@sogni-ai/sogni-creative-agent-skill 3.17.0 → 3.17.2
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/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/CHANGELOG.md +32 -0
- package/README.md +2 -0
- package/SKILL.md +4 -2
- package/desktop-extension/manifest.json +1 -1
- package/llm.txt +7 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/scripts/sync-creative-agent-runtime.mjs +39 -0
- package/sogni-agent.mjs +174 -28
- package/version.mjs +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sogni-creative-agent",
|
|
3
|
-
"version": "3.17.
|
|
3
|
+
"version": "3.17.2",
|
|
4
4
|
"description": "Sogni Creative Agent: image, video, and music generation via Sogni AI's decentralized GPU network. Supports personas, persistent memories, style transfer, and multi-step creative workflows.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Sogni AI",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,35 @@
|
|
|
1
|
+
## [3.17.2](https://github.com/Sogni-AI/sogni-creative-agent-skill/compare/v3.17.1...v3.17.2) (2026-07-26)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **billing:** clarify unlimited settlement and LTX sizing ([d836b49](https://github.com/Sogni-AI/sogni-creative-agent-skill/commit/d836b490bccda5c9e8166b2bb3d928708d2fbae4))
|
|
7
|
+
|
|
8
|
+
## Unreleased
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
* **billing:** clarify that `tokenType: "spark"` is a denomination, not proof of a Spark debit; Unlimited
|
|
13
|
+
coverage is determined by `paymentModel: "subscription"` or explicit subscription-billing success.
|
|
14
|
+
* **video:** use an already-compatible local LTX/10Eros reference as the implicit i2v canvas, avoiding
|
|
15
|
+
misleading intermediate dimension adjustments and no-op resize messages.
|
|
16
|
+
|
|
17
|
+
## [3.17.1](https://github.com/Sogni-AI/sogni-creative-agent-skill/compare/v3.17.0...v3.17.1) (2026-07-26)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **scripts:** refuse runtime sync on intelligence-client version mismatch ([247da8c](https://github.com/Sogni-AI/sogni-creative-agent-skill/commit/247da8c9cb7b6f0575a25543847ca00f44929c0a))
|
|
23
|
+
* **video:** stop discarding i2v resolution on sparse aspect ratios ([23125f7](https://github.com/Sogni-AI/sogni-creative-agent-skill/commit/23125f780d394ec988012aabd4db7a9e49c63341))
|
|
24
|
+
|
|
25
|
+
## [3.17.1](https://github.com/Sogni-AI/sogni-creative-agent-skill/compare/v3.17.0...v3.17.1) (2026-07-26)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Bug Fixes
|
|
29
|
+
|
|
30
|
+
* **scripts:** refuse runtime sync on intelligence-client version mismatch ([247da8c](https://github.com/Sogni-AI/sogni-creative-agent-skill/commit/247da8c9cb7b6f0575a25543847ca00f44929c0a))
|
|
31
|
+
* **video:** stop discarding i2v resolution on sparse aspect ratios ([23125f7](https://github.com/Sogni-AI/sogni-creative-agent-skill/commit/23125f780d394ec988012aabd4db7a9e49c63341))
|
|
32
|
+
|
|
1
33
|
## [3.17.0] - 2026-07-26
|
|
2
34
|
|
|
3
35
|
### Added
|
package/README.md
CHANGED
|
@@ -777,6 +777,8 @@ App Store and Google Play prices may differ from web pricing due to platform fee
|
|
|
777
777
|
|
|
778
778
|
By default the CLI sends no `billingMode`/coverage hint; the server decides coverage from the account's verified entitlement and the resolved model, and a subscription claim is never honored without a server-verified entitlement. `--billing-mode` makes the choice explicit when you need it: `subscription` requires Unlimited coverage (the job fails instead of spending tokens), `tokens` opts out of coverage and bills Spark/SOGNI, and `auto` states the default server behavior explicitly.
|
|
779
779
|
|
|
780
|
+
Do not use `tokenType: "spark"` by itself to determine that Spark paid for a render. `tokenType` is also the quote/accounting denomination for covered jobs. The server's separate `paymentModel` is authoritative: `subscription` means it skipped the artist Spark/SOGNI debit, while `paid_spark`, `free_spark`, and `sogni` identify token-funded paths. Some client result summaries do not expose `paymentModel`; in that case the payment source is unknown from that result alone. A request that completes successfully with `--billing-mode subscription` was covered—if coverage is unavailable, the server returns `4078` or `4080` instead of silently spending Spark.
|
|
781
|
+
|
|
780
782
|
With an active subscription, the CLI also skips its client-side "insufficient SPARK" pre-flight for covered video renders — a low token balance no longer blocks jobs the plan pays for. Vendor models and `--billing-mode tokens` keep the pre-flight, and the server remains authoritative either way.
|
|
781
783
|
|
|
782
784
|
### Free-trial usage limits
|
package/SKILL.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: sogni-creative-agent-skill
|
|
3
3
|
description: "Sogni Creative Agent Skill: agent skill and CLI for image, video, and music generation using Sogni AI's decentralized GPU network. Supports one-click image-folder loop reels, personas (named people with saved reference photos and voice clips), persistent memories, custom personality, style transfer, angle synthesis, Seedance/HappyHorse/LTX/WAN video, music/lyrics, hosted chat, durable workflows, replay records, and multi-step creative workflows. Ask the agent to \"draw\", \"generate\", \"create an image\", \"make a video/animate\", \"turn this image folder into a loop\", \"make music\", \"apply a style\", or \"generate me as a superhero\"."
|
|
4
4
|
metadata:
|
|
5
|
-
version: "3.17.
|
|
5
|
+
version: "3.17.2"
|
|
6
6
|
homepage: https://sogni.ai
|
|
7
7
|
openclaw:
|
|
8
8
|
emoji: "🎨"
|
|
@@ -275,6 +275,8 @@ Do not collect payment details, quote a custom price, or simulate a purchase in
|
|
|
275
275
|
|
|
276
276
|
On a **Sogni Unlimited** subscription, Sogni-hosted (Supernet) image, video, and music generation is covered by the plan under a fair-use policy instead of spending Spark or SOGNI. Plans: Unlimited ($20/mo, $199/yr) and Unlimited Pro ($50/mo, $498/yr), with a one-per-account 3-day free trial. External-vendor models — **GPT Image 2**, **Seedance 2.0 / Mini / Fast**, and **HappyHorse 1.1** — are never covered and always require Premium Spark, even on an active subscription. Selecting SOGNI opts a job out of coverage. The server decides coverage from the verified entitlement and resolved model; never tell the user a vendor model is "free on Unlimited."
|
|
277
277
|
|
|
278
|
+
**Do not infer a Spark charge from `tokenType: "spark"`.** `tokenType` is the quote/accounting denomination and may remain `spark` on a covered Unlimited job. Billing is decided separately by the server's `paymentModel`: `subscription` means the artist Spark/SOGNI debit was skipped; `paid_spark`, `free_spark`, or `sogni` means token billing. If a result does not expose `paymentModel`, treat the payment source as unknown rather than warning that Spark was spent. Check the structured subscription state or transaction history when available. A successful request made with `--billing-mode subscription` is covered: if the server cannot use Unlimited, it rejects the request with `4078` or `4080` instead of silently falling back to Spark.
|
|
279
|
+
|
|
278
280
|
Unlimited is fair-use, not unmetered: per-UTC-day concurrency ceilings step down as completed renders climb (and reset at UTC midnight), and once a plan's fast-lane allowance is exceeded, further jobs run best-effort in a lower-priority standard queue until capacity resets. Describe this as **fair use** / a **standard (throttled) queue** — never as "relaxed."
|
|
279
281
|
|
|
280
282
|
When a generation cannot bill to the subscription, the CLI returns a structured error (`errorCategory: "subscription_billing"`). Respond by the `errorCode`, and **do not** collect payment details or simulate a purchase:
|
|
@@ -324,7 +326,7 @@ Failure (single JSON object on stdout, exit code 1; progress/warnings on stderr)
|
|
|
324
326
|
|
|
325
327
|
## Cost
|
|
326
328
|
|
|
327
|
-
|
|
329
|
+
Eligible Sogni-hosted renders use Unlimited coverage when active; otherwise renders use the selected Spark or SOGNI token path. 512x512 images are most cost-efficient. `-n` is safety-capped at 16 outputs per call (`SOGNI_MAX_COUNT` raises it deliberately). Seedance, HappyHorse, and GPT Image 2 are vendor models requiring Premium Spark eligibility.
|
|
328
330
|
|
|
329
331
|
## Troubleshooting
|
|
330
332
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"manifest_version": "0.3",
|
|
3
3
|
"name": "sogni-creative-agent",
|
|
4
4
|
"display_name": "Sogni Creative Agent",
|
|
5
|
-
"version": "3.17.
|
|
5
|
+
"version": "3.17.2",
|
|
6
6
|
"description": "Generate images, video, and music on Sogni AI's decentralized GPU network — with personas, memories, and safe video editing tools.",
|
|
7
7
|
"author": { "name": "Sogni AI", "url": "https://sogni.ai" },
|
|
8
8
|
"homepage": "https://sogni.ai",
|
package/llm.txt
CHANGED
|
@@ -117,7 +117,13 @@ HappyHorse 1.1 (`happyhorse-1.1-t2v`, `happyhorse-1.1-i2v`,
|
|
|
117
117
|
`happyhorse-1.1-r2v`) — are never covered and always need Premium Spark;
|
|
118
118
|
selecting SOGNI opts a job out of coverage. The server decides
|
|
119
119
|
coverage from the verified entitlement + resolved model; the CLI never asserts
|
|
120
|
-
coverage.
|
|
120
|
+
coverage. Never infer a Spark charge from `tokenType: "spark"`: that field is
|
|
121
|
+
the quote/accounting denomination and can remain `spark` on a covered job.
|
|
122
|
+
`paymentModel: "subscription"` is the authoritative indication that the artist
|
|
123
|
+
debit was skipped. If `paymentModel` is absent, call the payment source unknown
|
|
124
|
+
instead of claiming Spark was spent. A successful `--billing-mode subscription`
|
|
125
|
+
request is covered; unavailable coverage fails with 4078 or 4080 rather than
|
|
126
|
+
silently falling back to Spark. Fair-use throttling lowers per-UTC-day concurrency as completed renders
|
|
121
127
|
climb (resets UTC midnight) and demotes over-allowance jobs to a lower-priority
|
|
122
128
|
standard queue — describe this as fair use / standard queue, never "relaxed".
|
|
123
129
|
Subscription-billing failures use `errorCategory: "subscription_billing"` with
|
package/openclaw.plugin.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "sogni-creative-agent-skill",
|
|
3
3
|
"name": "Sogni Creative Agent Skill — Image, Video & Music Generation",
|
|
4
4
|
"description": "Agent skill and CLI for Sogni AI image, video, and music generation.",
|
|
5
|
-
"version": "3.17.
|
|
5
|
+
"version": "3.17.2",
|
|
6
6
|
"skills": [
|
|
7
7
|
"."
|
|
8
8
|
],
|
package/package.json
CHANGED
|
@@ -73,6 +73,45 @@ if (!existsSync(upstreamSyncScript)) {
|
|
|
73
73
|
process.exit(1);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
const INTELLIGENCE_CLIENT = '@sogni-ai/sogni-intelligence-client';
|
|
77
|
+
|
|
78
|
+
function installedClientVersion(fromDir) {
|
|
79
|
+
const manifest = join(fromDir, 'node_modules', INTELLIGENCE_CLIENT, 'package.json');
|
|
80
|
+
if (!existsSync(manifest)) return null;
|
|
81
|
+
try {
|
|
82
|
+
return JSON.parse(readFileSync(manifest, 'utf8')).version || null;
|
|
83
|
+
} catch {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// The upstream sync script generates the prompt contracts from ITS OWN copy of the
|
|
89
|
+
// intelligence client, not ours. If that copy is older than the version this repo pins, the
|
|
90
|
+
// sync silently regenerates the runtime from stale contracts and DELETES everything added
|
|
91
|
+
// since — an easy change to land unnoticed, because it looks like a routine "runtime is
|
|
92
|
+
// stale" diff. Fail loudly on a version mismatch instead of emitting a downgrade.
|
|
93
|
+
const upstreamRoot = dirname(dirname(upstreamSyncScript));
|
|
94
|
+
const ourClientVersion = installedClientVersion(repoRoot);
|
|
95
|
+
const upstreamClientVersion = installedClientVersion(upstreamRoot);
|
|
96
|
+
|
|
97
|
+
if (ourClientVersion && upstreamClientVersion && ourClientVersion !== upstreamClientVersion) {
|
|
98
|
+
console.error(`Refusing to sync: ${INTELLIGENCE_CLIENT} version mismatch.`);
|
|
99
|
+
console.error(` this repo: ${ourClientVersion}`);
|
|
100
|
+
console.error(` ${upstreamRoot}: ${upstreamClientVersion}`);
|
|
101
|
+
console.error('');
|
|
102
|
+
console.error('The upstream sync script builds the prompt contracts from its own node_modules,');
|
|
103
|
+
console.error('so syncing now would regenerate generated/creative-agent-runtime.mjs from the');
|
|
104
|
+
console.error('older contract set and drop anything added since that version.');
|
|
105
|
+
console.error('');
|
|
106
|
+
console.error(`Fix: npm install --prefix ${upstreamRoot}`);
|
|
107
|
+
process.exit(1);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (!upstreamClientVersion) {
|
|
111
|
+
console.warn(`Warning: could not resolve ${INTELLIGENCE_CLIENT} in ${upstreamRoot};`);
|
|
112
|
+
console.warn('skipping version-parity check. Verify the generated diff before committing.');
|
|
113
|
+
}
|
|
114
|
+
|
|
76
115
|
const syncResult = run(process.execPath, [upstreamSyncScript], {
|
|
77
116
|
env: {
|
|
78
117
|
...process.env,
|
package/sogni-agent.mjs
CHANGED
|
@@ -401,6 +401,11 @@ function defaultsFromModelTier(card) {
|
|
|
401
401
|
if (Number.isFinite(card?.width?.min)) defaults.minDimension = card.width.min;
|
|
402
402
|
if (Number.isFinite(card?.width?.max)) defaults.maxDimension = card.width.max;
|
|
403
403
|
if (Number.isFinite(card?.width?.step)) defaults.dimensionMultiple = card.width.step;
|
|
404
|
+
const defaultSize = String(card?.defaultSize || '').match(/^(\d+)x(\d+)$/i);
|
|
405
|
+
if (defaultSize) {
|
|
406
|
+
defaults.defaultWidth = Number(defaultSize[1]);
|
|
407
|
+
defaults.defaultHeight = Number(defaultSize[2]);
|
|
408
|
+
}
|
|
404
409
|
return defaults;
|
|
405
410
|
}
|
|
406
411
|
|
|
@@ -1406,8 +1411,23 @@ const DEFAULT_VIDEO_DIMENSION_RULES = {
|
|
|
1406
1411
|
};
|
|
1407
1412
|
const WRAPPER_MAX_VIDEO_DIMENSION = 2048;
|
|
1408
1413
|
const WRAPPER_MAX_WAN_VIDEO_DIMENSION = 1536;
|
|
1414
|
+
|
|
1415
|
+
// SogniClientWrapper.normalizeVideoDimensions in @sogni-ai/sogni-intelligence-client clamps to
|
|
1416
|
+
// MAX_VIDEO_DIMENSION = 1536 for every model before it resizes a reference image and overwrites
|
|
1417
|
+
// the project dimensions with the resized reference's. So on any reference-bearing workflow a
|
|
1418
|
+
// larger ceiling is not reachable: the CLI waves 1600x896 through as "valid", the wrapper then
|
|
1419
|
+
// clamps to 1536x848 and hands the model a 1514x848 reference that is off-divisor — the exact
|
|
1420
|
+
// failure the i2v sizing logic exists to prevent. Applied only to reference-bearing workflows;
|
|
1421
|
+
// t2v never goes through the reference resize. Keep in sync with the pinned client version.
|
|
1422
|
+
const WRAPPER_MAX_REF_VIDEO_DIMENSION = 1536;
|
|
1409
1423
|
const VIDEO_DIMENSION_MULTIPLE = DEFAULT_VIDEO_DIMENSION_RULES.dimensionMultiple;
|
|
1410
1424
|
|
|
1425
|
+
// i2v reference sizing: when an exact-aspect bounding box would cost more than this share of
|
|
1426
|
+
// the pixel budget, pre-resize the reference to the model cap instead. The aspect ceiling keeps
|
|
1427
|
+
// the swap invisible — a 25:14 source becoming 16:9 drifts 0.44%, far under the limit.
|
|
1428
|
+
const VIDEO_REF_PRERESIZE_MIN_AREA_GAIN = 1.1;
|
|
1429
|
+
const VIDEO_REF_PRERESIZE_MAX_ASPECT_DRIFT = 0.02;
|
|
1430
|
+
|
|
1411
1431
|
function isWanVideoModelId(modelId) {
|
|
1412
1432
|
return typeof modelId === 'string' && modelId.startsWith('wan_');
|
|
1413
1433
|
}
|
|
@@ -1563,33 +1583,48 @@ function videoDimensionRulesFromDefaults(modelDefaults, modelId) {
|
|
|
1563
1583
|
}
|
|
1564
1584
|
|
|
1565
1585
|
/**
|
|
1566
|
-
*
|
|
1567
|
-
*
|
|
1586
|
+
* Predicts the dimensions `resizeImageBufferForVideo` will produce for a reference image.
|
|
1587
|
+
*
|
|
1588
|
+
* Scales the reference up to the model's max dimension (preserving aspect via fit:inside),
|
|
1589
|
+
* then rounds each side to the nearest model divisor. Unlike an exact-aspect bounding box,
|
|
1590
|
+
* this always reaches the model cap — at the cost of a sub-pixel-percent aspect adjustment.
|
|
1591
|
+
*
|
|
1592
|
+
* `resizeImageBufferForVideo` delegates to this so the prediction can never drift from the
|
|
1593
|
+
* actual resize.
|
|
1568
1594
|
*/
|
|
1569
|
-
|
|
1595
|
+
function predictVideoRefPreResizeDims(refWidth, refHeight, rules = DEFAULT_VIDEO_DIMENSION_RULES) {
|
|
1596
|
+
const rw = Number(refWidth);
|
|
1597
|
+
const rh = Number(refHeight);
|
|
1598
|
+
if (!Number.isFinite(rw) || !Number.isFinite(rh) || rw <= 0 || rh <= 0) return null;
|
|
1599
|
+
|
|
1570
1600
|
const multiple = rules.dimensionMultiple || VIDEO_DIMENSION_MULTIPLE;
|
|
1601
|
+
const minDimension = rules.minDimension || DEFAULT_VIDEO_DIMENSION_RULES.minDimension;
|
|
1602
|
+
const maxDimension = rules.maxDimension || DEFAULT_VIDEO_DIMENSION_RULES.maxDimension;
|
|
1571
1603
|
const roundToMultiple = (n) => Math.max(multiple, Math.round(n / multiple) * multiple);
|
|
1572
|
-
|
|
1573
|
-
const
|
|
1604
|
+
// Never round past the model's hard limits.
|
|
1605
|
+
const floorMultiple = Math.floor(maxDimension / multiple) * multiple;
|
|
1606
|
+
const ceilMultiple = Math.ceil(minDimension / multiple) * multiple;
|
|
1607
|
+
const clamp = (n) => Math.min(floorMultiple, Math.max(ceilMultiple, roundToMultiple(n)));
|
|
1574
1608
|
|
|
1575
|
-
|
|
1576
|
-
const
|
|
1577
|
-
|
|
1578
|
-
|
|
1609
|
+
const boxWidth = Math.max(minDimension, Math.min(maxDimension, roundToMultiple(rw)));
|
|
1610
|
+
const boxHeight = Math.max(minDimension, Math.min(maxDimension, roundToMultiple(rh)));
|
|
1611
|
+
const fitted = predictSharpInsideResizeDims(rw, rh, boxWidth, boxHeight);
|
|
1612
|
+
if (!fitted) return null;
|
|
1579
1613
|
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
const actualWidth = roundToMultiple(metadata.width);
|
|
1583
|
-
const actualHeight = roundToMultiple(metadata.height);
|
|
1614
|
+
return { width: clamp(fitted.width), height: clamp(fitted.height) };
|
|
1615
|
+
}
|
|
1584
1616
|
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1617
|
+
/**
|
|
1618
|
+
* Resizes an image buffer to model-compatible dimensions while maintaining aspect ratio.
|
|
1619
|
+
* Uses sharp's fit:inside to preserve aspect, then rounds to the model divisor.
|
|
1620
|
+
*/
|
|
1621
|
+
async function resizeImageBufferForVideo(buffer, originalWidth, originalHeight, rules = DEFAULT_VIDEO_DIMENSION_RULES) {
|
|
1622
|
+
const target = predictVideoRefPreResizeDims(originalWidth, originalHeight, rules);
|
|
1623
|
+
if (!target) return buffer;
|
|
1591
1624
|
|
|
1592
|
-
return
|
|
1625
|
+
return await sharp(buffer)
|
|
1626
|
+
.resize(target.width, target.height, { fit: 'cover', withoutEnlargement: false })
|
|
1627
|
+
.toBuffer();
|
|
1593
1628
|
}
|
|
1594
1629
|
|
|
1595
1630
|
function normalizeVideoDimensionsLikeWrapper(width, height, rules = DEFAULT_VIDEO_DIMENSION_RULES) {
|
|
@@ -3997,6 +4032,14 @@ if (options.music) {
|
|
|
3997
4032
|
} else if (options.video) {
|
|
3998
4033
|
options.model = options.model || selectDefaultVideoModel(options.videoWorkflow, options, openclawConfig) || 'wan_v2.2-14b-fp8_i2v_lightx2v';
|
|
3999
4034
|
options.model = resolveVideoModelAlias(options.model, options.videoWorkflow);
|
|
4035
|
+
try {
|
|
4036
|
+
await loadLiveModelDefaults(options.model);
|
|
4037
|
+
} catch (error) {
|
|
4038
|
+
fatalCliError(error?.message || 'Could not load the live Sogni model catalog.', {
|
|
4039
|
+
code: error?.code || 'MODEL_CATALOG_UNAVAILABLE',
|
|
4040
|
+
hint: error?.hint
|
|
4041
|
+
});
|
|
4042
|
+
}
|
|
4000
4043
|
const videoModelDefaults = getModelDefaults(options.model, openclawConfig);
|
|
4001
4044
|
// Fall back to skill-local defaults for models the intel registry does not
|
|
4002
4045
|
// carry (e.g. HappyHorse), so they get a sensible 16:9 default instead of the
|
|
@@ -4483,7 +4526,55 @@ if (options.video && !options.frames) {
|
|
|
4483
4526
|
// with sharp `fit: inside` and then override the project width/height with the resized reference dims.
|
|
4484
4527
|
// That means a "valid" requested size can still fail if the resized ref lands off the model divisor.
|
|
4485
4528
|
if (options.video) {
|
|
4486
|
-
const
|
|
4529
|
+
const baseVideoDimensionRules = videoDimensionRulesFromDefaults(getModelDefaults(options.model, openclawConfig), options.model);
|
|
4530
|
+
// A reference image routes through the wrapper's resize, which caps at 1536 for every model
|
|
4531
|
+
// and then adopts the resized reference's dimensions as the project's. Honour that ceiling up
|
|
4532
|
+
// front so the CLI picks a divisor-valid size instead of letting the wrapper clamp blindly.
|
|
4533
|
+
const hasVideoReference = Boolean(options.refImage || options.refImageEnd);
|
|
4534
|
+
const videoDimensionRules = hasVideoReference
|
|
4535
|
+
? {
|
|
4536
|
+
...baseVideoDimensionRules,
|
|
4537
|
+
maxDimension: Math.min(baseVideoDimensionRules.maxDimension, WRAPPER_MAX_REF_VIDEO_DIMENSION)
|
|
4538
|
+
}
|
|
4539
|
+
: baseVideoDimensionRules;
|
|
4540
|
+
|
|
4541
|
+
// An implicit LTX i2v canvas follows an already-compatible local reference
|
|
4542
|
+
// directly. Resolve this before normalizing the model's landscape default so
|
|
4543
|
+
// the CLI does not print an intermediate adjustment that will immediately be
|
|
4544
|
+
// discarded in favor of the reference aspect.
|
|
4545
|
+
const hasRequestedVideoCanvas =
|
|
4546
|
+
cliSet.width ||
|
|
4547
|
+
cliSet.height ||
|
|
4548
|
+
cliSet.targetResolution ||
|
|
4549
|
+
widthFromConfig ||
|
|
4550
|
+
heightFromConfig ||
|
|
4551
|
+
widthFromPrompt ||
|
|
4552
|
+
heightFromPrompt ||
|
|
4553
|
+
targetResolutionFromPrompt;
|
|
4554
|
+
if (
|
|
4555
|
+
isLtx2Model(options.model) &&
|
|
4556
|
+
options.videoWorkflow === 'i2v' &&
|
|
4557
|
+
!hasRequestedVideoCanvas
|
|
4558
|
+
) {
|
|
4559
|
+
const implicitRefPath = options.refImage || options.refImageEnd;
|
|
4560
|
+
if (implicitRefPath && !isHttpUrl(implicitRefPath) && existsSync(implicitRefPath)) {
|
|
4561
|
+
const implicitRefBuffer = readFileSync(implicitRefPath);
|
|
4562
|
+
const implicitRefDims = getImageDimensionsFromBuffer(implicitRefBuffer);
|
|
4563
|
+
if (implicitRefDims?.width && implicitRefDims?.height) {
|
|
4564
|
+
const sourceCanvas = computeSourceAspectCanvas(
|
|
4565
|
+
implicitRefDims.width,
|
|
4566
|
+
implicitRefDims.height,
|
|
4567
|
+
videoDimensionRules
|
|
4568
|
+
);
|
|
4569
|
+
options.width = sourceCanvas.width;
|
|
4570
|
+
options.height = sourceCanvas.height;
|
|
4571
|
+
options._ltxReferencePassthrough =
|
|
4572
|
+
sourceCanvas.width === implicitRefDims.width &&
|
|
4573
|
+
sourceCanvas.height === implicitRefDims.height;
|
|
4574
|
+
}
|
|
4575
|
+
}
|
|
4576
|
+
}
|
|
4577
|
+
|
|
4487
4578
|
if (!Number.isFinite(options.width) || options.width <= 0 || !Number.isFinite(options.height) || options.height <= 0) {
|
|
4488
4579
|
fatalCliError('Video width/height must be positive numbers.', {
|
|
4489
4580
|
code: 'INVALID_ARGUMENT',
|
|
@@ -4532,6 +4623,7 @@ if (options.video) {
|
|
|
4532
4623
|
const buffer = readFileSync(ref.path);
|
|
4533
4624
|
const dims = getImageDimensionsFromBuffer(buffer);
|
|
4534
4625
|
if (!dims?.width || !dims?.height) continue;
|
|
4626
|
+
|
|
4535
4627
|
localRefDims.set(ref.key, dims);
|
|
4536
4628
|
|
|
4537
4629
|
const predicted = predictSharpInsideResizeDims(dims.width, dims.height, options.width, options.height);
|
|
@@ -4569,6 +4661,46 @@ if (options.video) {
|
|
|
4569
4661
|
|
|
4570
4662
|
const beforeW = options.width;
|
|
4571
4663
|
const beforeH = options.height;
|
|
4664
|
+
|
|
4665
|
+
// An exact-aspect bounding box can only land on sizes where BOTH sides are divisor-valid.
|
|
4666
|
+
// For aspect ratios with sparse valid sizes (e.g. 25:14 on a /16 model, which tops out at
|
|
4667
|
+
// 1200x672 under a 1536 cap) that forfeits a large share of the model's pixel budget.
|
|
4668
|
+
// Pre-resizing the reference reaches the cap instead, trading a tiny aspect adjustment for
|
|
4669
|
+
// the resolution — so prefer it when it wins materially on pixels and barely moves the aspect.
|
|
4670
|
+
const preResize = predictVideoRefPreResizeDims(dims.width, dims.height, videoDimensionRules);
|
|
4671
|
+
const candidateArea = candidate.output ? candidate.output.width * candidate.output.height : 0;
|
|
4672
|
+
const preResizeArea = preResize ? preResize.width * preResize.height : 0;
|
|
4673
|
+
const refAspect = dims.width / dims.height;
|
|
4674
|
+
const aspectDrift = preResize
|
|
4675
|
+
? Math.abs((preResize.width / preResize.height) - refAspect) / refAspect
|
|
4676
|
+
: Infinity;
|
|
4677
|
+
|
|
4678
|
+
if (preResizeArea > candidateArea * VIDEO_REF_PRERESIZE_MIN_AREA_GAIN
|
|
4679
|
+
&& aspectDrift <= VIDEO_REF_PRERESIZE_MAX_ASPECT_DRIFT) {
|
|
4680
|
+
options.width = preResize.width;
|
|
4681
|
+
options.height = preResize.height;
|
|
4682
|
+
options[ref.resizeFlag] = true;
|
|
4683
|
+
options._adjustedVideoDims = {
|
|
4684
|
+
reason: 'i2v-ref-pre-resize',
|
|
4685
|
+
referenceType: ref.key,
|
|
4686
|
+
requested: { width: beforeW, height: beforeH },
|
|
4687
|
+
adjusted: { width: options.width, height: options.height },
|
|
4688
|
+
resizedFrom: predicted,
|
|
4689
|
+
resizedTo: { width: preResize.width, height: preResize.height },
|
|
4690
|
+
insteadOf: candidate.output
|
|
4691
|
+
? { width: candidate.output.width, height: candidate.output.height }
|
|
4692
|
+
: null
|
|
4693
|
+
};
|
|
4694
|
+
if (!options.quiet) {
|
|
4695
|
+
console.error(
|
|
4696
|
+
`Pre-resizing ${ref.label.toLowerCase()} to ${preResize.width}x${preResize.height} ` +
|
|
4697
|
+
`instead of shrinking the video to ${candidate.output.width}x${candidate.output.height} ` +
|
|
4698
|
+
`(keeps ${Math.round((preResizeArea / candidateArea - 1) * 100)}% more pixels).`
|
|
4699
|
+
);
|
|
4700
|
+
}
|
|
4701
|
+
continue;
|
|
4702
|
+
}
|
|
4703
|
+
|
|
4572
4704
|
options.width = candidate.width;
|
|
4573
4705
|
options.height = candidate.height;
|
|
4574
4706
|
|
|
@@ -4601,12 +4733,17 @@ if (options.video) {
|
|
|
4601
4733
|
|
|
4602
4734
|
const effectiveDimsSource = localRefDims.get('refImage') || localRefDims.get('refImageEnd') || null;
|
|
4603
4735
|
if (effectiveDimsSource) {
|
|
4604
|
-
const
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
|
|
4736
|
+
const effectiveResizeFlag = localRefDims.has('refImage') ? '_needsRefResize' : '_needsRefEndResize';
|
|
4737
|
+
// A pre-resized reference reaches the wrapper already divisor-valid, so the video lands on
|
|
4738
|
+
// the pre-resize dims rather than the fit:inside prediction of the original.
|
|
4739
|
+
const predicted = options[effectiveResizeFlag]
|
|
4740
|
+
? predictVideoRefPreResizeDims(effectiveDimsSource.width, effectiveDimsSource.height, videoDimensionRules)
|
|
4741
|
+
: predictSharpInsideResizeDims(
|
|
4742
|
+
effectiveDimsSource.width,
|
|
4743
|
+
effectiveDimsSource.height,
|
|
4744
|
+
options.width,
|
|
4745
|
+
options.height
|
|
4746
|
+
);
|
|
4610
4747
|
if (predicted) {
|
|
4611
4748
|
options._effectiveVideoDims = {
|
|
4612
4749
|
width: predicted.width,
|
|
@@ -9854,7 +9991,11 @@ async function main() {
|
|
|
9854
9991
|
return;
|
|
9855
9992
|
}
|
|
9856
9993
|
|
|
9857
|
-
|
|
9994
|
+
// Video catalog data is loaded before model-aware dimension planning.
|
|
9995
|
+
// Other media types retain the connected-stage lookup used previously.
|
|
9996
|
+
if (!options.video) {
|
|
9997
|
+
await loadLiveModelDefaults(options.model);
|
|
9998
|
+
}
|
|
9858
9999
|
await ensureSufficientVideoBalance(client, log);
|
|
9859
10000
|
|
|
9860
10001
|
if (options.estimateVideoCost) {
|
|
@@ -10242,8 +10383,13 @@ async function main() {
|
|
|
10242
10383
|
if (options.outputFormat) {
|
|
10243
10384
|
projectConfig.outputFormat = options.outputFormat;
|
|
10244
10385
|
}
|
|
10386
|
+
// Skip the wrapper's generic resize only for the proven no-op case: an
|
|
10387
|
+
// implicit LTX canvas already equals the compatible local reference.
|
|
10388
|
+
// Explicit canvases and incompatible references retain wrapper handling.
|
|
10245
10389
|
if (options.autoResizeVideoAssets !== null) {
|
|
10246
10390
|
projectConfig.autoResizeVideoAssets = options.autoResizeVideoAssets;
|
|
10391
|
+
} else if (options._ltxReferencePassthrough) {
|
|
10392
|
+
projectConfig.autoResizeVideoAssets = false;
|
|
10247
10393
|
}
|
|
10248
10394
|
|
|
10249
10395
|
if (options.frames) {
|
package/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const PACKAGE_VERSION = '3.17.
|
|
1
|
+
export const PACKAGE_VERSION = '3.17.2';
|