@diviops/mcp-server 1.5.45 → 1.5.47

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.
Files changed (2) hide show
  1. package/dist/index.js +47 -12
  2. 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. Both PAGE profiles compose an H1 hero, a native Product Card section, and an H2 closing section; SECTION is unchanged. 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 all seven roles including buy_now. Neither profile is a flexible Divi-composed product design. 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." +
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 only for preset_campaign_page_v1; forbidden for preset_campaign_page_native_card_v1."),
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 only for preset_campaign_page_v1; forbidden for preset_campaign_page_native_card_v1."),
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 needsBuyNow = profile === "preset_campaign_page_v1";
4700
- const roleMismatch = [preset_roles, expected_preset_checksums].some((roles) => roles !== undefined && Object.hasOwn(roles, "buy_now") !== needsBuyNow);
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: "Preset roles, checksum roles, and prior receipt must match the selected PAGE profile.", data: { mutated: false } },
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)
@@ -4729,6 +4737,33 @@ function registerProTools() {
4729
4737
  capabilityKey: "fluentcart_campaign_page_apply",
4730
4738
  requiredCapabilities: ["page_update_content_expected_checksum"],
4731
4739
  });
4740
+ const campaignRefreshSchema = z.object({
4741
+ page_id: z.number().int().positive().describe("Explicit editable draft page, never a receipt-derived target."),
4742
+ product_id: z.number().int().positive().describe("Ready product matching the existing native BuyNow variation."),
4743
+ expected_page_checksum: z.string().regex(/^sha256:[a-f0-9]{64}$/),
4744
+ refresh: z.enum(["title", "image", "title_and_image"]),
4745
+ targets: z.object({
4746
+ section_auto_index: z.string().regex(/^section:[1-9][0-9]*$/),
4747
+ heading_auto_index: z.string().regex(/^heading:[1-9][0-9]*$/),
4748
+ image_auto_index: z.string().regex(/^image:[1-9][0-9]*$/),
4749
+ }).strict().describe("Current-layout indices for the first campaign section, hero H1 and product Image; no label/text guessing."),
4750
+ image_attachment_id: z.number().int().positive().optional().describe("Required for image/title_and_image; forbidden for title. Existing readable raster attachment only."),
4751
+ confirm_plan_sha256: z.string().regex(/^sha256:[a-f0-9]{64}$/).optional(),
4752
+ dry_run: z.boolean().optional().default(true),
4753
+ }).strict();
4754
+ registerProTool("diviops_fc_campaign_page_refresh", {
4755
+ description: "Refresh only the reviewed product title and/or explicitly selected image in one polished flexible campaign on a draft page. Preserves its 16-block segment, seven existing module-preset bindings, all local design/copy and single native BuyNow. Requires exact current page checksum and explicit section/H1/Image auto-indices, not a generator receipt. Defaults to dry-run; apply requires its exact confirmation.plan_sha256 and rechecks consumed product/image state. No-op creates no backup or write. Changed content delegates once to the Free checksum/backup writer; its existing failure compensation may restore content. Returns maintenance evidence, never a PAGE/SECTION receipt. No automatic catalog sync, preset repair, publication or commerce mutation.",
4756
+ inputSchema: campaignRefreshSchema,
4757
+ annotations: { idempotentHint: false }, _meta: { idempotent: "conditional" },
4758
+ }, async (args) => {
4759
+ if ((args.image_attachment_id !== undefined) !== (args.refresh !== "title") || (!args.dry_run && !args.confirm_plan_sha256)) {
4760
+ return { isError: true, content: [{ type: "text", text: serializeEnvelope({
4761
+ ok: false, error: { code: "invalid_input", message: "Image input must match the refresh mode; apply requires the reviewed plan confirmation.", data: { mutated: false } },
4762
+ }, "diviops_fc_campaign_page_refresh") }] };
4763
+ }
4764
+ const result = await wp.requestEnveloped("/pro/fluentcart/campaign-page/refresh", { method: "POST", body: args });
4765
+ return { content: [{ type: "text", text: serializeEnvelope(result, "diviops_fc_campaign_page_refresh") }] };
4766
+ }, { target: "fluentcart", capabilityKey: "fluentcart_campaign_page_refresh", requiredCapabilities: ["page_update_content_expected_checksum"] });
4732
4767
  // ── V2 — simple product writes ─────────────────────────────────────
4733
4768
  //
4734
4769
  // Three Pro write tools backing the constrained simple-onetime-product
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diviops/mcp-server",
3
- "version": "1.5.45",
3
+ "version": "1.5.47",
4
4
  "description": "MCP server exposing Divi 5 Visual Builder as tools for Claude",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",