@sogni-ai/sogni-creative-agent-skill 3.7.0 → 3.9.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/CHANGELOG.md +37 -0
- package/README.md +7 -7
- package/SKILL.md +16 -9
- package/llm.txt +6 -4
- package/openclaw.plugin.json +1 -1
- package/package.json +2 -2
- package/references/hosted-api.md +1 -1
- package/references/models.md +71 -3
- package/references/video-editing.md +19 -7
- package/references/video-prompting.md +1 -1
- package/skill-package.json +1 -1
- package/skills/asset_reference_management.md +1 -1
- package/skills/image_generation.md +8 -2
- package/skills/video_editing.md +4 -3
- package/skills/video_generation.md +4 -3
- package/sogni-agent.mjs +613 -64
- package/version.mjs +1 -1
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.
|
|
323
|
-
speed: 'ace_step_1.
|
|
324
|
-
fast: 'ace_step_1.
|
|
325
|
-
sft: 'ace_step_1.
|
|
326
|
-
lyrics: 'ace_step_1.
|
|
327
|
-
lyric: 'ace_step_1.
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
|
@@ -1406,6 +1555,14 @@ const MULTI_ANGLE_DISTANCE_ALIASES = new Map([
|
|
|
1406
1555
|
['wide shot', 'wide']
|
|
1407
1556
|
]);
|
|
1408
1557
|
|
|
1558
|
+
const VIDEO_CONTROLNET_NAMES = ['canny', 'pose', 'depth', 'detailer', 'outpaint', 'inpaint'];
|
|
1559
|
+
const VIDEO_CONTROLNET_NAME_SET = new Set(VIDEO_CONTROLNET_NAMES);
|
|
1560
|
+
const OUTPAINT_POSITIONS = ['center', 'top', 'bottom', 'left', 'right'];
|
|
1561
|
+
const OUTPAINT_POSITION_SET = new Set(OUTPAINT_POSITIONS);
|
|
1562
|
+
const LTX_TRANSITION_LORA_ID = 'transition';
|
|
1563
|
+
const LTX_TRANSITION_TRIGGER = 'zhuanchang';
|
|
1564
|
+
const LTX_TRANSITION_DEFAULT_STRENGTH = 1.0;
|
|
1565
|
+
|
|
1409
1566
|
function normalizeMultiAngleValue(value, aliases, allowedKeys, label) {
|
|
1410
1567
|
if (!value) return null;
|
|
1411
1568
|
const normalized = value.toLowerCase().replace(/_/g, '-').replace(/\s+/g, ' ').trim();
|
|
@@ -1428,6 +1585,123 @@ function buildMultiAnglePrompt({ azimuth, elevation, distance, description }) {
|
|
|
1428
1585
|
return parts.join(' ');
|
|
1429
1586
|
}
|
|
1430
1587
|
|
|
1588
|
+
function normalizeVideoControlNetName(value) {
|
|
1589
|
+
if (!value) return null;
|
|
1590
|
+
const normalized = String(value).trim().toLowerCase().replace(/_/g, '-');
|
|
1591
|
+
return normalized || null;
|
|
1592
|
+
}
|
|
1593
|
+
|
|
1594
|
+
function normalizeOutpaintPositionValue(value) {
|
|
1595
|
+
if (!value) return null;
|
|
1596
|
+
const normalized = String(value).trim().toLowerCase().replace(/_/g, '-');
|
|
1597
|
+
return OUTPAINT_POSITION_SET.has(normalized) ? normalized : null;
|
|
1598
|
+
}
|
|
1599
|
+
|
|
1600
|
+
function parseOutpaintAspectRatio(value) {
|
|
1601
|
+
if (!value) return null;
|
|
1602
|
+
const match = String(value).trim().match(/^(\d+(?:\.\d+)?)\s*[:x/]\s*(\d+(?:\.\d+)?)$/i);
|
|
1603
|
+
if (!match) return null;
|
|
1604
|
+
const width = Number(match[1]);
|
|
1605
|
+
const height = Number(match[2]);
|
|
1606
|
+
if (!Number.isFinite(width) || !Number.isFinite(height) || width <= 0 || height <= 0) return null;
|
|
1607
|
+
return width / height;
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1610
|
+
function isLtx23V2VModelId(modelId) {
|
|
1611
|
+
return !!modelId && modelId.includes('ltx23') && /_v2v(_|$)/.test(modelId);
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1614
|
+
function isLtxI2vTransitionModelId(modelId) {
|
|
1615
|
+
return !!modelId && modelId.includes('ltx') && /_i2v(_|$)/.test(modelId);
|
|
1616
|
+
}
|
|
1617
|
+
|
|
1618
|
+
function applyLtxTransitionLora(projectConfig, modelId, hasStartFrame, hasEndFrame) {
|
|
1619
|
+
if (!hasStartFrame || !hasEndFrame || !isLtxI2vTransitionModelId(modelId)) {
|
|
1620
|
+
return;
|
|
1621
|
+
}
|
|
1622
|
+
const loras = Array.isArray(projectConfig.loras) ? [...projectConfig.loras] : [];
|
|
1623
|
+
const loraStrengths = Array.isArray(projectConfig.loraStrengths) ? [...projectConfig.loraStrengths] : [];
|
|
1624
|
+
if (!loras.includes(LTX_TRANSITION_LORA_ID)) {
|
|
1625
|
+
loras.push(LTX_TRANSITION_LORA_ID);
|
|
1626
|
+
loraStrengths.push(LTX_TRANSITION_DEFAULT_STRENGTH);
|
|
1627
|
+
}
|
|
1628
|
+
projectConfig.loras = loras;
|
|
1629
|
+
projectConfig.loraStrengths = loraStrengths;
|
|
1630
|
+
const prompt = String(projectConfig.positivePrompt || '');
|
|
1631
|
+
if (!new RegExp(`\\b${LTX_TRANSITION_TRIGGER}\\b`, 'i').test(prompt)) {
|
|
1632
|
+
projectConfig.positivePrompt = prompt ? `${prompt}, ${LTX_TRANSITION_TRIGGER}` : LTX_TRANSITION_TRIGGER;
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
function computeOutpaintCanvas(sourceWidth, sourceHeight, aspectRatioArg, position, rules = DEFAULT_VIDEO_DIMENSION_RULES) {
|
|
1637
|
+
const step = rules.dimensionMultiple || DEFAULT_VIDEO_DIMENSION_RULES.dimensionMultiple;
|
|
1638
|
+
const minD = rules.minDimension || DEFAULT_VIDEO_DIMENSION_RULES.minDimension;
|
|
1639
|
+
const maxD = rules.maxDimension || DEFAULT_VIDEO_DIMENSION_RULES.maxDimension;
|
|
1640
|
+
let srcW = Number.isFinite(sourceWidth) && sourceWidth > 0 ? sourceWidth : 1920;
|
|
1641
|
+
let srcH = Number.isFinite(sourceHeight) && sourceHeight > 0 ? sourceHeight : 1088;
|
|
1642
|
+
if (srcW > maxD || srcH > maxD) {
|
|
1643
|
+
const scale = Math.min(maxD / srcW, maxD / srcH);
|
|
1644
|
+
srcW *= scale;
|
|
1645
|
+
srcH *= scale;
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1648
|
+
let targetW = srcW;
|
|
1649
|
+
let targetH = srcH;
|
|
1650
|
+
const parsedAspect = parseOutpaintAspectRatio(aspectRatioArg);
|
|
1651
|
+
if (parsedAspect) {
|
|
1652
|
+
const srcAspect = srcW / srcH;
|
|
1653
|
+
if (parsedAspect > srcAspect) targetW = srcH * parsedAspect;
|
|
1654
|
+
else if (parsedAspect < srcAspect) targetH = srcW / parsedAspect;
|
|
1655
|
+
} else {
|
|
1656
|
+
const factor = 1.5;
|
|
1657
|
+
if (position === 'left' || position === 'right') targetW = srcW * factor;
|
|
1658
|
+
else if (position === 'top' || position === 'bottom') targetH = srcH * factor;
|
|
1659
|
+
else {
|
|
1660
|
+
targetW = srcW * factor;
|
|
1661
|
+
targetH = srcH * factor;
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
|
|
1665
|
+
const snapUp = (value) => Math.ceil(value / step) * step;
|
|
1666
|
+
let width = Math.min(maxD, Math.max(minD, snapUp(targetW)));
|
|
1667
|
+
let height = Math.min(maxD, Math.max(minD, snapUp(targetH)));
|
|
1668
|
+
width = Math.max(width, Math.min(maxD, snapUp(srcW)));
|
|
1669
|
+
height = Math.max(height, Math.min(maxD, snapUp(srcH)));
|
|
1670
|
+
return { width, height };
|
|
1671
|
+
}
|
|
1672
|
+
|
|
1673
|
+
function computeSourceAspectCanvas(sourceWidth, sourceHeight, rules = DEFAULT_VIDEO_DIMENSION_RULES, targetResolution = null) {
|
|
1674
|
+
const step = rules.dimensionMultiple || DEFAULT_VIDEO_DIMENSION_RULES.dimensionMultiple;
|
|
1675
|
+
const minD = rules.minDimension || DEFAULT_VIDEO_DIMENSION_RULES.minDimension;
|
|
1676
|
+
const maxD = rules.maxDimension || DEFAULT_VIDEO_DIMENSION_RULES.maxDimension;
|
|
1677
|
+
let width = Number.isFinite(sourceWidth) && sourceWidth > 0 ? sourceWidth : 1920;
|
|
1678
|
+
let height = Number.isFinite(sourceHeight) && sourceHeight > 0 ? sourceHeight : 1088;
|
|
1679
|
+
if (Number.isFinite(targetResolution) && targetResolution > 0) {
|
|
1680
|
+
const roundedTarget = Math.max(minD, Math.round(targetResolution / step) * step);
|
|
1681
|
+
if (width <= height) {
|
|
1682
|
+
height = Math.round((height * roundedTarget) / width / step) * step;
|
|
1683
|
+
width = roundedTarget;
|
|
1684
|
+
} else {
|
|
1685
|
+
width = Math.round((width * roundedTarget) / height / step) * step;
|
|
1686
|
+
height = roundedTarget;
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1689
|
+
if (width > maxD || height > maxD) {
|
|
1690
|
+
const scale = Math.min(maxD / width, maxD / height);
|
|
1691
|
+
width *= scale;
|
|
1692
|
+
height *= scale;
|
|
1693
|
+
}
|
|
1694
|
+
if (width < minD || height < minD) {
|
|
1695
|
+
const scale = Math.max(minD / width, minD / height);
|
|
1696
|
+
width *= scale;
|
|
1697
|
+
height *= scale;
|
|
1698
|
+
}
|
|
1699
|
+
return {
|
|
1700
|
+
width: Math.max(minD, Math.min(maxD, Math.round(width / step) * step)),
|
|
1701
|
+
height: Math.max(minD, Math.min(maxD, Math.round(height / step) * step))
|
|
1702
|
+
};
|
|
1703
|
+
}
|
|
1704
|
+
|
|
1431
1705
|
function loadOpenClawPluginConfig() {
|
|
1432
1706
|
const openclawPluginConfig = getEnv('OPENCLAW_PLUGIN_CONFIG');
|
|
1433
1707
|
if (openclawPluginConfig) {
|
|
@@ -1533,6 +1807,9 @@ const options = {
|
|
|
1533
1807
|
refVideo: null, // Reference video for animate workflows (primary)
|
|
1534
1808
|
refVideos: [], // Additional Seedance loose video refs; first --ref-video fills refVideo, subsequent calls append here
|
|
1535
1809
|
videoStart: null, // Optional start offset into reference video
|
|
1810
|
+
refMask: null, // Inpaint mask image for LTX-2.3 v2v inpaint
|
|
1811
|
+
outpaintPosition: null, // LTX-2.3 v2v outpaint canvas anchor
|
|
1812
|
+
outpaintAspectRatio: null, // Optional target aspect ratio for outpaint canvas growth
|
|
1536
1813
|
contextImages: [], // Context images for image editing
|
|
1537
1814
|
looping: false, // Create looping video (i2v only): generate A→B then B→A and concatenate
|
|
1538
1815
|
photobooth: false, // Photobooth mode (InstantID face transfer)
|
|
@@ -1677,6 +1954,9 @@ const cliSet = {
|
|
|
1677
1954
|
refVideo: false,
|
|
1678
1955
|
refVideos: false,
|
|
1679
1956
|
videoStart: false,
|
|
1957
|
+
refMask: false,
|
|
1958
|
+
outpaintPosition: false,
|
|
1959
|
+
outpaintAspectRatio: false,
|
|
1680
1960
|
context: false,
|
|
1681
1961
|
looping: false,
|
|
1682
1962
|
photobooth: false,
|
|
@@ -2033,16 +2313,31 @@ for (let i = 0; i < args.length; i++) {
|
|
|
2033
2313
|
i++;
|
|
2034
2314
|
options.cnGuidanceEnd = parseNumberValue(raw, arg);
|
|
2035
2315
|
cliSet.cnGuidanceEnd = true;
|
|
2036
|
-
} else if (arg === '--controlnet-name') {
|
|
2316
|
+
} else if (arg === '--controlnet-name' || arg === '--control-type') {
|
|
2037
2317
|
const raw = requireFlagValue(args, i, arg);
|
|
2038
2318
|
i++;
|
|
2039
|
-
options.videoControlNetName = raw;
|
|
2319
|
+
options.videoControlNetName = normalizeVideoControlNetName(raw);
|
|
2040
2320
|
cliSet.videoControlNetName = true;
|
|
2041
2321
|
} else if (arg === '--controlnet-strength') {
|
|
2042
2322
|
const raw = requireFlagValue(args, i, arg);
|
|
2043
2323
|
i++;
|
|
2044
2324
|
options.videoControlNetStrength = parseNumberValue(raw, arg);
|
|
2045
2325
|
cliSet.videoControlNetStrength = true;
|
|
2326
|
+
} else if (arg === '--mask' || arg === '--ref-mask' || arg === '--reference-mask') {
|
|
2327
|
+
const raw = expandHomePath(requireFlagValue(args, i, arg));
|
|
2328
|
+
i++;
|
|
2329
|
+
options.refMask = raw;
|
|
2330
|
+
cliSet.refMask = true;
|
|
2331
|
+
} else if (arg === '--outpaint-position') {
|
|
2332
|
+
const raw = requireFlagValue(args, i, arg);
|
|
2333
|
+
i++;
|
|
2334
|
+
options.outpaintPosition = raw;
|
|
2335
|
+
cliSet.outpaintPosition = true;
|
|
2336
|
+
} else if (arg === '--outpaint-aspect-ratio' || arg === '--outpaint-ratio') {
|
|
2337
|
+
const raw = requireFlagValue(args, i, arg);
|
|
2338
|
+
i++;
|
|
2339
|
+
options.outpaintAspectRatio = raw;
|
|
2340
|
+
cliSet.outpaintAspectRatio = true;
|
|
2046
2341
|
} else if (arg === '--sam2-coordinates') {
|
|
2047
2342
|
const raw = requireFlagValue(args, i, arg);
|
|
2048
2343
|
i++;
|
|
@@ -2507,7 +2802,7 @@ Photobooth (Face Transfer):
|
|
|
2507
2802
|
|
|
2508
2803
|
Music Options:
|
|
2509
2804
|
--music Generate music/audio instead of image
|
|
2510
|
-
--music-model <id> Music model: turbo|sft|ace_step_1.
|
|
2805
|
+
--music-model <id> Music model: turbo|sft|ace_step_1.5_xl_turbo|ace_step_1.5_xl_sft
|
|
2511
2806
|
--lyrics <text> Optional song lyrics (omit for instrumental)
|
|
2512
2807
|
--language <code> Lyrics language code (default: en)
|
|
2513
2808
|
--duration <sec> Music duration in seconds (10-600, default: 30)
|
|
@@ -2546,7 +2841,7 @@ Video Options:
|
|
|
2546
2841
|
first entry is the primary, extras must be HTTPS URLs in CLI
|
|
2547
2842
|
direct-gen. On LTX/WAN: single primary for animate/v2v workflows.
|
|
2548
2843
|
|
|
2549
|
-
Seedance Reference Modes (mutually exclusive on seedance2 / seedance2-fast):
|
|
2844
|
+
Seedance Reference Modes (mutually exclusive on seedance2 / seedance2-mini / seedance2-fast):
|
|
2550
2845
|
- DEDICATED FRAME MODE: --ref (first frame) and/or --ref-end (last frame).
|
|
2551
2846
|
Best when you want canonical first/last frame anchoring; max 2 images.
|
|
2552
2847
|
- LOOSE REFERENCE MODE: -c/--context image refs plus optional --ref-audio /
|
|
@@ -2557,8 +2852,12 @@ Seedance Reference Modes (mutually exclusive on seedance2 / seedance2-fast):
|
|
|
2557
2852
|
All three modalities pull caps from the canonical
|
|
2558
2853
|
@sogni-ai/sogni-protocol seedance-reference-limits catalog.
|
|
2559
2854
|
--video-start <sec> Start offset into --ref-video for segmented V2V/animate
|
|
2560
|
-
--controlnet-name <n> ControlNet type for v2v: canny|pose|depth|detailer
|
|
2855
|
+
--controlnet-name <n> ControlNet type for v2v: canny|pose|depth|detailer|outpaint|inpaint
|
|
2856
|
+
--control-type <n> Alias for --controlnet-name
|
|
2561
2857
|
--controlnet-strength <n> ControlNet strength for v2v (0.0-1.0, default: 0.8)
|
|
2858
|
+
--mask <path|url> Inpaint mask image for LTX-2.3 v2v inpaint (white = regenerate)
|
|
2859
|
+
--outpaint-position <p> LTX-2.3 outpaint anchor: center|top|bottom|left|right
|
|
2860
|
+
--outpaint-aspect-ratio <r> LTX-2.3 outpaint target ratio, e.g. 16:9 or 9:16
|
|
2562
2861
|
--sam2-coordinates <coords> SAM2 click coords for animate-replace (x,y or x1,y1;x2,y2)
|
|
2563
2862
|
--trim-end-frame Trim last frame for seamless video stitching
|
|
2564
2863
|
--first-frame-strength <n> Keyframe strength for start frame (0.0-1.0)
|
|
@@ -2664,6 +2963,7 @@ Personas (named people with reference photos):
|
|
|
2664
2963
|
Image Models:
|
|
2665
2964
|
z_image_turbo_bf16 Fast, general purpose (default)
|
|
2666
2965
|
gpt-image-2 OpenAI GPT Image 2 text-to-image and edit (up to 16 context images)
|
|
2966
|
+
krea2_turbo_fp8_scaled Krea 2 Turbo text-to-image
|
|
2667
2967
|
flux1-schnell-fp8 Very fast
|
|
2668
2968
|
flux2_dev_fp8 High quality (slow)
|
|
2669
2969
|
qwen_image_edit_2511_fp8 Image editing with context (up to 3 images)
|
|
@@ -2677,15 +2977,23 @@ Recommended LTX 2.3 Video Models:
|
|
|
2677
2977
|
ltx23-22b-fp8_v2v_distilled Video-to-video with ControlNet
|
|
2678
2978
|
|
|
2679
2979
|
Music Models:
|
|
2680
|
-
ace_step_1.
|
|
2681
|
-
ace_step_1.
|
|
2980
|
+
ace_step_1.5_xl_turbo Default direct music generation
|
|
2981
|
+
ace_step_1.5_xl_sft Quality variant with stronger lyric handling
|
|
2982
|
+
ace_step_1.5_turbo Legacy direct music generation
|
|
2983
|
+
ace_step_1.5_sft Legacy lyric-focused music generation
|
|
2682
2984
|
|
|
2683
2985
|
Seedance 2.0 Video Model Selectors:
|
|
2684
2986
|
seedance2 Text-to-video, 4-15s, native audio, HTTPS multimodal refs
|
|
2685
|
-
seedance2-
|
|
2987
|
+
seedance2-mini Lower-cost 720p-capped text-to-video
|
|
2988
|
+
seedance2-fast Legacy fast 720p-capped text-to-video
|
|
2686
2989
|
seedance2-ia2v Image+audio-to-video
|
|
2687
2990
|
seedance2-v2v Video-to-video without ControlNet
|
|
2688
2991
|
|
|
2992
|
+
HappyHorse 1.1 Video Model Selectors (3-15s, fixed 24fps, native audio, 720P/1080P):
|
|
2993
|
+
happyhorse-1.1-t2v Text-to-video (also accepts the bare "happyhorse" alias)
|
|
2994
|
+
happyhorse-1.1-i2v Image-to-video from a single first-frame image (--ref)
|
|
2995
|
+
happyhorse-1.1-r2v Reference-to-video from 1-9 reference images (-c/--context)
|
|
2996
|
+
|
|
2689
2997
|
WAN 2.2 Video Models:
|
|
2690
2998
|
wan_v2.2-14b-fp8_t2v_lightx2v Text-to-video (fast)
|
|
2691
2999
|
wan_v2.2-14b-fp8_i2v_lightx2v Fast simple image-to-video
|
|
@@ -3114,13 +3422,18 @@ if (options.angles360Video && !options.angles360) {
|
|
|
3114
3422
|
if (options.video) {
|
|
3115
3423
|
if (options.videoWorkflow) {
|
|
3116
3424
|
const normalized = normalizeVideoWorkflow(options.videoWorkflow);
|
|
3117
|
-
if (
|
|
3118
|
-
|
|
3425
|
+
if (normalized) {
|
|
3426
|
+
options.videoWorkflow = normalized;
|
|
3427
|
+
} else if (options.videoWorkflow === 'r2v' && isHappyHorseModelSelectionLocal(options.model)) {
|
|
3428
|
+
// HappyHorse adds a reference-to-video (r2v) mode that the shared
|
|
3429
|
+
// SkillVideoWorkflow enum does not carry; accept it for HappyHorse only.
|
|
3430
|
+
options.videoWorkflow = 'r2v';
|
|
3431
|
+
} else {
|
|
3432
|
+
fatalCliError(`Unknown workflow "${options.videoWorkflow}". Use t2v|i2v|s2v|ia2v|a2v|v2v|animate-move|animate-replace (r2v on HappyHorse).`, {
|
|
3119
3433
|
code: 'INVALID_ARGUMENT',
|
|
3120
3434
|
details: { workflow: options.videoWorkflow }
|
|
3121
3435
|
});
|
|
3122
3436
|
}
|
|
3123
|
-
options.videoWorkflow = normalized;
|
|
3124
3437
|
}
|
|
3125
3438
|
|
|
3126
3439
|
if (
|
|
@@ -3144,6 +3457,32 @@ if (options.video) {
|
|
|
3144
3457
|
}
|
|
3145
3458
|
}
|
|
3146
3459
|
|
|
3460
|
+
// HappyHorse 1.1 has no v2v/ia2v. A concrete `happyhorse-1.1-<mode>` id pins
|
|
3461
|
+
// the workflow; the bare `happyhorse` / `happyhorse-1.1` alias infers t2v by
|
|
3462
|
+
// default, i2v from a single first-frame image (--ref), and r2v from loose
|
|
3463
|
+
// -c/--context reference images (1-9). Pin the concrete per-mode model id.
|
|
3464
|
+
if (isHappyHorseModelSelectionLocal(options.model)) {
|
|
3465
|
+
const pinnedMode = happyHorseModeFromModelId(options.model);
|
|
3466
|
+
if (pinnedMode) {
|
|
3467
|
+
if (options.videoWorkflow && options.videoWorkflow !== pinnedMode) {
|
|
3468
|
+
fatalCliError(`Workflow "${options.videoWorkflow}" does not match model "${options.model}".`, {
|
|
3469
|
+
code: 'INVALID_ARGUMENT',
|
|
3470
|
+
details: { workflow: options.videoWorkflow, model: options.model }
|
|
3471
|
+
});
|
|
3472
|
+
}
|
|
3473
|
+
options.videoWorkflow = pinnedMode;
|
|
3474
|
+
} else if (!options.videoWorkflow) {
|
|
3475
|
+
if (Array.isArray(options.contextImages) && options.contextImages.length > 0) {
|
|
3476
|
+
options.videoWorkflow = 'r2v';
|
|
3477
|
+
} else if (options.refImage) {
|
|
3478
|
+
options.videoWorkflow = 'i2v';
|
|
3479
|
+
} else {
|
|
3480
|
+
options.videoWorkflow = 't2v';
|
|
3481
|
+
}
|
|
3482
|
+
}
|
|
3483
|
+
options.model = resolveHappyHorseModelId(options.model, options.videoWorkflow);
|
|
3484
|
+
}
|
|
3485
|
+
|
|
3147
3486
|
const workflowFromModel = inferVideoWorkflowFromModel(resolveVideoModelAlias(options.model, options.videoWorkflow));
|
|
3148
3487
|
if (options.videoWorkflow && workflowFromModel && options.videoWorkflow !== workflowFromModel) {
|
|
3149
3488
|
fatalCliError(`Workflow "${options.videoWorkflow}" does not match model "${options.model}".`, {
|
|
@@ -3180,7 +3519,7 @@ if (options.music) {
|
|
|
3180
3519
|
const configuredMusicModel = options.model || openclawConfig?.defaultMusicModel || 'turbo';
|
|
3181
3520
|
options.model = normalizeMusicModelId(configuredMusicModel);
|
|
3182
3521
|
if (!options.model) {
|
|
3183
|
-
fatalCliError(`Unknown music model "${configuredMusicModel}". Use turbo, sft, ace_step_1.
|
|
3522
|
+
fatalCliError(`Unknown music model "${configuredMusicModel}". Use turbo, sft, ace_step_1.5_xl_turbo, or ace_step_1.5_xl_sft.`, {
|
|
3184
3523
|
code: 'INVALID_ARGUMENT',
|
|
3185
3524
|
details: { flag: cliSet.model ? '--model' : 'defaultMusicModel', value: configuredMusicModel }
|
|
3186
3525
|
});
|
|
@@ -3214,12 +3553,22 @@ if (options.music) {
|
|
|
3214
3553
|
options.model = options.model || selectDefaultVideoModel(options.videoWorkflow, options, openclawConfig) || 'wan_v2.2-14b-fp8_i2v_lightx2v';
|
|
3215
3554
|
options.model = resolveVideoModelAlias(options.model, options.videoWorkflow);
|
|
3216
3555
|
const videoModelDefaults = getModelDefaults(options.model, openclawConfig);
|
|
3556
|
+
// Fall back to skill-local defaults for models the intel registry does not
|
|
3557
|
+
// carry (e.g. HappyHorse), so they get a sensible 16:9 default instead of the
|
|
3558
|
+
// 512x512 square. Registry defaults still take precedence when present.
|
|
3559
|
+
const videoModelDimensionFallback = videoModelDimensionDefaultsLikeWrapper(options.model);
|
|
3560
|
+
const defaultVideoWidth = Number.isFinite(videoModelDefaults?.defaultWidth)
|
|
3561
|
+
? videoModelDefaults.defaultWidth
|
|
3562
|
+
: videoModelDimensionFallback?.defaultWidth;
|
|
3563
|
+
const defaultVideoHeight = Number.isFinite(videoModelDefaults?.defaultHeight)
|
|
3564
|
+
? videoModelDefaults.defaultHeight
|
|
3565
|
+
: videoModelDimensionFallback?.defaultHeight;
|
|
3217
3566
|
const isSeedanceVideo = isSeedanceModel(options.model);
|
|
3218
|
-
if (!cliSet.width && !widthFromConfig && !widthFromPrompt && Number.isFinite(
|
|
3219
|
-
options.width =
|
|
3567
|
+
if (!cliSet.width && !widthFromConfig && !widthFromPrompt && Number.isFinite(defaultVideoWidth)) {
|
|
3568
|
+
options.width = defaultVideoWidth;
|
|
3220
3569
|
}
|
|
3221
|
-
if (!cliSet.height && !heightFromConfig && !heightFromPrompt && Number.isFinite(
|
|
3222
|
-
options.height =
|
|
3570
|
+
if (!cliSet.height && !heightFromConfig && !heightFromPrompt && Number.isFinite(defaultVideoHeight)) {
|
|
3571
|
+
options.height = defaultVideoHeight;
|
|
3223
3572
|
}
|
|
3224
3573
|
if (!cliSet.fps && !fpsFromConfig && Number.isFinite(videoModelDefaults?.fps)) {
|
|
3225
3574
|
options.fps = videoModelDefaults.fps;
|
|
@@ -3384,8 +3733,8 @@ if (options.apiChat && !options.prompt && getApiModeMediaReferences().length ===
|
|
|
3384
3733
|
fatalCliError('--api-chat requires a prompt or media reference for planning.', { code: 'INVALID_ARGUMENT' });
|
|
3385
3734
|
}
|
|
3386
3735
|
|
|
3387
|
-
if (!options.video && !options.apiChat && !options.apiWorkflowAction && (options.refAudio || options.refVideo || options.referenceAudioIdentity || options.voicePersonaName || options.videoWorkflow || options.frames || options.targetResolution || options.audioStart !== null || options.audioDuration !== null || options.videoStart !== null)) {
|
|
3388
|
-
fatalCliError('Video-only options (--workflow/--frames/--target-resolution/--ref-audio/--ref-video/--reference-audio-identity/--voice-persona) require --video.', {
|
|
3736
|
+
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)) {
|
|
3737
|
+
fatalCliError('Video-only options (--workflow/--frames/--target-resolution/--ref-audio/--ref-video/--mask/--outpaint-position/--reference-audio-identity/--voice-persona) require --video.', {
|
|
3389
3738
|
code: 'INVALID_ARGUMENT'
|
|
3390
3739
|
});
|
|
3391
3740
|
}
|
|
@@ -3404,12 +3753,25 @@ if (options.photobooth) {
|
|
|
3404
3753
|
|
|
3405
3754
|
if (options.video) {
|
|
3406
3755
|
const isSeedanceVideo = isSeedanceModel(options.model);
|
|
3756
|
+
const isHappyHorseVideo = isHappyHorseModel(options.model);
|
|
3407
3757
|
if (isSeedanceVideo && !['t2v', 'ia2v', 'v2v'].includes(options.videoWorkflow)) {
|
|
3408
3758
|
fatalCliError('Seedance models support only t2v, ia2v, or v2v workflows.', {
|
|
3409
3759
|
code: 'INVALID_ARGUMENT',
|
|
3410
3760
|
details: { workflow: options.videoWorkflow, model: options.model }
|
|
3411
3761
|
});
|
|
3412
3762
|
}
|
|
3763
|
+
if (isHappyHorseVideo && !['t2v', 'i2v', 'r2v'].includes(options.videoWorkflow)) {
|
|
3764
|
+
fatalCliError('HappyHorse models support only t2v, i2v, or r2v workflows.', {
|
|
3765
|
+
code: 'INVALID_ARGUMENT',
|
|
3766
|
+
details: { workflow: options.videoWorkflow, model: options.model }
|
|
3767
|
+
});
|
|
3768
|
+
}
|
|
3769
|
+
if (isHappyHorseVideo && options.videoControlNetName) {
|
|
3770
|
+
fatalCliError('HappyHorse video models do not support ControlNet.', {
|
|
3771
|
+
code: 'INVALID_ARGUMENT',
|
|
3772
|
+
details: { model: options.model, controlNetName: options.videoControlNetName }
|
|
3773
|
+
});
|
|
3774
|
+
}
|
|
3413
3775
|
|
|
3414
3776
|
if (options.videoWorkflow === 't2v') {
|
|
3415
3777
|
if (!isSeedanceVideo && (options.refImage || options.refImageEnd || options.refAudio || options.refVideo)) {
|
|
@@ -3418,11 +3780,34 @@ if (options.video) {
|
|
|
3418
3780
|
});
|
|
3419
3781
|
}
|
|
3420
3782
|
} else if (options.videoWorkflow === 'i2v') {
|
|
3421
|
-
if (
|
|
3422
|
-
|
|
3783
|
+
if (isHappyHorseVideo) {
|
|
3784
|
+
if (!options.refImage) {
|
|
3785
|
+
fatalCliError('HappyHorse i2v requires --ref (a single first-frame image).', { code: 'INVALID_ARGUMENT' });
|
|
3786
|
+
}
|
|
3787
|
+
if (options.refImageEnd) {
|
|
3788
|
+
fatalCliError('HappyHorse i2v accepts only a single first-frame image (--ref); it has no end-frame input.', { code: 'INVALID_ARGUMENT' });
|
|
3789
|
+
}
|
|
3790
|
+
if (options.refAudio || options.refVideo) {
|
|
3791
|
+
fatalCliError('HappyHorse i2v does not accept reference audio/video.', { code: 'INVALID_ARGUMENT' });
|
|
3792
|
+
}
|
|
3793
|
+
} else {
|
|
3794
|
+
if (!options.refImage && !options.refImageEnd) {
|
|
3795
|
+
fatalCliError('i2v requires --ref and/or --ref-end.', { code: 'INVALID_ARGUMENT' });
|
|
3796
|
+
}
|
|
3797
|
+
if (options.refAudio || options.refVideo) {
|
|
3798
|
+
fatalCliError('i2v does not accept reference audio/video.', { code: 'INVALID_ARGUMENT' });
|
|
3799
|
+
}
|
|
3800
|
+
}
|
|
3801
|
+
} else if (options.videoWorkflow === 'r2v') {
|
|
3802
|
+
// HappyHorse reference-to-video: 1-9 loose image references via -c/--context.
|
|
3803
|
+
if (!Array.isArray(options.contextImages) || options.contextImages.length === 0) {
|
|
3804
|
+
fatalCliError('HappyHorse r2v requires 1-9 reference images via -c/--context.', { code: 'INVALID_ARGUMENT' });
|
|
3805
|
+
}
|
|
3806
|
+
if (options.refImage || options.refImageEnd) {
|
|
3807
|
+
fatalCliError('HappyHorse r2v takes reference images via -c/--context, not --ref/--ref-end.', { code: 'INVALID_ARGUMENT' });
|
|
3423
3808
|
}
|
|
3424
3809
|
if (options.refAudio || options.refVideo) {
|
|
3425
|
-
fatalCliError('
|
|
3810
|
+
fatalCliError('HappyHorse r2v does not accept reference audio/video.', { code: 'INVALID_ARGUMENT' });
|
|
3426
3811
|
}
|
|
3427
3812
|
} else if (options.videoWorkflow === 's2v') {
|
|
3428
3813
|
if (!options.refImage || !options.refAudio) {
|
|
@@ -3454,7 +3839,7 @@ if (options.video) {
|
|
|
3454
3839
|
fatalCliError('v2v requires --ref-video.', { code: 'INVALID_ARGUMENT' });
|
|
3455
3840
|
}
|
|
3456
3841
|
if (!options.videoControlNetName && !isSeedanceModel(options.model)) {
|
|
3457
|
-
fatalCliError(
|
|
3842
|
+
fatalCliError(`v2v requires --controlnet-name/--control-type (${VIDEO_CONTROLNET_NAMES.join('|')}).`, { code: 'INVALID_ARGUMENT' });
|
|
3458
3843
|
}
|
|
3459
3844
|
if (!isSeedanceVideo && options.refAudio) {
|
|
3460
3845
|
fatalCliError('v2v does not accept reference audio.', { code: 'INVALID_ARGUMENT' });
|
|
@@ -3504,13 +3889,13 @@ if (options.video) {
|
|
|
3504
3889
|
// they only support a single primary --ref-audio / --ref-video each.
|
|
3505
3890
|
if (!isSeedanceVideo) {
|
|
3506
3891
|
if (Array.isArray(options.refAudios) && options.refAudios.length > 0) {
|
|
3507
|
-
fatalCliError('Multiple --ref-audio entries are only supported for Seedance models (seedance2, seedance2-fast).', {
|
|
3892
|
+
fatalCliError('Multiple --ref-audio entries are only supported for Seedance models (seedance2, seedance2-mini, seedance2-fast).', {
|
|
3508
3893
|
code: 'INVALID_ARGUMENT',
|
|
3509
3894
|
details: { model: options.model, extras: options.refAudios },
|
|
3510
3895
|
});
|
|
3511
3896
|
}
|
|
3512
3897
|
if (Array.isArray(options.refVideos) && options.refVideos.length > 0) {
|
|
3513
|
-
fatalCliError('Multiple --ref-video entries are only supported for Seedance models (seedance2, seedance2-fast).', {
|
|
3898
|
+
fatalCliError('Multiple --ref-video entries are only supported for Seedance models (seedance2, seedance2-mini, seedance2-fast).', {
|
|
3514
3899
|
code: 'INVALID_ARGUMENT',
|
|
3515
3900
|
details: { model: options.model, extras: options.refVideos },
|
|
3516
3901
|
});
|
|
@@ -3531,11 +3916,61 @@ if (options.video) {
|
|
|
3531
3916
|
|
|
3532
3917
|
// Validate controlnet-name values
|
|
3533
3918
|
if (options.videoControlNetName) {
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3919
|
+
if (!VIDEO_CONTROLNET_NAME_SET.has(options.videoControlNetName)) {
|
|
3920
|
+
fatalCliError(`Unknown --controlnet-name "${options.videoControlNetName}". Use: ${VIDEO_CONTROLNET_NAMES.join('|')}`, {
|
|
3921
|
+
code: 'INVALID_ARGUMENT',
|
|
3922
|
+
details: { flag: '--controlnet-name', value: options.videoControlNetName, allowed: VIDEO_CONTROLNET_NAMES }
|
|
3923
|
+
});
|
|
3924
|
+
}
|
|
3925
|
+
if ((options.videoControlNetName === 'outpaint' || options.videoControlNetName === 'inpaint') && !isLtx23V2VModelId(options.model)) {
|
|
3926
|
+
fatalCliError(`${options.videoControlNetName} control requires the LTX-2.3 v2v model.`, {
|
|
3537
3927
|
code: 'INVALID_ARGUMENT',
|
|
3538
|
-
details: {
|
|
3928
|
+
details: { controlNetName: options.videoControlNetName, model: options.model },
|
|
3929
|
+
hint: 'Use --workflow v2v -m ltx23 --control-type ' + options.videoControlNetName
|
|
3930
|
+
});
|
|
3931
|
+
}
|
|
3932
|
+
if (options.videoControlNetName === 'inpaint' && !options.refMask) {
|
|
3933
|
+
fatalCliError('LTX-2.3 v2v inpaint requires --mask <image> (white pixels = region to regenerate).', {
|
|
3934
|
+
code: 'INVALID_ARGUMENT'
|
|
3935
|
+
});
|
|
3936
|
+
}
|
|
3937
|
+
if (options.videoControlNetName === 'outpaint' && !options.outpaintPosition) {
|
|
3938
|
+
options.outpaintPosition = 'center';
|
|
3939
|
+
}
|
|
3940
|
+
}
|
|
3941
|
+
|
|
3942
|
+
if (options.refMask && options.videoControlNetName !== 'inpaint') {
|
|
3943
|
+
fatalCliError('--mask is only supported with --control-type inpaint.', {
|
|
3944
|
+
code: 'INVALID_ARGUMENT'
|
|
3945
|
+
});
|
|
3946
|
+
}
|
|
3947
|
+
|
|
3948
|
+
if (options.outpaintPosition) {
|
|
3949
|
+
const normalizedOutpaintPosition = normalizeOutpaintPositionValue(options.outpaintPosition);
|
|
3950
|
+
if (!normalizedOutpaintPosition) {
|
|
3951
|
+
fatalCliError(`Invalid --outpaint-position "${options.outpaintPosition}". Use: ${OUTPAINT_POSITIONS.join('|')}`, {
|
|
3952
|
+
code: 'INVALID_ARGUMENT',
|
|
3953
|
+
details: { flag: '--outpaint-position', value: options.outpaintPosition, allowed: OUTPAINT_POSITIONS }
|
|
3954
|
+
});
|
|
3955
|
+
}
|
|
3956
|
+
if (options.videoControlNetName !== 'outpaint') {
|
|
3957
|
+
fatalCliError('--outpaint-position is only supported with --control-type outpaint.', {
|
|
3958
|
+
code: 'INVALID_ARGUMENT'
|
|
3959
|
+
});
|
|
3960
|
+
}
|
|
3961
|
+
options.outpaintPosition = normalizedOutpaintPosition;
|
|
3962
|
+
}
|
|
3963
|
+
|
|
3964
|
+
if (options.outpaintAspectRatio) {
|
|
3965
|
+
if (!parseOutpaintAspectRatio(options.outpaintAspectRatio)) {
|
|
3966
|
+
fatalCliError(`Invalid --outpaint-aspect-ratio "${options.outpaintAspectRatio}". Use a ratio like 16:9 or 9:16.`, {
|
|
3967
|
+
code: 'INVALID_ARGUMENT',
|
|
3968
|
+
details: { flag: '--outpaint-aspect-ratio', value: options.outpaintAspectRatio }
|
|
3969
|
+
});
|
|
3970
|
+
}
|
|
3971
|
+
if (options.videoControlNetName !== 'outpaint') {
|
|
3972
|
+
fatalCliError('--outpaint-aspect-ratio is only supported with --control-type outpaint.', {
|
|
3973
|
+
code: 'INVALID_ARGUMENT'
|
|
3539
3974
|
});
|
|
3540
3975
|
}
|
|
3541
3976
|
}
|
|
@@ -3564,11 +3999,12 @@ if (options.video) {
|
|
|
3564
3999
|
|
|
3565
4000
|
applyVideoPromptGuardrails();
|
|
3566
4001
|
|
|
3567
|
-
if (options.video && isSeedanceModel(options.model) && options.fps !== 24) {
|
|
4002
|
+
if (options.video && (isSeedanceModel(options.model) || isHappyHorseModel(options.model)) && options.fps !== 24) {
|
|
3568
4003
|
const originalFps = options.fps;
|
|
4004
|
+
const vendorLabel = isHappyHorseModel(options.model) ? 'HappyHorse' : 'Seedance';
|
|
3569
4005
|
options.fps = 24;
|
|
3570
4006
|
if (!options.quiet) {
|
|
3571
|
-
console.error(`Adjusted
|
|
4007
|
+
console.error(`Adjusted ${vendorLabel} fps from ${originalFps} to 24 (${vendorLabel} uses fixed 24fps video generation).`);
|
|
3572
4008
|
}
|
|
3573
4009
|
}
|
|
3574
4010
|
|
|
@@ -4157,6 +4593,7 @@ function getApiModeMediaReferences() {
|
|
|
4157
4593
|
for (const value of options.refVideos || []) {
|
|
4158
4594
|
if (value) refs.push({ flag: '--ref-video', value, kind: 'video' });
|
|
4159
4595
|
}
|
|
4596
|
+
if (options.refMask) refs.push({ flag: '--mask', value: options.refMask, kind: 'image' });
|
|
4160
4597
|
return refs;
|
|
4161
4598
|
}
|
|
4162
4599
|
|
|
@@ -4224,6 +4661,7 @@ function apiMediaReferenceUploadType(ref, index) {
|
|
|
4224
4661
|
if (ref.kind === 'audio') return 'referenceAudio';
|
|
4225
4662
|
if (ref.kind === 'video') return 'referenceVideo';
|
|
4226
4663
|
if (ref.flag === '--ref-end') return 'referenceImageEnd';
|
|
4664
|
+
if (ref.flag === '--mask') return `contextImage${Math.min(index + 1, 16)}`;
|
|
4227
4665
|
if (ref.flag === '-c/--context') return `contextImage${Math.min(index + 1, 16)}`;
|
|
4228
4666
|
return 'referenceImage';
|
|
4229
4667
|
}
|
|
@@ -6556,6 +6994,32 @@ function enforceSeedanceReferenceCaps() {
|
|
|
6556
6994
|
}
|
|
6557
6995
|
}
|
|
6558
6996
|
|
|
6997
|
+
// Wraps the shared validateHappyHorseReferenceCounts() so a thrown
|
|
6998
|
+
// HappyHorseReferenceLimitError is re-raised as a CLI fatal error with the same
|
|
6999
|
+
// human message the hosted chat surfaces. HappyHorse caps are PER MODEL (mode):
|
|
7000
|
+
// t2v 0 images, i2v 1 first-frame image, r2v up to 9 reference images; it takes
|
|
7001
|
+
// no reference videos or audios (audio is rendered natively). Source of truth:
|
|
7002
|
+
// @sogni-ai/sogni-intelligence-client/tools HAPPYHORSE_REFERENCE_LIMITS.
|
|
7003
|
+
function enforceHappyHorseReferenceCaps() {
|
|
7004
|
+
try {
|
|
7005
|
+
validateHappyHorseReferenceCounts(options.model, effectiveSeedanceReferenceCounts());
|
|
7006
|
+
} catch (err) {
|
|
7007
|
+
if (err instanceof HappyHorseReferenceLimitError) {
|
|
7008
|
+
fatalCliError(err.message, {
|
|
7009
|
+
code: err.code,
|
|
7010
|
+
details: {
|
|
7011
|
+
modelId: err.modelId,
|
|
7012
|
+
limitKind: err.limitKind,
|
|
7013
|
+
requestedCount: err.requestedCount,
|
|
7014
|
+
maxCount: err.maxCount,
|
|
7015
|
+
limits: getHappyHorseReferenceLimits(options.model) || HAPPYHORSE_REFERENCE_LIMITS,
|
|
7016
|
+
},
|
|
7017
|
+
});
|
|
7018
|
+
}
|
|
7019
|
+
throw err;
|
|
7020
|
+
}
|
|
7021
|
+
}
|
|
7022
|
+
|
|
6559
7023
|
function resolveMultiAngleOutputConfig(outputPath, outputFormat) {
|
|
6560
7024
|
if (!outputPath) return null;
|
|
6561
7025
|
const ext = extname(outputPath);
|
|
@@ -8197,16 +8661,26 @@ async function main() {
|
|
|
8197
8661
|
if (options.refVideo) log(`Reference video: ${options.refVideo}`);
|
|
8198
8662
|
|
|
8199
8663
|
const isSeedanceVideo = isSeedanceModel(options.model);
|
|
8664
|
+
const isHappyHorseVideo = isHappyHorseModel(options.model);
|
|
8665
|
+
// Vendor video models forward image references as HTTPS URL arrays (or
|
|
8666
|
+
// Sogni-hosted uploads) instead of inline buffers; HappyHorse takes
|
|
8667
|
+
// image-only references (i2v first_frame, r2v reference_image).
|
|
8668
|
+
const isVendorReferenceVideo = isSeedanceVideo || isHappyHorseVideo;
|
|
8200
8669
|
if (isSeedanceVideo) {
|
|
8201
8670
|
// Source of truth: @sogni-ai/sogni-protocol catalogs/seedance-reference-limits.json
|
|
8202
8671
|
// surfaced through @sogni-ai/sogni-intelligence-client/tools.
|
|
8203
8672
|
enforceSeedanceReferenceCaps();
|
|
8204
8673
|
}
|
|
8674
|
+
if (isHappyHorseVideo) {
|
|
8675
|
+
// Source of truth: @sogni-ai/sogni-intelligence-client/tools
|
|
8676
|
+
// HAPPYHORSE_REFERENCE_LIMITS (per-mode image-only caps).
|
|
8677
|
+
enforceHappyHorseReferenceCaps();
|
|
8678
|
+
}
|
|
8205
8679
|
const seedanceReferenceImageUrls = [];
|
|
8206
8680
|
const seedanceReferenceVideoUrls = [];
|
|
8207
8681
|
const seedanceReferenceAudioUrls = [];
|
|
8208
|
-
const useRefImageUrl =
|
|
8209
|
-
const useRefImageEndUrl =
|
|
8682
|
+
const useRefImageUrl = isVendorReferenceVideo && await appendSafeSeedanceReferenceUrl(seedanceReferenceImageUrls, options.refImage, 'Reference image');
|
|
8683
|
+
const useRefImageEndUrl = isVendorReferenceVideo && await appendSafeSeedanceReferenceUrl(seedanceReferenceImageUrls, options.refImageEnd, 'End reference image');
|
|
8210
8684
|
const refAudioFormatByPath = options.refAudio
|
|
8211
8685
|
? detectReferenceAudioFormat(
|
|
8212
8686
|
new Uint8Array(),
|
|
@@ -8250,19 +8724,19 @@ async function main() {
|
|
|
8250
8724
|
}
|
|
8251
8725
|
}
|
|
8252
8726
|
|
|
8253
|
-
//
|
|
8254
|
-
//
|
|
8255
|
-
//
|
|
8256
|
-
//
|
|
8257
|
-
//
|
|
8258
|
-
//
|
|
8259
|
-
//
|
|
8260
|
-
//
|
|
8261
|
-
if (
|
|
8727
|
+
// Vendor loose image references: -c/--context images beyond start/end.
|
|
8728
|
+
// The Sogni Client SDK accepts only URL arrays for these
|
|
8729
|
+
// (createJobRequestMessage), so each entry must resolve to an HTTPS URL.
|
|
8730
|
+
// HTTPS inputs are forwarded as-is (SSRF-validated); local files are
|
|
8731
|
+
// uploaded to a Sogni-hosted URL first. This lets `-c <local image>` work
|
|
8732
|
+
// in direct generation without a detour through --api-chat / --durable-chat.
|
|
8733
|
+
// Seedance treats these as @ImageN loose refs; HappyHorse r2v treats them
|
|
8734
|
+
// as reference_image inputs (up to 9).
|
|
8735
|
+
if (isVendorReferenceVideo) {
|
|
8262
8736
|
for (const [ctxIndex, ctxImage] of (Array.isArray(options.contextImages) ? options.contextImages : []).entries()) {
|
|
8263
8737
|
if (!ctxImage) continue;
|
|
8264
8738
|
if (isHttpsUrl(ctxImage)) {
|
|
8265
|
-
await appendSafeSeedanceReferenceUrl(seedanceReferenceImageUrls, ctxImage, '
|
|
8739
|
+
await appendSafeSeedanceReferenceUrl(seedanceReferenceImageUrls, ctxImage, 'Image reference');
|
|
8266
8740
|
} else {
|
|
8267
8741
|
const uploadedImageUrl = await uploadSeedanceReferenceImageUrl(
|
|
8268
8742
|
ctxImage,
|
|
@@ -8272,6 +8746,10 @@ async function main() {
|
|
|
8272
8746
|
seedanceReferenceImageUrls.push(uploadedImageUrl);
|
|
8273
8747
|
}
|
|
8274
8748
|
}
|
|
8749
|
+
}
|
|
8750
|
+
// Seedance-only loose extras: repeated --ref-audio / --ref-video entries
|
|
8751
|
+
// past the first. HappyHorse takes no reference audio or video.
|
|
8752
|
+
if (isSeedanceVideo) {
|
|
8275
8753
|
for (const [extraAudioIndex, extraAudio] of options.refAudios.entries()) {
|
|
8276
8754
|
if (!isHttpsUrl(extraAudio)) {
|
|
8277
8755
|
fatalCliError(
|
|
@@ -8312,6 +8790,7 @@ async function main() {
|
|
|
8312
8790
|
let endImageBuffer = options.refImageEnd && !useRefImageEndUrl ? await fetchMediaBuffer(options.refImageEnd) : undefined;
|
|
8313
8791
|
let audioBuffer = options.refAudio && !useRefAudioUrl ? await fetchMediaBuffer(options.refAudio) : undefined;
|
|
8314
8792
|
let videoBuffer = options.refVideo && !useRefVideoUrl ? await fetchMediaBuffer(options.refVideo) : undefined;
|
|
8793
|
+
let maskBuffer = options.refMask ? await fetchMediaBuffer(options.refMask) : undefined;
|
|
8315
8794
|
if (audioBuffer) {
|
|
8316
8795
|
audioBuffer = await prepareReferenceAudioForVideoBuffer(audioBuffer, options.refAudio);
|
|
8317
8796
|
}
|
|
@@ -8342,6 +8821,62 @@ async function main() {
|
|
|
8342
8821
|
const modelDefaults = getModelDefaults(options.model, openclawConfig);
|
|
8343
8822
|
const videoDimensionRules = videoDimensionRulesFromDefaults(modelDefaults, options.model);
|
|
8344
8823
|
|
|
8824
|
+
if (
|
|
8825
|
+
options.videoWorkflow === 'v2v' &&
|
|
8826
|
+
(options.videoControlNetName === 'outpaint' || options.videoControlNetName === 'inpaint')
|
|
8827
|
+
) {
|
|
8828
|
+
let sourceVideoDimensions = null;
|
|
8829
|
+
if (options.refVideo && !isHttpUrl(options.refVideo) && existsSync(options.refVideo)) {
|
|
8830
|
+
const probed = await probeVideoStreamInfo(options.refVideo);
|
|
8831
|
+
if (probed.width && probed.height) {
|
|
8832
|
+
sourceVideoDimensions = { width: probed.width, height: probed.height };
|
|
8833
|
+
}
|
|
8834
|
+
}
|
|
8835
|
+
|
|
8836
|
+
if (options.videoControlNetName === 'outpaint') {
|
|
8837
|
+
const outpaintDimensions = computeOutpaintCanvas(
|
|
8838
|
+
sourceVideoDimensions?.width ?? options.width,
|
|
8839
|
+
sourceVideoDimensions?.height ?? options.height,
|
|
8840
|
+
options.outpaintAspectRatio,
|
|
8841
|
+
options.outpaintPosition || 'center',
|
|
8842
|
+
videoDimensionRules
|
|
8843
|
+
);
|
|
8844
|
+
if (outpaintDimensions.width !== options.width || outpaintDimensions.height !== options.height) {
|
|
8845
|
+
if (!options.quiet) {
|
|
8846
|
+
const ratioLabel = options.outpaintAspectRatio ? ` for ${options.outpaintAspectRatio}` : '';
|
|
8847
|
+
console.error(
|
|
8848
|
+
`Adjusted outpaint canvas from ${options.width}x${options.height} ` +
|
|
8849
|
+
`to ${outpaintDimensions.width}x${outpaintDimensions.height}${ratioLabel}.`
|
|
8850
|
+
);
|
|
8851
|
+
}
|
|
8852
|
+
options.width = outpaintDimensions.width;
|
|
8853
|
+
options.height = outpaintDimensions.height;
|
|
8854
|
+
}
|
|
8855
|
+
} else if (options.videoControlNetName === 'inpaint' && sourceVideoDimensions) {
|
|
8856
|
+
const hasExplicitVideoDimensions =
|
|
8857
|
+
(cliSet.width || widthFromConfig || widthFromPrompt) &&
|
|
8858
|
+
(cliSet.height || heightFromConfig || heightFromPrompt);
|
|
8859
|
+
if (!hasExplicitVideoDimensions) {
|
|
8860
|
+
const inpaintDimensions = computeSourceAspectCanvas(
|
|
8861
|
+
sourceVideoDimensions.width,
|
|
8862
|
+
sourceVideoDimensions.height,
|
|
8863
|
+
videoDimensionRules,
|
|
8864
|
+
options.targetResolution
|
|
8865
|
+
);
|
|
8866
|
+
if (inpaintDimensions.width !== options.width || inpaintDimensions.height !== options.height) {
|
|
8867
|
+
if (!options.quiet) {
|
|
8868
|
+
console.error(
|
|
8869
|
+
`Adjusted inpaint canvas from ${options.width}x${options.height} ` +
|
|
8870
|
+
`to ${inpaintDimensions.width}x${inpaintDimensions.height} to match the source video aspect.`
|
|
8871
|
+
);
|
|
8872
|
+
}
|
|
8873
|
+
options.width = inpaintDimensions.width;
|
|
8874
|
+
options.height = inpaintDimensions.height;
|
|
8875
|
+
}
|
|
8876
|
+
}
|
|
8877
|
+
}
|
|
8878
|
+
}
|
|
8879
|
+
|
|
8345
8880
|
// Pre-resize reference images to model-compatible dimensions if needed for i2v workflow.
|
|
8346
8881
|
if (options.videoWorkflow === 'i2v' && imageBuffer && options._needsRefResize) {
|
|
8347
8882
|
const dims = getImageDimensionsFromBuffer(imageBuffer);
|
|
@@ -8409,6 +8944,12 @@ async function main() {
|
|
|
8409
8944
|
if (endImageBuffer) {
|
|
8410
8945
|
projectConfig.referenceImageEnd = endImageBuffer;
|
|
8411
8946
|
}
|
|
8947
|
+
applyLtxTransitionLora(
|
|
8948
|
+
projectConfig,
|
|
8949
|
+
options.model,
|
|
8950
|
+
Boolean(projectConfig.referenceImage),
|
|
8951
|
+
Boolean(projectConfig.referenceImageEnd)
|
|
8952
|
+
);
|
|
8412
8953
|
if (audioBuffer) {
|
|
8413
8954
|
projectConfig.referenceAudio = audioBuffer;
|
|
8414
8955
|
}
|
|
@@ -8439,7 +8980,9 @@ async function main() {
|
|
|
8439
8980
|
if (options.seed !== null && options.seed !== undefined) {
|
|
8440
8981
|
projectConfig.seed = options.seed;
|
|
8441
8982
|
}
|
|
8442
|
-
if (Number.isFinite(steps)) {
|
|
8983
|
+
if (Number.isFinite(steps) && !isHappyHorseVideo) {
|
|
8984
|
+
// HappyHorse routes through the vendor-job path and ignores `steps`,
|
|
8985
|
+
// mirroring Seedance (whose model defaults already omit them).
|
|
8443
8986
|
projectConfig.steps = steps;
|
|
8444
8987
|
}
|
|
8445
8988
|
if (guidance !== null && guidance !== undefined) {
|
|
@@ -8455,14 +8998,20 @@ async function main() {
|
|
|
8455
8998
|
projectConfig.shift = modelDefaults.shift;
|
|
8456
8999
|
}
|
|
8457
9000
|
if (options.videoControlNetName && !isSeedanceModel(options.model)) {
|
|
8458
|
-
const
|
|
9001
|
+
const isInOutpaintControl = options.videoControlNetName === 'outpaint' || options.videoControlNetName === 'inpaint';
|
|
8459
9002
|
projectConfig.controlNet = {
|
|
8460
9003
|
name: options.videoControlNetName,
|
|
8461
|
-
strength:
|
|
9004
|
+
strength: isInOutpaintControl ? 1.0 : resolveVideoControlNetStrength(options.videoControlNetName, options.videoControlNetStrength)
|
|
8462
9005
|
};
|
|
8463
|
-
if (options.videoControlNetName !== 'detailer') {
|
|
9006
|
+
if (!isInOutpaintControl && options.videoControlNetName !== 'detailer') {
|
|
8464
9007
|
projectConfig.detailerStrength = 0.6;
|
|
8465
9008
|
}
|
|
9009
|
+
if (options.videoControlNetName === 'inpaint' && maskBuffer) {
|
|
9010
|
+
projectConfig.referenceMask = maskBuffer;
|
|
9011
|
+
}
|
|
9012
|
+
if (options.videoControlNetName === 'outpaint') {
|
|
9013
|
+
projectConfig.outpaintPosition = options.outpaintPosition || 'center';
|
|
9014
|
+
}
|
|
8466
9015
|
} else if (options.videoControlNetName && isSeedanceModel(options.model) && !options.quiet) {
|
|
8467
9016
|
console.error('Warning: --controlnet-name ignored for Seedance V2V models.');
|
|
8468
9017
|
}
|
|
@@ -9099,7 +9648,7 @@ async function main() {
|
|
|
9099
9648
|
success: false,
|
|
9100
9649
|
error: error.message,
|
|
9101
9650
|
prompt: options.prompt ?? null
|
|
9102
|
-
}, error);
|
|
9651
|
+
}, error, { modelId: options.model });
|
|
9103
9652
|
if (error.code) payload.errorCode = error.code;
|
|
9104
9653
|
if (error.details) payload.errorDetails = error.details;
|
|
9105
9654
|
// Don't let a stale per-error hint overwrite the canonical
|
|
@@ -9134,10 +9683,10 @@ async function main() {
|
|
|
9134
9683
|
if (IS_OPENCLAW_INVOCATION) payload.openclaw = true;
|
|
9135
9684
|
console.log(JSON.stringify(payload));
|
|
9136
9685
|
if (!options.json) {
|
|
9137
|
-
printHumanError(error);
|
|
9686
|
+
printHumanError(error, { modelId: options.model });
|
|
9138
9687
|
}
|
|
9139
9688
|
} else {
|
|
9140
|
-
printHumanError(error);
|
|
9689
|
+
printHumanError(error, { modelId: options.model });
|
|
9141
9690
|
}
|
|
9142
9691
|
} finally {
|
|
9143
9692
|
try {
|