@oh-story/dsh 0.1.4 → 0.1.6

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 (479) hide show
  1. package/README.md +56 -12
  2. package/lib/client.js +2707 -268
  3. package/lib/client.js.map +4 -4
  4. package/lib/drama/manifest.json +136 -101
  5. package/lib/drama/skills/short-drama/SKILL.md +61 -1
  6. package/lib/drama/skills/short-drama/references/contract-and-ownership.md +7 -4
  7. package/lib/drama/skills/short-drama/references/creator-documents.md +133 -8
  8. package/lib/drama/skills/short-drama/references/creator-workflow.md +38 -2
  9. package/lib/drama/skills/short-drama/references/knowhow-index.md +3 -0
  10. package/lib/drama/skills/short-drama/references/reference-roles.md +10 -7
  11. package/lib/drama/skills/short-drama/references/runtime-preflight.md +3 -0
  12. package/lib/drama/skills/short-drama/scripts/creator_markdown_check.py +1002 -0
  13. package/lib/drama/skills/short-drama/scripts/project_tool.py +485 -5
  14. package/lib/drama/skills/short-drama-assets/SKILL.md +13 -3
  15. package/lib/drama/skills/short-drama-assets/references/continuity-lock.md +116 -0
  16. package/lib/drama/skills/short-drama-assets/references/identity-vs-variant.md +2 -1
  17. package/lib/drama/skills/short-drama-assets/references/prop-and-state.md +19 -0
  18. package/lib/drama/skills/short-drama-assets/references/stage-contract.md +2 -0
  19. package/lib/drama/skills/short-drama-assets/scripts/asset_check.py +1 -1
  20. package/lib/drama/skills/short-drama-image-prompts/SKILL.md +6 -2
  21. package/lib/drama/skills/short-drama-image-prompts/references/common-recipe.md +4 -3
  22. package/lib/drama/skills/short-drama-image-prompts/references/lookdev-frame.md +1 -1
  23. package/lib/drama/skills/short-drama-image-prompts/references/review-and-fixtures.md +1 -1
  24. package/lib/drama/skills/short-drama-image-prompts/references/stage-contract.md +3 -1
  25. package/lib/drama/skills/short-drama-image-prompts/scripts/image_prompt_check.py +8 -8
  26. package/lib/drama/skills/short-drama-image-prompts/scripts/selftest.py +4 -2
  27. package/lib/drama/skills/short-drama-produce/SKILL.md +46 -10
  28. package/lib/drama/skills/short-drama-produce/references/adapter-contract.md +65 -8
  29. package/lib/drama/skills/short-drama-produce/references/providers/minimax-h3-video.md +85 -0
  30. package/lib/drama/skills/short-drama-produce/references/providers/seedance.md +27 -10
  31. package/lib/drama/skills/short-drama-produce/scripts/production_tool.py +362 -3
  32. package/lib/drama/skills/short-drama-produce/scripts/provider_adapters.py +627 -40
  33. package/lib/drama/skills/short-drama-produce/scripts/selftest.py +5 -4
  34. package/lib/drama/skills/short-drama-review/references/rubric-visual-motion.md +12 -0
  35. package/lib/drama/skills/short-drama-review/scripts/review_check.py +1 -1
  36. package/lib/drama/skills/short-drama-storyboard/SKILL.md +76 -7
  37. package/lib/drama/skills/short-drama-storyboard/assets/shot-template.jsonl +1 -1
  38. package/lib/drama/skills/short-drama-storyboard/references/keyframe-craft.md +6 -2
  39. package/lib/drama/skills/short-drama-storyboard/references/production-shot-grammar.md +19 -4
  40. package/lib/drama/skills/short-drama-storyboard/references/review-and-fixtures.md +5 -2
  41. package/lib/drama/skills/short-drama-storyboard/references/screenplay-to-keyframe-example.md +16 -0
  42. package/lib/drama/skills/short-drama-storyboard/references/stage-contract.md +8 -3
  43. package/lib/drama/skills/short-drama-storyboard/scripts/storyboard_check.py +1 -1
  44. package/lib/drama/skills/short-drama-video-prompts/SKILL.md +81 -13
  45. package/lib/drama/skills/short-drama-video-prompts/assets/motion-spec.jsonl.md +6 -1
  46. package/lib/drama/skills/short-drama-video-prompts/assets/video-prompts.md +17 -1
  47. package/lib/drama/skills/short-drama-video-prompts/references/delivery-profile.md +21 -1
  48. package/lib/drama/skills/short-drama-video-prompts/references/minimax-h3.md +154 -0
  49. package/lib/drama/skills/short-drama-video-prompts/references/motion-recipe.md +24 -6
  50. package/lib/drama/skills/short-drama-video-prompts/references/production-prompt-grammar.md +11 -7
  51. package/lib/drama/skills/short-drama-video-prompts/references/seedance-2.0.md +41 -0
  52. package/lib/drama/skills/short-drama-video-prompts/references/seedance-2.5.md +66 -0
  53. package/lib/drama/skills/short-drama-video-prompts/references/stage-contract.md +5 -2
  54. package/lib/drama/skills/short-drama-video-prompts/references/target-model-profile.md +115 -0
  55. package/lib/drama/skills/short-drama-video-prompts/scripts/container_check.py +1 -1
  56. package/lib/drama/skills/short-drama-video-prompts/scripts/music_spec_check.py +1 -1
  57. package/lib/drama/skills/short-drama-write/SKILL.md +3 -2
  58. package/lib/drama/skills/short-drama-write/scripts/duration_estimate.py +1 -1
  59. package/lib/drama/skills/short-drama-write/scripts/screenplay_index.py +2 -2
  60. package/lib/drama/skills/short-drama-write/scripts/voice_sheet_check.py +1 -1
  61. package/lib/index.js +865 -33
  62. package/lib/index.js.map +4 -4
  63. package/lib/novel-to-game/LICENSE +21 -0
  64. package/lib/novel-to-game/README.md +180 -0
  65. package/lib/novel-to-game/README_ZH.md +178 -0
  66. package/lib/novel-to-game/VERSION +1 -0
  67. package/lib/novel-to-game/examples/jin-ping-mei/build/BUILD_BRIEF.md +217 -0
  68. package/lib/novel-to-game/examples/jin-ping-mei/build/app/.vercelignore +3 -0
  69. package/lib/novel-to-game/examples/jin-ping-mei/build/app/RUN.md +130 -0
  70. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/bg/compound_new_guofeng.webp +0 -0
  71. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/finale/fate_coda.webp +0 -0
  72. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/finale/meng.webp +0 -0
  73. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/finale/pan.webp +0 -0
  74. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/finale/pinger.webp +0 -0
  75. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/finale/xuee.webp +0 -0
  76. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/finale/yue.webp +0 -0
  77. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/group/inner_court_accord_five.webp +0 -0
  78. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/group/inner_court_afterglow_five.webp +0 -0
  79. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/group/inner_court_alliance.webp +0 -0
  80. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/group/public_day10.webp +0 -0
  81. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/group/public_day15.webp +0 -0
  82. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/group/public_day5.webp +0 -0
  83. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/group/title_new_guofeng.webp +0 -0
  84. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/joint/pan_pinger.webp +0 -0
  85. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/joint/pan_xuee.webp +0 -0
  86. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/joint/yue_meng.webp +0 -0
  87. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/joint/yue_pan.webp +0 -0
  88. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/joint/yue_pinger.webp +0 -0
  89. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/meng/explicit.webp +0 -0
  90. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/meng/prelude.webp +0 -0
  91. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/milestone/meng.webp +0 -0
  92. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/milestone/pan.webp +0 -0
  93. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/milestone/pinger.webp +0 -0
  94. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/milestone/xuee.webp +0 -0
  95. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/milestone/yue.webp +0 -0
  96. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/pan/explicit.webp +0 -0
  97. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/pan/prelude.webp +0 -0
  98. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/pinger/explicit.webp +0 -0
  99. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/pinger/prelude.webp +0 -0
  100. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/xuee/explicit.webp +0 -0
  101. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/xuee/prelude.webp +0 -0
  102. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/yue/explicit.webp +0 -0
  103. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/yue/prelude.webp +0 -0
  104. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/heroine/meng/night.webp +0 -0
  105. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/heroine/pan/night.webp +0 -0
  106. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/heroine/pinger/night.webp +0 -0
  107. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/heroine/xuee/night.webp +0 -0
  108. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/heroine/yue/night.webp +0 -0
  109. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/household/li_jiaoer.webp +0 -0
  110. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/scene/gate_collector.webp +0 -0
  111. package/lib/novel-to-game/examples/jin-ping-mei/build/app/css/new-guofeng.css +1105 -0
  112. package/lib/novel-to-game/examples/jin-ping-mei/build/app/css/style.css +2539 -0
  113. package/lib/novel-to-game/examples/jin-ping-mei/build/app/index.html +18 -0
  114. package/lib/novel-to-game/examples/jin-ping-mei/build/app/js/assets.js +147 -0
  115. package/lib/novel-to-game/examples/jin-ping-mei/build/app/js/audio.js +332 -0
  116. package/lib/novel-to-game/examples/jin-ping-mei/build/app/js/data.js +7472 -0
  117. package/lib/novel-to-game/examples/jin-ping-mei/build/app/js/engine.js +13077 -0
  118. package/lib/novel-to-game/examples/jin-ping-mei/build/app/js/main.js +3028 -0
  119. package/lib/novel-to-game/examples/jin-ping-mei/build/app/js/text.js +32 -0
  120. package/lib/novel-to-game/examples/jin-ping-mei/build/app/package.json +10 -0
  121. package/lib/novel-to-game/examples/jin-ping-mei/build/app/vercel.json +23 -0
  122. package/lib/novel-to-game/examples/jin-ping-mei/build/art/generated-art.json +161 -0
  123. package/lib/novel-to-game/examples/jin-ping-mei/example.json +12 -0
  124. package/lib/novel-to-game/examples/jin-ping-mei/qa/README.md +31 -0
  125. package/lib/novel-to-game/examples/jin-ping-mei/qa/playable-model.json +99 -0
  126. package/lib/novel-to-game/examples/jin-ping-mei/qa/verification.json +41 -0
  127. package/lib/novel-to-game/examples/jin-ping-mei/qa/verify_playable_model.mjs +129 -0
  128. package/lib/novel-to-game/manifest.json +508 -0
  129. package/lib/novel-to-game/skills/game-art-direction/SKILL.md +73 -0
  130. package/lib/novel-to-game/skills/game-art-direction/agents/openai.yaml +4 -0
  131. package/lib/novel-to-game/skills/game-art-direction/references/art-direction-method.md +119 -0
  132. package/lib/novel-to-game/skills/game-build/SKILL.md +84 -0
  133. package/lib/novel-to-game/skills/game-build/agents/openai.yaml +4 -0
  134. package/lib/novel-to-game/skills/game-build/references/build-brief-contract.md +109 -0
  135. package/lib/novel-to-game/skills/game-build/references/generative-media-pipeline.md +56 -0
  136. package/lib/novel-to-game/skills/game-build/references/playable-model-contract.md +81 -0
  137. package/lib/novel-to-game/skills/game-build/references/tts-production-contract.md +37 -0
  138. package/lib/novel-to-game/skills/game-concept/SKILL.md +72 -0
  139. package/lib/novel-to-game/skills/game-concept/agents/openai.yaml +4 -0
  140. package/lib/novel-to-game/skills/game-concept/references/concept-method.md +94 -0
  141. package/lib/novel-to-game/skills/game-qa/SKILL.md +50 -0
  142. package/lib/novel-to-game/skills/game-qa/agents/openai.yaml +4 -0
  143. package/lib/novel-to-game/skills/game-qa/references/qa-contract.md +66 -0
  144. package/lib/novel-to-game/skills/game-qa/references/test-design-method.md +45 -0
  145. package/lib/novel-to-game/skills/game-world-design/SKILL.md +63 -0
  146. package/lib/novel-to-game/skills/game-world-design/agents/openai.yaml +4 -0
  147. package/lib/novel-to-game/skills/game-world-design/references/dialogue-design-method.md +59 -0
  148. package/lib/novel-to-game/skills/game-world-design/references/game-writing-craft.md +53 -0
  149. package/lib/novel-to-game/skills/game-world-design/references/narrative-design-method.md +84 -0
  150. package/lib/novel-to-game/skills/game-world-design/references/numeric-design-method.md +56 -0
  151. package/lib/novel-to-game/skills/game-world-design/references/world-design-method.md +124 -0
  152. package/lib/novel-to-game/skills/novel-game-analyze/SKILL.md +77 -0
  153. package/lib/novel-to-game/skills/novel-game-analyze/agents/openai.yaml +4 -0
  154. package/lib/novel-to-game/skills/novel-game-analyze/references/gameability-protocol.md +65 -0
  155. package/lib/novel-to-game/skills/novel-to-game/SKILL.md +71 -0
  156. package/lib/novel-to-game/skills/novel-to-game/agents/openai.yaml +4 -0
  157. package/lib/novel-to-game/skills/novel-to-game/references/intake-benchmark-reference.md +42 -0
  158. package/lib/novel-to-game/skills/novel-to-game/references/intake-method.md +51 -0
  159. package/lib/novel-to-game/skills/novel-to-game/references/pipeline-contract.md +65 -0
  160. package/lib/oh-story/manifest.json +415 -305
  161. package/lib/oh-story/roles/consistency-checker.md +1 -1
  162. package/lib/oh-story/roles/narrative-writer.md +32 -33
  163. package/lib/oh-story/roles/story-architect.md +16 -26
  164. package/lib/oh-story/skills/browser-cdp/SKILL.md +1 -1
  165. package/lib/oh-story/skills/story/SKILL.md +16 -9
  166. package/lib/oh-story/skills/story/VERSION +1 -1
  167. package/lib/oh-story/skills/story/references/author-memory.md +163 -0
  168. package/lib/oh-story/skills/story/scripts/author_memory_commit.py +871 -0
  169. package/lib/oh-story/skills/story-cover/SKILL.md +1 -1
  170. package/lib/oh-story/skills/story-deslop/SKILL.md +10 -5
  171. package/lib/oh-story/skills/story-deslop/references/anti-ai-writing.md +2 -1
  172. package/lib/oh-story/skills/story-deslop/references/author-memory.md +163 -0
  173. package/lib/oh-story/skills/story-deslop/references/banned-words.md +6 -4
  174. package/lib/oh-story/skills/story-deslop/scripts/author_memory_commit.py +871 -0
  175. package/lib/oh-story/skills/story-deslop/scripts/check-ai-patterns.js +64 -1
  176. package/lib/oh-story/skills/story-import/SKILL.md +19 -10
  177. package/lib/oh-story/skills/story-import/references/format-and-structure.md +9 -10
  178. package/lib/oh-story/skills/story-import/references/structure-mapping-long.md +2 -2
  179. package/lib/oh-story/skills/story-import/references/structure-mapping-short.md +1 -1
  180. package/lib/oh-story/skills/story-import/references/tracking-transaction.md +14 -6
  181. package/lib/oh-story/skills/story-import/scripts/check-outline-contract.js +251 -0
  182. package/lib/oh-story/skills/story-import/scripts/tracking_commit.py +98 -9
  183. package/lib/oh-story/skills/story-import/scripts/wordcount_core.py +246 -0
  184. package/lib/oh-story/skills/story-long-analyze/SKILL.md +4 -4
  185. package/lib/oh-story/skills/story-long-scan/SKILL.md +1 -1
  186. package/lib/oh-story/skills/story-long-write/SKILL.md +35 -21
  187. package/lib/oh-story/skills/story-long-write/references/anti-ai-writing.md +2 -1
  188. package/lib/oh-story/skills/story-long-write/references/artifact-protocols.md +7 -3
  189. package/lib/oh-story/skills/story-long-write/references/author-memory.md +163 -0
  190. package/lib/oh-story/skills/story-long-write/references/banned-words.md +6 -4
  191. package/lib/oh-story/skills/story-long-write/references/cross-book-recall.md +6 -6
  192. package/lib/oh-story/skills/story-long-write/references/genre-prose-cards.md +1 -1
  193. package/lib/oh-story/skills/story-long-write/references/genre-readers.md +1 -1
  194. package/lib/oh-story/skills/{story-setup/references/agent-references/hooks-chapter.md → story-long-write/references/long-chapter-hooks.md} +5 -5
  195. package/lib/oh-story/skills/story-long-write/references/{quality-checklist.md → long-chapter-quality.md} +2 -1
  196. package/lib/oh-story/skills/story-long-write/references/long-format.md +42 -0
  197. package/lib/oh-story/skills/{story-setup/references/agent-references/genre-catalog.md → story-long-write/references/long-genre-catalog.md} +11 -97
  198. package/lib/oh-story/skills/{story-setup/references/agent-references/genre-core-mechanics.md → story-long-write/references/long-genre-mechanics.md} +1 -1
  199. package/lib/oh-story/skills/{story-short-write/references/reversal-toolkit.md → story-long-write/references/long-reversal.md} +18 -32
  200. package/lib/oh-story/skills/story-long-write/references/{hooks-suspense.md → long-suspense.md} +6 -6
  201. package/lib/oh-story/skills/story-long-write/references/opening-design.md +1 -1
  202. package/lib/oh-story/skills/story-long-write/references/outline-structure-theory.md +1 -1
  203. package/lib/oh-story/skills/story-long-write/references/style-genre-modules.md +1 -1
  204. package/lib/oh-story/skills/story-long-write/references/tracking-transaction.md +14 -6
  205. package/lib/oh-story/skills/story-long-write/references/workflow-chapter.md +32 -27
  206. package/lib/oh-story/skills/story-long-write/references/workflow-daily.md +4 -4
  207. package/lib/oh-story/skills/story-long-write/references/workflow-revision.md +2 -2
  208. package/lib/oh-story/skills/story-long-write/references/workflow-setup.md +14 -14
  209. package/lib/oh-story/skills/story-long-write/references/writing-craft.md +54 -54
  210. package/lib/oh-story/skills/story-long-write/scripts/author_memory_commit.py +871 -0
  211. package/lib/oh-story/skills/story-long-write/scripts/check-ai-patterns.js +64 -1
  212. package/lib/oh-story/skills/story-long-write/scripts/check-outline-contract.js +251 -0
  213. package/lib/oh-story/skills/story-long-write/scripts/storyctl.py +303 -0
  214. package/lib/oh-story/skills/story-long-write/scripts/tracking_commit.py +98 -9
  215. package/lib/oh-story/skills/story-long-write/scripts/wordcount_core.py +246 -0
  216. package/lib/oh-story/skills/story-review/SKILL.md +26 -17
  217. package/lib/oh-story/skills/story-review/references/anti-ai-writing.md +2 -1
  218. package/lib/oh-story/skills/story-review/references/author-memory.md +163 -0
  219. package/lib/oh-story/skills/story-review/references/banned-words.md +6 -4
  220. package/lib/oh-story/skills/story-review/references/{quality-checklist.md → review-quality.md} +22 -21
  221. package/lib/oh-story/skills/story-review/references/tracking-transaction.md +14 -6
  222. package/lib/oh-story/skills/story-review/scripts/author_memory_commit.py +871 -0
  223. package/lib/oh-story/skills/story-review/scripts/check-ai-patterns.js +64 -1
  224. package/lib/oh-story/skills/story-review/scripts/tracking_commit.py +98 -9
  225. package/lib/oh-story/skills/story-review/scripts/wordcount_core.py +246 -0
  226. package/lib/oh-story/skills/story-setup/SKILL.md +74 -33
  227. package/lib/oh-story/skills/story-setup/references/agent-references/agent-quality.md +72 -0
  228. package/lib/oh-story/skills/story-setup/references/agent-references/agent-reference-profiles.md +55 -0
  229. package/lib/oh-story/skills/story-setup/references/agent-references/anti-ai-writing.md +2 -1
  230. package/lib/oh-story/skills/story-setup/references/agent-references/banned-words.md +6 -4
  231. package/lib/oh-story/skills/story-setup/references/agent-references/format-and-structure.md +9 -10
  232. package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards.md +1 -1
  233. package/lib/oh-story/skills/story-setup/references/agent-references/genre-readers.md +1 -1
  234. package/lib/oh-story/skills/{story-short-analyze/references/hooks-chapter.md → story-setup/references/agent-references/long-chapter-hooks.md} +5 -5
  235. package/lib/oh-story/skills/story-setup/references/agent-references/long-emotional-methods.md +209 -0
  236. package/lib/oh-story/skills/{story-long-write/references/genre-catalog.md → story-setup/references/agent-references/long-genre-catalog.md} +11 -97
  237. package/lib/oh-story/skills/{story-long-write/references/genre-core-mechanics.md → story-setup/references/agent-references/long-genre-mechanics.md} +1 -1
  238. package/lib/oh-story/skills/story-setup/references/agent-references/long-quality.md +40 -0
  239. package/lib/oh-story/skills/story-setup/references/agent-references/{reversal-toolkit.md → long-reversal.md} +18 -32
  240. package/lib/oh-story/skills/{story-short-write/references/hooks-suspense.md → story-setup/references/agent-references/long-suspense.md} +6 -6
  241. package/lib/oh-story/skills/story-setup/references/agent-references/opening-design.md +1 -1
  242. package/lib/oh-story/skills/story-setup/references/agent-references/{emotional-methods.md → short-emotional-methods.md} +4 -4
  243. package/lib/oh-story/skills/{story-long-write/references/genre-writing-formulas.md → story-setup/references/agent-references/short-genre-formulas.md} +32 -44
  244. package/lib/oh-story/skills/story-setup/references/agent-references/short-quality.md +39 -0
  245. package/lib/oh-story/skills/{story-long-write/references/reversal-toolkit.md → story-setup/references/agent-references/short-reversal.md} +29 -23
  246. package/lib/oh-story/skills/story-setup/references/agent-references/{hooks-suspense.md → short-suspense.md} +31 -31
  247. package/lib/oh-story/skills/story-setup/references/agent-references/style-genre-modules.md +1 -1
  248. package/lib/oh-story/skills/story-setup/references/agent-references/writing-craft.md +55 -55
  249. package/lib/oh-story/skills/story-short-analyze/SKILL.md +28 -28
  250. package/lib/oh-story/skills/story-short-analyze/references/{character-basics.md → analysis-character-basics.md} +1 -1
  251. package/lib/oh-story/skills/story-short-analyze/references/{character-design-methods.md → analysis-character-design.md} +1 -1
  252. package/lib/oh-story/skills/story-short-analyze/references/{character-relations.md → analysis-character-relations.md} +1 -1
  253. package/lib/oh-story/skills/story-short-analyze/references/{hooks-paragraph.md → analysis-paragraph-hooks.md} +1 -1
  254. package/lib/oh-story/skills/story-short-analyze/references/{genre-readers.md → analysis-reader-profile.md} +2 -2
  255. package/lib/oh-story/skills/story-short-analyze/references/analysis-report-style.md +45 -0
  256. package/lib/oh-story/skills/story-short-analyze/references/analysis-short-genres.md +65 -0
  257. package/lib/oh-story/skills/story-short-analyze/references/analysis-short-hooks.md +77 -0
  258. package/lib/oh-story/skills/story-short-analyze/references/analysis-short-mechanics.md +82 -0
  259. package/lib/oh-story/skills/story-short-analyze/references/analysis-short-patterns.md +50 -0
  260. package/lib/oh-story/skills/story-short-analyze/references/analysis-short-suspense.md +98 -0
  261. package/lib/oh-story/skills/story-short-analyze/references/{genre-writing-techniques.md → analysis-writing-techniques.md} +21 -19
  262. package/lib/oh-story/skills/story-short-analyze/references/deconstruction-examples.md +1 -1
  263. package/lib/oh-story/skills/story-short-analyze/references/material-decomposition.md +21 -28
  264. package/lib/oh-story/skills/story-short-analyze/references/output-contract.md +1 -1
  265. package/lib/oh-story/skills/story-short-analyze/references/output-templates.md +17 -17
  266. package/lib/oh-story/skills/story-short-analyze/references/{quality-checklist.md → source-story-quality.md} +28 -49
  267. package/lib/oh-story/skills/story-short-analyze/references/zhihu-style.md +2 -2
  268. package/lib/oh-story/skills/story-short-scan/SKILL.md +1 -1
  269. package/lib/oh-story/skills/story-short-write/SKILL.md +78 -55
  270. package/lib/oh-story/skills/story-short-write/references/author-memory.md +163 -0
  271. package/lib/oh-story/skills/story-short-write/references/banned-words.md +6 -4
  272. package/lib/oh-story/skills/story-short-write/references/cross-book-recall.md +3 -3
  273. package/lib/oh-story/skills/story-short-write/references/emotional-methods.md +4 -4
  274. package/lib/oh-story/skills/story-short-write/references/genre-styles//344/270/226/346/203/205/346/211/223/350/204/270.md +3 -3
  275. package/lib/oh-story/skills/story-short-write/references/genre-styles//345/217/214/347/224/267/344/270/273.md +2 -2
  276. package/lib/oh-story/skills/story-short-write/references/genre-styles//345/244/215/344/273/207/346/211/223/350/204/270.md +3 -3
  277. package/lib/oh-story/skills/story-short-write/references/genre-styles//345/256/205/346/226/227/345/256/253/346/226/227.md +6 -6
  278. package/lib/oh-story/skills/story-short-write/references/genre-styles//346/200/273/350/243/201/350/261/252/351/227/250.md +3 -3
  279. package/lib/oh-story/skills/story-short-write/references/genre-styles//346/202/254/347/226/221.md +4 -4
  280. package/lib/oh-story/skills/story-short-write/references/genre-styles//346/260/221/344/277/227/346/200/252/350/260/210.md +7 -7
  281. package/lib/oh-story/skills/story-short-write/references/genre-styles//346/262/231/351/233/225/350/204/221/346/264/236.md +5 -5
  282. package/lib/oh-story/skills/story-short-write/references/genre-styles//347/224/234/345/256/240.md +4 -4
  283. package/lib/oh-story/skills/story-short-write/references/genre-styles//350/277/275/345/246/273/347/201/253/350/221/254/345/234/272.md +3 -3
  284. package/lib/oh-story/skills/story-short-write/references/genre-writing-formulas.md +32 -44
  285. package/lib/oh-story/skills/story-short-write/references/genre-writing-techniques.md +20 -18
  286. package/lib/oh-story/skills/story-short-write/references/output-contract.md +1 -1
  287. package/lib/oh-story/skills/story-short-write/references/short-craft.md +18 -18
  288. package/lib/oh-story/skills/story-short-write/references/short-deslop.md +1 -1
  289. package/lib/oh-story/skills/story-short-write/references/short-format.md +38 -8
  290. package/lib/oh-story/skills/story-short-write/references/{quality-checklist.md → short-prose-quality.md} +22 -21
  291. package/lib/oh-story/skills/story-short-write/references/short-reversal.md +355 -0
  292. package/lib/oh-story/skills/{story-short-analyze/references/hooks-suspense.md → story-short-write/references/short-suspense.md} +31 -31
  293. package/lib/oh-story/skills/story-short-write/references/submission-craft.md +2 -2
  294. package/lib/oh-story/skills/story-short-write/references/writing-workflow.md +31 -22
  295. package/lib/oh-story/skills/story-short-write/scripts/author_memory_commit.py +871 -0
  296. package/lib/oh-story/skills/story-short-write/scripts/check-ai-patterns.js +64 -1
  297. package/lib/oh-story/skills/story-short-write/scripts/check-delivery-contract.js +212 -0
  298. package/lib/oh-story/skills/story-short-write/scripts/check-phase2-contract.js +363 -0
  299. package/lib/types/client/drama-production-view.d.ts +34 -0
  300. package/lib/types/client/drama-production-view.d.ts.map +1 -0
  301. package/lib/types/client/drama-production.d.ts +92 -0
  302. package/lib/types/client/drama-production.d.ts.map +1 -0
  303. package/lib/types/client/file-activity.d.ts +4 -2
  304. package/lib/types/client/file-activity.d.ts.map +1 -1
  305. package/lib/types/client/index.d.ts +1 -1
  306. package/lib/types/client/index.d.ts.map +1 -1
  307. package/lib/types/client/production-intents.d.ts +9 -0
  308. package/lib/types/client/production-intents.d.ts.map +1 -0
  309. package/lib/types/client/production-prompts.d.ts +9 -0
  310. package/lib/types/client/production-prompts.d.ts.map +1 -0
  311. package/lib/types/client/production-runtime.d.ts +58 -0
  312. package/lib/types/client/production-runtime.d.ts.map +1 -0
  313. package/lib/types/client/video-studio.d.ts +41 -0
  314. package/lib/types/client/video-studio.d.ts.map +1 -0
  315. package/lib/types/client/workbench-ui.d.ts +5 -0
  316. package/lib/types/client/workbench-ui.d.ts.map +1 -0
  317. package/lib/types/game-verification.d.ts +16 -0
  318. package/lib/types/game-verification.d.ts.map +1 -0
  319. package/lib/types/index.d.ts +3 -1
  320. package/lib/types/index.d.ts.map +1 -1
  321. package/lib/types/production-intent.d.ts +21 -0
  322. package/lib/types/production-intent.d.ts.map +1 -0
  323. package/lib/types/production-tool.d.ts +5 -0
  324. package/lib/types/production-tool.d.ts.map +1 -0
  325. package/lib/types/role-tool.d.ts.map +1 -1
  326. package/lib/types/skill-provider.d.ts +7 -0
  327. package/lib/types/skill-provider.d.ts.map +1 -1
  328. package/lib/types/video-project.d.ts +42 -0
  329. package/lib/types/video-project.d.ts.map +1 -0
  330. package/lib/types/workspace-request-trust.d.ts +6 -0
  331. package/lib/types/workspace-request-trust.d.ts.map +1 -1
  332. package/lib/types/workspace-route.d.ts +20 -0
  333. package/lib/types/workspace-route.d.ts.map +1 -1
  334. package/lib/video-recap/CHANGELOG.md +282 -0
  335. package/lib/video-recap/LICENSE +21 -0
  336. package/lib/video-recap/README.en.md +257 -0
  337. package/lib/video-recap/README.md +255 -0
  338. package/lib/video-recap/manifest.json +684 -0
  339. package/lib/video-recap/skills/video-assemble/SKILL.md +97 -0
  340. package/lib/video-recap/skills/video-assemble/references/jianying/LICENSE.duo-video +21 -0
  341. package/lib/video-recap/skills/video-assemble/references/jianying/SOURCE.md +15 -0
  342. package/lib/video-recap/skills/video-assemble/references/jianying/empty_draft_meta_info.json +69 -0
  343. package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_combination_segment.json +84 -0
  344. package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_combination_video_material.json +98 -0
  345. package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_draft.json +204 -0
  346. package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_material_video.json +83 -0
  347. package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_meta_material_value.json +23 -0
  348. package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_project_info.json +133 -0
  349. package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_segment.json +70 -0
  350. package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_text_styles.json +30 -0
  351. package/lib/video-recap/skills/video-assemble/references/jianying/empty_yj_material_audio.json +41 -0
  352. package/lib/video-recap/skills/video-assemble/references/jianying/empty_yj_material_text.json +109 -0
  353. package/lib/video-recap/skills/video-assemble/scripts/artifacts.py +88 -0
  354. package/lib/video-recap/skills/video-assemble/scripts/assemble.py +345 -0
  355. package/lib/video-recap/skills/video-assemble/scripts/assemble_constants.py +34 -0
  356. package/lib/video-recap/skills/video-assemble/scripts/assembly_contract.py +305 -0
  357. package/lib/video-recap/skills/video-assemble/scripts/assembly_settings.py +94 -0
  358. package/lib/video-recap/skills/video-assemble/scripts/audio_automation.py +205 -0
  359. package/lib/video-recap/skills/video-assemble/scripts/audio_mix.py +555 -0
  360. package/lib/video-recap/skills/video-assemble/scripts/export_jianying.py +261 -0
  361. package/lib/video-recap/skills/video-assemble/scripts/jianying_builders.py +767 -0
  362. package/lib/video-recap/skills/video-assemble/scripts/jianying_model.py +111 -0
  363. package/lib/video-recap/skills/video-assemble/scripts/jianying_optional.py +24 -0
  364. package/lib/video-recap/skills/video-assemble/scripts/jianying_schema.py +109 -0
  365. package/lib/video-recap/skills/video-assemble/scripts/jianying_templates.py +37 -0
  366. package/lib/video-recap/skills/video-assemble/scripts/jianying_timeline_contract.py +191 -0
  367. package/lib/video-recap/skills/video-assemble/scripts/jianying_tracks.py +75 -0
  368. package/lib/video-recap/skills/video-assemble/scripts/jianying_writer.py +394 -0
  369. package/lib/video-recap/skills/video-assemble/scripts/lib.py +239 -0
  370. package/lib/video-recap/skills/video-assemble/scripts/media.py +243 -0
  371. package/lib/video-recap/skills/video-assemble/scripts/narration_audio.py +477 -0
  372. package/lib/video-recap/skills/video-assemble/scripts/render_preflight.py +46 -0
  373. package/lib/video-recap/skills/video-assemble/scripts/source_subtitles.py +486 -0
  374. package/lib/video-recap/skills/video-assemble/scripts/subtitle_core.py +376 -0
  375. package/lib/video-recap/skills/video-assemble/scripts/subtitle_render.py +88 -0
  376. package/lib/video-recap/skills/video-assemble/scripts/timeline.py +248 -0
  377. package/lib/video-recap/skills/video-assemble/scripts/timeline_emit.py +89 -0
  378. package/lib/video-recap/skills/video-assemble/scripts/visual_render.py +512 -0
  379. package/lib/video-recap/skills/video-cut/SKILL.md +90 -0
  380. package/lib/video-recap/skills/video-cut/scripts/cut.py +67 -0
  381. package/lib/video-recap/skills/video-cut/scripts/cut_cli.py +320 -0
  382. package/lib/video-recap/skills/video-cut/scripts/cut_contract.py +545 -0
  383. package/lib/video-recap/skills/video-cut/scripts/cut_render.py +348 -0
  384. package/lib/video-recap/skills/video-cut/scripts/lib.py +77 -0
  385. package/lib/video-recap/skills/video-cut/scripts/media_geometry.py +341 -0
  386. package/lib/video-recap/skills/video-cut/scripts/narration_mapping.py +249 -0
  387. package/lib/video-recap/skills/video-cut/scripts/sentence_boundaries.py +745 -0
  388. package/lib/video-recap/skills/video-recap/SKILL.md +216 -0
  389. package/lib/video-recap/skills/video-recap/references/config-playbook.md +61 -0
  390. package/lib/video-recap/skills/video-recap/references/creative-editing-playbook.md +225 -0
  391. package/lib/video-recap/skills/video-recap/references/data-schema.md +534 -0
  392. package/lib/video-recap/skills/video-recap/references/research-guide.md +74 -0
  393. package/lib/video-recap/skills/video-recap/references/shift-left-qc-schema.md +23 -0
  394. package/lib/video-recap/skills/video-recap/references/timeline-and-jianying.md +251 -0
  395. package/lib/video-recap/skills/video-recap/scripts/doctor.py +483 -0
  396. package/lib/video-recap/skills/video-recap/scripts/final_qc.py +737 -0
  397. package/lib/video-recap/skills/video-recap/scripts/lib.py +242 -0
  398. package/lib/video-recap/skills/video-recap/scripts/materials.py +457 -0
  399. package/lib/video-recap/skills/video-recap/scripts/mimo_qc.py +95 -0
  400. package/lib/video-recap/skills/video-recap/scripts/mimo_qc_client.py +18 -0
  401. package/lib/video-recap/skills/video-recap/scripts/mimo_qc_contract.py +9 -0
  402. package/lib/video-recap/skills/video-recap/scripts/mimo_qc_evidence.py +371 -0
  403. package/lib/video-recap/skills/video-recap/scripts/mimo_qc_observations.py +201 -0
  404. package/lib/video-recap/skills/video-recap/scripts/mimo_qc_payload.py +227 -0
  405. package/lib/video-recap/skills/video-recap/scripts/mimo_qc_report.py +362 -0
  406. package/lib/video-recap/skills/video-recap/scripts/mimo_qc_runner.py +129 -0
  407. package/lib/video-recap/skills/video-recap/scripts/qc_contract.py +338 -0
  408. package/lib/video-recap/skills/video-recap/scripts/recap.py +9 -0
  409. package/lib/video-recap/skills/video-recap/scripts/recap_cli.py +140 -0
  410. package/lib/video-recap/skills/video-recap/scripts/recap_inspect.py +550 -0
  411. package/lib/video-recap/skills/video-recap/scripts/recap_review.py +77 -0
  412. package/lib/video-recap/skills/video-recap/scripts/recap_runner.py +654 -0
  413. package/lib/video-recap/skills/video-recap/scripts/recap_runtime.py +335 -0
  414. package/lib/video-recap/skills/video-recap/scripts/recap_stage_qc.py +217 -0
  415. package/lib/video-recap/skills/video-recap/scripts/recap_timeline.py +795 -0
  416. package/lib/video-recap/skills/video-script/SKILL.md +248 -0
  417. package/lib/video-recap/skills/video-script/references/creative-editing-playbook.md +225 -0
  418. package/lib/video-recap/skills/video-script/references/research-guide.md +75 -0
  419. package/lib/video-recap/skills/video-script/scripts/agent_brief.py +399 -0
  420. package/lib/video-recap/skills/video-script/scripts/agent_text.py +410 -0
  421. package/lib/video-recap/skills/video-script/scripts/brief_context.py +403 -0
  422. package/lib/video-recap/skills/video-script/scripts/brief_inputs.py +332 -0
  423. package/lib/video-recap/skills/video-script/scripts/brief_timeline.py +442 -0
  424. package/lib/video-recap/skills/video-script/scripts/deslop_qc.py +237 -0
  425. package/lib/video-recap/skills/video-script/scripts/evidence_bundle.py +492 -0
  426. package/lib/video-recap/skills/video-script/scripts/lib.py +327 -0
  427. package/lib/video-recap/skills/video-script/scripts/narration.py +12 -0
  428. package/lib/video-recap/skills/video-script/scripts/narration_lint.py +678 -0
  429. package/lib/video-recap/skills/video-script/scripts/review.py +42 -0
  430. package/lib/video-recap/skills/video-script/scripts/review_grounding.py +262 -0
  431. package/lib/video-recap/skills/video-script/scripts/review_response.py +761 -0
  432. package/lib/video-recap/skills/video-script/scripts/review_runner.py +200 -0
  433. package/lib/video-recap/skills/video-script/scripts/speech_ownership.py +204 -0
  434. package/lib/video-recap/skills/video-script/scripts/timeline_fusion.py +199 -0
  435. package/lib/video-recap/skills/video-script/scripts/validate.py +164 -0
  436. package/lib/video-recap/skills/video-understanding/SKILL.md +75 -0
  437. package/lib/video-recap/skills/video-understanding/references/data-schema.md +299 -0
  438. package/lib/video-recap/skills/video-understanding/references/prompt-templates.md +37 -0
  439. package/lib/video-recap/skills/video-understanding/references/research-guide.md +74 -0
  440. package/lib/video-recap/skills/video-understanding/scripts/agent_brief.py +399 -0
  441. package/lib/video-recap/skills/video-understanding/scripts/agent_text.py +410 -0
  442. package/lib/video-recap/skills/video-understanding/scripts/asr.py +260 -0
  443. package/lib/video-recap/skills/video-understanding/scripts/brief.py +12 -0
  444. package/lib/video-recap/skills/video-understanding/scripts/brief_context.py +403 -0
  445. package/lib/video-recap/skills/video-understanding/scripts/brief_inputs.py +332 -0
  446. package/lib/video-recap/skills/video-understanding/scripts/brief_timeline.py +442 -0
  447. package/lib/video-recap/skills/video-understanding/scripts/consolidate.py +647 -0
  448. package/lib/video-recap/skills/video-understanding/scripts/deslop_qc.py +237 -0
  449. package/lib/video-recap/skills/video-understanding/scripts/detect.py +513 -0
  450. package/lib/video-recap/skills/video-understanding/scripts/extract.py +62 -0
  451. package/lib/video-recap/skills/video-understanding/scripts/lib.py +470 -0
  452. package/lib/video-recap/skills/video-understanding/scripts/narration_lint.py +678 -0
  453. package/lib/video-recap/skills/video-understanding/scripts/speech_ownership.py +204 -0
  454. package/lib/video-recap/skills/video-understanding/scripts/storyboard.py +507 -0
  455. package/lib/video-recap/skills/video-understanding/scripts/timeline_fusion.py +199 -0
  456. package/lib/video-recap/skills/video-understanding/scripts/understand.py +9 -0
  457. package/lib/video-recap/skills/video-understanding/scripts/understanding_brief.py +216 -0
  458. package/lib/video-recap/skills/video-understanding/scripts/understanding_cache.py +327 -0
  459. package/lib/video-recap/skills/video-understanding/scripts/understanding_runner.py +367 -0
  460. package/lib/video-recap/skills/video-understanding/scripts/understanding_storyboard.py +162 -0
  461. package/lib/video-recap/skills/video-understanding/scripts/vlm.py +705 -0
  462. package/lib/video-recap/skills/video-voiceover/SKILL.md +81 -0
  463. package/lib/video-recap/skills/video-voiceover/scripts/dub.py +637 -0
  464. package/lib/video-recap/skills/video-voiceover/scripts/fish_audio.py +109 -0
  465. package/lib/video-recap/skills/video-voiceover/scripts/lib.py +421 -0
  466. package/lib/video-recap/skills/video-voiceover/scripts/tts_audio.py +113 -0
  467. package/lib/video-recap/skills/video-voiceover/scripts/voiceover.py +782 -0
  468. package/package.json +55 -40
  469. package/lib/oh-story/skills/story-deslop/scripts/check-outline-copy.js +0 -241
  470. package/lib/oh-story/skills/story-long-write/references/format-and-structure.md +0 -169
  471. package/lib/oh-story/skills/story-setup/references/agent-references/genre-writing-formulas.md +0 -444
  472. package/lib/oh-story/skills/story-setup/references/agent-references/quality-checklist.md +0 -247
  473. package/lib/oh-story/skills/story-short-analyze/references/anti-ai-writing.md +0 -582
  474. package/lib/oh-story/skills/story-short-analyze/references/banned-words.md +0 -147
  475. package/lib/oh-story/skills/story-short-analyze/references/genre-catalog.md +0 -490
  476. package/lib/oh-story/skills/story-short-analyze/references/genre-core-mechanics.md +0 -425
  477. package/lib/oh-story/skills/story-short-analyze/references/genre-writing-formulas.md +0 -453
  478. /package/lib/oh-story/skills/{story-long-write/references/hooks-chapter.md → story-setup/references/agent-references/short-chapter-hooks.md} +0 -0
  479. /package/lib/oh-story/skills/{story-long-write/references/hooks-paragraph.md → story-setup/references/agent-references/short-paragraph-hooks.md} +0 -0
@@ -0,0 +1,512 @@
1
+ """Visual overlays, subtitle layout QC, masking, and video filter helpers."""
2
+
3
+ import json
4
+ import re
5
+ from pathlib import Path
6
+
7
+ from artifacts import _artifact_fingerprint
8
+ from assemble_constants import (
9
+ SUBTITLE_STYLE_REF_H,
10
+ VISUAL_OVERLAYS,
11
+ VISUAL_QC,
12
+ _SUPPORTED_VISUAL_OVERLAY_TYPES,
13
+ _VISUAL_DELIVERY_FORBIDDEN_KEYS,
14
+ )
15
+ from audio_automation import coalesce_duck_windows
16
+ from audio_mix import _seg_place_window
17
+ from lib import CONFIG
18
+ from source_subtitles import (
19
+ _combined_subtitle_entries,
20
+ _original_gap_subtitle_entries,
21
+ _source_subtitle_mask_policy,
22
+ )
23
+ from subtitle_core import (
24
+ _measured_subtitle_safe_area,
25
+ _normalize_subtitle_text,
26
+ _style_for_measured_subtitle_band,
27
+ _subtitle_style_config,
28
+ _validate_measured_subtitle_coordinate_domain,
29
+ )
30
+
31
+ def _visual_text_units(text):
32
+ """Approximate visual text width in em units for deterministic geometry QC."""
33
+ units = 0.0
34
+ for ch in str(text or ""):
35
+ if ch.isspace():
36
+ units += 0.35
37
+ elif ord(ch) < 128:
38
+ units += 0.56
39
+ else:
40
+ units += 1.0
41
+ return units
42
+
43
+
44
+ def _subtitle_layout_qc(entries, canvas=None, style=None, safe_area=None):
45
+ """Machine-check subtitle safe-area/multiline/overflow facts for visual_qc.json."""
46
+ canvas = canvas or {}
47
+ style = style or _subtitle_style_config(canvas)
48
+ play_x = int(style.get("play_res_x") or canvas.get("width") or 1280)
49
+ play_y = int(style.get("play_res_y") or canvas.get("height") or 720)
50
+ margin_l = int(style.get("margin_l") or 0)
51
+ margin_r = int(style.get("margin_r") or 0)
52
+ margin_v = int(style.get("margin_v") or 0)
53
+ font_size = float(style.get("font_size") or 1)
54
+ max_lines = int(CONFIG.get("subtitle_max_lines", 2) or 2)
55
+ usable_w = max(1.0, play_x - margin_l - margin_r)
56
+ if safe_area:
57
+ safe_area = {
58
+ "x": int(safe_area.get("x", margin_l) or 0),
59
+ "y": int(safe_area.get("y", margin_v) or 0),
60
+ "width": int(safe_area.get("width", safe_area.get("w", play_x - margin_l - margin_r)) or 1),
61
+ "height": int(safe_area.get("height", safe_area.get("h", play_y - 2 * margin_v)) or 1),
62
+ "bottom_margin": margin_v,
63
+ }
64
+ usable_w = max(1.0, float(safe_area["width"]))
65
+ else:
66
+ safe_area = {
67
+ "x": margin_l,
68
+ "y": margin_v,
69
+ "width": max(1, play_x - margin_l - margin_r),
70
+ "height": max(1, play_y - 2 * margin_v),
71
+ "bottom_margin": margin_v,
72
+ }
73
+ line_h = font_size * 1.25
74
+ overflow_entries = []
75
+ violations = []
76
+ multi_line_entries = []
77
+ max_observed_lines = 0
78
+ entry_facts = []
79
+ for i, entry in enumerate(entries or []):
80
+ raw_text = _normalize_subtitle_text(entry.get("text", ""))
81
+ lines = [ln for ln in re.split(r"(?:\\N|\n)+", raw_text) if ln != ""]
82
+ if not lines:
83
+ lines = [""]
84
+ line_count = len(lines)
85
+ max_observed_lines = max(max_observed_lines, line_count)
86
+ widths = [_visual_text_units(line) * font_size for line in lines]
87
+ max_w = max(widths or [0.0])
88
+ band_h = line_count * line_h + float(style.get("outline", 0)) * 2 + float(style.get("shadow", 0))
89
+ overflow_reasons = []
90
+ if line_count > max_lines:
91
+ overflow_reasons.append("max_lines_exceeded")
92
+ if max_w > usable_w + 1e-6:
93
+ overflow_reasons.append("safe_width_exceeded")
94
+ if band_h > safe_area["height"] + 1e-6:
95
+ overflow_reasons.append("safe_height_exceeded")
96
+ fact = {
97
+ "index": i,
98
+ "start": round(float(entry.get("start", 0.0) or 0.0), 3),
99
+ "end": round(float(entry.get("end", 0.0) or 0.0), 3),
100
+ "line_count": line_count,
101
+ "max_line_width": round(max_w, 2),
102
+ "safe_width": round(usable_w, 2),
103
+ "band_height": round(band_h, 2),
104
+ "overflow": bool(overflow_reasons),
105
+ "overflow_reasons": overflow_reasons,
106
+ }
107
+ entry_facts.append(fact)
108
+ if line_count > 1:
109
+ multi_line_entries.append(i)
110
+ if overflow_reasons:
111
+ overflow_entries.append(fact)
112
+ for reason in overflow_reasons:
113
+ kind = {
114
+ "max_lines_exceeded": "line_count",
115
+ "safe_width_exceeded": "line_width",
116
+ "safe_height_exceeded": "safe_area",
117
+ }.get(reason, "safe_area")
118
+ violations.append({"index": i, "kind": kind, "reason": reason})
119
+ return {
120
+ "enabled": bool(CONFIG.get("burn_subtitles", False)),
121
+ "renderer": "ass" if CONFIG.get("burn_subtitles", False) else "sidecar_srt",
122
+ "style": {
123
+ "font_size": int(font_size),
124
+ "max_chars": int(style.get("max_chars") or 0),
125
+ "max_lines": max_lines,
126
+ "play_res_x": play_x,
127
+ "play_res_y": play_y,
128
+ "alignment": int(style.get("alignment") or 0),
129
+ "margin_l": margin_l,
130
+ "margin_r": margin_r,
131
+ "margin_v": margin_v,
132
+ },
133
+ "safe_area": safe_area,
134
+ "entries": len(entry_facts),
135
+ "max_lines": max_observed_lines,
136
+ "max_observed_lines": max_observed_lines,
137
+ "multi_line": bool(multi_line_entries),
138
+ "multi_line_entries": multi_line_entries,
139
+ "overflow": bool(overflow_entries),
140
+ "overflow_entries": overflow_entries,
141
+ "violations": violations,
142
+ "entry_facts": entry_facts,
143
+ }
144
+
145
+
146
+ def _load_visual_overlays(work_dir, *, with_source=False):
147
+ path = Path(work_dir) / VISUAL_OVERLAYS
148
+ if not path.exists():
149
+ result = ([], {"present": False, "path": str(path), "fingerprint": None})
150
+ return result if with_source else result[0]
151
+ try:
152
+ data = json.loads(path.read_text(encoding="utf-8"))
153
+ except (ValueError, OSError) as exc:
154
+ result = ([], {
155
+ "present": True,
156
+ "path": str(path),
157
+ "fingerprint": _artifact_fingerprint(path),
158
+ "load_error": "invalid_json",
159
+ "load_error_detail": str(exc),
160
+ })
161
+ return result if with_source else result[0]
162
+ source = {
163
+ "present": True,
164
+ "path": str(path),
165
+ "fingerprint": _artifact_fingerprint(path),
166
+ "schema_version": data.get("schema_version") if isinstance(data, dict) else None,
167
+ }
168
+ schema_version = data.get("schema_version") if isinstance(data, dict) else None
169
+ valid_schema_version = (
170
+ isinstance(schema_version, int)
171
+ and not isinstance(schema_version, bool)
172
+ and schema_version == 1
173
+ )
174
+ if isinstance(data, dict) and valid_schema_version and isinstance(data.get("overlays"), list):
175
+ overlays = data["overlays"]
176
+ else:
177
+ overlays = []
178
+ source["load_error"] = "invalid_schema"
179
+ return (overlays, source) if with_source else overlays
180
+
181
+
182
+ def _escape_drawtext_text(text):
183
+ return (
184
+ str(text or "")
185
+ .replace("\\", "\\\\")
186
+ .replace(":", "\\:")
187
+ .replace("'", "\\'")
188
+ .replace("%", "\\%")
189
+ .replace("\n", "\\n")
190
+ )
191
+
192
+
193
+ def _overlay_time_window(overlay, video_duration):
194
+ try:
195
+ start = float(overlay.get("start", 0.0) or 0.0)
196
+ except (TypeError, ValueError):
197
+ start = 0.0
198
+ try:
199
+ end = float(overlay.get("end", video_duration) or video_duration)
200
+ except (TypeError, ValueError):
201
+ end = float(video_duration or 0.0)
202
+ end = max(start, end)
203
+ return start, end
204
+
205
+
206
+ def _overlay_bbox(overlay, canvas, *, default_y):
207
+ width = int((canvas or {}).get("width") or 1280)
208
+ height = int((canvas or {}).get("height") or 720)
209
+ text = str(overlay.get("text") or "")
210
+ font_size = int(overlay.get("font_size") or max(18, round(height * 0.045)))
211
+ lines = [ln for ln in text.splitlines() if ln.strip()] or [text]
212
+ max_w = max((_visual_text_units(ln) * font_size for ln in lines), default=0.0)
213
+ text_h = len(lines) * font_size * 1.25
214
+ if overlay.get("type") == "top_title":
215
+ x = max(0.0, (width - max_w) / 2)
216
+ y = float(overlay.get("y", default_y) or default_y)
217
+ else:
218
+ raw_x = overlay.get("x", 0.08)
219
+ raw_y = overlay.get("y", 0.25)
220
+ try:
221
+ x = float(raw_x)
222
+ if 0.0 <= x <= 1.0:
223
+ x *= width
224
+ except (TypeError, ValueError):
225
+ x = width * 0.08
226
+ try:
227
+ y = float(raw_y)
228
+ if 0.0 <= y <= 1.0:
229
+ y *= height
230
+ except (TypeError, ValueError):
231
+ y = height * 0.25
232
+ return {
233
+ "x": round(x, 2),
234
+ "y": round(y, 2),
235
+ "width": round(max_w, 2),
236
+ "height": round(text_h, 2),
237
+ "font_size": font_size,
238
+ "line_count": len(lines),
239
+ "overflow": x < 0 or y < 0 or x + max_w > width or y + text_h > height,
240
+ }
241
+
242
+
243
+ def _visual_overlay_filters(work_dir, canvas, video_duration):
244
+ """Render the first-release canonical visual_overlays.json contract.
245
+
246
+ Only two semantic renderers are supported: top_title and inline_label_or_callout.
247
+ Unsupported types are QC-blocking and deliberately do not silently render.
248
+ """
249
+ overlays, source = _load_visual_overlays(work_dir, with_source=True)
250
+ height = int((canvas or {}).get("height") or 720)
251
+ default_top_y = max(24, round(height * 0.05))
252
+ filters = []
253
+ facts = []
254
+ unsupported = []
255
+ overflow = []
256
+ for idx, overlay in enumerate(overlays):
257
+ if not isinstance(overlay, dict):
258
+ unsupported.append({"index": idx, "type": None, "reason": "overlay_not_object"})
259
+ continue
260
+ typ = str(overlay.get("type") or "").strip()
261
+ text = str(overlay.get("text") or "").strip()
262
+ if typ not in _SUPPORTED_VISUAL_OVERLAY_TYPES:
263
+ unsupported.append({"index": idx, "type": typ, "reason": "unsupported_overlay_type"})
264
+ continue
265
+ if not text:
266
+ unsupported.append({"index": idx, "type": typ, "reason": "missing_text"})
267
+ continue
268
+ start, end = _overlay_time_window(overlay, video_duration)
269
+ bbox = _overlay_bbox(overlay, canvas, default_y=default_top_y)
270
+ if bbox["overflow"]:
271
+ overflow.append({"index": idx, "type": typ, "bbox": bbox})
272
+ font_size = bbox["font_size"]
273
+ safe_text = _escape_drawtext_text(text)
274
+ enable = f"between(t\\,{start:.3f}\\,{end:.3f})"
275
+ if typ == "top_title":
276
+ filt = (
277
+ "drawtext="
278
+ f"text='{safe_text}':x=(w-text_w)/2:y={int(bbox['y'])}:"
279
+ f"fontsize={font_size}:fontcolor=white:borderw=2:bordercolor=black@0.85:"
280
+ f"box=1:boxcolor=black@0.35:boxborderw=12:enable='{enable}'"
281
+ )
282
+ else:
283
+ filt = (
284
+ "drawtext="
285
+ f"text='{safe_text}':x={int(bbox['x'])}:y={int(bbox['y'])}:"
286
+ f"fontsize={font_size}:fontcolor=white:borderw=2:bordercolor=black@0.85:"
287
+ f"box=1:boxcolor=black@0.45:boxborderw=8:enable='{enable}'"
288
+ )
289
+ filters.append(filt)
290
+ facts.append({
291
+ "index": idx,
292
+ "type": typ,
293
+ "text_chars": len(text),
294
+ "start": round(start, 3),
295
+ "end": round(end, 3),
296
+ "bbox": bbox,
297
+ })
298
+ qc = {
299
+ "source": source,
300
+ "load_error": source.get("load_error"),
301
+ "supported_types": sorted(_SUPPORTED_VISUAL_OVERLAY_TYPES),
302
+ "present": bool(source.get("present")),
303
+ "count": len(overlays),
304
+ "rendered": len(facts),
305
+ "facts": facts,
306
+ "unsupported": unsupported,
307
+ "overflow": overflow,
308
+ }
309
+ return filters, qc
310
+
311
+
312
+ def _visual_qc_has_forbidden_delivery_facts(value):
313
+ if isinstance(value, dict):
314
+ for key, child in value.items():
315
+ if key in _VISUAL_DELIVERY_FORBIDDEN_KEYS:
316
+ return True
317
+ if _visual_qc_has_forbidden_delivery_facts(child):
318
+ return True
319
+ elif isinstance(value, list):
320
+ return any(_visual_qc_has_forbidden_delivery_facts(item) for item in value)
321
+ return False
322
+
323
+
324
+ def _build_visual_qc(tts_segments, work_dir, video_duration, canvas, *, overlay_qc=None, mask_filter=None):
325
+ entries = _combined_subtitle_entries(tts_segments, work_dir, video_duration)
326
+ style = _style_for_measured_subtitle_band(_subtitle_style_config(canvas), canvas)
327
+ subtitle_layout = _subtitle_layout_qc(
328
+ entries, canvas, style, safe_area=_measured_subtitle_safe_area(style, canvas)
329
+ )
330
+ mask = _source_subtitle_mask_policy(work_dir)
331
+ ratio = None
332
+ if mask.get("active"):
333
+ ratio = max(0.0, min(0.5, float(CONFIG.get("source_subtitle_mask_ratio", 0.14) or 0.0)))
334
+ mask.update({
335
+ "ratio": ratio,
336
+ "filter": "drawbox" if mask_filter else None,
337
+ "opacity": float(CONFIG.get("subtitle_mask_opacity", 0.6)),
338
+ "timing": str(CONFIG.get("source_subtitle_mask_timing", "narration")),
339
+ "subtitle_y_top": int(CONFIG.get("subtitle_y_top", -1)),
340
+ "subtitle_y_bot": int(CONFIG.get("subtitle_y_bot", -1)),
341
+ })
342
+ overlay_qc = overlay_qc or _visual_overlay_filters(work_dir, canvas, video_duration)[1]
343
+ blocking_codes = []
344
+ if mask.get("blocking"):
345
+ blocking_codes.append("mask_policy_not_explicit")
346
+ if subtitle_layout.get("overflow"):
347
+ blocking_codes.append("subtitle_overflow")
348
+ if overlay_qc.get("load_error"):
349
+ blocking_codes.append("invalid_visual_overlays_json")
350
+ if overlay_qc.get("unsupported"):
351
+ blocking_codes.append("unsupported_visual_overlay")
352
+ if overlay_qc.get("overflow"):
353
+ blocking_codes.append("visual_overlay_overflow")
354
+ qc = {
355
+ "schema_version": 1,
356
+ "artifact": VISUAL_QC,
357
+ "verdict": "FAIL" if blocking_codes else "PASS",
358
+ "blocking": bool(blocking_codes),
359
+ "blocking_codes": blocking_codes,
360
+ "geometry": {
361
+ "canvas": {
362
+ "width": int(canvas.get("width", 1280)),
363
+ "height": int(canvas.get("height", 720)),
364
+ "fps": float(canvas.get("fps", 30.0)),
365
+ },
366
+ "storage": {
367
+ "width": int(canvas.get("storage_width", canvas.get("width", 1280))),
368
+ "height": int(canvas.get("storage_height", canvas.get("height", 720))),
369
+ },
370
+ "rotation": int(canvas.get("rotation", 0) or 0),
371
+ "sample_aspect_ratio": canvas.get("sample_aspect_ratio", "1:1"),
372
+ "display_aspect_ratio": canvas.get("display_aspect_ratio"),
373
+ },
374
+ "subtitles": subtitle_layout,
375
+ "mask": mask,
376
+ "overlays": overlay_qc,
377
+ "summary": {
378
+ "subtitle_entries": subtitle_layout.get("entries", 0),
379
+ "subtitle_overflow": bool(subtitle_layout.get("overflow")),
380
+ "subtitle_multi_line": bool(subtitle_layout.get("multi_line")),
381
+ "mask_policy": mask.get("policy"),
382
+ "mask_active": bool(mask.get("active")),
383
+ "overlay_rendered": int(overlay_qc.get("rendered", 0) or 0),
384
+ "overlay_unsupported": len(overlay_qc.get("unsupported") or []),
385
+ },
386
+ }
387
+ if _visual_qc_has_forbidden_delivery_facts(qc):
388
+ qc["verdict"] = "FAIL"
389
+ qc["blocking"] = True
390
+ qc["blocking_codes"].append("visual_qc_contains_delivery_fact")
391
+ return qc
392
+
393
+
394
+ def _write_visual_qc(work_dir, qc):
395
+ path = Path(work_dir) / VISUAL_QC
396
+ path.write_text(json.dumps(qc, ensure_ascii=False, indent=2), encoding="utf-8")
397
+ return path
398
+
399
+
400
+ def _escape_subtitle_filter_path(path):
401
+ """Escape a path for ffmpeg subtitle/ass video filter arguments."""
402
+ text = str(path).replace("\\", "/")
403
+ for raw, escaped in (
404
+ ("\\", "\\\\"),
405
+ (":", "\\:"),
406
+ ("'", "\\'"),
407
+ (",", "\\,"),
408
+ ("[", "\\["),
409
+ ("]", "\\]"),
410
+ ):
411
+ text = text.replace(raw, escaped)
412
+ return text
413
+
414
+
415
+ def _subtitle_burn_filter(subtitle_path):
416
+ """Build the ffmpeg video filter used for hard-sub rendering."""
417
+ return f"subtitles=filename='{_escape_subtitle_filter_path(subtitle_path)}'"
418
+
419
+
420
+ def _output_downscale_filter(max_h):
421
+ """Lanczos downscale that forces BOTH output dimensions even (libx264/yuv420p need it).
422
+
423
+ -2 keeps the aspect ratio with an even width; 2*trunc(min(ih,H)/2) caps the height at H
424
+ yet forces it even, so an odd OUTPUT_MAX_HEIGHT (e.g. 721) cannot produce an odd height
425
+ that makes libx264 abort with an empty output file. 'min(ih,H)' only ever shrinks.
426
+ """
427
+ return f"scale=-2:'2*trunc(min(ih,{max_h})/2)':flags=lanczos"
428
+
429
+
430
+ def _source_subtitle_mask_filter(
431
+ canvas=None, work_dir=None, tts_segments=None, video_duration=None
432
+ ):
433
+ """Return source-subtitle drawbox filters, optionally scoped to narration windows.
434
+
435
+ Many source videos (e.g. 庆余年) ship hardcoded subtitles; without this the recap
436
+ shows the original subs AND our narration subs stacked. Once masking is explicitly enabled,
437
+ the enhanced default is a measured, translucent narration-only band; opacity and timing
438
+ remain configurable.
439
+ """
440
+ policy = _source_subtitle_mask_policy(work_dir)
441
+ if not policy.get("active"):
442
+ return None
443
+ opacity = max(0.0, min(1.0, float(CONFIG.get("subtitle_mask_opacity", 0.6))))
444
+
445
+ _validate_measured_subtitle_coordinate_domain(canvas)
446
+
447
+ canvas_h = int((canvas or {}).get("height", 0) or 0)
448
+ y_top = int(CONFIG.get("subtitle_y_top", -1))
449
+ y_bot = int(CONFIG.get("subtitle_y_bot", -1))
450
+ custom_band = canvas_h > 0 and 0 <= y_top < y_bot <= canvas_h
451
+ if custom_band:
452
+ padding = int(CONFIG.get("subtitle_mask_padding", 4) or 0)
453
+ mask_top = max(0, y_top - padding)
454
+ mask_bot = min(canvas_h, y_bot + padding)
455
+ geometry = f"x=0:y={mask_top}:w=iw:h={mask_bot - mask_top}"
456
+ else:
457
+ ratio = max(0.0, min(0.5, float(CONFIG.get("source_subtitle_mask_ratio", 0.14) or 0.0)))
458
+ # Our subtitle cues are one line. Keep the mask large enough for that line and its
459
+ # margin, but never regress to the old two-line bar that hid ~23% of the image.
460
+ style = _subtitle_style_config(canvas)
461
+ play_res_y = max(1.0, float(style["play_res_y"]))
462
+ line_h = float(style["font_size"]) * 1.25
463
+ pad = 10.0 * play_res_y / SUBTITLE_STYLE_REF_H
464
+ sub_band = (float(style["margin_v"]) + line_h + pad) / play_res_y
465
+ ratio = min(0.5, max(ratio, sub_band))
466
+ if ratio <= 0:
467
+ return None
468
+ geometry = f"x=0:y=ih-ih*{ratio:.3f}:w=iw:h=ih*{ratio:.3f}"
469
+
470
+ base = f"drawbox={geometry}:color=black@{opacity:.2f}:t=fill"
471
+ timing = str(CONFIG.get("source_subtitle_mask_timing", "narration") or "narration").lower()
472
+ if timing not in {"all", "narration"}:
473
+ timing = "narration"
474
+ filters = []
475
+ if timing == "all" and opacity > 0:
476
+ filters.append(base)
477
+ elif timing == "narration" and opacity > 0:
478
+ windows = []
479
+ for seg in tts_segments or []:
480
+ if not isinstance(seg, dict):
481
+ continue
482
+ start, end = _seg_place_window(seg)
483
+ try:
484
+ start, end = float(start), float(end)
485
+ except (TypeError, ValueError):
486
+ continue
487
+ if end <= start:
488
+ continue
489
+ windows.append((start, end, 0.0))
490
+ # Avoid overlapping drawboxes: stacking two 60%-black masks would darken the overlap
491
+ # to 84%. Coalescing also keeps long filter chains smaller.
492
+ filters.extend(
493
+ f"{base}:enable='between(t,{start:.3f},{end:.3f})'"
494
+ for start, end, _ in coalesce_duck_windows(windows, bridge=0.001)
495
+ )
496
+
497
+ # A translucent mask deliberately leaves the source glyphs visible. Whenever we burn a
498
+ # replacement original-dialogue subtitle into a gap, cover that exact window opaquely first;
499
+ # otherwise the source hard-sub and replacement text are stacked on top of each other.
500
+ if video_duration is not None and not (timing == "all" and opacity >= 1.0 - 1e-9):
501
+ replacement_entries = _original_gap_subtitle_entries(
502
+ tts_segments or [], work_dir, video_duration
503
+ )
504
+ replacement_windows = [
505
+ (entry["start"], entry["end"], 0.0) for entry in replacement_entries
506
+ ]
507
+ opaque = f"drawbox={geometry}:color=black@1.00:t=fill"
508
+ filters.extend(
509
+ f"{opaque}:enable='between(t,{start:.3f},{end:.3f})'"
510
+ for start, end, _ in coalesce_duck_windows(replacement_windows, bridge=0.001)
511
+ )
512
+ return ",".join(filters) if filters else None
@@ -0,0 +1,90 @@
1
+ ---
2
+ name: video-cut
3
+ user-invocable: false
4
+ description: >
5
+ 把长视频按 Agent 选择的原片区间剪成短片。作为两阶段创作流程中的剪辑环节,读取 clip_plan.json 与源视频,
6
+ 输出 edited_source.mp4;随后 Agent 按输出时间线写 narration.json。单独调用且未传 --no-narration-map 时,
7
+ 仍支持旧版单阶段路径,把原片时间的 narration.json 映射为 narration_mapped.json。
8
+ 触发词:视频剪辑、剪辑式解说、video cut、clip plan、拼剪。
9
+ ---
10
+
11
+ ## 1. 定位
12
+
13
+ 本技能只执行 Agent 已经做出的剪辑决定:
14
+
15
+ 1. 校验并补全 `clip_plan.json`,写出带 `clip_id`、原片/输出时间与时长的 `clip_plan_validated.json`。
16
+ 2. 先避开原片硬切附近的闪帧风险,最后把边界吸附到可靠句末/自然停顿;声音完整性拥有最终优先级。
17
+ 3. 拼接选定区间,输出 `edited_source.mp4`。
18
+ 4. 编排流程默认到此停止,由 Agent 按真实输出时间线写 `narration.json`。
19
+ 5. 旧版单阶段路径还会把原片时间的旁白映射为 `narration_mapped.json`。
20
+
21
+ 相同输入会得到相同输出。缓存仅表示:当 `edited_source.mp4` 新于 `clip_plan.json` 时复用成片。
22
+
23
+ ## 2. 输入契约
24
+
25
+ `work_dir/clip_plan.json` 可以是数组,也可以是 `{"clips": [...]}`:
26
+
27
+ ```json
28
+ {"start": 12.0, "end": 28.5, "reason": "b02 | turn | power: A→B | POV=女主 | 保留反应 | 入点=问题落下 | 出点=沉默结束"}
29
+ ```
30
+
31
+ - `start` / `end` 是原片秒数;也接受 `source_start` / `source_end` 或 `in` / `out`。
32
+ - 顶层可选 `target_duration`,例如 `"10m"`。
33
+ - 多视频项目的每个片段还必须填写 `source_id`。
34
+ - `speech_boundary_anchors.json` 与 ASR 时间段由理解阶段提供;Agent 先写大致区间,工具会尝试吸附并把仍在讲话区间内的入/出点作为 blocker 返回。
35
+
36
+ `work_dir/narration.json` 只在旧版单阶段路径中可选读取;该路径要求旁白使用原片时间。若允许重复或重叠片段,旁白可带 `source_clip_id` 消歧。
37
+
38
+ ## 3. 剪辑意图契约
39
+
40
+ 工具不会替 Agent 做创作选择。写片段前先完成本节的剪辑意图检查,并让每个区间映射到 `recap_story_plan.json` 的一个 beat。
41
+
42
+ 使用现有自由文本 `reason` 保存简洁决定:
43
+
44
+ ```text
45
+ beat_id | function | change | POV | preferred moment | 入点 reason | 出点 reason
46
+ ```
47
+
48
+ 不要因为“事件重要”就保留整段;要保留最能让 change 成立的具体表演、反应、动作或揭示。理解与情绪允许时晚进早出,同时保证台词、动作和技术边界完整。
49
+
50
+ 下面的 `scripts/...` 均相对于本技能目录。若执行器从仓库根目录启动,请给脚本路径加上本技能的绝对目录。脚本不从其他技能目录读取文件;外部输入仅限命令显式传入的视频、参数与 `work_dir` 产物。
51
+
52
+ ## 4. 运行命令
53
+
54
+ ```bash
55
+ python3 scripts/cut.py <video> --work-dir <work_dir> \
56
+ [--target-duration 10m] [--clip-padding 0] [--allow-overlap]
57
+ ```
58
+
59
+ ## 5. 输出契约
60
+
61
+ - `clip_plan_validated.json`:标准化片段,包含 `clip_id`、`source_start/end`、`output_start/end` 与 `duration`。
62
+ - `edited_source.mp4`:按计划拼接后的短视频。
63
+ - `narration_mapped.json`:仅旧版单阶段路径生成;编排流程使用 `--no-narration-map`,不会生成该文件。
64
+
65
+ 编排流程下游把 `edited_source.mp4` 当作视频,把 Agent 按输出时间写的 `narration.json` 当作旁白。
66
+
67
+ ## 6. 边界与时间线规则
68
+
69
+ - 旧版路径中,`clip_plan.json` 与 `narration.json` 都使用原片时间;本工具负责原片 → 输出映射。
70
+ - 编排路径中,`narration.json` 直接使用剪后输出时间,不再映射。
71
+ - 默认禁止重叠或重复原片区间;`--allow-overlap` 开启后,旁白应填写 `source_clip_id`。
72
+ - 片段起点只能位于源头、可靠句末/静音窗,或与上一片段构成无损同源连续连接;片段终点同理。ASR 判定仍在讲话且无法吸附时写入 `unsafe_clip_sentence_boundary` 并阻断。
73
+ - `SCENE_CUT_SNAP` 默认开启:先按画面把 source start 向后、source end 向前吸附到附近硬切,随后句末吸附再做最终修正,避免视觉修正重新制造半句原声。默认范围为 `SCENE_CUT_SNAP_MARGIN=0.5` 秒,检测阈值为 `SCENE_CUT_DETECT_THRESHOLD=0.4`。
74
+ - scene-change score 只提供接点候选,不证明接点自然。先检查短时间窗内是否出现密集候选,再区分来源:原片自带的无关短镜头整段删除;相关但短到像闪帧的镜头通过扩展 IN/OUT 保留完整动作、反应或台词,不用定格/慢放伪造时长;由本次拼接制造的切点则优先移动边界、恢复同源连续运动、合并相邻片段或改用更自然的连接,尽量消除。成片后仍要逐个播放接点前后约 0.5–1 秒;白闪或曝光叠化再结合逐帧亮度定位,不能为了通过视觉检测切断完整台词,也不能用转场遮掩坏接点。
75
+ - 连续同源片段的无损连接不做句中双侧音频淡出;非连续片段仍在安全停顿内做防爆音淡入淡出。
76
+ - 旧版旁白映射若跨越 clip 边界,不再裁短后继续:`clamped_beats` 永久阻断,`--allow-sparse-cut` 也不能绕过旁白句子完整性。
77
+
78
+ 需要检查短时间频繁切镜时,先用 ffmpeg scene filter 召回候选时间:
79
+
80
+ ```bash
81
+ ffmpeg -i input.mp4 -vf "select='gt(scene,0.35)',showinfo" -an -f null -
82
+ ```
83
+
84
+ `0.35` 是起始阈值,不是质量判据;大幅运动、闪白和叠化都可能误报。把候选映射回原片 shot 与本次拼接边界后,按上面的来源分类处理,并以正常速度播放决定是否保留。
85
+
86
+ ## 7. 能力边界
87
+
88
+ - 不重新转写,也不做人物、剧情或情绪等语义理解;scene filter 只承担技术边界候选检测。
89
+ - 不写旁白,也不替 Agent 选择片段;只消费 `clip_plan.json`。
90
+ - 只做生成 `edited_source.mp4` 所需的剪切、拼接与一次中间编码,不承担字幕包装或最终交付压缩。
@@ -0,0 +1,67 @@
1
+ #!/usr/bin/env python3
2
+ """Public API and CLI entrypoint for the self-contained video-cut skill."""
3
+
4
+ from cut_cli import main
5
+ from cut_contract import (
6
+ cut_plan_fingerprint,
7
+ edited_source_render_cache_payload,
8
+ edited_source_render_fingerprint,
9
+ file_fingerprint,
10
+ load_clip_plan,
11
+ normalize_clip_plan,
12
+ normalize_multi_source_clip_plan,
13
+ normalize_sources_manifest,
14
+ parse_duration_seconds,
15
+ should_reuse_edited_source,
16
+ value_fingerprint,
17
+ )
18
+ from cut_render import (
19
+ build_edited_source_video,
20
+ update_delivery_qc,
21
+ write_cut_delivery_qc,
22
+ )
23
+ from media_geometry import VideoGeometry
24
+ from narration_mapping import (
25
+ lint_mapped_narration,
26
+ map_narration_to_clips,
27
+ source_time_to_output_time,
28
+ update_cut_qc,
29
+ )
30
+ from sentence_boundaries import (
31
+ enforce_clip_sentence_boundaries,
32
+ snap_clip_ends_to_lines,
33
+ snap_clip_starts_to_lines,
34
+ snap_clips_off_shot_changes,
35
+ snap_multi_source_clips,
36
+ )
37
+
38
+ __all__ = [
39
+ "VideoGeometry",
40
+ "build_edited_source_video",
41
+ "cut_plan_fingerprint",
42
+ "edited_source_render_cache_payload",
43
+ "edited_source_render_fingerprint",
44
+ "enforce_clip_sentence_boundaries",
45
+ "file_fingerprint",
46
+ "lint_mapped_narration",
47
+ "load_clip_plan",
48
+ "main",
49
+ "map_narration_to_clips",
50
+ "normalize_clip_plan",
51
+ "normalize_multi_source_clip_plan",
52
+ "normalize_sources_manifest",
53
+ "parse_duration_seconds",
54
+ "should_reuse_edited_source",
55
+ "snap_clip_ends_to_lines",
56
+ "snap_clip_starts_to_lines",
57
+ "snap_clips_off_shot_changes",
58
+ "snap_multi_source_clips",
59
+ "source_time_to_output_time",
60
+ "update_cut_qc",
61
+ "update_delivery_qc",
62
+ "value_fingerprint",
63
+ "write_cut_delivery_qc",
64
+ ]
65
+
66
+ if __name__ == "__main__":
67
+ main()