fix(media-use): carve decodes only media files inside the composition's folder (#8649)

* fix(media-use): carve decodes only media files inside the composition's folder

carve.mjs resolved each media src from the composition and handed the result to ffmpeg, so an
absolute, climbing, UNC or linked name reached a file outside the project, and a playlist inside
the project was followed to the files it lists. Each src must now be a relative name that lands
on a regular file inside the composition's folder after links are resolved, outside the files the
project keeps private, and free of ffmpeg pattern characters. Every source is checked before any
is decoded. ffmpeg then reads the one file, pinned to its probed format and the file protocol,
and a list or playlist format is refused.

The probe and the pinned input move from recording.mjs into lib/media-input.mjs so both scripts
share them. The private-path rule and the image2 pattern guard are bundled into audio-carve.mjs
from packages/parsers.

* fix(media-use): media-input.mjs loads the Windows program guard first

Every skill script that starts programs imports windows-exe-search.mjs before anything else, so
ffprobe and ffmpeg are never looked up in the working directory on Windows.
This commit is contained in:
Michael Wang
2026-11-24 09:25:11 +00:00
committed by GitHub
parent 1c20a107a6
commit aefca2baff
8 changed files with 280 additions and 66 deletions
+7 -4
View File
@@ -1,5 +1,6 @@
#!/usr/bin/env node
// Bundles the carve analysis carve.mjs uses (packages/core/src/audioCarve.ts and audioFx.ts) into a single
// Bundles the carve analysis carve.mjs uses (packages/core/src/audioCarve.ts and audioFx.ts), and the private-path
// rule it checks sources with (packages/parsers/src/privatePath.ts), into a single
// import-free .mjs beside the skill, so the skill never loads @hyperframes/core from the project it edits.
// Regenerate after editing the source: node scripts/generate-media-use-audio-carve.mjs
import { writeFileSync } from "node:fs";
@@ -29,11 +30,13 @@ export {
parseAudioFxChain,
serializeAudioFxChain,
} from "./audioFx.ts";
export { isStudioPrivatePath } from "../../parsers/src/privatePath.ts";
`;
const HEADER = `// GENERATED: do not hand-edit. Source: packages/core/src/audioCarve.ts and audioFx.ts, bundled by
// scripts/generate-media-use-audio-carve.mjs so carve.mjs runs the same analysis as Studio without
// loading @hyperframes/core from the project. Regenerate: node scripts/generate-media-use-audio-carve.mjs
const HEADER = `// GENERATED: do not hand-edit. Source: packages/core/src/audioCarve.ts and audioFx.ts, and
// packages/parsers/src/privatePath.ts, bundled by scripts/generate-media-use-audio-carve.mjs so carve.mjs
// runs the same analysis and private-path rule as Studio without loading @hyperframes/core from the project.
// Regenerate: node scripts/generate-media-use-audio-carve.mjs
`;
export async function generate() {