@sogni-ai/sogni-creative-agent-skill 3.65.1 → 3.66.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@ name: sogni-creative-agent-skill
3
3
  description: "Generate and edit images, create Pixal3D 3D models, remove backgrounds with BiRefNet, synthesize Qwen3-TTS speech, upscale images, create video and music, animate image folders into seamless reels, and manage reusable personas with Sogni AI. Use when a Hermes user asks to draw, render, upscale, edit or restyle an image, animate an image, make a video, create music or lyrics, build a media workflow, build a playable world, apply a saved identity, or refine an earlier Sogni result."
4
4
  license: MIT
5
5
  metadata:
6
- version: "3.65.1"
6
+ version: "3.66.1"
7
7
  author: Sogni AI
8
8
  hermes:
9
9
  category: creative
@@ -22,6 +22,8 @@ Generate images, video, and music through Sogni AI's decentralized GPU network.
22
22
 
23
23
  For SAM 3 object masks, read [references/object-selection.md](references/object-selection.md).
24
24
  Use `--segment` with an original still and normalized points or an object description.
25
+ Use `--segment-video` with a video and `--segment-frame` for the selection's source frame; the result is a lossless mask MP4 with the source's dimensions and timing.
26
+ Drawn regions, several objects in one mask, several prompt frames and tracking memory are JavaScript and Python SDK fields (5.80.0 or later) with no CLI flags; the reference shows them.
25
27
 
26
28
  Invoke `sogni-agent-hermes` for every command in this skill. Fall back to
27
29
  `sogni-agent` only when the Hermes launcher is not on `PATH`. The two commands
@@ -19,8 +19,9 @@ never substitute another destination model's prompt contract.
19
19
  Select `gpt-image-2.6-sunburst` or `gpt-image-2.6-flare` explicitly. For a GIF,
20
20
  describe the action and return to the starting pose, then use `--output-format gif`,
21
21
  `--image-frame-count 9`, and `--image-frame-duration-ms 200`. Nine frames at 200 ms
22
- give a 1.8-second animation. GIFs accept text only: no context image, mask, markup,
23
- transparent background, or compression setting. Frames must be 2–16; each edge
22
+ give a 1.8-second animation. Add original still images with `-c` to animate a
23
+ reference character, photo or artwork. GIFs exclude masks, markup, transparent
24
+ background and compression settings. Frames must be 2–16; each edge
24
25
  is a multiple of 16, and width × height × frames must not exceed 8,294,400.
25
26
 
26
27
  ```bash
@@ -33,7 +34,7 @@ separate transparent PNG matching the first `--context` image after orientation.
33
34
  Describe the requested edit in the prompt. Do not combine an annotation with a mask.
34
35
  Use a concrete size and quality when comparing prices. GIF quotes reserve an output
35
36
  budget and settle downward to confirmed provider usage when lower. Limits checked
36
- November 4, 2026 PT; the live API enforces 16 frames despite the guide's higher limit.
37
+ November 7, 2026 PT; the live API enforces 16 frames despite the guide's higher limit.
37
38
 
38
39
  ## Output contracts by family
39
40
 
@@ -63,7 +64,7 @@ Prompt-only families return the directly runnable prompt with no label,
63
64
  Markdown fence, preamble, explanation, or render offer.
64
65
 
65
66
  <!-- BEGIN GENERATED PROMPT GUIDE: image-models -->
66
- <!-- Generated by npm run sync:prompt-guides from @sogni-ai/sogni-intelligence-client 4.25.3; edit the rules there, not here. -->
67
+ <!-- Generated by npm run sync:prompt-guides from @sogni-ai/sogni-intelligence-client 4.26.0; edit the rules there, not here. -->
67
68
 
68
69
  ## Per-model rules from Sogni's image prompt writer
69
70
 
@@ -289,6 +289,21 @@ BiRefNet are flat-priced; Pixal3D pricing depends on `shapeResolution`. None of
289
289
  the usual generation controls apply either: leave steps, guidance, sampler,
290
290
  scheduler, and the negative prompt unset for every one of them.
291
291
 
292
+ ### SAM 3 video selection (`sam3_video_segment_fp16`)
293
+
294
+ Use `--segment-video clip.mp4 --segment-text "unicorn horn" --segment-frame 126`
295
+ for an object that moves across a clip. One project returns a lossless binary
296
+ mask MP4 with the source timing and dimensions. SDK callers use `referenceVideo`
297
+ and `sam3VideoPrompt`, with normalized points/boxes or a short object description.
298
+ `frameIndex` is zero-based and tracking runs in both directions from it.
299
+ Inputs are constant-frame-rate SDR video, up to 30 seconds, 900 frames,
300
+ 2560 pixels on either edge and 100 MB. See [object selection](object-selection.md).
301
+ SDK callers can also send the optional `mask` (a drawn region), `objects`
302
+ (2 to 16 things merged into one mask), `frames` (the same selection on 2 to 8
303
+ frames, such as frame 0 and the last frame of a loop) and `memory` fields; the
304
+ CLI has no flags for them. The object-selection reference has examples and
305
+ limits.
306
+
292
307
  ### SAM 3 segmentation (`sam3_image_segment_bf16`)
293
308
 
294
309
  Flat $0.005 (1 Spark) per request at any source size. Returns exactly one
@@ -1658,6 +1673,8 @@ initial Flare canaries; inspect native output against a contrasting background.
1658
1673
 
1659
1674
  Select `-m gpt-image-2.6-sunburst` or `-m gpt-image-2.6-flare`; existing image defaults stay the same. Both support the 2.5 still-image controls above, plus `--image-complexity low|medium|high`. Use `--output-format gif` for an animation, `--image-frame-count 2..16` (default 9), and `--image-frame-duration-ms 20..2000` (default 200). Describe the motion in the prompt. GIF sizing depends on the frame count; let the CLI fit a supported sheet and quote the actual settings.
1660
1675
 
1676
+ Add up to 16 original still images with `-c` for a reference-guided GIF. Describe the motion and preserve the supplied references in their intended order. GIFs cannot combine with masks or annotation markup.
1677
+
1661
1678
  For a still-image edit, supply the original as the first `-c` reference and its aligned transparent annotation PNG URL with `--image-markup-url`. The marks guide the changes and are separate from an alpha mask. The CLI accepts a prepared annotation image; it has no drawing canvas.
1662
1679
 
1663
1680
  ```bash
@@ -1,5 +1,91 @@
1
1
  # SAM 3 object selection
2
2
 
3
+ For a moving object, use video selection:
4
+
5
+ ```bash
6
+ sogni-agent --segment-video clip.mp4 --segment-text "unicorn horn" --segment-frame 126 -o horn-mask.mp4
7
+ sogni-agent --segment-video clip.mp4 --segment-point 0.45,0.6 --segment-exclude 0.1,0.1 -o object-mask.mp4
8
+ ```
9
+
10
+ `--segment-video` uses `sam3_video_segment_fp16` and submits one paid project
11
+ for the complete clip. The result is a lossless binary mask MP4 with the
12
+ source's dimensions, frame count and frame rate. White selects the object.
13
+ The zero-based `--segment-frame` says which source frame the prompt describes;
14
+ tracking runs forward and backward from it. `--segment-object` chooses a
15
+ text-detected candidate in confidence order, starting at zero. Click prompts
16
+ select one object. Coordinates are normalized against the complete source frame.
17
+
18
+ Video selection accepts a constant-frame-rate SDR source up to 30 seconds,
19
+ 900 frames, 2560 pixels on either edge and 100 MB. Inspect the mask over the
20
+ original video at native size, including chunk boundaries and occlusions,
21
+ before using it for compositing or moving hotspot outlines.
22
+
23
+ ### Video selection options (SDK only)
24
+
25
+ `sam3VideoPrompt` has four optional fields. The CLI has no flags for them: do
26
+ not invent any. Send them through the JavaScript or Python SDK (5.80.0 or
27
+ later) in `sam3VideoPrompt`. A prompt without them runs and is priced exactly as before.
28
+
29
+ - `mask` selects a drawn region instead of text, points or boxes. `polygons`
30
+ holds 1 to 64 rings of normalized `[x, y]` points (3 to 2048 per ring, 4096
31
+ per region); a ring inside another ring is a hole. The region starts the
32
+ tracker on its prompt frame, as a click does, so that frame's mask is the
33
+ tracker's shape of the region, not the exact drawing. Draw it tight: any
34
+ background or foreground object inside it stays in the mask for several
35
+ frames. It cannot be combined with `text`, `points`, `boxes`, `threshold` or
36
+ `multimask`, and `objectIndex` must be 0 or left out.
37
+
38
+ ```json
39
+ { "frameIndex": 0, "mask": { "polygons": [[[0.42, 0.18], [0.58, 0.18], [0.61, 0.55], [0.39, 0.55]]] } }
40
+ ```
41
+
42
+ - `objects` tracks 2 to 16 things together, one selection each, and requires
43
+ `combine: "union"`. Every output frame is the union of their masks, all
44
+ selected on the top-level `frameIndex`. Use it for a crowd or several
45
+ separate things: one selection that covers several similar things settles on
46
+ just one of them. Top-level selection fields are refused alongside it.
47
+
48
+ ```json
49
+ { "combine": "union", "objects": [
50
+ { "points": [{ "x": 0.21, "y": 0.48, "label": "positive" }] },
51
+ { "points": [{ "x": 0.52, "y": 0.45, "label": "positive" }] }
52
+ ] }
53
+ ```
54
+
55
+ - `frames` gives the same selection on 2 to 8 different frames, each entry
56
+ with its own `frameIndex`. Each output frame follows the nearest prompted
57
+ frame (ties go to the earlier one). For a loop whose first and last frames
58
+ are the same still, select the same thing on frame 0 and on the last frame.
59
+ It cannot be combined with `objects` or with a top-level `frameIndex` or
60
+ selection.
61
+
62
+ ```json
63
+ { "frames": [
64
+ { "frameIndex": 0, "points": [{ "x": 0.47, "y": 0.62, "label": "positive" }] },
65
+ { "frameIndex": 120, "points": [{ "x": 0.47, "y": 0.62, "label": "positive" }] }
66
+ ] }
67
+ ```
68
+
69
+ - `memory` sets how tracking carries between 32-frame chunks. `"chunk"`, the
70
+ default, starts each chunk from the previous chunk's last mask; an object
71
+ lost at the end of a chunk is not found again. `"anchor"` starts each chunk
72
+ again from the prompt frame: errors do not carry over and a lost object can
73
+ be found again, but the mask can shift where a chunk starts.
74
+
75
+ ```json
76
+ { "text": "unicorn horn", "frameIndex": 127, "memory": "anchor" }
77
+ ```
78
+
79
+ A prompt holds at most 4096 region points across all its objects and frames.
80
+ Each object after the first adds 8% of a one-object job's price; anchor memory
81
+ adds 1/31; `frames` and `mask` add nothing. Pass the job's `sam3VideoPrompt`
82
+ to `estimateVideoCost()` (Python: `sam3_video_prompt` to
83
+ `estimate_video_cost()`) for the quote. These options run on Comfy worker
84
+ 1.0.253 or newer; when none is online the request is refused at once with
85
+ error 4044, before any charge.
86
+
87
+ ## Still-image selection
88
+
3
89
  Use SAM 3 when a task needs an object mask from an existing still, for example
4
90
  selecting a door before directing an edit. Coordinates refer to the original
5
91
  image, normalized from 0 to 1, with the origin at the top left.
@@ -124,7 +124,7 @@ LTX-2.5 text-to-video, one shot, so one sentence: "A medium shot frames a woman
124
124
  ```
125
125
 
126
126
  <!-- BEGIN GENERATED PROMPT GUIDE: ltx-2.5 -->
127
- <!-- Generated by npm run sync:prompt-guides from @sogni-ai/sogni-intelligence-client 4.25.3; edit the rules there, not here. -->
127
+ <!-- Generated by npm run sync:prompt-guides from @sogni-ai/sogni-intelligence-client 4.26.0; edit the rules there, not here. -->
128
128
 
129
129
  ### Sogni's prompt rules: ltx-2.5
130
130
 
@@ -179,7 +179,7 @@ Preserve requested visual style and production value without adding new objects,
179
179
  <!-- END GENERATED PROMPT GUIDE: ltx-2.5 -->
180
180
 
181
181
  <!-- BEGIN GENERATED PROMPT GUIDE: ltx-2.3 -->
182
- <!-- Generated by npm run sync:prompt-guides from @sogni-ai/sogni-intelligence-client 4.25.3; edit the rules there, not here. -->
182
+ <!-- Generated by npm run sync:prompt-guides from @sogni-ai/sogni-intelligence-client 4.26.0; edit the rules there, not here. -->
183
183
 
184
184
  ### Sogni's prompt rules: ltx-2.3
185
185
 
@@ -973,7 +973,7 @@ the exact waveform-conditioned lip-sync input. Remote audio URLs and additional
973
973
  audio references keep their existing handling.
974
974
 
975
975
  <!-- BEGIN GENERATED PROMPT GUIDE: minimax-h3 -->
976
- <!-- Generated by npm run sync:prompt-guides from @sogni-ai/sogni-intelligence-client 4.25.3; edit the rules there, not here. -->
976
+ <!-- Generated by npm run sync:prompt-guides from @sogni-ai/sogni-intelligence-client 4.26.0; edit the rules there, not here. -->
977
977
 
978
978
  ### Sogni's prompt rules: minimax-h3
979
979
 
@@ -1191,7 +1191,7 @@ A low tracking shot races alongside a teal 1960s convertible down a sunlit coast
1191
1191
  ```
1192
1192
 
1193
1193
  <!-- BEGIN GENERATED PROMPT GUIDE: seedance-2.5 -->
1194
- <!-- Generated by npm run sync:prompt-guides from @sogni-ai/sogni-intelligence-client 4.25.3; edit the rules there, not here. -->
1194
+ <!-- Generated by npm run sync:prompt-guides from @sogni-ai/sogni-intelligence-client 4.26.0; edit the rules there, not here. -->
1195
1195
 
1196
1196
  ### Sogni's prompt rules: seedance-2.5
1197
1197
 
@@ -1265,7 +1265,7 @@ TARGET CAPABILITIES: Seedance 2.5 uses the same director-style prompt grammar an
1265
1265
  <!-- END GENERATED PROMPT GUIDE: seedance-2.5 -->
1266
1266
 
1267
1267
  <!-- BEGIN GENERATED PROMPT GUIDE: seedance-2.0 -->
1268
- <!-- Generated by npm run sync:prompt-guides from @sogni-ai/sogni-intelligence-client 4.25.3; edit the rules there, not here. -->
1268
+ <!-- Generated by npm run sync:prompt-guides from @sogni-ai/sogni-intelligence-client 4.26.0; edit the rules there, not here. -->
1269
1269
 
1270
1270
  ### Sogni's prompt rules: seedance-2.0
1271
1271
 
@@ -1374,7 +1374,7 @@ writer uses close this section.
1374
1374
  motion timing, camera path, framing, and background.
1375
1375
 
1376
1376
  <!-- BEGIN GENERATED PROMPT GUIDE: wan-2.2 -->
1377
- <!-- Generated by npm run sync:prompt-guides from @sogni-ai/sogni-intelligence-client 4.25.3; edit the rules there, not here. -->
1377
+ <!-- Generated by npm run sync:prompt-guides from @sogni-ai/sogni-intelligence-client 4.26.0; edit the rules there, not here. -->
1378
1378
 
1379
1379
  ### Sogni's prompt rules: wan-2.2
1380
1380
 
@@ -1464,7 +1464,7 @@ The rules Sogni's own prompt writer uses close this section.
1464
1464
  - Prompts may run to 20,000 characters.
1465
1465
 
1466
1466
  <!-- BEGIN GENERATED PROMPT GUIDE: wan-3 -->
1467
- <!-- Generated by npm run sync:prompt-guides from @sogni-ai/sogni-intelligence-client 4.25.3; edit the rules there, not here. -->
1467
+ <!-- Generated by npm run sync:prompt-guides from @sogni-ai/sogni-intelligence-client 4.26.0; edit the rules there, not here. -->
1468
1468
 
1469
1469
  ### Sogni's prompt rules: wan-3
1470
1470
 
@@ -1519,7 +1519,7 @@ audio that is always on. What it renders well and the reference limits are in
1519
1519
  [models.md § HappyHorse 1.1](./models.md#happyhorse-11-prompting-tips).
1520
1520
 
1521
1521
  <!-- BEGIN GENERATED PROMPT GUIDE: happyhorse-1.1 -->
1522
- <!-- Generated by npm run sync:prompt-guides from @sogni-ai/sogni-intelligence-client 4.25.3; edit the rules there, not here. -->
1522
+ <!-- Generated by npm run sync:prompt-guides from @sogni-ai/sogni-intelligence-client 4.26.0; edit the rules there, not here. -->
1523
1523
 
1524
1524
  ### Sogni's prompt rules: happyhorse-1.1
1525
1525
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sogni-creative-agent",
3
- "version": "3.65.1",
3
+ "version": "3.66.1",
4
4
  "description": "Sogni Creative Agent: image, 3D, speech, video, and music generation via Sogni AI's decentralized GPU network. Supports personas, persistent memories, style transfer, and multi-step creative workflows.",
5
5
  "author": {
6
6
  "name": "Sogni AI",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sogni-creative-agent",
3
- "version": "3.65.1",
3
+ "version": "3.66.1",
4
4
  "description": "Create images, 3D models, speech, generative video, music, and image-folder loops with Sogni AI.",
5
5
  "author": {
6
6
  "name": "Sogni AI",
package/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## [3.66.1] - 2026-11-10
2
+
3
+ - Document the SAM 3.1 video selection options for SDK callers: a drawn region, 2 to 16 objects tracked together, the same selection on several frames, and how tracking carries between 32-frame chunks. They need the JavaScript or Python SDK 5.80.0 or later; the CLI has no flags for them.
4
+ - Use Sogni SDK 5.80.0 and intelligence-client 4.26.0.
5
+
6
+ ## [3.66.0] - 2026-11-07
7
+
8
+ - Select an object across a video from a point, box or text description and download its animated mask with the source frame count and timing. Existing image selection stays available.
9
+ - Animate reference images with GPT Image 2.6 Sunburst or Flare: combine `-c` with `--output-format gif` and describe the motion. GIFs continue to exclude masks and annotations.
10
+ - Use Sogni SDK 5.79.0, intelligence-client 4.25.6 and the synchronized creative-agent 2.29.4 runtime.
11
+
1
12
  ## [3.65.1] - 2026-11-05
2
13
 
3
14
  - Improve optional inline image previews while keeping full-resolution result links available.
package/README.md CHANGED
@@ -30,6 +30,7 @@ With this skill, an agent can:
30
30
 
31
31
  - generate images from prompts and edit/restyle existing images
32
32
  - select an object in an original image and return its SAM 3 mask (`--segment`; see the [object selection guide](references/object-selection.md))
33
+ - track an object across a video and return a frame-aligned mask (`--segment-video`; see the [object selection guide](references/object-selection.md))
33
34
  - create videos from text, images, first/last frames, audio, or source video (LTX-2.5), with LTX-2.3 retained for voice ID, transition, and 10Eros workflows
34
35
  - turn an image folder into a visually deduplicated, music-backed seamless loop with one plugin skill invocation
35
36
  - generate instrumental music or full songs with lyrics
package/SKILL.md CHANGED
@@ -2,7 +2,7 @@
2
2
  name: sogni-creative-agent-skill
3
3
  description: "CLI and agent skill for personal LoRAs, image, video, and music generation using Sogni AI's decentralized GPU network. Supports Pixal3D single- and multi-view image-to-GLB, BiRefNet background removal, Qwen3-TTS speech/voice cloning/design, MiniMax Music 3, SAM 3 object selection, promptless RTX VSR image upscaling through 16K, promptless FlashVSR video upscaling to 1080p/1440p, one-click image-folder loop reels, personas (people with saved photos and voices), persistent memories, custom personality, style transfer, angle synthesis, MiniMax H3/H3 Balanced/LightX2V Turbo/FastH3 Turbo (including audio-to-video from an uploaded track)/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\", \"upscale an image\", \"upscale a video\", \"make a video/animate\", \"turn this image folder into a loop\", \"make music\", \"build a playable world\", \"apply a style\", or \"generate me as a superhero\"."
4
4
  metadata:
5
- version: "3.65.1"
5
+ version: "3.66.1"
6
6
  homepage: https://sogni.ai
7
7
  openclaw:
8
8
  emoji: "🎨"
@@ -313,6 +313,7 @@ sogni-agent doctor --json
313
313
 
314
314
  ### Segmentation and 3D reconstruction
315
315
 
316
+ - To track a selected object through a video, use `--segment-video clip.mp4` with the existing selection text, points or boxes. `--segment-frame` identifies the zero-based prompt frame; tracking runs both ways. Save the frame-aligned mask as MP4. Read [`references/object-selection.md`](./references/object-selection.md) for limits and examples. A drawn region (`mask`), several objects in one mask (`objects`), the same selection on several frames for a loop (`frames`) and `memory` are `sam3VideoPrompt` fields in the JavaScript and Python SDKs (5.80.0 or later) with no CLI flags; the reference shows them.
316
317
  - To isolate an object in an image — a mask, or the subject cut out on transparency — use `sam3_image_segment_bf16` with a `sam3Prompt`. In direct CLI mode that is `--segment <original> --segment-point x,y` (repeat; `--segment-exclude` refines) or `--segment-text "<object>"` with optional `--segment-box x0,y0,x1,y1`, returning one binary PNG mask — read [`references/object-selection.md`](./references/object-selection.md) first. It is promptless in the ordinary sense: the selection comes from `text`, click `points`, or `boxes`, never from `positivePrompt`. Never route a "remove the background" or "select the X" request through `edit_image` or `refine_result`, which regenerate pixels instead of selecting them.
317
318
  - SDK callers: SAM 3 takes `sam3Prompt.applyMask: true` for a cutout; leave it off for the binary mask. If text matches too many instances, inspect `maskSelections` and refine with `maxInstances: 1` or points. BiRefNet uses top-level `applyMask` instead.
318
319
  - Pixal3D (`pixal3d_int8_i23d`) reconstructs one `startingImage` into a textured GLB. When the user has more photos of the same object, add any of `--left-view`, `--back-view` and `--right-view` to `--image-to-3d front.png`; the CLI then uses `pixal3d_multiview_int8_i23d` (SDK `leftViewImage` / `backViewImage` / `rightViewImage`) at the same options and price. Views are named by the subject's own sides, not the viewer's: left = the subject turned so its own left side faces the camera (it faces screen-left), right = its own right side (it faces screen-right), back = seen from behind. Never follow turnaround templates that label the subject's right side "left" — swapped sides build a model turned 180 degrees. Its supported graph is promptless: omit `templateVariant` or use `i23d-birefnet`; the old prompted `i23d` variant is removed. Shape resolution defaults to 1024, with 1536 available at a higher price. Set `meshTargetFaces` below the 700000 maximum for a real-time asset. Discovery supports `--search-models pixal3d` and `--model-media model`; generate with `--image-to-3d object.png --mesh-faces 30000 -o object.glb`. Save the binary result as `.glb`, never process it as an image.
@@ -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.65.1",
5
+ "version": "3.66.1",
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
@@ -27,7 +27,8 @@ Two-Stage delivered 720p/1080p/2K, FastH3 audio-to-video from an uploaded track
27
27
  `-flfa2v-turbo` / `-a2v-turbo`), MiniMax H3 keyframes that pin extra images at
28
28
  chosen times (repeatable `--keyframe image.png@3.5`, up to 8, on H3 i2v/flf2v,
29
29
  Sound to Video, and Ref2VA), GPT Image 2.5 Sunburst/Flare, SAM 3 object
30
- masks, and promptless FlashVSR video upscaling to 1080p/1440p.
30
+ masks for stills and complete video clips, and promptless FlashVSR video upscaling to 1080p/1440p.
31
+ Video selection: `sogni-agent --segment-video clip.mp4 --segment-text "person" --segment-frame 60 -o mask.mp4`.
31
32
  Direct CLI: Pixal3D uses `--image-to-3d original.png -o object.glb` (add
32
33
  `--left-view`, `--back-view`, `--right-view` for multi-view); BiRefNet
33
34
  uses `--remove-background original.png -o cutout.png` (add `--matte` for a mask).
@@ -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.65.1",
5
+ "version": "3.66.1",
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.65.1",
3
+ "version": "3.66.1",
4
4
  "description": "Sogni Creative Agent Skill: agent skill and CLI for Sogni AI image, 3D, speech, video, and music generation.",
5
5
  "type": "module",
6
6
  "main": "sogni-agent.mjs",
@@ -102,16 +102,17 @@
102
102
  "sogni-agent.mjs",
103
103
  "sam-segmentation.mjs",
104
104
  "media-utilities.mjs",
105
+ "sam-video-segmentation.mjs",
105
106
  "account-personas.mjs"
106
107
  ],
107
108
  "dependencies": {
108
- "@sogni-ai/sogni-intelligence-client": "4.25.3",
109
+ "@sogni-ai/sogni-intelligence-client": "4.26.0",
109
110
  "execa": "^10.0.1",
110
111
  "json5": "^2.2.3",
111
112
  "sharp": "0.35.5"
112
113
  },
113
114
  "overrides": {
114
- "@sogni-ai/sogni-client": "5.76.0",
115
+ "@sogni-ai/sogni-client": "5.80.0",
115
116
  "undici@7": "7.30.1"
116
117
  },
117
118
  "openclaw": {
@@ -69,6 +69,7 @@ For MiniMax reference-to-video, default to **Balanced R2V** (`minimax-h3-r2v-bal
69
69
  - Image: `sogni-agent "a cat on the moon, cinematic"`
70
70
  - Image edit: `sogni-agent -c <path> "make it night, add fireflies"`
71
71
  - Object mask: `sogni-agent --segment <path> --segment-point 0.5,0.5 -o mask.png` (SAM 3; see `../../references/object-selection.md`)
72
+ - Video object mask: `sogni-agent --segment-video <path> --segment-text "person" --segment-frame 60 -o mask.mp4` (tracks one selection across the complete clip at its original size and frame rate; see `../../references/object-selection.md`)
72
73
  - Video (image-to-video): `sogni-agent --video --ref <path> "the cyclist stands on the pedals and sprints out of frame as the camera whip-pans to follow"` (defaults to `wan_v2.2-14b-fp8_i2v_lightx2v`)
73
74
  - Animate two images (first frame → last frame): `sogni-agent --video --ref <first> --ref-end <last> "A wide shot opens on the dim hallway of the first frame as the camera pushes through the doorway, the overhead lights flickering on one by one across the polished floor, and arrives on the bright room of the final frame while footsteps echo and a switch clicks."` (defaults to `ltx25-22b-int8_i2v_distilled` and the standard FLF template; no transition LoRA is attached)
74
75
  - Seedance 2.5 at 1080p: `sogni-agent --video -m seedance2-5 -c ./courier.png --target-resolution 1080 --duration 8 -o ./seedance-1080p.mp4 "A low tracking shot follows a courier sprinting through a rain-soaked night market, stall awnings and paper lanterns whipping past the lens. Use @Image1 for the courier's face and yellow jacket. 0-3s: she vaults the turnstile at the market gate and lands mid-stride, rain spraying off her shoulders as two stall keepers jerk back. 3-6s: she skids around a fruit stall on the wet tiles, one hand slapping the counter to swing her through the turn, and a flock of pigeons bursts up from the crates she clips. 6-8s: she bursts out into the open street, chest heaving, the neon signs behind her smearing into streaks of color as the camera holds level with her. Rain hiss, slapping footsteps, beating wings, a vendor shouting in the distance. Her yellow jacket and face stay the same in every frame."` (4–30s; 480p/720p/1080p, native audio; optional `--output-format mov` and `--return-last-frame`)
@@ -19,8 +19,9 @@ never substitute another destination model's prompt contract.
19
19
  Select `gpt-image-2.6-sunburst` or `gpt-image-2.6-flare` explicitly. For a GIF,
20
20
  describe the action and return to the starting pose, then use `--output-format gif`,
21
21
  `--image-frame-count 9`, and `--image-frame-duration-ms 200`. Nine frames at 200 ms
22
- give a 1.8-second animation. GIFs accept text only: no context image, mask, markup,
23
- transparent background, or compression setting. Frames must be 2–16; each edge
22
+ give a 1.8-second animation. Add original still images with `-c` to animate a
23
+ reference character, photo or artwork. GIFs exclude masks, markup, transparent
24
+ background and compression settings. Frames must be 2–16; each edge
24
25
  is a multiple of 16, and width × height × frames must not exceed 8,294,400.
25
26
 
26
27
  ```bash
@@ -33,7 +34,7 @@ separate transparent PNG matching the first `--context` image after orientation.
33
34
  Describe the requested edit in the prompt. Do not combine an annotation with a mask.
34
35
  Use a concrete size and quality when comparing prices. GIF quotes reserve an output
35
36
  budget and settle downward to confirmed provider usage when lower. Limits checked
36
- November 4, 2026 PT; the live API enforces 16 frames despite the guide's higher limit.
37
+ November 7, 2026 PT; the live API enforces 16 frames despite the guide's higher limit.
37
38
 
38
39
  ## Output contracts by family
39
40
 
@@ -63,7 +64,7 @@ Prompt-only families return the directly runnable prompt with no label,
63
64
  Markdown fence, preamble, explanation, or render offer.
64
65
 
65
66
  <!-- BEGIN GENERATED PROMPT GUIDE: image-models -->
66
- <!-- Generated by npm run sync:prompt-guides from @sogni-ai/sogni-intelligence-client 4.25.3; edit the rules there, not here. -->
67
+ <!-- Generated by npm run sync:prompt-guides from @sogni-ai/sogni-intelligence-client 4.26.0; edit the rules there, not here. -->
67
68
 
68
69
  ## Per-model rules from Sogni's image prompt writer
69
70
 
@@ -289,6 +289,21 @@ BiRefNet are flat-priced; Pixal3D pricing depends on `shapeResolution`. None of
289
289
  the usual generation controls apply either: leave steps, guidance, sampler,
290
290
  scheduler, and the negative prompt unset for every one of them.
291
291
 
292
+ ### SAM 3 video selection (`sam3_video_segment_fp16`)
293
+
294
+ Use `--segment-video clip.mp4 --segment-text "unicorn horn" --segment-frame 126`
295
+ for an object that moves across a clip. One project returns a lossless binary
296
+ mask MP4 with the source timing and dimensions. SDK callers use `referenceVideo`
297
+ and `sam3VideoPrompt`, with normalized points/boxes or a short object description.
298
+ `frameIndex` is zero-based and tracking runs in both directions from it.
299
+ Inputs are constant-frame-rate SDR video, up to 30 seconds, 900 frames,
300
+ 2560 pixels on either edge and 100 MB. See [object selection](object-selection.md).
301
+ SDK callers can also send the optional `mask` (a drawn region), `objects`
302
+ (2 to 16 things merged into one mask), `frames` (the same selection on 2 to 8
303
+ frames, such as frame 0 and the last frame of a loop) and `memory` fields; the
304
+ CLI has no flags for them. The object-selection reference has examples and
305
+ limits.
306
+
292
307
  ### SAM 3 segmentation (`sam3_image_segment_bf16`)
293
308
 
294
309
  Flat $0.005 (1 Spark) per request at any source size. Returns exactly one
@@ -1658,6 +1673,8 @@ initial Flare canaries; inspect native output against a contrasting background.
1658
1673
 
1659
1674
  Select `-m gpt-image-2.6-sunburst` or `-m gpt-image-2.6-flare`; existing image defaults stay the same. Both support the 2.5 still-image controls above, plus `--image-complexity low|medium|high`. Use `--output-format gif` for an animation, `--image-frame-count 2..16` (default 9), and `--image-frame-duration-ms 20..2000` (default 200). Describe the motion in the prompt. GIF sizing depends on the frame count; let the CLI fit a supported sheet and quote the actual settings.
1660
1675
 
1676
+ Add up to 16 original still images with `-c` for a reference-guided GIF. Describe the motion and preserve the supplied references in their intended order. GIFs cannot combine with masks or annotation markup.
1677
+
1661
1678
  For a still-image edit, supply the original as the first `-c` reference and its aligned transparent annotation PNG URL with `--image-markup-url`. The marks guide the changes and are separate from an alpha mask. The CLI accepts a prepared annotation image; it has no drawing canvas.
1662
1679
 
1663
1680
  ```bash
@@ -1,5 +1,91 @@
1
1
  # SAM 3 object selection
2
2
 
3
+ For a moving object, use video selection:
4
+
5
+ ```bash
6
+ sogni-agent --segment-video clip.mp4 --segment-text "unicorn horn" --segment-frame 126 -o horn-mask.mp4
7
+ sogni-agent --segment-video clip.mp4 --segment-point 0.45,0.6 --segment-exclude 0.1,0.1 -o object-mask.mp4
8
+ ```
9
+
10
+ `--segment-video` uses `sam3_video_segment_fp16` and submits one paid project
11
+ for the complete clip. The result is a lossless binary mask MP4 with the
12
+ source's dimensions, frame count and frame rate. White selects the object.
13
+ The zero-based `--segment-frame` says which source frame the prompt describes;
14
+ tracking runs forward and backward from it. `--segment-object` chooses a
15
+ text-detected candidate in confidence order, starting at zero. Click prompts
16
+ select one object. Coordinates are normalized against the complete source frame.
17
+
18
+ Video selection accepts a constant-frame-rate SDR source up to 30 seconds,
19
+ 900 frames, 2560 pixels on either edge and 100 MB. Inspect the mask over the
20
+ original video at native size, including chunk boundaries and occlusions,
21
+ before using it for compositing or moving hotspot outlines.
22
+
23
+ ### Video selection options (SDK only)
24
+
25
+ `sam3VideoPrompt` has four optional fields. The CLI has no flags for them: do
26
+ not invent any. Send them through the JavaScript or Python SDK (5.80.0 or
27
+ later) in `sam3VideoPrompt`. A prompt without them runs and is priced exactly as before.
28
+
29
+ - `mask` selects a drawn region instead of text, points or boxes. `polygons`
30
+ holds 1 to 64 rings of normalized `[x, y]` points (3 to 2048 per ring, 4096
31
+ per region); a ring inside another ring is a hole. The region starts the
32
+ tracker on its prompt frame, as a click does, so that frame's mask is the
33
+ tracker's shape of the region, not the exact drawing. Draw it tight: any
34
+ background or foreground object inside it stays in the mask for several
35
+ frames. It cannot be combined with `text`, `points`, `boxes`, `threshold` or
36
+ `multimask`, and `objectIndex` must be 0 or left out.
37
+
38
+ ```json
39
+ { "frameIndex": 0, "mask": { "polygons": [[[0.42, 0.18], [0.58, 0.18], [0.61, 0.55], [0.39, 0.55]]] } }
40
+ ```
41
+
42
+ - `objects` tracks 2 to 16 things together, one selection each, and requires
43
+ `combine: "union"`. Every output frame is the union of their masks, all
44
+ selected on the top-level `frameIndex`. Use it for a crowd or several
45
+ separate things: one selection that covers several similar things settles on
46
+ just one of them. Top-level selection fields are refused alongside it.
47
+
48
+ ```json
49
+ { "combine": "union", "objects": [
50
+ { "points": [{ "x": 0.21, "y": 0.48, "label": "positive" }] },
51
+ { "points": [{ "x": 0.52, "y": 0.45, "label": "positive" }] }
52
+ ] }
53
+ ```
54
+
55
+ - `frames` gives the same selection on 2 to 8 different frames, each entry
56
+ with its own `frameIndex`. Each output frame follows the nearest prompted
57
+ frame (ties go to the earlier one). For a loop whose first and last frames
58
+ are the same still, select the same thing on frame 0 and on the last frame.
59
+ It cannot be combined with `objects` or with a top-level `frameIndex` or
60
+ selection.
61
+
62
+ ```json
63
+ { "frames": [
64
+ { "frameIndex": 0, "points": [{ "x": 0.47, "y": 0.62, "label": "positive" }] },
65
+ { "frameIndex": 120, "points": [{ "x": 0.47, "y": 0.62, "label": "positive" }] }
66
+ ] }
67
+ ```
68
+
69
+ - `memory` sets how tracking carries between 32-frame chunks. `"chunk"`, the
70
+ default, starts each chunk from the previous chunk's last mask; an object
71
+ lost at the end of a chunk is not found again. `"anchor"` starts each chunk
72
+ again from the prompt frame: errors do not carry over and a lost object can
73
+ be found again, but the mask can shift where a chunk starts.
74
+
75
+ ```json
76
+ { "text": "unicorn horn", "frameIndex": 127, "memory": "anchor" }
77
+ ```
78
+
79
+ A prompt holds at most 4096 region points across all its objects and frames.
80
+ Each object after the first adds 8% of a one-object job's price; anchor memory
81
+ adds 1/31; `frames` and `mask` add nothing. Pass the job's `sam3VideoPrompt`
82
+ to `estimateVideoCost()` (Python: `sam3_video_prompt` to
83
+ `estimate_video_cost()`) for the quote. These options run on Comfy worker
84
+ 1.0.253 or newer; when none is online the request is refused at once with
85
+ error 4044, before any charge.
86
+
87
+ ## Still-image selection
88
+
3
89
  Use SAM 3 when a task needs an object mask from an existing still, for example
4
90
  selecting a door before directing an edit. Coordinates refer to the original
5
91
  image, normalized from 0 to 1, with the origin at the top left.
@@ -124,7 +124,7 @@ LTX-2.5 text-to-video, one shot, so one sentence: "A medium shot frames a woman
124
124
  ```
125
125
 
126
126
  <!-- BEGIN GENERATED PROMPT GUIDE: ltx-2.5 -->
127
- <!-- Generated by npm run sync:prompt-guides from @sogni-ai/sogni-intelligence-client 4.25.3; edit the rules there, not here. -->
127
+ <!-- Generated by npm run sync:prompt-guides from @sogni-ai/sogni-intelligence-client 4.26.0; edit the rules there, not here. -->
128
128
 
129
129
  ### Sogni's prompt rules: ltx-2.5
130
130
 
@@ -179,7 +179,7 @@ Preserve requested visual style and production value without adding new objects,
179
179
  <!-- END GENERATED PROMPT GUIDE: ltx-2.5 -->
180
180
 
181
181
  <!-- BEGIN GENERATED PROMPT GUIDE: ltx-2.3 -->
182
- <!-- Generated by npm run sync:prompt-guides from @sogni-ai/sogni-intelligence-client 4.25.3; edit the rules there, not here. -->
182
+ <!-- Generated by npm run sync:prompt-guides from @sogni-ai/sogni-intelligence-client 4.26.0; edit the rules there, not here. -->
183
183
 
184
184
  ### Sogni's prompt rules: ltx-2.3
185
185
 
@@ -973,7 +973,7 @@ the exact waveform-conditioned lip-sync input. Remote audio URLs and additional
973
973
  audio references keep their existing handling.
974
974
 
975
975
  <!-- BEGIN GENERATED PROMPT GUIDE: minimax-h3 -->
976
- <!-- Generated by npm run sync:prompt-guides from @sogni-ai/sogni-intelligence-client 4.25.3; edit the rules there, not here. -->
976
+ <!-- Generated by npm run sync:prompt-guides from @sogni-ai/sogni-intelligence-client 4.26.0; edit the rules there, not here. -->
977
977
 
978
978
  ### Sogni's prompt rules: minimax-h3
979
979
 
@@ -1191,7 +1191,7 @@ A low tracking shot races alongside a teal 1960s convertible down a sunlit coast
1191
1191
  ```
1192
1192
 
1193
1193
  <!-- BEGIN GENERATED PROMPT GUIDE: seedance-2.5 -->
1194
- <!-- Generated by npm run sync:prompt-guides from @sogni-ai/sogni-intelligence-client 4.25.3; edit the rules there, not here. -->
1194
+ <!-- Generated by npm run sync:prompt-guides from @sogni-ai/sogni-intelligence-client 4.26.0; edit the rules there, not here. -->
1195
1195
 
1196
1196
  ### Sogni's prompt rules: seedance-2.5
1197
1197
 
@@ -1265,7 +1265,7 @@ TARGET CAPABILITIES: Seedance 2.5 uses the same director-style prompt grammar an
1265
1265
  <!-- END GENERATED PROMPT GUIDE: seedance-2.5 -->
1266
1266
 
1267
1267
  <!-- BEGIN GENERATED PROMPT GUIDE: seedance-2.0 -->
1268
- <!-- Generated by npm run sync:prompt-guides from @sogni-ai/sogni-intelligence-client 4.25.3; edit the rules there, not here. -->
1268
+ <!-- Generated by npm run sync:prompt-guides from @sogni-ai/sogni-intelligence-client 4.26.0; edit the rules there, not here. -->
1269
1269
 
1270
1270
  ### Sogni's prompt rules: seedance-2.0
1271
1271
 
@@ -1374,7 +1374,7 @@ writer uses close this section.
1374
1374
  motion timing, camera path, framing, and background.
1375
1375
 
1376
1376
  <!-- BEGIN GENERATED PROMPT GUIDE: wan-2.2 -->
1377
- <!-- Generated by npm run sync:prompt-guides from @sogni-ai/sogni-intelligence-client 4.25.3; edit the rules there, not here. -->
1377
+ <!-- Generated by npm run sync:prompt-guides from @sogni-ai/sogni-intelligence-client 4.26.0; edit the rules there, not here. -->
1378
1378
 
1379
1379
  ### Sogni's prompt rules: wan-2.2
1380
1380
 
@@ -1464,7 +1464,7 @@ The rules Sogni's own prompt writer uses close this section.
1464
1464
  - Prompts may run to 20,000 characters.
1465
1465
 
1466
1466
  <!-- BEGIN GENERATED PROMPT GUIDE: wan-3 -->
1467
- <!-- Generated by npm run sync:prompt-guides from @sogni-ai/sogni-intelligence-client 4.25.3; edit the rules there, not here. -->
1467
+ <!-- Generated by npm run sync:prompt-guides from @sogni-ai/sogni-intelligence-client 4.26.0; edit the rules there, not here. -->
1468
1468
 
1469
1469
  ### Sogni's prompt rules: wan-3
1470
1470
 
@@ -1519,7 +1519,7 @@ audio that is always on. What it renders well and the reference limits are in
1519
1519
  [models.md § HappyHorse 1.1](./models.md#happyhorse-11-prompting-tips).
1520
1520
 
1521
1521
  <!-- BEGIN GENERATED PROMPT GUIDE: happyhorse-1.1 -->
1522
- <!-- Generated by npm run sync:prompt-guides from @sogni-ai/sogni-intelligence-client 4.25.3; edit the rules there, not here. -->
1522
+ <!-- Generated by npm run sync:prompt-guides from @sogni-ai/sogni-intelligence-client 4.26.0; edit the rules there, not here. -->
1523
1523
 
1524
1524
  ### Sogni's prompt rules: happyhorse-1.1
1525
1525
 
@@ -0,0 +1,20 @@
1
+ import { validateSegmentationPrompts } from './sam-segmentation.mjs';
2
+
3
+ export const SAM3_VIDEO_MODEL_ID = 'sam3_video_segment_fp16';
4
+
5
+ export function videoSegmentationConfig(bytes, source, { points = [], boxes = [], text, frameIndex = 0, objectIndex = 0, tokenType = 'spark' } = {}) {
6
+ validateSegmentationPrompts(points, text, boxes);
7
+ const { width, height, frames, fps } = source;
8
+ if (![width, height, frames].every(value => Number.isSafeInteger(value) && value > 0)
9
+ || width > 2560 || height > 2560 || frames > 900 || !Number.isFinite(fps) || fps < 1 || fps > 60 || frames / fps > 30 || bytes.length > 100 * 1024 * 1024) {
10
+ throw new Error('Video selection accepts up to 30 seconds, 900 frames, 2560 pixels on either edge and 100 MB.');
11
+ }
12
+ if (!Number.isSafeInteger(frameIndex) || frameIndex < 0 || frameIndex >= frames) throw new Error('--segment-frame must be a zero-based source frame index.');
13
+ if (!Number.isSafeInteger(objectIndex) || objectIndex < 0 || objectIndex > 31) throw new Error('--segment-object must be an index from 0 to 31.');
14
+ return {
15
+ modelId: SAM3_VIDEO_MODEL_ID, positivePrompt: '', referenceVideo: bytes, numberOfMedia: 1,
16
+ width, height, frames, fps, outputFormat: 'mp4', disableNSFWFilter: true, tokenType,
17
+ sam3VideoPrompt: { ...(points.length ? { points } : {}), ...(boxes.length ? { boxes } : {}), ...(text?.trim() ? { text: text.trim() } : {}), frameIndex, objectIndex, output: 'mask', edges: 'hard' },
18
+ waitForCompletion: false, autoResizeVideoAssets: false,
19
+ };
20
+ }
@@ -3,12 +3,12 @@
3
3
  "private": true,
4
4
  "type": "module",
5
5
  "dependencies": {
6
- "@sogni-ai/sogni-intelligence-client": "4.25.3",
6
+ "@sogni-ai/sogni-intelligence-client": "4.26.0",
7
7
  "execa": "^10.0.1",
8
8
  "json5": "^2.2.3",
9
9
  "sharp": "0.35.5"
10
10
  },
11
11
  "overrides": {
12
- "@sogni-ai/sogni-client": "5.76.0"
12
+ "@sogni-ai/sogni-client": "5.80.0"
13
13
  }
14
14
  }
package/sogni-agent.mjs CHANGED
@@ -33,6 +33,7 @@ import {
33
33
  MESH_FLAGS, PIXAL3D_VIEW_FLAGS, SPEECH_VALUE_FLAGS, MUSIC3_MODEL_ID, MUSIC3_DEFAULTS, SPEECH_REFERENCE_SECONDS,
34
34
  prepareMediaUtilityOptions, imageUtilityConfig, speechConfig, utilityResultMetadata, validateGlb
35
35
  } from './media-utilities.mjs';
36
+ import { SAM3_VIDEO_MODEL_ID, videoSegmentationConfig } from './sam-video-segmentation.mjs';
36
37
  import { SAM3_MODEL_ID, segmentPoint, segmentBox, validateSegmentationPrompts, segmentationConfig } from './sam-segmentation.mjs';
37
38
  import {
38
39
  INTERNAL_FLAG as UPDATE_CHECK_INTERNAL_FLAG,
@@ -2387,7 +2388,7 @@ function nextSemanticWorkloadAttribution(options = {}) {
2387
2388
  function withBillingMode(config, attributionOptions = {}) {
2388
2389
  return {
2389
2390
  ...config,
2390
- ...(!options.video && !options.upscaleVideo && !options.music && !options.speech && !options.imageTo3d && options.embedPromptMetadata !== undefined
2391
+ ...(!options.video && !options.upscaleVideo && !options.segmentVideo && !options.music && !options.speech && !options.imageTo3d && options.embedPromptMetadata !== undefined
2391
2392
  ? { embedPromptMetadata: options.embedPromptMetadata } : {}),
2392
2393
  ...(options.billingMode ? { billingMode: options.billingMode } : {}),
2393
2394
  ...(options.priorityMode ? { priorityMode: true, billingMode: 'subscription' } : {}),
@@ -3920,6 +3921,9 @@ const options = {
3920
3921
  outpaintAspectRatio: null, // Optional target aspect ratio for outpaint canvas growth
3921
3922
  contextImages: [], // Context images for image editing
3922
3923
  upscaleImage: null, // Source image for promptless RTX VSR upscaling
3924
+ segmentVideo: null,
3925
+ segmentFrame: 0,
3926
+ segmentObject: 0,
3923
3927
  segmentImage: null,
3924
3928
  segmentPoints: [],
3925
3929
  segmentBoxes: [],
@@ -4586,6 +4590,12 @@ for (let i = 0; i < args.length; i++) {
4586
4590
  options[key] = key === 'voiceReference' ? expandHomePath(value) : value;
4587
4591
  } else if (arg === '--speech-creativity') {
4588
4592
  options.speechCreativity = parseNumberValue(requireFlagValue(args, i++, arg), arg);
4593
+ } else if (arg === '--segment-video') {
4594
+ options.segmentVideo = expandHomePath(requireFlagValue(args, i++, arg));
4595
+ } else if (arg === '--segment-frame' || arg === '--segment-object') {
4596
+ const value = Number(requireFlagValue(args, i++, arg));
4597
+ if (!Number.isSafeInteger(value) || value < 0) fatalCliError(`${arg} requires a non-negative integer.`, { code: 'INVALID_ARGUMENT' });
4598
+ options[arg === '--segment-frame' ? 'segmentFrame' : 'segmentObject'] = value;
4589
4599
  } else if (arg === '--segment') {
4590
4600
  options.segmentImage = expandHomePath(requireFlagValue(args, i++, arg));
4591
4601
  } else if (arg === '--segment-point' || arg === '--segment-exclude') {
@@ -5324,6 +5334,9 @@ Image Options:
5324
5334
  --upscale <path|url> Promptless NVIDIA RTX VSR upscale, up to 16K (one source image)
5325
5335
  --upscale-scale <n> Enlarge longest edge by 2, 3, or 4 (default: 2)
5326
5336
  --target-longest-edge <px> Explicit output longest edge, up to 15360 (overrides scale)
5337
+ --segment-video <path|url> Track one selected object; return a lossless, frame-aligned mask MP4
5338
+ --segment-frame <index> Zero-based frame the selection refers to (default: 0)
5339
+ --segment-object <index> Candidate in confidence order (default: 0)
5327
5340
  --upscale-video <path|url> Promptless FlashVSR upscale of one video to 1080p/1440p (keeps frames, fps, audio)
5328
5341
  --upscale-resolution <p> Output short edge for --upscale-video: 1080 or 1440 (default: 1440; 1080 below 720p)
5329
5342
 
@@ -6163,7 +6176,7 @@ if (options.outputFormat) {
6163
6176
  details: { outputFormat: options.outputFormat }
6164
6177
  });
6165
6178
  }
6166
- } else if (options.video || options.upscaleVideo) {
6179
+ } else if (options.video || options.upscaleVideo || options.segmentVideo) {
6167
6180
  if (!['mp4', ...(options.video && isSeedance25ModelSelectionLocal(options.model) ? ['mov'] : [])].includes(options.outputFormat)) {
6168
6181
  fatalCliError('Video output format must be "mp4" (Seedance 2.5 also supports "mov").', {
6169
6182
  code: 'INVALID_ARGUMENT',
@@ -6841,6 +6854,10 @@ if (options.music) {
6841
6854
  if (!cliSet.timeout && !timeoutFromConfig && options.timeout === 30000) {
6842
6855
  options.timeout = 1800000; // 30 min for queued video work
6843
6856
  }
6857
+ } else if (options.segmentVideo) {
6858
+ if (options.model && options.model !== SAM3_VIDEO_MODEL_ID) fatalCliError(`--segment-video requires model ${SAM3_VIDEO_MODEL_ID}.`, { code: 'INVALID_ARGUMENT' });
6859
+ options.model = SAM3_VIDEO_MODEL_ID;
6860
+ if (!cliSet.timeout && !timeoutFromConfig) options.timeout = 1800000;
6844
6861
  } else if (options.segmentImage) {
6845
6862
  if (options.model && options.model !== SAM3_MODEL_ID) fatalCliError(`--segment requires model ${SAM3_MODEL_ID}.`, { code: 'INVALID_ARGUMENT' });
6846
6863
  options.model = SAM3_MODEL_ID;
@@ -6877,7 +6894,7 @@ if (options.music) {
6877
6894
  if (!options.video && !options.music && isGptImage2ModelSelection(options.model)) {
6878
6895
  options.model = normalizeGptImageModelAlias(options.model);
6879
6896
  if (options.outputFormat === 'gif') {
6880
- if (options.contextImages.length || options.imageMask || options.imageMarkupUrl) fatalCliError('GIF output requires text-to-image generation without references, mask or markup.', { code: 'INVALID_ARGUMENT' });
6897
+ if (options.imageMask || options.imageMarkupUrl) fatalCliError('GIF output cannot combine with masks or markup.', { code: 'INVALID_ARGUMENT' });
6881
6898
  try {
6882
6899
  Object.assign(options, gptImageGifDimensions(
6883
6900
  cliSet.width || widthFromConfig || widthFromPrompt ? options.width : undefined,
@@ -7012,7 +7029,7 @@ const commandUsesGenerationSeed = !options.apiChat &&
7012
7029
  !options.remixAudio &&
7013
7030
  !options.upscaleImage &&
7014
7031
  !options.upscaleVideo &&
7015
- !options.segmentImage && !options.imageTo3d && !options.removeBackground &&
7032
+ !options.segmentImage && !options.segmentVideo && !options.imageTo3d && !options.removeBackground &&
7016
7033
  !options.listMedia &&
7017
7034
  !options.memoryAction &&
7018
7035
  !options.personalityAction &&
@@ -7087,7 +7104,7 @@ const wan3HasMediaInput = isWan3ModelLocal(options.model) && Boolean(
7087
7104
  || options.wan3ReferenceFileUrl
7088
7105
  || options.wan3ReferenceLinkUrl
7089
7106
  );
7090
- if (!options.prompt && !options.projectLookup && !options.seedanceFinalize && !wan3HasMediaInput && !options.segmentImage && !options.imageTo3d && !options.removeBackground && !options.upscaleImage && !options.upscaleVideo && !options.apiChat && !apiWorkflowUtilityAction && !apiWorkflowStartAction && !apiModelUtilityAction && !liveModelUtilityAction && !loraCatalogUtilityAction && !apiReplayUtilityAction && !contractUtilityAction && !storyboardPlanUtilityAction && !options.estimateVideoCost && !options.multiAngle && !options.showBalance && !options.showVersion && !options.doctor && !options.extractLastFrame && !options.extractFirstFrame && !options.extractFrameAt && !options.trimVideo && !options.verifyVideo && !options.concatVideos && !options.sourceReelDir && !options.remixAudio && !options.listMedia && !options.memoryAction && !options.personalityAction && !personaUtilityAction) {
7107
+ if (!options.prompt && !options.projectLookup && !options.seedanceFinalize && !wan3HasMediaInput && !options.segmentImage && !options.segmentVideo && !options.imageTo3d && !options.removeBackground && !options.upscaleImage && !options.upscaleVideo && !options.apiChat && !apiWorkflowUtilityAction && !apiWorkflowStartAction && !apiModelUtilityAction && !liveModelUtilityAction && !loraCatalogUtilityAction && !apiReplayUtilityAction && !contractUtilityAction && !storyboardPlanUtilityAction && !options.estimateVideoCost && !options.multiAngle && !options.showBalance && !options.showVersion && !options.doctor && !options.extractLastFrame && !options.extractFirstFrame && !options.extractFrameAt && !options.trimVideo && !options.verifyVideo && !options.concatVideos && !options.sourceReelDir && !options.remixAudio && !options.listMedia && !options.memoryAction && !options.personalityAction && !personaUtilityAction) {
7091
7108
  fatalCliError('No prompt provided. Use --help for usage.', { code: 'INVALID_ARGUMENT' });
7092
7109
  }
7093
7110
 
@@ -7128,7 +7145,14 @@ if (options.apiChat && !options.prompt && getApiModeMediaReferences().length ===
7128
7145
  fatalCliError('--api-chat requires a prompt or media reference for planning.', { code: 'INVALID_ARGUMENT' });
7129
7146
  }
7130
7147
 
7131
- if (options.segmentImage) {
7148
+ if (options.segmentVideo) {
7149
+ if (options.prompt || options.video || options.music || options.segmentImage || options.upscaleImage || options.upscaleVideo || options.photobooth || options.contextImages.length || options.refImage || options.refImageEnd
7150
+ || options.apiChat || options.apiWorkflowAction || options.multiAngle || options.count !== 1 || cliSet.width || cliSet.height || cliSet.frames || cliSet.fps) {
7151
+ fatalCliError('--segment-video accepts one complete source video with selection points, boxes or text; its dimensions and timing come from the source.', { code: 'INVALID_ARGUMENT' });
7152
+ }
7153
+ try { validateSegmentationPrompts(options.segmentPoints, options.segmentText, options.segmentBoxes); }
7154
+ catch (error) { fatalCliError(error.message, { code: 'INVALID_ARGUMENT' }); }
7155
+ } else if (options.segmentImage) {
7132
7156
  if (options.prompt || options.video || options.music || options.upscaleImage || options.upscaleVideo || options.photobooth || options.contextImages.length || options.refImage || options.refImageEnd
7133
7157
  || options.apiChat || options.apiWorkflowAction || options.multiAngle || options.noFilter || options.count !== 1 || cliSet.width || cliSet.height) {
7134
7158
  fatalCliError('--segment requires one original image with selection points or --segment-text; omit generation prompts, resize, other generation modes and --no-filter.', { code: 'INVALID_ARGUMENT' });
@@ -7136,7 +7160,7 @@ if (options.segmentImage) {
7136
7160
  try { validateSegmentationPrompts(options.segmentPoints, options.segmentText, options.segmentBoxes); }
7137
7161
  catch (error) { fatalCliError(error.message, { code: 'INVALID_ARGUMENT' }); }
7138
7162
  } else if (options.segmentPoints.length || options.segmentBoxes.length || options.segmentText !== null) {
7139
- fatalCliError('Selection prompts require --segment <path|url>.', { code: 'INVALID_ARGUMENT' });
7163
+ fatalCliError('Selection prompts require --segment <path|url> or --segment-video <path|url>.', { code: 'INVALID_ARGUMENT' });
7140
7164
  }
7141
7165
 
7142
7166
  if (options.upscaleImage) {
@@ -15235,7 +15259,7 @@ async function main() {
15235
15259
 
15236
15260
  // Video catalog data is loaded before model-aware dimension planning.
15237
15261
  // Other media types retain the connected-stage lookup used previously.
15238
- if (!options.video && !options.upscaleVideo) {
15262
+ if (!options.video && !options.upscaleVideo && !options.segmentVideo) {
15239
15263
  await loadLiveModelDefaults(options.model);
15240
15264
  }
15241
15265
  await ensureSufficientVideoBalance(client, log);
@@ -15331,7 +15355,7 @@ async function main() {
15331
15355
  const jobData = data.job?.data || {};
15332
15356
  const withheld = data.job?.isWithheld === true;
15333
15357
  results.push({
15334
- resultUrl: withheld ? null : data.resultUrl || ((options.music || options.speech) ? data.audioUrl : (options.video || options.upscaleVideo) ? data.videoUrl : data.imageUrl),
15358
+ resultUrl: withheld ? null : data.resultUrl || ((options.music || options.speech) ? data.audioUrl : (options.video || options.upscaleVideo || options.segmentVideo) ? data.videoUrl : data.imageUrl),
15335
15359
  lastFrameUrl: withheld ? null : data.lastFrameUrl || data.job?.lastFrameUrl || jobData.lastFrameUrl,
15336
15360
  seed: jobData.seed,
15337
15361
  jobIndex: data.jobIndex,
@@ -15342,7 +15366,7 @@ async function main() {
15342
15366
  ...(withheld ? { urlUnavailable: 'sensitiveContent' } : {})
15343
15367
  });
15344
15368
  completedJobs++;
15345
- log(`${options.speech ? 'Speech' : options.imageTo3d ? '3D model' : options.music ? 'Music' : (options.video || options.upscaleVideo) ? 'Video' : 'Image'} ${completedJobs}/${options.count} ${withheld ? 'withheld by the Sensitive Content Filter' : 'completed'}`);
15369
+ log(`${options.speech ? 'Speech' : options.imageTo3d ? '3D model' : options.music ? 'Music' : (options.video || options.upscaleVideo || options.segmentVideo) ? 'Video' : 'Image'} ${completedJobs}/${options.count} ${withheld ? 'withheld by the Sensitive Content Filter' : 'completed'}`);
15346
15370
 
15347
15371
  if (completedJobs >= options.count) {
15348
15372
  projectWait.stop();
@@ -15373,7 +15397,7 @@ async function main() {
15373
15397
  });
15374
15398
 
15375
15399
  // Progress for longer-running media jobs.
15376
- if (options.video || options.music || options.speech || options.imageTo3d || options.removeBackground || options.upscaleVideo) {
15400
+ if (options.video || options.music || options.speech || options.imageTo3d || options.removeBackground || options.upscaleVideo || options.segmentVideo) {
15377
15401
  client.on(ClientEvent.PROJECT_PROGRESS, (data) => {
15378
15402
  if (data.percentage && data.percentage > 0) {
15379
15403
  log(`Progress: ${Math.round(data.percentage)}%`);
@@ -16115,6 +16139,15 @@ async function main() {
16115
16139
  if (audioResult?.error || audioResult?.message) {
16116
16140
  throw buildProjectResultError(audioResult);
16117
16141
  }
16142
+ } else if (options.segmentVideo) {
16143
+ log(`Tracking the selected object with ${SAM3_VIDEO_MODEL_ID}...`);
16144
+ const bytes = await fetchMediaBuffer(options.segmentVideo);
16145
+ const source = await probeVideoUpscaleSource(bytes, options.segmentVideo);
16146
+ const config = videoSegmentationConfig(bytes, source, { points: options.segmentPoints, boxes: options.segmentBoxes, text: options.segmentText,
16147
+ frameIndex: options.segmentFrame, objectIndex: options.segmentObject, tokenType: options.tokenType || 'spark' });
16148
+ Object.assign(options, { width: source.width, height: source.height, frames: source.frames, fps: source.fps, outputFormat: 'mp4' });
16149
+ const result = trackProjectResult(await client.createVideoProject(withBillingMode(config)));
16150
+ if (result?.error || result?.message) throw buildProjectResultError(result);
16118
16151
  } else if (options.upscaleVideo) {
16119
16152
  log(`Upscaling video with ${FLASHVSR_MODEL_ID}...`);
16120
16153
  const sourceBuffer = await fetchMediaBuffer(options.upscaleVideo);
@@ -16504,7 +16537,7 @@ async function main() {
16504
16537
  const seeds = results.map(r => r.seed ?? options.seed);
16505
16538
  const renderInfo = {
16506
16539
  timestamp: new Date().toISOString(),
16507
- type: options.speech ? 'speech' : options.imageTo3d ? 'model' : options.music ? 'music' : (options.video || options.upscaleVideo) ? 'video' : 'image',
16540
+ type: options.speech ? 'speech' : options.imageTo3d ? 'model' : options.music ? 'music' : (options.video || options.upscaleVideo || options.segmentVideo) ? 'video' : 'image',
16508
16541
  prompt: options.prompt,
16509
16542
  model: options.model,
16510
16543
  width: (options.music || options.speech || options.imageTo3d) ? null : options.width,
@@ -16755,7 +16788,7 @@ async function main() {
16755
16788
  await buildConcatVideoFromClips(options.output, [clip1Path, clip2Path]);
16756
16789
  log(`Saved looping video to ${options.output}`);
16757
16790
  } else {
16758
- writeOutputFileSafe(options.output, buffer, (options.video || options.upscaleVideo) ? 'video' : (options.music || options.speech) ? 'audio' : options.imageTo3d ? 'model' : 'image');
16791
+ writeOutputFileSafe(options.output, buffer, (options.video || options.upscaleVideo || options.segmentVideo) ? 'video' : (options.music || options.speech) ? 'audio' : options.imageTo3d ? 'model' : 'image');
16759
16792
  log(`Saved to ${options.output}`);
16760
16793
  }
16761
16794
  }
@@ -16787,7 +16820,7 @@ async function main() {
16787
16820
  if (options.json) {
16788
16821
  const output = {
16789
16822
  success: true,
16790
- type: options.speech ? 'speech' : options.imageTo3d ? 'model' : options.music ? 'music' : (options.video || options.upscaleVideo) ? 'video' : 'image',
16823
+ type: options.speech ? 'speech' : options.imageTo3d ? 'model' : options.music ? 'music' : (options.video || options.upscaleVideo || options.segmentVideo) ? 'video' : 'image',
16791
16824
  prompt: options.prompt,
16792
16825
  model: options.model,
16793
16826
  width: (options.music || options.speech || options.imageTo3d) ? null : options.width,
package/sogni-app-id.mjs CHANGED
@@ -19,6 +19,7 @@
19
19
  import { randomUUID } from 'node:crypto';
20
20
  import {
21
21
  closeSync,
22
+ linkSync,
22
23
  mkdirSync,
23
24
  openSync,
24
25
  readFileSync,
@@ -35,8 +36,6 @@ const DEFAULT_APP_ID_POOL_DIR = join(homedir(), '.config', 'sogni', 'app-ids');
35
36
  const DEFAULT_APP_ID_POOL_MAX = 32;
36
37
  const GENERATED_APP_ID_PREFIX = 'sogni-agent-';
37
38
  const MAX_APP_ID_LENGTH = 256;
38
- const APP_ID_CREATE_RETRIES = 20;
39
- const APP_ID_CREATE_RETRY_MS = 5;
40
39
 
41
40
  function expandHomePath(rawPath) {
42
41
  if (rawPath === '~') return homedir();
@@ -63,14 +62,6 @@ function validateAppId(value, source) {
63
62
  return appId;
64
63
  }
65
64
 
66
- function waitForConcurrentWriter() {
67
- // Another process can observe the file in the tiny interval between its
68
- // exclusive creation and first write. Atomics.wait gives that writer a few
69
- // milliseconds without introducing an async API into client construction.
70
- const signal = new Int32Array(new SharedArrayBuffer(4));
71
- Atomics.wait(signal, 0, 0, APP_ID_CREATE_RETRY_MS);
72
- }
73
-
74
65
  function readPersistedAppId(appIdPath) {
75
66
  return validateAppId(readFileSync(appIdPath, 'utf8'), `Sogni app-id file ${appIdPath}`);
76
67
  }
@@ -85,7 +76,7 @@ function appIdPersistenceError(error, appIdPath) {
85
76
 
86
77
  /**
87
78
  * Create-once/read-forever identity file. Concurrent first launches race on
88
- * exclusive create; losers reuse the winner's value.
79
+ * atomic publication; losers reuse the winner's complete value.
89
80
  */
90
81
  function getOrCreateAppIdFile(resolvedPath, generateUuid) {
91
82
  try {
@@ -99,39 +90,20 @@ function getOrCreateAppIdFile(resolvedPath, generateUuid) {
99
90
  `${GENERATED_APP_ID_PREFIX}${generateUuid()}`,
100
91
  'Generated Sogni app ID',
101
92
  );
102
- let descriptor;
103
- let createdFile = false;
93
+ const temporaryPath = `${resolvedPath}.${process.pid}.${randomUUID()}.tmp`;
104
94
  try {
105
- descriptor = openSync(resolvedPath, 'wx', 0o600);
106
- createdFile = true;
107
- writeFileSync(descriptor, `${candidate}\n`, 'utf8');
108
- return candidate;
109
- } catch (error) {
110
- if (error?.code !== 'EEXIST') throw error;
111
-
112
- // A concurrent first launch won the exclusive create. Reuse its value
113
- // once the short write window closes.
114
- let lastError = error;
115
- for (let attempt = 0; attempt < APP_ID_CREATE_RETRIES; attempt += 1) {
116
- try {
117
- return readPersistedAppId(resolvedPath);
118
- } catch (readError) {
119
- lastError = readError;
120
- if (attempt + 1 < APP_ID_CREATE_RETRIES) waitForConcurrentWriter();
121
- }
95
+ writeFileSync(temporaryPath, `${candidate}\n`, { encoding: 'utf8', flag: 'wx', mode: 0o600 });
96
+ try {
97
+ // A hard link publishes complete bytes atomically without replacing an
98
+ // existing identity. Concurrent readers never see an empty first write.
99
+ linkSync(temporaryPath, resolvedPath);
100
+ return candidate;
101
+ } catch (error) {
102
+ if (error?.code !== 'EEXIST') throw error;
103
+ return readPersistedAppId(resolvedPath);
122
104
  }
123
- throw lastError;
124
105
  } finally {
125
- if (descriptor !== undefined) closeSync(descriptor);
126
- // Do not strand an empty/corrupt identity if this process created the
127
- // file but could not finish writing it.
128
- if (createdFile) {
129
- try {
130
- readPersistedAppId(resolvedPath);
131
- } catch {
132
- try { unlinkSync(resolvedPath); } catch { /* best effort */ }
133
- }
134
- }
106
+ try { unlinkSync(temporaryPath); } catch { /* best effort: only our temporary file */ }
135
107
  }
136
108
  }
137
109
 
package/version.mjs CHANGED
@@ -1 +1 @@
1
- export const PACKAGE_VERSION = '3.65.1';
1
+ export const PACKAGE_VERSION = '3.66.1';