@diviops/mcp-server 1.5.45 → 1.5.46
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.js +20 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4620,11 +4620,12 @@ function registerProTools() {
|
|
|
4620
4620
|
requiredCapabilities: ["page_update_content_expected_checksum"],
|
|
4621
4621
|
});
|
|
4622
4622
|
registerProTool("diviops_fc_campaign_page_apply", {
|
|
4623
|
-
description: "Create one new draft campaign page or insert/replace one exact-owned campaign-page segment on an existing Divi page.
|
|
4623
|
+
description: "Create one new draft campaign page or insert/replace one exact-owned campaign-page segment on an existing Divi page. All PAGE profiles compose an H1 hero, product section, and H2 closing section; SECTION is unchanged. Choose preset_campaign_page_flexible_v1 for native Divi Image/Text plus one native Buy Now in the product section, no ProductCard: 16 modules, exactly seven distinct installed preset roles (section, row, column, heading, body, image, buy_now). It requires image_attachment_id: an existing readable WordPress raster-image attachment. The sanitized product title and attachment identity/URL/alt/dimensions are authoring snapshots bound to confirmation; empty alt falls back to the product title. No image import/fetch, stored price/stock, or automatic catalog/image syncing. Native Buy Now retains live FluentCart behavior. Choose preset_campaign_page_native_card_v1 for a short page with one native card CTA: 14 modules, exactly six installed preset roles (section, row, column, heading, body, product_card), and closing copy referring to the card above. The existing preset_campaign_page_v1 intentionally repeats the CTA with native Buy Now below the closing copy: 15 modules and seven roles including buy_now and product_card. image_attachment_id and the image role are forbidden for both card profiles. It accepts one published storefront-ready FluentCart product. Dry-run audits presets and returns exact preset checksums, page markup, validation/render evidence, rollback plan, and a profile-bound plan checksum. Apply requires those exact preset checksums plus confirm_plan_sha256. Existing-page writes also require page_update_content_expected_checksum, an exact page checksum, mandatory backup, and either start/end insertion or a same-profile prior receipt. Cross-profile receipts are refused, not migrated. New pages are always drafts with an explicit title and sanitized slug; their rollback is exact page trash. The workflow never creates or repairs presets, accepts arbitrary copy/design input, publishes a page, or mutates FluentCart commerce state." +
|
|
4624
4624
|
DRY_RUN_DESC_SUFFIX,
|
|
4625
4625
|
inputSchema: {
|
|
4626
4626
|
product_id: z.number().int().positive().describe("Published FluentCart product ID whose storefront_links.ready is true."),
|
|
4627
|
-
profile: z.enum(["preset_campaign_page_v1", "preset_campaign_page_native_card_v1"]),
|
|
4627
|
+
profile: z.enum(["preset_campaign_page_v1", "preset_campaign_page_native_card_v1", "preset_campaign_page_flexible_v1"]),
|
|
4628
|
+
image_attachment_id: z.number().int().positive().optional().describe("Required only for preset_campaign_page_flexible_v1; forbidden for other profiles. Existing readable WordPress raster-image attachment; no URL/import/fetch."),
|
|
4628
4629
|
destination: z.discriminatedUnion("mode", [
|
|
4629
4630
|
z
|
|
4630
4631
|
.object({
|
|
@@ -4647,7 +4648,7 @@ function registerProTools() {
|
|
|
4647
4648
|
schema: z.literal("diviops.fluentcart_campaign_page.receipt.v1"),
|
|
4648
4649
|
page_id: z.number().int().positive(),
|
|
4649
4650
|
product_id: z.number().int().positive(),
|
|
4650
|
-
profile: z.enum(["preset_campaign_page_v1", "preset_campaign_page_native_card_v1"]),
|
|
4651
|
+
profile: z.enum(["preset_campaign_page_v1", "preset_campaign_page_native_card_v1", "preset_campaign_page_flexible_v1"]),
|
|
4651
4652
|
section_labels: z.object({ hero: z.string(), product: z.string(), closing: z.string() }).strict(),
|
|
4652
4653
|
segment_sha256: z.string().regex(/^sha256:[a-f0-9]{64}$/),
|
|
4653
4654
|
page_sha256: z.string().regex(/^sha256:[a-f0-9]{64}$/),
|
|
@@ -4668,8 +4669,9 @@ function registerProTools() {
|
|
|
4668
4669
|
column: z.string().min(1).max(128),
|
|
4669
4670
|
heading: z.string().min(1).max(128),
|
|
4670
4671
|
body: z.string().min(1).max(128),
|
|
4671
|
-
product_card: z.string().min(1).max(128),
|
|
4672
|
-
buy_now: z.string().min(1).max(128).optional().describe("Required
|
|
4672
|
+
product_card: z.string().min(1).max(128).optional().describe("Required for both card profiles; forbidden for preset_campaign_page_flexible_v1."),
|
|
4673
|
+
buy_now: z.string().min(1).max(128).optional().describe("Required for legacy and flexible profiles; forbidden for preset_campaign_page_native_card_v1."),
|
|
4674
|
+
image: z.string().min(1).max(128).optional().describe("Required only for preset_campaign_page_flexible_v1; forbidden for other profiles."),
|
|
4673
4675
|
})
|
|
4674
4676
|
.strict(),
|
|
4675
4677
|
expected_preset_checksums: z
|
|
@@ -4679,8 +4681,9 @@ function registerProTools() {
|
|
|
4679
4681
|
column: z.string().regex(/^sha256:[a-f0-9]{64}$/),
|
|
4680
4682
|
heading: z.string().regex(/^sha256:[a-f0-9]{64}$/),
|
|
4681
4683
|
body: z.string().regex(/^sha256:[a-f0-9]{64}$/),
|
|
4682
|
-
product_card: z.string().regex(/^sha256:[a-f0-9]{64}$/),
|
|
4683
|
-
buy_now: z.string().regex(/^sha256:[a-f0-9]{64}$/).optional().describe("Required
|
|
4684
|
+
product_card: z.string().regex(/^sha256:[a-f0-9]{64}$/).optional().describe("Required for both card profiles; forbidden for preset_campaign_page_flexible_v1."),
|
|
4685
|
+
buy_now: z.string().regex(/^sha256:[a-f0-9]{64}$/).optional().describe("Required for legacy and flexible profiles; forbidden for preset_campaign_page_native_card_v1."),
|
|
4686
|
+
image: z.string().regex(/^sha256:[a-f0-9]{64}$/).optional().describe("Required only for preset_campaign_page_flexible_v1; forbidden for other profiles."),
|
|
4684
4687
|
})
|
|
4685
4688
|
.strict()
|
|
4686
4689
|
.optional()
|
|
@@ -4694,21 +4697,26 @@ function registerProTools() {
|
|
|
4694
4697
|
},
|
|
4695
4698
|
annotations: { idempotentHint: false },
|
|
4696
4699
|
_meta: { idempotent: "conditional" },
|
|
4697
|
-
}, async ({ product_id, profile, destination, preset_roles, expected_preset_checksums, confirm_plan_sha256, dry_run }) => {
|
|
4700
|
+
}, async ({ product_id, profile, image_attachment_id, destination, preset_roles, expected_preset_checksums, confirm_plan_sha256, dry_run }) => {
|
|
4698
4701
|
// The SDK publishes a raw object shape; enforce its cross-field profile rules before transport.
|
|
4699
|
-
const
|
|
4700
|
-
const
|
|
4702
|
+
const flexible = profile === "preset_campaign_page_flexible_v1";
|
|
4703
|
+
const needsBuyNow = profile !== "preset_campaign_page_native_card_v1";
|
|
4704
|
+
const roleMismatch = [preset_roles, expected_preset_checksums].some((roles) => roles !== undefined && (Object.hasOwn(roles, "buy_now") !== needsBuyNow ||
|
|
4705
|
+
Object.hasOwn(roles, "product_card") === flexible ||
|
|
4706
|
+
Object.hasOwn(roles, "image") !== flexible));
|
|
4701
4707
|
const receiptMismatch = destination.mode === "existing_page" && destination.receipt !== undefined && destination.receipt.profile !== profile;
|
|
4702
|
-
if (roleMismatch || receiptMismatch) {
|
|
4708
|
+
if (roleMismatch || receiptMismatch || (image_attachment_id !== undefined) !== flexible) {
|
|
4703
4709
|
return {
|
|
4704
4710
|
isError: true,
|
|
4705
4711
|
content: [{ type: "text", text: serializeEnvelope({
|
|
4706
4712
|
ok: false,
|
|
4707
|
-
error: { code: "invalid_input", message: "
|
|
4713
|
+
error: { code: "invalid_input", message: "Image input, preset roles, checksum roles, and prior receipt must match the selected PAGE profile.", data: { mutated: false } },
|
|
4708
4714
|
}, "diviops_fc_campaign_page_apply") }],
|
|
4709
4715
|
};
|
|
4710
4716
|
}
|
|
4711
4717
|
const body = { product_id, profile, destination, preset_roles };
|
|
4718
|
+
if (image_attachment_id !== undefined)
|
|
4719
|
+
body.image_attachment_id = image_attachment_id;
|
|
4712
4720
|
if (expected_preset_checksums !== undefined)
|
|
4713
4721
|
body.expected_preset_checksums = expected_preset_checksums;
|
|
4714
4722
|
if (confirm_plan_sha256 !== undefined)
|