@superdoc/mcp 1.4.0-next.5 → 1.4.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 +113 -12
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -31330,7 +31330,7 @@ var init_host = __esm(() => {
31330
31330
  });
31331
31331
 
31332
31332
  // ../../packages/sdk/langs/node/src/runtime/sdk-version.generated.ts
31333
- var SDK_VERSION = "2.17.0-next.5";
31333
+ var SDK_VERSION = "2.17.0-next.7";
31334
31334
 
31335
31335
  // ../../packages/sdk/langs/node/src/runtime/embedded-platform.ts
31336
31336
  import { chmodSync, existsSync } from "node:fs";
@@ -125090,6 +125090,34 @@ function isSdtContentEditable(sdtXml) {
125090
125090
  return true;
125091
125091
  }
125092
125092
 
125093
+ // ../../../v2/editor-core/dist/document/internal/symbol-character.js
125094
+ function resolveSymbolCharacter(font, code) {
125095
+ if (!font || !code || !/^[0-9a-fA-F]{4}$/.test(code))
125096
+ return null;
125097
+ const value = Number.parseInt(code, 16);
125098
+ const normalizedFont = font.trim().toLowerCase();
125099
+ const legacyMap = SYMBOL_CHARACTER_MAP[normalizedFont];
125100
+ if (legacyMap) {
125101
+ if ((value & 65280) !== 61440 && (value & 65280) !== 0)
125102
+ return null;
125103
+ return legacyMap[value & 255] ?? null;
125104
+ }
125105
+ if (normalizedFont === "webdings" || /^wingdings\s+\d+$/.test(normalizedFont))
125106
+ return null;
125107
+ if (value < 32 || value >= 55296 && value <= 57343 || value >= 57344 && value <= 63743) {
125108
+ return null;
125109
+ }
125110
+ return String.fromCharCode(value);
125111
+ }
125112
+ var SYMBOL_CHARACTER_MAP;
125113
+ var init_symbol_character = __esm(() => {
125114
+ SYMBOL_CHARACTER_MAP = {
125115
+ symbol: { 183: "•" },
125116
+ wingdings: { 168: "\uD83D\uDF8E", 111: "\uD83D\uDF8F", 224: "\uD83E\uDC6A" },
125117
+ "wingdings 2": { 82: "☑", 80: "\uD83D\uDDF8" }
125118
+ };
125119
+ });
125120
+
125093
125121
  // ../../../v2/editor-core/dist/document/internal/paragraph-inline-model.js
125094
125122
  function getParagraphInlineModelAllocationDiagnostics() {
125095
125123
  return {
@@ -125273,6 +125301,16 @@ function parseRun(source, run, ctx) {
125273
125301
  case "noBreakHyphen":
125274
125302
  leaves.push(buildControlPiece(child, ctx, runProperties, runByteStart, runByteEnd, runCharStart, runCharEnd, runOpenTag, runCloseTag));
125275
125303
  break;
125304
+ case "sym": {
125305
+ if (ctx.instruction)
125306
+ break;
125307
+ const bindings = extendNamespaceBindings(ctx.namespaceBindings, child.openTag);
125308
+ const font = readAttrByNamespace(child.openTag, bindings, NS_W, "font");
125309
+ const code = readAttrByNamespace(child.openTag, bindings, NS_W, "char");
125310
+ const glyph = resolveSymbolCharacter(font ?? undefined, code ?? undefined);
125311
+ leaves.push(glyph ? buildControlPiece(child, ctx, runProperties, runByteStart, runByteEnd, runCharStart, runCharEnd, runOpenTag, runCloseTag, glyph) : buildUnknownLeaf(child, ctx, "unsupported-symbol"));
125312
+ break;
125313
+ }
125276
125314
  case "fldChar":
125277
125315
  leaves.push(buildFieldCharMarker(child, ctx, atomicRunSpan, run.openTag));
125278
125316
  break;
@@ -125391,14 +125429,18 @@ function buildTextPiece(source, node2, ctx, runProperties, runByteStart, runByte
125391
125429
  rawXml: node2.xml
125392
125430
  };
125393
125431
  }
125394
- function buildControlPiece(node2, ctx, runProperties, runByteStart, runByteEnd, runCharStart, runCharEnd, runOpenTag, runCloseTag) {
125432
+ function buildControlPiece(node2, ctx, runProperties, runByteStart, runByteEnd, runCharStart, runCharEnd, runOpenTag, runCloseTag, symbolText) {
125395
125433
  return {
125396
125434
  kind: "control",
125397
- control: node2.local,
125435
+ control: node2.local === "sym" ? "symbol" : node2.local,
125436
+ ...symbolText ? { symbolText } : {},
125398
125437
  deleted: ctx.deleted,
125399
125438
  charBoundaries: [
125400
125439
  { char: 0, byte: node2.byteStart },
125401
- { char: 1, byte: node2.byteEnd }
125440
+ ...Array.from({ length: symbolText?.length ?? 1 }, (_, index) => ({
125441
+ char: index + 1,
125442
+ byte: node2.byteEnd
125443
+ }))
125402
125444
  ],
125403
125445
  runByteStart,
125404
125446
  runByteEnd,
@@ -125871,7 +125913,7 @@ function visibleWidth(piece) {
125871
125913
  if (piece.kind === "text")
125872
125914
  return piece.textRole === "visible" ? piece.decodedText.length : 0;
125873
125915
  if (piece.kind === "control")
125874
- return piece.deleted ? 0 : 1;
125916
+ return piece.deleted ? 0 : piece.symbolText?.length ?? 1;
125875
125917
  if (piece.kind === "noteReference")
125876
125918
  return piece.deleted ? 0 : 1;
125877
125919
  return 0;
@@ -125880,7 +125922,7 @@ function trackedWidth(piece) {
125880
125922
  if (piece.kind === "text")
125881
125923
  return piece.textRole === "instruction" ? 0 : piece.decodedText.length;
125882
125924
  if (piece.kind === "control")
125883
- return 1;
125925
+ return piece.symbolText?.length ?? 1;
125884
125926
  if (piece.kind === "noteReference")
125885
125927
  return 1;
125886
125928
  return 0;
@@ -125903,7 +125945,7 @@ function projectText(pieces, space) {
125903
125945
  }
125904
125946
  if (piece.kind === "control") {
125905
125947
  if (space === "tracked" || !piece.deleted)
125906
- out += controlChar(piece.control);
125948
+ out += piece.symbolText ?? controlChar(piece.control);
125907
125949
  continue;
125908
125950
  }
125909
125951
  if (piece.kind === "noteReference") {
@@ -126101,6 +126143,7 @@ var editGradeInlineModelBuildCount = 0, denseUtf8CharIndexBuildCount = 0;
126101
126143
  var init_paragraph_inline_model = __esm(() => {
126102
126144
  init_xml_sax();
126103
126145
  init_xml_text();
126146
+ init_symbol_character();
126104
126147
  });
126105
126148
 
126106
126149
  // ../../../v2/editor-core/dist/document/internal/paragraph-text-projection.js
@@ -126310,6 +126353,34 @@ function projectRun2(xml, runStart, run, deleted, instruction, namespaceScopes,
126310
126353
  case "noBreakHyphen":
126311
126354
  appendControl(collector, "‑", deleted);
126312
126355
  break;
126356
+ case "sym": {
126357
+ if (instruction)
126358
+ break;
126359
+ const bindings = new Map;
126360
+ for (let index = 0;index < namespaceScopes.length; index += 2) {
126361
+ for (const attribute of scanRawXmlAttributes(xml.slice(namespaceScopes[index], namespaceScopes[index + 1]))) {
126362
+ if (attribute.name === "xmlns")
126363
+ bindings.set("", attribute.value);
126364
+ else if (attribute.name.startsWith("xmlns:"))
126365
+ bindings.set(attribute.name.slice(6), attribute.value);
126366
+ }
126367
+ }
126368
+ if (!bindings.has(collector.inferredWordPrefix))
126369
+ bindings.set(collector.inferredWordPrefix, NS_W);
126370
+ const tag = xml.slice(childStart, child.openEnd);
126371
+ for (const attribute of scanRawXmlAttributes(tag)) {
126372
+ if (attribute.name === "xmlns")
126373
+ bindings.set("", attribute.value);
126374
+ else if (attribute.name.startsWith("xmlns:"))
126375
+ bindings.set(attribute.name.slice(6), attribute.value);
126376
+ }
126377
+ const font = readXmlAttributeValueByNamespace(tag, bindings, NS_W, "font");
126378
+ const code = readXmlAttributeValueByNamespace(tag, bindings, NS_W, "char");
126379
+ const glyph = resolveSymbolCharacter(font == null ? undefined : decodeXmlText(font), code == null ? undefined : decodeXmlText(code));
126380
+ if (glyph)
126381
+ appendSymbol(collector, glyph, deleted);
126382
+ break;
126383
+ }
126313
126384
  case "footnoteReference":
126314
126385
  case "endnoteReference":
126315
126386
  appendNoteReference(collector, deleted);
@@ -126350,6 +126421,16 @@ function appendText(collector, rawText, role) {
126350
126421
  collector.telemetry.decodedTextCodeUnits += decodedLength;
126351
126422
  }
126352
126423
  }
126424
+ function appendSymbol(collector, value, deleted) {
126425
+ if (!deleted) {
126426
+ collector.visibleLength += value.length;
126427
+ collector.visibleChunks?.push(value);
126428
+ }
126429
+ collector.trackedLength += value.length;
126430
+ collector.trackedChunks?.push(value);
126431
+ if (collector.telemetry)
126432
+ collector.telemetry.controlCount += 1;
126433
+ }
126353
126434
  function appendControl(collector, value, deleted) {
126354
126435
  if (!deleted) {
126355
126436
  collector.visibleLength += 1;
@@ -126615,6 +126696,7 @@ var init_paragraph_text_projection = __esm(() => {
126615
126696
  init_xml_sax();
126616
126697
  init_paragraph_inline_model();
126617
126698
  init_xml_text();
126699
+ init_symbol_character();
126618
126700
  DECODED_ENTITY_PATTERN = /&(lt|gt|amp|quot|apos|#\d+|#x[0-9a-fA-F]+);/g;
126619
126701
  });
126620
126702
 
@@ -153415,10 +153497,12 @@ var init_content_types = __esm(() => {
153415
153497
 
153416
153498
  // ../../../v2/editor-core/dist/opc/package-open.js
153417
153499
  function isCompleteOpenedPartBytes(opened, partUri, bytes) {
153418
- if (!bytes || bytes.byteLength === 0)
153500
+ if (!bytes)
153419
153501
  return false;
153420
153502
  const expected = opened.parts.get(normalizePartUri(partUri))?.uncompressedSize;
153421
- return typeof expected !== "number" || expected <= 0 || bytes.byteLength === expected;
153503
+ if (bytes.byteLength === 0)
153504
+ return expected === 0;
153505
+ return typeof expected !== "number" || expected < 0 || bytes.byteLength === expected;
153422
153506
  }
153423
153507
  function readCompleteOpenedPartBytes(opened, partUri) {
153424
153508
  const fromZip = opened.zip.readPayload(partUri);
@@ -183123,7 +183207,11 @@ function buildParagraphOffsetMap(bytes, byteStart, byteEnd, options) {
183123
183207
  continue;
183124
183208
  }
183125
183209
  addBoundary(chars, byteStart + leaf.byteStart);
183126
- chars += 1;
183210
+ const width = leaf.kind === "control" ? leaf.symbolText?.length ?? 1 : 1;
183211
+ for (let index = 1;index < width; index += 1) {
183212
+ addBoundary(chars + index, byteStart + leaf.byteEnd);
183213
+ }
183214
+ chars += width;
183127
183215
  addBoundary(chars, byteStart + leaf.byteEnd);
183128
183216
  }
183129
183217
  addBoundary(chars, byteEnd);
@@ -347053,6 +347141,19 @@ function collectTokens(pieces, input, containers, trackedWrappers, out) {
347053
347141
  continue;
347054
347142
  }
347055
347143
  if (piece.kind === "control") {
347144
+ if (piece.control === "symbol") {
347145
+ out.push({
347146
+ kind: "text",
347147
+ text: piece.symbolText,
347148
+ source: sourceSpan(piece.trackedStart, piece.trackedEnd, input),
347149
+ byteStart: input.paragraphByteStart + piece.runByteStart,
347150
+ byteEnd: input.paragraphByteStart + piece.runByteEnd,
347151
+ runProperties: piece.runProperties,
347152
+ containers,
347153
+ trackedWrappers
347154
+ });
347155
+ continue;
347156
+ }
347056
347157
  out.push({
347057
347158
  kind: piece.control === "tab" ? "tab" : "lineBreak",
347058
347159
  ...piece.control === "tab" ? {} : { breakType: readBreakType(piece.rawXml) },
@@ -389068,11 +389169,11 @@ function walkPieces(pieces, from, to, out, notes, styleContext, review) {
389068
389169
  break;
389069
389170
  }
389070
389171
  case "control": {
389071
- if (piece.control === "tab") {
389172
+ if (piece.control === "tab" || piece.control === "symbol") {
389072
389173
  const marks = resolveRunMarks(piece.runProperties, styleContext);
389073
389174
  out.push({
389074
389175
  kind: "run",
389075
- run: serializePasteRun("\t", marks, piece, piece.visibleStart, piece.visibleEnd, review)
389176
+ run: serializePasteRun(piece.symbolText ?? "\t", marks, piece, piece.visibleStart, piece.visibleEnd, review)
389076
389177
  });
389077
389178
  } else {
389078
389179
  out.push({ kind: "break" });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc/mcp",
3
- "version": "1.4.0-next.5",
3
+ "version": "1.4.0-next.7",
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.17.0-next.5",
27
+ "@superdoc/sdk": "2.17.0-next.7",
28
28
  "debug": "^4.4.3",
29
29
  "zod": "^4.3.6"
30
30
  },
31
31
  "devDependencies": {
32
- "superdoc": "2.20.0-next.7",
33
- "@superdoc/docx-engine": "0.19.0-next.8",
32
+ "superdoc": "2.20.0-next.9",
33
+ "@superdoc/docx-engine": "0.19.0-next.10",
34
34
  "@superdoc/document-api": "0.1.0-alpha.0",
35
35
  "@types/bun": "^1.3.8",
36
36
  "@types/node": "22.19.2",