@nodaro/cli 1.46.0 → 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
@@ -42,7 +42,7 @@ var require_package = __commonJS({
42
42
  "package.json"(exports$1, module) {
43
43
  module.exports = {
44
44
  name: "@nodaro/cli",
45
- version: "1.46.0",
45
+ version: "1.47.0",
46
46
  description: "Command-line interface for Nodaro \u2014 list and run workflows, inspect jobs and executions, manage projects from the terminal.",
47
47
  type: "module",
48
48
  license: "Apache-2.0",
@@ -83,11 +83,11 @@ var require_package = __commonJS({
83
83
  "@inquirer/confirm": "^6.0.12",
84
84
  "@inquirer/input": "^5.0.12",
85
85
  "@inquirer/select": "^5.1.4",
86
- "@nodaro/sdk": "^2.66.0",
87
- "@nodaro/shared": "^3.56.0",
86
+ "@nodaro/sdk": "^2.67.0",
87
+ "@nodaro/shared": "^3.59.0",
88
88
  commander: "^12.1.0",
89
89
  picocolors: "^1.1.1",
90
- "@nodaro/prompts": "^1.51.0"
90
+ "@nodaro/prompts": "^1.53.1"
91
91
  },
92
92
  devDependencies: {
93
93
  tsup: "^8.5.0",
@@ -414,7 +414,7 @@ function saveWorkspace(profileName, workspaceId) {
414
414
  }
415
415
 
416
416
  // src/client.ts
417
- var CLI_VERSION = "1.46.0" ;
417
+ var CLI_VERSION = "1.47.0" ;
418
418
  function buildPublicClient(opts = {}) {
419
419
  const { profile } = getProfile(opts.profile);
420
420
  return createClient({
@@ -7555,11 +7555,37 @@ function refuseUnknownPlanTier(planTier) {
7555
7555
  }
7556
7556
  }
7557
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
+
7558
7584
  // src/commands/edit-recordings.ts
7559
7585
  function withRecordingsOptions(cmd) {
7560
7586
  return cmd.requiredOption(
7561
7587
  "--media <url>",
7562
- "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)",
7563
7589
  collectVariadic
7564
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(
7565
7591
  "--speaker-camera <speaker=recording>",
@@ -7612,6 +7638,7 @@ function recordingsInput(opts) {
7612
7638
 
7613
7639
  // src/commands/edit-use-case.ts
7614
7640
  var EMPHASIS_HELP = `none, or ${SPEAKER_EMPHASIS_STYLES.filter((s) => s !== "none").join(", ")} joined with "+" (each once)`;
7641
+ var TEXT_MAX = 4e3;
7615
7642
  var CONTINUATION_NEXT_STEP = {
7616
7643
  already_running: (id) => ` \u2014 follow it: nodaro jobs get ${id}`,
7617
7644
  continuation_superseded: (id) => ` \u2014 continue that one: nodaro edit continue-use-case ${id} --mode from-failed`,
@@ -7625,7 +7652,7 @@ function registerUseCaseCommands(cmd) {
7625
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(
7626
7653
  "--framing-source <source>",
7627
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)`
7628
- ).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(
7629
7656
  async (opts, command) => {
7630
7657
  if (opts.output !== void 0 && opts.output !== "video" && opts.output !== "audio") {
7631
7658
  warn(`--output must be "video" or "audio" (got "${opts.output}")`);
@@ -7652,21 +7679,47 @@ function registerUseCaseCommands(cmd) {
7652
7679
  warn(`--framing-source must be ${FRAMING_SOURCES.join(", ")} (got "${opts.framingSource}")`);
7653
7680
  process.exit(1);
7654
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
+ }
7655
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
+ };
7656
7719
  try {
7657
7720
  const client = buildClient(opts.profile);
7658
- const result = await client.edit.tightenEpisode({
7659
- ...recordings,
7660
- ...opts.music ? { musicUrl: opts.music } : {},
7661
- ...opts.output ? { output: opts.output } : {},
7662
- ...opts.framing ? { framing: { aspect: opts.framing, layout: opts.layout ?? "auto" } } : {},
7663
- ...opts.framingSource ? { framingSource: opts.framingSource } : {},
7664
- // commander's --no-captions defaults `captions` to true: send it only when turned off.
7665
- ...opts.captions === false ? { captions: false } : {},
7666
- ...opts.review ? { reviewBeforeRender: true } : {},
7667
- ...opts.planTier ? { planTier: opts.planTier } : {},
7668
- ...opts.instructions ? { instructions: opts.instructions } : {}
7669
- });
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);
7670
7723
  await reportQueuedJob(result, () => client.jobs.getStatus(result.jobId), {
7671
7724
  json: opts.json,
7672
7725
  watch: opts.watch,
@@ -7678,20 +7731,19 @@ function registerUseCaseCommands(cmd) {
7678
7731
  }
7679
7732
  }
7680
7733
  );
7681
- 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(
7682
7735
  async (opts, command) => {
7683
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
+ };
7684
7743
  try {
7685
7744
  const client = buildClient(opts.profile);
7686
- const result = await client.edit.episodeChapters(
7687
- {
7688
- mediaUrl: opts.media,
7689
- ...opts.planTier ? { planTier: opts.planTier } : {},
7690
- ...opts.instructions ? { instructions: opts.instructions } : {},
7691
- ...opts.styleGuide ? { styleGuide: opts.styleGuide } : {}
7692
- },
7693
- opts.idempotencyKey ? { idempotencyKey: opts.idempotencyKey } : void 0
7694
- );
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);
7695
7747
  const done = await reportQueuedJob(result, () => client.jobs.getStatus(result.jobId), {
7696
7748
  json: opts.json,
7697
7749
  watch: opts.watch,
@@ -7707,7 +7759,7 @@ function registerUseCaseCommands(cmd) {
7707
7759
  );
7708
7760
  withRecordingsOptions(
7709
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")
7710
- ).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(
7711
7763
  async (opts) => {
7712
7764
  const formats = opts.formats?.split(",").map((f) => f.trim()).filter((f) => f.length > 0);
7713
7765
  if (formats !== void 0 && (formats.length === 0 || formats.some((f) => !TRAILER_FORMATS.includes(f)))) {
@@ -7716,20 +7768,19 @@ function registerUseCaseCommands(cmd) {
7716
7768
  }
7717
7769
  refuseUnknownPlanTier(opts.planTier);
7718
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
+ };
7719
7780
  try {
7720
7781
  const client = buildClient(opts.profile);
7721
- const result = await client.edit.episodeTrailer(
7722
- {
7723
- ...recordings,
7724
- ...opts.introCard ? { introCardUrl: opts.introCard } : {},
7725
- ...formats ? { formats } : {},
7726
- ...opts.review ? { reviewBeforeRender: true } : {},
7727
- ...opts.planTier ? { planTier: opts.planTier } : {},
7728
- ...opts.instructions ? { instructions: opts.instructions } : {},
7729
- ...opts.styleGuide ? { styleGuide: opts.styleGuide } : {}
7730
- },
7731
- opts.idempotencyKey ? { idempotencyKey: opts.idempotencyKey } : void 0
7732
- );
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);
7733
7784
  const done = await reportQueuedJob(result, () => client.jobs.getStatus(result.jobId), {
7734
7785
  json: opts.json,
7735
7786
  watch: opts.watch,
@@ -7757,7 +7808,7 @@ function registerUseCaseCommands(cmd) {
7757
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(
7758
7809
  "--framing-source <source>",
7759
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)`
7760
- ).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(
7761
7812
  async (opts) => {
7762
7813
  if (opts.count !== void 0 && !isWhole(opts.count, 1, EDIT_PLAN_MAX_CLIP_COUNT)) {
7763
7814
  warn(`--count must be 1\u2013${EDIT_PLAN_MAX_CLIP_COUNT} (got "${opts.count}")`);
@@ -7811,33 +7862,32 @@ function registerUseCaseCommands(cmd) {
7811
7862
  }
7812
7863
  refuseUnknownPlanTier(opts.planTier);
7813
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
+ };
7814
7887
  try {
7815
7888
  const client = buildClient(opts.profile);
7816
- const result = await client.edit.clipPack(
7817
- {
7818
- ...recordings,
7819
- ...opts.count !== void 0 ? { count: Number(opts.count) } : {},
7820
- ...opts.length !== void 0 ? { targetDurationSec: Number(opts.length) } : {},
7821
- // none = the recording's shape; an aspect alone leaves the layout to the route (stacked).
7822
- ...opts.framing === "none" ? { framing: null } : opts.framing ? {
7823
- framing: {
7824
- aspect: opts.framing,
7825
- ...opts.layout ? { layout: opts.layout } : {},
7826
- ...opts.switch ? { switchType: opts.switch } : {},
7827
- ...opts.emphasis ? { emphasisStyle: opts.emphasis } : {}
7828
- }
7829
- } : {},
7830
- ...opts.framingSource ? { framingSource: opts.framingSource } : {},
7831
- // commander's --no-captions defaults `captions` to true: send it only when turned off.
7832
- ...opts.captions === false ? { captions: false } : {},
7833
- ...opts.captionStyle ? { captionStyle: opts.captionStyle } : {},
7834
- ...opts.review ? { reviewBeforeRender: true } : {},
7835
- ...opts.planTier ? { planTier: opts.planTier } : {},
7836
- ...opts.instructions ? { instructions: opts.instructions } : {},
7837
- ...opts.styleGuide ? { styleGuide: opts.styleGuide } : {}
7838
- },
7839
- opts.idempotencyKey ? { idempotencyKey: opts.idempotencyKey } : void 0
7840
- );
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);
7841
7891
  const done = await reportQueuedJob(result, () => client.jobs.getStatus(result.jobId), {
7842
7892
  json: opts.json,
7843
7893
  watch: opts.watch,
@@ -7868,7 +7918,7 @@ function registerUseCaseCommands(cmd) {
7868
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(
7869
7919
  "--framing-source <source>",
7870
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)`
7871
- ).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(
7872
7922
  async (opts) => {
7873
7923
  if (opts.aspect !== void 0 && !EDL_TARGET_ASPECTS.includes(opts.aspect)) {
7874
7924
  warn(`--aspect must be ${EDL_TARGET_ASPECTS.join(", ")} (got "${opts.aspect}")`);
@@ -7891,20 +7941,19 @@ function registerUseCaseCommands(cmd) {
7891
7941
  process.exit(1);
7892
7942
  }
7893
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
+ };
7894
7953
  try {
7895
7954
  const client = buildClient(opts.profile);
7896
- const result = await client.edit.speakerLayout(
7897
- {
7898
- ...recordings,
7899
- ...opts.aspect ? { targetAspect: opts.aspect } : {},
7900
- ...opts.layout ? { layout: opts.layout } : {},
7901
- ...opts.switch ? { switchType: opts.switch } : {},
7902
- ...opts.emphasis ? { emphasisStyle: opts.emphasis } : {},
7903
- ...opts.framingSource ? { framingSource: opts.framingSource } : {},
7904
- ...opts.review ? { reviewBeforeRender: true } : {}
7905
- },
7906
- opts.idempotencyKey ? { idempotencyKey: opts.idempotencyKey } : void 0
7907
- );
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);
7908
7957
  const done = await reportQueuedJob(result, () => client.jobs.getStatus(result.jobId), {
7909
7958
  json: opts.json,
7910
7959
  watch: opts.watch,
@@ -7981,6 +8030,11 @@ function registerUseCaseCommands(cmd) {
7981
8030
  }
7982
8031
 
7983
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
+ };
7984
8038
  function isEditPlanMode(v) {
7985
8039
  return EDIT_PLAN_MODES.includes(v);
7986
8040
  }
@@ -8068,11 +8122,11 @@ function editCommand() {
8068
8122
  "--source <[id=]url>",
8069
8123
  "a camera (or the master / wide) as url or id=url (repeatable, 2-6); ids are minted as source-N when omitted",
8070
8124
  collectVariadic
8071
- ).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(
8072
8126
  async (opts) => {
8073
8127
  const sources = opts.sourcesFile ? readJsonFile2(opts.sourcesFile) : (opts.source ?? []).map(parseAudioSyncSource);
8074
8128
  if (!Array.isArray(sources) || sources.length < 2 || sources.length > 6) {
8075
- 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)");
8076
8130
  process.exit(1);
8077
8131
  }
8078
8132
  try {
@@ -8133,7 +8187,7 @@ function editCommand() {
8133
8187
  }
8134
8188
  );
8135
8189
  registerUseCaseCommands(cmd);
8136
- 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(
8137
8191
  "--source <url>",
8138
8192
  "a media source as [id=]url[@audio|@video] (repeatable); id defaults to source-N, kind to video",
8139
8193
  collectVariadic
@@ -8198,7 +8252,23 @@ function editCommand() {
8198
8252
  }
8199
8253
  }
8200
8254
  );
8201
- 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(
8202
8272
  async (opts) => {
8203
8273
  try {
8204
8274
  const client = buildClient(opts.profile);
@@ -8210,6 +8280,7 @@ function editCommand() {
8210
8280
  ...opts.speakerNames ? { speakerNames: readJsonFile2(opts.speakerNames) } : {},
8211
8281
  ...opts.minShotMs !== void 0 ? { minShotMs: opts.minShotMs } : {},
8212
8282
  ...opts.leadMs !== void 0 ? { leadMs: opts.leadMs } : {},
8283
+ ...opts.lagMs !== void 0 ? { lagMs: opts.lagMs } : {},
8213
8284
  ...opts.maxShotMs !== void 0 ? { maxShotMs: opts.maxShotMs } : {},
8214
8285
  ...opts.wideEvery !== void 0 ? { wideEvery: opts.wideEvery } : {},
8215
8286
  ...opts.layoutHints ? { layoutHints: true } : {}