@sogni-ai/sogni-creative-agent-skill 3.6.0 → 3.6.2

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
@@ -5,6 +5,45 @@ All notable changes to this project are documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [3.6.2] - 2026-06-22
9
+
10
+ ### Fixed
11
+
12
+ - **`sogni-agent self-update` now gives clearer recovery guidance after failed global package updates.** When the
13
+ package manager exits nonzero, the CLI reports the failing exit code and prints platform-specific permission
14
+ guidance (for example, `sudo sogni-agent self-update` on macOS/Linux or an Administrator terminal on Windows)
15
+ instead of leaving users with only raw npm output.
16
+ - **Codex and Hermes setup docs now mention the target app must be started once before targeted installer runs.**
17
+ `README.md` and `llm.txt` now match the setup installer preflight: `--only=codex` and `--only=hermes` exit
18
+ before installing anything if `~/.codex/` or `~/.hermes/` has not been created yet.
19
+ - **Claude plugin setup guidance no longer tells agents to create a duplicate personal Claude skill.** The
20
+ plugin-bundled skill now installs only the global CLI, tells agents not to run the default setup installer from
21
+ inside the plugin, and clarifies that setup cleanup does not uninstall the Claude Code plugin itself.
22
+
23
+ ## [3.6.1] - 2026-06-15
24
+
25
+ ### Changed
26
+
27
+ - **Hosted-API guidance now recommends client-side planning over hosted re-planning.** The skill is driven by a
28
+ frontier LLM that out-plans Sogni's hosted planning model, so steering it to delegate planning through
29
+ `--api-chat` was a downgrade. `SKILL.md`, `references/hosted-api.md`, and `README.md` now tell the calling agent
30
+ to plan and select tools itself, use `--api-workflow` with an explicit `--workflow-input` step graph for durable
31
+ multi-step work (the server executes the authored plan without re-planning), and reserve `--api-chat` /
32
+ `--durable-chat` for deliberately offloading a long server-side loop or uploading several local files in one
33
+ turn. `--api-chat` and all hosted modes remain fully supported — only the recommended default changed.
34
+
35
+ ### Fixed
36
+
37
+ - **Local Seedance reference images via `-c`/`--context` now auto-upload in direct CLI mode.** Local
38
+ loose-reference images were rejected with an HTTPS-only error that pushed users onto the unreliable
39
+ `--api-chat` / `--durable-chat` path; local `--ref-audio` and `--ref-video` already auto-uploaded through the
40
+ `/v2` presigned-POST flow, so images were the only modality missing it and one broken branch cascaded into
41
+ downstream failures (vision 1024px cap, HTTP timeout, no-content, missing durable SDK package). Local
42
+ `-c`/`--context` images now upload through the same `/v2/image` presigned flow and forward as Sogni-hosted URLs.
43
+ MIME type is resolved by magic-byte sniffing (falling back to extension), and the accepted set
44
+ (PNG/JPEG/WebP/GIF) mirrors the backend's `allowedContentTypes`. Adds local-PNG-upload and mislabeled-WebP
45
+ byte-sniff regression tests; verified end-to-end with a real Seedance 2.0 render from a local `-c` PNG.
46
+
8
47
  ## [3.6.0] - 2026-06-12
9
48
 
10
49
  ### Added
package/README.md CHANGED
@@ -82,8 +82,9 @@ With this skill, an agent can:
82
82
 
83
83
  This auto-detects Claude Code, OpenAI Codex CLI, and Hermes Agent; installs the
84
84
  CLI globally; registers the skill into each detected runtime; prompts for your
85
- API key; and prints ChatGPT Custom-GPT setup instructions. (It does **not**
86
- configure OpenClaw — see the [OpenClaw plugin](#openclaw-plugin) section.)
85
+ API key; and tells you how to request ChatGPT Custom-GPT setup instructions.
86
+ (It does **not** configure OpenClaw — see the [OpenClaw plugin](#openclaw-plugin)
87
+ section.)
87
88
 
88
89
  Prefer to do it manually? Install the CLI directly:
89
90
 
@@ -151,10 +152,11 @@ The first command registers a `sogni` marketplace with one plugin entry (`sogni-
151
152
  The `npx` installer writes the skill to `~/.codex/skills/sogni-creative-agent-skill/`, which the Codex CLI discovers automatically:
152
153
 
153
154
  ```bash
154
- npm install -g @sogni-ai/sogni-creative-agent-skill@latest
155
155
  npx setup-sogni-agent-skill --only=codex
156
156
  ```
157
157
 
158
+ Start Codex once before running the installer so `~/.codex/` exists. If the selected local runtime is not detected, setup exits before installing anything.
159
+
158
160
  Restart Codex (or start a new session) and ask it to "generate an image of a sunset" — the skill shells out to the globally installed `sogni-agent`. To remove it later: `npx setup-sogni-agent-skill --uninstall --only=codex`.
159
161
 
160
162
  ### Hermes Agent
@@ -162,10 +164,11 @@ Restart Codex (or start a new session) and ask it to "generate an image of a sun
162
164
  [Hermes Agent](https://hermes-agent.nousresearch.com/) loads skills from `~/.hermes/skills/<category>/<name>/SKILL.md`. The `npx` installer places this skill at `~/.hermes/skills/media/sogni-creative-agent-skill/`:
163
165
 
164
166
  ```bash
165
- npm install -g @sogni-ai/sogni-creative-agent-skill@latest
166
167
  npx setup-sogni-agent-skill --only=hermes
167
168
  ```
168
169
 
170
+ Start Hermes once before running the installer so `~/.hermes/` exists. If the selected local runtime is not detected, setup exits before installing anything.
171
+
169
172
  Then `/reset` your Hermes session so it picks up the new skill. (You can also install manually: copy [`SKILL.md`](./SKILL.md) into `~/.hermes/skills/media/sogni-creative-agent-skill/SKILL.md`, or use `hermes skills install` if your build supports it.)
170
173
 
171
174
  ### OpenClaw plugin
@@ -216,7 +219,7 @@ When loaded through OpenClaw, this skill reads plugin defaults from OpenClaw con
216
219
 
217
220
  ### ChatGPT (Custom GPT)
218
221
 
219
- Running `npx setup-sogni-agent-skill` also prints step-by-step instructions for creating a ChatGPT Custom GPT whose Instructions embed this skill. Note that ChatGPT cannot run the local CLI; the Custom GPT path covers prompt-side behavior only.
222
+ Run `npx setup-sogni-agent-skill --only=chatgpt` to print step-by-step instructions for creating a ChatGPT Custom GPT whose Instructions embed this skill. Note that ChatGPT cannot run the local CLI; the Custom GPT path covers prompt-side behavior only.
220
223
 
221
224
  ### Manus / other SKILL.md frameworks
222
225
 
@@ -600,7 +603,9 @@ Stored at `~/.config/sogni/personality.txt`.
600
603
 
601
604
  Hosted API modes require `SOGNI_API_KEY`.
602
605
 
603
- - **`--api-chat`** targets `/v1/chat/completions` with Sogni creative-agent tools — best for text-first natural-language workflows. The CLI sanitizes prompt-injection markers before forwarding messages and can use the current server-side creative-agent media tools, including video extension, segment replacement, overlays, subtitles, stitch/orbit/dance composition, and generated artifact indexing. Tune with `--api-tools creative-agent|creative-tools|none`, `--no-api-tool-execution`, `--llm-model`, and `--system`.
606
+ **Choosing a mode.** Whatever is driving this CLI is usually a more capable planner than Sogni's hosted model, so prefer to plan yourself and let the server execute: direct-to-SDK flags for one-shot work, and `--api-workflow` with an explicit `--workflow-input` step graph for multi-step/durable work (you author the plan; the server runs it durably with replay — no hosted re-planning). Use `--api-chat` / `--durable-chat` when you deliberately want the hosted model to own a long server-side loop, or when several local files must be uploaded for one turn.
607
+
608
+ - **`--api-chat`** targets `/v1/chat/completions` with Sogni creative-agent tools and **delegates planning/tool-selection to the hosted model** — reach for it when the caller is a thin client, when you want the hosted model to drive a long server-side tool loop, or when several local files must be uploaded for one turn. The CLI sanitizes prompt-injection markers before forwarding messages and can use the current server-side creative-agent media tools, including video extension, segment replacement, overlays, subtitles, stitch/orbit/dance composition, and generated artifact indexing. Tune with `--api-tools creative-agent|creative-tools|none`, `--no-api-tool-execution`, `--llm-model`, and `--system`.
604
609
  - **Sogni Intelligence controls** include `--task-profile general|coding|reasoning`, `--max-tokens`, and `--thinking` / `--no-thinking`, which forward to `/v1/chat/completions` as `task_profile`, `max_tokens`, and `chat_template_kwargs.enable_thinking`. Use `--list-api-models` or `--get-api-model <id>` to inspect `/v1/models`.
605
610
  - **`--durable-chat`** starts a hosted `/v1/chat/runs` record through the SDK transport. Set `SOGNI_SKILL_USE_SDK_TRANSPORT=1` before using it. The CLI streams assistant deltas and de-duplicated per-job progress / ETA / result lines from hosted run events.
606
611
  - **`--api-workflow`** targets `/v1/creative-agent/workflows` for durable, async workflow records with event streaming and cancellation. Requests carry `input.steps` plus snake_case controls such as `token_type`, `media_references`, `max_estimated_capacity_units`, and `confirm_cost`.
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/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.6.0"
5
+ version: "3.6.2"
6
6
  homepage: https://sogni.ai
7
7
  openclaw:
8
8
  emoji: "🎨"
@@ -98,28 +98,31 @@ sogni-agent -o /tmp/cat.png "a cat wearing a hat" # ✗ avoid — user can't
98
98
  - Media listing for `--list-media` (read): `~/.openclaw/media/inbound`, falling back to the legacy `~/.clawdbot/media/inbound` when only it exists (`SOGNI_MEDIA_INBOUND_DIR`)
99
99
  - Custom ffmpeg binary: `FFMPEG_PATH`
100
100
 
101
- ## Recommended path: hosted Sogni Intelligence endpoints
101
+ ## Recommended path: you plan, Sogni executes
102
102
 
103
- For any natural-language creative request that should be planned, multi-step, resumable, or benefit from server-side tool selection and repair, prefer the hosted endpoints over direct-to-SDK flags — **read [`references/hosted-api.md`](./references/hosted-api.md) first** for the full contract (tool surfaces, durable workflows, templates, replays, Seedance reference modes, media-reference uploads, cost controls):
103
+ You (the calling LLM) are almost always more capable than Sogni's hosted planning model, so **do the planning and tool selection yourself** and let the hosted endpoints do what only the server can — run on the GPU network, persist assets/manifests, orchestrate durable multi-step runs with replay, and apply structured-contract repair. Don't flatten a rich request into a single natural-language string and hand planning back to a weaker model. Match the mode to the work:
104
104
 
105
- ```bash
106
- # Natural-language creative request (LLM picks the tool, dispatches, repairs)
107
- sogni-agent --api-chat "Turn the attached product photo into a launch poster" --ref product.jpg
105
+ - **One-shot generation** → direct-to-SDK flags (the Core Commands below). You already know the tool, model, and prompt — just run it. No LLM round-trip, lowest latency/cost.
106
+ - **Multi-step / durable / resumable** → `--api-workflow` with an explicit step graph via `--workflow-input <json|@path>`. *You* author the exact plan — `steps[]` with `toolName`, `arguments`, and `dependsOn` bindings (e.g. `sourceStepId`, `targetArgument`, `transform: "artifact_url"`) — and the server executes it durably with replay/resumability, **without re-planning through the hosted LLM**. Presets like `--api-workflow storyboard-video` are fine when they already match the request.
107
+ - **`--api-chat` / `--durable-chat` (hosted LLM owns the loop)** → reserve for when you deliberately *want* the hosted model to drive a long server-side tool loop (saves client round-trips on long async jobs), when structured-contract repair recipes should govern, or when several local files must be uploaded for a single turn (multi-file local upload is only supported here). These delegate planning to the hosted model — choose them on purpose, not by default.
108
108
 
109
- # Durable hosted chat run (persisted event log + SSE stream)
110
- SOGNI_SKILL_USE_SDK_TRANSPORT=1 sogni-agent --durable-chat "Create a launch campaign and animate the hero clip"
109
+ **Read [`references/hosted-api.md`](./references/hosted-api.md) first** for the full hosted contract (tool surfaces, durable workflows, templates, replays, Seedance reference modes, media-reference uploads, cost controls).
111
110
 
112
- # Durable workflow (resumable, server-orchestrated)
113
- sogni-agent --api-workflow --video-prompt "The camera slowly pushes in" "A graphite robot sketch on a drafting table"
111
+ ```bash
112
+ # One-shot: you pick the tool, the server just executes (see Core Commands below)
113
+ sogni-agent -q -Q hq -o ./poster.png "Turn the product photo into a launch poster"
114
114
 
115
- # Storyboard → GPT Image 2 sheet → Seedance video, all server-side
115
+ # Multi-step durable: you author the step graph, the server executes it (no hosted re-planning)
116
+ sogni-agent --api-workflow --workflow-input @plan.json
116
117
  sogni-agent --api-workflow storyboard-video --storyboard-frames 6 -Q hq "9:16 bakery launch video"
118
+
119
+ # Deliberately hand the whole loop to the hosted model (long async job, or multi local-file upload)
120
+ sogni-agent --api-chat "Turn the attached product photo into a launch poster" --ref product.jpg
121
+ SOGNI_SKILL_USE_SDK_TRANSPORT=1 sogni-agent --durable-chat "Create a launch campaign and animate the hero clip"
117
122
  ```
118
123
 
119
124
  Hosted modes require `SOGNI_API_KEY`. Local file references are uploaded to Sogni media storage and forwarded as retrievable URLs — **use direct CLI mode for private media that must not leave the local machine.**
120
125
 
121
- Use the direct-to-SDK commands below for explicit one-shot generation when you already know the model, dimensions, and prompt.
122
-
123
126
  ## Core Commands (direct-to-SDK)
124
127
 
125
128
  ```bash
package/llm.txt CHANGED
@@ -8,10 +8,13 @@ Manus AI, and other SKILL.md-aware agent runtimes.
8
8
 
9
9
  ```bash
10
10
  # One-command install: detects Claude Code, Codex CLI, and Hermes; installs the
11
- # CLI globally; prompts for the API key; prints ChatGPT Custom-GPT instructions.
11
+ # CLI globally; prompts for the API key; points to ChatGPT Custom-GPT setup.
12
12
  # (Does NOT configure OpenClaw — see below.)
13
13
  npx setup-sogni-agent-skill
14
14
 
15
+ # Print ChatGPT Custom-GPT instructions explicitly.
16
+ npx setup-sogni-agent-skill --only=chatgpt
17
+
15
18
  # Agent-safe manual CLI install or upgrade
16
19
  npm install -g @sogni-ai/sogni-creative-agent-skill@latest
17
20
  sogni-agent --version
@@ -23,11 +26,11 @@ sogni-agent --version
23
26
  # Pick ONE Claude Code registration: the plugin OR the ~/.claude/skills install
24
27
  # from the npx installer — not both.
25
28
 
26
- # OpenAI Codex CLI (writes ~/.codex/skills/sogni-creative-agent-skill/)
29
+ # OpenAI Codex CLI (start Codex once first so ~/.codex/ exists)
27
30
  npx setup-sogni-agent-skill --only=codex
28
31
 
29
- # Hermes Agent (writes ~/.hermes/skills/media/sogni-creative-agent-skill/),
30
- # then /reset the Hermes session
32
+ # Hermes Agent (start Hermes once first so ~/.hermes/ exists), then /reset the
33
+ # Hermes session
31
34
  npx setup-sogni-agent-skill --only=hermes
32
35
 
33
36
  # OpenClaw plugin (the npm package is scoped — use the npm: source prefix)
@@ -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.6.0",
5
+ "version": "3.6.2",
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.6.0",
3
+ "version": "3.6.2",
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",
@@ -7,35 +7,46 @@ All hosted modes require `SOGNI_API_KEY`.
7
7
 
8
8
  ## When to prefer the hosted path
9
9
 
10
- For any natural-language creative request that benefits from tool selection,
11
- repair, or durable workflows, prefer the hosted Sogni Intelligence endpoints
12
- over direct-to-SDK media flags. They are the canonical home for
13
- OpenAI-compatible chat, server-side creative tool dispatch, Structured
14
- Contracts v1 (gating policies, repair recipes, prompt contracts), durable chat
15
- runs, durable workflows, workflow templates, replay, and asset-manifest
16
- mapping.
10
+ The thing calling this API is usually a frontier LLM that is **more capable
11
+ than Sogni's hosted planning model**. So the default split is: *you* do the
12
+ planning and tool selection, and the hosted endpoints do what only the server
13
+ can — run on the GPU network, persist assets/manifests, orchestrate durable
14
+ multi-step runs with replay, and apply Structured Contracts v1 (gating
15
+ policies, repair recipes, prompt contracts). Routing a request through
16
+ `--api-chat` so a weaker model re-plans it is usually a downgrade; reach for the
17
+ hosted *planner* deliberately, not by default.
18
+
19
+ - **You already know the single tool + args** → direct-to-SDK flags. Lowest
20
+ latency/cost, no LLM round-trip.
21
+ - **Multi-step, durable, resumable** → `--api-workflow` with an explicit
22
+ `--workflow-input` step graph that *you* author (`steps[]` with `toolName`,
23
+ `arguments`, and `dependsOn` bindings). The server executes and repairs it
24
+ deterministically with replay/resumability and **no hosted-LLM re-planning**.
25
+ This is the best fit when a frontier client drives the work.
26
+ - **You want the hosted model to own a long loop** → `--api-chat` /
27
+ `--durable-chat`. Worth it when offloading a long async tool loop server-side
28
+ saves client round-trips, when structured-contract repair should govern, or
29
+ when several local files must be uploaded for one turn (only supported here).
17
30
 
18
31
  ```bash
19
- # Natural-language creative request (LLM picks the tool, dispatches, repairs)
32
+ # You author the exact durable plan; the server executes it (no hosted re-planning)
33
+ sogni-agent --api-workflow --workflow-input @plan.json
34
+
35
+ # Storyboard → GPT Image 2 sheet → Seedance, all server-side (preset plan)
36
+ sogni-agent --api-workflow storyboard-video --storyboard-frames 6 -Q hq \
37
+ "Create a 9:16 bakery launch video with a neon street-window reveal"
38
+
39
+ # Deliberately hand planning to the hosted model (long async job / multi local-file upload)
20
40
  sogni-agent --api-chat "Turn the attached product photo into a launch poster" --ref product.jpg
21
41
 
22
42
  # Durable hosted chat run (persisted event log + SSE stream)
23
43
  SOGNI_SKILL_USE_SDK_TRANSPORT=1 sogni-agent --durable-chat \
24
44
  "Create a four-shot launch campaign, generate the key art, and animate the hero clip"
25
-
26
- # Multi-step durable workflow (resumable, replay-friendly, server-orchestrated)
27
- sogni-agent --api-workflow \
28
- --video-prompt "The camera slowly pushes in" \
29
- "A graphite robot sketch on a drafting table"
30
-
31
- # Storyboard → GPT Image 2 sheet → Seedance, all server-side
32
- sogni-agent --api-workflow storyboard-video --storyboard-frames 6 -Q hq \
33
- "Create a 9:16 bakery launch video with a neon street-window reveal"
34
45
  ```
35
46
 
36
- The direct-to-SDK flags remain available for explicit one-shot generation when
37
- you already know the exact model, dimensions, and prompt and don't need LLM
38
- planning — use them when latency or cost rules out the LLM round-trip.
47
+ The direct-to-SDK flags remain the right call for explicit one-shot generation
48
+ when you already know the exact model, dimensions, and prompt — use them
49
+ whenever latency or cost rules out an LLM round-trip.
39
50
 
40
51
  ## --api-chat (`POST /v1/chat/completions`)
41
52
 
@@ -156,19 +167,24 @@ per video request:
156
167
  - **Loose reference mode — `-c/--context` plus optional `--ref-audio` and
157
168
  `--ref-video` extras.** Anchor frame intent in the prompt with `@Image1` /
158
169
  `@Video1` / `@Audio1` etc. (e.g. *"Use @Image1 as the opening shot
159
- reference"*). Supports up to 9 image refs, 3 video refs, 3 audio refs, and
160
- 12 total reference assets per request (canonical caps come from
170
+ reference"*). Each `-c/--context` image may be a **local file or an HTTPS
171
+ URL** (PNG, JPEG, WebP, or GIF) — local files are uploaded to Sogni media
172
+ storage automatically, so you do **not** need `--api-chat` / `--durable-chat`
173
+ just to attach a local loose-reference image. Supports up to 9 image refs, 3 video refs, 3 audio
174
+ refs, and 12 total reference assets per request (canonical caps come from
161
175
  `SEEDANCE_REFERENCE_LIMITS` / `validateSeedanceReferenceCounts()` in
162
176
  `@sogni-ai/sogni-intelligence-client/tools`).
163
177
 
164
178
  Combining `--ref` / `--ref-end` with `-c/--context` on Seedance is rejected
165
- client-side with an error pointing at the correct mode. In CLI direct-gen
166
- mode, additional `--ref-audio` / `--ref-video` entries beyond the first must
167
- be HTTPS URLs (the primary entry can still be a local file); for local
168
- multi-file Seedance uploads, use `--api-chat` / `--durable-chat` instead.
169
- Seedance accepts public HTTPS image, video, and audio references that pass the
170
- CLI URL safety checks; localhost and private-network URLs are rejected before
171
- forwarding. Audio references must be paired with an image or video reference.
179
+ client-side with an error pointing at the correct mode. In CLI direct-gen mode,
180
+ local `-c/--context` images and the primary `--ref-audio` / `--ref-video` are
181
+ uploaded to Sogni media storage automatically and forwarded as HTTPS URLs; only
182
+ *additional* `--ref-audio` / `--ref-video` entries beyond the first must already
183
+ be HTTPS URLs (use `--api-chat` / `--durable-chat` when you need to attach
184
+ several local audio or video files in one request). Seedance accepts public
185
+ HTTPS image, video, and audio references that pass the CLI URL safety checks;
186
+ localhost and private-network URLs are rejected before forwarding. Audio
187
+ references must be paired with an image or video reference.
172
188
 
173
189
  ## Models, replays, and contract debugging
174
190
 
package/sogni-agent.mjs CHANGED
@@ -4242,6 +4242,8 @@ function extensionForApiMediaReference(mimeType, kind) {
4242
4242
  const normalized = String(mimeType || '').split(';')[0].trim().toLowerCase();
4243
4243
  if (normalized === 'image/jpeg' || normalized === 'image/jpg') return 'jpg';
4244
4244
  if (normalized === 'image/png') return 'png';
4245
+ if (normalized === 'image/webp') return 'webp';
4246
+ if (normalized === 'image/gif') return 'gif';
4245
4247
  if (normalized === 'audio/mpeg' || normalized === 'audio/mp3') return 'mp3';
4246
4248
  if (normalized === 'audio/mp4' || normalized === 'audio/m4a' || normalized === 'audio/x-m4a') return 'm4a';
4247
4249
  if (normalized === 'audio/wav' || normalized === 'audio/x-wav' || normalized === 'audio/wave') return 'wav';
@@ -6285,6 +6287,84 @@ async function uploadSeedanceReferenceVideoUrl(pathOrUrl, apiKey, index = 0) {
6285
6287
  return uploaded.url;
6286
6288
  }
6287
6289
 
6290
+ // Content types the Sogni media pipeline accepts for image references, mirroring
6291
+ // the `allowedContentTypes` the /v2/image/uploadUrl presigned-POST endpoint
6292
+ // returns. Kept as a constant so the skill validates exactly what the backend
6293
+ // will store rather than imposing a narrower client-side policy.
6294
+ const SEEDANCE_REFERENCE_IMAGE_MIME_TYPES = Object.freeze([
6295
+ 'image/png', 'image/jpeg', 'image/webp', 'image/gif',
6296
+ ]);
6297
+
6298
+ // Identify an image's MIME type from its leading bytes (magic numbers). Reliable
6299
+ // because we already hold the buffer, so it works regardless of file extension.
6300
+ function sniffSeedanceReferenceImageMimeType(buffer) {
6301
+ if (!buffer || buffer.length < 4) return null;
6302
+ if (buffer[0] === 0x89 && buffer[1] === 0x50 && buffer[2] === 0x4e && buffer[3] === 0x47) return 'image/png';
6303
+ if (buffer[0] === 0xff && buffer[1] === 0xd8 && buffer[2] === 0xff) return 'image/jpeg';
6304
+ if (
6305
+ buffer.length >= 12
6306
+ && buffer[0] === 0x52 && buffer[1] === 0x49 && buffer[2] === 0x46 && buffer[3] === 0x46
6307
+ && buffer[8] === 0x57 && buffer[9] === 0x45 && buffer[10] === 0x42 && buffer[11] === 0x50
6308
+ ) return 'image/webp';
6309
+ if (buffer[0] === 0x47 && buffer[1] === 0x49 && buffer[2] === 0x46 && buffer[3] === 0x38) return 'image/gif';
6310
+ return null;
6311
+ }
6312
+
6313
+ // Resolve a Seedance loose-reference image's MIME type from its bytes first,
6314
+ // falling back to the file extension. Unsupported files fail fast with an
6315
+ // actionable message instead of uploading bytes the render backend will reject.
6316
+ function seedanceReferenceImageMimeType(pathOrUrl, buffer) {
6317
+ const sniffed = sniffSeedanceReferenceImageMimeType(buffer);
6318
+ if (sniffed) return sniffed;
6319
+ const byPath = mimeTypeForPath(pathOrUrl, '');
6320
+ const normalizedByPath = byPath === 'image/jpg' ? 'image/jpeg' : byPath;
6321
+ if (SEEDANCE_REFERENCE_IMAGE_MIME_TYPES.includes(normalizedByPath)) return normalizedByPath;
6322
+ const err = new Error(
6323
+ `Seedance reference image "${pathOrUrl}" must be a PNG, JPEG, WebP, or GIF file (or an HTTPS URL to one).`,
6324
+ );
6325
+ err.code = 'UNSUPPORTED_MEDIA_TYPE';
6326
+ err.hint = 'Convert the image to PNG, JPEG, or WebP, or pass an HTTPS URL.';
6327
+ err.details = { source: pathOrUrl };
6328
+ throw err;
6329
+ }
6330
+
6331
+ async function prepareSeedanceReferenceImageUploadFile(pathOrUrl, buffer) {
6332
+ const data = Buffer.from(buffer);
6333
+ const mimeType = seedanceReferenceImageMimeType(pathOrUrl, data);
6334
+ const filename = withMediaExtension(
6335
+ mediaFilenameFromSource(pathOrUrl, 'reference-image'),
6336
+ extensionForApiMediaReference(mimeType, 'image'),
6337
+ );
6338
+ const maxBytes = apiMediaReferenceMaxBytes();
6339
+ if (data.length > maxBytes) {
6340
+ const err = new Error(
6341
+ `Seedance reference image "${pathOrUrl}" is ${data.length} bytes, above the ${maxBytes} byte upload limit.`,
6342
+ );
6343
+ err.code = 'MEDIA_REFERENCE_TOO_LARGE';
6344
+ err.details = { source: pathOrUrl, byteLength: data.length, maxBytes };
6345
+ throw err;
6346
+ }
6347
+ return {
6348
+ buffer: data,
6349
+ filename,
6350
+ byteLength: data.length,
6351
+ mimeType,
6352
+ };
6353
+ }
6354
+
6355
+ // Upload a local (non-HTTPS) Seedance loose-reference image and return its
6356
+ // hosted HTTPS download URL. The Client SDK's loose-reference arrays accept only
6357
+ // URL strings, so this is what lets `-c <local image>` work in direct generation
6358
+ // without forcing the user onto the --api-chat / --durable-chat path. Mirrors
6359
+ // uploadSeedanceReferenceAudioUrl / uploadSeedanceReferenceVideoUrl.
6360
+ async function uploadSeedanceReferenceImageUrl(pathOrUrl, apiKey, index = 0) {
6361
+ const ref = { flag: '-c/--context', value: pathOrUrl, kind: 'image' };
6362
+ const buffer = await fetchMediaBuffer(pathOrUrl);
6363
+ const file = await prepareSeedanceReferenceImageUploadFile(pathOrUrl, buffer);
6364
+ const uploaded = await uploadPreparedApiMediaReferenceV2(ref, index, apiKey, file);
6365
+ return uploaded.url;
6366
+ }
6367
+
6288
6368
  async function trimSeedanceV2VSourceVideoBuffer(buffer, sourceLabel, startOffset, requestedDuration) {
6289
6369
  const ffmpegPath = await ensureFfmpegAvailable();
6290
6370
  const tempDir = createTrackedTempDir('sogni-seedance-v2v-');
@@ -8086,19 +8166,24 @@ async function main() {
8086
8166
  // Seedance loose-reference extras: -c/--context images beyond start/end,
8087
8167
  // plus repeated --ref-audio / --ref-video entries past the first. The
8088
8168
  // Sogni Client SDK accepts only URL arrays for these (createJobRequestMessage),
8089
- // so extras MUST be HTTPS URLs. For multi-file local uploads, use --api-chat /
8090
- // --durable-chat where the LLM upload pipeline handles per-file uploads.
8169
+ // so each entry must resolve to an HTTPS URL. HTTPS inputs are forwarded as-is
8170
+ // (SSRF-validated); local files are uploaded to a Sogni-hosted URL first, the
8171
+ // same way the primary --ref-audio / --ref-video locals are handled. This lets
8172
+ // `-c <local image>` work in direct generation without a detour through
8173
+ // --api-chat / --durable-chat.
8091
8174
  if (isSeedanceVideo) {
8092
- for (const ctxImage of (Array.isArray(options.contextImages) ? options.contextImages : [])) {
8175
+ for (const [ctxIndex, ctxImage] of (Array.isArray(options.contextImages) ? options.contextImages : []).entries()) {
8093
8176
  if (!ctxImage) continue;
8094
- if (!isHttpsUrl(ctxImage)) {
8095
- fatalCliError(
8096
- `Seedance extra image reference "${ctxImage}" must be an HTTPS URL. ` +
8097
- 'Local file uploads beyond --ref / --ref-end are only supported in --api-chat / --durable-chat mode.',
8098
- { code: 'INVALID_ARGUMENT', details: { flag: '-c/--context', value: ctxImage } },
8177
+ if (isHttpsUrl(ctxImage)) {
8178
+ await appendSafeSeedanceReferenceUrl(seedanceReferenceImageUrls, ctxImage, 'Seedance image reference');
8179
+ } else {
8180
+ const uploadedImageUrl = await uploadSeedanceReferenceImageUrl(
8181
+ ctxImage,
8182
+ creds.SOGNI_API_KEY,
8183
+ ctxIndex,
8099
8184
  );
8185
+ seedanceReferenceImageUrls.push(uploadedImageUrl);
8100
8186
  }
8101
- await appendSafeSeedanceReferenceUrl(seedanceReferenceImageUrls, ctxImage, 'Seedance image reference');
8102
8187
  }
8103
8188
  for (const [extraAudioIndex, extraAudio] of options.refAudios.entries()) {
8104
8189
  if (!isHttpsUrl(extraAudio)) {
package/update-check.mjs CHANGED
@@ -24,7 +24,7 @@
24
24
  import { spawn, spawnSync } from 'child_process';
25
25
  import { existsSync, mkdirSync, readFileSync, writeFileSync, unlinkSync } from 'fs';
26
26
  import { dirname, join } from 'path';
27
- import { homedir } from 'os';
27
+ import { homedir, platform as osPlatform } from 'os';
28
28
  import https from 'https';
29
29
 
30
30
  export const PACKAGE_NAME = '@sogni-ai/sogni-creative-agent-skill';
@@ -73,6 +73,20 @@ export function detectPackageManager(env = process.env) {
73
73
  return { manager: 'npm', installCmd: `npm install -g ${PACKAGE_NAME}` };
74
74
  }
75
75
 
76
+ function isPermissionErrorText(text) {
77
+ return /EACCES|EPERM|permission denied|operation not permitted/i.test(String(text || ''));
78
+ }
79
+
80
+ export function formatSelfUpdatePermissionHint({ manager = 'npm', platform = osPlatform() } = {}) {
81
+ const rerun = platform === 'win32'
82
+ ? 'open a terminal as Administrator and run `sogni-agent self-update` again'
83
+ : 'run `sudo sogni-agent self-update`';
84
+ if (manager === 'npm') {
85
+ return `Hint: if npm reported a permissions error, ${rerun}, or install Node with a version manager (nvm/fnm/volta).`;
86
+ }
87
+ return `Hint: if ${manager} reported a permissions error, ${rerun}, or fix your global ${manager} install permissions.`;
88
+ }
89
+
76
90
  // Hard opt-outs only. Notices are deliberately NOT skipped for non-TTY
77
91
  // stderr, --json, or OpenClaw plugin invocations anymore: those are exactly
78
92
  // the agent contexts that should relay "an update is available" to the user
@@ -432,22 +446,29 @@ export function runSelfUpdate({
432
446
  statePath = DEFAULT_STATE_PATH,
433
447
  spawnSyncFn = spawnSync,
434
448
  stdio = 'inherit',
449
+ platform = osPlatform(),
450
+ log = console.error,
435
451
  } = {}) {
436
452
  const { manager, installCmd } = detectPackageManager(env);
437
453
  const [command, ...args] = installCmd.split(' ');
438
- console.error(`Running: ${installCmd}`);
454
+ log(`Running: ${installCmd}`);
439
455
  const result = spawnSyncFn(command, args, { stdio, env });
440
456
  if (result.error) {
441
- console.error(`self-update failed: ${result.error.message}`);
457
+ log(`self-update failed: ${result.error.message}`);
442
458
  if (manager === 'npm' && /EACCES|EPERM/i.test(result.error.message)) {
443
- console.error('Hint: re-run with sudo, or install with a Node version manager (nvm/fnm/volta).');
459
+ log(formatSelfUpdatePermissionHint({ manager, platform }));
444
460
  }
445
461
  return 1;
446
462
  }
447
463
  if (typeof result.status === 'number' && result.status !== 0) {
464
+ log(`self-update failed: ${installCmd} exited with code ${result.status}.`);
465
+ const stderr = result.stderr ? result.stderr.toString('utf8') : '';
466
+ if (manager === 'npm' || isPermissionErrorText(stderr)) {
467
+ log(formatSelfUpdatePermissionHint({ manager, platform }));
468
+ }
448
469
  return result.status;
449
470
  }
450
471
  clearState(statePath);
451
- console.error('Updated. Run `sogni-agent --whats-new` to see what changed.');
472
+ log('Updated. Run `sogni-agent --whats-new` to see what changed.');
452
473
  return 0;
453
474
  }
package/version.mjs CHANGED
@@ -1 +1 @@
1
- export const PACKAGE_VERSION = '3.6.0';
1
+ export const PACKAGE_VERSION = '3.6.2';