@superdoc/mcp 1.12.0-next.6 → 1.12.0-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.
- package/dist/index.js +144 -13
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -31651,7 +31651,7 @@ var init_host = __esm(() => {
|
|
|
31651
31651
|
});
|
|
31652
31652
|
|
|
31653
31653
|
// ../../packages/sdk/langs/node/src/runtime/sdk-version.generated.ts
|
|
31654
|
-
var SDK_VERSION = "2.25.0-next.
|
|
31654
|
+
var SDK_VERSION = "2.25.0-next.8";
|
|
31655
31655
|
|
|
31656
31656
|
// ../../packages/sdk/langs/node/src/runtime/embedded-platform.ts
|
|
31657
31657
|
import { accessSync, chmodSync, constants, existsSync, statSync } from "node:fs";
|
|
@@ -195393,9 +195393,12 @@ function readContentControlBlockGroups(bytes) {
|
|
|
195393
195393
|
}
|
|
195394
195394
|
return { groups, leadingXml, trailingXml: sliceWithoutWrappers(cursor, container.closeStart) };
|
|
195395
195395
|
}
|
|
195396
|
-
function prepareContentControlRewrite(current, entry) {
|
|
195396
|
+
function prepareContentControlRewrite(current, entry, paragraph) {
|
|
195397
195397
|
if (entry.kind !== "modify")
|
|
195398
195398
|
return null;
|
|
195399
|
+
const localized = paragraph && prepareParagraphContentControlRewrite(current, entry, paragraph);
|
|
195400
|
+
if (localized)
|
|
195401
|
+
return localized;
|
|
195399
195402
|
const normalized = normalizePartPatches([...entry.patches]);
|
|
195400
195403
|
if (!normalized.ok)
|
|
195401
195404
|
return null;
|
|
@@ -195416,6 +195419,40 @@ function prepareContentControlRewrite(current, entry) {
|
|
|
195416
195419
|
trailingXmlChanged: before.trailingXml !== after.trailingXml
|
|
195417
195420
|
};
|
|
195418
195421
|
}
|
|
195422
|
+
function prepareParagraphContentControlRewrite(current, entry, paragraph) {
|
|
195423
|
+
if (entry.kind !== "modify" || entry.patches.length !== 1)
|
|
195424
|
+
return null;
|
|
195425
|
+
const patch = entry.patches[0];
|
|
195426
|
+
if (patch.kind !== "replaceBytes" || patch.startByte !== paragraph.byteStart || patch.endByte !== paragraph.byteEnd || paragraph.byteStart < 0 || paragraph.byteEnd > current.length || paragraph.byteEnd <= paragraph.byteStart)
|
|
195427
|
+
return null;
|
|
195428
|
+
const beforeXml = TD29.decode(current.subarray(paragraph.byteStart, paragraph.byteEnd));
|
|
195429
|
+
const afterXml = TD29.decode(patch.bytes);
|
|
195430
|
+
const namespaces = namespaceBindingsAtPosition(current, paragraph.byteStart);
|
|
195431
|
+
const capture = (xml) => {
|
|
195432
|
+
const parsed = collectXmlElementRanges(xml, { fragment: true, additionalNamespaces: { ...namespaces } });
|
|
195433
|
+
if (parsed.errors.length)
|
|
195434
|
+
return null;
|
|
195435
|
+
const paragraphs2 = parsed.ranges.filter((range) => range.tag.namespaceUri === W2 && range.tag.localName === "p");
|
|
195436
|
+
const root = paragraphs2[0];
|
|
195437
|
+
if (paragraphs2.length !== 1 || !root || root.start !== 0 || root.end !== xml.length || root.tag.attributes.find((attribute2) => attribute2.namespaceUri === W14 && attribute2.localName === "paraId")?.value !== paragraph.blockId || parsed.ranges.some((range) => range.tag.namespaceUri === W2 && range.tag.localName === "sectPr"))
|
|
195438
|
+
return null;
|
|
195439
|
+
return {
|
|
195440
|
+
open: xml.slice(root.start, root.openEnd),
|
|
195441
|
+
properties: parsed.ranges.filter((range) => range.tag.namespaceUri === W2 && range.tag.localName === "pPr").map((range) => xml.slice(range.start, range.end))
|
|
195442
|
+
};
|
|
195443
|
+
};
|
|
195444
|
+
const before = capture(beforeXml);
|
|
195445
|
+
const after = capture(afterXml);
|
|
195446
|
+
if (!before || !after || before.open !== after.open || before.properties.length !== after.properties.length || before.properties.some((xml, ordinal) => xml !== after.properties[ordinal]))
|
|
195447
|
+
return null;
|
|
195448
|
+
return {
|
|
195449
|
+
removedBlockIds: [],
|
|
195450
|
+
addedBlockIds: [],
|
|
195451
|
+
leadingBlockIds: [],
|
|
195452
|
+
trailingXmlChanged: false,
|
|
195453
|
+
contentBlockIds: beforeXml === afterXml ? [] : [paragraph.blockId]
|
|
195454
|
+
};
|
|
195455
|
+
}
|
|
195419
195456
|
function snapshot(xml, parsed = collectXmlElementRanges(xml)) {
|
|
195420
195457
|
if (parsed.errors.length)
|
|
195421
195458
|
return null;
|
|
@@ -195450,6 +195487,7 @@ var init_content_control_rewrite = __esm(() => {
|
|
|
195450
195487
|
init_xml_sax();
|
|
195451
195488
|
init_paragraph_index();
|
|
195452
195489
|
init_patch_substrate();
|
|
195490
|
+
init_paragraph_para_id_attrs();
|
|
195453
195491
|
TD29 = new TextDecoder;
|
|
195454
195492
|
});
|
|
195455
195493
|
|
|
@@ -232867,7 +232905,7 @@ function runImageMoveCommit(input) {
|
|
|
232867
232905
|
};
|
|
232868
232906
|
}
|
|
232869
232907
|
const sourceWithoutCarrier = sourceParagraphXml.slice(0, carrier.runStart) + sourceParagraphXml.slice(carrier.runEnd);
|
|
232870
|
-
const removeSourceParagraph = !sameParagraph && op.target.storyId === input.state.mainStoryId && sourceParagraph.isDirectBodyChild && isEmptyImageMoveSource(sourceWithoutCarrier, lazyNamespaceBindingsAt(storyBytes, sourceParagraph.byteStart)());
|
|
232908
|
+
const removeSourceParagraph = !sameParagraph && op.target.storyId === input.state.mainStoryId && sourceParagraph.isDirectBodyChild && isEmptyImageMoveSource(sourceWithoutCarrier, lazyNamespaceBindingsAt(storyBytes, sourceParagraph.byteStart)(), input.state);
|
|
232871
232909
|
const adjustedDestinationOffset = sameParagraph && op.to.offset > carrier.visibleOffset ? op.to.offset - 1 : op.to.offset;
|
|
232872
232910
|
const destinationBaseXml = sameParagraph ? sourceWithoutCarrier : destinationParagraphXml;
|
|
232873
232911
|
let validationWId = Number.MAX_SAFE_INTEGER;
|
|
@@ -232978,7 +233016,7 @@ function resolveParagraph(state, storyId, paraId) {
|
|
|
232978
233016
|
isDirectBodyChild: entry.directBodyChildOrdinal != null
|
|
232979
233017
|
};
|
|
232980
233018
|
}
|
|
232981
|
-
function isEmptyImageMoveSource(xml, namespaceBindings) {
|
|
233019
|
+
function isEmptyImageMoveSource(xml, namespaceBindings, state) {
|
|
232982
233020
|
if (xml.includes("<!--") || xml.includes("<?"))
|
|
232983
233021
|
return false;
|
|
232984
233022
|
const parsed = collectXmlElementRanges(xml, {
|
|
@@ -232989,7 +233027,20 @@ function isEmptyImageMoveSource(xml, namespaceBindings) {
|
|
|
232989
233027
|
return false;
|
|
232990
233028
|
if (parseParagraphInlineMap(xml, namespaceBindings).visibleLength !== 0)
|
|
232991
233029
|
return false;
|
|
232992
|
-
|
|
233030
|
+
const styles = parsed.ranges.filter((range) => range.tag.namespaceUri === WORDPROCESSINGML_NS && range.tag.localName === "pStyle");
|
|
233031
|
+
let defaultStyleId = null;
|
|
233032
|
+
if (styles.length) {
|
|
233033
|
+
if (styles.length !== 1)
|
|
233034
|
+
return false;
|
|
233035
|
+
const style = styles[0], properties2 = parsed.ranges.find((range) => range.tag.namespaceUri === WORDPROCESSINGML_NS && range.tag.localName === "pPr");
|
|
233036
|
+
if (!properties2 || style.start < properties2.openEnd || style.end > properties2.closeStart || xml.slice(style.openEnd, style.closeStart).trim())
|
|
233037
|
+
return false;
|
|
233038
|
+
const resolved = resolveDefaultParagraphStyle(state);
|
|
233039
|
+
defaultStyleId = resolved.ok ? resolved.styleId : null;
|
|
233040
|
+
if (!defaultStyleId || !style.tag.attributes.some((attribute2) => attribute2.namespaceUri === WORDPROCESSINGML_NS && attribute2.localName === "val" && attribute2.value === defaultStyleId))
|
|
233041
|
+
return false;
|
|
233042
|
+
}
|
|
233043
|
+
return parsed.ranges.every(({ tag }) => tag.namespaceUri === WORDPROCESSINGML_NS && ["p", "pPr", "pStyle", "r", "rPr", "t"].includes(tag.localName) && tag.attributes.every((attribute2) => attribute2.namespaceUri === "http://www.w3.org/2000/xmlns/" || attribute2.namespaceUri === "http://www.w3.org/XML/1998/namespace" && attribute2.localName === "space" || tag.localName === "pStyle" && attribute2.namespaceUri === WORDPROCESSINGML_NS && attribute2.localName === "val" && attribute2.value === defaultStyleId || tag.localName === "p" && (attribute2.namespaceUri === "http://schemas.microsoft.com/office/word/2010/wordml" && ["paraId", "textId"].includes(attribute2.localName) || attribute2.namespaceUri === WORDPROCESSINGML_NS && /^rsid/.test(attribute2.localName))));
|
|
232993
233044
|
}
|
|
232994
233045
|
function resolveIsolatedImageCarrier(input) {
|
|
232995
233046
|
const relativeDrawingStart = input.descriptor.byteStart - input.paragraphByteStart;
|
|
@@ -233555,6 +233606,7 @@ var init_compile_image_ops = __esm(() => {
|
|
|
233555
233606
|
init_revision_wid_allocator();
|
|
233556
233607
|
init_split_paragraph_inline();
|
|
233557
233608
|
init_paragraph_para_id_attrs();
|
|
233609
|
+
init_insertion_formatting_context();
|
|
233558
233610
|
init_insertion_restoration();
|
|
233559
233611
|
init_prepared_mutation();
|
|
233560
233612
|
init_patch_substrate();
|
|
@@ -245733,13 +245785,17 @@ function runStorySurfaceRewriteCommit(input) {
|
|
|
245733
245785
|
const controlOwner = op.storyPartOwnership[0];
|
|
245734
245786
|
const controlBytes = controlOwner && input.state.packageBytes.get(controlOwner.partUri);
|
|
245735
245787
|
const controlPatch = controlOwner && effectivePerPart[controlOwner.partUri];
|
|
245788
|
+
const controlIndex = op.contentControlRewrite && controlOwner && getStoryParagraphIndexFromState(input.state, controlOwner.storyId);
|
|
245789
|
+
const controlParagraph = op.targetBlockIds.length === 1 && controlIndex && !controlIndex.duplicateParaIds.has(op.targetBlockIds[0]) ? controlIndex.byParaId(op.targetBlockIds[0]) : undefined;
|
|
245790
|
+
const controlScope = controlOwner && op.indexRefreshScope?.perPart[controlOwner.partUri];
|
|
245791
|
+
const localizedControlParagraph = controlScope?.kind === "paragraph" && controlParagraph && controlParagraph.partUri === controlOwner?.partUri && controlScope.beforeWindow.startByte === controlParagraph.byteStart && controlScope.beforeWindow.endByte === controlParagraph.byteEnd ? controlParagraph : undefined;
|
|
245736
245792
|
const localizedControl = op.contentControlRewrite && op.changeMode !== "tracked" && controlBytes && controlPatch ? prepareLocalizedContentControlRewrite(controlBytes, controlPatch, controlOwner ? getStoryParagraphIndexFromState(input.state, controlOwner.storyId) : undefined, input.state) : null;
|
|
245737
245793
|
if (localizedControl && controlOwner) {
|
|
245738
245794
|
forwardPatchGroup.indexRefreshScope = {
|
|
245739
245795
|
perPart: { ...forwardPatchGroup.indexRefreshScope?.perPart, [controlOwner.partUri]: localizedControl.scope }
|
|
245740
245796
|
};
|
|
245741
245797
|
}
|
|
245742
|
-
const contentControlRewrite = localizedControl?.rewrite ?? (op.contentControlRewrite && controlBytes && controlPatch ? prepareContentControlRewrite(controlBytes, controlPatch) : null);
|
|
245798
|
+
const contentControlRewrite = localizedControl?.rewrite ?? (op.contentControlRewrite && controlBytes && controlPatch ? prepareContentControlRewrite(controlBytes, controlPatch, localizedControlParagraph) : null);
|
|
245743
245799
|
if (op.contentControlRewrite && (op.family !== "storyBlocks" || op.storyPartOwnership.length !== 1 || !contentControlRewrite)) {
|
|
245744
245800
|
return rejected7(input.txId, "unsupported-context");
|
|
245745
245801
|
}
|
|
@@ -327906,8 +327962,7 @@ function selectedDrawingRepresentation(piece) {
|
|
|
327906
327962
|
pic: "http://schemas.openxmlformats.org/drawingml/2006/picture",
|
|
327907
327963
|
wp: WORD_DRAWING_NAMESPACE,
|
|
327908
327964
|
wps: "http://schemas.microsoft.com/office/word/2010/wordprocessingShape",
|
|
327909
|
-
wpg: "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup"
|
|
327910
|
-
...Object.fromEntries(piece.namespaceBindings)
|
|
327965
|
+
wpg: "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup"
|
|
327911
327966
|
};
|
|
327912
327967
|
for (const attribute2 of root.tag.attributes) {
|
|
327913
327968
|
if (attribute2.prefix === "xmlns")
|
|
@@ -401272,6 +401327,7 @@ class V2ContentControlsAdapter {
|
|
|
401272
401327
|
return this.validateDryRun(input, options, target);
|
|
401273
401328
|
return this.commitDocument(nextXml, "content-control-create", input, options, target, {
|
|
401274
401329
|
partUri: part.partUri,
|
|
401330
|
+
...!tracked && !part.story && input.kind === "inline" && input.at?.start.kind === "text" && input.at.end.kind === "text" && input.at.start.blockId === input.at.end.blockId && !Object.keys(plannedContent.perPart ?? {}).length && !plannedContent.semanticStyleDependencies?.length ? { localizedParagraph: part.paragraphs.find((paragraph4) => paragraph4.blockId === (input.at?.start.kind === "text" ? input.at.start.blockId : undefined)) } : {},
|
|
401275
401331
|
affectedStories: [part.story ?? { kind: "story", storyType: "body" }],
|
|
401276
401332
|
storySurface: {
|
|
401277
401333
|
family: "storyBlocks",
|
|
@@ -402780,6 +402836,7 @@ class V2ContentControlsAdapter {
|
|
|
402780
402836
|
}
|
|
402781
402837
|
}
|
|
402782
402838
|
}
|
|
402839
|
+
const localized = partUri === DOCUMENT_PART_URI5 && commitOptions.storySurface?.contentControlRewrite && commitOptions.storySurface.family === "storyBlocks" && options?.changeMode !== "tracked" && commitOptions.storySurface.changeMode !== "tracked" && !Object.keys(commitOptions.extraPerPart ?? {}).length && !commitOptions.semanticStyleDependencies?.length ? this.localizedParagraphPatch(before, nextXml, current, commitOptions.localizedParagraph) : null;
|
|
402783
402840
|
const insertionCharOffset = commitOptions.insertionCharOffset;
|
|
402784
402841
|
const insertedLength = nextXml.length - before.length;
|
|
402785
402842
|
const bomLength = current[0] === 239 && current[1] === 187 && current[2] === 191 ? 3 : 0;
|
|
@@ -402789,12 +402846,28 @@ class V2ContentControlsAdapter {
|
|
|
402789
402846
|
atByte: bomLength + encodeXml(before.slice(0, insertionCharOffset)).length,
|
|
402790
402847
|
bytes: encodeXml(nextXml.slice(insertionCharOffset, insertionCharOffset + insertedLength))
|
|
402791
402848
|
} : null;
|
|
402792
|
-
const
|
|
402849
|
+
const expectedRevision = expectedRevisionFrom(input, options);
|
|
402850
|
+
const committed = localized ? commitKernelStorySurfacePatch({
|
|
402851
|
+
context: this.context,
|
|
402852
|
+
txIdPrefix: prefix2,
|
|
402853
|
+
expectedRevision: expectedRevision == null ? undefined : String(expectedRevision),
|
|
402854
|
+
appliedChangeMode: "direct",
|
|
402855
|
+
perPart: { [partUri]: localized.entry },
|
|
402856
|
+
storyIds: [localized.storyId],
|
|
402857
|
+
storySurface: { family: "storyBlocks", contentControlRewrite: true, changeMode: "direct", targetBlockIds: [localized.blockId] },
|
|
402858
|
+
signalLanesToRebuild: ["paragraphIndex", "noteAnchorRefs"],
|
|
402859
|
+
indexRefreshScope: { perPart: { [partUri]: {
|
|
402860
|
+
kind: "paragraph",
|
|
402861
|
+
blockIds: [localized.blockId],
|
|
402862
|
+
beforeWindow: localized.beforeWindow
|
|
402863
|
+
} } },
|
|
402864
|
+
createdRefs: commitOptions.createdRefs
|
|
402865
|
+
}) : localizedInsertion ? commitKernelStorySurfacePatch({
|
|
402793
402866
|
context: this.context,
|
|
402794
402867
|
txIdPrefix: prefix2,
|
|
402795
402868
|
appliedChangeMode: commitOptions.storySurface?.changeMode ?? options?.changeMode ?? "direct",
|
|
402796
402869
|
perPart: { [partUri]: { kind: "modify", patches: [localizedInsertion] } },
|
|
402797
|
-
expectedRevision:
|
|
402870
|
+
expectedRevision: expectedRevision === undefined ? undefined : String(expectedRevision),
|
|
402798
402871
|
storySurface: commitOptions.storySurface,
|
|
402799
402872
|
signalLanesToRebuild: commitOptions.signalLanesToRebuild,
|
|
402800
402873
|
storyIds: this.load().parts.filter((part) => part.partUri === partUri && !part.xmlRange).map((part) => part.storyId),
|
|
@@ -402832,6 +402905,31 @@ class V2ContentControlsAdapter {
|
|
|
402832
402905
|
}
|
|
402833
402906
|
return result;
|
|
402834
402907
|
}
|
|
402908
|
+
localizedParagraphPatch(before, after, bytes, paragraph4) {
|
|
402909
|
+
if (!paragraph4)
|
|
402910
|
+
return null;
|
|
402911
|
+
const nextEnd = after.length - before.length + paragraph4.end;
|
|
402912
|
+
if (nextEnd < paragraph4.start || before.slice(paragraph4.start, paragraph4.end) !== paragraph4.xml || before.slice(0, paragraph4.start) !== after.slice(0, paragraph4.start) || before.slice(paragraph4.end) !== after.slice(nextEnd))
|
|
402913
|
+
return null;
|
|
402914
|
+
const index2 = getSDDocumentSessionInternalParagraphIndex(this.context.session);
|
|
402915
|
+
if (!index2 || index2.duplicateParaIds.has(paragraph4.blockId))
|
|
402916
|
+
return null;
|
|
402917
|
+
const entry = index2.byParaId(paragraph4.blockId);
|
|
402918
|
+
if (!entry || entry.partUri !== DOCUMENT_PART_URI5 || decodeXml(bytes.subarray(entry.byteStart, entry.byteEnd)) !== paragraph4.xml)
|
|
402919
|
+
return null;
|
|
402920
|
+
return {
|
|
402921
|
+
blockId: entry.blockId,
|
|
402922
|
+
storyId: entry.storyId,
|
|
402923
|
+
beforeWindow: { startByte: entry.byteStart, endByte: entry.byteEnd },
|
|
402924
|
+
entry: { kind: "modify", patches: [{
|
|
402925
|
+
kind: "replaceBytes",
|
|
402926
|
+
order: 0,
|
|
402927
|
+
startByte: entry.byteStart,
|
|
402928
|
+
endByte: entry.byteEnd,
|
|
402929
|
+
bytes: encodeXml(after.slice(paragraph4.start, nextEnd))
|
|
402930
|
+
}] }
|
|
402931
|
+
};
|
|
402932
|
+
}
|
|
402835
402933
|
}
|
|
402836
402934
|
function contentControlTextBlockIds(control2) {
|
|
402837
402935
|
const target = control2.sourceSelectionTarget;
|
|
@@ -489881,6 +489979,11 @@ function scopeFromHandle(handle) {
|
|
|
489881
489979
|
});
|
|
489882
489980
|
}
|
|
489883
489981
|
const { rootDoc, scope } = handle;
|
|
489982
|
+
if (scope._item?.deleted) {
|
|
489983
|
+
invalidStoryShardTarget("story-shard handle is no longer current; reopen the shared document with join", {
|
|
489984
|
+
shardId: handle.shardId
|
|
489985
|
+
});
|
|
489986
|
+
}
|
|
489884
489987
|
const hasRoots = scope.get(STORY_SHARD_ROOT.meta) instanceof YMap && scope.get(STORY_SHARD_ROOT.blocks) instanceof YArray && scope.get(STORY_SHARD_ROOT.order) instanceof YMap && scope.get(STORY_SHARD_ROOT.tables) instanceof YMap;
|
|
489885
489988
|
if (!hasRoots) {
|
|
489886
489989
|
rootDoc.transact(() => {
|
|
@@ -509701,6 +509804,20 @@ function mirrorStructuralParagraphTargets(input, managedIds) {
|
|
|
509701
509804
|
}
|
|
509702
509805
|
function mirrorContentControlRewrite(input) {
|
|
509703
509806
|
const rewrite = input.extension.contentControlRewrite;
|
|
509807
|
+
const source = input.prepared.source;
|
|
509808
|
+
const index2 = loadStoryParagraphIndex(input.session, input.storyId);
|
|
509809
|
+
const scoped = source.kind === "storySurfaceRewrite" && source.operationId === "content-control-create" && source.changeMode !== "tracked" && input.prepared.localApplyBundle.indexRefreshScope?.perPart[input.prepared.resolvedTargets.storyPartOwnership[0]?.partUri ?? ""]?.kind === "paragraph";
|
|
509810
|
+
if (scoped && rewrite.contentBlockIds.length && !rewrite.addedBlockIds.length && !rewrite.removedBlockIds.length && !rewrite.leadingBlockIds.length && !rewrite.trailingXmlChanged) {
|
|
509811
|
+
const ordinaryBodyParagraphs = rewrite.contentBlockIds.every((id2) => index2?.byParaId(id2)?.directBodyChildOrdinal != null);
|
|
509812
|
+
if (ordinaryBodyParagraphs) {
|
|
509813
|
+
const context = loadStorySyncContext(input.session, input.storyId, rewrite.contentBlockIds);
|
|
509814
|
+
const payloads2 = rewrite.contentBlockIds.map((id2) => readSessionBlockPayload(context, id2));
|
|
509815
|
+
if (!payloads2.some((payload) => /<(?:[\w.-]+:)?(?:ins|del|moveFrom|moveTo)(?=[\s/>])/.test(payload.xml))) {
|
|
509816
|
+
syncBlockPayloads(input.doc, payloads2);
|
|
509817
|
+
return;
|
|
509818
|
+
}
|
|
509819
|
+
}
|
|
509820
|
+
}
|
|
509704
509821
|
if (rewrite.localized) {
|
|
509705
509822
|
const localized = rewrite.localized;
|
|
509706
509823
|
const blockIds = [...new Set([...rewrite.contentBlockIds, ...rewrite.leadingBlockIds])];
|
|
@@ -510354,15 +510471,17 @@ function loadStorySyncContext(session, storyId, blockIds) {
|
|
|
510354
510471
|
throw new Error(`story-surface session sync could not load bytes for ${partUri}`);
|
|
510355
510472
|
}
|
|
510356
510473
|
const rootNamespaceBindings2 = readRootNamespaceBindingsFromBytes(bytes);
|
|
510474
|
+
const paragraphs2 = blockIds ? blockIds.map((id2) => index2.byParaId(id2)).filter((entry) => entry != null) : index2.entries;
|
|
510475
|
+
const ordinaryBodyParagraphs = blockIds && paragraphs2.length === blockIds.length && paragraphs2.every((entry) => entry.directBodyChildOrdinal != null);
|
|
510357
510476
|
return {
|
|
510358
510477
|
storyId,
|
|
510359
510478
|
storyKind: story?.storyKind ?? inferStoryKindFromStoryId(storyId),
|
|
510360
510479
|
partUri,
|
|
510361
510480
|
index: index2,
|
|
510362
510481
|
bytes,
|
|
510363
|
-
tableRefsByBlockId: buildParagraphTableRefsFromCatalog({
|
|
510482
|
+
tableRefsByBlockId: ordinaryBodyParagraphs ? new Map : buildParagraphTableRefsFromCatalog({
|
|
510364
510483
|
catalog: readTableCatalogForSession(session, storyId),
|
|
510365
|
-
paragraphs:
|
|
510484
|
+
paragraphs: paragraphs2.map((entry) => ({
|
|
510366
510485
|
blockId: entry.blockId,
|
|
510367
510486
|
byteStart: entry.byteStart,
|
|
510368
510487
|
byteEnd: entry.byteEnd
|
|
@@ -515073,6 +515192,12 @@ function createCollabV2SessionProjectionController(options) {
|
|
|
515073
515192
|
});
|
|
515074
515193
|
}
|
|
515075
515194
|
function ensureProjectionSubscriptions() {
|
|
515195
|
+
for (const handle of [...options.projectionRegistry.listStories(), ...options.projectionRegistry.listPackageParts()]) {
|
|
515196
|
+
if (handle.rootDoc && handle.scope && getUnitScope(handle.rootDoc, handle.shardId) !== handle.scope) {
|
|
515197
|
+
runtime.markAllDirty();
|
|
515198
|
+
throw new CollabV2DiagnosticError(COLLAB_V2_DIAGNOSTICS.COLLAB_V2_CONNECTION_INPUT_INVALID, "shared document content is no longer current in this editor; reopen the shared document with join", { shardId: handle.shardId });
|
|
515199
|
+
}
|
|
515200
|
+
}
|
|
515076
515201
|
let registryShapeChanged = false;
|
|
515077
515202
|
const currentImport = getPackagePartsMap(options.rootDoc);
|
|
515078
515203
|
if (currentImport !== subscribedImport) {
|
|
@@ -515307,7 +515432,13 @@ function createCollabV2SessionProjectionController(options) {
|
|
|
515307
515432
|
message: `read-freshness matrix has no row for "${operationId}".`
|
|
515308
515433
|
};
|
|
515309
515434
|
}
|
|
515310
|
-
|
|
515435
|
+
try {
|
|
515436
|
+
ensureProjectionSubscriptions();
|
|
515437
|
+
} catch (error51) {
|
|
515438
|
+
if (!(error51 instanceof CollabV2DiagnosticError) || error51.code !== COLLAB_V2_DIAGNOSTICS.COLLAB_V2_CONNECTION_INPUT_INVALID)
|
|
515439
|
+
throw error51;
|
|
515440
|
+
return { ok: false, code: "PRECONDITION_FAILED", message: error51.message };
|
|
515441
|
+
}
|
|
515311
515442
|
if (localBackendSyncDepth === 0) {
|
|
515312
515443
|
const changed = (handle) => {
|
|
515313
515444
|
const doc2 = shardDurableDoc(handle);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc/mcp",
|
|
3
|
-
"version": "1.12.0-next.
|
|
3
|
+
"version": "1.12.0-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.25.0-next.
|
|
27
|
+
"@superdoc/sdk": "2.25.0-next.8",
|
|
28
28
|
"debug": "^4.4.3",
|
|
29
29
|
"zod": "^4.3.6"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"superdoc": "2.28.0-next.
|
|
33
|
-
"@superdoc/docx-engine": "0.27.0-next.
|
|
32
|
+
"superdoc": "2.28.0-next.10",
|
|
33
|
+
"@superdoc/docx-engine": "0.27.0-next.10",
|
|
34
34
|
"@superdoc/document-api": "0.1.0-alpha.0",
|
|
35
35
|
"@types/bun": "^1.3.8",
|
|
36
36
|
"@types/node": "22.19.2",
|