@sogni-ai/sogni-creative-agent-skill 3.19.0 → 3.21.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/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/CHANGELOG.md +24 -0
- package/SKILL.md +2 -1
- package/attribution.mjs +258 -0
- package/desktop-extension/manifest.json +4 -2
- package/desktop-extension/server/index.mjs +18 -1
- package/desktop-extension/server/resolve.mjs +13 -1
- package/host-launchers/claude-code.mjs +4 -0
- package/host-launchers/codex.mjs +4 -0
- package/host-launchers/hermes.mjs +4 -0
- package/openclaw.plugin.json +1 -1
- package/package.json +9 -4
- package/plugin-skills/loop-maker/SKILL.md +3 -0
- package/plugin-skills/sogni-creative-agent/SKILL.md +5 -0
- package/references/models.md +15 -0
- package/skill-package.json +1 -1
- package/skills/loop-maker/SKILL.md +3 -0
- package/skills/sogni-creative-agent/SKILL.md +3 -0
- package/sogni-agent.mjs +115 -24
- package/sogni-hosted-client.mjs +39 -9
- package/version.mjs +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sogni-creative-agent",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.21.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",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
# [3.21.0](https://github.com/Sogni-AI/sogni-creative-agent-skill/compare/v3.20.0...v3.21.0) (2026-07-31)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **telemetry:** identify Codex, Claude Code, Claude Desktop, Hermes Agent, and OpenClaw through fixed host markers and allowlisted MCP client metadata; attach privacy-safe framework, surface, workload, and semantic operation lineage to Sogni-owned requests without sending prompts, user paths, credentials, or headers to presigned uploads
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Dependencies
|
|
10
|
+
|
|
11
|
+
* use `@sogni-ai/sogni-intelligence-client` 3.10.0 and `@sogni-ai/sogni-client` 5.3.0 for the published attribution contract
|
|
12
|
+
|
|
13
|
+
# [3.20.0](https://github.com/Sogni-AI/sogni-creative-agent-skill/compare/v3.19.0...v3.20.0) (2026-07-29)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* **deps:** use `@sogni-ai/sogni-intelligence-client` 3.9.0
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
* **images:** support Krea LoRA stacks
|
|
24
|
+
|
|
1
25
|
# [3.19.0](https://github.com/Sogni-AI/sogni-creative-agent-skill/compare/v3.18.1...v3.19.0) (2026-07-28)
|
|
2
26
|
|
|
3
27
|
|
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.
|
|
5
|
+
version: "3.21.0"
|
|
6
6
|
homepage: https://sogni.ai
|
|
7
7
|
openclaw:
|
|
8
8
|
emoji: "🎨"
|
|
@@ -226,6 +226,7 @@ sogni-agent -c photo.jpg -m qwen_image_edit_2511_fp8 "turn this into anime style
|
|
|
226
226
|
```
|
|
227
227
|
|
|
228
228
|
- For identity-preserving Krea edits, use `-m krea2_identity_edit_v1_2` with 1-2 context images; use `-m dark_beast_krea2_identity_edit_v1_2` for the Dark Beast Krea 2 identity edit LoRA. Both use 512-2048 px output, 8-12 steps, guidance 1, and default to 10 steps.
|
|
229
|
+
- For Krea 2 style/control LoRAs, use the base text-to-image model `-m krea2_turbo_fp8_scaled` with repeatable ordered `--lora <id> --lora-strength <n>` arguments (or comma-separated `--loras` / `--lora-strengths`). Up to 8 LoRAs may be stacked. Order matters, strengths are positional, omitted strengths default to 1, and many Krea 2 LoRAs are bipolar sliders whose negative values apply the inverse effect. Do not clamp them to 0-2. The first use of an uncached LoRA may pause while the worker downloads it.
|
|
229
230
|
- Do not route to `--photobooth` merely because the user asks to preserve a face in a style edit — face-preserving full-image edits use `-c` with an image edit model. When context images are provided without `-m`, the CLI defaults to `qwen_image_edit_2511_fp8_lightning`; select `-m gpt-image-2` for up to 16 reference images and OpenAI-backed editing (Qwen supports up to 3; Krea identity edit supports up to 2).
|
|
230
231
|
|
|
231
232
|
### LTX video prompts
|
package/attribution.mjs
ADDED
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { PACKAGE_VERSION } from './version.mjs';
|
|
3
|
+
|
|
4
|
+
export const SOGNI_APP_SOURCE = 'sogni-creative-agent-skill';
|
|
5
|
+
|
|
6
|
+
const FRAMEWORK_ALIASES = new Map([
|
|
7
|
+
['codex', 'codex'],
|
|
8
|
+
['codex-cli', 'codex'],
|
|
9
|
+
['openai-codex', 'codex'],
|
|
10
|
+
['claude-code', 'claude-code'],
|
|
11
|
+
['claude-desktop', 'claude-desktop'],
|
|
12
|
+
['claude-ai', 'claude-desktop'],
|
|
13
|
+
['hermes', 'hermes-agent'],
|
|
14
|
+
['hermes-agent', 'hermes-agent'],
|
|
15
|
+
['openclaw', 'openclaw'],
|
|
16
|
+
['clawdbot', 'openclaw'],
|
|
17
|
+
]);
|
|
18
|
+
|
|
19
|
+
const SURFACES = new Set([
|
|
20
|
+
'plugin',
|
|
21
|
+
'personal_skill',
|
|
22
|
+
'mcp',
|
|
23
|
+
'cli',
|
|
24
|
+
]);
|
|
25
|
+
|
|
26
|
+
const EXECUTION_MODES = new Set(['browser', 'durable', 'server', 'unknown']);
|
|
27
|
+
// Keep this identical to the SDK/socket/API contract so accepted producer
|
|
28
|
+
// values are not silently discarded downstream.
|
|
29
|
+
const VERSION_PATTERN = /^[0-9][0-9A-Za-z._+-]{0,31}$/;
|
|
30
|
+
const OPERATION_ID_PATTERN = /^[0-9A-Za-z][0-9A-Za-z._:-]{0,127}$/;
|
|
31
|
+
|
|
32
|
+
function slug(value) {
|
|
33
|
+
return String(value ?? '')
|
|
34
|
+
.trim()
|
|
35
|
+
.toLowerCase()
|
|
36
|
+
.replace(/[\s_]+/g, '-')
|
|
37
|
+
.replace(/-+/g, '-');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function boundedVersion(value) {
|
|
41
|
+
const normalized = String(value ?? '').trim();
|
|
42
|
+
return VERSION_PATTERN.test(normalized) ? normalized : undefined;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function operationId(value) {
|
|
46
|
+
const normalized = String(value ?? '').trim();
|
|
47
|
+
return OPERATION_ID_PATTERN.test(normalized) ? normalized : undefined;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function normalizeAgentFramework(value) {
|
|
51
|
+
return FRAMEWORK_ALIASES.get(slug(value)) ?? 'unknown';
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function normalizeAgentSurface(value) {
|
|
55
|
+
const normalized = String(value ?? '').trim().toLowerCase().replace(/-/g, '_');
|
|
56
|
+
return SURFACES.has(normalized) ? normalized : undefined;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function resolveAgentAttribution({
|
|
60
|
+
env = process.env,
|
|
61
|
+
surfaceVersion = PACKAGE_VERSION,
|
|
62
|
+
} = {}) {
|
|
63
|
+
const declaredFramework = normalizeAgentFramework(env.SOGNI_AGENT_FRAMEWORK);
|
|
64
|
+
const openClawInvocation = typeof env.OPENCLAW_PLUGIN_CONFIG === 'string'
|
|
65
|
+
&& env.OPENCLAW_PLUGIN_CONFIG.length > 0;
|
|
66
|
+
const hasDeclaredFramework = declaredFramework !== 'unknown';
|
|
67
|
+
const agentFramework = hasDeclaredFramework
|
|
68
|
+
? declaredFramework
|
|
69
|
+
: openClawInvocation
|
|
70
|
+
? 'openclaw'
|
|
71
|
+
: 'unknown';
|
|
72
|
+
const declaredSurface = normalizeAgentSurface(env.SOGNI_AGENT_SURFACE);
|
|
73
|
+
const agentSurface = declaredSurface ?? (openClawInvocation ? 'plugin' : 'cli');
|
|
74
|
+
const agentFrameworkVersion = agentFramework === 'unknown'
|
|
75
|
+
? undefined
|
|
76
|
+
: boundedVersion(env.SOGNI_AGENT_FRAMEWORK_VERSION);
|
|
77
|
+
const executionMode = EXECUTION_MODES.has(String(env.SOGNI_AGENT_EXECUTION_MODE ?? '').trim())
|
|
78
|
+
? String(env.SOGNI_AGENT_EXECUTION_MODE).trim()
|
|
79
|
+
: undefined;
|
|
80
|
+
|
|
81
|
+
return Object.freeze({
|
|
82
|
+
appSource: SOGNI_APP_SOURCE,
|
|
83
|
+
interactionKind: 'external_agent',
|
|
84
|
+
workloadKind: 'agent_mediated',
|
|
85
|
+
agentFramework,
|
|
86
|
+
agentFrameworkVersion,
|
|
87
|
+
agentSurface,
|
|
88
|
+
agentSurfaceVersion: boundedVersion(env.SOGNI_AGENT_SURFACE_VERSION)
|
|
89
|
+
?? boundedVersion(surfaceVersion)
|
|
90
|
+
?? undefined,
|
|
91
|
+
executionMode,
|
|
92
|
+
attributionMethod: hasDeclaredFramework || declaredSurface || openClawInvocation
|
|
93
|
+
? 'wrapper_declared'
|
|
94
|
+
: 'known_source',
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export function normalizeMcpClientInfo(clientInfo, {
|
|
99
|
+
fallback = resolveAgentAttribution(),
|
|
100
|
+
surfaceVersion = PACKAGE_VERSION,
|
|
101
|
+
} = {}) {
|
|
102
|
+
const framework = normalizeAgentFramework(clientInfo?.name);
|
|
103
|
+
const useFallback = framework === 'unknown' && fallback?.agentFramework !== 'unknown';
|
|
104
|
+
return Object.freeze({
|
|
105
|
+
...fallback,
|
|
106
|
+
agentFramework: useFallback ? fallback.agentFramework : framework,
|
|
107
|
+
agentFrameworkVersion: framework === 'unknown'
|
|
108
|
+
? (useFallback ? fallback.agentFrameworkVersion : undefined)
|
|
109
|
+
: boundedVersion(clientInfo?.version),
|
|
110
|
+
agentSurface: 'mcp',
|
|
111
|
+
agentSurfaceVersion: boundedVersion(surfaceVersion),
|
|
112
|
+
attributionMethod: framework === 'unknown' && !useFallback
|
|
113
|
+
? 'known_source'
|
|
114
|
+
: 'wrapper_declared',
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export function attributionEnvironment(attribution) {
|
|
119
|
+
return {
|
|
120
|
+
SOGNI_AGENT_FRAMEWORK: attribution.agentFramework,
|
|
121
|
+
SOGNI_AGENT_SURFACE: attribution.agentSurface,
|
|
122
|
+
SOGNI_AGENT_SURFACE_VERSION: attribution.agentSurfaceVersion,
|
|
123
|
+
SOGNI_AGENT_FRAMEWORK_VERSION: attribution.agentFrameworkVersion,
|
|
124
|
+
SOGNI_AGENT_EXECUTION_MODE: attribution.executionMode,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export function connectionAttribution(attribution) {
|
|
129
|
+
return {
|
|
130
|
+
interactionKind: attribution.interactionKind,
|
|
131
|
+
agentFramework: attribution.agentFramework,
|
|
132
|
+
...(attribution.agentFrameworkVersion
|
|
133
|
+
? { agentFrameworkVersion: attribution.agentFrameworkVersion }
|
|
134
|
+
: {}),
|
|
135
|
+
agentSurface: attribution.agentSurface,
|
|
136
|
+
...(attribution.agentSurfaceVersion
|
|
137
|
+
? { agentSurfaceVersion: attribution.agentSurfaceVersion }
|
|
138
|
+
: {}),
|
|
139
|
+
...(attribution.executionMode ? { executionMode: attribution.executionMode } : {}),
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export function workloadAttributionDefaults(attribution) {
|
|
144
|
+
return {
|
|
145
|
+
workloadKind: attribution.workloadKind,
|
|
146
|
+
agentFramework: attribution.agentFramework,
|
|
147
|
+
...(attribution.agentFrameworkVersion
|
|
148
|
+
? { agentFrameworkVersion: attribution.agentFrameworkVersion }
|
|
149
|
+
: {}),
|
|
150
|
+
agentSurface: attribution.agentSurface,
|
|
151
|
+
...(attribution.agentSurfaceVersion
|
|
152
|
+
? { agentSurfaceVersion: attribution.agentSurfaceVersion }
|
|
153
|
+
: {}),
|
|
154
|
+
...(attribution.executionMode ? { executionMode: attribution.executionMode } : {}),
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export function clientAttribution(attribution) {
|
|
159
|
+
return {
|
|
160
|
+
connection: connectionAttribution(attribution),
|
|
161
|
+
workload: workloadAttributionDefaults(attribution),
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function generatedOperationId() {
|
|
166
|
+
return `op_${randomUUID()}`;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export function createInvocationLineage({
|
|
170
|
+
env = process.env,
|
|
171
|
+
generateOperationId = generatedOperationId,
|
|
172
|
+
} = {}) {
|
|
173
|
+
const declaredScope = env.SOGNI_AGENT_OPERATION_SCOPE === 'child' ? 'child' : 'top_level';
|
|
174
|
+
const declaredRoot = operationId(env.SOGNI_AGENT_ROOT_OPERATION_ID);
|
|
175
|
+
const rootOperationId = declaredRoot ?? operationId(env.SOGNI_AGENT_OPERATION_ID)
|
|
176
|
+
?? generateOperationId();
|
|
177
|
+
const declaredOperation = operationId(env.SOGNI_AGENT_OPERATION_ID);
|
|
178
|
+
const declaredParent = operationId(env.SOGNI_AGENT_PARENT_OPERATION_ID);
|
|
179
|
+
let topLevelIssued = declaredScope === 'child';
|
|
180
|
+
let firstIssued = false;
|
|
181
|
+
let lastOperationId = declaredParent ?? rootOperationId;
|
|
182
|
+
|
|
183
|
+
return {
|
|
184
|
+
rootOperationId,
|
|
185
|
+
next({ scope = 'auto', parentOperationId } = {}) {
|
|
186
|
+
// A command invoked as a child cannot promote one of its internal calls
|
|
187
|
+
// into a second top-level workload, even if that code path normally owns
|
|
188
|
+
// the root when the CLI runs standalone.
|
|
189
|
+
const resolvedScope = declaredScope === 'child'
|
|
190
|
+
? 'child'
|
|
191
|
+
: scope === 'top_level' || scope === 'child'
|
|
192
|
+
? scope
|
|
193
|
+
: (!topLevelIssued ? 'top_level' : 'child');
|
|
194
|
+
let nextOperationId;
|
|
195
|
+
if (!firstIssued && declaredOperation) {
|
|
196
|
+
nextOperationId = declaredOperation;
|
|
197
|
+
} else if (resolvedScope === 'top_level' && !topLevelIssued) {
|
|
198
|
+
nextOperationId = rootOperationId;
|
|
199
|
+
} else {
|
|
200
|
+
nextOperationId = generateOperationId();
|
|
201
|
+
}
|
|
202
|
+
const resolvedParent = resolvedScope === 'child'
|
|
203
|
+
? operationId(parentOperationId)
|
|
204
|
+
?? (!firstIssued ? declaredParent : undefined)
|
|
205
|
+
?? lastOperationId
|
|
206
|
+
?? rootOperationId
|
|
207
|
+
: undefined;
|
|
208
|
+
firstIssued = true;
|
|
209
|
+
if (resolvedScope === 'top_level') topLevelIssued = true;
|
|
210
|
+
lastOperationId = nextOperationId;
|
|
211
|
+
return {
|
|
212
|
+
operationScope: resolvedScope,
|
|
213
|
+
operationId: nextOperationId,
|
|
214
|
+
rootOperationId,
|
|
215
|
+
...(resolvedParent ? { parentOperationId: resolvedParent } : {}),
|
|
216
|
+
};
|
|
217
|
+
},
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export function semanticWorkloadAttribution(attribution, lineage) {
|
|
222
|
+
return {
|
|
223
|
+
...workloadAttributionDefaults(attribution),
|
|
224
|
+
...lineage,
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export function attributionHeaders(attribution, workload) {
|
|
229
|
+
const headers = {
|
|
230
|
+
'X-App-Source': attribution.appSource,
|
|
231
|
+
'X-Sogni-Interaction-Kind': attribution.interactionKind,
|
|
232
|
+
'X-Sogni-Workload-Kind': workload?.workloadKind ?? attribution.workloadKind,
|
|
233
|
+
'X-Sogni-Agent-Framework': attribution.agentFramework,
|
|
234
|
+
'X-Sogni-Agent-Surface': attribution.agentSurface,
|
|
235
|
+
};
|
|
236
|
+
if (attribution.agentFrameworkVersion) {
|
|
237
|
+
headers['X-Sogni-Agent-Framework-Version'] = attribution.agentFrameworkVersion;
|
|
238
|
+
}
|
|
239
|
+
if (attribution.agentSurfaceVersion) {
|
|
240
|
+
headers['X-Sogni-Agent-Surface-Version'] = attribution.agentSurfaceVersion;
|
|
241
|
+
}
|
|
242
|
+
if (attribution.executionMode) {
|
|
243
|
+
headers['X-Sogni-Execution-Mode'] = attribution.executionMode;
|
|
244
|
+
}
|
|
245
|
+
if (workload?.operationScope) {
|
|
246
|
+
headers['X-Sogni-Operation-Scope'] = workload.operationScope;
|
|
247
|
+
}
|
|
248
|
+
if (workload?.operationId) {
|
|
249
|
+
headers['X-Sogni-Operation-Id'] = workload.operationId;
|
|
250
|
+
}
|
|
251
|
+
if (workload?.rootOperationId) {
|
|
252
|
+
headers['X-Sogni-Root-Operation-Id'] = workload.rootOperationId;
|
|
253
|
+
}
|
|
254
|
+
if (workload?.parentOperationId) {
|
|
255
|
+
headers['X-Sogni-Parent-Operation-Id'] = workload.parentOperationId;
|
|
256
|
+
}
|
|
257
|
+
return headers;
|
|
258
|
+
}
|
|
@@ -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.21.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",
|
|
@@ -13,7 +13,9 @@
|
|
|
13
13
|
"command": "node",
|
|
14
14
|
"args": ["${__dirname}/server/index.mjs"],
|
|
15
15
|
"env": {
|
|
16
|
-
"SOGNI_API_KEY": "${user_config.api_key}"
|
|
16
|
+
"SOGNI_API_KEY": "${user_config.api_key}",
|
|
17
|
+
"SOGNI_AGENT_FRAMEWORK": "claude-desktop",
|
|
18
|
+
"SOGNI_AGENT_SURFACE": "mcp"
|
|
17
19
|
}
|
|
18
20
|
}
|
|
19
21
|
},
|
|
@@ -12,6 +12,11 @@ import { TOOLS, getTool } from './tools.mjs';
|
|
|
12
12
|
import { buildChildEnv, resolveAgentPath, resolveFfmpegPath } from './resolve.mjs';
|
|
13
13
|
import { collectInlineImages } from './inline-images.mjs';
|
|
14
14
|
import { runImportMedia } from './import-media.mjs';
|
|
15
|
+
import {
|
|
16
|
+
attributionEnvironment,
|
|
17
|
+
normalizeMcpClientInfo,
|
|
18
|
+
resolveAgentAttribution,
|
|
19
|
+
} from '../../attribution.mjs';
|
|
15
20
|
|
|
16
21
|
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
17
22
|
const PROTOCOL_FALLBACK = '2025-06-18';
|
|
@@ -25,6 +30,10 @@ try {
|
|
|
25
30
|
} catch {
|
|
26
31
|
// Running outside a packaged layout (e.g. unit tests before Task 4); harmless.
|
|
27
32
|
}
|
|
33
|
+
let mcpAttributionEnv = attributionEnvironment(normalizeMcpClientInfo(undefined, {
|
|
34
|
+
fallback: resolveAgentAttribution({ surfaceVersion: VERSION }),
|
|
35
|
+
surfaceVersion: VERSION,
|
|
36
|
+
}));
|
|
28
37
|
|
|
29
38
|
function send(msg) {
|
|
30
39
|
process.stdout.write(JSON.stringify(msg) + '\n');
|
|
@@ -65,7 +74,11 @@ async function callTool(name, input, progressToken) {
|
|
|
65
74
|
return textResult(err.message, true);
|
|
66
75
|
}
|
|
67
76
|
|
|
68
|
-
const env = buildChildEnv({
|
|
77
|
+
const env = buildChildEnv({
|
|
78
|
+
agentPath,
|
|
79
|
+
ffmpegPath: resolveFfmpegPath(),
|
|
80
|
+
attributionEnv: mcpAttributionEnv,
|
|
81
|
+
});
|
|
69
82
|
|
|
70
83
|
return await new Promise((resolve) => {
|
|
71
84
|
const child = spawn(process.execPath, [agentPath, ...args], {
|
|
@@ -129,6 +142,10 @@ async function dispatch(msg) {
|
|
|
129
142
|
const isRequest = id !== undefined && id !== null;
|
|
130
143
|
|
|
131
144
|
if (method === 'initialize') {
|
|
145
|
+
mcpAttributionEnv = attributionEnvironment(normalizeMcpClientInfo(params?.clientInfo, {
|
|
146
|
+
fallback: resolveAgentAttribution({ surfaceVersion: VERSION }),
|
|
147
|
+
surfaceVersion: VERSION,
|
|
148
|
+
}));
|
|
132
149
|
send({
|
|
133
150
|
jsonrpc: '2.0',
|
|
134
151
|
id,
|
|
@@ -49,7 +49,12 @@ export function resolveFfmpegPath({ env = process.env } = {}) {
|
|
|
49
49
|
return candidates.find((p) => existsSync(p)) ?? null;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
export function buildChildEnv({
|
|
52
|
+
export function buildChildEnv({
|
|
53
|
+
env = process.env,
|
|
54
|
+
agentPath,
|
|
55
|
+
ffmpegPath = null,
|
|
56
|
+
attributionEnv = {},
|
|
57
|
+
} = {}) {
|
|
53
58
|
const extraBins = ['/opt/homebrew/bin', '/usr/local/bin'];
|
|
54
59
|
if (agentPath) extraBins.push(dirname(agentPath));
|
|
55
60
|
const child = {
|
|
@@ -57,6 +62,13 @@ export function buildChildEnv({ env = process.env, agentPath, ffmpegPath = null
|
|
|
57
62
|
PATH: [...extraBins, env.PATH ?? ''].filter(Boolean).join(delimiter),
|
|
58
63
|
};
|
|
59
64
|
if (ffmpegPath) child.FFMPEG_PATH = ffmpegPath;
|
|
65
|
+
for (const [name, value] of Object.entries(attributionEnv)) {
|
|
66
|
+
if (typeof value === 'string' && value.length > 0) {
|
|
67
|
+
child[name] = value;
|
|
68
|
+
} else {
|
|
69
|
+
delete child[name];
|
|
70
|
+
}
|
|
71
|
+
}
|
|
60
72
|
// The .mcpb user_config template injects "" when the API-key field is left
|
|
61
73
|
// blank; an empty env var would shadow ~/.config/sogni/credentials.
|
|
62
74
|
if (child.SOGNI_API_KEY === '') delete child.SOGNI_API_KEY;
|
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.21.0",
|
|
6
6
|
"skills": [
|
|
7
7
|
"."
|
|
8
8
|
],
|
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sogni-ai/sogni-creative-agent-skill",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.21.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",
|
|
7
7
|
"bin": {
|
|
8
|
-
"sogni-agent": "sogni-agent.mjs"
|
|
8
|
+
"sogni-agent": "sogni-agent.mjs",
|
|
9
|
+
"sogni-agent-codex": "host-launchers/codex.mjs",
|
|
10
|
+
"sogni-agent-claude-code": "host-launchers/claude-code.mjs",
|
|
11
|
+
"sogni-agent-hermes": "host-launchers/hermes.mjs"
|
|
9
12
|
},
|
|
10
13
|
"scripts": {
|
|
11
14
|
"openclaw:sync": "node scripts/sync-openclaw-plugin.mjs",
|
|
@@ -68,6 +71,7 @@
|
|
|
68
71
|
"skills/",
|
|
69
72
|
"llm.txt",
|
|
70
73
|
"skill-package.json",
|
|
74
|
+
"host-launchers/",
|
|
71
75
|
"scripts/sync-version.mjs",
|
|
72
76
|
"scripts/check-version-sync.mjs",
|
|
73
77
|
"scripts/check-creative-agent-runtime.mjs",
|
|
@@ -78,6 +82,7 @@
|
|
|
78
82
|
"openclaw-plugin.mjs",
|
|
79
83
|
"openclaw.plugin.json",
|
|
80
84
|
"env.mjs",
|
|
85
|
+
"attribution.mjs",
|
|
81
86
|
"ssrf-guard.mjs",
|
|
82
87
|
"sogni-app-id.mjs",
|
|
83
88
|
"sogni-hosted-client.mjs",
|
|
@@ -87,13 +92,13 @@
|
|
|
87
92
|
"sogni-agent.mjs"
|
|
88
93
|
],
|
|
89
94
|
"dependencies": {
|
|
90
|
-
"@sogni-ai/sogni-intelligence-client": "3.
|
|
95
|
+
"@sogni-ai/sogni-intelligence-client": "3.10.0",
|
|
91
96
|
"execa": "^9.6.1",
|
|
92
97
|
"json5": "^2.2.3",
|
|
93
98
|
"sharp": "^0.34.5"
|
|
94
99
|
},
|
|
95
100
|
"overrides": {
|
|
96
|
-
"@sogni-ai/sogni-client": "5.
|
|
101
|
+
"@sogni-ai/sogni-client": "5.3.0"
|
|
97
102
|
},
|
|
98
103
|
"openclaw": {
|
|
99
104
|
"extensions": [
|
|
@@ -7,6 +7,9 @@ description: Turn a folder of images into a polished, music-backed seamless loop
|
|
|
7
7
|
|
|
8
8
|
Create the image-folder loop described in the user's current request. Treat text after the explicit skill invocation as its arguments when the host provides them.
|
|
9
9
|
|
|
10
|
+
When running this Claude Code plugin, invoke `sogni-agent-claude-code` wherever
|
|
11
|
+
the root skill or loop workflow says `sogni-agent`.
|
|
12
|
+
|
|
10
13
|
1. Resolve the plugin root as two directories above this `SKILL.md`. Read the root `SKILL.md` completely. A host-provided plugin-root variable may be used, but do not depend on one.
|
|
11
14
|
2. Read `references/loop-maker.md` under that plugin root completely and follow it as the canonical workflow.
|
|
12
15
|
3. Treat the first folder path in the arguments as the source. Treat remaining text as optional preferences such as the opening image, music direction, output name, pacing, aspect ratio, compositor effects, or cleanup request.
|
|
@@ -7,6 +7,11 @@ description: "Sogni Creative Agent: image, video, and music generation using Sog
|
|
|
7
7
|
|
|
8
8
|
Generate **images, videos, and music** via Sogni AI's decentralized GPU network through the `sogni-agent` CLI shipped with this plugin.
|
|
9
9
|
|
|
10
|
+
**Claude Code plugin command:** invoke `sogni-agent-claude-code` for every
|
|
11
|
+
Sogni command in this skill. Wherever this file or a referenced root guide says
|
|
12
|
+
`sogni-agent`, substitute `sogni-agent-claude-code`. This fixed launcher
|
|
13
|
+
preserves normal CLI behavior while attributing the request to Claude Code.
|
|
14
|
+
|
|
10
15
|
## Setup
|
|
11
16
|
|
|
12
17
|
1. Install the CLI (one-time): `npm install -g @sogni-ai/sogni-creative-agent-skill@latest`.
|
package/references/models.md
CHANGED
|
@@ -67,6 +67,21 @@ For Krea 2 Turbo, hosted/chat planning may use the creative-agent selector
|
|
|
67
67
|
`krea-2-turbo`; direct CLI `-m` uses the worker model ID
|
|
68
68
|
`krea2_turbo_fp8_scaled`.
|
|
69
69
|
|
|
70
|
+
Krea 2 Turbo supports ordered LoRA stacks:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
sogni-agent -m krea2_turbo_fp8_scaled \
|
|
74
|
+
--lora krea2-detail-enhancer --lora-strength 3 \
|
|
75
|
+
--lora krea2-amateur --lora-strength -2 \
|
|
76
|
+
"candid editorial street portrait at dusk"
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Use no more than 8 LoRAs. `loraStrengths[i]` controls `loras[i]`, and changing
|
|
80
|
+
the order can change the result. Omitted strengths default to 1. Many Krea 2
|
|
81
|
+
LoRAs are bipolar sliders, so negative values are valid and apply the inverse
|
|
82
|
+
effect. Follow the range documented for each LoRA rather than assuming 0-2.
|
|
83
|
+
The first render with an uncached LoRA can take longer while its asset downloads.
|
|
84
|
+
|
|
70
85
|
For identity-preserving Krea edits, pass a context image with
|
|
71
86
|
`-m krea2_identity_edit_v1_2` or
|
|
72
87
|
`-m dark_beast_krea2_identity_edit_v1_2`. These edit models support 1-2
|
package/skill-package.json
CHANGED
|
@@ -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,
|
|
@@ -282,9 +290,10 @@ const DEFAULT_SAFE_API_HOSTS = Object.freeze(['api.sogni.ai']);
|
|
|
282
290
|
const LOOPBACK_API_HOSTS = Object.freeze(['localhost', '127.0.0.1', '::1']);
|
|
283
291
|
const DEFAULT_LLM_MODEL = 'qwen3.6-35b-a3b-gguf-iq4xs';
|
|
284
292
|
const VALID_API_TASK_PROFILES = new Set(['general', 'coding', 'reasoning']);
|
|
285
|
-
const SOGNI_APP_SOURCE = 'sogni-creative-agent-skill';
|
|
286
293
|
const OPENCLAW_CONFIG_PATH = getEnv('OPENCLAW_CONFIG_PATH') || DEFAULT_OPENCLAW_CONFIG_PATH;
|
|
287
294
|
const IS_OPENCLAW_INVOCATION = Boolean(getEnv('OPENCLAW_PLUGIN_CONFIG'));
|
|
295
|
+
const AGENT_ATTRIBUTION = resolveAgentAttribution({ surfaceVersion: PACKAGE_VERSION });
|
|
296
|
+
const INVOCATION_LINEAGE = createInvocationLineage();
|
|
288
297
|
const RAW_ARGS = process.argv.slice(2);
|
|
289
298
|
const CLI_WANTS_JSON = RAW_ARGS.includes('--json');
|
|
290
299
|
const JSON_ERROR_MODE = CLI_WANTS_JSON || IS_OPENCLAW_INVOCATION;
|
|
@@ -1495,9 +1504,16 @@ function requiresSparkOnlyToken(modelId) {
|
|
|
1495
1504
|
// Attach the user's explicit --billing-mode to a project config. Omitted by
|
|
1496
1505
|
// default so the server keeps deciding coverage (Unlimited members get 'auto'
|
|
1497
1506
|
// coverage server-side; token payers are unaffected).
|
|
1498
|
-
function
|
|
1499
|
-
|
|
1500
|
-
|
|
1507
|
+
function nextSemanticWorkloadAttribution(options = {}) {
|
|
1508
|
+
return semanticWorkloadAttribution(AGENT_ATTRIBUTION, INVOCATION_LINEAGE.next(options));
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
function withBillingMode(config, attributionOptions = {}) {
|
|
1512
|
+
return {
|
|
1513
|
+
...config,
|
|
1514
|
+
...(options.billingMode ? { billingMode: options.billingMode } : {}),
|
|
1515
|
+
attribution: nextSemanticWorkloadAttribution(attributionOptions),
|
|
1516
|
+
};
|
|
1501
1517
|
}
|
|
1502
1518
|
|
|
1503
1519
|
// Best-effort Sogni Unlimited entitlement lookup. Returns null (never throws)
|
|
@@ -3211,7 +3227,7 @@ Image Options:
|
|
|
3211
3227
|
--output-format <f> Image output format: png|jpg (webp for gpt-image-2)
|
|
3212
3228
|
--sampler <name> Sampler (model-dependent)
|
|
3213
3229
|
--scheduler <name> Scheduler (model-dependent)
|
|
3214
|
-
--lora <id> LoRA id (repeatable
|
|
3230
|
+
--lora <id> Image LoRA id (repeatable; order is significant)
|
|
3215
3231
|
--loras <ids> Comma-separated LoRA ids
|
|
3216
3232
|
--lora-strength <n> LoRA strength (repeatable)
|
|
3217
3233
|
--lora-strengths <n> Comma-separated LoRA strengths
|
|
@@ -3874,6 +3890,13 @@ if (options.loraStrengths.length > 0 && options.loras.length > 0 &&
|
|
|
3874
3890
|
});
|
|
3875
3891
|
}
|
|
3876
3892
|
|
|
3893
|
+
if (!options.video && options.loras.length > 8) {
|
|
3894
|
+
fatalCliError('Image generation supports at most 8 LoRAs per render.', {
|
|
3895
|
+
code: 'INVALID_ARGUMENT',
|
|
3896
|
+
details: { loras: options.loras.length, maximum: 8 }
|
|
3897
|
+
});
|
|
3898
|
+
}
|
|
3899
|
+
|
|
3877
3900
|
if (options.music && options.loras.length > 0) {
|
|
3878
3901
|
fatalCliError('--lora options are not supported for music.', { code: 'INVALID_ARGUMENT' });
|
|
3879
3902
|
}
|
|
@@ -4950,12 +4973,13 @@ function requireApiKeyCredentials(creds, modeLabel) {
|
|
|
4950
4973
|
throw err;
|
|
4951
4974
|
}
|
|
4952
4975
|
|
|
4953
|
-
function apiRequestHeaders(apiKey, extra = {}) {
|
|
4976
|
+
function apiRequestHeaders(apiKey, extra = {}, workloadAttribution = undefined) {
|
|
4954
4977
|
return {
|
|
4955
4978
|
'Content-Type': 'application/json',
|
|
4956
4979
|
Authorization: `Bearer ${apiKey}`,
|
|
4957
4980
|
'api-key': apiKey,
|
|
4958
|
-
...extra
|
|
4981
|
+
...extra,
|
|
4982
|
+
...attributionHeaders(AGENT_ATTRIBUTION, workloadAttribution),
|
|
4959
4983
|
};
|
|
4960
4984
|
}
|
|
4961
4985
|
|
|
@@ -4996,6 +5020,7 @@ async function dispatchWorkflowActionViaSdk(action, apiKey, params) {
|
|
|
4996
5020
|
socketEndpoint: process.env.SOGNI_SOCKET_ENDPOINT || undefined,
|
|
4997
5021
|
appSource: SOGNI_APP_SOURCE,
|
|
4998
5022
|
appId: getOrCreateSogniAppId(),
|
|
5023
|
+
attribution: clientAttribution(AGENT_ATTRIBUTION),
|
|
4999
5024
|
},
|
|
5000
5025
|
async (client) => {
|
|
5001
5026
|
if (action === 'list') {
|
|
@@ -5029,6 +5054,7 @@ async function dispatchWorkflowActionViaSdk(action, apiKey, params) {
|
|
|
5029
5054
|
: {}),
|
|
5030
5055
|
...(params.confirmCost != null ? { confirmCost: params.confirmCost } : {}),
|
|
5031
5056
|
...(params.idempotencyKey ? { idempotencyKey: params.idempotencyKey } : {}),
|
|
5057
|
+
...(params.attribution ? { attribution: params.attribution } : {}),
|
|
5032
5058
|
},
|
|
5033
5059
|
{},
|
|
5034
5060
|
);
|
|
@@ -5057,7 +5083,7 @@ async function dispatchWorkflowActionViaSdk(action, apiKey, params) {
|
|
|
5057
5083
|
* Returns `null` when SDK transport is off so the caller falls back
|
|
5058
5084
|
* to `fetchApiJson`.
|
|
5059
5085
|
*/
|
|
5060
|
-
async function dispatchChatHostedViaSdk(apiKey, body) {
|
|
5086
|
+
async function dispatchChatHostedViaSdk(apiKey, body, workloadAttribution) {
|
|
5061
5087
|
let helpers;
|
|
5062
5088
|
try {
|
|
5063
5089
|
helpers = await import('./sogni-hosted-client.mjs');
|
|
@@ -5074,8 +5100,12 @@ async function dispatchChatHostedViaSdk(apiKey, body) {
|
|
|
5074
5100
|
socketEndpoint: process.env.SOGNI_SOCKET_ENDPOINT || undefined,
|
|
5075
5101
|
appSource: SOGNI_APP_SOURCE,
|
|
5076
5102
|
appId: getOrCreateSogniAppId(),
|
|
5103
|
+
attribution: clientAttribution(AGENT_ATTRIBUTION),
|
|
5077
5104
|
},
|
|
5078
|
-
async (client) => helpers.sdkChatHostedCreate(client,
|
|
5105
|
+
async (client) => helpers.sdkChatHostedCreate(client, {
|
|
5106
|
+
...body,
|
|
5107
|
+
...(workloadAttribution ? { attribution: workloadAttribution } : {}),
|
|
5108
|
+
}),
|
|
5079
5109
|
);
|
|
5080
5110
|
}
|
|
5081
5111
|
|
|
@@ -5117,6 +5147,7 @@ async function dispatchMediaReferenceUrlViaSdk({ ref, file, index, jobId, action
|
|
|
5117
5147
|
socketEndpoint: process.env.SOGNI_SOCKET_ENDPOINT || undefined,
|
|
5118
5148
|
appSource: SOGNI_APP_SOURCE,
|
|
5119
5149
|
appId: getOrCreateSogniAppId(),
|
|
5150
|
+
attribution: clientAttribution(AGENT_ATTRIBUTION),
|
|
5120
5151
|
},
|
|
5121
5152
|
async (client) => {
|
|
5122
5153
|
const type = apiMediaReferenceUploadType(ref, index);
|
|
@@ -5182,11 +5213,17 @@ async function fetchWithTimeout(resource, init = {}, timeoutMs = DEFAULT_HTTP_TI
|
|
|
5182
5213
|
}
|
|
5183
5214
|
}
|
|
5184
5215
|
|
|
5185
|
-
async function fetchApiJson(path, {
|
|
5216
|
+
async function fetchApiJson(path, {
|
|
5217
|
+
apiKey,
|
|
5218
|
+
method = 'GET',
|
|
5219
|
+
body = undefined,
|
|
5220
|
+
headers = {},
|
|
5221
|
+
workloadAttribution = undefined,
|
|
5222
|
+
} = {}) {
|
|
5186
5223
|
const url = await buildSafeApiUrl(path);
|
|
5187
5224
|
const init = {
|
|
5188
5225
|
method,
|
|
5189
|
-
headers: apiRequestHeaders(apiKey, headers),
|
|
5226
|
+
headers: apiRequestHeaders(apiKey, headers, workloadAttribution),
|
|
5190
5227
|
...(body === undefined ? {} : { body: JSON.stringify(body) })
|
|
5191
5228
|
};
|
|
5192
5229
|
|
|
@@ -5792,15 +5829,17 @@ async function runApiChat(log) {
|
|
|
5792
5829
|
...(options.noFilter === true ? { safeContentFilter: false } : {}),
|
|
5793
5830
|
...(apiMediaReferences.length > 0 ? { media_references: apiMediaReferences } : {})
|
|
5794
5831
|
};
|
|
5832
|
+
const workloadAttribution = nextSemanticWorkloadAttribution();
|
|
5795
5833
|
if (options.durableChat) {
|
|
5796
|
-
return runApiChatDurable(log, { apiKey, body });
|
|
5834
|
+
return runApiChatDurable(log, { apiKey, body, workloadAttribution });
|
|
5797
5835
|
}
|
|
5798
5836
|
const payload =
|
|
5799
|
-
(await dispatchChatHostedViaSdk(apiKey, body))
|
|
5837
|
+
(await dispatchChatHostedViaSdk(apiKey, body, workloadAttribution))
|
|
5800
5838
|
?? (await fetchApiJson('/v1/chat/completions', {
|
|
5801
5839
|
apiKey,
|
|
5802
5840
|
method: 'POST',
|
|
5803
|
-
body
|
|
5841
|
+
body,
|
|
5842
|
+
workloadAttribution,
|
|
5804
5843
|
}));
|
|
5805
5844
|
const message = extractChatMessage(payload);
|
|
5806
5845
|
const workflows = extractChatWorkflows(payload);
|
|
@@ -5850,7 +5889,7 @@ async function runApiChat(log) {
|
|
|
5850
5889
|
* installed) we fail with a clear error rather than silently falling
|
|
5851
5890
|
* back to the synchronous endpoint.
|
|
5852
5891
|
*/
|
|
5853
|
-
async function runApiChatDurable(log, { apiKey, body }) {
|
|
5892
|
+
async function runApiChatDurable(log, { apiKey, body, workloadAttribution }) {
|
|
5854
5893
|
let helpers;
|
|
5855
5894
|
try {
|
|
5856
5895
|
helpers = await import('./sogni-hosted-client.mjs');
|
|
@@ -5887,6 +5926,7 @@ async function runApiChatDurable(log, { apiKey, body }) {
|
|
|
5887
5926
|
...(typeof body.safeContentFilter === 'boolean'
|
|
5888
5927
|
? { runtimeConfig: { safeContentFilter: body.safeContentFilter } }
|
|
5889
5928
|
: {}),
|
|
5929
|
+
...(workloadAttribution ? { attribution: workloadAttribution } : {}),
|
|
5890
5930
|
};
|
|
5891
5931
|
|
|
5892
5932
|
const restEndpoint = await buildSafeApiUrl('/');
|
|
@@ -5905,6 +5945,7 @@ async function runApiChatDurable(log, { apiKey, body }) {
|
|
|
5905
5945
|
socketEndpoint: process.env.SOGNI_SOCKET_ENDPOINT || undefined,
|
|
5906
5946
|
appSource: SOGNI_APP_SOURCE,
|
|
5907
5947
|
appId: getOrCreateSogniAppId(),
|
|
5948
|
+
attribution: clientAttribution(AGENT_ATTRIBUTION),
|
|
5908
5949
|
},
|
|
5909
5950
|
async (client) => {
|
|
5910
5951
|
const created = await helpers.sdkChatRunsCreate(client, runParams);
|
|
@@ -6251,12 +6292,19 @@ async function generateStoryboardWorkflowStoryline(apiKey) {
|
|
|
6251
6292
|
sogni_tools: false,
|
|
6252
6293
|
sogni_tool_execution: false
|
|
6253
6294
|
};
|
|
6295
|
+
// Planning is internal compute for the workflow intent. Reserve the
|
|
6296
|
+
// invocation root for the workflow start so headline counts stay at one.
|
|
6297
|
+
const workloadAttribution = nextSemanticWorkloadAttribution({
|
|
6298
|
+
scope: 'child',
|
|
6299
|
+
parentOperationId: INVOCATION_LINEAGE.rootOperationId,
|
|
6300
|
+
});
|
|
6254
6301
|
const payload =
|
|
6255
|
-
(await dispatchChatHostedViaSdk(apiKey, body))
|
|
6302
|
+
(await dispatchChatHostedViaSdk(apiKey, body, workloadAttribution))
|
|
6256
6303
|
?? (await fetchApiJson('/v1/chat/completions', {
|
|
6257
6304
|
apiKey,
|
|
6258
6305
|
method: 'POST',
|
|
6259
|
-
body
|
|
6306
|
+
body,
|
|
6307
|
+
workloadAttribution,
|
|
6260
6308
|
}));
|
|
6261
6309
|
const message = extractChatMessage(payload);
|
|
6262
6310
|
const storyline = typeof message.content === 'string' ? message.content.trim() : '';
|
|
@@ -6975,6 +7023,7 @@ async function runApiWorkflow() {
|
|
|
6975
7023
|
input = buildGeneratedKeyframeVideoWorkflowInput();
|
|
6976
7024
|
}
|
|
6977
7025
|
|
|
7026
|
+
const workloadAttribution = nextSemanticWorkloadAttribution({ scope: 'top_level' });
|
|
6978
7027
|
payload =
|
|
6979
7028
|
(await dispatchWorkflowActionViaSdk('start', apiKey, {
|
|
6980
7029
|
input,
|
|
@@ -6983,6 +7032,7 @@ async function runApiWorkflow() {
|
|
|
6983
7032
|
maxEstimatedCapacityUnits: options.apiWorkflowMaxCost ?? undefined,
|
|
6984
7033
|
confirmCost: options.apiWorkflowConfirmCost ?? undefined,
|
|
6985
7034
|
idempotencyKey: options.apiWorkflowIdempotencyKey ?? undefined,
|
|
7035
|
+
attribution: workloadAttribution,
|
|
6986
7036
|
}))
|
|
6987
7037
|
?? (await fetchApiJson('/v1/creative-agent/workflows', {
|
|
6988
7038
|
apiKey,
|
|
@@ -6999,7 +7049,8 @@ async function runApiWorkflow() {
|
|
|
6999
7049
|
...(options.apiWorkflowConfirmCost !== null ? { confirm_cost: options.apiWorkflowConfirmCost } : {}),
|
|
7000
7050
|
token_type: tokenType,
|
|
7001
7051
|
app_source: SOGNI_APP_SOURCE
|
|
7002
|
-
}
|
|
7052
|
+
},
|
|
7053
|
+
workloadAttribution,
|
|
7003
7054
|
}));
|
|
7004
7055
|
const workflow = workflowFromPayload(payload);
|
|
7005
7056
|
const workflowId = workflow?.workflowId || workflow?.id;
|
|
@@ -7958,8 +8009,11 @@ function isNonEmptyFile(filePath) {
|
|
|
7958
8009
|
}
|
|
7959
8010
|
}
|
|
7960
8011
|
|
|
7961
|
-
async function runCommand(command, args, { captureOutput = false } = {}) {
|
|
7962
|
-
const options = {
|
|
8012
|
+
async function runCommand(command, args, { captureOutput = false, env = undefined } = {}) {
|
|
8013
|
+
const options = {
|
|
8014
|
+
reject: false,
|
|
8015
|
+
...(env ? { env: { ...process.env, ...env } } : {}),
|
|
8016
|
+
};
|
|
7963
8017
|
if (captureOutput) {
|
|
7964
8018
|
options.stdout = 'pipe';
|
|
7965
8019
|
options.stderr = 'pipe';
|
|
@@ -8731,8 +8785,22 @@ function parseSourceReelChildJson(stdout) {
|
|
|
8731
8785
|
}
|
|
8732
8786
|
}
|
|
8733
8787
|
|
|
8734
|
-
|
|
8735
|
-
|
|
8788
|
+
function sourceReelLineageEnvironment(workloadAttribution) {
|
|
8789
|
+
return {
|
|
8790
|
+
SOGNI_AGENT_OPERATION_SCOPE: workloadAttribution.operationScope,
|
|
8791
|
+
SOGNI_AGENT_OPERATION_ID: workloadAttribution.operationId,
|
|
8792
|
+
SOGNI_AGENT_ROOT_OPERATION_ID: workloadAttribution.rootOperationId,
|
|
8793
|
+
...(workloadAttribution.parentOperationId
|
|
8794
|
+
? { SOGNI_AGENT_PARENT_OPERATION_ID: workloadAttribution.parentOperationId }
|
|
8795
|
+
: {}),
|
|
8796
|
+
};
|
|
8797
|
+
}
|
|
8798
|
+
|
|
8799
|
+
async function runSourceReelChild(label, args, logPath, outputPath, workloadAttribution) {
|
|
8800
|
+
const result = await runCommand(process.execPath, args, {
|
|
8801
|
+
captureOutput: true,
|
|
8802
|
+
env: sourceReelLineageEnvironment(workloadAttribution),
|
|
8803
|
+
});
|
|
8736
8804
|
const parsed = parseSourceReelChildJson(result.stdout);
|
|
8737
8805
|
const logBody = [
|
|
8738
8806
|
`label=${label}`,
|
|
@@ -8784,7 +8852,14 @@ async function runSourceReel(log) {
|
|
|
8784
8852
|
}
|
|
8785
8853
|
log(`START clip ${clip.id} ${clip.name}`);
|
|
8786
8854
|
const args = sourceReelChildArgs(['--ref', clip.refPath], clip.clipPath, clip.prompt, plan, plan.imageSeconds);
|
|
8787
|
-
|
|
8855
|
+
const workloadAttribution = nextSemanticWorkloadAttribution();
|
|
8856
|
+
await runSourceReelChild(
|
|
8857
|
+
`clip ${clip.id}`,
|
|
8858
|
+
args,
|
|
8859
|
+
clip.logPath,
|
|
8860
|
+
clip.clipPath,
|
|
8861
|
+
workloadAttribution,
|
|
8862
|
+
);
|
|
8788
8863
|
log(`DONE clip ${clip.id} -> ${clip.clipPath}`);
|
|
8789
8864
|
});
|
|
8790
8865
|
|
|
@@ -8816,7 +8891,14 @@ async function runSourceReel(log) {
|
|
|
8816
8891
|
plan,
|
|
8817
8892
|
plan.transitionSeconds
|
|
8818
8893
|
);
|
|
8819
|
-
|
|
8894
|
+
const workloadAttribution = nextSemanticWorkloadAttribution();
|
|
8895
|
+
await runSourceReelChild(
|
|
8896
|
+
`transition ${transition.key}`,
|
|
8897
|
+
args,
|
|
8898
|
+
transition.logPath,
|
|
8899
|
+
transition.clipPath,
|
|
8900
|
+
workloadAttribution,
|
|
8901
|
+
);
|
|
8820
8902
|
log(`DONE transition ${transition.key} -> ${transition.clipPath}`);
|
|
8821
8903
|
});
|
|
8822
8904
|
}
|
|
@@ -9438,6 +9520,7 @@ async function runDoctor() {
|
|
|
9438
9520
|
doctorClient = new SogniClientWrapper({
|
|
9439
9521
|
appSource: SOGNI_APP_SOURCE,
|
|
9440
9522
|
appId: getOrCreateSogniAppId(),
|
|
9523
|
+
attribution: clientAttribution(AGENT_ATTRIBUTION),
|
|
9441
9524
|
network: openclawConfig?.defaultNetwork || 'fast',
|
|
9442
9525
|
autoConnect: false,
|
|
9443
9526
|
apiKey: creds.SOGNI_API_KEY,
|
|
@@ -9980,6 +10063,7 @@ async function main() {
|
|
|
9980
10063
|
client = new SogniClientWrapper({
|
|
9981
10064
|
appSource: SOGNI_APP_SOURCE,
|
|
9982
10065
|
appId: getOrCreateSogniAppId(),
|
|
10066
|
+
attribution: clientAttribution(AGENT_ATTRIBUTION),
|
|
9983
10067
|
network: openclawConfig?.defaultNetwork || 'fast',
|
|
9984
10068
|
autoConnect: false,
|
|
9985
10069
|
apiKey: creds.SOGNI_API_KEY,
|
|
@@ -10767,6 +10851,12 @@ async function main() {
|
|
|
10767
10851
|
if (steps) {
|
|
10768
10852
|
projectConfig.steps = steps;
|
|
10769
10853
|
}
|
|
10854
|
+
if (options.loras.length > 0) {
|
|
10855
|
+
projectConfig.loras = options.loras;
|
|
10856
|
+
}
|
|
10857
|
+
if (options.loraStrengths.length > 0) {
|
|
10858
|
+
projectConfig.loraStrengths = options.loraStrengths;
|
|
10859
|
+
}
|
|
10770
10860
|
|
|
10771
10861
|
if (options.seed !== null && options.seed !== undefined) {
|
|
10772
10862
|
projectConfig.seed = options.seed;
|
|
@@ -10938,6 +11028,7 @@ async function main() {
|
|
|
10938
11028
|
const client2 = new SogniClientWrapper({
|
|
10939
11029
|
appSource: SOGNI_APP_SOURCE,
|
|
10940
11030
|
appId: getOrCreateSogniAppId(),
|
|
11031
|
+
attribution: clientAttribution(AGENT_ATTRIBUTION),
|
|
10941
11032
|
network: openclawConfig?.defaultNetwork || 'fast',
|
|
10942
11033
|
autoConnect: false,
|
|
10943
11034
|
apiKey: creds.SOGNI_API_KEY,
|
package/sogni-hosted-client.mjs
CHANGED
|
@@ -66,6 +66,30 @@ export async function assertSafeSogniEndpoints({ restEndpoint, socketEndpoint })
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
export function buildHostedClientConfig({
|
|
70
|
+
apiKey,
|
|
71
|
+
restEndpoint,
|
|
72
|
+
socketEndpoint,
|
|
73
|
+
appSource,
|
|
74
|
+
appId,
|
|
75
|
+
attribution,
|
|
76
|
+
}) {
|
|
77
|
+
return {
|
|
78
|
+
appId: appId ?? getOrCreateSogniAppId(),
|
|
79
|
+
apiKey,
|
|
80
|
+
appSource: appSource ?? 'sogni-creative-agent-skill',
|
|
81
|
+
...(attribution ? { attribution } : {}),
|
|
82
|
+
logLevel: 'error',
|
|
83
|
+
...(restEndpoint ? { restEndpoint } : {}),
|
|
84
|
+
...(socketEndpoint ? { socketEndpoint } : {}),
|
|
85
|
+
// Every operation routed through this factory is REST or SSE. Avoid
|
|
86
|
+
// creating a short-lived WebSocket for each hosted call or upload-URL
|
|
87
|
+
// lookup; those connections would add noise to connection telemetry.
|
|
88
|
+
disableSocket: true,
|
|
89
|
+
socketEventSubscriptions: { modelAvailability: false }
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
69
93
|
/**
|
|
70
94
|
* Construct a managed `SogniClient` for the duration of `work`. Disposes
|
|
71
95
|
* the socket connection on completion (matching the per-request shape
|
|
@@ -73,17 +97,23 @@ export async function assertSafeSogniEndpoints({ restEndpoint, socketEndpoint })
|
|
|
73
97
|
* that pooling isn't required; the API process owns long-running pools
|
|
74
98
|
* via `SogniClientSessionService`.
|
|
75
99
|
*/
|
|
76
|
-
export async function withHostedClient({
|
|
100
|
+
export async function withHostedClient({
|
|
101
|
+
apiKey,
|
|
102
|
+
restEndpoint,
|
|
103
|
+
socketEndpoint,
|
|
104
|
+
appSource,
|
|
105
|
+
appId,
|
|
106
|
+
attribution,
|
|
107
|
+
}, work) {
|
|
77
108
|
await assertSafeSogniEndpoints({ restEndpoint, socketEndpoint });
|
|
78
|
-
const client = await SogniClient.createInstance({
|
|
79
|
-
appId: appId ?? getOrCreateSogniAppId(),
|
|
109
|
+
const client = await SogniClient.createInstance(buildHostedClientConfig({
|
|
80
110
|
apiKey,
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
});
|
|
111
|
+
restEndpoint,
|
|
112
|
+
socketEndpoint,
|
|
113
|
+
appSource,
|
|
114
|
+
appId,
|
|
115
|
+
attribution,
|
|
116
|
+
}));
|
|
87
117
|
try {
|
|
88
118
|
return await work(client);
|
|
89
119
|
} finally {
|
package/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const PACKAGE_VERSION = '3.
|
|
1
|
+
export const PACKAGE_VERSION = '3.21.0';
|