@sogni-ai/sogni-creative-agent-skill 3.20.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 +1 -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/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 +101 -23
- 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: "🎨"
|
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/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)
|
|
@@ -4957,12 +4973,13 @@ function requireApiKeyCredentials(creds, modeLabel) {
|
|
|
4957
4973
|
throw err;
|
|
4958
4974
|
}
|
|
4959
4975
|
|
|
4960
|
-
function apiRequestHeaders(apiKey, extra = {}) {
|
|
4976
|
+
function apiRequestHeaders(apiKey, extra = {}, workloadAttribution = undefined) {
|
|
4961
4977
|
return {
|
|
4962
4978
|
'Content-Type': 'application/json',
|
|
4963
4979
|
Authorization: `Bearer ${apiKey}`,
|
|
4964
4980
|
'api-key': apiKey,
|
|
4965
|
-
...extra
|
|
4981
|
+
...extra,
|
|
4982
|
+
...attributionHeaders(AGENT_ATTRIBUTION, workloadAttribution),
|
|
4966
4983
|
};
|
|
4967
4984
|
}
|
|
4968
4985
|
|
|
@@ -5003,6 +5020,7 @@ async function dispatchWorkflowActionViaSdk(action, apiKey, params) {
|
|
|
5003
5020
|
socketEndpoint: process.env.SOGNI_SOCKET_ENDPOINT || undefined,
|
|
5004
5021
|
appSource: SOGNI_APP_SOURCE,
|
|
5005
5022
|
appId: getOrCreateSogniAppId(),
|
|
5023
|
+
attribution: clientAttribution(AGENT_ATTRIBUTION),
|
|
5006
5024
|
},
|
|
5007
5025
|
async (client) => {
|
|
5008
5026
|
if (action === 'list') {
|
|
@@ -5036,6 +5054,7 @@ async function dispatchWorkflowActionViaSdk(action, apiKey, params) {
|
|
|
5036
5054
|
: {}),
|
|
5037
5055
|
...(params.confirmCost != null ? { confirmCost: params.confirmCost } : {}),
|
|
5038
5056
|
...(params.idempotencyKey ? { idempotencyKey: params.idempotencyKey } : {}),
|
|
5057
|
+
...(params.attribution ? { attribution: params.attribution } : {}),
|
|
5039
5058
|
},
|
|
5040
5059
|
{},
|
|
5041
5060
|
);
|
|
@@ -5064,7 +5083,7 @@ async function dispatchWorkflowActionViaSdk(action, apiKey, params) {
|
|
|
5064
5083
|
* Returns `null` when SDK transport is off so the caller falls back
|
|
5065
5084
|
* to `fetchApiJson`.
|
|
5066
5085
|
*/
|
|
5067
|
-
async function dispatchChatHostedViaSdk(apiKey, body) {
|
|
5086
|
+
async function dispatchChatHostedViaSdk(apiKey, body, workloadAttribution) {
|
|
5068
5087
|
let helpers;
|
|
5069
5088
|
try {
|
|
5070
5089
|
helpers = await import('./sogni-hosted-client.mjs');
|
|
@@ -5081,8 +5100,12 @@ async function dispatchChatHostedViaSdk(apiKey, body) {
|
|
|
5081
5100
|
socketEndpoint: process.env.SOGNI_SOCKET_ENDPOINT || undefined,
|
|
5082
5101
|
appSource: SOGNI_APP_SOURCE,
|
|
5083
5102
|
appId: getOrCreateSogniAppId(),
|
|
5103
|
+
attribution: clientAttribution(AGENT_ATTRIBUTION),
|
|
5084
5104
|
},
|
|
5085
|
-
async (client) => helpers.sdkChatHostedCreate(client,
|
|
5105
|
+
async (client) => helpers.sdkChatHostedCreate(client, {
|
|
5106
|
+
...body,
|
|
5107
|
+
...(workloadAttribution ? { attribution: workloadAttribution } : {}),
|
|
5108
|
+
}),
|
|
5086
5109
|
);
|
|
5087
5110
|
}
|
|
5088
5111
|
|
|
@@ -5124,6 +5147,7 @@ async function dispatchMediaReferenceUrlViaSdk({ ref, file, index, jobId, action
|
|
|
5124
5147
|
socketEndpoint: process.env.SOGNI_SOCKET_ENDPOINT || undefined,
|
|
5125
5148
|
appSource: SOGNI_APP_SOURCE,
|
|
5126
5149
|
appId: getOrCreateSogniAppId(),
|
|
5150
|
+
attribution: clientAttribution(AGENT_ATTRIBUTION),
|
|
5127
5151
|
},
|
|
5128
5152
|
async (client) => {
|
|
5129
5153
|
const type = apiMediaReferenceUploadType(ref, index);
|
|
@@ -5189,11 +5213,17 @@ async function fetchWithTimeout(resource, init = {}, timeoutMs = DEFAULT_HTTP_TI
|
|
|
5189
5213
|
}
|
|
5190
5214
|
}
|
|
5191
5215
|
|
|
5192
|
-
async function fetchApiJson(path, {
|
|
5216
|
+
async function fetchApiJson(path, {
|
|
5217
|
+
apiKey,
|
|
5218
|
+
method = 'GET',
|
|
5219
|
+
body = undefined,
|
|
5220
|
+
headers = {},
|
|
5221
|
+
workloadAttribution = undefined,
|
|
5222
|
+
} = {}) {
|
|
5193
5223
|
const url = await buildSafeApiUrl(path);
|
|
5194
5224
|
const init = {
|
|
5195
5225
|
method,
|
|
5196
|
-
headers: apiRequestHeaders(apiKey, headers),
|
|
5226
|
+
headers: apiRequestHeaders(apiKey, headers, workloadAttribution),
|
|
5197
5227
|
...(body === undefined ? {} : { body: JSON.stringify(body) })
|
|
5198
5228
|
};
|
|
5199
5229
|
|
|
@@ -5799,15 +5829,17 @@ async function runApiChat(log) {
|
|
|
5799
5829
|
...(options.noFilter === true ? { safeContentFilter: false } : {}),
|
|
5800
5830
|
...(apiMediaReferences.length > 0 ? { media_references: apiMediaReferences } : {})
|
|
5801
5831
|
};
|
|
5832
|
+
const workloadAttribution = nextSemanticWorkloadAttribution();
|
|
5802
5833
|
if (options.durableChat) {
|
|
5803
|
-
return runApiChatDurable(log, { apiKey, body });
|
|
5834
|
+
return runApiChatDurable(log, { apiKey, body, workloadAttribution });
|
|
5804
5835
|
}
|
|
5805
5836
|
const payload =
|
|
5806
|
-
(await dispatchChatHostedViaSdk(apiKey, body))
|
|
5837
|
+
(await dispatchChatHostedViaSdk(apiKey, body, workloadAttribution))
|
|
5807
5838
|
?? (await fetchApiJson('/v1/chat/completions', {
|
|
5808
5839
|
apiKey,
|
|
5809
5840
|
method: 'POST',
|
|
5810
|
-
body
|
|
5841
|
+
body,
|
|
5842
|
+
workloadAttribution,
|
|
5811
5843
|
}));
|
|
5812
5844
|
const message = extractChatMessage(payload);
|
|
5813
5845
|
const workflows = extractChatWorkflows(payload);
|
|
@@ -5857,7 +5889,7 @@ async function runApiChat(log) {
|
|
|
5857
5889
|
* installed) we fail with a clear error rather than silently falling
|
|
5858
5890
|
* back to the synchronous endpoint.
|
|
5859
5891
|
*/
|
|
5860
|
-
async function runApiChatDurable(log, { apiKey, body }) {
|
|
5892
|
+
async function runApiChatDurable(log, { apiKey, body, workloadAttribution }) {
|
|
5861
5893
|
let helpers;
|
|
5862
5894
|
try {
|
|
5863
5895
|
helpers = await import('./sogni-hosted-client.mjs');
|
|
@@ -5894,6 +5926,7 @@ async function runApiChatDurable(log, { apiKey, body }) {
|
|
|
5894
5926
|
...(typeof body.safeContentFilter === 'boolean'
|
|
5895
5927
|
? { runtimeConfig: { safeContentFilter: body.safeContentFilter } }
|
|
5896
5928
|
: {}),
|
|
5929
|
+
...(workloadAttribution ? { attribution: workloadAttribution } : {}),
|
|
5897
5930
|
};
|
|
5898
5931
|
|
|
5899
5932
|
const restEndpoint = await buildSafeApiUrl('/');
|
|
@@ -5912,6 +5945,7 @@ async function runApiChatDurable(log, { apiKey, body }) {
|
|
|
5912
5945
|
socketEndpoint: process.env.SOGNI_SOCKET_ENDPOINT || undefined,
|
|
5913
5946
|
appSource: SOGNI_APP_SOURCE,
|
|
5914
5947
|
appId: getOrCreateSogniAppId(),
|
|
5948
|
+
attribution: clientAttribution(AGENT_ATTRIBUTION),
|
|
5915
5949
|
},
|
|
5916
5950
|
async (client) => {
|
|
5917
5951
|
const created = await helpers.sdkChatRunsCreate(client, runParams);
|
|
@@ -6258,12 +6292,19 @@ async function generateStoryboardWorkflowStoryline(apiKey) {
|
|
|
6258
6292
|
sogni_tools: false,
|
|
6259
6293
|
sogni_tool_execution: false
|
|
6260
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
|
+
});
|
|
6261
6301
|
const payload =
|
|
6262
|
-
(await dispatchChatHostedViaSdk(apiKey, body))
|
|
6302
|
+
(await dispatchChatHostedViaSdk(apiKey, body, workloadAttribution))
|
|
6263
6303
|
?? (await fetchApiJson('/v1/chat/completions', {
|
|
6264
6304
|
apiKey,
|
|
6265
6305
|
method: 'POST',
|
|
6266
|
-
body
|
|
6306
|
+
body,
|
|
6307
|
+
workloadAttribution,
|
|
6267
6308
|
}));
|
|
6268
6309
|
const message = extractChatMessage(payload);
|
|
6269
6310
|
const storyline = typeof message.content === 'string' ? message.content.trim() : '';
|
|
@@ -6982,6 +7023,7 @@ async function runApiWorkflow() {
|
|
|
6982
7023
|
input = buildGeneratedKeyframeVideoWorkflowInput();
|
|
6983
7024
|
}
|
|
6984
7025
|
|
|
7026
|
+
const workloadAttribution = nextSemanticWorkloadAttribution({ scope: 'top_level' });
|
|
6985
7027
|
payload =
|
|
6986
7028
|
(await dispatchWorkflowActionViaSdk('start', apiKey, {
|
|
6987
7029
|
input,
|
|
@@ -6990,6 +7032,7 @@ async function runApiWorkflow() {
|
|
|
6990
7032
|
maxEstimatedCapacityUnits: options.apiWorkflowMaxCost ?? undefined,
|
|
6991
7033
|
confirmCost: options.apiWorkflowConfirmCost ?? undefined,
|
|
6992
7034
|
idempotencyKey: options.apiWorkflowIdempotencyKey ?? undefined,
|
|
7035
|
+
attribution: workloadAttribution,
|
|
6993
7036
|
}))
|
|
6994
7037
|
?? (await fetchApiJson('/v1/creative-agent/workflows', {
|
|
6995
7038
|
apiKey,
|
|
@@ -7006,7 +7049,8 @@ async function runApiWorkflow() {
|
|
|
7006
7049
|
...(options.apiWorkflowConfirmCost !== null ? { confirm_cost: options.apiWorkflowConfirmCost } : {}),
|
|
7007
7050
|
token_type: tokenType,
|
|
7008
7051
|
app_source: SOGNI_APP_SOURCE
|
|
7009
|
-
}
|
|
7052
|
+
},
|
|
7053
|
+
workloadAttribution,
|
|
7010
7054
|
}));
|
|
7011
7055
|
const workflow = workflowFromPayload(payload);
|
|
7012
7056
|
const workflowId = workflow?.workflowId || workflow?.id;
|
|
@@ -7965,8 +8009,11 @@ function isNonEmptyFile(filePath) {
|
|
|
7965
8009
|
}
|
|
7966
8010
|
}
|
|
7967
8011
|
|
|
7968
|
-
async function runCommand(command, args, { captureOutput = false } = {}) {
|
|
7969
|
-
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
|
+
};
|
|
7970
8017
|
if (captureOutput) {
|
|
7971
8018
|
options.stdout = 'pipe';
|
|
7972
8019
|
options.stderr = 'pipe';
|
|
@@ -8738,8 +8785,22 @@ function parseSourceReelChildJson(stdout) {
|
|
|
8738
8785
|
}
|
|
8739
8786
|
}
|
|
8740
8787
|
|
|
8741
|
-
|
|
8742
|
-
|
|
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
|
+
});
|
|
8743
8804
|
const parsed = parseSourceReelChildJson(result.stdout);
|
|
8744
8805
|
const logBody = [
|
|
8745
8806
|
`label=${label}`,
|
|
@@ -8791,7 +8852,14 @@ async function runSourceReel(log) {
|
|
|
8791
8852
|
}
|
|
8792
8853
|
log(`START clip ${clip.id} ${clip.name}`);
|
|
8793
8854
|
const args = sourceReelChildArgs(['--ref', clip.refPath], clip.clipPath, clip.prompt, plan, plan.imageSeconds);
|
|
8794
|
-
|
|
8855
|
+
const workloadAttribution = nextSemanticWorkloadAttribution();
|
|
8856
|
+
await runSourceReelChild(
|
|
8857
|
+
`clip ${clip.id}`,
|
|
8858
|
+
args,
|
|
8859
|
+
clip.logPath,
|
|
8860
|
+
clip.clipPath,
|
|
8861
|
+
workloadAttribution,
|
|
8862
|
+
);
|
|
8795
8863
|
log(`DONE clip ${clip.id} -> ${clip.clipPath}`);
|
|
8796
8864
|
});
|
|
8797
8865
|
|
|
@@ -8823,7 +8891,14 @@ async function runSourceReel(log) {
|
|
|
8823
8891
|
plan,
|
|
8824
8892
|
plan.transitionSeconds
|
|
8825
8893
|
);
|
|
8826
|
-
|
|
8894
|
+
const workloadAttribution = nextSemanticWorkloadAttribution();
|
|
8895
|
+
await runSourceReelChild(
|
|
8896
|
+
`transition ${transition.key}`,
|
|
8897
|
+
args,
|
|
8898
|
+
transition.logPath,
|
|
8899
|
+
transition.clipPath,
|
|
8900
|
+
workloadAttribution,
|
|
8901
|
+
);
|
|
8827
8902
|
log(`DONE transition ${transition.key} -> ${transition.clipPath}`);
|
|
8828
8903
|
});
|
|
8829
8904
|
}
|
|
@@ -9445,6 +9520,7 @@ async function runDoctor() {
|
|
|
9445
9520
|
doctorClient = new SogniClientWrapper({
|
|
9446
9521
|
appSource: SOGNI_APP_SOURCE,
|
|
9447
9522
|
appId: getOrCreateSogniAppId(),
|
|
9523
|
+
attribution: clientAttribution(AGENT_ATTRIBUTION),
|
|
9448
9524
|
network: openclawConfig?.defaultNetwork || 'fast',
|
|
9449
9525
|
autoConnect: false,
|
|
9450
9526
|
apiKey: creds.SOGNI_API_KEY,
|
|
@@ -9987,6 +10063,7 @@ async function main() {
|
|
|
9987
10063
|
client = new SogniClientWrapper({
|
|
9988
10064
|
appSource: SOGNI_APP_SOURCE,
|
|
9989
10065
|
appId: getOrCreateSogniAppId(),
|
|
10066
|
+
attribution: clientAttribution(AGENT_ATTRIBUTION),
|
|
9990
10067
|
network: openclawConfig?.defaultNetwork || 'fast',
|
|
9991
10068
|
autoConnect: false,
|
|
9992
10069
|
apiKey: creds.SOGNI_API_KEY,
|
|
@@ -10951,6 +11028,7 @@ async function main() {
|
|
|
10951
11028
|
const client2 = new SogniClientWrapper({
|
|
10952
11029
|
appSource: SOGNI_APP_SOURCE,
|
|
10953
11030
|
appId: getOrCreateSogniAppId(),
|
|
11031
|
+
attribution: clientAttribution(AGENT_ATTRIBUTION),
|
|
10954
11032
|
network: openclawConfig?.defaultNetwork || 'fast',
|
|
10955
11033
|
autoConnect: false,
|
|
10956
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';
|