@pixeldojo/mcp 0.14.0 → 0.15.1
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 +728 -88
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +728 -88
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +728 -88
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +728 -88
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -142,12 +142,13 @@ async function uploadLocalFile(path$1, ctx) {
|
|
|
142
142
|
);
|
|
143
143
|
}
|
|
144
144
|
const isImage = mime.startsWith("image/");
|
|
145
|
-
const
|
|
145
|
+
const isAudio = mime.startsWith("audio/");
|
|
146
|
+
const limit = isImage ? MAX_IMAGE_BYTES : isAudio ? MAX_AUDIO_BYTES : MAX_VIDEO_BYTES;
|
|
146
147
|
if (size > limit) {
|
|
147
148
|
const gotMB = (size / 1024 / 1024).toFixed(1);
|
|
148
149
|
const limitMB = (limit / 1024 / 1024).toFixed(0);
|
|
149
150
|
throw new SkillUploadError(
|
|
150
|
-
`"${path.basename(path$1)}" is ${gotMB}MB; limit for ${isImage ? "images" : "videos"} is ${limitMB}MB. Downscale or re-encode and try again.`
|
|
151
|
+
`"${path.basename(path$1)}" is ${gotMB}MB; limit for ${isImage ? "images" : isAudio ? "audio" : "videos"} is ${limitMB}MB. Downscale or re-encode and try again.`
|
|
151
152
|
);
|
|
152
153
|
}
|
|
153
154
|
const buffer = await promises.readFile(path$1);
|
|
@@ -159,11 +160,12 @@ async function uploadLocalFile(path$1, ctx) {
|
|
|
159
160
|
async function uploadLocalFiles(paths, ctx) {
|
|
160
161
|
return Promise.all(paths.map((p) => uploadLocalFile(p, ctx)));
|
|
161
162
|
}
|
|
162
|
-
var MAX_IMAGE_BYTES, MAX_VIDEO_BYTES, EXT_TO_MIME, SkillUploadError, HOSTED_LOCAL_PATH_MESSAGE;
|
|
163
|
+
var MAX_IMAGE_BYTES, MAX_VIDEO_BYTES, MAX_AUDIO_BYTES, EXT_TO_MIME, SkillUploadError, HOSTED_LOCAL_PATH_MESSAGE;
|
|
163
164
|
var init_upload_helpers = __esm({
|
|
164
165
|
"src/skills/upload-helpers.ts"() {
|
|
165
166
|
MAX_IMAGE_BYTES = 50 * 1024 * 1024;
|
|
166
167
|
MAX_VIDEO_BYTES = 200 * 1024 * 1024;
|
|
168
|
+
MAX_AUDIO_BYTES = 50 * 1024 * 1024;
|
|
167
169
|
EXT_TO_MIME = {
|
|
168
170
|
".jpg": "image/jpeg",
|
|
169
171
|
".jpeg": "image/jpeg",
|
|
@@ -172,7 +174,14 @@ var init_upload_helpers = __esm({
|
|
|
172
174
|
".gif": "image/gif",
|
|
173
175
|
".mp4": "video/mp4",
|
|
174
176
|
".webm": "video/webm",
|
|
175
|
-
".mov": "video/quicktime"
|
|
177
|
+
".mov": "video/quicktime",
|
|
178
|
+
// Audio: the server checks the bytes match (a Film Studio song, song_path).
|
|
179
|
+
".mp3": "audio/mpeg",
|
|
180
|
+
".wav": "audio/wav",
|
|
181
|
+
".m4a": "audio/mp4",
|
|
182
|
+
".aac": "audio/aac",
|
|
183
|
+
".ogg": "audio/ogg",
|
|
184
|
+
".flac": "audio/flac"
|
|
176
185
|
};
|
|
177
186
|
SkillUploadError = class extends Error {
|
|
178
187
|
constructor(userMessage) {
|
|
@@ -542,7 +551,7 @@ var init_generate = __esm({
|
|
|
542
551
|
InputSchema = zod.z.object({
|
|
543
552
|
prompt: zod.z.string().min(1).max(8e3).describe("Prompt describing what to generate."),
|
|
544
553
|
model: zod.z.string().optional().describe(
|
|
545
|
-
`Model apiId. Recommended: "seedream-5"
|
|
554
|
+
`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.`
|
|
546
555
|
),
|
|
547
556
|
preset: zod.z.string().optional().describe(
|
|
548
557
|
"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."
|
|
@@ -581,7 +590,7 @@ var init_generate = __esm({
|
|
|
581
590
|
prompt: { type: "string", description: "Prompt describing what to generate." },
|
|
582
591
|
model: {
|
|
583
592
|
type: "string",
|
|
584
|
-
description: `Model apiId. Recommended: "seedream-5"
|
|
593
|
+
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.`
|
|
585
594
|
},
|
|
586
595
|
preset: {
|
|
587
596
|
type: "string",
|
|
@@ -629,8 +638,8 @@ var init_generate = __esm({
|
|
|
629
638
|
};
|
|
630
639
|
generateSkill = {
|
|
631
640
|
name: "pixeldojo_generate",
|
|
632
|
-
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
|
|
633
|
-
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
|
|
641
|
+
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.",
|
|
642
|
+
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.",
|
|
634
643
|
inputZod: InputSchema,
|
|
635
644
|
inputJsonSchema: InputJsonSchema,
|
|
636
645
|
allowedModels: null,
|
|
@@ -914,6 +923,7 @@ var init_character = __esm({
|
|
|
914
923
|
"seedream-4",
|
|
915
924
|
"google-nano-banana",
|
|
916
925
|
"wan-2.7-image-edit",
|
|
926
|
+
"qwen-3-pro",
|
|
917
927
|
"qwen-image-2.0-pro"
|
|
918
928
|
];
|
|
919
929
|
DEFAULT_MODEL3 = "seedream-5";
|
|
@@ -924,6 +934,7 @@ var init_character = __esm({
|
|
|
924
934
|
"seedream-4": "image_urls",
|
|
925
935
|
"google-nano-banana": "image_input",
|
|
926
936
|
"wan-2.7-image-edit": "image_urls",
|
|
937
|
+
"qwen-3-pro": "image",
|
|
927
938
|
"qwen-image-2.0-pro": "reference_images"
|
|
928
939
|
};
|
|
929
940
|
InputSchema3 = zod.z.object({
|
|
@@ -1399,43 +1410,124 @@ function progressLine(f) {
|
|
|
1399
1410
|
const rendering = all.filter((sh) => sh.status === "clip-generating").length;
|
|
1400
1411
|
return `frames ${frames}/${all.length}, clips ${clips}/${all.length}${rendering > 0 ? ` (${rendering} rendering)` : ""}`;
|
|
1401
1412
|
}
|
|
1413
|
+
async function runPlanner(ctx, filmId, path, body, maxPolls = PLANNER_MAX_POLLS) {
|
|
1414
|
+
const submit = await filmApi(ctx, "POST", path, body);
|
|
1415
|
+
if (submit.data.film) return { film: submit.data.film };
|
|
1416
|
+
const jobId = submit.data.jobId;
|
|
1417
|
+
if (!jobId) return { error: submit.data.error ?? `HTTP ${submit.status}` };
|
|
1418
|
+
const sleep = ctx.pollOverrides?.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
|
|
1419
|
+
for (let i = 0; i < maxPolls; i += 1) {
|
|
1420
|
+
await sleep(PLANNER_POLL_MS);
|
|
1421
|
+
const { data } = await filmApi(ctx, "GET", `/api/films/${filmId}`);
|
|
1422
|
+
const job = data.film?.llmJob;
|
|
1423
|
+
if (!data.film || job?.id !== jobId) continue;
|
|
1424
|
+
if (job.status === "error") return { error: job.error ?? "the run failed" };
|
|
1425
|
+
if (job.status === "done") return { film: data.film };
|
|
1426
|
+
}
|
|
1427
|
+
return { pending: true };
|
|
1428
|
+
}
|
|
1429
|
+
async function sliceSong(ctx, film) {
|
|
1430
|
+
const r = await filmApi(ctx, "POST", `/api/films/${film.id}/music/slice`, {
|
|
1431
|
+
songDurationSec: film.musicDurationSec
|
|
1432
|
+
});
|
|
1433
|
+
return r.status === 200 ? null : `Could not cut the song into shots: ${r.data.error ?? r.status}`;
|
|
1434
|
+
}
|
|
1435
|
+
function plannedText(film, ctx) {
|
|
1436
|
+
const total = shots(film).length;
|
|
1437
|
+
const music = isMusicVideo(film);
|
|
1438
|
+
const sceneLines = film.scenes.map((s, i) => ` Scene ${i + 1} "${s.title}"${s.location ? ` [${s.location}]` : ""}: ${s.shots.length} shots`);
|
|
1439
|
+
return [
|
|
1440
|
+
`Planned ${music ? "music video " : ""}"${film.title}" (film_id: ${film.id}): ${film.scenes.length} scenes, ${total} shots, ${film.look}, ${film.aspect}.`,
|
|
1441
|
+
...sceneLines,
|
|
1442
|
+
"",
|
|
1443
|
+
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.`,
|
|
1444
|
+
`Review or edit at ${ctx.baseUrl}/film-studio/${film.id}, or call pixeldojo_film with {"film_id": "${film.id}", "action": "produce"} to start production.`
|
|
1445
|
+
].join("\n");
|
|
1446
|
+
}
|
|
1402
1447
|
async function plan(input, ctx) {
|
|
1448
|
+
const music = Boolean(input.song_url || input.song_path);
|
|
1403
1449
|
if (!input.idea?.trim() && !input.script?.trim()) {
|
|
1404
|
-
return {
|
|
1450
|
+
return {
|
|
1451
|
+
kind: "text",
|
|
1452
|
+
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."
|
|
1453
|
+
};
|
|
1454
|
+
}
|
|
1455
|
+
if (input.song_path && !input.song_url) {
|
|
1456
|
+
try {
|
|
1457
|
+
input = { ...input, song_url: await uploadLocalFile(input.song_path, ctx) };
|
|
1458
|
+
} catch (err) {
|
|
1459
|
+
if (err instanceof SkillUploadError) return { kind: "text", text: `Could not upload the song: ${err.userMessage}` };
|
|
1460
|
+
throw err;
|
|
1461
|
+
}
|
|
1405
1462
|
}
|
|
1406
1463
|
const created = await filmApi(ctx, "POST", "/api/films", {
|
|
1407
1464
|
aspect: input.aspect,
|
|
1408
|
-
look: input.look,
|
|
1465
|
+
look: input.look ?? (music ? MUSIC_VIDEO_LOOKS[0] : "live-action"),
|
|
1409
1466
|
lengthTarget: input.length,
|
|
1410
|
-
assetIds: []
|
|
1467
|
+
assetIds: [],
|
|
1468
|
+
...music ? {
|
|
1469
|
+
// No script step names a music video, so it would stay "Untitled film".
|
|
1470
|
+
...input.idea?.trim() ? { title: input.idea.trim().slice(0, 80) } : {},
|
|
1471
|
+
musicVideoMode: true,
|
|
1472
|
+
musicUrl: input.song_url,
|
|
1473
|
+
...input.song_duration_sec ? { musicDurationSec: input.song_duration_sec } : {},
|
|
1474
|
+
clipEngine: MUSIC_CLIP_ENGINE_ID
|
|
1475
|
+
} : {}
|
|
1411
1476
|
});
|
|
1412
1477
|
if (!created.data.film) return { kind: "text", text: `Could not create the film: ${created.data.error ?? created.status}` };
|
|
1413
1478
|
const id = created.data.film.id;
|
|
1414
|
-
let
|
|
1415
|
-
if (
|
|
1416
|
-
const
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
}
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1479
|
+
let planned;
|
|
1480
|
+
if (music) {
|
|
1481
|
+
const brief = [input.idea?.trim() || input.script.trim(), input.lyrics?.trim() ? `Lyrics:
|
|
1482
|
+
${input.lyrics.trim()}` : ""].filter(Boolean).join("\n\n");
|
|
1483
|
+
planned = await runPlanner(ctx, id, `/api/films/${id}/plan`, { script: brief });
|
|
1484
|
+
} else {
|
|
1485
|
+
let script = input.script?.trim() ?? "";
|
|
1486
|
+
if (!script) {
|
|
1487
|
+
const wrote = await runPlanner(ctx, id, `/api/films/${id}/script`, { idea: input.idea.trim() });
|
|
1488
|
+
if ("pending" in wrote) return { kind: "text", text: stillPlanningText(id, "script") };
|
|
1489
|
+
if ("error" in wrote) return { kind: "text", text: `Script writing failed: ${wrote.error}` };
|
|
1490
|
+
script = wrote.film.script ?? "";
|
|
1491
|
+
if (!script) return { kind: "text", text: "Script writing failed: the studio returned an empty script." };
|
|
1492
|
+
}
|
|
1493
|
+
planned = await runPlanner(ctx, id, `/api/films/${id}/plan`, { script });
|
|
1494
|
+
}
|
|
1495
|
+
if ("pending" in planned) return { kind: "text", text: stillPlanningText(id) };
|
|
1496
|
+
if ("error" in planned) return { kind: "text", text: `Shot planning failed: ${planned.error}` };
|
|
1497
|
+
const film = planned.film;
|
|
1498
|
+
if (needsSlice(film)) {
|
|
1499
|
+
const err = await sliceSong(ctx, film);
|
|
1500
|
+
if (err) return { kind: "text", text: `${plannedText(film, ctx)}
|
|
1501
|
+
|
|
1502
|
+
${err} Call action "status" to retry the cut.` };
|
|
1503
|
+
}
|
|
1504
|
+
return { kind: "text", text: plannedText(film, ctx) };
|
|
1505
|
+
}
|
|
1506
|
+
async function resumePlanning(film, ctx) {
|
|
1507
|
+
if (film.scenes.length > 0 && film.llmJob?.status !== "running") return null;
|
|
1508
|
+
if (film.llmJob?.status === "running") {
|
|
1509
|
+
return { kind: "text", text: stillPlanningText(film.id, film.llmJob.kind === "script" ? "script" : "plan") };
|
|
1510
|
+
}
|
|
1511
|
+
const prior = film.llmJob?.status === "error" ? `The last planning run failed (${film.llmJob.error ?? "unknown"}). ` : "";
|
|
1512
|
+
if (!film.script?.trim()) {
|
|
1513
|
+
return { kind: "text", text: `${prior}This film has nothing to plan from. Start a new one with action "plan".` };
|
|
1514
|
+
}
|
|
1515
|
+
const planned = await runPlanner(ctx, film.id, `/api/films/${film.id}/plan`, { script: film.script }, 0);
|
|
1516
|
+
if ("pending" in planned) return { kind: "text", text: `${prior}${stillPlanningText(film.id)}` };
|
|
1517
|
+
if ("error" in planned) return { kind: "text", text: `Shot planning failed: ${planned.error} Call action "status" to retry.` };
|
|
1518
|
+
if (needsSlice(planned.film)) {
|
|
1519
|
+
const err = await sliceSong(ctx, planned.film);
|
|
1520
|
+
if (err) return { kind: "text", text: `${plannedText(planned.film, ctx)}
|
|
1521
|
+
|
|
1522
|
+
${err} Call action "status" to retry the cut.` };
|
|
1523
|
+
}
|
|
1524
|
+
return { kind: "text", text: plannedText(planned.film, ctx) };
|
|
1435
1525
|
}
|
|
1436
1526
|
async function produce(filmId, ctx) {
|
|
1437
1527
|
const { data } = await filmApi(ctx, "GET", `/api/films/${filmId}`);
|
|
1438
1528
|
if (!data.film) return { kind: "text", text: `Film not found: ${data.error ?? filmId}` };
|
|
1529
|
+
const planning = await resumePlanning(data.film, ctx);
|
|
1530
|
+
if (planning) return planning;
|
|
1439
1531
|
const pending = shots(data.film).filter((sh) => sh.status === "idle" || sh.status === "failed" && !sh.frameUrl);
|
|
1440
1532
|
let fired = 0;
|
|
1441
1533
|
for (const sh of pending.slice(0, 6)) {
|
|
@@ -1499,6 +1591,16 @@ It is saved in the Library folder "Film: ${film.title}".`
|
|
|
1499
1591
|
if (film.exportError) {
|
|
1500
1592
|
return { kind: "text", text: `Export failed: ${film.exportError} Poll again with action "status" to retry.` };
|
|
1501
1593
|
}
|
|
1594
|
+
const planning = await resumePlanning(film, ctx);
|
|
1595
|
+
if (planning) return planning;
|
|
1596
|
+
if (needsSlice(film)) {
|
|
1597
|
+
const err = await sliceSong(ctx, film);
|
|
1598
|
+
if (err) return { kind: "text", text: `${err} Poll again with action "status" to retry.` };
|
|
1599
|
+
return { kind: "text", text: `Song cut into one slice per shot. Poll again with {"film_id": "${filmId}", "action": "status"} to keep production moving.` };
|
|
1600
|
+
}
|
|
1601
|
+
if (shots(film).length > 0 && shots(film).every((sh) => sh.status === "idle")) {
|
|
1602
|
+
return { kind: "text", text: plannedText(film, ctx) };
|
|
1603
|
+
}
|
|
1502
1604
|
const idleFrames = all.filter((sh) => sh.status === "idle");
|
|
1503
1605
|
for (const sh of idleFrames.slice(0, 6)) {
|
|
1504
1606
|
await filmApi(ctx, "POST", `/api/films/${filmId}/shots/${sh.id}/generate`, { kind: "frame" });
|
|
@@ -1518,7 +1620,7 @@ It is saved in the Library folder "Film: ${film.title}".`
|
|
|
1518
1620
|
await filmApi(ctx, "POST", `/api/films/${filmId}/save`, { kind: "clip" });
|
|
1519
1621
|
}
|
|
1520
1622
|
const hasMusic = film.audioStems.some((st) => st.kind === "music");
|
|
1521
|
-
if (soundtrack !== "none" && !hasMusic) {
|
|
1623
|
+
if (soundtrack !== "none" && !hasMusic && !isMusicVideo(film)) {
|
|
1522
1624
|
if (musicJobId) {
|
|
1523
1625
|
const job = await ctx.client.getJob(musicJobId);
|
|
1524
1626
|
const out = job.output;
|
|
@@ -1557,14 +1659,22 @@ async function run8(input, ctx) {
|
|
|
1557
1659
|
if (action === "produce") return produce(input.film_id, ctx);
|
|
1558
1660
|
return advance(input.film_id, input.soundtrack, input.music_job_id, ctx);
|
|
1559
1661
|
}
|
|
1560
|
-
var LOOKS, InputSchema8, InputJsonSchema8, shots, count, LOOK_MUSIC, ARC, filmSkill;
|
|
1662
|
+
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;
|
|
1561
1663
|
var init_film = __esm({
|
|
1562
1664
|
"src/skills/film.ts"() {
|
|
1563
|
-
|
|
1665
|
+
init_upload_helpers();
|
|
1666
|
+
STORY_LOOKS = ["live-action", "anime", "3d-animation", "noir", "horror", "sci-fi", "documentary", "western", "romance", "romantic-comedy", "comedy"];
|
|
1667
|
+
MUSIC_VIDEO_LOOKS = ["rap-video", "neon-club", "stage-performance", "retro-camcorder", "y2k-pop", "moody-rnb", "rock-grit", "dream-pop", "k-pop"];
|
|
1668
|
+
LOOKS = [...STORY_LOOKS, ...MUSIC_VIDEO_LOOKS];
|
|
1669
|
+
MUSIC_CLIP_ENGINE_ID = "minimax-h3-reference";
|
|
1564
1670
|
InputSchema8 = zod.z.object({
|
|
1565
1671
|
idea: zod.z.string().max(2e3).optional().describe("One-to-three sentence film idea. The studio writes the screenplay (free). Provide idea OR script for planning."),
|
|
1566
1672
|
script: zod.z.string().max(2e4).optional().describe("A full screenplay to plan instead of an idea (sluglines, action lines, dialogue)."),
|
|
1567
|
-
look: zod.z.enum(LOOKS).
|
|
1673
|
+
look: zod.z.enum(LOOKS).optional().describe("Visual style carried through frames, clips, and soundtrack. Default live-action, or rap-video for a music video."),
|
|
1674
|
+
song_url: zod.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."),
|
|
1675
|
+
song_path: zod.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."),
|
|
1676
|
+
song_duration_sec: zod.z.number().positive().max(7200).optional().describe("Music video mode (optional): the song length in seconds. Omit it and the studio measures the song."),
|
|
1677
|
+
lyrics: zod.z.string().max(1e4).optional().describe("Music video mode: the song lyrics, so shots land on the right lines. Optional."),
|
|
1568
1678
|
aspect: zod.z.enum(["16:9", "9:16"]).default("16:9"),
|
|
1569
1679
|
length: zod.z.enum(["30s", "60s", "2-3min", "5min"]).default("60s").describe("Target length; drives the shot count (~6/12/24/60 shots)."),
|
|
1570
1680
|
film_id: zod.z.string().max(40).optional().describe("Existing film id (from a previous call) for produce/status."),
|
|
@@ -1577,9 +1687,22 @@ var init_film = __esm({
|
|
|
1577
1687
|
properties: {
|
|
1578
1688
|
idea: { type: "string", description: "Plan step: one-to-three sentence film idea. The studio writes the screenplay (free). Provide idea or script." },
|
|
1579
1689
|
script: { type: "string", description: "Plan step: a full screenplay (sluglines, action lines, dialogue) to plan instead of an idea." },
|
|
1580
|
-
look: { type: "string", enum: [...LOOKS], description:
|
|
1690
|
+
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).` },
|
|
1691
|
+
song_url: {
|
|
1692
|
+
type: "string",
|
|
1693
|
+
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."
|
|
1694
|
+
},
|
|
1695
|
+
song_path: {
|
|
1696
|
+
type: "string",
|
|
1697
|
+
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."
|
|
1698
|
+
},
|
|
1699
|
+
song_duration_sec: {
|
|
1700
|
+
type: "number",
|
|
1701
|
+
description: "Plan step, music video mode (optional): the song length in seconds. Omit it and the studio measures the song."
|
|
1702
|
+
},
|
|
1703
|
+
lyrics: { type: "string", description: "Plan step, music video mode (optional): the song lyrics, so shots land on the right lines." },
|
|
1581
1704
|
aspect: { type: "string", enum: ["16:9", "9:16"], description: "Plan step: frame aspect ratio. Default 16:9." },
|
|
1582
|
-
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." },
|
|
1705
|
+
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." },
|
|
1583
1706
|
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".' },
|
|
1584
1707
|
action: {
|
|
1585
1708
|
type: "string",
|
|
@@ -1589,7 +1712,7 @@ var init_film = __esm({
|
|
|
1589
1712
|
soundtrack: {
|
|
1590
1713
|
type: "string",
|
|
1591
1714
|
enum: ["scene-synced", "flat", "none"],
|
|
1592
|
-
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."
|
|
1715
|
+
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."
|
|
1593
1716
|
},
|
|
1594
1717
|
music_job_id: {
|
|
1595
1718
|
type: "string",
|
|
@@ -1599,6 +1722,11 @@ var init_film = __esm({
|
|
|
1599
1722
|
};
|
|
1600
1723
|
shots = (f) => f.scenes.flatMap((s) => s.shots);
|
|
1601
1724
|
count = (f, pred) => shots(f).filter(pred).length;
|
|
1725
|
+
PLANNER_POLL_MS = 3e3;
|
|
1726
|
+
PLANNER_MAX_POLLS = 8;
|
|
1727
|
+
isMusicVideo = (f) => f.musicVideoMode === true;
|
|
1728
|
+
needsSlice = (f) => isMusicVideo(f) && shots(f).length > 0 && !shots(f).some((sh) => sh.musicChunkUrl);
|
|
1729
|
+
stillPlanningText = (filmId, stage = "plan") => `${stage === "script" ? "Still writing the script" : "Still planning the shots"} for 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.`;
|
|
1602
1730
|
LOOK_MUSIC = {
|
|
1603
1731
|
"live-action": "modern cinematic underscore, warm strings and soft felt piano, subtle rhythmic pulse, slow emotional build",
|
|
1604
1732
|
anime: "sweeping anime film score, lush strings and piano, taiko drum accents, soaring heartfelt theme",
|
|
@@ -1619,7 +1747,8 @@ var init_film = __esm({
|
|
|
1619
1747
|
};
|
|
1620
1748
|
filmSkill = {
|
|
1621
1749
|
name: "pixeldojo_film",
|
|
1622
|
-
description: "Make a finished short film from one idea: screenplay, storyboard frames (AI-reviewed), video clips with spoken dialogue, scene-synced soundtrack, stitched export.
|
|
1750
|
+
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).",
|
|
1751
|
+
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).",
|
|
1623
1752
|
inputZod: InputSchema8,
|
|
1624
1753
|
inputJsonSchema: InputJsonSchema8,
|
|
1625
1754
|
allowedModels: [],
|
|
@@ -1628,7 +1757,512 @@ var init_film = __esm({
|
|
|
1628
1757
|
};
|
|
1629
1758
|
}
|
|
1630
1759
|
});
|
|
1760
|
+
function buildVideoPayload(verb, apiId, i) {
|
|
1761
|
+
const prompt = i.prompt ?? "";
|
|
1762
|
+
const vd = i.videoDuration;
|
|
1763
|
+
if (NEEDS_VIDEO_DURATION.has(apiId) && vd === void 0) {
|
|
1764
|
+
return {
|
|
1765
|
+
error: `${apiId} needs video_duration: the source clip's length in seconds (it sets the credit cost).`
|
|
1766
|
+
};
|
|
1767
|
+
}
|
|
1768
|
+
if (verb === "move" && !i.images[0]) {
|
|
1769
|
+
return { error: `The move verb needs image_url: the character image to put into the video.` };
|
|
1770
|
+
}
|
|
1771
|
+
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;
|
|
1772
|
+
if (verb === "change") {
|
|
1773
|
+
switch (apiId) {
|
|
1774
|
+
case "seedance-2-5-video-edit":
|
|
1775
|
+
return {
|
|
1776
|
+
body: {
|
|
1777
|
+
mode: "edit",
|
|
1778
|
+
prompt,
|
|
1779
|
+
video_url: i.videoUrl,
|
|
1780
|
+
reference_images: i.images,
|
|
1781
|
+
...vd !== void 0 ? { source_duration_seconds: vd } : {}
|
|
1782
|
+
}
|
|
1783
|
+
};
|
|
1784
|
+
case "flux-video-edit":
|
|
1785
|
+
return { body: { prompt, video: i.videoUrl, video_duration: Math.ceil(vd) }, note: droppedImages };
|
|
1786
|
+
case "xai-video-edit":
|
|
1787
|
+
return { body: { prompt, video_url: i.videoUrl, video_duration: vd }, note: droppedImages };
|
|
1788
|
+
case "happyhorse-1.0-video-edit":
|
|
1789
|
+
return { body: { prompt, video_url: i.videoUrl, video_duration: vd, reference_urls: i.images } };
|
|
1790
|
+
default:
|
|
1791
|
+
return { body: { prompt, video_url: i.videoUrl, video_duration: vd, image_urls: i.images } };
|
|
1792
|
+
}
|
|
1793
|
+
}
|
|
1794
|
+
if (verb === "move") {
|
|
1795
|
+
if (apiId === "wan-video-character-swap") {
|
|
1796
|
+
return { body: { prompt: "", image_url: i.images[0], video_url: i.videoUrl, video_duration: vd } };
|
|
1797
|
+
}
|
|
1798
|
+
return {
|
|
1799
|
+
body: {
|
|
1800
|
+
prompt,
|
|
1801
|
+
video: i.videoUrl,
|
|
1802
|
+
video_duration: vd,
|
|
1803
|
+
character_image: i.images[0],
|
|
1804
|
+
// Not a background toggle: 'video' is the 30s duration cap.
|
|
1805
|
+
character_orientation: "video"
|
|
1806
|
+
}
|
|
1807
|
+
};
|
|
1808
|
+
}
|
|
1809
|
+
switch (apiId) {
|
|
1810
|
+
case "seedance-2-5-video-edit":
|
|
1811
|
+
return {
|
|
1812
|
+
body: {
|
|
1813
|
+
mode: "extend",
|
|
1814
|
+
prompt,
|
|
1815
|
+
video_url: i.videoUrl,
|
|
1816
|
+
direction: i.direction ?? "forward",
|
|
1817
|
+
duration: clamp(i.duration ?? 5, 4, 30),
|
|
1818
|
+
...vd !== void 0 ? { source_duration_seconds: vd } : {}
|
|
1819
|
+
},
|
|
1820
|
+
note: droppedImages
|
|
1821
|
+
};
|
|
1822
|
+
case "wan-2.7-i2v": {
|
|
1823
|
+
const chosen = clamp(i.duration ?? 5, 2, 15);
|
|
1824
|
+
return {
|
|
1825
|
+
body: {
|
|
1826
|
+
mode: "video-extend",
|
|
1827
|
+
prompt,
|
|
1828
|
+
video_url: i.videoUrl,
|
|
1829
|
+
// A continuation shorter than its own source is rejected outright.
|
|
1830
|
+
duration: vd ? Math.min(15, Math.max(chosen, Math.ceil(vd) + 1)) : chosen,
|
|
1831
|
+
...vd ? { source_video_duration: vd } : {}
|
|
1832
|
+
},
|
|
1833
|
+
note: droppedImages
|
|
1834
|
+
};
|
|
1835
|
+
}
|
|
1836
|
+
default:
|
|
1837
|
+
return {
|
|
1838
|
+
body: { prompt, video_url: i.videoUrl, extension_duration: clamp(i.duration ?? 6, 2, 10) },
|
|
1839
|
+
note: droppedImages
|
|
1840
|
+
};
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1631
1843
|
async function run9(input, ctx) {
|
|
1844
|
+
const paramsGate = paramsWithoutModel(input.params, input.model);
|
|
1845
|
+
if (paramsGate) return { kind: "text", text: paramsGate };
|
|
1846
|
+
const verb = input.verb;
|
|
1847
|
+
const engines = VIDEO_STUDIO_ENGINES[verb];
|
|
1848
|
+
const notes = [];
|
|
1849
|
+
let apiId = input.model ?? engines[0];
|
|
1850
|
+
if (!engines.includes(apiId)) {
|
|
1851
|
+
notes.push(`${apiId} is not a Video Studio ${verb} engine, so I used ${engines[0]} instead.`);
|
|
1852
|
+
apiId = engines[0];
|
|
1853
|
+
}
|
|
1854
|
+
if (verb === "extend" && input.direction === "backward" && !BACKWARD_ENGINES.has(apiId)) {
|
|
1855
|
+
notes.push(`${apiId} only extends forward, so I used ${engines[0]} to extend backward.`);
|
|
1856
|
+
apiId = engines[0];
|
|
1857
|
+
}
|
|
1858
|
+
let videoUrl = input.video_url;
|
|
1859
|
+
const images = [...input.image_url ? [input.image_url] : [], ...input.image_urls ?? []];
|
|
1860
|
+
try {
|
|
1861
|
+
if (!videoUrl && input.video_path) videoUrl = await uploadLocalFile(input.video_path, ctx);
|
|
1862
|
+
if (!input.image_url && input.image_path) images.unshift(await uploadLocalFile(input.image_path, ctx));
|
|
1863
|
+
} catch (err) {
|
|
1864
|
+
if (err instanceof SkillUploadError) {
|
|
1865
|
+
return { kind: "text", text: `pixeldojo_video (upload): ${err.userMessage}` };
|
|
1866
|
+
}
|
|
1867
|
+
throw err;
|
|
1868
|
+
}
|
|
1869
|
+
if (!videoUrl) {
|
|
1870
|
+
return {
|
|
1871
|
+
kind: "text",
|
|
1872
|
+
text: `pixeldojo_video ${verb} needs video_url: the ${verb === "move" ? "driving motion clip" : "source clip"}.`
|
|
1873
|
+
};
|
|
1874
|
+
}
|
|
1875
|
+
if (verb !== "move" && !input.prompt?.trim()) {
|
|
1876
|
+
return { kind: "text", text: `pixeldojo_video ${verb} needs a prompt.` };
|
|
1877
|
+
}
|
|
1878
|
+
const built = buildVideoPayload(verb, apiId, {
|
|
1879
|
+
prompt: input.prompt,
|
|
1880
|
+
videoUrl,
|
|
1881
|
+
images: images.filter((u, i, all) => all.indexOf(u) === i),
|
|
1882
|
+
videoDuration: input.video_duration,
|
|
1883
|
+
duration: input.duration,
|
|
1884
|
+
direction: input.direction
|
|
1885
|
+
});
|
|
1886
|
+
if ("error" in built) return { kind: "text", text: `pixeldojo_video: ${built.error}` };
|
|
1887
|
+
if (built.note) notes.push(built.note);
|
|
1888
|
+
const body = built.body;
|
|
1889
|
+
const paramsNote = applyParams(body, input.params, input.model, apiId);
|
|
1890
|
+
if (paramsNote) notes.push(paramsNote);
|
|
1891
|
+
const submitted = await ctx.client.run(apiId, body);
|
|
1892
|
+
const result = await pollJobUntilDoneOrHandoff(
|
|
1893
|
+
submitted.jobId,
|
|
1894
|
+
(id) => ctx.client.getJob(id),
|
|
1895
|
+
ctx.buildStatusUrl,
|
|
1896
|
+
{ now: ctx.pollOverrides?.now, sleep: ctx.pollOverrides?.sleep }
|
|
1897
|
+
);
|
|
1898
|
+
return prefixNote(
|
|
1899
|
+
pollResultToSkillResult(
|
|
1900
|
+
result,
|
|
1901
|
+
(urls) => urls.length === 0 ? `Job ${submitted.jobId} completed but returned no assets.` : `Video ready (${verb} on ${apiId}). Asset: ${urls.join(", ")}`
|
|
1902
|
+
),
|
|
1903
|
+
notes.join(" ")
|
|
1904
|
+
);
|
|
1905
|
+
}
|
|
1906
|
+
var VIDEO_STUDIO_ENGINES, VERBS, BACKWARD_ENGINES, clamp, NEEDS_VIDEO_DURATION, NO_IMAGE_ENGINES, InputSchema9, engineList, InputJsonSchema9, BASE_DESCRIPTION, videoSkill;
|
|
1907
|
+
var init_video = __esm({
|
|
1908
|
+
"src/skills/video.ts"() {
|
|
1909
|
+
init_poll();
|
|
1910
|
+
init_types();
|
|
1911
|
+
init_upload_helpers();
|
|
1912
|
+
init_params();
|
|
1913
|
+
VIDEO_STUDIO_ENGINES = {
|
|
1914
|
+
change: [
|
|
1915
|
+
"seedance-2-5-video-edit",
|
|
1916
|
+
"flux-video-edit",
|
|
1917
|
+
"kling-video-edit",
|
|
1918
|
+
"wan-video-edit",
|
|
1919
|
+
"seedance-video-edit",
|
|
1920
|
+
"happyhorse-1.0-video-edit",
|
|
1921
|
+
"xai-video-edit"
|
|
1922
|
+
],
|
|
1923
|
+
move: ["kling-motion-control", "wan-video-character-swap"],
|
|
1924
|
+
extend: ["seedance-2-5-video-edit", "wan-2.7-i2v", "grok-video-extend"]
|
|
1925
|
+
};
|
|
1926
|
+
VERBS = ["change", "move", "extend"];
|
|
1927
|
+
BACKWARD_ENGINES = /* @__PURE__ */ new Set(["seedance-2-5-video-edit"]);
|
|
1928
|
+
clamp = (n, min, max) => Math.min(max, Math.max(min, Math.round(n)));
|
|
1929
|
+
NEEDS_VIDEO_DURATION = /* @__PURE__ */ new Set([
|
|
1930
|
+
"flux-video-edit",
|
|
1931
|
+
"kling-video-edit",
|
|
1932
|
+
"wan-video-edit",
|
|
1933
|
+
"seedance-video-edit",
|
|
1934
|
+
"happyhorse-1.0-video-edit",
|
|
1935
|
+
"xai-video-edit",
|
|
1936
|
+
"kling-motion-control",
|
|
1937
|
+
"wan-video-character-swap"
|
|
1938
|
+
]);
|
|
1939
|
+
NO_IMAGE_ENGINES = /* @__PURE__ */ new Set(["flux-video-edit", "xai-video-edit"]);
|
|
1940
|
+
InputSchema9 = zod.z.object({
|
|
1941
|
+
verb: zod.z.enum(VERBS),
|
|
1942
|
+
prompt: zod.z.string().max(8e3).optional(),
|
|
1943
|
+
video_url: zod.z.string().url().optional(),
|
|
1944
|
+
video_path: zod.z.string().min(1).optional(),
|
|
1945
|
+
image_url: zod.z.string().url().optional(),
|
|
1946
|
+
image_urls: zod.z.array(zod.z.string().url()).optional(),
|
|
1947
|
+
image_path: zod.z.string().min(1).optional(),
|
|
1948
|
+
model: zod.z.string().optional(),
|
|
1949
|
+
video_duration: zod.z.number().positive().optional(),
|
|
1950
|
+
duration: zod.z.number().int().positive().optional(),
|
|
1951
|
+
direction: zod.z.enum(["forward", "backward"]).optional(),
|
|
1952
|
+
params: ParamsInput
|
|
1953
|
+
});
|
|
1954
|
+
engineList = (verb) => `${verb}: ${VIDEO_STUDIO_ENGINES[verb].join(", ")} (default ${VIDEO_STUDIO_ENGINES[verb][0]})`;
|
|
1955
|
+
InputJsonSchema9 = {
|
|
1956
|
+
type: "object",
|
|
1957
|
+
properties: {
|
|
1958
|
+
verb: {
|
|
1959
|
+
type: "string",
|
|
1960
|
+
enum: VERBS,
|
|
1961
|
+
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)."
|
|
1962
|
+
},
|
|
1963
|
+
prompt: {
|
|
1964
|
+
type: "string",
|
|
1965
|
+
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)."
|
|
1966
|
+
},
|
|
1967
|
+
video_url: {
|
|
1968
|
+
type: "string",
|
|
1969
|
+
format: "uri",
|
|
1970
|
+
description: "The source clip (change, extend) or the driving motion clip (move). Required."
|
|
1971
|
+
},
|
|
1972
|
+
video_path: {
|
|
1973
|
+
type: "string",
|
|
1974
|
+
description: "Absolute local path to the source clip (MP4, WebM, MOV). Uploaded to 24h temp storage and used as video_url."
|
|
1975
|
+
},
|
|
1976
|
+
image_url: {
|
|
1977
|
+
type: "string",
|
|
1978
|
+
format: "uri",
|
|
1979
|
+
description: "The character image (move, required) or a reference image (change, optional; some engines take none)."
|
|
1980
|
+
},
|
|
1981
|
+
image_urls: {
|
|
1982
|
+
type: "array",
|
|
1983
|
+
items: { type: "string", format: "uri" },
|
|
1984
|
+
description: "More reference images for change engines that take a set. Move uses the first image only."
|
|
1985
|
+
},
|
|
1986
|
+
image_path: {
|
|
1987
|
+
type: "string",
|
|
1988
|
+
description: "Absolute local path to the character or reference image. Uploaded to 24h temp storage and used as image_url."
|
|
1989
|
+
},
|
|
1990
|
+
model: {
|
|
1991
|
+
type: "string",
|
|
1992
|
+
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.`
|
|
1993
|
+
},
|
|
1994
|
+
video_duration: {
|
|
1995
|
+
type: "number",
|
|
1996
|
+
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."
|
|
1997
|
+
},
|
|
1998
|
+
duration: {
|
|
1999
|
+
type: "integer",
|
|
2000
|
+
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."
|
|
2001
|
+
},
|
|
2002
|
+
direction: {
|
|
2003
|
+
type: "string",
|
|
2004
|
+
enum: ["forward", "backward"],
|
|
2005
|
+
description: "Extend only. backward adds footage before the clip; only the default engine supports it."
|
|
2006
|
+
},
|
|
2007
|
+
params: PARAMS_JSON_SCHEMA
|
|
2008
|
+
},
|
|
2009
|
+
required: ["verb"]
|
|
2010
|
+
};
|
|
2011
|
+
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.";
|
|
2012
|
+
videoSkill = {
|
|
2013
|
+
name: "pixeldojo_video",
|
|
2014
|
+
description: `${BASE_DESCRIPTION} Local files: video_path / image_path (uploaded to 24h temp storage first).`,
|
|
2015
|
+
hostedDescription: `${BASE_DESCRIPTION} Media must be public http(s) URLs.`,
|
|
2016
|
+
inputZod: InputSchema9,
|
|
2017
|
+
inputJsonSchema: InputJsonSchema9,
|
|
2018
|
+
allowedModels: Array.from(new Set(VERBS.flatMap((v) => VIDEO_STUDIO_ENGINES[v]))),
|
|
2019
|
+
defaultModel: VIDEO_STUDIO_ENGINES.change[0],
|
|
2020
|
+
run: run9
|
|
2021
|
+
};
|
|
2022
|
+
}
|
|
2023
|
+
});
|
|
2024
|
+
async function episodeApi(ctx, method, path, body) {
|
|
2025
|
+
const res = await fetch(`${ctx.baseUrl}/api/faceless-studio/episodes${path}`, {
|
|
2026
|
+
method,
|
|
2027
|
+
headers: {
|
|
2028
|
+
Authorization: `Bearer ${ctx.apiKey}`,
|
|
2029
|
+
"Content-Type": "application/json",
|
|
2030
|
+
"x-pixeldojo-source": `mcp/${ctx.mcpVersion}`,
|
|
2031
|
+
"x-pixeldojo-skill": "episode"
|
|
2032
|
+
},
|
|
2033
|
+
...body !== void 0 ? { body: JSON.stringify(body) } : {}
|
|
2034
|
+
});
|
|
2035
|
+
const data = await res.json().catch(() => ({}));
|
|
2036
|
+
return { status: res.status, data };
|
|
2037
|
+
}
|
|
2038
|
+
function quoteText(ep, price, ctx) {
|
|
2039
|
+
const engines = [...new Set(ep.scenes.map((s) => s.engine))].join(", ");
|
|
2040
|
+
const seconds = ep.scenes.reduce((n, s) => n + s.shotSeconds, 0);
|
|
2041
|
+
return [
|
|
2042
|
+
`Planned "${ep.title}" (episode_id: ${ep.id}): ${ep.scenes.length} scenes, about ${Math.round(seconds)}s of picture, engine ${engines}.`,
|
|
2043
|
+
...ep.scenes.slice(0, 12).map((s, i) => ` ${i + 1}. ${s.narration.slice(0, 110)}`),
|
|
2044
|
+
...ep.scenes.length > 12 ? [` ... and ${ep.scenes.length - 12} more.`] : [],
|
|
2045
|
+
"",
|
|
2046
|
+
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.",
|
|
2047
|
+
`Review or edit at ${ctx.baseUrl}/faceless-studio?episode=${ep.id}, or call ${call(ep.id, "produce")} to start production.`
|
|
2048
|
+
].join("\n");
|
|
2049
|
+
}
|
|
2050
|
+
async function waitForPlan(ctx, id) {
|
|
2051
|
+
const sleep = ctx.pollOverrides?.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
|
|
2052
|
+
for (let i = 0; i < PLAN_MAX_POLLS; i += 1) {
|
|
2053
|
+
await sleep(PLAN_POLL_MS);
|
|
2054
|
+
const { data } = await episodeApi(ctx, "GET", `/${id}`);
|
|
2055
|
+
if (data.episode?.plan.job?.status !== "running") return data;
|
|
2056
|
+
}
|
|
2057
|
+
return null;
|
|
2058
|
+
}
|
|
2059
|
+
async function setEngine(ctx, ep, engine) {
|
|
2060
|
+
const { data } = await episodeApi(ctx, "PATCH", `/${ep.id}`, {
|
|
2061
|
+
scenes: ep.scenes.map((s) => ({ id: s.id, narration: s.narration, visualPrompt: s.visualPrompt, engine }))
|
|
2062
|
+
});
|
|
2063
|
+
if (!data.episode) return {};
|
|
2064
|
+
return (await episodeApi(ctx, "GET", `/${ep.id}`)).data;
|
|
2065
|
+
}
|
|
2066
|
+
async function create(input, ctx) {
|
|
2067
|
+
if (!input.topic?.trim()) {
|
|
2068
|
+
return { kind: "text", text: "Provide a `topic` (8 to 400 characters) to create an episode." };
|
|
2069
|
+
}
|
|
2070
|
+
const created = await episodeApi(ctx, "POST", "", {
|
|
2071
|
+
topic: input.topic.trim(),
|
|
2072
|
+
category: input.category,
|
|
2073
|
+
format: input.aspect,
|
|
2074
|
+
targetSeconds: input.length_seconds,
|
|
2075
|
+
style: input.style,
|
|
2076
|
+
voiceId: input.voice,
|
|
2077
|
+
...input.title?.trim() ? { title: input.title.trim() } : {}
|
|
2078
|
+
});
|
|
2079
|
+
const ep = created.data.episode;
|
|
2080
|
+
if (!ep) return { kind: "text", text: `Could not create the episode: ${created.data.error ?? created.status}` };
|
|
2081
|
+
if (!input.music) await episodeApi(ctx, "PATCH", `/${ep.id}`, { musicEnabled: false });
|
|
2082
|
+
const plan2 = await episodeApi(ctx, "POST", `/${ep.id}/plan`, { scope: "episode" });
|
|
2083
|
+
if (plan2.status !== 202) {
|
|
2084
|
+
return { kind: "text", text: `Episode created (episode_id: ${ep.id}) but planning did not start: ${plan2.data.error ?? plan2.status}` };
|
|
2085
|
+
}
|
|
2086
|
+
let planned = await waitForPlan(ctx, ep.id);
|
|
2087
|
+
if (!planned) return { kind: "text", text: stillPlanning(ep.id) };
|
|
2088
|
+
if (!planned.episode || planned.episode.plan.job?.status === "error" || planned.episode.scenes.length === 0) {
|
|
2089
|
+
return { kind: "text", text: `Planning failed: ${planned.episode?.plan.job?.error ?? planned.error ?? "no scenes came back"}` };
|
|
2090
|
+
}
|
|
2091
|
+
if (input.engine) {
|
|
2092
|
+
const switched = await setEngine(ctx, planned.episode, input.engine);
|
|
2093
|
+
if (switched.episode) planned = switched;
|
|
2094
|
+
}
|
|
2095
|
+
return { kind: "text", text: quoteText(planned.episode, planned.price, ctx) };
|
|
2096
|
+
}
|
|
2097
|
+
function progress(ep) {
|
|
2098
|
+
const done = ep.scenes.filter((s) => s.render.status === "done" && s.render.url && !s.render.stale).length;
|
|
2099
|
+
const running = ep.scenes.filter((s) => s.render.status === "running").length;
|
|
2100
|
+
const narr = ep.narration?.audioUrl ? "recorded" : ep.narration?.status === "running" ? "recording" : "not recorded";
|
|
2101
|
+
const music = !ep.musicEnabled ? "off" : ep.music?.url ? "ready" : ep.music?.status ?? "not started";
|
|
2102
|
+
const exp = ep.export?.status ?? "not started";
|
|
2103
|
+
return `narration ${narr}, scenes ${done}/${ep.scenes.length}${running ? ` (${running} rendering)` : ""}, music ${music}, export ${exp}`;
|
|
2104
|
+
}
|
|
2105
|
+
async function status(id, ctx) {
|
|
2106
|
+
const { data, status: code } = await episodeApi(ctx, "GET", `/${id}`);
|
|
2107
|
+
const ep = data.episode;
|
|
2108
|
+
if (!ep) return { kind: "text", text: `Episode not found: ${data.error ?? code}` };
|
|
2109
|
+
if (ep.plan.job?.status === "running") return { kind: "text", text: stillPlanning(id) };
|
|
2110
|
+
if (ep.scenes.length === 0) {
|
|
2111
|
+
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".` };
|
|
2112
|
+
}
|
|
2113
|
+
if (ep.export?.status === "done" && ep.export.url && ep.savedAt && !ep.export.stale) {
|
|
2114
|
+
return { kind: "text", text: `"${ep.title}" is finished: ${ep.export.url}` };
|
|
2115
|
+
}
|
|
2116
|
+
const quote = data.price ? ` Plan quote: about ${data.price.total} credits at list price.` : "";
|
|
2117
|
+
return { kind: "text", text: `"${ep.title}": ${progress(ep)}.${quote} Call ${call(id, "produce")} to keep production moving.` };
|
|
2118
|
+
}
|
|
2119
|
+
async function generate(ctx, id, path, label, regenerate = false) {
|
|
2120
|
+
const r = await episodeApi(ctx, "POST", `/${id}${path}`, regenerate ? { regenerate: true } : {});
|
|
2121
|
+
if (r.status === 200) {
|
|
2122
|
+
return { ok: true, line: `${label} started (${r.data.creditCost ?? "?"} credits).` };
|
|
2123
|
+
}
|
|
2124
|
+
return { ok: false, line: `${label} did not start: ${r.data.error ?? r.status}` };
|
|
2125
|
+
}
|
|
2126
|
+
async function produce2(id, ctx) {
|
|
2127
|
+
const { data, status: code } = await episodeApi(ctx, "GET", `/${id}`);
|
|
2128
|
+
const ep = data.episode;
|
|
2129
|
+
if (!ep) return { kind: "text", text: `Episode not found: ${data.error ?? code}` };
|
|
2130
|
+
if (ep.plan.job?.status === "running") return { kind: "text", text: stillPlanning(id) };
|
|
2131
|
+
if (ep.scenes.length === 0) {
|
|
2132
|
+
return { kind: "text", text: `"${ep.title}" has no scene plan to produce. Create a new episode with action "create".` };
|
|
2133
|
+
}
|
|
2134
|
+
if (!ep.narration?.audioUrl) {
|
|
2135
|
+
if (ep.narration?.status === "running") {
|
|
2136
|
+
return { kind: "text", text: `Narration is recording. ${next(id, "produce", "~20s")}` };
|
|
2137
|
+
}
|
|
2138
|
+
const g = await generate(ctx, id, "/narration/generate", "Narration");
|
|
2139
|
+
const failed = ep.narration?.status === "failed" ? ` (the last take failed: ${ep.narration.error ?? "unknown"})` : "";
|
|
2140
|
+
return { kind: "text", text: `${g.line}${failed} ${next(id, "produce", "~20s")}` };
|
|
2141
|
+
}
|
|
2142
|
+
const running = ep.scenes.filter((s) => s.render.status === "running").length;
|
|
2143
|
+
const queue = ep.scenes.filter(needsRender);
|
|
2144
|
+
if (queue.length > 0 || running > 0) {
|
|
2145
|
+
const lines = [];
|
|
2146
|
+
let spent = 0;
|
|
2147
|
+
for (const s of queue.slice(0, Math.max(0, MAX_IN_FLIGHT - running))) {
|
|
2148
|
+
const r = await episodeApi(ctx, "POST", `/${id}/scenes/${s.id}/generate`, {});
|
|
2149
|
+
if (r.status === 200) spent += r.data.creditCost ?? 0;
|
|
2150
|
+
else {
|
|
2151
|
+
lines.push(`Scene ${ep.scenes.indexOf(s) + 1} did not start: ${r.data.error ?? r.status}`);
|
|
2152
|
+
if (r.status === 402 || r.status === 403) break;
|
|
2153
|
+
}
|
|
2154
|
+
}
|
|
2155
|
+
const failed = ep.scenes.filter((s) => s.render.status === "failed");
|
|
2156
|
+
return {
|
|
2157
|
+
kind: "text",
|
|
2158
|
+
text: [
|
|
2159
|
+
`In progress: ${progress(ep)}.`,
|
|
2160
|
+
spent > 0 ? `Started scene renders for ${Math.round(spent * 10) / 10} credits.` : "",
|
|
2161
|
+
failed.length > 0 ? `${failed.length} scene(s) failed and were re-queued (${failed[0]?.render.error?.slice(0, 100) ?? ""}).` : "",
|
|
2162
|
+
...lines,
|
|
2163
|
+
next(id, "produce", "~30s")
|
|
2164
|
+
].filter(Boolean).join("\n")
|
|
2165
|
+
};
|
|
2166
|
+
}
|
|
2167
|
+
if (ep.musicEnabled && !ep.music?.url && ep.music?.status !== "failed") {
|
|
2168
|
+
if (ep.music?.status === "running") {
|
|
2169
|
+
return { kind: "text", text: `All scenes rendered; the music bed is composing. ${next(id, "produce", "~20s")}` };
|
|
2170
|
+
}
|
|
2171
|
+
const g = await generate(ctx, id, "/music/generate", "Music bed");
|
|
2172
|
+
return { kind: "text", text: `All scenes rendered. ${g.line} ${next(id, "produce", "~20s")}` };
|
|
2173
|
+
}
|
|
2174
|
+
const exp = ep.export;
|
|
2175
|
+
if (exp?.status === "running") {
|
|
2176
|
+
return { kind: "text", text: `Export is stitching the episode. ${next(id, "produce", "~60s")}` };
|
|
2177
|
+
}
|
|
2178
|
+
if (exp?.status === "done" && exp.url && !exp.stale) {
|
|
2179
|
+
if (ep.savedAt) return { kind: "text", text: `"${ep.title}" is finished: ${exp.url}` };
|
|
2180
|
+
const saved = await episodeApi(ctx, "POST", `/${id}/save`, {});
|
|
2181
|
+
const url = saved.data.episode?.export?.url;
|
|
2182
|
+
if (saved.status !== 200 || !url) {
|
|
2183
|
+
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")}` };
|
|
2184
|
+
}
|
|
2185
|
+
return { kind: "text", text: `"${ep.title}" is finished and saved to My Media: ${url}` };
|
|
2186
|
+
}
|
|
2187
|
+
const started = await episodeApi(ctx, "POST", `/${id}/export`, {});
|
|
2188
|
+
if (started.status !== 202) {
|
|
2189
|
+
return { kind: "text", text: `Export did not start: ${started.data.error ?? started.status}. ${next(id, "produce", "~30s")}` };
|
|
2190
|
+
}
|
|
2191
|
+
const prior = exp?.status === "failed" ? ` (the last export failed: ${exp.error ?? "unknown"})` : "";
|
|
2192
|
+
const musicNote = ep.musicEnabled && ep.music?.status === "failed" ? " The music bed failed, so this cut has no music." : "";
|
|
2193
|
+
return { kind: "text", text: `Export started, free${prior}.${musicNote} ${next(id, "produce", "~60s")}` };
|
|
2194
|
+
}
|
|
2195
|
+
async function run10(input, ctx) {
|
|
2196
|
+
const action = input.action === "create" && input.episode_id ? "status" : input.action;
|
|
2197
|
+
if (action === "create") return create(input, ctx);
|
|
2198
|
+
if (!input.episode_id) return { kind: "text", text: "produce and status need the episode_id returned by the create step." };
|
|
2199
|
+
if (action === "produce") return produce2(input.episode_id, ctx);
|
|
2200
|
+
return status(input.episode_id, ctx);
|
|
2201
|
+
}
|
|
2202
|
+
var STYLES, CATEGORIES, ENGINES, MIN_SECONDS, MAX_SECONDS, MAX_IN_FLIGHT, InputSchema10, InputJsonSchema10, call, next, needsRender, PLAN_POLL_MS, PLAN_MAX_POLLS, stillPlanning, episodeSkill;
|
|
2203
|
+
var init_episode = __esm({
|
|
2204
|
+
"src/skills/episode.ts"() {
|
|
2205
|
+
STYLES = ["editorial-motion", "paper-diorama", "hand-drawn", "storybook", "poster-vector", "soft-3d"];
|
|
2206
|
+
CATEGORIES = ["education", "history", "kids", "storytelling", "custom"];
|
|
2207
|
+
ENGINES = ["omni-draft", "omni-final", "still-motion"];
|
|
2208
|
+
MIN_SECONDS = 60;
|
|
2209
|
+
MAX_SECONDS = 300;
|
|
2210
|
+
MAX_IN_FLIGHT = 4;
|
|
2211
|
+
InputSchema10 = zod.z.object({
|
|
2212
|
+
action: zod.z.enum(["create", "produce", "status"]).default("create"),
|
|
2213
|
+
topic: zod.z.string().min(8).max(400).optional(),
|
|
2214
|
+
episode_id: zod.z.string().max(40).optional(),
|
|
2215
|
+
category: zod.z.enum(CATEGORIES).default("education"),
|
|
2216
|
+
style: zod.z.enum(STYLES).default("editorial-motion"),
|
|
2217
|
+
aspect: zod.z.enum(["16:9", "9:16"]).default("16:9"),
|
|
2218
|
+
length_seconds: zod.z.number().int().min(MIN_SECONDS).max(MAX_SECONDS).default(120),
|
|
2219
|
+
voice: zod.z.string().min(1).max(80).default("Wise_Woman"),
|
|
2220
|
+
engine: zod.z.enum(ENGINES).optional(),
|
|
2221
|
+
music: zod.z.boolean().default(true),
|
|
2222
|
+
title: zod.z.string().max(120).optional()
|
|
2223
|
+
});
|
|
2224
|
+
InputJsonSchema10 = {
|
|
2225
|
+
type: "object",
|
|
2226
|
+
properties: {
|
|
2227
|
+
action: {
|
|
2228
|
+
type: "string",
|
|
2229
|
+
enum: ["create", "produce", "status"],
|
|
2230
|
+
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."
|
|
2231
|
+
},
|
|
2232
|
+
topic: { type: "string", description: "Create step: what the episode is about, 8 to 400 characters." },
|
|
2233
|
+
episode_id: { type: "string", description: "The episode_id from the create step. Required for produce and status." },
|
|
2234
|
+
category: { type: "string", enum: [...CATEGORIES], description: "Create step: tone of the script. Default education." },
|
|
2235
|
+
style: { type: "string", enum: [...STYLES], description: "Create step: visual style of every scene. Default editorial-motion." },
|
|
2236
|
+
aspect: { type: "string", enum: ["16:9", "9:16"], description: "Create step: 16:9 landscape (default) or 9:16 vertical." },
|
|
2237
|
+
length_seconds: { type: "integer", minimum: MIN_SECONDS, maximum: MAX_SECONDS, description: "Create step: target length in seconds. Default 120." },
|
|
2238
|
+
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." },
|
|
2239
|
+
engine: {
|
|
2240
|
+
type: "string",
|
|
2241
|
+
enum: [...ENGINES],
|
|
2242
|
+
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."
|
|
2243
|
+
},
|
|
2244
|
+
music: { type: "boolean", description: "Create step: add a music bed under the narration. Default true." },
|
|
2245
|
+
title: { type: "string", description: "Create step (optional): episode title. Defaults to the topic." }
|
|
2246
|
+
}
|
|
2247
|
+
};
|
|
2248
|
+
call = (id, action) => `pixeldojo_episode with {"episode_id": "${id}", "action": "${action}"}`;
|
|
2249
|
+
next = (id, action, wait) => `Call ${call(id, action)} in ${wait}.`;
|
|
2250
|
+
needsRender = (s) => s.render.status !== "running" && (s.render.status === "idle" || s.render.status === "failed" || Boolean(s.render.stale) || !s.render.url);
|
|
2251
|
+
PLAN_POLL_MS = 3e3;
|
|
2252
|
+
PLAN_MAX_POLLS = 8;
|
|
2253
|
+
stillPlanning = (id) => `The script is still being written (episode_id: ${id}). Nothing has been charged. ${next(id, "status", "~30s")}`;
|
|
2254
|
+
episodeSkill = {
|
|
2255
|
+
name: "pixeldojo_episode",
|
|
2256
|
+
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.",
|
|
2257
|
+
inputZod: InputSchema10,
|
|
2258
|
+
inputJsonSchema: InputJsonSchema10,
|
|
2259
|
+
allowedModels: [],
|
|
2260
|
+
defaultModel: "",
|
|
2261
|
+
run: run10
|
|
2262
|
+
};
|
|
2263
|
+
}
|
|
2264
|
+
});
|
|
2265
|
+
async function run11(input, ctx) {
|
|
1632
2266
|
const productImages = [
|
|
1633
2267
|
...input.product_image_urls ?? [],
|
|
1634
2268
|
...await Promise.all((input.product_image_paths ?? []).map((p) => uploadLocalFile(p, ctx)))
|
|
@@ -1671,13 +2305,13 @@ async function run9(input, ctx) {
|
|
|
1671
2305
|
(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]}`
|
|
1672
2306
|
);
|
|
1673
2307
|
}
|
|
1674
|
-
var
|
|
2308
|
+
var InputSchema11, InputJsonSchema11, adSkill;
|
|
1675
2309
|
var init_ad = __esm({
|
|
1676
2310
|
"src/skills/ad.ts"() {
|
|
1677
2311
|
init_types();
|
|
1678
2312
|
init_poll();
|
|
1679
2313
|
init_upload_helpers();
|
|
1680
|
-
|
|
2314
|
+
InputSchema11 = zod.z.object({
|
|
1681
2315
|
style: zod.z.string().max(80).optional().describe(
|
|
1682
2316
|
"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."
|
|
1683
2317
|
),
|
|
@@ -1703,7 +2337,7 @@ var init_ad = __esm({
|
|
|
1703
2337
|
path: ["product_url"]
|
|
1704
2338
|
}
|
|
1705
2339
|
);
|
|
1706
|
-
|
|
2340
|
+
InputJsonSchema11 = {
|
|
1707
2341
|
type: "object",
|
|
1708
2342
|
properties: {
|
|
1709
2343
|
style: {
|
|
@@ -1790,16 +2424,16 @@ var init_ad = __esm({
|
|
|
1790
2424
|
name: "pixeldojo_ad",
|
|
1791
2425
|
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.",
|
|
1792
2426
|
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.",
|
|
1793
|
-
inputZod:
|
|
1794
|
-
inputJsonSchema:
|
|
2427
|
+
inputZod: InputSchema11,
|
|
2428
|
+
inputJsonSchema: InputJsonSchema11,
|
|
1795
2429
|
// Composition skill — the server routes to the ad engine internally.
|
|
1796
2430
|
allowedModels: [],
|
|
1797
2431
|
defaultModel: "",
|
|
1798
|
-
run:
|
|
2432
|
+
run: run11
|
|
1799
2433
|
};
|
|
1800
2434
|
}
|
|
1801
2435
|
});
|
|
1802
|
-
async function
|
|
2436
|
+
async function run12(input, ctx) {
|
|
1803
2437
|
const client = ctx.client;
|
|
1804
2438
|
const result = await client.runCampaign(input);
|
|
1805
2439
|
if (result.kind === "campaign") {
|
|
@@ -1826,10 +2460,10 @@ async function run10(input, ctx) {
|
|
|
1826
2460
|
statusUrl: result.statusUrl ?? ctx.buildStatusUrl(result.campaignId)
|
|
1827
2461
|
};
|
|
1828
2462
|
}
|
|
1829
|
-
var
|
|
2463
|
+
var InputSchema12, InputJsonSchema12, campaignSkill;
|
|
1830
2464
|
var init_campaign = __esm({
|
|
1831
2465
|
"src/skills/campaign.ts"() {
|
|
1832
|
-
|
|
2466
|
+
InputSchema12 = zod.z.object({
|
|
1833
2467
|
productUrl: zod.z.string().url().optional().describe("Product page URL. We extract name + description + images automatically."),
|
|
1834
2468
|
product: zod.z.object({
|
|
1835
2469
|
name: zod.z.string().min(1).max(200),
|
|
@@ -1845,7 +2479,7 @@ var init_campaign = __esm({
|
|
|
1845
2479
|
message: "productUrl or product is required",
|
|
1846
2480
|
path: ["productUrl"]
|
|
1847
2481
|
});
|
|
1848
|
-
|
|
2482
|
+
InputJsonSchema12 = {
|
|
1849
2483
|
type: "object",
|
|
1850
2484
|
properties: {
|
|
1851
2485
|
productUrl: {
|
|
@@ -1896,17 +2530,17 @@ var init_campaign = __esm({
|
|
|
1896
2530
|
campaignSkill = {
|
|
1897
2531
|
name: "pixeldojo_campaign",
|
|
1898
2532
|
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.",
|
|
1899
|
-
inputZod:
|
|
1900
|
-
inputJsonSchema:
|
|
2533
|
+
inputZod: InputSchema12,
|
|
2534
|
+
inputJsonSchema: InputJsonSchema12,
|
|
1901
2535
|
// Composition skill — internal sub-jobs route to per-tool models, no
|
|
1902
2536
|
// single allowed-models list applies here.
|
|
1903
2537
|
allowedModels: [],
|
|
1904
2538
|
defaultModel: "",
|
|
1905
|
-
run:
|
|
2539
|
+
run: run12
|
|
1906
2540
|
};
|
|
1907
2541
|
}
|
|
1908
2542
|
});
|
|
1909
|
-
async function
|
|
2543
|
+
async function run13(input, ctx) {
|
|
1910
2544
|
const client = ctx.client;
|
|
1911
2545
|
const result = await client.getCampaign(input.campaignId);
|
|
1912
2546
|
if (result.kind === "campaign") {
|
|
@@ -1936,13 +2570,13 @@ async function run11(input, ctx) {
|
|
|
1936
2570
|
statusUrl: result.statusUrl ?? ctx.buildStatusUrl(result.campaignId)
|
|
1937
2571
|
};
|
|
1938
2572
|
}
|
|
1939
|
-
var
|
|
2573
|
+
var InputSchema13, InputJsonSchema13, campaignStatusSkill;
|
|
1940
2574
|
var init_campaign_status = __esm({
|
|
1941
2575
|
"src/skills/campaign-status.ts"() {
|
|
1942
|
-
|
|
2576
|
+
InputSchema13 = zod.z.object({
|
|
1943
2577
|
campaignId: zod.z.string().min(1).max(200).describe("Campaign id returned from a prior pixeldojo_campaign handoff.")
|
|
1944
2578
|
});
|
|
1945
|
-
|
|
2579
|
+
InputJsonSchema13 = {
|
|
1946
2580
|
type: "object",
|
|
1947
2581
|
properties: {
|
|
1948
2582
|
campaignId: {
|
|
@@ -1955,15 +2589,15 @@ var init_campaign_status = __esm({
|
|
|
1955
2589
|
campaignStatusSkill = {
|
|
1956
2590
|
name: "pixeldojo_campaign_status",
|
|
1957
2591
|
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.",
|
|
1958
|
-
inputZod:
|
|
1959
|
-
inputJsonSchema:
|
|
2592
|
+
inputZod: InputSchema13,
|
|
2593
|
+
inputJsonSchema: InputJsonSchema13,
|
|
1960
2594
|
allowedModels: [],
|
|
1961
2595
|
defaultModel: "",
|
|
1962
|
-
run:
|
|
2596
|
+
run: run13
|
|
1963
2597
|
};
|
|
1964
2598
|
}
|
|
1965
2599
|
});
|
|
1966
|
-
async function
|
|
2600
|
+
async function run14(input, ctx) {
|
|
1967
2601
|
let url;
|
|
1968
2602
|
try {
|
|
1969
2603
|
url = await uploadLocalFile(input.path, ctx);
|
|
@@ -1976,40 +2610,40 @@ async function run12(input, ctx) {
|
|
|
1976
2610
|
return {
|
|
1977
2611
|
kind: "text",
|
|
1978
2612
|
text: `Uploaded ${path.basename(input.path)} \u2192 ${url}
|
|
1979
|
-
(temp storage; auto-deletes in ~24h. Pass this URL as image_url,
|
|
2613
|
+
(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.)`
|
|
1980
2614
|
};
|
|
1981
2615
|
}
|
|
1982
|
-
var
|
|
2616
|
+
var InputSchema14, InputJsonSchema14, uploadSkill;
|
|
1983
2617
|
var init_upload = __esm({
|
|
1984
2618
|
"src/skills/upload.ts"() {
|
|
1985
2619
|
init_upload_helpers();
|
|
1986
|
-
|
|
2620
|
+
InputSchema14 = zod.z.object({
|
|
1987
2621
|
path: zod.z.string().min(1).max(4096).describe(
|
|
1988
|
-
"Absolute local file path to upload. JPEG, PNG, WebP, GIF (\u226450MB)
|
|
2622
|
+
"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."
|
|
1989
2623
|
)
|
|
1990
2624
|
});
|
|
1991
|
-
|
|
2625
|
+
InputJsonSchema14 = {
|
|
1992
2626
|
type: "object",
|
|
1993
2627
|
properties: {
|
|
1994
2628
|
path: {
|
|
1995
2629
|
type: "string",
|
|
1996
|
-
description: "Absolute local file path. Allowed: JPEG, PNG, WebP, GIF (\u226450MB)
|
|
2630
|
+
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."
|
|
1997
2631
|
}
|
|
1998
2632
|
},
|
|
1999
2633
|
required: ["path"]
|
|
2000
2634
|
};
|
|
2001
2635
|
uploadSkill = {
|
|
2002
2636
|
name: "pixeldojo_upload",
|
|
2003
|
-
description: "Upload a local image or
|
|
2004
|
-
inputZod:
|
|
2005
|
-
inputJsonSchema:
|
|
2637
|
+
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.",
|
|
2638
|
+
inputZod: InputSchema14,
|
|
2639
|
+
inputJsonSchema: InputJsonSchema14,
|
|
2006
2640
|
allowedModels: [],
|
|
2007
2641
|
defaultModel: "",
|
|
2008
|
-
run:
|
|
2642
|
+
run: run14
|
|
2009
2643
|
};
|
|
2010
2644
|
}
|
|
2011
2645
|
});
|
|
2012
|
-
async function
|
|
2646
|
+
async function run15(input, ctx) {
|
|
2013
2647
|
const requested = input.model ?? DEFAULT_MODEL6;
|
|
2014
2648
|
if (!ALLOWED4.includes(requested)) {
|
|
2015
2649
|
return {
|
|
@@ -2047,14 +2681,14 @@ async function run13(input, ctx) {
|
|
|
2047
2681
|
(urls) => urls.length === 0 ? `Job ${submitted.jobId} completed but returned no assets.` : `Audio ready. Asset: ${urls[0]}`
|
|
2048
2682
|
);
|
|
2049
2683
|
}
|
|
2050
|
-
var ALLOWED4, DEFAULT_MODEL6,
|
|
2684
|
+
var ALLOWED4, DEFAULT_MODEL6, InputSchema15, InputJsonSchema15, audioSkill;
|
|
2051
2685
|
var init_audio = __esm({
|
|
2052
2686
|
"src/skills/audio.ts"() {
|
|
2053
2687
|
init_poll();
|
|
2054
2688
|
init_types();
|
|
2055
2689
|
ALLOWED4 = ["seed-audio", "text-to-speech"];
|
|
2056
2690
|
DEFAULT_MODEL6 = "seed-audio";
|
|
2057
|
-
|
|
2691
|
+
InputSchema15 = zod.z.object({
|
|
2058
2692
|
prompt: zod.z.string().min(1).describe(
|
|
2059
2693
|
"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."
|
|
2060
2694
|
),
|
|
@@ -2064,7 +2698,7 @@ var init_audio = __esm({
|
|
|
2064
2698
|
output_format: zod.z.string().optional().describe("Output format. seed-audio: mp3 (default), wav, pcm, ogg_opus. text-to-speech: mp3 (default), wav, flac, pcm."),
|
|
2065
2699
|
speed: zod.z.number().min(0.5).max(2).optional().describe("Speech speed multiplier, 0.5-2 (default 1). Both models.")
|
|
2066
2700
|
});
|
|
2067
|
-
|
|
2701
|
+
InputJsonSchema15 = {
|
|
2068
2702
|
type: "object",
|
|
2069
2703
|
properties: {
|
|
2070
2704
|
prompt: {
|
|
@@ -2102,15 +2736,15 @@ var init_audio = __esm({
|
|
|
2102
2736
|
audioSkill = {
|
|
2103
2737
|
name: "pixeldojo_audio",
|
|
2104
2738
|
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.",
|
|
2105
|
-
inputZod:
|
|
2106
|
-
inputJsonSchema:
|
|
2739
|
+
inputZod: InputSchema15,
|
|
2740
|
+
inputJsonSchema: InputJsonSchema15,
|
|
2107
2741
|
allowedModels: [...ALLOWED4],
|
|
2108
2742
|
defaultModel: DEFAULT_MODEL6,
|
|
2109
|
-
run:
|
|
2743
|
+
run: run15
|
|
2110
2744
|
};
|
|
2111
2745
|
}
|
|
2112
2746
|
});
|
|
2113
|
-
async function
|
|
2747
|
+
async function run16(input, ctx) {
|
|
2114
2748
|
const res = await ctx.client.listLibrary({
|
|
2115
2749
|
q: input.q,
|
|
2116
2750
|
model: input.model,
|
|
@@ -2141,16 +2775,16 @@ ${lines.join("\n")}
|
|
|
2141
2775
|
Pass any URL back into pixeldojo_generate, pixeldojo_edit, pixeldojo_character, or pixeldojo_upscale as a reference input.`
|
|
2142
2776
|
};
|
|
2143
2777
|
}
|
|
2144
|
-
var
|
|
2778
|
+
var InputSchema16, InputJsonSchema16, librarySkill;
|
|
2145
2779
|
var init_library = __esm({
|
|
2146
2780
|
"src/skills/library.ts"() {
|
|
2147
|
-
|
|
2781
|
+
InputSchema16 = zod.z.object({
|
|
2148
2782
|
q: zod.z.string().optional().describe("Substring match against the prompt that produced the asset."),
|
|
2149
2783
|
model: zod.z.string().optional().describe("Restrict to a single model (apiId)."),
|
|
2150
2784
|
modality: zod.z.enum(["image", "video", "audio"]).optional().describe("Restrict to one output type."),
|
|
2151
2785
|
limit: zod.z.number().int().min(1).max(50).optional().describe("Max results (default 10).")
|
|
2152
2786
|
});
|
|
2153
|
-
|
|
2787
|
+
InputJsonSchema16 = {
|
|
2154
2788
|
type: "object",
|
|
2155
2789
|
properties: {
|
|
2156
2790
|
q: {
|
|
@@ -2170,11 +2804,11 @@ var init_library = __esm({
|
|
|
2170
2804
|
librarySkill = {
|
|
2171
2805
|
name: "pixeldojo_library",
|
|
2172
2806
|
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.",
|
|
2173
|
-
inputZod:
|
|
2174
|
-
inputJsonSchema:
|
|
2807
|
+
inputZod: InputSchema16,
|
|
2808
|
+
inputJsonSchema: InputJsonSchema16,
|
|
2175
2809
|
allowedModels: [],
|
|
2176
2810
|
defaultModel: "",
|
|
2177
|
-
run:
|
|
2811
|
+
run: run16
|
|
2178
2812
|
};
|
|
2179
2813
|
}
|
|
2180
2814
|
});
|
|
@@ -2424,6 +3058,7 @@ __export(skills_exports, {
|
|
|
2424
3058
|
campaignStatusSkill: () => campaignStatusSkill,
|
|
2425
3059
|
characterSkill: () => characterSkill,
|
|
2426
3060
|
editSkill: () => editSkill,
|
|
3061
|
+
episodeSkill: () => episodeSkill,
|
|
2427
3062
|
filmSkill: () => filmSkill,
|
|
2428
3063
|
findHostedSkill: () => findHostedSkill,
|
|
2429
3064
|
findSkill: () => findSkill,
|
|
@@ -2436,7 +3071,8 @@ __export(skills_exports, {
|
|
|
2436
3071
|
statusSkill: () => statusSkill,
|
|
2437
3072
|
storyboardSkill: () => storyboardSkill,
|
|
2438
3073
|
uploadSkill: () => uploadSkill,
|
|
2439
|
-
upscaleSkill: () => upscaleSkill
|
|
3074
|
+
upscaleSkill: () => upscaleSkill,
|
|
3075
|
+
videoSkill: () => videoSkill
|
|
2440
3076
|
});
|
|
2441
3077
|
function findHostedSkill(name) {
|
|
2442
3078
|
const wanted = name.replace(/^pixeldojo:/, "pixeldojo_");
|
|
@@ -2457,6 +3093,8 @@ var init_skills = __esm({
|
|
|
2457
3093
|
init_status();
|
|
2458
3094
|
init_from_url();
|
|
2459
3095
|
init_film();
|
|
3096
|
+
init_video();
|
|
3097
|
+
init_episode();
|
|
2460
3098
|
init_ad();
|
|
2461
3099
|
init_campaign();
|
|
2462
3100
|
init_campaign_status();
|
|
@@ -2481,7 +3119,9 @@ var init_skills = __esm({
|
|
|
2481
3119
|
adSkill,
|
|
2482
3120
|
campaignSkill,
|
|
2483
3121
|
campaignStatusSkill,
|
|
2484
|
-
filmSkill
|
|
3122
|
+
filmSkill,
|
|
3123
|
+
videoSkill,
|
|
3124
|
+
episodeSkill
|
|
2485
3125
|
];
|
|
2486
3126
|
isLocalPathField = (key) => /_paths?$/.test(key);
|
|
2487
3127
|
HOSTED_SKILLS = ALL_SKILLS.filter(
|
|
@@ -2550,7 +3190,7 @@ function makeRedactedLogger(target = console) {
|
|
|
2550
3190
|
}
|
|
2551
3191
|
|
|
2552
3192
|
// src/server.ts
|
|
2553
|
-
var PACKAGE_VERSION = "0.
|
|
3193
|
+
var PACKAGE_VERSION = "0.15.1" ;
|
|
2554
3194
|
var SERVER_INSTRUCTIONS = "PixelDojo generates images, video, audio and short films across 100+ models, billed in credits from the connected PixelDojo account. A job that runs past the 30-second wait returns a jobId to check later; check it rather than submitting again, since every new submission is charged. Generated asset URLs are deleted one hour after they are created, so download anything the user wants to keep. Finished films are the exception and stay in the account library.";
|
|
2555
3195
|
function buildServer(options) {
|
|
2556
3196
|
if (!options.apiKey) {
|