@officexapp/vidfarm-devcli 0.21.24 → 0.21.27

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.
@@ -5,19 +5,35 @@
5
5
  //
6
6
  // The mode is a single durable preference the human picks ONCE (ideally asked by
7
7
  // their AI agent up front), then every billed command respects it:
8
- // - minimize : never burn AI credits by surprise. Prefer free local engines;
9
- // refuse billed cloud/AI ops unless the user re-confirms (--yes).
10
- // - hybrid : free where it's free, spend on AI only where it clearly wins.
11
- // (default recommendation.) Billed ops run but print a cost line.
12
- // - pure-ai : best-quality; AI image/video/voice/music used freely. Billed
13
- // ops run; cost is still surfaced. Shown to humans as "rich-ai".
8
+ // - minimize : ~$0 per video. Never burn AI credits by surprise. Prefer free
9
+ // local engines; refuse billed cloud/AI ops unless the user
10
+ // re-confirms (--yes).
11
+ // - hybrid : roughly $0.01–$1 per video. Free where it's free, spend on AI
12
+ // only where it clearly wins. (default recommendation.) Billed
13
+ // ops run but print a cost line.
14
+ // - rich-ai : $1+ per video. AI video generation is used to mint REUSABLE
15
+ // greenscreen raws, which are then keyed and remixed with
16
+ // hyperframes/HTML-CSS motion and the rest of the raw library.
17
+ // The raws persist (local `~/.vidfarm` raws store, optionally
18
+ // `vidfarm sync push /raws` to the cloud on a Pro plan), so the
19
+ // spend amortizes into later hybrid/minimize videos. Billed ops
20
+ // run; cost is still surfaced. Shown to humans as "rich-ai".
21
+ // - pure-videogen : $5+ per video. The whole piece is generated footage —
22
+ // text script → image storyboard → per-scene, frame-by-frame
23
+ // video generation. No raws reuse, no HTML motion. The most
24
+ // expensive mode; reserve it for hero pieces.
25
+ //
26
+ // Those dollar figures are what the AI providers charge, and they are billed to
27
+ // the user's OWN provider keys (BYOK — the keys saved via `vidfarm
28
+ // add-provider-key` / Settings → Bring your own keys), not to Vidfarm. Vidfarm
29
+ // wallet credits are only used when the user explicitly runs on the platform key.
14
30
  //
15
31
  // This module lives in the CLI's static import closure and is BACKEND-FREE (only
16
32
  // Node built-ins) so it ships in the public cloud-only package.
17
33
  import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
18
34
  import path from "node:path";
19
35
  import { resolveDevcliHome } from "./auth-store.js";
20
- export const COST_MODES = ["minimize", "hybrid", "pure-ai"];
36
+ export const COST_MODES = ["minimize", "hybrid", "rich-ai", "pure-videogen"];
21
37
  /** What we assume when nothing is set. Hybrid is the founder-friendly middle,
22
38
  * but callers can tell it apart from an explicit choice via `isSet`. */
23
39
  export const DEFAULT_COST_MODE = "hybrid";
@@ -33,21 +49,29 @@ export function normalizeCostMode(raw) {
33
49
  return "minimize";
34
50
  if (["hybrid", "mixed", "balanced", "smart", "default"].includes(v))
35
51
  return "hybrid";
36
- if (["pure-ai", "pureai", "rich-ai", "richai", "rich", "ai", "best", "best-quality", "premium", "max"].includes(v))
37
- return "pure-ai";
52
+ // Check videogen BEFORE rich-ai: "pure-videogen" must not be swallowed by a
53
+ // looser "pure*" spelling, and "videogen" always means the frame-by-frame mode.
54
+ if (["pure-videogen", "purevideogen", "pure-video-gen", "videogen", "video-gen", "pure-video", "purevideo", "veo", "frame-by-frame", "cinematic"].includes(v))
55
+ return "pure-videogen";
56
+ // "pure-ai"/"pureai" are the LEGACY slug this mode used to be stored under —
57
+ // keep accepting them so an older ~/.vidfarm/cost-mode.json still resolves.
58
+ if (["rich-ai", "richai", "rich", "pure-ai", "pureai", "ai", "best", "best-quality", "premium", "max"].includes(v))
59
+ return "rich-ai";
38
60
  return null;
39
61
  }
40
62
  /**
41
- * Human-facing NAME for a mode. The canonical stored slug for best-quality stays
42
- * `pure-ai` (so saved cost-mode.json, --cost-mode flags, and VIDFARM_COST_MODE
43
- * keep resolving), but users see and can type "rich-ai".
63
+ * Human-facing NAME for a mode. These match the canonical slugs one-for-one
64
+ * there is no "pure-ai" mode any more, it is `rich-ai` everywhere (the old slug
65
+ * is still ACCEPTED as an alias by normalizeCostMode so saved cost-mode.json,
66
+ * --cost-mode flags, and VIDFARM_COST_MODE from older installs keep resolving).
44
67
  */
45
68
  export const COST_MODE_DISPLAY = {
46
69
  minimize: "minimize",
47
70
  hybrid: "hybrid",
48
- "pure-ai": "rich-ai"
71
+ "rich-ai": "rich-ai",
72
+ "pure-videogen": "pure-videogen"
49
73
  };
50
- /** The three modes as users see them, e.g. for "<minimize|hybrid|rich-ai>". */
74
+ /** The modes as users see them, e.g. "<minimize|hybrid|rich-ai|pure-videogen>". */
51
75
  export const COST_MODE_DISPLAY_LIST = COST_MODES.map((m) => COST_MODE_DISPLAY[m]);
52
76
  export function costModeDisplayName(mode) {
53
77
  return COST_MODE_DISPLAY[mode];
@@ -101,31 +125,47 @@ export function resolveCostMode(values) {
101
125
  return { mode: DEFAULT_COST_MODE, isSet: false, source: "default" };
102
126
  }
103
127
  export const COST_MODE_BLURB = {
104
- minimize: "Minimize costs — stay on FREE local compute wherever possible (local render, " +
128
+ minimize: "Minimize costs — explicitly $0 videos. Stay on FREE local compute wherever possible (local render, " +
105
129
  "local TTS/STT, local greenscreen/matting, reused clips + HTML motion). For assets, " +
106
130
  'reach for the free stock catalog first — vidfarm media search "<meaning>" --type ' +
107
131
  "bgm|sfx|image|vector|icon|video. Check the KEYLESS sources first: Openverse (CC/CC0 " +
108
132
  "music, SFX, images) and iconify (icons) need no account at all. A free Pixabay key adds " +
109
133
  "photos/vectors/stock-video and may already be saved (check vidfarm provider-keys). " +
110
134
  "Billed cloud/AI generation is refused unless you re-confirm it (--yes).",
111
- hybrid: "Hybrid (recommended) — free where it's free, spend AI credits only where they " +
112
- "clearly win (a hero shot, a voice you can't fake locally). Billed ops run but " +
113
- "each prints its cost so nothing is a surprise.",
114
- "pure-ai": "Rich AI best quality; AI image/video/voice/music used freely. Billed ops run " +
115
- "without gating; cost is still shown."
135
+ hybrid: "Hybrid (recommended) — roughly $0.01–$1 per video. Free where it's free, spend AI " +
136
+ "credits only where they clearly win (a hero shot, a voice you can't fake locally). " +
137
+ "Billed ops run but each prints its cost so nothing is a surprise. Charges land on " +
138
+ "your own AI provider keys (BYOK).",
139
+ "rich-ai": "Rich AI — $1+ per video. AI video generation is spent on REUSABLE greenscreen raws " +
140
+ "(vidfarm avatar / generate --greenscreen), keyed once and then remixed with hyperframes " +
141
+ "HTML/CSS motion and the rest of the raw library. Those raws are saved in the local raws " +
142
+ "store (and pushed to the cloud with `vidfarm sync push /raws` on a Pro plan), so the same " +
143
+ "footage powers later hybrid/minimize videos for $0. AI image/voice/music used freely. " +
144
+ "Billed ops run without gating; cost is still shown. Charges land on your own AI " +
145
+ "provider keys (BYOK).",
146
+ "pure-videogen": "Pure videogen — $5+ per video. Every shot is generated footage: write the script in text, " +
147
+ "storyboard it as images, then generate each scene frame-by-frame from those keyframes. " +
148
+ "No raw reuse, no HTML motion — the most expensive and most cinematic mode. Billed ops run " +
149
+ "without gating; cost is still shown, and a single run can be many dollars. Charges land on " +
150
+ "your own AI provider keys (BYOK)."
116
151
  };
117
152
  /** One short human line summarizing the active mode. */
118
153
  export function costModeSummaryLine(resolved) {
119
154
  const setNote = resolved.isSet ? `set via ${resolved.source}` : "NOT set — assuming hybrid";
120
155
  return `cost mode: ${costModeDisplayName(resolved.mode)} (${setNote})`;
121
156
  }
122
- /** The 3-line "explain it simply" block an agent should relay to the user. */
157
+ /** The "explain it simply" block an agent should relay to the user. */
123
158
  export function costModeExplainer() {
124
159
  return [
125
- "How much do you want Vidfarm to spend on AI credits?",
126
- " • minimize cheapest: free local compute + free stock media, no surprise AI spend.",
127
- " • hybrid — recommended: free where free, pay AI only where it clearly wins.",
128
- " • rich-ai best quality: use AI image/video/voice/music freely.",
160
+ "How much do you want Vidfarm to spend on AI per video?",
161
+ " • minimize $0 videos: free local compute + free stock media, no AI spend at all.",
162
+ " • hybrid ~$0.01–$1 per video (recommended): free where free, pay AI only where it clearly wins.",
163
+ " • rich-ai $1+ per video: AI video gen mints REUSABLE greenscreen raws, then hyperframes",
164
+ " HTML/CSS motion remixes them with your library; the raws are saved and reused later.",
165
+ " • pure-videogen — $5+ per video: everything is generated footage — text script → image storyboard →",
166
+ " frame-by-frame scene generation. Most cinematic, most expensive.",
167
+ "Any spend is billed to YOUR own AI provider keys (BYOK) — add them with",
168
+ " `vidfarm add-provider-key <provider> <key>` or at vidfarm.cc/settings/developer.",
129
169
  "Tip: before paying to generate music/SFX/images/video, try the free stock catalog —",
130
170
  ' vidfarm media search "<meaning>" --type bgm|sfx|image|vector|icon|video.',
131
171
  " Check the keyless sources first — Openverse (CC/CC0 music, SFX, images) and iconify (icons)",
@@ -147,7 +187,7 @@ export class CostModeBlockedError extends Error {
147
187
  *
148
188
  * - minimize: throws unless `yes` is set — the agent must confirm with the user
149
189
  * (or use the free local alternative named in `freeAlternative`).
150
- * - hybrid / pure-ai: allowed; prints a one-line cost notice (unless json).
190
+ * - hybrid / rich-ai: allowed; prints a one-line cost notice (unless json).
151
191
  * - unset: allowed like hybrid, but prints a "no preference set — ask the user"
152
192
  * nudge once so the default posture really is "ask before spending."
153
193
  */