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

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 +203 -34
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -93206,6 +93206,18 @@ var init_contract = __esm(() => {
93206
93206
  type: "string"
93207
93207
  }
93208
93208
  },
93209
+ activeCommentIds: {
93210
+ type: "array",
93211
+ items: {
93212
+ type: "string"
93213
+ }
93214
+ },
93215
+ activeChangeIds: {
93216
+ type: "array",
93217
+ items: {
93218
+ type: "string"
93219
+ }
93220
+ },
93209
93221
  text: {
93210
93222
  type: "string"
93211
93223
  }
@@ -93214,7 +93226,9 @@ var init_contract = __esm(() => {
93214
93226
  required: [
93215
93227
  "empty",
93216
93228
  "target",
93217
- "activeMarks"
93229
+ "activeMarks",
93230
+ "activeCommentIds",
93231
+ "activeChangeIds"
93218
93232
  ]
93219
93233
  }
93220
93234
  },
@@ -204776,7 +204790,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
204776
204790
  emptyOptions2 = {};
204777
204791
  });
204778
204792
 
204779
- // ../../packages/superdoc/dist/chunks/SuperConverter-CyrStvpz.es.js
204793
+ // ../../packages/superdoc/dist/chunks/SuperConverter-BtMpBQnx.es.js
204780
204794
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
204781
204795
  const fieldValue = extension$1.config[field];
204782
204796
  if (typeof fieldValue === "function")
@@ -257183,7 +257197,7 @@ var isRegExp = (value) => {
257183
257197
  state.kern = kernNode.attributes["w:val"];
257184
257198
  }
257185
257199
  }, SuperConverter;
257186
- var init_SuperConverter_CyrStvpz_es = __esm(() => {
257200
+ var init_SuperConverter_BtMpBQnx_es = __esm(() => {
257187
257201
  init_rolldown_runtime_Bg48TavK_es();
257188
257202
  init_jszip_C49i9kUs_es();
257189
257203
  init_xml_js_CqGKpaft_es();
@@ -270073,11 +270087,15 @@ var init_SuperConverter_CyrStvpz_es = __esm(() => {
270073
270087
  empty: { type: "boolean" },
270074
270088
  target: { oneOf: [textTargetSchema, { type: "null" }] },
270075
270089
  activeMarks: arraySchema({ type: "string" }),
270090
+ activeCommentIds: arraySchema({ type: "string" }),
270091
+ activeChangeIds: arraySchema({ type: "string" }),
270076
270092
  text: { type: "string" }
270077
270093
  }, [
270078
270094
  "empty",
270079
270095
  "target",
270080
- "activeMarks"
270096
+ "activeMarks",
270097
+ "activeCommentIds",
270098
+ "activeChangeIds"
270081
270099
  ])
270082
270100
  },
270083
270101
  "mutations.preview": {
@@ -294782,7 +294800,7 @@ var init_SuperConverter_CyrStvpz_es = __esm(() => {
294782
294800
  };
294783
294801
  });
294784
294802
 
294785
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-JcG-eLAZ.es.js
294803
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-FOTAKCop.es.js
294786
294804
  function parseSizeUnit(val = "0") {
294787
294805
  const length = val.toString() || "0";
294788
294806
  const value = Number.parseFloat(length);
@@ -297404,8 +297422,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
297404
297422
  }
297405
297423
  };
297406
297424
  };
297407
- var init_create_headless_toolbar_JcG_eLAZ_es = __esm(() => {
297408
- init_SuperConverter_CyrStvpz_es();
297425
+ var init_create_headless_toolbar_FOTAKCop_es = __esm(() => {
297426
+ init_SuperConverter_BtMpBQnx_es();
297409
297427
  init_constants_DrU4EASo_es();
297410
297428
  init_dist_B8HfvhaK_es();
297411
297429
  CSS_DIMENSION_REGEX = /[\d-.]+(\w+)$/;
@@ -351614,7 +351632,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
351614
351632
  init_remark_gfm_BhnWr3yf_es();
351615
351633
  });
351616
351634
 
351617
- // ../../packages/superdoc/dist/chunks/src-4pRutOwm.es.js
351635
+ // ../../packages/superdoc/dist/chunks/src-XFPz5mDi.es.js
351618
351636
  function deleteProps(obj, propOrProps) {
351619
351637
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
351620
351638
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -360523,7 +360541,7 @@ function getMarksDiff(marksA = [], marksB = []) {
360523
360541
  if (!attrs)
360524
360542
  return {};
360525
360543
  const ignoredMarkKeys = /* @__PURE__ */ new Set;
360526
- if (TRACK_CHANGE_MARK_NAMES.has(markName))
360544
+ if (TRACK_CHANGE_MARK_NAMES$1.has(markName))
360527
360545
  for (const key2 of TRACK_CHANGE_IGNORED_ATTRIBUTE_KEYS)
360528
360546
  ignoredMarkKeys.add(key2);
360529
360547
  const normalized = {};
@@ -378651,14 +378669,21 @@ function resolveCurrentSelectionInfo(editor, input2) {
378651
378669
  return {
378652
378670
  empty: true,
378653
378671
  target: null,
378654
- activeMarks: []
378672
+ activeMarks: [],
378673
+ activeCommentIds: [],
378674
+ activeChangeIds: []
378655
378675
  };
378656
378676
  const { from: from$1, to, empty: empty$1 } = state.selection;
378657
378677
  const segments = collectTextSegments(state.doc, from$1, to);
378678
+ const target = segments && segments.length > 0 ? buildTextTarget(segments) : null;
378679
+ const activeMarks = collectActiveMarks(state, from$1, to);
378680
+ const { commentIds: activeCommentIds, changeIds: activeChangeRawIds } = collectActiveEntityIds(state, from$1, to);
378658
378681
  const info = {
378659
378682
  empty: empty$1,
378660
- target: segments && segments.length > 0 ? buildTextTarget(segments) : null,
378661
- activeMarks: collectActiveMarks(state, from$1, to)
378683
+ target,
378684
+ activeMarks,
378685
+ activeCommentIds,
378686
+ activeChangeIds: mapRawChangeIdsToCanonical(editor, activeChangeRawIds)
378662
378687
  };
378663
378688
  if (input2.includeText && !empty$1)
378664
378689
  info.text = state.doc.textBetween(from$1, to, " ");
@@ -378707,6 +378732,68 @@ function readBlockId(node2) {
378707
378732
  const id2 = attrs.sdBlockId ?? attrs.id ?? attrs.blockId;
378708
378733
  return typeof id2 === "string" && id2.length > 0 ? id2 : null;
378709
378734
  }
378735
+ function mapRawChangeIdsToCanonical(editor, rawIds) {
378736
+ if (rawIds.length === 0)
378737
+ return rawIds;
378738
+ let grouped;
378739
+ try {
378740
+ grouped = groupTrackedChanges(editor);
378741
+ } catch {
378742
+ return [];
378743
+ }
378744
+ const rawToCanonical = /* @__PURE__ */ new Map;
378745
+ for (const change of grouped)
378746
+ rawToCanonical.set(change.rawId, change.id);
378747
+ const seen = /* @__PURE__ */ new Set;
378748
+ const out = [];
378749
+ for (const raw of rawIds) {
378750
+ const canonical = rawToCanonical.get(raw);
378751
+ if (!canonical)
378752
+ continue;
378753
+ if (seen.has(canonical))
378754
+ continue;
378755
+ seen.add(canonical);
378756
+ out.push(canonical);
378757
+ }
378758
+ return out;
378759
+ }
378760
+ function collectActiveEntityIds(state, from$1, to) {
378761
+ const commentIds = /* @__PURE__ */ new Set;
378762
+ const changeIds = /* @__PURE__ */ new Set;
378763
+ const collectFromMark = (markType, attrs) => {
378764
+ if (markType === COMMENT_MARK_NAME2) {
378765
+ const id2 = resolveCommentIdFromAttrs(attrs ?? {});
378766
+ if (typeof id2 === "string" && id2.length > 0)
378767
+ commentIds.add(id2);
378768
+ } else if (TRACK_CHANGE_MARK_NAMES.has(markType)) {
378769
+ const id2 = attrs?.id;
378770
+ if (typeof id2 === "string" && id2.length > 0)
378771
+ changeIds.add(id2);
378772
+ }
378773
+ };
378774
+ if (from$1 === to) {
378775
+ if (state.storedMarks)
378776
+ for (const mark2 of state.storedMarks)
378777
+ collectFromMark(mark2.type.name, mark2.attrs);
378778
+ const $pos = state.doc.resolve(from$1);
378779
+ for (const mark2 of $pos.marks())
378780
+ collectFromMark(mark2.type.name, mark2.attrs);
378781
+ } else
378782
+ state.doc.nodesBetween(from$1, to, (node2, pos) => {
378783
+ if (!node2.isText)
378784
+ return true;
378785
+ const start$1 = Math.max(pos, from$1);
378786
+ if (Math.min(pos + node2.nodeSize, to) <= start$1)
378787
+ return false;
378788
+ for (const mark2 of node2.marks)
378789
+ collectFromMark(mark2.type.name, mark2.attrs);
378790
+ return false;
378791
+ });
378792
+ return {
378793
+ commentIds: Array.from(commentIds),
378794
+ changeIds: Array.from(changeIds)
378795
+ };
378796
+ }
378710
378797
  function collectActiveMarks(state, from$1, to) {
378711
378798
  const names = /* @__PURE__ */ new Set;
378712
378799
  const stored = state.storedMarks;
@@ -378761,7 +378848,9 @@ function selectionInfoKey(info) {
378761
378848
  else
378762
378849
  targetKey = target.segments.map((s2) => `${s2.blockId}:${s2.range.start}-${s2.range.end}`).join("|");
378763
378850
  const marks = [...info.activeMarks].sort().join(",");
378764
- return `${info.empty ? "1" : "0"}:${targetKey}:${marks}`;
378851
+ const comments = [...info.activeCommentIds].sort().join(",");
378852
+ const changes = [...info.activeChangeIds].sort().join(",");
378853
+ return `${info.empty ? "1" : "0"}:${targetKey}:${marks}:c=${comments}:tc=${changes}`;
378765
378854
  }
378766
378855
  function markTypesPresentEverywhere(doc$12, from$1, to) {
378767
378856
  let common = null;
@@ -422081,7 +422170,7 @@ var Node$13 = class Node$14 {
422081
422170
  id: { default: null },
422082
422171
  edGrp: { default: null },
422083
422172
  displacedByCustomXml: { default: null }
422084
- }), PermEnd, PermEndBlock, IGNORED_ATTRIBUTE_KEYS, TRACK_CHANGE_MARK_NAMES, TRACK_CHANGE_IGNORED_ATTRIBUTE_KEYS, VOLATILE_PARAGRAPH_ATTRS, VOLATILE_IMAGE_ORIGINAL_ATTR_KEYS, SIMILARITY_THRESHOLD = 0.65, MIN_LENGTH_FOR_SIMILARITY = 4, COMMENT_ATTRS_DIFF_IGNORED_KEYS, SLOT_VARIANTS, PART_KINDS, DOCUMENT_RELS_PATH$2 = "word/_rels/document.xml.rels", DOCUMENT_RELS_PATH$1 = "word/_rels/document.xml.rels", BODY_RELATIONSHIP_EXCLUSIONS, setNestedValue = (target, path5, value) => {
422173
+ }), PermEnd, PermEndBlock, IGNORED_ATTRIBUTE_KEYS, TRACK_CHANGE_MARK_NAMES$1, TRACK_CHANGE_IGNORED_ATTRIBUTE_KEYS, VOLATILE_PARAGRAPH_ATTRS, VOLATILE_IMAGE_ORIGINAL_ATTR_KEYS, SIMILARITY_THRESHOLD = 0.65, MIN_LENGTH_FOR_SIMILARITY = 4, COMMENT_ATTRS_DIFF_IGNORED_KEYS, SLOT_VARIANTS, PART_KINDS, DOCUMENT_RELS_PATH$2 = "word/_rels/document.xml.rels", DOCUMENT_RELS_PATH$1 = "word/_rels/document.xml.rels", BODY_RELATIONSHIP_EXCLUSIONS, setNestedValue = (target, path5, value) => {
422085
422174
  if (!path5.includes(".")) {
422086
422175
  target[path5] = value;
422087
422176
  return;
@@ -424996,7 +425085,7 @@ var Node$13 = class Node$14 {
424996
425085
  listener(snapshot2);
424997
425086
  } catch {}
424998
425087
  }
424999
- }, TRACK_MARK_TYPE_BY_NAME, EMITTABLE_BLOCK_TYPES, SDT_BLOCK_NODE_NAMES, REQUIRED_COMMANDS, VALID_CAPABILITY_REASON_CODES, REQUIRED_HELPERS, SCHEMA_NODE_GATES, schemaGatedIds, SUPPORTED_NON_UNIFORM_STRATEGIES, SUPPORTED_SET_MARKS, REGEX_MAX_PATTERN_LENGTH = 1024, STYLES_PART = "word/styles.xml", PROPERTIES_KEY_BY_CHANNEL, XML_PATH_BY_CHANNEL, UNDERLINE_API_TO_STORAGE, UNDERLINE_STORAGE_TO_API, HEX_SUBKEYS_BY_PROPERTY, SUPPORTED_DELETE_NODE_TYPES2, REJECTED_DELETE_NODE_TYPES2, TEXT_PREVIEW_MAX_LENGTH = 80, RANGE_DELETE_SAFE_NODE_TYPES, HEADING_PATTERN, OOXML_DEFAULT_FONT_SIZE_PT = 10, INDENT_PER_LEVEL_TWIPS = 720, HANGING_INDENT_TWIPS = 360, SYMBOL_FONT_NAMES, RFONTS_FAMILY_ATTRS, ORDERED_PRESET_CONFIG, BULLET_PRESET_CONFIG, PRESET_TEMPLATES, LevelFormattingHelpers, PRESET_KIND_MAP, NUMBERING_PART = "word/numbering.xml", DEFAULT_PRESET_FOR_KIND, _setValueDelegate, PREVIEW_TEXT_MAX_LENGTH = 2000, BLOCK_PREVIEW_MAX_LENGTH = 200, EDGE_NODE_TYPES$1, POINTS_TO_PIXELS, POINTS_TO_TWIPS = 20, PIXELS_TO_TWIPS, DEFAULT_TABLE_GRID_WIDTH_TWIPS = 1500, SETTINGS_PART$1 = "word/settings.xml", WORD_DEFAULT_TBL_LOOK, FLAG_TO_OOXML_KEY, INVERTED_FLAGS, XML_KEY_TO_STYLE_OPTION, CLEARED_BORDER_OOXML, TABLE_MARGIN_KEY_GROUPS, TABLE_ADAPTER_DISPATCH, ROW_TARGETED_TABLE_OPS, registered = false, STYLES_PART_ID = "word/styles.xml", stylesPartDescriptor, settingsPartDescriptor, RELS_PART_ID2 = "word/_rels/document.xml.rels", RELS_XMLNS2 = "http://schemas.openxmlformats.org/package/2006/relationships", HEADER_RELATIONSHIP_TYPE$1 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE$1 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", relsPartDescriptor, BatchHistoryAdapter = class {
425088
+ }, TRACK_MARK_TYPE_BY_NAME, EMITTABLE_BLOCK_TYPES, SDT_BLOCK_NODE_NAMES, REQUIRED_COMMANDS, VALID_CAPABILITY_REASON_CODES, REQUIRED_HELPERS, SCHEMA_NODE_GATES, schemaGatedIds, SUPPORTED_NON_UNIFORM_STRATEGIES, SUPPORTED_SET_MARKS, REGEX_MAX_PATTERN_LENGTH = 1024, STYLES_PART = "word/styles.xml", PROPERTIES_KEY_BY_CHANNEL, XML_PATH_BY_CHANNEL, UNDERLINE_API_TO_STORAGE, UNDERLINE_STORAGE_TO_API, HEX_SUBKEYS_BY_PROPERTY, SUPPORTED_DELETE_NODE_TYPES2, REJECTED_DELETE_NODE_TYPES2, TEXT_PREVIEW_MAX_LENGTH = 80, RANGE_DELETE_SAFE_NODE_TYPES, HEADING_PATTERN, OOXML_DEFAULT_FONT_SIZE_PT = 10, INDENT_PER_LEVEL_TWIPS = 720, HANGING_INDENT_TWIPS = 360, SYMBOL_FONT_NAMES, RFONTS_FAMILY_ATTRS, ORDERED_PRESET_CONFIG, BULLET_PRESET_CONFIG, PRESET_TEMPLATES, LevelFormattingHelpers, PRESET_KIND_MAP, NUMBERING_PART = "word/numbering.xml", DEFAULT_PRESET_FOR_KIND, _setValueDelegate, PREVIEW_TEXT_MAX_LENGTH = 2000, BLOCK_PREVIEW_MAX_LENGTH = 200, EDGE_NODE_TYPES$1, COMMENT_MARK_NAME2 = "commentMark", TRACK_CHANGE_MARK_NAMES, POINTS_TO_PIXELS, POINTS_TO_TWIPS = 20, PIXELS_TO_TWIPS, DEFAULT_TABLE_GRID_WIDTH_TWIPS = 1500, SETTINGS_PART$1 = "word/settings.xml", WORD_DEFAULT_TBL_LOOK, FLAG_TO_OOXML_KEY, INVERTED_FLAGS, XML_KEY_TO_STYLE_OPTION, CLEARED_BORDER_OOXML, TABLE_MARGIN_KEY_GROUPS, TABLE_ADAPTER_DISPATCH, ROW_TARGETED_TABLE_OPS, registered = false, STYLES_PART_ID = "word/styles.xml", stylesPartDescriptor, settingsPartDescriptor, RELS_PART_ID2 = "word/_rels/document.xml.rels", RELS_XMLNS2 = "http://schemas.openxmlformats.org/package/2006/relationships", HEADER_RELATIONSHIP_TYPE$1 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE$1 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", relsPartDescriptor, BatchHistoryAdapter = class {
425000
425089
  #done = [];
425001
425090
  #redone = [];
425002
425091
  #listeners = /* @__PURE__ */ new Set;
@@ -440693,12 +440782,12 @@ menclose::after {
440693
440782
  return;
440694
440783
  console.log(...args$1);
440695
440784
  }, 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;
440696
- var init_src_4pRutOwm_es = __esm(() => {
440785
+ var init_src_XFPz5mDi_es = __esm(() => {
440697
440786
  init_rolldown_runtime_Bg48TavK_es();
440698
- init_SuperConverter_CyrStvpz_es();
440787
+ init_SuperConverter_BtMpBQnx_es();
440699
440788
  init_jszip_C49i9kUs_es();
440700
440789
  init_uuid_qzgm05fK_es();
440701
- init_create_headless_toolbar_JcG_eLAZ_es();
440790
+ init_create_headless_toolbar_FOTAKCop_es();
440702
440791
  init_constants_DrU4EASo_es();
440703
440792
  init_dist_B8HfvhaK_es();
440704
440793
  init_unified_Dsuw2be5_es();
@@ -458961,7 +459050,7 @@ function print() { __p += __j.call(arguments, '') }
458961
459050
  attributes: sharedAttributes
458962
459051
  });
458963
459052
  IGNORED_ATTRIBUTE_KEYS = new Set(["sdBlockId"]);
458964
- TRACK_CHANGE_MARK_NAMES = new Set([
459053
+ TRACK_CHANGE_MARK_NAMES$1 = new Set([
458965
459054
  "trackInsert",
458966
459055
  "trackDelete",
458967
459056
  "trackFormat"
@@ -463779,6 +463868,11 @@ function print() { __p += __j.call(arguments, '') }
463779
463868
  bullet: "disc"
463780
463869
  };
463781
463870
  EDGE_NODE_TYPES$1 = new Set(SELECTION_EDGE_NODE_TYPES);
463871
+ TRACK_CHANGE_MARK_NAMES = new Set([
463872
+ "trackInsert",
463873
+ "trackDelete",
463874
+ "trackFormat"
463875
+ ]);
463782
463876
  POINTS_TO_PIXELS = 96 / 72;
463783
463877
  PIXELS_TO_TWIPS = 1440 / 96;
463784
463878
  WORD_DEFAULT_TBL_LOOK = {
@@ -477607,11 +477701,11 @@ var init_zipper_DbkgrypV_es = __esm(() => {
477607
477701
 
477608
477702
  // ../../packages/superdoc/dist/super-editor.es.js
477609
477703
  var init_super_editor_es = __esm(() => {
477610
- init_src_4pRutOwm_es();
477611
- init_SuperConverter_CyrStvpz_es();
477704
+ init_src_XFPz5mDi_es();
477705
+ init_SuperConverter_BtMpBQnx_es();
477612
477706
  init_jszip_C49i9kUs_es();
477613
477707
  init_xml_js_CqGKpaft_es();
477614
- init_create_headless_toolbar_JcG_eLAZ_es();
477708
+ init_create_headless_toolbar_FOTAKCop_es();
477615
477709
  init_constants_DrU4EASo_es();
477616
477710
  init_dist_B8HfvhaK_es();
477617
477711
  init_unified_Dsuw2be5_es();
@@ -489383,8 +489477,10 @@ var init_schemas4 = __esm(() => {
489383
489477
  empty: { type: "boolean" },
489384
489478
  target: { oneOf: [textTargetSchema2, { type: "null" }] },
489385
489479
  activeMarks: arraySchema2({ type: "string" }),
489480
+ activeCommentIds: arraySchema2({ type: "string" }),
489481
+ activeChangeIds: arraySchema2({ type: "string" }),
489386
489482
  text: { type: "string" }
489387
- }, ["empty", "target", "activeMarks"])
489483
+ }, ["empty", "target", "activeMarks", "activeCommentIds", "activeChangeIds"])
489388
489484
  },
489389
489485
  "mutations.preview": {
489390
489486
  input: mutationsInputSchema,
@@ -498278,7 +498374,7 @@ function isInlineHost2(node3) {
498278
498374
  function relevantMarks2(marks) {
498279
498375
  if (!marks?.length)
498280
498376
  return [];
498281
- return marks.filter((mark2) => mark2.type?.name === LINK_MARK_NAME2 || mark2.type?.name === COMMENT_MARK_NAME2);
498377
+ return marks.filter((mark2) => mark2.type?.name === LINK_MARK_NAME2 || mark2.type?.name === COMMENT_MARK_NAME3);
498282
498378
  }
498283
498379
  function closeMarkSpan2(state, key2, endOffset, endPos) {
498284
498380
  const active = state.activeMarks.get(key2);
@@ -498288,7 +498384,7 @@ function closeMarkSpan2(state, key2, endOffset, endPos) {
498288
498384
  if (endOffset <= active.startOffset)
498289
498385
  return;
498290
498386
  const markType = active.mark.type?.name;
498291
- const nodeType = markType === LINK_MARK_NAME2 ? "hyperlink" : markType === COMMENT_MARK_NAME2 ? "comment" : undefined;
498387
+ const nodeType = markType === LINK_MARK_NAME2 ? "hyperlink" : markType === COMMENT_MARK_NAME3 ? "comment" : undefined;
498292
498388
  if (!nodeType)
498293
498389
  return;
498294
498390
  const attrs = active.mark.attrs ?? {};
@@ -498492,9 +498588,9 @@ function findInlineByType2(index2, nodeType) {
498492
498588
  return index2.candidates;
498493
498589
  return index2.byType.get(nodeType) ?? [];
498494
498590
  }
498495
- var LINK_MARK_NAME2 = "link", COMMENT_MARK_NAME2, SUPPORTED_INLINE_TYPES2;
498591
+ var LINK_MARK_NAME2 = "link", COMMENT_MARK_NAME3, SUPPORTED_INLINE_TYPES2;
498496
498592
  var init_inline_address_resolver = __esm(() => {
498497
- COMMENT_MARK_NAME2 = CommentMarkName2;
498593
+ COMMENT_MARK_NAME3 = CommentMarkName2;
498498
498594
  SUPPORTED_INLINE_TYPES2 = new Set([
498499
498595
  "run",
498500
498596
  "bookmark",
@@ -589035,17 +589131,21 @@ var init_scroll_into_view_adapter = __esm(() => {
589035
589131
  function resolveCurrentSelectionInfo2(editor, input2) {
589036
589132
  const state = editor.state;
589037
589133
  if (!state) {
589038
- return { empty: true, target: null, activeMarks: [] };
589134
+ return { empty: true, target: null, activeMarks: [], activeCommentIds: [], activeChangeIds: [] };
589039
589135
  }
589040
589136
  const sel = state.selection;
589041
589137
  const { from: from4, to, empty: empty6 } = sel;
589042
589138
  const segments = collectTextSegments2(state.doc, from4, to);
589043
589139
  const target = segments && segments.length > 0 ? buildTextTarget3(segments) : null;
589044
589140
  const activeMarks = collectActiveMarks2(state, from4, to);
589141
+ const { commentIds: activeCommentIds, changeIds: activeChangeRawIds } = collectActiveEntityIds2(state, from4, to);
589142
+ const activeChangeIds = mapRawChangeIdsToCanonical2(editor, activeChangeRawIds);
589045
589143
  const info = {
589046
589144
  empty: empty6,
589047
589145
  target,
589048
- activeMarks
589146
+ activeMarks,
589147
+ activeCommentIds,
589148
+ activeChangeIds
589049
589149
  };
589050
589150
  if (input2.includeText && !empty6) {
589051
589151
  info.text = state.doc.textBetween(from4, to, " ");
@@ -589089,6 +589189,69 @@ function readBlockId2(node4) {
589089
589189
  const id2 = attrs.sdBlockId ?? attrs.id ?? attrs.blockId;
589090
589190
  return typeof id2 === "string" && id2.length > 0 ? id2 : null;
589091
589191
  }
589192
+ function mapRawChangeIdsToCanonical2(editor, rawIds) {
589193
+ if (rawIds.length === 0)
589194
+ return rawIds;
589195
+ let grouped;
589196
+ try {
589197
+ grouped = groupTrackedChanges2(editor);
589198
+ } catch {
589199
+ return [];
589200
+ }
589201
+ const rawToCanonical = new Map;
589202
+ for (const change of grouped) {
589203
+ rawToCanonical.set(change.rawId, change.id);
589204
+ }
589205
+ const seen = new Set;
589206
+ const out = [];
589207
+ for (const raw of rawIds) {
589208
+ const canonical = rawToCanonical.get(raw);
589209
+ if (!canonical)
589210
+ continue;
589211
+ if (seen.has(canonical))
589212
+ continue;
589213
+ seen.add(canonical);
589214
+ out.push(canonical);
589215
+ }
589216
+ return out;
589217
+ }
589218
+ function collectActiveEntityIds2(state, from4, to) {
589219
+ const commentIds = new Set;
589220
+ const changeIds = new Set;
589221
+ const collectFromMark = (markType, attrs) => {
589222
+ if (markType === COMMENT_MARK_NAME4) {
589223
+ const id2 = resolveCommentIdFromAttrs2(attrs ?? {});
589224
+ if (typeof id2 === "string" && id2.length > 0)
589225
+ commentIds.add(id2);
589226
+ } else if (TRACK_CHANGE_MARK_NAMES2.has(markType)) {
589227
+ const id2 = attrs?.id;
589228
+ if (typeof id2 === "string" && id2.length > 0)
589229
+ changeIds.add(id2);
589230
+ }
589231
+ };
589232
+ if (from4 === to) {
589233
+ if (state.storedMarks) {
589234
+ for (const mark2 of state.storedMarks)
589235
+ collectFromMark(mark2.type.name, mark2.attrs);
589236
+ }
589237
+ const $pos = state.doc.resolve(from4);
589238
+ for (const mark2 of $pos.marks())
589239
+ collectFromMark(mark2.type.name, mark2.attrs);
589240
+ } else {
589241
+ state.doc.nodesBetween(from4, to, (node4, pos) => {
589242
+ if (!node4.isText)
589243
+ return true;
589244
+ const start2 = Math.max(pos, from4);
589245
+ const end = Math.min(pos + node4.nodeSize, to);
589246
+ if (end <= start2)
589247
+ return false;
589248
+ for (const mark2 of node4.marks)
589249
+ collectFromMark(mark2.type.name, mark2.attrs);
589250
+ return false;
589251
+ });
589252
+ }
589253
+ return { commentIds: Array.from(commentIds), changeIds: Array.from(changeIds) };
589254
+ }
589092
589255
  function collectActiveMarks2(state, from4, to) {
589093
589256
  const names = new Set;
589094
589257
  const stored = state.storedMarks;
@@ -589146,7 +589309,9 @@ function selectionInfoKey2(info) {
589146
589309
  targetKey = target.segments.map((s2) => `${s2.blockId}:${s2.range.start}-${s2.range.end}`).join("|");
589147
589310
  }
589148
589311
  const marks = [...info.activeMarks].sort().join(",");
589149
- return `${info.empty ? "1" : "0"}:${targetKey}:${marks}`;
589312
+ const comments = [...info.activeCommentIds].sort().join(",");
589313
+ const changes = [...info.activeChangeIds].sort().join(",");
589314
+ return `${info.empty ? "1" : "0"}:${targetKey}:${marks}:c=${comments}:tc=${changes}`;
589150
589315
  }
589151
589316
  function markTypesPresentEverywhere2(doc6, from4, to) {
589152
589317
  let common = null;
@@ -589177,7 +589342,11 @@ function markTypesPresentEverywhere2(doc6, from4, to) {
589177
589342
  });
589178
589343
  return common ?? new Set;
589179
589344
  }
589180
- var init_selection_info_resolver = () => {};
589345
+ var COMMENT_MARK_NAME4 = "commentMark", TRACK_CHANGE_MARK_NAMES2;
589346
+ var init_selection_info_resolver = __esm(() => {
589347
+ init_tracked_change_resolver();
589348
+ TRACK_CHANGE_MARK_NAMES2 = new Set(["trackInsert", "trackDelete", "trackFormat"]);
589349
+ });
589181
589350
 
589182
589351
  // ../../packages/super-editor/src/editors/v1/document-api-adapters/helpers/table-target-resolver.ts
589183
589352
  function resolveLocatorToCandidate2(editor, locator, operationName) {
@@ -595207,7 +595376,7 @@ function getMarksDiff2(marksA = [], marksB = []) {
595207
595376
  return {};
595208
595377
  }
595209
595378
  const ignoredMarkKeys = new Set;
595210
- if (TRACK_CHANGE_MARK_NAMES2.has(markName)) {
595379
+ if (TRACK_CHANGE_MARK_NAMES3.has(markName)) {
595211
595380
  for (const key2 of TRACK_CHANGE_IGNORED_ATTRIBUTE_KEYS2) {
595212
595381
  ignoredMarkKeys.add(key2);
595213
595382
  }
@@ -595364,10 +595533,10 @@ function deepEquals2(a2, b2) {
595364
595533
  }
595365
595534
  return false;
595366
595535
  }
595367
- var IGNORED_ATTRIBUTE_KEYS2, TRACK_CHANGE_MARK_NAMES2, TRACK_CHANGE_IGNORED_ATTRIBUTE_KEYS2;
595536
+ var IGNORED_ATTRIBUTE_KEYS2, TRACK_CHANGE_MARK_NAMES3, TRACK_CHANGE_IGNORED_ATTRIBUTE_KEYS2;
595368
595537
  var init_attributes_diffing = __esm(() => {
595369
595538
  IGNORED_ATTRIBUTE_KEYS2 = new Set(["sdBlockId"]);
595370
- TRACK_CHANGE_MARK_NAMES2 = new Set(["trackInsert", "trackDelete", "trackFormat"]);
595539
+ TRACK_CHANGE_MARK_NAMES3 = new Set(["trackInsert", "trackDelete", "trackFormat"]);
595371
595540
  TRACK_CHANGE_IGNORED_ATTRIBUTE_KEYS2 = new Set(["id", "sourceId"]);
595372
595541
  });
595373
595542
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/mcp",
3
- "version": "0.3.0-next.6",
3
+ "version": "0.3.0-next.7",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc-mcp": "./dist/index.js"
@@ -18,8 +18,8 @@
18
18
  "@types/bun": "^1.3.8",
19
19
  "@types/node": "22.19.2",
20
20
  "typescript": "^5.9.2",
21
- "@superdoc/super-editor": "0.0.1",
22
- "superdoc": "1.29.0"
21
+ "superdoc": "1.29.0",
22
+ "@superdoc/super-editor": "0.0.1"
23
23
  },
24
24
  "publishConfig": {
25
25
  "access": "public"