@superdoc/mcp 1.4.1-next.4 → 1.4.1-next.5
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 +109 -36
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -31330,7 +31330,7 @@ var init_host = __esm(() => {
|
|
|
31330
31330
|
});
|
|
31331
31331
|
|
|
31332
31332
|
// ../../packages/sdk/langs/node/src/runtime/sdk-version.generated.ts
|
|
31333
|
-
var SDK_VERSION = "2.17.1-next.
|
|
31333
|
+
var SDK_VERSION = "2.17.1-next.5";
|
|
31334
31334
|
|
|
31335
31335
|
// ../../packages/sdk/langs/node/src/runtime/embedded-platform.ts
|
|
31336
31336
|
import { accessSync, chmodSync, constants, existsSync, statSync } from "node:fs";
|
|
@@ -193328,7 +193328,7 @@ function tryPreserveCollapsedInsertionAtComplexDeletionBoundary(input, allTokens
|
|
|
193328
193328
|
return compileOverlapWithInsertion(input, allTokens, insertion, touched.filter(({ token }) => token.kind !== "del"));
|
|
193329
193329
|
}
|
|
193330
193330
|
function tryPreserveCollapsedInsertionAtSimpleDeletionBoundary(input, allTokens, wrappers) {
|
|
193331
|
-
if (input.changeMode !== "tracked" || input.newText.length === 0 || input.rangeStart !== input.rangeEnd
|
|
193331
|
+
if (input.changeMode !== "tracked" || input.newText.length === 0 || input.rangeStart !== input.rangeEnd) {
|
|
193332
193332
|
return null;
|
|
193333
193333
|
}
|
|
193334
193334
|
const insertions = wrappers.filter((token) => token.kind === "ins");
|
|
@@ -193338,6 +193338,10 @@ function tryPreserveCollapsedInsertionAtSimpleDeletionBoundary(input, allTokens,
|
|
|
193338
193338
|
const insertion = insertions[0];
|
|
193339
193339
|
const deletion = deletions[0];
|
|
193340
193340
|
const classification = insertion._classification;
|
|
193341
|
+
if (input.coordinateSpace === "tracked") {
|
|
193342
|
+
const isTrackedInsertionDeletionBoundary = classification !== "same-user" && deletion.payloadIsExactSingleTextRun === true && insertion.visibleEnd === input.rangeStart && deletion.visibleStart === input.rangeStart && insertion.byteEnd === deletion.byteStart;
|
|
193343
|
+
return isTrackedInsertionDeletionBoundary ? insertAtForeignDeletion(input, allTokens, deletion, false, "before") : null;
|
|
193344
|
+
}
|
|
193341
193345
|
const sameAuthor3 = !!deletion.author.name && deletion.author.name === insertion.author.name && (!deletion.author.initials || !insertion.author.initials || deletion.author.initials === insertion.author.initials);
|
|
193342
193346
|
const isEngineReplacementBoundary = deletion.payloadIsExactSingleTextRun === true && deletion.byteEnd === insertion.byteStart && deletion.visibleStart === input.rangeStart && insertion.visibleStart === input.rangeStart && sameAuthor3;
|
|
193343
193347
|
if (classification === "same-user" || !isEngineReplacementBoundary) {
|
|
@@ -193399,7 +193403,7 @@ function tryPureDeleteAcrossTokens(input, allTokens, touched, touchedBreaks = []
|
|
|
193399
193403
|
if (input.newText.length !== 0 || input.rangeStart >= input.rangeEnd)
|
|
193400
193404
|
return null;
|
|
193401
193405
|
const touchedInsertions = touched.filter((entry) => entry.token.kind === "ins");
|
|
193402
|
-
if (touchedInsertions.some(({ token }) => token.innerRuns && token.innerRuns.length >
|
|
193406
|
+
if (touchedInsertions.some(({ token }) => token.innerRuns && token.innerRuns.length > 0 || token.nestedDeletions && token.nestedDeletions.length > 0)) {
|
|
193403
193407
|
return null;
|
|
193404
193408
|
}
|
|
193405
193409
|
return input.changeMode === "tracked" ? authorTrackedPureDelete(input, allTokens, touched, touchedBreaks) : authorDirectPureDelete(input, allTokens, touched, touchedBreaks);
|
|
@@ -193419,7 +193423,7 @@ function tryRangeReplacementAcrossTokens(input, allTokens, touched) {
|
|
|
193419
193423
|
if (!firstSelected)
|
|
193420
193424
|
return null;
|
|
193421
193425
|
const touchedInsertions = touched.filter((entry) => entry.token.kind === "ins");
|
|
193422
|
-
if (touchedInsertions.some(({ token }) => token.innerRuns && token.innerRuns.length >
|
|
193426
|
+
if (touchedInsertions.some(({ token }) => token.innerRuns && token.innerRuns.length > 0 && (token !== firstSelected.token || token.commentedBoundary != null) || token.nestedDeletions && token.nestedDeletions.length > 0)) {
|
|
193423
193427
|
return null;
|
|
193424
193428
|
}
|
|
193425
193429
|
const result = input.changeMode === "tracked" ? authorTrackedPureDelete(input, allTokens, touched) : authorDirectPureDelete(input, allTokens, touched);
|
|
@@ -193783,7 +193787,7 @@ function authorDirectPureDelete(input, allTokens, touched, touchedBreaks = []) {
|
|
|
193783
193787
|
return result;
|
|
193784
193788
|
}
|
|
193785
193789
|
function insertPlainTextInsideTrackedWrapper(input, allTokens, parent, touched) {
|
|
193786
|
-
if (parent.kind === "ins" && parent.innerRuns && parent.innerRuns.length >
|
|
193790
|
+
if (parent.kind === "ins" && parent.innerRuns && parent.innerRuns.length > 0) {
|
|
193787
193791
|
return {
|
|
193788
193792
|
ok: false,
|
|
193789
193793
|
reason: "text-range-in-unsupported-tracked-wrapper",
|
|
@@ -193991,7 +193995,7 @@ function foldInsideOwnInsertion(input, allTokens, parent) {
|
|
|
193991
193995
|
const result = markTextInsertionRefined(rebuildParagraph(allTokens, parent, ""), input, parent, true);
|
|
193992
193996
|
return result.ok && input.changeMode === "direct" ? { ...result, requiresCollaborationSessionSync: true } : result;
|
|
193993
193997
|
}
|
|
193994
|
-
const innerXml = parent.innerRuns && parent.innerRuns.length >
|
|
193998
|
+
const innerXml = parent.innerRuns && parent.innerRuns.length > 0 ? buildInsInnerXmlFromRuns(spliceInnerRuns(parent.innerRuns, localStart, localEnd, input.newText, parent, localStart)) : null;
|
|
193995
193999
|
const newInsXml = buildInsWrapperXml({
|
|
193996
194000
|
openTag: parent.openTag,
|
|
193997
194001
|
namespaceBindings: parent.namespaceBindings,
|
|
@@ -194029,7 +194033,13 @@ function flattenWrappedRuns(runs) {
|
|
|
194029
194033
|
const out = [];
|
|
194030
194034
|
for (const run of runs) {
|
|
194031
194035
|
for (let index = 0;index < run.text.length; index += 1) {
|
|
194032
|
-
out.push({
|
|
194036
|
+
out.push({
|
|
194037
|
+
ch: run.text.charAt(index),
|
|
194038
|
+
rPr: run.rPr,
|
|
194039
|
+
runOpen: run.runOpen,
|
|
194040
|
+
runClose: run.runClose,
|
|
194041
|
+
...run.controlXml ? { controlXml: run.controlXml } : {}
|
|
194042
|
+
});
|
|
194033
194043
|
}
|
|
194034
194044
|
}
|
|
194035
194045
|
return out;
|
|
@@ -194041,20 +194051,22 @@ function coalesceWrappedRuns(chars) {
|
|
|
194041
194051
|
let runOpen = chars[0].runOpen;
|
|
194042
194052
|
let runClose = chars[0].runClose;
|
|
194043
194053
|
let rPr = chars[0].rPr;
|
|
194054
|
+
let controlXml = chars[0].controlXml;
|
|
194044
194055
|
let text = chars[0].ch;
|
|
194045
194056
|
for (let i2 = 1;i2 < chars.length; i2 += 1) {
|
|
194046
194057
|
const ch = chars[i2];
|
|
194047
|
-
if (ch.rPr === rPr && ch.runOpen === runOpen && ch.runClose === runClose) {
|
|
194058
|
+
if (!controlXml && !ch.controlXml && ch.rPr === rPr && ch.runOpen === runOpen && ch.runClose === runClose) {
|
|
194048
194059
|
text += ch.ch;
|
|
194049
194060
|
continue;
|
|
194050
194061
|
}
|
|
194051
|
-
out.push({ runOpen, runClose, rPr, text });
|
|
194062
|
+
out.push({ runOpen, runClose, rPr, text, ...controlXml ? { controlXml } : {} });
|
|
194052
194063
|
runOpen = ch.runOpen;
|
|
194053
194064
|
runClose = ch.runClose;
|
|
194054
194065
|
rPr = ch.rPr;
|
|
194066
|
+
controlXml = ch.controlXml;
|
|
194055
194067
|
text = ch.ch;
|
|
194056
194068
|
}
|
|
194057
|
-
out.push({ runOpen, runClose, rPr, text });
|
|
194069
|
+
out.push({ runOpen, runClose, rPr, text, ...controlXml ? { controlXml } : {} });
|
|
194058
194070
|
return out;
|
|
194059
194071
|
}
|
|
194060
194072
|
function runMetaAtInsertionPoint(parent, localOffset, preferNextRunAtBoundary = false) {
|
|
@@ -194090,7 +194102,7 @@ function spliceInnerRuns(runs, localStart, localEnd, newText, parent, insertOffs
|
|
|
194090
194102
|
return coalesceWrappedRuns([...flat.slice(0, localStart), ...inserted, ...flat.slice(localEnd)]);
|
|
194091
194103
|
}
|
|
194092
194104
|
function buildInsInnerXmlFromRuns(runs) {
|
|
194093
|
-
return runs.map((run) => renderPlainRun(run.text, run.runOpen, run.runClose, run.rPr)).join("");
|
|
194105
|
+
return runs.map((run) => run.controlXml ? `${run.runOpen}${run.rPr}${run.controlXml}${run.runClose}` : renderPlainRun(run.text, run.runOpen, run.runClose, run.rPr)).join("");
|
|
194094
194106
|
}
|
|
194095
194107
|
function buildInsInnerXmlInterleaved(flat, nested, textSliceStart, textSliceEnd) {
|
|
194096
194108
|
if (nested.length === 0) {
|
|
@@ -194120,7 +194132,7 @@ function rPrAtInsertionPoint(parent, localOffset, preferNextRunAtBoundary = fals
|
|
|
194120
194132
|
return runs[runs.length - 1].rPr;
|
|
194121
194133
|
}
|
|
194122
194134
|
function spanningSameUserInsertion(input, allTokens, parent, touched) {
|
|
194123
|
-
if (parent.innerRuns && parent.innerRuns.length >
|
|
194135
|
+
if (parent.innerRuns && parent.innerRuns.length > 0) {
|
|
194124
194136
|
return {
|
|
194125
194137
|
ok: false,
|
|
194126
194138
|
reason: "text-range-in-unsupported-tracked-wrapper",
|
|
@@ -194812,7 +194824,7 @@ function buildDelWrapperXml(params) {
|
|
|
194812
194824
|
return `${openTag}${inner}${closeTag}`;
|
|
194813
194825
|
}
|
|
194814
194826
|
function buildDelInnerXmlFromRuns(runs) {
|
|
194815
|
-
return runs.map((run) => renderDelRun(run.text, run.runOpen, run.runClose, run.rPr)).join("");
|
|
194827
|
+
return runs.map((run) => run.controlXml ? `${run.runOpen}${run.rPr}${run.controlXml}${run.runClose}` : renderDelRun(run.text, run.runOpen, run.runClose, run.rPr)).join("");
|
|
194816
194828
|
}
|
|
194817
194829
|
function trackedWrapperCloseTag(openTag, fallbackPrefix, localName2) {
|
|
194818
194830
|
const sourceQName = /^<([^\s/>]+)/.exec(openTag)?.[1];
|
|
@@ -195113,6 +195125,22 @@ function readCommentedInsertionBoundary(piece) {
|
|
|
195113
195125
|
referenceRunXml
|
|
195114
195126
|
};
|
|
195115
195127
|
}
|
|
195128
|
+
function isManualBreak(piece, inherited) {
|
|
195129
|
+
if (piece.control === "cr")
|
|
195130
|
+
return true;
|
|
195131
|
+
if (piece.control !== "br")
|
|
195132
|
+
return false;
|
|
195133
|
+
const bindings = new Map(inherited);
|
|
195134
|
+
for (const tag of [piece.runOpenTag, piece.rawXml]) {
|
|
195135
|
+
for (const attribute of scanRawXmlAttributes(tag)) {
|
|
195136
|
+
if (attribute.name === "xmlns" || attribute.prefix === "xmlns") {
|
|
195137
|
+
bindings.set(attribute.name === "xmlns" ? "" : attribute.localName, decodeXmlText(attribute.value));
|
|
195138
|
+
}
|
|
195139
|
+
}
|
|
195140
|
+
}
|
|
195141
|
+
const type = decodeNamespacedAttr(piece.rawXml, bindings, "type");
|
|
195142
|
+
return type == null || type === "textWrapping";
|
|
195143
|
+
}
|
|
195116
195144
|
function trackedToken(piece, spanStart, spanEnd, allowComplexDeletions, allowStructuralDeletionPassThrough) {
|
|
195117
195145
|
const visibleStart = spanStart(piece);
|
|
195118
195146
|
const visibleEnd = spanEnd(piece);
|
|
@@ -195176,8 +195204,8 @@ function trackedToken(piece, spanStart, spanEnd, allowComplexDeletions, allowStr
|
|
|
195176
195204
|
}
|
|
195177
195205
|
const firstText = textLeaves2[0];
|
|
195178
195206
|
const nsPrefix2 = piece.prefix ?? "w";
|
|
195179
|
-
const
|
|
195180
|
-
const innerRuns2 =
|
|
195207
|
+
const runStarts = [...new Set(textLeaves2.map((leaf) => leaf.runCharStart))].sort((a, b) => a - b);
|
|
195208
|
+
const innerRuns2 = runStarts.map((runStart) => {
|
|
195181
195209
|
const leaves = textLeaves2.filter((leaf) => leaf.runCharStart === runStart);
|
|
195182
195210
|
const first = leaves[0];
|
|
195183
195211
|
return {
|
|
@@ -195226,7 +195254,7 @@ function trackedToken(piece, spanStart, spanEnd, allowComplexDeletions, allowStr
|
|
|
195226
195254
|
}
|
|
195227
195255
|
};
|
|
195228
195256
|
}
|
|
195229
|
-
const foreignChild = piece.children.find((child) => child.kind === "container" || child.kind === "unknown" || child.kind === "noteReference" || child.kind === "control" && !(piece.trackedKind === "ins" && child.control === "tab") || child.kind === "marker" && !commentedBoundary);
|
|
195257
|
+
const foreignChild = piece.children.find((child) => child.kind === "container" || child.kind === "unknown" || child.kind === "noteReference" || child.kind === "control" && !(piece.trackedKind === "ins" && (child.control === "tab" || isManualBreak(child, piece.namespaceBindings))) || child.kind === "marker" && !commentedBoundary);
|
|
195230
195258
|
if (foreignChild) {
|
|
195231
195259
|
if (foreignChild.kind === "container") {
|
|
195232
195260
|
return unsupported2(containerRejectionReason(foreignChild.containerKind), `overlap compiler: ${foreignChild.containerKind} inside w:${piece.trackedKind}`);
|
|
@@ -195239,21 +195267,36 @@ function trackedToken(piece, spanStart, spanEnd, allowComplexDeletions, allowStr
|
|
|
195239
195267
|
}
|
|
195240
195268
|
return unsupported2("text-range-in-unsupported-tracked-wrapper", `overlap compiler: unsupported payload inside w:${piece.trackedKind}`);
|
|
195241
195269
|
}
|
|
195242
|
-
const
|
|
195270
|
+
const hasManualBreak = piece.trackedKind === "ins" && piece.children.some((child) => child.kind === "control" && isManualBreak(child, piece.namespaceBindings));
|
|
195271
|
+
if (hasManualBreak && piece.children.some((child) => child.kind === "text" && child.textRole !== "visible")) {
|
|
195272
|
+
return unsupported2("text-range-in-unsupported-tracked-wrapper", "overlap compiler: non-visible text beside a manual break");
|
|
195273
|
+
}
|
|
195274
|
+
if (hasManualBreak && !piece.children.some((child) => child.kind === "text" && child.textRole === "visible" && child.decodedText.length > 0)) {
|
|
195275
|
+
return unsupported2("text-payload-unsupported-control-char", "overlap compiler: control-only insertion");
|
|
195276
|
+
}
|
|
195277
|
+
const textLeaves = piece.children.filter((child) => child.kind === "text" || piece.trackedKind === "ins" && child.kind === "control" && (child.control === "tab" || isManualBreak(child, piece.namespaceBindings)));
|
|
195243
195278
|
if (textLeaves.length === 0 && !(nestedDeletions && nestedDeletions.length > 0)) {
|
|
195244
195279
|
return unsupported2("text-range-in-unsupported-tracked-wrapper", `overlap compiler: empty w:${piece.trackedKind}`);
|
|
195245
195280
|
}
|
|
195246
|
-
const
|
|
195247
|
-
const
|
|
195248
|
-
const
|
|
195249
|
-
const
|
|
195250
|
-
|
|
195251
|
-
|
|
195252
|
-
|
|
195253
|
-
|
|
195254
|
-
text
|
|
195255
|
-
}
|
|
195256
|
-
|
|
195281
|
+
const innerRuns = [];
|
|
195282
|
+
for (const [index, leaf] of textLeaves.entries()) {
|
|
195283
|
+
const manualBreak = leaf.kind === "control" && isManualBreak(leaf, piece.namespaceBindings);
|
|
195284
|
+
const text = leaf.kind === "control" ? manualBreak ? `
|
|
195285
|
+
` : "\t" : leaf.decodedText;
|
|
195286
|
+
const previous = innerRuns[innerRuns.length - 1];
|
|
195287
|
+
const previousLeaf = textLeaves[index - 1];
|
|
195288
|
+
if (!manualBreak && previous && !previous.controlXml && previousLeaf?.runCharStart === leaf.runCharStart) {
|
|
195289
|
+
previous.text += text;
|
|
195290
|
+
} else {
|
|
195291
|
+
innerRuns.push({
|
|
195292
|
+
runOpen: leaf.runOpenTag,
|
|
195293
|
+
runClose: leaf.runCloseTag,
|
|
195294
|
+
rPr: leaf.runProperties ?? "",
|
|
195295
|
+
text,
|
|
195296
|
+
...manualBreak ? { controlXml: leaf.rawXml } : {}
|
|
195297
|
+
});
|
|
195298
|
+
}
|
|
195299
|
+
}
|
|
195257
195300
|
if (piece.trackedKind !== "ins" && innerRuns.length > 1) {
|
|
195258
195301
|
return unsupported2("text-range-in-unsupported-tracked-wrapper", `overlap compiler: multi-run w:${piece.trackedKind} not supported`);
|
|
195259
195302
|
}
|
|
@@ -195289,7 +195332,7 @@ function trackedToken(piece, spanStart, spanEnd, allowComplexDeletions, allowStr
|
|
|
195289
195332
|
rPr: inner.rPr,
|
|
195290
195333
|
text: inner.text
|
|
195291
195334
|
},
|
|
195292
|
-
...innerRuns.length > 1 ? { innerRuns } : {}
|
|
195335
|
+
...innerRuns.length > 1 || innerRuns.some((run) => run.controlXml) ? { innerRuns } : {}
|
|
195293
195336
|
};
|
|
195294
195337
|
return piece.trackedKind === "ins" ? {
|
|
195295
195338
|
kind: "ins",
|
|
@@ -197716,8 +197759,7 @@ function resolvePlannedDirectInsertRunProperties(beforeParagraphXml, afterParagr
|
|
|
197716
197759
|
const properties = collectXmlElementRanges(afterXml, { fragment: true, additionalNamespaces: { ...namespaceBindings } }).ranges.find((range) => range.tag.namespaceUri === NS_W && range.tag.localName === "rPr" && range.start >= carrier.runCharStart && range.end <= carrier.runCharEnd);
|
|
197717
197760
|
return properties ? closeNamespaceScope(afterXml.slice(properties.start, properties.end), properties.namespaceBindings, { w: NS_W }, { referencedOnly: true }) : null;
|
|
197718
197761
|
}
|
|
197719
|
-
function projectTrackedParagraphOffsetToVisible(paragraphXml, trackedOffset) {
|
|
197720
|
-
const model = parseParagraphInlineMap(paragraphXml);
|
|
197762
|
+
function projectTrackedParagraphOffsetToVisible(paragraphXml, trackedOffset, model = parseParagraphInlineMap(paragraphXml)) {
|
|
197721
197763
|
if (!Number.isInteger(trackedOffset) || trackedOffset < 0 || trackedOffset > model.trackedLength)
|
|
197722
197764
|
return null;
|
|
197723
197765
|
if (trackedOffset === model.trackedLength)
|
|
@@ -198741,12 +198783,12 @@ function tryOverlapRewriteDirect(input, bytes, window2, byteBase, inheritedNames
|
|
|
198741
198783
|
}
|
|
198742
198784
|
function tryOverlapRewriteTracked(input, bytes, window2, byteBase, stamp, inlineContext, inheritedNamespaceBindings) {
|
|
198743
198785
|
const op = input.op;
|
|
198744
|
-
|
|
198786
|
+
let paragraphXml = inlineContext?.paragraphXml ?? TD40.decode(bytes.subarray(window2.byteStart, window2.byteEnd));
|
|
198745
198787
|
const namespaceBindings = inheritedNamespaceBindings ?? textTargetNamespaceBindings(input, window2, byteBase);
|
|
198746
|
-
const
|
|
198788
|
+
const compile = (usePreparedModel) => compileOverlapEdit({
|
|
198747
198789
|
storyId: op.on.storyId,
|
|
198748
198790
|
paragraphXml,
|
|
198749
|
-
...inlineContext ? { paragraphInlineMap: inlineContext.model } : {},
|
|
198791
|
+
...usePreparedModel && inlineContext ? { paragraphInlineMap: inlineContext.model } : {},
|
|
198750
198792
|
namespaceBindings,
|
|
198751
198793
|
rangeStart: op.on.startOffset,
|
|
198752
198794
|
rangeEnd: op.on.endOffset,
|
|
@@ -198763,6 +198805,16 @@ function tryOverlapRewriteTracked(input, bytes, window2, byteBase, stamp, inline
|
|
|
198763
198805
|
reserveWId: () => reserveRevisionWIdBlock(input.state, 1),
|
|
198764
198806
|
revisionOccurrenceAt: createRevisionOccurrenceResolver(input, bytes, window2, byteBase, paragraphXml)
|
|
198765
198807
|
});
|
|
198808
|
+
let compiled = compile(true);
|
|
198809
|
+
if (!compiled.ok && compiled.reason === "text-payload-unsupported-control-char" && op.on.startOffset === op.on.endOffset && op.newText.length > 0) {
|
|
198810
|
+
const model = inlineContext?.model ?? parseParagraphInlineMap(paragraphXml, namespaceBindings);
|
|
198811
|
+
const visibleOffset = op.on.coordinateSpace === "tracked" ? projectTrackedParagraphOffsetToVisible(paragraphXml, op.on.startOffset, model) : op.on.startOffset;
|
|
198812
|
+
const normalized = visibleOffset == null ? null : splitCompoundRunsForTrackedReplace(paragraphXml, visibleOffset, visibleOffset, true, false, namespaceBindings);
|
|
198813
|
+
if (normalized) {
|
|
198814
|
+
paragraphXml = normalized;
|
|
198815
|
+
compiled = compile(false);
|
|
198816
|
+
}
|
|
198817
|
+
}
|
|
198766
198818
|
if (!compiled.ok)
|
|
198767
198819
|
return { ok: false, reason: compiled.reason };
|
|
198768
198820
|
return {
|
|
@@ -200774,10 +200826,10 @@ function rewriteRunSpanText(paragraphXml, startOffset, endOffset, newText) {
|
|
|
200774
200826
|
function rewriteSDDirectParagraphText(input) {
|
|
200775
200827
|
return rewriteRunSpanText(input.paragraphXml, input.startOffset, input.endOffset, input.newText);
|
|
200776
200828
|
}
|
|
200777
|
-
function splitCompoundRunsForTrackedReplace(paragraphXml, startOffset, endOffset, allowCollapsedInsert = false, allowControlBoundary = false) {
|
|
200829
|
+
function splitCompoundRunsForTrackedReplace(paragraphXml, startOffset, endOffset, allowCollapsedInsert = false, allowControlBoundary = false, namespaceBindings) {
|
|
200778
200830
|
if (startOffset > endOffset || startOffset === endOffset && !allowCollapsedInsert)
|
|
200779
200831
|
return null;
|
|
200780
|
-
const model = parseParagraphInlineMap(paragraphXml);
|
|
200832
|
+
const model = parseParagraphInlineMap(paragraphXml, namespaceBindings);
|
|
200781
200833
|
const leaves = model.leaves();
|
|
200782
200834
|
const runs = new Map;
|
|
200783
200835
|
for (const piece of model.pieces) {
|
|
@@ -387898,6 +387950,27 @@ function insertNoteReferenceIntoParagraph(paragraphXml, offset, referenceRunXml)
|
|
|
387898
387950
|
}
|
|
387899
387951
|
continue;
|
|
387900
387952
|
}
|
|
387953
|
+
if (child.localName === "ins" || child.localName === "del") {
|
|
387954
|
+
const visibleLength = extractVisibleTextFromXml(`${paragraph4.open}${child.xml}${paragraph4.close}`).length;
|
|
387955
|
+
if (!inserted && offset > visible && offset < visible + visibleLength) {
|
|
387956
|
+
return {
|
|
387957
|
+
ok: false,
|
|
387958
|
+
code: "CAPABILITY_UNAVAILABLE",
|
|
387959
|
+
message: "footnotes.insert cannot insert inside an existing tracked revision."
|
|
387960
|
+
};
|
|
387961
|
+
}
|
|
387962
|
+
if (!inserted && offset === visible) {
|
|
387963
|
+
out.push(referenceRunXml);
|
|
387964
|
+
inserted = true;
|
|
387965
|
+
}
|
|
387966
|
+
out.push(child.xml);
|
|
387967
|
+
visible += visibleLength;
|
|
387968
|
+
if (!inserted && offset === visible) {
|
|
387969
|
+
out.push(referenceRunXml);
|
|
387970
|
+
inserted = true;
|
|
387971
|
+
}
|
|
387972
|
+
continue;
|
|
387973
|
+
}
|
|
387901
387974
|
if (child.localName !== "r") {
|
|
387902
387975
|
if (isZeroWidthParagraphMarker(child.localName)) {
|
|
387903
387976
|
out.push(child.xml);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc/mcp",
|
|
3
|
-
"version": "1.4.1-next.
|
|
3
|
+
"version": "1.4.1-next.5",
|
|
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.17.1-next.
|
|
27
|
+
"@superdoc/sdk": "2.17.1-next.5",
|
|
28
28
|
"debug": "^4.4.3",
|
|
29
29
|
"zod": "^4.3.6"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"superdoc": "2.20.1-next.
|
|
33
|
-
"@superdoc/docx-engine": "0.19.1-next.
|
|
32
|
+
"superdoc": "2.20.1-next.5",
|
|
33
|
+
"@superdoc/docx-engine": "0.19.1-next.4",
|
|
34
34
|
"@superdoc/document-api": "0.1.0-alpha.0",
|
|
35
35
|
"@types/bun": "^1.3.8",
|
|
36
36
|
"@types/node": "22.19.2",
|