Skip to content

armgit / hypit

Public Imported from GitHub
0

Clone any viral video with AI agents. Not just a script, the whole workflow: swap the face, the words, the B-roll, ship 100 variants in one command, and get your 100M views.

fix: give HyperFrames ffmpeg children Windows TEMP and process-creation variables

fetwc5e53d2b5386
diff --git a/packages/provider-hyperframes-local/src/process.ts b/packages/provider-hyperframes-local/src/process.ts
index 5a8cf471..3a038edd 100644
--- a/packages/provider-hyperframes-local/src/process.ts
+++ b/packages/provider-hyperframes-local/src/process.ts
@@ -35,8 +35,12 @@ export async function mediaExecutablePath(value: string): Promise<string> {
throw new Error(`HyperFrames media executable ${value} is unavailable; correct the Provider's ffmpegPath or ffprobePath.`);
}
-function processEnvironment(): NodeJS.ProcessEnv {
- const names = ["PATH", "HOME", "TMPDIR", "LANG", "LC_ALL"] as const;
+export function processEnvironment(platform: NodeJS.Platform = process.platform): NodeJS.ProcessEnv {
+ // POSIX temp is TMPDIR; Windows is TEMP/TMP. HyperFrames writes extracted
+ // frames under %TEMP%\hf-render-… and ffmpeg creates temporary files the same way.
+ const names = platform === "win32"
+ ? ["PATH", "PATHEXT", "SYSTEMROOT", "WINDIR", "ComSpec", "TEMP", "TMP", "USERPROFILE", "LANG", "LC_ALL"] as const
+ : ["PATH", "HOME", "TMPDIR", "LANG", "LC_ALL"] as const;
return Object.fromEntries(names.flatMap((name) => process.env[name] === undefined
? []
: [[name, process.env[name]]])) as NodeJS.ProcessEnv;
diff --git a/packages/provider-hyperframes-local/test/process-env.test.ts b/packages/provider-hyperframes-local/test/process-env.test.ts
new file mode 100644
index 00000000..40778f19
--- /dev/null
+++ b/packages/provider-hyperframes-local/test/process-env.test.ts
@@ -0,0 +1,47 @@
+import assert from "node:assert/strict";
+import test from "node:test";
+
+import { processEnvironment, runProcess } from "../src/process.js";
+
+test("Windows HyperFrames children receive TEMP and process-creation variables, not Host secrets", () => {
+ const previous = process.env.HYPIT_HF_ENV_PROBE;
+ const previousTemp = process.env.TEMP;
+ process.env.HYPIT_HF_ENV_PROBE = "secret";
+ process.env.TEMP = "C:\\Windows\\Temp";
+ try {
+ const env = processEnvironment("win32");
+ assert.equal(env.PATH, process.env.PATH);
+ assert.equal(env.TEMP, "C:\\Windows\\Temp");
+ assert.equal(env.HYPIT_HF_ENV_PROBE, undefined);
+ assert.equal(env.HOME, undefined);
+ assert.equal(env.TMPDIR, undefined);
+ } finally {
+ if (previous === undefined) delete process.env.HYPIT_HF_ENV_PROBE;
+ else process.env.HYPIT_HF_ENV_PROBE = previous;
+ if (previousTemp === undefined) delete process.env.TEMP;
+ else process.env.TEMP = previousTemp;
+ }
+});
+
+test("POSIX HyperFrames children receive TMPDIR without Host secrets", async () => {
+ const previous = process.env.HYPIT_HF_ENV_PROBE;
+ process.env.HYPIT_HF_ENV_PROBE = "secret";
+ try {
+ const env = processEnvironment("darwin");
+ assert.equal(env.HYPIT_HF_ENV_PROBE, undefined);
+ assert.equal(env.PATH, process.env.PATH);
+ assert.equal(env.TMPDIR, process.env.TMPDIR);
+ const { stdout } = await runProcess({
+ executable: process.execPath,
+ argv: ["-e", "process.stdout.write(JSON.stringify({ probe: process.env.HYPIT_HF_ENV_PROBE, path: Boolean(process.env.PATH) }))"],
+ timeoutMs: 5_000,
+ maxOutputBytes: 4_096,
+ });
+ const body = JSON.parse(Buffer.from(stdout).toString("utf8")) as { probe?: string; path: boolean };
+ assert.equal(body.probe, undefined);
+ assert.equal(body.path, true);
+ } finally {
+ if (previous === undefined) delete process.env.HYPIT_HF_ENV_PROBE;
+ else process.env.HYPIT_HF_ENV_PROBE = previous;
+ }
+});