@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.
- package/README.md +5 -3
- package/dist/public/caption.d.ts +206 -183
- package/dist/public/composition.d.ts +25 -3
- package/dist/public/endpoint-kit.d.ts +24 -2
- package/dist/public/generation.d.ts +5 -1
- package/dist/public/hyperframes.d.ts +19 -1
- package/dist/public/narrative.d.ts +17 -3
- package/dist/public/performance.d.ts +1590 -0
- package/dist/public/program-space.d.ts +179 -32
- package/dist/public/runtime-kit.d.ts +21 -8
- package/dist/public/sound.d.ts +822 -0
- package/dist/public/speech.d.ts +41 -0
- package/dist/public/studio-adapter.d.ts +107 -16
- package/dist/public/temporal-markup.d.ts +9 -44
- package/dist/public/temporal.d.ts +37 -28
- package/dist/public/{semantic-track.d.ts → timeline.d.ts} +62 -49
- package/examples/README.md +18 -10
- package/examples/minimal-author-package/packages/example-component/preview/preview.svml +19 -12
- package/examples/minimal-author-package/packages/example-component/src/component.ts +5 -5
- package/examples/minimal-author-package/packages/example-component/src/fragment.ts +3 -5
- package/examples/minimal-author-package/packages/example-component/src/manifest.ts +8 -10
- package/examples/minimal-author-package/packages/example-component/src/surface.ts +2 -2
- package/examples/provider-package/README.md +78 -0
- package/examples/provider-package/hypit.runtime.json +12 -0
- package/examples/provider-package/packages/provider-images/package.json +11 -0
- package/examples/provider-package/packages/provider-images/src/activation.ts +24 -0
- package/examples/provider-package/packages/provider-images/src/provider.ts +122 -0
- package/examples/provider-package/packages/provider-images/tsconfig.json +9 -0
- package/examples/semantic-composition/README.md +6 -0
- package/examples/semantic-composition/chat.svml +6 -5
- package/examples/semantic-composition/packages/chat-scene/README.md +3 -3
- package/examples/semantic-composition/packages/chat-scene/src/activation.ts +18 -21
- package/examples/semantic-composition/packages/chat-scene/src/render.ts +4 -4
- package/examples/semantic-composition/packages/performance-styles/README.md +42 -0
- package/examples/semantic-composition/packages/performance-styles/package.json +25 -0
- package/examples/semantic-composition/packages/performance-styles/src/activation.ts +57 -0
- package/examples/semantic-composition/packages/performance-styles/src/render.ts +54 -0
- package/examples/semantic-composition/packages/performance-styles/src/studio.ts +28 -0
- package/examples/semantic-composition/packages/performance-styles/tsconfig.json +18 -0
- package/examples/semantic-composition/packages/responsive-explainer/README.md +16 -9
- package/examples/semantic-composition/packages/responsive-explainer/src/activation.ts +12 -12
- package/examples/semantic-composition/packages/responsive-explainer/src/render.ts +5 -5
- package/examples/semantic-composition/packages/sound-styles/README.md +36 -0
- package/examples/semantic-composition/packages/sound-styles/package.json +25 -0
- package/examples/semantic-composition/packages/sound-styles/src/activation.ts +53 -0
- package/examples/semantic-composition/packages/sound-styles/src/render.ts +14 -0
- package/examples/semantic-composition/packages/sound-styles/tsconfig.json +18 -0
- package/package.json +35 -15
- package/packages/audio-track/README.md +20 -13
- package/packages/audio-track/package.json +1 -1
- package/packages/audio-track/src/component.ts +4 -4
- package/packages/audio-track/src/fragment.ts +6 -5
- package/packages/audio-track/src/index.ts +1 -1
- package/packages/audio-track/src/manifest.ts +17 -16
- package/packages/audio-track/src/program.ts +21 -25
- package/packages/audio-track/src/surface.ts +19 -18
- package/packages/audio-track-studio/README.md +23 -0
- package/packages/audio-track-studio/src/index.ts +33 -19
- package/packages/author-kit/README.md +1 -1
- package/packages/background-removal/README.md +4 -7
- package/packages/browser-capture/package.json +1 -1
- package/packages/build-result/README.md +69 -0
- package/packages/build-result/package.json +2 -1
- package/packages/build-result/src/decode.ts +12 -8
- package/packages/build-result/src/execution-log.ts +17 -0
- package/packages/build-result/src/file-reference.ts +42 -0
- package/packages/build-result/src/index.ts +4 -0
- package/packages/build-result/src/replace-file-windows.ts +58 -0
- package/packages/build-result/src/replace-file.ts +11 -0
- package/packages/build-result/src/store.ts +58 -14
- package/packages/build-result/src/types.ts +41 -8
- package/packages/build-result/src/writer.ts +12 -1
- package/packages/build-result-fs/README.md +23 -1
- package/packages/build-result-s3/README.md +5 -0
- package/packages/build-result-s3/src/repository.ts +23 -5
- package/packages/caption/README.md +61 -73
- package/packages/caption/package.json +3 -2
- package/packages/caption/src/activation.ts +2 -2
- package/packages/caption/src/component.ts +20 -5
- package/packages/caption/src/display.ts +3 -18
- package/packages/caption/src/fragment.ts +3 -7
- package/packages/caption/src/index.ts +6 -5
- package/packages/caption/src/manifest.ts +29 -46
- package/packages/caption/src/style.ts +24 -135
- package/packages/caption/src/surface.ts +12 -92
- package/packages/caption/src/temporalize.ts +18 -53
- package/packages/caption/src/types.ts +8 -35
- package/packages/caption/src/visibility.ts +23 -0
- package/packages/caption-fine/README.md +31 -11
- package/packages/caption-fine/package.json +4 -2
- package/packages/caption-fine/src/component.ts +3 -3
- package/packages/caption-fine/src/fragment.ts +7 -19
- package/packages/caption-fine/src/index.ts +2 -0
- package/packages/caption-fine/src/manifest.ts +27 -18
- package/packages/caption-fine/src/recipe.ts +7 -0
- package/packages/caption-fine/src/render.ts +62 -49
- package/packages/caption-fine/src/schedule.ts +39 -35
- package/packages/caption-fine/src/style.ts +10 -9
- package/packages/caption-fine/src/surface.ts +62 -35
- package/packages/caption-fine/src/types.ts +2 -0
- package/packages/caption-fine-studio/README.md +24 -2
- package/packages/caption-fine-studio/package.json +10 -3
- package/packages/caption-fine-studio/src/activation.ts +3 -3
- package/packages/caption-fine-studio/src/index.ts +61 -40
- package/packages/cli/README.md +81 -3
- package/packages/cli/package.json +1 -0
- package/packages/cli/src/arguments.ts +39 -15
- package/packages/cli/src/build-planning.ts +9 -3
- package/packages/cli/src/command.ts +7 -1
- package/packages/cli/src/commands/environment.ts +66 -27
- package/packages/cli/src/commands/execution.ts +81 -26
- package/packages/cli/src/commands/results.ts +7 -11
- package/packages/cli/src/index.ts +2 -2
- package/packages/cli/src/machine-view.ts +15 -5
- package/packages/cli/src/main.ts +38 -42
- package/packages/cli/src/observation.ts +7 -1
- package/packages/cli/src/output.ts +92 -34
- package/packages/cli/src/result-export.ts +22 -13
- package/packages/cli/src/run-file.ts +19 -8
- package/packages/cli/src/view.ts +64 -18
- package/packages/comment-sticker/README.md +3 -3
- package/packages/comment-sticker/package.json +1 -1
- package/packages/comment-sticker/src/component.ts +4 -4
- package/packages/comment-sticker/src/fragment.ts +5 -4
- package/packages/comment-sticker/src/manifest.ts +7 -6
- package/packages/comment-sticker/src/program.ts +9 -9
- package/packages/comment-sticker/src/surface.ts +6 -7
- package/packages/comment-sticker-studio/src/index.ts +2 -1
- package/packages/compiler-node/src/compiler.ts +1 -0
- package/packages/composition/README.md +21 -0
- package/packages/composition/src/audio-presentation.ts +44 -0
- package/packages/composition/src/index.ts +3 -0
- package/packages/composition/src/schema.ts +8 -3
- package/packages/composition/src/track.ts +15 -1
- package/packages/credential-store-env/README.md +1 -1
- package/packages/deck-track/README.md +3 -3
- package/packages/deck-track/package.json +1 -1
- package/packages/deck-track/src/component.ts +5 -5
- package/packages/deck-track/src/fragment.ts +6 -5
- package/packages/deck-track/src/lower.ts +12 -12
- package/packages/deck-track/src/manifest.ts +8 -7
- package/packages/deck-track/src/program.ts +13 -16
- package/packages/deck-track/src/surface.ts +9 -10
- package/packages/driver-node/src/driver.ts +41 -3
- package/packages/elevenlabs-speech/README.md +27 -0
- package/packages/{provider-xiaomi-mimo → elevenlabs-speech}/package.json +5 -8
- package/packages/elevenlabs-speech/src/activation.ts +26 -0
- package/packages/elevenlabs-speech/src/fragment.ts +11 -0
- package/packages/elevenlabs-speech/src/index.ts +111 -0
- package/packages/elevenlabs-speech/src/surface.ts +167 -0
- package/packages/endpoint-kit/README.md +24 -0
- package/packages/endpoint-kit/src/index.ts +7 -1
- package/packages/estimate/README.md +56 -3
- package/packages/estimate/src/program.ts +7 -8
- package/packages/film/README.md +12 -7
- package/packages/film/package.json +1 -1
- package/packages/film/src/component.ts +4 -4
- package/packages/film/src/fragment.ts +6 -5
- package/packages/film/src/manifest.ts +11 -10
- package/packages/film/src/program.ts +5 -5
- package/packages/film/src/recipe.ts +2 -1
- package/packages/film/src/surface.ts +6 -6
- package/packages/film-studio/package.json +1 -1
- package/packages/film-studio/src/index.ts +2 -2
- package/packages/fishaudio-speech/README.md +33 -0
- package/packages/fishaudio-speech/package.json +21 -0
- package/packages/fishaudio-speech/src/activation.ts +32 -0
- package/packages/fishaudio-speech/src/fragment.ts +11 -0
- package/packages/fishaudio-speech/src/index.ts +156 -0
- package/packages/fishaudio-speech/src/surface.ts +192 -0
- package/packages/fonts-open/README.md +5 -0
- package/packages/fonts-open/package.json +5 -1
- package/packages/fonts-open/src/studio.ts +21 -0
- package/packages/generation/README.md +11 -1
- package/packages/generation/src/mapping.ts +28 -30
- package/packages/gpt-image/README.md +1 -2
- package/packages/grok-imagine/README.md +1 -2
- package/packages/hyperframes/README.md +7 -3
- package/packages/hyperframes/src/browser-program.ts +11 -2
- package/packages/hyperframes/src/document.ts +15 -2
- package/packages/interview-emoji-reveal/README.md +4 -4
- package/packages/interview-emoji-reveal/package.json +1 -1
- package/packages/interview-emoji-reveal/src/component.ts +4 -4
- package/packages/interview-emoji-reveal/src/fragment.ts +6 -5
- package/packages/interview-emoji-reveal/src/manifest.ts +9 -8
- package/packages/interview-emoji-reveal/src/program.ts +14 -14
- package/packages/interview-emoji-reveal/src/surface.ts +8 -9
- package/packages/media-execution/README.md +7 -3
- package/packages/media-execution/src/audio-presentation.ts +23 -0
- package/packages/media-execution/src/execute.ts +2 -0
- package/packages/media-pipeline/README.md +7 -3
- package/packages/media-pipeline/src/audio-plan.ts +4 -1
- package/packages/media-pipeline/src/component.ts +16 -2
- package/packages/media-pipeline/src/manifest.ts +3 -1
- package/packages/media-pipeline/src/types.ts +2 -1
- package/packages/media-track/README.md +14 -47
- package/packages/media-track/package.json +1 -1
- package/packages/media-track/preview/preview.svml +5 -5
- package/packages/media-track/src/author.ts +12 -6
- package/packages/media-track/src/component.ts +10 -16
- package/packages/media-track/src/fragment.ts +8 -7
- package/packages/media-track/src/index.ts +3 -1
- package/packages/media-track/src/lower.ts +7 -7
- package/packages/media-track/src/manifest.ts +16 -38
- package/packages/media-track/src/program.ts +62 -67
- package/packages/media-track/src/sampling.ts +6 -6
- package/packages/media-track/src/sequence.ts +8 -8
- package/packages/media-track/src/surface.ts +25 -43
- package/packages/media-track-studio/README.md +9 -0
- package/packages/media-track-studio/src/index.ts +23 -13
- package/packages/mimo-speech/README.md +1 -1
- package/packages/minimax-h3/README.md +1 -1
- package/packages/nano-banana/README.md +1 -1
- package/packages/narrative/README.md +23 -1
- package/packages/narrative/src/identity.ts +11 -0
- package/packages/narrative/src/index.ts +3 -0
- package/packages/narrative/src/schema.ts +28 -27
- package/packages/narrative/src/selection.ts +52 -0
- package/packages/narrative/src/types.ts +2 -0
- package/packages/package-loader-node/README.md +30 -0
- package/packages/package-loader-node/package.json +5 -2
- package/packages/package-loader-node/src/distribution-resolution.ts +10 -3
- package/packages/package-loader-node/src/index.ts +1 -0
- package/packages/package-loader-node/src/loader.ts +12 -15
- package/packages/package-loader-node/src/location.ts +27 -1
- package/packages/package-loader-node/src/module-scope.ts +183 -0
- package/packages/package-loader-node/src/types.ts +4 -0
- package/packages/performance/README.md +83 -0
- package/packages/performance/package.json +30 -0
- package/packages/performance/src/activation.ts +11 -0
- package/packages/performance/src/component.ts +46 -0
- package/packages/performance/src/index.ts +6 -0
- package/packages/performance/src/manifest.ts +53 -0
- package/packages/{media-track/src/performance.ts → performance/src/media.ts} +9 -10
- package/packages/performance/src/program.ts +51 -0
- package/packages/performance/src/style.ts +35 -0
- package/packages/performance/src/surface.ts +99 -0
- package/packages/performance-studio/README.md +25 -0
- package/packages/performance-studio/package.json +21 -0
- package/packages/performance-studio/src/activation.ts +6 -0
- package/packages/performance-studio/src/index.ts +84 -0
- package/packages/program-space/README.md +9 -18
- package/packages/program-space/src/activation.ts +1 -5
- package/packages/program-space/src/index.ts +2 -11
- package/packages/program-space/src/surface.ts +1 -20
- package/packages/project-context-node/README.md +20 -0
- package/packages/project-context-node/package.json +10 -0
- package/packages/project-context-node/src/index.ts +3 -0
- package/packages/{cli → project-context-node}/src/runtime-selection.ts +7 -2
- package/packages/provider-hyperframes-local/README.md +43 -15
- package/packages/provider-hyperframes-local/src/activation.ts +4 -3
- package/packages/provider-hyperframes-local/src/capture-process.ts +26 -4
- package/packages/provider-hyperframes-local/src/capture.ts +96 -26
- package/packages/provider-hyperframes-local/src/concurrency.ts +86 -0
- package/packages/provider-hyperframes-local/src/opaque-capture.ts +92 -0
- package/packages/provider-hyperframes-local/src/options.ts +2 -0
- package/packages/provider-hyperframes-local/src/program.ts +6 -3
- package/packages/provider-hyperframes-local/src/progress.ts +53 -0
- package/packages/provider-hyperframes-local/src/provider.ts +18 -5
- package/packages/provider-hyperframes-local/src/render.ts +48 -7
- package/packages/provider-hypihub/README.md +48 -17
- package/packages/provider-hypihub/package.json +2 -0
- package/packages/provider-hypihub/src/mapping.ts +31 -7
- package/packages/provider-hypihub/src/oauth.ts +6 -0
- package/packages/provider-hypihub/src/provider.ts +25 -13
- package/packages/provider-hypihub/src/routes.ts +1 -2
- package/packages/provider-hypihub/src/upload.ts +2 -0
- package/packages/provider-media-local/README.md +3 -4
- package/packages/provider-whisperx-local/README.md +57 -0
- package/packages/provider-whisperx-local/src/program.ts +1 -0
- package/packages/provider-whisperx-local/src/provider.ts +3 -0
- package/packages/ranking/README.md +8 -6
- package/packages/ranking/package.json +1 -1
- package/packages/ranking/src/component.ts +6 -6
- package/packages/ranking/src/fragment.ts +11 -7
- package/packages/ranking/src/manifest.ts +21 -14
- package/packages/ranking/src/render.ts +33 -35
- package/packages/ranking/src/schedule.ts +16 -19
- package/packages/ranking/src/surface.ts +12 -13
- package/packages/ranking-studio/README.md +29 -0
- package/packages/ranking-studio/package.json +8 -3
- package/packages/ranking-studio/src/index.ts +71 -12
- package/packages/render-hyperframes/README.md +7 -7
- package/packages/render-hyperframes/package.json +1 -1
- package/packages/render-hyperframes/src/component.ts +11 -1
- package/packages/render-hyperframes/src/fragment.ts +7 -4
- package/packages/render-hyperframes/src/manifest.ts +4 -4
- package/packages/render-hyperframes/src/surface.ts +6 -6
- package/packages/runtime/README.md +8 -1
- package/packages/runtime/src/catalog.ts +2 -0
- package/packages/runtime/src/execution.ts +15 -4
- package/packages/runtime/src/index.ts +2 -1
- package/packages/runtime/src/log.ts +51 -0
- package/packages/runtime/src/types.ts +5 -8
- package/packages/runtime-host-node/README.md +30 -0
- package/packages/runtime-host-node/package.json +1 -0
- package/packages/runtime-host-node/src/index.ts +25 -9
- package/packages/runtime-host-node/src/packages.ts +47 -50
- package/packages/runtime-kit/README.md +5 -0
- package/packages/runtime-kit/src/index.ts +3 -1
- package/packages/runtime-local/README.md +111 -4
- package/packages/runtime-local/src/config.ts +202 -56
- package/packages/runtime-local/src/control.ts +9 -1
- package/packages/runtime-local/src/executor.ts +66 -0
- package/packages/runtime-local/src/host.ts +37 -17
- package/packages/runtime-local/src/log.ts +48 -0
- package/packages/runtime-local/src/programs.ts +41 -25
- package/packages/runtime-local/src/result-writer.ts +2 -0
- package/packages/runtime-local/src/runtime.ts +10 -6
- package/packages/runtime-local/src/supervisor.ts +142 -0
- package/packages/runtime-local/src/types.ts +9 -2
- package/packages/runtime-local/src/worker-process.ts +7 -24
- package/packages/runtime-local/src/worker.ts +55 -83
- package/packages/screen-overlay/README.md +3 -3
- package/packages/screen-overlay/package.json +1 -1
- package/packages/screen-overlay/src/component.ts +3 -3
- package/packages/screen-overlay/src/fragment.ts +5 -4
- package/packages/screen-overlay/src/manifest.ts +7 -6
- package/packages/screen-overlay/src/program.ts +9 -9
- package/packages/screen-overlay/src/surface.ts +6 -7
- package/packages/script/README.md +37 -2
- package/packages/script/src/edit.ts +123 -73
- package/packages/script/src/lexical.ts +40 -6
- package/packages/script/src/manifest.ts +2 -2
- package/packages/script/src/narrative.ts +1 -0
- package/packages/script/src/parser.ts +36 -8
- package/packages/script/src/surface.ts +4 -3
- package/packages/script/src/types.ts +5 -1
- package/packages/script-studio/package.json +9 -3
- package/packages/script-studio/src/index.ts +2 -0
- package/packages/script-studio/src/projection.ts +105 -0
- package/packages/seedance/README.md +30 -1
- package/packages/seedance/src/index.ts +18 -7
- package/packages/seedance/src/surface.ts +17 -4
- package/packages/seedance-kits/README.md +10 -2
- package/packages/seedance-kits/kits/speaker-v1.svs +5 -5
- package/packages/seedream/README.md +1 -1
- package/packages/sound/README.md +81 -0
- package/packages/sound/package.json +25 -0
- package/packages/sound/src/activation.ts +11 -0
- package/packages/sound/src/component.ts +28 -0
- package/packages/sound/src/index.ts +5 -0
- package/packages/sound/src/manifest.ts +47 -0
- package/packages/sound/src/program.ts +84 -0
- package/packages/sound/src/style.ts +34 -0
- package/packages/sound/src/surface.ts +90 -0
- package/packages/sound-studio/README.md +22 -0
- package/packages/sound-studio/package.json +20 -0
- package/packages/sound-studio/src/activation.ts +6 -0
- package/packages/sound-studio/src/index.ts +74 -0
- package/packages/speech/README.md +2 -2
- package/packages/speech-alignment/src/align.ts +45 -21
- package/packages/speech-alignment/src/local.ts +8 -0
- package/packages/speech-alignment/src/locate.ts +1 -1
- package/packages/store-sqlite/README.md +7 -0
- package/packages/store-sqlite/src/store.ts +84 -83
- package/packages/studio/INSPECTOR.md +117 -0
- package/packages/studio/README.md +149 -14
- package/packages/studio/package.json +8 -7
- package/packages/studio/src/build-library.ts +99 -84
- package/packages/studio/src/companion-assembly.ts +1 -0
- package/packages/studio/src/domain.ts +1 -1
- package/packages/studio/src/fallback-companions.ts +3 -3
- package/packages/studio/src/feedback-server.ts +51 -0
- package/packages/studio/src/feedback-store.ts +66 -0
- package/packages/studio/src/feedback.ts +60 -0
- package/packages/studio/src/library-media.ts +19 -0
- package/packages/studio/src/parameter-values.ts +83 -1
- package/packages/studio/src/parameters.ts +132 -43
- package/packages/studio/src/preview/render.ts +5 -1
- package/packages/studio/src/preview/runtime-shim.ts +49 -3
- package/packages/studio/src/programme.ts +14 -30
- package/packages/studio/src/server.ts +66 -34
- package/packages/studio/src/shared.ts +24 -8
- package/packages/studio/src/snapshot.ts +21 -132
- package/packages/studio/src/studio-preflight.ts +3 -3
- package/packages/studio/src/studio-registry.ts +72 -6
- package/packages/studio/src/style.css +342 -190
- package/packages/studio/src/temporal-edit.ts +131 -0
- package/packages/studio/src/ui/artifact-name.ts +80 -0
- package/packages/studio/src/ui/artifact-preview.ts +99 -0
- package/packages/studio/src/ui/comments.ts +233 -0
- package/packages/studio/src/ui/icons.ts +10 -1
- package/packages/studio/src/ui/library.ts +373 -192
- package/packages/studio/src/ui/main.ts +291 -110
- package/packages/studio/src/ui/material-preview.ts +1 -1
- package/packages/studio/src/ui/overlay.ts +31 -26
- package/packages/studio/src/ui/scrub-preview.ts +108 -0
- package/packages/studio/src/ui/sidebar-panel.ts +31 -0
- package/packages/studio/src/ui/stage.ts +188 -9
- package/packages/studio/src/ui/timeline.ts +187 -281
- package/packages/studio/start.ts +19 -5
- package/packages/studio-adapter/README.md +151 -11
- package/packages/studio-adapter/src/index.ts +126 -14
- package/packages/temporal/README.md +6 -6
- package/packages/temporal/package.json +1 -1
- package/packages/temporal/src/component.ts +5 -6
- package/packages/temporal/src/index.ts +8 -6
- package/packages/temporal/src/location.ts +11 -11
- package/packages/temporal/src/projection.ts +19 -19
- package/packages/temporal/src/rational.ts +4 -4
- package/packages/temporal-markup/EDITING.md +183 -0
- package/packages/temporal-markup/README.md +31 -11
- package/packages/temporal-markup/package.json +1 -1
- package/packages/temporal-markup/src/index.ts +20 -25
- package/packages/temporal-markup/src/space.ts +10 -41
- package/packages/timeline/README.md +31 -0
- package/packages/{semantic-track → timeline}/package.json +1 -1
- package/packages/timeline/src/activation.ts +8 -0
- package/packages/timeline/src/component.ts +24 -0
- package/packages/timeline/src/identity.ts +60 -0
- package/packages/timeline/src/index.ts +6 -0
- package/packages/{semantic-track → timeline}/src/location.ts +20 -20
- package/packages/timeline/src/manifest.ts +39 -0
- package/packages/{semantic-track → timeline}/src/projection.ts +14 -14
- package/packages/timeline/src/types.ts +24 -0
- package/packages/timeline-author/README.md +68 -0
- package/packages/{speech-track → timeline-author}/package.json +6 -4
- package/packages/timeline-author/src/activation.ts +22 -0
- package/packages/{speech-track → timeline-author}/src/component.ts +15 -13
- package/packages/{speech-track → timeline-author}/src/fragment.ts +14 -23
- package/packages/timeline-author/src/index.ts +7 -0
- package/packages/timeline-author/src/manifest.ts +78 -0
- package/packages/timeline-author/src/program.ts +107 -0
- package/packages/timeline-author/src/surface.ts +46 -0
- package/packages/timeline-author/src/types.ts +6 -0
- package/packages/typography-track/README.md +4 -4
- package/packages/typography-track/package.json +1 -1
- package/packages/typography-track/src/component.ts +4 -4
- package/packages/typography-track/src/fragment.ts +4 -3
- package/packages/typography-track/src/manifest.ts +11 -9
- package/packages/typography-track/src/program.ts +15 -15
- package/packages/typography-track/src/surface.ts +17 -18
- package/packages/typography-track-studio/package.json +8 -3
- package/packages/typography-track-studio/src/index.ts +5 -1
- package/packages/video-cli/README.md +16 -4
- package/packages/video-cli/package.json +2 -1
- package/packages/video-cli/src/creation.ts +25 -9
- package/packages/video-cli/src/index.ts +1 -1
- package/packages/video-cli/src/studio-distribution.ts +2 -1
- package/packages/volcengine-matting/README.md +3 -3
- package/packages/whisperx/README.md +8 -1
- package/packages/workspace/src/index.ts +2 -0
- package/packages/workspace-fs-node/README.md +4 -1
- package/packages/workspace-fs-node/src/workspace.ts +3 -1
- package/services/whisperx/README.md +14 -0
- package/services/whisperx/pyproject.toml +2 -0
- package/services/whisperx/uv.lock +20 -20
- package/packages/provider-hyperframes-aws-lambda/README.md +0 -30
- package/packages/provider-hyperframes-aws-lambda/package.json +0 -30
- package/packages/provider-hyperframes-aws-lambda/src/activation.ts +0 -97
- package/packages/provider-hyperframes-aws-lambda/src/client.ts +0 -114
- package/packages/provider-hyperframes-aws-lambda/src/index.ts +0 -21
- package/packages/provider-hyperframes-aws-lambda/src/provider.ts +0 -522
- package/packages/provider-kie/README.md +0 -134
- package/packages/provider-kie/package.json +0 -43
- package/packages/provider-kie/src/activation.ts +0 -71
- package/packages/provider-kie/src/index.ts +0 -10
- package/packages/provider-kie/src/mapping.ts +0 -182
- package/packages/provider-kie/src/provider.ts +0 -657
- package/packages/provider-kie/src/routes.ts +0 -150
- package/packages/provider-xiaomi-mimo/README.md +0 -32
- package/packages/provider-xiaomi-mimo/src/activation.ts +0 -57
- package/packages/provider-xiaomi-mimo/src/index.ts +0 -5
- package/packages/provider-xiaomi-mimo/src/provider.ts +0 -214
- package/packages/runtime/src/environment.ts +0 -6
- package/packages/semantic-track/README.md +0 -21
- package/packages/semantic-track/src/activation.ts +0 -8
- package/packages/semantic-track/src/component.ts +0 -24
- package/packages/semantic-track/src/identity.ts +0 -58
- package/packages/semantic-track/src/index.ts +0 -6
- package/packages/semantic-track/src/manifest.ts +0 -38
- package/packages/semantic-track/src/types.ts +0 -26
- package/packages/speech-track/README.md +0 -51
- package/packages/speech-track/src/activation.ts +0 -19
- package/packages/speech-track/src/index.ts +0 -7
- package/packages/speech-track/src/manifest.ts +0 -73
- package/packages/speech-track/src/program.ts +0 -64
- package/packages/speech-track/src/surface.ts +0 -35
- package/packages/speech-track/src/types.ts +0 -6
- package/packages/speech-track-studio/README.md +0 -3
- package/packages/speech-track-studio/package.json +0 -14
- package/packages/speech-track-studio/src/activation.ts +0 -7
- package/packages/speech-track-studio/src/index.ts +0 -40
- /package/packages/{cli → project-context-node}/src/project-context.ts +0 -0
- /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
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
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
|
-
|
|
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
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
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
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
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 {
|
|
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
|
-
|
|
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. */
|