@nodaro/cli 1.45.3 → 1.47.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/dist/index.js CHANGED
@@ -17,6 +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 { VOICE_FAVORITE_TYPES } from '@nodaro/shared/pipeline';
20
21
  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
22
  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
23
  import { VIDEO_OVERLAY_PRESET_IDS, VIDEO_OVERLAY_CORNERS, VIDEO_OVERLAY_OUTPUT_ASPECTS, isVideoOverlayPresetId, isVideoOverlayCorner, isVideoOverlayOutputAspect, VIDEO_OVERLAY_FITS } from '@nodaro/shared/video';
@@ -41,7 +42,7 @@ var require_package = __commonJS({
41
42
  "package.json"(exports$1, module) {
42
43
  module.exports = {
43
44
  name: "@nodaro/cli",
44
- version: "1.45.3",
45
+ version: "1.47.0",
45
46
  description: "Command-line interface for Nodaro \u2014 list and run workflows, inspect jobs and executions, manage projects from the terminal.",
46
47
  type: "module",
47
48
  license: "Apache-2.0",
@@ -82,11 +83,11 @@ var require_package = __commonJS({
82
83
  "@inquirer/confirm": "^6.0.12",
83
84
  "@inquirer/input": "^5.0.12",
84
85
  "@inquirer/select": "^5.1.4",
85
- "@nodaro/sdk": "^2.61.0",
86
- "@nodaro/shared": "^3.51.0",
86
+ "@nodaro/sdk": "^2.67.0",
87
+ "@nodaro/shared": "^3.59.0",
87
88
  commander: "^12.1.0",
88
89
  picocolors: "^1.1.1",
89
- "@nodaro/prompts": "^1.47.0"
90
+ "@nodaro/prompts": "^1.53.1"
90
91
  },
91
92
  devDependencies: {
92
93
  tsup: "^8.5.0",
@@ -413,7 +414,7 @@ function saveWorkspace(profileName, workspaceId) {
413
414
  }
414
415
 
415
416
  // src/client.ts
416
- var CLI_VERSION = "1.45.3" ;
417
+ var CLI_VERSION = "1.47.0" ;
417
418
  function buildPublicClient(opts = {}) {
418
419
  const { profile } = getProfile(opts.profile);
419
420
  return createClient({
@@ -1429,6 +1430,19 @@ function jobsCommand() {
1429
1430
  handleError(err);
1430
1431
  }
1431
1432
  });
1433
+ cmd.command("rename <id> [title]").description("name one of your jobs (one line of plain text, up to 120 characters), or clear its name with --clear").option("--clear", "remove the name").option("--profile <name>").option("--json").action(async (id, title, opts) => {
1434
+ try {
1435
+ if (!opts.clear && (title === void 0 || title.trim() === "")) {
1436
+ throw new Error("give the name, or --clear to remove it");
1437
+ }
1438
+ const client = buildClient(opts.profile);
1439
+ const result = await client.jobs.rename(id, opts.clear ? null : title);
1440
+ if (opts.json) emit(result, opts);
1441
+ else success(result.data.title ? `named job ${id} "${result.data.title}"` : `cleared the name of job ${id}`);
1442
+ } catch (err) {
1443
+ handleError(err);
1444
+ }
1445
+ });
1432
1446
  cmd.command("cancel <id>").description("cancel a pending or running job").option("--profile <name>").option("--json").action(async (id, opts) => {
1433
1447
  try {
1434
1448
  const client = buildClient(opts.profile);
@@ -3070,6 +3084,54 @@ Examples:
3070
3084
  handleError(err);
3071
3085
  }
3072
3086
  });
3087
+ cmd.command("favorites").description("list your favorite voices, newest first (premade, library or clone), with the voice_id to pass to --voice").option("--profile <name>").option("--json").action(async (opts) => {
3088
+ try {
3089
+ const favorites = await buildClient(opts.profile).voices.listFavorites();
3090
+ if (opts.json) {
3091
+ emit(favorites, opts);
3092
+ return;
3093
+ }
3094
+ table(
3095
+ favorites.map((f) => ({ name: f.name, voice_id: f.voiceId, type: f.voiceType, starred: f.createdAt })),
3096
+ ["name", "voice_id", "type", "starred"]
3097
+ );
3098
+ dim(`${favorites.length} favorite${favorites.length === 1 ? "" : "s"} \u2014 pass voice_id to --voice / --voices`);
3099
+ } catch (err) {
3100
+ handleError(err);
3101
+ }
3102
+ });
3103
+ cmd.command("favorite <voiceId>").description("star a voice (a premade voice, a Voice Library voice or one of your clones) \u2014 idempotent").requiredOption("--name <name>", "the voice's name, as your favorites list will show it").requiredOption("--type <type>", "what the voice is: premade | library | custom (a library voice starred as premade would render on the wrong path)").option("--preview <url>", "the voice's preview audio URL, if you have it").option("--profile <name>").option("--json").action(async (voiceId, opts) => {
3104
+ try {
3105
+ if (!VOICE_FAVORITE_TYPES.includes(opts.type)) {
3106
+ throw new Error(`--type must be ${VOICE_FAVORITE_TYPES.join(", ")} (got "${opts.type}")`);
3107
+ }
3108
+ const favorite = await buildClient(opts.profile).voices.favorite({
3109
+ voiceId,
3110
+ voiceType: opts.type,
3111
+ name: opts.name,
3112
+ ...opts.preview ? { previewUrl: opts.preview } : {}
3113
+ });
3114
+ if (opts.json) {
3115
+ emit(favorite, opts);
3116
+ return;
3117
+ }
3118
+ dim(`Starred ${favorite.name} (${favorite.voiceId}).`);
3119
+ } catch (err) {
3120
+ handleError(err);
3121
+ }
3122
+ });
3123
+ cmd.command("unfavorite <voiceId>").description("unstar a voice \u2014 idempotent").option("--profile <name>").option("--json").action(async (voiceId, opts) => {
3124
+ try {
3125
+ await buildClient(opts.profile).voices.unfavorite(voiceId);
3126
+ if (opts.json) {
3127
+ emit({ success: true, voiceId }, opts);
3128
+ return;
3129
+ }
3130
+ dim(`Unstarred ${voiceId}.`);
3131
+ } catch (err) {
3132
+ handleError(err);
3133
+ }
3134
+ });
3073
3135
  const clones = new Command("clones").description("manage the voice clones you already have (list / delete) \u2014 cloning new voices is no longer offered");
3074
3136
  clones.command("list").description("list your voice clones").option("--profile <name>").option("--json").action(async (opts) => {
3075
3137
  try {
@@ -7493,11 +7555,37 @@ function refuseUnknownPlanTier(planTier) {
7493
7555
  }
7494
7556
  }
7495
7557
 
7558
+ // src/commands/edit-estimate.ts
7559
+ var ESTIMATE_HELP = "quote the run only: what these flags would be charged, with nothing created or charged (--watch and --idempotency-key are not used)";
7560
+ function lengthOf(sec) {
7561
+ const total = Math.round(sec);
7562
+ const h = Math.floor(total / 3600);
7563
+ const m = Math.floor(total % 3600 / 60);
7564
+ const s = total % 60;
7565
+ if (h > 0) return `${h} h ${String(m).padStart(2, "0")} min`;
7566
+ if (m > 0) return s > 0 ? `${m} min ${s} s` : `${m} min`;
7567
+ return `${s} s`;
7568
+ }
7569
+ function reportUseCaseEstimate(label, quote, opts) {
7570
+ if (opts.json) {
7571
+ emit(quote, opts);
7572
+ return;
7573
+ }
7574
+ const approx = quote.estimate ? "\u2248" : "";
7575
+ if (quote.totalCredits === 0 && quote.stepsCredits === 0 && quote.feeCredits === 0) {
7576
+ success(`${label}: not billed in credits on this edition`);
7577
+ } else {
7578
+ success(`${label} is estimated at ${approx}${quote.totalCredits} credits (its steps ${approx}${quote.stepsCredits} + the per-run fee ${quote.feeCredits})`);
7579
+ }
7580
+ dim(quote.durationSec === null ? "the recording's length could not be read" : `the recording is ${lengthOf(quote.durationSec)}`);
7581
+ dim("nothing was created or charged");
7582
+ }
7583
+
7496
7584
  // src/commands/edit-recordings.ts
7497
7585
  function withRecordingsOptions(cmd) {
7498
7586
  return cmd.requiredOption(
7499
7587
  "--media <url>",
7500
- "the recording (video or audio URL, up to 3 hours); repeat it for the cameras of one conversation, in order (several need Speaker Map)",
7588
+ "the recording (a video or audio URL, up to 3 hours; a video for episode-trailer and speaker-layout); repeat it for the cameras of one conversation, in order (several need Speaker Map)",
7501
7589
  collectVariadic
7502
7590
  ).option("--master-audio <url>", "the mixer or recorder track: the episode's sound and the clock the recordings are lined up to (needs Speaker Map)").option("--wide-camera <n>", "with several recordings: which --media (1-based) is the wide shot").option("--synced", "with several recordings: they already share one clock, skip lining them up").option(
7503
7591
  "--speaker-camera <speaker=recording>",
@@ -7550,6 +7638,7 @@ function recordingsInput(opts) {
7550
7638
 
7551
7639
  // src/commands/edit-use-case.ts
7552
7640
  var EMPHASIS_HELP = `none, or ${SPEAKER_EMPHASIS_STYLES.filter((s) => s !== "none").join(", ")} joined with "+" (each once)`;
7641
+ var TEXT_MAX = 4e3;
7553
7642
  var CONTINUATION_NEXT_STEP = {
7554
7643
  already_running: (id) => ` \u2014 follow it: nodaro jobs get ${id}`,
7555
7644
  continuation_superseded: (id) => ` \u2014 continue that one: nodaro edit continue-use-case ${id} --mode from-failed`,
@@ -7563,7 +7652,7 @@ function registerUseCaseCommands(cmd) {
7563
7652
  ).option("--music <url>", "optional music bed, ducked under the voice").option("--output <kind>", "video | audio (an audio recording always makes an audio episode)").option("--framing <aspect>", `frame a video episode on its speakers: ${EDL_TARGET_ASPECTS.join(" | ")}`).option("--layout <layout>", `layout with --framing (default auto): ${framingLayouts.join(" | ")}`).option(
7564
7653
  "--framing-source <source>",
7565
7654
  `with --framing, how it follows the speakers: ${FRAMING_SOURCES.join(" | ")} (default static: the even split; tracking follows faces with Speaker Frames, charged per started block of 1,000 sampled frames; auto follows faces while Speaker Frames is available to you)`
7566
- ).option("--no-captions", "no captions on a video episode").option("--review", "stop at a preview to review (render the final with `nodaro edit continue-use-case <jobId> --mode render-final`)").option("--plan-tier <tier>", EDIT_PLAN_TIERS.join(" | ")).option("--instructions <text>", "editing instructions for the planner").option("--watch", "poll the job until it finishes").option("--poll-interval <ms>", "poll interval with --watch", (v) => parseInt(v, 10)).option("--profile <name>").option("--json").action(
7655
+ ).option("--music-duck-amount <n>", "with --music, how far the music dips under the voice, 0\u2013100 (default 75)").option("--no-captions", "no captions on a video episode").option("--caption-style <style>", `the captions' look (default word-highlight): ${ALL_CAPTION_STYLES.join(" | ")}`).option("--review", "stop at a preview to review (render the final with `nodaro edit continue-use-case <jobId> --mode render-final`)").option("--plan-tier <tier>", EDIT_PLAN_TIERS.join(" | ")).option("--instructions <text>", "editing instructions for the planner").option("--style-guide <text>", `a style guide for the planner (up to ${TEXT_MAX} characters)`).option("--idempotency-key <key>", "sent as Idempotency-Key: a retry with the same key answers the run already started").option("--estimate", ESTIMATE_HELP).option("--watch", "poll the job until it finishes").option("--poll-interval <ms>", "poll interval with --watch", (v) => parseInt(v, 10)).option("--profile <name>").option("--json").action(
7567
7656
  async (opts, command) => {
7568
7657
  if (opts.output !== void 0 && opts.output !== "video" && opts.output !== "audio") {
7569
7658
  warn(`--output must be "video" or "audio" (got "${opts.output}")`);
@@ -7590,21 +7679,47 @@ function registerUseCaseCommands(cmd) {
7590
7679
  warn(`--framing-source must be ${FRAMING_SOURCES.join(", ")} (got "${opts.framingSource}")`);
7591
7680
  process.exit(1);
7592
7681
  }
7682
+ if (opts.musicDuckAmount !== void 0 && opts.music === void 0) {
7683
+ warn("--music-duck-amount applies with --music only (it is how far the music dips under the voice)");
7684
+ process.exit(1);
7685
+ }
7686
+ const duck = opts.musicDuckAmount !== void 0 && opts.musicDuckAmount.trim() !== "" ? Number(opts.musicDuckAmount) : Number.NaN;
7687
+ if (opts.musicDuckAmount !== void 0 && !(duck >= 0 && duck <= 100)) {
7688
+ warn(`--music-duck-amount must be a number from 0 to 100 (got "${opts.musicDuckAmount}")`);
7689
+ process.exit(1);
7690
+ }
7691
+ if (opts.captionStyle !== void 0 && opts.captions === false) {
7692
+ warn("--caption-style applies with captions on (drop --no-captions)");
7693
+ process.exit(1);
7694
+ }
7695
+ if (opts.captionStyle !== void 0 && !ALL_CAPTION_STYLES.includes(opts.captionStyle)) {
7696
+ warn(`--caption-style must be ${ALL_CAPTION_STYLES.join(", ")} (got "${opts.captionStyle}")`);
7697
+ process.exit(1);
7698
+ }
7699
+ if (opts.styleGuide !== void 0 && opts.styleGuide.length > TEXT_MAX) {
7700
+ warn(`--style-guide is at most ${TEXT_MAX} characters (got ${opts.styleGuide.length})`);
7701
+ process.exit(1);
7702
+ }
7593
7703
  const recordings = recordingsInput(opts);
7704
+ const input2 = {
7705
+ ...recordings,
7706
+ ...opts.music ? { musicUrl: opts.music } : {},
7707
+ ...opts.musicDuckAmount !== void 0 ? { musicDuckAmount: duck } : {},
7708
+ ...opts.output ? { output: opts.output } : {},
7709
+ ...opts.framing ? { framing: { aspect: opts.framing, layout: opts.layout ?? "auto" } } : {},
7710
+ ...opts.framingSource ? { framingSource: opts.framingSource } : {},
7711
+ // commander's --no-captions defaults `captions` to true: send it only when turned off.
7712
+ ...opts.captions === false ? { captions: false } : {},
7713
+ ...opts.captionStyle ? { captionStyle: opts.captionStyle } : {},
7714
+ ...opts.review ? { reviewBeforeRender: true } : {},
7715
+ ...opts.planTier ? { planTier: opts.planTier } : {},
7716
+ ...opts.instructions ? { instructions: opts.instructions } : {},
7717
+ ...opts.styleGuide ? { styleGuide: opts.styleGuide } : {}
7718
+ };
7594
7719
  try {
7595
7720
  const client = buildClient(opts.profile);
7596
- const result = await client.edit.tightenEpisode({
7597
- ...recordings,
7598
- ...opts.music ? { musicUrl: opts.music } : {},
7599
- ...opts.output ? { output: opts.output } : {},
7600
- ...opts.framing ? { framing: { aspect: opts.framing, layout: opts.layout ?? "auto" } } : {},
7601
- ...opts.framingSource ? { framingSource: opts.framingSource } : {},
7602
- // commander's --no-captions defaults `captions` to true: send it only when turned off.
7603
- ...opts.captions === false ? { captions: false } : {},
7604
- ...opts.review ? { reviewBeforeRender: true } : {},
7605
- ...opts.planTier ? { planTier: opts.planTier } : {},
7606
- ...opts.instructions ? { instructions: opts.instructions } : {}
7607
- });
7721
+ if (opts.estimate) return reportUseCaseEstimate("Tighten Episode", (await client.edit.estimateTightenEpisode(input2)).data, opts);
7722
+ const result = await client.edit.tightenEpisode(input2, opts.idempotencyKey ? { idempotencyKey: opts.idempotencyKey } : void 0);
7608
7723
  await reportQueuedJob(result, () => client.jobs.getStatus(result.jobId), {
7609
7724
  json: opts.json,
7610
7725
  watch: opts.watch,
@@ -7616,20 +7731,19 @@ function registerUseCaseCommands(cmd) {
7616
7731
  }
7617
7732
  }
7618
7733
  );
7619
- cmd.command("episode-chapters").description("list a podcast recording's chapters in one step (transcribe, then plan the chapters); with --watch, prints the show notes").requiredOption("--media <url>", "the recording (video or audio URL, up to 3 hours)").option("--plan-tier <tier>", EDIT_PLAN_TIERS.join(" | ")).option("--instructions <text>", 'instructions for the chapters ("5 to 8 chapters")').option("--style-guide <text>", "a style guide for the chapter titles").option("--idempotency-key <key>", "sent as Idempotency-Key: a retry with the same key answers the run already started").option("--watch", "poll the job until it finishes, then print the chapter list").option("--poll-interval <ms>", "poll interval with --watch", (v) => parseInt(v, 10)).option("--profile <name>").option("--json").action(
7734
+ cmd.command("episode-chapters").description("list a podcast recording's chapters in one step (transcribe, then plan the chapters); with --watch, prints the show notes").requiredOption("--media <url>", "the recording (video or audio URL, up to 3 hours)").option("--plan-tier <tier>", EDIT_PLAN_TIERS.join(" | ")).option("--instructions <text>", 'instructions for the chapters ("5 to 8 chapters")').option("--style-guide <text>", "a style guide for the chapter titles").option("--idempotency-key <key>", "sent as Idempotency-Key: a retry with the same key answers the run already started").option("--estimate", ESTIMATE_HELP).option("--watch", "poll the job until it finishes, then print the chapter list").option("--poll-interval <ms>", "poll interval with --watch", (v) => parseInt(v, 10)).option("--profile <name>").option("--json").action(
7620
7735
  async (opts, command) => {
7621
7736
  refuseUnknownPlanTier(opts.planTier);
7737
+ const input2 = {
7738
+ mediaUrl: opts.media,
7739
+ ...opts.planTier ? { planTier: opts.planTier } : {},
7740
+ ...opts.instructions ? { instructions: opts.instructions } : {},
7741
+ ...opts.styleGuide ? { styleGuide: opts.styleGuide } : {}
7742
+ };
7622
7743
  try {
7623
7744
  const client = buildClient(opts.profile);
7624
- const result = await client.edit.episodeChapters(
7625
- {
7626
- mediaUrl: opts.media,
7627
- ...opts.planTier ? { planTier: opts.planTier } : {},
7628
- ...opts.instructions ? { instructions: opts.instructions } : {},
7629
- ...opts.styleGuide ? { styleGuide: opts.styleGuide } : {}
7630
- },
7631
- opts.idempotencyKey ? { idempotencyKey: opts.idempotencyKey } : void 0
7632
- );
7745
+ if (opts.estimate) return reportUseCaseEstimate("Chapters", (await client.edit.estimateEpisodeChapters(input2)).data, opts);
7746
+ const result = await client.edit.episodeChapters(input2, opts.idempotencyKey ? { idempotencyKey: opts.idempotencyKey } : void 0);
7633
7747
  const done = await reportQueuedJob(result, () => client.jobs.getStatus(result.jobId), {
7634
7748
  json: opts.json,
7635
7749
  watch: opts.watch,
@@ -7645,7 +7759,7 @@ function registerUseCaseCommands(cmd) {
7645
7759
  );
7646
7760
  withRecordingsOptions(
7647
7761
  cmd.command("episode-trailer").description("cut a 20\u201340 second trailer of a recording and deliver it in each chosen social format, in one step")
7648
- ).option("--intro-card <url>", "an optional short video (15 s at most) played before the trailer").option("--formats <list>", `comma-separated, at least one: ${TRAILER_FORMATS.join(",")} (default 9:16,1:1,4:5)`).option("--review", "stop at a preview to review (render every format with `nodaro edit continue-use-case <jobId> --mode render-final`)").option("--plan-tier <tier>", EDIT_PLAN_TIERS.join(" | ")).option("--instructions <text>", "instructions for the trailer").option("--style-guide <text>", "a style guide for the plan").option("--idempotency-key <key>", "sent as Idempotency-Key: a retry with the same key answers the run already started").option("--watch", "poll the job until it finishes, then print each format's URL").option("--poll-interval <ms>", "poll interval with --watch", (v) => parseInt(v, 10)).option("--profile <name>").option("--json").action(
7762
+ ).option("--intro-card <url>", "an optional short video (15 s at most) played before the trailer").option("--formats <list>", `comma-separated, at least one: ${TRAILER_FORMATS.join(",")} (default 9:16,1:1,4:5)`).option("--review", "stop at a preview to review (render every format with `nodaro edit continue-use-case <jobId> --mode render-final`)").option("--plan-tier <tier>", EDIT_PLAN_TIERS.join(" | ")).option("--instructions <text>", "instructions for the trailer").option("--style-guide <text>", "a style guide for the plan").option("--idempotency-key <key>", "sent as Idempotency-Key: a retry with the same key answers the run already started").option("--estimate", ESTIMATE_HELP).option("--watch", "poll the job until it finishes, then print each format's URL").option("--poll-interval <ms>", "poll interval with --watch", (v) => parseInt(v, 10)).option("--profile <name>").option("--json").action(
7649
7763
  async (opts) => {
7650
7764
  const formats = opts.formats?.split(",").map((f) => f.trim()).filter((f) => f.length > 0);
7651
7765
  if (formats !== void 0 && (formats.length === 0 || formats.some((f) => !TRAILER_FORMATS.includes(f)))) {
@@ -7654,20 +7768,19 @@ function registerUseCaseCommands(cmd) {
7654
7768
  }
7655
7769
  refuseUnknownPlanTier(opts.planTier);
7656
7770
  const recordings = recordingsInput(opts);
7771
+ const input2 = {
7772
+ ...recordings,
7773
+ ...opts.introCard ? { introCardUrl: opts.introCard } : {},
7774
+ ...formats ? { formats } : {},
7775
+ ...opts.review ? { reviewBeforeRender: true } : {},
7776
+ ...opts.planTier ? { planTier: opts.planTier } : {},
7777
+ ...opts.instructions ? { instructions: opts.instructions } : {},
7778
+ ...opts.styleGuide ? { styleGuide: opts.styleGuide } : {}
7779
+ };
7657
7780
  try {
7658
7781
  const client = buildClient(opts.profile);
7659
- const result = await client.edit.episodeTrailer(
7660
- {
7661
- ...recordings,
7662
- ...opts.introCard ? { introCardUrl: opts.introCard } : {},
7663
- ...formats ? { formats } : {},
7664
- ...opts.review ? { reviewBeforeRender: true } : {},
7665
- ...opts.planTier ? { planTier: opts.planTier } : {},
7666
- ...opts.instructions ? { instructions: opts.instructions } : {},
7667
- ...opts.styleGuide ? { styleGuide: opts.styleGuide } : {}
7668
- },
7669
- opts.idempotencyKey ? { idempotencyKey: opts.idempotencyKey } : void 0
7670
- );
7782
+ if (opts.estimate) return reportUseCaseEstimate("Trailer", (await client.edit.estimateEpisodeTrailer(input2)).data, opts);
7783
+ const result = await client.edit.episodeTrailer(input2, opts.idempotencyKey ? { idempotencyKey: opts.idempotencyKey } : void 0);
7671
7784
  const done = await reportQueuedJob(result, () => client.jobs.getStatus(result.jobId), {
7672
7785
  json: opts.json,
7673
7786
  watch: opts.watch,
@@ -7695,7 +7808,7 @@ function registerUseCaseCommands(cmd) {
7695
7808
  ).option("--count <n>", `how many clips, 1\u2013${EDIT_PLAN_MAX_CLIP_COUNT} (default 8; the plan may find fewer)`).option("--length <sec>", `each clip's target length in seconds, ${CLIP_PACK_MIN_TARGET_SEC}\u2013${CLIP_PACK_MAX_TARGET_SEC} (default 60)`).option("--framing <aspect>", `frame each clip on its speakers: ${EDL_TARGET_ASPECTS.join(" | ")}, or none for the recording's shape (default 9:16)`).option("--layout <layout>", `layout with --framing <aspect> (default stacked): ${framingLayouts.join(" | ")}`).option("--switch <id>", `the switch at each speaker change, with --framing <aspect> (default pan): cut | pan | zoom | xfade:<transition>, e.g. xfade:fade`).option("--emphasis <style>", `how the speaker talking is emphasised, with --framing <aspect> (default scale): ${EMPHASIS_HELP}`).option(
7696
7809
  "--framing-source <source>",
7697
7810
  `how the framing follows the speakers (not with --framing none): ${FRAMING_SOURCES.join(" | ")} (default static: the even split; tracking follows faces with one Speaker Frames run over the whole pack, charged per started block of 1,000 sampled frames; auto follows faces while Speaker Frames is available to you)`
7698
- ).option("--no-captions", "no captions on the clips").option("--caption-style <style>", `the captions' look (default karaoke): ${ALL_CAPTION_STYLES.join(" | ")}`).option("--review", "stop at previews to review (render the kept clips with `nodaro edit continue-use-case <jobId> --mode render-final`)").option("--plan-tier <tier>", EDIT_PLAN_TIERS.join(" | ")).option("--instructions <text>", "instructions for picking the clips").option("--style-guide <text>", "a style guide for the plan").option("--idempotency-key <key>", "sent as Idempotency-Key: a retry with the same key answers the run already started").option("--watch", "poll the job until it finishes, then print each clip's URL").option("--poll-interval <ms>", "poll interval with --watch", (v) => parseInt(v, 10)).option("--profile <name>").option("--json").action(
7811
+ ).option("--no-captions", "no captions on the clips").option("--caption-style <style>", `the captions' look (default karaoke): ${ALL_CAPTION_STYLES.join(" | ")}`).option("--review", "stop at previews to review (render the kept clips with `nodaro edit continue-use-case <jobId> --mode render-final`)").option("--plan-tier <tier>", EDIT_PLAN_TIERS.join(" | ")).option("--instructions <text>", "instructions for picking the clips").option("--style-guide <text>", "a style guide for the plan").option("--idempotency-key <key>", "sent as Idempotency-Key: a retry with the same key answers the run already started").option("--estimate", ESTIMATE_HELP).option("--watch", "poll the job until it finishes, then print each clip's URL").option("--poll-interval <ms>", "poll interval with --watch", (v) => parseInt(v, 10)).option("--profile <name>").option("--json").action(
7699
7812
  async (opts) => {
7700
7813
  if (opts.count !== void 0 && !isWhole(opts.count, 1, EDIT_PLAN_MAX_CLIP_COUNT)) {
7701
7814
  warn(`--count must be 1\u2013${EDIT_PLAN_MAX_CLIP_COUNT} (got "${opts.count}")`);
@@ -7749,33 +7862,32 @@ function registerUseCaseCommands(cmd) {
7749
7862
  }
7750
7863
  refuseUnknownPlanTier(opts.planTier);
7751
7864
  const recordings = recordingsInput(opts);
7865
+ const input2 = {
7866
+ ...recordings,
7867
+ ...opts.count !== void 0 ? { count: Number(opts.count) } : {},
7868
+ ...opts.length !== void 0 ? { targetDurationSec: Number(opts.length) } : {},
7869
+ // none = the recording's shape; an aspect alone leaves the layout to the route (stacked).
7870
+ ...opts.framing === "none" ? { framing: null } : opts.framing ? {
7871
+ framing: {
7872
+ aspect: opts.framing,
7873
+ ...opts.layout ? { layout: opts.layout } : {},
7874
+ ...opts.switch ? { switchType: opts.switch } : {},
7875
+ ...opts.emphasis ? { emphasisStyle: opts.emphasis } : {}
7876
+ }
7877
+ } : {},
7878
+ ...opts.framingSource ? { framingSource: opts.framingSource } : {},
7879
+ // commander's --no-captions defaults `captions` to true: send it only when turned off.
7880
+ ...opts.captions === false ? { captions: false } : {},
7881
+ ...opts.captionStyle ? { captionStyle: opts.captionStyle } : {},
7882
+ ...opts.review ? { reviewBeforeRender: true } : {},
7883
+ ...opts.planTier ? { planTier: opts.planTier } : {},
7884
+ ...opts.instructions ? { instructions: opts.instructions } : {},
7885
+ ...opts.styleGuide ? { styleGuide: opts.styleGuide } : {}
7886
+ };
7752
7887
  try {
7753
7888
  const client = buildClient(opts.profile);
7754
- const result = await client.edit.clipPack(
7755
- {
7756
- ...recordings,
7757
- ...opts.count !== void 0 ? { count: Number(opts.count) } : {},
7758
- ...opts.length !== void 0 ? { targetDurationSec: Number(opts.length) } : {},
7759
- // none = the recording's shape; an aspect alone leaves the layout to the route (stacked).
7760
- ...opts.framing === "none" ? { framing: null } : opts.framing ? {
7761
- framing: {
7762
- aspect: opts.framing,
7763
- ...opts.layout ? { layout: opts.layout } : {},
7764
- ...opts.switch ? { switchType: opts.switch } : {},
7765
- ...opts.emphasis ? { emphasisStyle: opts.emphasis } : {}
7766
- }
7767
- } : {},
7768
- ...opts.framingSource ? { framingSource: opts.framingSource } : {},
7769
- // commander's --no-captions defaults `captions` to true: send it only when turned off.
7770
- ...opts.captions === false ? { captions: false } : {},
7771
- ...opts.captionStyle ? { captionStyle: opts.captionStyle } : {},
7772
- ...opts.review ? { reviewBeforeRender: true } : {},
7773
- ...opts.planTier ? { planTier: opts.planTier } : {},
7774
- ...opts.instructions ? { instructions: opts.instructions } : {},
7775
- ...opts.styleGuide ? { styleGuide: opts.styleGuide } : {}
7776
- },
7777
- opts.idempotencyKey ? { idempotencyKey: opts.idempotencyKey } : void 0
7778
- );
7889
+ if (opts.estimate) return reportUseCaseEstimate("Clip Pack", (await client.edit.estimateClipPack(input2)).data, opts);
7890
+ const result = await client.edit.clipPack(input2, opts.idempotencyKey ? { idempotencyKey: opts.idempotencyKey } : void 0);
7779
7891
  const done = await reportQueuedJob(result, () => client.jobs.getStatus(result.jobId), {
7780
7892
  json: opts.json,
7781
7893
  watch: opts.watch,
@@ -7806,7 +7918,7 @@ function registerUseCaseCommands(cmd) {
7806
7918
  ).option("--aspect <aspect>", `the video's shape (default 9:16): ${EDL_TARGET_ASPECTS.join(" | ")}`).option("--layout <layout>", `how the speakers are laid out (default stacked): ${framingLayouts.join(" | ")}`).option("--switch <id>", "the switch at each speaker change (default cut): cut | pan | zoom | xfade:<transition>, e.g. xfade:fade").option("--emphasis <style>", `how the speaker talking is emphasised (default scale): ${EMPHASIS_HELP}`).option(
7807
7919
  "--framing-source <source>",
7808
7920
  `how the speakers are followed: ${LAYOUT_FRAMING_SOURCES.join(" | ")} (default auto: follows faces with Speaker Frames while it is available to you, else the even split; static: the even split; tracking: follows faces, charged per started block of 1,000 sampled frames)`
7809
- ).option("--review", "stop at a preview to review (render the final with `nodaro edit continue-use-case <jobId> --mode render-final`)").option("--idempotency-key <key>", "sent as Idempotency-Key: a retry with the same key answers the run already started").option("--watch", "poll the job until it finishes, then print the framed video's URL").option("--poll-interval <ms>", "poll interval with --watch", (v) => parseInt(v, 10)).option("--profile <name>").option("--json").action(
7921
+ ).option("--review", "stop at a preview to review (render the final with `nodaro edit continue-use-case <jobId> --mode render-final`)").option("--idempotency-key <key>", "sent as Idempotency-Key: a retry with the same key answers the run already started").option("--estimate", ESTIMATE_HELP).option("--watch", "poll the job until it finishes, then print the framed video's URL").option("--poll-interval <ms>", "poll interval with --watch", (v) => parseInt(v, 10)).option("--profile <name>").option("--json").action(
7810
7922
  async (opts) => {
7811
7923
  if (opts.aspect !== void 0 && !EDL_TARGET_ASPECTS.includes(opts.aspect)) {
7812
7924
  warn(`--aspect must be ${EDL_TARGET_ASPECTS.join(", ")} (got "${opts.aspect}")`);
@@ -7829,20 +7941,19 @@ function registerUseCaseCommands(cmd) {
7829
7941
  process.exit(1);
7830
7942
  }
7831
7943
  const recordings = recordingsInput(opts);
7944
+ const input2 = {
7945
+ ...recordings,
7946
+ ...opts.aspect ? { targetAspect: opts.aspect } : {},
7947
+ ...opts.layout ? { layout: opts.layout } : {},
7948
+ ...opts.switch ? { switchType: opts.switch } : {},
7949
+ ...opts.emphasis ? { emphasisStyle: opts.emphasis } : {},
7950
+ ...opts.framingSource ? { framingSource: opts.framingSource } : {},
7951
+ ...opts.review ? { reviewBeforeRender: true } : {}
7952
+ };
7832
7953
  try {
7833
7954
  const client = buildClient(opts.profile);
7834
- const result = await client.edit.speakerLayout(
7835
- {
7836
- ...recordings,
7837
- ...opts.aspect ? { targetAspect: opts.aspect } : {},
7838
- ...opts.layout ? { layout: opts.layout } : {},
7839
- ...opts.switch ? { switchType: opts.switch } : {},
7840
- ...opts.emphasis ? { emphasisStyle: opts.emphasis } : {},
7841
- ...opts.framingSource ? { framingSource: opts.framingSource } : {},
7842
- ...opts.review ? { reviewBeforeRender: true } : {}
7843
- },
7844
- opts.idempotencyKey ? { idempotencyKey: opts.idempotencyKey } : void 0
7845
- );
7955
+ if (opts.estimate) return reportUseCaseEstimate("Speaker Layout", (await client.edit.estimateSpeakerLayout(input2)).data, opts);
7956
+ const result = await client.edit.speakerLayout(input2, opts.idempotencyKey ? { idempotencyKey: opts.idempotencyKey } : void 0);
7846
7957
  const done = await reportQueuedJob(result, () => client.jobs.getStatus(result.jobId), {
7847
7958
  json: opts.json,
7848
7959
  watch: opts.watch,
@@ -7919,6 +8030,11 @@ function registerUseCaseCommands(cmd) {
7919
8030
  }
7920
8031
 
7921
8032
  // src/commands/edit.ts
8033
+ var CAPABILITIES_SOURCE = {
8034
+ server: "this server",
8035
+ "nodaro.ai": "nodaro.ai (this install is connected to it)",
8036
+ "nodaro.ai-unreachable": "this install: nodaro.ai could not be reached, so only the original modes are listed"
8037
+ };
7922
8038
  function isEditPlanMode(v) {
7923
8039
  return EDIT_PLAN_MODES.includes(v);
7924
8040
  }
@@ -8006,11 +8122,11 @@ function editCommand() {
8006
8122
  "--source <[id=]url>",
8007
8123
  "a camera (or the master / wide) as url or id=url (repeatable, 2-6); ids are minted as source-N when omitted",
8008
8124
  collectVariadic
8009
- ).option("--sources-file <file>", "JSON array of { id, url } rows (overrides --source)").requiredOption("--transcript <file>", "path to the transcript JSON WITH speaker labels (transcribe with speaker detection)").option("--offsets <file>", "an audio-sync result JSON (the job's output_data.json); omit when the recordings share a clock").option("--master <id>", "the master audio's id: hears everyone, so it is no one's camera").option("--wide <id>", "the wide shot's id: no one's camera; a speaker with no clear camera is shown on it").option("--margin-db <db>", "how much louder the loudest camera must be than the next (default 3)", (v) => Number(v)).option("--watch", "poll the job until it finishes").option("--poll-interval <ms>", "poll interval with --watch", (v) => parseInt(v, 10)).option("--profile <name>").option("--json").action(
8125
+ ).option("--sources-file <file>", 'JSON array of { id, url, kind? } rows, kind "audio" for a sound-only recording (overrides --source)').requiredOption("--transcript <file>", "path to the transcript JSON WITH speaker labels (transcribe with speaker detection)").option("--offsets <file>", "an audio-sync result JSON (the job's output_data.json); omit when the recordings share a clock").option("--master <id>", "the master audio's id: hears everyone, so it is no one's camera").option("--wide <id>", "the wide shot's id: no one's camera; a speaker with no clear camera is shown on it").option("--margin-db <db>", "how much louder the loudest camera must be than the next (default 3)", (v) => Number(v)).option("--watch", "poll the job until it finishes").option("--poll-interval <ms>", "poll interval with --watch", (v) => parseInt(v, 10)).option("--profile <name>").option("--json").action(
8010
8126
  async (opts) => {
8011
8127
  const sources = opts.sourcesFile ? readJsonFile2(opts.sourcesFile) : (opts.source ?? []).map(parseAudioSyncSource);
8012
8128
  if (!Array.isArray(sources) || sources.length < 2 || sources.length > 6) {
8013
- warn("speaker-map takes 2-6 recordings \u2014 pass --source <url> (repeatable) or --sources-file <file> (a JSON array of { id, url } rows)");
8129
+ warn("speaker-map takes 2-6 recordings \u2014 pass --source <url> (repeatable) or --sources-file <file> (a JSON array of { id, url, kind? } rows)");
8014
8130
  process.exit(1);
8015
8131
  }
8016
8132
  try {
@@ -8071,7 +8187,7 @@ function editCommand() {
8071
8187
  }
8072
8188
  );
8073
8189
  registerUseCaseCommands(cmd);
8074
- cmd.command("plan").description("plan a transcript-driven cut / clips / chapters / trailer (Cloud edition)").requiredOption("--mode <mode>", EDIT_PLAN_MODES.join(" | ")).requiredOption("--plan-tier <tier>", "economy | standard | premium").requiredOption("--transcript <file>", "path to a timed transcript JSON file").option("--silence <file>", "optional silence JSON \u2014 the silence-detect job's output_data.json ({ version, ranges, durationMs })").option(
8190
+ cmd.command("plan").description("plan a transcript-driven cut / clips / chapters / trailer (runs on nodaro.ai; a connected self-hosted install relays it)").requiredOption("--mode <mode>", EDIT_PLAN_MODES.join(" | ")).requiredOption("--plan-tier <tier>", "economy | standard | premium").requiredOption("--transcript <file>", "path to a timed transcript JSON file").option("--silence <file>", "optional silence JSON \u2014 the silence-detect job's output_data.json ({ version, ranges, durationMs })").option(
8075
8191
  "--source <url>",
8076
8192
  "a media source as [id=]url[@audio|@video] (repeatable); id defaults to source-N, kind to video",
8077
8193
  collectVariadic
@@ -8136,7 +8252,23 @@ function editCommand() {
8136
8252
  }
8137
8253
  }
8138
8254
  );
8139
- cmd.command("switch-cameras").description("choose which camera shows each cut of an edit by who is speaking (Cloud edition; flat price)").requiredOption("--edl <file>", "path to ONE EDL JSON (an `edit plan` result)").requiredOption("--transcript <file>", "path to the transcript JSON WITH speaker labels (transcribe with speaker detection)").option("--speaker-map <file>", "JSON object: speaker label \u2192 EDL source id of their camera").option("--speaker-map-result <file>", "a speaker-map result JSON (the job's output_data.json); a label in --speaker-map wins over it").option("--speaker-names <file>", "JSON object: speaker label \u2192 display name").option("--min-shot-ms <ms>", "shortest shot (default 2500)", (v) => parseInt(v, 10)).option("--lead-ms <ms>", "cut this long before the new speaker (default 200)", (v) => parseInt(v, 10)).option("--max-shot-ms <ms>", "with a wide source: break to it after this long (default 20000)", (v) => parseInt(v, 10)).option("--wide-every <n>", "with a wide source: every N-th cut to the wide (default 0 = off)", (v) => parseInt(v, 10)).option("--layout-hints", "suggest side-by-side / stacked layouts for crosstalk (Apply EDL renders cut-only edits)").option("--watch", "poll the job until it finishes").option("--poll-interval <ms>", "poll interval with --watch", (v) => parseInt(v, 10)).option("--profile <name>").option("--json").action(
8255
+ cmd.command("capabilities").description("the Edit Plan modes this server can plan, who answered, and how Edit Plan is charged here; nothing is created or charged").option("--profile <name>").option("--json").action(async (opts) => {
8256
+ try {
8257
+ const caps = await buildClient(opts.profile).edit.editPlanCapabilities();
8258
+ if (opts.json) {
8259
+ emit(caps, opts);
8260
+ return;
8261
+ }
8262
+ success(`Edit Plan modes: ${caps.modes.join(", ")}`);
8263
+ const notListed = EDIT_PLAN_MODES.filter((m) => !caps.modes.includes(m));
8264
+ if (notListed.length > 0) dim(`not listed: ${notListed.join(", ")}`);
8265
+ dim(`answered by: ${CAPABILITIES_SOURCE[caps.source] ?? caps.source}`);
8266
+ dim(caps.perMinute ? "charged per started minute of the recording" : "charged at the 15/30/60/90/120/180-minute step the recording's length rounds up to");
8267
+ } catch (err) {
8268
+ handleError(err);
8269
+ }
8270
+ });
8271
+ cmd.command("switch-cameras").description("choose which camera shows each cut of an edit by who is speaking (runs on nodaro.ai; a connected self-hosted install relays it; flat price)").requiredOption("--edl <file>", "path to ONE EDL JSON (an `edit plan` result)").requiredOption("--transcript <file>", "path to the transcript JSON WITH speaker labels (transcribe with speaker detection)").option("--speaker-map <file>", "JSON object: speaker label \u2192 EDL source id of their camera").option("--speaker-map-result <file>", "a speaker-map result JSON (the job's output_data.json); a label in --speaker-map wins over it").option("--speaker-names <file>", "JSON object: speaker label \u2192 display name").option("--min-shot-ms <ms>", "shortest shot (default 2500)", (v) => parseInt(v, 10)).option("--lead-ms <ms>", "cut this long before the new speaker (default 200)", (v) => parseInt(v, 10)).option("--lag-ms <ms>", "delay each cut by this long, 0\u20135000 (default 0): --lead-ms's counterpart", (v) => parseInt(v, 10)).option("--max-shot-ms <ms>", "with a wide source: break to it after this long (default 20000)", (v) => parseInt(v, 10)).option("--wide-every <n>", "with a wide source: every N-th cut to the wide (default 0 = off)", (v) => parseInt(v, 10)).option("--layout-hints", "suggest side-by-side / stacked layouts for crosstalk (Apply EDL renders cut-only edits)").option("--watch", "poll the job until it finishes").option("--poll-interval <ms>", "poll interval with --watch", (v) => parseInt(v, 10)).option("--profile <name>").option("--json").action(
8140
8272
  async (opts) => {
8141
8273
  try {
8142
8274
  const client = buildClient(opts.profile);
@@ -8148,6 +8280,7 @@ function editCommand() {
8148
8280
  ...opts.speakerNames ? { speakerNames: readJsonFile2(opts.speakerNames) } : {},
8149
8281
  ...opts.minShotMs !== void 0 ? { minShotMs: opts.minShotMs } : {},
8150
8282
  ...opts.leadMs !== void 0 ? { leadMs: opts.leadMs } : {},
8283
+ ...opts.lagMs !== void 0 ? { lagMs: opts.lagMs } : {},
8151
8284
  ...opts.maxShotMs !== void 0 ? { maxShotMs: opts.maxShotMs } : {},
8152
8285
  ...opts.wideEvery !== void 0 ? { wideEvery: opts.wideEvery } : {},
8153
8286
  ...opts.layoutHints ? { layoutHints: true } : {}