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

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 +42 -9
  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.6";
31603
+ var SDK_VERSION = "2.20.1-next.8";
31604
31604
 
31605
31605
  // ../../packages/sdk/langs/node/src/runtime/embedded-platform.ts
31606
31606
  import { accessSync, chmodSync, constants, existsSync, statSync } from "node:fs";
@@ -205794,6 +205794,7 @@ function parsePlainRun(runXml, textStart, byteStart, byteEnd, options = {}) {
205794
205794
  runClose
205795
205795
  });
205796
205796
  const childRe = /<([\w.-]+):([\w.-]+)\b([^>]*)>/g;
205797
+ const pairedNoBreakHyphenCloseRe = /\s*<\/([\w.-]+):noBreakHyphen>/y;
205797
205798
  childRe.lastIndex = runOpen.length;
205798
205799
  let tMatch = null;
205799
205800
  let controlKind = null;
@@ -205838,7 +205839,18 @@ function parsePlainRun(runXml, textStart, byteStart, byteEnd, options = {}) {
205838
205839
  childRe.lastIndex = closeMatch.index + closeMatch[0].length;
205839
205840
  continue;
205840
205841
  }
205841
- if (isSelfClose && (local === "tab" || local === "br" || local === "cr")) {
205842
+ let supportedControlXml = m[0];
205843
+ let isPairedNoBreakHyphen = false;
205844
+ if (local === "noBreakHyphen" && !isSelfClose) {
205845
+ pairedNoBreakHyphenCloseRe.lastIndex = childRe.lastIndex;
205846
+ const close = pairedNoBreakHyphenCloseRe.exec(without);
205847
+ if (!close || close[1] !== ns)
205848
+ return fail4("invalid-range");
205849
+ childRe.lastIndex = pairedNoBreakHyphenCloseRe.lastIndex;
205850
+ supportedControlXml += close[0];
205851
+ isPairedNoBreakHyphen = true;
205852
+ }
205853
+ if ((isSelfClose || isPairedNoBreakHyphen) && (local === "tab" || local === "br" || local === "cr" || local === "noBreakHyphen")) {
205842
205854
  if (!options.allowReplaceableInlineControls) {
205843
205855
  if (!tMatch && !controlKind) {
205844
205856
  const trailing = matchSingleTrailingTextRun(without, childRe.lastIndex, without.length - runClose.length);
@@ -205856,7 +205868,7 @@ function parsePlainRun(runXml, textStart, byteStart, byteEnd, options = {}) {
205856
205868
  text: text2,
205857
205869
  rPr,
205858
205870
  runOpen,
205859
- leadingControlXml: m[0],
205871
+ leadingControlXml: supportedControlXml,
205860
205872
  runClose,
205861
205873
  ...leadingTransparentXml ? { leadingTransparentXml } : {}
205862
205874
  }
@@ -205870,7 +205882,7 @@ function parsePlainRun(runXml, textStart, byteStart, byteEnd, options = {}) {
205870
205882
  if (tMatch || controlKind)
205871
205883
  return fail4("invalid-range");
205872
205884
  controlKind = local;
205873
- controlXml = m[0];
205885
+ controlXml = supportedControlXml;
205874
205886
  continue;
205875
205887
  }
205876
205888
  if (local === "drawing" || local === "pict" || local === "object") {
@@ -206017,7 +206029,7 @@ function rewriteRunSpanText(paragraphXml, startOffset, endOffset, newText) {
206017
206029
  if (collected.runs.length === 0) {
206018
206030
  return rewriteEmptyParagraphInsert(paragraphXml, newText, startOffset, endOffset);
206019
206031
  }
206020
- const boundaryInsert = rewriteCollapsedBoundaryAfterAnchorGapInsert(paragraphXml, collected.runs, startOffset, endOffset, (carrier) => newText.length > 0 ? renderTextRun(newText, carrier.runOpen, carrier.runClose, carrier.rPr) : "");
206032
+ const boundaryInsert = rewriteCollapsedRunBoundaryInsert(paragraphXml, collected.runs, startOffset, endOffset, (carrier) => newText.length > 0 ? renderTextRun(newText, carrier.runOpen, carrier.runClose, carrier.rPr) : "");
206021
206033
  if (boundaryInsert)
206022
206034
  return { ok: true, xml: boundaryInsert };
206023
206035
  const tailInsert = rewriteCollapsedParagraphTailInsert(paragraphXml, collected.runs, startOffset, endOffset, (carrier) => newText.length > 0 ? renderTextRun(newText, carrier.runOpen, carrier.runClose, carrier.rPr) : "");
@@ -206157,7 +206169,7 @@ function rewriteRunSpanTrackedReplace(paragraphXml, startOffset, endOffset, stam
206157
206169
  if (!paragraphMarkFallback.ok)
206158
206170
  return paragraphMarkFallback;
206159
206171
  const carrierRPr = (carrier) => carrier.rPr || paragraphMarkFallback.rPr;
206160
- const boundaryInsert = rewriteCollapsedBoundaryAfterAnchorGapInsert(paragraphXml, collected.runs, startOffset, endOffset, (carrier) => stamp.newText.length > 0 ? buildInsWrapper(stamp.newText, carrier.runOpen, carrier.runClose, carrierRPr(carrier), {
206172
+ const boundaryInsert = rewriteCollapsedRunBoundaryInsert(paragraphXml, collected.runs, startOffset, endOffset, (carrier) => stamp.newText.length > 0 ? buildInsWrapper(stamp.newText, carrier.runOpen, carrier.runClose, carrierRPr(carrier), {
206161
206173
  rsid: stamp.insRsid,
206162
206174
  wId: stamp.wId,
206163
206175
  author: stamp.author,
@@ -206325,7 +206337,7 @@ function rewriteRunSpanTrackedReplacePreservingMarkers(paragraphXml, span, stamp
206325
206337
  function visibleTextLength(xml) {
206326
206338
  let len = 0;
206327
206339
  const visibleXml = stripElements(stripElements(xml, "del"), "moveFrom");
206328
- for (const match of visibleXml.matchAll(/<[\w.-]+:t\b[^>]*>([\s\S]*?)<\/[\w.-]+:t>|<[\w.-]+:(tab|br|cr|footnoteReference|endnoteReference)\b[^>]*\/>/g)) {
206340
+ for (const match of visibleXml.matchAll(/<[\w.-]+:t\b[^>]*>([\s\S]*?)<\/[\w.-]+:t>|<[\w.-]+:(tab|br|cr|noBreakHyphen|footnoteReference|endnoteReference)\b[^>]*\/>|<[\w.-]+:noBreakHyphen\b[^>]*>\s*<\/[\w.-]+:noBreakHyphen>/g)) {
206329
206341
  if (match[1] != null) {
206330
206342
  len += decodeXmlText6(match[1]).length;
206331
206343
  continue;
@@ -206658,9 +206670,23 @@ function preserveTextElementAttributes(attributes, text) {
206658
206670
  }
206659
206671
  return `${attributes} xml:space="preserve"`;
206660
206672
  }
206661
- function rewriteCollapsedBoundaryAfterAnchorGapInsert(paragraphXml, runs, startOffset, endOffset, buildContent) {
206673
+ function rewriteCollapsedRunBoundaryInsert(paragraphXml, runs, startOffset, endOffset, buildContent) {
206662
206674
  if (startOffset !== endOffset || runs.length === 0)
206663
206675
  return null;
206676
+ const first = runs[0];
206677
+ if (startOffset === 0) {
206678
+ let beforeControl = first.leadingControlXml != null && first.textStart === 1;
206679
+ if (first.kind === "control" && first.textStart === 0) {
206680
+ const parsed = parsePlainRun(first.xml, 0, first.byteStart, first.byteEnd, {
206681
+ allowReplaceableInlineControls: true
206682
+ });
206683
+ beforeControl = parsed.ok && parsed.run.controlKind != null;
206684
+ }
206685
+ if (beforeControl) {
206686
+ const content = buildContent(first);
206687
+ return `${paragraphXml.slice(0, first.byteStart)}${content}${paragraphXml.slice(first.byteStart)}`;
206688
+ }
206689
+ }
206664
206690
  const closeTagMatch = paragraphXml.match(/<\/[\w.-]+:p>\s*$/);
206665
206691
  if (!closeTagMatch || closeTagMatch.index == null)
206666
206692
  return null;
@@ -214997,6 +215023,12 @@ function runTrackedChangeDecideCommitWithLookupContext(lookupContext, input, xml
214997
215023
  const existingPatch = firstReplacePatch(perPart[partUri]);
214998
215024
  const workingBytes = existingPatch && existingPatch.kind === "replaceBytes" ? existingPatch.bytes : baseBytes;
214999
215025
  let workingXml = TD52.decode(workingBytes);
215026
+ let commentFreeMarkerIndex;
215027
+ const currentCommentMarkerIndex = () => {
215028
+ if (/commentRangeStart|commentRangeEnd|commentReference/.test(workingXml))
215029
+ return;
215030
+ return commentFreeMarkerIndex ?? (commentFreeMarkerIndex = buildCommentMarkerIndex(workingXml));
215031
+ };
215000
215032
  const sortedGroups = [...groups].sort((left, right) => {
215001
215033
  const leftOwnership = left.fragments.some((fragment3) => fragment3.nativeSdtOwnership);
215002
215034
  const rightOwnership = right.fragments.some((fragment3) => fragment3.nativeSdtOwnership);
@@ -215091,7 +215123,8 @@ function runTrackedChangeDecideCommitWithLookupContext(lookupContext, input, xml
215091
215123
  structuralHyperlinkRemovalParts.add(partUri);
215092
215124
  }
215093
215125
  const classification = classifyDroppedCommentMarkers(workingXml, result.deletedRange, {
215094
- preserveAdjacentEndBoundaryWIds
215126
+ preserveAdjacentEndBoundaryWIds,
215127
+ markerIndex: currentCommentMarkerIndex()
215095
215128
  });
215096
215129
  for (const wId of classification.delete) {
215097
215130
  cascadeCommentWIds.add(wId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc/mcp",
3
- "version": "1.7.1-next.6",
3
+ "version": "1.7.1-next.8",
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.6",
27
+ "@superdoc/sdk": "2.20.1-next.8",
28
28
  "debug": "^4.4.3",
29
29
  "zod": "^4.3.6"
30
30
  },
31
31
  "devDependencies": {
32
- "superdoc": "2.23.1-next.6",
33
- "@superdoc/docx-engine": "0.22.1-next.6",
32
+ "superdoc": "2.23.1-next.8",
33
+ "@superdoc/docx-engine": "0.22.1-next.7",
34
34
  "@superdoc/document-api": "0.1.0-alpha.0",
35
35
  "@types/bun": "^1.3.8",
36
36
  "@types/node": "22.19.2",