@hypersocial/decks-cli 0.9.21 → 0.9.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/skills/hyperdecks/SKILL.md +29 -2
- package/skills/hyperdecks/chat.md +7 -0
- package/src/commands.mjs +56 -4
- package/src/export-video.mjs +56 -3
- package/src/exportHelp.mjs +12 -2
- package/src/frame-clock.mjs +6 -2
- package/src/init.mjs +19 -6
- package/src/narrate.mjs +5 -2
- package/src/ops.mjs +32 -1
- package/src/preview-moment.mjs +10 -2
- package/src/runtime.mjs +5 -1
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: hyperdecks
|
|
3
3
|
description: Use when asked to make, narrate, check or ship a deck ("make me a narrated deck", "turn this into a deck and send it"), or when working with Hypersocial Decks, Hyperdecks CLI, production deck analytics, recipient share links, deck activity, MCP deck tools, or real-world/customer-facing deck checks. Prefer production for real activity and analytics; use development only for local implementation/testing when explicitly requested.
|
|
4
4
|
metadata:
|
|
5
|
-
version: "0.9.
|
|
5
|
+
version: "0.9.23"
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Hyperdecks
|
|
@@ -15,6 +15,21 @@ Hyperdecks is the CLI and MCP surface for Hypersocial Decks live analytics,
|
|
|
15
15
|
recipient links, and deck activity. Treat real recipient activity, live deck
|
|
16
16
|
stats, customer-facing links, and "what happened" questions as production work.
|
|
17
17
|
|
|
18
|
+
## Early access: the waitlist
|
|
19
|
+
|
|
20
|
+
Hyperdecks lets people in deliberately. A new account is on the waitlist until it
|
|
21
|
+
is approved, and approval is what grants its starting credits. While it waits,
|
|
22
|
+
only `hyperdecks whoami`, `hyperdecks credits`, `hyperdecks init` and
|
|
23
|
+
`hyperdecks access redeem <code>` work (in chat: `whoami`, `credits`,
|
|
24
|
+
`get_started` and `redeem_invite`); everything else answers with the same short
|
|
25
|
+
waitlist note. `whoami` and `credits` say `access: waitlisted` when that is so.
|
|
26
|
+
|
|
27
|
+
When you see it, do not retry or work around it. Tell the person, in one or two
|
|
28
|
+
sentences: their account is on the waitlist, an email comes when it is ready,
|
|
29
|
+
and if they have an invite code you can redeem it now. When they give you a
|
|
30
|
+
code, run `hyperdecks access redeem <code>` (or `redeem_invite`), say how many
|
|
31
|
+
credits arrived, then state the price of the next step before you spend.
|
|
32
|
+
|
|
18
33
|
## First run
|
|
19
34
|
|
|
20
35
|
When `hyperdecks whoami` says not authenticated, or `hyperdecks voice list`
|
|
@@ -188,7 +203,9 @@ Pace is the third: `--pace auto` (`pace: "auto"`, the default) plays itself,
|
|
|
188
203
|
`slide` waits for Next (the Continue pill, →, a swipe) after each slide's
|
|
189
204
|
narration, and `step` also stops the narration before each `[reveal]` cue,
|
|
190
205
|
so a slide's reveals are the steps the viewer clicks through: group what
|
|
191
|
-
belongs together at one word, so each stop is a meaningful step.
|
|
206
|
+
belongs together at one word, so each stop is a meaningful step. At `step`,
|
|
207
|
+
Next while the narrator is still talking goes to the slide's next step, not
|
|
208
|
+
the next slide; after the slide's last step it moves on. Viewers can
|
|
192
209
|
switch pace (and slides/scroll) in the player's Preferences, in its top bar
|
|
193
210
|
(remembered per link); a video export always plays straight through. Pace
|
|
194
211
|
waits apply side to side (slides) only: scroll keeps its own flow.
|
|
@@ -807,6 +824,16 @@ A slide fails when the transcript does not match the script: read the error,
|
|
|
807
824
|
reword the sentence (spell numbers and names the way they are said, or add a
|
|
808
825
|
`normalize:` entry), and narrate again; only that slide re-renders.
|
|
809
826
|
|
|
827
|
+
Narration costs credits: 1 per 500 characters actually rendered, rounded up
|
|
828
|
+
(a three-minute deck is about 6). Cached lines are free, so a rerun after a
|
|
829
|
+
one-line edit charges that line only, and a slide that fails is refunded.
|
|
830
|
+
`--dry-run` prints the cost first; `narrate` prints what it charged and the
|
|
831
|
+
credits left, and with too few credits it is refused before anything renders
|
|
832
|
+
(`hyperdecks credits` shows the balance). A video recorded with `export
|
|
833
|
+
--video` on this machine is free; `--hosted` (or export_deck mp4, the
|
|
834
|
+
dashboard's Export → Video) renders it on our servers for 2 credits a started
|
|
835
|
+
minute, refunded in full if it fails or is cancelled. PDF export is free.
|
|
836
|
+
|
|
810
837
|
<!-- topic: check -->
|
|
811
838
|
### 5. Check
|
|
812
839
|
|
|
@@ -7,6 +7,13 @@ reaches a recipient until `release_deck`. Topics: call `deck_guide` with
|
|
|
7
7
|
`format`, `script`, `scripts`, `design`, `look`, `layouts`, `presenter`, `transitions` or `check`
|
|
8
8
|
before the step that needs it.
|
|
9
9
|
|
|
10
|
+
## On the waitlist?
|
|
11
|
+
|
|
12
|
+
`whoami`, `credits` and `get_started` say `access: "waitlisted"` for an account
|
|
13
|
+
not let in yet; every other tool answers with the waitlist note. Say so plainly
|
|
14
|
+
(an email comes when it is ready) and offer to redeem an invite code with
|
|
15
|
+
`redeem_invite`; do not retry the task.
|
|
16
|
+
|
|
10
17
|
## First time here?
|
|
11
18
|
|
|
12
19
|
`get_started` with no answers says where the person stands (ready voices,
|
package/src/commands.mjs
CHANGED
|
@@ -45,8 +45,18 @@ async function whoamiCmd(opts) {
|
|
|
45
45
|
return null;
|
|
46
46
|
});
|
|
47
47
|
const [who, cli] = await Promise.all([signedIn, cliVersions(opts)]);
|
|
48
|
+
// Early access: joins the waitlist on first use. A backend without it says
|
|
49
|
+
// nothing; any other failure shows as access unknown, with why.
|
|
50
|
+
let accessError = null;
|
|
51
|
+
const access = who ? await ops.accessStatus(opts).catch((e) => {
|
|
52
|
+
if (!/Could not find public function/i.test(ops.errorText(e))) accessError = ops.errorText(e);
|
|
53
|
+
return null;
|
|
54
|
+
}) : null;
|
|
48
55
|
if (opts.json) {
|
|
49
|
-
|
|
56
|
+
const accessFields = access
|
|
57
|
+
? { access: access.status === "approved" ? "approved" : "waitlisted", ...(access.status === "approved" ? {} : { accessNote: ops.WAITLIST_NOTE }) }
|
|
58
|
+
: accessError ? { access: "unknown", accessError } : {};
|
|
59
|
+
console.log(JSON.stringify({ ...(who || {}), ...accessFields, deployment: t.name, convexUrl: t.convexUrl, cli }, null, 2));
|
|
50
60
|
if (signedOut) throw signedOut;
|
|
51
61
|
return;
|
|
52
62
|
}
|
|
@@ -60,6 +70,8 @@ async function whoamiCmd(opts) {
|
|
|
60
70
|
console.log(`email: ${who.email}`);
|
|
61
71
|
console.log(`subject: ${who.subject}`);
|
|
62
72
|
console.log(`isAdmin: ${who.isAdmin}`);
|
|
73
|
+
if (access) console.log(`access: ${access.status === "approved" ? "approved" : `waitlisted (${ops.WAITLIST_NOTE})`}`);
|
|
74
|
+
else if (accessError) console.log(`access: unknown (${accessError})`);
|
|
63
75
|
console.log(`deployment: ${t.name} (${t.convexUrl})`);
|
|
64
76
|
console.log(cliLine);
|
|
65
77
|
}
|
|
@@ -459,12 +471,15 @@ async function engagement(pos, opts) {
|
|
|
459
471
|
}
|
|
460
472
|
|
|
461
473
|
async function credits(pos, opts) {
|
|
474
|
+
const access = await ops.accessStatus(opts).catch(() => null);
|
|
475
|
+
const waitlisted = !!access && access.status !== "approved";
|
|
462
476
|
const bal = await ops.creditsBalance(opts);
|
|
463
477
|
const ledger = await ops.creditsLedger(opts, opts.limit || 10);
|
|
464
478
|
if (opts.json) {
|
|
465
|
-
console.log(JSON.stringify({ ...bal, ledger }, null, 2));
|
|
479
|
+
console.log(JSON.stringify({ ...bal, ...(access ? { access: waitlisted ? "waitlisted" : "approved" } : {}), ...(waitlisted ? { accessNote: ops.WAITLIST_NOTE } : {}), ledger }, null, 2));
|
|
466
480
|
return;
|
|
467
481
|
}
|
|
482
|
+
if (waitlisted) console.log(ops.WAITLIST_NOTE);
|
|
468
483
|
console.log(`credits: ${bal.balance}`);
|
|
469
484
|
for (const e of ledger) {
|
|
470
485
|
const when = new Date(e.at).toISOString().slice(0, 16).replace("T", " ");
|
|
@@ -650,7 +665,7 @@ commands:
|
|
|
650
665
|
with --notes), a footer with the deck's tracked link; kept 30 days
|
|
651
666
|
export <slug|deck-dir> --video [--size 1080p|720p|4k] [--shape 16:9|9:16|1:1] [--no-captions]
|
|
652
667
|
[--no-avatar] [--title-card] [--end-card [--link <url>]] [--slides <a-b>] [--upload]
|
|
653
|
-
[--out <file.mp4>] [--json]
|
|
668
|
+
[--out <file.mp4>] [--hosted] [--json]
|
|
654
669
|
an MP4 of the narrated deck, drawn frame by frame so the avatar is smooth (slower
|
|
655
670
|
than real time: a 4-minute deck takes about 25 minutes with the live head on a
|
|
656
671
|
laptop; the dashboard's Export → Video splits it across machines, about 10
|
|
@@ -658,7 +673,8 @@ commands:
|
|
|
658
673
|
records the released copy, a deck folder its working copy. --slides 3-5 records
|
|
659
674
|
only those slides (counting from 1). --title-card adds the title and presenter
|
|
660
675
|
(2s), --end-card the deck's "Video viewers" link (3s); --upload keeps it with the
|
|
661
|
-
deck's exports for 30 days
|
|
676
|
+
deck's exports for 30 days. Recorded here it is free; --hosted renders it on our
|
|
677
|
+
machines instead (Export → Video: 2 credits a started minute, refunded if it fails)
|
|
662
678
|
export list [<slug>] [--json] your exports and their download links
|
|
663
679
|
export status <exportId> [--json] one export: a hosted video's progress, its link when done
|
|
664
680
|
export cancel <exportId> stop a hosted video export (Export → Video, export_deck mp4)
|
|
@@ -666,6 +682,7 @@ commands:
|
|
|
666
682
|
poster <slug> [--force] [--json]
|
|
667
683
|
regenerate the share-link poster (release makes one) and print its URL
|
|
668
684
|
credits [--limit <n>] [--json] show your credit balance and recent history
|
|
685
|
+
access redeem <code> [--json] redeem an invite code (an account on the waitlist can do nothing else)
|
|
669
686
|
|
|
670
687
|
preview create <slug> --out <directory> [--share <token>] [--upload] [--json]
|
|
671
688
|
preview create --file <index.html> --out <directory> [--duration 4] [--width 600] [--delay 1000] [--label "Watch"] [--aspect-ratio 16:9]
|
|
@@ -950,6 +967,7 @@ async function exportCmd(pos, opts) {
|
|
|
950
967
|
if (opts.gif) throw new Error("the email GIF is `hyperdecks preview create`");
|
|
951
968
|
const video = opts.video || opts.mp4;
|
|
952
969
|
if (video && opts.pdf) throw new Error("pick one of --pdf and --video");
|
|
970
|
+
if (video && opts.hosted) return void (await exportHostedVideo(arg, opts));
|
|
953
971
|
if (video) return void (await exportVideo(arg, opts));
|
|
954
972
|
if (!opts.pdf) throw new Error(`${usage}\n(pick --pdf or --video)`);
|
|
955
973
|
const { slug, script } = exportTarget(arg, opts);
|
|
@@ -965,6 +983,33 @@ async function exportCmd(pos, opts) {
|
|
|
965
983
|
console.log(` download (30 days): ${out.url}`);
|
|
966
984
|
}
|
|
967
985
|
|
|
986
|
+
// A hosted video's credits: "charged 4 credits, credits left: 26" (or refunded).
|
|
987
|
+
export function exportCreditsLine(r) {
|
|
988
|
+
if (r.credits == null) return null;
|
|
989
|
+
const left = r.creditsRemaining != null ? `, credits left: ${r.creditsRemaining}` : "";
|
|
990
|
+
return `${r.creditsRefunded ? `refunded ${r.credits} credits` : `charged ${r.credits} credits`}${left}`;
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
// export --video --hosted: the same video the dashboard's Export → Video makes,
|
|
994
|
+
// rendered on our machines (2 credits a started minute, charged when the render
|
|
995
|
+
// learns the deck's length; refunded if it fails). Without --hosted it records
|
|
996
|
+
// locally, free.
|
|
997
|
+
async function exportHostedVideo(arg, opts) {
|
|
998
|
+
const { slug } = exportTarget(arg, opts);
|
|
999
|
+
for (const k of ["upload", "out", "slides", "link"]) if (opts[k]) throw new Error(`--${k} records locally; drop --hosted, or drop --${k}`);
|
|
1000
|
+
const fields = { slug, kind: "mp4" };
|
|
1001
|
+
if (opts.size) fields.size = String(opts.size);
|
|
1002
|
+
if (opts.shape) fields.shape = String(opts.shape);
|
|
1003
|
+
if (opts["no-captions"]) fields.captions = false;
|
|
1004
|
+
if (opts["no-avatar"]) fields.avatar = false;
|
|
1005
|
+
if (opts["title-card"]) fields.titleCard = true;
|
|
1006
|
+
if (opts["end-card"]) fields.endCard = true;
|
|
1007
|
+
process.stderr.write(`a hosted video costs 2 credits a started minute of the deck, charged when the render starts; a failed or cancelled one is refunded (record it locally free: drop --hosted)\n`);
|
|
1008
|
+
const out = await ops.requestVideoExport(opts, fields);
|
|
1009
|
+
if (opts.json) return void console.log(JSON.stringify(out, null, 2));
|
|
1010
|
+
console.log(`✓ queued ${out.exportId}: follow it with \`hyperdecks export status ${out.exportId}\` (it shows the credits charged and left)`);
|
|
1011
|
+
}
|
|
1012
|
+
|
|
968
1013
|
// One export, a line: "pitch mp4 rendering: slide 3/12" / "… ready, 4:31, 1920×1080, 48.2 MB".
|
|
969
1014
|
export function exportStatusLine(r) {
|
|
970
1015
|
const p = r.progress;
|
|
@@ -1315,6 +1360,8 @@ function commandTable(pos, rest, opts) {
|
|
|
1315
1360
|
if (opts.json) return void console.log(JSON.stringify(r, null, 2));
|
|
1316
1361
|
console.log(exportStatusLine(r));
|
|
1317
1362
|
if (r.url) console.log(` ${r.url}`);
|
|
1363
|
+
const credits = exportCreditsLine(r);
|
|
1364
|
+
if (credits) process.stderr.write(`${credits}\n`);
|
|
1318
1365
|
},
|
|
1319
1366
|
"export cancel": async () => {
|
|
1320
1367
|
if (!pos[2]) throw new Error("usage: export cancel <exportId>");
|
|
@@ -1327,6 +1374,11 @@ function commandTable(pos, rest, opts) {
|
|
|
1327
1374
|
console.log(opts.json ? JSON.stringify(out) : `✓ removed ${pos[2]}`);
|
|
1328
1375
|
},
|
|
1329
1376
|
credits: () => credits(pos.slice(1), opts),
|
|
1377
|
+
// Early access: redeem an invite code (redeem_invite in chat).
|
|
1378
|
+
"access redeem": async () => {
|
|
1379
|
+
const out = await ops.redeemInvite(opts, rest[0]);
|
|
1380
|
+
console.log(opts.json ? JSON.stringify(out, null, 2) : out.message);
|
|
1381
|
+
},
|
|
1330
1382
|
};
|
|
1331
1383
|
}
|
|
1332
1384
|
|
package/src/export-video.mjs
CHANGED
|
@@ -314,6 +314,40 @@ async function within(promise, ms, fallback) {
|
|
|
314
314
|
finally { clearTimeout(timer); }
|
|
315
315
|
}
|
|
316
316
|
|
|
317
|
+
// Stepped heads (packages/player/stepped-heads.js): a player whose Minimoji
|
|
318
|
+
// bundle has createManualClock publishes window.__hdExportHeads, and each head
|
|
319
|
+
// draws only when the recorder steps its clock. Real milliseconds a head may
|
|
320
|
+
// take to report ready: the player's export head budget (HEAD_BUDGET).
|
|
321
|
+
export const HEAD_READY_MS = 30000;
|
|
322
|
+
|
|
323
|
+
// Waits until every stepped head the page has can draw (`clock.ready`, the
|
|
324
|
+
// SDK's word), then draws each one's current frame (a step of 0). A page
|
|
325
|
+
// without stepped heads (an older bundle, no head) passes at once. A head that
|
|
326
|
+
// is not ready in `ms` fails the export with a plain message (as would a
|
|
327
|
+
// rejected ready, though the SDK's settles even on a failed load).
|
|
328
|
+
export async function waitForHeads(page, ms = HEAD_READY_MS, { draw = true } = {}) {
|
|
329
|
+
const said = await within(page.evaluate(async (draw) => {
|
|
330
|
+
const heads = window.__hdExportHeads;
|
|
331
|
+
if (!heads) return { count: 0 };
|
|
332
|
+
try {
|
|
333
|
+
const count = await heads.ready();
|
|
334
|
+
// Before the first frame (real time still runs): each head measures its settled box (stepped-heads.js remeasure).
|
|
335
|
+
if (draw) { await heads.remeasure?.(); heads.step(0); }
|
|
336
|
+
return { count };
|
|
337
|
+
} catch (e) { return { error: String(e?.message ?? e) }; }
|
|
338
|
+
}, draw), ms, null);
|
|
339
|
+
if (!said) throw new Error(`the deck's live head was not ready to draw after ${Math.round(ms / 1000)}s (its model, or its narration lines still loading); nothing more was recorded`);
|
|
340
|
+
if (said.error) throw new Error(`the deck's live head could not draw: ${said.error}`);
|
|
341
|
+
return said.count;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
// Freezes the page clock once every stepped head is ready: frame 0 is the deck
|
|
345
|
+
// as it starts, with its heads drawn. Returns the clock's epoch ms at freeze.
|
|
346
|
+
export async function freezeWhenHeadsReady(page, ms = HEAD_READY_MS) {
|
|
347
|
+
await waitForHeads(page, ms);
|
|
348
|
+
return page.evaluate(() => performance.timeOrigin + window.__hdFrameClock.freeze());
|
|
349
|
+
}
|
|
350
|
+
|
|
317
351
|
// The player's export log, read without trusting the page to answer quickly.
|
|
318
352
|
// undefined when it did not answer within `ms`.
|
|
319
353
|
const readLog = (page, ms = 5000) => within(page.evaluate(() => {
|
|
@@ -439,6 +473,8 @@ export async function recordVideo(config, { log = () => {}, chromium: injected,
|
|
|
439
473
|
// A range opens on its first slide (export-mode.js exportRangeStart).
|
|
440
474
|
if (config.range?.from > 0) await context.addInitScript((from) => { window.__hdExportFrom = from; }, config.range.from);
|
|
441
475
|
await context.addInitScript(() => {
|
|
476
|
+
// This recorder steps stepped heads' clocks (waitForHeads, the frame loop): the player may use them.
|
|
477
|
+
window.__hdStepsHeads = true;
|
|
442
478
|
navigator.sendBeacon = () => false;
|
|
443
479
|
window.open = () => null;
|
|
444
480
|
// The player's export mode waits for this before it plays (export-mode.js).
|
|
@@ -559,26 +595,42 @@ export async function recordVideo(config, { log = () => {}, chromium: injected,
|
|
|
559
595
|
written.catch(() => {});
|
|
560
596
|
};
|
|
561
597
|
// Frame 0 is the deck as it starts; frame n shows it n/fps seconds later on the page clock.
|
|
562
|
-
|
|
598
|
+
// Not before every stepped head is ready (waitForHeads).
|
|
599
|
+
const markMs = await freezeWhenHeadsReady(page);
|
|
563
600
|
// Each clip ends where its real audio does (the manifest's length can be off), as <audio> would end it.
|
|
564
601
|
// A range's tour ends after its last slide (export-mode.js exportRangeEnd).
|
|
565
602
|
await page.evaluate(({ lengths, to }) => { window.__hdExportClipLengths = lengths; if (to != null) window.__hdExportTo = to; window.__hdExportGo(); return window.__hdFrameClock.settle(); }, { lengths: clipLengths, to: range ? to : null });
|
|
566
603
|
const firstFrame = frameCount;
|
|
567
604
|
await capture();
|
|
568
605
|
const secondsOf = new Map(plan.ids.map((id, i) => [id, plan.seconds[i]]));
|
|
569
|
-
let shown = 0, progress = 0, movedAt = 0, end = Infinity;
|
|
606
|
+
let shown = 0, progress = 0, movedAt = 0, end = Infinity, waited = 0;
|
|
570
607
|
// A segment's seam frames (SEAM_FRAMES): recorded past its end, dropped from its start.
|
|
571
608
|
const tail = segment && to < last ? SEAM_FRAMES : 0, skip = segment && from > 0 ? SEAM_FRAMES : 0;
|
|
572
609
|
// Stuck: no slide landed and no clip started for longer than the current
|
|
573
610
|
// slide's planned clip and hold (unknown for a data-clip deck) plus a grace, on the page clock.
|
|
574
611
|
for (let n = 1; n < end; n++) {
|
|
612
|
+
// Each stepped head moves by the same 1/fps after the page clock, once
|
|
613
|
+
// per frame (a stepped head ignores requestAnimationFrame). One that
|
|
614
|
+
// mounted this frame (a guest's slide came near) is waited for first.
|
|
575
615
|
const step = await within(page.evaluate(async (ms) => {
|
|
576
616
|
const t = window.__hdFrameClock.step(ms);
|
|
577
617
|
await window.__hdFrameClock.settle();
|
|
618
|
+
const heads = window.__hdExportHeads;
|
|
619
|
+
// A line that started loading this frame finishes before the heads move (bounded by FRAME_TIMEOUT_MS).
|
|
620
|
+
await heads?.settled?.();
|
|
621
|
+
const waiting = heads ? !(await heads.idle().catch(() => false)) : false;
|
|
622
|
+
if (heads && !waiting) heads.step(ms / 1000);
|
|
578
623
|
const l = window.__hdExport;
|
|
579
|
-
return { t, moved: l.slides.length + l.clips.length, errors: l.errors.length, done: l.done };
|
|
624
|
+
return { t, moved: l.slides.length + l.clips.length, errors: l.errors.length, done: l.done, waiting };
|
|
580
625
|
}, 1000 / fps), FRAME_TIMEOUT_MS, null);
|
|
581
626
|
if (!step) throw new Error(`the page stopped answering (a frame took over ${FRAME_TIMEOUT_MS / 1000}s to draw)${pageSaid()}`);
|
|
627
|
+
if (step.waiting) {
|
|
628
|
+
// No extra draw: a step of 0 still moves a head's smoothing, so a frame that waited would differ.
|
|
629
|
+
waited++;
|
|
630
|
+
await waitForHeads(page, HEAD_READY_MS, { draw: false });
|
|
631
|
+
const stepped = await within(page.evaluate((s) => window.__hdExportHeads.step(s), 1 / fps), FRAME_TIMEOUT_MS, null);
|
|
632
|
+
if (stepped == null) throw new Error(`the page stopped answering (a head took over ${FRAME_TIMEOUT_MS / 1000}s to draw)${pageSaid()}`);
|
|
633
|
+
}
|
|
582
634
|
await capture();
|
|
583
635
|
const at = n / fps;
|
|
584
636
|
if (step.moved !== progress || step.errors || (step.done && end === Infinity)) {
|
|
@@ -605,6 +657,7 @@ export async function recordVideo(config, { log = () => {}, chromium: injected,
|
|
|
605
657
|
const seconds = frames / fps;
|
|
606
658
|
const wall = (Date.now() - startedAt) / 1000;
|
|
607
659
|
log(`rendered ${frames} frames (${clock(seconds)}) in ${clock(wall)}: ${(frames / Math.max(0.001, wall)).toFixed(1)} frames a second, ${(wall / Math.max(0.001, seconds)).toFixed(1)}× the video's length`);
|
|
660
|
+
if (waited) log(`waited for a head to finish loading on ${waited} frame(s)`);
|
|
608
661
|
// Drift means something only when every clip's planned length is known (a data-clip deck's are not).
|
|
609
662
|
const drift = (state.plan ?? []).every((s) => !s.audio || s.duration > 0) ? timelineDrift(state, markMs) : [];
|
|
610
663
|
const worst = drift.reduce((a, d) => (Math.abs(d.drift) > Math.abs(a.drift) ? d : a), { drift: 0 });
|
package/src/exportHelp.mjs
CHANGED
|
@@ -7,13 +7,23 @@ export const VIDEO_EXPORT_HELP =
|
|
|
7
7
|
"titleCard and endCard (the deck's tracked link). It returns { exportId, status: \"queued\" } at once: poll " +
|
|
8
8
|
"check_export(exportId) every 20-30 seconds until status is ready (url is the MP4, kept 30 days; title and description " +
|
|
9
9
|
"are ready for YouTube) or failed (error says why). The owner is also emailed the link. One video per deck at a time, " +
|
|
10
|
-
"10 a day.
|
|
10
|
+
"10 a day. A video rendered here costs 2 credits a started minute, charged when the render learns the deck's length; " +
|
|
11
|
+
"a failed or cancelled one is refunded in full; with no credits at all it is refused at once, and with too few it fails (error says the cost and balance) before rendering. " +
|
|
12
|
+
"Same as the dashboard's Export → Video; `hyperdecks export <slug> --video` records one locally instead, free.";
|
|
11
13
|
|
|
12
14
|
export const CHECK_EXPORT_HELP =
|
|
13
15
|
"Check an export started by export_deck: status (queued | rendering | ready | failed | cancelled); for a video, " +
|
|
14
16
|
"progress { slide, slides, phase } and ahead (jobs before it in line); once ready, url (the file, 30 days), " +
|
|
15
17
|
"filename, bytes, seconds, width, height, and title and description for a YouTube upload (the description " +
|
|
16
|
-
"carries the deck's tracked link); error when it failed
|
|
18
|
+
"carries the deck's tracked link); error when it failed; credits (charged once its length is known), creditsRemaining " +
|
|
19
|
+
"and creditsRefunded (a failed or cancelled video gets its credits back). Poll every 20-30 seconds.";
|
|
20
|
+
|
|
21
|
+
// What both MCP servers say narration costs (convex/lib/tokenCost.ts narrationCost).
|
|
22
|
+
export const NARRATION_CREDITS_HELP =
|
|
23
|
+
"Narration costs 1 credit per 500 characters actually rendered, rounded up; lines already rendered (cached) are free, " +
|
|
24
|
+
"so re-narrating after a one-line edit charges that line only. dryRun returns uncachedChars and credits (the price) first; " +
|
|
25
|
+
"narrate returns credits (charged) and creditsRemaining. Too few credits: refused before anything starts, saying the cost and " +
|
|
26
|
+
"the balance (credits shows it). Slides that fail to render are refunded (check_narration_job: creditsRefunded).";
|
|
17
27
|
|
|
18
28
|
// The video options as zod fields (each server passes its own zod).
|
|
19
29
|
export const videoExportInputs = (z) => ({
|
package/src/frame-clock.mjs
CHANGED
|
@@ -236,13 +236,17 @@ export function installFrameClock(win) {
|
|
|
236
236
|
step(ms) {
|
|
237
237
|
if (!frozen) throw new Error('the frame clock is not frozen');
|
|
238
238
|
const target = t + Math.max(0, Number(ms) || 0);
|
|
239
|
+
// A timer due on the frame's edge (a clip that ends on a frame time) fires in this frame
|
|
240
|
+
// whatever float noise the clock's origin (the real time at freeze) leaves in `due`:
|
|
241
|
+
// otherwise one export ends a line a frame later than another.
|
|
242
|
+
const EDGE_MS = 0.001;
|
|
239
243
|
// A timer that keeps re-arming itself at 0 ms must not hang the step: it is reported, as a page error.
|
|
240
244
|
for (let guard = 0; ; guard++) {
|
|
241
245
|
let next = null, nextId = 0;
|
|
242
|
-
for (const [id, x] of timers) if (x.due <= target && (!next || x.due < next.due || (x.due === next.due && id < nextId))) { next = x; nextId = id; }
|
|
246
|
+
for (const [id, x] of timers) if (x.due <= target + EDGE_MS && (!next || x.due < next.due || (x.due === next.due && id < nextId))) { next = x; nextId = id; }
|
|
243
247
|
if (!next) break;
|
|
244
248
|
if (guard === 100000) { report(new Error('a timer re-armed itself 100000 times in one video frame; the rest wait for the next frame')); break; }
|
|
245
|
-
t = Math.max(t, next.due);
|
|
249
|
+
t = Math.min(target, Math.max(t, next.due));
|
|
246
250
|
fire(nextId);
|
|
247
251
|
}
|
|
248
252
|
t = target;
|
package/src/init.mjs
CHANGED
|
@@ -27,7 +27,6 @@ import { release as runRelease } from "./release.mjs";
|
|
|
27
27
|
export const STATE_FILE = join(CRED_DIR, "init.json");
|
|
28
28
|
// Same numbers as convex/lib/tokenCost.ts (the published CLI cannot import it).
|
|
29
29
|
export const VOICE_CLONE_COST = 10;
|
|
30
|
-
export const STARTER_GRANT = 30;
|
|
31
30
|
const SKILL_DIR = join(dirname(fileURLToPath(import.meta.url)), "..", "skills", "hyperdecks");
|
|
32
31
|
const CHARACTERS = ["dash", "d.a.s.h."];
|
|
33
32
|
const RESUME = "npx hyperdecks init";
|
|
@@ -221,6 +220,22 @@ export async function init(pos = [], opts = {}, io = {}) {
|
|
|
221
220
|
}
|
|
222
221
|
save({ email: who.email, startedAt: state.startedAt ?? new Date().toISOString() });
|
|
223
222
|
|
|
223
|
+
// 1b. Early access: an account on the waitlist can make nothing yet.
|
|
224
|
+
let access = null;
|
|
225
|
+
try {
|
|
226
|
+
access = await ops.accessStatus(base);
|
|
227
|
+
} catch (e) {
|
|
228
|
+
// A backend without early access goes on; anything else stops here, resumably.
|
|
229
|
+
if (!/Could not find public function/i.test(ops.errorText(e))) {
|
|
230
|
+
record(step("access", "failed", `could not check your access: ${ops.errorText(e)}`));
|
|
231
|
+
return finish("incomplete");
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
if (access && access.status !== "approved") {
|
|
235
|
+
record(step("access", "needs-human", ops.WAITLIST_NOTE));
|
|
236
|
+
return finish("incomplete", { access: "waitlisted" });
|
|
237
|
+
}
|
|
238
|
+
|
|
224
239
|
// 2. The skill. Its failure never stops init: the deck does not need it.
|
|
225
240
|
record(await skillStep(opts, { interactive, ask, installSkill, spawn, home, env, sub }));
|
|
226
241
|
|
|
@@ -325,13 +340,11 @@ async function skillStep(opts, { interactive, ask, installSkill, spawn, home, en
|
|
|
325
340
|
return step("skill", "ran", `skill installed for ${agents[0] === "*" ? "every agent" : agents.map(label).join(", ")}`, { agents });
|
|
326
341
|
}
|
|
327
342
|
|
|
328
|
-
//
|
|
329
|
-
// the
|
|
343
|
+
// An approved account's credits arrived with its approval (early access), so
|
|
344
|
+
// the balance is all there is.
|
|
330
345
|
async function spendable(base) {
|
|
331
346
|
const { balance } = await ops.creditsBalance(base);
|
|
332
|
-
|
|
333
|
-
const ledger = await ops.creditsLedger(base, 1);
|
|
334
|
-
return ledger.length ? balance : STARTER_GRANT;
|
|
347
|
+
return balance;
|
|
335
348
|
}
|
|
336
349
|
|
|
337
350
|
async function chooseVoice(base, opts, { interactive, ask, voiceClone, sub, log, state, who }) {
|
package/src/narrate.mjs
CHANGED
|
@@ -48,13 +48,15 @@ export async function narrate(pos, opts = {}, { log = (line) => console.log(line
|
|
|
48
48
|
if (preview.presenterStyle) log(`presenter style: ${preview.presenterStyle}`);
|
|
49
49
|
for (const s of preview.slides) log(`${s.render ? "render" : s.cached ? "cached" : "skip "} ${s.id} ${s.hash.slice(0, 12)} ${s.chars} chars${s.presenterStyle ? ` presenter-style: ${s.presenterStyle}` : ""}`);
|
|
50
50
|
const render = preview.slides.filter((s) => s.render);
|
|
51
|
-
log(`${render.length} of ${preview.slides.length} slide(s) would render in voice "${preview.voice}", ~${render.reduce((n, s) => n + s.chars, 0)} characters of TTS`);
|
|
51
|
+
log(`${render.length} of ${preview.slides.length} slide(s) would render in voice "${preview.voice}", ~${preview.uncachedChars ?? render.reduce((n, s) => n + s.chars, 0)} characters of TTS`);
|
|
52
|
+
if (preview.credits != null) log(`cost: ${preview.credits} credit${preview.credits === 1 ? "" : "s"} (1 per 500 characters rendered; cached lines are free)`);
|
|
52
53
|
const who = presenterLine(preview.presenter);
|
|
53
54
|
if (who) log(who);
|
|
54
55
|
return preview;
|
|
55
56
|
}
|
|
56
|
-
const { jobId, slides, presenter } = await ops.narrateDeck(opts, fields);
|
|
57
|
+
const { jobId, slides, presenter, credits, creditsRemaining } = await ops.narrateDeck(opts, fields);
|
|
57
58
|
log(`narration job ${jobId}: ${slides.filter((s) => s.status === "render").length} to render, ${slides.filter((s) => s.status === "cached").length} cached`);
|
|
59
|
+
if (credits > 0) log(`charged ${credits} credit${credits === 1 ? "" : "s"}${creditsRemaining != null ? `, credits left: ${creditsRemaining}` : ""}`);
|
|
58
60
|
const who = presenterLine(presenter);
|
|
59
61
|
if (who) log(who);
|
|
60
62
|
const seen = new Map();
|
|
@@ -69,6 +71,7 @@ export async function narrate(pos, opts = {}, { log = (line) => console.log(line
|
|
|
69
71
|
}
|
|
70
72
|
},
|
|
71
73
|
});
|
|
74
|
+
if (job.creditsRefunded) log(`refunded ${job.creditsRefunded} credit${job.creditsRefunded === 1 ? "" : "s"} for slides that did not render`);
|
|
72
75
|
if (job.status === "error") throw new Error(job.error || "narration failed");
|
|
73
76
|
// release reads who presents from here (older backends send no presenter).
|
|
74
77
|
if (presenter) job.presenter = presenter;
|
package/src/ops.mjs
CHANGED
|
@@ -136,6 +136,32 @@ export async function creditsBalance(opts = {}) {
|
|
|
136
136
|
return (await client(opts)).query(api.credits.getBalance, {});
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
+
// Early access (convex/access.ts). Where this account stands: joins the
|
|
140
|
+
// waitlist on first use, and is approved then and there by admin or email domain.
|
|
141
|
+
// { status: "approved" | "waitlisted", email, isAdmin }
|
|
142
|
+
export async function accessStatus(opts = {}) {
|
|
143
|
+
return (await client(opts)).mutation(api.access.ensure, {});
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// What an account on the waitlist is told, by the CLI and the stdio MCP alike.
|
|
147
|
+
export const WAITLIST_NOTE =
|
|
148
|
+
"You're on the waitlist. We'll email you when your account is ready. Have a code? hyperdecks access redeem <code>";
|
|
149
|
+
// The same, for a chat agent (the hosted connector).
|
|
150
|
+
export const WAITLIST_CHAT_NOTE =
|
|
151
|
+
"waitlisted: this Hyperdecks account is on the waitlist, so nothing else works until it is approved. An email comes when it is ready. " +
|
|
152
|
+
"If the person has an invite code, redeem it with redeem_invite.";
|
|
153
|
+
|
|
154
|
+
// Redeem an invite code. Resolves { access: "approved", credits?, message };
|
|
155
|
+
// a wrong, used-up, expired or disabled code throws its reason.
|
|
156
|
+
export async function redeemInvite(opts = {}, code) {
|
|
157
|
+
if (!code || !String(code).trim()) throw new Error("usage: access redeem <code>");
|
|
158
|
+
const out = await (await client(opts)).mutation(api.access.redeemInvite, { code: String(code).trim() });
|
|
159
|
+
if (!out.ok) throw new Error(out.error);
|
|
160
|
+
return out.alreadyApproved
|
|
161
|
+
? { access: "approved", credits: 0, message: "This account was already approved; nothing to redeem." }
|
|
162
|
+
: { access: "approved", credits: out.credits, message: `You're in. ${out.credits} credits added.` };
|
|
163
|
+
}
|
|
164
|
+
|
|
139
165
|
// Read the user's recent credit ledger (most recent first).
|
|
140
166
|
export async function creditsLedger(opts = {}, limit) {
|
|
141
167
|
const args = limit ? { limit: Number(limit) } : {};
|
|
@@ -492,7 +518,12 @@ export async function listAllVoices(opts = {}) {
|
|
|
492
518
|
// ---- voice cloning (convex/voices.ts) ---------------------------------------
|
|
493
519
|
|
|
494
520
|
// The text of a backend error: ConvexError data (production redacts the rest), else the message.
|
|
495
|
-
|
|
521
|
+
// A server refusal for an account on the waitlist (convex/lib/waitlist.ts) reads
|
|
522
|
+
// as the one waitlist note, wherever it surfaced.
|
|
523
|
+
export const errorText = (e) => {
|
|
524
|
+
const text = typeof e?.data === "string" ? e.data : e?.message || String(e);
|
|
525
|
+
return /(^|\s)waitlisted: /.test(text) ? WAITLIST_NOTE : text;
|
|
526
|
+
};
|
|
496
527
|
|
|
497
528
|
// Upload one recording and bind it to you as a clone sample; returns { sampleId, size }.
|
|
498
529
|
export async function uploadVoiceSample(opts, { bytes, contentType }, adapter = {}) {
|
package/src/preview-moment.mjs
CHANGED
|
@@ -17,7 +17,7 @@ import { mkdtemp, readFile, rm, writeFile } from 'node:fs/promises';
|
|
|
17
17
|
import { tmpdir } from 'node:os';
|
|
18
18
|
import { extname, join } from 'node:path';
|
|
19
19
|
import { installFrameClock } from './frame-clock.mjs';
|
|
20
|
-
import { exportPageUrl, launchRecorder, planTimeline } from './export-video.mjs';
|
|
20
|
+
import { exportPageUrl, launchRecorder, planTimeline, waitForHeads } from './export-video.mjs';
|
|
21
21
|
import { recorderArgs, redactCaptureUrl, routeCaptureRequest } from './preview-capture.mjs';
|
|
22
22
|
|
|
23
23
|
// Page-clock milliseconds per step while seeking to `start`: timers fire in
|
|
@@ -145,6 +145,8 @@ export async function recordMoment(config, { chromium, serveSource, dir, net = {
|
|
|
145
145
|
}
|
|
146
146
|
await context.routeWebSocket('**/*', (ws) => ws.close());
|
|
147
147
|
await context.addInitScript({ content: `(${installFrameClock.toString()})(window);` });
|
|
148
|
+
// This recorder steps stepped heads' clocks (stepped-heads.js) with the page clock.
|
|
149
|
+
await context.addInitScript(() => { window.__hdStepsHeads = true; });
|
|
148
150
|
// The player opens on __hdExportFrom, read once its slides are in the page:
|
|
149
151
|
// the scene's index among them, as the player lists them (section.slide in order).
|
|
150
152
|
// An unknown scene opens the first slide; seekTarget then refuses it by name.
|
|
@@ -171,7 +173,9 @@ export async function recordMoment(config, { chromium, serveSource, dir, net = {
|
|
|
171
173
|
if (answer === none) throw new Error(`the page stopped answering ${what} (over 30s)`);
|
|
172
174
|
return answer;
|
|
173
175
|
};
|
|
174
|
-
|
|
176
|
+
// A stepped head (a bundle with createManualClock, packages/player/stepped-heads.js) draws only
|
|
177
|
+
// when its clock steps: it moves with the page clock, after it, as in the video export.
|
|
178
|
+
const step = (ms, what) => ask(async (ms) => { window.__hdFrameClock.step(ms); await window.__hdFrameClock.settle(); window.__hdExportHeads?.step(ms / 1000); return window.__hdExport; }, ms, what);
|
|
175
179
|
phase = 'page load';
|
|
176
180
|
await page.goto(pageUrl, { waitUntil: 'domcontentloaded', timeout: 30000 });
|
|
177
181
|
phase = 'player ready';
|
|
@@ -230,6 +234,10 @@ export async function recordMoment(config, { chromium, serveSource, dir, net = {
|
|
|
230
234
|
phase = 'heads';
|
|
231
235
|
await headsSettled({ retries: true });
|
|
232
236
|
|
|
237
|
+
// A stepped head reports ready only once its model and textures are in (the head-slot
|
|
238
|
+
// state says ready at mount); it draws its first frame here, before the clock freezes.
|
|
239
|
+
await waitForHeads(page);
|
|
240
|
+
|
|
233
241
|
phase = 'seek';
|
|
234
242
|
// Clip lengths come from the manifest (player.js clipLength), as a recipient's <audio> would roughly end them.
|
|
235
243
|
await ask(async () => {
|
package/src/runtime.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import { ConvexHttpClient } from "convex/browser";
|
|
|
9
9
|
import { makeFunctionReference } from "convex/server";
|
|
10
10
|
import { recordSkillInstall } from "./skillFreshness.mjs";
|
|
11
11
|
|
|
12
|
-
export const VERSION = "0.9.
|
|
12
|
+
export const VERSION = "0.9.23";
|
|
13
13
|
|
|
14
14
|
// Sent on the CLI's calls to our routes and to Convex, so the server can see
|
|
15
15
|
// which CLI versions are still out there (not used to refuse anything).
|
|
@@ -208,6 +208,10 @@ export const api = {
|
|
|
208
208
|
getBalance: makeFunctionReference("credits:getBalance"),
|
|
209
209
|
getLedger: makeFunctionReference("credits:getLedger"),
|
|
210
210
|
},
|
|
211
|
+
access: {
|
|
212
|
+
ensure: makeFunctionReference("access:ensure"),
|
|
213
|
+
redeemInvite: makeFunctionReference("access:redeemInvite"),
|
|
214
|
+
},
|
|
211
215
|
};
|
|
212
216
|
|
|
213
217
|
const BOOL = new Set(["private-only", "prod", "dev", "admin", "json", "require-email", "qa", "no-notify", "allow-forward", "no-forward", "help", "version", "all-agents", "global", "project", "transparent", "loop", "upload", "dry-run", "narrated", "layout", "strict", "fix", "full-page", "force", "hosted", "yes", "no-voice", "no-skill", "no-release", "no-narrate", "no-open", "save-to-minimoji", "captions-only", "no-brand", "brand", "no-logo", "pdf", "notes", "mp4", "gif", "video", "no-captions", "no-avatar", "title-card", "end-card", "backup"]);
|