dsh-hyperframes 0.3.1 → 0.4.0
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.en.md +6 -5
- package/README.md +7 -6
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -0
- package/package.json +63 -63
- package/skills/embedded-captions/SKILL.md +28 -3
- package/skills/embedded-captions/references/aesthetic-principles.md +2 -3
- package/skills/embedded-captions/references/rail.md +1 -1
- package/skills/embedded-captions/scripts/check-occlusion.cjs +4 -1
- package/skills/embedded-captions/scripts/check-overflow.cjs +1 -0
- package/skills/embedded-captions/scripts/check-rail-climax.cjs +5 -1
- package/skills/embedded-captions/scripts/fixtures/heroless/theme.json +11 -0
- package/skills/embedded-captions/scripts/hf-cli.cjs +33 -0
- package/skills/embedded-captions/scripts/make-theme.cjs +95 -57
- package/skills/embedded-captions/scripts/make-theme.test.mjs +131 -0
- package/skills/embedded-captions/scripts/matte.cjs +1 -13
- package/skills/embedded-captions/scripts/measure-layout.cjs +2 -1
- package/skills/embedded-captions/scripts/preview-frames.cjs +39 -11
- package/skills/embedded-captions/scripts/preview-frames.test.mjs +24 -0
- package/skills/embedded-captions/scripts/render-and-composite.sh +8 -52
- package/skills/embedded-captions/scripts/safe-zones.cjs +4 -1
- package/skills/embedded-captions/scripts/transcribe.cjs +5 -14
- package/skills/embedded-captions/scripts/transcribe.test.mjs +41 -0
- package/skills/faceless-explainer/SKILL.md +20 -16
- package/skills/faceless-explainer/references/story-design.md +1 -1
- package/skills/faceless-explainer/scripts/assemble-index.mjs +6 -4
- package/skills/faceless-explainer/scripts/assemble-index.test.mjs +57 -2
- package/skills/faceless-explainer/scripts/audio.mjs +2 -0
- package/skills/faceless-explainer/scripts/build-frame.mjs +6 -3
- package/skills/faceless-explainer/scripts/captions.mjs +7 -4
- package/skills/faceless-explainer/scripts/frame-packets.mjs +4 -4
- package/skills/faceless-explainer/scripts/lib/bgm-volume.mjs +4 -0
- package/skills/faceless-explainer/scripts/lib/captured-fonts.mjs +58 -0
- package/skills/{hyperframes-core → faceless-explainer}/scripts/lib/frame-packets-core.mjs +5 -23
- package/skills/faceless-explainer/scripts/lib/storyboard.mjs +1 -1
- package/skills/faceless-explainer/scripts/lib/transitions.json +3 -3
- package/skills/faceless-explainer/scripts/transitions.mjs +1 -0
- package/skills/faceless-explainer/scripts/transitions.test.mjs +2 -0
- package/skills/faceless-explainer/sub-agents/frame-worker.md +1 -1
- package/skills/figma/SKILL.md +2 -0
- package/skills/general-video/SKILL.md +13 -11
- package/skills/general-video/scripts/frame-packets.mjs +4 -4
- package/skills/general-video/scripts/lib/frame-packets-core.mjs +194 -0
- package/skills/general-video/sub-agents/frame-worker.md +1 -1
- package/skills/hyperframes/SKILL.md +40 -30
- package/skills/{hyperframes-core → hyperframes}/references/brief-contract.md +15 -15
- package/skills/{hyperframes-core → hyperframes}/references/brief-format.md +8 -8
- package/skills/hyperframes/references/capability-menu.md +2 -2
- package/skills/{hyperframes-core → hyperframes}/references/frame-worker-core.md +1 -1
- package/skills/hyperframes/references/intent-interview.md +16 -16
- package/skills/hyperframes/references/plugin-installation.md +43 -0
- package/skills/{hyperframes-core → hyperframes}/references/production-loop.md +11 -11
- package/skills/hyperframes/references/review-loop.md +37 -0
- package/skills/hyperframes/references/route-briefs.md +1 -1
- package/skills/hyperframes/references/routes/motion-graphics.md +1 -1
- package/skills/{hyperframes-core → hyperframes}/references/script-format.md +3 -3
- package/skills/hyperframes/references/skill-lifecycle.md +2 -0
- package/skills/{hyperframes-core → hyperframes}/references/storyboard-format.md +3 -34
- package/skills/hyperframes/scripts/lib/frame-packets-core.mjs +194 -0
- package/skills/hyperframes/scripts/plugin-cli.mjs +88 -0
- package/skills/hyperframes/scripts/plugin-cli.test.mjs +117 -0
- package/skills/hyperframes-animation/SKILL.md +5 -1
- package/skills/hyperframes-animation/adapters/gsap.md +1 -1
- package/skills/hyperframes-animation/adapters/lottie.md +15 -2
- package/skills/hyperframes-animation/adapters/three.md +14 -0
- package/skills/hyperframes-animation/blueprints/titlecard-reveal.md +1 -1
- package/skills/hyperframes-animation/references/motion-blur.md +133 -0
- package/skills/hyperframes-animation/rules/cursor-click-ripple.md +1 -1
- package/skills/hyperframes-animation/rules/dynamic-content-sequencing.md +1 -1
- package/skills/hyperframes-animation/rules/hacker-flip-3d.md +1 -1
- package/skills/hyperframes-animation/rules/kinetic-beat-slam.md +2 -2
- package/skills/hyperframes-animation/rules/motion-blur-streak.md +1 -1
- package/skills/hyperframes-animation/rules/vertical-spring-ticker.md +1 -1
- package/skills/hyperframes-animation/scripts/package-loader.mjs +47 -16
- package/skills/hyperframes-animation/scripts/package-loader.test.mjs +52 -0
- package/skills/hyperframes-animation/techniques.md +1 -1
- package/skills/hyperframes-animation/transitions/TRANSITION-REGISTRY.md +3 -3
- package/skills/hyperframes-animation/transitions/css-push.md +4 -4
- package/skills/hyperframes-audio/SKILL.md +30 -22
- package/skills/hyperframes-audio/scripts/carve.mjs +6 -3
- package/skills/hyperframes-audio/scripts/carve.test.mjs +16 -1
- package/skills/hyperframes-cli/SKILL.md +44 -35
- package/skills/hyperframes-cli/references/init-and-scaffold.md +8 -6
- package/skills/hyperframes-cli/references/lint-validate-inspect.md +3 -3
- package/skills/hyperframes-cli/references/preview-render.md +35 -32
- package/skills/hyperframes-cli/references/upgrade-info-misc.md +50 -1
- package/skills/hyperframes-core/SKILL.md +30 -24
- package/skills/hyperframes-core/references/composition-patterns.md +3 -42
- package/skills/hyperframes-core/references/creator-editing-recipes.md +131 -7
- package/skills/hyperframes-core/references/data-attributes.md +11 -11
- package/skills/hyperframes-core/references/determinism-rules.md +2 -19
- package/skills/hyperframes-core/references/full-screen-motion.md +0 -9
- package/skills/hyperframes-core/references/minimal-composition.md +2 -2
- package/skills/hyperframes-core/references/sub-compositions.md +3 -66
- package/skills/hyperframes-core/references/tailwind.md +1 -20
- package/skills/hyperframes-core/references/tracks-and-clips.md +2 -6
- package/skills/hyperframes-core/references/variables-and-media.md +3 -3
- package/skills/hyperframes-creative/SKILL.md +2 -0
- package/skills/hyperframes-creative/references/house-style.md +15 -15
- package/skills/hyperframes-creative/references/story-spine.md +3 -1
- package/skills/hyperframes-creative/references/storyboard-recipe.md +57 -0
- package/skills/hyperframes-creative/references/typography.md +1 -1
- package/skills/hyperframes-creative/scripts/package-loader.mjs +47 -16
- package/skills/hyperframes-creative/scripts/package-loader.test.mjs +52 -0
- package/skills/hyperframes-keyframes/SKILL.md +4 -2
- package/skills/hyperframes-registry/SKILL.md +3 -1
- package/skills/hyperframes-registry/references/contributing.md +8 -2
- package/skills/hyperframes-registry/references/discovery.md +20 -34
- package/skills/hyperframes-studio/SKILL.md +77 -0
- package/skills/media-use/SKILL.md +14 -12
- package/skills/media-use/audio/references/captions/authoring.md +4 -0
- package/skills/media-use/audio/references/remove-background.md +1 -1
- package/skills/media-use/audio/references/tts-to-captions.md +11 -2
- package/skills/media-use/audio/references/tts.md +84 -6
- package/skills/media-use/audio/scripts/audio.mjs +15 -6
- package/skills/media-use/audio/scripts/gemini-pipeline.test.mjs +113 -0
- package/skills/media-use/audio/scripts/lib/audio-meta.mjs +39 -0
- package/skills/media-use/audio/scripts/lib/audio-meta.test.mjs +136 -0
- package/skills/media-use/audio/scripts/lib/bgm-volume.mjs +4 -0
- package/skills/media-use/audio/scripts/lib/bgm.mjs +2 -6
- package/skills/media-use/audio/scripts/lib/gemini-auth.mjs +43 -0
- package/skills/media-use/audio/scripts/lib/gemini-auth.py +52 -0
- package/skills/media-use/audio/scripts/lib/gemini-auth.test.mjs +86 -0
- package/skills/media-use/audio/scripts/lib/gemini-auth_test.py +90 -0
- package/skills/media-use/audio/scripts/lib/gemini-tts.mjs +122 -0
- package/skills/media-use/audio/scripts/lib/gemini-tts.test.mjs +243 -0
- package/skills/media-use/audio/scripts/lib/heygen.mjs +2 -1
- package/skills/media-use/audio/scripts/lib/tts.mjs +15 -3
- package/skills/media-use/audio/scripts/wait-bgm.mjs +8 -4
- package/skills/media-use/audio/scripts/wait-bgm.test.mjs +65 -0
- package/skills/media-use/references/audio.md +3 -2
- package/skills/media-use/references/grading.md +7 -7
- package/skills/media-use/references/media-treatment-recipes.md +1 -1
- package/skills/media-use/references/memory.md +2 -2
- package/skills/media-use/references/meta.md +2 -2
- package/skills/media-use/references/operations.md +15 -13
- package/skills/media-use/references/resolve.md +22 -11
- package/skills/media-use/references/setup-providers.md +11 -11
- package/skills/media-use/scripts/audio-duck.mjs +19 -27
- package/skills/media-use/scripts/compatibility.test.mjs +96 -0
- package/skills/media-use/scripts/lib/config-lock.mjs +45 -0
- package/skills/media-use/scripts/lib/duck.mjs +16 -10
- package/skills/media-use/scripts/lib/media-fetch.mjs +85 -0
- package/skills/media-use/scripts/lib/media-home.mjs +20 -0
- package/skills/media-use/scripts/lib/npx-sync.mjs +28 -2
- package/skills/media-use/scripts/lib/prefs-store.mjs +2 -2
- package/skills/media-use/scripts/lib/recipe-store.mjs +2 -2
- package/skills/media-use/scripts/lib/telemetry.mjs +29 -41
- package/skills/media-use/scripts/lib/transcriptCutFade.mjs +21 -0
- package/skills/media-use/scripts/prefs.mjs +1 -1
- package/skills/media-use/scripts/recipe.mjs +1 -1
- package/skills/media-use/scripts/resolve-plugin.test.mjs +62 -0
- package/skills/media-use/scripts/resolve.mjs +27 -1267
- package/skills/media-use/scripts/transcribe.mjs +39 -25
- package/skills/media-use/scripts/transcribe.test.mjs +112 -0
- package/skills/media-use/scripts/transcript-cut.mjs +39 -8
- package/skills/media-use/scripts/transcript-cut.test.mjs +117 -0
- package/skills/motion-graphics/SKILL.md +3 -1
- package/skills/motion-graphics/agents/builder.md +1 -0
- package/skills/motion-graphics/agents/director.md +2 -1
- package/skills/motion-graphics/catalog-map.md +25 -13
- package/skills/motion-graphics/categories/charts/module.md +2 -1
- package/skills/motion-graphics/categories/lower-thirds/module.md +4 -0
- package/skills/motion-graphics/categories/news/module.md +1 -1
- package/skills/motion-graphics/references/motion-vocabulary.md +4 -0
- package/skills/music-to-video/SKILL.md +8 -6
- package/skills/music-to-video/references/montage.md +3 -6
- package/skills/music-to-video/references/motion-primitives/3d-card-flip/index.html +10 -111
- package/skills/music-to-video/references/motion-primitives/3d-card-flip/scene.html +119 -0
- package/skills/music-to-video/references/motion-primitives/bg-flow-field/index.html +11 -284
- package/skills/music-to-video/references/motion-primitives/bg-flow-field/scene.html +294 -0
- package/skills/music-to-video/references/motion-primitives/binary-decrypt/index.html +10 -76
- package/skills/music-to-video/references/motion-primitives/binary-decrypt/scene.html +85 -0
- package/skills/music-to-video/references/motion-primitives/blur-resolve/index.html +10 -52
- package/skills/music-to-video/references/motion-primitives/blur-resolve/scene.html +60 -0
- package/skills/music-to-video/references/motion-primitives/braam-punch/index.html +10 -92
- package/skills/music-to-video/references/motion-primitives/braam-punch/scene.html +100 -0
- package/skills/music-to-video/references/motion-primitives/chromatic-split/index.html +10 -103
- package/skills/music-to-video/references/motion-primitives/chromatic-split/scene.html +111 -0
- package/skills/music-to-video/references/motion-primitives/chrome-sweep/index.html +10 -60
- package/skills/music-to-video/references/motion-primitives/chrome-sweep/scene.html +68 -0
- package/skills/music-to-video/references/motion-primitives/counting-punch/index.html +10 -110
- package/skills/music-to-video/references/motion-primitives/counting-punch/scene.html +119 -0
- package/skills/music-to-video/references/motion-primitives/crash-zoom-in/index.html +10 -112
- package/skills/music-to-video/references/motion-primitives/crash-zoom-in/scene.html +120 -0
- package/skills/music-to-video/references/motion-primitives/datamosh-smear/index.html +10 -121
- package/skills/music-to-video/references/motion-primitives/datamosh-smear/scene.html +131 -0
- package/skills/music-to-video/references/motion-primitives/directional-fill/index.html +10 -90
- package/skills/music-to-video/references/motion-primitives/directional-fill/scene.html +103 -0
- package/skills/music-to-video/references/motion-primitives/dolly-zoom/index.html +10 -94
- package/skills/music-to-video/references/motion-primitives/dolly-zoom/scene.html +102 -0
- package/skills/music-to-video/references/motion-primitives/electric-arc/index.html +10 -100
- package/skills/music-to-video/references/motion-primitives/electric-arc/scene.html +105 -0
- package/skills/music-to-video/references/motion-primitives/flash-cut/index.html +10 -89
- package/skills/music-to-video/references/motion-primitives/flash-cut/scene.html +97 -0
- package/skills/music-to-video/references/motion-primitives/gooey-metaball/index.html +10 -197
- package/skills/music-to-video/references/motion-primitives/gooey-metaball/scene.html +206 -0
- package/skills/music-to-video/references/motion-primitives/hard-cut/index.html +10 -74
- package/skills/music-to-video/references/motion-primitives/hard-cut/scene.html +82 -0
- package/skills/music-to-video/references/motion-primitives/hypercut-whip/index.html +10 -36
- package/skills/music-to-video/references/motion-primitives/hypercut-whip/scene.html +44 -0
- package/skills/music-to-video/references/motion-primitives/iris-open/index.html +10 -61
- package/skills/music-to-video/references/motion-primitives/iris-open/scene.html +69 -0
- package/skills/music-to-video/references/motion-primitives/kinetic-letter-in/index.html +10 -55
- package/skills/music-to-video/references/motion-primitives/kinetic-letter-in/scene.html +64 -0
- package/skills/music-to-video/references/motion-primitives/liquid-morph/index.html +10 -88
- package/skills/music-to-video/references/motion-primitives/liquid-morph/scene.html +96 -0
- package/skills/music-to-video/references/motion-primitives/mask-reveal/index.html +10 -66
- package/skills/music-to-video/references/motion-primitives/mask-reveal/scene.html +74 -0
- package/skills/music-to-video/references/motion-primitives/mosaic-pack/index.html +10 -81
- package/skills/music-to-video/references/motion-primitives/mosaic-pack/scene.html +89 -0
- package/skills/music-to-video/references/motion-primitives/neon-flicker/index.html +10 -65
- package/skills/music-to-video/references/motion-primitives/neon-flicker/scene.html +73 -0
- package/skills/music-to-video/references/motion-primitives/outline-to-fill/index.html +10 -74
- package/skills/music-to-video/references/motion-primitives/outline-to-fill/scene.html +82 -0
- package/skills/music-to-video/references/motion-primitives/palette-flip/index.html +10 -89
- package/skills/music-to-video/references/motion-primitives/palette-flip/scene.html +97 -0
- package/skills/music-to-video/references/motion-primitives/particle-burst/index.html +10 -98
- package/skills/music-to-video/references/motion-primitives/particle-burst/scene.html +106 -0
- package/skills/music-to-video/references/motion-primitives/pixel-dissolve/index.html +10 -78
- package/skills/music-to-video/references/motion-primitives/pixel-dissolve/scene.html +86 -0
- package/skills/music-to-video/references/motion-primitives/radial-burst-lines/index.html +10 -117
- package/skills/music-to-video/references/motion-primitives/radial-burst-lines/scene.html +130 -0
- package/skills/music-to-video/references/motion-primitives/screen-shake/index.html +10 -70
- package/skills/music-to-video/references/motion-primitives/screen-shake/scene.html +78 -0
- package/skills/music-to-video/references/motion-primitives/slot-machine-reveal/index.html +10 -87
- package/skills/music-to-video/references/motion-primitives/slot-machine-reveal/scene.html +100 -0
- package/skills/music-to-video/references/motion-primitives/spotlight-sweep/index.html +10 -94
- package/skills/music-to-video/references/motion-primitives/spotlight-sweep/scene.html +102 -0
- package/skills/music-to-video/references/motion-primitives/staggered-exit/index.html +10 -74
- package/skills/music-to-video/references/motion-primitives/staggered-exit/scene.html +82 -0
- package/skills/music-to-video/references/motion-primitives/text-spectral-rays/index.html +11 -271
- package/skills/music-to-video/references/motion-primitives/text-spectral-rays/scene.html +280 -0
- package/skills/music-to-video/references/motion-primitives/text-wave-distort/index.html +10 -92
- package/skills/music-to-video/references/motion-primitives/text-wave-distort/scene.html +106 -0
- package/skills/music-to-video/references/motion-primitives/tile-mosaic/index.html +10 -101
- package/skills/music-to-video/references/motion-primitives/tile-mosaic/scene.html +109 -0
- package/skills/music-to-video/references/motion-primitives/typewriter-reveal/index.html +10 -79
- package/skills/music-to-video/references/motion-primitives/typewriter-reveal/scene.html +91 -0
- package/skills/music-to-video/references/motion-primitives/word-grid-burst/index.html +10 -83
- package/skills/music-to-video/references/motion-primitives/word-grid-burst/scene.html +96 -0
- package/skills/music-to-video/references/planning.md +2 -2
- package/skills/music-to-video/scripts/lib/storyboard.mjs +1 -1
- package/skills/music-to-video/sub-agents/frame-worker.md +2 -2
- package/skills/pr-to-video/SKILL.md +20 -16
- package/skills/pr-to-video/references/code-vocabulary.md +14 -12
- package/skills/pr-to-video/references/story-design.md +1 -1
- package/skills/pr-to-video/scripts/assemble-index.mjs +6 -4
- package/skills/pr-to-video/scripts/assemble-index.test.mjs +57 -2
- package/skills/pr-to-video/scripts/audio.mjs +2 -0
- package/skills/pr-to-video/scripts/build-frame.mjs +6 -3
- package/skills/pr-to-video/scripts/captions.mjs +7 -4
- package/skills/pr-to-video/scripts/captions.test.mjs +41 -0
- package/skills/pr-to-video/scripts/frame-packets.mjs +4 -4
- package/skills/pr-to-video/scripts/lib/bgm-volume.mjs +4 -0
- package/skills/pr-to-video/scripts/lib/captured-fonts.mjs +58 -0
- package/skills/pr-to-video/scripts/lib/frame-packets-core.mjs +194 -0
- package/skills/pr-to-video/scripts/lib/storyboard.mjs +1 -1
- package/skills/pr-to-video/scripts/lib/transitions.json +3 -3
- package/skills/pr-to-video/scripts/transitions.mjs +7 -5
- package/skills/pr-to-video/sub-agents/frame-worker.md +1 -1
- package/skills/product-launch-video/SKILL.md +20 -16
- package/skills/product-launch-video/references/story-design.md +1 -1
- package/skills/product-launch-video/scripts/assemble-index.mjs +6 -4
- package/skills/product-launch-video/scripts/assemble-index.test.mjs +57 -2
- package/skills/product-launch-video/scripts/audio.mjs +2 -0
- package/skills/product-launch-video/scripts/audio.test.mjs +16 -0
- package/skills/product-launch-video/scripts/build-frame-subsets.test.mjs +152 -0
- package/skills/product-launch-video/scripts/build-frame.mjs +6 -3
- package/skills/product-launch-video/scripts/captions.mjs +7 -4
- package/skills/product-launch-video/scripts/frame-packets.mjs +4 -4
- package/skills/product-launch-video/scripts/lib/bgm-volume.mjs +4 -0
- package/skills/product-launch-video/scripts/lib/captured-fonts.mjs +58 -0
- package/skills/product-launch-video/scripts/lib/frame-packets-core.mjs +194 -0
- package/skills/product-launch-video/scripts/lib/storyboard.mjs +1 -1
- package/skills/product-launch-video/scripts/lib/transitions.json +3 -3
- package/skills/product-launch-video/scripts/transitions.mjs +7 -5
- package/skills/product-launch-video/scripts/transitions.test.mjs +68 -0
- package/skills/product-launch-video/sub-agents/frame-worker.md +1 -1
- package/skills/remotion-to-hyperframes/SKILL.md +7 -4
- package/skills/remotion-to-hyperframes/assets/test-corpus/tier-1-title-card/expected.json +5 -5
- package/skills/remotion-to-hyperframes/assets/test-corpus/tier-1-title-card/hf-src/compositions/title.html +31 -0
- package/skills/remotion-to-hyperframes/assets/test-corpus/tier-1-title-card/hf-src/index.html +10 -25
- package/skills/remotion-to-hyperframes/assets/test-corpus/tier-2-multi-scene/README.md +8 -8
- package/skills/remotion-to-hyperframes/assets/test-corpus/tier-2-multi-scene/expected.json +9 -9
- package/skills/remotion-to-hyperframes/assets/test-corpus/tier-2-multi-scene/hf-src/compositions/scene-1.html +35 -0
- package/skills/remotion-to-hyperframes/assets/test-corpus/tier-2-multi-scene/hf-src/compositions/scene-2.html +35 -0
- package/skills/remotion-to-hyperframes/assets/test-corpus/tier-2-multi-scene/hf-src/compositions/scene-3.html +36 -0
- package/skills/remotion-to-hyperframes/assets/test-corpus/tier-2-multi-scene/hf-src/index.html +28 -71
- package/skills/remotion-to-hyperframes/assets/test-corpus/tier-3-data-driven/expected.json +3 -3
- package/skills/remotion-to-hyperframes/assets/test-corpus/tier-3-data-driven/hf-src/compositions/scene-1.html +52 -0
- package/skills/remotion-to-hyperframes/assets/test-corpus/tier-3-data-driven/hf-src/compositions/scene-2.html +99 -0
- package/skills/remotion-to-hyperframes/assets/test-corpus/tier-3-data-driven/hf-src/compositions/scene-3.html +55 -0
- package/skills/remotion-to-hyperframes/assets/test-corpus/tier-3-data-driven/hf-src/index.html +13 -212
- package/skills/remotion-to-hyperframes/references/api-map.md +16 -16
- package/skills/remotion-to-hyperframes/references/limitations.md +7 -7
- package/skills/remotion-to-hyperframes/references/lottie.md +5 -7
- package/skills/remotion-to-hyperframes/references/media.md +3 -3
- package/skills/remotion-to-hyperframes/references/parameters.md +5 -0
- package/skills/remotion-to-hyperframes/references/sequencing.md +71 -18
- package/skills/slideshow/SKILL.md +4 -1
- package/skills/slideshow/references/standalone-harness.md +0 -3
- package/skills/talking-head-recut/SKILL.md +10 -1
- package/skills/hyperframes-core/references/review-loop.md +0 -41
- package/skills/media-use/scripts/lib/adopt.mjs +0 -128
- package/skills/media-use/scripts/lib/adopt.test.mjs +0 -95
- package/skills/media-use/scripts/lib/bgm-provider.mjs +0 -20
- package/skills/media-use/scripts/lib/brand-provider.mjs +0 -59
- package/skills/media-use/scripts/lib/bundled-sfx-provider.mjs +0 -108
- package/skills/media-use/scripts/lib/bundled-sfx-provider.test.mjs +0 -85
- package/skills/media-use/scripts/lib/cache.mjs +0 -150
- package/skills/media-use/scripts/lib/candidates.mjs +0 -91
- package/skills/media-use/scripts/lib/candidates.test.mjs +0 -155
- package/skills/media-use/scripts/lib/codex-provider.mjs +0 -161
- package/skills/media-use/scripts/lib/codex-provider.test.mjs +0 -34
- package/skills/media-use/scripts/lib/coverage.test.mjs +0 -117
- package/skills/media-use/scripts/lib/cube-build.mjs +0 -181
- package/skills/media-use/scripts/lib/cube-build.test.mjs +0 -80
- package/skills/media-use/scripts/lib/cube-validate.mjs +0 -198
- package/skills/media-use/scripts/lib/cube-validate.test.mjs +0 -125
- package/skills/media-use/scripts/lib/cutlist.test.mjs +0 -148
- package/skills/media-use/scripts/lib/duck.test.mjs +0 -118
- package/skills/media-use/scripts/lib/error-diffusion.test.mjs +0 -102
- package/skills/media-use/scripts/lib/freeze.mjs +0 -70
- package/skills/media-use/scripts/lib/freeze.test.mjs +0 -46
- package/skills/media-use/scripts/lib/grade-analyzer.mjs +0 -264
- package/skills/media-use/scripts/lib/grade-analyzer.test.mjs +0 -285
- package/skills/media-use/scripts/lib/heygen-cli.mjs +0 -191
- package/skills/media-use/scripts/lib/heygen-cli.test.mjs +0 -301
- package/skills/media-use/scripts/lib/heygen-search.mjs +0 -45
- package/skills/media-use/scripts/lib/heygen-search.test.mjs +0 -49
- package/skills/media-use/scripts/lib/heygen-video-provider.mjs +0 -127
- package/skills/media-use/scripts/lib/heygen-video-provider.test.mjs +0 -344
- package/skills/media-use/scripts/lib/image-provider.mjs +0 -44
- package/skills/media-use/scripts/lib/local-models.mjs +0 -318
- package/skills/media-use/scripts/lib/local-models.test.mjs +0 -220
- package/skills/media-use/scripts/lib/local-run.mjs +0 -78
- package/skills/media-use/scripts/lib/local-run.test.mjs +0 -121
- package/skills/media-use/scripts/lib/logo-provider.mjs +0 -222
- package/skills/media-use/scripts/lib/logo-provider.test.mjs +0 -137
- package/skills/media-use/scripts/lib/ltx-video-provider.mjs +0 -94
- package/skills/media-use/scripts/lib/ltx-video-provider.test.mjs +0 -316
- package/skills/media-use/scripts/lib/lut-preset-provider.mjs +0 -266
- package/skills/media-use/scripts/lib/lut-preset-provider.test.mjs +0 -176
- package/skills/media-use/scripts/lib/manifest.test.mjs +0 -388
- package/skills/media-use/scripts/lib/match.mjs +0 -47
- package/skills/media-use/scripts/lib/mflux-provider.mjs +0 -128
- package/skills/media-use/scripts/lib/mflux-provider.test.mjs +0 -174
- package/skills/media-use/scripts/lib/misses.mjs +0 -49
- package/skills/media-use/scripts/lib/misses.test.mjs +0 -78
- package/skills/media-use/scripts/lib/npx-sync.test.mjs +0 -50
- package/skills/media-use/scripts/lib/parakeet-words.test.mjs +0 -44
- package/skills/media-use/scripts/lib/prefs-store.test.mjs +0 -189
- package/skills/media-use/scripts/lib/probe.mjs +0 -39
- package/skills/media-use/scripts/lib/probe.test.mjs +0 -31
- package/skills/media-use/scripts/lib/providers.mjs +0 -5
- package/skills/media-use/scripts/lib/recipe-store.test.mjs +0 -367
- package/skills/media-use/scripts/lib/registry.mjs +0 -218
- package/skills/media-use/scripts/lib/registry.test.mjs +0 -261
- package/skills/media-use/scripts/lib/search.mjs +0 -24
- package/skills/media-use/scripts/lib/search.test.mjs +0 -32
- package/skills/media-use/scripts/lib/sfx-provider.mjs +0 -23
- package/skills/media-use/scripts/lib/specs.mjs +0 -132
- package/skills/media-use/scripts/lib/specs.test.mjs +0 -157
- package/skills/media-use/scripts/lib/stats.mjs +0 -117
- package/skills/media-use/scripts/lib/stats.test.mjs +0 -165
- package/skills/media-use/scripts/lib/telemetry.test.mjs +0 -373
- package/skills/media-use/scripts/lib/tts-local-provider.mjs +0 -92
- package/skills/media-use/scripts/lib/tts-local-provider.test.mjs +0 -72
- package/skills/media-use/scripts/lib/usage.mjs +0 -57
- package/skills/media-use/scripts/lib/usage.test.mjs +0 -54
- package/skills/media-use/scripts/lib/voice-provider.mjs +0 -57
- package/skills/media-use/scripts/lib/voice-provider.test.mjs +0 -46
- package/skills/media-use/scripts/resolve.test.mjs +0 -1120
- /package/skills/{hyperframes-core → hyperframes}/references/subagent-dispatch.md +0 -0
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import { strict as assert } from "node:assert";
|
|
2
|
-
import { execFileSync } from "node:child_process";
|
|
3
|
-
import { mkdtempSync, writeFileSync, rmSync } from "node:fs";
|
|
4
|
-
import { join, dirname } from "node:path";
|
|
5
|
-
import { tmpdir } from "node:os";
|
|
6
|
-
import { fileURLToPath } from "node:url";
|
|
7
|
-
import { test } from "node:test";
|
|
8
|
-
import { compileCutList } from "./cutlist.mjs";
|
|
9
|
-
|
|
10
|
-
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
11
|
-
const SCRIPT = join(HERE, "..", "transcript-cut.mjs");
|
|
12
|
-
|
|
13
|
-
test("explicit --remove ranges invert to kept segments", () => {
|
|
14
|
-
const transcript = [
|
|
15
|
-
word("w0", "alpha", 0, 1),
|
|
16
|
-
word("w1", "beta", 1.2, 2),
|
|
17
|
-
word("w2", "gamma", 2.2, 5),
|
|
18
|
-
];
|
|
19
|
-
|
|
20
|
-
assert.deepEqual(compileCutList(transcript, { remove: "1-2.5" }), [
|
|
21
|
-
{ start: 0, end: 1 },
|
|
22
|
-
{ start: 2.5, end: 5 },
|
|
23
|
-
]);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
test("--remove-words resolves inclusive word-index ranges to time ranges", () => {
|
|
27
|
-
const transcript = [
|
|
28
|
-
word("w0", "zero", 0, 0.5),
|
|
29
|
-
word("w1", "one", 0.6, 1),
|
|
30
|
-
word("w2", "two", 1.1, 1.5),
|
|
31
|
-
word("w3", "three", 2, 3),
|
|
32
|
-
];
|
|
33
|
-
|
|
34
|
-
assert.deepEqual(compileCutList(transcript, { removeWords: "1-2" }), [
|
|
35
|
-
{ start: 0, end: 0.6 },
|
|
36
|
-
{ start: 1.5, end: 3 },
|
|
37
|
-
]);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
test("--remove-fillers drops case-insensitive matching words", () => {
|
|
41
|
-
const transcript = [
|
|
42
|
-
word("w0", "Hello", 0, 0.5),
|
|
43
|
-
word("w1", "Um", 0.5, 0.7),
|
|
44
|
-
word("w2", "world", 0.8, 1.2),
|
|
45
|
-
word("w3", "LIKE", 1.3, 1.5),
|
|
46
|
-
word("w4", "done", 1.6, 2),
|
|
47
|
-
];
|
|
48
|
-
|
|
49
|
-
assert.deepEqual(compileCutList(transcript, { removeFillers: "um,like" }), [
|
|
50
|
-
{ start: 0, end: 0.5 },
|
|
51
|
-
{ start: 0.7, end: 1.3 },
|
|
52
|
-
{ start: 1.5, end: 2 },
|
|
53
|
-
]);
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
test("--cut-silence removes only the center of long inter-word gaps", () => {
|
|
57
|
-
const transcript = [word("w0", "a", 0, 0.5), word("w1", "b", 2, 2.5), word("w2", "c", 2.7, 3)];
|
|
58
|
-
|
|
59
|
-
assert.deepEqual(compileCutList(transcript, { cutSilence: 0.8 }), [
|
|
60
|
-
{ start: 0, end: 0.65 },
|
|
61
|
-
{ start: 1.85, end: 3 },
|
|
62
|
-
]);
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
test("overlapping removal sources merge before inversion", () => {
|
|
66
|
-
const transcript = [
|
|
67
|
-
word("w0", "start", 0, 0.5),
|
|
68
|
-
word("w1", "um", 0.9, 1.1),
|
|
69
|
-
word("w2", "middle", 2.5, 2.8),
|
|
70
|
-
word("w3", "more", 3.1, 3.4),
|
|
71
|
-
word("w4", "end", 5.5, 6),
|
|
72
|
-
];
|
|
73
|
-
|
|
74
|
-
assert.deepEqual(
|
|
75
|
-
compileCutList(transcript, {
|
|
76
|
-
remove: "1-2.7",
|
|
77
|
-
removeWords: "2-3",
|
|
78
|
-
removeFillers: "um",
|
|
79
|
-
}),
|
|
80
|
-
[
|
|
81
|
-
{ start: 0, end: 0.9 },
|
|
82
|
-
{ start: 3.4, end: 6 },
|
|
83
|
-
],
|
|
84
|
-
);
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
test("kept slivers shorter than 0.2s are dropped", () => {
|
|
88
|
-
const transcript = [word("w0", "start", 0, 0.5), word("w1", "end", 2.5, 3)];
|
|
89
|
-
|
|
90
|
-
assert.deepEqual(compileCutList(transcript, { remove: "0.1-2.95" }), []);
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
test("--keep is inverse mode and coalesces direct kept ranges", () => {
|
|
94
|
-
const transcript = [word("w0", "start", 0, 0.5), word("w1", "end", 4.5, 5)];
|
|
95
|
-
|
|
96
|
-
assert.deepEqual(compileCutList(transcript, { keep: "3-4,1-2,1.5-2.5,4.1-4.2" }), [
|
|
97
|
-
{ start: 1, end: 2.5 },
|
|
98
|
-
{ start: 3, end: 4 },
|
|
99
|
-
]);
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
test("--plan on a fixture transcript prints the exact segment JSON", () => {
|
|
103
|
-
const dir = mkdtempSync(join(tmpdir(), "media-use-cutlist-"));
|
|
104
|
-
try {
|
|
105
|
-
const transcriptPath = join(dir, "fixture.json");
|
|
106
|
-
writeFileSync(
|
|
107
|
-
transcriptPath,
|
|
108
|
-
JSON.stringify([
|
|
109
|
-
word("w0", "hello", 0, 0.4),
|
|
110
|
-
word("w1", "um", 0.5, 0.65),
|
|
111
|
-
word("w2", "there", 0.7, 1),
|
|
112
|
-
word("w3", "pause", 2.2, 2.5),
|
|
113
|
-
word("w4", "end", 2.7, 3.2),
|
|
114
|
-
]),
|
|
115
|
-
);
|
|
116
|
-
|
|
117
|
-
const out = execFileSync(
|
|
118
|
-
process.execPath,
|
|
119
|
-
[
|
|
120
|
-
SCRIPT,
|
|
121
|
-
"--input",
|
|
122
|
-
"ignored.mp4",
|
|
123
|
-
"--transcript",
|
|
124
|
-
transcriptPath,
|
|
125
|
-
"--remove",
|
|
126
|
-
"0.9-1.2",
|
|
127
|
-
"--remove-fillers",
|
|
128
|
-
"um",
|
|
129
|
-
"--cut-silence",
|
|
130
|
-
"0.8",
|
|
131
|
-
"--plan",
|
|
132
|
-
],
|
|
133
|
-
{ encoding: "utf8" },
|
|
134
|
-
);
|
|
135
|
-
|
|
136
|
-
assert.deepEqual(JSON.parse(out), [
|
|
137
|
-
{ start: 0, end: 0.5 },
|
|
138
|
-
{ start: 0.65, end: 0.9 },
|
|
139
|
-
{ start: 2.05, end: 3.2 },
|
|
140
|
-
]);
|
|
141
|
-
} finally {
|
|
142
|
-
rmSync(dir, { recursive: true, force: true });
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
function word(id, text, start, end) {
|
|
147
|
-
return { id, text, start, end };
|
|
148
|
-
}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { strict as assert } from "node:assert";
|
|
2
|
-
import { execFileSync } from "node:child_process";
|
|
3
|
-
import { mkdtempSync, writeFileSync, rmSync } from "node:fs";
|
|
4
|
-
import { join, dirname } from "node:path";
|
|
5
|
-
import { tmpdir } from "node:os";
|
|
6
|
-
import { fileURLToPath } from "node:url";
|
|
7
|
-
import { test } from "node:test";
|
|
8
|
-
import { duckKeyframes, speechSpans } from "./duck.mjs";
|
|
9
|
-
|
|
10
|
-
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
11
|
-
const SCRIPT = join(HERE, "..", "audio-duck.mjs");
|
|
12
|
-
|
|
13
|
-
test("speechSpans bridges gaps smaller than mergeGap", () => {
|
|
14
|
-
const meta = {
|
|
15
|
-
words: [word("w0", "one", 0, 0.5), word("w1", "two", 0.8, 1), word("w2", "three", 2, 2.2)],
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
assert.deepEqual(speechSpans(meta, { mergeGap: 0.4 }), [
|
|
19
|
-
{ start: 0, end: 1 },
|
|
20
|
-
{ start: 2, end: 2.2 },
|
|
21
|
-
]);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
test("speechSpans refuses multi-line meta without placement (file-relative times)", () => {
|
|
25
|
-
const meta = {
|
|
26
|
-
voices: [
|
|
27
|
-
{ id: "a", words: [word("w0", "one", 0, 1)] },
|
|
28
|
-
{ id: "b", words: [word("w1", "two", 0, 1)] },
|
|
29
|
-
],
|
|
30
|
-
};
|
|
31
|
-
assert.throws(() => speechSpans(meta, { mergeGap: 0.2 }), /--sequential or --offsets/);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
test("speechSpans sequential stacks lines by duration plus gap", () => {
|
|
35
|
-
const meta = {
|
|
36
|
-
voices: [
|
|
37
|
-
{ id: "a", duration_s: 2, words: [word("w0", "one", 0.1, 1.9)] },
|
|
38
|
-
{ id: "b", duration_s: 1, words: [word("w1", "two", 0.1, 0.9)] },
|
|
39
|
-
],
|
|
40
|
-
};
|
|
41
|
-
assert.deepEqual(speechSpans(meta, { mergeGap: 0.2, sequential: true, gap: 0.5 }), [
|
|
42
|
-
{ start: 0.1, end: 1.9 },
|
|
43
|
-
{ start: 2.6, end: 3.4 },
|
|
44
|
-
]);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
test("speechSpans explicit offsets place each line at composition time", () => {
|
|
48
|
-
const meta = {
|
|
49
|
-
voices: [
|
|
50
|
-
{ id: "a", words: [word("w0", "one", 0, 1)] },
|
|
51
|
-
{ id: "b", words: [word("w1", "two", 0, 1)] },
|
|
52
|
-
],
|
|
53
|
-
};
|
|
54
|
-
assert.deepEqual(speechSpans(meta, { mergeGap: 0.2, offsets: { a: 0, b: 4 } }), [
|
|
55
|
-
{ start: 0, end: 1 },
|
|
56
|
-
{ start: 4, end: 5 },
|
|
57
|
-
]);
|
|
58
|
-
assert.throws(() => speechSpans(meta, { offsets: { a: 0 } }), /missing voice "b"/);
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
test("speechSpans returns empty spans for empty input", () => {
|
|
62
|
-
assert.deepEqual(speechSpans({ voices: [] }, { mergeGap: 0.6 }), []);
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
test("duckKeyframes shapes attack and release from base volume", () => {
|
|
66
|
-
assert.deepEqual(
|
|
67
|
-
duckKeyframes([{ start: 3, end: 5 }], {
|
|
68
|
-
duck: 0.25,
|
|
69
|
-
attack: 0.15,
|
|
70
|
-
release: 0.4,
|
|
71
|
-
baseVolume: 0.6,
|
|
72
|
-
}),
|
|
73
|
-
[
|
|
74
|
-
{ time: 3, volume: 0.15, duration: 0.15 },
|
|
75
|
-
{ time: 5, volume: 0.6, duration: 0.4 },
|
|
76
|
-
],
|
|
77
|
-
);
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
test("--json spans match --merge-gap semantics exactly", () => {
|
|
81
|
-
const dir = mkdtempSync(join(tmpdir(), "media-use-duck-"));
|
|
82
|
-
try {
|
|
83
|
-
const metaPath = join(dir, "audio_meta.json");
|
|
84
|
-
writeFileSync(
|
|
85
|
-
metaPath,
|
|
86
|
-
JSON.stringify({
|
|
87
|
-
voices: [
|
|
88
|
-
{
|
|
89
|
-
id: "narration",
|
|
90
|
-
words: [
|
|
91
|
-
word("w0", "one", 0, 0.4),
|
|
92
|
-
word("w1", "two", 0.9, 1.2),
|
|
93
|
-
word("w2", "three", 1.8, 2.1),
|
|
94
|
-
],
|
|
95
|
-
},
|
|
96
|
-
],
|
|
97
|
-
}),
|
|
98
|
-
);
|
|
99
|
-
|
|
100
|
-
const out = execFileSync(
|
|
101
|
-
process.execPath,
|
|
102
|
-
[SCRIPT, "--meta", metaPath, "--target", "#bgm", "--merge-gap", "0.6", "--json"],
|
|
103
|
-
{ encoding: "utf8" },
|
|
104
|
-
);
|
|
105
|
-
|
|
106
|
-
const parsed = JSON.parse(out);
|
|
107
|
-
assert.deepEqual(parsed.spans, [
|
|
108
|
-
{ start: 0, end: 1.2 },
|
|
109
|
-
{ start: 1.8, end: 2.1 },
|
|
110
|
-
]);
|
|
111
|
-
} finally {
|
|
112
|
-
rmSync(dir, { recursive: true, force: true });
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
function word(id, text, start, end) {
|
|
117
|
-
return { id, text, start, end };
|
|
118
|
-
}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import assert from "node:assert/strict";
|
|
2
|
-
import test from "node:test";
|
|
3
|
-
import { ERROR_DIFFUSION_ALGORITHMS, applyErrorDiffusionRgba } from "./error-diffusion.mjs";
|
|
4
|
-
|
|
5
|
-
const EXPECTED_GRADIENTS = {
|
|
6
|
-
"floyd-steinberg": "00000101/00010101/00100101/00010111/01010101/01011011",
|
|
7
|
-
atkinson: "00000011/00001100/00010011/00010111/01001101/00111011",
|
|
8
|
-
"jarvis-judice-ninke": "00000011/00001011/00011001/00101111/00100111/01011011",
|
|
9
|
-
stucki: "00000011/00010101/00010110/00101011/00101101/01010111",
|
|
10
|
-
burkes: "00000101/00010011/00010110/00101011/01010111/00101011",
|
|
11
|
-
sierra: "00000011/00010101/00010110/00100111/00110111/00101101",
|
|
12
|
-
"sierra-lite": "00000101/00010101/00100101/00010110/01010111/01010101",
|
|
13
|
-
"two-row-sierra": "00000101/00010011/00010110/00101011/00101101/01011011",
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
test("exposes the eight article error-diffusion algorithms", () => {
|
|
17
|
-
assert.deepEqual(Object.keys(ERROR_DIFFUSION_ALGORITHMS), Object.keys(EXPECTED_GRADIENTS));
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
test("matches deterministic golden patterns for every diffusion kernel", () => {
|
|
21
|
-
const width = 8;
|
|
22
|
-
const height = 6;
|
|
23
|
-
const source = new Uint8ClampedArray(width * height * 4);
|
|
24
|
-
for (let y = 0; y < height; y++) {
|
|
25
|
-
for (let x = 0; x < width; x++) {
|
|
26
|
-
const value = Math.round((255 * (x + y * 0.7)) / (width - 1 + (height - 1) * 0.7));
|
|
27
|
-
const offset = (y * width + x) * 4;
|
|
28
|
-
source[offset] = value;
|
|
29
|
-
source[offset + 1] = Math.round(value * 0.8);
|
|
30
|
-
source[offset + 2] = Math.round(value * 0.55);
|
|
31
|
-
source[offset + 3] = 17 + x + y;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
for (const [algorithm, expected] of Object.entries(EXPECTED_GRADIENTS)) {
|
|
36
|
-
const output = source.slice();
|
|
37
|
-
applyErrorDiffusionRgba(output, width, height, {
|
|
38
|
-
algorithm,
|
|
39
|
-
brightness: 1,
|
|
40
|
-
contrast: 1,
|
|
41
|
-
detail: 1,
|
|
42
|
-
palette: ["#000000", "#ffffff"],
|
|
43
|
-
pointSize: 1,
|
|
44
|
-
});
|
|
45
|
-
const rows = [];
|
|
46
|
-
for (let y = 0; y < height; y++) {
|
|
47
|
-
let row = "";
|
|
48
|
-
for (let x = 0; x < width; x++) row += output[(y * width + x) * 4] ? "1" : "0";
|
|
49
|
-
rows.push(row);
|
|
50
|
-
}
|
|
51
|
-
assert.equal(rows.join("/"), expected, algorithm);
|
|
52
|
-
for (let i = 0; i < width * height; i++) assert.equal(output[i * 4 + 3], source[i * 4 + 3]);
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
test("fills point-size blocks from their center sample", () => {
|
|
57
|
-
const data = new Uint8ClampedArray([
|
|
58
|
-
0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 4, 0, 0, 0, 5, 255, 255, 255, 6, 0, 0, 0, 7, 255,
|
|
59
|
-
255, 255, 8,
|
|
60
|
-
]);
|
|
61
|
-
applyErrorDiffusionRgba(
|
|
62
|
-
data,
|
|
63
|
-
4,
|
|
64
|
-
2,
|
|
65
|
-
{
|
|
66
|
-
algorithm: "floyd-steinberg",
|
|
67
|
-
brightness: 1,
|
|
68
|
-
contrast: 1,
|
|
69
|
-
detail: 1,
|
|
70
|
-
palette: ["#000000", "#ffffff"],
|
|
71
|
-
pointSize: 2,
|
|
72
|
-
},
|
|
73
|
-
new Float32Array(6),
|
|
74
|
-
);
|
|
75
|
-
assert.deepEqual(
|
|
76
|
-
[...data],
|
|
77
|
-
[
|
|
78
|
-
255, 255, 255, 1, 255, 255, 255, 2, 255, 255, 255, 3, 255, 255, 255, 4, 255, 255, 255, 5, 255,
|
|
79
|
-
255, 255, 6, 255, 255, 255, 7, 255, 255, 255, 8,
|
|
80
|
-
],
|
|
81
|
-
);
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
test("preserves authored palette order and validates the public contract", () => {
|
|
85
|
-
const reversed = new Uint8ClampedArray([0, 0, 0, 255]);
|
|
86
|
-
applyErrorDiffusionRgba(reversed, 1, 1, {
|
|
87
|
-
palette: ["#ffffff", "#000000"],
|
|
88
|
-
});
|
|
89
|
-
assert.deepEqual([...reversed], [255, 255, 255, 255]);
|
|
90
|
-
|
|
91
|
-
assert.throws(
|
|
92
|
-
() => applyErrorDiffusionRgba(new Uint8ClampedArray(4), 1, 1, { palette: ["#000000"] }),
|
|
93
|
-
/2 to 6 colors/,
|
|
94
|
-
);
|
|
95
|
-
assert.throws(
|
|
96
|
-
() =>
|
|
97
|
-
applyErrorDiffusionRgba(new Uint8ClampedArray(4), 1, 1, {
|
|
98
|
-
algorithm: "ordered-bayer",
|
|
99
|
-
}),
|
|
100
|
-
/unknown error-diffusion algorithm/,
|
|
101
|
-
);
|
|
102
|
-
});
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { writeFileSync, copyFileSync, mkdirSync } from "node:fs";
|
|
2
|
-
import { dirname } from "node:path";
|
|
3
|
-
|
|
4
|
-
// ponytail: bound the download so a hostile/runaway URL can't fill the disk.
|
|
5
|
-
// 256MB covers any real media asset; raise if 4K video sources ever exceed it.
|
|
6
|
-
const MAX_FREEZE_BYTES = 256 * 1024 * 1024;
|
|
7
|
-
|
|
8
|
-
export async function freezeUrl(url, destPath) {
|
|
9
|
-
const where = String(url).slice(0, 80);
|
|
10
|
-
const res = await fetch(url);
|
|
11
|
-
if (!res.ok) throw new Error(`freeze failed: HTTP ${res.status} for ${where}`);
|
|
12
|
-
|
|
13
|
-
// Fail fast on an advertised oversize body before reading a single byte.
|
|
14
|
-
const declared = Number(res.headers.get("content-length"));
|
|
15
|
-
if (declared > MAX_FREEZE_BYTES)
|
|
16
|
-
throw new Error(
|
|
17
|
-
`freeze failed: ${declared} bytes exceeds ${MAX_FREEZE_BYTES} cap for ${where}`,
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
// Stream and abort once the cap is crossed, so a lying/chunked hostile URL
|
|
21
|
-
// can't buffer the whole payload into memory before the check (M1).
|
|
22
|
-
const chunks = [];
|
|
23
|
-
let total = 0;
|
|
24
|
-
for await (const chunk of res.body) {
|
|
25
|
-
total += chunk.length;
|
|
26
|
-
if (total > MAX_FREEZE_BYTES)
|
|
27
|
-
throw new Error(`freeze failed: stream exceeds ${MAX_FREEZE_BYTES} cap for ${where}`);
|
|
28
|
-
chunks.push(chunk);
|
|
29
|
-
}
|
|
30
|
-
if (total === 0) throw new Error(`freeze failed: empty response for ${where}`);
|
|
31
|
-
|
|
32
|
-
mkdirSync(dirname(destPath), { recursive: true });
|
|
33
|
-
writeFileSync(destPath, Buffer.concat(chunks, total));
|
|
34
|
-
return total;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export function freezeLocalFile(srcPath, destPath) {
|
|
38
|
-
mkdirSync(dirname(destPath), { recursive: true });
|
|
39
|
-
copyFileSync(srcPath, destPath);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Ingest accepts a DIRECT public media URL only — not a platform page. yt-dlp is
|
|
43
|
-
// deliberately out (cloud IPs get blocked, and it's brittle); the supported case
|
|
44
|
-
// is "user points at their own file or a direct asset link". A direct URL is a
|
|
45
|
-
// non-platform host whose path ends in a known media extension.
|
|
46
|
-
const PLATFORM_HOSTS =
|
|
47
|
-
/(^|\.)(youtube\.com|youtu\.be|vimeo\.com|tiktok\.com|instagram\.com|twitter\.com|x\.com|facebook\.com|dailymotion\.com)$/i;
|
|
48
|
-
const MEDIA_EXT = /\.(mp3|wav|m4a|aac|ogg|flac|mp4|mov|webm|mkv|png|jpe?g|webp|gif|svg|avif)$/i;
|
|
49
|
-
|
|
50
|
-
// SSRF guard (m11): a user-supplied --from URL must not point at the local host
|
|
51
|
-
// or a private network. Blocks loopback/localhost, RFC1918, link-local, and the
|
|
52
|
-
// IPv6 equivalents on the literal hostname.
|
|
53
|
-
// ponytail: literal-host check only; a DNS name that *resolves* to a private IP
|
|
54
|
-
// (rebinding) still passes — add resolve-then-check if --from ever fetches from
|
|
55
|
-
// untrusted hostnames at scale.
|
|
56
|
-
const PRIVATE_HOST =
|
|
57
|
-
/^(localhost|.*\.local|.*\.internal|127\.|10\.|0\.|169\.254\.|192\.168\.|172\.(1[6-9]|2\d|3[01])\.|\[?(::1|::ffff:127\.|f[cd][0-9a-f]{2}:|fe80:))/i;
|
|
58
|
-
|
|
59
|
-
export function isDirectMediaUrl(u) {
|
|
60
|
-
let url;
|
|
61
|
-
try {
|
|
62
|
-
url = new URL(u);
|
|
63
|
-
} catch {
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
66
|
-
if (url.protocol !== "http:" && url.protocol !== "https:") return false;
|
|
67
|
-
if (PLATFORM_HOSTS.test(url.hostname)) return false;
|
|
68
|
-
if (PRIVATE_HOST.test(url.hostname)) return false;
|
|
69
|
-
return MEDIA_EXT.test(url.pathname);
|
|
70
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { strict as assert } from "node:assert";
|
|
2
|
-
import { test } from "node:test";
|
|
3
|
-
import { isDirectMediaUrl } from "./freeze.mjs";
|
|
4
|
-
|
|
5
|
-
test("accepts direct public media URLs", () => {
|
|
6
|
-
assert.equal(isDirectMediaUrl("https://cdn.example.com/clip.mp4"), true);
|
|
7
|
-
assert.equal(isDirectMediaUrl("https://example.com/a/b/track.mp3"), true);
|
|
8
|
-
assert.equal(isDirectMediaUrl("http://example.com/logo.svg"), true);
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
test("rejects platform pages (no yt-dlp)", () => {
|
|
12
|
-
assert.equal(isDirectMediaUrl("https://www.youtube.com/watch?v=abc"), false);
|
|
13
|
-
assert.equal(isDirectMediaUrl("https://youtu.be/abc"), false);
|
|
14
|
-
assert.equal(isDirectMediaUrl("https://vimeo.com/12345"), false);
|
|
15
|
-
assert.equal(isDirectMediaUrl("https://x.com/u/status/1"), false);
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
test("rejects non-direct / non-media URLs", () => {
|
|
19
|
-
assert.equal(isDirectMediaUrl("https://example.com/page"), false, "no media extension");
|
|
20
|
-
assert.equal(isDirectMediaUrl("ftp://example.com/a.mp4"), false, "non-http(s)");
|
|
21
|
-
assert.equal(isDirectMediaUrl("not a url"), false);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
test("rejects local / private hosts (SSRF guard, m11)", () => {
|
|
25
|
-
for (const u of [
|
|
26
|
-
"http://localhost/a.mp4",
|
|
27
|
-
"http://127.0.0.1/a.mp4",
|
|
28
|
-
"http://127.1.2.3/a.mp4",
|
|
29
|
-
"http://0.0.0.0/a.mp4",
|
|
30
|
-
"http://10.0.0.5/a.mp4",
|
|
31
|
-
"http://192.168.1.1/a.mp4",
|
|
32
|
-
"http://172.16.0.1/a.mp4",
|
|
33
|
-
"http://172.31.255.255/a.mp4",
|
|
34
|
-
"http://169.254.169.254/a.mp4", // cloud metadata endpoint
|
|
35
|
-
"http://printer.local/a.mp4",
|
|
36
|
-
"http://svc.internal/a.mp4",
|
|
37
|
-
"http://[::1]/a.mp4",
|
|
38
|
-
"http://[fe80::1]/a.mp4",
|
|
39
|
-
"http://[fd00::1]/a.mp4",
|
|
40
|
-
]) {
|
|
41
|
-
assert.equal(isDirectMediaUrl(u), false, `should block ${u}`);
|
|
42
|
-
}
|
|
43
|
-
// A public host that merely starts with similar digits is still allowed.
|
|
44
|
-
assert.equal(isDirectMediaUrl("https://172.40.0.1/a.mp4"), true, "172.40 is public");
|
|
45
|
-
assert.equal(isDirectMediaUrl("https://11.example.com/a.mp4"), true);
|
|
46
|
-
});
|