@sogni-ai/sogni-creative-agent-skill 3.8.0 → 3.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/README.md +19 -1
- package/SKILL.md +3 -2
- package/desktop-extension/README.md +29 -0
- package/desktop-extension/manifest.json +32 -0
- package/desktop-extension/server/index.mjs +159 -0
- package/desktop-extension/server/resolve.mjs +64 -0
- package/desktop-extension/server/tools.mjs +306 -0
- package/generated/creative-agent-runtime.mjs +4 -7
- package/llm.txt +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +3 -1
- package/references/video-editing.md +19 -7
- package/sogni-agent.mjs +289 -17
- package/update-check.mjs +4 -1
- package/version.mjs +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
# [3.10.0](https://github.com/Sogni-AI/sogni-creative-agent-skill/compare/v3.9.0...v3.10.0) (2026-07-04)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **cli:** recognize semantic-release h1 changelog entries in whats-new ([067bb65](https://github.com/Sogni-AI/sogni-creative-agent-skill/commit/067bb651e1ab924fb32d1b15585c80deeeb79d84))
|
|
7
|
+
* **desktop:** keep head of large success output, tail of errors ([394e1e1](https://github.com/Sogni-AI/sogni-creative-agent-skill/commit/394e1e131f5f75c4f01205a37286609ed7a59c99))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* **desktop:** add MCP tool registry mapping tools to sogni-agent argv ([cb951a7](https://github.com/Sogni-AI/sogni-creative-agent-skill/commit/cb951a79fcc5ef859ef3135f46b8aab81945305d))
|
|
13
|
+
* **desktop:** add MCPB manifest, npm packaging, and build script ([d464627](https://github.com/Sogni-AI/sogni-creative-agent-skill/commit/d4646273bcb4c2c8cfd7d08e7b6928e218f15e6f))
|
|
14
|
+
* **desktop:** add path resolution for the Claude Desktop MCP wrapper ([8cd5832](https://github.com/Sogni-AI/sogni-creative-agent-skill/commit/8cd58323982d63a756e75264441d0dd33feb1acc))
|
|
15
|
+
* **desktop:** implement dependency-free MCP stdio server for Claude Desktop ([de26cda](https://github.com/Sogni-AI/sogni-creative-agent-skill/commit/de26cda9f433a8da62dcc24c7b2b49e6c13e892a))
|
|
16
|
+
|
|
17
|
+
# [3.9.0](https://github.com/Sogni-AI/sogni-creative-agent-skill/compare/v3.8.0...v3.9.0) (2026-06-30)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* wire ltx23 lora video controls ([968aa9a](https://github.com/Sogni-AI/sogni-creative-agent-skill/commit/968aa9aca2bf5cfc30d7f73b513f4ff0afb9cf94))
|
|
23
|
+
|
|
1
24
|
# [3.7.0](https://github.com/Sogni-AI/sogni-creative-agent-skill/compare/v3.6.4...v3.7.0) (2026-06-25)
|
|
2
25
|
|
|
3
26
|
|
|
@@ -14,6 +37,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
14
37
|
|
|
15
38
|
## [Unreleased]
|
|
16
39
|
|
|
40
|
+
### Added
|
|
41
|
+
|
|
42
|
+
- **LTX-2.3 LoRA controls are now wired through the public CLI.** Direct `sogni-agent` video generation now
|
|
43
|
+
supports `--control-type outpaint` with `--outpaint-position` / `--outpaint-aspect-ratio`,
|
|
44
|
+
`--control-type inpaint --mask <image>`, and automatic `transition` LoRA attachment for LTX-2.3 i2v jobs
|
|
45
|
+
that provide both `--ref` and `--ref-end`.
|
|
46
|
+
|
|
17
47
|
## [3.8.0] - 2026-06-30
|
|
18
48
|
|
|
19
49
|
### Changed
|
package/README.md
CHANGED
|
@@ -267,6 +267,24 @@ If the checkout is missing, use the npm install path above or explicitly approve
|
|
|
267
267
|
|
|
268
268
|
---
|
|
269
269
|
|
|
270
|
+
## Claude Desktop
|
|
271
|
+
|
|
272
|
+
Claude Desktop can't run skills against your local files, so Sogni ships as a local MCP server instead. Two ways to install:
|
|
273
|
+
|
|
274
|
+
**Recommended — one command (also installs the CLI, saves your API key, and offers to install ffmpeg):**
|
|
275
|
+
|
|
276
|
+
npx setup-sogni-agent-skill
|
|
277
|
+
|
|
278
|
+
This registers the Sogni tools in `claude_desktop_config.json`. Fully quit and reopen Claude Desktop afterwards.
|
|
279
|
+
|
|
280
|
+
**Manual — drag-and-drop bundle:** download `sogni-creative-agent.mcpb` from the GitHub Releases page and drop it onto Claude Desktop's Settings → Extensions page. You'll be prompted for your Sogni API key (stored in the OS keychain) unless you've already run the installer.
|
|
281
|
+
|
|
282
|
+
Don't use both — you'd get duplicate Sogni tools. The extension wraps the same globally installed `sogni-agent` CLI used by Claude Code, so personas, memories, and credentials are shared.
|
|
283
|
+
|
|
284
|
+
Video/audio editing features need ffmpeg on your machine; the `npx` installer offers to install it for you.
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
270
288
|
## Setup (Sogni API key)
|
|
271
289
|
|
|
272
290
|
1. Get your API key from [dashboard.sogni.ai](https://dashboard.sogni.ai) (open the account menu).
|
|
@@ -504,7 +522,7 @@ Music generation uses `--music` and outputs `mp3` by default. `--audio` remains
|
|
|
504
522
|
|
|
505
523
|
V2V defaults mirror Sogni Chat workflow tuning: `canny`, `pose`, and `depth` use ControlNet strength `0.85` with detailer assist; `detailer` uses strength `1.0`. Use `-m seedance2-v2v` for Seedance V2V without ControlNet. Seedance accepts public HTTPS image, video, and audio references that pass CLI URL safety checks; localhost and private-network URLs are rejected before forwarding. Audio references must be paired with an image or video reference.
|
|
506
524
|
|
|
507
|
-
The LTX-2.3 v2v model `ltx23-22b-fp8_v2v_distilled` also supports two extra control modes: **`outpaint`** extends/expands the video canvas (e.g. make a vertical clip widescreen, or add space in a direction) — it is positional and mask-free, anchored with a position (`center|top|bottom|left|right`) and an optional target aspect ratio (`16:9|9:16|1:1|4:3|3:4|21:9`), and the canvas only grows, never crops; **`inpaint`** regenerates a masked region of the source video and **requires a mask image** (white pixels = region to regenerate). The hosted `video_to_video` tool selects these with `controlMode` `outpaint`/`inpaint
|
|
525
|
+
The LTX-2.3 v2v model `ltx23-22b-fp8_v2v_distilled` also supports two extra control modes: **`outpaint`** extends/expands the video canvas (e.g. make a vertical clip widescreen, or add space in a direction) — it is positional and mask-free, anchored with a position (`center|top|bottom|left|right`) and an optional target aspect ratio (`16:9|9:16|1:1|4:3|3:4|21:9`), and the canvas only grows, never crops; **`inpaint`** regenerates a masked region of the source video and **requires a mask image** (white pixels = region to regenerate) in direct CLI/SDK mode. The hosted `video_to_video` tool selects these with `controlMode` `outpaint`/`inpaint` and can derive an inpaint mask when the user did not upload one. The direct CLI and sogni-client SDK example expose them via `--control-type` / `control-type` (`canny|pose|depth|detailer|outpaint|inpaint`), with `--outpaint-position` for outpaint and `--mask` for inpaint. See `references/video-editing.md` for details.
|
|
508
526
|
|
|
509
527
|
---
|
|
510
528
|
|
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 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\", \"make music\", \"apply a style\", or \"generate me as a superhero\"."
|
|
4
4
|
metadata:
|
|
5
|
-
version: "3.
|
|
5
|
+
version: "3.9.0"
|
|
6
6
|
homepage: https://sogni.ai
|
|
7
7
|
openclaw:
|
|
8
8
|
emoji: "🎨"
|
|
@@ -184,7 +184,8 @@ sogni-agent doctor --json
|
|
|
184
184
|
| `-n <num>` | Output count (`{a\|b\|c}` prompt variations cycle); capped at 16, raise with `SOGNI_MAX_COUNT` | 1 |
|
|
185
185
|
| `--video`, `--music` | Generate video / music instead of image | - |
|
|
186
186
|
| `--workflow <t>` | Force `t2v\|i2v\|s2v\|ia2v\|a2v\|v2v\|animate-move\|animate-replace` | inferred |
|
|
187
|
-
| `--ref`, `--ref-end`, `--ref-audio`, `--ref-video` | Start frame / end frame / audio / video references | - |
|
|
187
|
+
| `--ref`, `--ref-end`, `--ref-audio`, `--ref-video`, `--mask` | Start frame / end frame / audio / video / inpaint mask references | - |
|
|
188
|
+
| `--control-type`, `--outpaint-position`, `--outpaint-aspect-ratio` | LTX-2.3 v2v control mode and outpaint canvas controls | - |
|
|
188
189
|
| `--duration <sec>` | Video or music length | video 5, music 30 |
|
|
189
190
|
| `--target-resolution <px>` | Short-side target preserving aspect ratio (use `2160` for Seedance 4K) | - |
|
|
190
191
|
| `--photobooth` | Face transfer mode (with `--ref`) | - |
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Sogni Creative Agent — Claude Desktop extension
|
|
2
|
+
|
|
3
|
+
A dependency-free MCP stdio server that wraps the globally installed
|
|
4
|
+
`sogni-agent` CLI. `manifest.json` follows the MCPB spec (v0.3).
|
|
5
|
+
|
|
6
|
+
## Layout
|
|
7
|
+
|
|
8
|
+
- `server/index.mjs` — JSON-RPC 2.0 stdio loop (initialize, tools/list, tools/call)
|
|
9
|
+
- `server/tools.mjs` — tool schemas + pure argv builders
|
|
10
|
+
- `server/resolve.mjs` — absolute-path resolution (agent, ffmpeg, child env);
|
|
11
|
+
Claude Desktop's GUI environment has a minimal PATH, so nothing here relies on PATH lookup
|
|
12
|
+
|
|
13
|
+
## Build the .mcpb bundle
|
|
14
|
+
|
|
15
|
+
npm run build:mcpb # → dist/sogni-creative-agent.mcpb
|
|
16
|
+
|
|
17
|
+
## Install paths
|
|
18
|
+
|
|
19
|
+
1. `npx setup-sogni-agent-skill` writes a `claude_desktop_config.json` entry
|
|
20
|
+
pointing at this server inside the global npm package (preferred).
|
|
21
|
+
2. The packed `.mcpb` is the manual drag-and-drop alternative
|
|
22
|
+
(Claude Desktop → Settings → Extensions).
|
|
23
|
+
|
|
24
|
+
The server needs the CLI installed globally (`npm i -g @sogni-ai/sogni-creative-agent-skill`);
|
|
25
|
+
when missing, every tool returns a hint to run `npx setup-sogni-agent-skill`.
|
|
26
|
+
|
|
27
|
+
## Testing
|
|
28
|
+
|
|
29
|
+
node --test test/desktop-extension.test.mjs
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"manifest_version": "0.3",
|
|
3
|
+
"name": "sogni-creative-agent",
|
|
4
|
+
"display_name": "Sogni Creative Agent",
|
|
5
|
+
"version": "3.9.0",
|
|
6
|
+
"description": "Generate images, video, and music on Sogni AI's decentralized GPU network — with personas, memories, and safe video editing tools.",
|
|
7
|
+
"author": { "name": "Sogni AI", "url": "https://sogni.ai" },
|
|
8
|
+
"homepage": "https://sogni.ai",
|
|
9
|
+
"server": {
|
|
10
|
+
"type": "node",
|
|
11
|
+
"entry_point": "server/index.mjs",
|
|
12
|
+
"mcp_config": {
|
|
13
|
+
"command": "node",
|
|
14
|
+
"args": ["${__dirname}/server/index.mjs"],
|
|
15
|
+
"env": {
|
|
16
|
+
"SOGNI_API_KEY": "${user_config.api_key}"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"user_config": {
|
|
21
|
+
"api_key": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"title": "Sogni API key",
|
|
24
|
+
"description": "Optional if you've already run `npx setup-sogni-agent-skill` (which saves ~/.config/sogni/credentials). Get a key at https://dashboard.sogni.ai.",
|
|
25
|
+
"sensitive": true,
|
|
26
|
+
"required": false
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"compatibility": {
|
|
30
|
+
"platforms": ["darwin", "win32", "linux"]
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// desktop-extension/server/index.mjs
|
|
3
|
+
// Dependency-free MCP stdio server for Claude Desktop. Translates tool calls
|
|
4
|
+
// into sogni-agent CLI invocations. Protocol: JSON-RPC 2.0, one message per
|
|
5
|
+
// line over stdio. IMPORTANT: stdout is protocol-only — log to stderr.
|
|
6
|
+
import { spawn } from 'node:child_process';
|
|
7
|
+
import { readFileSync } from 'node:fs';
|
|
8
|
+
import { createInterface } from 'node:readline';
|
|
9
|
+
import { dirname, join } from 'node:path';
|
|
10
|
+
import { fileURLToPath } from 'node:url';
|
|
11
|
+
import { TOOLS, getTool } from './tools.mjs';
|
|
12
|
+
import { buildChildEnv, resolveAgentPath, resolveFfmpegPath } from './resolve.mjs';
|
|
13
|
+
|
|
14
|
+
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
15
|
+
const PROTOCOL_FALLBACK = '2025-06-18';
|
|
16
|
+
const HARD_KILL_MS = 15 * 60 * 1000; // generation ceiling; CLI enforces its own -t timeouts sooner
|
|
17
|
+
const PROGRESS_INTERVAL_MS = 10_000;
|
|
18
|
+
const MAX_RESULT_CHARS = 20_000;
|
|
19
|
+
|
|
20
|
+
let VERSION = '0.0.0';
|
|
21
|
+
try {
|
|
22
|
+
VERSION = JSON.parse(readFileSync(join(HERE, '..', 'manifest.json'), 'utf8')).version;
|
|
23
|
+
} catch {
|
|
24
|
+
// Running outside a packaged layout (e.g. unit tests before Task 4); harmless.
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function send(msg) {
|
|
28
|
+
process.stdout.write(JSON.stringify(msg) + '\n');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function textResult(text, isError = false) {
|
|
32
|
+
return { content: [{ type: 'text', text }], isError };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async function callTool(name, input, progressToken) {
|
|
36
|
+
const tool = getTool(name);
|
|
37
|
+
if (!tool) return textResult(`Unknown tool: ${name}`, true);
|
|
38
|
+
|
|
39
|
+
const agentPath = resolveAgentPath();
|
|
40
|
+
if (!agentPath) {
|
|
41
|
+
return textResult(
|
|
42
|
+
'The sogni-agent CLI is not installed. Open a terminal, run `npx setup-sogni-agent-skill`, then retry.',
|
|
43
|
+
true,
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
let args;
|
|
48
|
+
try {
|
|
49
|
+
args = tool.buildArgs(input ?? {});
|
|
50
|
+
} catch (err) {
|
|
51
|
+
return textResult(err.message, true);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const env = buildChildEnv({ agentPath, ffmpegPath: resolveFfmpegPath() });
|
|
55
|
+
|
|
56
|
+
return await new Promise((resolve) => {
|
|
57
|
+
const child = spawn(process.execPath, [agentPath, ...args], {
|
|
58
|
+
env,
|
|
59
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
60
|
+
});
|
|
61
|
+
let stdout = '';
|
|
62
|
+
let stderr = '';
|
|
63
|
+
child.stdout.on('data', (d) => { stdout += d; });
|
|
64
|
+
child.stderr.on('data', (d) => { stderr += d; });
|
|
65
|
+
|
|
66
|
+
const started = Date.now();
|
|
67
|
+
const ticker = progressToken == null
|
|
68
|
+
? null
|
|
69
|
+
: setInterval(() => {
|
|
70
|
+
send({
|
|
71
|
+
jsonrpc: '2.0',
|
|
72
|
+
method: 'notifications/progress',
|
|
73
|
+
params: {
|
|
74
|
+
progressToken,
|
|
75
|
+
progress: Math.round((Date.now() - started) / 1000),
|
|
76
|
+
message: `sogni-agent ${name} running…`,
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
}, PROGRESS_INTERVAL_MS);
|
|
80
|
+
const killer = setTimeout(() => child.kill('SIGKILL'), HARD_KILL_MS);
|
|
81
|
+
|
|
82
|
+
const finish = (result) => {
|
|
83
|
+
if (ticker) clearInterval(ticker);
|
|
84
|
+
clearTimeout(killer);
|
|
85
|
+
resolve(result);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
child.on('error', (err) => finish(textResult(`Failed to launch sogni-agent: ${err.message}`, true)));
|
|
89
|
+
child.on('close', (code) => {
|
|
90
|
+
const text = [stdout.trim(), code === 0 ? '' : stderr.trim()].filter(Boolean).join('\n')
|
|
91
|
+
|| `sogni-agent exited with code ${code}`;
|
|
92
|
+
// Success output is front-loaded (e.g. result JSON) so keep the head; on
|
|
93
|
+
// failure the actionable error is at the tail, so keep the tail instead.
|
|
94
|
+
const clipped = code === 0 ? text.slice(0, MAX_RESULT_CHARS) : text.slice(-MAX_RESULT_CHARS);
|
|
95
|
+
finish(textResult(clipped, code !== 0));
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
async function dispatch(msg) {
|
|
101
|
+
const { id, method, params } = msg;
|
|
102
|
+
const isRequest = id !== undefined && id !== null;
|
|
103
|
+
|
|
104
|
+
if (method === 'initialize') {
|
|
105
|
+
send({
|
|
106
|
+
jsonrpc: '2.0',
|
|
107
|
+
id,
|
|
108
|
+
result: {
|
|
109
|
+
protocolVersion: params?.protocolVersion ?? PROTOCOL_FALLBACK,
|
|
110
|
+
capabilities: { tools: {} },
|
|
111
|
+
serverInfo: { name: 'sogni-creative-agent', version: VERSION },
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
if (method === 'ping') {
|
|
117
|
+
send({ jsonrpc: '2.0', id, result: {} });
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
if (method === 'tools/list') {
|
|
121
|
+
send({
|
|
122
|
+
jsonrpc: '2.0',
|
|
123
|
+
id,
|
|
124
|
+
result: {
|
|
125
|
+
tools: TOOLS.map(({ name, description, inputSchema }) => ({ name, description, inputSchema })),
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if (method === 'tools/call') {
|
|
131
|
+
const result = await callTool(params?.name, params?.arguments, params?._meta?.progressToken);
|
|
132
|
+
send({ jsonrpc: '2.0', id, result });
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
if (!isRequest || method?.startsWith('notifications/')) {
|
|
136
|
+
return; // notifications need no response
|
|
137
|
+
}
|
|
138
|
+
send({ jsonrpc: '2.0', id, error: { code: -32601, message: `Method not found: ${method}` } });
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const rl = createInterface({ input: process.stdin, terminal: false });
|
|
142
|
+
rl.on('line', (line) => {
|
|
143
|
+
if (!line.trim()) return;
|
|
144
|
+
let msg;
|
|
145
|
+
try {
|
|
146
|
+
msg = JSON.parse(line);
|
|
147
|
+
} catch {
|
|
148
|
+
send({ jsonrpc: '2.0', id: null, error: { code: -32700, message: 'Parse error' } });
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
dispatch(msg).catch((err) => {
|
|
152
|
+
if (msg.id !== undefined && msg.id !== null) {
|
|
153
|
+
send({ jsonrpc: '2.0', id: msg.id, error: { code: -32603, message: err.message } });
|
|
154
|
+
} else {
|
|
155
|
+
process.stderr.write(`sogni desktop server error: ${err.stack}\n`);
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
rl.on('close', () => process.exit(0));
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// desktop-extension/server/resolve.mjs
|
|
2
|
+
// Claude Desktop launches MCP servers with a minimal GUI environment: no
|
|
3
|
+
// /opt/homebrew/bin, no npm global bin dir. Everything here resolves to
|
|
4
|
+
// absolute paths so the wrapper never depends on PATH lookup.
|
|
5
|
+
import { existsSync, readdirSync } from 'node:fs';
|
|
6
|
+
import { homedir } from 'node:os';
|
|
7
|
+
import { delimiter, dirname, join } from 'node:path';
|
|
8
|
+
|
|
9
|
+
const PKG_REL = join('@sogni-ai', 'sogni-creative-agent-skill');
|
|
10
|
+
|
|
11
|
+
// System-wide npm global roots. Injectable (`roots`) so tests on machines that
|
|
12
|
+
// really have the skill installed globally can sandbox resolution.
|
|
13
|
+
const DEFAULT_GLOBAL_ROOTS = [
|
|
14
|
+
'/opt/homebrew/lib/node_modules',
|
|
15
|
+
'/usr/local/lib/node_modules',
|
|
16
|
+
'/usr/lib/node_modules',
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
function nvmCandidates(home) {
|
|
20
|
+
const base = join(home, '.nvm', 'versions', 'node');
|
|
21
|
+
let versions;
|
|
22
|
+
try {
|
|
23
|
+
versions = readdirSync(base);
|
|
24
|
+
} catch {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
return versions
|
|
28
|
+
.sort()
|
|
29
|
+
.reverse()
|
|
30
|
+
.map((v) => join(base, v, 'lib', 'node_modules', PKG_REL, 'sogni-agent.mjs'));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function resolveAgentPath({ env = process.env, home = homedir(), roots = DEFAULT_GLOBAL_ROOTS } = {}) {
|
|
34
|
+
if (env.SOGNI_AGENT_PATH) {
|
|
35
|
+
return existsSync(env.SOGNI_AGENT_PATH) ? env.SOGNI_AGENT_PATH : null;
|
|
36
|
+
}
|
|
37
|
+
const candidates = [
|
|
38
|
+
...roots.map((root) => join(root, PKG_REL, 'sogni-agent.mjs')),
|
|
39
|
+
join(home, '.npm-global', 'lib', 'node_modules', PKG_REL, 'sogni-agent.mjs'),
|
|
40
|
+
...(env.APPDATA ? [join(env.APPDATA, 'npm', 'node_modules', PKG_REL, 'sogni-agent.mjs')] : []),
|
|
41
|
+
...nvmCandidates(home),
|
|
42
|
+
];
|
|
43
|
+
return candidates.find((p) => existsSync(p)) ?? null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function resolveFfmpegPath({ env = process.env } = {}) {
|
|
47
|
+
if (env.FFMPEG_PATH) return env.FFMPEG_PATH;
|
|
48
|
+
const candidates = ['/opt/homebrew/bin/ffmpeg', '/usr/local/bin/ffmpeg', '/usr/bin/ffmpeg'];
|
|
49
|
+
return candidates.find((p) => existsSync(p)) ?? null;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function buildChildEnv({ env = process.env, agentPath, ffmpegPath = null } = {}) {
|
|
53
|
+
const extraBins = ['/opt/homebrew/bin', '/usr/local/bin'];
|
|
54
|
+
if (agentPath) extraBins.push(dirname(agentPath));
|
|
55
|
+
const child = {
|
|
56
|
+
...env,
|
|
57
|
+
PATH: [...extraBins, env.PATH ?? ''].filter(Boolean).join(delimiter),
|
|
58
|
+
};
|
|
59
|
+
if (ffmpegPath) child.FFMPEG_PATH = ffmpegPath;
|
|
60
|
+
// The .mcpb user_config template injects "" when the API-key field is left
|
|
61
|
+
// blank; an empty env var would shadow ~/.config/sogni/credentials.
|
|
62
|
+
if (child.SOGNI_API_KEY === '') delete child.SOGNI_API_KEY;
|
|
63
|
+
return child;
|
|
64
|
+
}
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
// desktop-extension/server/tools.mjs
|
|
2
|
+
// MCP tool registry: JSON Schemas shown to Claude Desktop plus pure
|
|
3
|
+
// buildArgs() functions that translate tool input into sogni-agent argv.
|
|
4
|
+
// buildArgs never spawns anything — index.mjs owns process execution.
|
|
5
|
+
|
|
6
|
+
const GEN_BASE = ['--json', '-q', '--no-update-check'];
|
|
7
|
+
|
|
8
|
+
function push(args, flag, value) {
|
|
9
|
+
if (value !== undefined && value !== null && value !== '') args.push(flag, String(value));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function required(input, field, hint) {
|
|
13
|
+
const v = input[field];
|
|
14
|
+
if (v === undefined || v === null || v === '') {
|
|
15
|
+
throw new Error(`${field} is required${hint ? ` — ${hint}` : ''}.`);
|
|
16
|
+
}
|
|
17
|
+
return v;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const str = (description) => ({ type: 'string', description });
|
|
21
|
+
const num = (description) => ({ type: 'number', description });
|
|
22
|
+
|
|
23
|
+
export const TOOLS = [
|
|
24
|
+
{
|
|
25
|
+
name: 'generate_image',
|
|
26
|
+
description:
|
|
27
|
+
'Generate one or more images from a text prompt on the Sogni GPU network. ' +
|
|
28
|
+
'Pass output_path (absolute, .png/.jpg) to save locally; otherwise a hosted URL is returned. ' +
|
|
29
|
+
'Use context_images for image editing ("make the background a beach") and persona to include a saved person.',
|
|
30
|
+
inputSchema: {
|
|
31
|
+
type: 'object',
|
|
32
|
+
properties: {
|
|
33
|
+
prompt: str('What to generate'),
|
|
34
|
+
output_path: str('Absolute file path to save the image (optional)'),
|
|
35
|
+
quality: { type: 'string', enum: ['fast', 'hq', 'pro'], description: 'Quality preset' },
|
|
36
|
+
model: str('Model id (optional; overrides quality preset)'),
|
|
37
|
+
width: num('Width in px (default 512)'),
|
|
38
|
+
height: num('Height in px (default 512)'),
|
|
39
|
+
count: num('Number of images (default 1)'),
|
|
40
|
+
seed: num('Fixed seed for reproducibility'),
|
|
41
|
+
context_images: { type: 'array', items: { type: 'string' }, description: 'Absolute paths of context/edit images' },
|
|
42
|
+
persona: str('Saved persona name to use as reference'),
|
|
43
|
+
timeout_seconds: num('Generation timeout override'),
|
|
44
|
+
},
|
|
45
|
+
required: ['prompt'],
|
|
46
|
+
},
|
|
47
|
+
buildArgs(input) {
|
|
48
|
+
const prompt = required(input, 'prompt');
|
|
49
|
+
const args = [...GEN_BASE];
|
|
50
|
+
push(args, '-o', input.output_path);
|
|
51
|
+
push(args, '-Q', input.quality);
|
|
52
|
+
push(args, '-m', input.model);
|
|
53
|
+
push(args, '-w', input.width);
|
|
54
|
+
push(args, '-h', input.height);
|
|
55
|
+
push(args, '-n', input.count);
|
|
56
|
+
push(args, '-s', input.seed);
|
|
57
|
+
for (const c of input.context_images ?? []) push(args, '-c', c);
|
|
58
|
+
push(args, '--persona', input.persona);
|
|
59
|
+
push(args, '-t', input.timeout_seconds);
|
|
60
|
+
args.push(prompt);
|
|
61
|
+
return args;
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: 'generate_video',
|
|
66
|
+
description:
|
|
67
|
+
'Generate a video from a text prompt, optionally driven by reference media. ' +
|
|
68
|
+
'ref = start frame image, ref_end = end frame, ref_audio = soundtrack/lip-sync audio, ref_video = motion reference. ' +
|
|
69
|
+
'Rendering takes minutes; prefer output_path (absolute .mp4).',
|
|
70
|
+
inputSchema: {
|
|
71
|
+
type: 'object',
|
|
72
|
+
properties: {
|
|
73
|
+
prompt: str('Motion/scene description'),
|
|
74
|
+
output_path: str('Absolute .mp4 path to save (optional)'),
|
|
75
|
+
model: str('Video model id (optional)'),
|
|
76
|
+
workflow: { type: 'string', enum: ['t2v', 'i2v', 's2v', 'ia2v', 'a2v', 'v2v', 'animate-move', 'animate-replace'] },
|
|
77
|
+
duration: num('Duration in seconds (default 5)'),
|
|
78
|
+
ref: str('Absolute path or URL of the start-frame image'),
|
|
79
|
+
ref_end: str('Absolute path or URL of the end-frame image'),
|
|
80
|
+
ref_audio: str('Absolute path or URL of reference audio'),
|
|
81
|
+
ref_video: str('Absolute path or URL of reference video'),
|
|
82
|
+
persona: str('Saved persona name (reference frame)'),
|
|
83
|
+
target_resolution: num('Short-side target in px, preserves aspect'),
|
|
84
|
+
timeout_seconds: num('Generation timeout override (default 300)'),
|
|
85
|
+
},
|
|
86
|
+
required: ['prompt'],
|
|
87
|
+
},
|
|
88
|
+
buildArgs(input) {
|
|
89
|
+
const prompt = required(input, 'prompt');
|
|
90
|
+
const args = [...GEN_BASE, '--video'];
|
|
91
|
+
push(args, '-o', input.output_path);
|
|
92
|
+
push(args, '-m', input.model);
|
|
93
|
+
push(args, '--workflow', input.workflow);
|
|
94
|
+
push(args, '--duration', input.duration);
|
|
95
|
+
push(args, '--ref', input.ref);
|
|
96
|
+
push(args, '--ref-end', input.ref_end);
|
|
97
|
+
push(args, '--ref-audio', input.ref_audio);
|
|
98
|
+
push(args, '--ref-video', input.ref_video);
|
|
99
|
+
push(args, '--persona', input.persona);
|
|
100
|
+
push(args, '--target-resolution', input.target_resolution);
|
|
101
|
+
push(args, '-t', input.timeout_seconds);
|
|
102
|
+
args.push(prompt);
|
|
103
|
+
return args;
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: 'generate_music',
|
|
108
|
+
description:
|
|
109
|
+
'Generate music/audio from a text prompt. Omit lyrics for an instrumental. ' +
|
|
110
|
+
'Duration 10-600 seconds. Prefer output_path (absolute .mp3/.wav/.flac).',
|
|
111
|
+
inputSchema: {
|
|
112
|
+
type: 'object',
|
|
113
|
+
properties: {
|
|
114
|
+
prompt: str('Style/mood description'),
|
|
115
|
+
output_path: str('Absolute audio file path to save (optional)'),
|
|
116
|
+
lyrics: str('Song lyrics (optional)'),
|
|
117
|
+
duration: num('Seconds, 10-600 (default 30)'),
|
|
118
|
+
bpm: num('Beats per minute (30-300)'),
|
|
119
|
+
keyscale: str('Key/scale, e.g. "C major"'),
|
|
120
|
+
music_model: str('turbo | sft | ace_step_1.5_turbo | ace_step_1.5_sft'),
|
|
121
|
+
audio_format: { type: 'string', enum: ['mp3', 'flac', 'wav'] },
|
|
122
|
+
timeout_seconds: num('Generation timeout override (default 600)'),
|
|
123
|
+
},
|
|
124
|
+
required: ['prompt'],
|
|
125
|
+
},
|
|
126
|
+
buildArgs(input) {
|
|
127
|
+
const prompt = required(input, 'prompt');
|
|
128
|
+
const args = [...GEN_BASE, '--music'];
|
|
129
|
+
push(args, '-o', input.output_path);
|
|
130
|
+
push(args, '--music-model', input.music_model);
|
|
131
|
+
push(args, '--lyrics', input.lyrics);
|
|
132
|
+
push(args, '--duration', input.duration);
|
|
133
|
+
push(args, '--bpm', input.bpm);
|
|
134
|
+
push(args, '--keyscale', input.keyscale);
|
|
135
|
+
push(args, '--output-format', input.audio_format);
|
|
136
|
+
push(args, '-t', input.timeout_seconds);
|
|
137
|
+
args.push(prompt);
|
|
138
|
+
return args;
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
name: 'photobooth',
|
|
143
|
+
description:
|
|
144
|
+
'Face-transfer portrait generation: renders the person in the ref photo into a new scene ' +
|
|
145
|
+
'(e.g. "LinkedIn professional headshot", "80s fashion portrait").',
|
|
146
|
+
inputSchema: {
|
|
147
|
+
type: 'object',
|
|
148
|
+
properties: {
|
|
149
|
+
prompt: str('Scene/style description'),
|
|
150
|
+
ref: str('Absolute path or URL of the face photo'),
|
|
151
|
+
output_path: str('Absolute image path to save (optional)'),
|
|
152
|
+
count: num('Number of variations (default 1)'),
|
|
153
|
+
},
|
|
154
|
+
required: ['prompt', 'ref'],
|
|
155
|
+
},
|
|
156
|
+
buildArgs(input) {
|
|
157
|
+
const prompt = required(input, 'prompt');
|
|
158
|
+
const ref = required(input, 'ref', 'a face photo path or URL');
|
|
159
|
+
const args = [...GEN_BASE, '--photobooth', '--ref', String(ref)];
|
|
160
|
+
push(args, '-n', input.count);
|
|
161
|
+
push(args, '-o', input.output_path);
|
|
162
|
+
args.push(prompt);
|
|
163
|
+
return args;
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
name: 'edit_video',
|
|
168
|
+
description:
|
|
169
|
+
'Safe local video utilities (ffmpeg wrappers): extract the first/last frame, ' +
|
|
170
|
+
'concatenate clips (with optional soundtrack), or remix the audio of an existing video.',
|
|
171
|
+
inputSchema: {
|
|
172
|
+
type: 'object',
|
|
173
|
+
properties: {
|
|
174
|
+
action: { type: 'string', enum: ['extract_first_frame', 'extract_last_frame', 'concat_videos', 'remix_audio'] },
|
|
175
|
+
input: str('Input video path (extract/remix actions)'),
|
|
176
|
+
output: str('Output file path'),
|
|
177
|
+
clips: { type: 'array', items: { type: 'string' }, description: 'Clip paths for concat_videos (min 2)' },
|
|
178
|
+
audio_path: str('Soundtrack to mux over concat_videos output'),
|
|
179
|
+
bed_audio: str('Audio bed for remix_audio'),
|
|
180
|
+
audio_loop: { type: 'boolean', description: 'Loop the bed to cover the video (remix_audio)' },
|
|
181
|
+
},
|
|
182
|
+
required: ['action', 'output'],
|
|
183
|
+
},
|
|
184
|
+
buildArgs(input) {
|
|
185
|
+
const action = required(input, 'action');
|
|
186
|
+
if (action === 'extract_first_frame' || action === 'extract_last_frame') {
|
|
187
|
+
const src = required(input, 'input', 'the source video');
|
|
188
|
+
const output = required(input, 'output');
|
|
189
|
+
return ['--no-update-check', `--${action.replaceAll('_', '-')}`, String(src), String(output)];
|
|
190
|
+
}
|
|
191
|
+
if (action === 'concat_videos') {
|
|
192
|
+
const output = required(input, 'output');
|
|
193
|
+
const clips = input.clips ?? [];
|
|
194
|
+
if (clips.length < 2) throw new Error('concat_videos needs at least two clips.');
|
|
195
|
+
const args = ['--no-update-check', '--concat-videos', String(output), ...clips.map(String)];
|
|
196
|
+
push(args, '--concat-audio', input.audio_path);
|
|
197
|
+
return args;
|
|
198
|
+
}
|
|
199
|
+
if (action === 'remix_audio') {
|
|
200
|
+
const src = required(input, 'input', 'the source video');
|
|
201
|
+
const output = required(input, 'output');
|
|
202
|
+
const args = ['--no-update-check', '--remix-audio', String(src), String(output)];
|
|
203
|
+
push(args, '--bed-audio', input.bed_audio);
|
|
204
|
+
if (input.audio_loop) args.push('--audio-loop');
|
|
205
|
+
return args;
|
|
206
|
+
}
|
|
207
|
+
throw new Error(`Unknown action "${action}".`);
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
name: 'list_media',
|
|
212
|
+
description: 'List recent inbound media files the user sent to Sogni (images, audio, or all).',
|
|
213
|
+
inputSchema: {
|
|
214
|
+
type: 'object',
|
|
215
|
+
properties: { type: { type: 'string', enum: ['images', 'audio', 'all'] } },
|
|
216
|
+
},
|
|
217
|
+
buildArgs(input) {
|
|
218
|
+
return ['--json', '--no-update-check', '--list-media', input.type ?? 'images'];
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
name: 'manage_personas',
|
|
223
|
+
description:
|
|
224
|
+
'Manage saved personas (named people with reference photos and optional voice clips). ' +
|
|
225
|
+
'Actions: list, add (needs name + ref photo), remove, resolve (show details).',
|
|
226
|
+
inputSchema: {
|
|
227
|
+
type: 'object',
|
|
228
|
+
properties: {
|
|
229
|
+
action: { type: 'string', enum: ['list', 'add', 'remove', 'resolve'] },
|
|
230
|
+
name: str('Persona name (add/remove/resolve)'),
|
|
231
|
+
ref: str('Reference photo path or URL (add)'),
|
|
232
|
+
relationship: { type: 'string', enum: ['self', 'partner', 'child', 'friend', 'pet'] },
|
|
233
|
+
description: str('Appearance description (add)'),
|
|
234
|
+
voice_clip: str('Voice clip audio path (add)'),
|
|
235
|
+
},
|
|
236
|
+
required: ['action'],
|
|
237
|
+
},
|
|
238
|
+
buildArgs(input) {
|
|
239
|
+
const action = required(input, 'action');
|
|
240
|
+
if (action === 'list') return ['--json', '--no-update-check', '--persona-list'];
|
|
241
|
+
const name = required(input, 'name');
|
|
242
|
+
if (action === 'remove') return ['--no-update-check', '--persona-remove', String(name)];
|
|
243
|
+
if (action === 'resolve') return ['--json', '--no-update-check', '--persona-resolve', String(name)];
|
|
244
|
+
if (action === 'add') {
|
|
245
|
+
const ref = required(input, 'ref', 'a reference photo for the persona');
|
|
246
|
+
const args = ['--no-update-check', '--persona-add', String(name), '--ref', String(ref)];
|
|
247
|
+
push(args, '--relationship', input.relationship);
|
|
248
|
+
push(args, '--description', input.description);
|
|
249
|
+
push(args, '--voice-clip', input.voice_clip);
|
|
250
|
+
return args;
|
|
251
|
+
}
|
|
252
|
+
throw new Error(`Unknown action "${action}".`);
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
name: 'manage_memories',
|
|
257
|
+
description:
|
|
258
|
+
'Manage persistent user preferences (e.g. preferred_style). Actions: list, get, set, remove.',
|
|
259
|
+
inputSchema: {
|
|
260
|
+
type: 'object',
|
|
261
|
+
properties: {
|
|
262
|
+
action: { type: 'string', enum: ['list', 'get', 'set', 'remove'] },
|
|
263
|
+
key: str('Memory key (get/set/remove)'),
|
|
264
|
+
value: str('Memory value (set)'),
|
|
265
|
+
category: { type: 'string', enum: ['preference', 'fact', 'context'] },
|
|
266
|
+
},
|
|
267
|
+
required: ['action'],
|
|
268
|
+
},
|
|
269
|
+
buildArgs(input) {
|
|
270
|
+
const action = required(input, 'action');
|
|
271
|
+
if (action === 'list') return ['--json', '--no-update-check', '--memory-list'];
|
|
272
|
+
const key = required(input, 'key');
|
|
273
|
+
if (action === 'get') return ['--json', '--no-update-check', '--memory-get', String(key)];
|
|
274
|
+
if (action === 'remove') return ['--no-update-check', '--memory-remove', String(key)];
|
|
275
|
+
if (action === 'set') {
|
|
276
|
+
const value = required(input, 'value');
|
|
277
|
+
const args = ['--no-update-check', '--memory-set', String(key), String(value)];
|
|
278
|
+
push(args, '--memory-category', input.category);
|
|
279
|
+
return args;
|
|
280
|
+
}
|
|
281
|
+
throw new Error(`Unknown action "${action}".`);
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
name: 'sogni_doctor',
|
|
286
|
+
description:
|
|
287
|
+
'Health check for the Sogni install: Node, credentials, ffmpeg, live auth, version. ' +
|
|
288
|
+
'Run only after another tool fails — not as a routine preflight.',
|
|
289
|
+
inputSchema: { type: 'object', properties: {} },
|
|
290
|
+
buildArgs() {
|
|
291
|
+
return ['--doctor', '--json', '--no-update-check'];
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
name: 'account_balance',
|
|
296
|
+
description: 'Show the SPARK/SOGNI token balances for the configured Sogni account.',
|
|
297
|
+
inputSchema: { type: 'object', properties: {} },
|
|
298
|
+
buildArgs() {
|
|
299
|
+
return ['--balances', '--json', '--no-update-check'];
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
];
|
|
303
|
+
|
|
304
|
+
export function getTool(name) {
|
|
305
|
+
return TOOLS.find((t) => t.name === name);
|
|
306
|
+
}
|
|
@@ -2216,15 +2216,12 @@ const PROMPT_CONTRACTS = [
|
|
|
2216
2216
|
"contractId": "video_to_video_v1",
|
|
2217
2217
|
"version": "1.0.0",
|
|
2218
2218
|
"toolName": "video_to_video",
|
|
2219
|
-
"baseDescription": "video_to_video transforms an uploaded video. Use for uploaded-video restyling, enhancement,\nupscaling/remastering, motion transfer from video to image, subject replacement, edge/pose/\ndepth-guided restyle, or explicit Seedance V2V transforms.\n\nThis tool requires an uploaded video source. Do not use it for generated video indices. For\ngenerated or uploaded partial edits use replace_video_segment; for appended time use\nextend_video; for logos/text overlays use overlay_video; for stitching use stitch_video.\n\nChoose controlMode by intent. Use detailer for quality-only enhancement without restyling.\nUse seedance-v2v only when the user asks to transform/enhance/remaster an uploaded video\nwith Seedance, including Seedance-fast uploaded-video upscale/remaster requests. For detailer,\ndescribe the original scene plus quality terms, not new content
|
|
2219
|
+
"baseDescription": "video_to_video transforms an uploaded video. Use for uploaded-video restyling, enhancement,\nupscaling/remastering, motion transfer from video to image, subject replacement, edge/pose/\ndepth-guided restyle, or explicit Seedance V2V transforms.\n\nThis tool requires an uploaded video source. Do not use it for generated video indices. For\ngenerated or uploaded partial edits use replace_video_segment; for appended time use\nextend_video; for logos/text overlays use overlay_video; for stitching use stitch_video.\n\nChoose controlMode by intent. Use detailer for quality-only enhancement without restyling.\nUse seedance-v2v only when the user asks to transform/enhance/remaster an uploaded video\nwith Seedance, including Seedance-fast uploaded-video upscale/remaster requests. For detailer,\ndescribe the original scene plus quality terms, not new content.",
|
|
2220
2220
|
"parameterDocs": {
|
|
2221
|
-
"prompt": "Describe the target appearance in present tense. For detailer, describe the original content plus quality qualifiers only.
|
|
2221
|
+
"prompt": "Describe the target appearance in present tense. For detailer, describe the original content plus quality qualifiers only.",
|
|
2222
2222
|
"videoSourceIndex": "Uploaded video index. Omit when there is one uploaded video; use 0 for first uploaded video or -1 if using negative upload notation.",
|
|
2223
|
-
"controlMode": "Pick from intent: detailer for enhance, seedance-v2v for explicit Seedance V2V, canny/depth/pose for control-net restyles, animate-move/replace for WAN Animate
|
|
2224
|
-
"sourceImageIndex": "Required for animate-move and animate-replace. Ignored by canny, depth,
|
|
2225
|
-
"outpaintPosition": "outpaint only. Where the original frame sits in the expanded canvas (center/top/bottom/left/right); determines grow direction. Default center.",
|
|
2226
|
-
"outpaintAspectRatio": "outpaint only, optional. Target aspect ratio (e.g. 16:9) for the expanded canvas; the canvas only grows, never crops. Set only when the user names a target shape/orientation.",
|
|
2227
|
-
"maskImageIndex": "inpaint only, optional. 0-based index of an uploaded mask image (white = regenerate, black = preserve). Omit when the user did not provide a mask.",
|
|
2223
|
+
"controlMode": "Pick from intent: detailer for enhance, seedance-v2v for explicit Seedance V2V, canny/depth/pose for control-net restyles, animate-move/replace for WAN Animate.",
|
|
2224
|
+
"sourceImageIndex": "Required for animate-move and animate-replace. Ignored by canny, depth, and detailer.",
|
|
2228
2225
|
"duration": "Set only when the user requests a different output length; otherwise let the tool match/cap the source duration."
|
|
2229
2226
|
}
|
|
2230
2227
|
},
|
package/llm.txt
CHANGED
|
@@ -87,7 +87,7 @@ You can also export `SOGNI_API_KEY` instead of writing the file. Confirm with
|
|
|
87
87
|
`--thinking` / `--no-thinking`, `--list-replays [n]`, `--get-replay <id>`,
|
|
88
88
|
`--ingest-replay <json|@path>`.
|
|
89
89
|
- Media references from `-c`, `--ref`, `--ref-end`, `--ref-audio`,
|
|
90
|
-
`--reference-audio-identity`,
|
|
90
|
+
`--reference-audio-identity`, `--ref-video`, and `--mask` are uploaded and forwarded as
|
|
91
91
|
`media_references`; API chat also attaches image refs as vision inputs.
|
|
92
92
|
Workflow JSON can bind refs with `sourceStepId: "$input_media"`.
|
|
93
93
|
- Cost policy: `--workflow-max-cost`, `--confirm-cost`, `--no-confirm-cost`.
|
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.
|
|
5
|
+
"version": "3.9.0",
|
|
6
6
|
"skills": [
|
|
7
7
|
"."
|
|
8
8
|
],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sogni-ai/sogni-creative-agent-skill",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.10.0",
|
|
4
4
|
"description": "Sogni Creative Agent Skill: agent skill and CLI for Sogni AI image, video, and music generation.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "sogni-agent.mjs",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"test:all": "npm run test && npm run test:integration",
|
|
20
20
|
"test:coverage": "npm run check:creative-agent-runtime && node --test --experimental-test-coverage --test-coverage-include=sogni-agent.mjs --test-coverage-lines=50 --test-coverage-branches=35 --test-coverage-functions=50 test/sogni-agent.test.mjs",
|
|
21
21
|
"test:coverage:full": "npm run check:creative-agent-runtime && node --test --experimental-test-coverage --test-coverage-include=sogni-agent.mjs --test-coverage-lines=50 --test-coverage-branches=35 --test-coverage-functions=50 test/*.test.mjs test/*.integration.mjs",
|
|
22
|
+
"build:mcpb": "npx -y @anthropic-ai/mcpb pack desktop-extension dist/sogni-creative-agent.mcpb",
|
|
22
23
|
"prepack": "npm run check:creative-agent-source:strict && SOGNI_REQUIRE_RUNTIME_SYNC=1 npm run check:creative-agent-runtime",
|
|
23
24
|
"prepare": "husky",
|
|
24
25
|
"release": "semantic-release"
|
|
@@ -56,6 +57,7 @@
|
|
|
56
57
|
"CHANGELOG.md",
|
|
57
58
|
"SKILL.md",
|
|
58
59
|
"references/",
|
|
60
|
+
"desktop-extension/",
|
|
59
61
|
"skills/",
|
|
60
62
|
"llm.txt",
|
|
61
63
|
"skill-package.json",
|
|
@@ -199,13 +199,25 @@ beyond `canny`/`pose`/`depth`/`detailer`:
|
|
|
199
199
|
These modes run as Sogni Projects on the v2v surface. In the hosted
|
|
200
200
|
`video_to_video` tool the control mode is selected with `controlMode` set to
|
|
201
201
|
`outpaint` or `inpaint` (with `outpaintPosition` / optional
|
|
202
|
-
`outpaintAspectRatio` for outpaint, or `maskImageIndex` for inpaint).
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
(
|
|
206
|
-
(
|
|
207
|
-
|
|
208
|
-
|
|
202
|
+
`outpaintAspectRatio` for outpaint, or `maskImageIndex` for inpaint). Hosted
|
|
203
|
+
execution can derive an inpaint mask if the user did not upload one. The direct
|
|
204
|
+
CLI and underlying sogni-client SDK example expose them as `--control-type` /
|
|
205
|
+
`control-type` (`canny|pose|depth|detailer|outpaint|inpaint`), with `--mask`
|
|
206
|
+
for direct inpaint (white = region to regenerate), `--outpaint-position`
|
|
207
|
+
(`center|top|bottom|left|right`), and optional `--outpaint-aspect-ratio`
|
|
208
|
+
(`16:9`, `9:16`, `1:1`, `4:3`, `3:4`, `21:9`) for direct outpaint. These
|
|
209
|
+
extension/inpaint controls are video-only.
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
sogni-agent -q --video --workflow v2v -m ltx23 \
|
|
213
|
+
--ref-video ./source.mp4 --control-type outpaint \
|
|
214
|
+
--outpaint-position center --outpaint-aspect-ratio 16:9 \
|
|
215
|
+
-o ./outpainted.mp4 "Extend the surrounding scene naturally"
|
|
216
|
+
|
|
217
|
+
sogni-agent -q --video --workflow v2v -m ltx23 \
|
|
218
|
+
--ref-video ./source.mp4 --control-type inpaint --mask ./mask.png \
|
|
219
|
+
-o ./inpainted.mp4 "Replace the masked region with clean matching detail"
|
|
220
|
+
```
|
|
209
221
|
|
|
210
222
|
## Music-to-Video Pipeline
|
|
211
223
|
|
package/sogni-agent.mjs
CHANGED
|
@@ -1555,6 +1555,14 @@ const MULTI_ANGLE_DISTANCE_ALIASES = new Map([
|
|
|
1555
1555
|
['wide shot', 'wide']
|
|
1556
1556
|
]);
|
|
1557
1557
|
|
|
1558
|
+
const VIDEO_CONTROLNET_NAMES = ['canny', 'pose', 'depth', 'detailer', 'outpaint', 'inpaint'];
|
|
1559
|
+
const VIDEO_CONTROLNET_NAME_SET = new Set(VIDEO_CONTROLNET_NAMES);
|
|
1560
|
+
const OUTPAINT_POSITIONS = ['center', 'top', 'bottom', 'left', 'right'];
|
|
1561
|
+
const OUTPAINT_POSITION_SET = new Set(OUTPAINT_POSITIONS);
|
|
1562
|
+
const LTX_TRANSITION_LORA_ID = 'transition';
|
|
1563
|
+
const LTX_TRANSITION_TRIGGER = 'zhuanchang';
|
|
1564
|
+
const LTX_TRANSITION_DEFAULT_STRENGTH = 1.0;
|
|
1565
|
+
|
|
1558
1566
|
function normalizeMultiAngleValue(value, aliases, allowedKeys, label) {
|
|
1559
1567
|
if (!value) return null;
|
|
1560
1568
|
const normalized = value.toLowerCase().replace(/_/g, '-').replace(/\s+/g, ' ').trim();
|
|
@@ -1577,6 +1585,123 @@ function buildMultiAnglePrompt({ azimuth, elevation, distance, description }) {
|
|
|
1577
1585
|
return parts.join(' ');
|
|
1578
1586
|
}
|
|
1579
1587
|
|
|
1588
|
+
function normalizeVideoControlNetName(value) {
|
|
1589
|
+
if (!value) return null;
|
|
1590
|
+
const normalized = String(value).trim().toLowerCase().replace(/_/g, '-');
|
|
1591
|
+
return normalized || null;
|
|
1592
|
+
}
|
|
1593
|
+
|
|
1594
|
+
function normalizeOutpaintPositionValue(value) {
|
|
1595
|
+
if (!value) return null;
|
|
1596
|
+
const normalized = String(value).trim().toLowerCase().replace(/_/g, '-');
|
|
1597
|
+
return OUTPAINT_POSITION_SET.has(normalized) ? normalized : null;
|
|
1598
|
+
}
|
|
1599
|
+
|
|
1600
|
+
function parseOutpaintAspectRatio(value) {
|
|
1601
|
+
if (!value) return null;
|
|
1602
|
+
const match = String(value).trim().match(/^(\d+(?:\.\d+)?)\s*[:x/]\s*(\d+(?:\.\d+)?)$/i);
|
|
1603
|
+
if (!match) return null;
|
|
1604
|
+
const width = Number(match[1]);
|
|
1605
|
+
const height = Number(match[2]);
|
|
1606
|
+
if (!Number.isFinite(width) || !Number.isFinite(height) || width <= 0 || height <= 0) return null;
|
|
1607
|
+
return width / height;
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1610
|
+
function isLtx23V2VModelId(modelId) {
|
|
1611
|
+
return !!modelId && modelId.includes('ltx23') && /_v2v(_|$)/.test(modelId);
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1614
|
+
function isLtxI2vTransitionModelId(modelId) {
|
|
1615
|
+
return !!modelId && modelId.includes('ltx') && /_i2v(_|$)/.test(modelId);
|
|
1616
|
+
}
|
|
1617
|
+
|
|
1618
|
+
function applyLtxTransitionLora(projectConfig, modelId, hasStartFrame, hasEndFrame) {
|
|
1619
|
+
if (!hasStartFrame || !hasEndFrame || !isLtxI2vTransitionModelId(modelId)) {
|
|
1620
|
+
return;
|
|
1621
|
+
}
|
|
1622
|
+
const loras = Array.isArray(projectConfig.loras) ? [...projectConfig.loras] : [];
|
|
1623
|
+
const loraStrengths = Array.isArray(projectConfig.loraStrengths) ? [...projectConfig.loraStrengths] : [];
|
|
1624
|
+
if (!loras.includes(LTX_TRANSITION_LORA_ID)) {
|
|
1625
|
+
loras.push(LTX_TRANSITION_LORA_ID);
|
|
1626
|
+
loraStrengths.push(LTX_TRANSITION_DEFAULT_STRENGTH);
|
|
1627
|
+
}
|
|
1628
|
+
projectConfig.loras = loras;
|
|
1629
|
+
projectConfig.loraStrengths = loraStrengths;
|
|
1630
|
+
const prompt = String(projectConfig.positivePrompt || '');
|
|
1631
|
+
if (!new RegExp(`\\b${LTX_TRANSITION_TRIGGER}\\b`, 'i').test(prompt)) {
|
|
1632
|
+
projectConfig.positivePrompt = prompt ? `${prompt}, ${LTX_TRANSITION_TRIGGER}` : LTX_TRANSITION_TRIGGER;
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
function computeOutpaintCanvas(sourceWidth, sourceHeight, aspectRatioArg, position, rules = DEFAULT_VIDEO_DIMENSION_RULES) {
|
|
1637
|
+
const step = rules.dimensionMultiple || DEFAULT_VIDEO_DIMENSION_RULES.dimensionMultiple;
|
|
1638
|
+
const minD = rules.minDimension || DEFAULT_VIDEO_DIMENSION_RULES.minDimension;
|
|
1639
|
+
const maxD = rules.maxDimension || DEFAULT_VIDEO_DIMENSION_RULES.maxDimension;
|
|
1640
|
+
let srcW = Number.isFinite(sourceWidth) && sourceWidth > 0 ? sourceWidth : 1920;
|
|
1641
|
+
let srcH = Number.isFinite(sourceHeight) && sourceHeight > 0 ? sourceHeight : 1088;
|
|
1642
|
+
if (srcW > maxD || srcH > maxD) {
|
|
1643
|
+
const scale = Math.min(maxD / srcW, maxD / srcH);
|
|
1644
|
+
srcW *= scale;
|
|
1645
|
+
srcH *= scale;
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1648
|
+
let targetW = srcW;
|
|
1649
|
+
let targetH = srcH;
|
|
1650
|
+
const parsedAspect = parseOutpaintAspectRatio(aspectRatioArg);
|
|
1651
|
+
if (parsedAspect) {
|
|
1652
|
+
const srcAspect = srcW / srcH;
|
|
1653
|
+
if (parsedAspect > srcAspect) targetW = srcH * parsedAspect;
|
|
1654
|
+
else if (parsedAspect < srcAspect) targetH = srcW / parsedAspect;
|
|
1655
|
+
} else {
|
|
1656
|
+
const factor = 1.5;
|
|
1657
|
+
if (position === 'left' || position === 'right') targetW = srcW * factor;
|
|
1658
|
+
else if (position === 'top' || position === 'bottom') targetH = srcH * factor;
|
|
1659
|
+
else {
|
|
1660
|
+
targetW = srcW * factor;
|
|
1661
|
+
targetH = srcH * factor;
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
|
|
1665
|
+
const snapUp = (value) => Math.ceil(value / step) * step;
|
|
1666
|
+
let width = Math.min(maxD, Math.max(minD, snapUp(targetW)));
|
|
1667
|
+
let height = Math.min(maxD, Math.max(minD, snapUp(targetH)));
|
|
1668
|
+
width = Math.max(width, Math.min(maxD, snapUp(srcW)));
|
|
1669
|
+
height = Math.max(height, Math.min(maxD, snapUp(srcH)));
|
|
1670
|
+
return { width, height };
|
|
1671
|
+
}
|
|
1672
|
+
|
|
1673
|
+
function computeSourceAspectCanvas(sourceWidth, sourceHeight, rules = DEFAULT_VIDEO_DIMENSION_RULES, targetResolution = null) {
|
|
1674
|
+
const step = rules.dimensionMultiple || DEFAULT_VIDEO_DIMENSION_RULES.dimensionMultiple;
|
|
1675
|
+
const minD = rules.minDimension || DEFAULT_VIDEO_DIMENSION_RULES.minDimension;
|
|
1676
|
+
const maxD = rules.maxDimension || DEFAULT_VIDEO_DIMENSION_RULES.maxDimension;
|
|
1677
|
+
let width = Number.isFinite(sourceWidth) && sourceWidth > 0 ? sourceWidth : 1920;
|
|
1678
|
+
let height = Number.isFinite(sourceHeight) && sourceHeight > 0 ? sourceHeight : 1088;
|
|
1679
|
+
if (Number.isFinite(targetResolution) && targetResolution > 0) {
|
|
1680
|
+
const roundedTarget = Math.max(minD, Math.round(targetResolution / step) * step);
|
|
1681
|
+
if (width <= height) {
|
|
1682
|
+
height = Math.round((height * roundedTarget) / width / step) * step;
|
|
1683
|
+
width = roundedTarget;
|
|
1684
|
+
} else {
|
|
1685
|
+
width = Math.round((width * roundedTarget) / height / step) * step;
|
|
1686
|
+
height = roundedTarget;
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1689
|
+
if (width > maxD || height > maxD) {
|
|
1690
|
+
const scale = Math.min(maxD / width, maxD / height);
|
|
1691
|
+
width *= scale;
|
|
1692
|
+
height *= scale;
|
|
1693
|
+
}
|
|
1694
|
+
if (width < minD || height < minD) {
|
|
1695
|
+
const scale = Math.max(minD / width, minD / height);
|
|
1696
|
+
width *= scale;
|
|
1697
|
+
height *= scale;
|
|
1698
|
+
}
|
|
1699
|
+
return {
|
|
1700
|
+
width: Math.max(minD, Math.min(maxD, Math.round(width / step) * step)),
|
|
1701
|
+
height: Math.max(minD, Math.min(maxD, Math.round(height / step) * step))
|
|
1702
|
+
};
|
|
1703
|
+
}
|
|
1704
|
+
|
|
1580
1705
|
function loadOpenClawPluginConfig() {
|
|
1581
1706
|
const openclawPluginConfig = getEnv('OPENCLAW_PLUGIN_CONFIG');
|
|
1582
1707
|
if (openclawPluginConfig) {
|
|
@@ -1682,6 +1807,9 @@ const options = {
|
|
|
1682
1807
|
refVideo: null, // Reference video for animate workflows (primary)
|
|
1683
1808
|
refVideos: [], // Additional Seedance loose video refs; first --ref-video fills refVideo, subsequent calls append here
|
|
1684
1809
|
videoStart: null, // Optional start offset into reference video
|
|
1810
|
+
refMask: null, // Inpaint mask image for LTX-2.3 v2v inpaint
|
|
1811
|
+
outpaintPosition: null, // LTX-2.3 v2v outpaint canvas anchor
|
|
1812
|
+
outpaintAspectRatio: null, // Optional target aspect ratio for outpaint canvas growth
|
|
1685
1813
|
contextImages: [], // Context images for image editing
|
|
1686
1814
|
looping: false, // Create looping video (i2v only): generate A→B then B→A and concatenate
|
|
1687
1815
|
photobooth: false, // Photobooth mode (InstantID face transfer)
|
|
@@ -1826,6 +1954,9 @@ const cliSet = {
|
|
|
1826
1954
|
refVideo: false,
|
|
1827
1955
|
refVideos: false,
|
|
1828
1956
|
videoStart: false,
|
|
1957
|
+
refMask: false,
|
|
1958
|
+
outpaintPosition: false,
|
|
1959
|
+
outpaintAspectRatio: false,
|
|
1829
1960
|
context: false,
|
|
1830
1961
|
looping: false,
|
|
1831
1962
|
photobooth: false,
|
|
@@ -2182,16 +2313,31 @@ for (let i = 0; i < args.length; i++) {
|
|
|
2182
2313
|
i++;
|
|
2183
2314
|
options.cnGuidanceEnd = parseNumberValue(raw, arg);
|
|
2184
2315
|
cliSet.cnGuidanceEnd = true;
|
|
2185
|
-
} else if (arg === '--controlnet-name') {
|
|
2316
|
+
} else if (arg === '--controlnet-name' || arg === '--control-type') {
|
|
2186
2317
|
const raw = requireFlagValue(args, i, arg);
|
|
2187
2318
|
i++;
|
|
2188
|
-
options.videoControlNetName = raw;
|
|
2319
|
+
options.videoControlNetName = normalizeVideoControlNetName(raw);
|
|
2189
2320
|
cliSet.videoControlNetName = true;
|
|
2190
2321
|
} else if (arg === '--controlnet-strength') {
|
|
2191
2322
|
const raw = requireFlagValue(args, i, arg);
|
|
2192
2323
|
i++;
|
|
2193
2324
|
options.videoControlNetStrength = parseNumberValue(raw, arg);
|
|
2194
2325
|
cliSet.videoControlNetStrength = true;
|
|
2326
|
+
} else if (arg === '--mask' || arg === '--ref-mask' || arg === '--reference-mask') {
|
|
2327
|
+
const raw = expandHomePath(requireFlagValue(args, i, arg));
|
|
2328
|
+
i++;
|
|
2329
|
+
options.refMask = raw;
|
|
2330
|
+
cliSet.refMask = true;
|
|
2331
|
+
} else if (arg === '--outpaint-position') {
|
|
2332
|
+
const raw = requireFlagValue(args, i, arg);
|
|
2333
|
+
i++;
|
|
2334
|
+
options.outpaintPosition = raw;
|
|
2335
|
+
cliSet.outpaintPosition = true;
|
|
2336
|
+
} else if (arg === '--outpaint-aspect-ratio' || arg === '--outpaint-ratio') {
|
|
2337
|
+
const raw = requireFlagValue(args, i, arg);
|
|
2338
|
+
i++;
|
|
2339
|
+
options.outpaintAspectRatio = raw;
|
|
2340
|
+
cliSet.outpaintAspectRatio = true;
|
|
2195
2341
|
} else if (arg === '--sam2-coordinates') {
|
|
2196
2342
|
const raw = requireFlagValue(args, i, arg);
|
|
2197
2343
|
i++;
|
|
@@ -2706,8 +2852,12 @@ Seedance Reference Modes (mutually exclusive on seedance2 / seedance2-mini / see
|
|
|
2706
2852
|
All three modalities pull caps from the canonical
|
|
2707
2853
|
@sogni-ai/sogni-protocol seedance-reference-limits catalog.
|
|
2708
2854
|
--video-start <sec> Start offset into --ref-video for segmented V2V/animate
|
|
2709
|
-
--controlnet-name <n> ControlNet type for v2v: canny|pose|depth|detailer
|
|
2855
|
+
--controlnet-name <n> ControlNet type for v2v: canny|pose|depth|detailer|outpaint|inpaint
|
|
2856
|
+
--control-type <n> Alias for --controlnet-name
|
|
2710
2857
|
--controlnet-strength <n> ControlNet strength for v2v (0.0-1.0, default: 0.8)
|
|
2858
|
+
--mask <path|url> Inpaint mask image for LTX-2.3 v2v inpaint (white = regenerate)
|
|
2859
|
+
--outpaint-position <p> LTX-2.3 outpaint anchor: center|top|bottom|left|right
|
|
2860
|
+
--outpaint-aspect-ratio <r> LTX-2.3 outpaint target ratio, e.g. 16:9 or 9:16
|
|
2711
2861
|
--sam2-coordinates <coords> SAM2 click coords for animate-replace (x,y or x1,y1;x2,y2)
|
|
2712
2862
|
--trim-end-frame Trim last frame for seamless video stitching
|
|
2713
2863
|
--first-frame-strength <n> Keyframe strength for start frame (0.0-1.0)
|
|
@@ -3583,8 +3733,8 @@ if (options.apiChat && !options.prompt && getApiModeMediaReferences().length ===
|
|
|
3583
3733
|
fatalCliError('--api-chat requires a prompt or media reference for planning.', { code: 'INVALID_ARGUMENT' });
|
|
3584
3734
|
}
|
|
3585
3735
|
|
|
3586
|
-
if (!options.video && !options.apiChat && !options.apiWorkflowAction && (options.refAudio || options.refVideo || options.referenceAudioIdentity || options.voicePersonaName || options.videoWorkflow || options.frames || options.targetResolution || options.audioStart !== null || options.audioDuration !== null || options.videoStart !== null)) {
|
|
3587
|
-
fatalCliError('Video-only options (--workflow/--frames/--target-resolution/--ref-audio/--ref-video/--reference-audio-identity/--voice-persona) require --video.', {
|
|
3736
|
+
if (!options.video && !options.apiChat && !options.apiWorkflowAction && (options.refAudio || options.refVideo || options.refMask || options.referenceAudioIdentity || options.voicePersonaName || options.videoWorkflow || options.frames || options.targetResolution || options.audioStart !== null || options.audioDuration !== null || options.videoStart !== null || options.outpaintPosition || options.outpaintAspectRatio)) {
|
|
3737
|
+
fatalCliError('Video-only options (--workflow/--frames/--target-resolution/--ref-audio/--ref-video/--mask/--outpaint-position/--reference-audio-identity/--voice-persona) require --video.', {
|
|
3588
3738
|
code: 'INVALID_ARGUMENT'
|
|
3589
3739
|
});
|
|
3590
3740
|
}
|
|
@@ -3689,7 +3839,7 @@ if (options.video) {
|
|
|
3689
3839
|
fatalCliError('v2v requires --ref-video.', { code: 'INVALID_ARGUMENT' });
|
|
3690
3840
|
}
|
|
3691
3841
|
if (!options.videoControlNetName && !isSeedanceModel(options.model)) {
|
|
3692
|
-
fatalCliError(
|
|
3842
|
+
fatalCliError(`v2v requires --controlnet-name/--control-type (${VIDEO_CONTROLNET_NAMES.join('|')}).`, { code: 'INVALID_ARGUMENT' });
|
|
3693
3843
|
}
|
|
3694
3844
|
if (!isSeedanceVideo && options.refAudio) {
|
|
3695
3845
|
fatalCliError('v2v does not accept reference audio.', { code: 'INVALID_ARGUMENT' });
|
|
@@ -3766,11 +3916,61 @@ if (options.video) {
|
|
|
3766
3916
|
|
|
3767
3917
|
// Validate controlnet-name values
|
|
3768
3918
|
if (options.videoControlNetName) {
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
fatalCliError(`Unknown --controlnet-name "${options.videoControlNetName}". Use: ${validControlNets.join('|')}`, {
|
|
3919
|
+
if (!VIDEO_CONTROLNET_NAME_SET.has(options.videoControlNetName)) {
|
|
3920
|
+
fatalCliError(`Unknown --controlnet-name "${options.videoControlNetName}". Use: ${VIDEO_CONTROLNET_NAMES.join('|')}`, {
|
|
3772
3921
|
code: 'INVALID_ARGUMENT',
|
|
3773
|
-
details: { flag: '--controlnet-name', value: options.videoControlNetName, allowed:
|
|
3922
|
+
details: { flag: '--controlnet-name', value: options.videoControlNetName, allowed: VIDEO_CONTROLNET_NAMES }
|
|
3923
|
+
});
|
|
3924
|
+
}
|
|
3925
|
+
if ((options.videoControlNetName === 'outpaint' || options.videoControlNetName === 'inpaint') && !isLtx23V2VModelId(options.model)) {
|
|
3926
|
+
fatalCliError(`${options.videoControlNetName} control requires the LTX-2.3 v2v model.`, {
|
|
3927
|
+
code: 'INVALID_ARGUMENT',
|
|
3928
|
+
details: { controlNetName: options.videoControlNetName, model: options.model },
|
|
3929
|
+
hint: 'Use --workflow v2v -m ltx23 --control-type ' + options.videoControlNetName
|
|
3930
|
+
});
|
|
3931
|
+
}
|
|
3932
|
+
if (options.videoControlNetName === 'inpaint' && !options.refMask) {
|
|
3933
|
+
fatalCliError('LTX-2.3 v2v inpaint requires --mask <image> (white pixels = region to regenerate).', {
|
|
3934
|
+
code: 'INVALID_ARGUMENT'
|
|
3935
|
+
});
|
|
3936
|
+
}
|
|
3937
|
+
if (options.videoControlNetName === 'outpaint' && !options.outpaintPosition) {
|
|
3938
|
+
options.outpaintPosition = 'center';
|
|
3939
|
+
}
|
|
3940
|
+
}
|
|
3941
|
+
|
|
3942
|
+
if (options.refMask && options.videoControlNetName !== 'inpaint') {
|
|
3943
|
+
fatalCliError('--mask is only supported with --control-type inpaint.', {
|
|
3944
|
+
code: 'INVALID_ARGUMENT'
|
|
3945
|
+
});
|
|
3946
|
+
}
|
|
3947
|
+
|
|
3948
|
+
if (options.outpaintPosition) {
|
|
3949
|
+
const normalizedOutpaintPosition = normalizeOutpaintPositionValue(options.outpaintPosition);
|
|
3950
|
+
if (!normalizedOutpaintPosition) {
|
|
3951
|
+
fatalCliError(`Invalid --outpaint-position "${options.outpaintPosition}". Use: ${OUTPAINT_POSITIONS.join('|')}`, {
|
|
3952
|
+
code: 'INVALID_ARGUMENT',
|
|
3953
|
+
details: { flag: '--outpaint-position', value: options.outpaintPosition, allowed: OUTPAINT_POSITIONS }
|
|
3954
|
+
});
|
|
3955
|
+
}
|
|
3956
|
+
if (options.videoControlNetName !== 'outpaint') {
|
|
3957
|
+
fatalCliError('--outpaint-position is only supported with --control-type outpaint.', {
|
|
3958
|
+
code: 'INVALID_ARGUMENT'
|
|
3959
|
+
});
|
|
3960
|
+
}
|
|
3961
|
+
options.outpaintPosition = normalizedOutpaintPosition;
|
|
3962
|
+
}
|
|
3963
|
+
|
|
3964
|
+
if (options.outpaintAspectRatio) {
|
|
3965
|
+
if (!parseOutpaintAspectRatio(options.outpaintAspectRatio)) {
|
|
3966
|
+
fatalCliError(`Invalid --outpaint-aspect-ratio "${options.outpaintAspectRatio}". Use a ratio like 16:9 or 9:16.`, {
|
|
3967
|
+
code: 'INVALID_ARGUMENT',
|
|
3968
|
+
details: { flag: '--outpaint-aspect-ratio', value: options.outpaintAspectRatio }
|
|
3969
|
+
});
|
|
3970
|
+
}
|
|
3971
|
+
if (options.videoControlNetName !== 'outpaint') {
|
|
3972
|
+
fatalCliError('--outpaint-aspect-ratio is only supported with --control-type outpaint.', {
|
|
3973
|
+
code: 'INVALID_ARGUMENT'
|
|
3774
3974
|
});
|
|
3775
3975
|
}
|
|
3776
3976
|
}
|
|
@@ -4393,6 +4593,7 @@ function getApiModeMediaReferences() {
|
|
|
4393
4593
|
for (const value of options.refVideos || []) {
|
|
4394
4594
|
if (value) refs.push({ flag: '--ref-video', value, kind: 'video' });
|
|
4395
4595
|
}
|
|
4596
|
+
if (options.refMask) refs.push({ flag: '--mask', value: options.refMask, kind: 'image' });
|
|
4396
4597
|
return refs;
|
|
4397
4598
|
}
|
|
4398
4599
|
|
|
@@ -4460,6 +4661,7 @@ function apiMediaReferenceUploadType(ref, index) {
|
|
|
4460
4661
|
if (ref.kind === 'audio') return 'referenceAudio';
|
|
4461
4662
|
if (ref.kind === 'video') return 'referenceVideo';
|
|
4462
4663
|
if (ref.flag === '--ref-end') return 'referenceImageEnd';
|
|
4664
|
+
if (ref.flag === '--mask') return `contextImage${Math.min(index + 1, 16)}`;
|
|
4463
4665
|
if (ref.flag === '-c/--context') return `contextImage${Math.min(index + 1, 16)}`;
|
|
4464
4666
|
return 'referenceImage';
|
|
4465
4667
|
}
|
|
@@ -5898,10 +6100,11 @@ async function runApiWorkflow() {
|
|
|
5898
6100
|
await streamApiWorkflowEvents(apiKey, id);
|
|
5899
6101
|
return;
|
|
5900
6102
|
}
|
|
5901
|
-
// Prefer SDK transport when opted-in. `resume`
|
|
5902
|
-
//
|
|
5903
|
-
//
|
|
5904
|
-
//
|
|
6103
|
+
// Prefer SDK transport when opted-in. `resume` exists in the SDK
|
|
6104
|
+
// (sogni-client CreativeWorkflows.resume) since 5.1.0-alpha.16 but
|
|
6105
|
+
// is not wired here yet, so resume still falls through to the
|
|
6106
|
+
// legacy fetch path. Wiring it (plus reseed, which the SDK also
|
|
6107
|
+
// ships) is tracked in the workflows MASTER plan, Phase 4.4.
|
|
5905
6108
|
let sdkPayload = null;
|
|
5906
6109
|
if (
|
|
5907
6110
|
options.apiWorkflowAction === 'get'
|
|
@@ -8588,6 +8791,7 @@ async function main() {
|
|
|
8588
8791
|
let endImageBuffer = options.refImageEnd && !useRefImageEndUrl ? await fetchMediaBuffer(options.refImageEnd) : undefined;
|
|
8589
8792
|
let audioBuffer = options.refAudio && !useRefAudioUrl ? await fetchMediaBuffer(options.refAudio) : undefined;
|
|
8590
8793
|
let videoBuffer = options.refVideo && !useRefVideoUrl ? await fetchMediaBuffer(options.refVideo) : undefined;
|
|
8794
|
+
let maskBuffer = options.refMask ? await fetchMediaBuffer(options.refMask) : undefined;
|
|
8591
8795
|
if (audioBuffer) {
|
|
8592
8796
|
audioBuffer = await prepareReferenceAudioForVideoBuffer(audioBuffer, options.refAudio);
|
|
8593
8797
|
}
|
|
@@ -8618,6 +8822,62 @@ async function main() {
|
|
|
8618
8822
|
const modelDefaults = getModelDefaults(options.model, openclawConfig);
|
|
8619
8823
|
const videoDimensionRules = videoDimensionRulesFromDefaults(modelDefaults, options.model);
|
|
8620
8824
|
|
|
8825
|
+
if (
|
|
8826
|
+
options.videoWorkflow === 'v2v' &&
|
|
8827
|
+
(options.videoControlNetName === 'outpaint' || options.videoControlNetName === 'inpaint')
|
|
8828
|
+
) {
|
|
8829
|
+
let sourceVideoDimensions = null;
|
|
8830
|
+
if (options.refVideo && !isHttpUrl(options.refVideo) && existsSync(options.refVideo)) {
|
|
8831
|
+
const probed = await probeVideoStreamInfo(options.refVideo);
|
|
8832
|
+
if (probed.width && probed.height) {
|
|
8833
|
+
sourceVideoDimensions = { width: probed.width, height: probed.height };
|
|
8834
|
+
}
|
|
8835
|
+
}
|
|
8836
|
+
|
|
8837
|
+
if (options.videoControlNetName === 'outpaint') {
|
|
8838
|
+
const outpaintDimensions = computeOutpaintCanvas(
|
|
8839
|
+
sourceVideoDimensions?.width ?? options.width,
|
|
8840
|
+
sourceVideoDimensions?.height ?? options.height,
|
|
8841
|
+
options.outpaintAspectRatio,
|
|
8842
|
+
options.outpaintPosition || 'center',
|
|
8843
|
+
videoDimensionRules
|
|
8844
|
+
);
|
|
8845
|
+
if (outpaintDimensions.width !== options.width || outpaintDimensions.height !== options.height) {
|
|
8846
|
+
if (!options.quiet) {
|
|
8847
|
+
const ratioLabel = options.outpaintAspectRatio ? ` for ${options.outpaintAspectRatio}` : '';
|
|
8848
|
+
console.error(
|
|
8849
|
+
`Adjusted outpaint canvas from ${options.width}x${options.height} ` +
|
|
8850
|
+
`to ${outpaintDimensions.width}x${outpaintDimensions.height}${ratioLabel}.`
|
|
8851
|
+
);
|
|
8852
|
+
}
|
|
8853
|
+
options.width = outpaintDimensions.width;
|
|
8854
|
+
options.height = outpaintDimensions.height;
|
|
8855
|
+
}
|
|
8856
|
+
} else if (options.videoControlNetName === 'inpaint' && sourceVideoDimensions) {
|
|
8857
|
+
const hasExplicitVideoDimensions =
|
|
8858
|
+
(cliSet.width || widthFromConfig || widthFromPrompt) &&
|
|
8859
|
+
(cliSet.height || heightFromConfig || heightFromPrompt);
|
|
8860
|
+
if (!hasExplicitVideoDimensions) {
|
|
8861
|
+
const inpaintDimensions = computeSourceAspectCanvas(
|
|
8862
|
+
sourceVideoDimensions.width,
|
|
8863
|
+
sourceVideoDimensions.height,
|
|
8864
|
+
videoDimensionRules,
|
|
8865
|
+
options.targetResolution
|
|
8866
|
+
);
|
|
8867
|
+
if (inpaintDimensions.width !== options.width || inpaintDimensions.height !== options.height) {
|
|
8868
|
+
if (!options.quiet) {
|
|
8869
|
+
console.error(
|
|
8870
|
+
`Adjusted inpaint canvas from ${options.width}x${options.height} ` +
|
|
8871
|
+
`to ${inpaintDimensions.width}x${inpaintDimensions.height} to match the source video aspect.`
|
|
8872
|
+
);
|
|
8873
|
+
}
|
|
8874
|
+
options.width = inpaintDimensions.width;
|
|
8875
|
+
options.height = inpaintDimensions.height;
|
|
8876
|
+
}
|
|
8877
|
+
}
|
|
8878
|
+
}
|
|
8879
|
+
}
|
|
8880
|
+
|
|
8621
8881
|
// Pre-resize reference images to model-compatible dimensions if needed for i2v workflow.
|
|
8622
8882
|
if (options.videoWorkflow === 'i2v' && imageBuffer && options._needsRefResize) {
|
|
8623
8883
|
const dims = getImageDimensionsFromBuffer(imageBuffer);
|
|
@@ -8685,6 +8945,12 @@ async function main() {
|
|
|
8685
8945
|
if (endImageBuffer) {
|
|
8686
8946
|
projectConfig.referenceImageEnd = endImageBuffer;
|
|
8687
8947
|
}
|
|
8948
|
+
applyLtxTransitionLora(
|
|
8949
|
+
projectConfig,
|
|
8950
|
+
options.model,
|
|
8951
|
+
Boolean(projectConfig.referenceImage),
|
|
8952
|
+
Boolean(projectConfig.referenceImageEnd)
|
|
8953
|
+
);
|
|
8688
8954
|
if (audioBuffer) {
|
|
8689
8955
|
projectConfig.referenceAudio = audioBuffer;
|
|
8690
8956
|
}
|
|
@@ -8733,14 +8999,20 @@ async function main() {
|
|
|
8733
8999
|
projectConfig.shift = modelDefaults.shift;
|
|
8734
9000
|
}
|
|
8735
9001
|
if (options.videoControlNetName && !isSeedanceModel(options.model)) {
|
|
8736
|
-
const
|
|
9002
|
+
const isInOutpaintControl = options.videoControlNetName === 'outpaint' || options.videoControlNetName === 'inpaint';
|
|
8737
9003
|
projectConfig.controlNet = {
|
|
8738
9004
|
name: options.videoControlNetName,
|
|
8739
|
-
strength:
|
|
9005
|
+
strength: isInOutpaintControl ? 1.0 : resolveVideoControlNetStrength(options.videoControlNetName, options.videoControlNetStrength)
|
|
8740
9006
|
};
|
|
8741
|
-
if (options.videoControlNetName !== 'detailer') {
|
|
9007
|
+
if (!isInOutpaintControl && options.videoControlNetName !== 'detailer') {
|
|
8742
9008
|
projectConfig.detailerStrength = 0.6;
|
|
8743
9009
|
}
|
|
9010
|
+
if (options.videoControlNetName === 'inpaint' && maskBuffer) {
|
|
9011
|
+
projectConfig.referenceMask = maskBuffer;
|
|
9012
|
+
}
|
|
9013
|
+
if (options.videoControlNetName === 'outpaint') {
|
|
9014
|
+
projectConfig.outpaintPosition = options.outpaintPosition || 'center';
|
|
9015
|
+
}
|
|
8744
9016
|
} else if (options.videoControlNetName && isSeedanceModel(options.model) && !options.quiet) {
|
|
8745
9017
|
console.error('Warning: --controlnet-name ignored for Seedance V2V models.');
|
|
8746
9018
|
}
|
package/update-check.mjs
CHANGED
|
@@ -371,12 +371,15 @@ export function snoozeUpdate({
|
|
|
371
371
|
// ---------- what's new (CHANGELOG summaries) ----------
|
|
372
372
|
|
|
373
373
|
// Parses keep-a-changelog style sections: `## [x.y.z] - date` headings.
|
|
374
|
+
// semantic-release writes minor/major entries as h1 (`# [x.y.z](compare-url)`)
|
|
375
|
+
// and patches as h2, so both heading levels are version entries; the file's
|
|
376
|
+
// `# Changelog` title never matches because a semver must follow the hash.
|
|
374
377
|
export function extractChangelogEntries(changelogText) {
|
|
375
378
|
const entries = [];
|
|
376
379
|
const lines = String(changelogText || '').split('\n');
|
|
377
380
|
let current = null;
|
|
378
381
|
for (const line of lines) {
|
|
379
|
-
const heading = line.match(
|
|
382
|
+
const heading = line.match(/^##?\s+\[?(\d+\.\d+\.\d+)\]?(.*)$/);
|
|
380
383
|
if (heading) {
|
|
381
384
|
if (current) entries.push(current);
|
|
382
385
|
current = { version: heading[1], heading: line.trim(), body: [] };
|
package/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const PACKAGE_VERSION = '3.
|
|
1
|
+
export const PACKAGE_VERSION = '3.9.0';
|