@eigenpal/docx-js-editor 0.0.16 → 0.0.17

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 (171) hide show
  1. package/dist/FindReplaceDialog-K4GRE4JB.cjs +2 -0
  2. package/dist/FindReplaceDialog-K4GRE4JB.cjs.map +1 -0
  3. package/dist/{FindReplaceDialog-UMXCBBST.js → FindReplaceDialog-MMDEJORP.js} +2 -1
  4. package/dist/FindReplaceDialog-MMDEJORP.js.map +1 -0
  5. package/dist/{FootnotePropertiesDialog-TYQGPWPX.js → FootnotePropertiesDialog-HG4267LR.js} +2 -1
  6. package/dist/FootnotePropertiesDialog-HG4267LR.js.map +1 -0
  7. package/dist/{FootnotePropertiesDialog-OBQXOBJE.cjs → FootnotePropertiesDialog-V3YOIJCV.cjs} +2 -1
  8. package/dist/FootnotePropertiesDialog-V3YOIJCV.cjs.map +1 -0
  9. package/dist/{HyperlinkDialog-UOERZIBM.js → HyperlinkDialog-SCSX4RP7.js} +2 -1
  10. package/dist/HyperlinkDialog-SCSX4RP7.js.map +1 -0
  11. package/dist/HyperlinkDialog-YPKURBZK.cjs +2 -0
  12. package/dist/HyperlinkDialog-YPKURBZK.cjs.map +1 -0
  13. package/dist/{ImagePositionDialog-52FDANUK.js → ImagePositionDialog-CJYJ35PI.js} +2 -1
  14. package/dist/ImagePositionDialog-CJYJ35PI.js.map +1 -0
  15. package/dist/{ImagePositionDialog-ZK5WFBRC.cjs → ImagePositionDialog-IMVI7EXA.cjs} +2 -1
  16. package/dist/ImagePositionDialog-IMVI7EXA.cjs.map +1 -0
  17. package/dist/{ImagePropertiesDialog-YPSLPSF6.js → ImagePropertiesDialog-P7WN2ALR.js} +2 -1
  18. package/dist/ImagePropertiesDialog-P7WN2ALR.js.map +1 -0
  19. package/dist/{ImagePropertiesDialog-LU44RDIY.cjs → ImagePropertiesDialog-YS4KJRN7.cjs} +2 -1
  20. package/dist/ImagePropertiesDialog-YS4KJRN7.cjs.map +1 -0
  21. package/dist/{TablePropertiesDialog-KMOYHPGF.cjs → TablePropertiesDialog-CUQXUBQN.cjs} +2 -1
  22. package/dist/TablePropertiesDialog-CUQXUBQN.cjs.map +1 -0
  23. package/dist/{TablePropertiesDialog-OUUJAA7D.js → TablePropertiesDialog-ZHAYVHPZ.js} +2 -1
  24. package/dist/TablePropertiesDialog-ZHAYVHPZ.js.map +1 -0
  25. package/dist/{clipboard-BOocwmAM.d.ts → TableToolbar-RHX9L4h9.d.cts} +2 -125
  26. package/dist/{clipboard-Cx7cb3kX.d.cts → TableToolbar-RHX9L4h9.d.ts} +2 -125
  27. package/dist/chunk-7FEY3YWC.cjs +3 -0
  28. package/dist/chunk-7FEY3YWC.cjs.map +1 -0
  29. package/dist/chunk-AL62KQYJ.js +2 -0
  30. package/dist/chunk-AL62KQYJ.js.map +1 -0
  31. package/dist/{chunk-VTAS7VZ6.cjs → chunk-DJAEBZ33.cjs} +2 -1
  32. package/dist/chunk-DJAEBZ33.cjs.map +1 -0
  33. package/dist/{chunk-CTYOM6BE.js → chunk-M2T6XKT5.js} +2 -1
  34. package/dist/chunk-M2T6XKT5.js.map +1 -0
  35. package/dist/chunk-MXGYESPA.cjs +178 -0
  36. package/dist/chunk-MXGYESPA.cjs.map +1 -0
  37. package/dist/chunk-NMYD4OJZ.js +3 -0
  38. package/dist/chunk-NMYD4OJZ.js.map +1 -0
  39. package/dist/chunk-OD33FUTO.js +178 -0
  40. package/dist/chunk-OD33FUTO.js.map +1 -0
  41. package/dist/{chunk-PJVI53AH.js → chunk-Q6HUGWO6.js} +2 -1
  42. package/dist/chunk-Q6HUGWO6.js.map +1 -0
  43. package/dist/{chunk-XS2AQFMF.cjs → chunk-S26DZVRQ.cjs} +2 -1
  44. package/dist/chunk-S26DZVRQ.cjs.map +1 -0
  45. package/dist/chunk-V3MCDVZE.cjs +2 -0
  46. package/dist/chunk-V3MCDVZE.cjs.map +1 -0
  47. package/dist/{chunk-MLSHZVL7.js → chunk-VIEW4NAF.js} +6 -5
  48. package/dist/chunk-VIEW4NAF.js.map +1 -0
  49. package/dist/{chunk-OEOUMSWH.cjs → chunk-ZX4CSEL3.cjs} +6 -5
  50. package/dist/chunk-ZX4CSEL3.cjs.map +1 -0
  51. package/dist/core-plugins-reexport.cjs +2 -0
  52. package/dist/core-plugins-reexport.cjs.map +1 -0
  53. package/dist/core-plugins-reexport.d.cts +1 -0
  54. package/dist/core-plugins-reexport.d.ts +1 -0
  55. package/dist/core-plugins-reexport.js +2 -0
  56. package/dist/core-plugins-reexport.js.map +1 -0
  57. package/dist/core-reexport.cjs +2 -0
  58. package/dist/core-reexport.cjs.map +1 -0
  59. package/dist/core-reexport.d.cts +4 -0
  60. package/dist/core-reexport.d.ts +4 -0
  61. package/dist/core-reexport.js +2 -0
  62. package/dist/core-reexport.js.map +1 -0
  63. package/dist/headless-reexport.cjs +2 -0
  64. package/dist/headless-reexport.cjs.map +1 -0
  65. package/dist/headless-reexport.d.cts +1 -0
  66. package/dist/headless-reexport.d.ts +1 -0
  67. package/dist/headless-reexport.js +2 -0
  68. package/dist/headless-reexport.js.map +1 -0
  69. package/dist/index.cjs +10 -9
  70. package/dist/index.cjs.map +1 -0
  71. package/dist/index.d.cts +28 -257
  72. package/dist/index.d.ts +28 -257
  73. package/dist/index.js +10 -9
  74. package/dist/index.js.map +1 -0
  75. package/dist/mcp-reexport.cjs +2 -0
  76. package/dist/mcp-reexport.cjs.map +1 -0
  77. package/dist/mcp-reexport.d.cts +1 -0
  78. package/dist/mcp-reexport.d.ts +1 -0
  79. package/dist/mcp-reexport.js +2 -0
  80. package/dist/mcp-reexport.js.map +1 -0
  81. package/dist/react.cjs +2 -1
  82. package/dist/react.cjs.map +1 -0
  83. package/dist/react.d.cts +860 -9
  84. package/dist/react.d.ts +860 -9
  85. package/dist/react.js +2 -1
  86. package/dist/react.js.map +1 -0
  87. package/dist/styles.css +1 -1
  88. package/dist/ui.cjs +2 -1
  89. package/dist/ui.cjs.map +1 -0
  90. package/dist/ui.d.cts +5 -3
  91. package/dist/ui.d.ts +5 -3
  92. package/dist/ui.js +2 -1
  93. package/dist/ui.js.map +1 -0
  94. package/package.json +27 -87
  95. package/LICENSE +0 -21
  96. package/README.md +0 -171
  97. package/dist/DocumentAgent-Ci6_T-XM.d.ts +0 -412
  98. package/dist/DocumentAgent-DEGFgYEN.d.cts +0 -412
  99. package/dist/FindReplaceDialog-46BE7Q2G.cjs +0 -1
  100. package/dist/HyperlinkDialog-22NH7ZLP.cjs +0 -1
  101. package/dist/agentApi-CbVUCZRu.d.cts +0 -2086
  102. package/dist/agentApi-CbVUCZRu.d.ts +0 -2086
  103. package/dist/chunk-24N3L4IL.cjs +0 -258
  104. package/dist/chunk-2ASOEN3V.js +0 -1
  105. package/dist/chunk-46OFHSPJ.cjs +0 -2
  106. package/dist/chunk-65OFYOHF.cjs +0 -58
  107. package/dist/chunk-6YFGCUHU.js +0 -4
  108. package/dist/chunk-DYQUXFE5.cjs +0 -1
  109. package/dist/chunk-EMKABJPH.js +0 -1
  110. package/dist/chunk-ESI4BSBF.js +0 -1
  111. package/dist/chunk-FYAWM7MP.cjs +0 -1
  112. package/dist/chunk-GLFFXY2X.js +0 -258
  113. package/dist/chunk-ITWEFKGQ.cjs +0 -1
  114. package/dist/chunk-JKN7TNPA.js +0 -12
  115. package/dist/chunk-KESNGXGO.js +0 -1
  116. package/dist/chunk-L34XFLQZ.cjs +0 -1
  117. package/dist/chunk-NO7WUK5E.cjs +0 -12
  118. package/dist/chunk-NT2REEAA.cjs +0 -1
  119. package/dist/chunk-O7QVCJN6.cjs +0 -4
  120. package/dist/chunk-OW5H5DNE.cjs +0 -1
  121. package/dist/chunk-OWMXCVKB.js +0 -1
  122. package/dist/chunk-PXC7ARQB.cjs +0 -1
  123. package/dist/chunk-R5SKERM2.js +0 -1
  124. package/dist/chunk-RM3ITJ2H.cjs +0 -10
  125. package/dist/chunk-SF53KLDZ.cjs +0 -1
  126. package/dist/chunk-TOI5W3HK.js +0 -8
  127. package/dist/chunk-UAVOWAIF.cjs +0 -8
  128. package/dist/chunk-ULNHBTYA.js +0 -2
  129. package/dist/chunk-UXXV4GT6.js +0 -10
  130. package/dist/chunk-VOWKSURW.cjs +0 -1
  131. package/dist/chunk-WFWLPKQA.js +0 -1
  132. package/dist/chunk-WFYRA2TH.js +0 -1
  133. package/dist/chunk-YMXKVLTU.js +0 -58
  134. package/dist/chunk-ZDYHAYN6.js +0 -1
  135. package/dist/colorResolver-CIDiSPWd.d.cts +0 -618
  136. package/dist/colorResolver-KXbUgzWC.d.ts +0 -618
  137. package/dist/core-plugins.cjs +0 -1
  138. package/dist/core-plugins.d.cts +0 -31
  139. package/dist/core-plugins.d.ts +0 -31
  140. package/dist/core-plugins.js +0 -1
  141. package/dist/core.cjs +0 -1
  142. package/dist/core.d.cts +0 -23
  143. package/dist/core.d.ts +0 -23
  144. package/dist/core.js +0 -1
  145. package/dist/executor-ITYZTNSH.cjs +0 -1
  146. package/dist/executor-TC7CLATE.js +0 -1
  147. package/dist/headless.cjs +0 -4
  148. package/dist/headless.d.cts +0 -195
  149. package/dist/headless.d.ts +0 -195
  150. package/dist/headless.js +0 -4
  151. package/dist/index.css +0 -1
  152. package/dist/insertOperations-CzB5b-Of.d.ts +0 -176
  153. package/dist/insertOperations-DKVmCV32.d.cts +0 -176
  154. package/dist/mcp-cli.js +0 -136
  155. package/dist/mcp.cjs +0 -16
  156. package/dist/mcp.d.cts +0 -156
  157. package/dist/mcp.d.ts +0 -156
  158. package/dist/mcp.js +0 -16
  159. package/dist/processTemplate-525HZL4S.cjs +0 -1
  160. package/dist/processTemplate-RJN6452W.js +0 -1
  161. package/dist/react-BZxD04XV.d.ts +0 -1350
  162. package/dist/react-D8eAYckC.d.cts +0 -1350
  163. package/dist/react.css +0 -1
  164. package/dist/registry-D4tvj9f3.d.ts +0 -165
  165. package/dist/registry-ngv6Bumt.d.cts +0 -165
  166. package/dist/selectionRects-PQEUEW35.cjs +0 -1
  167. package/dist/selectionRects-QAG5RSHD.js +0 -1
  168. package/dist/types-D96elyJF.d.cts +0 -310
  169. package/dist/types-xMzSPT4i.d.ts +0 -310
  170. package/dist/variableDetector-CPxKo9jP.d.cts +0 -173
  171. package/dist/variableDetector-DeM1N-_L.d.ts +0 -173
package/dist/mcp.cjs DELETED
@@ -1,16 +0,0 @@
1
- 'use strict';var chunk65OFYOHF_cjs=require('./chunk-65OFYOHF.cjs'),chunkFYAWM7MP_cjs=require('./chunk-FYAWM7MP.cjs'),chunkNO7WUK5E_cjs=require('./chunk-NO7WUK5E.cjs'),chunkPXC7ARQB_cjs=require('./chunk-PXC7ARQB.cjs');require('./chunk-VOWKSURW.cjs');var u={type:"string",description:"Document ID returned from docx_load"},x={type:"object",properties:{paragraphIndex:{type:"number",description:"Index of the paragraph (0-indexed)",minimum:0},offset:{type:"number",description:"Character offset within the paragraph",minimum:0}},required:["paragraphIndex","offset"]},h={type:"object",properties:{start:x,end:x},required:["start","end"]},D={name:"docx_load",description:`Load a DOCX document from base64-encoded content.
2
- Returns a document ID that can be used with other tools.
3
- The document remains in session memory until closed.`,inputSchema:{type:"object",properties:{content:{type:"string",description:"Base64-encoded DOCX file content"},source:{type:"string",description:"Optional source filename or identifier for reference"}},required:["content"]},handler:async(r,s)=>{let{content:e,source:c}=r;try{let t=atob(e),n=new Uint8Array(t.length);for(let l=0;l<t.length;l++)n[l]=t.charCodeAt(l);let o=n.buffer,a=await chunkNO7WUK5E_cjs.p(o),d=`doc_${Date.now()}_${Math.random().toString(36).substr(2,9)}`;s.session.documents.set(d,{id:d,document:a,buffer:o,source:c,lastModified:Date.now()});let p=a.package.document.content.filter(l=>l.type==="paragraph").length;return {content:[{type:"text",text:JSON.stringify({documentId:d,source:c,paragraphCount:p,message:"Document loaded successfully"})}]}}catch(t){return {isError:true,content:[{type:"text",text:`Failed to load document: ${t.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}},C={name:"docx_save",description:`Export the document to base64-encoded DOCX format.
4
- Returns the document as a base64 string that can be saved to a file.`,inputSchema:{type:"object",properties:{documentId:u},required:["documentId"]},handler:async(r,s)=>{let{documentId:e}=r,c=s.session.documents.get(e);if(!c)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let t;c.buffer?t=await chunk65OFYOHF_cjs.d(c.document):t=await chunk65OFYOHF_cjs.e(c.document);let n=new Uint8Array(t),o="";for(let d=0;d<n.length;d++)o+=String.fromCharCode(n[d]);let a=btoa(o);return {content:[{type:"text",text:JSON.stringify({documentId:e,base64:a,size:t.byteLength,message:"Document exported successfully"})}]}}catch(t){return {isError:true,content:[{type:"text",text:`Failed to save document: ${t.message}`}]}}},annotations:{category:"core",readOnly:true,complexity:"low"}},R={name:"docx_close",description:`Close a document and free its memory.
5
- Use this when done working with a document.`,inputSchema:{type:"object",properties:{documentId:u},required:["documentId"]},handler:async(r,s)=>{let{documentId:e}=r;return s.session.documents.has(e)?(s.session.documents.delete(e),{content:[{type:"text",text:JSON.stringify({documentId:e,message:"Document closed"})}]}):{isError:true,content:[{type:"text",text:`Document not found: ${e}`}]}},annotations:{category:"core",readOnly:false,complexity:"low"}},k={name:"docx_get_info",description:`Get metadata and statistics about a document.
6
- Returns paragraph count, word count, table count, and other useful info.`,inputSchema:{type:"object",properties:{documentId:u},required:["documentId"]},handler:async(r,s)=>{let{documentId:e}=r,c=s.session.documents.get(e);if(!c)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};let t=c.document,n=t.package.document,o=n.content.filter(p=>p.type==="paragraph"),a=n.content.filter(p=>p.type==="table"),d=0;for(let p of o)if(p.type==="paragraph"){let l=P(p);d+=l.split(/\s+/).filter(y=>y.length>0).length;}return {content:[{type:"text",text:JSON.stringify({documentId:e,paragraphCount:o.length,tableCount:a.length,wordCount:d,hasStyles:!!t.package.styles,hasTheme:!!t.package.theme,source:c.source,lastModified:c.lastModified})}]}},annotations:{category:"core",readOnly:true,complexity:"low"}},$={name:"docx_get_text",description:`Get the plain text content of the document.
7
- Returns all text concatenated with paragraph breaks.
8
- Useful for understanding document content before making edits.`,inputSchema:{type:"object",properties:{documentId:u,maxLength:{type:"number",description:"Maximum characters to return (default: 10000)",default:1e4}},required:["documentId"]},handler:async(r,s)=>{let{documentId:e,maxLength:c=1e4}=r,t=s.session.documents.get(e);if(!t)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};let n=t.document.package.document,o=[];for(let p of n.content)p.type==="paragraph"?o.push(P(p)):p.type==="table"&&o.push("[TABLE]");let a=o.join(`
9
- `),d=a.length>c;return d&&(a=a.slice(0,c)+"..."),{content:[{type:"text",text:JSON.stringify({documentId:e,text:a,truncated:d,totalLength:d?o.join(`
10
- `).length:a.length})}]}},annotations:{category:"core",readOnly:true,complexity:"low"}},J={name:"docx_insert_text",description:`Insert text at a specific position in the document.
11
- Position is specified by paragraph index (0-indexed) and character offset.`,inputSchema:{type:"object",properties:{documentId:u,position:x,text:{type:"string",description:"Text to insert"}},required:["documentId","position","text"]},handler:async(r,s)=>{let{documentId:e,position:c,text:t}=r,n=s.session.documents.get(e);if(!n)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let o=chunkFYAWM7MP_cjs.a(n.document,{type:"insertText",position:c,text:t});return n.document=o,n.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,insertedLength:t.length,position:c})}]}}catch(o){return {isError:true,content:[{type:"text",text:`Failed to insert text: ${o.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}},v={name:"docx_replace_text",description:`Replace text in a range with new text.
12
- Specify start and end positions to define the range to replace.`,inputSchema:{type:"object",properties:{documentId:u,range:h,text:{type:"string",description:"Replacement text"}},required:["documentId","range","text"]},handler:async(r,s)=>{let{documentId:e,range:c,text:t}=r,n=s.session.documents.get(e);if(!n)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let o=chunkFYAWM7MP_cjs.a(n.document,{type:"replaceText",range:c,text:t});return n.document=o,n.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,replacedRange:c,newTextLength:t.length})}]}}catch(o){return {isError:true,content:[{type:"text",text:`Failed to replace text: ${o.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}},j={name:"docx_delete_text",description:`Delete text in a range.
13
- Specify start and end positions to define the range to delete.`,inputSchema:{type:"object",properties:{documentId:u,range:h},required:["documentId","range"]},handler:async(r,s)=>{let{documentId:e,range:c}=r,t=s.session.documents.get(e);if(!t)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let n=chunkFYAWM7MP_cjs.a(t.document,{type:"deleteText",range:c});return t.document=n,t.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,deletedRange:c})}]}}catch(n){return {isError:true,content:[{type:"text",text:`Failed to delete text: ${n.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}},E={name:"docx_format_text",description:`Apply formatting to text in a range.
14
- Supports bold, italic, underline, font size, font family, color, and highlight.`,inputSchema:{type:"object",properties:{documentId:u,range:h,formatting:{type:"object",description:"Formatting options to apply",properties:{bold:{type:"boolean"},italic:{type:"boolean"},underline:{type:"boolean"},strikethrough:{type:"boolean"},fontSize:{type:"number",description:"Font size in points"},fontFamily:{type:"string"},color:{type:"string",description:'Hex color (e.g., "#FF0000")'},highlight:{type:"string",description:"Highlight color name"}}}},required:["documentId","range","formatting"]},handler:async(r,s)=>{let{documentId:e,range:c,formatting:t}=r,n=s.session.documents.get(e);if(!n)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let o=chunkFYAWM7MP_cjs.a(n.document,{type:"formatText",range:c,formatting:t});return n.document=o,n.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,range:c,appliedFormatting:t})}]}}catch(o){return {isError:true,content:[{type:"text",text:`Failed to format text: ${o.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"medium"}},O={name:"docx_apply_style",description:`Apply a named style to a paragraph.
15
- Use document styles like "Heading1", "Heading2", "Normal", etc.`,inputSchema:{type:"object",properties:{documentId:u,paragraphIndex:{type:"number",description:"Index of the paragraph (0-indexed)",minimum:0},styleId:{type:"string",description:'Style ID (e.g., "Heading1", "Normal")'}},required:["documentId","paragraphIndex","styleId"]},handler:async(r,s)=>{let{documentId:e,paragraphIndex:c,styleId:t}=r,n=s.session.documents.get(e);if(!n)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let o=chunkFYAWM7MP_cjs.a(n.document,{type:"applyStyle",paragraphIndex:c,styleId:t});return n.document=o,n.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,paragraphIndex:c,styleId:t})}]}}catch(o){return {isError:true,content:[{type:"text",text:`Failed to apply style: ${o.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}};function P(r){let s=[];for(let e of r.content)e.type==="run"?s.push(_(e)):e.type==="hyperlink"&&s.push(A(e));return s.join("")}function _(r){return r.content.filter(s=>s.type==="text").map(s=>s.text).join("")}function A(r){let s=[];for(let e of r.children)e.type==="run"&&s.push(_(e));return s.join("")}var T=[D,C,R,k,$,J,v,j,E,O];function q(r={}){let{name:s="docx-editor",version:e="0.1.0",includeCoreTools:c=true,debug:t=false,additionalTools:n=[]}=r,o=new Map,a={id:`session_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,documents:new Map,data:new Map};if(c)for(let i of T)o.set(i.name,i),t&&console.log(`[MCP] Registered core tool: ${i.name}`);let d=chunkPXC7ARQB_cjs.b.getMcpTools();for(let i of d)o.has(i.name)&&console.warn(`[MCP] Tool '${i.name}' from plugin overrides existing tool`),o.set(i.name,i),t&&console.log(`[MCP] Registered plugin tool: ${i.name}`);for(let i of n)o.set(i.name,i),t&&console.log(`[MCP] Registered additional tool: ${i.name}`);let p=t?(i,f)=>{console.log(`[MCP] ${i}`,f??"");}:()=>{};async function l(i,f){let M=o.get(i);if(!M)throw new Error(`Unknown tool: ${i}`);p(`Calling tool: ${i}`,f);let N={session:a,log:p};try{let g=await M.handler(f,N);return p(`Tool ${i} completed`,g),g}catch(g){throw p(`Tool ${i} failed`,g),g}}function y(){return Array.from(o.values()).map(i=>({name:i.name,description:i.description,inputSchema:z(i.inputSchema),category:i.annotations?.category}))}function L(){return {name:s,version:e,toolCount:o.size}}return {tools:o,session:a,handleToolCall:l,listTools:y,getInfo:L}}async function F(r,s){let{id:e,method:c,params:t}=s;try{switch(c){case "initialize":return {jsonrpc:"2.0",id:e,result:{protocolVersion:"2024-11-05",capabilities:{tools:{}},serverInfo:r.getInfo()}};case "tools/list":{let n=r.listTools();return {jsonrpc:"2.0",id:e,result:{tools:n.map(o=>({name:o.name,description:o.description,inputSchema:o.inputSchema}))}}}case "tools/call":{let{name:n,arguments:o}=t,a=await r.handleToolCall(n,o);return {jsonrpc:"2.0",id:e,result:a}}default:return {jsonrpc:"2.0",id:e,error:{code:-32601,message:`Method not found: ${c}`}}}}catch(n){return {jsonrpc:"2.0",id:e,error:{code:-32e3,message:n.message}}}}async function H(r={}){let s=q(r);r.debug&&(console.error(`[MCP] Server started: ${s.getInfo().name} v${s.getInfo().version}`),console.error(`[MCP] Tools registered: ${s.tools.size}`));let c=(await import('readline')).createInterface({input:process.stdin,output:process.stdout,terminal:false}),t="";c.on("line",async n=>{t+=n;try{let o=JSON.parse(t);t="";let a=await F(s,o);process.stdout.write(JSON.stringify(a)+`
16
- `);}catch{}}),c.on("close",()=>{r.debug&&console.error("[MCP] Server closed"),process.exit(0);});}function z(r){return typeof r=="object"&&r!==null&&("type"in r||"properties"in r)?r:{type:"object",properties:{}}}exports.applyStyleTool=O;exports.closeDocumentTool=R;exports.coreMcpTools=T;exports.createMcpServer=q;exports.deleteTextTool=j;exports.formatTextTool=E;exports.getDocumentInfoTool=k;exports.getDocumentTextTool=$;exports.handleJsonRpcRequest=F;exports.insertTextTool=J;exports.loadDocumentTool=D;exports.replaceTextTool=v;exports.saveDocumentTool=C;exports.startStdioServer=H;
package/dist/mcp.d.cts DELETED
@@ -1,156 +0,0 @@
1
- import { a as McpToolDefinition, M as McpSession, J as JsonSchema } from './types-D96elyJF.cjs';
2
- import './agentApi-CbVUCZRu.cjs';
3
-
4
- /**
5
- * Core MCP Tools
6
- *
7
- * Built-in MCP tools for document operations that are always available.
8
- * These provide basic document manipulation without requiring plugins.
9
- */
10
-
11
- /**
12
- * Load a DOCX document from base64
13
- */
14
- declare const loadDocumentTool: McpToolDefinition;
15
- /**
16
- * Save a document to base64
17
- */
18
- declare const saveDocumentTool: McpToolDefinition;
19
- /**
20
- * Close a document
21
- */
22
- declare const closeDocumentTool: McpToolDefinition;
23
- /**
24
- * Get document information
25
- */
26
- declare const getDocumentInfoTool: McpToolDefinition;
27
- /**
28
- * Get document plain text
29
- */
30
- declare const getDocumentTextTool: McpToolDefinition;
31
- /**
32
- * Insert text at a position
33
- */
34
- declare const insertTextTool: McpToolDefinition;
35
- /**
36
- * Replace text in a range
37
- */
38
- declare const replaceTextTool: McpToolDefinition;
39
- /**
40
- * Delete text in a range
41
- */
42
- declare const deleteTextTool: McpToolDefinition;
43
- /**
44
- * Apply text formatting
45
- */
46
- declare const formatTextTool: McpToolDefinition;
47
- /**
48
- * Apply paragraph style
49
- */
50
- declare const applyStyleTool: McpToolDefinition;
51
- declare const coreMcpTools: McpToolDefinition[];
52
-
53
- /**
54
- * MCP Server
55
- *
56
- * Model Context Protocol server that exposes document editing tools to AI clients.
57
- * Discovers and registers tools from the plugin system plus core built-in tools.
58
- *
59
- * @example
60
- * ```ts
61
- * import { createMcpServer, startStdioServer } from '@eigenpal/docx-editor/mcp';
62
- * import { pluginRegistry, docxtemplaterPlugin } from '@eigenpal/docx-editor/core-plugins';
63
- *
64
- * // Register plugins
65
- * pluginRegistry.register(docxtemplaterPlugin);
66
- *
67
- * // Start MCP server
68
- * startStdioServer();
69
- * ```
70
- */
71
-
72
- /**
73
- * MCP Server configuration
74
- */
75
- interface McpServerConfig {
76
- /** Server name */
77
- name?: string;
78
- /** Server version */
79
- version?: string;
80
- /** Include core tools (default: true) */
81
- includeCoreTools?: boolean;
82
- /** Enable debug logging */
83
- debug?: boolean;
84
- /** Custom tools to add */
85
- additionalTools?: McpToolDefinition[];
86
- }
87
- /**
88
- * MCP Server instance
89
- */
90
- interface McpServer {
91
- /** All registered tools */
92
- tools: Map<string, McpToolDefinition>;
93
- /** Active session */
94
- session: McpSession;
95
- /** Handle a tool call */
96
- handleToolCall(toolName: string, input: unknown): Promise<unknown>;
97
- /** List available tools */
98
- listTools(): McpToolInfo[];
99
- /** Get server info */
100
- getInfo(): {
101
- name: string;
102
- version: string;
103
- toolCount: number;
104
- };
105
- }
106
- /**
107
- * Tool info for listing
108
- */
109
- interface McpToolInfo {
110
- name: string;
111
- description: string;
112
- inputSchema: JsonSchema;
113
- category?: string;
114
- }
115
- /**
116
- * Create an MCP server instance
117
- *
118
- * @param config - Server configuration
119
- * @returns MCP server instance
120
- */
121
- declare function createMcpServer(config?: McpServerConfig): McpServer;
122
- /**
123
- * JSON-RPC request
124
- */
125
- interface JsonRpcRequest {
126
- jsonrpc: '2.0';
127
- id: string | number;
128
- method: string;
129
- params?: unknown;
130
- }
131
- /**
132
- * JSON-RPC response
133
- */
134
- interface JsonRpcResponse {
135
- jsonrpc: '2.0';
136
- id: string | number;
137
- result?: unknown;
138
- error?: {
139
- code: number;
140
- message: string;
141
- data?: unknown;
142
- };
143
- }
144
- /**
145
- * Handle a JSON-RPC request
146
- */
147
- declare function handleJsonRpcRequest(server: McpServer, request: JsonRpcRequest): Promise<JsonRpcResponse>;
148
- /**
149
- * Start the MCP server with stdio transport
150
- *
151
- * Reads JSON-RPC requests from stdin, writes responses to stdout.
152
- * This is the standard way to run an MCP server for Claude Desktop.
153
- */
154
- declare function startStdioServer(config?: McpServerConfig): Promise<void>;
155
-
156
- export { type McpServer, type McpServerConfig, type McpToolInfo, applyStyleTool, closeDocumentTool, coreMcpTools, createMcpServer, deleteTextTool, formatTextTool, getDocumentInfoTool, getDocumentTextTool, handleJsonRpcRequest, insertTextTool, loadDocumentTool, replaceTextTool, saveDocumentTool, startStdioServer };
package/dist/mcp.d.ts DELETED
@@ -1,156 +0,0 @@
1
- import { a as McpToolDefinition, M as McpSession, J as JsonSchema } from './types-xMzSPT4i.js';
2
- import './agentApi-CbVUCZRu.js';
3
-
4
- /**
5
- * Core MCP Tools
6
- *
7
- * Built-in MCP tools for document operations that are always available.
8
- * These provide basic document manipulation without requiring plugins.
9
- */
10
-
11
- /**
12
- * Load a DOCX document from base64
13
- */
14
- declare const loadDocumentTool: McpToolDefinition;
15
- /**
16
- * Save a document to base64
17
- */
18
- declare const saveDocumentTool: McpToolDefinition;
19
- /**
20
- * Close a document
21
- */
22
- declare const closeDocumentTool: McpToolDefinition;
23
- /**
24
- * Get document information
25
- */
26
- declare const getDocumentInfoTool: McpToolDefinition;
27
- /**
28
- * Get document plain text
29
- */
30
- declare const getDocumentTextTool: McpToolDefinition;
31
- /**
32
- * Insert text at a position
33
- */
34
- declare const insertTextTool: McpToolDefinition;
35
- /**
36
- * Replace text in a range
37
- */
38
- declare const replaceTextTool: McpToolDefinition;
39
- /**
40
- * Delete text in a range
41
- */
42
- declare const deleteTextTool: McpToolDefinition;
43
- /**
44
- * Apply text formatting
45
- */
46
- declare const formatTextTool: McpToolDefinition;
47
- /**
48
- * Apply paragraph style
49
- */
50
- declare const applyStyleTool: McpToolDefinition;
51
- declare const coreMcpTools: McpToolDefinition[];
52
-
53
- /**
54
- * MCP Server
55
- *
56
- * Model Context Protocol server that exposes document editing tools to AI clients.
57
- * Discovers and registers tools from the plugin system plus core built-in tools.
58
- *
59
- * @example
60
- * ```ts
61
- * import { createMcpServer, startStdioServer } from '@eigenpal/docx-editor/mcp';
62
- * import { pluginRegistry, docxtemplaterPlugin } from '@eigenpal/docx-editor/core-plugins';
63
- *
64
- * // Register plugins
65
- * pluginRegistry.register(docxtemplaterPlugin);
66
- *
67
- * // Start MCP server
68
- * startStdioServer();
69
- * ```
70
- */
71
-
72
- /**
73
- * MCP Server configuration
74
- */
75
- interface McpServerConfig {
76
- /** Server name */
77
- name?: string;
78
- /** Server version */
79
- version?: string;
80
- /** Include core tools (default: true) */
81
- includeCoreTools?: boolean;
82
- /** Enable debug logging */
83
- debug?: boolean;
84
- /** Custom tools to add */
85
- additionalTools?: McpToolDefinition[];
86
- }
87
- /**
88
- * MCP Server instance
89
- */
90
- interface McpServer {
91
- /** All registered tools */
92
- tools: Map<string, McpToolDefinition>;
93
- /** Active session */
94
- session: McpSession;
95
- /** Handle a tool call */
96
- handleToolCall(toolName: string, input: unknown): Promise<unknown>;
97
- /** List available tools */
98
- listTools(): McpToolInfo[];
99
- /** Get server info */
100
- getInfo(): {
101
- name: string;
102
- version: string;
103
- toolCount: number;
104
- };
105
- }
106
- /**
107
- * Tool info for listing
108
- */
109
- interface McpToolInfo {
110
- name: string;
111
- description: string;
112
- inputSchema: JsonSchema;
113
- category?: string;
114
- }
115
- /**
116
- * Create an MCP server instance
117
- *
118
- * @param config - Server configuration
119
- * @returns MCP server instance
120
- */
121
- declare function createMcpServer(config?: McpServerConfig): McpServer;
122
- /**
123
- * JSON-RPC request
124
- */
125
- interface JsonRpcRequest {
126
- jsonrpc: '2.0';
127
- id: string | number;
128
- method: string;
129
- params?: unknown;
130
- }
131
- /**
132
- * JSON-RPC response
133
- */
134
- interface JsonRpcResponse {
135
- jsonrpc: '2.0';
136
- id: string | number;
137
- result?: unknown;
138
- error?: {
139
- code: number;
140
- message: string;
141
- data?: unknown;
142
- };
143
- }
144
- /**
145
- * Handle a JSON-RPC request
146
- */
147
- declare function handleJsonRpcRequest(server: McpServer, request: JsonRpcRequest): Promise<JsonRpcResponse>;
148
- /**
149
- * Start the MCP server with stdio transport
150
- *
151
- * Reads JSON-RPC requests from stdin, writes responses to stdout.
152
- * This is the standard way to run an MCP server for Claude Desktop.
153
- */
154
- declare function startStdioServer(config?: McpServerConfig): Promise<void>;
155
-
156
- export { type McpServer, type McpServerConfig, type McpToolInfo, applyStyleTool, closeDocumentTool, coreMcpTools, createMcpServer, deleteTextTool, formatTextTool, getDocumentInfoTool, getDocumentTextTool, handleJsonRpcRequest, insertTextTool, loadDocumentTool, replaceTextTool, saveDocumentTool, startStdioServer };
package/dist/mcp.js DELETED
@@ -1,16 +0,0 @@
1
- import {d,e}from'./chunk-YMXKVLTU.js';import {a}from'./chunk-WFWLPKQA.js';import {p}from'./chunk-JKN7TNPA.js';import {b}from'./chunk-R5SKERM2.js';import'./chunk-OWMXCVKB.js';var u={type:"string",description:"Document ID returned from docx_load"},x={type:"object",properties:{paragraphIndex:{type:"number",description:"Index of the paragraph (0-indexed)",minimum:0},offset:{type:"number",description:"Character offset within the paragraph",minimum:0}},required:["paragraphIndex","offset"]},h={type:"object",properties:{start:x,end:x},required:["start","end"]},D={name:"docx_load",description:`Load a DOCX document from base64-encoded content.
2
- Returns a document ID that can be used with other tools.
3
- The document remains in session memory until closed.`,inputSchema:{type:"object",properties:{content:{type:"string",description:"Base64-encoded DOCX file content"},source:{type:"string",description:"Optional source filename or identifier for reference"}},required:["content"]},handler:async(r,s)=>{let{content:e,source:c}=r;try{let t=atob(e),n=new Uint8Array(t.length);for(let l=0;l<t.length;l++)n[l]=t.charCodeAt(l);let o=n.buffer,a=await p(o),d=`doc_${Date.now()}_${Math.random().toString(36).substr(2,9)}`;s.session.documents.set(d,{id:d,document:a,buffer:o,source:c,lastModified:Date.now()});let p$1=a.package.document.content.filter(l=>l.type==="paragraph").length;return {content:[{type:"text",text:JSON.stringify({documentId:d,source:c,paragraphCount:p$1,message:"Document loaded successfully"})}]}}catch(t){return {isError:true,content:[{type:"text",text:`Failed to load document: ${t.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}},C={name:"docx_save",description:`Export the document to base64-encoded DOCX format.
4
- Returns the document as a base64 string that can be saved to a file.`,inputSchema:{type:"object",properties:{documentId:u},required:["documentId"]},handler:async(r,s)=>{let{documentId:e$1}=r,c=s.session.documents.get(e$1);if(!c)return {isError:true,content:[{type:"text",text:`Document not found: ${e$1}`}]};try{let t;c.buffer?t=await d(c.document):t=await e(c.document);let n=new Uint8Array(t),o="";for(let d=0;d<n.length;d++)o+=String.fromCharCode(n[d]);let a=btoa(o);return {content:[{type:"text",text:JSON.stringify({documentId:e$1,base64:a,size:t.byteLength,message:"Document exported successfully"})}]}}catch(t){return {isError:true,content:[{type:"text",text:`Failed to save document: ${t.message}`}]}}},annotations:{category:"core",readOnly:true,complexity:"low"}},R={name:"docx_close",description:`Close a document and free its memory.
5
- Use this when done working with a document.`,inputSchema:{type:"object",properties:{documentId:u},required:["documentId"]},handler:async(r,s)=>{let{documentId:e}=r;return s.session.documents.has(e)?(s.session.documents.delete(e),{content:[{type:"text",text:JSON.stringify({documentId:e,message:"Document closed"})}]}):{isError:true,content:[{type:"text",text:`Document not found: ${e}`}]}},annotations:{category:"core",readOnly:false,complexity:"low"}},k={name:"docx_get_info",description:`Get metadata and statistics about a document.
6
- Returns paragraph count, word count, table count, and other useful info.`,inputSchema:{type:"object",properties:{documentId:u},required:["documentId"]},handler:async(r,s)=>{let{documentId:e}=r,c=s.session.documents.get(e);if(!c)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};let t=c.document,n=t.package.document,o=n.content.filter(p=>p.type==="paragraph"),a=n.content.filter(p=>p.type==="table"),d=0;for(let p of o)if(p.type==="paragraph"){let l=P(p);d+=l.split(/\s+/).filter(y=>y.length>0).length;}return {content:[{type:"text",text:JSON.stringify({documentId:e,paragraphCount:o.length,tableCount:a.length,wordCount:d,hasStyles:!!t.package.styles,hasTheme:!!t.package.theme,source:c.source,lastModified:c.lastModified})}]}},annotations:{category:"core",readOnly:true,complexity:"low"}},$={name:"docx_get_text",description:`Get the plain text content of the document.
7
- Returns all text concatenated with paragraph breaks.
8
- Useful for understanding document content before making edits.`,inputSchema:{type:"object",properties:{documentId:u,maxLength:{type:"number",description:"Maximum characters to return (default: 10000)",default:1e4}},required:["documentId"]},handler:async(r,s)=>{let{documentId:e,maxLength:c=1e4}=r,t=s.session.documents.get(e);if(!t)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};let n=t.document.package.document,o=[];for(let p of n.content)p.type==="paragraph"?o.push(P(p)):p.type==="table"&&o.push("[TABLE]");let a=o.join(`
9
- `),d=a.length>c;return d&&(a=a.slice(0,c)+"..."),{content:[{type:"text",text:JSON.stringify({documentId:e,text:a,truncated:d,totalLength:d?o.join(`
10
- `).length:a.length})}]}},annotations:{category:"core",readOnly:true,complexity:"low"}},J={name:"docx_insert_text",description:`Insert text at a specific position in the document.
11
- Position is specified by paragraph index (0-indexed) and character offset.`,inputSchema:{type:"object",properties:{documentId:u,position:x,text:{type:"string",description:"Text to insert"}},required:["documentId","position","text"]},handler:async(r,s)=>{let{documentId:e,position:c,text:t}=r,n=s.session.documents.get(e);if(!n)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let o=a(n.document,{type:"insertText",position:c,text:t});return n.document=o,n.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,insertedLength:t.length,position:c})}]}}catch(o){return {isError:true,content:[{type:"text",text:`Failed to insert text: ${o.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}},v={name:"docx_replace_text",description:`Replace text in a range with new text.
12
- Specify start and end positions to define the range to replace.`,inputSchema:{type:"object",properties:{documentId:u,range:h,text:{type:"string",description:"Replacement text"}},required:["documentId","range","text"]},handler:async(r,s)=>{let{documentId:e,range:c,text:t}=r,n=s.session.documents.get(e);if(!n)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let o=a(n.document,{type:"replaceText",range:c,text:t});return n.document=o,n.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,replacedRange:c,newTextLength:t.length})}]}}catch(o){return {isError:true,content:[{type:"text",text:`Failed to replace text: ${o.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}},j={name:"docx_delete_text",description:`Delete text in a range.
13
- Specify start and end positions to define the range to delete.`,inputSchema:{type:"object",properties:{documentId:u,range:h},required:["documentId","range"]},handler:async(r,s)=>{let{documentId:e,range:c}=r,t=s.session.documents.get(e);if(!t)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let n=a(t.document,{type:"deleteText",range:c});return t.document=n,t.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,deletedRange:c})}]}}catch(n){return {isError:true,content:[{type:"text",text:`Failed to delete text: ${n.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}},E={name:"docx_format_text",description:`Apply formatting to text in a range.
14
- Supports bold, italic, underline, font size, font family, color, and highlight.`,inputSchema:{type:"object",properties:{documentId:u,range:h,formatting:{type:"object",description:"Formatting options to apply",properties:{bold:{type:"boolean"},italic:{type:"boolean"},underline:{type:"boolean"},strikethrough:{type:"boolean"},fontSize:{type:"number",description:"Font size in points"},fontFamily:{type:"string"},color:{type:"string",description:'Hex color (e.g., "#FF0000")'},highlight:{type:"string",description:"Highlight color name"}}}},required:["documentId","range","formatting"]},handler:async(r,s)=>{let{documentId:e,range:c,formatting:t}=r,n=s.session.documents.get(e);if(!n)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let o=a(n.document,{type:"formatText",range:c,formatting:t});return n.document=o,n.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,range:c,appliedFormatting:t})}]}}catch(o){return {isError:true,content:[{type:"text",text:`Failed to format text: ${o.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"medium"}},O={name:"docx_apply_style",description:`Apply a named style to a paragraph.
15
- Use document styles like "Heading1", "Heading2", "Normal", etc.`,inputSchema:{type:"object",properties:{documentId:u,paragraphIndex:{type:"number",description:"Index of the paragraph (0-indexed)",minimum:0},styleId:{type:"string",description:'Style ID (e.g., "Heading1", "Normal")'}},required:["documentId","paragraphIndex","styleId"]},handler:async(r,s)=>{let{documentId:e,paragraphIndex:c,styleId:t}=r,n=s.session.documents.get(e);if(!n)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let o=a(n.document,{type:"applyStyle",paragraphIndex:c,styleId:t});return n.document=o,n.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,paragraphIndex:c,styleId:t})}]}}catch(o){return {isError:true,content:[{type:"text",text:`Failed to apply style: ${o.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}};function P(r){let s=[];for(let e of r.content)e.type==="run"?s.push(_(e)):e.type==="hyperlink"&&s.push(A(e));return s.join("")}function _(r){return r.content.filter(s=>s.type==="text").map(s=>s.text).join("")}function A(r){let s=[];for(let e of r.children)e.type==="run"&&s.push(_(e));return s.join("")}var T=[D,C,R,k,$,J,v,j,E,O];function q(r={}){let{name:s="docx-editor",version:e="0.1.0",includeCoreTools:c=true,debug:t=false,additionalTools:n=[]}=r,o=new Map,a={id:`session_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,documents:new Map,data:new Map};if(c)for(let i of T)o.set(i.name,i),t&&console.log(`[MCP] Registered core tool: ${i.name}`);let d=b.getMcpTools();for(let i of d)o.has(i.name)&&console.warn(`[MCP] Tool '${i.name}' from plugin overrides existing tool`),o.set(i.name,i),t&&console.log(`[MCP] Registered plugin tool: ${i.name}`);for(let i of n)o.set(i.name,i),t&&console.log(`[MCP] Registered additional tool: ${i.name}`);let p=t?(i,f)=>{console.log(`[MCP] ${i}`,f??"");}:()=>{};async function l(i,f){let M=o.get(i);if(!M)throw new Error(`Unknown tool: ${i}`);p(`Calling tool: ${i}`,f);let N={session:a,log:p};try{let g=await M.handler(f,N);return p(`Tool ${i} completed`,g),g}catch(g){throw p(`Tool ${i} failed`,g),g}}function y(){return Array.from(o.values()).map(i=>({name:i.name,description:i.description,inputSchema:z(i.inputSchema),category:i.annotations?.category}))}function L(){return {name:s,version:e,toolCount:o.size}}return {tools:o,session:a,handleToolCall:l,listTools:y,getInfo:L}}async function F(r,s){let{id:e,method:c,params:t}=s;try{switch(c){case "initialize":return {jsonrpc:"2.0",id:e,result:{protocolVersion:"2024-11-05",capabilities:{tools:{}},serverInfo:r.getInfo()}};case "tools/list":{let n=r.listTools();return {jsonrpc:"2.0",id:e,result:{tools:n.map(o=>({name:o.name,description:o.description,inputSchema:o.inputSchema}))}}}case "tools/call":{let{name:n,arguments:o}=t,a=await r.handleToolCall(n,o);return {jsonrpc:"2.0",id:e,result:a}}default:return {jsonrpc:"2.0",id:e,error:{code:-32601,message:`Method not found: ${c}`}}}}catch(n){return {jsonrpc:"2.0",id:e,error:{code:-32e3,message:n.message}}}}async function H(r={}){let s=q(r);r.debug&&(console.error(`[MCP] Server started: ${s.getInfo().name} v${s.getInfo().version}`),console.error(`[MCP] Tools registered: ${s.tools.size}`));let c=(await import('readline')).createInterface({input:process.stdin,output:process.stdout,terminal:false}),t="";c.on("line",async n=>{t+=n;try{let o=JSON.parse(t);t="";let a=await F(s,o);process.stdout.write(JSON.stringify(a)+`
16
- `);}catch{}}),c.on("close",()=>{r.debug&&console.error("[MCP] Server closed"),process.exit(0);});}function z(r){return typeof r=="object"&&r!==null&&("type"in r||"properties"in r)?r:{type:"object",properties:{}}}export{O as applyStyleTool,R as closeDocumentTool,T as coreMcpTools,q as createMcpServer,j as deleteTextTool,E as formatTextTool,k as getDocumentInfoTool,$ as getDocumentTextTool,F as handleJsonRpcRequest,J as insertTextTool,D as loadDocumentTool,v as replaceTextTool,C as saveDocumentTool,H as startStdioServer};
@@ -1 +0,0 @@
1
- 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var chunkITWEFKGQ_cjs=require('./chunk-ITWEFKGQ.cjs');require('./chunk-VOWKSURW.cjs');Object.defineProperty(exports,"createTemplateProcessor",{enumerable:true,get:function(){return chunkITWEFKGQ_cjs.j}});Object.defineProperty(exports,"default",{enumerable:true,get:function(){return chunkITWEFKGQ_cjs.k}});Object.defineProperty(exports,"getMissingVariables",{enumerable:true,get:function(){return chunkITWEFKGQ_cjs.g}});Object.defineProperty(exports,"getTemplateTags",{enumerable:true,get:function(){return chunkITWEFKGQ_cjs.e}});Object.defineProperty(exports,"previewTemplate",{enumerable:true,get:function(){return chunkITWEFKGQ_cjs.h}});Object.defineProperty(exports,"processTemplate",{enumerable:true,get:function(){return chunkITWEFKGQ_cjs.a}});Object.defineProperty(exports,"processTemplateAdvanced",{enumerable:true,get:function(){return chunkITWEFKGQ_cjs.i}});Object.defineProperty(exports,"processTemplateAndDownload",{enumerable:true,get:function(){return chunkITWEFKGQ_cjs.d}});Object.defineProperty(exports,"processTemplateAsBlob",{enumerable:true,get:function(){return chunkITWEFKGQ_cjs.c}});Object.defineProperty(exports,"processTemplateDetailed",{enumerable:true,get:function(){return chunkITWEFKGQ_cjs.b}});Object.defineProperty(exports,"validateTemplate",{enumerable:true,get:function(){return chunkITWEFKGQ_cjs.f}});
@@ -1 +0,0 @@
1
- export{j as createTemplateProcessor,k as default,g as getMissingVariables,e as getTemplateTags,h as previewTemplate,a as processTemplate,i as processTemplateAdvanced,d as processTemplateAndDownload,c as processTemplateAsBlob,b as processTemplateDetailed,f as validateTemplate}from'./chunk-ESI4BSBF.js';import'./chunk-OWMXCVKB.js';