@superdoc/mcp 1.13.0-next.2 → 1.13.0-next.3

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 +42 -8
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -31654,7 +31654,7 @@ var init_host = __esm(() => {
31654
31654
  });
31655
31655
 
31656
31656
  // ../../packages/sdk/langs/node/src/runtime/sdk-version.generated.ts
31657
- var SDK_VERSION = "2.26.0-next.2";
31657
+ var SDK_VERSION = "2.26.0-next.3";
31658
31658
 
31659
31659
  // ../../packages/sdk/langs/node/src/runtime/embedded-platform.ts
31660
31660
  import { accessSync, chmodSync, constants, existsSync, statSync } from "node:fs";
@@ -188307,13 +188307,13 @@ function prepareNativeTrackedCatalogPublication(state, group) {
188307
188307
  return true;
188308
188308
  } };
188309
188309
  }
188310
- function prepareTrackedChangeParagraphScanMaintenance(state, partUri, beforePayload, patches) {
188310
+ function prepareTrackedChangeParagraphScanMaintenance(state, partUri, beforePayload, patches, residentEdit) {
188311
188311
  const previousRevision = state.parts.get(partUri)?.descriptor.revision;
188312
188312
  const scan = asPartScanCacheEntry(state.partRegistries.get(TRACKED_CHANGE_PART_SCAN_REGISTRY_KEY))?.byPart.get(partUri);
188313
188313
  if (!previousRevision || scan?.revision !== previousRevision || patches.length !== 1)
188314
188314
  return null;
188315
188315
  const original = scan.scan;
188316
- if (original.hasTextboxContent || original.unsupported.length)
188316
+ if (original.unsupported.length)
188317
188317
  return null;
188318
188318
  if (original.fragments.some((fragment3) => !fragment3.wId || fragment3.byteStart < 0 || fragment3.sourceByteStart < 0 || fragment3.storyTrackedTextStart < 0))
188319
188319
  return null;
@@ -188578,7 +188578,9 @@ function prepareTrackedChangeParagraphScanMaintenance(state, partUri, beforePayl
188578
188578
  }
188579
188579
  return xml.slice(cursor).trim() ? null : total;
188580
188580
  };
188581
- const previousTrackedLength = trackedLength(beforeXml), currentTrackedLength = trackedLength(afterXml);
188581
+ const residentWindowEdit = residentEdit && last === low && residentEdit.before.partUri === partUri && residentEdit.before.blockId === paragraph.blockId && residentEdit.after.blockId === paragraph.blockId && residentEdit.before.model.paragraphXml === beforeXml && residentEdit.after.model.paragraphXml === afterXml ? residentEdit : null;
188582
+ const previousTrackedLength = residentWindowEdit ? residentWindowEdit.before.model.trackedLength : trackedLength(beforeXml);
188583
+ const currentTrackedLength = residentWindowEdit ? residentWindowEdit.after.model.trackedLength : trackedLength(afterXml);
188582
188584
  if (previousTrackedLength == null || currentTrackedLength == null)
188583
188585
  return null;
188584
188586
  const trackedDelta = currentTrackedLength - previousTrackedLength;
@@ -202838,11 +202840,12 @@ function applyPatchGroupAtomicUnlocked(state, group, options = {}) {
202838
202840
  return rejectedKernel("invalid-input");
202839
202841
  }
202840
202842
  }
202843
+ const residentTextEdit = readSDResidentTextEdit(group);
202841
202844
  const trackedScanMaintenance = staged.flatMap((item) => {
202842
202845
  if (!item.beforePayload || !item.normalizedPatches)
202843
202846
  return [];
202844
202847
  try {
202845
- const install = prepareTrackedChangeParagraphScanMaintenance(state, item.partUri, item.beforePayload, item.normalizedPatches);
202848
+ const install = prepareTrackedChangeParagraphScanMaintenance(state, item.partUri, item.beforePayload, item.normalizedPatches, residentTextEdit);
202846
202849
  return install ? [install] : [];
202847
202850
  } catch {
202848
202851
  return [];
@@ -290995,6 +290998,13 @@ function getSDDocumentSessionInternalAuthor(session) {
290995
290998
  throw new Error("internal: unknown SDDocumentSession instance");
290996
290999
  return internal.author;
290997
291000
  }
291001
+ function setSDDocumentSessionInternalAuthor(session, author) {
291002
+ const internal = INTERNALS.get(session);
291003
+ if (!internal)
291004
+ throw new Error("internal: unknown SDDocumentSession instance");
291005
+ internal.assertNotDisposed();
291006
+ internal.author = author ? { ...author } : null;
291007
+ }
290998
291008
  function resolveSDDocumentSessionInternalAuthorInitials(session, authorName) {
290999
291009
  const internal = INTERNALS.get(session);
291000
291010
  if (!internal)
@@ -349256,8 +349266,25 @@ function settingsPackageUpdates(context, currentXml3, nextXml) {
349256
349266
  updates[CONTENT_TYPES_PART_URI14] = encodeXml(nextTypes);
349257
349267
  return updates;
349258
349268
  }
349269
+ function copyProtectionState(state) {
349270
+ return {
349271
+ editingRestriction: { ...state.editingRestriction },
349272
+ writeProtection: { ...state.writeProtection },
349273
+ readOnlyRecommended: state.readOnlyRecommended
349274
+ };
349275
+ }
349259
349276
  function projectProtectionStateFromSettings(settingsXml) {
349260
- const parsed = settingsXml ? parseSettings(settingsXml) : null;
349277
+ if (!settingsXml)
349278
+ return projectProtectionStateFromParsedSettings(null);
349279
+ if (lastProjectedSettings?.xml !== settingsXml) {
349280
+ lastProjectedSettings = {
349281
+ xml: settingsXml,
349282
+ state: projectProtectionStateFromParsedSettings(parseSettings(settingsXml))
349283
+ };
349284
+ }
349285
+ return copyProtectionState(lastProjectedSettings.state);
349286
+ }
349287
+ function projectProtectionStateFromParsedSettings(parsed) {
349261
349288
  const documentProtection = parsed?.find("documentProtection");
349262
349289
  const writeProtection = parsed?.find("writeProtection");
349263
349290
  const readOnlyRecommended = Boolean(parsed?.find("readOnlyRecommended"));
@@ -349412,7 +349439,7 @@ function emptySettingsXml(namespace) {
349412
349439
  "</w:settings>"
349413
349440
  ].join("");
349414
349441
  }
349415
- var SETTINGS_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings", SETTINGS_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml", WORD_NAMESPACE10 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", STRICT_WORD_NAMESPACE2 = "http://purl.oclc.org/ooxml/wordprocessingml/main", WORD_NAMESPACES3, STRICT_SETTINGS_REL_TYPE = "http://purl.oclc.org/ooxml/officeDocument/relationships/settings", SETTINGS_REL_TYPES, SETTINGS_BEFORE_PROTECTION, PASSWORD_VERIFIER_ATTRS, VALID_EDIT_MODES;
349442
+ var SETTINGS_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings", SETTINGS_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml", WORD_NAMESPACE10 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", STRICT_WORD_NAMESPACE2 = "http://purl.oclc.org/ooxml/wordprocessingml/main", WORD_NAMESPACES3, STRICT_SETTINGS_REL_TYPE = "http://purl.oclc.org/ooxml/officeDocument/relationships/settings", SETTINGS_REL_TYPES, SETTINGS_BEFORE_PROTECTION, PASSWORD_VERIFIER_ATTRS, VALID_EDIT_MODES, lastProjectedSettings = null;
349416
349443
  var init_adapter5 = __esm(() => {
349417
349444
  init_src3();
349418
349445
  init_sd_document_session_internal();
@@ -429804,7 +429831,13 @@ function createV2AdapterContext(session, options = {}) {
429804
429831
  },
429805
429832
  trackedChangesReplacementMode,
429806
429833
  permissionResolver: options.permissionResolver,
429807
- currentUser: resolvedCurrentUser,
429834
+ get currentUser() {
429835
+ return resolvedCurrentUser;
429836
+ },
429837
+ setUser(user) {
429838
+ setSDDocumentSessionInternalAuthor(session, user);
429839
+ resolvedCurrentUser = { id: user.id ?? null, name: user.name, email: user.email ?? null };
429840
+ },
429808
429841
  get fieldContext() {
429809
429842
  ensureHistoryGeneration();
429810
429843
  return fieldContext;
@@ -471205,6 +471238,7 @@ function createV2DocumentApiHost(session, options = {}) {
471205
471238
  return receipt3;
471206
471239
  },
471207
471240
  currentPublicRevision: () => context.currentPublicRevision(),
471241
+ setUser: (user) => context.setUser(user),
471208
471242
  beginRenderCommitCapture: () => context.beginRenderCommitCapture(),
471209
471243
  beginRenderSnapshot: (id) => {
471210
471244
  const binding = beginSDDocumentSessionInternalRenderSnapshot(session, id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc/mcp",
3
- "version": "1.13.0-next.2",
3
+ "version": "1.13.0-next.3",
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.26.0-next.2",
27
+ "@superdoc/sdk": "2.26.0-next.3",
28
28
  "debug": "^4.4.3",
29
29
  "zod": "^4.3.6"
30
30
  },
31
31
  "devDependencies": {
32
- "superdoc": "2.29.0-next.2",
33
- "@superdoc/docx-engine": "0.28.0-next.2",
32
+ "superdoc": "2.29.0-next.3",
33
+ "@superdoc/docx-engine": "0.28.0-next.3",
34
34
  "@superdoc/document-api": "0.1.0-alpha.0",
35
35
  "@types/bun": "^1.3.8",
36
36
  "@types/node": "22.19.2",