@superdoc/mcp 1.10.1-next.3 → 1.10.1-next.4

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.
Files changed (2) hide show
  1. package/dist/index.js +58 -10
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -31630,7 +31630,7 @@ var init_host = __esm(() => {
31630
31630
  });
31631
31631
 
31632
31632
  // ../../packages/sdk/langs/node/src/runtime/sdk-version.generated.ts
31633
- var SDK_VERSION = "2.23.1-next.3";
31633
+ var SDK_VERSION = "2.23.1-next.4";
31634
31634
 
31635
31635
  // ../../packages/sdk/langs/node/src/runtime/embedded-platform.ts
31636
31636
  import { accessSync, chmodSync, constants, existsSync, statSync } from "node:fs";
@@ -159805,7 +159805,7 @@ function readResidentReviewComponent(state, mode, sourceIds, includeCoordinates
159805
159805
  cached2.lookupContext.dispose();
159806
159806
  }
159807
159807
  if (component.wrapped.length <= 2 * 1024 * 1024) {
159808
- while (review.selectionCatalogs.size >= 64 || review.componentCharacters + component.wrapped.length > 2 * 1024 * 1024) {
159808
+ while (review.selectionCatalogs.size >= 512 || review.componentCharacters + component.wrapped.length > 2 * 1024 * 1024) {
159809
159809
  const oldest = review.selectionCatalogs.entries().next().value;
159810
159810
  if (!oldest)
159811
159811
  break;
@@ -400614,6 +400614,7 @@ class V2TrackedChangesAdapter {
400614
400614
  this.context = context;
400615
400615
  this.supportsCommentRetention = true;
400616
400616
  this.reviewReadCache = null;
400617
+ this.reviewSnapshotWork = { discoveryItemBuilds: 0, discoveryItemReuses: 0, residentReads: 0, fullViewReads: 0 };
400617
400618
  this.discoveryIdentity = null;
400618
400619
  this.retainedDiscoveryItems = new Map;
400619
400620
  this.residentProjectionViews = new WeakMap;
@@ -400677,12 +400678,21 @@ class V2TrackedChangesAdapter {
400677
400678
  readReviewProjectionIdentity() {
400678
400679
  return readSDDocumentSessionInternalCurrentTrackedChangeLogicalCatalog(this.context.session, resolveReplacementMode(this.context.trackedChangesReplacementMode))?.reviewProjectionIdentity ?? null;
400679
400680
  }
400681
+ readReviewSnapshotWork(reset = false) {
400682
+ const work = { ...this.reviewSnapshotWork };
400683
+ if (reset)
400684
+ for (const counter of Object.keys(this.reviewSnapshotWork))
400685
+ this.reviewSnapshotWork[counter] = 0;
400686
+ return work;
400687
+ }
400680
400688
  readLeanDiscoveryItemsForReviewSnapshotBatch(requests) {
400681
400689
  const residentViews = new Map;
400682
400690
  const discoveryItems = new Map;
400683
400691
  const frame = { validatedCache: null, readLimit: Math.min(128, Math.max(32, requests.length * 2)) };
400692
+ this.readReviewSnapshotWork(true);
400684
400693
  const allIds = [...new Set(requests.flatMap((request) => [...request.requestedIds]))];
400685
400694
  if (readSDDocumentSessionInternalCurrentTrackedChangeLogicalCatalog(this.context.session, resolveReplacementMode(this.context.trackedChangesReplacementMode))) {
400695
+ this.reviewSnapshotWork.fullViewReads += 1;
400686
400696
  const current = this.buildView();
400687
400697
  for (const id of allIds)
400688
400698
  residentViews.set(id, current);
@@ -400800,6 +400810,13 @@ class V2TrackedChangesAdapter {
400800
400810
  requestedByAlias.set(alias, requested);
400801
400811
  }
400802
400812
  let fullView;
400813
+ const readFullView = () => {
400814
+ if (!fullView) {
400815
+ this.reviewSnapshotWork.fullViewReads += 1;
400816
+ fullView = this.buildView();
400817
+ }
400818
+ return fullView;
400819
+ };
400803
400820
  const storyFilter = story ? resolveStoryFilter(story, this.context.session) : undefined;
400804
400821
  const structuralScope = source?.structuralOwner ? resolveReviewSnapshotStructuralScope(this.context, source, storyFilter) : undefined;
400805
400822
  const paragraphScope2 = source?.paragraphOwner ? resolveReviewSnapshotParagraphScope(this.context, source, storyFilter) : undefined;
@@ -400843,6 +400860,7 @@ class V2TrackedChangesAdapter {
400843
400860
  orderedRequestedIds.push(id);
400844
400861
  let view = residentViews.get(id) ?? fullView;
400845
400862
  if (!view) {
400863
+ this.reviewSnapshotWork.residentReads += 1;
400846
400864
  const resident = this.readResidentProjectionView([reviewSnapshotMoveSideId(id)?.id ?? id]);
400847
400865
  if (resident) {
400848
400866
  view = resident;
@@ -400865,12 +400883,12 @@ class V2TrackedChangesAdapter {
400865
400883
  residentViews.set(requested, resident);
400866
400884
  }
400867
400885
  } else
400868
- view = fullView ?? (fullView = this.buildView());
400886
+ view = readFullView();
400869
400887
  }
400870
400888
  const localEntry = reviewSnapshotMoveSideId(id) ? null : getLocalTrackedTextEntry(this.context, id);
400871
400889
  let entry = localEntry && (!storyFilter || logicalEntryMatchesStoryFilter(localEntry, storyFilter)) && reviewSnapshotEntryMatchesSource(localEntry, sourceFilter, id) ? localEntry : resolve2(view, id);
400872
400890
  if (!entry && view !== fullView && [...view.logical.byId.values()].every((candidate2) => source?.partUri && candidate2.partUri !== source.partUri || storyFilter && !logicalEntryMatchesStoryFilter(candidate2, storyFilter))) {
400873
- view = fullView ?? (fullView = this.buildView());
400891
+ view = readFullView();
400874
400892
  entry = resolve2(view, id);
400875
400893
  }
400876
400894
  if (!entry) {
@@ -400893,11 +400911,13 @@ class V2TrackedChangesAdapter {
400893
400911
  }
400894
400912
  let item = itemsByEntry.get(entry) ?? (identity ? this.retainedDiscoveryItems.get(entry.id) : undefined);
400895
400913
  if (!item) {
400914
+ this.reviewSnapshotWork.discoveryItemBuilds += 1;
400896
400915
  item = buildDiscoveryItem2(entry, this.context, view.logical, undefined, resolveSession);
400897
400916
  itemsByEntry.set(entry, item);
400898
400917
  if (identity)
400899
400918
  this.retainedDiscoveryItems.set(entry.id, item);
400900
- }
400919
+ } else if (!itemsByEntry.has(entry))
400920
+ this.reviewSnapshotWork.discoveryItemReuses += 1;
400901
400921
  reviewSnapshotOrder.set(item, { storyId: entry.storyId, start: entry.documentOrderStart });
400902
400922
  items.push(item);
400903
400923
  }
@@ -414508,6 +414528,32 @@ function projectionDiagnostic(input) {
414508
414528
  function sortProjectionDiagnostics(diagnostics) {
414509
414529
  return [...diagnostics].sort((left, right) => diagnosticKey(left).localeCompare(diagnosticKey(right)));
414510
414530
  }
414531
+ function createProjectionDiagnosticLookup(diagnostics) {
414532
+ const codes2 = new Map;
414533
+ let indexedThrough = 0;
414534
+ return (diagnostic2) => {
414535
+ while (indexedThrough < diagnostics.length) {
414536
+ const candidate2 = diagnostics[indexedThrough++];
414537
+ const { blockId: blockId2, range: range2 } = candidate2.source;
414538
+ if (Number.isNaN(range2?.start) || Number.isNaN(range2?.end))
414539
+ continue;
414540
+ let blocks = codes2.get(candidate2.code);
414541
+ if (!blocks)
414542
+ codes2.set(candidate2.code, blocks = new Map);
414543
+ let starts = blocks.get(blockId2);
414544
+ if (!starts)
414545
+ blocks.set(blockId2, starts = new Map);
414546
+ let ends = starts.get(range2?.start);
414547
+ if (!ends)
414548
+ starts.set(range2?.start, ends = new Set);
414549
+ ends.add(range2?.end);
414550
+ }
414551
+ const { blockId, range } = diagnostic2.source;
414552
+ if (Number.isNaN(range?.start) || Number.isNaN(range?.end))
414553
+ return false;
414554
+ return codes2.get(diagnostic2.code)?.get(blockId)?.get(range?.start)?.has(range?.end) ?? false;
414555
+ };
414556
+ }
414511
414557
  async function sortProjectionDiagnosticsCooperatively(diagnostics, sliceGate) {
414512
414558
  let source = [];
414513
414559
  for (const diagnostic2 of diagnostics) {
@@ -415622,6 +415668,7 @@ function prepareProjectionBuild(context, input, supplied) {
415622
415668
  imageNamespaces: projectionStoryRootNamespaceBindings(context, resolved),
415623
415669
  imageTargets: supplied?.imageTargets ?? sourceExternalTargets(projectionPartBytes(context, ownerRelationshipsPartUri(resolved.partUri)), "image"),
415624
415670
  diagnostics,
415671
+ hasDiagnostic: createProjectionDiagnosticLookup(diagnostics),
415625
415672
  visibleToTracked,
415626
415673
  paragraphTrackedRanges: new Map,
415627
415674
  progress: { storyTrackedCursor: 0 },
@@ -415687,7 +415734,8 @@ function visitProjectionParagraph(state, paragraph4) {
415687
415734
  styleModel,
415688
415735
  resolvedParagraphProperties,
415689
415736
  tableInfo,
415690
- diagnostics
415737
+ diagnostics,
415738
+ hasDiagnostic: state.hasDiagnostic
415691
415739
  }));
415692
415740
  const bookmarks = standaloneHorizontalRule ? [] : tokenRead.bookmarks.filter((bookmark) => trackedWrappersAreEmitted(bookmark.trackedWrappers, reviewMode)).map((bookmark) => ({ name: bookmark.name, offset: bookmark.offset }));
415693
415741
  const blockDiagnostics = [];
@@ -417192,7 +417240,7 @@ function projectToken(input) {
417192
417240
  changeIds,
417193
417241
  commentIds
417194
417242
  });
417195
- if (!input.diagnostics.some((candidate2) => candidate2.code === diagnostic2.code && candidate2.source.blockId === diagnostic2.source.blockId && candidate2.source.range?.start === diagnostic2.source.range?.start && candidate2.source.range?.end === diagnostic2.source.range?.end))
417243
+ if (!input.hasDiagnostic(diagnostic2))
417196
417244
  input.diagnostics.push(diagnostic2);
417197
417245
  }
417198
417246
  const referenceField = hyperlink && "classification" in hyperlink.descriptor && (hyperlink.descriptor.classification === "ref" || hyperlink.descriptor.classification === "pageRef");
@@ -421903,7 +421951,7 @@ function provePlainBlockHasNoHyperlink(context, query3) {
421903
421951
  return null;
421904
421952
  }
421905
421953
  const prefix2 = bytes.subarray(0, paragraph4.byteStart);
421906
- if (!bytesContainAsciiToken(prefix2, FLD_CHAR_TOKEN)) {
421954
+ if (!bytesContainAsciiToken(prefix2, ONLY_TOKEN_THAT_CAN_OPEN_A_FIELD_ACROSS_PARAGRAPHS)) {
421907
421955
  return { storyId: body.storyId, partUri: body.partUri };
421908
421956
  }
421909
421957
  const prefixXml = TD114.decode(prefix2);
@@ -422321,7 +422369,7 @@ function escapeRegex13(value3) {
422321
422369
  function defaultRelationshipsXml2() {
422322
422370
  return '<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>';
422323
422371
  }
422324
- var HYPERLINK_REL_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", TD114, TE65, FLD_CHAR_TOKEN;
422372
+ var HYPERLINK_REL_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", TD114, TE65, ONLY_TOKEN_THAT_CAN_OPEN_A_FIELD_ACROSS_PARAGRAPHS;
422325
422373
  var init_adapter21 = __esm(() => {
422326
422374
  init_applied_change_mode();
422327
422375
  init_sd_document_session_internal();
@@ -422339,7 +422387,7 @@ var init_adapter21 = __esm(() => {
422339
422387
  init_registry3();
422340
422388
  TD114 = new TextDecoder;
422341
422389
  TE65 = new TextEncoder;
422342
- FLD_CHAR_TOKEN = Uint8Array.from("fldChar", (char) => char.charCodeAt(0));
422390
+ ONLY_TOKEN_THAT_CAN_OPEN_A_FIELD_ACROSS_PARAGRAPHS = Uint8Array.from("fldChar", (char) => char.charCodeAt(0));
422343
422391
  });
422344
422392
 
422345
422393
  // ../../../v2/document-api-v2-adapter/dist/images/pending-image-insertion.js
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc/mcp",
3
- "version": "1.10.1-next.3",
3
+ "version": "1.10.1-next.4",
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.23.1-next.3",
27
+ "@superdoc/sdk": "2.23.1-next.4",
28
28
  "debug": "^4.4.3",
29
29
  "zod": "^4.3.6"
30
30
  },
31
31
  "devDependencies": {
32
- "superdoc": "2.26.1-next.3",
33
- "@superdoc/docx-engine": "0.25.1-next.3",
32
+ "superdoc": "2.26.1-next.4",
33
+ "@superdoc/docx-engine": "0.25.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",