@superdoc/mcp 1.2.1-next.2 → 1.2.1-next.3
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 +31 -11
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -31314,7 +31314,7 @@ var init_host = __esm(() => {
|
|
|
31314
31314
|
});
|
|
31315
31315
|
|
|
31316
31316
|
// ../../packages/sdk/langs/node/src/runtime/sdk-version.generated.ts
|
|
31317
|
-
var SDK_VERSION = "2.15.1-next.
|
|
31317
|
+
var SDK_VERSION = "2.15.1-next.3";
|
|
31318
31318
|
|
|
31319
31319
|
// ../../packages/sdk/langs/node/src/runtime/embedded-platform.ts
|
|
31320
31320
|
import { chmodSync, existsSync } from "node:fs";
|
|
@@ -162777,7 +162777,7 @@ var init_collapsed_inline_insertion_site = __esm(() => {
|
|
|
162777
162777
|
});
|
|
162778
162778
|
|
|
162779
162779
|
// ../../../v2/editor-core/dist/document/transactions/compile-edit-text-inline-plan.js
|
|
162780
|
-
function planDirectInlineEdit(paragraphBytes, startOffset, endOffset, newText, collapsedObjectBoundary, collapsedInlineAffinity, inheritedNamespaceBindings = {}) {
|
|
162780
|
+
function planDirectInlineEdit(paragraphBytes, startOffset, endOffset, newText, collapsedObjectBoundary, collapsedInlineAffinity, inheritedNamespaceBindings = {}, collapsedOutsideContentControl = false) {
|
|
162781
162781
|
const xml = TD21.decode(paragraphBytes);
|
|
162782
162782
|
const model = parseParagraphInlineMap(xml, inheritedNamespaceBindings);
|
|
162783
162783
|
const leaves = model.leaves();
|
|
@@ -162820,7 +162820,7 @@ function planDirectInlineEdit(paragraphBytes, startOffset, endOffset, newText, c
|
|
|
162820
162820
|
if (beside)
|
|
162821
162821
|
return beside;
|
|
162822
162822
|
}
|
|
162823
|
-
const scope = resolveEditScope(model.pieces, startOffset, endOffset, collapsedInlineAffinity);
|
|
162823
|
+
const scope = resolveEditScope(model.pieces, startOffset, endOffset, collapsedInlineAffinity, collapsedOutsideContentControl);
|
|
162824
162824
|
if (!scope.ok)
|
|
162825
162825
|
return { ok: false, reason: scope.reason };
|
|
162826
162826
|
const pieces = scope.pieces;
|
|
@@ -162832,7 +162832,7 @@ function planDirectInlineEdit(paragraphBytes, startOffset, endOffset, newText, c
|
|
|
162832
162832
|
return { ok: false, reason: "invalid-range" };
|
|
162833
162833
|
}
|
|
162834
162834
|
const hasEditableLeaf = pieces.some((piece) => isVisibleText(piece) || isLiveControl(piece) || startOffset !== endOffset && isLiveNoteReference(piece));
|
|
162835
|
-
if (!hasEditableLeaf) {
|
|
162835
|
+
if (!hasEditableLeaf && !(collapsedOutsideContentControl && startOffset === endOffset && newText.length > 0)) {
|
|
162836
162836
|
if (newText.length === 0 && scope.wrapperRemovalOps.length > 0) {
|
|
162837
162837
|
return {
|
|
162838
162838
|
ok: true,
|
|
@@ -162849,7 +162849,7 @@ function planDirectInlineEdit(paragraphBytes, startOffset, endOffset, newText, c
|
|
|
162849
162849
|
}
|
|
162850
162850
|
if (startOffset === endOffset) {
|
|
162851
162851
|
const plan2 = planCollapsedInsert(paragraphBytes, xml, pieces, leaves, startOffset, newText, visibleLength === 0, inlineContext, collapsedInlineAffinity);
|
|
162852
|
-
return plan2.ok && scope.requiresCollaborationSessionSync ? { ...plan2, requiresCollaborationSessionSync: true } : plan2;
|
|
162852
|
+
return plan2.ok && (scope.requiresCollaborationSessionSync || collapsedOutsideContentControl) ? { ...plan2, requiresCollaborationSessionSync: true } : plan2;
|
|
162853
162853
|
}
|
|
162854
162854
|
const plan = planReplace(paragraphBytes, pieces, leaves, startOffset, endOffset, newText, scope.wrapperRemovalOps);
|
|
162855
162855
|
return plan.ok && (scope.requiresCollaborationSessionSync || preservesCrossedBookmarks) ? { ...plan, requiresCollaborationSessionSync: true } : plan;
|
|
@@ -163441,13 +163441,13 @@ function hasNonWordMarkerAtCollapsedMoveBoundary(pieces, at, coordinateSpace = "
|
|
|
163441
163441
|
function firstNonFieldRangeStartMarker(markers) {
|
|
163442
163442
|
return markers.find((piece) => piece.role === "range-start" && !isFieldMarker(piece.markerKind)) ?? null;
|
|
163443
163443
|
}
|
|
163444
|
-
function resolveEditScope(pieces, start, end, collapsedInlineAffinity) {
|
|
163444
|
+
function resolveEditScope(pieces, start, end, collapsedInlineAffinity, collapsedOutsideContentControl = false) {
|
|
163445
163445
|
let current = pieces;
|
|
163446
163446
|
let descended = false;
|
|
163447
163447
|
let emptySdt;
|
|
163448
163448
|
let requiresCollaborationSessionSync = false;
|
|
163449
163449
|
for (;; ) {
|
|
163450
|
-
const container = current.find((piece) => piece.kind === "container" && containerContainsRange(piece, start, end)) ?? (start === end ? findCollapsedEdgeContainer(current, start, collapsedInlineAffinity
|
|
163450
|
+
const container = current.find((piece) => piece.kind === "container" && containerContainsRange(piece, start, end)) ?? (start === end ? findCollapsedEdgeContainer(current, start, collapsedInlineAffinity, collapsedOutsideContentControl) : undefined);
|
|
163451
163451
|
if (!container) {
|
|
163452
163452
|
if (start === end) {
|
|
163453
163453
|
return {
|
|
@@ -163550,9 +163550,24 @@ function containerContainsRange(piece, start, end) {
|
|
|
163550
163550
|
return piece.visibleStart < start && start < piece.visibleEnd;
|
|
163551
163551
|
return piece.visibleStart <= start && end <= piece.visibleEnd;
|
|
163552
163552
|
}
|
|
163553
|
-
function findCollapsedEdgeContainer(pieces, at,
|
|
163553
|
+
function findCollapsedEdgeContainer(pieces, at, collapsedInlineAffinity, collapsedOutsideContentControl = false) {
|
|
163554
163554
|
const emptySdtsAtPoint = pieces.filter((piece) => piece.kind === "container" && piece.containerKind === "sdt" && piece.visibleStart === at && piece.visibleEnd === at);
|
|
163555
|
-
return pieces.find((piece) =>
|
|
163555
|
+
return pieces.find((piece) => {
|
|
163556
|
+
if (piece.kind !== "container")
|
|
163557
|
+
return false;
|
|
163558
|
+
if (collapsedOutsideContentControl && piece.containerKind === "sdt")
|
|
163559
|
+
return false;
|
|
163560
|
+
if (piece.visibleStart === piece.visibleEnd) {
|
|
163561
|
+
return collapsedInlineAffinity == null && emptySdtsAtPoint.length === 1 && piece.containerKind === "sdt" && piece.visibleStart === at;
|
|
163562
|
+
}
|
|
163563
|
+
if (piece.visibleStart === at) {
|
|
163564
|
+
return piece.containerKind === "sdt" ? collapsedInlineAffinity !== "upstream" : !hasVisibleSiblingEndingAt(pieces, at);
|
|
163565
|
+
}
|
|
163566
|
+
if (piece.visibleEnd === at) {
|
|
163567
|
+
return piece.containerKind === "sdt" ? collapsedInlineAffinity !== "downstream" && !hasVisibleSiblingStartingAt(pieces, at, "sdt") : !hasVisibleSiblingStartingAt(pieces, at);
|
|
163568
|
+
}
|
|
163569
|
+
return false;
|
|
163570
|
+
});
|
|
163556
163571
|
}
|
|
163557
163572
|
function planEmptySdtInsert(paragraphBytes, piece, newText) {
|
|
163558
163573
|
const raw = piece.rawXml;
|
|
@@ -196194,7 +196209,7 @@ function rewriteLocalizedDirect(bytes, window2, op, inheritedNamespaceBindings =
|
|
|
196194
196209
|
return rewritten;
|
|
196195
196210
|
return { ok: true, bytes: TE16.encode(rewritten.xml), runPropertiesXml: "" };
|
|
196196
196211
|
}
|
|
196197
|
-
const plan = planDirectInlineEdit(paragraphBytes, op.on.startOffset, op.on.endOffset, op.newText, op.on.collapsedObjectBoundary, op.on.collapsedInlineAffinity, inheritedNamespaceBindings);
|
|
196212
|
+
const plan = planDirectInlineEdit(paragraphBytes, op.on.startOffset, op.on.endOffset, op.newText, op.on.collapsedObjectBoundary, op.on.collapsedInlineAffinity, inheritedNamespaceBindings, op.on.collapsedOutsideContentControl);
|
|
196198
196213
|
if (plan.ok) {
|
|
196199
196214
|
return {
|
|
196200
196215
|
ok: true,
|
|
@@ -292203,8 +292218,13 @@ class V2SelectionMutationAdapter {
|
|
|
292203
292218
|
const tx = begun.tx;
|
|
292204
292219
|
const editTextStartedAt = nowMs6();
|
|
292205
292220
|
const collapsedInlineAffinity = selectionCollapsedInlineAffinity(options);
|
|
292221
|
+
const collapsedOutsideContentControl = options?.collapsedOutsideContentControl === true;
|
|
292206
292222
|
const kernelEdits = edits.map((edit, index2) => ({
|
|
292207
|
-
on:
|
|
292223
|
+
on: edit.on.startOffset === edit.on.endOffset ? {
|
|
292224
|
+
...edit.on,
|
|
292225
|
+
...collapsedInlineAffinity ? { collapsedInlineAffinity } : {},
|
|
292226
|
+
...collapsedOutsideContentControl ? { collapsedOutsideContentControl: true } : {}
|
|
292227
|
+
} : edit.on,
|
|
292208
292228
|
newText: edit.newText,
|
|
292209
292229
|
...options?.changeMode === "tracked" && (isRewrite || edits.length > 1) && !typingHistoryMetadata(options) && story.storyKind !== "textbox" ? {
|
|
292210
292230
|
rewriteGroupId: `${tx.txId}:0`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc/mcp",
|
|
3
|
-
"version": "1.2.1-next.
|
|
3
|
+
"version": "1.2.1-next.3",
|
|
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.15.1-next.
|
|
27
|
+
"@superdoc/sdk": "2.15.1-next.3",
|
|
28
28
|
"debug": "^4.4.3",
|
|
29
29
|
"zod": "^4.3.6"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"superdoc": "2.18.1-next.
|
|
33
|
-
"@superdoc/docx-engine": "0.17.1-next.
|
|
32
|
+
"superdoc": "2.18.1-next.3",
|
|
33
|
+
"@superdoc/docx-engine": "0.17.1-next.3",
|
|
34
34
|
"@superdoc/document-api": "0.1.0-alpha.0",
|
|
35
35
|
"@types/bun": "^1.3.8",
|
|
36
36
|
"@types/node": "22.19.2",
|