@sogni-ai/sogni-creative-agent-skill 3.6.4 → 3.8.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
@@ -53,6 +53,8 @@ import {
53
53
  getVideoPromptGuardrailPlan,
54
54
  inferVideoWorkflowFromAssets,
55
55
  inferVideoWorkflowFromModel,
56
+ isHappyHorseModel,
57
+ isHappyHorseModelSelection,
56
58
  isLtx2Model,
57
59
  isSeedanceModel,
58
60
  isSeedanceModelSelection,
@@ -80,10 +82,16 @@ import {
80
82
  prepareSeedanceV2VSourceVideo as prepareSharedSeedanceV2VSourceVideo
81
83
  } from '@sogni-ai/sogni-intelligence-client/media';
82
84
  import {
85
+ HAPPYHORSE_REFERENCE_LIMITS,
86
+ HappyHorseReferenceLimitError,
83
87
  SEEDANCE_REFERENCE_LIMITS,
84
88
  SeedanceReferenceLimitError,
89
+ getHappyHorseReferenceLimits,
90
+ happyhorseTerminalGenerationFailurePayloadFromError,
91
+ happyhorseTerminalPolicyPayloadFromError,
85
92
  seedanceTerminalGenerationFailurePayloadFromError,
86
93
  seedanceTerminalPolicyPayloadFromError,
94
+ validateHappyHorseReferenceCounts,
87
95
  validateSeedanceReferenceCounts
88
96
  } from '@sogni-ai/sogni-intelligence-client/tools';
89
97
 
@@ -109,7 +117,7 @@ function subscriptionBillingFallback(code) {
109
117
  // Vendor model the subscription never covers, or no verified entitlement.
110
118
  return {
111
119
  retryable: false,
112
- hint: 'This generation is not covered by Sogni Unlimited. Vendor models (GPT Image 2, Seedance) always require Premium Spark; otherwise reconnect and try again. ' + SPARK_PACKS_PURCHASE_HINT,
120
+ hint: 'This generation is not covered by Sogni Unlimited. Vendor models (GPT Image 2, Seedance, HappyHorse) always require Premium Spark; otherwise reconnect and try again. ' + SPARK_PACKS_PURCHASE_HINT,
113
121
  purchaseLabel: 'Get Premium Spark',
114
122
  purchaseUrl: SPARK_PACKS_PURCHASE_URL,
115
123
  };
@@ -319,14 +327,27 @@ const SOCKET_EVENT_SUBSCRIPTIONS = Object.freeze({
319
327
  modelAvailability: false
320
328
  });
321
329
  const MUSIC_MODEL_IDS = {
322
- turbo: 'ace_step_1.5_turbo',
323
- speed: 'ace_step_1.5_turbo',
324
- fast: 'ace_step_1.5_turbo',
325
- sft: 'ace_step_1.5_sft',
326
- lyrics: 'ace_step_1.5_sft',
327
- lyric: 'ace_step_1.5_sft'
330
+ turbo: 'ace_step_1.5_xl_turbo',
331
+ speed: 'ace_step_1.5_xl_turbo',
332
+ fast: 'ace_step_1.5_xl_turbo',
333
+ sft: 'ace_step_1.5_xl_sft',
334
+ lyrics: 'ace_step_1.5_xl_sft',
335
+ lyric: 'ace_step_1.5_xl_sft'
328
336
  };
329
337
  const MUSIC_MODEL_DEFAULTS = {
338
+ 'ace_step_1.5_xl_turbo': {
339
+ steps: { min: 4, max: 16, default: 8 },
340
+ shift: { min: 1, max: 6, default: 3 },
341
+ sampler: { allowed: ['euler', 'euler_ancestral'], default: 'euler' },
342
+ scheduler: { allowed: ['simple'], default: 'simple' }
343
+ },
344
+ 'ace_step_1.5_xl_sft': {
345
+ steps: { min: 10, max: 100, default: 50 },
346
+ guidance: { min: 1, max: 15, default: 5 },
347
+ shift: { min: 1, max: 6, default: 3 },
348
+ sampler: { allowed: ['euler', 'euler_ancestral', 'er_sde'], default: 'er_sde' },
349
+ scheduler: { allowed: ['simple', 'linear_quadratic'], default: 'linear_quadratic' }
350
+ },
330
351
  'ace_step_1.5_turbo': {
331
352
  steps: { min: 4, max: 16, default: 8 },
332
353
  shift: { min: 1, max: 6, default: 3 },
@@ -435,8 +456,74 @@ function seedanceFriendlyGenerationMessage(payload) {
435
456
  return payload?.message || 'Seedance could not complete this video.';
436
457
  }
437
458
 
438
- function classifyCliError(error) {
459
+ // Classify a HappyHorse terminal policy / generation-failure error into the
460
+ // canonical CLI error shape, or null when neither HappyHorse matcher applies.
461
+ // Factored out so it can run either AFTER the Seedance matchers (default order)
462
+ // or BEFORE them when the failing model is known to be HappyHorse (see
463
+ // classifyCliError).
464
+ function classifyHappyHorseCliError(error, rawMessage) {
465
+ const happyhorsePolicyPayload = happyhorseTerminalPolicyPayloadFromError(error);
466
+ if (happyhorsePolicyPayload) {
467
+ return {
468
+ error_type: 'SAFETY_REJECTED',
469
+ category: 'content_refused',
470
+ message: happyhorsePolicyPayload.message,
471
+ retryable: false,
472
+ metadata: happyhorsePolicyPayload,
473
+ technicalError: rawMessage
474
+ };
475
+ }
476
+
477
+ const happyhorseGenerationPayload = happyhorseTerminalGenerationFailurePayloadFromError(error);
478
+ if (happyhorseGenerationPayload) {
479
+ const vendorCode = happyhorseGenerationPayload.vendorErrorCode;
480
+ const isInvalidParameter = vendorCode === 'InvalidParameter' ||
481
+ happyhorseGenerationPayload.error === 'happyhorse_input_download_failed';
482
+ return {
483
+ error_type: isInvalidParameter ? 'PARAMETER_INVALID' : 'GPU_WORKER_FAILED',
484
+ category: isInvalidParameter ? 'schema_validation' : 'transient_failure',
485
+ message: happyhorseGenerationPayload.message || 'HappyHorse could not complete this video.',
486
+ retryable: !isInvalidParameter,
487
+ metadata: happyhorseGenerationPayload,
488
+ technicalError: rawMessage
489
+ };
490
+ }
491
+
492
+ return null;
493
+ }
494
+
495
+ function classifyCliError(error, context = {}) {
439
496
  const rawMessage = cliErrorMessage(error);
497
+
498
+ // Client-side CLI rejections are the plain `{ message, code }` shape built by
499
+ // buildCliErrorPayload (never an Error instance and never a vendor poll body).
500
+ // They are argument-validation failures, so skip the HappyHorse terminal
501
+ // matchers — the HappyHorse generation matcher keys off a bare "happyhorse"
502
+ // mention and would otherwise re-wrap a validation message (e.g. "HappyHorse
503
+ // models do not support ControlNet") as a retryable vendor generation failure.
504
+ const isClientSideCliPayload = error
505
+ && typeof error === 'object'
506
+ && !(error instanceof Error)
507
+ && typeof error.message === 'string'
508
+ && !('output' in error)
509
+ && !('vendorError' in error)
510
+ && !('vendorErrorCode' in error);
511
+
512
+ // When the failing model is HappyHorse, run the HappyHorse matchers BEFORE the
513
+ // generic Seedance generation matcher. That matcher keys off vendor-agnostic
514
+ // socket failure text ("All N video generation jobs failed", "Vendor task ...
515
+ // status=failed", "Vendor job failed"), which a HappyHorse failure also
516
+ // produces, so without this model-aware reordering a HappyHorse vendor failure
517
+ // would be misattributed to Seedance. The client-side-payload guard still
518
+ // applies so a CLI validation message that merely names HappyHorse is not
519
+ // re-wrapped as a retryable vendor failure.
520
+ const modelHint = context?.modelId;
521
+ const preferHappyHorse = isHappyHorseModel(modelHint) || isHappyHorseModelSelectionLocal(modelHint);
522
+ if (preferHappyHorse && !isClientSideCliPayload) {
523
+ const happyhorseClassified = classifyHappyHorseCliError(error, rawMessage);
524
+ if (happyhorseClassified) return happyhorseClassified;
525
+ }
526
+
440
527
  const seedancePolicyPayload = seedanceTerminalPolicyPayloadFromError(error);
441
528
  if (seedancePolicyPayload) {
442
529
  return {
@@ -464,11 +551,19 @@ function classifyCliError(error) {
464
551
  };
465
552
  }
466
553
 
554
+ // Default order: when the model is not known to be HappyHorse, run the
555
+ // HappyHorse matchers after the Seedance matchers (preferHappyHorse already
556
+ // ran them above when the model hint matched).
557
+ if (!preferHappyHorse && !isClientSideCliPayload) {
558
+ const happyhorseClassified = classifyHappyHorseCliError(error, rawMessage);
559
+ if (happyhorseClassified) return happyhorseClassified;
560
+ }
561
+
467
562
  return classifySkillError(error);
468
563
  }
469
564
 
470
- function addCanonicalErrorFields(payload, error) {
471
- const classified = classifyCliError(error);
565
+ function addCanonicalErrorFields(payload, error, context = {}) {
566
+ const classified = classifyCliError(error, context);
472
567
  payload.error = classified.message;
473
568
  payload.errorType = classified.error_type;
474
569
  payload.errorCategory = classified.category;
@@ -494,9 +589,9 @@ function addCanonicalErrorFields(payload, error) {
494
589
  // Human-facing twin of addCanonicalErrorFields: print the classified, friendly
495
590
  // message (with the raw message as a detail line when it differs) so human
496
591
  // users get the same quality of error JSON consumers already receive.
497
- function printHumanError(error) {
592
+ function printHumanError(error, context = {}) {
498
593
  let classified = null;
499
- try { classified = classifyCliError(error); } catch { /* fall back to raw */ }
594
+ try { classified = classifyCliError(error, context); } catch { /* fall back to raw */ }
500
595
  const message = classified?.message || error?.message || String(error);
501
596
  console.error(`Error: ${message}`);
502
597
  if (classified?.technicalError && classified.technicalError !== message) {
@@ -1173,7 +1268,36 @@ function normalizeMusicTimeSignature(value) {
1173
1268
  }
1174
1269
 
1175
1270
  function requiresSparkOnlyToken(modelId) {
1176
- return isGptImage2ModelSelection(modelId) || isSeedanceModel(modelId);
1271
+ return isGptImage2ModelSelection(modelId) || isSeedanceModel(modelId) || isHappyHorseModel(modelId);
1272
+ }
1273
+
1274
+ // HappyHorse 1.1 ships three discrete vendor models (no mini/fast). The shared
1275
+ // intel client only resolves the fully-qualified ids; accept the bare
1276
+ // `happyhorse` / `happyhorse-1.1` selector here so `-m happyhorse` works the way
1277
+ // `-m seedance2` does, and pin the concrete per-mode model id.
1278
+ const HAPPYHORSE_VIDEO_MODES = new Set(['t2v', 'i2v', 'r2v']);
1279
+
1280
+ function isHappyHorseModelSelectionLocal(modelId) {
1281
+ if (isHappyHorseModelSelection(modelId)) return true;
1282
+ const key = String(modelId || '').trim().toLowerCase();
1283
+ return key === 'happyhorse' || key === 'happyhorse-1.1';
1284
+ }
1285
+
1286
+ function resolveHappyHorseModelId(modelId, workflow) {
1287
+ if (!isHappyHorseModelSelectionLocal(modelId)) return modelId;
1288
+ const key = String(modelId || '').trim().toLowerCase();
1289
+ if (key === 'happyhorse' || key === 'happyhorse-1.1') {
1290
+ const mode = HAPPYHORSE_VIDEO_MODES.has(workflow) ? workflow : 't2v';
1291
+ return `happyhorse-1.1-${mode}`;
1292
+ }
1293
+ return modelId;
1294
+ }
1295
+
1296
+ // The per-mode workflow pinned by a concrete `happyhorse-1.1-<mode>` model id, or
1297
+ // null for the bare `happyhorse` / `happyhorse-1.1` alias (mode inferred from refs).
1298
+ function happyHorseModeFromModelId(modelId) {
1299
+ const match = String(modelId || '').trim().toLowerCase().match(/^happyhorse-1\.1-(t2v|i2v|r2v)$/);
1300
+ return match ? match[1] : null;
1177
1301
  }
1178
1302
 
1179
1303
  function getMaxContextImages(modelId) {
@@ -1183,21 +1307,46 @@ function getMaxContextImages(modelId) {
1183
1307
 
1184
1308
  function videoDurationLimitsLikeWrapper(modelId) {
1185
1309
  if (isSeedanceModel(modelId)) return { min: 4, max: 15 };
1310
+ if (isHappyHorseModel(modelId)) return { min: 3, max: 15 };
1186
1311
  if (isLtx2Model(modelId) || isWanAnimateVideoModelId(modelId)) return { min: 1, max: 20 };
1187
1312
  return { min: 1, max: 10 };
1188
1313
  }
1189
1314
 
1315
+ // Default video dimensions (and dimension rules) for models the shared intel
1316
+ // video-model registry does not carry, so `getModelDefaults` returns null and
1317
+ // the CLI would otherwise fall back to the 512x512 square.
1318
+ // Parallels `videoDurationLimitsLikeWrapper`.
1319
+ //
1320
+ // HappyHorse 1.1 spec default is 1080P (1920x1080, 16:9). The intelligence
1321
+ // client registers dimensionDivisor=1 and maxDimension=1920 for HappyHorse, so
1322
+ // we mirror those here via `maxDimension` and `dimensionMultiple` so that
1323
+ // `videoDimensionRulesFromDefaults` applies the correct clamp for the model
1324
+ // instead of the generic 480-1536 / multiple-of-16 rules (which would reduce
1325
+ // 1920x1080 to 1536x864 and round 1080 to 1072). These are defaults only —
1326
+ // explicit -w/-h/--target-resolution, config, and prompt-derived dimensions
1327
+ // still win (see the video preflight defaults block).
1328
+ function videoModelDimensionDefaultsLikeWrapper(modelId) {
1329
+ if (isHappyHorseModel(modelId) || isHappyHorseModelSelectionLocal(modelId)) {
1330
+ return { defaultWidth: 1920, defaultHeight: 1080, maxDimension: 1920, dimensionMultiple: 1 };
1331
+ }
1332
+ return null;
1333
+ }
1334
+
1190
1335
  function wrapperMaxVideoDimension(modelId) {
1191
1336
  return isWanVideoModelId(modelId) ? WRAPPER_MAX_WAN_VIDEO_DIMENSION : WRAPPER_MAX_VIDEO_DIMENSION;
1192
1337
  }
1193
1338
 
1194
1339
  function videoDimensionRulesFromDefaults(modelDefaults, modelId) {
1195
1340
  const wrapperMax = wrapperMaxVideoDimension(modelId);
1196
- const configuredMax = modelDefaults?.maxDimension || DEFAULT_VIDEO_DIMENSION_RULES.maxDimension;
1341
+ // Fall back to skill-local dimension rules for models the intel registry does
1342
+ // not carry (e.g. HappyHorse), so their model-specific maxDimension and
1343
+ // dimensionMultiple are applied instead of the generic 1536 / 16 defaults.
1344
+ const localFallback = videoModelDimensionDefaultsLikeWrapper(modelId);
1345
+ const configuredMax = modelDefaults?.maxDimension || localFallback?.maxDimension || DEFAULT_VIDEO_DIMENSION_RULES.maxDimension;
1197
1346
  return {
1198
1347
  minDimension: modelDefaults?.minDimension || DEFAULT_VIDEO_DIMENSION_RULES.minDimension,
1199
1348
  maxDimension: Math.min(configuredMax, wrapperMax),
1200
- dimensionMultiple: modelDefaults?.dimensionMultiple || DEFAULT_VIDEO_DIMENSION_RULES.dimensionMultiple
1349
+ dimensionMultiple: modelDefaults?.dimensionMultiple || localFallback?.dimensionMultiple || DEFAULT_VIDEO_DIMENSION_RULES.dimensionMultiple
1201
1350
  };
1202
1351
  }
1203
1352
 
@@ -2507,7 +2656,7 @@ Photobooth (Face Transfer):
2507
2656
 
2508
2657
  Music Options:
2509
2658
  --music Generate music/audio instead of image
2510
- --music-model <id> Music model: turbo|sft|ace_step_1.5_turbo|ace_step_1.5_sft
2659
+ --music-model <id> Music model: turbo|sft|ace_step_1.5_xl_turbo|ace_step_1.5_xl_sft
2511
2660
  --lyrics <text> Optional song lyrics (omit for instrumental)
2512
2661
  --language <code> Lyrics language code (default: en)
2513
2662
  --duration <sec> Music duration in seconds (10-600, default: 30)
@@ -2546,7 +2695,7 @@ Video Options:
2546
2695
  first entry is the primary, extras must be HTTPS URLs in CLI
2547
2696
  direct-gen. On LTX/WAN: single primary for animate/v2v workflows.
2548
2697
 
2549
- Seedance Reference Modes (mutually exclusive on seedance2 / seedance2-fast):
2698
+ Seedance Reference Modes (mutually exclusive on seedance2 / seedance2-mini / seedance2-fast):
2550
2699
  - DEDICATED FRAME MODE: --ref (first frame) and/or --ref-end (last frame).
2551
2700
  Best when you want canonical first/last frame anchoring; max 2 images.
2552
2701
  - LOOSE REFERENCE MODE: -c/--context image refs plus optional --ref-audio /
@@ -2664,6 +2813,7 @@ Personas (named people with reference photos):
2664
2813
  Image Models:
2665
2814
  z_image_turbo_bf16 Fast, general purpose (default)
2666
2815
  gpt-image-2 OpenAI GPT Image 2 text-to-image and edit (up to 16 context images)
2816
+ krea2_turbo_fp8_scaled Krea 2 Turbo text-to-image
2667
2817
  flux1-schnell-fp8 Very fast
2668
2818
  flux2_dev_fp8 High quality (slow)
2669
2819
  qwen_image_edit_2511_fp8 Image editing with context (up to 3 images)
@@ -2677,15 +2827,23 @@ Recommended LTX 2.3 Video Models:
2677
2827
  ltx23-22b-fp8_v2v_distilled Video-to-video with ControlNet
2678
2828
 
2679
2829
  Music Models:
2680
- ace_step_1.5_turbo Default direct music generation
2681
- ace_step_1.5_sft Experimental model with stronger lyric handling
2830
+ ace_step_1.5_xl_turbo Default direct music generation
2831
+ ace_step_1.5_xl_sft Quality variant with stronger lyric handling
2832
+ ace_step_1.5_turbo Legacy direct music generation
2833
+ ace_step_1.5_sft Legacy lyric-focused music generation
2682
2834
 
2683
2835
  Seedance 2.0 Video Model Selectors:
2684
2836
  seedance2 Text-to-video, 4-15s, native audio, HTTPS multimodal refs
2685
- seedance2-fast Fast 720p-capped text-to-video
2837
+ seedance2-mini Lower-cost 720p-capped text-to-video
2838
+ seedance2-fast Legacy fast 720p-capped text-to-video
2686
2839
  seedance2-ia2v Image+audio-to-video
2687
2840
  seedance2-v2v Video-to-video without ControlNet
2688
2841
 
2842
+ HappyHorse 1.1 Video Model Selectors (3-15s, fixed 24fps, native audio, 720P/1080P):
2843
+ happyhorse-1.1-t2v Text-to-video (also accepts the bare "happyhorse" alias)
2844
+ happyhorse-1.1-i2v Image-to-video from a single first-frame image (--ref)
2845
+ happyhorse-1.1-r2v Reference-to-video from 1-9 reference images (-c/--context)
2846
+
2689
2847
  WAN 2.2 Video Models:
2690
2848
  wan_v2.2-14b-fp8_t2v_lightx2v Text-to-video (fast)
2691
2849
  wan_v2.2-14b-fp8_i2v_lightx2v Fast simple image-to-video
@@ -3114,13 +3272,18 @@ if (options.angles360Video && !options.angles360) {
3114
3272
  if (options.video) {
3115
3273
  if (options.videoWorkflow) {
3116
3274
  const normalized = normalizeVideoWorkflow(options.videoWorkflow);
3117
- if (!normalized) {
3118
- fatalCliError(`Unknown workflow "${options.videoWorkflow}". Use t2v|i2v|s2v|ia2v|a2v|v2v|animate-move|animate-replace.`, {
3275
+ if (normalized) {
3276
+ options.videoWorkflow = normalized;
3277
+ } else if (options.videoWorkflow === 'r2v' && isHappyHorseModelSelectionLocal(options.model)) {
3278
+ // HappyHorse adds a reference-to-video (r2v) mode that the shared
3279
+ // SkillVideoWorkflow enum does not carry; accept it for HappyHorse only.
3280
+ options.videoWorkflow = 'r2v';
3281
+ } else {
3282
+ fatalCliError(`Unknown workflow "${options.videoWorkflow}". Use t2v|i2v|s2v|ia2v|a2v|v2v|animate-move|animate-replace (r2v on HappyHorse).`, {
3119
3283
  code: 'INVALID_ARGUMENT',
3120
3284
  details: { workflow: options.videoWorkflow }
3121
3285
  });
3122
3286
  }
3123
- options.videoWorkflow = normalized;
3124
3287
  }
3125
3288
 
3126
3289
  if (
@@ -3144,6 +3307,32 @@ if (options.video) {
3144
3307
  }
3145
3308
  }
3146
3309
 
3310
+ // HappyHorse 1.1 has no v2v/ia2v. A concrete `happyhorse-1.1-<mode>` id pins
3311
+ // the workflow; the bare `happyhorse` / `happyhorse-1.1` alias infers t2v by
3312
+ // default, i2v from a single first-frame image (--ref), and r2v from loose
3313
+ // -c/--context reference images (1-9). Pin the concrete per-mode model id.
3314
+ if (isHappyHorseModelSelectionLocal(options.model)) {
3315
+ const pinnedMode = happyHorseModeFromModelId(options.model);
3316
+ if (pinnedMode) {
3317
+ if (options.videoWorkflow && options.videoWorkflow !== pinnedMode) {
3318
+ fatalCliError(`Workflow "${options.videoWorkflow}" does not match model "${options.model}".`, {
3319
+ code: 'INVALID_ARGUMENT',
3320
+ details: { workflow: options.videoWorkflow, model: options.model }
3321
+ });
3322
+ }
3323
+ options.videoWorkflow = pinnedMode;
3324
+ } else if (!options.videoWorkflow) {
3325
+ if (Array.isArray(options.contextImages) && options.contextImages.length > 0) {
3326
+ options.videoWorkflow = 'r2v';
3327
+ } else if (options.refImage) {
3328
+ options.videoWorkflow = 'i2v';
3329
+ } else {
3330
+ options.videoWorkflow = 't2v';
3331
+ }
3332
+ }
3333
+ options.model = resolveHappyHorseModelId(options.model, options.videoWorkflow);
3334
+ }
3335
+
3147
3336
  const workflowFromModel = inferVideoWorkflowFromModel(resolveVideoModelAlias(options.model, options.videoWorkflow));
3148
3337
  if (options.videoWorkflow && workflowFromModel && options.videoWorkflow !== workflowFromModel) {
3149
3338
  fatalCliError(`Workflow "${options.videoWorkflow}" does not match model "${options.model}".`, {
@@ -3180,7 +3369,7 @@ if (options.music) {
3180
3369
  const configuredMusicModel = options.model || openclawConfig?.defaultMusicModel || 'turbo';
3181
3370
  options.model = normalizeMusicModelId(configuredMusicModel);
3182
3371
  if (!options.model) {
3183
- fatalCliError(`Unknown music model "${configuredMusicModel}". Use turbo, sft, ace_step_1.5_turbo, or ace_step_1.5_sft.`, {
3372
+ fatalCliError(`Unknown music model "${configuredMusicModel}". Use turbo, sft, ace_step_1.5_xl_turbo, or ace_step_1.5_xl_sft.`, {
3184
3373
  code: 'INVALID_ARGUMENT',
3185
3374
  details: { flag: cliSet.model ? '--model' : 'defaultMusicModel', value: configuredMusicModel }
3186
3375
  });
@@ -3214,12 +3403,22 @@ if (options.music) {
3214
3403
  options.model = options.model || selectDefaultVideoModel(options.videoWorkflow, options, openclawConfig) || 'wan_v2.2-14b-fp8_i2v_lightx2v';
3215
3404
  options.model = resolveVideoModelAlias(options.model, options.videoWorkflow);
3216
3405
  const videoModelDefaults = getModelDefaults(options.model, openclawConfig);
3406
+ // Fall back to skill-local defaults for models the intel registry does not
3407
+ // carry (e.g. HappyHorse), so they get a sensible 16:9 default instead of the
3408
+ // 512x512 square. Registry defaults still take precedence when present.
3409
+ const videoModelDimensionFallback = videoModelDimensionDefaultsLikeWrapper(options.model);
3410
+ const defaultVideoWidth = Number.isFinite(videoModelDefaults?.defaultWidth)
3411
+ ? videoModelDefaults.defaultWidth
3412
+ : videoModelDimensionFallback?.defaultWidth;
3413
+ const defaultVideoHeight = Number.isFinite(videoModelDefaults?.defaultHeight)
3414
+ ? videoModelDefaults.defaultHeight
3415
+ : videoModelDimensionFallback?.defaultHeight;
3217
3416
  const isSeedanceVideo = isSeedanceModel(options.model);
3218
- if (!cliSet.width && !widthFromConfig && !widthFromPrompt && Number.isFinite(videoModelDefaults?.defaultWidth)) {
3219
- options.width = videoModelDefaults.defaultWidth;
3417
+ if (!cliSet.width && !widthFromConfig && !widthFromPrompt && Number.isFinite(defaultVideoWidth)) {
3418
+ options.width = defaultVideoWidth;
3220
3419
  }
3221
- if (!cliSet.height && !heightFromConfig && !heightFromPrompt && Number.isFinite(videoModelDefaults?.defaultHeight)) {
3222
- options.height = videoModelDefaults.defaultHeight;
3420
+ if (!cliSet.height && !heightFromConfig && !heightFromPrompt && Number.isFinite(defaultVideoHeight)) {
3421
+ options.height = defaultVideoHeight;
3223
3422
  }
3224
3423
  if (!cliSet.fps && !fpsFromConfig && Number.isFinite(videoModelDefaults?.fps)) {
3225
3424
  options.fps = videoModelDefaults.fps;
@@ -3404,12 +3603,25 @@ if (options.photobooth) {
3404
3603
 
3405
3604
  if (options.video) {
3406
3605
  const isSeedanceVideo = isSeedanceModel(options.model);
3606
+ const isHappyHorseVideo = isHappyHorseModel(options.model);
3407
3607
  if (isSeedanceVideo && !['t2v', 'ia2v', 'v2v'].includes(options.videoWorkflow)) {
3408
3608
  fatalCliError('Seedance models support only t2v, ia2v, or v2v workflows.', {
3409
3609
  code: 'INVALID_ARGUMENT',
3410
3610
  details: { workflow: options.videoWorkflow, model: options.model }
3411
3611
  });
3412
3612
  }
3613
+ if (isHappyHorseVideo && !['t2v', 'i2v', 'r2v'].includes(options.videoWorkflow)) {
3614
+ fatalCliError('HappyHorse models support only t2v, i2v, or r2v workflows.', {
3615
+ code: 'INVALID_ARGUMENT',
3616
+ details: { workflow: options.videoWorkflow, model: options.model }
3617
+ });
3618
+ }
3619
+ if (isHappyHorseVideo && options.videoControlNetName) {
3620
+ fatalCliError('HappyHorse video models do not support ControlNet.', {
3621
+ code: 'INVALID_ARGUMENT',
3622
+ details: { model: options.model, controlNetName: options.videoControlNetName }
3623
+ });
3624
+ }
3413
3625
 
3414
3626
  if (options.videoWorkflow === 't2v') {
3415
3627
  if (!isSeedanceVideo && (options.refImage || options.refImageEnd || options.refAudio || options.refVideo)) {
@@ -3418,11 +3630,34 @@ if (options.video) {
3418
3630
  });
3419
3631
  }
3420
3632
  } else if (options.videoWorkflow === 'i2v') {
3421
- if (!options.refImage && !options.refImageEnd) {
3422
- fatalCliError('i2v requires --ref and/or --ref-end.', { code: 'INVALID_ARGUMENT' });
3633
+ if (isHappyHorseVideo) {
3634
+ if (!options.refImage) {
3635
+ fatalCliError('HappyHorse i2v requires --ref (a single first-frame image).', { code: 'INVALID_ARGUMENT' });
3636
+ }
3637
+ if (options.refImageEnd) {
3638
+ fatalCliError('HappyHorse i2v accepts only a single first-frame image (--ref); it has no end-frame input.', { code: 'INVALID_ARGUMENT' });
3639
+ }
3640
+ if (options.refAudio || options.refVideo) {
3641
+ fatalCliError('HappyHorse i2v does not accept reference audio/video.', { code: 'INVALID_ARGUMENT' });
3642
+ }
3643
+ } else {
3644
+ if (!options.refImage && !options.refImageEnd) {
3645
+ fatalCliError('i2v requires --ref and/or --ref-end.', { code: 'INVALID_ARGUMENT' });
3646
+ }
3647
+ if (options.refAudio || options.refVideo) {
3648
+ fatalCliError('i2v does not accept reference audio/video.', { code: 'INVALID_ARGUMENT' });
3649
+ }
3650
+ }
3651
+ } else if (options.videoWorkflow === 'r2v') {
3652
+ // HappyHorse reference-to-video: 1-9 loose image references via -c/--context.
3653
+ if (!Array.isArray(options.contextImages) || options.contextImages.length === 0) {
3654
+ fatalCliError('HappyHorse r2v requires 1-9 reference images via -c/--context.', { code: 'INVALID_ARGUMENT' });
3655
+ }
3656
+ if (options.refImage || options.refImageEnd) {
3657
+ fatalCliError('HappyHorse r2v takes reference images via -c/--context, not --ref/--ref-end.', { code: 'INVALID_ARGUMENT' });
3423
3658
  }
3424
3659
  if (options.refAudio || options.refVideo) {
3425
- fatalCliError('i2v does not accept reference audio/video.', { code: 'INVALID_ARGUMENT' });
3660
+ fatalCliError('HappyHorse r2v does not accept reference audio/video.', { code: 'INVALID_ARGUMENT' });
3426
3661
  }
3427
3662
  } else if (options.videoWorkflow === 's2v') {
3428
3663
  if (!options.refImage || !options.refAudio) {
@@ -3504,13 +3739,13 @@ if (options.video) {
3504
3739
  // they only support a single primary --ref-audio / --ref-video each.
3505
3740
  if (!isSeedanceVideo) {
3506
3741
  if (Array.isArray(options.refAudios) && options.refAudios.length > 0) {
3507
- fatalCliError('Multiple --ref-audio entries are only supported for Seedance models (seedance2, seedance2-fast).', {
3742
+ fatalCliError('Multiple --ref-audio entries are only supported for Seedance models (seedance2, seedance2-mini, seedance2-fast).', {
3508
3743
  code: 'INVALID_ARGUMENT',
3509
3744
  details: { model: options.model, extras: options.refAudios },
3510
3745
  });
3511
3746
  }
3512
3747
  if (Array.isArray(options.refVideos) && options.refVideos.length > 0) {
3513
- fatalCliError('Multiple --ref-video entries are only supported for Seedance models (seedance2, seedance2-fast).', {
3748
+ fatalCliError('Multiple --ref-video entries are only supported for Seedance models (seedance2, seedance2-mini, seedance2-fast).', {
3514
3749
  code: 'INVALID_ARGUMENT',
3515
3750
  details: { model: options.model, extras: options.refVideos },
3516
3751
  });
@@ -3564,11 +3799,12 @@ if (options.video) {
3564
3799
 
3565
3800
  applyVideoPromptGuardrails();
3566
3801
 
3567
- if (options.video && isSeedanceModel(options.model) && options.fps !== 24) {
3802
+ if (options.video && (isSeedanceModel(options.model) || isHappyHorseModel(options.model)) && options.fps !== 24) {
3568
3803
  const originalFps = options.fps;
3804
+ const vendorLabel = isHappyHorseModel(options.model) ? 'HappyHorse' : 'Seedance';
3569
3805
  options.fps = 24;
3570
3806
  if (!options.quiet) {
3571
- console.error(`Adjusted Seedance fps from ${originalFps} to 24 (Seedance uses fixed 24fps video generation).`);
3807
+ console.error(`Adjusted ${vendorLabel} fps from ${originalFps} to 24 (${vendorLabel} uses fixed 24fps video generation).`);
3572
3808
  }
3573
3809
  }
3574
3810
 
@@ -6556,6 +6792,32 @@ function enforceSeedanceReferenceCaps() {
6556
6792
  }
6557
6793
  }
6558
6794
 
6795
+ // Wraps the shared validateHappyHorseReferenceCounts() so a thrown
6796
+ // HappyHorseReferenceLimitError is re-raised as a CLI fatal error with the same
6797
+ // human message the hosted chat surfaces. HappyHorse caps are PER MODEL (mode):
6798
+ // t2v 0 images, i2v 1 first-frame image, r2v up to 9 reference images; it takes
6799
+ // no reference videos or audios (audio is rendered natively). Source of truth:
6800
+ // @sogni-ai/sogni-intelligence-client/tools HAPPYHORSE_REFERENCE_LIMITS.
6801
+ function enforceHappyHorseReferenceCaps() {
6802
+ try {
6803
+ validateHappyHorseReferenceCounts(options.model, effectiveSeedanceReferenceCounts());
6804
+ } catch (err) {
6805
+ if (err instanceof HappyHorseReferenceLimitError) {
6806
+ fatalCliError(err.message, {
6807
+ code: err.code,
6808
+ details: {
6809
+ modelId: err.modelId,
6810
+ limitKind: err.limitKind,
6811
+ requestedCount: err.requestedCount,
6812
+ maxCount: err.maxCount,
6813
+ limits: getHappyHorseReferenceLimits(options.model) || HAPPYHORSE_REFERENCE_LIMITS,
6814
+ },
6815
+ });
6816
+ }
6817
+ throw err;
6818
+ }
6819
+ }
6820
+
6559
6821
  function resolveMultiAngleOutputConfig(outputPath, outputFormat) {
6560
6822
  if (!outputPath) return null;
6561
6823
  const ext = extname(outputPath);
@@ -8197,16 +8459,26 @@ async function main() {
8197
8459
  if (options.refVideo) log(`Reference video: ${options.refVideo}`);
8198
8460
 
8199
8461
  const isSeedanceVideo = isSeedanceModel(options.model);
8462
+ const isHappyHorseVideo = isHappyHorseModel(options.model);
8463
+ // Vendor video models forward image references as HTTPS URL arrays (or
8464
+ // Sogni-hosted uploads) instead of inline buffers; HappyHorse takes
8465
+ // image-only references (i2v first_frame, r2v reference_image).
8466
+ const isVendorReferenceVideo = isSeedanceVideo || isHappyHorseVideo;
8200
8467
  if (isSeedanceVideo) {
8201
8468
  // Source of truth: @sogni-ai/sogni-protocol catalogs/seedance-reference-limits.json
8202
8469
  // surfaced through @sogni-ai/sogni-intelligence-client/tools.
8203
8470
  enforceSeedanceReferenceCaps();
8204
8471
  }
8472
+ if (isHappyHorseVideo) {
8473
+ // Source of truth: @sogni-ai/sogni-intelligence-client/tools
8474
+ // HAPPYHORSE_REFERENCE_LIMITS (per-mode image-only caps).
8475
+ enforceHappyHorseReferenceCaps();
8476
+ }
8205
8477
  const seedanceReferenceImageUrls = [];
8206
8478
  const seedanceReferenceVideoUrls = [];
8207
8479
  const seedanceReferenceAudioUrls = [];
8208
- const useRefImageUrl = isSeedanceVideo && await appendSafeSeedanceReferenceUrl(seedanceReferenceImageUrls, options.refImage, 'Reference image');
8209
- const useRefImageEndUrl = isSeedanceVideo && await appendSafeSeedanceReferenceUrl(seedanceReferenceImageUrls, options.refImageEnd, 'End reference image');
8480
+ const useRefImageUrl = isVendorReferenceVideo && await appendSafeSeedanceReferenceUrl(seedanceReferenceImageUrls, options.refImage, 'Reference image');
8481
+ const useRefImageEndUrl = isVendorReferenceVideo && await appendSafeSeedanceReferenceUrl(seedanceReferenceImageUrls, options.refImageEnd, 'End reference image');
8210
8482
  const refAudioFormatByPath = options.refAudio
8211
8483
  ? detectReferenceAudioFormat(
8212
8484
  new Uint8Array(),
@@ -8250,19 +8522,19 @@ async function main() {
8250
8522
  }
8251
8523
  }
8252
8524
 
8253
- // Seedance loose-reference extras: -c/--context images beyond start/end,
8254
- // plus repeated --ref-audio / --ref-video entries past the first. The
8255
- // Sogni Client SDK accepts only URL arrays for these (createJobRequestMessage),
8256
- // so each entry must resolve to an HTTPS URL. HTTPS inputs are forwarded as-is
8257
- // (SSRF-validated); local files are uploaded to a Sogni-hosted URL first, the
8258
- // same way the primary --ref-audio / --ref-video locals are handled. This lets
8259
- // `-c <local image>` work in direct generation without a detour through
8260
- // --api-chat / --durable-chat.
8261
- if (isSeedanceVideo) {
8525
+ // Vendor loose image references: -c/--context images beyond start/end.
8526
+ // The Sogni Client SDK accepts only URL arrays for these
8527
+ // (createJobRequestMessage), so each entry must resolve to an HTTPS URL.
8528
+ // HTTPS inputs are forwarded as-is (SSRF-validated); local files are
8529
+ // uploaded to a Sogni-hosted URL first. This lets `-c <local image>` work
8530
+ // in direct generation without a detour through --api-chat / --durable-chat.
8531
+ // Seedance treats these as @ImageN loose refs; HappyHorse r2v treats them
8532
+ // as reference_image inputs (up to 9).
8533
+ if (isVendorReferenceVideo) {
8262
8534
  for (const [ctxIndex, ctxImage] of (Array.isArray(options.contextImages) ? options.contextImages : []).entries()) {
8263
8535
  if (!ctxImage) continue;
8264
8536
  if (isHttpsUrl(ctxImage)) {
8265
- await appendSafeSeedanceReferenceUrl(seedanceReferenceImageUrls, ctxImage, 'Seedance image reference');
8537
+ await appendSafeSeedanceReferenceUrl(seedanceReferenceImageUrls, ctxImage, 'Image reference');
8266
8538
  } else {
8267
8539
  const uploadedImageUrl = await uploadSeedanceReferenceImageUrl(
8268
8540
  ctxImage,
@@ -8272,6 +8544,10 @@ async function main() {
8272
8544
  seedanceReferenceImageUrls.push(uploadedImageUrl);
8273
8545
  }
8274
8546
  }
8547
+ }
8548
+ // Seedance-only loose extras: repeated --ref-audio / --ref-video entries
8549
+ // past the first. HappyHorse takes no reference audio or video.
8550
+ if (isSeedanceVideo) {
8275
8551
  for (const [extraAudioIndex, extraAudio] of options.refAudios.entries()) {
8276
8552
  if (!isHttpsUrl(extraAudio)) {
8277
8553
  fatalCliError(
@@ -8439,7 +8715,9 @@ async function main() {
8439
8715
  if (options.seed !== null && options.seed !== undefined) {
8440
8716
  projectConfig.seed = options.seed;
8441
8717
  }
8442
- if (Number.isFinite(steps)) {
8718
+ if (Number.isFinite(steps) && !isHappyHorseVideo) {
8719
+ // HappyHorse routes through the vendor-job path and ignores `steps`,
8720
+ // mirroring Seedance (whose model defaults already omit them).
8443
8721
  projectConfig.steps = steps;
8444
8722
  }
8445
8723
  if (guidance !== null && guidance !== undefined) {
@@ -9099,7 +9377,7 @@ async function main() {
9099
9377
  success: false,
9100
9378
  error: error.message,
9101
9379
  prompt: options.prompt ?? null
9102
- }, error);
9380
+ }, error, { modelId: options.model });
9103
9381
  if (error.code) payload.errorCode = error.code;
9104
9382
  if (error.details) payload.errorDetails = error.details;
9105
9383
  // Don't let a stale per-error hint overwrite the canonical
@@ -9134,10 +9412,10 @@ async function main() {
9134
9412
  if (IS_OPENCLAW_INVOCATION) payload.openclaw = true;
9135
9413
  console.log(JSON.stringify(payload));
9136
9414
  if (!options.json) {
9137
- printHumanError(error);
9415
+ printHumanError(error, { modelId: options.model });
9138
9416
  }
9139
9417
  } else {
9140
- printHumanError(error);
9418
+ printHumanError(error, { modelId: options.model });
9141
9419
  }
9142
9420
  } finally {
9143
9421
  try {
package/version.mjs CHANGED
@@ -1 +1 @@
1
- export const PACKAGE_VERSION = '3.6.4';
1
+ export const PACKAGE_VERSION = '3.8.0';