@sogni-ai/sogni-creative-agent-skill 3.14.1 → 3.15.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.
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "sogni",
3
+ "owner": {
4
+ "name": "Sogni AI",
5
+ "url": "https://sogni.ai"
6
+ },
7
+ "metadata": {
8
+ "description": "Sogni AI plugins for Claude Code and Codex.",
9
+ "version": "1.0.0"
10
+ },
11
+ "plugins": [
12
+ {
13
+ "name": "sogni-creative-agent",
14
+ "source": "./",
15
+ "description": "Image, video, and music generation via Sogni AI's decentralized GPU network.",
16
+ "category": "creative",
17
+ "tags": ["sogni", "image-generation", "video-generation", "music-generation"],
18
+ "homepage": "https://sogni.ai",
19
+ "repository": "https://github.com/Sogni-AI/sogni-creative-agent-skill",
20
+ "license": "MIT"
21
+ }
22
+ ]
23
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "sogni-creative-agent",
3
+ "version": "3.15.0",
4
+ "description": "Sogni Creative Agent: image, video, and music generation via Sogni AI's decentralized GPU network. Supports personas, persistent memories, style transfer, and multi-step creative workflows.",
5
+ "author": {
6
+ "name": "Sogni AI",
7
+ "url": "https://sogni.ai"
8
+ },
9
+ "homepage": "https://github.com/Sogni-AI/sogni-creative-agent-skill",
10
+ "repository": "https://github.com/Sogni-AI/sogni-creative-agent-skill",
11
+ "license": "MIT",
12
+ "keywords": ["sogni", "image-generation", "video-generation", "music-generation", "creative"],
13
+ "skills": "./plugin-skills"
14
+ }
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "sogni-creative-agent",
3
+ "version": "3.14.0",
4
+ "description": "Create images, generative video, music, and polished image-folder loops with Sogni AI.",
5
+ "author": {
6
+ "name": "Sogni AI",
7
+ "url": "https://sogni.ai"
8
+ },
9
+ "homepage": "https://github.com/Sogni-AI/sogni-creative-agent-skill",
10
+ "repository": "https://github.com/Sogni-AI/sogni-creative-agent-skill",
11
+ "license": "MIT",
12
+ "keywords": [
13
+ "sogni",
14
+ "image-generation",
15
+ "video-generation",
16
+ "music-generation",
17
+ "creative"
18
+ ],
19
+ "skills": "./skills",
20
+ "interface": {
21
+ "displayName": "Sogni Creative Agent",
22
+ "shortDescription": "Create images, video, music, and seamless loops",
23
+ "longDescription": "Generate and edit images, animate first-frame-to-last-frame video, create music, and turn image folders into verified seamless reels using Sogni AI.",
24
+ "developerName": "Sogni AI",
25
+ "category": "Creativity",
26
+ "capabilities": [
27
+ "Read",
28
+ "Write",
29
+ "Network"
30
+ ],
31
+ "websiteURL": "https://sogni.ai",
32
+ "defaultPrompt": [
33
+ "Turn my image folder into a seamless music-backed loop.",
34
+ "Animate these two images as a first-frame-to-last-frame transition.",
35
+ "Create an instrumental soundtrack for my video."
36
+ ]
37
+ }
38
+ }
package/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ # [3.15.0](https://github.com/Sogni-AI/sogni-creative-agent-skill/compare/v3.14.1...v3.15.0) (2026-07-21)
2
+
3
+ ### Bug Fixes
4
+
5
+ * **packaging:** include the hosted SDK client module required by durable chat
6
+
7
+ ### Features
8
+
9
+ * support Krea identity-edit models
10
+ * add the verified loop-maker workflow
11
+
1
12
  # [3.14.1](https://github.com/Sogni-AI/sogni-creative-agent-skill/compare/v3.14.0...v3.14.1) (2026-07-13)
2
13
 
3
14
 
package/README.md CHANGED
@@ -27,6 +27,7 @@ With this skill, an agent can:
27
27
 
28
28
  - generate images from prompts and edit/restyle existing images
29
29
  - create videos from text, images, audio, or reference video (LTX-2.3, WAN 2.2, Seedance 2.0, HappyHorse 1.1)
30
+ - turn an image folder into a visually deduplicated, music-backed seamless loop with one plugin skill invocation
30
31
  - generate instrumental music or full songs with lyrics
31
32
  - run hosted creative workflows including storyboard-driven video
32
33
  - save personas, preferences, and last-render state across sessions
@@ -108,6 +109,7 @@ Then ask your agent to do something:
108
109
 
109
110
  - "Generate an image of a sunset over mountains"
110
111
  - "Edit this image to add a rainbow"
112
+ - "Use Sogni Loop Maker on my image folder"
111
113
  - "Make a video of a cat playing piano"
112
114
  - "Generate a 30 second synthwave product-launch theme"
113
115
  - "Turn my selfie into James Bond using photobooth"
@@ -119,7 +121,7 @@ Then ask your agent to do something:
119
121
 
120
122
  - **Node.js ≥ 22.11.0**
121
123
  - **Sogni API key** ([dashboard.sogni.ai](https://dashboard.sogni.ai))
122
- - **`ffmpeg`** *(optional)* — required for local utilities such as `--angles-360-video`, `--concat-videos`, and `--extract-last-frame`. Set `FFMPEG_PATH` to override discovery.
124
+ - **`ffmpeg` + `ffprobe`** *(optional)* — required for local utilities such as `--angles-360-video`, `--concat-videos`, timestamped frame extraction, and `--verify-video`. Set `FFMPEG_PATH` / `FFPROBE_PATH` to override discovery.
123
125
  - macOS, Linux, or Windows
124
126
 
125
127
  ---
@@ -152,7 +154,24 @@ The first command registers a `sogni` marketplace with one plugin entry (`sogni-
152
154
 
153
155
  ### OpenAI Codex CLI
154
156
 
155
- The `npx` installer writes the skill to `~/.codex/skills/sogni-creative-agent-skill/`, which the Codex CLI discovers automatically:
157
+ For the namespaced Sogni skills, register the marketplace and install the plugin:
158
+
159
+ ```bash
160
+ codex plugin marketplace add Sogni-AI/sogni-creative-agent-skill
161
+ codex plugin add sogni-creative-agent@sogni
162
+ ```
163
+
164
+ Start a new Codex session, then invoke Loop Maker directly:
165
+
166
+ ```text
167
+ $sogni-creative-agent:loop-maker ./images
168
+ ```
169
+
170
+ In the Codex app, type `@`, choose **Sogni Loop Maker**, and select its starter prompt.
171
+
172
+ For local development, replace the GitHub shorthand in `codex plugin marketplace add` with the absolute path to this repository.
173
+
174
+ Alternatively, the `npx` installer writes the full monolithic skill to `~/.codex/skills/sogni-creative-agent-skill/`, which Codex discovers automatically:
156
175
 
157
176
  ```bash
158
177
  npx setup-sogni-agent-skill --only=codex
@@ -160,7 +179,7 @@ npx setup-sogni-agent-skill --only=codex
160
179
 
161
180
  Start Codex once before running the installer so `~/.codex/` exists. If the selected local runtime is not detected, setup exits before installing anything.
162
181
 
163
- 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`.
182
+ 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 this personal-skill install later: `npx setup-sogni-agent-skill --uninstall --only=codex`.
164
183
 
165
184
  ### Hermes Agent
166
185
 
@@ -336,6 +355,22 @@ Defaults live under `~/.config/sogni/` for credentials, last-render metadata, pe
336
355
 
337
356
  ## Usage
338
357
 
358
+ Claude Code plugin users can launch the complete folder-to-loop workflow with one skill invocation:
359
+
360
+ ```text
361
+ /sogni-creative-agent:loop-maker ./images
362
+ /sogni-creative-agent:loop-maker ./images start=cover.jpg music="subtle tropical cyberpunk electronica" output=launch-loop.mp4
363
+ ```
364
+
365
+ Codex CLI and IDE users can invoke the same bundled skill with `$`:
366
+
367
+ ```text
368
+ $sogni-creative-agent:loop-maker ./images
369
+ $sogni-creative-agent:loop-maker ./images start=cover.jpg music="subtle tropical cyberpunk electronica" output=launch-loop.mp4
370
+ ```
371
+
372
+ The skill visually removes repeated concepts from the active sequence, renders one direct LTX first-frame/last-frame clip per image pair, closes the loop, generates a soundtrack longer than the picture, and verifies anchors, interior motion, streams, and full-file decoding before delivery. Original source images are preserved. The default stack is Sogni plus the bundled FFmpeg wrappers; HyperFrames and Remotion are optional only for explicitly requested text, overlays, or compositor effects. True 360 novel-view synthesis is deliberately excluded from this workflow because a direct single-image LTX prompt does not reliably create camera orbit geometry.
373
+
339
374
  ```bash
340
375
  # Image generation
341
376
  sogni-agent -Q hq -o dragon.png "a dragon eating tacos"
@@ -476,6 +511,8 @@ Run `sogni-agent --help` for the full CLI. Below are the options and tables most
476
511
  | `--list-replays [n]`, `--get-replay <id>`, `--ingest-replay <json\|@path>` | Manage Sogni Intelligence replay records (use `@path` to load JSON from a file) |
477
512
  | `--persona <name>` | Use a saved persona |
478
513
  | `--concat-videos <out> <clips...>` | Stitch clips locally with FFmpeg |
514
+ | `--extract-first-frame`, `--extract-frame-at`, `--extract-last-frame` | Extract visual-QA frames through safe FFmpeg wrappers |
515
+ | `--verify-video <path>` | Probe streams and fully decode a final video before delivery |
479
516
  | `--last`, `--last-image` | Inspect last render / reuse last image as context or video reference |
480
517
  | `--strict-size` | Fail instead of auto-adjusting video size |
481
518
  | `--json` | Emit structured output for agents |
@@ -510,6 +547,9 @@ Prefer `-Q fast|hq|pro` for images and automatic workflow routing for video. Pas
510
547
  | OpenAI GPT Image generation, editing, or strong text rendering | `gpt-image-2` |
511
548
  | Highest-quality images | `flux2_dev_fp8` (or `-Q pro`) |
512
549
  | Image editing | `qwen_image_edit_2511_fp8_lightning` |
550
+ | Dark Beast Krea 2 images | `dark_beast_krea2_fp8` |
551
+ | Identity-preserving Krea image edits | `krea2_identity_edit_v1_2` |
552
+ | Uncensored identity-preserving Krea edits | `dark_beast_krea2_identity_edit_v1_2` |
513
553
  | Photobooth face transfer | `coreml-sogniXLturbo_alpha1_ad` |
514
554
  | Direct music generation | `ace_step_1.5_xl_turbo` (or `--music-model turbo`) |
515
555
  | Music with stronger lyric handling | `ace_step_1.5_xl_sft` (or `--music-model sft`) |
@@ -521,7 +561,7 @@ Prefer `-Q fast|hq|pro` for images and automatic workflow routing for video. Pas
521
561
  | Seedance video-to-video without ControlNet | `seedance2-v2v` |
522
562
  | Face lip-sync with uploaded audio | `wan_v2.2-14b-fp8_s2v_lightx2v` |
523
563
 
524
- `gpt-image-2` supports flexible OpenAI image sizes up to 3840 px on either edge, max 3:1 aspect ratio, and total pixels from 655,360 to 8,294,400; the API snaps dimensions to valid multiples of 16. For image editing with `gpt-image-2`, you can pass up to 16 context images.
564
+ `gpt-image-2` supports flexible OpenAI image sizes up to 3840 px on either edge, max 3:1 aspect ratio, and total pixels from 655,360 to 8,294,400; the API snaps dimensions to valid multiples of 16. For image editing with `gpt-image-2`, you can pass up to 16 context images. Krea 2 Identity Edit (`krea2_identity_edit_v1_2`) and Dark Beast Krea 2 Identity Edit (`dark_beast_krea2_identity_edit_v1_2`) use `-c/--context`, support 1-2 references, 512-2048 px output, 8-12 steps, and guidance 1.
525
565
 
526
566
  Music generation uses `--music` and outputs `mp3` by default. `--audio` remains the video-reference alias for `--ref-audio`; use `--music` or `--generate-music` for direct audio-only generation.
527
567
 
package/SKILL.md CHANGED
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  name: sogni-creative-agent-skill
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\"."
3
+ description: "Sogni Creative Agent Skill: agent skill and CLI for image, video, and music generation using Sogni AI's decentralized GPU network. Supports one-click image-folder loop reels, 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\", \"turn this image folder into a loop\", \"make music\", \"apply a style\", or \"generate me as a superhero\"."
4
4
  metadata:
5
- version: "3.14.1"
5
+ version: "3.15.0"
6
6
  homepage: https://sogni.ai
7
7
  openclaw:
8
8
  emoji: "🎨"
@@ -98,7 +98,7 @@ sogni-agent -o /tmp/cat.png "a cat wearing a hat" # ✗ avoid — user can't
98
98
  - Memories / personality / personas (read/write): `~/.config/sogni/`
99
99
  - OpenClaw config (read): `~/.openclaw/openclaw.json` (`OPENCLAW_CONFIG_PATH`)
100
100
  - 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`)
101
- - Custom ffmpeg binary: `FFMPEG_PATH`
101
+ - Custom ffmpeg / ffprobe binaries: `FFMPEG_PATH`, `FFPROBE_PATH`
102
102
 
103
103
  ## Recommended path: you plan, Sogni executes
104
104
 
@@ -204,13 +204,14 @@ sogni-agent doctor --json
204
204
  ### Photobooth vs. context editing
205
205
 
206
206
  - `--photobooth` is **face-reference generation**, not full-image editing: it generates a *new* portrait from a face photo and may change pose, clothing, background, framing, and composition. Use it when the user explicitly asks for photobooth/face-transfer, a new portrait/headshot from their face, or to place their face into a different concept. Cannot be combined with `--video` or `-c/--context`. Tune with `--cn-strength` (default 0.8) and `--cn-guidance-end` (default 0.3).
207
- - If the request is "**same image, different style**" — e.g. an anime version that must keep the same face, pose, clothing, background, framing, and composition; "use this image as the base"; "keep everything the same"; "only change the style" — use Qwen context editing with `-c/--context` instead. For stronger preservation than the lightning default:
207
+ - If the request is "**same image, different style**" — e.g. an anime version that must keep the same face, pose, clothing, background, framing, and composition; "use this image as the base"; "keep everything the same"; "only change the style" — use context editing with `-c/--context` instead. For stronger preservation than the lightning default:
208
208
 
209
209
  ```bash
210
210
  sogni-agent -c photo.jpg -m qwen_image_edit_2511_fp8 "turn this into anime style; keep the same face, pose, clothing, background, framing, and composition"
211
211
  ```
212
212
 
213
- - Do not route to `--photobooth` merely because the user asks to preserve a face in a style edit — face-preserving full-image edits use `-c` with Qwen image edit. When context images are provided without `-m`, the CLI defaults to `qwen_image_edit_2511_fp8_lightning`; select `-m gpt-image-2` for up to 16 reference images and OpenAI-backed editing (Qwen supports up to 3).
213
+ - For identity-preserving Krea edits, use `-m krea2_identity_edit_v1_2` with 1-2 context images; use `-m dark_beast_krea2_identity_edit_v1_2` for the Dark Beast Krea 2 identity edit LoRA. Both use 512-2048 px output, 8-12 steps, guidance 1, and default to 10 steps.
214
+ - Do not route to `--photobooth` merely because the user asks to preserve a face in a style edit — face-preserving full-image edits use `-c` with an image edit model. When context images are provided without `-m`, the CLI defaults to `qwen_image_edit_2511_fp8_lightning`; select `-m gpt-image-2` for up to 16 reference images and OpenAI-backed editing (Qwen supports up to 3; Krea identity edit supports up to 2).
214
215
 
215
216
  ### LTX video prompts
216
217
 
@@ -224,7 +225,9 @@ For "4k" / "uhd" requests where the user accepts the Premium Spark vendor path o
224
225
 
225
226
  Trigger patterns — "animate/morph image A to image B" (`--ref A --ref-end B`; on LTX-2.3 i2v this is a single render — the transition/morph LoRA auto-applies, no bridge clip), "continue this video" (extract last frame → i2v → concat), "transition between two videos" (bridge clip between two *finished videos*), "make a reel/slideshow from these images" or "animate this folder of images" (`--source-reel <dir>`; plan first with the free `--reel-plan-only`; options: `--reel-image-seconds`, `--reel-transition-seconds`, `--reel-loop`/`--no-reel-loop`, `--reel-image-prompt`, `--reel-transition-prompt`), "360 video" (`--angles-360 --angles-360-video`), "add/replace the soundtrack" (`--concat-audio` / `--remix-audio`). **Read [`references/video-editing.md`](./references/video-editing.md) for the step-by-step recipes.**
226
227
 
227
- **Security: never run raw shell commands (`ffmpeg`, `ls`, `cp`, etc.) for file operations or video/audio manipulation.** Always use the CLI's built-in safe wrappers: `--extract-first-frame`, `--extract-last-frame`, `--concat-videos`, `--remix-audio`, `--list-media`, `--video-start`, `--audio-start`, `--audio-duration`, `--looping`.
228
+ For a **one-click polished folder loop** where each source image animates and then morphs directly into the next original image, read [`references/loop-maker.md`](./references/loop-maker.md). Use its visually deduplicated, one-LTX-clip-per-pair workflow instead of the default SourceReel split animation-plus-bridge structure. Do not route true 360 novel-view synthesis to this direct pairwise workflow: a turning subject or occluder wipe is not a camera orbit. Trigger on requests such as "Sogni Loop Maker", "make this image folder a seamless loop", "one-click animated photo reel", the Claude Code command `/sogni-creative-agent:loop-maker`, or the Codex skill `$sogni-creative-agent:loop-maker`.
229
+
230
+ **Security: never run raw shell commands (`ffmpeg`, `ffprobe`, `ls`, `cp`, etc.) for file operations or video/audio manipulation.** Always use the CLI's built-in safe wrappers: `--extract-first-frame`, `--extract-frame-at`, `--extract-last-frame`, `--verify-video`, `--concat-videos`, `--remix-audio`, `--list-media`, `--video-start`, `--audio-start`, `--audio-duration`, `--looping`.
228
231
 
229
232
  ### Finding user-sent media
230
233
 
@@ -317,8 +320,9 @@ Uses Spark tokens from the user's Sogni account. 512x512 images are most cost-ef
317
320
  |-----------|------------------------|
318
321
  | [`references/video-prompting.md`](./references/video-prompting.md) | Writing LTX video prompts; high-res/4K routing; orientation/aspect mapping; camera language |
319
322
  | [`references/video-editing.md`](./references/video-editing.md) | Animate between images, continue/bridge videos, 360 turnarounds, concat, audio remix/layering, v2v ControlNet |
323
+ | [`references/loop-maker.md`](./references/loop-maker.md) | One-click image-folder loops with visual deduplication, direct LTX first/last-frame clips, music, and verification |
320
324
  | [`references/hosted-api.md`](./references/hosted-api.md) | `--api-chat`, `--durable-chat`, `--api-workflow`, workflow templates, replays, Seedance reference modes, cost controls |
321
- | [`references/models.md`](./references/models.md) | Choosing models, sizing/divisibility rules, gpt-image-2 limits, music model options |
325
+ | [`references/models.md`](./references/models.md) | Choosing models, sizing/divisibility rules, image edit reference limits, music model options |
322
326
  | [`references/personas-memory.md`](./references/personas-memory.md) | Persona CRUD/voice cloning, multi-persona scenes, memories, personality, style transfer, photo restoration |
323
327
  | [`references/openclaw-config.md`](./references/openclaw-config.md) | OpenClaw plugin config defaults and overrides |
324
328
  | [`skills/README.md`](./skills/README.md) | Hosted per-skill tool surface (for hosts that load focused capability subsets) |
@@ -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.14.1",
5
+ "version": "3.15.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",
package/llm.txt CHANGED
@@ -90,6 +90,12 @@ You can also export `SOGNI_API_KEY` instead of writing the file. Confirm with
90
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
+ - Direct Krea IDs: use `-m krea2_turbo_fp8_scaled` for Krea 2 Turbo images,
94
+ `-m dark_beast_krea2_fp8` for Dark Beast Krea 2 images, and
95
+ `-c <image> -m krea2_identity_edit_v1_2` or
96
+ `-c <image> -m dark_beast_krea2_identity_edit_v1_2` for identity-preserving
97
+ Krea edits with 1-2 references, 512-2048 px output, 8-12 steps, and
98
+ guidance 1.
93
99
  - Cost policy: `--workflow-max-cost`, `--confirm-cost`, `--no-confirm-cost`.
94
100
  - JSON errors include canonical `errorType`, `errorCategory`, and `retryable`.
95
101
 
@@ -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.14.1",
5
+ "version": "3.15.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.14.1",
3
+ "version": "3.15.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",
@@ -38,7 +38,9 @@
38
38
  "hermes-agent",
39
39
  "manus",
40
40
  "claude",
41
- "claude-code"
41
+ "claude-code",
42
+ "codex",
43
+ "codex-plugin"
42
44
  ],
43
45
  "author": "Mauvis Ledford",
44
46
  "license": "MIT",
@@ -57,6 +59,9 @@
57
59
  "LICENSE",
58
60
  "README.md",
59
61
  "CHANGELOG.md",
62
+ ".claude-plugin/",
63
+ ".codex-plugin/",
64
+ "plugin-skills/",
60
65
  "SKILL.md",
61
66
  "references/",
62
67
  "desktop-extension/",
@@ -74,6 +79,7 @@
74
79
  "openclaw.plugin.json",
75
80
  "env.mjs",
76
81
  "ssrf-guard.mjs",
82
+ "sogni-hosted-client.mjs",
77
83
  "update-check.mjs",
78
84
  "node-version-check.mjs",
79
85
  "generated/creative-agent-runtime.mjs",
@@ -0,0 +1,16 @@
1
+ ---
2
+ name: loop-maker
3
+ description: Turn a folder of images into a polished, music-backed seamless loop using visually deduplicated source frames and direct LTX first-frame/last-frame transitions. Invoke as /sogni-creative-agent:loop-maker IMAGE_FOLDER in Claude Code or $sogni-creative-agent:loop-maker in Codex, with optional start, music, output, pacing, or aspect preferences. Use when the user asks for a one-click image-folder reel, animated photo loop, looping montage, or slideshow where every image animates briefly before morphing into the next. Do not route true 360 novel-view synthesis here.
4
+ ---
5
+
6
+ # Sogni Loop Maker
7
+
8
+ Create the image-folder loop described in the user's current request. Treat text after the explicit skill invocation as its arguments when the host provides them.
9
+
10
+ 1. Resolve the plugin root as two directories above this `SKILL.md`. Read the root `SKILL.md` completely. A host-provided plugin-root variable may be used, but do not depend on one.
11
+ 2. Read `references/loop-maker.md` under that plugin root completely and follow it as the canonical workflow.
12
+ 3. Treat the first folder path in the arguments as the source. Treat remaining text as optional preferences such as the opening image, music direction, output name, pacing, aspect ratio, compositor effects, or cleanup request.
13
+ 4. If no folder is supplied, use the current directory only when it contains at least two supported source images; otherwise ask for the folder path.
14
+ 5. Execute through final verification. Ask no stylistic questions when the defaults in the workflow are safe.
15
+
16
+ Preserve original source images. Use Sogni for all generated video and music, and use the CLI's safe media wrappers for extraction, concatenation, audio remixing, and verification. Do not use HyperFrames or Remotion unless the user explicitly requests text, overlays, or compositor effects that need one of them.
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: sogni-creative-agent
3
+ description: "Sogni Creative Agent: image, video, and music generation using Sogni AI's decentralized GPU network. Supports personas, 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. Invoke when the user asks to \"draw\", \"generate\", \"create an image\", \"make a video\", \"animate\", \"make music\", \"apply a style\", or \"generate me as a superhero\"."
4
+ ---
5
+
6
+ # Sogni Creative Agent
7
+
8
+ Generate **images, videos, and music** via Sogni AI's decentralized GPU network through the `sogni-agent` CLI shipped with this plugin.
9
+
10
+ ## Setup
11
+
12
+ 1. Install the CLI (one-time): `npm install -g @sogni-ai/sogni-creative-agent-skill@latest`.
13
+ 2. Provide your Sogni API key (get one at https://dashboard.sogni.ai → account menu): either set `SOGNI_API_KEY` in the environment, or save it to `~/.config/sogni/credentials` as `SOGNI_API_KEY=<your-key>`.
14
+ 3. Verify with `sogni-agent doctor --json` and confirm `"success": true` before reporting the install as working.
15
+ 4. Optional config files honored: `~/.config/sogni/credentials`, `~/.config/sogni/last-render.json`.
16
+
17
+ Do not run the default `npx setup-sogni-agent-skill` from an installed plugin unless the user explicitly wants a separate personal skill registration in `~/.claude/skills/` or another host's personal skill directory; using both can create duplicate skills.
18
+
19
+ **Uninstall:** remove `sogni-creative-agent@sogni` with Claude Code's plugin manager. To also remove the global CLI and Sogni data, run `npx setup-sogni-agent-skill --uninstall --remove-cli --purge` after the plugin is removed; it backs up `~/.config/sogni/` to `~/.config/sogni.backup-<timestamp>.tar.gz` first. Tell the user the backup path; it holds their API key. Omit `--purge` to keep data. This cleanup command does not uninstall the Claude Code plugin itself.
20
+
21
+ ## Quick examples
22
+
23
+ - Image: `sogni-agent "a cat on the moon, cinematic"`
24
+ - Image edit: `sogni-agent -c <path> "make it night, add fireflies"`
25
+ - Video (image-to-video): `sogni-agent --video --ref <path> "gentle camera pan"`
26
+ - One-click image-folder loop: `/sogni-creative-agent:loop-maker ./images`
27
+ - One-click image-folder loop in Codex: `$sogni-creative-agent:loop-maker ./images`
28
+ - Music: `sogni-agent --music "ambient drone, 30 seconds"`
29
+ - Hosted workflow: `sogni-agent --api-workflow storyboard-video --storyboard-frames 6 "9:16 bakery launch video"`
30
+ - List inbound media the user sent (Telegram etc.): `sogni-agent --json --list-media`
31
+ - Inspect the last render: `sogni-agent --last --json`
32
+ - Full reference: `sogni-agent --help`
33
+
34
+ ## When to invoke this skill
35
+
36
+ The user asks to:
37
+ - generate / create / draw / render an image
38
+ - animate, make a video, convert image to video
39
+ - turn a folder of images into a deduplicated, music-backed seamless loop
40
+ - make music, generate audio, create a soundtrack
41
+ - apply a style or transform a subject ("as a superhero", "anime style")
42
+ - manage personas or saved reference assets
43
+
44
+ ## Full skill manifest
45
+
46
+ The complete skill spec — every workflow, model default, persona schema, memory schema, and prompt-engineering note — lives at `../../SKILL.md` relative to this file, with deep-dive guides under `../../references/`. Resolve those paths from this installed `SKILL.md`, not from the user's working directory. Read them when the user's request needs detail beyond the quick examples above (e.g. choosing between video workflows, configuring persona references, planning a multi-step composition).
@@ -0,0 +1,192 @@
1
+ # Loop Maker: Image Folder to Seamless Music-Backed Video
2
+
3
+ Use this workflow for one-command requests to turn a folder of still images into a fast, polished, seamlessly looping video. It differs from the default SourceReel pipeline: render one direct first-frame/last-frame LTX clip per adjacent image pair instead of creating a standalone animation clip plus a bridge. The skill invocation is the one command; the agent performs the audited render, retries, assembly, and verification behind it.
4
+
5
+ ## Defaults and rendering stack
6
+
7
+ - Preserve source files and their relative filename order.
8
+ - Support `.jpg`, `.jpeg`, `.png`, and `.webp` source images.
9
+ - Keep one strongest representative of each visual concept.
10
+ - Use the strongest retained image as the opener unless the user names another, then rotate the ordered list without otherwise reordering it.
11
+ - Render one 3-second clip per image pair: about 2 seconds of restrained motion followed by a smooth transition into the next supplied image.
12
+ - Close the loop with the last retained image to the opener.
13
+ - Use `ltx23-22b-fp8_i2v_distilled`, `--token-type auto`, and the exact original files as both `--ref` and `--ref-end` for every pair.
14
+ - Pin both endpoint strengths to `1` and disable SDK asset auto-resizing after choosing a valid LTX canvas.
15
+ - Target a 768px short side unless the user requests another resolution. Choose dimensions divisible by 64, preserve the dominant source aspect ratio, and keep the long side at or below 2048px. For a 4:3 source set, use `1024x768`.
16
+ - Normalize the stitched result to 32 fps.
17
+ - Generate instrumental ACE-Step 1.5 XL Turbo music unless the user supplies audio or requests `music=none`.
18
+ - Save the final beside the source folder as `sogni-loop-final.mp4`, choosing a non-overwriting numbered name when it already exists.
19
+
20
+ The default stack is Sogni generation plus the Sogni CLI's local FFmpeg wrappers. Do not initialize or depend on HyperFrames or Remotion for generation, assembly, or validation. If either compositor is already installed, use it only when the user explicitly asks for timed text, titles, overlays, or effects that the wrappers cannot provide; preserve the approved picture track and loop anchors through that optional pass.
21
+
22
+ ## 1. Resolve input and preferences
23
+
24
+ Parse the invocation text for:
25
+
26
+ - source folder;
27
+ - optional opening image;
28
+ - optional output path;
29
+ - optional music style or `music=none`;
30
+ - optional clip duration, resolution, aspect ratio, fps, ordering, or compositor effects.
31
+
32
+ Use the current directory only when no folder was supplied and it clearly contains the intended source set. Ask one concise question only when the folder cannot be resolved safely.
33
+
34
+ Before generation, run:
35
+
36
+ ```bash
37
+ sogni-agent --memory-list --json
38
+ sogni-agent --personality-get --json
39
+ ```
40
+
41
+ Respect explicit invocation preferences over stored defaults. Do not run `doctor` as a routine preflight.
42
+
43
+ ## 2. Audit and deduplicate visually
44
+
45
+ Inspect every candidate image as pixels, not just filenames, metadata, hashes, or thumbnails too small to judge. Group together:
46
+
47
+ - byte-identical files;
48
+ - alternate exports, crops, or edits of the same scene;
49
+ - images with substantially repeated subject, wardrobe, setting, composition, and concept;
50
+ - sketches, unfinished work, corrupted files, obvious mistakes, and low-quality outliers.
51
+
52
+ Keep the strongest image from each group. Prefer the first occurrence when alternatives are equivalent. Preserve retained images' relative filename order, then rotate the list to the chosen opener. Never delete, overwrite, recompress, or substitute an original source image.
53
+
54
+ Write a small plan that records the selected order, exclusions with reasons, opener, adjacent pairs including last-to-first, output path, model, dimensions, fps, and music direction. If fewer than two unique suitable images remain, stop and explain why a multi-image loop cannot be built.
55
+
56
+ ## 3. Render one anchored clip per pair
57
+
58
+ For selected images `A, B, C`, render exactly:
59
+
60
+ ```text
61
+ A -> B
62
+ B -> C
63
+ C -> A
64
+ ```
65
+
66
+ Do not render standalone image-animation clips, extra bridge clips, or multi-angle stills. This one-clip-per-pair structure prevents a scene from appearing twice.
67
+
68
+ For each pair, write one LTX-safe paragraph of 4-8 present-tense sentences:
69
+
70
+ 1. Establish the supplied starting image and its concrete visual identity.
71
+ 2. Describe restrained, believable motion for roughly the first two seconds.
72
+ 3. Connect shared lighting, color, texture, shapes, atmosphere, or camera movement into the supplied target image.
73
+ 4. State that the shot settles exactly into the supplied final image with stable identity, wardrobe, style, and composition.
74
+
75
+ Keep one continuous shot and one motion thread. Use positive phrasing. Preserve faces, bodies, clothing, layout, magazine covers, and important source text. Do not request new on-screen text, logos, anatomy, props, or intermediate scenes.
76
+
77
+ Describe ambiguous source objects with concrete positive geometry and material language. For example, call a saddle horn “one compact rounded inanimate leather saddle horn” instead of merely warning against an animal; this reduces accidental anatomy while keeping prompts positive.
78
+
79
+ Pass the exact original paths directly. Do not make normalized JPEG copies or use generated angle images as anchors:
80
+
81
+ ```bash
82
+ sogni-agent -q --video \
83
+ -m ltx23-22b-fp8_i2v_distilled \
84
+ --ref ./from-image.jpg \
85
+ --ref-end ./to-image.jpg \
86
+ --no-auto-resize-assets \
87
+ --first-frame-strength 1 --last-frame-strength 1 \
88
+ -w <width> -h <height> \
89
+ --duration 3 --token-type auto -t 600 \
90
+ -o ./working/clips/01-to-02.mp4 \
91
+ "<four-to-eight-sentence LTX transition paragraph>"
92
+ ```
93
+
94
+ The explicit no-auto-resize setting is intentional. In testing, requesting a 4:3 high-resolution canvas while leaving SDK asset auto-resizing enabled produced an unintended second resize and a `1408x1152` result; `--no-auto-resize-assets -w 1024 -h 768` preserved the intended 4:3 output. Verify the actual clip dimensions instead of trusting only the requested values.
95
+
96
+ Render independent pairs with at most two concurrent jobs when the host can track each job and preserve per-clip errors. Keep every approved clip as a frozen local file.
97
+
98
+ ### True 360 requests are a separate, unvalidated workflow
99
+
100
+ Do not advertise or label a direct single-image LTX transition as a 360 orbit. A real trial using pairwise LTX orbit prompts produced fixed-camera pose changes, hat and sheet wipes, and ordinary morphs; it did not produce sustained camera travel, coherent rear-view geometry, or background parallax.
101
+
102
+ When the user requests a true 360 wraparound, explain that Loop Maker's validated path is the anchored morph loop, not single-image novel-view synthesis. Proceed only when the user supplies coherent multi-view sources or explicitly authorizes a separate experimental angle-synthesis workflow such as `--angles-360 --angles-360-video`. That workflow generates additional intermediate views and clips, so it is not equivalent to the one-original-per-pair contract and must be audited separately.
103
+
104
+ Never count a turning subject, changing pose, zoom, crop, wipe, or morph as a camera orbit. Accept a 360 result only when sampled frames demonstrate consistent front, quarter, side, rear, opposite-side, and return viewpoints, with coherent background parallax and stable identity. If those tests fail, report that the orbit failed; do not describe the output as 360.
105
+
106
+ ## 4. Verify every clip before assembly
107
+
108
+ Extract both anchors and interior checkpoints with the safe wrappers. For a 3-second clip:
109
+
110
+ ```bash
111
+ sogni-agent --extract-first-frame ./working/clips/01-to-02.mp4 ./working/verify/01-to-02-first.png
112
+ sogni-agent --extract-frame-at ./working/clips/01-to-02.mp4 0.75 ./working/verify/01-to-02-25.png
113
+ sogni-agent --extract-frame-at ./working/clips/01-to-02.mp4 1.50 ./working/verify/01-to-02-50.png
114
+ sogni-agent --extract-frame-at ./working/clips/01-to-02.mp4 2.25 ./working/verify/01-to-02-75.png
115
+ sogni-agent --extract-last-frame ./working/clips/01-to-02.mp4 ./working/verify/01-to-02-last.png
116
+ ```
117
+
118
+ For other durations, sample roughly 25%, 50%, and 75%. Visually compare all five frames with the intended originals. Compression means endpoint pixels need not be byte-identical, but the first and last frames must perceptually match the exact supplied anchors.
119
+
120
+ Approve a clip only when:
121
+
122
+ - the first frame is the intended starting original;
123
+ - the last frame is the intended target original;
124
+ - interior motion is coherent and reaches the target rather than an invented scene;
125
+ - any requested camera movement is visible in viewpoint and background parallax rather than simulated by subject rotation or an occluder wipe;
126
+ - no unrelated or duplicate scene, face, body, animal, text, or prop appears;
127
+ - identity, wardrobe, and important composition remain stable;
128
+ - actual dimensions and orientation match the plan.
129
+
130
+ Regenerate a failing clip with a more concrete pair-specific prompt. Preserve the same source pair and output dimensions. Name failed attempts separately and limit automatic retries to two per pair. If it still fails, keep any prior verified final untouched and report the failed pair.
131
+
132
+ ## 5. Stitch exactly once
133
+
134
+ Concatenate approved pair clips in planned order, once each:
135
+
136
+ ```bash
137
+ sogni-agent --concat-videos ./working/picture-only.mp4 \
138
+ ./working/clips/01-to-02.mp4 \
139
+ ./working/clips/02-to-03.mp4 \
140
+ ./working/clips/03-to-01.mp4 \
141
+ --concat-fps 32
142
+ ```
143
+
144
+ The opener may appear at the first and final boundary only to close the loop. No retained concept or transition clip may otherwise repeat.
145
+
146
+ ## 6. Create and apply music
147
+
148
+ If the user supplies music, use that frozen local file. If the user requests `music=none`, keep the picture-only output. Otherwise derive a coherent instrumental style from the images. When no direction is given, use subtle melodic electronic music with eclectic tropical and futuristic accents, polished atmosphere, light rhythm, warm texture, and restrained energy.
149
+
150
+ Generate ACE-Step 1.5 XL Turbo music at least 6 seconds longer than the stitched picture:
151
+
152
+ ```bash
153
+ sogni-agent -q --token-type auto --music --music-model turbo \
154
+ --duration <video-seconds-plus-6-or-more> \
155
+ -o ./working/soundtrack.mp3 \
156
+ "<instrumental music direction>"
157
+ ```
158
+
159
+ Apply it without looping and align fades to the actual video ending:
160
+
161
+ ```bash
162
+ sogni-agent --remix-audio ./working/picture-only.mp4 ./sogni-loop-final.mp4 \
163
+ --bed-audio ./working/soundtrack.mp3 \
164
+ --audio-fade-in 0.35 --audio-fade-out 1.4
165
+ ```
166
+
167
+ Treat music generation as recoverable but never silently weaken the output contract. If a worker fails server-side, run `doctor` only after that failure, retry once, and reuse a previously generated soundtrack only when it is verified, stylistically suitable, and longer than the picture. Do not silently loop a short track or let it end early. If no valid track exists, preserve the approved picture-only assembly and report the music stage as incomplete instead of presenting it as the requested final.
168
+
169
+ ## 7. Final verification, cleanup, and handoff
170
+
171
+ Extract and visually compare the final first and last frames, then verify streams and a full decode:
172
+
173
+ ```bash
174
+ sogni-agent --extract-first-frame ./sogni-loop-final.mp4 ./working/verify/final-first.png
175
+ sogni-agent --extract-last-frame ./sogni-loop-final.mp4 ./working/verify/final-last.png
176
+ sogni-agent --verify-video ./sogni-loop-final.mp4 --json
177
+ ```
178
+
179
+ Confirm that:
180
+
181
+ - every retained visual concept appears once;
182
+ - every approved transition clip appears once;
183
+ - all adjacent pairs use the correct original first and last frames;
184
+ - the final boundary perceptually matches the opening original;
185
+ - size and fps are consistent;
186
+ - the soundtrack is longer than and covers the complete picture without looping;
187
+ - the final MP4 contains valid video and audio streams unless `music=none` was requested;
188
+ - the entire file decodes successfully.
189
+
190
+ Only after the final passes, move generated failed clips, obsolete assemblies, superseded finals, and disposable verification stills to Trash so they remain recoverable. Preserve original images, the final output, the soundtrack, the plan, and approved clips unless the user explicitly requests deeper cleanup.
191
+
192
+ Return a clickable absolute path to the final video plus duration, dimensions, fps, unique-scene count, music status, and any excluded-image summary.
@@ -26,6 +26,9 @@ dimensions. "high quality" / "best quality" / "pro" → `-Q pro`; quick drafts
26
26
  | `flux1-schnell-fp8` | Very fast | Quick iterations |
27
27
  | `flux2_dev_fp8` | Slow (~2min) | High quality |
28
28
  | `krea2_turbo_fp8_scaled` | Fast | Krea 2 Turbo text-to-image, fast high-quality generations with strong prompt adherence |
29
+ | `dark_beast_krea2_fp8` | Fast | Dark Beast Krea 2 community text-to-image fine-tune |
30
+ | `krea2_identity_edit_v1_2` | Fast | Krea 2 Identity Edit LoRA v1.2, identity-preserving edits with 1-2 references |
31
+ | `dark_beast_krea2_identity_edit_v1_2` | Fast | Dark Beast Krea 2 Identity Edit community LoRA with 1-2 references |
29
32
  | `chroma-v.46-flash_fp8` | Medium | Balanced |
30
33
  | `qwen_image_edit_2511_fp8` | Medium | Image editing with context (up to 3), strongest preservation |
31
34
  | `qwen_image_edit_2511_fp8_lightning` | Fast | Quick image editing (default for `-c`) |
@@ -35,11 +38,17 @@ For Krea 2 Turbo, hosted/chat planning may use the creative-agent selector
35
38
  `krea-2-turbo`; direct CLI `-m` uses the worker model ID
36
39
  `krea2_turbo_fp8_scaled`.
37
40
 
41
+ For identity-preserving Krea edits, pass a context image with
42
+ `-m krea2_identity_edit_v1_2` or
43
+ `-m dark_beast_krea2_identity_edit_v1_2`. These edit models support 1-2
44
+ context images, 512-2048 px output, 8-12 steps, and guidance 1; the default
45
+ is 10 steps.
46
+
38
47
  `gpt-image-2` supports flexible OpenAI image sizes up to `3840px` on either
39
48
  edge, max `3:1` aspect ratio, and total pixels from `655,360` through
40
49
  `8,294,400`; the API snaps dimensions to valid multiples of 16. For image
41
50
  editing with `gpt-image-2`, you can pass up to 16 context images (Qwen models
42
- support up to 3).
51
+ support up to 3; Krea identity edit models support up to 2).
43
52
 
44
53
  ## Music models
45
54
 
@@ -161,6 +170,9 @@ and short in-scene text.
161
170
  | OpenAI GPT Image generation, editing, or strong text rendering | `gpt-image-2` |
162
171
  | Highest-quality images | `flux2_dev_fp8` (or `-Q pro`) |
163
172
  | Image editing | `qwen_image_edit_2511_fp8_lightning` |
173
+ | Dark Beast Krea 2 images | `dark_beast_krea2_fp8` |
174
+ | Identity-preserving Krea image edits | `krea2_identity_edit_v1_2` |
175
+ | Uncensored identity-preserving Krea edits | `dark_beast_krea2_identity_edit_v1_2` |
164
176
  | Photobooth face transfer | `coreml-sogniXLturbo_alpha1_ad` |
165
177
  | Direct music generation | `ace_step_1.5_xl_turbo` (or `--music-model turbo`) |
166
178
  | Music with stronger lyric handling | `ace_step_1.5_xl_sft` (or `--music-model sft`) |
@@ -25,6 +25,8 @@ Edit, restore, restyle, refine, or change the camera angle of an existing image.
25
25
  ## Constraints
26
26
 
27
27
  - Persona images must always be produced with `edit_image` and a reference photo — never invoke `generate_image` for persona output.
28
+ - Use `-m krea2_identity_edit_v1_2` for identity-preserving Krea 2 edits with 1-2 context images; use `-m dark_beast_krea2_identity_edit_v1_2` for the Dark Beast Krea 2 identity edit LoRA. Both support 512-2048 px output, 8-12 steps, guidance 1, and default to 10 steps.
29
+ - Qwen Image Edit supports up to 3 context images, GPT Image 2 supports up to 16, and Krea identity edit models support up to 2.
28
30
  - `refine_result` acts on a prior generation in the session; do not call it before any image has been produced or uploaded.
29
31
  - For source-preserving style edits such as "anime version of this image", "keep everything the same", or requests that preserve pose, clothing, background, framing, or composition, use image editing with the provided image as context. Do not switch to photobooth/face-transfer just because the user asks to preserve the face.
30
32
  - Photobooth/face-transfer is for generating a new portrait from a face reference. It is not full-image editing and may change pose, clothing, background, framing, and composition.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: image_generation
3
- description: Text-to-image synthesis with Z-Image, Krea 2, Flux, Qwen, and GPT Image 2 models.
3
+ description: Text-to-image synthesis with Z-Image, Krea 2, Dark Beast Krea 2, Flux, Qwen, and GPT Image 2 models.
4
4
  always_loaded: false
5
5
  tool_names:
6
6
  - generate_image
@@ -8,7 +8,7 @@ tool_names:
8
8
 
9
9
  # Image generation
10
10
 
11
- Text-to-image synthesis with the current Sogni image stack (Z-Image, Krea 2, Flux, Qwen, and GPT Image 2). Use when the user wants a new image generated from a prompt with no source asset.
11
+ Text-to-image synthesis with the current Sogni image stack (Z-Image, Krea 2, Dark Beast Krea 2, Flux, Qwen, and GPT Image 2). Use when the user wants a new image generated from a prompt with no source asset.
12
12
 
13
13
  ## Tools
14
14
 
@@ -18,6 +18,7 @@ Text-to-image synthesis with the current Sogni image stack (Z-Image, Krea 2, Flu
18
18
 
19
19
  - Use natural-language descriptions (subject, setting, composition, lighting, style) for the next-gen models (Krea 2, Z-Image, Flux, Qwen) rather than keyword lists.
20
20
  - Krea 2 favors long, detailed prompts but also handles short ones; to render text in the image, wrap the exact words in quotes (e.g. a sign reading "OPEN").
21
+ - Use `-m dark_beast_krea2_fp8` when the user explicitly requests Dark Beast Krea 2 or the uncensored community Krea 2 fine-tune.
21
22
  - The app applies model-specific prompt-enhancement automatically — pass the user's intent faithfully and avoid empty quality-booster spam.
22
23
 
23
24
  ## Constraints
@@ -0,0 +1,8 @@
1
+ ---
2
+ name: loop-maker
3
+ description: Turn a folder of images into a polished, music-backed seamless loop using visually deduplicated source frames and direct LTX first-frame/last-frame transitions. Invoke as $sogni-creative-agent:loop-maker with the image folder and optional start, music, output, pacing, or aspect preferences. Use for a one-click image-folder reel, animated photo loop, looping montage, or slideshow where every image animates briefly before morphing into the next. Do not use it for true 360 novel-view synthesis.
4
+ ---
5
+
6
+ # Sogni Loop Maker
7
+
8
+ Read `../../plugin-skills/loop-maker/SKILL.md` relative to this installed file completely and follow it. Resolve every subsequent plugin path from the plugin root two directories above this file, never from the user's working directory.
@@ -0,0 +1,7 @@
1
+ interface:
2
+ display_name: "Sogni Loop Maker"
3
+ short_description: "Turn an image folder into a seamless video loop"
4
+ default_prompt: "Use $loop-maker to turn my image folder into a polished, music-backed seamless loop."
5
+
6
+ policy:
7
+ allow_implicit_invocation: true
@@ -0,0 +1,8 @@
1
+ ---
2
+ name: sogni-creative-agent
3
+ description: Generate and edit images, video, and music using Sogni AI's decentralized GPU network. Use for image generation or editing, first-frame/last-frame animation, video generation, music and soundtrack creation, personas, style transfer, and other Sogni Creative Agent workflows.
4
+ ---
5
+
6
+ # Sogni Creative Agent
7
+
8
+ Read `../../plugin-skills/sogni-creative-agent/SKILL.md` relative to this installed file completely and follow it. Resolve every subsequent plugin path from the plugin root two directories above this file, never from the user's working directory.
package/sogni-agent.mjs CHANGED
@@ -1249,6 +1249,25 @@ function isGptImage2ModelSelection(modelId) {
1249
1249
  return ['gpt-image-2', 'gptimage2', 'gpt-image', 'gpt_image_2'].includes(normalized);
1250
1250
  }
1251
1251
 
1252
+ const KREA2_IDENTITY_EDIT_MODELS = new Set([
1253
+ 'krea2_identity_edit_v1_2',
1254
+ 'dark_beast_krea2_identity_edit_v1_2'
1255
+ ]);
1256
+
1257
+ function isKrea2IdentityEditModelSelection(modelId) {
1258
+ return KREA2_IDENTITY_EDIT_MODELS.has(String(modelId || '').trim().toLowerCase());
1259
+ }
1260
+
1261
+ function getKrea2IdentityEditDefaults(modelId) {
1262
+ if (!isKrea2IdentityEditModelSelection(modelId)) return null;
1263
+ return {
1264
+ steps: 10,
1265
+ guidance: 1,
1266
+ sampler: 'euler',
1267
+ scheduler: 'simple'
1268
+ };
1269
+ }
1270
+
1252
1271
  function normalizeMusicModelId(value) {
1253
1272
  const raw = String(value || '').trim();
1254
1273
  if (!raw) return null;
@@ -1337,6 +1356,7 @@ function happyHorseModeFromModelId(modelId) {
1337
1356
 
1338
1357
  function getMaxContextImages(modelId) {
1339
1358
  if (isGptImage2ModelSelection(modelId)) return 16;
1359
+ if (isKrea2IdentityEditModelSelection(modelId)) return 2;
1340
1360
  return getWrapperMaxContextImages(modelId);
1341
1361
  }
1342
1362
 
@@ -1866,6 +1886,10 @@ const options = {
1866
1886
  concatFps: null, // --concat-fps <n>: override target fps for concat normalization
1867
1887
  extractFirstFrame: null, // --extract-first-frame <video> <image>
1868
1888
  extractFirstFrameOutput: null,
1889
+ extractFrameAt: null, // --extract-frame-at <video> <seconds> <image>
1890
+ extractFrameAtSeconds: null,
1891
+ extractFrameAtOutput: null,
1892
+ verifyVideo: null, // --verify-video <video>: probe streams and decode the full file
1869
1893
  sourceReelDir: null, // --source-reel <image-folder>: animate folder images into a stitched video
1870
1894
  sourceReelImageSeconds: 3,
1871
1895
  sourceReelTransitionSeconds: 3,
@@ -2463,6 +2487,20 @@ for (let i = 0; i < args.length; i++) {
2463
2487
  i++;
2464
2488
  options.extractFirstFrame = videoArg;
2465
2489
  options.extractFirstFrameOutput = imageArg;
2490
+ } else if (arg === '--extract-frame-at') {
2491
+ const videoArg = requireFlagValue(args, i, arg);
2492
+ i++;
2493
+ const secondsRaw = requireFlagValue(args, i, arg + ' (seconds)');
2494
+ i++;
2495
+ const imageArg = requireFlagValue(args, i, arg + ' (output image)');
2496
+ i++;
2497
+ options.extractFrameAt = videoArg;
2498
+ options.extractFrameAtSeconds = parseNonNegativeNumberValue(secondsRaw, arg + ' (seconds)');
2499
+ options.extractFrameAtOutput = imageArg;
2500
+ } else if (arg === '--verify-video') {
2501
+ const raw = requireFlagValue(args, i, arg);
2502
+ i++;
2503
+ options.verifyVideo = raw;
2466
2504
  } else if (arg === '--source-reel' || arg === '--image-reel') {
2467
2505
  const raw = expandHomePath(requireFlagValue(args, i, arg));
2468
2506
  i++;
@@ -3036,6 +3074,8 @@ General:
3036
3074
  self-update Upgrade sogni-agent in place (npm/pnpm/yarn/bun auto-detected)
3037
3075
  --extract-last-frame <video> <image> Extract last frame from a video (safe ffmpeg wrapper)
3038
3076
  --extract-first-frame <video> <image> Extract first frame from a video (safe ffmpeg wrapper)
3077
+ --extract-frame-at <video> <sec> <image> Extract a timestamped frame (safe ffmpeg wrapper)
3078
+ --verify-video <video> Verify streams and fully decode a video (safe ffmpeg/ffprobe wrapper)
3039
3079
  --concat-videos <out> <clips...> Concatenate video clips (safe ffmpeg wrapper, min 2 clips).
3040
3080
  Normalizes fps/size and fills silent audio so mismatched clips stitch cleanly.
3041
3081
  --concat-fps <n> Override target fps for --concat-videos (default: highest clip fps)
@@ -3085,6 +3125,9 @@ Image Models:
3085
3125
  z_image_turbo_bf16 Fast, general purpose (default)
3086
3126
  gpt-image-2 OpenAI GPT Image 2 text-to-image and edit (up to 16 context images)
3087
3127
  krea2_turbo_fp8_scaled Krea 2 Turbo text-to-image
3128
+ dark_beast_krea2_fp8 Dark Beast Krea 2 text-to-image
3129
+ krea2_identity_edit_v1_2 Krea 2 Identity Edit LoRA (up to 2 context images)
3130
+ dark_beast_krea2_identity_edit_v1_2 Dark Beast Krea 2 Identity Edit (up to 2 context images)
3088
3131
  flux1-schnell-fp8 Very fast
3089
3132
  flux2_dev_fp8 High quality (slow)
3090
3133
  qwen_image_edit_2511_fp8 Image editing with context (up to 3 images)
@@ -3157,6 +3200,7 @@ Examples:
3157
3200
  sogni-agent --video --ref subject.jpg --ref-video motion.mp4 --workflow animate-move "transfer motion"
3158
3201
  sogni-agent --video --last-image "gentle camera pan"
3159
3202
  sogni-agent -c photo.jpg "make the background a beach" -m qwen_image_edit_2511_fp8
3203
+ sogni-agent -c person.jpg -m krea2_identity_edit_v1_2 "editorial portrait, same identity, new wardrobe"
3160
3204
  sogni-agent -c subject.jpg -c style.jpg "apply the style to the subject"
3161
3205
  sogni-agent --photobooth --ref face.jpg "80s fashion portrait"
3162
3206
  sogni-agent --photobooth --ref face.jpg -n 4 "LinkedIn professional headshot"
@@ -3742,7 +3786,7 @@ if (options.music) {
3742
3786
  options.timeout = 60000;
3743
3787
  }
3744
3788
  } else if (options.contextImages.length > 0) {
3745
- // Use qwen edit model when context images provided (unless model explicitly set)
3789
+ // Use the default edit model when context images are provided unless -m overrides it.
3746
3790
  options.model = options.model || openclawConfig?.defaultEditModel || 'qwen_image_edit_2511_fp8_lightning';
3747
3791
  if (!cliSet.timeout && !timeoutFromConfig && options.timeout === 30000) {
3748
3792
  options.timeout = 60000; // 1 min for editing
@@ -3835,6 +3879,8 @@ const commandUsesGenerationSeed = !options.apiChat &&
3835
3879
  !options.doctor &&
3836
3880
  !options.extractLastFrame &&
3837
3881
  !options.extractFirstFrame &&
3882
+ !options.extractFrameAt &&
3883
+ !options.verifyVideo &&
3838
3884
  !options.concatVideos &&
3839
3885
  !options.sourceReelDir &&
3840
3886
  !options.remixAudio &&
@@ -3853,7 +3899,7 @@ if (apiWorkflowStartAction && apiWorkflowTemplate === 'storyboard_video' && !opt
3853
3899
  if (typeof options.prompt === 'string' && options.prompt.trim() === '') {
3854
3900
  options.prompt = '';
3855
3901
  }
3856
- if (!options.prompt && !options.apiChat && !apiWorkflowUtilityAction && !apiWorkflowStartAction && !apiModelUtilityAction && !apiReplayUtilityAction && !contractUtilityAction && !storyboardPlanUtilityAction && !options.estimateVideoCost && !options.multiAngle && !options.showBalance && !options.showVersion && !options.doctor && !options.extractLastFrame && !options.extractFirstFrame && !options.concatVideos && !options.sourceReelDir && !options.remixAudio && !options.listMedia && !options.memoryAction && !options.personalityAction && !personaUtilityAction) {
3902
+ if (!options.prompt && !options.apiChat && !apiWorkflowUtilityAction && !apiWorkflowStartAction && !apiModelUtilityAction && !apiReplayUtilityAction && !contractUtilityAction && !storyboardPlanUtilityAction && !options.estimateVideoCost && !options.multiAngle && !options.showBalance && !options.showVersion && !options.doctor && !options.extractLastFrame && !options.extractFirstFrame && !options.extractFrameAt && !options.verifyVideo && !options.concatVideos && !options.sourceReelDir && !options.remixAudio && !options.listMedia && !options.memoryAction && !options.personalityAction && !personaUtilityAction) {
3857
3903
  fatalCliError('No prompt provided. Use --help for usage.', { code: 'INVALID_ARGUMENT' });
3858
3904
  }
3859
3905
 
@@ -4312,7 +4358,7 @@ if (options.contextImages.length > 0 && !options.video) {
4312
4358
  fatalCliError(`Model ${options.model} does not support context images.`, {
4313
4359
  code: 'INVALID_ARGUMENT',
4314
4360
  details: { model: options.model },
4315
- hint: 'Try: qwen_image_edit_2511_fp8 or qwen_image_edit_2511_fp8_lightning'
4361
+ hint: 'Try: qwen_image_edit_2511_fp8, qwen_image_edit_2511_fp8_lightning, krea2_identity_edit_v1_2, or dark_beast_krea2_identity_edit_v1_2'
4316
4362
  });
4317
4363
  }
4318
4364
  if (options.contextImages.length > maxImages) {
@@ -7396,6 +7442,34 @@ async function extractFirstFrameFromVideo(videoPath, outputImagePath) {
7396
7442
  await runFrameExtraction(args, { videoPath, outputImagePath, which: 'first' });
7397
7443
  }
7398
7444
 
7445
+ async function extractFrameAtTimeFromVideo(videoPath, seconds, outputImagePath) {
7446
+ sanitizePath(videoPath, 'video path');
7447
+ sanitizePath(outputImagePath, 'output image path');
7448
+ const timestamp = Number(seconds);
7449
+ if (!Number.isFinite(timestamp) || timestamp < 0) {
7450
+ const err = new Error('Frame extraction timestamp must be a non-negative number.');
7451
+ err.code = 'INVALID_ARGUMENT';
7452
+ throw err;
7453
+ }
7454
+
7455
+ // Seek after opening the input for frame-accurate visual QA. Loop Maker
7456
+ // clips are short, so accuracy is more useful here than keyframe-only speed.
7457
+ const args = [
7458
+ '-i', videoPath,
7459
+ '-ss', String(timestamp),
7460
+ '-frames:v', '1',
7461
+ '-q:v', '1',
7462
+ '-y',
7463
+ outputImagePath
7464
+ ];
7465
+
7466
+ await runFrameExtraction(args, {
7467
+ videoPath,
7468
+ outputImagePath,
7469
+ which: `frame at ${timestamp}s`
7470
+ });
7471
+ }
7472
+
7399
7473
  function parseFrameRate(raw) {
7400
7474
  if (typeof raw === 'number') return Number.isFinite(raw) && raw > 0 ? raw : null;
7401
7475
  if (typeof raw !== 'string') return null;
@@ -7410,15 +7484,23 @@ function parseFrameRate(raw) {
7410
7484
  }
7411
7485
 
7412
7486
  // Probe a media file's primary video stream + whether it has any audio.
7413
- // Returns { width, height, fps, duration, hasAudio }. Fields are null when the
7414
- // probe fails (e.g. ffprobe missing); callers fall back to safe defaults.
7487
+ // Fields are null when the probe fails (e.g. ffprobe missing); callers fall
7488
+ // back to safe defaults unless they explicitly require verification.
7415
7489
  async function probeVideoStreamInfo(filePath) {
7416
- const info = { width: null, height: null, fps: null, duration: null, hasAudio: false };
7490
+ const info = {
7491
+ width: null,
7492
+ height: null,
7493
+ fps: null,
7494
+ duration: null,
7495
+ hasAudio: false,
7496
+ videoCodec: null,
7497
+ audioCodec: null
7498
+ };
7417
7499
  const ffprobePath = getEnv('FFPROBE_PATH') || 'ffprobe';
7418
7500
  sanitizePath(ffprobePath, 'FFPROBE_PATH');
7419
7501
  const result = await runCommand(ffprobePath, [
7420
7502
  '-v', 'error',
7421
- '-show_entries', 'stream=codec_type,width,height,avg_frame_rate,r_frame_rate',
7503
+ '-show_entries', 'stream=codec_type,codec_name,width,height,avg_frame_rate,r_frame_rate',
7422
7504
  '-show_entries', 'format=duration',
7423
7505
  '-of', 'json',
7424
7506
  filePath,
@@ -7428,17 +7510,57 @@ async function probeVideoStreamInfo(filePath) {
7428
7510
  try { parsed = JSON.parse(result.stdout || '{}'); } catch { return info; }
7429
7511
  const streams = Array.isArray(parsed.streams) ? parsed.streams : [];
7430
7512
  const video = streams.find((s) => s.codec_type === 'video');
7431
- info.hasAudio = streams.some((s) => s.codec_type === 'audio');
7513
+ const audio = streams.find((s) => s.codec_type === 'audio');
7514
+ info.hasAudio = Boolean(audio);
7432
7515
  if (video) {
7433
7516
  info.width = Number(video.width) || null;
7434
7517
  info.height = Number(video.height) || null;
7435
7518
  info.fps = parseFrameRate(video.avg_frame_rate) || parseFrameRate(video.r_frame_rate) || null;
7519
+ info.videoCodec = video.codec_name || null;
7436
7520
  }
7521
+ info.audioCodec = audio?.codec_name || null;
7437
7522
  const dur = Number(parsed?.format?.duration);
7438
7523
  info.duration = Number.isFinite(dur) && dur > 0 ? dur : null;
7439
7524
  return info;
7440
7525
  }
7441
7526
 
7527
+ async function verifyVideoFile(videoPath) {
7528
+ sanitizePath(videoPath, 'video path');
7529
+ const info = await probeVideoStreamInfo(videoPath);
7530
+ if (!info.videoCodec || !info.width || !info.height || !info.fps || !info.duration) {
7531
+ const err = new Error('Failed to read a valid video stream with ffprobe.');
7532
+ err.code = 'FFPROBE_VERIFY_FAILED';
7533
+ err.hint = 'Install ffprobe, confirm the file is a playable video, and retry.';
7534
+ err.details = { videoPath, ...info };
7535
+ throw err;
7536
+ }
7537
+
7538
+ const ffmpegPath = await ensureFfmpegAvailable();
7539
+ const result = await runCommand(ffmpegPath, [
7540
+ '-hide_banner',
7541
+ '-loglevel', 'error',
7542
+ '-i', videoPath,
7543
+ '-map', '0:v:0',
7544
+ '-map', '0:a?',
7545
+ '-f', 'null',
7546
+ '-'
7547
+ ], { captureOutput: true });
7548
+ if (result.error || result.status !== 0) {
7549
+ const err = new Error('Video stream verification failed during full decode.');
7550
+ err.code = 'FFMPEG_VERIFY_FAILED';
7551
+ err.hint = 'Keep the prior verified output and rebuild this file before delivery.';
7552
+ err.details = {
7553
+ videoPath,
7554
+ status: result.status,
7555
+ stderr: result.stderr || '',
7556
+ stdout: result.stdout || ''
7557
+ };
7558
+ throw err;
7559
+ }
7560
+
7561
+ return { ...info, decodable: true };
7562
+ }
7563
+
7442
7564
  // Concatenate clips using the concat *filter* (not the concat demuxer). The
7443
7565
  // demuxer corrupts timestamps when clips differ in fps/timebase and desyncs
7444
7566
  // audio when a clip has no audio track. Here we probe each clip, normalize every
@@ -9000,6 +9122,58 @@ async function main() {
9000
9122
  return;
9001
9123
  }
9002
9124
 
9125
+ if (options.extractFrameAt) {
9126
+ const videoPath = sanitizePath(options.extractFrameAt, '--extract-frame-at video');
9127
+ const outputPath = sanitizePath(options.extractFrameAtOutput, '--extract-frame-at output');
9128
+ if (!existsSync(videoPath)) {
9129
+ const err = new Error(`Video file not found: ${videoPath}`);
9130
+ err.code = 'FILE_NOT_FOUND';
9131
+ throw err;
9132
+ }
9133
+ await extractFrameAtTimeFromVideo(videoPath, options.extractFrameAtSeconds, outputPath);
9134
+ if (options.json || JSON_ERROR_MODE) {
9135
+ console.log(JSON.stringify({
9136
+ success: true,
9137
+ type: 'extract-frame-at',
9138
+ seconds: options.extractFrameAtSeconds,
9139
+ outputPath,
9140
+ timestamp: new Date().toISOString()
9141
+ }));
9142
+ } else {
9143
+ console.log(`Extracted frame at ${options.extractFrameAtSeconds}s to: ${outputPath}`);
9144
+ }
9145
+ return;
9146
+ }
9147
+
9148
+ if (options.verifyVideo) {
9149
+ const videoPath = sanitizePath(options.verifyVideo, '--verify-video input');
9150
+ if (!existsSync(videoPath)) {
9151
+ const err = new Error(`Video file not found: ${videoPath}`);
9152
+ err.code = 'FILE_NOT_FOUND';
9153
+ throw err;
9154
+ }
9155
+ const verification = await verifyVideoFile(videoPath);
9156
+ if (options.json || JSON_ERROR_MODE) {
9157
+ console.log(JSON.stringify({
9158
+ success: true,
9159
+ type: 'verify-video',
9160
+ videoPath,
9161
+ ...verification,
9162
+ timestamp: new Date().toISOString()
9163
+ }));
9164
+ } else {
9165
+ const audio = verification.hasAudio
9166
+ ? `audio=${verification.audioCodec || 'present'}`
9167
+ : 'audio=none';
9168
+ console.log(
9169
+ `Verified video: ${videoPath} ` +
9170
+ `(${verification.width}x${verification.height}, ${verification.fps} fps, ` +
9171
+ `${verification.duration.toFixed(3)}s, video=${verification.videoCodec}, ${audio})`
9172
+ );
9173
+ }
9174
+ return;
9175
+ }
9176
+
9003
9177
  if (options.concatVideos) {
9004
9178
  const outputPath = sanitizePath(options.concatVideos, '--concat-videos output');
9005
9179
  const clips = options.concatVideosClips.map((c, i) => sanitizePath(c, `clip[${i}]`));
@@ -9776,7 +9950,8 @@ async function main() {
9776
9950
  const contextBuffers = await Promise.all(
9777
9951
  options.contextImages.map(img => fetchMediaBuffer(img))
9778
9952
  );
9779
- const modelDefaults = getModelDefaults(options.model, openclawConfig);
9953
+ const modelDefaults = getModelDefaults(options.model, openclawConfig)
9954
+ ?? getKrea2IdentityEditDefaults(options.model);
9780
9955
  const steps = options.steps ?? modelDefaults?.steps ?? (options.model.includes('lightning') ? 4 : 20);
9781
9956
  const guidance = options.guidance ?? modelDefaults?.guidance ?? (options.model.includes('lightning') ? 3.5 : 7.5);
9782
9957
  const gptImageQuality = isGptImage2ModelSelection(options.model)
@@ -9806,11 +9981,11 @@ async function main() {
9806
9981
  if (gptImageQuality) {
9807
9982
  editConfig.gptImageQuality = gptImageQuality;
9808
9983
  }
9809
- if (options.sampler) {
9810
- editConfig.sampler = options.sampler;
9984
+ if (options.sampler || modelDefaults?.sampler) {
9985
+ editConfig.sampler = options.sampler || modelDefaults.sampler;
9811
9986
  }
9812
- if (options.scheduler) {
9813
- editConfig.scheduler = options.scheduler;
9987
+ if (options.scheduler || modelDefaults?.scheduler) {
9988
+ editConfig.scheduler = options.scheduler || modelDefaults.scheduler;
9814
9989
  }
9815
9990
  if (options.loras.length > 0) {
9816
9991
  editConfig.loras = options.loras;
@@ -0,0 +1,201 @@
1
+ /**
2
+ * Sogni Hosted Client Factory (Phase 6 P0).
3
+ *
4
+ * Wraps the SDK-backed client re-exported by
5
+ * `@sogni-ai/sogni-intelligence-client` for the durable hosted workflow +
6
+ * chat surfaces the skill needs, while preserving the skill's SSRF guard
7
+ * contract.
8
+ *
9
+ * The skill historically called these endpoints via `fetchApiJson` ->
10
+ * `buildSafeApiUrl` -> `assertSafeUrl`. Migrating to the SDK directly
11
+ * would lose the SSRF check because `SogniClient.createInstance`
12
+ * accepts an arbitrary `restEndpoint`. This factory closes the gap:
13
+ * - Validate the resolved REST + Socket endpoints via `assertSafeUrl`
14
+ * **before** constructing the client.
15
+ * - Pin the resolved endpoint on the client so subsequent SDK calls
16
+ * can't be redirected to an unsafe host.
17
+ * - Expose a narrow `withClient(apiKey, work)` pattern that
18
+ * constructs + disposes the SDK client per task, mirroring the
19
+ * short-lived per-request shape the skill already used for fetch.
20
+ *
21
+ * Opt-in: callers receive the factory only when
22
+ * `SOGNI_SKILL_USE_SDK_TRANSPORT` is truthy. The legacy fetch path
23
+ * remains the default until the durable chat run methods are
24
+ * battle-tested in production.
25
+ */
26
+ import { createRequire } from 'node:module';
27
+ import { assertSafeUrl } from './ssrf-guard.mjs';
28
+
29
+ const require = createRequire(import.meta.url);
30
+ const { SogniClient } = require('@sogni-ai/sogni-intelligence-client');
31
+
32
+ function readBoolEnv(name) {
33
+ const raw = process.env[name];
34
+ if (!raw) return false;
35
+ const value = String(raw).trim().toLowerCase();
36
+ return value === '1' || value === 'true' || value === 'yes' || value === 'on';
37
+ }
38
+
39
+ /**
40
+ * Returns true when the skill should route hosted operations through
41
+ * the SDK transport. Default: false. Operators opt in via
42
+ * `SOGNI_SKILL_USE_SDK_TRANSPORT=1` once they've validated the SDK
43
+ * path in their environment.
44
+ */
45
+ export function shouldUseSdkTransport() {
46
+ return readBoolEnv('SOGNI_SKILL_USE_SDK_TRANSPORT');
47
+ }
48
+
49
+ /**
50
+ * Validate the resolved API endpoint via the SSRF guard.
51
+ *
52
+ * Accepts `restEndpoint` (https://api.sogni.ai) and `socketEndpoint`
53
+ * (wss://socket.sogni.ai) shaped values. Throws when either fails the
54
+ * guard so the caller can fall back to the legacy fetch path or abort
55
+ * cleanly.
56
+ */
57
+ export async function assertSafeSogniEndpoints({ restEndpoint, socketEndpoint }) {
58
+ if (restEndpoint) await assertSafeUrl(restEndpoint);
59
+ if (socketEndpoint) {
60
+ // assertSafeUrl validates `http(s)` schemes; convert ws(s) → https for
61
+ // host/IP resolution checks. The actual websocket connection still
62
+ // uses the original scheme.
63
+ const httpsEquivalent = socketEndpoint.replace(/^ws/i, 'http');
64
+ await assertSafeUrl(httpsEquivalent);
65
+ }
66
+ }
67
+
68
+ /**
69
+ * Construct a managed `SogniClient` for the duration of `work`. Disposes
70
+ * the socket connection on completion (matching the per-request shape
71
+ * the skill already used for fetch). The skill is short-lived enough
72
+ * that pooling isn't required; the API process owns long-running pools
73
+ * via `SogniClientSessionService`.
74
+ */
75
+ export async function withHostedClient({ apiKey, restEndpoint, socketEndpoint, appSource, appId }, work) {
76
+ await assertSafeSogniEndpoints({ restEndpoint, socketEndpoint });
77
+ const client = await SogniClient.createInstance({
78
+ appId: appId ?? `sogni-skill-${process.pid}-${Date.now()}`,
79
+ apiKey,
80
+ appSource: appSource ?? 'sogni-creative-agent-skill',
81
+ logLevel: 'error',
82
+ ...(restEndpoint ? { restEndpoint } : {}),
83
+ ...(socketEndpoint ? { socketEndpoint } : {}),
84
+ socketEventSubscriptions: { modelAvailability: false }
85
+ });
86
+ try {
87
+ return await work(client);
88
+ } finally {
89
+ try {
90
+ client.dispose();
91
+ } catch {
92
+ // Best-effort dispose; do not mask the original error.
93
+ }
94
+ }
95
+ }
96
+
97
+ /**
98
+ * Helper: start a durable creative workflow via the SDK and return the
99
+ * resulting record. Caller is responsible for SSRF endpoint validation;
100
+ * the factory handles that via `withHostedClient`.
101
+ */
102
+ export async function sdkStartCreativeWorkflow(client, input, options = {}) {
103
+ return client.workflows.start(input, options);
104
+ }
105
+
106
+ export async function sdkGetCreativeWorkflow(client, workflowId) {
107
+ return client.workflows.get(workflowId);
108
+ }
109
+
110
+ export async function sdkListCreativeWorkflows(client, options = {}) {
111
+ return client.workflows.list(options);
112
+ }
113
+
114
+ export async function sdkListCreativeWorkflowEvents(client, workflowId) {
115
+ return client.workflows.events(workflowId);
116
+ }
117
+
118
+ export async function sdkCancelCreativeWorkflow(client, workflowId) {
119
+ return client.workflows.cancel(workflowId);
120
+ }
121
+
122
+ /**
123
+ * SSE iterator wrapper. The underlying SDK iterator yields parsed
124
+ * `CreativeWorkflowSseEvent`s; the skill's UI loop already knows how
125
+ * to interpret them, so we forward as-is.
126
+ */
127
+ export async function* sdkStreamCreativeWorkflowEvents(client, workflowId, options = {}) {
128
+ yield* client.workflows.streamEvents(workflowId, options);
129
+ }
130
+
131
+ /**
132
+ * Synchronous hosted chat completion. Mirrors the
133
+ * `POST /v1/chat/completions` REST surface but goes through the SDK so
134
+ * the SSRF guard runs at client construction and the SDK's typed
135
+ * `HostedChatCompletionParams` shape is enforced. Returns the raw
136
+ * `HostedChatCompletionResult` so the skill's existing extractors
137
+ * (`extractChatMessage`, `extractChatWorkflows`) keep working.
138
+ */
139
+ export async function sdkChatHostedCreate(client, params) {
140
+ return client.chat.hosted.create(params);
141
+ }
142
+
143
+ /**
144
+ * Submit a durable hosted chat run. Returns the persisted record
145
+ * immediately; the executor drives the LLM/tool loop server-side.
146
+ */
147
+ export async function sdkChatRunsCreate(client, params) {
148
+ return client.chat.runs.create(params);
149
+ }
150
+
151
+ export async function sdkChatRunsGet(client, runId) {
152
+ return client.chat.runs.get(runId);
153
+ }
154
+
155
+ export async function sdkChatRunsCancel(client, runId, reason) {
156
+ return client.chat.runs.cancel(runId, reason);
157
+ }
158
+
159
+ /**
160
+ * SSE iterator for durable chat run events. Honors `lastEventId` in
161
+ * `options` so callers can resume after disconnect via Last-Event-ID
162
+ * replay.
163
+ */
164
+ export async function* sdkChatRunsStreamEvents(client, runId, options = {}) {
165
+ yield* client.chat.runs.streamEvents(runId, options);
166
+ }
167
+
168
+ /**
169
+ * Image asset upload URL. Mirrors `GET /v1/image/uploadUrl` and
170
+ * returns the presigned URL string. Params shape:
171
+ * { imageId, jobId, type: 'referenceImage'|'referenceImageEnd'|'contextImageN'|..., contentType? }
172
+ *
173
+ * Returns the URL string the caller should `PUT` the asset to.
174
+ */
175
+ export async function sdkImageUploadUrl(client, params) {
176
+ return client.projects.uploadUrl(params);
177
+ }
178
+
179
+ /**
180
+ * Image asset download URL. Mirrors `GET /v1/image/downloadUrl`.
181
+ */
182
+ export async function sdkImageDownloadUrl(client, params) {
183
+ return client.projects.downloadUrl(params);
184
+ }
185
+
186
+ /**
187
+ * Media (audio/video) asset upload URL. Mirrors `GET /v1/media/uploadUrl`.
188
+ * Params shape:
189
+ * { id?, jobId, type: 'referenceAudio'|'referenceVideo'|..., contentType? }
190
+ */
191
+ export async function sdkMediaUploadUrl(client, params) {
192
+ return client.projects.mediaUploadUrl(params);
193
+ }
194
+
195
+ /**
196
+ * Media (audio/video) asset download URL. Mirrors
197
+ * `GET /v1/media/downloadUrl`.
198
+ */
199
+ export async function sdkMediaDownloadUrl(client, params) {
200
+ return client.projects.mediaDownloadUrl(params);
201
+ }
package/version.mjs CHANGED
@@ -1 +1 @@
1
- export const PACKAGE_VERSION = '3.14.1';
1
+ export const PACKAGE_VERSION = '3.15.0';