@superdoc-dev/mcp 0.3.0-next.76 → 0.3.0-next.78

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 +125 -75
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -199842,7 +199842,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
199842
199842
  init_remark_gfm_BhnWr3yf_es();
199843
199843
  });
199844
199844
 
199845
- // ../../packages/superdoc/dist/chunks/src-BdpJXQ5F.es.js
199845
+ // ../../packages/superdoc/dist/chunks/src-DnSeNxAx.es.js
199846
199846
  function deleteProps(obj, propOrProps) {
199847
199847
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
199848
199848
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -256616,7 +256616,7 @@ function mergeAdjacentRuns(runs2) {
256616
256616
  let current = runs2[0];
256617
256617
  for (let i4 = 1;i4 < runs2.length; i4++) {
256618
256618
  const next2 = runs2[i4];
256619
- if (isTextRun$3(current) && isTextRun$3(next2) && !current.token && !next2.token && current.pmStart != null && current.pmEnd != null && next2.pmStart != null && next2.pmEnd != null && current.pmEnd === next2.pmStart && current.fontFamily === next2.fontFamily && current.fontSize === next2.fontSize && current.bold === next2.bold && current.italic === next2.italic && current.underline === next2.underline && current.strike === next2.strike && current.color === next2.color && current.highlight === next2.highlight && (current.letterSpacing ?? 0) === (next2.letterSpacing ?? 0) && trackedChangesCompatible(current, next2) && dataAttrsCompatible(current, next2) && commentsCompatible(current, next2)) {
256619
+ if (isTextRun$3(current) && isTextRun$3(next2) && !current.token && !next2.token && current.pmStart != null && current.pmEnd != null && next2.pmStart != null && next2.pmEnd != null && current.pmEnd === next2.pmStart && current.fontFamily === next2.fontFamily && current.fontSize === next2.fontSize && current.bold === next2.bold && current.italic === next2.italic && current.underline === next2.underline && current.strike === next2.strike && current.color === next2.color && current.highlight === next2.highlight && (current.letterSpacing ?? 0) === (next2.letterSpacing ?? 0) && trackedChangesCompatible(current, next2) && dataAttrsCompatible(current, next2) && commentsCompatible(current, next2) && bidiCompatible(current, next2)) {
256620
256620
  const currText = current.text ?? "";
256621
256621
  const nextText = next2.text ?? "";
256622
256622
  current = {
@@ -257079,7 +257079,9 @@ function toFlowBlocks(pmDoc, options) {
257079
257079
  };
257080
257080
  const bodySectionProps = doc$12.attrs?.bodySectPr ?? doc$12.attrs?.sectPr;
257081
257081
  const sectionRanges = options?.emitSectionBreaks ? analyzeSectionRanges(doc$12, bodySectionProps) : [];
257082
- converterContext.sectionDirection = converterContext.sectionDirection ?? resolveSectionDirectionFromSectPr(sectionRanges[0]?.sectPr ?? bodySectionProps);
257082
+ const firstSectPr = sectionRanges[0]?.sectPr ?? bodySectionProps;
257083
+ converterContext.sectionDirection = converterContext.sectionDirection ?? resolveSectionDirectionFromSectPr(firstSectPr);
257084
+ converterContext.sectionDirectionContext = resolveSectionDirection(firstSectPr);
257083
257085
  publishSectionMetadata(sectionRanges, options);
257084
257086
  if (sectionRanges.length > 0 && sectionRanges[0]) {
257085
257087
  const sectionBreak = createSectionBreakBlock(sectionRanges[0], nextBlockId, { isFirstSection: true });
@@ -282104,6 +282106,10 @@ menclose::after {
282104
282106
  if (runToken === "totalPageCount")
282105
282107
  return context.totalPages ? String(context.totalPages) : run2.text ?? "";
282106
282108
  return run2.text ?? "";
282109
+ }, RTL_DATE_LIKE_TOKEN_RE, RLM = "‏", normalizeRtlDateTokenForWordParity = (text5) => {
282110
+ if (!RTL_DATE_LIKE_TOKEN_RE.test(text5))
282111
+ return text5;
282112
+ return text5.replace(/[./-]/g, (separator) => `${RLM}${separator}${RLM}`);
282107
282113
  }, createDomPainter = (options) => {
282108
282114
  const painter = new DomPainter(options);
282109
282115
  return {
@@ -282595,7 +282601,8 @@ menclose::after {
282595
282601
  textRun.baselineShift != null ? textRun.baselineShift : "",
282596
282602
  textRun.token ?? "",
282597
282603
  textRun.trackedChange ? 1 : 0,
282598
- textRun.comments?.length ?? 0
282604
+ textRun.comments?.length ?? 0,
282605
+ textRun.bidi ? JSON.stringify(textRun.bidi) : ""
282599
282606
  ].join(",");
282600
282607
  }).join("|");
282601
282608
  const attrs = block.attrs;
@@ -282760,6 +282767,8 @@ menclose::after {
282760
282767
  hash$3 = hashString(hash$3, getRunBooleanProp(run2, "strike") ? "1" : "");
282761
282768
  hash$3 = hashString(hash$3, getRunStringProp(run2, "vertAlign"));
282762
282769
  hash$3 = hashNumber(hash$3, getRunNumberProp(run2, "baselineShift"));
282770
+ const bidi = run2.bidi;
282771
+ hash$3 = hashString(hash$3, bidi ? JSON.stringify(bidi) : "");
282763
282772
  }
282764
282773
  }
282765
282774
  }
@@ -283262,6 +283271,7 @@ menclose::after {
283262
283271
  const fontFamily = "fontFamily" in run2 ? run2.fontFamily : undefined;
283263
283272
  const highlight = "highlight" in run2 ? run2.highlight : undefined;
283264
283273
  const link2 = "link" in run2 ? run2.link : undefined;
283274
+ const bidi = "bidi" in run2 ? run2.bidi : undefined;
283265
283275
  return [
283266
283276
  bold ? "b" : "",
283267
283277
  italic ? "i" : "",
@@ -283271,7 +283281,8 @@ menclose::after {
283271
283281
  fontSize !== undefined ? `fs:${fontSize}` : "",
283272
283282
  fontFamily ? `ff:${fontFamily}` : "",
283273
283283
  highlight ? `hl:${highlight}` : "",
283274
- link2 ? `ln:${JSON.stringify(link2)}` : ""
283284
+ link2 ? `ln:${JSON.stringify(link2)}` : "",
283285
+ bidi ? `bd:${JSON.stringify(bidi)}` : ""
283275
283286
  ].join("");
283276
283287
  }, MAX_CACHE_SIZE$1 = 1e4, BYTES_PER_ENTRY_ESTIMATE = 5000, hashParagraphFrame = (frame) => {
283277
283288
  const parts = [];
@@ -285872,7 +285883,69 @@ menclose::after {
285872
285883
  this.#onRebuild();
285873
285884
  });
285874
285885
  }
285875
- }, Y_SORT_THRESHOLD_PX = 2, Y_SAME_LINE_THRESHOLD_PX = 3, HORIZONTAL_OVERLAP_THRESHOLD = 0.8, log = (...args$1) => {}, CLASS, TWIPS_PER_INCH2 = 1440, PX_PER_PT2, VALID_TRACKED_MODES, DEFAULT_HYPERLINK_CONFIG, ATOMIC_INLINE_TYPES, TOKEN_INLINE_TYPES, isValidTrackedMode = (value) => {
285886
+ }, Y_SORT_THRESHOLD_PX = 2, Y_SAME_LINE_THRESHOLD_PX = 3, HORIZONTAL_OVERLAP_THRESHOLD = 0.8, log = (...args$1) => {}, CLASS, DEFAULT_PAGE_DIRECTION = "ltr", DEFAULT_WRITING_MODE = "horizontal-tb", isToggleOn = (val) => {
285887
+ if (val === undefined || val === null)
285888
+ return true;
285889
+ if (val === "0" || val === 0 || val === false)
285890
+ return false;
285891
+ if (val === "false" || val === "off")
285892
+ return false;
285893
+ return true;
285894
+ }, writingModeFromTextDirection$1 = (val) => {
285895
+ if (typeof val !== "string")
285896
+ return;
285897
+ switch (val) {
285898
+ case "lrTb":
285899
+ case "lrTbV":
285900
+ case "tb":
285901
+ case "tbV":
285902
+ return "horizontal-tb";
285903
+ case "tbRl":
285904
+ case "tbRlV":
285905
+ case "rl":
285906
+ case "rlV":
285907
+ return "vertical-rl";
285908
+ case "btLr":
285909
+ case "lr":
285910
+ case "lrV":
285911
+ case "tbLrV":
285912
+ return "vertical-lr";
285913
+ default:
285914
+ return;
285915
+ }
285916
+ }, resolveSectionDirection = (sectPr) => {
285917
+ let pageDirection = DEFAULT_PAGE_DIRECTION;
285918
+ let writingMode = DEFAULT_WRITING_MODE;
285919
+ let rtlGutter = false;
285920
+ if (sectPr && typeof sectPr === "object") {
285921
+ const elements = sectPr.elements;
285922
+ if (Array.isArray(elements))
285923
+ for (const el of elements) {
285924
+ if (!el?.name)
285925
+ continue;
285926
+ const val = el.attributes?.["w:val"] ?? el.attributes?.val;
285927
+ if (el.name === "w:bidi" && isToggleOn(val)) {
285928
+ pageDirection = "rtl";
285929
+ continue;
285930
+ }
285931
+ if (el.name === "w:textDirection") {
285932
+ const mode = writingModeFromTextDirection$1(val);
285933
+ if (mode)
285934
+ writingMode = mode;
285935
+ continue;
285936
+ }
285937
+ if (el.name === "w:rtlGutter" && isToggleOn(val)) {
285938
+ rtlGutter = true;
285939
+ continue;
285940
+ }
285941
+ }
285942
+ }
285943
+ return {
285944
+ pageDirection,
285945
+ writingMode,
285946
+ rtlGutter
285947
+ };
285948
+ }, TWIPS_PER_INCH2 = 1440, PX_PER_PT2, VALID_TRACKED_MODES, DEFAULT_HYPERLINK_CONFIG, ATOMIC_INLINE_TYPES, TOKEN_INLINE_TYPES, isValidTrackedMode = (value) => {
285876
285949
  return typeof value === "string" && VALID_TRACKED_MODES.includes(value);
285877
285950
  }, isTextRun$4 = (run2) => {
285878
285951
  return "text" in run2 && run2.kind !== "tab";
@@ -286477,68 +286550,6 @@ menclose::after {
286477
286550
  mutated = true;
286478
286551
  }
286479
286552
  return mutated ? mirrored : indent2;
286480
- }, DEFAULT_PAGE_DIRECTION = "ltr", DEFAULT_WRITING_MODE = "horizontal-tb", isToggleOn = (val) => {
286481
- if (val === undefined || val === null)
286482
- return true;
286483
- if (val === "0" || val === 0 || val === false)
286484
- return false;
286485
- if (val === "false" || val === "off")
286486
- return false;
286487
- return true;
286488
- }, writingModeFromTextDirection$1 = (val) => {
286489
- if (typeof val !== "string")
286490
- return;
286491
- switch (val) {
286492
- case "lrTb":
286493
- case "lrTbV":
286494
- case "tb":
286495
- case "tbV":
286496
- return "horizontal-tb";
286497
- case "tbRl":
286498
- case "tbRlV":
286499
- case "rl":
286500
- case "rlV":
286501
- return "vertical-rl";
286502
- case "btLr":
286503
- case "lr":
286504
- case "lrV":
286505
- case "tbLrV":
286506
- return "vertical-lr";
286507
- default:
286508
- return;
286509
- }
286510
- }, resolveSectionDirection = (sectPr) => {
286511
- let pageDirection = DEFAULT_PAGE_DIRECTION;
286512
- let writingMode = DEFAULT_WRITING_MODE;
286513
- let rtlGutter = false;
286514
- if (sectPr && typeof sectPr === "object") {
286515
- const elements = sectPr.elements;
286516
- if (Array.isArray(elements))
286517
- for (const el of elements) {
286518
- if (!el?.name)
286519
- continue;
286520
- const val = el.attributes?.["w:val"] ?? el.attributes?.val;
286521
- if (el.name === "w:bidi" && isToggleOn(val)) {
286522
- pageDirection = "rtl";
286523
- continue;
286524
- }
286525
- if (el.name === "w:textDirection") {
286526
- const mode = writingModeFromTextDirection$1(val);
286527
- if (mode)
286528
- writingMode = mode;
286529
- continue;
286530
- }
286531
- if (el.name === "w:rtlGutter" && isToggleOn(val)) {
286532
- rtlGutter = true;
286533
- continue;
286534
- }
286535
- }
286536
- }
286537
- return {
286538
- pageDirection,
286539
- writingMode,
286540
- rtlGutter
286541
- };
286542
286553
  }, writingModeFromTextDirection = (val) => {
286543
286554
  switch (val) {
286544
286555
  case "lrTb":
@@ -286709,7 +286720,7 @@ menclose::after {
286709
286720
  resolvedParagraphProperties = paragraphProperties;
286710
286721
  else
286711
286722
  resolvedParagraphProperties = resolveParagraphProperties(converterContext, paragraphProperties, converterContext.tableInfo);
286712
- const sectionContext = resolveSectionDirection(undefined);
286723
+ const sectionContext = converterContext?.sectionDirectionContext ?? resolveSectionDirection(undefined);
286713
286724
  const directionContext = resolveParagraphDirection(resolvedParagraphProperties, sectionContext);
286714
286725
  const normalizedDirection = directionContext.inlineDirection;
286715
286726
  const isRtl = normalizedDirection === "rtl";
@@ -288399,6 +288410,14 @@ menclose::after {
288399
288410
  if (aKeys[i4] !== bKeys[i4])
288400
288411
  return false;
288401
288412
  return true;
288413
+ }, bidiCompatible = (a2, b$1) => {
288414
+ const aBidi = a2.bidi;
288415
+ const bBidi = b$1.bidi;
288416
+ if (!aBidi && !bBidi)
288417
+ return true;
288418
+ if (!aBidi || !bBidi)
288419
+ return false;
288420
+ return aBidi.rtl === bBidi.rtl && aBidi.embedding === bBidi.embedding && aBidi.override === bBidi.override;
288402
288421
  }, toTrackChangeAttrs = (value) => {
288403
288422
  if (!value || typeof value !== "object")
288404
288423
  return;
@@ -293432,7 +293451,7 @@ menclose::after {
293432
293451
  return;
293433
293452
  console.log(...args$1);
293434
293453
  }, 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;
293435
- var init_src_BdpJXQ5F_es = __esm(() => {
293454
+ var init_src_DnSeNxAx_es = __esm(() => {
293436
293455
  init_rolldown_runtime_Bg48TavK_es();
293437
293456
  init_SuperConverter_BInxZk0I_es();
293438
293457
  init_jszip_C49i9kUs_es();
@@ -322985,7 +323004,9 @@ function print() { __p += __j.call(arguments, '') }
322985
323004
  const isActiveLink = !!(linkData && !linkData.blocked && linkData.href);
322986
323005
  const elem = isActiveLink ? this.doc.createElement("a") : this.doc.createElement("span");
322987
323006
  const text5 = resolveRunText(run2, context);
322988
- this.setTextContentWithFormattingSpaceMarks(elem, text5);
323007
+ const textRun = run2;
323008
+ const effectiveText = textRun.bidi?.rtl === true && typeof text5 === "string" ? normalizeRtlDateTokenForWordParity(text5) : text5;
323009
+ this.setTextContentWithFormattingSpaceMarks(elem, effectiveText);
322989
323010
  if (linkData?.dataset)
322990
323011
  applyLinkDataset(elem, linkData.dataset);
322991
323012
  if (linkData?.blocked) {
@@ -323000,7 +323021,11 @@ function print() { __p += __j.call(arguments, '') }
323000
323021
  this.pendingTooltips.set(elem, linkData.tooltip);
323001
323022
  }
323002
323023
  applyRunStyles(elem, run2, isActiveLink);
323003
- const commentAnnotations = run2.comments;
323024
+ if (textRun.bidi?.rtl === true)
323025
+ elem.setAttribute("dir", "rtl");
323026
+ else if (typeof textRun.text === "string" && RTL_DATE_LIKE_TOKEN_RE.test(textRun.text))
323027
+ elem.setAttribute("dir", "ltr");
323028
+ const commentAnnotations = textRun.comments;
323004
323029
  if (!!commentAnnotations?.length) {
323005
323030
  elem.dataset.commentIds = commentAnnotations.map((c) => c.commentId).join(",");
323006
323031
  if (commentAnnotations.some((c) => c.internal))
@@ -323462,7 +323487,8 @@ function print() { __p += __j.call(arguments, '') }
323462
323487
  sdt: run2.sdt ?? null,
323463
323488
  link: run2.link ?? null,
323464
323489
  comments: run2.comments ?? null,
323465
- dataAttrs: stableDataAttrs(run2.dataAttrs) ?? null
323490
+ dataAttrs: stableDataAttrs(run2.dataAttrs) ?? null,
323491
+ bidi: run2.bidi ?? null
323466
323492
  });
323467
323493
  const isWhitespaceOnly = (text5) => {
323468
323494
  if (text5.length === 0)
@@ -324110,6 +324136,7 @@ function print() { __p += __j.call(arguments, '') }
324110
324136
  "path(",
324111
324137
  "rect("
324112
324138
  ];
324139
+ RTL_DATE_LIKE_TOKEN_RE = /^-?\d+(?:[./-]\d+)+$/;
324113
324140
  CLIP_PATH_PREFIXES = [
324114
324141
  "inset(",
324115
324142
  "polygon(",
@@ -331493,7 +331520,7 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
331493
331520
 
331494
331521
  // ../../packages/superdoc/dist/super-editor.es.js
331495
331522
  var init_super_editor_es = __esm(() => {
331496
- init_src_BdpJXQ5F_es();
331523
+ init_src_DnSeNxAx_es();
331497
331524
  init_SuperConverter_BInxZk0I_es();
331498
331525
  init_jszip_C49i9kUs_es();
331499
331526
  init_xml_js_CqGKpaft_es();
@@ -469955,6 +469982,28 @@ function dispatchIntentTool(toolName, args3, execute) {
469955
469982
  }
469956
469983
  }
469957
469984
 
469985
+ // src/tools/param-renames.ts
469986
+ function applyParamRenames(opId, input2) {
469987
+ const renames = PARAM_RENAMES[opId];
469988
+ if (!renames)
469989
+ return input2;
469990
+ const renamed = {};
469991
+ for (const [key3, value] of Object.entries(input2)) {
469992
+ renamed[renames[key3] ?? key3] = value;
469993
+ }
469994
+ return renamed;
469995
+ }
469996
+ var PARAM_RENAMES;
469997
+ var init_param_renames = __esm(() => {
469998
+ PARAM_RENAMES = {
469999
+ getNodeById: { id: "nodeId" },
470000
+ "comments.create": { parentId: "parentCommentId" },
470001
+ "comments.patch": { id: "commentId" },
470002
+ "comments.delete": { id: "commentId" },
470003
+ "comments.get": { id: "commentId" }
470004
+ };
470005
+ });
470006
+
469958
470007
  // src/tools/intent.ts
469959
470008
  function jsonSchemaPropertyToZod(prop) {
469960
470009
  const desc = prop.description;
@@ -470008,7 +470057,7 @@ function buildZodSchema(tool) {
470008
470057
  }
470009
470058
  function executeOperation(api2, operationId, input2) {
470010
470059
  const opId = operationId.startsWith("doc.") ? operationId.slice(4) : operationId;
470011
- return api2.invoke({ operationId: opId, input: input2 });
470060
+ return api2.invoke({ operationId: opId, input: applyParamRenames(opId, input2) });
470012
470061
  }
470013
470062
  function registerIntentTools(server, sessions) {
470014
470063
  const catalog = MCP_TOOL_CATALOG;
@@ -470043,6 +470092,7 @@ function registerIntentTools(server, sessions) {
470043
470092
  var init_intent = __esm(() => {
470044
470093
  init_zod();
470045
470094
  init_catalog();
470095
+ init_param_renames();
470046
470096
  });
470047
470097
 
470048
470098
  // src/tools/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/mcp",
3
- "version": "0.3.0-next.76",
3
+ "version": "0.3.0-next.78",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=20"