@superdoc/mcp 1.7.1-next.5 → 1.7.1-next.6

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 +57 -3
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -31600,7 +31600,7 @@ var init_host = __esm(() => {
31600
31600
  });
31601
31601
 
31602
31602
  // ../../packages/sdk/langs/node/src/runtime/sdk-version.generated.ts
31603
- var SDK_VERSION = "2.20.1-next.5";
31603
+ var SDK_VERSION = "2.20.1-next.6";
31604
31604
 
31605
31605
  // ../../packages/sdk/langs/node/src/runtime/embedded-platform.ts
31606
31606
  import { accessSync, chmodSync, constants, existsSync, statSync } from "node:fs";
@@ -138920,6 +138920,9 @@ function validateRunContents(xml, options) {
138920
138920
  }
138921
138921
  if (runs === "")
138922
138922
  return { ok: true };
138923
+ if (/^[\t\n\r ]+$/.test(runs)) {
138924
+ return { ok: false, reason: "target runs contain only XML whitespace; clearing this representation is not supported" };
138925
+ }
138923
138926
  const replayXml = stripAllowedNoteReferences(runs, options);
138924
138927
  const withoutCarriers = replayXml !== null && options.baseRunXml ? stripRetainedCarrier(replayXml, options.baseRunXml, options.allowNamespaceDeclarationDifference === true) : replayXml;
138925
138928
  const withoutBookmarks = withoutCarriers !== null && /<(?:[\w.-]+:)?bookmark(?:Start|End)\b/.test(withoutCarriers) ? preservedBookmarkRunTokens(withoutCarriers)?.strippedXml ?? null : withoutCarriers;
@@ -389256,6 +389259,29 @@ function requiredPartBytes(context, partUri) {
389256
389259
  throw new SDCompareError("SOURCE_NOT_COMPLETE", `compare capture could not read required part ${partUri}.`);
389257
389260
  return bytes;
389258
389261
  }
389262
+ function assertInspectableTablePlacement(context) {
389263
+ const partUris = new Set(listSDDocumentSessionInternalStories(context.session).map((story) => story.partUri));
389264
+ for (const partUri of partUris) {
389265
+ const parents = [];
389266
+ let inlineContainer;
389267
+ walkXmlElements(new TextDecoder().decode(requiredPartBytes(context, partUri)), {
389268
+ onOpenTag({ tag }) {
389269
+ const parent = parents.at(-1);
389270
+ if (tag.namespaceUri === WORDPROCESSINGML_NAMESPACE8 && tag.localName === "tbl" && parent?.namespaceUri === WORDPROCESSINGML_NAMESPACE8 && (parent.localName === "p" || parent.localName === "r"))
389271
+ inlineContainer = parent.localName === "p" ? "paragraph" : "run";
389272
+ if (!tag.isSelfClosing)
389273
+ parents.push(tag);
389274
+ },
389275
+ onCloseTag({ tag }) {
389276
+ if (!tag.isSelfClosing)
389277
+ parents.pop();
389278
+ }
389279
+ });
389280
+ if (inlineContainer) {
389281
+ throw new SDCompareError("INVALID_INPUT", `compare capture found an uninspectable WordprocessingML table inside a ${inlineContainer} in ${partUri}. ` + "Tables must be block content; no comparison snapshot was produced.");
389282
+ }
389283
+ }
389284
+ }
389259
389285
  function contentTypeRegistrationForPart(context, partUri) {
389260
389286
  const registry2 = parseContentTypes(new TextDecoder().decode(requiredPartBytes(context, CONTENT_TYPES_URI)));
389261
389287
  if (registry2.parseError)
@@ -389542,6 +389568,7 @@ function captureCompareSnapshotSync(context, options = {}) {
389542
389568
  return projectCompareSnapshot(context, "source-complete", options);
389543
389569
  }
389544
389570
  function projectCompareSnapshot(context, posture, options) {
389571
+ assertInspectableTablePlacement(context);
389545
389572
  const body = projectBody(context);
389546
389573
  const slots = projectSlots(context);
389547
389574
  const { stories, noteParts } = projectStories(context, slots);
@@ -391539,6 +391566,13 @@ function buildCommentApplyPlan(base3, target) {
391539
391566
  }
391540
391567
  function buildExactCommentApplyPlan(base3, target, baseSource, targetSource) {
391541
391568
  const fallback = buildCommentApplyPlan(base3, target);
391569
+ if (fallback.steps.filter((step3) => step3.kind === "create").length > 1) {
391570
+ return {
391571
+ steps: [],
391572
+ partRewrites: [],
391573
+ unsafeReasons: ["multiple comment creations require revision-stable anchor replay"]
391574
+ };
391575
+ }
391542
391576
  const baseById = new Map(base3.map((record3) => [record3.commentId, record3]));
391543
391577
  const targetById = new Map(target.map((record3) => [record3.commentId, record3]));
391544
391578
  const topologyCompatible = base3.length === target.length && base3.every((record3) => {
@@ -395291,7 +395325,11 @@ class V2DiffAdapter {
395291
395325
  base: payload.base.definitions,
395292
395326
  target: payload.target.definitions
395293
395327
  }), canonicalBodyOperations);
395294
- const trackedTablePropertyPlan = tablesChanged && reviewMarkup ? buildTrackedTablePropertyReplayPlan(liveBaseMainDocument, payloadMainDocument.target) : null;
395328
+ const tablePropertyPlan = tablesChanged ? buildTrackedTablePropertyReplayPlan(liveBaseMainDocument, payloadMainDocument.target) : null;
395329
+ if (tablePropertyPlan && this.context.isCollaborativeSession()) {
395330
+ throw diffValidationError("CAPABILITY_UNSUPPORTED", "diff.apply: table property replay is unavailable in a joined collaboration session; use a standalone session for this input. No mutation was performed.", { changedFamilies: ["tables"], unsupportedReason: "collaborative-table-property-replay-unsupported" });
395331
+ }
395332
+ const trackedTablePropertyPlan = reviewMarkup ? tablePropertyPlan : null;
395295
395333
  let trackedTablePlan = tablesChanged && reviewMarkup && !trackedTablePropertyPlan ? buildTrackedTableRowReplayPlan({
395296
395334
  base: liveBaseMainDocument,
395297
395335
  target: payloadMainDocument.target,
@@ -395762,6 +395800,7 @@ function buildCompareApplyEligibility(context, payload, plans, styleChangeMode)
395762
395800
  }
395763
395801
  const tablesChanged = payload.familyPolicy.some((policy) => policy.family === "tables" && policy.applyRequired);
395764
395802
  let wholeMainDirectReplay = false;
395803
+ let tablePropertyReplayRequiresStandalone = false;
395765
395804
  if (tablesChanged) {
395766
395805
  const bodyDeferredToTableReplay = payload.familyPolicy.some((policy) => policy.family === "body" && policy.applyRequired && policy.disposition === "deferred");
395767
395806
  const mainDocument = payload.mainDocument ?? { base: EMPTY_MAIN_DOCUMENT_SOURCE, target: EMPTY_MAIN_DOCUMENT_SOURCE };
@@ -395793,7 +395832,13 @@ function buildCompareApplyEligibility(context, payload, plans, styleChangeMode)
395793
395832
  bodyOperations: trackedBodyOperations,
395794
395833
  allowTopologyReplacement: true
395795
395834
  }) : null;
395796
- if (trackedTablePlan.unsafeReasons.length === 0 && trackedTablePlan.steps.length > 0) {
395835
+ const trackedPropertyPlan = buildTrackedTablePropertyReplayPlan(mainDocument.base, mainDocument.target);
395836
+ tablePropertyReplayRequiresStandalone = trackedPropertyPlan !== null && context.isCollaborativeSession();
395837
+ if (trackedPropertyPlan) {
395838
+ tracked.add("tables");
395839
+ if (bodyDeferredToTableReplay)
395840
+ tracked.add("body");
395841
+ } else if (trackedTablePlan.unsafeReasons.length === 0 && trackedTablePlan.steps.length > 0) {
395797
395842
  tracked.add("tables");
395798
395843
  if (bodyDeferredToTableReplay)
395799
395844
  tracked.add("body");
@@ -395814,6 +395859,15 @@ function buildCompareApplyEligibility(context, payload, plans, styleChangeMode)
395814
395859
  if (metadataPartPlan.rewrites.length > 0)
395815
395860
  direct.add("package-graph");
395816
395861
  const hazards = { direct: [], tracked: [] };
395862
+ if (tablePropertyReplayRequiresStandalone) {
395863
+ const hazard = {
395864
+ code: "family-apply-lane-unavailable",
395865
+ message: "Table property replay is unavailable in a joined collaboration session; use a standalone session for this input.",
395866
+ families: ["tables"]
395867
+ };
395868
+ hazards.direct.push(hazard);
395869
+ hazards.tracked.push(hazard);
395870
+ }
395817
395871
  if (metadataPartPlan.unsafeReasons.length > 0) {
395818
395872
  hazards.direct.push({
395819
395873
  code: "family-apply-lane-unavailable",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc/mcp",
3
- "version": "1.7.1-next.5",
3
+ "version": "1.7.1-next.6",
4
4
  "description": "Model Context Protocol server for SuperDoc, giving an AI agent tools to read and edit .docx files.",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0",
@@ -24,13 +24,13 @@
24
24
  ],
25
25
  "dependencies": {
26
26
  "@modelcontextprotocol/sdk": "^1.26.0",
27
- "@superdoc/sdk": "2.20.1-next.5",
27
+ "@superdoc/sdk": "2.20.1-next.6",
28
28
  "debug": "^4.4.3",
29
29
  "zod": "^4.3.6"
30
30
  },
31
31
  "devDependencies": {
32
- "superdoc": "2.23.1-next.5",
33
- "@superdoc/docx-engine": "0.22.1-next.5",
32
+ "superdoc": "2.23.1-next.6",
33
+ "@superdoc/docx-engine": "0.22.1-next.6",
34
34
  "@superdoc/document-api": "0.1.0-alpha.0",
35
35
  "@types/bun": "^1.3.8",
36
36
  "@types/node": "22.19.2",