@sogni-ai/sogni-creative-agent-skill 3.22.0 → 3.23.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sogni-creative-agent",
3
- "version": "3.22.0",
3
+ "version": "3.23.0",
4
4
  "description": "Sogni Creative Agent: image, video, and music generation via Sogni AI's decentralized GPU network. Supports personas, persistent memories, style transfer, and multi-step creative workflows.",
5
5
  "author": {
6
6
  "name": "Sogni AI",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sogni-creative-agent",
3
- "version": "3.22.0",
3
+ "version": "3.23.0",
4
4
  "description": "Create images, generative video, music, and polished image-folder loops with Sogni AI.",
5
5
  "author": {
6
6
  "name": "Sogni AI",
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [3.23.0](https://github.com/Sogni-AI/sogni-creative-agent-skill/compare/v3.22.0...v3.23.0) (2026-08-03)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **video:** raise the default generation timeout to 30 minutes and explicitly cancel every known Sogni project before reporting a timeout
7
+ * **video:** keep desktop and OpenClaw process safety limits behind the CLI timeout so network cancellation can finish first
8
+
9
+
10
+ ### Features
11
+
12
+ * **models:** add MiniMax H3 text-to-video, image-to-video, and first/last-frame aliases with native frame-grid alignment
13
+
14
+
1
15
  # [3.22.0](https://github.com/Sogni-AI/sogni-creative-agent-skill/compare/v3.21.0...v3.22.0) (2026-07-30)
2
16
 
3
17
 
package/README.md CHANGED
@@ -574,6 +574,9 @@ Prefer `-Q fast|hq|pro` for images and automatic workflow routing for video. Pas
574
574
  | Photobooth face transfer | `coreml-sogniXLturbo_alpha1_ad` |
575
575
  | Direct music generation | `ace_step_1.5_xl_turbo` (or `--music-model turbo`) |
576
576
  | Music with stronger lyric handling | `ace_step_1.5_xl_sft` (or `--music-model sft`) |
577
+ | MiniMax H3 text-to-video with native stereo audio | `minimax-h3` or `minimax-h3-t2v` |
578
+ | MiniMax H3 image-to-video | `minimax-h3-i2v` |
579
+ | MiniMax H3 first-frame → last-frame video | `minimax-h3-flf2v` with `--ref A --ref-end B` |
577
580
  | Text-to-video with native dialogue/audio | `ltx23-22b-fp8_t2v_distilled` |
578
581
  | Explicit uncensored image-to-video on 30GB+ GPUs | `ltx23-eros` with `--no-filter` |
579
582
  | Image+audio-to-video | `ltx23-22b-fp8_ia2v_distilled` |
@@ -592,6 +595,7 @@ Music generation uses `--music` and outputs `mp3` by default. `--audio` remains
592
595
  ## Video Sizing & Aspect Ratios
593
596
 
594
597
  - **WAN models** use dimensions divisible by 16, min 480 px, max 1536 px.
598
+ - **MiniMax H3 FL2VA** uses a 32 px grid, fixed 24 fps, native stereo audio, 124–362 frames (`124 + n×17`), and a 1,032,192-pixel render cap (normally 1344×768 or 768×1344). The initial Sogni release requires a 32 GB-class worker.
595
599
  - **LTX family** (`ltx2-*`, `ltx23-*`) uses dimensions divisible by 64. The current wrapper caps non-WAN video dimensions at 2048 px on the long side.
596
600
  - **Seedance** runs at fixed 24 fps and supports 4–15 s durations. Full `seedance2` supports native 4K via `--target-resolution 2160`; `seedance2-mini` and `seedance2-fast` remain capped to the 720p lower-resolution path. Other default/WAN paths support up to 10 s; LTX and WAN animate workflows support up to 20 s.
597
601
  - For spoken dialogue, budget roughly 3 words per second plus about 1 second for each meaningful acting beat or pause. Keep quoted speech under the model's hard per-clip word budget.
package/SKILL.md CHANGED
@@ -2,7 +2,7 @@
2
2
  name: sogni-creative-agent-skill
3
3
  description: "Sogni Creative Agent Skill: agent skill and CLI for image, video, and music generation using Sogni AI's decentralized GPU network. Supports one-click image-folder loop reels, personas (named people with saved reference photos and voice clips), persistent memories, custom personality, style transfer, angle synthesis, Seedance/HappyHorse/LTX/WAN video, music/lyrics, hosted chat, durable workflows, replay records, and multi-step creative workflows. Ask the agent to \"draw\", \"generate\", \"create an image\", \"make a video/animate\", \"turn this image folder into a loop\", \"make music\", \"apply a style\", or \"generate me as a superhero\"."
4
4
  metadata:
5
- version: "3.22.0"
5
+ version: "3.23.0"
6
6
  homepage: https://sogni.ai
7
7
  openclaw:
8
8
  emoji: "🎨"
@@ -244,6 +244,8 @@ tokens in that scoped reference rather than ordinary model recommendations.
244
244
 
245
245
  ### High-res video
246
246
 
247
+ MiniMax H3 is an explicit model choice, not a universal default. Use `-m minimax-h3` for text-to-video, `-m minimax-h3-i2v --ref A` for first-frame animation, or `-m minimax-h3-flf2v --ref A --ref-end B` for a first/last-frame transition. H3 generates native stereo audio at fixed 24 fps. The initial Sogni release is routed to 32 GB-class workers.
248
+
247
249
  For "4k" / "uhd" requests where the user accepts the Premium Spark vendor path or asks for Seedance/native audio/multimodal references, use full Seedance: `-m seedance2 --target-resolution 2160`. Do not use `seedance2-mini` or `seedance2-fast` for 4K; both remain capped to the 720p lower-resolution path. For "hd" / "1080p" requests, or when avoiding vendor models, use `-m ltx23-22b-fp8_t2v_distilled` (text) or `-m ltx23-22b-fp8_i2v_distilled` (image), prefer `-w 1920 -h 1088` (or the orientation mapping in the reference), and rewrite the prompt per the LTX rule. For bare "720p" without orientation, prefer `--target-resolution 768`.
248
250
 
249
251
  ### Video editing, stitching, 360 turnarounds
@@ -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.22.0",
5
+ "version": "3.23.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",
@@ -20,7 +20,12 @@ import {
20
20
 
21
21
  const HERE = dirname(fileURLToPath(import.meta.url));
22
22
  const PROTOCOL_FALLBACK = '2025-06-18';
23
- const HARD_KILL_MS = 15 * 60 * 1000; // generation ceiling; CLI enforces its own -t timeouts sooner
23
+ const MIN_HARD_KILL_MS = 15 * 60 * 1000;
24
+ const HARD_KILL_GRACE_MS = 60 * 1000;
25
+ const DEFAULT_TOOL_TIMEOUT_SECONDS = {
26
+ generate_video: 1800,
27
+ generate_music: 600,
28
+ };
24
29
  const PROGRESS_INTERVAL_MS = 10_000;
25
30
  const MAX_RESULT_CHARS = 20_000;
26
31
 
@@ -43,6 +48,17 @@ function textResult(text, isError = false) {
43
48
  return { content: [{ type: 'text', text }], isError };
44
49
  }
45
50
 
51
+ function hardKillTimeoutMs(toolName, input) {
52
+ const explicitTimeoutSeconds = Number(input?.timeout_seconds);
53
+ const timeoutSeconds = Number.isFinite(explicitTimeoutSeconds) && explicitTimeoutSeconds > 0
54
+ ? explicitTimeoutSeconds
55
+ : DEFAULT_TOOL_TIMEOUT_SECONDS[toolName];
56
+ if (!timeoutSeconds) return MIN_HARD_KILL_MS;
57
+ // Let the CLI's own timeout run first so it can await the normal Sogni
58
+ // project cancellation protocol before this process-level safety valve.
59
+ return Math.max(MIN_HARD_KILL_MS, (timeoutSeconds * 1000) + HARD_KILL_GRACE_MS);
60
+ }
61
+
46
62
  // Tools marked local in the registry run inside this process and must work
47
63
  // even when the sogni-agent CLI is not installed yet.
48
64
  const LOCAL_HANDLERS = { import_media: runImportMedia };
@@ -104,7 +120,10 @@ async function callTool(name, input, progressToken) {
104
120
  },
105
121
  });
106
122
  }, PROGRESS_INTERVAL_MS);
107
- const killer = setTimeout(() => child.kill('SIGKILL'), HARD_KILL_MS);
123
+ const killer = setTimeout(
124
+ () => child.kill('SIGKILL'),
125
+ hardKillTimeoutMs(name, input),
126
+ );
108
127
 
109
128
  const finish = (result) => {
110
129
  if (ticker) clearInterval(ticker);
@@ -91,7 +91,7 @@ export const TOOLS = [
91
91
  ref_video: str('Absolute path or URL of reference video'),
92
92
  persona: str('Saved persona name (reference frame)'),
93
93
  target_resolution: num('Short-side target in px, preserves aspect'),
94
- timeout_seconds: num('Generation timeout override (default 300)'),
94
+ timeout_seconds: num('Generation timeout override (default 1800)'),
95
95
  },
96
96
  required: ['prompt'],
97
97
  },
@@ -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.22.0",
5
+ "version": "3.23.0",
6
6
  "skills": [
7
7
  "."
8
8
  ],
@@ -158,7 +158,7 @@
158
158
  "defaultVideoTimeoutSec": {
159
159
  "type": "integer",
160
160
  "minimum": 30,
161
- "default": 300
161
+ "default": 1800
162
162
  },
163
163
  "defaultMusicDurationSec": {
164
164
  "type": "integer",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sogni-ai/sogni-creative-agent-skill",
3
- "version": "3.22.0",
3
+ "version": "3.23.0",
4
4
  "description": "Sogni Creative Agent Skill: agent skill and CLI for Sogni AI image, video, and music generation.",
5
5
  "type": "module",
6
6
  "main": "sogni-agent.mjs",
@@ -50,6 +50,9 @@ dimensions. "high quality" / "best quality" / "pro" → `-Q pro`; quick drafts
50
50
 
51
51
  | Model | Speed | Use Case |
52
52
  |-------|-------|----------|
53
+ | `minimax-h3` / `minimax-h3-t2v` | Standard | MiniMax H3 FL2VA text-to-video at 24 fps with native stereo audio |
54
+ | `minimax-h3-i2v` | Standard | MiniMax H3 first-frame image-to-video with native stereo audio |
55
+ | `minimax-h3-flf2v` | Standard | MiniMax H3 first-frame → last-frame video; pass both `--ref` and `--ref-end` |
53
56
  | `z_image_turbo_bf16` | Fast (~5-10s) | General purpose, default |
54
57
  | `gpt-image-2` | Variable | OpenAI GPT Image 2 text-to-image and edit, strong prompt and text rendering |
55
58
  | `flux1-schnell-fp8` | Very fast | Quick iterations |
@@ -298,6 +301,7 @@ model recommendations.
298
301
  ## Video sizing & aspect ratios
299
302
 
300
303
  - **WAN models** use dimensions divisible by 16, min 480 px, max 1536 px.
304
+ - **MiniMax H3 FL2VA** uses dimensions divisible by 32, fixed 24 fps, 124–362 frames on the `124 + n×17` grid, and no more than 1,032,192 pixels (1344×768 and 768×1344 are the primary landscape/portrait sizes). The initial Sogni release requires a 32 GB-class worker.
301
305
  - **LTX family** (`ltx2-*`, `ltx23-*`) uses dimensions divisible by 64. The current wrapper caps non-WAN video dimensions at 2048 px on the long side.
302
306
  - **Seedance** runs at fixed 24 fps and supports 4–15 s durations. Full `seedance2` supports native 4K via `--target-resolution 2160`; `seedance2-mini` and `seedance2-fast` remain capped to the 720p lower-resolution path. Other default/WAN paths support up to 10 s; LTX and WAN animate workflows support up to 20 s.
303
307
  - **HappyHorse 1.1** runs at fixed 24 fps and supports 3–15 s durations at 720P or 1080P, with always-on native audio (no negative prompt, no ControlNet). Accepted aspect ratios are `16:9`, `9:16`, `1:1`, `4:3`, `3:4`, `4:5`, `5:4`, `9:21`, and `21:9`. i2v takes one first-frame image (`--ref`); r2v takes 1–9 reference images (`-c`/`--context`); it accepts no reference video or audio.
@@ -54,7 +54,7 @@ CLI defaults are 512×512 images, count 1, spark tokens, prompt-hash seeds):
54
54
  "defaultFps": 16,
55
55
  "defaultDurationSec": 5,
56
56
  "defaultImageTimeoutSec": 30,
57
- "defaultVideoTimeoutSec": 300,
57
+ "defaultVideoTimeoutSec": 1800,
58
58
  "defaultMusicDurationSec": 30,
59
59
  "defaultMusicTimeoutSec": 600,
60
60
  "credentialsPath": "~/.config/sogni/credentials",
package/sogni-agent.mjs CHANGED
@@ -1588,6 +1588,7 @@ function getMaxContextImages(modelId) {
1588
1588
  }
1589
1589
 
1590
1590
  function videoDurationLimitsLikeWrapper(modelId) {
1591
+ if (isMiniMaxH3Model(modelId)) return { min: 5, max: 15 };
1591
1592
  if (isSeedanceModel(modelId)) return { min: 4, max: 15 };
1592
1593
  if (isHappyHorseModel(modelId)) return { min: 3, max: 15 };
1593
1594
  if (isLtx2Model(modelId) || isWanAnimateVideoModelId(modelId)) return { min: 1, max: 20 };
@@ -1608,6 +1609,9 @@ function videoDurationLimitsLikeWrapper(modelId) {
1608
1609
  // explicit -w/-h/--target-resolution, config, and prompt-derived dimensions
1609
1610
  // still win (see the video preflight defaults block).
1610
1611
  function videoModelDimensionDefaultsLikeWrapper(modelId) {
1612
+ if (isMiniMaxH3Model(modelId)) {
1613
+ return { defaultWidth: 1344, defaultHeight: 768, maxDimension: 1344, dimensionMultiple: 32 };
1614
+ }
1611
1615
  if (isHappyHorseModel(modelId) || isHappyHorseModelSelectionLocal(modelId)) {
1612
1616
  return { defaultWidth: 1920, defaultHeight: 1080, maxDimension: 1920, dimensionMultiple: 1 };
1613
1617
  }
@@ -1860,6 +1864,11 @@ const LTX_TRANSITION_LORA_ID = 'transition';
1860
1864
  const LTX_TRANSITION_TRIGGER = 'zhuanchang';
1861
1865
  const LTX_TRANSITION_DEFAULT_STRENGTH = 1.0;
1862
1866
  const LTX23_10EROS_MODEL_ID = 'ltx23-22b-10eros-v1.4-fp8mixed_i2v';
1867
+ const MINIMAX_H3_MODEL_IDS = new Set([
1868
+ 'minimax-h3-fl2va-fp8_t2v',
1869
+ 'minimax-h3-fl2va-fp8_i2v',
1870
+ 'minimax-h3-fl2va-fp8_flf2v'
1871
+ ]);
1863
1872
  const LTX23_10EROS_FIXED_SETTINGS = Object.freeze({
1864
1873
  steps: 9,
1865
1874
  guidance: 1,
@@ -1875,13 +1884,28 @@ const DR34ML4Y_SUPPORTED_MODEL_IDS = new Set([
1875
1884
  LTX23_10EROS_MODEL_ID
1876
1885
  ]);
1877
1886
 
1878
- function resolveSkillVideoModelAlias(modelId) {
1887
+ function resolveSkillVideoModelAlias(modelId, workflow = null, hasEndFrame = false) {
1879
1888
  const normalized = String(modelId || '').trim().toLowerCase();
1889
+ if (normalized === 'minimax-h3' && workflow) {
1890
+ if (workflow === 'i2v') {
1891
+ return hasEndFrame ? 'minimax-h3-fl2va-fp8_flf2v' : 'minimax-h3-fl2va-fp8_i2v';
1892
+ }
1893
+ return 'minimax-h3-fl2va-fp8_t2v';
1894
+ }
1895
+ if (normalized === 'minimax-h3-t2v') {
1896
+ return 'minimax-h3-fl2va-fp8_t2v';
1897
+ }
1898
+ if (normalized === 'minimax-h3-i2v') return 'minimax-h3-fl2va-fp8_i2v';
1899
+ if (normalized === 'minimax-h3-flf2v') return 'minimax-h3-fl2va-fp8_flf2v';
1880
1900
  return normalized === '10eros' || normalized === 'ltx23-eros'
1881
1901
  ? LTX23_10EROS_MODEL_ID
1882
1902
  : modelId;
1883
1903
  }
1884
1904
 
1905
+ function isMiniMaxH3Model(modelId) {
1906
+ return MINIMAX_H3_MODEL_IDS.has(String(modelId || '').trim().toLowerCase());
1907
+ }
1908
+
1885
1909
  function normalizeMultiAngleValue(value, aliases, allowedKeys, label) {
1886
1910
  if (!value) return null;
1887
1911
  const normalized = value.toLowerCase().replace(/_/g, '-').replace(/\s+/g, ' ').trim();
@@ -3378,7 +3402,7 @@ Hosted API Modes:
3378
3402
  --api-base-url <url> Sogni API base URL (default: ${DEFAULT_API_BASE_URL})
3379
3403
 
3380
3404
  General:
3381
- -t, --timeout <sec> Timeout in seconds (default: 30, video: 300, music: 600)
3405
+ -t, --timeout <sec> Timeout in seconds (default: 30, video: 1800, music: 600)
3382
3406
  --steps <num> Override steps (model-dependent)
3383
3407
  --guidance <num> Override guidance (model-dependent)
3384
3408
  --token-type <type> Token type: spark|sogni|auto (default: spark, auto retries with alternate)
@@ -4043,7 +4067,10 @@ if (options.video) {
4043
4067
  options.videoWorkflow = workflowFromModel || inferVideoWorkflowFromAssets(options) || configuredDefaultVideoWorkflow || 't2v';
4044
4068
  }
4045
4069
  if (options.model) {
4046
- options.model = resolveVideoModelAlias(options.model, options.videoWorkflow);
4070
+ options.model = resolveVideoModelAlias(
4071
+ resolveSkillVideoModelAlias(options.model, options.videoWorkflow, Boolean(options.refImageEnd)),
4072
+ options.videoWorkflow
4073
+ );
4047
4074
  }
4048
4075
  }
4049
4076
 
@@ -4198,7 +4225,7 @@ if (options.music) {
4198
4225
  }
4199
4226
  }
4200
4227
  if (!cliSet.timeout && !timeoutFromConfig && options.timeout === 30000) {
4201
- options.timeout = 300000; // 5 min for video
4228
+ options.timeout = 1800000; // 30 min for queued and long-running video jobs
4202
4229
  }
4203
4230
  } else if (options.photobooth) {
4204
4231
  // Photobooth uses SDXL Turbo + InstantID ControlNet
@@ -4631,6 +4658,22 @@ if (options.video && !options.frames) {
4631
4658
  }
4632
4659
  options.duration = clampedDuration;
4633
4660
  }
4661
+ if (isMiniMaxH3Model(options.model)) {
4662
+ const desiredFrames = options.duration * 24;
4663
+ options.frames = Math.max(
4664
+ 124,
4665
+ Math.min(362, 124 + Math.round((desiredFrames - 124) / 17) * 17)
4666
+ );
4667
+ options.fps = 24;
4668
+ }
4669
+ } else if (options.video && isMiniMaxH3Model(options.model)) {
4670
+ if (options.frames < 124 || options.frames > 362 || (options.frames - 124) % 17 !== 0) {
4671
+ fatalCliError('MiniMax H3 frames must be 124 + n×17, from 124 through 362.', {
4672
+ code: 'INVALID_ARGUMENT',
4673
+ details: { frames: options.frames, minimum: 124, maximum: 362, step: 17 }
4674
+ });
4675
+ }
4676
+ options.fps = 24;
4634
4677
  }
4635
4678
 
4636
4679
  // Video dimensions:
@@ -4700,6 +4743,12 @@ if (options.video) {
4700
4743
  const normalizedVideoDims = normalizeVideoDimensionsLikeWrapper(options.width, options.height, videoDimensionRules);
4701
4744
  options.width = normalizedVideoDims.width;
4702
4745
  options.height = normalizedVideoDims.height;
4746
+ if (isMiniMaxH3Model(options.model) && options.width * options.height > 1344 * 768) {
4747
+ const scale = Math.sqrt((1344 * 768) / (options.width * options.height));
4748
+ options.width = Math.max(32, Math.floor((options.width * scale) / 32) * 32);
4749
+ options.height = Math.max(32, Math.floor((options.height * scale) / 32) * 32);
4750
+ normalizedVideoDims.adjusted = true;
4751
+ }
4703
4752
  if (normalizedVideoDims.adjusted && !options.quiet) {
4704
4753
  console.error(
4705
4754
  `Auto-adjusted video dimensions from ${originalVideoWidth}x${originalVideoHeight} ` +
@@ -8994,10 +9043,61 @@ async function runSourceReel(log) {
8994
9043
  }
8995
9044
  }
8996
9045
 
9046
+ async function buildProjectTimeoutError(projects, timeoutMs, label = 'Project') {
9047
+ const timeoutSeconds = timeoutMs / 1000;
9048
+ const cancellableProjects = [...new Set((projects || []).filter(Boolean))]
9049
+ .filter((project) => typeof project.cancel === 'function');
9050
+ const projectIds = cancellableProjects
9051
+ .map((project) => project.id)
9052
+ .filter(Boolean);
9053
+
9054
+ if (cancellableProjects.length === 0) {
9055
+ const error = new Error(
9056
+ `Timeout after ${timeoutSeconds}s; no cancellable Sogni project handle was available. ` +
9057
+ 'The project may still be running.'
9058
+ );
9059
+ error.code = 'PROJECT_TIMEOUT_CANCEL_UNAVAILABLE';
9060
+ error.details = { timeoutSeconds, projectIds: [], canceled: false };
9061
+ return error;
9062
+ }
9063
+
9064
+ const failures = [];
9065
+ for (const project of cancellableProjects) {
9066
+ try {
9067
+ await project.cancel();
9068
+ } catch (cancelError) {
9069
+ failures.push({
9070
+ projectId: project.id || null,
9071
+ message: cancelError?.message || String(cancelError)
9072
+ });
9073
+ }
9074
+ }
9075
+
9076
+ if (failures.length > 0) {
9077
+ const failedIds = failures.map((failure) => failure.projectId).filter(Boolean);
9078
+ const error = new Error(
9079
+ `Timeout after ${timeoutSeconds}s; failed to cancel Sogni ${label.toLowerCase()} ` +
9080
+ `${failedIds.join(', ') || '(unknown id)'}. The project may still be running.`
9081
+ );
9082
+ error.code = 'PROJECT_TIMEOUT_CANCEL_FAILED';
9083
+ error.details = { timeoutSeconds, projectIds, canceled: false, failures };
9084
+ return error;
9085
+ }
9086
+
9087
+ const error = new Error(
9088
+ `Timeout after ${timeoutSeconds}s; canceled Sogni ${label.toLowerCase()} ` +
9089
+ `${projectIds.join(', ') || '(unknown id)'}.`
9090
+ );
9091
+ error.code = 'PROJECT_TIMEOUT';
9092
+ error.details = { timeoutSeconds, projectIds, canceled: true };
9093
+ return error;
9094
+ }
9095
+
8997
9096
  async function runImageEditProjectWithEvents(client, editConfig, expectedCount, log, timeoutMs, label) {
8998
9097
  const results = [];
8999
9098
  let completed = 0;
9000
9099
  let projectId = null;
9100
+ let activeProject = null;
9001
9101
 
9002
9102
  let resolvePromise;
9003
9103
  let rejectPromise;
@@ -9039,7 +9139,8 @@ async function runImageEditProjectWithEvents(client, editConfig, expectedCount,
9039
9139
 
9040
9140
  const timeout = setTimeout(() => {
9041
9141
  cleanup();
9042
- rejectPromise(new Error(`Timeout after ${timeoutMs / 1000}s`));
9142
+ void buildProjectTimeoutError([activeProject], timeoutMs, 'image edit project')
9143
+ .then(rejectPromise);
9043
9144
  }, timeoutMs);
9044
9145
 
9045
9146
  client.on(ClientEvent.JOB_COMPLETED, onCompleted);
@@ -9047,6 +9148,7 @@ async function runImageEditProjectWithEvents(client, editConfig, expectedCount,
9047
9148
 
9048
9149
  try {
9049
9150
  const projectResult = await client.createImageEditProject(withBillingMode(editConfig));
9151
+ activeProject = projectResult?.project || null;
9050
9152
  projectId = projectResult?.project?.id || projectId;
9051
9153
 
9052
9154
  // Check for errors in the response (e.g., insufficient tokens)
@@ -10225,10 +10327,16 @@ async function main() {
10225
10327
  const results = [];
10226
10328
  let completedJobs = 0;
10227
10329
  let loopingStartImageBuffer;
10330
+ const activeProjects = new Set();
10331
+ const trackProjectResult = (projectResult) => {
10332
+ if (projectResult?.project) activeProjects.add(projectResult.project);
10333
+ return projectResult;
10334
+ };
10228
10335
 
10229
10336
  const completionPromise = new Promise((resolve, reject) => {
10230
10337
  const timeout = setTimeout(() => {
10231
- reject(new Error(`Timeout after ${options.timeout / 1000}s`));
10338
+ void buildProjectTimeoutError([...activeProjects], options.timeout)
10339
+ .then(reject);
10232
10340
  }, options.timeout);
10233
10341
 
10234
10342
  client.on(ClientEvent.JOB_COMPLETED, (data) => {
@@ -10669,7 +10777,9 @@ async function main() {
10669
10777
  projectConfig.loraStrengths = options.loraStrengths;
10670
10778
  }
10671
10779
 
10672
- const videoResult = await client.createVideoProject(withBillingMode(projectConfig));
10780
+ const videoResult = trackProjectResult(
10781
+ await client.createVideoProject(withBillingMode(projectConfig))
10782
+ );
10673
10783
 
10674
10784
  // Check for errors in the response (e.g., insufficient tokens)
10675
10785
  if (videoResult?.error || videoResult?.message) {
@@ -10731,7 +10841,9 @@ async function main() {
10731
10841
  projectConfig.seed = options.seed;
10732
10842
  }
10733
10843
 
10734
- const audioResult = await client.createAudioProject(withBillingMode(projectConfig));
10844
+ const audioResult = trackProjectResult(
10845
+ await client.createAudioProject(withBillingMode(projectConfig))
10846
+ );
10735
10847
 
10736
10848
  if (audioResult?.error || audioResult?.message) {
10737
10849
  throw buildProjectResultError(audioResult);
@@ -10796,9 +10908,9 @@ async function main() {
10796
10908
  editConfig.seed = options.seed;
10797
10909
  }
10798
10910
 
10799
- const editResult = isGptImage2ModelSelection(options.model)
10911
+ const editResult = trackProjectResult(isGptImage2ModelSelection(options.model)
10800
10912
  ? await client.createImageProject(withBillingMode(editConfig))
10801
- : await client.createImageEditProject(withBillingMode(editConfig));
10913
+ : await client.createImageEditProject(withBillingMode(editConfig)));
10802
10914
  if (editResult?.error || editResult?.message) {
10803
10915
  throw buildProjectResultError(editResult);
10804
10916
  }
@@ -10843,7 +10955,9 @@ async function main() {
10843
10955
  if (options.loras.length > 0) projectConfig.loras = options.loras;
10844
10956
  if (options.loraStrengths.length > 0) projectConfig.loraStrengths = options.loraStrengths;
10845
10957
 
10846
- const projectResult = await client.createImageProject(withBillingMode(projectConfig));
10958
+ const projectResult = trackProjectResult(
10959
+ await client.createImageProject(withBillingMode(projectConfig))
10960
+ );
10847
10961
 
10848
10962
  // Check for errors in the response (e.g., insufficient tokens)
10849
10963
  if (projectResult?.error || projectResult?.message) {
@@ -10918,7 +11032,9 @@ async function main() {
10918
11032
  projectConfig.seed = options.seed;
10919
11033
  }
10920
11034
 
10921
- const imageResult = await client.createImageProject(withBillingMode(projectConfig));
11035
+ const imageResult = trackProjectResult(
11036
+ await client.createImageProject(withBillingMode(projectConfig))
11037
+ );
10922
11038
  if (imageResult?.error || imageResult?.message) {
10923
11039
  throw buildProjectResultError(imageResult);
10924
11040
  }
@@ -11094,9 +11210,11 @@ async function main() {
11094
11210
  await disableLiveModelAvailabilityEvents(client2);
11095
11211
 
11096
11212
  // Create second clip and wait for completion via events
11213
+ let activeClip2Project = null;
11097
11214
  const clip2Promise = new Promise((resolve, reject) => {
11098
11215
  const timeout = setTimeout(() => {
11099
- reject(new Error('Second clip generation timed out'));
11216
+ void buildProjectTimeoutError([activeClip2Project], options.timeout, 'second clip project')
11217
+ .then(reject);
11100
11218
  }, options.timeout);
11101
11219
 
11102
11220
  client2.on(ClientEvent.JOB_COMPLETED, async (data) => {
@@ -11140,6 +11258,7 @@ async function main() {
11140
11258
  });
11141
11259
 
11142
11260
  const clip2Result = await client2.createVideoProject(withBillingMode(projectConfig2));
11261
+ activeClip2Project = clip2Result?.project || null;
11143
11262
 
11144
11263
  // Check for errors in the response (e.g., insufficient tokens)
11145
11264
  if (clip2Result?.error || clip2Result?.message) {
package/version.mjs CHANGED
@@ -1 +1 @@
1
- export const PACKAGE_VERSION = '3.22.0';
1
+ export const PACKAGE_VERSION = '3.23.0';