mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-19 00:18:27 +00:00
fix(cli): reverse start makes its --dir project, and init takes the video already in it (#7089)
* fix(cli): reverse start makes its --dir project, and init takes the video already in it Bug bash: production has no reverse/start route yet, so every run came back unrecorded, and reverse start then made no folder and no hyperframes.json. The agent downloaded the video into the folder it named, and init refused it as not empty, so agents moved files around. reverse start now makes --dir and stamps it with the skill when no session is recorded, and init accepts a folder whose only other files are its --video or --audio. * refactor(cli): say in names what the comments said, so the comment share holds * fix(cli): init keeps an in-folder source safe, and saved_to only names a stamped config - Only an audio or video file in the folder counts as the source; a file named index.html, meta.json or AGENTS.md is refused, so the scaffold never writes over it. - An in-folder .mp4 that needs transcoding goes to <name>.h264.mp4 beside it, instead of being both ffmpeg's input and output. - reverse start names saved_to only when hyperframes.json now holds the skill; a broken config is left as it was and saved_to is null. * fix(cli): init transcodes an in-folder .MP4 beside it on case-insensitive disks too original.MP4 and original.mp4 are one file on macOS and Windows, so the same-file check now ignores case. The test's ffprobe call gets its --. * fix(cli): init tells the source in the folder by the file, not its spelling On a case-blind disk --video original.mp4 names Original.MP4, so the folder check and the copy now compare device and inode; a source named in another case is accepted and never copied onto itself. * fix(cli): init transcodes only to a name with nothing at it, so a linked alias is never the output The folder guard admits every alias of the source by file identity, but the transcode output was chosen by path spelling. A hard link or symlink at name.mp4 or name.h264.mp4, or a source named through a linked folder, made FFmpeg (-y) rewrite the original. The output is now the first of name.mp4, name.h264.mp4, name.h264-2.mp4, ... with nothing at its path (lstat, so a link counts), which also covers a case-only spelling on a case-blind disk. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HebQXN7wsMK6GqT3MNtqXw --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
823cd126ee
commit
6728b82e63
@@ -1563,7 +1563,9 @@ with a `reverse` field: whether you are signed in, the plan (`free`, `pro`, or
|
||||
purchase to this run (both `null` when HeyGen says no plan can be bought right now). It stops the
|
||||
run only when HeyGen blocks it for a Free account: it then exits non-zero with that command, or,
|
||||
without one, says a plan can't be purchased right now. Signed out, offline, or on a server without
|
||||
the route, it skips the session and still probes.
|
||||
the route, it skips the session and still probes; `--dir` is still created with a
|
||||
`hyperframes.json` naming the skill. `init` accepts that folder with the video already in it when
|
||||
it is the `--video` it was given.
|
||||
|
||||
```bash
|
||||
npx hyperframes reverse start ref.mp4 --dir my-rebuild
|
||||
|
||||
@@ -0,0 +1,193 @@
|
||||
import { afterEach, beforeEach, expect, it, vi } from "vitest";
|
||||
import { execFileSync, spawnSync } from "node:child_process";
|
||||
import {
|
||||
copyFileSync,
|
||||
existsSync,
|
||||
linkSync,
|
||||
mkdirSync,
|
||||
mkdtempSync,
|
||||
readFileSync,
|
||||
renameSync,
|
||||
rmSync,
|
||||
symlinkSync,
|
||||
writeFileSync,
|
||||
} from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { runCommand } from "citty";
|
||||
import { consumeCommandResult } from "../utils/commandResult.js";
|
||||
import init from "./init.js";
|
||||
|
||||
vi.mock("../telemetry/events.js", () => ({ trackInitTemplate: vi.fn() }));
|
||||
|
||||
const ffmpeg = spawnSync("ffmpeg", ["-version"]).status === 0;
|
||||
const hevc =
|
||||
ffmpeg && spawnSync("ffmpeg", ["-hide_banner", "-encoders"]).stdout.includes("libx265");
|
||||
const caseBlind = (() => {
|
||||
const probe = mkdtempSync(join(tmpdir(), "hf-case-"));
|
||||
writeFileSync(join(probe, "a"), "");
|
||||
const blind = existsSync(join(probe, "A"));
|
||||
rmSync(probe, { recursive: true, force: true });
|
||||
return blind;
|
||||
})();
|
||||
let dir: string;
|
||||
let project: string;
|
||||
|
||||
const encode = (out: string, codec: string[]) =>
|
||||
execFileSync("ffmpeg", [
|
||||
...["-v", "error", "-y", "-f", "lavfi", "-i", "testsrc2=size=160x90:rate=24:duration=1"],
|
||||
...codec,
|
||||
...["-pix_fmt", "yuv420p", out],
|
||||
]);
|
||||
const codecOf = (file: string) =>
|
||||
execFileSync("ffprobe", [
|
||||
...["-v", "error", "-select_streams", "v:0", "-show_entries", "stream=codec_name"],
|
||||
...["-of", "csv=p=0", "--", file],
|
||||
])
|
||||
.toString()
|
||||
.trim();
|
||||
|
||||
beforeEach(() => {
|
||||
dir = mkdtempSync(join(tmpdir(), "hf-init-source-"));
|
||||
project = join(dir, "rebuild");
|
||||
mkdirSync(project);
|
||||
// What `reverse start --dir` leaves, then the video the agent downloaded into it.
|
||||
writeFileSync(
|
||||
join(project, "hyperframes.json"),
|
||||
'{\n "authoringSkill": "reverse-any-video"\n}\n',
|
||||
);
|
||||
if (ffmpeg) encode(join(project, "original.mp4"), ["-c:v", "libx264"]);
|
||||
vi.stubEnv("HYPERFRAMES_SKIP_SKILLS", "1");
|
||||
vi.spyOn(console, "log").mockImplementation(() => {});
|
||||
vi.spyOn(console, "error").mockImplementation(() => {});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
rmSync(dir, { recursive: true, force: true });
|
||||
vi.restoreAllMocks();
|
||||
vi.unstubAllEnvs();
|
||||
consumeCommandResult();
|
||||
});
|
||||
|
||||
const initWithVideo = (video = join(project, "original.mp4"), keepOriginal = true) =>
|
||||
runCommand(init, {
|
||||
rawArgs: [
|
||||
...[project, "--video", video, "--example", "blank"],
|
||||
...(keepOriginal ? ["--keep-original"] : []),
|
||||
...["--skip-transcribe", "--non-interactive"],
|
||||
],
|
||||
});
|
||||
|
||||
it.skipIf(!ffmpeg)(
|
||||
"scaffolds into the folder that already holds the video it was given",
|
||||
async () => {
|
||||
const video = readFileSync(join(project, "original.mp4"));
|
||||
await initWithVideo();
|
||||
expect(existsSync(join(project, "index.html"))).toBe(true);
|
||||
expect(readFileSync(join(project, "original.mp4")).equals(video)).toBe(true);
|
||||
expect(readFileSync(join(project, "hyperframes.json"), "utf-8")).toContain("reverse-any-video");
|
||||
},
|
||||
);
|
||||
|
||||
it.skipIf(!ffmpeg || !caseBlind)(
|
||||
"scaffolds when the video in the folder is named in another case on a case-blind disk",
|
||||
async () => {
|
||||
renameSync(join(project, "original.mp4"), join(project, "Original.MP4"));
|
||||
const video = readFileSync(join(project, "Original.MP4"));
|
||||
await initWithVideo(join(project, "original.mp4"));
|
||||
expect(existsSync(join(project, "index.html"))).toBe(true);
|
||||
expect(readFileSync(join(project, "Original.MP4")).equals(video)).toBe(true);
|
||||
},
|
||||
);
|
||||
|
||||
it.skipIf(!ffmpeg)("still refuses a folder holding anything else", async () => {
|
||||
writeFileSync(join(project, "notes.txt"), "mine");
|
||||
await initWithVideo().catch(() => undefined);
|
||||
expect(existsSync(join(project, "index.html"))).toBe(false);
|
||||
});
|
||||
|
||||
it.skipIf(!ffmpeg).each(["index.html", "meta.json", "AGENTS.md"])(
|
||||
"refuses a video named %s, a file the scaffold writes, and leaves it as it was",
|
||||
async (name) => {
|
||||
const source = join(project, name);
|
||||
copyFileSync(join(project, "original.mp4"), source);
|
||||
rmSync(join(project, "original.mp4"));
|
||||
const video = readFileSync(source);
|
||||
await initWithVideo(source).catch(() => undefined);
|
||||
expect(readFileSync(source).equals(video)).toBe(true);
|
||||
expect(existsSync(join(project, name === "index.html" ? "meta.json" : "index.html"))).toBe(
|
||||
false,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
it.skipIf(!hevc).each(["original.mp4", "original.MP4"])(
|
||||
"transcodes an HEVC %s already in the folder beside it, keeping the original",
|
||||
async (name) => {
|
||||
rmSync(join(project, "original.mp4"));
|
||||
const source = join(project, name);
|
||||
encode(source, ["-c:v", "libx265", "-tag:v", "hvc1"]);
|
||||
const video = readFileSync(source);
|
||||
await initWithVideo(source, false);
|
||||
// On a case-sensitive disk original.mp4 is a free name beside original.MP4.
|
||||
const out = name === "original.mp4" || caseBlind ? "original.h264.mp4" : "original.mp4";
|
||||
expect(readFileSync(source).equals(video)).toBe(true);
|
||||
expect(codecOf(join(project, out))).toBe("h264");
|
||||
expect(readFileSync(join(project, "index.html"), "utf-8")).toContain(out);
|
||||
},
|
||||
60_000,
|
||||
);
|
||||
|
||||
const linkKinds = [
|
||||
["hard link", linkSync],
|
||||
["symlink", symlinkSync],
|
||||
] as const;
|
||||
|
||||
it.skipIf(!hevc).each(linkKinds)(
|
||||
"never transcodes onto the HEVC source through a %s where its .mp4 would go",
|
||||
async (_, link) => {
|
||||
rmSync(join(project, "original.mp4"));
|
||||
const source = join(project, "original.mov");
|
||||
encode(source, ["-c:v", "libx265", "-tag:v", "hvc1"]);
|
||||
link(source, join(project, "original.mp4"));
|
||||
const video = readFileSync(source);
|
||||
await initWithVideo(source, false);
|
||||
expect(readFileSync(source).equals(video)).toBe(true);
|
||||
expect(codecOf(source)).toBe("hevc");
|
||||
expect(codecOf(join(project, "original.h264.mp4"))).toBe("h264");
|
||||
},
|
||||
60_000,
|
||||
);
|
||||
|
||||
it.skipIf(!hevc).each(linkKinds)(
|
||||
"never transcodes onto the HEVC source through a %s where its .h264.mp4 would go",
|
||||
async (_, link) => {
|
||||
rmSync(join(project, "original.mp4"));
|
||||
const source = join(project, "original.mp4");
|
||||
encode(source, ["-c:v", "libx265", "-tag:v", "hvc1"]);
|
||||
link(source, join(project, "original.h264.mp4"));
|
||||
const video = readFileSync(source);
|
||||
await initWithVideo(source, false);
|
||||
expect(readFileSync(source).equals(video)).toBe(true);
|
||||
expect(codecOf(source)).toBe("hevc");
|
||||
expect(codecOf(join(project, "original.h264-2.mp4"))).toBe("h264");
|
||||
},
|
||||
60_000,
|
||||
);
|
||||
|
||||
it.skipIf(!hevc)(
|
||||
"never transcodes onto the HEVC source when it is named through a linked folder",
|
||||
async () => {
|
||||
rmSync(join(project, "original.mp4"));
|
||||
encode(join(project, "original.mp4"), ["-c:v", "libx265", "-tag:v", "hvc1"]);
|
||||
const alias = join(dir, "alias");
|
||||
symlinkSync(project, alias);
|
||||
const source = join(alias, "original.mp4");
|
||||
const video = readFileSync(source);
|
||||
await initWithVideo(source, false);
|
||||
expect(readFileSync(source).equals(video)).toBe(true);
|
||||
expect(codecOf(source)).toBe("hevc");
|
||||
expect(codecOf(join(project, "original.h264.mp4"))).toBe("h264");
|
||||
},
|
||||
60_000,
|
||||
);
|
||||
@@ -23,8 +23,10 @@ export const examples: Example[] = [
|
||||
];
|
||||
import {
|
||||
existsSync,
|
||||
lstatSync,
|
||||
mkdirSync,
|
||||
copyFileSync,
|
||||
statSync,
|
||||
writeFileSync,
|
||||
readFileSync,
|
||||
readdirSync,
|
||||
@@ -278,8 +280,58 @@ function getSharedTemplateDir(): string {
|
||||
return resolveAssetDir(["..", "templates", "_shared"], ["templates", "_shared"]);
|
||||
}
|
||||
|
||||
function holdsFilesBesideProjectConfig(dir: string): boolean {
|
||||
return existsSync(dir) && readdirSync(dir).some((name) => name !== "hyperframes.json");
|
||||
const MEDIA_THE_SCAFFOLD_NEVER_WRITES =
|
||||
/\.(mp4|m4v|mov|webm|mkv|avi|mpe?g|wav|mp3|m4a|aac|ogg|oga|opus|flac)$/i;
|
||||
|
||||
function fileOnDisk(path: string): string | undefined {
|
||||
try {
|
||||
const { dev, ino } = statSync(path);
|
||||
return `${dev}:${ino}`;
|
||||
} catch {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
function holdsFilesBesideProjectConfigOrSources(
|
||||
dir: string,
|
||||
sources: (string | undefined)[] = [],
|
||||
): boolean {
|
||||
const kept = new Set(
|
||||
sources.flatMap((s) => (s && MEDIA_THE_SCAFFOLD_NEVER_WRITES.test(s) ? [fileOnDisk(s)] : [])),
|
||||
);
|
||||
kept.delete(undefined);
|
||||
const isKeptSource = (name: string) =>
|
||||
MEDIA_THE_SCAFFOLD_NEVER_WRITES.test(name) && kept.has(fileOnDisk(resolve(dir, name)));
|
||||
return (
|
||||
existsSync(dir) &&
|
||||
readdirSync(dir).some((name) => name !== "hyperframes.json" && !isKeptSource(name))
|
||||
);
|
||||
}
|
||||
|
||||
function nothingAt(path: string): boolean {
|
||||
try {
|
||||
lstatSync(path);
|
||||
return false;
|
||||
} catch {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The first of `name.mp4`, `name.h264.mp4`, `name.h264-2.mp4`, ... with nothing at its path. FFmpeg
|
||||
* overwrites its output, and a link or a case-only spelling there can be the source itself.
|
||||
*/
|
||||
function freeTranscodeName(destDir: string, localVideoName: string): string {
|
||||
const stem = localVideoName.replace(/\.[^.]+$/, "");
|
||||
for (let n = 0; ; n++) {
|
||||
const name = n === 0 ? `${stem}.mp4` : `${stem}.h264${n === 1 ? "" : `-${n}`}.mp4`;
|
||||
if (nothingAt(resolve(destDir, name))) return name;
|
||||
}
|
||||
}
|
||||
|
||||
function copyIntoProjectUnlessAlreadyThere(src: string, dest: string): void {
|
||||
const same = resolve(src) === resolve(dest) || fileOnDisk(src) === (fileOnDisk(dest) ?? "");
|
||||
if (!same) copyFileSync(src, dest);
|
||||
}
|
||||
|
||||
/** The longest folder name the common disks hold: 255 UTF-8 bytes on Linux, 255 UTF-16 units on macOS and Windows. */
|
||||
@@ -492,7 +544,7 @@ async function handleVideoFile(
|
||||
}
|
||||
|
||||
if (shouldTranscode) {
|
||||
const mp4Name = localVideoName.replace(/\.[^.]+$/, ".mp4");
|
||||
const mp4Name = freeTranscodeName(destDir, localVideoName);
|
||||
const mp4Path = resolve(destDir, mp4Name);
|
||||
const spin = clack.spinner();
|
||||
spin.start("Transcoding to H.264 MP4...");
|
||||
@@ -502,10 +554,10 @@ async function handleVideoFile(
|
||||
localVideoName = mp4Name;
|
||||
} else {
|
||||
spin.stop(c.warn("Transcode failed — copying original file"));
|
||||
copyFileSync(videoPath, resolve(destDir, localVideoName));
|
||||
copyIntoProjectUnlessAlreadyThere(videoPath, resolve(destDir, localVideoName));
|
||||
}
|
||||
} else {
|
||||
copyFileSync(videoPath, resolve(destDir, localVideoName));
|
||||
copyIntoProjectUnlessAlreadyThere(videoPath, resolve(destDir, localVideoName));
|
||||
}
|
||||
} else {
|
||||
if (interactive) {
|
||||
@@ -515,10 +567,10 @@ async function handleVideoFile(
|
||||
console.log(c.warn("ffmpeg not installed — cannot transcode. Copying original."));
|
||||
console.log(c.dim("Install: ") + c.accent(getFFmpegInstallHint()));
|
||||
}
|
||||
copyFileSync(videoPath, resolve(destDir, localVideoName));
|
||||
copyIntoProjectUnlessAlreadyThere(videoPath, resolve(destDir, localVideoName));
|
||||
}
|
||||
} else {
|
||||
copyFileSync(videoPath, resolve(destDir, localVideoName));
|
||||
copyIntoProjectUnlessAlreadyThere(videoPath, resolve(destDir, localVideoName));
|
||||
}
|
||||
|
||||
return { meta, localVideoName };
|
||||
@@ -864,7 +916,7 @@ export default defineCommand({
|
||||
failCommand();
|
||||
}
|
||||
|
||||
if (holdsFilesBesideProjectConfig(destDir)) {
|
||||
if (holdsFilesBesideProjectConfigOrSources(destDir, [videoFlag, audioFlag])) {
|
||||
console.error(c.error(`Directory already exists and is not empty: ${name}`));
|
||||
failCommand();
|
||||
}
|
||||
@@ -912,7 +964,7 @@ export default defineCommand({
|
||||
// Handle audio
|
||||
if (audioPath) {
|
||||
sourceFilePath = audioPath;
|
||||
copyFileSync(audioPath, resolve(destDir, basename(audioPath)));
|
||||
copyIntoProjectUnlessAlreadyThere(audioPath, resolve(destDir, basename(audioPath)));
|
||||
const { getMediaDurationSeconds } = await import("../whisper/transcribe.js");
|
||||
videoDuration = getMediaDurationSeconds(audioPath) ?? undefined;
|
||||
console.log(`Audio: ${basename(audioPath)}`);
|
||||
@@ -1048,7 +1100,7 @@ export default defineCommand({
|
||||
failCommand();
|
||||
}
|
||||
|
||||
if (holdsFilesBesideProjectConfig(destDir)) {
|
||||
if (holdsFilesBesideProjectConfigOrSources(destDir, [videoFlag, audioFlag])) {
|
||||
const overwrite = await clack.confirm({
|
||||
message: `Directory ${c.accent(name)} already exists and is not empty. Overwrite?`,
|
||||
initialValue: false,
|
||||
@@ -1089,7 +1141,7 @@ export default defineCommand({
|
||||
}
|
||||
mkdirSync(destDir, { recursive: true });
|
||||
sourceFilePath = audioPath;
|
||||
copyFileSync(audioPath, resolve(destDir, basename(audioPath)));
|
||||
copyIntoProjectUnlessAlreadyThere(audioPath, resolve(destDir, basename(audioPath)));
|
||||
const { getMediaDurationSeconds } = await import("../whisper/transcribe.js");
|
||||
videoDuration = getMediaDurationSeconds(audioPath) ?? undefined;
|
||||
clack.log.info(`Audio copied to ${c.accent(basename(audioPath))}`);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { runCommand } from "citty";
|
||||
import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
@@ -169,12 +169,29 @@ describe("reverse start", () => {
|
||||
{ recorded: false, reason: "unavailable", plan: "free" },
|
||||
{ signed_in: true, plan: "free", recorded: false },
|
||||
],
|
||||
])("never stops the run when %s", async (_label, answer, reverse) => {
|
||||
server.answer = answer;
|
||||
])(
|
||||
"never stops the run when %s, and still makes the --dir project",
|
||||
async (_label, answer, reverse) => {
|
||||
server.answer = answer;
|
||||
const dir = join(root, "rebuild");
|
||||
await run("--dir", dir);
|
||||
expect(output()).toMatchObject({
|
||||
ok: true,
|
||||
width: 1080,
|
||||
reverse: { ...reverse, saved_to: join(dir, "hyperframes.json") },
|
||||
});
|
||||
expect(config(dir)).toMatchObject({ authoringSkill: "reverse-any-video" });
|
||||
expect(config(dir)).not.toHaveProperty("reverseSessionId");
|
||||
},
|
||||
);
|
||||
|
||||
it("names no saved_to when the --dir project's config is broken, and leaves it as it was", async () => {
|
||||
const dir = join(root, "rebuild");
|
||||
mkdirSync(dir);
|
||||
writeFileSync(join(dir, "hyperframes.json"), "{ not json");
|
||||
await run("--dir", dir);
|
||||
expect(output()).toMatchObject({ ok: true, width: 1080, reverse });
|
||||
expect(() => readFileSync(join(dir, "hyperframes.json"))).toThrow();
|
||||
expect(output()).toMatchObject({ ok: true, reverse: { recorded: false, saved_to: null } });
|
||||
expect(readFileSync(join(dir, "hyperframes.json"), "utf-8")).toBe("{ not json");
|
||||
});
|
||||
|
||||
it("stops a Free account the server blocks, with the subscribe command as the fix, after saving the session", async () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { existsSync } from "node:fs";
|
||||
import { existsSync, mkdirSync } from "node:fs";
|
||||
import { defineCommand } from "../../utils/defineCommand.js";
|
||||
import type { Example } from "../_examples.js";
|
||||
import { jsonArg, runMeasure, videoArg } from "../../measure/command.js";
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
projectConfigPath,
|
||||
readProjectConfig,
|
||||
recordProjectReverseSession,
|
||||
seedProjectAuthoringSkill,
|
||||
} from "../../utils/projectConfig.js";
|
||||
import { probeReport } from "../measure/probe.js";
|
||||
|
||||
@@ -44,6 +45,7 @@ async function summary(started: ReverseStart, savedTo: string | undefined) {
|
||||
signed_in: started.reason !== "not_signed_in",
|
||||
plan: started.plan ?? null,
|
||||
recorded: false,
|
||||
saved_to: savedTo ?? null,
|
||||
...(started.plan === "free"
|
||||
? { upgrade_url: await reverseUpgradeUrl(), subscribe_command: subscribeCommand() }
|
||||
: {}),
|
||||
@@ -61,6 +63,22 @@ async function summary(started: ReverseStart, savedTo: string | undefined) {
|
||||
};
|
||||
}
|
||||
|
||||
function makeProjectStampedWithSkill(dir: string): string | undefined {
|
||||
try {
|
||||
mkdirSync(dir, { recursive: true });
|
||||
} catch {
|
||||
return undefined;
|
||||
}
|
||||
seedProjectAuthoringSkill(dir, SKILL);
|
||||
return readProjectConfig(dir)?.authoringSkill === SKILL ? projectConfigPath(dir) : undefined;
|
||||
}
|
||||
|
||||
function saveRun(started: ReverseStart, dir: string | undefined): string | undefined {
|
||||
if (started.recorded && (dir !== undefined || existsSync(projectConfigPath("."))))
|
||||
return recordProjectReverseSession(dir ?? ".", started.session.sessionId, SKILL);
|
||||
return dir === undefined ? undefined : makeProjectStampedWithSkill(dir);
|
||||
}
|
||||
|
||||
async function refusalWhenServerBlocksFree(session: ReverseSession): Promise<Fix | undefined> {
|
||||
if (session.gate !== "block" || session.plan !== "free") return undefined;
|
||||
if ((await reverseUpgradeUrl(session)) === null) {
|
||||
@@ -99,10 +117,7 @@ export default defineCommand({
|
||||
const started = await startReverseSession({
|
||||
resumeSessionId: readProjectConfig(projectDir)?.reverseSessionId,
|
||||
});
|
||||
const save = started.recorded && (dir !== undefined || existsSync(projectConfigPath(".")));
|
||||
const savedTo = save
|
||||
? recordProjectReverseSession(projectDir, started.session.sessionId, SKILL)
|
||||
: undefined;
|
||||
const savedTo = saveRun(started, dir);
|
||||
const refused = started.recorded
|
||||
? await refusalWhenServerBlocksFree(started.session)
|
||||
: undefined;
|
||||
|
||||
Reference in New Issue
Block a user