@hypit/hypit 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 (486) hide show
  1. package/README.md +5 -3
  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 +107 -16
  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 +6 -0
  30. package/examples/semantic-composition/chat.svml +6 -5
  31. package/examples/semantic-composition/packages/chat-scene/README.md +3 -3
  32. package/examples/semantic-composition/packages/chat-scene/src/activation.ts +18 -21
  33. package/examples/semantic-composition/packages/chat-scene/src/render.ts +4 -4
  34. package/examples/semantic-composition/packages/performance-styles/README.md +42 -0
  35. package/examples/semantic-composition/packages/performance-styles/package.json +25 -0
  36. package/examples/semantic-composition/packages/performance-styles/src/activation.ts +57 -0
  37. package/examples/semantic-composition/packages/performance-styles/src/render.ts +54 -0
  38. package/examples/semantic-composition/packages/performance-styles/src/studio.ts +28 -0
  39. package/examples/semantic-composition/packages/performance-styles/tsconfig.json +18 -0
  40. package/examples/semantic-composition/packages/responsive-explainer/README.md +16 -9
  41. package/examples/semantic-composition/packages/responsive-explainer/src/activation.ts +12 -12
  42. package/examples/semantic-composition/packages/responsive-explainer/src/render.ts +5 -5
  43. package/examples/semantic-composition/packages/sound-styles/README.md +36 -0
  44. package/examples/semantic-composition/packages/sound-styles/package.json +25 -0
  45. package/examples/semantic-composition/packages/sound-styles/src/activation.ts +53 -0
  46. package/examples/semantic-composition/packages/sound-styles/src/render.ts +14 -0
  47. package/examples/semantic-composition/packages/sound-styles/tsconfig.json +18 -0
  48. package/package.json +35 -15
  49. package/packages/audio-track/README.md +20 -13
  50. package/packages/audio-track/package.json +1 -1
  51. package/packages/audio-track/src/component.ts +4 -4
  52. package/packages/audio-track/src/fragment.ts +6 -5
  53. package/packages/audio-track/src/index.ts +1 -1
  54. package/packages/audio-track/src/manifest.ts +17 -16
  55. package/packages/audio-track/src/program.ts +21 -25
  56. package/packages/audio-track/src/surface.ts +19 -18
  57. package/packages/audio-track-studio/README.md +23 -0
  58. package/packages/audio-track-studio/src/index.ts +33 -19
  59. package/packages/author-kit/README.md +1 -1
  60. package/packages/background-removal/README.md +4 -7
  61. package/packages/browser-capture/package.json +1 -1
  62. package/packages/build-result/README.md +69 -0
  63. package/packages/build-result/package.json +2 -1
  64. package/packages/build-result/src/decode.ts +12 -8
  65. package/packages/build-result/src/execution-log.ts +17 -0
  66. package/packages/build-result/src/file-reference.ts +42 -0
  67. package/packages/build-result/src/index.ts +4 -0
  68. package/packages/build-result/src/replace-file-windows.ts +58 -0
  69. package/packages/build-result/src/replace-file.ts +11 -0
  70. package/packages/build-result/src/store.ts +58 -14
  71. package/packages/build-result/src/types.ts +41 -8
  72. package/packages/build-result/src/writer.ts +12 -1
  73. package/packages/build-result-fs/README.md +23 -1
  74. package/packages/build-result-s3/README.md +5 -0
  75. package/packages/build-result-s3/src/repository.ts +23 -5
  76. package/packages/caption/README.md +61 -73
  77. package/packages/caption/package.json +3 -2
  78. package/packages/caption/src/activation.ts +2 -2
  79. package/packages/caption/src/component.ts +20 -5
  80. package/packages/caption/src/display.ts +3 -18
  81. package/packages/caption/src/fragment.ts +3 -7
  82. package/packages/caption/src/index.ts +6 -5
  83. package/packages/caption/src/manifest.ts +29 -46
  84. package/packages/caption/src/style.ts +24 -135
  85. package/packages/caption/src/surface.ts +12 -92
  86. package/packages/caption/src/temporalize.ts +18 -53
  87. package/packages/caption/src/types.ts +8 -35
  88. package/packages/caption/src/visibility.ts +23 -0
  89. package/packages/caption-fine/README.md +31 -11
  90. package/packages/caption-fine/package.json +4 -2
  91. package/packages/caption-fine/src/component.ts +3 -3
  92. package/packages/caption-fine/src/fragment.ts +7 -19
  93. package/packages/caption-fine/src/index.ts +2 -0
  94. package/packages/caption-fine/src/manifest.ts +27 -18
  95. package/packages/caption-fine/src/recipe.ts +7 -0
  96. package/packages/caption-fine/src/render.ts +62 -49
  97. package/packages/caption-fine/src/schedule.ts +39 -35
  98. package/packages/caption-fine/src/style.ts +10 -9
  99. package/packages/caption-fine/src/surface.ts +62 -35
  100. package/packages/caption-fine/src/types.ts +2 -0
  101. package/packages/caption-fine-studio/README.md +24 -2
  102. package/packages/caption-fine-studio/package.json +10 -3
  103. package/packages/caption-fine-studio/src/activation.ts +3 -3
  104. package/packages/caption-fine-studio/src/index.ts +61 -40
  105. package/packages/cli/README.md +81 -3
  106. package/packages/cli/package.json +1 -0
  107. package/packages/cli/src/arguments.ts +39 -15
  108. package/packages/cli/src/build-planning.ts +9 -3
  109. package/packages/cli/src/command.ts +7 -1
  110. package/packages/cli/src/commands/environment.ts +66 -27
  111. package/packages/cli/src/commands/execution.ts +81 -26
  112. package/packages/cli/src/commands/results.ts +7 -11
  113. package/packages/cli/src/index.ts +2 -2
  114. package/packages/cli/src/machine-view.ts +15 -5
  115. package/packages/cli/src/main.ts +38 -42
  116. package/packages/cli/src/observation.ts +7 -1
  117. package/packages/cli/src/output.ts +92 -34
  118. package/packages/cli/src/result-export.ts +22 -13
  119. package/packages/cli/src/run-file.ts +19 -8
  120. package/packages/cli/src/view.ts +64 -18
  121. package/packages/comment-sticker/README.md +3 -3
  122. package/packages/comment-sticker/package.json +1 -1
  123. package/packages/comment-sticker/src/component.ts +4 -4
  124. package/packages/comment-sticker/src/fragment.ts +5 -4
  125. package/packages/comment-sticker/src/manifest.ts +7 -6
  126. package/packages/comment-sticker/src/program.ts +9 -9
  127. package/packages/comment-sticker/src/surface.ts +6 -7
  128. package/packages/comment-sticker-studio/src/index.ts +2 -1
  129. package/packages/compiler-node/src/compiler.ts +1 -0
  130. package/packages/composition/README.md +21 -0
  131. package/packages/composition/src/audio-presentation.ts +44 -0
  132. package/packages/composition/src/index.ts +3 -0
  133. package/packages/composition/src/schema.ts +8 -3
  134. package/packages/composition/src/track.ts +15 -1
  135. package/packages/credential-store-env/README.md +1 -1
  136. package/packages/deck-track/README.md +3 -3
  137. package/packages/deck-track/package.json +1 -1
  138. package/packages/deck-track/src/component.ts +5 -5
  139. package/packages/deck-track/src/fragment.ts +6 -5
  140. package/packages/deck-track/src/lower.ts +12 -12
  141. package/packages/deck-track/src/manifest.ts +8 -7
  142. package/packages/deck-track/src/program.ts +13 -16
  143. package/packages/deck-track/src/surface.ts +9 -10
  144. package/packages/driver-node/src/driver.ts +41 -3
  145. package/packages/elevenlabs-speech/README.md +27 -0
  146. package/packages/{provider-xiaomi-mimo → elevenlabs-speech}/package.json +5 -8
  147. package/packages/elevenlabs-speech/src/activation.ts +26 -0
  148. package/packages/elevenlabs-speech/src/fragment.ts +11 -0
  149. package/packages/elevenlabs-speech/src/index.ts +111 -0
  150. package/packages/elevenlabs-speech/src/surface.ts +167 -0
  151. package/packages/endpoint-kit/README.md +24 -0
  152. package/packages/endpoint-kit/src/index.ts +7 -1
  153. package/packages/estimate/README.md +56 -3
  154. package/packages/estimate/src/program.ts +7 -8
  155. package/packages/film/README.md +12 -7
  156. package/packages/film/package.json +1 -1
  157. package/packages/film/src/component.ts +4 -4
  158. package/packages/film/src/fragment.ts +6 -5
  159. package/packages/film/src/manifest.ts +11 -10
  160. package/packages/film/src/program.ts +5 -5
  161. package/packages/film/src/recipe.ts +2 -1
  162. package/packages/film/src/surface.ts +6 -6
  163. package/packages/film-studio/package.json +1 -1
  164. package/packages/film-studio/src/index.ts +2 -2
  165. package/packages/fishaudio-speech/README.md +33 -0
  166. package/packages/fishaudio-speech/package.json +21 -0
  167. package/packages/fishaudio-speech/src/activation.ts +32 -0
  168. package/packages/fishaudio-speech/src/fragment.ts +11 -0
  169. package/packages/fishaudio-speech/src/index.ts +156 -0
  170. package/packages/fishaudio-speech/src/surface.ts +192 -0
  171. package/packages/fonts-open/README.md +5 -0
  172. package/packages/fonts-open/package.json +5 -1
  173. package/packages/fonts-open/src/studio.ts +21 -0
  174. package/packages/generation/README.md +11 -1
  175. package/packages/generation/src/mapping.ts +28 -30
  176. package/packages/gpt-image/README.md +1 -2
  177. package/packages/grok-imagine/README.md +1 -2
  178. package/packages/hyperframes/README.md +7 -3
  179. package/packages/hyperframes/src/browser-program.ts +11 -2
  180. package/packages/hyperframes/src/document.ts +15 -2
  181. package/packages/interview-emoji-reveal/README.md +4 -4
  182. package/packages/interview-emoji-reveal/package.json +1 -1
  183. package/packages/interview-emoji-reveal/src/component.ts +4 -4
  184. package/packages/interview-emoji-reveal/src/fragment.ts +6 -5
  185. package/packages/interview-emoji-reveal/src/manifest.ts +9 -8
  186. package/packages/interview-emoji-reveal/src/program.ts +14 -14
  187. package/packages/interview-emoji-reveal/src/surface.ts +8 -9
  188. package/packages/media-execution/README.md +7 -3
  189. package/packages/media-execution/src/audio-presentation.ts +23 -0
  190. package/packages/media-execution/src/execute.ts +2 -0
  191. package/packages/media-pipeline/README.md +7 -3
  192. package/packages/media-pipeline/src/audio-plan.ts +4 -1
  193. package/packages/media-pipeline/src/component.ts +16 -2
  194. package/packages/media-pipeline/src/manifest.ts +3 -1
  195. package/packages/media-pipeline/src/types.ts +2 -1
  196. package/packages/media-track/README.md +14 -47
  197. package/packages/media-track/package.json +1 -1
  198. package/packages/media-track/preview/preview.svml +5 -5
  199. package/packages/media-track/src/author.ts +12 -6
  200. package/packages/media-track/src/component.ts +10 -16
  201. package/packages/media-track/src/fragment.ts +8 -7
  202. package/packages/media-track/src/index.ts +3 -1
  203. package/packages/media-track/src/lower.ts +7 -7
  204. package/packages/media-track/src/manifest.ts +16 -38
  205. package/packages/media-track/src/program.ts +62 -67
  206. package/packages/media-track/src/sampling.ts +6 -6
  207. package/packages/media-track/src/sequence.ts +8 -8
  208. package/packages/media-track/src/surface.ts +25 -43
  209. package/packages/media-track-studio/README.md +9 -0
  210. package/packages/media-track-studio/src/index.ts +23 -13
  211. package/packages/mimo-speech/README.md +1 -1
  212. package/packages/minimax-h3/README.md +1 -1
  213. package/packages/nano-banana/README.md +1 -1
  214. package/packages/narrative/README.md +23 -1
  215. package/packages/narrative/src/identity.ts +11 -0
  216. package/packages/narrative/src/index.ts +3 -0
  217. package/packages/narrative/src/schema.ts +28 -27
  218. package/packages/narrative/src/selection.ts +52 -0
  219. package/packages/narrative/src/types.ts +2 -0
  220. package/packages/package-loader-node/README.md +30 -0
  221. package/packages/package-loader-node/package.json +5 -2
  222. package/packages/package-loader-node/src/distribution-resolution.ts +10 -3
  223. package/packages/package-loader-node/src/index.ts +1 -0
  224. package/packages/package-loader-node/src/loader.ts +12 -15
  225. package/packages/package-loader-node/src/location.ts +27 -1
  226. package/packages/package-loader-node/src/module-scope.ts +183 -0
  227. package/packages/package-loader-node/src/types.ts +4 -0
  228. package/packages/performance/README.md +83 -0
  229. package/packages/performance/package.json +30 -0
  230. package/packages/performance/src/activation.ts +11 -0
  231. package/packages/performance/src/component.ts +46 -0
  232. package/packages/performance/src/index.ts +6 -0
  233. package/packages/performance/src/manifest.ts +53 -0
  234. package/packages/{media-track/src/performance.ts → performance/src/media.ts} +9 -10
  235. package/packages/performance/src/program.ts +51 -0
  236. package/packages/performance/src/style.ts +35 -0
  237. package/packages/performance/src/surface.ts +99 -0
  238. package/packages/performance-studio/README.md +25 -0
  239. package/packages/performance-studio/package.json +21 -0
  240. package/packages/performance-studio/src/activation.ts +6 -0
  241. package/packages/performance-studio/src/index.ts +84 -0
  242. package/packages/program-space/README.md +9 -18
  243. package/packages/program-space/src/activation.ts +1 -5
  244. package/packages/program-space/src/index.ts +2 -11
  245. package/packages/program-space/src/surface.ts +1 -20
  246. package/packages/project-context-node/README.md +20 -0
  247. package/packages/project-context-node/package.json +10 -0
  248. package/packages/project-context-node/src/index.ts +3 -0
  249. package/packages/{cli → project-context-node}/src/runtime-selection.ts +7 -2
  250. package/packages/provider-hyperframes-local/README.md +43 -15
  251. package/packages/provider-hyperframes-local/src/activation.ts +4 -3
  252. package/packages/provider-hyperframes-local/src/capture-process.ts +26 -4
  253. package/packages/provider-hyperframes-local/src/capture.ts +96 -26
  254. package/packages/provider-hyperframes-local/src/concurrency.ts +86 -0
  255. package/packages/provider-hyperframes-local/src/opaque-capture.ts +92 -0
  256. package/packages/provider-hyperframes-local/src/options.ts +2 -0
  257. package/packages/provider-hyperframes-local/src/program.ts +6 -3
  258. package/packages/provider-hyperframes-local/src/progress.ts +53 -0
  259. package/packages/provider-hyperframes-local/src/provider.ts +18 -5
  260. package/packages/provider-hyperframes-local/src/render.ts +48 -7
  261. package/packages/provider-hypihub/README.md +48 -17
  262. package/packages/provider-hypihub/package.json +2 -0
  263. package/packages/provider-hypihub/src/mapping.ts +31 -7
  264. package/packages/provider-hypihub/src/oauth.ts +6 -0
  265. package/packages/provider-hypihub/src/provider.ts +25 -13
  266. package/packages/provider-hypihub/src/routes.ts +1 -2
  267. package/packages/provider-hypihub/src/upload.ts +2 -0
  268. package/packages/provider-media-local/README.md +3 -4
  269. package/packages/provider-whisperx-local/README.md +57 -0
  270. package/packages/provider-whisperx-local/src/program.ts +1 -0
  271. package/packages/provider-whisperx-local/src/provider.ts +3 -0
  272. package/packages/ranking/README.md +8 -6
  273. package/packages/ranking/package.json +1 -1
  274. package/packages/ranking/src/component.ts +6 -6
  275. package/packages/ranking/src/fragment.ts +11 -7
  276. package/packages/ranking/src/manifest.ts +21 -14
  277. package/packages/ranking/src/render.ts +33 -35
  278. package/packages/ranking/src/schedule.ts +16 -19
  279. package/packages/ranking/src/surface.ts +12 -13
  280. package/packages/ranking-studio/README.md +29 -0
  281. package/packages/ranking-studio/package.json +8 -3
  282. package/packages/ranking-studio/src/index.ts +71 -12
  283. package/packages/render-hyperframes/README.md +7 -7
  284. package/packages/render-hyperframes/package.json +1 -1
  285. package/packages/render-hyperframes/src/component.ts +11 -1
  286. package/packages/render-hyperframes/src/fragment.ts +7 -4
  287. package/packages/render-hyperframes/src/manifest.ts +4 -4
  288. package/packages/render-hyperframes/src/surface.ts +6 -6
  289. package/packages/runtime/README.md +8 -1
  290. package/packages/runtime/src/catalog.ts +2 -0
  291. package/packages/runtime/src/execution.ts +15 -4
  292. package/packages/runtime/src/index.ts +2 -1
  293. package/packages/runtime/src/log.ts +51 -0
  294. package/packages/runtime/src/types.ts +5 -8
  295. package/packages/runtime-host-node/README.md +30 -0
  296. package/packages/runtime-host-node/package.json +1 -0
  297. package/packages/runtime-host-node/src/index.ts +25 -9
  298. package/packages/runtime-host-node/src/packages.ts +47 -50
  299. package/packages/runtime-kit/README.md +5 -0
  300. package/packages/runtime-kit/src/index.ts +3 -1
  301. package/packages/runtime-local/README.md +111 -4
  302. package/packages/runtime-local/src/config.ts +202 -56
  303. package/packages/runtime-local/src/control.ts +9 -1
  304. package/packages/runtime-local/src/executor.ts +66 -0
  305. package/packages/runtime-local/src/host.ts +37 -17
  306. package/packages/runtime-local/src/log.ts +48 -0
  307. package/packages/runtime-local/src/programs.ts +41 -25
  308. package/packages/runtime-local/src/result-writer.ts +2 -0
  309. package/packages/runtime-local/src/runtime.ts +10 -6
  310. package/packages/runtime-local/src/supervisor.ts +142 -0
  311. package/packages/runtime-local/src/types.ts +9 -2
  312. package/packages/runtime-local/src/worker-process.ts +7 -24
  313. package/packages/runtime-local/src/worker.ts +55 -83
  314. package/packages/screen-overlay/README.md +3 -3
  315. package/packages/screen-overlay/package.json +1 -1
  316. package/packages/screen-overlay/src/component.ts +3 -3
  317. package/packages/screen-overlay/src/fragment.ts +5 -4
  318. package/packages/screen-overlay/src/manifest.ts +7 -6
  319. package/packages/screen-overlay/src/program.ts +9 -9
  320. package/packages/screen-overlay/src/surface.ts +6 -7
  321. package/packages/script/README.md +37 -2
  322. package/packages/script/src/edit.ts +123 -73
  323. package/packages/script/src/lexical.ts +40 -6
  324. package/packages/script/src/manifest.ts +2 -2
  325. package/packages/script/src/narrative.ts +1 -0
  326. package/packages/script/src/parser.ts +36 -8
  327. package/packages/script/src/surface.ts +4 -3
  328. package/packages/script/src/types.ts +5 -1
  329. package/packages/script-studio/package.json +9 -3
  330. package/packages/script-studio/src/index.ts +2 -0
  331. package/packages/script-studio/src/projection.ts +105 -0
  332. package/packages/seedance/README.md +30 -1
  333. package/packages/seedance/src/index.ts +18 -7
  334. package/packages/seedance/src/surface.ts +17 -4
  335. package/packages/seedance-kits/README.md +10 -2
  336. package/packages/seedance-kits/kits/speaker-v1.svs +5 -5
  337. package/packages/seedream/README.md +1 -1
  338. package/packages/sound/README.md +81 -0
  339. package/packages/sound/package.json +25 -0
  340. package/packages/sound/src/activation.ts +11 -0
  341. package/packages/sound/src/component.ts +28 -0
  342. package/packages/sound/src/index.ts +5 -0
  343. package/packages/sound/src/manifest.ts +47 -0
  344. package/packages/sound/src/program.ts +84 -0
  345. package/packages/sound/src/style.ts +34 -0
  346. package/packages/sound/src/surface.ts +90 -0
  347. package/packages/sound-studio/README.md +22 -0
  348. package/packages/sound-studio/package.json +20 -0
  349. package/packages/sound-studio/src/activation.ts +6 -0
  350. package/packages/sound-studio/src/index.ts +74 -0
  351. package/packages/speech/README.md +2 -2
  352. package/packages/speech-alignment/src/align.ts +45 -21
  353. package/packages/speech-alignment/src/local.ts +8 -0
  354. package/packages/speech-alignment/src/locate.ts +1 -1
  355. package/packages/store-sqlite/README.md +7 -0
  356. package/packages/store-sqlite/src/store.ts +84 -83
  357. package/packages/studio/INSPECTOR.md +117 -0
  358. package/packages/studio/README.md +149 -14
  359. package/packages/studio/package.json +8 -7
  360. package/packages/studio/src/build-library.ts +99 -84
  361. package/packages/studio/src/companion-assembly.ts +1 -0
  362. package/packages/studio/src/domain.ts +1 -1
  363. package/packages/studio/src/fallback-companions.ts +3 -3
  364. package/packages/studio/src/feedback-server.ts +51 -0
  365. package/packages/studio/src/feedback-store.ts +66 -0
  366. package/packages/studio/src/feedback.ts +60 -0
  367. package/packages/studio/src/library-media.ts +19 -0
  368. package/packages/studio/src/parameter-values.ts +83 -1
  369. package/packages/studio/src/parameters.ts +132 -43
  370. package/packages/studio/src/preview/render.ts +5 -1
  371. package/packages/studio/src/preview/runtime-shim.ts +49 -3
  372. package/packages/studio/src/programme.ts +14 -30
  373. package/packages/studio/src/server.ts +66 -34
  374. package/packages/studio/src/shared.ts +24 -8
  375. package/packages/studio/src/snapshot.ts +21 -132
  376. package/packages/studio/src/studio-preflight.ts +3 -3
  377. package/packages/studio/src/studio-registry.ts +72 -6
  378. package/packages/studio/src/style.css +342 -190
  379. package/packages/studio/src/temporal-edit.ts +131 -0
  380. package/packages/studio/src/ui/artifact-name.ts +80 -0
  381. package/packages/studio/src/ui/artifact-preview.ts +99 -0
  382. package/packages/studio/src/ui/comments.ts +233 -0
  383. package/packages/studio/src/ui/icons.ts +10 -1
  384. package/packages/studio/src/ui/library.ts +373 -192
  385. package/packages/studio/src/ui/main.ts +291 -110
  386. package/packages/studio/src/ui/material-preview.ts +1 -1
  387. package/packages/studio/src/ui/overlay.ts +31 -26
  388. package/packages/studio/src/ui/scrub-preview.ts +108 -0
  389. package/packages/studio/src/ui/sidebar-panel.ts +31 -0
  390. package/packages/studio/src/ui/stage.ts +188 -9
  391. package/packages/studio/src/ui/timeline.ts +187 -281
  392. package/packages/studio/start.ts +19 -5
  393. package/packages/studio-adapter/README.md +151 -11
  394. package/packages/studio-adapter/src/index.ts +126 -14
  395. package/packages/temporal/README.md +6 -6
  396. package/packages/temporal/package.json +1 -1
  397. package/packages/temporal/src/component.ts +5 -6
  398. package/packages/temporal/src/index.ts +8 -6
  399. package/packages/temporal/src/location.ts +11 -11
  400. package/packages/temporal/src/projection.ts +19 -19
  401. package/packages/temporal/src/rational.ts +4 -4
  402. package/packages/temporal-markup/EDITING.md +183 -0
  403. package/packages/temporal-markup/README.md +31 -11
  404. package/packages/temporal-markup/package.json +1 -1
  405. package/packages/temporal-markup/src/index.ts +20 -25
  406. package/packages/temporal-markup/src/space.ts +10 -41
  407. package/packages/timeline/README.md +31 -0
  408. package/packages/{semantic-track → timeline}/package.json +1 -1
  409. package/packages/timeline/src/activation.ts +8 -0
  410. package/packages/timeline/src/component.ts +24 -0
  411. package/packages/timeline/src/identity.ts +60 -0
  412. package/packages/timeline/src/index.ts +6 -0
  413. package/packages/{semantic-track → timeline}/src/location.ts +20 -20
  414. package/packages/timeline/src/manifest.ts +39 -0
  415. package/packages/{semantic-track → timeline}/src/projection.ts +14 -14
  416. package/packages/timeline/src/types.ts +24 -0
  417. package/packages/timeline-author/README.md +68 -0
  418. package/packages/{speech-track → timeline-author}/package.json +6 -4
  419. package/packages/timeline-author/src/activation.ts +22 -0
  420. package/packages/{speech-track → timeline-author}/src/component.ts +15 -13
  421. package/packages/{speech-track → timeline-author}/src/fragment.ts +14 -23
  422. package/packages/timeline-author/src/index.ts +7 -0
  423. package/packages/timeline-author/src/manifest.ts +78 -0
  424. package/packages/timeline-author/src/program.ts +107 -0
  425. package/packages/timeline-author/src/surface.ts +46 -0
  426. package/packages/timeline-author/src/types.ts +6 -0
  427. package/packages/typography-track/README.md +4 -4
  428. package/packages/typography-track/package.json +1 -1
  429. package/packages/typography-track/src/component.ts +4 -4
  430. package/packages/typography-track/src/fragment.ts +4 -3
  431. package/packages/typography-track/src/manifest.ts +11 -9
  432. package/packages/typography-track/src/program.ts +15 -15
  433. package/packages/typography-track/src/surface.ts +17 -18
  434. package/packages/typography-track-studio/package.json +8 -3
  435. package/packages/typography-track-studio/src/index.ts +5 -1
  436. package/packages/video-cli/README.md +16 -4
  437. package/packages/video-cli/package.json +2 -1
  438. package/packages/video-cli/src/creation.ts +25 -9
  439. package/packages/video-cli/src/index.ts +1 -1
  440. package/packages/video-cli/src/studio-distribution.ts +2 -1
  441. package/packages/volcengine-matting/README.md +3 -3
  442. package/packages/whisperx/README.md +8 -1
  443. package/packages/workspace/src/index.ts +2 -0
  444. package/packages/workspace-fs-node/README.md +4 -1
  445. package/packages/workspace-fs-node/src/workspace.ts +3 -1
  446. package/services/whisperx/README.md +14 -0
  447. package/services/whisperx/pyproject.toml +2 -0
  448. package/services/whisperx/uv.lock +20 -20
  449. package/packages/provider-hyperframes-aws-lambda/README.md +0 -30
  450. package/packages/provider-hyperframes-aws-lambda/package.json +0 -30
  451. package/packages/provider-hyperframes-aws-lambda/src/activation.ts +0 -97
  452. package/packages/provider-hyperframes-aws-lambda/src/client.ts +0 -114
  453. package/packages/provider-hyperframes-aws-lambda/src/index.ts +0 -21
  454. package/packages/provider-hyperframes-aws-lambda/src/provider.ts +0 -522
  455. package/packages/provider-kie/README.md +0 -134
  456. package/packages/provider-kie/package.json +0 -43
  457. package/packages/provider-kie/src/activation.ts +0 -71
  458. package/packages/provider-kie/src/index.ts +0 -10
  459. package/packages/provider-kie/src/mapping.ts +0 -182
  460. package/packages/provider-kie/src/provider.ts +0 -657
  461. package/packages/provider-kie/src/routes.ts +0 -150
  462. package/packages/provider-xiaomi-mimo/README.md +0 -32
  463. package/packages/provider-xiaomi-mimo/src/activation.ts +0 -57
  464. package/packages/provider-xiaomi-mimo/src/index.ts +0 -5
  465. package/packages/provider-xiaomi-mimo/src/provider.ts +0 -214
  466. package/packages/runtime/src/environment.ts +0 -6
  467. package/packages/semantic-track/README.md +0 -21
  468. package/packages/semantic-track/src/activation.ts +0 -8
  469. package/packages/semantic-track/src/component.ts +0 -24
  470. package/packages/semantic-track/src/identity.ts +0 -58
  471. package/packages/semantic-track/src/index.ts +0 -6
  472. package/packages/semantic-track/src/manifest.ts +0 -38
  473. package/packages/semantic-track/src/types.ts +0 -26
  474. package/packages/speech-track/README.md +0 -51
  475. package/packages/speech-track/src/activation.ts +0 -19
  476. package/packages/speech-track/src/index.ts +0 -7
  477. package/packages/speech-track/src/manifest.ts +0 -73
  478. package/packages/speech-track/src/program.ts +0 -64
  479. package/packages/speech-track/src/surface.ts +0 -35
  480. package/packages/speech-track/src/types.ts +0 -6
  481. package/packages/speech-track-studio/README.md +0 -3
  482. package/packages/speech-track-studio/package.json +0 -14
  483. package/packages/speech-track-studio/src/activation.ts +0 -7
  484. package/packages/speech-track-studio/src/index.ts +0 -40
  485. /package/packages/{cli → project-context-node}/src/project-context.ts +0 -0
  486. /package/packages/{speech-track → timeline-author}/preview/Track.png +0 -0
@@ -5,6 +5,7 @@ import type {
5
5
  } from "@hypit/runtime-host-node";
6
6
  import { hypitHostStateRoot } from "@hypit/runtime-host-node";
7
7
  import { resolve } from "node:path";
8
+ import { superviseBuilds } from "./supervisor.js";
8
9
 
9
10
  import {
10
11
  createRuntimeControlFromConfig,
@@ -82,8 +83,8 @@ export async function openLocalRuntimeHost(
82
83
  },
83
84
  programs: {
84
85
  up: async (programOptions) => await bringManagedProgramsUp(profile, { ...programOptions, packageRoot, ...distribution }),
85
- down: async () => await takeManagedProgramsDown(profile, { packageRoot, ...distribution }),
86
- report: async () => await reportManagedPrograms(profile, { packageRoot, ...distribution }),
86
+ down: async (scope) => await takeManagedProgramsDown(profile, { ...scope, packageRoot, ...distribution }),
87
+ report: async (scope) => await reportManagedPrograms(profile, { ...scope, packageRoot, ...distribution }),
87
88
  },
88
89
  };
89
90
  };
@@ -102,7 +103,7 @@ export async function openLocalRuntimeHost(
102
103
  };
103
104
  },
104
105
  controller,
105
- createRuntime: async () => await createRuntimeFromConfig(profile, { packageRoot: basePackageRoot, ...distribution }),
106
+ createRuntime: async (scope) => await createRuntimeFromConfig(profile, { packageRoot: basePackageRoot, ...distribution, ...scope }),
106
107
  openControl: async (options) => await createRuntimeControlFromConfig(profile, {
107
108
  packageRoot: basePackageRoot,
108
109
  ...distribution,
@@ -121,16 +122,19 @@ export async function openLocalRuntimeHost(
121
122
  packageRoot: basePackageRoot,
122
123
  ...distribution,
123
124
  ...(options?.onProgress === undefined ? {} : { onProgress: options.onProgress }),
125
+ ...(options?.endpoints === undefined ? {} : { endpoints: options.endpoints }),
124
126
  }),
125
127
  preflight: async (options) => await preflightRuntimeConfig(profile, {
126
128
  packageRoot: basePackageRoot,
127
129
  ...distribution,
128
130
  ...(options?.capabilities === undefined ? {} : { capabilities: options.capabilities }),
131
+ ...(options?.endpoints === undefined ? {} : { endpoints: options.endpoints }),
129
132
  }),
130
133
  doctor: async (options) => await doctorRuntimeConfig(profile, {
131
134
  packageRoot: basePackageRoot,
132
135
  ...distribution,
133
136
  ...(options?.capabilities === undefined ? {} : { capabilities: options.capabilities }),
137
+ ...(options?.endpoints === undefined ? {} : { endpoints: options.endpoints }),
134
138
  }),
135
139
  providers: async (capabilities) => await describeRuntimeConfigProviders(profile, capabilities, {
136
140
  packageRoot: basePackageRoot,
@@ -140,34 +144,50 @@ export async function openLocalRuntimeHost(
140
144
  packageRoot: basePackageRoot,
141
145
  ...distribution,
142
146
  }),
143
- invoke: async (need, resources) => await invokeRuntimeConfigNeed(profile, need, resources, {
147
+ invoke: async (need, resources, observation) => await invokeRuntimeConfigNeed(profile, need, resources, {
144
148
  packageRoot: basePackageRoot,
145
149
  ...distribution,
150
+ ...observation,
146
151
  }),
147
152
  openTransientExecution: async () => await openTransientRuntimeConfigExecution(profile, {
148
153
  packageRoot: basePackageRoot,
149
154
  ...distribution,
150
155
  }),
151
- runWorker: async (readyFile, owner) => {
152
- let runtime: Awaited<ReturnType<typeof createRuntimeFromConfig>> | undefined;
156
+ runWorker: async (readyFile, owner, execution) => {
153
157
  const abort = new AbortController();
154
- const stop = (): void => abort.abort();
158
+ const stop = (): void => { abort.abort(); };
159
+ // A Build never survives loss of its supervisor by silently changing code owners.
160
+ const disconnected = (): never => process.exit(1);
161
+ const message = (value: unknown): void => {
162
+ if (typeof value === "object" && value !== null && "kind" in value && value.kind === "stop-execution") stop();
163
+ };
155
164
  process.once("SIGTERM", stop);
156
165
  process.once("SIGINT", stop);
166
+ if (execution !== undefined) {
167
+ process.once("disconnect", disconnected);
168
+ process.on("message", message);
169
+ }
157
170
  try {
158
- runtime = await createRuntimeFromConfig(profile, {
159
- packageRoot: basePackageRoot,
160
- ...distribution,
161
- });
162
- await runtime.work({
163
- idlePollMs: 250,
164
- signal: abort.signal,
165
- ready: async () => await markRuntimeProcessReady(readyFile, owner),
166
- });
171
+ if (execution !== undefined) {
172
+ const { executeBuilds } = await import("./executor.js");
173
+ await executeBuilds(execution.dataRoot, abort.signal);
174
+ } else {
175
+ const paths = await resolveRuntimeConfigPaths(profile, { packageRoot: basePackageRoot, ...distribution });
176
+ await superviseBuilds({
177
+ profile, dataRoot: paths.dataRoot, readyFile, owner,
178
+ launch: hostOptions.workerLaunch, signal: abort.signal,
179
+ ready: async () => await markRuntimeProcessReady(readyFile, owner),
180
+ });
181
+ }
182
+ } catch (error) {
183
+ if (execution !== undefined && process.connected) process.send?.({ kind: "execution-error", message: error instanceof Error ? error.message : String(error) });
184
+ throw error;
167
185
  } finally {
168
186
  process.removeListener("SIGTERM", stop);
169
187
  process.removeListener("SIGINT", stop);
170
- await runtime?.close();
188
+ process.removeListener("disconnect", disconnected);
189
+ process.removeListener("message", message);
190
+ if (execution !== undefined && process.connected) process.disconnect();
171
191
  }
172
192
  },
173
193
  };
@@ -0,0 +1,48 @@
1
+ import { createReadStream } from "node:fs";
2
+ import { appendFile, mkdir, stat } from "node:fs/promises";
3
+ import { join } from "node:path";
4
+ import { readExecutionLog } from "@hypit/runtime";
5
+ import type { ExecutionLogEvent, ExecutionLogRecord, ExecutionLogView } from "@hypit/runtime";
6
+
7
+ export type LocalExecutionLogs = {
8
+ record(build: string, command: string, event: ExecutionLogEvent): Promise<void>;
9
+ open(build: string): Promise<AsyncIterable<Uint8Array> | undefined>;
10
+ read(build: string, lines: number): Promise<ExecutionLogView | undefined>;
11
+ };
12
+
13
+ /** Append-only Build evidence. Queues coordinate writes, not execution or historical lookup. */
14
+ export function fileExecutionLogs(workDirectory: (build: string) => string): LocalExecutionLogs {
15
+ const pending = new Map<string, Promise<void>>();
16
+ const failures = new Map<string, unknown>();
17
+ const path = (build: string) => join(workDirectory(build), "execution.jsonl");
18
+ const open = async (build: string): Promise<AsyncIterable<Uint8Array> | undefined> => {
19
+ await pending.get(build);
20
+ if (failures.has(build)) throw new Error(`Build ${build} execution log could not be saved`, { cause: failures.get(build) });
21
+ try { await stat(path(build)); }
22
+ catch (error) { if ((error as NodeJS.ErrnoException).code === "ENOENT") return undefined; throw error; }
23
+ // Open only when the Repository consumes the stream, so a failed destination opens no source handle.
24
+ return (async function* () { yield* createReadStream(path(build)); })();
25
+ };
26
+ return {
27
+ async record(build, command, event) {
28
+ const record: ExecutionLogRecord = { ...event, format: "hypit.execution-log@1", time: Date.now(), command };
29
+ const write = (pending.get(build) ?? Promise.resolve()).then(async () => {
30
+ await mkdir(workDirectory(build), { recursive: true });
31
+ await appendFile(path(build), `${JSON.stringify(record)}\n`, "utf8");
32
+ }).catch((error) => { failures.set(build, error); });
33
+ pending.set(build, write);
34
+ await write;
35
+ if (pending.get(build) === write) pending.delete(build);
36
+ },
37
+ open,
38
+ async read(build, lines) {
39
+ const chunks = await open(build);
40
+ try { return chunks === undefined ? undefined : await readExecutionLog(chunks, lines); }
41
+ catch (error) {
42
+ // The Result may have finished and cleaned work between opening an active view and reading it.
43
+ if ((error as NodeJS.ErrnoException).code === "ENOENT") return undefined;
44
+ throw error;
45
+ }
46
+ },
47
+ };
48
+ }
@@ -36,6 +36,7 @@ export type ManagedProgramReport = {
36
36
  export type ManagedProgramProgress = {
37
37
  readonly id: string;
38
38
  readonly phase: "checking" | "installing" | "starting" | "waiting" | "ready";
39
+ readonly logPath?: string;
39
40
  };
40
41
 
41
42
  export type ManagedProgramOptions = LoadRuntimeConfigOptions & {
@@ -45,6 +46,7 @@ export type ManagedProgramOptions = LoadRuntimeConfigOptions & {
45
46
  readonly onProgress?: (event: ManagedProgramProgress) => void;
46
47
  /** When present, operate only programs backing at least one demanded capability. */
47
48
  readonly capabilities?: readonly CapabilityRef[];
49
+ readonly endpoints?: readonly string[];
48
50
  };
49
51
 
50
52
  function independentPrograms(programs: readonly { instance: string; program: ManagedProgram }[]) {
@@ -97,24 +99,31 @@ async function readPid(root: string, program: ManagedProgram): Promise<number |
97
99
  }
98
100
  }
99
101
 
100
- function run(root: string, command: ManagedProgramCommand): Promise<{ ok: boolean; detail: string }> {
101
- return new Promise((resolve) => {
102
- const child = spawn(command.command, [...command.args], {
103
- cwd: command.cwd ?? root,
104
- env: { ...process.env, ...command.env },
105
- shell: false,
106
- windowsHide: true,
107
- stdio: ["ignore", "pipe", "pipe"],
102
+ async function run(root: string, command: ManagedProgramCommand, logPath: string): Promise<{ ok: boolean; detail: string }> {
103
+ const log = await open(logPath, "a+");
104
+ try {
105
+ const offset = (await log.stat()).size;
106
+ const exit = await new Promise<{ code: number | null; error?: string }>((resolve) => {
107
+ const child = spawn(command.command, [...command.args], {
108
+ cwd: command.cwd ?? root,
109
+ env: { ...process.env, ...command.env },
110
+ shell: false,
111
+ windowsHide: true,
112
+ stdio: ["ignore", log.fd, log.fd],
113
+ });
114
+ child.on("error", (error) => resolve({ code: null, error: error.message }));
115
+ child.on("close", (code) => resolve({ code }));
108
116
  });
109
- let output = "";
110
- child.stdout.on("data", (chunk: Buffer) => { output += chunk.toString(); });
111
- child.stderr.on("data", (chunk: Buffer) => { output += chunk.toString(); });
112
- child.on("error", (error) => resolve({ ok: false, detail: error.message }));
113
- child.on("close", (code) => resolve({
114
- ok: code === 0,
115
- detail: code === 0 ? "" : (output.trim().split("\n").at(-1) ?? `exited ${code}`),
116
- }));
117
- });
117
+ if (exit.code === 0) return { ok: true, detail: "" };
118
+ const end = (await log.stat()).size;
119
+ const start = Math.max(offset, end - 8192);
120
+ const tail = Buffer.alloc(end - start);
121
+ const { bytesRead } = await log.read(tail, 0, tail.length, start);
122
+ const line = tail.subarray(0, bytesRead).toString().trim().split(/\r?\n/u).at(-1);
123
+ return { ok: false, detail: exit.error ?? (line || `exited ${exit.code}`) };
124
+ } finally {
125
+ await log.close();
126
+ }
118
127
  }
119
128
 
120
129
  /**
@@ -254,20 +263,23 @@ async function bringUp(
254
263
  }
255
264
 
256
265
  let installed = false;
266
+ const logPath = join(directory(root, program), "program.log");
267
+ const installLogPath = join(directory(root, program), "install.log");
257
268
  if (program.installation !== undefined) {
258
269
  const installation = await program.installation.probe();
259
- if (installation.state !== "ready") {
260
- onProgress?.({ id: program.id, phase: "installing" });
270
+ if (installation.state !== "ready" || program.installation.prepareBeforeStart === true) {
261
271
  await mkdir(directory(root, program), { recursive: true });
272
+ await rotateLog(installLogPath);
273
+ onProgress?.({ id: program.id, phase: "installing", logPath: installLogPath });
262
274
  for (const command of program.installation.commands) {
263
- const result = await run(root, command);
275
+ const result = await run(root, command, installLogPath);
264
276
  if (!result.ok) {
265
- return { ...base, action: "unchanged", state: initial, detail: `${command.command} failed: ${result.detail}` };
277
+ return { ...base, action: "unchanged", state: initial, logPath: installLogPath, detail: `${command.command} failed: ${result.detail}` };
266
278
  }
267
279
  }
268
280
  const after = await program.installation.probe();
269
281
  if (after.state !== "ready") {
270
- return { ...base, action: "unchanged", state: initial, detail: `installation is ${after.state}: ${after.detail}` };
282
+ return { ...base, action: "unchanged", state: initial, logPath: installLogPath, detail: `installation is ${after.state}: ${after.detail}` };
271
283
  }
272
284
  installed = true;
273
285
  }
@@ -276,12 +288,16 @@ async function bringUp(
276
288
  // Nothing to keep running: installation was the whole job.
277
289
  const state = await program.probe();
278
290
  if (state.state === "ready") onProgress?.({ id: program.id, phase: "ready" });
279
- return { ...base, action: state.state === "ready" && installed ? "installed" : "unchanged", state };
291
+ return {
292
+ ...base,
293
+ action: state.state === "ready" && installed ? "installed" : "unchanged",
294
+ state,
295
+ ...(installed ? { logPath: installLogPath } : {}),
296
+ };
280
297
  }
281
298
 
282
- onProgress?.({ id: program.id, phase: "starting" });
299
+ onProgress?.({ id: program.id, phase: "starting", logPath });
283
300
  await mkdir(directory(root, program), { recursive: true });
284
- const logPath = join(directory(root, program), "program.log");
285
301
  await rotateLog(logPath);
286
302
  const log = await open(logPath, "a");
287
303
  try {
@@ -150,7 +150,9 @@ export function createLocalResultWriter(
150
150
  ...(operation.failure === undefined ? {} : { failure: operation.failure }),
151
151
  };
152
152
  });
153
+ const executionLog = await options.executionLogs?.open(execution.build);
153
154
  await reopened.writer.finish({
155
+ ...(executionLog === undefined ? {} : { executionLog }),
154
156
  operations,
155
157
  outcome: execution.decision.outcome,
156
158
  ...(execution.decision.reason === undefined ? {} : { failure: execution.decision.reason }),
@@ -153,6 +153,7 @@ export async function createLocalRuntime(
153
153
  validators,
154
154
  });
155
155
  const resultWriter = createLocalResultWriter({
156
+ ...(options.executionLogs === undefined ? {} : { executionLogs: options.executionLogs }),
156
157
  buildStore: options.buildStore,
157
158
  operationStore: options.operationStore,
158
159
  commandExecutionStore: options.commandExecutionStore,
@@ -165,6 +166,8 @@ export async function createLocalRuntime(
165
166
  openBuildResultRepository,
166
167
  });
167
168
  const worker = createDurableLocalWorker(driver, {
169
+ ...(options.executionBuild === undefined ? {} : { executionBuild: options.executionBuild }),
170
+ ...(options.executionLogs === undefined ? {} : { executionLogs: options.executionLogs }),
168
171
  stores: {
169
172
  builds: options.buildStore,
170
173
  operations: options.operationStore,
@@ -174,7 +177,6 @@ export async function createLocalRuntime(
174
177
  resourceStore: options.resourceStore,
175
178
  ...(options.resourceStoreForBuild === undefined ? {} : { resourceStoreForBuild: options.resourceStoreForBuild }),
176
179
  openBuildResultRepository,
177
- ...(options.assertEnvironment === undefined ? {} : { assertEnvironment: options.assertEnvironment }),
178
180
  installComponentPackages,
179
181
  resultWriter,
180
182
  });
@@ -183,7 +185,9 @@ export async function createLocalRuntime(
183
185
  endpoints: options.endpoints ?? [],
184
186
  });
185
187
  const control = createLocalRuntimeControl({
188
+ ...(options.executionLogs === undefined ? {} : { executionLogs: options.executionLogs }),
186
189
  buildStore: options.buildStore,
190
+ commandExecutionStore: options.commandExecutionStore,
187
191
  buildCatalog,
188
192
  operationStore: options.operationStore,
189
193
  executionStore: options.executionStore,
@@ -256,6 +260,7 @@ export async function createLocalRuntime(
256
260
  const resultRequest = request.result;
257
261
  const executionRequest = {
258
262
  build: request.id,
263
+ ...(options.executionContext === undefined ? {} : { context: options.executionContext }),
259
264
  componentPackages: [...new Set(request.componentPackages ?? [])].sort(),
260
265
  result: resultRequest.repository,
261
266
  } as const;
@@ -268,6 +273,7 @@ export async function createLocalRuntime(
268
273
  try {
269
274
  const publishedOutputs = request.catalog.publishedOutputs.map((published) => ({
270
275
  name: published.name,
276
+ ...(published.displayName === undefined ? {} : { displayName: published.displayName }),
271
277
  output: published.ref.id,
272
278
  }));
273
279
  const names = new Map<string, string>();
@@ -291,6 +297,7 @@ export async function createLocalRuntime(
291
297
  targets,
292
298
  publishedOutputs,
293
299
  ...(resultRequest.forwards === undefined ? {} : { forwards: resultRequest.forwards }),
300
+ ...(resultRequest.resourceReferences === undefined ? {} : { resourceReferences: resultRequest.resourceReferences }),
294
301
  });
295
302
  } finally {
296
303
  await opened.close?.();
@@ -329,11 +336,8 @@ export async function createLocalRuntime(
329
336
  ...credentialControl,
330
337
  ...resultWriter,
331
338
  build: runBuild,
332
- async workOnce() {
333
- return await worker.runOnce();
334
- },
335
- async work(workOptions) {
336
- await worker.run(workOptions);
339
+ async workOnce(workOptions) {
340
+ return await worker.runOnce(workOptions);
337
341
  },
338
342
  close() {
339
343
  return options.close?.();
@@ -0,0 +1,142 @@
1
+ import { spawn, type ChildProcess } from "node:child_process";
2
+ import { setTimeout as pause } from "node:timers/promises";
3
+ import { SqliteRuntimeState } from "@hypit/store-sqlite";
4
+ import type { RuntimeWorkerLaunch } from "./worker-process.js";
5
+ import { createRuntimeResultWriter, localExecutionContext, readRuntimeWorkerOptions, statePath } from "./config.js";
6
+
7
+ type Carrier = { readonly child: ChildProcess; readonly builds: Set<string>; readonly ready: Promise<void>;
8
+ done: Promise<void>; exited: boolean; stopping: boolean; completed: number; rssBytes: number };
9
+
10
+ /** Owns execution-carrier lifetimes, not project implementations. */
11
+ export async function superviseBuilds(options: {
12
+ readonly profile: string;
13
+ readonly dataRoot: string;
14
+ readonly readyFile: string;
15
+ readonly owner: string;
16
+ readonly launch: RuntimeWorkerLaunch;
17
+ readonly signal: AbortSignal;
18
+ readonly ready: () => Promise<void>;
19
+ }): Promise<void> {
20
+ const { executionMemoryMb } = await readRuntimeWorkerOptions(options.profile);
21
+ const memoryBudget = executionMemoryMb * 1024 * 1024;
22
+ const state = new SqliteRuntimeState(statePath(options.dataRoot));
23
+ const carriers = new Set<Carrier>();
24
+ let accepting: Carrier | undefined;
25
+ const considerRetirement = (carrier: Carrier): void => {
26
+ // Retire accumulated completed work. Live work alone is not a reason to multiply
27
+ // processes, and a cold process above the budget must still be able to accept work.
28
+ if (accepting === carrier && carrier.completed > 0 && carrier.rssBytes >= memoryBudget) {
29
+ accepting = undefined;
30
+ process.stderr.write(`Executor ${carrier.child.pid}: draining at ${Math.ceil(carrier.rssBytes / 1024 / 1024)} MiB; active Builds continue in place\n`);
31
+ }
32
+ };
33
+ const finishInterrupted = async (build: string, reason: string): Promise<void> => {
34
+ const current = await state.execution.read(build);
35
+ if (current === undefined) return;
36
+ const decided = await state.execution.interrupt(build, reason);
37
+ try {
38
+ const writer = createRuntimeResultWriter(options.dataRoot, localExecutionContext(current.context));
39
+ try { await writer.completeResult(decided); }
40
+ finally { await writer.close(); }
41
+ } catch (error) {
42
+ await state.execution.setAttention(build, { step: "result", error: error instanceof Error ? error.message : String(error) });
43
+ }
44
+ };
45
+ const launch = (): Carrier => {
46
+ const child = spawn(options.launch.command, [
47
+ ...options.launch.args, "_worker", options.profile,
48
+ "--ready-file", options.readyFile, "--worker-owner", options.owner,
49
+ "--execution-root", options.dataRoot,
50
+ ], {
51
+ stdio: ["ignore", "inherit", "inherit", "ipc"], windowsHide: true,
52
+ // Node's CommonJS evaluation callback needs this for scoped dynamic import().
53
+ env: { ...process.env, NODE_OPTIONS: [process.env.NODE_OPTIONS, "--experimental-vm-modules"].filter(Boolean).join(" ") },
54
+ });
55
+ let detail: string | undefined;
56
+ let ready!: () => void;
57
+ let rejectReady!: (error: Error) => void;
58
+ let reports = Promise.resolve();
59
+ const carrier: Carrier = { child, builds: new Set(), ready: new Promise((resolve, reject) => { ready = resolve; rejectReady = reject; }),
60
+ done: Promise.resolve(), exited: false, stopping: false, completed: 0, rssBytes: 0 };
61
+ child.on("message", (message: unknown) => {
62
+ if (typeof message !== "object" || message === null || !("kind" in message)) return;
63
+ if (message.kind === "executor-ready") ready();
64
+ if ("rssBytes" in message && typeof message.rssBytes === "number" && Number.isFinite(message.rssBytes)) {
65
+ carrier.rssBytes = message.rssBytes;
66
+ considerRetirement(carrier);
67
+ }
68
+ if (message.kind === "execution-error" && "message" in message && typeof message.message === "string") detail = message.message;
69
+ if (message.kind === "build-finished" && "build" in message && typeof message.build === "string") {
70
+ const build = message.build;
71
+ reports = reports.then(async () => {
72
+ if (!carrier.builds.has(build)) throw new Error(`Unassigned Build ${build} reported completion`);
73
+ if ("error" in message && typeof message.error === "string") await finishInterrupted(build, message.error);
74
+ carrier.builds.delete(build);
75
+ carrier.completed++;
76
+ considerRetirement(carrier);
77
+ });
78
+ void reports.catch((error) => { detail = String(error); child.kill(); });
79
+ }
80
+ });
81
+ const exited = new Promise<void>((resolve) => {
82
+ child.once("error", (error) => { detail = error.message; rejectReady(error); });
83
+ child.once("close", (code, signal) => {
84
+ carrier.exited = true;
85
+ detail ??= `Build executor exited (${signal ?? code ?? "unknown"}); create a new Build to continue`;
86
+ rejectReady(new Error(detail)); resolve();
87
+ });
88
+ });
89
+ carrier.done = exited.then(async () => {
90
+ await reports.catch(() => undefined);
91
+ for (const build of carrier.builds) await finishInterrupted(build, detail!);
92
+ }).finally(() => {
93
+ carriers.delete(carrier);
94
+ if (accepting === carrier) accepting = undefined;
95
+ });
96
+ void carrier.done.catch((error) => { process.stderr.write(`Executor: ${String(error)}\n`); });
97
+ carriers.add(carrier);
98
+ return carrier;
99
+ };
100
+ try {
101
+ await state.execution.reclaimResultWrites();
102
+ for (const execution of await state.execution.list()) {
103
+ if (execution.decision === undefined && execution.startedAt !== undefined) {
104
+ await finishInterrupted(execution.build, "Build executor was lost; its code context is gone. Create a new Build to continue");
105
+ } else if (execution.decision !== undefined && execution.attention === undefined) {
106
+ await state.execution.setAttention(execution.build, { step: "result", error: "Result writing was interrupted; run hypit result finish <build-id>" });
107
+ }
108
+ }
109
+ await state.execution.reclaimActionCapacity();
110
+ await options.ready();
111
+ while (!options.signal.aborted) {
112
+ for (const carrier of carriers) {
113
+ if (carrier.builds.size !== 0 || carrier.stopping || carrier.exited) continue;
114
+ carrier.stopping = true;
115
+ if (carrier.child.connected) carrier.child.send({ kind: "stop-execution" }, () => undefined);
116
+ if (accepting === carrier) accepting = undefined;
117
+ }
118
+ for (const build of await state.execution.listUnstarted()) {
119
+ if (options.signal.aborted) break;
120
+ accepting ??= launch();
121
+ const carrier = accepting;
122
+ await carrier.ready;
123
+ if (carrier.exited) break;
124
+ if (accepting !== carrier) continue;
125
+ await state.execution.start(build);
126
+ carrier.builds.add(build);
127
+ try {
128
+ await new Promise<void>((resolve, reject) => carrier.child.send({ kind: "start-build", build }, (error) => error ? reject(error) : resolve()));
129
+ } catch (error) {
130
+ await finishInterrupted(build, `Build dispatch failed: ${String(error)}; create a new Build to continue`);
131
+ carrier.builds.delete(build);
132
+ if (accepting === carrier) accepting = undefined;
133
+ }
134
+ }
135
+ await pause(100, undefined, { signal: options.signal }).catch((error) => { if (!options.signal.aborted) throw error; });
136
+ }
137
+ } finally {
138
+ for (const { child } of carriers) if (child.connected) child.send({ kind: "stop-execution" }, () => undefined);
139
+ await Promise.allSettled([...carriers].map(({ done }) => done));
140
+ state.close();
141
+ }
142
+ }
@@ -21,13 +21,16 @@ import type {
21
21
  } from "@hypit/runtime-host-node";
22
22
 
23
23
  export type CreateLocalRuntimeOptions = {
24
+ /** Already assigned by the local coordinator. Embeddings omit this and start fresh work. */
25
+ readonly executionBuild?: string;
26
+ readonly executionContext?: import("@hypit/protocol").CanonicalValue;
27
+ readonly executionLogs?: import("./log.js").LocalExecutionLogs;
24
28
  readonly buildStore: BuildStore;
25
29
  /** Host presentation metadata only; never part of Core state. */
26
30
  readonly buildCatalog: BuildCatalog;
27
31
  readonly operationStore: OperationStore;
28
32
  /** Durable receipt boundary: one immediate Command is never invoked twice for one Build. */
29
33
  readonly commandExecutionStore: import("@hypit/runtime").CommandExecutionStore;
30
- readonly assertEnvironment?: () => Awaitable<void>;
31
34
  readonly executionStore: import("@hypit/runtime").BuildExecutionStore;
32
35
  readonly removeActiveBuild: (build: string) => Awaitable<BuildCompletion>;
33
36
  /** Atomic submission boundary: external preparation is never a claimable partial Build. */
@@ -49,7 +52,9 @@ export type CreateLocalRuntimeOptions = {
49
52
  };
50
53
 
51
54
  export type CreateLocalRuntimeControlOptions = {
55
+ readonly executionLogs?: import("./log.js").LocalExecutionLogs;
52
56
  readonly buildStore: BuildStore;
57
+ readonly commandExecutionStore: import("@hypit/runtime").CommandExecutionStore;
53
58
  readonly buildCatalog?: BuildCatalog;
54
59
  readonly operationStore: OperationStore;
55
60
  readonly executionStore: BuildExecutionStore;
@@ -59,6 +64,7 @@ export type CreateLocalRuntimeControlOptions = {
59
64
  };
60
65
 
61
66
  export type CreateLocalResultWriterOptions = {
67
+ readonly executionLogs?: import("./log.js").LocalExecutionLogs;
62
68
  readonly buildStore: BuildStore;
63
69
  readonly operationStore: OperationStore;
64
70
  readonly commandExecutionStore: import("@hypit/runtime").CommandExecutionStore;
@@ -83,7 +89,8 @@ export type LocalBuildOptions = Parameters<RuntimeHostExecution["build"]>[1];
83
89
  export type LocalBuildSubmission = RuntimeHostBuildSubmission;
84
90
 
85
91
  export type LocalRuntime = RuntimeHostExecution & {
86
- workOnce(): Promise<BuildExecutionSnapshot | BuildCompletion | undefined>;
92
+ /** Advance owned or unstarted work only. Process lifecycle belongs to the Runtime Host. */
93
+ workOnce(options?: { readonly build?: string; readonly hydrated?: () => void }): Promise<BuildExecutionSnapshot | BuildCompletion | undefined>;
87
94
  };
88
95
 
89
96
  /** Active execution control that never opens the selected ResourceStore. */