@superdoc-dev/mcp 0.3.0-next.5 → 0.3.0-next.6

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 +202 -24
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -90248,11 +90248,14 @@ var init_contract = __esm(() => {
90248
90248
  oneOf: [
90249
90249
  {
90250
90250
  const: "resolved"
90251
+ },
90252
+ {
90253
+ const: "active"
90251
90254
  }
90252
90255
  ],
90253
- description: "Set comment status. Use 'resolved' to mark as resolved."
90256
+ description: "Set comment status. Use 'resolved' to resolve a comment, or 'active' to reopen a previously resolved comment (lifecycle inverse)."
90254
90257
  },
90255
- description: "Set comment status. Use 'resolved' to mark as resolved."
90258
+ description: "Set comment status. Use 'resolved' to resolve a comment, or 'active' to reopen a previously resolved comment (lifecycle inverse)."
90256
90259
  },
90257
90260
  {
90258
90261
  name: "isInternal",
@@ -90304,9 +90307,10 @@ var init_contract = __esm(() => {
90304
90307
  },
90305
90308
  status: {
90306
90309
  enum: [
90307
- "resolved"
90310
+ "resolved",
90311
+ "active"
90308
90312
  ],
90309
- description: "Set comment status. Use 'resolved' to mark as resolved."
90313
+ description: "Set comment status. Use 'resolved' to resolve a comment, or 'active' to reopen a previously resolved comment (lifecycle inverse)."
90310
90314
  },
90311
90315
  isInternal: {
90312
90316
  type: "boolean",
@@ -204772,7 +204776,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
204772
204776
  emptyOptions2 = {};
204773
204777
  });
204774
204778
 
204775
- // ../../packages/superdoc/dist/chunks/SuperConverter-lmyr0gmB.es.js
204779
+ // ../../packages/superdoc/dist/chunks/SuperConverter-CyrStvpz.es.js
204776
204780
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
204777
204781
  const fieldValue = extension$1.config[field];
204778
204782
  if (typeof fieldValue === "function")
@@ -207559,8 +207563,8 @@ function validatePatchCommentInput(input) {
207559
207563
  field: "text",
207560
207564
  value: text$2
207561
207565
  });
207562
- if (status !== undefined && status !== "resolved")
207563
- throw new DocumentApiValidationError("INVALID_INPUT", `status must be "resolved", got "${String(status)}".`, {
207566
+ if (status !== undefined && status !== "resolved" && status !== "active")
207567
+ throw new DocumentApiValidationError("INVALID_INPUT", `status must be "resolved" or "active", got "${String(status)}".`, {
207564
207568
  field: "status",
207565
207569
  value: status
207566
207570
  });
@@ -207598,6 +207602,8 @@ function executeCommentsPatch(adapter, input, options) {
207598
207602
  }, options);
207599
207603
  if (input.status === "resolved")
207600
207604
  return adapter.resolve({ commentId: input.commentId }, options);
207605
+ if (input.status === "active")
207606
+ return adapter.reopen({ commentId: input.commentId }, options);
207601
207607
  if (input.isInternal !== undefined)
207602
207608
  return adapter.setInternal({
207603
207609
  commentId: input.commentId,
@@ -257177,7 +257183,7 @@ var isRegExp = (value) => {
257177
257183
  state.kern = kernNode.attributes["w:val"];
257178
257184
  }
257179
257185
  }, SuperConverter;
257180
- var init_SuperConverter_lmyr0gmB_es = __esm(() => {
257186
+ var init_SuperConverter_CyrStvpz_es = __esm(() => {
257181
257187
  init_rolldown_runtime_Bg48TavK_es();
257182
257188
  init_jszip_C49i9kUs_es();
257183
257189
  init_xml_js_CqGKpaft_es();
@@ -269627,8 +269633,8 @@ var init_SuperConverter_lmyr0gmB_es = __esm(() => {
269627
269633
  },
269628
269634
  target: textAddressSchema,
269629
269635
  status: {
269630
- enum: ["resolved"],
269631
- description: "Set comment status. Use 'resolved' to mark as resolved."
269636
+ enum: ["resolved", "active"],
269637
+ description: "Set comment status. Use 'resolved' to resolve a comment, or 'active' to reopen a previously resolved comment (lifecycle inverse)."
269632
269638
  },
269633
269639
  isInternal: {
269634
269640
  type: "boolean",
@@ -294776,7 +294782,7 @@ var init_SuperConverter_lmyr0gmB_es = __esm(() => {
294776
294782
  };
294777
294783
  });
294778
294784
 
294779
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-CVKqElqj.es.js
294785
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-JcG-eLAZ.es.js
294780
294786
  function parseSizeUnit(val = "0") {
294781
294787
  const length = val.toString() || "0";
294782
294788
  const value = Number.parseFloat(length);
@@ -297398,8 +297404,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
297398
297404
  }
297399
297405
  };
297400
297406
  };
297401
- var init_create_headless_toolbar_CVKqElqj_es = __esm(() => {
297402
- init_SuperConverter_lmyr0gmB_es();
297407
+ var init_create_headless_toolbar_JcG_eLAZ_es = __esm(() => {
297408
+ init_SuperConverter_CyrStvpz_es();
297403
297409
  init_constants_DrU4EASo_es();
297404
297410
  init_dist_B8HfvhaK_es();
297405
297411
  CSS_DIMENSION_REGEX = /[\d-.]+(\w+)$/;
@@ -351608,7 +351614,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
351608
351614
  init_remark_gfm_BhnWr3yf_es();
351609
351615
  });
351610
351616
 
351611
- // ../../packages/superdoc/dist/chunks/src-B2eovI4l.es.js
351617
+ // ../../packages/superdoc/dist/chunks/src-4pRutOwm.es.js
351612
351618
  function deleteProps(obj, propOrProps) {
351613
351619
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
351614
351620
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -373988,6 +373994,50 @@ function resolveCommentHandler(editor, input2, options) {
373988
373994
  updated: [toCommentAddress(identity.commentId)]
373989
373995
  };
373990
373996
  }
373997
+ function reopenCommentHandler(editor, input2, options) {
373998
+ const reopenComment = requireEditorCommand(editor.commands?.reopenComment, "comments.patch (reopenComment)");
373999
+ const store = getCommentEntityStore(editor);
374000
+ const identity = resolveCommentIdentity(editor, input2.commentId);
374001
+ const existing = findCommentEntity(store, identity.commentId);
374002
+ const isAnchored = identity.anchors.length > 0;
374003
+ const isResolvedInStore = existing ? isCommentResolved(existing) : false;
374004
+ const isResolvedInDoc = isAnchored && identity.anchors.every((a2) => a2.status === "resolved");
374005
+ if (!isResolvedInStore && !isResolvedInDoc)
374006
+ return {
374007
+ success: false,
374008
+ failure: {
374009
+ code: "NO_OP",
374010
+ message: "Comment is already active."
374011
+ }
374012
+ };
374013
+ const storedInternal = existing?.isInternal;
374014
+ const internalOverride = typeof storedInternal === "boolean" ? storedInternal : undefined;
374015
+ if (executeDomainCommand(editor, () => {
374016
+ const didReopen = reopenComment({
374017
+ commentId: identity.commentId,
374018
+ importedId: identity.importedId,
374019
+ internal: internalOverride
374020
+ });
374021
+ if (didReopen)
374022
+ upsertCommentEntity(store, identity.commentId, {
374023
+ importedId: identity.importedId,
374024
+ isDone: false,
374025
+ resolvedTime: null
374026
+ });
374027
+ return Boolean(didReopen);
374028
+ }, { expectedRevision: options?.expectedRevision }).steps[0]?.effect !== "changed")
374029
+ return {
374030
+ success: false,
374031
+ failure: {
374032
+ code: "NO_OP",
374033
+ message: "Comment reopen produced no change."
374034
+ }
374035
+ };
374036
+ return {
374037
+ success: true,
374038
+ updated: [toCommentAddress(identity.commentId)]
374039
+ };
374040
+ }
373991
374041
  function removeCommentHandler(editor, input2, options) {
373992
374042
  const removeComment = requireEditorCommand(editor.commands?.removeComment, "comments.remove (removeComment)");
373993
374043
  const store = getCommentEntityStore(editor);
@@ -374142,6 +374192,7 @@ function createCommentsWrapper(editor) {
374142
374192
  reply: (input2, options) => replyToCommentHandler(editor, input2, options),
374143
374193
  move: (input2, options) => moveCommentHandler(editor, input2, options),
374144
374194
  resolve: (input2, options) => resolveCommentHandler(editor, input2, options),
374195
+ reopen: (input2, options) => reopenCommentHandler(editor, input2, options),
374145
374196
  remove: (input2, options) => removeCommentHandler(editor, input2, options),
374146
374197
  setInternal: (input2, options) => setCommentInternalHandler(editor, input2, options),
374147
374198
  setActive: (input2, options) => setCommentActiveHandler(editor, input2, options),
@@ -416301,6 +416352,75 @@ var Node$13 = class Node$14 {
416301
416352
  });
416302
416353
  dispatch(tr);
416303
416354
  return true;
416355
+ }, getCommentRangeAnchorsById = (commentId, doc$12, importedId) => {
416356
+ const anchors = [];
416357
+ doc$12.descendants((node2, pos) => {
416358
+ const typeName = node2.type?.name;
416359
+ if (typeName !== "commentRangeStart" && typeName !== "commentRangeEnd")
416360
+ return;
416361
+ const wid = node2.attrs?.["w:id"];
416362
+ if (wid !== commentId && (!importedId || wid !== importedId))
416363
+ return;
416364
+ anchors.push({
416365
+ pos,
416366
+ type: typeName === "commentRangeStart" ? "start" : "end",
416367
+ internal: !!node2.attrs?.internal
416368
+ });
416369
+ });
416370
+ const pairs = [];
416371
+ const stack = [];
416372
+ for (const anchor of anchors) {
416373
+ if (anchor.type === "start") {
416374
+ stack.push({
416375
+ pos: anchor.pos,
416376
+ internal: anchor.internal
416377
+ });
416378
+ continue;
416379
+ }
416380
+ const opener = stack.shift();
416381
+ if (!opener)
416382
+ continue;
416383
+ pairs.push({
416384
+ from: opener.pos,
416385
+ to: anchor.pos,
416386
+ internal: opener.internal
416387
+ });
416388
+ }
416389
+ return {
416390
+ pairs,
416391
+ anchorNodePositions: anchors.map((a2) => a2.pos)
416392
+ };
416393
+ }, reopenCommentById = ({ commentId, importedId, internal, state, tr, dispatch }) => {
416394
+ const { schema } = state;
416395
+ const markType = schema.marks?.[CommentMarkName];
416396
+ if (!markType)
416397
+ return false;
416398
+ const { pairs, anchorNodePositions } = getCommentRangeAnchorsById(commentId, state.doc, importedId);
416399
+ if (!pairs.length)
416400
+ return false;
416401
+ pairs.forEach(({ from: from$1, to, internal: anchorInternal }) => {
416402
+ const mappedFrom = tr.mapping.map(from$1);
416403
+ const mappedTo = tr.mapping.map(to);
416404
+ if (mappedTo <= mappedFrom)
416405
+ return;
416406
+ const attrs = {
416407
+ commentId,
416408
+ importedId,
416409
+ internal: typeof internal === "boolean" ? internal : anchorInternal
416410
+ };
416411
+ tr.addMark(mappedFrom + 1, mappedTo, markType.create(attrs));
416412
+ });
416413
+ anchorNodePositions.map((pos) => tr.mapping.map(pos)).sort((a2, b$1) => b$1 - a2).forEach((pos) => {
416414
+ const node2 = tr.doc.nodeAt(pos);
416415
+ if (!node2)
416416
+ return;
416417
+ const typeName = node2.type?.name;
416418
+ if (typeName !== "commentRangeStart" && typeName !== "commentRangeEnd")
416419
+ return;
416420
+ tr.delete(pos, pos + node2.nodeSize);
416421
+ });
416422
+ dispatch(tr);
416423
+ return true;
416304
416424
  }, prepareCommentsForExport = (doc$12, tr, schema, comments = []) => {
416305
416425
  const commentMap = /* @__PURE__ */ new Map;
416306
416426
  comments.forEach((c) => {
@@ -440573,12 +440693,12 @@ menclose::after {
440573
440693
  return;
440574
440694
  console.log(...args$1);
440575
440695
  }, HEADER_FOOTER_INIT_BUDGET_MS = 200, MAX_ZOOM_WARNING_THRESHOLD = 10, MAX_SELECTION_RECTS_PER_USER = 100, SEMANTIC_RESIZE_DEBOUNCE_MS = 120, MIN_SEMANTIC_CONTENT_WIDTH_PX = 1, GLOBAL_PERFORMANCE, PresentationEditor, ICONS, TEXTS, tableActionsOptions;
440576
- var init_src_B2eovI4l_es = __esm(() => {
440696
+ var init_src_4pRutOwm_es = __esm(() => {
440577
440697
  init_rolldown_runtime_Bg48TavK_es();
440578
- init_SuperConverter_lmyr0gmB_es();
440698
+ init_SuperConverter_CyrStvpz_es();
440579
440699
  init_jszip_C49i9kUs_es();
440580
440700
  init_uuid_qzgm05fK_es();
440581
- init_create_headless_toolbar_CVKqElqj_es();
440701
+ init_create_headless_toolbar_JcG_eLAZ_es();
440582
440702
  init_constants_DrU4EASo_es();
440583
440703
  init_dist_B8HfvhaK_es();
440584
440704
  init_unified_Dsuw2be5_es();
@@ -443922,6 +444042,17 @@ ${err.toString()}`);
443922
444042
  dispatch
443923
444043
  });
443924
444044
  },
444045
+ reopenComment: ({ commentId, importedId, internal }) => ({ tr, dispatch, state }) => {
444046
+ tr.setMeta(CommentsPluginKey, { event: "update" });
444047
+ return reopenCommentById({
444048
+ commentId,
444049
+ importedId,
444050
+ internal,
444051
+ state,
444052
+ tr,
444053
+ dispatch
444054
+ });
444055
+ },
443925
444056
  editComment: ({ commentId, importedId, content: content3, text: text5 }) => ({ editor }) => {
443926
444057
  const nextCommentId = commentId ?? importedId;
443927
444058
  if (!nextCommentId)
@@ -463282,6 +463413,7 @@ function print() { __p += __j.call(arguments, '') }
463282
463413
  "editComment",
463283
463414
  "moveComment",
463284
463415
  "resolveComment",
463416
+ "reopenComment",
463285
463417
  "setCommentInternal"
463286
463418
  ],
463287
463419
  "comments.delete": ["removeComment"],
@@ -477475,11 +477607,11 @@ var init_zipper_DbkgrypV_es = __esm(() => {
477475
477607
 
477476
477608
  // ../../packages/superdoc/dist/super-editor.es.js
477477
477609
  var init_super_editor_es = __esm(() => {
477478
- init_src_B2eovI4l_es();
477479
- init_SuperConverter_lmyr0gmB_es();
477610
+ init_src_4pRutOwm_es();
477611
+ init_SuperConverter_CyrStvpz_es();
477480
477612
  init_jszip_C49i9kUs_es();
477481
477613
  init_xml_js_CqGKpaft_es();
477482
- init_create_headless_toolbar_CVKqElqj_es();
477614
+ init_create_headless_toolbar_JcG_eLAZ_es();
477483
477615
  init_constants_DrU4EASo_es();
477484
477616
  init_dist_B8HfvhaK_es();
477485
477617
  init_unified_Dsuw2be5_es();
@@ -488924,7 +489056,10 @@ var init_schemas4 = __esm(() => {
488924
489056
  commentId: { type: "string" },
488925
489057
  text: { type: "string", description: "Updated comment text." },
488926
489058
  target: textAddressSchema2,
488927
- status: { enum: ["resolved"], description: "Set comment status. Use 'resolved' to mark as resolved." },
489059
+ status: {
489060
+ enum: ["resolved", "active"],
489061
+ description: "Set comment status. Use 'resolved' to resolve a comment, or 'active' to reopen a previously resolved comment (lifecycle inverse)."
489062
+ },
488928
489063
  isInternal: {
488929
489064
  type: "boolean",
488930
489065
  description: "When true, marks the comment as internal (hidden from external collaborators)."
@@ -491645,8 +491780,8 @@ function validatePatchCommentInput2(input2) {
491645
491780
  value: text5
491646
491781
  });
491647
491782
  }
491648
- if (status !== undefined && status !== "resolved") {
491649
- throw new DocumentApiValidationError3("INVALID_INPUT", `status must be "resolved", got "${String(status)}".`, {
491783
+ if (status !== undefined && status !== "resolved" && status !== "active") {
491784
+ throw new DocumentApiValidationError3("INVALID_INPUT", `status must be "resolved" or "active", got "${String(status)}".`, {
491650
491785
  field: "status",
491651
491786
  value: status
491652
491787
  });
@@ -491682,6 +491817,9 @@ function executeCommentsPatch2(adapter, input2, options) {
491682
491817
  if (input2.status === "resolved") {
491683
491818
  return adapter.resolve({ commentId: input2.commentId }, options);
491684
491819
  }
491820
+ if (input2.status === "active") {
491821
+ return adapter.reopen({ commentId: input2.commentId }, options);
491822
+ }
491685
491823
  if (input2.isInternal !== undefined) {
491686
491824
  return adapter.setInternal({ commentId: input2.commentId, isInternal: input2.isInternal }, options);
491687
491825
  }
@@ -583598,6 +583736,45 @@ function resolveCommentHandler2(editor, input2, options) {
583598
583736
  }
583599
583737
  return { success: true, updated: [toCommentAddress2(identity.commentId)] };
583600
583738
  }
583739
+ function reopenCommentHandler2(editor, input2, options) {
583740
+ const reopenComment = requireEditorCommand2(editor.commands?.reopenComment, "comments.patch (reopenComment)");
583741
+ const store = getCommentEntityStore2(editor);
583742
+ const identity = resolveCommentIdentity2(editor, input2.commentId);
583743
+ const existing = findCommentEntity2(store, identity.commentId);
583744
+ const isAnchored = identity.anchors.length > 0;
583745
+ const isResolvedInStore = existing ? isCommentResolved2(existing) : false;
583746
+ const isResolvedInDoc = isAnchored && identity.anchors.every((a2) => a2.status === "resolved");
583747
+ if (!isResolvedInStore && !isResolvedInDoc) {
583748
+ return {
583749
+ success: false,
583750
+ failure: { code: "NO_OP", message: "Comment is already active." }
583751
+ };
583752
+ }
583753
+ const storedInternal = existing?.isInternal;
583754
+ const internalOverride = typeof storedInternal === "boolean" ? storedInternal : undefined;
583755
+ const receipt2 = executeDomainCommand2(editor, () => {
583756
+ const didReopen = reopenComment({
583757
+ commentId: identity.commentId,
583758
+ importedId: identity.importedId,
583759
+ internal: internalOverride
583760
+ });
583761
+ if (didReopen) {
583762
+ upsertCommentEntity2(store, identity.commentId, {
583763
+ importedId: identity.importedId,
583764
+ isDone: false,
583765
+ resolvedTime: null
583766
+ });
583767
+ }
583768
+ return Boolean(didReopen);
583769
+ }, { expectedRevision: options?.expectedRevision });
583770
+ if (receipt2.steps[0]?.effect !== "changed") {
583771
+ return {
583772
+ success: false,
583773
+ failure: { code: "NO_OP", message: "Comment reopen produced no change." }
583774
+ };
583775
+ }
583776
+ return { success: true, updated: [toCommentAddress2(identity.commentId)] };
583777
+ }
583601
583778
  function removeCommentHandler2(editor, input2, options) {
583602
583779
  const removeComment = requireEditorCommand2(editor.commands?.removeComment, "comments.remove (removeComment)");
583603
583780
  const store = getCommentEntityStore2(editor);
@@ -583766,6 +583943,7 @@ function createCommentsWrapper2(editor) {
583766
583943
  reply: (input2, options) => replyToCommentHandler2(editor, input2, options),
583767
583944
  move: (input2, options) => moveCommentHandler2(editor, input2, options),
583768
583945
  resolve: (input2, options) => resolveCommentHandler2(editor, input2, options),
583946
+ reopen: (input2, options) => reopenCommentHandler2(editor, input2, options),
583769
583947
  remove: (input2, options) => removeCommentHandler2(editor, input2, options),
583770
583948
  setInternal: (input2, options) => setCommentInternalHandler2(editor, input2, options),
583771
583949
  setActive: (input2, options) => setCommentActiveHandler2(editor, input2, options),
@@ -584921,7 +585099,7 @@ var init_capabilities_adapter = __esm(() => {
584921
585099
  "lists.clearLevelOverrides": [],
584922
585100
  "blocks.delete": ["deleteBlockNodeById"],
584923
585101
  "comments.create": ["addComment", "setTextSelection", "addCommentReply"],
584924
- "comments.patch": ["editComment", "moveComment", "resolveComment", "setCommentInternal"],
585102
+ "comments.patch": ["editComment", "moveComment", "resolveComment", "reopenComment", "setCommentInternal"],
584925
585103
  "comments.delete": ["removeComment"],
584926
585104
  "trackChanges.decide": [
584927
585105
  "acceptTrackedChangeById",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/mcp",
3
- "version": "0.3.0-next.5",
3
+ "version": "0.3.0-next.6",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc-mcp": "./dist/index.js"
@@ -11,8 +11,8 @@
11
11
  "dependencies": {
12
12
  "@modelcontextprotocol/sdk": "^1.26.0",
13
13
  "zod": "^4.3.6",
14
- "@superdoc/document-api": "0.0.1",
15
- "@superdoc-dev/sdk": "1.7.0"
14
+ "@superdoc-dev/sdk": "1.7.0",
15
+ "@superdoc/document-api": "0.0.1"
16
16
  },
17
17
  "devDependencies": {
18
18
  "@types/bun": "^1.3.8",