@remixmate/cli 0.9.16 → 0.9.17

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.
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Persistent project binding — which Project should this machine's CLI output
3
+ * belong to?
4
+ *
5
+ * Stored at ~/.config/remixmate/projects.json, NOT in credentials.json: that
6
+ * file is a 0600 secret store keyed by API base URL, with different lifetime
7
+ * and different blast radius on corruption.
8
+ *
9
+ * Two layers, because host cwd semantics are not uniform:
10
+ * - `byPath` — keyed by absolute cwd. Hosts that run inside the user's real
11
+ * repo (Codex, Claude Code) get per-repo bindings.
12
+ * - `default` — a single fallback. Hosts that spawn a throwaway working
13
+ * directory per conversation (WorkBuddy uses
14
+ * ~/WorkBuddy/<timestamp>) would never hit a byPath entry, so a
15
+ * cwd-only design silently degrades to nothing for them.
16
+ *
17
+ * See docs/cli-project-binding-design.md §3.
18
+ */
19
+ import { homedir } from 'node:os';
20
+ import { dirname, join, resolve } from 'node:path';
21
+ import { promises as fs } from 'node:fs';
22
+ export const CONFIG_DIR = join(homedir(), '.config', 'remixmate');
23
+ export const PROJECTS_FILE = join(CONFIG_DIR, 'projects.json');
24
+ /**
25
+ * Must build a NEW object every call, not spread a shared constant: `backends`
26
+ * would then be one object aliased by every "empty" read, and writeBinding
27
+ * mutates it — so a later read of a missing/corrupt file would hand back
28
+ * bindings accumulated earlier in the process instead of nothing.
29
+ */
30
+ function emptyFile() {
31
+ return { version: 1, backends: {} };
32
+ }
33
+ async function readFile() {
34
+ try {
35
+ const raw = await fs.readFile(PROJECTS_FILE, 'utf-8');
36
+ const parsed = JSON.parse(raw);
37
+ if (!parsed || typeof parsed !== 'object' || !parsed.backends)
38
+ return emptyFile();
39
+ return parsed;
40
+ }
41
+ catch {
42
+ // Missing or corrupt → behave as unbound. A broken binding file must never
43
+ // block a render; the resolution ladder just falls through to the default project.
44
+ return emptyFile();
45
+ }
46
+ }
47
+ async function writeFile(data) {
48
+ await fs.mkdir(dirname(PROJECTS_FILE), { recursive: true, mode: 0o700 });
49
+ await fs.writeFile(PROJECTS_FILE, JSON.stringify(data, null, 2) + '\n', { mode: 0o600 });
50
+ }
51
+ /** Look up the binding for a cwd: exact byPath match first, then the default. */
52
+ export async function readBinding(apiBaseUrl, cwd = process.cwd()) {
53
+ const file = await readFile();
54
+ const entry = file.backends[apiBaseUrl];
55
+ if (!entry)
56
+ return null;
57
+ const byPath = entry.byPath?.[resolve(cwd)];
58
+ if (byPath)
59
+ return { projectId: byPath, scope: 'path' };
60
+ if (entry.default)
61
+ return { projectId: entry.default, scope: 'default' };
62
+ return null;
63
+ }
64
+ /** Bind a project to this cwd (`scope: 'path'`) or as the fallback (`'default'`). */
65
+ export async function writeBinding(apiBaseUrl, projectId, scope, cwd = process.cwd()) {
66
+ const file = await readFile();
67
+ const entry = file.backends[apiBaseUrl] ?? {};
68
+ if (scope === 'default') {
69
+ entry.default = projectId;
70
+ }
71
+ else {
72
+ entry.byPath = { ...(entry.byPath ?? {}), [resolve(cwd)]: projectId };
73
+ }
74
+ file.backends[apiBaseUrl] = entry;
75
+ await writeFile(file);
76
+ }
77
+ /** Drop a binding. Returns true when something was actually removed. */
78
+ export async function clearBinding(apiBaseUrl, scope, cwd = process.cwd()) {
79
+ const file = await readFile();
80
+ const entry = file.backends[apiBaseUrl];
81
+ if (!entry)
82
+ return false;
83
+ let removed = false;
84
+ if (scope === 'default') {
85
+ removed = entry.default != null;
86
+ delete entry.default;
87
+ }
88
+ else {
89
+ const key = resolve(cwd);
90
+ removed = entry.byPath?.[key] != null;
91
+ if (entry.byPath)
92
+ delete entry.byPath[key];
93
+ }
94
+ if (removed)
95
+ await writeFile(file);
96
+ return removed;
97
+ }
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Take creation — turn a render invocation into a VideoProject the web app can
3
+ * show, and hand its conversation id down to the skill.
4
+ *
5
+ * Why this exists at all: ab-web derives a video's project from
6
+ * `file.conversation_id → media_video_project → media_project`. A render whose
7
+ * upload carries no conversation id is stored correctly but belongs to nothing,
8
+ * so it shows up only in the raw asset list. The cloud agent injects
9
+ * CONVERSATION_ID for its own runs; locally, nobody did — that is the bug this
10
+ * module fixes.
11
+ *
12
+ * Idempotency lives on the server (`/video-project/ensure` is get-or-create on
13
+ * `(user_id, client_session_key)`), not in a local state file: a pipeline is N
14
+ * separate CLI processes, sometimes concurrent, and a local cache would have to
15
+ * solve staleness and write races that a unique index solves for free.
16
+ *
17
+ * See docs/cli-project-binding-design.md §5.
18
+ */
19
+ import { type HttpContext } from '../http.js';
20
+ export interface EnsuredTake {
21
+ conversationId: string;
22
+ videoProjectId: string;
23
+ projectId: string;
24
+ created: boolean;
25
+ attempt: number;
26
+ }
27
+ /**
28
+ * Look up the take for the current grouping key without creating anything.
29
+ *
30
+ * Used by pipeline skills that should attach to a take when one exists but must
31
+ * never bring one into being: someone running `remixmate gen-image` on its own
32
+ * isn't making a video, and an empty VideoProject is worse clutter than an
33
+ * unattributed image.
34
+ *
35
+ * Deliberately does NOT resolve a project — resolveProject()'s last rung
36
+ * lazily *creates* 「未分类」, which a read-only lookup has no business doing.
37
+ */
38
+ export declare function findTake(ctx: HttpContext): Promise<EnsuredTake | null>;
39
+ /**
40
+ * Resolve project + grouping key, then get-or-create the take.
41
+ * Returns null when this invocation shouldn't own a take.
42
+ */
43
+ export declare function ensureTake(ctx: HttpContext, opts: {
44
+ jobId?: number;
45
+ flagProjectId?: string;
46
+ }): Promise<EnsuredTake | null>;
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Take creation — turn a render invocation into a VideoProject the web app can
3
+ * show, and hand its conversation id down to the skill.
4
+ *
5
+ * Why this exists at all: ab-web derives a video's project from
6
+ * `file.conversation_id → media_video_project → media_project`. A render whose
7
+ * upload carries no conversation id is stored correctly but belongs to nothing,
8
+ * so it shows up only in the raw asset list. The cloud agent injects
9
+ * CONVERSATION_ID for its own runs; locally, nobody did — that is the bug this
10
+ * module fixes.
11
+ *
12
+ * Idempotency lives on the server (`/video-project/ensure` is get-or-create on
13
+ * `(user_id, client_session_key)`), not in a local state file: a pipeline is N
14
+ * separate CLI processes, sometimes concurrent, and a local cache would have to
15
+ * solve staleness and write races that a unique index solves for free.
16
+ *
17
+ * See docs/cli-project-binding-design.md §5.
18
+ */
19
+ import { mmPost } from '../http.js';
20
+ import { resolveTakeKey } from './host.js';
21
+ import { resolveProject } from './resolve.js';
22
+ /**
23
+ * Pull title / aspectRatio / templateId off the persisted render job.
24
+ *
25
+ * The VideoProject row needs them at creation time, but this runs in Node
26
+ * before the Python renderer is spawned, so the DSL itself isn't in reach —
27
+ * `render_jobs.dsl_meta` is the summary of exactly those fields. Best-effort:
28
+ * a take with a placeholder title beats no take at all.
29
+ */
30
+ async function fetchJobMeta(ctx, jobId) {
31
+ try {
32
+ const detail = await mmPost(ctx, '/renderJob/get', { jobId });
33
+ return detail?.dslMeta ?? {};
34
+ }
35
+ catch {
36
+ return {};
37
+ }
38
+ }
39
+ /**
40
+ * Look up the take for the current grouping key without creating anything.
41
+ *
42
+ * Used by pipeline skills that should attach to a take when one exists but must
43
+ * never bring one into being: someone running `remixmate gen-image` on its own
44
+ * isn't making a video, and an empty VideoProject is worse clutter than an
45
+ * unattributed image.
46
+ *
47
+ * Deliberately does NOT resolve a project — resolveProject()'s last rung
48
+ * lazily *creates* 「未分类」, which a read-only lookup has no business doing.
49
+ */
50
+ export async function findTake(ctx) {
51
+ const takeKey = resolveTakeKey(undefined);
52
+ if (!takeKey.key)
53
+ return null;
54
+ const res = await mmPost(ctx, '/video-project/find-by-session', {
55
+ clientSessionKey: takeKey.key,
56
+ });
57
+ if (!res?.conversationId)
58
+ return null;
59
+ return {
60
+ conversationId: res.conversationId,
61
+ videoProjectId: res.id,
62
+ projectId: res.projectId ?? '',
63
+ created: false,
64
+ attempt: res.attempt ?? 0,
65
+ };
66
+ }
67
+ /**
68
+ * Resolve project + grouping key, then get-or-create the take.
69
+ * Returns null when this invocation shouldn't own a take.
70
+ */
71
+ export async function ensureTake(ctx, opts) {
72
+ const jobId = opts.jobId && opts.jobId > 0 ? opts.jobId : undefined;
73
+ const takeKey = resolveTakeKey(jobId);
74
+ // No grouping key at all → don't create. Only reachable for a take-creating
75
+ // skill that has no jobId (prepare-video-assets) on a host that exposes no
76
+ // session id. Creating here would produce an ungrouped take that the later
77
+ // render-video call — which *does* have a jobId, hence the `job:N` key —
78
+ // could not join, leaving two takes for one video.
79
+ if (!takeKey.key)
80
+ return null;
81
+ const { projectId } = await resolveProject(ctx, { flagProjectId: opts.flagProjectId });
82
+ const meta = jobId ? await fetchJobMeta(ctx, jobId) : {};
83
+ const res = await mmPost(ctx, '/video-project/ensure', {
84
+ projectId,
85
+ clientSessionKey: takeKey.key,
86
+ clientHost: takeKey.host,
87
+ jobId: jobId ?? 0,
88
+ title: meta?.title ?? '',
89
+ archetype: meta?.archetype ?? '',
90
+ aspectRatio: meta?.aspectRatio ?? '',
91
+ templateId: meta?.templateId ?? '',
92
+ });
93
+ if (!res?.conversationId)
94
+ return null;
95
+ return {
96
+ conversationId: res.conversationId,
97
+ videoProjectId: res.id,
98
+ projectId,
99
+ created: res.created,
100
+ attempt: res.attempt,
101
+ };
102
+ }
@@ -16,6 +16,10 @@ export interface SkillDef {
16
16
  entry: SkillEntry;
17
17
  /** Authorization requirement enforced by the dispatcher before invocation. */
18
18
  auth: SkillAuthMode;
19
+ /** Ensure a take (VideoProject + conversation) before running — see skill-schema.ts. */
20
+ createsTake: boolean;
21
+ /** Attach to an existing take, never create one — see skill-schema.ts. */
22
+ joinsTake: boolean;
19
23
  skillDir: string;
20
24
  /** Absolute path to the python entry script (only when entry.type === 'python'). */
21
25
  scriptAbsolutePath?: string;
package/dist/registry.js CHANGED
@@ -38,6 +38,8 @@ function loadOne(skillDir) {
38
38
  parameters: raw.parameters ?? {},
39
39
  entry,
40
40
  auth: resolveAuthMode(raw),
41
+ createsTake: raw.createsTake === true,
42
+ joinsTake: raw.joinsTake === true,
41
43
  skillDir,
42
44
  };
43
45
  if (entry.type === 'python') {
package/dist/runner.js CHANGED
@@ -16,6 +16,8 @@ import { HANDLERS } from './handlers/index.js';
16
16
  import { EXIT, SkillError } from './errors.js';
17
17
  import { authChildEnv, ensureAuth } from './auth/ensure.js';
18
18
  import { emitBillingFooter } from './billing.js';
19
+ import { resolveHttpContext } from './http.js';
20
+ import { ensureTake, findTake } from './project/take.js';
19
21
  /** Read the token override accepted by both the TS handlers and the Python skills. */
20
22
  function tokenFlag(args) {
21
23
  const value = args.token ?? args.priv_token;
@@ -33,6 +35,7 @@ export async function runSkill(skillName, opts) {
33
35
  apiBaseUrl: typeof opts.parsedArgs.api_base_url === 'string' ? opts.parsedArgs.api_base_url : undefined,
34
36
  flagToken: tokenFlag(opts.parsedArgs),
35
37
  });
38
+ await applyTakeContext(skill, opts, auth);
36
39
  switch (skill.entry.type) {
37
40
  case 'python':
38
41
  // Python children talk to ab-api themselves and print their own billing
@@ -58,6 +61,62 @@ export async function runSkill(skillName, opts) {
58
61
  emitBillingFooter();
59
62
  }
60
63
  }
64
+ /**
65
+ * Attach this invocation to a take, publishing the result as `CONVERSATION_ID`.
66
+ * That variable is the only thing that makes an uploaded asset reachable from
67
+ * the web app — it rides the upload as `x-conversation-id` and lands in
68
+ * `file.conversation_id`.
69
+ *
70
+ * Writes `process.env` rather than returning a child-env patch, because the two
71
+ * dispatch paths consume it differently: spawned Python inherits the process
72
+ * environment, while http/builtin handlers run in-process and read it via
73
+ * resolveHttpContext(). Four of the seven take-joining skills are in-process
74
+ * handlers, so a child-env-only patch would silently do nothing for them.
75
+ * Safe here because the CLI runs exactly one skill per process.
76
+ *
77
+ * Two deliberate non-behaviours:
78
+ * - An already-set CONVERSATION_ID is left alone. The cloud agent injects its
79
+ * own, and so does our own parent when prepare-video-assets shells out to
80
+ * gen-image / gen-voice. Re-deriving would fork the conversation.
81
+ * - Any failure is downgraded to a warning. Attribution is a convenience;
82
+ * losing it must never cost the user a render they already paid for. The
83
+ * asset still uploads, just unattributed — exactly the old behaviour.
84
+ */
85
+ async function applyTakeContext(skill, opts, auth) {
86
+ if (!skill.createsTake && !skill.joinsTake)
87
+ return;
88
+ if ((process.env.CONVERSATION_ID ?? '').trim())
89
+ return;
90
+ if (!auth.token)
91
+ return;
92
+ try {
93
+ const ctx = await resolveHttpContext(skill.name, {
94
+ apiBaseUrl: auth.apiBaseUrl,
95
+ preflightToken: auth.token,
96
+ });
97
+ let take;
98
+ if (skill.createsTake) {
99
+ const jobIdArg = opts.parsedArgs.job_id;
100
+ const jobId = typeof jobIdArg === 'number' ? jobIdArg : Number(jobIdArg);
101
+ const flagProject = opts.parsedArgs.project;
102
+ take = await ensureTake(ctx, {
103
+ jobId: Number.isFinite(jobId) ? jobId : undefined,
104
+ flagProjectId: typeof flagProject === 'string' ? flagProject : undefined,
105
+ });
106
+ }
107
+ else {
108
+ take = await findTake(ctx);
109
+ }
110
+ if (!take)
111
+ return;
112
+ process.env.CONVERSATION_ID = take.conversationId;
113
+ process.stdout.write(`📁 take ${take.created ? 'created' : 'reused'}: ${take.videoProjectId} ` +
114
+ `(project ${take.projectId}${take.attempt ? `, attempt ${take.attempt}` : ''})\n`);
115
+ }
116
+ catch (err) {
117
+ process.stderr.write(`⚠️ 无法归属本次产物(内容仍会正常生成,但不会出现在项目里): ${err.message}\n`);
118
+ }
119
+ }
61
120
  async function runPython(skill, rawArgs, auth) {
62
121
  if (!skill.scriptAbsolutePath) {
63
122
  throw new SkillError(`skill ${skill.name} has entry.type=python but no scriptAbsolutePath`);
@@ -58,6 +58,20 @@ export interface RawSkillJson {
58
58
  scriptPath?: string;
59
59
  entry?: SkillEntry;
60
60
  envVars?: string[];
61
+ /**
62
+ * Declares that this skill produces a finished video, so the dispatcher should
63
+ * ensure a "take" (VideoProject + conversation) before running it and inject the
64
+ * resulting CONVERSATION_ID. Declarative rather than a hardcoded skill name in
65
+ * runner.ts, so the pipeline's shape stays visible in the skill's own manifest.
66
+ */
67
+ createsTake?: boolean;
68
+ /**
69
+ * Declares that this skill contributes to a video but must never *start* one:
70
+ * attach to an existing take if there is one, otherwise carry on unattributed.
71
+ * A standalone `gen-image` run isn't a video, and an empty VideoProject is
72
+ * worse clutter than an unattributed asset.
73
+ */
74
+ joinsTake?: boolean;
61
75
  }
62
76
  /**
63
77
  * Resolve a skill's auth mode, defaulting for records that predate the field.
@@ -61,6 +61,21 @@ export function validateSkillJson(raw, skillId) {
61
61
  if (raw.auth != null && !AUTH_VALUES.includes(raw.auth)) {
62
62
  errors.push(`skill.json.auth must be one of ${AUTH_VALUES.join(' | ')}, got '${raw.auth}'`);
63
63
  }
64
+ if (raw.createsTake != null && typeof raw.createsTake !== 'boolean') {
65
+ errors.push(`skill.json.createsTake must be a boolean, got '${String(raw.createsTake)}'`);
66
+ }
67
+ if (raw.joinsTake != null && typeof raw.joinsTake !== 'boolean') {
68
+ errors.push(`skill.json.joinsTake must be a boolean, got '${String(raw.joinsTake)}'`);
69
+ }
70
+ if (raw.createsTake === true && raw.joinsTake === true) {
71
+ errors.push("skill.json cannot set both 'createsTake' and 'joinsTake' — createsTake already implies joining");
72
+ }
73
+ // Attribution means calling ab-api as a specific user. An `auth: none` skill
74
+ // never touches the backend and produces no server-side file, so there is
75
+ // nothing to attribute — the flag would be dead config that reads as working.
76
+ if ((raw.createsTake === true || raw.joinsTake === true) && resolveAuthMode(raw) === 'none') {
77
+ errors.push("skill.json declares createsTake/joinsTake but auth='none' — a purely local skill has nothing to attribute");
78
+ }
64
79
  if (raw.name && raw.name !== skillId) {
65
80
  errors.push(`skill.json.name='${raw.name}' does not match directory name '${skillId}'`);
66
81
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remixmate/cli",
3
- "version": "0.9.16",
3
+ "version": "0.9.17",
4
4
  "description": "AI media generation skills for Claude Code / Codex — 12 skills covering image, video, voice, digital human, web screenshot, web recording, script, template registry, rendering, Jianying export, and video deconstruction.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -6,26 +6,87 @@
6
6
  "title": "Digital-Human Talking-Head",
7
7
  "description": "Digital-human video: list available avatars; produce a talking-head video from text via TTS, or drive an avatar from an existing audio URL.",
8
8
  "auth": "required",
9
- "envVars": ["PRIV_TOKEN", "MM_API_BASE_URL", "AGENT_NAME"],
10
- "entry": { "type": "http", "handler": "gen-digital-human" },
9
+ "joinsTake": true,
10
+ "envVars": [
11
+ "PRIV_TOKEN",
12
+ "MM_API_BASE_URL",
13
+ "AGENT_NAME"
14
+ ],
15
+ "entry": {
16
+ "type": "http",
17
+ "handler": "gen-digital-human"
18
+ },
11
19
  "parameters": {
12
20
  "type": "object",
13
21
  "properties": {
14
- "list_avatars": { "type": "boolean", "description": "List available digital-human avatars" },
15
- "mine": { "type": "boolean", "description": "With list_avatars=true: list the caller's own custom avatars instead of the public catalog. Custom avatars do not appear without this." },
16
- "name": { "type": "string", "description": "With list_avatars=true: fuzzy-filter avatars by name" },
17
- "source": { "type": "string", "enum": ["jimeng", "hifly"], "description": "Provider: jimeng is image-driven, hifly is video-driven. Usually inferred from the avatar; pass it explicitly when the avatar declares no source." },
18
- "gender": { "type": "string", "enum": ["male", "female"], "description": "Filter by gender" },
19
- "avatar_id": { "type": "number", "description": "Avatar id" },
20
- "text": { "type": "string", "description": "Narration text (TTS mode)" },
21
- "audio_url": { "type": "string", "description": "Audio URL (audio-driven mode)" },
22
- "voice_id": { "type": "string", "description": "Voice id (TTS mode). Shares the Minimax catalog with gen-voice — call gen_voice with list_voices=true to see available ids rather than inventing one." },
23
- "voice_name": { "type": "string", "description": "Voice display name, recorded alongside voice_id for bookkeeping. Does not affect synthesis." },
24
- "aspect_ratio": { "type": "string", "description": "Aspect ratio: 9:16 / 16:9 / 3:4 / 1:1. Defaults to the avatar's own ratio." },
25
- "prompt": { "type": "string", "description": "Action prompt describing how the avatar should perform, e.g. 'more hand gestures'" },
26
- "check_status": { "type": "boolean", "description": "Status-check mode: poll an earlier job instead of starting a new one. Requires generation_id. Use this when a generate call timed out." },
27
- "generation_id": { "type": "number", "description": "Job id to poll (required when check_status=true)" },
28
- "json_output": { "type": "boolean", "description": "Emit a JSON result (generate: { url, generationId }; list: { avatars }; check-status: { status, url }) instead of human-readable output" }
22
+ "list_avatars": {
23
+ "type": "boolean",
24
+ "description": "List available digital-human avatars"
25
+ },
26
+ "mine": {
27
+ "type": "boolean",
28
+ "description": "With list_avatars=true: list the caller's own custom avatars instead of the public catalog. Custom avatars do not appear without this."
29
+ },
30
+ "name": {
31
+ "type": "string",
32
+ "description": "With list_avatars=true: fuzzy-filter avatars by name"
33
+ },
34
+ "source": {
35
+ "type": "string",
36
+ "enum": [
37
+ "jimeng",
38
+ "hifly"
39
+ ],
40
+ "description": "Provider: jimeng is image-driven, hifly is video-driven. Usually inferred from the avatar; pass it explicitly when the avatar declares no source."
41
+ },
42
+ "gender": {
43
+ "type": "string",
44
+ "enum": [
45
+ "male",
46
+ "female"
47
+ ],
48
+ "description": "Filter by gender"
49
+ },
50
+ "avatar_id": {
51
+ "type": "number",
52
+ "description": "Avatar id"
53
+ },
54
+ "text": {
55
+ "type": "string",
56
+ "description": "Narration text (TTS mode)"
57
+ },
58
+ "audio_url": {
59
+ "type": "string",
60
+ "description": "Audio URL (audio-driven mode)"
61
+ },
62
+ "voice_id": {
63
+ "type": "string",
64
+ "description": "Voice id (TTS mode). Shares the Minimax catalog with gen-voice — call gen_voice with list_voices=true to see available ids rather than inventing one."
65
+ },
66
+ "voice_name": {
67
+ "type": "string",
68
+ "description": "Voice display name, recorded alongside voice_id for bookkeeping. Does not affect synthesis."
69
+ },
70
+ "aspect_ratio": {
71
+ "type": "string",
72
+ "description": "Aspect ratio: 9:16 / 16:9 / 3:4 / 1:1. Defaults to the avatar's own ratio."
73
+ },
74
+ "prompt": {
75
+ "type": "string",
76
+ "description": "Action prompt describing how the avatar should perform, e.g. 'more hand gestures'"
77
+ },
78
+ "check_status": {
79
+ "type": "boolean",
80
+ "description": "Status-check mode: poll an earlier job instead of starting a new one. Requires generation_id. Use this when a generate call timed out."
81
+ },
82
+ "generation_id": {
83
+ "type": "number",
84
+ "description": "Job id to poll (required when check_status=true)"
85
+ },
86
+ "json_output": {
87
+ "type": "boolean",
88
+ "description": "Emit a JSON result (generate: { url, generationId }; list: { avatars }; check-status: { status, url }) instead of human-readable output"
89
+ }
29
90
  },
30
91
  "required": []
31
92
  }
@@ -6,28 +6,79 @@
6
6
  "title": "AI Image Generation",
7
7
  "description": "AI image generation: produce an image from a text prompt. Supports the Seedream family (including a high-fidelity 'pro' variant) and Gemini, plus image-to-image with reference images.",
8
8
  "auth": "required",
9
- "envVars": ["PRIV_TOKEN", "MM_API_BASE_URL", "AGENT_NAME", "MM_IMAGE_MODEL"],
10
- "entry": { "type": "http", "handler": "gen-image" },
9
+ "joinsTake": true,
10
+ "envVars": [
11
+ "PRIV_TOKEN",
12
+ "MM_API_BASE_URL",
13
+ "AGENT_NAME",
14
+ "MM_IMAGE_MODEL"
15
+ ],
16
+ "entry": {
17
+ "type": "http",
18
+ "handler": "gen-image"
19
+ },
11
20
  "parameters": {
12
21
  "type": "object",
13
22
  "properties": {
14
- "prompt": { "type": "string", "description": "Image description (required)" },
15
- "model": { "type": "string", "description": "Model: 'seedream' (default), 'seedream-pro' (high fidelity, precise placement and on-image text; costs more per image), or 'gemini'" },
16
- "size": { "type": "string", "description": "Aspect ratio or WxH, e.g. 1:1, 9:16" },
17
- "resolution": { "type": "string", "enum": ["1K", "2K", "4K"], "description": "Output resolution (Gemini only)" },
18
- "n": { "type": "number", "description": "Number of images, 1-4" },
23
+ "prompt": {
24
+ "type": "string",
25
+ "description": "Image description (required)"
26
+ },
27
+ "model": {
28
+ "type": "string",
29
+ "description": "Model: 'seedream' (default), 'seedream-pro' (high fidelity, precise placement and on-image text; costs more per image), or 'gemini'"
30
+ },
31
+ "size": {
32
+ "type": "string",
33
+ "description": "Aspect ratio or WxH, e.g. 1:1, 9:16"
34
+ },
35
+ "resolution": {
36
+ "type": "string",
37
+ "enum": [
38
+ "1K",
39
+ "2K",
40
+ "4K"
41
+ ],
42
+ "description": "Output resolution (Gemini only)"
43
+ },
44
+ "n": {
45
+ "type": "number",
46
+ "description": "Number of images, 1-4"
47
+ },
19
48
  "reference": {
20
49
  "type": "array",
21
- "items": { "type": "string" },
50
+ "items": {
51
+ "type": "string"
52
+ },
22
53
  "description": "Reference images for image-to-image: local file path, https URL, or data URI. Pass multiple to blend several references (seedream: max 14, seedream-pro: max 10, gemini: max 4 — over the limit fails before spending credits)."
23
54
  },
24
- "image_strength": { "type": "number", "description": "How strongly the reference images influence the result, 0-1 (Seedream family only). Omit to use the backend default." },
25
- "guidance_scale": { "type": "number", "description": "Prompt-adherence strength, where supported. Omit to use the backend default." },
26
- "negative_prompt": { "type": "string", "description": "Negative prompt content to avoid" },
27
- "seed": { "type": "number", "description": "Random seed. Pass the same seed with the same prompt and model to make a run reproducible." },
28
- "watermark": { "type": "boolean", "description": "Add a watermark to the output. Only true has an effect; there is no opt-out override of the backend default." },
29
- "json_output": { "type": "boolean", "description": "Emit a JSON result ({ urls: [...] }) instead of human-readable output" }
55
+ "image_strength": {
56
+ "type": "number",
57
+ "description": "How strongly the reference images influence the result, 0-1 (Seedream family only). Omit to use the backend default."
58
+ },
59
+ "guidance_scale": {
60
+ "type": "number",
61
+ "description": "Prompt-adherence strength, where supported. Omit to use the backend default."
62
+ },
63
+ "negative_prompt": {
64
+ "type": "string",
65
+ "description": "Negative prompt — content to avoid"
66
+ },
67
+ "seed": {
68
+ "type": "number",
69
+ "description": "Random seed. Pass the same seed with the same prompt and model to make a run reproducible."
70
+ },
71
+ "watermark": {
72
+ "type": "boolean",
73
+ "description": "Add a watermark to the output. Only true has an effect; there is no opt-out override of the backend default."
74
+ },
75
+ "json_output": {
76
+ "type": "boolean",
77
+ "description": "Emit a JSON result ({ urls: [...] }) instead of human-readable output"
78
+ }
30
79
  },
31
- "required": ["prompt"]
80
+ "required": [
81
+ "prompt"
82
+ ]
32
83
  }
33
84
  }