@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,3 +1,4 @@
1
+ import { fileExecutionLogs } from "./log.js";
1
2
  import { readFile, rm, stat } from "node:fs/promises";
2
3
  import { dirname, relative, resolve, sep } from "node:path";
3
4
 
@@ -56,6 +57,7 @@ import type {
56
57
  RuntimeHostCapabilityProvider,
57
58
  RuntimeHostProviderQuery,
58
59
  RuntimeHostTransientExecution,
60
+ RuntimeInvocationObservation,
59
61
  } from "@hypit/runtime-host-node";
60
62
  import { SqliteRuntimeState } from "@hypit/store-sqlite";
61
63
 
@@ -82,6 +84,8 @@ export type LocalRuntimeAdapterSelection = {
82
84
  export type LocalRuntimeProfile = {
83
85
  readonly format: "hypit.runtime-local@1";
84
86
  readonly dataRoot: string;
87
+ /** Coordinator policy, independent of any Build's selected Endpoints. */
88
+ readonly worker?: { readonly executionMemoryMb: number };
85
89
  readonly credentials: readonly LocalRuntimeAdapterSelection[];
86
90
  readonly endpoints: readonly LocalRuntimeAdapterSelection[];
87
91
  /**
@@ -106,6 +110,9 @@ export type ProjectBuildResultDoctorResult = {
106
110
  export type LoadRuntimeConfigOptions = {
107
111
  readonly registry?: RuntimeAdapterRegistry;
108
112
  readonly resultRegistry?: BuildResultRepositoryRegistry;
113
+ /** Execution-owned module bindings; omitted for ordinary short-lived CLI calls. */
114
+ readonly importModule?: (url: string) => Promise<unknown>;
115
+ readonly endpoints?: readonly string[];
109
116
  readonly packageRoot?: string;
110
117
  readonly distributionPackageRoot?: string;
111
118
  /** Persistent machine/user state. Defaults to the platform Hypit state root. */
@@ -119,9 +126,35 @@ export type RuntimeConfigDoctorResult = {
119
126
 
120
127
  type RuntimeInspectionOptions = LoadRuntimeConfigOptions & {
121
128
  readonly capabilities?: readonly CapabilityRef[];
129
+ readonly endpoints?: readonly string[];
122
130
  readonly active: boolean;
123
131
  };
124
132
 
133
+ /** Explicit deployment scope. Bindings narrow discovery before unused packages are loaded. */
134
+ function scopedProfile(document: LocalRuntimeProfile, scope: {
135
+ readonly endpoints?: readonly string[];
136
+ readonly capabilities?: readonly CapabilityRef[];
137
+ }): LocalRuntimeProfile {
138
+ const bound = scope.capabilities?.map((capability) => document.bindings[capabilityKey(capability)]);
139
+ const names = scope.endpoints ?? (bound?.every((name) => name !== undefined) ? bound as string[] : undefined);
140
+ if (names === undefined) return document;
141
+ for (const name of names) {
142
+ if (!document.endpoints.some((item) => item.instance === name)) throw new Error(`Runtime Profile has no Endpoint ${name}`);
143
+ }
144
+ const selected = new Set(names);
145
+ return { ...document,
146
+ endpoints: document.endpoints.filter((item) => selected.has(item.instance)),
147
+ bindings: Object.fromEntries(Object.entries(document.bindings).filter(([, name]) => selected.has(name))),
148
+ };
149
+ }
150
+
151
+ function requestsCapability(document: LocalRuntimeProfile, instance: string, capability: CapabilityRef,
152
+ requested: ReadonlySet<string> | undefined): boolean {
153
+ const key = capabilityKey(capability);
154
+ return requested === undefined || requested.has(key)
155
+ && (document.bindings[key] === undefined || document.bindings[key] === instance);
156
+ }
157
+
125
158
  export type ResolvedRuntimeConfigPaths = {
126
159
  readonly packageRoot: string;
127
160
  readonly dataRoot: string;
@@ -194,7 +227,7 @@ function bindings(value: unknown, endpoints: readonly LocalRuntimeAdapterSelecti
194
227
 
195
228
  export function parseLocalRuntimeProfile(value: unknown): LocalRuntimeProfile {
196
229
  const item = object(value, "$runtime");
197
- exactKeys(item, ["format", "dataRoot", "credentials", "endpoints", "bindings"], "$runtime");
230
+ exactKeys(item, ["format", "dataRoot", "worker", "credentials", "endpoints", "bindings"], "$runtime");
198
231
  if (item.format !== "hypit.runtime-local@1") {
199
232
  throw new Error("$runtime.format must be hypit.runtime-local@1");
200
233
  }
@@ -202,15 +235,31 @@ export function parseLocalRuntimeProfile(value: unknown): LocalRuntimeProfile {
202
235
  const endpoints = entries(item.endpoints, "$runtime.endpoints", true);
203
236
  const ids = [...credentials, ...endpoints].map((value) => value.instance);
204
237
  if (new Set(ids).size !== ids.length) throw new Error("$runtime repeats a Runtime instance id");
238
+ let worker: LocalRuntimeProfile["worker"];
239
+ if (item.worker !== undefined) {
240
+ const settings = object(item.worker, "$runtime.worker");
241
+ exactKeys(settings, ["executionMemoryMb"], "$runtime.worker");
242
+ const budget = settings.executionMemoryMb;
243
+ if (typeof budget !== "number" || !Number.isSafeInteger(budget) || budget <= 0) {
244
+ throw new Error("$runtime.worker.executionMemoryMb must be a positive integer in MiB");
245
+ }
246
+ worker = { executionMemoryMb: budget };
247
+ }
205
248
  return {
206
249
  format: "hypit.runtime-local@1",
207
250
  dataRoot: requiredString(item.dataRoot, "$runtime.dataRoot"),
251
+ ...(worker === undefined ? {} : { worker }),
208
252
  credentials,
209
253
  endpoints,
210
254
  bindings: bindings(item.bindings, endpoints),
211
255
  };
212
256
  }
213
257
 
258
+ /** Read only process policy; starting a coordinator does not load selected project packages. */
259
+ export async function readRuntimeWorkerOptions(path: string): Promise<{ readonly executionMemoryMb: number }> {
260
+ return (await openRuntimeConfig(path)).document.worker ?? { executionMemoryMb: 1024 };
261
+ }
262
+
214
263
  async function openRuntimeConfig(path: string, packageRootHint?: string): Promise<OpenedRuntimeConfig> {
215
264
  const absolute = resolve(path);
216
265
  const document = parseLocalRuntimeProfile(JSON.parse(await readFile(absolute, "utf8")));
@@ -253,6 +302,7 @@ async function installRuntimeAdapters(
253
302
  packageRoot: string,
254
303
  selection: NodePackageSelectionRequest,
255
304
  distributionPackageRoot?: string,
305
+ importModule?: (url: string) => Promise<unknown>,
256
306
  ): Promise<void> {
257
307
  const logical = selection.logical?.filter((address) => {
258
308
  if (address.abi === runtimeEndpointAdapterHostAbi) return !registry.has(address.name, "endpoint");
@@ -261,6 +311,8 @@ async function installRuntimeAdapters(
261
311
  }) ?? [];
262
312
  if (selection.selected.length === 0 && logical.length === 0) return;
263
313
  const loaded = await loadNodePackageSelection({ selected: selection.selected, logical }, packageRoot, {
314
+ deferExternalDependencies: true,
315
+ ...(importModule === undefined ? {} : { importModule }),
264
316
  ...(distributionPackageRoot === undefined ? {} : { fallbackRoots: [distributionPackageRoot] }),
265
317
  });
266
318
  for (const item of loaded) {
@@ -275,9 +327,11 @@ async function installBuildResultAdapter(
275
327
  packageRoot: string,
276
328
  use: string,
277
329
  distributionPackageRoot?: string,
330
+ importModule?: (url: string) => Promise<unknown>,
278
331
  ): Promise<void> {
279
332
  if (registry.has(use)) return;
280
333
  const loaded = await loadNodePackageSelection(resultPackageSelection(use), packageRoot, {
334
+ ...(importModule === undefined ? {} : { importModule }),
281
335
  ...(distributionPackageRoot === undefined ? {} : { fallbackRoots: [distributionPackageRoot] }),
282
336
  });
283
337
  for (const item of loaded) {
@@ -294,7 +348,7 @@ async function openBuildResultLocation(
294
348
  packageRoot: string,
295
349
  registry: BuildResultRepositoryRegistry,
296
350
  ): Promise<BuildResultRepositoryOpened> {
297
- await installBuildResultAdapter(registry, packageRoot, location.selection.use, options.distributionPackageRoot);
351
+ await installBuildResultAdapter(registry, packageRoot, location.selection.use, options.distributionPackageRoot, options.importModule);
298
352
  return await registry.open(location.selection, location.root);
299
353
  }
300
354
 
@@ -394,13 +448,19 @@ export async function prepareRuntimeConfigPackages(
394
448
  path: string,
395
449
  options: LoadRuntimeConfigOptions & {
396
450
  readonly onProgress?: (event: HostPackageProgress) => void;
451
+ readonly endpoints?: readonly string[];
397
452
  } = {},
398
453
  ): Promise<readonly HostPackageReport[]> {
399
454
  if (options.distributionPackageRoot === undefined) return [];
400
- const { document } = await openRuntimeConfig(path, options.packageRoot);
455
+ const opened = await openRuntimeConfig(path, options.packageRoot);
456
+ const document = scopedProfile(opened.document, options);
457
+ const registry = options.registry ?? new RuntimeAdapterRegistry();
458
+ await installRuntimeAdapters(registry, opened.packageRoot, endpointPackageSelection(document), options.distributionPackageRoot);
459
+ const activations = await activatedEndpoints(document, opened.root, resolve(options.hostStateRoot ?? hypitHostStateRoot()), registry);
460
+ const credentials = credentialProfile(document, activations.map(({ activation }) => activation.endpoint));
401
461
  const requirements = await distributionExternalPackageRequirements([
402
- ...document.credentials.map((item) => item.use),
403
462
  ...document.endpoints.map((item) => item.use),
463
+ ...credentials.credentials.map((item) => item.use),
404
464
  ], options.distributionPackageRoot);
405
465
  return await prepareHostPackages(requirements.map((item) => item.specifier), {
406
466
  root: hypitHostPackageRoot(options.hostStateRoot),
@@ -450,11 +510,18 @@ async function activatedEndpoints(
450
510
  })));
451
511
  }
452
512
 
513
+ function credentialProfile(document: LocalRuntimeProfile, endpoints: readonly EndpointPackage[]): LocalRuntimeProfile {
514
+ const used = new Set(endpoints.flatMap((endpoint) => endpoint.credentials.map((slot) => slot.ref.store)));
515
+ return { ...document, credentials: document.credentials.filter((item) => used.has(item.instance)) };
516
+ }
517
+
453
518
  export async function declaredManagedPrograms(
454
519
  path: string,
455
- options: LoadRuntimeConfigOptions & { readonly capabilities?: readonly CapabilityRef[] } = {},
520
+ options: LoadRuntimeConfigOptions & { readonly capabilities?: readonly CapabilityRef[]; readonly endpoints?: readonly string[] } = {},
456
521
  ): Promise<{ readonly dataRoot: string; readonly programs: readonly DeclaredManagedProgram[] }> {
457
- const { document, root, packageRoot } = await openRuntimeConfig(path, options.packageRoot);
522
+ const opened = await openRuntimeConfig(path, options.packageRoot);
523
+ const { root, packageRoot } = opened;
524
+ const document = scopedProfile(opened.document, options);
458
525
  if (options.capabilities?.length === 0) return { dataRoot: root, programs: [] };
459
526
  const hostStateRoot = resolve(options.hostStateRoot ?? hypitHostStateRoot());
460
527
  const registry = options.registry ?? new RuntimeAdapterRegistry();
@@ -464,7 +531,7 @@ export async function declaredManagedPrograms(
464
531
  : new Set(options.capabilities.map(capabilityKey));
465
532
  const programs: DeclaredManagedProgram[] = [];
466
533
  for (const { entry, activation } of await activatedEndpoints(document, root, hostStateRoot, registry)) {
467
- if (requested !== undefined && !activation.endpoint.offers.some((offer) => requested.has(capabilityKey(offer.capability)))) continue;
534
+ if (requested !== undefined && !activation.endpoint.offers.some((offer) => requestsCapability(document, entry.instance, offer.capability, requested))) continue;
468
535
  if (activation.program !== undefined) programs.push({ instance: entry.instance, program: activation.program });
469
536
  }
470
537
  return { dataRoot: root, programs };
@@ -627,7 +694,9 @@ export async function describeRuntimeConfigProviders(
627
694
  options: LoadRuntimeConfigOptions = {},
628
695
  ): Promise<readonly RuntimeHostCapabilityProvider[]> {
629
696
  if (requests.length === 0) return [];
630
- const { document, root, packageRoot } = await openRuntimeConfig(path, options.packageRoot);
697
+ const opened = await openRuntimeConfig(path, options.packageRoot);
698
+ const { root, packageRoot } = opened;
699
+ const document = scopedProfile(opened.document, { capabilities: requests.map((request) => request.capability) });
631
700
  const hostStateRoot = resolve(options.hostStateRoot ?? hypitHostStateRoot());
632
701
  const registry = options.registry ?? new RuntimeAdapterRegistry();
633
702
  await installRuntimeAdapters(registry, packageRoot, endpointPackageSelection(document), options.distributionPackageRoot);
@@ -708,14 +777,25 @@ export async function readRuntimeConfigPricing(
708
777
  options: LoadRuntimeConfigOptions = {},
709
778
  ): Promise<readonly RuntimeHostCapabilityPricing[]> {
710
779
  if (requests.length === 0) return [];
711
- const { absolute, document, root, packageRoot } = await openRuntimeConfig(path, options.packageRoot);
780
+ const opened = await openRuntimeConfig(path, options.packageRoot);
781
+ const { absolute, root, packageRoot } = opened;
782
+ const document = scopedProfile(opened.document, { capabilities: requests.map((request) => request.capability) });
712
783
  const hostStateRoot = resolve(options.hostStateRoot ?? hypitHostStateRoot());
713
784
  const registry = options.registry ?? new RuntimeAdapterRegistry();
714
- await installRuntimeAdapters(registry, packageRoot, runtimePackageSelection(document), options.distributionPackageRoot);
785
+ await installRuntimeAdapters(registry, packageRoot, endpointPackageSelection(document), options.distributionPackageRoot);
715
786
  const activations = await activatedEndpoints(document, root, hostStateRoot, registry);
716
787
  const endpoints = await installedEndpointRegistry(document, activations);
717
- let stores: Awaited<ReturnType<typeof openCredentialStores>> | undefined;
718
- const openedStores = async () => stores ??= await openCredentialStores(document, root, hostStateRoot, registry);
788
+ const stores = new Map<string, Awaited<ReturnType<typeof openCredentialStores>>>();
789
+ const openedStores = async (endpoint: EndpointPackage) => {
790
+ let opened = stores.get(endpoint.instance.id);
791
+ if (opened === undefined) {
792
+ const selected = credentialProfile(document, [endpoint]);
793
+ await installRuntimeAdapters(registry, packageRoot, runtimePackageSelection({ ...selected, endpoints: [] }), options.distributionPackageRoot);
794
+ opened = await openCredentialStores(selected, root, hostStateRoot, registry);
795
+ stores.set(endpoint.instance.id, opened);
796
+ }
797
+ return opened;
798
+ };
719
799
  const result: RuntimeHostCapabilityPricing[] = [];
720
800
  try {
721
801
  for (const request of requests) {
@@ -784,7 +864,7 @@ export async function readRuntimeConfigPricing(
784
864
  const pricingDocuments = await match.activation.endpoint.readPricing({
785
865
  request: endpointRequest,
786
866
  credentials: async () => {
787
- const opened = await openedStores();
867
+ const opened = await openedStores(match.activation.endpoint);
788
868
  return await resolveEndpointCredentials(match.activation.endpoint, opened.store, absolute);
789
869
  },
790
870
  });
@@ -804,7 +884,7 @@ export async function readRuntimeConfigPricing(
804
884
  }
805
885
  return result;
806
886
  } finally {
807
- await stores?.close();
887
+ await Promise.all([...stores.values()].map((opened) => opened.close()));
808
888
  }
809
889
  }
810
890
 
@@ -820,12 +900,14 @@ export async function invokeRuntimeConfigNeed(
820
900
  path: string,
821
901
  need: Need,
822
902
  resources: ResourceStore,
823
- options: LoadRuntimeConfigOptions = {},
903
+ options: LoadRuntimeConfigOptions & RuntimeInvocationObservation = {},
824
904
  ): Promise<EndpointFulfillment> {
825
- const { absolute, document, root, packageRoot } = await openRuntimeConfig(path, options.packageRoot);
905
+ const opened = await openRuntimeConfig(path, options.packageRoot);
906
+ const { absolute, root, packageRoot } = opened;
907
+ const document = scopedProfile(opened.document, { capabilities: [need.capability] });
826
908
  const hostStateRoot = resolve(options.hostStateRoot ?? hypitHostStateRoot());
827
909
  const registry = options.registry ?? new RuntimeAdapterRegistry();
828
- await installRuntimeAdapters(registry, packageRoot, runtimePackageSelection(document), options.distributionPackageRoot);
910
+ await installRuntimeAdapters(registry, packageRoot, endpointPackageSelection(document), options.distributionPackageRoot);
829
911
  const activations = await activatedEndpoints(document, root, hostStateRoot, registry);
830
912
  const endpoints = await installedEndpointRegistry(document, activations);
831
913
  const subject = capabilityKey(need.capability);
@@ -850,7 +932,9 @@ export async function invokeRuntimeConfigNeed(
850
932
  }
851
933
  const activation = activations.find(({ activation: item }) => item.endpoint.instance.id === registration.id)?.activation;
852
934
  if (activation === undefined) throw new Error(`Endpoint ${registration.id} is not declared by ${absolute}`);
853
- const stores = await openCredentialStores(document, root, hostStateRoot, registry);
935
+ const selected = credentialProfile(document, [activation.endpoint]);
936
+ await installRuntimeAdapters(registry, packageRoot, runtimePackageSelection({ ...selected, endpoints: [] }), options.distributionPackageRoot);
937
+ const stores = await openCredentialStores(selected, root, hostStateRoot, registry);
854
938
  try {
855
939
  const credentials = await resolveEndpointCredentials(activation.endpoint, stores.store, absolute);
856
940
  return await registration.handler({
@@ -858,6 +942,8 @@ export async function invokeRuntimeConfigNeed(
858
942
  need,
859
943
  resources,
860
944
  credentials,
945
+ ...(options.reportProgress === undefined ? {} : { reportProgress: options.reportProgress }),
946
+ ...(options.reportDiagnostic === undefined ? {} : { reportDiagnostic: options.reportDiagnostic }),
861
947
  });
862
948
  } finally {
863
949
  await stores.close();
@@ -896,7 +982,7 @@ async function openCredentialStores(
896
982
  }
897
983
  }
898
984
 
899
- function statePath(root: string): string {
985
+ export function statePath(root: string): string {
900
986
  return resolve(root, "runtime.sqlite");
901
987
  }
902
988
 
@@ -915,7 +1001,10 @@ async function inspectRuntimeConfig(
915
1001
  path: string,
916
1002
  options: RuntimeInspectionOptions,
917
1003
  ): Promise<RuntimeConfigDoctorResult> {
918
- const { absolute, document, root, packageRoot } = await openRuntimeConfig(path, options.packageRoot);
1004
+ const opened = await openRuntimeConfig(path, options.packageRoot);
1005
+ const { absolute, root, packageRoot } = opened;
1006
+ const document = scopedProfile(opened.document, options);
1007
+ const scoped = options.endpoints !== undefined || options.capabilities !== undefined;
919
1008
  const hostStateRoot = resolve(options.hostStateRoot ?? hypitHostStateRoot());
920
1009
  const diagnostics: RuntimeDoctorDiagnostic[] = [];
921
1010
  try {
@@ -927,24 +1016,10 @@ async function inspectRuntimeConfig(
927
1016
  }
928
1017
  const registry = options.registry ?? new RuntimeAdapterRegistry();
929
1018
  try {
930
- await installRuntimeAdapters(registry, packageRoot, runtimePackageSelection(document), options.distributionPackageRoot);
1019
+ await installRuntimeAdapters(registry, packageRoot, endpointPackageSelection(document), options.distributionPackageRoot);
931
1020
  } catch (error) {
932
1021
  return { dataRoot: root, diagnostics: [diagnostic(error, "RUNTIME_PACKAGE_SELECTION_INVALID")] };
933
1022
  }
934
- const storeSelections = [
935
- ...document.credentials.map((item) => ({ item, kind: "credential-store" as const })),
936
- ];
937
- for (const selection of storeSelections) {
938
- const context = adapterContext(root, hostStateRoot, selection.item);
939
- try {
940
- diagnostics.push(...registry.validate(selection.item.use, selection.kind, context));
941
- if (options.active) {
942
- diagnostics.push(...await registry.doctor(selection.item.use, selection.kind, context));
943
- }
944
- } catch (error) {
945
- diagnostics.push(diagnostic(error, "RUNTIME_COMPONENT_CONFIG_INVALID", selection.item.instance));
946
- }
947
- }
948
1023
  const requested = options.capabilities === undefined
949
1024
  ? undefined
950
1025
  : new Set(options.capabilities.map(capabilityKey));
@@ -963,7 +1038,7 @@ async function inspectRuntimeConfig(
963
1038
  continue;
964
1039
  }
965
1040
  activated.push({ item, activation });
966
- if (requested !== undefined && !activation.endpoint.offers.some((offer) => requested.has(capabilityKey(offer.capability)))) continue;
1041
+ if (requested !== undefined && !activation.endpoint.offers.some((offer) => requestsCapability(document, item.instance, offer.capability, requested))) continue;
967
1042
  for (const offer of activation.endpoint.offers) covered.add(capabilityKey(offer.capability));
968
1043
  selectedEndpoints.push({ item, activation });
969
1044
  const program = activation.program;
@@ -1028,10 +1103,32 @@ async function inspectRuntimeConfig(
1028
1103
  } catch (error) {
1029
1104
  diagnostics.push(diagnostic(error, "RUNTIME_ENDPOINT_INSTALL_FAILED"));
1030
1105
  }
1106
+ const credentialDocument = scoped ? credentialProfile(document, selectedEndpoints.map(({ activation }) => activation.endpoint)) : document;
1107
+ try {
1108
+ await installRuntimeAdapters(registry, packageRoot, {
1109
+ selected: [], logical: credentialDocument.credentials.map((item) => ({ abi: runtimeCredentialStoreAdapterHostAbi, name: item.use })),
1110
+ }, options.distributionPackageRoot);
1111
+ const storeSelections = [
1112
+ ...credentialDocument.credentials.map((item) => ({ item, kind: "credential-store" as const })),
1113
+ ];
1114
+ for (const selection of storeSelections) {
1115
+ const context = adapterContext(root, hostStateRoot, selection.item);
1116
+ try {
1117
+ diagnostics.push(...registry.validate(selection.item.use, selection.kind, context));
1118
+ if (options.active) {
1119
+ diagnostics.push(...await registry.doctor(selection.item.use, selection.kind, context));
1120
+ }
1121
+ } catch (error) {
1122
+ diagnostics.push(diagnostic(error, "RUNTIME_COMPONENT_CONFIG_INVALID", selection.item.instance));
1123
+ }
1124
+ }
1125
+ } catch (error) {
1126
+ diagnostics.push(diagnostic(error, "RUNTIME_CREDENTIAL_CHECK_FAILED"));
1127
+ }
1031
1128
  if (selectedEndpoints.length > 0) {
1032
1129
  let stores: Awaited<ReturnType<typeof openCredentialStores>> | undefined;
1033
1130
  try {
1034
- stores = await openCredentialStores(document, root, hostStateRoot, registry);
1131
+ stores = await openCredentialStores(credentialDocument, root, hostStateRoot, registry);
1035
1132
  for (const { item, activation } of selectedEndpoints) {
1036
1133
  const credentials: Record<string, CredentialValue> = {};
1037
1134
  let missing = false;
@@ -1081,7 +1178,7 @@ async function inspectRuntimeConfig(
1081
1178
  */
1082
1179
  export async function preflightRuntimeConfig(
1083
1180
  path: string,
1084
- options: LoadRuntimeConfigOptions & { readonly capabilities?: readonly CapabilityRef[] } = {},
1181
+ options: LoadRuntimeConfigOptions & { readonly capabilities?: readonly CapabilityRef[]; readonly endpoints?: readonly string[] } = {},
1085
1182
  ): Promise<RuntimeConfigDoctorResult> {
1086
1183
  return await inspectRuntimeConfig(path, { ...options, active: false });
1087
1184
  }
@@ -1089,7 +1186,7 @@ export async function preflightRuntimeConfig(
1089
1186
  /** Active diagnosis may ask selected credentials and Endpoints to verify their configured services. */
1090
1187
  export async function doctorRuntimeConfig(
1091
1188
  path: string,
1092
- options: LoadRuntimeConfigOptions & { readonly capabilities?: readonly CapabilityRef[] } = {},
1189
+ options: LoadRuntimeConfigOptions & { readonly capabilities?: readonly CapabilityRef[]; readonly endpoints?: readonly string[] } = {},
1093
1190
  ): Promise<RuntimeConfigDoctorResult> {
1094
1191
  return await inspectRuntimeConfig(path, { ...options, active: true });
1095
1192
  }
@@ -1098,35 +1195,75 @@ export async function createRuntimeFromConfig(
1098
1195
  path: string,
1099
1196
  options: LoadRuntimeConfigOptions = {},
1100
1197
  ): Promise<LocalRuntime> {
1101
- const { document, root, packageRoot } = await openRuntimeConfig(path, options.packageRoot);
1198
+ return await createRuntimeFromOpened(await openRuntimeConfig(path, options.packageRoot), options);
1199
+ }
1200
+
1201
+ /** Execution choices are captured at submission; later Profile edits belong to later Builds. */
1202
+ export type LocalExecutionContext = {
1203
+ readonly format: "hypit.local-execution@1";
1204
+ readonly packageRoot: string;
1205
+ readonly hostStateRoot: string;
1206
+ readonly distributionPackageRoot?: string;
1207
+ readonly profile: CanonicalValue;
1208
+ };
1209
+
1210
+ export function localExecutionContext(value: CanonicalValue | undefined): LocalExecutionContext {
1211
+ const record = object(value, "Build execution context");
1212
+ if (record.format !== "hypit.local-execution@1") throw new Error("Build has no local execution context; create a new Build");
1213
+ return {
1214
+ format: "hypit.local-execution@1",
1215
+ packageRoot: requiredString(record.packageRoot, "execution.packageRoot"),
1216
+ hostStateRoot: requiredString(record.hostStateRoot, "execution.hostStateRoot"),
1217
+ ...(record.distributionPackageRoot === undefined ? {} : { distributionPackageRoot: requiredString(record.distributionPackageRoot, "execution.distributionPackageRoot") }),
1218
+ profile: record.profile as CanonicalValue,
1219
+ };
1220
+ }
1221
+
1222
+ export async function createRuntimeForBuild(dataRoot: string, build: string, execution: {
1223
+ readonly state: SqliteRuntimeState;
1224
+ readonly importModule: (url: string) => Promise<unknown>;
1225
+ }): Promise<LocalRuntime> {
1226
+ const context = localExecutionContext((await execution.state.execution.read(build))?.context);
1227
+ return await createRuntimeFromOpened({
1228
+ absolute: dataRoot, profileRoot: dataRoot, root: dataRoot,
1229
+ packageRoot: context.packageRoot, document: parseLocalRuntimeProfile(context.profile),
1230
+ }, { ...context, importModule: execution.importModule }, { state: execution.state, build });
1231
+ }
1232
+
1233
+ async function createRuntimeFromOpened(opened: OpenedRuntimeConfig, options: LoadRuntimeConfigOptions, execution?: {
1234
+ readonly state: SqliteRuntimeState; readonly build: string;
1235
+ }): Promise<LocalRuntime> {
1236
+ const { root, packageRoot } = opened;
1237
+ let document = scopedProfile(opened.document, options);
1102
1238
  const hostStateRoot = resolve(options.hostStateRoot ?? hypitHostStateRoot());
1103
1239
  const registry = options.registry ?? new RuntimeAdapterRegistry();
1104
1240
  const resultRegistry = options.resultRegistry ?? new BuildResultRepositoryRegistry();
1105
- await installRuntimeAdapters(registry, packageRoot, runtimePackageSelection(document), options.distributionPackageRoot);
1106
- const state = new SqliteRuntimeState(statePath(root));
1107
- // Only selections that can change Command execution or an Operation handle are pinned until
1108
- // every Build using them has left active Runtime state.
1109
- const environmentConfig = canonicalStringify({
1110
- credentials: document.credentials,
1111
- endpoints: document.endpoints,
1112
- bindings: document.bindings,
1113
- });
1241
+ await installRuntimeAdapters(registry, packageRoot, endpointPackageSelection(document), options.distributionPackageRoot, options.importModule);
1242
+ const state = execution?.state ?? new SqliteRuntimeState(statePath(root));
1114
1243
  let credentials: Awaited<ReturnType<typeof openCredentialStores>> | undefined;
1115
1244
  try {
1116
- await state.environment.use(environmentConfig);
1117
- credentials = await openCredentialStores(document, root, hostStateRoot, registry);
1118
1245
  const endpoints = await Promise.all(document.endpoints.map(async (item) => await registry.createEndpoint(
1119
1246
  item.use,
1120
1247
  adapterContext(root, hostStateRoot, { ...item, pool: item.pool ?? item.instance }),
1121
1248
  )));
1249
+ document = credentialProfile(document, endpoints);
1250
+ await installRuntimeAdapters(registry, packageRoot, runtimePackageSelection({ ...document, endpoints: [] }), options.distributionPackageRoot, options.importModule);
1251
+ credentials = await openCredentialStores(document, root, hostStateRoot, registry);
1252
+ const selections = (items: readonly LocalRuntimeAdapterSelection[]) => Object.fromEntries(items.map(({ instance, ...selection }) => [instance, selection]));
1253
+ const context = {
1254
+ format: "hypit.local-execution@1", packageRoot, hostStateRoot,
1255
+ ...(options.distributionPackageRoot === undefined ? {} : { distributionPackageRoot: options.distributionPackageRoot }),
1256
+ profile: { format: document.format, dataRoot: root, credentials: selections(document.credentials),
1257
+ endpoints: selections(document.endpoints), bindings: document.bindings },
1258
+ } as CanonicalValue;
1122
1259
  return await createLocalRuntime({
1260
+ ...(execution === undefined ? {} : { executionBuild: execution.build }),
1261
+ executionContext: context,
1123
1262
  buildStore: state.builds,
1124
1263
  buildCatalog: state.catalog,
1125
1264
  operationStore: state.operations,
1126
1265
  commandExecutionStore: state.commandExecutions,
1127
- assertEnvironment: async () => {
1128
- await state.environment.assert(environmentConfig);
1129
- },
1266
+ executionLogs: fileExecutionLogs((build) => buildWorkPath(root, build)),
1130
1267
  executionStore: state.execution,
1131
1268
  removeActiveBuild: async (build) => await state.removeActiveBuild(build),
1132
1269
  submissionStore: state.submissions,
@@ -1139,6 +1276,7 @@ export async function createRuntimeFromConfig(
1139
1276
  credentialStore: credentials.store,
1140
1277
  loadComponentPackages: async (specifiers) => {
1141
1278
  const loaded = await loadNodePackageSelection(specifiers, packageRoot, {
1279
+ ...(options.importModule === undefined ? {} : { importModule: options.importModule }),
1142
1280
  ...(options.distributionPackageRoot === undefined
1143
1281
  ? {}
1144
1282
  : { fallbackRoots: [options.distributionPackageRoot] }),
@@ -1149,12 +1287,12 @@ export async function createRuntimeFromConfig(
1149
1287
  bindings: document.bindings,
1150
1288
  close: async () => {
1151
1289
  await credentials?.close();
1152
- state.close();
1290
+ if (execution === undefined) state.close();
1153
1291
  },
1154
1292
  });
1155
1293
  } catch (error) {
1156
1294
  await credentials?.close();
1157
- state.close();
1295
+ if (execution === undefined) state.close();
1158
1296
  throw error;
1159
1297
  }
1160
1298
  }
@@ -1167,6 +1305,8 @@ export async function createRuntimeControlFromConfig(
1167
1305
  const state = new SqliteRuntimeState(statePath(root), { readOnly: options.readOnly === true });
1168
1306
  return createLocalRuntimeControl({
1169
1307
  buildStore: state.builds,
1308
+ commandExecutionStore: state.commandExecutions,
1309
+ executionLogs: fileExecutionLogs((build) => buildWorkPath(root, build)),
1170
1310
  buildCatalog: state.catalog,
1171
1311
  operationStore: state.operations,
1172
1312
  executionStore: state.execution,
@@ -1180,12 +1320,18 @@ export async function createRuntimeResultControlFromConfig(
1180
1320
  options: LoadRuntimeConfigOptions = {},
1181
1321
  ): Promise<LocalResultWriter> {
1182
1322
  const { root, packageRoot } = await openRuntimeConfig(path, options.packageRoot);
1323
+ return createRuntimeResultWriter(root, { ...options, packageRoot });
1324
+ }
1325
+
1326
+ export function createRuntimeResultWriter(root: string, options: LoadRuntimeConfigOptions & { readonly packageRoot: string }): LocalResultWriter {
1327
+ const { packageRoot } = options;
1183
1328
  const state = new SqliteRuntimeState(statePath(root));
1184
1329
  const resultRegistry = options.resultRegistry ?? new BuildResultRepositoryRegistry();
1185
1330
  return createLocalResultWriter({
1186
1331
  buildStore: state.builds,
1187
1332
  operationStore: state.operations,
1188
1333
  commandExecutionStore: state.commandExecutions,
1334
+ executionLogs: fileExecutionLogs((build) => buildWorkPath(root, build)),
1189
1335
  executionStore: state.execution,
1190
1336
  removeActiveBuild: async (build) => await state.removeActiveBuild(build),
1191
1337
  submissionStore: state.submissions,
@@ -20,6 +20,7 @@ function buildView(input: {
20
20
  readonly submission?: PendingBuildSubmission;
21
21
  readonly execution?: BuildExecutionSnapshot;
22
22
  readonly operations: readonly OperationSnapshot[];
23
+ readonly commands: readonly import("@hypit/runtime").CommandExecutionReceipt[];
23
24
  }): BuildView | undefined {
24
25
  if (input.submission === undefined && input.execution === undefined) return undefined;
25
26
  const createdAt = buildIdCreatedAt(input.build);
@@ -57,6 +58,8 @@ function buildView(input: {
57
58
  ...(requests === undefined ? {} : { requests }),
58
59
  acceptedRecords: input.snapshot?.state.records.length ?? 0,
59
60
  outstandingCommands: input.snapshot?.state.outstanding.length ?? 0,
61
+ commands: input.commands.flatMap((command) => command.status === "started" && command.activity !== undefined
62
+ ? [{ id: command.command, ...command.activity }] : []),
60
63
  operations: input.operations.map((operation) => ({
61
64
  id: operation.id,
62
65
  endpoint: operation.endpoint,
@@ -75,12 +78,13 @@ export function createLocalRuntimeControl(
75
78
  ): LocalRuntimeControl {
76
79
  const buildCatalog = options.buildCatalog;
77
80
  const inspect = async (build: string): Promise<BuildView | undefined> => {
78
- const [snapshot, catalog, operations, submission, execution] = await Promise.all([
81
+ const [snapshot, catalog, operations, submission, execution, commands] = await Promise.all([
79
82
  options.buildStore.read(build),
80
83
  buildCatalog?.read(build),
81
84
  options.operationStore.list({ build }),
82
85
  options.submissionStore.read(build),
83
86
  options.executionStore.read(build),
87
+ options.commandExecutionStore.list(build),
84
88
  ]);
85
89
  return buildView({
86
90
  build,
@@ -89,10 +93,14 @@ export function createLocalRuntimeControl(
89
93
  ...(submission === undefined ? {} : { submission }),
90
94
  ...(execution === undefined ? {} : { execution }),
91
95
  operations,
96
+ commands,
92
97
  });
93
98
  };
94
99
  return {
95
100
  inspect,
101
+ async logs(build, lines) {
102
+ return await options.executionLogs?.read(build, lines);
103
+ },
96
104
  async activity() {
97
105
  const [submissions, executions, capacity] = await Promise.all([
98
106
  options.submissionStore.list(),
@@ -0,0 +1,66 @@
1
+ import { setImmediate, setTimeout as pause } from "node:timers/promises";
2
+ import { NodeModuleScope } from "@hypit/package-loader-node/module-scope";
3
+ import { SqliteRuntimeState } from "@hypit/store-sqlite";
4
+ import { createRuntimeForBuild, statePath } from "./config.js";
5
+ import type { LocalRuntime } from "./types.js";
6
+
7
+ type Context = { readonly scope: NodeModuleScope; readonly runtime: LocalRuntime; task?: Promise<void> };
8
+
9
+ /** A shared execution carrier. Database readiness selects work; waiting is not an occupied process. */
10
+ export async function executeBuilds(dataRoot: string, signal: AbortSignal): Promise<void> {
11
+ const state = new SqliteRuntimeState(statePath(dataRoot));
12
+ const pending = new Set<string>();
13
+ const contexts = new Map<string, Context>();
14
+ const finished = (build: string, error?: unknown): void => {
15
+ process.send?.({ kind: "build-finished", build, rssBytes: process.memoryUsage.rss(),
16
+ ...(error === undefined ? {} : { error: error instanceof Error ? error.message : String(error) }) });
17
+ };
18
+ const receive = (message: unknown): void => {
19
+ if (typeof message === "object" && message !== null && "kind" in message && message.kind === "start-build"
20
+ && "build" in message && typeof message.build === "string") pending.add(message.build);
21
+ };
22
+ const close = async (build: string, context: Context): Promise<void> => {
23
+ contexts.delete(build);
24
+ try { await context.runtime.close(); } finally { context.scope.close(); }
25
+ };
26
+ process.on("message", receive);
27
+ process.send?.({ kind: "executor-ready" });
28
+ try {
29
+ while (!signal.aborted) {
30
+ for (const build of await state.execution.listReady()) {
31
+ if (signal.aborted) break;
32
+ let context = contexts.get(build);
33
+ if (context === undefined && pending.delete(build)) {
34
+ const scope = new NodeModuleScope();
35
+ try {
36
+ const runtime = await createRuntimeForBuild(dataRoot, build, { state, importModule: (url) => scope.import(url) });
37
+ context = { scope, runtime };
38
+ contexts.set(build, context);
39
+ process.send?.({ kind: "executor-memory", rssBytes: process.memoryUsage.rss() });
40
+ } catch (error) { scope.close(); finished(build, error); }
41
+ }
42
+ if (context === undefined || context.task !== undefined) continue;
43
+ const current = context;
44
+ let hydrated!: () => void;
45
+ const hydration = new Promise<void>((resolve) => { hydrated = resolve; });
46
+ current.task = current.runtime.workOnce({ build, hydrated }).then(async (result) => {
47
+ if (result !== undefined && ("outcome" in result || result.decision !== undefined)) {
48
+ await close(build, current); finished(build);
49
+ }
50
+ }).catch(async (error: unknown) => {
51
+ await close(build, current).catch(() => undefined); finished(build, error);
52
+ }).finally(() => { delete current.task; });
53
+ // Only local hydration is sequenced. Slow submission/poll/collection continues
54
+ // asynchronously while the next ready Build advances its independent work.
55
+ await Promise.race([hydration, current.task]);
56
+ await setImmediate();
57
+ }
58
+ await pause(25, undefined, { signal }).catch((error) => { if (!signal.aborted) throw error; });
59
+ }
60
+ } finally {
61
+ process.removeListener("message", receive);
62
+ await Promise.allSettled([...contexts.values()].flatMap((item) => item.task === undefined ? [] : [item.task]));
63
+ await Promise.allSettled([...contexts].map(([build, context]) => close(build, context)));
64
+ state.close();
65
+ }
66
+ }