@nodaro/cli 1.35.0 → 1.38.0
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/README.md +9 -0
- package/dist/index.js +389 -20
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -124,6 +124,7 @@ nodaro nodes run <type> --params-file body.json [--watch] [--poll-interval 1000]
|
|
|
124
124
|
|
|
125
125
|
# Models — browse the model catalog (makers, capability sheets, credit pricing, prompt tips)
|
|
126
126
|
nodaro models list [--kind video] [--mode i2v] [--family Google] [--featured]
|
|
127
|
+
nodaro models cost <id…> # credits charged per id; a metered LLM key (llm-chat:<model>) prints ~N, an estimate
|
|
127
128
|
|
|
128
129
|
# Pickers — valid values for parameter-picker nodes (setting, mood, person, …)
|
|
129
130
|
nodaro pickers list # all picker node types + option counts + pictures
|
|
@@ -141,6 +142,14 @@ nodaro recast estimate --analysis-job <id> # quote credits before c
|
|
|
141
142
|
nodaro recast create --workflow <id> --analysis-job <id> # BUYS THE PLAN
|
|
142
143
|
nodaro recast start <recastId> && nodaro recast status <recastId>
|
|
143
144
|
|
|
145
|
+
# Trends — ready-made Cast Swap recipes: put your own pictures in a trend (Cloud)
|
|
146
|
+
nodaro trends list [--search <text>] [--favorites] # the catalog
|
|
147
|
+
nodaro trends get <slug> # its slots, examples, resolutions
|
|
148
|
+
nodaro trends estimate <slug> --slot person=<url>,<url> --choice person.outfit=original # free quote
|
|
149
|
+
nodaro trends run <slug> --slot person=<url> # SPENDS CREDITS; prints the job id (--session: accepted, not yet applied)
|
|
150
|
+
nodaro trends runs [--trend <slug>]
|
|
151
|
+
nodaro trends favorite <slug> | unfavorite <slug>
|
|
152
|
+
|
|
144
153
|
nodaro executions get <id>
|
|
145
154
|
nodaro executions get <id> --watch
|
|
146
155
|
nodaro executions cancel <id> [--mode cancelled|stopping]
|
package/dist/index.js
CHANGED
|
@@ -17,7 +17,7 @@ import checkbox from '@inquirer/checkbox';
|
|
|
17
17
|
import input from '@inquirer/input';
|
|
18
18
|
import { CHARACTER_STYLES } from '@nodaro/shared/entities';
|
|
19
19
|
import { TRANSCRIBE_PROVIDERS, transcribeLaneSupportsWordTimestamps, DIALOGUE_PROVIDERS, dialogueStabilityAccepted, dialogueProviderOf, getDialogueCapabilities, TRANSCRIBE_LANES, DEFAULT_TRANSCRIBE_PROVIDER } from '@nodaro/shared/models';
|
|
20
|
-
import { OVERLAY_ANCHORS, OVERLAY_PLATFORM_IDS, GENERATE_MASK_LIMITS, DEFAULT_VIDEO_MASK_PROVIDER, VIDEO_MASK_PROVIDERS, VIDEO_MASK_LIMITS, MASK_COMPOSITE_BOUNDS, MASK_COMPOSITE_DEFAULTS, MASK_COMPOSITE_BACKGROUND_FITS, MASK_COMPOSITE_AUDIO_SOURCES } from '@nodaro/shared/media';
|
|
20
|
+
import { OVERLAY_ANCHORS, OVERLAY_PLATFORM_IDS, GENERATE_MASK_LIMITS, DEFAULT_VIDEO_MASK_PROVIDER, VIDEO_MASK_PROVIDERS, VIDEO_MASK_LIMITS, MASK_COMPOSITE_BOUNDS, MASK_COMPOSITE_DEFAULTS, MASK_COMPOSITE_BACKGROUND_FITS, MASK_COMPOSITE_AUDIO_SOURCES, MASK_COMPOSITE_FILLS } from '@nodaro/shared/media';
|
|
21
21
|
import { ALL_CAPTION_STYLES, DEFAULT_CAPTION_LOOK, CAPTION_LOOK_IDS, CAPTION_MAX_WORDS_PER_LINE_MIN, CAPTION_MAX_WORDS_PER_LINE_MAX, SUPPORTED_FONT_NAMES } from '@nodaro/shared/captions';
|
|
22
22
|
import { VIDEO_OVERLAY_PRESET_IDS, VIDEO_OVERLAY_CORNERS, VIDEO_OVERLAY_OUTPUT_ASPECTS, isVideoOverlayPresetId, isVideoOverlayCorner, isVideoOverlayOutputAspect, VIDEO_OVERLAY_FITS } from '@nodaro/shared/video';
|
|
23
23
|
import { SOCIAL_PLATFORMS, COMPETITOR_ACCOUNT_KEYS, isMeasurableCard, isSocialPost, COMPETITOR_ABOUT_PLATFORMS, COMPETITOR_SCHEDULES } from '@nodaro/shared/social';
|
|
@@ -41,7 +41,7 @@ var require_package = __commonJS({
|
|
|
41
41
|
"package.json"(exports$1, module) {
|
|
42
42
|
module.exports = {
|
|
43
43
|
name: "@nodaro/cli",
|
|
44
|
-
version: "1.
|
|
44
|
+
version: "1.38.0",
|
|
45
45
|
description: "Command-line interface for Nodaro \u2014 list and run workflows, inspect jobs and executions, manage projects from the terminal.",
|
|
46
46
|
type: "module",
|
|
47
47
|
license: "Apache-2.0",
|
|
@@ -82,8 +82,8 @@ var require_package = __commonJS({
|
|
|
82
82
|
"@inquirer/confirm": "^6.0.12",
|
|
83
83
|
"@inquirer/input": "^5.0.12",
|
|
84
84
|
"@inquirer/select": "^5.1.4",
|
|
85
|
-
"@nodaro/sdk": "^2.
|
|
86
|
-
"@nodaro/shared": "^3.
|
|
85
|
+
"@nodaro/sdk": "^2.43.0",
|
|
86
|
+
"@nodaro/shared": "^3.38.0",
|
|
87
87
|
commander: "^12.1.0",
|
|
88
88
|
picocolors: "^1.1.1",
|
|
89
89
|
"@nodaro/prompts": "^1.40.0"
|
|
@@ -413,7 +413,7 @@ function saveWorkspace(profileName, workspaceId) {
|
|
|
413
413
|
}
|
|
414
414
|
|
|
415
415
|
// src/client.ts
|
|
416
|
-
var CLI_VERSION = "1.
|
|
416
|
+
var CLI_VERSION = "1.38.0" ;
|
|
417
417
|
function buildPublicClient(opts = {}) {
|
|
418
418
|
const { profile } = getProfile(opts.profile);
|
|
419
419
|
return createClient({
|
|
@@ -1133,7 +1133,8 @@ function workflowsCommand() {
|
|
|
1133
1133
|
success(`Render final of ${renderNodeId} runs ${quote.nodeIds.join(", ")}`);
|
|
1134
1134
|
if (quote.estimatedCredits !== null) {
|
|
1135
1135
|
dim(
|
|
1136
|
-
|
|
1136
|
+
// `~`: an LLM node in the run is charged its actual usage, so the figure is an estimate.
|
|
1137
|
+
`estimated ${quote.estimatedCreditsIsEstimate ? "~" : ""}${quote.estimatedCredits} credits` + (quote.sufficient === false ? ` \u2014 not covered${quote.available !== null ? ` (${quote.available} available)` : ""}` : "")
|
|
1137
1138
|
);
|
|
1138
1139
|
}
|
|
1139
1140
|
return;
|
|
@@ -1286,7 +1287,7 @@ function ratingArg(value) {
|
|
|
1286
1287
|
}
|
|
1287
1288
|
function jobsCommand() {
|
|
1288
1289
|
const cmd = new Command("jobs").description("list, inspect, rate and cancel jobs");
|
|
1289
|
-
cmd.command("list").description("your jobs, newest first").option("--status <statuses>", "only these statuses, comma-separated (e.g. failed,cancelled)").option("--type <types>", "only these input_data.type values, comma-separated (e.g. generate-image)").option("--origin <origin>", "only jobs this client app sent").option("--favorited", "only jobs you favorited").option("--no-favorited", "only jobs you did not favorite").option("--rating <rating>", "good, bad, rated (any) or unrated").option("--limit <n>", "page size (1-100)").option("--cursor <cursor>", "the previous page's next").option("--profile <name>").option("--json").action(async (opts) => {
|
|
1290
|
+
cmd.command("list").description("your jobs, newest first").option("--status <statuses>", "only these statuses, comma-separated (e.g. failed,cancelled)").option("--type <types>", "only these input_data.type values, comma-separated (e.g. generate-image)").option("--origin <origin>", "only jobs this client app sent").option("--source <sources>", "only jobs these surfaces created, comma-separated (mcp, web, cli, sdk, extension, app, api, internal)").option("--favorited", "only jobs you favorited").option("--no-favorited", "only jobs you did not favorite").option("--rating <rating>", "good, bad, rated (any) or unrated").option("--limit <n>", "page size (1-100)").option("--cursor <cursor>", "the previous page's next").option("--profile <name>").option("--json").action(async (opts) => {
|
|
1290
1291
|
try {
|
|
1291
1292
|
const rating = ratingFilter(opts.rating);
|
|
1292
1293
|
const client = buildClient(opts.profile);
|
|
@@ -1294,6 +1295,7 @@ function jobsCommand() {
|
|
|
1294
1295
|
status: list(opts.status),
|
|
1295
1296
|
type: list(opts.type),
|
|
1296
1297
|
origin: opts.origin,
|
|
1298
|
+
source: list(opts.source),
|
|
1297
1299
|
favorited: opts.favorited,
|
|
1298
1300
|
rating,
|
|
1299
1301
|
limit: opts.limit ? Number(opts.limit) : void 0,
|
|
@@ -1835,10 +1837,14 @@ async function pickNodeInteractively(client) {
|
|
|
1835
1837
|
choices: result.data.map((n) => ({
|
|
1836
1838
|
name: `${n.label} \u2014 ${n.type}`,
|
|
1837
1839
|
value: n.type,
|
|
1838
|
-
description: `${n.category} \u2192 ${n.outputType}${n.creditCost ? ` (${n
|
|
1840
|
+
description: `${n.category} \u2192 ${n.outputType}${n.creditCost ? ` (${nodeCreditsLabel(n)})` : ""}`
|
|
1839
1841
|
}))
|
|
1840
1842
|
});
|
|
1841
1843
|
}
|
|
1844
|
+
function nodeCreditsLabel(n) {
|
|
1845
|
+
if (n.creditCost === "unpriced") return "unpriced";
|
|
1846
|
+
return `${n.estimate ? "~" : ""}${n.creditCost} cr`;
|
|
1847
|
+
}
|
|
1842
1848
|
function rejectPositionalParams(extras, example) {
|
|
1843
1849
|
if (!extras || extras.length === 0) return;
|
|
1844
1850
|
const looksLikeObject = extras[0].trim().startsWith("{");
|
|
@@ -1870,7 +1876,7 @@ function nodesCommand() {
|
|
|
1870
1876
|
label: n.label,
|
|
1871
1877
|
category: n.category,
|
|
1872
1878
|
outputType: n.outputType,
|
|
1873
|
-
credits: n.creditCost
|
|
1879
|
+
credits: n.creditCost === void 0 ? "" : n.estimate ? `~${n.creditCost}` : n.creditCost,
|
|
1874
1880
|
providers: n.providers ? n.providers.length : ""
|
|
1875
1881
|
})),
|
|
1876
1882
|
["type", "label", "category", "outputType", "credits", "providers"]
|
|
@@ -2373,7 +2379,7 @@ function promptCommand() {
|
|
|
2373
2379
|
const cmd = new Command("prompt").description(
|
|
2374
2380
|
"AI prompt wizard \u2014 analyze, generate, and enhance prompts for generation nodes"
|
|
2375
2381
|
);
|
|
2376
|
-
cmd.command("wizard").description("interactive: answer guided questions and get an optimized prompt").option("--node-type <type>", "target node type (omit for an interactive picker)").option("--prompt <text>", "your rough idea (optional)").option("--provider <name>").option("--style <name>").option("--aspect-ratio <ratio>").option("--duration <seconds>", "clip duration in seconds", (v) => parseInt(v, 10)).option("--llm-model <id>").option("--reasoning-effort <level>", "reasoning effort: none|low|medium|high|xhigh|max (model-dependent)").option("--advanced", "Gemini and Claude models: run on the provider's own API so --temperature/--max-tokens/the full reasoning range apply.
|
|
2382
|
+
cmd.command("wizard").description("interactive: answer guided questions and get an optimized prompt").option("--node-type <type>", "target node type (omit for an interactive picker)").option("--prompt <text>", "your rough idea (optional)").option("--provider <name>").option("--style <name>").option("--aspect-ratio <ratio>").option("--duration <seconds>", "clip duration in seconds", (v) => parseInt(v, 10)).option("--llm-model <id>").option("--reasoning-effort <level>", "reasoning effort: none|low|medium|high|xhigh|max (model-dependent)").option("--advanced", "Gemini and Claude models: run on the provider's own API so --temperature/--max-tokens/the full reasoning range apply. Charged per token at that lane's rate.").option("--temperature <n>", "Sampling temperature (only with --advanced)", parseFloat).option("--max-tokens <n>", "Output token cap (only with --advanced)", (v) => parseInt(v, 10)).option("--profile <name>").action(async (opts) => {
|
|
2377
2383
|
try {
|
|
2378
2384
|
if (!isInteractive()) {
|
|
2379
2385
|
warn("`prompt wizard` needs an interactive terminal \u2014 use `prompt analyze` + `prompt generate`, or `prompt enhance`, in scripts.");
|
|
@@ -2423,7 +2429,7 @@ function promptCommand() {
|
|
|
2423
2429
|
handleError(err);
|
|
2424
2430
|
}
|
|
2425
2431
|
});
|
|
2426
|
-
cmd.command("analyze").description("return guided questions for a rough prompt idea").requiredOption("--node-type <type>").option("--prompt <text>").option("--provider <name>").option("--style <name>").option("--aspect-ratio <ratio>").option("--duration <seconds>", "clip duration in seconds", (v) => parseInt(v, 10)).option("--llm-model <id>").option("--reasoning-effort <level>", "reasoning effort: none|low|medium|high|xhigh|max (model-dependent)").option("--advanced", "Gemini and Claude models: run on the provider's own API so --temperature/--max-tokens/the full reasoning range apply.
|
|
2432
|
+
cmd.command("analyze").description("return guided questions for a rough prompt idea").requiredOption("--node-type <type>").option("--prompt <text>").option("--provider <name>").option("--style <name>").option("--aspect-ratio <ratio>").option("--duration <seconds>", "clip duration in seconds", (v) => parseInt(v, 10)).option("--llm-model <id>").option("--reasoning-effort <level>", "reasoning effort: none|low|medium|high|xhigh|max (model-dependent)").option("--advanced", "Gemini and Claude models: run on the provider's own API so --temperature/--max-tokens/the full reasoning range apply. Charged per token at that lane's rate.").option("--temperature <n>", "Sampling temperature (only with --advanced)", parseFloat).option("--max-tokens <n>", "Output token cap (only with --advanced)", (v) => parseInt(v, 10)).option("--profile <name>").option("--json").action(async (opts) => {
|
|
2427
2433
|
try {
|
|
2428
2434
|
const client = buildClient(opts.profile);
|
|
2429
2435
|
const { jobId, questions } = await client.promptHelper.analyze({
|
|
@@ -2448,7 +2454,7 @@ function promptCommand() {
|
|
|
2448
2454
|
handleError(err);
|
|
2449
2455
|
}
|
|
2450
2456
|
});
|
|
2451
|
-
cmd.command("generate").description("build an optimized prompt from --selection category=value flags").requiredOption("--node-type <type>").option("--selection <pairs...>", "category=value (repeat); custom answers are wizard-only", collectVariadic).option("--original-prompt <text>").option("--provider <name>").option("--style <name>").option("--aspect-ratio <ratio>").option("--duration <seconds>", "clip duration in seconds", (v) => parseInt(v, 10)).option("--llm-model <id>").option("--reasoning-effort <level>", "reasoning effort: none|low|medium|high|xhigh|max (model-dependent)").option("--advanced", "Gemini and Claude models: run on the provider's own API so --temperature/--max-tokens/the full reasoning range apply.
|
|
2457
|
+
cmd.command("generate").description("build an optimized prompt from --selection category=value flags").requiredOption("--node-type <type>").option("--selection <pairs...>", "category=value (repeat); custom answers are wizard-only", collectVariadic).option("--original-prompt <text>").option("--provider <name>").option("--style <name>").option("--aspect-ratio <ratio>").option("--duration <seconds>", "clip duration in seconds", (v) => parseInt(v, 10)).option("--llm-model <id>").option("--reasoning-effort <level>", "reasoning effort: none|low|medium|high|xhigh|max (model-dependent)").option("--advanced", "Gemini and Claude models: run on the provider's own API so --temperature/--max-tokens/the full reasoning range apply. Charged per token at that lane's rate.").option("--temperature <n>", "Sampling temperature (only with --advanced)", parseFloat).option("--max-tokens <n>", "Output token cap (only with --advanced)", (v) => parseInt(v, 10)).option("--profile <name>").option("--json").action(async (opts) => {
|
|
2452
2458
|
try {
|
|
2453
2459
|
const client = buildClient(opts.profile);
|
|
2454
2460
|
const selections = parseSelectionPairs(opts.selection);
|
|
@@ -2468,7 +2474,7 @@ function promptCommand() {
|
|
|
2468
2474
|
handleError(err);
|
|
2469
2475
|
}
|
|
2470
2476
|
});
|
|
2471
|
-
cmd.command("enhance").description("rewrite a rough idea into one optimized prompt (no questions)").requiredOption("--node-type <type>").option("--prompt <text>").option("--provider <name>").option("--style <name>").option("--aspect-ratio <ratio>").option("--duration <seconds>", "clip duration in seconds", (v) => parseInt(v, 10)).option("--llm-model <id>").option("--reasoning-effort <level>", "reasoning effort: none|low|medium|high|xhigh|max (model-dependent)").option("--advanced", "Gemini and Claude models: run on the provider's own API so --temperature/--max-tokens/the full reasoning range apply.
|
|
2477
|
+
cmd.command("enhance").description("rewrite a rough idea into one optimized prompt (no questions)").requiredOption("--node-type <type>").option("--prompt <text>").option("--provider <name>").option("--style <name>").option("--aspect-ratio <ratio>").option("--duration <seconds>", "clip duration in seconds", (v) => parseInt(v, 10)).option("--llm-model <id>").option("--reasoning-effort <level>", "reasoning effort: none|low|medium|high|xhigh|max (model-dependent)").option("--advanced", "Gemini and Claude models: run on the provider's own API so --temperature/--max-tokens/the full reasoning range apply. Charged per token at that lane's rate.").option("--temperature <n>", "Sampling temperature (only with --advanced)", parseFloat).option("--max-tokens <n>", "Output token cap (only with --advanced)", (v) => parseInt(v, 10)).option("--profile <name>").option("--json").action(async (opts) => {
|
|
2472
2478
|
try {
|
|
2473
2479
|
const client = buildClient(opts.profile);
|
|
2474
2480
|
const result = await client.promptHelper.enhance({
|
|
@@ -3049,6 +3055,16 @@ function parseSafeArea(raw) {
|
|
|
3049
3055
|
const [x, y, w, h] = parts;
|
|
3050
3056
|
return { x, y, w, h };
|
|
3051
3057
|
}
|
|
3058
|
+
function parseVideoMaskZone(raw) {
|
|
3059
|
+
const parts = raw.split(",").map((n) => n.trim());
|
|
3060
|
+
const nums = parts.map((n) => /^(?:\d+\.?\d*|\.\d+)$/.test(n) ? Number(n) : Number.NaN);
|
|
3061
|
+
if (nums.length !== 4 || nums.some((n) => !(n >= VIDEO_MASK_LIMITS.ZONE_MARGIN_PCT_MIN && n <= VIDEO_MASK_LIMITS.ZONE_MARGIN_PCT_MAX))) {
|
|
3062
|
+
warn(`--zone must be "left,right,top,bottom", each a % of the frame from ${VIDEO_MASK_LIMITS.ZONE_MARGIN_PCT_MIN} to ${VIDEO_MASK_LIMITS.ZONE_MARGIN_PCT_MAX}, e.g. 10,10,5,5 (got "${raw}")`);
|
|
3063
|
+
process.exit(1);
|
|
3064
|
+
}
|
|
3065
|
+
const [leftPct, rightPct, topPct, bottomPct] = nums;
|
|
3066
|
+
return { leftPct, rightPct, topPct, bottomPct };
|
|
3067
|
+
}
|
|
3052
3068
|
function mediaCommand() {
|
|
3053
3069
|
const cmd = new Command("media").description(
|
|
3054
3070
|
"media ingestion + compositing \u2014 pull a social video into storage, trim video/audio, burn captions, still-to-video, slideshow, collage images, overlay layers on an image or timed images on a video, save a URL to storage, probe metadata"
|
|
@@ -3652,11 +3668,12 @@ image, passed through unchanged): \`nodaro jobs get <jobId>\`. Use the mask for
|
|
|
3652
3668
|
handleError(err);
|
|
3653
3669
|
}
|
|
3654
3670
|
});
|
|
3655
|
-
cmd.command("video-mask <videoUrl> <prompt>").description("track a subject described in text through a video (SAM 3.1, or --model sam-3 at half the price) and get a black-and-white mask video back (white = the subject)").option("--model <model>", `${VIDEO_MASK_PROVIDERS.join(" | ")} (default ${DEFAULT_VIDEO_MASK_PROVIDER})`).option("--threshold <n>", `detection confidence ${VIDEO_MASK_LIMITS.THRESHOLD_MIN}\u2013${VIDEO_MASK_LIMITS.THRESHOLD_MAX} (default ${VIDEO_MASK_LIMITS.THRESHOLD_DEFAULT}; lower finds more)`, parseFloat).option("--watch", "poll until the job completes").option("--poll-interval <ms>", "watch poll interval in ms", (v) => parseInt(v, 10), 2e3).option("--profile <name>").option("--json").addHelpText("after", `
|
|
3671
|
+
cmd.command("video-mask <videoUrl> <prompt>").description("track a subject described in text through a video (SAM 3.1, or --model sam-3 at half the price) and get a black-and-white mask video back (white = the subject)").option("--model <model>", `${VIDEO_MASK_PROVIDERS.join(" | ")} (default ${DEFAULT_VIDEO_MASK_PROVIDER})`).option("--threshold <n>", `detection confidence ${VIDEO_MASK_LIMITS.THRESHOLD_MIN}\u2013${VIDEO_MASK_LIMITS.THRESHOLD_MAX} (default ${VIDEO_MASK_LIMITS.THRESHOLD_DEFAULT}; lower finds more)`, parseFloat).option("--hold-last-mask", "keep the last mask on frames where the subject is lost (e.g. hidden behind a hand)").option("--min-subject-height <pct>", `ignore subjects smaller than this % of the frame height, ${VIDEO_MASK_LIMITS.MIN_SUBJECT_HEIGHT_PCT_MIN}\u2013${VIDEO_MASK_LIMITS.MIN_SUBJECT_HEIGHT_PCT_MAX} (default 0 = off)`, (v) => Number(v)).option("--max-subject-height <pct>", `ignore subjects larger than this % of the frame height, ${VIDEO_MASK_LIMITS.MAX_SUBJECT_HEIGHT_PCT_MIN}\u2013${VIDEO_MASK_LIMITS.MAX_SUBJECT_HEIGHT_PCT_MAX} (default 0 = off)`, (v) => Number(v)).option("--zone <L,R,T,B>", `keep only subjects whose centre is inside these left,right,top,bottom margins, each ${VIDEO_MASK_LIMITS.ZONE_MARGIN_PCT_MIN}\u2013${VIDEO_MASK_LIMITS.ZONE_MARGIN_PCT_MAX} % of the frame (default off)`).option("--per-shot", "detect the subject again in every shot after a scene cut").option("--watch", "poll until the job completes").option("--poll-interval <ms>", "watch poll interval in ms", (v) => parseInt(v, 10), 2e3).option("--profile <name>").option("--json").addHelpText("after", `
|
|
3656
3672
|
Examples:
|
|
3657
3673
|
$ nodaro media video-mask https://x/dance.mp4 "the dancer" --watch
|
|
3658
3674
|
$ nodaro media video-mask https://x/street.mp4 "person, dog" --threshold 0.3 --watch
|
|
3659
3675
|
$ nodaro media video-mask https://x/long-take.mp4 "the skater" --model sam-3 --watch
|
|
3676
|
+
$ nodaro media video-mask https://x/edit.mp4 "face" --per-shot --zone 10,10,5,5 --watch
|
|
3660
3677
|
|
|
3661
3678
|
Clips up to ${VIDEO_MASK_LIMITS.MAX_BILLED_SEC} s at ${VIDEO_MASK_LIMITS.FPS_BASIS} fps (a faster clip counts proportionally longer); priced by the
|
|
3662
3679
|
clip's length. Feed the mask to \`nodaro media mask-composite\`.`).action(async (videoUrl, prompt, opts) => {
|
|
@@ -3669,27 +3686,67 @@ clip's length. Feed the mask to \`nodaro media mask-composite\`.`).action(async
|
|
|
3669
3686
|
warn(`--threshold must be between ${VIDEO_MASK_LIMITS.THRESHOLD_MIN} and ${VIDEO_MASK_LIMITS.THRESHOLD_MAX}`);
|
|
3670
3687
|
process.exit(1);
|
|
3671
3688
|
}
|
|
3689
|
+
if (opts.minSubjectHeight !== void 0 && !(Number.isFinite(opts.minSubjectHeight) && opts.minSubjectHeight >= VIDEO_MASK_LIMITS.MIN_SUBJECT_HEIGHT_PCT_MIN && opts.minSubjectHeight <= VIDEO_MASK_LIMITS.MIN_SUBJECT_HEIGHT_PCT_MAX)) {
|
|
3690
|
+
warn(`--min-subject-height must be a number from ${VIDEO_MASK_LIMITS.MIN_SUBJECT_HEIGHT_PCT_MIN} to ${VIDEO_MASK_LIMITS.MIN_SUBJECT_HEIGHT_PCT_MAX}`);
|
|
3691
|
+
process.exit(1);
|
|
3692
|
+
}
|
|
3693
|
+
if (opts.maxSubjectHeight !== void 0 && !(Number.isFinite(opts.maxSubjectHeight) && opts.maxSubjectHeight >= VIDEO_MASK_LIMITS.MAX_SUBJECT_HEIGHT_PCT_MIN && opts.maxSubjectHeight <= VIDEO_MASK_LIMITS.MAX_SUBJECT_HEIGHT_PCT_MAX)) {
|
|
3694
|
+
warn(`--max-subject-height must be a number from ${VIDEO_MASK_LIMITS.MAX_SUBJECT_HEIGHT_PCT_MIN} to ${VIDEO_MASK_LIMITS.MAX_SUBJECT_HEIGHT_PCT_MAX}`);
|
|
3695
|
+
process.exit(1);
|
|
3696
|
+
}
|
|
3697
|
+
if ((opts.minSubjectHeight ?? 0) > 0 && (opts.maxSubjectHeight ?? 0) > 0 && opts.minSubjectHeight > opts.maxSubjectHeight) {
|
|
3698
|
+
warn("--min-subject-height is above --max-subject-height: no subject could be kept");
|
|
3699
|
+
process.exit(1);
|
|
3700
|
+
}
|
|
3701
|
+
const zone = opts.zone !== void 0 ? parseVideoMaskZone(opts.zone) : void 0;
|
|
3672
3702
|
const client = buildClient(opts.profile);
|
|
3673
3703
|
const result = await client.media.videoMask({
|
|
3674
3704
|
videoUrl,
|
|
3675
3705
|
prompt,
|
|
3676
3706
|
...opts.threshold !== void 0 ? { threshold: opts.threshold } : {},
|
|
3677
|
-
...opts.model ? { provider: opts.model } : {}
|
|
3707
|
+
...opts.model ? { provider: opts.model } : {},
|
|
3708
|
+
...opts.holdLastMask ? { holdLastMask: true } : {},
|
|
3709
|
+
...opts.minSubjectHeight !== void 0 ? { minSubjectHeightPct: opts.minSubjectHeight } : {},
|
|
3710
|
+
...opts.maxSubjectHeight !== void 0 ? { maxSubjectHeightPct: opts.maxSubjectHeight } : {},
|
|
3711
|
+
...zone ? { zone } : {},
|
|
3712
|
+
...opts.perShot ? { perShot: true } : {}
|
|
3678
3713
|
});
|
|
3679
3714
|
await reportQueuedJob(result, () => client.jobs.get(result.jobId), { ...opts, note: "video mask" });
|
|
3680
3715
|
} catch (err) {
|
|
3681
3716
|
handleError(err);
|
|
3682
3717
|
}
|
|
3683
3718
|
});
|
|
3684
|
-
cmd.command("mask-composite <
|
|
3719
|
+
cmd.command("mask-composite <urls...>").description("put a foreground video over a background video through a mask video (white = foreground) \u2014 local compositor, no AI. Takes <foregroundUrl> <backgroundUrl> <maskUrl>; with --fill pixelate|blur, <backgroundUrl> <maskUrl>").option("--invert", "swap which side of the mask shows the foreground").option("--feather <px>", `edge softening ${MASK_COMPOSITE_BOUNDS.FEATHER_MIN}\u2013${MASK_COMPOSITE_BOUNDS.FEATHER_MAX} px (default ${MASK_COMPOSITE_DEFAULTS.feather})`, (v) => parseInt(v, 10)).option("--grow <px>", `grow (+) or shrink (\u2212) the foreground region, ${MASK_COMPOSITE_BOUNDS.GROW_MIN}\u2013${MASK_COMPOSITE_BOUNDS.GROW_MAX} px (default 0)`, (v) => parseInt(v, 10)).option("--background-fit <fit>", `${MASK_COMPOSITE_BACKGROUND_FITS.join(" | ")} (default ${MASK_COMPOSITE_DEFAULTS.backgroundFit})`).option("--audio <source>", `${MASK_COMPOSITE_AUDIO_SOURCES.join(" | ")} (default ${MASK_COMPOSITE_DEFAULTS.audioSource})`).option("--fill <fill>", `what fills the mask: ${MASK_COMPOSITE_FILLS.join(" | ")} (default ${MASK_COMPOSITE_DEFAULTS.fill}; pixelate / blur use the background itself and take no foreground)`).option("--pixel-size-pct <pct>", `pixelate block size, % of the frame width, ${MASK_COMPOSITE_BOUNDS.PIXEL_SIZE_PCT_MIN}\u2013${MASK_COMPOSITE_BOUNDS.PIXEL_SIZE_PCT_MAX} (default ${MASK_COMPOSITE_DEFAULTS.pixelSizePct})`, (v) => Number(v)).option("--blur-strength-pct <pct>", `blur strength (sigma), % of the frame width, ${MASK_COMPOSITE_BOUNDS.BLUR_STRENGTH_PCT_MIN}\u2013${MASK_COMPOSITE_BOUNDS.BLUR_STRENGTH_PCT_MAX} (default ${MASK_COMPOSITE_DEFAULTS.blurStrengthPct})`, (v) => Number(v)).option("--watch", "poll until the job completes").option("--poll-interval <ms>", "watch poll interval in ms", (v) => parseInt(v, 10), 2e3).option("--profile <name>").option("--json").addHelpText("after", `
|
|
3685
3720
|
Example:
|
|
3686
3721
|
$ nodaro media mask-composite https://x/dance.mp4 https://x/beach.mp4 https://x/dance-mask.mp4 --feather 4 --grow -1 --watch
|
|
3722
|
+
$ nodaro media mask-composite https://x/street.mp4 https://x/faces-mask.mp4 --fill pixelate --pixel-size-pct 2 --watch
|
|
3687
3723
|
|
|
3688
3724
|
The result follows the FOREGROUND's size, frame rate and length; the background
|
|
3689
|
-
is fitted to that frame and loops when shorter; the mask holds its last frame
|
|
3690
|
-
|
|
3725
|
+
is fitted to that frame and loops when shorter; the mask holds its last frame.
|
|
3726
|
+
With --fill pixelate or blur the masked area is the background itself,
|
|
3727
|
+
pixelated or blurred, and the result follows the background.`).action(
|
|
3728
|
+
async (urls, opts) => {
|
|
3691
3729
|
try {
|
|
3692
3730
|
const b = MASK_COMPOSITE_BOUNDS;
|
|
3731
|
+
if (opts.fill && !MASK_COMPOSITE_FILLS.includes(opts.fill)) {
|
|
3732
|
+
warn(`--fill must be one of ${MASK_COMPOSITE_FILLS.join(", ")} (got "${opts.fill}")`);
|
|
3733
|
+
process.exit(1);
|
|
3734
|
+
}
|
|
3735
|
+
const fill = opts.fill ?? MASK_COMPOSITE_DEFAULTS.fill;
|
|
3736
|
+
const withForeground = fill === "video";
|
|
3737
|
+
if (urls.length !== (withForeground ? 3 : 2)) {
|
|
3738
|
+
warn(withForeground ? "give <foregroundUrl> <backgroundUrl> <maskUrl>" : `with --fill ${fill}, give <backgroundUrl> <maskUrl> (no foreground)`);
|
|
3739
|
+
process.exit(1);
|
|
3740
|
+
}
|
|
3741
|
+
const [foregroundUrl, backgroundUrl, maskUrl] = withForeground ? urls : [void 0, ...urls];
|
|
3742
|
+
if (opts.pixelSizePct !== void 0 && !(Number.isFinite(opts.pixelSizePct) && opts.pixelSizePct >= b.PIXEL_SIZE_PCT_MIN && opts.pixelSizePct <= b.PIXEL_SIZE_PCT_MAX)) {
|
|
3743
|
+
warn(`--pixel-size-pct must be a number from ${b.PIXEL_SIZE_PCT_MIN} to ${b.PIXEL_SIZE_PCT_MAX}`);
|
|
3744
|
+
process.exit(1);
|
|
3745
|
+
}
|
|
3746
|
+
if (opts.blurStrengthPct !== void 0 && !(Number.isFinite(opts.blurStrengthPct) && opts.blurStrengthPct >= b.BLUR_STRENGTH_PCT_MIN && opts.blurStrengthPct <= b.BLUR_STRENGTH_PCT_MAX)) {
|
|
3747
|
+
warn(`--blur-strength-pct must be a number from ${b.BLUR_STRENGTH_PCT_MIN} to ${b.BLUR_STRENGTH_PCT_MAX}`);
|
|
3748
|
+
process.exit(1);
|
|
3749
|
+
}
|
|
3693
3750
|
if (opts.feather !== void 0 && !(Number.isInteger(opts.feather) && opts.feather >= b.FEATHER_MIN && opts.feather <= b.FEATHER_MAX)) {
|
|
3694
3751
|
warn(`--feather must be a whole number from ${b.FEATHER_MIN} to ${b.FEATHER_MAX}`);
|
|
3695
3752
|
process.exit(1);
|
|
@@ -3708,14 +3765,17 @@ is fitted to that frame and loops when shorter; the mask holds its last frame.`)
|
|
|
3708
3765
|
}
|
|
3709
3766
|
const client = buildClient(opts.profile);
|
|
3710
3767
|
const result = await client.media.maskComposite({
|
|
3711
|
-
foregroundUrl,
|
|
3768
|
+
...foregroundUrl ? { foregroundUrl } : {},
|
|
3712
3769
|
backgroundUrl,
|
|
3713
3770
|
maskUrl,
|
|
3714
3771
|
...opts.invert ? { invertMask: true } : {},
|
|
3715
3772
|
...opts.feather !== void 0 ? { feather: opts.feather } : {},
|
|
3716
3773
|
...opts.grow !== void 0 ? { grow: opts.grow } : {},
|
|
3717
3774
|
...opts.backgroundFit ? { backgroundFit: opts.backgroundFit } : {},
|
|
3718
|
-
...opts.audio ? { audioSource: opts.audio } : {}
|
|
3775
|
+
...opts.audio ? { audioSource: opts.audio } : {},
|
|
3776
|
+
...opts.fill ? { fill } : {},
|
|
3777
|
+
...opts.pixelSizePct !== void 0 ? { pixelSizePct: opts.pixelSizePct } : {},
|
|
3778
|
+
...opts.blurStrengthPct !== void 0 ? { blurStrengthPct: opts.blurStrengthPct } : {}
|
|
3719
3779
|
});
|
|
3720
3780
|
await reportQueuedJob(result, () => client.jobs.get(result.jobId), { ...opts, note: "mask composite" });
|
|
3721
3781
|
} catch (err) {
|
|
@@ -5615,8 +5675,50 @@ Examples:
|
|
|
5615
5675
|
}
|
|
5616
5676
|
}
|
|
5617
5677
|
);
|
|
5678
|
+
cmd.command("cost <ids...>").description(
|
|
5679
|
+
"credits each identifier is charged \u2014 a model id, a credit id, or a metered LLM price key (<feature>:<model>[:direct]); an estimate prints as ~N"
|
|
5680
|
+
).option("--profile <name>").option("--json").addHelpText(
|
|
5681
|
+
"after",
|
|
5682
|
+
`
|
|
5683
|
+
A metered LLM price key (llmPriceKey from @nodaro/shared/llm-models) is
|
|
5684
|
+
charged for the tokens the call actually uses, so its figure is an estimate of
|
|
5685
|
+
a typical call and prints as ~N. Every model's per-token rate:
|
|
5686
|
+
docs/pricing/llm-models.md.
|
|
5687
|
+
|
|
5688
|
+
Examples:
|
|
5689
|
+
$ nodaro models cost nano-banana-pro seedance-2-fast
|
|
5690
|
+
$ nodaro models cost llm-chat:gemini-3.6-flash llm-chat:claude-opus-5.5:direct
|
|
5691
|
+
$ nodaro models cost llm-chat:claude-fable-5 --json`
|
|
5692
|
+
).action(async (ids, opts) => {
|
|
5693
|
+
try {
|
|
5694
|
+
const client = buildClient(opts.profile);
|
|
5695
|
+
const result = await client.credits.modelCosts(ids);
|
|
5696
|
+
if (opts.json) {
|
|
5697
|
+
emit(result, opts);
|
|
5698
|
+
return;
|
|
5699
|
+
}
|
|
5700
|
+
table(costRows(ids, result), ["id", "credits", "note"]);
|
|
5701
|
+
} catch (err) {
|
|
5702
|
+
handleError(err);
|
|
5703
|
+
}
|
|
5704
|
+
});
|
|
5618
5705
|
return cmd;
|
|
5619
5706
|
}
|
|
5707
|
+
function costRows(ids, result) {
|
|
5708
|
+
const estimates = new Set(result.estimates ?? []);
|
|
5709
|
+
const missing = new Set(result.missing);
|
|
5710
|
+
const errors = new Set(result.errors);
|
|
5711
|
+
return [...new Set(ids)].map((id) => {
|
|
5712
|
+
const credits = result.data[id];
|
|
5713
|
+
if (typeof credits === "number") {
|
|
5714
|
+
const estimate = estimates.has(id);
|
|
5715
|
+
return { id, credits: estimate ? `~${credits}` : String(credits), note: estimate ? "estimate: charged per token used" : "" };
|
|
5716
|
+
}
|
|
5717
|
+
if (errors.has(id)) return { id, credits: "-", note: terminalSafe(result.errorCodes?.[id]?.message ?? "could not be priced") };
|
|
5718
|
+
if (missing.has(id)) return { id, credits: "-", note: "no price on this server" };
|
|
5719
|
+
return { id, credits: "-", note: "not asked (over the batch limit)" };
|
|
5720
|
+
});
|
|
5721
|
+
}
|
|
5620
5722
|
function readJsonObject2(path, flag) {
|
|
5621
5723
|
let raw;
|
|
5622
5724
|
try {
|
|
@@ -5821,6 +5923,271 @@ function recastCommand() {
|
|
|
5821
5923
|
});
|
|
5822
5924
|
return cmd;
|
|
5823
5925
|
}
|
|
5926
|
+
var RESOLUTIONS = ["480p", "720p", "1080p"];
|
|
5927
|
+
var SLOT_KEY_RE = /^[a-z0-9_]{1,32}$/;
|
|
5928
|
+
var URL_SPLIT_RE = /,(?=\s*https?:\/\/)/i;
|
|
5929
|
+
var CHIPS = ["body", "outfit", "hair", "coat", "shape", "finish"];
|
|
5930
|
+
function addRunFlags(cmd) {
|
|
5931
|
+
return cmd.option(
|
|
5932
|
+
"--slot <key=url[,url]>",
|
|
5933
|
+
"a slot's pictures, 1-3 per slot (repeat for each slot; the same key again adds pictures)",
|
|
5934
|
+
collectVariadic
|
|
5935
|
+
).option(
|
|
5936
|
+
"--choice <key.chip=new|original>",
|
|
5937
|
+
"a slot's chip: make it anew from your pictures or keep the clip's, e.g. person.outfit=original (repeatable; only the chips `trends get` lists for the slot)",
|
|
5938
|
+
collectVariadic
|
|
5939
|
+
).option("--example <n>", "1-based example whose pictures fill the optional slots you leave empty (default 1)").option("--details <text>", "your own words (at most 1,000 characters); mention a slot as {slot:<key>}").option("--preview", "a 4-second preview run (only when the trend offers one)").addOption(new Option("--resolution <r>", "default 480p").choices([...RESOLUTIONS])).option("--no-draft", "a full run instead of a draft (a draft is 480p only, and the default there)");
|
|
5940
|
+
}
|
|
5941
|
+
function checkSlotKey(flag, spec, key2) {
|
|
5942
|
+
if (!SLOT_KEY_RE.test(key2) || key2 === "__proto__") {
|
|
5943
|
+
throw new Error(`${flag} ${spec}: "${key2}" is not a slot key (lowercase letters, digits and _, up to 32; see \`nodaro trends get <slug>\`)`);
|
|
5944
|
+
}
|
|
5945
|
+
}
|
|
5946
|
+
function parseSlot(spec) {
|
|
5947
|
+
const eq = spec.indexOf("=");
|
|
5948
|
+
const key2 = eq === -1 ? "" : spec.slice(0, eq).trim();
|
|
5949
|
+
const images = eq === -1 ? [] : spec.slice(eq + 1).split(URL_SPLIT_RE).map((u) => u.trim()).filter(Boolean);
|
|
5950
|
+
if (!key2 || images.length === 0) {
|
|
5951
|
+
throw new Error(`--slot ${spec}: expected key=url[,url], e.g. --slot person=https://example.com/me.jpg`);
|
|
5952
|
+
}
|
|
5953
|
+
checkSlotKey("--slot", spec, key2);
|
|
5954
|
+
return { key: key2, images };
|
|
5955
|
+
}
|
|
5956
|
+
function parseChoice(spec) {
|
|
5957
|
+
const eq = spec.indexOf("=");
|
|
5958
|
+
const target = eq === -1 ? "" : spec.slice(0, eq).trim();
|
|
5959
|
+
const value = eq === -1 ? "" : spec.slice(eq + 1).trim();
|
|
5960
|
+
const dot = target.lastIndexOf(".");
|
|
5961
|
+
const key2 = dot === -1 ? "" : target.slice(0, dot);
|
|
5962
|
+
const chip = dot === -1 ? "" : target.slice(dot + 1);
|
|
5963
|
+
if (!key2 || !chip) {
|
|
5964
|
+
throw new Error(`--choice ${spec}: expected key.chip=new|original, e.g. --choice person.outfit=original`);
|
|
5965
|
+
}
|
|
5966
|
+
if (!CHIPS.includes(chip)) {
|
|
5967
|
+
throw new Error(`--choice ${spec}: the chip must be one of ${CHIPS.slice(0, -1).join(", ")} or ${CHIPS.at(-1)}`);
|
|
5968
|
+
}
|
|
5969
|
+
if (value !== "new" && value !== "original") {
|
|
5970
|
+
throw new Error(`--choice ${spec}: the value must be new or original`);
|
|
5971
|
+
}
|
|
5972
|
+
checkSlotKey("--choice", spec, key2);
|
|
5973
|
+
return { key: key2, chip, value };
|
|
5974
|
+
}
|
|
5975
|
+
function parseLimit(raw) {
|
|
5976
|
+
if (raw === void 0) return void 0;
|
|
5977
|
+
const n = Number(raw);
|
|
5978
|
+
if (!/^\d+$/.test(raw.trim()) || !Number.isInteger(n) || n < 1 || n > 60) {
|
|
5979
|
+
throw new Error(`--limit ${raw}: expected a whole number from 1 to 60`);
|
|
5980
|
+
}
|
|
5981
|
+
return n;
|
|
5982
|
+
}
|
|
5983
|
+
function buildRequest(flags) {
|
|
5984
|
+
const slots = /* @__PURE__ */ Object.create(null);
|
|
5985
|
+
for (const spec of flags.slot ?? []) {
|
|
5986
|
+
const { key: key2, images } = parseSlot(spec);
|
|
5987
|
+
const slot = slots[key2] ??= {};
|
|
5988
|
+
slot.images = [...slot.images ?? [], ...images];
|
|
5989
|
+
}
|
|
5990
|
+
for (const spec of flags.choice ?? []) {
|
|
5991
|
+
const { key: key2, chip, value } = parseChoice(spec);
|
|
5992
|
+
(slots[key2] ??= {})[chip] = value;
|
|
5993
|
+
}
|
|
5994
|
+
const request = { slots };
|
|
5995
|
+
if (flags.example !== void 0) {
|
|
5996
|
+
const n = Number(flags.example);
|
|
5997
|
+
if (!Number.isInteger(n) || n < 1) throw new Error(`--example ${flags.example}: expected a whole number from 1`);
|
|
5998
|
+
request.example = n;
|
|
5999
|
+
}
|
|
6000
|
+
if (flags.details !== void 0) request.details = flags.details;
|
|
6001
|
+
if (flags.preview) request.preview = true;
|
|
6002
|
+
if (flags.resolution) request.resolution = flags.resolution;
|
|
6003
|
+
if (flags.draft === false) request.draft = false;
|
|
6004
|
+
return request;
|
|
6005
|
+
}
|
|
6006
|
+
function trendsCommand() {
|
|
6007
|
+
const cmd = new Command("trends").description(
|
|
6008
|
+
"trends \u2014 ready-made Cast Swap recipes: browse, quote, run with your own pictures, favorite (Cloud edition)"
|
|
6009
|
+
);
|
|
6010
|
+
cmd.command("list").description("the published trend catalog, in its curated order").option("--search <text>", "search text").option("--tag <tag>", "only trends with this tag").option("--favorites", "only your favorites").option("--locale <locale>", "language of names and descriptions (default your profile's, then English)").option("--limit <n>", "page size (1-60)").option("--cursor <cursor>", "the previous page's next").option("--profile <name>").option("--json").action(async (opts) => {
|
|
6011
|
+
try {
|
|
6012
|
+
const limit = parseLimit(opts.limit);
|
|
6013
|
+
const client = buildClient(opts.profile);
|
|
6014
|
+
const page = await client.trends.list({
|
|
6015
|
+
q: opts.search,
|
|
6016
|
+
tag: opts.tag,
|
|
6017
|
+
favorites: opts.favorites,
|
|
6018
|
+
locale: opts.locale,
|
|
6019
|
+
limit,
|
|
6020
|
+
cursor: opts.cursor
|
|
6021
|
+
});
|
|
6022
|
+
if (opts.json) {
|
|
6023
|
+
emit(page, opts);
|
|
6024
|
+
return;
|
|
6025
|
+
}
|
|
6026
|
+
table(
|
|
6027
|
+
page.data.map((t) => ({
|
|
6028
|
+
slug: t.slug,
|
|
6029
|
+
name: t.name,
|
|
6030
|
+
needs: Object.entries(t.needs).filter(([, n]) => n > 0).map(([kind, n]) => `${n} ${kind}`).join(", "),
|
|
6031
|
+
seconds: t.durationSec,
|
|
6032
|
+
tags: t.tags.join(", "),
|
|
6033
|
+
favorite: t.isFavorite ? "\u2605" : ""
|
|
6034
|
+
})),
|
|
6035
|
+
["slug", "name", "needs", "seconds", "tags", "favorite"]
|
|
6036
|
+
);
|
|
6037
|
+
if (page.next) dim(`next: --cursor ${page.next}`);
|
|
6038
|
+
} catch (err) {
|
|
6039
|
+
handleError(err);
|
|
6040
|
+
}
|
|
6041
|
+
});
|
|
6042
|
+
cmd.command("get <slug>").description("a trend's page: its slots, examples, preview and resolutions").option("--locale <locale>", "language of names and descriptions").option("--profile <name>").option("--json").action(async (slug, opts) => {
|
|
6043
|
+
try {
|
|
6044
|
+
const trend = await buildClient(opts.profile).trends.get(slug, { locale: opts.locale });
|
|
6045
|
+
if (opts.json) emit(trend, opts);
|
|
6046
|
+
else detail(trend);
|
|
6047
|
+
} catch (err) {
|
|
6048
|
+
handleError(err);
|
|
6049
|
+
}
|
|
6050
|
+
});
|
|
6051
|
+
addRunFlags(
|
|
6052
|
+
cmd.command("estimate <slug>").description("quote a run before starting it (free)")
|
|
6053
|
+
).option("--profile <name>").option("--json").action(async (slug, opts) => {
|
|
6054
|
+
try {
|
|
6055
|
+
const request = buildRequest(opts);
|
|
6056
|
+
const quote = await buildClient(opts.profile).trends.estimate(slug, request);
|
|
6057
|
+
if (opts.json) {
|
|
6058
|
+
emit(quote, opts);
|
|
6059
|
+
return;
|
|
6060
|
+
}
|
|
6061
|
+
info(
|
|
6062
|
+
`about ${quote.expectedCredits} credits` + (quote.holdCredits !== quote.expectedCredits ? ` (up to ${quote.holdCredits} held while it runs)` : "")
|
|
6063
|
+
);
|
|
6064
|
+
for (const [part, credits] of Object.entries(quote.breakdown)) dim(` ${terminalSafe(part)}: ${credits}`);
|
|
6065
|
+
} catch (err) {
|
|
6066
|
+
handleError(err);
|
|
6067
|
+
}
|
|
6068
|
+
});
|
|
6069
|
+
addRunFlags(
|
|
6070
|
+
cmd.command("run <slug>").description("start a run \u2014 SPENDS CREDITS; run `estimate` first. Prints the job to follow")
|
|
6071
|
+
).option("--session <id>", "a generation session of yours (accepted; not yet applied: trend runs are not filed into sessions yet)").option("--idempotency-key <key>", "8-200 characters; a retry with the same key returns the first run's job").option("--profile <name>").option("--json").action(async (slug, opts) => {
|
|
6072
|
+
try {
|
|
6073
|
+
const request = buildRequest(opts);
|
|
6074
|
+
if (opts.session) request.sessionId = opts.session;
|
|
6075
|
+
const result = await buildClient(opts.profile).trends.run(
|
|
6076
|
+
slug,
|
|
6077
|
+
request,
|
|
6078
|
+
opts.idempotencyKey ? { idempotencyKey: opts.idempotencyKey } : {}
|
|
6079
|
+
);
|
|
6080
|
+
if (opts.json) {
|
|
6081
|
+
emit(result, opts);
|
|
6082
|
+
return;
|
|
6083
|
+
}
|
|
6084
|
+
success(`started trend run \u2014 job ${result.jobId}`);
|
|
6085
|
+
dim(`follow it: nodaro jobs get ${result.jobId}`);
|
|
6086
|
+
} catch (err) {
|
|
6087
|
+
handleError(err);
|
|
6088
|
+
}
|
|
6089
|
+
});
|
|
6090
|
+
cmd.command("runs").description("your trend runs, newest first").option("--trend <slug>", "only runs of this trend").option("--limit <n>", "page size (1-60)").option("--cursor <cursor>", "the previous page's next").option("--profile <name>").option("--json").action(async (opts) => {
|
|
6091
|
+
try {
|
|
6092
|
+
const limit = parseLimit(opts.limit);
|
|
6093
|
+
const page = await buildClient(opts.profile).trends.runs({
|
|
6094
|
+
trend: opts.trend,
|
|
6095
|
+
cursor: opts.cursor,
|
|
6096
|
+
limit
|
|
6097
|
+
});
|
|
6098
|
+
if (opts.json) {
|
|
6099
|
+
emit(page, opts);
|
|
6100
|
+
return;
|
|
6101
|
+
}
|
|
6102
|
+
table(
|
|
6103
|
+
page.data.map((r) => ({
|
|
6104
|
+
jobId: r.jobId,
|
|
6105
|
+
trend: r.trend.slug,
|
|
6106
|
+
status: r.status,
|
|
6107
|
+
resolution: r.preview ? `${r.resolution} preview` : r.resolution,
|
|
6108
|
+
draft: r.draft,
|
|
6109
|
+
credits: r.creditsCharged,
|
|
6110
|
+
createdAt: r.createdAt,
|
|
6111
|
+
video: r.videoUrl
|
|
6112
|
+
})),
|
|
6113
|
+
["jobId", "trend", "status", "resolution", "draft", "credits", "createdAt", "video"]
|
|
6114
|
+
);
|
|
6115
|
+
if (page.next) dim(`next: --cursor ${page.next}`);
|
|
6116
|
+
} catch (err) {
|
|
6117
|
+
handleError(err);
|
|
6118
|
+
}
|
|
6119
|
+
});
|
|
6120
|
+
cmd.command("favorite <slug>").description("add a trend to your favorites").option("--profile <name>").option("--json").action(async (slug, opts) => {
|
|
6121
|
+
try {
|
|
6122
|
+
await buildClient(opts.profile).trends.favorite(slug);
|
|
6123
|
+
if (opts.json) {
|
|
6124
|
+
emit({ success: true, slug }, opts);
|
|
6125
|
+
return;
|
|
6126
|
+
}
|
|
6127
|
+
success(`added ${terminalSafe(slug)} to your favorites`);
|
|
6128
|
+
} catch (err) {
|
|
6129
|
+
handleError(err);
|
|
6130
|
+
}
|
|
6131
|
+
});
|
|
6132
|
+
cmd.command("unfavorite <slug>").description("remove a trend from your favorites").option("--profile <name>").option("--json").action(async (slug, opts) => {
|
|
6133
|
+
try {
|
|
6134
|
+
await buildClient(opts.profile).trends.unfavorite(slug);
|
|
6135
|
+
if (opts.json) {
|
|
6136
|
+
emit({ success: true, slug }, opts);
|
|
6137
|
+
return;
|
|
6138
|
+
}
|
|
6139
|
+
success(`removed ${terminalSafe(slug)} from your favorites`);
|
|
6140
|
+
} catch (err) {
|
|
6141
|
+
handleError(err);
|
|
6142
|
+
}
|
|
6143
|
+
});
|
|
6144
|
+
return cmd;
|
|
6145
|
+
}
|
|
6146
|
+
function fullQualityCommand() {
|
|
6147
|
+
const cmd = new Command("full-quality").description(
|
|
6148
|
+
"finish a draft run (Cast Swap or trend) at Full Quality: the same take at 1080p, as a new job \u2014 `estimate` quotes it (free), `run` SPENDS CREDITS"
|
|
6149
|
+
);
|
|
6150
|
+
cmd.command("estimate <jobId>").description("quote finishing the draft at Full Quality (free): the credits, and until when the draft can be finished").option("--profile <name>").option("--json").action(async (jobId, opts) => {
|
|
6151
|
+
try {
|
|
6152
|
+
const quote = await buildClient(opts.profile).castSwap.fullQualityEstimate(jobId);
|
|
6153
|
+
if (opts.json) {
|
|
6154
|
+
emit(quote, opts);
|
|
6155
|
+
return;
|
|
6156
|
+
}
|
|
6157
|
+
info(`about ${quote.totalCredits} credits`);
|
|
6158
|
+
dim(` castSwap: ${quote.breakdown.castSwap}`);
|
|
6159
|
+
dim(` seedanceHd: ${quote.breakdown.seedanceHd}`);
|
|
6160
|
+
if (quote.breakdown.seedanceHd === 0) dim(" an earlier try's 1080p render is reused");
|
|
6161
|
+
dim(`available until ${terminalSafe(quote.availableUntil)}`);
|
|
6162
|
+
} catch (err) {
|
|
6163
|
+
handleError(err);
|
|
6164
|
+
}
|
|
6165
|
+
});
|
|
6166
|
+
cmd.command("run <jobId>").description("start Full Quality \u2014 SPENDS CREDITS; run `estimate` first. Prints the job to follow").option("--session <id>", "a generation session of yours to file the result in").option("--profile <name>").option("--json").action(async (jobId, opts) => {
|
|
6167
|
+
try {
|
|
6168
|
+
const result = await buildClient(opts.profile).castSwap.fullQuality(
|
|
6169
|
+
jobId,
|
|
6170
|
+
opts.session !== void 0 ? { sessionId: opts.session } : {}
|
|
6171
|
+
);
|
|
6172
|
+
if (opts.json) {
|
|
6173
|
+
emit(result, opts);
|
|
6174
|
+
return;
|
|
6175
|
+
}
|
|
6176
|
+
const id = terminalSafe(result.jobId);
|
|
6177
|
+
if (result.existing) info(`this draft's Full Quality already exists \u2014 job ${id} (nothing new was charged)`);
|
|
6178
|
+
else success(`started Full Quality \u2014 job ${id}`);
|
|
6179
|
+
dim(`follow it: nodaro jobs get ${id}`);
|
|
6180
|
+
} catch (err) {
|
|
6181
|
+
handleError(err);
|
|
6182
|
+
}
|
|
6183
|
+
});
|
|
6184
|
+
return cmd;
|
|
6185
|
+
}
|
|
6186
|
+
function castSwapCommand() {
|
|
6187
|
+
const cmd = new Command("cast-swap").description("Cast Swap \u2014 replace who and what is in a short video (Cloud edition)");
|
|
6188
|
+
cmd.addCommand(fullQualityCommand());
|
|
6189
|
+
return cmd;
|
|
6190
|
+
}
|
|
5824
6191
|
var ASSET_TYPE_TO_COLUMN = {
|
|
5825
6192
|
timeOfDay: "time_of_day",
|
|
5826
6193
|
weather: "weather",
|
|
@@ -7989,6 +8356,8 @@ program.addCommand(catalogCommand());
|
|
|
7989
8356
|
program.addCommand(modelsCommand());
|
|
7990
8357
|
program.addCommand(shotsCommand());
|
|
7991
8358
|
program.addCommand(recastCommand());
|
|
8359
|
+
program.addCommand(trendsCommand());
|
|
8360
|
+
program.addCommand(castSwapCommand());
|
|
7992
8361
|
program.addCommand(orgCommand());
|
|
7993
8362
|
program.addCommand(workspaceCommand());
|
|
7994
8363
|
program.addCommand(editCommand());
|