@simpligen/mcp 0.5.1 → 0.7.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/README.md +5 -1
- package/package.json +2 -2
- package/src/bin.js +1 -1
- package/src/client.js +5 -0
- package/src/tools.js +114 -21
package/README.md
CHANGED
|
@@ -20,7 +20,11 @@ The easiest path is in the SimpliGen app: **Settings -> Connect an agent**, pick
|
|
|
20
20
|
|
|
21
21
|
## Tools
|
|
22
22
|
|
|
23
|
-
`list_capabilities`, `get_status`, `list_projects`, `create_project`, `upload_file`, `generate`, `get_job`, `wait_for_result`, `list_jobs`, `cancel_job`, `prepare_preset`, `get_result_image`.
|
|
23
|
+
`list_capabilities`, `get_status`, `list_projects`, `create_project`, `upload_file`, `generate`, `get_job`, `wait_for_result`, `list_jobs`, `cancel_job`, `prepare_preset`, `get_result_image`, `wait_for_approval`, `get_app_context`, `fill_generate_form`, `open_screen`, `accept_character_base`.
|
|
24
|
+
|
|
25
|
+
**Approval flow (SimpliGen's in-app Assistant).** A token the app issues for its own Assistant panel is flagged `approvalRequired`. With it, any call that queues a generation, renders or exports a film, runs a recipe, or deletes a character or product does not run. It returns `awaiting_approval` with a `proposalId`, and the user sees an approval card in the app. Call `wait_for_approval(proposalId)` (it long-polls in short rounds, like `wait_for_result`). It returns the real result once the user clicks Approve, or `declined` with the user's optional reason so you can adjust and propose again. For `regenerate_character_base`, the approved result carries a base job id: wait on it with `wait_for_result`, then call `accept_character_base`. Normal pairing tokens (Claude Desktop and other clients) never see this flow.
|
|
26
|
+
|
|
27
|
+
**Screen tools.** `get_app_context` returns what the user is looking at. `fill_generate_form` fills the visible Generate form and never presses Generate. `open_screen` navigates the app. They work for outside MCP clients too.
|
|
24
28
|
|
|
25
29
|
**Video Studio** (connector 0.5.0 or newer): `list_films`, `create_film`, `get_film`, `update_film_settings`, `add_track`, `move_track`, `detect_tempo`, `add_clip`, `update_clip`, `move_clip`, `trim_clip`, `remove_clip`, `apply_film_plan`, `set_fades`, `add_marker`, `set_export_range`, `render_clips`, `wait_for_renders`, `list_takes`, `use_take`, `export_film`, `list_locations`, `create_location`. An agent can build a whole music video: a song, its tempo, clips on the bars, shots, renders and the export. With the film open in the Video Studio every change shows live and undoes with Ctrl+Z. These tools are listed only when your SimpliGen has the Video Studio (connector 0.5.1 or newer, SimpliGen 1.75 or newer). If the agent starts before SimpliGen is running, they appear within a minute of SimpliGen starting; an agent app that does not refresh its tool list shows them after a restart.
|
|
26
30
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simpligen/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "MCP server for SimpliGen -- drive local/cloud AI image & video generation from an agent.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@modelcontextprotocol/sdk": "^1",
|
|
34
|
-
"sharp": "
|
|
34
|
+
"sharp": ">=0.34.5 <0.36",
|
|
35
35
|
"zod": "^3"
|
|
36
36
|
}
|
|
37
37
|
}
|
package/src/bin.js
CHANGED
package/src/client.js
CHANGED
|
@@ -91,7 +91,12 @@ export class ControlApiClient {
|
|
|
91
91
|
listProjects() { return this.#req('GET', '/projects'); }
|
|
92
92
|
createProject(name) { return this.#req('POST', '/projects', { name }); }
|
|
93
93
|
listLoras() { return this.#req('GET', '/loras'); }
|
|
94
|
+
getPromptGuide(presetId) { return this.#req('GET', `/prompt-guide/${encodeURIComponent(presetId)}`); }
|
|
94
95
|
generate(args) { return this.#req('POST', '/generate', args); }
|
|
96
|
+
waitForApproval(id, timeoutSeconds) { return this.#req('GET', `/approvals/${encodeURIComponent(id)}/wait?timeoutSeconds=${timeoutSeconds}`); }
|
|
97
|
+
getAppContext() { return this.#req('GET', '/app/context'); }
|
|
98
|
+
fillGenerateForm(body) { return this.#req('POST', '/app/generate-form', body); }
|
|
99
|
+
openScreen(body) { return this.#req('POST', '/app/screen', body); }
|
|
95
100
|
getJob(id) { return this.#req('GET', `/jobs/${encodeURIComponent(id)}`); }
|
|
96
101
|
listJobs() { return this.#req('GET', '/jobs'); }
|
|
97
102
|
cancelJob(id) { return this.#req('POST', `/jobs/${encodeURIComponent(id)}/cancel`, {}); }
|
package/src/tools.js
CHANGED
|
@@ -8,12 +8,13 @@ import { buildResultImageContent } from './resultImage.js';
|
|
|
8
8
|
export const TOOL_NAMES = [
|
|
9
9
|
'list_capabilities', 'get_status', 'start_engine', 'stop_engine', 'restart_engine',
|
|
10
10
|
'list_projects', 'create_project',
|
|
11
|
-
'
|
|
11
|
+
'wait_for_approval', 'get_app_context', 'fill_generate_form', 'open_screen',
|
|
12
|
+
'upload_file', 'generate', 'list_loras', 'get_prompt_guide', 'get_job', 'wait_for_result', 'list_jobs',
|
|
12
13
|
'cancel_job', 'prepare_preset', 'get_result_image',
|
|
13
14
|
'list_characters', 'get_character', 'list_character_features', 'list_character_presets',
|
|
14
15
|
'remove_character', 'create_character', 'generate_character_image', 'generate_character_video',
|
|
15
16
|
'generate_character_frame', 'animate_character', 'set_character_preset',
|
|
16
|
-
'enhance_character_media', 'regenerate_character_base',
|
|
17
|
+
'enhance_character_media', 'regenerate_character_base', 'accept_character_base',
|
|
17
18
|
'list_recipe_blocks', 'compose_recipe', 'validate_recipe', 'list_recipes', 'get_recipe', 'publish_recipe',
|
|
18
19
|
'run_recipe', 'get_recipe_run', 'wait_for_recipe_run', 'list_recipe_runs', 'cancel_recipe_run',
|
|
19
20
|
'list_subjects', 'list_products', 'create_product', 'remove_product',
|
|
@@ -29,7 +30,22 @@ const ok = (data) => ({ content: [{ type: 'text', text: JSON.stringify(data, nul
|
|
|
29
30
|
const fail = (err) => ({ isError: true, content: [{ type: 'text', text: `${err.errorCode ? err.errorCode + ': ' : ''}${err.message || String(err)}` }] });
|
|
30
31
|
const wrap = (fn) => async (args) => { try { return ok(await fn(args)); } catch (e) { return fail(e); } };
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
// In the in-app Assistant the user approves spending and deletions on a card first.
|
|
34
|
+
const APPROVAL_NOTE = ' If the result is awaiting_approval, call wait_for_approval with its proposalId and tell the user an approval card is waiting.';
|
|
35
|
+
|
|
36
|
+
// generate_character_video chains two gated steps; when one waits for the user it stops
|
|
37
|
+
// and tells the agent how to carry on.
|
|
38
|
+
const RESUME_ANIMATE = {
|
|
39
|
+
tool: 'animate_character',
|
|
40
|
+
note: 'The chain stopped at an approval. After wait_for_approval reports done, wait_for_result on the frame job, then call animate_character with that jobId.',
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const RESUME_CREATE = { tool: 'get_character', note: 'The base portrait is generated after approval. wait_for_approval returns the new characterId; then poll get_character (or wait_for_result on the base job id, if the create response carries one) until base_image_url is set.' };
|
|
44
|
+
const RESUME_REGEN = { tool: 'wait_for_result', note: 'After approval, wait_for_approval returns the base jobId; call wait_for_result on it, then accept_character_base.' };
|
|
45
|
+
|
|
46
|
+
const NO_PROMPT_GUIDES = 'This SimpliGen version has no prompt guides yet. Update the app, or write the prompt without a guide.';
|
|
47
|
+
|
|
48
|
+
export function registerTools(host, client, { onStatus, now = Date.now, sleep = (ms) => new Promise((r) => setTimeout(r, ms)) } = {}) {
|
|
33
49
|
// Every tool's handle by name, so the studio's can be shown and hidden later.
|
|
34
50
|
const registered = {};
|
|
35
51
|
const server = { registerTool: (name, ...rest) => (registered[name] = host.registerTool(name, ...rest)) };
|
|
@@ -73,11 +89,12 @@ export function registerTools(host, client, { onStatus } = {}) {
|
|
|
73
89
|
|
|
74
90
|
server.registerTool('generate',
|
|
75
91
|
{
|
|
76
|
-
title: 'Generate', description: 'Start an image or video generation. Inputs (image/referenceImages/video) are handles from upload_file. backend: local | cloud | auto. Returns a jobId (and, for local runs, an expectation with the same fields as onThisMachine for the requested settings); poll with wait_for_result or get_job.',
|
|
92
|
+
title: 'Generate', description: 'Start an image or video generation. Before writing the prompt, call get_prompt_guide for the preset and follow it. Inputs (image/referenceImages/video) are handles from upload_file. backend: local | cloud | auto. Returns a jobId (and, for local runs, an expectation with the same fields as onThisMachine for the requested settings); poll with wait_for_result or get_job.' + APPROVAL_NOTE,
|
|
77
93
|
inputSchema: {
|
|
78
94
|
presetId: z.string(), mediaType: z.enum(['image', 'video']), prompt: z.string(),
|
|
79
95
|
packId: z.string().optional(), backend: z.enum(['local', 'cloud', 'auto']).optional(),
|
|
80
|
-
negativePrompt: z.string().optional()
|
|
96
|
+
negativePrompt: z.string().optional().describe('Extra terms added to the preset default negative prompt (local runs only); the default is always applied.'),
|
|
97
|
+
project: z.string().optional(),
|
|
81
98
|
image: z.string().optional().describe('upload_file handle'),
|
|
82
99
|
// A bare handle still works, so every agent written against the old
|
|
83
100
|
// schema keeps working. The object form carries the per-image label,
|
|
@@ -149,6 +166,24 @@ export function registerTools(host, client, { onStatus } = {}) {
|
|
|
149
166
|
{ title: 'List LoRAs', description: 'List the installed user LoRAs (name, base model, trigger words) so you can pass them in generate -> loras.', inputSchema: {} },
|
|
150
167
|
wrap(() => client.listLoras()));
|
|
151
168
|
|
|
169
|
+
server.registerTool('get_prompt_guide',
|
|
170
|
+
{
|
|
171
|
+
title: 'Get prompt guide',
|
|
172
|
+
description: 'Read the prompting guide for a preset before writing its prompt: how its model reads a prompt, structure, length, camera and motion wording, negatives, character wording and examples. Follow it when you write the prompt for generate.',
|
|
173
|
+
inputSchema: { presetId: z.string() },
|
|
174
|
+
},
|
|
175
|
+
async ({ presetId }) => {
|
|
176
|
+
try {
|
|
177
|
+
return ok(await client.getPromptGuide(presetId));
|
|
178
|
+
} catch (e) {
|
|
179
|
+
// Any other 404 means the app predates the route.
|
|
180
|
+
if (e && e.status === 404 && e.errorCode !== 'unknown_preset') {
|
|
181
|
+
return { isError: true, content: [{ type: 'text', text: NO_PROMPT_GUIDES }] };
|
|
182
|
+
}
|
|
183
|
+
return fail(e);
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
|
|
152
187
|
server.registerTool('get_job',
|
|
153
188
|
{ title: 'Get job', description: 'Status + result of a generation job. resultPath is the local file when completed.', inputSchema: { jobId: z.string() } },
|
|
154
189
|
wrap(({ jobId }) => client.getJob(jobId)));
|
|
@@ -192,6 +227,48 @@ export function registerTools(host, client, { onStatus } = {}) {
|
|
|
192
227
|
}
|
|
193
228
|
});
|
|
194
229
|
|
|
230
|
+
// The user's Approve click on an approval card can take minutes: poll in rounds the
|
|
231
|
+
// control API can hold open (25 s max), until the proposal settles or the timeout passes.
|
|
232
|
+
server.registerTool('wait_for_approval',
|
|
233
|
+
{ title: 'Wait for approval', description: 'Block until the user approves or declines an approval card (proposalId from an awaiting_approval result), or the timeout passes. Returns { status: done | declined | expired, ... }: done carries the result of the approved call (for example the jobId), declined carries a reason. On timeout returns { status: pending, note: still_waiting }: call it again.', inputSchema: { proposalId: z.string(), timeoutSeconds: z.number().optional().describe('Total seconds to wait (default 600)') } },
|
|
234
|
+
wrap(async ({ proposalId, timeoutSeconds = 600 }) => {
|
|
235
|
+
const deadline = now() + timeoutSeconds * 1000;
|
|
236
|
+
for (;;) {
|
|
237
|
+
const remaining = Math.ceil((deadline - now()) / 1000);
|
|
238
|
+
if (remaining <= 0) return { status: 'pending', note: 'still_waiting', proposalId };
|
|
239
|
+
const started = now();
|
|
240
|
+
const r = await client.waitForApproval(proposalId, Math.min(25, remaining));
|
|
241
|
+
if (r.status === 'done') {
|
|
242
|
+
const httpStatus = r.result?.status;
|
|
243
|
+
return { status: 'done', ok: httpStatus >= 200 && httpStatus < 300, result: r.result?.json, httpStatus };
|
|
244
|
+
}
|
|
245
|
+
if (r.status !== 'pending' && r.status !== 'running') return r;
|
|
246
|
+
// A server that answers at once instead of holding the call must not be hammered.
|
|
247
|
+
const spent = now() - started;
|
|
248
|
+
if (spent < 1000) await sleep(1000 - spent);
|
|
249
|
+
}
|
|
250
|
+
}));
|
|
251
|
+
|
|
252
|
+
// ---- The app's own screen: what the user sees, and moving it for them ----
|
|
253
|
+
|
|
254
|
+
server.registerTool('get_app_context',
|
|
255
|
+
{ title: 'Get app context', description: 'What the user is looking at in SimpliGen right now: the open screen, the selected preset, character or film, and the current Generate form values.', inputSchema: {} },
|
|
256
|
+
wrap(() => client.getAppContext()));
|
|
257
|
+
|
|
258
|
+
server.registerTool('fill_generate_form',
|
|
259
|
+
{ title: 'Fill the Generate form', description: 'Fill in the Generate screen for the user (preset, prompt and settings) without generating, so they can review it and click Generate themselves.', inputSchema: {
|
|
260
|
+
presetId: z.string(), prompt: z.string(), negativePrompt: z.string().optional(), characterId: z.string().optional(),
|
|
261
|
+
settings: z.record(z.any()).optional().describe('Preset settings keyed by setting id (see list_capabilities).'),
|
|
262
|
+
} },
|
|
263
|
+
wrap((a) => client.fillGenerateForm(a)));
|
|
264
|
+
|
|
265
|
+
server.registerTool('open_screen',
|
|
266
|
+
{ title: 'Open a screen', description: 'Take the user to a screen in SimpliGen. id selects a character when screen is "character".', inputSchema: {
|
|
267
|
+
screen: z.enum(['generate', 'gallery', 'characters', 'character', 'video-studio', 'prompt-library', 'settings']),
|
|
268
|
+
id: z.string().optional(),
|
|
269
|
+
} },
|
|
270
|
+
wrap((a) => client.openScreen(a)));
|
|
271
|
+
|
|
195
272
|
// ---- Character Studio tools ----
|
|
196
273
|
|
|
197
274
|
server.registerTool('list_characters',
|
|
@@ -211,13 +288,13 @@ export function registerTools(host, client, { onStatus } = {}) {
|
|
|
211
288
|
wrap(() => client.listCharacterPresets()));
|
|
212
289
|
|
|
213
290
|
server.registerTool('remove_character',
|
|
214
|
-
{ title: 'Remove character', description: 'Permanently delete a character and its associated data.', inputSchema: { characterId: z.string() } },
|
|
291
|
+
{ title: 'Remove character', description: 'Permanently delete a character and its associated data.' + APPROVAL_NOTE, inputSchema: { characterId: z.string() } },
|
|
215
292
|
wrap(({ characterId }) => client.removeCharacter(characterId)));
|
|
216
293
|
|
|
217
294
|
server.registerTool('create_character',
|
|
218
295
|
{
|
|
219
296
|
title: 'Create character',
|
|
220
|
-
description: 'Create a new character. Three paths: (1) describe -- pass gender and identity features from list_character_features with mode "generate"; the server builds a base portrait automatically and this tool waits until ready. (2) upload as base -- pass baseFilePath pointing to a local image with mode "upload"; the image becomes the base portrait immediately. (3) vision recreate -- describe path but fill identity by having the agent analyse a reference photo first; the agent extracts features and passes them as identity.',
|
|
297
|
+
description: 'Create a new character. Three paths: (1) describe -- pass gender and identity features from list_character_features with mode "generate"; the server builds a base portrait automatically and this tool waits until ready. (2) upload as base -- pass baseFilePath pointing to a local image with mode "upload"; the image becomes the base portrait immediately. (3) vision recreate -- describe path but fill identity by having the agent analyse a reference photo first; the agent extracts features and passes them as identity.' + APPROVAL_NOTE,
|
|
221
298
|
inputSchema: {
|
|
222
299
|
name: z.string().describe('Display name for the character'),
|
|
223
300
|
gender: z.enum(['woman', 'man', 'nonbinary']),
|
|
@@ -233,10 +310,12 @@ export function registerTools(host, client, { onStatus } = {}) {
|
|
|
233
310
|
if (mode === 'upload') {
|
|
234
311
|
const up = await client.uploadFile(baseFilePath);
|
|
235
312
|
const char = await client.createCharacter({ name, gender, mode: 'upload', identity, baseHandle: up.handle });
|
|
313
|
+
if (char?.status === 'awaiting_approval') return ok({ ...char, resume: RESUME_CREATE });
|
|
236
314
|
return ok({ ...char, ready: true });
|
|
237
315
|
}
|
|
238
316
|
// mode === 'generate': create then poll until base_image_url is set
|
|
239
317
|
const c = await client.createCharacter({ name, gender, mode: 'generate', identity });
|
|
318
|
+
if (c?.status === 'awaiting_approval') return ok({ ...c, resume: RESUME_CREATE });
|
|
240
319
|
const { characterId } = c;
|
|
241
320
|
const deadline = Date.now() + (timeoutSeconds ?? 300) * 1000;
|
|
242
321
|
while (true) {
|
|
@@ -253,7 +332,7 @@ export function registerTools(host, client, { onStatus } = {}) {
|
|
|
253
332
|
server.registerTool('generate_character_image',
|
|
254
333
|
{
|
|
255
334
|
title: 'Generate character image',
|
|
256
|
-
description: 'Generate one or more images of a character in a scene. Returns jobIds; use wait_for_result then get_result_image for each. Pass presetId to override the default image preset (ids from list_character_presets).',
|
|
335
|
+
description: 'Generate one or more images of a character in a scene. Returns jobIds; use wait_for_result then get_result_image for each. Pass presetId to override the default image preset (ids from list_character_presets).' + APPROVAL_NOTE,
|
|
257
336
|
inputSchema: {
|
|
258
337
|
characterId: z.string(),
|
|
259
338
|
prompt: z.string(),
|
|
@@ -271,7 +350,7 @@ export function registerTools(host, client, { onStatus } = {}) {
|
|
|
271
350
|
server.registerTool('generate_character_video',
|
|
272
351
|
{
|
|
273
352
|
title: 'Generate character video',
|
|
274
|
-
description: 'Generate a short video of a character in a scene. Internally generates a frame then animates it (I2V). Returns frameJobId and videoJobId; use wait_for_result then get_result_image on videoJobId. Use framePresetId to override the image-frame preset and videoPresetId to override the video/animate preset (ids from list_character_presets).',
|
|
353
|
+
description: 'Generate a short video of a character in a scene. Internally generates a frame then animates it (I2V). Returns frameJobId and videoJobId; use wait_for_result then get_result_image on videoJobId. Use framePresetId to override the image-frame preset and videoPresetId to override the video/animate preset (ids from list_character_presets).' + APPROVAL_NOTE,
|
|
275
354
|
inputSchema: {
|
|
276
355
|
characterId: z.string(),
|
|
277
356
|
prompt: z.string(),
|
|
@@ -286,7 +365,9 @@ export function registerTools(host, client, { onStatus } = {}) {
|
|
|
286
365
|
async ({ characterId, prompt, motion, aspect, timeoutSeconds = 300, pollMs = 2000, framePresetId, videoPresetId }) => {
|
|
287
366
|
try {
|
|
288
367
|
// 1. Generate a frame (still image for I2V)
|
|
289
|
-
const
|
|
368
|
+
const frame = await client.generateCharacterFrame(characterId, { prompt, aspect, presetId: framePresetId });
|
|
369
|
+
if (frame?.status === 'awaiting_approval') return ok({ ...frame, resume: RESUME_ANIMATE });
|
|
370
|
+
const { jobIds: [frameJobId] } = frame;
|
|
290
371
|
// 2. Wait for frame to complete
|
|
291
372
|
const deadline = Date.now() + timeoutSeconds * 1000;
|
|
292
373
|
while (true) {
|
|
@@ -297,7 +378,9 @@ export function registerTools(host, client, { onStatus } = {}) {
|
|
|
297
378
|
await new Promise((r) => setTimeout(r, pollMs));
|
|
298
379
|
}
|
|
299
380
|
// 3. Animate from the completed frame
|
|
300
|
-
const
|
|
381
|
+
const video = await client.animateCharacter(characterId, { frameJobId, motion, aspect, presetId: videoPresetId });
|
|
382
|
+
if (video?.status === 'awaiting_approval') return ok({ ...video, resume: RESUME_ANIMATE });
|
|
383
|
+
const { jobIds: [videoJobId] } = video;
|
|
301
384
|
return ok({ frameJobId, videoJobId });
|
|
302
385
|
} catch (e) { return fail(e); }
|
|
303
386
|
});
|
|
@@ -307,7 +390,7 @@ export function registerTools(host, client, { onStatus } = {}) {
|
|
|
307
390
|
server.registerTool('generate_character_frame',
|
|
308
391
|
{
|
|
309
392
|
title: 'Generate character frame',
|
|
310
|
-
description: 'Generate a start-frame image for a character that you can review or enhance before animating. Returns jobIds; use wait_for_result then get_result_image. Pass presetId to override the frame-image preset (ids from list_character_presets).',
|
|
393
|
+
description: 'Generate a start-frame image for a character that you can review or enhance before animating. Returns jobIds; use wait_for_result then get_result_image. Pass presetId to override the frame-image preset (ids from list_character_presets).' + APPROVAL_NOTE,
|
|
311
394
|
inputSchema: {
|
|
312
395
|
characterId: z.string(),
|
|
313
396
|
prompt: z.string(),
|
|
@@ -324,7 +407,7 @@ export function registerTools(host, client, { onStatus } = {}) {
|
|
|
324
407
|
server.registerTool('animate_character',
|
|
325
408
|
{
|
|
326
409
|
title: 'Animate character',
|
|
327
|
-
description: 'Animate a character from a completed image/frame job or a local file path (I2V). jobId may be any completed character image, frame, or upscale job. Returns jobIds; use wait_for_result then get_result_image. Pass videoPresetId to override the video preset (ids from list_character_presets).',
|
|
410
|
+
description: 'Animate a character from a completed image/frame job or a local file path (I2V). jobId may be any completed character image, frame, or upscale job. Returns jobIds; use wait_for_result then get_result_image. Pass videoPresetId to override the video preset (ids from list_character_presets).' + APPROVAL_NOTE,
|
|
328
411
|
inputSchema: {
|
|
329
412
|
characterId: z.string(),
|
|
330
413
|
jobId: z.string().optional().describe('Any completed character image/frame/upscale jobId to use as the source frame'),
|
|
@@ -352,7 +435,7 @@ export function registerTools(host, client, { onStatus } = {}) {
|
|
|
352
435
|
server.registerTool('enhance_character_media',
|
|
353
436
|
{
|
|
354
437
|
title: 'Enhance character media',
|
|
355
|
-
description: 'Upscale a generated image/video, a local file, or the character base portrait (target: "base"). Returns a jobId; use wait_for_result then get_result_image. scale sets the upscale factor; keepResolution upscales then resizes back to source size for a sharper same-size result; applyAsBase replaces the character base portrait with the upscaled result. Enhance presets come from list_character_presets (enhanceImage/enhanceVideo, each with supportedScales).',
|
|
438
|
+
description: 'Upscale a generated image/video, a local file, or the character base portrait (target: "base"). Returns a jobId; use wait_for_result then get_result_image. scale sets the upscale factor; keepResolution upscales then resizes back to source size for a sharper same-size result; applyAsBase replaces the character base portrait with the upscaled result. Enhance presets come from list_character_presets (enhanceImage/enhanceVideo, each with supportedScales).' + APPROVAL_NOTE,
|
|
356
439
|
inputSchema: {
|
|
357
440
|
characterId: z.string(),
|
|
358
441
|
jobId: z.string().optional().describe('Completed job whose result to enhance'),
|
|
@@ -371,7 +454,7 @@ export function registerTools(host, client, { onStatus } = {}) {
|
|
|
371
454
|
server.registerTool('regenerate_character_base',
|
|
372
455
|
{
|
|
373
456
|
title: 'Regenerate character base',
|
|
374
|
-
description: 'Switch the base model and regenerate the base portrait IN PLACE (no new character created). Replaces the current base when completed. Uses basePresetId from list_character_presets. Optionally update identity features at the same time. Polls until completed, then auto-accepts the new base.',
|
|
457
|
+
description: 'Switch the base model and regenerate the base portrait IN PLACE (no new character created). Replaces the current base when completed. Uses basePresetId from list_character_presets. Optionally update identity features at the same time. Polls until completed, then auto-accepts the new base.' + APPROVAL_NOTE,
|
|
375
458
|
inputSchema: {
|
|
376
459
|
characterId: z.string(),
|
|
377
460
|
basePresetId: z.string().optional().describe('Base-generation preset id from list_character_presets'),
|
|
@@ -382,7 +465,9 @@ export function registerTools(host, client, { onStatus } = {}) {
|
|
|
382
465
|
},
|
|
383
466
|
async ({ characterId, basePresetId, identity, timeoutSeconds = 300, pollMs = 2000 }) => {
|
|
384
467
|
try {
|
|
385
|
-
const
|
|
468
|
+
const regen = await client.regenerateCharacterBase(characterId, { basePresetId, identity });
|
|
469
|
+
if (regen?.status === 'awaiting_approval') return ok({ ...regen, resume: RESUME_REGEN });
|
|
470
|
+
const { baseJobId } = regen;
|
|
386
471
|
const deadline = Date.now() + timeoutSeconds * 1000;
|
|
387
472
|
while (true) {
|
|
388
473
|
const { job } = await client.getJob(baseJobId);
|
|
@@ -397,6 +482,14 @@ export function registerTools(host, client, { onStatus } = {}) {
|
|
|
397
482
|
} catch (e) { return fail(e); }
|
|
398
483
|
});
|
|
399
484
|
|
|
485
|
+
server.registerTool('accept_character_base',
|
|
486
|
+
{
|
|
487
|
+
title: 'Accept character base',
|
|
488
|
+
description: 'Make a finished base-portrait job the base of the character. Use it after an approved regenerate_character_base job finishes (wait_for_result completed).',
|
|
489
|
+
inputSchema: { characterId: z.string(), jobId: z.string().describe('The completed base job id') },
|
|
490
|
+
},
|
|
491
|
+
wrap(({ characterId, jobId }) => client.acceptBase(characterId, { altImageId: jobId })));
|
|
492
|
+
|
|
400
493
|
// --- Recipe authoring: compose multi-step recipes out of packs/presets ---
|
|
401
494
|
|
|
402
495
|
const recipeStep = z.object({
|
|
@@ -450,7 +543,7 @@ export function registerTools(host, client, { onStatus } = {}) {
|
|
|
450
543
|
server.registerTool('run_recipe',
|
|
451
544
|
{
|
|
452
545
|
title: 'Run a recipe',
|
|
453
|
-
description: 'Run an installed recipe (from list_recipes) with its inputs filled: the same multi-step pipeline UGC Studio / Product Studio runs when a person clicks Generate, so results land in the Gallery grouped the same way. `inputs` is keyed by input key; a subject input takes a character/product id, media inputs take upload_file handles. engine: local (default when every step is installed) | cloud | auto. Returns a runId; poll with wait_for_recipe_run or get_recipe_run. Cloud runs are priced up front and count against this agent\'s spend cap.',
|
|
546
|
+
description: 'Run an installed recipe (from list_recipes) with its inputs filled: the same multi-step pipeline UGC Studio / Product Studio runs when a person clicks Generate, so results land in the Gallery grouped the same way. `inputs` is keyed by input key; a subject input takes a character/product id, media inputs take upload_file handles. engine: local (default when every step is installed) | cloud | auto. Returns a runId; poll with wait_for_recipe_run or get_recipe_run. Cloud runs are priced up front and count against this agent\'s spend cap.' + APPROVAL_NOTE,
|
|
454
547
|
inputSchema: {
|
|
455
548
|
id: z.string().describe('Recipe id from list_recipes'),
|
|
456
549
|
inputs: z.record(z.any()).describe('Input values keyed by the recipe\'s input keys (see list_recipes -> inputs).'),
|
|
@@ -504,7 +597,7 @@ export function registerTools(host, client, { onStatus } = {}) {
|
|
|
504
597
|
wrap(({ name, image, description, category }) => client.createProduct({ name, image, description, category })));
|
|
505
598
|
|
|
506
599
|
server.registerTool('remove_product',
|
|
507
|
-
{ title: 'Remove a product', description: 'Delete a product and its photo from this device.', inputSchema: { id: z.string() } },
|
|
600
|
+
{ title: 'Remove a product', description: 'Delete a product and its photo from this device.' + APPROVAL_NOTE, inputSchema: { id: z.string() } },
|
|
508
601
|
wrap(({ id }) => client.removeProduct(id)));
|
|
509
602
|
|
|
510
603
|
// ---- The Video Studio (TASK-1310) ---------------------------------------------
|
|
@@ -629,7 +722,7 @@ export function registerTools(host, client, { onStatus } = {}) {
|
|
|
629
722
|
wrap(({ filmId: id, ...rest }) => client.setExportRange(id, rest)));
|
|
630
723
|
|
|
631
724
|
server.registerTool('render_clips',
|
|
632
|
-
{ title: 'Render clips', description: 'Render the clips that need it (default) or the clips named. Clips that continue from the clip before render one at a time, each after the take it starts from. Answers once the batch is under way (for clips that do not continue from each other, after queueing them all) with what started, what is held and why, and the cost in the cloud (counted against this agent\'s spend cap). Refused, with nothing started, as exceeds_balance (the cloud balance does not cover it), exceeds_spend_cap (over this agent\'s spend cap) or cost_unknown (the cloud cost is not known yet; try again in a minute). Follow progress with wait_for_renders or get_film.', inputSchema: {
|
|
725
|
+
{ title: 'Render clips', description: 'Render the clips that need it (default) or the clips named. Clips that continue from the clip before render one at a time, each after the take it starts from. Answers once the batch is under way (for clips that do not continue from each other, after queueing them all) with what started, what is held and why, and the cost in the cloud (counted against this agent\'s spend cap). Refused, with nothing started, as exceeds_balance (the cloud balance does not cover it), exceeds_spend_cap (over this agent\'s spend cap) or cost_unknown (the cloud cost is not known yet; try again in a minute). Follow progress with wait_for_renders or get_film.' + APPROVAL_NOTE, inputSchema: {
|
|
633
726
|
filmId, clips: z.union([z.literal('stale'), z.array(clipRef)]).optional().describe('"stale" (default): every clip whose take is missing or out of date; or a list of clips.'),
|
|
634
727
|
} },
|
|
635
728
|
wrap(({ filmId: id, clips }) => client.renderClips(id, clips === undefined ? {} : { clips })));
|
|
@@ -659,7 +752,7 @@ export function registerTools(host, client, { onStatus } = {}) {
|
|
|
659
752
|
wrap(({ filmId: id, clip, generationId }) => client.useTake(id, clip, generationId)));
|
|
660
753
|
|
|
661
754
|
server.registerTool('export_film',
|
|
662
|
-
{ title: 'Export a film', description: 'Stitch the film (or its export range) into one video with its music, and answer the file path. A long film can take several minutes. Refused with clips_not_ready while clips still need a render; a clip that cannot render at all comes out black and is named in `blanks`.', inputSchema: { filmId } },
|
|
755
|
+
{ title: 'Export a film', description: 'Stitch the film (or its export range) into one video with its music, and answer the file path. A long film can take several minutes. Refused with clips_not_ready while clips still need a render; a clip that cannot render at all comes out black and is named in `blanks`.' + APPROVAL_NOTE, inputSchema: { filmId } },
|
|
663
756
|
wrap(({ filmId: id }) => client.exportFilm(id)));
|
|
664
757
|
|
|
665
758
|
server.registerTool('list_locations',
|
|
@@ -681,7 +774,7 @@ export function registerTools(host, client, { onStatus } = {}) {
|
|
|
681
774
|
wrap(({ id }) => client.getRecipe(id)));
|
|
682
775
|
|
|
683
776
|
server.registerTool('publish_recipe',
|
|
684
|
-
{ title: 'Publish a recipe', description: 'Submit a saved recipe to the SimpliGen Creator Marketplace (queued for human review). Requires a connected account: if none, returns not_connected and the user connects once in Settings, then this succeeds on the same recipe. priceTokens sets an optional one-time price (0 or omitted = free). Every preset the recipe uses must be a distributable first-party pack.', inputSchema: { id: z.string().describe('Recipe id to publish'), changelog: z.string().optional(), priceTokens: z.number().optional().describe('One-time price in tokens (0/omitted = free).') } },
|
|
777
|
+
{ title: 'Publish a recipe', description: 'Submit a saved recipe to the SimpliGen Creator Marketplace (queued for human review). Requires a connected account: if none, returns not_connected and the user connects once in Settings, then this succeeds on the same recipe. priceTokens sets an optional one-time price (0 or omitted = free). Every preset the recipe uses must be a distributable first-party pack.' + APPROVAL_NOTE, inputSchema: { id: z.string().describe('Recipe id to publish'), changelog: z.string().optional(), priceTokens: z.number().optional().describe('One-time price in tokens (0/omitted = free).') } },
|
|
685
778
|
wrap(({ id, changelog, priceTokens }) => client.publishRecipe(id, { changelog, priceTokens })));
|
|
686
779
|
|
|
687
780
|
return { studioTools: STUDIO_TOOL_NAMES.map((name) => registered[name]) };
|