@superdoc/mcp 1.9.0-next.4 → 1.9.0-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 +237 -103
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -31620,7 +31620,7 @@ var init_host = __esm(() => {
|
|
|
31620
31620
|
});
|
|
31621
31621
|
|
|
31622
31622
|
// ../../packages/sdk/langs/node/src/runtime/sdk-version.generated.ts
|
|
31623
|
-
var SDK_VERSION = "2.22.0-next.
|
|
31623
|
+
var SDK_VERSION = "2.22.0-next.5";
|
|
31624
31624
|
|
|
31625
31625
|
// ../../packages/sdk/langs/node/src/runtime/embedded-platform.ts
|
|
31626
31626
|
import { accessSync, chmodSync, constants, existsSync, statSync } from "node:fs";
|
|
@@ -150138,7 +150138,11 @@ function captureParagraphLocalCommentMarkersUncached(xml, namespaceBindings) {
|
|
|
150138
150138
|
start: event.start,
|
|
150139
150139
|
end: event.end,
|
|
150140
150140
|
rawTag: xml.slice(event.start, event.end),
|
|
150141
|
-
namespaces: JSON.stringify(
|
|
150141
|
+
namespaces: JSON.stringify([...new Set([
|
|
150142
|
+
event.tag.prefix,
|
|
150143
|
+
...event.tag.attributes.filter((attribute) => attribute.prefix && attribute.prefix !== "xmlns").map((attribute) => attribute.prefix),
|
|
150144
|
+
...event.tag.attributes.flatMap((attribute) => [...attribute.value.matchAll(/\b([\w.-]+):[\w.-]+/g)].map((match) => match[1]))
|
|
150145
|
+
])].sort().map((prefix) => [prefix, event.namespaceBindings[prefix] ?? ""]))
|
|
150142
150146
|
});
|
|
150143
150147
|
}
|
|
150144
150148
|
});
|
|
@@ -166069,25 +166073,28 @@ function readResidentReviewComponent(state, mode, sourceIds, includeCoordinates
|
|
|
166069
166073
|
const ownership = readResidentParagraphOwnership(state, index.entries[first]?.blockId ?? "");
|
|
166070
166074
|
if (!ownership || ownership.parentNamespaceBindings.w !== NS_W)
|
|
166071
166075
|
return null;
|
|
166076
|
+
const hasParagraphBridge = (owner2) => (owner2.xml.match(/<w:pPr\b[\s\S]*?<\/w:pPr>/g) ?? []).some((xml) => /<w:pPrChange\b|<w:rPr\b[\s\S]*?<w:(?:ins|del)\b/.test(xml));
|
|
166072
166077
|
const neighbor = (ordinal, delta) => {
|
|
166073
166078
|
const paragraph2 = index.entries[ordinal], adjacent = index.entries[ordinal + delta];
|
|
166074
166079
|
if (!paragraph2 || !adjacent)
|
|
166075
166080
|
return ordinal;
|
|
166076
166081
|
const adjacentOwnership = readResidentParagraphOwnership(state, adjacent.blockId);
|
|
166077
166082
|
if (!adjacentOwnership) {
|
|
166078
|
-
const
|
|
166079
|
-
if (
|
|
166083
|
+
const current2 = review.owners.get(paragraph2.blockId), other = review.owners.get(adjacent.blockId);
|
|
166084
|
+
if (current2 && other && !/<(?:[\w.-]+:)?pPr\b/.test(current2.xml) && !/<(?:[\w.-]+:)?(?:ins|del|moveFrom|moveTo|pPrChange|rPrChange)\b/.test(other.xml))
|
|
166080
166085
|
return ordinal;
|
|
166081
166086
|
return null;
|
|
166082
166087
|
}
|
|
166083
|
-
|
|
166088
|
+
if (adjacentOwnership.containerId === ownership.containerId)
|
|
166089
|
+
return ordinal + delta;
|
|
166090
|
+
const current = review.owners.get(paragraph2.blockId);
|
|
166091
|
+
return current && hasParagraphBridge(current) ? null : ordinal;
|
|
166084
166092
|
};
|
|
166085
166093
|
const previous = neighbor(first, -1), next = neighbor(last, 1);
|
|
166086
166094
|
if (previous == null || next == null)
|
|
166087
166095
|
return null;
|
|
166088
166096
|
first = previous;
|
|
166089
166097
|
last = next;
|
|
166090
|
-
const hasParagraphBridge = (owner2) => (owner2.xml.match(/<w:pPr\b[\s\S]*?<\/w:pPr>/g) ?? []).some((xml) => /<w:pPrChange\b|<w:rPr\b[\s\S]*?<w:(?:ins|del)\b/.test(xml));
|
|
166091
166098
|
let owners = [];
|
|
166092
166099
|
for (;; ) {
|
|
166093
166100
|
if (last - first >= 64)
|
|
@@ -179652,6 +179659,10 @@ var init_textbox_atom_replacement = __esm(() => {
|
|
|
179652
179659
|
function clearTrackedChangeLogicalCatalogCache(state) {
|
|
179653
179660
|
state.partRegistries.delete(LOGICAL_CATALOG_CACHE_KEY);
|
|
179654
179661
|
}
|
|
179662
|
+
function readCurrentTrackedChangeLogicalCatalog(state, replacementMode) {
|
|
179663
|
+
const cached2 = state.partRegistries.get(LOGICAL_CATALOG_CACHE_KEY);
|
|
179664
|
+
return cached2?.key === logicalCatalogGuardKey(state, replacementMode) ? cached2.view : null;
|
|
179665
|
+
}
|
|
179655
179666
|
function accessTrackedChangeLogicalCatalog(state, replacementMode) {
|
|
179656
179667
|
const key3 = logicalCatalogGuardKey(state, replacementMode);
|
|
179657
179668
|
const cached2 = state.partRegistries.get(LOGICAL_CATALOG_CACHE_KEY);
|
|
@@ -194313,6 +194324,71 @@ var init_preserved_structural_sdt = __esm(() => {
|
|
|
194313
194324
|
INLINE_SDT_DEPENDENCY_RE = /<(?:[\w.-]+:)?sdt\b/;
|
|
194314
194325
|
});
|
|
194315
194326
|
|
|
194327
|
+
// ../../../v2/editor-core/dist/document/transactions/tracked-changes/paragraph-mark-markers.js
|
|
194328
|
+
function paragraphMarkTrackedMarkers(paragraphXml) {
|
|
194329
|
+
const rPr = paragraphMarkRPrSpan(paragraphXml);
|
|
194330
|
+
if (!rPr)
|
|
194331
|
+
return [];
|
|
194332
|
+
const markers = [];
|
|
194333
|
+
for (const child of childElements(paragraphXml, rPr.contentStart, rPr.contentEnd)) {
|
|
194334
|
+
const localName2 = xmlLocalName(child.qname);
|
|
194335
|
+
if (!child.selfClosing || !MARK_KINDS.has(localName2))
|
|
194336
|
+
continue;
|
|
194337
|
+
markers.push({ kind: localName2, start: child.start, end: child.end });
|
|
194338
|
+
}
|
|
194339
|
+
return markers;
|
|
194340
|
+
}
|
|
194341
|
+
function paragraphMarkHasTrackedMarker(paragraphXml, kind) {
|
|
194342
|
+
return paragraphMarkTrackedMarkers(paragraphXml).some((marker) => marker.kind === kind);
|
|
194343
|
+
}
|
|
194344
|
+
function paragraphMarkRPrSpan(paragraphXml) {
|
|
194345
|
+
const paragraph = readXmlNodeAt(paragraphXml, 0);
|
|
194346
|
+
if (!paragraph || paragraph.kind !== "element" || paragraph.selfClosing)
|
|
194347
|
+
return null;
|
|
194348
|
+
if (xmlLocalName(paragraph.qname) !== "p")
|
|
194349
|
+
return null;
|
|
194350
|
+
const [pPr] = childElements(paragraphXml, paragraph.openEnd, paragraph.closeStart);
|
|
194351
|
+
if (!pPr || pPr.selfClosing || xmlLocalName(pPr.qname) !== "pPr")
|
|
194352
|
+
return null;
|
|
194353
|
+
for (const child of childElements(paragraphXml, pPr.openEnd, pPr.closeStart)) {
|
|
194354
|
+
const localName2 = xmlLocalName(child.qname);
|
|
194355
|
+
if (localName2 === "pPrChange")
|
|
194356
|
+
return null;
|
|
194357
|
+
if (localName2 !== "rPr")
|
|
194358
|
+
continue;
|
|
194359
|
+
return child.selfClosing ? null : { contentStart: child.openEnd, contentEnd: child.closeStart };
|
|
194360
|
+
}
|
|
194361
|
+
return null;
|
|
194362
|
+
}
|
|
194363
|
+
function childElements(xml, from, to) {
|
|
194364
|
+
const children = [];
|
|
194365
|
+
let cursor = from;
|
|
194366
|
+
while (cursor < to) {
|
|
194367
|
+
const next = xml.indexOf("<", cursor);
|
|
194368
|
+
if (next < 0 || next >= to)
|
|
194369
|
+
break;
|
|
194370
|
+
const node2 = readXmlNodeAt(xml, next);
|
|
194371
|
+
if (!node2 || node2.end > to)
|
|
194372
|
+
break;
|
|
194373
|
+
if (node2.kind === "element") {
|
|
194374
|
+
children.push({
|
|
194375
|
+
qname: node2.qname,
|
|
194376
|
+
selfClosing: node2.selfClosing,
|
|
194377
|
+
start: next,
|
|
194378
|
+
openEnd: node2.openEnd,
|
|
194379
|
+
closeStart: node2.closeStart,
|
|
194380
|
+
end: node2.end
|
|
194381
|
+
});
|
|
194382
|
+
}
|
|
194383
|
+
cursor = node2.end;
|
|
194384
|
+
}
|
|
194385
|
+
return children;
|
|
194386
|
+
}
|
|
194387
|
+
var MARK_KINDS;
|
|
194388
|
+
var init_paragraph_mark_markers = __esm(() => {
|
|
194389
|
+
MARK_KINDS = new Set(["ins", "del", "moveFrom", "moveTo"]);
|
|
194390
|
+
});
|
|
194391
|
+
|
|
194316
194392
|
// ../../../v2/editor-core/dist/document/transactions/structural-tracked-carrier-partition.js
|
|
194317
194393
|
function issueStructuralTrackedCarrierPartition(state, input) {
|
|
194318
194394
|
const paragraph = input.paragraph;
|
|
@@ -194344,7 +194420,7 @@ function issueStructuralTrackedCarrierPartition(state, input) {
|
|
|
194344
194420
|
}
|
|
194345
194421
|
if (renderedParagraphs.length !== 2)
|
|
194346
194422
|
return null;
|
|
194347
|
-
const renderedPayloads = renderedParagraphs.map((xml) => inlinePayload(xml, ownership.namespaceBindings, readInline, lineage));
|
|
194423
|
+
const renderedPayloads = renderedParagraphs.map((xml) => inlinePayload(xml, ownership.namespaceBindings, readInline, lineage, input.authoredMarkWordId));
|
|
194348
194424
|
if (!before || resultPayloads.some((payload) => !payload) || JSON.stringify(compactPayload(before)) !== JSON.stringify(compactPayload(resultPayloads.flatMap((payload) => payload))) || renderedPayloads.some((payload) => !payload) || JSON.stringify(compactPayload(renderedPayloads.flatMap((payload) => payload))) !== JSON.stringify(compactPayload(before)) || !proveClosedCommentAnchorPreservation(input.beforeXml, input.afterXml, ownership.namespaceBindings))
|
|
194349
194425
|
return null;
|
|
194350
194426
|
const local = buildTrackedChangeCatalogFromPartXml({
|
|
@@ -194447,8 +194523,18 @@ function metadataKeys(fragments) {
|
|
|
194447
194523
|
customAttributes: fragment3.customAttributes
|
|
194448
194524
|
})))].sort();
|
|
194449
194525
|
}
|
|
194450
|
-
function inlinePayload(xml, namespaces, readInline, lineage = new Map) {
|
|
194451
|
-
|
|
194526
|
+
function inlinePayload(xml, namespaces, readInline, lineage = new Map, authoredMarkWordId) {
|
|
194527
|
+
let payloadXml = xml;
|
|
194528
|
+
if (authoredMarkWordId != null)
|
|
194529
|
+
for (const marker of paragraphMarkTrackedMarkers(xml).reverse()) {
|
|
194530
|
+
const raw = xml.slice(marker.start, marker.end);
|
|
194531
|
+
const node2 = readXmlNodeAt(raw, 0);
|
|
194532
|
+
const prefix = node2?.kind === "element" ? node2.qname.split(":").slice(0, -1).join(":") : "";
|
|
194533
|
+
const ids = [...scanRawXmlAttributes(raw)].filter((attribute2) => attribute2.localName === "id" && namespaces[attribute2.prefix] === NS_W);
|
|
194534
|
+
if (marker.kind === "ins" && namespaces[prefix] === NS_W && ids.length === 1 && ids[0].value === authoredMarkWordId)
|
|
194535
|
+
payloadXml = payloadXml.slice(0, marker.start) + payloadXml.slice(marker.end);
|
|
194536
|
+
}
|
|
194537
|
+
if (/\bxmlns(?:\s|:)/.test(payloadXml.slice(payloadXml.indexOf(">") + 1)))
|
|
194452
194538
|
return null;
|
|
194453
194539
|
const result = [];
|
|
194454
194540
|
const visit = (pieces, wrappers) => {
|
|
@@ -194548,6 +194634,7 @@ var init_structural_tracked_carrier_partition = __esm(() => {
|
|
|
194548
194634
|
init_catalog3();
|
|
194549
194635
|
init_comment_range_invariance();
|
|
194550
194636
|
init_xml_sax();
|
|
194637
|
+
init_paragraph_mark_markers();
|
|
194551
194638
|
issued4 = new WeakMap;
|
|
194552
194639
|
});
|
|
194553
194640
|
|
|
@@ -194845,71 +194932,6 @@ var init_tracked_annotation_history = __esm(() => {
|
|
|
194845
194932
|
groupCapsules = new WeakMap;
|
|
194846
194933
|
});
|
|
194847
194934
|
|
|
194848
|
-
// ../../../v2/editor-core/dist/document/transactions/tracked-changes/paragraph-mark-markers.js
|
|
194849
|
-
function paragraphMarkTrackedMarkers(paragraphXml) {
|
|
194850
|
-
const rPr = paragraphMarkRPrSpan(paragraphXml);
|
|
194851
|
-
if (!rPr)
|
|
194852
|
-
return [];
|
|
194853
|
-
const markers = [];
|
|
194854
|
-
for (const child of childElements(paragraphXml, rPr.contentStart, rPr.contentEnd)) {
|
|
194855
|
-
const localName2 = xmlLocalName(child.qname);
|
|
194856
|
-
if (!child.selfClosing || !MARK_KINDS.has(localName2))
|
|
194857
|
-
continue;
|
|
194858
|
-
markers.push({ kind: localName2, start: child.start, end: child.end });
|
|
194859
|
-
}
|
|
194860
|
-
return markers;
|
|
194861
|
-
}
|
|
194862
|
-
function paragraphMarkHasTrackedMarker(paragraphXml, kind) {
|
|
194863
|
-
return paragraphMarkTrackedMarkers(paragraphXml).some((marker) => marker.kind === kind);
|
|
194864
|
-
}
|
|
194865
|
-
function paragraphMarkRPrSpan(paragraphXml) {
|
|
194866
|
-
const paragraph = readXmlNodeAt(paragraphXml, 0);
|
|
194867
|
-
if (!paragraph || paragraph.kind !== "element" || paragraph.selfClosing)
|
|
194868
|
-
return null;
|
|
194869
|
-
if (xmlLocalName(paragraph.qname) !== "p")
|
|
194870
|
-
return null;
|
|
194871
|
-
const [pPr] = childElements(paragraphXml, paragraph.openEnd, paragraph.closeStart);
|
|
194872
|
-
if (!pPr || pPr.selfClosing || xmlLocalName(pPr.qname) !== "pPr")
|
|
194873
|
-
return null;
|
|
194874
|
-
for (const child of childElements(paragraphXml, pPr.openEnd, pPr.closeStart)) {
|
|
194875
|
-
const localName2 = xmlLocalName(child.qname);
|
|
194876
|
-
if (localName2 === "pPrChange")
|
|
194877
|
-
return null;
|
|
194878
|
-
if (localName2 !== "rPr")
|
|
194879
|
-
continue;
|
|
194880
|
-
return child.selfClosing ? null : { contentStart: child.openEnd, contentEnd: child.closeStart };
|
|
194881
|
-
}
|
|
194882
|
-
return null;
|
|
194883
|
-
}
|
|
194884
|
-
function childElements(xml, from, to) {
|
|
194885
|
-
const children = [];
|
|
194886
|
-
let cursor = from;
|
|
194887
|
-
while (cursor < to) {
|
|
194888
|
-
const next = xml.indexOf("<", cursor);
|
|
194889
|
-
if (next < 0 || next >= to)
|
|
194890
|
-
break;
|
|
194891
|
-
const node2 = readXmlNodeAt(xml, next);
|
|
194892
|
-
if (!node2 || node2.end > to)
|
|
194893
|
-
break;
|
|
194894
|
-
if (node2.kind === "element") {
|
|
194895
|
-
children.push({
|
|
194896
|
-
qname: node2.qname,
|
|
194897
|
-
selfClosing: node2.selfClosing,
|
|
194898
|
-
start: next,
|
|
194899
|
-
openEnd: node2.openEnd,
|
|
194900
|
-
closeStart: node2.closeStart,
|
|
194901
|
-
end: node2.end
|
|
194902
|
-
});
|
|
194903
|
-
}
|
|
194904
|
-
cursor = node2.end;
|
|
194905
|
-
}
|
|
194906
|
-
return children;
|
|
194907
|
-
}
|
|
194908
|
-
var MARK_KINDS;
|
|
194909
|
-
var init_paragraph_mark_markers = __esm(() => {
|
|
194910
|
-
MARK_KINDS = new Set(["ins", "del", "moveFrom", "moveTo"]);
|
|
194911
|
-
});
|
|
194912
|
-
|
|
194913
194935
|
// ../../../v2/editor-core/dist/document/transactions/render-commit-envelope.js
|
|
194914
194936
|
function isParagraphRangeRestore(prepared) {
|
|
194915
194937
|
return prepared.source.kind === "paragraphRangeCollapse" && prepared.source.changeMode === "direct" && prepared.backendExtensions.storySurface?.historyReplay?.direction === "undo";
|
|
@@ -265424,36 +265446,59 @@ var init_list_summary = __esm(() => {
|
|
|
265424
265446
|
|
|
265425
265447
|
// ../../../v2/editor-core/dist/document/internal/review-projection-overlay.js
|
|
265426
265448
|
function buildSDReviewProjectionOverlay(input) {
|
|
265449
|
+
return drainCatalogWork(buildReviewProjectionOverlaySteps(input));
|
|
265450
|
+
}
|
|
265451
|
+
function buildSDReviewProjectionOverlayCooperatively(input, options) {
|
|
265452
|
+
return runCatalogWork(buildReviewProjectionOverlaySteps(input), options);
|
|
265453
|
+
}
|
|
265454
|
+
function* buildReviewProjectionOverlaySteps(input) {
|
|
265427
265455
|
const tableCatalogs = input.tableCatalogs ?? [];
|
|
265428
|
-
const facts =
|
|
265429
|
-
const factsByLogicalId = new Map
|
|
265430
|
-
const
|
|
265431
|
-
|
|
265432
|
-
|
|
265433
|
-
|
|
265434
|
-
|
|
265435
|
-
|
|
265436
|
-
|
|
265437
|
-
|
|
265456
|
+
const facts = [];
|
|
265457
|
+
const factsByLogicalId = new Map;
|
|
265458
|
+
for (const change of input.catalog.logical.byId.values()) {
|
|
265459
|
+
const fact = buildProjectionFact(change, tableCatalogs);
|
|
265460
|
+
facts.push(fact);
|
|
265461
|
+
factsByLogicalId.set(fact.logicalId, fact);
|
|
265462
|
+
yield;
|
|
265463
|
+
}
|
|
265464
|
+
const unsupported2 = [];
|
|
265465
|
+
for (const entries2 of input.catalog.raw.unsupportedByStory.values()) {
|
|
265466
|
+
for (const fact of entries2) {
|
|
265467
|
+
unsupported2.push({
|
|
265468
|
+
kind: "unsupported",
|
|
265469
|
+
storyId: fact.storyId,
|
|
265470
|
+
partUri: fact.partUri,
|
|
265471
|
+
sourceStart: fact.byteStart,
|
|
265472
|
+
sourceEnd: fact.byteEnd,
|
|
265473
|
+
reason: fact.reason
|
|
265474
|
+
});
|
|
265475
|
+
yield;
|
|
265476
|
+
}
|
|
265477
|
+
}
|
|
265478
|
+
const tableIdentities = [];
|
|
265479
|
+
for (const { storyId, tables } of tableCatalogs) {
|
|
265480
|
+
for (const table of tables) {
|
|
265481
|
+
const rows = [];
|
|
265482
|
+
for (const row of table.rows) {
|
|
265483
|
+
const cells = [];
|
|
265484
|
+
for (const cell of row.cells) {
|
|
265485
|
+
cells.push({ cellNodeId: cell.cellNodeId, identityProvenance: cell.identityProvenance });
|
|
265486
|
+
yield;
|
|
265487
|
+
}
|
|
265488
|
+
rows.push({ rowNodeId: row.rowNodeId, identityProvenance: row.identityProvenance, cells });
|
|
265489
|
+
yield;
|
|
265490
|
+
}
|
|
265491
|
+
tableIdentities.push({ storyId, tableNodeId: table.tableNodeId, identityProvenance: table.identityProvenance, rows });
|
|
265492
|
+
yield;
|
|
265493
|
+
}
|
|
265494
|
+
}
|
|
265438
265495
|
return {
|
|
265439
265496
|
replacementMode: input.catalog.logical.replacementMode,
|
|
265440
265497
|
revision: { ...input.revision },
|
|
265441
265498
|
facts,
|
|
265442
265499
|
factsByLogicalId,
|
|
265443
265500
|
unsupported: unsupported2,
|
|
265444
|
-
tableIdentities
|
|
265445
|
-
storyId,
|
|
265446
|
-
tableNodeId: table.tableNodeId,
|
|
265447
|
-
identityProvenance: table.identityProvenance,
|
|
265448
|
-
rows: table.rows.map((row) => ({
|
|
265449
|
-
rowNodeId: row.rowNodeId,
|
|
265450
|
-
identityProvenance: row.identityProvenance,
|
|
265451
|
-
cells: row.cells.map((cell) => ({
|
|
265452
|
-
cellNodeId: cell.cellNodeId,
|
|
265453
|
-
identityProvenance: cell.identityProvenance
|
|
265454
|
-
}))
|
|
265455
|
-
}))
|
|
265456
|
-
})))
|
|
265501
|
+
tableIdentities
|
|
265457
265502
|
};
|
|
265458
265503
|
}
|
|
265459
265504
|
function reviewProjectionRevisionMatches(overlay, revision) {
|
|
@@ -270924,6 +270969,69 @@ function readSDDocumentSessionInternalReviewProjectionOverlay(session, options =
|
|
|
270924
270969
|
})
|
|
270925
270970
|
};
|
|
270926
270971
|
}
|
|
270972
|
+
async function readSDDocumentSessionInternalReviewProjectionOverlayCooperatively(session, yieldPoint) {
|
|
270973
|
+
const internal = INTERNALS.get(session);
|
|
270974
|
+
if (!internal)
|
|
270975
|
+
throw new Error("internal: unknown SDDocumentSession instance");
|
|
270976
|
+
internal.assertNotDisposed();
|
|
270977
|
+
const state = internal.state;
|
|
270978
|
+
const revision = captureReviewProjectionRevision(state);
|
|
270979
|
+
const stale = () => ({
|
|
270980
|
+
status: "stale",
|
|
270981
|
+
expectedPackageRevision: revision.packageRevision,
|
|
270982
|
+
actualPackageRevision: state.packageRevision,
|
|
270983
|
+
expectedRevision: revision,
|
|
270984
|
+
actualRevision: captureReviewProjectionRevision(state)
|
|
270985
|
+
});
|
|
270986
|
+
if (hasFencedMainStory(state) && !hasCurrentTrackedChangeSourceInventory(state)) {
|
|
270987
|
+
return { status: "source-incomplete", revision, reason: "tracked-change-source-inventory-unavailable" };
|
|
270988
|
+
}
|
|
270989
|
+
const superseded = Symbol("review-source-superseded");
|
|
270990
|
+
const replacementMode = internal.trackedChangesReplacementMode;
|
|
270991
|
+
let borrowed = null;
|
|
270992
|
+
const current = () => revisionsEqual(revision, captureReviewProjectionRevision(state)) && (!borrowed || readCurrentTrackedChangeLogicalCatalog(state, replacementMode) === borrowed);
|
|
270993
|
+
const guardedYield = async () => {
|
|
270994
|
+
await yieldPoint();
|
|
270995
|
+
internal.assertNotDisposed();
|
|
270996
|
+
if (!current())
|
|
270997
|
+
throw superseded;
|
|
270998
|
+
};
|
|
270999
|
+
let captured = null;
|
|
271000
|
+
try {
|
|
271001
|
+
await guardedYield();
|
|
271002
|
+
borrowed = readCurrentTrackedChangeLogicalCatalog(state, replacementMode);
|
|
271003
|
+
if (!borrowed)
|
|
271004
|
+
captured = captureCooperativeTrackedCatalogRead(state, replacementMode, internal.assertNotDisposed);
|
|
271005
|
+
let catalog;
|
|
271006
|
+
if (borrowed)
|
|
271007
|
+
catalog = borrowed;
|
|
271008
|
+
else if (captured) {
|
|
271009
|
+
const result = await captured.build({ yieldPoint: guardedYield, sliceTargetMs: 8 });
|
|
271010
|
+
if (!result.promoted)
|
|
271011
|
+
return stale();
|
|
271012
|
+
catalog = result;
|
|
271013
|
+
} else
|
|
271014
|
+
catalog = accessTrackedChangeLogicalCatalog(state, replacementMode);
|
|
271015
|
+
if (!current())
|
|
271016
|
+
return stale();
|
|
271017
|
+
const tableCatalogs = [];
|
|
271018
|
+
for (const storyId of state.storyOrder) {
|
|
271019
|
+
const tables = await getOrBuildTableCatalogForStoryCooperatively(state, storyId, guardedYield);
|
|
271020
|
+
if (!current())
|
|
271021
|
+
return stale();
|
|
271022
|
+
if (tables)
|
|
271023
|
+
tableCatalogs.push({ storyId, tables: tables.tables });
|
|
271024
|
+
}
|
|
271025
|
+
const overlay = await buildSDReviewProjectionOverlayCooperatively({ catalog, tableCatalogs, revision }, { yieldPoint: guardedYield, sliceTargetMs: 8 });
|
|
271026
|
+
return current() ? { status: "success", overlay } : stale();
|
|
271027
|
+
} catch (error48) {
|
|
271028
|
+
if (error48 === superseded)
|
|
271029
|
+
return stale();
|
|
271030
|
+
throw error48;
|
|
271031
|
+
} finally {
|
|
271032
|
+
captured?.release();
|
|
271033
|
+
}
|
|
271034
|
+
}
|
|
270927
271035
|
function captureReviewProjectionRevision(state) {
|
|
270928
271036
|
const inventory = state.trackedChangeSourceInventory;
|
|
270929
271037
|
const currentInventory = inventory && trackedChangeSourceInventoryMatchesState(state, inventory) ? inventory : null;
|
|
@@ -361020,6 +361128,15 @@ var init_numbering2 = __esm(() => {
|
|
|
361020
361128
|
// ../../../v2/document-api-v2-adapter/dist/content-projection/block-numbering.js
|
|
361021
361129
|
function createReviewAwareBlockNumberingProjector(context, storyId, reviewMode) {
|
|
361022
361130
|
const overlayRead = readSDDocumentSessionInternalReviewProjectionOverlay(context.session);
|
|
361131
|
+
return blockNumberingProjector(context, storyId, reviewMode, overlayRead);
|
|
361132
|
+
}
|
|
361133
|
+
async function createReviewAwareBlockNumberingProjectorCooperatively(context, storyId, reviewMode, yieldPoint) {
|
|
361134
|
+
const overlayRead = await readSDDocumentSessionInternalReviewProjectionOverlayCooperatively(context.session, yieldPoint);
|
|
361135
|
+
if (overlayRead.status === "stale")
|
|
361136
|
+
return null;
|
|
361137
|
+
return blockNumberingProjector(context, storyId, reviewMode, overlayRead);
|
|
361138
|
+
}
|
|
361139
|
+
function blockNumberingProjector(context, storyId, reviewMode, overlayRead) {
|
|
361023
361140
|
const boundedEmptyOverlay = overlayRead.status === "source-incomplete";
|
|
361024
361141
|
const overlay = overlayRead.status === "success" ? overlayRead.overlay : emptyReviewProjectionOverlay(getSDDocumentSessionInternalReviewProjectionRevision(context.session));
|
|
361025
361142
|
const model = projectionStyleModel(context);
|
|
@@ -361432,7 +361549,9 @@ async function buildReviewAwareBlockNumberingCooperatively(context, storyId, ind
|
|
|
361432
361549
|
return null;
|
|
361433
361550
|
tableContexts.set(story.storyId, tableContext);
|
|
361434
361551
|
}
|
|
361435
|
-
const projector =
|
|
361552
|
+
const projector = await createReviewAwareBlockNumberingProjectorCooperatively(context, storyId, reviewMode, yieldPoint);
|
|
361553
|
+
if (!projector || !current())
|
|
361554
|
+
return null;
|
|
361436
361555
|
const partUriBytes = new Map;
|
|
361437
361556
|
let ordinal = 0;
|
|
361438
361557
|
for (const source of blockNumberingParagraphs(stories)) {
|
|
@@ -361690,6 +361809,7 @@ class V2BlocksAdapter {
|
|
|
361690
361809
|
this.lastBlocksListStructuralProbe = streamed.probe;
|
|
361691
361810
|
return;
|
|
361692
361811
|
}
|
|
361812
|
+
throw new Error("Block list could not stabilize after cooperative source changes.");
|
|
361693
361813
|
}
|
|
361694
361814
|
list(input) {
|
|
361695
361815
|
const inlineModelDiagnosticsBefore = getParagraphInlineModelAllocationDiagnostics();
|
|
@@ -386713,7 +386833,7 @@ function allocateHeaderFooterUri(context, kind) {
|
|
|
386713
386833
|
}
|
|
386714
386834
|
function emptyHeaderFooterXml(kind, paraId) {
|
|
386715
386835
|
const root = kind === "header" ? "w:hdr" : "w:ftr";
|
|
386716
|
-
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>` + `<${root}${renderRootNamespaceDeclarations()}>` + `<w:p w14:paraId="${paraId}"
|
|
386836
|
+
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>` + `<${root}${renderRootNamespaceDeclarations()}>` + `<w:p w14:paraId="${paraId}"></w:p>` + `</${root}>`;
|
|
386717
386837
|
}
|
|
386718
386838
|
function unsupportedTrackedHeaderFooterMutation() {
|
|
386719
386839
|
return { success: false, failure: {
|
|
@@ -452032,7 +452152,7 @@ function hasPendingOrderChanges(scope) {
|
|
|
452032
452152
|
return true;
|
|
452033
452153
|
if (Object.is(type, scope.meta) && [...keys3].some((key3) => key3?.startsWith(GROUP_PREFIX)))
|
|
452034
452154
|
return true;
|
|
452035
|
-
if (type instanceof YMap && type.parent === scope.blocks && keys3.has(BLOCK_KEY.blockId))
|
|
452155
|
+
if (type instanceof YMap && type.parent === scope.blocks && (keys3.has(BLOCK_KEY.blockId) || keys3.has(BLOCK_KEY.mergedIntoBlockId)))
|
|
452036
452156
|
return true;
|
|
452037
452157
|
}
|
|
452038
452158
|
return false;
|
|
@@ -452059,7 +452179,7 @@ function readRetainedOrder(scope) {
|
|
|
452059
452179
|
retained.byId = null;
|
|
452060
452180
|
};
|
|
452061
452181
|
const blocksChanged = (events) => {
|
|
452062
|
-
if (events.some((event) => event.target === scope.blocks || event.target instanceof YMap && event.keysChanged.has(BLOCK_KEY.blockId)))
|
|
452182
|
+
if (events.some((event) => event.target === scope.blocks || event.target instanceof YMap && (event.keysChanged.has(BLOCK_KEY.blockId) || event.keysChanged.has(BLOCK_KEY.mergedIntoBlockId))))
|
|
452063
452183
|
invalidate();
|
|
452064
452184
|
};
|
|
452065
452185
|
const metadataChanged = (event) => {
|
|
@@ -473563,8 +473683,18 @@ function createCollabV2SessionProjectionController(options) {
|
|
|
473563
473683
|
return backend.preflight ? backend.preflight(prepared) : "unsupported-context";
|
|
473564
473684
|
},
|
|
473565
473685
|
apply(prepared) {
|
|
473566
|
-
if (prepared.source.kind !== "packageReplace")
|
|
473567
|
-
|
|
473686
|
+
if (prepared.source.kind !== "packageReplace") {
|
|
473687
|
+
let result2 = { status: "rejected", rejectedReason: "internal-error" };
|
|
473688
|
+
localBackendSyncDepth += 1;
|
|
473689
|
+
try {
|
|
473690
|
+
options.rootDoc.transact(() => {
|
|
473691
|
+
result2 = storyBackend.apply(prepared);
|
|
473692
|
+
}, STORY_SURFACE_BACKEND_ORIGIN);
|
|
473693
|
+
} finally {
|
|
473694
|
+
localBackendSyncDepth -= 1;
|
|
473695
|
+
}
|
|
473696
|
+
return result2;
|
|
473697
|
+
}
|
|
473568
473698
|
const publish3 = options.preparePackageReplacementPublication?.(prepared);
|
|
473569
473699
|
if (!publish3)
|
|
473570
473700
|
return { status: "rejected", rejectedReason: "unsupported-context" };
|
|
@@ -474577,6 +474707,10 @@ function findAnyPackagePartHandleByUri(projectionRegistry, partUri) {
|
|
|
474577
474707
|
const ownerPartUri2 = String(meta3.get(PACKAGE_PART_META_KEY.ownerPartUri) ?? "");
|
|
474578
474708
|
if (ownerPartUri2 === partUri)
|
|
474579
474709
|
return handle;
|
|
474710
|
+
const paired = meta3.get(PACKAGE_PART_META_KEY.pairedPartKeys);
|
|
474711
|
+
const partKey2 = partUri.replace(/^\/+/, "").replace(/\//g, "_");
|
|
474712
|
+
if (Array.isArray(paired) && paired.some((key3) => typeof key3 === "string" && key3.replace(/^\/+/, "").replace(/\//g, "_") === partKey2))
|
|
474713
|
+
return handle;
|
|
474580
474714
|
}
|
|
474581
474715
|
return null;
|
|
474582
474716
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc/mcp",
|
|
3
|
-
"version": "1.9.0-next.
|
|
3
|
+
"version": "1.9.0-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.22.0-next.
|
|
27
|
+
"@superdoc/sdk": "2.22.0-next.5",
|
|
28
28
|
"debug": "^4.4.3",
|
|
29
29
|
"zod": "^4.3.6"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"superdoc": "2.25.0-next.
|
|
33
|
-
"@superdoc/docx-engine": "0.24.0-next.
|
|
32
|
+
"superdoc": "2.25.0-next.5",
|
|
33
|
+
"@superdoc/docx-engine": "0.24.0-next.5",
|
|
34
34
|
"@superdoc/document-api": "0.1.0-alpha.0",
|
|
35
35
|
"@types/bun": "^1.3.8",
|
|
36
36
|
"@types/node": "22.19.2",
|