@oh-story/dsh 0.1.3 → 0.1.5

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 (524) hide show
  1. package/README.md +58 -12
  2. package/lib/client.js +2970 -537
  3. package/lib/client.js.map +4 -4
  4. package/lib/drama/manifest.json +218 -178
  5. package/lib/drama/skills/short-drama/SKILL.md +110 -117
  6. package/lib/drama/skills/short-drama/references/audience-reveal.md +14 -67
  7. package/lib/drama/skills/short-drama/references/contract-and-ownership.md +26 -77
  8. package/lib/drama/skills/short-drama/references/creator-documents.md +204 -0
  9. package/lib/drama/skills/short-drama/references/creator-workflow.md +73 -63
  10. package/lib/drama/skills/short-drama/references/knowhow-index.md +5 -0
  11. package/lib/drama/skills/short-drama/references/look-development.md +2 -3
  12. package/lib/drama/skills/short-drama/references/pickup-and-alternate.md +14 -48
  13. package/lib/drama/skills/short-drama/references/production-form-profiles.md +1 -1
  14. package/lib/drama/skills/short-drama/references/reference-roles.md +32 -135
  15. package/lib/drama/skills/short-drama/references/runtime-preflight.md +16 -19
  16. package/lib/drama/skills/short-drama/scripts/creator_markdown_check.py +1002 -0
  17. package/lib/drama/skills/short-drama/scripts/project_tool.py +485 -5
  18. package/lib/drama/skills/short-drama-assets/SKILL.md +59 -170
  19. package/lib/drama/skills/short-drama-assets/references/asset-review-checklist.md +18 -25
  20. package/lib/drama/skills/short-drama-assets/references/character-and-look.md +13 -15
  21. package/lib/drama/skills/short-drama-assets/references/continuity-delta.md +11 -14
  22. package/lib/drama/skills/short-drama-assets/references/continuity-lock.md +116 -0
  23. package/lib/drama/skills/short-drama-assets/references/identity-vs-variant.md +6 -12
  24. package/lib/drama/skills/short-drama-assets/references/occurrence-extraction.md +8 -11
  25. package/lib/drama/skills/short-drama-assets/references/prop-and-state.md +21 -2
  26. package/lib/drama/skills/short-drama-assets/references/stage-contract.md +12 -105
  27. package/lib/drama/skills/short-drama-assets/references/voice-direction.md +12 -32
  28. package/lib/drama/skills/short-drama-assets/scripts/asset_check.py +1 -1
  29. package/lib/drama/skills/short-drama-image-prompts/SKILL.md +45 -155
  30. package/lib/drama/skills/short-drama-image-prompts/references/character-and-look.md +12 -13
  31. package/lib/drama/skills/short-drama-image-prompts/references/common-recipe.md +12 -13
  32. package/lib/drama/skills/short-drama-image-prompts/references/edit-and-revision.md +39 -51
  33. package/lib/drama/skills/short-drama-image-prompts/references/location-plate.md +3 -4
  34. package/lib/drama/skills/short-drama-image-prompts/references/look-and-state-variant.md +15 -14
  35. package/lib/drama/skills/short-drama-image-prompts/references/lookdev-frame.md +11 -15
  36. package/lib/drama/skills/short-drama-image-prompts/references/production-sheet-recipes.md +1 -1
  37. package/lib/drama/skills/short-drama-image-prompts/references/prop-plate.md +4 -7
  38. package/lib/drama/skills/short-drama-image-prompts/references/review-and-fixtures.md +23 -23
  39. package/lib/drama/skills/short-drama-image-prompts/references/stage-contract.md +8 -65
  40. package/lib/drama/skills/short-drama-image-prompts/scripts/image_prompt_check.py +8 -8
  41. package/lib/drama/skills/short-drama-image-prompts/scripts/selftest.py +4 -2
  42. package/lib/drama/skills/short-drama-produce/SKILL.md +67 -15
  43. package/lib/drama/skills/short-drama-produce/references/adapter-contract.md +65 -8
  44. package/lib/drama/skills/short-drama-produce/references/providers/minimax-h3-video.md +85 -0
  45. package/lib/drama/skills/short-drama-produce/references/providers/seedance.md +27 -10
  46. package/lib/drama/skills/short-drama-produce/scripts/production_tool.py +362 -3
  47. package/lib/drama/skills/short-drama-produce/scripts/provider_adapters.py +627 -40
  48. package/lib/drama/skills/short-drama-produce/scripts/selftest.py +5 -4
  49. package/lib/drama/skills/short-drama-review/SKILL.md +61 -123
  50. package/lib/drama/skills/short-drama-review/references/anti-template-repair.md +10 -15
  51. package/lib/drama/skills/short-drama-review/references/production-quality-gates.md +15 -16
  52. package/lib/drama/skills/short-drama-review/references/project-calibration.md +7 -9
  53. package/lib/drama/skills/short-drama-review/references/review-method.md +8 -9
  54. package/lib/drama/skills/short-drama-review/references/rubric-assets-prompts.md +9 -13
  55. package/lib/drama/skills/short-drama-review/references/rubric-story-script.md +104 -4
  56. package/lib/drama/skills/short-drama-review/references/rubric-visual-motion.md +27 -19
  57. package/lib/drama/skills/short-drama-review/references/stage-contract.md +4 -63
  58. package/lib/drama/skills/short-drama-review/scripts/review_check.py +1 -1
  59. package/lib/drama/skills/short-drama-storyboard/SKILL.md +116 -238
  60. package/lib/drama/skills/short-drama-storyboard/assets/shot-template.jsonl +1 -1
  61. package/lib/drama/skills/short-drama-storyboard/references/blocking-playbooks.md +9 -34
  62. package/lib/drama/skills/short-drama-storyboard/references/comic-keyframe-lexicon.md +156 -0
  63. package/lib/drama/skills/short-drama-storyboard/references/coverage-audition.md +5 -10
  64. package/lib/drama/skills/short-drama-storyboard/references/keyframe-craft.md +12 -7
  65. package/lib/drama/skills/short-drama-storyboard/references/production-shot-grammar.md +19 -4
  66. package/lib/drama/skills/short-drama-storyboard/references/review-and-fixtures.md +27 -62
  67. package/lib/drama/skills/short-drama-storyboard/references/scene-visual-plan.md +16 -25
  68. package/lib/drama/skills/short-drama-storyboard/references/screenplay-to-keyframe-example.md +21 -23
  69. package/lib/drama/skills/short-drama-storyboard/references/shot-craft.md +8 -10
  70. package/lib/drama/skills/short-drama-storyboard/references/shot-revision-identity.md +9 -13
  71. package/lib/drama/skills/short-drama-storyboard/references/stage-contract.md +16 -71
  72. package/lib/drama/skills/short-drama-storyboard/scripts/storyboard_check.py +1 -1
  73. package/lib/drama/skills/short-drama-video-prompts/SKILL.md +123 -230
  74. package/lib/drama/skills/short-drama-video-prompts/assets/motion-spec.jsonl.md +6 -1
  75. package/lib/drama/skills/short-drama-video-prompts/assets/video-prompts.md +17 -1
  76. package/lib/drama/skills/short-drama-video-prompts/references/camera-audio-continuity.md +10 -8
  77. package/lib/drama/skills/short-drama-video-prompts/references/delivery-profile.md +24 -6
  78. package/lib/drama/skills/short-drama-video-prompts/references/generability.md +2 -2
  79. package/lib/drama/skills/short-drama-video-prompts/references/minimax-h3.md +154 -0
  80. package/lib/drama/skills/short-drama-video-prompts/references/motion-recipe.md +35 -27
  81. package/lib/drama/skills/short-drama-video-prompts/references/performance-action-timing.md +8 -11
  82. package/lib/drama/skills/short-drama-video-prompts/references/production-prompt-grammar.md +13 -10
  83. package/lib/drama/skills/short-drama-video-prompts/references/review-and-fixtures.md +34 -63
  84. package/lib/drama/skills/short-drama-video-prompts/references/seedance-2.0.md +41 -0
  85. package/lib/drama/skills/short-drama-video-prompts/references/seedance-2.5.md +66 -0
  86. package/lib/drama/skills/short-drama-video-prompts/references/stage-contract.md +17 -73
  87. package/lib/drama/skills/short-drama-video-prompts/references/target-model-profile.md +115 -0
  88. package/lib/drama/skills/short-drama-video-prompts/scripts/container_check.py +1 -1
  89. package/lib/drama/skills/short-drama-video-prompts/scripts/music_spec_check.py +1 -1
  90. package/lib/drama/skills/short-drama-write/SKILL.md +74 -268
  91. package/lib/drama/skills/short-drama-write/references/dialogue-craft.md +7 -0
  92. package/lib/drama/skills/short-drama-write/references/scene-handoff-capsule.md +17 -43
  93. package/lib/drama/skills/short-drama-write/references/screenplay-format.md +15 -15
  94. package/lib/drama/skills/short-drama-write/references/script-craft.md +208 -21
  95. package/lib/drama/skills/short-drama-write/references/stage-contract.md +11 -70
  96. package/lib/drama/skills/short-drama-write/scripts/duration_estimate.py +1 -1
  97. package/lib/drama/skills/short-drama-write/scripts/screenplay_index.py +2 -2
  98. package/lib/drama/skills/short-drama-write/scripts/voice_sheet_check.py +1 -1
  99. package/lib/index.js +971 -46
  100. package/lib/index.js.map +4 -4
  101. package/lib/novel-to-game/LICENSE +21 -0
  102. package/lib/novel-to-game/README.md +180 -0
  103. package/lib/novel-to-game/README_ZH.md +178 -0
  104. package/lib/novel-to-game/VERSION +1 -0
  105. package/lib/novel-to-game/examples/jin-ping-mei/build/BUILD_BRIEF.md +217 -0
  106. package/lib/novel-to-game/examples/jin-ping-mei/build/app/.vercelignore +3 -0
  107. package/lib/novel-to-game/examples/jin-ping-mei/build/app/RUN.md +130 -0
  108. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/bg/compound_new_guofeng.webp +0 -0
  109. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/finale/fate_coda.webp +0 -0
  110. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/finale/meng.webp +0 -0
  111. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/finale/pan.webp +0 -0
  112. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/finale/pinger.webp +0 -0
  113. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/finale/xuee.webp +0 -0
  114. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/finale/yue.webp +0 -0
  115. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/group/inner_court_accord_five.webp +0 -0
  116. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/group/inner_court_afterglow_five.webp +0 -0
  117. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/group/inner_court_alliance.webp +0 -0
  118. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/group/public_day10.webp +0 -0
  119. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/group/public_day15.webp +0 -0
  120. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/group/public_day5.webp +0 -0
  121. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/group/title_new_guofeng.webp +0 -0
  122. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/joint/pan_pinger.webp +0 -0
  123. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/joint/pan_xuee.webp +0 -0
  124. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/joint/yue_meng.webp +0 -0
  125. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/joint/yue_pan.webp +0 -0
  126. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/joint/yue_pinger.webp +0 -0
  127. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/meng/explicit.webp +0 -0
  128. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/meng/prelude.webp +0 -0
  129. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/milestone/meng.webp +0 -0
  130. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/milestone/pan.webp +0 -0
  131. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/milestone/pinger.webp +0 -0
  132. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/milestone/xuee.webp +0 -0
  133. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/milestone/yue.webp +0 -0
  134. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/pan/explicit.webp +0 -0
  135. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/pan/prelude.webp +0 -0
  136. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/pinger/explicit.webp +0 -0
  137. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/pinger/prelude.webp +0 -0
  138. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/xuee/explicit.webp +0 -0
  139. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/xuee/prelude.webp +0 -0
  140. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/yue/explicit.webp +0 -0
  141. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/yue/prelude.webp +0 -0
  142. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/heroine/meng/night.webp +0 -0
  143. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/heroine/pan/night.webp +0 -0
  144. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/heroine/pinger/night.webp +0 -0
  145. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/heroine/xuee/night.webp +0 -0
  146. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/heroine/yue/night.webp +0 -0
  147. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/household/li_jiaoer.webp +0 -0
  148. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/scene/gate_collector.webp +0 -0
  149. package/lib/novel-to-game/examples/jin-ping-mei/build/app/css/new-guofeng.css +1105 -0
  150. package/lib/novel-to-game/examples/jin-ping-mei/build/app/css/style.css +2539 -0
  151. package/lib/novel-to-game/examples/jin-ping-mei/build/app/index.html +18 -0
  152. package/lib/novel-to-game/examples/jin-ping-mei/build/app/js/assets.js +147 -0
  153. package/lib/novel-to-game/examples/jin-ping-mei/build/app/js/audio.js +332 -0
  154. package/lib/novel-to-game/examples/jin-ping-mei/build/app/js/data.js +7472 -0
  155. package/lib/novel-to-game/examples/jin-ping-mei/build/app/js/engine.js +13077 -0
  156. package/lib/novel-to-game/examples/jin-ping-mei/build/app/js/main.js +3028 -0
  157. package/lib/novel-to-game/examples/jin-ping-mei/build/app/js/text.js +32 -0
  158. package/lib/novel-to-game/examples/jin-ping-mei/build/app/package.json +10 -0
  159. package/lib/novel-to-game/examples/jin-ping-mei/build/app/vercel.json +23 -0
  160. package/lib/novel-to-game/examples/jin-ping-mei/build/art/generated-art.json +161 -0
  161. package/lib/novel-to-game/examples/jin-ping-mei/example.json +12 -0
  162. package/lib/novel-to-game/examples/jin-ping-mei/qa/README.md +31 -0
  163. package/lib/novel-to-game/examples/jin-ping-mei/qa/playable-model.json +99 -0
  164. package/lib/novel-to-game/examples/jin-ping-mei/qa/verification.json +41 -0
  165. package/lib/novel-to-game/examples/jin-ping-mei/qa/verify_playable_model.mjs +129 -0
  166. package/lib/novel-to-game/manifest.json +508 -0
  167. package/lib/novel-to-game/skills/game-art-direction/SKILL.md +73 -0
  168. package/lib/novel-to-game/skills/game-art-direction/agents/openai.yaml +4 -0
  169. package/lib/novel-to-game/skills/game-art-direction/references/art-direction-method.md +119 -0
  170. package/lib/novel-to-game/skills/game-build/SKILL.md +84 -0
  171. package/lib/novel-to-game/skills/game-build/agents/openai.yaml +4 -0
  172. package/lib/novel-to-game/skills/game-build/references/build-brief-contract.md +109 -0
  173. package/lib/novel-to-game/skills/game-build/references/generative-media-pipeline.md +56 -0
  174. package/lib/novel-to-game/skills/game-build/references/playable-model-contract.md +81 -0
  175. package/lib/novel-to-game/skills/game-build/references/tts-production-contract.md +37 -0
  176. package/lib/novel-to-game/skills/game-concept/SKILL.md +72 -0
  177. package/lib/novel-to-game/skills/game-concept/agents/openai.yaml +4 -0
  178. package/lib/novel-to-game/skills/game-concept/references/concept-method.md +94 -0
  179. package/lib/novel-to-game/skills/game-qa/SKILL.md +50 -0
  180. package/lib/novel-to-game/skills/game-qa/agents/openai.yaml +4 -0
  181. package/lib/novel-to-game/skills/game-qa/references/qa-contract.md +66 -0
  182. package/lib/novel-to-game/skills/game-qa/references/test-design-method.md +45 -0
  183. package/lib/novel-to-game/skills/game-world-design/SKILL.md +63 -0
  184. package/lib/novel-to-game/skills/game-world-design/agents/openai.yaml +4 -0
  185. package/lib/novel-to-game/skills/game-world-design/references/dialogue-design-method.md +59 -0
  186. package/lib/novel-to-game/skills/game-world-design/references/game-writing-craft.md +53 -0
  187. package/lib/novel-to-game/skills/game-world-design/references/narrative-design-method.md +84 -0
  188. package/lib/novel-to-game/skills/game-world-design/references/numeric-design-method.md +56 -0
  189. package/lib/novel-to-game/skills/game-world-design/references/world-design-method.md +124 -0
  190. package/lib/novel-to-game/skills/novel-game-analyze/SKILL.md +77 -0
  191. package/lib/novel-to-game/skills/novel-game-analyze/agents/openai.yaml +4 -0
  192. package/lib/novel-to-game/skills/novel-game-analyze/references/gameability-protocol.md +65 -0
  193. package/lib/novel-to-game/skills/novel-to-game/SKILL.md +71 -0
  194. package/lib/novel-to-game/skills/novel-to-game/agents/openai.yaml +4 -0
  195. package/lib/novel-to-game/skills/novel-to-game/references/intake-benchmark-reference.md +42 -0
  196. package/lib/novel-to-game/skills/novel-to-game/references/intake-method.md +51 -0
  197. package/lib/novel-to-game/skills/novel-to-game/references/pipeline-contract.md +65 -0
  198. package/lib/oh-story/manifest.json +419 -309
  199. package/lib/oh-story/roles/character-designer.md +4 -4
  200. package/lib/oh-story/roles/consistency-checker.md +1 -1
  201. package/lib/oh-story/roles/narrative-writer.md +41 -42
  202. package/lib/oh-story/roles/story-architect.md +19 -23
  203. package/lib/oh-story/roles/story-explorer.md +8 -5
  204. package/lib/oh-story/skills/browser-cdp/SKILL.md +1 -1
  205. package/lib/oh-story/skills/story/SKILL.md +16 -9
  206. package/lib/oh-story/skills/story/VERSION +1 -1
  207. package/lib/oh-story/skills/story/references/author-memory.md +163 -0
  208. package/lib/oh-story/skills/story/scripts/author_memory_commit.py +871 -0
  209. package/lib/oh-story/skills/story-cover/SKILL.md +1 -1
  210. package/lib/oh-story/skills/story-deslop/SKILL.md +10 -5
  211. package/lib/oh-story/skills/story-deslop/references/anti-ai-writing.md +2 -1
  212. package/lib/oh-story/skills/story-deslop/references/author-memory.md +163 -0
  213. package/lib/oh-story/skills/story-deslop/references/banned-words.md +6 -4
  214. package/lib/oh-story/skills/story-deslop/scripts/author_memory_commit.py +871 -0
  215. package/lib/oh-story/skills/story-deslop/scripts/check-ai-patterns.js +64 -1
  216. package/lib/oh-story/skills/story-import/SKILL.md +21 -8
  217. package/lib/oh-story/skills/story-import/references/format-and-structure.md +9 -10
  218. package/lib/oh-story/skills/story-import/references/structure-mapping-long.md +2 -2
  219. package/lib/oh-story/skills/story-import/references/structure-mapping-short.md +1 -1
  220. package/lib/oh-story/skills/story-import/references/tracking-transaction.md +14 -6
  221. package/lib/oh-story/skills/story-import/scripts/check-outline-contract.js +251 -0
  222. package/lib/oh-story/skills/story-import/scripts/tracking_commit.py +98 -9
  223. package/lib/oh-story/skills/story-import/scripts/wordcount_core.py +246 -0
  224. package/lib/oh-story/skills/story-long-analyze/SKILL.md +4 -4
  225. package/lib/oh-story/skills/story-long-scan/SKILL.md +1 -1
  226. package/lib/oh-story/skills/story-long-write/SKILL.md +35 -21
  227. package/lib/oh-story/skills/story-long-write/references/anti-ai-writing.md +2 -1
  228. package/lib/oh-story/skills/story-long-write/references/artifact-protocols.md +7 -3
  229. package/lib/oh-story/skills/story-long-write/references/author-memory.md +163 -0
  230. package/lib/oh-story/skills/story-long-write/references/banned-words.md +6 -4
  231. package/lib/oh-story/skills/story-long-write/references/cross-book-recall.md +6 -6
  232. package/lib/oh-story/skills/story-long-write/references/genre-prose-cards.md +1 -1
  233. package/lib/oh-story/skills/story-long-write/references/genre-readers.md +1 -1
  234. package/lib/oh-story/skills/{story-setup/references/agent-references/hooks-chapter.md → story-long-write/references/long-chapter-hooks.md} +5 -5
  235. package/lib/oh-story/skills/story-long-write/references/{quality-checklist.md → long-chapter-quality.md} +2 -1
  236. package/lib/oh-story/skills/story-long-write/references/long-format.md +42 -0
  237. package/lib/oh-story/skills/{story-setup/references/agent-references/genre-catalog.md → story-long-write/references/long-genre-catalog.md} +11 -97
  238. package/lib/oh-story/skills/story-long-write/references/{genre-core-mechanics.md → long-genre-mechanics.md} +1 -1
  239. package/lib/oh-story/skills/story-long-write/references/{reversal-toolkit.md → long-reversal.md} +18 -32
  240. package/lib/oh-story/skills/story-long-write/references/{hooks-suspense.md → long-suspense.md} +6 -6
  241. package/lib/oh-story/skills/story-long-write/references/opening-design.md +1 -1
  242. package/lib/oh-story/skills/story-long-write/references/outline-structure-theory.md +1 -1
  243. package/lib/oh-story/skills/story-long-write/references/style-genre-modules.md +1 -1
  244. package/lib/oh-story/skills/story-long-write/references/tracking-transaction.md +14 -6
  245. package/lib/oh-story/skills/story-long-write/references/workflow-chapter.md +32 -27
  246. package/lib/oh-story/skills/story-long-write/references/workflow-daily.md +5 -4
  247. package/lib/oh-story/skills/story-long-write/references/workflow-revision.md +2 -2
  248. package/lib/oh-story/skills/story-long-write/references/workflow-setup.md +17 -11
  249. package/lib/oh-story/skills/story-long-write/references/writing-craft.md +54 -54
  250. package/lib/oh-story/skills/story-long-write/scripts/author_memory_commit.py +871 -0
  251. package/lib/oh-story/skills/story-long-write/scripts/check-ai-patterns.js +64 -1
  252. package/lib/oh-story/skills/story-long-write/scripts/check-outline-contract.js +251 -0
  253. package/lib/oh-story/skills/story-long-write/scripts/storyctl.py +303 -0
  254. package/lib/oh-story/skills/story-long-write/scripts/tracking_commit.py +98 -9
  255. package/lib/oh-story/skills/story-long-write/scripts/wordcount_core.py +246 -0
  256. package/lib/oh-story/skills/story-review/SKILL.md +26 -17
  257. package/lib/oh-story/skills/story-review/references/anti-ai-writing.md +2 -1
  258. package/lib/oh-story/skills/story-review/references/author-memory.md +163 -0
  259. package/lib/oh-story/skills/story-review/references/banned-words.md +6 -4
  260. package/lib/oh-story/skills/story-review/references/{quality-checklist.md → review-quality.md} +22 -21
  261. package/lib/oh-story/skills/story-review/references/tracking-transaction.md +14 -6
  262. package/lib/oh-story/skills/story-review/scripts/author_memory_commit.py +871 -0
  263. package/lib/oh-story/skills/story-review/scripts/check-ai-patterns.js +64 -1
  264. package/lib/oh-story/skills/story-review/scripts/tracking_commit.py +98 -9
  265. package/lib/oh-story/skills/story-review/scripts/wordcount_core.py +246 -0
  266. package/lib/oh-story/skills/story-setup/SKILL.md +85 -41
  267. package/lib/oh-story/skills/story-setup/references/agent-references/agent-quality.md +72 -0
  268. package/lib/oh-story/skills/story-setup/references/agent-references/agent-reference-profiles.md +55 -0
  269. package/lib/oh-story/skills/story-setup/references/agent-references/anti-ai-writing.md +2 -1
  270. package/lib/oh-story/skills/story-setup/references/agent-references/banned-words.md +6 -4
  271. package/lib/oh-story/skills/story-setup/references/agent-references/format-and-structure.md +9 -10
  272. package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards.md +1 -1
  273. package/lib/oh-story/skills/story-setup/references/agent-references/genre-readers.md +1 -1
  274. package/lib/oh-story/skills/{story-short-analyze/references/hooks-chapter.md → story-setup/references/agent-references/long-chapter-hooks.md} +5 -5
  275. package/lib/oh-story/skills/story-setup/references/agent-references/long-emotional-methods.md +209 -0
  276. package/lib/oh-story/skills/{story-long-write/references/genre-catalog.md → story-setup/references/agent-references/long-genre-catalog.md} +11 -97
  277. package/lib/oh-story/skills/story-setup/references/agent-references/{genre-core-mechanics.md → long-genre-mechanics.md} +1 -1
  278. package/lib/oh-story/skills/story-setup/references/agent-references/long-quality.md +40 -0
  279. package/lib/oh-story/skills/{story-short-write/references/reversal-toolkit.md → story-setup/references/agent-references/long-reversal.md} +18 -32
  280. package/lib/oh-story/skills/{story-short-write/references/hooks-suspense.md → story-setup/references/agent-references/long-suspense.md} +6 -6
  281. package/lib/oh-story/skills/story-setup/references/agent-references/opening-design.md +1 -1
  282. package/lib/oh-story/skills/story-setup/references/agent-references/{emotional-methods.md → short-emotional-methods.md} +4 -4
  283. package/lib/oh-story/skills/{story-long-write/references/genre-writing-formulas.md → story-setup/references/agent-references/short-genre-formulas.md} +32 -44
  284. package/lib/oh-story/skills/story-setup/references/agent-references/short-quality.md +39 -0
  285. package/lib/oh-story/skills/story-setup/references/agent-references/{reversal-toolkit.md → short-reversal.md} +29 -23
  286. package/lib/oh-story/skills/story-setup/references/agent-references/{hooks-suspense.md → short-suspense.md} +31 -31
  287. package/lib/oh-story/skills/story-setup/references/agent-references/style-genre-modules.md +1 -1
  288. package/lib/oh-story/skills/story-setup/references/agent-references/writing-craft.md +55 -55
  289. package/lib/oh-story/skills/story-short-analyze/SKILL.md +28 -28
  290. package/lib/oh-story/skills/story-short-analyze/references/{character-basics.md → analysis-character-basics.md} +1 -1
  291. package/lib/oh-story/skills/story-short-analyze/references/{character-design-methods.md → analysis-character-design.md} +1 -1
  292. package/lib/oh-story/skills/story-short-analyze/references/{character-relations.md → analysis-character-relations.md} +1 -1
  293. package/lib/oh-story/skills/story-short-analyze/references/{hooks-paragraph.md → analysis-paragraph-hooks.md} +1 -1
  294. package/lib/oh-story/skills/story-short-analyze/references/{genre-readers.md → analysis-reader-profile.md} +2 -2
  295. package/lib/oh-story/skills/story-short-analyze/references/analysis-report-style.md +45 -0
  296. package/lib/oh-story/skills/story-short-analyze/references/analysis-short-genres.md +65 -0
  297. package/lib/oh-story/skills/story-short-analyze/references/analysis-short-hooks.md +77 -0
  298. package/lib/oh-story/skills/story-short-analyze/references/analysis-short-mechanics.md +82 -0
  299. package/lib/oh-story/skills/story-short-analyze/references/analysis-short-patterns.md +50 -0
  300. package/lib/oh-story/skills/story-short-analyze/references/analysis-short-suspense.md +98 -0
  301. package/lib/oh-story/skills/story-short-analyze/references/{genre-writing-techniques.md → analysis-writing-techniques.md} +21 -19
  302. package/lib/oh-story/skills/story-short-analyze/references/deconstruction-examples.md +1 -1
  303. package/lib/oh-story/skills/story-short-analyze/references/material-decomposition.md +21 -28
  304. package/lib/oh-story/skills/story-short-analyze/references/output-contract.md +1 -1
  305. package/lib/oh-story/skills/story-short-analyze/references/output-templates.md +17 -17
  306. package/lib/oh-story/skills/story-short-analyze/references/{quality-checklist.md → source-story-quality.md} +28 -49
  307. package/lib/oh-story/skills/story-short-analyze/references/zhihu-style.md +2 -2
  308. package/lib/oh-story/skills/story-short-scan/SKILL.md +1 -1
  309. package/lib/oh-story/skills/story-short-write/SKILL.md +78 -55
  310. package/lib/oh-story/skills/story-short-write/references/author-memory.md +163 -0
  311. package/lib/oh-story/skills/story-short-write/references/banned-words.md +6 -4
  312. package/lib/oh-story/skills/story-short-write/references/cross-book-recall.md +3 -3
  313. package/lib/oh-story/skills/story-short-write/references/emotional-methods.md +4 -4
  314. 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
  315. package/lib/oh-story/skills/story-short-write/references/genre-styles//345/217/214/347/224/267/344/270/273.md +2 -2
  316. 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
  317. 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
  318. 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
  319. package/lib/oh-story/skills/story-short-write/references/genre-styles//346/202/254/347/226/221.md +4 -4
  320. 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
  321. 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
  322. package/lib/oh-story/skills/story-short-write/references/genre-styles//347/224/234/345/256/240.md +4 -4
  323. 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
  324. package/lib/oh-story/skills/story-short-write/references/genre-writing-formulas.md +32 -44
  325. package/lib/oh-story/skills/story-short-write/references/genre-writing-techniques.md +20 -18
  326. package/lib/oh-story/skills/story-short-write/references/output-contract.md +1 -1
  327. package/lib/oh-story/skills/story-short-write/references/short-craft.md +18 -18
  328. package/lib/oh-story/skills/story-short-write/references/short-deslop.md +1 -1
  329. package/lib/oh-story/skills/story-short-write/references/short-format.md +38 -8
  330. package/lib/oh-story/skills/story-short-write/references/{quality-checklist.md → short-prose-quality.md} +22 -21
  331. package/lib/oh-story/skills/story-short-write/references/short-reversal.md +355 -0
  332. package/lib/oh-story/skills/{story-short-analyze/references/hooks-suspense.md → story-short-write/references/short-suspense.md} +31 -31
  333. package/lib/oh-story/skills/story-short-write/references/submission-craft.md +2 -2
  334. package/lib/oh-story/skills/story-short-write/references/writing-workflow.md +31 -22
  335. package/lib/oh-story/skills/story-short-write/scripts/author_memory_commit.py +871 -0
  336. package/lib/oh-story/skills/story-short-write/scripts/check-ai-patterns.js +64 -1
  337. package/lib/oh-story/skills/story-short-write/scripts/check-delivery-contract.js +212 -0
  338. package/lib/oh-story/skills/story-short-write/scripts/check-phase2-contract.js +363 -0
  339. package/lib/types/client/drama-production-view.d.ts +34 -0
  340. package/lib/types/client/drama-production-view.d.ts.map +1 -0
  341. package/lib/types/client/drama-production.d.ts +92 -0
  342. package/lib/types/client/drama-production.d.ts.map +1 -0
  343. package/lib/types/client/file-activity.d.ts +9 -2
  344. package/lib/types/client/file-activity.d.ts.map +1 -1
  345. package/lib/types/client/index.d.ts +1 -1
  346. package/lib/types/client/index.d.ts.map +1 -1
  347. package/lib/types/client/production-intents.d.ts +9 -0
  348. package/lib/types/client/production-intents.d.ts.map +1 -0
  349. package/lib/types/client/production-prompts.d.ts +9 -0
  350. package/lib/types/client/production-prompts.d.ts.map +1 -0
  351. package/lib/types/client/production-runtime.d.ts +58 -0
  352. package/lib/types/client/production-runtime.d.ts.map +1 -0
  353. package/lib/types/client/video-studio.d.ts +41 -0
  354. package/lib/types/client/video-studio.d.ts.map +1 -0
  355. package/lib/types/client/workbench-ui.d.ts +5 -0
  356. package/lib/types/client/workbench-ui.d.ts.map +1 -0
  357. package/lib/types/game-verification.d.ts +16 -0
  358. package/lib/types/game-verification.d.ts.map +1 -0
  359. package/lib/types/index.d.ts +5 -2
  360. package/lib/types/index.d.ts.map +1 -1
  361. package/lib/types/production-intent.d.ts +21 -0
  362. package/lib/types/production-intent.d.ts.map +1 -0
  363. package/lib/types/production-tool.d.ts +5 -0
  364. package/lib/types/production-tool.d.ts.map +1 -0
  365. package/lib/types/reference-tool.d.ts +6 -0
  366. package/lib/types/reference-tool.d.ts.map +1 -0
  367. package/lib/types/role-provider.d.ts.map +1 -1
  368. package/lib/types/role-tool.d.ts +3 -1
  369. package/lib/types/role-tool.d.ts.map +1 -1
  370. package/lib/types/skill-provider.d.ts +7 -0
  371. package/lib/types/skill-provider.d.ts.map +1 -1
  372. package/lib/types/video-project.d.ts +42 -0
  373. package/lib/types/video-project.d.ts.map +1 -0
  374. package/lib/types/workspace-request-trust.d.ts +6 -0
  375. package/lib/types/workspace-request-trust.d.ts.map +1 -1
  376. package/lib/types/workspace-route.d.ts +20 -0
  377. package/lib/types/workspace-route.d.ts.map +1 -1
  378. package/lib/video-recap/CHANGELOG.md +282 -0
  379. package/lib/video-recap/LICENSE +21 -0
  380. package/lib/video-recap/README.en.md +257 -0
  381. package/lib/video-recap/README.md +255 -0
  382. package/lib/video-recap/manifest.json +684 -0
  383. package/lib/video-recap/skills/video-assemble/SKILL.md +97 -0
  384. package/lib/video-recap/skills/video-assemble/references/jianying/LICENSE.duo-video +21 -0
  385. package/lib/video-recap/skills/video-assemble/references/jianying/SOURCE.md +15 -0
  386. package/lib/video-recap/skills/video-assemble/references/jianying/empty_draft_meta_info.json +69 -0
  387. package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_combination_segment.json +84 -0
  388. package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_combination_video_material.json +98 -0
  389. package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_draft.json +204 -0
  390. package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_material_video.json +83 -0
  391. package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_meta_material_value.json +23 -0
  392. package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_project_info.json +133 -0
  393. package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_segment.json +70 -0
  394. package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_text_styles.json +30 -0
  395. package/lib/video-recap/skills/video-assemble/references/jianying/empty_yj_material_audio.json +41 -0
  396. package/lib/video-recap/skills/video-assemble/references/jianying/empty_yj_material_text.json +109 -0
  397. package/lib/video-recap/skills/video-assemble/scripts/artifacts.py +88 -0
  398. package/lib/video-recap/skills/video-assemble/scripts/assemble.py +345 -0
  399. package/lib/video-recap/skills/video-assemble/scripts/assemble_constants.py +34 -0
  400. package/lib/video-recap/skills/video-assemble/scripts/assembly_contract.py +305 -0
  401. package/lib/video-recap/skills/video-assemble/scripts/assembly_settings.py +94 -0
  402. package/lib/video-recap/skills/video-assemble/scripts/audio_automation.py +205 -0
  403. package/lib/video-recap/skills/video-assemble/scripts/audio_mix.py +555 -0
  404. package/lib/video-recap/skills/video-assemble/scripts/export_jianying.py +261 -0
  405. package/lib/video-recap/skills/video-assemble/scripts/jianying_builders.py +767 -0
  406. package/lib/video-recap/skills/video-assemble/scripts/jianying_model.py +111 -0
  407. package/lib/video-recap/skills/video-assemble/scripts/jianying_optional.py +24 -0
  408. package/lib/video-recap/skills/video-assemble/scripts/jianying_schema.py +109 -0
  409. package/lib/video-recap/skills/video-assemble/scripts/jianying_templates.py +37 -0
  410. package/lib/video-recap/skills/video-assemble/scripts/jianying_timeline_contract.py +191 -0
  411. package/lib/video-recap/skills/video-assemble/scripts/jianying_tracks.py +75 -0
  412. package/lib/video-recap/skills/video-assemble/scripts/jianying_writer.py +394 -0
  413. package/lib/video-recap/skills/video-assemble/scripts/lib.py +239 -0
  414. package/lib/video-recap/skills/video-assemble/scripts/media.py +243 -0
  415. package/lib/video-recap/skills/video-assemble/scripts/narration_audio.py +477 -0
  416. package/lib/video-recap/skills/video-assemble/scripts/render_preflight.py +46 -0
  417. package/lib/video-recap/skills/video-assemble/scripts/source_subtitles.py +486 -0
  418. package/lib/video-recap/skills/video-assemble/scripts/subtitle_core.py +376 -0
  419. package/lib/video-recap/skills/video-assemble/scripts/subtitle_render.py +88 -0
  420. package/lib/video-recap/skills/video-assemble/scripts/timeline.py +248 -0
  421. package/lib/video-recap/skills/video-assemble/scripts/timeline_emit.py +89 -0
  422. package/lib/video-recap/skills/video-assemble/scripts/visual_render.py +512 -0
  423. package/lib/video-recap/skills/video-cut/SKILL.md +90 -0
  424. package/lib/video-recap/skills/video-cut/scripts/cut.py +67 -0
  425. package/lib/video-recap/skills/video-cut/scripts/cut_cli.py +320 -0
  426. package/lib/video-recap/skills/video-cut/scripts/cut_contract.py +545 -0
  427. package/lib/video-recap/skills/video-cut/scripts/cut_render.py +348 -0
  428. package/lib/video-recap/skills/video-cut/scripts/lib.py +77 -0
  429. package/lib/video-recap/skills/video-cut/scripts/media_geometry.py +341 -0
  430. package/lib/video-recap/skills/video-cut/scripts/narration_mapping.py +249 -0
  431. package/lib/video-recap/skills/video-cut/scripts/sentence_boundaries.py +745 -0
  432. package/lib/video-recap/skills/video-recap/SKILL.md +216 -0
  433. package/lib/video-recap/skills/video-recap/references/config-playbook.md +61 -0
  434. package/lib/video-recap/skills/video-recap/references/creative-editing-playbook.md +225 -0
  435. package/lib/video-recap/skills/video-recap/references/data-schema.md +534 -0
  436. package/lib/video-recap/skills/video-recap/references/research-guide.md +74 -0
  437. package/lib/video-recap/skills/video-recap/references/shift-left-qc-schema.md +23 -0
  438. package/lib/video-recap/skills/video-recap/references/timeline-and-jianying.md +251 -0
  439. package/lib/video-recap/skills/video-recap/scripts/doctor.py +483 -0
  440. package/lib/video-recap/skills/video-recap/scripts/final_qc.py +737 -0
  441. package/lib/video-recap/skills/video-recap/scripts/lib.py +242 -0
  442. package/lib/video-recap/skills/video-recap/scripts/materials.py +457 -0
  443. package/lib/video-recap/skills/video-recap/scripts/mimo_qc.py +95 -0
  444. package/lib/video-recap/skills/video-recap/scripts/mimo_qc_client.py +18 -0
  445. package/lib/video-recap/skills/video-recap/scripts/mimo_qc_contract.py +9 -0
  446. package/lib/video-recap/skills/video-recap/scripts/mimo_qc_evidence.py +371 -0
  447. package/lib/video-recap/skills/video-recap/scripts/mimo_qc_observations.py +201 -0
  448. package/lib/video-recap/skills/video-recap/scripts/mimo_qc_payload.py +227 -0
  449. package/lib/video-recap/skills/video-recap/scripts/mimo_qc_report.py +362 -0
  450. package/lib/video-recap/skills/video-recap/scripts/mimo_qc_runner.py +129 -0
  451. package/lib/video-recap/skills/video-recap/scripts/qc_contract.py +338 -0
  452. package/lib/video-recap/skills/video-recap/scripts/recap.py +9 -0
  453. package/lib/video-recap/skills/video-recap/scripts/recap_cli.py +140 -0
  454. package/lib/video-recap/skills/video-recap/scripts/recap_inspect.py +550 -0
  455. package/lib/video-recap/skills/video-recap/scripts/recap_review.py +77 -0
  456. package/lib/video-recap/skills/video-recap/scripts/recap_runner.py +654 -0
  457. package/lib/video-recap/skills/video-recap/scripts/recap_runtime.py +335 -0
  458. package/lib/video-recap/skills/video-recap/scripts/recap_stage_qc.py +217 -0
  459. package/lib/video-recap/skills/video-recap/scripts/recap_timeline.py +795 -0
  460. package/lib/video-recap/skills/video-script/SKILL.md +248 -0
  461. package/lib/video-recap/skills/video-script/references/creative-editing-playbook.md +225 -0
  462. package/lib/video-recap/skills/video-script/references/research-guide.md +75 -0
  463. package/lib/video-recap/skills/video-script/scripts/agent_brief.py +399 -0
  464. package/lib/video-recap/skills/video-script/scripts/agent_text.py +410 -0
  465. package/lib/video-recap/skills/video-script/scripts/brief_context.py +403 -0
  466. package/lib/video-recap/skills/video-script/scripts/brief_inputs.py +332 -0
  467. package/lib/video-recap/skills/video-script/scripts/brief_timeline.py +442 -0
  468. package/lib/video-recap/skills/video-script/scripts/deslop_qc.py +237 -0
  469. package/lib/video-recap/skills/video-script/scripts/evidence_bundle.py +492 -0
  470. package/lib/video-recap/skills/video-script/scripts/lib.py +327 -0
  471. package/lib/video-recap/skills/video-script/scripts/narration.py +12 -0
  472. package/lib/video-recap/skills/video-script/scripts/narration_lint.py +678 -0
  473. package/lib/video-recap/skills/video-script/scripts/review.py +42 -0
  474. package/lib/video-recap/skills/video-script/scripts/review_grounding.py +262 -0
  475. package/lib/video-recap/skills/video-script/scripts/review_response.py +761 -0
  476. package/lib/video-recap/skills/video-script/scripts/review_runner.py +200 -0
  477. package/lib/video-recap/skills/video-script/scripts/speech_ownership.py +204 -0
  478. package/lib/video-recap/skills/video-script/scripts/timeline_fusion.py +199 -0
  479. package/lib/video-recap/skills/video-script/scripts/validate.py +164 -0
  480. package/lib/video-recap/skills/video-understanding/SKILL.md +75 -0
  481. package/lib/video-recap/skills/video-understanding/references/data-schema.md +299 -0
  482. package/lib/video-recap/skills/video-understanding/references/prompt-templates.md +37 -0
  483. package/lib/video-recap/skills/video-understanding/references/research-guide.md +74 -0
  484. package/lib/video-recap/skills/video-understanding/scripts/agent_brief.py +399 -0
  485. package/lib/video-recap/skills/video-understanding/scripts/agent_text.py +410 -0
  486. package/lib/video-recap/skills/video-understanding/scripts/asr.py +260 -0
  487. package/lib/video-recap/skills/video-understanding/scripts/brief.py +12 -0
  488. package/lib/video-recap/skills/video-understanding/scripts/brief_context.py +403 -0
  489. package/lib/video-recap/skills/video-understanding/scripts/brief_inputs.py +332 -0
  490. package/lib/video-recap/skills/video-understanding/scripts/brief_timeline.py +442 -0
  491. package/lib/video-recap/skills/video-understanding/scripts/consolidate.py +647 -0
  492. package/lib/video-recap/skills/video-understanding/scripts/deslop_qc.py +237 -0
  493. package/lib/video-recap/skills/video-understanding/scripts/detect.py +513 -0
  494. package/lib/video-recap/skills/video-understanding/scripts/extract.py +62 -0
  495. package/lib/video-recap/skills/video-understanding/scripts/lib.py +470 -0
  496. package/lib/video-recap/skills/video-understanding/scripts/narration_lint.py +678 -0
  497. package/lib/video-recap/skills/video-understanding/scripts/speech_ownership.py +204 -0
  498. package/lib/video-recap/skills/video-understanding/scripts/storyboard.py +507 -0
  499. package/lib/video-recap/skills/video-understanding/scripts/timeline_fusion.py +199 -0
  500. package/lib/video-recap/skills/video-understanding/scripts/understand.py +9 -0
  501. package/lib/video-recap/skills/video-understanding/scripts/understanding_brief.py +216 -0
  502. package/lib/video-recap/skills/video-understanding/scripts/understanding_cache.py +327 -0
  503. package/lib/video-recap/skills/video-understanding/scripts/understanding_runner.py +367 -0
  504. package/lib/video-recap/skills/video-understanding/scripts/understanding_storyboard.py +162 -0
  505. package/lib/video-recap/skills/video-understanding/scripts/vlm.py +705 -0
  506. package/lib/video-recap/skills/video-voiceover/SKILL.md +81 -0
  507. package/lib/video-recap/skills/video-voiceover/scripts/dub.py +637 -0
  508. package/lib/video-recap/skills/video-voiceover/scripts/fish_audio.py +109 -0
  509. package/lib/video-recap/skills/video-voiceover/scripts/lib.py +421 -0
  510. package/lib/video-recap/skills/video-voiceover/scripts/tts_audio.py +113 -0
  511. package/lib/video-recap/skills/video-voiceover/scripts/voiceover.py +782 -0
  512. package/package.json +57 -41
  513. package/lib/drama/skills/short-drama/references/lifecycle-commands.md +0 -130
  514. package/lib/oh-story/skills/story-deslop/scripts/check-outline-copy.js +0 -241
  515. package/lib/oh-story/skills/story-long-write/references/format-and-structure.md +0 -169
  516. package/lib/oh-story/skills/story-setup/references/agent-references/genre-writing-formulas.md +0 -444
  517. package/lib/oh-story/skills/story-setup/references/agent-references/quality-checklist.md +0 -247
  518. package/lib/oh-story/skills/story-short-analyze/references/anti-ai-writing.md +0 -582
  519. package/lib/oh-story/skills/story-short-analyze/references/banned-words.md +0 -147
  520. package/lib/oh-story/skills/story-short-analyze/references/genre-catalog.md +0 -490
  521. package/lib/oh-story/skills/story-short-analyze/references/genre-core-mechanics.md +0 -425
  522. package/lib/oh-story/skills/story-short-analyze/references/genre-writing-formulas.md +0 -453
  523. /package/lib/oh-story/skills/{story-long-write/references/hooks-chapter.md → story-setup/references/agent-references/short-chapter-hooks.md} +0 -0
  524. /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,767 @@
1
+ """Production material and segment builders for the JianYing exporter."""
2
+
3
+ import json
4
+ import os
5
+ from copy import deepcopy
6
+
7
+ from jianying_schema import scrub_platform_identity, us, validate_material_category
8
+ from jianying_templates import template
9
+ from jianying_tracks import SEGMENT_RENDER_INDEX
10
+
11
+
12
+ def timerange(start_us, dur_us):
13
+ return {"start": int(start_us), "duration": int(dur_us)}
14
+
15
+
16
+ def speed_material(new_id, speed=1.0):
17
+ return {
18
+ "id": new_id(),
19
+ "speed": float(speed),
20
+ "type": "speed",
21
+ "mode": 0,
22
+ "curve_speed": None,
23
+ }
24
+
25
+
26
+ def volume_keyframes(keyframes, seg_start_s, new_id):
27
+ """Build one KFTypeVolume keyframe list from timeline-absolute points."""
28
+ if not keyframes:
29
+ return []
30
+ kfs = []
31
+ for kf in keyframes:
32
+ kfs.append({
33
+ "curveType": "Line",
34
+ "graphID": "",
35
+ "left_control": {"x": 0.0, "y": 0.0},
36
+ "right_control": {"x": 0.0, "y": 0.0},
37
+ "id": new_id(),
38
+ "time_offset": max(0, us(kf["t"] - seg_start_s)),
39
+ "values": [round(float(kf["gain"]), 4)],
40
+ })
41
+ return [{
42
+ "id": new_id(),
43
+ "keyframe_list": kfs,
44
+ "material_id": "",
45
+ "property_type": "KFTypeVolume",
46
+ }]
47
+
48
+
49
+ def windowed_volume_keyframes(keyframes, seg_start_s, seg_end_s, default_gain, new_id):
50
+ """Window timeline-absolute keyframes for one split/looped segment."""
51
+ if not keyframes:
52
+ return []
53
+ start = float(seg_start_s)
54
+ end = float(seg_end_s)
55
+ default_gain = float(default_gain)
56
+ ordered = sorted((
57
+ {"t": float(kf["t"]), "gain": float(kf["gain"])}
58
+ for kf in keyframes
59
+ if "t" in kf and "gain" in kf
60
+ ), key=lambda kf: kf["t"])
61
+ if not ordered or end <= start:
62
+ return []
63
+
64
+ start_gain = default_gain
65
+ for kf in ordered:
66
+ if kf["t"] <= start:
67
+ start_gain = kf["gain"]
68
+ else:
69
+ break
70
+ inner = [kf for kf in ordered if start <= kf["t"] <= end]
71
+ if not inner and abs(start_gain - default_gain) < 1e-4:
72
+ return []
73
+
74
+ selected = [{"t": start, "gain": start_gain}]
75
+ for kf in inner:
76
+ if abs(kf["t"] - start) < 1e-4:
77
+ selected[-1] = {"t": start, "gain": kf["gain"]}
78
+ else:
79
+ selected.append(kf)
80
+ if all(abs(kf["gain"] - default_gain) < 1e-4 for kf in selected):
81
+ return []
82
+ return volume_keyframes(selected, start, new_id)
83
+
84
+
85
+ def clip_from_segment(segment=None):
86
+ segment = segment or {}
87
+ scale = segment.get("scale") if isinstance(segment.get("scale"), dict) else {}
88
+ position = segment.get("position") if isinstance(segment.get("position"), dict) else {}
89
+ flip = segment.get("flip") if isinstance(segment.get("flip"), dict) else {}
90
+ return {
91
+ "alpha": round(float(segment.get("opacity", 1.0)), 4),
92
+ "flip": {
93
+ "horizontal": bool(flip.get("horizontal", False)),
94
+ "vertical": bool(flip.get("vertical", False)),
95
+ },
96
+ "rotation": float(segment.get("rotation_degrees", 0.0)),
97
+ "scale": {
98
+ "x": float(scale.get("x", 1.0)),
99
+ "y": float(scale.get("y", 1.0)),
100
+ },
101
+ # Timeline v2 uses JianYing's normalized, canvas-center, Y-up coordinates.
102
+ "transform": {
103
+ "x": float(position.get("x", 0.0)),
104
+ "y": float(position.get("y", 0.0)),
105
+ },
106
+ }
107
+
108
+
109
+ def base_segment(material_id, target_start_us, target_dur_us, volume, keyframes, new_id):
110
+ segment = template("segment")
111
+ segment.update({
112
+ "id": new_id(),
113
+ "material_id": material_id,
114
+ "target_timerange": timerange(target_start_us, target_dur_us),
115
+ "common_keyframes": keyframes,
116
+ "track_render_index": SEGMENT_RENDER_INDEX,
117
+ "render_index": SEGMENT_RENDER_INDEX,
118
+ "volume": round(float(volume), 4),
119
+ })
120
+ return segment
121
+
122
+
123
+ def audio_segment_piece(material_id, target_start_us, target_dur_us, source_start_us,
124
+ source_dur_us, volume, keyframes, new_id):
125
+ seg = base_segment(material_id, target_start_us, target_dur_us, volume, keyframes, new_id)
126
+ seg["source_timerange"] = timerange(source_start_us, source_dur_us)
127
+ seg["extra_material_refs"] = []
128
+ return seg
129
+
130
+
131
+ def _hex_rgb(color):
132
+ value = str(color or "#FFFFFF").lstrip("#")
133
+ if len(value) == 8:
134
+ value = value[:6]
135
+ if len(value) != 6:
136
+ raise ValueError(f"invalid text color: {color!r}")
137
+ try:
138
+ return [round(int(value[index:index + 2], 16) / 255.0, 6) for index in (0, 2, 4)]
139
+ except ValueError as exc:
140
+ raise ValueError(f"invalid text color: {color!r}") from exc
141
+
142
+
143
+ def _text_style(style, start, end):
144
+ fill_color = style.get("fill_color", "#FFFFFF")
145
+ authored = template("text_style")["styles"][0]
146
+ authored.update({
147
+ "fill": {
148
+ "alpha": 1.0,
149
+ "content": {
150
+ "render_type": "solid",
151
+ "solid": {"alpha": 1.0, "color": _hex_rgb(fill_color)},
152
+ },
153
+ },
154
+ "range": [int(start), int(end)],
155
+ "size": float(style.get("font_size", 8.0)),
156
+ "bold": bool(style.get("bold", False)),
157
+ "italic": bool(style.get("italic", False)),
158
+ "underline": bool(style.get("underline", False)),
159
+ "strokes": list(style.get("strokes", [])),
160
+ })
161
+ if style.get("font_path") or style.get("font_id"):
162
+ authored["font"] = {
163
+ "id": str(style.get("font_id", "")),
164
+ "path": str(style.get("font_path", "")),
165
+ }
166
+ if style.get("stroke_color") and float(style.get("stroke_width", 0)) > 0:
167
+ width = float(style["stroke_width"])
168
+ authored["strokes"] = [{
169
+ "alpha": 1.0,
170
+ "content": {
171
+ "render_type": "solid",
172
+ "solid": {"alpha": 1.0, "color": _hex_rgb(style["stroke_color"])},
173
+ },
174
+ "width": round(0.00196 * (width ** 1.013), 6),
175
+ }]
176
+ if style.get("shadow_color"):
177
+ authored["shadows"] = [{
178
+ "alpha": float(style.get("shadow_opacity", 90)) / 100.0,
179
+ "angle": int(style.get("shadow_angle", -45)),
180
+ "distance": int(style.get("shadow_width", 5)),
181
+ "feather": float(style.get("shadow_vague", 45)) / 100.0,
182
+ "content": {
183
+ "render_type": "solid",
184
+ "solid": {"alpha": 1.0, "color": _hex_rgb(style["shadow_color"])},
185
+ },
186
+ }]
187
+ if isinstance(style.get("effect_style"), dict):
188
+ authored["effect_style"] = deepcopy(style["effect_style"])
189
+ authored["use_letter_color"] = True
190
+ return authored
191
+
192
+
193
+ def rich_text_content(text, base_style=None, words=None, style_presets=None):
194
+ """Build duo-video text styles using UTF-16 code-unit ranges."""
195
+ base_style = dict(base_style or {})
196
+ length = len(text.encode("utf-16-le")) // 2
197
+ style_presets = style_presets or {}
198
+ normalized_words = []
199
+ boundaries = {0, length}
200
+ for word in words or []:
201
+ start = max(0, min(length, int(word.get("index", 0))))
202
+ end = max(start, min(length, start + int(word.get("length", 0))))
203
+ if end <= start:
204
+ continue
205
+ word_style = dict(style_presets.get(str(word.get("style_id")), {}))
206
+ word_style.update(word)
207
+ normalized_words.append((start, end, word_style))
208
+ boundaries.update((start, end))
209
+
210
+ styles = []
211
+ points = sorted(boundaries)
212
+ for start, end in zip(points, points[1:]):
213
+ style = dict(base_style)
214
+ for word_start, word_end, word in normalized_words:
215
+ if word_start <= start and end <= word_end:
216
+ style.update({key: value for key, value in word.items() if key not in {"index", "length"}})
217
+ styles.append(_text_style(style, start, end))
218
+ content = template("text_style")
219
+ content["text"] = text
220
+ content["styles"] = styles
221
+ return content
222
+
223
+
224
+ def unsupported_track_note(kind):
225
+ info = validate_material_category(kind)
226
+ if info["supported"]:
227
+ return None
228
+ return info.get("note")
229
+
230
+
231
+ RESOURCE_TRACKS = {
232
+ "sound": ("audios", "audio"),
233
+ "sticker": ("stickers", "sticker"),
234
+ "text_template": ("text_templates", "text"),
235
+ "video_effect": ("video_effects", "effect"),
236
+ "face_effect": ("video_effects", "effect"),
237
+ }
238
+
239
+
240
+ def _resource_value(config, snake_case, camel_case, default=None):
241
+ if snake_case in config:
242
+ return config[snake_case]
243
+ return config.get(camel_case, default)
244
+
245
+
246
+ def _load_resource_config(config, kind):
247
+ if isinstance(config, str):
248
+ with open(config, encoding="utf-8") as source:
249
+ config = json.load(source)
250
+ if not isinstance(config, dict):
251
+ raise ValueError(f"{kind} resource_config must be an object")
252
+ return config
253
+
254
+
255
+ def _resource_material(segment, kind, new_id):
256
+ raw = segment.get("material")
257
+ config = segment.get("resource_config")
258
+ if raw is not None and config is not None:
259
+ raise ValueError(f"{kind} segment must use either material or resource_config, not both")
260
+ if config is not None:
261
+ config = _load_resource_config(config, kind)
262
+ raw = _resource_value(config, "main_config", "mainConfig")
263
+ if isinstance(raw, str):
264
+ raw = json.loads(raw)
265
+ if not isinstance(raw, dict):
266
+ raise ValueError(f"{kind} resource_config.main_config must be an object")
267
+ raw = deepcopy(raw)
268
+ resource_id = _resource_value(config, "resource_id", "resourceId")
269
+ if resource_id is not None:
270
+ raw.setdefault("resource_id", resource_id)
271
+ if config.get("resources"):
272
+ raw["_bundle_resources"] = deepcopy(config["resources"])
273
+ cover_img = _resource_value(config, "cover_img", "coverImg")
274
+ if kind == "sticker" and cover_img:
275
+ raw["icon_url"] = cover_img
276
+ raw["preview_cover_url"] = cover_img
277
+ elif not isinstance(raw, dict):
278
+ raise ValueError(f"{kind} segment requires material or resource_config")
279
+ else:
280
+ raw = deepcopy(raw)
281
+ raw["id"] = new_id()
282
+ return raw
283
+
284
+
285
+ def build_resource_track(ctx, timeline_track):
286
+ kind = timeline_track["kind"]
287
+ materials_key, _track_type = RESOURCE_TRACKS[kind]
288
+ track_name = timeline_track.get("name", kind)
289
+ for item in timeline_track.get("segments", []):
290
+ ts, te = float(item["timeline_start"]), float(item["timeline_end"])
291
+ duration_us = us(te - ts)
292
+ authored_item = item
293
+ package_name = item.get("resource_package")
294
+ if package_name is not None:
295
+ package = ctx.resource_packages.get(str(package_name))
296
+ if not isinstance(package, dict):
297
+ raise ValueError(f"unknown JianYing resource package: {package_name}")
298
+ authored_item = dict(item)
299
+ authored_item["resource_config"] = package
300
+ material = _resource_material(authored_item, kind, ctx.new_id)
301
+ ctx.materials[materials_key].append(material)
302
+ config = authored_item.get("resource_config") or {}
303
+ if config:
304
+ config = _load_resource_config(config, kind)
305
+ if kind == "text_template":
306
+ subordinate_resources = deepcopy(material.get("_bundle_resources", []))
307
+ subordinate_texts = deepcopy(config.get("texts", []))
308
+ subordinate_effects = deepcopy(config.get("effects", []))
309
+ if subordinate_resources:
310
+ for subordinate in subordinate_texts + subordinate_effects:
311
+ if isinstance(subordinate, dict):
312
+ subordinate["_bundle_resources"] = deepcopy(subordinate_resources)
313
+ ctx.materials["texts"].extend(subordinate_texts)
314
+ ctx.materials["effects"].extend(subordinate_effects)
315
+ seg = base_segment(material["id"], us(ts), duration_us, 1.0, [], ctx.new_id)
316
+ speed_value = float(item.get("speed", 1.0))
317
+ if speed_value <= 0:
318
+ raise ValueError(f"{kind} segment speed must be greater than 0")
319
+ seg["source_timerange"] = timerange(0, round(duration_us * speed_value))
320
+ seg["track_render_index"] = 0
321
+ seg["extra_material_refs"] = []
322
+ seg["speed"] = speed_value
323
+ if abs(speed_value - 1.0) > 1e-9:
324
+ speed = speed_material(ctx.new_id, speed_value)
325
+ ctx.materials["speeds"].append(speed)
326
+ seg["extra_material_refs"].append(speed["id"])
327
+ seg["clip"] = clip_from_segment(item)
328
+ ctx.add_segment(kind, track_name, us(ts), duration_us, seg)
329
+
330
+
331
+ def _attachment_material(spec, kind, new_id):
332
+ if not isinstance(spec, dict):
333
+ raise ValueError(f"video {kind} must be an object")
334
+ material = deepcopy(spec)
335
+ config = material.pop("main_config", material.pop("mainConfig", None))
336
+ resources = material.pop("resources", None)
337
+ resource_id = material.pop("resourceId", None)
338
+ if config is not None:
339
+ if isinstance(config, str):
340
+ config = json.loads(config)
341
+ if not isinstance(config, dict):
342
+ raise ValueError(f"video {kind}.main_config must be an object")
343
+ merged = deepcopy(config)
344
+ merged.update(material)
345
+ material = merged
346
+ if resource_id is not None:
347
+ material.setdefault("resource_id", resource_id)
348
+ if resources:
349
+ material["_bundle_resources"] = deepcopy(resources)
350
+ material["id"] = new_id()
351
+ return material
352
+
353
+
354
+ def _resolve_attachment_spec(ctx, spec, kind):
355
+ if isinstance(spec, str):
356
+ package = ctx.resource_packages.get(spec)
357
+ if not isinstance(package, dict):
358
+ raise ValueError(f"unknown JianYing {kind} resource package: {spec}")
359
+ return package
360
+ return spec
361
+
362
+
363
+ def apply_video_attachments(ctx, clip, segment):
364
+ """Attach duo-video transition, mask, and LUT authoring data."""
365
+ semantic_kind = "video"
366
+ transition_spec = clip.get("transition")
367
+ if transition_spec is not None:
368
+ transition_spec = _resolve_attachment_spec(ctx, transition_spec, "transition")
369
+ transition = _attachment_material(transition_spec, "transition", ctx.new_id)
370
+ ctx.materials["transitions"].append(transition)
371
+ segment["extra_material_refs"].append(transition["id"])
372
+
373
+ mask_spec = clip.get("mask")
374
+ if mask_spec is not None:
375
+ mask_spec = _resolve_attachment_spec(ctx, mask_spec, "mask")
376
+ mask = _attachment_material(mask_spec, "mask", ctx.new_id)
377
+ ctx.materials["masks"].append(mask)
378
+ ctx.materials["common_mask"].append(deepcopy(mask))
379
+ segment["extra_material_refs"].append(mask["id"])
380
+ semantic_kind = "mask"
381
+
382
+ lut_spec = clip.get("lut")
383
+ if lut_spec is not None:
384
+ lut_spec = _resolve_attachment_spec(ctx, lut_spec, "lut")
385
+ lut = _attachment_material(lut_spec, "lut", ctx.new_id)
386
+ lut["value"] = float(lut.pop("strength", 100)) / 100.0
387
+ lut.pop("skin_tone_correction", None)
388
+ ctx.materials["effects"].append(lut)
389
+ segment["extra_material_refs"].append(lut["id"])
390
+ if lut_spec.get("skin_tone_correction") is not None:
391
+ lumi_hub_path = str(lut.get("lumi_hub_path") or "")
392
+ if not lumi_hub_path:
393
+ raise ValueError(
394
+ "LUT skin_tone_correction requires an offline effect "
395
+ "main_config with lumi_hub_path"
396
+ )
397
+ effect_path = lumi_hub_path.rsplit("/", 1)[0]
398
+ skin_tone = deepcopy(lut)
399
+ skin_tone["id"] = ctx.new_id()
400
+ skin_tone["type"] = "skin_tone_correction"
401
+ skin_tone["version"] = "v3"
402
+ skin_tone["value"] = float(lut_spec["skin_tone_correction"]) / 100.0
403
+ skin_tone["path"] = effect_path
404
+ skin_tone["lumi_hub_path"] = effect_path
405
+ ctx.materials["effects"].append(skin_tone)
406
+ segment["extra_material_refs"].append(skin_tone["id"])
407
+ return semantic_kind
408
+
409
+
410
+ def _track_object(ctx, name, track_type, segments, flag):
411
+ return {
412
+ "attribute": 0,
413
+ "flag": flag,
414
+ "id": ctx.new_id(),
415
+ "is_default_name": True,
416
+ "name": name,
417
+ "segments": segments,
418
+ "type": track_type,
419
+ }
420
+
421
+
422
+ def build_compound_video(ctx, clip, material, foreground_segment, track_name, ts, te):
423
+ """Build duo-video's nested green-screen/compound draft structure."""
424
+ background_spec = clip.get("green_background")
425
+ chroma_spec = _resolve_attachment_spec(ctx, clip.get("chroma"), "chroma")
426
+ if not isinstance(background_spec, dict) or not isinstance(chroma_spec, dict):
427
+ raise ValueError("compound green-screen clips require green_background and chroma objects")
428
+
429
+ duration_us = us(te - ts)
430
+ full_material_duration_us = int(material.get("duration") or duration_us)
431
+ outer_source_timerange = deepcopy(foreground_segment["source_timerange"])
432
+ outer_target_timerange = deepcopy(foreground_segment["target_timerange"])
433
+ background_path = background_spec.get("source_path")
434
+ if not isinstance(background_path, str) or not background_path:
435
+ raise ValueError("green_background.source_path must be a non-empty string")
436
+
437
+ background_id = ctx.new_id()
438
+ background = template("video")
439
+ background.update({
440
+ "duration": full_material_duration_us,
441
+ "height": int(background_spec.get("height") or ctx.height),
442
+ "id": background_id,
443
+ "material_name": os.path.basename(background_path),
444
+ "path": background_path,
445
+ "type": background_spec.get("type", "photo"),
446
+ "width": int(background_spec.get("width") or ctx.width),
447
+ })
448
+
449
+ chroma = _attachment_material(chroma_spec, "chroma", ctx.new_id)
450
+ foreground_segment = deepcopy(foreground_segment)
451
+ foreground_segment["source_timerange"] = timerange(0, full_material_duration_us)
452
+ foreground_segment["target_timerange"] = timerange(0, full_material_duration_us)
453
+ foreground_segment["extra_material_refs"].append(chroma["id"])
454
+
455
+ background_segment = base_segment(
456
+ background_id, 0, full_material_duration_us, 1.0, [], ctx.new_id
457
+ )
458
+ background_segment["source_timerange"] = timerange(0, full_material_duration_us)
459
+ background_segment["render_index"] = 1
460
+ background_segment["track_render_index"] = 1
461
+ background_segment["clip"] = clip_from_segment(background_spec)
462
+
463
+ draft = template("draft")
464
+ draft["id"] = ctx.new_id()
465
+ draft["combination_id"] = ctx.new_id()
466
+ nested = draft["draft"]
467
+ nested["id"] = ctx.new_id()
468
+ nested["canvas_config"] = {
469
+ "width": ctx.width,
470
+ "height": ctx.height,
471
+ "ratio": "original",
472
+ }
473
+ nested["duration"] = full_material_duration_us
474
+ nested["fps"] = float(ctx.fps)
475
+ scrub_platform_identity(nested)
476
+ nested["materials"]["videos"] = [material, background]
477
+ nested["materials"]["chromas"] = [chroma]
478
+ referenced = set(foreground_segment["extra_material_refs"])
479
+ nested_speeds = [
480
+ item for item in ctx.materials["speeds"] if item.get("id") in referenced
481
+ ]
482
+ if nested_speeds:
483
+ nested["materials"]["speeds"] = nested_speeds
484
+ ctx.materials["speeds"] = [
485
+ item for item in ctx.materials["speeds"] if item.get("id") not in referenced
486
+ ]
487
+ nested["tracks"] = [
488
+ _track_object(ctx, "green_background", "video", [background_segment], 0),
489
+ _track_object(ctx, "video", "video", [foreground_segment], 2),
490
+ ]
491
+ ctx.materials["drafts"].append(draft)
492
+
493
+ combination_material = template("combination_video")
494
+ combination_material.update({
495
+ "duration": full_material_duration_us,
496
+ "height": ctx.height,
497
+ "id": ctx.new_id(),
498
+ "width": ctx.width,
499
+ })
500
+ ctx.materials["videos"].append(combination_material)
501
+
502
+ combination_segment = template("combination_segment")
503
+ combination_segment.update({
504
+ "id": ctx.new_id(),
505
+ "material_id": combination_material["id"],
506
+ "extra_material_refs": [draft["id"]],
507
+ "source_timerange": outer_source_timerange,
508
+ "target_timerange": outer_target_timerange,
509
+ })
510
+ semantic_kind = apply_video_attachments(ctx, clip, combination_segment)
511
+ authored_track_name = "mask" if semantic_kind == "mask" else track_name
512
+ ctx.add_segment(
513
+ semantic_kind, authored_track_name, us(ts), duration_us, combination_segment
514
+ )
515
+
516
+
517
+ def build_video_track(ctx, timeline_track):
518
+ track_name = timeline_track.get("name", "video")
519
+ for clip in timeline_track.get("clips", []):
520
+ ts, te = float(clip["timeline_start"]), float(clip["timeline_end"])
521
+ ss, se = float(clip["source_start"]), float(clip["source_end"])
522
+ path = clip["source_path"]
523
+ speed_value = float(clip.get("speed", 1.0))
524
+ if speed_value <= 0:
525
+ raise ValueError("video clip speed must be greater than 0")
526
+ reverse = bool(clip.get("reverse", False))
527
+ if reverse:
528
+ reverse_path = clip.get("reverse_path")
529
+ if not isinstance(reverse_path, str) or not reverse_path:
530
+ raise ValueError("reverse video clips require a local reverse_path")
531
+ path = reverse_path
532
+ src_dur_us, width, height = ctx.media_duration(path, us(se))
533
+ mat_id = ctx.new_id()
534
+ material = template("video")
535
+ material.update({
536
+ "duration": int(src_dur_us),
537
+ "height": height or ctx.height,
538
+ "id": mat_id,
539
+ "material_name": os.path.basename(path),
540
+ "path": path,
541
+ "width": width or ctx.width,
542
+ })
543
+ audio = clip.get("audio", {})
544
+ keyframes = volume_keyframes(audio.get("volume_keyframes"), ts, ctx.new_id)
545
+ volume = audio.get("base_gain", 1.0) if not keyframes else 1.0
546
+ seg = base_segment(mat_id, us(ts), us(te - ts), volume, keyframes, ctx.new_id)
547
+ source_start = ss
548
+ if reverse:
549
+ source_start = max(0.0, (src_dur_us / 1_000_000) - se)
550
+ seg["source_timerange"] = timerange(us(source_start), us(se - ss))
551
+ seg["speed"] = speed_value
552
+ seg["extra_material_refs"] = []
553
+ if abs(speed_value - 1.0) > 1e-9:
554
+ speed = speed_material(ctx.new_id, speed_value)
555
+ ctx.materials["speeds"].append(speed)
556
+ seg["extra_material_refs"].append(speed["id"])
557
+ seg["clip"] = clip_from_segment(clip)
558
+ if clip.get("compound") or clip.get("green_background") or clip.get("chroma"):
559
+ build_compound_video(ctx, clip, material, seg, track_name, ts, te)
560
+ continue
561
+ ctx.materials["videos"].append(material)
562
+ semantic_kind = apply_video_attachments(ctx, clip, seg)
563
+ authored_track_name = "mask" if semantic_kind == "mask" else track_name
564
+ ctx.add_segment(semantic_kind, authored_track_name, us(ts), us(te - ts), seg)
565
+
566
+
567
+ def build_audio_track(ctx, timeline_track):
568
+ role = timeline_track.get("role", timeline_track.get("name", "audio"))
569
+ track_name = timeline_track.get("name", role)
570
+ for segment in timeline_track.get("segments", []):
571
+ ts, te = float(segment["timeline_start"]), float(segment["timeline_end"])
572
+ path = segment["source_path"]
573
+ mat_dur_us, _width, _height = ctx.media_duration(path, us(te - ts))
574
+ want_us = us(te - ts)
575
+ speed_value = float(segment.get("speed", 1.0))
576
+ if speed_value <= 0:
577
+ raise ValueError("audio segment speed must be greater than 0")
578
+ place_us = want_us
579
+ required_source_us = int(round(want_us * speed_value))
580
+ if mat_dur_us and required_source_us > mat_dur_us:
581
+ if role == "bgm" and timeline_track.get("loop"):
582
+ place_us = want_us
583
+ else:
584
+ place_us = int(mat_dur_us / speed_value)
585
+ if role == "bgm" and not timeline_track.get("loop"):
586
+ ctx.note(
587
+ f"BGM 素材({mat_dur_us/1e6:.1f}s) 短于时间线({(te - ts):.1f}s),"
588
+ "剪映中未循环铺满(可在剪映里手动复制延长)"
589
+ )
590
+ mat_id = ctx.new_id()
591
+ material = template("audio")
592
+ material.update({
593
+ "duration": int(mat_dur_us or want_us),
594
+ "id": mat_id,
595
+ "path": path,
596
+ })
597
+ ctx.materials["audios"].append(material)
598
+ keyframes = volume_keyframes(segment.get("volume_keyframes"), ts, ctx.new_id)
599
+ volume = segment.get("gain", 1.0) if not keyframes else 1.0
600
+ if role == "bgm" and timeline_track.get("loop") and mat_dur_us and required_source_us > mat_dur_us:
601
+ cursor = 0
602
+ while cursor < want_us:
603
+ piece = min(int(mat_dur_us / speed_value), want_us - cursor)
604
+ if piece <= 0:
605
+ break
606
+ piece_start_s = ts + (cursor / 1_000_000)
607
+ piece_end_s = ts + ((cursor + piece) / 1_000_000)
608
+ piece_kfs = windowed_volume_keyframes(
609
+ segment.get("volume_keyframes"), piece_start_s, piece_end_s,
610
+ segment.get("gain", 1.0), ctx.new_id)
611
+ piece_volume = segment.get("gain", 1.0) if not piece_kfs else 1.0
612
+ piece_seg = audio_segment_piece(
613
+ mat_id, us(ts) + cursor, piece, 0, int(round(piece * speed_value)),
614
+ piece_volume, piece_kfs, ctx.new_id)
615
+ piece_seg["speed"] = speed_value
616
+ if abs(speed_value - 1.0) > 1e-9:
617
+ speed = speed_material(ctx.new_id, speed_value)
618
+ ctx.materials["speeds"].append(speed)
619
+ piece_seg["extra_material_refs"].append(speed["id"])
620
+ ctx.add_segment("audio", track_name, us(ts) + cursor, piece, piece_seg)
621
+ cursor += piece
622
+ else:
623
+ audio_seg = audio_segment_piece(
624
+ mat_id, us(ts), place_us, 0, int(round(place_us * speed_value)),
625
+ volume, keyframes, ctx.new_id)
626
+ audio_seg["speed"] = speed_value
627
+ if abs(speed_value - 1.0) > 1e-9:
628
+ speed = speed_material(ctx.new_id, speed_value)
629
+ ctx.materials["speeds"].append(speed)
630
+ audio_seg["extra_material_refs"].append(speed["id"])
631
+ ctx.add_segment("audio", track_name, us(ts), place_us, audio_seg)
632
+
633
+
634
+ def build_text_track(ctx, timeline_track):
635
+ track_name = timeline_track.get("name", "text")
636
+ track_kind = "subtitle" if track_name == "subtitle" else "text"
637
+ for segment in timeline_track.get("segments", []):
638
+ ts, te = float(segment["timeline_start"]), float(segment["timeline_end"])
639
+ text = segment.get("text", "")
640
+ mat_id = ctx.new_id()
641
+ authored_style = dict(ctx.style_presets.get(str(segment.get("style_id")), {}))
642
+ authored_style.update(segment.get("style") or {})
643
+ content = rich_text_content(
644
+ text, authored_style, segment.get("words"), ctx.style_presets
645
+ )
646
+ material = template("text")
647
+ material.update({
648
+ "id": mat_id,
649
+ "content": json.dumps(content, ensure_ascii=False),
650
+ "type": "subtitle" if track_kind == "subtitle" else "text",
651
+ "alignment": int(authored_style.get("text_align", 1)),
652
+ "font_size": float(authored_style.get("font_size", 8.0)),
653
+ "text_color": authored_style.get("fill_color", "#FFFFFF"),
654
+ "line_spacing": float(authored_style.get("line_spacing", 0.02)),
655
+ "letter_spacing": float(authored_style.get("letter_spacing", 0.0)),
656
+ "check_flag": 15,
657
+ })
658
+ bundle_resources = []
659
+ for content_style in content["styles"]:
660
+ font_path = content_style.get("font", {}).get("path")
661
+ if font_path and not str(font_path).startswith(("Resources/", "##_draftpath_placeholder_")):
662
+ bundle_resources.append({
663
+ "source_path": str(font_path),
664
+ "resource_kind": "fonts",
665
+ })
666
+ effect_path = content_style.get("effect_style", {}).get("path")
667
+ if effect_path and not str(effect_path).startswith(("Resources/", "##_draftpath_placeholder_")):
668
+ bundle_resources.append({
669
+ "source_path": str(effect_path),
670
+ "resource_kind": "effect",
671
+ })
672
+ if bundle_resources:
673
+ material["_bundle_resources"] = bundle_resources
674
+ if authored_style.get("background_color"):
675
+ material.update({
676
+ "background_color": authored_style["background_color"],
677
+ "background_alpha": float(authored_style.get("background_opacity", 100)) / 100.0,
678
+ "background_style": 1,
679
+ "background_height": float(authored_style.get("background_height", 14)) / 100.0,
680
+ "background_width": float(authored_style.get("background_width", 14)) / 100.0,
681
+ "background_horizontal_offset": float(authored_style.get("background_offset_x", 50)) * 0.02 - 1,
682
+ "background_vertical_offset": float(authored_style.get("background_offset_y", 50)) * 0.02 - 1,
683
+ "background_round_radius": float(authored_style.get("background_radius", 6)) / 100.0,
684
+ "check_flag": 31,
685
+ })
686
+ if authored_style.get("stroke_color") and float(authored_style.get("stroke_width", 0)) > 0:
687
+ material["bold_width"] = round(
688
+ 0.00196 * (float(authored_style["stroke_width"]) ** 1.013), 6
689
+ )
690
+ material["border_color"] = authored_style["stroke_color"]
691
+ if authored_style.get("shadow_color"):
692
+ material.update({
693
+ "has_shadow": True,
694
+ "shadow_color": authored_style["shadow_color"],
695
+ "shadow_alpha": float(authored_style.get("shadow_opacity", 90)) / 100.0,
696
+ "shadow_angle": float(authored_style.get("shadow_angle", -45)),
697
+ "shadow_distance": float(authored_style.get("shadow_width", 5)),
698
+ "shadow_smoothing": float(authored_style.get("shadow_vague", 45)) / 100.0,
699
+ })
700
+ if authored_style or segment.get("words"):
701
+ material["is_rich_text"] = True
702
+ ctx.materials["texts"].append(material)
703
+ duration_us = us(te - ts)
704
+ seg = base_segment(mat_id, us(ts), duration_us, 1.0, [], ctx.new_id)
705
+ seg["source_timerange"] = timerange(0, duration_us)
706
+ seg["clip"] = clip_from_segment(segment)
707
+ if track_kind == "subtitle" and "position" not in segment:
708
+ seg["clip"]["transform"]["y"] = -0.72
709
+ ctx.add_segment(track_kind, track_name, us(ts), duration_us, seg)
710
+
711
+
712
+ def build_image_track(ctx, timeline_track):
713
+ """Build local image overlays as JianYing photo materials on video tracks."""
714
+ track_name = timeline_track.get("name", "image")
715
+ for segment in timeline_track.get("segments", []):
716
+ ts, te = float(segment["timeline_start"]), float(segment["timeline_end"])
717
+ duration_us = us(te - ts)
718
+ path = segment["source_path"]
719
+ _ignored_duration, width, height = ctx.media_duration(path, duration_us)
720
+ mat_id = ctx.new_id()
721
+ material = template("video")
722
+ material.update({
723
+ "duration": duration_us,
724
+ "height": height or ctx.height,
725
+ "id": mat_id,
726
+ "material_name": os.path.basename(path),
727
+ "path": path,
728
+ "type": "photo",
729
+ "width": width or ctx.width,
730
+ })
731
+ ctx.materials["videos"].append(material)
732
+ seg = base_segment(mat_id, us(ts), duration_us, 1.0, [], ctx.new_id)
733
+ speed_value = float(segment.get("speed", 1.0))
734
+ if speed_value <= 0:
735
+ raise ValueError("image segment speed must be greater than 0")
736
+ seg["source_timerange"] = timerange(0, round(duration_us * speed_value))
737
+ seg["clip"] = clip_from_segment(segment)
738
+ seg["speed"] = speed_value
739
+ if abs(speed_value - 1.0) > 1e-9:
740
+ speed = speed_material(ctx.new_id, speed_value)
741
+ ctx.materials["speeds"].append(speed)
742
+ seg["extra_material_refs"].append(speed["id"])
743
+ semantic_kind = apply_video_attachments(ctx, segment, seg)
744
+ authored_track_name = "mask" if semantic_kind == "mask" else track_name
745
+ if semantic_kind == "video":
746
+ semantic_kind = "image"
747
+ ctx.add_segment(semantic_kind, authored_track_name, us(ts), duration_us, seg)
748
+
749
+
750
+ def build_timeline_track(ctx, timeline_track):
751
+ kind = timeline_track.get("kind")
752
+ if kind in ("audio", "text") and not timeline_track.get("segments"):
753
+ return
754
+ if kind == "video":
755
+ build_video_track(ctx, timeline_track)
756
+ elif kind == "audio":
757
+ build_audio_track(ctx, timeline_track)
758
+ elif kind == "text":
759
+ build_text_track(ctx, timeline_track)
760
+ elif kind == "image":
761
+ build_image_track(ctx, timeline_track)
762
+ elif kind in RESOURCE_TRACKS:
763
+ build_resource_track(ctx, timeline_track)
764
+ else:
765
+ note = unsupported_track_note(kind)
766
+ if note:
767
+ ctx.note(note)