@sogni-ai/sogni-creative-agent-skill 3.52.4 → 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.
- package/.agents/skills/sogni-creative-agent-skill/SKILL.md +1 -1
- package/.agents/skills/sogni-creative-agent-skill/references/long-jobs-and-queues.md +79 -0
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/CHANGELOG.md +15 -0
- package/README.md +2 -0
- package/SKILL.md +5 -5
- package/desktop-extension/manifest.json +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +3 -3
- package/references/long-jobs-and-queues.md +79 -0
- package/scripts/sync-hermes-skill.mjs +1 -0
- package/skill-package.json +2 -2
- package/sogni-agent.mjs +449 -15
- package/version.mjs +1 -1
|
@@ -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.
|
|
6
|
+
version: "3.53.0"
|
|
7
7
|
author: Sogni AI
|
|
8
8
|
hermes:
|
|
9
9
|
category: creative
|
|
@@ -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.
|
|
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",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
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
|
+
|
|
1
16
|
## [3.52.4] - 2026-09-23
|
|
2
17
|
|
|
3
18
|
### Features
|
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`) |
|
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.
|
|
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>` |
|
|
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
|
|
|
@@ -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:**
|
|
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.
|
|
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",
|
package/openclaw.plugin.json
CHANGED
|
@@ -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.
|
|
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.
|
|
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.4.
|
|
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.
|
|
109
|
+
"@sogni-ai/sogni-client": "5.57.0"
|
|
110
110
|
},
|
|
111
111
|
"openclaw": {
|
|
112
112
|
"extensions": [
|
|
@@ -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.
|
package/skill-package.json
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
"private": true,
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@sogni-ai/sogni-intelligence-client": "4.4.
|
|
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.
|
|
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>
|
|
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)
|
|
@@ -6079,10 +6119,28 @@ const wan3HasMediaInput = isWan3ModelLocal(options.model) && Boolean(
|
|
|
6079
6119
|
|| options.wan3ReferenceFileUrl
|
|
6080
6120
|
|| options.wan3ReferenceLinkUrl
|
|
6081
6121
|
);
|
|
6082
|
-
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) {
|
|
6083
6123
|
fatalCliError('No prompt provided. Use --help for usage.', { code: 'INVALID_ARGUMENT' });
|
|
6084
6124
|
}
|
|
6085
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
|
+
|
|
6086
6144
|
if (contractUtilityAction && options.contractAction === 'dispatch' && !options.contractToolName) {
|
|
6087
6145
|
fatalCliError('--dispatch-tool requires a tool name.', { code: 'INVALID_ARGUMENT' });
|
|
6088
6146
|
}
|
|
@@ -11929,13 +11987,373 @@ async function runSourceReel(log) {
|
|
|
11929
11987
|
}
|
|
11930
11988
|
}
|
|
11931
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
|
+
*/
|
|
11932
12329
|
async function buildProjectTimeoutError(projects, timeoutMs, label = 'Project') {
|
|
11933
12330
|
const timeoutSeconds = timeoutMs / 1000;
|
|
11934
|
-
const
|
|
11935
|
-
|
|
11936
|
-
const projectIds =
|
|
11937
|
-
|
|
11938
|
-
|
|
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
|
+
}
|
|
11939
12357
|
|
|
11940
12358
|
if (cancellableProjects.length === 0) {
|
|
11941
12359
|
const error = new Error(
|
|
@@ -13229,6 +13647,11 @@ async function main() {
|
|
|
13229
13647
|
await disableLiveModelAvailabilityEvents(client);
|
|
13230
13648
|
log('Connected.');
|
|
13231
13649
|
|
|
13650
|
+
if (options.projectLookup) {
|
|
13651
|
+
await runProjectLookup(client, options.projectLookup);
|
|
13652
|
+
return;
|
|
13653
|
+
}
|
|
13654
|
+
|
|
13232
13655
|
if (options.showBalance) {
|
|
13233
13656
|
const balance = await client.getBalance();
|
|
13234
13657
|
const spark = Number.parseFloat(balance?.spark);
|
|
@@ -13343,16 +13766,20 @@ async function main() {
|
|
|
13343
13766
|
let completedJobs = 0;
|
|
13344
13767
|
let loopingStartImageBuffer;
|
|
13345
13768
|
const activeProjects = new Set();
|
|
13769
|
+
const projectWait = createProjectWaitTracker(client, log);
|
|
13346
13770
|
const trackProjectResult = (projectResult) => {
|
|
13347
|
-
if (projectResult?.project)
|
|
13771
|
+
if (projectResult?.project) {
|
|
13772
|
+
activeProjects.add(projectResult.project);
|
|
13773
|
+
projectWait.track(projectResult.project);
|
|
13774
|
+
}
|
|
13348
13775
|
return projectResult;
|
|
13349
13776
|
};
|
|
13350
13777
|
|
|
13351
13778
|
const completionPromise = new Promise((resolve, reject) => {
|
|
13352
|
-
|
|
13779
|
+
projectWait.onTimeout(() => {
|
|
13353
13780
|
void buildProjectTimeoutError([...activeProjects], options.timeout)
|
|
13354
13781
|
.then(reject);
|
|
13355
|
-
}
|
|
13782
|
+
});
|
|
13356
13783
|
|
|
13357
13784
|
client.on(ClientEvent.JOB_COMPLETED, (data) => {
|
|
13358
13785
|
const jobData = data.job?.data || {};
|
|
@@ -13369,30 +13796,30 @@ async function main() {
|
|
|
13369
13796
|
log(`${options.speech ? 'Speech' : options.imageTo3d ? '3D model' : options.music ? 'Music' : (options.video || options.upscaleVideo) ? 'Video' : 'Image'} ${completedJobs}/${options.count} completed`);
|
|
13370
13797
|
|
|
13371
13798
|
if (completedJobs >= options.count) {
|
|
13372
|
-
|
|
13799
|
+
projectWait.stop();
|
|
13373
13800
|
resolve();
|
|
13374
13801
|
}
|
|
13375
13802
|
});
|
|
13376
13803
|
|
|
13377
13804
|
client.on(ClientEvent.JOB_FAILED, (data) => {
|
|
13378
|
-
|
|
13805
|
+
projectWait.stop();
|
|
13379
13806
|
reject(buildProjectResultError(data, 'Job failed'));
|
|
13380
13807
|
});
|
|
13381
13808
|
|
|
13382
13809
|
client.on(ClientEvent.PROJECT_FAILED, (data) => {
|
|
13383
|
-
|
|
13810
|
+
projectWait.stop();
|
|
13384
13811
|
reject(buildProjectResultError(data));
|
|
13385
13812
|
});
|
|
13386
13813
|
|
|
13387
13814
|
client.on(ClientEvent.PROJECT_EVENT, (event) => {
|
|
13388
13815
|
if (event?.type !== 'error') return;
|
|
13389
|
-
|
|
13816
|
+
projectWait.stop();
|
|
13390
13817
|
reject(buildProjectResultError(event));
|
|
13391
13818
|
});
|
|
13392
13819
|
|
|
13393
13820
|
client.on(ClientEvent.JOB_EVENT, (event) => {
|
|
13394
13821
|
if (event?.type !== 'error') return;
|
|
13395
|
-
|
|
13822
|
+
projectWait.stop();
|
|
13396
13823
|
reject(buildProjectResultError(event, 'Job failed'));
|
|
13397
13824
|
});
|
|
13398
13825
|
|
|
@@ -14037,6 +14464,7 @@ async function main() {
|
|
|
14037
14464
|
projectConfig.loraStrengths = options.loraStrengths;
|
|
14038
14465
|
}
|
|
14039
14466
|
|
|
14467
|
+
await warnAboutInFlightProjects(client, log);
|
|
14040
14468
|
const videoResult = trackProjectResult(
|
|
14041
14469
|
await client.createVideoProject(withBillingMode(projectConfig))
|
|
14042
14470
|
);
|
|
@@ -14435,6 +14863,12 @@ async function main() {
|
|
|
14435
14863
|
}
|
|
14436
14864
|
}
|
|
14437
14865
|
|
|
14866
|
+
if (options.detach) {
|
|
14867
|
+
projectWait.stop();
|
|
14868
|
+
reportDetachedProjects([...activeProjects], projectWait);
|
|
14869
|
+
return;
|
|
14870
|
+
}
|
|
14871
|
+
|
|
14438
14872
|
// Wait for completion via events
|
|
14439
14873
|
await completionPromise;
|
|
14440
14874
|
|
package/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const PACKAGE_VERSION = '3.
|
|
1
|
+
export const PACKAGE_VERSION = '3.53.0';
|