@pixeldojo/mcp 0.25.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
@@ -1837,14 +1837,17 @@ async function plan(input, ctx) {
1837
1837
  look: input.look ?? (music ? MUSIC_VIDEO_LOOKS[0] : "live-action"),
1838
1838
  lengthTarget: input.length,
1839
1839
  ...!music && input.pacing === "trailer" ? { pacing: "trailer" } : {},
1840
+ ...input.quality === "final" ? { clipQuality: "final" } : {},
1840
1841
  assetIds: [],
1841
1842
  ...music ? {
1842
1843
  // No script step names a music video, so it would stay "Untitled film".
1843
1844
  ...input.idea?.trim() ? { title: input.idea.trim().slice(0, 80) } : {},
1844
1845
  musicVideoMode: true,
1845
1846
  musicUrl: input.song_url,
1846
- ...input.song_duration_sec ? { musicDurationSec: input.song_duration_sec } : {},
1847
- 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).
1848
1851
  } : {}
1849
1852
  });
1850
1853
  if (!created.data.film) return { kind: "text", text: `Could not create the film: ${created.data.error ?? created.status}` };
@@ -2246,14 +2249,13 @@ async function run10(input, ctx) {
2246
2249
  if (action === "redo") return redoShots(input, ctx);
2247
2250
  return advance(input.film_id, input.soundtrack, input.music_job_id, ctx);
2248
2251
  }
2249
- 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;
2250
2253
  var init_film = __esm({
2251
2254
  "src/skills/film.ts"() {
2252
2255
  init_upload_helpers();
2253
2256
  STORY_LOOKS = ["live-action", "anime", "3d-animation", "noir", "horror", "sci-fi", "documentary", "western", "romance", "romantic-comedy", "comedy"];
2254
2257
  MUSIC_VIDEO_LOOKS = ["rap-video", "neon-club", "stage-performance", "retro-camcorder", "y2k-pop", "moody-rnb", "rock-grit", "dream-pop", "k-pop"];
2255
2258
  LOOKS = [...STORY_LOOKS, ...MUSIC_VIDEO_LOOKS];
2256
- MUSIC_CLIP_ENGINE_ID = "minimax-h3-reference";
2257
2259
  InputSchema10 = z.object({
2258
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."),
2259
2261
  script: z.string().max(2e4).optional().describe("A full screenplay to plan instead of an idea (sluglines, action lines, dialogue)."),
@@ -2264,6 +2266,7 @@ var init_film = __esm({
2264
2266
  lyrics: z.string().max(1e4).optional().describe("Music video mode: the song lyrics, so shots land on the right lines. Optional."),
2265
2267
  aspect: z.enum(["16:9", "9:16"]).default("16:9"),
2266
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."),
2267
2270
  length: z.enum(["30s", "60s", "2-3min", "5min"]).default("60s").describe("Target length of the finished film."),
2268
2271
  film_id: z.string().max(40).optional().describe("Existing film id (from a previous call) for produce/status/cast/redo."),
2269
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."),
@@ -2303,6 +2306,11 @@ var init_film = __esm({
2303
2306
  lyrics: { type: "string", description: "Plan step, music video mode (optional): the song lyrics, so shots land on the right lines." },
2304
2307
  aspect: { type: "string", enum: ["16:9", "9:16"], description: "Plan step: frame aspect ratio. Default 16:9." },
2305
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
+ },
2306
2314
  pacing: {
2307
2315
  type: "string",
2308
2316
  enum: ["story", "trailer"],
@@ -2851,7 +2859,7 @@ var init_episode = __esm({
2851
2859
  "src/skills/episode.ts"() {
2852
2860
  STYLES2 = ["editorial-motion", "paper-diorama", "hand-drawn", "storybook", "poster-vector", "soft-3d"];
2853
2861
  CATEGORIES = ["education", "history", "kids", "storytelling", "custom"];
2854
- ENGINES = ["omni-draft", "omni-final", "still-motion"];
2862
+ ENGINES = ["omni-draft", "omni-final", "omni-1080", "still-motion"];
2855
2863
  MIN_SECONDS = 60;
2856
2864
  MAX_SECONDS = 300;
2857
2865
  MAX_IN_FLIGHT = 4;
@@ -2886,7 +2894,7 @@ var init_episode = __esm({
2886
2894
  engine: {
2887
2895
  type: "string",
2888
2896
  enum: [...ENGINES],
2889
- 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."
2890
2898
  },
2891
2899
  music: { type: "boolean", description: "Create step: add a music bed under the narration. Default true." },
2892
2900
  title: { type: "string", description: "Create step (optional): episode title. Defaults to the topic." }
@@ -3579,6 +3587,148 @@ var init_save_character = __esm({
3579
3587
  };
3580
3588
  }
3581
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
+ });
3582
3732
  function substitutePlaceholders(args, inputs, prevUrl) {
3583
3733
  const missing = [];
3584
3734
  const fill = (value) => {
@@ -3827,6 +3977,8 @@ __export(skills_exports, {
3827
3977
  captionSkill: () => captionSkill,
3828
3978
  characterSkill: () => characterSkill,
3829
3979
  editSkill: () => editSkill,
3980
+ effectRunSkill: () => effectRunSkill,
3981
+ effectsListSkill: () => effectsListSkill,
3830
3982
  episodeSkill: () => episodeSkill,
3831
3983
  filmSkill: () => filmSkill,
3832
3984
  findHostedSkill: () => findHostedSkill,
@@ -3888,6 +4040,7 @@ var init_skills = __esm({
3888
4040
  init_library();
3889
4041
  init_save();
3890
4042
  init_save_character();
4043
+ init_effects();
3891
4044
  init_workflows();
3892
4045
  ALL_SKILLS = [
3893
4046
  generateSkill,
@@ -3898,6 +4051,8 @@ var init_skills = __esm({
3898
4051
  captionSkill,
3899
4052
  overlaySkill,
3900
4053
  audioSkill,
4054
+ effectsListSkill,
4055
+ effectRunSkill,
3901
4056
  librarySkill,
3902
4057
  saveSkill,
3903
4058
  saveCharacterSkill,
@@ -3939,6 +4094,8 @@ var init_skills = __esm({
3939
4094
  pixeldojo_caption: render("Caption video"),
3940
4095
  pixeldojo_overlay: render("Add offer or end card"),
3941
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"),
3942
4099
  pixeldojo_video: render("Change, animate or extend video"),
3943
4100
  pixeldojo_ad: render("Make video ad"),
3944
4101
  pixeldojo_campaign: render("Make product launch campaign"),
@@ -3961,10 +4118,10 @@ function makeAttributedClient(options) {
3961
4118
  const { mcpVersion, skillName, baseFetch, ...sdkOptions } = options;
3962
4119
  const real = baseFetch ?? globalThis.fetch.bind(globalThis);
3963
4120
  const wrappedFetch = (input, init) => {
3964
- const headers = new Headers(init?.headers);
3965
- headers.set("x-pixeldojo-source", `mcp/${mcpVersion}`);
3966
- if (skillName) headers.set("x-pixeldojo-skill", skillName);
3967
- 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 });
3968
4125
  };
3969
4126
  return new PixelDojoClient({
3970
4127
  ...sdkOptions,
@@ -4008,7 +4165,7 @@ function makeRedactedLogger(target = console) {
4008
4165
  }
4009
4166
 
4010
4167
  // src/server.ts
4011
- var PACKAGE_VERSION = "0.25.0" ;
4168
+ var PACKAGE_VERSION = "0.26.0" ;
4012
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.";
4013
4170
  function buildServer(options) {
4014
4171
  if (!options.apiKey) {