@productmaker/mcp 12.8.0 → 12.8.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/dist/http.js +98 -7
- package/dist/stdio.js +98 -7
- package/package.json +3 -3
package/dist/http.js
CHANGED
|
@@ -18435,6 +18435,47 @@ var LandingRegenerationStatusResponse = z75.object({
|
|
|
18435
18435
|
updatedAt: z75.string().datetime()
|
|
18436
18436
|
});
|
|
18437
18437
|
|
|
18438
|
+
// ../../packages/types/src/classic-landing-selection.ts
|
|
18439
|
+
function buildClassicLandingSelection(document, gifs, selectedIds, images) {
|
|
18440
|
+
const imageChoices = new Map(images.map((image2) => [
|
|
18441
|
+
classicLandingBlockId({
|
|
18442
|
+
kind: "image",
|
|
18443
|
+
ownerTaskId: image2.ownerTaskId,
|
|
18444
|
+
sourceIndex: image2.sourceIndex
|
|
18445
|
+
}),
|
|
18446
|
+
image2
|
|
18447
|
+
]));
|
|
18448
|
+
let imageCount = 0;
|
|
18449
|
+
const blocks = document.blocks.filter((block) => {
|
|
18450
|
+
if (block.kind === "image") return Boolean(imageChoices.get(classicLandingBlockId(block))?.selected) && imageCount++ < SHOPIFY_MAX_LANDING_IMAGES;
|
|
18451
|
+
const gif = gifs.find((item) => item.gifId === block.gifId && item.ownerTaskId === block.ownerTaskId);
|
|
18452
|
+
return selectedIds.includes(classicLandingBlockId(block)) && Boolean(gif && isDeliverableLandingGif(gif));
|
|
18453
|
+
});
|
|
18454
|
+
return {
|
|
18455
|
+
documentRevision: document.revision,
|
|
18456
|
+
blocks,
|
|
18457
|
+
gifs: blocks.flatMap((block) => block.kind === "gif" ? [
|
|
18458
|
+
{
|
|
18459
|
+
ownerTaskId: block.ownerTaskId,
|
|
18460
|
+
gifId: block.gifId,
|
|
18461
|
+
gifRevision: gifs.find((item) => item.gifId === block.gifId).gifRevision
|
|
18462
|
+
}
|
|
18463
|
+
] : []),
|
|
18464
|
+
images: blocks.flatMap((block) => {
|
|
18465
|
+
if (block.kind !== "image") return [];
|
|
18466
|
+
const choice = imageChoices.get(classicLandingBlockId(block));
|
|
18467
|
+
return [
|
|
18468
|
+
{
|
|
18469
|
+
ownerTaskId: choice.ownerTaskId,
|
|
18470
|
+
sourceIndex: choice.sourceIndex,
|
|
18471
|
+
variantIndex: choice.variantIndex
|
|
18472
|
+
}
|
|
18473
|
+
];
|
|
18474
|
+
})
|
|
18475
|
+
};
|
|
18476
|
+
}
|
|
18477
|
+
__name(buildClassicLandingSelection, "buildClassicLandingSelection");
|
|
18478
|
+
|
|
18438
18479
|
// ../../packages/types/src/shopify-meta-tracking.ts
|
|
18439
18480
|
import * as z76 from "zod";
|
|
18440
18481
|
var MetaTrackingOwnerSchema = z76.enum([
|
|
@@ -31756,7 +31797,7 @@ var ApiClient = class {
|
|
|
31756
31797
|
};
|
|
31757
31798
|
|
|
31758
31799
|
// src/index.ts
|
|
31759
|
-
var MCP_VERSION = "12.8.
|
|
31800
|
+
var MCP_VERSION = "12.8.1";
|
|
31760
31801
|
|
|
31761
31802
|
// src/meta-upload-app.ts
|
|
31762
31803
|
import { readFileSync } from "fs";
|
|
@@ -39601,7 +39642,9 @@ function registerPublishTools(server, api, opts = {}) {
|
|
|
39601
39642
|
const selectedLandingGif = includeLandingGif ? defaults?.gif ?? null : null;
|
|
39602
39643
|
const effectiveAvailable = availableImages > 0 ? availableImages : 3;
|
|
39603
39644
|
const numImages = Math.min(parsed.numLandingImages ?? effectiveAvailable, effectiveAvailable, SHOPIFY_MAX_LANDING_IMAGES);
|
|
39604
|
-
const
|
|
39645
|
+
const classic = includeLandingGif && defaults && variantIndex === 0 ? buildMcpClassicSelection(defaults, numImages) : null;
|
|
39646
|
+
const classicSelection = classic?.selection ?? null;
|
|
39647
|
+
const selectedLandingImages = classic?.images ?? Array.from({
|
|
39605
39648
|
length: numImages
|
|
39606
39649
|
}, (_, i) => ({
|
|
39607
39650
|
imageIndex: i,
|
|
@@ -39615,7 +39658,13 @@ function registerPublishTools(server, api, opts = {}) {
|
|
|
39615
39658
|
}),
|
|
39616
39659
|
shopDomain: parsed.shopDomain,
|
|
39617
39660
|
selectedLandingImages,
|
|
39618
|
-
|
|
39661
|
+
// Classic block landings publish their GIF blocks through the
|
|
39662
|
+
// ordered document, exactly like the web editor; the legacy
|
|
39663
|
+
// primary GIF only rides selectedLandingGif.
|
|
39664
|
+
...classicSelection ? {
|
|
39665
|
+
classicSelection,
|
|
39666
|
+
selectedLandingGif: null
|
|
39667
|
+
} : selectedLandingGif ? {
|
|
39619
39668
|
selectedLandingGif
|
|
39620
39669
|
} : {},
|
|
39621
39670
|
showVariantPicker: parsed.showVariantPicker,
|
|
@@ -39910,23 +39959,65 @@ async function fetchLandingPublishDefaults(api, taskId) {
|
|
|
39910
39959
|
const r = await api.getJson(`/v1/results/${encodeURIComponent(taskId)}`);
|
|
39911
39960
|
if (!isRecord3(r) || !isRecord3(r.landing)) return {
|
|
39912
39961
|
imageCount: 0,
|
|
39913
|
-
|
|
39962
|
+
images: [],
|
|
39963
|
+
gif: null,
|
|
39964
|
+
classic: null
|
|
39914
39965
|
};
|
|
39915
|
-
const
|
|
39966
|
+
const rawImages = Array.isArray(r.landing.images) ? r.landing.images : [];
|
|
39967
|
+
const images = rawImages.map((image2) => {
|
|
39968
|
+
const record = isRecord3(image2) ? image2 : {};
|
|
39969
|
+
return {
|
|
39970
|
+
ownerTaskId: typeof record.variantTaskId === "string" ? record.variantTaskId : taskId,
|
|
39971
|
+
sourceIndex: Number(record.sourceIndex ?? record.index)
|
|
39972
|
+
};
|
|
39973
|
+
});
|
|
39916
39974
|
const demo = LandingGifReadableSchema.safeParse(r.landing.demoGif);
|
|
39917
39975
|
const gif = demo.success && demo.data.ownerTaskId === taskId && demo.data.quality.verdict === "passed" ? {
|
|
39918
39976
|
ownerTaskId: taskId,
|
|
39919
39977
|
gifRevision: demo.data.gifRevision
|
|
39920
39978
|
} : null;
|
|
39979
|
+
const document = ClassicLandingDocumentSchema.safeParse(r.landing.classicDocument);
|
|
39980
|
+
const gifs = (Array.isArray(r.landing.gifBlocks) ? r.landing.gifBlocks : []).flatMap((entry) => {
|
|
39981
|
+
const parsed = LandingGifItemSchema.safeParse(entry);
|
|
39982
|
+
return parsed.success ? [
|
|
39983
|
+
parsed.data
|
|
39984
|
+
] : [];
|
|
39985
|
+
});
|
|
39921
39986
|
return {
|
|
39922
|
-
imageCount:
|
|
39923
|
-
|
|
39987
|
+
imageCount: rawImages.length,
|
|
39988
|
+
images,
|
|
39989
|
+
gif,
|
|
39990
|
+
classic: document.success ? {
|
|
39991
|
+
document: document.data,
|
|
39992
|
+
gifs
|
|
39993
|
+
} : null
|
|
39924
39994
|
};
|
|
39925
39995
|
} catch {
|
|
39926
39996
|
return null;
|
|
39927
39997
|
}
|
|
39928
39998
|
}
|
|
39929
39999
|
__name(fetchLandingPublishDefaults, "fetchLandingPublishDefaults");
|
|
40000
|
+
function buildMcpClassicSelection(defaults, numImages) {
|
|
40001
|
+
if (!defaults.classic) return null;
|
|
40002
|
+
const { document, gifs } = defaults.classic;
|
|
40003
|
+
const gifBlockIds = document.blocks.flatMap((block) => block.kind === "gif" && gifs.some((item) => item.gifId === block.gifId && item.ownerTaskId === block.ownerTaskId && isDeliverableLandingGif(item)) ? [
|
|
40004
|
+
classicLandingBlockId(block)
|
|
40005
|
+
] : []);
|
|
40006
|
+
if (gifBlockIds.length === 0) return null;
|
|
40007
|
+
const selection = buildClassicLandingSelection(document, gifs, gifBlockIds, defaults.images.map((image2, arrayIndex) => ({
|
|
40008
|
+
...image2,
|
|
40009
|
+
selected: arrayIndex < numImages,
|
|
40010
|
+
variantIndex: 0
|
|
40011
|
+
})));
|
|
40012
|
+
return {
|
|
40013
|
+
selection,
|
|
40014
|
+
images: (selection.images ?? []).map((selected) => ({
|
|
40015
|
+
imageIndex: defaults.images.findIndex((image2) => image2.ownerTaskId === selected.ownerTaskId && image2.sourceIndex === selected.sourceIndex),
|
|
40016
|
+
variantIndex: selected.variantIndex
|
|
40017
|
+
}))
|
|
40018
|
+
};
|
|
40019
|
+
}
|
|
40020
|
+
__name(buildMcpClassicSelection, "buildMcpClassicSelection");
|
|
39930
40021
|
function toMetaCampaignOverrides(cfg) {
|
|
39931
40022
|
const out = {};
|
|
39932
40023
|
if (cfg.dailyBudgetUsd !== void 0) out.dailyBudgetUsd = cfg.dailyBudgetUsd;
|
package/dist/stdio.js
CHANGED
|
@@ -18210,6 +18210,47 @@ var LandingRegenerationStatusResponse = z75.object({
|
|
|
18210
18210
|
updatedAt: z75.string().datetime()
|
|
18211
18211
|
});
|
|
18212
18212
|
|
|
18213
|
+
// ../../packages/types/src/classic-landing-selection.ts
|
|
18214
|
+
function buildClassicLandingSelection(document, gifs, selectedIds, images) {
|
|
18215
|
+
const imageChoices = new Map(images.map((image2) => [
|
|
18216
|
+
classicLandingBlockId({
|
|
18217
|
+
kind: "image",
|
|
18218
|
+
ownerTaskId: image2.ownerTaskId,
|
|
18219
|
+
sourceIndex: image2.sourceIndex
|
|
18220
|
+
}),
|
|
18221
|
+
image2
|
|
18222
|
+
]));
|
|
18223
|
+
let imageCount = 0;
|
|
18224
|
+
const blocks = document.blocks.filter((block) => {
|
|
18225
|
+
if (block.kind === "image") return Boolean(imageChoices.get(classicLandingBlockId(block))?.selected) && imageCount++ < SHOPIFY_MAX_LANDING_IMAGES;
|
|
18226
|
+
const gif = gifs.find((item) => item.gifId === block.gifId && item.ownerTaskId === block.ownerTaskId);
|
|
18227
|
+
return selectedIds.includes(classicLandingBlockId(block)) && Boolean(gif && isDeliverableLandingGif(gif));
|
|
18228
|
+
});
|
|
18229
|
+
return {
|
|
18230
|
+
documentRevision: document.revision,
|
|
18231
|
+
blocks,
|
|
18232
|
+
gifs: blocks.flatMap((block) => block.kind === "gif" ? [
|
|
18233
|
+
{
|
|
18234
|
+
ownerTaskId: block.ownerTaskId,
|
|
18235
|
+
gifId: block.gifId,
|
|
18236
|
+
gifRevision: gifs.find((item) => item.gifId === block.gifId).gifRevision
|
|
18237
|
+
}
|
|
18238
|
+
] : []),
|
|
18239
|
+
images: blocks.flatMap((block) => {
|
|
18240
|
+
if (block.kind !== "image") return [];
|
|
18241
|
+
const choice = imageChoices.get(classicLandingBlockId(block));
|
|
18242
|
+
return [
|
|
18243
|
+
{
|
|
18244
|
+
ownerTaskId: choice.ownerTaskId,
|
|
18245
|
+
sourceIndex: choice.sourceIndex,
|
|
18246
|
+
variantIndex: choice.variantIndex
|
|
18247
|
+
}
|
|
18248
|
+
];
|
|
18249
|
+
})
|
|
18250
|
+
};
|
|
18251
|
+
}
|
|
18252
|
+
__name(buildClassicLandingSelection, "buildClassicLandingSelection");
|
|
18253
|
+
|
|
18213
18254
|
// ../../packages/types/src/shopify-meta-tracking.ts
|
|
18214
18255
|
import * as z76 from "zod";
|
|
18215
18256
|
var MetaTrackingOwnerSchema = z76.enum([
|
|
@@ -30083,7 +30124,7 @@ var ApiClient = class {
|
|
|
30083
30124
|
};
|
|
30084
30125
|
|
|
30085
30126
|
// src/index.ts
|
|
30086
|
-
var MCP_VERSION = "12.8.
|
|
30127
|
+
var MCP_VERSION = "12.8.1";
|
|
30087
30128
|
|
|
30088
30129
|
// src/meta-upload-app.ts
|
|
30089
30130
|
import { readFileSync } from "fs";
|
|
@@ -38086,7 +38127,9 @@ function registerPublishTools(server, api, opts = {}) {
|
|
|
38086
38127
|
const selectedLandingGif = includeLandingGif ? defaults?.gif ?? null : null;
|
|
38087
38128
|
const effectiveAvailable = availableImages > 0 ? availableImages : 3;
|
|
38088
38129
|
const numImages = Math.min(parsed.numLandingImages ?? effectiveAvailable, effectiveAvailable, SHOPIFY_MAX_LANDING_IMAGES);
|
|
38089
|
-
const
|
|
38130
|
+
const classic = includeLandingGif && defaults && variantIndex === 0 ? buildMcpClassicSelection(defaults, numImages) : null;
|
|
38131
|
+
const classicSelection = classic?.selection ?? null;
|
|
38132
|
+
const selectedLandingImages = classic?.images ?? Array.from({
|
|
38090
38133
|
length: numImages
|
|
38091
38134
|
}, (_, i) => ({
|
|
38092
38135
|
imageIndex: i,
|
|
@@ -38100,7 +38143,13 @@ function registerPublishTools(server, api, opts = {}) {
|
|
|
38100
38143
|
}),
|
|
38101
38144
|
shopDomain: parsed.shopDomain,
|
|
38102
38145
|
selectedLandingImages,
|
|
38103
|
-
|
|
38146
|
+
// Classic block landings publish their GIF blocks through the
|
|
38147
|
+
// ordered document, exactly like the web editor; the legacy
|
|
38148
|
+
// primary GIF only rides selectedLandingGif.
|
|
38149
|
+
...classicSelection ? {
|
|
38150
|
+
classicSelection,
|
|
38151
|
+
selectedLandingGif: null
|
|
38152
|
+
} : selectedLandingGif ? {
|
|
38104
38153
|
selectedLandingGif
|
|
38105
38154
|
} : {},
|
|
38106
38155
|
showVariantPicker: parsed.showVariantPicker,
|
|
@@ -38395,23 +38444,65 @@ async function fetchLandingPublishDefaults(api, taskId) {
|
|
|
38395
38444
|
const r = await api.getJson(`/v1/results/${encodeURIComponent(taskId)}`);
|
|
38396
38445
|
if (!isRecord3(r) || !isRecord3(r.landing)) return {
|
|
38397
38446
|
imageCount: 0,
|
|
38398
|
-
|
|
38447
|
+
images: [],
|
|
38448
|
+
gif: null,
|
|
38449
|
+
classic: null
|
|
38399
38450
|
};
|
|
38400
|
-
const
|
|
38451
|
+
const rawImages = Array.isArray(r.landing.images) ? r.landing.images : [];
|
|
38452
|
+
const images = rawImages.map((image2) => {
|
|
38453
|
+
const record = isRecord3(image2) ? image2 : {};
|
|
38454
|
+
return {
|
|
38455
|
+
ownerTaskId: typeof record.variantTaskId === "string" ? record.variantTaskId : taskId,
|
|
38456
|
+
sourceIndex: Number(record.sourceIndex ?? record.index)
|
|
38457
|
+
};
|
|
38458
|
+
});
|
|
38401
38459
|
const demo = LandingGifReadableSchema.safeParse(r.landing.demoGif);
|
|
38402
38460
|
const gif = demo.success && demo.data.ownerTaskId === taskId && demo.data.quality.verdict === "passed" ? {
|
|
38403
38461
|
ownerTaskId: taskId,
|
|
38404
38462
|
gifRevision: demo.data.gifRevision
|
|
38405
38463
|
} : null;
|
|
38464
|
+
const document = ClassicLandingDocumentSchema.safeParse(r.landing.classicDocument);
|
|
38465
|
+
const gifs = (Array.isArray(r.landing.gifBlocks) ? r.landing.gifBlocks : []).flatMap((entry) => {
|
|
38466
|
+
const parsed = LandingGifItemSchema.safeParse(entry);
|
|
38467
|
+
return parsed.success ? [
|
|
38468
|
+
parsed.data
|
|
38469
|
+
] : [];
|
|
38470
|
+
});
|
|
38406
38471
|
return {
|
|
38407
|
-
imageCount:
|
|
38408
|
-
|
|
38472
|
+
imageCount: rawImages.length,
|
|
38473
|
+
images,
|
|
38474
|
+
gif,
|
|
38475
|
+
classic: document.success ? {
|
|
38476
|
+
document: document.data,
|
|
38477
|
+
gifs
|
|
38478
|
+
} : null
|
|
38409
38479
|
};
|
|
38410
38480
|
} catch {
|
|
38411
38481
|
return null;
|
|
38412
38482
|
}
|
|
38413
38483
|
}
|
|
38414
38484
|
__name(fetchLandingPublishDefaults, "fetchLandingPublishDefaults");
|
|
38485
|
+
function buildMcpClassicSelection(defaults, numImages) {
|
|
38486
|
+
if (!defaults.classic) return null;
|
|
38487
|
+
const { document, gifs } = defaults.classic;
|
|
38488
|
+
const gifBlockIds = document.blocks.flatMap((block) => block.kind === "gif" && gifs.some((item) => item.gifId === block.gifId && item.ownerTaskId === block.ownerTaskId && isDeliverableLandingGif(item)) ? [
|
|
38489
|
+
classicLandingBlockId(block)
|
|
38490
|
+
] : []);
|
|
38491
|
+
if (gifBlockIds.length === 0) return null;
|
|
38492
|
+
const selection = buildClassicLandingSelection(document, gifs, gifBlockIds, defaults.images.map((image2, arrayIndex) => ({
|
|
38493
|
+
...image2,
|
|
38494
|
+
selected: arrayIndex < numImages,
|
|
38495
|
+
variantIndex: 0
|
|
38496
|
+
})));
|
|
38497
|
+
return {
|
|
38498
|
+
selection,
|
|
38499
|
+
images: (selection.images ?? []).map((selected) => ({
|
|
38500
|
+
imageIndex: defaults.images.findIndex((image2) => image2.ownerTaskId === selected.ownerTaskId && image2.sourceIndex === selected.sourceIndex),
|
|
38501
|
+
variantIndex: selected.variantIndex
|
|
38502
|
+
}))
|
|
38503
|
+
};
|
|
38504
|
+
}
|
|
38505
|
+
__name(buildMcpClassicSelection, "buildMcpClassicSelection");
|
|
38415
38506
|
function toMetaCampaignOverrides(cfg) {
|
|
38416
38507
|
const out = {};
|
|
38417
38508
|
if (cfg.dailyBudgetUsd !== void 0) out.dailyBudgetUsd = cfg.dailyBudgetUsd;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@productmaker/mcp",
|
|
3
|
-
"version": "12.8.
|
|
3
|
+
"version": "12.8.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "ProductMaker MCP server — cost products, generate landing pages, UGC videos, and ad creatives, and publish to Shopify, Meta Ads, and TikTok Ads.",
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
"typescript": "^7.0.2",
|
|
68
68
|
"vitest": "5.0.3",
|
|
69
69
|
"@packages/product-economics": "0.1.0",
|
|
70
|
-
"@packages/
|
|
71
|
-
"@packages/
|
|
70
|
+
"@packages/utils": "0.1.0",
|
|
71
|
+
"@packages/types": "0.1.0"
|
|
72
72
|
},
|
|
73
73
|
"publishConfig": {
|
|
74
74
|
"access": "public"
|