@diviops/mcp-server 1.5.79 → 1.5.81

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/README.md CHANGED
@@ -300,7 +300,13 @@ Workflow:
300
300
  1. Call `diviops_cross_env_source_export_get` on the source site and save the
301
301
  returned `data` object as `source.json`.
302
302
  2. Call `diviops_cross_env_target_context_get` on the target site and save the
303
- returned `data` object as `target.json`.
303
+ returned `data` object as `target.json`. An absent menu ID or empty desktop value in a header
304
+ or footer uses the destination's primary menu location. For explicit menu IDs,
305
+ pass the names from `source.json`'s `menus` as `source_menu_names`. Review the
306
+ source and destination term IDs and match method. If a name has zero or
307
+ multiple matches, inspect the menus, repeat the source export with explicit
308
+ `menu_targets` (for example `{"2":3}`), and pass those destination IDs as
309
+ `target_menu_ids` when collecting fresh target context.
304
310
  3. Run `diviops-cross-env-preflight --source source.json --target target.json --dry-run --contract layout-v1`
305
311
  for `diviops_cross_env_layout_apply`. Omit the contract flag (or select
306
312
  `header-v1`) only for the compatibility header apply tool.
@@ -514,6 +520,14 @@ Common quick fixes — full reference in [troubleshooting.md](../docs/troublesho
514
520
  - For plugin and skill updates shipped alongside the server, see the [public distribution releases](https://github.com/oaris-dev/diviops/releases).
515
521
  - The [archive through MCP 1.5.77](https://github.com/oaris-dev/diviops/blob/v1.5.95/diviops-server/README.md#mcp-1577-release-note) preserves the original version notes and their qualification limits. The 1.5.67 note refers to the [WP-CLI command tiers](https://github.com/oaris-dev/diviops/blob/main/SETUP.md#wp-cli-security).
516
522
 
523
+ ### MCP 1.5.81 release note
524
+
525
+ Pair with DiviOps Agent 1.5.53 to check FluentCart activation on Free sites with `diviops_meta_info`. In `plugins.fluent_cart`, read `activation_known` before interpreting `active`. When `activation_known` is false, the server could not confirm activation.
526
+
527
+ ### MCP 1.5.80 release note
528
+
529
+ Pair with Agent Pro 1.0.20-beta to review navigation menus when transferring an existing Theme Builder header or footer between sites. The plan matches explicit menus by a unique name or a destination you select. It identifies menus that follow the destination’s primary theme location. Apply refuses an explicit selection when either side cannot verify the reviewed mapping.
530
+
517
531
  ### MCP 1.5.79 release note
518
532
 
519
533
  The package page now opens with client setup guides and a first connection check that lists up to five page IDs and titles. Existing installations need no configuration change.
@@ -1,3 +1,4 @@
1
+ import { type MenuMapping, type MenuSource, type MenuTarget } from "./menus.js";
1
2
  export type CrossEnvObjectKind = "tb_header_layout";
2
3
  export type CrossEnvVerdict = "safe_dry_run" | "operator_action_required" | "refused";
3
4
  export interface SourceAttachmentInventoryItem {
@@ -7,7 +8,7 @@ export interface SourceAttachmentInventoryItem {
7
8
  filename?: string;
8
9
  mime?: string;
9
10
  }
10
- export interface SourceLayoutPayload {
11
+ export interface SourceLayoutPayload extends MenuSource {
11
12
  origin: string;
12
13
  object_kind: CrossEnvObjectKind | string;
13
14
  object_id?: number | string;
@@ -33,7 +34,7 @@ export interface Sha256Checksum {
33
34
  computed: string;
34
35
  input?: string;
35
36
  }
36
- export interface TargetLayoutContext {
37
+ export interface TargetLayoutContext extends MenuTarget {
37
38
  origin: string;
38
39
  destination_kind: CrossEnvObjectKind | string;
39
40
  destination_id?: number | string;
@@ -129,6 +130,7 @@ export interface CrossEnvHeaderPreflightReport {
129
130
  off_canvas: OffCanvasReference[];
130
131
  };
131
132
  rewrite_plan: {
133
+ menus?: MenuMapping[];
132
134
  url_rewrites: Array<{
133
135
  from: string;
134
136
  to: string;
@@ -153,7 +155,7 @@ export interface CrossEnvHeaderPreflightReport {
153
155
  operator_actions: PreflightIssue[];
154
156
  notes: string[];
155
157
  confirmation_binding: {
156
- schema: "diviops.cross_env.header_preflight.confirmation_binding.v1";
158
+ schema: "diviops.cross_env.header_preflight.confirmation_binding.v1" | "diviops.cross_env.header_preflight.confirmation_binding.v2";
157
159
  algorithm: "sha256";
158
160
  fingerprint: string;
159
161
  input: Record<string, unknown>;
@@ -1,3 +1,4 @@
1
+ import { PRIMARY_MENU_NOTE, planMenus } from "./menus.js";
1
2
  import { createHash } from "node:crypto";
2
3
  const SUPPORTED_KIND = "tb_header_layout";
3
4
  const UPLOADS_PREFIX = "/wp-content/uploads/";
@@ -638,7 +639,7 @@ function buildConfirmationBinding(report) {
638
639
  }
639
640
  : {}),
640
641
  };
641
- const schema = "diviops.cross_env.header_preflight.confirmation_binding.v1";
642
+ const schema = report.rewrite_plan.menus ? "diviops.cross_env.header_preflight.confirmation_binding.v2" : "diviops.cross_env.header_preflight.confirmation_binding.v1";
642
643
  const fingerprint = sha256(canonicalJson({ schema, input }));
643
644
  return {
644
645
  schema,
@@ -814,6 +815,8 @@ export function preflightCrossEnvHeaderSync(input) {
814
815
  const missingAttachmentRemaps = attachments
815
816
  .filter((attachment) => attachment.status !== "proven_remap")
816
817
  .map((attachment) => attachment.source_id);
818
+ const menus = planMenus(input.source, input.target);
819
+ blockers.push(...menus.blockers);
817
820
  const verdict = blockers.length > 0
818
821
  ? "refused"
819
822
  : operatorActions.length > 0
@@ -854,6 +857,7 @@ export function preflightCrossEnvHeaderSync(input) {
854
857
  off_canvas: offCanvas,
855
858
  },
856
859
  rewrite_plan: {
860
+ ...(menus.mappings.length || menus.blockers.length ? { menus: menus.mappings } : {}),
857
861
  url_rewrites: urlRewrites,
858
862
  attachment_replacements: attachmentReplacements,
859
863
  third_party_urls_kept: urls
@@ -865,6 +869,7 @@ export function preflightCrossEnvHeaderSync(input) {
865
869
  blockers,
866
870
  operator_actions: operatorActions,
867
871
  notes: [
872
+ ...(menus.refs.some(ref => ref.selection === "primary_location") ? [PRIMARY_MENU_NOTE] : []),
868
873
  "Preflight only: no WordPress write/apply path exists in this slice.",
869
874
  "The rewrite plan is descriptive and does not mutate markup.",
870
875
  "Fail-closed behavior is intentional for missing attachment remaps, missing gcid definitions, and off-canvas wiring.",
@@ -1,3 +1,4 @@
1
+ import { type MenuMapping } from "./menus.js";
1
2
  import { type CrossEnvVerdict, type GcidReference, type ModulePresetReference, type OffCanvasReference, type PreflightIssue, type Sha256Checksum, type SourceLayoutPayload, type TargetLayoutContext, type AttachmentReference, type UrlOccurrence } from "./header-preflight.js";
2
3
  export declare const THEME_BUILDER_LAYOUT_KIND_POST_TYPES: {
3
4
  readonly tb_header_layout: "et_header_layout";
@@ -61,6 +62,7 @@ export interface CrossEnvThemeBuilderLayoutPreflightReport {
61
62
  rewrite_scope: "same_origin_wp_uploads_only";
62
63
  };
63
64
  rewrite_plan: {
65
+ menus?: MenuMapping[];
64
66
  url_rewrites: Array<{
65
67
  from: string;
66
68
  to: string;
@@ -85,7 +87,7 @@ export interface CrossEnvThemeBuilderLayoutPreflightReport {
85
87
  operator_actions: PreflightIssue[];
86
88
  notes: string[];
87
89
  confirmation_binding: {
88
- schema: "diviops.cross_env.theme_builder_layout_preflight.confirmation_binding.v1";
90
+ schema: "diviops.cross_env.theme_builder_layout_preflight.confirmation_binding.v1" | "diviops.cross_env.theme_builder_layout_preflight.confirmation_binding.v2";
89
91
  algorithm: "sha256";
90
92
  fingerprint: string;
91
93
  input: Record<string, unknown>;
@@ -1,4 +1,5 @@
1
1
  import { createHash } from "node:crypto";
2
+ import { PRIMARY_MENU_NOTE } from "./menus.js";
2
3
  import { staffCanonical, staffSourceProof, validStaffTarget } from "./staff-body.js";
3
4
  import { preflightCrossEnvHeaderSync, } from "./header-preflight.js";
4
5
  export const THEME_BUILDER_LAYOUT_KIND_POST_TYPES = {
@@ -43,9 +44,7 @@ function replaceCacheDestinationKind(target, kind) {
43
44
  return target.replace(/^tb_header_layout(?=#|$)/, kind);
44
45
  }
45
46
  export function preflightCrossEnvThemeBuilderLayoutSync(input) {
46
- // The shipped header-v1 engine remains the immutable compatibility analyzer.
47
- // The generic contract reuses its hazard inventory while owning a distinct
48
- // report and fingerprint namespace.
47
+ // Reuse header dependency resolution with a layout-specific fingerprint namespace.
49
48
  const base = preflightCrossEnvHeaderSync({
50
49
  source: { ...input.source, object_kind: "tb_header_layout" },
51
50
  target: { ...input.target, destination_kind: "tb_header_layout" },
@@ -58,6 +57,9 @@ export function preflightCrossEnvThemeBuilderLayoutSync(input) {
58
57
  const targetExpectedType = expectedPostType(targetKind);
59
58
  const body = sourceKind === "tb_body_layout" || targetKind === "tb_body_layout";
60
59
  if (body) {
60
+ if (base.rewrite_plan.menus) {
61
+ blockers.push({ code: "staff_body_menu_unsupported", message: "Staff body promotion cannot verify a menu-bearing recipe." });
62
+ }
61
63
  try {
62
64
  if (staffCanonical(staffSourceProof(input.source.markup)) !== staffCanonical(input.source.staff_body))
63
65
  throw Error("missing or mismatched source proof");
@@ -165,6 +167,7 @@ export function preflightCrossEnvThemeBuilderLayoutSync(input) {
165
167
  blockers,
166
168
  operator_actions: operatorActions,
167
169
  notes: [
170
+ ...base.notes.filter(note => note === PRIMARY_MENU_NOTE),
168
171
  "Preflight only: Free/core evidence and CLI do not mutate WordPress.",
169
172
  "The generic binding is distinct from the shipped header-v1 fingerprint.",
170
173
  "Template linkage is drift evidence only and never authorizes assignment mutation.",
@@ -207,7 +210,7 @@ export function preflightCrossEnvThemeBuilderLayoutSync(input) {
207
210
  operator_actions: stableIssues(operatorActions),
208
211
  validator_contract: validatorContract,
209
212
  };
210
- const schema = "diviops.cross_env.theme_builder_layout_preflight.confirmation_binding.v1";
213
+ const schema = base.rewrite_plan.menus ? "diviops.cross_env.theme_builder_layout_preflight.confirmation_binding.v2" : "diviops.cross_env.theme_builder_layout_preflight.confirmation_binding.v1";
211
214
  const canonicalInput = canonicalize(bindingInput);
212
215
  return {
213
216
  ...reportWithoutBinding,
@@ -0,0 +1,48 @@
1
+ import type { WPClient } from "../wp-client.js";
2
+ export interface MenuTerm {
3
+ id: number;
4
+ name: string;
5
+ slug: string;
6
+ }
7
+ export interface MenuIdentity extends MenuTerm {
8
+ digest: string;
9
+ }
10
+ export interface MenuMapping {
11
+ module: string;
12
+ source: MenuIdentity;
13
+ target: MenuIdentity;
14
+ match: "unique_name" | "operator";
15
+ }
16
+ export interface MenuSource {
17
+ menus?: MenuIdentity[];
18
+ menu_targets?: Record<string, number>;
19
+ }
20
+ export interface MenuTarget {
21
+ menus?: MenuIdentity[];
22
+ }
23
+ export declare const PRIMARY_MENU_NOTE = "Uses the destination's primary menu location.";
24
+ declare function menuSelection(attrs: unknown): number | "primary_location" | null;
25
+ export declare function menuReferences(markup: string): {
26
+ module: string;
27
+ selection: ReturnType<typeof menuSelection>;
28
+ }[];
29
+ export declare function planMenus(source: MenuSource & {
30
+ markup: string;
31
+ }, target: MenuTarget): {
32
+ refs: {
33
+ module: string;
34
+ selection: ReturnType<typeof menuSelection>;
35
+ }[];
36
+ mappings: MenuMapping[];
37
+ blockers: {
38
+ code: string;
39
+ message: string;
40
+ }[];
41
+ };
42
+ export declare function readMenus(client: WPClient, select: (term: MenuTerm) => boolean): Promise<MenuIdentity[]>;
43
+ export declare function targetMenus(client: WPClient, names?: string[], ids?: number[]): Promise<MenuTarget>;
44
+ export declare function targetMenuHints(source: MenuSource): {
45
+ names: string[] | undefined;
46
+ ids: number[];
47
+ };
48
+ export {};
@@ -0,0 +1,87 @@
1
+ import { createHash } from "node:crypto";
2
+ export const PRIMARY_MENU_NOTE = "Uses the destination's primary menu location.";
3
+ function menuSelection(attrs) {
4
+ let node = attrs;
5
+ for (const key of ["menu", "advanced", "menuId"]) {
6
+ if (!node || typeof node !== "object" || Array.isArray(node))
7
+ return null;
8
+ if (!Object.hasOwn(node, key))
9
+ return "primary_location";
10
+ node = node[key];
11
+ }
12
+ if (!node || typeof node !== "object" || Object.keys(node).join() !== "desktop")
13
+ return null;
14
+ const desktop = node.desktop;
15
+ if (!desktop || typeof desktop !== "object" || Object.keys(desktop).join() !== "value")
16
+ return null;
17
+ const value = desktop.value;
18
+ if (value === "")
19
+ return "primary_location";
20
+ if ((typeof value === "number" || typeof value === "string") &&
21
+ /^[1-9]\d*$/.test(String(value)) && Number.isSafeInteger(Number(value)))
22
+ return Number(value);
23
+ return null;
24
+ }
25
+ export function menuReferences(markup) {
26
+ const refs = [];
27
+ for (const match of markup.matchAll(/<!--\s+wp:(divi\/(?:fullwidth-)?menu)(?=[\s/])([\s\S]*?)-->/g)) {
28
+ let selection = null;
29
+ try {
30
+ selection = menuSelection(JSON.parse(match[2].replace(/\/\s*$/, "").trim() || "{}"));
31
+ }
32
+ catch { /* Malformed attributes remain a blocking reference. */ }
33
+ refs.push({ module: match[1], selection });
34
+ }
35
+ return refs;
36
+ }
37
+ export function planMenus(source, target) {
38
+ const refs = menuReferences(source.markup);
39
+ const mappings = [];
40
+ const blockers = [];
41
+ for (const ref of refs) {
42
+ if (ref.selection === "primary_location")
43
+ continue;
44
+ const origins = source.menus?.filter(menu => menu.id === ref.selection) ?? [];
45
+ const origin = origins[0];
46
+ const chosen = ref.selection === null ? undefined : source.menu_targets?.[ref.selection];
47
+ const matches = target.menus?.filter(menu => chosen === undefined ? menu.name === origin?.name : menu.id === chosen) ?? [];
48
+ if (origins.length !== 1 || !origin?.name || matches.length !== 1 ||
49
+ ![origin, matches[0]].every(menu => Number.isSafeInteger(menu.id) && menu.id > 0 &&
50
+ typeof menu.name === "string" && typeof menu.slug === "string" && /^[a-f0-9]{64}$/.test(menu.digest))) {
51
+ blockers.push({ code: "menu_mapping_unverified", message: `Cannot resolve ${ref.module} menu ${ref.selection ?? "(unsupported selection)"}. Inspect current menu names on both sites or provide an explicit destination for this source ID.` });
52
+ continue;
53
+ }
54
+ mappings.push({ module: ref.module, source: origin, target: matches[0], match: chosen === undefined ? "unique_name" : "operator" });
55
+ }
56
+ return { refs, mappings, blockers };
57
+ }
58
+ // Hash only the menu endpoint's published member fields, in their stored order.
59
+ // Only the digest and public term identity enter the exported plan.
60
+ async function readMenu(client, term) {
61
+ const result = await client.requestEnveloped(`/menu/get/${term.id}`);
62
+ if (!result.ok)
63
+ throw new Error("Cannot read the reviewed navigation menu.");
64
+ const { menu, items } = result.data;
65
+ if (menu.id !== term.id || menu.name !== term.name || menu.slug !== term.slug || !Array.isArray(items))
66
+ throw new Error("Navigation menu changed during inventory.");
67
+ const fields = ["id", "title", "url", "type", "object", "object_id", "parent", "order"];
68
+ const digest = createHash("sha256").update(JSON.stringify(items.map(item => fields.map(field => item[field])))).digest("hex");
69
+ return { id: menu.id, name: menu.name, slug: menu.slug, digest };
70
+ }
71
+ export async function readMenus(client, select) {
72
+ const result = await client.requestEnveloped("/menu/list");
73
+ if (!result.ok)
74
+ throw new Error("Cannot inventory navigation menus. Check edit_theme_options on the connected site.");
75
+ const menus = [];
76
+ for (const term of result.data.menus.filter(select))
77
+ menus.push(await readMenu(client, term));
78
+ return menus;
79
+ }
80
+ export async function targetMenus(client, names = [], ids = []) {
81
+ if (!names.length && !ids.length)
82
+ return {};
83
+ return { menus: await readMenus(client, term => names.includes(term.name) || ids.includes(term.id)) };
84
+ }
85
+ export function targetMenuHints(source) {
86
+ return { names: source.menus?.map(menu => menu.name), ids: Object.values(source.menu_targets ?? {}) };
87
+ }
package/dist/index.js CHANGED
@@ -21,6 +21,7 @@ import { ErrorCodes, envelopeMap, recordIdempotent, serializeEnvelope, withCode,
21
21
  import { preflightCrossEnvHeaderSync, } from "./cross-env-preflight/header-preflight.js";
22
22
  import { preflightCrossEnvThemeBuilderLayoutSync, } from "./cross-env-preflight/layout-preflight.js";
23
23
  import { crossEnvEvidenceLayoutKinds } from "./cross-env-preflight/layout-capability.js";
24
+ import { menuReferences, readMenus, targetMenuHints, targetMenus } from "./cross-env-preflight/menus.js";
24
25
  import { sourceHintsFromPayload } from "./cross-env-source-hints.js";
25
26
  import { createSourcePayloadRef, loadSourcePayloadRef, } from "./cross-env-preflight/source-payload-ref.js";
26
27
  import { optimizeSchema } from "./schema-optimizer.js";
@@ -183,12 +184,16 @@ function buildPluginVersionSummary() {
183
184
  return {
184
185
  diviops_agent: { active: false, version: null },
185
186
  diviops_agent_pro: { active: false, version: null },
186
- fluent_cart: { active: false, version: null },
187
+ fluent_cart: { active: false, version: null, activation_known: false },
187
188
  fluent_cart_pro: { active: false, version: null },
188
189
  };
189
190
  }
190
191
  const plugins = handshakeState.plugins;
191
192
  const fluentCartTarget = handshakeState.availableTargets.fluentcart;
193
+ const fluentCart = plugins.fluent_cart ?? {
194
+ active: fluentCartTarget?.present,
195
+ version: fluentCartTarget?.version ?? null,
196
+ };
192
197
  return {
193
198
  diviops_agent: {
194
199
  active: true,
@@ -198,9 +203,11 @@ function buildPluginVersionSummary() {
198
203
  active: handshakeState.proActive,
199
204
  version: handshakeState.proVersion ?? null,
200
205
  },
201
- fluent_cart: plugins.fluent_cart ?? {
202
- active: fluentCartTarget?.present === true,
203
- version: fluentCartTarget?.version ?? null,
206
+ fluent_cart: {
207
+ ...fluentCart,
208
+ active: fluentCart.active === true,
209
+ // Older Agents may supply neither record. Keep the legacy boolean for readers.
210
+ activation_known: typeof fluentCart.active === "boolean",
204
211
  },
205
212
  fluent_cart_pro: plugins.fluent_cart_pro ?? {
206
213
  active: false,
@@ -2779,6 +2786,8 @@ function registerCrossEnvEvidenceTools() {
2779
2786
  .optional()
2780
2787
  .default("tb_header_layout")
2781
2788
  .describe(`Destination kind. Existing ${layoutLabel} layout evidence is supported.${staffNote}`),
2789
+ source_menu_names: z.array(z.string()).optional().describe("Menu names from the source export; inventories all matching destination menus."),
2790
+ target_menu_ids: z.array(z.number().int().positive()).optional().describe("Explicit destination IDs from the source export menu_targets."),
2782
2791
  source_asset_hints: z
2783
2792
  .array(z.string())
2784
2793
  .optional()
@@ -2799,7 +2808,7 @@ function registerCrossEnvEvidenceTools() {
2799
2808
  },
2800
2809
  annotations: { idempotentHint: true },
2801
2810
  _meta: { idempotent: "true" },
2802
- }, async ({ destination_id, destination_kind, source_asset_hints, source_upload_paths, source_attachment_ids, }) => {
2811
+ }, async ({ destination_id, destination_kind, source_menu_names, target_menu_ids, source_asset_hints, source_upload_paths, source_attachment_ids, }) => {
2803
2812
  const body = {
2804
2813
  destination_id,
2805
2814
  destination_kind: destination_kind ?? "tb_header_layout",
@@ -2813,9 +2822,11 @@ function registerCrossEnvEvidenceTools() {
2813
2822
  if (source_attachment_ids && source_attachment_ids.length > 0) {
2814
2823
  body.source_attachment_ids = source_attachment_ids;
2815
2824
  }
2816
- const result = await wp.requestEnveloped("/cross-env/target-context", {
2817
- method: "POST",
2818
- body,
2825
+ const result = await wrapResponse(async () => {
2826
+ const context = await wp.requestEnveloped("/cross-env/target-context", { method: "POST", body });
2827
+ if (context.ok)
2828
+ Object.assign(context.data, await targetMenus(wp, source_menu_names, target_menu_ids));
2829
+ return context;
2819
2830
  });
2820
2831
  return {
2821
2832
  content: [
@@ -2829,6 +2840,7 @@ function registerCrossEnvEvidenceTools() {
2829
2840
  registerPluginTool("diviops_cross_env_source_export_get", {
2830
2841
  description: `Export read-only, secret-free source-site payload for an offline cross-environment Theme Builder ${layoutLabel} preflight. Returns exact kind/post-type identity, sanitized markup and checksum, dependency inventories, and a bounded source_payload_ref. Free/core and read-only: no WordPress content, assignment, dependency, or cache mutation.${staffNote}`,
2831
2842
  inputSchema: {
2843
+ menu_targets: z.record(z.string(), z.number().int().positive()).optional().describe("Optional operator-reviewed source menu ID to destination menu ID choices."),
2832
2844
  source_id: z
2833
2845
  .number()
2834
2846
  .int()
@@ -2847,7 +2859,7 @@ function registerCrossEnvEvidenceTools() {
2847
2859
  },
2848
2860
  annotations: { idempotentHint: true },
2849
2861
  _meta: { idempotent: "true" },
2850
- }, async ({ source_id, source_kind }) => {
2862
+ }, async ({ source_id, source_kind, menu_targets }) => {
2851
2863
  const withRef = await wrapResponse(async () => {
2852
2864
  const body = {
2853
2865
  source_id,
@@ -2857,6 +2869,14 @@ function registerCrossEnvEvidenceTools() {
2857
2869
  method: "POST",
2858
2870
  body,
2859
2871
  });
2872
+ if (result.ok) {
2873
+ const refs = menuReferences(result.data.markup);
2874
+ if (refs.some(ref => typeof ref.selection === "number")) {
2875
+ result.data.menus = await readMenus(wp, term => refs.some(ref => ref.selection === term.id));
2876
+ if (menu_targets)
2877
+ result.data.menu_targets = menu_targets;
2878
+ }
2879
+ }
2860
2880
  return envelopeMap(result, (data) => ({
2861
2881
  ...data,
2862
2882
  source_payload_ref: createSourcePayloadRef(data),
@@ -4630,7 +4650,7 @@ function registerProTools() {
4630
4650
  }, { target: "managed_recovery", capabilityKey: "managed_recovery_plan_v1" });
4631
4651
  // diviops_cross_env_header_apply — guarded Pro apply for reviewed header preflight
4632
4652
  registerProTool("diviops_cross_env_header_apply", {
4633
- description: "Apply a reviewed cross-environment Theme Builder header payload into an existing target header layout (Pro tier; requires the cross_env Pro module). This first MVP is intentionally narrow: it requires `confirm_apply: true`, either an inline source export payload or a bounded `source_payload_ref` returned by diviops_cross_env_source_export_get, an existing target `destination_id`, and the reviewed `confirmation_binding.fingerprint` from `diviops-cross-env-preflight`. Large real headers should use `source_payload_ref`; inline `source_payload` remains supported for small/disposable tests. The server loads referenced payload bytes from its own `.diviops-tmp/cross-env-source-payloads/` artifact store, verifies checksum, re-exports current target context, reruns the TypeScript preflight engine, refuses fingerprint mismatch, unsafe verdicts, destination checksum drift, missing/ambiguous attachment remaps, missing global-color value evidence, missing target module preset definitions, and off-canvas/canvas references, then calls the Pro route with the verified plan. The Pro route re-loads the destination post, verifies the current checksum again, builds content only from source-origin upload URL rewrites and proven attachment-ID remaps, writes with readback/rollback evidence, and runs Divi static-resource cleanup plus explicit _divi_dynamic_assets_cached_feature_used cleanup. No media upload/import, global-color creation/import, preset import/clone, new layout creation, off-canvas reconcile, public/store/license change, or live-site smoke is performed by this tool. Returns the standardized envelope { ok, data?, error: { code, message, hint?, data? } }. Error codes include cross_env.confirmation_required, cross_env.source_payload_ref_invalid, cross_env.fingerprint_mismatch, cross_env.preflight_not_safe, cross_env.destination_checksum_drift, cross_env.source_checksum_mismatch, cross_env.content_write_corruption, invalid_input, not_found, forbidden, and wp_error.",
4653
+ description: "Apply a reviewed cross-environment Theme Builder header payload into an existing target header layout (Pro tier; requires the cross_env Pro module). This first MVP is intentionally narrow: it requires `confirm_apply: true`, either an inline source export payload or a bounded `source_payload_ref` returned by diviops_cross_env_source_export_get, an existing target `destination_id`, and the reviewed `confirmation_binding.fingerprint` from `diviops-cross-env-preflight`. Large real headers should use `source_payload_ref`; inline `source_payload` remains supported for small/disposable tests. The server loads referenced payload bytes from its own `.diviops-tmp/cross-env-source-payloads/` artifact store, verifies checksum, re-exports current target context, reruns the TypeScript preflight engine, refuses fingerprint mismatch, unsafe verdicts, destination checksum drift, missing/ambiguous attachment remaps, missing global-color value evidence, missing target module preset definitions, off-canvas/canvas references, and unverified navigation menus, then calls the Pro route with the verified plan. The Pro route re-loads the destination post, verifies the current checksum again, builds content from reviewed upload URL, attachment and menu mappings, writes with readback/rollback evidence, and runs Divi static-resource cleanup plus explicit _divi_dynamic_assets_cached_feature_used cleanup. No media upload/import, global-color creation/import, preset import/clone, new layout creation, off-canvas reconcile, public/store/license change, or live-site smoke is performed by this tool. Returns the standardized envelope { ok, data?, error: { code, message, hint?, data? } }. Error codes include cross_env.confirmation_required, cross_env.source_payload_ref_invalid, cross_env.fingerprint_mismatch, cross_env.preflight_not_safe, cross_env.destination_checksum_drift, cross_env.source_checksum_mismatch, cross_env.content_write_corruption, invalid_input, not_found, forbidden, and wp_error.",
4634
4654
  inputSchema: {
4635
4655
  source_payload: CrossEnvHeaderSourcePayloadSchema.optional().describe("The `data` object returned by diviops_cross_env_source_export_get on the source site. Use source_payload_ref instead for large real headers."),
4636
4656
  source_payload_ref: CrossEnvSourcePayloadRefSchema.optional().describe("Bounded server-local artifact reference returned as data.source_payload_ref by diviops_cross_env_source_export_get. Preferred for large real headers because it avoids inlining full markup through the model."),
@@ -4689,6 +4709,8 @@ function registerProTools() {
4689
4709
  const targetEnvelope = await wp.requestEnveloped("/cross-env/target-context", { method: "POST", body: targetBody });
4690
4710
  if (!targetEnvelope.ok)
4691
4711
  return targetEnvelope;
4712
+ const menuHints = targetMenuHints(resolvedSourcePayload);
4713
+ Object.assign(targetEnvelope.data, await targetMenus(wp, menuHints.names, menuHints.ids));
4692
4714
  const report = preflightCrossEnvHeaderSync({
4693
4715
  source: resolvedSourcePayload,
4694
4716
  target: targetEnvelope.data,
@@ -4798,6 +4820,8 @@ function registerProTools() {
4798
4820
  });
4799
4821
  if (!targetEnvelope.ok)
4800
4822
  return targetEnvelope;
4823
+ const menuHints = targetMenuHints(resolvedSourcePayload);
4824
+ Object.assign(targetEnvelope.data, await targetMenus(wp, menuHints.names, menuHints.ids));
4801
4825
  const report = preflightCrossEnvThemeBuilderLayoutSync({
4802
4826
  source: resolvedSourcePayload,
4803
4827
  target: targetEnvelope.data,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diviops/mcp-server",
3
- "version": "1.5.79",
3
+ "version": "1.5.81",
4
4
  "description": "MCP server for Divi 5 on WordPress. List pages, inspect presets and edit native Divi modules through the DiviOps Agent plugin.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",