@sogni-ai/sogni-creative-agent-skill 3.31.0 → 3.32.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 +110 -0
- package/.agents/skills/sogni-creative-agent-skill/references/hosted-api.md +227 -0
- package/.agents/skills/sogni-creative-agent-skill/references/krea2-loras.md +178 -0
- package/.agents/skills/sogni-creative-agent-skill/references/loop-maker.md +192 -0
- package/.agents/skills/sogni-creative-agent-skill/references/models.md +632 -0
- package/.agents/skills/sogni-creative-agent-skill/references/personas-memory.md +124 -0
- package/.agents/skills/sogni-creative-agent-skill/references/private-mature-video.md +118 -0
- package/.agents/skills/sogni-creative-agent-skill/references/seamless-tiling.md +108 -0
- package/.agents/skills/sogni-creative-agent-skill/references/video-editing.md +262 -0
- package/.agents/skills/sogni-creative-agent-skill/references/video-prompting.md +457 -0
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/CHANGELOG.md +29 -0
- package/README.md +27 -5
- package/SKILL.md +9 -6
- package/desktop-extension/manifest.json +1 -1
- package/generated/creative-agent-runtime.mjs +3 -3
- package/llm.txt +5 -0
- package/openclaw.plugin.json +1 -1
- package/package.json +6 -3
- package/references/hosted-api.md +5 -0
- package/references/krea2-loras.md +178 -0
- package/references/models.md +17 -3
- package/scripts/check-version-sync.mjs +4 -0
- package/scripts/sync-hermes-skill.mjs +35 -0
- package/scripts/sync-version.mjs +11 -1
- package/skill-package.json +1 -1
- package/skills/image_editing.md +2 -2
- package/sogni-agent.mjs +239 -13
- package/version.mjs +1 -1
package/sogni-agent.mjs
CHANGED
|
@@ -230,6 +230,9 @@ const rootClientModule = process.env.SOGNI_AGENT_TEST_STATE_PATH
|
|
|
230
230
|
const {
|
|
231
231
|
SogniClientWrapper,
|
|
232
232
|
ClientEvent,
|
|
233
|
+
// Re-exported from @sogni-ai/sogni-client. Used for public REST catalog reads
|
|
234
|
+
// (`projects.availableLoras`) that need neither a socket nor credentials.
|
|
235
|
+
SogniClient,
|
|
233
236
|
getMaxContextImages: getWrapperMaxContextImages,
|
|
234
237
|
parseCreativeWorkflowSseChunk,
|
|
235
238
|
// Model-aware wrapper dimension rules (intelligence-client > 3.15.1). On
|
|
@@ -1301,7 +1304,9 @@ function parsePositiveIntegerValue(raw, flagName, min = 1, max = Infinity) {
|
|
|
1301
1304
|
const MAX_IMAGE_DIMENSION = 8192;
|
|
1302
1305
|
const RTX_VSR_MODEL_ID = 'rtx_vsr_pro';
|
|
1303
1306
|
const RTX_VSR_MIN_DIMENSION = 512;
|
|
1307
|
+
const RTX_VSR_MAX_DIMENSION = 15360;
|
|
1304
1308
|
const RTX_VSR_DIMENSION_STEP = 8;
|
|
1309
|
+
const RTX_VSR_JPG_THRESHOLD_EDGE = 7680;
|
|
1305
1310
|
|
|
1306
1311
|
function alignRtxVsrDimension(value) {
|
|
1307
1312
|
return Math.floor(value / RTX_VSR_DIMENSION_STEP) * RTX_VSR_DIMENSION_STEP;
|
|
@@ -1315,10 +1320,10 @@ function resolveRtxVsrDimensions(sourceWidth, sourceHeight, { scale = 2, targetL
|
|
|
1315
1320
|
}
|
|
1316
1321
|
|
|
1317
1322
|
const sourceLongestEdge = Math.max(sourceWidth, sourceHeight);
|
|
1318
|
-
if (sourceLongestEdge >=
|
|
1319
|
-
fatalCliError(`RTX VSR cannot enlarge an image whose longest edge is already ${
|
|
1323
|
+
if (sourceLongestEdge >= RTX_VSR_MAX_DIMENSION) {
|
|
1324
|
+
fatalCliError(`RTX VSR cannot enlarge an image whose longest edge is already ${RTX_VSR_MAX_DIMENSION}px or larger.`, {
|
|
1320
1325
|
code: 'INVALID_UPSCALE_SIZE',
|
|
1321
|
-
details: { sourceWidth, sourceHeight, maxDimension:
|
|
1326
|
+
details: { sourceWidth, sourceHeight, maxDimension: RTX_VSR_MAX_DIMENSION }
|
|
1322
1327
|
});
|
|
1323
1328
|
}
|
|
1324
1329
|
|
|
@@ -1329,7 +1334,7 @@ function resolveRtxVsrDimensions(sourceWidth, sourceHeight, { scale = 2, targetL
|
|
|
1329
1334
|
details: { sourceWidth, sourceHeight, requestedLongestEdge }
|
|
1330
1335
|
});
|
|
1331
1336
|
}
|
|
1332
|
-
const factor = Math.min(requestedLongestEdge / sourceLongestEdge,
|
|
1337
|
+
const factor = Math.min(requestedLongestEdge / sourceLongestEdge, RTX_VSR_MAX_DIMENSION / sourceLongestEdge);
|
|
1333
1338
|
const width = alignRtxVsrDimension(sourceWidth * factor);
|
|
1334
1339
|
const height = alignRtxVsrDimension(sourceHeight * factor);
|
|
1335
1340
|
if (width < RTX_VSR_MIN_DIMENSION || height < RTX_VSR_MIN_DIMENSION) {
|
|
@@ -1337,9 +1342,9 @@ function resolveRtxVsrDimensions(sourceWidth, sourceHeight, { scale = 2, targetL
|
|
|
1337
1342
|
const minimumLongestEdge = Math.ceil(
|
|
1338
1343
|
(sourceLongestEdge * RTX_VSR_MIN_DIMENSION / sourceShortestEdge) / RTX_VSR_DIMENSION_STEP
|
|
1339
1344
|
) * RTX_VSR_DIMENSION_STEP;
|
|
1340
|
-
const message = minimumLongestEdge <=
|
|
1345
|
+
const message = minimumLongestEdge <= RTX_VSR_MAX_DIMENSION
|
|
1341
1346
|
? `The requested RTX VSR output would be ${width}×${height}px. To preserve aspect ratio, choose --target-longest-edge ${minimumLongestEdge} or larger so every output edge is at least ${RTX_VSR_MIN_DIMENSION}px.`
|
|
1342
|
-
: `The ${sourceWidth}×${sourceHeight}px source aspect ratio cannot fit RTX VSR's supported ${RTX_VSR_MIN_DIMENSION}–${
|
|
1347
|
+
: `The ${sourceWidth}×${sourceHeight}px source aspect ratio cannot fit RTX VSR's supported ${RTX_VSR_MIN_DIMENSION}–${RTX_VSR_MAX_DIMENSION}px output bounds without stretching.`;
|
|
1343
1348
|
fatalCliError(message, {
|
|
1344
1349
|
code: 'INVALID_UPSCALE_SIZE',
|
|
1345
1350
|
details: {
|
|
@@ -1348,7 +1353,7 @@ function resolveRtxVsrDimensions(sourceWidth, sourceHeight, { scale = 2, targetL
|
|
|
1348
1353
|
requestedLongestEdge,
|
|
1349
1354
|
minimumLongestEdge,
|
|
1350
1355
|
minDimension: RTX_VSR_MIN_DIMENSION,
|
|
1351
|
-
maxDimension:
|
|
1356
|
+
maxDimension: RTX_VSR_MAX_DIMENSION
|
|
1352
1357
|
}
|
|
1353
1358
|
});
|
|
1354
1359
|
}
|
|
@@ -2519,6 +2524,10 @@ const options = {
|
|
|
2519
2524
|
liveModelMedia: 'all', // image|video|audio|all
|
|
2520
2525
|
liveModelNetwork: null, // fast|relaxed; defaults to configured network
|
|
2521
2526
|
liveModelTags: [], // repeatable --model-tag filters (AND semantics)
|
|
2527
|
+
loraCatalogAction: null, // list|search
|
|
2528
|
+
loraCatalogQuery: null,
|
|
2529
|
+
loraCatalogModel: null, // restrict to LoRAs compatible with this model id
|
|
2530
|
+
loraCatalogCategory: null, // restrict to one catalog category
|
|
2522
2531
|
apiReplayAction: null, // list|get|ingest
|
|
2523
2532
|
apiReplayId: null,
|
|
2524
2533
|
apiReplayInput: null,
|
|
@@ -2976,7 +2985,7 @@ for (let i = 0; i < args.length; i++) {
|
|
|
2976
2985
|
raw,
|
|
2977
2986
|
arg,
|
|
2978
2987
|
RTX_VSR_MIN_DIMENSION,
|
|
2979
|
-
|
|
2988
|
+
RTX_VSR_MAX_DIMENSION
|
|
2980
2989
|
);
|
|
2981
2990
|
cliSet.upscaleTargetLongestEdge = true;
|
|
2982
2991
|
} else if (arg === '--photobooth') {
|
|
@@ -3230,6 +3239,26 @@ for (let i = 0; i < args.length; i++) {
|
|
|
3230
3239
|
const raw = requireFlagValue(args, i, arg);
|
|
3231
3240
|
i++;
|
|
3232
3241
|
options.liveModelTags.push(raw);
|
|
3242
|
+
} else if (arg === '--list-loras' || arg === '--loras-catalog') {
|
|
3243
|
+
options.loraCatalogAction = 'list';
|
|
3244
|
+
const next = args[i + 1];
|
|
3245
|
+
if (next && !next.startsWith('-')) {
|
|
3246
|
+
i++;
|
|
3247
|
+
options.loraCatalogQuery = next;
|
|
3248
|
+
}
|
|
3249
|
+
} else if (arg === '--search-loras' || arg === '--find-loras') {
|
|
3250
|
+
const raw = requireFlagValue(args, i, arg);
|
|
3251
|
+
i++;
|
|
3252
|
+
options.loraCatalogAction = 'search';
|
|
3253
|
+
options.loraCatalogQuery = raw;
|
|
3254
|
+
} else if (arg === '--lora-catalog-model') {
|
|
3255
|
+
const raw = requireFlagValue(args, i, arg);
|
|
3256
|
+
i++;
|
|
3257
|
+
options.loraCatalogModel = raw;
|
|
3258
|
+
} else if (arg === '--lora-category') {
|
|
3259
|
+
const raw = requireFlagValue(args, i, arg);
|
|
3260
|
+
i++;
|
|
3261
|
+
options.loraCatalogCategory = raw;
|
|
3233
3262
|
// --- Hosted Sogni API paths ---
|
|
3234
3263
|
} else if (arg === '--api-chat') {
|
|
3235
3264
|
options.apiChat = true;
|
|
@@ -3572,9 +3601,9 @@ Image Options:
|
|
|
3572
3601
|
--lora-strengths <n> Comma-separated LoRA strengths
|
|
3573
3602
|
-c, --context <path> Context image for editing (can use multiple)
|
|
3574
3603
|
--last-image Use last generated image as context
|
|
3575
|
-
--upscale <path|url> Promptless NVIDIA RTX VSR upscale (one source image)
|
|
3604
|
+
--upscale <path|url> Promptless NVIDIA RTX VSR upscale, up to 16K (one source image)
|
|
3576
3605
|
--upscale-scale <n> Enlarge longest edge by 2, 3, or 4 (default: 2)
|
|
3577
|
-
--target-longest-edge <px> Explicit output longest edge, up to
|
|
3606
|
+
--target-longest-edge <px> Explicit output longest edge, up to 15360 (overrides scale)
|
|
3578
3607
|
|
|
3579
3608
|
Photobooth (Face Transfer):
|
|
3580
3609
|
--photobooth Face transfer mode (InstantID + SDXL Turbo)
|
|
@@ -3716,6 +3745,10 @@ General:
|
|
|
3716
3745
|
--model-media <type> Filter model discovery: image|video|audio|all (default: all)
|
|
3717
3746
|
--model-network <n> Model discovery network: fast|relaxed (default: configured network)
|
|
3718
3747
|
--model-tag <tag> Filter by catalog tag, e.g. spicy or uncensored (repeatable, AND)
|
|
3748
|
+
--list-loras [query] List the live LoRA catalog with each LoRA's strength contract
|
|
3749
|
+
--search-loras <q> Search LoRAs by ID, name, category, or description
|
|
3750
|
+
--lora-catalog-model <id> Only LoRAs compatible with that model id
|
|
3751
|
+
--lora-category <c> Filter by catalog category, e.g. character or lighting
|
|
3719
3752
|
--doctor Health check: Node, credentials, ffmpeg, auth, plan, config, version
|
|
3720
3753
|
--snooze-update Snooze the pending update reminder (1 day → 2 days → 1 week)
|
|
3721
3754
|
--whats-new [version] Show bundled CHANGELOG entries (everything after <version> if given)
|
|
@@ -4736,6 +4769,7 @@ const apiWorkflowStartHasExternalInput = options.apiWorkflowAction === 'start' &
|
|
|
4736
4769
|
const apiWorkflowTemplate = options.apiWorkflowTemplate || 'generated_keyframe_video';
|
|
4737
4770
|
const apiModelUtilityAction = Boolean(options.apiModelAction);
|
|
4738
4771
|
const liveModelUtilityAction = Boolean(options.liveModelAction);
|
|
4772
|
+
const loraCatalogUtilityAction = Boolean(options.loraCatalogAction);
|
|
4739
4773
|
const apiReplayUtilityAction = Boolean(options.apiReplayAction);
|
|
4740
4774
|
const personaUtilityAction = Boolean(options.personaAction && options.personaAction !== 'generate');
|
|
4741
4775
|
const contractUtilityAction = Boolean(options.contractAction);
|
|
@@ -4744,6 +4778,7 @@ const commandUsesGenerationSeed = !options.apiChat &&
|
|
|
4744
4778
|
!apiWorkflowUtilityAction &&
|
|
4745
4779
|
!apiModelUtilityAction &&
|
|
4746
4780
|
!liveModelUtilityAction &&
|
|
4781
|
+
!loraCatalogUtilityAction &&
|
|
4747
4782
|
!apiReplayUtilityAction &&
|
|
4748
4783
|
!contractUtilityAction &&
|
|
4749
4784
|
!storyboardPlanUtilityAction &&
|
|
@@ -4774,12 +4809,17 @@ if (!liveModelUtilityAction && (options.liveModelMedia !== 'all' || options.live
|
|
|
4774
4809
|
code: 'INVALID_ARGUMENT'
|
|
4775
4810
|
});
|
|
4776
4811
|
}
|
|
4812
|
+
if (!loraCatalogUtilityAction && (options.loraCatalogModel || options.loraCatalogCategory)) {
|
|
4813
|
+
fatalCliError('--lora-catalog-model and --lora-category require --list-loras or --search-loras.', {
|
|
4814
|
+
code: 'INVALID_ARGUMENT'
|
|
4815
|
+
});
|
|
4816
|
+
}
|
|
4777
4817
|
// Normalize a whitespace-only prompt to empty so the guard below treats it as
|
|
4778
4818
|
// "no prompt" rather than silently sending blank text to the server.
|
|
4779
4819
|
if (typeof options.prompt === 'string' && options.prompt.trim() === '') {
|
|
4780
4820
|
options.prompt = '';
|
|
4781
4821
|
}
|
|
4782
|
-
if (!options.prompt && !options.upscaleImage && !options.apiChat && !apiWorkflowUtilityAction && !apiWorkflowStartAction && !apiModelUtilityAction && !liveModelUtilityAction && !apiReplayUtilityAction && !contractUtilityAction && !storyboardPlanUtilityAction && !options.estimateVideoCost && !options.multiAngle && !options.showBalance && !options.showVersion && !options.doctor && !options.extractLastFrame && !options.extractFirstFrame && !options.extractFrameAt && !options.verifyVideo && !options.concatVideos && !options.sourceReelDir && !options.remixAudio && !options.listMedia && !options.memoryAction && !options.personalityAction && !personaUtilityAction) {
|
|
4822
|
+
if (!options.prompt && !options.upscaleImage && !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.verifyVideo && !options.concatVideos && !options.sourceReelDir && !options.remixAudio && !options.listMedia && !options.memoryAction && !options.personalityAction && !personaUtilityAction) {
|
|
4783
4823
|
fatalCliError('No prompt provided. Use --help for usage.', { code: 'INVALID_ARGUMENT' });
|
|
4784
4824
|
}
|
|
4785
4825
|
|
|
@@ -7215,6 +7255,183 @@ async function runLiveModels() {
|
|
|
7215
7255
|
}
|
|
7216
7256
|
}
|
|
7217
7257
|
|
|
7258
|
+
// LoRA discovery goes through the SDK's catalog surface
|
|
7259
|
+
// (`projects.availableLoras`), which reads the public artist-facing catalog and
|
|
7260
|
+
// applies the `modelId` filter server-side. That is the single source of truth
|
|
7261
|
+
// for which LoRAs a model accepts and for the strength contract of each one, so
|
|
7262
|
+
// the CLI (and any agent reading its output) stays correct when Sogni
|
|
7263
|
+
// publishes, retunes, or retires a LoRA without a skill release.
|
|
7264
|
+
//
|
|
7265
|
+
// This path is deliberately socket-free and credential-free: the catalog is
|
|
7266
|
+
// public, so `--list-loras` answers without connecting a worker session.
|
|
7267
|
+
async function fetchLoraCatalog(modelId) {
|
|
7268
|
+
const fixtureJson = getEnv('SOGNI_AGENT_TEST_LORA_CATALOG_JSON');
|
|
7269
|
+
if (fixtureJson) {
|
|
7270
|
+
const payload = JSON.parse(fixtureJson);
|
|
7271
|
+
const data = payload?.data || payload;
|
|
7272
|
+
const loras = Array.isArray(data) ? data : data?.loras;
|
|
7273
|
+
if (!Array.isArray(loras)) {
|
|
7274
|
+
const error = new Error('Sogni LoRA catalog response contained no LoRA list.');
|
|
7275
|
+
error.code = 'LORA_CATALOG_INVALID';
|
|
7276
|
+
throw error;
|
|
7277
|
+
}
|
|
7278
|
+
return {
|
|
7279
|
+
lastUpdated: data?.lastUpdated,
|
|
7280
|
+
loras: modelId
|
|
7281
|
+
? loras.filter(lora => Array.isArray(lora?.modelIds) && lora.modelIds.includes(modelId))
|
|
7282
|
+
: loras,
|
|
7283
|
+
models: Array.isArray(data?.models) ? data.models : [],
|
|
7284
|
+
constraints: data?.constraints || null
|
|
7285
|
+
};
|
|
7286
|
+
}
|
|
7287
|
+
|
|
7288
|
+
// Run the same host/protocol guard every other REST path in this CLI goes
|
|
7289
|
+
// through before handing the base URL to the SDK. The SDK owns the route.
|
|
7290
|
+
await buildSafeApiUrl('/');
|
|
7291
|
+
|
|
7292
|
+
let sdkClient;
|
|
7293
|
+
try {
|
|
7294
|
+
sdkClient = await SogniClient.createInstance({
|
|
7295
|
+
appId: getOrCreateSogniAppId(),
|
|
7296
|
+
appSource: SOGNI_APP_SOURCE,
|
|
7297
|
+
restEndpoint: getApiBaseUrl(),
|
|
7298
|
+
// The catalog is a plain REST read. Opening a socket would cost a worker
|
|
7299
|
+
// session and would make a public listing require credentials.
|
|
7300
|
+
disableSocket: true,
|
|
7301
|
+
logLevel: 'error'
|
|
7302
|
+
});
|
|
7303
|
+
if (typeof sdkClient.projects.availableLoras !== 'function') {
|
|
7304
|
+
const error = new Error('The installed Sogni SDK does not expose the LoRA catalog.');
|
|
7305
|
+
error.code = 'LORA_CATALOG_UNSUPPORTED';
|
|
7306
|
+
error.hint = 'Update @sogni-ai/sogni-intelligence-client to a release built on sogni-client >= 5.17.0.';
|
|
7307
|
+
throw error;
|
|
7308
|
+
}
|
|
7309
|
+
const catalog = await sdkClient.projects.availableLoras(modelId ? { modelId } : {});
|
|
7310
|
+
if (!Array.isArray(catalog?.loras)) {
|
|
7311
|
+
const error = new Error('Sogni LoRA catalog response contained no LoRA list.');
|
|
7312
|
+
error.code = 'LORA_CATALOG_INVALID';
|
|
7313
|
+
throw error;
|
|
7314
|
+
}
|
|
7315
|
+
return catalog;
|
|
7316
|
+
} catch (cause) {
|
|
7317
|
+
if (cause?.code === 'LORA_CATALOG_INVALID' || cause?.code === 'LORA_CATALOG_UNSUPPORTED') throw cause;
|
|
7318
|
+
const error = new Error(`Could not load the live Sogni LoRA catalog (${cause?.message || cause}).`);
|
|
7319
|
+
error.code = cause?.code || 'LORA_CATALOG_UNAVAILABLE';
|
|
7320
|
+
error.hint = 'Check Sogni platform status and retry.';
|
|
7321
|
+
throw error;
|
|
7322
|
+
} finally {
|
|
7323
|
+
try {
|
|
7324
|
+
sdkClient?.dispose?.();
|
|
7325
|
+
} catch {
|
|
7326
|
+
// Disposal is best-effort; a listing must not fail on teardown.
|
|
7327
|
+
}
|
|
7328
|
+
}
|
|
7329
|
+
}
|
|
7330
|
+
|
|
7331
|
+
function loraCatalogEntryFromPayload(entry) {
|
|
7332
|
+
const ui = entry?.ui || {};
|
|
7333
|
+
return {
|
|
7334
|
+
loraId: entry?.loraId || entry?.slug || '',
|
|
7335
|
+
name: entry?.name || entry?.loraId || '',
|
|
7336
|
+
description: typeof entry?.description === 'string' ? entry.description : '',
|
|
7337
|
+
modelIds: Array.isArray(entry?.modelIds) ? entry.modelIds : [],
|
|
7338
|
+
category: ui.category || null,
|
|
7339
|
+
section: ui.section?.label || null,
|
|
7340
|
+
min: Number.isFinite(ui.min) ? ui.min : null,
|
|
7341
|
+
max: Number.isFinite(ui.max) ? ui.max : null,
|
|
7342
|
+
default: Number.isFinite(ui.default) ? ui.default : null,
|
|
7343
|
+
step: Number.isFinite(ui.step) ? ui.step : null,
|
|
7344
|
+
recommendedMin: Number.isFinite(ui.recommendedMin) ? ui.recommendedMin : null,
|
|
7345
|
+
recommendedMax: Number.isFinite(ui.recommendedMax) ? ui.recommendedMax : null,
|
|
7346
|
+
rangeLabels: ui.rangeLabels || null,
|
|
7347
|
+
bipolar: Number.isFinite(ui.min) && ui.min < 0,
|
|
7348
|
+
nsfw: Boolean(ui.nsfw),
|
|
7349
|
+
sexual: Boolean(ui.sexual),
|
|
7350
|
+
creator: ui.creator || null,
|
|
7351
|
+
sourceUrl: ui.sourceUrl || null,
|
|
7352
|
+
license: ui.license || null
|
|
7353
|
+
};
|
|
7354
|
+
}
|
|
7355
|
+
|
|
7356
|
+
function formatLoraRange(entry) {
|
|
7357
|
+
if (entry.min === null || entry.max === null) return '-';
|
|
7358
|
+
const hard = `${entry.min}..${entry.max}`;
|
|
7359
|
+
if (entry.recommendedMin === null || entry.recommendedMax === null) return hard;
|
|
7360
|
+
return `${hard} (rec ${entry.recommendedMin}..${entry.recommendedMax})`;
|
|
7361
|
+
}
|
|
7362
|
+
|
|
7363
|
+
async function runLoraCatalog() {
|
|
7364
|
+
const query = options.loraCatalogQuery?.trim() || null;
|
|
7365
|
+
const normalizedQuery = normalizeLiveModelSearch(query);
|
|
7366
|
+
if (query && !normalizedQuery) {
|
|
7367
|
+
const err = new Error('LoRA search query must contain at least one letter or number.');
|
|
7368
|
+
err.code = 'INVALID_ARGUMENT';
|
|
7369
|
+
throw err;
|
|
7370
|
+
}
|
|
7371
|
+
const modelFilter = options.loraCatalogModel?.trim() || null;
|
|
7372
|
+
const categoryFilter = normalizeLiveModelTag(options.loraCatalogCategory) || null;
|
|
7373
|
+
|
|
7374
|
+
// The model filter is applied server-side by the catalog endpoint; category
|
|
7375
|
+
// and free-text search are presentation-layer narrowing over what it returns.
|
|
7376
|
+
const catalog = await fetchLoraCatalog(modelFilter || undefined);
|
|
7377
|
+
let loras = catalog.loras.map(loraCatalogEntryFromPayload).filter(entry => entry.loraId);
|
|
7378
|
+
if (categoryFilter) loras = loras.filter(entry => normalizeLiveModelTag(entry.category) === categoryFilter);
|
|
7379
|
+
if (normalizedQuery) {
|
|
7380
|
+
loras = loras.filter(entry =>
|
|
7381
|
+
normalizeLiveModelSearch(`${entry.loraId} ${entry.name} ${entry.category || ''} ${entry.description}`)
|
|
7382
|
+
.includes(normalizedQuery)
|
|
7383
|
+
);
|
|
7384
|
+
}
|
|
7385
|
+
|
|
7386
|
+
const result = {
|
|
7387
|
+
success: true,
|
|
7388
|
+
type: 'lora-catalog',
|
|
7389
|
+
query,
|
|
7390
|
+
model: modelFilter,
|
|
7391
|
+
category: options.loraCatalogCategory || null,
|
|
7392
|
+
count: loras.length,
|
|
7393
|
+
// Catalog-level facts, unaffected by the filters above: which models take
|
|
7394
|
+
// LoRAs at all, and how many may be stacked on one render.
|
|
7395
|
+
loraCapableModels: Array.isArray(catalog.models) ? catalog.models : [],
|
|
7396
|
+
constraints: catalog.constraints || null,
|
|
7397
|
+
loras,
|
|
7398
|
+
timestamp: new Date().toISOString()
|
|
7399
|
+
};
|
|
7400
|
+
if (options.json || JSON_ERROR_MODE) {
|
|
7401
|
+
console.log(JSON.stringify(result));
|
|
7402
|
+
return;
|
|
7403
|
+
}
|
|
7404
|
+
|
|
7405
|
+
const scope = [
|
|
7406
|
+
modelFilter ? `model=${modelFilter}` : 'all models',
|
|
7407
|
+
options.loraCatalogCategory ? `category=${options.loraCatalogCategory}` : null,
|
|
7408
|
+
query ? `query=${JSON.stringify(query)}` : null
|
|
7409
|
+
].filter(Boolean).join(', ');
|
|
7410
|
+
const maxPerRequest = catalog.constraints?.maxPerRequest;
|
|
7411
|
+
const stacking = Number.isFinite(maxPerRequest) ? `; stack up to ${maxPerRequest} per render` : '';
|
|
7412
|
+
console.log(`Sogni LoRA catalog (${loras.length}; ${scope}${stacking})`);
|
|
7413
|
+
if (loras.length === 0) {
|
|
7414
|
+
if (modelFilter && !result.loraCapableModels.includes(modelFilter)) {
|
|
7415
|
+
console.log(`${modelFilter} does not accept LoRAs. Models that do: ${result.loraCapableModels.join(', ') || '(none reported)'}`);
|
|
7416
|
+
return;
|
|
7417
|
+
}
|
|
7418
|
+
console.log('No matching LoRAs found.');
|
|
7419
|
+
return;
|
|
7420
|
+
}
|
|
7421
|
+
console.log('LORA ID\tRANGE\tDEFAULT\tCATEGORY\tMATURE\tNAME');
|
|
7422
|
+
for (const entry of loras) {
|
|
7423
|
+
const mature = [entry.nsfw ? 'nsfw' : null, entry.sexual ? 'sexual' : null].filter(Boolean).join('+') || '-';
|
|
7424
|
+
console.log([
|
|
7425
|
+
entry.loraId,
|
|
7426
|
+
formatLoraRange(entry),
|
|
7427
|
+
entry.default ?? '-',
|
|
7428
|
+
entry.category || '-',
|
|
7429
|
+
mature,
|
|
7430
|
+
entry.name
|
|
7431
|
+
].join('\t'));
|
|
7432
|
+
}
|
|
7433
|
+
}
|
|
7434
|
+
|
|
7218
7435
|
function recordsFromReplayPayload(payload) {
|
|
7219
7436
|
const data = extractApiEnvelopeData(payload);
|
|
7220
7437
|
return Array.isArray(data?.records) ? data.records : Array.isArray(payload?.records) ? payload.records : [];
|
|
@@ -10520,6 +10737,11 @@ async function main() {
|
|
|
10520
10737
|
return;
|
|
10521
10738
|
}
|
|
10522
10739
|
|
|
10740
|
+
if (options.loraCatalogAction) {
|
|
10741
|
+
await runLoraCatalog();
|
|
10742
|
+
return;
|
|
10743
|
+
}
|
|
10744
|
+
|
|
10523
10745
|
if (options.apiReplayAction) {
|
|
10524
10746
|
await runApiReplay();
|
|
10525
10747
|
return;
|
|
@@ -11495,6 +11717,10 @@ async function main() {
|
|
|
11495
11717
|
);
|
|
11496
11718
|
options.width = targetDimensions.width;
|
|
11497
11719
|
options.height = targetDimensions.height;
|
|
11720
|
+
const upscaleOutputFormat = Math.max(options.width, options.height) > RTX_VSR_JPG_THRESHOLD_EDGE
|
|
11721
|
+
? 'jpg'
|
|
11722
|
+
: 'png';
|
|
11723
|
+
options.outputFormat = upscaleOutputFormat;
|
|
11498
11724
|
log(
|
|
11499
11725
|
`Source ${sourceDimensions.width}x${sourceDimensions.height}; ` +
|
|
11500
11726
|
`target box ${options.width}x${options.height} (aspect ratio preserved).`
|
|
@@ -11512,8 +11738,8 @@ async function main() {
|
|
|
11512
11738
|
width: options.width,
|
|
11513
11739
|
height: options.height,
|
|
11514
11740
|
steps: 1,
|
|
11515
|
-
|
|
11516
|
-
outputFormat:
|
|
11741
|
+
numberOfPreviews: 0,
|
|
11742
|
+
outputFormat: upscaleOutputFormat,
|
|
11517
11743
|
disableNSFWFilter: true,
|
|
11518
11744
|
startingImage: sourceBuffer,
|
|
11519
11745
|
startingImageStrength: 1,
|
package/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const PACKAGE_VERSION = '3.
|
|
1
|
+
export const PACKAGE_VERSION = '3.32.0';
|