Skip to content

Commit a23ab12

Browse files
fix(cli): a voice pick waits for a known account instead of binding to none
Rames: when /v3/users/me failed, senderScope() was null and the pick was bound to an empty scope; once the account came back, the same command missed that binding and could pick another voice and paid key. pickVoice now stops before picking or posting while the account is unknown, and never reads or writes a blank-account binding. Regressions, both directions: unknown then known refuses with no POST, then picks once; known then unknown refuses the re-run with no second POST, then resumes with the same body and key. Also README: a non-interactive install gets all 8 skills, not 7.
1 parent 188c413 commit a23ab12

3 files changed

Lines changed: 52 additions & 3 deletions

File tree

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ The skills teach agents the HyperFrames production loop: plan the video, write v
8383

8484
HyperFrames ships 8 skills. Make any video by asking for it; the `/hyperframes` skill carries the contract and the references (film, captions, overlays, motion, look). Read it first.
8585

86-
For standalone installation, default to the **core set** (`/hyperframes`, `/hyperframes-cli`, `/hyperframes-registry`, `/media-use`). `npx hyperframes skills update` installs exactly that from anywhere; the interactive picker (`npx skills add heygen-com/hyperframes`) lists it as the "Core Skills" group, nothing pre-selected. The picker is interactive-only — a non-interactive or agent run without `--skill` installs all 7. Use `npx skills add heygen-com/hyperframes --all` to install the complete published set deliberately (skips the picker), or `npx skills add heygen-com/hyperframes --skill <name>` for just one (bare name, no leading `/`).
86+
For standalone installation, default to the **core set** (`/hyperframes`, `/hyperframes-cli`, `/hyperframes-registry`, `/media-use`). `npx hyperframes skills update` installs exactly that from anywhere; the interactive picker (`npx skills add heygen-com/hyperframes`) lists it as the "Core Skills" group, nothing pre-selected. The picker is interactive-only — a non-interactive or agent run without `--skill` installs all 8. Use `npx skills add heygen-com/hyperframes --all` to install the complete published set deliberately (skips the picker), or `npx skills add heygen-com/hyperframes --skill <name>` for just one (bare name, no leading `/`).
8787

8888
Standalone installs stay lean after that: `npx hyperframes init` installs the **core set** only when it is missing and never touches a skill you already have (`npx hyperframes skills update` refreshes them, and never removes one); `/figma`, `/slideshow`, `/remotion-to-hyperframes` and `/reverse-any-video` install **on demand** with `npx hyperframes skills update <name>`. Nothing re-pulls the full set behind your back.
8989

‎packages/cli/src/heygen/generate.test.ts‎

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ vi.mock("../cloud/auth.js", () => ({
1414

1515
vi.stubEnv("HEYGEN_API_KEY", "k");
1616

17+
const account = vi.hoisted(() => ({ scope: "acct" as string | null }));
18+
vi.mock("./v3.js", async (load) => ({
19+
...(await load<typeof import("./v3.js")>()),
20+
senderScope: async () => account.scope,
21+
}));
22+
1723
const {
1824
checkRequest,
1925
foldShort,
@@ -714,6 +720,7 @@ describe("pickVoice", () => {
714720
});
715721
afterEach(() => {
716722
vi.useRealTimers();
723+
account.scope = "acct";
717724
catalog = [voice("a", "Lin"), voice("b", "Wei")];
718725
asked.length = 0;
719726
posts.length = 0;
@@ -744,7 +751,9 @@ describe("pickVoice", () => {
744751
// The command's own path: pick, then generate; a timeout, a reordered catalog, the same command.
745752
const runOnce = async (r: GenerateRequest) => {
746753
const request = { ...r };
747-
request.voice = (await pickVoice(request)).voice_id;
754+
const picked = await pickVoice(request).catch((err: unknown) => err);
755+
if (picked instanceof Error) return picked;
756+
request.voice = (picked as { voice_id: string }).voice_id;
748757
vi.useFakeTimers({ toFake: ["Date", "setTimeout"] });
749758
const run = generate(request).catch((err: unknown) => err);
750759
await vi.advanceTimersByTimeAsync(31 * 60_000);
@@ -790,4 +799,38 @@ describe("pickVoice", () => {
790799
},
791800
);
792801
}
802+
const shot = (name: string): GenerateRequest => ({
803+
type: "voice",
804+
out: join(project, `assets/${name}.mp3`),
805+
voice: "Chinese",
806+
script: "你好",
807+
});
808+
809+
it("refuses before any pick or POST while the account is unknown, then picks once it is", async () => {
810+
heygen();
811+
account.scope = null;
812+
expect(await runOnce(shot("who-later"))).toMatchObject({
813+
message: expect.stringContaining("did not say which account"),
814+
});
815+
expect(posts).toHaveLength(0);
816+
expect(asked).toEqual([]);
817+
account.scope = "acct";
818+
await runOnce(shot("who-later"));
819+
expect(posts.map((p) => p.body.voice_id)).toEqual(["a".repeat(32)]);
820+
});
821+
822+
it("refuses a re-run while the account is unknown instead of starting another job", async () => {
823+
heygen();
824+
await runOnce(shot("who-lost"));
825+
account.scope = null;
826+
catalog = [voice("b", "Wei"), voice("a", "Lin")];
827+
expect(await runOnce(shot("who-lost"))).toMatchObject({
828+
message: expect.stringContaining("did not say which account"),
829+
});
830+
expect(posts).toHaveLength(1);
831+
account.scope = "acct";
832+
await runOnce(shot("who-lost"));
833+
expect(posts[1]!.key).toBe(posts[0]!.key);
834+
expect(posts[1]!.body).toEqual(posts[0]!.body);
835+
});
793836
});

‎packages/cli/src/heygen/generate.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,10 +492,16 @@ export async function pickVoice(r: GenerateRequest): Promise<Voice> {
492492
`--voice <language>, e.g. --voice English, for HeyGen's first voice in it, or a voice id: ${listed}`,
493493
);
494494
}
495+
const scope = await senderScope();
496+
if (!scope)
497+
throw new Fix(
498+
"HeyGen did not say which account this sign-in is, so a voice picked now could differ on a re-run",
499+
"run the same command again in a minute; pass --voice <voice id> to skip the pick",
500+
);
495501
const project = projectOf(dirname(resolve(r.out)));
496502
const request = idempotencyKey("voice-pick", [
497503
JSON.stringify({ ...r, out: resolve(r.out) }),
498-
(await senderScope()) ?? "",
504+
scope,
499505
]);
500506
const kept = keptVoice(project, request);
501507
if (kept) return kept;

0 commit comments

Comments
 (0)