@superdoc/mcp 1.0.1-next.8 → 1.0.1-next.9

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 +27 -23
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -31314,7 +31314,7 @@ var init_host = __esm(() => {
31314
31314
  });
31315
31315
 
31316
31316
  // ../../packages/sdk/langs/node/src/runtime/sdk-version.generated.ts
31317
- var SDK_VERSION = "2.13.1-next.8";
31317
+ var SDK_VERSION = "2.13.1-next.9";
31318
31318
 
31319
31319
  // ../../packages/sdk/langs/node/src/runtime/embedded-platform.ts
31320
31320
  import { chmodSync, existsSync } from "node:fs";
@@ -81329,7 +81329,6 @@ When formatting newly created content, use the right source:
81329
81329
  - **Do NOT hardcode formatting values.** Always read from blocks data and replicate.
81330
81330
  - **Do NOT copy heading/title formatting onto body paragraphs.** Read from body text blocks (alignment "justify" or "left"), not title blocks.
81331
81331
  - **Pass structured objects, not JSON-encoded strings.** Fields like \`at\`, \`target\`, and \`inline\` expect objects, not serialized JSON strings.
81332
- - **Only pass \`dryRun\` when the action's schema explicitly lists it.** Do not assume every action accepts it. Prefer a real call over a preview for destructive actions unless dryRun is documented for that action.
81333
81332
  - **If blocks still report \`underline: true\` after you explicitly removed it, treat it as a style inheritance artifact.** Do not retry formatting to fix it.
81334
81333
  - **On "Unknown field" errors, drop the unrecognized field and retry.** Use the narrowest working call shape rather than guessing alternative field names.
81335
81334
  - **Table styling crosses two tools.** Borders / shading / cnf flags / spacing are on \`superdoc_table\`; cell-text alignment and font color/weight are on \`superdoc_format\` (paragraph- and run-level). A "style the whole table" pass calls both. See the Tables: cross-tool workflows section for the full recipe.
@@ -81815,7 +81814,6 @@ When formatting newly created content, use the right source:
81815
81814
  - **Do NOT hardcode formatting values.** Always read from blocks data and replicate.
81816
81815
  - **Do NOT copy heading/title formatting onto body paragraphs.** Read from body text blocks (alignment "justify" or "left"), not title blocks.
81817
81816
  - **Pass structured objects, not JSON-encoded strings.** Fields like \`at\`, \`target\`, and \`inline\` expect objects, not serialized JSON strings.
81818
- - **Only pass \`dryRun\` when the action's schema explicitly lists it.** Do not assume every action accepts it. Prefer a real call over a preview for destructive actions unless dryRun is documented for that action.
81819
81817
  - **If blocks still report \`underline: true\` after you explicitly removed it, treat it as a style inheritance artifact.** Do not retry formatting to fix it.
81820
81818
  - **On "Unknown field" errors, drop the unrecognized field and retry.** Use the narrowest working call shape rather than guessing alternative field names.
81821
81819
  - **Table styling crosses two tools.** Borders / shading / cnf flags / spacing are on \`superdoc_table\`; cell-text alignment and font color/weight are on \`superdoc_format\` (paragraph- and run-level). A "style the whole table" pass calls both. See the Tables: cross-tool workflows section for the full recipe.
@@ -90178,17 +90176,14 @@ async function runInsertTableRow(doc2, args) {
90178
90176
  };
90179
90177
  if (args.changeMode)
90180
90178
  insertParams.changeMode = args.changeMode;
90181
- if (args.dryRun === true)
90182
- insertParams.dryRun = true;
90183
90179
  const insertResult = await insertFn(insertParams);
90184
90180
  const executed = [
90185
90181
  {
90186
90182
  operationId: "doc.tables.insertRow",
90187
- result: insertResult,
90188
- rationale: args.dryRun === true ? "Preview only; no document mutation applied." : undefined
90183
+ result: insertResult
90189
90184
  }
90190
90185
  ];
90191
- if (args.dryRun !== true && args.cellTexts && args.cellTexts.length > 0) {
90186
+ if (args.cellTexts && args.cellTexts.length > 0) {
90192
90187
  const insertedRowIndex = position === "below" ? rowIndex + 1 : rowIndex;
90193
90188
  const cells = args.cellTexts.map((cell, columnIndex) => cellTextFromSpec(cell, insertedRowIndex, columnIndex));
90194
90189
  const applied = await applyTableCellTexts(doc2, table.nodeId, table.ordinal, cells, args.changeMode);
@@ -90217,17 +90212,17 @@ async function runInsertTableRow(doc2, args) {
90217
90212
  const postIdentity = await readDocumentIdentity(doc2);
90218
90213
  const postTable = await getTableShape2(doc2, table.nodeId);
90219
90214
  const verification = [
90220
- revisionVerification(preIdentity.revision, postIdentity.revision, args.dryRun !== true)
90215
+ revisionVerification(preIdentity.revision, postIdentity.revision, true)
90221
90216
  ];
90222
90217
  if (postTable) {
90223
90218
  verification.push({
90224
90219
  check: {
90225
90220
  kind: "table-shape",
90226
90221
  nodeId: table.nodeId,
90227
- rows: args.dryRun === true ? table.rows : table.rows + 1,
90222
+ rows: table.rows + 1,
90228
90223
  columns: table.columns
90229
90224
  },
90230
- passed: postTable.rows === (args.dryRun === true ? table.rows : table.rows + 1) && postTable.columns === table.columns
90225
+ passed: postTable.rows === table.rows + 1 && postTable.columns === table.columns
90231
90226
  });
90232
90227
  }
90233
90228
  return {
@@ -92297,8 +92292,7 @@ async function dispatchSuperdocPerformAction(doc2, args) {
92297
92292
  rowIndex: rowIndex != null && Number.isInteger(rowIndex) && rowIndex >= 0 ? rowIndex : undefined,
92298
92293
  position,
92299
92294
  cellTexts: cellTexts ?? undefined,
92300
- changeMode: parseChangeMode4(args.changeMode),
92301
- dryRun: args.dryRun === true
92295
+ changeMode: parseChangeMode4(args.changeMode)
92302
92296
  });
92303
92297
  }
92304
92298
  case "insert_table_column": {
@@ -92964,10 +92958,10 @@ var init_actions = __esm(() => {
92964
92958
  trackedOverrideReason: "The V2 TOC adapter guarantees native tracked creation."
92965
92959
  },
92966
92960
  insert_table_row: {
92967
- hint: "tableOrdinal?, rowIndex?, position?: before|after|above|below, cellTexts? (one per column; each a plain string OR a STYLED {runs, marks?} cell to reproduce the table's cell formatting), changeMode?, dryRun? — to match existing cell styling, inspect the table with includeTableCellRuns:true first, then style each new cell HERE. PLACEMENT: when the user does not say WHERE the row goes, append it after the LAST existing row (rowIndex = last row's index, position: below); never pick a middle position on your own",
92961
+ hint: "tableOrdinal?, rowIndex?, position?: before|after|above|below, cellTexts? (one per column; each a plain string OR a STYLED {runs, marks?} cell to reproduce the table's cell formatting), changeMode? — to match existing cell styling, inspect the table with includeTableCellRuns:true first, then style each new cell HERE. PLACEMENT: when the user does not say WHERE the row goes, append it after the LAST existing row (rowIndex = last row's index, position: below); never pick a middle position on your own",
92968
92962
  group: "Table edits",
92969
92963
  groupOrder: 3,
92970
- args: ["tableOrdinal", "rowIndex", "position", "cellTexts", "changeMode", "dryRun"],
92964
+ args: ["tableOrdinal", "rowIndex", "position", "cellTexts", "changeMode"],
92971
92965
  operations: ["tables.insertRow"]
92972
92966
  },
92973
92967
  insert_table_column: {
@@ -93472,7 +93466,6 @@ var init_catalog = __esm(() => {
93472
93466
  rowIndex: { type: "number" },
93473
93467
  columnIndex: { type: "number" },
93474
93468
  position: { type: "string" },
93475
- dryRun: { type: "boolean" },
93476
93469
  headerText: { type: "string" },
93477
93470
  separatorText: { type: "string" },
93478
93471
  anchorText: { type: "string" },
@@ -94405,7 +94398,7 @@ ACTIONS (superdoc_perform_action with flat args)
94405
94398
  - move_table: tableOrdinal? (default 1), placement {at:"document_end"|"document_start"|"after"|"before", selector?}. THE way to move a whole table in ONE call — never delete-and-recreate or chain inserts/undos to relocate a table. changeMode:"tracked" records the move for review.
94406
94399
  - delete_table: tableOrdinal? (default 1), changeMode?. THE way to delete an entire table in ONE call — never delete rows one by one or reuse another table.
94407
94400
  - style_table: tableOrdinal? (default 1), accentColor? (header fill hex). ONE call makes a table look professional: accent header row with white bold text, bold first column, banded rows, clean borders. Use after create_table or on any existing table. changeMode:"tracked" records the formatting for review.
94408
- - insert_table_row: tableOrdinal (1-based), rowIndex (0-based; omit to append), position:"above"|"below", optional cellTexts. dryRun:true for preview.
94401
+ - insert_table_row: tableOrdinal (1-based), rowIndex (0-based; omit to append), position:"above"|"below", optional cellTexts.
94409
94402
  - insert_table_column: tableOrdinal, columnIndex (0-based; omit to append right), position:"left"|"right", optional headerText.
94410
94403
  - delete_table_row / delete_table_column: rowIndex or columnIndex required, tableOrdinal optional.
94411
94404
  - split_table: tableOrdinal, rowIndex (>=1), optional separatorText.
@@ -94434,7 +94427,7 @@ OPERATING RULES
94434
94427
  - For anchored rewrites or multi-term edits, prefer textSearch selectors over copied nodeIds. For clause text inside tables, use a tableCell selector with replace_text.
94435
94428
  - For tab-indented headings, replace only the visible text with replace_text (rewrite_block can delete the tab node).
94436
94429
  - For BULK or PATTERN transforms (every percentage, every date), use ONE replace_text call with multiple edits. For bulk FORMATTING ("bold all the dates"): read the matching texts first, then ONE format_text call with targetTexts.
94437
- - For preview-only requests ("show what it would look like", "don't save"), pass dryRun:true and make NO other mutating call; describe the preview from the receipt.
94430
+ - For preview-only requests ("show what it would look like", "don't save"), make NO mutating call — read the document with superdoc_inspect and describe the change in your answer. If they want to SEE it in the document before it is final, make the edit with changeMode:"tracked" so it lands as a reviewable suggestion they can accept or reject — but only on an action that records tracked changes; for an action marked Direct edit, describe the change instead of making it.
94438
94431
  - Pure count questions: superdoc_inspect countsOnly:true, then stop. Use includeDomains to keep snapshots small.
94439
94432
  - Do not include doc or sessionId in tool args. Never rely on benchmark routing, eval metadata, or fixture names.
94440
94433
  - If the runtime truly cannot express the request, say what is missing instead of faking success.
@@ -94507,9 +94500,16 @@ function validateAgentToolArgs(toolName, args) {
94507
94500
  const knownKeys = new Set(Object.keys(properties));
94508
94501
  const unknownKeys = Object.keys(args).filter((key) => !knownKeys.has(key));
94509
94502
  if (unknownKeys.length > 0) {
94510
- throw new SuperDocCliError(`Unknown argument(s) for ${toolName}: ${unknownKeys.join(", ")}`, {
94503
+ const retiredKeys = unknownKeys.filter((key) => Object.hasOwn(RETIRED_ACTION_ARGS, key));
94504
+ const message = retiredKeys.length > 0 ? retiredKeys.map((key) => RETIRED_ACTION_ARGS[key]).join(" ") : `Unknown argument(s) for ${toolName}: ${unknownKeys.join(", ")}`;
94505
+ throw new SuperDocCliError(message, {
94511
94506
  code: "INVALID_ARGUMENT",
94512
- details: { toolName, unknownKeys, knownKeys: [...knownKeys] }
94507
+ details: {
94508
+ toolName,
94509
+ unknownKeys,
94510
+ knownKeys: [...knownKeys],
94511
+ ...retiredKeys.length > 0 ? { retiredKeys } : {}
94512
+ }
94513
94513
  });
94514
94514
  }
94515
94515
  const missingKeys = required2.filter((key) => args[key] == null);
@@ -94873,7 +94873,7 @@ async function coreDispatch(documentHandle, toolName, args, invokeOptions) {
94873
94873
  details: { toolName, preset: "core" }
94874
94874
  });
94875
94875
  }
94876
- var MODULE_DIR2, PROMPT_DIR_CANDIDATES, _actionsOnlyPromptCache = null, _mcpPromptCache = null, RECEIPT_LIST_CAP = 8, EXECUTE_CODE_SPEC, SENTENCE_BOUNDARY, ENFORCEMENT_SIDE_DOORS, POLICY_OPTION_KEYS, corePreset;
94876
+ var MODULE_DIR2, PROMPT_DIR_CANDIDATES, _actionsOnlyPromptCache = null, _mcpPromptCache = null, RETIRED_ACTION_ARGS, RECEIPT_LIST_CAP = 8, EXECUTE_CODE_SPEC, SENTENCE_BOUNDARY, ENFORCEMENT_SIDE_DOORS, POLICY_OPTION_KEYS, corePreset;
94877
94877
  var init_core3 = __esm(() => {
94878
94878
  init_errors4();
94879
94879
  init_debug_trace();
@@ -94883,6 +94883,9 @@ var init_core3 = __esm(() => {
94883
94883
  init_embedded_prompts_generated();
94884
94884
  MODULE_DIR2 = path5.dirname(fileURLToPath4(import.meta.url));
94885
94885
  PROMPT_DIR_CANDIDATES = [path5.resolve(MODULE_DIR2, "..", "prompts"), path5.resolve(MODULE_DIR2, "prompts")];
94886
+ RETIRED_ACTION_ARGS = {
94887
+ dryRun: "dryRun is not supported by superdoc_perform_action: no action previews a mutation. To make an edit reviewable before it is final, pass changeMode: 'tracked' on an action that records tracked changes; to take one back, use the undo_changes action."
94888
+ };
94886
94889
  EXECUTE_CODE_SPEC = {
94887
94890
  operationId: "doc.executeCode",
94888
94891
  commandTokens: ["execute", "code"],
@@ -328904,9 +328907,10 @@ function rawProperties(prXml) {
328904
328907
  }
328905
328908
  function extractText3(xml) {
328906
328909
  let out = "";
328907
- const re = /<w:t\b[^>]*>([\s\S]*?)<\/w:t>/g;
328910
+ const re = /<w:t\b[^>]*?(?:\/>|>([\s\S]*?)<\/w:t>)/g;
328908
328911
  for (let match = re.exec(xml);match; match = re.exec(xml)) {
328909
- out += decodeXmlEntities(match[1]);
328912
+ if (match[1] !== undefined)
328913
+ out += decodeXmlEntities(match[1]);
328910
328914
  }
328911
328915
  return out;
328912
328916
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc/mcp",
3
- "version": "1.0.1-next.8",
3
+ "version": "1.0.1-next.9",
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.13.1-next.8",
27
+ "@superdoc/sdk": "2.13.1-next.9",
28
28
  "debug": "^4.4.3",
29
29
  "zod": "^4.3.6"
30
30
  },
31
31
  "devDependencies": {
32
- "superdoc": "2.16.1-next.8",
33
- "@superdoc/docx-engine": "0.15.1-next.8",
32
+ "superdoc": "2.16.1-next.9",
33
+ "@superdoc/docx-engine": "0.15.1-next.9",
34
34
  "@superdoc/document-api": "0.1.0-alpha.0",
35
35
  "@types/bun": "^1.3.8",
36
36
  "@types/node": "22.19.2",