@sogni-ai/sogni-creative-agent-skill 3.52.2 → 3.53.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.
@@ -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, apply a saved identity, or refine an earlier Sogni result."
4
4
  license: MIT
5
5
  metadata:
6
- version: "3.52.2"
6
+ version: "3.53.0"
7
7
  author: Sogni AI
8
8
  hermes:
9
9
  category: creative
@@ -36,10 +36,10 @@ require 23 GB, while jobs with an H3 LoRA require 32 GB. FastH3 has no R2V
36
36
  mode. Always check the exact FastVideo model id's live catalog before relying
37
37
  on a particular adapter.
38
38
  The FastH3 audio-to-video modes (`minimax-h3-fasth3-ia2v-turbo`,
39
- `-flfa2v-turbo`, `-a2v-turbo` and their `-2stage` forms) load no LoRAs: the
40
- CLI refuses `--lora` on them before reading the catalog, and Sogni refuses the
41
- request too. To combine a LoRA with a character's voice, render a FastH3
42
- frame mode with its generated audio instead.
39
+ `-flfa2v-turbo`, `-a2v-turbo` and their `-2stage` forms) take the same catalog
40
+ and Personal H3 LoRAs as the frame modes (as of 2026-09-23): pass `--lora` with
41
+ `--ref-audio`, and the CLI resolves them against the selected audio mode's live
42
+ catalog exactly as it does for every other H3 selector.
43
43
 
44
44
  ## Published adapters
45
45
 
@@ -0,0 +1,79 @@
1
+ # Long jobs, queued work, and results after a session
2
+
3
+ Sogni projects run on the network, not in the CLI process. A project keeps
4
+ going when the CLI stops waiting, when its connection drops, and when no agent
5
+ is connected at all. These commands follow a project by id instead of holding a
6
+ connection open for its whole life.
7
+
8
+ ## Commands
9
+
10
+ ```bash
11
+ # Submit and return at once; prints the project id and the follow-up commands.
12
+ sogni-agent --video -m minimax-h3-ref2va-fp8_r2v --workflow r2v -c face.png --detach --json "A slow dolly toward the subject"
13
+
14
+ # State, and while queued, why it is waiting.
15
+ sogni-agent --status <projectId> --json
16
+
17
+ # Finished media (-o saves it; several renders get -2, -3 suffixes like a normal run).
18
+ sogni-agent --result <projectId> -o clip.mp4 --json
19
+
20
+ # This account's completed projects, newest first (default 24 h, max 168).
21
+ sogni-agent --recent --json
22
+ sogni-agent --recent 6 --json
23
+ ```
24
+
25
+ `--detach` refuses flows that submit a second project after the first finishes
26
+ (`--looping`, `--multi-angle`, source reels, hosted workflows and `--api-chat`).
27
+
28
+ ## Start of a session
29
+
30
+ Run `sogni-agent --recent --json` and offer the user any results they have not
31
+ seen. The socket holds a project that finished while its client was
32
+ disconnected for one hour only; `--recent` and `--result` read the durable
33
+ account history (7 days), so nothing that finished while the agent was away is
34
+ lost.
35
+
36
+ ## Why a project is waiting
37
+
38
+ `--status` (and the progress log of a waiting run) reports the server's reason:
39
+
40
+ - **Plan limit**: "you've reached your Unlimited plan limit for simultaneous
41
+ MiniMax H3 videos". The account is already running as many of these as its
42
+ plan allows: the Unlimited plan runs one standard MiniMax H3 video at a time
43
+ and Unlimited Pro two, while H3 Balanced and Turbo get more. It starts by
44
+ itself when one of the account's own jobs finishes. This is not a shortage of
45
+ workers; submitting more only lengthens the line. Tell the user plainly, and
46
+ mention Unlimited Pro only when they ask how to run more at once.
47
+ - **Confirming payment**: brief; it clears on its own.
48
+ - **Waiting for an available worker**: the network has no free worker that can
49
+ run it yet.
50
+
51
+ Never resubmit or cancel a queued project to "retry" it. That loses its place
52
+ and, for a plan-limited queue, changes nothing.
53
+
54
+ ## Batches
55
+
56
+ Several standard MiniMax H3 videos submitted together on Unlimited run one after
57
+ another: the last waits for every render ahead of it. Before submitting a batch,
58
+ say so and estimate the wait as one render's time multiplied by the number of
59
+ renders ahead of it, not a single-job estimate. Before each video submission the
60
+ CLI notes how many of the account's other video projects are already queued or
61
+ rendering (from other runs, apps or devices).
62
+
63
+ ## Timeouts
64
+
65
+ `-t` is how long a run waits, counted from submission (uploads excluded). Time
66
+ the account's own plan limit holds a project is not counted, because that wait
67
+ ends on its own. When `-t` runs out the project is **not** cancelled: the run
68
+ exits with `errorCode: "PROJECT_TIMEOUT_STILL_RUNNING"`, and
69
+ `details.resultCommands` holds the `sogni-agent --result <id>` commands that
70
+ fetch it later (`details.waitingReason` says why it was still waiting).
71
+ `--cancel-on-timeout` restores the old behavior of cancelling on timeout.
72
+
73
+ Hosts that cap a single tool call (often around 10 minutes) cannot wait out a
74
+ long video in one call. Submit it with `--detach`, check back with `--status`,
75
+ and collect it with `--result <id> -o <file>` in later calls, instead of
76
+ raising `-t`.
77
+
78
+ `--status`, `--result` and `--recent` need `@sogni-ai/sogni-client` 5.57.0 or
79
+ later; an older installation says so and asks for a skill update.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sogni-creative-agent",
3
- "version": "3.52.2",
3
+ "version": "3.53.0",
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.52.2",
3
+ "version": "3.53.0",
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,30 @@
1
+ ## [3.53.0] - 2026-09-25
2
+
3
+ ### Features
4
+
5
+ * **A timeout no longer cancels the project.** When `-t` runs out, the project keeps rendering on Sogni and the run exits with `errorCode: "PROJECT_TIMEOUT_STILL_RUNNING"`. `details.resultCommands` holds the `sogni-agent --result <id>` commands that fetch it later, and `details.waitingReason` says why it was still waiting. `--cancel-on-timeout` restores the old behavior. The clock now starts at submission (uploads excluded). Time the account's own plan limit holds a project is not counted, because that wait ends by itself.
6
+ * Follow a project by its id. Every run prints each project id as soon as it is submitted. `--detach` (`--no-wait`) submits and returns with the id. `--status <id>` shows the project's state and, while it is queued, why. `--result <id>` fetches its finished media (`-o` saves it, with `-2`, `-3` suffixes for several renders). `--recent [hours]` lists this account's completed projects, newest first (default 24 hours, max 168). Projects that finished while no agent was connected are included; the server holds a result for a disconnected client for one hour only, but `--recent` and `--result` read the account's history. `--detach` refuses flows that submit a second project after the first (`--looping`, `--multi-angle`, source reels, hosted workflows and `--api-chat`).
7
+ * Say why a project is queued, in the same words as Sogni Web. A plan limit reads "you've reached your Unlimited plan limit for simultaneous MiniMax H3 videos": the account's own limit, which starts the project when one of its running jobs finishes. It is not a shortage of workers, and resubmitting only lengthens the line. Confirming payment and waiting for an available worker are reported separately.
8
+ * Before a video is submitted, note how many of the account's other video projects are already queued or rendering from other runs, apps or devices, since those may run first.
9
+ * Agent guidance in SKILL.md and the new `references/long-jobs-and-queues.md`: check `--recent` at the start of a session and offer unseen results; never resubmit or cancel a queued project; a batch of standard MiniMax H3 videos on Unlimited runs one after another, so estimate the wait for the whole batch; on hosts that cap a single tool call, submit long videos with `--detach` and collect them with `--result`.
10
+
11
+ ### Bug Fixes
12
+
13
+ * Document the actual default video timeout, 1800 seconds (the skill said 300), and the 600-second music default.
14
+ * Update the generation clients to SDK 5.57.0 and intelligence client 4.4.2. The SDK now chooses a result's download endpoint from the model's media kind, the result's content type and the project's type instead of assuming an image, and recognizes Wan 2.2 sound-to-video and Qwen3-TTS results as media. `--status`, `--result` and `--recent` need SDK 5.57.0; an older installation says so and asks for a skill update.
15
+
16
+ ## [3.52.4] - 2026-09-23
17
+
18
+ ### Features
19
+
20
+ * Pass `--lora` on the MiniMax H3 FastH3 audio-to-video modes (`-ia2v-turbo`, `-flfa2v-turbo`, `-a2v-turbo` and their `-2stage` forms). Catalog and Personal H3 LoRAs resolve against the selected audio mode exactly as on the frame modes, on the released generation clients.
21
+
22
+ ## [3.52.3] - 2026-09-23
23
+
24
+ ### Bug Fixes
25
+
26
+ * Update the generation clients to preserve authoritative queue reasons across reconnects, partial batches, and recovered projects.
27
+
1
28
  ## [3.52.2] - 2026-09-23
2
29
 
3
30
  ### Bug Fixes
package/README.md CHANGED
@@ -674,6 +674,8 @@ Run `sogni-agent --help` for the full CLI. Below are the options and tables most
674
674
  | `--extract-first-frame`, `--extract-frame-at`, `--extract-last-frame` | Extract visual-QA frames through safe FFmpeg wrappers |
675
675
  | `--verify-video <path>` | Probe streams and fully decode a final video before delivery |
676
676
  | `--last`, `--last-image` | Inspect last render / reuse last image as context or video reference |
677
+ | `-t <sec>`, `--cancel-on-timeout` | How long a run waits, from submission (default 30 image, 1800 video, 600 music). Time the account's own plan limit holds a project is not counted. A timeout leaves the project running and prints the `--result` command that fetches it; `--cancel-on-timeout` cancels instead |
678
+ | `--detach` (`--no-wait`), `--status <id>`, `--result <id>`, `--recent [hours]` | Submit and return with the project id; check a project's state and why it is queued (plan limit or workers); fetch its finished media (`-o` saves it); list this account's completed projects (default 24 h, max 168) |
677
679
  | `--strict-size` | Fail instead of auto-adjusting video size |
678
680
  | `--json` | Emit structured output for agents |
679
681
  | `-n <count>` | Multiple outputs per call (safety-capped at 16; raise deliberately with `SOGNI_MAX_COUNT`) |
@@ -733,7 +735,7 @@ Prefer `-Q fast|hq|pro` for images and automatic workflow routing for video. Pas
733
735
  | MiniMax H3 FastH3 Turbo first-frame → last-frame video | `minimax-h3-fasth3-flf2v-turbo` with `--ref A --ref-end B`; FastH3 has no R2V mode |
734
736
  | MiniMax H3 1080p or 2K video (FastH3 Two-Stage, delivered at twice the canvas) | `minimax-h3-fasth3-turbo-2stage` (infers the frame mode; 2K default, `--target-resolution 1080` or `720`), or `minimax-h3-fasth3-t2v-turbo-2stage` / `-i2v-turbo-2stage` / `-flf2v-turbo-2stage`; no R2V |
735
737
  | MiniMax H3 1080p or 2K reference-to-video (Ref2VA Two-Stage, delivered at twice the canvas) | `minimax-h3-r2v-2stage` (Standard, 20 steps) or `minimax-h3-r2v-balanced-2stage` (Balanced, 8 steps): the same references, durations and LoRAs as `minimax-h3-r2v` / `minimax-h3-r2v-balanced`; 2K default, `--target-resolution 1080` or `720` |
736
- | MiniMax H3 video driven by your own voice or song (FastH3 audio-to-video) | `minimax-h3-fasth3-ia2v-turbo` (`--ref` + `--ref-audio`), `minimax-h3-fasth3-flfa2v-turbo` (`--ref` + `--ref-end` + `--ref-audio`), or `minimax-h3-fasth3-a2v-turbo` (`--ref-audio`); `minimax-h3-fasth3-turbo` with `--ref-audio` picks the mode; add `-2stage` for Two-Stage; no LoRAs |
738
+ | MiniMax H3 video driven by your own voice or song (FastH3 audio-to-video) | `minimax-h3-fasth3-ia2v-turbo` (`--ref` + `--ref-audio`), `minimax-h3-fasth3-flfa2v-turbo` (`--ref` + `--ref-end` + `--ref-audio`), or `minimax-h3-fasth3-a2v-turbo` (`--ref-audio`); `minimax-h3-fasth3-turbo` with `--ref-audio` picks the mode; add `-2stage` for Two-Stage; `--lora` works as on the frame modes |
737
739
  | Text-to-video with native dialogue/audio | `ltx25` (Distilled) or `ltx25-22b-int8_t2v_dev` (Dev/HQ) |
738
740
  | Explicit uncensored image-to-video on 30GB+ GPUs | `ltx23-eros` with `--no-filter` |
739
741
  | Image or first/last frames to video | `ltx25-i2v` (FLF shares the I2V model ID) |
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 (named people with saved reference photos and voice clips), 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\", \"apply a style\", or \"generate me as a superhero\"."
4
4
  metadata:
5
- version: "3.52.2"
5
+ version: "3.53.0"
6
6
  homepage: https://sogni.ai
7
7
  openclaw:
8
8
  emoji: "🎨"
@@ -310,7 +310,7 @@ sogni-agent doctor --json
310
310
  | `--model-tag <tag>` | Filter by an official catalog tag such as `spicy` or `uncensored`; repeat for AND matching | - |
311
311
  | `--json` | Machine-parseable stdout (progress goes to stderr) | false |
312
312
  | `-q, --quiet` | Suppress progress output | false |
313
- | `-t <sec>` | Timeout | 30 image / 300 video |
313
+ | `-t <sec>` | Stop waiting (from submission; plan-limit queue time not counted); never cancels. Also `--detach`, `--status <id>`, `--result <id>`, `--recent [h]` | 30 image / 1800 video / 600 music |
314
314
  | `--strict-size` | Fail instead of auto-adjusting video size | false |
315
315
  | `doctor`, `self-update`, `--whats-new`, `--snooze-update` | Health check / upgrade / changelog / snooze reminder | - |
316
316
 
@@ -367,7 +367,7 @@ H3 r2v accepts up to **9 images** (`--ref` then repeatable `-c`), **3 videos** (
367
367
 
368
368
  **Music-locked video is immutable.** When the user asks for the same/specific/original/trending song or choreography tied to it, never invent, imitate, recompose, remix, replace, or add a copyright-avoidance mutation. For H3 Ref2VA use `audio reuse`, `<Audio N>: fully_copy`, and explicit source action times; then stream-copy/remux the original soundtrack into the final deliverable. `audio reference` means a newly generated signal and is allowed only when explicitly requested. Ref2VA is loose conditioning: if edit-level choreography timing is mandatory, use a pose/edit-controlled workflow or stop before spending compute rather than promise exact sync.
369
369
 
370
- [Personal LoRA library management](./references/personal-loras.md) covers imports, consent, status and compatible models. **MiniMax H3 is the only video family that loads LoRAs** (not its FastH3 audio-to-video modes). Attach them with the same repeatable `--lora <id> --lora-strength <n>` arguments the image models take, and name the explicit H3 mode in the same command — availability differs per mode, and bare `-m minimax-h3` cannot be validated. Video LoRAs are positive-only: a negative value is not an inverse effect and `0` is off, unlike the bipolar Krea 2 image sliders. Omit `--lora-strengths` to apply each adapter's catalog default rather than the worker's 1.0 fallback. `h3-realism-people` needs its trigger word `r34l1sm` near the FRONT of the prompt or it renders as ordinary H3 with no error. The CLI validates every id against the live catalog for the model you selected, so a wrong id fails before it costs a render instead of being dropped silently. LTX, WAN, Seedance, and HappyHorse load none. Read [`references/h3-video-loras.md`](./references/h3-video-loras.md) for per-mode availability and ranges.
370
+ [Personal LoRA library management](./references/personal-loras.md) covers imports, consent, status and compatible models. **MiniMax H3 is the only video family that loads LoRAs**, including its FastH3 audio-to-video modes. Attach them with the same repeatable `--lora <id> --lora-strength <n>` arguments the image models take, and name the explicit H3 mode in the same command — availability differs per mode, and bare `-m minimax-h3` cannot be validated. Video LoRAs are positive-only: a negative value is not an inverse effect and `0` is off, unlike the bipolar Krea 2 image sliders. Omit `--lora-strengths` to apply each adapter's catalog default rather than the worker's 1.0 fallback. `h3-realism-people` needs its trigger word `r34l1sm` near the FRONT of the prompt or it renders as ordinary H3 with no error. The CLI validates every id against the live catalog for the model you selected, so a wrong id fails before it costs a render instead of being dropped silently. LTX, WAN, Seedance, and HappyHorse load none. Read [`references/h3-video-loras.md`](./references/h3-video-loras.md) for per-mode availability and ranges.
371
371
 
372
372
  **H3 requires MiniMax's official ordered-field prompt contract.** Standard, Balanced, LightX2V Turbo, and FastH3 T2V/I2V/L2V/FLF2V (and the FastH3 audio modes, with the I2V or FLF2V preamble when frames are supplied) use `integrated_multimodal_description`, `overall_soundscape`, then `non_diegetic_music`, with the mode-specific alignment preamble for endpoint-conditioned modes. Use `[Shot N]` notation, stable `(S1)` speaker IDs, and dialogue as `<d>[Language] words</d>`. Preserve supplied dialogue exactly; author one concise line only when the user explicitly asks for speech/dialogue/lyrics without supplying words, and otherwise invent no speech. Use `<scenetrans>` at both connecting points when one line crosses a cut and `<cutoff>` only when the video ending truncates speech. Do not substitute quoted prose, bracketed timecode lists, or tokenizer-internal `<|...|>` markers. Ref2VA uses its separate six-field contract and exact task/retention vocabulary; loose video references do not promise editing or continuation. Negative direction belongs inside the structured prompt because there is no negative-prompt field. Read [`references/video-prompting.md`](./references/video-prompting.md) § MiniMax H3 Prompting before writing any H3 prompt.
373
373
 
@@ -417,7 +417,7 @@ On a **Sogni Unlimited** subscription, Sogni-hosted (Supernet) image, video, and
417
417
 
418
418
  **Do not infer a Spark charge from `tokenType: "spark"`.** `tokenType` is the quote/accounting denomination and may remain `spark` on a covered Unlimited job. Billing is decided separately by the server's `paymentModel`: `subscription` means the artist Spark/SOGNI debit was skipped; `paid_spark`, `free_spark`, or `sogni` means token billing. If a result does not expose `paymentModel`, treat the payment source as unknown rather than warning that Spark was spent. Check the structured subscription state or transaction history when available. A successful request made with `--billing-mode subscription` is covered: if the server cannot use Unlimited, it rejects the request with `4078` or `4080` instead of silently falling back to Spark.
419
419
 
420
- Unlimited is fair-use, not unmetered. Describe only the concurrency and queue limits shown in the current plan catalog; actual throughput can vary with demand, available Supernet capacity, and fair-use controls. If generation is temporarily at capacity, ask the user to wait for active jobs to finish or try again later, or offer Premium Spark for fastest priority. Do not speculate about unpublished scheduling mechanics or availability windows, and never describe the plan as "relaxed."
420
+ Unlimited is fair-use, not unmetered. Describe only the concurrency and queue limits shown in the current plan catalog; actual throughput can vary with demand, available Supernet capacity, and fair-use controls. If generation is temporarily at capacity, ask the user to wait for active jobs to finish or try again later, or offer Premium Spark for fastest priority. Do not speculate about unpublished scheduling mechanics or availability windows, and never describe the plan as "relaxed." **Queued work, long jobs, and results after a session.** Start each session with `sogni-agent --recent --json` and offer results the user has not seen; projects finish on Sogni even when no agent is connected. A queued project is not lost: never resubmit or cancel it. `--status <id>` says whether the account's own plan limit holds it (Unlimited runs one standard MiniMax H3 video at a time; it starts by itself when one of the account's jobs finishes, and it is not a worker shortage) or it is waiting for a worker. A batch of standard H3 videos on Unlimited runs one after another; say so and estimate the whole wait. On hosts that cap a tool call, submit long videos with `--detach` and collect them with `--result <id> -o <file>`. A timeout exits with `PROJECT_TIMEOUT_STILL_RUNNING` and never cancels. Details: [`references/long-jobs-and-queues.md`](./references/long-jobs-and-queues.md).
421
421
 
422
422
  When a generation cannot bill to the subscription, the CLI returns a structured error (`errorCategory: "subscription_billing"`). Respond by the `errorCode`, and **do not** collect payment details or simulate a purchase:
423
423
 
@@ -476,8 +476,7 @@ Eligible Sogni-hosted renders use Unlimited coverage when active; otherwise rend
476
476
  - **Error 4061 / too many app IDs:** the CLI leases stable IDs from the persistent pool in `~/.config/sogni/app-ids/`. Do not delete that directory between runs. For ephemeral/container homes, set the same `SOGNI_APP_ID` on every session. An existing block may require waiting before retrying after upgrading.
477
477
  - **Kicked mid-render / SWITCH_CONNECTION 4015:** two processes shared one app ID. The slot pool prevents this for concurrent CLI runs; if a long-lived daemon also uses this account, give it its own pinned `SOGNI_APP_ID`.
478
478
  - **Video size errors:** sizes are model-specific (WAN 2.2 ÷16 min 480 max 1536; Wan 3 uses its exact 480P/720P/1080P ratio buckets; LTX ÷64, long side ≤2048). The CLI auto-adjusts for local refs; `--strict-size` makes it fail with a suggested size instead. Details in [`references/models.md`](./references/models.md).
479
- - **Timeouts:** try a faster model or raise `-t`.
480
- - **No workers:** check https://sogni.ai for network status.
479
+ - **Timeouts / no workers:** a timeout never cancels; the project finishes on Sogni and `sogni-agent --result <id>` fetches it (`details.resultCommands`). For long videos use `--detach`, not a large `-t`. `--status <id>` says whether it waits on the plan limit or on workers; for network status see https://sogni.ai.
481
480
 
482
481
  ## Reference Index (read before acting)
483
482
 
@@ -496,4 +495,5 @@ Eligible Sogni-hosted renders use Unlimited coverage when active; otherwise rend
496
495
  | [`references/h3-video-loras.md`](./references/h3-video-loras.md) | MiniMax H3 video LoRAs: per-mode availability, trigger words, positive-only strength bands, live catalog discovery |
497
496
  | [`references/personas-memory.md`](./references/personas-memory.md) | Persona CRUD/voice cloning, multi-persona scenes, memories, personality, style transfer, photo restoration |
498
497
  | [`references/openclaw-config.md`](./references/openclaw-config.md) | OpenClaw plugin config defaults and overrides |
498
+ | [`references/long-jobs-and-queues.md`](./references/long-jobs-and-queues.md) | Long videos and batches, `--detach` / `--status` / `--result` / `--recent`, why a project is queued (plan limit vs workers), timeouts that no longer cancel |
499
499
  | [`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.52.2",
5
+ "version": "3.53.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",
@@ -2944,7 +2944,7 @@ const PROMPT_CONTRACTS = [
2944
2944
  "contractId": "sound_to_video_v1",
2945
2945
  "version": "1.1.0",
2946
2946
  "toolName": "sound_to_video",
2947
- "baseDescription": "sound_to_video creates audio-synced video from an audio source. Works with uploaded audio\nfiles (mp3, m4a, wav) OR previously generated music from generate_music (auto-detected).\n\nWhen the user asks to \"turn that song/music into a video\" after generate_music, use\nsound_to_video — it will automatically find the generated audio.\n\nFor music visualization (syncing video to a specific song or audio track), use the\ngenerate_music → sound_to_video pipeline. Do NOT use animate_photo or generate_video for\naudio-driven visualization.\n\nanimate_photo and generate_video produce audio natively via LTX 2.5 or LTX 2.3 — never\npre-generate audio for those tools. sound_to_video is only for when the audio IS the primary creative\ninput driving the video output.\n\nPERSONA VOICE CLIPS: Persona voice clips returned by resolve_personas are voice identity\nreferences for LTX Audio ID, not audio tracks to synchronize. If the user explicitly asks\nfor a registered/persona/reference voice or voice clone, call resolve_personas first, then\nuse generate_video with ltx23 and voicePersonaName when there is no image source, or\nanimate_photo with ltx23 and voicePersonaName when an image/source frame should be\nanimated. Do not call sound_to_video for a persona voice clip unless a separate uploaded\naudio track is the primary sync driver.\n\nMINIMAX H3 AUDIO GUIDE: only when the user asks for MiniMax H3 or FastH3 with an uploaded audio\ntrack, use sound_to_video with videoModel \"minimax-h3-fasth3-ia2v-turbo\" (first-frame image via\nsourceImageIndex), \"minimax-h3-fasth3-flfa2v-turbo\" (first frame via sourceImageIndex and last\nframe via endImageIndex) or \"minimax-h3-fasth3-a2v-turbo\" (audio only, no image). The audio\ndrives the picture from frame 0 and stays in the output. Clips are 124-362 frames at a fixed\n24 fps (about 5.2-15.1 seconds); audioStart picks the window. generateAudio=false, LoRAs and\nnegativePrompt are not supported. Add \"-2stage\" only for 1080p, 1440p or 2K H3 output (1080 or\n1440 targetResolution); 720p-class audio output stays on the regular selector. Never use these\nin place of the LTX 2.5 defaults when the user did not ask for MiniMax H3 or FastH3.",
2947
+ "baseDescription": "sound_to_video creates audio-synced video from an audio source. Works with uploaded audio\nfiles (mp3, m4a, wav) OR previously generated music from generate_music (auto-detected).\n\nWhen the user asks to \"turn that song/music into a video\" after generate_music, use\nsound_to_video — it will automatically find the generated audio.\n\nFor music visualization (syncing video to a specific song or audio track), use the\ngenerate_music → sound_to_video pipeline. Do NOT use animate_photo or generate_video for\naudio-driven visualization.\n\nanimate_photo and generate_video produce audio natively via LTX 2.5 or LTX 2.3 — never\npre-generate audio for those tools. sound_to_video is only for when the audio IS the primary creative\ninput driving the video output.\n\nPERSONA VOICE CLIPS: Persona voice clips returned by resolve_personas are voice identity\nreferences for LTX Audio ID, not audio tracks to synchronize. If the user explicitly asks\nfor a registered/persona/reference voice or voice clone, call resolve_personas first, then\nuse generate_video with ltx23 and voicePersonaName when there is no image source, or\nanimate_photo with ltx23 and voicePersonaName when an image/source frame should be\nanimated. Do not call sound_to_video for a persona voice clip unless a separate uploaded\naudio track is the primary sync driver.\n\nMINIMAX H3 AUDIO GUIDE: only when the user asks for MiniMax H3 or FastH3 with an uploaded audio\ntrack, use sound_to_video with videoModel \"minimax-h3-fasth3-ia2v-turbo\" (first-frame image via\nsourceImageIndex), \"minimax-h3-fasth3-flfa2v-turbo\" (first frame via sourceImageIndex and last\nframe via endImageIndex) or \"minimax-h3-fasth3-a2v-turbo\" (audio only, no image). The audio\ndrives the picture from frame 0 and stays in the output. Clips are 124-362 frames at a fixed\n24 fps (about 5.2-15.1 seconds); audioStart picks the window. MiniMax H3 catalog and Personal\nLoRAs are supported across audio modes and tiers. generateAudio=false and\nnegativePrompt are not supported. Add \"-2stage\" only for 1080p, 1440p or 2K H3 output (1080 or\n1440 targetResolution); 720p-class audio output stays on the regular selector. Never use these\nin place of the LTX 2.5 defaults when the user did not ask for MiniMax H3 or FastH3.",
2948
2948
  "parameterDocs": {
2949
2949
  "audioSource": "Uploaded audio file or reference to a prior generate_music result. Auto-detected when omitted after generate_music.",
2950
2950
  "endImageIndex": "Last frame for the MiniMax H3 FastH3 first/last frame + audio selectors only, indexed like animate_photo (-1 first upload, -2 second upload, non-negative generated results)."
@@ -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.52.2",
5
+ "version": "3.53.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.52.2",
3
+ "version": "3.53.0",
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",
@@ -100,13 +100,13 @@
100
100
  "media-utilities.mjs"
101
101
  ],
102
102
  "dependencies": {
103
- "@sogni-ai/sogni-intelligence-client": "4.3.7",
103
+ "@sogni-ai/sogni-intelligence-client": "4.4.2",
104
104
  "execa": "^10.0.1",
105
105
  "json5": "^2.2.3",
106
106
  "sharp": "0.35.4"
107
107
  },
108
108
  "overrides": {
109
- "@sogni-ai/sogni-client": "5.54.2"
109
+ "@sogni-ai/sogni-client": "5.57.0"
110
110
  },
111
111
  "openclaw": {
112
112
  "extensions": [
@@ -36,10 +36,10 @@ require 23 GB, while jobs with an H3 LoRA require 32 GB. FastH3 has no R2V
36
36
  mode. Always check the exact FastVideo model id's live catalog before relying
37
37
  on a particular adapter.
38
38
  The FastH3 audio-to-video modes (`minimax-h3-fasth3-ia2v-turbo`,
39
- `-flfa2v-turbo`, `-a2v-turbo` and their `-2stage` forms) load no LoRAs: the
40
- CLI refuses `--lora` on them before reading the catalog, and Sogni refuses the
41
- request too. To combine a LoRA with a character's voice, render a FastH3
42
- frame mode with its generated audio instead.
39
+ `-flfa2v-turbo`, `-a2v-turbo` and their `-2stage` forms) take the same catalog
40
+ and Personal H3 LoRAs as the frame modes (as of 2026-09-23): pass `--lora` with
41
+ `--ref-audio`, and the CLI resolves them against the selected audio mode's live
42
+ catalog exactly as it does for every other H3 selector.
43
43
 
44
44
  ## Published adapters
45
45
 
@@ -0,0 +1,79 @@
1
+ # Long jobs, queued work, and results after a session
2
+
3
+ Sogni projects run on the network, not in the CLI process. A project keeps
4
+ going when the CLI stops waiting, when its connection drops, and when no agent
5
+ is connected at all. These commands follow a project by id instead of holding a
6
+ connection open for its whole life.
7
+
8
+ ## Commands
9
+
10
+ ```bash
11
+ # Submit and return at once; prints the project id and the follow-up commands.
12
+ sogni-agent --video -m minimax-h3-ref2va-fp8_r2v --workflow r2v -c face.png --detach --json "A slow dolly toward the subject"
13
+
14
+ # State, and while queued, why it is waiting.
15
+ sogni-agent --status <projectId> --json
16
+
17
+ # Finished media (-o saves it; several renders get -2, -3 suffixes like a normal run).
18
+ sogni-agent --result <projectId> -o clip.mp4 --json
19
+
20
+ # This account's completed projects, newest first (default 24 h, max 168).
21
+ sogni-agent --recent --json
22
+ sogni-agent --recent 6 --json
23
+ ```
24
+
25
+ `--detach` refuses flows that submit a second project after the first finishes
26
+ (`--looping`, `--multi-angle`, source reels, hosted workflows and `--api-chat`).
27
+
28
+ ## Start of a session
29
+
30
+ Run `sogni-agent --recent --json` and offer the user any results they have not
31
+ seen. The socket holds a project that finished while its client was
32
+ disconnected for one hour only; `--recent` and `--result` read the durable
33
+ account history (7 days), so nothing that finished while the agent was away is
34
+ lost.
35
+
36
+ ## Why a project is waiting
37
+
38
+ `--status` (and the progress log of a waiting run) reports the server's reason:
39
+
40
+ - **Plan limit**: "you've reached your Unlimited plan limit for simultaneous
41
+ MiniMax H3 videos". The account is already running as many of these as its
42
+ plan allows: the Unlimited plan runs one standard MiniMax H3 video at a time
43
+ and Unlimited Pro two, while H3 Balanced and Turbo get more. It starts by
44
+ itself when one of the account's own jobs finishes. This is not a shortage of
45
+ workers; submitting more only lengthens the line. Tell the user plainly, and
46
+ mention Unlimited Pro only when they ask how to run more at once.
47
+ - **Confirming payment**: brief; it clears on its own.
48
+ - **Waiting for an available worker**: the network has no free worker that can
49
+ run it yet.
50
+
51
+ Never resubmit or cancel a queued project to "retry" it. That loses its place
52
+ and, for a plan-limited queue, changes nothing.
53
+
54
+ ## Batches
55
+
56
+ Several standard MiniMax H3 videos submitted together on Unlimited run one after
57
+ another: the last waits for every render ahead of it. Before submitting a batch,
58
+ say so and estimate the wait as one render's time multiplied by the number of
59
+ renders ahead of it, not a single-job estimate. Before each video submission the
60
+ CLI notes how many of the account's other video projects are already queued or
61
+ rendering (from other runs, apps or devices).
62
+
63
+ ## Timeouts
64
+
65
+ `-t` is how long a run waits, counted from submission (uploads excluded). Time
66
+ the account's own plan limit holds a project is not counted, because that wait
67
+ ends on its own. When `-t` runs out the project is **not** cancelled: the run
68
+ exits with `errorCode: "PROJECT_TIMEOUT_STILL_RUNNING"`, and
69
+ `details.resultCommands` holds the `sogni-agent --result <id>` commands that
70
+ fetch it later (`details.waitingReason` says why it was still waiting).
71
+ `--cancel-on-timeout` restores the old behavior of cancelling on timeout.
72
+
73
+ Hosts that cap a single tool call (often around 10 minutes) cannot wait out a
74
+ long video in one call. Submit it with `--detach`, check back with `--status`,
75
+ and collect it with `--result <id> -o <file>` in later calls, instead of
76
+ raising `-t`.
77
+
78
+ `--status`, `--result` and `--recent` need `@sogni-ai/sogni-client` 5.57.0 or
79
+ later; an older installation says so and asks for a skill update.
@@ -21,6 +21,7 @@ const referenceFiles = [
21
21
  'image-prompting.md',
22
22
  'interactive-worlds.md',
23
23
  'krea2-loras.md',
24
+ 'long-jobs-and-queues.md',
24
25
  'loop-maker.md',
25
26
  'models.md',
26
27
  'object-selection.md',
@@ -3,12 +3,12 @@
3
3
  "private": true,
4
4
  "type": "module",
5
5
  "dependencies": {
6
- "@sogni-ai/sogni-intelligence-client": "4.3.7",
6
+ "@sogni-ai/sogni-intelligence-client": "4.4.2",
7
7
  "execa": "^10.0.1",
8
8
  "json5": "^2.2.3",
9
9
  "sharp": "0.35.4"
10
10
  },
11
11
  "overrides": {
12
- "@sogni-ai/sogni-client": "5.54.2"
12
+ "@sogni-ai/sogni-client": "5.57.0"
13
13
  }
14
14
  }
package/sogni-agent.mjs CHANGED
@@ -3077,6 +3077,12 @@ const options = {
3077
3077
  json: false,
3078
3078
  quiet: false,
3079
3079
  timeout: 30000,
3080
+ // Stop waiting without cancelling: --detach returns right after submission;
3081
+ // a timeout leaves the project running unless --cancel-on-timeout is set.
3082
+ detach: false,
3083
+ cancelOnTimeout: false,
3084
+ // --status <id> | --result <id> | --recent [hours]
3085
+ projectLookup: null,
3080
3086
  strictSize: false,
3081
3087
  quality: null, // Quality tier: fast|hq|pro — auto-selects model, steps, dimensions
3082
3088
  tokenType: null,
@@ -4395,6 +4401,29 @@ for (let i = 0; i < args.length; i++) {
4395
4401
  options._lastImagePath = lastImagePath;
4396
4402
  }
4397
4403
  }
4404
+ } else if (arg === '--detach' || arg === '--no-wait') {
4405
+ options.detach = true;
4406
+ } else if (arg === '--cancel-on-timeout') {
4407
+ options.cancelOnTimeout = true;
4408
+ } else if (arg === '--status' || arg === '--result') {
4409
+ const projectId = requireFlagValue(args, i, arg);
4410
+ i++;
4411
+ options.projectLookup = { action: arg.slice(2), projectId };
4412
+ } else if (arg === '--recent') {
4413
+ // Optional look-back in hours: `--recent` or `--recent 6`.
4414
+ const next = args[i + 1];
4415
+ let hours = 24;
4416
+ if (next !== undefined && /^\d+(\.\d+)?$/.test(next)) {
4417
+ hours = Number(next);
4418
+ i++;
4419
+ if (!(hours > 0) || hours > 168) {
4420
+ fatalCliError('--recent hours must be between 0 and 168 (7 days).', {
4421
+ code: 'INVALID_ARGUMENT',
4422
+ details: { flag: '--recent', value: next }
4423
+ });
4424
+ }
4425
+ }
4426
+ options.projectLookup = { action: 'recent', hours };
4398
4427
  } else if (arg === '--last') {
4399
4428
  // Show last render info. Use CLI_WANTS_JSON (precomputed from raw argv)
4400
4429
  // because --json may appear after --last in the argument list.
@@ -4652,7 +4681,18 @@ Hosted API Modes:
4652
4681
  --api-base-url <url> Sogni API base URL (default: ${DEFAULT_API_BASE_URL})
4653
4682
 
4654
4683
  General:
4655
- -t, --timeout <sec> Timeout in seconds (default: 30, video: 1800, music: 600)
4684
+ -t, --timeout <sec> Stop waiting after this many seconds (default: 30, video: 1800, music: 600).
4685
+ Counted from submission; time the account's own plan concurrency limit
4686
+ holds the project is not counted. The project is NOT cancelled; fetch it
4687
+ later with --result
4688
+ --cancel-on-timeout Cancel the project when --timeout runs out (the pre-3.53 behavior)
4689
+ --detach, --no-wait Submit, print the project id, and exit without waiting. The project keeps
4690
+ running; use --status / --result to follow it
4691
+ --status <projectId> Show a project's state and, while queued, why it is waiting
4692
+ --result <projectId> Fetch a finished project's media (saved to -o when given), including one
4693
+ that finished after an earlier run stopped waiting
4694
+ --recent [hours] List this account's completed projects from the last N hours
4695
+ (default 24, max 168); fetch one with --result
4656
4696
  --steps <num> Override steps (model-dependent)
4657
4697
  --guidance <num> Override guidance (model-dependent)
4658
4698
  --token-type <type> Token type: spark|sogni|auto (default: spark, auto retries with alternate)
@@ -4833,7 +4873,7 @@ state negatives in the structured prompt.):
4833
4873
  motion from frame 0 and is the clip's soundtrack
4834
4874
  minimax-h3-fasth3-flfa2v-turbo FastH3 first + last frame plus audio (--ref, --ref-end, --ref-audio)
4835
4875
  minimax-h3-fasth3-a2v-turbo FastH3 audio only (--ref-audio). Audio modes: --audio-start picks the window,
4836
- --duration/--frames set its length; no LoRAs, --audio-duration or
4876
+ --duration/--frames set its length; LoRAs supported; no --audio-duration or
4837
4877
  --no-generate-audio. minimax-h3-fasth3-turbo with --ref-audio picks one of these.
4838
4878
  minimax-h3-fasth3-ia2v-turbo-2stage / -flfa2v-turbo-2stage / -a2v-turbo-2stage
4839
4879
  FastH3 Two-Stage audio-to-video; minimax-h3-fasth3-turbo-2stage with --ref-audio
@@ -5319,14 +5359,6 @@ if (options.music && options.loras.length > 0) {
5319
5359
  }
5320
5360
 
5321
5361
  if (options.video && options.loras.length > 0) {
5322
- // No LoRA has been qualified on the FastH3 audio-guide graphs; Sogni refuses
5323
- // them, so stop before reading the catalog or uploading anything.
5324
- if (isMiniMaxH3AudioGuideSelectionLocal(options.model, options.refAudio)) {
5325
- fatalCliError('MiniMax H3 FastH3 audio-to-video does not support LoRAs. Remove --lora/--loras.', {
5326
- code: 'INVALID_ARGUMENT',
5327
- details: { model: options.model, loras: options.loras }
5328
- });
5329
- }
5330
5362
  if (options.loras.length > 8) {
5331
5363
  fatalCliError('Video generation supports at most 8 LoRAs per render.', {
5332
5364
  code: 'INVALID_ARGUMENT',
@@ -6087,10 +6119,28 @@ const wan3HasMediaInput = isWan3ModelLocal(options.model) && Boolean(
6087
6119
  || options.wan3ReferenceFileUrl
6088
6120
  || options.wan3ReferenceLinkUrl
6089
6121
  );
6090
- if (!options.prompt && !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) {
6122
+ if (!options.prompt && !options.projectLookup && !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) {
6091
6123
  fatalCliError('No prompt provided. Use --help for usage.', { code: 'INVALID_ARGUMENT' });
6092
6124
  }
6093
6125
 
6126
+ // --detach returns after the first submission, so it only fits a run that
6127
+ // submits one project up front; these flows submit more after the first ends.
6128
+ if (options.detach) {
6129
+ const multiStage = [
6130
+ ['--looping', options.looping],
6131
+ ['--multi-angle', options.multiAngle],
6132
+ ['--source-reel', options.sourceReelDir],
6133
+ ['--api-chat', options.apiChat],
6134
+ ['hosted workflows', options.apiWorkflowAction]
6135
+ ].find(([, enabled]) => enabled);
6136
+ if (multiStage) {
6137
+ fatalCliError(`--detach cannot be combined with ${multiStage[0]}, which submits more than one project in sequence.`, {
6138
+ code: 'INVALID_ARGUMENT',
6139
+ details: { flag: '--detach', conflictsWith: multiStage[0] }
6140
+ });
6141
+ }
6142
+ }
6143
+
6094
6144
  if (contractUtilityAction && options.contractAction === 'dispatch' && !options.contractToolName) {
6095
6145
  fatalCliError('--dispatch-tool requires a tool name.', { code: 'INVALID_ARGUMENT' });
6096
6146
  }
@@ -11937,13 +11987,373 @@ async function runSourceReel(log) {
11937
11987
  }
11938
11988
  }
11939
11989
 
11990
+ // Reasons the server gives for queued work that is held by the account's own
11991
+ // plan (or payment tier) concurrency limit, not by a shortage of workers.
11992
+ const PLAN_LIMIT_WAITING_REASONS = new Set(['concurrency_limit', 'model_concurrency_limit']);
11993
+
11994
+ /** The @sogni-ai/sogni-client instance behind the intelligence-client wrapper. */
11995
+ function sdkClientOf(wrapper) {
11996
+ return wrapper?.client || null;
11997
+ }
11998
+
11999
+ /** Which plan or payment tier a concurrency limit belongs to (same wording as sogni-web). */
12000
+ function waitingLimitScope(waitingReason) {
12001
+ if (waitingReason.paymentModel === 'subscription' || waitingReason.reason === 'model_concurrency_limit') {
12002
+ if (waitingReason.subscriptionTier === 'unlimited_pro') return 'Unlimited Pro plan';
12003
+ if (waitingReason.subscriptionTier === 'unlimited') return 'Unlimited plan';
12004
+ return 'plan';
12005
+ }
12006
+ if (waitingReason.paymentModel === 'paid_spark') return 'Premium Spark';
12007
+ if (waitingReason.paymentModel === 'free_spark') return 'Free Spark';
12008
+ return 'account';
12009
+ }
12010
+
12011
+ /**
12012
+ * Why a project is waiting, as one line for the agent and its user. Mirrors
12013
+ * sogni-web: a plan limit is named as the account's own limit (the project
12014
+ * starts by itself when one of the account's running jobs finishes), never as
12015
+ * a shortage of workers. Returns null for no reason.
12016
+ */
12017
+ function describeWaitingReason(waitingReason) {
12018
+ if (!waitingReason || typeof waitingReason !== 'object') return null;
12019
+ switch (waitingReason.reason) {
12020
+ case 'concurrency_limit':
12021
+ case 'model_concurrency_limit': {
12022
+ const modelLimit = waitingReason.reason === 'model_concurrency_limit';
12023
+ const media = modelLimit
12024
+ ? (waitingReason.modelFamily === 'minimax_h3' ? 'MiniMax H3 videos' : 'videos using this model')
12025
+ : (waitingReason.mediaType === 'video' ? 'videos' : 'generations');
12026
+ return `Queued: you've reached your ${waitingLimitScope(waitingReason)} limit for simultaneous ${media}. ` +
12027
+ 'It will start automatically when one of your running jobs finishes. This is your plan\'s limit, ' +
12028
+ 'not a shortage of workers, so do not resubmit it.';
12029
+ }
12030
+ case 'payment_pending':
12031
+ return 'Confirming payment before this project can start.';
12032
+ case 'no_workers':
12033
+ return 'Waiting for an available worker to take this project.';
12034
+ case 'queued':
12035
+ return typeof waitingReason.message === 'string' && waitingReason.message ? `Queued: ${waitingReason.message}` : 'Queued.';
12036
+ default:
12037
+ return typeof waitingReason.message === 'string' && waitingReason.message ? waitingReason.message : null;
12038
+ }
12039
+ }
12040
+
12041
+ function isPlanLimitWait(waitingReason) {
12042
+ return PLAN_LIMIT_WAITING_REASONS.has(waitingReason?.reason);
12043
+ }
12044
+
12045
+ /** The shell command that fetches a project's results later. */
12046
+ function resultCommandFor(projectId) {
12047
+ return `sogni-agent --result ${projectId}`;
12048
+ }
12049
+
12050
+ /**
12051
+ * Wait bookkeeping for one run's projects. It announces each project id as
12052
+ * soon as the project is submitted, reports why a project is queued in the
12053
+ * server's own terms, and runs the --timeout clock only for time that is the
12054
+ * run's to count: from submission (uploads excluded), minus any time the
12055
+ * account's own plan concurrency limit held a project, since such a project
12056
+ * starts by itself when one of the account's running jobs finishes. A guard
12057
+ * still ends a run whose submission never completes.
12058
+ */
12059
+ function createProjectWaitTracker(client, log, timeoutMs = options.timeout) {
12060
+ const projects = new Map();
12061
+ const reasons = new Map();
12062
+ const described = new Map();
12063
+ const sdkProjects = sdkClientOf(client)?.projects;
12064
+ let onTimeout = () => {};
12065
+ let timer = null;
12066
+ let stopped = false;
12067
+ let startedAt = null;
12068
+ let heldMs = 0;
12069
+ let heldSince = null;
12070
+
12071
+ const reasonFor = (projectId) => reasons.get(projectId) ?? projects.get(projectId)?.waitingReason ?? null;
12072
+ const updateHold = () => {
12073
+ const now = Date.now();
12074
+ const held = [...projects.keys()].some((projectId) => isPlanLimitWait(reasonFor(projectId)));
12075
+ if (held && heldSince === null) heldSince = now;
12076
+ if (!held && heldSince !== null) {
12077
+ heldMs += now - heldSince;
12078
+ heldSince = null;
12079
+ }
12080
+ };
12081
+ const countedMs = () => {
12082
+ const now = Date.now();
12083
+ return now - startedAt - heldMs - (heldSince === null ? 0 : now - heldSince);
12084
+ };
12085
+ const cleanup = () => {
12086
+ clearTimeout(timer);
12087
+ if (typeof sdkProjects?.off === 'function') sdkProjects.off('queueChanged', onQueueChanged);
12088
+ };
12089
+ const schedule = (ms) => {
12090
+ clearTimeout(timer);
12091
+ timer = setTimeout(fire, Math.max(0, ms));
12092
+ };
12093
+ function fire() {
12094
+ if (stopped) return;
12095
+ if (startedAt !== null) {
12096
+ updateHold();
12097
+ const remaining = timeoutMs - countedMs();
12098
+ if (remaining > 0) {
12099
+ schedule(remaining);
12100
+ return;
12101
+ }
12102
+ }
12103
+ stopped = true;
12104
+ cleanup();
12105
+ onTimeout();
12106
+ }
12107
+ const report = (projectId) => {
12108
+ const text = describeWaitingReason(reasonFor(projectId));
12109
+ if (!text || described.get(projectId) === text) return;
12110
+ described.set(projectId, text);
12111
+ log(text);
12112
+ };
12113
+ function onQueueChanged(event) {
12114
+ if (!event?.projectId || !projects.has(event.projectId)) return;
12115
+ reasons.set(event.projectId, event.waitingReason ?? null);
12116
+ updateHold();
12117
+ report(event.projectId);
12118
+ }
12119
+ if (typeof sdkProjects?.on === 'function') sdkProjects.on('queueChanged', onQueueChanged);
12120
+ // Submission guard: uploads can be slow, but a run that never gets a project
12121
+ // submitted still ends.
12122
+ schedule(Math.max(timeoutMs, 30 * 60 * 1000));
12123
+
12124
+ return {
12125
+ track(project) {
12126
+ if (stopped || !project?.id || projects.has(project.id)) return;
12127
+ projects.set(project.id, project);
12128
+ log(`Submitted Sogni project ${project.id}. If this run stops before it finishes, the project keeps going; fetch it with: ${resultCommandFor(project.id)}`);
12129
+ updateHold();
12130
+ report(project.id);
12131
+ if (startedAt === null) {
12132
+ startedAt = Date.now();
12133
+ schedule(timeoutMs);
12134
+ }
12135
+ },
12136
+ onTimeout(fn) {
12137
+ onTimeout = fn;
12138
+ },
12139
+ stop() {
12140
+ stopped = true;
12141
+ cleanup();
12142
+ },
12143
+ waitingReasonFor: reasonFor,
12144
+ projectIds() {
12145
+ return [...projects.keys()];
12146
+ }
12147
+ };
12148
+ }
12149
+
12150
+ /**
12151
+ * Report projects submitted with --detach: they keep running on Sogni, and
12152
+ * --status / --result fetch them later, including after the socket has stopped
12153
+ * holding a finished project for this client (one hour).
12154
+ */
12155
+ function reportDetachedProjects(projects, projectWait) {
12156
+ const projectIds = [...new Set(projects.map((project) => project?.id).filter(Boolean))];
12157
+ const entries = projectIds.map((projectId) => {
12158
+ const waitingReason = projectWait.waitingReasonFor(projectId);
12159
+ return {
12160
+ projectId,
12161
+ waitingReason,
12162
+ message: describeWaitingReason(waitingReason),
12163
+ statusCommand: `sogni-agent --status ${projectId}`,
12164
+ resultCommand: resultCommandFor(projectId)
12165
+ };
12166
+ });
12167
+ if (options.json) {
12168
+ console.log(JSON.stringify({
12169
+ success: true,
12170
+ detached: true,
12171
+ projectIds,
12172
+ projects: entries,
12173
+ note: 'Submitted and still running on Sogni. Nothing was cancelled. Check it with the statusCommand and fetch it with the resultCommand when it finishes; do not resubmit it.'
12174
+ }));
12175
+ return;
12176
+ }
12177
+ for (const entry of entries) {
12178
+ console.log(`Submitted Sogni project ${entry.projectId}; it keeps running on Sogni.`);
12179
+ if (entry.message) console.log(entry.message);
12180
+ console.log(`Check it: ${entry.statusCommand}`);
12181
+ console.log(`Fetch the result when it finishes: ${entry.resultCommand}`);
12182
+ }
12183
+ }
12184
+
12185
+ function projectLookupSummary(result) {
12186
+ const message = describeWaitingReason(result.waitingReason);
12187
+ return {
12188
+ projectId: result.id,
12189
+ status: result.status,
12190
+ finished: result.finished,
12191
+ ...(result.modelId ? { model: result.modelId } : {}),
12192
+ waitingReason: result.waitingReason ?? null,
12193
+ ...(message ? { message } : {}),
12194
+ jobs: (result.jobs || []).map((job) => ({
12195
+ id: job.id,
12196
+ status: job.status,
12197
+ ...(job.reason ? { reason: job.reason } : {}),
12198
+ ...(job.kind ? { kind: job.kind } : {}),
12199
+ ...(job.url ? { url: job.url } : {}),
12200
+ ...(job.urlUnavailable ? { urlUnavailable: job.urlUnavailable } : {})
12201
+ }))
12202
+ };
12203
+ }
12204
+
12205
+ function printProjectStatus(result) {
12206
+ const summary = projectLookupSummary(result);
12207
+ if (options.json) {
12208
+ console.log(JSON.stringify({ success: true, ...summary }));
12209
+ return;
12210
+ }
12211
+ const done = summary.jobs.filter((job) => job.status === 'completed').length;
12212
+ console.log(`Project ${summary.projectId}: ${summary.status}${summary.finished ? ` (${done}/${summary.jobs.length} render(s) completed)` : ''}`);
12213
+ if (summary.message) console.log(summary.message);
12214
+ for (const job of summary.jobs) {
12215
+ if (job.status !== 'completed') console.log(` ${job.id}: ${job.status}${job.reason ? ` (${job.reason})` : ''}`);
12216
+ }
12217
+ if (summary.finished && done > 0) console.log(`Fetch the media with: ${resultCommandFor(summary.projectId)}`);
12218
+ }
12219
+
12220
+ /** --result: the project's media, saved to -o like a normal run when given. */
12221
+ async function saveProjectResult(result) {
12222
+ const summary = projectLookupSummary(result);
12223
+ if (!summary.finished) {
12224
+ if (options.json) {
12225
+ console.log(JSON.stringify({ success: true, ...summary, note: 'Not finished yet; it is still running on Sogni. Check again later; do not resubmit it.' }));
12226
+ } else {
12227
+ console.log(`Project ${summary.projectId} is not finished yet (${summary.status}); it is still running on Sogni.`);
12228
+ if (summary.message) console.log(summary.message);
12229
+ console.log(`Check again later with: ${resultCommandFor(summary.projectId)}`);
12230
+ }
12231
+ return;
12232
+ }
12233
+ const urls = summary.jobs.map((job) => job.url).filter(Boolean);
12234
+ const localPaths = [];
12235
+ if (options.output) {
12236
+ const extension = extname(options.output);
12237
+ for (const [index, url] of urls.entries()) {
12238
+ const path = index === 0
12239
+ ? options.output
12240
+ : options.output.slice(0, options.output.length - extension.length) + `-${index + 1}` + extension;
12241
+ await downloadUrlToFile(url, path);
12242
+ localPaths.push(path);
12243
+ }
12244
+ }
12245
+ if (options.json) {
12246
+ console.log(JSON.stringify({ success: true, ...summary, urls, ...(localPaths.length ? { localPaths } : {}) }));
12247
+ return;
12248
+ }
12249
+ console.log(`Project ${summary.projectId}: ${summary.status}`);
12250
+ if (localPaths.length) {
12251
+ for (const path of localPaths) console.log(`Saved to ${path}`);
12252
+ } else {
12253
+ for (const url of urls) console.log(url);
12254
+ }
12255
+ for (const job of summary.jobs) {
12256
+ if (job.urlUnavailable === 'sensitiveContent') console.log(` ${job.id}: withheld by the Sensitive Content Filter`);
12257
+ else if (job.status !== 'completed') console.log(` ${job.id}: ${job.status}${job.reason ? ` (${job.reason})` : ''}`);
12258
+ }
12259
+ }
12260
+
12261
+ function printRecentProjects(projects, hours) {
12262
+ if (options.json) {
12263
+ console.log(JSON.stringify({ success: true, sinceHours: hours, projects }));
12264
+ return;
12265
+ }
12266
+ if (!projects.length) {
12267
+ console.log(`No completed Sogni projects in the last ${hours} hour(s).`);
12268
+ return;
12269
+ }
12270
+ console.log(`Completed Sogni projects in the last ${hours} hour(s), newest first:`);
12271
+ for (const project of projects) {
12272
+ const when = project.finishedAt ? new Date(project.finishedAt).toISOString() : 'unknown time';
12273
+ const ready = project.jobs.filter((job) => job.status === 'completed' && !job.sensitiveContentWithheld).length;
12274
+ console.log(` ${when} ${project.id} ${project.modelName || project.modelId || 'unknown model'} ${ready} result(s)${project.appSource ? ` [${project.appSource}]` : ''}`);
12275
+ }
12276
+ console.log('Fetch one with: sogni-agent --result <projectId>');
12277
+ }
12278
+
12279
+ /**
12280
+ * Before a video is submitted, say how many of this account's other video
12281
+ * projects are already queued or rendering (other runs, apps or devices).
12282
+ * Plans run a limited number at once -- the Unlimited plan runs one standard
12283
+ * MiniMax H3 video at a time -- so the new one may wait for them. Best effort:
12284
+ * it never blocks the run.
12285
+ */
12286
+ async function warnAboutInFlightProjects(client, log) {
12287
+ const projectsApi = sdkClientOf(client)?.projects;
12288
+ if (typeof projectsApi?.listProjectsElsewhere !== 'function') return;
12289
+ let inFlight;
12290
+ try {
12291
+ inFlight = await projectsApi.listProjectsElsewhere();
12292
+ } catch {
12293
+ return;
12294
+ }
12295
+ const videos = (inFlight || []).filter((project) => !project?.model?.type || project.model.type === 'video');
12296
+ if (!videos.length) return;
12297
+ const count = videos.length === 1 ? '1 other video project is' : `${videos.length} other video projects are`;
12298
+ log(`Note: ${count} already queued or rendering on this account (from other runs, apps or devices). ` +
12299
+ 'Plans run a limited number of videos at once (the Unlimited plan runs one standard MiniMax H3 video at a time), ' +
12300
+ 'so this one may wait for them. If it does, it starts by itself; do not resubmit it.');
12301
+ }
12302
+
12303
+ /** --status <id>, --result <id>, --recent [hours]. */
12304
+ async function runProjectLookup(client, lookup) {
12305
+ const projectsApi = sdkClientOf(client)?.projects;
12306
+ const method = lookup.action === 'recent' ? 'listRecent' : 'getResult';
12307
+ if (typeof projectsApi?.[method] !== 'function') {
12308
+ const error = new Error(`--${lookup.action} needs @sogni-ai/sogni-client 5.57.0 or later (projects.${method}). Update the Sogni skill.`);
12309
+ error.code = 'SDK_UPDATE_REQUIRED';
12310
+ throw error;
12311
+ }
12312
+ if (lookup.action === 'recent') {
12313
+ const projects = await projectsApi.listRecent({ since: Date.now() - lookup.hours * 3600 * 1000, limit: 100 });
12314
+ printRecentProjects(projects, lookup.hours);
12315
+ return;
12316
+ }
12317
+ const result = await projectsApi.getResult(lookup.projectId);
12318
+ if (lookup.action === 'status') printProjectStatus(result);
12319
+ else await saveProjectResult(result);
12320
+ }
12321
+
12322
+ /**
12323
+ * What to do when a run stops waiting before its projects finish. By default
12324
+ * nothing is cancelled: the projects keep going on Sogni and their results can
12325
+ * be fetched later with --result (or found with --recent). Before 3.53, a
12326
+ * timeout cancelled them, which threw away work that was only queued behind the
12327
+ * account's own plan limit. --cancel-on-timeout keeps that behaviour.
12328
+ */
11940
12329
  async function buildProjectTimeoutError(projects, timeoutMs, label = 'Project') {
11941
12330
  const timeoutSeconds = timeoutMs / 1000;
11942
- const cancellableProjects = [...new Set((projects || []).filter(Boolean))]
11943
- .filter((project) => typeof project.cancel === 'function');
11944
- const projectIds = cancellableProjects
11945
- .map((project) => project.id)
11946
- .filter(Boolean);
12331
+ const trackedProjects = [...new Set((projects || []).filter(Boolean))];
12332
+ const cancellableProjects = trackedProjects.filter((project) => typeof project.cancel === 'function');
12333
+ const projectIds = [...new Set(trackedProjects.map((project) => project.id).filter(Boolean))];
12334
+
12335
+ if (!options.cancelOnTimeout) {
12336
+ const waiting = trackedProjects.map((project) => project.waitingReason).find(Boolean) || null;
12337
+ const waitingText = describeWaitingReason(waiting);
12338
+ const resultCommands = projectIds.map(resultCommandFor);
12339
+ const error = new Error(
12340
+ `Stopped waiting after ${timeoutSeconds}s; Sogni ${label.toLowerCase()} ` +
12341
+ `${projectIds.join(', ') || '(unknown id)'} is still running and was not cancelled. ` +
12342
+ (waitingText ? `${waitingText} ` : '') +
12343
+ (resultCommands.length
12344
+ ? `Fetch the result when it finishes with: ${resultCommands.join('; ')}`
12345
+ : 'Find it when it finishes with: sogni-agent --recent')
12346
+ );
12347
+ error.code = 'PROJECT_TIMEOUT_STILL_RUNNING';
12348
+ error.details = {
12349
+ timeoutSeconds,
12350
+ projectIds,
12351
+ canceled: false,
12352
+ waitingReason: waiting,
12353
+ resultCommands
12354
+ };
12355
+ return error;
12356
+ }
11947
12357
 
11948
12358
  if (cancellableProjects.length === 0) {
11949
12359
  const error = new Error(
@@ -13237,6 +13647,11 @@ async function main() {
13237
13647
  await disableLiveModelAvailabilityEvents(client);
13238
13648
  log('Connected.');
13239
13649
 
13650
+ if (options.projectLookup) {
13651
+ await runProjectLookup(client, options.projectLookup);
13652
+ return;
13653
+ }
13654
+
13240
13655
  if (options.showBalance) {
13241
13656
  const balance = await client.getBalance();
13242
13657
  const spark = Number.parseFloat(balance?.spark);
@@ -13351,16 +13766,20 @@ async function main() {
13351
13766
  let completedJobs = 0;
13352
13767
  let loopingStartImageBuffer;
13353
13768
  const activeProjects = new Set();
13769
+ const projectWait = createProjectWaitTracker(client, log);
13354
13770
  const trackProjectResult = (projectResult) => {
13355
- if (projectResult?.project) activeProjects.add(projectResult.project);
13771
+ if (projectResult?.project) {
13772
+ activeProjects.add(projectResult.project);
13773
+ projectWait.track(projectResult.project);
13774
+ }
13356
13775
  return projectResult;
13357
13776
  };
13358
13777
 
13359
13778
  const completionPromise = new Promise((resolve, reject) => {
13360
- const timeout = setTimeout(() => {
13779
+ projectWait.onTimeout(() => {
13361
13780
  void buildProjectTimeoutError([...activeProjects], options.timeout)
13362
13781
  .then(reject);
13363
- }, options.timeout);
13782
+ });
13364
13783
 
13365
13784
  client.on(ClientEvent.JOB_COMPLETED, (data) => {
13366
13785
  const jobData = data.job?.data || {};
@@ -13377,30 +13796,30 @@ async function main() {
13377
13796
  log(`${options.speech ? 'Speech' : options.imageTo3d ? '3D model' : options.music ? 'Music' : (options.video || options.upscaleVideo) ? 'Video' : 'Image'} ${completedJobs}/${options.count} completed`);
13378
13797
 
13379
13798
  if (completedJobs >= options.count) {
13380
- clearTimeout(timeout);
13799
+ projectWait.stop();
13381
13800
  resolve();
13382
13801
  }
13383
13802
  });
13384
13803
 
13385
13804
  client.on(ClientEvent.JOB_FAILED, (data) => {
13386
- clearTimeout(timeout);
13805
+ projectWait.stop();
13387
13806
  reject(buildProjectResultError(data, 'Job failed'));
13388
13807
  });
13389
13808
 
13390
13809
  client.on(ClientEvent.PROJECT_FAILED, (data) => {
13391
- clearTimeout(timeout);
13810
+ projectWait.stop();
13392
13811
  reject(buildProjectResultError(data));
13393
13812
  });
13394
13813
 
13395
13814
  client.on(ClientEvent.PROJECT_EVENT, (event) => {
13396
13815
  if (event?.type !== 'error') return;
13397
- clearTimeout(timeout);
13816
+ projectWait.stop();
13398
13817
  reject(buildProjectResultError(event));
13399
13818
  });
13400
13819
 
13401
13820
  client.on(ClientEvent.JOB_EVENT, (event) => {
13402
13821
  if (event?.type !== 'error') return;
13403
- clearTimeout(timeout);
13822
+ projectWait.stop();
13404
13823
  reject(buildProjectResultError(event, 'Job failed'));
13405
13824
  });
13406
13825
 
@@ -14045,6 +14464,7 @@ async function main() {
14045
14464
  projectConfig.loraStrengths = options.loraStrengths;
14046
14465
  }
14047
14466
 
14467
+ await warnAboutInFlightProjects(client, log);
14048
14468
  const videoResult = trackProjectResult(
14049
14469
  await client.createVideoProject(withBillingMode(projectConfig))
14050
14470
  );
@@ -14443,6 +14863,12 @@ async function main() {
14443
14863
  }
14444
14864
  }
14445
14865
 
14866
+ if (options.detach) {
14867
+ projectWait.stop();
14868
+ reportDetachedProjects([...activeProjects], projectWait);
14869
+ return;
14870
+ }
14871
+
14446
14872
  // Wait for completion via events
14447
14873
  await completionPromise;
14448
14874
 
package/version.mjs CHANGED
@@ -1 +1 @@
1
- export const PACKAGE_VERSION = '3.52.2';
1
+ export const PACKAGE_VERSION = '3.53.0';