@sogni-ai/sogni-creative-agent-skill 3.62.0 → 3.64.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/.agents/skills/sogni-creative-agent-skill/SKILL.md +35 -11
- package/.agents/skills/sogni-creative-agent-skill/references/image-prompting.md +65 -5
- package/.agents/skills/sogni-creative-agent-skill/references/long-jobs-and-queues.md +20 -0
- package/.agents/skills/sogni-creative-agent-skill/references/loop-maker.md +2 -2
- package/.agents/skills/sogni-creative-agent-skill/references/models.md +70 -24
- package/.agents/skills/sogni-creative-agent-skill/references/private-mature-video.md +21 -16
- package/.agents/skills/sogni-creative-agent-skill/references/video-editing.md +1 -2
- package/.agents/skills/sogni-creative-agent-skill/references/video-prompting.md +813 -64
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/CHANGELOG.md +22 -0
- package/README.md +68 -17
- package/SKILL.md +28 -25
- package/desktop-extension/manifest.json +1 -1
- package/desktop-extension/server/index.mjs +3 -19
- package/desktop-extension/server/tools.mjs +69 -5
- package/generated/creative-agent-runtime.mjs +9 -9
- package/llm.txt +21 -1
- package/openclaw.plugin.json +2 -2
- package/package.json +10 -8
- package/plugin-skills/sogni-creative-agent/SKILL.md +36 -10
- package/references/image-prompting.md +65 -5
- package/references/long-jobs-and-queues.md +20 -0
- package/references/loop-maker.md +2 -2
- package/references/models.md +70 -24
- package/references/openclaw-config.md +7 -0
- package/references/private-mature-video.md +21 -16
- package/references/video-editing.md +1 -2
- package/references/video-prompting.md +813 -64
- package/skill-package.json +2 -2
- package/skills/image_generation.md +1 -1
- package/sogni-agent.mjs +465 -24
- package/version.mjs +1 -1
package/sogni-agent.mjs
CHANGED
|
@@ -91,11 +91,17 @@ import {
|
|
|
91
91
|
import {
|
|
92
92
|
extractToolCallProgressUpdate
|
|
93
93
|
} from '@sogni-ai/sogni-intelligence-client/chatRun';
|
|
94
|
+
import {
|
|
95
|
+
MODEL_PROMPT_GUIDES,
|
|
96
|
+
getModelPromptGuide,
|
|
97
|
+
renderModelPromptGuide
|
|
98
|
+
} from '@sogni-ai/sogni-intelligence-client/prompt-guides';
|
|
94
99
|
import {
|
|
95
100
|
buildImageEditExecutionControls,
|
|
96
101
|
normalizeGptImageModelAlias,
|
|
97
102
|
normalizeGptImageQuality,
|
|
98
103
|
getGptImageRequestOptions,
|
|
104
|
+
gptImageGifDimensions,
|
|
99
105
|
isGptImageModel,
|
|
100
106
|
isKreaIdentityEditModel,
|
|
101
107
|
// Seedream 5.0 Pro Uncensored: external-API image model (text-to-image and
|
|
@@ -165,8 +171,14 @@ const KNOWN_MODEL_CATALOG_TAGS = new Set([
|
|
|
165
171
|
// message). Mirrors the `insufficient_credits` enrichment below: it adds an
|
|
166
172
|
// actionable hint/category so an agent responds correctly instead of looping a
|
|
167
173
|
// covered job that cannot bill. Codes are the source of truth in
|
|
168
|
-
// sogni-socket/constants/errorCodes.js (4078-4081).
|
|
169
|
-
const SUBSCRIPTION_BILLING_ERROR_CODES = new Set(['4078', '4079', '4080', '4081']);
|
|
174
|
+
// sogni-socket/constants/errorCodes.js (4078-4081, 4087, 4089).
|
|
175
|
+
const SUBSCRIPTION_BILLING_ERROR_CODES = new Set(['4078', '4079', '4080', '4081', '4087', '4089']);
|
|
176
|
+
// The socket's refusal for a model with no place on Relaxed. Its wording is the
|
|
177
|
+
// only marker: the jobError carries just 4004, which also covers disabled models
|
|
178
|
+
// and a catalog that is still updating, where retrying is right.
|
|
179
|
+
const RELAXED_UNAVAILABLE_MESSAGE = /not currently available on the Relaxed Supernet|only available on the Fast Supernet/i;
|
|
180
|
+
const RELAXED_UNAVAILABLE_HINT =
|
|
181
|
+
'This model does not run on Relaxed right now. Run --list-models --model-network relaxed to see what does, or rerun with --network fast.';
|
|
170
182
|
const APP_ID_LIMIT_ERROR_CODE = '4061';
|
|
171
183
|
const APP_ID_LIMIT_HINT =
|
|
172
184
|
'This CLI persists and reuses one installation app ID. Keep ~/.config/sogni/app-id between sessions; for ephemeral/container homes, set one stable SOGNI_APP_ID or persist SOGNI_APP_ID_PATH. If the address is already blocked, preserve the stable ID and wait before retrying.';
|
|
@@ -205,6 +217,13 @@ function subscriptionBillingFallback(code) {
|
|
|
205
217
|
purchaseLabel: 'Upgrade to Unlimited Pro',
|
|
206
218
|
purchaseUrl: UNLIMITED_PLAN_URL,
|
|
207
219
|
};
|
|
220
|
+
case '4087':
|
|
221
|
+
case '4089':
|
|
222
|
+
// The plan's Fast capacity is used up until it resets (daily or monthly).
|
|
223
|
+
return {
|
|
224
|
+
retryable: false,
|
|
225
|
+
hint: 'Fast rendering on this plan is paused until it resets, so retrying on Fast will keep failing. Relaxed stays included: rerun with --network relaxed, or set defaultNetwork to relaxed in the plugin config until the reset. Not every model runs there (see --list-models --model-network relaxed) and the queue can take hours, so add --detach and collect the result with --result <id> --wait. To stay on Fast now, pay with Premium Spark using --billing-mode tokens.',
|
|
226
|
+
};
|
|
208
227
|
default:
|
|
209
228
|
return null;
|
|
210
229
|
}
|
|
@@ -698,6 +717,7 @@ function buildCliErrorPayload({ message, code, details, hint, prompt }) {
|
|
|
698
717
|
};
|
|
699
718
|
if (classified.metadata) payload.metadata = classified.metadata;
|
|
700
719
|
if (classified.metadata?.consentInstructions && !hint) payload.hint = classified.metadata.consentInstructions;
|
|
720
|
+
if (classified.hint && !hint) payload.hint = classified.hint;
|
|
701
721
|
if (classified.technicalError && classified.technicalError !== payload.error) {
|
|
702
722
|
payload.technicalError = classified.technicalError;
|
|
703
723
|
}
|
|
@@ -705,7 +725,7 @@ function buildCliErrorPayload({ message, code, details, hint, prompt }) {
|
|
|
705
725
|
if (details) payload.errorDetails = details;
|
|
706
726
|
if (hint) payload.hint = hint;
|
|
707
727
|
if (applySubscriptionBillingEnrichment(payload, code)) {
|
|
708
|
-
// Subscription-billing code (4078-4081) — handled with subscription-specific
|
|
728
|
+
// Subscription-billing code (4078-4081, 4087, 4089) — handled with subscription-specific
|
|
709
729
|
// guidance; skip the generic "Buy Spark Packs" credits branch.
|
|
710
730
|
} else if (classified.category === 'insufficient_credits') {
|
|
711
731
|
payload.purchaseAction = true;
|
|
@@ -799,6 +819,16 @@ function classifyCliError(error, context = {}) {
|
|
|
799
819
|
error = unwrapGenericProjectError(error);
|
|
800
820
|
const rawMessage = cliErrorMessage(error);
|
|
801
821
|
|
|
822
|
+
if (RELAXED_UNAVAILABLE_MESSAGE.test(rawMessage)) {
|
|
823
|
+
return {
|
|
824
|
+
error_type: 'MODEL_UNAVAILABLE',
|
|
825
|
+
category: 'model_unavailable',
|
|
826
|
+
message: rawMessage,
|
|
827
|
+
retryable: false,
|
|
828
|
+
hint: RELAXED_UNAVAILABLE_HINT
|
|
829
|
+
};
|
|
830
|
+
}
|
|
831
|
+
|
|
802
832
|
// HTTP 429: Sogni limits requests per network, and the browser of whoever runs
|
|
803
833
|
// this shares that budget. Say how long to wait, never "try again".
|
|
804
834
|
const rateLimit = rateLimitFromError(error);
|
|
@@ -961,12 +991,13 @@ function addCanonicalErrorFields(payload, error, context = {}) {
|
|
|
961
991
|
payload.retryable = classified.retryable;
|
|
962
992
|
if (classified.metadata) payload.metadata = classified.metadata;
|
|
963
993
|
if (classified.metadata?.consentInstructions && !payload.hint) payload.hint = classified.metadata.consentInstructions;
|
|
994
|
+
if (classified.hint && !payload.hint) payload.hint = classified.hint;
|
|
964
995
|
if (classified.technicalError && classified.technicalError !== classified.message) {
|
|
965
996
|
payload.technicalError = classified.technicalError;
|
|
966
997
|
}
|
|
967
998
|
const subscriptionCode = subscriptionBillingCodeFromError(error);
|
|
968
999
|
if (applySubscriptionBillingEnrichment(payload, subscriptionCode)) {
|
|
969
|
-
// Subscription-billing code (4078-4081) — handled with subscription-specific
|
|
1000
|
+
// Subscription-billing code (4078-4081, 4087, 4089) — handled with subscription-specific
|
|
970
1001
|
// guidance; skip the generic "Buy Spark Packs" credits branch.
|
|
971
1002
|
} else if (classified.category === 'insufficient_credits') {
|
|
972
1003
|
payload.purchaseAction = true;
|
|
@@ -981,6 +1012,13 @@ function addCanonicalErrorFields(payload, error, context = {}) {
|
|
|
981
1012
|
// Human-facing twin of addCanonicalErrorFields: print the classified, friendly
|
|
982
1013
|
// message (with the raw message as a detail line when it differs) so human
|
|
983
1014
|
// users get the same quality of error JSON consumers already receive.
|
|
1015
|
+
// Only these two: the other subscription hints stay in the JSON payload, because
|
|
1016
|
+
// their generic wording can contradict the socket's more specific message.
|
|
1017
|
+
function fastCapacityHint(error) {
|
|
1018
|
+
const code = String(subscriptionBillingCodeFromError(unwrapGenericProjectError(error)) ?? '');
|
|
1019
|
+
return code === '4087' || code === '4089' ? subscriptionBillingFallback(code).hint : null;
|
|
1020
|
+
}
|
|
1021
|
+
|
|
984
1022
|
function printHumanError(error, context = {}) {
|
|
985
1023
|
let classified = null;
|
|
986
1024
|
try { classified = classifyCliError(error, context); } catch { /* fall back to raw */ }
|
|
@@ -991,6 +1029,8 @@ function printHumanError(error, context = {}) {
|
|
|
991
1029
|
}
|
|
992
1030
|
const hint = error?.hint
|
|
993
1031
|
|| classified?.metadata?.consentInstructions
|
|
1032
|
+
|| classified?.hint
|
|
1033
|
+
|| fastCapacityHint(error)
|
|
994
1034
|
|| (classified?.category === 'insufficient_credits' ? SPARK_PACKS_PURCHASE_HINT : null);
|
|
995
1035
|
if (hint) console.error(`Hint: ${hint}`);
|
|
996
1036
|
}
|
|
@@ -1092,7 +1132,7 @@ function createSkillSogniClient(creds, appId) {
|
|
|
1092
1132
|
appSource: SOGNI_APP_SOURCE,
|
|
1093
1133
|
appId,
|
|
1094
1134
|
attribution: clientAttribution(AGENT_ATTRIBUTION),
|
|
1095
|
-
network:
|
|
1135
|
+
network: renderNetwork,
|
|
1096
1136
|
autoConnect: false,
|
|
1097
1137
|
apiKey: creds.SOGNI_API_KEY,
|
|
1098
1138
|
authType: 'apiKey'
|
|
@@ -2032,6 +2072,10 @@ function imageOptionsFromCli() {
|
|
|
2032
2072
|
if (!isGptImage2ModelSelection(options.model)) return {};
|
|
2033
2073
|
return {
|
|
2034
2074
|
...getGptImageRequestOptions({
|
|
2075
|
+
gptImageComplexity: options.imageComplexity,
|
|
2076
|
+
gptImageFrameCount: options.imageFrameCount,
|
|
2077
|
+
gptImageFrameDurationMs: options.imageFrameDurationMs,
|
|
2078
|
+
gptImageMarkupUrl: options.imageMarkupUrl,
|
|
2035
2079
|
gptImageBackground: options.imageBackground ?? undefined,
|
|
2036
2080
|
gptImageOutputCompression: options.imageOutputCompression ?? undefined,
|
|
2037
2081
|
outputFormat: options.outputFormat ?? 'png'
|
|
@@ -2042,6 +2086,19 @@ function imageOptionsFromCli() {
|
|
|
2042
2086
|
}
|
|
2043
2087
|
|
|
2044
2088
|
const SEEDANCE_TASK_TYPES = new Set(['reference', 'edit', 'extend']);
|
|
2089
|
+
|
|
2090
|
+
// Seedance 2.5 draft mode: a draft's job id is what --seedance-finalize takes,
|
|
2091
|
+
// and its expiry is the last moment it can be rendered at 1080p. Reported only
|
|
2092
|
+
// for draft-mode requests, from the completed SDK job.
|
|
2093
|
+
function seedanceDraftResultFields(job) {
|
|
2094
|
+
if (!options.seedanceDraft && options.seedanceFinalize === null) return {};
|
|
2095
|
+
return {
|
|
2096
|
+
jobId: job?.id ?? null,
|
|
2097
|
+
...(options.seedanceDraft
|
|
2098
|
+
? { seedanceDraft: job?.seedanceDraft === true, seedanceDraftExpiresAt: job?.seedanceDraftExpiresAt ?? null }
|
|
2099
|
+
: { seedanceDraftJobId: job?.seedanceDraftJobId ?? options.seedanceFinalize })
|
|
2100
|
+
};
|
|
2101
|
+
}
|
|
2045
2102
|
const QWEN_IMAGE_EDIT_2511_MODEL_IDS = new Set([
|
|
2046
2103
|
'qwen_image_edit_2511_fp8',
|
|
2047
2104
|
'qwen_image_edit_2511_fp8_lightning',
|
|
@@ -2305,9 +2362,19 @@ function requiresSparkOnlyToken(modelId) {
|
|
|
2305
2362
|
|| isWan3ModelSelectionLocal(modelId);
|
|
2306
2363
|
}
|
|
2307
2364
|
|
|
2365
|
+
// Vendor models run on neither worker pool and the socket refuses them on
|
|
2366
|
+
// Relaxed, so a configured default leaves them on Fast. An explicit --network is
|
|
2367
|
+
// sent as asked, and the refusal says why.
|
|
2368
|
+
function projectNetwork(modelId) {
|
|
2369
|
+
if (renderNetwork === 'relaxed' && !options.network && requiresSparkOnlyToken(modelId)) return 'fast';
|
|
2370
|
+
return renderNetwork;
|
|
2371
|
+
}
|
|
2372
|
+
|
|
2308
2373
|
// Attach the user's explicit --billing-mode to a project config. Omitted by
|
|
2309
2374
|
// default so the server keeps deciding coverage (Unlimited members get 'auto'
|
|
2310
|
-
// coverage server-side; token payers are unaffected).
|
|
2375
|
+
// coverage server-side; token payers are unaffected). The render network always
|
|
2376
|
+
// goes on the project: the socket routes on this field over the connection's
|
|
2377
|
+
// network, and the client wrapper fills in 'fast' when it is missing.
|
|
2311
2378
|
function nextSemanticWorkloadAttribution(options = {}) {
|
|
2312
2379
|
return semanticWorkloadAttribution(AGENT_ATTRIBUTION, INVOCATION_LINEAGE.next(options));
|
|
2313
2380
|
}
|
|
@@ -2318,6 +2385,7 @@ function withBillingMode(config, attributionOptions = {}) {
|
|
|
2318
2385
|
...(!options.video && !options.upscaleVideo && !options.music && !options.speech && !options.imageTo3d && options.embedPromptMetadata !== undefined
|
|
2319
2386
|
? { embedPromptMetadata: options.embedPromptMetadata } : {}),
|
|
2320
2387
|
...(options.billingMode ? { billingMode: options.billingMode } : {}),
|
|
2388
|
+
network: projectNetwork(config.modelId),
|
|
2321
2389
|
attribution: nextSemanticWorkloadAttribution(attributionOptions),
|
|
2322
2390
|
};
|
|
2323
2391
|
}
|
|
@@ -3539,6 +3607,181 @@ function loadOpenClawPluginConfig() {
|
|
|
3539
3607
|
}
|
|
3540
3608
|
}
|
|
3541
3609
|
|
|
3610
|
+
// ---------------------------------------------------------------------------
|
|
3611
|
+
// Prompt guides: `sogni-agent prompt-guide [model] [--mode <mode>] [--json]`
|
|
3612
|
+
// prints the prompt rules Sogni's own writers use for a model and mode
|
|
3613
|
+
// (@sogni-ai/sogni-intelligence-client/prompt-guides), so an agent can read
|
|
3614
|
+
// them before writing the prompt itself. The model is resolved the way -m is,
|
|
3615
|
+
// by model id only; nothing here reads prompt text. No API call, no credentials.
|
|
3616
|
+
// ---------------------------------------------------------------------------
|
|
3617
|
+
const PROMPT_GUIDE_USAGE = 'sogni-agent prompt-guide <model> [--mode <mode>] [--json]';
|
|
3618
|
+
|
|
3619
|
+
function promptGuideCatalog() {
|
|
3620
|
+
return Object.entries(MODEL_PROMPT_GUIDES).map(([family, modes]) => ({
|
|
3621
|
+
family,
|
|
3622
|
+
modes: Object.keys(modes),
|
|
3623
|
+
models: [...new Set(Object.values(modes).flatMap((guide) => guide.models))],
|
|
3624
|
+
}));
|
|
3625
|
+
}
|
|
3626
|
+
|
|
3627
|
+
function formatPromptGuideCatalog() {
|
|
3628
|
+
const lines = [
|
|
3629
|
+
`Usage: ${PROMPT_GUIDE_USAGE}`,
|
|
3630
|
+
"Prints the prompt rules Sogni's own writers use for a model, to read before you write its prompt. Free and offline.",
|
|
3631
|
+
'',
|
|
3632
|
+
];
|
|
3633
|
+
for (const { family, modes, models } of promptGuideCatalog()) {
|
|
3634
|
+
lines.push(family, ` modes: ${modes.join(', ')}`, ` models: ${models.join(', ')}`);
|
|
3635
|
+
}
|
|
3636
|
+
return lines.join('\n');
|
|
3637
|
+
}
|
|
3638
|
+
|
|
3639
|
+
// The CLI resolves -m against the run's workflow and frames: with a workflow,
|
|
3640
|
+
// `wan22` t2v/i2v renders on LTX 2.5, and bare tier selectors such as
|
|
3641
|
+
// `minimax-h3-balanced` resolve only with one. A guide mode names both. With no
|
|
3642
|
+
// mode, a run with no media attached is t2v.
|
|
3643
|
+
const PROMPT_GUIDE_MODE_WORKFLOWS = Object.freeze({
|
|
3644
|
+
t2v: ['t2v', false, false],
|
|
3645
|
+
extend: ['t2v', false, false],
|
|
3646
|
+
i2v: ['i2v', true, false],
|
|
3647
|
+
'i2v-keyframes': ['i2v', true, false],
|
|
3648
|
+
l2v: ['i2v', false, true],
|
|
3649
|
+
flf: ['i2v', true, true],
|
|
3650
|
+
flf2v: ['i2v', true, true],
|
|
3651
|
+
r2v: ['r2v', false, false],
|
|
3652
|
+
v2v: ['v2v', false, false],
|
|
3653
|
+
a2v: ['a2v', false, false],
|
|
3654
|
+
'a2v-keyframes': ['a2v', false, false],
|
|
3655
|
+
ia2v: ['ia2v', true, false],
|
|
3656
|
+
flfa2v: ['ia2v', true, true],
|
|
3657
|
+
s2v: ['s2v', true, false],
|
|
3658
|
+
'animate-move': ['animate-move', true, false],
|
|
3659
|
+
'animate-replace': ['animate-replace', true, false],
|
|
3660
|
+
});
|
|
3661
|
+
|
|
3662
|
+
// Every guide mode, in registry order, for listing what one -m value supports.
|
|
3663
|
+
const PROMPT_GUIDE_MODES = [...new Set(Object.values(MODEL_PROMPT_GUIDES).flatMap((modes) => Object.keys(modes)))];
|
|
3664
|
+
|
|
3665
|
+
// The guide for a -m value and mode, resolved in the CLI's own order: its video
|
|
3666
|
+
// selectors for that workflow, then its image selector normalization. The model
|
|
3667
|
+
// id decides; nothing reads prompt text.
|
|
3668
|
+
function resolvePromptGuide(model, mode) {
|
|
3669
|
+
const [workflow, hasStartFrame, hasEndFrame] = mode
|
|
3670
|
+
? (PROMPT_GUIDE_MODE_WORKFLOWS[mode] || [])
|
|
3671
|
+
: PROMPT_GUIDE_MODE_WORKFLOWS.t2v;
|
|
3672
|
+
const video = resolveVideoModelAlias(
|
|
3673
|
+
resolveHappyHorseModelId(
|
|
3674
|
+
resolveSkillVideoModelAlias(model, workflow ?? null, Boolean(hasStartFrame), Boolean(hasEndFrame)),
|
|
3675
|
+
workflow ?? null
|
|
3676
|
+
),
|
|
3677
|
+
workflow
|
|
3678
|
+
);
|
|
3679
|
+
const image = normalizeSeedreamModelAlias(normalizeGptImageModelAlias(model));
|
|
3680
|
+
for (const resolvedModel of new Set([video, image])) {
|
|
3681
|
+
const guide = getModelPromptGuide(resolvedModel, mode || undefined);
|
|
3682
|
+
if (guide) return { guide, resolvedModel };
|
|
3683
|
+
}
|
|
3684
|
+
return null;
|
|
3685
|
+
}
|
|
3686
|
+
|
|
3687
|
+
function runPromptGuideAction(argv) {
|
|
3688
|
+
let model = null;
|
|
3689
|
+
let mode = null;
|
|
3690
|
+
let showCatalog = false;
|
|
3691
|
+
for (let i = 0; i < argv.length; i++) {
|
|
3692
|
+
const arg = argv[i];
|
|
3693
|
+
if (arg === '--mode') {
|
|
3694
|
+
mode = requireFlagValue(argv, i, arg).trim().toLowerCase();
|
|
3695
|
+
i++;
|
|
3696
|
+
} else if (arg === '-m' || arg === '--model') {
|
|
3697
|
+
model = requireFlagValue(argv, i, arg).trim();
|
|
3698
|
+
i++;
|
|
3699
|
+
} else if (arg === '--json' || arg === '--no-update-check') {
|
|
3700
|
+
// --json is read from the raw argv (JSON_ERROR_MODE); the update check reads its own flag.
|
|
3701
|
+
} else if (arg === '--help') {
|
|
3702
|
+
showCatalog = true;
|
|
3703
|
+
} else if (arg.startsWith('-')) {
|
|
3704
|
+
fatalCliError(`Unknown prompt-guide option: ${arg}`, {
|
|
3705
|
+
code: 'INVALID_ARGUMENT',
|
|
3706
|
+
hint: `Usage: ${PROMPT_GUIDE_USAGE}`
|
|
3707
|
+
});
|
|
3708
|
+
} else if (model === null) {
|
|
3709
|
+
model = arg.trim();
|
|
3710
|
+
} else {
|
|
3711
|
+
fatalCliError(`prompt-guide takes one model; got "${model}" and "${arg}".`, {
|
|
3712
|
+
code: 'INVALID_ARGUMENT',
|
|
3713
|
+
hint: `Usage: ${PROMPT_GUIDE_USAGE}`
|
|
3714
|
+
});
|
|
3715
|
+
}
|
|
3716
|
+
}
|
|
3717
|
+
|
|
3718
|
+
const failWithCatalog = (message, details) => {
|
|
3719
|
+
if (!JSON_ERROR_MODE) console.error(formatPromptGuideCatalog());
|
|
3720
|
+
fatalCliError(message, {
|
|
3721
|
+
code: 'INVALID_ARGUMENT',
|
|
3722
|
+
details: { ...details, families: promptGuideCatalog() },
|
|
3723
|
+
hint: `Usage: ${PROMPT_GUIDE_USAGE}. Run sogni-agent prompt-guide with no model to list every guide.`
|
|
3724
|
+
});
|
|
3725
|
+
};
|
|
3726
|
+
|
|
3727
|
+
if (showCatalog || !model) {
|
|
3728
|
+
if (mode && !showCatalog) {
|
|
3729
|
+
failWithCatalog('prompt-guide --mode needs a model.', { mode });
|
|
3730
|
+
}
|
|
3731
|
+
if (JSON_ERROR_MODE) {
|
|
3732
|
+
console.log(JSON.stringify({ success: true, type: 'prompt-guide-list', usage: PROMPT_GUIDE_USAGE, families: promptGuideCatalog() }));
|
|
3733
|
+
} else {
|
|
3734
|
+
console.log(formatPromptGuideCatalog());
|
|
3735
|
+
}
|
|
3736
|
+
return;
|
|
3737
|
+
}
|
|
3738
|
+
|
|
3739
|
+
// Modes differ per selector (krea2-identity-edit only edits; wan22 s2v stays
|
|
3740
|
+
// on WAN 2.2 while its t2v renders on LTX 2.5), so list this -m value's own.
|
|
3741
|
+
const modes = PROMPT_GUIDE_MODES.filter((entry) => resolvePromptGuide(model, entry));
|
|
3742
|
+
const resolved = resolvePromptGuide(model, mode);
|
|
3743
|
+
if (!resolved) {
|
|
3744
|
+
if (mode && modes.length > 0) {
|
|
3745
|
+
fatalCliError(`No "${mode}" prompt guide for ${model}. Its modes: ${modes.join(', ')}.`, {
|
|
3746
|
+
code: 'INVALID_ARGUMENT',
|
|
3747
|
+
details: { model, mode, modes },
|
|
3748
|
+
hint: `Run sogni-agent prompt-guide ${model} --mode <${modes.join('|')}>.`
|
|
3749
|
+
});
|
|
3750
|
+
}
|
|
3751
|
+
failWithCatalog(`No prompt guide for model "${model}".`, { model, mode });
|
|
3752
|
+
}
|
|
3753
|
+
|
|
3754
|
+
const { guide, resolvedModel } = resolved;
|
|
3755
|
+
if (JSON_ERROR_MODE) {
|
|
3756
|
+
console.log(JSON.stringify({
|
|
3757
|
+
success: true,
|
|
3758
|
+
type: 'prompt-guide',
|
|
3759
|
+
model,
|
|
3760
|
+
resolvedModel,
|
|
3761
|
+
family: guide.family,
|
|
3762
|
+
mode: guide.mode,
|
|
3763
|
+
modes,
|
|
3764
|
+
guide,
|
|
3765
|
+
}));
|
|
3766
|
+
return;
|
|
3767
|
+
}
|
|
3768
|
+
const otherModes = modes.filter((entry) => entry !== guide.mode);
|
|
3769
|
+
const footer = [
|
|
3770
|
+
`-m ${model} resolves to ${resolvedModel} in this mode.`,
|
|
3771
|
+
...(otherModes.length > 0
|
|
3772
|
+
? [`Other modes: ${otherModes.join(', ')}. Print one with: sogni-agent prompt-guide ${model} --mode <mode>`]
|
|
3773
|
+
: []),
|
|
3774
|
+
];
|
|
3775
|
+
console.log(`${renderModelPromptGuide(guide, { audience: 'agent' })}\n\n${footer.join('\n')}`);
|
|
3776
|
+
}
|
|
3777
|
+
|
|
3778
|
+
// prompt-guide runs here: after the model alias tables it resolves with, and
|
|
3779
|
+
// before any config, credential or network work.
|
|
3780
|
+
if (RAW_ARGS[0] === 'prompt-guide') {
|
|
3781
|
+
runPromptGuideAction(RAW_ARGS.slice(1));
|
|
3782
|
+
process.exit(0);
|
|
3783
|
+
}
|
|
3784
|
+
|
|
3542
3785
|
const openclawConfig = loadOpenClawPluginConfig();
|
|
3543
3786
|
const CREDENTIALS_PATH = resolveConfiguredPath(
|
|
3544
3787
|
getEnv('SOGNI_CREDENTIALS_PATH') || openclawConfig?.credentialsPath,
|
|
@@ -3587,6 +3830,7 @@ const options = {
|
|
|
3587
3830
|
quality: null, // Quality tier: fast|hq|pro — auto-selects model, steps, dimensions
|
|
3588
3831
|
tokenType: null,
|
|
3589
3832
|
billingMode: null, // auto|subscription|tokens — omitted by default so the server decides coverage
|
|
3833
|
+
network: null, // fast|relaxed; defaults to the configured network, then fast
|
|
3590
3834
|
steps: null,
|
|
3591
3835
|
guidance: null,
|
|
3592
3836
|
outputFormat: null,
|
|
@@ -3634,6 +3878,8 @@ const options = {
|
|
|
3634
3878
|
video: false,
|
|
3635
3879
|
videoWorkflow: null,
|
|
3636
3880
|
seedanceTaskType: null,
|
|
3881
|
+
seedanceDraft: false,
|
|
3882
|
+
seedanceFinalize: null,
|
|
3637
3883
|
legacyWan3TaskType: null,
|
|
3638
3884
|
wan3Ratio: 'adaptive',
|
|
3639
3885
|
wan3SmartDuration: false,
|
|
@@ -3837,6 +4083,8 @@ const cliSet = {
|
|
|
3837
4083
|
video: false,
|
|
3838
4084
|
workflow: false,
|
|
3839
4085
|
seedanceTaskType: false,
|
|
4086
|
+
seedanceDraft: false,
|
|
4087
|
+
seedanceFinalize: false,
|
|
3840
4088
|
wan3Ratio: false,
|
|
3841
4089
|
wan3SmartDuration: false,
|
|
3842
4090
|
wan3ReferenceFileUrl: false,
|
|
@@ -3957,6 +4205,16 @@ for (let i = 0; i < args.length; i++) {
|
|
|
3957
4205
|
i++;
|
|
3958
4206
|
options.billingMode = raw;
|
|
3959
4207
|
cliSet.billingMode = true;
|
|
4208
|
+
} else if (arg === '--network') {
|
|
4209
|
+
const raw = requireFlagValue(args, i, arg);
|
|
4210
|
+
i++;
|
|
4211
|
+
if (!['fast', 'relaxed'].includes(raw)) {
|
|
4212
|
+
fatalCliError('--network must be fast or relaxed.', {
|
|
4213
|
+
code: 'INVALID_ARGUMENT',
|
|
4214
|
+
details: { flag: '--network', value: raw }
|
|
4215
|
+
});
|
|
4216
|
+
}
|
|
4217
|
+
options.network = raw;
|
|
3960
4218
|
} else if (arg === '--steps') {
|
|
3961
4219
|
const raw = requireFlagValue(args, i, arg);
|
|
3962
4220
|
i++;
|
|
@@ -3980,6 +4238,14 @@ for (let i = 0; i < args.length; i++) {
|
|
|
3980
4238
|
i++;
|
|
3981
4239
|
options.outputFormat = raw;
|
|
3982
4240
|
cliSet.outputFormat = true;
|
|
4241
|
+
} else if (arg === '--image-complexity') {
|
|
4242
|
+
options.imageComplexity = requireFlagValue(args, i++, arg);
|
|
4243
|
+
} else if (arg === '--image-frame-count') {
|
|
4244
|
+
options.imageFrameCount = parseNumberValue(requireFlagValue(args, i++, arg), arg);
|
|
4245
|
+
} else if (arg === '--image-frame-duration-ms') {
|
|
4246
|
+
options.imageFrameDurationMs = parseNumberValue(requireFlagValue(args, i++, arg), arg);
|
|
4247
|
+
} else if (arg === '--image-markup-url') {
|
|
4248
|
+
options.imageMarkupUrl = requireFlagValue(args, i++, arg);
|
|
3983
4249
|
} else if (arg === '--image-quality') {
|
|
3984
4250
|
options.imageQuality = requireFlagValue(args, i++, arg);
|
|
3985
4251
|
} else if (arg === '--image-background') {
|
|
@@ -4150,6 +4416,14 @@ for (let i = 0; i < args.length; i++) {
|
|
|
4150
4416
|
i++;
|
|
4151
4417
|
options.seedanceTaskType = raw.trim().toLowerCase();
|
|
4152
4418
|
cliSet.seedanceTaskType = true;
|
|
4419
|
+
} else if (arg === '--seedance-draft') {
|
|
4420
|
+
options.seedanceDraft = true;
|
|
4421
|
+
cliSet.seedanceDraft = true;
|
|
4422
|
+
} else if (arg === '--seedance-finalize') {
|
|
4423
|
+
const raw = requireFlagValue(args, i, arg);
|
|
4424
|
+
i++;
|
|
4425
|
+
options.seedanceFinalize = raw.trim();
|
|
4426
|
+
cliSet.seedanceFinalize = true;
|
|
4153
4427
|
} else if (arg === '--wan3-task-type') {
|
|
4154
4428
|
const raw = requireFlagValue(args, i, arg);
|
|
4155
4429
|
i++;
|
|
@@ -5005,11 +5279,15 @@ Image Options:
|
|
|
5005
5279
|
--distance <key> close-up|medium|wide
|
|
5006
5280
|
--angle-strength <n> LoRA strength for multiple_angles (default: 0.9)
|
|
5007
5281
|
--angle-description <text> Optional subject description
|
|
5008
|
-
--output-format <f> Images: png|jpg|webp; video: mp4|mov (MOV: Seedance 2.5)
|
|
5282
|
+
--output-format <f> Images: png|jpg|webp|gif (GIF: GPT Image 2.6); video: mp4|mov (MOV: Seedance 2.5)
|
|
5009
5283
|
--no-prompt-metadata Omit prompt/settings metadata from worker image outputs
|
|
5010
5284
|
--return-last-frame Export the final video frame as an image (Seedance 2.5)
|
|
5011
|
-
--image-
|
|
5012
|
-
--image-
|
|
5285
|
+
--image-complexity <q> GPT Image 2.6: low|medium|high planning effort
|
|
5286
|
+
--image-frame-count <n> GIF: 2-16 frames (default 9), use --output-format gif
|
|
5287
|
+
--image-frame-duration-ms <n> GIF: 20-2000 ms per frame (default 200)
|
|
5288
|
+
--image-markup-url <url> Transparent annotation PNG for the first edit reference
|
|
5289
|
+
--image-quality <q> GPT Image: low|medium|high; 2.5 and 2.6 also xhigh|max
|
|
5290
|
+
--image-background <b> auto|opaque; 2.5/2.6 also transparent (PNG/WebP)
|
|
5013
5291
|
--image-output-compression <n> JPEG/WebP compression, integer 0–100
|
|
5014
5292
|
--image-mask <path|url> PNG alpha mask of first --context image, same size
|
|
5015
5293
|
--sampler <name> Sampler (images/music; H3 LightX2V Turbo: euler|er_sde|sa_solver; FastH3: euler)
|
|
@@ -5084,6 +5362,9 @@ Video Options:
|
|
|
5084
5362
|
--video, -v Generate video instead of image
|
|
5085
5363
|
--workflow <type> Video workflow: t2v|i2v|r2v|s2v|ia2v|a2v|v2v|animate-move|animate-replace
|
|
5086
5364
|
--seedance-task-type <type> Seedance 2.5 loose-reference operation: reference|edit|extend
|
|
5365
|
+
--seedance-draft Seedance 2.5: render a 480p draft that --seedance-finalize can render at 1080p
|
|
5366
|
+
--seedance-finalize <draft-job-id> Seedance 2.5: render that draft at 1080p with its own prompt, media,
|
|
5367
|
+
length, ratio, seed and audio (send none of them; the final is billed at 1080p)
|
|
5087
5368
|
--wan3-ratio <ratio> Wan 3 ratio: adaptive|16:9|4:3|1:1|3:4|9:16
|
|
5088
5369
|
--smart-duration, --no-smart-duration Let Wan 3 choose 2-30s, or use --duration
|
|
5089
5370
|
--reference-file-url <url> Wan 3 public HTTPS document context (one, up to 100 MB; supported paged formats up to 50 pages)
|
|
@@ -5204,7 +5485,8 @@ Hosted API Modes:
|
|
|
5204
5485
|
--api-base-url <url> Sogni API base URL (default: ${DEFAULT_API_BASE_URL})
|
|
5205
5486
|
|
|
5206
5487
|
General:
|
|
5207
|
-
-t, --timeout <sec> Stop waiting after this many seconds (default: 30, video: 1800, music: 600
|
|
5488
|
+
-t, --timeout <sec> Stop waiting after this many seconds (default: 30, video: 1800, music: 600;
|
|
5489
|
+
at least 1800 on Relaxed).
|
|
5208
5490
|
Counted from submission; time the account's own plan concurrency limit
|
|
5209
5491
|
holds the project is not counted. The project is NOT cancelled; fetch it
|
|
5210
5492
|
later with --result
|
|
@@ -5226,6 +5508,8 @@ General:
|
|
|
5226
5508
|
--token-type <type> Token type: spark|sogni|auto (default: spark, auto retries with alternate)
|
|
5227
5509
|
--billing-mode <mode> Billing: auto|subscription|tokens (default: server decides; "subscription"
|
|
5228
5510
|
requires Sogni Unlimited coverage, "tokens" opts out of it)
|
|
5511
|
+
--network <n> Render on this Supernet: fast|relaxed (default: configured defaultNetwork, else fast).
|
|
5512
|
+
Relaxed queues can take hours; pair long renders with --detach
|
|
5229
5513
|
--balance, --balances Show account, plan, and SPARK/SOGNI balances and exit
|
|
5230
5514
|
--list-models [query] List live Supernet media models; optionally filter by query
|
|
5231
5515
|
--search-models <q> Search live models by ID or name (separator-insensitive)
|
|
@@ -5250,6 +5534,11 @@ General:
|
|
|
5250
5534
|
--version, -V Show sogni-agent version and exit
|
|
5251
5535
|
--no-update-check Skip the once-daily npm update check for this run
|
|
5252
5536
|
self-update Upgrade sogni-agent in place (npm/pnpm/yarn/bun auto-detected)
|
|
5537
|
+
prompt-guide <model> [--mode <mode>] [--json]
|
|
5538
|
+
Print the prompt rules Sogni's own writers use for a model and mode
|
|
5539
|
+
(t2v|i2v|l2v|flf|r2v|v2v|a2v|ia2v|extend|generate|edit|...); read them
|
|
5540
|
+
before writing that model's prompt. Free and offline. With no model it
|
|
5541
|
+
lists every guide
|
|
5253
5542
|
--extract-last-frame <video> <image> Extract last frame from a video (safe ffmpeg wrapper)
|
|
5254
5543
|
--extract-first-frame <video> <image> Extract first frame from a video (safe ffmpeg wrapper)
|
|
5255
5544
|
--extract-frame-at <video> <sec> <image> Extract a timestamped frame (safe ffmpeg wrapper)
|
|
@@ -5461,7 +5750,8 @@ LTX-2 / LTX-2.3 rollback models:
|
|
|
5461
5750
|
|
|
5462
5751
|
Examples:
|
|
5463
5752
|
sogni-agent "a cat wearing a hat"
|
|
5464
|
-
sogni-agent -
|
|
5753
|
+
sogni-agent prompt-guide seedance2-5 --mode i2v
|
|
5754
|
+
sogni-agent -o cat.jpg "a cat"
|
|
5465
5755
|
sogni-agent --multi-angle -c subject.jpg --azimuth front-right --elevation eye-level --distance medium "studio portrait"
|
|
5466
5756
|
sogni-agent --angles-360 -c subject.jpg "studio portrait"
|
|
5467
5757
|
sogni-agent --video --ref cat.jpg -o cat.mp4 "cat walks around"
|
|
@@ -5628,6 +5918,17 @@ if (options.billingMode) {
|
|
|
5628
5918
|
options.billingMode = mode;
|
|
5629
5919
|
}
|
|
5630
5920
|
|
|
5921
|
+
// --network wins, then the configured default, then Fast.
|
|
5922
|
+
function resolveRenderNetwork() {
|
|
5923
|
+
if (options.network) return options.network;
|
|
5924
|
+
const configured = openclawConfig?.defaultNetwork;
|
|
5925
|
+
if (!configured) return 'fast';
|
|
5926
|
+
if (configured === 'fast' || configured === 'relaxed') return configured;
|
|
5927
|
+
console.error(`Warning: defaultNetwork must be "fast" or "relaxed" (got ${JSON.stringify(configured)}); using fast.`);
|
|
5928
|
+
return 'fast';
|
|
5929
|
+
}
|
|
5930
|
+
const renderNetwork = resolveRenderNetwork();
|
|
5931
|
+
|
|
5631
5932
|
if (options.apiTaskProfile) {
|
|
5632
5933
|
const profile = String(options.apiTaskProfile).trim().toLowerCase();
|
|
5633
5934
|
if (!VALID_API_TASK_PROFILES.has(profile)) {
|
|
@@ -5848,7 +6149,7 @@ if (options.outputFormat) {
|
|
|
5848
6149
|
details: { outputFormat: options.outputFormat }
|
|
5849
6150
|
});
|
|
5850
6151
|
}
|
|
5851
|
-
} else if (!['png', 'jpg', 'webp'].includes(options.outputFormat)) {
|
|
6152
|
+
} else if (!['png', 'jpg', 'webp', 'gif'].includes(options.outputFormat)) {
|
|
5852
6153
|
fatalCliError('Image output format must be "png", "jpg", or "webp".', {
|
|
5853
6154
|
code: 'INVALID_ARGUMENT',
|
|
5854
6155
|
details: { outputFormat: options.outputFormat }
|
|
@@ -5860,7 +6161,7 @@ if (options.returnLastFrame && (!options.video || !isSeedance25ModelSelectionLoc
|
|
|
5860
6161
|
fatalCliError('--return-last-frame requires Seedance 2.5 video.', { code: 'INVALID_ARGUMENT' });
|
|
5861
6162
|
}
|
|
5862
6163
|
|
|
5863
|
-
if (options.imageQuality !== null || options.imageBackground !== null || options.imageOutputCompression !== null || options.imageMask !== null) {
|
|
6164
|
+
if (options.imageQuality !== null || options.imageBackground !== null || options.imageOutputCompression !== null || options.imageMask !== null || [options.imageComplexity, options.imageFrameCount, options.imageFrameDurationMs, options.imageMarkupUrl].some(value => value !== undefined) || options.outputFormat === 'gif') {
|
|
5864
6165
|
try {
|
|
5865
6166
|
if (options.video || options.music || !isGptImage2ModelSelection(options.model)) {
|
|
5866
6167
|
throw new Error('Image quality, background, compression and mask options require a GPT Image model.');
|
|
@@ -6451,6 +6752,13 @@ if (options.music) {
|
|
|
6451
6752
|
: 'Use -m minimax-h3-fasth3-turbo-2stage for 2K MiniMax H3 video, or pass the short side in pixels.'
|
|
6452
6753
|
});
|
|
6453
6754
|
}
|
|
6755
|
+
// Seedance 2.5 drafts render at 480p only, so a draft with no size asked for
|
|
6756
|
+
// gets the 480p canvas. A finalize sends no size: its final is the 1080p size
|
|
6757
|
+
// for the draft's ratio.
|
|
6758
|
+
if (options.seedanceDraft && !cliSet.targetResolution && !targetResolutionFromPrompt && !cliSet.width && !cliSet.height) {
|
|
6759
|
+
options.targetResolution = 480;
|
|
6760
|
+
cliSet.targetResolution = true;
|
|
6761
|
+
}
|
|
6454
6762
|
const hasExplicitVideoCanvas = cliSet.width || cliSet.height || widthFromConfig || heightFromConfig || widthFromPrompt || heightFromPrompt;
|
|
6455
6763
|
if (isTwoStageVideo) {
|
|
6456
6764
|
const requestedClass = (cliSet.targetResolution || targetResolutionFromPrompt) ? options.targetResolution : undefined;
|
|
@@ -6547,12 +6855,23 @@ if (options.music) {
|
|
|
6547
6855
|
|
|
6548
6856
|
if (!options.video && !options.music && isGptImage2ModelSelection(options.model)) {
|
|
6549
6857
|
options.model = normalizeGptImageModelAlias(options.model);
|
|
6858
|
+
if (options.outputFormat === 'gif') {
|
|
6859
|
+
if (options.contextImages.length || options.imageMask || options.imageMarkupUrl) fatalCliError('GIF output requires text-to-image generation without references, mask or markup.', { code: 'INVALID_ARGUMENT' });
|
|
6860
|
+
try {
|
|
6861
|
+
Object.assign(options, gptImageGifDimensions(
|
|
6862
|
+
cliSet.width || widthFromConfig || widthFromPrompt ? options.width : undefined,
|
|
6863
|
+
cliSet.height || heightFromConfig || heightFromPrompt ? options.height : undefined,
|
|
6864
|
+
options.imageFrameCount
|
|
6865
|
+
));
|
|
6866
|
+
} catch (error) { fatalCliError(error.message, { code: 'INVALID_ARGUMENT' }); }
|
|
6867
|
+
} else {
|
|
6550
6868
|
if (!cliSet.width && !widthFromConfig && !widthFromPrompt) options.width = 1024;
|
|
6551
6869
|
if (!cliSet.height && !heightFromConfig && !heightFromPrompt) options.height = 1024;
|
|
6552
6870
|
const { width, height } = options;
|
|
6553
6871
|
if (width % 16 || height % 16 || Math.max(width, height) > 3840 || Math.max(width, height) / Math.min(width, height) > 3 || width * height < 655360 || width * height > 8294400) {
|
|
6554
6872
|
fatalCliError('GPT Image dimensions must be multiples of 16, at most 3840 per edge, within 3:1 and 655360–8294400 pixels.', { code: 'INVALID_ARGUMENT' });
|
|
6555
6873
|
}
|
|
6874
|
+
}
|
|
6556
6875
|
if (!cliSet.timeout && !timeoutFromConfig) options.timeout = 600000;
|
|
6557
6876
|
}
|
|
6558
6877
|
|
|
@@ -6649,6 +6968,8 @@ const personaUtilityAction = Boolean(options.personaAction && options.personaAct
|
|
|
6649
6968
|
const contractUtilityAction = Boolean(options.contractAction);
|
|
6650
6969
|
const storyboardPlanUtilityAction = Boolean(options.storyboardPlanAction);
|
|
6651
6970
|
const commandUsesGenerationSeed = !options.apiChat &&
|
|
6971
|
+
// A Seedance 2.5 finalize renders its draft with the draft's own seed.
|
|
6972
|
+
!options.seedanceFinalize &&
|
|
6652
6973
|
!apiWorkflowUtilityAction &&
|
|
6653
6974
|
!apiModelUtilityAction &&
|
|
6654
6975
|
!liveModelUtilityAction &&
|
|
@@ -6681,6 +7002,25 @@ if (apiWorkflowStartAction && apiWorkflowTemplate === 'generated_keyframe_video'
|
|
|
6681
7002
|
if (apiWorkflowStartAction && apiWorkflowTemplate === 'storyboard_video' && !options.prompt && !apiWorkflowStartHasExternalInput) {
|
|
6682
7003
|
fatalCliError('--api-workflow storyboard-video preset requires a prompt or --workflow-input JSON.', { code: 'INVALID_ARGUMENT' });
|
|
6683
7004
|
}
|
|
7005
|
+
if (options.network) {
|
|
7006
|
+
const unrouted = [
|
|
7007
|
+
['--api-chat, which runs on hosted Fast', options.apiChat],
|
|
7008
|
+
['hosted workflows, which run on hosted Fast', options.apiWorkflowAction],
|
|
7009
|
+
['--list-models or --search-models (use --model-network)', liveModelUtilityAction]
|
|
7010
|
+
].find(([, applies]) => applies);
|
|
7011
|
+
if (unrouted) {
|
|
7012
|
+
fatalCliError(`--network cannot be combined with ${unrouted[0]}.`, {
|
|
7013
|
+
code: 'INVALID_ARGUMENT',
|
|
7014
|
+
details: { flag: '--network', conflictsWith: unrouted[0] }
|
|
7015
|
+
});
|
|
7016
|
+
}
|
|
7017
|
+
}
|
|
7018
|
+
// Relaxed queues run far longer than Fast, so its renders get at least the wait a
|
|
7019
|
+
// queued video gets, unless the caller or the config chose one. Timing out leaves
|
|
7020
|
+
// the project running; --result <id> --wait collects it.
|
|
7021
|
+
if (!cliSet.timeout && !timeoutFromConfig && projectNetwork(options.model) === 'relaxed') {
|
|
7022
|
+
options.timeout = Math.max(options.timeout, 1800000);
|
|
7023
|
+
}
|
|
6684
7024
|
if (!liveModelUtilityAction && (options.liveModelMedia !== 'all' || options.liveModelNetwork || options.liveModelTags.length > 0)) {
|
|
6685
7025
|
fatalCliError('--model-media, --model-network, and --model-tag require --list-models or --search-models.', {
|
|
6686
7026
|
code: 'INVALID_ARGUMENT'
|
|
@@ -6719,7 +7059,7 @@ const wan3HasMediaInput = isWan3ModelLocal(options.model) && Boolean(
|
|
|
6719
7059
|
|| options.wan3ReferenceFileUrl
|
|
6720
7060
|
|| options.wan3ReferenceLinkUrl
|
|
6721
7061
|
);
|
|
6722
|
-
if (!options.prompt && !options.projectLookup && !wan3HasMediaInput && !options.segmentImage && !options.imageTo3d && !options.removeBackground && !options.upscaleImage && !options.upscaleVideo && !options.apiChat && !apiWorkflowUtilityAction && !apiWorkflowStartAction && !apiModelUtilityAction && !liveModelUtilityAction && !loraCatalogUtilityAction && !apiReplayUtilityAction && !contractUtilityAction && !storyboardPlanUtilityAction && !options.estimateVideoCost && !options.multiAngle && !options.showBalance && !options.showVersion && !options.doctor && !options.extractLastFrame && !options.extractFirstFrame && !options.extractFrameAt && !options.trimVideo && !options.verifyVideo && !options.concatVideos && !options.sourceReelDir && !options.remixAudio && !options.listMedia && !options.memoryAction && !options.personalityAction && !personaUtilityAction) {
|
|
7062
|
+
if (!options.prompt && !options.projectLookup && !options.seedanceFinalize && !wan3HasMediaInput && !options.segmentImage && !options.imageTo3d && !options.removeBackground && !options.upscaleImage && !options.upscaleVideo && !options.apiChat && !apiWorkflowUtilityAction && !apiWorkflowStartAction && !apiModelUtilityAction && !liveModelUtilityAction && !loraCatalogUtilityAction && !apiReplayUtilityAction && !contractUtilityAction && !storyboardPlanUtilityAction && !options.estimateVideoCost && !options.multiAngle && !options.showBalance && !options.showVersion && !options.doctor && !options.extractLastFrame && !options.extractFirstFrame && !options.extractFrameAt && !options.trimVideo && !options.verifyVideo && !options.concatVideos && !options.sourceReelDir && !options.remixAudio && !options.listMedia && !options.memoryAction && !options.personalityAction && !personaUtilityAction) {
|
|
6723
7063
|
fatalCliError('No prompt provided. Use --help for usage.', { code: 'INVALID_ARGUMENT' });
|
|
6724
7064
|
}
|
|
6725
7065
|
|
|
@@ -6841,8 +7181,8 @@ if (options.legacyWan3TaskType !== null) {
|
|
|
6841
7181
|
);
|
|
6842
7182
|
}
|
|
6843
7183
|
|
|
6844
|
-
if (!options.video && !options.apiChat && !options.apiWorkflowAction && (options.refAudio || options.refVideo || options.refMask || options.referenceAudioIdentity || options.voicePersonaName || options.videoWorkflow || options.seedanceTaskType || options.wan3SmartDuration || options.wan3ReferenceFileUrl || options.wan3ReferenceLinkUrl || options.wan3Watermark || cliSet.wan3Ratio || options.frames || options.targetResolution || options.audioStart !== null || options.audioDuration !== null || options.videoStart !== null || options.outpaintPosition || options.outpaintAspectRatio)) {
|
|
6845
|
-
fatalCliError('Video-only options (--workflow/--seedance-task-type/--wan3-ratio/--smart-duration/--reference-file-url/--reference-link-url/--watermark/--frames/--target-resolution/--ref-audio/--ref-video/--mask/--outpaint-position/--reference-audio-identity/--voice-persona) require --video.', {
|
|
7184
|
+
if (!options.video && !options.apiChat && !options.apiWorkflowAction && (options.refAudio || options.refVideo || options.refMask || options.referenceAudioIdentity || options.voicePersonaName || options.videoWorkflow || options.seedanceTaskType || options.seedanceDraft || options.seedanceFinalize || options.wan3SmartDuration || options.wan3ReferenceFileUrl || options.wan3ReferenceLinkUrl || options.wan3Watermark || cliSet.wan3Ratio || options.frames || options.targetResolution || options.audioStart !== null || options.audioDuration !== null || options.videoStart !== null || options.outpaintPosition || options.outpaintAspectRatio)) {
|
|
7185
|
+
fatalCliError('Video-only options (--workflow/--seedance-task-type/--seedance-draft/--seedance-finalize/--wan3-ratio/--smart-duration/--reference-file-url/--reference-link-url/--watermark/--frames/--target-resolution/--ref-audio/--ref-video/--mask/--outpaint-position/--reference-audio-identity/--voice-persona) require --video.', {
|
|
6846
7186
|
code: 'INVALID_ARGUMENT'
|
|
6847
7187
|
});
|
|
6848
7188
|
}
|
|
@@ -6879,6 +7219,61 @@ if (options.video) {
|
|
|
6879
7219
|
details: { model: options.model, seedanceTaskType: options.seedanceTaskType }
|
|
6880
7220
|
});
|
|
6881
7221
|
}
|
|
7222
|
+
// Seedance 2.5 draft mode: --seedance-draft renders a 480p draft, and
|
|
7223
|
+
// --seedance-finalize renders that draft at 1080p. The final reuses every
|
|
7224
|
+
// generation-defining input of its draft, and Sogni refuses any of them sent
|
|
7225
|
+
// again, so they are refused here in the CLI's own flag names.
|
|
7226
|
+
if ((options.seedanceDraft || options.seedanceFinalize !== null) && !isSeedance25Video) {
|
|
7227
|
+
fatalCliError('Seedance draft mode (--seedance-draft, --seedance-finalize) is supported only by Seedance 2.5.', {
|
|
7228
|
+
code: 'INVALID_ARGUMENT',
|
|
7229
|
+
details: { model: options.model },
|
|
7230
|
+
hint: 'Pass -m with the Seedance 2.5 model that made (or will make) the draft, such as -m seedance2-5.'
|
|
7231
|
+
});
|
|
7232
|
+
}
|
|
7233
|
+
if (options.seedanceDraft && options.seedanceFinalize !== null) {
|
|
7234
|
+
fatalCliError('--seedance-draft and --seedance-finalize cannot be combined: render a draft, or finalize one.', {
|
|
7235
|
+
code: 'INVALID_ARGUMENT'
|
|
7236
|
+
});
|
|
7237
|
+
}
|
|
7238
|
+
if (options.seedanceDraft && (cliSet.targetResolution || targetResolutionFromPrompt) && Number(options.targetResolution) !== 480) {
|
|
7239
|
+
fatalCliError(`Seedance 2.5 drafts render at 480p only, not ${options.targetResolution}p. Use --target-resolution 480 or leave it out.`, {
|
|
7240
|
+
code: 'INVALID_ARGUMENT',
|
|
7241
|
+
details: { targetResolution: options.targetResolution }
|
|
7242
|
+
});
|
|
7243
|
+
}
|
|
7244
|
+
if (options.seedanceFinalize !== null) {
|
|
7245
|
+
if (!options.seedanceFinalize) {
|
|
7246
|
+
fatalCliError('--seedance-finalize needs the job id of a Seedance 2.5 draft.', { code: 'INVALID_ARGUMENT' });
|
|
7247
|
+
}
|
|
7248
|
+
const inherited = [
|
|
7249
|
+
[options.prompt, 'a prompt'],
|
|
7250
|
+
[options.refImage, '--ref'],
|
|
7251
|
+
[options.refImageEnd, '--ref-end'],
|
|
7252
|
+
[options.contextImages.length > 0, '-c/--context'],
|
|
7253
|
+
[options.refAudio || options.refAudios.length > 0, '--ref-audio'],
|
|
7254
|
+
[options.refVideo || options.refVideos.length > 0, '--ref-video'],
|
|
7255
|
+
[options.referenceAudioIdentity || options.voicePersonaName, '--reference-audio-identity/--voice-persona'],
|
|
7256
|
+
[options.keyframes.length > 0, '--keyframe'],
|
|
7257
|
+
[cliSet.duration, '--duration'],
|
|
7258
|
+
[cliSet.frames, '--frames'],
|
|
7259
|
+
[cliSet.seed || options.lastSeed, '--seed/--last-seed'],
|
|
7260
|
+
[options.apiGenerateAudio !== null, '--generate-audio/--no-generate-audio'],
|
|
7261
|
+
[cliSet.seedanceTaskType || cliSet.workflow, '--seedance-task-type/--workflow'],
|
|
7262
|
+
[cliSet.width || cliSet.height || cliSet.targetResolution, '-w/-h/--target-resolution'],
|
|
7263
|
+
[cliSet.count && options.count !== 1, '-n']
|
|
7264
|
+
].filter(([present]) => present).map(([, flag]) => flag);
|
|
7265
|
+
if (inherited.length > 0) {
|
|
7266
|
+
fatalCliError(
|
|
7267
|
+
`A Seedance 2.5 finalize renders its draft at 1080p with the draft's own prompt, media, length, ratio, seed and audio; remove ${inherited.join(', ')}.`,
|
|
7268
|
+
{
|
|
7269
|
+
code: 'INVALID_ARGUMENT',
|
|
7270
|
+
details: { seedanceFinalize: options.seedanceFinalize, inherited },
|
|
7271
|
+
hint: `sogni-agent --video -m ${options.model} --seedance-finalize ${options.seedanceFinalize} -o final.mp4`
|
|
7272
|
+
}
|
|
7273
|
+
);
|
|
7274
|
+
}
|
|
7275
|
+
options.count = 1;
|
|
7276
|
+
}
|
|
6882
7277
|
if ((cliSet.wan3Ratio || options.wan3SmartDuration || options.wan3ReferenceFileUrl || options.wan3ReferenceLinkUrl || options.wan3Watermark) && !isWan3Video) {
|
|
6883
7278
|
fatalCliError('Wan 3 controls are supported only by Wan 3 or Wan 3.0 Enhanced.', {
|
|
6884
7279
|
code: 'INVALID_ARGUMENT',
|
|
@@ -7394,7 +7789,8 @@ if (options.video) {
|
|
|
7394
7789
|
fatalCliError(
|
|
7395
7790
|
'Seedance reference modes are mutually exclusive: native --ref/--ref-end frame anchors cannot be combined with loose image, video, or audio references. '
|
|
7396
7791
|
+ 'Pick one: use --ref/--ref-end alone for first-class frame anchoring, or use -c/--context with optional --ref-video/--ref-audio and @ImageN/@VideoN/@AudioN prompt language. '
|
|
7397
|
-
+ 'For image-plus-audio generation, select --workflow ia2v; there --ref is mapped to a loose @Image reference instead of first_frame.'
|
|
7792
|
+
+ 'For image-plus-audio generation, select --workflow ia2v; there --ref is mapped to a loose @Image reference instead of first_frame. '
|
|
7793
|
+
+ 'To open on a picture while using references, pass it with -c and state it in the prompt as the first frame ("@ImageN is the first frame of this video").',
|
|
7398
7794
|
{ code: 'INVALID_ARGUMENT', details: {
|
|
7399
7795
|
dedicatedFrames: seedanceFrameInputs,
|
|
7400
7796
|
looseReferences: seedanceLooseInputs,
|
|
@@ -9793,7 +10189,7 @@ async function fetchLiveModelCatalog(network, media) {
|
|
|
9793
10189
|
}
|
|
9794
10190
|
|
|
9795
10191
|
async function runLiveModels() {
|
|
9796
|
-
const network = options.liveModelNetwork ||
|
|
10192
|
+
const network = options.liveModelNetwork || renderNetwork;
|
|
9797
10193
|
const media = options.liveModelMedia || 'all';
|
|
9798
10194
|
const query = options.liveModelQuery?.trim() || null;
|
|
9799
10195
|
const normalizedQuery = normalizeLiveModelSearch(query);
|
|
@@ -12637,6 +13033,7 @@ function sourceReelChildArgs(baseArgs, outputPath, prompt, plan, duration) {
|
|
|
12637
13033
|
...baseArgs
|
|
12638
13034
|
];
|
|
12639
13035
|
if (options.tokenType) args.push('--token-type', options.tokenType);
|
|
13036
|
+
if (options.network) args.push('--network', options.network);
|
|
12640
13037
|
if (options.steps !== null && options.steps !== undefined) args.push('--steps', String(options.steps));
|
|
12641
13038
|
if (options.guidance !== null && options.guidance !== undefined) args.push('--guidance', String(options.guidance));
|
|
12642
13039
|
if (options.noFilter) args.push('--no-filter');
|
|
@@ -13064,7 +13461,10 @@ function projectLookupSummary(result) {
|
|
|
13064
13461
|
...(job.reason ? { reason: job.reason } : {}),
|
|
13065
13462
|
...(job.kind ? { kind: job.kind } : {}),
|
|
13066
13463
|
...(job.url ? { url: job.url } : {}),
|
|
13067
|
-
...(job.urlUnavailable ? { urlUnavailable: job.urlUnavailable } : {})
|
|
13464
|
+
...(job.urlUnavailable ? { urlUnavailable: job.urlUnavailable } : {}),
|
|
13465
|
+
// Seedance 2.5 draft mode: render a draft at 1080p with --seedance-finalize <id> before it expires.
|
|
13466
|
+
...(job.seedanceDraft === true ? { seedanceDraft: true, seedanceDraftExpiresAt: job.seedanceDraftExpiresAt ?? null } : {}),
|
|
13467
|
+
...(job.seedanceDraftJobId ? { seedanceDraftJobId: job.seedanceDraftJobId } : {})
|
|
13068
13468
|
}))
|
|
13069
13469
|
};
|
|
13070
13470
|
}
|
|
@@ -13920,11 +14320,16 @@ async function buildVideoEstimateParams({ tokenType, steps }) {
|
|
|
13920
14320
|
fps: options.fps,
|
|
13921
14321
|
numberOfMedia: options.count,
|
|
13922
14322
|
tokenType,
|
|
14323
|
+
network: projectNetwork(options.model),
|
|
13923
14324
|
...(Number.isFinite(steps) && steps > 0 ? { steps } : {}),
|
|
13924
14325
|
...(options.frames ? { frames: options.frames } : { duration: options.duration }),
|
|
13925
14326
|
...(referenceImageCount !== undefined ? { referenceImageCount } : {}),
|
|
13926
14327
|
// MiniMax H3 keyframes: two are included, each extra one adds output time.
|
|
13927
|
-
...(options.keyframes.length > 0 ? { keyframeCount: options.keyframes.length } : {})
|
|
14328
|
+
...(options.keyframes.length > 0 ? { keyframeCount: options.keyframes.length } : {}),
|
|
14329
|
+
// Seedance 2.5 draft mode: a draft is quoted as its 480p job, a finalize
|
|
14330
|
+
// from its draft (the server ignores this request's size and length).
|
|
14331
|
+
...(options.seedanceDraft ? { seedanceDraft: true } : {}),
|
|
14332
|
+
...(options.seedanceFinalize !== null ? { seedanceDraftJobId: options.seedanceFinalize } : {})
|
|
13928
14333
|
};
|
|
13929
14334
|
|
|
13930
14335
|
if ((isSeedanceVideo || isWan3Video || isMiniMaxH3R2v) && videoSources.length > 0) {
|
|
@@ -14126,7 +14531,7 @@ async function runDoctor() {
|
|
|
14126
14531
|
appSource: SOGNI_APP_SOURCE,
|
|
14127
14532
|
appId: getOrCreateSogniAppId(),
|
|
14128
14533
|
attribution: clientAttribution(AGENT_ATTRIBUTION),
|
|
14129
|
-
network:
|
|
14534
|
+
network: renderNetwork,
|
|
14130
14535
|
autoConnect: false,
|
|
14131
14536
|
apiKey: creds.SOGNI_API_KEY,
|
|
14132
14537
|
authType: 'apiKey'
|
|
@@ -14811,6 +15216,7 @@ async function main() {
|
|
|
14811
15216
|
success: true,
|
|
14812
15217
|
type: 'video-cost',
|
|
14813
15218
|
model: options.model,
|
|
15219
|
+
network: estimateParams.network,
|
|
14814
15220
|
width: options.width,
|
|
14815
15221
|
height: options.height,
|
|
14816
15222
|
fps: options.fps,
|
|
@@ -14821,6 +15227,12 @@ async function main() {
|
|
|
14821
15227
|
count: options.count,
|
|
14822
15228
|
...(delivered ? { deliveredWidth: delivered.width, deliveredHeight: delivered.height } : {}),
|
|
14823
15229
|
...(options.keyframes.length > 0 ? { keyframeCount: options.keyframes.length } : {}),
|
|
15230
|
+
// A finalize is quoted from its draft: 1080p in the draft's ratio, for
|
|
15231
|
+
// the draft's length, not this request's defaults.
|
|
15232
|
+
...(options.seedanceFinalize !== null
|
|
15233
|
+
? { width: null, height: null, frames: null, duration: null, seedanceDraftJobId: options.seedanceFinalize }
|
|
15234
|
+
: {}),
|
|
15235
|
+
...(options.seedanceDraft ? { seedanceDraft: true } : {}),
|
|
14824
15236
|
estimate
|
|
14825
15237
|
}));
|
|
14826
15238
|
} else {
|
|
@@ -14865,6 +15277,7 @@ async function main() {
|
|
|
14865
15277
|
seed: jobData.seed,
|
|
14866
15278
|
jobIndex: data.jobIndex,
|
|
14867
15279
|
projectId: data.projectId,
|
|
15280
|
+
...seedanceDraftResultFields(data.job),
|
|
14868
15281
|
nsfwDetected: data.job?.nsfwDetected ?? jobData.nsfwDetected ?? false,
|
|
14869
15282
|
nsfwSources: data.job?.nsfwSources ?? jobData.nsfwSources ?? [],
|
|
14870
15283
|
...(withheld ? { urlUnavailable: 'sensitiveContent' } : {})
|
|
@@ -15398,6 +15811,7 @@ async function main() {
|
|
|
15398
15811
|
if (options.seedanceTaskType) {
|
|
15399
15812
|
projectConfig.seedanceTaskType = options.seedanceTaskType;
|
|
15400
15813
|
}
|
|
15814
|
+
if (options.seedanceDraft) projectConfig.seedanceDraft = true;
|
|
15401
15815
|
if (options.returnLastFrame) projectConfig.returnLastFrame = true;
|
|
15402
15816
|
if (isWan3Video) {
|
|
15403
15817
|
projectConfig.ratio = options.wan3Ratio;
|
|
@@ -15560,6 +15974,16 @@ async function main() {
|
|
|
15560
15974
|
projectConfig.loraStrengths = options.loraStrengths;
|
|
15561
15975
|
}
|
|
15562
15976
|
|
|
15977
|
+
if (options.seedanceFinalize !== null) {
|
|
15978
|
+
// The final is its draft at 1080p: Sogni takes the prompt, media, length,
|
|
15979
|
+
// ratio, seed and audio from the draft and refuses them sent again. The
|
|
15980
|
+
// flags that set them are refused up front; the default length is not.
|
|
15981
|
+
delete projectConfig.duration;
|
|
15982
|
+
projectConfig.positivePrompt = '';
|
|
15983
|
+
projectConfig.seedanceDraftJobId = options.seedanceFinalize;
|
|
15984
|
+
log(`Rendering Seedance draft ${options.seedanceFinalize} at 1080p...`);
|
|
15985
|
+
}
|
|
15986
|
+
|
|
15563
15987
|
await warnAboutInFlightProjects(client, log);
|
|
15564
15988
|
const videoResult = trackProjectResult(
|
|
15565
15989
|
await client.createVideoProject(withBillingMode(projectConfig))
|
|
@@ -16031,8 +16455,11 @@ async function main() {
|
|
|
16031
16455
|
seeds,
|
|
16032
16456
|
projectId: firstResult.projectId,
|
|
16033
16457
|
urls: urls,
|
|
16034
|
-
results: results.map(({ resultUrl, seed, jobIndex, nsfwDetected, nsfwSources, urlUnavailable }) => ({
|
|
16035
|
-
url: resultUrl, seed, jobIndex, nsfwDetected, nsfwSources, ...(urlUnavailable ? { urlUnavailable } : {})
|
|
16458
|
+
results: results.map(({ resultUrl, seed, jobIndex, nsfwDetected, nsfwSources, urlUnavailable, jobId, seedanceDraft, seedanceDraftExpiresAt, seedanceDraftJobId }) => ({
|
|
16459
|
+
url: resultUrl, seed, jobIndex, nsfwDetected, nsfwSources, ...(urlUnavailable ? { urlUnavailable } : {}),
|
|
16460
|
+
...(jobId ? { jobId } : {}),
|
|
16461
|
+
...(seedanceDraft !== undefined ? { seedanceDraft, seedanceDraftExpiresAt } : {}),
|
|
16462
|
+
...(seedanceDraftJobId ? { seedanceDraftJobId } : {})
|
|
16036
16463
|
})),
|
|
16037
16464
|
localPath: options.output || null,
|
|
16038
16465
|
tokenType: options.tokenType || 'spark',
|
|
@@ -16194,7 +16621,7 @@ async function main() {
|
|
|
16194
16621
|
appSource: SOGNI_APP_SOURCE,
|
|
16195
16622
|
appId: getOrCreateSogniAppId(),
|
|
16196
16623
|
attribution: clientAttribution(AGENT_ATTRIBUTION),
|
|
16197
|
-
network:
|
|
16624
|
+
network: renderNetwork,
|
|
16198
16625
|
autoConnect: false,
|
|
16199
16626
|
apiKey: creds.SOGNI_API_KEY,
|
|
16200
16627
|
authType: 'apiKey'
|
|
@@ -16431,6 +16858,13 @@ async function main() {
|
|
|
16431
16858
|
guidanceEnd: options.cnGuidanceEnd ?? 0.6,
|
|
16432
16859
|
};
|
|
16433
16860
|
}
|
|
16861
|
+
if (options.seedanceFinalize !== null) {
|
|
16862
|
+
// The final's size and length are its draft's, at 1080p, not this
|
|
16863
|
+
// request's defaults.
|
|
16864
|
+
output.width = null;
|
|
16865
|
+
output.height = null;
|
|
16866
|
+
output.duration = null;
|
|
16867
|
+
}
|
|
16434
16868
|
console.log(JSON.stringify(output));
|
|
16435
16869
|
} else {
|
|
16436
16870
|
urls.forEach(url => console.log(url));
|
|
@@ -16438,6 +16872,13 @@ async function main() {
|
|
|
16438
16872
|
if (options.returnLastFrame) {
|
|
16439
16873
|
results.forEach(result => { if (result.lastFrameUrl) console.log(`Last frame: ${result.lastFrameUrl}`); });
|
|
16440
16874
|
}
|
|
16875
|
+
if (options.seedanceDraft) {
|
|
16876
|
+
results.forEach(result => {
|
|
16877
|
+
if (!result.jobId) return;
|
|
16878
|
+
const until = result.seedanceDraftExpiresAt ? ` until ${result.seedanceDraftExpiresAt}` : '';
|
|
16879
|
+
console.log(`Seedance draft ${result.jobId}. Render it at 1080p${until} with: sogni-agent --video -m ${options.model} --seedance-finalize ${result.jobId} -o final.mp4`);
|
|
16880
|
+
});
|
|
16881
|
+
}
|
|
16441
16882
|
}
|
|
16442
16883
|
} else {
|
|
16443
16884
|
throw new Error('No output generated - may have been filtered');
|