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: preserve cross-platform release diagnostics

kashorin4bcda6149455
diff --git a/packages/cli/test/control-commands.test.ts b/packages/cli/test/control-commands.test.ts
index 89ea120a..a6afcd24 100644
--- a/packages/cli/test/control-commands.test.ts
+++ b/packages/cli/test/control-commands.test.ts
@@ -12,6 +12,8 @@ import { createLocalCredentialControl } from "@hypit/runtime-local";
import { cliCommandModules } from "../../runtime-local/src/cli.js";
import { commandHint } from "../src/command-hint.js";
+const applicationCwd = tmpdir();
+
const runCli = async (argv: readonly string[], output: CliIo, selected: CliDistribution) => await runCliApplication(
argv,
output,
@@ -24,7 +26,7 @@ const runCli = async (argv: readonly string[], output: CliIo, selected: CliDistr
await selected.openRuntimeHost(path, options),
} as CliDistribution,
commandModules: cliCommandModules,
- cwd: tmpdir(),
+ cwd: applicationCwd,
resolveProjectRoot: async (explicit) => await realpath(explicit ?? tmpdir()),
},
);
@@ -331,7 +333,7 @@ test("status preserves Runtime decision and attention when its Result Store is u
assert.equal(result.build.result.state, "unavailable");
assert.equal(result.build.attention.message, "S3 unavailable");
assert.equal(result.build.attention.action, commandHint(["result", "finish", view.id], {
- projectRoot: await realpath(tmpdir()), runtimeProfile: resolve("/tmp/runtime with space.json"),
+ projectRoot: await realpath(applicationCwd), runtimeProfile: resolve(applicationCwd, "/tmp/runtime with space.json"),
}));
assert.deepEqual((result.build as { operations?: unknown }).operations, [{
endpoint: "images.internal", state: "failed", failure: { code: "REMOTE", message: "provider detail" },
diff --git a/packages/cli/test/programs-command.test.ts b/packages/cli/test/programs-command.test.ts
index a4d72bc5..18740aef 100644
--- a/packages/cli/test/programs-command.test.ts
+++ b/packages/cli/test/programs-command.test.ts
@@ -13,6 +13,7 @@ import type { ManagedProgramProgress as CliManagedProgramProgress, ManagedProgra
import type { RuntimeController as CliRuntimeController } from "../../runtime-local/src/host-api.js";
const io = { write: () => {} };
+const applicationCwd = tmpdir();
const runCli = async (argv: readonly string[], output: CliIo, selected: CliDistribution) =>
await runCliApplication(argv, output, {
// This suite mounts the Local Runtime command contribution onto deliberately
@@ -24,7 +25,7 @@ const runCli = async (argv: readonly string[], output: CliIo, selected: CliDistr
await selected.openRuntimeHost(path, options),
} as CliDistribution,
commandModules: cliCommandModules,
- cwd: tmpdir(),
+ cwd: applicationCwd,
resolveProjectRoot: async (explicit) => await realpath(explicit ?? tmpdir()),
});
@@ -73,7 +74,7 @@ test("programs dispatches lifecycle through the selected Runtime Controller", as
await runCli(["programs", "status", "/p/hypit.runtime.json"], io, distribution(calls));
// The CLI resolves the profile it is given, and what resolving produces is the platform's own
// spelling. Asserting the argument back verbatim would only be asserting that this is POSIX.
- const profile = resolve("/p/hypit.runtime.json");
+ const profile = resolve(applicationCwd, "/p/hypit.runtime.json");
assert.deepEqual(calls, [
`up ${profile} {"maxWaitMs":1000}`,
`down ${profile}`,
@@ -400,5 +401,5 @@ test("Worker stop suggests Program control in the same project and Profile", asy
test("programs prepare provisions resources through the controller without starting a worker", async () => {
const calls: string[] = [];
await runCli(["programs", "prepare", "/p/hypit.runtime.json", "--endpoint", "speech"], io, distribution(calls));
- assert.deepEqual(calls, [`prepare ${resolve("/p/hypit.runtime.json")} {"endpoints":["speech"]}`]);
+ assert.deepEqual(calls, [`prepare ${resolve(applicationCwd, "/p/hypit.runtime.json")} {"endpoints":["speech"]}`]);
});
diff --git a/packages/provider-html-local/src/capture-exit.ts b/packages/provider-html-local/src/capture-exit.ts
index 8a31fa28..e03cd404 100644
--- a/packages/provider-html-local/src/capture-exit.ts
+++ b/packages/provider-html-local/src/capture-exit.ts
@@ -10,15 +10,24 @@ const cleanup = () => {
writeSync(2, `Render exit cleanup could not be confirmed: ${String(error)}\n`);
}
};
+// `taskkill /T` includes the Windows owner process itself. During an uncaught
+// failure the exit hook can therefore stop Node before its usual diagnostic is
+// flushed. Preserve that diagnostic synchronously before cleanup begins.
+const reportUncaught = (error: unknown) => {
+ const message = error instanceof Error ? error.stack ?? error.message : String(error);
+ writeSync(2, `${message}\n`);
+};
const terminate = () => process.exit(143);
const interrupt = () => process.exit(130);
process.once("exit", cleanup);
process.once("SIGTERM", terminate);
process.once("SIGINT", interrupt);
+if (process.platform === "win32") process.on("uncaughtExceptionMonitor", reportUncaught);
/** Call only after capture has closed every resource successfully. */
export function releaseCaptureExitCleanup(): void {
process.off("exit", cleanup);
process.off("SIGTERM", terminate);
process.off("SIGINT", interrupt);
+ if (process.platform === "win32") process.off("uncaughtExceptionMonitor", reportUncaught);
}
diff --git a/packages/runtime-local/test/platform-credentials-cli.test.ts b/packages/runtime-local/test/platform-credentials-cli.test.ts
index 23dfd68e..f28872ce 100644
--- a/packages/runtime-local/test/platform-credentials-cli.test.ts
+++ b/packages/runtime-local/test/platform-credentials-cli.test.ts
@@ -17,6 +17,14 @@ const launcher = fileURLToPath(new URL("../../../bin/hypit.mjs", import.meta.url
*/
const isLinux = process.platform === "linux";
+async function declareProject(project: string): Promise<void> {
+ await writeFile(join(project, "package.json"), `${JSON.stringify({
+ name: "hypit-runtime-platform-test",
+ private: true,
+ hypit: { project: true },
+ }, null, 2)}\n`);
+}
+
test("the interview example authenticates on Linux, without editing its Profile",
{ skip: !isLinux, timeout: 120_000 }, async (t) => {
const root = await mkdtemp(join(tmpdir(), "hypit-platform-example-"));
@@ -24,6 +32,7 @@ test("the interview example authenticates on Linux, without editing its Profile"
const project = join(root, "project");
const state = join(root, "host");
await mkdir(project, { recursive: true });
+ await declareProject(project);
const profile = fileURLToPath(new URL("../../../examples/interview/hypit.runtime.json", import.meta.url));
const run = (...args: string[]) => exec(process.execPath, [launcher, ...args, "--json"], {
cwd: project, env: { ...process.env, HYPIT_STATE_HOME: state }, timeout: 60_000, windowsHide: true,
@@ -55,6 +64,7 @@ test("the Profile runtime init writes authenticates on Linux, without editing it
const project = join(root, "project");
const state = join(root, "host");
await mkdir(project, { recursive: true });
+ await declareProject(project);
const run = (...args: string[]) => exec(process.execPath, [launcher, ...args, "--json"], {
cwd: project, env: { ...process.env, HYPIT_STATE_HOME: state }, timeout: 60_000, windowsHide: true,
});