@superdoc-dev/mcp 0.2.0-next.2 → 0.2.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 +123 -44
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -48744,10 +48744,10 @@ import { access, readFile, writeFile } from "node:fs/promises";
48744
48744
  import { randomBytes } from "node:crypto";
48745
48745
  import { resolve as resolve3, basename as basename2 } from "node:path";
48746
48746
 
48747
- // ../../packages/superdoc/dist/chunks/src-99Lji-cs.es.js
48747
+ // ../../packages/superdoc/dist/chunks/src-CYnAk7Cg.es.js
48748
48748
  init_rolldown_runtime_B2q5OVn9_es();
48749
- var exports_src_99Lji_cs_es = {};
48750
- __export(exports_src_99Lji_cs_es, {
48749
+ var exports_src_CYnAk7Cg_es = {};
48750
+ __export(exports_src_CYnAk7Cg_es, {
48751
48751
  zt: () => defineMark,
48752
48752
  z: () => cM,
48753
48753
  yt: () => removeAwarenessStates,
@@ -115442,7 +115442,7 @@ if (glo[importIdentifier] === true) {
115442
115442
  }
115443
115443
  glo[importIdentifier] = true;
115444
115444
 
115445
- // ../../packages/superdoc/dist/chunks/src-99Lji-cs.es.js
115445
+ // ../../packages/superdoc/dist/chunks/src-CYnAk7Cg.es.js
115446
115446
  function isNodeType(node2, name) {
115447
115447
  return node2.type.name === name;
115448
115448
  }
@@ -139610,7 +139610,11 @@ var OPERATION_DEFINITIONS = {
139610
139610
  supportsDryRun: false,
139611
139611
  supportsTrackedMode: false,
139612
139612
  possibleFailureCodes: ["INVALID_TARGET", "NO_OP"],
139613
- throws: [...T_NOT_FOUND_COMMAND, "INVALID_TARGET"]
139613
+ throws: [
139614
+ ...T_NOT_FOUND_COMMAND,
139615
+ "INVALID_TARGET",
139616
+ "INVALID_INPUT"
139617
+ ]
139614
139618
  }),
139615
139619
  referenceDocPath: "comments/patch.mdx",
139616
139620
  referenceGroup: "comments"
@@ -139676,7 +139680,11 @@ var OPERATION_DEFINITIONS = {
139676
139680
  supportsDryRun: false,
139677
139681
  supportsTrackedMode: false,
139678
139682
  possibleFailureCodes: ["NO_OP"],
139679
- throws: T_NOT_FOUND_COMMAND
139683
+ throws: [
139684
+ ...T_NOT_FOUND_COMMAND,
139685
+ "INVALID_INPUT",
139686
+ "INVALID_TARGET"
139687
+ ]
139680
139688
  }),
139681
139689
  referenceDocPath: "track-changes/decide.mdx",
139682
139690
  referenceGroup: "trackChanges"
@@ -140668,7 +140676,9 @@ function validateCreateCommentInput(input2) {
140668
140676
  throw new DocumentApiValidationError("INVALID_TARGET", "Cannot combine parentCommentId with target. Replies do not take a target.", { fields: ["parentCommentId", "target"] });
140669
140677
  return;
140670
140678
  }
140671
- if (hasTarget && !isTextAddress(target))
140679
+ if (!hasTarget)
140680
+ throw new DocumentApiValidationError("INVALID_TARGET", "comments.create requires a target for root comments.", { field: "target" });
140681
+ if (!isTextAddress(target))
140672
140682
  throw new DocumentApiValidationError("INVALID_TARGET", "target must be a text address object.", {
140673
140683
  field: "target",
140674
140684
  value: target
@@ -140692,6 +140702,17 @@ function validatePatchCommentInput(input2) {
140692
140702
  field: "commentId",
140693
140703
  value: commentId
140694
140704
  });
140705
+ const mutationFields = [
140706
+ "text",
140707
+ "target",
140708
+ "status",
140709
+ "isInternal"
140710
+ ];
140711
+ const providedFields = mutationFields.filter((f) => input2[f] !== undefined);
140712
+ if (providedFields.length === 0)
140713
+ throw new DocumentApiValidationError("INVALID_INPUT", "comments.patch requires exactly one mutation field (text, target, status, or isInternal).", { allowedFields: [...mutationFields] });
140714
+ if (providedFields.length > 1)
140715
+ throw new DocumentApiValidationError("INVALID_INPUT", `comments.patch accepts exactly one mutation field per call, got ${providedFields.length}: ${providedFields.join(", ")}.`, { providedFields: [...providedFields] });
140695
140716
  const { status } = input2;
140696
140717
  if (status !== undefined && status !== "resolved")
140697
140718
  throw new DocumentApiValidationError("INVALID_TARGET", `status must be "resolved", got "${String(status)}".`, {
@@ -140715,25 +140736,24 @@ function executeCommentsCreate(adapter, input2, options) {
140715
140736
  }
140716
140737
  function executeCommentsPatch(adapter, input2, options) {
140717
140738
  validatePatchCommentInput(input2);
140718
- let lastReceipt = { success: true };
140719
140739
  if (input2.text !== undefined)
140720
- lastReceipt = adapter.edit({
140740
+ return adapter.edit({
140721
140741
  commentId: input2.commentId,
140722
140742
  text: input2.text
140723
140743
  }, options);
140724
140744
  if (input2.target !== undefined)
140725
- lastReceipt = adapter.move({
140745
+ return adapter.move({
140726
140746
  commentId: input2.commentId,
140727
140747
  target: input2.target
140728
140748
  }, options);
140729
140749
  if (input2.status === "resolved")
140730
- lastReceipt = adapter.resolve({ commentId: input2.commentId }, options);
140750
+ return adapter.resolve({ commentId: input2.commentId }, options);
140731
140751
  if (input2.isInternal !== undefined)
140732
- lastReceipt = adapter.setInternal({
140752
+ return adapter.setInternal({
140733
140753
  commentId: input2.commentId,
140734
140754
  isInternal: input2.isInternal
140735
140755
  }, options);
140736
- return lastReceipt;
140756
+ return { success: true };
140737
140757
  }
140738
140758
  function executeCommentsDelete(adapter, input2, options) {
140739
140759
  return adapter.remove({ commentId: input2.commentId }, options);
@@ -141026,16 +141046,38 @@ function executeTrackChangesList(adapter, input2) {
141026
141046
  function executeTrackChangesGet(adapter, input2) {
141027
141047
  return adapter.get(input2);
141028
141048
  }
141029
- function executeTrackChangesDecide(adapter, input2, options) {
141030
- const isAll = "scope" in input2.target && input2.target.scope === "all";
141049
+ function executeTrackChangesDecide(adapter, rawInput, options) {
141050
+ const raw = rawInput;
141051
+ if (typeof raw !== "object" || raw == null)
141052
+ throw new DocumentApiValidationError("INVALID_INPUT", "trackChanges.decide input must be a non-null object.", { value: raw });
141053
+ const input2 = raw;
141054
+ if (input2.decision !== "accept" && input2.decision !== "reject")
141055
+ throw new DocumentApiValidationError("INVALID_INPUT", `trackChanges.decide decision must be "accept" or "reject", got "${String(input2.decision)}".`, {
141056
+ field: "decision",
141057
+ value: input2.decision
141058
+ });
141059
+ if (typeof input2.target !== "object" || input2.target == null)
141060
+ throw new DocumentApiValidationError("INVALID_TARGET", 'trackChanges.decide target must be an object with { id: string } or { scope: "all" }.', {
141061
+ field: "target",
141062
+ value: input2.target
141063
+ });
141064
+ const target = input2.target;
141065
+ const isAll = target.scope === "all";
141066
+ if (!isAll) {
141067
+ if (typeof target.id !== "string" || target.id.length === 0)
141068
+ throw new DocumentApiValidationError("INVALID_TARGET", 'trackChanges.decide target must have { id: string } or { scope: "all" }.', {
141069
+ field: "target",
141070
+ value: input2.target
141071
+ });
141072
+ }
141031
141073
  if (input2.decision === "accept") {
141032
141074
  if (isAll)
141033
141075
  return adapter.acceptAll({}, options);
141034
- return adapter.accept({ id: input2.target.id }, options);
141076
+ return adapter.accept({ id: target.id }, options);
141035
141077
  }
141036
141078
  if (isAll)
141037
141079
  return adapter.rejectAll({}, options);
141038
- return adapter.reject({ id: input2.target.id }, options);
141080
+ return adapter.reject({ id: target.id }, options);
141039
141081
  }
141040
141082
  function buildDispatchTable(api2) {
141041
141083
  return {
@@ -210759,8 +210801,8 @@ function stubFalse() {
210759
210801
  return false;
210760
210802
  }
210761
210803
  var stubFalse_default = stubFalse;
210762
- var freeExports$2 = typeof exports_src_99Lji_cs_es == "object" && exports_src_99Lji_cs_es && !exports_src_99Lji_cs_es.nodeType && exports_src_99Lji_cs_es;
210763
- var freeModule$2 = freeExports$2 && typeof module_src_99Lji_cs_es == "object" && module_src_99Lji_cs_es && !module_src_99Lji_cs_es.nodeType && module_src_99Lji_cs_es;
210804
+ var freeExports$2 = typeof exports_src_CYnAk7Cg_es == "object" && exports_src_CYnAk7Cg_es && !exports_src_CYnAk7Cg_es.nodeType && exports_src_CYnAk7Cg_es;
210805
+ var freeModule$2 = freeExports$2 && typeof module_src_CYnAk7Cg_es == "object" && module_src_CYnAk7Cg_es && !module_src_CYnAk7Cg_es.nodeType && module_src_CYnAk7Cg_es;
210764
210806
  var Buffer$1 = freeModule$2 && freeModule$2.exports === freeExports$2 ? _root_default.Buffer : undefined;
210765
210807
  var isBuffer_default = (Buffer$1 ? Buffer$1.isBuffer : undefined) || stubFalse_default;
210766
210808
  var argsTag$1 = "[object Arguments]";
@@ -210800,8 +210842,8 @@ function baseUnary(func) {
210800
210842
  };
210801
210843
  }
210802
210844
  var _baseUnary_default = baseUnary;
210803
- var freeExports$1 = typeof exports_src_99Lji_cs_es == "object" && exports_src_99Lji_cs_es && !exports_src_99Lji_cs_es.nodeType && exports_src_99Lji_cs_es;
210804
- var freeModule$1 = freeExports$1 && typeof module_src_99Lji_cs_es == "object" && module_src_99Lji_cs_es && !module_src_99Lji_cs_es.nodeType && module_src_99Lji_cs_es;
210845
+ var freeExports$1 = typeof exports_src_CYnAk7Cg_es == "object" && exports_src_CYnAk7Cg_es && !exports_src_CYnAk7Cg_es.nodeType && exports_src_CYnAk7Cg_es;
210846
+ var freeModule$1 = freeExports$1 && typeof module_src_CYnAk7Cg_es == "object" && module_src_CYnAk7Cg_es && !module_src_CYnAk7Cg_es.nodeType && module_src_CYnAk7Cg_es;
210805
210847
  var freeProcess = freeModule$1 && freeModule$1.exports === freeExports$1 && _freeGlobal_default.process;
210806
210848
  var _nodeUtil_default = function() {
210807
210849
  try {
@@ -211182,8 +211224,8 @@ Stack.prototype.get = _stackGet_default;
211182
211224
  Stack.prototype.has = _stackHas_default;
211183
211225
  Stack.prototype.set = _stackSet_default;
211184
211226
  var _Stack_default = Stack;
211185
- var freeExports = typeof exports_src_99Lji_cs_es == "object" && exports_src_99Lji_cs_es && !exports_src_99Lji_cs_es.nodeType && exports_src_99Lji_cs_es;
211186
- var freeModule = freeExports && typeof module_src_99Lji_cs_es == "object" && module_src_99Lji_cs_es && !module_src_99Lji_cs_es.nodeType && module_src_99Lji_cs_es;
211227
+ var freeExports = typeof exports_src_CYnAk7Cg_es == "object" && exports_src_CYnAk7Cg_es && !exports_src_CYnAk7Cg_es.nodeType && exports_src_CYnAk7Cg_es;
211228
+ var freeModule = freeExports && typeof module_src_CYnAk7Cg_es == "object" && module_src_CYnAk7Cg_es && !module_src_CYnAk7Cg_es.nodeType && module_src_CYnAk7Cg_es;
211187
211229
  var Buffer4 = freeModule && freeModule.exports === freeExports ? _root_default.Buffer : undefined;
211188
211230
  var allocUnsafe = Buffer4 ? Buffer4.allocUnsafe : undefined;
211189
211231
  function cloneBuffer(buffer4, isDeep) {
@@ -221201,7 +221243,7 @@ var OPERATION_DEFINITIONS2 = {
221201
221243
  supportsDryRun: false,
221202
221244
  supportsTrackedMode: false,
221203
221245
  possibleFailureCodes: ["INVALID_TARGET", "NO_OP"],
221204
- throws: [...T_NOT_FOUND_COMMAND2, "INVALID_TARGET"]
221246
+ throws: [...T_NOT_FOUND_COMMAND2, "INVALID_TARGET", "INVALID_INPUT"]
221205
221247
  }),
221206
221248
  referenceDocPath: "comments/patch.mdx",
221207
221249
  referenceGroup: "comments"
@@ -221271,7 +221313,7 @@ var OPERATION_DEFINITIONS2 = {
221271
221313
  supportsDryRun: false,
221272
221314
  supportsTrackedMode: false,
221273
221315
  possibleFailureCodes: ["NO_OP"],
221274
- throws: T_NOT_FOUND_COMMAND2
221316
+ throws: [...T_NOT_FOUND_COMMAND2, "INVALID_INPUT", "INVALID_TARGET"]
221275
221317
  }),
221276
221318
  referenceDocPath: "track-changes/decide.mdx",
221277
221319
  referenceGroup: "trackChanges"
@@ -222319,7 +222361,12 @@ function validateCreateCommentInput2(input2) {
222319
222361
  }
222320
222362
  return;
222321
222363
  }
222322
- if (hasTarget && !isTextAddress2(target)) {
222364
+ if (!hasTarget) {
222365
+ throw new DocumentApiValidationError3("INVALID_TARGET", "comments.create requires a target for root comments.", {
222366
+ field: "target"
222367
+ });
222368
+ }
222369
+ if (!isTextAddress2(target)) {
222323
222370
  throw new DocumentApiValidationError3("INVALID_TARGET", "target must be a text address object.", {
222324
222371
  field: "target",
222325
222372
  value: target
@@ -222340,6 +222387,14 @@ function validatePatchCommentInput2(input2) {
222340
222387
  value: commentId
222341
222388
  });
222342
222389
  }
222390
+ const mutationFields = ["text", "target", "status", "isInternal"];
222391
+ const providedFields = mutationFields.filter((f) => input2[f] !== undefined);
222392
+ if (providedFields.length === 0) {
222393
+ throw new DocumentApiValidationError3("INVALID_INPUT", "comments.patch requires exactly one mutation field (text, target, status, or isInternal).", { allowedFields: [...mutationFields] });
222394
+ }
222395
+ if (providedFields.length > 1) {
222396
+ throw new DocumentApiValidationError3("INVALID_INPUT", `comments.patch accepts exactly one mutation field per call, got ${providedFields.length}: ${providedFields.join(", ")}.`, { providedFields: [...providedFields] });
222397
+ }
222343
222398
  const { status } = input2;
222344
222399
  if (status !== undefined && status !== "resolved") {
222345
222400
  throw new DocumentApiValidationError3("INVALID_TARGET", `status must be "resolved", got "${String(status)}".`, {
@@ -222363,20 +222418,19 @@ function executeCommentsCreate2(adapter, input2, options) {
222363
222418
  }
222364
222419
  function executeCommentsPatch2(adapter, input2, options) {
222365
222420
  validatePatchCommentInput2(input2);
222366
- let lastReceipt = { success: true };
222367
222421
  if (input2.text !== undefined) {
222368
- lastReceipt = adapter.edit({ commentId: input2.commentId, text: input2.text }, options);
222422
+ return adapter.edit({ commentId: input2.commentId, text: input2.text }, options);
222369
222423
  }
222370
222424
  if (input2.target !== undefined) {
222371
- lastReceipt = adapter.move({ commentId: input2.commentId, target: input2.target }, options);
222425
+ return adapter.move({ commentId: input2.commentId, target: input2.target }, options);
222372
222426
  }
222373
222427
  if (input2.status === "resolved") {
222374
- lastReceipt = adapter.resolve({ commentId: input2.commentId }, options);
222428
+ return adapter.resolve({ commentId: input2.commentId }, options);
222375
222429
  }
222376
222430
  if (input2.isInternal !== undefined) {
222377
- lastReceipt = adapter.setInternal({ commentId: input2.commentId, isInternal: input2.isInternal }, options);
222431
+ return adapter.setInternal({ commentId: input2.commentId, isInternal: input2.isInternal }, options);
222378
222432
  }
222379
- return lastReceipt;
222433
+ return { success: true };
222380
222434
  }
222381
222435
  function executeCommentsDelete2(adapter, input2, options) {
222382
222436
  return adapter.remove({ commentId: input2.commentId }, options);
@@ -222698,16 +222752,35 @@ function executeTrackChangesList2(adapter, input2) {
222698
222752
  function executeTrackChangesGet2(adapter, input2) {
222699
222753
  return adapter.get(input2);
222700
222754
  }
222701
- function executeTrackChangesDecide2(adapter, input2, options) {
222702
- const isAll = "scope" in input2.target && input2.target.scope === "all";
222755
+ function executeTrackChangesDecide2(adapter, rawInput, options) {
222756
+ const raw = rawInput;
222757
+ if (typeof raw !== "object" || raw == null) {
222758
+ throw new DocumentApiValidationError3("INVALID_INPUT", "trackChanges.decide input must be a non-null object.", {
222759
+ value: raw
222760
+ });
222761
+ }
222762
+ const input2 = raw;
222763
+ if (input2.decision !== "accept" && input2.decision !== "reject") {
222764
+ throw new DocumentApiValidationError3("INVALID_INPUT", `trackChanges.decide decision must be "accept" or "reject", got "${String(input2.decision)}".`, { field: "decision", value: input2.decision });
222765
+ }
222766
+ if (typeof input2.target !== "object" || input2.target == null) {
222767
+ throw new DocumentApiValidationError3("INVALID_TARGET", 'trackChanges.decide target must be an object with { id: string } or { scope: "all" }.', { field: "target", value: input2.target });
222768
+ }
222769
+ const target = input2.target;
222770
+ const isAll = target.scope === "all";
222771
+ if (!isAll) {
222772
+ if (typeof target.id !== "string" || target.id.length === 0) {
222773
+ throw new DocumentApiValidationError3("INVALID_TARGET", 'trackChanges.decide target must have { id: string } or { scope: "all" }.', { field: "target", value: input2.target });
222774
+ }
222775
+ }
222703
222776
  if (input2.decision === "accept") {
222704
222777
  if (isAll)
222705
222778
  return adapter.acceptAll({}, options);
222706
- return adapter.accept({ id: input2.target.id }, options);
222779
+ return adapter.accept({ id: target.id }, options);
222707
222780
  }
222708
222781
  if (isAll)
222709
222782
  return adapter.rejectAll({}, options);
222710
- return adapter.reject({ id: input2.target.id }, options);
222783
+ return adapter.reject({ id: target.id }, options);
222711
222784
  }
222712
222785
 
222713
222786
  // ../../packages/document-api/src/invoke/invoke.ts
@@ -261084,7 +261157,10 @@ function registerTrackChangesTools(server, sessions) {
261084
261157
  }, async ({ session_id, id: id2 }) => {
261085
261158
  try {
261086
261159
  const { api: api2 } = sessions.get(session_id);
261087
- const result = api2.invoke({ operationId: "review.decide", input: { decision: "accept", target: { id: id2 } } });
261160
+ const result = api2.invoke({
261161
+ operationId: "trackChanges.decide",
261162
+ input: { decision: "accept", target: { id: id2 } }
261163
+ });
261088
261164
  return {
261089
261165
  content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
261090
261166
  };
@@ -261106,7 +261182,10 @@ function registerTrackChangesTools(server, sessions) {
261106
261182
  }, async ({ session_id, id: id2 }) => {
261107
261183
  try {
261108
261184
  const { api: api2 } = sessions.get(session_id);
261109
- const result = api2.invoke({ operationId: "review.decide", input: { decision: "reject", target: { id: id2 } } });
261185
+ const result = api2.invoke({
261186
+ operationId: "trackChanges.decide",
261187
+ input: { decision: "reject", target: { id: id2 } }
261188
+ });
261110
261189
  return {
261111
261190
  content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
261112
261191
  };
@@ -261128,7 +261207,7 @@ function registerTrackChangesTools(server, sessions) {
261128
261207
  try {
261129
261208
  const { api: api2 } = sessions.get(session_id);
261130
261209
  const result = api2.invoke({
261131
- operationId: "review.decide",
261210
+ operationId: "trackChanges.decide",
261132
261211
  input: { decision: "accept", target: { scope: "all" } }
261133
261212
  });
261134
261213
  return {
@@ -261152,7 +261231,7 @@ function registerTrackChangesTools(server, sessions) {
261152
261231
  try {
261153
261232
  const { api: api2 } = sessions.get(session_id);
261154
261233
  const result = api2.invoke({
261155
- operationId: "review.decide",
261234
+ operationId: "trackChanges.decide",
261156
261235
  input: { decision: "reject", target: { scope: "all" } }
261157
261236
  });
261158
261237
  return {
@@ -261183,7 +261262,7 @@ function registerCommentTools(server, sessions) {
261183
261262
  const { api: api2 } = sessions.get(session_id);
261184
261263
  const parsed = JSON.parse(target);
261185
261264
  const result = api2.invoke({
261186
- operationId: "comments.add",
261265
+ operationId: "comments.create",
261187
261266
  input: { text: text4, target: parsed }
261188
261267
  });
261189
261268
  return {
@@ -261234,7 +261313,7 @@ function registerCommentTools(server, sessions) {
261234
261313
  try {
261235
261314
  const { api: api2 } = sessions.get(session_id);
261236
261315
  const result = api2.invoke({
261237
- operationId: "comments.reply",
261316
+ operationId: "comments.create",
261238
261317
  input: { parentCommentId: comment_id, text: text4 }
261239
261318
  });
261240
261319
  return {
@@ -261259,8 +261338,8 @@ function registerCommentTools(server, sessions) {
261259
261338
  try {
261260
261339
  const { api: api2 } = sessions.get(session_id);
261261
261340
  const result = api2.invoke({
261262
- operationId: "comments.resolve",
261263
- input: { commentId: comment_id }
261341
+ operationId: "comments.patch",
261342
+ input: { commentId: comment_id, status: "resolved" }
261264
261343
  });
261265
261344
  return {
261266
261345
  content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/mcp",
3
- "version": "0.2.0-next.2",
3
+ "version": "0.2.0-next.3",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc-mcp": "./dist/index.js"