@sogni-ai/sogni-creative-agent-skill 3.20.0 → 3.22.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.
@@ -82,11 +82,22 @@ LoRAs are bipolar sliders, so negative values are valid and apply the inverse
82
82
  effect. Follow the range documented for each LoRA rather than assuming 0-2.
83
83
  The first render with an uncached LoRA can take longer while its asset downloads.
84
84
 
85
- For identity-preserving Krea edits, pass a context image with
86
- `-m krea2_identity_edit_v1_2` or
87
- `-m dark_beast_krea2_identity_edit_v1_2`. These edit models support 1-2
88
- context images, 512-2048 px output, 8-12 steps, and guidance 1; the default
89
- is 10 steps.
85
+ For an edit of a referenced person or character that must preserve likeness or
86
+ character identity while changing clothing, hair or makeup, pose or position,
87
+ face/head/body, background, lighting, or visual style, default to a context
88
+ edit with `-m krea2_identity_edit_v1_2`. Infer that semantic intent in any
89
+ language; never route from keyword or regex matching. Also use it for a
90
+ single-character sheet unless Pro/detail-critical layout requirements favor
91
+ GPT Image 2. An explicitly requested model always wins. Use
92
+ `-m dark_beast_krea2_identity_edit_v1_2` only when the creator explicitly
93
+ requests that community/uncensored variant.
94
+
95
+ These models accept 1-2 context images at 512-2048 px. With two references,
96
+ pass the base scene first and the person/detail/outfit/pose/style reference
97
+ second. Use a concise 1-4 sentence delta instruction rather than restating the
98
+ whole image, do not send a negative prompt, and leave steps, guidance, sampler,
99
+ and scheduler unset so the current model tier and worker choose their optimized
100
+ defaults.
90
101
 
91
102
  `gpt-image-2` supports flexible OpenAI image sizes up to `3840px` on either
92
103
  edge, max `3:1` aspect ratio, and total pixels from `655,360` through
@@ -120,6 +131,7 @@ direct music generation. Music controls: `--lyrics`, `--language`, `--bpm`
120
131
  |-------|-------|----------|
121
132
  | `ltx23-22b-fp8_t2v_distilled` | Fast (~2-3min) | Default text-to-video with native dialogue/audio |
122
133
  | `ltx23-22b-fp8_i2v_distilled` | Fast (~2-3min) | Image-to-video with native dialogue/audio; **default for two-image first-frame → last-frame animation** (transition/morph LoRA auto-applies) |
134
+ | `ltx23-eros` → `ltx23-22b-10eros-v1.4-fp8mixed_i2v` | Fast | Explicit uncensored I2V; 30GB+ GPU and `--no-filter` required |
123
135
  | `ltx23-22b-fp8_ia2v_distilled` | Fast (~2-3min) | Image+audio-to-video |
124
136
  | `ltx23-22b-fp8_a2v_distilled` | Fast (~2-3min) | Audio-to-video |
125
137
  | `ltx23-22b-fp8_v2v_distilled` | Fast (~3min) | Video-to-video with ControlNet, plus canvas outpaint and masked inpaint |
@@ -217,6 +229,20 @@ and short in-scene text.
217
229
 
218
230
  ## LTX-2 / LTX-2.3 models
219
231
 
232
+ ### LTX-2.3 10Eros
233
+
234
+ Use `-m ltx23-eros` only when the user explicitly requests 10Eros/the
235
+ uncensored model and explicitly permits disabling the content filter. It is
236
+ image-to-video only and requires `--ref`, `--no-filter`, and a worker with at
237
+ least 30GB VRAM. The CLI resolves it to
238
+ `ltx23-22b-10eros-v1.4-fp8mixed_i2v` and pins 9 steps, guidance 1,
239
+ `euler_ancestral`, and `manual_sigmas`.
240
+
241
+ ```bash
242
+ sogni-agent --video --workflow i2v --ref input.png \
243
+ -m ltx23-eros --no-filter -o output.mp4 "<LTX-rewritten paragraph>"
244
+ ```
245
+
220
246
  | Model | Speed | Use Case |
221
247
  |-------|-------|----------|
222
248
  | `ltx2-19b-fp8_t2v_distilled` | Fast (~2-3min) | Text-to-video, 8-step |
@@ -257,6 +283,7 @@ model recommendations.
257
283
  | Text-to-video with native dialogue/audio | `ltx23-22b-fp8_t2v_distilled` |
258
284
  | Image-to-video from one start frame (default) | `wan_v2.2-14b-fp8_i2v_lightx2v` |
259
285
  | Animate two images together (first frame → last frame) | `ltx23-22b-fp8_i2v_distilled` with `--ref A --ref-end B` (transition/morph LoRA auto-applies) |
286
+ | Explicit uncensored image-to-video on 30GB+ GPUs | `ltx23-eros` with `--no-filter` |
260
287
  | Image+audio-to-video | `ltx23-22b-fp8_ia2v_distilled` |
261
288
  | Audio-to-video | `ltx23-22b-fp8_a2v_distilled` |
262
289
  | Video-to-video with ControlNet | `ltx23-22b-fp8_v2v_distilled` |
@@ -44,22 +44,40 @@ chronologically, and place each token beside its corresponding action.
44
44
  ## Prompt construction for 10Eros + DR34ML4Y
45
45
 
46
46
  Write the prompt solely to produce the result the creator requested. Use one
47
- unbroken, chronological LTX paragraph:
48
-
49
- 1. Describe the supplied frame's visible composition and pose.
50
- 2. State the action concretely. Include a LoRA token when the requested action
47
+ unbroken, chronological LTX paragraph of 4-8 present-tense sentences. Do not
48
+ emit section labels such as `Performance:` or `Dialogue:` into the model
49
+ prompt; fold those details into cinematic prose instead.
50
+
51
+ 1. Use the supplied start image exactly as the first frame by passing it through
52
+ `--ref`; do not merely mention it in prose. Briefly anchor its composition,
53
+ subject placement, and starting pose without inventing conflicting details.
54
+ 2. Establish the overall cinematic style, shot scale, camera movement,
55
+ environment, lighting, atmosphere, and relevant subtle background motion.
56
+ 3. State the action concretely. Include a LoRA token when the requested action
51
57
  matches one of its trained concepts.
52
- 3. Describe what happens step by step in chronological order: who moves, which
58
+ 4. Describe what happens step by step in chronological order: who moves, which
53
59
  body parts move, their direction, changes in position or contact, and the
54
60
  resulting pose.
55
- 4. Specify shot scale, camera angle, framing, and any camera movement.
56
- 5. Integrate the audio design with the action: voice delivery, dialogue, foley,
61
+ 5. Direct the performance through observable behavior: posture, breathing,
62
+ gaze, facial expression, micro-expressions, small pauses, and emotional
63
+ changes that flow naturally from the starting pose.
64
+ 6. Integrate the audio design with the action: voice delivery, dialogue, foley,
57
65
  environmental sound, and music where relevant.
58
66
 
59
67
  Be specific and literal. Do not substitute euphemisms or generalizations for
60
68
  the requested visible action. Keep the action density appropriate for the
61
69
  duration, and avoid contradictory positions, unrelated cuts, generic quality
62
- tags, and repeating the same action in several different ways.
70
+ tags, and repeating the same action in several different ways. Prefer one
71
+ simple, logical, interesting motion evolution. Keep acting and physical motion
72
+ natural and cinematic, with realistic weight and restrained gestures rather
73
+ than exaggerated motion or slapstick. Do not introduce extra characters unless
74
+ they are clearly visible in the supplied image or explicitly requested.
75
+
76
+ When an image is attached and the creator says "one for this image", "make one
77
+ for this", or similar, treat the image as the start-frame authority and build
78
+ the complete purpose-written prompt from what is visibly present plus the
79
+ creator's stated intent. Do not answer with generic prompting advice, and do
80
+ not invent a different scene merely to fill out the paragraph.
63
81
 
64
82
  Write every spoken line verbatim in double quotes and identify who says it and
65
83
  how. Never imply dialogue with a summary such as "they talk" or "she says
@@ -3,7 +3,7 @@
3
3
  "private": true,
4
4
  "type": "module",
5
5
  "dependencies": {
6
- "@sogni-ai/sogni-intelligence-client": "3.9.0",
6
+ "@sogni-ai/sogni-intelligence-client": "3.11.0",
7
7
  "execa": "^9.6.1",
8
8
  "json5": "^2.2.3",
9
9
  "sharp": "^0.34.5"
@@ -5,4 +5,7 @@ description: Turn a folder of images into a polished, music-backed seamless loop
5
5
 
6
6
  # Sogni Loop Maker
7
7
 
8
+ This is the Codex plugin surface. Wherever the referenced workflow says
9
+ `sogni-agent` or `sogni-agent-claude-code`, invoke `sogni-agent-codex`.
10
+
8
11
  Read `../../plugin-skills/loop-maker/SKILL.md` relative to this installed file completely and follow it. Resolve every subsequent plugin path from the plugin root two directories above this file, never from the user's working directory.
@@ -5,4 +5,7 @@ description: Generate and edit images, video, and music using Sogni AI's decentr
5
5
 
6
6
  # Sogni Creative Agent
7
7
 
8
+ This is the Codex plugin surface. Wherever the referenced skill says
9
+ `sogni-agent` or `sogni-agent-claude-code`, invoke `sogni-agent-codex`.
10
+
8
11
  Read `../../plugin-skills/sogni-creative-agent/SKILL.md` relative to this installed file completely and follow it. Resolve every subsequent plugin path from the plugin root two directories above this file, never from the user's working directory.
package/sogni-agent.mjs CHANGED
@@ -18,6 +18,14 @@ import sharp from 'sharp';
18
18
  import { getEnv, hasEnv } from './env.mjs';
19
19
  import { getOrCreateSogniAppId } from './sogni-app-id.mjs';
20
20
  import { PACKAGE_VERSION } from './version.mjs';
21
+ import {
22
+ SOGNI_APP_SOURCE,
23
+ attributionHeaders,
24
+ clientAttribution,
25
+ createInvocationLineage,
26
+ resolveAgentAttribution,
27
+ semanticWorkloadAttribution,
28
+ } from './attribution.mjs';
21
29
  import { assertSafeUrl, fetchSafeUrl } from './ssrf-guard.mjs';
22
30
  import {
23
31
  INTERNAL_FLAG as UPDATE_CHECK_INTERNAL_FLAG,
@@ -79,6 +87,8 @@ import {
79
87
  extractToolCallProgressUpdate
80
88
  } from '@sogni-ai/sogni-intelligence-client/chatRun';
81
89
  import {
90
+ buildImageEditExecutionControls,
91
+ isKreaIdentityEditModel,
82
92
  SEEDANCE_R2V_REFERENCE_AUDIO_MAX_DURATION_SECONDS,
83
93
  prepareSeedanceV2VSourceVideo as prepareSharedSeedanceV2VSourceVideo
84
94
  } from '@sogni-ai/sogni-intelligence-client/media';
@@ -282,9 +292,10 @@ const DEFAULT_SAFE_API_HOSTS = Object.freeze(['api.sogni.ai']);
282
292
  const LOOPBACK_API_HOSTS = Object.freeze(['localhost', '127.0.0.1', '::1']);
283
293
  const DEFAULT_LLM_MODEL = 'qwen3.6-35b-a3b-gguf-iq4xs';
284
294
  const VALID_API_TASK_PROFILES = new Set(['general', 'coding', 'reasoning']);
285
- const SOGNI_APP_SOURCE = 'sogni-creative-agent-skill';
286
295
  const OPENCLAW_CONFIG_PATH = getEnv('OPENCLAW_CONFIG_PATH') || DEFAULT_OPENCLAW_CONFIG_PATH;
287
296
  const IS_OPENCLAW_INVOCATION = Boolean(getEnv('OPENCLAW_PLUGIN_CONFIG'));
297
+ const AGENT_ATTRIBUTION = resolveAgentAttribution({ surfaceVersion: PACKAGE_VERSION });
298
+ const INVOCATION_LINEAGE = createInvocationLineage();
288
299
  const RAW_ARGS = process.argv.slice(2);
289
300
  const CLI_WANTS_JSON = RAW_ARGS.includes('--json');
290
301
  const JSON_ERROR_MODE = CLI_WANTS_JSON || IS_OPENCLAW_INVOCATION;
@@ -405,11 +416,19 @@ let liveModelDefaults = null;
405
416
  function getModelDefaults(modelId, config) {
406
417
  const sharedDefaults = getSharedModelDefaults(modelId, config);
407
418
  const catalogDefaults = liveModelDefaults?.[modelId];
408
- if (!catalogDefaults) return sharedDefaults;
409
419
  const configuredDefaults = config?.modelDefaults?.[modelId];
420
+ const fixedDefaults = modelId === LTX23_10EROS_MODEL_ID
421
+ ? LTX23_10EROS_FIXED_SETTINGS
422
+ : null;
423
+ if (!catalogDefaults && !configuredDefaults && !fixedDefaults) return sharedDefaults;
410
424
  // The live catalog supersedes bundled registry data. Explicit user config
411
- // remains the final override.
412
- return { ...(sharedDefaults || {}), ...catalogDefaults, ...(configuredDefaults || {}) };
425
+ // remains the final override except where a workflow has immutable settings.
426
+ return {
427
+ ...(sharedDefaults || {}),
428
+ ...(catalogDefaults || {}),
429
+ ...(configuredDefaults || {}),
430
+ ...(fixedDefaults || {})
431
+ };
413
432
  }
414
433
 
415
434
  function defaultsFromModelTier(card) {
@@ -1495,9 +1514,16 @@ function requiresSparkOnlyToken(modelId) {
1495
1514
  // Attach the user's explicit --billing-mode to a project config. Omitted by
1496
1515
  // default so the server keeps deciding coverage (Unlimited members get 'auto'
1497
1516
  // coverage server-side; token payers are unaffected).
1498
- function withBillingMode(config) {
1499
- if (!options.billingMode) return config;
1500
- return { ...config, billingMode: options.billingMode };
1517
+ function nextSemanticWorkloadAttribution(options = {}) {
1518
+ return semanticWorkloadAttribution(AGENT_ATTRIBUTION, INVOCATION_LINEAGE.next(options));
1519
+ }
1520
+
1521
+ function withBillingMode(config, attributionOptions = {}) {
1522
+ return {
1523
+ ...config,
1524
+ ...(options.billingMode ? { billingMode: options.billingMode } : {}),
1525
+ attribution: nextSemanticWorkloadAttribution(attributionOptions),
1526
+ };
1501
1527
  }
1502
1528
 
1503
1529
  // Best-effort Sogni Unlimited entitlement lookup. Returns null (never throws)
@@ -1834,6 +1860,13 @@ const LTX_TRANSITION_LORA_ID = 'transition';
1834
1860
  const LTX_TRANSITION_TRIGGER = 'zhuanchang';
1835
1861
  const LTX_TRANSITION_DEFAULT_STRENGTH = 1.0;
1836
1862
  const LTX23_10EROS_MODEL_ID = 'ltx23-22b-10eros-v1.4-fp8mixed_i2v';
1863
+ const LTX23_10EROS_FIXED_SETTINGS = Object.freeze({
1864
+ steps: 9,
1865
+ guidance: 1,
1866
+ sampler: 'euler_ancestral',
1867
+ scheduler: 'manual_sigmas',
1868
+ requiresDisabledSafetyFilter: true
1869
+ });
1837
1870
  const DR34ML4Y_LORA_ID = 'dr34ml4y-v3';
1838
1871
  const DR34ML4Y_DEFAULT_STRENGTH = 1.0;
1839
1872
  const DR34ML4Y_SUPPORTED_MODEL_IDS = new Set([
@@ -1844,7 +1877,9 @@ const DR34ML4Y_SUPPORTED_MODEL_IDS = new Set([
1844
1877
 
1845
1878
  function resolveSkillVideoModelAlias(modelId) {
1846
1879
  const normalized = String(modelId || '').trim().toLowerCase();
1847
- return normalized === '10eros' ? LTX23_10EROS_MODEL_ID : modelId;
1880
+ return normalized === '10eros' || normalized === 'ltx23-eros'
1881
+ ? LTX23_10EROS_MODEL_ID
1882
+ : modelId;
1848
1883
  }
1849
1884
 
1850
1885
  function normalizeMultiAngleValue(value, aliases, allowedKeys, label) {
@@ -3425,6 +3460,7 @@ Image Models:
3425
3460
  Recommended LTX 2.3 Video Models:
3426
3461
  ltx23-22b-fp8_t2v_distilled Text-to-video with native dialogue/audio
3427
3462
  ltx23-22b-fp8_i2v_distilled Image-to-video with native dialogue/audio; default for --ref + --ref-end pairs
3463
+ ltx23-eros Explicit uncensored I2V (30GB+ worker; requires --no-filter)
3428
3464
  ltx23-22b-fp8_ia2v_distilled Image+audio-to-video
3429
3465
  ltx23-22b-fp8_a2v_distilled Audio-to-video
3430
3466
  ltx23-22b-fp8_v2v_distilled Video-to-video with ControlNet
@@ -4088,6 +4124,31 @@ if (options.music) {
4088
4124
  });
4089
4125
  }
4090
4126
  const videoModelDefaults = getModelDefaults(options.model, openclawConfig);
4127
+ if (videoModelDefaults?.requiresDisabledSafetyFilter) {
4128
+ if (!options.noFilter) {
4129
+ fatalCliError('LTX-2.3 10Eros requires explicit --no-filter acknowledgement.', {
4130
+ code: 'INVALID_ARGUMENT',
4131
+ details: { model: options.model, requiredFlag: '--no-filter' },
4132
+ hint: 'Retry with --video --workflow i2v --ref <image> -m ltx23-eros --no-filter'
4133
+ });
4134
+ }
4135
+ const fixedSettings = {
4136
+ steps: videoModelDefaults.steps,
4137
+ guidance: videoModelDefaults.guidance,
4138
+ sampler: videoModelDefaults.sampler,
4139
+ scheduler: videoModelDefaults.scheduler
4140
+ };
4141
+ for (const [setting, expected] of Object.entries(fixedSettings)) {
4142
+ if (expected === undefined) continue;
4143
+ if (cliSet[setting] && options[setting] !== expected) {
4144
+ fatalCliError(`LTX-2.3 10Eros requires --${setting} ${expected}.`, {
4145
+ code: 'INVALID_ARGUMENT',
4146
+ details: { model: options.model, setting, expected, received: options[setting] }
4147
+ });
4148
+ }
4149
+ options[setting] = expected;
4150
+ }
4151
+ }
4091
4152
  // Fall back to skill-local defaults for models the intel registry does not
4092
4153
  // carry (e.g. HappyHorse), so they get a sensible 16:9 default instead of the
4093
4154
  // 512x512 square. Registry defaults still take precedence when present.
@@ -4110,7 +4171,12 @@ if (options.music) {
4110
4171
  }
4111
4172
  const videoQuality = options.quality ? QUALITY_TIERS[options.quality]?.video : null;
4112
4173
  if (videoQuality) {
4113
- if (!isSeedanceVideo && !cliSet.steps && Number.isFinite(videoQuality.steps)) {
4174
+ if (
4175
+ !isSeedanceVideo
4176
+ && options.model !== LTX23_10EROS_MODEL_ID
4177
+ && !cliSet.steps
4178
+ && Number.isFinite(videoQuality.steps)
4179
+ ) {
4114
4180
  options.steps = videoQuality.steps;
4115
4181
  }
4116
4182
  }
@@ -4957,12 +5023,13 @@ function requireApiKeyCredentials(creds, modeLabel) {
4957
5023
  throw err;
4958
5024
  }
4959
5025
 
4960
- function apiRequestHeaders(apiKey, extra = {}) {
5026
+ function apiRequestHeaders(apiKey, extra = {}, workloadAttribution = undefined) {
4961
5027
  return {
4962
5028
  'Content-Type': 'application/json',
4963
5029
  Authorization: `Bearer ${apiKey}`,
4964
5030
  'api-key': apiKey,
4965
- ...extra
5031
+ ...extra,
5032
+ ...attributionHeaders(AGENT_ATTRIBUTION, workloadAttribution),
4966
5033
  };
4967
5034
  }
4968
5035
 
@@ -5003,6 +5070,7 @@ async function dispatchWorkflowActionViaSdk(action, apiKey, params) {
5003
5070
  socketEndpoint: process.env.SOGNI_SOCKET_ENDPOINT || undefined,
5004
5071
  appSource: SOGNI_APP_SOURCE,
5005
5072
  appId: getOrCreateSogniAppId(),
5073
+ attribution: clientAttribution(AGENT_ATTRIBUTION),
5006
5074
  },
5007
5075
  async (client) => {
5008
5076
  if (action === 'list') {
@@ -5036,6 +5104,7 @@ async function dispatchWorkflowActionViaSdk(action, apiKey, params) {
5036
5104
  : {}),
5037
5105
  ...(params.confirmCost != null ? { confirmCost: params.confirmCost } : {}),
5038
5106
  ...(params.idempotencyKey ? { idempotencyKey: params.idempotencyKey } : {}),
5107
+ ...(params.attribution ? { attribution: params.attribution } : {}),
5039
5108
  },
5040
5109
  {},
5041
5110
  );
@@ -5064,7 +5133,7 @@ async function dispatchWorkflowActionViaSdk(action, apiKey, params) {
5064
5133
  * Returns `null` when SDK transport is off so the caller falls back
5065
5134
  * to `fetchApiJson`.
5066
5135
  */
5067
- async function dispatchChatHostedViaSdk(apiKey, body) {
5136
+ async function dispatchChatHostedViaSdk(apiKey, body, workloadAttribution) {
5068
5137
  let helpers;
5069
5138
  try {
5070
5139
  helpers = await import('./sogni-hosted-client.mjs');
@@ -5081,8 +5150,12 @@ async function dispatchChatHostedViaSdk(apiKey, body) {
5081
5150
  socketEndpoint: process.env.SOGNI_SOCKET_ENDPOINT || undefined,
5082
5151
  appSource: SOGNI_APP_SOURCE,
5083
5152
  appId: getOrCreateSogniAppId(),
5153
+ attribution: clientAttribution(AGENT_ATTRIBUTION),
5084
5154
  },
5085
- async (client) => helpers.sdkChatHostedCreate(client, body),
5155
+ async (client) => helpers.sdkChatHostedCreate(client, {
5156
+ ...body,
5157
+ ...(workloadAttribution ? { attribution: workloadAttribution } : {}),
5158
+ }),
5086
5159
  );
5087
5160
  }
5088
5161
 
@@ -5124,6 +5197,7 @@ async function dispatchMediaReferenceUrlViaSdk({ ref, file, index, jobId, action
5124
5197
  socketEndpoint: process.env.SOGNI_SOCKET_ENDPOINT || undefined,
5125
5198
  appSource: SOGNI_APP_SOURCE,
5126
5199
  appId: getOrCreateSogniAppId(),
5200
+ attribution: clientAttribution(AGENT_ATTRIBUTION),
5127
5201
  },
5128
5202
  async (client) => {
5129
5203
  const type = apiMediaReferenceUploadType(ref, index);
@@ -5189,11 +5263,17 @@ async function fetchWithTimeout(resource, init = {}, timeoutMs = DEFAULT_HTTP_TI
5189
5263
  }
5190
5264
  }
5191
5265
 
5192
- async function fetchApiJson(path, { apiKey, method = 'GET', body = undefined, headers = {} } = {}) {
5266
+ async function fetchApiJson(path, {
5267
+ apiKey,
5268
+ method = 'GET',
5269
+ body = undefined,
5270
+ headers = {},
5271
+ workloadAttribution = undefined,
5272
+ } = {}) {
5193
5273
  const url = await buildSafeApiUrl(path);
5194
5274
  const init = {
5195
5275
  method,
5196
- headers: apiRequestHeaders(apiKey, headers),
5276
+ headers: apiRequestHeaders(apiKey, headers, workloadAttribution),
5197
5277
  ...(body === undefined ? {} : { body: JSON.stringify(body) })
5198
5278
  };
5199
5279
 
@@ -5799,15 +5879,17 @@ async function runApiChat(log) {
5799
5879
  ...(options.noFilter === true ? { safeContentFilter: false } : {}),
5800
5880
  ...(apiMediaReferences.length > 0 ? { media_references: apiMediaReferences } : {})
5801
5881
  };
5882
+ const workloadAttribution = nextSemanticWorkloadAttribution();
5802
5883
  if (options.durableChat) {
5803
- return runApiChatDurable(log, { apiKey, body });
5884
+ return runApiChatDurable(log, { apiKey, body, workloadAttribution });
5804
5885
  }
5805
5886
  const payload =
5806
- (await dispatchChatHostedViaSdk(apiKey, body))
5887
+ (await dispatchChatHostedViaSdk(apiKey, body, workloadAttribution))
5807
5888
  ?? (await fetchApiJson('/v1/chat/completions', {
5808
5889
  apiKey,
5809
5890
  method: 'POST',
5810
- body
5891
+ body,
5892
+ workloadAttribution,
5811
5893
  }));
5812
5894
  const message = extractChatMessage(payload);
5813
5895
  const workflows = extractChatWorkflows(payload);
@@ -5857,7 +5939,7 @@ async function runApiChat(log) {
5857
5939
  * installed) we fail with a clear error rather than silently falling
5858
5940
  * back to the synchronous endpoint.
5859
5941
  */
5860
- async function runApiChatDurable(log, { apiKey, body }) {
5942
+ async function runApiChatDurable(log, { apiKey, body, workloadAttribution }) {
5861
5943
  let helpers;
5862
5944
  try {
5863
5945
  helpers = await import('./sogni-hosted-client.mjs');
@@ -5894,6 +5976,7 @@ async function runApiChatDurable(log, { apiKey, body }) {
5894
5976
  ...(typeof body.safeContentFilter === 'boolean'
5895
5977
  ? { runtimeConfig: { safeContentFilter: body.safeContentFilter } }
5896
5978
  : {}),
5979
+ ...(workloadAttribution ? { attribution: workloadAttribution } : {}),
5897
5980
  };
5898
5981
 
5899
5982
  const restEndpoint = await buildSafeApiUrl('/');
@@ -5912,6 +5995,7 @@ async function runApiChatDurable(log, { apiKey, body }) {
5912
5995
  socketEndpoint: process.env.SOGNI_SOCKET_ENDPOINT || undefined,
5913
5996
  appSource: SOGNI_APP_SOURCE,
5914
5997
  appId: getOrCreateSogniAppId(),
5998
+ attribution: clientAttribution(AGENT_ATTRIBUTION),
5915
5999
  },
5916
6000
  async (client) => {
5917
6001
  const created = await helpers.sdkChatRunsCreate(client, runParams);
@@ -6258,12 +6342,19 @@ async function generateStoryboardWorkflowStoryline(apiKey) {
6258
6342
  sogni_tools: false,
6259
6343
  sogni_tool_execution: false
6260
6344
  };
6345
+ // Planning is internal compute for the workflow intent. Reserve the
6346
+ // invocation root for the workflow start so headline counts stay at one.
6347
+ const workloadAttribution = nextSemanticWorkloadAttribution({
6348
+ scope: 'child',
6349
+ parentOperationId: INVOCATION_LINEAGE.rootOperationId,
6350
+ });
6261
6351
  const payload =
6262
- (await dispatchChatHostedViaSdk(apiKey, body))
6352
+ (await dispatchChatHostedViaSdk(apiKey, body, workloadAttribution))
6263
6353
  ?? (await fetchApiJson('/v1/chat/completions', {
6264
6354
  apiKey,
6265
6355
  method: 'POST',
6266
- body
6356
+ body,
6357
+ workloadAttribution,
6267
6358
  }));
6268
6359
  const message = extractChatMessage(payload);
6269
6360
  const storyline = typeof message.content === 'string' ? message.content.trim() : '';
@@ -6982,6 +7073,7 @@ async function runApiWorkflow() {
6982
7073
  input = buildGeneratedKeyframeVideoWorkflowInput();
6983
7074
  }
6984
7075
 
7076
+ const workloadAttribution = nextSemanticWorkloadAttribution({ scope: 'top_level' });
6985
7077
  payload =
6986
7078
  (await dispatchWorkflowActionViaSdk('start', apiKey, {
6987
7079
  input,
@@ -6990,6 +7082,7 @@ async function runApiWorkflow() {
6990
7082
  maxEstimatedCapacityUnits: options.apiWorkflowMaxCost ?? undefined,
6991
7083
  confirmCost: options.apiWorkflowConfirmCost ?? undefined,
6992
7084
  idempotencyKey: options.apiWorkflowIdempotencyKey ?? undefined,
7085
+ attribution: workloadAttribution,
6993
7086
  }))
6994
7087
  ?? (await fetchApiJson('/v1/creative-agent/workflows', {
6995
7088
  apiKey,
@@ -7006,7 +7099,8 @@ async function runApiWorkflow() {
7006
7099
  ...(options.apiWorkflowConfirmCost !== null ? { confirm_cost: options.apiWorkflowConfirmCost } : {}),
7007
7100
  token_type: tokenType,
7008
7101
  app_source: SOGNI_APP_SOURCE
7009
- }
7102
+ },
7103
+ workloadAttribution,
7010
7104
  }));
7011
7105
  const workflow = workflowFromPayload(payload);
7012
7106
  const workflowId = workflow?.workflowId || workflow?.id;
@@ -7965,8 +8059,11 @@ function isNonEmptyFile(filePath) {
7965
8059
  }
7966
8060
  }
7967
8061
 
7968
- async function runCommand(command, args, { captureOutput = false } = {}) {
7969
- const options = { reject: false };
8062
+ async function runCommand(command, args, { captureOutput = false, env = undefined } = {}) {
8063
+ const options = {
8064
+ reject: false,
8065
+ ...(env ? { env: { ...process.env, ...env } } : {}),
8066
+ };
7970
8067
  if (captureOutput) {
7971
8068
  options.stdout = 'pipe';
7972
8069
  options.stderr = 'pipe';
@@ -8738,8 +8835,22 @@ function parseSourceReelChildJson(stdout) {
8738
8835
  }
8739
8836
  }
8740
8837
 
8741
- async function runSourceReelChild(label, args, logPath, outputPath) {
8742
- const result = await runCommand(process.execPath, args, { captureOutput: true });
8838
+ function sourceReelLineageEnvironment(workloadAttribution) {
8839
+ return {
8840
+ SOGNI_AGENT_OPERATION_SCOPE: workloadAttribution.operationScope,
8841
+ SOGNI_AGENT_OPERATION_ID: workloadAttribution.operationId,
8842
+ SOGNI_AGENT_ROOT_OPERATION_ID: workloadAttribution.rootOperationId,
8843
+ ...(workloadAttribution.parentOperationId
8844
+ ? { SOGNI_AGENT_PARENT_OPERATION_ID: workloadAttribution.parentOperationId }
8845
+ : {}),
8846
+ };
8847
+ }
8848
+
8849
+ async function runSourceReelChild(label, args, logPath, outputPath, workloadAttribution) {
8850
+ const result = await runCommand(process.execPath, args, {
8851
+ captureOutput: true,
8852
+ env: sourceReelLineageEnvironment(workloadAttribution),
8853
+ });
8743
8854
  const parsed = parseSourceReelChildJson(result.stdout);
8744
8855
  const logBody = [
8745
8856
  `label=${label}`,
@@ -8791,7 +8902,14 @@ async function runSourceReel(log) {
8791
8902
  }
8792
8903
  log(`START clip ${clip.id} ${clip.name}`);
8793
8904
  const args = sourceReelChildArgs(['--ref', clip.refPath], clip.clipPath, clip.prompt, plan, plan.imageSeconds);
8794
- await runSourceReelChild(`clip ${clip.id}`, args, clip.logPath, clip.clipPath);
8905
+ const workloadAttribution = nextSemanticWorkloadAttribution();
8906
+ await runSourceReelChild(
8907
+ `clip ${clip.id}`,
8908
+ args,
8909
+ clip.logPath,
8910
+ clip.clipPath,
8911
+ workloadAttribution,
8912
+ );
8795
8913
  log(`DONE clip ${clip.id} -> ${clip.clipPath}`);
8796
8914
  });
8797
8915
 
@@ -8823,7 +8941,14 @@ async function runSourceReel(log) {
8823
8941
  plan,
8824
8942
  plan.transitionSeconds
8825
8943
  );
8826
- await runSourceReelChild(`transition ${transition.key}`, args, transition.logPath, transition.clipPath);
8944
+ const workloadAttribution = nextSemanticWorkloadAttribution();
8945
+ await runSourceReelChild(
8946
+ `transition ${transition.key}`,
8947
+ args,
8948
+ transition.logPath,
8949
+ transition.clipPath,
8950
+ workloadAttribution,
8951
+ );
8827
8952
  log(`DONE transition ${transition.key} -> ${transition.clipPath}`);
8828
8953
  });
8829
8954
  }
@@ -9004,21 +9129,24 @@ async function runMultiAngleFlow(client, log) {
9004
9129
  numberOfMedia: options.count,
9005
9130
  width: options.width,
9006
9131
  height: options.height,
9007
- steps,
9008
- guidance,
9009
9132
  tokenType: options.tokenType || 'spark',
9010
9133
  waitForCompletion: false,
9011
- disableNSFWFilter: options.noFilter === true
9134
+ disableNSFWFilter: options.noFilter === true,
9135
+ ...buildImageEditExecutionControls(options.model, {
9136
+ steps,
9137
+ guidance,
9138
+ sampler: options.sampler,
9139
+ scheduler: options.scheduler
9140
+ }, {
9141
+ steps: cliSet.steps ? options.steps : undefined,
9142
+ guidance: cliSet.guidance ? options.guidance : undefined,
9143
+ sampler: cliSet.sampler ? options.sampler : undefined,
9144
+ scheduler: cliSet.scheduler ? options.scheduler : undefined
9145
+ })
9012
9146
  };
9013
9147
  if (options.outputFormat) {
9014
9148
  editConfig.outputFormat = options.outputFormat;
9015
9149
  }
9016
- if (options.sampler) {
9017
- editConfig.sampler = options.sampler;
9018
- }
9019
- if (options.scheduler) {
9020
- editConfig.scheduler = options.scheduler;
9021
- }
9022
9150
  if (options.loras.length > 0) {
9023
9151
  editConfig.loras = options.loras;
9024
9152
  }
@@ -9445,6 +9573,7 @@ async function runDoctor() {
9445
9573
  doctorClient = new SogniClientWrapper({
9446
9574
  appSource: SOGNI_APP_SOURCE,
9447
9575
  appId: getOrCreateSogniAppId(),
9576
+ attribution: clientAttribution(AGENT_ATTRIBUTION),
9448
9577
  network: openclawConfig?.defaultNetwork || 'fast',
9449
9578
  autoConnect: false,
9450
9579
  apiKey: creds.SOGNI_API_KEY,
@@ -9987,6 +10116,7 @@ async function main() {
9987
10116
  client = new SogniClientWrapper({
9988
10117
  appSource: SOGNI_APP_SOURCE,
9989
10118
  appId: getOrCreateSogniAppId(),
10119
+ attribution: clientAttribution(AGENT_ATTRIBUTION),
9990
10120
  network: openclawConfig?.defaultNetwork || 'fast',
9991
10121
  autoConnect: false,
9992
10122
  apiKey: creds.SOGNI_API_KEY,
@@ -10634,10 +10764,19 @@ async function main() {
10634
10764
  numberOfMedia: options.count,
10635
10765
  width: options.width,
10636
10766
  height: options.height,
10637
- steps,
10638
- guidance,
10639
10767
  tokenType: options.tokenType || 'spark',
10640
- disableNSFWFilter: options.noFilter === true
10768
+ disableNSFWFilter: options.noFilter === true,
10769
+ ...buildImageEditExecutionControls(options.model, {
10770
+ steps,
10771
+ guidance,
10772
+ sampler: options.sampler || modelDefaults?.sampler,
10773
+ scheduler: options.scheduler || modelDefaults?.scheduler
10774
+ }, {
10775
+ steps: cliSet.steps ? options.steps : undefined,
10776
+ guidance: cliSet.guidance ? options.guidance : undefined,
10777
+ sampler: cliSet.sampler ? options.sampler : undefined,
10778
+ scheduler: cliSet.scheduler ? options.scheduler : undefined
10779
+ })
10641
10780
  };
10642
10781
 
10643
10782
  if (options.outputFormat) {
@@ -10646,12 +10785,6 @@ async function main() {
10646
10785
  if (gptImageQuality) {
10647
10786
  editConfig.gptImageQuality = gptImageQuality;
10648
10787
  }
10649
- if (options.sampler || modelDefaults?.sampler) {
10650
- editConfig.sampler = options.sampler || modelDefaults.sampler;
10651
- }
10652
- if (options.scheduler || modelDefaults?.scheduler) {
10653
- editConfig.scheduler = options.scheduler || modelDefaults.scheduler;
10654
- }
10655
10788
  if (options.loras.length > 0) {
10656
10789
  editConfig.loras = options.loras;
10657
10790
  }
@@ -10951,6 +11084,7 @@ async function main() {
10951
11084
  const client2 = new SogniClientWrapper({
10952
11085
  appSource: SOGNI_APP_SOURCE,
10953
11086
  appId: getOrCreateSogniAppId(),
11087
+ attribution: clientAttribution(AGENT_ATTRIBUTION),
10954
11088
  network: openclawConfig?.defaultNetwork || 'fast',
10955
11089
  autoConnect: false,
10956
11090
  apiKey: creds.SOGNI_API_KEY,