@eigenpal/docx-editor-agents 0.4.1 → 0.4.3

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 (40) hide show
  1. package/dist/ai-sdk/server.js +1 -1
  2. package/dist/ai-sdk/server.mjs +1 -1
  3. package/dist/bridge.d.mts +1 -1
  4. package/dist/bridge.d.ts +1 -1
  5. package/dist/bridge.js +1 -1
  6. package/dist/bridge.mjs +1 -1
  7. package/dist/{chunk-TICYYVCD.mjs → chunk-24MVJKCP.mjs} +2 -2
  8. package/dist/{chunk-WGUYD2A2.mjs → chunk-74RQEWM7.mjs} +1 -1
  9. package/dist/{chunk-HTCA4A6G.mjs → chunk-H7HNGCMH.mjs} +1 -1
  10. package/dist/{chunk-AMRM73UC.mjs → chunk-HSAYNLBS.mjs} +1 -1
  11. package/dist/{chunk-U7PAJJYD.js → chunk-MREPAMXX.js} +1 -1
  12. package/dist/{chunk-O7DEBIDX.js → chunk-NLYXACTI.js} +2 -2
  13. package/dist/chunk-OVPN5UGH.js +71 -0
  14. package/dist/chunk-PNONETA3.mjs +71 -0
  15. package/dist/{chunk-T5P2DWHN.js → chunk-RI5S75JY.js} +2 -2
  16. package/dist/{chunk-3HEONW4M.js → chunk-YCUXBRD7.js} +3 -3
  17. package/dist/{headless-PZWHORT6.mjs → headless-ASQ6WVGY.mjs} +1 -1
  18. package/dist/headless-VE2YU7ZB.js +1 -0
  19. package/dist/index.d.mts +2 -2
  20. package/dist/index.d.ts +2 -2
  21. package/dist/index.js +1 -1
  22. package/dist/index.mjs +1 -1
  23. package/dist/mcp.d.mts +1 -1
  24. package/dist/mcp.d.ts +1 -1
  25. package/dist/mcp.js +2 -2
  26. package/dist/mcp.mjs +1 -1
  27. package/dist/react.d.mts +2 -2
  28. package/dist/react.d.ts +2 -2
  29. package/dist/react.js +1 -1
  30. package/dist/react.mjs +1 -1
  31. package/dist/{server-B7dGWiLh.d.mts → server-CLaXsEC8.d.mts} +36 -4
  32. package/dist/{server-B7dGWiLh.d.ts → server-CLaXsEC8.d.ts} +36 -4
  33. package/dist/server.d.mts +1 -1
  34. package/dist/server.d.ts +1 -1
  35. package/dist/server.js +1 -1
  36. package/dist/server.mjs +1 -1
  37. package/package.json +2 -1
  38. package/dist/chunk-25L7AEDN.mjs +0 -71
  39. package/dist/chunk-VF25WARH.js +0 -71
  40. package/dist/headless-B7TGKW6I.js +0 -1
@@ -1,8 +1,8 @@
1
- 'use strict';var d=["single","words","double","thick","dotted","dottedHeavy","dash","dashedHeavy","dashLong","dashLongHeavy","dotDash","dashDotHeavy","dotDotDash","dashDotDotHeavy","wave","wavyHeavy","wavyDouble","none"],o=["black","blue","cyan","darkBlue","darkCyan","darkGray","darkGreen","darkMagenta","darkRed","darkYellow","green","lightGray","magenta","red","white","yellow","none"],c={name:"apply_formatting",displayName:"Applying formatting",description:'Apply character formatting (bold, italic, underline, strike, color, highlight, font size, font family) to a paragraph or to a unique phrase within it. Pass `search` to scope the change to part of the paragraph; omit it to format the whole paragraph. Direct edit \u2014 does not create a tracked change. Pass `false` to clear a mark; omit a key to leave it untouched. Color uses `{rgb: "FF0000"}` (no hash) or `{themeColor: "accent1"}`. Font size is in points. Font family takes `{ascii, hAnsi}`.',inputSchema:{type:"object",properties:{paraId:{type:"string",description:"Paragraph id from read_document / find_text."},search:{type:"string",description:"Optional: format only this exact phrase within the paragraph (must be unique)."},marks:{type:"object",description:"Marks to set or clear. Omit a key to leave it untouched.",properties:{bold:{type:"boolean"},italic:{type:"boolean"},underline:{description:'true \u2192 single underline; false \u2192 clear; or { style: "single"|"double"|"thick"|"dotted"|"dottedHeavy"|"dash"|"dashedHeavy"|"dashLong"|"dashLongHeavy"|"dotDash"|"dashDotHeavy"|"dotDotDash"|"dashDotDotHeavy"|"wave"|"wavyHeavy"|"wavyDouble"|"words"|"none" }. Other values are rejected.'},strike:{type:"boolean"},color:{type:"object",description:'Either {rgb: "RRGGBB"} (no hash) or {themeColor: "accent1"|"text1"|...}.',properties:{rgb:{type:"string"},themeColor:{type:"string"}}},highlight:{type:"string",enum:[...o,""],description:"Highlight color \u2014 must be one of the Word-supported names: "+o.join(", ")+". Pass empty string to clear. Hex values are rejected (Word does not accept hex for <w:highlight>)."},fontSize:{type:"number",description:"Size in points (e.g. 12, 14, 24)."},fontFamily:{type:"object",properties:{ascii:{type:"string"},hAnsi:{type:"string"}}}}}},required:["paraId","marks"]},handler:(e,r)=>{if(!e.marks||Object.keys(e.marks).length===0)return {success:false,error:"No marks provided. Specify at least one of bold/italic/etc."};let t=typeof e.marks.underline=="object"&&e.marks.underline!==null?e.marks.underline.style:void 0;if(t&&!d.includes(t))return {success:false,error:`Invalid underline.style "${t}". Must be one of: ${d.join(", ")}.`};let n=typeof e.marks.highlight=="string"?e.marks.highlight:void 0;return n&&!o.includes(n)?{success:false,error:`Invalid highlight "${n}". Must be one of: ${o.join(", ")}. Hex values are not supported by Word's highlight attribute.`}:r.applyFormatting({paraId:e.paraId,search:e.search,marks:e.marks})?{success:true,data:`Formatting applied to ${e.search?`"${e.search}" in ${e.paraId}`:e.paraId}.`}:{success:false,error:"Could not apply formatting. The paraId may not exist, or `search` is missing / ambiguous."}}},p={name:"set_paragraph_style",displayName:"Setting paragraph style",description:`Apply a paragraph style by id (e.g. "Heading1", "Heading2", "Title", "Quote", "Normal"). The styleId must exist in the document's style definitions \u2014 unknown ids are no-ops. Direct edit, not a tracked change.`,inputSchema:{type:"object",properties:{paraId:{type:"string",description:"Paragraph id from read_document / find_text."},styleId:{type:"string",description:'Style id (e.g. "Heading1", "Title", "Quote", "Normal").'}},required:["paraId","styleId"]},handler:(e,r)=>r.setParagraphStyle({paraId:e.paraId,styleId:e.styleId})?{success:true,data:`Style "${e.styleId}" applied to ${e.paraId}.`}:{success:false,error:`Could not set style. paraId "${e.paraId}" not found, or styleId "${e.styleId}" is not defined.`}};var l={name:"read_page",displayName:"Reading page",description:`Read the contents of one rendered page (1-indexed). Returns paragraphs on the page, each tagged with its stable paraId. Use this when the user asks "summarize page 3" or "comment on what's on this page".`,inputSchema:{type:"object",properties:{pageNumber:{type:"number",description:"1-indexed page number."}},required:["pageNumber"]},handler:(e,r)=>{let t=r.getPage(e.pageNumber);if(!t){let n=r.getTotalPages();return n===0?{success:false,error:"No pages rendered (headless mode or empty document)."}:{success:false,error:`Page ${e.pageNumber} does not exist (document has ${n} page${n===1?"":"s"}).`}}return {success:true,data:t.text||"(empty page)"}}},m={name:"read_pages",displayName:"Reading pages",description:"Read a contiguous range of rendered pages (1-indexed, inclusive). Returns paragraphs across the range, each tagged with paraId. Cheaper than calling read_page repeatedly \u2014 single round-trip.",inputSchema:{type:"object",properties:{from:{type:"number",description:"1-indexed start page (inclusive)."},to:{type:"number",description:"1-indexed end page (inclusive)."}},required:["from","to"]},handler:(e,r)=>{let t=r.getPages({from:e.from,to:e.to});if(t.length===0){let a=r.getTotalPages();return a===0?{success:false,error:"No pages rendered (headless mode or empty document)."}:{success:false,error:`No pages in range ${e.from}\u2013${e.to} (document has ${a} page${a===1?"":"s"}).`}}return {success:true,data:t.map(a=>`--- Page ${a.pageNumber} ---
1
+ 'use strict';var d=["single","words","double","thick","dotted","dottedHeavy","dash","dashedHeavy","dashLong","dashLongHeavy","dotDash","dashDotHeavy","dotDotDash","dashDotDotHeavy","wave","wavyHeavy","wavyDouble","none"],o=["black","blue","cyan","darkBlue","darkCyan","darkGray","darkGreen","darkMagenta","darkRed","darkYellow","green","lightGray","magenta","red","white","yellow","none"],c={name:"apply_formatting",displayName:"Applying formatting",description:'Apply character formatting (bold, italic, underline, strike, color, highlight, font size, font family) to a paragraph or to a unique phrase within it. Pass `search` to scope the change to part of the paragraph; omit it to format the whole paragraph. Direct edit \u2014 does not create a tracked change. Pass `false` to clear a mark; omit a key to leave it untouched. Color uses `{rgb: "FF0000"}` (no hash) or `{themeColor: "accent1"}`. Font size is in points. Font family takes `{ascii, hAnsi}`.',inputSchema:{type:"object",properties:{paraId:{type:"string",description:"Paragraph id from read_document / find_text."},search:{type:"string",description:"Optional: format only this exact phrase within the paragraph (must be unique)."},marks:{type:"object",description:"Marks to set or clear. Omit a key to leave it untouched.",properties:{bold:{type:"boolean"},italic:{type:"boolean"},underline:{description:'true \u2192 single underline; false \u2192 clear; or { style: "single"|"double"|"thick"|"dotted"|"dottedHeavy"|"dash"|"dashedHeavy"|"dashLong"|"dashLongHeavy"|"dotDash"|"dashDotHeavy"|"dotDotDash"|"dashDotDotHeavy"|"wave"|"wavyHeavy"|"wavyDouble"|"words"|"none" }. Other values are rejected.'},strike:{type:"boolean"},color:{type:"object",description:'Either {rgb: "RRGGBB"} (no hash) or {themeColor: "accent1"|"text1"|...}.',properties:{rgb:{type:"string"},themeColor:{type:"string"}}},highlight:{type:"string",enum:[...o],description:"Highlight color \u2014 must be one of the Word-supported names: "+o.join(", ")+'. Pass "none" to clear. Hex values are rejected (Word does not accept hex for <w:highlight>).'},fontSize:{type:"number",description:"Size in points (e.g. 12, 14, 24)."},fontFamily:{type:"object",properties:{ascii:{type:"string"},hAnsi:{type:"string"}}}}}},required:["paraId","marks"]},handler:(e,r)=>{if(!e.marks||Object.keys(e.marks).length===0)return {success:false,error:"No marks provided. Specify at least one of bold/italic/etc."};let t=typeof e.marks.underline=="object"&&e.marks.underline!==null?e.marks.underline.style:void 0;if(t&&!d.includes(t))return {success:false,error:`Invalid underline.style "${t}". Must be one of: ${d.join(", ")}.`};let n=typeof e.marks.highlight=="string"?e.marks.highlight:void 0;if(n&&!o.includes(n))return {success:false,error:`Invalid highlight "${n}". Must be one of: ${o.join(", ")}. Hex values are not supported by Word's highlight attribute.`};let a=n==="none"?{...e.marks,highlight:""}:e.marks;return r.applyFormatting({paraId:e.paraId,search:e.search,marks:a})?{success:true,data:`Formatting applied to ${e.search?`"${e.search}" in ${e.paraId}`:e.paraId}.`}:{success:false,error:"Could not apply formatting. The paraId may not exist, or `search` is missing / ambiguous."}}},p={name:"set_paragraph_style",displayName:"Setting paragraph style",description:`Apply a paragraph style by id (e.g. "Heading1", "Heading2", "Title", "Quote", "Normal"). The styleId must exist in the document's style definitions \u2014 unknown ids are no-ops. Direct edit, not a tracked change.`,inputSchema:{type:"object",properties:{paraId:{type:"string",description:"Paragraph id from read_document / find_text."},styleId:{type:"string",description:'Style id (e.g. "Heading1", "Title", "Quote", "Normal").'}},required:["paraId","styleId"]},handler:(e,r)=>r.setParagraphStyle({paraId:e.paraId,styleId:e.styleId})?{success:true,data:`Style "${e.styleId}" applied to ${e.paraId}.`}:{success:false,error:`Could not set style. paraId "${e.paraId}" not found, or styleId "${e.styleId}" is not defined.`}};var l={name:"read_page",displayName:"Reading page",description:`Read the contents of one rendered page (1-indexed). Returns paragraphs on the page, each tagged with its stable paraId. Use this when the user asks "summarize page 3" or "comment on what's on this page".`,inputSchema:{type:"object",properties:{pageNumber:{type:"number",description:"1-indexed page number."}},required:["pageNumber"]},handler:(e,r)=>{let t=r.getPage(e.pageNumber);if(!t){let n=r.getTotalPages();return n===0?{success:false,error:"No pages rendered (headless mode or empty document)."}:{success:false,error:`Page ${e.pageNumber} does not exist (document has ${n} page${n===1?"":"s"}).`}}return {success:true,data:t.text||"(empty page)"}}},m={name:"read_pages",displayName:"Reading pages",description:"Read a contiguous range of rendered pages (1-indexed, inclusive). Returns paragraphs across the range, each tagged with paraId. Cheaper than calling read_page repeatedly \u2014 single round-trip.",inputSchema:{type:"object",properties:{from:{type:"number",description:"1-indexed start page (inclusive)."},to:{type:"number",description:"1-indexed end page (inclusive)."}},required:["from","to"]},handler:(e,r)=>{let t=r.getPages({from:e.from,to:e.to});if(t.length===0){let a=r.getTotalPages();return a===0?{success:false,error:"No pages rendered (headless mode or empty document)."}:{success:false,error:`No pages in range ${e.from}\u2013${e.to} (document has ${a} page${a===1?"":"s"}).`}}return {success:true,data:t.map(a=>`--- Page ${a.pageNumber} ---
2
2
  ${a.text||"(empty page)"}`).join(`
3
3
 
4
4
  `)}}};var h={name:"read_document",displayName:"Reading document",description:'Read the document content. Returns lines tagged with a stable paragraph id, e.g. "[2A1F3B] First paragraph". Use the bracketed id as `paraId` when commenting or suggesting changes \u2014 it survives edits, unlike ordinal indices. Returns the vanilla document (the doc as it exists right now, before any tracked suggestions are accepted): pending insertions are HIDDEN, pending deletions are shown as plain text (still part of the document until accepted), and comment markers are stripped. Use read_changes / read_comments to inspect what is pending.',inputSchema:{type:"object",properties:{fromIndex:{type:"number",description:"Start ordinal index (inclusive). Optional."},toIndex:{type:"number",description:"End ordinal index (inclusive). Optional."}}},handler:(e,r)=>({success:true,data:r.getContentAsText({fromIndex:e.fromIndex,toIndex:e.toIndex,includeTrackedChanges:false,includeCommentAnchors:false})})},g={name:"read_selection",displayName:"Reading selection",description:'Read the user\'s current cursor or selection. Returns the selected text, the paragraph it lives in, and that paragraph\'s `paraId`. Use this when the user asks "fix this" or "review what I have selected".',inputSchema:{type:"object",properties:{}},handler:(e,r)=>{let t=r.getSelection();return t?{success:true,data:t}:{success:false,error:"No selection (editor not focused)."}}},u={name:"find_text",displayName:"Finding text",description:"Locate paragraphs containing `query`. Returns up to `limit` handles, each with `paraId`, the matched substring, and surrounding context. Pass any returned `paraId` (and the `match` as `search`) to add_comment / suggest_change.",inputSchema:{type:"object",properties:{query:{type:"string",description:"Text to find (substring match)."},caseSensitive:{type:"boolean",description:"Default: false."},limit:{type:"number",description:"Max paragraphs to return. Default: 20."}},required:["query"]},handler:(e,r)=>{let t=r.findText(e.query,{caseSensitive:e.caseSensitive,limit:e.limit});return t.length===0?{success:true,data:"No matches."}:{success:true,data:t}}},y={name:"read_comments",displayName:"Reading comments",description:"List all comments in the document with their paragraph anchors.",inputSchema:{type:"object",properties:{}},handler:(e,r)=>{let t=r.getComments();return t.length===0?{success:true,data:"No comments."}:{success:true,data:t.map(a=>`[Comment #${a.id}] ${a.author}: "${a.text}"`+(a.anchoredText?` (anchored to: "${a.anchoredText}")`:"")+(a.replies.length>0?`
5
5
  `+a.replies.map(s=>` Reply by ${s.author}: "${s.text}"`).join(`
6
6
  `):"")).join(`
7
7
  `)}}},f={name:"read_changes",displayName:"Reading changes",description:"List tracked changes (insertions / deletions) currently in the document.",inputSchema:{type:"object",properties:{}},handler:(e,r)=>{let t=r.getChanges();return t.length===0?{success:true,data:"No tracked changes."}:{success:true,data:t.map(a=>`[Change #${a.id}] ${a.type} by ${a.author}: "${a.text}"`).join(`
8
- `)}}},b={name:"add_comment",displayName:"Adding comment",description:"Attach a comment to a paragraph, optionally anchored to a unique phrase within it. The user sees it instantly in the comments sidebar.",inputSchema:{type:"object",properties:{paraId:{type:"string",description:"Paragraph id from read_document / find_text."},text:{type:"string",description:"Comment body."},search:{type:"string",description:"Optional: anchor to this exact phrase within the paragraph. Must be unique."}},required:["paraId","text"]},handler:(e,r)=>{let t=r.addComment({paraId:e.paraId,text:e.text,search:e.search});return t===null?{success:false,error:"Could not add comment. The paraId may not exist, or `search` is missing / ambiguous."}:{success:true,data:`Comment ${t} added on ${e.paraId}.`}}},I={name:"suggest_change",displayName:"Suggesting change",description:"Suggest a tracked change. Three modes: (1) replacement \u2014 `search` non-empty, `replaceWith` non-empty; (2) deletion \u2014 `search` non-empty, `replaceWith` empty; (3) insertion at paragraph end \u2014 `search` empty, `replaceWith` non-empty. The user can accept or reject in the editor UI.",inputSchema:{type:"object",properties:{paraId:{type:"string",description:"Paragraph id from read_document / find_text."},search:{type:"string",description:"Phrase to find (must be unique). Empty string = insert at paragraph end."},replaceWith:{type:"string",description:"Replacement text. Empty string = delete the matched phrase."}},required:["paraId","search","replaceWith"]},handler:(e,r)=>r.proposeChange({paraId:e.paraId,search:e.search,replaceWith:e.replaceWith})?e.search?e.replaceWith?{success:true,data:`Replacement proposed: "${e.search}" \u2192 "${e.replaceWith}" on ${e.paraId}.`}:{success:true,data:`Deletion proposed: "${e.search}" on ${e.paraId}.`}:{success:true,data:`Insertion proposed on ${e.paraId}.`}:{success:false,error:"Could not propose change. Possible causes: paraId not found; search missing or ambiguous; or the target overlaps an existing tracked change."}},x={name:"reply_comment",displayName:"Replying to comment",description:"Reply to an existing comment by id. Threaded under the original.",inputSchema:{type:"object",properties:{commentId:{type:"number",description:"Comment id from read_comments."},text:{type:"string",description:"Reply body."}},required:["commentId","text"]},handler:(e,r)=>{let t=r.replyTo(e.commentId,{text:e.text});return t===null?{success:false,error:`Comment #${e.commentId} not found.`}:{success:true,data:`Reply ${t} added to comment ${e.commentId}.`}}},k={name:"resolve_comment",displayName:"Resolving comment",description:"Mark a comment as resolved (done).",inputSchema:{type:"object",properties:{commentId:{type:"number",description:"Comment id from read_comments."}},required:["commentId"]},handler:(e,r)=>(r.resolveComment(e.commentId),{success:true,data:`Comment ${e.commentId} resolved.`})},v={name:"scroll",displayName:"Scrolling",description:"Scroll the editor to a paragraph by paraId. Does not move the user's cursor.",inputSchema:{type:"object",properties:{paraId:{type:"string",description:"Paragraph id from read_document / find_text."}},required:["paraId"]},handler:(e,r)=>r.scrollTo(e.paraId)?{success:true,data:`Scrolled to ${e.paraId}.`}:{success:false,error:`paraId ${e.paraId} not found.`}},i=[h,g,l,m,u,y,f,b,I,c,p,x,k,v];function C(e,r,t){let n=i.find(a=>a.name===e);if(!n)return {success:false,error:`Unknown tool: ${e}`};try{return n.handler(r,t)}catch(a){return {success:false,error:a instanceof Error?a.message:String(a)}}}function _(e){let r=i.find(n=>n.name===e);if(r?.displayName)return r.displayName;let t=e.replace(/_/g," ");return t.charAt(0).toUpperCase()+t.slice(1)}function N(){return i.map(e=>({type:"function",function:{name:e.name,description:e.description,parameters:e.inputSchema}}))}exports.a=i;exports.b=C;exports.c=_;exports.d=N;
8
+ `)}}},b={name:"add_comment",displayName:"Adding comment",description:"Attach a comment to a paragraph, optionally anchored to a unique phrase within it. The user sees it instantly in the comments sidebar.",inputSchema:{type:"object",properties:{paraId:{type:"string",description:"Paragraph id from read_document / find_text."},text:{type:"string",description:"Comment body."},search:{type:"string",description:"Optional: anchor to this exact phrase within the paragraph. Must be unique."}},required:["paraId","text"]},handler:(e,r)=>{let t=r.addComment({paraId:e.paraId,text:e.text,search:e.search});return t===null?{success:false,error:"Could not add comment. The paraId may not exist, or `search` is missing / ambiguous."}:{success:true,data:`Comment ${t} added on ${e.paraId}.`}}},I={name:"suggest_change",displayName:"Suggesting change",description:"Suggest a tracked change. Three modes: (1) replacement \u2014 `search` non-empty, `replaceWith` non-empty; (2) deletion \u2014 `search` non-empty, `replaceWith` empty; (3) insertion at paragraph end \u2014 `search` empty, `replaceWith` non-empty. The user can accept or reject in the editor UI.",inputSchema:{type:"object",properties:{paraId:{type:"string",description:"Paragraph id from read_document / find_text."},search:{type:"string",description:"Phrase to find (must be unique). Empty string = insert at paragraph end."},replaceWith:{type:"string",description:"Replacement text. Empty string = delete the matched phrase."}},required:["paraId","search","replaceWith"]},handler:(e,r)=>r.proposeChange({paraId:e.paraId,search:e.search,replaceWith:e.replaceWith})?e.search?e.replaceWith?{success:true,data:`Replacement proposed: "${e.search}" \u2192 "${e.replaceWith}" on ${e.paraId}.`}:{success:true,data:`Deletion proposed: "${e.search}" on ${e.paraId}.`}:{success:true,data:`Insertion proposed on ${e.paraId}.`}:{success:false,error:"Could not propose change. Possible causes: paraId not found; search missing or ambiguous; or the target overlaps an existing tracked change."}},x={name:"reply_comment",displayName:"Replying to comment",description:"Reply to an existing comment by id. Threaded under the original.",inputSchema:{type:"object",properties:{commentId:{type:"number",description:"Comment id from read_comments."},text:{type:"string",description:"Reply body."}},required:["commentId","text"]},handler:(e,r)=>{let t=r.replyTo(e.commentId,{text:e.text});return t===null?{success:false,error:`Comment #${e.commentId} not found.`}:{success:true,data:`Reply ${t} added to comment ${e.commentId}.`}}},k={name:"resolve_comment",displayName:"Resolving comment",description:"Mark a comment as resolved (done).",inputSchema:{type:"object",properties:{commentId:{type:"number",description:"Comment id from read_comments."}},required:["commentId"]},handler:(e,r)=>(r.resolveComment(e.commentId),{success:true,data:`Comment ${e.commentId} resolved.`})},v={name:"scroll",displayName:"Scrolling",description:"Scroll the editor to a paragraph by paraId. Does not move the user's cursor.",inputSchema:{type:"object",properties:{paraId:{type:"string",description:"Paragraph id from read_document / find_text."}},required:["paraId"]},handler:(e,r)=>r.scrollTo(e.paraId)?{success:true,data:`Scrolled to ${e.paraId}.`}:{success:false,error:`paraId ${e.paraId} not found.`}},i=[h,g,l,m,u,y,f,b,I,c,p,x,k,v];function _(e,r,t){let n=i.find(a=>a.name===e);if(!n)return {success:false,error:`Unknown tool: ${e}`};try{return n.handler(r,t)}catch(a){return {success:false,error:a instanceof Error?a.message:String(a)}}}function N(e){let r=i.find(n=>n.name===e);if(r?.displayName)return r.displayName;let t=e.replace(/_/g," ");return t.charAt(0).toUpperCase()+t.slice(1)}function w(){return i.map(e=>({type:"function",function:{name:e.name,description:e.description,parameters:e.inputSchema}}))}exports.a=i;exports.b=_;exports.c=N;exports.d=w;
@@ -1,5 +1,5 @@
1
- 'use strict';var chunkVF25WARH_js=require('./chunk-VF25WARH.js');function h(s){return s.type==="insertion"||s.type==="deletion"||s.type==="moveFrom"||s.type==="moveTo"}function x(s){let n=[];for(let o of s)o.type==="run"?n.push(chunkVF25WARH_js.Q(o)):o.type==="hyperlink"&&n.push(chunkVF25WARH_js.R(o));return n.join("")}function K(s,n){let o=0;for(let t of s.content)if(t.type==="paragraph"){if(o===n)return t;o++;}else if(t.type==="table"){for(let r of t.rows)for(let e of r.cells)for(let a of e.content)if(a.type==="paragraph"){if(o===n)return a;o++;}}else o++;throw new Error(`Paragraph index ${n} out of bounds (max: ${o-1})`)}function R(s,n){let o=0;for(let t of s.content)if(t.type==="paragraph"){if(n(t,o)===false)return;o++;}else if(t.type==="table"){for(let r of t.rows)for(let e of r.cells)for(let a of e.content)if(a.type==="paragraph"){if(n(a,o)===false)return;o++;}}else o++;}function V(s,n={}){let{fromIndex:o,toIndex:t,includeTrackedChanges:r=true,includeCommentAnchors:e=true}=n,a=[],i=0;for(let c of s.content)if(c.type==="paragraph")w(i,o,t)&&a.push(L(c,i,r,e)),i++;else if(c.type==="table"){w(i,o,t)&&a.push(H(c,i,r,e));for(let l of c.rows)for(let u of l.cells)for(let p of u.content)p.type==="paragraph"&&i++;}else i++;return a}function w(s,n,o){return (n===void 0||s>=n)&&(o===void 0||s<=o)}function L(s,n,o,t){let r=B(s,o,t),e=s.formatting?.styleId,a=s.paraId;return chunkVF25WARH_js.ba(e)?{type:"heading",index:n,paraId:a,level:chunkVF25WARH_js.ca(e)??1,text:r}:s.listRendering?{type:"list-item",index:n,paraId:a,text:r,listLevel:s.listRendering.level??0,listType:s.listRendering.isBullet?"bullet":"number"}:{type:"paragraph",index:n,paraId:a,text:r}}function H(s,n,o,t){let r=[],e=[];for(let a of s.rows){let i=[],c=[];for(let l of a.cells){let u=[],p;for(let g of l.content)g.type==="paragraph"&&(p===void 0&&(p=g.paraId),u.push(B(g,o,t)));i.push(u.join(`
1
+ 'use strict';var chunkOVPN5UGH_js=require('./chunk-OVPN5UGH.js');function h(s){return s.type==="insertion"||s.type==="deletion"||s.type==="moveFrom"||s.type==="moveTo"}function x(s){let n=[];for(let o of s)o.type==="run"?n.push(chunkOVPN5UGH_js.Q(o)):o.type==="hyperlink"&&n.push(chunkOVPN5UGH_js.R(o));return n.join("")}function K(s,n){let o=0;for(let t of s.content)if(t.type==="paragraph"){if(o===n)return t;o++;}else if(t.type==="table"){for(let r of t.rows)for(let e of r.cells)for(let a of e.content)if(a.type==="paragraph"){if(o===n)return a;o++;}}else o++;throw new Error(`Paragraph index ${n} out of bounds (max: ${o-1})`)}function R(s,n){let o=0;for(let t of s.content)if(t.type==="paragraph"){if(n(t,o)===false)return;o++;}else if(t.type==="table"){for(let r of t.rows)for(let e of r.cells)for(let a of e.content)if(a.type==="paragraph"){if(n(a,o)===false)return;o++;}}else o++;}function V(s,n={}){let{fromIndex:o,toIndex:t,includeTrackedChanges:r=true,includeCommentAnchors:e=true}=n,a=[],i=0;for(let c of s.content)if(c.type==="paragraph")w(i,o,t)&&a.push(L(c,i,r,e)),i++;else if(c.type==="table"){w(i,o,t)&&a.push(H(c,i,r,e));for(let l of c.rows)for(let u of l.cells)for(let p of u.content)p.type==="paragraph"&&i++;}else i++;return a}function w(s,n,o){return (n===void 0||s>=n)&&(o===void 0||s<=o)}function L(s,n,o,t){let r=B(s,o,t),e=s.formatting?.styleId,a=s.paraId;return chunkOVPN5UGH_js.ba(e)?{type:"heading",index:n,paraId:a,level:chunkOVPN5UGH_js.ca(e)??1,text:r}:s.listRendering?{type:"list-item",index:n,paraId:a,text:r,listLevel:s.listRendering.level??0,listType:s.listRendering.isBullet?"bullet":"number"}:{type:"paragraph",index:n,paraId:a,text:r}}function H(s,n,o,t){let r=[],e=[];for(let a of s.rows){let i=[],c=[];for(let l of a.cells){let u=[],p;for(let g of l.content)g.type==="paragraph"&&(p===void 0&&(p=g.paraId),u.push(B(g,o,t)));i.push(u.join(`
2
2
  `)),c.push(p);}r.push(i),e.push(c);}return {type:"table",index:n,rows:r,cellParaIds:e}}function Y(s){let n=[],o=t=>t.paraId?t.paraId:String(t.index);for(let t of s)switch(t.type){case "heading":n.push(`[${o(t)}] (h${t.level}) ${t.text}`);break;case "paragraph":n.push(`[${o(t)}] ${t.text}`);break;case "list-item":{let r=" ".repeat(t.listLevel),e=t.listType==="bullet"?"\u2022":"-";n.push(`[${o(t)}] ${r}${e} ${t.text}`);break}case "table":{let r=t.index;for(let e=0;e<t.rows.length;e++)for(let a=0;a<t.rows[e].length;a++){let c=t.rows[e][a].split(`
3
3
  `),l=t.cellParaIds?.[e]?.[a];for(let u=0;u<c.length;u++){let p=u===0&&l?l:String(r);n.push(`[${p}] (table, row ${e+1}, col ${a+1}) ${c[u]}`),r++;}}break}}return n.join(`
4
- `)}function B(s,n,o){let t=[],r=new Set;for(let e of s.content){if(e.type==="commentRangeStart"&&o){r.add(e.id),t.push(`[comment:${e.id}]`);continue}if(e.type==="commentRangeEnd"&&o){r.has(e.id)&&(r.delete(e.id),t.push("[/comment]"));continue}if(e.type==="run")t.push(chunkVF25WARH_js.Q(e));else if(e.type==="hyperlink")t.push(chunkVF25WARH_js.R(e));else if(h(e)){let a=x(e.content);e.type==="insertion"||e.type==="moveTo"?n&&t.push(`[+${a}+]{by:${e.info.author}}`):n?t.push(`[-${a}-]{by:${e.info.author}}`):t.push(a);}}return t.join("")}var y=class extends Error{constructor(n,o){let t=o!==void 0?` in paragraph ${o}`:" in document";super(`Text not found${t}: "${n}"`),this.name="TextNotFoundError";}},M=class extends Error{constructor(n){super(`Tracked change not found: id=${n}`),this.name="ChangeNotFoundError";}},F=class extends Error{constructor(n){super(`Comment not found: id=${n}`),this.name="CommentNotFoundError";}};function E(s){let n=[],o=0;for(let t=0;t<s.content.length;t++){let r=s.content[t];if(r.type==="run"){let e=chunkVF25WARH_js.Q(r);n.push({contentIndex:t,run:r,text:e,startPos:o}),o+=e.length;}else if(r.type==="hyperlink")for(let e=0;e<r.children.length;e++){let a=r.children[e];if(a.type==="run"){let i=chunkVF25WARH_js.Q(a);n.push({contentIndex:t,run:a,text:i,startPos:o}),o+=i.length;}}else if(h(r)){if(r.type==="insertion"||r.type==="moveTo")continue;for(let e=0;e<r.content.length;e++){let a=r.content[e];if(a.type==="run"){let i=chunkVF25WARH_js.Q(a);n.push({contentIndex:t,run:a,text:i,startPos:o}),o+=i.length;}else if(a.type==="hyperlink"){for(let i of a.children)if(i.type==="run"){let c=chunkVF25WARH_js.Q(i);n.push({contentIndex:t,run:i,text:c,startPos:o}),o+=c.length;}}}}}return n}function k(s){return E(s).map(n=>n.text).join("")}function G(s,n,o){let t=E(s),r=t.map(u=>u.text).join(""),e=W(r,n);if(!e)throw new y(n,o);let a=-1,i=0;for(let u=0;u<t.length;u++)if(e.start<t[u].startPos+t[u].text.length){a=u,i=e.start-t[u].startPos;break}let c=-1,l=0;for(let u=t.length-1;u>=0;u--)if(e.end>t[u].startPos){c=u,l=e.end-t[u].startPos;break}if(a===-1||c===-1)throw new y(n,o);return {startRunIndex:t[a].contentIndex,startOffset:i,endRunIndex:t[c].contentIndex,endOffset:l}}function te(s,n,o){let t=G(s,n,o),{startRunIndex:r,endRunIndex:e}=t,{startOffset:a,endOffset:i}=t,c=s.content[e];if(c.type==="run"){let u=chunkVF25WARH_js.Q(c);if(i<u.length){let p=D(u.slice(i),c);$(c,u.slice(0,i)),s.content.splice(e+1,0,p);}}let l=s.content[r];if(l.type==="run"&&a>0){let u=chunkVF25WARH_js.Q(l),p=D(u.slice(0,a),l);$(l,u.slice(a)),s.content.splice(r,0,p),r++,e++;}return {startIndex:r,endIndex:e}}function D(s,n){return {type:"run",content:[{type:"text",text:s}],formatting:n.formatting?{...n.formatting}:void 0}}function $(s,n){let o=s.content.find(t=>t.type==="text");o&&(o.text=n);}function O(s){let n=[],o=[],t=true;for(let r=0;r<s.length;r++){let e=s[r];if(!"\u200B\u200C\u200D\uFEFF\xAD".includes(e)){if("\u201C\u201D\u201E\u201F".includes(e)&&(e='"'),"\u2018\u2019\u201A\u201B".includes(e)&&(e="'"),"\u2013\u2014\u2012\u2015".includes(e)&&(e="-"),e==="\u2026"){n.push(".",".","."),o.push(r,r,r),t=false;continue}if(/\s/.test(e)||e==="\xA0"){t||(n.push(" "),o.push(r),t=true);continue}n.push(e.toLowerCase()),o.push(r),t=false;}}return n.length>0&&n[n.length-1]===" "&&(n.pop(),o.pop()),{text:n.join(""),posMap:o}}function S(s,n,o,t){let r=s.posMap[n],e=s.posMap[n+o-1]+1;for(;e<t.length&&"\u200B\u200C\u200D\uFEFF\xAD".includes(t[e]);)e++;return {start:r,end:e}}function W(s,n){if(!n||!s)return null;let o=s.indexOf(n);if(o!==-1)return {start:o,end:o+n.length};let t=O(s),r=O(n);if(!r.text)return null;let e=t.text.indexOf(r.text);if(e!==-1)return S(t,e,r.text.length,s);let a=r.text.split(" ");if(a.length>=3)for(let i=1;i<=Math.min(2,a.length-2);i++){let c=a.slice(0,-i).join(" "),l=t.text.indexOf(c);if(l!==-1)return S(t,l,c.length,s)}return null}function se(s,n){let o=new Map;return R(s,(r,e)=>{let a=null;for(let i of r.content)if(h(i)){a===null&&(a=k(r));let c=x(i.content),l=i.info.id,u=o.get(l);u&&u.paragraphIndex===e?u.text+=c:o.set(l,{id:l,type:i.type,author:i.info.author,date:i.info.date??null,text:c,context:a,paragraphIndex:e});}}),Array.from(o.values()).filter(r=>!(n?.author&&r.author!==n.author||n?.type&&r.type!==n.type))}function ae(s,n){let o=s.comments??[];if(o.length===0)return [];let t=z(s),r=[],e=new Map;for(let i of o)if(i.parentId!==void 0){let c=e.get(i.parentId)??[];c.push(i),e.set(i.parentId,c);}else r.push(i);return r.map(i=>{let c=t.get(i.id),l=(e.get(i.id)??[]).map(u=>({id:u.id,author:u.author,date:u.date??null,text:A(u)}));return {id:i.id,author:i.author,date:i.date??null,text:A(i),anchoredText:c?.text??"",paragraphIndex:c?.paragraphIndex??-1,replies:l,done:i.done??false}}).filter(i=>!(n?.author&&i.author!==n.author||n?.done!==void 0&&i.done!==n.done))}function A(s){return s.content.map(n=>k(n)).join(`
5
- `)}function z(s){let n=new Map,o=new Map;return R(s,(t,r)=>{for(let e of t.content)if(e.type==="commentRangeStart")o.set(e.id,{paragraphIndex:r,parts:[]});else if(e.type==="commentRangeEnd"){let a=o.get(e.id);a&&(n.set(e.id,{text:a.parts.join(""),paragraphIndex:a.paragraphIndex}),o.delete(e.id));}else if(e.type==="run"){let a=chunkVF25WARH_js.Q(e);for(let i of o.values())i.parts.push(a);}else if(e.type==="hyperlink"){let a=e.children.filter(i=>i.type==="run").map(chunkVF25WARH_js.Q).join("");for(let i of o.values())i.parts.push(a);}else if(h(e)){if(e.type==="insertion"||e.type==="moveTo")continue;let a=x(e.content);for(let i of o.values())i.parts.push(a);}}),n}function N(s){let n=s.toDocument().package?.document;if(!n)return new Map;let o=new Map,t=0;for(let r of n.content)if(r.type==="paragraph"){let e=r.paraId;e&&o.set(e,t),t++;}else if(r.type==="table")for(let e of r.rows)for(let a of e.cells)for(let i of a.content)i.type==="paragraph"&&t++;else t++;return o}function X(s){let n=[],o=t=>{for(let r of t.content)r.type==="text"&&n.push(r.text??"");};for(let t of s.content)if(t.type==="run")o(t);else if(t.type==="hyperlink")for(let r of t.children)r.type==="run"&&o(r);else if(t.type==="deletion"||t.type==="moveFrom"){for(let r of t.content)if(r.type==="run")o(r);else if(r.type==="hyperlink")for(let e of r.children)e.type==="run"&&o(e);}return n.join("")}function ce(s){let n=new Set,o=null;function t(){return o===null&&(o=N(s)),o}function r(){if(n.size===0)return;let e=s.getComments(),a=s.getChanges(),i={commentCount:e.length,changeCount:a.length,comments:e,changes:a};for(let c of n)try{c(i);}catch(l){console.error("reviewerBridge content listener threw:",l);}}return {getContentAsText(e){return s.getContentAsText(e)},getContent(e){return s.getContent(e)},getComments(e){return s.getComments(e)},getChanges(e){return s.getChanges(e)},findText(e,a){if(!e)return [];let i=a?.caseSensitive??false,c=a?.limit??20,l=i?e:e.toLowerCase(),u=s.toDocument().package?.document;if(!u)return [];let p=[],g=40;for(let P of u.content){if(p.length>=c)break;if(P.type!=="paragraph")continue;let C=P;if(!C.paraId)continue;let m=X(C),v=i?m:m.toLowerCase(),d=v.indexOf(l);if(d===-1||v.indexOf(l,d+1)!==-1)continue;let j=m.slice(d,d+e.length);p.push({paraId:C.paraId,match:j,before:m.slice(Math.max(0,d-g),d),after:m.slice(d+e.length,d+e.length+g)});}return p},getSelection(){return null},addComment(e){let a=t().get(e.paraId);if(a===void 0)return null;try{let i=s.addComment({paragraphIndex:a,text:e.text,author:e.author,search:e.search});return r(),i}catch{return null}},replyTo(e,a){try{let i=s.replyTo(e,a);return r(),i}catch{return null}},resolveComment(e){let i=s.toDocument().package?.document?.comments?.find(c=>c.id===e);i&&(i.done=true,r());},proposeChange(e){let a=t().get(e.paraId);if(a===void 0)return false;let i=e.search==="",c=e.replaceWith==="";if(i&&c)return false;try{return i?s.proposeInsertion({paragraphIndex:a,insertText:e.replaceWith,author:e.author}):c?s.proposeDeletion({paragraphIndex:a,search:e.search,author:e.author}):s.replace({paragraphIndex:a,search:e.search,replaceWith:e.replaceWith,author:e.author}),r(),true}catch{return false}},scrollTo(e){return t().has(e)},applyFormatting(){return false},setParagraphStyle(){return false},getPage(){return null},getPages(){return []},getTotalPages(){return 0},getCurrentPage(){return 0},onContentChange(e){return n.add(e),()=>{n.delete(e);}},onSelectionChange(){return ()=>{}}}}exports.a=h;exports.b=K;exports.c=R;exports.d=V;exports.e=Y;exports.f=y;exports.g=M;exports.h=F;exports.i=G;exports.j=te;exports.k=se;exports.l=ae;exports.m=ce;
4
+ `)}function B(s,n,o){let t=[],r=new Set;for(let e of s.content){if(e.type==="commentRangeStart"&&o){r.add(e.id),t.push(`[comment:${e.id}]`);continue}if(e.type==="commentRangeEnd"&&o){r.has(e.id)&&(r.delete(e.id),t.push("[/comment]"));continue}if(e.type==="run")t.push(chunkOVPN5UGH_js.Q(e));else if(e.type==="hyperlink")t.push(chunkOVPN5UGH_js.R(e));else if(h(e)){let a=x(e.content);e.type==="insertion"||e.type==="moveTo"?n&&t.push(`[+${a}+]{by:${e.info.author}}`):n?t.push(`[-${a}-]{by:${e.info.author}}`):t.push(a);}}return t.join("")}var y=class extends Error{constructor(n,o){let t=o!==void 0?` in paragraph ${o}`:" in document";super(`Text not found${t}: "${n}"`),this.name="TextNotFoundError";}},M=class extends Error{constructor(n){super(`Tracked change not found: id=${n}`),this.name="ChangeNotFoundError";}},F=class extends Error{constructor(n){super(`Comment not found: id=${n}`),this.name="CommentNotFoundError";}};function E(s){let n=[],o=0;for(let t=0;t<s.content.length;t++){let r=s.content[t];if(r.type==="run"){let e=chunkOVPN5UGH_js.Q(r);n.push({contentIndex:t,run:r,text:e,startPos:o}),o+=e.length;}else if(r.type==="hyperlink")for(let e=0;e<r.children.length;e++){let a=r.children[e];if(a.type==="run"){let i=chunkOVPN5UGH_js.Q(a);n.push({contentIndex:t,run:a,text:i,startPos:o}),o+=i.length;}}else if(h(r)){if(r.type==="insertion"||r.type==="moveTo")continue;for(let e=0;e<r.content.length;e++){let a=r.content[e];if(a.type==="run"){let i=chunkOVPN5UGH_js.Q(a);n.push({contentIndex:t,run:a,text:i,startPos:o}),o+=i.length;}else if(a.type==="hyperlink"){for(let i of a.children)if(i.type==="run"){let c=chunkOVPN5UGH_js.Q(i);n.push({contentIndex:t,run:i,text:c,startPos:o}),o+=c.length;}}}}}return n}function k(s){return E(s).map(n=>n.text).join("")}function G(s,n,o){let t=E(s),r=t.map(u=>u.text).join(""),e=W(r,n);if(!e)throw new y(n,o);let a=-1,i=0;for(let u=0;u<t.length;u++)if(e.start<t[u].startPos+t[u].text.length){a=u,i=e.start-t[u].startPos;break}let c=-1,l=0;for(let u=t.length-1;u>=0;u--)if(e.end>t[u].startPos){c=u,l=e.end-t[u].startPos;break}if(a===-1||c===-1)throw new y(n,o);return {startRunIndex:t[a].contentIndex,startOffset:i,endRunIndex:t[c].contentIndex,endOffset:l}}function te(s,n,o){let t=G(s,n,o),{startRunIndex:r,endRunIndex:e}=t,{startOffset:a,endOffset:i}=t,c=s.content[e];if(c.type==="run"){let u=chunkOVPN5UGH_js.Q(c);if(i<u.length){let p=D(u.slice(i),c);$(c,u.slice(0,i)),s.content.splice(e+1,0,p);}}let l=s.content[r];if(l.type==="run"&&a>0){let u=chunkOVPN5UGH_js.Q(l),p=D(u.slice(0,a),l);$(l,u.slice(a)),s.content.splice(r,0,p),r++,e++;}return {startIndex:r,endIndex:e}}function D(s,n){return {type:"run",content:[{type:"text",text:s}],formatting:n.formatting?{...n.formatting}:void 0}}function $(s,n){let o=s.content.find(t=>t.type==="text");o&&(o.text=n);}function O(s){let n=[],o=[],t=true;for(let r=0;r<s.length;r++){let e=s[r];if(!"\u200B\u200C\u200D\uFEFF\xAD".includes(e)){if("\u201C\u201D\u201E\u201F".includes(e)&&(e='"'),"\u2018\u2019\u201A\u201B".includes(e)&&(e="'"),"\u2013\u2014\u2012\u2015".includes(e)&&(e="-"),e==="\u2026"){n.push(".",".","."),o.push(r,r,r),t=false;continue}if(/\s/.test(e)||e==="\xA0"){t||(n.push(" "),o.push(r),t=true);continue}n.push(e.toLowerCase()),o.push(r),t=false;}}return n.length>0&&n[n.length-1]===" "&&(n.pop(),o.pop()),{text:n.join(""),posMap:o}}function S(s,n,o,t){let r=s.posMap[n],e=s.posMap[n+o-1]+1;for(;e<t.length&&"\u200B\u200C\u200D\uFEFF\xAD".includes(t[e]);)e++;return {start:r,end:e}}function W(s,n){if(!n||!s)return null;let o=s.indexOf(n);if(o!==-1)return {start:o,end:o+n.length};let t=O(s),r=O(n);if(!r.text)return null;let e=t.text.indexOf(r.text);if(e!==-1)return S(t,e,r.text.length,s);let a=r.text.split(" ");if(a.length>=3)for(let i=1;i<=Math.min(2,a.length-2);i++){let c=a.slice(0,-i).join(" "),l=t.text.indexOf(c);if(l!==-1)return S(t,l,c.length,s)}return null}function se(s,n){let o=new Map;return R(s,(r,e)=>{let a=null;for(let i of r.content)if(h(i)){a===null&&(a=k(r));let c=x(i.content),l=i.info.id,u=o.get(l);u&&u.paragraphIndex===e?u.text+=c:o.set(l,{id:l,type:i.type,author:i.info.author,date:i.info.date??null,text:c,context:a,paragraphIndex:e});}}),Array.from(o.values()).filter(r=>!(n?.author&&r.author!==n.author||n?.type&&r.type!==n.type))}function ae(s,n){let o=s.comments??[];if(o.length===0)return [];let t=z(s),r=[],e=new Map;for(let i of o)if(i.parentId!==void 0){let c=e.get(i.parentId)??[];c.push(i),e.set(i.parentId,c);}else r.push(i);return r.map(i=>{let c=t.get(i.id),l=(e.get(i.id)??[]).map(u=>({id:u.id,author:u.author,date:u.date??null,text:A(u)}));return {id:i.id,author:i.author,date:i.date??null,text:A(i),anchoredText:c?.text??"",paragraphIndex:c?.paragraphIndex??-1,replies:l,done:i.done??false}}).filter(i=>!(n?.author&&i.author!==n.author||n?.done!==void 0&&i.done!==n.done))}function A(s){return s.content.map(n=>k(n)).join(`
5
+ `)}function z(s){let n=new Map,o=new Map;return R(s,(t,r)=>{for(let e of t.content)if(e.type==="commentRangeStart")o.set(e.id,{paragraphIndex:r,parts:[]});else if(e.type==="commentRangeEnd"){let a=o.get(e.id);a&&(n.set(e.id,{text:a.parts.join(""),paragraphIndex:a.paragraphIndex}),o.delete(e.id));}else if(e.type==="run"){let a=chunkOVPN5UGH_js.Q(e);for(let i of o.values())i.parts.push(a);}else if(e.type==="hyperlink"){let a=e.children.filter(i=>i.type==="run").map(chunkOVPN5UGH_js.Q).join("");for(let i of o.values())i.parts.push(a);}else if(h(e)){if(e.type==="insertion"||e.type==="moveTo")continue;let a=x(e.content);for(let i of o.values())i.parts.push(a);}}),n}function N(s){let n=s.toDocument().package?.document;if(!n)return new Map;let o=new Map,t=0;for(let r of n.content)if(r.type==="paragraph"){let e=r.paraId;e&&o.set(e,t),t++;}else if(r.type==="table")for(let e of r.rows)for(let a of e.cells)for(let i of a.content)i.type==="paragraph"&&t++;else t++;return o}function X(s){let n=[],o=t=>{for(let r of t.content)r.type==="text"&&n.push(r.text??"");};for(let t of s.content)if(t.type==="run")o(t);else if(t.type==="hyperlink")for(let r of t.children)r.type==="run"&&o(r);else if(t.type==="deletion"||t.type==="moveFrom"){for(let r of t.content)if(r.type==="run")o(r);else if(r.type==="hyperlink")for(let e of r.children)e.type==="run"&&o(e);}return n.join("")}function ce(s){let n=new Set,o=null;function t(){return o===null&&(o=N(s)),o}function r(){if(n.size===0)return;let e=s.getComments(),a=s.getChanges(),i={commentCount:e.length,changeCount:a.length,comments:e,changes:a};for(let c of n)try{c(i);}catch(l){console.error("reviewerBridge content listener threw:",l);}}return {getContentAsText(e){return s.getContentAsText(e)},getContent(e){return s.getContent(e)},getComments(e){return s.getComments(e)},getChanges(e){return s.getChanges(e)},findText(e,a){if(!e)return [];let i=a?.caseSensitive??false,c=a?.limit??20,l=i?e:e.toLowerCase(),u=s.toDocument().package?.document;if(!u)return [];let p=[],g=40;for(let P of u.content){if(p.length>=c)break;if(P.type!=="paragraph")continue;let C=P;if(!C.paraId)continue;let m=X(C),v=i?m:m.toLowerCase(),d=v.indexOf(l);if(d===-1||v.indexOf(l,d+1)!==-1)continue;let j=m.slice(d,d+e.length);p.push({paraId:C.paraId,match:j,before:m.slice(Math.max(0,d-g),d),after:m.slice(d+e.length,d+e.length+g)});}return p},getSelection(){return null},addComment(e){let a=t().get(e.paraId);if(a===void 0)return null;try{let i=s.addComment({paragraphIndex:a,text:e.text,author:e.author,search:e.search});return r(),i}catch{return null}},replyTo(e,a){try{let i=s.replyTo(e,a);return r(),i}catch{return null}},resolveComment(e){let i=s.toDocument().package?.document?.comments?.find(c=>c.id===e);i&&(i.done=true,r());},proposeChange(e){let a=t().get(e.paraId);if(a===void 0)return false;let i=e.search==="",c=e.replaceWith==="";if(i&&c)return false;try{return i?s.proposeInsertion({paragraphIndex:a,insertText:e.replaceWith,author:e.author}):c?s.proposeDeletion({paragraphIndex:a,search:e.search,author:e.author}):s.replace({paragraphIndex:a,search:e.search,replaceWith:e.replaceWith,author:e.author}),r(),true}catch{return false}},scrollTo(e){return t().has(e)},applyFormatting(){return false},setParagraphStyle(){return false},getPage(){return null},getPages(){return []},getTotalPages(){return 0},getCurrentPage(){return 0},onContentChange(e){return n.add(e),()=>{n.delete(e);}},onSelectionChange(){return ()=>{}}}}exports.a=h;exports.b=K;exports.c=R;exports.d=V;exports.e=Y;exports.f=y;exports.g=M;exports.h=F;exports.i=G;exports.j=te;exports.k=se;exports.l=ae;exports.m=ce;
@@ -1 +1 @@
1
- export{Fa as DEFAULT_AI_ACTIONS,G as DocumentAgent,Ha as VERSION,i as attemptSelectiveSave,wa as blendColors,N as buildExtendedSelectionContext,h as buildPatchedDocumentXml,M as buildSelectionContext,K as buildSelectionContextFromContext,xa as colorsEqual,Ca as comparePositions,V as countCharacters,U as countWords,H as createAgent,I as createAgentFromDocument,za as createCollapsedRange,Ga as createCommand,ka as createDocumentWithText,f as createDocx,ja as createEmptyDocument,Aa as createRange,ta as createRgbColor,sa as createThemeColor,ua as darkenColor,j as detectVariables,k as detectVariablesDetailed,l as detectVariablesInBody,m as detectVariablesInParagraph,v as documentHasVariables,y as emuToPixels,A as emuToTwips,n as extractVariablesFromText,E as formatPx,r as formatVariable,Ea as getActionDescription,Da as getActionLabel,J as getAgentContext,ia as getBlockIndexForParagraph,X as getBodyCharacterCount,T as getBodyText,W as getBodyWordCount,qa as getContrastingColor,L as getDocumentSummary,_ as getFormattingAtPosition,aa as getHyperlinkAtPosition,R as getHyperlinkText,ha as getParagraphAtIndex,P as getParagraphText,ga as getParagraphs,Q as getRunText,O as getSelectionFormattingSummary,S as getTableText,Z as getTextAfter,Y as getTextBefore,D as halfPointsToPixels,ea as hasHyperlinks,da as hasImages,fa as hasTables,o as hasTemplateVariables,oa as isBlack,ba as isHeadingStyle,$ as isPositionInHyperlink,Ba as isPositionInRange,p as isValidVariableName,pa as isWhite,ya as isZodSchema,va as lightenColor,ra as parseColorString,F as parseDocx,ca as parseHeadingLevel,s as parseVariable,z as pixelsToEmu,x as pixelsToTwips,C as pointsToPixels,u as removeVariables,d as repackDocx,t as replaceVariables,la as resolveColor,ma as resolveHighlightColor,na as resolveShadingColor,q as sanitizeVariableName,b as serializeDocumentBody,c as serializeDocx,a as serializeSectionProperties,B as twipsToEmu,w as twipsToPixels,e as updateMultipleFiles,g as validatePatchSafety}from'./chunk-25L7AEDN.mjs';export{j as createTemplateProcessor,g as getMissingVariables,e as getTemplateTags,h as previewTemplate,a as processTemplate,i as processTemplateAdvanced,c as processTemplateAsBlob,b as processTemplateDetailed,f as validateTemplate}from'./chunk-UILTIEBD.mjs';export{a as PluginRegistry,d as createPluginRegistrar,e as executeCommand,f as executeCommands,b as pluginRegistry,c as registerPlugins}from'./chunk-X57U3ESM.mjs';
1
+ export{Fa as DEFAULT_AI_ACTIONS,G as DocumentAgent,Ha as VERSION,i as attemptSelectiveSave,wa as blendColors,N as buildExtendedSelectionContext,h as buildPatchedDocumentXml,M as buildSelectionContext,K as buildSelectionContextFromContext,xa as colorsEqual,Ca as comparePositions,V as countCharacters,U as countWords,H as createAgent,I as createAgentFromDocument,za as createCollapsedRange,Ga as createCommand,ka as createDocumentWithText,f as createDocx,ja as createEmptyDocument,Aa as createRange,ta as createRgbColor,sa as createThemeColor,ua as darkenColor,j as detectVariables,k as detectVariablesDetailed,l as detectVariablesInBody,m as detectVariablesInParagraph,v as documentHasVariables,y as emuToPixels,A as emuToTwips,n as extractVariablesFromText,E as formatPx,r as formatVariable,Ea as getActionDescription,Da as getActionLabel,J as getAgentContext,ia as getBlockIndexForParagraph,X as getBodyCharacterCount,T as getBodyText,W as getBodyWordCount,qa as getContrastingColor,L as getDocumentSummary,_ as getFormattingAtPosition,aa as getHyperlinkAtPosition,R as getHyperlinkText,ha as getParagraphAtIndex,P as getParagraphText,ga as getParagraphs,Q as getRunText,O as getSelectionFormattingSummary,S as getTableText,Z as getTextAfter,Y as getTextBefore,D as halfPointsToPixels,ea as hasHyperlinks,da as hasImages,fa as hasTables,o as hasTemplateVariables,oa as isBlack,ba as isHeadingStyle,$ as isPositionInHyperlink,Ba as isPositionInRange,p as isValidVariableName,pa as isWhite,ya as isZodSchema,va as lightenColor,ra as parseColorString,F as parseDocx,ca as parseHeadingLevel,s as parseVariable,z as pixelsToEmu,x as pixelsToTwips,C as pointsToPixels,u as removeVariables,d as repackDocx,t as replaceVariables,la as resolveColor,ma as resolveHighlightColor,na as resolveShadingColor,q as sanitizeVariableName,b as serializeDocumentBody,c as serializeDocx,a as serializeSectionProperties,B as twipsToEmu,w as twipsToPixels,e as updateMultipleFiles,g as validatePatchSafety}from'./chunk-PNONETA3.mjs';export{j as createTemplateProcessor,g as getMissingVariables,e as getTemplateTags,h as previewTemplate,a as processTemplate,i as processTemplateAdvanced,c as processTemplateAsBlob,b as processTemplateDetailed,f as validateTemplate}from'./chunk-UILTIEBD.mjs';export{a as PluginRegistry,d as createPluginRegistrar,e as executeCommand,f as executeCommands,b as pluginRegistry,c as registerPlugins}from'./chunk-X57U3ESM.mjs';
@@ -0,0 +1 @@
1
+ 'use strict';var chunkOVPN5UGH_js=require('./chunk-OVPN5UGH.js'),chunk4QRVKNI4_js=require('./chunk-4QRVKNI4.js'),chunk2AF2FRMM_js=require('./chunk-2AF2FRMM.js');Object.defineProperty(exports,"DEFAULT_AI_ACTIONS",{enumerable:true,get:function(){return chunkOVPN5UGH_js.Fa}});Object.defineProperty(exports,"DocumentAgent",{enumerable:true,get:function(){return chunkOVPN5UGH_js.G}});Object.defineProperty(exports,"VERSION",{enumerable:true,get:function(){return chunkOVPN5UGH_js.Ha}});Object.defineProperty(exports,"attemptSelectiveSave",{enumerable:true,get:function(){return chunkOVPN5UGH_js.i}});Object.defineProperty(exports,"blendColors",{enumerable:true,get:function(){return chunkOVPN5UGH_js.wa}});Object.defineProperty(exports,"buildExtendedSelectionContext",{enumerable:true,get:function(){return chunkOVPN5UGH_js.N}});Object.defineProperty(exports,"buildPatchedDocumentXml",{enumerable:true,get:function(){return chunkOVPN5UGH_js.h}});Object.defineProperty(exports,"buildSelectionContext",{enumerable:true,get:function(){return chunkOVPN5UGH_js.M}});Object.defineProperty(exports,"buildSelectionContextFromContext",{enumerable:true,get:function(){return chunkOVPN5UGH_js.K}});Object.defineProperty(exports,"colorsEqual",{enumerable:true,get:function(){return chunkOVPN5UGH_js.xa}});Object.defineProperty(exports,"comparePositions",{enumerable:true,get:function(){return chunkOVPN5UGH_js.Ca}});Object.defineProperty(exports,"countCharacters",{enumerable:true,get:function(){return chunkOVPN5UGH_js.V}});Object.defineProperty(exports,"countWords",{enumerable:true,get:function(){return chunkOVPN5UGH_js.U}});Object.defineProperty(exports,"createAgent",{enumerable:true,get:function(){return chunkOVPN5UGH_js.H}});Object.defineProperty(exports,"createAgentFromDocument",{enumerable:true,get:function(){return chunkOVPN5UGH_js.I}});Object.defineProperty(exports,"createCollapsedRange",{enumerable:true,get:function(){return chunkOVPN5UGH_js.za}});Object.defineProperty(exports,"createCommand",{enumerable:true,get:function(){return chunkOVPN5UGH_js.Ga}});Object.defineProperty(exports,"createDocumentWithText",{enumerable:true,get:function(){return chunkOVPN5UGH_js.ka}});Object.defineProperty(exports,"createDocx",{enumerable:true,get:function(){return chunkOVPN5UGH_js.f}});Object.defineProperty(exports,"createEmptyDocument",{enumerable:true,get:function(){return chunkOVPN5UGH_js.ja}});Object.defineProperty(exports,"createRange",{enumerable:true,get:function(){return chunkOVPN5UGH_js.Aa}});Object.defineProperty(exports,"createRgbColor",{enumerable:true,get:function(){return chunkOVPN5UGH_js.ta}});Object.defineProperty(exports,"createThemeColor",{enumerable:true,get:function(){return chunkOVPN5UGH_js.sa}});Object.defineProperty(exports,"darkenColor",{enumerable:true,get:function(){return chunkOVPN5UGH_js.ua}});Object.defineProperty(exports,"detectVariables",{enumerable:true,get:function(){return chunkOVPN5UGH_js.j}});Object.defineProperty(exports,"detectVariablesDetailed",{enumerable:true,get:function(){return chunkOVPN5UGH_js.k}});Object.defineProperty(exports,"detectVariablesInBody",{enumerable:true,get:function(){return chunkOVPN5UGH_js.l}});Object.defineProperty(exports,"detectVariablesInParagraph",{enumerable:true,get:function(){return chunkOVPN5UGH_js.m}});Object.defineProperty(exports,"documentHasVariables",{enumerable:true,get:function(){return chunkOVPN5UGH_js.v}});Object.defineProperty(exports,"emuToPixels",{enumerable:true,get:function(){return chunkOVPN5UGH_js.y}});Object.defineProperty(exports,"emuToTwips",{enumerable:true,get:function(){return chunkOVPN5UGH_js.A}});Object.defineProperty(exports,"extractVariablesFromText",{enumerable:true,get:function(){return chunkOVPN5UGH_js.n}});Object.defineProperty(exports,"formatPx",{enumerable:true,get:function(){return chunkOVPN5UGH_js.E}});Object.defineProperty(exports,"formatVariable",{enumerable:true,get:function(){return chunkOVPN5UGH_js.r}});Object.defineProperty(exports,"getActionDescription",{enumerable:true,get:function(){return chunkOVPN5UGH_js.Ea}});Object.defineProperty(exports,"getActionLabel",{enumerable:true,get:function(){return chunkOVPN5UGH_js.Da}});Object.defineProperty(exports,"getAgentContext",{enumerable:true,get:function(){return chunkOVPN5UGH_js.J}});Object.defineProperty(exports,"getBlockIndexForParagraph",{enumerable:true,get:function(){return chunkOVPN5UGH_js.ia}});Object.defineProperty(exports,"getBodyCharacterCount",{enumerable:true,get:function(){return chunkOVPN5UGH_js.X}});Object.defineProperty(exports,"getBodyText",{enumerable:true,get:function(){return chunkOVPN5UGH_js.T}});Object.defineProperty(exports,"getBodyWordCount",{enumerable:true,get:function(){return chunkOVPN5UGH_js.W}});Object.defineProperty(exports,"getContrastingColor",{enumerable:true,get:function(){return chunkOVPN5UGH_js.qa}});Object.defineProperty(exports,"getDocumentSummary",{enumerable:true,get:function(){return chunkOVPN5UGH_js.L}});Object.defineProperty(exports,"getFormattingAtPosition",{enumerable:true,get:function(){return chunkOVPN5UGH_js._}});Object.defineProperty(exports,"getHyperlinkAtPosition",{enumerable:true,get:function(){return chunkOVPN5UGH_js.aa}});Object.defineProperty(exports,"getHyperlinkText",{enumerable:true,get:function(){return chunkOVPN5UGH_js.R}});Object.defineProperty(exports,"getParagraphAtIndex",{enumerable:true,get:function(){return chunkOVPN5UGH_js.ha}});Object.defineProperty(exports,"getParagraphText",{enumerable:true,get:function(){return chunkOVPN5UGH_js.P}});Object.defineProperty(exports,"getParagraphs",{enumerable:true,get:function(){return chunkOVPN5UGH_js.ga}});Object.defineProperty(exports,"getRunText",{enumerable:true,get:function(){return chunkOVPN5UGH_js.Q}});Object.defineProperty(exports,"getSelectionFormattingSummary",{enumerable:true,get:function(){return chunkOVPN5UGH_js.O}});Object.defineProperty(exports,"getTableText",{enumerable:true,get:function(){return chunkOVPN5UGH_js.S}});Object.defineProperty(exports,"getTextAfter",{enumerable:true,get:function(){return chunkOVPN5UGH_js.Z}});Object.defineProperty(exports,"getTextBefore",{enumerable:true,get:function(){return chunkOVPN5UGH_js.Y}});Object.defineProperty(exports,"halfPointsToPixels",{enumerable:true,get:function(){return chunkOVPN5UGH_js.D}});Object.defineProperty(exports,"hasHyperlinks",{enumerable:true,get:function(){return chunkOVPN5UGH_js.ea}});Object.defineProperty(exports,"hasImages",{enumerable:true,get:function(){return chunkOVPN5UGH_js.da}});Object.defineProperty(exports,"hasTables",{enumerable:true,get:function(){return chunkOVPN5UGH_js.fa}});Object.defineProperty(exports,"hasTemplateVariables",{enumerable:true,get:function(){return chunkOVPN5UGH_js.o}});Object.defineProperty(exports,"isBlack",{enumerable:true,get:function(){return chunkOVPN5UGH_js.oa}});Object.defineProperty(exports,"isHeadingStyle",{enumerable:true,get:function(){return chunkOVPN5UGH_js.ba}});Object.defineProperty(exports,"isPositionInHyperlink",{enumerable:true,get:function(){return chunkOVPN5UGH_js.$}});Object.defineProperty(exports,"isPositionInRange",{enumerable:true,get:function(){return chunkOVPN5UGH_js.Ba}});Object.defineProperty(exports,"isValidVariableName",{enumerable:true,get:function(){return chunkOVPN5UGH_js.p}});Object.defineProperty(exports,"isWhite",{enumerable:true,get:function(){return chunkOVPN5UGH_js.pa}});Object.defineProperty(exports,"isZodSchema",{enumerable:true,get:function(){return chunkOVPN5UGH_js.ya}});Object.defineProperty(exports,"lightenColor",{enumerable:true,get:function(){return chunkOVPN5UGH_js.va}});Object.defineProperty(exports,"parseColorString",{enumerable:true,get:function(){return chunkOVPN5UGH_js.ra}});Object.defineProperty(exports,"parseDocx",{enumerable:true,get:function(){return chunkOVPN5UGH_js.F}});Object.defineProperty(exports,"parseHeadingLevel",{enumerable:true,get:function(){return chunkOVPN5UGH_js.ca}});Object.defineProperty(exports,"parseVariable",{enumerable:true,get:function(){return chunkOVPN5UGH_js.s}});Object.defineProperty(exports,"pixelsToEmu",{enumerable:true,get:function(){return chunkOVPN5UGH_js.z}});Object.defineProperty(exports,"pixelsToTwips",{enumerable:true,get:function(){return chunkOVPN5UGH_js.x}});Object.defineProperty(exports,"pointsToPixels",{enumerable:true,get:function(){return chunkOVPN5UGH_js.C}});Object.defineProperty(exports,"removeVariables",{enumerable:true,get:function(){return chunkOVPN5UGH_js.u}});Object.defineProperty(exports,"repackDocx",{enumerable:true,get:function(){return chunkOVPN5UGH_js.d}});Object.defineProperty(exports,"replaceVariables",{enumerable:true,get:function(){return chunkOVPN5UGH_js.t}});Object.defineProperty(exports,"resolveColor",{enumerable:true,get:function(){return chunkOVPN5UGH_js.la}});Object.defineProperty(exports,"resolveHighlightColor",{enumerable:true,get:function(){return chunkOVPN5UGH_js.ma}});Object.defineProperty(exports,"resolveShadingColor",{enumerable:true,get:function(){return chunkOVPN5UGH_js.na}});Object.defineProperty(exports,"sanitizeVariableName",{enumerable:true,get:function(){return chunkOVPN5UGH_js.q}});Object.defineProperty(exports,"serializeDocumentBody",{enumerable:true,get:function(){return chunkOVPN5UGH_js.b}});Object.defineProperty(exports,"serializeDocx",{enumerable:true,get:function(){return chunkOVPN5UGH_js.c}});Object.defineProperty(exports,"serializeSectionProperties",{enumerable:true,get:function(){return chunkOVPN5UGH_js.a}});Object.defineProperty(exports,"twipsToEmu",{enumerable:true,get:function(){return chunkOVPN5UGH_js.B}});Object.defineProperty(exports,"twipsToPixels",{enumerable:true,get:function(){return chunkOVPN5UGH_js.w}});Object.defineProperty(exports,"updateMultipleFiles",{enumerable:true,get:function(){return chunkOVPN5UGH_js.e}});Object.defineProperty(exports,"validatePatchSafety",{enumerable:true,get:function(){return chunkOVPN5UGH_js.g}});Object.defineProperty(exports,"createTemplateProcessor",{enumerable:true,get:function(){return chunk4QRVKNI4_js.j}});Object.defineProperty(exports,"getMissingVariables",{enumerable:true,get:function(){return chunk4QRVKNI4_js.g}});Object.defineProperty(exports,"getTemplateTags",{enumerable:true,get:function(){return chunk4QRVKNI4_js.e}});Object.defineProperty(exports,"previewTemplate",{enumerable:true,get:function(){return chunk4QRVKNI4_js.h}});Object.defineProperty(exports,"processTemplate",{enumerable:true,get:function(){return chunk4QRVKNI4_js.a}});Object.defineProperty(exports,"processTemplateAdvanced",{enumerable:true,get:function(){return chunk4QRVKNI4_js.i}});Object.defineProperty(exports,"processTemplateAsBlob",{enumerable:true,get:function(){return chunk4QRVKNI4_js.c}});Object.defineProperty(exports,"processTemplateDetailed",{enumerable:true,get:function(){return chunk4QRVKNI4_js.b}});Object.defineProperty(exports,"validateTemplate",{enumerable:true,get:function(){return chunk4QRVKNI4_js.f}});Object.defineProperty(exports,"PluginRegistry",{enumerable:true,get:function(){return chunk2AF2FRMM_js.a}});Object.defineProperty(exports,"createPluginRegistrar",{enumerable:true,get:function(){return chunk2AF2FRMM_js.d}});Object.defineProperty(exports,"executeCommand",{enumerable:true,get:function(){return chunk2AF2FRMM_js.e}});Object.defineProperty(exports,"executeCommands",{enumerable:true,get:function(){return chunk2AF2FRMM_js.f}});Object.defineProperty(exports,"pluginRegistry",{enumerable:true,get:function(){return chunk2AF2FRMM_js.b}});Object.defineProperty(exports,"registerPlugins",{enumerable:true,get:function(){return chunk2AF2FRMM_js.c}});
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { G as GetContentOptions, C as ContentBlock, e as CommentFilter, R as ReviewComment, f as ChangeFilter, h as ReviewChange, F as FoundMatch, S as SelectionInfo, i as AddCommentByParaIdOptions, j as ReplyOptions, P as ProposeChangeOptions, k as ApplyFormattingOptions, l as SetParagraphStyleOptions, m as PageContent, n as ContentChangeEvent, o as SelectionChangeEvent } from './server-B7dGWiLh.mjs';
2
- export { A as AgentToolDefinition, a as AgentToolResult, B as BatchError, p as BatchResult, q as BatchReviewOptions, D as DocxReviewer, r as agentTools, s as createReviewerBridge, t as executeToolCall, g as getToolSchemas } from './server-B7dGWiLh.mjs';
1
+ import { G as GetContentOptions, C as ContentBlock, e as CommentFilter, R as ReviewComment, f as ChangeFilter, h as ReviewChange, F as FoundMatch, S as SelectionInfo, i as AddCommentByParaIdOptions, j as ReplyOptions, P as ProposeChangeOptions, k as ApplyFormattingOptions, l as SetParagraphStyleOptions, m as PageContent, n as ContentChangeEvent, o as SelectionChangeEvent } from './server-CLaXsEC8.mjs';
2
+ export { A as AgentToolDefinition, a as AgentToolResult, B as BatchError, p as BatchResult, q as BatchReviewOptions, D as DocxReviewer, r as agentTools, s as createReviewerBridge, t as executeToolCall, g as getToolSchemas } from './server-CLaXsEC8.mjs';
3
3
 
4
4
  /**
5
5
  * Error classes for @eigenpal/docx-editor-agents
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { G as GetContentOptions, C as ContentBlock, e as CommentFilter, R as ReviewComment, f as ChangeFilter, h as ReviewChange, F as FoundMatch, S as SelectionInfo, i as AddCommentByParaIdOptions, j as ReplyOptions, P as ProposeChangeOptions, k as ApplyFormattingOptions, l as SetParagraphStyleOptions, m as PageContent, n as ContentChangeEvent, o as SelectionChangeEvent } from './server-B7dGWiLh.js';
2
- export { A as AgentToolDefinition, a as AgentToolResult, B as BatchError, p as BatchResult, q as BatchReviewOptions, D as DocxReviewer, r as agentTools, s as createReviewerBridge, t as executeToolCall, g as getToolSchemas } from './server-B7dGWiLh.js';
1
+ import { G as GetContentOptions, C as ContentBlock, e as CommentFilter, R as ReviewComment, f as ChangeFilter, h as ReviewChange, F as FoundMatch, S as SelectionInfo, i as AddCommentByParaIdOptions, j as ReplyOptions, P as ProposeChangeOptions, k as ApplyFormattingOptions, l as SetParagraphStyleOptions, m as PageContent, n as ContentChangeEvent, o as SelectionChangeEvent } from './server-CLaXsEC8.js';
2
+ export { A as AgentToolDefinition, a as AgentToolResult, B as BatchError, p as BatchResult, q as BatchReviewOptions, D as DocxReviewer, r as agentTools, s as createReviewerBridge, t as executeToolCall, g as getToolSchemas } from './server-CLaXsEC8.js';
3
3
 
4
4
  /**
5
5
  * Error classes for @eigenpal/docx-editor-agents
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- 'use strict';var chunkU7PAJJYD_js=require('./chunk-U7PAJJYD.js'),chunk3HEONW4M_js=require('./chunk-3HEONW4M.js'),chunkT5P2DWHN_js=require('./chunk-T5P2DWHN.js');Object.defineProperty(exports,"DocxReviewer",{enumerable:true,get:function(){return chunkU7PAJJYD_js.a}});Object.defineProperty(exports,"ChangeNotFoundError",{enumerable:true,get:function(){return chunk3HEONW4M_js.g}});Object.defineProperty(exports,"CommentNotFoundError",{enumerable:true,get:function(){return chunk3HEONW4M_js.h}});Object.defineProperty(exports,"TextNotFoundError",{enumerable:true,get:function(){return chunk3HEONW4M_js.f}});Object.defineProperty(exports,"createReviewerBridge",{enumerable:true,get:function(){return chunk3HEONW4M_js.m}});Object.defineProperty(exports,"agentTools",{enumerable:true,get:function(){return chunkT5P2DWHN_js.a}});Object.defineProperty(exports,"executeToolCall",{enumerable:true,get:function(){return chunkT5P2DWHN_js.b}});Object.defineProperty(exports,"getToolSchemas",{enumerable:true,get:function(){return chunkT5P2DWHN_js.d}});
1
+ 'use strict';var chunkMREPAMXX_js=require('./chunk-MREPAMXX.js'),chunkYCUXBRD7_js=require('./chunk-YCUXBRD7.js'),chunkRI5S75JY_js=require('./chunk-RI5S75JY.js');Object.defineProperty(exports,"DocxReviewer",{enumerable:true,get:function(){return chunkMREPAMXX_js.a}});Object.defineProperty(exports,"ChangeNotFoundError",{enumerable:true,get:function(){return chunkYCUXBRD7_js.g}});Object.defineProperty(exports,"CommentNotFoundError",{enumerable:true,get:function(){return chunkYCUXBRD7_js.h}});Object.defineProperty(exports,"TextNotFoundError",{enumerable:true,get:function(){return chunkYCUXBRD7_js.f}});Object.defineProperty(exports,"createReviewerBridge",{enumerable:true,get:function(){return chunkYCUXBRD7_js.m}});Object.defineProperty(exports,"agentTools",{enumerable:true,get:function(){return chunkRI5S75JY_js.a}});Object.defineProperty(exports,"executeToolCall",{enumerable:true,get:function(){return chunkRI5S75JY_js.b}});Object.defineProperty(exports,"getToolSchemas",{enumerable:true,get:function(){return chunkRI5S75JY_js.d}});
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export{a as DocxReviewer}from'./chunk-HTCA4A6G.mjs';export{g as ChangeNotFoundError,h as CommentNotFoundError,f as TextNotFoundError,m as createReviewerBridge}from'./chunk-AMRM73UC.mjs';export{a as agentTools,b as executeToolCall,d as getToolSchemas}from'./chunk-TICYYVCD.mjs';
1
+ export{a as DocxReviewer}from'./chunk-H7HNGCMH.mjs';export{g as ChangeNotFoundError,h as CommentNotFoundError,f as TextNotFoundError,m as createReviewerBridge}from'./chunk-HSAYNLBS.mjs';export{a as agentTools,b as executeToolCall,d as getToolSchemas}from'./chunk-24MVJKCP.mjs';
package/dist/mcp.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { v as EditorBridge } from './server-B7dGWiLh.mjs';
1
+ import { v as EditorBridge } from './server-CLaXsEC8.mjs';
2
2
 
3
3
  /**
4
4
  * MCP wire protocol (subset) — JSON-RPC 2.0 framing + the message types we
package/dist/mcp.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { v as EditorBridge } from './server-B7dGWiLh.js';
1
+ import { v as EditorBridge } from './server-CLaXsEC8.js';
2
2
 
3
3
  /**
4
4
  * MCP wire protocol (subset) — JSON-RPC 2.0 framing + the message types we
package/dist/mcp.js CHANGED
@@ -1,4 +1,4 @@
1
- 'use strict';var chunkT5P2DWHN_js=require('./chunk-T5P2DWHN.js'),string_decoder=require('string_decoder');var i={ParseError:-32700,InvalidRequest:-32600,MethodNotFound:-32601,InvalidParams:-32602,InternalError:-32603};function v(t){return typeof t=="object"&&t!==null&&t.jsonrpc==="2.0"&&typeof t.method=="string"&&"id"in t}function I(t){return typeof t=="object"&&t!==null&&t.jsonrpc==="2.0"&&typeof t.method=="string"&&!("id"in t)}function u(t,r){return {jsonrpc:"2.0",id:t,result:r}}function p(t,r,e,o){return {jsonrpc:"2.0",id:t,error:o===void 0?{code:r,message:e}:{code:r,message:e,data:o}}}function y(t){let r=[],e=[],o=t.split(`
1
+ 'use strict';var chunkRI5S75JY_js=require('./chunk-RI5S75JY.js'),string_decoder=require('string_decoder');var i={ParseError:-32700,InvalidRequest:-32600,MethodNotFound:-32601,InvalidParams:-32602,InternalError:-32603};function v(t){return typeof t=="object"&&t!==null&&t.jsonrpc==="2.0"&&typeof t.method=="string"&&"id"in t}function I(t){return typeof t=="object"&&t!==null&&t.jsonrpc==="2.0"&&typeof t.method=="string"&&!("id"in t)}function u(t,r){return {jsonrpc:"2.0",id:t,result:r}}function p(t,r,e,o){return {jsonrpc:"2.0",id:t,error:o===void 0?{code:r,message:e}:{code:r,message:e,data:o}}}function y(t){let r=[],e=[],o=t.split(`
2
2
  `),n=o.pop()??"";for(let c of o){let a=c.trim();if(a)try{r.push(JSON.parse(a));}catch{e.push(a);}}return {messages:r,parseErrors:e,rest:n}}function d(t){return JSON.stringify(t)+`
3
- `}var T="2025-06-18",f=class{constructor(r,e={}){this.bridge=r,this.opts={name:e.name??"@eigenpal/docx-editor-agents",version:e.version??"0.0.0",protocolVersion:e.protocolVersion??T};}handle(r){if(!v(r))return null;let e=r;try{switch(e.method){case "initialize":return u(e.id,this.handleInitialize());case "tools/list":return u(e.id,this.handleToolsList());case "tools/call":return this.handleToolsCall(e);case "ping":return u(e.id,{});default:return p(e.id,i.MethodNotFound,`Method not found: ${e.method}`)}}catch(o){return p(e.id,i.InternalError,o instanceof Error?o.message:String(o))}}handleInitialize(){return {protocolVersion:this.opts.protocolVersion,capabilities:{tools:{}},serverInfo:{name:this.opts.name,version:this.opts.version}}}handleToolsList(){return {tools:chunkT5P2DWHN_js.a.map(r=>({name:r.name,description:r.description,inputSchema:r.inputSchema}))}}handleToolsCall(r){let e=r.params;if(!e||typeof e.name!="string")return p(r.id,i.InvalidParams,'tools/call requires a "name" string');let o=e.arguments??{},n=chunkT5P2DWHN_js.b(e.name,o,this.bridge),c=n.success?{content:[{type:"text",text:typeof n.data=="string"?n.data:JSON.stringify(n.data,null,2)}]}:{isError:true,content:[{type:"text",text:n.error??"Unknown tool error"}]};return u(r.id,c)}};var x=1024*1024;function b(t,r={}){let e=new f(t,r),o=r.input??(typeof process<"u"&&process.stdin?process.stdin:null),n=r.output??(typeof process<"u"&&process.stdout?process.stdout:null),c=r.log??(s=>{typeof process<"u"&&process.stderr&&process.stderr.write(s+`
3
+ `}var T="2025-06-18",f=class{constructor(r,e={}){this.bridge=r,this.opts={name:e.name??"@eigenpal/docx-editor-agents",version:e.version??"0.0.0",protocolVersion:e.protocolVersion??T};}handle(r){if(!v(r))return null;let e=r;try{switch(e.method){case "initialize":return u(e.id,this.handleInitialize());case "tools/list":return u(e.id,this.handleToolsList());case "tools/call":return this.handleToolsCall(e);case "ping":return u(e.id,{});default:return p(e.id,i.MethodNotFound,`Method not found: ${e.method}`)}}catch(o){return p(e.id,i.InternalError,o instanceof Error?o.message:String(o))}}handleInitialize(){return {protocolVersion:this.opts.protocolVersion,capabilities:{tools:{}},serverInfo:{name:this.opts.name,version:this.opts.version}}}handleToolsList(){return {tools:chunkRI5S75JY_js.a.map(r=>({name:r.name,description:r.description,inputSchema:r.inputSchema}))}}handleToolsCall(r){let e=r.params;if(!e||typeof e.name!="string")return p(r.id,i.InvalidParams,'tools/call requires a "name" string');let o=e.arguments??{},n=chunkRI5S75JY_js.b(e.name,o,this.bridge),c=n.success?{content:[{type:"text",text:typeof n.data=="string"?n.data:JSON.stringify(n.data,null,2)}]}:{isError:true,content:[{type:"text",text:n.error??"Unknown tool error"}]};return u(r.id,c)}};var x=1024*1024;function b(t,r={}){let e=new f(t,r),o=r.input??(typeof process<"u"&&process.stdin?process.stdin:null),n=r.output??(typeof process<"u"&&process.stdout?process.stdout:null),c=r.log??(s=>{typeof process<"u"&&process.stderr&&process.stderr.write(s+`
4
4
  `);});if(!o||!n)throw new Error("runStdioServer: no input/output stream available. Pass options.input and options.output, or run inside a Node process with stdin/stdout.");let a=n,h=new string_decoder.StringDecoder("utf8"),l="",R=false;function w(s){let g=e.handle(s);g!==null&&a.write(d(g));}function J(s){if(R)return;if(l+=typeof s=="string"?s:h.write(s),l.length>x){l="",c(`MCP buffer overflow (>${x} bytes without newline) \u2014 dropped`),a.write(d(p(null,i.ParseError,"Frame too large")));return}let{messages:g,parseErrors:E,rest:k}=y(l);l=k;for(let m of g)w(m);for(let m of E)c(`MCP parse error: ${m}`),a.write(d(p(null,i.ParseError,"Parse error",m)));}return o.on("data",J),o.on("end",()=>{R=true;}),o.on("error",s=>{c(`MCP input error: ${s.message}`),R=true;}),{server:e,feed:J,close(){R=true;}}}exports.ErrorCode=i;exports.McpServer=f;exports.encodeFrame=d;exports.isJsonRpcNotification=I;exports.isJsonRpcRequest=v;exports.makeError=p;exports.makeSuccess=u;exports.parseFrames=y;exports.runStdioServer=b;
package/dist/mcp.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import {a,b as b$1}from'./chunk-TICYYVCD.mjs';import {StringDecoder}from'string_decoder';var i={ParseError:-32700,InvalidRequest:-32600,MethodNotFound:-32601,InvalidParams:-32602,InternalError:-32603};function v(t){return typeof t=="object"&&t!==null&&t.jsonrpc==="2.0"&&typeof t.method=="string"&&"id"in t}function I(t){return typeof t=="object"&&t!==null&&t.jsonrpc==="2.0"&&typeof t.method=="string"&&!("id"in t)}function u(t,r){return {jsonrpc:"2.0",id:t,result:r}}function p(t,r,e,o){return {jsonrpc:"2.0",id:t,error:o===void 0?{code:r,message:e}:{code:r,message:e,data:o}}}function y(t){let r=[],e=[],o=t.split(`
1
+ import {a,b as b$1}from'./chunk-24MVJKCP.mjs';import {StringDecoder}from'string_decoder';var i={ParseError:-32700,InvalidRequest:-32600,MethodNotFound:-32601,InvalidParams:-32602,InternalError:-32603};function v(t){return typeof t=="object"&&t!==null&&t.jsonrpc==="2.0"&&typeof t.method=="string"&&"id"in t}function I(t){return typeof t=="object"&&t!==null&&t.jsonrpc==="2.0"&&typeof t.method=="string"&&!("id"in t)}function u(t,r){return {jsonrpc:"2.0",id:t,result:r}}function p(t,r,e,o){return {jsonrpc:"2.0",id:t,error:o===void 0?{code:r,message:e}:{code:r,message:e,data:o}}}function y(t){let r=[],e=[],o=t.split(`
2
2
  `),n=o.pop()??"";for(let c of o){let a=c.trim();if(a)try{r.push(JSON.parse(a));}catch{e.push(a);}}return {messages:r,parseErrors:e,rest:n}}function d(t){return JSON.stringify(t)+`
3
3
  `}var T="2025-06-18",f=class{constructor(r,e={}){this.bridge=r,this.opts={name:e.name??"@eigenpal/docx-editor-agents",version:e.version??"0.0.0",protocolVersion:e.protocolVersion??T};}handle(r){if(!v(r))return null;let e=r;try{switch(e.method){case "initialize":return u(e.id,this.handleInitialize());case "tools/list":return u(e.id,this.handleToolsList());case "tools/call":return this.handleToolsCall(e);case "ping":return u(e.id,{});default:return p(e.id,i.MethodNotFound,`Method not found: ${e.method}`)}}catch(o){return p(e.id,i.InternalError,o instanceof Error?o.message:String(o))}}handleInitialize(){return {protocolVersion:this.opts.protocolVersion,capabilities:{tools:{}},serverInfo:{name:this.opts.name,version:this.opts.version}}}handleToolsList(){return {tools:a.map(r=>({name:r.name,description:r.description,inputSchema:r.inputSchema}))}}handleToolsCall(r){let e=r.params;if(!e||typeof e.name!="string")return p(r.id,i.InvalidParams,'tools/call requires a "name" string');let o=e.arguments??{},n=b$1(e.name,o,this.bridge),c=n.success?{content:[{type:"text",text:typeof n.data=="string"?n.data:JSON.stringify(n.data,null,2)}]}:{isError:true,content:[{type:"text",text:n.error??"Unknown tool error"}]};return u(r.id,c)}};var x=1024*1024;function b(t,r={}){let e=new f(t,r),o=r.input??(typeof process<"u"&&process.stdin?process.stdin:null),n=r.output??(typeof process<"u"&&process.stdout?process.stdout:null),c=r.log??(s=>{typeof process<"u"&&process.stderr&&process.stderr.write(s+`
4
4
  `);});if(!o||!n)throw new Error("runStdioServer: no input/output stream available. Pass options.input and options.output, or run inside a Node process with stdin/stdout.");let a=n,h=new StringDecoder("utf8"),l="",R=false;function w(s){let g=e.handle(s);g!==null&&a.write(d(g));}function J(s){if(R)return;if(l+=typeof s=="string"?s:h.write(s),l.length>x){l="",c(`MCP buffer overflow (>${x} bytes without newline) \u2014 dropped`),a.write(d(p(null,i.ParseError,"Frame too large")));return}let{messages:g,parseErrors:E,rest:k}=y(l);l=k;for(let m of g)w(m);for(let m of E)c(`MCP parse error: ${m}`),a.write(d(p(null,i.ParseError,"Parse error",m)));}return o.on("data",J),o.on("end",()=>{R=true;}),o.on("error",s=>{c(`MCP input error: ${s.message}`),R=true;}),{server:e,feed:J,close(){R=true;}}}export{i as ErrorCode,f as McpServer,d as encodeFrame,I as isJsonRpcNotification,v as isJsonRpcRequest,p as makeError,u as makeSuccess,y as parseFrames,b as runStdioServer};
package/dist/react.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { E as EditorRefLike, A as AgentToolDefinition, g as getToolSchemas, a as AgentToolResult, b as AgentContextSnapshot } from './server-B7dGWiLh.mjs';
2
- export { U as UseAgentChatOptions, c as UseAgentChatReturn, d as getToolDisplayName, u as useAgentChat } from './server-B7dGWiLh.mjs';
1
+ import { E as EditorRefLike, A as AgentToolDefinition, g as getToolSchemas, a as AgentToolResult, b as AgentContextSnapshot } from './server-CLaXsEC8.mjs';
2
+ export { U as UseAgentChatOptions, c as UseAgentChatReturn, d as getToolDisplayName, u as useAgentChat } from './server-CLaXsEC8.mjs';
3
3
 
4
4
  /**
5
5
  * useDocxAgentTools — wires the toolkit to a live DocxEditor for BYO chat
package/dist/react.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { E as EditorRefLike, A as AgentToolDefinition, g as getToolSchemas, a as AgentToolResult, b as AgentContextSnapshot } from './server-B7dGWiLh.js';
2
- export { U as UseAgentChatOptions, c as UseAgentChatReturn, d as getToolDisplayName, u as useAgentChat } from './server-B7dGWiLh.js';
1
+ import { E as EditorRefLike, A as AgentToolDefinition, g as getToolSchemas, a as AgentToolResult, b as AgentContextSnapshot } from './server-CLaXsEC8.js';
2
+ export { U as UseAgentChatOptions, c as UseAgentChatReturn, d as getToolDisplayName, u as useAgentChat } from './server-CLaXsEC8.js';
3
3
 
4
4
  /**
5
5
  * useDocxAgentTools — wires the toolkit to a live DocxEditor for BYO chat
package/dist/react.js CHANGED
@@ -1 +1 @@
1
- 'use strict';var chunkO7DEBIDX_js=require('./chunk-O7DEBIDX.js'),chunkT5P2DWHN_js=require('./chunk-T5P2DWHN.js'),react=require('react');function S(T){let{editorRef:i,author:l="AI",tools:n,include:r,exclude:s}=T,m=!!n&&Object.keys(n).length>0,c=react.useCallback(t=>!(r&&!r.includes(t)||s&&s.includes(t)),[r,s]),A=react.useMemo(()=>{let t=r||s?chunkT5P2DWHN_js.a.filter(e=>c(e.name)):chunkT5P2DWHN_js.a;if(!m)return t.map(e=>({type:"function",function:{name:e.name,description:e.description,parameters:e.inputSchema}}));let o=new Map(t.map(e=>[e.name,e]));for(let[e,a]of Object.entries(n))o.set(e,a);return Array.from(o.values()).map(e=>({type:"function",function:{name:e.name,description:e.description,parameters:e.inputSchema}}))},[n,m,r,s,c]),y=react.useCallback((t,o)=>{let e=i.current;if(!e)return {success:false,error:"Editor not ready."};let a=chunkO7DEBIDX_js.b(e,l),d=n?.[t];if(d)try{return d.handler(o,a)}catch(u){return {success:false,error:u instanceof Error?u.message:String(u)}}return c(t)?chunkT5P2DWHN_js.b(t,o,a):{success:false,error:`Tool '${t}' is not enabled.`}},[i,l,n,c]),h=react.useCallback(()=>{let t=i.current;if(!t)return {selection:null,currentPage:0,totalPages:0};let o=chunkO7DEBIDX_js.b(t,l);return {selection:o.getSelection(),currentPage:o.getCurrentPage(),totalPages:o.getTotalPages()}},[i,l]);return {tools:A,executeToolCall:y,getContext:h}}Object.defineProperty(exports,"useAgentChat",{enumerable:true,get:function(){return chunkO7DEBIDX_js.a}});Object.defineProperty(exports,"getToolDisplayName",{enumerable:true,get:function(){return chunkT5P2DWHN_js.c}});exports.useDocxAgentTools=S;
1
+ 'use strict';var chunkNLYXACTI_js=require('./chunk-NLYXACTI.js'),chunkRI5S75JY_js=require('./chunk-RI5S75JY.js'),react=require('react');function S(T){let{editorRef:i,author:l="AI",tools:n,include:r,exclude:s}=T,m=!!n&&Object.keys(n).length>0,c=react.useCallback(t=>!(r&&!r.includes(t)||s&&s.includes(t)),[r,s]),A=react.useMemo(()=>{let t=r||s?chunkRI5S75JY_js.a.filter(e=>c(e.name)):chunkRI5S75JY_js.a;if(!m)return t.map(e=>({type:"function",function:{name:e.name,description:e.description,parameters:e.inputSchema}}));let o=new Map(t.map(e=>[e.name,e]));for(let[e,a]of Object.entries(n))o.set(e,a);return Array.from(o.values()).map(e=>({type:"function",function:{name:e.name,description:e.description,parameters:e.inputSchema}}))},[n,m,r,s,c]),y=react.useCallback((t,o)=>{let e=i.current;if(!e)return {success:false,error:"Editor not ready."};let a=chunkNLYXACTI_js.b(e,l),d=n?.[t];if(d)try{return d.handler(o,a)}catch(u){return {success:false,error:u instanceof Error?u.message:String(u)}}return c(t)?chunkRI5S75JY_js.b(t,o,a):{success:false,error:`Tool '${t}' is not enabled.`}},[i,l,n,c]),h=react.useCallback(()=>{let t=i.current;if(!t)return {selection:null,currentPage:0,totalPages:0};let o=chunkNLYXACTI_js.b(t,l);return {selection:o.getSelection(),currentPage:o.getCurrentPage(),totalPages:o.getTotalPages()}},[i,l]);return {tools:A,executeToolCall:y,getContext:h}}Object.defineProperty(exports,"useAgentChat",{enumerable:true,get:function(){return chunkNLYXACTI_js.a}});Object.defineProperty(exports,"getToolDisplayName",{enumerable:true,get:function(){return chunkRI5S75JY_js.c}});exports.useDocxAgentTools=S;
package/dist/react.mjs CHANGED
@@ -1 +1 @@
1
- import {b}from'./chunk-WGUYD2A2.mjs';export{a as useAgentChat}from'./chunk-WGUYD2A2.mjs';import {a,b as b$1}from'./chunk-TICYYVCD.mjs';export{c as getToolDisplayName}from'./chunk-TICYYVCD.mjs';import {useCallback,useMemo}from'react';function S(T){let{editorRef:i,author:l="AI",tools:n,include:r,exclude:s}=T,m=!!n&&Object.keys(n).length>0,c=useCallback(t=>!(r&&!r.includes(t)||s&&s.includes(t)),[r,s]),A=useMemo(()=>{let t=r||s?a.filter(e=>c(e.name)):a;if(!m)return t.map(e=>({type:"function",function:{name:e.name,description:e.description,parameters:e.inputSchema}}));let o=new Map(t.map(e=>[e.name,e]));for(let[e,a]of Object.entries(n))o.set(e,a);return Array.from(o.values()).map(e=>({type:"function",function:{name:e.name,description:e.description,parameters:e.inputSchema}}))},[n,m,r,s,c]),y=useCallback((t,o)=>{let e=i.current;if(!e)return {success:false,error:"Editor not ready."};let a=b(e,l),d=n?.[t];if(d)try{return d.handler(o,a)}catch(u){return {success:false,error:u instanceof Error?u.message:String(u)}}return c(t)?b$1(t,o,a):{success:false,error:`Tool '${t}' is not enabled.`}},[i,l,n,c]),h=useCallback(()=>{let t=i.current;if(!t)return {selection:null,currentPage:0,totalPages:0};let o=b(t,l);return {selection:o.getSelection(),currentPage:o.getCurrentPage(),totalPages:o.getTotalPages()}},[i,l]);return {tools:A,executeToolCall:y,getContext:h}}export{S as useDocxAgentTools};
1
+ import {b}from'./chunk-74RQEWM7.mjs';export{a as useAgentChat}from'./chunk-74RQEWM7.mjs';import {a,b as b$1}from'./chunk-24MVJKCP.mjs';export{c as getToolDisplayName}from'./chunk-24MVJKCP.mjs';import {useCallback,useMemo}from'react';function S(T){let{editorRef:i,author:l="AI",tools:n,include:r,exclude:s}=T,m=!!n&&Object.keys(n).length>0,c=useCallback(t=>!(r&&!r.includes(t)||s&&s.includes(t)),[r,s]),A=useMemo(()=>{let t=r||s?a.filter(e=>c(e.name)):a;if(!m)return t.map(e=>({type:"function",function:{name:e.name,description:e.description,parameters:e.inputSchema}}));let o=new Map(t.map(e=>[e.name,e]));for(let[e,a]of Object.entries(n))o.set(e,a);return Array.from(o.values()).map(e=>({type:"function",function:{name:e.name,description:e.description,parameters:e.inputSchema}}))},[n,m,r,s,c]),y=useCallback((t,o)=>{let e=i.current;if(!e)return {success:false,error:"Editor not ready."};let a=b(e,l),d=n?.[t];if(d)try{return d.handler(o,a)}catch(u){return {success:false,error:u instanceof Error?u.message:String(u)}}return c(t)?b$1(t,o,a):{success:false,error:`Tool '${t}' is not enabled.`}},[i,l,n,c]),h=useCallback(()=>{let t=i.current;if(!t)return {selection:null,currentPage:0,totalPages:0};let o=b(t,l);return {selection:o.getSelection(),currentPage:o.getCurrentPage(),totalPages:o.getTotalPages()}},[i,l]);return {tools:A,executeToolCall:y,getContext:h}}export{S as useDocxAgentTools};
@@ -178,6 +178,13 @@ type ParagraphAlignment = 'left' | 'center' | 'right' | 'both' | 'distribute' |
178
178
  /**
179
179
  * Complete paragraph formatting properties (w:pPr)
180
180
  */
181
+ /** Per-side flags identifying which `<w:spacing>` attrs were inline (not
182
+ * inherited from a style chain). Used to suppress style-only spacing on
183
+ * empty paragraphs per Word's behavior. */
184
+ type SpacingExplicit = {
185
+ before?: boolean;
186
+ after?: boolean;
187
+ };
181
188
  interface ParagraphFormatting {
182
189
  /** Paragraph alignment (w:jc) */
183
190
  alignment?: ParagraphAlignment;
@@ -195,6 +202,12 @@ interface ParagraphFormatting {
195
202
  beforeAutospacing?: boolean;
196
203
  /** Auto space after (w:spacing/@w:afterAutospacing) */
197
204
  afterAutospacing?: boolean;
205
+ /**
206
+ * Per-side flags marking which `<w:spacing>` attrs came from this
207
+ * paragraph's own pPr (vs inherited). Word collapses style-inherited
208
+ * spacing on empty paragraphs but honors the explicit values.
209
+ */
210
+ spacingExplicit?: SpacingExplicit;
198
211
  /** Left indent in twips (w:ind/@w:left) */
199
212
  indentLeft?: number;
200
213
  /** Right indent in twips (w:ind/@w:right) */
@@ -532,6 +545,14 @@ interface ListRendering {
532
545
  * may need a different format (e.g., upperRoman parent + decimal child).
533
546
  */
534
547
  levelNumFmts?: NumberFormat[];
548
+ /** abstractNumId the paragraph's numId points to (counters key on this). */
549
+ abstractNumId?: number;
550
+ /**
551
+ * Start value from the numId's lvlOverride for the paragraph's ilvl, if any.
552
+ * Per ECMA-376 §17.9.18, this resets the shared abstractNum counter the
553
+ * first time the numId appears.
554
+ */
555
+ startOverride?: number;
535
556
  }
536
557
  /**
537
558
  * Complete numbering definitions
@@ -1262,6 +1283,8 @@ interface Paragraph {
1262
1283
  content: ParagraphContent[];
1263
1284
  /** Computed list rendering (if this is a list item) */
1264
1285
  listRendering?: ListRendering;
1286
+ /** Word's cached layout says this paragraph started on a new rendered page. */
1287
+ renderedPageBreakBefore?: boolean;
1265
1288
  /** Section properties (if this paragraph ends a section) */
1266
1289
  sectionProperties?: SectionProperties;
1267
1290
  }
@@ -1329,8 +1352,14 @@ interface Footnote {
1329
1352
  id: number;
1330
1353
  /** Special footnote type */
1331
1354
  noteType?: 'normal' | 'separator' | 'continuationSeparator' | 'continuationNotice';
1332
- /** Content */
1333
- content: Paragraph[];
1355
+ /**
1356
+ * Content. Per ECMA-376 §17.11.10 footnotes can hold the same blocks as
1357
+ * the body — paragraphs and tables. The parser previously only collected
1358
+ * <w:p> children which silently dropped any <w:tbl> inside a footnote;
1359
+ * widened to match HeaderFooter / TableCell shape so the body pipeline
1360
+ * (toProseDoc → toFlowBlocks) can render them uniformly.
1361
+ */
1362
+ content: (Paragraph | Table)[];
1334
1363
  }
1335
1364
  /**
1336
1365
  * Endnote (w:endnote)
@@ -1341,8 +1370,11 @@ interface Endnote {
1341
1370
  id: number;
1342
1371
  /** Special endnote type */
1343
1372
  noteType?: 'normal' | 'separator' | 'continuationSeparator' | 'continuationNotice';
1344
- /** Content */
1345
- content: Paragraph[];
1373
+ /**
1374
+ * Content. Per ECMA-376 §17.11.4 endnotes can hold the same blocks as
1375
+ * the body — paragraphs and tables. See note on `Footnote.content`.
1376
+ */
1377
+ content: (Paragraph | Table)[];
1346
1378
  }
1347
1379
  /**
1348
1380
  * Page orientation
@@ -178,6 +178,13 @@ type ParagraphAlignment = 'left' | 'center' | 'right' | 'both' | 'distribute' |
178
178
  /**
179
179
  * Complete paragraph formatting properties (w:pPr)
180
180
  */
181
+ /** Per-side flags identifying which `<w:spacing>` attrs were inline (not
182
+ * inherited from a style chain). Used to suppress style-only spacing on
183
+ * empty paragraphs per Word's behavior. */
184
+ type SpacingExplicit = {
185
+ before?: boolean;
186
+ after?: boolean;
187
+ };
181
188
  interface ParagraphFormatting {
182
189
  /** Paragraph alignment (w:jc) */
183
190
  alignment?: ParagraphAlignment;
@@ -195,6 +202,12 @@ interface ParagraphFormatting {
195
202
  beforeAutospacing?: boolean;
196
203
  /** Auto space after (w:spacing/@w:afterAutospacing) */
197
204
  afterAutospacing?: boolean;
205
+ /**
206
+ * Per-side flags marking which `<w:spacing>` attrs came from this
207
+ * paragraph's own pPr (vs inherited). Word collapses style-inherited
208
+ * spacing on empty paragraphs but honors the explicit values.
209
+ */
210
+ spacingExplicit?: SpacingExplicit;
198
211
  /** Left indent in twips (w:ind/@w:left) */
199
212
  indentLeft?: number;
200
213
  /** Right indent in twips (w:ind/@w:right) */
@@ -532,6 +545,14 @@ interface ListRendering {
532
545
  * may need a different format (e.g., upperRoman parent + decimal child).
533
546
  */
534
547
  levelNumFmts?: NumberFormat[];
548
+ /** abstractNumId the paragraph's numId points to (counters key on this). */
549
+ abstractNumId?: number;
550
+ /**
551
+ * Start value from the numId's lvlOverride for the paragraph's ilvl, if any.
552
+ * Per ECMA-376 §17.9.18, this resets the shared abstractNum counter the
553
+ * first time the numId appears.
554
+ */
555
+ startOverride?: number;
535
556
  }
536
557
  /**
537
558
  * Complete numbering definitions
@@ -1262,6 +1283,8 @@ interface Paragraph {
1262
1283
  content: ParagraphContent[];
1263
1284
  /** Computed list rendering (if this is a list item) */
1264
1285
  listRendering?: ListRendering;
1286
+ /** Word's cached layout says this paragraph started on a new rendered page. */
1287
+ renderedPageBreakBefore?: boolean;
1265
1288
  /** Section properties (if this paragraph ends a section) */
1266
1289
  sectionProperties?: SectionProperties;
1267
1290
  }
@@ -1329,8 +1352,14 @@ interface Footnote {
1329
1352
  id: number;
1330
1353
  /** Special footnote type */
1331
1354
  noteType?: 'normal' | 'separator' | 'continuationSeparator' | 'continuationNotice';
1332
- /** Content */
1333
- content: Paragraph[];
1355
+ /**
1356
+ * Content. Per ECMA-376 §17.11.10 footnotes can hold the same blocks as
1357
+ * the body — paragraphs and tables. The parser previously only collected
1358
+ * <w:p> children which silently dropped any <w:tbl> inside a footnote;
1359
+ * widened to match HeaderFooter / TableCell shape so the body pipeline
1360
+ * (toProseDoc → toFlowBlocks) can render them uniformly.
1361
+ */
1362
+ content: (Paragraph | Table)[];
1334
1363
  }
1335
1364
  /**
1336
1365
  * Endnote (w:endnote)
@@ -1341,8 +1370,11 @@ interface Endnote {
1341
1370
  id: number;
1342
1371
  /** Special endnote type */
1343
1372
  noteType?: 'normal' | 'separator' | 'continuationSeparator' | 'continuationNotice';
1344
- /** Content */
1345
- content: Paragraph[];
1373
+ /**
1374
+ * Content. Per ECMA-376 §17.11.4 endnotes can hold the same blocks as
1375
+ * the body — paragraphs and tables. See note on `Footnote.content`.
1376
+ */
1377
+ content: (Paragraph | Table)[];
1346
1378
  }
1347
1379
  /**
1348
1380
  * Page orientation
package/dist/server.d.mts CHANGED
@@ -1 +1 @@
1
- export { b as AgentContextSnapshot, A as AgentToolDefinition, a as AgentToolResult, D as DocxReviewer, v as EditorBridge, S as SelectionInfo, s as createReviewerBridge, r as docxAgentTools, t as executeToolCall, d as getToolDisplayName, g as getToolSchemas } from './server-B7dGWiLh.mjs';
1
+ export { b as AgentContextSnapshot, A as AgentToolDefinition, a as AgentToolResult, D as DocxReviewer, v as EditorBridge, S as SelectionInfo, s as createReviewerBridge, r as docxAgentTools, t as executeToolCall, d as getToolDisplayName, g as getToolSchemas } from './server-CLaXsEC8.mjs';
package/dist/server.d.ts CHANGED
@@ -1 +1 @@
1
- export { b as AgentContextSnapshot, A as AgentToolDefinition, a as AgentToolResult, D as DocxReviewer, v as EditorBridge, S as SelectionInfo, s as createReviewerBridge, r as docxAgentTools, t as executeToolCall, d as getToolDisplayName, g as getToolSchemas } from './server-B7dGWiLh.js';
1
+ export { b as AgentContextSnapshot, A as AgentToolDefinition, a as AgentToolResult, D as DocxReviewer, v as EditorBridge, S as SelectionInfo, s as createReviewerBridge, r as docxAgentTools, t as executeToolCall, d as getToolDisplayName, g as getToolSchemas } from './server-CLaXsEC8.js';
package/dist/server.js CHANGED
@@ -1 +1 @@
1
- 'use strict';var chunkU7PAJJYD_js=require('./chunk-U7PAJJYD.js'),chunk3HEONW4M_js=require('./chunk-3HEONW4M.js'),chunkT5P2DWHN_js=require('./chunk-T5P2DWHN.js');Object.defineProperty(exports,"DocxReviewer",{enumerable:true,get:function(){return chunkU7PAJJYD_js.a}});Object.defineProperty(exports,"createReviewerBridge",{enumerable:true,get:function(){return chunk3HEONW4M_js.m}});Object.defineProperty(exports,"docxAgentTools",{enumerable:true,get:function(){return chunkT5P2DWHN_js.a}});Object.defineProperty(exports,"executeToolCall",{enumerable:true,get:function(){return chunkT5P2DWHN_js.b}});Object.defineProperty(exports,"getToolDisplayName",{enumerable:true,get:function(){return chunkT5P2DWHN_js.c}});Object.defineProperty(exports,"getToolSchemas",{enumerable:true,get:function(){return chunkT5P2DWHN_js.d}});
1
+ 'use strict';var chunkMREPAMXX_js=require('./chunk-MREPAMXX.js'),chunkYCUXBRD7_js=require('./chunk-YCUXBRD7.js'),chunkRI5S75JY_js=require('./chunk-RI5S75JY.js');Object.defineProperty(exports,"DocxReviewer",{enumerable:true,get:function(){return chunkMREPAMXX_js.a}});Object.defineProperty(exports,"createReviewerBridge",{enumerable:true,get:function(){return chunkYCUXBRD7_js.m}});Object.defineProperty(exports,"docxAgentTools",{enumerable:true,get:function(){return chunkRI5S75JY_js.a}});Object.defineProperty(exports,"executeToolCall",{enumerable:true,get:function(){return chunkRI5S75JY_js.b}});Object.defineProperty(exports,"getToolDisplayName",{enumerable:true,get:function(){return chunkRI5S75JY_js.c}});Object.defineProperty(exports,"getToolSchemas",{enumerable:true,get:function(){return chunkRI5S75JY_js.d}});
package/dist/server.mjs CHANGED
@@ -1 +1 @@
1
- export{a as DocxReviewer}from'./chunk-HTCA4A6G.mjs';export{m as createReviewerBridge}from'./chunk-AMRM73UC.mjs';export{a as docxAgentTools,b as executeToolCall,c as getToolDisplayName,d as getToolSchemas}from'./chunk-TICYYVCD.mjs';
1
+ export{a as DocxReviewer}from'./chunk-H7HNGCMH.mjs';export{m as createReviewerBridge}from'./chunk-HSAYNLBS.mjs';export{a as docxAgentTools,b as executeToolCall,c as getToolDisplayName,d as getToolSchemas}from'./chunk-24MVJKCP.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eigenpal/docx-editor-agents",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
4
  "description": "Agent-friendly API for DOCX document review — read, comment, propose changes, accept/reject tracked changes",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -101,6 +101,7 @@
101
101
  ],
102
102
  "author": "EigenPal",
103
103
  "license": "AGPL-3.0-or-later",
104
+ "homepage": "https://docx-editor.dev/",
104
105
  "repository": {
105
106
  "type": "git",
106
107
  "url": "https://github.com/eigenpal/docx-editor.git",