@hypit/hypit 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +8 -1
- package/examples/semantic-composition/chat.svml +6 -5
- package/examples/semantic-composition/hypit.runtime.json +1 -1
- 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 +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 +21 -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 +66 -19
- 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 +10 -7
- 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 +109 -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 +30 -5
- package/packages/script/src/manifest.ts +4 -3
- package/packages/script/src/narrative.ts +1 -0
- package/packages/script/src/parser.ts +45 -6
- 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/LOCALIZATION.md +98 -0
- package/packages/studio/README.md +101 -14
- package/packages/studio/locales/en.json +197 -0
- package/packages/studio/locales/zh-CN.json +191 -0
- 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/localization-node.ts +46 -0
- package/packages/studio/src/localization.ts +85 -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 +223 -50
- package/packages/studio/src/ui/artifact-name.ts +8 -6
- package/packages/studio/src/ui/artifact-preview.ts +5 -4
- package/packages/studio/src/ui/code.ts +17 -16
- package/packages/studio/src/ui/comments.ts +234 -0
- package/packages/studio/src/ui/dropdown.ts +68 -0
- package/packages/studio/src/ui/i18n.ts +109 -0
- package/packages/studio/src/ui/icons.ts +6 -0
- package/packages/studio/src/ui/library.ts +76 -65
- package/packages/studio/src/ui/main.ts +223 -211
- package/packages/studio/src/ui/overlay.ts +12 -8
- package/packages/studio/src/ui/scrub-preview.ts +110 -0
- package/packages/studio/src/ui/stage.ts +93 -29
- package/packages/studio/src/ui/timeline.ts +190 -118
- package/packages/studio/start.ts +41 -22
- 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
|
@@ -1,20 +1,10 @@
|
|
|
1
|
-
import type { CaptionDocument
|
|
1
|
+
import type { CaptionDocument } from "@hypit/narrative";
|
|
2
2
|
import { canonicalStringify, canonicalize } from "@hypit/protocol";
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from "./display.js";
|
|
9
|
-
import type {
|
|
10
|
-
CaptionMuteApplication,
|
|
11
|
-
CaptionProgram,
|
|
12
|
-
CaptionStyleApplication,
|
|
13
|
-
CaptionStyleIntent,
|
|
14
|
-
CaptionWordStyleApplication,
|
|
15
|
-
} from "./types.js";
|
|
16
|
-
|
|
17
|
-
export type { CaptionMuteApplication, CaptionStyleApplication, CaptionWordStyleApplication } from "./types.js";
|
|
4
|
+
import { assertCaptionDocument } from "./display.js";
|
|
5
|
+
import { assertTemporalWindowFor } from "@hypit/temporal";
|
|
6
|
+
import type { TemporalWindow } from "@hypit/temporal";
|
|
7
|
+
import type { CaptionProgram, CaptionStyleIntent } from "./types.js";
|
|
18
8
|
|
|
19
9
|
const ID = /^[A-Za-z][A-Za-z0-9_.-]{0,127}$/u;
|
|
20
10
|
function assert(condition: unknown, message: string): asserts condition { if (!condition) throw new Error(message); }
|
|
@@ -22,7 +12,8 @@ function assert(condition: unknown, message: string): asserts condition { if (!c
|
|
|
22
12
|
export function sealCaptionStyle(value: CaptionStyleIntent): CaptionStyleIntent {
|
|
23
13
|
const result = canonicalize({
|
|
24
14
|
id: value.id,
|
|
25
|
-
rendering:
|
|
15
|
+
rendering: value.rendering === null ? null
|
|
16
|
+
: { family: value.rendering.family.trim(), parameters: canonicalize(value.rendering.parameters) },
|
|
26
17
|
}) as unknown as CaptionStyleIntent;
|
|
27
18
|
assertCaptionStyle(result);
|
|
28
19
|
return result;
|
|
@@ -30,6 +21,7 @@ export function sealCaptionStyle(value: CaptionStyleIntent): CaptionStyleIntent
|
|
|
30
21
|
|
|
31
22
|
export function assertCaptionStyle(value: CaptionStyleIntent): void {
|
|
32
23
|
assert(ID.test(value.id), "Caption Style identity is invalid");
|
|
24
|
+
if (value.rendering === null) return;
|
|
33
25
|
assert(value.rendering.family.trim().length > 0, `Caption Style ${value.id} rendering family is empty`);
|
|
34
26
|
canonicalize(value.rendering.parameters);
|
|
35
27
|
}
|
|
@@ -41,130 +33,27 @@ export function sealCaptionProgram(value: CaptionProgram): CaptionProgram {
|
|
|
41
33
|
}
|
|
42
34
|
|
|
43
35
|
export function assertCaptionProgram(value: CaptionProgram): void {
|
|
44
|
-
assert(ID.test(value.id), "Caption
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const styles = new Map(value.styles.map((style) => [style.id, style]));
|
|
48
|
-
assert(styles.size === value.styles.length, "Caption Program styles are repeated");
|
|
36
|
+
assert(ID.test(value.id) && value.documentId.length > 0, "Caption Track identity is invalid");
|
|
37
|
+
const styles = new Map(value.styles.map(style => [style.id, style]));
|
|
38
|
+
assert(styles.size === value.styles.length, "Caption Styles are repeated");
|
|
49
39
|
value.styles.forEach(assertCaptionStyle);
|
|
50
|
-
assert(new Set(value.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
assert(new Set(value.wordRuns.map((run) => run.id)).size === value.wordRuns.length,
|
|
57
|
-
"Caption Program word run ids are repeated");
|
|
58
|
-
const words = value.wordRuns.flatMap((run) => run.wordIds);
|
|
59
|
-
assert(new Set(words).size === words.length, "Caption Program word runs repeat a word");
|
|
60
|
-
assert(value.wordRuns.every((run) => styles.has(run.styleId) && run.wordIds.length > 0),
|
|
61
|
-
"Caption Program word run is invalid");
|
|
62
|
-
assert(new Set(value.mutedUnitIds).size === value.mutedUnitIds.length,
|
|
63
|
-
"Caption Program muted units are repeated");
|
|
40
|
+
assert(new Set(value.uses.map(use => use.window.subjectId)).size === value.uses.length, "Caption Use ids are repeated");
|
|
41
|
+
for (const use of value.uses) {
|
|
42
|
+
assertTemporalWindowFor(use.window, { subjectId: use.window.subjectId });
|
|
43
|
+
assert(styles.has(use.styleId), "Caption Use references an unknown Style");
|
|
44
|
+
assert(use.role === undefined || use.role.trim().length > 0, "Caption Role is empty");
|
|
45
|
+
}
|
|
64
46
|
}
|
|
65
|
-
|
|
66
47
|
export function assertCaptionProgramForDocument(value: CaptionProgram, document: CaptionDocument): void {
|
|
67
48
|
assertCaptionProgram(value);
|
|
68
49
|
assertCaptionDocument(document);
|
|
69
|
-
assert(value.documentId === document.id, "Caption
|
|
70
|
-
const expected = document.units.map((unit) => unit.id);
|
|
71
|
-
assert(value.runs.flatMap((run) => run.unitIds).join("\0") === expected.join("\0"),
|
|
72
|
-
"Caption Program must partition every Caption unit exactly once and in order");
|
|
73
|
-
const known = new Set(expected);
|
|
74
|
-
assert(value.mutedUnitIds.every((id) => known.has(id)), "Caption Program mutes an unknown unit");
|
|
75
|
-
const knownWords = new Set(document.words.map((word) => word.id));
|
|
76
|
-
assert(value.wordRuns.every((run) => run.wordIds.every((id) => knownWords.has(id))),
|
|
77
|
-
"Caption Program styles an unknown display word");
|
|
50
|
+
assert(value.documentId === document.id, "Caption Uses belong to another CaptionDocument");
|
|
78
51
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
assert(indices.length > 0 && indices.every((index) => index !== undefined),
|
|
86
|
-
"Caption unit subset contains an unknown unit");
|
|
87
|
-
assert(indices.every((index, position) => position === 0 || index! > indices[position - 1]!),
|
|
88
|
-
"Caption unit subset must be ordered and contain no repeated unit");
|
|
89
|
-
return [...value.unitIds];
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export function resolveCaptionProgram(
|
|
93
|
-
document: CaptionDocument,
|
|
94
|
-
narrative: Narrative,
|
|
95
|
-
id: string,
|
|
96
|
-
defaultStyle: CaptionStyleIntent,
|
|
97
|
-
applications: readonly CaptionStyleApplication[],
|
|
98
|
-
mutes: readonly CaptionMuteApplication[] = [],
|
|
99
|
-
wordApplications: readonly CaptionWordStyleApplication[] = [],
|
|
100
|
-
): CaptionProgram {
|
|
101
|
-
assertCaptionDocument(document);
|
|
102
|
-
assertCaptionStyle(defaultStyle);
|
|
103
|
-
const styles = new Map<string, CaptionStyleIntent>([[defaultStyle.id, defaultStyle]]);
|
|
104
|
-
const selected = applications.map((application) => {
|
|
105
|
-
assert(ID.test(application.id), "Caption Style Application identity is invalid");
|
|
106
|
-
assertCaptionStyle(application.style);
|
|
107
|
-
const unitIds = orderedSubset({ documentId: document.id, unitIds: application.unitIds }, document);
|
|
108
|
-
const previous = styles.get(application.style.id);
|
|
109
|
-
assert(previous === undefined || canonicalStringify(previous) === canonicalStringify(application.style),
|
|
110
|
-
`Caption Style ${application.style.id} has conflicting definitions`);
|
|
111
|
-
styles.set(application.style.id, application.style);
|
|
112
|
-
return { ...application, unitIds };
|
|
113
|
-
});
|
|
114
|
-
const muted = mutes.flatMap((application) => {
|
|
115
|
-
assert(ID.test(application.id), "Caption Mute identity is invalid");
|
|
116
|
-
return orderedSubset({ documentId: document.id, unitIds: application.unitIds }, document);
|
|
52
|
+
export function appendCaptionUse(program: CaptionProgram, window: TemporalWindow, style: CaptionStyleIntent, role?: string): CaptionProgram {
|
|
53
|
+
const previous = program.styles.find(item => item.id === style.id);
|
|
54
|
+
assert(previous === undefined || canonicalStringify(previous) === canonicalStringify(style), `Caption Style ${style.id} has conflicting definitions`);
|
|
55
|
+
return sealCaptionProgram({ ...program,
|
|
56
|
+
styles: previous === undefined ? [...program.styles, style] : program.styles,
|
|
57
|
+
uses: [...program.uses, { window, styleId: style.id, ...(role === undefined ? {} : { role }) }],
|
|
117
58
|
});
|
|
118
|
-
const wordChosen = new Map<string, string>();
|
|
119
|
-
for (const application of wordApplications) {
|
|
120
|
-
assert(ID.test(application.id), "Caption Word Style Application identity is invalid");
|
|
121
|
-
assert(application.attribute.trim().length > 0, "Caption Word Style Application attribute is empty");
|
|
122
|
-
assertCaptionStyle(application.style);
|
|
123
|
-
const knownWordIds = new Set(document.words.map((word) => word.id));
|
|
124
|
-
for (const wordId of application.wordIds) {
|
|
125
|
-
assert(knownWordIds.has(wordId), `Caption Word Style Application references unknown word ${wordId}`);
|
|
126
|
-
const previous = wordChosen.get(wordId);
|
|
127
|
-
assert(previous === undefined || previous === application.style.id,
|
|
128
|
-
`Caption word ${wordId} receives conflicting styles`);
|
|
129
|
-
wordChosen.set(wordId, application.style.id);
|
|
130
|
-
}
|
|
131
|
-
const previous = styles.get(application.style.id);
|
|
132
|
-
assert(previous === undefined || canonicalStringify(previous) === canonicalStringify(application.style),
|
|
133
|
-
`Caption Style ${application.style.id} has conflicting definitions`);
|
|
134
|
-
styles.set(application.style.id, application.style);
|
|
135
|
-
}
|
|
136
|
-
const chosen = new Map(document.units.map((unit) => [unit.id, defaultStyle.id]));
|
|
137
|
-
for (const application of selected) for (const unitId of application.unitIds) chosen.set(unitId, application.style.id);
|
|
138
|
-
const runs: CaptionProgram["runs"][number][] = [];
|
|
139
|
-
for (const unit of document.units) {
|
|
140
|
-
const styleId = chosen.get(unit.id)!;
|
|
141
|
-
const previous = runs.at(-1);
|
|
142
|
-
if (previous === undefined || previous.styleId !== styleId) {
|
|
143
|
-
runs.push({ id: `${id}:run:${runs.length + 1}`, styleId, unitIds: [unit.id] });
|
|
144
|
-
} else {
|
|
145
|
-
runs[runs.length - 1] = { ...previous, unitIds: [...previous.unitIds, unit.id] };
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
const wordRuns: CaptionProgram["wordRuns"][number][] = [];
|
|
149
|
-
for (const [wordId, styleId] of wordChosen) {
|
|
150
|
-
const previous = wordRuns.at(-1);
|
|
151
|
-
if (previous === undefined || previous.styleId !== styleId) {
|
|
152
|
-
wordRuns.push({ id: `${id}:word-run:${wordRuns.length + 1}`, styleId, wordIds: [wordId] });
|
|
153
|
-
} else {
|
|
154
|
-
wordRuns[wordRuns.length - 1] = { ...previous, wordIds: [...previous.wordIds, wordId] };
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
const program = sealCaptionProgram({
|
|
158
|
-
id,
|
|
159
|
-
documentId: document.id,
|
|
160
|
-
styles: [...styles.values()].filter((style) => [...chosen.values(), ...wordChosen.values()].includes(style.id)),
|
|
161
|
-
runs,
|
|
162
|
-
wordRuns,
|
|
163
|
-
mutedUnitIds: [...new Set(muted)],
|
|
164
|
-
});
|
|
165
|
-
assertCaptionProgramForDocument(program, document);
|
|
166
|
-
void narrative;
|
|
167
|
-
return program;
|
|
168
59
|
}
|
|
169
|
-
|
|
170
|
-
export { captionUnitsForRole };
|
|
@@ -1,96 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import type { StructuredElement, StructuredSurfaceHandler, SurfaceResolvedReference, MarkupAttributeValue } from "@hypit/markup";
|
|
4
|
-
|
|
1
|
+
import type { StructuredSurfaceHandler } from "@hypit/markup";
|
|
2
|
+
import { assertAttributes, assertEmptyElement, textAttribute } from "@hypit/markup";
|
|
5
3
|
import { captionTypes } from "./manifest.js";
|
|
6
|
-
import {
|
|
7
|
-
import { resolveCaptionProgram } from "./style.js";
|
|
8
|
-
import type { CaptionMuteApplication, CaptionStyleApplication, CaptionStyleIntent, CaptionWordStyleApplication } from "./types.js";
|
|
9
|
-
|
|
10
|
-
function sameType(left: SurfaceResolvedReference["type"], right: SurfaceResolvedReference["type"]): boolean {
|
|
11
|
-
return left.module.name === right.module.name && left.module.version === right.module.version && left.name === right.name;
|
|
12
|
-
}
|
|
13
|
-
function attributes(element: StructuredElement, required: readonly string[], optional: readonly string[] = []): void {
|
|
14
|
-
const allowed = new Set([...required, ...optional]);
|
|
15
|
-
const actual = Object.keys(element.attributes);
|
|
16
|
-
if (required.some((name) => element.attributes[name] === undefined) || actual.some((name) => !allowed.has(name))) {
|
|
17
|
-
throw new Error(`${element.name} requires ${required.join(", ")}${optional.length ? `; optional: ${optional.join(", ")}` : ""}`);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
function stringAttribute(element: StructuredElement, name: string): string {
|
|
21
|
-
const value = element.attributes[name];
|
|
22
|
-
if (typeof value !== "string" || !value.trim()) throw new Error(`${element.name}.${name} must be a non-empty string`);
|
|
23
|
-
return value.trim();
|
|
24
|
-
}
|
|
25
|
-
function optionalString(element: StructuredElement, name: string): string | undefined {
|
|
26
|
-
const value = element.attributes[name];
|
|
27
|
-
if (value === undefined) return undefined;
|
|
28
|
-
if (typeof value !== "string" || !value.trim()) throw new Error(`${element.name}.${name} must be a non-empty string`);
|
|
29
|
-
return value.trim();
|
|
30
|
-
}
|
|
31
|
-
function reference(
|
|
32
|
-
element: StructuredElement,
|
|
33
|
-
name: string,
|
|
34
|
-
expected: SurfaceResolvedReference["type"],
|
|
35
|
-
resolveReference: (path: string) => SurfaceResolvedReference | undefined,
|
|
36
|
-
): SurfaceResolvedReference {
|
|
37
|
-
const raw: MarkupAttributeValue | undefined = element.attributes[name];
|
|
38
|
-
if (typeof raw !== "object" || raw.kind !== "reference") throw new Error(`${element.name}.${name} must be a whole-value reference`);
|
|
39
|
-
const value = resolveReference(raw.path);
|
|
40
|
-
if (value === undefined) throw new Error(`${element.name}.${name} cannot resolve ${raw.path}`);
|
|
41
|
-
if (!sameType(value.type, expected)) throw new Error(`${element.name}.${name} has the wrong type`);
|
|
42
|
-
return value;
|
|
43
|
-
}
|
|
44
|
-
function inline<T>(referenceValue: SurfaceResolvedReference, subject: string): T {
|
|
45
|
-
if (referenceValue.record?.value.kind !== "inline") throw new Error(`${subject} must reference an authored inline Record`);
|
|
46
|
-
return referenceValue.record.value.value as unknown as T;
|
|
47
|
-
}
|
|
48
|
-
function localName(name: string): string { const index = name.lastIndexOf(":"); return index < 0 ? name : name.slice(index + 1); }
|
|
4
|
+
import { sealCaptionStyle } from "./style.js";
|
|
49
5
|
|
|
50
|
-
export const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const applications: CaptionStyleApplication[] = [];
|
|
57
|
-
const wordApplications: CaptionWordStyleApplication[] = [];
|
|
58
|
-
const mutes: CaptionMuteApplication[] = [];
|
|
59
|
-
for (const child of element.children) {
|
|
60
|
-
if (child.kind === "text") { if (child.value.trim()) throw new Error(`${element.name} accepts only Use or Mute children`); continue; }
|
|
61
|
-
const childName = localName(child.name);
|
|
62
|
-
if (childName !== "Use" && childName !== "Mute") throw new Error(`${element.name} accepts only Use or Mute children`);
|
|
63
|
-
attributes(child, childName === "Use" ? ["style"] : [], ["role", "selection", "attribute"]);
|
|
64
|
-
const role = optionalString(child, "role");
|
|
65
|
-
const attribute = optionalString(child, "attribute");
|
|
66
|
-
const selectionRaw = child.attributes.selection;
|
|
67
|
-
const selectors = [role !== undefined, selectionRaw !== undefined, attribute !== undefined].filter(Boolean).length;
|
|
68
|
-
if (selectors !== 1) throw new Error(`${child.name} requires exactly one of role, selection or attribute`);
|
|
69
|
-
if (childName === "Mute" && attribute !== undefined) throw new Error(`${child.name} cannot mute a token attribute`);
|
|
70
|
-
if (attribute !== undefined) {
|
|
71
|
-
const wordIds = captionWordsForAttribute(document, attribute);
|
|
72
|
-
wordApplications.push({
|
|
73
|
-
id: `${id}.word-use.${wordApplications.length + 1}`,
|
|
74
|
-
attribute,
|
|
75
|
-
wordIds,
|
|
76
|
-
style: inline<CaptionStyleIntent>(reference(child, "style", captionTypes.style, resolveReference), `${child.name}.style`),
|
|
77
|
-
});
|
|
78
|
-
continue;
|
|
79
|
-
}
|
|
80
|
-
const unitIds = role !== undefined
|
|
81
|
-
? captionUnitsForRole(document, role).unitIds
|
|
82
|
-
: captionUnitsForSelection(
|
|
83
|
-
document,
|
|
84
|
-
narrative,
|
|
85
|
-
inline<NarrativeSelection>(reference(child, "selection", narrativeTypes.selection, resolveReference), `${child.name}.selection`),
|
|
86
|
-
).unitIds;
|
|
87
|
-
if (childName === "Mute") mutes.push({ id: `${id}.mute.${mutes.length + 1}`, unitIds });
|
|
88
|
-
else applications.push({
|
|
89
|
-
id: `${id}.use.${applications.length + 1}`,
|
|
90
|
-
unitIds,
|
|
91
|
-
style: inline<CaptionStyleIntent>(reference(child, "style", captionTypes.style, resolveReference), `${child.name}.style`),
|
|
92
|
-
});
|
|
6
|
+
export const decodeHiddenCaptionStyleSurface: StructuredSurfaceHandler = ({ element }) => {
|
|
7
|
+
assertAttributes(element, ["id"]);
|
|
8
|
+
assertEmptyElement(element);
|
|
9
|
+
const id = textAttribute(element, "id");
|
|
10
|
+
if (element.children.some(child => child.kind !== "text" || child.value.trim())) {
|
|
11
|
+
throw new Error(`${element.name} accepts no children`);
|
|
93
12
|
}
|
|
94
|
-
|
|
95
|
-
|
|
13
|
+
return { records: [{ id, type: captionTypes.style,
|
|
14
|
+
value: { kind: "inline", value: sealCaptionStyle({ id, rendering: null }) }, range: element.range }],
|
|
15
|
+
components: [], fragments: [] };
|
|
96
16
|
};
|
|
@@ -1,64 +1,55 @@
|
|
|
1
1
|
import type { CaptionDocument } from "@hypit/narrative";
|
|
2
|
-
import {
|
|
3
|
-
import type {
|
|
2
|
+
import { projectTimelineSpace, tokenFrameSpan } from "@hypit/timeline";
|
|
3
|
+
import type { Timeline } from "@hypit/timeline";
|
|
4
4
|
|
|
5
5
|
import { CaptionTimingError } from "./error.js";
|
|
6
6
|
import { assertCaptionDocument } from "./display.js";
|
|
7
|
-
import {
|
|
8
|
-
import type { CaptionProgram, TimedCaptionProjection, TimedCaptionCue, TimedCaptionUnit } from "./types.js";
|
|
7
|
+
import type { TimedCaptionProjection, TimedCaptionCue, TimedCaptionUnit } from "./types.js";
|
|
9
8
|
|
|
10
9
|
export function temporalizeCaptionDocument(
|
|
11
10
|
document: CaptionDocument,
|
|
12
|
-
semantic:
|
|
13
|
-
program: CaptionProgram,
|
|
11
|
+
semantic: Timeline,
|
|
14
12
|
): TimedCaptionProjection {
|
|
15
13
|
assertCaptionDocument(document);
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
throw new CaptionTimingError("CAPTION_NARRATIVE", "CaptionDocument and SemanticTrack belong to different Narratives.");
|
|
14
|
+
const space = projectTimelineSpace(semantic);
|
|
15
|
+
if (semantic.narrativeId !== undefined && document.narrativeId !== semantic.narrativeId) {
|
|
16
|
+
throw new CaptionTimingError("CAPTION_NARRATIVE", "CaptionDocument and Timeline belong to different Narratives.");
|
|
20
17
|
}
|
|
21
|
-
const styleByUnit = new Map(program.runs.flatMap((run) => run.unitIds.map((unitId) => [unitId, run.styleId] as const)));
|
|
22
|
-
const muted = new Set(program.mutedUnitIds);
|
|
23
18
|
const breaks = new Set(document.cueBreaks.map((cueBreak) => cueBreak.afterUnitId));
|
|
24
|
-
const timed: Array<{ unit: CaptionDocument["units"][number];
|
|
19
|
+
const timed: Array<{ unit: CaptionDocument["units"][number]; timing: TimedCaptionUnit }> = [];
|
|
25
20
|
for (const unit of document.units) {
|
|
26
|
-
if (muted.has(unit.id)) continue;
|
|
27
|
-
const styleId = styleByUnit.get(unit.id);
|
|
28
|
-
if (styleId === undefined) throw new CaptionTimingError("CAPTION_UNIT", `Caption unit ${unit.id} has no Style.`);
|
|
29
21
|
const window = tokenFrameSpan(semantic, unit.sourceTokenIds);
|
|
30
|
-
if (window === undefined)
|
|
22
|
+
if (window === undefined) continue;
|
|
31
23
|
if (window.endFrameExclusive < window.startFrame) {
|
|
32
24
|
throw new CaptionTimingError("CAPTION_SPEECH_ORDER", `Caption unit ${unit.id} references speech Tokens in reverse order.`);
|
|
33
25
|
}
|
|
34
26
|
const startFrame = window.startFrame;
|
|
35
27
|
const endFrameExclusive = Math.max(startFrame + 1, window.endFrameExclusive);
|
|
36
|
-
timed.push({ unit,
|
|
28
|
+
timed.push({ unit, timing: { unitId: unit.id, startFrame, endFrameExclusive } });
|
|
37
29
|
}
|
|
38
30
|
const cues: TimedCaptionCue[] = [];
|
|
39
|
-
let current: {
|
|
31
|
+
let current: { units: TimedCaptionUnit[]; segmentId: string; turnId: string } | undefined;
|
|
40
32
|
const flush = (): void => {
|
|
41
33
|
if (current === undefined || current.units.length === 0) return;
|
|
42
34
|
cues.push({
|
|
43
|
-
id: `${
|
|
44
|
-
styleId: current.styleId,
|
|
35
|
+
id: `${document.id}:cue:${cues.length + 1}`,
|
|
45
36
|
startFrame: current.units[0]!.startFrame,
|
|
46
37
|
endFrameExclusive: current.units.at(-1)!.endFrameExclusive,
|
|
47
38
|
units: current.units,
|
|
48
39
|
});
|
|
49
40
|
current = undefined;
|
|
50
41
|
};
|
|
42
|
+
const documentOrder = new Map(document.units.map((unit, index) => [unit.id, index]));
|
|
51
43
|
for (const [index, entry] of timed.entries()) {
|
|
52
44
|
const previousDocumentUnit = index === 0 ? undefined : timed[index - 1]!.unit;
|
|
53
45
|
const mustBreak = current !== undefined && (
|
|
54
|
-
current.
|
|
55
|
-
|| current.segmentId !== entry.unit.segmentId
|
|
46
|
+
current.segmentId !== entry.unit.segmentId
|
|
56
47
|
|| current.turnId !== entry.unit.turnId
|
|
57
|
-
|| (previousDocumentUnit !== undefined && breaks.has(previousDocumentUnit.id)
|
|
48
|
+
|| (previousDocumentUnit !== undefined && (breaks.has(previousDocumentUnit.id)
|
|
49
|
+
|| documentOrder.get(entry.unit.id)! !== documentOrder.get(previousDocumentUnit.id)! + 1))
|
|
58
50
|
);
|
|
59
51
|
if (mustBreak) flush();
|
|
60
52
|
if (current === undefined) current = {
|
|
61
|
-
styleId: entry.styleId,
|
|
62
53
|
units: [],
|
|
63
54
|
segmentId: entry.unit.segmentId,
|
|
64
55
|
turnId: entry.unit.turnId,
|
|
@@ -68,7 +59,7 @@ export function temporalizeCaptionDocument(
|
|
|
68
59
|
flush();
|
|
69
60
|
const result: TimedCaptionProjection = {
|
|
70
61
|
spaceId: space.id,
|
|
71
|
-
narrativeId:
|
|
62
|
+
narrativeId: document.narrativeId,
|
|
72
63
|
documentId: document.id,
|
|
73
64
|
cues,
|
|
74
65
|
};
|
|
@@ -76,32 +67,6 @@ export function temporalizeCaptionDocument(
|
|
|
76
67
|
return result;
|
|
77
68
|
}
|
|
78
69
|
|
|
79
|
-
export function applyCaptionMute(
|
|
80
|
-
projection: TimedCaptionProjection,
|
|
81
|
-
program: CaptionProgram,
|
|
82
|
-
document: CaptionDocument,
|
|
83
|
-
): TimedCaptionProjection {
|
|
84
|
-
assertCaptionDocument(document);
|
|
85
|
-
assertCaptionProgramForDocument(program, document);
|
|
86
|
-
if (projection.documentId !== document.id || projection.narrativeId !== document.narrativeId) {
|
|
87
|
-
throw new Error("Caption Mute received another CaptionDocument or Narrative");
|
|
88
|
-
}
|
|
89
|
-
const muted = new Set(program.mutedUnitIds);
|
|
90
|
-
const cues = projection.cues.flatMap((cue) => {
|
|
91
|
-
const units = cue.units.filter((unit) => !muted.has(unit.unitId));
|
|
92
|
-
if (units.length === 0) return [];
|
|
93
|
-
return [{ ...cue, units, startFrame: units[0]!.startFrame, endFrameExclusive: units.at(-1)!.endFrameExclusive }];
|
|
94
|
-
});
|
|
95
|
-
const result = {
|
|
96
|
-
spaceId: projection.spaceId,
|
|
97
|
-
narrativeId: projection.narrativeId,
|
|
98
|
-
documentId: projection.documentId,
|
|
99
|
-
cues,
|
|
100
|
-
};
|
|
101
|
-
assertTimedCaptionProjection(result);
|
|
102
|
-
return result;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
70
|
export function assertTimedCaptionProjection(projection: TimedCaptionProjection): void {
|
|
106
71
|
if (projection.spaceId.length === 0 || projection.narrativeId.length === 0 || projection.documentId.length === 0) {
|
|
107
72
|
throw new Error("TimedCaptionProjection provenance is invalid");
|
|
@@ -109,7 +74,7 @@ export function assertTimedCaptionProjection(projection: TimedCaptionProjection)
|
|
|
109
74
|
const cueIds = new Set<string>();
|
|
110
75
|
const unitIds = new Set<string>();
|
|
111
76
|
for (const cue of projection.cues) {
|
|
112
|
-
if (cue.id.length === 0 || cueIds.has(cue.id) || cue.
|
|
77
|
+
if (cue.id.length === 0 || cueIds.has(cue.id) || cue.units.length === 0
|
|
113
78
|
|| !Number.isSafeInteger(cue.startFrame) || !Number.isSafeInteger(cue.endFrameExclusive)
|
|
114
79
|
|| cue.startFrame < 0 || cue.endFrameExclusive <= cue.startFrame) throw new Error("TimedCaptionProjection contains an invalid Cue");
|
|
115
80
|
cueIds.add(cue.id);
|
|
@@ -2,50 +2,24 @@ import type { CanonicalValue } from "@hypit/protocol";
|
|
|
2
2
|
|
|
3
3
|
export type CaptionStyleIntent = {
|
|
4
4
|
readonly id: string;
|
|
5
|
+
/** null selects no rendering; later Uses can select a visible Style again. */
|
|
5
6
|
readonly rendering: {
|
|
6
7
|
readonly family: string;
|
|
7
8
|
readonly parameters: CanonicalValue;
|
|
8
|
-
};
|
|
9
|
+
} | null;
|
|
9
10
|
};
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
readonly
|
|
14
|
-
readonly style: CaptionStyleIntent;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export type CaptionWordStyleApplication = {
|
|
18
|
-
readonly id: string;
|
|
19
|
-
readonly attribute: string;
|
|
20
|
-
readonly wordIds: readonly string[];
|
|
21
|
-
readonly style: CaptionStyleIntent;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export type CaptionMuteApplication = {
|
|
25
|
-
readonly id: string;
|
|
26
|
-
readonly unitIds: readonly string[];
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export type CaptionProgramRun = {
|
|
30
|
-
readonly id: string;
|
|
31
|
-
readonly styleId: string;
|
|
32
|
-
readonly unitIds: readonly string[];
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export type CaptionProgramWordRun = {
|
|
36
|
-
readonly id: string;
|
|
12
|
+
/** Ordered, resolved Uses owned by a Caption Track, not a separate author element. */
|
|
13
|
+
export type CaptionUse = {
|
|
14
|
+
readonly window: import("@hypit/temporal").TemporalWindow;
|
|
37
15
|
readonly styleId: string;
|
|
38
|
-
readonly
|
|
16
|
+
readonly role?: string;
|
|
39
17
|
};
|
|
40
|
-
|
|
41
18
|
export type CaptionProgram = {
|
|
42
19
|
readonly id: string;
|
|
43
20
|
readonly documentId: string;
|
|
44
21
|
readonly styles: readonly CaptionStyleIntent[];
|
|
45
|
-
readonly
|
|
46
|
-
/** Optional local word styles resolved from Script-native word attributes. */
|
|
47
|
-
readonly wordRuns: readonly CaptionProgramWordRun[];
|
|
48
|
-
readonly mutedUnitIds: readonly string[];
|
|
22
|
+
readonly uses: readonly CaptionUse[];
|
|
49
23
|
};
|
|
50
24
|
|
|
51
25
|
export type TimedCaptionUnit = {
|
|
@@ -56,14 +30,13 @@ export type TimedCaptionUnit = {
|
|
|
56
30
|
|
|
57
31
|
export type TimedCaptionCue = {
|
|
58
32
|
readonly id: string;
|
|
59
|
-
readonly styleId: string;
|
|
60
33
|
readonly startFrame: number;
|
|
61
34
|
readonly endFrameExclusive: number;
|
|
62
35
|
readonly units: readonly TimedCaptionUnit[];
|
|
63
36
|
};
|
|
64
37
|
|
|
65
38
|
export type TimedCaptionProjection = {
|
|
66
|
-
/** Semantic
|
|
39
|
+
/** Semantic Timeline from which every unit frame was measured. */
|
|
67
40
|
readonly spaceId: string;
|
|
68
41
|
readonly narrativeId: string;
|
|
69
42
|
readonly documentId: string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
type FrameSpan = { readonly startFrame: number; readonly endFrameExclusive: number };
|
|
2
|
+
import type { CaptionProgram } from "./types.js";
|
|
3
|
+
|
|
4
|
+
/** Later Uses replace this Cue's presentation inside their windows, including Hidden. */
|
|
5
|
+
export function captionUseVisibility(program: CaptionProgram, index: number, role: string | undefined, envelope: FrameSpan): FrameSpan[] {
|
|
6
|
+
const use = program.uses[index]!;
|
|
7
|
+
if (use.role !== undefined && use.role !== role) return [];
|
|
8
|
+
const startFrame = Math.max(envelope.startFrame, use.window.span.startFrame);
|
|
9
|
+
const endFrameExclusive = Math.min(envelope.endFrameExclusive, use.window.span.endFrameExclusive);
|
|
10
|
+
let visible = endFrameExclusive > startFrame ? [{ startFrame, endFrameExclusive }] : [];
|
|
11
|
+
for (const later of program.uses.slice(index + 1)) {
|
|
12
|
+
if (later.role !== undefined && later.role !== role) continue;
|
|
13
|
+
const cut = later.window.span;
|
|
14
|
+
visible = visible.flatMap(span => {
|
|
15
|
+
if (cut.startFrame >= span.endFrameExclusive || cut.endFrameExclusive <= span.startFrame) return [span];
|
|
16
|
+
return [
|
|
17
|
+
...(cut.startFrame > span.startFrame ? [{ startFrame: span.startFrame, endFrameExclusive: cut.startFrame }] : []),
|
|
18
|
+
...(cut.endFrameExclusive < span.endFrameExclusive ? [{ startFrame: cut.endFrameExclusive, endFrameExclusive: span.endFrameExclusive }] : []),
|
|
19
|
+
];
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return visible;
|
|
23
|
+
}
|
|
@@ -7,9 +7,11 @@ does not carry a private visual role.
|
|
|
7
7
|
|
|
8
8
|
```xml
|
|
9
9
|
<caption-fine:Style id="primary" recipe={recipes.caption.primary} font={caption-font}/>
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
<caption-fine:Track id="captions-track" document={story.caption}
|
|
12
|
-
|
|
12
|
+
timeline={speech.timeline}>
|
|
13
|
+
<caption-fine:Use style={primary}/>
|
|
14
|
+
</caption-fine:Track>
|
|
13
15
|
```
|
|
14
16
|
|
|
15
17
|
An optional Spatial Region Timeline replaces only the moving placement point. The timeline is authored
|
|
@@ -20,7 +22,9 @@ and a later Run can reuse the same media and alignment while changing placement:
|
|
|
20
22
|
```xml
|
|
21
23
|
<space:RegionTimeline id="heads" within={vertical} recipe={tracking.heads.default}/>
|
|
22
24
|
<caption-fine:Track id="captions-track" document={story.caption}
|
|
23
|
-
|
|
25
|
+
timeline={speech.timeline} regions={heads}>
|
|
26
|
+
<caption-fine:Use style={primary}/>
|
|
27
|
+
</caption-fine:Track>
|
|
24
28
|
```
|
|
25
29
|
|
|
26
30
|
With `regions`, every Cue must carry one Script Role. When the Region Timeline contains a measured region for that
|
|
@@ -45,16 +49,17 @@ One SVS Recipe freezes three public dimensions:
|
|
|
45
49
|
|
|
46
50
|
Caption first projects authored Script units onto semantic Word timing. Fine then produces an
|
|
47
51
|
explicit visible Schedule and renders that Schedule. Lead and tail never change the semantic Word
|
|
48
|
-
times used by Karaoke.
|
|
52
|
+
times used by Karaoke. Later Uses mask earlier presentation, including Hidden. The final visibility
|
|
53
|
+
is clipped to the winning Use Window while the original Cue envelope and animations are preserved.
|
|
49
54
|
|
|
50
55
|
The Fine Schedule preserves the Caption projection's ProgramSpace, Narrative and document identities.
|
|
51
56
|
The renderer rejects any mismatched Space or document. Studio may expose lead, tail and handoff as
|
|
52
57
|
ordinary parameter edits, but Cue rectangles remain read-only semantic evidence.
|
|
53
58
|
|
|
54
|
-
Script segments, turns
|
|
55
|
-
|
|
59
|
+
Script segments, turns and `||` organize complete Cues. Timed Uses select presentation without
|
|
60
|
+
changing that grouping. Fine applies uniform rules to the words of a Cue. A caption whose Cue contains structural roles or
|
|
56
61
|
relationships—such as an independently arranged oversized keyword and supporting phrase—can use
|
|
57
|
-
a new project Caption family. Reuse the common [Caption
|
|
62
|
+
a new project Caption family. Reuse the common [Caption content, timed Uses and timing](../caption/README.md),
|
|
58
63
|
and implement the new schedule and rendering behavior in that package. This is ordinary component
|
|
59
64
|
authorship; different colors or fonts alone can remain Fine Style choices.
|
|
60
65
|
|
|
@@ -82,6 +87,13 @@ individual Han characters as Display Words; punctuation stays with its display w
|
|
|
82
87
|
those units for timing and active Paint, while authored Cues remain complete reading phrases.
|
|
83
88
|
Dual Text retains its complete alignment unit even when it displays or speaks several words.
|
|
84
89
|
|
|
90
|
+
`<组件化|>` authors the same unit as `<组件化|组件化>` without repeating the speech. Fine's `step`
|
|
91
|
+
karaoke, active underline and active box treat that unit together using its first-to-last speech
|
|
92
|
+
interval. Ordinary Chinese characters around it retain their own activation times. This is an
|
|
93
|
+
explicit authored group, not a renderer-selected segmentation, and does not introduce a new Cue.
|
|
94
|
+
The underlying character anchors remain available to other Timeline consumers. `wipe` and
|
|
95
|
+
`typewriter` still animate inside the complete unit over its interval when deliberately selected.
|
|
96
|
+
|
|
85
97
|
`word-gap` applies between Latin words and at Chinese/Latin boundaries. Adjacent Han characters and
|
|
86
98
|
full-width punctuation carry no extra word gap. `letter-spacing` controls glyph tracking. Exact
|
|
87
99
|
font fallbacks supply the required glyphs; the layout does not select a font by language.
|
|
@@ -119,5 +131,5 @@ The Hypit Skill's Caption craft page owns grouping and visual direction.
|
|
|
119
131
|
primary face or a `<caption-fine:Fallback font={...}/>` child, just like a bundled face. See
|
|
120
132
|
[Media font assets](../media/README.md#font-files) and [the open catalog](../fonts-open/README.md).
|
|
121
133
|
|
|
122
|
-
The [Fine Studio Companion](../caption-fine-studio/src/index.ts) reads the same schedule and
|
|
123
|
-
Style references. It presents the actual Cue timing and exposes supported Style edits in the Inspector.
|
|
134
|
+
The [Fine Studio Companion](../caption-fine-studio/src/index.ts) reads the same schedule and authored Use
|
|
135
|
+
Style references. It presents the actual Cue timing and exposes Use timing and supported Style edits in the Inspector.
|
|
@@ -19,10 +19,12 @@
|
|
|
19
19
|
"@hypit/narrative": "workspace:*",
|
|
20
20
|
"@hypit/program-space": "workspace:*",
|
|
21
21
|
"@hypit/protocol": "workspace:*",
|
|
22
|
-
"@hypit/
|
|
22
|
+
"@hypit/timeline": "workspace:*",
|
|
23
23
|
"@hypit/spatial": "workspace:*",
|
|
24
24
|
"@hypit/svs": "workspace:*",
|
|
25
|
-
"@hypit/markup": "workspace:*"
|
|
25
|
+
"@hypit/markup": "workspace:*",
|
|
26
|
+
"@hypit/temporal": "workspace:*",
|
|
27
|
+
"@hypit/temporal-markup": "workspace:*"
|
|
26
28
|
},
|
|
27
29
|
"devDependencies": {
|
|
28
30
|
"@hypit/script": "workspace:*"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import type { Timeline } from "@hypit/timeline";
|
|
1
2
|
import type { CaptionProgram, TimedCaptionProjection } from "@hypit/caption";
|
|
2
3
|
import type { ComponentPackage } from "@hypit/component-kit";
|
|
3
4
|
import type { CaptionDocument } from "@hypit/narrative";
|
|
4
|
-
import type { ProgramSpace } from "@hypit/program-space";
|
|
5
5
|
import type { StoredValue } from "@hypit/protocol";
|
|
6
6
|
import { canonicalize } from "@hypit/protocol";
|
|
7
7
|
import type { SpatialRegionTimeline } from "@hypit/spatial";
|
|
@@ -36,7 +36,7 @@ export const captionFineComponent = {
|
|
|
36
36
|
inline<FineCaptionSchedule>(inputs.schedule?.value, "FineCaptionSchedule"),
|
|
37
37
|
inline<CaptionProgram>(inputs.program?.value, "CaptionProgram"),
|
|
38
38
|
inline<CaptionDocument>(inputs.document?.value, "CaptionDocument"),
|
|
39
|
-
inline<
|
|
39
|
+
inline<Timeline>(inputs.timeline?.value, "Timeline"),
|
|
40
40
|
)) } },
|
|
41
41
|
needs: {},
|
|
42
42
|
}),
|
|
@@ -48,7 +48,7 @@ export const captionFineComponent = {
|
|
|
48
48
|
inline<FineCaptionSchedule>(inputs.schedule?.value, "FineCaptionSchedule"),
|
|
49
49
|
inline<CaptionProgram>(inputs.program?.value, "CaptionProgram"),
|
|
50
50
|
inline<CaptionDocument>(inputs.document?.value, "CaptionDocument"),
|
|
51
|
-
inline<
|
|
51
|
+
inline<Timeline>(inputs.timeline?.value, "Timeline"),
|
|
52
52
|
inline<SpatialRegionTimeline>(inputs.regions?.value, "SpatialRegionTimeline"),
|
|
53
53
|
)) } },
|
|
54
54
|
needs: {},
|