@pixeldojo/mcp 0.14.0 → 0.15.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 +6 -2
- package/dist/cli.cjs +722 -87
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +722 -87
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +722 -87
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +722 -87
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -140,12 +140,13 @@ async function uploadLocalFile(path, ctx) {
|
|
|
140
140
|
);
|
|
141
141
|
}
|
|
142
142
|
const isImage = mime.startsWith("image/");
|
|
143
|
-
const
|
|
143
|
+
const isAudio = mime.startsWith("audio/");
|
|
144
|
+
const limit = isImage ? MAX_IMAGE_BYTES : isAudio ? MAX_AUDIO_BYTES : MAX_VIDEO_BYTES;
|
|
144
145
|
if (size > limit) {
|
|
145
146
|
const gotMB = (size / 1024 / 1024).toFixed(1);
|
|
146
147
|
const limitMB = (limit / 1024 / 1024).toFixed(0);
|
|
147
148
|
throw new SkillUploadError(
|
|
148
|
-
`"${basename(path)}" is ${gotMB}MB; limit for ${isImage ? "images" : "videos"} is ${limitMB}MB. Downscale or re-encode and try again.`
|
|
149
|
+
`"${basename(path)}" is ${gotMB}MB; limit for ${isImage ? "images" : isAudio ? "audio" : "videos"} is ${limitMB}MB. Downscale or re-encode and try again.`
|
|
149
150
|
);
|
|
150
151
|
}
|
|
151
152
|
const buffer = await readFile(path);
|
|
@@ -157,11 +158,12 @@ async function uploadLocalFile(path, ctx) {
|
|
|
157
158
|
async function uploadLocalFiles(paths, ctx) {
|
|
158
159
|
return Promise.all(paths.map((p) => uploadLocalFile(p, ctx)));
|
|
159
160
|
}
|
|
160
|
-
var MAX_IMAGE_BYTES, MAX_VIDEO_BYTES, EXT_TO_MIME, SkillUploadError, HOSTED_LOCAL_PATH_MESSAGE;
|
|
161
|
+
var MAX_IMAGE_BYTES, MAX_VIDEO_BYTES, MAX_AUDIO_BYTES, EXT_TO_MIME, SkillUploadError, HOSTED_LOCAL_PATH_MESSAGE;
|
|
161
162
|
var init_upload_helpers = __esm({
|
|
162
163
|
"src/skills/upload-helpers.ts"() {
|
|
163
164
|
MAX_IMAGE_BYTES = 50 * 1024 * 1024;
|
|
164
165
|
MAX_VIDEO_BYTES = 200 * 1024 * 1024;
|
|
166
|
+
MAX_AUDIO_BYTES = 50 * 1024 * 1024;
|
|
165
167
|
EXT_TO_MIME = {
|
|
166
168
|
".jpg": "image/jpeg",
|
|
167
169
|
".jpeg": "image/jpeg",
|
|
@@ -170,7 +172,14 @@ var init_upload_helpers = __esm({
|
|
|
170
172
|
".gif": "image/gif",
|
|
171
173
|
".mp4": "video/mp4",
|
|
172
174
|
".webm": "video/webm",
|
|
173
|
-
".mov": "video/quicktime"
|
|
175
|
+
".mov": "video/quicktime",
|
|
176
|
+
// Audio: the server checks the bytes match (a Film Studio song, song_path).
|
|
177
|
+
".mp3": "audio/mpeg",
|
|
178
|
+
".wav": "audio/wav",
|
|
179
|
+
".m4a": "audio/mp4",
|
|
180
|
+
".aac": "audio/aac",
|
|
181
|
+
".ogg": "audio/ogg",
|
|
182
|
+
".flac": "audio/flac"
|
|
174
183
|
};
|
|
175
184
|
SkillUploadError = class extends Error {
|
|
176
185
|
constructor(userMessage) {
|
|
@@ -540,7 +549,7 @@ var init_generate = __esm({
|
|
|
540
549
|
InputSchema = z.object({
|
|
541
550
|
prompt: z.string().min(1).max(8e3).describe("Prompt describing what to generate."),
|
|
542
551
|
model: z.string().optional().describe(
|
|
543
|
-
`Model apiId. Recommended: "seedream-5"
|
|
552
|
+
`Model apiId. Recommended (the models the PixelDojo studios use): "seedream-5" for images (the default), "seedance-2-5" for video (prompt only or a starting image), "wan-3-0-video" for video the others refuse. Use another model only when the user names one. Full catalog: https://pixeldojo.ai/api/v1/models; one model's fields: https://pixeldojo.ai/llm/{apiId}.txt. Omit for seedream-5, which makes still images only; name a video model to get a video.`
|
|
544
553
|
),
|
|
545
554
|
preset: z.string().optional().describe(
|
|
546
555
|
"Preset slug that seeds the running model's settings; explicit fields and params override it. Each preset belongs to one model (browse them by model at https://pixeldojo.ai/presets), so set `model` to that preset's model: a slug the running model has no preset for is rejected with a 400 before any charge."
|
|
@@ -579,7 +588,7 @@ var init_generate = __esm({
|
|
|
579
588
|
prompt: { type: "string", description: "Prompt describing what to generate." },
|
|
580
589
|
model: {
|
|
581
590
|
type: "string",
|
|
582
|
-
description: `Model apiId. Recommended: "seedream-5"
|
|
591
|
+
description: `Model apiId. Recommended (the models the PixelDojo studios use): "seedream-5" for images (the default), "seedance-2-5" for video (prompt only or a starting image), "wan-3-0-video" for video the others refuse. Use another model only when the user names one. Full catalog: https://pixeldojo.ai/api/v1/models; one model's fields: https://pixeldojo.ai/llm/{apiId}.txt. Omit for seedream-5, which makes still images only; name a video model to get a video.`
|
|
583
592
|
},
|
|
584
593
|
preset: {
|
|
585
594
|
type: "string",
|
|
@@ -627,8 +636,8 @@ var init_generate = __esm({
|
|
|
627
636
|
};
|
|
628
637
|
generateSkill = {
|
|
629
638
|
name: "pixeldojo_generate",
|
|
630
|
-
description: "Generate an image or video from a prompt with any model in the PixelDojo catalog. With no `model`, a prompt runs on seedream-5, which makes still images only. For a video, name seedance-2-5
|
|
631
|
-
hostedDescription: "Generate an image or video from a prompt with any model in the PixelDojo catalog. With no `model`, a prompt runs on seedream-5, which makes still images only. For a video, name seedance-2-5
|
|
639
|
+
description: "Generate an image or video from a prompt with any model in the PixelDojo catalog. With no `model`, a prompt runs on seedream-5, which makes still images only. For a video, name seedance-2-5, which works from a prompt alone or a starting image. If a provider refuses the content, retry once on wan-3-0-video (video) or seedream-5 (images), the least-restricted models. For a multi-shot film or a music video synced to a song use pixeldojo_film; to change, move or extend an existing clip use pixeldojo_video. These are the models the PixelDojo studios use; name another only when the user asks for it. References: `image_url`/`image_urls` for stills, `video_url` for a source clip, `image_path`/`image_paths` for absolute local files (uploaded to 24h temp storage first). A clip or an audio track URL with no `model` runs on seedance-2-reference; a named model that cannot read a clip is swapped for it and the result says so, while a named model with no audio input drops the track. Model-specific settings go in `params` alongside an explicit `model`. Returns asset URLs, or a jobId for pixeldojo_status when the job outlasts the 30s wait.",
|
|
640
|
+
hostedDescription: "Generate an image or video from a prompt with any model in the PixelDojo catalog. With no `model`, a prompt runs on seedream-5, which makes still images only. For a video, name seedance-2-5, which works from a prompt alone or a starting image. If a provider refuses the content, retry once on wan-3-0-video (video) or seedream-5 (images), the least-restricted models. For a multi-shot film or a music video synced to a song use pixeldojo_film; to change, move or extend an existing clip use pixeldojo_video. These are the models the PixelDojo studios use; name another only when the user asks for it. References: `image_url`/`image_urls` for stills and `video_url` for a source clip, all public http(s) URLs. A clip or an audio track URL with no `model` runs on seedance-2-reference; a named model that cannot read a clip is swapped for it and the result says so, while a named model with no audio input drops the track. Model-specific settings go in `params` alongside an explicit `model`. Returns asset URLs, or a jobId for pixeldojo_status when the job outlasts the 30s wait.",
|
|
632
641
|
inputZod: InputSchema,
|
|
633
642
|
inputJsonSchema: InputJsonSchema,
|
|
634
643
|
allowedModels: null,
|
|
@@ -912,6 +921,7 @@ var init_character = __esm({
|
|
|
912
921
|
"seedream-4",
|
|
913
922
|
"google-nano-banana",
|
|
914
923
|
"wan-2.7-image-edit",
|
|
924
|
+
"qwen-3-pro",
|
|
915
925
|
"qwen-image-2.0-pro"
|
|
916
926
|
];
|
|
917
927
|
DEFAULT_MODEL3 = "seedream-5";
|
|
@@ -922,6 +932,7 @@ var init_character = __esm({
|
|
|
922
932
|
"seedream-4": "image_urls",
|
|
923
933
|
"google-nano-banana": "image_input",
|
|
924
934
|
"wan-2.7-image-edit": "image_urls",
|
|
935
|
+
"qwen-3-pro": "image",
|
|
925
936
|
"qwen-image-2.0-pro": "reference_images"
|
|
926
937
|
};
|
|
927
938
|
InputSchema3 = z.object({
|
|
@@ -1397,43 +1408,122 @@ function progressLine(f) {
|
|
|
1397
1408
|
const rendering = all.filter((sh) => sh.status === "clip-generating").length;
|
|
1398
1409
|
return `frames ${frames}/${all.length}, clips ${clips}/${all.length}${rendering > 0 ? ` (${rendering} rendering)` : ""}`;
|
|
1399
1410
|
}
|
|
1411
|
+
async function runPlanner(ctx, filmId, path, body) {
|
|
1412
|
+
const submit = await filmApi(ctx, "POST", path, body);
|
|
1413
|
+
if (submit.data.film) return { film: submit.data.film };
|
|
1414
|
+
const jobId = submit.data.jobId;
|
|
1415
|
+
if (!jobId) return { error: submit.data.error ?? `HTTP ${submit.status}` };
|
|
1416
|
+
const sleep = ctx.pollOverrides?.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
|
|
1417
|
+
for (let i = 0; i < PLANNER_MAX_POLLS; i += 1) {
|
|
1418
|
+
await sleep(PLANNER_POLL_MS);
|
|
1419
|
+
const { data } = await filmApi(ctx, "GET", `/api/films/${filmId}`);
|
|
1420
|
+
const job = data.film?.llmJob;
|
|
1421
|
+
if (!data.film || job?.id !== jobId) continue;
|
|
1422
|
+
if (job.status === "error") return { error: job.error ?? "the run failed" };
|
|
1423
|
+
if (job.status === "done") return { film: data.film };
|
|
1424
|
+
}
|
|
1425
|
+
return { pending: true };
|
|
1426
|
+
}
|
|
1427
|
+
async function sliceSong(ctx, film) {
|
|
1428
|
+
const r = await filmApi(ctx, "POST", `/api/films/${film.id}/music/slice`, {
|
|
1429
|
+
songDurationSec: film.musicDurationSec
|
|
1430
|
+
});
|
|
1431
|
+
return r.status === 200 ? null : `Could not cut the song into shots: ${r.data.error ?? r.status}`;
|
|
1432
|
+
}
|
|
1433
|
+
function plannedText(film, ctx) {
|
|
1434
|
+
const total = shots(film).length;
|
|
1435
|
+
const music = isMusicVideo(film);
|
|
1436
|
+
const sceneLines = film.scenes.map((s, i) => ` Scene ${i + 1} "${s.title}"${s.location ? ` [${s.location}]` : ""}: ${s.shots.length} shots`);
|
|
1437
|
+
return [
|
|
1438
|
+
`Planned ${music ? "music video " : ""}"${film.title}" (film_id: ${film.id}): ${film.scenes.length} scenes, ${total} shots, ${film.look}, ${film.aspect}.`,
|
|
1439
|
+
...sceneLines,
|
|
1440
|
+
"",
|
|
1441
|
+
music ? `Nothing has been charged yet. The song is cut into one slice per shot and each clip lip-syncs to its slice on the studio music video engine. Producing renders every shot, charged as each renders. No score is composed: the export plays your song.` : `Nothing has been charged yet. Producing renders every shot (roughly 35-40 credits per 5-second shot at default engines, charged as each renders) plus a few credits for the soundtrack.`,
|
|
1442
|
+
`Review or edit at ${ctx.baseUrl}/film-studio/${film.id}, or call pixeldojo_film with {"film_id": "${film.id}", "action": "produce"} to start production.`
|
|
1443
|
+
].join("\n");
|
|
1444
|
+
}
|
|
1400
1445
|
async function plan(input, ctx) {
|
|
1446
|
+
const music = Boolean(input.song_url || input.song_path);
|
|
1401
1447
|
if (!input.idea?.trim() && !input.script?.trim()) {
|
|
1402
|
-
return {
|
|
1448
|
+
return {
|
|
1449
|
+
kind: "text",
|
|
1450
|
+
text: music ? "Provide an `idea` describing the visuals of the music video (plus optional `lyrics`)." : "Provide an `idea` (we write the script, free) or a full `script` to plan a film."
|
|
1451
|
+
};
|
|
1452
|
+
}
|
|
1453
|
+
if (input.song_path && !input.song_url) {
|
|
1454
|
+
try {
|
|
1455
|
+
input = { ...input, song_url: await uploadLocalFile(input.song_path, ctx) };
|
|
1456
|
+
} catch (err) {
|
|
1457
|
+
if (err instanceof SkillUploadError) return { kind: "text", text: `Could not upload the song: ${err.userMessage}` };
|
|
1458
|
+
throw err;
|
|
1459
|
+
}
|
|
1403
1460
|
}
|
|
1404
1461
|
const created = await filmApi(ctx, "POST", "/api/films", {
|
|
1405
1462
|
aspect: input.aspect,
|
|
1406
|
-
look: input.look,
|
|
1463
|
+
look: input.look ?? (music ? MUSIC_VIDEO_LOOKS[0] : "live-action"),
|
|
1407
1464
|
lengthTarget: input.length,
|
|
1408
|
-
assetIds: []
|
|
1465
|
+
assetIds: [],
|
|
1466
|
+
...music ? {
|
|
1467
|
+
// No script step names a music video, so it would stay "Untitled film".
|
|
1468
|
+
...input.idea?.trim() ? { title: input.idea.trim().slice(0, 80) } : {},
|
|
1469
|
+
musicVideoMode: true,
|
|
1470
|
+
musicUrl: input.song_url,
|
|
1471
|
+
...input.song_duration_sec ? { musicDurationSec: input.song_duration_sec } : {},
|
|
1472
|
+
clipEngine: MUSIC_CLIP_ENGINE_ID
|
|
1473
|
+
} : {}
|
|
1409
1474
|
});
|
|
1410
1475
|
if (!created.data.film) return { kind: "text", text: `Could not create the film: ${created.data.error ?? created.status}` };
|
|
1411
1476
|
const id = created.data.film.id;
|
|
1412
|
-
let
|
|
1413
|
-
if (
|
|
1414
|
-
const
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
}
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1477
|
+
let planned;
|
|
1478
|
+
if (music) {
|
|
1479
|
+
const brief = [input.idea?.trim() || input.script.trim(), input.lyrics?.trim() ? `Lyrics:
|
|
1480
|
+
${input.lyrics.trim()}` : ""].filter(Boolean).join("\n\n");
|
|
1481
|
+
planned = await runPlanner(ctx, id, `/api/films/${id}/plan`, { script: brief });
|
|
1482
|
+
} else {
|
|
1483
|
+
let script = input.script?.trim() ?? "";
|
|
1484
|
+
if (!script) {
|
|
1485
|
+
const wrote = await runPlanner(ctx, id, `/api/films/${id}/script`, { idea: input.idea.trim() });
|
|
1486
|
+
if ("pending" in wrote) return { kind: "text", text: stillPlanningText(id) };
|
|
1487
|
+
if ("error" in wrote) return { kind: "text", text: `Script writing failed: ${wrote.error}` };
|
|
1488
|
+
script = wrote.film.script ?? "";
|
|
1489
|
+
if (!script) return { kind: "text", text: "Script writing failed: the studio returned an empty script." };
|
|
1490
|
+
}
|
|
1491
|
+
planned = await runPlanner(ctx, id, `/api/films/${id}/plan`, { script });
|
|
1492
|
+
}
|
|
1493
|
+
if ("pending" in planned) return { kind: "text", text: stillPlanningText(id) };
|
|
1494
|
+
if ("error" in planned) return { kind: "text", text: `Shot planning failed: ${planned.error}` };
|
|
1495
|
+
const film = planned.film;
|
|
1496
|
+
if (needsSlice(film)) {
|
|
1497
|
+
const err = await sliceSong(ctx, film);
|
|
1498
|
+
if (err) return { kind: "text", text: `${plannedText(film, ctx)}
|
|
1499
|
+
|
|
1500
|
+
${err} Call action "status" to retry the cut.` };
|
|
1501
|
+
}
|
|
1502
|
+
return { kind: "text", text: plannedText(film, ctx) };
|
|
1503
|
+
}
|
|
1504
|
+
async function resumePlanning(film, ctx) {
|
|
1505
|
+
if (film.scenes.length > 0 && film.llmJob?.status !== "running") return null;
|
|
1506
|
+
if (film.llmJob?.status === "running") return { kind: "text", text: stillPlanningText(film.id) };
|
|
1507
|
+
const prior = film.llmJob?.status === "error" ? `The last planning run failed (${film.llmJob.error ?? "unknown"}). ` : "";
|
|
1508
|
+
if (!film.script?.trim()) {
|
|
1509
|
+
return { kind: "text", text: `${prior}This film has nothing to plan from. Start a new one with action "plan".` };
|
|
1510
|
+
}
|
|
1511
|
+
const planned = await runPlanner(ctx, film.id, `/api/films/${film.id}/plan`, { script: film.script });
|
|
1512
|
+
if ("pending" in planned) return { kind: "text", text: `${prior}${stillPlanningText(film.id)}` };
|
|
1513
|
+
if ("error" in planned) return { kind: "text", text: `Shot planning failed: ${planned.error} Call action "status" to retry.` };
|
|
1514
|
+
if (needsSlice(planned.film)) {
|
|
1515
|
+
const err = await sliceSong(ctx, planned.film);
|
|
1516
|
+
if (err) return { kind: "text", text: `${plannedText(planned.film, ctx)}
|
|
1517
|
+
|
|
1518
|
+
${err} Call action "status" to retry the cut.` };
|
|
1519
|
+
}
|
|
1520
|
+
return { kind: "text", text: plannedText(planned.film, ctx) };
|
|
1433
1521
|
}
|
|
1434
1522
|
async function produce(filmId, ctx) {
|
|
1435
1523
|
const { data } = await filmApi(ctx, "GET", `/api/films/${filmId}`);
|
|
1436
1524
|
if (!data.film) return { kind: "text", text: `Film not found: ${data.error ?? filmId}` };
|
|
1525
|
+
const planning = await resumePlanning(data.film, ctx);
|
|
1526
|
+
if (planning) return planning;
|
|
1437
1527
|
const pending = shots(data.film).filter((sh) => sh.status === "idle" || sh.status === "failed" && !sh.frameUrl);
|
|
1438
1528
|
let fired = 0;
|
|
1439
1529
|
for (const sh of pending.slice(0, 6)) {
|
|
@@ -1497,6 +1587,13 @@ It is saved in the Library folder "Film: ${film.title}".`
|
|
|
1497
1587
|
if (film.exportError) {
|
|
1498
1588
|
return { kind: "text", text: `Export failed: ${film.exportError} Poll again with action "status" to retry.` };
|
|
1499
1589
|
}
|
|
1590
|
+
const planning = await resumePlanning(film, ctx);
|
|
1591
|
+
if (planning) return planning;
|
|
1592
|
+
if (needsSlice(film)) {
|
|
1593
|
+
const err = await sliceSong(ctx, film);
|
|
1594
|
+
if (err) return { kind: "text", text: `${err} Poll again with action "status" to retry.` };
|
|
1595
|
+
return { kind: "text", text: `Song cut into one slice per shot. Poll again with {"film_id": "${filmId}", "action": "status"} to keep production moving.` };
|
|
1596
|
+
}
|
|
1500
1597
|
const idleFrames = all.filter((sh) => sh.status === "idle");
|
|
1501
1598
|
for (const sh of idleFrames.slice(0, 6)) {
|
|
1502
1599
|
await filmApi(ctx, "POST", `/api/films/${filmId}/shots/${sh.id}/generate`, { kind: "frame" });
|
|
@@ -1516,7 +1613,7 @@ It is saved in the Library folder "Film: ${film.title}".`
|
|
|
1516
1613
|
await filmApi(ctx, "POST", `/api/films/${filmId}/save`, { kind: "clip" });
|
|
1517
1614
|
}
|
|
1518
1615
|
const hasMusic = film.audioStems.some((st) => st.kind === "music");
|
|
1519
|
-
if (soundtrack !== "none" && !hasMusic) {
|
|
1616
|
+
if (soundtrack !== "none" && !hasMusic && !isMusicVideo(film)) {
|
|
1520
1617
|
if (musicJobId) {
|
|
1521
1618
|
const job = await ctx.client.getJob(musicJobId);
|
|
1522
1619
|
const out = job.output;
|
|
@@ -1555,14 +1652,22 @@ async function run8(input, ctx) {
|
|
|
1555
1652
|
if (action === "produce") return produce(input.film_id, ctx);
|
|
1556
1653
|
return advance(input.film_id, input.soundtrack, input.music_job_id, ctx);
|
|
1557
1654
|
}
|
|
1558
|
-
var LOOKS, InputSchema8, InputJsonSchema8, shots, count, LOOK_MUSIC, ARC, filmSkill;
|
|
1655
|
+
var STORY_LOOKS, MUSIC_VIDEO_LOOKS, LOOKS, MUSIC_CLIP_ENGINE_ID, InputSchema8, InputJsonSchema8, shots, count, PLANNER_POLL_MS, PLANNER_MAX_POLLS, isMusicVideo, needsSlice, stillPlanningText, LOOK_MUSIC, ARC, filmSkill;
|
|
1559
1656
|
var init_film = __esm({
|
|
1560
1657
|
"src/skills/film.ts"() {
|
|
1561
|
-
|
|
1658
|
+
init_upload_helpers();
|
|
1659
|
+
STORY_LOOKS = ["live-action", "anime", "3d-animation", "noir", "horror", "sci-fi", "documentary", "western", "romance", "romantic-comedy", "comedy"];
|
|
1660
|
+
MUSIC_VIDEO_LOOKS = ["rap-video", "neon-club", "stage-performance", "retro-camcorder", "y2k-pop", "moody-rnb", "rock-grit", "dream-pop", "k-pop"];
|
|
1661
|
+
LOOKS = [...STORY_LOOKS, ...MUSIC_VIDEO_LOOKS];
|
|
1662
|
+
MUSIC_CLIP_ENGINE_ID = "minimax-h3-reference";
|
|
1562
1663
|
InputSchema8 = z.object({
|
|
1563
1664
|
idea: z.string().max(2e3).optional().describe("One-to-three sentence film idea. The studio writes the screenplay (free). Provide idea OR script for planning."),
|
|
1564
1665
|
script: z.string().max(2e4).optional().describe("A full screenplay to plan instead of an idea (sluglines, action lines, dialogue)."),
|
|
1565
|
-
look: z.enum(LOOKS).
|
|
1666
|
+
look: z.enum(LOOKS).optional().describe("Visual style carried through frames, clips, and soundtrack. Default live-action, or rap-video for a music video."),
|
|
1667
|
+
song_url: z.string().url().startsWith("https://").max(2e3).optional().describe("Music video mode: URL of the song, which must be your own PixelDojo upload (from pixeldojo_upload), not a third-party link. The film is cut to the song and every clip lip-syncs to its slice of it. idea describes the visuals."),
|
|
1668
|
+
song_path: z.string().max(4096).optional().describe("Music video mode, local server only: absolute path to the song file (MP3, WAV, M4A, AAC, OGG, FLAC up to 50MB). Uploaded for you; use instead of song_url."),
|
|
1669
|
+
song_duration_sec: z.number().positive().max(7200).optional().describe("Music video mode (optional): the song length in seconds. Omit it and the studio measures the song."),
|
|
1670
|
+
lyrics: z.string().max(1e4).optional().describe("Music video mode: the song lyrics, so shots land on the right lines. Optional."),
|
|
1566
1671
|
aspect: z.enum(["16:9", "9:16"]).default("16:9"),
|
|
1567
1672
|
length: z.enum(["30s", "60s", "2-3min", "5min"]).default("60s").describe("Target length; drives the shot count (~6/12/24/60 shots)."),
|
|
1568
1673
|
film_id: z.string().max(40).optional().describe("Existing film id (from a previous call) for produce/status."),
|
|
@@ -1575,9 +1680,22 @@ var init_film = __esm({
|
|
|
1575
1680
|
properties: {
|
|
1576
1681
|
idea: { type: "string", description: "Plan step: one-to-three sentence film idea. The studio writes the screenplay (free). Provide idea or script." },
|
|
1577
1682
|
script: { type: "string", description: "Plan step: a full screenplay (sluglines, action lines, dialogue) to plan instead of an idea." },
|
|
1578
|
-
look: { type: "string", enum: [...LOOKS], description:
|
|
1683
|
+
look: { type: "string", enum: [...LOOKS], description: `Plan step: visual style carried through frames, clips and soundtrack. Story looks: ${STORY_LOOKS.join(", ")} (default live-action). Music video looks: ${MUSIC_VIDEO_LOOKS.join(", ")} (default rap-video).` },
|
|
1684
|
+
song_url: {
|
|
1685
|
+
type: "string",
|
|
1686
|
+
description: "Plan step, music video mode: URL of the song. It must be your own PixelDojo upload (from pixeldojo_upload or /api/v1/upload); a third-party link is refused. Makes a music video cut to this song, every clip lip-synced to its slice of it, rendered on the studio music video engine. idea (or script) describes the visuals. No score is composed: the song is the soundtrack."
|
|
1687
|
+
},
|
|
1688
|
+
song_path: {
|
|
1689
|
+
type: "string",
|
|
1690
|
+
description: "Plan step, music video mode: absolute local path to the song (MP3, WAV, M4A, AAC, OGG, FLAC up to 50MB). Uploaded for you; use instead of song_url."
|
|
1691
|
+
},
|
|
1692
|
+
song_duration_sec: {
|
|
1693
|
+
type: "number",
|
|
1694
|
+
description: "Plan step, music video mode (optional): the song length in seconds. Omit it and the studio measures the song."
|
|
1695
|
+
},
|
|
1696
|
+
lyrics: { type: "string", description: "Plan step, music video mode (optional): the song lyrics, so shots land on the right lines." },
|
|
1579
1697
|
aspect: { type: "string", enum: ["16:9", "9:16"], description: "Plan step: frame aspect ratio. Default 16:9." },
|
|
1580
|
-
length: { type: "string", enum: ["30s", "60s", "2-3min", "5min"], description: "Plan step: target length, which sets the shot count (~6/12/24/60 shots). Default 60s." },
|
|
1698
|
+
length: { type: "string", enum: ["30s", "60s", "2-3min", "5min"], description: "Plan step: target length, which sets the shot count (~6/12/24/60 shots). Default 60s. Ignored for a music video, whose length is the song." },
|
|
1581
1699
|
film_id: { type: "string", description: 'The film_id returned by the plan step. Required for produce and status; with it, action "plan" is treated as "status".' },
|
|
1582
1700
|
action: {
|
|
1583
1701
|
type: "string",
|
|
@@ -1587,7 +1705,7 @@ var init_film = __esm({
|
|
|
1587
1705
|
soundtrack: {
|
|
1588
1706
|
type: "string",
|
|
1589
1707
|
enum: ["scene-synced", "flat", "none"],
|
|
1590
|
-
description: "Read on status calls once all clips are ready. scene-synced (default): one musical section per scene. flat: one cohesive bed. none: export without music."
|
|
1708
|
+
description: "Read on status calls once all clips are ready. scene-synced (default): one musical section per scene. flat: one cohesive bed. none: export without music. Ignored for a music video, which always exports with its song."
|
|
1591
1709
|
},
|
|
1592
1710
|
music_job_id: {
|
|
1593
1711
|
type: "string",
|
|
@@ -1597,6 +1715,11 @@ var init_film = __esm({
|
|
|
1597
1715
|
};
|
|
1598
1716
|
shots = (f) => f.scenes.flatMap((s) => s.shots);
|
|
1599
1717
|
count = (f, pred) => shots(f).filter(pred).length;
|
|
1718
|
+
PLANNER_POLL_MS = 3e3;
|
|
1719
|
+
PLANNER_MAX_POLLS = 8;
|
|
1720
|
+
isMusicVideo = (f) => f.musicVideoMode === true;
|
|
1721
|
+
needsSlice = (f) => isMusicVideo(f) && shots(f).length > 0 && !shots(f).some((sh) => sh.musicChunkUrl);
|
|
1722
|
+
stillPlanningText = (filmId) => `Planning is still running (film_id: ${filmId}). Nothing has been charged. Call pixeldojo_film with {"film_id": "${filmId}", "action": "status"} in ~30s; it returns the plan once it is ready.`;
|
|
1600
1723
|
LOOK_MUSIC = {
|
|
1601
1724
|
"live-action": "modern cinematic underscore, warm strings and soft felt piano, subtle rhythmic pulse, slow emotional build",
|
|
1602
1725
|
anime: "sweeping anime film score, lush strings and piano, taiko drum accents, soaring heartfelt theme",
|
|
@@ -1617,7 +1740,8 @@ var init_film = __esm({
|
|
|
1617
1740
|
};
|
|
1618
1741
|
filmSkill = {
|
|
1619
1742
|
name: "pixeldojo_film",
|
|
1620
|
-
description: "Make a finished short film from one idea: screenplay, storyboard frames (AI-reviewed), video clips with spoken dialogue, scene-synced soundtrack, stitched export.
|
|
1743
|
+
description: "Make a finished short film from one idea: screenplay, storyboard frames (AI-reviewed), video clips with spoken dialogue, scene-synced soundtrack, stitched export. Or a music video: pass song_path (a local file) or song_url (your own PixelDojo upload from pixeldojo_upload, never a third-party link) with optional lyrics; the film is cut to that song, each clip lip-synced to its slice on the studio music video engine, and no score is composed: the export plays the song. Phased: plan is free; produce starts charged generation; status advances production (poll every ~30s).",
|
|
1744
|
+
hostedDescription: "Make a finished short film from one idea: screenplay, storyboard frames (AI-reviewed), video clips with spoken dialogue, scene-synced soundtrack, stitched export. Or a music video: pass song_url (your own PixelDojo upload made with POST /api/v1/upload, never a third-party link) with optional lyrics; the film is cut to that song, each clip lip-synced to its slice on the studio music video engine, and no score is composed: the export plays the song. Phased: plan is free; produce starts charged generation; status advances production (poll every ~30s).",
|
|
1621
1745
|
inputZod: InputSchema8,
|
|
1622
1746
|
inputJsonSchema: InputJsonSchema8,
|
|
1623
1747
|
allowedModels: [],
|
|
@@ -1626,7 +1750,512 @@ var init_film = __esm({
|
|
|
1626
1750
|
};
|
|
1627
1751
|
}
|
|
1628
1752
|
});
|
|
1753
|
+
function buildVideoPayload(verb, apiId, i) {
|
|
1754
|
+
const prompt = i.prompt ?? "";
|
|
1755
|
+
const vd = i.videoDuration;
|
|
1756
|
+
if (NEEDS_VIDEO_DURATION.has(apiId) && vd === void 0) {
|
|
1757
|
+
return {
|
|
1758
|
+
error: `${apiId} needs video_duration: the source clip's length in seconds (it sets the credit cost).`
|
|
1759
|
+
};
|
|
1760
|
+
}
|
|
1761
|
+
if (verb === "move" && !i.images[0]) {
|
|
1762
|
+
return { error: `The move verb needs image_url: the character image to put into the video.` };
|
|
1763
|
+
}
|
|
1764
|
+
const droppedImages = i.images.length > 0 && (verb === "extend" || NO_IMAGE_ENGINES.has(apiId)) ? `${apiId} takes no reference images, so I left them off.` : void 0;
|
|
1765
|
+
if (verb === "change") {
|
|
1766
|
+
switch (apiId) {
|
|
1767
|
+
case "seedance-2-5-video-edit":
|
|
1768
|
+
return {
|
|
1769
|
+
body: {
|
|
1770
|
+
mode: "edit",
|
|
1771
|
+
prompt,
|
|
1772
|
+
video_url: i.videoUrl,
|
|
1773
|
+
reference_images: i.images,
|
|
1774
|
+
...vd !== void 0 ? { source_duration_seconds: vd } : {}
|
|
1775
|
+
}
|
|
1776
|
+
};
|
|
1777
|
+
case "flux-video-edit":
|
|
1778
|
+
return { body: { prompt, video: i.videoUrl, video_duration: Math.ceil(vd) }, note: droppedImages };
|
|
1779
|
+
case "xai-video-edit":
|
|
1780
|
+
return { body: { prompt, video_url: i.videoUrl, video_duration: vd }, note: droppedImages };
|
|
1781
|
+
case "happyhorse-1.0-video-edit":
|
|
1782
|
+
return { body: { prompt, video_url: i.videoUrl, video_duration: vd, reference_urls: i.images } };
|
|
1783
|
+
default:
|
|
1784
|
+
return { body: { prompt, video_url: i.videoUrl, video_duration: vd, image_urls: i.images } };
|
|
1785
|
+
}
|
|
1786
|
+
}
|
|
1787
|
+
if (verb === "move") {
|
|
1788
|
+
if (apiId === "wan-video-character-swap") {
|
|
1789
|
+
return { body: { prompt: "", image_url: i.images[0], video_url: i.videoUrl, video_duration: vd } };
|
|
1790
|
+
}
|
|
1791
|
+
return {
|
|
1792
|
+
body: {
|
|
1793
|
+
prompt,
|
|
1794
|
+
video: i.videoUrl,
|
|
1795
|
+
video_duration: vd,
|
|
1796
|
+
character_image: i.images[0],
|
|
1797
|
+
// Not a background toggle: 'video' is the 30s duration cap.
|
|
1798
|
+
character_orientation: "video"
|
|
1799
|
+
}
|
|
1800
|
+
};
|
|
1801
|
+
}
|
|
1802
|
+
switch (apiId) {
|
|
1803
|
+
case "seedance-2-5-video-edit":
|
|
1804
|
+
return {
|
|
1805
|
+
body: {
|
|
1806
|
+
mode: "extend",
|
|
1807
|
+
prompt,
|
|
1808
|
+
video_url: i.videoUrl,
|
|
1809
|
+
direction: i.direction ?? "forward",
|
|
1810
|
+
duration: clamp(i.duration ?? 5, 4, 30),
|
|
1811
|
+
...vd !== void 0 ? { source_duration_seconds: vd } : {}
|
|
1812
|
+
},
|
|
1813
|
+
note: droppedImages
|
|
1814
|
+
};
|
|
1815
|
+
case "wan-2.7-i2v": {
|
|
1816
|
+
const chosen = clamp(i.duration ?? 5, 2, 15);
|
|
1817
|
+
return {
|
|
1818
|
+
body: {
|
|
1819
|
+
mode: "video-extend",
|
|
1820
|
+
prompt,
|
|
1821
|
+
video_url: i.videoUrl,
|
|
1822
|
+
// A continuation shorter than its own source is rejected outright.
|
|
1823
|
+
duration: vd ? Math.min(15, Math.max(chosen, Math.ceil(vd) + 1)) : chosen,
|
|
1824
|
+
...vd ? { source_video_duration: vd } : {}
|
|
1825
|
+
},
|
|
1826
|
+
note: droppedImages
|
|
1827
|
+
};
|
|
1828
|
+
}
|
|
1829
|
+
default:
|
|
1830
|
+
return {
|
|
1831
|
+
body: { prompt, video_url: i.videoUrl, extension_duration: clamp(i.duration ?? 6, 2, 10) },
|
|
1832
|
+
note: droppedImages
|
|
1833
|
+
};
|
|
1834
|
+
}
|
|
1835
|
+
}
|
|
1629
1836
|
async function run9(input, ctx) {
|
|
1837
|
+
const paramsGate = paramsWithoutModel(input.params, input.model);
|
|
1838
|
+
if (paramsGate) return { kind: "text", text: paramsGate };
|
|
1839
|
+
const verb = input.verb;
|
|
1840
|
+
const engines = VIDEO_STUDIO_ENGINES[verb];
|
|
1841
|
+
const notes = [];
|
|
1842
|
+
let apiId = input.model ?? engines[0];
|
|
1843
|
+
if (!engines.includes(apiId)) {
|
|
1844
|
+
notes.push(`${apiId} is not a Video Studio ${verb} engine, so I used ${engines[0]} instead.`);
|
|
1845
|
+
apiId = engines[0];
|
|
1846
|
+
}
|
|
1847
|
+
if (verb === "extend" && input.direction === "backward" && !BACKWARD_ENGINES.has(apiId)) {
|
|
1848
|
+
notes.push(`${apiId} only extends forward, so I used ${engines[0]} to extend backward.`);
|
|
1849
|
+
apiId = engines[0];
|
|
1850
|
+
}
|
|
1851
|
+
let videoUrl = input.video_url;
|
|
1852
|
+
const images = [...input.image_url ? [input.image_url] : [], ...input.image_urls ?? []];
|
|
1853
|
+
try {
|
|
1854
|
+
if (!videoUrl && input.video_path) videoUrl = await uploadLocalFile(input.video_path, ctx);
|
|
1855
|
+
if (!input.image_url && input.image_path) images.unshift(await uploadLocalFile(input.image_path, ctx));
|
|
1856
|
+
} catch (err) {
|
|
1857
|
+
if (err instanceof SkillUploadError) {
|
|
1858
|
+
return { kind: "text", text: `pixeldojo_video (upload): ${err.userMessage}` };
|
|
1859
|
+
}
|
|
1860
|
+
throw err;
|
|
1861
|
+
}
|
|
1862
|
+
if (!videoUrl) {
|
|
1863
|
+
return {
|
|
1864
|
+
kind: "text",
|
|
1865
|
+
text: `pixeldojo_video ${verb} needs video_url: the ${verb === "move" ? "driving motion clip" : "source clip"}.`
|
|
1866
|
+
};
|
|
1867
|
+
}
|
|
1868
|
+
if (verb !== "move" && !input.prompt?.trim()) {
|
|
1869
|
+
return { kind: "text", text: `pixeldojo_video ${verb} needs a prompt.` };
|
|
1870
|
+
}
|
|
1871
|
+
const built = buildVideoPayload(verb, apiId, {
|
|
1872
|
+
prompt: input.prompt,
|
|
1873
|
+
videoUrl,
|
|
1874
|
+
images: images.filter((u, i, all) => all.indexOf(u) === i),
|
|
1875
|
+
videoDuration: input.video_duration,
|
|
1876
|
+
duration: input.duration,
|
|
1877
|
+
direction: input.direction
|
|
1878
|
+
});
|
|
1879
|
+
if ("error" in built) return { kind: "text", text: `pixeldojo_video: ${built.error}` };
|
|
1880
|
+
if (built.note) notes.push(built.note);
|
|
1881
|
+
const body = built.body;
|
|
1882
|
+
const paramsNote = applyParams(body, input.params, input.model, apiId);
|
|
1883
|
+
if (paramsNote) notes.push(paramsNote);
|
|
1884
|
+
const submitted = await ctx.client.run(apiId, body);
|
|
1885
|
+
const result = await pollJobUntilDoneOrHandoff(
|
|
1886
|
+
submitted.jobId,
|
|
1887
|
+
(id) => ctx.client.getJob(id),
|
|
1888
|
+
ctx.buildStatusUrl,
|
|
1889
|
+
{ now: ctx.pollOverrides?.now, sleep: ctx.pollOverrides?.sleep }
|
|
1890
|
+
);
|
|
1891
|
+
return prefixNote(
|
|
1892
|
+
pollResultToSkillResult(
|
|
1893
|
+
result,
|
|
1894
|
+
(urls) => urls.length === 0 ? `Job ${submitted.jobId} completed but returned no assets.` : `Video ready (${verb} on ${apiId}). Asset: ${urls.join(", ")}`
|
|
1895
|
+
),
|
|
1896
|
+
notes.join(" ")
|
|
1897
|
+
);
|
|
1898
|
+
}
|
|
1899
|
+
var VIDEO_STUDIO_ENGINES, VERBS, BACKWARD_ENGINES, clamp, NEEDS_VIDEO_DURATION, NO_IMAGE_ENGINES, InputSchema9, engineList, InputJsonSchema9, BASE_DESCRIPTION, videoSkill;
|
|
1900
|
+
var init_video = __esm({
|
|
1901
|
+
"src/skills/video.ts"() {
|
|
1902
|
+
init_poll();
|
|
1903
|
+
init_types();
|
|
1904
|
+
init_upload_helpers();
|
|
1905
|
+
init_params();
|
|
1906
|
+
VIDEO_STUDIO_ENGINES = {
|
|
1907
|
+
change: [
|
|
1908
|
+
"seedance-2-5-video-edit",
|
|
1909
|
+
"flux-video-edit",
|
|
1910
|
+
"kling-video-edit",
|
|
1911
|
+
"wan-video-edit",
|
|
1912
|
+
"seedance-video-edit",
|
|
1913
|
+
"happyhorse-1.0-video-edit",
|
|
1914
|
+
"xai-video-edit"
|
|
1915
|
+
],
|
|
1916
|
+
move: ["kling-motion-control", "wan-video-character-swap"],
|
|
1917
|
+
extend: ["seedance-2-5-video-edit", "wan-2.7-i2v", "grok-video-extend"]
|
|
1918
|
+
};
|
|
1919
|
+
VERBS = ["change", "move", "extend"];
|
|
1920
|
+
BACKWARD_ENGINES = /* @__PURE__ */ new Set(["seedance-2-5-video-edit"]);
|
|
1921
|
+
clamp = (n, min, max) => Math.min(max, Math.max(min, Math.round(n)));
|
|
1922
|
+
NEEDS_VIDEO_DURATION = /* @__PURE__ */ new Set([
|
|
1923
|
+
"flux-video-edit",
|
|
1924
|
+
"kling-video-edit",
|
|
1925
|
+
"wan-video-edit",
|
|
1926
|
+
"seedance-video-edit",
|
|
1927
|
+
"happyhorse-1.0-video-edit",
|
|
1928
|
+
"xai-video-edit",
|
|
1929
|
+
"kling-motion-control",
|
|
1930
|
+
"wan-video-character-swap"
|
|
1931
|
+
]);
|
|
1932
|
+
NO_IMAGE_ENGINES = /* @__PURE__ */ new Set(["flux-video-edit", "xai-video-edit"]);
|
|
1933
|
+
InputSchema9 = z.object({
|
|
1934
|
+
verb: z.enum(VERBS),
|
|
1935
|
+
prompt: z.string().max(8e3).optional(),
|
|
1936
|
+
video_url: z.string().url().optional(),
|
|
1937
|
+
video_path: z.string().min(1).optional(),
|
|
1938
|
+
image_url: z.string().url().optional(),
|
|
1939
|
+
image_urls: z.array(z.string().url()).optional(),
|
|
1940
|
+
image_path: z.string().min(1).optional(),
|
|
1941
|
+
model: z.string().optional(),
|
|
1942
|
+
video_duration: z.number().positive().optional(),
|
|
1943
|
+
duration: z.number().int().positive().optional(),
|
|
1944
|
+
direction: z.enum(["forward", "backward"]).optional(),
|
|
1945
|
+
params: ParamsInput
|
|
1946
|
+
});
|
|
1947
|
+
engineList = (verb) => `${verb}: ${VIDEO_STUDIO_ENGINES[verb].join(", ")} (default ${VIDEO_STUDIO_ENGINES[verb][0]})`;
|
|
1948
|
+
InputJsonSchema9 = {
|
|
1949
|
+
type: "object",
|
|
1950
|
+
properties: {
|
|
1951
|
+
verb: {
|
|
1952
|
+
type: "string",
|
|
1953
|
+
enum: VERBS,
|
|
1954
|
+
description: "change = restyle or edit an existing clip; move = put a character image into a driving video (motion transfer / character swap); extend = continue a clip forward (or backward on the default engine)."
|
|
1955
|
+
},
|
|
1956
|
+
prompt: {
|
|
1957
|
+
type: "string",
|
|
1958
|
+
description: "What to change, how the character should move, or what happens next. Required for change and extend. Optional for move (wan-video-character-swap ignores it)."
|
|
1959
|
+
},
|
|
1960
|
+
video_url: {
|
|
1961
|
+
type: "string",
|
|
1962
|
+
format: "uri",
|
|
1963
|
+
description: "The source clip (change, extend) or the driving motion clip (move). Required."
|
|
1964
|
+
},
|
|
1965
|
+
video_path: {
|
|
1966
|
+
type: "string",
|
|
1967
|
+
description: "Absolute local path to the source clip (MP4, WebM, MOV). Uploaded to 24h temp storage and used as video_url."
|
|
1968
|
+
},
|
|
1969
|
+
image_url: {
|
|
1970
|
+
type: "string",
|
|
1971
|
+
format: "uri",
|
|
1972
|
+
description: "The character image (move, required) or a reference image (change, optional; some engines take none)."
|
|
1973
|
+
},
|
|
1974
|
+
image_urls: {
|
|
1975
|
+
type: "array",
|
|
1976
|
+
items: { type: "string", format: "uri" },
|
|
1977
|
+
description: "More reference images for change engines that take a set. Move uses the first image only."
|
|
1978
|
+
},
|
|
1979
|
+
image_path: {
|
|
1980
|
+
type: "string",
|
|
1981
|
+
description: "Absolute local path to the character or reference image. Uploaded to 24h temp storage and used as image_url."
|
|
1982
|
+
},
|
|
1983
|
+
model: {
|
|
1984
|
+
type: "string",
|
|
1985
|
+
description: `Video Studio engine for this verb. Omit for the default. ${VERBS.map((v) => engineList(v)).join("; ")}. A model not on the verb's list is replaced by the default and the result says so.`
|
|
1986
|
+
},
|
|
1987
|
+
video_duration: {
|
|
1988
|
+
type: "number",
|
|
1989
|
+
description: "The source clip's length in seconds. Required by every engine except the change/extend default and grok-video-extend, since it sets their credit cost."
|
|
1990
|
+
},
|
|
1991
|
+
duration: {
|
|
1992
|
+
type: "integer",
|
|
1993
|
+
description: "Extend only: output length in seconds (default engine 4-30, wan-2.7-i2v 2-15 total), or seconds added on grok-video-extend (2-10). Ignored by change and move, which keep the source length."
|
|
1994
|
+
},
|
|
1995
|
+
direction: {
|
|
1996
|
+
type: "string",
|
|
1997
|
+
enum: ["forward", "backward"],
|
|
1998
|
+
description: "Extend only. backward adds footage before the clip; only the default engine supports it."
|
|
1999
|
+
},
|
|
2000
|
+
params: PARAMS_JSON_SCHEMA
|
|
2001
|
+
},
|
|
2002
|
+
required: ["verb"]
|
|
2003
|
+
};
|
|
2004
|
+
BASE_DESCRIPTION = "Video Studio verbs for an existing clip, on the same engines the studio uses. verb=change restyles or edits a clip (prompt + video_url, optional reference images). verb=move puts a character image into a driving video's motion (video_url + image_url + video_duration). verb=extend continues a clip forward, or backward on the default engine (prompt + video_url, optional duration and direction). Omit `model` for the studio default; engine-specific settings go in `params` with an explicit `model`. To make a new video, use pixeldojo_generate. Returns asset URLs, or a jobId for pixeldojo_status when the job outlasts the 30s wait.";
|
|
2005
|
+
videoSkill = {
|
|
2006
|
+
name: "pixeldojo_video",
|
|
2007
|
+
description: `${BASE_DESCRIPTION} Local files: video_path / image_path (uploaded to 24h temp storage first).`,
|
|
2008
|
+
hostedDescription: `${BASE_DESCRIPTION} Media must be public http(s) URLs.`,
|
|
2009
|
+
inputZod: InputSchema9,
|
|
2010
|
+
inputJsonSchema: InputJsonSchema9,
|
|
2011
|
+
allowedModels: Array.from(new Set(VERBS.flatMap((v) => VIDEO_STUDIO_ENGINES[v]))),
|
|
2012
|
+
defaultModel: VIDEO_STUDIO_ENGINES.change[0],
|
|
2013
|
+
run: run9
|
|
2014
|
+
};
|
|
2015
|
+
}
|
|
2016
|
+
});
|
|
2017
|
+
async function episodeApi(ctx, method, path, body) {
|
|
2018
|
+
const res = await fetch(`${ctx.baseUrl}/api/faceless-studio/episodes${path}`, {
|
|
2019
|
+
method,
|
|
2020
|
+
headers: {
|
|
2021
|
+
Authorization: `Bearer ${ctx.apiKey}`,
|
|
2022
|
+
"Content-Type": "application/json",
|
|
2023
|
+
"x-pixeldojo-source": `mcp/${ctx.mcpVersion}`,
|
|
2024
|
+
"x-pixeldojo-skill": "episode"
|
|
2025
|
+
},
|
|
2026
|
+
...body !== void 0 ? { body: JSON.stringify(body) } : {}
|
|
2027
|
+
});
|
|
2028
|
+
const data = await res.json().catch(() => ({}));
|
|
2029
|
+
return { status: res.status, data };
|
|
2030
|
+
}
|
|
2031
|
+
function quoteText(ep, price, ctx) {
|
|
2032
|
+
const engines = [...new Set(ep.scenes.map((s) => s.engine))].join(", ");
|
|
2033
|
+
const seconds = ep.scenes.reduce((n, s) => n + s.shotSeconds, 0);
|
|
2034
|
+
return [
|
|
2035
|
+
`Planned "${ep.title}" (episode_id: ${ep.id}): ${ep.scenes.length} scenes, about ${Math.round(seconds)}s of picture, engine ${engines}.`,
|
|
2036
|
+
...ep.scenes.slice(0, 12).map((s, i) => ` ${i + 1}. ${s.narration.slice(0, 110)}`),
|
|
2037
|
+
...ep.scenes.length > 12 ? [` ... and ${ep.scenes.length - 12} more.`] : [],
|
|
2038
|
+
"",
|
|
2039
|
+
price ? `Nothing has been charged yet. Producing it costs about ${price.total} credits at list price: scenes ${price.scenes}, narration ${price.narration}, music ${price.music}. Each part is charged as it renders; an active sale can make it lower.` : "Nothing has been charged yet.",
|
|
2040
|
+
`Review or edit at ${ctx.baseUrl}/faceless-studio?episode=${ep.id}, or call ${call(ep.id, "produce")} to start production.`
|
|
2041
|
+
].join("\n");
|
|
2042
|
+
}
|
|
2043
|
+
async function waitForPlan(ctx, id) {
|
|
2044
|
+
const sleep = ctx.pollOverrides?.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
|
|
2045
|
+
for (let i = 0; i < PLAN_MAX_POLLS; i += 1) {
|
|
2046
|
+
await sleep(PLAN_POLL_MS);
|
|
2047
|
+
const { data } = await episodeApi(ctx, "GET", `/${id}`);
|
|
2048
|
+
if (data.episode?.plan.job?.status !== "running") return data;
|
|
2049
|
+
}
|
|
2050
|
+
return null;
|
|
2051
|
+
}
|
|
2052
|
+
async function setEngine(ctx, ep, engine) {
|
|
2053
|
+
const { data } = await episodeApi(ctx, "PATCH", `/${ep.id}`, {
|
|
2054
|
+
scenes: ep.scenes.map((s) => ({ id: s.id, narration: s.narration, visualPrompt: s.visualPrompt, engine }))
|
|
2055
|
+
});
|
|
2056
|
+
if (!data.episode) return {};
|
|
2057
|
+
return (await episodeApi(ctx, "GET", `/${ep.id}`)).data;
|
|
2058
|
+
}
|
|
2059
|
+
async function create(input, ctx) {
|
|
2060
|
+
if (!input.topic?.trim()) {
|
|
2061
|
+
return { kind: "text", text: "Provide a `topic` (8 to 400 characters) to create an episode." };
|
|
2062
|
+
}
|
|
2063
|
+
const created = await episodeApi(ctx, "POST", "", {
|
|
2064
|
+
topic: input.topic.trim(),
|
|
2065
|
+
category: input.category,
|
|
2066
|
+
format: input.aspect,
|
|
2067
|
+
targetSeconds: input.length_seconds,
|
|
2068
|
+
style: input.style,
|
|
2069
|
+
voiceId: input.voice,
|
|
2070
|
+
...input.title?.trim() ? { title: input.title.trim() } : {}
|
|
2071
|
+
});
|
|
2072
|
+
const ep = created.data.episode;
|
|
2073
|
+
if (!ep) return { kind: "text", text: `Could not create the episode: ${created.data.error ?? created.status}` };
|
|
2074
|
+
if (!input.music) await episodeApi(ctx, "PATCH", `/${ep.id}`, { musicEnabled: false });
|
|
2075
|
+
const plan2 = await episodeApi(ctx, "POST", `/${ep.id}/plan`, { scope: "episode" });
|
|
2076
|
+
if (plan2.status !== 202) {
|
|
2077
|
+
return { kind: "text", text: `Episode created (episode_id: ${ep.id}) but planning did not start: ${plan2.data.error ?? plan2.status}` };
|
|
2078
|
+
}
|
|
2079
|
+
let planned = await waitForPlan(ctx, ep.id);
|
|
2080
|
+
if (!planned) return { kind: "text", text: stillPlanning(ep.id) };
|
|
2081
|
+
if (!planned.episode || planned.episode.plan.job?.status === "error" || planned.episode.scenes.length === 0) {
|
|
2082
|
+
return { kind: "text", text: `Planning failed: ${planned.episode?.plan.job?.error ?? planned.error ?? "no scenes came back"}` };
|
|
2083
|
+
}
|
|
2084
|
+
if (input.engine) {
|
|
2085
|
+
const switched = await setEngine(ctx, planned.episode, input.engine);
|
|
2086
|
+
if (switched.episode) planned = switched;
|
|
2087
|
+
}
|
|
2088
|
+
return { kind: "text", text: quoteText(planned.episode, planned.price, ctx) };
|
|
2089
|
+
}
|
|
2090
|
+
function progress(ep) {
|
|
2091
|
+
const done = ep.scenes.filter((s) => s.render.status === "done" && s.render.url && !s.render.stale).length;
|
|
2092
|
+
const running = ep.scenes.filter((s) => s.render.status === "running").length;
|
|
2093
|
+
const narr = ep.narration?.audioUrl ? "recorded" : ep.narration?.status === "running" ? "recording" : "not recorded";
|
|
2094
|
+
const music = !ep.musicEnabled ? "off" : ep.music?.url ? "ready" : ep.music?.status ?? "not started";
|
|
2095
|
+
const exp = ep.export?.status ?? "not started";
|
|
2096
|
+
return `narration ${narr}, scenes ${done}/${ep.scenes.length}${running ? ` (${running} rendering)` : ""}, music ${music}, export ${exp}`;
|
|
2097
|
+
}
|
|
2098
|
+
async function status(id, ctx) {
|
|
2099
|
+
const { data, status: code } = await episodeApi(ctx, "GET", `/${id}`);
|
|
2100
|
+
const ep = data.episode;
|
|
2101
|
+
if (!ep) return { kind: "text", text: `Episode not found: ${data.error ?? code}` };
|
|
2102
|
+
if (ep.plan.job?.status === "running") return { kind: "text", text: stillPlanning(id) };
|
|
2103
|
+
if (ep.scenes.length === 0) {
|
|
2104
|
+
return { kind: "text", text: `"${ep.title}" has no scene plan yet${ep.plan.job?.error ? ` (${ep.plan.job.error})` : ""}. Create a new episode with action "create".` };
|
|
2105
|
+
}
|
|
2106
|
+
if (ep.export?.status === "done" && ep.export.url && ep.savedAt && !ep.export.stale) {
|
|
2107
|
+
return { kind: "text", text: `"${ep.title}" is finished: ${ep.export.url}` };
|
|
2108
|
+
}
|
|
2109
|
+
const quote = data.price ? ` Plan quote: about ${data.price.total} credits at list price.` : "";
|
|
2110
|
+
return { kind: "text", text: `"${ep.title}": ${progress(ep)}.${quote} Call ${call(id, "produce")} to keep production moving.` };
|
|
2111
|
+
}
|
|
2112
|
+
async function generate(ctx, id, path, label, regenerate = false) {
|
|
2113
|
+
const r = await episodeApi(ctx, "POST", `/${id}${path}`, regenerate ? { regenerate: true } : {});
|
|
2114
|
+
if (r.status === 200) {
|
|
2115
|
+
return { ok: true, line: `${label} started (${r.data.creditCost ?? "?"} credits).` };
|
|
2116
|
+
}
|
|
2117
|
+
return { ok: false, line: `${label} did not start: ${r.data.error ?? r.status}` };
|
|
2118
|
+
}
|
|
2119
|
+
async function produce2(id, ctx) {
|
|
2120
|
+
const { data, status: code } = await episodeApi(ctx, "GET", `/${id}`);
|
|
2121
|
+
const ep = data.episode;
|
|
2122
|
+
if (!ep) return { kind: "text", text: `Episode not found: ${data.error ?? code}` };
|
|
2123
|
+
if (ep.plan.job?.status === "running") return { kind: "text", text: stillPlanning(id) };
|
|
2124
|
+
if (ep.scenes.length === 0) {
|
|
2125
|
+
return { kind: "text", text: `"${ep.title}" has no scene plan to produce. Create a new episode with action "create".` };
|
|
2126
|
+
}
|
|
2127
|
+
if (!ep.narration?.audioUrl) {
|
|
2128
|
+
if (ep.narration?.status === "running") {
|
|
2129
|
+
return { kind: "text", text: `Narration is recording. ${next(id, "produce", "~20s")}` };
|
|
2130
|
+
}
|
|
2131
|
+
const g = await generate(ctx, id, "/narration/generate", "Narration");
|
|
2132
|
+
const failed = ep.narration?.status === "failed" ? ` (the last take failed: ${ep.narration.error ?? "unknown"})` : "";
|
|
2133
|
+
return { kind: "text", text: `${g.line}${failed} ${next(id, "produce", "~20s")}` };
|
|
2134
|
+
}
|
|
2135
|
+
const running = ep.scenes.filter((s) => s.render.status === "running").length;
|
|
2136
|
+
const queue = ep.scenes.filter(needsRender);
|
|
2137
|
+
if (queue.length > 0 || running > 0) {
|
|
2138
|
+
const lines = [];
|
|
2139
|
+
let spent = 0;
|
|
2140
|
+
for (const s of queue.slice(0, Math.max(0, MAX_IN_FLIGHT - running))) {
|
|
2141
|
+
const r = await episodeApi(ctx, "POST", `/${id}/scenes/${s.id}/generate`, {});
|
|
2142
|
+
if (r.status === 200) spent += r.data.creditCost ?? 0;
|
|
2143
|
+
else {
|
|
2144
|
+
lines.push(`Scene ${ep.scenes.indexOf(s) + 1} did not start: ${r.data.error ?? r.status}`);
|
|
2145
|
+
if (r.status === 402 || r.status === 403) break;
|
|
2146
|
+
}
|
|
2147
|
+
}
|
|
2148
|
+
const failed = ep.scenes.filter((s) => s.render.status === "failed");
|
|
2149
|
+
return {
|
|
2150
|
+
kind: "text",
|
|
2151
|
+
text: [
|
|
2152
|
+
`In progress: ${progress(ep)}.`,
|
|
2153
|
+
spent > 0 ? `Started scene renders for ${Math.round(spent * 10) / 10} credits.` : "",
|
|
2154
|
+
failed.length > 0 ? `${failed.length} scene(s) failed and were re-queued (${failed[0]?.render.error?.slice(0, 100) ?? ""}).` : "",
|
|
2155
|
+
...lines,
|
|
2156
|
+
next(id, "produce", "~30s")
|
|
2157
|
+
].filter(Boolean).join("\n")
|
|
2158
|
+
};
|
|
2159
|
+
}
|
|
2160
|
+
if (ep.musicEnabled && !ep.music?.url && ep.music?.status !== "failed") {
|
|
2161
|
+
if (ep.music?.status === "running") {
|
|
2162
|
+
return { kind: "text", text: `All scenes rendered; the music bed is composing. ${next(id, "produce", "~20s")}` };
|
|
2163
|
+
}
|
|
2164
|
+
const g = await generate(ctx, id, "/music/generate", "Music bed");
|
|
2165
|
+
return { kind: "text", text: `All scenes rendered. ${g.line} ${next(id, "produce", "~20s")}` };
|
|
2166
|
+
}
|
|
2167
|
+
const exp = ep.export;
|
|
2168
|
+
if (exp?.status === "running") {
|
|
2169
|
+
return { kind: "text", text: `Export is stitching the episode. ${next(id, "produce", "~60s")}` };
|
|
2170
|
+
}
|
|
2171
|
+
if (exp?.status === "done" && exp.url && !exp.stale) {
|
|
2172
|
+
if (ep.savedAt) return { kind: "text", text: `"${ep.title}" is finished: ${exp.url}` };
|
|
2173
|
+
const saved = await episodeApi(ctx, "POST", `/${id}/save`, {});
|
|
2174
|
+
const url = saved.data.episode?.export?.url;
|
|
2175
|
+
if (saved.status !== 200 || !url) {
|
|
2176
|
+
return { kind: "text", text: `The export is ready but could not be saved: ${saved.data.error ?? saved.status}. The draft (kept 24h): ${exp.url}. ${next(id, "produce", "~30s")}` };
|
|
2177
|
+
}
|
|
2178
|
+
return { kind: "text", text: `"${ep.title}" is finished and saved to My Media: ${url}` };
|
|
2179
|
+
}
|
|
2180
|
+
const started = await episodeApi(ctx, "POST", `/${id}/export`, {});
|
|
2181
|
+
if (started.status !== 202) {
|
|
2182
|
+
return { kind: "text", text: `Export did not start: ${started.data.error ?? started.status}. ${next(id, "produce", "~30s")}` };
|
|
2183
|
+
}
|
|
2184
|
+
const prior = exp?.status === "failed" ? ` (the last export failed: ${exp.error ?? "unknown"})` : "";
|
|
2185
|
+
const musicNote = ep.musicEnabled && ep.music?.status === "failed" ? " The music bed failed, so this cut has no music." : "";
|
|
2186
|
+
return { kind: "text", text: `Export started, free${prior}.${musicNote} ${next(id, "produce", "~60s")}` };
|
|
2187
|
+
}
|
|
2188
|
+
async function run10(input, ctx) {
|
|
2189
|
+
const action = input.action === "create" && input.episode_id ? "status" : input.action;
|
|
2190
|
+
if (action === "create") return create(input, ctx);
|
|
2191
|
+
if (!input.episode_id) return { kind: "text", text: "produce and status need the episode_id returned by the create step." };
|
|
2192
|
+
if (action === "produce") return produce2(input.episode_id, ctx);
|
|
2193
|
+
return status(input.episode_id, ctx);
|
|
2194
|
+
}
|
|
2195
|
+
var STYLES, CATEGORIES, ENGINES, MIN_SECONDS, MAX_SECONDS, MAX_IN_FLIGHT, InputSchema10, InputJsonSchema10, call, next, needsRender, PLAN_POLL_MS, PLAN_MAX_POLLS, stillPlanning, episodeSkill;
|
|
2196
|
+
var init_episode = __esm({
|
|
2197
|
+
"src/skills/episode.ts"() {
|
|
2198
|
+
STYLES = ["editorial-motion", "paper-diorama", "hand-drawn", "storybook", "poster-vector", "soft-3d"];
|
|
2199
|
+
CATEGORIES = ["education", "history", "kids", "storytelling", "custom"];
|
|
2200
|
+
ENGINES = ["omni-draft", "omni-final", "still-motion"];
|
|
2201
|
+
MIN_SECONDS = 60;
|
|
2202
|
+
MAX_SECONDS = 300;
|
|
2203
|
+
MAX_IN_FLIGHT = 4;
|
|
2204
|
+
InputSchema10 = z.object({
|
|
2205
|
+
action: z.enum(["create", "produce", "status"]).default("create"),
|
|
2206
|
+
topic: z.string().min(8).max(400).optional(),
|
|
2207
|
+
episode_id: z.string().max(40).optional(),
|
|
2208
|
+
category: z.enum(CATEGORIES).default("education"),
|
|
2209
|
+
style: z.enum(STYLES).default("editorial-motion"),
|
|
2210
|
+
aspect: z.enum(["16:9", "9:16"]).default("16:9"),
|
|
2211
|
+
length_seconds: z.number().int().min(MIN_SECONDS).max(MAX_SECONDS).default(120),
|
|
2212
|
+
voice: z.string().min(1).max(80).default("Wise_Woman"),
|
|
2213
|
+
engine: z.enum(ENGINES).optional(),
|
|
2214
|
+
music: z.boolean().default(true),
|
|
2215
|
+
title: z.string().max(120).optional()
|
|
2216
|
+
});
|
|
2217
|
+
InputJsonSchema10 = {
|
|
2218
|
+
type: "object",
|
|
2219
|
+
properties: {
|
|
2220
|
+
action: {
|
|
2221
|
+
type: "string",
|
|
2222
|
+
enum: ["create", "produce", "status"],
|
|
2223
|
+
description: "create (default, free): writes the script and scene plan, returns episode_id and the credit quote. produce (charged): advances production one step (narration, scene renders, music, export, save) and reports what that step cost; call it every ~30s until it returns the finished video URL. status (free): progress only."
|
|
2224
|
+
},
|
|
2225
|
+
topic: { type: "string", description: "Create step: what the episode is about, 8 to 400 characters." },
|
|
2226
|
+
episode_id: { type: "string", description: "The episode_id from the create step. Required for produce and status." },
|
|
2227
|
+
category: { type: "string", enum: [...CATEGORIES], description: "Create step: tone of the script. Default education." },
|
|
2228
|
+
style: { type: "string", enum: [...STYLES], description: "Create step: visual style of every scene. Default editorial-motion." },
|
|
2229
|
+
aspect: { type: "string", enum: ["16:9", "9:16"], description: "Create step: 16:9 landscape (default) or 9:16 vertical." },
|
|
2230
|
+
length_seconds: { type: "integer", minimum: MIN_SECONDS, maximum: MAX_SECONDS, description: "Create step: target length in seconds. Default 120." },
|
|
2231
|
+
voice: { type: "string", description: "Create step: narrator voice id from the text-to-speech tool (e.g. Wise_Woman, Deep_Voice_Man, Friendly_Person). Default Wise_Woman." },
|
|
2232
|
+
engine: {
|
|
2233
|
+
type: "string",
|
|
2234
|
+
enum: [...ENGINES],
|
|
2235
|
+
description: "Create step (optional): render every scene with one engine. omni-draft: fast, cheap motion preview. omni-final: full quality motion with sound. still-motion: one illustration per scene, gently panned, cheapest. Default: the style picks."
|
|
2236
|
+
},
|
|
2237
|
+
music: { type: "boolean", description: "Create step: add a music bed under the narration. Default true." },
|
|
2238
|
+
title: { type: "string", description: "Create step (optional): episode title. Defaults to the topic." }
|
|
2239
|
+
}
|
|
2240
|
+
};
|
|
2241
|
+
call = (id, action) => `pixeldojo_episode with {"episode_id": "${id}", "action": "${action}"}`;
|
|
2242
|
+
next = (id, action, wait) => `Call ${call(id, action)} in ${wait}.`;
|
|
2243
|
+
needsRender = (s) => s.render.status !== "running" && (s.render.status === "idle" || s.render.status === "failed" || Boolean(s.render.stale) || !s.render.url);
|
|
2244
|
+
PLAN_POLL_MS = 3e3;
|
|
2245
|
+
PLAN_MAX_POLLS = 8;
|
|
2246
|
+
stillPlanning = (id) => `The script is still being written (episode_id: ${id}). Nothing has been charged. ${next(id, "status", "~30s")}`;
|
|
2247
|
+
episodeSkill = {
|
|
2248
|
+
name: "pixeldojo_episode",
|
|
2249
|
+
description: "Make a finished narrated faceless video (explainer, history, kids story) from one topic: script, scene visuals, AI narration, music bed, stitched export saved to My Media. Phased: create is free and returns a credit quote; produce is charged and advances one step per call (poll every ~30s until it returns the video URL); status is free.",
|
|
2250
|
+
inputZod: InputSchema10,
|
|
2251
|
+
inputJsonSchema: InputJsonSchema10,
|
|
2252
|
+
allowedModels: [],
|
|
2253
|
+
defaultModel: "",
|
|
2254
|
+
run: run10
|
|
2255
|
+
};
|
|
2256
|
+
}
|
|
2257
|
+
});
|
|
2258
|
+
async function run11(input, ctx) {
|
|
1630
2259
|
const productImages = [
|
|
1631
2260
|
...input.product_image_urls ?? [],
|
|
1632
2261
|
...await Promise.all((input.product_image_paths ?? []).map((p) => uploadLocalFile(p, ctx)))
|
|
@@ -1669,13 +2298,13 @@ async function run9(input, ctx) {
|
|
|
1669
2298
|
(urls) => urls.length === 0 ? `Ad job ${submitted.jobId} completed but returned no assets.` : `Ad rendered (style: ${styleLabel}${submitted.ad?.product?.name ? `, product: ${submitted.ad.product.name}` : ""}). Video: ${urls[0]}`
|
|
1670
2299
|
);
|
|
1671
2300
|
}
|
|
1672
|
-
var
|
|
2301
|
+
var InputSchema11, InputJsonSchema11, adSkill;
|
|
1673
2302
|
var init_ad = __esm({
|
|
1674
2303
|
"src/skills/ad.ts"() {
|
|
1675
2304
|
init_types();
|
|
1676
2305
|
init_poll();
|
|
1677
2306
|
init_upload_helpers();
|
|
1678
|
-
|
|
2307
|
+
InputSchema11 = z.object({
|
|
1679
2308
|
style: z.string().max(80).optional().describe(
|
|
1680
2309
|
"Ad style slug (default ugc-testimonial). Catalog: GET /api/v1/marketing/presets \u2014 e.g. ugc-testimonial, unboxing-reveal, unboxing-asmr, virtual-try-on, street-style, product-showcase, macro-details, crush-test, hyper-motion, before-after, day-in-the-life, the-gift, tv-spot."
|
|
1681
2310
|
),
|
|
@@ -1701,7 +2330,7 @@ var init_ad = __esm({
|
|
|
1701
2330
|
path: ["product_url"]
|
|
1702
2331
|
}
|
|
1703
2332
|
);
|
|
1704
|
-
|
|
2333
|
+
InputJsonSchema11 = {
|
|
1705
2334
|
type: "object",
|
|
1706
2335
|
properties: {
|
|
1707
2336
|
style: {
|
|
@@ -1788,16 +2417,16 @@ var init_ad = __esm({
|
|
|
1788
2417
|
name: "pixeldojo_ad",
|
|
1789
2418
|
description: "Marketing Studio: turn a product into a rendered video ad with voiceover. Requires `product_url` (name, description and images are extracted), or `product_name` plus product_image_urls / product_image_paths. Pick a `style` slug (default ugc-testimonial; full catalog at GET https://pixeldojo.ai/api/v1/marketing/presets), and optionally add presenter reference images, a location, a hook, and the exact spoken script. Returns the video URL, or a jobId to check with pixeldojo_status.",
|
|
1790
2419
|
hostedDescription: "Marketing Studio: turn a product into a rendered video ad with voiceover. Requires `product_url` (name, description and images are extracted), or `product_name` plus product_image_urls (public http(s) URLs). Pick a `style` slug (default ugc-testimonial; full catalog at GET https://pixeldojo.ai/api/v1/marketing/presets), and optionally add presenter reference images, a location, a hook, and the exact spoken script. Returns the video URL, or a jobId to check with pixeldojo_status.",
|
|
1791
|
-
inputZod:
|
|
1792
|
-
inputJsonSchema:
|
|
2420
|
+
inputZod: InputSchema11,
|
|
2421
|
+
inputJsonSchema: InputJsonSchema11,
|
|
1793
2422
|
// Composition skill — the server routes to the ad engine internally.
|
|
1794
2423
|
allowedModels: [],
|
|
1795
2424
|
defaultModel: "",
|
|
1796
|
-
run:
|
|
2425
|
+
run: run11
|
|
1797
2426
|
};
|
|
1798
2427
|
}
|
|
1799
2428
|
});
|
|
1800
|
-
async function
|
|
2429
|
+
async function run12(input, ctx) {
|
|
1801
2430
|
const client = ctx.client;
|
|
1802
2431
|
const result = await client.runCampaign(input);
|
|
1803
2432
|
if (result.kind === "campaign") {
|
|
@@ -1824,10 +2453,10 @@ async function run10(input, ctx) {
|
|
|
1824
2453
|
statusUrl: result.statusUrl ?? ctx.buildStatusUrl(result.campaignId)
|
|
1825
2454
|
};
|
|
1826
2455
|
}
|
|
1827
|
-
var
|
|
2456
|
+
var InputSchema12, InputJsonSchema12, campaignSkill;
|
|
1828
2457
|
var init_campaign = __esm({
|
|
1829
2458
|
"src/skills/campaign.ts"() {
|
|
1830
|
-
|
|
2459
|
+
InputSchema12 = z.object({
|
|
1831
2460
|
productUrl: z.string().url().optional().describe("Product page URL. We extract name + description + images automatically."),
|
|
1832
2461
|
product: z.object({
|
|
1833
2462
|
name: z.string().min(1).max(200),
|
|
@@ -1843,7 +2472,7 @@ var init_campaign = __esm({
|
|
|
1843
2472
|
message: "productUrl or product is required",
|
|
1844
2473
|
path: ["productUrl"]
|
|
1845
2474
|
});
|
|
1846
|
-
|
|
2475
|
+
InputJsonSchema12 = {
|
|
1847
2476
|
type: "object",
|
|
1848
2477
|
properties: {
|
|
1849
2478
|
productUrl: {
|
|
@@ -1894,17 +2523,17 @@ var init_campaign = __esm({
|
|
|
1894
2523
|
campaignSkill = {
|
|
1895
2524
|
name: "pixeldojo_campaign",
|
|
1896
2525
|
description: "Generate a coherent product launch package (hero image + N lifestyle variants + optional vertical video) from one URL or product profile. Composes hero / lifestyle / video models server-side; returns assets in one call or a handoff with campaignId to poll via pixeldojo_campaign_status.",
|
|
1897
|
-
inputZod:
|
|
1898
|
-
inputJsonSchema:
|
|
2526
|
+
inputZod: InputSchema12,
|
|
2527
|
+
inputJsonSchema: InputJsonSchema12,
|
|
1899
2528
|
// Composition skill — internal sub-jobs route to per-tool models, no
|
|
1900
2529
|
// single allowed-models list applies here.
|
|
1901
2530
|
allowedModels: [],
|
|
1902
2531
|
defaultModel: "",
|
|
1903
|
-
run:
|
|
2532
|
+
run: run12
|
|
1904
2533
|
};
|
|
1905
2534
|
}
|
|
1906
2535
|
});
|
|
1907
|
-
async function
|
|
2536
|
+
async function run13(input, ctx) {
|
|
1908
2537
|
const client = ctx.client;
|
|
1909
2538
|
const result = await client.getCampaign(input.campaignId);
|
|
1910
2539
|
if (result.kind === "campaign") {
|
|
@@ -1934,13 +2563,13 @@ async function run11(input, ctx) {
|
|
|
1934
2563
|
statusUrl: result.statusUrl ?? ctx.buildStatusUrl(result.campaignId)
|
|
1935
2564
|
};
|
|
1936
2565
|
}
|
|
1937
|
-
var
|
|
2566
|
+
var InputSchema13, InputJsonSchema13, campaignStatusSkill;
|
|
1938
2567
|
var init_campaign_status = __esm({
|
|
1939
2568
|
"src/skills/campaign-status.ts"() {
|
|
1940
|
-
|
|
2569
|
+
InputSchema13 = z.object({
|
|
1941
2570
|
campaignId: z.string().min(1).max(200).describe("Campaign id returned from a prior pixeldojo_campaign handoff.")
|
|
1942
2571
|
});
|
|
1943
|
-
|
|
2572
|
+
InputJsonSchema13 = {
|
|
1944
2573
|
type: "object",
|
|
1945
2574
|
properties: {
|
|
1946
2575
|
campaignId: {
|
|
@@ -1953,15 +2582,15 @@ var init_campaign_status = __esm({
|
|
|
1953
2582
|
campaignStatusSkill = {
|
|
1954
2583
|
name: "pixeldojo_campaign_status",
|
|
1955
2584
|
description: "Poll a campaign by campaignId returned from pixeldojo_campaign. Returns assets when every sub-job is done, or a handoff describing what is still in flight.",
|
|
1956
|
-
inputZod:
|
|
1957
|
-
inputJsonSchema:
|
|
2585
|
+
inputZod: InputSchema13,
|
|
2586
|
+
inputJsonSchema: InputJsonSchema13,
|
|
1958
2587
|
allowedModels: [],
|
|
1959
2588
|
defaultModel: "",
|
|
1960
|
-
run:
|
|
2589
|
+
run: run13
|
|
1961
2590
|
};
|
|
1962
2591
|
}
|
|
1963
2592
|
});
|
|
1964
|
-
async function
|
|
2593
|
+
async function run14(input, ctx) {
|
|
1965
2594
|
let url;
|
|
1966
2595
|
try {
|
|
1967
2596
|
url = await uploadLocalFile(input.path, ctx);
|
|
@@ -1974,40 +2603,40 @@ async function run12(input, ctx) {
|
|
|
1974
2603
|
return {
|
|
1975
2604
|
kind: "text",
|
|
1976
2605
|
text: `Uploaded ${basename(input.path)} \u2192 ${url}
|
|
1977
|
-
(temp storage; auto-deletes in ~24h. Pass this URL as image_url,
|
|
2606
|
+
(temp storage; auto-deletes in ~24h. Pass this URL as image_url, video_url for a clip, or song_url on pixeldojo_film for a song, to any pixeldojo tool that takes one.)`
|
|
1978
2607
|
};
|
|
1979
2608
|
}
|
|
1980
|
-
var
|
|
2609
|
+
var InputSchema14, InputJsonSchema14, uploadSkill;
|
|
1981
2610
|
var init_upload = __esm({
|
|
1982
2611
|
"src/skills/upload.ts"() {
|
|
1983
2612
|
init_upload_helpers();
|
|
1984
|
-
|
|
2613
|
+
InputSchema14 = z.object({
|
|
1985
2614
|
path: z.string().min(1).max(4096).describe(
|
|
1986
|
-
"Absolute local file path to upload. JPEG, PNG, WebP, GIF (\u226450MB)
|
|
2615
|
+
"Absolute local file path to upload. JPEG, PNG, WebP, GIF (\u226450MB), MP4, WebM, MOV (\u2264200MB) or MP3, WAV, M4A, AAC, OGG, FLAC audio (\u226450MB). Returns a public URL on the temp CDN; storage auto-expires after 24 hours."
|
|
1987
2616
|
)
|
|
1988
2617
|
});
|
|
1989
|
-
|
|
2618
|
+
InputJsonSchema14 = {
|
|
1990
2619
|
type: "object",
|
|
1991
2620
|
properties: {
|
|
1992
2621
|
path: {
|
|
1993
2622
|
type: "string",
|
|
1994
|
-
description: "Absolute local file path. Allowed: JPEG, PNG, WebP, GIF (\u226450MB)
|
|
2623
|
+
description: "Absolute local file path. Allowed: JPEG, PNG, WebP, GIF (\u226450MB), MP4, WebM, MOV (\u2264200MB) or MP3, WAV, M4A, AAC, OGG, FLAC audio (\u226450MB). Returns a public URL on the temp CDN; auto-expires after 24h."
|
|
1995
2624
|
}
|
|
1996
2625
|
},
|
|
1997
2626
|
required: ["path"]
|
|
1998
2627
|
};
|
|
1999
2628
|
uploadSkill = {
|
|
2000
2629
|
name: "pixeldojo_upload",
|
|
2001
|
-
description: "Upload a local image or
|
|
2002
|
-
inputZod:
|
|
2003
|
-
inputJsonSchema:
|
|
2630
|
+
description: "Upload a local image, video or audio file (JPEG, PNG, WebP, GIF up to 50MB; MP4, WebM, MOV up to 200MB; MP3, WAV, M4A, AAC, OGG, FLAC up to 50MB) and get back a public URL that expires after 24 hours. Free. Pass an audio URL as song_url to pixeldojo_film for a music video. Pass the URL as image_url (stills) or video_url (clips) to tools that take hosted URLs only, such as pixeldojo_character, pixeldojo_storyboard and pixeldojo_upscale. pixeldojo_generate, pixeldojo_edit and pixeldojo_ad take local paths directly and need no separate upload.",
|
|
2631
|
+
inputZod: InputSchema14,
|
|
2632
|
+
inputJsonSchema: InputJsonSchema14,
|
|
2004
2633
|
allowedModels: [],
|
|
2005
2634
|
defaultModel: "",
|
|
2006
|
-
run:
|
|
2635
|
+
run: run14
|
|
2007
2636
|
};
|
|
2008
2637
|
}
|
|
2009
2638
|
});
|
|
2010
|
-
async function
|
|
2639
|
+
async function run15(input, ctx) {
|
|
2011
2640
|
const requested = input.model ?? DEFAULT_MODEL6;
|
|
2012
2641
|
if (!ALLOWED4.includes(requested)) {
|
|
2013
2642
|
return {
|
|
@@ -2045,14 +2674,14 @@ async function run13(input, ctx) {
|
|
|
2045
2674
|
(urls) => urls.length === 0 ? `Job ${submitted.jobId} completed but returned no assets.` : `Audio ready. Asset: ${urls[0]}`
|
|
2046
2675
|
);
|
|
2047
2676
|
}
|
|
2048
|
-
var ALLOWED4, DEFAULT_MODEL6,
|
|
2677
|
+
var ALLOWED4, DEFAULT_MODEL6, InputSchema15, InputJsonSchema15, audioSkill;
|
|
2049
2678
|
var init_audio = __esm({
|
|
2050
2679
|
"src/skills/audio.ts"() {
|
|
2051
2680
|
init_poll();
|
|
2052
2681
|
init_types();
|
|
2053
2682
|
ALLOWED4 = ["seed-audio", "text-to-speech"];
|
|
2054
2683
|
DEFAULT_MODEL6 = "seed-audio";
|
|
2055
|
-
|
|
2684
|
+
InputSchema15 = z.object({
|
|
2056
2685
|
prompt: z.string().min(1).describe(
|
|
2057
2686
|
"seed-audio: a script to speak, or a scene description (dialogue, sound effects, music), up to 2048 characters; refer to audio_urls clips in order as @Audio1..@Audio3. text-to-speech: the exact text to speak, up to 10,000 characters."
|
|
2058
2687
|
),
|
|
@@ -2062,7 +2691,7 @@ var init_audio = __esm({
|
|
|
2062
2691
|
output_format: z.string().optional().describe("Output format. seed-audio: mp3 (default), wav, pcm, ogg_opus. text-to-speech: mp3 (default), wav, flac, pcm."),
|
|
2063
2692
|
speed: z.number().min(0.5).max(2).optional().describe("Speech speed multiplier, 0.5-2 (default 1). Both models.")
|
|
2064
2693
|
});
|
|
2065
|
-
|
|
2694
|
+
InputJsonSchema15 = {
|
|
2066
2695
|
type: "object",
|
|
2067
2696
|
properties: {
|
|
2068
2697
|
prompt: {
|
|
@@ -2100,15 +2729,15 @@ var init_audio = __esm({
|
|
|
2100
2729
|
audioSkill = {
|
|
2101
2730
|
name: "pixeldojo_audio",
|
|
2102
2731
|
description: "Generate audio: speech, multi-character dialogue, sound effects, and background music from one prompt (Seed Audio 1.0 by default; plain text-to-speech available). Voice cloning takes hosted reference clip URLs in audio_urls; local audio files are not accepted. Returns an audio URL, or a jobId for pixeldojo_status.",
|
|
2103
|
-
inputZod:
|
|
2104
|
-
inputJsonSchema:
|
|
2732
|
+
inputZod: InputSchema15,
|
|
2733
|
+
inputJsonSchema: InputJsonSchema15,
|
|
2105
2734
|
allowedModels: [...ALLOWED4],
|
|
2106
2735
|
defaultModel: DEFAULT_MODEL6,
|
|
2107
|
-
run:
|
|
2736
|
+
run: run15
|
|
2108
2737
|
};
|
|
2109
2738
|
}
|
|
2110
2739
|
});
|
|
2111
|
-
async function
|
|
2740
|
+
async function run16(input, ctx) {
|
|
2112
2741
|
const res = await ctx.client.listLibrary({
|
|
2113
2742
|
q: input.q,
|
|
2114
2743
|
model: input.model,
|
|
@@ -2139,16 +2768,16 @@ ${lines.join("\n")}
|
|
|
2139
2768
|
Pass any URL back into pixeldojo_generate, pixeldojo_edit, pixeldojo_character, or pixeldojo_upscale as a reference input.`
|
|
2140
2769
|
};
|
|
2141
2770
|
}
|
|
2142
|
-
var
|
|
2771
|
+
var InputSchema16, InputJsonSchema16, librarySkill;
|
|
2143
2772
|
var init_library = __esm({
|
|
2144
2773
|
"src/skills/library.ts"() {
|
|
2145
|
-
|
|
2774
|
+
InputSchema16 = z.object({
|
|
2146
2775
|
q: z.string().optional().describe("Substring match against the prompt that produced the asset."),
|
|
2147
2776
|
model: z.string().optional().describe("Restrict to a single model (apiId)."),
|
|
2148
2777
|
modality: z.enum(["image", "video", "audio"]).optional().describe("Restrict to one output type."),
|
|
2149
2778
|
limit: z.number().int().min(1).max(50).optional().describe("Max results (default 10).")
|
|
2150
2779
|
});
|
|
2151
|
-
|
|
2780
|
+
InputJsonSchema16 = {
|
|
2152
2781
|
type: "object",
|
|
2153
2782
|
properties: {
|
|
2154
2783
|
q: {
|
|
@@ -2168,11 +2797,11 @@ var init_library = __esm({
|
|
|
2168
2797
|
librarySkill = {
|
|
2169
2798
|
name: "pixeldojo_library",
|
|
2170
2799
|
description: "Search your media library: saved My Media items (permanent) and recent API/MCP generations (deleted 1 hour after they finish), newest first. Returns asset URLs to reuse as reference inputs.",
|
|
2171
|
-
inputZod:
|
|
2172
|
-
inputJsonSchema:
|
|
2800
|
+
inputZod: InputSchema16,
|
|
2801
|
+
inputJsonSchema: InputJsonSchema16,
|
|
2173
2802
|
allowedModels: [],
|
|
2174
2803
|
defaultModel: "",
|
|
2175
|
-
run:
|
|
2804
|
+
run: run16
|
|
2176
2805
|
};
|
|
2177
2806
|
}
|
|
2178
2807
|
});
|
|
@@ -2422,6 +3051,7 @@ __export(skills_exports, {
|
|
|
2422
3051
|
campaignStatusSkill: () => campaignStatusSkill,
|
|
2423
3052
|
characterSkill: () => characterSkill,
|
|
2424
3053
|
editSkill: () => editSkill,
|
|
3054
|
+
episodeSkill: () => episodeSkill,
|
|
2425
3055
|
filmSkill: () => filmSkill,
|
|
2426
3056
|
findHostedSkill: () => findHostedSkill,
|
|
2427
3057
|
findSkill: () => findSkill,
|
|
@@ -2434,7 +3064,8 @@ __export(skills_exports, {
|
|
|
2434
3064
|
statusSkill: () => statusSkill,
|
|
2435
3065
|
storyboardSkill: () => storyboardSkill,
|
|
2436
3066
|
uploadSkill: () => uploadSkill,
|
|
2437
|
-
upscaleSkill: () => upscaleSkill
|
|
3067
|
+
upscaleSkill: () => upscaleSkill,
|
|
3068
|
+
videoSkill: () => videoSkill
|
|
2438
3069
|
});
|
|
2439
3070
|
function findHostedSkill(name) {
|
|
2440
3071
|
const wanted = name.replace(/^pixeldojo:/, "pixeldojo_");
|
|
@@ -2455,6 +3086,8 @@ var init_skills = __esm({
|
|
|
2455
3086
|
init_status();
|
|
2456
3087
|
init_from_url();
|
|
2457
3088
|
init_film();
|
|
3089
|
+
init_video();
|
|
3090
|
+
init_episode();
|
|
2458
3091
|
init_ad();
|
|
2459
3092
|
init_campaign();
|
|
2460
3093
|
init_campaign_status();
|
|
@@ -2479,7 +3112,9 @@ var init_skills = __esm({
|
|
|
2479
3112
|
adSkill,
|
|
2480
3113
|
campaignSkill,
|
|
2481
3114
|
campaignStatusSkill,
|
|
2482
|
-
filmSkill
|
|
3115
|
+
filmSkill,
|
|
3116
|
+
videoSkill,
|
|
3117
|
+
episodeSkill
|
|
2483
3118
|
];
|
|
2484
3119
|
isLocalPathField = (key) => /_paths?$/.test(key);
|
|
2485
3120
|
HOSTED_SKILLS = ALL_SKILLS.filter(
|