@sogni-ai/sogni-creative-agent-skill 3.9.0 → 3.11.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 +29 -0
- package/README.md +18 -0
- package/SKILL.md +1 -1
- package/desktop-extension/README.md +39 -0
- package/desktop-extension/manifest.json +32 -0
- package/desktop-extension/server/index.mjs +173 -0
- package/desktop-extension/server/inline-images.mjs +123 -0
- package/desktop-extension/server/resolve.mjs +64 -0
- package/desktop-extension/server/tools.mjs +309 -0
- package/openclaw.plugin.json +1 -1
- package/package.json +3 -1
- package/sogni-agent.mjs +5 -4
- package/update-check.mjs +4 -1
- package/version.mjs +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,32 @@
|
|
|
1
|
+
# [3.11.0](https://github.com/Sogni-AI/sogni-creative-agent-skill/compare/v3.10.0...v3.11.0) (2026-07-05)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **desktop:** bound inline image fetches with a 20s abort timeout ([f20f42b](https://github.com/Sogni-AI/sogni-creative-agent-skill/commit/f20f42ba6138eeb1f1c07ed8f02a5feb79c9f1fd))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **desktop:** add inline-image collection module for MCP results ([422043f](https://github.com/Sogni-AI/sogni-creative-agent-skill/commit/422043f0cdef1bcd36f168fb95ab3e3bf6450962))
|
|
12
|
+
* **desktop:** attach inline image blocks to successful tool results ([617bd5b](https://github.com/Sogni-AI/sogni-creative-agent-skill/commit/617bd5b63f3f0437cd81df3f6b59da8a587dcf16))
|
|
13
|
+
|
|
14
|
+
# [3.10.0](https://github.com/Sogni-AI/sogni-creative-agent-skill/compare/v3.9.0...v3.10.0) (2026-07-04)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **cli:** recognize semantic-release h1 changelog entries in whats-new ([067bb65](https://github.com/Sogni-AI/sogni-creative-agent-skill/commit/067bb651e1ab924fb32d1b15585c80deeeb79d84))
|
|
20
|
+
* **desktop:** keep head of large success output, tail of errors ([394e1e1](https://github.com/Sogni-AI/sogni-creative-agent-skill/commit/394e1e131f5f75c4f01205a37286609ed7a59c99))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Features
|
|
24
|
+
|
|
25
|
+
* **desktop:** add MCP tool registry mapping tools to sogni-agent argv ([cb951a7](https://github.com/Sogni-AI/sogni-creative-agent-skill/commit/cb951a79fcc5ef859ef3135f46b8aab81945305d))
|
|
26
|
+
* **desktop:** add MCPB manifest, npm packaging, and build script ([d464627](https://github.com/Sogni-AI/sogni-creative-agent-skill/commit/d4646273bcb4c2c8cfd7d08e7b6928e218f15e6f))
|
|
27
|
+
* **desktop:** add path resolution for the Claude Desktop MCP wrapper ([8cd5832](https://github.com/Sogni-AI/sogni-creative-agent-skill/commit/8cd58323982d63a756e75264441d0dd33feb1acc))
|
|
28
|
+
* **desktop:** implement dependency-free MCP stdio server for Claude Desktop ([de26cda](https://github.com/Sogni-AI/sogni-creative-agent-skill/commit/de26cda9f433a8da62dcc24c7b2b49e6c13e892a))
|
|
29
|
+
|
|
1
30
|
# [3.9.0](https://github.com/Sogni-AI/sogni-creative-agent-skill/compare/v3.8.0...v3.9.0) (2026-06-30)
|
|
2
31
|
|
|
3
32
|
|
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. Generated images display inline in the chat automatically.
|
|
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).
|
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.10.0"
|
|
6
6
|
homepage: https://sogni.ai
|
|
7
7
|
openclaw:
|
|
8
8
|
emoji: "🎨"
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
## Inline images
|
|
14
|
+
|
|
15
|
+
Successful `generate_image`, `photobooth`, and frame-extraction calls attach
|
|
16
|
+
the rendered image(s) to the tool result as MCP image content blocks, which
|
|
17
|
+
Claude Desktop displays inline (up to 4 per call, full resolution; images
|
|
18
|
+
that would exceed the ~3.5MB content ceiling are downscaled via `sharp`, or
|
|
19
|
+
skipped with a note if that fails). The text block always keeps the hosted
|
|
20
|
+
URL / saved path. Set `SOGNI_MCP_NO_INLINE_IMAGES=1` in the server env to
|
|
21
|
+
disable.
|
|
22
|
+
|
|
23
|
+
## Build the .mcpb bundle
|
|
24
|
+
|
|
25
|
+
npm run build:mcpb # → dist/sogni-creative-agent.mcpb
|
|
26
|
+
|
|
27
|
+
## Install paths
|
|
28
|
+
|
|
29
|
+
1. `npx setup-sogni-agent-skill` writes a `claude_desktop_config.json` entry
|
|
30
|
+
pointing at this server inside the global npm package (preferred).
|
|
31
|
+
2. The packed `.mcpb` is the manual drag-and-drop alternative
|
|
32
|
+
(Claude Desktop → Settings → Extensions).
|
|
33
|
+
|
|
34
|
+
The server needs the CLI installed globally (`npm i -g @sogni-ai/sogni-creative-agent-skill`);
|
|
35
|
+
when missing, every tool returns a hint to run `npx setup-sogni-agent-skill`.
|
|
36
|
+
|
|
37
|
+
## Testing
|
|
38
|
+
|
|
39
|
+
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.10.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,173 @@
|
|
|
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
|
+
import { collectInlineImages } from './inline-images.mjs';
|
|
14
|
+
|
|
15
|
+
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
16
|
+
const PROTOCOL_FALLBACK = '2025-06-18';
|
|
17
|
+
const HARD_KILL_MS = 15 * 60 * 1000; // generation ceiling; CLI enforces its own -t timeouts sooner
|
|
18
|
+
const PROGRESS_INTERVAL_MS = 10_000;
|
|
19
|
+
const MAX_RESULT_CHARS = 20_000;
|
|
20
|
+
|
|
21
|
+
let VERSION = '0.0.0';
|
|
22
|
+
try {
|
|
23
|
+
VERSION = JSON.parse(readFileSync(join(HERE, '..', 'manifest.json'), 'utf8')).version;
|
|
24
|
+
} catch {
|
|
25
|
+
// Running outside a packaged layout (e.g. unit tests before Task 4); harmless.
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function send(msg) {
|
|
29
|
+
process.stdout.write(JSON.stringify(msg) + '\n');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function textResult(text, isError = false) {
|
|
33
|
+
return { content: [{ type: 'text', text }], isError };
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async function callTool(name, input, progressToken) {
|
|
37
|
+
const tool = getTool(name);
|
|
38
|
+
if (!tool) return textResult(`Unknown tool: ${name}`, true);
|
|
39
|
+
|
|
40
|
+
const agentPath = resolveAgentPath();
|
|
41
|
+
if (!agentPath) {
|
|
42
|
+
return textResult(
|
|
43
|
+
'The sogni-agent CLI is not installed. Open a terminal, run `npx setup-sogni-agent-skill`, then retry.',
|
|
44
|
+
true,
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
let args;
|
|
49
|
+
try {
|
|
50
|
+
args = tool.buildArgs(input ?? {});
|
|
51
|
+
} catch (err) {
|
|
52
|
+
return textResult(err.message, true);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const env = buildChildEnv({ agentPath, ffmpegPath: resolveFfmpegPath() });
|
|
56
|
+
|
|
57
|
+
return await new Promise((resolve) => {
|
|
58
|
+
const child = spawn(process.execPath, [agentPath, ...args], {
|
|
59
|
+
env,
|
|
60
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
61
|
+
});
|
|
62
|
+
let stdout = '';
|
|
63
|
+
let stderr = '';
|
|
64
|
+
child.stdout.on('data', (d) => { stdout += d; });
|
|
65
|
+
child.stderr.on('data', (d) => { stderr += d; });
|
|
66
|
+
|
|
67
|
+
const started = Date.now();
|
|
68
|
+
const ticker = progressToken == null
|
|
69
|
+
? null
|
|
70
|
+
: setInterval(() => {
|
|
71
|
+
send({
|
|
72
|
+
jsonrpc: '2.0',
|
|
73
|
+
method: 'notifications/progress',
|
|
74
|
+
params: {
|
|
75
|
+
progressToken,
|
|
76
|
+
progress: Math.round((Date.now() - started) / 1000),
|
|
77
|
+
message: `sogni-agent ${name} running…`,
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
}, PROGRESS_INTERVAL_MS);
|
|
81
|
+
const killer = setTimeout(() => child.kill('SIGKILL'), HARD_KILL_MS);
|
|
82
|
+
|
|
83
|
+
const finish = (result) => {
|
|
84
|
+
if (ticker) clearInterval(ticker);
|
|
85
|
+
clearTimeout(killer);
|
|
86
|
+
resolve(result);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
child.on('error', (err) => finish(textResult(`Failed to launch sogni-agent: ${err.message}`, true)));
|
|
90
|
+
child.on('close', async (code) => {
|
|
91
|
+
const text = [stdout.trim(), code === 0 ? '' : stderr.trim()].filter(Boolean).join('\n')
|
|
92
|
+
|| `sogni-agent exited with code ${code}`;
|
|
93
|
+
// Success output is front-loaded (e.g. result JSON) so keep the head; on
|
|
94
|
+
// failure the actionable error is at the tail, so keep the tail instead.
|
|
95
|
+
const clipped = code === 0 ? text.slice(0, MAX_RESULT_CHARS) : text.slice(-MAX_RESULT_CHARS);
|
|
96
|
+
if (code !== 0) {
|
|
97
|
+
finish(textResult(clipped, true));
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
// Inline images: best-effort. Any failure here must not degrade the
|
|
101
|
+
// text result, so the whole step is fenced.
|
|
102
|
+
let inline = { blocks: [], notes: [] };
|
|
103
|
+
try {
|
|
104
|
+
inline = await collectInlineImages({ toolName: name, input: input ?? {}, stdout });
|
|
105
|
+
} catch {
|
|
106
|
+
inline = { blocks: [], notes: [] };
|
|
107
|
+
}
|
|
108
|
+
const finalText = [clipped, ...inline.notes].join('\n');
|
|
109
|
+
finish({ content: [...inline.blocks, { type: 'text', text: finalText }], isError: false });
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
async function dispatch(msg) {
|
|
115
|
+
const { id, method, params } = msg;
|
|
116
|
+
const isRequest = id !== undefined && id !== null;
|
|
117
|
+
|
|
118
|
+
if (method === 'initialize') {
|
|
119
|
+
send({
|
|
120
|
+
jsonrpc: '2.0',
|
|
121
|
+
id,
|
|
122
|
+
result: {
|
|
123
|
+
protocolVersion: params?.protocolVersion ?? PROTOCOL_FALLBACK,
|
|
124
|
+
capabilities: { tools: {} },
|
|
125
|
+
serverInfo: { name: 'sogni-creative-agent', version: VERSION },
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if (method === 'ping') {
|
|
131
|
+
send({ jsonrpc: '2.0', id, result: {} });
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
if (method === 'tools/list') {
|
|
135
|
+
send({
|
|
136
|
+
jsonrpc: '2.0',
|
|
137
|
+
id,
|
|
138
|
+
result: {
|
|
139
|
+
tools: TOOLS.map(({ name, description, inputSchema }) => ({ name, description, inputSchema })),
|
|
140
|
+
},
|
|
141
|
+
});
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
if (method === 'tools/call') {
|
|
145
|
+
const result = await callTool(params?.name, params?.arguments, params?._meta?.progressToken);
|
|
146
|
+
send({ jsonrpc: '2.0', id, result });
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
if (!isRequest || method?.startsWith('notifications/')) {
|
|
150
|
+
return; // notifications need no response
|
|
151
|
+
}
|
|
152
|
+
send({ jsonrpc: '2.0', id, error: { code: -32601, message: `Method not found: ${method}` } });
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const rl = createInterface({ input: process.stdin, terminal: false });
|
|
156
|
+
rl.on('line', (line) => {
|
|
157
|
+
if (!line.trim()) return;
|
|
158
|
+
let msg;
|
|
159
|
+
try {
|
|
160
|
+
msg = JSON.parse(line);
|
|
161
|
+
} catch {
|
|
162
|
+
send({ jsonrpc: '2.0', id: null, error: { code: -32700, message: 'Parse error' } });
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
dispatch(msg).catch((err) => {
|
|
166
|
+
if (msg.id !== undefined && msg.id !== null) {
|
|
167
|
+
send({ jsonrpc: '2.0', id: msg.id, error: { code: -32603, message: err.message } });
|
|
168
|
+
} else {
|
|
169
|
+
process.stderr.write(`sogni desktop server error: ${err.stack}\n`);
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
rl.on('close', () => process.exit(0));
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
// desktop-extension/server/inline-images.mjs
|
|
2
|
+
// Turns a successful CLI run into MCP image content blocks so Claude Desktop
|
|
3
|
+
// renders results inline. Pure of protocol concerns: index.mjs decides when
|
|
4
|
+
// to call this and how to compose the result. Every expected failure (bad
|
|
5
|
+
// JSON, missing file, failed fetch, oversized bytes) degrades silently —
|
|
6
|
+
// callers must never end up worse off than the text-only result.
|
|
7
|
+
import { readFile } from 'node:fs/promises';
|
|
8
|
+
import { extname } from 'node:path';
|
|
9
|
+
|
|
10
|
+
const INLINE_TOOLS = new Set(['generate_image', 'photobooth']);
|
|
11
|
+
const FRAME_ACTIONS = new Set(['extract_first_frame', 'extract_last_frame']);
|
|
12
|
+
const MAX_INLINE_IMAGES = 4;
|
|
13
|
+
const MAX_RAW_BYTES = 3.5 * 1024 * 1024; // ≈5MB once base64-encoded — the practical content ceiling
|
|
14
|
+
const DOWNSCALE_MAX_DIM = 2048;
|
|
15
|
+
const DOWNSCALE_JPEG_QUALITY = 85;
|
|
16
|
+
const FETCH_TIMEOUT_MS = 20_000; // inline fetch must never meaningfully delay the text result
|
|
17
|
+
const TOO_LARGE_NOTE = 'One image was too large to display inline; use the link above.';
|
|
18
|
+
|
|
19
|
+
const MIME_BY_EXT = {
|
|
20
|
+
'.png': 'image/png',
|
|
21
|
+
'.jpg': 'image/jpeg',
|
|
22
|
+
'.jpeg': 'image/jpeg',
|
|
23
|
+
'.webp': 'image/webp',
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
function mimeFromPath(p) {
|
|
27
|
+
return MIME_BY_EXT[extname(String(p).split('?')[0]).toLowerCase()] ?? null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function isInlineScoped(toolName, input) {
|
|
31
|
+
if (INLINE_TOOLS.has(toolName)) return true;
|
|
32
|
+
return toolName === 'edit_video' && FRAME_ACTIONS.has(input?.action);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// The CLI's --json output is a single JSON document, but be tolerant of any
|
|
36
|
+
// stray wrapper lines: fall back to the outermost {...} span.
|
|
37
|
+
function parseDescriptor(stdout) {
|
|
38
|
+
const raw = String(stdout ?? '').trim();
|
|
39
|
+
for (const candidate of [raw, raw.slice(raw.indexOf('{'), raw.lastIndexOf('}') + 1)]) {
|
|
40
|
+
if (!candidate) continue;
|
|
41
|
+
try {
|
|
42
|
+
const parsed = JSON.parse(candidate);
|
|
43
|
+
if (parsed && typeof parsed === 'object') return parsed;
|
|
44
|
+
} catch {
|
|
45
|
+
// try next candidate
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function sourceCandidates(toolName, input, stdout) {
|
|
52
|
+
if (toolName === 'edit_video') {
|
|
53
|
+
// Frame extractions write straight to the caller-provided output path and
|
|
54
|
+
// emit no --json descriptor.
|
|
55
|
+
return input?.output ? [{ kind: 'file', ref: String(input.output) }] : [];
|
|
56
|
+
}
|
|
57
|
+
const desc = parseDescriptor(stdout);
|
|
58
|
+
if (!desc) return [];
|
|
59
|
+
if (desc.localPath) return [{ kind: 'file', ref: String(desc.localPath) }];
|
|
60
|
+
if (Array.isArray(desc.urls)) {
|
|
61
|
+
return desc.urls
|
|
62
|
+
.filter((u) => typeof u === 'string' && /^https?:\/\//.test(u))
|
|
63
|
+
.slice(0, MAX_INLINE_IMAGES)
|
|
64
|
+
.map((u) => ({ kind: 'url', ref: u }));
|
|
65
|
+
}
|
|
66
|
+
return [];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
async function obtainBytes(candidate, fetchImpl, fetchTimeoutMs) {
|
|
70
|
+
if (candidate.kind === 'file') {
|
|
71
|
+
return { data: await readFile(candidate.ref), mime: mimeFromPath(candidate.ref) ?? 'image/png' };
|
|
72
|
+
}
|
|
73
|
+
// AbortSignal.timeout bounds headers AND body for undici fetch; an abort
|
|
74
|
+
// rejects the await, which the caller's per-image try/catch degrades silently.
|
|
75
|
+
const res = await fetchImpl(candidate.ref, { signal: AbortSignal.timeout(fetchTimeoutMs) });
|
|
76
|
+
if (!res.ok) throw new Error(`fetch failed: ${res.status}`);
|
|
77
|
+
const headerMime = (res.headers.get('content-type') ?? '').split(';')[0].trim();
|
|
78
|
+
const mime = headerMime.startsWith('image/') ? headerMime : (mimeFromPath(candidate.ref) ?? 'image/png');
|
|
79
|
+
return { data: Buffer.from(await res.arrayBuffer()), mime };
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Full-resolution by default; only an image that would blow the content
|
|
83
|
+
// ceiling gets downscaled (sharp ships with the package), and if that is
|
|
84
|
+
// impossible the image is skipped with a note rather than breaking the call.
|
|
85
|
+
async function fitBytes(entry) {
|
|
86
|
+
if (entry.data.length <= MAX_RAW_BYTES) return entry;
|
|
87
|
+
try {
|
|
88
|
+
const { default: sharp } = await import('sharp');
|
|
89
|
+
const data = await sharp(entry.data)
|
|
90
|
+
.resize({ width: DOWNSCALE_MAX_DIM, height: DOWNSCALE_MAX_DIM, fit: 'inside', withoutEnlargement: true })
|
|
91
|
+
.jpeg({ quality: DOWNSCALE_JPEG_QUALITY })
|
|
92
|
+
.toBuffer();
|
|
93
|
+
if (data.length <= MAX_RAW_BYTES) return { data, mime: 'image/jpeg' };
|
|
94
|
+
return null;
|
|
95
|
+
} catch {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export async function collectInlineImages({
|
|
101
|
+
toolName, input, stdout, env = process.env, fetchImpl = fetch, fetchTimeoutMs = FETCH_TIMEOUT_MS,
|
|
102
|
+
}) {
|
|
103
|
+
const empty = { blocks: [], notes: [] };
|
|
104
|
+
if (env.SOGNI_MCP_NO_INLINE_IMAGES === '1') return empty;
|
|
105
|
+
if (!isInlineScoped(toolName, input)) return empty;
|
|
106
|
+
|
|
107
|
+
const blocks = [];
|
|
108
|
+
const notes = [];
|
|
109
|
+
for (const candidate of sourceCandidates(toolName, input, stdout)) {
|
|
110
|
+
if (blocks.length >= MAX_INLINE_IMAGES) break;
|
|
111
|
+
try {
|
|
112
|
+
const fitted = await fitBytes(await obtainBytes(candidate, fetchImpl, fetchTimeoutMs));
|
|
113
|
+
if (!fitted) {
|
|
114
|
+
if (!notes.includes(TOO_LARGE_NOTE)) notes.push(TOO_LARGE_NOTE);
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
blocks.push({ type: 'image', data: fitted.data.toString('base64'), mimeType: fitted.mime });
|
|
118
|
+
} catch {
|
|
119
|
+
// Silent per-image degradation: the text block still carries the link.
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return { blocks, notes };
|
|
123
|
+
}
|
|
@@ -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,309 @@
|
|
|
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
|
+
'Image results are attached inline in the tool result.',
|
|
31
|
+
inputSchema: {
|
|
32
|
+
type: 'object',
|
|
33
|
+
properties: {
|
|
34
|
+
prompt: str('What to generate'),
|
|
35
|
+
output_path: str('Absolute file path to save the image (optional)'),
|
|
36
|
+
quality: { type: 'string', enum: ['fast', 'hq', 'pro'], description: 'Quality preset' },
|
|
37
|
+
model: str('Model id (optional; overrides quality preset)'),
|
|
38
|
+
width: num('Width in px (default 512)'),
|
|
39
|
+
height: num('Height in px (default 512)'),
|
|
40
|
+
count: num('Number of images (default 1)'),
|
|
41
|
+
seed: num('Fixed seed for reproducibility'),
|
|
42
|
+
context_images: { type: 'array', items: { type: 'string' }, description: 'Absolute paths of context/edit images' },
|
|
43
|
+
persona: str('Saved persona name to use as reference'),
|
|
44
|
+
timeout_seconds: num('Generation timeout override'),
|
|
45
|
+
},
|
|
46
|
+
required: ['prompt'],
|
|
47
|
+
},
|
|
48
|
+
buildArgs(input) {
|
|
49
|
+
const prompt = required(input, 'prompt');
|
|
50
|
+
const args = [...GEN_BASE];
|
|
51
|
+
push(args, '-o', input.output_path);
|
|
52
|
+
push(args, '-Q', input.quality);
|
|
53
|
+
push(args, '-m', input.model);
|
|
54
|
+
push(args, '-w', input.width);
|
|
55
|
+
push(args, '-h', input.height);
|
|
56
|
+
push(args, '-n', input.count);
|
|
57
|
+
push(args, '-s', input.seed);
|
|
58
|
+
for (const c of input.context_images ?? []) push(args, '-c', c);
|
|
59
|
+
push(args, '--persona', input.persona);
|
|
60
|
+
push(args, '-t', input.timeout_seconds);
|
|
61
|
+
args.push(prompt);
|
|
62
|
+
return args;
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: 'generate_video',
|
|
67
|
+
description:
|
|
68
|
+
'Generate a video from a text prompt, optionally driven by reference media. ' +
|
|
69
|
+
'ref = start frame image, ref_end = end frame, ref_audio = soundtrack/lip-sync audio, ref_video = motion reference. ' +
|
|
70
|
+
'Rendering takes minutes; prefer output_path (absolute .mp4).',
|
|
71
|
+
inputSchema: {
|
|
72
|
+
type: 'object',
|
|
73
|
+
properties: {
|
|
74
|
+
prompt: str('Motion/scene description'),
|
|
75
|
+
output_path: str('Absolute .mp4 path to save (optional)'),
|
|
76
|
+
model: str('Video model id (optional)'),
|
|
77
|
+
workflow: { type: 'string', enum: ['t2v', 'i2v', 's2v', 'ia2v', 'a2v', 'v2v', 'animate-move', 'animate-replace'] },
|
|
78
|
+
duration: num('Duration in seconds (default 5)'),
|
|
79
|
+
ref: str('Absolute path or URL of the start-frame image'),
|
|
80
|
+
ref_end: str('Absolute path or URL of the end-frame image'),
|
|
81
|
+
ref_audio: str('Absolute path or URL of reference audio'),
|
|
82
|
+
ref_video: str('Absolute path or URL of reference video'),
|
|
83
|
+
persona: str('Saved persona name (reference frame)'),
|
|
84
|
+
target_resolution: num('Short-side target in px, preserves aspect'),
|
|
85
|
+
timeout_seconds: num('Generation timeout override (default 300)'),
|
|
86
|
+
},
|
|
87
|
+
required: ['prompt'],
|
|
88
|
+
},
|
|
89
|
+
buildArgs(input) {
|
|
90
|
+
const prompt = required(input, 'prompt');
|
|
91
|
+
const args = [...GEN_BASE, '--video'];
|
|
92
|
+
push(args, '-o', input.output_path);
|
|
93
|
+
push(args, '-m', input.model);
|
|
94
|
+
push(args, '--workflow', input.workflow);
|
|
95
|
+
push(args, '--duration', input.duration);
|
|
96
|
+
push(args, '--ref', input.ref);
|
|
97
|
+
push(args, '--ref-end', input.ref_end);
|
|
98
|
+
push(args, '--ref-audio', input.ref_audio);
|
|
99
|
+
push(args, '--ref-video', input.ref_video);
|
|
100
|
+
push(args, '--persona', input.persona);
|
|
101
|
+
push(args, '--target-resolution', input.target_resolution);
|
|
102
|
+
push(args, '-t', input.timeout_seconds);
|
|
103
|
+
args.push(prompt);
|
|
104
|
+
return args;
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: 'generate_music',
|
|
109
|
+
description:
|
|
110
|
+
'Generate music/audio from a text prompt. Omit lyrics for an instrumental. ' +
|
|
111
|
+
'Duration 10-600 seconds. Prefer output_path (absolute .mp3/.wav/.flac).',
|
|
112
|
+
inputSchema: {
|
|
113
|
+
type: 'object',
|
|
114
|
+
properties: {
|
|
115
|
+
prompt: str('Style/mood description'),
|
|
116
|
+
output_path: str('Absolute audio file path to save (optional)'),
|
|
117
|
+
lyrics: str('Song lyrics (optional)'),
|
|
118
|
+
duration: num('Seconds, 10-600 (default 30)'),
|
|
119
|
+
bpm: num('Beats per minute (30-300)'),
|
|
120
|
+
keyscale: str('Key/scale, e.g. "C major"'),
|
|
121
|
+
music_model: str('turbo | sft | ace_step_1.5_turbo | ace_step_1.5_sft'),
|
|
122
|
+
audio_format: { type: 'string', enum: ['mp3', 'flac', 'wav'] },
|
|
123
|
+
timeout_seconds: num('Generation timeout override (default 600)'),
|
|
124
|
+
},
|
|
125
|
+
required: ['prompt'],
|
|
126
|
+
},
|
|
127
|
+
buildArgs(input) {
|
|
128
|
+
const prompt = required(input, 'prompt');
|
|
129
|
+
const args = [...GEN_BASE, '--music'];
|
|
130
|
+
push(args, '-o', input.output_path);
|
|
131
|
+
push(args, '--music-model', input.music_model);
|
|
132
|
+
push(args, '--lyrics', input.lyrics);
|
|
133
|
+
push(args, '--duration', input.duration);
|
|
134
|
+
push(args, '--bpm', input.bpm);
|
|
135
|
+
push(args, '--keyscale', input.keyscale);
|
|
136
|
+
push(args, '--output-format', input.audio_format);
|
|
137
|
+
push(args, '-t', input.timeout_seconds);
|
|
138
|
+
args.push(prompt);
|
|
139
|
+
return args;
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
name: 'photobooth',
|
|
144
|
+
description:
|
|
145
|
+
'Face-transfer portrait generation: renders the person in the ref photo into a new scene ' +
|
|
146
|
+
'(e.g. "LinkedIn professional headshot", "80s fashion portrait"). ' +
|
|
147
|
+
'Image results are attached inline in the tool result.',
|
|
148
|
+
inputSchema: {
|
|
149
|
+
type: 'object',
|
|
150
|
+
properties: {
|
|
151
|
+
prompt: str('Scene/style description'),
|
|
152
|
+
ref: str('Absolute path or URL of the face photo'),
|
|
153
|
+
output_path: str('Absolute image path to save (optional)'),
|
|
154
|
+
count: num('Number of variations (default 1)'),
|
|
155
|
+
},
|
|
156
|
+
required: ['prompt', 'ref'],
|
|
157
|
+
},
|
|
158
|
+
buildArgs(input) {
|
|
159
|
+
const prompt = required(input, 'prompt');
|
|
160
|
+
const ref = required(input, 'ref', 'a face photo path or URL');
|
|
161
|
+
const args = [...GEN_BASE, '--photobooth', '--ref', String(ref)];
|
|
162
|
+
push(args, '-n', input.count);
|
|
163
|
+
push(args, '-o', input.output_path);
|
|
164
|
+
args.push(prompt);
|
|
165
|
+
return args;
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
name: 'edit_video',
|
|
170
|
+
description:
|
|
171
|
+
'Safe local video utilities (ffmpeg wrappers): extract the first/last frame, ' +
|
|
172
|
+
'concatenate clips (with optional soundtrack), or remix the audio of an existing video. ' +
|
|
173
|
+
'Extracted frames are attached inline in the tool result.',
|
|
174
|
+
inputSchema: {
|
|
175
|
+
type: 'object',
|
|
176
|
+
properties: {
|
|
177
|
+
action: { type: 'string', enum: ['extract_first_frame', 'extract_last_frame', 'concat_videos', 'remix_audio'] },
|
|
178
|
+
input: str('Input video path (extract/remix actions)'),
|
|
179
|
+
output: str('Output file path'),
|
|
180
|
+
clips: { type: 'array', items: { type: 'string' }, description: 'Clip paths for concat_videos (min 2)' },
|
|
181
|
+
audio_path: str('Soundtrack to mux over concat_videos output'),
|
|
182
|
+
bed_audio: str('Audio bed for remix_audio'),
|
|
183
|
+
audio_loop: { type: 'boolean', description: 'Loop the bed to cover the video (remix_audio)' },
|
|
184
|
+
},
|
|
185
|
+
required: ['action', 'output'],
|
|
186
|
+
},
|
|
187
|
+
buildArgs(input) {
|
|
188
|
+
const action = required(input, 'action');
|
|
189
|
+
if (action === 'extract_first_frame' || action === 'extract_last_frame') {
|
|
190
|
+
const src = required(input, 'input', 'the source video');
|
|
191
|
+
const output = required(input, 'output');
|
|
192
|
+
return ['--no-update-check', `--${action.replaceAll('_', '-')}`, String(src), String(output)];
|
|
193
|
+
}
|
|
194
|
+
if (action === 'concat_videos') {
|
|
195
|
+
const output = required(input, 'output');
|
|
196
|
+
const clips = input.clips ?? [];
|
|
197
|
+
if (clips.length < 2) throw new Error('concat_videos needs at least two clips.');
|
|
198
|
+
const args = ['--no-update-check', '--concat-videos', String(output), ...clips.map(String)];
|
|
199
|
+
push(args, '--concat-audio', input.audio_path);
|
|
200
|
+
return args;
|
|
201
|
+
}
|
|
202
|
+
if (action === 'remix_audio') {
|
|
203
|
+
const src = required(input, 'input', 'the source video');
|
|
204
|
+
const output = required(input, 'output');
|
|
205
|
+
const args = ['--no-update-check', '--remix-audio', String(src), String(output)];
|
|
206
|
+
push(args, '--bed-audio', input.bed_audio);
|
|
207
|
+
if (input.audio_loop) args.push('--audio-loop');
|
|
208
|
+
return args;
|
|
209
|
+
}
|
|
210
|
+
throw new Error(`Unknown action "${action}".`);
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
name: 'list_media',
|
|
215
|
+
description: 'List recent inbound media files the user sent to Sogni (images, audio, or all).',
|
|
216
|
+
inputSchema: {
|
|
217
|
+
type: 'object',
|
|
218
|
+
properties: { type: { type: 'string', enum: ['images', 'audio', 'all'] } },
|
|
219
|
+
},
|
|
220
|
+
buildArgs(input) {
|
|
221
|
+
return ['--json', '--no-update-check', '--list-media', input.type ?? 'images'];
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
name: 'manage_personas',
|
|
226
|
+
description:
|
|
227
|
+
'Manage saved personas (named people with reference photos and optional voice clips). ' +
|
|
228
|
+
'Actions: list, add (needs name + ref photo), remove, resolve (show details).',
|
|
229
|
+
inputSchema: {
|
|
230
|
+
type: 'object',
|
|
231
|
+
properties: {
|
|
232
|
+
action: { type: 'string', enum: ['list', 'add', 'remove', 'resolve'] },
|
|
233
|
+
name: str('Persona name (add/remove/resolve)'),
|
|
234
|
+
ref: str('Reference photo path or URL (add)'),
|
|
235
|
+
relationship: { type: 'string', enum: ['self', 'partner', 'child', 'friend', 'pet'] },
|
|
236
|
+
description: str('Appearance description (add)'),
|
|
237
|
+
voice_clip: str('Voice clip audio path (add)'),
|
|
238
|
+
},
|
|
239
|
+
required: ['action'],
|
|
240
|
+
},
|
|
241
|
+
buildArgs(input) {
|
|
242
|
+
const action = required(input, 'action');
|
|
243
|
+
if (action === 'list') return ['--json', '--no-update-check', '--persona-list'];
|
|
244
|
+
const name = required(input, 'name');
|
|
245
|
+
if (action === 'remove') return ['--no-update-check', '--persona-remove', String(name)];
|
|
246
|
+
if (action === 'resolve') return ['--json', '--no-update-check', '--persona-resolve', String(name)];
|
|
247
|
+
if (action === 'add') {
|
|
248
|
+
const ref = required(input, 'ref', 'a reference photo for the persona');
|
|
249
|
+
const args = ['--no-update-check', '--persona-add', String(name), '--ref', String(ref)];
|
|
250
|
+
push(args, '--relationship', input.relationship);
|
|
251
|
+
push(args, '--description', input.description);
|
|
252
|
+
push(args, '--voice-clip', input.voice_clip);
|
|
253
|
+
return args;
|
|
254
|
+
}
|
|
255
|
+
throw new Error(`Unknown action "${action}".`);
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
name: 'manage_memories',
|
|
260
|
+
description:
|
|
261
|
+
'Manage persistent user preferences (e.g. preferred_style). Actions: list, get, set, remove.',
|
|
262
|
+
inputSchema: {
|
|
263
|
+
type: 'object',
|
|
264
|
+
properties: {
|
|
265
|
+
action: { type: 'string', enum: ['list', 'get', 'set', 'remove'] },
|
|
266
|
+
key: str('Memory key (get/set/remove)'),
|
|
267
|
+
value: str('Memory value (set)'),
|
|
268
|
+
category: { type: 'string', enum: ['preference', 'fact', 'context'] },
|
|
269
|
+
},
|
|
270
|
+
required: ['action'],
|
|
271
|
+
},
|
|
272
|
+
buildArgs(input) {
|
|
273
|
+
const action = required(input, 'action');
|
|
274
|
+
if (action === 'list') return ['--json', '--no-update-check', '--memory-list'];
|
|
275
|
+
const key = required(input, 'key');
|
|
276
|
+
if (action === 'get') return ['--json', '--no-update-check', '--memory-get', String(key)];
|
|
277
|
+
if (action === 'remove') return ['--no-update-check', '--memory-remove', String(key)];
|
|
278
|
+
if (action === 'set') {
|
|
279
|
+
const value = required(input, 'value');
|
|
280
|
+
const args = ['--no-update-check', '--memory-set', String(key), String(value)];
|
|
281
|
+
push(args, '--memory-category', input.category);
|
|
282
|
+
return args;
|
|
283
|
+
}
|
|
284
|
+
throw new Error(`Unknown action "${action}".`);
|
|
285
|
+
},
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
name: 'sogni_doctor',
|
|
289
|
+
description:
|
|
290
|
+
'Health check for the Sogni install: Node, credentials, ffmpeg, live auth, version. ' +
|
|
291
|
+
'Run only after another tool fails — not as a routine preflight.',
|
|
292
|
+
inputSchema: { type: 'object', properties: {} },
|
|
293
|
+
buildArgs() {
|
|
294
|
+
return ['--doctor', '--json', '--no-update-check'];
|
|
295
|
+
},
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
name: 'account_balance',
|
|
299
|
+
description: 'Show the SPARK/SOGNI token balances for the configured Sogni account.',
|
|
300
|
+
inputSchema: { type: 'object', properties: {} },
|
|
301
|
+
buildArgs() {
|
|
302
|
+
return ['--balances', '--json', '--no-update-check'];
|
|
303
|
+
},
|
|
304
|
+
},
|
|
305
|
+
];
|
|
306
|
+
|
|
307
|
+
export function getTool(name) {
|
|
308
|
+
return TOOLS.find((t) => t.name === name);
|
|
309
|
+
}
|
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.10.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.11.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",
|
package/sogni-agent.mjs
CHANGED
|
@@ -6100,10 +6100,11 @@ async function runApiWorkflow() {
|
|
|
6100
6100
|
await streamApiWorkflowEvents(apiKey, id);
|
|
6101
6101
|
return;
|
|
6102
6102
|
}
|
|
6103
|
-
// Prefer SDK transport when opted-in. `resume`
|
|
6104
|
-
//
|
|
6105
|
-
//
|
|
6106
|
-
//
|
|
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.
|
|
6107
6108
|
let sdkPayload = null;
|
|
6108
6109
|
if (
|
|
6109
6110
|
options.apiWorkflowAction === 'get'
|
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.10.0';
|