@hypit/hypit 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 (462) hide show
  1. package/README.md +4 -2
  2. package/dist/public/caption.d.ts +206 -183
  3. package/dist/public/composition.d.ts +25 -3
  4. package/dist/public/endpoint-kit.d.ts +24 -2
  5. package/dist/public/generation.d.ts +5 -1
  6. package/dist/public/hyperframes.d.ts +19 -1
  7. package/dist/public/narrative.d.ts +17 -3
  8. package/dist/public/performance.d.ts +1590 -0
  9. package/dist/public/program-space.d.ts +179 -32
  10. package/dist/public/runtime-kit.d.ts +21 -8
  11. package/dist/public/sound.d.ts +822 -0
  12. package/dist/public/speech.d.ts +41 -0
  13. package/dist/public/studio-adapter.d.ts +77 -15
  14. package/dist/public/temporal-markup.d.ts +9 -44
  15. package/dist/public/temporal.d.ts +37 -28
  16. package/dist/public/{semantic-track.d.ts → timeline.d.ts} +62 -49
  17. package/examples/README.md +18 -10
  18. package/examples/minimal-author-package/packages/example-component/preview/preview.svml +19 -12
  19. package/examples/minimal-author-package/packages/example-component/src/component.ts +5 -5
  20. package/examples/minimal-author-package/packages/example-component/src/fragment.ts +3 -5
  21. package/examples/minimal-author-package/packages/example-component/src/manifest.ts +8 -10
  22. package/examples/minimal-author-package/packages/example-component/src/surface.ts +2 -2
  23. package/examples/provider-package/README.md +78 -0
  24. package/examples/provider-package/hypit.runtime.json +12 -0
  25. package/examples/provider-package/packages/provider-images/package.json +11 -0
  26. package/examples/provider-package/packages/provider-images/src/activation.ts +24 -0
  27. package/examples/provider-package/packages/provider-images/src/provider.ts +122 -0
  28. package/examples/provider-package/packages/provider-images/tsconfig.json +9 -0
  29. package/examples/semantic-composition/README.md +8 -1
  30. package/examples/semantic-composition/chat.svml +6 -5
  31. package/examples/semantic-composition/hypit.runtime.json +1 -1
  32. package/examples/semantic-composition/packages/chat-scene/README.md +3 -3
  33. package/examples/semantic-composition/packages/chat-scene/src/activation.ts +18 -21
  34. package/examples/semantic-composition/packages/chat-scene/src/render.ts +4 -4
  35. package/examples/semantic-composition/packages/performance-styles/README.md +42 -0
  36. package/examples/semantic-composition/packages/performance-styles/package.json +25 -0
  37. package/examples/semantic-composition/packages/performance-styles/src/activation.ts +57 -0
  38. package/examples/semantic-composition/packages/performance-styles/src/render.ts +54 -0
  39. package/examples/semantic-composition/packages/performance-styles/src/studio.ts +28 -0
  40. package/examples/semantic-composition/packages/performance-styles/tsconfig.json +18 -0
  41. package/examples/semantic-composition/packages/responsive-explainer/README.md +16 -9
  42. package/examples/semantic-composition/packages/responsive-explainer/src/activation.ts +12 -12
  43. package/examples/semantic-composition/packages/responsive-explainer/src/render.ts +5 -5
  44. package/examples/semantic-composition/packages/sound-styles/README.md +36 -0
  45. package/examples/semantic-composition/packages/sound-styles/package.json +25 -0
  46. package/examples/semantic-composition/packages/sound-styles/src/activation.ts +53 -0
  47. package/examples/semantic-composition/packages/sound-styles/src/render.ts +14 -0
  48. package/examples/semantic-composition/packages/sound-styles/tsconfig.json +18 -0
  49. package/package.json +35 -15
  50. package/packages/audio-track/README.md +20 -13
  51. package/packages/audio-track/package.json +1 -1
  52. package/packages/audio-track/src/component.ts +4 -4
  53. package/packages/audio-track/src/fragment.ts +6 -5
  54. package/packages/audio-track/src/index.ts +1 -1
  55. package/packages/audio-track/src/manifest.ts +17 -16
  56. package/packages/audio-track/src/program.ts +21 -25
  57. package/packages/audio-track/src/surface.ts +19 -18
  58. package/packages/audio-track-studio/README.md +23 -0
  59. package/packages/audio-track-studio/src/index.ts +28 -17
  60. package/packages/author-kit/README.md +1 -1
  61. package/packages/background-removal/README.md +4 -7
  62. package/packages/browser-capture/package.json +1 -1
  63. package/packages/build-result/README.md +11 -0
  64. package/packages/build-result/src/decode.ts +2 -0
  65. package/packages/build-result/src/execution-log.ts +17 -0
  66. package/packages/build-result/src/index.ts +1 -0
  67. package/packages/build-result/src/store.ts +14 -1
  68. package/packages/build-result/src/types.ts +3 -0
  69. package/packages/build-result-s3/src/repository.ts +4 -0
  70. package/packages/caption/README.md +61 -73
  71. package/packages/caption/package.json +3 -2
  72. package/packages/caption/src/activation.ts +2 -2
  73. package/packages/caption/src/component.ts +20 -5
  74. package/packages/caption/src/display.ts +3 -18
  75. package/packages/caption/src/fragment.ts +3 -7
  76. package/packages/caption/src/index.ts +6 -5
  77. package/packages/caption/src/manifest.ts +29 -46
  78. package/packages/caption/src/style.ts +24 -135
  79. package/packages/caption/src/surface.ts +12 -92
  80. package/packages/caption/src/temporalize.ts +18 -53
  81. package/packages/caption/src/types.ts +8 -35
  82. package/packages/caption/src/visibility.ts +23 -0
  83. package/packages/caption-fine/README.md +21 -9
  84. package/packages/caption-fine/package.json +4 -2
  85. package/packages/caption-fine/src/component.ts +3 -3
  86. package/packages/caption-fine/src/fragment.ts +7 -19
  87. package/packages/caption-fine/src/index.ts +2 -0
  88. package/packages/caption-fine/src/manifest.ts +26 -17
  89. package/packages/caption-fine/src/recipe.ts +7 -0
  90. package/packages/caption-fine/src/render.ts +14 -13
  91. package/packages/caption-fine/src/schedule.ts +39 -35
  92. package/packages/caption-fine/src/style.ts +10 -9
  93. package/packages/caption-fine/src/surface.ts +62 -35
  94. package/packages/caption-fine/src/types.ts +2 -0
  95. package/packages/caption-fine-studio/README.md +24 -2
  96. package/packages/caption-fine-studio/package.json +3 -1
  97. package/packages/caption-fine-studio/src/activation.ts +3 -3
  98. package/packages/caption-fine-studio/src/index.ts +54 -42
  99. package/packages/cli/README.md +57 -4
  100. package/packages/cli/package.json +1 -0
  101. package/packages/cli/src/arguments.ts +25 -6
  102. package/packages/cli/src/build-planning.ts +3 -2
  103. package/packages/cli/src/command.ts +6 -0
  104. package/packages/cli/src/commands/environment.ts +28 -18
  105. package/packages/cli/src/commands/execution.ts +81 -26
  106. package/packages/cli/src/commands/results.ts +7 -11
  107. package/packages/cli/src/index.ts +2 -2
  108. package/packages/cli/src/machine-view.ts +3 -2
  109. package/packages/cli/src/main.ts +34 -42
  110. package/packages/cli/src/observation.ts +7 -1
  111. package/packages/cli/src/output.ts +65 -23
  112. package/packages/cli/src/view.ts +66 -19
  113. package/packages/comment-sticker/README.md +3 -3
  114. package/packages/comment-sticker/package.json +1 -1
  115. package/packages/comment-sticker/src/component.ts +4 -4
  116. package/packages/comment-sticker/src/fragment.ts +5 -4
  117. package/packages/comment-sticker/src/manifest.ts +7 -6
  118. package/packages/comment-sticker/src/program.ts +9 -9
  119. package/packages/comment-sticker/src/surface.ts +6 -7
  120. package/packages/composition/README.md +21 -0
  121. package/packages/composition/src/audio-presentation.ts +44 -0
  122. package/packages/composition/src/index.ts +3 -0
  123. package/packages/composition/src/schema.ts +8 -3
  124. package/packages/composition/src/track.ts +15 -1
  125. package/packages/credential-store-env/README.md +1 -1
  126. package/packages/deck-track/README.md +3 -3
  127. package/packages/deck-track/package.json +1 -1
  128. package/packages/deck-track/src/component.ts +5 -5
  129. package/packages/deck-track/src/fragment.ts +6 -5
  130. package/packages/deck-track/src/lower.ts +12 -12
  131. package/packages/deck-track/src/manifest.ts +8 -7
  132. package/packages/deck-track/src/program.ts +13 -16
  133. package/packages/deck-track/src/surface.ts +9 -10
  134. package/packages/driver-node/src/driver.ts +41 -3
  135. package/packages/elevenlabs-speech/README.md +27 -0
  136. package/packages/{provider-xiaomi-mimo → elevenlabs-speech}/package.json +5 -8
  137. package/packages/elevenlabs-speech/src/activation.ts +26 -0
  138. package/packages/elevenlabs-speech/src/fragment.ts +11 -0
  139. package/packages/elevenlabs-speech/src/index.ts +111 -0
  140. package/packages/elevenlabs-speech/src/surface.ts +167 -0
  141. package/packages/endpoint-kit/README.md +24 -0
  142. package/packages/endpoint-kit/src/index.ts +7 -1
  143. package/packages/film/README.md +12 -7
  144. package/packages/film/package.json +1 -1
  145. package/packages/film/src/component.ts +4 -4
  146. package/packages/film/src/fragment.ts +6 -5
  147. package/packages/film/src/manifest.ts +11 -10
  148. package/packages/film/src/program.ts +5 -5
  149. package/packages/film/src/recipe.ts +2 -1
  150. package/packages/film/src/surface.ts +10 -7
  151. package/packages/film-studio/package.json +1 -1
  152. package/packages/film-studio/src/index.ts +2 -2
  153. package/packages/fishaudio-speech/README.md +33 -0
  154. package/packages/fishaudio-speech/package.json +21 -0
  155. package/packages/fishaudio-speech/src/activation.ts +32 -0
  156. package/packages/fishaudio-speech/src/fragment.ts +11 -0
  157. package/packages/fishaudio-speech/src/index.ts +156 -0
  158. package/packages/fishaudio-speech/src/surface.ts +192 -0
  159. package/packages/generation/README.md +11 -1
  160. package/packages/generation/src/mapping.ts +28 -30
  161. package/packages/gpt-image/README.md +1 -2
  162. package/packages/grok-imagine/README.md +1 -2
  163. package/packages/hyperframes/README.md +7 -3
  164. package/packages/hyperframes/src/browser-program.ts +11 -2
  165. package/packages/hyperframes/src/document.ts +15 -2
  166. package/packages/interview-emoji-reveal/README.md +4 -4
  167. package/packages/interview-emoji-reveal/package.json +1 -1
  168. package/packages/interview-emoji-reveal/src/component.ts +4 -4
  169. package/packages/interview-emoji-reveal/src/fragment.ts +6 -5
  170. package/packages/interview-emoji-reveal/src/manifest.ts +9 -8
  171. package/packages/interview-emoji-reveal/src/program.ts +14 -14
  172. package/packages/interview-emoji-reveal/src/surface.ts +8 -9
  173. package/packages/media-execution/README.md +7 -3
  174. package/packages/media-execution/src/audio-presentation.ts +23 -0
  175. package/packages/media-execution/src/execute.ts +2 -0
  176. package/packages/media-pipeline/README.md +7 -3
  177. package/packages/media-pipeline/src/audio-plan.ts +4 -1
  178. package/packages/media-pipeline/src/component.ts +16 -2
  179. package/packages/media-pipeline/src/manifest.ts +3 -1
  180. package/packages/media-pipeline/src/types.ts +2 -1
  181. package/packages/media-track/README.md +14 -47
  182. package/packages/media-track/package.json +1 -1
  183. package/packages/media-track/preview/preview.svml +5 -5
  184. package/packages/media-track/src/author.ts +12 -6
  185. package/packages/media-track/src/component.ts +10 -16
  186. package/packages/media-track/src/fragment.ts +8 -7
  187. package/packages/media-track/src/index.ts +3 -1
  188. package/packages/media-track/src/lower.ts +7 -7
  189. package/packages/media-track/src/manifest.ts +16 -38
  190. package/packages/media-track/src/program.ts +62 -67
  191. package/packages/media-track/src/sampling.ts +6 -6
  192. package/packages/media-track/src/sequence.ts +8 -8
  193. package/packages/media-track/src/surface.ts +25 -43
  194. package/packages/media-track-studio/README.md +9 -0
  195. package/packages/media-track-studio/src/index.ts +16 -11
  196. package/packages/mimo-speech/README.md +1 -1
  197. package/packages/minimax-h3/README.md +1 -1
  198. package/packages/nano-banana/README.md +1 -1
  199. package/packages/narrative/README.md +23 -1
  200. package/packages/narrative/src/identity.ts +11 -0
  201. package/packages/narrative/src/index.ts +3 -0
  202. package/packages/narrative/src/schema.ts +28 -27
  203. package/packages/narrative/src/selection.ts +52 -0
  204. package/packages/narrative/src/types.ts +2 -0
  205. package/packages/package-loader-node/README.md +30 -0
  206. package/packages/package-loader-node/package.json +5 -2
  207. package/packages/package-loader-node/src/distribution-resolution.ts +10 -3
  208. package/packages/package-loader-node/src/index.ts +1 -0
  209. package/packages/package-loader-node/src/loader.ts +12 -15
  210. package/packages/package-loader-node/src/location.ts +27 -1
  211. package/packages/package-loader-node/src/module-scope.ts +183 -0
  212. package/packages/package-loader-node/src/types.ts +4 -0
  213. package/packages/performance/README.md +83 -0
  214. package/packages/performance/package.json +30 -0
  215. package/packages/performance/src/activation.ts +11 -0
  216. package/packages/performance/src/component.ts +46 -0
  217. package/packages/performance/src/index.ts +6 -0
  218. package/packages/performance/src/manifest.ts +53 -0
  219. package/packages/{media-track/src/performance.ts → performance/src/media.ts} +9 -10
  220. package/packages/performance/src/program.ts +51 -0
  221. package/packages/performance/src/style.ts +35 -0
  222. package/packages/performance/src/surface.ts +99 -0
  223. package/packages/performance-studio/README.md +25 -0
  224. package/packages/performance-studio/package.json +21 -0
  225. package/packages/performance-studio/src/activation.ts +6 -0
  226. package/packages/performance-studio/src/index.ts +84 -0
  227. package/packages/program-space/README.md +9 -18
  228. package/packages/program-space/src/activation.ts +1 -5
  229. package/packages/program-space/src/index.ts +2 -11
  230. package/packages/program-space/src/surface.ts +1 -20
  231. package/packages/project-context-node/README.md +20 -0
  232. package/packages/project-context-node/package.json +10 -0
  233. package/packages/project-context-node/src/index.ts +3 -0
  234. package/packages/{cli → project-context-node}/src/runtime-selection.ts +7 -2
  235. package/packages/provider-hyperframes-local/README.md +43 -15
  236. package/packages/provider-hyperframes-local/src/activation.ts +4 -3
  237. package/packages/provider-hyperframes-local/src/capture-process.ts +26 -4
  238. package/packages/provider-hyperframes-local/src/capture.ts +96 -26
  239. package/packages/provider-hyperframes-local/src/concurrency.ts +86 -0
  240. package/packages/provider-hyperframes-local/src/opaque-capture.ts +92 -0
  241. package/packages/provider-hyperframes-local/src/options.ts +2 -0
  242. package/packages/provider-hyperframes-local/src/program.ts +6 -3
  243. package/packages/provider-hyperframes-local/src/progress.ts +53 -0
  244. package/packages/provider-hyperframes-local/src/provider.ts +18 -5
  245. package/packages/provider-hyperframes-local/src/render.ts +48 -7
  246. package/packages/provider-hypihub/README.md +48 -17
  247. package/packages/provider-hypihub/package.json +2 -0
  248. package/packages/provider-hypihub/src/mapping.ts +31 -7
  249. package/packages/provider-hypihub/src/oauth.ts +6 -0
  250. package/packages/provider-hypihub/src/provider.ts +25 -13
  251. package/packages/provider-hypihub/src/routes.ts +1 -2
  252. package/packages/provider-hypihub/src/upload.ts +2 -0
  253. package/packages/provider-media-local/README.md +3 -4
  254. package/packages/provider-whisperx-local/src/program.ts +1 -0
  255. package/packages/provider-whisperx-local/src/provider.ts +3 -0
  256. package/packages/ranking/README.md +8 -6
  257. package/packages/ranking/package.json +1 -1
  258. package/packages/ranking/src/component.ts +6 -6
  259. package/packages/ranking/src/fragment.ts +11 -7
  260. package/packages/ranking/src/manifest.ts +21 -14
  261. package/packages/ranking/src/render.ts +22 -26
  262. package/packages/ranking/src/schedule.ts +16 -19
  263. package/packages/ranking/src/surface.ts +12 -13
  264. package/packages/ranking-studio/README.md +18 -0
  265. package/packages/ranking-studio/src/index.ts +61 -9
  266. package/packages/render-hyperframes/README.md +7 -7
  267. package/packages/render-hyperframes/package.json +1 -1
  268. package/packages/render-hyperframes/src/component.ts +11 -1
  269. package/packages/render-hyperframes/src/fragment.ts +7 -4
  270. package/packages/render-hyperframes/src/manifest.ts +4 -4
  271. package/packages/render-hyperframes/src/surface.ts +6 -6
  272. package/packages/runtime/README.md +8 -1
  273. package/packages/runtime/src/execution.ts +15 -4
  274. package/packages/runtime/src/index.ts +2 -1
  275. package/packages/runtime/src/log.ts +51 -0
  276. package/packages/runtime/src/types.ts +5 -8
  277. package/packages/runtime-host-node/README.md +30 -0
  278. package/packages/runtime-host-node/package.json +1 -0
  279. package/packages/runtime-host-node/src/index.ts +24 -9
  280. package/packages/runtime-host-node/src/packages.ts +47 -50
  281. package/packages/runtime-kit/README.md +5 -0
  282. package/packages/runtime-kit/src/index.ts +3 -1
  283. package/packages/runtime-local/README.md +109 -4
  284. package/packages/runtime-local/src/config.ts +202 -56
  285. package/packages/runtime-local/src/control.ts +9 -1
  286. package/packages/runtime-local/src/executor.ts +66 -0
  287. package/packages/runtime-local/src/host.ts +37 -17
  288. package/packages/runtime-local/src/log.ts +48 -0
  289. package/packages/runtime-local/src/programs.ts +2 -1
  290. package/packages/runtime-local/src/result-writer.ts +2 -0
  291. package/packages/runtime-local/src/runtime.ts +8 -6
  292. package/packages/runtime-local/src/supervisor.ts +142 -0
  293. package/packages/runtime-local/src/types.ts +9 -2
  294. package/packages/runtime-local/src/worker-process.ts +7 -24
  295. package/packages/runtime-local/src/worker.ts +55 -83
  296. package/packages/screen-overlay/README.md +3 -3
  297. package/packages/screen-overlay/package.json +1 -1
  298. package/packages/screen-overlay/src/component.ts +3 -3
  299. package/packages/screen-overlay/src/fragment.ts +5 -4
  300. package/packages/screen-overlay/src/manifest.ts +7 -6
  301. package/packages/screen-overlay/src/program.ts +9 -9
  302. package/packages/screen-overlay/src/surface.ts +6 -7
  303. package/packages/script/README.md +30 -5
  304. package/packages/script/src/manifest.ts +4 -3
  305. package/packages/script/src/narrative.ts +1 -0
  306. package/packages/script/src/parser.ts +45 -6
  307. package/packages/script/src/surface.ts +4 -3
  308. package/packages/script/src/types.ts +1 -1
  309. package/packages/script-studio/package.json +9 -3
  310. package/packages/script-studio/src/index.ts +2 -0
  311. package/packages/script-studio/src/projection.ts +105 -0
  312. package/packages/seedance/README.md +30 -1
  313. package/packages/seedance/src/index.ts +18 -7
  314. package/packages/seedance/src/surface.ts +17 -4
  315. package/packages/seedance-kits/README.md +7 -1
  316. package/packages/seedream/README.md +1 -1
  317. package/packages/sound/README.md +81 -0
  318. package/packages/sound/package.json +25 -0
  319. package/packages/sound/src/activation.ts +11 -0
  320. package/packages/sound/src/component.ts +28 -0
  321. package/packages/sound/src/index.ts +5 -0
  322. package/packages/sound/src/manifest.ts +47 -0
  323. package/packages/sound/src/program.ts +84 -0
  324. package/packages/sound/src/style.ts +34 -0
  325. package/packages/sound/src/surface.ts +90 -0
  326. package/packages/sound-studio/README.md +22 -0
  327. package/packages/sound-studio/package.json +20 -0
  328. package/packages/sound-studio/src/activation.ts +6 -0
  329. package/packages/sound-studio/src/index.ts +74 -0
  330. package/packages/speech/README.md +2 -2
  331. package/packages/speech-alignment/src/local.ts +8 -0
  332. package/packages/speech-alignment/src/locate.ts +1 -1
  333. package/packages/store-sqlite/README.md +7 -0
  334. package/packages/store-sqlite/src/store.ts +84 -83
  335. package/packages/studio/INSPECTOR.md +15 -2
  336. package/packages/studio/LOCALIZATION.md +98 -0
  337. package/packages/studio/README.md +101 -14
  338. package/packages/studio/locales/en.json +197 -0
  339. package/packages/studio/locales/zh-CN.json +191 -0
  340. package/packages/studio/package.json +8 -7
  341. package/packages/studio/src/companion-assembly.ts +1 -0
  342. package/packages/studio/src/domain.ts +1 -1
  343. package/packages/studio/src/fallback-companions.ts +3 -3
  344. package/packages/studio/src/feedback-server.ts +51 -0
  345. package/packages/studio/src/feedback-store.ts +66 -0
  346. package/packages/studio/src/feedback.ts +60 -0
  347. package/packages/studio/src/localization-node.ts +46 -0
  348. package/packages/studio/src/localization.ts +85 -0
  349. package/packages/studio/src/parameter-values.ts +43 -1
  350. package/packages/studio/src/parameters.ts +114 -24
  351. package/packages/studio/src/preview/render.ts +5 -1
  352. package/packages/studio/src/preview/runtime-shim.ts +49 -3
  353. package/packages/studio/src/programme.ts +14 -30
  354. package/packages/studio/src/server.ts +10 -6
  355. package/packages/studio/src/shared.ts +4 -2
  356. package/packages/studio/src/snapshot.ts +21 -132
  357. package/packages/studio/src/studio-preflight.ts +3 -3
  358. package/packages/studio/src/studio-registry.ts +50 -6
  359. package/packages/studio/src/style.css +223 -50
  360. package/packages/studio/src/ui/artifact-name.ts +8 -6
  361. package/packages/studio/src/ui/artifact-preview.ts +5 -4
  362. package/packages/studio/src/ui/code.ts +17 -16
  363. package/packages/studio/src/ui/comments.ts +234 -0
  364. package/packages/studio/src/ui/dropdown.ts +68 -0
  365. package/packages/studio/src/ui/i18n.ts +109 -0
  366. package/packages/studio/src/ui/icons.ts +6 -0
  367. package/packages/studio/src/ui/library.ts +76 -65
  368. package/packages/studio/src/ui/main.ts +223 -211
  369. package/packages/studio/src/ui/overlay.ts +12 -8
  370. package/packages/studio/src/ui/scrub-preview.ts +110 -0
  371. package/packages/studio/src/ui/stage.ts +93 -29
  372. package/packages/studio/src/ui/timeline.ts +190 -118
  373. package/packages/studio/start.ts +41 -22
  374. package/packages/studio-adapter/README.md +130 -11
  375. package/packages/studio-adapter/src/index.ts +100 -13
  376. package/packages/temporal/README.md +6 -6
  377. package/packages/temporal/package.json +1 -1
  378. package/packages/temporal/src/component.ts +5 -6
  379. package/packages/temporal/src/index.ts +8 -6
  380. package/packages/temporal/src/location.ts +11 -11
  381. package/packages/temporal/src/projection.ts +19 -19
  382. package/packages/temporal/src/rational.ts +4 -4
  383. package/packages/temporal-markup/EDITING.md +2 -2
  384. package/packages/temporal-markup/README.md +27 -11
  385. package/packages/temporal-markup/package.json +1 -1
  386. package/packages/temporal-markup/src/index.ts +20 -25
  387. package/packages/temporal-markup/src/space.ts +10 -41
  388. package/packages/timeline/README.md +31 -0
  389. package/packages/{semantic-track → timeline}/package.json +1 -1
  390. package/packages/timeline/src/activation.ts +8 -0
  391. package/packages/timeline/src/component.ts +24 -0
  392. package/packages/timeline/src/identity.ts +60 -0
  393. package/packages/timeline/src/index.ts +6 -0
  394. package/packages/{semantic-track → timeline}/src/location.ts +20 -20
  395. package/packages/timeline/src/manifest.ts +39 -0
  396. package/packages/{semantic-track → timeline}/src/projection.ts +14 -14
  397. package/packages/timeline/src/types.ts +24 -0
  398. package/packages/timeline-author/README.md +68 -0
  399. package/packages/{speech-track → timeline-author}/package.json +6 -4
  400. package/packages/timeline-author/src/activation.ts +22 -0
  401. package/packages/{speech-track → timeline-author}/src/component.ts +15 -13
  402. package/packages/{speech-track → timeline-author}/src/fragment.ts +14 -23
  403. package/packages/timeline-author/src/index.ts +7 -0
  404. package/packages/timeline-author/src/manifest.ts +78 -0
  405. package/packages/timeline-author/src/program.ts +107 -0
  406. package/packages/timeline-author/src/surface.ts +46 -0
  407. package/packages/timeline-author/src/types.ts +6 -0
  408. package/packages/typography-track/README.md +4 -4
  409. package/packages/typography-track/package.json +1 -1
  410. package/packages/typography-track/src/component.ts +4 -4
  411. package/packages/typography-track/src/fragment.ts +4 -3
  412. package/packages/typography-track/src/manifest.ts +11 -9
  413. package/packages/typography-track/src/program.ts +15 -15
  414. package/packages/typography-track/src/surface.ts +17 -18
  415. package/packages/video-cli/README.md +4 -1
  416. package/packages/video-cli/package.json +2 -1
  417. package/packages/video-cli/src/creation.ts +14 -4
  418. package/packages/video-cli/src/index.ts +1 -1
  419. package/packages/video-cli/src/studio-distribution.ts +2 -1
  420. package/packages/volcengine-matting/README.md +3 -3
  421. package/packages/whisperx/README.md +1 -1
  422. package/services/whisperx/README.md +14 -0
  423. package/services/whisperx/pyproject.toml +2 -0
  424. package/services/whisperx/uv.lock +20 -20
  425. package/packages/provider-hyperframes-aws-lambda/README.md +0 -30
  426. package/packages/provider-hyperframes-aws-lambda/package.json +0 -30
  427. package/packages/provider-hyperframes-aws-lambda/src/activation.ts +0 -97
  428. package/packages/provider-hyperframes-aws-lambda/src/client.ts +0 -114
  429. package/packages/provider-hyperframes-aws-lambda/src/index.ts +0 -21
  430. package/packages/provider-hyperframes-aws-lambda/src/provider.ts +0 -522
  431. package/packages/provider-kie/README.md +0 -134
  432. package/packages/provider-kie/package.json +0 -43
  433. package/packages/provider-kie/src/activation.ts +0 -71
  434. package/packages/provider-kie/src/index.ts +0 -10
  435. package/packages/provider-kie/src/mapping.ts +0 -182
  436. package/packages/provider-kie/src/provider.ts +0 -657
  437. package/packages/provider-kie/src/routes.ts +0 -150
  438. package/packages/provider-xiaomi-mimo/README.md +0 -32
  439. package/packages/provider-xiaomi-mimo/src/activation.ts +0 -57
  440. package/packages/provider-xiaomi-mimo/src/index.ts +0 -5
  441. package/packages/provider-xiaomi-mimo/src/provider.ts +0 -214
  442. package/packages/runtime/src/environment.ts +0 -6
  443. package/packages/semantic-track/README.md +0 -21
  444. package/packages/semantic-track/src/activation.ts +0 -8
  445. package/packages/semantic-track/src/component.ts +0 -24
  446. package/packages/semantic-track/src/identity.ts +0 -58
  447. package/packages/semantic-track/src/index.ts +0 -6
  448. package/packages/semantic-track/src/manifest.ts +0 -38
  449. package/packages/semantic-track/src/types.ts +0 -26
  450. package/packages/speech-track/README.md +0 -51
  451. package/packages/speech-track/src/activation.ts +0 -19
  452. package/packages/speech-track/src/index.ts +0 -7
  453. package/packages/speech-track/src/manifest.ts +0 -73
  454. package/packages/speech-track/src/program.ts +0 -64
  455. package/packages/speech-track/src/surface.ts +0 -35
  456. package/packages/speech-track/src/types.ts +0 -6
  457. package/packages/speech-track-studio/README.md +0 -3
  458. package/packages/speech-track-studio/package.json +0 -14
  459. package/packages/speech-track-studio/src/activation.ts +0 -7
  460. package/packages/speech-track-studio/src/index.ts +0 -40
  461. /package/packages/{cli → project-context-node}/src/project-context.ts +0 -0
  462. /package/packages/{speech-track → timeline-author}/preview/Track.png +0 -0
@@ -1,20 +1,10 @@
1
- import type { CaptionDocument, Narrative } from "@hypit/narrative";
1
+ import type { CaptionDocument } from "@hypit/narrative";
2
2
  import { canonicalStringify, canonicalize } from "@hypit/protocol";
3
3
 
4
- import {
5
- assertCaptionDocument,
6
- captionUnitsForRole,
7
- type CaptionUnitSubset,
8
- } from "./display.js";
9
- import type {
10
- CaptionMuteApplication,
11
- CaptionProgram,
12
- CaptionStyleApplication,
13
- CaptionStyleIntent,
14
- CaptionWordStyleApplication,
15
- } from "./types.js";
16
-
17
- export type { CaptionMuteApplication, CaptionStyleApplication, CaptionWordStyleApplication } from "./types.js";
4
+ import { assertCaptionDocument } from "./display.js";
5
+ import { assertTemporalWindowFor } from "@hypit/temporal";
6
+ import type { TemporalWindow } from "@hypit/temporal";
7
+ import type { CaptionProgram, CaptionStyleIntent } from "./types.js";
18
8
 
19
9
  const ID = /^[A-Za-z][A-Za-z0-9_.-]{0,127}$/u;
20
10
  function assert(condition: unknown, message: string): asserts condition { if (!condition) throw new Error(message); }
@@ -22,7 +12,8 @@ function assert(condition: unknown, message: string): asserts condition { if (!c
22
12
  export function sealCaptionStyle(value: CaptionStyleIntent): CaptionStyleIntent {
23
13
  const result = canonicalize({
24
14
  id: value.id,
25
- rendering: { family: value.rendering.family.trim(), parameters: canonicalize(value.rendering.parameters) },
15
+ rendering: value.rendering === null ? null
16
+ : { family: value.rendering.family.trim(), parameters: canonicalize(value.rendering.parameters) },
26
17
  }) as unknown as CaptionStyleIntent;
27
18
  assertCaptionStyle(result);
28
19
  return result;
@@ -30,6 +21,7 @@ export function sealCaptionStyle(value: CaptionStyleIntent): CaptionStyleIntent
30
21
 
31
22
  export function assertCaptionStyle(value: CaptionStyleIntent): void {
32
23
  assert(ID.test(value.id), "Caption Style identity is invalid");
24
+ if (value.rendering === null) return;
33
25
  assert(value.rendering.family.trim().length > 0, `Caption Style ${value.id} rendering family is empty`);
34
26
  canonicalize(value.rendering.parameters);
35
27
  }
@@ -41,130 +33,27 @@ export function sealCaptionProgram(value: CaptionProgram): CaptionProgram {
41
33
  }
42
34
 
43
35
  export function assertCaptionProgram(value: CaptionProgram): void {
44
- assert(ID.test(value.id), "Caption Program identity is invalid");
45
- assert(value.documentId.length > 0 && value.styles.length > 0 && value.runs.length > 0,
46
- "Caption Program is empty");
47
- const styles = new Map(value.styles.map((style) => [style.id, style]));
48
- assert(styles.size === value.styles.length, "Caption Program styles are repeated");
36
+ assert(ID.test(value.id) && value.documentId.length > 0, "Caption Track identity is invalid");
37
+ const styles = new Map(value.styles.map(style => [style.id, style]));
38
+ assert(styles.size === value.styles.length, "Caption Styles are repeated");
49
39
  value.styles.forEach(assertCaptionStyle);
50
- assert(new Set(value.runs.map((run) => run.id)).size === value.runs.length,
51
- "Caption Program run ids are repeated");
52
- const units = value.runs.flatMap((run) => run.unitIds);
53
- assert(new Set(units).size === units.length, "Caption Program runs repeat a unit");
54
- assert(value.runs.every((run) => styles.has(run.styleId) && run.unitIds.length > 0),
55
- "Caption Program run is invalid");
56
- assert(new Set(value.wordRuns.map((run) => run.id)).size === value.wordRuns.length,
57
- "Caption Program word run ids are repeated");
58
- const words = value.wordRuns.flatMap((run) => run.wordIds);
59
- assert(new Set(words).size === words.length, "Caption Program word runs repeat a word");
60
- assert(value.wordRuns.every((run) => styles.has(run.styleId) && run.wordIds.length > 0),
61
- "Caption Program word run is invalid");
62
- assert(new Set(value.mutedUnitIds).size === value.mutedUnitIds.length,
63
- "Caption Program muted units are repeated");
40
+ assert(new Set(value.uses.map(use => use.window.subjectId)).size === value.uses.length, "Caption Use ids are repeated");
41
+ for (const use of value.uses) {
42
+ assertTemporalWindowFor(use.window, { subjectId: use.window.subjectId });
43
+ assert(styles.has(use.styleId), "Caption Use references an unknown Style");
44
+ assert(use.role === undefined || use.role.trim().length > 0, "Caption Role is empty");
45
+ }
64
46
  }
65
-
66
47
  export function assertCaptionProgramForDocument(value: CaptionProgram, document: CaptionDocument): void {
67
48
  assertCaptionProgram(value);
68
49
  assertCaptionDocument(document);
69
- assert(value.documentId === document.id, "Caption Program belongs to another CaptionDocument");
70
- const expected = document.units.map((unit) => unit.id);
71
- assert(value.runs.flatMap((run) => run.unitIds).join("\0") === expected.join("\0"),
72
- "Caption Program must partition every Caption unit exactly once and in order");
73
- const known = new Set(expected);
74
- assert(value.mutedUnitIds.every((id) => known.has(id)), "Caption Program mutes an unknown unit");
75
- const knownWords = new Set(document.words.map((word) => word.id));
76
- assert(value.wordRuns.every((run) => run.wordIds.every((id) => knownWords.has(id))),
77
- "Caption Program styles an unknown display word");
50
+ assert(value.documentId === document.id, "Caption Uses belong to another CaptionDocument");
78
51
  }
79
-
80
- function orderedSubset(value: CaptionUnitSubset, document: CaptionDocument): string[] {
81
- assertCaptionDocument(document);
82
- assert(value.documentId === document.id, "Caption unit subset belongs to another document");
83
- const order = new Map(document.units.map((unit, index) => [unit.id, index]));
84
- const indices = value.unitIds.map((id) => order.get(id));
85
- assert(indices.length > 0 && indices.every((index) => index !== undefined),
86
- "Caption unit subset contains an unknown unit");
87
- assert(indices.every((index, position) => position === 0 || index! > indices[position - 1]!),
88
- "Caption unit subset must be ordered and contain no repeated unit");
89
- return [...value.unitIds];
90
- }
91
-
92
- export function resolveCaptionProgram(
93
- document: CaptionDocument,
94
- narrative: Narrative,
95
- id: string,
96
- defaultStyle: CaptionStyleIntent,
97
- applications: readonly CaptionStyleApplication[],
98
- mutes: readonly CaptionMuteApplication[] = [],
99
- wordApplications: readonly CaptionWordStyleApplication[] = [],
100
- ): CaptionProgram {
101
- assertCaptionDocument(document);
102
- assertCaptionStyle(defaultStyle);
103
- const styles = new Map<string, CaptionStyleIntent>([[defaultStyle.id, defaultStyle]]);
104
- const selected = applications.map((application) => {
105
- assert(ID.test(application.id), "Caption Style Application identity is invalid");
106
- assertCaptionStyle(application.style);
107
- const unitIds = orderedSubset({ documentId: document.id, unitIds: application.unitIds }, document);
108
- const previous = styles.get(application.style.id);
109
- assert(previous === undefined || canonicalStringify(previous) === canonicalStringify(application.style),
110
- `Caption Style ${application.style.id} has conflicting definitions`);
111
- styles.set(application.style.id, application.style);
112
- return { ...application, unitIds };
113
- });
114
- const muted = mutes.flatMap((application) => {
115
- assert(ID.test(application.id), "Caption Mute identity is invalid");
116
- return orderedSubset({ documentId: document.id, unitIds: application.unitIds }, document);
52
+ export function appendCaptionUse(program: CaptionProgram, window: TemporalWindow, style: CaptionStyleIntent, role?: string): CaptionProgram {
53
+ const previous = program.styles.find(item => item.id === style.id);
54
+ assert(previous === undefined || canonicalStringify(previous) === canonicalStringify(style), `Caption Style ${style.id} has conflicting definitions`);
55
+ return sealCaptionProgram({ ...program,
56
+ styles: previous === undefined ? [...program.styles, style] : program.styles,
57
+ uses: [...program.uses, { window, styleId: style.id, ...(role === undefined ? {} : { role }) }],
117
58
  });
118
- const wordChosen = new Map<string, string>();
119
- for (const application of wordApplications) {
120
- assert(ID.test(application.id), "Caption Word Style Application identity is invalid");
121
- assert(application.attribute.trim().length > 0, "Caption Word Style Application attribute is empty");
122
- assertCaptionStyle(application.style);
123
- const knownWordIds = new Set(document.words.map((word) => word.id));
124
- for (const wordId of application.wordIds) {
125
- assert(knownWordIds.has(wordId), `Caption Word Style Application references unknown word ${wordId}`);
126
- const previous = wordChosen.get(wordId);
127
- assert(previous === undefined || previous === application.style.id,
128
- `Caption word ${wordId} receives conflicting styles`);
129
- wordChosen.set(wordId, application.style.id);
130
- }
131
- const previous = styles.get(application.style.id);
132
- assert(previous === undefined || canonicalStringify(previous) === canonicalStringify(application.style),
133
- `Caption Style ${application.style.id} has conflicting definitions`);
134
- styles.set(application.style.id, application.style);
135
- }
136
- const chosen = new Map(document.units.map((unit) => [unit.id, defaultStyle.id]));
137
- for (const application of selected) for (const unitId of application.unitIds) chosen.set(unitId, application.style.id);
138
- const runs: CaptionProgram["runs"][number][] = [];
139
- for (const unit of document.units) {
140
- const styleId = chosen.get(unit.id)!;
141
- const previous = runs.at(-1);
142
- if (previous === undefined || previous.styleId !== styleId) {
143
- runs.push({ id: `${id}:run:${runs.length + 1}`, styleId, unitIds: [unit.id] });
144
- } else {
145
- runs[runs.length - 1] = { ...previous, unitIds: [...previous.unitIds, unit.id] };
146
- }
147
- }
148
- const wordRuns: CaptionProgram["wordRuns"][number][] = [];
149
- for (const [wordId, styleId] of wordChosen) {
150
- const previous = wordRuns.at(-1);
151
- if (previous === undefined || previous.styleId !== styleId) {
152
- wordRuns.push({ id: `${id}:word-run:${wordRuns.length + 1}`, styleId, wordIds: [wordId] });
153
- } else {
154
- wordRuns[wordRuns.length - 1] = { ...previous, wordIds: [...previous.wordIds, wordId] };
155
- }
156
- }
157
- const program = sealCaptionProgram({
158
- id,
159
- documentId: document.id,
160
- styles: [...styles.values()].filter((style) => [...chosen.values(), ...wordChosen.values()].includes(style.id)),
161
- runs,
162
- wordRuns,
163
- mutedUnitIds: [...new Set(muted)],
164
- });
165
- assertCaptionProgramForDocument(program, document);
166
- void narrative;
167
- return program;
168
59
  }
169
-
170
- export { captionUnitsForRole };
@@ -1,96 +1,16 @@
1
- import { narrativeTypes } from "@hypit/narrative";
2
- import type { CaptionDocument, Narrative, NarrativeSelection } from "@hypit/narrative";
3
- import type { StructuredElement, StructuredSurfaceHandler, SurfaceResolvedReference, MarkupAttributeValue } from "@hypit/markup";
4
-
1
+ import type { StructuredSurfaceHandler } from "@hypit/markup";
2
+ import { assertAttributes, assertEmptyElement, textAttribute } from "@hypit/markup";
5
3
  import { captionTypes } from "./manifest.js";
6
- import { captionUnitsForRole, captionUnitsForSelection, captionWordsForAttribute } from "./display.js";
7
- import { resolveCaptionProgram } from "./style.js";
8
- import type { CaptionMuteApplication, CaptionStyleApplication, CaptionStyleIntent, CaptionWordStyleApplication } from "./types.js";
9
-
10
- function sameType(left: SurfaceResolvedReference["type"], right: SurfaceResolvedReference["type"]): boolean {
11
- return left.module.name === right.module.name && left.module.version === right.module.version && left.name === right.name;
12
- }
13
- function attributes(element: StructuredElement, required: readonly string[], optional: readonly string[] = []): void {
14
- const allowed = new Set([...required, ...optional]);
15
- const actual = Object.keys(element.attributes);
16
- if (required.some((name) => element.attributes[name] === undefined) || actual.some((name) => !allowed.has(name))) {
17
- throw new Error(`${element.name} requires ${required.join(", ")}${optional.length ? `; optional: ${optional.join(", ")}` : ""}`);
18
- }
19
- }
20
- function stringAttribute(element: StructuredElement, name: string): string {
21
- const value = element.attributes[name];
22
- if (typeof value !== "string" || !value.trim()) throw new Error(`${element.name}.${name} must be a non-empty string`);
23
- return value.trim();
24
- }
25
- function optionalString(element: StructuredElement, name: string): string | undefined {
26
- const value = element.attributes[name];
27
- if (value === undefined) return undefined;
28
- if (typeof value !== "string" || !value.trim()) throw new Error(`${element.name}.${name} must be a non-empty string`);
29
- return value.trim();
30
- }
31
- function reference(
32
- element: StructuredElement,
33
- name: string,
34
- expected: SurfaceResolvedReference["type"],
35
- resolveReference: (path: string) => SurfaceResolvedReference | undefined,
36
- ): SurfaceResolvedReference {
37
- const raw: MarkupAttributeValue | undefined = element.attributes[name];
38
- if (typeof raw !== "object" || raw.kind !== "reference") throw new Error(`${element.name}.${name} must be a whole-value reference`);
39
- const value = resolveReference(raw.path);
40
- if (value === undefined) throw new Error(`${element.name}.${name} cannot resolve ${raw.path}`);
41
- if (!sameType(value.type, expected)) throw new Error(`${element.name}.${name} has the wrong type`);
42
- return value;
43
- }
44
- function inline<T>(referenceValue: SurfaceResolvedReference, subject: string): T {
45
- if (referenceValue.record?.value.kind !== "inline") throw new Error(`${subject} must reference an authored inline Record`);
46
- return referenceValue.record.value.value as unknown as T;
47
- }
48
- function localName(name: string): string { const index = name.lastIndexOf(":"); return index < 0 ? name : name.slice(index + 1); }
4
+ import { sealCaptionStyle } from "./style.js";
49
5
 
50
- export const decodeCaptionProgramSurface: StructuredSurfaceHandler = ({ element, resolveReference }) => {
51
- attributes(element, ["id", "document", "narrative", "default"]);
52
- const id = stringAttribute(element, "id");
53
- const document = inline<CaptionDocument>(reference(element, "document", narrativeTypes.captionDocument, resolveReference), `${element.name}.document`);
54
- const narrative = inline<Narrative>(reference(element, "narrative", narrativeTypes.narrative, resolveReference), `${element.name}.narrative`);
55
- const defaultStyle = inline<CaptionStyleIntent>(reference(element, "default", captionTypes.style, resolveReference), `${element.name}.default`);
56
- const applications: CaptionStyleApplication[] = [];
57
- const wordApplications: CaptionWordStyleApplication[] = [];
58
- const mutes: CaptionMuteApplication[] = [];
59
- for (const child of element.children) {
60
- if (child.kind === "text") { if (child.value.trim()) throw new Error(`${element.name} accepts only Use or Mute children`); continue; }
61
- const childName = localName(child.name);
62
- if (childName !== "Use" && childName !== "Mute") throw new Error(`${element.name} accepts only Use or Mute children`);
63
- attributes(child, childName === "Use" ? ["style"] : [], ["role", "selection", "attribute"]);
64
- const role = optionalString(child, "role");
65
- const attribute = optionalString(child, "attribute");
66
- const selectionRaw = child.attributes.selection;
67
- const selectors = [role !== undefined, selectionRaw !== undefined, attribute !== undefined].filter(Boolean).length;
68
- if (selectors !== 1) throw new Error(`${child.name} requires exactly one of role, selection or attribute`);
69
- if (childName === "Mute" && attribute !== undefined) throw new Error(`${child.name} cannot mute a token attribute`);
70
- if (attribute !== undefined) {
71
- const wordIds = captionWordsForAttribute(document, attribute);
72
- wordApplications.push({
73
- id: `${id}.word-use.${wordApplications.length + 1}`,
74
- attribute,
75
- wordIds,
76
- style: inline<CaptionStyleIntent>(reference(child, "style", captionTypes.style, resolveReference), `${child.name}.style`),
77
- });
78
- continue;
79
- }
80
- const unitIds = role !== undefined
81
- ? captionUnitsForRole(document, role).unitIds
82
- : captionUnitsForSelection(
83
- document,
84
- narrative,
85
- inline<NarrativeSelection>(reference(child, "selection", narrativeTypes.selection, resolveReference), `${child.name}.selection`),
86
- ).unitIds;
87
- if (childName === "Mute") mutes.push({ id: `${id}.mute.${mutes.length + 1}`, unitIds });
88
- else applications.push({
89
- id: `${id}.use.${applications.length + 1}`,
90
- unitIds,
91
- style: inline<CaptionStyleIntent>(reference(child, "style", captionTypes.style, resolveReference), `${child.name}.style`),
92
- });
6
+ export const decodeHiddenCaptionStyleSurface: StructuredSurfaceHandler = ({ element }) => {
7
+ assertAttributes(element, ["id"]);
8
+ assertEmptyElement(element);
9
+ const id = textAttribute(element, "id");
10
+ if (element.children.some(child => child.kind !== "text" || child.value.trim())) {
11
+ throw new Error(`${element.name} accepts no children`);
93
12
  }
94
- const program = resolveCaptionProgram(document, narrative, id, defaultStyle, applications, mutes, wordApplications);
95
- return { records: [{ id, type: captionTypes.program, value: { kind: "inline", value: program }, range: element.range }], components: [], fragments: [] };
13
+ return { records: [{ id, type: captionTypes.style,
14
+ value: { kind: "inline", value: sealCaptionStyle({ id, rendering: null }) }, range: element.range }],
15
+ components: [], fragments: [] };
96
16
  };
@@ -1,64 +1,55 @@
1
1
  import type { CaptionDocument } from "@hypit/narrative";
2
- import { projectSemanticProgramSpace, tokenFrameSpan } from "@hypit/semantic-track";
3
- import type { SemanticTrack } from "@hypit/semantic-track";
2
+ import { projectTimelineSpace, tokenFrameSpan } from "@hypit/timeline";
3
+ import type { Timeline } from "@hypit/timeline";
4
4
 
5
5
  import { CaptionTimingError } from "./error.js";
6
6
  import { assertCaptionDocument } from "./display.js";
7
- import { assertCaptionProgramForDocument } from "./style.js";
8
- import type { CaptionProgram, TimedCaptionProjection, TimedCaptionCue, TimedCaptionUnit } from "./types.js";
7
+ import type { TimedCaptionProjection, TimedCaptionCue, TimedCaptionUnit } from "./types.js";
9
8
 
10
9
  export function temporalizeCaptionDocument(
11
10
  document: CaptionDocument,
12
- semantic: SemanticTrack,
13
- program: CaptionProgram,
11
+ semantic: Timeline,
14
12
  ): TimedCaptionProjection {
15
13
  assertCaptionDocument(document);
16
- assertCaptionProgramForDocument(program, document);
17
- const space = projectSemanticProgramSpace(semantic);
18
- if (document.narrativeId !== semantic.narrativeId) {
19
- throw new CaptionTimingError("CAPTION_NARRATIVE", "CaptionDocument and SemanticTrack belong to different Narratives.");
14
+ const space = projectTimelineSpace(semantic);
15
+ if (semantic.narrativeId !== undefined && document.narrativeId !== semantic.narrativeId) {
16
+ throw new CaptionTimingError("CAPTION_NARRATIVE", "CaptionDocument and Timeline belong to different Narratives.");
20
17
  }
21
- const styleByUnit = new Map(program.runs.flatMap((run) => run.unitIds.map((unitId) => [unitId, run.styleId] as const)));
22
- const muted = new Set(program.mutedUnitIds);
23
18
  const breaks = new Set(document.cueBreaks.map((cueBreak) => cueBreak.afterUnitId));
24
- const timed: Array<{ unit: CaptionDocument["units"][number]; styleId: string; timing: TimedCaptionUnit }> = [];
19
+ const timed: Array<{ unit: CaptionDocument["units"][number]; timing: TimedCaptionUnit }> = [];
25
20
  for (const unit of document.units) {
26
- if (muted.has(unit.id)) continue;
27
- const styleId = styleByUnit.get(unit.id);
28
- if (styleId === undefined) throw new CaptionTimingError("CAPTION_UNIT", `Caption unit ${unit.id} has no Style.`);
29
21
  const window = tokenFrameSpan(semantic, unit.sourceTokenIds);
30
- if (window === undefined) throw new CaptionTimingError("CAPTION_SPEECH_COVERAGE", `Caption unit ${unit.id} is absent from the SemanticTrack.`);
22
+ if (window === undefined) continue;
31
23
  if (window.endFrameExclusive < window.startFrame) {
32
24
  throw new CaptionTimingError("CAPTION_SPEECH_ORDER", `Caption unit ${unit.id} references speech Tokens in reverse order.`);
33
25
  }
34
26
  const startFrame = window.startFrame;
35
27
  const endFrameExclusive = Math.max(startFrame + 1, window.endFrameExclusive);
36
- timed.push({ unit, styleId, timing: { unitId: unit.id, startFrame, endFrameExclusive } });
28
+ timed.push({ unit, timing: { unitId: unit.id, startFrame, endFrameExclusive } });
37
29
  }
38
30
  const cues: TimedCaptionCue[] = [];
39
- let current: { styleId: string; units: TimedCaptionUnit[]; segmentId: string; turnId: string } | undefined;
31
+ let current: { units: TimedCaptionUnit[]; segmentId: string; turnId: string } | undefined;
40
32
  const flush = (): void => {
41
33
  if (current === undefined || current.units.length === 0) return;
42
34
  cues.push({
43
- id: `${program.id}:cue:${cues.length + 1}`,
44
- styleId: current.styleId,
35
+ id: `${document.id}:cue:${cues.length + 1}`,
45
36
  startFrame: current.units[0]!.startFrame,
46
37
  endFrameExclusive: current.units.at(-1)!.endFrameExclusive,
47
38
  units: current.units,
48
39
  });
49
40
  current = undefined;
50
41
  };
42
+ const documentOrder = new Map(document.units.map((unit, index) => [unit.id, index]));
51
43
  for (const [index, entry] of timed.entries()) {
52
44
  const previousDocumentUnit = index === 0 ? undefined : timed[index - 1]!.unit;
53
45
  const mustBreak = current !== undefined && (
54
- current.styleId !== entry.styleId
55
- || current.segmentId !== entry.unit.segmentId
46
+ current.segmentId !== entry.unit.segmentId
56
47
  || current.turnId !== entry.unit.turnId
57
- || (previousDocumentUnit !== undefined && breaks.has(previousDocumentUnit.id))
48
+ || (previousDocumentUnit !== undefined && (breaks.has(previousDocumentUnit.id)
49
+ || documentOrder.get(entry.unit.id)! !== documentOrder.get(previousDocumentUnit.id)! + 1))
58
50
  );
59
51
  if (mustBreak) flush();
60
52
  if (current === undefined) current = {
61
- styleId: entry.styleId,
62
53
  units: [],
63
54
  segmentId: entry.unit.segmentId,
64
55
  turnId: entry.unit.turnId,
@@ -68,7 +59,7 @@ export function temporalizeCaptionDocument(
68
59
  flush();
69
60
  const result: TimedCaptionProjection = {
70
61
  spaceId: space.id,
71
- narrativeId: semantic.narrativeId,
62
+ narrativeId: document.narrativeId,
72
63
  documentId: document.id,
73
64
  cues,
74
65
  };
@@ -76,32 +67,6 @@ export function temporalizeCaptionDocument(
76
67
  return result;
77
68
  }
78
69
 
79
- export function applyCaptionMute(
80
- projection: TimedCaptionProjection,
81
- program: CaptionProgram,
82
- document: CaptionDocument,
83
- ): TimedCaptionProjection {
84
- assertCaptionDocument(document);
85
- assertCaptionProgramForDocument(program, document);
86
- if (projection.documentId !== document.id || projection.narrativeId !== document.narrativeId) {
87
- throw new Error("Caption Mute received another CaptionDocument or Narrative");
88
- }
89
- const muted = new Set(program.mutedUnitIds);
90
- const cues = projection.cues.flatMap((cue) => {
91
- const units = cue.units.filter((unit) => !muted.has(unit.unitId));
92
- if (units.length === 0) return [];
93
- return [{ ...cue, units, startFrame: units[0]!.startFrame, endFrameExclusive: units.at(-1)!.endFrameExclusive }];
94
- });
95
- const result = {
96
- spaceId: projection.spaceId,
97
- narrativeId: projection.narrativeId,
98
- documentId: projection.documentId,
99
- cues,
100
- };
101
- assertTimedCaptionProjection(result);
102
- return result;
103
- }
104
-
105
70
  export function assertTimedCaptionProjection(projection: TimedCaptionProjection): void {
106
71
  if (projection.spaceId.length === 0 || projection.narrativeId.length === 0 || projection.documentId.length === 0) {
107
72
  throw new Error("TimedCaptionProjection provenance is invalid");
@@ -109,7 +74,7 @@ export function assertTimedCaptionProjection(projection: TimedCaptionProjection)
109
74
  const cueIds = new Set<string>();
110
75
  const unitIds = new Set<string>();
111
76
  for (const cue of projection.cues) {
112
- if (cue.id.length === 0 || cueIds.has(cue.id) || cue.styleId.length === 0 || cue.units.length === 0
77
+ if (cue.id.length === 0 || cueIds.has(cue.id) || cue.units.length === 0
113
78
  || !Number.isSafeInteger(cue.startFrame) || !Number.isSafeInteger(cue.endFrameExclusive)
114
79
  || cue.startFrame < 0 || cue.endFrameExclusive <= cue.startFrame) throw new Error("TimedCaptionProjection contains an invalid Cue");
115
80
  cueIds.add(cue.id);
@@ -2,50 +2,24 @@ import type { CanonicalValue } from "@hypit/protocol";
2
2
 
3
3
  export type CaptionStyleIntent = {
4
4
  readonly id: string;
5
+ /** null selects no rendering; later Uses can select a visible Style again. */
5
6
  readonly rendering: {
6
7
  readonly family: string;
7
8
  readonly parameters: CanonicalValue;
8
- };
9
+ } | null;
9
10
  };
10
11
 
11
- export type CaptionStyleApplication = {
12
- readonly id: string;
13
- readonly unitIds: readonly string[];
14
- readonly style: CaptionStyleIntent;
15
- };
16
-
17
- export type CaptionWordStyleApplication = {
18
- readonly id: string;
19
- readonly attribute: string;
20
- readonly wordIds: readonly string[];
21
- readonly style: CaptionStyleIntent;
22
- };
23
-
24
- export type CaptionMuteApplication = {
25
- readonly id: string;
26
- readonly unitIds: readonly string[];
27
- };
28
-
29
- export type CaptionProgramRun = {
30
- readonly id: string;
31
- readonly styleId: string;
32
- readonly unitIds: readonly string[];
33
- };
34
-
35
- export type CaptionProgramWordRun = {
36
- readonly id: string;
12
+ /** Ordered, resolved Uses owned by a Caption Track, not a separate author element. */
13
+ export type CaptionUse = {
14
+ readonly window: import("@hypit/temporal").TemporalWindow;
37
15
  readonly styleId: string;
38
- readonly wordIds: readonly string[];
16
+ readonly role?: string;
39
17
  };
40
-
41
18
  export type CaptionProgram = {
42
19
  readonly id: string;
43
20
  readonly documentId: string;
44
21
  readonly styles: readonly CaptionStyleIntent[];
45
- readonly runs: readonly CaptionProgramRun[];
46
- /** Optional local word styles resolved from Script-native word attributes. */
47
- readonly wordRuns: readonly CaptionProgramWordRun[];
48
- readonly mutedUnitIds: readonly string[];
22
+ readonly uses: readonly CaptionUse[];
49
23
  };
50
24
 
51
25
  export type TimedCaptionUnit = {
@@ -56,14 +30,13 @@ export type TimedCaptionUnit = {
56
30
 
57
31
  export type TimedCaptionCue = {
58
32
  readonly id: string;
59
- readonly styleId: string;
60
33
  readonly startFrame: number;
61
34
  readonly endFrameExclusive: number;
62
35
  readonly units: readonly TimedCaptionUnit[];
63
36
  };
64
37
 
65
38
  export type TimedCaptionProjection = {
66
- /** Semantic ProgramSpace from which every unit frame was measured. */
39
+ /** Semantic Timeline from which every unit frame was measured. */
67
40
  readonly spaceId: string;
68
41
  readonly narrativeId: string;
69
42
  readonly documentId: string;
@@ -0,0 +1,23 @@
1
+ type FrameSpan = { readonly startFrame: number; readonly endFrameExclusive: number };
2
+ import type { CaptionProgram } from "./types.js";
3
+
4
+ /** Later Uses replace this Cue's presentation inside their windows, including Hidden. */
5
+ export function captionUseVisibility(program: CaptionProgram, index: number, role: string | undefined, envelope: FrameSpan): FrameSpan[] {
6
+ const use = program.uses[index]!;
7
+ if (use.role !== undefined && use.role !== role) return [];
8
+ const startFrame = Math.max(envelope.startFrame, use.window.span.startFrame);
9
+ const endFrameExclusive = Math.min(envelope.endFrameExclusive, use.window.span.endFrameExclusive);
10
+ let visible = endFrameExclusive > startFrame ? [{ startFrame, endFrameExclusive }] : [];
11
+ for (const later of program.uses.slice(index + 1)) {
12
+ if (later.role !== undefined && later.role !== role) continue;
13
+ const cut = later.window.span;
14
+ visible = visible.flatMap(span => {
15
+ if (cut.startFrame >= span.endFrameExclusive || cut.endFrameExclusive <= span.startFrame) return [span];
16
+ return [
17
+ ...(cut.startFrame > span.startFrame ? [{ startFrame: span.startFrame, endFrameExclusive: cut.startFrame }] : []),
18
+ ...(cut.endFrameExclusive < span.endFrameExclusive ? [{ startFrame: cut.endFrameExclusive, endFrameExclusive: span.endFrameExclusive }] : []),
19
+ ];
20
+ });
21
+ }
22
+ return visible;
23
+ }
@@ -7,9 +7,11 @@ does not carry a private visual role.
7
7
 
8
8
  ```xml
9
9
  <caption-fine:Style id="primary" recipe={recipes.caption.primary} font={caption-font}/>
10
- <caption:Program id="captions" document={story.caption} narrative={story} default={primary}/>
10
+
11
11
  <caption-fine:Track id="captions-track" document={story.caption}
12
- semantic={speech.semantic} program={captions}/>
12
+ timeline={speech.timeline}>
13
+ <caption-fine:Use style={primary}/>
14
+ </caption-fine:Track>
13
15
  ```
14
16
 
15
17
  An optional Spatial Region Timeline replaces only the moving placement point. The timeline is authored
@@ -20,7 +22,9 @@ and a later Run can reuse the same media and alignment while changing placement:
20
22
  ```xml
21
23
  <space:RegionTimeline id="heads" within={vertical} recipe={tracking.heads.default}/>
22
24
  <caption-fine:Track id="captions-track" document={story.caption}
23
- semantic={speech.semantic} program={captions} regions={heads}/>
25
+ timeline={speech.timeline} regions={heads}>
26
+ <caption-fine:Use style={primary}/>
27
+ </caption-fine:Track>
24
28
  ```
25
29
 
26
30
  With `regions`, every Cue must carry one Script Role. When the Region Timeline contains a measured region for that
@@ -45,16 +49,17 @@ One SVS Recipe freezes three public dimensions:
45
49
 
46
50
  Caption first projects authored Script units onto semantic Word timing. Fine then produces an
47
51
  explicit visible Schedule and renders that Schedule. Lead and tail never change the semantic Word
48
- times used by Karaoke.
52
+ times used by Karaoke. Later Uses mask earlier presentation, including Hidden. The final visibility
53
+ is clipped to the winning Use Window while the original Cue envelope and animations are preserved.
49
54
 
50
55
  The Fine Schedule preserves the Caption projection's ProgramSpace, Narrative and document identities.
51
56
  The renderer rejects any mismatched Space or document. Studio may expose lead, tail and handoff as
52
57
  ordinary parameter edits, but Cue rectangles remain read-only semantic evidence.
53
58
 
54
- Script segments, turns, Style changes and `||` author Cue grouping. Fine rejects word-specific Style
55
- runs. A caption whose Cue contains structural roles or
59
+ Script segments, turns and `||` organize complete Cues. Timed Uses select presentation without
60
+ changing that grouping. Fine applies uniform rules to the words of a Cue. A caption whose Cue contains structural roles or
56
61
  relationships—such as an independently arranged oversized keyword and supporting phrase—can use
57
- a new project Caption family. Reuse the common [Caption document, Program and timing](../caption/README.md),
62
+ a new project Caption family. Reuse the common [Caption content, timed Uses and timing](../caption/README.md),
58
63
  and implement the new schedule and rendering behavior in that package. This is ordinary component
59
64
  authorship; different colors or fonts alone can remain Fine Style choices.
60
65
 
@@ -82,6 +87,13 @@ individual Han characters as Display Words; punctuation stays with its display w
82
87
  those units for timing and active Paint, while authored Cues remain complete reading phrases.
83
88
  Dual Text retains its complete alignment unit even when it displays or speaks several words.
84
89
 
90
+ `<组件化|>` authors the same unit as `<组件化|组件化>` without repeating the speech. Fine's `step`
91
+ karaoke, active underline and active box treat that unit together using its first-to-last speech
92
+ interval. Ordinary Chinese characters around it retain their own activation times. This is an
93
+ explicit authored group, not a renderer-selected segmentation, and does not introduce a new Cue.
94
+ The underlying character anchors remain available to other Timeline consumers. `wipe` and
95
+ `typewriter` still animate inside the complete unit over its interval when deliberately selected.
96
+
85
97
  `word-gap` applies between Latin words and at Chinese/Latin boundaries. Adjacent Han characters and
86
98
  full-width punctuation carry no extra word gap. `letter-spacing` controls glyph tracking. Exact
87
99
  font fallbacks supply the required glyphs; the layout does not select a font by language.
@@ -119,5 +131,5 @@ The Hypit Skill's Caption craft page owns grouping and visual direction.
119
131
  primary face or a `<caption-fine:Fallback font={...}/>` child, just like a bundled face. See
120
132
  [Media font assets](../media/README.md#font-files) and [the open catalog](../fonts-open/README.md).
121
133
 
122
- The [Fine Studio Companion](../caption-fine-studio/src/index.ts) reads the same schedule and per-Cue
123
- Style references. It presents the actual Cue timing and exposes supported Style edits in the Inspector.
134
+ The [Fine Studio Companion](../caption-fine-studio/src/index.ts) reads the same schedule and authored Use
135
+ Style references. It presents the actual Cue timing and exposes Use timing and supported Style edits in the Inspector.
@@ -19,10 +19,12 @@
19
19
  "@hypit/narrative": "workspace:*",
20
20
  "@hypit/program-space": "workspace:*",
21
21
  "@hypit/protocol": "workspace:*",
22
- "@hypit/semantic-track": "workspace:*",
22
+ "@hypit/timeline": "workspace:*",
23
23
  "@hypit/spatial": "workspace:*",
24
24
  "@hypit/svs": "workspace:*",
25
- "@hypit/markup": "workspace:*"
25
+ "@hypit/markup": "workspace:*",
26
+ "@hypit/temporal": "workspace:*",
27
+ "@hypit/temporal-markup": "workspace:*"
26
28
  },
27
29
  "devDependencies": {
28
30
  "@hypit/script": "workspace:*"
@@ -1,7 +1,7 @@
1
+ import type { Timeline } from "@hypit/timeline";
1
2
  import type { CaptionProgram, TimedCaptionProjection } from "@hypit/caption";
2
3
  import type { ComponentPackage } from "@hypit/component-kit";
3
4
  import type { CaptionDocument } from "@hypit/narrative";
4
- import type { ProgramSpace } from "@hypit/program-space";
5
5
  import type { StoredValue } from "@hypit/protocol";
6
6
  import { canonicalize } from "@hypit/protocol";
7
7
  import type { SpatialRegionTimeline } from "@hypit/spatial";
@@ -36,7 +36,7 @@ export const captionFineComponent = {
36
36
  inline<FineCaptionSchedule>(inputs.schedule?.value, "FineCaptionSchedule"),
37
37
  inline<CaptionProgram>(inputs.program?.value, "CaptionProgram"),
38
38
  inline<CaptionDocument>(inputs.document?.value, "CaptionDocument"),
39
- inline<ProgramSpace>(inputs.space?.value, "ProgramSpace"),
39
+ inline<Timeline>(inputs.timeline?.value, "Timeline"),
40
40
  )) } },
41
41
  needs: {},
42
42
  }),
@@ -48,7 +48,7 @@ export const captionFineComponent = {
48
48
  inline<FineCaptionSchedule>(inputs.schedule?.value, "FineCaptionSchedule"),
49
49
  inline<CaptionProgram>(inputs.program?.value, "CaptionProgram"),
50
50
  inline<CaptionDocument>(inputs.document?.value, "CaptionDocument"),
51
- inline<ProgramSpace>(inputs.space?.value, "ProgramSpace"),
51
+ inline<Timeline>(inputs.timeline?.value, "Timeline"),
52
52
  inline<SpatialRegionTimeline>(inputs.regions?.value, "SpatialRegionTimeline"),
53
53
  )) } },
54
54
  needs: {},