@superdoc/mcp 1.6.0-next.5 → 1.6.0-next.7

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 +75 -14
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -31443,7 +31443,7 @@ var init_host = __esm(() => {
31443
31443
  });
31444
31444
 
31445
31445
  // ../../packages/sdk/langs/node/src/runtime/sdk-version.generated.ts
31446
- var SDK_VERSION = "2.19.0-next.5";
31446
+ var SDK_VERSION = "2.19.0-next.7";
31447
31447
 
31448
31448
  // ../../packages/sdk/langs/node/src/runtime/embedded-platform.ts
31449
31449
  import { accessSync, chmodSync, constants, existsSync, statSync } from "node:fs";
@@ -194891,12 +194891,15 @@ function compileParsedOverlapEdit(input, tokens, descendedEditableContainers) {
194891
194891
  if (commented.length > 0) {
194892
194892
  const parent = commented[0].token;
194893
194893
  const following = touched.filter((entry) => entry.token.kind === "plain");
194894
- const collapsedInsertion = commented.length === 1 && wrappers.length === 1 && input.changeMode === "tracked" && input.newText.length > 0 && input.rangeStart === input.rangeEnd && input.rangeStart > parent.visibleStart && input.rangeStart < parent.visibleEnd;
194895
- if (!collapsedInsertion && (commented.length !== 1 || wrappers.length !== 1 || following.length !== 1 || following[0].token.byteStart < parent.byteEnd || input.changeMode !== "tracked" || input.newText.length === 0 || input.rangeStart <= parent.visibleStart || input.rangeStart >= parent.visibleEnd || input.rangeEnd <= parent.visibleEnd || input.rangeEnd > following[0].token.visibleEnd)) {
194894
+ const collapsedInsertion = commented.length === 1 && wrappers.length === 1 && input.changeMode === "tracked" && input.newText.length > 0 && input.rangeStart === input.rangeEnd && input.rangeStart >= parent.visibleStart && input.rangeStart <= parent.visibleEnd;
194895
+ const partialDeletion = commented.length === 1 && wrappers.length === 1 && input.changeMode === "tracked" && input.newText.length === 0 && input.rangeStart >= parent.visibleStart && input.rangeEnd <= parent.visibleEnd && input.rangeStart < input.rangeEnd && input.rangeEnd - input.rangeStart < parent.inner.text.length;
194896
+ if (collapsedInsertion && (input.rangeStart === parent.visibleStart || input.rangeStart === parent.visibleEnd))
194897
+ return insertBesideCommentedInsertion(input, parent);
194898
+ if (!collapsedInsertion && !partialDeletion && (commented.length !== 1 || wrappers.length !== 1 || following.length !== 1 || following[0].token.byteStart < parent.byteEnd || input.changeMode !== "tracked" || input.newText.length === 0 || input.rangeStart <= parent.visibleStart || input.rangeStart >= parent.visibleEnd || input.rangeEnd <= parent.visibleEnd || input.rangeEnd > following[0].token.visibleEnd)) {
194896
194899
  return {
194897
194900
  ok: false,
194898
194901
  reason: "text-range-in-unsupported-tracked-wrapper",
194899
- detail: "overlap compiler: comment-bearing insertion requires bounded tracked typing or spanning replacement."
194902
+ detail: "overlap compiler: comment-bearing insertion requires bounded tracked typing, partial deletion, or spanning replacement."
194900
194903
  };
194901
194904
  }
194902
194905
  }
@@ -196199,6 +196202,29 @@ function closeFreshInsertionScope(xml, source, destination) {
196199
196202
  return null;
196200
196203
  return closeNamespaceScope(xml.slice(0, wrapper.openEnd) + inner + xml.slice(wrapper.closeStart), source, destination, { referencedOnly: true });
196201
196204
  }
196205
+ function insertBesideCommentedInsertion(input, parent) {
196206
+ const before = input.rangeStart === parent.visibleStart;
196207
+ const offset = before ? 0 : parent.inner.text.length;
196208
+ const meta3 = runMetaAtInsertionPoint(parent, offset);
196209
+ const fresh = buildInsWrapperXml({
196210
+ nsPrefix: parent.nsPrefix,
196211
+ wId: String(resolveNextWId(input)),
196212
+ author: { name: input.currentAuthor.name, initials: input.currentAuthor.initials ?? null, email: input.currentAuthor.email ?? null },
196213
+ date: input.txTimestamp,
196214
+ rsidR: input.insRsid,
196215
+ inner: { ...meta3, rPr: rPrAtInsertionPoint(parent, offset), text: input.newText }
196216
+ });
196217
+ const closed = closeFreshInsertionScope(fresh, Object.fromEntries(parent.namespaceBindings), input.namespaceBindings ?? {});
196218
+ if (closed == null)
196219
+ return { ok: false, reason: "text-range-in-unsupported-tracked-wrapper" };
196220
+ const boundary = before ? parent.byteStart : parent.byteEnd;
196221
+ return {
196222
+ ok: true,
196223
+ xml: input.paragraphXml.slice(0, boundary) + closed + input.paragraphXml.slice(boundary),
196224
+ emittedRsids: [input.insRsid],
196225
+ requiresCollaborationSessionSync: true
196226
+ };
196227
+ }
196202
196228
  function splitInsertionAroundChildChange(input, allTokens, parent) {
196203
196229
  const nestedDeletions = parent.nestedDeletions ?? [];
196204
196230
  const rawLocalStart = input.rangeStart - parent.visibleStart;
@@ -196252,7 +196278,7 @@ function splitInsertionAroundChildChange(input, allTokens, parent) {
196252
196278
  const hasTailFragment = tailText.length > 0 || tailOwnedNested.length > 0;
196253
196279
  const emitsTrailingParentFragment = hasTailFragment || removedText.length > 0 && input.newText.length > 0;
196254
196280
  const tailParentWId = input.changeMode === "tracked" && input.newText.length > 0 && hasHeadFragment && emitsTrailingParentFragment ? allocateFreshWId() : parent.wId;
196255
- const liftComment = parent.commentedBoundary && input.rangeStart === input.rangeEnd && input.changeMode === "tracked" && input.newText.length > 0 && parent._classification !== "same-user";
196281
+ const liftComment = parent.commentedBoundary && input.changeMode === "tracked" && (input.rangeStart === input.rangeEnd && input.newText.length > 0 || removedText.length > 0 && input.newText.length === 0) && parent._classification !== "same-user";
196256
196282
  const headInsXml = hasHeadFragment ? buildInsWrapperXml({
196257
196283
  openTag: parent.openTag,
196258
196284
  namespaceBindings: parent.namespaceBindings,
@@ -212527,6 +212553,28 @@ function collectStandaloneCommentWIds(state) {
212527
212553
  return out;
212528
212554
  }
212529
212555
  function preserveAdjacentEndBoundaryWIdsForDroppedRange(input) {
212556
+ if (input.decision === "reject" && input.fragment.kind === "ins") {
212557
+ const markerIndex = input.markerIndex ?? buildCommentMarkerIndex(input.partXml);
212558
+ const preserved2 = new Set(input.defaultWIds);
212559
+ for (const wId of input.defaultWIds) {
212560
+ const markers = markerIndex.allByWId.get(wId) ?? [];
212561
+ if (markers.length !== 3)
212562
+ continue;
212563
+ const start = markers.find((marker) => marker.kind === "commentRangeStart");
212564
+ const end = markers.find((marker) => marker.kind === "commentRangeEnd");
212565
+ const reference = markers.find((marker) => marker.kind === "commentReference");
212566
+ if (!start || !end || !reference || start.byteEnd > input.droppedRange.startInXml || end.byteStart < input.droppedRange.endInXml || reference.byteStart < end.byteEnd) {
212567
+ continue;
212568
+ }
212569
+ const before = input.partXml.slice(start.byteEnd, input.droppedRange.startInXml);
212570
+ const after = input.partXml.slice(input.droppedRange.endInXml, end.byteStart);
212571
+ const opening = /^\s*<([\w.-]+):ins\b(?:[^"'<>]|"[^"]*"|'[^']*')*>\s*$/.exec(before);
212572
+ const closing = /^\s*<\/([\w.-]+):ins\s*>\s*$/.exec(after);
212573
+ if (opening && closing && opening[1] === closing[1])
212574
+ preserved2.delete(wId);
212575
+ }
212576
+ return preserved2;
212577
+ }
212530
212578
  if (input.decision !== "accept" || input.fragment.kind !== "del" || isSessionCreatedTextFragment(input.fragment, input.sessionCreatedTrackedChangeRsids, input.sessionCreatedTrackedChangeWIds)) {
212531
212579
  return input.defaultWIds;
212532
212580
  }
@@ -251730,11 +251778,10 @@ async function streamingSavePackageToSink(entries, sink) {
251730
251778
  largestOutputChunkBytes: metrics.largestOutputChunkBytes
251731
251779
  };
251732
251780
  }
251733
- var STREAM_PUSH_CHUNK, STREAMING_SAVE_ZIP_ENTRY_MTIME;
251781
+ var STREAM_PUSH_CHUNK, STREAMING_SAVE_ZIP_ENTRY_MTIME = "1980-01-01T00:00:00";
251734
251782
  var init_large_streaming_save = __esm(() => {
251735
251783
  init_esm2();
251736
251784
  STREAM_PUSH_CHUNK = 64 * 1024;
251737
- STREAMING_SAVE_ZIP_ENTRY_MTIME = new Date(1980, 0, 1, 0, 0, 0);
251738
251785
  });
251739
251786
 
251740
251787
  // ../../../v2/editor-core/dist/document/transactions/comment-export-normalization.js
@@ -257453,7 +257500,7 @@ async function waitForQueuedPreScan(controller, cancel) {
257453
257500
  }
257454
257501
  return outcome.value;
257455
257502
  }
257456
- var SAVE_XML_DECODER, SAVE_XML_ENCODER, PACKAGE_BINDING_TEXT_ENCODER, WORD_XML_PART_RE, REVIEW_SOURCE_COPY_CHUNK_BYTES, INTERNALS, LIVE_MAIN_STORY_SCAN_MEMO, RELS_DECODER, DEFAULT_SAVE_COMPRESSION_LEVEL = 6, SAVE_ZIP_ENTRY_MTIME, EMPTY_PART_URI_SET, ALREADY_COMPRESSED_PART_RE, RAW_FONT_PART_RE, RSID_ATTR_FOR_FINGERPRINT_RE, SIMPLE_TRACKED_CHANGE_WRAPPER_OPEN_RE, WRAPPER_ID_ATTR_FOR_FINGERPRINT_RE, SDSourceBackedSaveUnsupportedError, REMOTE_PROJECTION_GENERATIONS, COLLABORATION_ATTACHMENTS, FIELD_STABLE_ID_ALLOCATORS;
257503
+ var SAVE_XML_DECODER, SAVE_XML_ENCODER, PACKAGE_BINDING_TEXT_ENCODER, WORD_XML_PART_RE, REVIEW_SOURCE_COPY_CHUNK_BYTES, INTERNALS, LIVE_MAIN_STORY_SCAN_MEMO, RELS_DECODER, DEFAULT_SAVE_COMPRESSION_LEVEL = 6, SAVE_ZIP_ENTRY_MTIME = "1980-01-01T00:00:00", EMPTY_PART_URI_SET, ALREADY_COMPRESSED_PART_RE, RAW_FONT_PART_RE, RSID_ATTR_FOR_FINGERPRINT_RE, SIMPLE_TRACKED_CHANGE_WRAPPER_OPEN_RE, WRAPPER_ID_ATTR_FOR_FINGERPRINT_RE, SDSourceBackedSaveUnsupportedError, REMOTE_PROJECTION_GENERATIONS, COLLABORATION_ATTACHMENTS, FIELD_STABLE_ID_ALLOCATORS;
257457
257504
  var init_sd_document_session = __esm(() => {
257458
257505
  init_textbox_atom_replacement();
257459
257506
  init_paragraph_signal_index();
@@ -257526,7 +257573,6 @@ var init_sd_document_session = __esm(() => {
257526
257573
  INTERNALS = new WeakMap;
257527
257574
  LIVE_MAIN_STORY_SCAN_MEMO = new WeakMap;
257528
257575
  RELS_DECODER = new TextDecoder("utf-8", { fatal: false });
257529
- SAVE_ZIP_ENTRY_MTIME = new Date(1980, 0, 1, 0, 0, 0);
257530
257576
  EMPTY_PART_URI_SET = new Set;
257531
257577
  ALREADY_COMPRESSED_PART_RE = /\.(png|jpe?g|gif|webp|bmp|ico|tiff?|emf|wmf|mp3|mp4|m4a|mov|avi|wmv|ogg|zip|gz|woff2?|eot)$/i;
257532
257578
  RAW_FONT_PART_RE = /\.(ttf|otf|odttf)$/i;
@@ -286308,8 +286354,13 @@ function toCssFontFamily(fontName, options = {}) {
286308
286354
  if (!fontName || typeof fontName !== "string")
286309
286355
  return fontName;
286310
286356
  let trimmed = fontName.trim();
286311
- if (!trimmed || trimmed.includes(","))
286357
+ if (!trimmed)
286312
286358
  return trimmed;
286359
+ const explicitParts = normalizeParts(trimmed);
286360
+ if (explicitParts.length > 1) {
286361
+ const serialized = explicitParts.map(serializeFamily);
286362
+ return serialized.every((part, i2) => part === explicitParts[i2]) ? trimmed : serialized.join(", ");
286363
+ }
286313
286364
  if (trimmed.toLowerCase() === INHERITED_FONT_FAMILY)
286314
286365
  return;
286315
286366
  if (trimmed.includes(";")) {
@@ -286320,15 +286371,16 @@ function toCssFontFamily(fontName, options = {}) {
286320
286371
  const fixedPitch = typeof pitch === "string" && pitch.trim().toLowerCase() === "fixed";
286321
286372
  const fallbackValue = fallback ?? (fixedPitch ? "monospace" : undefined) ?? (family !== "auto" && Object.hasOwn(FONT_FAMILY_FALLBACKS, family) ? mapWordFamilyFallback(family) : undefined) ?? inferGenericFallbackFromFontName(trimmed);
286322
286373
  const fallbackParts = normalizeParts(fallbackValue);
286374
+ const primaryParts = normalizeParts(trimmed);
286323
286375
  if (fallbackParts.length === 0) {
286324
- return trimmed;
286376
+ return primaryParts.map(serializeFamily).join(", ");
286325
286377
  }
286326
286378
  const normalizedName = trimmed.toLowerCase();
286327
286379
  const includesName = fallbackParts.some((part) => part.toLowerCase() === normalizedName);
286328
286380
  if (includesName) {
286329
- return fallbackParts.join(", ");
286381
+ return fallbackParts.map(serializeFamily).join(", ");
286330
286382
  }
286331
- return [trimmed, ...fallbackParts].join(", ");
286383
+ return [...primaryParts, ...fallbackParts].map(serializeFamily).join(", ");
286332
286384
  }
286333
286385
  var FONT_FAMILY_FALLBACKS, DEFAULT_GENERIC_FALLBACK = "sans-serif", INHERITED_FONT_FAMILY = "inherit", SERIF_LIKE_FONTS, normalizeFontNameForLookup = (fontName) => {
286334
286386
  if (!fontName || typeof fontName !== "string")
@@ -286339,7 +286391,7 @@ var FONT_FAMILY_FALLBACKS, DEFAULT_GENERIC_FALLBACK = "sans-serif", INHERITED_FO
286339
286391
  if (MONOSPACE_FONTS.has(name))
286340
286392
  return "monospace";
286341
286393
  return SERIF_LIKE_FONTS.has(name) ? "serif" : DEFAULT_GENERIC_FALLBACK;
286342
- }, normalizeParts = (value) => (value || "").split(",").map((part) => part.trim()).filter(Boolean), splitOutsideQuotes = (str, delimiter) => {
286394
+ }, normalizeParts = (value) => splitOutsideQuotes(value || "", ","), splitOutsideQuotes = (str, delimiter) => {
286343
286395
  if (!str.includes('"') && !str.includes("'")) {
286344
286396
  return str.split(delimiter).map((p) => p.trim()).filter(Boolean);
286345
286397
  }
@@ -286374,6 +286426,14 @@ var FONT_FAMILY_FALLBACKS, DEFAULT_GENERIC_FALLBACK = "sans-serif", INHERITED_FO
286374
286426
  if (current.trim())
286375
286427
  parts.push(current.trim());
286376
286428
  return parts;
286429
+ }, CSS_IDENTIFIER, serializeFamily = (family) => {
286430
+ const first = family[0];
286431
+ if ((first === '"' || first === "'") && family.endsWith(first))
286432
+ return family;
286433
+ if (family.split(/\s+/).every((part) => CSS_IDENTIFIER.test(part)))
286434
+ return family;
286435
+ const escaped = family.replace(/["\\\x00-\x1f\x7f]/g, (char) => char === '"' || char === "\\" ? `\\${char}` : `\\${char.codePointAt(0).toString(16)} `);
286436
+ return `"${escaped}"`;
286377
286437
  }, CSS_GENERIC_FAMILIES;
286378
286438
  var init_font_utils = __esm(() => {
286379
286439
  FONT_FAMILY_FALLBACKS = Object.freeze({
@@ -286414,6 +286474,7 @@ var init_font_utils = __esm(() => {
286414
286474
  "dejavu sans mono",
286415
286475
  "source code pro"
286416
286476
  ]);
286477
+ CSS_IDENTIFIER = /^(?:--|-?(?:[a-zA-Z_]|[^\x00-\x7f]))(?:[a-zA-Z0-9_-]|[^\x00-\x7f])*$/;
286417
286478
  CSS_GENERIC_FAMILIES = new Set([
286418
286479
  "serif",
286419
286480
  "sans-serif",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc/mcp",
3
- "version": "1.6.0-next.5",
3
+ "version": "1.6.0-next.7",
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.19.0-next.5",
27
+ "@superdoc/sdk": "2.19.0-next.7",
28
28
  "debug": "^4.4.3",
29
29
  "zod": "^4.3.6"
30
30
  },
31
31
  "devDependencies": {
32
- "superdoc": "2.22.0-next.5",
33
- "@superdoc/docx-engine": "0.21.0-next.5",
32
+ "superdoc": "2.22.0-next.7",
33
+ "@superdoc/docx-engine": "0.21.0-next.7",
34
34
  "@superdoc/document-api": "0.1.0-alpha.0",
35
35
  "@types/bun": "^1.3.8",
36
36
  "@types/node": "22.19.2",