@hypit/hypit 0.1.4 → 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 +4 -2
- 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 +77 -15
- 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 +32 -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 +28 -17
- 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 +11 -0
- package/packages/build-result/src/decode.ts +2 -0
- package/packages/build-result/src/execution-log.ts +17 -0
- package/packages/build-result/src/index.ts +1 -0
- package/packages/build-result/src/store.ts +14 -1
- package/packages/build-result/src/types.ts +3 -0
- package/packages/build-result-s3/src/repository.ts +4 -0
- 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 +14 -9
- 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 +26 -17
- package/packages/caption-fine/src/recipe.ts +7 -0
- package/packages/caption-fine/src/render.ts +14 -13
- 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 +3 -1
- package/packages/caption-fine-studio/src/activation.ts +3 -3
- package/packages/caption-fine-studio/src/index.ts +54 -42
- package/packages/cli/README.md +57 -4
- package/packages/cli/package.json +1 -0
- package/packages/cli/src/arguments.ts +25 -6
- package/packages/cli/src/build-planning.ts +3 -2
- package/packages/cli/src/command.ts +6 -0
- package/packages/cli/src/commands/environment.ts +28 -18
- 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 +3 -2
- package/packages/cli/src/main.ts +34 -42
- package/packages/cli/src/observation.ts +7 -1
- package/packages/cli/src/output.ts +65 -23
- 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/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/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/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 +16 -11
- 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/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 +22 -26
- package/packages/ranking/src/schedule.ts +16 -19
- package/packages/ranking/src/surface.ts +12 -13
- package/packages/ranking-studio/README.md +18 -0
- package/packages/ranking-studio/src/index.ts +61 -9
- 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/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 +24 -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 +92 -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 +2 -1
- package/packages/runtime-local/src/result-writer.ts +2 -0
- package/packages/runtime-local/src/runtime.ts +8 -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 +15 -2
- package/packages/script/src/manifest.ts +2 -2
- package/packages/script/src/narrative.ts +1 -0
- package/packages/script/src/surface.ts +4 -3
- package/packages/script/src/types.ts +1 -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 +7 -1
- 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/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 +15 -2
- package/packages/studio/README.md +88 -14
- package/packages/studio/package.json +8 -7
- 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/parameter-values.ts +43 -1
- package/packages/studio/src/parameters.ts +114 -24
- 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 +10 -6
- package/packages/studio/src/shared.ts +4 -2
- package/packages/studio/src/snapshot.ts +21 -132
- package/packages/studio/src/studio-preflight.ts +3 -3
- package/packages/studio/src/studio-registry.ts +50 -6
- package/packages/studio/src/style.css +209 -48
- package/packages/studio/src/ui/comments.ts +233 -0
- package/packages/studio/src/ui/icons.ts +5 -0
- package/packages/studio/src/ui/main.ts +145 -86
- package/packages/studio/src/ui/overlay.ts +12 -8
- package/packages/studio/src/ui/scrub-preview.ts +108 -0
- package/packages/studio/src/ui/stage.ts +67 -4
- package/packages/studio/src/ui/timeline.ts +177 -108
- package/packages/studio/start.ts +4 -2
- package/packages/studio-adapter/README.md +130 -11
- package/packages/studio-adapter/src/index.ts +100 -13
- 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 +2 -2
- package/packages/temporal-markup/README.md +27 -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/video-cli/README.md +4 -1
- package/packages/video-cli/package.json +2 -1
- package/packages/video-cli/src/creation.ts +14 -4
- 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 +1 -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
|
+
}
|
|
@@ -46,6 +46,7 @@ export type ManagedProgramOptions = LoadRuntimeConfigOptions & {
|
|
|
46
46
|
readonly onProgress?: (event: ManagedProgramProgress) => void;
|
|
47
47
|
/** When present, operate only programs backing at least one demanded capability. */
|
|
48
48
|
readonly capabilities?: readonly CapabilityRef[];
|
|
49
|
+
readonly endpoints?: readonly string[];
|
|
49
50
|
};
|
|
50
51
|
|
|
51
52
|
function independentPrograms(programs: readonly { instance: string; program: ManagedProgram }[]) {
|
|
@@ -266,7 +267,7 @@ async function bringUp(
|
|
|
266
267
|
const installLogPath = join(directory(root, program), "install.log");
|
|
267
268
|
if (program.installation !== undefined) {
|
|
268
269
|
const installation = await program.installation.probe();
|
|
269
|
-
if (installation.state !== "ready") {
|
|
270
|
+
if (installation.state !== "ready" || program.installation.prepareBeforeStart === true) {
|
|
270
271
|
await mkdir(directory(root, program), { recursive: true });
|
|
271
272
|
await rotateLog(installLogPath);
|
|
272
273
|
onProgress?.({ id: program.id, phase: "installing", logPath: installLogPath });
|
|
@@ -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;
|
|
@@ -331,11 +336,8 @@ export async function createLocalRuntime(
|
|
|
331
336
|
...credentialControl,
|
|
332
337
|
...resultWriter,
|
|
333
338
|
build: runBuild,
|
|
334
|
-
async workOnce() {
|
|
335
|
-
return await worker.runOnce();
|
|
336
|
-
},
|
|
337
|
-
async work(workOptions) {
|
|
338
|
-
await worker.run(workOptions);
|
|
339
|
+
async workOnce(workOptions) {
|
|
340
|
+
return await worker.runOnce(workOptions);
|
|
339
341
|
},
|
|
340
342
|
close() {
|
|
341
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. */
|
|
@@ -3,7 +3,6 @@ import { randomUUID } from "node:crypto";
|
|
|
3
3
|
import { mkdir, open, readFile, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
4
4
|
import { dirname, join, resolve } from "node:path";
|
|
5
5
|
|
|
6
|
-
import { canonicalStringify } from "@hypit/protocol";
|
|
7
6
|
|
|
8
7
|
import { processAlive, stopProcessTree } from "./process-control.js";
|
|
9
8
|
import { readProcessLogs } from "./process-logs.js";
|
|
@@ -17,7 +16,6 @@ export type RuntimeWorkerLaunch = {
|
|
|
17
16
|
|
|
18
17
|
export type RuntimeProcessState = {
|
|
19
18
|
readonly state: "running" | "stopped";
|
|
20
|
-
readonly configuration?: "current" | "changed";
|
|
21
19
|
readonly profile: string;
|
|
22
20
|
readonly pid?: number;
|
|
23
21
|
readonly startedAt?: number;
|
|
@@ -26,7 +24,6 @@ export type RuntimeProcessState = {
|
|
|
26
24
|
|
|
27
25
|
type ProcessRecord = {
|
|
28
26
|
readonly profile: string;
|
|
29
|
-
readonly profileConfig: string;
|
|
30
27
|
readonly owner: string;
|
|
31
28
|
readonly pid: number;
|
|
32
29
|
readonly startedAt: number;
|
|
@@ -68,12 +65,11 @@ async function rotateLog(path: string): Promise<void> {
|
|
|
68
65
|
await rename(path, previous);
|
|
69
66
|
}
|
|
70
67
|
|
|
71
|
-
async function record(
|
|
68
|
+
async function record(dataRoot: string): Promise<ProcessRecord | undefined> {
|
|
72
69
|
const path = paths(dataRoot).pid;
|
|
73
70
|
try {
|
|
74
71
|
const value = JSON.parse(await readFile(path, "utf8")) as ProcessRecord;
|
|
75
|
-
if (value.profile !==
|
|
76
|
-
|| typeof value.profileConfig !== "string" || value.profileConfig.length === 0
|
|
72
|
+
if (typeof value.profile !== "string" || value.profile.length === 0
|
|
77
73
|
|| typeof value.owner !== "string" || value.owner.length === 0
|
|
78
74
|
|| !Number.isSafeInteger(value.pid) || value.pid < 1
|
|
79
75
|
|| !Number.isSafeInteger(value.startedAt) || value.startedAt < 0) {
|
|
@@ -86,10 +82,6 @@ async function record(profile: string, dataRoot: string): Promise<ProcessRecord
|
|
|
86
82
|
}
|
|
87
83
|
}
|
|
88
84
|
|
|
89
|
-
async function profileConfig(profile: string): Promise<string> {
|
|
90
|
-
return canonicalStringify(JSON.parse(await readFile(resolve(profile), "utf8")));
|
|
91
|
-
}
|
|
92
|
-
|
|
93
85
|
async function readyOwner(path: string): Promise<string | undefined> {
|
|
94
86
|
try {
|
|
95
87
|
const value = (await readFile(path, "utf8")).trim();
|
|
@@ -105,13 +97,12 @@ export async function runtimeProcessStatus(
|
|
|
105
97
|
dataRoot: string,
|
|
106
98
|
): Promise<RuntimeProcessState> {
|
|
107
99
|
const location = paths(dataRoot);
|
|
108
|
-
const current = await record(
|
|
100
|
+
const current = await record(dataRoot);
|
|
109
101
|
if (current === undefined || !processAlive(current.pid)) {
|
|
110
102
|
return { state: "stopped", profile: resolve(profile), logPath: location.log };
|
|
111
103
|
}
|
|
112
104
|
return {
|
|
113
105
|
state: "running",
|
|
114
|
-
configuration: current.profileConfig === await profileConfig(profile) ? "current" : "changed",
|
|
115
106
|
profile: current.profile,
|
|
116
107
|
pid: current.pid,
|
|
117
108
|
startedAt: current.startedAt,
|
|
@@ -159,7 +150,7 @@ async function waitForReady(
|
|
|
159
150
|
const location = paths(dataRoot);
|
|
160
151
|
const deadline = Date.now() + timeoutMs;
|
|
161
152
|
while (Date.now() <= deadline) {
|
|
162
|
-
const current = await record(
|
|
153
|
+
const current = await record(dataRoot);
|
|
163
154
|
if (current === undefined || !processAlive(current.pid)) {
|
|
164
155
|
const log = await readProcessLogs(location.log, LOG_TAIL_BYTES);
|
|
165
156
|
throw new Error(`Runtime Worker exited before becoming ready${log.length === 0 ? "" : `: ${log.trim().split("\n").at(-1)}`}`);
|
|
@@ -197,18 +188,14 @@ export async function ensureRuntimeProcess(
|
|
|
197
188
|
try {
|
|
198
189
|
const current = await runtimeProcessStatus(profile, dataRoot);
|
|
199
190
|
if (current.state === "running") {
|
|
200
|
-
if (current.configuration === "changed") {
|
|
201
|
-
throw new Error("Runtime Profile changed while its Worker is running; stop and start the Worker to activate it");
|
|
202
|
-
}
|
|
203
191
|
return current;
|
|
204
192
|
}
|
|
205
|
-
const stale = await record(
|
|
193
|
+
const stale = await record(dataRoot).catch(() => undefined);
|
|
206
194
|
if (stale !== undefined && !processAlive(stale.pid)) {
|
|
207
195
|
await rm(location.pid, { force: true });
|
|
208
196
|
await rm(location.ready, { force: true });
|
|
209
197
|
}
|
|
210
198
|
const owner = `worker_${randomUUID()}`;
|
|
211
|
-
const activeProfileConfig = await profileConfig(absolute);
|
|
212
199
|
await rm(location.ready, { force: true });
|
|
213
200
|
await rotateLog(location.log);
|
|
214
201
|
const log = await open(location.log, "a");
|
|
@@ -252,7 +239,6 @@ export async function ensureRuntimeProcess(
|
|
|
252
239
|
const startedAt = Date.now();
|
|
253
240
|
await writeFile(location.pid, JSON.stringify({
|
|
254
241
|
profile: absolute,
|
|
255
|
-
profileConfig: activeProfileConfig,
|
|
256
242
|
owner,
|
|
257
243
|
pid: child.pid,
|
|
258
244
|
startedAt,
|
|
@@ -260,9 +246,6 @@ export async function ensureRuntimeProcess(
|
|
|
260
246
|
child.unref?.();
|
|
261
247
|
try {
|
|
262
248
|
const ready = await waitForReady(absolute, dataRoot, owner, timeoutMs);
|
|
263
|
-
if (ready.configuration === "changed") {
|
|
264
|
-
throw new Error("Runtime Profile changed while its Worker was starting; start it again to activate the new Profile");
|
|
265
|
-
}
|
|
266
249
|
return ready;
|
|
267
250
|
} catch (error) {
|
|
268
251
|
const stopped = await stopProcessTree(child.pid, true).catch(() => "denied" as const);
|
|
@@ -272,7 +255,7 @@ export async function ensureRuntimeProcess(
|
|
|
272
255
|
{ cause: error },
|
|
273
256
|
);
|
|
274
257
|
}
|
|
275
|
-
const saved = await record(
|
|
258
|
+
const saved = await record(dataRoot).catch(() => undefined);
|
|
276
259
|
if (saved?.owner === owner) {
|
|
277
260
|
await rm(location.pid, { force: true });
|
|
278
261
|
await rm(location.ready, { force: true });
|
|
@@ -288,7 +271,7 @@ export async function ensureRuntimeProcess(
|
|
|
288
271
|
}
|
|
289
272
|
|
|
290
273
|
async function stopRuntimeProcessUnlocked(profile: string, dataRoot: string, timeoutMs: number): Promise<RuntimeProcessState> {
|
|
291
|
-
const current = await record(
|
|
274
|
+
const current = await record(dataRoot);
|
|
292
275
|
const location = paths(dataRoot);
|
|
293
276
|
if (current === undefined || !processAlive(current.pid)) {
|
|
294
277
|
await rm(location.pid, { force: true });
|