@sogni-ai/sogni-creative-agent-skill 3.33.0 → 3.34.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
@@ -95,9 +95,9 @@ import {
95
95
  import {
96
96
  HAPPYHORSE_REFERENCE_LIMITS,
97
97
  HappyHorseReferenceLimitError,
98
- SEEDANCE_REFERENCE_LIMITS,
99
98
  SeedanceReferenceLimitError,
100
99
  getHappyHorseReferenceLimits,
100
+ getSeedanceReferenceLimits,
101
101
  happyhorseTerminalGenerationFailurePayloadFromError,
102
102
  happyhorseTerminalPolicyPayloadFromError,
103
103
  seedanceTerminalGenerationFailurePayloadFromError,
@@ -1571,16 +1571,13 @@ const VIDEO_REF_PRERESIZE_MAX_ASPECT_DRIFT = 0.02;
1571
1571
  const MINIMAX_H3_MAX_VIDEO_PIXELS = 1_032_192;
1572
1572
 
1573
1573
  function isWanVideoModelId(modelId) {
1574
- return typeof modelId === 'string' && modelId.startsWith('wan_');
1574
+ return getSharedModelDefaults(modelId)?.family === 'wan22';
1575
1575
  }
1576
1576
 
1577
1577
  function isWanAnimateVideoModelId(modelId) {
1578
- return typeof modelId === 'string' && (
1579
- modelId.includes('_animate-move') ||
1580
- modelId.includes('_animate-replace') ||
1581
- modelId.includes('_animate_move') ||
1582
- modelId.includes('_animate_replace')
1583
- );
1578
+ if (!isWanVideoModelId(modelId)) return false;
1579
+ const workflow = inferVideoWorkflowFromModel(modelId);
1580
+ return workflow === 'animate-move' || workflow === 'animate-replace';
1584
1581
  }
1585
1582
 
1586
1583
  function isGptImage2ModelSelection(modelId) {
@@ -1588,6 +1585,37 @@ function isGptImage2ModelSelection(modelId) {
1588
1585
  return ['gpt-image-2', 'gptimage2', 'gpt-image', 'gpt_image_2'].includes(normalized);
1589
1586
  }
1590
1587
 
1588
+ const SEEDANCE_TASK_TYPES = new Set(['reference', 'edit', 'extend']);
1589
+ const QWEN_IMAGE_EDIT_2511_MODEL_IDS = new Set([
1590
+ 'qwen_image_edit_2511_fp8',
1591
+ 'qwen_image_edit_2511_fp8_lightning',
1592
+ ]);
1593
+ const LIGHTNING_IMAGE_MODEL_IDS = new Set([
1594
+ 'qwen_image_edit_2511_fp8_lightning',
1595
+ 'qwen_image_2512_fp8_lightning',
1596
+ ]);
1597
+
1598
+ function isQwenImageEdit2511ModelSelection(modelId) {
1599
+ return QWEN_IMAGE_EDIT_2511_MODEL_IDS.has(String(modelId || '').trim().toLowerCase());
1600
+ }
1601
+
1602
+ function isLightningImageModelSelection(modelId) {
1603
+ return LIGHTNING_IMAGE_MODEL_IDS.has(String(modelId || '').trim().toLowerCase());
1604
+ }
1605
+
1606
+ const SEEDANCE_25_MODEL_SELECTIONS = new Set([
1607
+ 'seedance-2-5',
1608
+ 'seedance2-5',
1609
+ 'seedance2-5-t2v',
1610
+ 'seedance2-5-ia2v',
1611
+ 'seedance2-5-v2v',
1612
+ ]);
1613
+
1614
+ function isSeedance25ModelSelectionLocal(modelId) {
1615
+ const normalized = String(modelId || '').trim().toLowerCase().replace(/_/g, '-');
1616
+ return SEEDANCE_25_MODEL_SELECTIONS.has(normalized);
1617
+ }
1618
+
1591
1619
  function normalizeMusicModelId(value) {
1592
1620
  const raw = String(value || '').trim();
1593
1621
  if (!raw) return null;
@@ -1688,6 +1716,7 @@ function getMaxContextImages(modelId) {
1688
1716
 
1689
1717
  function videoDurationLimitsLikeWrapper(modelId) {
1690
1718
  if (isMiniMaxH3Model(modelId)) return { ...MINIMAX_H3_DURATION_LIMITS };
1719
+ if (isSeedance25ModelSelectionLocal(modelId)) return { min: 4, max: 30 };
1691
1720
  if (isSeedanceModel(modelId)) return { min: 4, max: 15 };
1692
1721
  if (isHappyHorseModel(modelId)) return { min: 3, max: 15 };
1693
1722
  if (isLtxFamilyModel(modelId) || isWanAnimateVideoModelId(modelId)) return { min: 1, max: 20 };
@@ -2111,7 +2140,12 @@ const DR34ML4Y_SUPPORTED_MODEL_IDS = new Set([
2111
2140
  LTX23_10EROS_MODEL_ID
2112
2141
  ]);
2113
2142
 
2114
- function resolveSkillVideoModelAlias(modelId, workflow = null, hasEndFrame = false) {
2143
+ function resolveSkillVideoModelAlias(
2144
+ modelId,
2145
+ workflow = null,
2146
+ hasStartFrame = false,
2147
+ hasEndFrame = false,
2148
+ ) {
2115
2149
  const normalized = String(modelId || '').trim().toLowerCase();
2116
2150
  if (normalized === 'ltx25' || normalized === 'ltx25-t2v') {
2117
2151
  const mode = ['i2v', 'a2v', 'ia2v', 'v2v'].includes(workflow) ? workflow : 't2v';
@@ -2124,7 +2158,9 @@ function resolveSkillVideoModelAlias(modelId, workflow = null, hasEndFrame = fal
2124
2158
  if (normalized === 'minimax-h3' && workflow) {
2125
2159
  if (workflow === 'r2v') return MINIMAX_H3_R2V_MODEL_ID;
2126
2160
  if (workflow === 'i2v') {
2127
- return hasEndFrame ? 'minimax-h3-fl2va-fp8_flf2v' : 'minimax-h3-fl2va-fp8_i2v';
2161
+ return hasStartFrame && hasEndFrame
2162
+ ? 'minimax-h3-fl2va-fp8_flf2v'
2163
+ : 'minimax-h3-fl2va-fp8_i2v';
2128
2164
  }
2129
2165
  return 'minimax-h3-fl2va-fp8_t2v';
2130
2166
  }
@@ -2140,7 +2176,7 @@ function resolveSkillVideoModelAlias(modelId, workflow = null, hasEndFrame = fal
2140
2176
  return MINIMAX_H3_R2V_TURBO_MODEL_ID;
2141
2177
  }
2142
2178
  if (workflow === 'i2v') {
2143
- return hasEndFrame
2179
+ return hasStartFrame && hasEndFrame
2144
2180
  ? 'minimax-h3-fl2va-fp8_flf2v_turbo'
2145
2181
  : 'minimax-h3-fl2va-fp8_i2v_turbo';
2146
2182
  }
@@ -2263,19 +2299,19 @@ function parseOutpaintAspectRatio(value) {
2263
2299
  }
2264
2300
 
2265
2301
  function isLtxV2VModelId(modelId) {
2266
- return !!modelId && (modelId.includes('ltx23') || modelId.includes('ltx25')) && /_v2v(_|$)/.test(modelId);
2302
+ return isLtxFamilyModel(modelId) && inferVideoWorkflowFromModel(modelId) === 'v2v';
2267
2303
  }
2268
2304
 
2269
2305
  function isLtx23ModelId(modelId) {
2270
- return String(modelId || '').trim().toLowerCase().startsWith('ltx23-');
2306
+ return getSharedModelDefaults(modelId)?.family === 'ltx23';
2271
2307
  }
2272
2308
 
2273
2309
  function isLtx25ModelId(modelId) {
2274
- return String(modelId || '').trim().toLowerCase().startsWith('ltx25-');
2310
+ return getSharedModelDefaults(modelId)?.family === 'ltx25';
2275
2311
  }
2276
2312
 
2277
2313
  function isLtxFamilyModel(modelId) {
2278
- return isLtx2Model(modelId) || isLtx25ModelId(modelId);
2314
+ return isLtx2Model(modelId);
2279
2315
  }
2280
2316
 
2281
2317
  function ltx25WorkflowFromModelSelection(modelId) {
@@ -2482,6 +2518,7 @@ const options = {
2482
2518
  musicShift: null,
2483
2519
  video: false,
2484
2520
  videoWorkflow: null,
2521
+ seedanceTaskType: null,
2485
2522
  fps: 16,
2486
2523
  duration: 5,
2487
2524
  frames: null,
@@ -2661,6 +2698,7 @@ const cliSet = {
2661
2698
  musicShift: false,
2662
2699
  video: false,
2663
2700
  workflow: false,
2701
+ seedanceTaskType: false,
2664
2702
  fps: false,
2665
2703
  duration: false,
2666
2704
  frames: false,
@@ -2944,6 +2982,11 @@ for (let i = 0; i < args.length; i++) {
2944
2982
  i++;
2945
2983
  options.videoWorkflow = raw;
2946
2984
  cliSet.workflow = true;
2985
+ } else if (arg === '--seedance-task-type') {
2986
+ const raw = requireFlagValue(args, i, arg);
2987
+ i++;
2988
+ options.seedanceTaskType = raw.trim().toLowerCase();
2989
+ cliSet.seedanceTaskType = true;
2947
2990
  } else if (arg === '--fps') {
2948
2991
  const raw = requireFlagValue(args, i, arg);
2949
2992
  i++;
@@ -3696,17 +3739,18 @@ Music Options:
3696
3739
  Video Options:
3697
3740
  --video, -v Generate video instead of image
3698
3741
  --workflow <type> Video workflow: t2v|i2v|r2v|s2v|ia2v|a2v|v2v|animate-move|animate-replace
3742
+ --seedance-task-type <type> Seedance 2.5 loose-reference operation: reference|edit|extend
3699
3743
  --fps <num> Frames per second (model default unless set)
3700
- --duration <sec> Duration in seconds (default: 5)
3744
+ --duration <sec> Duration in seconds (default: 5); Seedance 2.5 edit requires @Video1's source duration
3701
3745
  --frames <num> Override total frames (optional)
3702
- --target-resolution <px> Short-side target that preserves aspect ratio
3746
+ --target-resolution <px> Short-side target that preserves aspect ratio (Seedance 2.5: 480 or 720)
3703
3747
  --auto-resize-assets Auto-resize video reference assets (default)
3704
3748
  --no-auto-resize-assets Disable auto-resize for video assets
3705
3749
  --estimate-video-cost Estimate video cost and exit
3706
3750
  --ref <path|url> Reference image for video (start frame; Picture 1 on H3 r2v)
3707
3751
  --ref-end <path|url> End frame for interpolation/morphing; with --ref it
3708
3752
  defaults to the LTX-2.5 i2v first/last-frame workflow
3709
- (last frame on Seedance)
3753
+ (last frame on Seedance; L2VA endpoint on MiniMax H3 i2v)
3710
3754
  --ref-audio <path|url> Audio reference. Repeatable on Seedance and H3 r2v (up to 3 total);
3711
3755
  first entry is the primary, extras must be HTTPS URLs in CLI
3712
3756
  direct-gen for Seedance; H3 r2v uploads local/remote files.
@@ -3722,14 +3766,17 @@ Video Options:
3722
3766
 
3723
3767
  Seedance Reference Modes (mutually exclusive on seedance2 / seedance2-mini / seedance2-fast / seedance2-5):
3724
3768
  - DEDICATED FRAME MODE: --ref (first frame) and/or --ref-end (last frame).
3725
- Best when you want canonical first/last frame anchoring; max 2 images.
3769
+ Best when you want canonical first/last frame anchoring; do not attach loose
3770
+ image, video, or audio references to the same request.
3726
3771
  - LOOSE REFERENCE MODE: -c/--context image refs plus optional --ref-audio /
3727
3772
  --ref-video extras. Anchor frame intent in the prompt with @Image1, @Image2,
3728
3773
  @Video1, @Audio1 etc. (e.g. "Use @Image1 as the opening shot reference").
3729
3774
  Up to 9 image / 3 video / 3 audio / 12 total references per video request
3730
3775
  on the 2.0 family; seedance2-5 raises the caps to 30 image / 10 video /
3731
- 10 audio / 30 total.
3732
- Combining --ref/--ref-end with -c/--context on Seedance is rejected client-side.
3776
+ 10 audio / 50 total.
3777
+ - Typed IA2V exception: with --workflow ia2v, --ref is a loose @Image
3778
+ reference beside --ref-audio, not a first_frame anchor. --ref-end is invalid.
3779
+ Combining native frame anchors with any loose reference is rejected client-side.
3733
3780
  All three modalities pull caps from the canonical
3734
3781
  @sogni-ai/sogni-protocol seedance-reference-limits catalog.
3735
3782
  --video-start <sec> Start offset into --ref-video for segmented V2V/animate
@@ -3928,14 +3975,14 @@ image-only R2V need 32GB-class workers; video-conditioned R2V needs above 40GB.
3928
3975
  Prompts use MiniMax's exact ordered-field contracts and [Shot N] notation; see
3929
3976
  references/video-prompting.md "MiniMax H3 Prompting". No negative prompt field:
3930
3977
  state negatives in the structured prompt.):
3931
- minimax-h3 Text-to-video (also accepts minimax-h3-t2v); --ref/--ref-end pick i2v/flf2v
3932
- minimax-h3-i2v Image-to-video from a single first-frame image (--ref)
3978
+ minimax-h3 Text-to-video; --ref selects I2VA, --ref-end L2VA, and both FL2VA
3979
+ minimax-h3-i2v I2VA from --ref, or L2VA from a closing frame supplied as --ref-end
3933
3980
  minimax-h3-flf2v First-frame -> last-frame transition (--ref plus --ref-end)
3934
3981
  minimax-h3-r2v Multi-reference video: --ref/-c images, repeatable --ref-video/--ref-audio
3935
3982
  (9 images / 3 videos / 3 audios / 12 files total; requires an image or video)
3936
- minimax-h3-turbo 4-step Turbo; --ref/--ref-end select i2v/flf2v
3983
+ minimax-h3-turbo 4-step Turbo; --ref selects I2VA, --ref-end L2VA, and both FL2VA
3937
3984
  minimax-h3-t2v-turbo 4-step Turbo text-to-video
3938
- minimax-h3-i2v-turbo 4-step Turbo image-to-video (--ref)
3985
+ minimax-h3-i2v-turbo 4-step Turbo I2VA (--ref) or L2VA (--ref-end)
3939
3986
  minimax-h3-flf2v-turbo 4-step Turbo first-frame -> last-frame (--ref plus --ref-end)
3940
3987
  minimax-h3-r2v-turbo 4-step Ref2VA Turbo with loose image/video/audio references
3941
3988
  (upstream default: 960x544, Euler/simple)
@@ -4272,7 +4319,7 @@ if (options.multiAngle) {
4272
4319
  options.elevation = normalizeMultiAngleValue(options.elevation, MULTI_ANGLE_ELEVATION_ALIASES, elevationKeys, 'elevation');
4273
4320
  options.distance = normalizeMultiAngleValue(options.distance, MULTI_ANGLE_DISTANCE_ALIASES, distanceKeys, 'distance');
4274
4321
 
4275
- if (options.model && !options.model.includes('qwen_image_edit_2511')) {
4322
+ if (options.model && !isQwenImageEdit2511ModelSelection(options.model)) {
4276
4323
  fatalCliError('--multi-angle requires a Qwen Image Edit 2511 model.', {
4277
4324
  code: 'INVALID_ARGUMENT',
4278
4325
  details: { model: options.model }
@@ -4305,7 +4352,7 @@ if (options.multiAngle) {
4305
4352
  options.loraStrengths = [];
4306
4353
  }
4307
4354
  if (!cliSet.guidance && (options.guidance === null || options.guidance === undefined)) {
4308
- options.guidance = options.model.includes('lightning') ? 1.0 : 4.0;
4355
+ options.guidance = isLightningImageModelSelection(options.model) ? 1.0 : 4.0;
4309
4356
  }
4310
4357
  if (options.angleStrength === null || options.angleStrength === undefined) {
4311
4358
  options.angleStrength = 0.9;
@@ -4490,15 +4537,16 @@ if (options.video) {
4490
4537
  if (!options.videoWorkflow && isSeedanceModelSelection(options.model)) {
4491
4538
  if (options.refVideo) {
4492
4539
  options.videoWorkflow = 'v2v';
4493
- } else if (options.refAudio && (options.refImage || options.refImageEnd)) {
4540
+ } else if (options.refAudio && options.refImage) {
4494
4541
  options.videoWorkflow = 'ia2v';
4495
4542
  } else {
4496
4543
  options.videoWorkflow = 't2v';
4497
4544
  }
4498
4545
  }
4499
4546
 
4500
- // MiniMax H3 has four concrete modes. The FL2VA checkpoint covers t2v, i2v,
4501
- // and first/last-frame (represented by the CLI's i2v workflow); Ref2VA is a
4547
+ // MiniMax H3 has four concrete worker selectors and five prompt shapes. The
4548
+ // FL2VA checkpoint covers t2v, first-frame i2v, last-frame-only l2v, and
4549
+ // first/last-frame (represented by the CLI's i2v workflow); Ref2VA is a
4502
4550
  // separate r2v checkpoint and is never inferred from loose references alone.
4503
4551
  // Selecting minimax-h3-r2v or explicitly passing --workflow r2v is required.
4504
4552
  if (isMiniMaxH3ModelSelectionLocal(options.model)) {
@@ -4518,6 +4566,7 @@ if (options.video) {
4518
4566
  options.model = resolveSkillVideoModelAlias(
4519
4567
  options.model,
4520
4568
  options.videoWorkflow,
4569
+ Boolean(options.refImage),
4521
4570
  Boolean(options.refImageEnd)
4522
4571
  );
4523
4572
  }
@@ -4562,7 +4611,12 @@ if (options.video) {
4562
4611
  }
4563
4612
  if (options.model) {
4564
4613
  options.model = resolveVideoModelAlias(
4565
- resolveSkillVideoModelAlias(options.model, options.videoWorkflow, Boolean(options.refImageEnd)),
4614
+ resolveSkillVideoModelAlias(
4615
+ options.model,
4616
+ options.videoWorkflow,
4617
+ Boolean(options.refImage),
4618
+ Boolean(options.refImageEnd),
4619
+ ),
4566
4620
  options.videoWorkflow
4567
4621
  );
4568
4622
  }
@@ -4927,8 +4981,8 @@ if (!options.upscaleImage && (cliSet.upscaleScale || cliSet.upscaleTargetLongest
4927
4981
  });
4928
4982
  }
4929
4983
 
4930
- if (!options.video && !options.apiChat && !options.apiWorkflowAction && (options.refAudio || options.refVideo || options.refMask || options.referenceAudioIdentity || options.voicePersonaName || options.videoWorkflow || options.frames || options.targetResolution || options.audioStart !== null || options.audioDuration !== null || options.videoStart !== null || options.outpaintPosition || options.outpaintAspectRatio)) {
4931
- fatalCliError('Video-only options (--workflow/--frames/--target-resolution/--ref-audio/--ref-video/--mask/--outpaint-position/--reference-audio-identity/--voice-persona) require --video.', {
4984
+ if (!options.video && !options.apiChat && !options.apiWorkflowAction && (options.refAudio || options.refVideo || options.refMask || options.referenceAudioIdentity || options.voicePersonaName || options.videoWorkflow || options.seedanceTaskType || options.frames || options.targetResolution || options.audioStart !== null || options.audioDuration !== null || options.videoStart !== null || options.outpaintPosition || options.outpaintAspectRatio)) {
4985
+ fatalCliError('Video-only options (--workflow/--seedance-task-type/--frames/--target-resolution/--ref-audio/--ref-video/--mask/--outpaint-position/--reference-audio-identity/--voice-persona) require --video.', {
4932
4986
  code: 'INVALID_ARGUMENT'
4933
4987
  });
4934
4988
  }
@@ -4947,11 +5001,108 @@ if (options.photobooth) {
4947
5001
 
4948
5002
  if (options.video) {
4949
5003
  const isSeedanceVideo = isSeedanceModel(options.model);
5004
+ const isSeedance25Video = isSeedance25ModelSelectionLocal(options.model);
4950
5005
  const isHappyHorseVideo = isHappyHorseModel(options.model);
4951
5006
  const isMiniMaxH3Video = isMiniMaxH3Model(options.model);
4952
5007
  const isMiniMaxH3R2v = isMiniMaxH3R2vModel(options.model);
4953
- if (isSeedanceVideo && !['t2v', 'ia2v', 'v2v'].includes(options.videoWorkflow)) {
4954
- fatalCliError('Seedance models support only t2v, ia2v, or v2v workflows.', {
5008
+ if (options.seedanceTaskType && !SEEDANCE_TASK_TYPES.has(options.seedanceTaskType)) {
5009
+ fatalCliError('--seedance-task-type must be one of: reference, edit, extend.', {
5010
+ code: 'INVALID_ARGUMENT',
5011
+ details: { seedanceTaskType: options.seedanceTaskType }
5012
+ });
5013
+ }
5014
+ if (options.seedanceTaskType && !isSeedance25Video) {
5015
+ fatalCliError('--seedance-task-type is supported only by Seedance 2.5.', {
5016
+ code: 'INVALID_ARGUMENT',
5017
+ details: { model: options.model, seedanceTaskType: options.seedanceTaskType }
5018
+ });
5019
+ }
5020
+ if (isSeedance25Video && !options.seedanceTaskType) {
5021
+ if (options.videoWorkflow === 'v2v') {
5022
+ options.seedanceTaskType = 'edit';
5023
+ } else if (
5024
+ options.videoWorkflow === 'ia2v' ||
5025
+ options.contextImages.length > 0 ||
5026
+ options.refAudio ||
5027
+ options.refAudios.length > 0 ||
5028
+ options.refVideo ||
5029
+ options.refVideos.length > 0
5030
+ ) {
5031
+ options.seedanceTaskType = 'reference';
5032
+ }
5033
+ }
5034
+ const seedance25TypedIa2vImage =
5035
+ options.videoWorkflow === 'ia2v' && options.refImage && !options.refImageEnd;
5036
+ if (
5037
+ options.seedanceTaskType &&
5038
+ (options.refImageEnd || (options.refImage && !seedance25TypedIa2vImage))
5039
+ ) {
5040
+ fatalCliError(
5041
+ 'Seedance 2.5 reference/edit/extend uses loose media only. Use -c/--context for images; omit --ref/--ref-end frame anchors.',
5042
+ {
5043
+ code: 'INVALID_ARGUMENT',
5044
+ details: { seedanceTaskType: options.seedanceTaskType }
5045
+ }
5046
+ );
5047
+ }
5048
+ if (
5049
+ (options.seedanceTaskType === 'edit' || options.seedanceTaskType === 'extend') &&
5050
+ !options.refVideo && options.refVideos.length === 0
5051
+ ) {
5052
+ fatalCliError(`Seedance 2.5 ${options.seedanceTaskType} requires --ref-video.`, {
5053
+ code: 'INVALID_ARGUMENT',
5054
+ details: { seedanceTaskType: options.seedanceTaskType }
5055
+ });
5056
+ }
5057
+ if (
5058
+ options.seedanceTaskType === 'reference' &&
5059
+ options.contextImages.length === 0 &&
5060
+ !options.refAudio && options.refAudios.length === 0 &&
5061
+ !options.refVideo && options.refVideos.length === 0
5062
+ ) {
5063
+ fatalCliError(`Seedance 2.5 ${options.seedanceTaskType} requires at least one loose reference.`, {
5064
+ code: 'INVALID_ARGUMENT',
5065
+ details: { seedanceTaskType: options.seedanceTaskType }
5066
+ });
5067
+ }
5068
+ if (options.seedanceTaskType === 'edit' && !cliSet.duration) {
5069
+ fatalCliError(
5070
+ 'Seedance 2.5 edit requires --duration set to @Video1\'s source duration.',
5071
+ {
5072
+ code: 'INVALID_ARGUMENT',
5073
+ details: { seedanceTaskType: options.seedanceTaskType }
5074
+ }
5075
+ );
5076
+ }
5077
+ if (
5078
+ (options.seedanceTaskType === 'edit' || options.seedanceTaskType === 'extend') &&
5079
+ (cliSet.width || cliSet.height)
5080
+ ) {
5081
+ fatalCliError(
5082
+ `Seedance 2.5 ${options.seedanceTaskType} inherits @Video1's aspect ratio; use --target-resolution 480 or 720 instead of --width/--height.`,
5083
+ {
5084
+ code: 'INVALID_ARGUMENT',
5085
+ details: { seedanceTaskType: options.seedanceTaskType }
5086
+ }
5087
+ );
5088
+ }
5089
+ if (
5090
+ isSeedance25Video &&
5091
+ cliSet.targetResolution &&
5092
+ ![480, 720].includes(options.targetResolution)
5093
+ ) {
5094
+ fatalCliError('Seedance 2.5 --target-resolution must be 480 or 720.', {
5095
+ code: 'INVALID_ARGUMENT',
5096
+ details: { targetResolution: options.targetResolution }
5097
+ });
5098
+ }
5099
+ const seedanceWorkflows = isSeedance25Video
5100
+ ? ['t2v', 'ia2v', 'a2v', 'v2v']
5101
+ : ['t2v', 'ia2v', 'v2v'];
5102
+ if (isSeedanceVideo && !seedanceWorkflows.includes(options.videoWorkflow)) {
5103
+ fatalCliError(isSeedance25Video
5104
+ ? 'Seedance 2.5 supports only t2v, ia2v, a2v, or v2v workflows.'
5105
+ : 'Seedance 2.0 models support only t2v, ia2v, or v2v workflows.', {
4955
5106
  code: 'INVALID_ARGUMENT',
4956
5107
  details: { workflow: options.videoWorkflow, model: options.model }
4957
5108
  });
@@ -5020,11 +5171,11 @@ if (options.video) {
5020
5171
  fatalCliError('MiniMax H3 flf2v requires both --ref and --ref-end.', { code: 'INVALID_ARGUMENT' });
5021
5172
  }
5022
5173
  } else {
5023
- if (!options.refImage) {
5024
- fatalCliError('MiniMax H3 i2v requires --ref (a single first-frame image).', { code: 'INVALID_ARGUMENT' });
5174
+ if (!options.refImage && !options.refImageEnd) {
5175
+ fatalCliError('MiniMax H3 i2v requires exactly one endpoint: --ref for I2VA or --ref-end for L2VA.', { code: 'INVALID_ARGUMENT' });
5025
5176
  }
5026
- if (options.refImageEnd) {
5027
- fatalCliError('MiniMax H3 i2v accepts one first-frame image; use -m minimax-h3-flf2v for --ref plus --ref-end.', { code: 'INVALID_ARGUMENT' });
5177
+ if (options.refImage && options.refImageEnd) {
5178
+ fatalCliError('MiniMax H3 i2v accepts one endpoint; use -m minimax-h3-flf2v for --ref plus --ref-end.', { code: 'INVALID_ARGUMENT' });
5028
5179
  }
5029
5180
  }
5030
5181
  if (options.contextImages.length > 0 || options.refAudio || options.refVideo || options.refAudios.length > 0 || options.refVideos.length > 0) {
@@ -5069,9 +5220,12 @@ if (options.video) {
5069
5220
  }
5070
5221
  } else if (options.videoWorkflow === 'ia2v') {
5071
5222
  if (isSeedanceVideo) {
5072
- if (!options.refAudio || (!options.refImage && !options.refImageEnd && !options.refVideo)) {
5223
+ if (!options.refAudio || (!options.refImage && !options.refVideo)) {
5073
5224
  fatalCliError('Seedance ia2v requires --ref-audio plus --ref or --ref-video.', { code: 'INVALID_ARGUMENT' });
5074
5225
  }
5226
+ if (options.refImageEnd) {
5227
+ fatalCliError('Seedance ia2v treats --ref as a loose @Image reference and does not accept --ref-end. Use dedicated frame mode without audio for a native last-frame anchor.', { code: 'INVALID_ARGUMENT' });
5228
+ }
5075
5229
  } else if (!options.refImage || !options.refAudio) {
5076
5230
  fatalCliError('ia2v requires both --ref and --ref-audio.', { code: 'INVALID_ARGUMENT' });
5077
5231
  }
@@ -5120,29 +5274,40 @@ if (options.video) {
5120
5274
  if (options.videoStart !== null && !options.refVideo) {
5121
5275
  fatalCliError('--video-start requires --ref-video.', { code: 'INVALID_ARGUMENT' });
5122
5276
  }
5123
- if (isSeedanceVideo && options.refAudio && !options.refImage && !options.refImageEnd && !options.refVideo
5277
+ if (isSeedanceVideo && !isSeedance25Video && options.refAudio && !options.refImage && !options.refImageEnd && !options.refVideo
5124
5278
  && (!Array.isArray(options.contextImages) || options.contextImages.length === 0)) {
5125
- fatalCliError('Seedance audio references require --ref, --ref-video, or -c/--context image refs.', { code: 'INVALID_ARGUMENT' });
5279
+ fatalCliError('Seedance 2.0 audio references require --ref, --ref-video, or -c/--context image refs.', { code: 'INVALID_ARGUMENT' });
5126
5280
  }
5127
5281
 
5128
- // Seedance reference modes are mutually exclusive:
5129
- // - DEDICATED FRAME MODE: --ref (first frame) and/or --ref-end (last frame).
5130
- // Up to 2 images; the platform pins them as parameter-mode firstFrame/lastFrame.
5282
+ // Seedance provider roles form two mutually exclusive request shapes:
5283
+ // - DEDICATED FRAME MODE: --ref (first frame) and/or --ref-end (last frame)
5284
+ // outside the typed ia2v workflow. The platform pins them as
5285
+ // parameter-mode firstFrame/lastFrame.
5131
5286
  // - LOOSE REFERENCE MODE: -c/--context (repeatable image refs), --ref-audio extras,
5132
- // --ref-video extras. Up to 9 images / 3 videos / 3 audios / 12 total.
5287
+ // --ref-video extras. Seedance 2.0 permits 9 images / 3 videos / 3 audios /
5288
+ // 12 total; Seedance 2.5 permits 30 / 10 / 10 / 50 and audio-only input.
5133
5289
  // Anchor frame intent in the prompt with @Image1 / @Video1 / @Audio1 etc.
5134
- // Mixing dedicated frames with loose image refs is rejected at sogni-socket
5135
- // (jobsController.js) so we catch it client-side with a clearer message.
5136
- if (isSeedanceVideo
5137
- && (options.refImage || options.refImageEnd)
5138
- && Array.isArray(options.contextImages) && options.contextImages.length > 0) {
5290
+ // In typed ia2v, --ref is intentionally a loose reference_image beside the
5291
+ // audio, not a first_frame role. Every other frame-plus-loose combination is
5292
+ // rejected by sogni-socket, so catch it before uploading or charging.
5293
+ const seedanceFrameInputs = options.videoWorkflow === 'ia2v'
5294
+ ? [options.refImageEnd].filter(Boolean)
5295
+ : [options.refImage, options.refImageEnd].filter(Boolean);
5296
+ const seedanceLooseInputs = [
5297
+ ...(Array.isArray(options.contextImages) ? options.contextImages : []),
5298
+ options.refAudio,
5299
+ ...(Array.isArray(options.refAudios) ? options.refAudios : []),
5300
+ options.refVideo,
5301
+ ...(Array.isArray(options.refVideos) ? options.refVideos : []),
5302
+ ].filter(Boolean);
5303
+ if (isSeedanceVideo && seedanceFrameInputs.length > 0 && seedanceLooseInputs.length > 0) {
5139
5304
  fatalCliError(
5140
- 'Seedance reference modes are mutually exclusive: --ref/--ref-end (dedicated first/last frame) cannot be combined with -c/--context (loose image references). '
5141
- + 'Pick one: use --ref/--ref-end for first-class first-frame/last-frame anchoring (max 2 images), '
5142
- + 'or use -c/--context (plus optional @Image1/@Image2 prompt language) for up to 9 loose image references.',
5305
+ 'Seedance reference modes are mutually exclusive: native --ref/--ref-end frame anchors cannot be combined with loose image, video, or audio references. '
5306
+ + 'Pick one: use --ref/--ref-end alone for first-class frame anchoring, or use -c/--context with optional --ref-video/--ref-audio and @ImageN/@VideoN/@AudioN prompt language. '
5307
+ + 'For image-plus-audio generation, select --workflow ia2v; there --ref is mapped to a loose @Image reference instead of first_frame.',
5143
5308
  { code: 'INVALID_ARGUMENT', details: {
5144
- dedicatedFrames: [options.refImage, options.refImageEnd].filter(Boolean),
5145
- looseImageRefs: options.contextImages,
5309
+ dedicatedFrames: seedanceFrameInputs,
5310
+ looseReferences: seedanceLooseInputs,
5146
5311
  } },
5147
5312
  );
5148
5313
  }
@@ -8788,12 +8953,13 @@ function effectiveSeedanceReferenceCounts() {
8788
8953
 
8789
8954
  // Wraps the shared validateSeedanceReferenceCounts() so a thrown
8790
8955
  // SeedanceReferenceLimitError is re-raised as a CLI fatal error with the same
8791
- // human message the hosted chat surfaces. Source of truth for the numeric caps
8792
- // (9 / 3 / 3 / 12) is @sogni-ai/sogni-protocol's seedance-reference-limits
8793
- // catalog, surfaced through @sogni-ai/sogni-intelligence-client/tools.
8956
+ // human message the hosted chat surfaces. Source of truth for the per-model
8957
+ // numeric caps (2.0: 9 / 3 / 3 / 12; 2.5: 30 / 10 / 10 / 50) is
8958
+ // @sogni-ai/sogni-protocol's seedance-reference-limits catalog, surfaced
8959
+ // through @sogni-ai/sogni-intelligence-client/tools.
8794
8960
  function enforceSeedanceReferenceCaps() {
8795
8961
  try {
8796
- validateSeedanceReferenceCounts(effectiveSeedanceReferenceCounts());
8962
+ validateSeedanceReferenceCounts(effectiveSeedanceReferenceCounts(), options.model);
8797
8963
  } catch (err) {
8798
8964
  if (err instanceof SeedanceReferenceLimitError) {
8799
8965
  fatalCliError(err.message, {
@@ -8802,7 +8968,7 @@ function enforceSeedanceReferenceCaps() {
8802
8968
  limitKind: err.limitKind,
8803
8969
  requestedCount: err.requestedCount,
8804
8970
  maxCount: err.maxCount,
8805
- limits: SEEDANCE_REFERENCE_LIMITS,
8971
+ limits: getSeedanceReferenceLimits(options.model),
8806
8972
  },
8807
8973
  });
8808
8974
  }
@@ -10048,8 +10214,8 @@ async function runMultiAngleFlow(client, log) {
10048
10214
  ? MULTI_ANGLE_AZIMUTHS.map((a) => a.key)
10049
10215
  : [options.azimuth];
10050
10216
  const modelDefaults = getModelDefaults(options.model, openclawConfig);
10051
- const steps = options.steps ?? modelDefaults?.steps ?? (options.model.includes('lightning') ? 4 : 20);
10052
- const guidance = options.guidance ?? modelDefaults?.guidance ?? (options.model.includes('lightning') ? 1.0 : 4.0);
10217
+ const steps = options.steps ?? modelDefaults?.steps ?? (isLightningImageModelSelection(options.model) ? 4 : 20);
10218
+ const guidance = options.guidance ?? modelDefaults?.guidance ?? (isLightningImageModelSelection(options.model) ? 1.0 : 4.0);
10053
10219
 
10054
10220
  let outputConfig = resolveMultiAngleOutputConfig(options.output, options.outputFormat);
10055
10221
  let tempOutputDir = null;
@@ -11348,8 +11514,40 @@ async function main() {
11348
11514
  const seedanceReferenceImageUrls = [];
11349
11515
  const seedanceReferenceVideoUrls = [];
11350
11516
  const seedanceReferenceAudioUrls = [];
11351
- const useRefImageUrl = isVendorReferenceVideo && await appendSafeSeedanceReferenceUrl(seedanceReferenceImageUrls, options.refImage, 'Reference image');
11352
- const useRefImageEndUrl = isVendorReferenceVideo && await appendSafeSeedanceReferenceUrl(seedanceReferenceImageUrls, options.refImageEnd, 'End reference image');
11517
+ // Argument roles, never file location, determine provider semantics.
11518
+ // --ref/--ref-end are dedicated frame anchors even when they are HTTPS;
11519
+ // -c/--context is loose reference media. IA2V is the one typed exception:
11520
+ // its image travels beside audio as a loose @Image reference. HappyHorse
11521
+ // has no binary frame upload field and keeps URL forwarding.
11522
+ let useRefImageUrl = false;
11523
+ let useRefImageEndUrl = false;
11524
+ if (isHappyHorseVideo) {
11525
+ useRefImageUrl = await appendSafeSeedanceReferenceUrl(
11526
+ seedanceReferenceImageUrls,
11527
+ options.refImage,
11528
+ 'Reference image',
11529
+ );
11530
+ useRefImageEndUrl = await appendSafeSeedanceReferenceUrl(
11531
+ seedanceReferenceImageUrls,
11532
+ options.refImageEnd,
11533
+ 'End reference image',
11534
+ );
11535
+ } else if (isSeedanceVideo && options.videoWorkflow === 'ia2v' && options.refImage) {
11536
+ if (isHttpsUrl(options.refImage)) {
11537
+ useRefImageUrl = await appendSafeSeedanceReferenceUrl(
11538
+ seedanceReferenceImageUrls,
11539
+ options.refImage,
11540
+ 'Reference image',
11541
+ );
11542
+ } else {
11543
+ seedanceReferenceImageUrls.push(await uploadSeedanceReferenceImageUrl(
11544
+ options.refImage,
11545
+ creds.SOGNI_API_KEY,
11546
+ 0,
11547
+ ));
11548
+ useRefImageUrl = true;
11549
+ }
11550
+ }
11353
11551
  const refAudioFormatByPath = options.refAudio
11354
11552
  ? detectReferenceAudioFormat(
11355
11553
  new Uint8Array(),
@@ -11653,6 +11851,9 @@ async function main() {
11653
11851
  waitForCompletion: false,
11654
11852
  disableNSFWFilter: options.noFilter === true
11655
11853
  };
11854
+ if (options.seedanceTaskType) {
11855
+ projectConfig.seedanceTaskType = options.seedanceTaskType;
11856
+ }
11656
11857
 
11657
11858
  if (options.outputFormat) {
11658
11859
  projectConfig.outputFormat = options.outputFormat;
@@ -11910,8 +12111,8 @@ async function main() {
11910
12111
  options.contextImages.map(img => fetchMediaBuffer(img))
11911
12112
  );
11912
12113
  const modelDefaults = getModelDefaults(options.model, openclawConfig);
11913
- const steps = options.steps ?? modelDefaults?.steps ?? (options.model.includes('lightning') ? 4 : 20);
11914
- const guidance = options.guidance ?? modelDefaults?.guidance ?? (options.model.includes('lightning') ? 3.5 : 7.5);
12114
+ const steps = options.steps ?? modelDefaults?.steps ?? (isLightningImageModelSelection(options.model) ? 4 : 20);
12115
+ const guidance = options.guidance ?? modelDefaults?.guidance ?? (isLightningImageModelSelection(options.model) ? 3.5 : 7.5);
11915
12116
  const gptImageQuality = isGptImage2ModelSelection(options.model)
11916
12117
  ? options.quality === 'pro'
11917
12118
  ? 'high'
package/version.mjs CHANGED
@@ -1 +1 @@
1
- export const PACKAGE_VERSION = '3.33.0';
1
+ export const PACKAGE_VERSION = '3.34.0';