@hypersocial/decks-cli 0.9.20 → 0.9.22

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hypersocial/decks-cli",
3
- "version": "0.9.20",
3
+ "version": "0.9.22",
4
4
  "description": "Command-line client for Hypersocial Decks live analytics and share management.",
5
5
  "type": "module",
6
6
  "main": "./src/commands.mjs",
@@ -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.20"
5
+ version: "0.9.22"
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. Viewers can
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
 
@@ -1011,6 +1038,10 @@ rebuild's list on 2026-11-05 produced four.
1011
1038
  `deck list --tag <tag>` / `list_decks { tag }` lists one tag's decks, and
1012
1039
  `deck new … --tag <tag,...>` tags at creation. Tags are the owner's own
1013
1040
  labels: recipients never see them.
1041
+ - To find a deck by who it went to ("the one I sent a16z"): `hyperdecks deck list
1042
+ --search a16z` / `list_decks { search: "a16z" }`. Search matches the title,
1043
+ slug, tags and `sentTo` (each share link's recipient name, email and note; QA
1044
+ links never), the same as the dashboard search; it combines with `tag`.
1014
1045
  - To retire a deck ("archive it", "put it away", a superseded draft), archive it:
1015
1046
  `hyperdecks deck archive <slug>` / `archive_deck`. It is reversible
1016
1047
  (`deck unarchive` / `unarchive_deck` puts back the status it had) and deletes
@@ -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
@@ -18,6 +18,7 @@ import { fetchVersionInfo, updatePreflight } from "./update.mjs";
18
18
  import { refreshSkillCopies } from "./skillFreshness.mjs";
19
19
  import * as ops from "./ops.mjs";
20
20
  import { MAX_TAGS, normalizeTags } from "./tags.mjs";
21
+ import { sentToLabel, sentToMatch } from "./deckSearch.mjs";
21
22
  import { exportVideo } from "./export-video.mjs";
22
23
  import { presenterLine } from "./presenter.mjs";
23
24
 
@@ -44,8 +45,18 @@ async function whoamiCmd(opts) {
44
45
  return null;
45
46
  });
46
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;
47
55
  if (opts.json) {
48
- console.log(JSON.stringify({ ...(who || {}), deployment: t.name, convexUrl: t.convexUrl, cli }, null, 2));
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));
49
60
  if (signedOut) throw signedOut;
50
61
  return;
51
62
  }
@@ -59,6 +70,8 @@ async function whoamiCmd(opts) {
59
70
  console.log(`email: ${who.email}`);
60
71
  console.log(`subject: ${who.subject}`);
61
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})`);
62
75
  console.log(`deployment: ${t.name} (${t.convexUrl})`);
63
76
  console.log(cliLine);
64
77
  }
@@ -75,15 +88,31 @@ function tagFlag(opts, usage) {
75
88
  return v;
76
89
  }
77
90
 
91
+ // --search: same refusal as tagFlag for a missing value; the text is free.
92
+ function searchFlag(opts) {
93
+ if (!("search" in opts)) return undefined;
94
+ const v = opts.search;
95
+ if (typeof v !== "string" || !v.trim() || v === "undefined" || v.startsWith("--")) throw new Error("--search needs some text: deck list --search <text>");
96
+ return v;
97
+ }
98
+
78
99
  async function deckList(opts) {
79
100
  const tag = tagFlag(opts, "deck list --tag <tag>");
80
- const rows = await ops.listDecks(opts, { tag });
101
+ const search = searchFlag(opts);
102
+ const rows = await ops.listDecks(opts, { tag, search });
81
103
  if (opts.json) {
82
104
  console.log(JSON.stringify(rows, null, 2));
83
105
  return;
84
106
  }
85
- for (const d of rows) console.log(`${d.slug}\t${d.status}\t${d.title}${d.tags.length ? `\t#${d.tags.join(" #")}` : ""}`);
86
- if (!rows.length) console.log(tag ? `(no decks tagged ${tag})` : "(no decks)");
107
+ for (const d of rows) {
108
+ // Found only through who it was sent to: say who, as the dashboard does.
109
+ const sentTo = search ? sentToMatch(d, search) : null;
110
+ console.log(`${d.slug}\t${d.status}\t${d.title}${d.tags.length ? `\t#${d.tags.join(" #")}` : ""}${sentTo ? `\t→ ${sentToLabel(sentTo)}` : ""}`);
111
+ }
112
+ if (!rows.length) {
113
+ if (search) console.log(`(no decks${tag ? ` tagged ${tag}` : ""} match "${search.trim()}")`);
114
+ else console.log(tag ? `(no decks tagged ${tag})` : "(no decks)");
115
+ }
87
116
  }
88
117
 
89
118
  const TAG_USAGE = "usage: deck tag <slug> add|remove <tag...> [--json]";
@@ -442,12 +471,15 @@ async function engagement(pos, opts) {
442
471
  }
443
472
 
444
473
  async function credits(pos, opts) {
474
+ const access = await ops.accessStatus(opts).catch(() => null);
475
+ const waitlisted = !!access && access.status !== "approved";
445
476
  const bal = await ops.creditsBalance(opts);
446
477
  const ledger = await ops.creditsLedger(opts, opts.limit || 10);
447
478
  if (opts.json) {
448
- 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));
449
480
  return;
450
481
  }
482
+ if (waitlisted) console.log(ops.WAITLIST_NOTE);
451
483
  console.log(`credits: ${bal.balance}`);
452
484
  for (const e of ledger) {
453
485
  const when = new Date(e.at).toISOString().slice(0, 16).replace("T", " ");
@@ -522,8 +554,10 @@ commands:
522
554
  logout [--dev]
523
555
  whoami [--json] [--dev]
524
556
  deck list|tag|stats|open|link|archive|unarchive|rm|forward|view|transfer|transfers
525
- deck list [--tag <tag>] [--json]
526
- your decks; --tag shows only the ones carrying that tag.
557
+ deck list [--tag <tag>] [--search <text>] [--json]
558
+ your decks; --tag shows only the ones carrying that tag; --search only those whose
559
+ title, slug, tags or recipients (share link name, email, note) contain the text,
560
+ like the dashboard search (→ shows who it was sent to when only a recipient matched).
527
561
  deck tag <slug> [add|remove <tag...>] [--json]
528
562
  label a deck for yourself (investors, fizz-fm…): lowercase a-z 0-9 -, 1–32 characters,
529
563
  spaces become -, at most 10 a deck. Only you see them; never recipients. No action: print them.
@@ -631,7 +665,7 @@ commands:
631
665
  with --notes), a footer with the deck's tracked link; kept 30 days
632
666
  export <slug|deck-dir> --video [--size 1080p|720p|4k] [--shape 16:9|9:16|1:1] [--no-captions]
633
667
  [--no-avatar] [--title-card] [--end-card [--link <url>]] [--slides <a-b>] [--upload]
634
- [--out <file.mp4>] [--json]
668
+ [--out <file.mp4>] [--hosted] [--json]
635
669
  an MP4 of the narrated deck, drawn frame by frame so the avatar is smooth (slower
636
670
  than real time: a 4-minute deck takes about 25 minutes with the live head on a
637
671
  laptop; the dashboard's Export → Video splits it across machines, about 10
@@ -639,7 +673,8 @@ commands:
639
673
  records the released copy, a deck folder its working copy. --slides 3-5 records
640
674
  only those slides (counting from 1). --title-card adds the title and presenter
641
675
  (2s), --end-card the deck's "Video viewers" link (3s); --upload keeps it with the
642
- 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)
643
678
  export list [<slug>] [--json] your exports and their download links
644
679
  export status <exportId> [--json] one export: a hosted video's progress, its link when done
645
680
  export cancel <exportId> stop a hosted video export (Export → Video, export_deck mp4)
@@ -647,6 +682,7 @@ commands:
647
682
  poster <slug> [--force] [--json]
648
683
  regenerate the share-link poster (release makes one) and print its URL
649
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)
650
686
 
651
687
  preview create <slug> --out <directory> [--share <token>] [--upload] [--json]
652
688
  preview create --file <index.html> --out <directory> [--duration 4] [--width 600] [--delay 1000] [--label "Watch"] [--aspect-ratio 16:9]
@@ -931,6 +967,7 @@ async function exportCmd(pos, opts) {
931
967
  if (opts.gif) throw new Error("the email GIF is `hyperdecks preview create`");
932
968
  const video = opts.video || opts.mp4;
933
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));
934
971
  if (video) return void (await exportVideo(arg, opts));
935
972
  if (!opts.pdf) throw new Error(`${usage}\n(pick --pdf or --video)`);
936
973
  const { slug, script } = exportTarget(arg, opts);
@@ -946,6 +983,33 @@ async function exportCmd(pos, opts) {
946
983
  console.log(` download (30 days): ${out.url}`);
947
984
  }
948
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
+
949
1013
  // One export, a line: "pitch mp4 rendering: slide 3/12" / "… ready, 4:31, 1920×1080, 48.2 MB".
950
1014
  export function exportStatusLine(r) {
951
1015
  const p = r.progress;
@@ -1296,6 +1360,8 @@ function commandTable(pos, rest, opts) {
1296
1360
  if (opts.json) return void console.log(JSON.stringify(r, null, 2));
1297
1361
  console.log(exportStatusLine(r));
1298
1362
  if (r.url) console.log(` ${r.url}`);
1363
+ const credits = exportCreditsLine(r);
1364
+ if (credits) process.stderr.write(`${credits}\n`);
1299
1365
  },
1300
1366
  "export cancel": async () => {
1301
1367
  if (!pos[2]) throw new Error("usage: export cancel <exportId>");
@@ -1308,6 +1374,11 @@ function commandTable(pos, rest, opts) {
1308
1374
  console.log(opts.json ? JSON.stringify(out) : `✓ removed ${pos[2]}`);
1309
1375
  },
1310
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
+ },
1311
1382
  };
1312
1383
  }
1313
1384
 
@@ -0,0 +1,53 @@
1
+ // Deck text search, shared by the dashboard (lib/deckSort.ts filterDecks), the
2
+ // CLI (`deck list --search`) and both MCPs (list_decks search), so one search
3
+ // finds the same decks everywhere. Pure: no Convex, no React.
4
+ //
5
+ // One case-insensitive substring test over the deck's title, slug and tags,
6
+ // and over each person it was sent to (decks.listForViewer sentTo: the link's
7
+ // recipient name, email and note; QA links never appear there).
8
+
9
+ /** @typedef {{ name: string, email?: string, note?: string }} SentTo */
10
+ /** @typedef {{ title: string, slug: string, tags?: string[], sentTo?: SentTo[] }} SearchableDeck */
11
+
12
+ /** @param {string | null | undefined} q */
13
+ export const searchNeedle = (q) => (q ?? "").trim().toLowerCase();
14
+
15
+ /** @param {string | null | undefined} s @param {string} needle */
16
+ const has = (s, needle) => !!s && s.toLowerCase().includes(needle);
17
+
18
+ /**
19
+ * Whether the deck matches the search, and how. null: no match (or an empty
20
+ * search, which every deck passes: callers skip searching then). `sentTo`
21
+ * lists the recipients that matched, and is empty when the deck's own title,
22
+ * slug or a tag matched: only a recipient-only match needs explaining.
23
+ * @param {SearchableDeck} deck
24
+ * @param {string | null | undefined} q
25
+ * @returns {{ sentTo: SentTo[] } | null}
26
+ */
27
+ export function deckSearchMatch(deck, q) {
28
+ const needle = searchNeedle(q);
29
+ if (!needle) return null;
30
+ if (has(deck.title, needle) || has(deck.slug, needle) || (deck.tags ?? []).some((t) => has(t, needle))) return { sentTo: [] };
31
+ const sentTo = (deck.sentTo ?? []).filter((r) => has(r.name, needle) || has(r.email, needle) || has(r.note, needle));
32
+ return sentTo.length ? { sentTo } : null;
33
+ }
34
+
35
+ /** @param {SearchableDeck} deck @param {string | null | undefined} q */
36
+ export const deckMatchesSearch = (deck, q) => !searchNeedle(q) || deckSearchMatch(deck, q) !== null;
37
+
38
+ /**
39
+ * Who a recipient-only match was sent to, for the "Sent to …" line: the first
40
+ * matching name and how many more ("a16z +2"). null when the deck matched on
41
+ * its own title, slug or tags, or not at all.
42
+ * @param {SearchableDeck} deck
43
+ * @param {string | null | undefined} q
44
+ * @returns {{ name: string, more: number } | null}
45
+ */
46
+ export function sentToMatch(deck, q) {
47
+ const hit = deckSearchMatch(deck, q);
48
+ if (!hit?.sentTo.length) return null;
49
+ return { name: hit.sentTo[0].name, more: hit.sentTo.length - 1 };
50
+ }
51
+
52
+ /** @param {{ name: string, more: number }} m */
53
+ export const sentToLabel = (m) => (m.more ? `${m.name} +${m.more}` : m.name);
@@ -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. Same as the dashboard's Export → Video; `hyperdecks export <slug> --video` records one locally instead.";
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. Poll every 20-30 seconds.";
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/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
- // A ledger with no rows means the starter grant has not landed yet: it does on
329
- // the first spend, so a new account can afford its first clone.
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
- if (balance > 0) return balance;
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
@@ -5,6 +5,7 @@ import { COLOR_KEYS, FONT_PAIRINGS, FONT_ROLES, findPairing, googleFontsUrl } fr
5
5
  import { MAX_IMPORT_FILE_BYTES, draftArgs, extractFile } from "./brandImport.mjs";
6
6
  import { api, backupLinkUrl, client, linkBase, target, uploadBytes as runtimeUploadBytes } from "./runtime.mjs";
7
7
  import { normalizeTags, TAG_RULE } from "./tags.mjs";
8
+ import { deckMatchesSearch } from "./deckSearch.mjs";
8
9
  import {
9
10
  bytesFromText,
10
11
  isTextAsset,
@@ -34,18 +35,24 @@ export function ownerLink(opts, slug) {
34
35
  }
35
36
 
36
37
  // `tag`: only the decks carrying it (normalized the way tags are stored).
37
- /** @param {any} [opts] @param {{ all?: boolean, tag?: string }} [filter] */
38
- export async function listDecks(opts = {}, { all = false, tag } = {}) {
38
+ // `search`: only the decks whose title, slug, tags or recipients (sentTo: the
39
+ // share links' names, emails and notes, never QA links) contain the text, the
40
+ // dashboard's search (deckSearch.mjs). An admin's `all` carries no recipients.
41
+ /** @param {any} [opts] @param {{ all?: boolean, tag?: string, search?: string }} [filter] */
42
+ export async function listDecks(opts = {}, { all = false, tag, search } = {}) {
39
43
  const wanted = tag == null ? [] : normalizeTags(tag);
40
44
  if (tag != null && wanted.length !== 1) throw new Error(wanted.length ? "filter by one tag at a time" : `name a tag to filter by: ${TAG_RULE}`);
41
45
  const want = wanted[0] ?? null;
42
46
  const rows = await (await client(opts)).query(all ? api.decks.listAll : api.decks.listForViewer, {});
43
- return rows.filter((d) => !want || (d.tags ?? []).includes(want)).map((d) => ({
47
+ return rows.filter((d) => (!want || (d.tags ?? []).includes(want)) && deckMatchesSearch({ ...d, sentTo: all ? [] : d.sentTo }, search)).map((d) => ({
44
48
  slug: d.slug,
45
49
  title: d.title,
46
50
  status: d.status,
47
51
  // The owner's own labels (deck tag / tag_deck), sorted.
48
52
  tags: d.tags ?? [],
53
+ // Who it was sent to ({ name, email?, note? } per non-QA link, newest
54
+ // first); empty for an admin's all.
55
+ sentTo: all ? [] : d.sentTo ?? [],
49
56
  ownerEmail: d.ownerEmail ?? null,
50
57
  hasHtml: !!(d.html || d.htmlStorageId || d.hasHtml),
51
58
  // How it opens (null: as its HTML says) and whether viewers may switch.
@@ -129,6 +136,32 @@ export async function creditsBalance(opts = {}) {
129
136
  return (await client(opts)).query(api.credits.getBalance, {});
130
137
  }
131
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
+
132
165
  // Read the user's recent credit ledger (most recent first).
133
166
  export async function creditsLedger(opts = {}, limit) {
134
167
  const args = limit ? { limit: Number(limit) } : {};
@@ -485,7 +518,12 @@ export async function listAllVoices(opts = {}) {
485
518
  // ---- voice cloning (convex/voices.ts) ---------------------------------------
486
519
 
487
520
  // The text of a backend error: ConvexError data (production redacts the rest), else the message.
488
- export const errorText = (e) => (typeof e?.data === "string" ? e.data : e?.message || String(e));
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
+ };
489
527
 
490
528
  // Upload one recording and bind it to you as a clone sample; returns { sampleId, size }.
491
529
  export async function uploadVoiceSample(opts, { bytes, contentType }, adapter = {}) {
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.20";
12
+ export const VERSION = "0.9.22";
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"]);