@sogni-ai/sogni-creative-agent-skill 3.26.0 → 3.27.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/sogni-agent.mjs CHANGED
@@ -133,7 +133,7 @@ const KNOWN_MODEL_CATALOG_TAGS = new Set([
133
133
  const SUBSCRIPTION_BILLING_ERROR_CODES = new Set(['4078', '4079', '4080', '4081']);
134
134
  const APP_ID_LIMIT_ERROR_CODE = '4061';
135
135
  const APP_ID_LIMIT_HINT =
136
- 'This CLI now persists and reuses one installation app ID. Keep ~/.config/sogni/app-id between sessions; for ephemeral/container homes, set one stable SOGNI_APP_ID or persist SOGNI_APP_ID_PATH. App IDs already registered from this address remain counted until 00:00 UTC, so wait for the next UTC reset once if the address is already blocked.';
136
+ 'This CLI persists and reuses one installation app ID. Keep ~/.config/sogni/app-id between sessions; for ephemeral/container homes, set one stable SOGNI_APP_ID or persist SOGNI_APP_ID_PATH. If the address is already blocked, preserve the stable ID and wait before retrying.';
137
137
 
138
138
  function subscriptionBillingFallback(code) {
139
139
  if (code === undefined || code === null) return null;
@@ -656,7 +656,22 @@ function buildCliErrorPayload({ message, code, details, hint, prompt }) {
656
656
  return payload;
657
657
  }
658
658
 
659
+ function unwrapGenericProjectError(error) {
660
+ let current = error;
661
+ const seen = new Set();
662
+ while (current && typeof current === 'object' && !seen.has(current)) {
663
+ seen.add(current);
664
+ const message = typeof current.message === 'string' ? current.message.trim() : '';
665
+ if (message !== 'Project creation failed') break;
666
+ const next = current.originalError || current.cause;
667
+ if (!next) break;
668
+ current = next;
669
+ }
670
+ return current;
671
+ }
672
+
659
673
  function cliErrorMessage(error) {
674
+ error = unwrapGenericProjectError(error);
660
675
  if (typeof error === 'string') return error;
661
676
  if (error instanceof Error) return error.message || String(error);
662
677
  if (error && typeof error === 'object') {
@@ -716,6 +731,7 @@ function classifyHappyHorseCliError(error, rawMessage) {
716
731
  }
717
732
 
718
733
  function classifyCliError(error, context = {}) {
734
+ error = unwrapGenericProjectError(error);
719
735
  const rawMessage = cliErrorMessage(error);
720
736
 
721
737
  // Client-side CLI rejections are the plain `{ message, code }` shape built by
@@ -1588,7 +1604,7 @@ function getMaxContextImages(modelId) {
1588
1604
  }
1589
1605
 
1590
1606
  function videoDurationLimitsLikeWrapper(modelId) {
1591
- if (isMiniMaxH3Model(modelId)) return { min: 5, max: 15 };
1607
+ if (isMiniMaxH3Model(modelId)) return { ...MINIMAX_H3_DURATION_LIMITS };
1592
1608
  if (isSeedanceModel(modelId)) return { min: 4, max: 15 };
1593
1609
  if (isHappyHorseModel(modelId)) return { min: 3, max: 15 };
1594
1610
  if (isLtx2Model(modelId) || isWanAnimateVideoModelId(modelId)) return { min: 1, max: 20 };
@@ -1864,12 +1880,16 @@ const LTX_TRANSITION_LORA_ID = 'transition';
1864
1880
  const LTX_TRANSITION_TRIGGER = 'zhuanchang';
1865
1881
  const LTX_TRANSITION_DEFAULT_STRENGTH = 1.0;
1866
1882
  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
- 'minimax-h3-ref2va-fp8_r2v'
1883
+ const MINIMAX_H3_MODEL_MODES = new Map([
1884
+ ['minimax-h3-fl2va-fp8_t2v', 't2v'],
1885
+ ['minimax-h3-fl2va-fp8_i2v', 'i2v'],
1886
+ ['minimax-h3-fl2va-fp8_flf2v', 'flf2v'],
1887
+ ['minimax-h3-ref2va-fp8_r2v', 'r2v'],
1888
+ ['minimax-h3-fl2va-fp8_t2v_turbo', 't2v'],
1889
+ ['minimax-h3-fl2va-fp8_i2v_turbo', 'i2v'],
1890
+ ['minimax-h3-fl2va-fp8_flf2v_turbo', 'flf2v']
1872
1891
  ]);
1892
+ const MINIMAX_H3_MODEL_IDS = new Set(MINIMAX_H3_MODEL_MODES.keys());
1873
1893
  const MINIMAX_H3_R2V_MODEL_ID = 'minimax-h3-ref2va-fp8_r2v';
1874
1894
  const MINIMAX_H3_REFERENCE_LIMITS = Object.freeze({
1875
1895
  images: 9,
@@ -1877,6 +1897,33 @@ const MINIMAX_H3_REFERENCE_LIMITS = Object.freeze({
1877
1897
  audios: 3,
1878
1898
  assets: 12
1879
1899
  });
1900
+ // H3 renders on a fixed 24fps frame grid: frames are 124 + n×17, from 124
1901
+ // through 362. Every duration the user asks for is snapped to that grid, so the
1902
+ // deliverable range is 5.17-15.08s — not the round 5-15s it rounds to.
1903
+ const MINIMAX_H3_FRAME_GRID = Object.freeze({
1904
+ fps: 24,
1905
+ min: 124,
1906
+ max: 362,
1907
+ step: 17
1908
+ });
1909
+ const MINIMAX_H3_DURATION_LIMITS = Object.freeze({
1910
+ min: MINIMAX_H3_FRAME_GRID.min / MINIMAX_H3_FRAME_GRID.fps,
1911
+ max: MINIMAX_H3_FRAME_GRID.max / MINIMAX_H3_FRAME_GRID.fps
1912
+ });
1913
+
1914
+ // Grid-snapped durations are rarely whole seconds; keep the printed form short
1915
+ // without implying more precision than the frame count carries.
1916
+ function formatDurationSeconds(seconds) {
1917
+ return String(Number(Number(seconds).toFixed(2)));
1918
+ }
1919
+
1920
+ // Snap a duration in seconds onto the H3 frame grid.
1921
+ function miniMaxH3FramesForDuration(durationSeconds) {
1922
+ const { fps, min, max, step } = MINIMAX_H3_FRAME_GRID;
1923
+ const desiredFrames = durationSeconds * fps;
1924
+ return Math.max(min, Math.min(max, min + Math.round((desiredFrames - min) / step) * step));
1925
+ }
1926
+
1880
1927
  const LTX23_10EROS_FIXED_SETTINGS = Object.freeze({
1881
1928
  steps: 9,
1882
1929
  guidance: 1,
@@ -1907,6 +1954,29 @@ function resolveSkillVideoModelAlias(modelId, workflow = null, hasEndFrame = fal
1907
1954
  if (normalized === 'minimax-h3-i2v') return 'minimax-h3-fl2va-fp8_i2v';
1908
1955
  if (normalized === 'minimax-h3-flf2v') return 'minimax-h3-fl2va-fp8_flf2v';
1909
1956
  if (normalized === 'minimax-h3-r2v') return MINIMAX_H3_R2V_MODEL_ID;
1957
+ if (normalized === 'minimax-h3-turbo' && workflow) {
1958
+ if (workflow === 'r2v') {
1959
+ fatalCliError('MiniMax H3 Turbo does not support r2v; use minimax-h3-r2v for Ref2VA.', {
1960
+ code: 'INVALID_ARGUMENT',
1961
+ details: { workflow, model: normalized }
1962
+ });
1963
+ }
1964
+ if (workflow === 'i2v') {
1965
+ return hasEndFrame
1966
+ ? 'minimax-h3-fl2va-fp8_flf2v_turbo'
1967
+ : 'minimax-h3-fl2va-fp8_i2v_turbo';
1968
+ }
1969
+ return 'minimax-h3-fl2va-fp8_t2v_turbo';
1970
+ }
1971
+ if (normalized === 'minimax-h3-t2v-turbo') {
1972
+ return 'minimax-h3-fl2va-fp8_t2v_turbo';
1973
+ }
1974
+ if (normalized === 'minimax-h3-i2v-turbo') {
1975
+ return 'minimax-h3-fl2va-fp8_i2v_turbo';
1976
+ }
1977
+ if (normalized === 'minimax-h3-flf2v-turbo') {
1978
+ return 'minimax-h3-fl2va-fp8_flf2v_turbo';
1979
+ }
1910
1980
  return normalized === '10eros' || normalized === 'ltx23-eros'
1911
1981
  ? LTX23_10EROS_MODEL_ID
1912
1982
  : modelId;
@@ -1927,16 +1997,23 @@ function isMiniMaxH3ModelSelectionLocal(modelId) {
1927
1997
  || normalized === 'minimax-h3-i2v'
1928
1998
  || normalized === 'minimax-h3-flf2v'
1929
1999
  || normalized === 'minimax-h3-r2v'
2000
+ || normalized === 'minimax-h3-turbo'
2001
+ || normalized === 'minimax-h3-t2v-turbo'
2002
+ || normalized === 'minimax-h3-i2v-turbo'
2003
+ || normalized === 'minimax-h3-flf2v-turbo'
1930
2004
  || isMiniMaxH3Model(normalized);
1931
2005
  }
1932
2006
 
1933
2007
  function miniMaxH3ModeFromModelId(modelId) {
1934
2008
  const normalized = String(modelId || '').trim().toLowerCase();
1935
- if (normalized === 'minimax-h3-t2v' || normalized === 'minimax-h3-fl2va-fp8_t2v') return 't2v';
1936
- if (normalized === 'minimax-h3-i2v' || normalized === 'minimax-h3-fl2va-fp8_i2v') return 'i2v';
1937
- if (normalized === 'minimax-h3-flf2v' || normalized === 'minimax-h3-fl2va-fp8_flf2v') return 'flf2v';
1938
- if (normalized === 'minimax-h3-r2v' || normalized === MINIMAX_H3_R2V_MODEL_ID) return 'r2v';
1939
- return null;
2009
+ if (normalized === 'minimax-h3-t2v') return 't2v';
2010
+ if (normalized === 'minimax-h3-i2v') return 'i2v';
2011
+ if (normalized === 'minimax-h3-flf2v') return 'flf2v';
2012
+ if (normalized === 'minimax-h3-r2v') return 'r2v';
2013
+ if (normalized === 'minimax-h3-t2v-turbo') return 't2v';
2014
+ if (normalized === 'minimax-h3-i2v-turbo') return 'i2v';
2015
+ if (normalized === 'minimax-h3-flf2v-turbo') return 'flf2v';
2016
+ return MINIMAX_H3_MODEL_MODES.get(normalized) || null;
1940
2017
  }
1941
2018
 
1942
2019
  function normalizeMultiAngleValue(value, aliases, allowedKeys, label) {
@@ -3543,15 +3620,21 @@ HappyHorse 1.1 Video Model Selectors (3-15s, fixed 24fps, native audio, 720P/108
3543
3620
  happyhorse-1.1-r2v Reference-to-video from 1-9 reference images (-c/--context)
3544
3621
 
3545
3622
  MiniMax H3 Video Model Selectors (fixed 24fps, native 32kHz stereo audio + dialogue,
3546
- frames 124+n*17 = 5.17-15.08s, sizes /32 up to 1,032,192px, 32GB-class workers.
3547
- Prompt is natural cinematic prose — a timed shot list ("[0-2 seconds] ...") plus
3548
- explicit audio direction; see references/video-prompting.md "MiniMax H3
3549
- Prompting". No negative prompt field: state negatives in the prompt text.):
3623
+ frames 124+n*17 = 5.17-15.08s, sizes /32 up to 1,032,192px. FL2VA/Turbo and
3624
+ image-only R2V need 32GB-class workers; video-conditioned R2V needs above 40GB.
3625
+ Prompts use MiniMax's exact ordered-field contracts and [Shot N] notation; see
3626
+ references/video-prompting.md "MiniMax H3 Prompting". No negative prompt field:
3627
+ state negatives in the structured prompt.):
3550
3628
  minimax-h3 Text-to-video (also accepts minimax-h3-t2v); --ref/--ref-end pick i2v/flf2v
3551
3629
  minimax-h3-i2v Image-to-video from a single first-frame image (--ref)
3552
3630
  minimax-h3-flf2v First-frame -> last-frame transition (--ref plus --ref-end)
3553
3631
  minimax-h3-r2v Multi-reference video: --ref/-c images, repeatable --ref-video/--ref-audio
3554
- (9 images / 3 videos / 3 audios / 12 files total)
3632
+ (9 images / 3 videos / 3 audios / 12 files total; requires an image or video)
3633
+ minimax-h3-turbo 4-step Turbo; --ref/--ref-end select i2v/flf2v
3634
+ minimax-h3-t2v-turbo 4-step Turbo text-to-video
3635
+ minimax-h3-i2v-turbo 4-step Turbo image-to-video (--ref)
3636
+ minimax-h3-flf2v-turbo 4-step Turbo first-frame -> last-frame (--ref plus --ref-end)
3637
+ (Turbo has no r2v/Ref2VA variant)
3555
3638
 
3556
3639
  WAN 2.2 Video Models:
3557
3640
  wan_v2.2-14b-fp8_t2v_lightx2v Text-to-video (fast)
@@ -4558,8 +4641,9 @@ if (options.video) {
4558
4641
  } else if (options.videoWorkflow === 'r2v') {
4559
4642
  if (isMiniMaxH3R2v) {
4560
4643
  const imageCount = (options.refImage ? 1 : 0) + options.contextImages.length;
4561
- if (imageCount === 0) {
4562
- fatalCliError('MiniMax H3 r2v needs at least one reference image via --ref or -c/--context.', { code: 'INVALID_ARGUMENT' });
4644
+ const videoCount = (options.refVideo ? 1 : 0) + options.refVideos.length;
4645
+ if (imageCount === 0 && videoCount === 0) {
4646
+ fatalCliError('MiniMax H3 r2v needs at least one visual reference via --ref, -c/--context, or --ref-video; audio-only input is invalid.', { code: 'INVALID_ARGUMENT' });
4563
4647
  }
4564
4648
  if (options.refImageEnd) {
4565
4649
  fatalCliError('MiniMax H3 r2v has no end-frame anchor; use -c/--context for another loose image or minimax-h3-flf2v for first/last frames.', { code: 'INVALID_ARGUMENT' });
@@ -4777,9 +4861,13 @@ if (options.video && (isSeedanceModel(options.model) || isHappyHorseModel(option
4777
4861
 
4778
4862
  if (options.video && !options.frames) {
4779
4863
  const durationLimits = videoDurationLimitsLikeWrapper(options.model);
4864
+ const requestedDuration = options.duration;
4780
4865
  const clampedDuration = Math.max(durationLimits.min, Math.min(durationLimits.max, options.duration));
4781
4866
  if (clampedDuration !== options.duration) {
4782
- if (!options.quiet) {
4867
+ // H3 reports its own adjustment below, after the frame grid decides the
4868
+ // duration actually delivered; announcing the clamp here would name a
4869
+ // duration H3 cannot render.
4870
+ if (!options.quiet && !isMiniMaxH3Model(options.model)) {
4783
4871
  console.error(
4784
4872
  `Adjusted video duration from ${options.duration}s to ${clampedDuration}s ` +
4785
4873
  `(supported range for ${options.model}: ${durationLimits.min}-${durationLimits.max}s).`
@@ -4788,21 +4876,28 @@ if (options.video && !options.frames) {
4788
4876
  options.duration = clampedDuration;
4789
4877
  }
4790
4878
  if (isMiniMaxH3Model(options.model)) {
4791
- const desiredFrames = options.duration * 24;
4792
- options.frames = Math.max(
4793
- 124,
4794
- Math.min(362, 124 + Math.round((desiredFrames - 124) / 17) * 17)
4795
- );
4796
- options.fps = 24;
4879
+ options.frames = miniMaxH3FramesForDuration(options.duration);
4880
+ options.fps = MINIMAX_H3_FRAME_GRID.fps;
4881
+ const deliveredDuration = options.frames / MINIMAX_H3_FRAME_GRID.fps;
4882
+ if (!options.quiet && Math.abs(deliveredDuration - requestedDuration) > 1e-6) {
4883
+ console.error(
4884
+ `Adjusted video duration from ${formatDurationSeconds(requestedDuration)}s to ` +
4885
+ `${formatDurationSeconds(deliveredDuration)}s (${options.frames} frames). ` +
4886
+ `MiniMax H3 renders ${MINIMAX_H3_FRAME_GRID.min} + n×${MINIMAX_H3_FRAME_GRID.step} frames at ` +
4887
+ `${MINIMAX_H3_FRAME_GRID.fps}fps, so ${options.model} delivers ` +
4888
+ `${formatDurationSeconds(durationLimits.min)}-${formatDurationSeconds(durationLimits.max)}s.`
4889
+ );
4890
+ }
4797
4891
  }
4798
4892
  } else if (options.video && isMiniMaxH3Model(options.model)) {
4799
- if (options.frames < 124 || options.frames > 362 || (options.frames - 124) % 17 !== 0) {
4800
- fatalCliError('MiniMax H3 frames must be 124 + n×17, from 124 through 362.', {
4893
+ const { min: minFrames, max: maxFrames, step: frameStep, fps: h3Fps } = MINIMAX_H3_FRAME_GRID;
4894
+ if (options.frames < minFrames || options.frames > maxFrames || (options.frames - minFrames) % frameStep !== 0) {
4895
+ fatalCliError(`MiniMax H3 frames must be ${minFrames} + n×${frameStep}, from ${minFrames} through ${maxFrames}.`, {
4801
4896
  code: 'INVALID_ARGUMENT',
4802
- details: { frames: options.frames, minimum: 124, maximum: 362, step: 17 }
4897
+ details: { frames: options.frames, minimum: minFrames, maximum: maxFrames, step: frameStep }
4803
4898
  });
4804
4899
  }
4805
- options.fps = 24;
4900
+ options.fps = h3Fps;
4806
4901
  }
4807
4902
 
4808
4903
  // Video dimensions:
@@ -9694,6 +9789,26 @@ function buildVideoEstimateParams({ tokenType, steps }) {
9694
9789
  return params;
9695
9790
  }
9696
9791
 
9792
+ function isMiniMaxH3ExtendedDurationEstimateError(err) {
9793
+ const actualDuration = options.frames
9794
+ ? options.frames / options.fps
9795
+ : options.duration;
9796
+ return isMiniMaxH3Model(options.model)
9797
+ && actualDuration > 10
9798
+ && /duration must be between 1 and 10 seconds/i.test(String(err?.message || err || ''));
9799
+ }
9800
+
9801
+ function buildMiniMaxH3EstimateUnavailableError(cause) {
9802
+ const err = new Error(
9803
+ 'MiniMax H3 generation supports clips through 15.08 seconds, but this client cannot pre-estimate clips over 10 seconds.'
9804
+ );
9805
+ err.code = 'VIDEO_COST_ESTIMATE_UNAVAILABLE';
9806
+ err.retryable = false;
9807
+ err.hint = 'Submit without --estimate-video-cost so the server can validate balance when the render starts, or estimate a clip of 10 seconds or less.';
9808
+ err.cause = cause;
9809
+ return err;
9810
+ }
9811
+
9697
9812
  async function ensureSufficientVideoBalance(client, log) {
9698
9813
  if (!options.video || options.estimateVideoCost) return;
9699
9814
  // Sogni Unlimited bills covered video jobs to the subscription, so a low
@@ -9735,7 +9850,12 @@ async function ensureSufficientVideoBalance(client, log) {
9735
9850
  estimate = await client.estimateVideoCost(buildVideoEstimateParams({ tokenType, steps }));
9736
9851
  } catch (err) {
9737
9852
  if (!options.quiet) {
9738
- log(`Warning: Could not estimate video cost (${err?.message || 'error'})`);
9853
+ if (isMiniMaxH3ExtendedDurationEstimateError(err)) {
9854
+ const estimateError = buildMiniMaxH3EstimateUnavailableError(err);
9855
+ log(`Note: ${estimateError.message} ${estimateError.hint}`);
9856
+ } else {
9857
+ log(`Warning: Could not estimate video cost (${err?.message || 'error'})`);
9858
+ }
9739
9859
  }
9740
9860
  return;
9741
9861
  }
@@ -10450,7 +10570,15 @@ async function main() {
10450
10570
  tokenType: options.tokenType || 'spark',
10451
10571
  steps
10452
10572
  });
10453
- const estimate = await client.estimateVideoCost(estimateParams);
10573
+ let estimate;
10574
+ try {
10575
+ estimate = await client.estimateVideoCost(estimateParams);
10576
+ } catch (err) {
10577
+ if (isMiniMaxH3ExtendedDurationEstimateError(err)) {
10578
+ throw buildMiniMaxH3EstimateUnavailableError(err);
10579
+ }
10580
+ throw err;
10581
+ }
10454
10582
  if (options.json) {
10455
10583
  const duration = options.frames ? Math.max(1, Math.round((options.frames - 1) / options.fps)) : options.duration;
10456
10584
  console.log(JSON.stringify({
package/sogni-app-id.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * Persistent Sogni application identity.
3
3
  *
4
- * Sogni limits how many distinct app IDs may connect from one address each
5
- * UTC day. An app ID therefore represents an installation, not a process or
6
- * request. Keep it outside credentials so rotating an API key does not rotate
7
- * the installation identity.
4
+ * Repeatedly registering distinct app IDs can exhaust the service allowance.
5
+ * An app ID therefore represents an installation, not a process or request.
6
+ * Keep it outside credentials so rotating an API key does not rotate the
7
+ * installation identity.
8
8
  *
9
9
  * A single shared app ID is not enough once several agent harnesses (Claude
10
10
  * Code, Codex, OpenCode, hermes, ...) drive this CLI concurrently: the socket
package/update-check.mjs CHANGED
@@ -292,8 +292,9 @@ export const AGENT_NOTICE_THROTTLE_MS = 24 * 60 * 60 * 1000;
292
292
 
293
293
  export function formatAgentUpdateNotice({ currentVersion, latestVersion } = {}) {
294
294
  return `[sogni-agent] Update available: ${currentVersion} -> ${latestVersion}. ` +
295
- 'Agent: after finishing the current task, let the user know a newer Sogni Creative Agent Skill exists ' +
295
+ 'Agent: after finishing the current task, let the user know a newer Sogni CLI package exists ' +
296
296
  'and offer to run `sogni-agent self-update` (then `sogni-agent --whats-new`). ' +
297
+ 'That updates the global CLI only; copied personal skill bundles must be refreshed through their original setup flow and loaded in a new session. ' +
297
298
  'If they decline, run `sogni-agent --snooze-update` to pause these reminders.';
298
299
  }
299
300
 
@@ -472,6 +473,7 @@ export function runSelfUpdate({
472
473
  return result.status;
473
474
  }
474
475
  clearState(statePath);
475
- log('Updated. Run `sogni-agent --whats-new` to see what changed.');
476
+ log('Updated the global CLI. Run `sogni-agent --whats-new` to see what changed.');
477
+ log('Copied personal skill bundles are not refreshed by self-update; rerun their original setup flow and start a new agent session.');
476
478
  return 0;
477
479
  }
package/version.mjs CHANGED
@@ -1 +1 @@
1
- export const PACKAGE_VERSION = '3.26.0';
1
+ export const PACKAGE_VERSION = '3.27.0';