@slatesvideo/shared 0.7.6 → 0.7.8

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 (1042) hide show
  1. package/README.md +3 -6
  2. package/dist/analytics/events.d.ts +1 -1
  3. package/dist/analytics/events.js +7 -0
  4. package/dist/auth.d.ts +2 -0
  5. package/dist/auth.js +5 -0
  6. package/dist/clients/cloud.d.ts +2 -0
  7. package/dist/clients/cloud.js +5 -1
  8. package/dist/index.d.ts +8 -4
  9. package/dist/index.js +8 -4
  10. package/dist/manual/content.d.ts +1 -1
  11. package/dist/manual/content.js +1 -1
  12. package/dist/operations/index.d.ts +1347 -122
  13. package/dist/operations/index.js +1926 -340
  14. package/dist/operations/surface.d.ts +3 -2
  15. package/dist/operations/surface.js +56 -5
  16. package/dist/prompts/agent-doctrine.d.ts +16 -0
  17. package/dist/prompts/agent-doctrine.js +114 -37
  18. package/dist/prompts/banned-tokens.js +23 -13
  19. package/dist/prompts/brain.d.ts +29 -0
  20. package/dist/prompts/brain.js +72 -0
  21. package/dist/prompts/craft-cards.d.ts +15 -4
  22. package/dist/prompts/craft-cards.js +71 -9
  23. package/dist/prompts/generation-policy.d.ts +1 -1
  24. package/dist/prompts/generation-policy.js +1 -1
  25. package/dist/prompts/guide-discovery.d.ts +13 -1
  26. package/dist/prompts/guide-discovery.js +18 -8
  27. package/dist/prompts/guide-retrieval.d.ts +7 -1
  28. package/dist/prompts/guide-retrieval.js +33 -5
  29. package/dist/prompts/model-capabilities.d.ts +30 -2
  30. package/dist/prompts/model-capabilities.js +169 -27
  31. package/dist/prompts/model-facts.d.ts +1 -1
  32. package/dist/prompts/model-facts.js +52 -40
  33. package/dist/prompts/partials.generated.js +2 -12
  34. package/dist/prompts/prompting-tips.d.ts +1 -1
  35. package/dist/prompts/prompting-tips.js +73 -28
  36. package/dist/prompts/shot-grammar.d.ts +1 -1
  37. package/dist/prompts/shot-grammar.js +1 -1
  38. package/dist/prompts/shot-spec.d.ts +1 -1
  39. package/dist/skills/brain-check.d.ts +44 -0
  40. package/dist/skills/brain-check.js +172 -0
  41. package/dist/skills/content.d.ts +3 -0
  42. package/dist/skills/content.js +81 -36
  43. package/dist/skills/hyperframes-content.d.ts +3 -0
  44. package/dist/skills/hyperframes-content.js +337 -0
  45. package/dist/skills/hyperframes.d.ts +44 -0
  46. package/dist/skills/hyperframes.js +108 -0
  47. package/dist/skills/my-brain.d.ts +52 -0
  48. package/dist/skills/my-brain.js +218 -0
  49. package/dist/skills/served.d.ts +52 -0
  50. package/dist/skills/served.js +202 -0
  51. package/package.json +2 -4
  52. package/skills/_partials/living-performance-short.md +2 -0
  53. package/skills/hyperframes/LICENSE-hyperframes +190 -0
  54. package/skills/hyperframes/NOTICE +36 -0
  55. package/skills/hyperframes/SLATES-MAPPING.md +59 -0
  56. package/skills/hyperframes/embedded-captions/CATALOG.md +94 -0
  57. package/skills/hyperframes/embedded-captions/SKILL.md +283 -0
  58. package/skills/hyperframes/embedded-captions/assets/fonts/char-widths.json +2437 -0
  59. package/skills/hyperframes/embedded-captions/assets/strokefonts/HersheyScript1.svg +242 -0
  60. package/skills/hyperframes/embedded-captions/assets/strokefonts/HersheyScriptMed.svg +242 -0
  61. package/skills/hyperframes/embedded-captions/dna/README.md +148 -0
  62. package/skills/hyperframes/embedded-captions/dna/chrome.json +68 -0
  63. package/skills/hyperframes/embedded-captions/dna/cream.json +69 -0
  64. package/skills/hyperframes/embedded-captions/dna/documentary.json +62 -0
  65. package/skills/hyperframes/embedded-captions/dna/editorial.json +70 -0
  66. package/skills/hyperframes/embedded-captions/dna/glitch.json +82 -0
  67. package/skills/hyperframes/embedded-captions/dna/ink.json +65 -0
  68. package/skills/hyperframes/embedded-captions/dna/keynote.json +62 -0
  69. package/skills/hyperframes/embedded-captions/dna/loud.json +75 -0
  70. package/skills/hyperframes/embedded-captions/dna/neon.json +58 -0
  71. package/skills/hyperframes/embedded-captions/dna/velocity.json +89 -0
  72. package/skills/hyperframes/embedded-captions/modes/cinematic/README.md +48 -0
  73. package/skills/hyperframes/embedded-captions/modes/cinematic/_archive/champion/spec.md +98 -0
  74. package/skills/hyperframes/embedded-captions/modes/cinematic/_archive/champion/template.html +188 -0
  75. package/skills/hyperframes/embedded-captions/modes/cinematic/_archive/memory-wall/spec.md +134 -0
  76. package/skills/hyperframes/embedded-captions/modes/cinematic/_archive/memory-wall/template.html +179 -0
  77. package/skills/hyperframes/embedded-captions/modes/cinematic/_archive/portrait-header/spec.md +81 -0
  78. package/skills/hyperframes/embedded-captions/modes/cinematic/_archive/portrait-header/template.html +170 -0
  79. package/skills/hyperframes/embedded-captions/modes/cinematic/cinematic-cream/spec.md +16 -0
  80. package/skills/hyperframes/embedded-captions/modes/cinematic/cinematic-cream/template.html +217 -0
  81. package/skills/hyperframes/embedded-captions/modes/cinematic/engine.html +346 -0
  82. package/skills/hyperframes/embedded-captions/modes/standard/_anatomy.md +233 -0
  83. package/skills/hyperframes/embedded-captions/modes/standard/_motion.md +192 -0
  84. package/skills/hyperframes/embedded-captions/modes/standard/fonts/build-fonts-css.cjs +114 -0
  85. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/anton-latin-400-normal.woff2 +0 -0
  86. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/archivo-latin-wdth-italic.woff2 +0 -0
  87. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/archivo-latin-wdth-normal.woff2 +0 -0
  88. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/audiowide-latin-400-normal.woff2 +0 -0
  89. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/baloo-2-latin-400-normal.woff2 +0 -0
  90. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/baloo-2-latin-700-normal.woff2 +0 -0
  91. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/bangers-latin-400-normal.woff2 +0 -0
  92. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/bodoni-moda-latin-400-normal.woff2 +0 -0
  93. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/bodoni-moda-latin-700-normal.woff2 +0 -0
  94. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/caveat-latin-400-normal.woff2 +0 -0
  95. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/caveat-latin-700-normal.woff2 +0 -0
  96. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/chakra-petch-latin-500-normal.woff2 +0 -0
  97. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/chakra-petch-latin-700-normal.woff2 +0 -0
  98. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/cinzel-latin-400-normal.woff2 +0 -0
  99. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/cinzel-latin-700-normal.woff2 +0 -0
  100. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/cormorant-garamond-latin-400-normal.woff2 +0 -0
  101. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/cormorant-garamond-latin-700-normal.woff2 +0 -0
  102. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/creepster-latin-400-normal.woff2 +0 -0
  103. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/fredoka-latin-400-normal.woff2 +0 -0
  104. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/fredoka-latin-700-normal.woff2 +0 -0
  105. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/inter-latin-400-normal.woff2 +0 -0
  106. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/inter-latin-500-italic.woff2 +0 -0
  107. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/inter-latin-500-normal.woff2 +0 -0
  108. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/inter-latin-600-italic.woff2 +0 -0
  109. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/inter-latin-600-normal.woff2 +0 -0
  110. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/inter-latin-700-normal.woff2 +0 -0
  111. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/inter-latin-800-normal.woff2 +0 -0
  112. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/inter-latin-900-normal.woff2 +0 -0
  113. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/monoton-latin-400-normal.woff2 +0 -0
  114. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/orbitron-latin-400-normal.woff2 +0 -0
  115. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/orbitron-latin-700-normal.woff2 +0 -0
  116. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/permanent-marker-latin-400-normal.woff2 +0 -0
  117. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/press-start-2p-latin-400-normal.woff2 +0 -0
  118. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/rajdhani-latin-500-normal.woff2 +0 -0
  119. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/rajdhani-latin-700-normal.woff2 +0 -0
  120. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/saira-stencil-one-latin-400-normal.woff2 +0 -0
  121. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/shippori-mincho-latin-400-normal.woff2 +0 -0
  122. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/shippori-mincho-latin-700-normal.woff2 +0 -0
  123. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/sora-latin-400-normal.woff2 +0 -0
  124. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/sora-latin-700-normal.woff2 +0 -0
  125. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/space-grotesk-latin-400-normal.woff2 +0 -0
  126. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/space-grotesk-latin-700-normal.woff2 +0 -0
  127. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/special-elite-latin-400-normal.woff2 +0 -0
  128. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/teko-latin-400-normal.woff2 +0 -0
  129. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/teko-latin-700-normal.woff2 +0 -0
  130. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/vt323-latin-400-normal.woff2 +0 -0
  131. package/skills/hyperframes/embedded-captions/references/aesthetic-principles.md +167 -0
  132. package/skills/hyperframes/embedded-captions/references/anti-patterns.md +188 -0
  133. package/skills/hyperframes/embedded-captions/references/bespoke-vs-presets.md +178 -0
  134. package/skills/hyperframes/embedded-captions/references/caption-grouping.md +130 -0
  135. package/skills/hyperframes/embedded-captions/references/composition-craft.md +522 -0
  136. package/skills/hyperframes/embedded-captions/references/direction-catalog.md +138 -0
  137. package/skills/hyperframes/embedded-captions/references/example-renders/champion.html +371 -0
  138. package/skills/hyperframes/embedded-captions/references/example-renders/memory-wall.html +334 -0
  139. package/skills/hyperframes/embedded-captions/references/failure-modes.md +145 -0
  140. package/skills/hyperframes/embedded-captions/references/layout-heuristics.md +238 -0
  141. package/skills/hyperframes/embedded-captions/references/motion-vocabulary.md +148 -0
  142. package/skills/hyperframes/embedded-captions/references/rail.md +68 -0
  143. package/skills/hyperframes/embedded-captions/references/reference-bar.md +47 -0
  144. package/skills/hyperframes/embedded-captions/references/scene-types.md +94 -0
  145. package/skills/hyperframes/embedded-captions/references/typographic-moves.md +266 -0
  146. package/skills/hyperframes/embedded-captions/references/typography-presets.md +63 -0
  147. package/skills/hyperframes/embedded-captions/scripts/audio-envelope.cjs +95 -0
  148. package/skills/hyperframes/embedded-captions/scripts/check-occlusion.cjs +253 -0
  149. package/skills/hyperframes/embedded-captions/scripts/check-overflow.cjs +195 -0
  150. package/skills/hyperframes/embedded-captions/scripts/check-rail-climax.cjs +237 -0
  151. package/skills/hyperframes/embedded-captions/scripts/check-timing.cjs +173 -0
  152. package/skills/hyperframes/embedded-captions/scripts/fill-timings.cjs +124 -0
  153. package/skills/hyperframes/embedded-captions/scripts/fit-fonts.cjs +158 -0
  154. package/skills/hyperframes/embedded-captions/scripts/fixtures/heroless/theme.json +11 -0
  155. package/skills/hyperframes/embedded-captions/scripts/gen-stroke-path.py +57 -0
  156. package/skills/hyperframes/embedded-captions/scripts/hf-cli.cjs +33 -0
  157. package/skills/hyperframes/embedded-captions/scripts/inject-fonts.cjs +169 -0
  158. package/skills/hyperframes/embedded-captions/scripts/lib-dna.cjs +201 -0
  159. package/skills/hyperframes/embedded-captions/scripts/make-cinematic.cjs +1206 -0
  160. package/skills/hyperframes/embedded-captions/scripts/make-composition.cjs +405 -0
  161. package/skills/hyperframes/embedded-captions/scripts/make-theme.cjs +9056 -0
  162. package/skills/hyperframes/embedded-captions/scripts/make-theme.test.mjs +132 -0
  163. package/skills/hyperframes/embedded-captions/scripts/matte.cjs +268 -0
  164. package/skills/hyperframes/embedded-captions/scripts/measure-layout.cjs +294 -0
  165. package/skills/hyperframes/embedded-captions/scripts/prepare.sh +39 -0
  166. package/skills/hyperframes/embedded-captions/scripts/preview-frames.cjs +296 -0
  167. package/skills/hyperframes/embedded-captions/scripts/preview-frames.test.mjs +24 -0
  168. package/skills/hyperframes/embedded-captions/scripts/render-and-composite.sh +425 -0
  169. package/skills/hyperframes/embedded-captions/scripts/render-theme.sh +34 -0
  170. package/skills/hyperframes/embedded-captions/scripts/safe-zones.cjs +816 -0
  171. package/skills/hyperframes/embedded-captions/scripts/transcribe.cjs +327 -0
  172. package/skills/hyperframes/embedded-captions/scripts/transcribe.test.mjs +69 -0
  173. package/skills/hyperframes/embedded-captions/themes/README.md +268 -0
  174. package/skills/hyperframes/embedded-captions/themes/anchor.json +27 -0
  175. package/skills/hyperframes/embedded-captions/themes/arcade.json +51 -0
  176. package/skills/hyperframes/embedded-captions/themes/aurora.json +41 -0
  177. package/skills/hyperframes/embedded-captions/themes/biolume.json +35 -0
  178. package/skills/hyperframes/embedded-captions/themes/brush.json +74 -0
  179. package/skills/hyperframes/embedded-captions/themes/chalkboard.json +52 -0
  180. package/skills/hyperframes/embedded-captions/themes/dossier.json +56 -0
  181. package/skills/hyperframes/embedded-captions/themes/graffiti.json +62 -0
  182. package/skills/hyperframes/embedded-captions/themes/hologram.json +41 -0
  183. package/skills/hyperframes/embedded-captions/themes/inkwater.json +43 -0
  184. package/skills/hyperframes/embedded-captions/themes/laser.json +46 -0
  185. package/skills/hyperframes/embedded-captions/themes/lastpage.json +33 -0
  186. package/skills/hyperframes/embedded-captions/themes/lesson.json +31 -0
  187. package/skills/hyperframes/embedded-captions/themes/neonsign.json +53 -0
  188. package/skills/hyperframes/embedded-captions/themes/ordnance.json +54 -0
  189. package/skills/hyperframes/embedded-captions/themes/papercut.json +37 -0
  190. package/skills/hyperframes/embedded-captions/themes/popup.json +46 -0
  191. package/skills/hyperframes/embedded-captions/themes/ransom.json +62 -0
  192. package/skills/hyperframes/embedded-captions/themes/scoreboard.json +54 -0
  193. package/skills/hyperframes/embedded-captions/themes/spectrum.json +46 -0
  194. package/skills/hyperframes/embedded-captions/themes/stardust.json +29 -0
  195. package/skills/hyperframes/embedded-captions/themes/stomp.json +43 -0
  196. package/skills/hyperframes/embedded-captions/themes/terminal.json +49 -0
  197. package/skills/hyperframes/embedded-captions/themes/thunder.json +44 -0
  198. package/skills/hyperframes/embedded-captions/themes/transit.json +44 -0
  199. package/skills/hyperframes/embedded-captions/themes/vhs.json +47 -0
  200. package/skills/hyperframes/faceless-explainer/SKILL.md +241 -0
  201. package/skills/hyperframes/faceless-explainer/references/cut-catalog.md +215 -0
  202. package/skills/hyperframes/faceless-explainer/references/motion-language.md +156 -0
  203. package/skills/hyperframes/faceless-explainer/references/story-design.md +255 -0
  204. package/skills/hyperframes/faceless-explainer/references/visual-design.md +146 -0
  205. package/skills/hyperframes/faceless-explainer/scripts/assemble-index.mjs +625 -0
  206. package/skills/hyperframes/faceless-explainer/scripts/assemble-index.test.mjs +127 -0
  207. package/skills/hyperframes/faceless-explainer/scripts/audio.mjs +338 -0
  208. package/skills/hyperframes/faceless-explainer/scripts/audio.test.mjs +341 -0
  209. package/skills/hyperframes/faceless-explainer/scripts/build-frame.mjs +554 -0
  210. package/skills/hyperframes/faceless-explainer/scripts/captions.mjs +524 -0
  211. package/skills/hyperframes/faceless-explainer/scripts/captions.test.mjs +219 -0
  212. package/skills/hyperframes/faceless-explainer/scripts/frame-packets.mjs +27 -0
  213. package/skills/hyperframes/faceless-explainer/scripts/frame-packets.test.mjs +66 -0
  214. package/skills/hyperframes/faceless-explainer/scripts/lib/assets.mjs +56 -0
  215. package/skills/hyperframes/faceless-explainer/scripts/lib/bgm-volume.mjs +4 -0
  216. package/skills/hyperframes/faceless-explainer/scripts/lib/captured-fonts.mjs +58 -0
  217. package/skills/hyperframes/faceless-explainer/scripts/lib/dimensions.mjs +45 -0
  218. package/skills/hyperframes/faceless-explainer/scripts/lib/frame-packets-core.mjs +194 -0
  219. package/skills/hyperframes/faceless-explainer/scripts/lib/host-audio.mjs +28 -0
  220. package/skills/hyperframes/faceless-explainer/scripts/lib/pad-frame-duration.mjs +36 -0
  221. package/skills/hyperframes/faceless-explainer/scripts/lib/storyboard.mjs +249 -0
  222. package/skills/hyperframes/faceless-explainer/scripts/lib/tokens.mjs +211 -0
  223. package/skills/hyperframes/faceless-explainer/scripts/lib/transition-registry.mjs +38 -0
  224. package/skills/hyperframes/faceless-explainer/scripts/lib/transitions.json +71 -0
  225. package/skills/hyperframes/faceless-explainer/scripts/transitions.mjs +384 -0
  226. package/skills/hyperframes/faceless-explainer/scripts/transitions.test.mjs +70 -0
  227. package/skills/hyperframes/faceless-explainer/sub-agents/frame-worker.md +12 -0
  228. package/skills/hyperframes/figma/SKILL.md +134 -0
  229. package/skills/hyperframes/figma/scripts/verify-motion.mjs +153 -0
  230. package/skills/hyperframes/general-video/SKILL.md +168 -0
  231. package/skills/hyperframes/general-video/scripts/frame-packets.mjs +38 -0
  232. package/skills/hyperframes/general-video/scripts/frame-packets.test.mjs +80 -0
  233. package/skills/hyperframes/general-video/scripts/lib/frame-packets-core.mjs +194 -0
  234. package/skills/hyperframes/general-video/sub-agents/frame-worker.md +34 -0
  235. package/skills/hyperframes/hyperframes/SKILL.md +154 -0
  236. package/skills/hyperframes/hyperframes/references/brief-contract.md +108 -0
  237. package/skills/hyperframes/hyperframes/references/brief-format.md +72 -0
  238. package/skills/hyperframes/hyperframes/references/capability-menu.md +47 -0
  239. package/skills/hyperframes/hyperframes/references/frame-worker-core.md +80 -0
  240. package/skills/hyperframes/hyperframes/references/intent-interview.md +73 -0
  241. package/skills/hyperframes/hyperframes/references/pitch-round.md +40 -0
  242. package/skills/hyperframes/hyperframes/references/plugin-installation.md +43 -0
  243. package/skills/hyperframes/hyperframes/references/production-loop.md +26 -0
  244. package/skills/hyperframes/hyperframes/references/review-loop.md +37 -0
  245. package/skills/hyperframes/hyperframes/references/route-briefs.md +11 -0
  246. package/skills/hyperframes/hyperframes/references/routes/embedded-captions.md +11 -0
  247. package/skills/hyperframes/hyperframes/references/routes/faceless-explainer.md +12 -0
  248. package/skills/hyperframes/hyperframes/references/routes/general-video.md +12 -0
  249. package/skills/hyperframes/hyperframes/references/routes/motion-graphics.md +11 -0
  250. package/skills/hyperframes/hyperframes/references/routes/music-to-video.md +12 -0
  251. package/skills/hyperframes/hyperframes/references/routes/pr-to-video.md +28 -0
  252. package/skills/hyperframes/hyperframes/references/routes/product-launch-video.md +13 -0
  253. package/skills/hyperframes/hyperframes/references/routes/remotion-to-hyperframes.md +9 -0
  254. package/skills/hyperframes/hyperframes/references/routes/slideshow.md +11 -0
  255. package/skills/hyperframes/hyperframes/references/routes/talking-head-recut.md +11 -0
  256. package/skills/hyperframes/hyperframes/references/script-format.md +52 -0
  257. package/skills/hyperframes/hyperframes/references/skill-lifecycle.md +35 -0
  258. package/skills/hyperframes/hyperframes/references/storyboard-format.md +99 -0
  259. package/skills/hyperframes/hyperframes/references/subagent-dispatch.md +35 -0
  260. package/skills/hyperframes/hyperframes/references/workflow-catalog.md +10 -0
  261. package/skills/hyperframes/hyperframes/scripts/lib/frame-packets-core.mjs +194 -0
  262. package/skills/hyperframes/hyperframes/scripts/plugin-cli.mjs +88 -0
  263. package/skills/hyperframes/hyperframes/scripts/plugin-cli.test.mjs +117 -0
  264. package/skills/hyperframes/hyperframes-animation/SKILL.md +88 -0
  265. package/skills/hyperframes/hyperframes-animation/adapters/animate-text.md +64 -0
  266. package/skills/hyperframes/hyperframes-animation/adapters/animejs.md +130 -0
  267. package/skills/hyperframes/hyperframes-animation/adapters/css-animations.md +143 -0
  268. package/skills/hyperframes/hyperframes-animation/adapters/gsap-easing-and-stagger.md +199 -0
  269. package/skills/hyperframes/hyperframes-animation/adapters/gsap-timeline-and-labels.md +96 -0
  270. package/skills/hyperframes/hyperframes-animation/adapters/gsap-transforms-and-perf.md +129 -0
  271. package/skills/hyperframes/hyperframes-animation/adapters/gsap.md +105 -0
  272. package/skills/hyperframes/hyperframes-animation/adapters/html-in-canvas-patterns.md +507 -0
  273. package/skills/hyperframes/hyperframes-animation/adapters/lottie.md +130 -0
  274. package/skills/hyperframes/hyperframes-animation/adapters/three.md +176 -0
  275. package/skills/hyperframes/hyperframes-animation/adapters/typegpu.md +182 -0
  276. package/skills/hyperframes/hyperframes-animation/adapters/waapi.md +101 -0
  277. package/skills/hyperframes/hyperframes-animation/blueprints/agent-progress-theater.md +76 -0
  278. package/skills/hyperframes/hyperframes-animation/blueprints/camera-journey.md +61 -0
  279. package/skills/hyperframes/hyperframes-animation/blueprints/comparison-split.md +27 -0
  280. package/skills/hyperframes/hyperframes-animation/blueprints/constellation-hub.md +63 -0
  281. package/skills/hyperframes/hyperframes-animation/blueprints/cta-morph-press.md +63 -0
  282. package/skills/hyperframes/hyperframes-animation/blueprints/cursor-ui-demo.md +89 -0
  283. package/skills/hyperframes/hyperframes-animation/blueprints/dataviz-countup.md +59 -0
  284. package/skills/hyperframes/hyperframes-animation/blueprints/device-surface-showcase.md +68 -0
  285. package/skills/hyperframes/hyperframes-animation/blueprints/fixed-anchor-cycle.md +46 -0
  286. package/skills/hyperframes/hyperframes-animation/blueprints/grid-card-assemble.md +81 -0
  287. package/skills/hyperframes/hyperframes-animation/blueprints/kinetic-type-beats.md +133 -0
  288. package/skills/hyperframes/hyperframes-animation/blueprints/logo-assemble-lockup.md +121 -0
  289. package/skills/hyperframes/hyperframes-animation/blueprints/overwhelm-surround.md +58 -0
  290. package/skills/hyperframes/hyperframes-animation/blueprints/panel-edit-live-sync.md +73 -0
  291. package/skills/hyperframes/hyperframes-animation/blueprints/prompt-type-submit-generate.md +85 -0
  292. package/skills/hyperframes/hyperframes-animation/blueprints/spatial-pan-stations.md +37 -0
  293. package/skills/hyperframes/hyperframes-animation/blueprints/ticker-takeover.md +29 -0
  294. package/skills/hyperframes/hyperframes-animation/blueprints/titlecard-reveal.md +80 -0
  295. package/skills/hyperframes/hyperframes-animation/blueprints/transcript-scroll-artifact-reveal.md +45 -0
  296. package/skills/hyperframes/hyperframes-animation/blueprints/typewriter-reveal.md +51 -0
  297. package/skills/hyperframes/hyperframes-animation/blueprints/video-text-pivot.md +30 -0
  298. package/skills/hyperframes/hyperframes-animation/blueprints/zoom-out-workspace-reveal.md +68 -0
  299. package/skills/hyperframes/hyperframes-animation/blueprints-index.md +202 -0
  300. package/skills/hyperframes/hyperframes-animation/examples/brand-reveal-assemble-zoom.html +382 -0
  301. package/skills/hyperframes/hyperframes-animation/examples/comparison-split-cards.html +649 -0
  302. package/skills/hyperframes/hyperframes-animation/examples/concept-demo-decode-pan.html +520 -0
  303. package/skills/hyperframes/hyperframes-animation/examples/cta-morph-press.html +468 -0
  304. package/skills/hyperframes/hyperframes-animation/examples/cta-orbit-collapse.html +1298 -0
  305. package/skills/hyperframes/hyperframes-animation/examples/demo-page-scroll-spotlight.html +759 -0
  306. package/skills/hyperframes/hyperframes-animation/examples/hook-counter-burst.html +729 -0
  307. package/skills/hyperframes/hyperframes-animation/examples/messaging-multi-phrase.html +352 -0
  308. package/skills/hyperframes/hyperframes-animation/examples/metric-video-text-pivot.html +779 -0
  309. package/skills/hyperframes/hyperframes-animation/examples/problem-mockup-overwhelm.html +1374 -0
  310. package/skills/hyperframes/hyperframes-animation/examples/proof-logo-chain.html +861 -0
  311. package/skills/hyperframes/hyperframes-animation/examples/takeover-ticker-displace.html +347 -0
  312. package/skills/hyperframes/hyperframes-animation/examples/workflow-approve-press.html +606 -0
  313. package/skills/hyperframes/hyperframes-animation/references/motion-blur.md +134 -0
  314. package/skills/hyperframes/hyperframes-animation/rules/3d-camera-flight.md +180 -0
  315. package/skills/hyperframes/hyperframes-animation/rules/3d-page-scroll.md +135 -0
  316. package/skills/hyperframes/hyperframes-animation/rules/3d-text-depth-layers.md +128 -0
  317. package/skills/hyperframes/hyperframes-animation/rules/ai-tracking-box.md +139 -0
  318. package/skills/hyperframes/hyperframes-animation/rules/ambient-glow-bloom.md +133 -0
  319. package/skills/hyperframes/hyperframes-animation/rules/anchored-layout-expand.md +148 -0
  320. package/skills/hyperframes/hyperframes-animation/rules/asr-keyword-glow.md +128 -0
  321. package/skills/hyperframes/hyperframes-animation/rules/avatar-cloud-network.md +145 -0
  322. package/skills/hyperframes/hyperframes-animation/rules/camera-cursor-tracking.md +133 -0
  323. package/skills/hyperframes/hyperframes-animation/rules/card-morph-anchor.md +134 -0
  324. package/skills/hyperframes/hyperframes-animation/rules/center-outward-expansion.md +88 -0
  325. package/skills/hyperframes/hyperframes-animation/rules/chart-scrub-readout.md +151 -0
  326. package/skills/hyperframes/hyperframes-animation/rules/chromatic-glitch.md +150 -0
  327. package/skills/hyperframes/hyperframes-animation/rules/context-sensitive-cursor.md +140 -0
  328. package/skills/hyperframes/hyperframes-animation/rules/control-target-sync.md +131 -0
  329. package/skills/hyperframes/hyperframes-animation/rules/coordinate-target-zoom.md +138 -0
  330. package/skills/hyperframes/hyperframes-animation/rules/counting-dynamic-scale.md +115 -0
  331. package/skills/hyperframes/hyperframes-animation/rules/css-marker-patterns.md +208 -0
  332. package/skills/hyperframes/hyperframes-animation/rules/cursor-click-ripple.md +104 -0
  333. package/skills/hyperframes/hyperframes-animation/rules/cursor-drag.md +141 -0
  334. package/skills/hyperframes/hyperframes-animation/rules/depth-of-field-blur.md +112 -0
  335. package/skills/hyperframes/hyperframes-animation/rules/depth-scatter-assemble.md +139 -0
  336. package/skills/hyperframes/hyperframes-animation/rules/discrete-text-sequence.md +146 -0
  337. package/skills/hyperframes/hyperframes-animation/rules/dynamic-content-sequencing.md +149 -0
  338. package/skills/hyperframes/hyperframes-animation/rules/gradient-text-sweep.md +136 -0
  339. package/skills/hyperframes/hyperframes-animation/rules/gsap-effects.md +196 -0
  340. package/skills/hyperframes/hyperframes-animation/rules/hacker-flip-3d.md +123 -0
  341. package/skills/hyperframes/hyperframes-animation/rules/kinetic-beat-slam.md +137 -0
  342. package/skills/hyperframes/hyperframes-animation/rules/motion-blur-streak.md +187 -0
  343. package/skills/hyperframes/hyperframes-animation/rules/multi-cursor-choreography.md +133 -0
  344. package/skills/hyperframes/hyperframes-animation/rules/multi-phase-camera.md +129 -0
  345. package/skills/hyperframes/hyperframes-animation/rules/nudge-curve.md +47 -0
  346. package/skills/hyperframes/hyperframes-animation/rules/orbit-3d-entry.md +148 -0
  347. package/skills/hyperframes/hyperframes-animation/rules/particle-burst.md +149 -0
  348. package/skills/hyperframes/hyperframes-animation/rules/physics-press-reaction.md +101 -0
  349. package/skills/hyperframes/hyperframes-animation/rules/press-release-spring.md +108 -0
  350. package/skills/hyperframes/hyperframes-animation/rules/reactive-displacement.md +92 -0
  351. package/skills/hyperframes/hyperframes-animation/rules/scale-swap-transition.md +88 -0
  352. package/skills/hyperframes/hyperframes-animation/rules/sine-wave-loop.md +85 -0
  353. package/skills/hyperframes/hyperframes-animation/rules/split-tilt-cards.md +123 -0
  354. package/skills/hyperframes/hyperframes-animation/rules/spring-pop-entrance.md +107 -0
  355. package/skills/hyperframes/hyperframes-animation/rules/stat-bars-and-fills.md +145 -0
  356. package/skills/hyperframes/hyperframes-animation/rules/svg-icon-enrichment.md +141 -0
  357. package/skills/hyperframes/hyperframes-animation/rules/svg-path-draw.md +122 -0
  358. package/skills/hyperframes/hyperframes-animation/rules/theme-crossfade-morph.md +126 -0
  359. package/skills/hyperframes/hyperframes-animation/rules/vertical-spring-ticker.md +104 -0
  360. package/skills/hyperframes/hyperframes-animation/rules/viewport-change.md +148 -0
  361. package/skills/hyperframes/hyperframes-animation/rules/waterfall-entry.md +81 -0
  362. package/skills/hyperframes/hyperframes-animation/rules-index.md +113 -0
  363. package/skills/hyperframes/hyperframes-animation/scripts/animation-map-sampling.mjs +40 -0
  364. package/skills/hyperframes/hyperframes-animation/scripts/animation-map-sampling.test.mjs +48 -0
  365. package/skills/hyperframes/hyperframes-animation/scripts/animation-map.mjs +659 -0
  366. package/skills/hyperframes/hyperframes-animation/scripts/animation-map.test.mjs +444 -0
  367. package/skills/hyperframes/hyperframes-animation/scripts/package-loader.mjs +415 -0
  368. package/skills/hyperframes/hyperframes-animation/scripts/package-loader.test.mjs +114 -0
  369. package/skills/hyperframes/hyperframes-animation/techniques.md +507 -0
  370. package/skills/hyperframes/hyperframes-animation/transitions/TRANSITION-REGISTRY.md +168 -0
  371. package/skills/hyperframes/hyperframes-animation/transitions/catalog.md +127 -0
  372. package/skills/hyperframes/hyperframes-animation/transitions/css-3d.md +12 -0
  373. package/skills/hyperframes/hyperframes-animation/transitions/css-blur.md +51 -0
  374. package/skills/hyperframes/hyperframes-animation/transitions/css-cover.md +43 -0
  375. package/skills/hyperframes/hyperframes-animation/transitions/css-destruction.md +95 -0
  376. package/skills/hyperframes/hyperframes-animation/transitions/css-dissolve.md +66 -0
  377. package/skills/hyperframes/hyperframes-animation/transitions/css-distortion.md +45 -0
  378. package/skills/hyperframes/hyperframes-animation/transitions/css-grid.md +10 -0
  379. package/skills/hyperframes/hyperframes-animation/transitions/css-light.md +49 -0
  380. package/skills/hyperframes/hyperframes-animation/transitions/css-mechanical.md +30 -0
  381. package/skills/hyperframes/hyperframes-animation/transitions/css-other.md +25 -0
  382. package/skills/hyperframes/hyperframes-animation/transitions/css-push.md +41 -0
  383. package/skills/hyperframes/hyperframes-animation/transitions/css-radial.md +37 -0
  384. package/skills/hyperframes/hyperframes-animation/transitions/css-scale.md +24 -0
  385. package/skills/hyperframes/hyperframes-animation/transitions/overview.md +153 -0
  386. package/skills/hyperframes/hyperframes-audio/SKILL.md +475 -0
  387. package/skills/hyperframes/hyperframes-audio/references/attributes.md +138 -0
  388. package/skills/hyperframes/hyperframes-audio/references/diagnosis.md +276 -0
  389. package/skills/hyperframes/hyperframes-audio/references/fx-registry.md +84 -0
  390. package/skills/hyperframes/hyperframes-audio/references/presets.md +216 -0
  391. package/skills/hyperframes/hyperframes-audio/scripts/carve.mjs +572 -0
  392. package/skills/hyperframes/hyperframes-audio/scripts/carve.test.mjs +254 -0
  393. package/skills/hyperframes/hyperframes-cli/SKILL.md +194 -0
  394. package/skills/hyperframes/hyperframes-cli/references/beats.md +19 -0
  395. package/skills/hyperframes/hyperframes-cli/references/cloud.md +163 -0
  396. package/skills/hyperframes/hyperframes-cli/references/cloudrun.md +62 -0
  397. package/skills/hyperframes/hyperframes-cli/references/compare-and-batch.md +105 -0
  398. package/skills/hyperframes/hyperframes-cli/references/doctor-browser.md +57 -0
  399. package/skills/hyperframes/hyperframes-cli/references/init-and-scaffold.md +74 -0
  400. package/skills/hyperframes/hyperframes-cli/references/lambda.md +185 -0
  401. package/skills/hyperframes/hyperframes-cli/references/lint-validate-inspect.md +132 -0
  402. package/skills/hyperframes/hyperframes-cli/references/preview-render.md +193 -0
  403. package/skills/hyperframes/hyperframes-cli/references/upgrade-info-misc.md +134 -0
  404. package/skills/hyperframes/hyperframes-core/SKILL.md +100 -0
  405. package/skills/hyperframes/hyperframes-core/references/composition-patterns.md +224 -0
  406. package/skills/hyperframes/hyperframes-core/references/creator-editing-recipes.md +439 -0
  407. package/skills/hyperframes/hyperframes-core/references/data-attributes.md +80 -0
  408. package/skills/hyperframes/hyperframes-core/references/determinism-rules.md +53 -0
  409. package/skills/hyperframes/hyperframes-core/references/full-screen-motion.md +67 -0
  410. package/skills/hyperframes/hyperframes-core/references/minimal-composition.md +69 -0
  411. package/skills/hyperframes/hyperframes-core/references/sub-compositions.md +176 -0
  412. package/skills/hyperframes/hyperframes-core/references/tailwind.md +104 -0
  413. package/skills/hyperframes/hyperframes-core/references/tracks-and-clips.md +121 -0
  414. package/skills/hyperframes/hyperframes-core/references/variables-and-media.md +109 -0
  415. package/skills/hyperframes/hyperframes-creative/SKILL.md +73 -0
  416. package/skills/hyperframes/hyperframes-creative/frame-presets/biennale-yellow/FRAME.md +289 -0
  417. package/skills/hyperframes/hyperframes-creative/frame-presets/biennale-yellow/caption-skin.html +221 -0
  418. package/skills/hyperframes/hyperframes-creative/frame-presets/biennale-yellow/frame-showcase.html +1214 -0
  419. package/skills/hyperframes/hyperframes-creative/frame-presets/blockframe/FRAME.md +275 -0
  420. package/skills/hyperframes/hyperframes-creative/frame-presets/blockframe/caption-skin.html +224 -0
  421. package/skills/hyperframes/hyperframes-creative/frame-presets/blockframe/frame-showcase.html +1347 -0
  422. package/skills/hyperframes/hyperframes-creative/frame-presets/blue-professional/FRAME.md +307 -0
  423. package/skills/hyperframes/hyperframes-creative/frame-presets/blue-professional/caption-skin.html +223 -0
  424. package/skills/hyperframes/hyperframes-creative/frame-presets/blue-professional/frame-showcase.html +1372 -0
  425. package/skills/hyperframes/hyperframes-creative/frame-presets/bold-poster/FRAME.md +275 -0
  426. package/skills/hyperframes/hyperframes-creative/frame-presets/bold-poster/caption-skin.html +230 -0
  427. package/skills/hyperframes/hyperframes-creative/frame-presets/bold-poster/frame-showcase.html +1140 -0
  428. package/skills/hyperframes/hyperframes-creative/frame-presets/broadside/FRAME.md +284 -0
  429. package/skills/hyperframes/hyperframes-creative/frame-presets/broadside/caption-skin.html +225 -0
  430. package/skills/hyperframes/hyperframes-creative/frame-presets/broadside/frame-showcase.html +1166 -0
  431. package/skills/hyperframes/hyperframes-creative/frame-presets/capsule/FRAME.md +284 -0
  432. package/skills/hyperframes/hyperframes-creative/frame-presets/capsule/caption-skin.html +224 -0
  433. package/skills/hyperframes/hyperframes-creative/frame-presets/capsule/frame-showcase.html +1465 -0
  434. package/skills/hyperframes/hyperframes-creative/frame-presets/cartesian/FRAME.md +278 -0
  435. package/skills/hyperframes/hyperframes-creative/frame-presets/cartesian/caption-skin.html +222 -0
  436. package/skills/hyperframes/hyperframes-creative/frame-presets/cartesian/frame-showcase.html +1263 -0
  437. package/skills/hyperframes/hyperframes-creative/frame-presets/cobalt-grid/FRAME.md +265 -0
  438. package/skills/hyperframes/hyperframes-creative/frame-presets/cobalt-grid/caption-skin.html +238 -0
  439. package/skills/hyperframes/hyperframes-creative/frame-presets/cobalt-grid/frame-showcase.html +1468 -0
  440. package/skills/hyperframes/hyperframes-creative/frame-presets/code-editorial/FRAME.md +277 -0
  441. package/skills/hyperframes/hyperframes-creative/frame-presets/code-editorial/caption-skin.html +224 -0
  442. package/skills/hyperframes/hyperframes-creative/frame-presets/code-editorial/fonts/EBGaramond-400.woff2 +0 -0
  443. package/skills/hyperframes/hyperframes-creative/frame-presets/code-editorial/fonts/EBGaramond-700.woff2 +0 -0
  444. package/skills/hyperframes/hyperframes-creative/frame-presets/code-editorial/fonts/Inter-400.woff2 +0 -0
  445. package/skills/hyperframes/hyperframes-creative/frame-presets/code-editorial/fonts/Inter-700.woff2 +0 -0
  446. package/skills/hyperframes/hyperframes-creative/frame-presets/code-editorial/fonts/JetBrainsMono-400.woff2 +0 -0
  447. package/skills/hyperframes/hyperframes-creative/frame-presets/code-editorial/fonts/JetBrainsMono-700.woff2 +0 -0
  448. package/skills/hyperframes/hyperframes-creative/frame-presets/code-editorial/fonts/OFL-eb-garamond.txt +93 -0
  449. package/skills/hyperframes/hyperframes-creative/frame-presets/code-editorial/fonts/OFL-inter.txt +93 -0
  450. package/skills/hyperframes/hyperframes-creative/frame-presets/code-editorial/fonts/OFL-jetbrains-mono.txt +93 -0
  451. package/skills/hyperframes/hyperframes-creative/frame-presets/code-editorial/frame-showcase.html +1438 -0
  452. package/skills/hyperframes/hyperframes-creative/frame-presets/coral/FRAME.md +314 -0
  453. package/skills/hyperframes/hyperframes-creative/frame-presets/coral/caption-skin.html +226 -0
  454. package/skills/hyperframes/hyperframes-creative/frame-presets/coral/frame-showcase.html +1268 -0
  455. package/skills/hyperframes/hyperframes-creative/frame-presets/creative-mode/FRAME.md +333 -0
  456. package/skills/hyperframes/hyperframes-creative/frame-presets/creative-mode/caption-skin.html +227 -0
  457. package/skills/hyperframes/hyperframes-creative/frame-presets/creative-mode/frame-showcase.html +1330 -0
  458. package/skills/hyperframes/hyperframes-creative/frame-presets/daisy-days/FRAME.md +274 -0
  459. package/skills/hyperframes/hyperframes-creative/frame-presets/daisy-days/caption-skin.html +230 -0
  460. package/skills/hyperframes/hyperframes-creative/frame-presets/daisy-days/frame-showcase.html +1444 -0
  461. package/skills/hyperframes/hyperframes-creative/frame-presets/editorial-forest/FRAME.md +265 -0
  462. package/skills/hyperframes/hyperframes-creative/frame-presets/editorial-forest/caption-skin.html +223 -0
  463. package/skills/hyperframes/hyperframes-creative/frame-presets/editorial-forest/frame-showcase.html +1273 -0
  464. package/skills/hyperframes/hyperframes-creative/palettes/bold-energetic.md +14 -0
  465. package/skills/hyperframes/hyperframes-creative/palettes/clean-corporate.md +14 -0
  466. package/skills/hyperframes/hyperframes-creative/palettes/dark-premium.md +14 -0
  467. package/skills/hyperframes/hyperframes-creative/palettes/jewel-rich.md +14 -0
  468. package/skills/hyperframes/hyperframes-creative/palettes/monochrome.md +14 -0
  469. package/skills/hyperframes/hyperframes-creative/palettes/nature-earth.md +14 -0
  470. package/skills/hyperframes/hyperframes-creative/palettes/neon-electric.md +14 -0
  471. package/skills/hyperframes/hyperframes-creative/palettes/pastel-soft.md +14 -0
  472. package/skills/hyperframes/hyperframes-creative/palettes/warm-editorial.md +14 -0
  473. package/skills/hyperframes/hyperframes-creative/references/audio-reactive.md +76 -0
  474. package/skills/hyperframes/hyperframes-creative/references/beat-direction.md +164 -0
  475. package/skills/hyperframes/hyperframes-creative/references/composition-patterns.md +199 -0
  476. package/skills/hyperframes/hyperframes-creative/references/data-in-motion.md +19 -0
  477. package/skills/hyperframes/hyperframes-creative/references/design-adherence.md +19 -0
  478. package/skills/hyperframes/hyperframes-creative/references/design-picker.md +123 -0
  479. package/skills/hyperframes/hyperframes-creative/references/design-spec.md +55 -0
  480. package/skills/hyperframes/hyperframes-creative/references/house-style.md +73 -0
  481. package/skills/hyperframes/hyperframes-creative/references/motion-principles.md +151 -0
  482. package/skills/hyperframes/hyperframes-creative/references/narration.md +92 -0
  483. package/skills/hyperframes/hyperframes-creative/references/prompt-expansion.md +68 -0
  484. package/skills/hyperframes/hyperframes-creative/references/story-spine.md +45 -0
  485. package/skills/hyperframes/hyperframes-creative/references/storyboard-recipe.md +57 -0
  486. package/skills/hyperframes/hyperframes-creative/references/typography.md +218 -0
  487. package/skills/hyperframes/hyperframes-creative/references/video-composition.md +63 -0
  488. package/skills/hyperframes/hyperframes-creative/references/visual-styles.md +457 -0
  489. package/skills/hyperframes/hyperframes-creative/scripts/contrast-report.mjs +538 -0
  490. package/skills/hyperframes/hyperframes-creative/scripts/extract-audio-data.py +199 -0
  491. package/skills/hyperframes/hyperframes-creative/scripts/package-loader.mjs +415 -0
  492. package/skills/hyperframes/hyperframes-creative/scripts/package-loader.test.mjs +114 -0
  493. package/skills/hyperframes/hyperframes-creative/templates/design-picker.html +1432 -0
  494. package/skills/hyperframes/hyperframes-keyframes/SKILL.md +263 -0
  495. package/skills/hyperframes/hyperframes-keyframes/agents/openai.yaml +4 -0
  496. package/skills/hyperframes/hyperframes-keyframes/references/keyframe-patterns.md +108 -0
  497. package/skills/hyperframes/hyperframes-registry/SKILL.md +147 -0
  498. package/skills/hyperframes/hyperframes-registry/examples/add-block.md +51 -0
  499. package/skills/hyperframes/hyperframes-registry/examples/add-component.md +73 -0
  500. package/skills/hyperframes/hyperframes-registry/references/component-quality-bar.md +250 -0
  501. package/skills/hyperframes/hyperframes-registry/references/contributing.md +180 -0
  502. package/skills/hyperframes/hyperframes-registry/references/demo-html-pattern.md +54 -0
  503. package/skills/hyperframes/hyperframes-registry/references/discovery.md +217 -0
  504. package/skills/hyperframes/hyperframes-registry/references/install-locations.md +45 -0
  505. package/skills/hyperframes/hyperframes-registry/references/placeholder-material.md +149 -0
  506. package/skills/hyperframes/hyperframes-registry/references/templates.md +417 -0
  507. package/skills/hyperframes/hyperframes-registry/references/wiring-blocks.md +61 -0
  508. package/skills/hyperframes/hyperframes-registry/references/wiring-components.md +39 -0
  509. package/skills/hyperframes/hyperframes-studio/SKILL.md +140 -0
  510. package/skills/hyperframes/media-use/SKILL.md +102 -0
  511. package/skills/hyperframes/media-use/audio/assets/sfx/CREDITS.md +35 -0
  512. package/skills/hyperframes/media-use/audio/assets/sfx/chime.mp3 +0 -0
  513. package/skills/hyperframes/media-use/audio/assets/sfx/click-soft.mp3 +0 -0
  514. package/skills/hyperframes/media-use/audio/assets/sfx/click.mp3 +0 -0
  515. package/skills/hyperframes/media-use/audio/assets/sfx/error.mp3 +0 -0
  516. package/skills/hyperframes/media-use/audio/assets/sfx/glitch-1.mp3 +0 -0
  517. package/skills/hyperframes/media-use/audio/assets/sfx/glitch-2.mp3 +0 -0
  518. package/skills/hyperframes/media-use/audio/assets/sfx/glitch-3.mp3 +0 -0
  519. package/skills/hyperframes/media-use/audio/assets/sfx/impact-bass-1.mp3 +0 -0
  520. package/skills/hyperframes/media-use/audio/assets/sfx/impact-bass-2.mp3 +0 -0
  521. package/skills/hyperframes/media-use/audio/assets/sfx/key-press.mp3 +0 -0
  522. package/skills/hyperframes/media-use/audio/assets/sfx/manifest.json +97 -0
  523. package/skills/hyperframes/media-use/audio/assets/sfx/notification.mp3 +0 -0
  524. package/skills/hyperframes/media-use/audio/assets/sfx/ping.mp3 +0 -0
  525. package/skills/hyperframes/media-use/audio/assets/sfx/pop.mp3 +0 -0
  526. package/skills/hyperframes/media-use/audio/assets/sfx/riser.mp3 +0 -0
  527. package/skills/hyperframes/media-use/audio/assets/sfx/sparkle.mp3 +0 -0
  528. package/skills/hyperframes/media-use/audio/assets/sfx/typing.mp3 +0 -0
  529. package/skills/hyperframes/media-use/audio/assets/sfx/whoosh-cinematic.mp3 +0 -0
  530. package/skills/hyperframes/media-use/audio/assets/sfx/whoosh-short.mp3 +0 -0
  531. package/skills/hyperframes/media-use/audio/assets/sfx/whoosh.mp3 +0 -0
  532. package/skills/hyperframes/media-use/audio/references/bgm.md +76 -0
  533. package/skills/hyperframes/media-use/audio/references/captions/authoring.md +163 -0
  534. package/skills/hyperframes/media-use/audio/references/captions/motion.md +87 -0
  535. package/skills/hyperframes/media-use/audio/references/captions/transcript-handling.md +97 -0
  536. package/skills/hyperframes/media-use/audio/references/remove-background.md +143 -0
  537. package/skills/hyperframes/media-use/audio/references/requirements.md +29 -0
  538. package/skills/hyperframes/media-use/audio/references/sfx.md +42 -0
  539. package/skills/hyperframes/media-use/audio/references/transcribe.md +52 -0
  540. package/skills/hyperframes/media-use/audio/references/tts-to-captions.md +35 -0
  541. package/skills/hyperframes/media-use/audio/references/tts.md +260 -0
  542. package/skills/hyperframes/media-use/audio/scripts/audio.mjs +311 -0
  543. package/skills/hyperframes/media-use/audio/scripts/audio.test.mjs +159 -0
  544. package/skills/hyperframes/media-use/audio/scripts/gemini-pipeline.test.mjs +131 -0
  545. package/skills/hyperframes/media-use/audio/scripts/heygen-tts.mjs +122 -0
  546. package/skills/hyperframes/media-use/audio/scripts/heygen-tts.test.mjs +38 -0
  547. package/skills/hyperframes/media-use/audio/scripts/heygen-voice.mjs +98 -0
  548. package/skills/hyperframes/media-use/audio/scripts/heygen-voice.test.mjs +233 -0
  549. package/skills/hyperframes/media-use/audio/scripts/lib/audio-meta.mjs +39 -0
  550. package/skills/hyperframes/media-use/audio/scripts/lib/audio-meta.test.mjs +136 -0
  551. package/skills/hyperframes/media-use/audio/scripts/lib/bgm-volume.mjs +4 -0
  552. package/skills/hyperframes/media-use/audio/scripts/lib/bgm.mjs +257 -0
  553. package/skills/hyperframes/media-use/audio/scripts/lib/bgm.test.mjs +74 -0
  554. package/skills/hyperframes/media-use/audio/scripts/lib/concurrency.mjs +14 -0
  555. package/skills/hyperframes/media-use/audio/scripts/lib/concurrency.test.mjs +41 -0
  556. package/skills/hyperframes/media-use/audio/scripts/lib/gemini-auth.mjs +43 -0
  557. package/skills/hyperframes/media-use/audio/scripts/lib/gemini-auth.py +52 -0
  558. package/skills/hyperframes/media-use/audio/scripts/lib/gemini-auth.test.mjs +86 -0
  559. package/skills/hyperframes/media-use/audio/scripts/lib/gemini-auth_test.py +90 -0
  560. package/skills/hyperframes/media-use/audio/scripts/lib/gemini-tts.mjs +122 -0
  561. package/skills/hyperframes/media-use/audio/scripts/lib/gemini-tts.test.mjs +243 -0
  562. package/skills/hyperframes/media-use/audio/scripts/lib/heygen.mjs +197 -0
  563. package/skills/hyperframes/media-use/audio/scripts/lib/heygen.test.mjs +185 -0
  564. package/skills/hyperframes/media-use/audio/scripts/lib/host-audio.mjs +28 -0
  565. package/skills/hyperframes/media-use/audio/scripts/lib/host-audio.test.mjs +106 -0
  566. package/skills/hyperframes/media-use/audio/scripts/lib/media-record.mjs +114 -0
  567. package/skills/hyperframes/media-use/audio/scripts/lib/media-record.test.mjs +205 -0
  568. package/skills/hyperframes/media-use/audio/scripts/lib/python.mjs +77 -0
  569. package/skills/hyperframes/media-use/audio/scripts/lib/python.test.mjs +136 -0
  570. package/skills/hyperframes/media-use/audio/scripts/lib/sfx.mjs +165 -0
  571. package/skills/hyperframes/media-use/audio/scripts/lib/sfx.test.mjs +121 -0
  572. package/skills/hyperframes/media-use/audio/scripts/lib/tts.mjs +389 -0
  573. package/skills/hyperframes/media-use/audio/scripts/lib/tts.spawn.test.mjs +158 -0
  574. package/skills/hyperframes/media-use/audio/scripts/lib/tts.test.mjs +230 -0
  575. package/skills/hyperframes/media-use/audio/scripts/lyria-recipe.py +136 -0
  576. package/skills/hyperframes/media-use/audio/scripts/wait-bgm.mjs +175 -0
  577. package/skills/hyperframes/media-use/audio/scripts/wait-bgm.test.mjs +108 -0
  578. package/skills/hyperframes/media-use/luts/README.md +28 -0
  579. package/skills/hyperframes/media-use/luts/index.json +57 -0
  580. package/skills/hyperframes/media-use/references/audio.md +20 -0
  581. package/skills/hyperframes/media-use/references/grading.md +160 -0
  582. package/skills/hyperframes/media-use/references/media-treatment-recipes.md +929 -0
  583. package/skills/hyperframes/media-use/references/media-treatments.md +202 -0
  584. package/skills/hyperframes/media-use/references/memory.md +37 -0
  585. package/skills/hyperframes/media-use/references/meta.md +61 -0
  586. package/skills/hyperframes/media-use/references/operations.md +327 -0
  587. package/skills/hyperframes/media-use/references/resolve.md +150 -0
  588. package/skills/hyperframes/media-use/references/setup-providers.md +81 -0
  589. package/skills/hyperframes/media-use/references/telemetry-dashboard.md +49 -0
  590. package/skills/hyperframes/media-use/scripts/audio-duck.mjs +113 -0
  591. package/skills/hyperframes/media-use/scripts/compatibility.test.mjs +96 -0
  592. package/skills/hyperframes/media-use/scripts/dither.mjs +328 -0
  593. package/skills/hyperframes/media-use/scripts/dither.test.mjs +176 -0
  594. package/skills/hyperframes/media-use/scripts/eval.mjs +369 -0
  595. package/skills/hyperframes/media-use/scripts/lib/config-lock.mjs +45 -0
  596. package/skills/hyperframes/media-use/scripts/lib/cutlist.mjs +184 -0
  597. package/skills/hyperframes/media-use/scripts/lib/duck.mjs +95 -0
  598. package/skills/hyperframes/media-use/scripts/lib/error-diffusion.mjs +230 -0
  599. package/skills/hyperframes/media-use/scripts/lib/index-gen.mjs +63 -0
  600. package/skills/hyperframes/media-use/scripts/lib/manifest.mjs +279 -0
  601. package/skills/hyperframes/media-use/scripts/lib/media-fetch.mjs +85 -0
  602. package/skills/hyperframes/media-use/scripts/lib/media-home.mjs +20 -0
  603. package/skills/hyperframes/media-use/scripts/lib/npx-sync.mjs +57 -0
  604. package/skills/hyperframes/media-use/scripts/lib/parakeet-words.mjs +27 -0
  605. package/skills/hyperframes/media-use/scripts/lib/prefs-store.mjs +180 -0
  606. package/skills/hyperframes/media-use/scripts/lib/recipe-store.mjs +367 -0
  607. package/skills/hyperframes/media-use/scripts/lib/telemetry.mjs +210 -0
  608. package/skills/hyperframes/media-use/scripts/lib/transcriptCutFade.mjs +21 -0
  609. package/skills/hyperframes/media-use/scripts/lib/words.mjs +18 -0
  610. package/skills/hyperframes/media-use/scripts/prefs.mjs +70 -0
  611. package/skills/hyperframes/media-use/scripts/recipe.mjs +103 -0
  612. package/skills/hyperframes/media-use/scripts/resolve-plugin.test.mjs +62 -0
  613. package/skills/hyperframes/media-use/scripts/resolve.mjs +31 -0
  614. package/skills/hyperframes/media-use/scripts/transcribe.mjs +194 -0
  615. package/skills/hyperframes/media-use/scripts/transcribe.test.mjs +112 -0
  616. package/skills/hyperframes/media-use/scripts/transcript-cut.mjs +270 -0
  617. package/skills/hyperframes/media-use/scripts/transcript-cut.test.mjs +117 -0
  618. package/skills/hyperframes/motion-graphics/SKILL.md +174 -0
  619. package/skills/hyperframes/motion-graphics/agents/builder.md +45 -0
  620. package/skills/hyperframes/motion-graphics/agents/director.md +54 -0
  621. package/skills/hyperframes/motion-graphics/agents/finalize.md +17 -0
  622. package/skills/hyperframes/motion-graphics/catalog-map.md +52 -0
  623. package/skills/hyperframes/motion-graphics/categories/asset-fusion/module.md +37 -0
  624. package/skills/hyperframes/motion-graphics/categories/charts/module.md +24 -0
  625. package/skills/hyperframes/motion-graphics/categories/kinetic-type/module.md +19 -0
  626. package/skills/hyperframes/motion-graphics/categories/logo-reveal/module.md +17 -0
  627. package/skills/hyperframes/motion-graphics/categories/lower-thirds/module.md +20 -0
  628. package/skills/hyperframes/motion-graphics/categories/maps/bake-basemap.mjs +273 -0
  629. package/skills/hyperframes/motion-graphics/categories/maps/module.md +61 -0
  630. package/skills/hyperframes/motion-graphics/categories/news/module.md +56 -0
  631. package/skills/hyperframes/motion-graphics/categories/stat/module.md +23 -0
  632. package/skills/hyperframes/motion-graphics/categories/tweet/module.md +16 -0
  633. package/skills/hyperframes/motion-graphics/categories/webpage/module.md +30 -0
  634. package/skills/hyperframes/motion-graphics/grounding/PROTOCOL.md +64 -0
  635. package/skills/hyperframes/motion-graphics/grounding/locate.mjs +228 -0
  636. package/skills/hyperframes/motion-graphics/phases/source/guide.md +21 -0
  637. package/skills/hyperframes/motion-graphics/references/builder-contract.md +38 -0
  638. package/skills/hyperframes/motion-graphics/references/motion-vocabulary.md +47 -0
  639. package/skills/hyperframes/motion-graphics/references/shot-plan-ir.md +54 -0
  640. package/skills/hyperframes/motion-graphics/samples/asset-fusion/_ref-circle-highlight.html +306 -0
  641. package/skills/hyperframes/music-to-video/SKILL.md +210 -0
  642. package/skills/hyperframes/music-to-video/references/frame-skeleton.md +100 -0
  643. package/skills/hyperframes/music-to-video/references/montage.md +55 -0
  644. package/skills/hyperframes/music-to-video/references/motion-primitive-catalog.md +75 -0
  645. package/skills/hyperframes/music-to-video/references/motion-primitives/3d-card-flip/index.html +53 -0
  646. package/skills/hyperframes/music-to-video/references/motion-primitives/3d-card-flip/scene.html +119 -0
  647. package/skills/hyperframes/music-to-video/references/motion-primitives/assets/gsap.min.js +11 -0
  648. package/skills/hyperframes/music-to-video/references/motion-primitives/bg-flow-field/index.html +53 -0
  649. package/skills/hyperframes/music-to-video/references/motion-primitives/bg-flow-field/scene.html +294 -0
  650. package/skills/hyperframes/music-to-video/references/motion-primitives/binary-decrypt/index.html +54 -0
  651. package/skills/hyperframes/music-to-video/references/motion-primitives/binary-decrypt/scene.html +85 -0
  652. package/skills/hyperframes/music-to-video/references/motion-primitives/blur-resolve/index.html +53 -0
  653. package/skills/hyperframes/music-to-video/references/motion-primitives/blur-resolve/scene.html +60 -0
  654. package/skills/hyperframes/music-to-video/references/motion-primitives/braam-punch/index.html +53 -0
  655. package/skills/hyperframes/music-to-video/references/motion-primitives/braam-punch/scene.html +100 -0
  656. package/skills/hyperframes/music-to-video/references/motion-primitives/chromatic-split/index.html +53 -0
  657. package/skills/hyperframes/music-to-video/references/motion-primitives/chromatic-split/scene.html +111 -0
  658. package/skills/hyperframes/music-to-video/references/motion-primitives/chrome-sweep/index.html +53 -0
  659. package/skills/hyperframes/music-to-video/references/motion-primitives/chrome-sweep/scene.html +68 -0
  660. package/skills/hyperframes/music-to-video/references/motion-primitives/counting-punch/index.html +54 -0
  661. package/skills/hyperframes/music-to-video/references/motion-primitives/counting-punch/scene.html +119 -0
  662. package/skills/hyperframes/music-to-video/references/motion-primitives/crash-zoom-in/index.html +53 -0
  663. package/skills/hyperframes/music-to-video/references/motion-primitives/crash-zoom-in/scene.html +120 -0
  664. package/skills/hyperframes/music-to-video/references/motion-primitives/datamosh-smear/index.html +55 -0
  665. package/skills/hyperframes/music-to-video/references/motion-primitives/datamosh-smear/scene.html +131 -0
  666. package/skills/hyperframes/music-to-video/references/motion-primitives/directional-fill/index.html +53 -0
  667. package/skills/hyperframes/music-to-video/references/motion-primitives/directional-fill/scene.html +103 -0
  668. package/skills/hyperframes/music-to-video/references/motion-primitives/dolly-zoom/index.html +53 -0
  669. package/skills/hyperframes/music-to-video/references/motion-primitives/dolly-zoom/scene.html +102 -0
  670. package/skills/hyperframes/music-to-video/references/motion-primitives/electric-arc/index.html +54 -0
  671. package/skills/hyperframes/music-to-video/references/motion-primitives/electric-arc/scene.html +105 -0
  672. package/skills/hyperframes/music-to-video/references/motion-primitives/flash-cut/index.html +53 -0
  673. package/skills/hyperframes/music-to-video/references/motion-primitives/flash-cut/scene.html +97 -0
  674. package/skills/hyperframes/music-to-video/references/motion-primitives/gooey-metaball/index.html +54 -0
  675. package/skills/hyperframes/music-to-video/references/motion-primitives/gooey-metaball/scene.html +206 -0
  676. package/skills/hyperframes/music-to-video/references/motion-primitives/hard-cut/index.html +53 -0
  677. package/skills/hyperframes/music-to-video/references/motion-primitives/hard-cut/scene.html +82 -0
  678. package/skills/hyperframes/music-to-video/references/motion-primitives/hypercut-whip/index.html +53 -0
  679. package/skills/hyperframes/music-to-video/references/motion-primitives/hypercut-whip/scene.html +44 -0
  680. package/skills/hyperframes/music-to-video/references/motion-primitives/iris-open/index.html +53 -0
  681. package/skills/hyperframes/music-to-video/references/motion-primitives/iris-open/scene.html +69 -0
  682. package/skills/hyperframes/music-to-video/references/motion-primitives/kinetic-letter-in/index.html +53 -0
  683. package/skills/hyperframes/music-to-video/references/motion-primitives/kinetic-letter-in/scene.html +64 -0
  684. package/skills/hyperframes/music-to-video/references/motion-primitives/liquid-morph/index.html +53 -0
  685. package/skills/hyperframes/music-to-video/references/motion-primitives/liquid-morph/scene.html +96 -0
  686. package/skills/hyperframes/music-to-video/references/motion-primitives/mask-reveal/index.html +53 -0
  687. package/skills/hyperframes/music-to-video/references/motion-primitives/mask-reveal/scene.html +74 -0
  688. package/skills/hyperframes/music-to-video/references/motion-primitives/mosaic-pack/index.html +53 -0
  689. package/skills/hyperframes/music-to-video/references/motion-primitives/mosaic-pack/scene.html +89 -0
  690. package/skills/hyperframes/music-to-video/references/motion-primitives/neon-flicker/index.html +53 -0
  691. package/skills/hyperframes/music-to-video/references/motion-primitives/neon-flicker/scene.html +73 -0
  692. package/skills/hyperframes/music-to-video/references/motion-primitives/outline-to-fill/index.html +53 -0
  693. package/skills/hyperframes/music-to-video/references/motion-primitives/outline-to-fill/scene.html +82 -0
  694. package/skills/hyperframes/music-to-video/references/motion-primitives/palette-flip/index.html +53 -0
  695. package/skills/hyperframes/music-to-video/references/motion-primitives/palette-flip/scene.html +97 -0
  696. package/skills/hyperframes/music-to-video/references/motion-primitives/particle-burst/index.html +53 -0
  697. package/skills/hyperframes/music-to-video/references/motion-primitives/particle-burst/scene.html +106 -0
  698. package/skills/hyperframes/music-to-video/references/motion-primitives/pixel-dissolve/index.html +53 -0
  699. package/skills/hyperframes/music-to-video/references/motion-primitives/pixel-dissolve/scene.html +86 -0
  700. package/skills/hyperframes/music-to-video/references/motion-primitives/radial-burst-lines/index.html +53 -0
  701. package/skills/hyperframes/music-to-video/references/motion-primitives/radial-burst-lines/scene.html +130 -0
  702. package/skills/hyperframes/music-to-video/references/motion-primitives/screen-shake/index.html +53 -0
  703. package/skills/hyperframes/music-to-video/references/motion-primitives/screen-shake/scene.html +78 -0
  704. package/skills/hyperframes/music-to-video/references/motion-primitives/slot-machine-reveal/index.html +53 -0
  705. package/skills/hyperframes/music-to-video/references/motion-primitives/slot-machine-reveal/scene.html +100 -0
  706. package/skills/hyperframes/music-to-video/references/motion-primitives/spotlight-sweep/index.html +53 -0
  707. package/skills/hyperframes/music-to-video/references/motion-primitives/spotlight-sweep/scene.html +102 -0
  708. package/skills/hyperframes/music-to-video/references/motion-primitives/staggered-exit/index.html +53 -0
  709. package/skills/hyperframes/music-to-video/references/motion-primitives/staggered-exit/scene.html +82 -0
  710. package/skills/hyperframes/music-to-video/references/motion-primitives/text-spectral-rays/USAGE.md +42 -0
  711. package/skills/hyperframes/music-to-video/references/motion-primitives/text-spectral-rays/index.html +53 -0
  712. package/skills/hyperframes/music-to-video/references/motion-primitives/text-spectral-rays/scene.html +280 -0
  713. package/skills/hyperframes/music-to-video/references/motion-primitives/text-wave-distort/index.html +54 -0
  714. package/skills/hyperframes/music-to-video/references/motion-primitives/text-wave-distort/scene.html +106 -0
  715. package/skills/hyperframes/music-to-video/references/motion-primitives/tile-mosaic/index.html +53 -0
  716. package/skills/hyperframes/music-to-video/references/motion-primitives/tile-mosaic/scene.html +109 -0
  717. package/skills/hyperframes/music-to-video/references/motion-primitives/typewriter-reveal/index.html +53 -0
  718. package/skills/hyperframes/music-to-video/references/motion-primitives/typewriter-reveal/scene.html +91 -0
  719. package/skills/hyperframes/music-to-video/references/motion-primitives/word-grid-burst/index.html +53 -0
  720. package/skills/hyperframes/music-to-video/references/motion-primitives/word-grid-burst/scene.html +96 -0
  721. package/skills/hyperframes/music-to-video/references/planning.md +104 -0
  722. package/skills/hyperframes/music-to-video/references/storyboard-format.md +94 -0
  723. package/skills/hyperframes/music-to-video/references/template-catalog.md +106 -0
  724. package/skills/hyperframes/music-to-video/references/templates/card-flyby/index.html +527 -0
  725. package/skills/hyperframes/music-to-video/references/templates/card-flyby/program.json +13 -0
  726. package/skills/hyperframes/music-to-video/references/templates/held-message-living-field/index.html +485 -0
  727. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/asphalt-031.png +0 -0
  728. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/bark-014.png +0 -0
  729. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/brick.png +0 -0
  730. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/bricks-075-a.png +0 -0
  731. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/bricks-101.png +0 -0
  732. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/bricks-102.png +0 -0
  733. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/bricks-104.png +0 -0
  734. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/carpet.png +0 -0
  735. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/concrete-034.png +0 -0
  736. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/concrete-042-a.png +0 -0
  737. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/concrete-046.png +0 -0
  738. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/concrete-047-a.png +0 -0
  739. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/concrete.png +0 -0
  740. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/diamond-plate-009.png +0 -0
  741. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/fabric-080.png +0 -0
  742. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/fabric-083.png +0 -0
  743. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/grass-001.png +0 -0
  744. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/grass-004.png +0 -0
  745. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/grass-005.png +0 -0
  746. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/ground-037.png +0 -0
  747. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/ground-054.png +0 -0
  748. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/ground-068.png +0 -0
  749. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/ground-080.png +0 -0
  750. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/ground-103.png +0 -0
  751. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/ground-104.png +0 -0
  752. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/lava.png +0 -0
  753. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/leather-037.png +0 -0
  754. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/marble-012.png +0 -0
  755. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/marble-016.png +0 -0
  756. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/metal-032.png +0 -0
  757. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/metal-038.png +0 -0
  758. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/metal-041-a.png +0 -0
  759. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/metal-046-b.png +0 -0
  760. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/metal-048-a.png +0 -0
  761. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/metal-049-a.png +0 -0
  762. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/metal-055-a.png +0 -0
  763. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/metal-061-b.png +0 -0
  764. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/metal.png +0 -0
  765. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/onyx.png +0 -0
  766. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/painted-plaster-017.png +0 -0
  767. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/paving-stones-138.png +0 -0
  768. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/paving-stones-150.png +0 -0
  769. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/plaster-001.png +0 -0
  770. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/road-007.png +0 -0
  771. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/road-008-a.png +0 -0
  772. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/road-009-c.png +0 -0
  773. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/road-012-a.png +0 -0
  774. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/road-012-b.png +0 -0
  775. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/road-013-a.png +0 -0
  776. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/rock-058.png +0 -0
  777. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/rock-063.png +0 -0
  778. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/rock.png +0 -0
  779. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/snow-015.png +0 -0
  780. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/snow.png +0 -0
  781. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/tiles-138.png +0 -0
  782. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/travertine-009.png +0 -0
  783. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/wood-049.png +0 -0
  784. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/wood-051.png +0 -0
  785. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/wood-058.png +0 -0
  786. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/wood-066.png +0 -0
  787. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/wood-092.png +0 -0
  788. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/wood-094.png +0 -0
  789. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/wood-floor-051.png +0 -0
  790. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/wood-floor-064.png +0 -0
  791. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/wood-floor-070.png +0 -0
  792. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/assets/texture-mask-text/masks/wood.png +0 -0
  793. package/skills/hyperframes/music-to-video/references/templates/held-text-strobe-burst/index.html +302 -0
  794. package/skills/hyperframes/music-to-video/references/templates/intro-kinetic-cascade/index.html +610 -0
  795. package/skills/hyperframes/music-to-video/references/templates/intro-kinetic-cascade/program.json +41 -0
  796. package/skills/hyperframes/music-to-video/references/templates/logo-split-lockup-pulse/assets/fredoka-700.woff2 +0 -0
  797. package/skills/hyperframes/music-to-video/references/templates/logo-split-lockup-pulse/index.html +596 -0
  798. package/skills/hyperframes/music-to-video/references/templates/poster-tile-mosaic/index.html +589 -0
  799. package/skills/hyperframes/music-to-video/references/templates/poster-tile-mosaic/program.json +25 -0
  800. package/skills/hyperframes/music-to-video/references/templates/roll-flipbook-word-cycle/index.html +267 -0
  801. package/skills/hyperframes/music-to-video/references/templates/split-anchor-word-slot/index.html +594 -0
  802. package/skills/hyperframes/music-to-video/references/templates/split-anchor-word-slot/program.json +39 -0
  803. package/skills/hyperframes/music-to-video/references/templates/typewriter-phrase-keyword-shuffle/index.html +238 -0
  804. package/skills/hyperframes/music-to-video/scripts/analyze-beatgrid.py +542 -0
  805. package/skills/hyperframes/music-to-video/scripts/assemble-index.mjs +220 -0
  806. package/skills/hyperframes/music-to-video/scripts/lib/storyboard.mjs +249 -0
  807. package/skills/hyperframes/music-to-video/scripts/stage-assets.mjs +58 -0
  808. package/skills/hyperframes/music-to-video/scripts/validate-plan.mjs +161 -0
  809. package/skills/hyperframes/music-to-video/sub-agents/frame-worker.md +49 -0
  810. package/skills/hyperframes/pr-to-video/SKILL.md +273 -0
  811. package/skills/hyperframes/pr-to-video/references/code-vocabulary.md +113 -0
  812. package/skills/hyperframes/pr-to-video/references/cut-catalog.md +215 -0
  813. package/skills/hyperframes/pr-to-video/references/motion-language.md +156 -0
  814. package/skills/hyperframes/pr-to-video/references/story-design.md +230 -0
  815. package/skills/hyperframes/pr-to-video/references/visual-design.md +164 -0
  816. package/skills/hyperframes/pr-to-video/scripts/assemble-index.mjs +631 -0
  817. package/skills/hyperframes/pr-to-video/scripts/assemble-index.test.mjs +130 -0
  818. package/skills/hyperframes/pr-to-video/scripts/audio.mjs +338 -0
  819. package/skills/hyperframes/pr-to-video/scripts/build-frame.mjs +589 -0
  820. package/skills/hyperframes/pr-to-video/scripts/captions.mjs +524 -0
  821. package/skills/hyperframes/pr-to-video/scripts/captions.test.mjs +260 -0
  822. package/skills/hyperframes/pr-to-video/scripts/fetch-people-avatars.mjs +157 -0
  823. package/skills/hyperframes/pr-to-video/scripts/fetch-pr.mjs +234 -0
  824. package/skills/hyperframes/pr-to-video/scripts/frame-contract.test.mjs +209 -0
  825. package/skills/hyperframes/pr-to-video/scripts/frame-packets.mjs +62 -0
  826. package/skills/hyperframes/pr-to-video/scripts/ingest.mjs +561 -0
  827. package/skills/hyperframes/pr-to-video/scripts/lib/assets.mjs +56 -0
  828. package/skills/hyperframes/pr-to-video/scripts/lib/bgm-volume.mjs +4 -0
  829. package/skills/hyperframes/pr-to-video/scripts/lib/captured-fonts.mjs +58 -0
  830. package/skills/hyperframes/pr-to-video/scripts/lib/dimensions.mjs +45 -0
  831. package/skills/hyperframes/pr-to-video/scripts/lib/frame-contract.mjs +54 -0
  832. package/skills/hyperframes/pr-to-video/scripts/lib/frame-packets-core.mjs +194 -0
  833. package/skills/hyperframes/pr-to-video/scripts/lib/host-audio.mjs +28 -0
  834. package/skills/hyperframes/pr-to-video/scripts/lib/pad-frame-duration.mjs +36 -0
  835. package/skills/hyperframes/pr-to-video/scripts/lib/storyboard.mjs +249 -0
  836. package/skills/hyperframes/pr-to-video/scripts/lib/tokens.mjs +211 -0
  837. package/skills/hyperframes/pr-to-video/scripts/lib/transition-registry.mjs +38 -0
  838. package/skills/hyperframes/pr-to-video/scripts/lib/transitions.json +71 -0
  839. package/skills/hyperframes/pr-to-video/scripts/preflight.mjs +51 -0
  840. package/skills/hyperframes/pr-to-video/scripts/project-dir.mjs +92 -0
  841. package/skills/hyperframes/pr-to-video/scripts/transitions.mjs +383 -0
  842. package/skills/hyperframes/pr-to-video/scripts/workflow-guardrails.test.mjs +198 -0
  843. package/skills/hyperframes/pr-to-video/sub-agents/frame-worker.md +38 -0
  844. package/skills/hyperframes/product-launch-video/SKILL.md +268 -0
  845. package/skills/hyperframes/product-launch-video/references/cut-catalog.md +220 -0
  846. package/skills/hyperframes/product-launch-video/references/motion-language.md +156 -0
  847. package/skills/hyperframes/product-launch-video/references/story-design.md +508 -0
  848. package/skills/hyperframes/product-launch-video/references/visual-design.md +126 -0
  849. package/skills/hyperframes/product-launch-video/scripts/assemble-index.mjs +773 -0
  850. package/skills/hyperframes/product-launch-video/scripts/assemble-index.test.mjs +127 -0
  851. package/skills/hyperframes/product-launch-video/scripts/audio.mjs +338 -0
  852. package/skills/hyperframes/product-launch-video/scripts/audio.test.mjs +399 -0
  853. package/skills/hyperframes/product-launch-video/scripts/build-frame-subsets.test.mjs +152 -0
  854. package/skills/hyperframes/product-launch-video/scripts/build-frame.mjs +552 -0
  855. package/skills/hyperframes/product-launch-video/scripts/captions.mjs +524 -0
  856. package/skills/hyperframes/product-launch-video/scripts/captions.test.mjs +219 -0
  857. package/skills/hyperframes/product-launch-video/scripts/capture-skill-guardrails.test.mjs +39 -0
  858. package/skills/hyperframes/product-launch-video/scripts/frame-packets.mjs +27 -0
  859. package/skills/hyperframes/product-launch-video/scripts/frame-packets.test.mjs +144 -0
  860. package/skills/hyperframes/product-launch-video/scripts/lib/assets.mjs +56 -0
  861. package/skills/hyperframes/product-launch-video/scripts/lib/bgm-volume.mjs +4 -0
  862. package/skills/hyperframes/product-launch-video/scripts/lib/captured-fonts.mjs +58 -0
  863. package/skills/hyperframes/product-launch-video/scripts/lib/dimensions.mjs +45 -0
  864. package/skills/hyperframes/product-launch-video/scripts/lib/frame-packets-core.mjs +194 -0
  865. package/skills/hyperframes/product-launch-video/scripts/lib/host-audio.mjs +28 -0
  866. package/skills/hyperframes/product-launch-video/scripts/lib/pad-frame-duration.mjs +36 -0
  867. package/skills/hyperframes/product-launch-video/scripts/lib/pad-frame-duration.test.mjs +76 -0
  868. package/skills/hyperframes/product-launch-video/scripts/lib/storyboard.mjs +249 -0
  869. package/skills/hyperframes/product-launch-video/scripts/lib/tokens.mjs +218 -0
  870. package/skills/hyperframes/product-launch-video/scripts/lib/tokens.test.mjs +57 -0
  871. package/skills/hyperframes/product-launch-video/scripts/lib/transition-registry.mjs +38 -0
  872. package/skills/hyperframes/product-launch-video/scripts/lib/transitions.json +71 -0
  873. package/skills/hyperframes/product-launch-video/scripts/media-contract.test.mjs +200 -0
  874. package/skills/hyperframes/product-launch-video/scripts/stage-assets.mjs +39 -0
  875. package/skills/hyperframes/product-launch-video/scripts/stage-assets.test.mjs +52 -0
  876. package/skills/hyperframes/product-launch-video/scripts/transitions.mjs +383 -0
  877. package/skills/hyperframes/product-launch-video/scripts/transitions.test.mjs +68 -0
  878. package/skills/hyperframes/product-launch-video/sub-agents/frame-worker.md +21 -0
  879. package/skills/hyperframes/remotion-to-hyperframes/SKILL.md +132 -0
  880. package/skills/hyperframes/remotion-to-hyperframes/assets/.gitkeep +0 -0
  881. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/run.sh +249 -0
  882. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-1-title-card/README.md +41 -0
  883. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-1-title-card/expected.json +26 -0
  884. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-1-title-card/hf-src/compositions/title.html +31 -0
  885. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-1-title-card/hf-src/index.html +46 -0
  886. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-1-title-card/remotion-src/package.json +14 -0
  887. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-1-title-card/remotion-src/remotion.config.ts +13 -0
  888. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-1-title-card/remotion-src/src/Root.tsx +13 -0
  889. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-1-title-card/remotion-src/src/TitleCard.tsx +34 -0
  890. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-1-title-card/remotion-src/src/index.ts +4 -0
  891. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-1-title-card/remotion-src/tsconfig.json +15 -0
  892. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-2-multi-scene/README.md +54 -0
  893. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-2-multi-scene/expected.json +29 -0
  894. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-2-multi-scene/hf-src/compositions/scene-1.html +35 -0
  895. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-2-multi-scene/hf-src/compositions/scene-2.html +35 -0
  896. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-2-multi-scene/hf-src/compositions/scene-3.html +36 -0
  897. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-2-multi-scene/hf-src/index.html +75 -0
  898. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-2-multi-scene/remotion-src/package.json +14 -0
  899. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-2-multi-scene/remotion-src/remotion.config.ts +13 -0
  900. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-2-multi-scene/remotion-src/src/MultiScene.tsx +105 -0
  901. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-2-multi-scene/remotion-src/src/Root.tsx +13 -0
  902. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-2-multi-scene/remotion-src/src/index.ts +4 -0
  903. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-2-multi-scene/remotion-src/tsconfig.json +15 -0
  904. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-2-multi-scene/setup.sh +34 -0
  905. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-3-data-driven/README.md +85 -0
  906. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-3-data-driven/expected.json +41 -0
  907. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-3-data-driven/hf-src/compositions/scene-1.html +52 -0
  908. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-3-data-driven/hf-src/compositions/scene-2.html +99 -0
  909. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-3-data-driven/hf-src/compositions/scene-3.html +55 -0
  910. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-3-data-driven/hf-src/index.html +70 -0
  911. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-3-data-driven/remotion-src/package.json +15 -0
  912. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-3-data-driven/remotion-src/remotion.config.ts +13 -0
  913. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-3-data-driven/remotion-src/src/Root.tsx +27 -0
  914. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-3-data-driven/remotion-src/src/Stargazed.tsx +37 -0
  915. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-3-data-driven/remotion-src/src/components/AnimatedNumber.tsx +23 -0
  916. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-3-data-driven/remotion-src/src/components/StatCard.tsx +59 -0
  917. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-3-data-driven/remotion-src/src/components/UnderlinedText.tsx +47 -0
  918. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-3-data-driven/remotion-src/src/index.ts +4 -0
  919. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-3-data-driven/remotion-src/src/scenes/OutroScene.tsx +18 -0
  920. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-3-data-driven/remotion-src/src/scenes/StatsScene.tsx +34 -0
  921. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-3-data-driven/remotion-src/src/scenes/TitleScene.tsx +55 -0
  922. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-3-data-driven/remotion-src/tsconfig.json +15 -0
  923. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-4-escape-hatch/README.md +51 -0
  924. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-4-escape-hatch/cases/01-use-state.tsx +29 -0
  925. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-4-escape-hatch/cases/02-use-effect-deps.tsx +29 -0
  926. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-4-escape-hatch/cases/03-async-metadata.tsx +39 -0
  927. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-4-escape-hatch/cases/04-third-party-react.tsx +30 -0
  928. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-4-escape-hatch/cases/05-lambda-config.tsx +38 -0
  929. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-4-escape-hatch/cases/06-warnings-only.tsx +36 -0
  930. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-4-escape-hatch/cases/07-custom-hook.tsx +28 -0
  931. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-4-escape-hatch/cases/08-mixed.tsx +41 -0
  932. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-4-escape-hatch/expected.json +85 -0
  933. package/skills/hyperframes/remotion-to-hyperframes/assets/test-corpus/tier-4-escape-hatch/validate.sh +110 -0
  934. package/skills/hyperframes/remotion-to-hyperframes/references/api-map.md +142 -0
  935. package/skills/hyperframes/remotion-to-hyperframes/references/escape-hatch.md +115 -0
  936. package/skills/hyperframes/remotion-to-hyperframes/references/eval.md +140 -0
  937. package/skills/hyperframes/remotion-to-hyperframes/references/fonts.md +112 -0
  938. package/skills/hyperframes/remotion-to-hyperframes/references/limitations.md +136 -0
  939. package/skills/hyperframes/remotion-to-hyperframes/references/lottie.md +119 -0
  940. package/skills/hyperframes/remotion-to-hyperframes/references/media.md +166 -0
  941. package/skills/hyperframes/remotion-to-hyperframes/references/parameters.md +172 -0
  942. package/skills/hyperframes/remotion-to-hyperframes/references/sequencing.md +251 -0
  943. package/skills/hyperframes/remotion-to-hyperframes/references/timing.md +165 -0
  944. package/skills/hyperframes/remotion-to-hyperframes/references/transitions.md +114 -0
  945. package/skills/hyperframes/remotion-to-hyperframes/scripts/.gitkeep +0 -0
  946. package/skills/hyperframes/remotion-to-hyperframes/scripts/frame_strip.sh +107 -0
  947. package/skills/hyperframes/remotion-to-hyperframes/scripts/lint_source.py +370 -0
  948. package/skills/hyperframes/remotion-to-hyperframes/scripts/render_diff.sh +103 -0
  949. package/skills/hyperframes/remotion-to-hyperframes/scripts/tests/fixtures/blocker.tsx +50 -0
  950. package/skills/hyperframes/remotion-to-hyperframes/scripts/tests/fixtures/clean.tsx +46 -0
  951. package/skills/hyperframes/remotion-to-hyperframes/scripts/tests/smoke.sh +90 -0
  952. package/skills/hyperframes/slideshow/SKILL.md +526 -0
  953. package/skills/hyperframes/slideshow/references/standalone-harness.md +1017 -0
  954. package/skills/hyperframes/talking-head-recut/NOTICE.md +39 -0
  955. package/skills/hyperframes/talking-head-recut/SKILL.md +1204 -0
  956. package/skills/hyperframes/talking-head-recut/assets/fonts/Caveat-400-latin.woff2 +0 -0
  957. package/skills/hyperframes/talking-head-recut/assets/fonts/Caveat-700-latin.woff2 +0 -0
  958. package/skills/hyperframes/talking-head-recut/assets/fonts/Inter-400-latin.woff2 +0 -0
  959. package/skills/hyperframes/talking-head-recut/assets/fonts/Inter-700-latin.woff2 +0 -0
  960. package/skills/hyperframes/talking-head-recut/assets/fonts/LXGWWenKaiTC-400-latin.woff2 +0 -0
  961. package/skills/hyperframes/talking-head-recut/assets/fonts/Virgil.woff2 +0 -0
  962. package/skills/hyperframes/talking-head-recut/assets/vendor/gsap.min.js +10 -0
  963. package/skills/hyperframes/talking-head-recut/media-contract.test.mjs +24 -0
  964. package/skills/hyperframes/talking-head-recut/references/DESIGN_INDEX.md +145 -0
  965. package/skills/hyperframes/talking-head-recut/references/frames/clean.html +92 -0
  966. package/skills/hyperframes/talking-head-recut/references/frames/hairline.html +171 -0
  967. package/skills/hyperframes/talking-head-recut/references/frames/polaroid.html +131 -0
  968. package/skills/hyperframes/talking-head-recut/references/layouts/overlay.html +164 -0
  969. package/skills/hyperframes/talking-head-recut/references/layouts/pip.html +143 -0
  970. package/skills/hyperframes/talking-head-recut/references/layouts/split.html +121 -0
  971. package/skills/hyperframes/talking-head-recut/references/layouts/stack.html +109 -0
  972. package/skills/hyperframes/talking-head-recut/references/styles/academic.html +172 -0
  973. package/skills/hyperframes/talking-head-recut/references/styles/audit.html +170 -0
  974. package/skills/hyperframes/talking-head-recut/references/styles/editorial.html +189 -0
  975. package/skills/hyperframes/talking-head-recut/references/styles/geom.html +181 -0
  976. package/skills/hyperframes/talking-head-recut/references/styles/minimal.html +130 -0
  977. package/skills/hyperframes/talking-head-recut/references/styles/spotlight.html +142 -0
  978. package/skills/hyperframes/talking-head-recut/references/styles/swiss.html +188 -0
  979. package/skills/hyperframes/talking-head-recut/references/styles/terminal.html +196 -0
  980. package/skills/hyperframes/talking-head-recut/references/styles/whiteboard.html +170 -0
  981. package/skills/hyperframes/talking-head-recut/references/styles/xhs.html +206 -0
  982. package/skills/slates-start-here.md +78 -0
  983. package/exports/slates-chatgpt-images/generated/SKILL.md +0 -113
  984. package/exports/slates-chatgpt-images/generated/slates-chatgpt-images.skill +0 -0
  985. package/exports/slates-prompt-builder/generated/SKILL.md +0 -71
  986. package/exports/slates-prompt-builder/generated/reference-character.md +0 -90
  987. package/exports/slates-prompt-builder/generated/reference-content-policy.md +0 -81
  988. package/exports/slates-prompt-builder/generated/reference-gpt-image-2-5.md +0 -191
  989. package/exports/slates-prompt-builder/generated/reference-kling.md +0 -254
  990. package/exports/slates-prompt-builder/generated/reference-nano-banana.md +0 -229
  991. package/exports/slates-prompt-builder/generated/reference-omni-flash.md +0 -65
  992. package/exports/slates-prompt-builder/generated/reference-seedance-2-5.md +0 -362
  993. package/exports/slates-prompt-builder/generated/reference-seedance.md +0 -413
  994. package/exports/slates-prompt-builder/generated/slates-prompt-builder-manifest.json +0 -133
  995. package/exports/slates-prompt-builder/generated/slates-prompt-builder.skill +0 -0
  996. package/skills/_partials/blender-action-curves.md +0 -24
  997. package/skills/_partials/cinematic-card.md +0 -8
  998. package/skills/_partials/decision-log.md +0 -1
  999. package/skills/_partials/image-defaults.md +0 -11
  1000. package/skills/_partials/iteration-diagnosis.md +0 -5
  1001. package/skills/_partials/model-routing.md +0 -35
  1002. package/skills/_partials/references-read-literally.md +0 -11
  1003. package/skills/_partials/seedance-25-timestamps.md +0 -34
  1004. package/skills/_partials/sheet-tool-defaults.md +0 -6
  1005. package/skills/_partials/still-gate.md +0 -3
  1006. package/skills/_partials/thresholds.md +0 -19
  1007. package/skills/slates-blocking-to-prompt.md +0 -252
  1008. package/skills/slates-camera-language.md +0 -234
  1009. package/skills/slates-character-identity.md +0 -115
  1010. package/skills/slates-chatgpt-images.md +0 -113
  1011. package/skills/slates-cinematic-look.md +0 -237
  1012. package/skills/slates-content-policy.md +0 -88
  1013. package/skills/slates-cost-discipline.md +0 -152
  1014. package/skills/slates-dialogue-blocking.md +0 -134
  1015. package/skills/slates-direct-response-ad.md +0 -28
  1016. package/skills/slates-edit-and-iterate.md +0 -71
  1017. package/skills/slates-model-selection.md +0 -131
  1018. package/skills/slates-one-prompt-film.md +0 -38
  1019. package/skills/slates-previs-blocking.md +0 -184
  1020. package/skills/slates-project-organization.md +0 -41
  1021. package/skills/slates-prompting-elevenlabs.md +0 -128
  1022. package/skills/slates-prompting-flux-2-max.md +0 -191
  1023. package/skills/slates-prompting-gpt-image-2-5.md +0 -196
  1024. package/skills/slates-prompting-inworld-tts.md +0 -174
  1025. package/skills/slates-prompting-kling-v3.md +0 -264
  1026. package/skills/slates-prompting-lip-sync.md +0 -216
  1027. package/skills/slates-prompting-ltx-2-5.md +0 -217
  1028. package/skills/slates-prompting-minimax-h3.md +0 -354
  1029. package/skills/slates-prompting-motion-transfer.md +0 -202
  1030. package/skills/slates-prompting-nano-banana-2.md +0 -240
  1031. package/skills/slates-prompting-omni-flash.md +0 -85
  1032. package/skills/slates-prompting-seed-audio.md +0 -168
  1033. package/skills/slates-prompting-seedance-2-5.md +0 -391
  1034. package/skills/slates-prompting-seedance.md +0 -435
  1035. package/skills/slates-prompting-seedream-5-lite.md +0 -122
  1036. package/skills/slates-restyle-from-blocking.md +0 -121
  1037. package/skills/slates-script-craft.md +0 -45
  1038. package/skills/slates-shot-variety.md +0 -24
  1039. package/skills/slates-storyboard-from-script.md +0 -32
  1040. package/skills/slates-style-prompting.md +0 -56
  1041. package/skills/slates-ugc-influencer-ad.md +0 -32
  1042. package/skills/slates-vision-feedback-loop.md +0 -118
@@ -1,7 +1,9 @@
1
1
  import { MAX_IMAGE_VARIATIONS } from '../prompts/generation-policy.js';
2
+ import { STYLE_LIBRARY, DEFAULT_STYLE_ID } from '../prompts/style-library.js';
2
3
  import { discoverGuides, guideCatalog } from '../prompts/guide-discovery.js';
3
- import { retrieveGuide } from '../prompts/guide-retrieval.js';
4
- import { MINIMAX_MAX_REFERENCE, minimaxMaxReferenceTokens, MODEL_CAPABILITIES, GPT_QUALITY_TIERS, DEFAULT_GPT_QUALITY, GPT_BACKGROUNDS } from '../prompts/model-capabilities.js';
4
+ import { retrieveGuide, servedDepth } from '../prompts/guide-retrieval.js';
5
+ import { BRAIN_ROUTER, MY_BRAIN_TOPIC, ROUTER_ALIASES } from '../prompts/brain.js';
6
+ import { MINIMAX_MAX_REFERENCE, minimaxMaxReferenceTokens, MODEL_CAPABILITIES, RETIRED_MODELS, retiredModelOfKey, GPT_QUALITY_TIERS, DEFAULT_GPT_QUALITY, GPT_BACKGROUNDS } from '../prompts/model-capabilities.js';
5
7
  // Operations layer — the ONE place every Slates agent tool is defined.
6
8
  // Both the MCP server and the CLI register these as their tool / command
7
9
  // surface. Every operation:
@@ -18,6 +20,9 @@ import { SlatesCloudClient, SlatesCloudHttpError } from '../clients/cloud.js';
18
20
  import { SlatesDesktopClient } from '../clients/desktop.js';
19
21
  import { BlenderBridgeClient, BLENDER_SETUP_HINT, RENDER_TIMEOUT_MS } from '../clients/blender.js';
20
22
  import { SKILLS } from '../skills/content.js';
23
+ import { brainSkills, myBrainDir, myBrainPreload, noteUsed } from '../skills/my-brain.js';
24
+ import { brainFiles, refreshServedBrain, servedBrain } from '../skills/served.js';
25
+ import { HYPERFRAMES_MAPPING, findHyperframesGuide, hyperframesCard, hyperframesCatalog, hyperframesFilesOf, hyperframesGuideHeader, hyperframesSkillBodies, loadHyperframes } from '../skills/hyperframes.js';
21
26
  import { appManualIndex, appManualSections } from '../manual/index.js';
22
27
  // Reference-capacity prose is DERIVED, never hand-typed — root CLAUDE.md:
23
28
  // "never hand-type a fact an LLM will read". These helpers read MODEL_FACTS.
@@ -77,6 +82,41 @@ export class OperationCancelledError extends Error {
77
82
  super(`Cancelled by the user${detail ? ` — ${detail}` : ''}.`);
78
83
  }
79
84
  }
85
+ /**
86
+ * A generation refused because this session has not read its model's guide.
87
+ * Eric, 2026-10-23, after a Seedance test was prompted before its guide was
88
+ * read: *"That needs to be a hard blocker."* Nothing was generated or charged.
89
+ */
90
+ /** How a machine with no brain gets one: the desktop app signed in here writes it, or a CLI login fetches it. */
91
+ export const CONNECT_FOR_BRAIN = 'Have the user open the Slates app signed in on this machine (it brings the brain here), or run `slates login`';
92
+ export class GuideNotReadError extends Error {
93
+ model;
94
+ guide;
95
+ code = 'GUIDE_NOT_READ';
96
+ constructor(model, guide) {
97
+ const head = `Refused: this session has not read ${guide}, the guide for ${model}. Nothing was generated or charged. `;
98
+ const body = brainSkills().skills[guide];
99
+ const served = servedBrain();
100
+ super(body !== undefined || served.locked.some(entry => entry.name === guide)
101
+ ? head +
102
+ `Call slates_get_prompting_guide with topic "${guide}", rewrite the prompt against it, then call this again. Its card:\n\n` +
103
+ // The card this user's brain serves, so a model guide from their My brain is the one in the refusal.
104
+ describeCraftCard(guide, body)
105
+ : // No copy here and none locked: the brain never arrived, so asking for the guide again cannot help.
106
+ head +
107
+ `The guide comes from the connected Slates account and is not on this machine (${served.problem ?? 'no brain received yet'}). ` +
108
+ `${CONNECT_FOR_BRAIN}; then call slates_get_prompting_guide with topic "${guide}" and call this again.`);
109
+ this.model = model;
110
+ this.guide = guide;
111
+ }
112
+ }
113
+ /** Refuse the generation when the session keeps a ledger and `model`'s guide is not in it. A seat with no model id names its guide. */
114
+ function requireGuideRead(ctx, model, guide = model ? resolveGuideTopic(model) : null) {
115
+ if (!ctx?.guidesRead || !model)
116
+ return;
117
+ if (guide && !ctx.guidesRead.has(guide))
118
+ throw new GuideNotReadError(model, guide);
119
+ }
80
120
  /** Throw if the caller has cancelled. Call between billable items, never inside one. */
81
121
  function throwIfCancelled(ctx, detail) {
82
122
  if (ctx.signal?.aborted)
@@ -123,6 +163,8 @@ const CENTS_PER_CREDIT = 3; // peg: 1 credit = 3¢ billed = 2¢ COGS (mirror of
123
163
  * desktop loop imports it instead of declaring its own.
124
164
  */
125
165
  export const DEVIATION_FACTOR = 1.2;
166
+ /** For an asset param that takes a UUID only (no resolveAssetRefs in its run). */
167
+ const ASSET_UUID_ONLY = 'Asset UUID, not a badge code: pass the code to slates_list_assets as search to resolve it.';
126
168
  /**
127
169
  * The confirm-gate sentence, rendered ONCE from CONFIRM_CREDITS.
128
170
  *
@@ -134,7 +176,17 @@ export const DEVIATION_FACTOR = 1.2;
134
176
  // The consent half rides every generation tool because a host may drop the
135
177
  // server instructions: Codex CLI 0.159.1 passed none to the model (probes
136
178
  // 2026-09-30 and 2026-10-02), so a small spend had no approval rule in view.
137
- const CONFIRM_GATE_SENTENCE = `Show the user the estimate and wait for their OK before any generation, however small. Cost above ${CONFIRM_CREDITS} credits (and, on image and video, any attached reference) also returns requires_confirm — pass confirm=true only to relay that OK.`;
179
+ //
180
+ // `alsoWhen` names a second trigger, only on an op whose run gates on it.
181
+ const confirmGateSentence = (alsoWhen) => `Show the user the estimate and wait for their OK before any generation, however small. Cost above ${CONFIRM_CREDITS} credits${alsoWhen ? `, or ${alsoWhen},` : ''} also returns requires_confirm — pass confirm=true only to relay that OK.`;
182
+ const CONFIRM_GATE_SENTENCE = confirmGateSentence();
183
+ /** Longest source clip motion transfer reads, by characterOrientation: the run bills at most this. */
184
+ const MOTION_TRANSFER_MAX_SECONDS = { video: 30, image: 10 };
185
+ const STYLE_DESCRIBE = (omitted) => `Art style. ${omitted} Canonical styles: ${STYLE_LIBRARY.filter((s) => s.id !== DEFAULT_STYLE_ID).map((s) => s.id).join(', ')}. Or pass any free-text instruction, e.g. 'turn this into a real person'.`;
186
+ /** The character, location and look ops read and write Library items (slate routes-library.ts); new work uses the Library op named. */
187
+ const LIBRARY_TWIN = (op, does) => ` These are Library items: ${op} ${does}.`;
188
+ /** The confirm param, one wording: it relays the user's OK of a quoted spend. */
189
+ const CONFIRM_PARAM = `Set true only to relay the user's explicit OK of this exact spend.`;
138
190
  // Declared HERE, above every op, because `slates_estimate_generation_cost`
139
191
  // renders them into its `duration` description at MODULE LOAD — a const
140
192
  // declared below the first schema that reads it is a temporal-dead-zone
@@ -293,7 +345,7 @@ function backgroundSubmitted(kind, ids, extra, note) {
293
345
  // ── Workspace + identity ────────────────────────────────────────
294
346
  export const getWorkspaceState = {
295
347
  id: 'slates_get_workspace_state',
296
- description: 'Snapshot of the user\'s Slates workspace: the project list (most recent first) plus the active project in full when you name one.',
348
+ description: 'Snapshot of the user\'s Slates workspace: the project list (most recent first) plus the active project in full when you name one. It also returns generationDefaults (the default image and video model and image settings) for when the user states no preference.',
297
349
  input: z.object({
298
350
  projectId: z.string().optional(),
299
351
  limit: z.number().int().min(1).max(200).optional().describe('How many projects to list, newest first. Default 40.'),
@@ -335,6 +387,17 @@ export const getWorkspaceState = {
335
387
  });
336
388
  },
337
389
  };
390
+ const clipName = (c) => c.code ?? c.label ?? 'a clip';
391
+ /** "here" and "this" on the timeline, in one line: the playhead, the clips under it and the words spoken there. */
392
+ function describePlace(t) {
393
+ const under = t.underPlayhead.map(clipName);
394
+ const words = t.underPlayhead.map((c) => c.words).find(Boolean);
395
+ return (`On the timeline "${t.name}" the playhead is at ${t.playhead.timecode}` +
396
+ (under.length ? `, over ${under.join(', ')}` : ', over no clip') +
397
+ (t.selectedClips.length ? `; selected clips: ${t.selectedClips.map(clipName).join(', ')}` : '') +
398
+ (words ? `; spoken around it: "${words}"` : '') +
399
+ '.');
400
+ }
338
401
  /**
339
402
  * What the user has selected in the app RIGHT NOW. The selection band in every
340
403
  * grid (images, clips, audio, storyboard shots) reports its ids to the desktop,
@@ -346,7 +409,7 @@ export const getSelection = {
346
409
  description:
347
410
  // Lean on purpose: WHEN to call it is the doctrine's ASSET CODES line, and
348
411
  // this description is paid on every desktop turn (lockstep § 7).
349
- 'The user\'s live selection in the Slates app: ticked cards (with codes) and the image open in the viewer.',
412
+ 'The user\'s live selection in the Slates app: ticked cards (with codes), the image open in the viewer, and where they are on the open timeline (playhead, selected clips, the clips under the playhead and the words spoken there).',
350
413
  input: z.object({}).strict(),
351
414
  async run(_input, ctx) {
352
415
  await ctx.desktop().requireCapability('selection', 'reading the live selection');
@@ -370,6 +433,9 @@ export const getSelection = {
370
433
  }
371
434
  if (viewed)
372
435
  lines.push(`Open in the viewer: ${describe(viewed)}.`);
436
+ const place = r.timeline ?? null;
437
+ if (place)
438
+ lines.push(describePlace(place));
373
439
  if (lines.length === 0) {
374
440
  lines.push('Nothing is selected and no image is open in the viewer. Ask the user to select the cards in Slates (click or drag), or to name the codes.');
375
441
  }
@@ -388,38 +454,46 @@ export const getSelection = {
388
454
  viewing: viewed
389
455
  ? { project_id: r.viewing.projectId, item: viewed, updated_at: r.viewing.updatedAt }
390
456
  : null,
457
+ timeline: place,
391
458
  },
392
459
  };
393
460
  },
394
461
  };
395
462
  // 1.6.1: what is ticked. Mirrors slate's `SELECTION_TARGETS` and `SELECTION_MODES` in `@shared/types/view`
396
463
  // (lockstep check 12), which this package cannot import.
397
- const SELECTION_TARGETS = ['media', 'board'];
464
+ const SELECTION_TARGETS = ['media', 'board', 'timeline'];
398
465
  const SELECTION_MODES = ['replace', 'add', 'remove', 'clear', 'all'];
399
466
  /**
400
- * SET what is selected, as the user's clicks do: the cards ticked in Media, the Shots ticked on the Board.
467
+ * SET what is selected, as the user's clicks do: the cards ticked in Media, the Shots ticked on the Board, the
468
+ * clips selected on the timeline (which also opens the Cut on them, scrolls to them and opens the Inspector).
401
469
  * Pairs with `slates_get_selection`, which reads it: "tick the shots with no clip, then price them" is this op
402
470
  * and then the quote. The desktop applies it through the stores the grids write and answers with what SETTLED.
403
471
  */
404
472
  export const setSelection = {
405
473
  id: 'slates_set_selection',
406
- description: "Tick or untick cards in Media or Shots on the Board, as clicks, Shift-click, Escape and Ctrl/Cmd+A do: replace makes the ids the whole selection, add and remove change only them, clear empties it, all ticks everything the tab shows (Media: the grid as filtered, folded rounds left out; Board: every Shot on the open board). Media needs its grid showing and the Board needs the Board or Script tab; slates_set_view switches. Ids are asset ids or badge codes (Media) or Shot ids or SHOT-A codes (Board). Answers with the selection as it settled and names any id it could not tick. slates_get_selection reads it back; what is selected is what the user means by 'these'.",
474
+ description: "Select cards in Media, Shots on the Board or clips on the timeline, as clicks, Shift-click, Escape and Ctrl/Cmd+A do: replace makes the ids the whole selection, add and remove change only them, clear empties it, all ticks everything the tab shows (Media: the grid as filtered, folded rounds left out; Board: every Shot on the open board; timeline: every clip on the open timeline). Every surface needs a project open in the window, Media its grid showing and the Board the Board or Script tab; slates_set_view opens and switches. On the timeline, clip ids open the Cut on their timeline, scroll to them and open the Inspector on the last, so use it to show the user a clip instead of asking them to click it; all, or replace with no ids, needs a timeline open (slates_set_view cut.timelineId). Ids are asset ids or badge codes (Media), Shot ids or SHOT-A codes (Board) or clip ids from slates_get_timeline (timeline, all on one timeline). Answers with the selection as it settled and names any id it could not select. slates_get_selection reads it back (timeline clips under timeline.selectedClips); what is selected is what the user means by 'these'.",
407
475
  input: z
408
476
  .object({
409
477
  surface: z.enum(SELECTION_TARGETS),
410
478
  mode: z.enum(SELECTION_MODES),
411
- ids: z.array(z.string().min(1)).max(500).optional().describe('Asset ids or codes (media) or Shot ids or codes (board). Not used by clear or all.'),
479
+ ids: z.array(z.string().min(1)).max(500).optional().describe('Asset ids or codes (media), Shot ids or codes (board) or clip ids (timeline). Not used by clear or all.'),
412
480
  })
413
481
  .strict(),
414
482
  async run(input, ctx) {
415
483
  await ctx.desktop().requireCapability('selection-set', 'setting what is selected');
484
+ if (input.surface === 'timeline')
485
+ await ctx.desktop().requireCapability('timeline-select', 'selecting timeline clips');
416
486
  if ((input.mode === 'add' || input.mode === 'remove') && !input.ids?.length)
417
487
  throw new Error(`${input.mode} needs ids.`);
418
488
  const r = await ctx.desktop().post('/agent/selection', input);
419
489
  if (!r.selection)
420
490
  return { text: `Nothing was changed (${r.reason ?? 'no answer'}).`, data: { selection: null } };
421
- const where = r.selection.surface === 'media' ? 'Media' : 'the Board';
422
- const named = (row) => (row.code ? (row.label ? `${row.code} — ${row.label}` : row.code) : row.id);
491
+ const where = r.selection.surface === 'media' ? 'Media' : r.selection.surface === 'timeline' ? 'the timeline' : 'the Board';
492
+ const named = (row) => {
493
+ const coded = row.code ? (row.label ? `${row.code} — ${row.label}` : row.code) : null;
494
+ // A timeline row appends its id, so its label may stand in for a code; a Media or Board row without one is named by its id.
495
+ return row.track && row.start ? `${coded ?? row.label ?? row.id} (${row.track}, ${row.start.timecode}, ${row.id})` : coded ?? row.id;
496
+ };
423
497
  const notes = r.notes?.length ? ` Not applied: ${r.notes.join('; ')}.` : '';
424
498
  return {
425
499
  text: (r.selection.items.length ? `${r.selection.items.length} selected on ${where}: ${r.selection.items.map(named).join(', ')}.` : `Nothing is selected on ${where}.`) + notes,
@@ -433,6 +507,10 @@ export const setSelection = {
433
507
  const VIEW_LENSES = ['board', 'media', 'script'];
434
508
  const VIEW_CUT_SIDES = ['bottom', 'left', 'right'];
435
509
  const VIEW_DOCK_SECTIONS = ['storyboards', 'library', 'folders', 'pinned'];
510
+ // W3: the one window's two layouts (`WINDOW_LAYOUTS`).
511
+ const VIEW_WINDOW_LAYOUTS = ['plan', 'edit'];
512
+ // What the timeline's Viewer shows (`VIEWER_MODES`).
513
+ const VIEW_VIEWER_MODES = ['source', 'timeline'];
436
514
  // 1.6.1: what the user is looking at. Mirrors slate's `@shared/types/view` (lockstep check 12).
437
515
  const VIEW_BOARD_LEVELS = ['film', 'scenes', 'shot'];
438
516
  const VIEW_BOARD_FILTERS = ['all', 'with-clip', 'without-clip'];
@@ -440,6 +518,33 @@ const VIEW_MEDIA_TABS = ['all', 'images', 'videos', 'audio'];
440
518
  const VIEW_SETTINGS_PANES = ['account', 'ai', 'storage', 'logs', 'general', 'keys'];
441
519
  /** What each dock section is called on screen. */
442
520
  const DOCK_SECTION_NAMES = { storyboards: 'Boards', library: 'Library', folders: 'Folders', pinned: 'Pinned' };
521
+ // Delivery ids and dimensions come from the desktop catalog, not model capabilities.
522
+ const deliveryAspectInput = z.string().min(1).describe('Delivery format id from slates_get_variant_grid.formats; the desktop validates it and supplies dimensions.');
523
+ const gridSelectionInput = z.object({ rowKeys: z.array(z.string()), aspects: z.array(deliveryAspectInput) }).strict();
524
+ const deliveryInput = z.object({
525
+ formats: z.array(deliveryAspectInput).min(1),
526
+ shortSide: z.number().int().positive().optional().describe('Optional short side supported by the desktop delivery settings.'),
527
+ mode: z.enum(['fill', 'fit']).optional().describe('Fill crops around focus; fit pads the frame.'),
528
+ }).strict();
529
+ const taxonomyInput = z.object({
530
+ concept: z.string().min(1), variant: z.string().min(1),
531
+ hook: z.string().optional(), body: z.string().optional(), cast: z.string().optional(),
532
+ vf: z.string().optional(), icp: z.string().optional(), lp: z.string().optional(),
533
+ }).strict().describe('Naming fields. Prefill recorded variation choices by position, never infer them from labels. The desktop owns filename formatting and collision resolution.');
534
+ const slotBindingInput = z.object({
535
+ key: z.string(), label: z.string().optional(), choicePosition: z.number().int().nonnegative().optional(),
536
+ sectionId: z.string().optional(), alternativeId: z.string().optional(), shotIds: z.array(z.string().uuid()).optional().describe('Shot ids (UUIDs only, from slates_list_shots).'),
537
+ }).strict();
538
+ const gridBindingInput = z.object({
539
+ familyId: z.string(), variationId: z.string().nullable().optional(),
540
+ slots: z.object({ hook: slotBindingInput.optional(), body: slotBindingInput.optional(), endCard: slotBindingInput.optional() }).strict().optional(),
541
+ intendedShotIds: z.array(z.string().uuid()).optional().describe('Shot ids (UUIDs only, from slates_list_shots).'),
542
+ }).strict().describe('Explicit existing-cut slot bindings; creates no combinations or nested sequences.');
543
+ const cutOptionsInput = {
544
+ delivery: deliveryInput.nullable().optional().describe('Delivery formats and framing defaults; null restores legacy Master export.'),
545
+ taxonomy: taxonomyInput.nullable().optional(),
546
+ gridBinding: gridBindingInput.nullable().optional(),
547
+ };
443
548
  /** 1.6.1: what the user is looking at, in the words on screen. Empty parts are left out. */
444
549
  const describeLooking = (v) => {
445
550
  const parts = [];
@@ -484,21 +589,30 @@ const describeLooking = (v) => {
484
589
  return parts.length ? ' ' + parts.join(' ') : '';
485
590
  };
486
591
  const describeView = (v) => {
487
- const where = v.cut.full
488
- ? 'filling the workspace'
489
- : v.cut.open
490
- ? v.cut.side === 'bottom'
491
- ? `a ${v.cut.height}px band under the ${v.lens} tab`
492
- : `a ${v.cut.width}px column on the ${v.cut.side} of the ${v.lens} tab`
493
- : 'closed, resting as one line at the bottom';
592
+ const under = v.window ? 'along the bottom of the window' : `under the ${v.lens} tab`;
593
+ const where = v.window && !v.window.timeline
594
+ ? 'hidden'
595
+ : v.cut.full
596
+ ? 'filling the workspace'
597
+ : v.cut.open
598
+ ? v.cut.side === 'bottom'
599
+ ? `a ${v.cut.height}px band ${under}`
600
+ : `a ${v.cut.width}px column on the ${v.cut.side} of the ${v.lens} tab`
601
+ : 'closed, resting as one line at the bottom';
602
+ const areas = v.window
603
+ ? [v.window.lens && `the ${v.lens} tab`, v.window.viewer && 'the Viewer', v.window.inspector && (v.window.inspector === 'column' ? 'the Inspector drawer open' : 'the Inspector drawer shut for want of room'), v.window.timeline && 'the timeline'].filter(Boolean)
604
+ : [];
494
605
  const agent = v.studioAgent.enabled
495
606
  ? v.studioAgent.open
496
- ? `the Studio Agent panel is open (${v.studioAgent.width}px)`
497
- : 'the Studio Agent panel is closed'
498
- : 'the Studio Agent is switched off in Settings';
499
- return (`The ${v.lens} tab is showing. The timeline is ${where}. ` +
607
+ ? `the Slates Director panel is open (${v.studioAgent.width}px)`
608
+ : 'the Slates Director panel is closed'
609
+ : 'Slates Director is switched off in Settings';
610
+ return (`The ${v.lens} tab is ${v.window && !v.window.lens ? 'hidden' : 'showing'}. The timeline is ${where}. ` +
500
611
  `The project navigator is ${v.leftDock.open ? `open (${v.leftDock.width}px)` : 'closed'}, and ${agent}.` +
501
612
  (v.leftDock.folded?.length ? ` Folded in the navigator: ${v.leftDock.folded.map((f) => DOCK_SECTION_NAMES[f] ?? f).join(', ')}.` : '') +
613
+ (v.window
614
+ ? ` The window is in the ${v.window.layout === 'edit' ? 'Edit' : 'Plan'} layout, showing ${areas.length > 1 ? `${areas.slice(0, -1).join(', ')} and ${areas.at(-1)}` : areas[0] ?? 'none of its areas'}.`
615
+ : '') +
502
616
  (v.script ? ` The Script page shows ${v.script.details ? 'Words + shots (each shot\'s picture beside its words)' : 'Words (the words alone)'}.` : '') +
503
617
  describeLooking(v));
504
618
  };
@@ -509,7 +623,7 @@ const describeView = (v) => {
509
623
  */
510
624
  export const getView = {
511
625
  id: 'slates_get_view',
512
- description: "What the user is looking at in Slates: Home or a project, the tab (Media, Script or Board), the open board and its View and Filter, Media's tab, chosen folder and narrowing, a Library page, the picture viewer, the timeline Viewer's mode and clip, Compare, the animatic, Settings, whether the prompt box is hidden, the timeline and the side panels, and any dialog or menu open over the page. Read it before telling the user where to click.",
626
+ description: "What the user is looking at in Slates: Home or a project, the tab (Media, Script or Board), the open board and its View and Filter, Media's tab, chosen folder and narrowing, a Library page, the picture viewer, the timeline Viewer's mode and clip, Compare, the animatic, Settings, whether the prompt box is hidden, the timeline and the side panels, and, from a desktop with the one-window layout, the window's layout (Plan or Edit, which areas show, the Viewer's Inspector drawer open or shut for want of room), and any dialog or menu open over the page. New desktops also report cut.format and the selected variant grid rows and aspects. Read it before telling the user where to click.",
513
627
  input: z.object({}).strict(),
514
628
  async run(_input, ctx) {
515
629
  await ctx.desktop().requireCapability('view', 'the window layout');
@@ -537,7 +651,7 @@ export const getView = {
537
651
  */
538
652
  export const setView = {
539
653
  id: 'slates_set_view',
540
- description: "Change what the user is looking at, as their own clicks would: open a project or go Home, switch tab, open a board, jump to a scene, set the Board's View and Filter, set Media's tab, folder and narrowing, jump to a card in Media, open a Library page, a picture in the picture viewer or a clip in the timeline's Viewer, Compare, the animatic or Settings on a pane, show or hide the prompt box, open or park the timeline or switch the cut on it, open a Shot's panel on Script. Only the fields you name change; the app clamps sizes, answers with what it settled on, and names any field it could not apply. A project change is applied alone (it restores that project's own view). Use it when the user asks you to show or open something, not to answer a question they can see for themselves.",
654
+ description: "Change what the user is looking at, as their own clicks would: open a project or go Home, switch tab, open a board, jump to a scene, set the Board's View and Filter, set Media's tab, folder and narrowing, jump to a card in Media, open a Library page, a picture in the picture viewer or a clip in the timeline's Viewer, Compare, the animatic or Settings on a pane, show or hide the prompt box, open or park the timeline or switch the cut on it, open a Shot's panel on Script, set the side panels (the project navigator and its folded sections, the Slates Director panel), the Script page's Words or Words + shots and its text size, the Board's card size and linked clips, and on a desktop with the one-window layout the layout and which areas show. Only the fields you name change; the app clamps sizes, answers with what it settled on, and names any field it could not apply. A project change is applied alone (it restores that project's own view). Use it when the user asks you to show or open something, not to answer a question they can see for themselves.",
541
655
  input: z
542
656
  .object({
543
657
  projectId: z.string().nullable().optional().describe('Open this project, or null for Home. Applied alone.'),
@@ -549,10 +663,12 @@ export const setView = {
549
663
  side: z
550
664
  .enum(VIEW_CUT_SIDES)
551
665
  .optional()
552
- .describe('Where the timeline is parked. A column suits a wide monitor; picking a side opens the timeline.'),
666
+ .describe('Where the timeline is parked; picking a side opens the timeline. On a desktop with the one-window layout it always runs along the bottom: another side comes back as a note and is not applied.'),
553
667
  height: z.number().optional().describe("The bottom band's height in px."),
554
- width: z.number().optional().describe("The side column's width in px."),
668
+ width: z.number().optional().describe("The side column's width in px; with the one-window layout, the Viewer's width in the Plan layout."),
555
669
  timelineId: z.string().optional().describe('The named cut to show on the timeline (slates_list_timelines).'),
670
+ format: deliveryAspectInput.optional().describe('Preview this delivery format; requires ad-variant-export.'),
671
+ gridSelection: gridSelectionInput.optional().describe('Selected existing grid rows and delivery formats; requires ad-variant-export. Does not export.'),
556
672
  })
557
673
  .strict()
558
674
  .optional(),
@@ -575,7 +691,7 @@ export const setView = {
575
691
  })
576
692
  .strict()
577
693
  .optional()
578
- .describe('The Studio Agent panel on the right. It cannot be opened while the agent is off in Settings.'),
694
+ .describe('The Slates Director panel on the right. It cannot be opened while the agent is off in Settings.'),
579
695
  script: z
580
696
  .object({
581
697
  details: z.boolean().optional().describe("Words + shots (true): each shot's picture beside its words on the Script page. Words (false): the words alone."),
@@ -613,7 +729,14 @@ export const setView = {
613
729
  .strict()
614
730
  .optional(),
615
731
  library: z.object({ categoryId: z.string().nullable() }).strict().optional().describe("Open a Library category's page in Media's place; null goes back to the grid."),
616
- viewer: z.object({ assetId: z.string().nullable() }).strict().optional().describe("A picture opens in the picture viewer; a clip plays in the timeline's Viewer (Source), on desktops after 1.6.2. null closes the picture viewer."),
732
+ viewer: z
733
+ .object({
734
+ assetId: z.string().nullable().optional().describe("A picture opens in the picture viewer; a clip plays in the timeline's Viewer (Source), on desktops after 1.6.2. null closes the picture viewer."),
735
+ mode: z.enum(VIEW_VIEWER_MODES).optional().describe("What the timeline's Viewer shows: source (a clip opened to watch) or timeline (the timeline). Compare opens through compare.open. Desktops from 1.6.3."),
736
+ })
737
+ .strict()
738
+ .refine((v) => v.assetId !== undefined || v.mode !== undefined, { message: 'viewer: name assetId or mode' })
739
+ .optional(),
617
740
  compare: z
618
741
  .object({ open: z.boolean().optional(), assetIds: z.array(z.string()).max(4).optional().describe('The compare set, two to four items.') })
619
742
  .strict()
@@ -621,6 +744,16 @@ export const setView = {
621
744
  animatic: z.object({ open: z.boolean(), fromShotId: z.string().optional() }).strict().optional().describe('Play the board as a rough cut from a Shot (the Board or Script tab must be showing).'),
622
745
  settings: z.object({ open: z.boolean(), pane: z.enum(VIEW_SETTINGS_PANES).optional() }).strict().optional().describe('Open Settings, on a pane (ai is AI tools, keys is API keys).'),
623
746
  composer: z.object({ open: z.boolean() }).strict().optional().describe('Show or hide the prompt box.'),
747
+ window: z
748
+ .object({
749
+ layout: z.enum(VIEW_WINDOW_LAYOUTS).optional().describe('edit gives the Viewer the room, with Media, Board and Script a column at its left; plan gives it to them, with the Viewer a column at their right.'),
750
+ viewer: z.boolean().optional().describe('Show or hide the Viewer.'),
751
+ inspector: z.boolean().optional().describe("Open or shut the Inspector, the Viewer's drawer (opening it shows the Viewer); in a window with no room, Media, Board and Script fold to make room."),
752
+ lensWidth: z.number().optional().describe("The Media, Board and Script column's width in px in the Edit layout."),
753
+ })
754
+ .strict()
755
+ .optional()
756
+ .describe('The one window (desktops with it): its layout and which areas show.'),
624
757
  })
625
758
  .strict(),
626
759
  async run(input, ctx) {
@@ -636,6 +769,17 @@ export const setView = {
636
769
  input.script?.panelShotId !== undefined;
637
770
  if (widened)
638
771
  await ctx.desktop().requireCapability('view-v2', 'showing and opening things in the window');
772
+ if (input.cut?.format !== undefined || input.cut?.gridSelection !== undefined) {
773
+ await ctx.desktop().requireCapability('ad-variant-export', 'delivery preview and variant grid selection');
774
+ }
775
+ // A desktop from before the one window has no capability token for it, and refuses a patch holding only
776
+ // `window` as empty; its view report has no `window`, so read that first.
777
+ if (input.window !== undefined && Object.entries(input).every(([k, v]) => k === 'window' || v === undefined)) {
778
+ const current = await ctx.desktop().get('/agent/view');
779
+ if (current.view && current.view.window === undefined) {
780
+ return { text: 'Nothing was changed: this Slates has no one-window layout; update Slates.', data: { view: current.view } };
781
+ }
782
+ }
639
783
  const r = await ctx.desktop().post('/agent/view', input);
640
784
  if (!r.view) {
641
785
  return { text: r.reason ? `Nothing was changed (${r.reason}).` : 'Nothing was changed.', data: { view: null } };
@@ -644,7 +788,11 @@ export const setView = {
644
788
  const noFolds = input.leftDock?.folded !== undefined && r.view.leftDock.folded === undefined
645
789
  ? " This Slates cannot fold the navigator's sections; update Slates."
646
790
  : '';
647
- return { text: describeView(r.view) + noFolds, data: { view: r.view } };
791
+ // A desktop from before the one window takes the patch and ignores `window`.
792
+ const noWindow = input.window !== undefined && r.view.window === undefined
793
+ ? ' This Slates has no one-window layout, so window was not applied; update Slates.'
794
+ : '';
795
+ return { text: describeView(r.view) + noFolds + noWindow, data: { view: r.view } };
648
796
  },
649
797
  };
650
798
  /**
@@ -856,7 +1004,7 @@ export const getUsage = {
856
1004
  };
857
1005
  export const getAppSettings = {
858
1006
  id: 'slates_get_app_settings',
859
- description: "The app's own settings an agent may read: the app version, the projects folder, which tab a never-opened project lands on (newProjectLens), whether ChatGPT images is on, and (from Slates 1.6.1) who does the Studio Agent's thinking (studioAgentHost: slates, codex or claude) with each host's model and thinking level ('' is its default). Never keys or sign-in.",
1007
+ description: "The app's own settings an agent may read: the app version, the projects folder, which tab a never-opened project lands on (newProjectLens), whether ChatGPT images is on, and (from Slates 1.6.1) who does Slates Director's thinking (studioAgentHost: slates, codex or claude) with each host's model and thinking level ('' is its default). Never keys or sign-in.",
860
1008
  input: z.object({}).strict(),
861
1009
  async run(_input, ctx) {
862
1010
  await ctx.desktop().requireCapability('app-settings', 'app settings');
@@ -866,7 +1014,7 @@ export const getAppSettings = {
866
1014
  const HOST_KEYS = ['studioAgentHost', 'studioAgentCodexModel', 'studioAgentCodexEffort', 'studioAgentClaudeModel', 'studioAgentClaudeEffort'];
867
1015
  export const setAppSettings = {
868
1016
  id: 'slates_set_app_settings',
869
- description: "Change an app setting the user asked you to: newProjectLens (the tab a never-opened project lands on: media, script or board), chatGptImagesEnabled (Settings → AI tools → ChatGPT images), or who does the Studio Agent's thinking: studioAgentHost (slates, codex for the user's own Codex on their ChatGPT plan, claude for their own Claude Code on their Claude plan) and each host's model and thinking level, ids from the host's own list or '' for its default. The projects folder, keys and sign-in are the user's to change.",
1017
+ description: "Change an app setting the user asked you to: newProjectLens (the tab a never-opened project lands on: media, script or board), chatGptImagesEnabled (Settings → AI tools → ChatGPT images), or who does Slates Director's thinking: studioAgentHost (slates, codex for the user's own Codex on their ChatGPT plan, claude for their own Claude Code on their Claude plan) and each host's model and thinking level, ids from the host's own list or '' for its default. The projects folder, keys and sign-in are the user's to change.",
870
1018
  input: z
871
1019
  .object({
872
1020
  newProjectLens: z.enum(['media', 'script', 'board']).optional(),
@@ -882,7 +1030,7 @@ export const setAppSettings = {
882
1030
  await ctx.desktop().requireCapability('app-settings', 'app settings');
883
1031
  // An older desktop has the route but not these keys: ask it by capability, so it says "update Slates".
884
1032
  if (HOST_KEYS.some((key) => input[key] !== undefined)) {
885
- await ctx.desktop().requireCapability('agent-host', "choosing who does the Studio Agent's thinking");
1033
+ await ctx.desktop().requireCapability('agent-host', "choosing who does Slates Director's thinking");
886
1034
  }
887
1035
  return ok(await ctx.desktop().post('/agent/app-settings', input));
888
1036
  },
@@ -913,9 +1061,67 @@ export const linkAssetSource = {
913
1061
  }));
914
1062
  },
915
1063
  };
1064
+ export const transcribeAsset = {
1065
+ id: 'slates_transcribe_asset',
1066
+ billable: false,
1067
+ description: "Transcribe a video or audio asset's speech into words timed to within a frame, as the card's Transcribe command does. Free: it runs on the user's machine and spends no credits. The first run downloads the speech models once (the result's downloadedModelsMB says how much) and can take minutes; if the call times out, the desktop keeps working, so read slates_get_asset_transcript before trying again. A repeat, or another asset with the same bytes, reuses the stored transcript (reused: true); force re-runs it, and an edited transcript (edited: true) is kept unless forced. noSpeech: true means the audio holds no speech. slates_add_captions transcribes on its own, so call this when you want the words themselves.",
1068
+ input: z
1069
+ .object({
1070
+ projectId: z.string().uuid(),
1071
+ assetId: z.string().min(1).describe('A video or audio asset: its code (VID-V3) or id.'),
1072
+ force: z.boolean().optional().describe('Transcribe again even when a stored transcript exists.'),
1073
+ })
1074
+ .strict(),
1075
+ async run(input, ctx) {
1076
+ await ctx.desktop().requireCapability('transcripts', 'transcripts');
1077
+ const id = (await resolveAssetRefs(ctx, input.projectId, [input.assetId])).get(input.assetId).id;
1078
+ const r = await ctx.desktop().post('/agent/assets/transcribe', { assetId: id, ...(input.force ? { force: true } : {}) });
1079
+ const what = r.noSpeech ? 'No speech in this asset.' : r.reused ? 'Reused the stored transcript.' : 'Transcribed.';
1080
+ const models = r.downloadedModelsMB ? ` Downloaded ${r.downloadedModelsMB} MB of speech models first.` : '';
1081
+ return ok(r, `${what}${models} ${JSON.stringify(r)}`);
1082
+ },
1083
+ };
1084
+ export const getAssetTranscript = {
1085
+ id: 'slates_get_asset_transcript',
1086
+ description: "Read an asset's stored transcript: its words with their times in the asset's own seconds, whether it holds speech, whether the user edited it, and when it was made. Never transcribes: transcript null with a hint means nobody has transcribed it yet (slates_transcribe_asset, free).",
1087
+ input: z
1088
+ .object({
1089
+ projectId: z.string().uuid(),
1090
+ assetId: z.string().min(1).describe('A video or audio asset: its code (VID-V3) or id.'),
1091
+ })
1092
+ .strict(),
1093
+ async run(input, ctx) {
1094
+ await ctx.desktop().requireCapability('transcripts', 'transcripts');
1095
+ const id = (await resolveAssetRefs(ctx, input.projectId, [input.assetId])).get(input.assetId).id;
1096
+ return ok(await ctx.desktop().get('/agent/assets/transcript', { assetId: id }));
1097
+ },
1098
+ };
1099
+ export const editAssetTranscript = {
1100
+ id: 'slates_edit_asset_transcript',
1101
+ billable: false,
1102
+ description: "Correct an asset's transcript by sending its whole text back, edited, as the transcript editor in the app does: a corrected word keeps its time, a removed word goes, and a new word takes time shared out from its neighbours (the silence between them, or the word before it). Paragraph breaks are free; only the words count. By default the captions heard from this asset are made again from the corrected words, on the same tracks in the same style (recaption false skips that); captions estimated from the Shot's line or written from your own words are left alone. Read the current text first with slates_get_asset_transcript. Free. The machine's own words stay stored, so slates_transcribe_asset with force starts fresh.",
1103
+ input: z
1104
+ .object({
1105
+ projectId: z.string().uuid(),
1106
+ assetId: z.string().min(1).describe('A video or audio asset with a transcript: its code (VID-V3) or id.'),
1107
+ text: z.string().min(1).describe('The whole transcript, edited. Words are separated by spaces or line breaks.'),
1108
+ recaption: z.boolean().optional().describe("Make this asset's captions again from the edited words. Default true."),
1109
+ })
1110
+ .strict(),
1111
+ async run(input, ctx) {
1112
+ await ctx.desktop().requireCapability('transcript-edit', 'transcript editing');
1113
+ const id = (await resolveAssetRefs(ctx, input.projectId, [input.assetId])).get(input.assetId).id;
1114
+ const r = await ctx.desktop().post('/agent/assets/transcript/edit', {
1115
+ assetId: id, text: input.text, ...(input.recaption === false ? { recaption: false } : {}),
1116
+ });
1117
+ const c = r.changed;
1118
+ const summary = { assetId: id, changed: c, recaptioned: r.recaptioned };
1119
+ return ok(summary, `Saved: ${c.corrected} corrected, ${c.added} added, ${c.removed} removed.${r.recaptioned.length ? ` Remade ${r.recaptioned.length} caption clip${r.recaptioned.length === 1 ? '' : 's'}: ${r.recaptioned.join(', ')}.` : ''}`);
1120
+ },
1121
+ };
916
1122
  export const extractVideoFrame = {
917
1123
  id: 'slates_extract_video_frame',
918
- description: "Save one frame of a clip as a new picture in Media, as the clip card's camera does: at 'first', 'last' (default 'first') or a second. Free. The usual continuity move: extract a clip's last frame and use it as the next clip's first frame.",
1124
+ description: "Save one frame of a clip as a new picture in Media, as the clip card's camera does: at 'first', 'last' (default 'first') or a second. Free. The usual continuity move: extract a clip's last frame and use it as the next clip's first frame. To only look at a clip, use slates_get_asset_video_frames; this one adds a picture to the project.",
919
1125
  input: z
920
1126
  .object({
921
1127
  projectId: z.string().uuid(),
@@ -940,7 +1146,7 @@ export const getMe = {
940
1146
  };
941
1147
  export const getCreditBalance = {
942
1148
  id: 'slates_get_credit_balance',
943
- description: 'Current Slates credit balance (abstract credits — never expire). Call before any generation that costs credits.',
1149
+ description: 'Current credit balance only (credits never expire); slates_get_me also returns identity and license tier. Read it to answer a balance question or to check there is enough for a quoted total.',
944
1150
  input: z.object({}).strict(),
945
1151
  async run(_input, ctx) {
946
1152
  const r = await ctx.cloud().get('/api/agent/credits/balance');
@@ -956,7 +1162,8 @@ export const listAvailableModels = {
956
1162
  }),
957
1163
  async run(input, ctx) {
958
1164
  const r = await ctx.cloud().get('/api/agent/models');
959
- let models = r.models;
1165
+ // The server keeps a retired seat's keys for older desktops; an agent is never offered them.
1166
+ let models = r.models.filter((m) => !retiredModelOfKey(m.model));
960
1167
  if (input.filter) {
961
1168
  const q = input.filter.toLowerCase();
962
1169
  models = models.filter((m) => m.model.toLowerCase().includes(q));
@@ -964,16 +1171,16 @@ export const listAvailableModels = {
964
1171
  // Compact text table — "key credits" lines are ~5x denser than the raw
965
1172
  // JSON registry (the full pretty-printed dump was an ~8k-token leak).
966
1173
  const table = models.map((m) => `${m.model} ${creditCost(m)}`).join('\n');
967
- return {
968
- text: `${models.length} COST keys (credits per generation)${input.filter ? ` matching "${input.filter}"` : ''}. ` +
969
- `NOTE: these are billing keys for cost lookup ONLY — the \`model\` param on the generate ops takes a BASE id. ` +
970
- // Derived from the SSOT arrays, not restated: a hand-written list here
971
- // drifts the moment a model lands (it already omitted omni-flash).
972
- `slates_generate_video: ${VIDEO_MODELS.join(' | ')} (duration/videoResolution as separate params). ` +
973
- `slates_generate_audio: ${AUDIO_MODELS.join(' | ')} (durationSeconds as a separate param):\n` +
974
- table,
975
- data: { count: models.length },
976
- };
1174
+ const text = `${models.length} COST keys (credits per generation)${input.filter ? ` matching "${input.filter}"` : ''}. ` +
1175
+ `NOTE: these are billing keys for cost lookup ONLY — the \`model\` param on the generate ops takes a BASE id. ` +
1176
+ // Derived from the SSOT arrays, not restated: a hand-written list here
1177
+ // drifts the moment a model lands (it already omitted omni-flash).
1178
+ `slates_generate_video: ${VIDEO_MODELS.join(' | ')} (duration/videoResolution as separate params). ` +
1179
+ `slates_generate_audio: ${AUDIO_MODELS.join(' | ')} (durationSeconds as a separate param):\n` +
1180
+ table;
1181
+ // The whole text rides in `data` too: the MCP server mirrors `data` as structuredContent, and a host that
1182
+ // shows only structuredContent (Claude Code) otherwise hands the model `{count}` and no prices (2026-10-18).
1183
+ return { text, data: { count: models.length, text } };
977
1184
  },
978
1185
  };
979
1186
  // ── Video model vocabulary ──────────────────────────────────────
@@ -996,7 +1203,17 @@ export const VIDEO_MODELS = [
996
1203
  // not here; edit models live on slates_edit_video, same as the Kling and Omni
997
1204
  // Flash ones.
998
1205
  'seedance-2.5',
1206
+ // Gemini Omni Flash, version 1.1 since 2026-10-17: swapped in place, same id,
1207
+ // fal's `google/gemini-omni-flash/v1.1/*` endpoints.
999
1208
  'omni-flash',
1209
+ // Wan 3.0 (Alibaba, added 2026-10-17): 2-30s at 480p-1080p, sound on or off,
1210
+ // start and end frames OR references (10 images, 5 videos, 5 audio clips).
1211
+ // Reference video seconds bill on top of output seconds, so it has a vref key.
1212
+ 'wan-3.0',
1213
+ // Kling 4.0 (added 2026-10-23 beside 3.0, which stays the default Kling):
1214
+ // one row with no Standard/Pro split, frames or text only, sound always on.
1215
+ // `kling-v4.0` never starts with `kling-v3.0`, so no 3.0 branch can take it.
1216
+ 'kling-v4.0',
1000
1217
  // MiniMax H3, three seats in one family. Base H3 (2026-08-27) is the
1001
1218
  // AUTHORED-AUDIO seat — three directable sound layers in one pass, declared
1002
1219
  // reference relationships, 480p to 4K. H3 Max (2026-08-27) is fal's
@@ -1013,7 +1230,7 @@ export const VIDEO_MODELS = [
1013
1230
  'minimax-h3-max',
1014
1231
  'minimax-h3-max-turbo',
1015
1232
  // LTX-2.5, two seats in one family (2026-08-29). Base is the VOLUME seat —
1016
- // cheapest 1080p second with sound included, free native audio at every tier,
1233
+ // cheapest native 1080p second with sound included, free native audio at every tier,
1017
1234
  // the only row reaching 1440p, and clips up to 20s.
1018
1235
  // Pro is the fidelity seat and is NOT a superset: shorter ladder (no
1019
1236
  // 1440p/4K), shorter clips (6/8/10 only) and ~1/3 dearer.
@@ -1041,8 +1258,10 @@ const VIDEO_ASPECT_RATIOS = aspectRatioUnion(VIDEO_MODELS, AGENT_ROUTE_PROVIDER)
1041
1258
  const VIDEO_RESOLUTIONS = videoResolutionUnion(VIDEO_MODELS);
1042
1259
  /** Widest legal duration window across every video model. */
1043
1260
  const VIDEO_DURATION_BOUNDS = durationBounds(VIDEO_MODELS);
1044
- /** Omni Flash's combined reference-image cap, read from the SSOT (7). */
1261
+ /** Omni Flash's combined reference-image cap, read from the SSOT (10 on 1.1). */
1045
1262
  const omniFlashRefCap = getModelCapability('omni-flash')?.maxIngredientImages ?? 0;
1263
+ /** Omni Flash's per-clip reference-video ceiling in seconds, read from the SSOT. */
1264
+ const omniFlashRefClipMax = getModelCapability('omni-flash')?.referenceVideoDuration?.max ?? 0;
1046
1265
  /** Every resolution token any video model speaks, for the forgiving cost-key
1047
1266
  * parser. Derived, so 768p and 2k arrived with the models rather than with a
1048
1267
  * later bug report. */
@@ -1086,6 +1305,9 @@ const MINIMAX_FREE_REF_IMAGES_BY_MODEL = {
1086
1305
  * in slate/src/shared/pricing.ts.
1087
1306
  */
1088
1307
  const LTX_MODELS = new Set(['ltx-2-5', 'ltx-2-5-pro']);
1308
+ /** Max billed seconds on a Wan 3.0 take: 30s of output plus 15s of reference
1309
+ * video, which fal bills "in addition to output duration". */
1310
+ const WAN_3_VREF_MAX_TOTAL = 45;
1089
1311
  /** K for the `-ref{K}` suffix: images past the free five, capped by the model's
1090
1312
  * own declared ceiling. 0 for h3-max (no reference transport) and for anything
1091
1313
  * that is not a MiniMax row. Mirrors refImageSurchargeCount() in
@@ -1116,6 +1338,13 @@ export const EDIT_VIDEO_MODELS = [
1116
1338
  'omni-flash-edit',
1117
1339
  'seedance-2.5-edit',
1118
1340
  ];
1341
+ // The op's default, not MODEL_FACTS' edit tier default: the desktop route defaults to the same Kling
1342
+ // engine (slate routes.ts, /agent/generation/edit-video), so moving it is a two-repo change.
1343
+ const EDIT_VIDEO_DEFAULT = 'kling-v3.0-omni-edit';
1344
+ /** The edit engines that take character and style references (elements); the run refuses them on the rest. */
1345
+ const EDIT_VIDEO_ELEMENT_MODELS = EDIT_VIDEO_MODELS.filter((m) => (getModelCapability(m)?.maxIngredientImages ?? 0) > 0);
1346
+ const EDIT_VIDEO_ELEMENT_CAP = Math.max(...EDIT_VIDEO_ELEMENT_MODELS.map((m) => getModelCapability(m)?.maxIngredientImages ?? 0));
1347
+ const EDIT_VIDEO_ELEMENTS_ONLY = `Only ${EDIT_VIDEO_ELEMENT_MODELS.join(' and ')} take them; the other engines refuse them.`;
1119
1348
  /**
1120
1349
  * Source-clip length an edit engine accepts, read from the SSOT.
1121
1350
  *
@@ -1131,14 +1360,14 @@ function editClipBounds(model) {
1131
1360
  throw new Error(`editClipBounds: no duration capability for "${model}"`);
1132
1361
  return { min: d.min, max: d.max };
1133
1362
  }
1134
- /** Resolutions any edit engine exposes as a PARAM. Only Seedance's edit price
1135
- * moves with resolution; the Kling and Omni Flash rows are fixed to the source. */
1136
- const EDIT_VIDEO_RESOLUTIONS = videoResolutionUnion(['seedance-2.5-edit']);
1363
+ /** Resolutions any edit engine exposes as a PARAM. Seedance's and Omni Flash
1364
+ * 1.1's edit prices move with resolution; the Kling rows follow the source. */
1365
+ const EDIT_VIDEO_RESOLUTIONS = videoResolutionUnion(['seedance-2.5-edit', 'omni-flash-edit']);
1137
1366
  export const estimateGenerationCost = {
1138
1367
  id: 'slates_estimate_generation_cost',
1139
- description: 'Quote credits before any generate_* op. Accepts the generation model ids and parameters (edit seats other than Kling, lip-sync and motion-transfer engines need an exact registry cost key), or an exact registry cost key. Pairs with the confirm gate.',
1368
+ description: 'Quote credits before any generate_* op. For saved Shots, a board or a scene, quote with slates_get_board_quote instead. Accepts the generation model ids and parameters (edit seats other than Kling, lip-sync and motion-transfer engines need an exact registry cost key), or an exact registry cost key. Show the user the total and wait for their OK before the generate call; the result flags requires_confirm above the threshold and carries the model\'s prompting card.',
1140
1369
  input: z.object({
1141
- model: z.string().describe('Base model id as passed to the generate op (e.g. "seedance-2", "kling-v3.0-std", "nano-banana-2") or an exact registry cost key ("nano-banana-2-2k", "seedance-2-1080p-8s")'),
1370
+ model: z.string().describe('Base model id as passed to the generate op (e.g. "seedance-2", "kling-v3.0-std", "nano-banana-2-1") or an exact registry cost key ("nano-banana-2-1-2k", "seedance-2-1080p-8s")'),
1142
1371
  quantity: z.number().int().min(1).max(10).optional().describe('Number of generations (default 1)'),
1143
1372
  // Video windows and resolutions GENERATED from MODEL_CAPABILITIES. The
1144
1373
  // hand-typed "Video 3-15" here was wrong the day seedance-2.5 (4-30s)
@@ -1154,17 +1383,23 @@ export const estimateGenerationCost = {
1154
1383
  videoResolution: zEnum(VIDEO_RESOLUTIONS).optional().describe('Video only. Omitted, each model quotes at its own default. Per-model ladders: see slates_generate_video\'s videoResolution.'),
1155
1384
  resolution: z.enum(['1k', '2k', '3k', '4k']).optional().describe('Image only. Omit for the model default; pass the same value to generation.'),
1156
1385
  quality: z.enum(GPT_QUALITY_TIERS).optional().describe(`GPT Image tier; default ${DEFAULT_GPT_QUALITY}.`),
1157
- aspectRatio: z.string().optional().describe('GPT Image only: 1:1, 4:3 and 3:4 cost more than 16:9.'),
1158
- sound: z.boolean().optional().describe('Kling 3.0: the audio flag changes the cost key. Omitted means sound on, as generation bills it; pass false to price a silent take. Kling 4K keys include audio.'),
1159
- seedanceFace: z.boolean().optional().describe('Seedance Face row, for an AI character\'s face (pricier key).'),
1386
+ aspectRatio: z.string().optional().describe('GPT Image: the frame shape changes the price; pass the generation\'s value.'),
1387
+ sound: z.boolean().optional().describe('Kling 3.0: a silent take prices differently from one with sound. Omitted means sound on, as generation bills it; pass false to price a silent take. Kling 4K keys include audio.'),
1388
+ seedanceFace: z.boolean().optional().describe('Seedance Face row, for an AI character\'s face.'),
1160
1389
  seedanceRealFace: z.boolean().optional().describe('Seedance with a consented real person (premium key).'),
1161
1390
  videoRefSeconds: z.number().nonnegative().optional().describe('Combined reference-video seconds, measured from the clips.'),
1162
1391
  audioRefSeconds: z.number().nonnegative().optional().describe('Combined reference-audio seconds, including attached character voices.'),
1163
1392
  referenceImages: z.number().int().min(0).optional().describe(`MiniMax H3 rows only — how many reference IMAGES the generation will carry. Each image past the row's free allowance is a paid dimension of the cost key, so a quote that omits this UNDER-REPORTS a reference-heavy job. The allowances differ: minimax-h3 gives ${MINIMAX_FREE_REF_IMAGES_BY_MODEL['minimax-h3']} free, minimax-h3-max gives ${MINIMAX_FREE_REF_IMAGES_BY_MODEL['minimax-h3-max']}. Ignored by every other model. Start/end frames are free on both rows and are not reference images.`),
1164
1393
  }),
1165
1394
  async run(input, ctx) {
1395
+ // A retired seat is never quoted: its keys still bill older desktops, and `nano-banana-2-1k` (the
1396
+ // retired Nano Banana 2 at 1K) would otherwise answer an agent that meant Nano Banana 2.1.
1397
+ const retired = retiredModelOfKey(input.model);
1398
+ if (retired) {
1399
+ throw new Error(`${retired} was retired and ${RETIRED_MODELS[retired]} replaced it. Quote ${RETIRED_MODELS[retired]} with the same parameters.`);
1400
+ }
1166
1401
  const registry = await ctx.cloud().get('/api/agent/models');
1167
- const byKey = new Map(registry.models.map((m) => [m.model, creditCost(m)]));
1402
+ const byKey = new Map(registry.models.filter((m) => !retiredModelOfKey(m.model)).map((m) => [m.model, creditCost(m)]));
1168
1403
  // 1) exact registry cost key
1169
1404
  let key = byKey.has(input.model) ? input.model : null;
1170
1405
  // 2) image base id + resolution (+ quality for GPT Image 2.5)
@@ -1316,7 +1551,8 @@ export const estimateGenerationCost = {
1316
1551
  // paid for on every turn of every session and read once — this is paid for
1317
1552
  // only by the call that is about to use the model.
1318
1553
  const skill = promptingSkillFor(input.model);
1319
- const card = describeCraftCard(skill);
1554
+ // From the user's brain: their My brain card for this model rides first when they wrote one (craft-cards.ts).
1555
+ const card = describeCraftCard(skill, brainSkills().skills[skill]);
1320
1556
  const banned = describeBannedTokensForSkill(skill);
1321
1557
  // Before the card on purpose: the desktop strips a repeated card by cutting
1322
1558
  // the text at "--- HOW TO PROMPT", and this line must survive that.
@@ -1356,7 +1592,7 @@ export const estimateGenerationCost = {
1356
1592
  // ── Projects ────────────────────────────────────────────────────
1357
1593
  export const listProjects = {
1358
1594
  id: 'slates_list_projects',
1359
- description: 'List all Slates projects in the desktop workspace.',
1595
+ description: 'Full records for every project in the desktop workspace, unbounded. To start a session use slates_get_workspace_state instead: the compact list, the active project and generation defaults.',
1360
1596
  input: z.object({}).strict(),
1361
1597
  async run(_input, ctx) {
1362
1598
  const r = await ctx.desktop().get('/agent/projects');
@@ -1365,7 +1601,7 @@ export const listProjects = {
1365
1601
  };
1366
1602
  export const createProject = {
1367
1603
  id: 'slates_create_project',
1368
- description: 'Create a new Slates project. Returns the new project record.',
1604
+ description: 'Create a new Slates project, only when the user asks for one; otherwise work in the current project (slates_get_workspace_state). Returns the new project record.',
1369
1605
  input: z.object({ name: z.string().min(1).max(120) }),
1370
1606
  async run(input, ctx) {
1371
1607
  const r = await ctx.desktop().post('/agent/projects', { name: input.name });
@@ -1471,7 +1707,7 @@ function describeResolvedRefs(refInputs, resolved) {
1471
1707
  }
1472
1708
  export const listAssets = {
1473
1709
  id: 'slates_list_assets',
1474
- description: 'List assets in a Slates project as COMPACT rows (id, code, label, type) — newest first, default limit 50. Each asset carries its short code (IMG-A12 / VID-V3 / AUD-S1 — the badge the user sees on the gallery card) and label. When the user names an asset by code ("use IMG-A36 as the reference"), pass it as `search` to resolve the assetId. Always speak about assets by code + label, never by UUID. A favorited asset carries `isFavorite: true` (absent means not favorited). NOTE: generate_* results already return the new asset ids — do NOT call this to find an asset you just created.',
1710
+ description: 'List assets in a Slates project as compact rows (id, code, label, type) — newest first, default limit 50. Each asset carries its short code (IMG-A12 / VID-V3 / AUD-S1 — the badge the user sees on the gallery card) and label. When the user names an asset by code ("use IMG-A36 as the reference"), pass it as `search` to resolve the assetId. Always speak about assets by code + label, never by UUID. A favorited asset carries `isFavorite: true` (absent means not favorited). Generate results already return new asset ids, so do not list to find one you just created.',
1475
1711
  input: z.object({
1476
1712
  projectId: z.string().uuid(),
1477
1713
  type: z.enum(['image', 'video', 'audio']).optional().describe('Only this asset type'),
@@ -1508,7 +1744,7 @@ export const listAssets = {
1508
1744
  };
1509
1745
  export const getAssetImage = {
1510
1746
  id: 'slates_get_asset_image',
1511
- description: 'Read an asset image off disk and return it inline as base64 so the calling LLM sees the actual pixels. The response also carries the asset\'s short code (e.g. IMG-A12) and human label — USE these when referring to the asset in chat with the user (e.g. "I\'m using IMG-A12 — Beach Sunset as the first frame") so they can match it to the badged thumbnail in the Slates gallery. Default JPEG 85% ≤1024px long-edge for token economy. Pass fullRes=true for the original PNG.',
1747
+ description: 'Read an asset image off disk and return it inline as base64 so the calling LLM sees the actual pixels. The response also carries the asset\'s short code (e.g. IMG-A12) and human label; use these when referring to the asset in chat with the user (e.g. "I\'m using IMG-A12 — Beach Sunset as the first frame") so they can match it to the badged thumbnail in the Slates gallery. Default JPEG 85% ≤1024px long-edge for token economy. Pass fullRes=true for the original PNG. Takes the asset UUID, not a badge code.',
1512
1748
  input: z.object({
1513
1749
  id: z.string().uuid(),
1514
1750
  fullRes: z.boolean().optional(),
@@ -1534,7 +1770,7 @@ export const getAssetsBatch = {
1534
1770
  id: 'slates_get_assets_batch',
1535
1771
  description: 'Fetch up to 8 image-asset thumbnails inline in a single call. Use this when picking the right reference from a project gallery — one round trip beats N. Each returned image carries its short code (IMG-A12) and label. Video assets are not supported here — call slates_get_asset_video_frames for those.',
1536
1772
  input: z.object({
1537
- ids: z.array(z.string().uuid()).min(1).max(8).describe('1-8 image-asset ids. Order is preserved in the response.'),
1773
+ ids: z.array(z.string().uuid()).min(1).max(8).describe('1-8 image-asset UUIDs (not badge codes). Order is preserved in the response.'),
1538
1774
  }),
1539
1775
  async run(input, ctx) {
1540
1776
  const r = await ctx.desktop().post('/agent/assets/batch-images', { ids: input.ids });
@@ -1565,7 +1801,7 @@ export const getAssetVideoFrames = {
1565
1801
  id: 'slates_get_asset_video_frames',
1566
1802
  description: 'Extract evenly-spaced sampled still frames from a video asset and return them inline as JPEGs. Inspect visible appearance, composition and identity before revising a prompt. Stills do not verify continuous motion, timing, lip sync or sound; actual playback through a capable host is needed for those claims. Default 3 samples; count can request more. The response includes the asset code and label; use them when discussing the clip.',
1567
1803
  input: z.object({
1568
- id: z.string().uuid(),
1804
+ id: z.string().uuid().describe(ASSET_UUID_ONLY),
1569
1805
  count: z.number().int().min(1).max(8).optional().describe('Number of frames to extract. Default 3.'),
1570
1806
  }),
1571
1807
  async run(input, ctx) {
@@ -1615,11 +1851,12 @@ export const connectChatGpt = {
1615
1851
  };
1616
1852
  export const generateChatGptImage = {
1617
1853
  id: 'slates_generate_chatgpt_image',
1618
- description: 'Generate an image through the local Codex host using the connected ChatGPT account, then save it in Slates with its exact submitted prompt, reference lineage and measured dimensions. Uses ChatGPT account limits, never Slates credits or a paid API fallback. Check slates_get_chatgpt_status first. Supply a new UUID requestId once per intended generation; reuse it for retries to avoid duplicate generation/import. No explicit image model, quality or size controls are exposed. Prompt may request visual properties without guaranteeing them. Background returns a generationId for slates_get_generation_status.',
1854
+ description: 'Generate an image through the local Codex host using the connected ChatGPT account, then save it in Slates with its exact submitted prompt, reference lineage and measured dimensions. Uses ChatGPT account limits, never Slates credits or a paid API fallback. Check slates_get_chatgpt_status first. Supply a new UUID requestId once per intended generation; reuse it for retries to avoid duplicate generation/import. No explicit image model, quality or size controls are exposed. Prompt may request visual properties without guaranteeing them. Background returns a generationId for slates_get_generation_status. After an error, start no new run unless the user asks; a retry reuses the same requestId.',
1619
1855
  input: z.object({ projectId: z.string().uuid(), requestId: z.string().uuid(), prompt: z.string().min(1),
1620
1856
  aspectRatio: z.enum(CHATGPT_FRAMING_RATIOS).optional().describe('Optional framing request appended verbally to the prompt, not an exact output-size guarantee.'),
1621
1857
  referenceAssetIds: z.array(z.string().min(1)).optional(), background: z.boolean().optional(), folderId: folderIdField }),
1622
1858
  async run(input, ctx) {
1859
+ requireGuideRead(ctx, 'ChatGPT images', 'slates-chatgpt-images');
1623
1860
  const desktop = ctx.desktop();
1624
1861
  await desktop.requireCapability('chatgpt-image-generation', 'ChatGPT image generation');
1625
1862
  // A desktop before the folder rule ignores folderId and files at the root.
@@ -1757,7 +1994,7 @@ export const moveAssetsToFolder = {
1757
1994
  id: 'slates_move_assets_to_folder',
1758
1995
  description: 'Move one or more assets into a folder, or to the project root (folderId=null).',
1759
1996
  input: z.object({
1760
- assetIds: z.array(z.string().uuid()).min(1),
1997
+ assetIds: z.array(z.string().uuid()).min(1).describe(ASSET_UUID_ONLY),
1761
1998
  folderId: z.string().uuid().nullable(),
1762
1999
  }),
1763
2000
  async run(input, ctx) {
@@ -1768,7 +2005,7 @@ export const setAssetFavorite = {
1768
2005
  id: 'slates_set_asset_favorite',
1769
2006
  description: 'Mark or unmark one asset as a favorite. The heart persists on the card in the app, and slates_list_assets reports it as isFavorite.',
1770
2007
  input: z.object({
1771
- assetId: z.string().uuid(),
2008
+ assetId: z.string().uuid().describe(ASSET_UUID_ONLY),
1772
2009
  favorite: z.boolean(),
1773
2010
  }),
1774
2011
  async run(input, ctx) {
@@ -1780,7 +2017,7 @@ export const exportAssets = {
1780
2017
  id: 'slates_export_assets',
1781
2018
  description: 'Copy the ORIGINAL files of one or more assets (images, clips or audio) into a directory on this machine, named by their codes (IMG-A12.png). Never overwrites: a clash gets -2, -3. The project is untouched. Works for an image-only project with no shot, video or timeline. Returns each exported path and any asset whose file is missing.',
1782
2019
  input: z.object({
1783
- assetIds: z.array(z.string().uuid()).min(1),
2020
+ assetIds: z.array(z.string().uuid()).min(1).describe(ASSET_UUID_ONLY),
1784
2021
  directory: z.string().min(1).describe('Absolute path; created if it does not exist.'),
1785
2022
  }),
1786
2023
  async run(input, ctx) {
@@ -1886,7 +2123,7 @@ export const copyAssetsToProject = {
1886
2123
  };
1887
2124
  export const moveEntityToProject = {
1888
2125
  id: 'slates_move_entity_to_project',
1889
- description: "Move a Library item (a character, location, product, look…) into another project, taking every image it references with it; it lands in the target's category of the same name. This is the fix when slates_move_assets_to_project refuses an asset because a Library item still uses it: the image can't leave on its own, but the whole item can. Refuses (rather than cascading) if one of its images is ALSO used by something else — copy the images instead in that case. mentioningShots lists this project's Shots that mention it: they keep the words and fire without it until it comes back. Board frames are not movable this way; moving a frame's image out would empty the shot.",
2126
+ description: "Move a Library item (a character, location, product, look…) into another project, taking every image it references with it; it lands in the target's category of the same name. This is the fix when slates_move_assets_to_project refuses an asset because a Library item still uses it: the image can't leave on its own, but the whole item can. Refuses (rather than cascading) if one of its images is also used by something else; then use slates_copy_library_item_to_project to copy the whole item, or slates_copy_assets_to_project for the images alone. mentioningShots lists this project's Shots that mention it: they keep the words and fire without it until it comes back. Board frames are not movable this way; moving a frame's image out would empty the shot.",
1890
2127
  input: z.object({
1891
2128
  kind: z
1892
2129
  .enum(['library', 'character', 'environment', 'style'])
@@ -1906,7 +2143,7 @@ export const moveEntityToProject = {
1906
2143
  // ── Characters ──────────────────────────────────────────────────
1907
2144
  export const listCharacters = {
1908
2145
  id: 'slates_list_characters',
1909
- description: 'List characters in a Slates project.',
2146
+ description: 'List characters in a Slates project.' + LIBRARY_TWIN('slates_list_library', 'lists them with every other Library item, each with its category and mention (@name; looks #name)'),
1910
2147
  input: z.object({ projectId: z.string().uuid() }),
1911
2148
  async run(input, ctx) {
1912
2149
  return ok(await ctx.desktop().get('/agent/characters', { projectId: input.projectId }));
@@ -1914,12 +2151,12 @@ export const listCharacters = {
1914
2151
  };
1915
2152
  export const createCharacter = {
1916
2153
  id: 'slates_create_character',
1917
- description: 'Create a new character in a Slates project.',
2154
+ description: 'Create a new character in a Slates project.' + LIBRARY_TWIN('slates_create_library_item', 'creates one in a category you choose and returns its @mention'),
1918
2155
  input: z.object({
1919
2156
  projectId: z.string().uuid(),
1920
2157
  name: z.string().min(1).max(120),
1921
2158
  description: z.string().optional(),
1922
- style: z.string().max(200).optional().describe("Art style. Omit to inherit the reference's style (the default). Canonical styles: photoreal, anime, painterly, 3d-render, comic. Or pass any free-text instruction, e.g. 'turn this into a real person'."),
2159
+ style: z.string().max(200).optional().describe(STYLE_DESCRIBE("Omitted: keeps the reference's medium (Slates 1.6.2 and older use realistic).")),
1923
2160
  }),
1924
2161
  async run(input, ctx) {
1925
2162
  return ok(await ctx.desktop().post('/agent/characters', input));
@@ -1927,10 +2164,10 @@ export const createCharacter = {
1927
2164
  };
1928
2165
  export const setCharacterIdentity = {
1929
2166
  id: 'slates_set_character_identity_asset',
1930
- description: 'Bind one image asset as the character identity (or clear with assetId=null). The user sees the character card update live.',
2167
+ description: 'Bind one image asset as the character identity (or clear with assetId=null). The user sees the character card update live.' + LIBRARY_TWIN('slates_update_library_item', 'edits the same row'),
1931
2168
  input: z.object({
1932
2169
  characterId: z.string().uuid(),
1933
- assetId: z.string().uuid().nullable(),
2170
+ assetId: z.string().uuid().nullable().describe(ASSET_UUID_ONLY),
1934
2171
  }),
1935
2172
  async run(input, ctx) {
1936
2173
  return ok(await ctx.desktop().post('/agent/characters/update', {
@@ -1942,7 +2179,7 @@ export const setCharacterIdentity = {
1942
2179
  // ── Environments ────────────────────────────────────────────────
1943
2180
  export const listEnvironments = {
1944
2181
  id: 'slates_list_environments',
1945
- description: 'List the locations (environments) in a Slates project.',
2182
+ description: 'List the locations (environments) in a Slates project.' + LIBRARY_TWIN('slates_list_library', 'lists them with every other Library item, each with its category and mention (@name; looks #name)'),
1946
2183
  input: z.object({ projectId: z.string().uuid() }),
1947
2184
  async run(input, ctx) {
1948
2185
  return ok(await ctx.desktop().get('/agent/environments', { projectId: input.projectId }));
@@ -1950,12 +2187,12 @@ export const listEnvironments = {
1950
2187
  };
1951
2188
  export const createEnvironment = {
1952
2189
  id: 'slates_create_environment',
1953
- description: 'Create a new location (environment) in a Slates project.',
2190
+ description: 'Create a new location (environment) in a Slates project.' + LIBRARY_TWIN('slates_create_library_item', 'creates one in a category you choose and returns its @mention'),
1954
2191
  input: z.object({
1955
2192
  projectId: z.string().uuid(),
1956
2193
  name: z.string().min(1).max(120),
1957
2194
  description: z.string().optional(),
1958
- style: z.string().max(200).optional().describe("Art style. Omit to inherit the reference's style (the default). Canonical styles: photoreal, anime, painterly, 3d-render, comic. Or pass any free-text instruction, e.g. 'turn this into a real person'."),
2195
+ style: z.string().max(200).optional().describe(STYLE_DESCRIBE("Omitted: keeps the reference's medium (Slates 1.6.2 and older use realistic).")),
1959
2196
  }),
1960
2197
  async run(input, ctx) {
1961
2198
  return ok(await ctx.desktop().post('/agent/environments', input));
@@ -1964,14 +2201,14 @@ export const createEnvironment = {
1964
2201
  export const generateCharacterIdentity = {
1965
2202
  id: 'slates_generate_character_identity',
1966
2203
  billable: true,
1967
- description: "Generate one character identity sheet from a base portrait asset and bind it as the character's canonical reference. Call after slates_create_character. Read slates-character-identity before calling and quote the cost from slates_estimate_generation_cost.",
2204
+ description: "Generate one identity sheet (a portrait plus front and back full-body views) from a base portrait and bind it as the item's canonical picture. Works on a character or any Library thing; the item must exist (slates_create_character or slates_create_library_item). Craft: slates-character-identity. Show the user the estimate from slates_estimate_generation_cost and wait for their OK before calling: this tool has no confirm gate.",
1968
2205
  input: z.object({
1969
2206
  characterId: z.string().uuid().describe('A character, or the id of any Library thing: both sheet tools run on any thing, and the result binds as its image.'),
1970
2207
  projectId: z.string().uuid(),
1971
- baseAssetId: z.string().uuid().describe('The base portrait asset the identity is generated from.'),
2208
+ baseAssetId: z.string().uuid().describe('The base portrait asset the identity is generated from. ' + ASSET_UUID_ONLY),
1972
2209
  userNotes: z.string().optional().describe('Extra instruction, e.g. "use the woman on the left".'),
1973
2210
  model: z
1974
- .enum(['nano-banana-2', 'nano-banana-2-lite', 'nano-banana-pro', 'gpt-image-2-5-flare', 'gpt-image-2-5-sunburst'])
2211
+ .enum(['nano-banana-2-1', 'gpt-image-2-5-flare', 'gpt-image-2-5-sunburst'])
1975
2212
  .optional()
1976
2213
  .describe(`Image model for the sheet. Omit for the sheet tool's seat (${toolModelFor('character-sheet')}), which is what the app's own button uses. Pass another only to compare seats side by side.`),
1977
2214
  }),
@@ -1982,14 +2219,15 @@ export const generateCharacterIdentity = {
1982
2219
  // model's price and generate another, silently. Same failure `generateImage`
1983
2220
  // and `editImage` gate against; this op was simply missed when the gate was
1984
2221
  // introduced, and the 2.5 swap is what makes it reachable in practice.
2222
+ requireGuideRead(ctx, input.model ?? toolModelFor('character-sheet'));
1985
2223
  if (isGptImageModel(input.model)) {
1986
2224
  await ctx.desktop().requireCapability('image-models-v3', `${input.model} character identity`);
1987
2225
  }
1988
- else if (input.model === 'nano-banana-pro' || input.model === 'nano-banana-2-lite') {
1989
- await ctx.desktop().requireCapability('image-models-v2', `${input.model} character identity`);
2226
+ else if (isImageModelV4(input.model)) {
2227
+ await ctx.desktop().requireCapability('image-models-v4', `${input.model} character identity`);
1990
2228
  }
1991
2229
  // 1.5.8 renders an unnamed model as Nano Banana 2 and every model at 2k, so
1992
- // only an explicit Nano Banana model runs there as quoted.
2230
+ // an unnamed or GPT Image seat needs a desktop that renders the seat quoted.
1993
2231
  if (!input.model || isGptImageModel(input.model)) {
1994
2232
  await ctx.desktop().requireCapability('sheet-tool-seats', 'sheet tools on the default image seat');
1995
2233
  }
@@ -2005,7 +2243,7 @@ export const generateCharacterIdentity = {
2005
2243
  export const generateEnvironmentPlate = {
2006
2244
  id: 'slates_generate_environment_plate',
2007
2245
  billable: true,
2008
- description: "Generate one clean establishing image from an optional base image and bind it as the location's canonical reference. Call after slates_create_environment and quote the cost from slates_estimate_generation_cost.",
2246
+ description: "Generate one clean, empty establishing image of a place from an optional base image and bind it as the item's canonical picture. Works on a location or any Library thing; the item must exist (slates_create_environment or slates_create_library_item). Show the user the estimate from slates_estimate_generation_cost and wait for their OK before calling: this tool has no confirm gate.",
2009
2247
  input: z.object({
2010
2248
  environmentId: z.string().uuid().describe('A location, or the id of any Library thing: both sheet tools run on any thing, and the result binds as its image.'),
2011
2249
  projectId: z.string().uuid(),
@@ -2017,6 +2255,7 @@ export const generateEnvironmentPlate = {
2017
2255
  userNotes: z.string().optional(),
2018
2256
  }),
2019
2257
  async run(input, ctx) {
2258
+ requireGuideRead(ctx, toolModelFor('environment-plate'));
2020
2259
  // 1.5.8 always renders the plate on Nano Banana 2 at 2k, never the seat quoted.
2021
2260
  await ctx.desktop().requireCapability('sheet-tool-seats', 'sheet tools on the default image seat');
2022
2261
  return ok(await ctx.desktop().post('/agent/environments/generate-plate', {
@@ -2041,7 +2280,7 @@ export const createStoryboard = {
2041
2280
  description: 'Create a new board (storyboard) with a default first scene. Returns the board record.',
2042
2281
  input: z.object({
2043
2282
  projectId: z.string().uuid(),
2044
- name: z.string().min(1).max(120),
2283
+ name: z.string().min(1).max(80),
2045
2284
  description: z.string().optional(),
2046
2285
  }),
2047
2286
  async run(input, ctx) {
@@ -2088,7 +2327,7 @@ export const addFrame = {
2088
2327
  projectId: z.string().uuid(),
2089
2328
  storyboardId: z.string().uuid(),
2090
2329
  sceneId: z.string().uuid(),
2091
- assetId: z.string().uuid(),
2330
+ assetId: z.string().uuid().describe(ASSET_UUID_ONLY),
2092
2331
  shotLabel: z.string().optional(),
2093
2332
  notes: z.string().optional(),
2094
2333
  position: z.number().int().min(0).optional(),
@@ -2179,12 +2418,10 @@ async function previewAssets(ctx, refs) {
2179
2418
  /** Derived compatibility export for callers enumerating the 3k ladder. */
2180
2419
  export const THREE_K_IMAGE_MODELS = Object.keys(MODEL_CAPABILITIES).filter((id) => MODEL_CAPABILITIES[id].imageResolutions?.includes('3k'));
2181
2420
  export const IMAGE_MODELS = [
2182
- 'nano-banana-2',
2183
- 'nano-banana-2-lite',
2184
- 'nano-banana-pro',
2421
+ 'nano-banana-2-1',
2185
2422
  'gpt-image-2-5-flare',
2186
2423
  'gpt-image-2-5-sunburst',
2187
- 'flux-2-max',
2424
+ 'flux-3',
2188
2425
  'seedream-5-lite',
2189
2426
  ];
2190
2427
  /** True for either GPT Image 2.5 seat. Flare and Sunburst differ in latency
@@ -2192,6 +2429,17 @@ export const IMAGE_MODELS = [
2192
2429
  export function isGptImageModel(model) {
2193
2430
  return model === 'gpt-image-2-5-flare' || model === 'gpt-image-2-5-sunburst';
2194
2431
  }
2432
+ /**
2433
+ * The seats that arrived 2026-10-23, which only a desktop advertising
2434
+ * `image-models-v4` knows. 🚨 A NEW TOKEN, as v3 was for GPT Image 2.5: an older
2435
+ * desktop has neither id in its registry and would fall back to its Nano Banana
2436
+ * path while this op quotes the new seat's price.
2437
+ */
2438
+ export function isImageModelV4(model) {
2439
+ return model === 'nano-banana-2-1' || model === 'flux-3';
2440
+ }
2441
+ /** The one image seat with a headless path (no projectId): the MCP asks the proxy for it directly. */
2442
+ const HEADLESS_IMAGE_MODEL = 'nano-banana-2-1';
2195
2443
  /**
2196
2444
  * The aspect ratios an image generation can carry — the UNION over what these
2197
2445
  * models declare in `MODEL_CAPABILITIES`, generated so the enum cannot hold a
@@ -2209,9 +2457,8 @@ export function isGptImageModel(model) {
2209
2457
  const IMAGE_ASPECT_RATIOS = aspectRatioUnion(IMAGE_MODELS);
2210
2458
  // Registry cost-key for an image model+resolution. Mirrors imageCreditKey()
2211
2459
  // in slate/src/shared/pricing.ts — MUST byte-match it (the same hard rule as
2212
- // videoCostKey): NB2/NB Pro price per resolution, FLUX.2 Max prices per
2213
- // resolution (1k is the bare key), NB2 Lite/Seedream are flat, GPT Image 2.5 is
2214
- // quality × resolution-class over ALL FIVE exposed tiers.
2460
+ // videoCostKey): Nano Banana 2.1 and FLUX 3 price per resolution, Seedream is
2461
+ // flat, GPT Image 2.5 is quality × resolution-class over ALL FIVE exposed tiers.
2215
2462
  //
2216
2463
  // 🚨 THE KEY SUFFIX IS `med` WHILE THE WIRE VALUE IS `medium` — the one
2217
2464
  // tier name that differs between fal's enum and our cost keys, inherited from
@@ -2239,17 +2486,13 @@ function gptKeyAspect(aspectRatio) {
2239
2486
  // `imageCreditKey`. Before that check existed the byte-match was a comment and
2240
2487
  // a hope — the two are in different repos and nothing compared them.
2241
2488
  export function imageCostKey(model, resolution, quality = DEFAULT_GPT_QUALITY, aspectRatio) {
2242
- if (model === 'flux-2-max')
2243
- return resolution === '1k' ? 'flux-2-max' : `flux-2-max-${resolution}`;
2489
+ if (model === 'flux-3')
2490
+ return `flux-3-${resolution}`;
2244
2491
  if (model === 'seedream-5-lite')
2245
2492
  return 'seedream-5-lite';
2246
- if (model === 'nano-banana-2-lite')
2247
- return 'nano-banana-2-lite';
2248
- if (model === 'nano-banana-pro')
2249
- return `nano-banana-pro-${resolution}`;
2250
2493
  if (isGptImageModel(model))
2251
2494
  return `${model}-${gptKeyTier(quality)}-${resolution}${gptKeyAspect(aspectRatio)}`;
2252
- return `nano-banana-2-${resolution}`;
2495
+ return `nano-banana-2-1-${resolution}`;
2253
2496
  }
2254
2497
  /**
2255
2498
  * Image settings on the price list that cost less per image than `than`: each
@@ -2301,41 +2544,40 @@ const DEFAULT_IMAGE_MODEL = defaultModelFor('image');
2301
2544
  if (!IMAGE_MODELS.includes(DEFAULT_IMAGE_MODEL)) {
2302
2545
  throw new Error(`slates_generate_image: default image seat ${DEFAULT_IMAGE_MODEL} is not in IMAGE_MODELS`);
2303
2546
  }
2304
- /** The headless path's one fal batch: `maxBatchImages` owns it (nano-banana-2 is the only batching model). */
2305
- const HEADLESS_BATCH_CAP = MODEL_CAPABILITIES['nano-banana-2']?.maxBatchImages ?? 1;
2547
+ /** The headless path's one provider request: `maxBatchImages` owns it. Nano Banana 2.1 declares none, so one image. */
2548
+ const HEADLESS_BATCH_CAP = MODEL_CAPABILITIES[HEADLESS_IMAGE_MODEL]?.maxBatchImages ?? 1;
2306
2549
  /** A 1.5.8 desktop's own clamp on a project batch, frozen with that build. */
2307
2550
  const LEGACY_DESKTOP_IMAGE_BATCH = 4;
2308
2551
  export const generateImage = {
2309
2552
  id: 'slates_generate_image',
2310
2553
  billable: true,
2311
2554
  description:
2312
- // Rules first: Claude Code keeps only the first 2,048 characters of a tool
2313
- // description, and the generated roster below runs past that cut.
2314
- 'Generate an image via Slates credits. Pass projectId to save into a Slates project (asset appears live in the desktop UI). All models except nano-banana-2 REQUIRE projectId (no headless path). You MUST pass aspectRatio (the server returns requires_clarification when missing); resolution defaults to the model\'s own. ' +
2315
- CONFIRM_GATE_SENTENCE +
2555
+ // Rules only: Claude Code keeps the first 2,048 characters of a tool
2556
+ // description, so the generated roster lives on the model param, as on the
2557
+ // video and audio ops (it pushed the default seat's line past the cut).
2558
+ `Generate an image via Slates credits. Pass projectId to save into a Slates project (asset appears live in the desktop UI). All models except ${HEADLESS_IMAGE_MODEL} require projectId (no headless path). ` + 'Pass aspectRatio (the server returns requires_clarification when missing); resolution defaults to the model\'s own. ' +
2559
+ confirmGateSentence('any referenceAssetIds') +
2316
2560
  ' MCP/CLI generation always charges credits. The estimate returns the model\'s prompting card; load its slates-prompting-* guide with slates_get_prompting_guide for anything the card leaves out. ' +
2317
2561
  // GENERATED from the skill file's own never-use list -- the one piece of
2318
2562
  // prompting doctrine that is ALWAYS in context, because the agent has
2319
2563
  // demonstrably skipped the call that would have taught it.
2320
- describeBannedTokens('image') +
2321
- // GENERATED from MODEL_FACTS — the hand-typed model list that stood here
2322
- // was a third copy of the routing doctrine, and it had already gone stale
2323
- // (it still described nano-banana-2-lite by a capability the param owns).
2324
- `\n${describeRouting('image')}\n` +
2325
- 'Full table: the slates-model-selection skill.',
2564
+ describeBannedTokens('image'),
2326
2565
  input: z.object({
2327
2566
  prompt: z.string().min(1).max(4000),
2328
- model: zEnum(IMAGE_MODELS).optional().describe(`Image model. Omitted: ${DEFAULT_IMAGE_MODEL} with projectId, nano-banana-2 (the only headless seat) without. Routing: slates-model-selection skill.`),
2329
- projectId: z.string().uuid().optional().describe('Save into this Slates project. Renderer refreshes live. Required for every model except nano-banana-2.'),
2567
+ // Routing GENERATED from MODEL_FACTS.
2568
+ model: zEnum(IMAGE_MODELS).optional().describe(`Image model. Omitted: ${DEFAULT_IMAGE_MODEL} with projectId, ${HEADLESS_IMAGE_MODEL} (the only headless seat) without.\n` +
2569
+ `${describeRouting('image')}\n` +
2570
+ 'Full table: the slates-model-selection skill.'),
2571
+ projectId: z.string().uuid().optional().describe(`Save into this Slates project. Renderer refreshes live. Required for every model except ${HEADLESS_IMAGE_MODEL}.`),
2330
2572
  resolution: z.enum(['1k', '2k', '3k', '4k']).optional().describe('Omit for the selected model default. Override for a specific delivery size; use the same setting when estimating.'),
2331
2573
  quality: z.enum(GPT_QUALITY_TIERS).optional().describe(`GPT Image only. Default ${DEFAULT_GPT_QUALITY}; estimate the chosen tier before generation.`),
2332
2574
  backgroundMode: z.enum(GPT_BACKGROUNDS).optional().describe('GPT Image only. transparent = alpha channel. Free.'),
2333
2575
  aspectRatio: zEnum(IMAGE_ASPECT_RATIOS).optional().describe(`Pick from the use case: cinematic 16:9 · TikTok/Reels 9:16 · IG square 1:1 · ultra-wide 21:9. 1:1 costs most on GPT Image. Per model: ${describeAspectRatios(IMAGE_MODELS)}`),
2334
- count: z.number().int().min(1).max(MAX_IMAGE_VARIATIONS).optional().describe(`Variations of this one prompt: every image gets the same prompt, so different subjects are separate calls. Up to ${MAX_IMAGE_VARIATIONS} with projectId; headless caps at ${HEADLESS_BATCH_CAP}.`),
2335
- referenceImageUrls: z.array(z.string().url()).max(14).optional().describe('Headless (no projectId) nano-banana-2 only. With a projectId, upload via slates_upload_reference_image. Label every image role in the prompt.'),
2336
- referenceAssetIds: z.array(z.string()).max(16).optional().describe("Project assets as references — UUIDs or badge codes (\"IMG-A8\"), resolved at call time. Requires projectId. Caps: GPT Image 16, nano-banana-2 14, FLUX/Seedream lower. Label every reference role in the prompt."),
2576
+ count: z.number().int().min(1).max(MAX_IMAGE_VARIATIONS).optional().describe(`Variations of this one prompt: every image gets the same prompt, so different subjects are separate calls. Up to ${MAX_IMAGE_VARIATIONS} with projectId; headless caps at ${HEADLESS_BATCH_CAP}. A 2x2 or 3x3 grid in one picture is a Shot's or the prompt box's Grid (params.gridMode), not count.`),
2577
+ referenceImageUrls: z.array(z.string().url()).max(14).optional().describe(`Headless (no projectId) ${HEADLESS_IMAGE_MODEL} only. With a projectId, upload via slates_upload_reference_image. Label every image role in the prompt.`),
2578
+ referenceAssetIds: z.array(z.string()).max(16).optional().describe(`Project assets as references — UUIDs or badge codes ("IMG-A8"), resolved at call time. Requires projectId. Caps: ${describeReferenceImageCaps(IMAGE_MODELS)}. Label every reference role in the prompt.`),
2337
2579
  background: z.boolean().optional().describe(BACKGROUND_DESCRIBE),
2338
- confirm: z.boolean().optional().describe('Set true to bypass the confirm gate.'),
2580
+ confirm: z.boolean().optional().describe(CONFIRM_PARAM),
2339
2581
  folderId: z.string().uuid().nullable().optional().describe(`${FOLDER_DESCRIBE} Needs projectId.`),
2340
2582
  }),
2341
2583
  async run(input, ctx) {
@@ -2350,10 +2592,11 @@ export const generateImage = {
2350
2592
  // that echoes a prompt -- the clarification and confirm gates are PRE-spend,
2351
2593
  // which is where a rewrite is still free.
2352
2594
  // Omitted model: the default seat when there is a project to route through,
2353
- // nano-banana-2 without one, because it is the only headless seat. The
2595
+ // HEADLESS_IMAGE_MODEL without one, because it is the only headless seat. The
2354
2596
  // desktop resolves the same seat for its cost and plan-model guards
2355
2597
  // (`imageModelFor`, slate src/main/studio-agent/guards.ts): change both together.
2356
- const imageModel = input.model ?? (input.projectId ? DEFAULT_IMAGE_MODEL : 'nano-banana-2');
2598
+ const imageModel = input.model ?? (input.projectId ? DEFAULT_IMAGE_MODEL : HEADLESS_IMAGE_MODEL);
2599
+ requireGuideRead(ctx, imageModel);
2357
2600
  const promptWarning = bannedTokenWarning(input.prompt, 'image', promptingSkillFor(imageModel));
2358
2601
  input = { ...input, resolution: input.resolution ?? defaultImageResolutionFor(imageModel) };
2359
2602
  if (!input.aspectRatio || !input.resolution) {
@@ -2380,9 +2623,9 @@ export const generateImage = {
2380
2623
  return ok({ requires_clarification: true, missing: ['resolution'],
2381
2624
  message: `${imageModel} accepts ${resolutions.join(', ')}.` });
2382
2625
  }
2383
- // Only nano-banana-2 has a headless path — everything else routes through
2384
- // the desktop generation pipeline, which needs a project.
2385
- if (imageModel !== 'nano-banana-2' && !input.projectId) {
2626
+ // Only HEADLESS_IMAGE_MODEL has a headless path — everything else routes
2627
+ // through the desktop generation pipeline, which needs a project.
2628
+ if (imageModel !== HEADLESS_IMAGE_MODEL && !input.projectId) {
2386
2629
  return ok({
2387
2630
  requires_clarification: true,
2388
2631
  missing: ['projectId'],
@@ -2408,16 +2651,16 @@ export const generateImage = {
2408
2651
  message: 'background=true routes through the desktop generation pipeline (so slates_get_generation_status can poll it) — pass a projectId, or drop background for a blocking headless run.',
2409
2652
  });
2410
2653
  }
2411
- // 🚨 THE HEADLESS PATH ASKS FAL FOR A BATCH, so a provider ceiling binds
2412
- // here and nowhere else. It is nano-banana-2 only, and Nano Banana's
2413
- // `num_images` maximum is 4 (fal schema, 2026-09-09). Refused rather than
2414
- // clamped: a silent clamp would make four images against a request for ten
2415
- // and read to the caller as a partial failure it should retry.
2654
+ // 🚨 THE HEADLESS PATH IS ONE PROVIDER REQUEST, so its batch bound binds
2655
+ // here and nowhere else: `maxBatchImages` on HEADLESS_IMAGE_MODEL, which
2656
+ // Nano Banana 2.1 leaves unset (one image; model-capabilities.ts says why).
2657
+ // Refused rather than clamped: a silent clamp would make one image against a
2658
+ // request for ten and read to the caller as a partial failure to retry.
2416
2659
  if (!input.projectId && (input.count ?? 1) > HEADLESS_BATCH_CAP) {
2417
2660
  return ok({
2418
2661
  requires_clarification: true,
2419
2662
  missing: ['projectId'],
2420
- message: `count above ${HEADLESS_BATCH_CAP} needs a projectId. The headless path asks for one batch and nano-banana-2 caps a batch at ${HEADLESS_BATCH_CAP}; with a projectId the desktop fires them as separate generations and the limit is ${MAX_IMAGE_VARIATIONS}.`,
2663
+ message: `count above ${HEADLESS_BATCH_CAP} needs a projectId. The headless path is one request and ${HEADLESS_IMAGE_MODEL} caps it at ${HEADLESS_BATCH_CAP}; with a projectId the desktop fires them as separate generations and the limit is ${MAX_IMAGE_VARIATIONS}.`,
2421
2664
  });
2422
2665
  }
2423
2666
  let refEcho = '';
@@ -2434,18 +2677,17 @@ export const generateImage = {
2434
2677
  await ctx.desktop().requireCapability('background-generation', 'background generation');
2435
2678
  }
2436
2679
  // New-roster models need a desktop that knows them — an older desktop's
2437
- // allowlist would silently fall back to nano-banana-2 while we quote the
2438
- // new model's price.
2680
+ // allowlist would silently fall back to its Nano Banana path while we quote
2681
+ // the new model's price.
2439
2682
  if (input.projectId && isGptImageModel(imageModel)) {
2440
2683
  // 🚨 v3, NOT v2. GPT Image 2.5 landed 2026-09-09 with new ids and a
2441
2684
  // five-rung ladder; a desktop that only knows v2 has neither, so it would
2442
- // fall back to nano-banana-2 while this op quotes a 2.5 price — precisely
2685
+ // fall back to its Nano Banana path while this op quotes a 2.5 price — precisely
2443
2686
  // the failure the gate was built to stop. Reusing v2 reintroduces it.
2444
2687
  await ctx.desktop().requireCapability('image-models-v3', `${imageModel} generation`);
2445
2688
  }
2446
- else if (input.projectId &&
2447
- (imageModel === 'nano-banana-pro' || imageModel === 'nano-banana-2-lite')) {
2448
- await ctx.desktop().requireCapability('image-models-v2', `${imageModel} generation`);
2689
+ else if (input.projectId && isImageModelV4(imageModel)) {
2690
+ await ctx.desktop().requireCapability('image-models-v4', `${imageModel} generation`);
2449
2691
  }
2450
2692
  // 1.5.8 clamps a project batch to its own 4 and bills 4 against this op's quote for all of them.
2451
2693
  if (input.projectId && (input.count ?? 1) > LEGACY_DESKTOP_IMAGE_BATCH) {
@@ -2605,38 +2847,37 @@ export const generateImage = {
2605
2847
  // to `/edit` 422s on the missing `image_urls` field.
2606
2848
  const hasReferenceImages = !!input.referenceImageUrls && input.referenceImageUrls.length > 0;
2607
2849
  const endpoint = hasReferenceImages
2608
- ? 'fal-ai/nano-banana-2/edit'
2609
- : 'fal-ai/nano-banana-2';
2850
+ ? 'google/nano-banana-2.1/edit'
2851
+ : 'google/nano-banana-2.1';
2610
2852
  const proxyResult = await cloud.post('/proxy/generate', {
2611
2853
  provider: 'fal',
2612
2854
  type: 'image',
2613
2855
  model: costKey,
2614
2856
  endpoint,
2857
+ // The body the desktop's `buildFalNanoBananaRequest` (slate src/main/api/fal.ts)
2858
+ // sends, field for field; the proxy derives the cost key from it
2859
+ // (slates-api src/lib/fal-image-keys.ts).
2615
2860
  params: {
2616
2861
  prompt: input.prompt,
2617
2862
  aspect_ratio: input.aspectRatio ?? '1:1',
2618
2863
  // 🚨 THE RESOLUTION HAS TO BE ON THE WIRE, BECAUSE IT IS IN THE KEY.
2619
- // `imageCostKey` above bills `nano-banana-2-{resolution}`, and until
2620
- // 2026-09-10 this body omitted the field entirely — so fal rendered at
2621
- // its own default while we charged for whatever rung the caller asked
2622
- // for. The enum is fal's (`1K`/`2K`/`4K`), the same one the desktop's
2623
- // `buildFalNB2Request` sends, and the proxy now recovers the rung from it
2624
- // rather than trusting the key (`lib/fal-image-keys.ts`).
2625
- // `3k` cannot reach here — the capability guard above refuses a rung
2626
- // nano-banana-2 does not declare — so the map is deliberately partial
2627
- // rather than carrying a rung this model has no key for.
2864
+ // `imageCostKey` above bills `nano-banana-2-1-{resolution}`; until
2865
+ // 2026-09-10 this body omitted the field and fal rendered at its own
2866
+ // default while we charged for the rung asked. The enum is fal's
2867
+ // (`1K`/`2K`/`4K`), and the proxy recovers the rung from it rather than
2868
+ // trusting the key. `3k` cannot reach here: the capability guard above
2869
+ // refuses a rung the model does not declare.
2628
2870
  resolution: { '1k': '1K', '2k': '2K', '4k': '4K' }[resolution] ?? '2K',
2629
- // 🚨 THE HEADLESS PATH IS THE ONE PLACE WE ASK FAL FOR A BATCH, so it
2630
- // is the one place a provider's own `num_images` ceiling binds — and
2631
- // Nano Banana's is 4 (fal schema, read 2026-09-09), against the op's
2632
- // limit of 10. Everything else fans out through the desktop as N
2633
- // separate single-image generations, where no batch ceiling exists.
2634
- // Guarded above rather than clamped here: silently making 4 when 10
2635
- // were asked for would bill 4 and look like a partial failure.
2636
- //
2637
- // The proxy bills this COUNT (it multiplies the single-image key by it),
2638
- // which is what the confirm gate above has always quoted.
2871
+ // Sent, never left to fal's default: a default is a bill nobody chose.
2872
+ // `medium` is what the key's thinking allowance prices; the proxy
2873
+ // refuses `high`, which no key prices.
2874
+ thinking_level: 'medium',
2875
+ // One image per request (HEADLESS_BATCH_CAP, guarded above). The proxy
2876
+ // bills this count against the single-image key.
2639
2877
  num_images: input.count ?? 1,
2878
+ // Nano Banana 2's posture, kept: fal's string enum "1"-"6", default "4".
2879
+ safety_tolerance: '5',
2880
+ output_format: 'png',
2640
2881
  ...(hasReferenceImages
2641
2882
  ? { image_urls: input.referenceImageUrls }
2642
2883
  : {}),
@@ -2706,22 +2947,23 @@ async function pollProxyJob(cloud, jobId, options = {}) {
2706
2947
  /** References an edit carries beside the source, which is image 1 of the same request. */
2707
2948
  const editReferenceCap = (model) => Math.max(0, (MODEL_CAPABILITIES[model]?.maxRefImages ?? 1) - 1);
2708
2949
  /** The models a 1.5.8 desktop sends edit references on, frozen with that build: on every other model it drops them and bills the edit in full. */
2709
- const LEGACY_EDIT_REFERENCE_MODELS = ['nano-banana-2', 'nano-banana-2-lite', 'nano-banana-pro'];
2950
+ const LEGACY_EDIT_REFERENCE_MODELS = ['nano-banana-2', 'nano-banana-2-lite', 'nano-banana-pro']; // 1.5.8's ids, retired since
2710
2951
  export const editImage = {
2711
2952
  id: 'slates_edit_image',
2712
2953
  billable: true,
2713
- description: 'Surgically edit an image asset with a text instruction (e.g. \'make the jacket red\') instead of regenerating from scratch — use when ~90% of the image is already right. The result is a NEW asset (prompt prefixed \'[Edit]\'); the source is untouched. Default model ' + toolModelFor('image-edit') + ' (the image-edit tool seat, the model the app\'s Edit box opens on). Every model also takes referenceAssetIds, up to its reference cap less one: the source is image 1 of the request. Use slates-edit-and-iterate for missing edit craft; reuse current guidance already in context.',
2954
+ description: 'Surgically edit an image asset with a text instruction (e.g. \'make the jacket red\') instead of regenerating from scratch — use when ~90% of the image is already right. The result is a NEW asset (prompt prefixed \'[Edit]\'); the source is untouched. Default model ' + toolModelFor('image-edit') + ' (the image-edit tool seat, the model the app\'s Edit box opens on). Every model also takes referenceAssetIds, up to its reference cap less one: the source is image 1 of the request. Use slates-edit-and-iterate for missing edit craft; reuse current guidance already in context. ' +
2955
+ CONFIRM_GATE_SENTENCE,
2714
2956
  input: z.object({
2715
2957
  projectId: z.string().uuid(),
2716
- sourceAssetId: z.string().uuid().describe('Image asset to edit. Must exist in the project.'),
2717
- prompt: z.string().min(1).max(4000).describe('The change, not the whole image.'),
2958
+ sourceAssetId: z.string().uuid().describe('Image asset to edit. Must exist in the project. ' + ASSET_UUID_ONLY),
2959
+ prompt: z.string().min(1).max(4000).describe('The change, not the whole image. @name and #look words attach nothing here: pass those pictures in referenceAssetIds.'),
2718
2960
  editModel: zEnum(IMAGE_MODELS).optional(),
2719
- referenceAssetIds: z.array(z.string().uuid()).max(Math.max(...IMAGE_MODELS.map(editReferenceCap))).optional().describe(`Images beside the source, which is image 1. Each model's own cap: ${IMAGE_MODELS.map((m) => `${m} ${editReferenceCap(m)}`).join(', ')}.`),
2720
- resolution: z.enum(['1k', '2k', '3k', '4k']).optional().describe('3k = GPT Image/seedream-5-lite; nano-banana-2-lite is 1k only.'),
2961
+ referenceAssetIds: z.array(z.string().uuid().describe(ASSET_UUID_ONLY)).max(Math.max(...IMAGE_MODELS.map(editReferenceCap))).optional().describe(`Images beside the source, which is image 1. Each model's own cap: ${IMAGE_MODELS.map((m) => `${m} ${editReferenceCap(m)}`).join(', ')}.`),
2962
+ resolution: z.enum(['1k', '2k', '3k', '4k']).optional().describe('3k = GPT Image/seedream-5-lite only.'),
2721
2963
  quality: z.enum(GPT_QUALITY_TIERS).optional().describe(`GPT Image tier; default ${DEFAULT_GPT_QUALITY}.`),
2722
2964
  backgroundMode: z.enum(GPT_BACKGROUNDS).optional().describe('GPT Image only. transparent = alpha channel. Free.'),
2723
2965
  aspectRatio: z.string().optional(),
2724
- confirm: z.boolean().optional().describe('Set true to bypass the confirm gate.'),
2966
+ confirm: z.boolean().optional().describe(CONFIRM_PARAM),
2725
2967
  background: z.boolean().optional().describe(BACKGROUND_DESCRIBE),
2726
2968
  }),
2727
2969
  async run(input, ctx) {
@@ -2732,6 +2974,7 @@ export const editImage = {
2732
2974
  }
2733
2975
  // The image-edit tool's seat (TOOL_SEAT), the model the app's own Edit uses.
2734
2976
  const editModel = input.editModel ?? toolModelFor('image-edit');
2977
+ requireGuideRead(ctx, editModel);
2735
2978
  const resolution = input.resolution ?? defaultImageResolutionFor(editModel);
2736
2979
  if (isGptImageModel(editModel)) {
2737
2980
  // 🚨 v3, LIKE generateImage — this site was missed once already.
@@ -2741,8 +2984,8 @@ export const editImage = {
2741
2984
  // at a quoted 2.5 price. Exactly the bug the gate exists to stop.
2742
2985
  await desktop.requireCapability('image-models-v3', `${editModel} editing`);
2743
2986
  }
2744
- else if (editModel === 'nano-banana-pro' || editModel === 'nano-banana-2-lite') {
2745
- await desktop.requireCapability('image-models-v2', `${editModel} editing`);
2987
+ else if (isImageModelV4(editModel)) {
2988
+ await desktop.requireCapability('image-models-v4', `${editModel} editing`);
2746
2989
  }
2747
2990
  if (input.referenceAssetIds?.length && !LEGACY_EDIT_REFERENCE_MODELS.includes(editModel)) {
2748
2991
  await desktop.requireCapability('edit-references-all-models', `references on a ${editModel} edit`);
@@ -2753,7 +2996,7 @@ export const editImage = {
2753
2996
  // FLUX / Seedream route to dedicated edit endpoints priced under '-edit' keys.
2754
2997
  // Mirrors `editCreditKey` in the desktop's src/shared/imageEdit.ts, which
2755
2998
  // this package cannot import: change both together.
2756
- const costKey = editModel === 'flux-2-max' || editModel === 'seedream-5-lite'
2999
+ const costKey = editModel === 'flux-3' || editModel === 'seedream-5-lite'
2757
3000
  ? `${imageCostKey(editModel, resolution)}-edit`
2758
3001
  : imageCostKey(editModel, resolution, input.quality, input.aspectRatio);
2759
3002
  const cloud = ctx.cloud();
@@ -2844,7 +3087,7 @@ export const editImage = {
2844
3087
  * with no `confirm`, the op answers with the price and the exact prompt, and spends nothing.
2845
3088
  */
2846
3089
  /** The seats the viewer's Cells box offers. Mirrors slate's `GRID_EXTRACT_MODELS` (`shared/prompts/storyboard-grids.ts`), which this package cannot import. */
2847
- const GRID_EXTRACT_SEATS = ['nano-banana-2', 'flux-2-max', 'seedream-5-lite'];
3090
+ const GRID_EXTRACT_SEATS = ['nano-banana-2-1', 'flux-3', 'seedream-5-lite'];
2848
3091
  export const extractGridCells = {
2849
3092
  id: 'slates_extract_grid_cells',
2850
3093
  billable: true,
@@ -2862,10 +3105,11 @@ export const extractGridCells = {
2862
3105
  aspectRatio: z.string().optional().describe("Output aspect ratio, one the seat offers. Default: the ratio nearest the grid's own shape."),
2863
3106
  prompt: z.string().max(2500).optional().describe('Words for every cell (what the shot is). On the default seat @name and #look attach their pictures; the crop is image 1.'),
2864
3107
  referenceAssetIds: z.array(z.string()).max(13).optional().describe('Pictures added beside the crop (default seat only), UUIDs or badge codes.'),
2865
- confirm: z.boolean().optional().describe('Set true to bypass the confirm gate after explicit user OK.'),
3108
+ confirm: z.boolean().optional().describe(CONFIRM_PARAM),
2866
3109
  background: z.boolean().optional().describe(BACKGROUND_DESCRIBE),
2867
3110
  }),
2868
3111
  async run(input, ctx) {
3112
+ requireGuideRead(ctx, input.model ?? toolModelFor('grid-extract'));
2869
3113
  const desktop = ctx.desktop();
2870
3114
  await desktop.requireCapability('grid-extract', 'extracting grid cells');
2871
3115
  if (input.background)
@@ -3067,10 +3311,38 @@ export function videoCostKey(input) {
3067
3311
  }
3068
3312
  return `${tier}-${input.duration}s${input.sound !== false ? '-audio' : ''}`;
3069
3313
  }
3314
+ if (input.model === 'kling-v4.0') {
3315
+ // Mirrors kling4CreditKey() in slate/src/shared/pricing.ts. Output seconds
3316
+ // at the chosen resolution, flat: sound is always on and multi-shot does
3317
+ // not move the price (a multi-shot take bills the sum of its shots, which
3318
+ // is the duration the desktop quotes). Never `kling-v3-…`: a v4 key must
3319
+ // not resolve to a 3.0 row.
3320
+ const res = input.videoResolution ?? defaultVideoResolutionFor(input.model);
3321
+ return `kling-v4-${res}-${input.duration}s`;
3322
+ }
3070
3323
  if (input.model === 'omni-flash') {
3071
- // Mirrors omniFlashCreditKey() in slate/src/shared/pricing.ts — flat 720p
3072
- // rate, audio native + included, no resolution/audio key dimension.
3073
- return `omni-flash-${input.duration}s`;
3324
+ // Mirrors omniFlashCreditKey() in slate/src/shared/pricing.ts. Omni Flash
3325
+ // 1.1 prices each output second by resolution, so the key carries it. Audio
3326
+ // is native and included, and references do not move fal's 1.1 price.
3327
+ // 1.0's flat `omni-flash-{N}s` keys are legacy: only desktops released
3328
+ // before the swap send them.
3329
+ const res = input.videoResolution ?? defaultVideoResolutionFor(input.model);
3330
+ return `omni-flash-${res}-${input.duration}s`;
3331
+ }
3332
+ if (input.model === 'wan-3.0') {
3333
+ // Mirrors wanCreditKey() in slate/src/shared/pricing.ts. Output seconds at
3334
+ // the chosen resolution. A reference video adds its own seconds ("billed in
3335
+ // addition to output duration", fal) and flips to `-vref-{res}-{T}s`,
3336
+ // T = in + out. Sound on or off, reference images and reference audio do
3337
+ // not move the price.
3338
+ const res = input.videoResolution ?? defaultVideoResolutionFor(input.model);
3339
+ const vrefSecs = input.videoRefSeconds ?? 0;
3340
+ if (vrefSecs > 0) {
3341
+ // ceil(x - 0.05) matches the server's probe rounding, so quote = bill.
3342
+ const total = Math.min(WAN_3_VREF_MAX_TOTAL, Math.ceil(vrefSecs - 0.05) + input.duration);
3343
+ return `wan-3.0-vref-${res}-${total}s`;
3344
+ }
3345
+ return `wan-3.0-${res}-${input.duration}s`;
3074
3346
  }
3075
3347
  throw new Error(`Unknown video model: ${input.model}`);
3076
3348
  }
@@ -3084,9 +3356,11 @@ export function klingEditCostKey(model, duration) {
3084
3356
  }
3085
3357
  // Omni Flash video-edit cost key — mirrors omniFlashCreditKey() in
3086
3358
  // slate/src/shared/pricing.ts (must byte-match; checked by the slates-api
3087
- // pricing-consistency script). Duration is the CEILED source-clip length.
3088
- export function omniFlashEditCostKey(duration) {
3089
- return `omni-flash-edit-${duration}s`;
3359
+ // pricing-consistency script). Duration is the CEILED source-clip length. The
3360
+ // resolution is the output's, because Omni Flash 1.1 prices edit seconds by it.
3361
+ export function omniFlashEditCostKey(duration, videoResolution) {
3362
+ const res = videoResolution ?? defaultVideoResolutionFor('omni-flash-edit');
3363
+ return `omni-flash-edit-${res}-${duration}s`;
3090
3364
  }
3091
3365
  /** Max billed (input + output) seconds on a Seedance video-reference gen.
3092
3366
  * 2.0: refs 2–15s + output 4–15s. 2.5: refs to 30s + output to 30s. */
@@ -3253,6 +3527,22 @@ function resolveVideoModel(raw) {
3253
3527
  'gemini-omni-flash': 'omni-flash',
3254
3528
  'gemini-omni-flash-preview': 'omni-flash',
3255
3529
  'omni-flash-preview': 'omni-flash',
3530
+ 'gemini-omni-1.1-flash': 'omni-flash',
3531
+ 'gemini-omni-flash-1.1': 'omni-flash',
3532
+ 'omni-flash-1.1': 'omni-flash',
3533
+ 'wan-3': 'wan-3.0',
3534
+ 'wan-3-0': 'wan-3.0',
3535
+ 'wan3': 'wan-3.0',
3536
+ 'wan3.0': 'wan-3.0',
3537
+ 'alibaba-wan-3.0': 'wan-3.0',
3538
+ wan: 'wan-3.0',
3539
+ // Kling 4.0 spellings. The bare `kling` and `kling-v3` keep meaning 3.0,
3540
+ // the default Kling.
3541
+ 'kling-v4': 'kling-v4.0',
3542
+ 'kling-v4-0': 'kling-v4.0',
3543
+ 'kling-4': 'kling-v4.0',
3544
+ 'kling-4.0': 'kling-v4.0',
3545
+ 'kling4': 'kling-v4.0',
3256
3546
  // The MAX and TURBO spellings must come out as themselves. Bare `minimax`,
3257
3547
  // `h3` and `hailuo-3` all mean the BASE row — it holds the full ladder and
3258
3548
  // the references, and it is cheaper than Max at the tier they share.
@@ -3333,8 +3623,8 @@ export const generateVideo = {
3333
3623
  description: 'Generate video via Slates credits. Choose the model with slates-model-selection. Video models prompt very differently: the estimate returns the chosen model\'s prompting card, and its full guide (' +
3334
3624
  VIDEO_MODEL_GUIDES +
3335
3625
  ') covers modes the card leaves out, via slates_get_prompting_guide. Read slates-content-policy when the scene involves conflict, creatures, crowds, destruction, weapons, or young characters. projectId, aspectRatio, and duration are required (requires_clarification otherwise). ' +
3336
- CONFIRM_GATE_SENTENCE +
3337
- ' Image-to-video via firstFrameAssetId; first+last frames on every model except Omni Flash; ingredients via ingredientAssetIds (Kling Omni, Seedance, Omni Flash, H3 and H3 Max; Kling Std/Pro only with a first frame). Asset params take UUIDs or badge codes ("IMG-A8"). ' +
3626
+ confirmGateSentence('any image reference (frame, ingredient, character, environment or style)') +
3627
+ ' Image-to-video via firstFrameAssetId; a last frame via lastFrameAssetId and ingredients via ingredientAssetIds, each param stating which models take it. Asset params take UUIDs or badge codes ("IMG-A8"). ' +
3338
3628
  // GENERATED from the skill's own slop-token list. Always in context on both
3339
3629
  // surfaces, so it survives an agent that skips slates_get_prompting_guide.
3340
3630
  describeBannedTokens('video'),
@@ -3371,7 +3661,7 @@ export const generateVideo = {
3371
3661
  // demand, by the one session that needs it. If you are about to explain
3372
3662
  // WHY here, you are writing the skill in the wrong file.
3373
3663
  firstFrameAssetId: z.string().optional().describe('Starting frame for image-to-video (UUID or badge code, resolved at call time).'),
3374
- lastFrameAssetId: z.string().optional().describe('Ending frame; every model except Omni Flash. Pairs with firstFrameAssetId.'),
3664
+ lastFrameAssetId: z.string().optional().describe('Ending frame. Pairs with firstFrameAssetId.'),
3375
3665
  ingredientAssetIds: z.array(z.string()).max(30).optional().describe(
3376
3666
  // Caps DERIVED from MODEL_CAPABILITIES — the hand-typed list omitted
3377
3667
  // kling-v3.0-omni-pro entirely and read as if 7 were an Omni Flash-only rule.
@@ -3386,19 +3676,19 @@ export const generateVideo = {
3386
3676
  // The capacity sentences are DERIVED from MODEL_FACTS (see
3387
3677
  // multimodalRefSummary) rather than hand-typed, so a cap change in one
3388
3678
  // place cannot leave a stale number in a description an LLM reads.
3389
- videoReferenceAssetIds: z.array(z.string()).optional().describe(`Reference VIDEOS, cited in the prompt as "video 1", "video 2"… in the order given. ${multimodalRefModels().join(' / ')} only; per-model caps are on audioReferenceAssetIds. On Seedance, billing switches to the vref key (input+output seconds) — pass videoReferenceSecondsEach. Over the cap is REFUSED, never trimmed.`),
3679
+ videoReferenceAssetIds: z.array(z.string()).optional().describe(`Reference VIDEOS, cited in the prompt as "video 1", "video 2"… in the order given. ${multimodalRefModels().join(' / ')} only; per-model caps are on audioReferenceAssetIds. On Seedance and Wan 3.0, billing switches to the vref key (input+output seconds); Omni Flash caps each clip at ${omniFlashRefClipMax}s. Pass videoReferenceSecondsEach. Over the cap is REFUSED, never trimmed.`),
3390
3680
  videoReferenceSecondsEach: z.array(z.number()).optional().describe('REQUIRED with videoReferenceAssetIds, same order and length: each clip\'s duration in seconds. Feeds the vref cost key; the server re-probes and corrects an understated value upward.'),
3391
3681
  audioReferenceAssetIds: z.array(z.string()).optional().describe(`Reference AUDIO, cited as "audio 1", "audio 2"… in the order given. ${multimodalRefModels().join(' / ')} only. No surcharge on Seedance; on H3 Max, audio counts toward the reference-token pool. ${multimodalRefModels().map(multimodalRefSummary).join(' ')}`),
3392
3682
  audioReferenceSpokenText: z.array(z.string()).optional().describe('The exact words in each reference clip — same order and length as audioReferenceAssetIds, "" for a clip with no speech. The model RE-TRANSCRIBES a take rather than using it verbatim, so audio decides voice/accent/timing and only this decides the WORDS. Omit it and the words are a guess.'),
3393
- sound: z.boolean().optional().describe('Kling (every tier) and LTX: sound on (default) or silent (false); Kling bills audio as its own key. Seedance, Omni Flash and H3 always generate audio.'),
3394
- audioLanguage: z.enum(['EN', 'ZH', 'JA', 'KO', 'ES']).optional().describe('Any Kling model with sound on — language for dialogue.'),
3395
- generateMusic: z.boolean().optional().describe('Any Kling model with sound on — auto-generate background music.'),
3396
- seedanceFace: z.boolean().optional().describe('Seedance ONLY: a reference shows an AI CHARACTER\'s face. Without it, faces are blocked; with it the generation costs ~45% more. A REAL person fails here with [REAL_FACE_DETECTED] — see seedanceRealFace.'),
3397
- seedanceRealFace: z.boolean().optional().describe('Seedance ONLY: a reference shows a REAL person. The real-person tier, about 1.4x the Face price (about 2x faceless) — quote it first. REQUIRES realFaceConsent=true.'),
3683
+ sound: z.boolean().optional().describe('Kling 3.0 (every tier), LTX and Wan 3.0: sound on (default) or silent (false); Kling 3.0 bills audio as its own key. Seedance, Omni Flash, H3 and Kling 4.0 always generate audio.'),
3684
+ audioLanguage: z.enum(['EN', 'ZH', 'JA', 'KO', 'ES']).optional().describe('Any Kling 3.0 model with sound on — language for dialogue.'),
3685
+ generateMusic: z.boolean().optional().describe('Any Kling 3.0 model with sound on — auto-generate background music.'),
3686
+ seedanceFace: z.boolean().optional().describe('Seedance only: a reference shows an AI character\'s face. Without it, faces are blocked; the estimate prices it. A real person fails here with [REAL_FACE_DETECTED]; see seedanceRealFace.'),
3687
+ seedanceRealFace: z.boolean().optional().describe('Seedance ONLY: a reference shows a REAL person. The real-person tier, priced above Face: estimate it with the flag set first. REQUIRES realFaceConsent=true.'),
3398
3688
  realFaceConsent: z.boolean().optional().describe('MANDATORY with seedanceRealFace: true ONLY after the user has explicitly confirmed they hold rights/consent to this likeness and it does not impersonate or misrepresent them. Refused without it; public figures fail on every tier.'),
3399
3689
  negativePrompt: z.string().optional(),
3400
3690
  background: z.boolean().optional().describe(BACKGROUND_DESCRIBE),
3401
- confirm: z.boolean().optional().describe('Set true after explicit user OK to bypass the confirm gate (which fires for almost every video gen since they\'re expensive).'),
3691
+ confirm: z.boolean().optional().describe(CONFIRM_PARAM),
3402
3692
  folderId: folderIdField,
3403
3693
  }),
3404
3694
  async run(input, ctx) {
@@ -3416,6 +3706,7 @@ export const generateVideo = {
3416
3706
  `pass the base id and set duration / videoResolution as separate params.`);
3417
3707
  }
3418
3708
  input.model = resolved.model;
3709
+ requireGuideRead(ctx, input.model);
3419
3710
  if (input.duration == null && resolved.duration != null)
3420
3711
  input.duration = resolved.duration;
3421
3712
  if (input.videoResolution == null && resolved.videoResolution != null)
@@ -3472,31 +3763,101 @@ export const generateVideo = {
3472
3763
  const capErr = assertVideoCapabilities(input);
3473
3764
  if (capErr)
3474
3765
  return ok(capErr);
3475
- // Omni Flash's SHAPE constraints — t2v, single-start-frame i2v, or ref2v
3476
- // with reference IMAGES. No last frame, no video/audio refs. (Its duration
3477
- // and resolution are covered by the capability gate above; the 3-10s check
3478
- // that used to live here was a hand-typed duplicate of registry data.)
3766
+ // Omni Flash 1.1's SHAPE constraints. Frames ride image-to-video (a start
3767
+ // frame and an optional end frame); references ride reference-to-video (up
3768
+ // to 10 images and 3 videos, each within the per-clip cap). With references, the desktop
3769
+ // sends a start frame as reference image 1 (as it did on 1.0), so it counts
3770
+ // toward the image cap; a last frame has no slot there and is refused. There
3771
+ // is no audio reference at all (Google: "Uploading audio references is
3772
+ // unsupported"). Counts are read from the capability SSOT; duration and
3773
+ // resolution are covered by the capability gate above.
3479
3774
  if (input.model === 'omni-flash') {
3480
- if (input.lastFrameAssetId ||
3481
- input.videoReferenceAssetId || input.audioReferenceAssetId ||
3482
- (input.videoReferenceAssetIds?.length ?? 0) > 0 ||
3483
- (input.audioReferenceAssetIds?.length ?? 0) > 0) {
3484
- return ok({
3485
- requires_clarification: true,
3486
- missing: [],
3487
- message: `Omni Flash takes a prompt, an optional start frame, and up to ${omniFlashRefCap} reference IMAGES — last frames and video/audio references are not supported. Drop those, or switch to seedance-2.5 (video/audio refs, last frame).`,
3488
- });
3775
+ const cap = getModelCapability('omni-flash');
3776
+ const maxVideos = cap?.maxReferenceVideos ?? 0;
3777
+ const videoRefs = (input.videoReferenceAssetIds?.length ?? 0) + (input.videoReferenceAssetId ? 1 : 0);
3778
+ const audioRefs = (input.audioReferenceAssetIds?.length ?? 0) + (input.audioReferenceAssetId ? 1 : 0);
3779
+ const imageRefs = (input.ingredientAssetIds?.length ?? 0) +
3780
+ (input.characterAssetIds?.length ?? 0) +
3781
+ (input.environmentAssetIds?.length ?? 0) +
3782
+ (input.styleAssetIds?.length ?? 0);
3783
+ const hasRefs = imageRefs + videoRefs > 0;
3784
+ const refCount = imageRefs + (hasRefs && input.firstFrameAssetId ? 1 : 0);
3785
+ const shapeError = audioRefs > 0
3786
+ ? 'Omni Flash takes no audio references. Drop them, or switch to seedance-2.5 or wan-3.0, which read reference audio.'
3787
+ : hasRefs && input.lastFrameAssetId
3788
+ ? 'Omni Flash takes a last frame only without references: references ride a different endpoint, with no end-frame slot. Drop the last frame or the references.'
3789
+ : input.lastFrameAssetId && !input.firstFrameAssetId
3790
+ ? 'Omni Flash needs a start frame (firstFrameAssetId) with a last frame.'
3791
+ : refCount > omniFlashRefCap
3792
+ ? `Omni Flash takes at most ${omniFlashRefCap} reference images combined, a start frame included (you passed ${refCount}). Trim the list.`
3793
+ : videoRefs > maxVideos
3794
+ ? `Omni Flash takes at most ${maxVideos} reference videos (you passed ${videoRefs}).`
3795
+ : [input.videoReferenceSeconds ?? 0, ...(input.videoReferenceSecondsEach ?? [])].some((d) => d > omniFlashRefClipMax + 0.05)
3796
+ ? `Each Omni Flash reference video must be ${omniFlashRefClipMax}s or shorter. Trim it first with slates_trim_video.`
3797
+ : null;
3798
+ if (shapeError) {
3799
+ return ok({ requires_clarification: true, missing: [], message: shapeError });
3489
3800
  }
3490
- const refCount = (input.ingredientAssetIds?.length ?? 0) +
3801
+ }
3802
+ // Wan 3.0's SHAPE constraints. The same split as Omni Flash: image-to-video
3803
+ // takes a start frame and an optional end frame, reference-to-video takes
3804
+ // images, videos and audio, and Alibaba calls the two modes "mutually
3805
+ // exclusive". The reference endpoint has no frame slot, so frames with
3806
+ // references are refused, never dropped (the MiniMax H3 rule, slate
3807
+ // .claude/rules/models.md invariant 7). Caps are read from the SSOT.
3808
+ if (input.model === 'wan-3.0') {
3809
+ const cap = getModelCapability('wan-3.0');
3810
+ const imageRefs = (input.ingredientAssetIds?.length ?? 0) +
3491
3811
  (input.characterAssetIds?.length ?? 0) +
3492
3812
  (input.environmentAssetIds?.length ?? 0) +
3493
3813
  (input.styleAssetIds?.length ?? 0);
3494
- if (refCount > omniFlashRefCap) {
3495
- return ok({
3496
- requires_clarification: true,
3497
- missing: [],
3498
- message: `Omni Flash takes at most ${omniFlashRefCap} reference images combined (you passed ${refCount}). Trim the list.`,
3499
- });
3814
+ const videoRefs = (input.videoReferenceAssetIds?.length ?? 0) + (input.videoReferenceAssetId ? 1 : 0);
3815
+ const audioRefs = (input.audioReferenceAssetIds?.length ?? 0) + (input.audioReferenceAssetId ? 1 : 0);
3816
+ const refImages = imageRefs;
3817
+ const refAll = refImages + videoRefs + audioRefs;
3818
+ const videoSecs = [input.videoReferenceSeconds ?? 0, ...(input.videoReferenceSecondsEach ?? [])].reduce((n, d) => n + (d > 0 ? d : 0), 0);
3819
+ const maxVideoSecs = cap?.maxReferenceVideoSeconds ?? 15;
3820
+ const overCap = [
3821
+ [refImages, cap?.maxIngredientImages, 'reference images'],
3822
+ [videoRefs, cap?.maxReferenceVideos, 'reference videos'],
3823
+ [audioRefs, cap?.maxReferenceAudio, 'reference audio clips'],
3824
+ [refAll, cap?.maxReferenceFilesTotal, 'reference files across all types'],
3825
+ ].find(([n, max]) => max !== undefined && n > max);
3826
+ const shapeError = refAll > 0 && (input.firstFrameAssetId || input.lastFrameAssetId)
3827
+ ? 'Wan 3.0 takes first/last frames OR references, not both: Alibaba calls the two modes mutually exclusive. Drop one side.'
3828
+ : input.lastFrameAssetId && !input.firstFrameAssetId
3829
+ ? 'Wan 3.0 needs a start frame (firstFrameAssetId) with a last frame.'
3830
+ : overCap
3831
+ ? `Wan 3.0 takes at most ${overCap[1]} ${overCap[2]} (you passed ${overCap[0]}).`
3832
+ : videoSecs > maxVideoSecs + 0.05
3833
+ ? `Wan 3.0 takes at most ${maxVideoSecs}s of reference video in total (you passed ${videoSecs.toFixed(1)}s). Trim a clip first with slates_trim_video.`
3834
+ : null;
3835
+ if (shapeError) {
3836
+ return ok({ requires_clarification: true, missing: [], message: shapeError });
3837
+ }
3838
+ }
3839
+ // Kling 4.0's SHAPE constraint: FRAMES, NEVER REFERENCES. Only fal's
3840
+ // `kling/v4/image-to-video` (start frame plus an optional end frame) and
3841
+ // `kling/v4/text-to-video` are sold; its reference-to-video is not, so a
3842
+ // reference id has no transport and is refused rather than dropped (the
3843
+ // LTX rule below). An end frame needs the start frame: text-to-video has
3844
+ // no frame slot at all.
3845
+ if (input.model === 'kling-v4.0') {
3846
+ const refs = (input.ingredientAssetIds?.length ?? 0) +
3847
+ (input.characterAssetIds?.length ?? 0) +
3848
+ (input.environmentAssetIds?.length ?? 0) +
3849
+ (input.styleAssetIds?.length ?? 0) +
3850
+ (input.videoReferenceAssetIds?.length ?? 0) +
3851
+ (input.audioReferenceAssetIds?.length ?? 0) +
3852
+ (input.videoReferenceAssetId ? 1 : 0) +
3853
+ (input.audioReferenceAssetId ? 1 : 0);
3854
+ const shapeError = refs > 0
3855
+ ? 'kling-v4.0 takes a prompt and up to two frames (start and/or end); it reads no reference images, video or audio. Drop them, or switch to kling-v3.0-omni, which reads reference images.'
3856
+ : input.lastFrameAssetId && !input.firstFrameAssetId
3857
+ ? 'kling-v4.0 needs a start frame (firstFrameAssetId) with a last frame.'
3858
+ : null;
3859
+ if (shapeError) {
3860
+ return ok({ requires_clarification: true, missing: [], message: shapeError });
3500
3861
  }
3501
3862
  }
3502
3863
  // LTX-2.5's SHAPE constraint: FRAMES, NEVER REFERENCES. fal publishes
@@ -3696,21 +4057,24 @@ export const generateVideo = {
3696
4057
  // The quote needs a length for EVERY reference clip, in both shapes. A
3697
4058
  // missing one doesn't fail the generation (the server probes and corrects
3698
4059
  // upward) — it silently under-quotes, which is worse than asking.
4060
+ // Wan 3.0 bills reference video seconds on top of output seconds too, and
4061
+ // Omni Flash's per-clip cap needs every length to check.
3699
4062
  const isSeedance = input.model.startsWith('seedance');
3700
- if (input.videoReferenceAssetId && isSeedance && !input.videoReferenceSeconds) {
4063
+ const needsRefSeconds = isSeedance || input.model === 'wan-3.0' || input.model === 'omni-flash';
4064
+ if (input.videoReferenceAssetId && needsRefSeconds && !input.videoReferenceSeconds) {
3701
4065
  return ok({
3702
4066
  requires_clarification: true,
3703
4067
  missing: ['videoReferenceSeconds'],
3704
- message: 'A Seedance video reference bills on combined input+output seconds (on a 2.5 Face row, max(input, output) + output). Pass videoReferenceSeconds (the reference clip\'s duration, shown in slates_list_assets) so the pre-flight quote matches the bill.',
4068
+ message: `A Seedance or Wan 3.0 video reference bills on combined input+output seconds (on a Seedance 2.5 Face row, max(input, output) + output), and Omni Flash caps each clip at ${omniFlashRefClipMax}s. Pass videoReferenceSeconds (the reference clip's duration, shown in slates_list_assets) so the pre-flight quote matches the bill.`,
3705
4069
  });
3706
4070
  }
3707
4071
  const pluralRefCount = input.videoReferenceAssetIds?.length ?? 0;
3708
- if (pluralRefCount > 0 && isSeedance &&
4072
+ if (pluralRefCount > 0 && needsRefSeconds &&
3709
4073
  (input.videoReferenceSecondsEach?.length ?? 0) !== pluralRefCount) {
3710
4074
  return ok({
3711
4075
  requires_clarification: true,
3712
4076
  missing: ['videoReferenceSecondsEach'],
3713
- message: `A Seedance video reference bills on combined input+output seconds (on a 2.5 Face row, max(input, output) + output). Pass videoReferenceSecondsEach with exactly ${pluralRefCount} duration${pluralRefCount === 1 ? '' : 's'}, in the same order as videoReferenceAssetIds (durations are shown in slates_list_assets), so the pre-flight quote matches the bill.`,
4077
+ message: `A Seedance or Wan 3.0 video reference bills on combined input+output seconds (on a Seedance 2.5 Face row, max(input, output) + output), and Omni Flash caps each clip at ${omniFlashRefClipMax}s. Pass videoReferenceSecondsEach with exactly ${pluralRefCount} duration${pluralRefCount === 1 ? '' : 's'}, in the same order as videoReferenceAssetIds (durations are shown in slates_list_assets), so the pre-flight quote matches the bill.`,
3714
4078
  });
3715
4079
  }
3716
4080
  const cloud = ctx.cloud();
@@ -3906,7 +4270,7 @@ export const generateVideo = {
3906
4270
  */
3907
4271
  export const listVoices = {
3908
4272
  id: 'slates_list_voices',
3909
- description: `Browse ${TTS_MODEL} preset voices. Pass a returned voiceId to slates_generate_audio. Filters AND together.`,
4273
+ description: `Browse the ${TTS_MODEL} preset voices; browsing spends nothing. Pass a returned voiceId to slates_generate_audio with model ${TTS_MODEL}. Filters AND together.`,
3910
4274
  input: z.object({
3911
4275
  gender: z.string().optional().describe('male | female'),
3912
4276
  accent: z.string().optional().describe('Region ("GB") or languageCode ("en-GB"); available accents come from the shelf.'),
@@ -3948,7 +4312,7 @@ export const listVoices = {
3948
4312
  line: shelf.line,
3949
4313
  count: voices.length,
3950
4314
  voices,
3951
- next: `Pass a voiceId to slates_generate_audio (model ${TTS_MODEL}) as voiceId. To keep one on a character for reuse, generate a clip with it and set slates_update_character voiceAssetId.`,
4315
+ next: `Pass a voiceId to slates_generate_audio (model ${TTS_MODEL}) as voiceId. To keep one for reuse, generate a clip with it and set it as a Library item's voice (slates_update_library_item voiceAssetId).`,
3952
4316
  });
3953
4317
  },
3954
4318
  };
@@ -3956,9 +4320,9 @@ export const listVoices = {
3956
4320
  export const generateAudio = {
3957
4321
  id: 'slates_generate_audio',
3958
4322
  billable: true,
3959
- description: `Generate project audio using credits. Choose the surface via the model routing below. ` +
4323
+ description: `Generate speech (voice-over), a scene sound bed or a sound effect into a project, using credits. The model param lists the surfaces and their routing. ` +
3960
4324
  'The estimate returns the chosen surface\'s prompting card; its full guide (slates-prompting-seed-audio | slates-prompting-elevenlabs | slates-prompting-inworld-tts) covers what the card leaves out. ' +
3961
- 'Seed Audio bills the requested duration, which is appended to the prompt regardless of output length. Kling "SFX:" / "Ambient noise:" syntax does not transfer. ' +
4325
+ 'Seed Audio bills the requested duration, which is appended to the prompt regardless of output length. ' +
3962
4326
  CONFIRM_GATE_SENTENCE,
3963
4327
  input: z.object({
3964
4328
  projectId: z.string().uuid().describe('Slates project the audio asset lands in. Required — the renderer refreshes live.'),
@@ -3994,7 +4358,7 @@ export const generateAudio = {
3994
4358
  .min(TTS_VOICE_CLONE.designPromptChars.min)
3995
4359
  .max(TTS_VOICE_CLONE.designPromptChars.max)
3996
4360
  .optional()
3997
- .describe(`${TTS_MODEL} — a voice from words (${TTS_VOICE_CLONE.designPromptChars.min}-${TTS_VOICE_CLONE.designPromptChars.max} chars) for a character with no recording; keep it via slates_update_character voiceAssetId.`),
4361
+ .describe(`${TTS_MODEL} — a voice from words (${TTS_VOICE_CLONE.designPromptChars.min}-${TTS_VOICE_CLONE.designPromptChars.max} chars) for a character with no recording; keep it via slates_update_library_item voiceAssetId.`),
3998
4362
  speed: z.number().min(0.5).max(2).optional().describe('seed-audio only — 0.5-2.0. Reach for it when dialogue races or drags against picture.'),
3999
4363
  volume: z.number().min(0.5).max(2).optional().describe('seed-audio only — output gain, 0.5-2.0 (1 = unchanged). Prefer the timeline fader for mix decisions.'),
4000
4364
  pitch: z.number().int().min(-12).max(12).optional().describe('seed-audio only — semitones. Small moves; ±3 is already a lot.'),
@@ -4011,10 +4375,11 @@ export const generateAudio = {
4011
4375
  .optional()
4012
4376
  .describe('seed-audio only — ONE image asset to score what is in frame. MUTUALLY EXCLUSIVE with audioReferenceAssetIds.'),
4013
4377
  background: z.boolean().optional().describe(BACKGROUND_DESCRIBE),
4014
- confirm: z.boolean().optional().describe('Set true to bypass the confirm gate after explicit user OK.'),
4378
+ confirm: z.boolean().optional().describe(CONFIRM_PARAM),
4015
4379
  folderId: folderIdField,
4016
4380
  }),
4017
4381
  run: async (input, ctx) => {
4382
+ requireGuideRead(ctx, input.model);
4018
4383
  // A desktop before the folder rule ignores folderId and files at the root.
4019
4384
  if (input.folderId !== undefined)
4020
4385
  await ctx.desktop().requireCapability('media-folder', 'choosing the folder a result lands in');
@@ -4052,7 +4417,7 @@ export const generateAudio = {
4052
4417
  return ok({
4053
4418
  requires_clarification: true,
4054
4419
  missing: ['voiceId'],
4055
- message: `${TTS_MODEL} needs a voice — exactly one of three. Speaking AS a character: pass its voiceAssetId (slates_list_characters) as voiceReferenceAssetId. A stock voice: slates_list_voices lists presets by gender, accent and age; pass one's voiceId. No recording of the voice: voiceDescription (words), or voiceReferenceAssetId with any clean clip of one speaker. A voice worth reusing can be kept on a character with slates_update_character, but nothing requires that — ask the user which they want only when the request does not say.`,
4420
+ message: `${TTS_MODEL} needs a voice — exactly one of three. Speaking AS a character: pass its voiceAssetId (slates_list_characters) as voiceReferenceAssetId. A stock voice: slates_list_voices lists presets by gender, accent and age; pass one's voiceId. No recording of the voice: voiceDescription (words), or voiceReferenceAssetId with any clean clip of one speaker. A voice worth reusing can be kept on a Library item with slates_update_library_item, but nothing requires that — ask the user which they want only when the request does not say.`,
4056
4421
  });
4057
4422
  }
4058
4423
  if (voiceSources.length > 1) {
@@ -4211,21 +4576,21 @@ async function quoteToolBlocks(ctx, stem, seconds, voiceStep) {
4211
4576
  export const generateLipSync = {
4212
4577
  id: 'slates_generate_lip_sync',
4213
4578
  billable: true,
4214
- description: 'Lip-sync a still image (avatar) or a video clip to audio. KLING-ONLY — this tool wraps Kling\'s dedicated lip-sync endpoints and nothing else: sourceType=video re-syncs a clip, sourceType=image animates a still avatar (avatar-standard, or avatar-pro for the premium seat). Quote each with slates_estimate_generation_cost rather than from memory. Audio from TTS (ttsText + ttsVoice) or an uploaded file. Billed per 5s of the output (the clip, or on a still the voice track). For a Seedance version, do NOT look for an engine switch here — run a normal slates_generate_video on seedance-2 with the clip attached as a video reference and the dialogue written into the prompt; that is the same call, with the prompt visible and editable. The craft is slates-prompting-lip-sync; the confirm response shows the exact cost before anything is charged. projectId is REQUIRED. ' +
4215
- CONFIRM_GATE_SENTENCE,
4579
+ description: 'Lip-sync a still image (avatar) or a video clip to audio. Kling only: this tool wraps Kling\'s dedicated lip-sync endpoints and nothing else: sourceType=video re-syncs a clip, sourceType=image animates a still avatar (avatar-standard, or avatar-pro for the premium seat). Quote each with slates_estimate_generation_cost rather than from memory. Audio from TTS (ttsText + ttsVoice) or an uploaded file. Billed per 5s of the output (the clip, or on a still the voice track). For a Seedance version there is no engine switch here: run a normal slates_generate_video on seedance-2 with the clip attached as a video reference and the dialogue written into the prompt; that is the same call, with the prompt visible and editable. The craft is slates-prompting-lip-sync; the confirm response shows the exact cost before anything is charged. projectId is required. ' +
4580
+ confirmGateSentence('a length it cannot read'),
4216
4581
  input: z.object({
4217
4582
  projectId: z.string().uuid().describe('Slates project the source asset lives in. The new lip-synced video lands here.'),
4218
- sourceAssetId: z.string().uuid().describe('Asset id of the still image (avatar flow) or video clip (lip-sync flow). Must already exist in the project — use slates_upload_reference_image or slates_generate_image / slates_generate_video first if needed.'),
4583
+ sourceAssetId: z.string().uuid().describe('Asset id of the still image (avatar flow) or video clip (lip-sync flow). Must already exist in the project — use slates_upload_reference_image or slates_generate_image / slates_generate_video first if needed. ' + ASSET_UUID_ONLY),
4219
4584
  sourceType: z.enum(['image', 'video']).describe('"image" = animate a still portrait (avatar). "video" = re-sync an existing talking-head clip. Determines pricing — be deliberate.'),
4220
4585
  audioMethod: z.enum(['tts', 'upload']).describe('"tts" = generate speech from ttsText. "upload" = use the file at audioFilePath (absolute path on the user\'s machine).'),
4221
- ttsText: z.string().min(1).max(2000).optional().describe('Required when audioMethod=tts. The exact words the avatar/clip will speak.'),
4586
+ ttsText: z.string().min(1).max(2000).optional().describe('Required when audioMethod=tts. The exact words the avatar/clip will speak, up to 120 characters (longer is cut off); for a longer line upload audio or make it with slates_generate_audio.'),
4222
4587
  ttsVoice: z.string().optional().describe('Voice id (e.g. "oversea_male1"). See slates-prompting-lip-sync skill for the voice catalog.'),
4223
4588
  ttsLanguage: z.enum(['EN', 'ZH', 'JA', 'KO', 'ES']).optional().describe('TTS language. Default EN.'),
4224
4589
  ttsSpeed: z.number().min(0.5).max(2).optional().describe('TTS speech rate. Default 1.0. Range 0.5-2.0.'),
4225
4590
  audioFilePath: z.string().optional().describe('Required when audioMethod=upload. Absolute path to the audio file on the user\'s machine (mp3, wav, m4a).'),
4226
- avatarModel: z.enum(['avatar-standard', 'avatar-pro']).optional().describe('Image-source only. avatar-standard (~14 credits/5s) for general use. avatar-pro (~29 credits/5s) for sharper face fidelity.'),
4591
+ avatarModel: z.enum(['avatar-standard', 'avatar-pro']).optional().describe('Image-source only. avatar-standard for general use; avatar-pro for sharper face fidelity. Price each with slates_estimate_generation_cost.'),
4227
4592
  background: z.boolean().optional().describe(BACKGROUND_DESCRIBE),
4228
- confirm: z.boolean().optional().describe('Set true to bypass the confirm gate. Required for avatar-pro.'),
4593
+ confirm: z.boolean().optional().describe(CONFIRM_PARAM),
4229
4594
  }),
4230
4595
  async run(input, ctx) {
4231
4596
  if (input.audioMethod === 'tts' && !input.ttsText) {
@@ -4245,6 +4610,7 @@ export const generateLipSync = {
4245
4610
  const stem = input.sourceType === 'video'
4246
4611
  ? 'kling-lip-sync-video'
4247
4612
  : input.avatarModel === 'avatar-pro' ? 'kling-lip-sync-avatar-pro' : 'kling-lip-sync-avatar';
4613
+ requireGuideRead(ctx, stem);
4248
4614
  // Billed per 5s block of the output: the clip's length on a video source;
4249
4615
  // on a still, the voice track's — typed words at the desktop's reading pace
4250
4616
  // (`lipSyncEstimate`, 13 characters a second, so this quote is the Generate
@@ -4333,24 +4699,25 @@ export const generateLipSync = {
4333
4699
  export const generateMotionTransfer = {
4334
4700
  id: 'slates_generate_motion_transfer',
4335
4701
  billable: true,
4336
- description: 'Transfer the motion from a reference video onto a target image character. KLING-ONLY — this tool wraps Kling Motion Control and nothing else: kling-mc-std or kling-mc-pro, structured skeleton/depth retargeting, billed per 5s of the driving clip. For a Seedance version, do NOT look for an engine switch here — run a normal slates_generate_video on seedance-2 with the driving clip attached as a video reference and the motion described in the prompt ("the character from image 1 performs the exact motion from video 1"); that is the same call, with the prompt visible and editable. The craft is slates-prompting-motion-transfer; the confirm response shows the exact cost before anything is charged. projectId is REQUIRED — both assets must exist in the project. ' +
4337
- CONFIRM_GATE_SENTENCE,
4702
+ description: 'Transfer the motion from a reference video onto a target image character. KLING-ONLY — this tool wraps Kling Motion Control and nothing else: kling-mc-std or kling-mc-pro, structured skeleton/depth retargeting, billed per 5s of the driving clip. For a Seedance version there is no engine switch here: run a normal slates_generate_video on seedance-2 with the driving clip attached as a video reference and the motion described in the prompt ("the character from image 1 performs the exact motion from video 1"); that is the same call, with the prompt visible and editable. The craft is slates-prompting-motion-transfer; the confirm response shows the exact cost before anything is charged. projectId is REQUIRED — both assets must exist in the project. ' +
4703
+ confirmGateSentence('a source length it cannot read'),
4338
4704
  input: z.object({
4339
4705
  projectId: z.string().uuid().describe('Slates project. Both source and target assets must live here.'),
4340
- sourceVideoAssetId: z.string().uuid().describe('Asset id of the reference video — its motion will be retargeted onto the target image. Must already exist in the project. Up to 30s with characterOrientation video, 10s with image; billed per 5s block.'),
4341
- targetImageAssetId: z.string().uuid().describe('Asset id of the target image (the character that will perform the motion). Must already exist in the project.'),
4706
+ sourceVideoAssetId: z.string().uuid().describe(`Asset id of the reference video — its motion will be retargeted onto the target image. Must already exist in the project. Up to ${MOTION_TRANSFER_MAX_SECONDS.video}s with characterOrientation video, ${MOTION_TRANSFER_MAX_SECONDS.image}s with image; billed per 5s block.` + ' ' + ASSET_UUID_ONLY),
4707
+ targetImageAssetId: z.string().uuid().describe('Asset id of the target image (the character that will perform the motion). Must already exist in the project. ' + ASSET_UUID_ONLY),
4342
4708
  motionModel: z.enum(['kling-mc-std', 'kling-mc-pro']).optional().describe('kling-mc-std general motion; kling-mc-pro cleaner anatomy — default. Quote both with slates_estimate_generation_cost.'),
4343
4709
  characterOrientation: z.enum(['video', 'image']).optional().describe('"video" = use the source video\'s framing. "image" = use the target image\'s framing. Default video.'),
4344
4710
  prompt: z.string().optional().describe('Optional refinement. Read slates-prompting-motion-transfer.'),
4345
4711
  background: z.boolean().optional().describe(BACKGROUND_DESCRIBE),
4346
- confirm: z.boolean().optional().describe('Set true to bypass the confirm gate. Required — both tiers exceed.'),
4712
+ confirm: z.boolean().optional().describe(CONFIRM_PARAM),
4347
4713
  }),
4348
4714
  async run(input, ctx) {
4349
4715
  const motionModel = input.motionModel ?? 'kling-mc-pro';
4716
+ requireGuideRead(ctx, motionModel);
4350
4717
  // Billed per 5s block of the driving clip, which the output follows, up to
4351
4718
  // the orientation's maximum (the desktop's `motionTransferEstimate`).
4352
4719
  const clipSeconds = await recordedSeconds(ctx.desktop(), input.projectId, input.sourceVideoAssetId);
4353
- const seconds = clipSeconds == null ? null : Math.min(clipSeconds, (input.characterOrientation ?? 'video') === 'video' ? 30 : 10);
4720
+ const seconds = clipSeconds == null ? null : Math.min(clipSeconds, MOTION_TRANSFER_MAX_SECONDS[input.characterOrientation ?? 'video']);
4354
4721
  const { costKey, totalCents, blocks } = await quoteToolBlocks(ctx, motionModel, seconds, false);
4355
4722
  // Cost confirm gate. Motion transfer is mechanical — the model
4356
4723
  // applies source motion to target image deterministically. We don't
@@ -4442,26 +4809,27 @@ export const editVideo = {
4442
4809
  // point to in a tool result) and go stale on the next rate change; the
4443
4810
  // windows are owned by MODEL_CAPABILITIES and are generated below into the
4444
4811
  // params that enforce them.
4445
- 'Edit an EXISTING video clip with one instruction — character swap, environment change, style transfer — in one pass, no masking. Original motion, camera, and audio are preserved; only what the prompt names changes. Use when a clip is ~90% right (fix it, don\'t re-roll it) or to AI-edit the user\'s own footage. Engines: Kling O3 edit (default — subject/style refs via elements), omni-flash-edit (PROMPT-ONLY, no refs, priced level with Kling O3 Edit Standard; the first pick in the routing guide for footage-synced edits), or seedance-2.5-edit (the only engine that takes a clip over 15s; seedanceFace:true for AI-character faces). Clip-length and resolution windows per engine are on the `model` param. Cost is per second of OUTPUT (≈ clip length, rounded up), and an edit bills input + output seconds on Seedance and output seconds on Kling and Omni Flash — read the quote from the confirm gate or slates_estimate_generation_cost, never from memory. Subjects to swap IN go as characterAssetIds (frontal + angle images become Kling elements — Kling models only); style refs as styleAssetIds; max 4 combined. The edited clip saves as a NEW asset linked to its parent (chain edits freely). Routing: Kling edit is the default (element lock + audio intact); omni-flash-edit for cheap prompt-only footage-synced swaps; Seedance edit for style-transfer-heavy jobs — see slates-model-selection. Prompting: slates-prompting-kling-v3 §Edit / slates-prompting-omni-flash.',
4812
+ 'Edit an EXISTING video clip with one instruction — character swap, environment change, style transfer — in one pass, no masking. Original motion, camera, and audio are preserved; only what the prompt names changes. Use when a clip is ~90% right (fix it, don\'t re-roll it) or to AI-edit the user\'s own footage. Engine routing, clip-length and resolution windows are on the `model` param (subject and style refs: ' + EDIT_VIDEO_ELEMENT_MODELS.join(' and ') + ' only); seedanceFace:true for AI-character faces on seedance-2.5-edit. Cost is per second: output seconds on Kling and Omni Flash, input + output on Seedance; quote it with slates_estimate_generation_cost. Subjects to swap IN go as characterAssetIds (frontal + angle images become Kling elements — Kling models only); style refs as styleAssetIds; max 4 combined. The edited clip saves as a NEW asset linked to its parent (chain edits freely). Routing: the `model` param and slates-model-selection. Prompting: slates-prompting-kling-v3 §Edit / slates-prompting-omni-flash. ' +
4813
+ confirmGateSentence('any character or style reference'),
4446
4814
  input: z.object({
4447
4815
  projectId: z.string().uuid().describe('Project the source clip lives in.'),
4448
- sourceVideoAssetId: z.string().describe('The VIDEO asset to edit — UUID or badge code ("VID-V3", bare "V3"); codes resolve against the project at call time. Kling: 3–15s clips; omni-flash-edit: 3–10s.'),
4816
+ sourceVideoAssetId: z.string().describe('The VIDEO asset to edit — UUID or badge code ("VID-V3", bare "V3"); codes resolve against the project at call time. Clip-length windows per engine are on `model`.'),
4449
4817
  prompt: z.string().min(1).max(2500).describe('The change, not the whole scene — e.g. "replace the man with @marcus", "make it a rainy night", "turn the street into a neon Tokyo alley". Mention subjects with @name; the transport compiles them to Kling\'s @ElementN notation (Kling models). For omni-flash-edit keep it simple and add "Keep everything else the same."'),
4450
4818
  // Clip windows and resolutions GENERATED from MODEL_CAPABILITIES.
4451
4819
  model: zEnum(EDIT_VIDEO_MODELS).optional().describe(
4452
4820
  // Routing GENERATED from MODEL_FACTS; the paragraph that stood here was
4453
4821
  // hand-written and carried per-second prices, which drift and which the
4454
4822
  // agent's own REAL NUMBERS ONLY rule forbids it repeating.
4455
- `Default kling-v3.0-omni-edit. Neither omni-flash-edit nor seedance-2.5-edit takes character/style refs on this op.\n` +
4823
+ `Default ${EDIT_VIDEO_DEFAULT}. Character and style references: ${EDIT_VIDEO_ELEMENTS_ONLY}\n` +
4456
4824
  `${describeRouting('video', 'edit')}\n` +
4457
4825
  `Source-clip length per engine: ${describeDurations(EDIT_VIDEO_MODELS)}. Output resolution: ${describeVideoResolutions(EDIT_VIDEO_MODELS)}`),
4458
- characterAssetIds: z.array(z.string()).max(4).optional().describe('Subject/element image assets to swap IN (UUIDs or badge codes). Each becomes a Kling element (@ElementN). KLING MODELS ONLY — rejected on omni-flash-edit.'),
4459
- styleAssetIds: z.array(z.string()).max(4).optional().describe('Style/appearance reference images (@ImageN). Max 4 combined with characterAssetIds. KLING MODELS ONLY — rejected on omni-flash-edit.'),
4826
+ characterAssetIds: z.array(z.string()).max(EDIT_VIDEO_ELEMENT_CAP).optional().describe('Subject/element image assets to swap IN (UUIDs or badge codes). Each becomes an element (@ElementN). ' + EDIT_VIDEO_ELEMENTS_ONLY),
4827
+ styleAssetIds: z.array(z.string()).max(EDIT_VIDEO_ELEMENT_CAP).optional().describe(`Style/appearance reference images (@ImageN). Max ${EDIT_VIDEO_ELEMENT_CAP} combined with characterAssetIds. ` + EDIT_VIDEO_ELEMENTS_ONLY),
4460
4828
  keepAudio: z.boolean().optional().describe('Preserve the original audio track (default true; Kling models only — omni-flash-edit and seedance-2.5-edit output carry their own audio).'),
4461
- videoResolution: zEnum(EDIT_VIDEO_RESOLUTIONS).optional().describe(`seedance-2.5-edit ONLY (default ${defaultVideoResolutionFor('seedance-2.5-edit')}). Ignored by the Kling and Omni Flash engines, whose output follows the source clip.`),
4462
- seedanceFace: z.boolean().optional().describe('seedance-2.5-edit ONLY: set true when a CHARACTER FACE is visible in the clip. Without it a face is blocked outright; with it the edit costs about 40-50% more. A face edit submitted without this flag is rejected, not silently downgraded.'),
4829
+ videoResolution: zEnum(EDIT_VIDEO_RESOLUTIONS).optional().describe(`seedance-2.5-edit (default ${defaultVideoResolutionFor('seedance-2.5-edit')}) and omni-flash-edit (default ${defaultVideoResolutionFor('omni-flash-edit')}; its 1080p and 4K are upscales). Ignored by the Kling engines, whose output follows the source clip.`),
4830
+ seedanceFace: z.boolean().optional().describe(`seedance-2.5-edit ONLY: set true when a CHARACTER FACE is visible in the clip. Without it a face is blocked outright; with it the edit is priced higher: quote it with slates_estimate_generation_cost by its cost key as model (${seedanceEditCostKey({ duration: SEEDANCE_25_EDIT_MIN_SECONDS, videoResolution: defaultVideoResolutionFor('seedance-2.5-edit'), seedanceFace: true })} for ${SEEDANCE_25_EDIT_MIN_SECONDS}s at ${defaultVideoResolutionFor('seedance-2.5-edit')}). A face edit submitted without this flag is rejected, not silently downgraded.`),
4463
4831
  background: z.boolean().optional().describe(BACKGROUND_DESCRIBE),
4464
- confirm: z.boolean().optional().describe('Set true to bypass the cost confirm gate after the user OKs the spend.'),
4832
+ confirm: z.boolean().optional().describe(CONFIRM_PARAM),
4465
4833
  folderId: folderIdField,
4466
4834
  }),
4467
4835
  async run(input, ctx) {
@@ -4473,14 +4841,15 @@ export const editVideo = {
4473
4841
  if (input.background) {
4474
4842
  await desktop.requireCapability('background-generation', 'background generation');
4475
4843
  }
4476
- const model = input.model ?? 'kling-v3.0-omni-edit';
4844
+ const model = input.model ?? EDIT_VIDEO_DEFAULT;
4845
+ requireGuideRead(ctx, model);
4477
4846
  const isOmniFlashEdit = model === 'omni-flash-edit';
4478
4847
  const isSeedanceEdit = model === 'seedance-2.5-edit';
4479
4848
  // Source-clip window, read from the capability SSOT per engine — never a
4480
4849
  // model-id ternary. (Kling 3–15s, Omni Flash 3–10s, Seedance 2.5 4–30s.)
4481
4850
  const { min: minClipSeconds, max: maxClipSeconds } = editClipBounds(model);
4482
- if ((isOmniFlashEdit || isSeedanceEdit) && ((input.characterAssetIds?.length ?? 0) > 0 || (input.styleAssetIds?.length ?? 0) > 0)) {
4483
- throw new Error(`${model} takes the prompt and the source clip only on this op — no character/style reference images. Drop the refs, or switch to kling-v3.0-omni-edit which supports elements.`);
4851
+ if (!EDIT_VIDEO_ELEMENT_MODELS.includes(model) && ((input.characterAssetIds?.length ?? 0) > 0 || (input.styleAssetIds?.length ?? 0) > 0)) {
4852
+ throw new Error(`${model} takes the prompt and the source clip only on this op — no character/style reference images. Drop the refs, or switch to ${EDIT_VIDEO_ELEMENT_MODELS.join(' or ')}, which take them.`);
4484
4853
  }
4485
4854
  // Resolve refs (UUIDs or badge codes) against the project AT CALL TIME.
4486
4855
  const refInputs = [
@@ -4494,8 +4863,8 @@ export const editVideo = {
4494
4863
  const characterAssetIds = (input.characterAssetIds ?? []).map(rid);
4495
4864
  const styleAssetIds = (input.styleAssetIds ?? []).map(rid);
4496
4865
  const refEcho = describeResolvedRefs(refInputs, resolved);
4497
- if (characterAssetIds.length + styleAssetIds.length > 4) {
4498
- throw new Error('Kling O3 edit takes max 4 combined subject + style references.');
4866
+ if (characterAssetIds.length + styleAssetIds.length > EDIT_VIDEO_ELEMENT_CAP) {
4867
+ throw new Error(`${model} takes at most ${EDIT_VIDEO_ELEMENT_CAP} subject and style references combined.`);
4499
4868
  }
4500
4869
  // The billed key needs the clip's duration (ceiled). Read it from the
4501
4870
  // project's asset records — the desktop route independently re-validates.
@@ -4528,7 +4897,7 @@ export const editVideo = {
4528
4897
  seedanceFace: input.seedanceFace === true,
4529
4898
  })
4530
4899
  : isOmniFlashEdit
4531
- ? omniFlashEditCostKey(billedSeconds)
4900
+ ? omniFlashEditCostKey(billedSeconds, (input.videoResolution ?? defaultVideoResolutionFor('omni-flash-edit')))
4532
4901
  : klingEditCostKey(model, billedSeconds);
4533
4902
  const cloud = ctx.cloud();
4534
4903
  const registry = await cloud.get('/api/agent/models');
@@ -4609,7 +4978,7 @@ export const editVideo = {
4609
4978
  // ── Trim a video to an exact window (fit-to-model primitive) ────
4610
4979
  export const trimVideo = {
4611
4980
  id: 'slates_trim_video',
4612
- description: 'Trim a video asset to an exact [inSec, outSec] window and save the result as a NEW clip linked to the original (the original is untouched). This is the fit-to-model primitive: an 11s clip will not run on omni-flash-edit (3–10s), a 16s one not on Kling edit (3–15s), and a Seedance 2.0 video reference must be 2–15s (2.5 takes up to 30s combined) — trim it first, then edit the trimmed clip. EXACT re-encode (not a keyframe-snapped cut) so the result honors hard duration caps to the frame; any phone rotation flag is baked into the pixels in the same pass. The new clip lands with correct duration/width/height immediately. inSec defaults to 0. Pass pieces to cut the window into SEVERAL clips in one call, as the Trim & split dialog does (split points, or Auto-split by longest piece, with seconds shared between neighbours); every new clip comes back.',
4981
+ description: 'Trim a video asset to an exact [inSec, outSec] window and save the result as a NEW clip linked to the original (the original is untouched). This is the fit-to-model primitive: when a clip is longer than the edit or reference window the chosen model accepts (its `model` param and estimate state the window), trim it first, then edit the trimmed clip. Exact re-encode (not a keyframe-snapped cut) so the result honors hard duration caps to the frame; any phone rotation flag is baked into the pixels in the same pass. The new clip lands with correct duration/width/height immediately. inSec defaults to 0. Pass pieces to cut the window into SEVERAL clips in one call, as the Trim & split dialog does (split points, or Auto-split by longest piece, with seconds shared between neighbours); every new clip comes back.',
4613
4982
  input: z.object({
4614
4983
  projectId: z.string().uuid().describe('Project the clip lives in.'),
4615
4984
  assetId: z
@@ -4671,7 +5040,7 @@ export const trimVideo = {
4671
5040
  // ── Generation status (background mode) ─────────────────────────
4672
5041
  export const getGenerationStatus = {
4673
5042
  id: 'slates_get_generation_status',
4674
- description: 'Poll one generation by id. Returns status (pending/processing/completed/failed/cancelled), the error message on failure, and the finished asset record (with id, code, filePath) on completion. Use after submitting any generate_* op with background=true. ALWAYS pass waitSeconds (use 45) — the call long-polls internally and returns early the moment the generation reaches a terminal state, so ONE call replaces a dozen rapid polls (each poll turn re-reads your whole context; rapid polling is the #1 orchestration-cost leak). Video generations commonly take 1-5 minutes: expect 1-4 long-poll calls, never a tight loop. Generations survive app restarts (the desktop resumes in-flight provider jobs on boot).',
5043
+ description: 'Poll one generation by id after a background=true submit. Returns status (pending/processing/completed/failed/cancelled), the error message on failure, and the finished asset record (with id, code, filePath) on completion. Pass waitSeconds 45: the call long-polls and returns the moment the generation ends, so one call replaces many quick polls, each of which re-reads your whole context. A video commonly takes a few long-poll calls. Generations survive app restarts (the desktop resumes in-flight provider jobs on boot).',
4675
5044
  input: z.object({
4676
5045
  generationId: z.string().uuid(),
4677
5046
  waitSeconds: z
@@ -4731,19 +5100,205 @@ export const listGenerations = {
4731
5100
  }));
4732
5101
  },
4733
5102
  };
4734
- const exportCutsInput = z.object({ projectId: z.string().uuid(), directory: z.string(), manifestId: z.string().min(1),
5103
+ const legacyExportCutsInput = z.object({ projectId: z.string().uuid(), directory: z.string(), manifestId: z.string().min(1),
4735
5104
  action: z.enum(['start', 'status', 'cancel']).optional().describe('start (default) begins, or re-attaches to a running export; status reads it; cancel stops after the output being rendered.'),
4736
- items: z.array(z.object({ timelineId: z.string().uuid(), format: z.enum(['mp4', 'xml']) })).min(1).optional().describe('Required to start.') });
5105
+ items: z.array(z.object({ timelineId: z.string().uuid(), format: z.enum(['mp4', 'xml']) }).strict()).min(1).optional().describe('Required to start.') }).strict();
5106
+ // A pick from a cut's variant grid (desktop engine plan E3b; slate shared/variantSlots.ts normalizeVariantGridPick).
5107
+ const variantGridPicks = z.record(z.string().uuid(), z.array(z.string().uuid())).describe('Slot id to the alternative ids picked in it; a slot left out takes all its alternatives.');
5108
+ const variantGridAspects = z.array(deliveryAspectInput).min(1).describe("Delivery format ids; default the cut's own formats, else master.");
5109
+ const adCopyInput = z.object({ destinationUrl: z.string().optional(), primaryText: z.string().optional(), headline: z.string().optional(), cta: z.string().optional() }).strict();
5110
+ const batchExportCutsInput = z.object({
5111
+ version: z.literal(2).describe('Use version 2 with batchId and items for delivery-format batches. Omit version for legacy directory/manifestId requests.'),
5112
+ projectId: z.string().uuid(), batchId: z.string().min(1).describe('Required for version 2. Reuse this id and the same items to reattach or retry.'),
5113
+ exportRoot: z.string().optional().describe('Optional export root; the desktop remembers it and creates a fresh batch folder.'),
5114
+ items: z.array(z.object({ timelineId: z.string().uuid(), aspects: z.array(deliveryAspectInput).min(1).optional(),
5115
+ formats: z.array(z.enum(['mp4', 'xml'])).min(1).optional(), taxonomy: taxonomyInput.optional() }).strict()),
5116
+ variants: z.object({ timelineId: z.string().uuid().describe('The cut with the slots, or any timeline of its family.'), picks: variantGridPicks.optional(), aspects: variantGridAspects.optional() }).strict()
5117
+ .describe('A grid pick to export: each combination gets a variant row if it has none, and every variant exports in every format, beside any items. Requires variant-grid.').optional(),
5118
+ copy: adCopyInput.optional().describe('User-entered batch ad copy and destination defaults. Omission leaves them empty; never copy script or video text here.'),
5119
+ outputCopy: z.record(adCopyInput).optional().describe('Per-output ad copy overrides keyed by the desktop receipt output key.'),
5120
+ }).strict();
5121
+ // MCP requires an object at the schema root; the CLI also reads its shape for
5122
+ // project defaults and flag coercion. Validate the two wire contracts intact.
5123
+ const exportCutsInput = z.object({
5124
+ ...legacyExportCutsInput.partial().shape,
5125
+ ...batchExportCutsInput.partial().shape,
5126
+ projectId: z.string().uuid(),
5127
+ items: z.array(z.union([batchExportCutsInput.shape.items.element, legacyExportCutsInput.shape.items.unwrap().element])).optional().describe('Required for version 2 start/retry (may be [] beside variants) and legacy start. Version 2 selects existing timelineIds with aspects/formats/taxonomy; legacy selects timelineId/format.'),
5128
+ }).strict().superRefine((input, ctx) => {
5129
+ const parsed = (input.version === 2 ? batchExportCutsInput : legacyExportCutsInput).safeParse(input);
5130
+ if (!parsed.success)
5131
+ for (const issue of parsed.error.issues)
5132
+ ctx.addIssue(issue);
5133
+ if (input.items?.length === 0 && !(input.version === 2 && input.variants))
5134
+ ctx.addIssue({ code: z.ZodIssueCode.custom, path: ['items'], message: 'items needs at least one cut, unless version 2 names variants' });
5135
+ });
4737
5136
  export const exportCuts = {
4738
- id: 'slates_export_cuts', description: 'Export explicit named cuts to distinct local files with a frozen manifest of timeline settings, media, script revisions and generation provenance. Returns at once while rendering continues; poll with action status. Starting again with the same manifestId and selection retries unfinished outputs under the same filenames and skips finished ones. Existing outputs are never overwritten, and export never generates media. Uses current video/XML fidelity limits.',
5137
+ id: 'slates_export_cuts', description: 'Start or retry a background export of existing named cuts to local files without generating media or spending credits. Version 2 selects cuts × delivery aspects from slates_get_variant_grid and returns batchId, manifestPath and frozen named outputs immediately; poll slates_get_export_batch. Version 2 with variants (a pick read through slates_get_variants grid) and items [] exports every variant of a cut\'s slots in every picked format in one request, adding the rows a combination lacks: one body and ten hooks in four formats is forty named files. Each variant\'s picture is joined from parts rendered once per format and kept, so a shared body renders once and an unchanged export again renders nothing; an output cut at a seam carries segments (parts, reused), and one that rendered whole says why. Variants requires variant-grid. Repeating the same batchId and selection reattaches or retries unfinished outputs; completed files are checked and never overwritten. Naming, delivery and provenance are frozen by the desktop. CSV contains completed MP4s only and is unverified against a live Meta import. Missing takes are reported per cut, never filled. Version 2 requires ad-variant-export; update Slates on capability refusal. Legacy directory/manifestId/items/action requests remain supported. For one cut, slates_export_video is enough.',
5138
+ billable: false,
4739
5139
  input: exportCutsInput,
4740
5140
  async run(input, ctx) {
4741
- await ctx.desktop().requireCapability('named-cuts', 'named cuts');
4742
- return ok(await ctx.desktop().post('/agent/timeline/export-cuts', input));
5141
+ const desktop = ctx.desktop();
5142
+ await desktop.requireCapability('named-cuts', 'named cuts');
5143
+ if (input.version === 2)
5144
+ await desktop.requireCapability('ad-variant-export', 'ad variant batch export and retry');
5145
+ if (input.variants !== undefined)
5146
+ await desktop.requireCapability('variant-grid', 'exporting a variant grid pick');
5147
+ return ok(await desktop.post('/agent/timeline/export-cuts', input));
5148
+ },
5149
+ };
5150
+ export const getExportBatch = {
5151
+ id: 'slates_get_export_batch', description: 'Inspect the status of an ad variant export batch, or list saved batches in a project when batchId is omitted. Returns receipts and per-output states immediately through GET, including after a desktop restart. Never starts or retries a render and never spends credits. Requires ad-variant-export; update Slates on capability refusal.',
5152
+ billable: false,
5153
+ input: z.object({ projectId: z.string().uuid(), batchId: z.string().min(1).optional() }).strict(),
5154
+ async run(input, ctx) {
5155
+ const desktop = ctx.desktop();
5156
+ await desktop.requireCapability('ad-variant-export', 'ad variant export batch status and listing');
5157
+ if (input.batchId !== undefined)
5158
+ return ok(await desktop.get('/agent/timeline/export-cuts/status', input));
5159
+ return ok(await desktop.get('/agent/timeline/export-batches', { projectId: input.projectId }));
5160
+ },
5161
+ };
5162
+ export const cancelExportBatch = {
5163
+ id: 'slates_cancel_export_batch', description: 'Stop an ad variant export now, or after the current output finishes. mode now aborts active encoding; after-current preserves the current output before stopping. Completed files and frozen names remain available for retry with slates_export_cuts. Never generates media or spends credits. Requires ad-variant-export; update Slates on capability refusal.',
5164
+ billable: false,
5165
+ input: z.object({ projectId: z.string().uuid(), batchId: z.string().min(1), mode: z.enum(['now', 'after-current']) }).strict(),
5166
+ async run(input, ctx) {
5167
+ await ctx.desktop().requireCapability('ad-variant-export', 'ad variant export cancellation');
5168
+ return ok(await ctx.desktop().post('/agent/timeline/export-cuts/cancel', input));
5169
+ },
5170
+ };
5171
+ export const getVariantGrid = {
5172
+ id: 'slates_get_variant_grid', description: 'Read the variant grid of existing named cuts, recorded slot choices, missing takes and delivery format ids with actual dimensions. Shows absent combinations without creating them; missing-take prices are local quotes, never generation requests. Select existing timelineIds and returned aspects for slates_export_cuts. For a cut\'s slots (hooks, body, end card) crossed with formats, read slates_get_variants with grid. Requires ad-variant-export; update Slates on capability refusal.',
5173
+ billable: false,
5174
+ input: z.object({ projectId: z.string().uuid() }).strict(),
5175
+ async run(input, ctx) {
5176
+ await ctx.desktop().requireCapability('ad-variant-export', 'the ad variant grid and delivery catalog');
5177
+ return ok(await ctx.desktop().get('/agent/timeline/variant-grid', input));
5178
+ },
5179
+ };
5180
+ // Ad variants on one shared body (desktop engine plan E3b; the design heads slate's main/editor/variants.ts).
5181
+ // The desktop's normalizeSeamSetting (slate shared/variantSlots.ts): frames 1 to 600 for j, l and crossfade; a cut takes none.
5182
+ const seamSetting = z.union([
5183
+ z.literal('auto'),
5184
+ z.object({ kind: z.literal('cut'), frames: z.number().optional() }).strict(),
5185
+ z.object({ kind: z.enum(['j', 'l', 'crossfade']), frames: z.number().int().min(1).max(600) }).strict(),
5186
+ ]).describe("'auto' for the automatic pick, { kind: 'cut' }, or { kind, frames } with frames 1 to 600: j (the next slot's sound leads by frames), l (this slot's sound runs on), crossfade (its length).");
5187
+ const variantChoices = z.record(z.string().uuid(), z.string().uuid()).describe('Slot id to alternative id. A slot left out plays its first alternative.');
5188
+ const variantSeams = z.record(z.string().uuid(), seamSetting).describe('Keyed by the slot AFTER the seam.');
5189
+ const getVariantsInput = z.object({
5190
+ projectId: z.string().uuid(),
5191
+ timelineId: z.string().uuid(),
5192
+ grid: z.object({ picks: variantGridPicks.optional(), aspects: variantGridAspects.optional() }).strict().optional()
5193
+ .describe("Add the grid for this pick: {} for every alternative in the cut's formats. Requires variant-grid."),
5194
+ }).strict();
5195
+ export const getVariants = {
5196
+ id: 'slates_get_variants',
5197
+ description: "Read a cut's ad variants: hooks, a shared body and an end card as slots laid end to end, each slot's alternatives (each a timeline: sequenceId, its length), and the variant rows, one alternative per slot, each built into an ordinary timeline (cutId) with its seams (J-cut, L-cut, crossfade or cut, who picked it and why, and what the media held back) and its state: current, edited by hand and left alone, or unbuilt, with behind once its sources changed since its timeline was built. The cut's own lanes are the bed under every variant. Any timeline of the family answers: the cut, a slot's sequence or a variant's timeline. With grid, it adds the grid for a pick of alternatives per slot and of delivery formats: each combination (name, variantId and cutId, null when no row has it yet), files (combinations × formats), the formats offered with their sizes, and missingTakes (shotIds of intended takes the picked alternatives lack; credits, what making them bills in all, the figure to quote; costs, dollars per take request; both null when unpriceable; the grid never generates). Export that pick with slates_export_cuts variants. Reading writes nothing: a behind variant catches up when its timeline is opened (slates_get_timeline) or exported, after any slates_edit_variant_slots or slates_edit_variants call, and on rebuild, which also drops hand edits. Requires ad-variants; update Slates on capability refusal.",
5198
+ billable: false,
5199
+ input: getVariantsInput,
5200
+ async run(input, ctx) {
5201
+ const desktop = ctx.desktop();
5202
+ await desktop.requireCapability('ad-variants', 'ad variants on one shared body');
5203
+ const { grid, ...ids } = input;
5204
+ if (grid === undefined)
5205
+ return ok(await desktop.get('/agent/timeline/variants', ids));
5206
+ await desktop.requireCapability('variant-grid', 'the variant grid: combinations, files and missing takes');
5207
+ return ok(withGridCredits(await desktop.get('/agent/timeline/variants', { ...ids, grid: true,
5208
+ picks: grid.picks === undefined ? undefined : JSON.stringify(grid.picks), aspects: grid.aspects?.join(',') })));
5209
+ },
5210
+ };
5211
+ /** The grid's missing takes in credits. A desktop before slate 9f9b9ea sends only `costs`, dollars per request,
5212
+ * so their credits are summed here, each request rounded alone as it bills. */
5213
+ function withGridCredits(answer) {
5214
+ const takes = answer?.grid?.missingTakes;
5215
+ if (takes && takes.credits === undefined) {
5216
+ takes.credits = Array.isArray(takes.costs) ? takes.costs.reduce((sum, cost) => sum + creditsFromDollars(cost), 0) : null;
5217
+ }
5218
+ return answer;
5219
+ }
5220
+ const variantSlotsInput = z.object({
5221
+ projectId: z.string().uuid(),
5222
+ action: z.enum(['add', 'update', 'remove', 'add-alternative', 'update-alternative', 'remove-alternative']),
5223
+ timelineId: z.string().uuid().optional().describe('The cut: for add, and for add-alternative with slotName instead of slotId.'),
5224
+ slotId: z.string().uuid().optional().describe('For update, remove and add-alternative.'),
5225
+ slotName: z.string().min(1).max(80).optional().describe('add-alternative without slotId: makes this slot first.'),
5226
+ alternativeId: z.string().uuid().optional().describe('For update-alternative and remove-alternative.'),
5227
+ name: z.string().min(1).max(80).optional().describe("A slot's or an alternative's name. Defaults: Hook, Body, End card; '<slot> 1'."),
5228
+ at: z.number().int().min(0).optional().describe('add: the position among the slots.'),
5229
+ orderIndex: z.number().int().min(0).optional().describe('update or update-alternative: move it to this position.'),
5230
+ bedFrame: z.number().int().min(0).nullable().optional().describe("update: the bed frame this slot's first frame meets in every variant (one slot per cut); null clears it."),
5231
+ clipIds: z.array(z.string().uuid()).min(1).optional().describe('add-alternative: move these clips (and their linked sound) off the cut into a new sequence; what stays is the bed.'),
5232
+ sequenceId: z.string().uuid().optional().describe('add-alternative: an existing timeline of this project to hold as it is.'),
5233
+ }).strict();
5234
+ export const editVariantSlots = {
5235
+ id: 'slates_edit_variant_slots',
5236
+ description: "Add, rename, move or remove a cut's ad-variant slots (hook, body, end card: names, never types) and their alternatives, as the Ad variants view in the Inspector does. add-alternative with clipIds collapses those clips off the cut into a new nested sequence, so the body exists once and a fix to it shows in every variant; the first slot made from clips, or one named Body, anchors the bed where its clips sat. Without clipIds or sequenceId it makes an empty sequence to fill with slates_add_clip_to_timeline (its sequenceId is the timelineId). Removing an alternative also removes the variant rows that pick it (removedVariantIds), each with its timeline unless edited by hand; removing a slot drops each row's pick for it. A removed slot's or alternative's own sequence stays, as an ordinary cut. Every unedited variant rebuilds after. Returns the whole set as slates_get_variants does, with the new slotId or alternativeId. Requires ad-variants; update Slates on capability refusal.",
5237
+ billable: false,
5238
+ input: variantSlotsInput,
5239
+ async run(input, ctx) {
5240
+ await ctx.desktop().requireCapability('ad-variants', 'ad variants on one shared body');
5241
+ return ok(await ctx.desktop().post('/agent/timeline/variant-slots', input));
5242
+ },
5243
+ };
5244
+ const variantsInput = z.object({
5245
+ projectId: z.string().uuid(),
5246
+ action: z.enum(['add', 'update', 'remove', 'rebuild']),
5247
+ timelineId: z.string().uuid().optional().describe('add: the cut with the slots.'),
5248
+ variantId: z.string().uuid().optional().describe('update, remove and rebuild.'),
5249
+ combinations: z.boolean().optional().describe("add: one row per combination of the slots' alternatives not already a row."),
5250
+ rows: z.array(z.object({ name: z.string().min(1).max(80).optional(), choices: variantChoices.optional(), seams: variantSeams.optional() }).strict()).optional().describe('add: the rows to add; omit for one row of first alternatives.'),
5251
+ name: z.string().min(1).max(80).optional().describe('update: the row and its timeline take it.'),
5252
+ choices: variantChoices.optional().describe('update: merged into the row.'),
5253
+ seams: variantSeams.optional().describe("update: merged; 'auto' gives a seam back to the automatic pick."),
5254
+ }).strict();
5255
+ export const editVariants = {
5256
+ id: 'slates_edit_variants',
5257
+ description: "Add, change, rebuild or remove ad variant rows on a cut's slots, as the Ad variants view does. Each row picks one alternative per slot and is built into an ordinary timeline (cutId), named for ad export, ready for slates_export_cuts. Seams: the picture always cuts where slots meet; the sound is picked from the transcripts (L-cut when the outgoing line runs past its picture, J-cut when the next slot opens on speech, a short crossfade when both sides have sound on audio lanes, else a cut, a picture cut over the bed with no dialogue), or set by hand per seam; either way held to the media past the cut, with the reason in the result. A row's timeline catches up with its sources when opened, exported or after any slot or row action, unless edited by hand; rebuild takes the sources and drops the hand edits. remove deletes the row and its timeline unless edited by hand. Returns the whole set and the new variantIds. Requires ad-variants; update Slates on capability refusal.",
5258
+ billable: false,
5259
+ input: variantsInput,
5260
+ async run(input, ctx) {
5261
+ await ctx.desktop().requireCapability('ad-variants', 'ad variants on one shared body');
5262
+ return ok(await ctx.desktop().post('/agent/timeline/variants', input));
5263
+ },
5264
+ };
5265
+ export const getRecipe = {
5266
+ id: 'slates_get_recipe', description: 'Find what made an exported ad from its recipe ID, its full ad name or its file name (anything holding __r-<id>). Returns every export that carried the recipe (batch, export time, ad name, files per format, the timeline id and name, its taxonomy); then each clip with its timing and asset and, when generated, the model, prompt, references and key settings frozen at export, and the Shot and board it came from (Shot, board and asset names and labels are read as they are now, not frozen); then any timeline that still renders the recipe. Searches every project unless projectId is given. When nothing matches, notFound says why: exported before ad names carried a recipe ID, or the timeline changed and its export folder is unreachable. Read-only; never generates or spends. Requires recipe-lookup; update Slates on capability refusal.',
5267
+ billable: false,
5268
+ input: z.object({
5269
+ recipe: z.string().min(1).describe('The recipe ID (the characters after __r-), or a whole ad name, file name or path containing __r-<id>.'),
5270
+ projectId: z.string().uuid().optional().describe('Search only this project; omit to search every project.'),
5271
+ }).strict(),
5272
+ async run(input, ctx) {
5273
+ await ctx.desktop().requireCapability('recipe-lookup', 'looking up the recipe behind an exported ad');
5274
+ return ok(await ctx.desktop().get('/agent/timeline/recipe', input));
5275
+ },
5276
+ };
5277
+ const reframeReportInput = z.object({ projectId: z.string().uuid(), timelineId: z.string().uuid(), aspect: deliveryAspectInput, clipId: z.string().uuid().optional() }).strict();
5278
+ export const getReframeReport = {
5279
+ id: 'slates_get_reframe_report', description: 'Inspect effective delivery framing, computed dimensions, kept frame percentage, upscale and stale-take or missing-media warnings for a cut or one clip. Read before reframing; warnings never trigger generation or disable export. Requires ad-variant-export; update Slates on capability refusal.',
5280
+ billable: false,
5281
+ input: reframeReportInput,
5282
+ async run(input, ctx) {
5283
+ await ctx.desktop().requireCapability('ad-variant-export', 'delivery framing reports');
5284
+ return ok(await ctx.desktop().get('/agent/timeline/reframe-report', input));
5285
+ },
5286
+ };
5287
+ const reframeClipInput = reframeReportInput.extend({ clipId: z.string().uuid(), framing: z.object({
5288
+ mode: z.enum(['fill', 'fit']).optional(), focusX: z.number().min(0).max(1).optional(),
5289
+ focusY: z.number().min(0).max(1).optional(), zoom: z.number().min(1).optional(),
5290
+ }).strict().nullable().describe('Normalized focus and zoom for this clip/aspect. Null resets the override; the desktop binds it to the current take.') });
5291
+ export const reframeClip = {
5292
+ id: 'slates_reframe_clip', description: 'Set or reset a clip framing override for one delivery aspect and return the desktop computed framing report. Changes focus, fill/fit and zoom without duplicating the timeline or generating media. Requires ad-variant-export; update Slates on capability refusal.',
5293
+ billable: false,
5294
+ input: reframeClipInput,
5295
+ async run(input, ctx) {
5296
+ await ctx.desktop().requireCapability('ad-variant-export', 'clip delivery reframing');
5297
+ return ok(await ctx.desktop().post('/agent/timeline/reframe', input));
4743
5298
  },
4744
5299
  };
4745
5300
  export const listTimelines = {
4746
- id: 'slates_list_timelines', description: 'List the independent named cuts in a project. Use the selected timelineId for edits, builds and exports.',
5301
+ id: 'slates_list_timelines', description: "List the independent named cuts in a project (not a slot's alternative timelines: slates_get_variants names those). Use the selected timelineId for edits, builds and exports.",
4747
5302
  input: z.object({ projectId: z.string().uuid() }),
4748
5303
  async run(input, ctx) {
4749
5304
  await ctx.desktop().requireCapability('named-cuts', 'named cuts');
@@ -4751,10 +5306,13 @@ export const listTimelines = {
4751
5306
  },
4752
5307
  };
4753
5308
  export const saveTimeline = {
4754
- id: 'slates_save_timeline', description: 'Create a named cut, or rename the explicit timelineId. Existing cuts and the legacy default stay intact.',
4755
- input: z.object({ projectId: z.string().uuid(), timelineId: z.string().uuid().optional(), name: z.string().min(1) }),
5309
+ id: 'slates_save_timeline', description: 'Create a named cut, or rename the explicit timelineId, with optional delivery, naming taxonomy and explicit variant grid bindings. Existing cuts and the legacy default stay intact. New fields require ad-variant-export; null clears them. Read delivery ids and dimensions from slates_get_variant_grid; never infer slot roles from labels.',
5310
+ input: z.object({ projectId: z.string().uuid(), timelineId: z.string().uuid().optional(), name: z.string().min(1), ...cutOptionsInput }),
4756
5311
  async run(input, ctx) {
4757
5312
  await ctx.desktop().requireCapability('named-cuts', 'named cuts');
5313
+ if (input.delivery !== undefined || input.taxonomy !== undefined || input.gridBinding !== undefined) {
5314
+ await ctx.desktop().requireCapability('ad-variant-export', 'cut delivery, naming and grid bindings');
5315
+ }
4758
5316
  return ok(await ctx.desktop().post('/agent/timelines', input));
4759
5317
  },
4760
5318
  };
@@ -4789,9 +5347,63 @@ export const getTimeline = {
4789
5347
  JSON.stringify(r, null, 2));
4790
5348
  },
4791
5349
  };
5350
+ const loudnessInput = z.object({
5351
+ projectId: z.string().uuid(),
5352
+ timelineId: z.string().uuid().optional().describe("The cut to measure; absent: the project's default timeline."),
5353
+ fromSec: z.number().min(0).optional().describe('Measure from here (timeline seconds), as if the span were exported alone.'),
5354
+ toSec: z.number().positive().optional().describe('Measure to here (timeline seconds); absent: the end.'),
5355
+ trackId: z.string().min(1).optional().describe('Read this one lane alone (with the mix); absent: every lane heard.'),
5356
+ });
5357
+ export const getTimelineLoudness = {
5358
+ id: 'slates_get_timeline_loudness',
5359
+ description: "Measure a timeline's loudness as its export writes it: integrated LUFS (gated, ITU-R BS.1770), loudness range (LRA, LU), " +
5360
+ 'true peak (dBTP, read 4x oversampled) and sample peak of the whole mix, the same for each lane alone (every other lane muted), ' +
5361
+ 'and a short-term (3 s) and momentary (400 ms) reading per second in `mix.trace`. Read-only: the desktop renders the sound to a ' +
5362
+ 'temporary file and measures it; nothing is saved and nothing is spent. Check a mix against its bar before exporting: a short for ' +
5363
+ 'social is -14 LUFS integrated with a true peak of -1 dBTP or under (`target` in the answer, shown, never enforced). To move the ' +
5364
+ 'integrated level by D dB, multiply masterVolume by 10^(D/20) with slates_update_timeline_settings, then measure again and check the ' +
5365
+ 'true peak. fromSec and toSec measure one span alone; trackId reads one lane. Null means silence, or a span too short (range and ' +
5366
+ "short-term need 3 s). Same numbers as the Output level popover's Measure. Requires the desktop's loudness capability; update Slates on refusal.",
5367
+ billable: false,
5368
+ input: loudnessInput,
5369
+ async run(input, ctx) {
5370
+ const desktop = ctx.desktop();
5371
+ await desktop.requireCapability('loudness', 'the loudness meter');
5372
+ await requireNamedCut(desktop, input.timelineId);
5373
+ const r = await desktop.get('/agent/timeline/loudness', input);
5374
+ const show = (n, unit) => (n == null ? '-' : `${n} ${unit}`);
5375
+ const lanes = (r.lanes ?? []).map((l) => `${l.name} ${show(l.integratedLufs, 'LUFS')}`).join(', ');
5376
+ return ok(r, `Mix: ${show(r.mix?.integratedLufs, 'LUFS')} integrated, range ${show(r.mix?.loudnessRangeLu, 'LU')}, true peak ${show(r.mix?.truePeakDbtp, 'dBTP')} ` +
5377
+ `(target ${r.target?.integratedLufs ?? '?'} LUFS, ${r.target?.truePeakDbtp ?? '?'} dBTP).${lanes ? ` Lanes: ${lanes}.` : ''}\n\n` +
5378
+ JSON.stringify(r, null, 2));
5379
+ },
5380
+ };
5381
+ // ── Sound to the sample (music edits between frames) ───────────
5382
+ // Mirrors of slate's limits, held equal by lockstep check 12: the rate a sound clip set to the sample counts
5383
+ // its file in (`AUDIO_SOURCE_FPS`, src/shared/clipTiming.ts), the crossfade's millisecond range and curves
5384
+ // (src/shared/transitions.ts) and the export's sound bitrates (src/shared/audioBitrate.ts).
5385
+ const SOUND_SAMPLE_RATE = 48000;
5386
+ const SOUND_CROSSFADE_MS = { min: 1, max: 10000 };
5387
+ const SOUND_CURVES = ['equal-power', 'linear'];
5388
+ const AUDIO_BITRATES = [128, 192, 256, 320];
5389
+ const AUDIO_BITRATE_DEFAULT = 320;
5390
+ const audioBitrateInput = z.union(AUDIO_BITRATES.map((kbps) => z.literal(kbps)));
5391
+ const soundEdgesInput = {
5392
+ startSec: z.number().min(0).optional().describe('Audio lane: where its sound starts on the timeline, in seconds to the sample; it may fall between frames.'),
5393
+ sourceInSec: z.number().min(0).optional().describe('Audio lane: where in its file the sound starts, in seconds, to the sample.'),
5394
+ sourceOutSec: z.number().positive().optional().describe('Audio lane: where in its file the sound ends, in seconds, to the sample.'),
5395
+ sourceInSample: z.number().int().min(0).optional().describe(`The media in as a sample count at ${SOUND_SAMPLE_RATE} Hz, instead of sourceInSec.`),
5396
+ sourceOutSample: z.number().int().positive().optional().describe(`The media out as a sample count at ${SOUND_SAMPLE_RATE} Hz, instead of sourceOutSec.`),
5397
+ };
5398
+ const SOUND_EDGE_FIELDS = Object.keys(soundEdgesInput);
5399
+ const asksSoundEdges = (input) => SOUND_EDGE_FIELDS.some((field) => input[field] !== undefined);
5400
+ /** An older desktop drops the fields and keeps the clip on its frames; this one refuses instead. */
5401
+ async function requireSoundPrecision(desktop) {
5402
+ await desktop.requireCapability('sound-precision', 'sound edges to the sample, millisecond crossfades and the sound bitrate');
5403
+ }
4792
5404
  export const addClipToTimeline = {
4793
5405
  id: 'slates_add_clip_to_timeline',
4794
- description: "Append a video or audio asset from the project to the project's timeline (or place it at an explicit startFrame). Defaults match the desktop UI: video clips go to the end of the first video track; audio clips (music, voiceover, AI audio) go after the last clip on the first AUDIO track and are mixed under the video on export. An empty timeline auto-adopts the first video clip's resolution and frame rate; later higher-resolution clips raise the canvas. Overlapping video clips resolve top-track-wins. Optionally trim with sourceInFrame/sourceOutFrame (frames at the SOURCE fps). Use slates_get_timeline first to see current clips and pick positions.",
5406
+ description: "Append a video or audio asset from the project to the project's timeline (or place it at an explicit startFrame). Defaults match the desktop UI: video clips go to the end of the first video track; audio clips (music, voiceover, AI audio) go after the last clip on the first AUDIO track and are mixed under the video on export. An empty timeline auto-adopts the first video clip's resolution and frame rate; later higher-resolution clips raise the canvas. Overlapping video clips resolve top-track-wins. Optionally trim with sourceInFrame/sourceOutFrame (frames at the SOURCE fps). An audio asset may instead take startSec, sourceInSec and sourceOutSec (or sourceInSample/sourceOutSample) to the sample, for a music edit between frames; with no startSec it starts where the lane's last sound ends, so clips appended in turn butt exactly. Use slates_get_timeline first to see current clips and pick positions. To lay a board's chosen clips in board order, use slates_edit_cut (build) instead.",
4795
5407
  input: z.object({
4796
5408
  projectId: z.string().uuid(), timelineId: z.string().uuid().optional(),
4797
5409
  assetId: z.string().uuid().describe('Video or audio asset already in the project.'),
@@ -4799,11 +5411,18 @@ export const addClipToTimeline = {
4799
5411
  startFrame: z.number().int().min(0).optional().describe('Timeline frame to place the clip at. Default: append after the last clip.'),
4800
5412
  sourceInFrame: z.number().int().min(0).optional(),
4801
5413
  sourceOutFrame: z.number().int().min(1).optional(),
5414
+ ...soundEdgesInput,
4802
5415
  }),
4803
5416
  async run(input, ctx) {
4804
5417
  const desktop = ctx.desktop();
4805
5418
  await desktop.requireCapability('timeline', 'timeline editing');
4806
5419
  await requireNamedCut(desktop, input.timelineId);
5420
+ const precise = asksSoundEdges(input);
5421
+ if (precise && (input.startFrame !== undefined || input.sourceInFrame !== undefined || input.sourceOutFrame !== undefined)) {
5422
+ throw new Error("Send the clip's edges in frames or in seconds and samples, not both.");
5423
+ }
5424
+ if (precise)
5425
+ await requireSoundPrecision(desktop);
4807
5426
  const r = await desktop.post('/agent/timeline/add-clip', {
4808
5427
  projectId: input.projectId, timelineId: input.timelineId,
4809
5428
  assetId: input.assetId,
@@ -4811,6 +5430,7 @@ export const addClipToTimeline = {
4811
5430
  startFrame: input.startFrame,
4812
5431
  sourceInFrame: input.sourceInFrame,
4813
5432
  sourceOutFrame: input.sourceOutFrame,
5433
+ ...Object.fromEntries(SOUND_EDGE_FIELDS.map((field) => [field, input[field]])),
4814
5434
  });
4815
5435
  const clip = r.clip ?? {};
4816
5436
  // Code + label for the chat reference: prefer fields on the clip, fall
@@ -4839,14 +5459,204 @@ export const reorderClips = {
4839
5459
  };
4840
5460
  export const removeClip = {
4841
5461
  id: 'slates_remove_clip',
4842
- description: "Remove a clip from the timeline (the source asset is untouched). Leaves a gap at the clip's old position — MP4 export renders gaps as black; call slates_reorder_clips afterwards to close gaps.",
4843
- input: z.object({ clipId: z.string().uuid() }),
5462
+ description: "Remove a clip from the timeline (the source asset is untouched). By default it leaves a gap at the clip's old position, which MP4 export renders as black. ripple: true closes the gap instead: the lane's later clips move left by the clip's length (needs projectId). An overlay track's text and image clips keep their times, and the gap is just no overlay.",
5463
+ input: z.object({
5464
+ clipId: z.string().uuid(),
5465
+ ripple: z.boolean().optional().describe("Close the gap: the lane's later clips move up. Needs projectId."),
5466
+ projectId: z.string().uuid().optional(),
5467
+ }),
4844
5468
  async run(input, ctx) {
4845
5469
  const desktop = ctx.desktop();
4846
5470
  await desktop.requireCapability('timeline', 'timeline editing');
5471
+ if (input.ripple) {
5472
+ await desktop.requireCapability('timeline-editing', 'ripple delete');
5473
+ if (!input.projectId)
5474
+ throw new Error('ripple needs projectId.');
5475
+ }
4847
5476
  return ok(await desktop.post('/agent/timeline/remove-clip', input));
4848
5477
  },
4849
5478
  };
5479
+ // ── Transitions on cuts (timeline engine plan E2) ──────────────
5480
+ // A cut is two clips that meet on one lane. The kinds are the desktop's (GET /agent/timeline returns
5481
+ // them as transitionKinds), so none is typed here; an unknown kind is refused with the list.
5482
+ const transitionShape = {
5483
+ kind: z.string().optional().describe("A kind from slates_get_timeline's transitionKinds for this lane: picture kinds on video and overlay lanes, sound kinds on audio lanes. Default: a dissolve, or a crossfade on sound."),
5484
+ durationFrames: z.number().int().positive().optional().describe('How long it lasts, in timeline frames. Default 0.5 s, shortened to what the clips allow; a length you name that is too long is refused with the longest that fits.'),
5485
+ durationSec: z.number().positive().optional().describe('The same, in seconds.'),
5486
+ alignment: z.enum(['center', 'start', 'end']).optional().describe('center (default) straddles the cut; start begins at the cut; end finishes at it.'),
5487
+ params: z.record(z.string(), z.unknown()).optional().describe("The kind's settings. freeze: true holds the edge frame where the media runs short. On a picture transition, audio: false stops the clips' sound crossfading with it."),
5488
+ durationMs: z.number().min(SOUND_CROSSFADE_MS.min).max(SOUND_CROSSFADE_MS.max).optional().describe(`Audio lane: the crossfade's length in milliseconds (${SOUND_CROSSFADE_MS.min} to ${SOUND_CROSSFADE_MS.max}), placed to the sample, so it may be shorter than a frame. Instead of durationFrames or durationSec.`),
5489
+ curve: z.enum(SOUND_CURVES).optional().describe("Audio lane: 'equal-power' (default) for two different sounds, 'linear' (straight lines, a triangular crossfade) for a join inside one piece of music."),
5490
+ };
5491
+ export const addTransition = {
5492
+ id: 'slates_add_transition',
5493
+ description: "Put a transition (dissolve, wipe, crossfade and the other kinds) on a cut between two clips that meet on one lane, as the Cut's clip menu does. Name the cut by fromClipId and toClipId, or by one clipId and side ('end' runs this clip into the next, 'start' the last clip into this one). A cut holds one transition, so adding where one exists changes it. It never refuses short media: the result's shortHandles says how many frames are missing and offers the fixes (slates_update_transition fix: freeze or shorten). On an audio lane, durationMs sets a crossfade to the millisecond and curve how the sounds cross: a 10 ms linear crossfade with alignment 'end' joins two cuts of one song as a triangular crossfade does. For a fade to or from black, set the clip's fades with slates_update_clip instead. The open Cut shows the change.",
5494
+ input: z.object({
5495
+ projectId: z.string().uuid(),
5496
+ fromClipId: z.string().uuid().optional().describe('The clip before the cut.'),
5497
+ toClipId: z.string().uuid().optional().describe('The clip after the cut.'),
5498
+ clipId: z.string().uuid().optional().describe('One clip of the cut, with side.'),
5499
+ side: z.enum(['start', 'end']).optional().describe("With clipId: 'end' (default) or 'start'."),
5500
+ ...transitionShape,
5501
+ }),
5502
+ async run(input, ctx) {
5503
+ const desktop = ctx.desktop();
5504
+ await desktop.requireCapability('timeline-transitions', 'transitions');
5505
+ if (!input.fromClipId && !input.toClipId && !input.clipId)
5506
+ throw new Error('Name the cut: fromClipId and toClipId, or clipId with side.');
5507
+ if (input.durationMs !== undefined || input.curve !== undefined)
5508
+ await requireSoundPrecision(desktop);
5509
+ return ok(await desktop.post('/agent/timeline/add-transition', input));
5510
+ },
5511
+ };
5512
+ export const updateTransition = {
5513
+ id: 'slates_update_transition',
5514
+ description: "Change a transition's kind, length, alignment or settings by its id (slates_get_timeline lists them under transitions), or apply one of the two fixes for short media: fix 'freeze' holds the edge frame for the missing frames, fix 'shorten' cuts it to the longest the media covers. Only the fields you name change; on an audio lane durationMs and curve set a crossfade to the millisecond, and a length in frames or seconds replaces one in milliseconds. Returns the transition with its span (durationSec, curve) and any frames still missing.",
5515
+ input: z.object({
5516
+ projectId: z.string().uuid(),
5517
+ transitionId: z.string().uuid(),
5518
+ fix: z.enum(['freeze', 'shorten']).optional().describe('Instead of other fields: the short-media fix.'),
5519
+ ...transitionShape,
5520
+ }),
5521
+ async run(input, ctx) {
5522
+ const desktop = ctx.desktop();
5523
+ await desktop.requireCapability('timeline-transitions', 'transitions');
5524
+ if (input.durationMs !== undefined || input.curve !== undefined)
5525
+ await requireSoundPrecision(desktop);
5526
+ return ok(await desktop.post('/agent/timeline/update-transition', input));
5527
+ },
5528
+ };
5529
+ export const removeTransition = {
5530
+ id: 'slates_remove_transition',
5531
+ description: 'Take a transition off its cut, leaving a plain cut; the clips are untouched. The id is in slates_get_timeline under transitions.',
5532
+ input: z.object({ projectId: z.string().uuid(), transitionId: z.string().uuid() }),
5533
+ async run(input, ctx) {
5534
+ const desktop = ctx.desktop();
5535
+ await desktop.requireCapability('timeline-transitions', 'transitions');
5536
+ return ok(await desktop.post('/agent/timeline/remove-transition', input));
5537
+ },
5538
+ };
5539
+ // ── Editing clips on the timeline (timeline engine plan E3) ────
5540
+ // One tool for the edits that move clip edges and positions; slates_update_clip holds a clip's own
5541
+ // settings. Both run through the same core as the Cut's own tools.
5542
+ export const editTimelineClips = {
5543
+ id: 'slates_edit_timeline_clips',
5544
+ description: "Trim, roll, ripple, slip, move or split clips on the timeline, as the Cut's tools do; the source files are untouched (to cut a new file, use slates_trim_video). trim moves one edge (edge, then frame or deltaFrames): mode overwrite (default) covers a neighbour it grows into, ripple moves the lane's later clips by the change, roll moves the cut shared with the clip that meets this edge. A trim cuts media and never changes speed. slip changes which part of the media a clip shows without moving it (deltaFrames in timeline frames, or deltaSourceFrames in the file's). move takes clipId or clipIds, keeps their spacing, to startFrame or by deltaFrames, optionally onto trackId (a lane of the same type); mode overwrite cuts what they land on, insert pushes the lane's later clips right (a landing inside a clip moves to its nearer edge). split cuts at frame (or sec) every clip under it on the timeline, or only clipIds. Returns the clips it wrote as they now stand, the ids it deleted, the cut's durationFrames and any staleTransitions (whose clips no longer meet); a refused edit says why.",
5545
+ input: z.object({
5546
+ projectId: z.string().uuid(),
5547
+ action: z.enum(['trim', 'slip', 'move', 'split']),
5548
+ clipId: z.string().uuid().optional(),
5549
+ clipIds: z.array(z.string().uuid()).min(1).optional().describe('move or split: several clips of one timeline.'),
5550
+ edge: z.enum(['start', 'end']).optional().describe('trim: which edge.'),
5551
+ frame: z.number().int().min(0).optional().describe('trim: where the edge goes. split: where to cut. Timeline frames.'),
5552
+ sec: z.number().min(0).optional().describe('split: where to cut, in seconds.'),
5553
+ deltaFrames: z.number().int().optional().describe('trim, slip or move: how far, in timeline frames; negative is left (slip: earlier media).'),
5554
+ deltaSourceFrames: z.number().int().optional().describe("slip: how far, in the file's own frames."),
5555
+ startFrame: z.number().int().min(0).optional().describe('move: where the first clip lands.'),
5556
+ trackId: z.string().uuid().optional().describe('move: another lane of the same type.'),
5557
+ timelineId: z.string().uuid().optional().describe("split without clipIds: a named cut; omit for the project's timeline."),
5558
+ mode: z.enum(['overwrite', 'ripple', 'roll', 'insert']).optional().describe('trim: overwrite, ripple or roll. move: overwrite or insert.'),
5559
+ }),
5560
+ async run(input, ctx) {
5561
+ const desktop = ctx.desktop();
5562
+ await desktop.requireCapability('timeline-editing', 'editing clips on the timeline');
5563
+ const { action, ...body } = input;
5564
+ if ((action === 'trim' || action === 'slip') && !input.clipId)
5565
+ throw new Error(`${action} needs a clipId.`);
5566
+ if (action === 'trim' && !input.edge)
5567
+ throw new Error("trim needs an edge: 'start' or 'end'.");
5568
+ if (action === 'move' && !input.clipId && !input.clipIds)
5569
+ throw new Error('move needs clipId or clipIds.');
5570
+ if (action === 'split' && input.frame === undefined && input.sec === undefined)
5571
+ throw new Error('split needs a frame or sec.');
5572
+ if (action === 'trim')
5573
+ return ok(await desktop.post('/agent/timeline/trim-clip', body));
5574
+ if (action === 'slip')
5575
+ return ok(await desktop.post('/agent/timeline/slip-clip', body));
5576
+ if (action === 'move')
5577
+ return ok(await desktop.post('/agent/timeline/move-clip', body));
5578
+ return ok(await desktop.post('/agent/timeline/split-clip', body));
5579
+ },
5580
+ };
5581
+ const keyframeEasing = z.union([
5582
+ z.enum(['linear', 'ease', 'ease-in', 'ease-out', 'ease-in-out', 'hold']),
5583
+ z.object({ cubicBezier: z.tuple([z.number().min(0).max(1), z.number(), z.number().min(0).max(1), z.number()]) }).strict(),
5584
+ ]);
5585
+ const keyframeKeys = z.array(z
5586
+ .object({
5587
+ frame: z.number().finite().min(0).describe("Frames from the clip's start, at the timeline's frame rate; may fall between frames, read at that exact time (110.4 is 4.6 s at 24 fps)."),
5588
+ value: z.number().finite(),
5589
+ easing: keyframeEasing.optional().describe('The curve from this key to the next. Default linear; hold jumps at the next key.'),
5590
+ })
5591
+ .strict());
5592
+ const keyframeList = keyframeKeys.max(500);
5593
+ /** Any key off a whole frame, in any of these key lists or effect lists' keys. */
5594
+ function keysBetweenFrames(...lists) {
5595
+ return lists.some((list) => (list ?? []).some((item) => 'frame' in item ? !Number.isInteger(item.frame) : Object.values(item.keyframes ?? {}).some((keys) => keys.some((k) => !Number.isInteger(k.frame)))));
5596
+ }
5597
+ /** An older desktop refuses a key that is not a whole frame; ask first, so the refusal names the update. */
5598
+ async function requireKeysBetweenFrames(desktop, ...lists) {
5599
+ if (keysBetweenFrames(...lists))
5600
+ await desktop.requireCapability('keys-between-frames', 'keys between frames (a frame such as 110.4)');
5601
+ }
5602
+ /** An effect list as the desktop stores it (`slate/src/shared/audioEffects.ts`); slates_get_timeline's audioEffects lists each type's parameters and ranges. */
5603
+ const audioEffectList = z
5604
+ .array(z
5605
+ .object({
5606
+ id: z.string().max(64).optional().describe('Kept when sent back; a new effect gets one.'),
5607
+ type: z.enum(['volume', 'eq']).describe("volume: gain in dB (param gainDb, -60 silent to +12). eq: its low-pass (params 'lowpass.frequency' in Hz, 20 to 20000, swept by octave; 'lowpass.q', 0.1 to 10, 0.71 flat)."),
5608
+ bypass: z.boolean().optional(),
5609
+ params: z.record(z.number()).optional().describe('Fixed values by parameter name.'),
5610
+ keyframes: z.record(keyframeKeys.max(4000)).optional().describe('Keys by parameter name; a keyed parameter reads its keys instead of its fixed value.'),
5611
+ })
5612
+ .strict())
5613
+ .max(16);
5614
+ export const updateClip = {
5615
+ id: 'slates_update_clip',
5616
+ description: "Set a timeline clip's own speed, volume, split edit (J-cut or L-cut) and fades, as the Cut's Inspector does. Only the fields you name change; null puts one back to the default. speed keeps the clip's media in and out points and its start and changes its length (2 is twice as fast, half as long); with ripple: true the lane's later clips move by the change, otherwise a longer clip covers what follows. audioOffsetFrames, on a video clip, moves its own sound against its picture in sync: below 0 is a J-cut (the sound starts first), above 0 an L-cut (it runs on). Fades are frames: fadeIn/fadeOut for the picture, audioFadeIn/audioFadeOut for the sound. volume is linear gain (1 = 0 dB, 0 = silent). look, on a clip with a picture, is the Inspector's Blend, Grain and Colour, sent whole: blend mixes the picture with what is under it (multiply darkens, screen lightens, overlay and soft-light add contrast), grain is film grain from 0 to 1, saturation is colour from 0 (black and white) through 1 (as shot) to 2; null clears the look. effects is the clip's sound effects, sent whole, in order: a volume (gain in dB) and an eq (its low-pass), each fixed or keyed in frames from the clip's start, the same in preview and export. speedRamp keys the speed over the clip (a slow-motion ramp): media in and out stay, the length becomes what the keys take, and the sound follows tape-style; not with speed. speedSound 'tape' makes a constant speed's sound change pitch with it. On an audio lane, startSec, sourceInSec and sourceOutSec (or sourceInSample and sourceOutSample) set where its sound starts and its media in and out to the sample, for a music edit between frames; a longer clip covers what follows unless ripple; not with speed in the same call.",
5617
+ input: z.object({
5618
+ projectId: z.string().uuid(),
5619
+ clipId: z.string().uuid(),
5620
+ speed: z.number().positive().nullable().optional().describe('1 is normal speed; null is too, at the natural length of the clip.'),
5621
+ volume: z.number().min(0).nullable().optional().describe('Linear gain under the lane fader; 1 is unchanged.'),
5622
+ audioOffsetFrames: z.number().int().nullable().optional().describe('Video clips: the split edit, in timeline frames.'),
5623
+ fadeInFrames: z.number().int().min(0).nullable().optional(),
5624
+ fadeOutFrames: z.number().int().min(0).nullable().optional(),
5625
+ audioFadeInFrames: z.number().int().min(0).nullable().optional(),
5626
+ audioFadeOutFrames: z.number().int().min(0).nullable().optional(),
5627
+ look: z.object({
5628
+ blend: z.enum(['normal', 'multiply', 'screen', 'overlay', 'soft-light']).optional(),
5629
+ grain: z.number().min(0).max(1).optional(),
5630
+ saturation: z.number().min(0).max(2).optional(),
5631
+ }).strict().nullable().optional().describe('The whole look, at least one field; a field left out is its default (normal, no grain, colour 1). null clears it.'),
5632
+ effects: audioEffectList.nullable().optional().describe("A clip with sound: its effect list, sent whole; null clears it. A split picture's go to its sound clip."),
5633
+ speedRamp: keyframeKeys.max(4000).nullable().optional().describe("Speeds (0.05 to 20) keyed in frames from the clip's start; null goes back to one speed. Its linked sound follows."),
5634
+ speedSound: z.enum(['tape', 'keep-pitch']).nullable().optional().describe("How a constant speed's sound plays: tape moves pitch with speed; keep-pitch (or null) holds it. A ramp's is always tape."),
5635
+ ripple: z.boolean().optional().describe("With speed, speedRamp or a sound clip's new media out: move the lane's later clips instead of covering them."),
5636
+ ...soundEdgesInput,
5637
+ }),
5638
+ async run(input, ctx) {
5639
+ const desktop = ctx.desktop();
5640
+ await desktop.requireCapability('timeline-editing', "a clip's speed, volume, split edit and fades");
5641
+ if (input.speed !== undefined && input.speedRamp !== undefined)
5642
+ throw new Error('Send speed (one speed) or speedRamp (keyed), not both.');
5643
+ if (input.effects !== undefined || input.speedRamp !== undefined || input.speedSound !== undefined) {
5644
+ await desktop.requireCapability('audio-effects', 'audio effects and speed ramps');
5645
+ await requireKeysBetweenFrames(desktop, input.speedRamp, input.effects);
5646
+ }
5647
+ // An empty look would clear the clip's look without saying so; null is how to ask for that.
5648
+ if (input.look && Object.keys(input.look).length === 0)
5649
+ throw new Error('look needs at least one of blend, grain or saturation; send look: null to clear it');
5650
+ if (input.look !== undefined)
5651
+ await desktop.requireCapability('clip-look', "a clip's blend, grain and colour");
5652
+ if (asksSoundEdges(input)) {
5653
+ if (input.speed !== undefined || input.speedRamp !== undefined)
5654
+ throw new Error("Set a clip's speed and its edges in seconds or samples in two calls.");
5655
+ await requireSoundPrecision(desktop);
5656
+ }
5657
+ return ok(await desktop.post('/agent/timeline/update-clip', input));
5658
+ },
5659
+ };
4850
5660
  export const manageTimelineMarker = {
4851
5661
  id: 'slates_manage_timeline_marker',
4852
5662
  description: "Add, change or delete a marker on the timeline, as the Cut's ruler and marker menus do (slates_get_timeline lists them under timeline.markers). create: frame, optional name and color. update: markerId plus any of frame, name, color. delete: markerId. The color is one of the app's marker colours by name (e.g. Red); any other is refused with the list. The open Cut shows the change.",
@@ -4871,22 +5681,423 @@ export const manageTimelineMarker = {
4871
5681
  };
4872
5682
  export const addTimelineTrack = {
4873
5683
  id: 'slates_add_timeline_track',
4874
- description: "Add a track to the project's timeline (default: an audio track, for layering voiceover + music + AI audio). The new track is appended below existing tracks. Returns the new track and the full timeline.",
5684
+ description: "Add a track to the project's timeline (default: an audio track, for layering voiceover + music + AI audio). A video or audio track is appended below the existing tracks; an overlay track, for text and image overlays, goes on top so it draws over every other track. Returns the new track and the full timeline.",
4875
5685
  input: z.object({
4876
5686
  projectId: z.string().uuid(), timelineId: z.string().uuid().optional(),
4877
- type: z.enum(['video', 'audio']).optional().describe('Default: audio.'),
4878
- name: z.string().optional().describe("Default: 'Audio N' / 'Video N'."),
5687
+ type: z.enum(['video', 'audio', 'overlay']).optional().describe('Default: audio. overlay needs a desktop with text and image overlays.'),
5688
+ name: z.string().optional().describe("Default: 'Audio N', 'Video N' or 'Overlay N'."),
4879
5689
  }),
4880
5690
  async run(input, ctx) {
4881
5691
  const desktop = ctx.desktop();
4882
5692
  await desktop.requireCapability('timeline-tracks', 'timeline tracks + audio mixing');
5693
+ if (input.type === 'overlay')
5694
+ await desktop.requireCapability('timeline-overlays', 'text and image overlays');
4883
5695
  await requireNamedCut(desktop, input.timelineId);
4884
5696
  return ok(await desktop.post('/agent/timeline/add-track', input));
4885
5697
  },
4886
5698
  };
5699
+ // Text and image overlays (slate's finished-ads plan, L1). The look's lists, limits, ranges and defaults
5700
+ // mirror slate's `src/shared/textStyles.ts`, `src/shared/overlays.ts` and `src/main/editor/overlays.ts`,
5701
+ // and the batch cap slate's `src/main/agent/routes-editor.ts`, which this package cannot import;
5702
+ // lockstep check 12 fails when they differ. The 0..1 position and
5703
+ // opacity are fractions by definition, not a desktop choice.
5704
+ const TEXT_STYLE_IDS = ['word-pop', 'keyword', 'subtitle', 'headline', 'clean', 'plain'];
5705
+ // A text clip set exactly (slate 1.6.x, capability text-fonts): the fonts Slates carries, the exact size,
5706
+ // the picture before the words and a line of clips, mirrored from slate's `src/shared/textStyles.ts` and
5707
+ // `src/shared/overlays.ts` like the rest (lockstep check 12).
5708
+ const TEXT_FONT_IDS = ['bebas-neue', 'montserrat-medium', 'montserrat-bold', 'montserrat-extrabold', 'montserrat-black',
5709
+ 'geist-regular', 'geist-medium', 'geist-semibold', 'geist-bold'];
5710
+ const TEXT_FONT_SIZE_RANGE = { min: 0.005, max: 0.5 };
5711
+ const TEXT_PICTURE_HEIGHT_RANGE = { min: 0.1, max: 5 };
5712
+ const TEXT_PICTURE_GAP_RANGE = { min: 0, max: 2 };
5713
+ const TEXT_LINE_GAP_RANGE = { min: 0, max: 4 };
5714
+ const TEXT_LINE_NAME_MAX = 40;
5715
+ const TEXT_LINE_PLACE_MAX = 99;
5716
+ const TEXT_STYLE_DEFAULT = 'subtitle';
5717
+ const OVERLAY_TEXT_MAX = 2000;
5718
+ const OVERLAY_WORDS_MAX = 2000;
5719
+ const OVERLAY_WORD_TEXT_MAX = 200;
5720
+ const OVERLAY_SIZE_RANGE = { min: 0.25, max: 4 };
5721
+ const OVERLAY_WIDTH_RANGE = { min: 0.01, max: 1 };
5722
+ const OVERLAY_DEFAULT_SECONDS = 3;
5723
+ const OVERLAY_BATCH_MAX = 500;
5724
+ /** Text the desktop accepts: not blank (it trims before checking), at most `max` characters. A pattern, not a refine, so the JSON schema a host checks says it too. */
5725
+ const overlayText = (max) => z.string().max(max).regex(/\S/, 'must not be blank');
5726
+ const overlayPlacementInput = {
5727
+ startSec: z.number().min(0).optional().describe('Where the clip starts, in timeline seconds. startSec or startFrame is required, not both.'),
5728
+ startFrame: z.number().int().min(0).optional().describe('Where the clip starts, in timeline frames.'),
5729
+ durationSec: z.number().positive().optional().describe(`How long it shows, in seconds. Default: ${OVERLAY_DEFAULT_SECONDS}.`),
5730
+ endFrame: z.number().int().min(1).optional().describe('The frame it ends before, instead of durationSec.'),
5731
+ trackId: z.string().uuid().optional().describe('An overlay track (slates_add_timeline_track, type overlay). Default: the topmost unlocked, shown overlay track with room, or a new one on top.'),
5732
+ };
5733
+ const overlayPositionInput = {
5734
+ x: z.number().min(0).max(1).optional().describe("The centre's distance from the left edge, as a fraction of the frame's width."),
5735
+ y: z.number().min(0).max(1).optional().describe("The centre's distance from the top edge, as a fraction of the frame's height."),
5736
+ };
5737
+ const textSizeInput = z
5738
+ .number().min(OVERLAY_SIZE_RANGE.min).max(OVERLAY_SIZE_RANGE.max)
5739
+ .describe(`A multiple of the style's text size, ${OVERLAY_SIZE_RANGE.min} to ${OVERLAY_SIZE_RANGE.max}; 1 is the style's own.`);
5740
+ const imageWidthInput = z
5741
+ .number().min(OVERLAY_WIDTH_RANGE.min).max(OVERLAY_WIDTH_RANGE.max)
5742
+ .describe(`Its width as a fraction of the frame's width, ${OVERLAY_WIDTH_RANGE.min} to ${OVERLAY_WIDTH_RANGE.max}; the height follows the picture.`);
5743
+ const textLookInput = {
5744
+ style: z.enum(TEXT_STYLE_IDS).optional().describe(`Default: ${TEXT_STYLE_DEFAULT}. word-pop lights up the spoken word when the clip has words.`),
5745
+ ...overlayPositionInput,
5746
+ size: textSizeInput.optional(),
5747
+ color: z.string().regex(/^#[0-9a-fA-F]{6}$/).optional().describe('The text colour as #rrggbb. Default: the style\'s.'),
5748
+ };
5749
+ /** The fields of a text clip set exactly; each is checked by the desktop again. */
5750
+ const textSetInput = {
5751
+ font: z.enum(TEXT_FONT_IDS).describe("A font Slates carries, drawn the same in preview and export on any machine. Default: the style's font."),
5752
+ fontSize: z.number().min(TEXT_FONT_SIZE_RANGE.min).max(TEXT_FONT_SIZE_RANGE.max)
5753
+ .describe("The exact size as a fraction of the frame's height (72 px on a 1920-high frame is 0.0375); replaces size."),
5754
+ pictureAssetId: z.string().min(1).describe('An image asset in the project (code IMG-A12 or id) drawn before the words, centred on them.'),
5755
+ pictureHeight: z.number().min(TEXT_PICTURE_HEIGHT_RANGE.min).max(TEXT_PICTURE_HEIGHT_RANGE.max)
5756
+ .describe("The picture's height as a multiple of the font size. Default: the capitals' height."),
5757
+ pictureGap: z.number().min(TEXT_PICTURE_GAP_RANGE.min).max(TEXT_PICTURE_GAP_RANGE.max)
5758
+ .describe('The space after the picture, a multiple of the font size. Default: 0.25.'),
5759
+ line: z
5760
+ .object({
5761
+ name: z.string().max(TEXT_LINE_NAME_MAX).regex(/\S/, 'must not be blank'),
5762
+ place: z.number().int().min(0).max(TEXT_LINE_PLACE_MAX).optional().describe('Left to right, lowest first. Default: 0; a tie keeps the lower lane first.'),
5763
+ })
5764
+ .strict()
5765
+ .describe("Text clips on screen together with one line name are set side by side, centred as one on the first clip's x and y."),
5766
+ gap: z.number().min(TEXT_LINE_GAP_RANGE.min).max(TEXT_LINE_GAP_RANGE.max)
5767
+ .describe('In a line: the space before this clip, a multiple of its font size. Default: 0.25.'),
5768
+ };
5769
+ const TEXT_SET_FIELDS = Object.keys(textSetInput);
5770
+ /** The plain style came with text-fonts (slate 22f76ea), so a desktop without the token lacks it. */
5771
+ const TEXT_FONTS_STYLE = 'plain';
5772
+ /**
5773
+ * Items setting a text clip exactly, or in the plain style, need a desktop that takes them (an older one
5774
+ * would drop the fields and draw in the style's font, or not know the style), and their pictures named by
5775
+ * code become asset ids.
5776
+ */
5777
+ async function textSetItems(ctx, desktop, projectId, items) {
5778
+ const needsFonts = (item) => item.style === TEXT_FONTS_STYLE
5779
+ || TEXT_SET_FIELDS.some((field) => item[field] !== undefined);
5780
+ if (!items.some(needsFonts))
5781
+ return items;
5782
+ await desktop.requireCapability('text-fonts', 'bundled fonts, exact sizes, pictures and lines on text clips');
5783
+ const named = items.flatMap((item) => (typeof item.pictureAssetId === 'string' ? [item.pictureAssetId] : []));
5784
+ if (named.length === 0)
5785
+ return items;
5786
+ const refs = await resolveAssetRefs(ctx, projectId, named);
5787
+ return items.map((item, i) => {
5788
+ if (typeof item.pictureAssetId !== 'string')
5789
+ return item;
5790
+ const asset = refs.get(item.pictureAssetId);
5791
+ if (!asset)
5792
+ throw new Error(`items[${i}].pictureAssetId "${item.pictureAssetId}" is not an asset in this project (slates_list_assets).`);
5793
+ return { ...item, pictureAssetId: asset.id };
5794
+ });
5795
+ }
5796
+ const overlayWordsInput = z
5797
+ .array(z
5798
+ .object({ text: overlayText(OVERLAY_WORD_TEXT_MAX), start: z.number().min(0), end: z.number().min(0) })
5799
+ .strict()
5800
+ .refine((w) => w.end > w.start, { message: 'end must be after start' }))
5801
+ .max(OVERLAY_WORDS_MAX)
5802
+ .describe("Word timings in timeline seconds, for captions that follow the voice; each word's end comes after its start.");
5803
+ /** An item must start once: startSec or startFrame, and end at most once: durationSec or endFrame. Refused here, naming it. */
5804
+ function requireOverlayStart(items) {
5805
+ items.forEach((item, i) => {
5806
+ if (item.startSec === undefined && item.startFrame === undefined)
5807
+ throw new Error(`items[${i}] needs startSec or startFrame.`);
5808
+ if (item.startSec !== undefined && item.startFrame !== undefined)
5809
+ throw new Error(`items[${i}]: give startSec or startFrame, not both.`);
5810
+ if (item.durationSec !== undefined && item.endFrame !== undefined)
5811
+ throw new Error(`items[${i}]: give durationSec or endFrame, not both.`);
5812
+ });
5813
+ }
5814
+ const overlayCount = (r, what) => {
5815
+ const n = r.clips?.length ?? 0;
5816
+ return `Added ${n} ${what}${n === 1 ? '' : 's'}.`;
5817
+ };
5818
+ export const addTextClip = {
5819
+ id: 'slates_add_text_clip',
5820
+ description: "Put text on the timeline: captions, a headline, a keyword, a call to action, a title-card label, a logo with words. Each item is one text clip on an overlay track, drawn over the video in preview and export; a batch lands in one transaction, all or none. Captions that follow the voice: one clip per line, with each word's timing in words. Set a label exactly with font (a font Slates carries) and fontSize (a fraction of the frame's height); it then centres the middle of its capitals on x, y. pictureAssetId draws an image before the words; clips sharing a line name are set side by side and centred as one, so a logo strip such as 'Blender + slates' is three items in one line (needs text-fonts; update Slates on refusal). Read slates_get_timeline first for the frame rate, where clips sit and textFonts. Returns the clips and the timeline. Change one later with slates_update_overlay_clip, remove it with slates_remove_clip.",
5821
+ input: z.object({
5822
+ projectId: z.string().uuid(), timelineId: z.string().uuid().optional(),
5823
+ items: z
5824
+ .array(z
5825
+ .object({
5826
+ text: overlayText(OVERLAY_TEXT_MAX).describe('What it says.'),
5827
+ words: overlayWordsInput.optional(),
5828
+ ...textLookInput,
5829
+ font: textSetInput.font.optional(),
5830
+ fontSize: textSetInput.fontSize.optional(),
5831
+ pictureAssetId: textSetInput.pictureAssetId.optional(),
5832
+ pictureHeight: textSetInput.pictureHeight.optional(),
5833
+ pictureGap: textSetInput.pictureGap.optional(),
5834
+ line: textSetInput.line.optional(),
5835
+ gap: textSetInput.gap.optional(),
5836
+ ...overlayPlacementInput,
5837
+ })
5838
+ .strict())
5839
+ .min(1)
5840
+ .max(OVERLAY_BATCH_MAX),
5841
+ }),
5842
+ async run(input, ctx) {
5843
+ const desktop = ctx.desktop();
5844
+ await desktop.requireCapability('timeline-overlays', 'text and image overlays');
5845
+ await requireNamedCut(desktop, input.timelineId);
5846
+ requireOverlayStart(input.items);
5847
+ const items = await textSetItems(ctx, desktop, input.projectId, input.items);
5848
+ const r = await desktop.post('/agent/timeline/add-text', { ...input, items });
5849
+ return ok(r, `${overlayCount(r, 'text clip')} ${JSON.stringify(r)}`);
5850
+ },
5851
+ };
5852
+ export const addImageOverlay = {
5853
+ id: 'slates_add_image_overlay',
5854
+ description: "Put a picture over the video on the timeline: a logo, a product shot, an end card, a badge. Each item is one image clip on an overlay track, drawn in preview and export; a batch lands in one transaction, all or none. The picture is an image asset already in the project. Returns the clips and the timeline. Change one later with slates_update_overlay_clip, remove it with slates_remove_clip.",
5855
+ input: z.object({
5856
+ projectId: z.string().uuid(), timelineId: z.string().uuid().optional(),
5857
+ items: z
5858
+ .array(z
5859
+ .object({
5860
+ assetId: z.string().min(1).describe('An image asset in the project: its code (IMG-A12) or id.'),
5861
+ ...overlayPositionInput,
5862
+ width: imageWidthInput.optional().describe(`${imageWidthInput.description} Default: half.`),
5863
+ opacity: z.number().min(0).max(1).optional().describe('Default: 1, fully opaque.'),
5864
+ ...overlayPlacementInput,
5865
+ })
5866
+ .strict())
5867
+ .min(1)
5868
+ .max(OVERLAY_BATCH_MAX),
5869
+ }),
5870
+ async run(input, ctx) {
5871
+ const desktop = ctx.desktop();
5872
+ await desktop.requireCapability('timeline-overlays', 'text and image overlays');
5873
+ await requireNamedCut(desktop, input.timelineId);
5874
+ requireOverlayStart(input.items);
5875
+ const refs = await resolveAssetRefs(ctx, input.projectId, input.items.map((item) => item.assetId));
5876
+ const items = input.items.map((item, i) => {
5877
+ const asset = refs.get(item.assetId);
5878
+ if (!asset)
5879
+ throw new Error(`items[${i}].assetId "${item.assetId}" is not an asset in this project (slates_list_assets).`);
5880
+ return { ...item, assetId: asset.id };
5881
+ });
5882
+ const r = await desktop.post('/agent/timeline/add-image-overlay', { ...input, items });
5883
+ return ok(r, `${overlayCount(r, 'image overlay')} ${JSON.stringify(r)}`);
5884
+ },
5885
+ };
5886
+ export const updateOverlayClip = {
5887
+ id: 'slates_update_overlay_clip',
5888
+ description: "Change a text clip's words or look, or an image overlay's place, size and opacity. Only the fields you name change; null puts one back to the style's or the default. A text clip also takes font, fontSize, pictureAssetId (null takes the picture away), pictureHeight, pictureGap, line and gap, as slates_add_text_clip describes (needs text-fonts); in a line, x and y are read from its first clip. words replaces a text clip's timings, and [] drops them; new text keeps the old timings, so send words with it. When the clip shows does not change here: to move one, remove it (slates_remove_clip) and add it again. A batch lands in one transaction, all or none. Returns the changed clips.",
5889
+ input: z.object({
5890
+ projectId: z.string().uuid(),
5891
+ items: z
5892
+ .array(z
5893
+ .object({
5894
+ clipId: z.string().uuid().describe('A text or image clip (slates_get_timeline).'),
5895
+ text: overlayText(OVERLAY_TEXT_MAX).optional().describe('Text clips: what it says.'),
5896
+ words: overlayWordsInput.optional(),
5897
+ style: z.enum(TEXT_STYLE_IDS).nullable().optional().describe(`Text clips. null: ${TEXT_STYLE_DEFAULT}.`),
5898
+ x: z.number().min(0).max(1).nullable().optional().describe("The centre's distance from the left edge, as a fraction of the frame's width."),
5899
+ y: z.number().min(0).max(1).nullable().optional().describe("The centre's distance from the top edge, as a fraction of the frame's height."),
5900
+ size: textSizeInput.nullable().optional().describe(`Text clips: ${textSizeInput.description}`),
5901
+ color: z.string().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional().describe('Text clips: #rrggbb.'),
5902
+ width: imageWidthInput.nullable().optional().describe(`Image clips: ${imageWidthInput.description}`),
5903
+ opacity: z.number().min(0).max(1).nullable().optional().describe('Image clips.'),
5904
+ font: textSetInput.font.nullable().optional(),
5905
+ fontSize: textSetInput.fontSize.nullable().optional(),
5906
+ pictureAssetId: textSetInput.pictureAssetId.nullable().optional().describe(`${textSetInput.pictureAssetId.description} null: none.`),
5907
+ pictureHeight: textSetInput.pictureHeight.nullable().optional(),
5908
+ pictureGap: textSetInput.pictureGap.nullable().optional(),
5909
+ line: textSetInput.line.nullable().optional().describe(`${textSetInput.line.description} null: out of the line.`),
5910
+ gap: textSetInput.gap.nullable().optional(),
5911
+ })
5912
+ .strict()
5913
+ .refine((item) => Object.keys(item).some((k) => k !== 'clipId'), { message: 'name at least one field to change besides clipId' }))
5914
+ .min(1)
5915
+ .max(OVERLAY_BATCH_MAX),
5916
+ }),
5917
+ async run(input, ctx) {
5918
+ const desktop = ctx.desktop();
5919
+ await desktop.requireCapability('timeline-overlays', 'text and image overlays');
5920
+ const items = await textSetItems(ctx, desktop, input.projectId, input.items);
5921
+ return ok(await desktop.post('/agent/timeline/update-overlay', { ...input, items }));
5922
+ },
5923
+ };
5924
+ const KEYFRAME_PROPERTY_IDS = ['positionX', 'positionY', 'scale', 'rotation', 'opacity', 'cropLeft', 'cropTop', 'cropRight', 'cropBottom', 'focusX', 'focusY', 'zoom'];
5925
+ export const setClipKeyframes = {
5926
+ id: 'slates_set_clip_keyframes',
5927
+ description: "Animate or set a timeline clip's transform with keyframes: a punch-in, a slow push, a Ken Burns move, a slide, a spin, a fade, a crop. Each property you name gets exactly the keys you send ([] clears it back to its static value); properties you leave out keep theirs, and all of them land in one transaction. One key holds a value for the whole clip. Frames count from the clip's start and may fall between frames (110.4), read at that exact time. Units: positionX/positionY move the picture's centre in frame widths/heights (0.1 = a tenth of the frame right or down, -4..4); scale multiplies the framed size about the frame's centre (1 = as framed, 0.01..20); rotation is degrees clockwise; opacity 0..1; cropLeft/Top/Right/Bottom remove that fraction of the source from its side (0..0.99); focusX/focusY (0..1) and zoom (1..20) animate the clip's reframe for the aspect being exported. Drawn by the Cut's monitor and its export alike, both the timeline engine. Returns the clip's keys; slates_get_timeline lists every clip's keys in timeline.keyframes. Requires timeline-keyframes; update Slates on capability refusal.",
5928
+ input: z.object({
5929
+ projectId: z.string().uuid(),
5930
+ timelineId: z.string().uuid(),
5931
+ clipId: z.string().uuid().describe('A clip on that timeline (slates_get_timeline).'),
5932
+ properties: z
5933
+ .object(Object.fromEntries(KEYFRAME_PROPERTY_IDS.map((id) => [id, keyframeList.optional()])))
5934
+ .strict()
5935
+ .refine((p) => Object.keys(p).length > 0, { message: 'name at least one property' })
5936
+ .describe('Each property to set, with its keys. Example punch-in over one second at 24 fps: {"scale":[{"frame":0,"value":1,"easing":"ease-in-out"},{"frame":24,"value":1.25}]}.'),
5937
+ }),
5938
+ async run(input, ctx) {
5939
+ const desktop = ctx.desktop();
5940
+ await desktop.requireCapability('timeline-keyframes', 'clip keyframes');
5941
+ await requireKeysBetweenFrames(desktop, ...Object.values(input.properties));
5942
+ return ok(await desktop.post('/agent/timeline/keyframes', input));
5943
+ },
5944
+ };
5945
+ // Captions (slate's finished-ads plan L2) and HTML layers (the engine plan's E4). The caption default,
5946
+ // the emphasis tiers and the registry's item types mirror slate's `src/main/transcription/captions.ts`,
5947
+ // `src/shared/captionBuild.ts` and `src/main/layers/registry.ts`; lockstep check 12 fails when they differ.
5948
+ const CAPTION_STYLE_DEFAULT = 'word-pop';
5949
+ const CAPTION_TIERS = ['regular', 'italic', 'emphasis', 'slam'];
5950
+ const MOTION_REGISTRY_TYPES = ['block', 'component', 'example'];
5951
+ /** Mirrors slate's src/main/layers/captionComponents.ts: the caption-* components checked to draw fed words. */
5952
+ const CAPTION_COMPONENTS = [
5953
+ 'caption-highlight', 'caption-pill-karaoke', 'caption-weight-shift', 'caption-glitch-rgb', 'caption-neon-glow',
5954
+ 'caption-gradient-fill', 'caption-kinetic-slam', 'caption-clip-wipe', 'caption-matrix-decode', 'caption-particle-burst',
5955
+ 'caption-neon-accent', 'caption-editorial-emphasis',
5956
+ ];
5957
+ const htmlCompositionInput = z.string().min(1).describe('A composition: a whole HTML document whose GSAP timeline is registered on window.__timelines.');
5958
+ const htmlVariablesInput = z.record(z.union([z.string(), z.number(), z.boolean()])).describe("Values for the composition's or block's declared variables, by name: text, numbers or true/false.");
5959
+ export const addCaptions = {
5960
+ id: 'slates_add_captions',
5961
+ billable: false,
5962
+ description: "Caption the speech in a cut: one text clip per phrase on an overlay track, each carrying its words so the spoken word lights up on the frame it is said. Free; any transcription it needs runs on the user's machine. source transcript (the default) uses the words heard in each clip, aligned to within a frame, transcribing first when needed; script spreads the clip's Shot line over the speech, with estimated timing; words takes your own timed words in timeline seconds. By default every clip with sound is captioned on a new Captions track on top. Phrases follow the caption rules unless you pass your own; tiers mark emphasis per word. The result lists mismatches, where what was heard differs from the Shot's written line (the caption shows what was said: fix the line or the captions), and skipped clips with the reason. Craft: slates_get_prompting_guide (topic: slates-captions). Change a text caption later with slates_update_overlay_clip, and a component or html caption layer with slates_update_html_clip.",
5963
+ input: z
5964
+ .object({
5965
+ projectId: z.string().uuid(),
5966
+ timelineId: z.string().uuid().describe('The cut (slates_get_timeline or slates_list_timelines).'),
5967
+ clipIds: z.array(z.string().uuid()).min(1).optional().describe('Video or audio clips whose speech to caption. Default with transcript: every clip with sound.'),
5968
+ source: z.enum(['transcript', 'script', 'words']).optional().describe('Default: words when you pass words, else transcript.'),
5969
+ words: overlayWordsInput.min(1).optional().describe('With source words: the words and their times in timeline seconds.'),
5970
+ style: z.enum(TEXT_STYLE_IDS).optional().describe(`Default: ${CAPTION_STYLE_DEFAULT}, which lights up the spoken word.`),
5971
+ phrases: z
5972
+ .array(z.tuple([z.number().int().min(0), z.number().int().min(1)]))
5973
+ .min(1)
5974
+ .optional()
5975
+ .describe("Your own phrases as [from, to) word index ranges, in order and not overlapping: from is the phrase's first word, to is one past its last. Words count across the whole call in timeline order, and only those inside each clip's in and out points: a trimmed clip's earlier words are not counted (see slates-captions)."),
5976
+ tiers: z
5977
+ .record(z.string().regex(/^\d+$/, 'a word index'), z.enum(CAPTION_TIERS))
5978
+ .optional()
5979
+ .describe('Emphasis by word index (the same count as phrases). Unnamed words are regular. Drawn only by components: caption-editorial-emphasis sets italic and emphasis (slam draws as emphasis); kinetic-slam, clip-wipe, particle-burst, neon-glow and neon-accent colour emphasis and slam words as keywords. The text styles show regular.'),
5980
+ trackId: z.string().uuid().optional().describe('An overlay track to use. Default: a new Captions track on top.'),
5981
+ component: z.enum(CAPTION_COMPONENTS).optional().describe("A caption component instead of text clips: one HTML clip animating every word in that component's look (style does not apply). Preview them with slates_list_motion_blocks (query: caption, type: component)."),
5982
+ html: htmlCompositionInput.optional().describe("Your own caption layer instead of a component or text clips: a composition that reads var WORDS = [{ text, start, end }], RAW_GROUPS (phrases as [first, last] word indexes), KEYWORDS (a Set of emphasis word indexes) and DURATION, which Slates fills from the words, phrases and tiers. The slates-layer-brand-captions guide is one ready to use and adapt. Its declared values become the clip's Inspector controls. Not with component or style."),
5983
+ variables: htmlVariablesInput.optional().describe(`${htmlVariablesInput.description} With html.`),
5984
+ })
5985
+ .strict(),
5986
+ async run(input, ctx) {
5987
+ await ctx.desktop().requireCapability('captions', 'captions');
5988
+ if (input.component)
5989
+ await ctx.desktop().requireCapability('caption-components', 'caption components');
5990
+ if (input.html !== undefined)
5991
+ await ctx.desktop().requireCapability('caption-html', 'caption layers of your own');
5992
+ if (input.style === TEXT_FONTS_STYLE)
5993
+ await ctx.desktop().requireCapability('text-fonts', 'the plain text style');
5994
+ if (input.html !== undefined && input.component)
5995
+ throw new Error('html is your own caption layer and component a ready one. Pass one or the other.');
5996
+ if (input.html !== undefined && input.style)
5997
+ throw new Error('style is for text-clip captions; your html brings its own look. Pass one or the other.');
5998
+ if (input.variables && input.html === undefined)
5999
+ throw new Error('variables go with html, the composition that declares them.');
6000
+ if (input.component && input.style)
6001
+ throw new Error('style is for text-clip captions; a component brings its own look. Pass one or the other.');
6002
+ if (input.words && input.source && input.source !== 'words')
6003
+ throw new Error(`words go with source words; source ${input.source} finds its own.`);
6004
+ if (input.source === 'words' && !input.words)
6005
+ throw new Error('source words needs words: [{ text, start, end }] in timeline seconds.');
6006
+ const r = await ctx.desktop().post('/agent/timeline/add-captions', input);
6007
+ const lines = [
6008
+ input.component || input.html !== undefined
6009
+ ? `Added one ${input.component ?? 'caption layer'} clip over ${r.words} words (timing ${r.timing.join(', ')}) on ${r.createdTrack ? 'a new' : 'the'} track ${r.trackId}. ${describeFindings(r.findings)}`
6010
+ : `Added ${r.phrases} caption clip${r.phrases === 1 ? '' : 's'} (${r.words} words, timing ${r.timing.join(', ')}) on ${r.createdTrack ? 'a new' : 'the'} track ${r.trackId}.`,
6011
+ r.mismatches.length ? `Heard ≠ written in ${r.mismatches.length} place${r.mismatches.length === 1 ? '' : 's'}: ${r.mismatches.map((m) => `"${m.heard}" for "${m.written}" at ${m.start}s`).join('; ')}.` : '',
6012
+ r.skipped.length ? `Skipped: ${r.skipped.map((s) => `${s.clipId} (${s.reason})`).join('; ')}.` : '',
6013
+ ].filter(Boolean);
6014
+ return ok(r, `${lines.join(' ')} ${JSON.stringify(r)}`);
6015
+ },
6016
+ };
6017
+ const describeFindings = (f) => {
6018
+ if (!f)
6019
+ return '';
6020
+ const list = (items) => items.map((i) => `${i.code}: ${i.message}${i.selector ? ` (${i.selector})` : ''}${i.fixHint ? ` Fix: ${i.fixHint}` : ''}`).join('; ');
6021
+ if (f.errors.length)
6022
+ return `Check found ${f.errors.length} error${f.errors.length === 1 ? '' : 's'}; fix ${f.errors.length === 1 ? 'it' : 'them'} before moving on: ${list(f.errors)}.${f.warnings.length ? ` Warnings: ${list(f.warnings)}.` : ''}`;
6023
+ return f.warnings.length ? `Check passed with ${f.warnings.length} warning${f.warnings.length === 1 ? '' : 's'}: ${list(f.warnings)}.` : 'Check passed.';
6024
+ };
6025
+ export const addHtmlClip = {
6026
+ id: 'slates_add_html_clip',
6027
+ description: "Put an HTML motion layer on the timeline: an animated caption, lower third, end card, title, logo sting or background plate, drawn on an overlay track in preview and export. An HTML clip is a composition, an HTML document with a GSAP timeline registered on window.__timelines. Pass your own html, or block with the name of a registry block (slates_list_motion_blocks) and its variables; html with block replaces the block's document and keeps its files. Slates' composition check runs before the clip lands and its findings come back here: fix every error with slates_update_html_clip before moving on. Keep a transparent foreground and a background plate on separate tracks. Free. Read slates_get_timeline first for the frame rate and where clips sit. Craft: slates_get_prompting_guide (topic: slates-motion).",
6028
+ input: z
6029
+ .object({
6030
+ projectId: z.string().uuid(),
6031
+ timelineId: z.string().uuid().describe('The cut (slates_get_timeline or slates_list_timelines).'),
6032
+ trackId: z.string().uuid().optional().describe('An overlay track (slates_add_timeline_track, type overlay). Without it the desktop picks or makes one; createdTrack says which.'),
6033
+ startFrame: z.number().int().min(0).describe('Where the clip starts, in timeline frames.'),
6034
+ endFrame: z.number().int().min(1).optional().describe('The frame it ends before. Give endFrame or durationSec, not both; without either, the duration the composition or block declares.'),
6035
+ durationSec: z.number().positive().optional().describe('How long it shows, in seconds.'),
6036
+ html: htmlCompositionInput.optional().describe(`${htmlCompositionInput.description} html, block or both.`),
6037
+ block: z.string().min(1).optional().describe('A registry block name from slates_list_motion_blocks.'),
6038
+ variables: htmlVariablesInput.optional(),
6039
+ })
6040
+ .strict(),
6041
+ async run(input, ctx) {
6042
+ await ctx.desktop().requireCapability('html-clips', 'HTML layers');
6043
+ if (input.html === undefined && input.block === undefined)
6044
+ throw new Error('Give html (a composition document) or block (a registry block name).');
6045
+ if (input.endFrame !== undefined && input.durationSec !== undefined)
6046
+ throw new Error('Give endFrame or durationSec, not both.');
6047
+ const r = await ctx.desktop().post('/agent/timeline/add-html-clip', input);
6048
+ return ok(r, `Added HTML clip ${r.clipId} on ${r.createdTrack ? 'a new' : 'the'} track ${r.trackId}. ${describeFindings(r.findings)} ${JSON.stringify(r)}`);
6049
+ },
6050
+ };
6051
+ export const updateHtmlClip = {
6052
+ id: 'slates_update_html_clip',
6053
+ description: "Change an HTML clip's composition or its variables. Slates' composition check runs again and its findings come back here: fix every error before moving on. Only what you pass changes. To move or retime one, remove it (slates_remove_clip) and add it again.",
6054
+ input: z
6055
+ .object({
6056
+ projectId: z.string().uuid(),
6057
+ clipId: z.string().uuid().describe('An HTML clip (slates_get_timeline).'),
6058
+ html: htmlCompositionInput.optional().describe(`${htmlCompositionInput.description} Replaces the whole document.`),
6059
+ variables: htmlVariablesInput.nullable().optional().describe(`${htmlVariablesInput.description} Replaces them all; null clears them.`),
6060
+ })
6061
+ .strict(),
6062
+ async run(input, ctx) {
6063
+ await ctx.desktop().requireCapability('html-clips', 'HTML layers');
6064
+ if (input.html === undefined && input.variables === undefined)
6065
+ throw new Error('Pass html or variables to change.');
6066
+ const r = await ctx.desktop().post('/agent/timeline/update-html-clip', input);
6067
+ return ok(r, `Updated HTML clip ${r.clipId}. ${describeFindings(r.findings)} ${JSON.stringify(r)}`);
6068
+ },
6069
+ };
6070
+ export const checkComposition = {
6071
+ id: 'slates_check_composition',
6072
+ description: "Check a composition before it lands, with Slates' composition check: its errors and warnings, each with a code, a message and, where it has one, the selector it found. Writes nothing. slates_add_html_clip and slates_update_html_clip run the same check, so use this one while drafting.",
6073
+ input: z.object({ html: htmlCompositionInput }).strict(),
6074
+ async run(input, ctx) {
6075
+ await ctx.desktop().requireCapability('html-clips', 'HTML layers');
6076
+ const r = await ctx.desktop().post('/agent/compositions/check', input);
6077
+ return ok(r, `${describeFindings(r)} ${JSON.stringify(r)}`);
6078
+ },
6079
+ };
6080
+ export const listMotionBlocks = {
6081
+ id: 'slates_list_motion_blocks',
6082
+ description: "Search the motion block library for ready-made motion layers, such as captions, lower thirds and end cards: each item's name, type, title, description and tags. The list is the library at the version this Slates build runs, so every item in it draws here. Put a block on the timeline with slates_add_html_clip (block: its name).",
6083
+ input: z
6084
+ .object({
6085
+ query: z.string().min(1).max(200).optional().describe('Words to match, such as "lower third" or "kinetic caption".'),
6086
+ type: z.enum(MOTION_REGISTRY_TYPES).optional().describe('Default: block, the items slates_add_html_clip takes.'),
6087
+ })
6088
+ .strict(),
6089
+ async run(input, ctx) {
6090
+ await ctx.desktop().requireCapability('html-clips', 'HTML layers');
6091
+ const r = await ctx.desktop().get('/agent/compositions/registry', { query: input.query, type: input.type });
6092
+ const rows = r.items.map((i) => `- ${i.name} (${i.type})${i.title ? `: ${i.title}` : ''}${i.description ? ` — ${i.description}` : ''}${i.tags?.length ? ` [${i.tags.join(', ')}]` : ''}`);
6093
+ const shown = r.total > r.items.length ? `${r.items.length} of ${r.total} registry items (search to narrow it)` : `${r.items.length} registry item${r.items.length === 1 ? '' : 's'}`;
6094
+ const from = r.offline ? `the list saved ${r.fetchedAt} (the registry could not be reached)` : `${r.source}, fetched ${r.fetchedAt}`;
6095
+ return ok(r, `${shown} from ${from}.\n${rows.join('\n')}`);
6096
+ },
6097
+ };
4887
6098
  export const updateTimelineTrack = {
4888
6099
  id: 'slates_update_timeline_track',
4889
- description: 'Update a timeline track: rename, mute/unmute, lock/unlock, or set its volume fader (linear gain, -∞ to +12 dB). Track volume applies to both preview and MP4 export — audio-track clips are mixed at this gain; a muted video track still shows video but its embedded audio is silenced.',
6100
+ description: 'Update a timeline track: rename, mute/unmute, lock/unlock, or set its volume fader (linear gain, -∞ to +12 dB). Track volume applies to both preview and MP4 export — audio-track clips are mixed at this gain; a muted video track still shows video but its embedded audio is silenced. effects puts an effect list on a sound lane, heard after its clips\' own (the same shape as slates_update_clip, keys in frames from the timeline start).',
4890
6101
  input: z.object({
4891
6102
  projectId: z.string().uuid(),
4892
6103
  trackId: z.string().uuid(),
@@ -4894,10 +6105,14 @@ export const updateTimelineTrack = {
4894
6105
  muted: z.boolean().optional(),
4895
6106
  locked: z.boolean().optional(),
4896
6107
  volume: z.number().min(0).max(4).optional().describe('Track fader as LINEAR gain: 0 = -∞ (silent), 1 = 0 dB (unity), ~3.98 = +12 dB (max boost).'),
6108
+ effects: audioEffectList.nullable().optional().describe('A video or audio lane: its effect list, sent whole; null clears it.'),
4897
6109
  }),
4898
6110
  async run(input, ctx) {
4899
6111
  const desktop = ctx.desktop();
4900
6112
  await desktop.requireCapability('timeline-tracks', 'timeline tracks + audio mixing');
6113
+ if (input.effects !== undefined)
6114
+ await desktop.requireCapability('audio-effects', 'audio effects on a lane');
6115
+ await requireKeysBetweenFrames(desktop, input.effects);
4901
6116
  return ok(await desktop.post('/agent/timeline/update-track', input));
4902
6117
  },
4903
6118
  };
@@ -4916,18 +6131,32 @@ export const removeTimelineTrack = {
4916
6131
  };
4917
6132
  export const updateTimelineSettings = {
4918
6133
  id: 'slates_update_timeline_settings',
4919
- description: "Update the project timeline's output settings: resolution, frame rate (24/30/60 — all clips are conformed to it on export), and masterVolume, the output fader (linear gain, -∞ to +12 dB) applied to the final mix in both preview and MP4 export (use it to prevent clipping when stacking loud tracks). Note these are normally auto-managed: the first video clip sets fps + resolution, and higher-res clips raise the canvas. Changing frameRate after clips are placed retimes them — avoid unless the timeline is empty.",
6134
+ description: "Update a timeline's output settings: resolution, frame rate (24/30/60; all clips are conformed to it on export), masterVolume, or delivery formats, naming taxonomy and explicit variant grid bindings. New fields require ad-variant-export; null clears them. Read aspects and dimensions from slates_get_variant_grid. Delivery-only updates on an explicit timeline return the computed formats. masterVolume is the output fader (linear gain: 0 is silent, 1 is unity, 4 is the maximum boost) applied to the preview and the final mix; use it to prevent clipping when stacking loud tracks. These are normally auto-managed: the first video clip sets fps and resolution, higher-res clips raise the canvas, and delivery preserves the master aspect. Changing frameRate keeps clip positions, lengths and markers in seconds, rounded to the nearest new frame. effects puts an effect list on the master, after the output fader (the same shape as slates_update_clip, keys in frames from the timeline start). audioBitrate is the exported MP4's sound in kb/s, the Sound bitrate the settings button shows.",
4920
6135
  input: z.object({
4921
6136
  projectId: z.string().uuid(), timelineId: z.string().uuid().optional(),
4922
6137
  width: z.number().int().min(16).optional(),
4923
6138
  height: z.number().int().min(16).optional(),
4924
6139
  frameRate: z.union([z.literal(24), z.literal(30), z.literal(60)]).optional(),
4925
6140
  masterVolume: z.number().min(0).max(4).optional().describe('Output fader as LINEAR gain: 0 = -∞ (silent), 1 = 0 dB (unity), ~3.98 = +12 dB (max boost).'),
6141
+ effects: audioEffectList.nullable().optional().describe("The master's effect list, sent whole; null clears it."),
6142
+ audioBitrate: audioBitrateInput.nullable().optional().describe(`The export's AAC sound in kb/s: ${AUDIO_BITRATES.join(', ')}; null goes back to the default ${AUDIO_BITRATE_DEFAULT}.`),
6143
+ ...cutOptionsInput,
4926
6144
  }),
4927
6145
  async run(input, ctx) {
4928
6146
  const desktop = ctx.desktop();
4929
6147
  await desktop.requireCapability('timeline-tracks', 'timeline tracks + audio mixing');
6148
+ if (input.effects !== undefined)
6149
+ await desktop.requireCapability('audio-effects', 'audio effects on the master');
6150
+ await requireKeysBetweenFrames(desktop, input.effects);
6151
+ if (input.audioBitrate !== undefined)
6152
+ await requireSoundPrecision(desktop);
4930
6153
  await requireNamedCut(desktop, input.timelineId);
6154
+ if (input.delivery !== undefined || input.taxonomy !== undefined || input.gridBinding !== undefined) {
6155
+ await desktop.requireCapability('ad-variant-export', 'cut delivery, naming and grid bindings');
6156
+ }
6157
+ if (input.timelineId && input.delivery !== undefined && Object.keys(input).every(key => ['projectId', 'timelineId', 'delivery'].includes(key))) {
6158
+ return ok(await desktop.post('/agent/timeline/delivery', input));
6159
+ }
4931
6160
  return ok(await desktop.post('/agent/timeline/update-settings', input));
4932
6161
  },
4933
6162
  };
@@ -4935,7 +6164,8 @@ export const updateTimelineSettings = {
4935
6164
  const ABSOLUTE_PATH_RE = /^([A-Za-z]:[\\/]|\/)/;
4936
6165
  export const exportVideo = {
4937
6166
  id: 'slates_export_video',
4938
- description: "Render the project's timeline to an MP4 file on disk via the desktop app's ffmpeg pipeline (H.264 + AAC, gaps rendered as black). No dialogs — pass an absolute outputPath ending in .mp4. Fails if the file exists unless overwrite=true. Blocks until encoding finishes (can take minutes for long timelines) and returns the real file size and probed duration. After success, consider slates_reveal_file to show the file to the user. Requires at least one video clip on the timeline.",
6167
+ billable: false,
6168
+ description: "Render the project's timeline to an MP4 file on disk through the desktop app's timeline engine, the renderer its monitor shows, so the file matches the preview (H.264 + AAC, every video lane composited with its transitions, fades and keyframes, gaps rendered as black; the Slates window must be open). No dialogs — pass an absolute outputPath ending in .mp4. Fails if the file exists unless overwrite=true. Blocks until encoding finishes (can take minutes for long timelines) and returns the real file size and probed duration. After success, consider slates_reveal_file to show the file to the user. Requires at least one video clip on the timeline. The sound is AAC at the timeline's Sound bitrate (slates_update_timeline_settings audioBitrate; default 320 kb/s) unless audioBitrate names one for this file. Pass exactly one of projectId (the project's default timeline) or timelineId (a named cut).",
4939
6169
  input: z
4940
6170
  .object({
4941
6171
  projectId: z.string().uuid().optional(),
@@ -4946,6 +6176,8 @@ export const exportVideo = {
4946
6176
  .refine((p) => ABSOLUTE_PATH_RE.test(p), { message: 'outputPath must be absolute' })
4947
6177
  .describe('Absolute path for the rendered file, ending in .mp4 (e.g. C:\\Users\\you\\Videos\\ad.mp4 or /Users/you/ad.mp4). slates_get_project_directory gives a sensible default folder.'),
4948
6178
  overwrite: z.boolean().optional(),
6179
+ aspect: deliveryAspectInput.optional().describe('Optional delivery aspect from slates_get_variant_grid; requires ad-variant-export. Omission keeps existing export behavior.'),
6180
+ audioBitrate: audioBitrateInput.optional().describe(`This file's AAC sound in kb/s (${AUDIO_BITRATES.join(', ')}); omit for the timeline's Sound bitrate.`),
4949
6181
  })
4950
6182
  .refine((d) => !!d.projectId !== !!d.timelineId, {
4951
6183
  message: 'Pass exactly one of projectId or timelineId',
@@ -4953,11 +6185,17 @@ export const exportVideo = {
4953
6185
  async run(input, ctx) {
4954
6186
  const desktop = ctx.desktop();
4955
6187
  await desktop.requireCapability('export', 'video export');
6188
+ if (input.aspect !== undefined)
6189
+ await desktop.requireCapability('ad-variant-export', 'single video delivery export');
6190
+ if (input.audioBitrate !== undefined)
6191
+ await requireSoundPrecision(desktop);
4956
6192
  const r = await desktop.post('/agent/timeline/export-video', {
4957
6193
  projectId: input.projectId,
4958
6194
  timelineId: input.timelineId,
4959
6195
  outputPath: input.outputPath,
4960
6196
  overwrite: input.overwrite,
6197
+ aspect: input.aspect,
6198
+ audioBitrate: input.audioBitrate,
4961
6199
  });
4962
6200
  const mb = r.fileSizeBytes != null ? (r.fileSizeBytes / (1024 * 1024)).toFixed(1) : '?';
4963
6201
  return ok(r, `Exported ${r.durationSec ?? '?'}s MP4 (${mb} MB) to ${r.outputPath ?? input.outputPath}.`);
@@ -4965,7 +6203,7 @@ export const exportVideo = {
4965
6203
  };
4966
6204
  export const exportTimelineXml = {
4967
6205
  id: 'slates_export_timeline_xml',
4968
- description: "Export the project's timeline as FCP7/XMEML XML — the file DaVinci Resolve imports directly (File → Import → Timeline) to recreate the edit with references to the original clip media on disk. Use this for DaVinci Resolve or Premiere; current Final Cut Pro requires FCPXML, which this tool does not export. Pass an absolute outputPath ending in .xml; fails if the file exists unless overwrite=true.",
6206
+ description: "Export the project's timeline as FCP7/XMEML XML — the file DaVinci Resolve imports directly (File → Import → Timeline) to recreate the edit with references to the original clip media on disk. Use this for DaVinci Resolve or Premiere; current Final Cut Pro requires FCPXML, which this tool does not export. Pass an absolute outputPath ending in .xml; fails if the file exists unless overwrite=true. Pass exactly one of projectId (the project's default timeline) or timelineId (a named cut).",
4969
6207
  input: z
4970
6208
  .object({
4971
6209
  projectId: z.string().uuid().optional(),
@@ -5075,8 +6313,8 @@ export const undoRelocateProject = {
5075
6313
  };
5076
6314
  export const deleteAsset = {
5077
6315
  id: 'slates_delete_asset',
5078
- description: 'Delete an asset from its project. Permanent — also deletes the media file from disk.',
5079
- input: z.object({ id: z.string().uuid() }),
6316
+ description: 'Delete an asset from its project. Permanent: also deletes the media file from disk, so ask the user first.',
6317
+ input: z.object({ id: z.string().uuid().describe(ASSET_UUID_ONLY) }),
5080
6318
  async run(input, ctx) {
5081
6319
  return ok(await ctx.desktop().post('/agent/assets/delete', { id: input.id }));
5082
6320
  },
@@ -5094,7 +6332,7 @@ export const renameFolder = {
5094
6332
  };
5095
6333
  export const deleteFolder = {
5096
6334
  id: 'slates_delete_folder',
5097
- description: 'Delete an asset folder.',
6335
+ description: 'Delete an asset folder only; its files return to No folder. To delete the files too, call slates_delete_asset on them first.',
5098
6336
  input: z.object({ folderId: z.string().uuid() }),
5099
6337
  async run(input, ctx) {
5100
6338
  return ok(await ctx.desktop().post('/agent/folders/delete', { id: input.folderId }));
@@ -5105,7 +6343,7 @@ export const setFolderCover = {
5105
6343
  description: 'Set the cover image of an asset folder (or clear it with assetId=null).',
5106
6344
  input: z.object({
5107
6345
  folderId: z.string().uuid(),
5108
- assetId: z.string().uuid().nullable(),
6346
+ assetId: z.string().uuid().nullable().describe(ASSET_UUID_ONLY),
5109
6347
  }),
5110
6348
  async run(input, ctx) {
5111
6349
  return ok(await ctx.desktop().post('/agent/folders/set-cover', input));
@@ -5113,12 +6351,12 @@ export const setFolderCover = {
5113
6351
  };
5114
6352
  export const updateCharacter = {
5115
6353
  id: 'slates_update_character',
5116
- description: 'Update a character\'s name, description, style, or voice. Use slates_set_character_identity_asset for its canonical image.',
6354
+ description: 'Update a character\'s name, description, style, or voice. Use slates_set_character_identity_asset for its canonical image.' + LIBRARY_TWIN('slates_update_library_item', 'edits the same row'),
5117
6355
  input: z.object({
5118
6356
  characterId: z.string().uuid(),
5119
6357
  name: z.string().min(1).max(120).optional(),
5120
6358
  description: z.string().optional(),
5121
- style: z.string().max(200).optional().describe("Art style. Omit to inherit the reference's style (the default). Canonical styles: photoreal, anime, painterly, 3d-render, comic. Or pass any free-text instruction, e.g. 'turn this into a real person'."),
6359
+ style: z.string().max(200).optional().describe(STYLE_DESCRIBE('Omit to keep the stored style.')),
5122
6360
  // Agent parity for the character card's voice slot: the desktop route has
5123
6361
  // taken this since 2026-08-28; the op never exposed it, so an agent could
5124
6362
  // render a voice and had no way to keep it on the character.
@@ -5145,7 +6383,7 @@ export const updateCharacter = {
5145
6383
  };
5146
6384
  export const deleteCharacter = {
5147
6385
  id: 'slates_delete_character',
5148
- description: 'Delete a character from its project.',
6386
+ description: 'Delete a character from its project.' + LIBRARY_TWIN('slates_delete_library_item', 'deletes the same row'),
5149
6387
  input: z.object({ characterId: z.string().uuid() }),
5150
6388
  async run(input, ctx) {
5151
6389
  return ok(await ctx.desktop().post('/agent/characters/delete', { id: input.characterId }));
@@ -5153,12 +6391,12 @@ export const deleteCharacter = {
5153
6391
  };
5154
6392
  export const updateEnvironment = {
5155
6393
  id: 'slates_update_environment',
5156
- description: 'Update a location\'s name, description, style, or bound reference image (referenceAssetId=null clears it).',
6394
+ description: 'Update a location\'s name, description, style, or bound reference image (referenceAssetId=null clears it).' + LIBRARY_TWIN('slates_update_library_item', 'edits the same row'),
5157
6395
  input: z.object({
5158
6396
  environmentId: z.string().uuid(),
5159
6397
  name: z.string().min(1).max(120).optional(),
5160
6398
  description: z.string().optional(),
5161
- style: z.string().max(200).optional().describe("Art style. Omit to inherit the reference's style (the default). Canonical styles: photoreal, anime, painterly, 3d-render, comic. Or pass any free-text instruction, e.g. 'turn this into a real person'."),
6399
+ style: z.string().max(200).optional().describe(STYLE_DESCRIBE('Omit to keep the stored style.')),
5162
6400
  referenceAssetId: z.string().uuid().nullable().optional(),
5163
6401
  }),
5164
6402
  async run(input, ctx) {
@@ -5175,7 +6413,7 @@ export const updateEnvironment = {
5175
6413
  };
5176
6414
  export const deleteEnvironment = {
5177
6415
  id: 'slates_delete_environment',
5178
- description: 'Delete a location from its project.',
6416
+ description: 'Delete a location from its project.' + LIBRARY_TWIN('slates_delete_library_item', 'deletes the same row'),
5179
6417
  input: z.object({ environmentId: z.string().uuid() }),
5180
6418
  async run(input, ctx) {
5181
6419
  return ok(await ctx.desktop().post('/agent/environments/delete', { id: input.environmentId }));
@@ -5183,7 +6421,7 @@ export const deleteEnvironment = {
5183
6421
  };
5184
6422
  export const listStyles = {
5185
6423
  id: 'slates_list_styles',
5186
- description: 'List the looks (styles) in a Slates project.',
6424
+ description: 'List the looks (styles) in a Slates project.' + LIBRARY_TWIN('slates_list_library', 'lists them with every other Library item, each with its category and mention (#name for a look)'),
5187
6425
  input: z.object({ projectId: z.string().uuid() }),
5188
6426
  async run(input, ctx) {
5189
6427
  return ok(await ctx.desktop().get('/agent/styles', { projectId: input.projectId }));
@@ -5191,7 +6429,7 @@ export const listStyles = {
5191
6429
  };
5192
6430
  export const createStyle = {
5193
6431
  id: 'slates_create_style',
5194
- description: 'Create a new look (style) in a Slates project.',
6432
+ description: 'Create a new look (style) in a Slates project.' + LIBRARY_TWIN('slates_create_library_item', 'creates one in a category you choose and returns its #mention'),
5195
6433
  input: z.object({
5196
6434
  projectId: z.string().uuid(),
5197
6435
  name: z.string().min(1).max(120),
@@ -5203,7 +6441,7 @@ export const createStyle = {
5203
6441
  };
5204
6442
  export const updateStyle = {
5205
6443
  id: 'slates_update_style',
5206
- description: 'Update a look\'s name, description, or bound reference image (imageAssetId=null clears it).',
6444
+ description: 'Update a look\'s name, description, or bound reference image (imageAssetId=null clears it).' + LIBRARY_TWIN('slates_update_library_item', 'edits the same row'),
5207
6445
  input: z.object({
5208
6446
  styleId: z.string().uuid(),
5209
6447
  name: z.string().min(1).max(120).optional(),
@@ -5219,7 +6457,7 @@ export const updateStyle = {
5219
6457
  };
5220
6458
  export const deleteStyle = {
5221
6459
  id: 'slates_delete_style',
5222
- description: 'Delete a look from its project.',
6460
+ description: 'Delete a look from its project.' + LIBRARY_TWIN('slates_delete_library_item', 'deletes the same row'),
5223
6461
  input: z.object({ styleId: z.string().uuid() }),
5224
6462
  async run(input, ctx) {
5225
6463
  return ok(await ctx.desktop().post('/agent/styles/delete', { id: input.styleId }));
@@ -5266,7 +6504,7 @@ export const createLibraryItem = {
5266
6504
  };
5267
6505
  export const updateLibraryItem = {
5268
6506
  id: 'slates_update_library_item',
5269
- description: "Update a Library item: rename it, move it to another category (categoryId), bind its picture (imageAssetId) or its voice (voiceAssetId, an audio asset; a thing in a location category composes as an environment and carries none). null clears an asset; the asset itself stays. Moving between a 'thing' and a 'look' category flips the sigil (@ ↔ #), and moving a thing into or out of a 'location'-template category changes what it composes as. A rename changes its handle. In every case each saved Shot that mentions the item is rewritten to match (the mention in its prompt, and its mention id), and the result's `move` reports `shotsMentioning`, `shotsRetagged` and the old and new `mention`: tell the user what changed. Pass retagShots:false to leave Shots alone; they then show the item as missing until it is mentioned again. Moving it back, or renaming it back, undoes the rewrite.",
6507
+ description: "Update a Library item: rename it, move it to another category (categoryId), bind its picture (imageAssetId) or its voice (voiceAssetId, an audio asset; a thing in a location category composes as an environment and carries none). null clears an asset; the asset itself stays. Moving between a 'thing' and a 'look' category flips the sigil (@ ↔ #), and moving a thing into or out of a 'location'-template category changes what it composes as. A rename changes its handle. In every case each saved Shot that mentions the item is rewritten to match (the mention in its prompt, and its mention id), and the result's `move` reports `shotsMentioning`, `shotsRetagged` and the old and new `mention`: tell the user what changed. Pass retagShots:false to leave Shots alone; they then show the item as missing until it is mentioned again. Moving it back, or renaming it back, undoes the rewrite. extraAssetIds sets the item's extra pictures (the whole ordered list; [] clears; a mention still sends only its picture) and palette its colours (up to six; [] clears; shown and read, never sent to a model).",
5270
6508
  input: z.object({
5271
6509
  projectId: z.string().uuid().describe('The project the item is in — asset codes resolve against it.'),
5272
6510
  itemId: z.string().uuid(),
@@ -5277,10 +6515,15 @@ export const updateLibraryItem = {
5277
6515
  retagShots: z.boolean().optional().describe('Only with categoryId or name. Default true: Shots that mention the item follow a move or a rename that changes how it is mentioned.'),
5278
6516
  imageAssetId: z.string().min(1).nullable().optional().describe('UUID or badge code; null clears.'),
5279
6517
  voiceAssetId: z.string().min(1).nullable().optional().describe('An AUDIO asset, UUID or badge code; null detaches.'),
6518
+ extraAssetIds: z.array(z.string().min(1)).max(24).optional().describe('More pictures of it, in order: UUIDs or badge codes of pictures in this project. [] clears.'),
6519
+ palette: z.array(z.string().min(1)).max(6).optional().describe('Its colours: #rrggbb, #rgb or rgb(r, g, b). [] clears.'),
5280
6520
  }),
5281
6521
  async run(input, ctx) {
5282
6522
  await ctx.desktop().requireCapability('library', 'the Library');
5283
- const refs = [input.imageAssetId, input.voiceAssetId].filter((r) => typeof r === 'string');
6523
+ if (input.extraAssetIds !== undefined || input.palette !== undefined) {
6524
+ await ctx.desktop().requireCapability('product-intake', "a Library item's extra pictures and colours");
6525
+ }
6526
+ const refs = [input.imageAssetId, input.voiceAssetId, ...(input.extraAssetIds ?? [])].filter((r) => typeof r === 'string');
5284
6527
  const resolved = await resolveAssetRefs(ctx, input.projectId, refs);
5285
6528
  const asset = (ref) => typeof ref === 'string' ? resolved.get(ref).id : ref;
5286
6529
  return ok(await ctx.desktop().post('/agent/library/items/update', {
@@ -5295,13 +6538,15 @@ export const updateLibraryItem = {
5295
6538
  // explicit null is the clear.
5296
6539
  ...(input.imageAssetId !== undefined ? { imageAssetId: asset(input.imageAssetId) } : {}),
5297
6540
  ...(input.voiceAssetId !== undefined ? { voiceAssetId: asset(input.voiceAssetId) } : {}),
6541
+ ...(input.extraAssetIds !== undefined ? { extraAssetIds: input.extraAssetIds.map((ref) => resolved.get(ref).id) } : {}),
6542
+ ...(input.palette !== undefined ? { palette: input.palette } : {}),
5298
6543
  },
5299
6544
  }));
5300
6545
  },
5301
6546
  };
5302
6547
  export const deleteLibraryItem = {
5303
6548
  id: 'slates_delete_library_item',
5304
- description: 'Delete a Library item. Its images and voice clip stay in the project as ordinary assets.',
6549
+ description: 'Delete a Library item. Saved Shots that mention it stop attaching it, so tell the user how many. Its images and voice clip stay in the project as ordinary assets.',
5305
6550
  input: z.object({ itemId: z.string().uuid() }),
5306
6551
  async run(input, ctx) {
5307
6552
  await ctx.desktop().requireCapability('library', 'the Library');
@@ -5315,7 +6560,7 @@ export const manageLibraryCategory = {
5315
6560
  action: z.enum(['create', 'rename', 'set-behaviour', 'reorder', 'delete']),
5316
6561
  projectId: z.string().uuid().optional(),
5317
6562
  categoryId: z.string().uuid().optional(),
5318
- name: z.string().min(1).max(80).optional(),
6563
+ name: z.string().min(1).max(40).optional().describe("Up to 40 characters, as the app's name field."),
5319
6564
  kind: z.enum(['thing', 'look']).optional(),
5320
6565
  template: z.enum(['person', 'location']).nullable().optional(),
5321
6566
  retagShots: z.boolean().optional(),
@@ -5354,7 +6599,7 @@ export const copyLibraryItemToProject = {
5354
6599
  // mention. It holds no takes, and importing one generates and spends nothing.
5355
6600
  export const getTemplate = {
5356
6601
  id: 'slates_get_template',
5357
- description: "Read a Slates template file without changing anything. With `path`: what it holds (scenes, shots, library items, the models its shots are set to) and its SWAP SLOTS — every Library item (`item:i1`, labelled with its mention, e.g. @candle) and every directly attached reference (`asset:a3`, with its roles) that slates_import_template can point at one of the project's own assets instead. Without `path`: the saved templates on this machine (the app's starter set and the user's own folder).",
6602
+ description: "Read a Slates template file without changing anything. With `path`: what it holds (scenes, shots, library items, the models its shots are set to) and its SWAP SLOTS — every Library item (`item:i1`, labelled with its mention, e.g. @candle) and every directly attached reference (`asset:a3`, with its roles) that slates_import_template can point at one of the project's own assets instead. Without `path`: the templates in the user's templates folder, plus any starter templates the app ships.",
5358
6603
  input: z.object({ path: z.string().min(1).optional().describe('Absolute path of a .slatestemplate file. Omit to list saved templates.') }),
5359
6604
  async run(input, ctx) {
5360
6605
  await ctx.desktop().requireCapability('templates', 'templates');
@@ -5365,7 +6610,7 @@ export const getTemplate = {
5365
6610
  };
5366
6611
  export const exportTemplate = {
5367
6612
  id: 'slates_export_template',
5368
- description: "Save a board, a scene or one Shot as a template file someone else can start from. Give exactly one of storyboardId, sceneId or shotId. The file carries each Shot's full recipe (prompt, model, settings, reference roles, script words) plus the reference files and the Library items the Shots mention; it carries no takes. The project is untouched. Returns the path, the counts, and a warning for any reference whose file is missing.",
6613
+ description: "Save a board, a scene or one Shot as a template file someone else can start from. Give exactly one of storyboardId, sceneId or shotId. The file carries each Shot's full recipe (prompt, model, settings, reference roles, script words) plus the reference files and the Library items the Shots mention; it carries no takes. The project is untouched. A file saved outside the user's templates folder is not in the template list (slates_get_template without path); the user opens it with Open a file. Returns the path, the counts and a warning for any reference whose file is missing.",
5369
6614
  input: z.object({
5370
6615
  projectId: z.string().uuid(),
5371
6616
  path: z.string().min(1).describe('Absolute path to write, ending in .slatestemplate. Its folder is created if needed.'),
@@ -5385,7 +6630,7 @@ export const exportTemplate = {
5385
6630
  };
5386
6631
  export const importTemplate = {
5387
6632
  id: 'slates_import_template',
5388
- description: "Add a template to a project. A board template becomes a new board; a scene template becomes a new scene of `storyboardId` (default: the most recently edited board); a single-Shot template is filed like any new Shot (into `sceneId` when given). Its reference files become new assets of this project and its Library items are created here (a taken name is suffixed and the imported prompts are rewritten to match; see `renamed`). `swaps` maps a slot key from slates_get_template to an asset of THIS project (id or code) of the slot's type: the item takes that picture, or every Shot that attached the template's reference attaches it instead, and the template's own file for that slot is not imported. Generates nothing and spends nothing: price and fire the returned shotIds with slates_generate_from_shots, after the user approves the prices.",
6633
+ description: "Add a template to a project. A board template becomes a new board; a scene template becomes a new scene of `storyboardId` (default: the most recently edited board); a single-Shot template is filed like any new Shot (into `sceneId` when given, else the last scene of `storyboardId` or of the most recently edited board). Its reference files become new assets of this project and its Library items are created here (a taken name is suffixed and the imported prompts are rewritten to match; see `renamed`). `swaps` maps a slot key from slates_get_template to an asset of THIS project (id or code) of the slot's type: the item takes that picture, or every Shot that attached the template's reference attaches it instead, and the template's own file for that slot is not imported. Generates nothing and spends nothing: price and fire the returned shotIds with slates_generate_from_shots, after the user approves the prices.",
5389
6634
  input: z.object({
5390
6635
  projectId: z.string().uuid(),
5391
6636
  path: z.string().min(1).describe('Absolute path of the .slatestemplate file.'),
@@ -5409,12 +6654,148 @@ export const importTemplate = {
5409
6654
  return ok(await ctx.desktop().post('/agent/templates/import', { ...input, swaps }));
5410
6655
  },
5411
6656
  };
6657
+ // ── Start from a reference ad ───────────────────────────────────────────
6658
+ // A finished ad becomes an ordinary board: one Shot per cut, each postered with
6659
+ // its keyframe, the heard words on the Script page. Local and free, and the
6660
+ // board generates nothing. Read and write are two tools so a host can
6661
+ // auto-approve the read (mcp-server-design § Annotations).
6662
+ export const getReferenceBreakdown = {
6663
+ id: 'slates_get_reference_breakdown',
6664
+ description: "Read a reference ad's cuts and words without changing anything: each cut's start, end and seconds, the words heard in it, and the reference's size, frame rate and form (a still, no voice, soft cuts). When slates_break_down_reference already saved this asset's frames, they come back too (framesSaved: true, each cut's keyframeCode and compositeCode, the first and last frame side by side); otherwise there are no pictures and the words are the stored transcript only. Free; writes nothing. To start from a reference, read it here, then break it down.",
6665
+ input: z
6666
+ .object({
6667
+ projectId: z.string().uuid(),
6668
+ assetId: z.string().min(1).describe('The reference video or picture in the project: its code (VID-V3) or id.'),
6669
+ })
6670
+ .strict(),
6671
+ async run(input, ctx) {
6672
+ await ctx.desktop().requireCapability('reference-breakdown', 'breaking a reference ad into shots');
6673
+ const assetId = (await resolveAssetRefs(ctx, input.projectId, [input.assetId])).get(input.assetId).id;
6674
+ return ok(await ctx.desktop().get('/agent/reference/breakdown', { projectId: input.projectId, assetId }));
6675
+ },
6676
+ };
6677
+ export const breakDownReference = {
6678
+ id: 'slates_break_down_reference',
6679
+ billable: false,
6680
+ description: "Start from a reference ad: break a finished video into a new board with one Shot per cut, as the clip's Break down into shots command does, so the user can remake it with their own product. Each Shot is postered with its cut's keyframe (a poster only, never a reference or first frame), named by its seconds in the reference, and holds the words heard in that cut on the Script page. Nothing is generated and nothing spends: the result carries the board's quote, the Shot codes and each timing gap in words (a cut shorter than the model's shortest length). Local and free; the first transcription can take minutes. Name the reference by assetId, filePath or url, one of them: a url is fetched into the project's Media first, and works for a Meta Ad Library ad link (facebook.com/ads/library/?id=...) or a direct link to a video file; TikTok Creative Center, YouTube and TikTok post links are refused with the reason (download the video, then pass filePath). The result's source names the link, its kind and the video file it fetched. build false saves each cut's keyframe and first-and-last composite to a frames folder and returns the cuts, without a board: look at them with slates_get_asset_image, then call again with build (the frames are reused) and `cuts` (each cut's description, written for the user's product, becomes its Shot's prompt; onScreenText becomes a direction line), `sections` (headings) and `roles` (who or what recurs; itemId points the role at the user's own Library item). A still becomes one Shot. Generate only after the user approves the quote (slates_generate_from_shots). To be able to stop a run, name it with jobId; cancel true with that jobId (and projectId, nothing else) stops it at its next step, removing its frames and any video it fetched, until its board build starts (too late then: the board is kept).",
6681
+ input: z
6682
+ .object({
6683
+ projectId: z.string().uuid(),
6684
+ assetId: z.string().min(1).optional().describe('A video or picture already in the project: its code (VID-V3) or id. Give this, filePath or url.'),
6685
+ filePath: z.string().min(1).optional().describe('An absolute path to a video or picture on this computer; it is imported first.'),
6686
+ url: z
6687
+ .string()
6688
+ .url()
6689
+ .optional()
6690
+ .describe('A link to the reference: a Meta Ad Library ad or a direct video file link, fetched and imported first. Creative Center and post links are refused with the reason.'),
6691
+ build: z.boolean().optional().describe('false: save the frames and return the cuts, with no board. Default true.'),
6692
+ transcribe: z.boolean().optional().describe('Hear the words when no transcript is stored. Default true.'),
6693
+ name: z.string().min(1).max(80).optional().describe("The board's name. Defaults to the reference's."),
6694
+ model: z.string().min(1).optional().describe("A video model id for every Shot; defaults to the app's default video model."),
6695
+ cuts: z
6696
+ .array(z
6697
+ .object({
6698
+ index: z.number().int().min(0).describe("The cut's index from the breakdown's segments."),
6699
+ description: z.string().max(4000).optional().describe("What this Shot shows, for the user's product: its prompt."),
6700
+ onScreenText: z.string().max(500).optional().describe('Words on screen in this cut, kept as a direction line, never sent as action.'),
6701
+ })
6702
+ .strict())
6703
+ .optional(),
6704
+ sections: z
6705
+ .array(z.object({ label: z.string().min(1).max(120), fromCut: z.number().int().min(0) }).strict())
6706
+ .optional()
6707
+ .describe('Headings on the Script page, each before the cut it starts at (hook, problem, offer...).'),
6708
+ roles: z
6709
+ .array(z
6710
+ .object({
6711
+ name: z.string().min(1).max(80),
6712
+ kind: z.enum(['person', 'location', 'product']).optional(),
6713
+ itemId: z.string().min(1).optional().describe('A Library item of this project (slates_list_library) to use for the role.'),
6714
+ cuts: z.array(z.number().int().min(0)).describe('The cut indices the role appears in.'),
6715
+ })
6716
+ .strict())
6717
+ .optional()
6718
+ .describe('Who or what recurs. Without itemId a role becomes a new Library item to fill in.'),
6719
+ jobId: z.string().min(1).max(120).optional().describe('A name for this run, so a later call with cancel can stop it.'),
6720
+ cancel: z.boolean().optional().describe('true: stop the run named by jobId instead of starting one.'),
6721
+ })
6722
+ .strict(),
6723
+ async run(input, ctx) {
6724
+ await ctx.desktop().requireCapability('reference-breakdown', 'breaking a reference ad into shots');
6725
+ if (input.cancel) {
6726
+ if (!input.jobId)
6727
+ throw new Error('cancel stops a run by its jobId: give the jobId the breakdown was started with.');
6728
+ await ctx.desktop().requireCapability('reference-cancel', 'stopping a reference breakdown');
6729
+ const c = await ctx.desktop().post('/agent/reference/cancel', { jobId: input.jobId });
6730
+ return ok(c, c.cancelled ? `Stopping breakdown ${c.jobId}: it ends at its next step, its frames and any fetched video removed.` : `Nothing to stop: no breakdown named ${c.jobId} is running, or it has reached its board build, which finishes and keeps the board.`);
6731
+ }
6732
+ if (input.jobId)
6733
+ await ctx.desktop().requireCapability('reference-cancel', 'naming a reference breakdown so it can be stopped');
6734
+ if ([input.assetId, input.filePath, input.url].filter(Boolean).length !== 1) {
6735
+ throw new Error('Give exactly one of assetId (a video or picture in the project), filePath or url.');
6736
+ }
6737
+ const assetId = input.assetId ? (await resolveAssetRefs(ctx, input.projectId, [input.assetId])).get(input.assetId).id : input.assetId;
6738
+ const r = await ctx.desktop().post('/agent/reference/breakdown', { ...input, assetId, cancel: undefined });
6739
+ const cuts = r.breakdown.segments.length;
6740
+ const fetched = r.source ? `Fetched the ${r.source.kind === 'meta' ? 'Meta Ad Library ad' : 'video link'} into Media as ${r.breakdown.sourceCode ?? 'a video'}. ` : '';
6741
+ const head = r.board
6742
+ ? `Board ${r.board.storyboardId} built: ${r.board.shotCodes.length} Shot${r.board.shotCodes.length === 1 ? '' : 's'} (${r.board.shotCodes.join(', ')}), nothing generated.${r.board.timing.length ? ` Timing: ${r.board.timing.join(' ')}` : ''}`
6743
+ : `${cuts} cut${cuts === 1 ? '' : 's'} found in ${r.breakdown.sourceCode ?? 'the reference'}; frames saved, no board yet.`;
6744
+ return ok(r, `${fetched}${head} ${JSON.stringify(r)}`);
6745
+ },
6746
+ };
6747
+ // ── Product intake ──────────────────────────────────────────────────────
6748
+ // A product page becomes Library items a remade ad's roles can use: the product
6749
+ // (a thing, with its pictures) and its brand (a look, with its logo and colours).
6750
+ // Read and write are two tools so a host can auto-approve the read.
6751
+ export const getProductPage = {
6752
+ id: 'slates_get_product_page',
6753
+ description: "Read a product page without changing anything: the product's name, description, brand, slogan, price, pictures, logo candidates, the brand's declared colours and the page's bullet points, each with where it came from (json-ld product data, a Shopify store's product data, open-graph sharing tags, other meta tags, or the page's own pictures by size), plus notes on what the page lacks. The desktop fetches the page itself (public addresses only, no browser, nothing signed in). A page that builds itself with JavaScript, an ad library link, a post, or a link to a picture or video file is refused with the reason. Free; writes nothing. Read here first when the user names a product page, then make the product with slates_import_product.",
6754
+ input: z
6755
+ .object({
6756
+ url: z.string().url().describe("The product page, such as a shop's /products/... page."),
6757
+ })
6758
+ .strict(),
6759
+ async run(input, ctx) {
6760
+ await ctx.desktop().requireCapability('product-intake', 'reading product pages');
6761
+ return ok(await ctx.desktop().get('/agent/library/intake', { url: input.url }));
6762
+ },
6763
+ };
6764
+ export const importProduct = {
6765
+ id: 'slates_import_product',
6766
+ billable: false,
6767
+ description: "Add a product to the Library from its page, as the app's Add as product does: the product becomes a thing (in Products, or the things categoryId given) with the page's first picture as its picture, the next ones as its extra pictures and the page's bullet points, price and link as its notes; its brand becomes a look with the brand's logo as its picture and the page's and logo's colours as its palette. A look of the same name already in the Library is filled in where empty, never overwritten. Pictures land in a Media folder named after the product. Give url, filePaths (absolute paths to pictures on this computer, the product's first), or both. html is the page's HTML when you already have it (a page that builds itself with JavaScript, read in your own browser); url still names the page and its pictures are still fetched. Free; nothing is generated. The result gives the product and the brand with their mention (@name, #name) for prompts and for slates_break_down_reference roles (itemId), each picture and where it came from, each picture left out with its reason, and notes on what the page lacked.",
6768
+ input: z
6769
+ .object({
6770
+ projectId: z.string().uuid(),
6771
+ url: z.string().url().optional().describe('The product page.'),
6772
+ html: z.string().min(1).optional().describe("The page's HTML, read instead of fetching the page. Needs url."),
6773
+ filePaths: z.array(z.string().min(1)).optional().describe('Absolute paths to pictures of the product on this computer, first in the order given.'),
6774
+ name: z.string().min(1).max(120).optional().describe("The product's name. Defaults to the page's, else the first file's."),
6775
+ categoryId: z.string().uuid().optional().describe('A things category (slates_list_library) to file the product in. Defaults to Products.'),
6776
+ brand: z.boolean().optional().describe('false: make no look for the brand. Default true.'),
6777
+ maxPictures: z.number().int().min(1).optional().describe('How many pictures to fetch from the page. Default 6; the desktop takes at most 12.'),
6778
+ })
6779
+ .strict(),
6780
+ async run(input, ctx) {
6781
+ await ctx.desktop().requireCapability('product-intake', 'adding products from their pages');
6782
+ if (!input.url && !input.filePaths?.length)
6783
+ throw new Error('Give url (the product page), filePaths (pictures on this computer), or both.');
6784
+ if (input.html && !input.url)
6785
+ throw new Error('html needs url: the address the page came from.');
6786
+ const r = await ctx.desktop().post('/agent/library/intake', input);
6787
+ const brand = r.brand ? ` Its brand ${r.brand.mention} ${r.brandReused ? 'was already in the Library and was filled in' : 'is a new look'}.` : '';
6788
+ const left = r.skipped.length ? ` ${r.skipped.length} picture${r.skipped.length === 1 ? '' : 's'} left out (see skipped).` : '';
6789
+ const head = `Added ${r.product.mention} with ${r.pictures.length} picture${r.pictures.length === 1 ? '' : 's'}.${brand}${left}${r.notes.length ? ` ${r.notes.join(' ')}` : ''}`;
6790
+ return ok(r, `${head} ${JSON.stringify(r)}`);
6791
+ },
6792
+ };
5412
6793
  export const updateStoryboard = {
5413
6794
  id: 'slates_update_storyboard',
5414
6795
  description: 'Update a board\'s name and/or description.',
5415
6796
  input: z.object({
5416
6797
  storyboardId: z.string().uuid(),
5417
- name: z.string().min(1).max(120).optional(),
6798
+ name: z.string().min(1).max(80).optional(),
5418
6799
  description: z.string().optional(),
5419
6800
  }),
5420
6801
  async run(input, ctx) {
@@ -5426,7 +6807,7 @@ export const updateStoryboard = {
5426
6807
  };
5427
6808
  export const deleteStoryboard = {
5428
6809
  id: 'slates_delete_storyboard',
5429
- description: 'Delete a board with all its scenes and frames (the referenced assets are untouched).',
6810
+ description: 'Delete a board with all its scenes and Shots; the media they made stays, and a Shot that also sits on another board survives. The app cannot undo this, so confirm with the user first.',
5430
6811
  input: z.object({ storyboardId: z.string().uuid() }),
5431
6812
  async run(input, ctx) {
5432
6813
  return ok(await ctx.desktop().post('/agent/storyboards/delete', { id: input.storyboardId }));
@@ -5449,7 +6830,7 @@ export const updateScene = {
5449
6830
  };
5450
6831
  export const deleteScene = {
5451
6832
  id: 'slates_delete_scene',
5452
- description: 'Delete a scene (and its frames) from a board.',
6833
+ description: 'Delete a scene and every Shot in it; the pictures and clips they made stay in Media. The app cannot undo this, so confirm with the user first. To drop only the scene break and keep its Shots, use slates_merge_scene.',
5453
6834
  input: z.object({ sceneId: z.string().uuid() }),
5454
6835
  async run(input, ctx) {
5455
6836
  return ok(await ctx.desktop().post('/agent/scenes/delete', { id: input.sceneId }));
@@ -5473,12 +6854,12 @@ export const updateFrame = {
5473
6854
  // of what the Shot in this slot already encodes — the image's role and the
5474
6855
  // beat's words — and they were backfilled into Shots on 2026-08-31. Use
5475
6856
  // slates_update_shot for either.
5476
- 'Update a slot: its shot label, notes, bound asset (assetId=null unbinds), scene or position. A scene or position change carries the words in this slot with it on the Script page. preferredClipId picks the clip the timeline takes for this slot (a video asset id or VID code; null goes back to the slot\'s most recent linked clip), as the take menu\'s "Use in the timeline" does. The BEAT — its line, references, model, prompt and framing — lives on the Shot in this slot; use slates_update_shot for that.',
6857
+ 'Update a slot: its shot label, notes, bound asset (assetId=null unbinds), scene or position. A scene or position change carries the words in this slot with it on the Script page. preferredClipId picks the clip the timeline takes for this slot (a video asset id or VID code; null goes back to the newest linked video), as the take menu\'s "Use in the timeline" does. The BEAT — its line, references, model, prompt and framing — lives on the Shot in this slot; use slates_update_shot for that.',
5477
6858
  input: z.object({
5478
6859
  frameId: z.string().uuid(),
5479
6860
  shotLabel: z.string().optional(),
5480
6861
  notes: z.string().optional(),
5481
- assetId: z.string().uuid().nullable().optional(),
6862
+ assetId: z.string().uuid().nullable().optional().describe(ASSET_UUID_ONLY),
5482
6863
  sceneId: z.string().uuid().optional(),
5483
6864
  position: z.number().int().min(0).optional(),
5484
6865
  preferredClipId: z.string().min(1).nullable().optional().describe('The clip the timeline takes for this slot: a video asset id or badge code in the project; null clears it.'),
@@ -5522,7 +6903,7 @@ export const batchUpdateFrames = {
5522
6903
  frameId: z.string().uuid(),
5523
6904
  shotLabel: z.string().optional(),
5524
6905
  notes: z.string().optional(),
5525
- assetId: z.string().uuid().nullable().optional(),
6906
+ assetId: z.string().uuid().nullable().optional().describe(ASSET_UUID_ONLY),
5526
6907
  sceneId: z.string().uuid().optional(),
5527
6908
  position: z.number().int().min(0).optional(),
5528
6909
  preferredClipId: z.string().min(1).nullable().optional().describe('A video asset id or badge code in the project; null clears it.'),
@@ -5550,7 +6931,7 @@ export const batchUpdateFrames = {
5550
6931
  };
5551
6932
  export const deleteFrame = {
5552
6933
  id: 'slates_delete_frame',
5553
- description: 'Delete a frame from its scene (the referenced asset is untouched).',
6934
+ description: 'Delete a Shot by deleting its slot (frame): this is the delete-Shot tool, and it also removes an exploration slot. The takes stay in Media. The user can press Ctrl+Z in the app to bring a deleted Shot back.',
5554
6935
  input: z.object({ frameId: z.string().uuid() }),
5555
6936
  async run(input, ctx) {
5556
6937
  return ok(await ctx.desktop().post('/agent/frames/delete', { id: input.frameId }));
@@ -5627,13 +7008,13 @@ function shotParamsShape(described) {
5627
7008
  duration: d(z.number().int().min(1).max(360).optional(), 'Seconds for video or duration-based audio; TTS uses text length.'),
5628
7009
  videoResolution: d(zEnum(VIDEO_RESOLUTIONS).optional(), 'Validated against the model when the Shot is saved.'),
5629
7010
  imageResolution: d(z.enum(['1k', '2k', '3k', '4k']).optional(), 'Image models only.'),
5630
- gptQuality: d(z.enum(GPT_QUALITY_TIERS).optional(), 'GPT Image 2.5 only.'),
7011
+ gptQuality: d(z.enum(GPT_QUALITY_TIERS).optional(), `${IMAGE_MODELS.filter(isGptImageModel).join(', ')} only.`),
5631
7012
  gptBackground: d(z.enum(GPT_BACKGROUNDS).optional(), 'GPT Image only.'),
5632
7013
  detachedVoiceCharacterIds: z.array(z.string()).optional().describe('Character voices removed from this recipe.'),
5633
7014
  imageQuantity: d(z.number().int().min(1).max(10).optional(), 'Image models only.'),
5634
7015
  negativePrompt: z.string().optional(),
5635
7016
  sound: d(z.boolean().optional(), 'Video models that co-generate audio.'),
5636
- seedanceFace: d(z.boolean().optional(), "Seedance only — a reference shows an AI character's FACE; without it faces are blocked, and it costs ~45% more."),
7017
+ seedanceFace: d(z.boolean().optional(), "Seedance only — a reference shows an AI character's face; without it faces are blocked. The estimate prices it."),
5637
7018
  audioDurationSeconds: d(z.number().int().min(1).max(120).optional(), 'Audio lane. On seed-audio the requested duration IS the bill.'),
5638
7019
  // The TTS voice — the same three fields slates_generate_audio takes, so a
5639
7020
  // Shot is the audio call, serialized. Exactly one of them, enforced at fire.
@@ -5919,7 +7300,7 @@ async function loadDynamicPrice(ctx, byKey, key) {
5919
7300
  }
5920
7301
  export const createShot = {
5921
7302
  id: 'slates_create_shot',
5922
- description: 'Write one beat of the piece — a Shot: its script line, its references with their roles, its model and params, and the prompt that fires. It needs NO image to exist, so a whole film can be written, arranged and priced before anything is generated. It lands in the board automatically (the open scene, else the most recent board) — never unfiled. ' +
7303
+ description: 'Write one beat of the piece — a Shot: its script line, its references with their roles, its model and params, and the prompt that fires. It needs NO image to exist, so a whole film can be written, arranged and priced before anything is generated. It lands in the board automatically (the open scene, else the most recent board) — never unfiled. Saves only: it generates and spends nothing; price with slates_get_board_quote and fire with slates_generate_from_shots after the user approves. ' +
5923
7304
  FRAMING_NOTE,
5924
7305
  input: z.object({
5925
7306
  projectId: z.string().uuid(),
@@ -6024,7 +7405,7 @@ async function boardSoFar(desktop, where) {
6024
7405
  }
6025
7406
  export const updateShot = {
6026
7407
  id: 'slates_update_shot',
6027
- description: 'Change part of a Shot, or attach/detach it from a board frame — anything you omit is left exactly as it was. ' +
7408
+ description: 'Change part of a Shot, or attach/detach it from a board frame — anything you omit is left exactly as it was. Saves only: it generates and spends nothing. ' +
6028
7409
  FRAMING_NOTE,
6029
7410
  input: z.object({
6030
7411
  shotId: z.string().describe('The Shot id, or its SHOT-A code as shown on the row.'),
@@ -6165,7 +7546,7 @@ function describeVarietyReport(v) {
6165
7546
  }
6166
7547
  export const listShots = {
6167
7548
  id: 'slates_list_shots',
6168
- description: "Read the shot list — every Shot as a compact row IN BOARD ORDER (scene, then position), with its place on the board (2C: scene number and slot letter, as the window shows it and the user says it), the piece's cut count, runtime, saved-recipe price and its variety distribution. Read this before firing a set: if one shot size is the plurality or three cuts in a row share a camera move, the batch is wrong before a credit is spent.",
7549
+ description: "Read the shot list — every Shot as a compact row in board order (scene, then position), with its place on the board (2C: scene number and slot letter, as the window shows it and the user says it), the piece's cut count, runtime, saved-recipe price and its variety distribution. Read this before firing a set: if one shot size is the plurality or three cuts in a row share a camera move, the batch is wrong before a credit is spent.",
6169
7550
  input: z.object({
6170
7551
  projectId: z.string().uuid(),
6171
7552
  storyboardId: z.string().uuid().optional().describe('Only Shots attached to a frame in this board.'),
@@ -6345,7 +7726,7 @@ export const splitShot = {
6345
7726
  };
6346
7727
  export const splitTake = {
6347
7728
  id: 'slates_split_take',
6348
- description: "A take founds its own Shot. The result (a take under `shotId`) moves to a NEW Shot whose recipe is the take's RECORDED one — the prompt, model, params and references it was actually made from, which may differ from what the source Shot says now. The new Shot lands directly after the source by default; the source keeps its other takes and its recipe untouched, and is never deleted when emptied. Script fields (line, speaker) start empty on the new row.",
7729
+ description: "Move a take to a NEW Shot made from its recorded recipe (to move it to an existing Shot, use slates_refile_take). The result (a take under `shotId`) moves to a new Shot whose recipe is the take's RECORDED one — the prompt, model, params and references it was actually made from, which may differ from what the source Shot says now. The new Shot lands directly after the source by default; the source keeps its other takes and its recipe untouched, and is never deleted when emptied. Script fields (line, speaker) start empty on the new row.",
6349
7730
  input: z.object({
6350
7731
  shotId: z.string().describe('The source Shot id, or its SHOT-A code.'),
6351
7732
  assetId: z.string().describe('The take to move — an asset id or its IMG-A / VID-A code. Must be a take of `shotId`.'),
@@ -6365,7 +7746,7 @@ export const splitTake = {
6365
7746
  };
6366
7747
  export const refileTake = {
6367
7748
  id: 'slates_refile_take',
6368
- description: 'Move a take (a result) from one Shot to another in the same project. Only the attribution moves: neither Shot\'s recipe changes, the asset stays where it is in Media, and a clip that a frame prefers keeps that role. `fromShotId` is a guard — the take moves only if it still hangs under that Shot (omit it to claim an unattributed result). An emptied Shot is kept, never deleted.',
7749
+ description: 'Move a take (a result) from one Shot to another in the same project. Only the attribution moves: neither Shot\'s recipe changes, the asset stays where it is in Media, and a clip that a frame prefers keeps that role. `fromShotId` is a guard — the take moves only if it still hangs under that Shot (omit it to claim an unattributed result). An emptied Shot is kept, never deleted. To start a new Shot from the take, use slates_split_take.',
6369
7750
  input: z.object({
6370
7751
  assetId: z.string().describe('The take — an asset id or its IMG-A / VID-A code.'),
6371
7752
  fromShotId: z.string().nullable().optional().describe('The Shot it hangs under now (id or SHOT-A code). Omitted or null = an unattributed result.'),
@@ -6382,7 +7763,7 @@ export const refileTake = {
6382
7763
  };
6383
7764
  export const mergeShots = {
6384
7765
  id: 'slates_merge_shots',
6385
- description: "Merge two adjacent Shots into one. Texts join, references union, the FIRST Shot's model and params win, and the durations SUM — which may exceed the model's window, in which case it is shown and never blocked. Lossy in one direction: the second Shot's model and params are discarded, and there is no undo (the takes are the history).",
7766
+ description: "Merge two adjacent Shots into one. Texts join, references union, the FIRST Shot's model and params win, and the durations SUM — which may exceed the model's window, in which case it is shown and never blocked. Lossy in one direction: the second Shot's model and params are discarded. There is no undo op; the user can press Ctrl+Z in the app straight after, and the takes stay as the history.",
6386
7767
  input: z.object({
6387
7768
  firstId: z.string().describe('The Shot that survives — its model and params win. Id or SHOT-A code.'),
6388
7769
  secondId: z.string().describe('The Shot folded into it. Id or SHOT-A code.'),
@@ -6406,7 +7787,7 @@ export const mergeShots = {
6406
7787
  // it; read before you write, because every edit moves what follows it.
6407
7788
  export const getScript = {
6408
7789
  id: 'slates_get_script',
6409
- description: "A scene's script — the ONE text its Shots' lines are ranges of — with every ranged Shot's [start, end) offsets and code. Read this before slates_edit_script or slates_make_shot_from_script: offsets are character positions into exactly this text. Text no Shot holds is unshot; a Shot listed by slates_list_shots but absent here has no words on the page yet. `rev` names this exact text and `revision` the whole script document: pass either to slates_edit_script so an edit measured on it is refused, not misplaced, if the words changed in between (1.6.0 desktops; older ones return neither).",
7790
+ description: "A scene's script, the one text its Shots' lines are ranges of, with every ranged Shot's [start, end) offsets and code. For the whole board's document (headings, formatting, every scene) use slates_get_script_document. Read this before slates_edit_script or slates_make_shot_from_script: offsets are character positions into exactly this text. Text no Shot holds is unshot; a Shot listed by slates_list_shots but absent here has no words on the page yet. `rev` names this exact text and `revision` the whole script document: pass either to slates_edit_script so an edit measured on it is refused, not misplaced, if the words changed in between.",
6410
7791
  input: z.object({
6411
7792
  sceneId: z.string().uuid().describe('The scene (slates_get_storyboard_with_frames lists them, each with its script).'),
6412
7793
  }),
@@ -6418,12 +7799,16 @@ export const getScript = {
6418
7799
  },
6419
7800
  };
6420
7801
  const variationSchema = z.object({
6421
- storyboardId: z.string().uuid(), expectedRevision: z.number().int().nonnegative(), name: z.string().min(1),
6422
- choices: z.array(z.object({ sectionId: z.string().uuid(), alternativeId: z.string().uuid() })),
7802
+ storyboardId: z.string().uuid(),
7803
+ expectedRevision: z.number().int().nonnegative().describe('The revision from slates_get_script_document; a stale one is refused.'),
7804
+ name: z.string().min(1),
7805
+ choices: z.array(z.object({ sectionId: z.string().uuid(), alternativeId: z.string().uuid() })).describe('One saved version per section, ids from slates_get_script_sections.'),
6423
7806
  arrangement: z.array(z.object({ sectionId: z.string().uuid(), alternativeId: z.string().uuid() })).optional(),
6424
- itemOverrides: z.array(z.object({ from: z.string().uuid(), to: z.string().uuid(), voice: z.enum(['keep', 'replace']) })).optional(),
6425
- assetOverrides: z.array(z.object({ from: z.string().min(1), to: z.string().min(1) })).optional(),
6426
- idempotencyKey: z.string().min(1).optional(),
7807
+ itemOverrides: z.array(z.object({ from: z.string().uuid(), to: z.string().uuid(), voice: z.enum(['keep', 'replace']) })).optional()
7808
+ .describe("Swap one Library item for another of the same kind and role, a person for a person, a location for a location (item ids). voice keep: the replaced item's voice stays on the Shots it speaks in; replace: it does not carry over."),
7809
+ assetOverrides: z.array(z.object({ from: z.string().min(1), to: z.string().min(1) })).optional()
7810
+ .describe('Swap one asset for another of the same type (ids or badge codes).'),
7811
+ idempotencyKey: z.string().min(1).optional().describe('Required to create: a retry with the same key and choices returns the same Board.'),
6427
7812
  });
6428
7813
  export const previewScriptVariation = {
6429
7814
  id: 'slates_preview_script_variation', description: 'Preview explicit version choices (one saved version per section) and independent ID-based reference replacements without writes or generation. An optional ordered arrangement supports repetition and omission. Returns composed requests, custom-prompt/reference warnings, a quote, and a plan marking each shot reuse (a finished take with matching inputs exists) or new. Inspect only the combinations you need.',
@@ -6434,7 +7819,7 @@ export const previewScriptVariation = {
6434
7819
  },
6435
7820
  };
6436
7821
  export const createScriptVariation = {
6437
- id: 'slates_create_script_variation', description: 'Materialize one reviewed variation as an independent Board with local shot IDs and lineage. Requires idempotencyKey; retry returns the same Board. Returns a quote through the normal request service. No media generation or implicit take reuse.',
7822
+ id: 'slates_create_script_variation', description: 'Materialize one reviewed variation as an independent Board with local shot IDs and lineage. Pass idempotencyKey: a retry with the same key returns the same Board. Returns a quote through the normal request service. No media generation or implicit take reuse.',
6438
7823
  input: variationSchema,
6439
7824
  async run(input, ctx) {
6440
7825
  await ctx.desktop().requireCapability('script-documents', 'script documents and variations');
@@ -6450,7 +7835,7 @@ async function resolveVariationRefs(input, ctx) {
6450
7835
  }
6451
7836
  export const getScriptUses = {
6452
7837
  id: 'slates_get_script_uses',
6453
- description: 'Review each reused passage before updating it: current and proposed words, destination revision, and local-edit conflicts. Pass only explicitly selected non-conflicting uses to slates_update_script_section.',
7838
+ description: 'Review each reused passage before updating it: current and proposed words, destination revision, and local-edit conflicts. Pass only explicitly selected non-conflicting uses to slates_update_script_section (updateUses). sectionId comes from slates_get_script_sections.',
6454
7839
  input: z.object({ sectionId: z.string().uuid() }),
6455
7840
  async run(input, ctx) {
6456
7841
  await ctx.desktop().requireCapability('script-documents', 'script documents');
@@ -6459,7 +7844,7 @@ export const getScriptUses = {
6459
7844
  };
6460
7845
  export const getShotInputs = {
6461
7846
  id: 'slates_get_shot_inputs',
6462
- description: 'Read take input history and compatible reusable media. Earlier and unknown inputs remain playable; they are never treated as a fresh match. No generation.',
7847
+ description: 'Read this Shot\'s take input history and the finished takes elsewhere in the project made from its exact inputs; add one free with slates_reuse_shot_take. Earlier and unknown inputs remain playable but never count as a match. No generation.',
6463
7848
  input: z.object({ projectId: z.string().uuid(), shotId: z.string() }),
6464
7849
  async run(input, ctx) {
6465
7850
  await ctx.desktop().requireCapability('script-documents', 'script documents');
@@ -6468,7 +7853,7 @@ export const getShotInputs = {
6468
7853
  };
6469
7854
  export const reuseShotTake = {
6470
7855
  id: 'slates_reuse_shot_take',
6471
- description: 'Explicitly link a take with matching saved request and recipe inputs to this shot. Keeps the original generation and independent shot recipe. Input changes are rechecked before reuse; costs no credits.',
7856
+ description: 'Explicitly link a take with matching saved request and recipe inputs to this shot. Keeps the original generation and independent shot recipe. Input changes are rechecked before reuse; costs no credits. Find candidates with slates_get_shot_inputs; slates_refile_take moves a take instead.',
6472
7857
  input: z.object({ projectId: z.string().uuid(), shotId: z.string(), assetId: z.string().describe('Asset UUID or badge code from compatibleTakes.') }),
6473
7858
  async run(input, ctx) {
6474
7859
  await ctx.desktop().requireCapability('script-documents', 'script documents');
@@ -6486,15 +7871,23 @@ export const getScriptSections = {
6486
7871
  },
6487
7872
  };
6488
7873
  const sectionInput = z.object({
6489
- storyboardId: z.string().uuid(), expectedRevision: z.number().int().min(0), action: z.enum(['create', 'alternative', 'choose', 'save', 'reuse', 'updateUses', 'rename', 'archive', 'tags']),
6490
- sectionId: z.string().uuid().optional(), alternativeId: z.string().uuid().optional(), parentId: z.string().uuid().optional(), label: z.string().optional(),
7874
+ storyboardId: z.string().uuid(),
7875
+ expectedRevision: z.number().int().min(0).describe('The revision from slates_get_script_document; a stale one is refused.'),
7876
+ action: z.enum(['create', 'alternative', 'choose', 'save', 'reuse', 'updateUses', 'rename', 'archive', 'tags']),
7877
+ sectionId: z.string().uuid().optional().describe('Every action except create.'),
7878
+ alternativeId: z.string().uuid().optional(),
7879
+ parentId: z.string().uuid().optional().describe('create: a section that contains this passage.'),
7880
+ label: z.string().optional().describe('The name: required for create and alternative, and for rename.'),
6491
7881
  tags: z.array(z.string()).max(20).optional().describe('Free tags for action tags; replaces the list.'),
6492
- target: z.object({ sceneId: z.string().uuid(), at: z.number().int().min(0), expectedRevision: z.number().int().min(0) }).optional(),
6493
- uses: z.array(z.object({ sectionId: z.string().uuid(), expectedRevision: z.number().int().min(0) })).optional(),
6494
- fragments: z.array(z.object({ sceneId: z.string().uuid(), start: z.number().int().min(0), end: z.number().int().min(0) })).optional(),
7882
+ target: z.object({ sceneId: z.string().uuid(), at: z.number().int().min(0), expectedRevision: z.number().int().min(0) }).optional()
7883
+ .describe("reuse: the scene the copy goes into, the place in its text, and that board's document revision."),
7884
+ uses: z.array(z.object({ sectionId: z.string().uuid(), expectedRevision: z.number().int().min(0) })).optional()
7885
+ .describe('updateUses: the copies to update, with the revisions slates_get_script_uses returns.'),
7886
+ fragments: z.array(z.object({ sceneId: z.string().uuid(), start: z.number().int().min(0), end: z.number().int().min(0) })).optional()
7887
+ .describe('create: the passage, as ranges of scene text.'),
6495
7888
  });
6496
7889
  export const changeScriptSection = {
6497
- id: 'slates_update_script_section', description: 'Create a free-named section from a selected passage, save the words now on the page as a new version (action alternative), save changes to the shown version (save) or choose another (choose), insert an editable copy (reuse), update unedited copies (updateUses), rename or archive a section or one version (alternativeId), or set its free tags. Choosing, archiving a section, reuse and updateUses first save the page\'s words and shot bindings into the version that was showing (the page is never unsaved; save remains for an explicit save), and only alternative starts a new version; archiving a section keeps its words, shots and media on the page. Uses the current document revision and never generates media. Partial crossing sections are refused.',
7890
+ id: 'slates_update_script_section', description: 'Create a free-named section from a selected passage, save the words now on the page as a new version (action alternative), save changes to the shown version (save) or choose another (choose), insert an editable copy (reuse), update unedited copies (updateUses), rename or archive a section or one version (alternativeId), or set its free tags (action tags). Choosing, archiving a section, reuse and updateUses first save the page\'s words and shot bindings into the version that was showing (the page is never unsaved; save remains for an explicit save), and only alternative starts a new version; archiving a section keeps its words, shots and media on the page. Uses the current document revision and never generates media. Partial crossing sections are refused.',
6498
7891
  input: sectionInput,
6499
7892
  async run(input, ctx) {
6500
7893
  await ctx.desktop().requireCapability('script-documents', 'script documents');
@@ -6531,7 +7924,7 @@ const documentBlocks = z.array(z.object({
6531
7924
  }));
6532
7925
  export const getScriptDocument = {
6533
7926
  id: 'slates_get_script_document',
6534
- description: 'Read the whole script document: scene strings, UTF-16 block/shot anchors, non-spoken headings/directions and a revision for safe writes. Formatting metadata contains no second copy of paragraph text.',
7927
+ description: 'Read the whole script document: scene strings, UTF-16 block/shot anchors, non-spoken headings/directions and a revision for safe writes. Formatting metadata contains no second copy of paragraph text. slates_get_script reads one scene\'s text with its Shot offsets.',
6535
7928
  input: z.object({ storyboardId: z.string().uuid() }),
6536
7929
  async run(input, ctx) {
6537
7930
  await ctx.desktop().requireCapability('script-documents', 'script documents');
@@ -6550,7 +7943,7 @@ const writeScriptDocumentInput = z.object({
6550
7943
  });
6551
7944
  export const writeScriptDocument = {
6552
7945
  id: 'slates_update_script_document',
6553
- description: 'Apply ordered script edits and optional formatting in one revision-checked transaction. Read the document first. Stale writes are refused without replacing either author’s work. A move carries contained shot anchors; restoreRevision restores an existing text/structure revision. No generation side effect. ensureScene creates an empty scene only if needed.',
7946
+ description: 'Several script changes in one revision-checked write: ordered text edits across scenes, formatting, moving a block, making Shots from ranges (makeShots), splitting or merging scenes (sceneAction). For one text replacement in one scene use slates_edit_script. Read the document first. Stale writes are refused without replacing either author’s work. A move carries contained shot anchors; restoreRevision restores an existing text/structure revision. No generation side effect. ensureScene creates an empty scene only if needed.',
6554
7947
  input: writeScriptDocumentInput,
6555
7948
  async run(input, ctx) {
6556
7949
  await ctx.desktop().requireCapability('script-documents', 'script documents');
@@ -6560,7 +7953,7 @@ export const writeScriptDocument = {
6560
7953
  };
6561
7954
  export const editScript = {
6562
7955
  id: 'slates_edit_script',
6563
- description: "Edit a scene's script: ONE contiguous replacement — `removed` characters at `at` become `text` (insert: removed 0; delete: text ''). Every Shot's range follows the way comment anchors follow a document: text before a Shot moves it, text after leaves it, an edit inside grows or shrinks it, typing at its end extends it unless the text starts a new line, and deleting all of a Shot's words leaves it with no words and no place on the page. Every affected Shot's `line` changes at once — this IS editing the Shots. Read slates_get_script first; offsets are into that text. Pass its `rev` (or the document `revision` as `expectedRevision`): when the Script page or anything else changed the words since, the edit is refused ('the script changed since you read it', or SCRIPT_CONFLICT for a stale revision), and you re-read and measure again. The result carries the new `rev` and `revision` for a following edit.",
7956
+ description: "One text replacement in one scene (for several edits, formatting or scene changes in one write, use slates_update_script_document): one contiguous replacement — `removed` characters at `at` become `text` (insert: removed 0; delete: text ''). Every Shot's range follows the way comment anchors follow a document: text before a Shot moves it, text after leaves it, an edit inside grows or shrinks it, typing at its end extends it unless the text starts a new line, and deleting all of a Shot's words leaves it with no words and no place on the page. Every affected Shot's `line` changes at once: this is editing the Shots. Read slates_get_script first; offsets are into that text. Pass its `rev` (or the document `revision` as `expectedRevision`): when the Script page or anything else changed the words since, the edit is refused ('the script changed since you read it', or SCRIPT_CONFLICT for a stale revision), and you re-read and measure again. The result carries the new `rev` and `revision` for a following edit.",
6564
7957
  input: z.object({
6565
7958
  sceneId: z.string().uuid(),
6566
7959
  expectedRevision: z.number().int().nonnegative().optional().describe('The document `revision` slates_get_script or slates_get_script_document returned. The edit is refused if the document changed since.'),
@@ -6578,7 +7971,7 @@ export const editScript = {
6578
7971
  };
6579
7972
  export const makeShotFromScript = {
6580
7973
  id: 'slates_make_shot_from_script',
6581
- description: "Do the ONE thing a selection of the script can mean, exactly as the Script page's popover does: Make shot when the selection touches no Shot; Split when it lies inside one Shot (the Shot keeps its first piece and its takes, every other piece becomes a new Shot after it); Extend when it crosses one Shot's edge; Merge when it spans several (the first takes the span — unshot text between them included, nothing deleted — the others give up their words: one holding a take (finished or generating), a prompt, a reference or a picture stays and waits for text; only a completely blank one is removed). Pass `waitingShotId` to give a Shot that has no words yet (made on the Board, split off a take) the selected text instead. `perParagraph: true` over several unshot paragraphs makes one Shot per paragraph. A new Shot is filed after every ranged Shot whose words start before it.",
7974
+ description: "Turn a selected passage of a scene's script into Shots, as the Script page's popover does; start and end are offsets into slates_get_script's text. The action follows what the selection touches: Make shot when the selection touches no Shot; Split when it lies inside one Shot (the Shot keeps its first piece and its takes, every other piece becomes a new Shot after it); Extend when it crosses one Shot's edge; Merge when it spans several (the first takes the span — unshot text between them included, nothing deleted — the others give up their words: one holding a take (finished or generating), a prompt, a reference or a picture stays and waits for text; only a completely blank one is removed). Pass `waitingShotId` to give a Shot that has no words yet (made on the Board, split off a take) the selected text instead. `perParagraph: true` over several unshot paragraphs makes one Shot per paragraph. A new Shot is filed after every ranged Shot whose words start before it.",
6582
7975
  input: z.object({
6583
7976
  sceneId: z.string().uuid(),
6584
7977
  start: z.number().int().min(0),
@@ -6612,7 +8005,7 @@ export const breakScriptIntoShots = {
6612
8005
  };
6613
8006
  export const splitScene = {
6614
8007
  id: 'slates_split_scene',
6615
- description: "Open a scene at a heading line, the Notion way: the text from `lineEnd` on moves into a NEW scene directly after this one, with its Shots and their slots; the heading line [lineStart, lineEnd) itself is consumed and `name` becomes the new scene's name. Use slates_paste_script to do this for every SCENE / INT. / EXT. / # line of a pasted script at once.",
8008
+ description: "Open a scene at a heading line: the text from `lineEnd` on moves into a NEW scene directly after this one, with its Shots and their slots; the heading line [lineStart, lineEnd) itself is consumed and `name` becomes the new scene's name. Use slates_paste_script to do this for every SCENE / INT. / EXT. / # line of a pasted script at once.",
6616
8009
  input: z.object({
6617
8010
  sceneId: z.string().uuid(),
6618
8011
  lineStart: z.number().int().min(0).describe('Offset where the heading line starts.'),
@@ -6660,10 +8053,10 @@ const DRAFT_INPUT = z
6660
8053
  export const generateFromShots = {
6661
8054
  id: 'slates_generate_from_shots',
6662
8055
  billable: true,
6663
- description: 'Preview the itemized prices the Generate panel shows for saved Shots. After explicit approval, pass confirm and the returned fingerprint. Changed recipes require a fresh price. Runs sequentially; after a timeout inspect generations instead of re-firing. Pass draft to generate previews instead: one picture for each Shot that has none, never saved to the Shot.',
8056
+ description: 'Generate results for saved Shots, spending credits. Call without confirm for the itemized prices the Generate panel shows and a fingerprint; show the user the total and wait for their OK, then pass confirm with that fingerprint. Changed recipes require a fresh price. Runs sequentially; after a timeout inspect generations (slates_list_generations, status processing) instead of re-firing. Pass draft to generate previews instead: one picture for each Shot that has none, kept as a take of that Shot; the Shot\'s recipe does not change.',
6664
8057
  input: z.object({
6665
8058
  shotIds: z.array(z.string()).min(1).max(20),
6666
- confirm: z.boolean().optional(),
8059
+ confirm: z.boolean().optional().describe(CONFIRM_PARAM + " Pass it with the quote's fingerprint."),
6667
8060
  fingerprint: z.string().optional(),
6668
8061
  draft: DRAFT_INPUT.describe('Generate previews: pass {} to price ONE picture for each Shot in scope that has no picture, instead of each Shot recipe, at the chosen image model’s default settings. Works on a Shot with no model. No Shot row changes; the picture becomes a take of that Shot. Pass the same value when confirming.'),
6669
8062
  }),
@@ -6677,6 +8070,8 @@ export const generateFromShots = {
6677
8070
  const quote = await desktop.get('/agent/shots/quote', {
6678
8071
  input: JSON.stringify({ projectId: details[0].shot.projectId, shotIds: details.map((d) => d.shot.id), draft: input.draft }),
6679
8072
  });
8073
+ for (const model of new Set(quote.items.map((i) => i.model)))
8074
+ requireGuideRead(ctx, model);
6680
8075
  const total = quote.items.reduce((n, i) => n + (i.credits ?? 0), 0);
6681
8076
  const largest = Math.max(0, ...quote.items.map((i) => i.credits ?? 0));
6682
8077
  // ONE approval for the set, on the STATED total; a stale fingerprint is a
@@ -6725,7 +8120,7 @@ export const getBoardProgress = {
6725
8120
  };
6726
8121
  export const editCut = {
6727
8122
  id: 'slates_edit_cut',
6728
- description: 'Read pending preferred-take changes, explicitly replace one clip, sync a board’s preferred clips, or build a cut in board order. Read changes first for the count. Swaps keep timeline starts and source timing when possible; shorter takes are visibly marked. Never changes a shot recipe or poster. Undo swaps with restore and the returned before snapshots; undo a build with undo-build and its clipIds/markerIds.',
8123
+ description: 'Build the timeline from the board\'s chosen clips (a marker per scene), or keep it in step with the board\'s favourite takes: read pending preferred-take changes, explicitly replace one clip, sync a board’s preferred clips, or build a cut in board order. Read changes first for the count. Swaps keep timeline starts and source timing when possible; shorter takes are visibly marked. Never changes a shot recipe or poster. Undo swaps with restore and the returned before snapshots; undo a build with undo-build and its clipIds/markerIds.',
6729
8124
  input: z.object({
6730
8125
  projectId: z.string().uuid(), timelineId: z.string().uuid().optional(),
6731
8126
  action: z.enum(['changes', 'replace', 'sync', 'build', 'restore', 'undo-build']),
@@ -6764,6 +8159,9 @@ export function resolveGuideTopic(topic) {
6764
8159
  const t = topic.trim().toLowerCase();
6765
8160
  if (Object.hasOwn(SKILLS, t))
6766
8161
  return t;
8162
+ // The brain's front door: the Director card and the router (prompts/brain.ts).
8163
+ if (ROUTER_ALIASES.includes(t))
8164
+ return BRAIN_ROUTER;
6767
8165
  if (t === 'slates-character-turnaround' || t === 'character-turnaround') {
6768
8166
  return 'slates-character-identity';
6769
8167
  }
@@ -6782,6 +8180,21 @@ export function resolveGuideTopic(topic) {
6782
8180
  t === 'blender') {
6783
8181
  return 'slates-previs-blocking';
6784
8182
  }
8183
+ // Timeline craft: placing transitions, and the cutting pass (trim, roll, slip, J- and L-cuts).
8184
+ if (t === 'transition' || t === 'transitions' || t === 'dissolve' || t === 'crossfade' || t === 'wipe')
8185
+ return 'slates-transitions';
8186
+ // Starting from a finished ad: the breakdown and the remake.
8187
+ if (t === 'remake' || t === 'reference ad' || t === 'reference-ad' || t === 'breakdown' || t === 'break down')
8188
+ return 'slates-storyboard-from-script';
8189
+ if (t === 'cut' || t === 'cuts' || t === 'cutting' || t === 'editing' || t === 'pacing' || t === 'trim' || t === 'j-cut' || t === 'l-cut' || t === 'split-edit' || t === 'split edit')
8190
+ return 'slates-cuts';
8191
+ if (['variants', 'variant', 'ad-variants', 'ad variants', 'hook variants', 'variant grid', 'variant-grid'].includes(t))
8192
+ return 'slates-ad-variants';
8193
+ if (['captions', 'caption', 'subtitles', 'subtitle', 'transcribe', 'transcript', 'transcription'].includes(t))
8194
+ return 'slates-captions';
8195
+ // `motion-graphics` is HyperFrames' own guide, matched by name before these aliases.
8196
+ if (['motion', 'motion-layers', 'motion layers', 'layers', 'html-clip', 'html clip', 'lower-third', 'lower third', 'end-card', 'end card'].includes(t))
8197
+ return 'slates-motion';
6785
8198
  if (t === 'camera' || t === 'camera-moves' || t === 'camera moves' || t === 'shot-list' || t === 'shot list') {
6786
8199
  return 'slates-camera-language';
6787
8200
  }
@@ -6829,15 +8242,17 @@ export function resolveGuideTopic(topic) {
6829
8242
  return 'slates-model-selection';
6830
8243
  }
6831
8244
  if (t.startsWith('nano-banana'))
6832
- return 'slates-prompting-nano-banana-2';
8245
+ return 'slates-prompting-nano-banana-2-1';
6833
8246
  if (t === 'sunburst' || t === 'flare' || t.startsWith('gpt-image') || t.startsWith('gpt image'))
6834
8247
  return 'slates-prompting-gpt-image-2-5';
6835
8248
  if (t.startsWith('flux'))
6836
- return 'slates-prompting-flux-2-max';
8249
+ return 'slates-prompting-flux-3';
6837
8250
  if (t.startsWith('seedream'))
6838
8251
  return 'slates-prompting-seedream-5-lite';
6839
8252
  if (t.startsWith('omni-flash') || t.startsWith('gemini-omni') || t === 'omni flash')
6840
8253
  return 'slates-prompting-omni-flash';
8254
+ if (t.startsWith('wan') || t === 'alibaba-wan-3.0')
8255
+ return 'slates-prompting-wan-3';
6841
8256
  // MiniMax H3 — both seats share one skill. Placed BEFORE the seed/seedance
6842
8257
  // block for the same reason seed-audio is: no prefix collision exists today,
6843
8258
  // but a `minimax-*` id must never fall through to a Seedance guide.
@@ -6857,7 +8272,9 @@ export function resolveGuideTopic(topic) {
6857
8272
  return 'slates-prompting-motion-transfer';
6858
8273
  if (t === 'edit-video' || t === 'video-edit' || t === 'edit video' || t === 'video edit')
6859
8274
  return resolveGuideTopic(defaultModelFor('video', 'edit'));
6860
- if (t.startsWith('kling-v3'))
8275
+ // Kling 4.0 shares the Kling guide, which carries its own short 4.0 section:
8276
+ // no Kling 4.0 prompting guide has been published (checked 2026-10-23).
8277
+ if (t.startsWith('kling-v3') || t.startsWith('kling-v4'))
6861
8278
  return 'slates-prompting-kling-v3';
6862
8279
  // Audio — the TTS seat FIRST, then seed-audio, then eleven-sfx.
6863
8280
  //
@@ -6903,7 +8320,7 @@ export function resolveGuideTopic(topic) {
6903
8320
  if (t.startsWith('avatar-') || t.includes('lip-sync'))
6904
8321
  return 'slates-prompting-lip-sync';
6905
8322
  // Style names → the per-style prompting guide (photoreal/anime/painterly/
6906
- // 3d-render across Seedance/Kling/NB2). Matches the style-library ids plus
8323
+ // 3d-render across Seedance/Kling/Nano Banana). Matches the style-library ids plus
6907
8324
  // the obvious spellings users type.
6908
8325
  if (t === 'style' ||
6909
8326
  t === 'styles' ||
@@ -6917,6 +8334,60 @@ export function resolveGuideTopic(topic) {
6917
8334
  }
6918
8335
  return null;
6919
8336
  }
8337
+ /** Edits between two names: insert, delete, substitute or swap two neighbours (optimal string alignment). */
8338
+ function editDistance(a, b) {
8339
+ const d = Array.from({ length: a.length + 1 }, (_, i) => [i, ...Array(b.length).fill(0)]);
8340
+ for (let j = 1; j <= b.length; j++)
8341
+ d[0][j] = j;
8342
+ for (let i = 1; i <= a.length; i++) {
8343
+ for (let j = 1; j <= b.length; j++) {
8344
+ d[i][j] = Math.min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + (a[i - 1] === b[j - 1] ? 0 : 1));
8345
+ if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1])
8346
+ d[i][j] = Math.min(d[i][j], d[i - 2][j - 2] + 1);
8347
+ }
8348
+ }
8349
+ return d[a.length][b.length];
8350
+ }
8351
+ /**
8352
+ * The one guide a near-miss name means: the name without its `slates-` prefix, or a typo of one name
8353
+ * ("slaes-direct-response-ad"). Two names equally close come back as `tied`, for the caller to name rather
8354
+ * than pick. Only the guide op uses it: a model id resolves exactly or not at all (resolveGuideTopic), since
8355
+ * a near guess there would gate a generation on another model's guide.
8356
+ */
8357
+ export function nearestGuideName(topic, names) {
8358
+ const t = topic.trim().toLowerCase().replace(/[\s_]+/g, '-');
8359
+ if (!t || t.length > 128)
8360
+ return null;
8361
+ if (names.includes(t))
8362
+ return { name: t };
8363
+ if (names.includes(`slates-${t}`))
8364
+ return { name: `slates-${t}` };
8365
+ // Two edits in a long name, one in a short one, none under four letters: past that it is another guide.
8366
+ const core = t.replace(/^slates-/, '').length;
8367
+ const allowed = core >= 8 ? 2 : core >= 4 ? 1 : 0;
8368
+ // A version is not a typo: seedance-2-0 is not seedance-2-5, and kling-v2 is not kling-v3.
8369
+ const digits = (s) => (s.match(/\d+/g) ?? []).join('.');
8370
+ const version = digits(t);
8371
+ let best = allowed + 1;
8372
+ let closest = [];
8373
+ for (const name of new Set(names)) {
8374
+ if (digits(name) !== version)
8375
+ continue;
8376
+ // A length gap past the budget, against the name as typed or prefixed, is past it in edits too.
8377
+ if (Math.abs(name.length - t.length) > allowed && Math.abs(name.length - t.length - 7) > allowed)
8378
+ continue;
8379
+ const d = Math.min(editDistance(t, name), editDistance(`slates-${t}`, name));
8380
+ if (d < best) {
8381
+ best = d;
8382
+ closest = [name];
8383
+ }
8384
+ else if (d === best && d <= allowed)
8385
+ closest.push(name);
8386
+ }
8387
+ if (!closest.length)
8388
+ return null;
8389
+ return closest.length === 1 ? { name: closest[0] } : { tied: closest.sort() };
8390
+ }
6920
8391
  // Discovery is the first call of most briefs: a slow or unentitled member check
6921
8392
  // must not cost every call a round trip, or hang free craft behind a 30s read.
6922
8393
  const MEMBER_CATALOG_TTL_MS = 60_000;
@@ -6957,27 +8428,97 @@ async function fetchMemberGuideCatalog(ctx) {
6957
8428
  return { entries: [], access: error instanceof SlatesCloudHttpError && error.status === 401 ? 'reconnect Slates to access member guides; bundled guides available' : 'member access check failed; retry for private guides; bundled guides available' };
6958
8429
  }
6959
8430
  }
8431
+ /** The guide topic that serves the full MCP working method (agent-doctrine.ts, buildMcpInstructions). */
8432
+ export const WORKING_METHOD_TOPIC = 'working-method';
6960
8433
  export const getPromptingGuide = {
6961
8434
  id: 'slates_get_prompting_guide',
6962
- description: 'Find production craft from the user vision: pass query alone with the brief (for example "two friends talking in a rainy diner") for keyword-ranked guides with matching sections, followed by every other guide\'s description so you choose by judgment. Omit topic and query, or use topic "catalog", for the whole catalog. Then request a guide name, model id or style name with card/index/section/full depth. Cards are short; query with a topic selects one section or cinematic technique; full returns worked examples, failure modes and sources. Reuse current guidance already in context. Entitled member playbooks are fetched privately through the connected Slates account. For exact buttons and UI paths use topic "app-manual" with relevant question keywords; no query returns its surface map. Users supply the vision; you find the guides.',
8435
+ description: 'Find production craft from the user vision: pass query alone with the brief (for example "two friends talking in a rainy diner") for keyword-ranked guides with matching sections, followed by every other guide\'s description so you choose by judgment. Omit topic and query, or use topic "catalog", for the whole catalog. Then request a guide name, model id or style name with card/index/section/full depth. Cards are short; query with a topic selects one section or cinematic technique; full returns worked examples, failure modes and sources. Reuse current guidance already in context. Entitled member playbooks are fetched privately through the connected Slates account. The motion engine\'s own skills (motion-*) are in the catalog too, for HTML motion layers and editing craft; a topic can name one of their files by path. For exact buttons and UI paths use topic "app-manual" with relevant question keywords; no query returns its surface map. Users supply the vision; you find the guides.',
6963
8436
  input: z.object({
6964
8437
  query: z.string().min(1).max(1000).optional().describe('Without topic: creative brief or craft need to discover guides. With topic: section keywords, heading or technique ID.'),
6965
- topic: z.string().min(1).optional().describe('Optional guide name, model id, style name, catalog, or app-manual. Omit to search by intent or browse.'),
8438
+ topic: z.string().min(1).optional().describe(`Optional guide name, model id, style name, catalog, app-manual, or ${WORKING_METHOD_TOPIC} (the full working method and hard rules for an MCP client; the app's Slates Director has its own). Omit to search by intent or browse.`),
6966
8439
  depth: z.enum(['card', 'index', 'section', 'full']).optional().describe('Default card is a short overview; index lists sections; query selects a section; full returns the complete guide.'),
6967
- limit: z.number().int().min(1).max(20).optional().describe('Page size: a search returns 8 ranked matches by default, browsing the whole catalog. Does not change guide bodies.'),
8440
+ limit: z.number().int().min(1).max(20).optional().describe('Page size for a search (default 8) or a catalog listing (default: the whole catalog); continue with offset from nextOffset. Does not change guide bodies.'),
6968
8441
  offset: z.number().int().min(0).optional().describe('Catalog/search offset from nextOffset in the preceding result.'),
6969
8442
  }),
6970
8443
  async run(input, ctx) {
6971
8444
  const topic = input.topic?.trim().toLowerCase();
8445
+ if (topic === WORKING_METHOD_TOPIC) {
8446
+ // Imported here: agent-doctrine imports this module at load.
8447
+ const { buildAgentDoctrine } = await import('../prompts/agent-doctrine.js');
8448
+ // Its per-model guide line reads the served brain, so the brain is checked first: a signed-in user whose brain
8449
+ // is not cached yet is otherwise told to connect.
8450
+ if (ctx?.cloud)
8451
+ await refreshServedBrain(ctx.cloud);
8452
+ const content = buildAgentDoctrine({ surface: 'mcp' });
8453
+ return { text: content, data: { topic: WORKING_METHOD_TOPIC, bytes: Buffer.byteLength(content, 'utf8'), guide: content } };
8454
+ }
6972
8455
  if (topic === 'app-manual') {
6973
8456
  const content = input.query || input.depth === 'full' ? appManualSections(input.query) : appManualIndex();
6974
8457
  return { text: content, data: { topic: 'app-manual', bytes: Buffer.byteLength(content, 'utf8'), guide: content } };
6975
8458
  }
6976
- const resolved = topic ? resolveGuideTopic(topic) : null;
8459
+ if (topic === MY_BRAIN_TOPIC) {
8460
+ // What an agent reads of the user's own brain before the router, on request: the router's answer carries it
8461
+ // too, and so does the router the MCP server sends a connection that has not opened it.
8462
+ const content = myBrainPreload() || `The user's own brain (My brain) is empty: no files in ${myBrainDir()}. Each file there is a markdown guide in the shared skills' shape (frontmatter, then an operative summary); a file named like a shared guide adds their rules to it, a new name adds a guide, and profile.md is read first.`;
8463
+ return { text: content, data: { topic: MY_BRAIN_TOPIC, bytes: Buffer.byteLength(content, 'utf8'), guide: content } };
8464
+ }
8465
+ const hyperframes = await loadHyperframes();
8466
+ // The playbooks, rules and model guides come from the account's tier (skills/served.ts): checked against the
8467
+ // server at most every ten minutes, the cache when it cannot be reached.
8468
+ if (ctx?.cloud)
8469
+ await refreshServedBrain(ctx.cloud);
8470
+ const served = servedBrain();
8471
+ // A playbook past the account's tier: the job still runs, on the general rules, and the user hears once where
8472
+ // the playbook lives (the server's own words).
8473
+ const locked = topic ? served.locked.find(entry => entry.name === topic || entry.name === `slates-${topic}`) : undefined;
8474
+ if (locked) {
8475
+ const guide = locked.notice ?? `${locked.name} is not open to this account. Run the job on the general rules.`;
8476
+ // The guide gate makes an agent read what this account holds; a guide it cannot open never blocks a generation.
8477
+ ctx?.guidesRead?.add(locked.name);
8478
+ return { text: guide, data: { topic: locked.name, tier: locked.tier, locked: true, bytes: Buffer.byteLength(guide, 'utf8'), guide } };
8479
+ }
8480
+ // The shared brain with the user's My brain laid over it; theirs wins on a conflict (skills/my-brain.ts).
8481
+ const brain = brainSkills();
8482
+ // A motion skill or file by its exact name wins over an alias (`motion-audio` is not `audio`).
8483
+ const hf = topic && !Object.hasOwn(brain.skills, topic) ? findHyperframesGuide(hyperframes, topic) : null;
8484
+ if (hf) {
8485
+ const depth = input.depth ?? 'card';
8486
+ const body = depth === 'card' && !input.query?.trim() ? hyperframesCard(hf.content) : retrieveGuide(hf.key, hf.content, depth, input.query);
8487
+ const others = (depth === 'card' || depth === 'index') && !input.query ? hyperframesFilesOf(hyperframes, hf.key) : [];
8488
+ const guide = `${hyperframesGuideHeader(hf.key)}${body}${others.length ? `\n\nIts other files (request each as a topic): ${others.join(', ')}` : ''}`;
8489
+ return { text: guide, data: { topic: hf.key, tier: 'free', source: 'motion', depth, bytes: Buffer.byteLength(guide, 'utf8'), guide } };
8490
+ }
8491
+ // The user's file by its exact name wins over an alias (their `flux-portraits` is theirs, not the FLUX guide);
8492
+ // the router's names are reserved in the loader, so none of them reaches here as a local file. A name missing
8493
+ // its `slates-` prefix is that guide, resolved here so it never waits on the member check.
8494
+ // With no brain on this machine, an exact `slates-*` name (the one a guide-gate refusal gives) is that guide, not
8495
+ // an unknown topic: it answers with how to get the brain instead of the catalog, and so never loops.
8496
+ const unheld = topic && served.source === 'none' && /^slates-[a-z0-9-]+$/.test(topic) ? topic : null;
8497
+ const resolved = topic ? (Object.hasOwn(brain.skills, topic) ? topic : resolveGuideTopic(topic) ?? (Object.hasOwn(brain.skills, `slates-${topic}`) ? `slates-${topic}` : unheld)) : null;
8498
+ if (resolved && !Object.hasOwn(brain.skills, resolved)) {
8499
+ // An alias named a guide this process does not hold: a locked one, or no brain at all (not connected, and
8500
+ // nothing cached yet).
8501
+ const lockedAlias = served.locked.find(entry => entry.name === resolved);
8502
+ const guide = lockedAlias?.notice ?? `The guide ${resolved} comes from the connected Slates account and is not on this machine (${served.problem ?? 'no brain received yet'}). ${CONNECT_FOR_BRAIN}, then ask again.`;
8503
+ // A locked guide's notice carries its craft card (slates-api lib/brain.ts lockedNotice), so it counts as read; a
8504
+ // guide that never arrived does not, so no generation runs without the card (Eric, 2026-10-23: a hard blocker).
8505
+ if (lockedAlias)
8506
+ ctx?.guidesRead?.add(resolved);
8507
+ return { text: guide, data: { topic: resolved, ...(lockedAlias ? { tier: lockedAlias.tier, locked: true } : { unavailable: true }), bytes: Buffer.byteLength(guide, 'utf8'), guide } };
8508
+ }
6977
8509
  if (resolved) {
6978
8510
  const depth = input.depth ?? 'card';
6979
- const guide = retrieveGuide(resolved, SKILLS[resolved], depth, input.query);
6980
- return { text: guide, data: { topic: resolved, tier: 'free', depth, bytes: Buffer.byteLength(guide, 'utf8'), guide } };
8511
+ const mine = brain.mine.has(resolved);
8512
+ if (mine)
8513
+ noteUsed(resolved);
8514
+ // A file laid over a shared guide says so itself (prompts/brain.ts, overlayGuide); a new name needs the line.
8515
+ const own = mine && !Object.hasOwn(brainFiles(), resolved) ? "From the user's own brain (My brain).\n\n" : '';
8516
+ // The router's answer carries the user's brain in front, as Director's prompt does: the MCP server sends the
8517
+ // router with the preload only to a connection that has not opened it, so this answer is the agent's one copy.
8518
+ const preload = resolved === BRAIN_ROUTER ? myBrainPreload() : '';
8519
+ const guide = `${preload ? `${preload}\n\n` : ''}${own}${retrieveGuide(resolved, brain.skills[resolved], depth, input.query)}`;
8520
+ ctx?.guidesRead?.add(resolved);
8521
+ return { text: guide, data: { topic: resolved, tier: 'free', ...(mine ? { source: 'my-brain' } : {}), depth: servedDepth(resolved, depth, input.query), bytes: Buffer.byteLength(guide, 'utf8'), guide } };
6981
8522
  }
6982
8523
  const member = await memberGuideCatalog(ctx);
6983
8524
  const privateEntry = member.entries.find(entry => entry.name === topic);
@@ -6994,14 +8535,28 @@ export const getPromptingGuide = {
6994
8535
  throw new Error('Invalid member guide body');
6995
8536
  const depth = input.depth ?? 'card';
6996
8537
  const guide = retrieveGuide(privateEntry.name, result.markdown, depth, input.query);
8538
+ ctx?.guidesRead?.add(privateEntry.name);
6997
8539
  return { text: guide, data: { topic: privateEntry.name, tier: 'paid', depth, bytes: Buffer.byteLength(guide, 'utf8'), guide } };
6998
8540
  }
6999
- const catalog = [...guideCatalog(SKILLS), ...member.entries].sort((a, b) => a.name.localeCompare(b.name));
7000
- const result = discoverGuides(catalog, SKILLS, input.query ?? (topic && topic !== 'catalog' && topic !== 'index' ? input.topic : undefined), input.limit, input.offset);
7001
- const guide = result.guides.map(entry => `${entry.name} (${entry.tier}): ${entry.description}${entry.sections.length ? `\n Matching sections: ${entry.sections.join('; ')}` : ''}`).join('\n\n');
7002
- const rest = result.rest.length ? `\n\nEvery other guide (keyword hints above only see shared words; choose by the brief):\n${result.rest.map(entry => `- ${entry.name} (${entry.tier}): ${entry.description}`).join('\n')}` : '';
7003
- const text = `${result.fallback ? 'No keyword match; choose relevant craft from the catalog.\n\n' : ''}${guide}${rest}\n\n${result.total} ${result.query && !result.fallback ? 'keyword matches' : 'guides'}; nextOffset: ${result.nextOffset ?? 'none'}. Member guides: ${member.access}. Retrieve a name with depth card/index or query for a section. The user does not need to choose guides.`;
7004
- return { text, data: { ...result, memberAccess: member.access, bytes: Buffer.byteLength(text, 'utf8') } };
8541
+ // Slates' guides first, then HyperFrames' (they carry the craft for HTML layers and editing).
8542
+ const own = guideCatalog(brain.skills).map(entry => (brain.mine.has(entry.name) ? { ...entry, source: 'my-brain' } : entry));
8543
+ // Locked playbooks stay listed, so an agent can tell the user where one lives.
8544
+ const lockedEntries = served.locked.map(entry => ({ name: entry.name, description: `(not open to this account) ${entry.description}`, tier: 'paid' }));
8545
+ const catalog = [...[...own, ...member.entries, ...lockedEntries].sort((a, b) => a.name.localeCompare(b.name)), ...hyperframesCatalog(hyperframes)];
8546
+ // A typo of one guide's name serves that guide; a name as close to two is answered with both, never a guess.
8547
+ const near = topic && topic !== 'catalog' && topic !== 'index' ? nearestGuideName(topic, catalog.map(entry => entry.name)) : null;
8548
+ if (near && 'name' in near) {
8549
+ const served = await getPromptingGuide.run({ ...input, topic: near.name }, ctx);
8550
+ // Said first, so the agent sees the substitution and learns the real name.
8551
+ return { ...served, text: `Served ${near.name} for "${input.topic}", the closest guide name.\n\n${served.text}` };
8552
+ }
8553
+ const tied = near && 'tied' in near ? near.tied : [];
8554
+ const result = discoverGuides(catalog, { ...brain.skills, ...hyperframesSkillBodies(hyperframes) }, input.query ?? (topic && topic !== 'catalog' && topic !== 'index' ? input.topic : undefined), input.limit, input.offset);
8555
+ const label = (entry) => (entry.source === 'motion' ? 'motion' : entry.source === 'my-brain' ? 'yours' : entry.tier);
8556
+ const guide = result.guides.map(entry => `${entry.name} (${label(entry)}): ${entry.description}${entry.sections.length ? `\n Matching sections: ${entry.sections.join('; ')}` : ''}`).join('\n\n');
8557
+ const rest = result.rest.length ? `\n\nEvery other guide (keyword hints above only see shared words; choose by the brief):\n${result.rest.map(entry => `- ${entry.name} (${label(entry)}): ${entry.description}`).join('\n')}` : '';
8558
+ const text = `${tied.length ? `"${input.topic}" is equally close to ${tied.join(' and ')}; request one of them by name.\n\n` : ''}${result.fallback ? 'No keyword match; choose relevant craft from the catalog.\n\n' : ''}${guide}${rest}\n\n${result.total} ${result.query && !result.fallback ? 'keyword matches' : 'guides'}; nextOffset: ${result.nextOffset ?? 'none'}. Member guides: ${member.access}. Retrieve a name with depth card/index or query for a section. Motion guides are the motion engine's own; topic motion/${HYPERFRAMES_MAPPING} maps their CLI and Studio onto Slates. The user does not need to choose guides.`;
8559
+ return { text, data: { ...result, ...(tied.length ? { tied } : {}), memberAccess: member.access, bytes: Buffer.byteLength(text, 'utf8') } };
7005
8560
  },
7006
8561
  };
7007
8562
  /**
@@ -7067,7 +8622,7 @@ export const blenderStatus = {
7067
8622
  };
7068
8623
  export const blenderExecute = {
7069
8624
  id: 'slates_blender_execute',
7070
- description: 'Run Python (`bpy`) inside the connected Blender and return whatever the code assigns to a dict named `result`. This is how blocking gets built: primitives, empties, constraints, camera rigs, keyframes, markers. Anything Blender can do, this can do. Assign a dict to `result` to get data back (e.g. `result = {"camera": cam.name}`); print() output comes back separately as stdout. On an exception you get the full traceback — read it, fix the code, retry. Before writing an unfamiliar call, look up its real signature with slates_blender_docs rather than guessing: the add-on ships the Blender 5.1 API reference precisely so you do not have to recall it.',
8625
+ description: 'Run Python (`bpy`) inside the connected Blender and return whatever the code assigns to a dict named `result`. This is how blocking gets built: primitives, empties, constraints, camera rigs, keyframes, markers. Anything Blender can do, this can do. Assign a dict to `result` to get data back (e.g. `result = {"camera": cam.name}`); print() output comes back separately as stdout. On an exception you get the full traceback — read it, fix the code, retry. Before writing an unfamiliar call, look up its real signature with slates_blender_docs rather than guessing: the add-on ships the Blender API reference precisely so you do not have to recall it.',
7071
8626
  input: z.object({
7072
8627
  code: z
7073
8628
  .string()
@@ -7091,7 +8646,7 @@ export const blenderExecute = {
7091
8646
  };
7092
8647
  export const blenderScene = {
7093
8648
  id: 'slates_blender_scene',
7094
- description: 'Scene summary from the connected Blender: frame range, fps, duration, render resolution, the active camera with its keyframe times in both frames and seconds, and the full collection/object tree with transforms and constraints. Cheap — call it freely between edits. The camera keyframe times ARE the cut structure, so read them before writing any shot-by-shot prompt.',
8649
+ description: 'Scene summary from the connected Blender: frame range, fps, duration, render resolution, the active camera with its keyframe times in both frames and seconds, and the full collection/object tree with transforms and constraints. Cheap — call it freely between edits. It errors when the bridge is down; slates_blender_status checks without failing. The camera keyframe times ARE the cut structure, so read them before writing any shot-by-shot prompt.',
7095
8650
  input: z.object({}),
7096
8651
  async run() {
7097
8652
  return ok(await new BlenderBridgeClient().call('result = _mod("scene").summary()'));
@@ -7099,7 +8654,7 @@ export const blenderScene = {
7099
8654
  };
7100
8655
  export const blenderDocs = {
7101
8656
  id: 'slates_blender_docs',
7102
- description: 'Look up a dotted Blender Python API identifier in the bundled 5.1 reference — e.g. "bpy.ops.object", "bpy.types.Camera", "bpy.types.FollowPathConstraint". Pass "*" for top-level modules or "bpy.ops.*" to list a namespace. Use this instead of recalling a signature from memory: invented operator names and wrong enum values are the most common way previs code fails, and they fail silently often enough to be worth the lookup.',
8657
+ description: 'Look up a dotted Blender Python API identifier in the bundled Blender API reference — e.g. "bpy.ops.object", "bpy.types.Camera", "bpy.types.FollowPathConstraint". Pass "*" for top-level modules or "bpy.ops.*" to list a namespace. Use this instead of recalling a signature from memory: invented operator names and wrong enum values are the most common way previs code fails, and they fail silently often enough to be worth the lookup.',
7103
8658
  input: z.object({
7104
8659
  identifier: z.string().min(1).describe('Dotted identifier, or a namespace wildcard like "bpy.ops.*".'),
7105
8660
  }),
@@ -7127,7 +8682,7 @@ export const blenderSearchDocs = {
7127
8682
  };
7128
8683
  export const blenderRenderBlocking = {
7129
8684
  id: 'slates_blender_render_blocking',
7130
- description: "Render the connected Blender scene camera to a grey-box mp4 — the blocking clip that locks camera motion for generation — and, when projectId is given, import it into that Slates project as a video asset in the same call. The returned asset id goes into slates_generate_video's videoReferenceAssetIds and the returned durationSeconds into videoReferenceSecondsEach. Renders through the SCENE camera using scene render settings, never the user's viewport, so output does not depend on where they left their mouse. Untextured is correct: the clip supplies camera path and timing, the references supply the look. Colour in the blocking is NOTATION, not look — a distinct viewport colour per character is what binds a proxy to its reference image across cuts, and a marked face encodes which way a featureless proxy is facing. State every such mapping in the generation prompt AND state that the colours themselves are not inherited, or the model renders a literally red person. See the slates-previs-blocking and slates-blocking-to-prompt skills. Keep it at or under 30s — seedance-2.5 accepts reference videos up to 30s, the other reference-video models up to 15s.",
8685
+ description: "Render the connected Blender scene camera to a grey-box mp4 — the blocking clip that locks camera motion for generation — and, when projectId is given, import it into that Slates project as a video asset in the same call. The returned asset id goes into slates_generate_video's videoReferenceAssetIds and the returned durationSeconds into videoReferenceSecondsEach. Renders through the SCENE camera using scene render settings, never the user's viewport, so output does not depend on where they left their mouse. Untextured is correct: the clip supplies camera path and timing, the references supply the look. Any colour or marking in the blocking is notation; slates-blocking-to-prompt says how to state it in the generation prompt, and slates-previs-blocking how to build the blocking. Keep the clip within the reference-video length the chosen video model accepts (slates_generate_video's reference params and the estimate state it).",
7131
8686
  input: z.object({
7132
8687
  projectId: z
7133
8688
  .string()
@@ -7209,6 +8764,9 @@ export const ALL_OPERATIONS = [
7209
8764
  setAppSettings,
7210
8765
  getAsset,
7211
8766
  linkAssetSource,
8767
+ transcribeAsset,
8768
+ getAssetTranscript,
8769
+ editAssetTranscript,
7212
8770
  extractVideoFrame,
7213
8771
  getMe,
7214
8772
  getCreditBalance,
@@ -7265,12 +8823,36 @@ export const ALL_OPERATIONS = [
7265
8823
  listTimelines,
7266
8824
  saveTimeline,
7267
8825
  exportCuts,
8826
+ getExportBatch,
8827
+ cancelExportBatch,
8828
+ getVariantGrid,
8829
+ getVariants,
8830
+ editVariantSlots,
8831
+ editVariants,
8832
+ getRecipe,
8833
+ reframeClip,
8834
+ getReframeReport,
7268
8835
  getTimeline,
8836
+ getTimelineLoudness,
7269
8837
  addClipToTimeline,
7270
8838
  reorderClips,
7271
8839
  removeClip,
8840
+ editTimelineClips,
8841
+ updateClip,
8842
+ addTransition,
8843
+ updateTransition,
8844
+ removeTransition,
7272
8845
  manageTimelineMarker,
7273
8846
  addTimelineTrack,
8847
+ addTextClip,
8848
+ addImageOverlay,
8849
+ updateOverlayClip,
8850
+ setClipKeyframes,
8851
+ addCaptions,
8852
+ addHtmlClip,
8853
+ updateHtmlClip,
8854
+ checkComposition,
8855
+ listMotionBlocks,
7274
8856
  updateTimelineTrack,
7275
8857
  removeTimelineTrack,
7276
8858
  updateTimelineSettings,
@@ -7303,6 +8885,10 @@ export const ALL_OPERATIONS = [
7303
8885
  getTemplate,
7304
8886
  exportTemplate,
7305
8887
  importTemplate,
8888
+ getReferenceBreakdown,
8889
+ breakDownReference,
8890
+ getProductPage,
8891
+ importProduct,
7306
8892
  updateStoryboard,
7307
8893
  deleteStoryboard,
7308
8894
  updateScene,