@superdoc/mcp 1.7.0-next.4 → 1.7.0-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.
- package/dist/index.js +108 -21
- 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.0-next.
|
|
31603
|
+
var SDK_VERSION = "2.20.0-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";
|
|
@@ -125658,7 +125658,7 @@ var SYMBOL_CHARACTER_MAP;
|
|
|
125658
125658
|
var init_symbol_character = __esm(() => {
|
|
125659
125659
|
SYMBOL_CHARACTER_MAP = {
|
|
125660
125660
|
symbol: { 183: "•" },
|
|
125661
|
-
wingdings: { 168: "\uD83D\uDF8E", 111: "\uD83D\uDF8F", 224: "\uD83E\uDC6A" },
|
|
125661
|
+
wingdings: { 168: "\uD83D\uDF8E", 111: "\uD83D\uDF8F", 224: "\uD83E\uDC6A", 254: "☑" },
|
|
125662
125662
|
"wingdings 2": { 82: "☑", 80: "\uD83D\uDDF8" }
|
|
125663
125663
|
};
|
|
125664
125664
|
});
|
|
@@ -278811,6 +278811,13 @@ var init_source = __esm(() => {
|
|
|
278811
278811
|
relatedV1Operation: null,
|
|
278812
278812
|
rationale: "Resolve a clicked field result to its canonical address and rebuild availability for the context menu."
|
|
278813
278813
|
},
|
|
278814
|
+
{
|
|
278815
|
+
method: "createDocumentApi(host.adapter).trackChanges.moveFragmentWordIds",
|
|
278816
|
+
stability: "internal",
|
|
278817
|
+
workerWired: true,
|
|
278818
|
+
relatedV1Operation: null,
|
|
278819
|
+
rationale: "Per-side physical w:id arrays for every paragraph of a multi-paragraph tracked move, so the render surface can paint every fragment instead of only the first."
|
|
278820
|
+
},
|
|
278814
278821
|
{
|
|
278815
278822
|
method: "createDocumentApi(host.adapter).format.readEffectiveInlineUniformity",
|
|
278816
278823
|
stability: "internal",
|
|
@@ -356840,6 +356847,9 @@ function createV2AdapterContext(session, options = {}) {
|
|
|
356840
356847
|
currentPublicRevision() {
|
|
356841
356848
|
return mapRevisionToken(currentInternalRevision());
|
|
356842
356849
|
},
|
|
356850
|
+
currentRawPackageRevision() {
|
|
356851
|
+
return currentInternalRevision();
|
|
356852
|
+
},
|
|
356843
356853
|
currentMutationSerial() {
|
|
356844
356854
|
return mutationSerial;
|
|
356845
356855
|
},
|
|
@@ -364806,10 +364816,11 @@ class V2GetAdapter {
|
|
|
364806
364816
|
constructor(context) {
|
|
364807
364817
|
this.context = context;
|
|
364808
364818
|
}
|
|
364809
|
-
get(
|
|
364819
|
+
get(input) {
|
|
364810
364820
|
const paragraphs = readBodyParagraphs(this.context);
|
|
364811
364821
|
const imagesByPara = readBodyParagraphImageMap(this.context);
|
|
364812
|
-
const
|
|
364822
|
+
const styleModel = input.options?.includeResolved ? projectionStyleModel(this.context) : undefined;
|
|
364823
|
+
const body = readTopLevelBodyItems(this.context).map((item) => item.kind === "table" ? projectTableToContentNode(item.table, paragraphs, styleModel) : projectParagraphToContentNode(item.paragraph, imagesByPara.get(item.paragraph.blockId) ?? [], styleModel));
|
|
364813
364824
|
return {
|
|
364814
364825
|
modelVersion: "sdm/1",
|
|
364815
364826
|
body
|
|
@@ -365214,7 +365225,7 @@ class V2HtmlToFragmentAdapter {
|
|
|
365214
365225
|
return convertContentToFragment({ format: "html", source: input.html });
|
|
365215
365226
|
}
|
|
365216
365227
|
}
|
|
365217
|
-
function projectParagraphToContentNode(paragraph4, images) {
|
|
365228
|
+
function projectParagraphToContentNode(paragraph4, images, styleModel) {
|
|
365218
365229
|
if (isHorizontalRuleParagraph(paragraph4.rawXml)) {
|
|
365219
365230
|
return {
|
|
365220
365231
|
kind: "horizontalRule",
|
|
@@ -365224,6 +365235,7 @@ function projectParagraphToContentNode(paragraph4, images) {
|
|
|
365224
365235
|
}
|
|
365225
365236
|
const inlines = buildParagraphInlines(paragraph4.text, images);
|
|
365226
365237
|
const props = projectParagraphDirectProps(paragraph4.rawXml);
|
|
365238
|
+
const resolved = styleModel ? projectParagraphResolvedIndent(paragraph4.rawXml, styleModel) : undefined;
|
|
365227
365239
|
if (paragraph4.headingLevel > 0) {
|
|
365228
365240
|
return {
|
|
365229
365241
|
kind: "heading",
|
|
@@ -365232,7 +365244,8 @@ function projectParagraphToContentNode(paragraph4, images) {
|
|
|
365232
365244
|
level: toPublicHeadingLevel(paragraph4.headingLevel) ?? 1,
|
|
365233
365245
|
inlines,
|
|
365234
365246
|
...paragraph4.styleId ? { styleRef: paragraph4.styleId } : {},
|
|
365235
|
-
...props ? { props } : {}
|
|
365247
|
+
...props ? { props } : {},
|
|
365248
|
+
...resolved ? { resolved } : {}
|
|
365236
365249
|
}
|
|
365237
365250
|
};
|
|
365238
365251
|
}
|
|
@@ -365242,10 +365255,23 @@ function projectParagraphToContentNode(paragraph4, images) {
|
|
|
365242
365255
|
paragraph: {
|
|
365243
365256
|
inlines,
|
|
365244
365257
|
...paragraph4.styleId ? { styleRef: paragraph4.styleId } : {},
|
|
365245
|
-
...props ? { props } : {}
|
|
365258
|
+
...props ? { props } : {},
|
|
365259
|
+
...resolved ? { resolved } : {}
|
|
365246
365260
|
}
|
|
365247
365261
|
};
|
|
365248
365262
|
}
|
|
365263
|
+
function projectParagraphResolvedIndent(paragraphXml, styleModel) {
|
|
365264
|
+
const properties = styleModel.resolveParagraph({
|
|
365265
|
+
inlineProps: parseWordParagraphPropertiesXml(paragraphXml)
|
|
365266
|
+
});
|
|
365267
|
+
const indent2 = {};
|
|
365268
|
+
for (const key2 of ["start", "end", "left", "right", "firstLine", "hanging"]) {
|
|
365269
|
+
const value2 = properties.indent?.[key2];
|
|
365270
|
+
if (typeof value2 === "number" && Number.isFinite(value2))
|
|
365271
|
+
indent2[key2] = twipsToPoints2(value2);
|
|
365272
|
+
}
|
|
365273
|
+
return Object.keys(indent2).length > 0 ? { indent: indent2 } : {};
|
|
365274
|
+
}
|
|
365249
365275
|
function isHorizontalRuleParagraph(paragraphXml) {
|
|
365250
365276
|
return /<v:rect\b[^>]*\s+o:hr\s*=\s*(["'])t\1[^>]*>/i.test(paragraphXml);
|
|
365251
365277
|
}
|
|
@@ -365303,7 +365329,7 @@ function projectImageInline(image) {
|
|
|
365303
365329
|
}
|
|
365304
365330
|
};
|
|
365305
365331
|
}
|
|
365306
|
-
function projectTableToContentNode(table, paragraphs) {
|
|
365332
|
+
function projectTableToContentNode(table, paragraphs, styleModel) {
|
|
365307
365333
|
return {
|
|
365308
365334
|
kind: "table",
|
|
365309
365335
|
id: table.tableNodeId,
|
|
@@ -365314,7 +365340,7 @@ function projectTableToContentNode(table, paragraphs) {
|
|
|
365314
365340
|
...row.isHeaderRow ? { header: true } : {},
|
|
365315
365341
|
colSpan: cell.gridSpan > 1 ? cell.gridSpan : undefined,
|
|
365316
365342
|
rowSpan: computeCellRowSpan(table, row.rowIndex, cell) > 1 ? computeCellRowSpan(table, row.rowIndex, cell) : undefined,
|
|
365317
|
-
content: findParagraphsInCell(paragraphs, cell).map((paragraph4) => projectParagraphToContentNode(paragraph4, []))
|
|
365343
|
+
content: findParagraphsInCell(paragraphs, cell).map((paragraph4) => projectParagraphToContentNode(paragraph4, [], styleModel))
|
|
365318
365344
|
}))
|
|
365319
365345
|
}))
|
|
365320
365346
|
}
|
|
@@ -365556,12 +365582,14 @@ function findTrackedParagraphEntry(context, storyId, partUri, start, end) {
|
|
|
365556
365582
|
var WORD_RE;
|
|
365557
365583
|
var init_read_adapters = __esm(() => {
|
|
365558
365584
|
init_review_read_model();
|
|
365585
|
+
init_src6();
|
|
365559
365586
|
init_src3();
|
|
365560
365587
|
init_sd_document_session_internal();
|
|
365561
365588
|
init_story_locator();
|
|
365562
365589
|
init_textbox_story();
|
|
365563
365590
|
init_conversion();
|
|
365564
365591
|
init_read();
|
|
365592
|
+
init_formatting();
|
|
365565
365593
|
init_logical_view_cache();
|
|
365566
365594
|
init_content_projection3();
|
|
365567
365595
|
init_paragraph();
|
|
@@ -376815,6 +376843,41 @@ class V2TrackedChangesAdapter {
|
|
|
376815
376843
|
}
|
|
376816
376844
|
return { requestedIds: orderedRequestedIds, canonicalIds, items, unresolvedTrackedChangeIds };
|
|
376817
376845
|
}
|
|
376846
|
+
moveFragmentWordIds(requestedIds) {
|
|
376847
|
+
if (isTrackedChangeLoadingDisabledForDevelopment()) {
|
|
376848
|
+
return {
|
|
376849
|
+
evaluatedRevision: this.context.currentPublicRevision(),
|
|
376850
|
+
packageRevision: this.context.currentRawPackageRevision(),
|
|
376851
|
+
items: []
|
|
376852
|
+
};
|
|
376853
|
+
}
|
|
376854
|
+
const view = this.buildView();
|
|
376855
|
+
const { logical } = view;
|
|
376856
|
+
const seen = new Set;
|
|
376857
|
+
const items = [];
|
|
376858
|
+
for (const id of requestedIds) {
|
|
376859
|
+
if (seen.has(id))
|
|
376860
|
+
continue;
|
|
376861
|
+
seen.add(id);
|
|
376862
|
+
let entry = getLocalTrackedTextEntry(this.context, id);
|
|
376863
|
+
if (!entry) {
|
|
376864
|
+
const rawEntry = logical.byId.get(id);
|
|
376865
|
+
entry = rawEntry ? resolveSubsumedLogicalChange(logical, rawEntry) : id.startsWith("imported:") ? resolveReviewSnapshotTrackedChangeId(view, id) : null;
|
|
376866
|
+
}
|
|
376867
|
+
if (!entry || entry.type !== "move")
|
|
376868
|
+
continue;
|
|
376869
|
+
items.push({
|
|
376870
|
+
id,
|
|
376871
|
+
sourceWordIds: entry.fragments.filter((fragment4) => fragment4.kind === "moveFrom").map((fragment4) => fragment4.wId).filter((wId) => wId.length > 0),
|
|
376872
|
+
destinationWordIds: entry.fragments.filter((fragment4) => fragment4.kind === "moveTo").map((fragment4) => fragment4.wId).filter((wId) => wId.length > 0)
|
|
376873
|
+
});
|
|
376874
|
+
}
|
|
376875
|
+
return {
|
|
376876
|
+
evaluatedRevision: this.context.currentPublicRevision(),
|
|
376877
|
+
packageRevision: this.context.currentRawPackageRevision(),
|
|
376878
|
+
items
|
|
376879
|
+
};
|
|
376880
|
+
}
|
|
376818
376881
|
get(input) {
|
|
376819
376882
|
throwProjectionReadFailure(this.context, "trackChanges.get");
|
|
376820
376883
|
const localEntry = getLocalTrackedTextEntry(this.context, input.id);
|
|
@@ -378770,15 +378833,20 @@ function mapInternalOverlapLayerTypeToPublic(type) {
|
|
|
378770
378833
|
}
|
|
378771
378834
|
}
|
|
378772
378835
|
function buildMoveTargetProjection(context, address3, entry, storyOverride, resolveSession) {
|
|
378773
|
-
|
|
378774
|
-
|
|
378836
|
+
let sourceFragments = entry.fragments.filter((fragment4) => fragment4.kind === "moveFrom");
|
|
378837
|
+
if (sourceFragments.length === 0 && entry.type === "move") {
|
|
378838
|
+
sourceFragments = entry.fragments.filter((fragment4) => fragment4.kind === "del");
|
|
378839
|
+
}
|
|
378840
|
+
let destinationFragments = entry.fragments.filter((fragment4) => fragment4.kind === "moveTo");
|
|
378841
|
+
if (destinationFragments.length === 0 && entry.type === "move") {
|
|
378842
|
+
destinationFragments = entry.fragments.filter((fragment4) => fragment4.kind === "ins");
|
|
378843
|
+
}
|
|
378775
378844
|
const sourceStructuralFragment = entry.structuralFragments.find((fragment4) => fragment4.structuralKind.endsWith("-deletion")) ?? null;
|
|
378776
378845
|
const destinationStructuralFragment = entry.structuralFragments.find((fragment4) => fragment4.structuralKind.endsWith("-insertion")) ?? null;
|
|
378777
|
-
if (
|
|
378846
|
+
if (sourceFragments.length === 0 && destinationFragments.length === 0 && !sourceStructuralFragment && !destinationStructuralFragment)
|
|
378778
378847
|
return null;
|
|
378779
|
-
const
|
|
378780
|
-
const
|
|
378781
|
-
const destinationTarget = destinationFragment ? resolveMoveSideTarget(context, destinationFragment, "tracked", storyOverride, resolveSession) : destinationStructuralFragment ? resolveTrackedChangeFragmentBlockAnchor(context, destinationStructuralFragment, storyOverride, resolveSession)?.target ?? null : null;
|
|
378848
|
+
const sourceTarget = sourceFragments.length > 0 ? resolveMoveSideTarget(context, sourceFragments, "tracked", storyOverride, resolveSession) : sourceStructuralFragment ? resolveTrackedChangeFragmentBlockAnchor(context, sourceStructuralFragment, storyOverride, resolveSession)?.target ?? null : null;
|
|
378849
|
+
const destinationTarget = destinationFragments.length > 0 ? resolveMoveSideTarget(context, destinationFragments, "tracked", storyOverride, resolveSession) : destinationStructuralFragment ? resolveTrackedChangeFragmentBlockAnchor(context, destinationStructuralFragment, storyOverride, resolveSession)?.target ?? null : null;
|
|
378782
378850
|
return {
|
|
378783
378851
|
kind: "move",
|
|
378784
378852
|
address: address3,
|
|
@@ -378786,12 +378854,31 @@ function buildMoveTargetProjection(context, address3, entry, storyOverride, reso
|
|
|
378786
378854
|
destination: destinationTarget
|
|
378787
378855
|
};
|
|
378788
378856
|
}
|
|
378789
|
-
function resolveMoveSideTarget(context,
|
|
378790
|
-
const
|
|
378791
|
-
|
|
378792
|
-
|
|
378793
|
-
|
|
378794
|
-
|
|
378857
|
+
function resolveMoveSideTarget(context, fragments, coordinateSpace, storyOverride, resolveSession) {
|
|
378858
|
+
const segments = [];
|
|
378859
|
+
let story;
|
|
378860
|
+
for (const fragment4 of fragments) {
|
|
378861
|
+
const text4 = resolveTrackedChangeFragmentTextTarget(context, fragment4, coordinateSpace, storyOverride, resolveSession);
|
|
378862
|
+
if (!text4.ok)
|
|
378863
|
+
continue;
|
|
378864
|
+
segments.push(...text4.normalizedTarget.segments);
|
|
378865
|
+
if (story === undefined)
|
|
378866
|
+
story = text4.normalizedTarget.story;
|
|
378867
|
+
}
|
|
378868
|
+
if (segments.length > 0) {
|
|
378869
|
+
return {
|
|
378870
|
+
kind: "text",
|
|
378871
|
+
coordinateSpace,
|
|
378872
|
+
segments: [segments[0], ...segments.slice(1)],
|
|
378873
|
+
...story ? { story } : {}
|
|
378874
|
+
};
|
|
378875
|
+
}
|
|
378876
|
+
for (const fragment4 of fragments) {
|
|
378877
|
+
const anchor = resolveTrackedChangeFragmentBlockAnchor(context, fragment4, storyOverride, resolveSession);
|
|
378878
|
+
if (anchor)
|
|
378879
|
+
return anchor.target;
|
|
378880
|
+
}
|
|
378881
|
+
return null;
|
|
378795
378882
|
}
|
|
378796
378883
|
function buildFormattingTarget(address3, entry) {
|
|
378797
378884
|
const semantics = entry.formattingDelta?.semantics;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc/mcp",
|
|
3
|
-
"version": "1.7.0-next.
|
|
3
|
+
"version": "1.7.0-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.0-next.
|
|
27
|
+
"@superdoc/sdk": "2.20.0-next.6",
|
|
28
28
|
"debug": "^4.4.3",
|
|
29
29
|
"zod": "^4.3.6"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"superdoc": "2.23.0-next.
|
|
33
|
-
"@superdoc/docx-engine": "0.22.0-next.
|
|
32
|
+
"superdoc": "2.23.0-next.6",
|
|
33
|
+
"@superdoc/docx-engine": "0.22.0-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",
|