@sogni-ai/sogni-creative-agent-skill 3.11.0 → 3.11.1

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 CHANGED
@@ -1,3 +1,10 @@
1
+ ## [3.11.1](https://github.com/Sogni-AI/sogni-creative-agent-skill/compare/v3.11.0...v3.11.1) (2026-07-05)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **desktop:** fit inline image previews under the 1MB host result cap ([4666922](https://github.com/Sogni-AI/sogni-creative-agent-skill/commit/46669226a8c6fb9a70ff808ef58c387ae62a4778))
7
+
1
8
  # [3.11.0](https://github.com/Sogni-AI/sogni-creative-agent-skill/compare/v3.10.0...v3.11.0) (2026-07-05)
2
9
 
3
10
 
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.10.0"
5
+ version: "3.11.0"
6
6
  homepage: https://sogni.ai
7
7
  openclaw:
8
8
  emoji: "🎨"
@@ -14,11 +14,12 @@ A dependency-free MCP stdio server that wraps the globally installed
14
14
 
15
15
  Successful `generate_image`, `photobooth`, and frame-extraction calls attach
16
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.
17
+ Claude Desktop displays inline (up to 4 per call). Previews auto-fit the
18
+ host's 1MB tool-result limit: they share a ~700KB cumulative raw-byte budget,
19
+ and any image over the remaining budget is downscaled via a `sharp` ladder
20
+ (1024px/q80 → 768px/q70 → 512px/q60), or skipped with a note if none fits.
21
+ The text block always keeps the full-resolution URL / saved path. Set
22
+ `SOGNI_MCP_NO_INLINE_IMAGES=1` in the server env to disable.
22
23
 
23
24
  ## Build the .mcpb bundle
24
25
 
@@ -2,7 +2,7 @@
2
2
  "manifest_version": "0.3",
3
3
  "name": "sogni-creative-agent",
4
4
  "display_name": "Sogni Creative Agent",
5
- "version": "3.10.0",
5
+ "version": "3.11.0",
6
6
  "description": "Generate images, video, and music on Sogni AI's decentralized GPU network — with personas, memories, and safe video editing tools.",
7
7
  "author": { "name": "Sogni AI", "url": "https://sogni.ai" },
8
8
  "homepage": "https://sogni.ai",
@@ -4,15 +4,31 @@
4
4
  // to call this and how to compose the result. Every expected failure (bad
5
5
  // JSON, missing file, failed fetch, oversized bytes) degrades silently —
6
6
  // callers must never end up worse off than the text-only result.
7
+ //
8
+ // Size budget: Claude Desktop rejects any tool result over 1MB total ("Tool
9
+ // result is too large. Maximum size is 1MB."). Inline previews therefore share
10
+ // a cumulative raw-byte budget (INLINE_BUDGET_RAW) that leaves headroom for
11
+ // base64 expansion (~4/3) plus the text block, keeping the whole result under
12
+ // the 1MB host cap. Each image attaches as-is if it fits the remaining budget;
13
+ // otherwise it is downscaled through a deterministic sharp ladder to the first
14
+ // rung that fits. The text block always carries the full-resolution URL/path —
15
+ // the inline block is only a preview.
7
16
  import { readFile } from 'node:fs/promises';
8
17
  import { extname } from 'node:path';
9
18
 
10
19
  const INLINE_TOOLS = new Set(['generate_image', 'photobooth']);
11
20
  const FRAME_ACTIONS = new Set(['extract_first_frame', 'extract_last_frame']);
12
21
  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;
22
+ // Cumulative raw-byte budget across all inline images. ≈933KB once base64-
23
+ // encoded, which plus the text block stays safely under the 1MB host cap.
24
+ const INLINE_BUDGET_RAW = 700 * 1024;
25
+ // Deterministic downscale rungs, largest first; attach the first rung whose
26
+ // JPEG output fits the remaining budget.
27
+ const DOWNSCALE_LADDER = [
28
+ { dim: 1024, q: 80 },
29
+ { dim: 768, q: 70 },
30
+ { dim: 512, q: 60 },
31
+ ];
16
32
  const FETCH_TIMEOUT_MS = 20_000; // inline fetch must never meaningfully delay the text result
17
33
  const TOO_LARGE_NOTE = 'One image was too large to display inline; use the link above.';
18
34
 
@@ -79,18 +95,22 @@ async function obtainBytes(candidate, fetchImpl, fetchTimeoutMs) {
79
95
  return { data: Buffer.from(await res.arrayBuffer()), mime };
80
96
  }
81
97
 
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;
98
+ // Fit one image into the REMAINING cumulative budget. If the original bytes
99
+ // already fit, attach them unchanged. Otherwise downscale through the ladder
100
+ // (sharp ships with the package) and attach the first rung whose JPEG output
101
+ // fits. If no rung fits, or sharp is unavailable/throws, return null so the
102
+ // caller skips the image with a note rather than breaking the whole call.
103
+ async function fitToBudget(entry, remaining) {
104
+ if (entry.data.length <= remaining) return entry;
87
105
  try {
88
106
  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' };
107
+ for (const { dim, q } of DOWNSCALE_LADDER) {
108
+ const data = await sharp(entry.data)
109
+ .resize({ width: dim, height: dim, fit: 'inside', withoutEnlargement: true })
110
+ .jpeg({ quality: q })
111
+ .toBuffer();
112
+ if (data.length <= remaining) return { data, mime: 'image/jpeg' };
113
+ }
94
114
  return null;
95
115
  } catch {
96
116
  return null;
@@ -98,7 +118,8 @@ async function fitBytes(entry) {
98
118
  }
99
119
 
100
120
  export async function collectInlineImages({
101
- toolName, input, stdout, env = process.env, fetchImpl = fetch, fetchTimeoutMs = FETCH_TIMEOUT_MS,
121
+ toolName, input, stdout, env = process.env, fetchImpl = fetch,
122
+ fetchTimeoutMs = FETCH_TIMEOUT_MS, budgetRaw = INLINE_BUDGET_RAW,
102
123
  }) {
103
124
  const empty = { blocks: [], notes: [] };
104
125
  if (env.SOGNI_MCP_NO_INLINE_IMAGES === '1') return empty;
@@ -106,14 +127,17 @@ export async function collectInlineImages({
106
127
 
107
128
  const blocks = [];
108
129
  const notes = [];
130
+ let attachedRawTotal = 0;
109
131
  for (const candidate of sourceCandidates(toolName, input, stdout)) {
110
132
  if (blocks.length >= MAX_INLINE_IMAGES) break;
111
133
  try {
112
- const fitted = await fitBytes(await obtainBytes(candidate, fetchImpl, fetchTimeoutMs));
134
+ const remaining = budgetRaw - attachedRawTotal;
135
+ const fitted = await fitToBudget(await obtainBytes(candidate, fetchImpl, fetchTimeoutMs), remaining);
113
136
  if (!fitted) {
114
137
  if (!notes.includes(TOO_LARGE_NOTE)) notes.push(TOO_LARGE_NOTE);
115
138
  continue;
116
139
  }
140
+ attachedRawTotal += fitted.data.length;
117
141
  blocks.push({ type: 'image', data: fitted.data.toString('base64'), mimeType: fitted.mime });
118
142
  } catch {
119
143
  // Silent per-image degradation: the text block still carries the link.
@@ -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.10.0",
5
+ "version": "3.11.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.11.0",
3
+ "version": "3.11.1",
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",
package/version.mjs CHANGED
@@ -1 +1 @@
1
- export const PACKAGE_VERSION = '3.10.0';
1
+ export const PACKAGE_VERSION = '3.11.0';