@eigenpal/docx-editor-agents 1.5.0 → 1.6.1
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.
- package/README.md +1 -1
- package/dist/ai-sdk/server.js +1 -1
- package/dist/ai-sdk/server.mjs +1 -1
- package/dist/bridge.d.mts +1 -1
- package/dist/bridge.d.ts +1 -1
- package/dist/bridge.js +1 -1
- package/dist/bridge.mjs +1 -1
- package/dist/chunk-3RLSV2EA.mjs +2 -0
- package/dist/chunk-5THPDZLF.mjs +5 -0
- package/dist/{chunk-XDZHYYU6.mjs → chunk-6RMDMHUK.mjs} +1 -1
- package/dist/{chunk-RI5S75JY.js → chunk-AO5SO6ZS.js} +4 -4
- package/dist/chunk-EX4NO3JP.js +5 -0
- package/dist/{chunk-RYT33AHF.js → chunk-JMEIIPEL.js} +1 -1
- package/dist/{chunk-EPRXZTIE.js → chunk-MMJQ47Q7.js} +1 -1
- package/dist/{chunk-24MVJKCP.mjs → chunk-MSKW7E36.mjs} +4 -4
- package/dist/chunk-RTU2ZS7R.js +75 -0
- package/dist/chunk-X5FXVERG.mjs +75 -0
- package/dist/{chunk-BFGKTTP7.mjs → chunk-YAKNDLQA.mjs} +1 -1
- package/dist/chunk-YIZV6SSD.js +2 -0
- package/dist/executor-3N3ESB3N.mjs +1 -0
- package/dist/executor-KLVHM2GK.js +1 -0
- package/dist/headless-6GD55ATM.js +1 -0
- package/dist/{headless-6HFY6GHX.mjs → headless-ESEZ6OHS.mjs} +1 -1
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/mcp.d.mts +1 -1
- package/dist/mcp.d.ts +1 -1
- package/dist/mcp.js +3 -3
- package/dist/mcp.mjs +3 -3
- package/dist/react.d.mts +8 -8
- package/dist/react.d.ts +8 -8
- package/dist/react.js +2 -2
- package/dist/react.mjs +1 -1
- package/dist/{server-D1vJRNf0.d.mts → server-DP8QoY84.d.mts} +22 -0
- package/dist/{server-D1vJRNf0.d.ts → server-DP8QoY84.d.ts} +22 -0
- package/dist/server.d.mts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +1 -1
- package/dist/server.mjs +1 -1
- package/dist/vue.js +6 -6
- package/dist/vue.mjs +226 -179
- package/package.json +1 -1
- package/dist/chunk-3XKOKAHP.mjs +0 -75
- package/dist/chunk-4I6U7BWX.mjs +0 -2
- package/dist/chunk-HSVOT6AW.mjs +0 -5
- package/dist/chunk-HTMMNA3I.js +0 -75
- package/dist/chunk-UTMAYI7M.js +0 -2
- package/dist/chunk-VPUAYS3Y.js +0 -5
- package/dist/executor-SBR6X4JZ.mjs +0 -1
- package/dist/executor-ZTSOZMKE.js +0 -1
- package/dist/headless-HVIRJIN4.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import {e,f,l as l$1,m,b,j,i,c,k,h,a,d}from'./chunk-
|
|
1
|
+
import {e,f,l as l$1,m,b,j,i,c,k,h,a,d}from'./chunk-5THPDZLF.mjs';import {w}from'./chunk-X5FXVERG.mjs';function y(n,e){let{paragraphIndex:t,author:o="AI",text:s,search:a}=e,r=b(n,t),c=(n.comments??[]).map(m=>m.id),p=c.length>0?Math.max(...c)+1:1,i={id:p,author:o,date:new Date().toISOString(),content:[{type:"paragraph",content:[{type:"run",content:[{type:"text",text:s}]}],formatting:{}}]};if(n.comments||(n.comments=[]),n.comments.push(i),a){let m=j(r,a,t);r.content.splice(m.endRunIndex+1,0,{type:"commentRangeEnd",id:p}),r.content.splice(m.startRunIndex,0,{type:"commentRangeStart",id:p});}else r.content.unshift({type:"commentRangeStart",id:p}),r.content.push({type:"commentRangeEnd",id:p});return p}function C(n,e,t){let o=n.comments??[];if(!o.find(p=>p.id===e))throw new i(e);let a=o.map(p=>p.id),r=Math.max(...a)+1,c={id:r,author:t.author??"AI",date:new Date().toISOString(),parentId:e,content:[{type:"paragraph",content:[{type:"run",content:[{type:"text",text:t.text}]}],formatting:{}}]};return o.push(c),r}function N(n,e){let t=n.comments??[],o=t.find(r=>r.id===e);if(!o)throw new i(e);let s=o.parentId!==void 0,a=new Set([e]);if(!s)for(let r of t)r.parentId===e&&a.add(r.id);n.comments=t.filter(r=>!a.has(r.id)),!s&&c(n,r=>{for(let c=r.content.length-1;c>=0;c--){let p=r.content[c];(p.type==="commentRangeStart"||p.type==="commentRangeEnd")&&p.id===e&&r.content.splice(c,1);}});}function I(n,e,t){if(!W(n,e,"accept",t))throw new h(typeof e=="number"?e:e.id)}function R(n,e,t){if(!W(n,e,"reject",t))throw new h(typeof e=="number"?e:e.id)}function F(n,e,t){return G(n,"accept",e,t)}function M(n,e,t){return G(n,"reject",e,t)}function l(n,e,t){let o=0;for(let s=n.content.length-1;s>=0;s--){let a$1=n.content[s];a(a$1)&&t(a$1)&&(J(n,s,a$1,e),o++);}return o}function W(n,e,t,o){if(typeof e!="number"&&e.noteType){let a=e.noteType==="footnote"?o?.footnotes:o?.endnotes,r=e.noteId!==void 0?a?.find(c=>c.id===e.noteId):void 0;return r?z(r,e.id,t):false}let s=typeof e=="number"?e:e.id;return q(n,s,t)}function G(n,e,t,o){let s=0;if(c(n,a=>{s+=l(a,e,()=>true);}),t?.includeFootnotes&&o?.footnotes)for(let a of o.footnotes)d(a,r=>{s+=l(r,e,()=>true);});if(t?.includeEndnotes&&o?.endnotes)for(let a of o.endnotes)d(a,r=>{s+=l(r,e,()=>true);});return s}function q(n,e,t){let o=false;return c(n,s=>{if(l(s,t,a=>a.info.id===e)>0&&(o=true),o)return false}),o}function z(n,e,t){let o=false;return d(n,s=>{l(s,t,a=>a.info.id===e)>0&&(o=true);}),o}function J(n,e,t,o){if(t.type==="insertion"&&o==="accept"||t.type==="deletion"&&o==="reject"||t.type==="moveTo"&&o==="accept"||t.type==="moveFrom"&&o==="reject"){let a=t.content;n.content.splice(e,1,...a);}else n.content.splice(e,1);}function x(n,e){let{paragraphIndex:t,search:o,author:s="AI",replaceWith:a}=e,r=b(n,t),{startIndex:c,endIndex:p}=k(r,o,t),i=new Date().toISOString(),m=P(n),d=r.content.slice(c,p+1),v={type:"deletion",info:{id:m,author:s,date:i},content:d},b$1={type:"insertion",info:{id:m+1,author:s,date:i},content:[{type:"run",content:[{type:"text",text:a}]}]};r.content.splice(c,p-c+1,v,b$1);}function H(n,e){let{paragraphIndex:t,author:o="AI",insertText:s,position:a="after",search:r}=e,c=b(n,t),p=new Date().toISOString(),m={type:"insertion",info:{id:P(n),author:o,date:p},content:[{type:"run",content:[{type:"text",text:s}]}]};if(r){let{startIndex:d,endIndex:v}=k(c,r,t),b=a==="after"?v+1:d;c.content.splice(b,0,m);}else a==="before"?c.content.unshift(m):c.content.push(m);}function L(n,e){let{paragraphIndex:t,search:o,author:s="AI"}=e,a=b(n,t),{startIndex:r,endIndex:c}=k(a,o,t),p=new Date().toISOString(),i=P(n),m=a.content.slice(r,c+1),d={type:"deletion",info:{id:i,author:s,date:p},content:m};a.content.splice(r,c-r+1,d);}var S=new WeakMap;function P(n){let e=S.get(n);e===void 0&&(e=0,c(n,o=>{for(let s of o.content)a(s)&&(e=Math.max(e,s.info.id));}));let t=e+1;return S.set(n,t+1),t}function U(n,e,t="AI"){let o=[],s=0,a=0,r=0,c=0,p=0;for(let i of e.accept??[])try{I(n,i),s++;}catch(m){o.push({operation:"accept",id:i,error:m.message});}for(let i of e.reject??[])try{R(n,i),a++;}catch(m){o.push({operation:"reject",id:i,error:m.message});}for(let i of e.comments??[])try{y(n,{...i,author:i.author??t}),r++;}catch(m){o.push({operation:"comment",search:i.search,error:m.message});}for(let i of e.replies??[])try{C(n,i.commentId,{author:i.author??t,text:i.text}),c++;}catch(m){o.push({operation:"reply",id:i.commentId,error:m.message});}for(let i of e.proposals??[])try{x(n,{...i,author:i.author??t}),p++;}catch(m){o.push({operation:"proposal",search:i.search,error:m.message});}return {accepted:s,rejected:a,commentsAdded:r,repliesAdded:c,proposalsAdded:p,errors:o}}var X=class n{constructor(e,t="AI",o){let s=o??e.originalBuffer,{originalBuffer:a,...r}=e;this.doc=structuredClone(r),s&&(this.doc.originalBuffer=s),this.author=t;}static async fromBuffer(e,t="AI"){let o=await w(e,{preloadFonts:false});return new n(o,t,e)}get body(){return this.doc.package.document}resolveAuthor(e){return e??this.author}getContent(e$1){return e(this.body,e$1)}getContentAsText(e$1){return f(e(this.body,e$1))}getChanges(e){return l$1(this.body,e,{footnotes:this.doc.package.footnotes,endnotes:this.doc.package.endnotes})}getComments(e){return m(this.body,e)}addComment(e,t){let o=typeof e=="number"?{paragraphIndex:e,text:t,author:this.author}:{...e,author:this.resolveAuthor(e.author)};return y(this.body,o)}replyTo(e,t){let o=typeof t=="string"?{text:t,author:this.author}:{...t,author:this.resolveAuthor(t.author)};return C(this.body,e,o)}removeComment(e){N(this.body,e);}replace(e,t,o){let s=typeof e=="number"?{paragraphIndex:e,search:t,replaceWith:o,author:this.author}:{...e,author:this.resolveAuthor(e.author)};x(this.body,s);}proposeReplacement(e){this.replace(e);}proposeInsertion(e){H(this.body,{...e,author:this.resolveAuthor(e.author)});}proposeDeletion(e){L(this.body,{...e,author:this.resolveAuthor(e.author)});}acceptChange(e){I(this.body,e,this.changeNotes());}rejectChange(e){R(this.body,e,this.changeNotes());}acceptAll(e){return F(this.body,e,this.changeNotes())}rejectAll(e){return M(this.body,e,this.changeNotes())}changeNotes(){return {footnotes:this.doc.package.footnotes,endnotes:this.doc.package.endnotes}}applyReview(e){return U(this.body,e,this.author)}toDocument(){return this.doc}async toBuffer(){if(!this.doc.originalBuffer)throw new Error("Cannot create buffer: no original DOCX buffer was provided. Use DocxReviewer.fromBuffer() or pass originalBuffer to the constructor.");let{repackDocx:e}=await import('./headless-ESEZ6OHS.mjs');return e(this.doc)}};export{X as a};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var chunkEX4NO3JP_js=require('./chunk-EX4NO3JP.js');function y(n){return !n||n.length===0?"":n.map(l=>{let s=l;return s?.content?s.content.map(e=>e.content?.map(t=>t.text||"").join("")||"").join(""):""}).join(`
|
|
2
|
+
`)}function u(n){let l=n.getEditorRef();if(l){let e=l.getDocument();if(e?.package?.document)return e.package.document}return n.getDocument()?.package?.document??null}function k(n,l="AI"){function s(e){return e??l}return {getContentAsText(e){let t=u(n);return t?chunkEX4NO3JP_js.f(chunkEX4NO3JP_js.e(t,e)):""},getContent(e){let t=u(n);return t?chunkEX4NO3JP_js.e(t,e):[]},getComments(e){let t=u(n);if(!t)return [];let r=chunkEX4NO3JP_js.m(t,e);if(r.length>0)return r;let i=n.getComments();if(i.length===0)return [];let a=new Map,g=[];for(let o of i)if(o.parentId){let p=a.get(o.parentId);p?p.push(o):a.set(o.parentId,[o]);}else g.push(o);let m=[];for(let o of g){if(e?.author&&o.author!==e.author||e?.done!==void 0&&(o.done??false)!==e.done)continue;let p=a.get(o.id)??[];m.push({id:o.id,author:o.author,date:o.date??null,text:y(o.content),anchoredText:"",paragraphIndex:-1,replies:p.map(c=>({id:c.id,author:c.author,date:c.date??null,text:y(c.content)})),done:o.done??false});}return m},getChanges(e){let t=u(n);return t?chunkEX4NO3JP_js.l(t,e):[]},findText(e,t){return n.findInDocument(e,t)},getSelection(){return n.getSelectionInfo()},addComment(e){return n.addComment({paraId:e.paraId,text:e.text,author:s(e.author),search:e.search})},replyTo(e,t){return n.replyToComment(e,t.text,s(t.author))},resolveComment(e){n.resolveComment(e);},proposeChange(e){return n.proposeChange({paraId:e.paraId,search:e.search,replaceWith:e.replaceWith,author:s(e.author)})},applyFormatting(e){return n.applyFormatting({paraId:e.paraId,search:e.search,marks:e.marks})},setParagraphStyle(e){return n.setParagraphStyle({paraId:e.paraId,styleId:e.styleId})},insertBreak(e){return n.insertBreak({paraId:e.paraId,type:e.type})},getPage(e){return n.getPageContent(e)},getPages(e){let t=n.getTotalPages(),r=Math.max(1,Math.min(e.from,t)),i=Math.max(r,Math.min(e.to,t)),a=[];for(let g=r;g<=i;g++){let m=n.getPageContent(g);m&&a.push(m);}return a},getTotalPages(){return n.getTotalPages()},getCurrentPage(){return n.getCurrentPage()},scrollTo(e){return n.scrollToParaId(e)},onContentChange(e){return n.onContentChange(()=>{let t=u(n),r=t?chunkEX4NO3JP_js.m(t):[],i=t?chunkEX4NO3JP_js.l(t):[];try{e({commentCount:r.length,changeCount:i.length,comments:r,changes:i});}catch(a){console.error("onContentChange listener threw:",a);}})},onSelectionChange(e){return n.onSelectionChange(()=>{try{e(n.getSelectionInfo());}catch(t){console.error("onSelectionChange listener threw:",t);}})}}}exports.a=k;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{o as executeCommand,p as executeCommands}from'./chunk-6RMDMHUK.mjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkMMJQ47Q7_js=require('./chunk-MMJQ47Q7.js');Object.defineProperty(exports,"executeCommand",{enumerable:true,get:function(){return chunkMMJQ47Q7_js.o}});Object.defineProperty(exports,"executeCommands",{enumerable:true,get:function(){return chunkMMJQ47Q7_js.p}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkRTU2ZS7R_js=require('./chunk-RTU2ZS7R.js'),chunk4QRVKNI4_js=require('./chunk-4QRVKNI4.js'),chunkMMJQ47Q7_js=require('./chunk-MMJQ47Q7.js');Object.defineProperty(exports,"ContentControlBoundError",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.ga}});Object.defineProperty(exports,"ContentControlLockedError",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.ea}});Object.defineProperty(exports,"ContentControlNotFoundError",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.da}});Object.defineProperty(exports,"ContentControlTypeError",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.fa}});Object.defineProperty(exports,"ContentControlValueError",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.ja}});Object.defineProperty(exports,"DEFAULT_AI_ACTIONS",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Qa}});Object.defineProperty(exports,"DocumentAgent",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.x}});Object.defineProperty(exports,"RepeatingSectionError",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.oa}});Object.defineProperty(exports,"VERSION",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Sa}});Object.defineProperty(exports,"addRepeatingSectionItem",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.pa}});Object.defineProperty(exports,"attemptSelectiveSave",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.i}});Object.defineProperty(exports,"blendColors",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Ha}});Object.defineProperty(exports,"buildExtendedSelectionContext",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.E}});Object.defineProperty(exports,"buildPatchedDocumentXml",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.h}});Object.defineProperty(exports,"buildSelectionContext",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.D}});Object.defineProperty(exports,"buildSelectionContextFromContext",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.B}});Object.defineProperty(exports,"colorsEqual",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Ia}});Object.defineProperty(exports,"comparePositions",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Na}});Object.defineProperty(exports,"countCharacters",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.M}});Object.defineProperty(exports,"countWords",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.L}});Object.defineProperty(exports,"createAgent",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.y}});Object.defineProperty(exports,"createAgentFromDocument",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.z}});Object.defineProperty(exports,"createCollapsedRange",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Ka}});Object.defineProperty(exports,"createCommand",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Ra}});Object.defineProperty(exports,"createDocumentWithText",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.ua}});Object.defineProperty(exports,"createDocx",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.f}});Object.defineProperty(exports,"createEmptyDocument",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.ta}});Object.defineProperty(exports,"createRange",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.La}});Object.defineProperty(exports,"createRgbColor",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Ea}});Object.defineProperty(exports,"createThemeColor",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Da}});Object.defineProperty(exports,"darkenColor",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Fa}});Object.defineProperty(exports,"detectVariables",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.j}});Object.defineProperty(exports,"detectVariablesDetailed",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.k}});Object.defineProperty(exports,"detectVariablesInBody",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.l}});Object.defineProperty(exports,"detectVariablesInParagraph",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.m}});Object.defineProperty(exports,"documentHasVariables",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.v}});Object.defineProperty(exports,"extractVariablesFromText",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.n}});Object.defineProperty(exports,"findContentControl",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.ca}});Object.defineProperty(exports,"findContentControls",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.ba}});Object.defineProperty(exports,"formatSdtDate",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.ka}});Object.defineProperty(exports,"formatVariable",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.r}});Object.defineProperty(exports,"getActionDescription",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Pa}});Object.defineProperty(exports,"getActionLabel",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Oa}});Object.defineProperty(exports,"getAgentContext",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.A}});Object.defineProperty(exports,"getBlockIndexForParagraph",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.$}});Object.defineProperty(exports,"getBodyCharacterCount",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.O}});Object.defineProperty(exports,"getBodyText",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.K}});Object.defineProperty(exports,"getBodyWordCount",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.N}});Object.defineProperty(exports,"getContentControlText",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.aa}});Object.defineProperty(exports,"getContrastingColor",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Ba}});Object.defineProperty(exports,"getDocumentSummary",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.C}});Object.defineProperty(exports,"getDocumentWatermark",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.ra}});Object.defineProperty(exports,"getFormattingAtPosition",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.R}});Object.defineProperty(exports,"getHyperlinkAtPosition",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.T}});Object.defineProperty(exports,"getHyperlinkText",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.I}});Object.defineProperty(exports,"getParagraphAtIndex",{enumerable:true,get:function(){return chunkRTU2ZS7R_js._}});Object.defineProperty(exports,"getParagraphText",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.G}});Object.defineProperty(exports,"getParagraphs",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Z}});Object.defineProperty(exports,"getRunText",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.H}});Object.defineProperty(exports,"getSelectionFormattingSummary",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.F}});Object.defineProperty(exports,"getTableText",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.J}});Object.defineProperty(exports,"getTextAfter",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Q}});Object.defineProperty(exports,"getTextBefore",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.P}});Object.defineProperty(exports,"hasHyperlinks",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.X}});Object.defineProperty(exports,"hasImages",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.W}});Object.defineProperty(exports,"hasTables",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Y}});Object.defineProperty(exports,"hasTemplateVariables",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.o}});Object.defineProperty(exports,"isBlack",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.za}});Object.defineProperty(exports,"isHeadingStyle",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.U}});Object.defineProperty(exports,"isPositionInHyperlink",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.S}});Object.defineProperty(exports,"isPositionInRange",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Ma}});Object.defineProperty(exports,"isRepeatingSection",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.ma}});Object.defineProperty(exports,"isRepeatingSectionItem",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.na}});Object.defineProperty(exports,"isValidVariableName",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.p}});Object.defineProperty(exports,"isWhite",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Aa}});Object.defineProperty(exports,"isZodSchema",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Ja}});Object.defineProperty(exports,"lightenColor",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Ga}});Object.defineProperty(exports,"mapHexToHighlightName",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.va}});Object.defineProperty(exports,"parseColorString",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Ca}});Object.defineProperty(exports,"parseDocx",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.w}});Object.defineProperty(exports,"parseHeadingLevel",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.V}});Object.defineProperty(exports,"parseVariable",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.s}});Object.defineProperty(exports,"removeContentControl",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.ia}});Object.defineProperty(exports,"removeRepeatingSectionItem",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.qa}});Object.defineProperty(exports,"removeVariables",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.u}});Object.defineProperty(exports,"repackDocx",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.d}});Object.defineProperty(exports,"replaceVariables",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.t}});Object.defineProperty(exports,"resolveColor",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.wa}});Object.defineProperty(exports,"resolveHighlightColor",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.xa}});Object.defineProperty(exports,"resolveShadingColor",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.ya}});Object.defineProperty(exports,"sanitizeVariableName",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.q}});Object.defineProperty(exports,"serializeDocumentBody",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.b}});Object.defineProperty(exports,"serializeDocx",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.c}});Object.defineProperty(exports,"serializeSectionProperties",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.a}});Object.defineProperty(exports,"setContentControlContent",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.ha}});Object.defineProperty(exports,"setContentControlValue",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.la}});Object.defineProperty(exports,"setDocumentWatermark",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.sa}});Object.defineProperty(exports,"updateMultipleFiles",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.e}});Object.defineProperty(exports,"validatePatchSafety",{enumerable:true,get:function(){return chunkRTU2ZS7R_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 chunkMMJQ47Q7_js.a}});Object.defineProperty(exports,"createPluginRegistrar",{enumerable:true,get:function(){return chunkMMJQ47Q7_js.d}});Object.defineProperty(exports,"emuToPixels",{enumerable:true,get:function(){return chunkMMJQ47Q7_js.g}});Object.defineProperty(exports,"emuToTwips",{enumerable:true,get:function(){return chunkMMJQ47Q7_js.i}});Object.defineProperty(exports,"executeCommand",{enumerable:true,get:function(){return chunkMMJQ47Q7_js.o}});Object.defineProperty(exports,"executeCommands",{enumerable:true,get:function(){return chunkMMJQ47Q7_js.p}});Object.defineProperty(exports,"formatPx",{enumerable:true,get:function(){return chunkMMJQ47Q7_js.n}});Object.defineProperty(exports,"halfPointsToPixels",{enumerable:true,get:function(){return chunkMMJQ47Q7_js.l}});Object.defineProperty(exports,"pixelsToEmu",{enumerable:true,get:function(){return chunkMMJQ47Q7_js.h}});Object.defineProperty(exports,"pixelsToTwips",{enumerable:true,get:function(){return chunkMMJQ47Q7_js.f}});Object.defineProperty(exports,"pluginRegistry",{enumerable:true,get:function(){return chunkMMJQ47Q7_js.b}});Object.defineProperty(exports,"pointsToHalfPoints",{enumerable:true,get:function(){return chunkMMJQ47Q7_js.m}});Object.defineProperty(exports,"pointsToPixels",{enumerable:true,get:function(){return chunkMMJQ47Q7_js.k}});Object.defineProperty(exports,"registerPlugins",{enumerable:true,get:function(){return chunkMMJQ47Q7_js.c}});Object.defineProperty(exports,"twipsToEmu",{enumerable:true,get:function(){return chunkMMJQ47Q7_js.j}});Object.defineProperty(exports,"twipsToPixels",{enumerable:true,get:function(){return chunkMMJQ47Q7_js.e}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{ga as ContentControlBoundError,ea as ContentControlLockedError,da as ContentControlNotFoundError,fa as ContentControlTypeError,ja as ContentControlValueError,Qa as DEFAULT_AI_ACTIONS,x as DocumentAgent,oa as RepeatingSectionError,Sa as VERSION,pa as addRepeatingSectionItem,i as attemptSelectiveSave,Ha as blendColors,E as buildExtendedSelectionContext,h as buildPatchedDocumentXml,D as buildSelectionContext,B as buildSelectionContextFromContext,Ia as colorsEqual,Na as comparePositions,M as countCharacters,L as countWords,y as createAgent,z as createAgentFromDocument,Ka as createCollapsedRange,Ra as createCommand,ua as createDocumentWithText,f as createDocx,ta as createEmptyDocument,La as createRange,Ea as createRgbColor,Da as createThemeColor,Fa as darkenColor,j as detectVariables,k as detectVariablesDetailed,l as detectVariablesInBody,m as detectVariablesInParagraph,v as documentHasVariables,n as extractVariablesFromText,ca as findContentControl,ba as findContentControls,ka as formatSdtDate,r as formatVariable,Pa as getActionDescription,Oa as getActionLabel,A as getAgentContext,$ as getBlockIndexForParagraph,O as getBodyCharacterCount,K as getBodyText,N as getBodyWordCount,aa as getContentControlText,Ba as getContrastingColor,C as getDocumentSummary,ra as getDocumentWatermark,R as getFormattingAtPosition,T as getHyperlinkAtPosition,I as getHyperlinkText,_ as getParagraphAtIndex,G as getParagraphText,Z as getParagraphs,H as getRunText,F as getSelectionFormattingSummary,J as getTableText,Q as getTextAfter,P as getTextBefore,X as hasHyperlinks,W as hasImages,Y as hasTables,o as hasTemplateVariables,za as isBlack,U as isHeadingStyle,S as isPositionInHyperlink,Ma as isPositionInRange,ma as isRepeatingSection,na as isRepeatingSectionItem,p as isValidVariableName,Aa as isWhite,Ja as isZodSchema,Ga as lightenColor,va as mapHexToHighlightName,Ca as parseColorString,w as parseDocx,V as parseHeadingLevel,s as parseVariable,ia as removeContentControl,qa as removeRepeatingSectionItem,u as removeVariables,d as repackDocx,t as replaceVariables,wa as resolveColor,xa as resolveHighlightColor,ya as resolveShadingColor,q as sanitizeVariableName,b as serializeDocumentBody,c as serializeDocx,a as serializeSectionProperties,ha as setContentControlContent,la as setContentControlValue,sa as setDocumentWatermark,e as updateMultipleFiles,g as validatePatchSafety}from'./chunk-
|
|
1
|
+
export{ga as ContentControlBoundError,ea as ContentControlLockedError,da as ContentControlNotFoundError,fa as ContentControlTypeError,ja as ContentControlValueError,Qa as DEFAULT_AI_ACTIONS,x as DocumentAgent,oa as RepeatingSectionError,Sa as VERSION,pa as addRepeatingSectionItem,i as attemptSelectiveSave,Ha as blendColors,E as buildExtendedSelectionContext,h as buildPatchedDocumentXml,D as buildSelectionContext,B as buildSelectionContextFromContext,Ia as colorsEqual,Na as comparePositions,M as countCharacters,L as countWords,y as createAgent,z as createAgentFromDocument,Ka as createCollapsedRange,Ra as createCommand,ua as createDocumentWithText,f as createDocx,ta as createEmptyDocument,La as createRange,Ea as createRgbColor,Da as createThemeColor,Fa as darkenColor,j as detectVariables,k as detectVariablesDetailed,l as detectVariablesInBody,m as detectVariablesInParagraph,v as documentHasVariables,n as extractVariablesFromText,ca as findContentControl,ba as findContentControls,ka as formatSdtDate,r as formatVariable,Pa as getActionDescription,Oa as getActionLabel,A as getAgentContext,$ as getBlockIndexForParagraph,O as getBodyCharacterCount,K as getBodyText,N as getBodyWordCount,aa as getContentControlText,Ba as getContrastingColor,C as getDocumentSummary,ra as getDocumentWatermark,R as getFormattingAtPosition,T as getHyperlinkAtPosition,I as getHyperlinkText,_ as getParagraphAtIndex,G as getParagraphText,Z as getParagraphs,H as getRunText,F as getSelectionFormattingSummary,J as getTableText,Q as getTextAfter,P as getTextBefore,X as hasHyperlinks,W as hasImages,Y as hasTables,o as hasTemplateVariables,za as isBlack,U as isHeadingStyle,S as isPositionInHyperlink,Ma as isPositionInRange,ma as isRepeatingSection,na as isRepeatingSectionItem,p as isValidVariableName,Aa as isWhite,Ja as isZodSchema,Ga as lightenColor,va as mapHexToHighlightName,Ca as parseColorString,w as parseDocx,V as parseHeadingLevel,s as parseVariable,ia as removeContentControl,qa as removeRepeatingSectionItem,u as removeVariables,d as repackDocx,t as replaceVariables,wa as resolveColor,xa as resolveHighlightColor,ya as resolveShadingColor,q as sanitizeVariableName,b as serializeDocumentBody,c as serializeDocx,a as serializeSectionProperties,ha as setContentControlContent,la as setContentControlValue,sa as setDocumentWatermark,e as updateMultipleFiles,g as validatePatchSafety}from'./chunk-X5FXVERG.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,g as emuToPixels,i as emuToTwips,o as executeCommand,p as executeCommands,n as formatPx,l as halfPointsToPixels,h as pixelsToEmu,f as pixelsToTwips,b as pluginRegistry,m as pointsToHalfPoints,k as pointsToPixels,c as registerPlugins,j as twipsToEmu,e as twipsToPixels}from'./chunk-6RMDMHUK.mjs';
|
package/dist/index.d.mts
CHANGED
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
* @packageDocumentation
|
|
29
29
|
* @public
|
|
30
30
|
*/
|
|
31
|
-
import { G as GetContentOptions, C as ContentBlock, a as CommentFilter, R as ReviewComment, b as ChangeFilter, c as ReviewChange, F as FoundMatch, S as SelectionInfo, A as AddCommentByParaIdOptions, d as ReplyOptions, P as ProposeChangeOptions, e as ApplyFormattingOptions, f as SetParagraphStyleOptions, g as PageContent, h as ContentChangeEvent, i as SelectionChangeEvent } from './server-
|
|
32
|
-
export { j as AgentToolDefinition, k as AgentToolResult, B as BatchError, l as BatchResult, m as BatchReviewOptions, D as DocxReviewer, n as agentTools, o as createReviewerBridge, p as executeToolCall, q as getToolSchemas } from './server-
|
|
31
|
+
import { G as GetContentOptions, C as ContentBlock, a as CommentFilter, R as ReviewComment, b as ChangeFilter, c as ReviewChange, F as FoundMatch, S as SelectionInfo, A as AddCommentByParaIdOptions, d as ReplyOptions, P as ProposeChangeOptions, e as ApplyFormattingOptions, f as SetParagraphStyleOptions, g as PageContent, h as ContentChangeEvent, i as SelectionChangeEvent } from './server-DP8QoY84.mjs';
|
|
32
|
+
export { j as AgentToolDefinition, k as AgentToolResult, B as BatchError, l as BatchResult, m as BatchReviewOptions, D as DocxReviewer, n as agentTools, o as createReviewerBridge, p as executeToolCall, q as getToolSchemas } from './server-DP8QoY84.mjs';
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* Error classes for @eigenpal/docx-editor-agents
|
|
@@ -75,6 +75,7 @@ declare class CommentNotFoundError extends Error {
|
|
|
75
75
|
* | `Document.onSelectionChanged.add()` | `onSelectionChange(listener)` |
|
|
76
76
|
* | `Range.font.bold` / `italic` / `color` / `size` / `name` | `applyFormatting({paraId, search?, marks})` |
|
|
77
77
|
* | `ParagraphFormat.style` / `applyStyle(...)` | `setParagraphStyle({paraId, styleId})` |
|
|
78
|
+
* | `Range.insertBreak(BreakType.*)` | `insertBreak({paraId, type})` |
|
|
78
79
|
*
|
|
79
80
|
* ## Beyond Word's surface (paged-document affordances)
|
|
80
81
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
* @packageDocumentation
|
|
29
29
|
* @public
|
|
30
30
|
*/
|
|
31
|
-
import { G as GetContentOptions, C as ContentBlock, a as CommentFilter, R as ReviewComment, b as ChangeFilter, c as ReviewChange, F as FoundMatch, S as SelectionInfo, A as AddCommentByParaIdOptions, d as ReplyOptions, P as ProposeChangeOptions, e as ApplyFormattingOptions, f as SetParagraphStyleOptions, g as PageContent, h as ContentChangeEvent, i as SelectionChangeEvent } from './server-
|
|
32
|
-
export { j as AgentToolDefinition, k as AgentToolResult, B as BatchError, l as BatchResult, m as BatchReviewOptions, D as DocxReviewer, n as agentTools, o as createReviewerBridge, p as executeToolCall, q as getToolSchemas } from './server-
|
|
31
|
+
import { G as GetContentOptions, C as ContentBlock, a as CommentFilter, R as ReviewComment, b as ChangeFilter, c as ReviewChange, F as FoundMatch, S as SelectionInfo, A as AddCommentByParaIdOptions, d as ReplyOptions, P as ProposeChangeOptions, e as ApplyFormattingOptions, f as SetParagraphStyleOptions, g as PageContent, h as ContentChangeEvent, i as SelectionChangeEvent } from './server-DP8QoY84.js';
|
|
32
|
+
export { j as AgentToolDefinition, k as AgentToolResult, B as BatchError, l as BatchResult, m as BatchReviewOptions, D as DocxReviewer, n as agentTools, o as createReviewerBridge, p as executeToolCall, q as getToolSchemas } from './server-DP8QoY84.js';
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* Error classes for @eigenpal/docx-editor-agents
|
|
@@ -75,6 +75,7 @@ declare class CommentNotFoundError extends Error {
|
|
|
75
75
|
* | `Document.onSelectionChanged.add()` | `onSelectionChange(listener)` |
|
|
76
76
|
* | `Range.font.bold` / `italic` / `color` / `size` / `name` | `applyFormatting({paraId, search?, marks})` |
|
|
77
77
|
* | `ParagraphFormat.style` / `applyStyle(...)` | `setParagraphStyle({paraId, styleId})` |
|
|
78
|
+
* | `Range.insertBreak(BreakType.*)` | `insertBreak({paraId, type})` |
|
|
78
79
|
*
|
|
79
80
|
* ## Beyond Word's surface (paged-document affordances)
|
|
80
81
|
*
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkJMEIIPEL_js=require('./chunk-JMEIIPEL.js'),chunkEX4NO3JP_js=require('./chunk-EX4NO3JP.js'),chunkAO5SO6ZS_js=require('./chunk-AO5SO6ZS.js');Object.defineProperty(exports,"DocxReviewer",{enumerable:true,get:function(){return chunkJMEIIPEL_js.a}});Object.defineProperty(exports,"ChangeNotFoundError",{enumerable:true,get:function(){return chunkEX4NO3JP_js.h}});Object.defineProperty(exports,"CommentNotFoundError",{enumerable:true,get:function(){return chunkEX4NO3JP_js.i}});Object.defineProperty(exports,"TextNotFoundError",{enumerable:true,get:function(){return chunkEX4NO3JP_js.g}});Object.defineProperty(exports,"createReviewerBridge",{enumerable:true,get:function(){return chunkEX4NO3JP_js.n}});Object.defineProperty(exports,"agentTools",{enumerable:true,get:function(){return chunkAO5SO6ZS_js.a}});Object.defineProperty(exports,"executeToolCall",{enumerable:true,get:function(){return chunkAO5SO6ZS_js.b}});Object.defineProperty(exports,"getToolSchemas",{enumerable:true,get:function(){return chunkAO5SO6ZS_js.d}});
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as DocxReviewer}from'./chunk-
|
|
1
|
+
export{a as DocxReviewer}from'./chunk-YAKNDLQA.mjs';export{h as ChangeNotFoundError,i as CommentNotFoundError,g as TextNotFoundError,n as createReviewerBridge}from'./chunk-5THPDZLF.mjs';export{a as agentTools,b as executeToolCall,d as getToolSchemas}from'./chunk-MSKW7E36.mjs';
|
package/dist/mcp.d.mts
CHANGED
package/dist/mcp.d.ts
CHANGED
package/dist/mcp.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkAO5SO6ZS_js=require('./chunk-AO5SO6ZS.js');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:
|
|
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
|
|
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:chunkAO5SO6ZS_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=chunkAO5SO6ZS_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 C(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
|
+
`);});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 TextDecoder("utf-8"),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.decode(s,{stream:true}),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=C;
|
package/dist/mcp.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a,b
|
|
1
|
+
import {a,b}from'./chunk-MSKW7E36.mjs';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: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
|
|
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
|
|
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(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 C(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
|
+
`);});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 TextDecoder("utf-8"),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.decode(s,{stream:true}),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,C as runStdioServer};
|
package/dist/react.d.mts
CHANGED
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
* @packageDocumentation
|
|
19
19
|
* @public
|
|
20
20
|
*/
|
|
21
|
-
import { r as EditorRefLike, k as AgentToolResult, q as getToolSchemas, j as AgentToolDefinition, s as AgentContextSnapshot } from './server-
|
|
22
|
-
export { t as getToolDisplayName } from './server-
|
|
23
|
-
import * as
|
|
21
|
+
import { r as EditorRefLike, k as AgentToolResult, q as getToolSchemas, j as AgentToolDefinition, s as AgentContextSnapshot } from './server-DP8QoY84.mjs';
|
|
22
|
+
export { t as getToolDisplayName } from './server-DP8QoY84.mjs';
|
|
23
|
+
import * as react from 'react';
|
|
24
24
|
import { ReactNode, CSSProperties } from 'react';
|
|
25
25
|
import { A as AgentMessage, a as AgentToolCall } from './agent-types-C8RvQB7n.mjs';
|
|
26
26
|
|
|
@@ -162,7 +162,7 @@ interface AgentPanelProps {
|
|
|
162
162
|
*/
|
|
163
163
|
closed?: boolean;
|
|
164
164
|
}
|
|
165
|
-
declare function AgentPanel({ title, icon, closeLabel, resizeHandleLabel, width: controlledWidth, defaultWidth, minWidth, maxWidth, onWidthChange, onClose, children, className, closed, }: AgentPanelProps):
|
|
165
|
+
declare function AgentPanel({ title, icon, closeLabel, resizeHandleLabel, width: controlledWidth, defaultWidth, minWidth, maxWidth, onWidthChange, onClose, children, className, closed, }: AgentPanelProps): react.JSX.Element;
|
|
166
166
|
|
|
167
167
|
interface AgentChatLogProps {
|
|
168
168
|
messages: AgentMessage[];
|
|
@@ -225,8 +225,8 @@ interface AgentTimelineProps {
|
|
|
225
225
|
* assistant text bubble. Auto-collapses when the turn finishes; click the
|
|
226
226
|
* summary row to re-expand.
|
|
227
227
|
*/
|
|
228
|
-
declare function AgentTimeline({ toolCalls, streaming, maxVisibleCalls, humanizeName, workingLabel, summaryLabel, earlierLabel, }: AgentTimelineProps):
|
|
229
|
-
declare function AgentChatLog({ messages, loading, error, emptyState, autoScroll, humanizeToolName, maxVisibleCalls, className, style, thinkingLabel, workingLabel, summaryLabel, earlierLabel, }: AgentChatLogProps):
|
|
228
|
+
declare function AgentTimeline({ toolCalls, streaming, maxVisibleCalls, humanizeName, workingLabel, summaryLabel, earlierLabel, }: AgentTimelineProps): react.JSX.Element | null;
|
|
229
|
+
declare function AgentChatLog({ messages, loading, error, emptyState, autoScroll, humanizeToolName, maxVisibleCalls, className, style, thinkingLabel, workingLabel, summaryLabel, earlierLabel, }: AgentChatLogProps): react.JSX.Element;
|
|
230
230
|
interface AgentComposerProps {
|
|
231
231
|
value: string;
|
|
232
232
|
onChange: (next: string) => void;
|
|
@@ -239,12 +239,12 @@ interface AgentComposerProps {
|
|
|
239
239
|
footnote?: ReactNode;
|
|
240
240
|
className?: string;
|
|
241
241
|
}
|
|
242
|
-
declare function AgentComposer({ value, onChange, onSubmit, disabled, placeholder, sendLabel, footnote, className, }: AgentComposerProps):
|
|
242
|
+
declare function AgentComposer({ value, onChange, onSubmit, disabled, placeholder, sendLabel, footnote, className, }: AgentComposerProps): react.JSX.Element;
|
|
243
243
|
interface AgentSuggestionChipProps {
|
|
244
244
|
label: string;
|
|
245
245
|
onClick: () => void;
|
|
246
246
|
disabled?: boolean;
|
|
247
247
|
}
|
|
248
|
-
declare function AgentSuggestionChip({ label, onClick, disabled }: AgentSuggestionChipProps):
|
|
248
|
+
declare function AgentSuggestionChip({ label, onClick, disabled }: AgentSuggestionChipProps): react.JSX.Element;
|
|
249
249
|
|
|
250
250
|
export { AgentChatLog, type AgentChatLogProps, AgentComposer, type AgentComposerProps, AgentContextSnapshot, AgentMessage, AgentPanel, type AgentPanelProps, AgentSuggestionChip, type AgentSuggestionChipProps, AgentTimeline, type AgentTimelineProps, AgentToolCall, AgentToolDefinition, AgentToolResult, EditorRefLike, type UseAgentChatOptions, type UseAgentChatReturn, type UseDocxAgentToolsOptions, type UseDocxAgentToolsReturn, useAgentChat, useDocxAgentTools };
|
package/dist/react.d.ts
CHANGED
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
* @packageDocumentation
|
|
19
19
|
* @public
|
|
20
20
|
*/
|
|
21
|
-
import { r as EditorRefLike, k as AgentToolResult, q as getToolSchemas, j as AgentToolDefinition, s as AgentContextSnapshot } from './server-
|
|
22
|
-
export { t as getToolDisplayName } from './server-
|
|
23
|
-
import * as
|
|
21
|
+
import { r as EditorRefLike, k as AgentToolResult, q as getToolSchemas, j as AgentToolDefinition, s as AgentContextSnapshot } from './server-DP8QoY84.js';
|
|
22
|
+
export { t as getToolDisplayName } from './server-DP8QoY84.js';
|
|
23
|
+
import * as react from 'react';
|
|
24
24
|
import { ReactNode, CSSProperties } from 'react';
|
|
25
25
|
import { A as AgentMessage, a as AgentToolCall } from './agent-types-C8RvQB7n.js';
|
|
26
26
|
|
|
@@ -162,7 +162,7 @@ interface AgentPanelProps {
|
|
|
162
162
|
*/
|
|
163
163
|
closed?: boolean;
|
|
164
164
|
}
|
|
165
|
-
declare function AgentPanel({ title, icon, closeLabel, resizeHandleLabel, width: controlledWidth, defaultWidth, minWidth, maxWidth, onWidthChange, onClose, children, className, closed, }: AgentPanelProps):
|
|
165
|
+
declare function AgentPanel({ title, icon, closeLabel, resizeHandleLabel, width: controlledWidth, defaultWidth, minWidth, maxWidth, onWidthChange, onClose, children, className, closed, }: AgentPanelProps): react.JSX.Element;
|
|
166
166
|
|
|
167
167
|
interface AgentChatLogProps {
|
|
168
168
|
messages: AgentMessage[];
|
|
@@ -225,8 +225,8 @@ interface AgentTimelineProps {
|
|
|
225
225
|
* assistant text bubble. Auto-collapses when the turn finishes; click the
|
|
226
226
|
* summary row to re-expand.
|
|
227
227
|
*/
|
|
228
|
-
declare function AgentTimeline({ toolCalls, streaming, maxVisibleCalls, humanizeName, workingLabel, summaryLabel, earlierLabel, }: AgentTimelineProps):
|
|
229
|
-
declare function AgentChatLog({ messages, loading, error, emptyState, autoScroll, humanizeToolName, maxVisibleCalls, className, style, thinkingLabel, workingLabel, summaryLabel, earlierLabel, }: AgentChatLogProps):
|
|
228
|
+
declare function AgentTimeline({ toolCalls, streaming, maxVisibleCalls, humanizeName, workingLabel, summaryLabel, earlierLabel, }: AgentTimelineProps): react.JSX.Element | null;
|
|
229
|
+
declare function AgentChatLog({ messages, loading, error, emptyState, autoScroll, humanizeToolName, maxVisibleCalls, className, style, thinkingLabel, workingLabel, summaryLabel, earlierLabel, }: AgentChatLogProps): react.JSX.Element;
|
|
230
230
|
interface AgentComposerProps {
|
|
231
231
|
value: string;
|
|
232
232
|
onChange: (next: string) => void;
|
|
@@ -239,12 +239,12 @@ interface AgentComposerProps {
|
|
|
239
239
|
footnote?: ReactNode;
|
|
240
240
|
className?: string;
|
|
241
241
|
}
|
|
242
|
-
declare function AgentComposer({ value, onChange, onSubmit, disabled, placeholder, sendLabel, footnote, className, }: AgentComposerProps):
|
|
242
|
+
declare function AgentComposer({ value, onChange, onSubmit, disabled, placeholder, sendLabel, footnote, className, }: AgentComposerProps): react.JSX.Element;
|
|
243
243
|
interface AgentSuggestionChipProps {
|
|
244
244
|
label: string;
|
|
245
245
|
onClick: () => void;
|
|
246
246
|
disabled?: boolean;
|
|
247
247
|
}
|
|
248
|
-
declare function AgentSuggestionChip({ label, onClick, disabled }: AgentSuggestionChipProps):
|
|
248
|
+
declare function AgentSuggestionChip({ label, onClick, disabled }: AgentSuggestionChipProps): react.JSX.Element;
|
|
249
249
|
|
|
250
250
|
export { AgentChatLog, type AgentChatLogProps, AgentComposer, type AgentComposerProps, AgentContextSnapshot, AgentMessage, AgentPanel, type AgentPanelProps, AgentSuggestionChip, type AgentSuggestionChipProps, AgentTimeline, type AgentTimelineProps, AgentToolCall, AgentToolDefinition, AgentToolResult, EditorRefLike, type UseAgentChatOptions, type UseAgentChatReturn, type UseDocxAgentToolsOptions, type UseDocxAgentToolsReturn, useAgentChat, useDocxAgentTools };
|
package/dist/react.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkYIZV6SSD_js=require('./chunk-YIZV6SSD.js'),chunkAO5SO6ZS_js=require('./chunk-AO5SO6ZS.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var te=chunkAO5SO6ZS_js.d();function ne(e){let{editorRef:t,author:l="AI"}=e,c=react.useMemo(()=>({get:()=>t.current?chunkYIZV6SSD_js.a(t.current,l):null}),[t,l]);return {executeToolCall:react.useCallback((d,p)=>{let r=c.get();return r?chunkAO5SO6ZS_js.b(d,p,r):{success:false,error:"Editor not ready"}},[c]),toolSchemas:te}}function re(e){let{editorRef:t,author:l="AI",tools:c,include:u,exclude:d}=e,p=!!c&&Object.keys(c).length>0,r=react.useCallback(i=>!(u&&!u.includes(i)||d&&d.includes(i)),[u,d]),f=react.useMemo(()=>{let i=u||d?chunkAO5SO6ZS_js.a.filter(n=>r(n.name)):chunkAO5SO6ZS_js.a;if(!p)return i.map(n=>({type:"function",function:{name:n.name,description:n.description,parameters:n.inputSchema}}));let o=new Map(i.map(n=>[n.name,n]));for(let[n,C]of Object.entries(c))o.set(n,C);return Array.from(o.values()).map(n=>({type:"function",function:{name:n.name,description:n.description,parameters:n.inputSchema}}))},[c,p,u,d,r]),g=react.useCallback((i,o)=>{let n=t.current;if(!n)return {success:false,error:"Editor not ready."};let C=chunkYIZV6SSD_js.a(n,l),k=c?.[i];if(k)try{return k.handler(o,C)}catch(T){return {success:false,error:T instanceof Error?T.message:String(T)}}return r(i)?chunkAO5SO6ZS_js.b(i,o,C):{success:false,error:`Tool '${i}' is not enabled.`}},[t,l,c,r]),x=react.useCallback(()=>{let i=t.current;if(!i)return {selection:null,currentPage:0,totalPages:0};let o=chunkYIZV6SSD_js.a(i,l);return {selection:o.getSelection(),currentPage:o.getCurrentPage(),totalPages:o.getTotalPages()}},[t,l]);return {tools:f,executeToolCall:g,getContext:x}}var y={agentPanel:{defaultTitle:"Assistant",close:"Close panel",resizeHandle:"Resize agent panel",thinking:"Assistant is thinking",composerPlaceholder:"Ask the assistant\u2026",send:"Send",timeline:{working:"Working\u2026 {count, plural, one {# step} other {# steps}}",summary:"{count, plural, one {# step} other {# steps}}",earlier:"+ {count, plural, one {# earlier step} other {# earlier steps}}"}}};var _="eigenpal:docx-editor:agentPanelWidth";function ae({size:e=22}){return jsxRuntime.jsx("svg",{viewBox:"0 -960 960 960",width:e,height:e,fill:"currentColor","aria-hidden":"true",children:jsxRuntime.jsx("path",{d:"m760-600-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110Zm0 560-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110ZM360-160 260-380 40-480l220-100 100-220 100 220 220 100-220 100-100 220Zm0-194 40-86 86-40-86-40-40-86-40 86-86 40 86 40 40 86Zm0-126Z"})})}function le({size:e=18}){return jsxRuntime.jsx("svg",{viewBox:"0 -960 960 960",width:e,height:e,fill:"currentColor","aria-hidden":"true",children:jsxRuntime.jsx("path",{d:"m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"})})}var ce=360,ue=280,de=600;function pe({title:e=y.agentPanel.defaultTitle,icon:t,closeLabel:l=y.agentPanel.close,resizeHandleLabel:c=y.agentPanel.resizeHandle,width:u,defaultWidth:d=ce,minWidth:p=ue,maxWidth:r=de,onWidthChange:f,onClose:g,children:x,className:i,closed:o=false}){let n=u!==void 0,[C,k]=react.useState(false),T=react.useRef(o);react.useEffect(()=>{if(T.current!==o){T.current=o,k(true);let m=window.setTimeout(()=>k(false),260);return ()=>window.clearTimeout(m)}},[o]);let[L,h]=react.useState(()=>{if(n)return u;if(typeof window>"u")return d;try{let m=window.localStorage.getItem(_);if(m){let S=Number(m);if(Number.isFinite(S)&&S>=p&&S<=r)return S}}catch{}return d}),E=n?u:L,v=react.useRef(null),B=react.useRef({minWidth:p,maxWidth:r,isControlled:n,onWidthChange:f});B.current={minWidth:p,maxWidth:r,isControlled:n,onWidthChange:f};let w=react.useRef(null);if(!w.current){let m=P=>{let D=v.current;if(!D)return;let I=B.current,q=D.startX-P.clientX,N=Math.min(I.maxWidth,Math.max(I.minWidth,D.startWidth+q));D.lastWidth=N,I.isControlled||h(N),I.onWidthChange?.(N);},S=()=>{let P=v.current;if(P&&(v.current=null,document.removeEventListener("pointermove",m),document.removeEventListener("pointerup",S),!B.current.isControlled))try{window.localStorage.setItem(_,String(P.lastWidth));}catch{}};w.current={move:m,up:S};}let Y=react.useCallback(m=>{m.preventDefault();let S=n?u:L;v.current={startX:m.clientX,startWidth:S,lastWidth:S},document.addEventListener("pointermove",w.current.move),document.addEventListener("pointerup",w.current.up);},[]);return react.useEffect(()=>()=>{let m=w.current;m&&(document.removeEventListener("pointermove",m.move),document.removeEventListener("pointerup",m.up));},[]),jsxRuntime.jsxs("div",{className:`ep-agent-panel${i?` ${i}`:""}`,style:{width:o?0:E,flex:o?"0 0 0px":`0 0 ${E}px`,height:"calc(100% - 16px)",margin:o?"8px 0 8px 0":"8px 8px 8px 12px",display:"flex",flexDirection:"column",background:"#ffffff",border:o?"1px solid transparent":"1px solid #e3e3e3",borderRadius:16,boxShadow:o?"none":"0 1px 2px rgba(60,64,67,0.05), 0 4px 12px rgba(60,64,67,0.08)",opacity:o?0:1,pointerEvents:o?"none":"auto",position:"relative",boxSizing:"border-box",minWidth:o?0:p,overflow:"hidden",fontFamily:"'Google Sans', 'Google Sans Text', system-ui, -apple-system, sans-serif",transition:C?"flex-basis 220ms cubic-bezier(0.4, 0, 0.2, 1), width 220ms cubic-bezier(0.4, 0, 0.2, 1), margin 220ms cubic-bezier(0.4, 0, 0.2, 1), opacity 180ms ease, box-shadow 220ms ease, border-color 220ms ease":"opacity 180ms ease, box-shadow 220ms ease, border-color 220ms ease"},"aria-hidden":o,"data-testid":"agent-panel","data-state":o?"closed":"open",role:"complementary","aria-label":e,children:[jsxRuntime.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":c,onPointerDown:Y,style:{position:"absolute",left:-3,top:0,bottom:0,width:6,cursor:"col-resize",touchAction:"none",zIndex:1},"data-testid":"agent-panel-resize-handle"}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 16px 10px",flex:"0 0 auto",background:"#ffffff"},children:[jsxRuntime.jsx("span",{style:{display:"inline-flex",alignItems:"center",color:"#0b57d0"},children:t??jsxRuntime.jsx(ae,{size:22})}),jsxRuntime.jsx("span",{style:{flex:1,fontSize:15,fontWeight:500,color:"#1f1f1f",letterSpacing:.1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e}),g&&jsxRuntime.jsx("button",{type:"button",onClick:g,"aria-label":l,title:l,"data-testid":"agent-panel-close",style:{border:"none",background:"transparent",padding:6,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"#444746",borderRadius:999,transition:"background 0.15s"},onMouseEnter:m=>{m.currentTarget.style.background="#f1f3f4";},onMouseLeave:m=>{m.currentTarget.style.background="transparent";},children:jsxRuntime.jsx(le,{size:18})})]}),jsxRuntime.jsx("div",{style:{flex:1,minHeight:0,overflow:"hidden",display:"flex",flexDirection:"column"},children:x})]})}function ge(e){let t={},l=/(=\d+|\w+)\s*\{([^}]*)\}/g,c;for(;(c=l.exec(e))!==null;)t[c[1]]=c[2];return t}function F(e,t,l="en"){return t?e.replace(/\{(\w+),\s*plural,\s*((?:[^{}]|\{[^{}]*\})*)\}/g,(u,d,p)=>{let r=Number(t[d]);if(isNaN(r))return u;let f=ge(p),g=f[`=${r}`];if(g!==void 0)return g.replace(/#/g,String(r));let x;try{x=new Intl.PluralRules(l).select(r);}catch{x=r===1?"one":"other";}return (f[x]??f.other??"").replace(/#/g,String(r))}).replace(/\{(\w+)\}/g,(u,d)=>{let p=t[d];return p!==void 0?String(p):`{${d}}`}):e}function V(e){let t=e.replace(/_/g," ");return t.charAt(0).toUpperCase()+t.slice(1)}var xe=y.agentPanel.thinking,he=y.agentPanel.composerPlaceholder,be=y.agentPanel.send,ye=e=>F(y.agentPanel.timeline.working,{count:e}),Ae=e=>F(y.agentPanel.timeline.summary,{count:e}),Se=e=>F(y.agentPanel.timeline.earlier,{count:e}),j="ep-agent-chat-keyframes",Ce=`
|
|
2
2
|
@keyframes epAgentDot {
|
|
3
3
|
0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
|
|
4
4
|
40% { transform: scale(1); opacity: 1; }
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
@keyframes epAgentSpin {
|
|
7
7
|
to { transform: rotate(360deg); }
|
|
8
8
|
}
|
|
9
|
-
`;function Te(){react.useEffect(()=>{if(typeof document>"u"||document.getElementById(j))return;let e=document.createElement("style");e.id=j,e.textContent=Ce,document.head.appendChild(e);},[]);}var ke=3;function K({toolCalls:e,streaming:t,maxVisibleCalls:l=ke,humanizeName:c=V,workingLabel:u=ye,summaryLabel:d=Ae,earlierLabel:p=Se}){let[r,f]=react.useState(null),g=r??!!t;if(e.length===0)return null;let x=t?u(e.length):d(e.length),i=e.slice(-l),o=Math.max(0,e.length-i.length);return jsxRuntime.jsxs("div",{style:s.timelineWrap,"data-testid":"agent-timeline",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>f(!g),"aria-expanded":g,style:s.timelineHeader,"data-testid":"agent-timeline-toggle",children:[jsxRuntime.jsxs("span",{style:s.timelineSummary,children:[t?jsxRuntime.jsx(X,{}):jsxRuntime.jsx(ve,{}),x]}),jsxRuntime.jsx("span",{style:{...s.timelineChevron,transform:g?"rotate(180deg)":"rotate(0deg)"},"aria-hidden":"true",children:"\u25BE"})]}),g&&jsxRuntime.jsxs("ol",{style:s.timelineList,children:[o>0&&jsxRuntime.jsx("li",{style:s.timelineMore,"data-testid":"agent-timeline-earlier",children:p(o)}),i.map(n=>jsxRuntime.jsxs("li",{style:s.timelineItem,children:[n.status==="running"?jsxRuntime.jsx(X,{size:10,compact:true}):jsxRuntime.jsx("span",{style:{...s.timelineDot,background:n.status==="error"?"#d93025":"#1e8e3e"},"aria-hidden":"true"}),jsxRuntime.jsxs("span",{style:s.timelineCall,children:[jsxRuntime.jsx("span",{style:s.timelineCallName,children:c(n.name)}),n.error&&jsxRuntime.jsx("span",{style:s.timelineError,children:n.error})]})]},n.id))]})]})}function X({size:e=12,compact:t=false}={}){return jsxRuntime.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",style:{marginRight:t?0:6,animation:"epAgentSpin 0.8s linear infinite",flexShrink:0},"aria-hidden":"true",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"9",stroke:"#dadce0",strokeWidth:"3",fill:"none"}),jsxRuntime.jsx("path",{d:"M21 12a9 9 0 0 0-9-9",stroke:"#0b57d0",strokeWidth:"3",strokeLinecap:"round"})]})}function ve(){return jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",style:{marginRight:6},children:jsxRuntime.jsx("path",{d:"M5 13l4 4L19 7",stroke:"#1e8e3e",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function we({messages:e,loading:t,error:l,emptyState:c,autoScroll:u=true,humanizeToolName:d,maxVisibleCalls:p,className:r,style:f,thinkingLabel:g=xe,workingLabel:x,summaryLabel:i,earlierLabel:o}){Te();let n=react.useRef(null),C=e[e.length-1],k=C?.toolCalls?.length??0,T=C?.status==="streaming";react.useEffect(()=>{u&&n.current?.scrollIntoView({behavior:T||t?"auto":"smooth",block:"end"});},[e.length,k,t,T,u]);let L=e.length===0&&!t&&!l;return jsxRuntime.jsxs("div",{className:`ep-agent-chat-log${r?` ${r}`:""}`,style:{flex:1,overflow:"auto",padding:"16px 14px 8px",display:"flex",flexDirection:"column",gap:10,...f},children:[L&&c,e.map(h=>{let E=h.role==="assistant"&&h.toolCalls&&h.toolCalls.length>0,v=h.text.length>0;return jsxRuntime.jsxs("div",{style:s.messageGroup,"data-role":h.role,children:[E&&jsxRuntime.jsx(K,{toolCalls:h.toolCalls,streaming:h.status==="streaming",humanizeName:d,maxVisibleCalls:p,workingLabel:x,summaryLabel:i,earlierLabel:o}),v&&jsxRuntime.jsx("div",{style:h.role==="user"?s.userBubble:s.assistantBubble,children:h.text})]},h.id)}),t&&jsxRuntime.jsxs("div",{style:s.thinkingBubble,"aria-label":g,children:[jsxRuntime.jsx("span",{style:{...s.dot,animationDelay:"0s"}}),jsxRuntime.jsx("span",{style:{...s.dot,animationDelay:"0.15s"}}),jsxRuntime.jsx("span",{style:{...s.dot,animationDelay:"0.3s"}})]}),l&&jsxRuntime.jsx("div",{style:s.errorBubble,role:"alert",children:l}),jsxRuntime.jsx("div",{ref:n})]})}function Re({value:e,onChange:t,onSubmit:l,disabled:c,placeholder:u=he,sendLabel:d=be,footnote:p,className:r}){let f=u,g=e.trim().length>0&&!c;return jsxRuntime.jsxs("form",{onSubmit:i=>{i.preventDefault(),g&&l();},className:`ep-agent-composer${r?` ${r}`:""}`,style:s.composerWrap,children:[jsxRuntime.jsxs("div",{style:s.composerShell,children:[jsxRuntime.jsx("input",{style:s.composerInput,value:e,onChange:i=>t(i.target.value),placeholder:f,disabled:c}),jsxRuntime.jsx("button",{type:"submit","aria-label":d,disabled:!g,style:{...s.sendBtn,opacity:g?1:.35,cursor:g?"pointer":"not-allowed"},children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:jsxRuntime.jsx("path",{d:"M12 19V5M5 12l7-7 7 7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),p&&jsxRuntime.jsx("div",{style:s.footnote,children:p})]})}function Le({label:e,onClick:t,disabled:l}){return jsxRuntime.jsx("button",{type:"button",style:s.chip,onClick:t,disabled:l,children:e})}var s={messageGroup:{display:"flex",flexDirection:"column",gap:6,width:"100%"},userBubble:{background:"#0b57d0",color:"#fff",padding:"10px 14px",borderRadius:"20px 20px 4px 20px",fontSize:13.5,lineHeight:1.5,alignSelf:"flex-end",maxWidth:"88%",whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"'Google Sans', 'Google Sans Text', system-ui, -apple-system, sans-serif"},assistantBubble:{background:"#f0f4f9",color:"#1f1f1f",padding:"12px 16px",borderRadius:"20px 20px 20px 4px",fontSize:13.5,lineHeight:1.55,alignSelf:"flex-start",maxWidth:"92%",whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"'Google Sans', 'Google Sans Text', system-ui, -apple-system, sans-serif"},thinkingBubble:{background:"#f0f4f9",padding:"12px 16px",borderRadius:"20px 20px 20px 4px",alignSelf:"flex-start",display:"flex",gap:4,alignItems:"center"},dot:{width:6,height:6,borderRadius:"50%",background:"#5f6368",display:"inline-block",animation:"epAgentDot 1.4s infinite ease-in-out"},errorBubble:{background:"#fce8e6",color:"#b3261e",padding:"10px 14px",borderRadius:16,fontSize:12.5,alignSelf:"flex-start",maxWidth:"92%",whiteSpace:"pre-wrap",fontFamily:"'Google Sans Text', system-ui, sans-serif"},composerWrap:{padding:"8px 12px 14px",background:"#fff",flex:"0 0 auto"},composerShell:{display:"flex",alignItems:"center",gap:4,padding:"6px 6px 6px 18px",background:"#fff",border:"1px solid #c4c7c5",borderRadius:28,boxShadow:"0 1px 2px rgba(60,64,67,0.04)",transition:"border-color 0.15s, box-shadow 0.15s",fontFamily:"'Google Sans Text', system-ui, sans-serif"},composerInput:{flex:1,padding:"8px 0",fontSize:14,border:"none",outline:"none",background:"transparent",fontFamily:"inherit",color:"#1f1f1f"},sendBtn:{width:36,height:36,borderRadius:"50%",border:"none",background:"#0b57d0",color:"#fff",flexShrink:0,display:"inline-flex",alignItems:"center",justifyContent:"center",transition:"background 0.15s, opacity 0.15s, transform 0.15s"},footnote:{fontSize:11,color:"#5f6368",textAlign:"center",marginTop:10,fontFamily:"'Google Sans Text', system-ui, sans-serif"},chip:{textAlign:"left",background:"#fff",border:"1px solid #dadce0",borderRadius:18,padding:"10px 14px",fontSize:13,color:"#1f1f1f",cursor:"pointer",fontFamily:"'Google Sans Text', system-ui, sans-serif",lineHeight:1.4,transition:"background 0.15s, border-color 0.15s, box-shadow 0.15s",width:"100%"},timelineWrap:{alignSelf:"flex-start",maxWidth:"92%",background:"#fff",border:"1px solid #e1e3e6",borderRadius:12,overflow:"hidden",fontFamily:"'Google Sans Text', system-ui, sans-serif"},timelineHeader:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",padding:"8px 12px",background:"transparent",border:"none",cursor:"pointer",fontSize:12.5,color:"#1f1f1f",fontFamily:"inherit"},timelineSummary:{display:"inline-flex",alignItems:"center",fontWeight:500},timelineChevron:{fontSize:12,color:"#5f6368",transition:"transform 0.15s ease",marginLeft:8},timelineList:{listStyle:"none",margin:0,padding:"4px 12px 10px 12px",display:"flex",flexDirection:"column",gap:6,borderTop:"1px solid #ececf0"},timelineItem:{display:"flex",alignItems:"center",gap:8,fontSize:12,color:"#444746"},timelineDot:{width:6,height:6,borderRadius:"50%",flexShrink:0},timelineCall:{display:"inline-flex",flexDirection:"column",minWidth:0},timelineCallName:{color:"#1f1f1f"},timelineError:{color:"#d93025",fontSize:11},timelineMore:{fontSize:11,color:"#5f6368",fontStyle:"italic",paddingLeft:14}};Object.defineProperty(exports,"getToolDisplayName",{enumerable:true,get:function(){return
|
|
9
|
+
`;function Te(){react.useEffect(()=>{if(typeof document>"u"||document.getElementById(j))return;let e=document.createElement("style");e.id=j,e.textContent=Ce,document.head.appendChild(e);},[]);}var ke=3;function K({toolCalls:e,streaming:t,maxVisibleCalls:l=ke,humanizeName:c=V,workingLabel:u=ye,summaryLabel:d=Ae,earlierLabel:p=Se}){let[r,f]=react.useState(null),g=r??!!t;if(e.length===0)return null;let x=t?u(e.length):d(e.length),i=e.slice(-l),o=Math.max(0,e.length-i.length);return jsxRuntime.jsxs("div",{style:s.timelineWrap,"data-testid":"agent-timeline",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>f(!g),"aria-expanded":g,style:s.timelineHeader,"data-testid":"agent-timeline-toggle",children:[jsxRuntime.jsxs("span",{style:s.timelineSummary,children:[t?jsxRuntime.jsx(X,{}):jsxRuntime.jsx(ve,{}),x]}),jsxRuntime.jsx("span",{style:{...s.timelineChevron,transform:g?"rotate(180deg)":"rotate(0deg)"},"aria-hidden":"true",children:"\u25BE"})]}),g&&jsxRuntime.jsxs("ol",{style:s.timelineList,children:[o>0&&jsxRuntime.jsx("li",{style:s.timelineMore,"data-testid":"agent-timeline-earlier",children:p(o)}),i.map(n=>jsxRuntime.jsxs("li",{style:s.timelineItem,children:[n.status==="running"?jsxRuntime.jsx(X,{size:10,compact:true}):jsxRuntime.jsx("span",{style:{...s.timelineDot,background:n.status==="error"?"#d93025":"#1e8e3e"},"aria-hidden":"true"}),jsxRuntime.jsxs("span",{style:s.timelineCall,children:[jsxRuntime.jsx("span",{style:s.timelineCallName,children:c(n.name)}),n.error&&jsxRuntime.jsx("span",{style:s.timelineError,children:n.error})]})]},n.id))]})]})}function X({size:e=12,compact:t=false}={}){return jsxRuntime.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",style:{marginRight:t?0:6,animation:"epAgentSpin 0.8s linear infinite",flexShrink:0},"aria-hidden":"true",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"9",stroke:"#dadce0",strokeWidth:"3",fill:"none"}),jsxRuntime.jsx("path",{d:"M21 12a9 9 0 0 0-9-9",stroke:"#0b57d0",strokeWidth:"3",strokeLinecap:"round"})]})}function ve(){return jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",style:{marginRight:6},children:jsxRuntime.jsx("path",{d:"M5 13l4 4L19 7",stroke:"#1e8e3e",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function we({messages:e,loading:t,error:l,emptyState:c,autoScroll:u=true,humanizeToolName:d,maxVisibleCalls:p,className:r,style:f,thinkingLabel:g=xe,workingLabel:x,summaryLabel:i,earlierLabel:o}){Te();let n=react.useRef(null),C=e[e.length-1],k=C?.toolCalls?.length??0,T=C?.status==="streaming";react.useEffect(()=>{u&&n.current?.scrollIntoView({behavior:T||t?"auto":"smooth",block:"end"});},[e.length,k,t,T,u]);let L=e.length===0&&!t&&!l;return jsxRuntime.jsxs("div",{className:`ep-agent-chat-log${r?` ${r}`:""}`,style:{flex:1,overflow:"auto",padding:"16px 14px 8px",display:"flex",flexDirection:"column",gap:10,...f},children:[L&&c,e.map(h=>{let E=h.role==="assistant"&&h.toolCalls&&h.toolCalls.length>0,v=h.text.length>0;return jsxRuntime.jsxs("div",{style:s.messageGroup,"data-role":h.role,children:[E&&jsxRuntime.jsx(K,{toolCalls:h.toolCalls,streaming:h.status==="streaming",humanizeName:d,maxVisibleCalls:p,workingLabel:x,summaryLabel:i,earlierLabel:o}),v&&jsxRuntime.jsx("div",{style:h.role==="user"?s.userBubble:s.assistantBubble,children:h.text})]},h.id)}),t&&jsxRuntime.jsxs("div",{style:s.thinkingBubble,"aria-label":g,children:[jsxRuntime.jsx("span",{style:{...s.dot,animationDelay:"0s"}}),jsxRuntime.jsx("span",{style:{...s.dot,animationDelay:"0.15s"}}),jsxRuntime.jsx("span",{style:{...s.dot,animationDelay:"0.3s"}})]}),l&&jsxRuntime.jsx("div",{style:s.errorBubble,role:"alert",children:l}),jsxRuntime.jsx("div",{ref:n})]})}function Re({value:e,onChange:t,onSubmit:l,disabled:c,placeholder:u=he,sendLabel:d=be,footnote:p,className:r}){let f=u,g=e.trim().length>0&&!c;return jsxRuntime.jsxs("form",{onSubmit:i=>{i.preventDefault(),g&&l();},className:`ep-agent-composer${r?` ${r}`:""}`,style:s.composerWrap,children:[jsxRuntime.jsxs("div",{style:s.composerShell,children:[jsxRuntime.jsx("input",{style:s.composerInput,value:e,onChange:i=>t(i.target.value),placeholder:f,disabled:c}),jsxRuntime.jsx("button",{type:"submit","aria-label":d,disabled:!g,style:{...s.sendBtn,opacity:g?1:.35,cursor:g?"pointer":"not-allowed"},children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:jsxRuntime.jsx("path",{d:"M12 19V5M5 12l7-7 7 7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),p&&jsxRuntime.jsx("div",{style:s.footnote,children:p})]})}function Le({label:e,onClick:t,disabled:l}){return jsxRuntime.jsx("button",{type:"button",style:s.chip,onClick:t,disabled:l,children:e})}var s={messageGroup:{display:"flex",flexDirection:"column",gap:6,width:"100%"},userBubble:{background:"#0b57d0",color:"#fff",padding:"10px 14px",borderRadius:"20px 20px 4px 20px",fontSize:13.5,lineHeight:1.5,alignSelf:"flex-end",maxWidth:"88%",whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"'Google Sans', 'Google Sans Text', system-ui, -apple-system, sans-serif"},assistantBubble:{background:"#f0f4f9",color:"#1f1f1f",padding:"12px 16px",borderRadius:"20px 20px 20px 4px",fontSize:13.5,lineHeight:1.55,alignSelf:"flex-start",maxWidth:"92%",whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"'Google Sans', 'Google Sans Text', system-ui, -apple-system, sans-serif"},thinkingBubble:{background:"#f0f4f9",padding:"12px 16px",borderRadius:"20px 20px 20px 4px",alignSelf:"flex-start",display:"flex",gap:4,alignItems:"center"},dot:{width:6,height:6,borderRadius:"50%",background:"#5f6368",display:"inline-block",animation:"epAgentDot 1.4s infinite ease-in-out"},errorBubble:{background:"#fce8e6",color:"#b3261e",padding:"10px 14px",borderRadius:16,fontSize:12.5,alignSelf:"flex-start",maxWidth:"92%",whiteSpace:"pre-wrap",fontFamily:"'Google Sans Text', system-ui, sans-serif"},composerWrap:{padding:"8px 12px 14px",background:"#fff",flex:"0 0 auto"},composerShell:{display:"flex",alignItems:"center",gap:4,padding:"6px 6px 6px 18px",background:"#fff",border:"1px solid #c4c7c5",borderRadius:28,boxShadow:"0 1px 2px rgba(60,64,67,0.04)",transition:"border-color 0.15s, box-shadow 0.15s",fontFamily:"'Google Sans Text', system-ui, sans-serif"},composerInput:{flex:1,padding:"8px 0",fontSize:14,border:"none",outline:"none",background:"transparent",fontFamily:"inherit",color:"#1f1f1f"},sendBtn:{width:36,height:36,borderRadius:"50%",border:"none",background:"#0b57d0",color:"#fff",flexShrink:0,display:"inline-flex",alignItems:"center",justifyContent:"center",transition:"background 0.15s, opacity 0.15s, transform 0.15s"},footnote:{fontSize:11,color:"#5f6368",textAlign:"center",marginTop:10,fontFamily:"'Google Sans Text', system-ui, sans-serif"},chip:{textAlign:"left",background:"#fff",border:"1px solid #dadce0",borderRadius:18,padding:"10px 14px",fontSize:13,color:"#1f1f1f",cursor:"pointer",fontFamily:"'Google Sans Text', system-ui, sans-serif",lineHeight:1.4,transition:"background 0.15s, border-color 0.15s, box-shadow 0.15s",width:"100%"},timelineWrap:{alignSelf:"flex-start",maxWidth:"92%",background:"#fff",border:"1px solid #e1e3e6",borderRadius:12,overflow:"hidden",fontFamily:"'Google Sans Text', system-ui, sans-serif"},timelineHeader:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",padding:"8px 12px",background:"transparent",border:"none",cursor:"pointer",fontSize:12.5,color:"#1f1f1f",fontFamily:"inherit"},timelineSummary:{display:"inline-flex",alignItems:"center",fontWeight:500},timelineChevron:{fontSize:12,color:"#5f6368",transition:"transform 0.15s ease",marginLeft:8},timelineList:{listStyle:"none",margin:0,padding:"4px 12px 10px 12px",display:"flex",flexDirection:"column",gap:6,borderTop:"1px solid #ececf0"},timelineItem:{display:"flex",alignItems:"center",gap:8,fontSize:12,color:"#444746"},timelineDot:{width:6,height:6,borderRadius:"50%",flexShrink:0},timelineCall:{display:"inline-flex",flexDirection:"column",minWidth:0},timelineCallName:{color:"#1f1f1f"},timelineError:{color:"#d93025",fontSize:11},timelineMore:{fontSize:11,color:"#5f6368",fontStyle:"italic",paddingLeft:14}};Object.defineProperty(exports,"getToolDisplayName",{enumerable:true,get:function(){return chunkAO5SO6ZS_js.c}});exports.AgentChatLog=we;exports.AgentComposer=Re;exports.AgentPanel=pe;exports.AgentSuggestionChip=Le;exports.AgentTimeline=K;exports.useAgentChat=ne;exports.useDocxAgentTools=re;
|
package/dist/react.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a}from'./chunk-
|
|
1
|
+
import {a}from'./chunk-3RLSV2EA.mjs';import {d,b,a as a$1}from'./chunk-MSKW7E36.mjs';export{c as getToolDisplayName}from'./chunk-MSKW7E36.mjs';import {useMemo,useCallback,useState,useRef,useEffect}from'react';import {jsxs,jsx}from'react/jsx-runtime';var te=d();function ne(e){let{editorRef:t,author:l="AI"}=e,c=useMemo(()=>({get:()=>t.current?a(t.current,l):null}),[t,l]);return {executeToolCall:useCallback((d,p)=>{let r=c.get();return r?b(d,p,r):{success:false,error:"Editor not ready"}},[c]),toolSchemas:te}}function re(e){let{editorRef:t,author:l="AI",tools:c,include:u,exclude:d}=e,p=!!c&&Object.keys(c).length>0,r=useCallback(i=>!(u&&!u.includes(i)||d&&d.includes(i)),[u,d]),f=useMemo(()=>{let i=u||d?a$1.filter(n=>r(n.name)):a$1;if(!p)return i.map(n=>({type:"function",function:{name:n.name,description:n.description,parameters:n.inputSchema}}));let o=new Map(i.map(n=>[n.name,n]));for(let[n,C]of Object.entries(c))o.set(n,C);return Array.from(o.values()).map(n=>({type:"function",function:{name:n.name,description:n.description,parameters:n.inputSchema}}))},[c,p,u,d,r]),g=useCallback((i,o)=>{let n=t.current;if(!n)return {success:false,error:"Editor not ready."};let C=a(n,l),k=c?.[i];if(k)try{return k.handler(o,C)}catch(T){return {success:false,error:T instanceof Error?T.message:String(T)}}return r(i)?b(i,o,C):{success:false,error:`Tool '${i}' is not enabled.`}},[t,l,c,r]),x=useCallback(()=>{let i=t.current;if(!i)return {selection:null,currentPage:0,totalPages:0};let o=a(i,l);return {selection:o.getSelection(),currentPage:o.getCurrentPage(),totalPages:o.getTotalPages()}},[t,l]);return {tools:f,executeToolCall:g,getContext:x}}var y={agentPanel:{defaultTitle:"Assistant",close:"Close panel",resizeHandle:"Resize agent panel",thinking:"Assistant is thinking",composerPlaceholder:"Ask the assistant\u2026",send:"Send",timeline:{working:"Working\u2026 {count, plural, one {# step} other {# steps}}",summary:"{count, plural, one {# step} other {# steps}}",earlier:"+ {count, plural, one {# earlier step} other {# earlier steps}}"}}};var _="eigenpal:docx-editor:agentPanelWidth";function ae({size:e=22}){return jsx("svg",{viewBox:"0 -960 960 960",width:e,height:e,fill:"currentColor","aria-hidden":"true",children:jsx("path",{d:"m760-600-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110Zm0 560-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110ZM360-160 260-380 40-480l220-100 100-220 100 220 220 100-220 100-100 220Zm0-194 40-86 86-40-86-40-40-86-40 86-86 40 86 40 40 86Zm0-126Z"})})}function le({size:e=18}){return jsx("svg",{viewBox:"0 -960 960 960",width:e,height:e,fill:"currentColor","aria-hidden":"true",children:jsx("path",{d:"m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"})})}var ce=360,ue=280,de=600;function pe({title:e=y.agentPanel.defaultTitle,icon:t,closeLabel:l=y.agentPanel.close,resizeHandleLabel:c=y.agentPanel.resizeHandle,width:u,defaultWidth:d=ce,minWidth:p=ue,maxWidth:r=de,onWidthChange:f,onClose:g,children:x,className:i,closed:o=false}){let n=u!==void 0,[C,k]=useState(false),T=useRef(o);useEffect(()=>{if(T.current!==o){T.current=o,k(true);let m=window.setTimeout(()=>k(false),260);return ()=>window.clearTimeout(m)}},[o]);let[L,h]=useState(()=>{if(n)return u;if(typeof window>"u")return d;try{let m=window.localStorage.getItem(_);if(m){let S=Number(m);if(Number.isFinite(S)&&S>=p&&S<=r)return S}}catch{}return d}),E=n?u:L,v=useRef(null),B=useRef({minWidth:p,maxWidth:r,isControlled:n,onWidthChange:f});B.current={minWidth:p,maxWidth:r,isControlled:n,onWidthChange:f};let w=useRef(null);if(!w.current){let m=P=>{let D=v.current;if(!D)return;let I=B.current,q=D.startX-P.clientX,N=Math.min(I.maxWidth,Math.max(I.minWidth,D.startWidth+q));D.lastWidth=N,I.isControlled||h(N),I.onWidthChange?.(N);},S=()=>{let P=v.current;if(P&&(v.current=null,document.removeEventListener("pointermove",m),document.removeEventListener("pointerup",S),!B.current.isControlled))try{window.localStorage.setItem(_,String(P.lastWidth));}catch{}};w.current={move:m,up:S};}let Y=useCallback(m=>{m.preventDefault();let S=n?u:L;v.current={startX:m.clientX,startWidth:S,lastWidth:S},document.addEventListener("pointermove",w.current.move),document.addEventListener("pointerup",w.current.up);},[]);return useEffect(()=>()=>{let m=w.current;m&&(document.removeEventListener("pointermove",m.move),document.removeEventListener("pointerup",m.up));},[]),jsxs("div",{className:`ep-agent-panel${i?` ${i}`:""}`,style:{width:o?0:E,flex:o?"0 0 0px":`0 0 ${E}px`,height:"calc(100% - 16px)",margin:o?"8px 0 8px 0":"8px 8px 8px 12px",display:"flex",flexDirection:"column",background:"#ffffff",border:o?"1px solid transparent":"1px solid #e3e3e3",borderRadius:16,boxShadow:o?"none":"0 1px 2px rgba(60,64,67,0.05), 0 4px 12px rgba(60,64,67,0.08)",opacity:o?0:1,pointerEvents:o?"none":"auto",position:"relative",boxSizing:"border-box",minWidth:o?0:p,overflow:"hidden",fontFamily:"'Google Sans', 'Google Sans Text', system-ui, -apple-system, sans-serif",transition:C?"flex-basis 220ms cubic-bezier(0.4, 0, 0.2, 1), width 220ms cubic-bezier(0.4, 0, 0.2, 1), margin 220ms cubic-bezier(0.4, 0, 0.2, 1), opacity 180ms ease, box-shadow 220ms ease, border-color 220ms ease":"opacity 180ms ease, box-shadow 220ms ease, border-color 220ms ease"},"aria-hidden":o,"data-testid":"agent-panel","data-state":o?"closed":"open",role:"complementary","aria-label":e,children:[jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":c,onPointerDown:Y,style:{position:"absolute",left:-3,top:0,bottom:0,width:6,cursor:"col-resize",touchAction:"none",zIndex:1},"data-testid":"agent-panel-resize-handle"}),jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 16px 10px",flex:"0 0 auto",background:"#ffffff"},children:[jsx("span",{style:{display:"inline-flex",alignItems:"center",color:"#0b57d0"},children:t??jsx(ae,{size:22})}),jsx("span",{style:{flex:1,fontSize:15,fontWeight:500,color:"#1f1f1f",letterSpacing:.1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e}),g&&jsx("button",{type:"button",onClick:g,"aria-label":l,title:l,"data-testid":"agent-panel-close",style:{border:"none",background:"transparent",padding:6,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"#444746",borderRadius:999,transition:"background 0.15s"},onMouseEnter:m=>{m.currentTarget.style.background="#f1f3f4";},onMouseLeave:m=>{m.currentTarget.style.background="transparent";},children:jsx(le,{size:18})})]}),jsx("div",{style:{flex:1,minHeight:0,overflow:"hidden",display:"flex",flexDirection:"column"},children:x})]})}function ge(e){let t={},l=/(=\d+|\w+)\s*\{([^}]*)\}/g,c;for(;(c=l.exec(e))!==null;)t[c[1]]=c[2];return t}function F(e,t,l="en"){return t?e.replace(/\{(\w+),\s*plural,\s*((?:[^{}]|\{[^{}]*\})*)\}/g,(u,d,p)=>{let r=Number(t[d]);if(isNaN(r))return u;let f=ge(p),g=f[`=${r}`];if(g!==void 0)return g.replace(/#/g,String(r));let x;try{x=new Intl.PluralRules(l).select(r);}catch{x=r===1?"one":"other";}return (f[x]??f.other??"").replace(/#/g,String(r))}).replace(/\{(\w+)\}/g,(u,d)=>{let p=t[d];return p!==void 0?String(p):`{${d}}`}):e}function V(e){let t=e.replace(/_/g," ");return t.charAt(0).toUpperCase()+t.slice(1)}var xe=y.agentPanel.thinking,he=y.agentPanel.composerPlaceholder,be=y.agentPanel.send,ye=e=>F(y.agentPanel.timeline.working,{count:e}),Ae=e=>F(y.agentPanel.timeline.summary,{count:e}),Se=e=>F(y.agentPanel.timeline.earlier,{count:e}),j="ep-agent-chat-keyframes",Ce=`
|
|
2
2
|
@keyframes epAgentDot {
|
|
3
3
|
0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
|
|
4
4
|
40% { transform: scale(1); opacity: 1; }
|
|
@@ -2512,6 +2512,17 @@ interface SetParagraphStyleOptions {
|
|
|
2512
2512
|
paraId: string;
|
|
2513
2513
|
styleId: string;
|
|
2514
2514
|
}
|
|
2515
|
+
/** Kind of break `insertBreak` inserts after a paragraph. */
|
|
2516
|
+
type BreakType = 'page' | 'sectionNextPage' | 'sectionContinuous';
|
|
2517
|
+
/**
|
|
2518
|
+
* Insert a page or section break after the paragraph identified by `paraId`.
|
|
2519
|
+
* `page` adds a page break; `sectionNextPage` starts a new section on a new
|
|
2520
|
+
* page; `sectionContinuous` starts a new section on the same page.
|
|
2521
|
+
*/
|
|
2522
|
+
interface InsertBreakOptions {
|
|
2523
|
+
paraId: string;
|
|
2524
|
+
type: BreakType;
|
|
2525
|
+
}
|
|
2515
2526
|
/** A single paragraph anchored on a page (returned by `getPage` / `getPages`). */
|
|
2516
2527
|
interface PageParagraph {
|
|
2517
2528
|
paraId: string;
|
|
@@ -2790,6 +2801,11 @@ interface EditorRefLike {
|
|
|
2790
2801
|
paraId: string;
|
|
2791
2802
|
styleId: string;
|
|
2792
2803
|
}): boolean;
|
|
2804
|
+
/** Insert a page or section break after the paragraph. Returns false if paraId is unknown. */
|
|
2805
|
+
insertBreak(options: {
|
|
2806
|
+
paraId: string;
|
|
2807
|
+
type: 'page' | 'sectionNextPage' | 'sectionContinuous';
|
|
2808
|
+
}): boolean;
|
|
2793
2809
|
/** Read a single page's paragraphs (1-indexed). Returns null if the page does not exist. */
|
|
2794
2810
|
getPageContent(pageNumber: number): PageContent | null;
|
|
2795
2811
|
/** Total number of pages currently rendered. */
|
|
@@ -2841,6 +2857,12 @@ interface EditorBridge {
|
|
|
2841
2857
|
* Direct edit, not a tracked change.
|
|
2842
2858
|
*/
|
|
2843
2859
|
setParagraphStyle(options: SetParagraphStyleOptions): boolean;
|
|
2860
|
+
/**
|
|
2861
|
+
* Insert a page or section break after a paragraph, by paraId. `page` adds a
|
|
2862
|
+
* page break; `sectionNextPage` / `sectionContinuous` start a new section on
|
|
2863
|
+
* a new page / the same page. Direct edit, not a tracked change.
|
|
2864
|
+
*/
|
|
2865
|
+
insertBreak(options: InsertBreakOptions): boolean;
|
|
2844
2866
|
/** Read a single page (1-indexed). Returns null if the page does not exist. */
|
|
2845
2867
|
getPage(pageNumber: number): PageContent | null;
|
|
2846
2868
|
/** Read a range of pages (1-indexed, inclusive). Out-of-range pages are skipped. */
|
|
@@ -2512,6 +2512,17 @@ interface SetParagraphStyleOptions {
|
|
|
2512
2512
|
paraId: string;
|
|
2513
2513
|
styleId: string;
|
|
2514
2514
|
}
|
|
2515
|
+
/** Kind of break `insertBreak` inserts after a paragraph. */
|
|
2516
|
+
type BreakType = 'page' | 'sectionNextPage' | 'sectionContinuous';
|
|
2517
|
+
/**
|
|
2518
|
+
* Insert a page or section break after the paragraph identified by `paraId`.
|
|
2519
|
+
* `page` adds a page break; `sectionNextPage` starts a new section on a new
|
|
2520
|
+
* page; `sectionContinuous` starts a new section on the same page.
|
|
2521
|
+
*/
|
|
2522
|
+
interface InsertBreakOptions {
|
|
2523
|
+
paraId: string;
|
|
2524
|
+
type: BreakType;
|
|
2525
|
+
}
|
|
2515
2526
|
/** A single paragraph anchored on a page (returned by `getPage` / `getPages`). */
|
|
2516
2527
|
interface PageParagraph {
|
|
2517
2528
|
paraId: string;
|
|
@@ -2790,6 +2801,11 @@ interface EditorRefLike {
|
|
|
2790
2801
|
paraId: string;
|
|
2791
2802
|
styleId: string;
|
|
2792
2803
|
}): boolean;
|
|
2804
|
+
/** Insert a page or section break after the paragraph. Returns false if paraId is unknown. */
|
|
2805
|
+
insertBreak(options: {
|
|
2806
|
+
paraId: string;
|
|
2807
|
+
type: 'page' | 'sectionNextPage' | 'sectionContinuous';
|
|
2808
|
+
}): boolean;
|
|
2793
2809
|
/** Read a single page's paragraphs (1-indexed). Returns null if the page does not exist. */
|
|
2794
2810
|
getPageContent(pageNumber: number): PageContent | null;
|
|
2795
2811
|
/** Total number of pages currently rendered. */
|
|
@@ -2841,6 +2857,12 @@ interface EditorBridge {
|
|
|
2841
2857
|
* Direct edit, not a tracked change.
|
|
2842
2858
|
*/
|
|
2843
2859
|
setParagraphStyle(options: SetParagraphStyleOptions): boolean;
|
|
2860
|
+
/**
|
|
2861
|
+
* Insert a page or section break after a paragraph, by paraId. `page` adds a
|
|
2862
|
+
* page break; `sectionNextPage` / `sectionContinuous` start a new section on
|
|
2863
|
+
* a new page / the same page. Direct edit, not a tracked change.
|
|
2864
|
+
*/
|
|
2865
|
+
insertBreak(options: InsertBreakOptions): boolean;
|
|
2844
2866
|
/** Read a single page (1-indexed). Returns null if the page does not exist. */
|
|
2845
2867
|
getPage(pageNumber: number): PageContent | null;
|
|
2846
2868
|
/** Read a range of pages (1-indexed, inclusive). Out-of-range pages are skipped. */
|
package/dist/server.d.mts
CHANGED
|
@@ -31,4 +31,4 @@
|
|
|
31
31
|
* @packageDocumentation
|
|
32
32
|
* @public
|
|
33
33
|
*/
|
|
34
|
-
export { s as AgentContextSnapshot, j as AgentToolDefinition, k as AgentToolResult, D as DocxReviewer, E as EditorBridge, S as SelectionInfo, o as createReviewerBridge, n as docxAgentTools, p as executeToolCall, t as getToolDisplayName, q as getToolSchemas } from './server-
|
|
34
|
+
export { s as AgentContextSnapshot, j as AgentToolDefinition, k as AgentToolResult, D as DocxReviewer, E as EditorBridge, S as SelectionInfo, o as createReviewerBridge, n as docxAgentTools, p as executeToolCall, t as getToolDisplayName, q as getToolSchemas } from './server-DP8QoY84.mjs';
|
package/dist/server.d.ts
CHANGED
|
@@ -31,4 +31,4 @@
|
|
|
31
31
|
* @packageDocumentation
|
|
32
32
|
* @public
|
|
33
33
|
*/
|
|
34
|
-
export { s as AgentContextSnapshot, j as AgentToolDefinition, k as AgentToolResult, D as DocxReviewer, E as EditorBridge, S as SelectionInfo, o as createReviewerBridge, n as docxAgentTools, p as executeToolCall, t as getToolDisplayName, q as getToolSchemas } from './server-
|
|
34
|
+
export { s as AgentContextSnapshot, j as AgentToolDefinition, k as AgentToolResult, D as DocxReviewer, E as EditorBridge, S as SelectionInfo, o as createReviewerBridge, n as docxAgentTools, p as executeToolCall, t as getToolDisplayName, q as getToolSchemas } from './server-DP8QoY84.js';
|
package/dist/server.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkJMEIIPEL_js=require('./chunk-JMEIIPEL.js'),chunkEX4NO3JP_js=require('./chunk-EX4NO3JP.js'),chunkAO5SO6ZS_js=require('./chunk-AO5SO6ZS.js');Object.defineProperty(exports,"DocxReviewer",{enumerable:true,get:function(){return chunkJMEIIPEL_js.a}});Object.defineProperty(exports,"createReviewerBridge",{enumerable:true,get:function(){return chunkEX4NO3JP_js.n}});Object.defineProperty(exports,"docxAgentTools",{enumerable:true,get:function(){return chunkAO5SO6ZS_js.a}});Object.defineProperty(exports,"executeToolCall",{enumerable:true,get:function(){return chunkAO5SO6ZS_js.b}});Object.defineProperty(exports,"getToolDisplayName",{enumerable:true,get:function(){return chunkAO5SO6ZS_js.c}});Object.defineProperty(exports,"getToolSchemas",{enumerable:true,get:function(){return chunkAO5SO6ZS_js.d}});
|
package/dist/server.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as DocxReviewer}from'./chunk-
|
|
1
|
+
export{a as DocxReviewer}from'./chunk-YAKNDLQA.mjs';export{n as createReviewerBridge}from'./chunk-5THPDZLF.mjs';export{a as docxAgentTools,b as executeToolCall,c as getToolDisplayName,d as getToolSchemas}from'./chunk-MSKW7E36.mjs';
|