@pixeldojo/mcp 0.24.0 → 0.26.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/dist/index.d.cts CHANGED
@@ -84,6 +84,12 @@ interface SkillContext {
84
84
  * fields would read the production container's disk. Fail-closed.
85
85
  */
86
86
  localFiles?: boolean;
87
+ /**
88
+ * Fetch for raw calls outside the SDK (pixeldojo_effect's /api/v1/effects
89
+ * routes). The hosted route passes its attributed fetch (source header,
90
+ * signed client IP); unset means the global fetch.
91
+ */
92
+ fetch?: typeof globalThis.fetch;
87
93
  /** Optional logger that already redacts pd_xxx tokens. */
88
94
  logger: {
89
95
  error: (msg: string, ...args: unknown[]) => void;
package/dist/index.d.ts CHANGED
@@ -84,6 +84,12 @@ interface SkillContext {
84
84
  * fields would read the production container's disk. Fail-closed.
85
85
  */
86
86
  localFiles?: boolean;
87
+ /**
88
+ * Fetch for raw calls outside the SDK (pixeldojo_effect's /api/v1/effects
89
+ * routes). The hosted route passes its attributed fetch (source header,
90
+ * signed client IP); unset means the global fetch.
91
+ */
92
+ fetch?: typeof globalThis.fetch;
87
93
  /** Optional logger that already redacts pd_xxx tokens. */
88
94
  logger: {
89
95
  error: (msg: string, ...args: unknown[]) => void;
package/dist/index.js CHANGED
@@ -1324,6 +1324,7 @@ async function run7(input, ctx) {
1324
1324
  ...callout ? {
1325
1325
  callout_title: callout.title,
1326
1326
  callout_subtitle: callout.subtitle,
1327
+ callout_style: callout.style,
1327
1328
  callout_start: callout.start_sec,
1328
1329
  callout_duration: callout.duration_sec
1329
1330
  } : {},
@@ -1387,6 +1388,7 @@ var init_overlay = __esm({
1387
1388
  callout: z.object({
1388
1389
  title: z.string().max(32),
1389
1390
  subtitle: z.string().max(40).optional(),
1391
+ style: z.enum(["label", "classic"]).optional(),
1390
1392
  start_sec: z.number().min(0).optional(),
1391
1393
  duration_sec: z.number().min(1).max(10).optional()
1392
1394
  }).optional(),
@@ -1443,11 +1445,12 @@ var init_overlay = __esm({
1443
1445
  },
1444
1446
  callout: {
1445
1447
  type: "object",
1446
- description: 'Lower-third label that slides in from the left: a benefit ("Ships in 24h") or a name and title.',
1448
+ description: 'Lower third: a benefit ("Ships in 24h") or a name and title. style label (default) is a brand-colored box sliding in; classic is the broadcast strap, an accent bar beside a bold name and a lighter title (bottom band on 16:9).',
1447
1449
  required: ["title"],
1448
1450
  properties: {
1449
1451
  title: { type: "string", maxLength: 32, description: "The label." },
1450
- subtitle: { type: "string", maxLength: 40, description: "Optional second line." },
1452
+ subtitle: { type: "string", maxLength: 40, description: "Optional second line (the title, for classic)." },
1453
+ style: { type: "string", enum: ["label", "classic"], description: "Default label." },
1451
1454
  start_sec: { type: "number", description: "Default 3." },
1452
1455
  duration_sec: { type: "number", minimum: 1, maximum: 10, description: "Default 4." }
1453
1456
  }
@@ -1834,14 +1837,17 @@ async function plan(input, ctx) {
1834
1837
  look: input.look ?? (music ? MUSIC_VIDEO_LOOKS[0] : "live-action"),
1835
1838
  lengthTarget: input.length,
1836
1839
  ...!music && input.pacing === "trailer" ? { pacing: "trailer" } : {},
1840
+ ...input.quality === "final" ? { clipQuality: "final" } : {},
1837
1841
  assetIds: [],
1838
1842
  ...music ? {
1839
1843
  // No script step names a music video, so it would stay "Untitled film".
1840
1844
  ...input.idea?.trim() ? { title: input.idea.trim().slice(0, 80) } : {},
1841
1845
  musicVideoMode: true,
1842
1846
  musicUrl: input.song_url,
1843
- ...input.song_duration_sec ? { musicDurationSec: input.song_duration_sec } : {},
1844
- clipEngine: MUSIC_CLIP_ENGINE_ID
1847
+ ...input.song_duration_sec ? { musicDurationSec: input.song_duration_sec } : {}
1848
+ // Engine left on Auto, like the web composer's music mode, so the
1849
+ // planner routes a mature song to H3 and the rest to P-Video 2 Pro
1850
+ // Reference (tests/contracts/mcp-film-music-parity.test.ts).
1845
1851
  } : {}
1846
1852
  });
1847
1853
  if (!created.data.film) return { kind: "text", text: `Could not create the film: ${created.data.error ?? created.status}` };
@@ -2243,14 +2249,13 @@ async function run10(input, ctx) {
2243
2249
  if (action === "redo") return redoShots(input, ctx);
2244
2250
  return advance(input.film_id, input.soundtrack, input.music_job_id, ctx);
2245
2251
  }
2246
- var STORY_LOOKS, MUSIC_VIDEO_LOOKS, LOOKS, MUSIC_CLIP_ENGINE_ID, InputSchema10, InputJsonSchema10, shots, benignDispatchRefusal, count, frameDone, RETRY_CLEARS, REFUSED, isRefused, PLANNER_POLL_MS, PLANNER_MAX_POLLS, isMusicVideo, needsSlice, stillPlanningText, LOOK_MUSIC, ARC, filmSkill;
2252
+ var STORY_LOOKS, MUSIC_VIDEO_LOOKS, LOOKS, InputSchema10, InputJsonSchema10, shots, benignDispatchRefusal, count, frameDone, RETRY_CLEARS, REFUSED, isRefused, PLANNER_POLL_MS, PLANNER_MAX_POLLS, isMusicVideo, needsSlice, stillPlanningText, LOOK_MUSIC, ARC, filmSkill;
2247
2253
  var init_film = __esm({
2248
2254
  "src/skills/film.ts"() {
2249
2255
  init_upload_helpers();
2250
2256
  STORY_LOOKS = ["live-action", "anime", "3d-animation", "noir", "horror", "sci-fi", "documentary", "western", "romance", "romantic-comedy", "comedy"];
2251
2257
  MUSIC_VIDEO_LOOKS = ["rap-video", "neon-club", "stage-performance", "retro-camcorder", "y2k-pop", "moody-rnb", "rock-grit", "dream-pop", "k-pop"];
2252
2258
  LOOKS = [...STORY_LOOKS, ...MUSIC_VIDEO_LOOKS];
2253
- MUSIC_CLIP_ENGINE_ID = "minimax-h3-reference";
2254
2259
  InputSchema10 = z.object({
2255
2260
  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."),
2256
2261
  script: z.string().max(2e4).optional().describe("A full screenplay to plan instead of an idea (sluglines, action lines, dialogue)."),
@@ -2261,6 +2266,7 @@ var init_film = __esm({
2261
2266
  lyrics: z.string().max(1e4).optional().describe("Music video mode: the song lyrics, so shots land on the right lines. Optional."),
2262
2267
  aspect: z.enum(["16:9", "9:16"]).default("16:9"),
2263
2268
  pacing: z.enum(["story", "trailer"]).default("story").describe("'story' (default) plays every shot's action whole. 'trailer' cuts it like a trailer or promo: most shots keep only their first 1.5-3 seconds."),
2269
+ quality: z.enum(["standard", "final"]).default("standard").describe("'standard' (default) renders 720p clips and a 720p film. 'final' renders 1080p clips where the engine supports it and exports the film at 1080p; it costs more per second."),
2264
2270
  length: z.enum(["30s", "60s", "2-3min", "5min"]).default("60s").describe("Target length of the finished film."),
2265
2271
  film_id: z.string().max(40).optional().describe("Existing film id (from a previous call) for produce/status/cast/redo."),
2266
2272
  action: z.enum(["plan", "produce", "status", "cast", "redo"]).default("plan").describe("'plan' creates + storyboards (free). 'cast' casts, replaces or removes characters on an existing film. 'produce' starts charged generation. 'status' advances production and reports progress; poll it every ~30s until it returns the finished film. 'redo' renders a new take of the listed shots (charged), then status re-saves and re-exports."),
@@ -2300,6 +2306,11 @@ var init_film = __esm({
2300
2306
  lyrics: { type: "string", description: "Plan step, music video mode (optional): the song lyrics, so shots land on the right lines." },
2301
2307
  aspect: { type: "string", enum: ["16:9", "9:16"], description: "Plan step: frame aspect ratio. Default 16:9." },
2302
2308
  length: { type: "string", enum: ["30s", "60s", "2-3min", "5min"], description: "Plan step: target length. Default 60s. Ignored for a music video, whose length is the song." },
2309
+ quality: {
2310
+ type: "string",
2311
+ enum: ["standard", "final"],
2312
+ description: "Plan step: 'standard' (default) is 720p. 'final' renders 1080p clips where the engine supports it and exports at 1080p, at a higher price per second."
2313
+ },
2303
2314
  pacing: {
2304
2315
  type: "string",
2305
2316
  enum: ["story", "trailer"],
@@ -2848,7 +2859,7 @@ var init_episode = __esm({
2848
2859
  "src/skills/episode.ts"() {
2849
2860
  STYLES2 = ["editorial-motion", "paper-diorama", "hand-drawn", "storybook", "poster-vector", "soft-3d"];
2850
2861
  CATEGORIES = ["education", "history", "kids", "storytelling", "custom"];
2851
- ENGINES = ["omni-draft", "omni-final", "still-motion"];
2862
+ ENGINES = ["omni-draft", "omni-final", "omni-1080", "still-motion"];
2852
2863
  MIN_SECONDS = 60;
2853
2864
  MAX_SECONDS = 300;
2854
2865
  MAX_IN_FLIGHT = 4;
@@ -2883,7 +2894,7 @@ var init_episode = __esm({
2883
2894
  engine: {
2884
2895
  type: "string",
2885
2896
  enum: [...ENGINES],
2886
- 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."
2897
+ description: "Create step (optional): render every scene with one engine. omni-draft: fast, cheap motion preview. omni-final: full quality motion with sound (720p). omni-1080: the same at 1080p, and the episode exports at 1080p. still-motion: one illustration per scene, gently panned, cheapest. Default: the style picks."
2887
2898
  },
2888
2899
  music: { type: "boolean", description: "Create step: add a music bed under the narration. Default true." },
2889
2900
  title: { type: "string", description: "Create step (optional): episode title. Defaults to the topic." }
@@ -3576,6 +3587,148 @@ var init_save_character = __esm({
3576
3587
  };
3577
3588
  }
3578
3589
  });
3590
+ function priceOf(e) {
3591
+ if (!e.creditsByEngine) return `${e.credits ?? "?"} credits`;
3592
+ return Object.entries(e.creditsByEngine).map(([engine, c]) => `${engine}${engine === e.defaultEngine ? " (default)" : ""} ${c ?? "?"} credits`).join(" / ");
3593
+ }
3594
+ async function listRun(input, ctx) {
3595
+ const q = new URLSearchParams();
3596
+ for (const [k, v] of Object.entries(input)) if (v !== void 0 && v !== "") q.set(k, String(v));
3597
+ if (!input.limit) q.set("limit", "20");
3598
+ const res = await (ctx.fetch ?? fetch)(`${ctx.baseUrl}/api/v1/effects?${q}`, { headers: headers(ctx, "pixeldojo_effects") });
3599
+ const data = await res.json().catch(() => ({}));
3600
+ if (!res.ok) return { kind: "text", text: `Could not list effects: ${data.error ?? `HTTP ${res.status}`}` };
3601
+ const effects = data.effects ?? [];
3602
+ const cats = Object.entries(data.categories ?? {}).map(([fam, list]) => `${fam}: ${list.join(", ")}`);
3603
+ if (!effects.length) {
3604
+ return { kind: "text", text: ["No effects match. Categories:", ...cats].join("\n") };
3605
+ }
3606
+ const lines = effects.map((e) => {
3607
+ const ins = e.inputs.map(
3608
+ (i) => i.kind === "image" ? `photo "${i.label}"` : `text "${i.label}"${i.options ? ` [${i.options.join(" | ")}]` : ""}${i.optional ? " (optional)" : ""}`
3609
+ );
3610
+ return `- ${e.slug} (${e.family}, ${e.output}, ${priceOf(e)}): ${e.title}. ${e.tagline} Inputs: ${ins.join(", ")}.`;
3611
+ });
3612
+ const shown = data.total && data.total > effects.length ? `, showing ${effects.length}` : "";
3613
+ return {
3614
+ kind: "text",
3615
+ text: [
3616
+ `${data.total ?? effects.length} effects${shown}. Run one with pixeldojo_effect (slug, image_urls in the order listed, texts for text inputs).`,
3617
+ ...lines,
3618
+ ...input.search || input.family || input.category ? [] : ["", "Categories:", ...cats]
3619
+ ].join("\n")
3620
+ };
3621
+ }
3622
+ async function effectRun(input, ctx) {
3623
+ const images = input.image_paths?.length ? await uploadLocalFiles(input.image_paths, ctx) : input.image_urls ?? [];
3624
+ const res = await (ctx.fetch ?? fetch)(`${ctx.baseUrl}/api/v1/effects/${encodeURIComponent(input.slug)}/run`, {
3625
+ method: "POST",
3626
+ headers: headers(ctx, "pixeldojo_effect"),
3627
+ body: JSON.stringify({
3628
+ images,
3629
+ ...input.texts ? { texts: input.texts } : {},
3630
+ ...input.family ? { family: input.family } : {},
3631
+ ...input.engine ? { engine: input.engine } : {}
3632
+ })
3633
+ });
3634
+ const data = await res.json().catch(() => ({}));
3635
+ if (!res.ok || !data.jobId) {
3636
+ return { kind: "text", text: `Effect not started (nothing charged): ${data.error ?? `HTTP ${res.status}`}` };
3637
+ }
3638
+ const result = await pollJobUntilDoneOrHandoff(data.jobId, (id) => ctx.client.getJob(id), ctx.buildStatusUrl, {
3639
+ now: ctx.pollOverrides?.now,
3640
+ sleep: ctx.pollOverrides?.sleep
3641
+ });
3642
+ return pollResultToSkillResult(
3643
+ result,
3644
+ (urls) => urls.length === 0 ? `Job ${data.jobId} completed but returned no assets.` : `Done (${data.creditCost ?? "?"} credits). Asset: ${urls[0]}`
3645
+ );
3646
+ }
3647
+ var FAMILIES, ENGINES2, headers, ListSchema, effectsListSkill, RunSchema, runProperties, effectRunSkill;
3648
+ var init_effects = __esm({
3649
+ "src/skills/effects.ts"() {
3650
+ init_poll();
3651
+ init_upload_helpers();
3652
+ init_types();
3653
+ FAMILIES = ["video-effect", "photo-effect", "tool"];
3654
+ ENGINES2 = ["klein", "qwen"];
3655
+ headers = (ctx, skill) => ({
3656
+ Authorization: `Bearer ${ctx.apiKey}`,
3657
+ "Content-Type": "application/json",
3658
+ "x-pixeldojo-source": `mcp/${ctx.mcpVersion}`,
3659
+ "x-pixeldojo-skill": skill
3660
+ });
3661
+ ListSchema = z.object({
3662
+ search: z.string().max(200).optional(),
3663
+ family: z.enum(FAMILIES).optional(),
3664
+ category: z.string().max(60).optional(),
3665
+ limit: z.number().int().min(1).max(100).optional()
3666
+ });
3667
+ effectsListSkill = {
3668
+ name: "pixeldojo_effects",
3669
+ description: "List PixelDojo's one-click effects: 283 video effects (a photo or two in, a 5 s clip out: AI Hug, Earth Zoom In, AI Dance), 30 photo effects (a photo in, a styled image out: action figure, Ghibli style, sticker, aging filter) and one-job tools (remove a watermark, object or background, headshots, photo restoration, relight, logo, thumbnail and poster makers). Search by words, family or category; each result gives the slug, inputs and credit price. Free. Run one with pixeldojo_effect.",
3670
+ inputZod: ListSchema,
3671
+ inputJsonSchema: {
3672
+ type: "object",
3673
+ properties: {
3674
+ search: { type: "string", description: 'Words like "hug", "action figure", "ghibli", "remove background".' },
3675
+ family: {
3676
+ type: "string",
3677
+ enum: FAMILIES,
3678
+ description: "video-effect = photo to clip, photo-effect = photo to styled image, tool = one-job edit."
3679
+ },
3680
+ category: { type: "string", description: 'A category name from a previous listing, e.g. "Viral", "Toys & 3D".' },
3681
+ limit: { type: "integer", minimum: 1, maximum: 100, description: "Default 20." }
3682
+ }
3683
+ },
3684
+ allowedModels: [],
3685
+ defaultModel: "",
3686
+ run: listRun
3687
+ };
3688
+ RunSchema = z.object({
3689
+ slug: z.string().min(1).max(80),
3690
+ family: z.enum(FAMILIES).optional(),
3691
+ image_urls: z.array(z.string().url()).max(4).optional(),
3692
+ image_paths: z.array(z.string()).max(4).optional(),
3693
+ texts: z.array(z.string().max(200)).max(4).optional(),
3694
+ engine: z.enum(ENGINES2).optional()
3695
+ });
3696
+ runProperties = {
3697
+ slug: { type: "string", description: 'The effect slug from pixeldojo_effects, e.g. "ai-hug", "action-figure", "watermark-remover".' },
3698
+ family: {
3699
+ type: "string",
3700
+ enum: FAMILIES,
3701
+ description: "Needed only for action-figure, comic-book and red-carpet, which are both a video and a photo effect."
3702
+ },
3703
+ image_urls: {
3704
+ type: "array",
3705
+ items: { type: "string", format: "uri" },
3706
+ description: "The photos as https URLs, in the order the listing names them (most take one; duo effects take two)."
3707
+ },
3708
+ image_paths: {
3709
+ type: "array",
3710
+ items: { type: "string" },
3711
+ description: "Absolute local photo paths instead of image_urls; uploaded first (24h temp storage)."
3712
+ },
3713
+ texts: {
3714
+ type: "array",
3715
+ items: { type: "string" },
3716
+ description: "Text inputs in listing order, for entries that list them (object to remove, new background, brand name)."
3717
+ },
3718
+ engine: { type: "string", enum: ENGINES2, description: "Photo effects only: leave out for the default engine." }
3719
+ };
3720
+ effectRunSkill = {
3721
+ name: "pixeldojo_effect",
3722
+ description: "Run one of PixelDojo's one-click effects on your photos: the prompt is built in, so pass only the slug from pixeldojo_effects and the photos (image_urls, or image_paths for local files), plus texts for tools that ask for them. Video effects return a 5 s clip (usually handed off; poll with pixeldojo_status), photo effects and tools an image. Costs the credits the listing shows.",
3723
+ hostedDescription: "Run one of PixelDojo's one-click effects on your photos: the prompt is built in, so pass only the slug from pixeldojo_effects and the photos as https image_urls, plus texts for tools that ask for them. Video effects return a 5 s clip (usually handed off; poll with pixeldojo_status), photo effects and tools an image. Costs the credits the listing shows.",
3724
+ inputZod: RunSchema,
3725
+ inputJsonSchema: { type: "object", required: ["slug"], properties: runProperties },
3726
+ allowedModels: [],
3727
+ defaultModel: "",
3728
+ run: effectRun
3729
+ };
3730
+ }
3731
+ });
3579
3732
  function substitutePlaceholders(args, inputs, prevUrl) {
3580
3733
  const missing = [];
3581
3734
  const fill = (value) => {
@@ -3824,6 +3977,8 @@ __export(skills_exports, {
3824
3977
  captionSkill: () => captionSkill,
3825
3978
  characterSkill: () => characterSkill,
3826
3979
  editSkill: () => editSkill,
3980
+ effectRunSkill: () => effectRunSkill,
3981
+ effectsListSkill: () => effectsListSkill,
3827
3982
  episodeSkill: () => episodeSkill,
3828
3983
  filmSkill: () => filmSkill,
3829
3984
  findHostedSkill: () => findHostedSkill,
@@ -3885,6 +4040,7 @@ var init_skills = __esm({
3885
4040
  init_library();
3886
4041
  init_save();
3887
4042
  init_save_character();
4043
+ init_effects();
3888
4044
  init_workflows();
3889
4045
  ALL_SKILLS = [
3890
4046
  generateSkill,
@@ -3895,6 +4051,8 @@ var init_skills = __esm({
3895
4051
  captionSkill,
3896
4052
  overlaySkill,
3897
4053
  audioSkill,
4054
+ effectsListSkill,
4055
+ effectRunSkill,
3898
4056
  librarySkill,
3899
4057
  saveSkill,
3900
4058
  saveCharacterSkill,
@@ -3936,6 +4094,8 @@ var init_skills = __esm({
3936
4094
  pixeldojo_caption: render("Caption video"),
3937
4095
  pixeldojo_overlay: render("Add offer or end card"),
3938
4096
  pixeldojo_audio: render("Generate music, speech or sound"),
4097
+ pixeldojo_effects: read("List one-click effects"),
4098
+ pixeldojo_effect: render("Run one-click effect"),
3939
4099
  pixeldojo_video: render("Change, animate or extend video"),
3940
4100
  pixeldojo_ad: render("Make video ad"),
3941
4101
  pixeldojo_campaign: render("Make product launch campaign"),
@@ -3958,10 +4118,10 @@ function makeAttributedClient(options) {
3958
4118
  const { mcpVersion, skillName, baseFetch, ...sdkOptions } = options;
3959
4119
  const real = baseFetch ?? globalThis.fetch.bind(globalThis);
3960
4120
  const wrappedFetch = (input, init) => {
3961
- const headers = new Headers(init?.headers);
3962
- headers.set("x-pixeldojo-source", `mcp/${mcpVersion}`);
3963
- if (skillName) headers.set("x-pixeldojo-skill", skillName);
3964
- return real(input, { ...init, headers });
4121
+ const headers2 = new Headers(init?.headers);
4122
+ headers2.set("x-pixeldojo-source", `mcp/${mcpVersion}`);
4123
+ if (skillName) headers2.set("x-pixeldojo-skill", skillName);
4124
+ return real(input, { ...init, headers: headers2 });
3965
4125
  };
3966
4126
  return new PixelDojoClient({
3967
4127
  ...sdkOptions,
@@ -4005,7 +4165,7 @@ function makeRedactedLogger(target = console) {
4005
4165
  }
4006
4166
 
4007
4167
  // src/server.ts
4008
- var PACKAGE_VERSION = "0.24.0" ;
4168
+ var PACKAGE_VERSION = "0.26.0" ;
4009
4169
  var SERVER_INSTRUCTIONS = "Pixel Dojo generates images, video, audio and short films from one catalog of AI models, billed in credits from the connected Pixel Dojo 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: pixeldojo_save keeps one in the user's My Media permanently (after a safety check), and finished films stay in the account library. In any prompt, @Name uses a character, product, outfit, location, prop or style the user saved in Character Studio: its photos are attached automatically. pixeldojo_library source=characters lists them, and pixeldojo_save_character saves a new one from 3 to 5 photos.";
4010
4170
  function buildServer(options) {
4011
4171
  if (!options.apiKey) {