@sogni-ai/sogni-creative-agent-skill 3.66.1 → 3.68.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/sogni-agent.mjs CHANGED
@@ -1593,14 +1593,23 @@ function resolveRtxVsrDimensions(sourceWidth, sourceHeight, { scale = 2, targetL
1593
1593
  };
1594
1594
  }
1595
1595
 
1596
- // Promptless FlashVSR video upscaling (--upscale-video). The server probes the
1596
+ // Promptless FlashVSR and RelayVSR video upscaling (--upscale-video). The server probes the
1597
1597
  // uploaded source and stays authoritative; these public geometry, frame-rate
1598
1598
  // and file-size limits let the CLI explain an unsupported clip before any
1599
1599
  // upload. There is deliberately no frame-count or duration limit here: the
1600
1600
  // server's admission check alone sets the maximum clip length and refuses a
1601
1601
  // source that is too long (see annotateVideoUpscaleError).
1602
1602
  const FLASHVSR_MODEL_ID = 'flashvsr_v1.1_tiny_long_bf16';
1603
+ const RELAYVSR_X2_MODEL_ID = 'relayvsr_x2_lightx2v_int8_convrot';
1604
+ const RELAYVSR_X4_MODEL_ID = 'relayvsr_x4_int8_convrot';
1605
+ const VIDEO_UPSCALE_MODELS = ['flashvsr', 'relayvsr'];
1603
1606
  const VIDEO_UPSCALE_RESOLUTIONS = [1080, 1440];
1607
+ const RELAYVSR_RESOLUTIONS = [1080, 1440, 2160];
1608
+ // Portrait mirrors these. X2's 1088 short edge admits 1920x1088 renders
1609
+ // (two-stage 1080p MiniMax H3, LTX 2.5 1080p).
1610
+ const RELAYVSR_X2_SOURCE = { scale: 2, maxShortEdge: 1088, maxLongEdge: 1920 };
1611
+ const RELAYVSR_X4_SOURCE = { scale: 4, maxShortEdge: 768, maxLongEdge: 1344 };
1612
+ const RELAYVSR_MAX_OUTPUT_LONG_EDGE = 3840;
1604
1613
  const VIDEO_UPSCALE_DEFAULT_RESOLUTION = 1440;
1605
1614
  const VIDEO_UPSCALE_MAX_SOURCE_SHORT_EDGE = 768;
1606
1615
  // Source area counted in 64-pixel blocks: about 1344x768, or 768x1344 in portrait.
@@ -1611,13 +1620,26 @@ const VIDEO_UPSCALE_MAX_BYTES = 100 * 1024 * 1024;
1611
1620
  const VIDEO_UPSCALE_MAX_OUTPUT_LONG_EDGE = 2560;
1612
1621
  const VIDEO_UPSCALE_MAX_OUTPUT_PIXELS = 2560 * 1440;
1613
1622
  const FLASHVSR_UNAVAILABLE_MESSAGE = 'FlashVSR video upscaling is not available yet. Please try again later.';
1623
+ const RELAYVSR_UNAVAILABLE_MESSAGE = 'RelayVSR video upscaling is not available right now. Please try again later.';
1614
1624
 
1615
- function parseVideoUpscaleResolutionValue(raw, flag) {
1625
+ function parseVideoUpscaleResolutionValue(raw, flag, relayVsr = false) {
1616
1626
  const value = Number(String(raw ?? '').trim().toLowerCase().replace(/p$/, ''));
1617
- if (!VIDEO_UPSCALE_RESOLUTIONS.includes(value)) {
1618
- fatalCliError(`${flag} must be 1080 or 1440.`, {
1627
+ const allowed = relayVsr ? RELAYVSR_RESOLUTIONS : VIDEO_UPSCALE_RESOLUTIONS;
1628
+ if (!allowed.includes(value)) {
1629
+ fatalCliError(`${flag} must be ${relayVsr ? '1080, 1440, or 2160' : '1080 or 1440'}.`, {
1619
1630
  code: 'INVALID_ARGUMENT',
1620
- details: { flag, value: raw, allowed: VIDEO_UPSCALE_RESOLUTIONS }
1631
+ details: { flag, value: raw, allowed }
1632
+ });
1633
+ }
1634
+ return value;
1635
+ }
1636
+
1637
+ function parseVideoUpscaleModelValue(raw, flag) {
1638
+ const value = String(raw ?? '').trim().toLowerCase();
1639
+ if (!VIDEO_UPSCALE_MODELS.includes(value)) {
1640
+ fatalCliError(`${flag} must be flashvsr or relayvsr.`, {
1641
+ code: 'INVALID_ARGUMENT',
1642
+ details: { flag, value: raw, allowed: VIDEO_UPSCALE_MODELS }
1621
1643
  });
1622
1644
  }
1623
1645
  return value;
@@ -1673,6 +1695,59 @@ function resolveVideoUpscaleOutput(sourceWidth, sourceHeight, requestedResolutio
1673
1695
  });
1674
1696
  }
1675
1697
 
1698
+ function relayVsrOutputFor(sourceWidth, sourceHeight, resolution) {
1699
+ const shortEdge = Math.min(sourceWidth, sourceHeight);
1700
+ const longEdge = Math.max(sourceWidth, sourceHeight);
1701
+ const ratio = resolution / shortEdge;
1702
+ if (ratio <= 1) {
1703
+ return { problem: `This ${sourceWidth}×${sourceHeight} video is already ${resolution}p or larger.` };
1704
+ }
1705
+ if (ratio > RELAYVSR_X4_SOURCE.scale) {
1706
+ return {
1707
+ problem: `${resolution}p needs a source at least ${Math.ceil(resolution / RELAYVSR_X4_SOURCE.scale)}px on its short edge; this video is ${sourceWidth}×${sourceHeight}.`
1708
+ };
1709
+ }
1710
+ const useX2 = ratio <= RELAYVSR_X2_SOURCE.scale;
1711
+ if (!useX2 && (shortEdge > RELAYVSR_X4_SOURCE.maxShortEdge || longEdge > RELAYVSR_X4_SOURCE.maxLongEdge)) {
1712
+ return {
1713
+ problem: `${resolution}p is more than twice the size of this ${sourceWidth}×${sourceHeight} video; RelayVSR goes past twice the size only for sources up to ${RELAYVSR_X4_SOURCE.maxLongEdge}×${RELAYVSR_X4_SOURCE.maxShortEdge} pixels, or ${RELAYVSR_X4_SOURCE.maxShortEdge}×${RELAYVSR_X4_SOURCE.maxLongEdge} in portrait.`
1714
+ };
1715
+ }
1716
+ const width = Math.round((sourceWidth * ratio) / 2) * 2;
1717
+ const height = Math.round((sourceHeight * ratio) / 2) * 2;
1718
+ if (Math.max(width, height) > RELAYVSR_MAX_OUTPUT_LONG_EDGE) {
1719
+ return {
1720
+ problem: `At ${resolution}p this ${sourceWidth}×${sourceHeight} video would be ${width}×${height}, past the ${RELAYVSR_MAX_OUTPUT_LONG_EDGE}px long-edge upscale output limit.`
1721
+ };
1722
+ }
1723
+ return { modelId: useX2 ? RELAYVSR_X2_MODEL_ID : RELAYVSR_X4_MODEL_ID, resolution, width, height };
1724
+ }
1725
+
1726
+ // X2 when the target is at most twice the source's short edge, otherwise X4.
1727
+ // Without an explicit resolution, 1440p is used when the source allows it and 1080p otherwise.
1728
+ function resolveRelayVsrOutput(sourceWidth, sourceHeight, requestedResolution = null) {
1729
+ if (
1730
+ Math.min(sourceWidth, sourceHeight) > RELAYVSR_X2_SOURCE.maxShortEdge
1731
+ || Math.max(sourceWidth, sourceHeight) > RELAYVSR_X2_SOURCE.maxLongEdge
1732
+ ) {
1733
+ fatalCliError(
1734
+ `This video is ${sourceWidth}×${sourceHeight}; RelayVSR accepts sources up to ${RELAYVSR_X2_SOURCE.maxLongEdge}×${RELAYVSR_X2_SOURCE.maxShortEdge} pixels, or ${RELAYVSR_X2_SOURCE.maxShortEdge}×${RELAYVSR_X2_SOURCE.maxLongEdge} in portrait.`,
1735
+ { code: 'INVALID_UPSCALE_SOURCE', details: { sourceWidth, sourceHeight } }
1736
+ );
1737
+ }
1738
+ const candidates = requestedResolution ? [requestedResolution] : [VIDEO_UPSCALE_DEFAULT_RESOLUTION, 1080];
1739
+ let lastProblem = '';
1740
+ for (const resolution of candidates) {
1741
+ const output = relayVsrOutputFor(sourceWidth, sourceHeight, resolution);
1742
+ if (!output.problem) return output;
1743
+ lastProblem = output.problem;
1744
+ }
1745
+ fatalCliError(lastProblem, {
1746
+ code: 'INVALID_UPSCALE_SIZE',
1747
+ details: { sourceWidth, sourceHeight, requestedResolution }
1748
+ });
1749
+ }
1750
+
1676
1751
  // Read the exact source geometry, frame count, and frame rate with ffprobe so
1677
1752
  // the request matches what the server verifies after upload.
1678
1753
  async function probeVideoUpscaleSource(buffer, sourceLabel) {
@@ -1754,6 +1829,104 @@ async function probeVideoUpscaleSource(buffer, sourceLabel) {
1754
1829
  return { width, height, frames, fps, sizeBytes: buffer.length };
1755
1830
  }
1756
1831
 
1832
+ // RelayVSR only (--upscale-model relayvsr): read the source geometry, frame
1833
+ // count, and frame rate with ffprobe so the request matches what the server
1834
+ // verifies after upload. The server conforms a RelayVSR clip that is off its
1835
+ // average cadence, rotated, or not square-pixel, so its timing is the server's
1836
+ // to settle: `conform` marks those, and the size is the upright picture the
1837
+ // server judges. FlashVSR and --segment-video keep probeVideoUpscaleSource.
1838
+ async function probeConformedVideoUpscaleSource(buffer, sourceLabel) {
1839
+ if (buffer.length > VIDEO_UPSCALE_MAX_BYTES) {
1840
+ fatalCliError('Video upscaling accepts source files up to 100 MB.', {
1841
+ code: 'INVALID_UPSCALE_SOURCE',
1842
+ details: { sizeBytes: buffer.length, maxBytes: VIDEO_UPSCALE_MAX_BYTES }
1843
+ });
1844
+ }
1845
+ const ffprobePath = sanitizePath(getEnv('FFPROBE_PATH') || 'ffprobe', 'FFPROBE_PATH');
1846
+ const tempDir = createTrackedTempDir('sogni-video-upscale-probe-');
1847
+ const inputPath = mediaTempInputPath(tempDir, sourceLabel, '.mp4');
1848
+ let result;
1849
+ try {
1850
+ writeFileSync(inputPath, buffer);
1851
+ result = await runCommand(ffprobePath, [
1852
+ '-v', 'error',
1853
+ '-select_streams', 'v:0',
1854
+ '-count_frames',
1855
+ '-show_frames',
1856
+ '-show_entries',
1857
+ 'stream=width,height,nb_read_frames,avg_frame_rate,r_frame_rate,sample_aspect_ratio,color_transfer:stream_side_data=rotation:frame=best_effort_timestamp_time',
1858
+ '-of', 'json',
1859
+ inputPath,
1860
+ ], { captureOutput: true });
1861
+ } finally {
1862
+ try { if (existsSync(inputPath)) unlinkSync(inputPath); } catch {}
1863
+ try { rmdirSync(tempDir); } catch {}
1864
+ }
1865
+ // A signal means ffprobe started and then crashed on this file; that is
1866
+ // reported with the unreadable-source error below, not as a missing ffprobe.
1867
+ if (result?.error && result.status === null && !result.error.signal) {
1868
+ const err = new Error(`ffprobe is required for --upscale-video, but "${ffprobePath}" could not be started (${result.error.code}).`);
1869
+ err.code = 'MISSING_FFPROBE';
1870
+ err.hint = 'Install ffmpeg/ffprobe (e.g. `brew install ffmpeg` / `apt install ffmpeg`) or set FFPROBE_PATH to a working ffprobe binary. If ffprobe runs in your shell, set FFPROBE_PATH to the full path from `command -v ffprobe`.';
1871
+ err.details = { ffprobePath, reason: result.error.code };
1872
+ throw err;
1873
+ }
1874
+ let probe = null;
1875
+ try {
1876
+ probe = JSON.parse(result?.stdout || '{}');
1877
+ } catch {
1878
+ probe = null;
1879
+ }
1880
+ const stream = probe?.streams?.[0] ?? null;
1881
+ const codedWidth = Number(stream?.width);
1882
+ const codedHeight = Number(stream?.height);
1883
+ const frames = Number(stream?.nb_read_frames);
1884
+ const average = parseFrameRate(stream?.avg_frame_rate);
1885
+ if (result?.status !== 0 || ![codedWidth, codedHeight, frames].every((value) => Number.isSafeInteger(value) && value > 0) || !average) {
1886
+ // -count_frames decodes every frame, so a damaged file can print an error
1887
+ // per frame; keep the tail, where ffprobe names the file-level failure.
1888
+ // ffprobe names the temporary copy, so show the user's source instead.
1889
+ const ffprobeError = [
1890
+ String(result?.stderr || '').split(inputPath).join(sourceLabel).trim().slice(-500),
1891
+ result?.error?.signal ? `ffprobe was stopped by ${result.error.signal}.` : '',
1892
+ ].filter(Boolean).join('\n');
1893
+ fatalCliError('The source video dimensions, frame count, or frame rate could not be read. Use an MP4 or MOV file of 100 MB or less.', {
1894
+ code: 'INVALID_UPSCALE_SOURCE',
1895
+ details: { source: sourceLabel, ...(ffprobeError ? { ffprobeError } : {}) },
1896
+ ...(ffprobeError ? { hint: `ffprobe reported: ${ffprobeError.split('\n').at(-1).trim()}` } : {})
1897
+ });
1898
+ }
1899
+ const times = (probe?.frames ?? [])
1900
+ .map((frame) => Number(frame?.best_effort_timestamp_time))
1901
+ .sort((a, b) => a - b);
1902
+ const onCadence = times.every((time, index) => Math.abs(time - times[0] - index / average) <= 0.001);
1903
+ if (onCadence && (average < VIDEO_UPSCALE_MIN_FPS || average > VIDEO_UPSCALE_MAX_FPS)) {
1904
+ fatalCliError(`This video runs at ${Number(average.toFixed(3))} fps; video upscaling accepts ${VIDEO_UPSCALE_MIN_FPS}-${VIDEO_UPSCALE_MAX_FPS} fps.`, {
1905
+ code: 'INVALID_UPSCALE_SOURCE',
1906
+ details: { fps: average }
1907
+ });
1908
+ }
1909
+ if (['smpte2084', 'arib-std-b67'].includes(stream?.color_transfer ?? '')) {
1910
+ fatalCliError('Convert HDR video to SDR before upscaling.', { code: 'INVALID_UPSCALE_SOURCE' });
1911
+ }
1912
+ const aspect = stream?.sample_aspect_ratio;
1913
+ const square = ['1:1', 'N/A', '0:1', undefined].includes(aspect);
1914
+ const [aspectWidth, aspectHeight] = square ? [1, 1] : aspect.split(':').map(Number);
1915
+ const uprightWidth = square ? codedWidth : Math.round(codedWidth * aspectWidth / aspectHeight / 2) * 2;
1916
+ const rotation = Number(stream?.side_data_list?.find((item) => 'rotation' in item)?.rotation ?? 0);
1917
+ const turned = rotation % 180 !== 0;
1918
+ const conform = !onCadence || rotation % 360 !== 0 || !square;
1919
+ // The server owns the maximum clip length; submit the exact source count.
1920
+ return {
1921
+ width: turned ? codedHeight : uprightWidth,
1922
+ height: turned ? uprightWidth : codedHeight,
1923
+ frames,
1924
+ fps: Math.min(Math.max(average, VIDEO_UPSCALE_MIN_FPS), VIDEO_UPSCALE_MAX_FPS),
1925
+ sizeBytes: buffer.length,
1926
+ ...(conform ? { conform } : {}),
1927
+ };
1928
+ }
1929
+
1757
1930
  // The server's own refusal of a source longer than it accepts. Only the server
1758
1931
  // knows the current maximum, so the CLI relays its sentence rather than
1759
1932
  // restating a limit.
@@ -1765,6 +1938,10 @@ function annotateVideoUpscaleError(error) {
1765
1938
  if (!error.code || error.code === 'PROJECT_ERROR') error.code = 'MODEL_UNAVAILABLE';
1766
1939
  error.hint = 'FlashVSR upscaling workers are not online yet, so nothing was charged. Try again later.';
1767
1940
  }
1941
+ if (error && typeof error === 'object' && message.includes(RELAYVSR_UNAVAILABLE_MESSAGE)) {
1942
+ if (!error.code || error.code === 'PROJECT_ERROR') error.code = 'MODEL_UNAVAILABLE';
1943
+ error.hint = 'No RelayVSR worker is online right now, so nothing was charged. Try again later.';
1944
+ }
1768
1945
  const tooLong = [error?.message, error?.originalError?.message]
1769
1946
  .map((text) => String(text || '').match(VIDEO_UPSCALE_TOO_LONG_PATTERN)?.[0].trim())
1770
1947
  .find(Boolean);
@@ -2884,6 +3061,7 @@ const MINIMAX_H3_MODEL_MODES = new Map([
2884
3061
  ['minimax-h3-fl2va-fp8_i2v_balanced', 'i2v'],
2885
3062
  ['minimax-h3-fl2va-fp8_flf2v_balanced', 'flf2v'],
2886
3063
  ['minimax-h3-ref2va-fp8_r2v_balanced', 'r2v'],
3064
+ ['minimax-h3-prism-int8_r2v', 'r2v'],
2887
3065
  ['minimax-h3-ref2va-fp8_r2v_2stage', 'r2v'],
2888
3066
  ['minimax-h3-ref2va-fp8_r2v_balanced_2stage', 'r2v'],
2889
3067
  ['minimax-h3-fastvideo-omni-int8_r2v_turbo', 'r2v'],
@@ -2969,6 +3147,13 @@ const MINIMAX_H3_TURBO_SAMPLER_SET = new Set(MINIMAX_H3_TURBO_SAMPLERS);
2969
3147
  const MINIMAX_H3_R2V_MODEL_ID = 'minimax-h3-ref2va-fp8_r2v';
2970
3148
  const MINIMAX_H3_R2V_TURBO_MODEL_ID = 'minimax-h3-ref2va-fp8_r2v_turbo';
2971
3149
  const MINIMAX_H3_R2V_BALANCED_MODEL_ID = 'minimax-h3-ref2va-fp8_r2v_balanced';
3150
+ // MiniMax H3 Prism: an optional reference-to-video model for mature themes on
3151
+ // Balanced R2V's graph, with its recipe fixed in the worker (8 Euler steps), so
3152
+ // the CLI sends no steps or sampler, as for Balanced. 768p class only (no
3153
+ // two-stage), Balanced's references, keyframes and LoRAs. It requires
3154
+ // --no-filter and is never a default, a fallback or what a family alias picks.
3155
+ const MINIMAX_H3_R2V_PRISM_MODEL_ID = 'minimax-h3-prism-int8_r2v';
3156
+ const MINIMAX_H3_R2V_PRISM_SELECTOR = 'minimax-h3-r2v-prism';
2972
3157
  // Ref2VA Two-Stage: the Standard (20-step) or Balanced (8-step) R2V request on
2973
3158
  // its own id, rendered on the FastH3 Two-Stage canvas (384, 544 or 768 px short
2974
3159
  // edge) and delivered at exactly twice it. Never Turbo; references, durations
@@ -3210,6 +3395,7 @@ function resolveSkillVideoModelAlias(
3210
3395
  if (normalized === 'minimax-h3-r2v-balanced') {
3211
3396
  return MINIMAX_H3_R2V_BALANCED_MODEL_ID;
3212
3397
  }
3398
+ if (normalized === MINIMAX_H3_R2V_PRISM_SELECTOR) return MINIMAX_H3_R2V_PRISM_MODEL_ID;
3213
3399
  if (normalized === 'minimax-h3-r2v-2stage') return MINIMAX_H3_R2V_TWO_STAGE_MODEL_ID;
3214
3400
  if (normalized === 'minimax-h3-r2v-balanced-2stage') return MINIMAX_H3_R2V_BALANCED_TWO_STAGE_MODEL_ID;
3215
3401
  if (normalized === 'minimax-h3-fasth3-r2v-turbo') return MINIMAX_H3_FASTH3_R2V_MODEL_ID;
@@ -3279,6 +3465,7 @@ function isMiniMaxH3R2vModel(modelId) {
3279
3465
  return normalized === MINIMAX_H3_R2V_MODEL_ID
3280
3466
  || normalized === MINIMAX_H3_R2V_TURBO_MODEL_ID
3281
3467
  || normalized === MINIMAX_H3_R2V_BALANCED_MODEL_ID
3468
+ || normalized === MINIMAX_H3_R2V_PRISM_MODEL_ID
3282
3469
  || normalized === MINIMAX_H3_R2V_TWO_STAGE_MODEL_ID
3283
3470
  || normalized === MINIMAX_H3_R2V_BALANCED_TWO_STAGE_MODEL_ID
3284
3471
  || isMiniMaxH3FastH3R2vModel(normalized);
@@ -3296,6 +3483,12 @@ function miniMaxH3R2vTwoStageSelector(modelId) {
3296
3483
  : 'minimax-h3-r2v-2stage';
3297
3484
  }
3298
3485
 
3486
+ // MiniMax H3 Prism by its selector or worker id: the model that needs --no-filter.
3487
+ function isMiniMaxH3PrismSelectionLocal(modelId) {
3488
+ const normalized = String(modelId || '').trim().toLowerCase();
3489
+ return normalized === MINIMAX_H3_R2V_PRISM_SELECTOR || normalized === MINIMAX_H3_R2V_PRISM_MODEL_ID;
3490
+ }
3491
+
3299
3492
  function isMiniMaxH3R2vTurboSelectionLocal(modelId, workflow = null) {
3300
3493
  const normalized = String(modelId || '').trim().toLowerCase();
3301
3494
  return normalized === 'minimax-h3-r2v-turbo'
@@ -3355,6 +3548,7 @@ function isMiniMaxH3ModelSelectionLocal(modelId) {
3355
3548
  || normalized === 'minimax-h3-i2v-balanced'
3356
3549
  || normalized === 'minimax-h3-flf2v-balanced'
3357
3550
  || normalized === 'minimax-h3-r2v-balanced'
3551
+ || normalized === MINIMAX_H3_R2V_PRISM_SELECTOR
3358
3552
  || normalized === 'minimax-h3-r2v-2stage'
3359
3553
  || normalized === 'minimax-h3-r2v-balanced-2stage'
3360
3554
  || normalized === 'minimax-h3-fasth3-r2v-turbo'
@@ -3401,6 +3595,7 @@ function miniMaxH3ModeFromModelId(modelId) {
3401
3595
  if (normalized === 'minimax-h3-i2v-balanced') return 'i2v';
3402
3596
  if (normalized === 'minimax-h3-flf2v-balanced') return 'flf2v';
3403
3597
  if (normalized === 'minimax-h3-r2v-balanced') return 'r2v';
3598
+ if (normalized === MINIMAX_H3_R2V_PRISM_SELECTOR) return 'r2v';
3404
3599
  if (normalized === 'minimax-h3-r2v-2stage') return 'r2v';
3405
3600
  if (normalized === 'minimax-h3-r2v-balanced-2stage') return 'r2v';
3406
3601
  if (normalized === 'minimax-h3-fasth3-r2v-turbo') return 'r2v';
@@ -3930,8 +4125,9 @@ const options = {
3930
4125
  segmentText: null,
3931
4126
  upscaleScale: 2,
3932
4127
  upscaleTargetLongestEdge: null,
3933
- upscaleVideo: null, // Source video for promptless FlashVSR upscaling
3934
- upscaleResolution: null, // FlashVSR output short edge (1080 | 1440)
4128
+ upscaleVideo: null, // Source video for promptless FlashVSR or RelayVSR upscaling
4129
+ upscaleModel: null, // Video upscaler selector; omitted means FlashVSR
4130
+ upscaleResolution: null, // Upscale output short edge (1080 | 1440, or 2160 on RelayVSR)
3935
4131
  looping: false, // Create looping video (i2v only): generate A→B then B→A and concatenate
3936
4132
  photobooth: false, // Photobooth mode (InstantID face transfer)
3937
4133
  cnStrength: null, // ControlNet strength override
@@ -4130,6 +4326,7 @@ const cliSet = {
4130
4326
  upscaleScale: false,
4131
4327
  upscaleTargetLongestEdge: false,
4132
4328
  upscaleVideo: false,
4329
+ upscaleModel: false,
4133
4330
  upscaleResolution: false,
4134
4331
  looping: false,
4135
4332
  photobooth: false,
@@ -4634,8 +4831,18 @@ for (let i = 0; i < args.length; i++) {
4634
4831
  } else if (arg === '--upscale-resolution') {
4635
4832
  const raw = requireFlagValue(args, i, arg);
4636
4833
  i++;
4637
- options.upscaleResolution = parseVideoUpscaleResolutionValue(raw, arg);
4834
+ const upscaleModelFlag = args.lastIndexOf('--upscale-model');
4835
+ options.upscaleResolution = parseVideoUpscaleResolutionValue(
4836
+ raw,
4837
+ arg,
4838
+ upscaleModelFlag !== -1 && String(args[upscaleModelFlag + 1]).trim().toLowerCase() === 'relayvsr'
4839
+ );
4638
4840
  cliSet.upscaleResolution = true;
4841
+ } else if (arg === '--upscale-model') {
4842
+ const raw = requireFlagValue(args, i, arg);
4843
+ i++;
4844
+ options.upscaleModel = parseVideoUpscaleModelValue(raw, arg);
4845
+ cliSet.upscaleModel = true;
4639
4846
  } else if (arg === '--photobooth') {
4640
4847
  options.photobooth = true;
4641
4848
  cliSet.photobooth = true;
@@ -5338,7 +5545,8 @@ Image Options:
5338
5545
  --segment-frame <index> Zero-based frame the selection refers to (default: 0)
5339
5546
  --segment-object <index> Candidate in confidence order (default: 0)
5340
5547
  --upscale-video <path|url> Promptless FlashVSR upscale of one video to 1080p/1440p (keeps frames, fps, audio)
5341
- --upscale-resolution <p> Output short edge for --upscale-video: 1080 or 1440 (default: 1440; 1080 below 720p)
5548
+ --upscale-model <m> Upscaler for --upscale-video: flashvsr (default) or relayvsr (reaches 2160p)
5549
+ --upscale-resolution <p> Output short edge for --upscale-video: 1080 or 1440, or 2160 with relayvsr (default: 1440; 1080 below 720p)
5342
5550
 
5343
5551
  Photobooth (Face Transfer):
5344
5552
  --photobooth Face transfer mode (InstantID + SDXL Turbo)
@@ -5715,6 +5923,8 @@ state negatives in the structured prompt.):
5715
5923
  minimax-h3-i2v-balanced Balanced I2VA (--ref) or L2VA (--ref-end)
5716
5924
  minimax-h3-flf2v-balanced Balanced first-frame -> last-frame (--ref plus --ref-end)
5717
5925
  minimax-h3-r2v-balanced Balanced Ref2VA with loose image/video/audio references
5926
+ minimax-h3-r2v-prism Optional Ref2VA model for mature themes on Balanced's graph: 768p class,
5927
+ Balanced's references, keyframes and LoRAs; requires --no-filter
5718
5928
  minimax-h3-r2v-2stage Ref2VA Two-Stage: the minimax-h3-r2v request (20 steps), delivered at twice the
5719
5929
  canvas, 2K by default (1344x768 -> 2688x1536); --target-resolution 1080 or 720
5720
5930
  minimax-h3-r2v-balanced-2stage Balanced Ref2VA Two-Stage: the minimax-h3-r2v-balanced request (8 steps),
@@ -6221,6 +6431,12 @@ if (options.video) {
6221
6431
  { code: 'INVALID_ARGUMENT' }
6222
6432
  );
6223
6433
  }
6434
+ if (isMiniMaxH3PrismSelectionLocal(options.model) && !options.noFilter) {
6435
+ fatalCliError(
6436
+ 'MiniMax H3 Prism is an opt-in mature-theme model and requires --no-filter.',
6437
+ { code: 'INVALID_ARGUMENT' }
6438
+ );
6439
+ }
6224
6440
  }
6225
6441
 
6226
6442
  if (options.loraStrengths.length > 0 && options.loras.length === 0) {
@@ -6707,6 +6923,15 @@ if (options.music) {
6707
6923
  options.model = LTX23_WORKFLOW_MODELS[options.videoWorkflow];
6708
6924
  }
6709
6925
  options.model = resolveVideoModelAlias(options.model, options.videoWorkflow);
6926
+ // A configured default (OpenClaw videoModels) reaches here without the -m
6927
+ // check above, so Prism's --no-filter requirement is checked again.
6928
+ if (isMiniMaxH3PrismSelectionLocal(options.model) && !options.noFilter) {
6929
+ fatalCliError('MiniMax H3 Prism requires explicit --no-filter acknowledgement.', {
6930
+ code: 'INVALID_ARGUMENT',
6931
+ details: { model: options.model, requiredFlag: '--no-filter' },
6932
+ hint: 'Retry with --video -m minimax-h3-r2v-prism --ref <image> --no-filter'
6933
+ });
6934
+ }
6710
6935
  try {
6711
6936
  await loadLiveModelDefaults(options.model);
6712
6937
  } catch (error) {
@@ -6844,13 +7069,24 @@ if (options.music) {
6844
7069
  options.timeout = 1800000; // 30 min for queued and long-running video jobs
6845
7070
  }
6846
7071
  } else if (options.upscaleVideo) {
6847
- if (options.model && options.model !== FLASHVSR_MODEL_ID) {
6848
- fatalCliError(`--upscale-video requires model ${FLASHVSR_MODEL_ID}.`, {
6849
- code: 'INVALID_ARGUMENT',
6850
- details: { model: options.model, requiredModel: FLASHVSR_MODEL_ID }
6851
- });
7072
+ if (options.upscaleModel === 'relayvsr') {
7073
+ if (options.model) {
7074
+ fatalCliError('--upscale-model relayvsr picks its own model from the source; omit -m/--model.', {
7075
+ code: 'INVALID_ARGUMENT',
7076
+ details: { model: options.model }
7077
+ });
7078
+ }
7079
+ // Replaced by the X2 or X4 id once the source has been probed.
7080
+ options.model = RELAYVSR_X2_MODEL_ID;
7081
+ } else {
7082
+ if (options.model && options.model !== FLASHVSR_MODEL_ID) {
7083
+ fatalCliError(`--upscale-video requires model ${FLASHVSR_MODEL_ID}.`, {
7084
+ code: 'INVALID_ARGUMENT',
7085
+ details: { model: options.model, requiredModel: FLASHVSR_MODEL_ID }
7086
+ });
7087
+ }
7088
+ options.model = FLASHVSR_MODEL_ID;
6852
7089
  }
6853
- options.model = FLASHVSR_MODEL_ID;
6854
7090
  if (!cliSet.timeout && !timeoutFromConfig && options.timeout === 30000) {
6855
7091
  options.timeout = 1800000; // 30 min for queued video work
6856
7092
  }
@@ -7223,6 +7459,12 @@ if (!options.upscaleVideo && cliSet.upscaleResolution) {
7223
7459
  });
7224
7460
  }
7225
7461
 
7462
+ if (!options.upscaleVideo && cliSet.upscaleModel) {
7463
+ fatalCliError('--upscale-model requires --upscale-video <path|url>.', {
7464
+ code: 'INVALID_ARGUMENT'
7465
+ });
7466
+ }
7467
+
7226
7468
  if (options.legacyWan3TaskType !== null) {
7227
7469
  fatalCliError(
7228
7470
  '--wan3-task-type has been removed because Wan 3 has no provider edit/extend task mode. Use --workflow r2v with --ref-video for loose conditioning, or select a video-to-video model for editing.',
@@ -16149,10 +16391,16 @@ async function main() {
16149
16391
  const result = trackProjectResult(await client.createVideoProject(withBillingMode(config)));
16150
16392
  if (result?.error || result?.message) throw buildProjectResultError(result);
16151
16393
  } else if (options.upscaleVideo) {
16152
- log(`Upscaling video with ${FLASHVSR_MODEL_ID}...`);
16394
+ const relayVsr = options.upscaleModel === 'relayvsr';
16395
+ log(`Upscaling video with ${relayVsr ? 'RelayVSR' : FLASHVSR_MODEL_ID}...`);
16153
16396
  const sourceBuffer = await fetchMediaBuffer(options.upscaleVideo);
16154
- const source = await probeVideoUpscaleSource(sourceBuffer, options.upscaleVideo);
16155
- const target = resolveVideoUpscaleOutput(source.width, source.height, options.upscaleResolution);
16397
+ const source = relayVsr
16398
+ ? await probeConformedVideoUpscaleSource(sourceBuffer, options.upscaleVideo)
16399
+ : await probeVideoUpscaleSource(sourceBuffer, options.upscaleVideo);
16400
+ const target = relayVsr
16401
+ ? resolveRelayVsrOutput(source.width, source.height, options.upscaleResolution)
16402
+ : resolveVideoUpscaleOutput(source.width, source.height, options.upscaleResolution);
16403
+ if (relayVsr) options.model = target.modelId;
16156
16404
  options.width = target.width;
16157
16405
  options.height = target.height;
16158
16406
  options.frames = source.frames;
@@ -16164,17 +16412,16 @@ async function main() {
16164
16412
  `output ${target.width}x${target.height} (${target.resolution}p), every frame and the audio kept.`
16165
16413
  );
16166
16414
 
16167
- // The exact frame count and rate satisfy the SDK's FlashVSR validation;
16168
- // the server re-probes the upload and adopts its verified size, so the
16169
- // output width/height are not sent.
16415
+ // The server re-probes the upload and adopts its verified size, so the
16416
+ // output width/height are not sent; a conformed source's timing is left
16417
+ // to it too, since anything sent that differs refuses the project.
16170
16418
  const upscaleVideoConfig = {
16171
- modelId: FLASHVSR_MODEL_ID,
16419
+ modelId: options.model,
16172
16420
  positivePrompt: '',
16173
16421
  numberOfMedia: 1,
16174
16422
  referenceVideo: sourceBuffer,
16175
16423
  upscaleResolution: target.resolution,
16176
- frames: source.frames,
16177
- fps: source.fps,
16424
+ ...(source.conform ? {} : { frames: source.frames, fps: source.fps }),
16178
16425
  tokenType: options.tokenType || 'spark',
16179
16426
  waitForCompletion: false,
16180
16427
  autoResizeVideoAssets: false
package/version.mjs CHANGED
@@ -1 +1 @@
1
- export const PACKAGE_VERSION = '3.66.1';
1
+ export const PACKAGE_VERSION = '3.68.0';