@eigenpal/docx-editor-agents 1.0.3 → 1.2.0
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/LICENSE +13 -16
- 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-NGMVN6QV.mjs → chunk-6KT5LOQB.mjs} +1 -1
- package/dist/chunk-B3LQVYMR.js +74 -0
- package/dist/{chunk-DDW6L3LZ.js → chunk-DIXFGAF5.js} +2 -2
- package/dist/chunk-EPRXZTIE.js +1 -0
- package/dist/{chunk-JQBSMHZA.mjs → chunk-HTU7NUTJ.mjs} +1 -1
- package/dist/chunk-L7LXQOTH.mjs +74 -0
- package/dist/chunk-MHUG23P6.js +5 -0
- package/dist/chunk-MK47WH2X.mjs +5 -0
- package/dist/{chunk-SCYZRJWI.js → chunk-NSFRE2VK.js} +1 -1
- package/dist/chunk-XDZHYYU6.mjs +1 -0
- package/dist/executor-SBR6X4JZ.mjs +1 -0
- package/dist/executor-ZTSOZMKE.js +1 -0
- package/dist/headless-6C4JSKYY.mjs +1 -0
- package/dist/headless-VGNLVFAJ.js +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -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/react.d.mts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +1 -1
- package/dist/react.mjs +1 -1
- package/dist/{server-CGxgyhy-.d.mts → server-uM9UUIhk.d.mts} +190 -108
- package/dist/{server-CGxgyhy-.d.ts → server-uM9UUIhk.d.ts} +190 -108
- 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 +2 -2
- package/dist/vue.mjs +18 -20
- package/package.json +2 -2
- package/dist/chunk-7C5RGTQY.js +0 -71
- package/dist/chunk-MOAJJKKG.js +0 -5
- package/dist/chunk-NISW2GF6.js +0 -1
- package/dist/chunk-OHVUJUDE.mjs +0 -71
- package/dist/chunk-PSSPSJR4.mjs +0 -5
- package/dist/chunk-X4YGLGUM.mjs +0 -1
- package/dist/executor-QBMOTUCJ.js +0 -1
- package/dist/executor-RSQI3VOF.mjs +0 -1
- package/dist/headless-3IX5WQEZ.js +0 -1
- package/dist/headless-V7JUUMG6.mjs +0 -1
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-uM9UUIhk.js';
|
package/dist/server.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkNSFRE2VK_js=require('./chunk-NSFRE2VK.js'),chunkMHUG23P6_js=require('./chunk-MHUG23P6.js'),chunkRI5S75JY_js=require('./chunk-RI5S75JY.js');Object.defineProperty(exports,"DocxReviewer",{enumerable:true,get:function(){return chunkNSFRE2VK_js.a}});Object.defineProperty(exports,"createReviewerBridge",{enumerable:true,get:function(){return chunkMHUG23P6_js.m}});Object.defineProperty(exports,"docxAgentTools",{enumerable:true,get:function(){return chunkRI5S75JY_js.a}});Object.defineProperty(exports,"executeToolCall",{enumerable:true,get:function(){return chunkRI5S75JY_js.b}});Object.defineProperty(exports,"getToolDisplayName",{enumerable:true,get:function(){return chunkRI5S75JY_js.c}});Object.defineProperty(exports,"getToolSchemas",{enumerable:true,get:function(){return chunkRI5S75JY_js.d}});
|
package/dist/server.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as DocxReviewer}from'./chunk-
|
|
1
|
+
export{a as DocxReviewer}from'./chunk-6KT5LOQB.mjs';export{m as createReviewerBridge}from'./chunk-MK47WH2X.mjs';export{a as docxAgentTools,b as executeToolCall,c as getToolDisplayName,d as getToolSchemas}from'./chunk-24MVJKCP.mjs';
|
package/dist/vue.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`vue`),t=require(`@eigenpal/docx-editor-core/headless`);var n={_lang:`en`,agentPanel:{defaultTitle:`Assistant`,close:`Close panel`,resizeHandle:`Resize agent panel`,thinking:`Assistant is thinking`,composerPlaceholder:`Ask the assistant…`,send:`Send`,timeline:{working:`Working… {count, plural, one {# step} other {# steps}}`,summary:`{count, plural, one {# step} other {# steps}}`,earlier:`+ {count, plural, one {# earlier step} other {# earlier steps}}`}},aiActions:{header:`AI Actions`,askAi:`Ask AI`,rewrite:`Rewrite`,expand:`Expand`,summarize:`Summarize`,translate:`Translate`,explain:`Explain`,fixGrammar:`Fix grammar`,makeFormal:`Make formal`,makeCasual:`Make casual`,custom:`Custom`,customPlaceholder:`Custom prompt…`},aiPreview:{defaultTitle:`AI Response`,labels:{rewrite:`Rewrite`,expand:`Expand`,summarize:`Summary`,translate:`Translation`,explain:`Explanation`,fixGrammar:`Grammar Fix`,makeFormal:`Formal Version`,makeCasual:`Casual Version`,custom:`AI Response`,askAi:`AI Response`},loading:`Processing…`,original:`Original:`,suggested:`Suggested:`,edit:`Edit`,discard:`Discard`,accept:`Accept`,retry:`Retry`,close:`Close`}},r=[`aria-hidden`,`aria-label`,`data-state`],i=[`aria-label`,`aria-valuenow`,`aria-valuemin`,`aria-valuemax`,`aria-valuetext`],a=[`aria-label`,`title`],o=`eigenpal:docx-editor:agentPanelWidth`,s=(0,e.defineComponent)({__name:`AgentPanel`,props:{title:{default:()=>n.agentPanel.defaultTitle},closeLabel:{default:()=>n.agentPanel.close},resizeHandleLabel:{default:()=>n.agentPanel.resizeHandle},width:{default:void 0},defaultWidth:{default:360},minWidth:{default:280},maxWidth:{default:600},closed:{type:Boolean,default:!1},closable:{type:Boolean,default:!0},className:{default:``}},emits:[`close`,`update:width`],setup(t,{emit:n}){let s=t,c=n,l=(0,e.computed)(()=>s.width!==void 0);function u(){if(typeof window>`u`)return s.defaultWidth;try{let e=window.localStorage.getItem(o);if(e){let t=Number(e);if(Number.isFinite(t)&&t>=s.minWidth&&t<=s.maxWidth)return t}}catch{}return s.defaultWidth}let d=(0,e.ref)(l.value?s.width:u()),f=(0,e.computed)(()=>l.value?s.width:d.value),p=(0,e.ref)(!1),m=null;(0,e.watch)(()=>s.closed,()=>{m!==null&&window.clearTimeout(m),p.value=!0,m=window.setTimeout(()=>{p.value=!1,m=null},260)},{flush:`post`});let h=null;function g(e){if(!h)return;let t=h.startX-e.clientX,n=Math.min(s.maxWidth,Math.max(s.minWidth,h.startWidth+t));h.lastWidth=n,l.value||(d.value=n),c(`update:width`,n)}function _(){if(!h)return;let e=h.lastWidth;if(h=null,document.removeEventListener(`pointermove`,g),document.removeEventListener(`pointerup`,_),!l.value)try{window.localStorage.setItem(o,String(e))}catch{}}function v(e){e.preventDefault(),h={startX:e.clientX,startWidth:f.value,lastWidth:f.value},document.addEventListener(`pointermove`,g),document.addEventListener(`pointerup`,_)}function y(e){s.closable&&(e.stopPropagation(),c(`close`))}function b(e){let t=0,n=null,r=e.shiftKey?64:16;switch(e.key){case`ArrowLeft`:t=r;break;case`ArrowRight`:t=-r;break;case`Home`:n=s.maxWidth;break;case`End`:n=s.minWidth;break;default:return}e.preventDefault();let i=n===null?Math.min(s.maxWidth,Math.max(s.minWidth,f.value+t)):n;if(l.value||(d.value=i),c(`update:width`,i),!l.value)try{window.localStorage.setItem(o,String(i))}catch{}}(0,e.onBeforeUnmount)(()=>{document.removeEventListener(`pointermove`,g),document.removeEventListener(`pointerup`,_),m!==null&&window.clearTimeout(m)});let x=(0,e.computed)(()=>({width:s.closed?`0px`:`${f.value}px`,flex:s.closed?`0 0 0px`:`0 0 ${f.value}px`,height:`calc(100% - 16px)`,margin:s.closed?`8px 0 8px 0`:`8px 8px 8px 12px`,display:`flex`,flexDirection:`column`,background:`#ffffff`,border:s.closed?`1px solid transparent`:`1px solid #e3e3e3`,borderRadius:`16px`,boxShadow:s.closed?`none`:`0 1px 2px rgba(60,64,67,0.05), 0 4px 12px rgba(60,64,67,0.08)`,opacity:+!s.closed,pointerEvents:s.closed?`none`:`auto`,position:`relative`,boxSizing:`border-box`,minWidth:s.closed?0:`${s.minWidth}px`,overflow:`hidden`,fontFamily:`'Google Sans', 'Google Sans Text', system-ui, -apple-system, sans-serif`,transition:p.value?`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`})),S={position:`absolute`,left:`-3px`,top:0,bottom:0,width:`6px`,cursor:`col-resize`,touchAction:`none`,zIndex:1},C={display:`flex`,alignItems:`center`,gap:`10px`,padding:`14px 16px 10px`,flex:`0 0 auto`,background:`#ffffff`},w={display:`inline-flex`,alignItems:`center`,color:`#0b57d0`},T={flex:1,fontSize:`15px`,fontWeight:500,color:`#1f1f1f`,letterSpacing:`0.1px`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},E={border:`none`,background:`transparent`,padding:`6px`,cursor:`pointer`,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,color:`#444746`,borderRadius:`999px`,transition:`background 0.15s`},D={flex:1,minHeight:0,overflow:`hidden`,display:`flex`,flexDirection:`column`};function O(e,t){let n=t.currentTarget;n&&(n.style.background=e?`#f1f3f4`:`transparent`)}return(n,o)=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:(0,e.normalizeClass)([`ep-agent-panel`,t.className]),style:(0,e.normalizeStyle)(x.value),"aria-hidden":t.closed,"aria-label":t.title,role:`complementary`,"data-testid":`agent-panel`,"data-state":t.closed?`closed`:`open`,onKeydown:(0,e.withKeys)(y,[`esc`])},[(0,e.createElementVNode)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":t.resizeHandleLabel,"aria-valuenow":f.value,"aria-valuemin":t.minWidth,"aria-valuemax":t.maxWidth,"aria-valuetext":`${f.value} pixels wide`,tabindex:`0`,style:S,"data-testid":`agent-panel-resize-handle`,onPointerdown:v,onKeydown:b},null,40,i),(0,e.createElementVNode)(`div`,{style:C},[(0,e.createElementVNode)(`span`,{style:w},[(0,e.renderSlot)(n.$slots,`icon`,{},()=>[o[3]||=(0,e.createElementVNode)(`svg`,{viewBox:`0 -960 960 960`,width:`22`,height:`22`,fill:`currentColor`,"aria-hidden":`true`},[(0,e.createElementVNode)(`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`})],-1)])]),(0,e.createElementVNode)(`span`,{style:T},(0,e.toDisplayString)(t.title),1),t.closable?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{key:0,type:`button`,"aria-label":t.closeLabel,title:t.closeLabel,"data-testid":`agent-panel-close`,style:E,onClick:o[0]||=e=>c(`close`),onMouseenter:o[1]||=e=>O(!0,e),onMouseleave:o[2]||=e=>O(!1,e)},[...o[4]||=[(0,e.createElementVNode)(`svg`,{viewBox:`0 -960 960 960`,width:`18`,height:`18`,fill:`currentColor`,"aria-hidden":`true`},[(0,e.createElementVNode)(`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`})],-1)]],40,a)):(0,e.createCommentVNode)(``,!0)]),(0,e.createElementVNode)(`div`,{style:D},[(0,e.renderSlot)(n.$slots,`default`)])],46,r))}});function c(e){let t={},n=/(=\d+|\w+)\s*\{([^}]*)\}/g,r;for(;(r=n.exec(e))!==null;)t[r[1]]=r[2];return t}function l(e,t,n=`en`){return t?e.replace(/\{(\w+),\s*plural,\s*((?:[^{}]|\{[^{}]*\})*)\}/g,(e,r,i)=>{let a=Number(t[r]);if(isNaN(a))return e;let o=c(i),s=o[`=${a}`];if(s!==void 0)return s.replace(/#/g,String(a));let l;try{l=new Intl.PluralRules(n).select(a)}catch{l=a===1?`one`:`other`}return(o[l]??o.other??``).replace(/#/g,String(a))}).replace(/\{(\w+)\}/g,(e,n)=>{let r=t[n];return r===void 0?`{${n}}`:String(r)}):e}function u(e){let t=e.replace(/_/g,` `);return t.charAt(0).toUpperCase()+t.slice(1)}var d=[`aria-expanded`],f={key:1,style:{marginRight:`6px`,display:`inline-flex`},"aria-hidden":`true`},p=(0,e.defineComponent)({__name:`AgentTimeline`,props:{toolCalls:{},streaming:{type:Boolean,default:!1},maxVisibleCalls:{default:3},humanizeName:{type:Function,default:void 0},workingLabel:{type:Function,default:void 0},summaryLabel:{type:Function,default:void 0},earlierLabel:{type:Function,default:void 0}},setup(t){let r=t,i=(0,e.ref)(null),a=(0,e.computed)(()=>i.value===null?!!r.streaming:i.value),o=e=>(r.humanizeName??u)(e),s=e=>(r.earlierLabel??(e=>l(n.agentPanel.timeline.earlier,{count:e})))(e),c=(0,e.computed)(()=>{let e=r.toolCalls.length;return r.streaming?(r.workingLabel??(e=>l(n.agentPanel.timeline.working,{count:e})))(e):(r.summaryLabel??(e=>l(n.agentPanel.timeline.summary,{count:e})))(e)}),p=(0,e.computed)(()=>r.toolCalls.slice(-r.maxVisibleCalls)),m=(0,e.computed)(()=>Math.max(0,r.toolCalls.length-p.value.length)),h=(0,e.computed)(()=>({fontSize:`12px`,color:`#5f6368`,transition:`transform 0.15s ease`,marginLeft:`8px`,display:`inline-block`,transform:a.value?`rotate(180deg)`:`rotate(0deg)`}));function g(e=!1){return{marginRight:e?0:`6px`,display:`inline-flex`,animation:`epAgentSpin 0.8s linear infinite`,flexShrink:0}}let _={timelineWrap:{alignSelf:`flex-start`,maxWidth:`92%`,background:`#fff`,border:`1px solid #e1e3e6`,borderRadius:`12px`,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.5px`,color:`#1f1f1f`,fontFamily:`inherit`},timelineSummary:{display:`inline-flex`,alignItems:`center`,fontWeight:500},timelineList:{listStyle:`none`,margin:0,padding:`4px 12px 10px 12px`,display:`flex`,flexDirection:`column`,gap:`6px`,borderTop:`1px solid #ececf0`},timelineItem:{display:`flex`,alignItems:`center`,gap:`8px`,fontSize:`12px`,color:`#444746`},timelineDot:{width:`6px`,height:`6px`,borderRadius:`50%`,flexShrink:0},timelineCall:{display:`inline-flex`,flexDirection:`column`,minWidth:0},timelineCallName:{color:`#1f1f1f`},timelineError:{color:`#d93025`,fontSize:`11px`},timelineMore:{fontSize:`11px`,color:`#5f6368`,fontStyle:`italic`,paddingLeft:`14px`}};return(n,r)=>t.toolCalls.length>0?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,style:(0,e.normalizeStyle)(_.timelineWrap),"data-testid":`agent-timeline`},[(0,e.createElementVNode)(`button`,{type:`button`,"aria-expanded":a.value,style:(0,e.normalizeStyle)(_.timelineHeader),"data-testid":`agent-timeline-toggle`,onClick:r[0]||=e=>i.value=!a.value},[(0,e.createElementVNode)(`span`,{style:(0,e.normalizeStyle)(_.timelineSummary)},[t.streaming?((0,e.openBlock)(),(0,e.createElementBlock)(`span`,{key:0,style:(0,e.normalizeStyle)(g()),"aria-hidden":`true`},[...r[1]||=[(0,e.createElementVNode)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`},[(0,e.createElementVNode)(`circle`,{cx:`12`,cy:`12`,r:`9`,stroke:`#dadce0`,"stroke-width":`3`,fill:`none`}),(0,e.createElementVNode)(`path`,{d:`M21 12a9 9 0 0 0-9-9`,stroke:`#0b57d0`,"stroke-width":`3`,"stroke-linecap":`round`})],-1)]],4)):((0,e.openBlock)(),(0,e.createElementBlock)(`span`,f,[...r[2]||=[(0,e.createElementVNode)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`},[(0,e.createElementVNode)(`path`,{d:`M5 13l4 4L19 7`,stroke:`#1e8e3e`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`})],-1)]])),(0,e.createTextVNode)(` `+(0,e.toDisplayString)(c.value),1)],4),(0,e.createElementVNode)(`span`,{style:(0,e.normalizeStyle)(h.value),"aria-hidden":`true`},`▾`,4)],12,d),a.value?((0,e.openBlock)(),(0,e.createElementBlock)(`ol`,{key:0,style:(0,e.normalizeStyle)(_.timelineList)},[m.value>0?((0,e.openBlock)(),(0,e.createElementBlock)(`li`,{key:0,style:(0,e.normalizeStyle)(_.timelineMore),"data-testid":`agent-timeline-earlier`},(0,e.toDisplayString)(s(m.value)),5)):(0,e.createCommentVNode)(``,!0),((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(p.value,t=>((0,e.openBlock)(),(0,e.createElementBlock)(`li`,{key:t.id,style:(0,e.normalizeStyle)(_.timelineItem)},[t.status===`running`?((0,e.openBlock)(),(0,e.createElementBlock)(`span`,{key:0,style:(0,e.normalizeStyle)(g(!0)),"aria-hidden":`true`},[...r[3]||=[(0,e.createElementVNode)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 24 24`,fill:`none`},[(0,e.createElementVNode)(`circle`,{cx:`12`,cy:`12`,r:`9`,stroke:`#dadce0`,"stroke-width":`3`,fill:`none`}),(0,e.createElementVNode)(`path`,{d:`M21 12a9 9 0 0 0-9-9`,stroke:`#0b57d0`,"stroke-width":`3`,"stroke-linecap":`round`})],-1)]],4)):((0,e.openBlock)(),(0,e.createElementBlock)(`span`,{key:1,style:(0,e.normalizeStyle)({..._.timelineDot,background:t.status===`error`?`#d93025`:`#1e8e3e`}),"aria-hidden":`true`},null,4)),(0,e.createElementVNode)(`span`,{style:(0,e.normalizeStyle)(_.timelineCall)},[(0,e.createElementVNode)(`span`,{style:(0,e.normalizeStyle)(_.timelineCallName)},(0,e.toDisplayString)(o(t.name)),5),t.error?((0,e.openBlock)(),(0,e.createElementBlock)(`span`,{key:0,style:(0,e.normalizeStyle)(_.timelineError)},(0,e.toDisplayString)(t.error),5)):(0,e.createCommentVNode)(``,!0)],4)],4))),128))],4)):(0,e.createCommentVNode)(``,!0)],4)):(0,e.createCommentVNode)(``,!0)}}),m=[`data-role`],h=[`aria-label`],g=`ep-agent-chat-keyframes`,_=(0,e.defineComponent)({__name:`AgentChatLog`,props:{messages:{},loading:{type:Boolean,default:!1},error:{default:null},thinkingLabel:{default:()=>n.agentPanel.thinking},workingLabel:{type:Function,default:void 0},summaryLabel:{type:Function,default:void 0},earlierLabel:{type:Function,default:void 0},autoScroll:{type:Boolean,default:!0},humanizeToolName:{type:Function,default:void 0},maxVisibleCalls:{default:3},className:{default:``}},setup(t){let n=t,r=(0,e.ref)(null),i=(0,e.ref)(null),a=(0,e.computed)(()=>n.messages.length===0&&!n.loading&&!n.error);function o(){if(!n.autoScroll)return;let e=n.messages[n.messages.length-1]?.status===`streaming`;i.value?.scrollIntoView({behavior:e||n.loading?`auto`:`smooth`,block:`end`})}(0,e.onMounted)(()=>{(0,e.nextTick)(o),s()}),(0,e.watch)([()=>n.messages.length,()=>n.messages[n.messages.length-1]?.toolCalls?.length??0,()=>n.loading,()=>n.messages[n.messages.length-1]?.status===`streaming`],o,{flush:`post`});function s(){if(typeof document>`u`||document.getElementById(g))return;let e=document.createElement(`style`);e.id=g,e.textContent=`
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`vue`),t=require(`@eigenpal/docx-editor-core/headless`);var n={_lang:`en`,agentPanel:{defaultTitle:`Assistant`,close:`Close panel`,resizeHandle:`Resize agent panel`,thinking:`Assistant is thinking`,composerPlaceholder:`Ask the assistant…`,send:`Send`,timeline:{working:`Working… {count, plural, one {# step} other {# steps}}`,summary:`{count, plural, one {# step} other {# steps}}`,earlier:`+ {count, plural, one {# earlier step} other {# earlier steps}}`}},aiActions:{header:`AI Actions`,askAi:`Ask AI`,rewrite:`Rewrite`,expand:`Expand`,summarize:`Summarize`,translate:`Translate`,explain:`Explain`,fixGrammar:`Fix grammar`,makeFormal:`Make formal`,makeCasual:`Make casual`,custom:`Custom`,customPlaceholder:`Custom prompt…`},aiPreview:{defaultTitle:`AI Response`,labels:{rewrite:`Rewrite`,expand:`Expand`,summarize:`Summary`,translate:`Translation`,explain:`Explanation`,fixGrammar:`Grammar Fix`,makeFormal:`Formal Version`,makeCasual:`Casual Version`,custom:`AI Response`,askAi:`AI Response`},loading:`Processing…`,original:`Original:`,suggested:`Suggested:`,edit:`Edit`,discard:`Discard`,accept:`Accept`,retry:`Retry`,close:`Close`}},r=[`aria-hidden`,`aria-label`,`data-state`],i=[`aria-label`,`aria-valuenow`,`aria-valuemin`,`aria-valuemax`,`aria-valuetext`],a=[`aria-label`,`title`],o=`eigenpal:docx-editor:agentPanelWidth`,s=(0,e.defineComponent)({__name:`AgentPanel`,props:{title:{default:()=>n.agentPanel.defaultTitle},closeLabel:{default:()=>n.agentPanel.close},resizeHandleLabel:{default:()=>n.agentPanel.resizeHandle},width:{default:void 0},defaultWidth:{default:360},minWidth:{default:280},maxWidth:{default:600},closed:{type:Boolean,default:!1},closable:{type:Boolean,default:!0},className:{default:``}},emits:[`close`,`update:width`],setup(t,{emit:n}){let s=t,c=n,l=(0,e.computed)(()=>s.width!==void 0);function u(){if(typeof window>`u`)return s.defaultWidth;try{let e=window.localStorage.getItem(o);if(e){let t=Number(e);if(Number.isFinite(t)&&t>=s.minWidth&&t<=s.maxWidth)return t}}catch{}return s.defaultWidth}let d=(0,e.ref)(l.value?s.width:u()),f=(0,e.computed)(()=>l.value?s.width:d.value),p=(0,e.ref)(!1),m=null;(0,e.watch)(()=>s.closed,()=>{m!==null&&window.clearTimeout(m),p.value=!0,m=window.setTimeout(()=>{p.value=!1,m=null},260)},{flush:`post`});let h=null;function g(e){if(!h)return;let t=h.startX-e.clientX,n=Math.min(s.maxWidth,Math.max(s.minWidth,h.startWidth+t));h.lastWidth=n,l.value||(d.value=n),c(`update:width`,n)}function _(){if(!h)return;let e=h.lastWidth;if(h=null,document.removeEventListener(`pointermove`,g),document.removeEventListener(`pointerup`,_),!l.value)try{window.localStorage.setItem(o,String(e))}catch{}}function v(e){e.preventDefault(),h={startX:e.clientX,startWidth:f.value,lastWidth:f.value},document.addEventListener(`pointermove`,g),document.addEventListener(`pointerup`,_)}function y(e){s.closable&&(e.stopPropagation(),c(`close`))}function b(e){let t=0,n=null,r=e.shiftKey?64:16;switch(e.key){case`ArrowLeft`:t=r;break;case`ArrowRight`:t=-r;break;case`Home`:n=s.maxWidth;break;case`End`:n=s.minWidth;break;default:return}e.preventDefault();let i=n===null?Math.min(s.maxWidth,Math.max(s.minWidth,f.value+t)):n;if(l.value||(d.value=i),c(`update:width`,i),!l.value)try{window.localStorage.setItem(o,String(i))}catch{}}(0,e.onBeforeUnmount)(()=>{document.removeEventListener(`pointermove`,g),document.removeEventListener(`pointerup`,_),m!==null&&window.clearTimeout(m)});let x=(0,e.computed)(()=>({width:s.closed?`0px`:`${f.value}px`,flex:s.closed?`0 0 0px`:`0 0 ${f.value}px`,height:`calc(100% - 16px)`,margin:s.closed?`8px 0 8px 0`:`8px 8px 8px 12px`,display:`flex`,flexDirection:`column`,background:`#ffffff`,border:s.closed?`1px solid transparent`:`1px solid #e3e3e3`,borderRadius:`16px`,boxShadow:s.closed?`none`:`0 1px 2px rgba(60,64,67,0.05), 0 4px 12px rgba(60,64,67,0.08)`,opacity:+!s.closed,pointerEvents:s.closed?`none`:`auto`,position:`relative`,boxSizing:`border-box`,minWidth:s.closed?0:`${s.minWidth}px`,overflow:`hidden`,fontFamily:`'Google Sans', 'Google Sans Text', system-ui, -apple-system, sans-serif`,transition:p.value?`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`})),S={position:`absolute`,left:`-3px`,top:0,bottom:0,width:`6px`,cursor:`col-resize`,touchAction:`none`,zIndex:1},C={display:`flex`,alignItems:`center`,gap:`10px`,padding:`14px 16px 10px`,flex:`0 0 auto`,background:`#ffffff`},w={display:`inline-flex`,alignItems:`center`,color:`#0b57d0`},T={flex:1,fontSize:`15px`,fontWeight:500,color:`#1f1f1f`,letterSpacing:`0.1px`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},E={border:`none`,background:`transparent`,padding:`6px`,cursor:`pointer`,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,color:`#444746`,borderRadius:`999px`,transition:`background 0.15s`},D={flex:1,minHeight:0,overflow:`hidden`,display:`flex`,flexDirection:`column`};function O(e,t){let n=t.currentTarget;n&&(n.style.background=e?`#f1f3f4`:`transparent`)}return(n,o)=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:(0,e.normalizeClass)([`ep-agent-panel`,t.className]),style:(0,e.normalizeStyle)(x.value),"aria-hidden":t.closed,"aria-label":t.title,role:`complementary`,"data-testid":`agent-panel`,"data-state":t.closed?`closed`:`open`,onKeydown:(0,e.withKeys)(y,[`esc`])},[(0,e.createElementVNode)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":t.resizeHandleLabel,"aria-valuenow":f.value,"aria-valuemin":t.minWidth,"aria-valuemax":t.maxWidth,"aria-valuetext":`${f.value} pixels wide`,tabindex:`0`,style:S,"data-testid":`agent-panel-resize-handle`,onPointerdown:v,onKeydown:b},null,40,i),(0,e.createElementVNode)(`div`,{style:C},[(0,e.createElementVNode)(`span`,{style:w},[(0,e.renderSlot)(n.$slots,`icon`,{},()=>[o[3]||=(0,e.createElementVNode)(`svg`,{viewBox:`0 -960 960 960`,width:`22`,height:`22`,fill:`currentColor`,"aria-hidden":`true`},[(0,e.createElementVNode)(`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`})],-1)])]),(0,e.createElementVNode)(`span`,{style:T},(0,e.toDisplayString)(t.title),1),t.closable?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{key:0,type:`button`,"aria-label":t.closeLabel,title:t.closeLabel,"data-testid":`agent-panel-close`,style:E,onClick:o[0]||=e=>c(`close`),onMouseenter:o[1]||=e=>O(!0,e),onMouseleave:o[2]||=e=>O(!1,e)},[...o[4]||=[(0,e.createElementVNode)(`svg`,{viewBox:`0 -960 960 960`,width:`18`,height:`18`,fill:`currentColor`,"aria-hidden":`true`},[(0,e.createElementVNode)(`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`})],-1)]],40,a)):(0,e.createCommentVNode)(``,!0)]),(0,e.createElementVNode)(`div`,{style:D},[(0,e.renderSlot)(n.$slots,`default`)])],46,r))}});function c(e){let t={},n=/(=\d+|\w+)\s*\{([^}]*)\}/g,r;for(;(r=n.exec(e))!==null;)t[r[1]]=r[2];return t}function l(e,t,n=`en`){return t?e.replace(/\{(\w+),\s*plural,\s*((?:[^{}]|\{[^{}]*\})*)\}/g,(e,r,i)=>{let a=Number(t[r]);if(isNaN(a))return e;let o=c(i),s=o[`=${a}`];if(s!==void 0)return s.replace(/#/g,String(a));let l;try{l=new Intl.PluralRules(n).select(a)}catch{l=a===1?`one`:`other`}return(o[l]??o.other??``).replace(/#/g,String(a))}).replace(/\{(\w+)\}/g,(e,n)=>{let r=t[n];return r===void 0?`{${n}}`:String(r)}):e}function u(e){let t=e.replace(/_/g,` `);return t.charAt(0).toUpperCase()+t.slice(1)}var d=[`aria-expanded`],f={key:1,style:{marginRight:`6px`,display:`inline-flex`},"aria-hidden":`true`},p=(0,e.defineComponent)({__name:`AgentTimeline`,props:{toolCalls:{},streaming:{type:Boolean,default:!1},maxVisibleCalls:{default:3},humanizeName:{type:Function,default:void 0},workingLabel:{type:Function,default:void 0},summaryLabel:{type:Function,default:void 0},earlierLabel:{type:Function,default:void 0}},setup(t){let r=t,i=(0,e.ref)(null),a=(0,e.computed)(()=>i.value===null?!!r.streaming:i.value),o=e=>(r.humanizeName??u)(e),s=e=>(r.earlierLabel??(e=>l(n.agentPanel.timeline.earlier,{count:e})))(e),c=(0,e.computed)(()=>{let e=r.toolCalls.length;return r.streaming?(r.workingLabel??(e=>l(n.agentPanel.timeline.working,{count:e})))(e):(r.summaryLabel??(e=>l(n.agentPanel.timeline.summary,{count:e})))(e)}),p=(0,e.computed)(()=>r.toolCalls.slice(-r.maxVisibleCalls)),m=(0,e.computed)(()=>Math.max(0,r.toolCalls.length-p.value.length)),h=(0,e.computed)(()=>({fontSize:`12px`,color:`#5f6368`,transition:`transform 0.15s ease`,marginLeft:`8px`,display:`inline-block`,transform:a.value?`rotate(180deg)`:`rotate(0deg)`}));function g(e=!1){return{marginRight:e?0:`6px`,display:`inline-flex`,animation:`epAgentSpin 0.8s linear infinite`,flexShrink:0}}let _={timelineWrap:{alignSelf:`flex-start`,maxWidth:`92%`,background:`#fff`,border:`1px solid #e1e3e6`,borderRadius:`12px`,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.5px`,color:`#1f1f1f`,fontFamily:`inherit`},timelineSummary:{display:`inline-flex`,alignItems:`center`,fontWeight:500},timelineList:{listStyle:`none`,margin:0,padding:`4px 12px 10px 12px`,display:`flex`,flexDirection:`column`,gap:`6px`,borderTop:`1px solid #ececf0`},timelineItem:{display:`flex`,alignItems:`center`,gap:`8px`,fontSize:`12px`,color:`#444746`},timelineDot:{width:`6px`,height:`6px`,borderRadius:`50%`,flexShrink:0},timelineCall:{display:`inline-flex`,flexDirection:`column`,minWidth:0},timelineCallName:{color:`#1f1f1f`},timelineError:{color:`#d93025`,fontSize:`11px`},timelineMore:{fontSize:`11px`,color:`#5f6368`,fontStyle:`italic`,paddingLeft:`14px`}};return(n,r)=>t.toolCalls.length>0?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,style:(0,e.normalizeStyle)(_.timelineWrap),"data-testid":`agent-timeline`},[(0,e.createElementVNode)(`button`,{type:`button`,"aria-expanded":a.value,style:(0,e.normalizeStyle)(_.timelineHeader),"data-testid":`agent-timeline-toggle`,onClick:r[0]||=e=>i.value=!a.value},[(0,e.createElementVNode)(`span`,{style:(0,e.normalizeStyle)(_.timelineSummary)},[t.streaming?((0,e.openBlock)(),(0,e.createElementBlock)(`span`,{key:0,style:(0,e.normalizeStyle)(g()),"aria-hidden":`true`},[...r[1]||=[(0,e.createElementVNode)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`},[(0,e.createElementVNode)(`circle`,{cx:`12`,cy:`12`,r:`9`,stroke:`#dadce0`,"stroke-width":`3`,fill:`none`}),(0,e.createElementVNode)(`path`,{d:`M21 12a9 9 0 0 0-9-9`,stroke:`#0b57d0`,"stroke-width":`3`,"stroke-linecap":`round`})],-1)]],4)):((0,e.openBlock)(),(0,e.createElementBlock)(`span`,f,[...r[2]||=[(0,e.createElementVNode)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`},[(0,e.createElementVNode)(`path`,{d:`M5 13l4 4L19 7`,stroke:`#1e8e3e`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`})],-1)]])),(0,e.createTextVNode)(` `+(0,e.toDisplayString)(c.value),1)],4),(0,e.createElementVNode)(`span`,{style:(0,e.normalizeStyle)(h.value),"aria-hidden":`true`},`▾`,4)],12,d),a.value?((0,e.openBlock)(),(0,e.createElementBlock)(`ol`,{key:0,style:(0,e.normalizeStyle)(_.timelineList)},[m.value>0?((0,e.openBlock)(),(0,e.createElementBlock)(`li`,{key:0,style:(0,e.normalizeStyle)(_.timelineMore),"data-testid":`agent-timeline-earlier`},(0,e.toDisplayString)(s(m.value)),5)):(0,e.createCommentVNode)(``,!0),((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(p.value,t=>((0,e.openBlock)(),(0,e.createElementBlock)(`li`,{key:t.id,style:(0,e.normalizeStyle)(_.timelineItem)},[t.status===`running`?((0,e.openBlock)(),(0,e.createElementBlock)(`span`,{key:0,style:(0,e.normalizeStyle)(g(!0)),"aria-hidden":`true`},[...r[3]||=[(0,e.createElementVNode)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 24 24`,fill:`none`},[(0,e.createElementVNode)(`circle`,{cx:`12`,cy:`12`,r:`9`,stroke:`#dadce0`,"stroke-width":`3`,fill:`none`}),(0,e.createElementVNode)(`path`,{d:`M21 12a9 9 0 0 0-9-9`,stroke:`#0b57d0`,"stroke-width":`3`,"stroke-linecap":`round`})],-1)]],4)):((0,e.openBlock)(),(0,e.createElementBlock)(`span`,{key:1,style:(0,e.normalizeStyle)({..._.timelineDot,background:t.status===`error`?`#d93025`:`#1e8e3e`}),"aria-hidden":`true`},null,4)),(0,e.createElementVNode)(`span`,{style:(0,e.normalizeStyle)(_.timelineCall)},[(0,e.createElementVNode)(`span`,{style:(0,e.normalizeStyle)(_.timelineCallName)},(0,e.toDisplayString)(o(t.name)),5),t.error?((0,e.openBlock)(),(0,e.createElementBlock)(`span`,{key:0,style:(0,e.normalizeStyle)(_.timelineError)},(0,e.toDisplayString)(t.error),5)):(0,e.createCommentVNode)(``,!0)],4)],4))),128))],4)):(0,e.createCommentVNode)(``,!0)],4)):(0,e.createCommentVNode)(``,!0)}}),m=[`data-role`],h=[`aria-label`],g=`ep-agent-chat-keyframes`,_=(0,e.defineComponent)({__name:`AgentChatLog`,props:{messages:{},loading:{type:Boolean,default:!1},error:{default:null},thinkingLabel:{default:()=>n.agentPanel.thinking},workingLabel:{type:Function,default:void 0},summaryLabel:{type:Function,default:void 0},earlierLabel:{type:Function,default:void 0},autoScroll:{type:Boolean,default:!0},humanizeToolName:{type:Function,default:void 0},maxVisibleCalls:{default:3},className:{default:``}},setup(t){let n=t,r=(0,e.ref)(null),i=(0,e.computed)(()=>n.messages.length===0&&!n.loading&&!n.error);function a(){if(!n.autoScroll)return;let e=n.messages[n.messages.length-1]?.status===`streaming`;r.value?.scrollIntoView({behavior:e||n.loading?`auto`:`smooth`,block:`end`})}(0,e.onMounted)(()=>{(0,e.nextTick)(a),o()}),(0,e.watch)([()=>n.messages.length,()=>n.messages[n.messages.length-1]?.toolCalls?.length??0,()=>n.loading,()=>n.messages[n.messages.length-1]?.status===`streaming`],a,{flush:`post`});function o(){if(typeof document>`u`||document.getElementById(g))return;let e=document.createElement(`style`);e.id=g,e.textContent=`
|
|
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,7 +6,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require
|
|
|
6
6
|
@keyframes epAgentSpin {
|
|
7
7
|
to { transform: rotate(360deg); }
|
|
8
8
|
}
|
|
9
|
-
`,document.head.appendChild(e)}let c={flex:1,overflow:`auto`,padding:`16px 14px 8px`,display:`flex`,flexDirection:`column`,gap:`10px`},l={messageGroup:{display:`flex`,flexDirection:`column`,gap:`6px`,width:`100%`},userBubble:{background:`#0b57d0`,color:`#fff`,padding:`10px 14px`,borderRadius:`20px 20px 4px 20px`,fontSize:`13.5px`,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.5px`,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:`4px`,alignItems:`center`},dot:{width:`6px`,height:`6px`,borderRadius:`50%`,background:`#5f6368`,display:`inline-block`,animation:`epAgentDot 1.4s infinite ease-in-out`},errorBubble:{background:`#fce8e6`,color:`#b3261e`,padding:`10px 14px`,borderRadius:`16px`,fontSize:`12.5px`,alignSelf:`flex-start`,maxWidth:`92%`,whiteSpace:`pre-wrap`,fontFamily:`'Google Sans Text', system-ui, sans-serif`}};return(n,o)=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:(0,e.normalizeClass)([`ep-agent-chat-log`,t.className]),style:c,ref_key:`rootEl`,ref:r,role:`log`,"aria-live":`polite`,"aria-atomic":`false`},[a.value?(0,e.renderSlot)(n.$slots,`empty`,{key:0}):(0,e.createCommentVNode)(``,!0),((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.messages,n=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:n.id,style:(0,e.normalizeStyle)(l.messageGroup),"data-role":n.role},[n.role===`assistant`&&n.toolCalls&&n.toolCalls.length>0?((0,e.openBlock)(),(0,e.createBlock)(p,{key:0,"tool-calls":n.toolCalls,streaming:n.status===`streaming`,"humanize-name":t.humanizeToolName,"max-visible-calls":t.maxVisibleCalls,"working-label":t.workingLabel,"summary-label":t.summaryLabel,"earlier-label":t.earlierLabel},null,8,[`tool-calls`,`streaming`,`humanize-name`,`max-visible-calls`,`working-label`,`summary-label`,`earlier-label`])):(0,e.createCommentVNode)(``,!0),n.text.length>0?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,style:(0,e.normalizeStyle)(n.role===`user`?l.userBubble:l.assistantBubble)},(0,e.toDisplayString)(n.text),5)):(0,e.createCommentVNode)(``,!0)],12,m))),128)),t.loading?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,style:(0,e.normalizeStyle)(l.thinkingBubble),"aria-label":t.thinkingLabel},[(0,e.createElementVNode)(`span`,{style:(0,e.normalizeStyle)({...l.dot,animationDelay:`0s`})},null,4),(0,e.createElementVNode)(`span`,{style:(0,e.normalizeStyle)({...l.dot,animationDelay:`0.15s`})},null,4),(0,e.createElementVNode)(`span`,{style:(0,e.normalizeStyle)({...l.dot,animationDelay:`0.3s`})},null,4)],12,h)):(0,e.createCommentVNode)(``,!0),t.error?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:2,style:(0,e.normalizeStyle)(l.errorBubble),role:`alert`},(0,e.toDisplayString)(t.error),5)):(0,e.createCommentVNode)(``,!0),(0,e.createElementVNode)(`div`,{ref_key:`endEl`,ref:i},null,512)],2))}}),v=[`value`,`placeholder`,`disabled`],y=[`aria-label`,`disabled`],b=(0,e.defineComponent)({__name:`AgentComposer`,props:{modelValue:{},disabled:{type:Boolean,default:!1},placeholder:{default:()=>n.agentPanel.composerPlaceholder},sendLabel:{default:()=>n.agentPanel.send},className:{default:``}},emits:[`update:modelValue`,`submit`],setup(t,{emit:n}){let r=t,i=n,a=(0,e.computed)(()=>r.modelValue.trim().length>0&&!r.disabled);function o(){a.value&&i(`submit`)}let s=(0,e.computed)(()=>({width:`36px`,height:`36px`,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`,opacity:a.value?1:.35,cursor:a.value?`pointer`:`not-allowed`})),c={composerWrap:{padding:`8px 12px 14px`,background:`#fff`,flex:`0 0 auto`},composerShell:{display:`flex`,alignItems:`center`,gap:`4px`,padding:`6px 6px 6px 18px`,background:`#fff`,border:`1px solid #c4c7c5`,borderRadius:`28px`,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:`14px`,border:`none`,outline:`none`,background:`transparent`,fontFamily:`inherit`,color:`#1f1f1f`},footnote:{fontSize:`11px`,color:`#5f6368`,textAlign:`center`,marginTop:`10px`,fontFamily:`'Google Sans Text', system-ui, sans-serif`}};return(n,r)=>((0,e.openBlock)(),(0,e.createElementBlock)(`form`,{class:(0,e.normalizeClass)([`ep-agent-composer`,t.className]),style:(0,e.normalizeStyle)(c.composerWrap),onSubmit:(0,e.withModifiers)(o,[`prevent`])},[(0,e.createElementVNode)(`div`,{style:(0,e.normalizeStyle)(c.composerShell)},[(0,e.createElementVNode)(`input`,{style:(0,e.normalizeStyle)(c.composerInput),value:t.modelValue,placeholder:t.placeholder,disabled:t.disabled,onInput:r[0]||=e=>i(`update:modelValue`,e.target.value)},null,44,v),(0,e.createElementVNode)(`button`,{type:`submit`,"aria-label":t.sendLabel,disabled:!a.value,style:(0,e.normalizeStyle)(s.value)},[...r[1]||=[(0,e.createElementVNode)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,"aria-hidden":`true`},[(0,e.createElementVNode)(`path`,{d:`M12 19V5M5 12l7-7 7 7`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`})],-1)]],12,y)],4),n.$slots.footnote?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,style:(0,e.normalizeStyle)(c.footnote)},[(0,e.renderSlot)(n.$slots,`footnote`)],4)):(0,e.createCommentVNode)(``,!0)],38))}}),x=[`disabled`],S=(0,e.defineComponent)({__name:`AgentSuggestionChip`,props:{label:{},disabled:{type:Boolean}},emits:[`click`],setup(t,{emit:n}){let r=n,i={textAlign:`left`,background:`#fff`,border:`1px solid #dadce0`,borderRadius:`18px`,padding:`10px 14px`,fontSize:`13px`,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%`};return(n,a)=>((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{type:`button`,style:i,disabled:t.disabled,onClick:a[0]||=e=>r(`click`)},(0,e.toDisplayString)(t.label),9,x))}}),C=[`aria-label`],w={class:`ai-ctx-menu__header`,"aria-hidden":`true`},T=[`onMousedown`],E=[`innerHTML`],D={class:`ai-ctx-menu__label`},O={key:0,class:`ai-ctx-menu__custom`},k=[`placeholder`],A=(0,e.defineComponent)({__name:`AIContextMenu`,props:{isOpen:{type:Boolean},position:{},selectedText:{},showCustomPrompt:{type:Boolean,default:!0},labels:{default:()=>({})}},emits:[`close`,`action`],setup(t,{emit:r}){let i=t,a=r,o=(0,e.ref)(``),s=(0,e.ref)([]);(0,e.watch)(()=>i.isOpen,t=>{t&&(0,e.nextTick)(()=>s.value[0]?.focus())},{immediate:!0});let c=[{id:`rewrite`,icon:`✍`},{id:`expand`,icon:`↔`},{id:`summarize`,icon:`📝`},{id:`fixGrammar`,icon:`✔`},{id:`makeFormal`,icon:`👔`},{id:`makeCasual`,icon:`😊`},{id:`translate`,icon:`🌐`},{id:`explain`,icon:`💡`}],l=(0,e.computed)(()=>i.labels?.header??n.aiActions.header),u=(0,e.computed)(()=>i.labels?.customPlaceholder??n.aiActions.customPlaceholder);function d(e){return i.labels?.[e]||(n.aiActions[e]??e)}let f=(0,e.computed)(()=>{let e=i.position.x,t=i.position.y;return typeof window<`u`&&(e+220+10>window.innerWidth&&(e=window.innerWidth-220-10),t+360+10>window.innerHeight&&(t=window.innerHeight-360-10)),{position:`fixed`,left:`${e}px`,top:`${t}px`,zIndex:500}});function p(e){a(`action`,e,e===`custom`?o.value:void 0),o.value=``,a(`close`)}return(n,r)=>((0,e.openBlock)(),(0,e.createBlock)(e.Teleport,{to:`body`},[t.isOpen?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:`ai-ctx-backdrop`,onMousedown:r[0]||=e=>a(`close`),onContextmenu:r[1]||=(0,e.withModifiers)(e=>a(`close`),[`prevent`])},null,32)):(0,e.createCommentVNode)(``,!0),t.isOpen?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,class:`ai-ctx-menu`,"aria-label":l.value,style:(0,e.normalizeStyle)(f.value),tabindex:`-1`,onContextmenu:r[4]||=(0,e.withModifiers)(()=>{},[`prevent`]),onKeydown:r[5]||=(0,e.withKeys)((0,e.withModifiers)(e=>a(`close`),[`stop`]),[`esc`])},[(0,e.createElementVNode)(`div`,w,(0,e.toDisplayString)(l.value),1),((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(c,t=>(0,e.createElementVNode)(`button`,{key:t.id,ref_for:!0,ref_key:`itemRefs`,ref:s,class:`ai-ctx-menu__item`,onMousedown:(0,e.withModifiers)(e=>p(t.id),[`prevent`])},[(0,e.createElementVNode)(`span`,{class:`ai-ctx-menu__icon`,innerHTML:t.icon},null,8,E),(0,e.createElementVNode)(`span`,D,(0,e.toDisplayString)(d(t.id)),1)],40,T)),64)),r[6]||=(0,e.createElementVNode)(`div`,{class:`ai-ctx-menu__divider`},null,-1),t.showCustomPrompt?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,O,[(0,e.withDirectives)((0,e.createElementVNode)(`input`,{"onUpdate:modelValue":r[2]||=e=>o.value=e,class:`ai-ctx-menu__input`,placeholder:u.value,onKeydown:r[3]||=(0,e.withKeys)((0,e.withModifiers)(e=>p(`custom`),[`prevent`]),[`enter`])},null,40,k),[[e.vModelText,o.value]])])):(0,e.createCommentVNode)(``,!0)],44,C)):(0,e.createCommentVNode)(``,!0)]))}}),j=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},M=j(A,[[`__scopeId`,`data-v-c30da7a7`]]),ee=[`aria-label`],te={class:`ai-preview__header`},ne={class:`ai-preview__title`},re=[`aria-label`],ie={key:0,class:`ai-preview__loading`},ae={key:1,class:`ai-preview__error`},oe={key:2,class:`ai-preview__content`},se={key:0,class:`ai-preview__diff`},ce={class:`ai-preview__diff-label`},le={class:`ai-preview__diff-text ai-preview__diff-text--old`},ue={class:`ai-preview__diff-label`},de={class:`ai-preview__diff-text ai-preview__diff-text--new`},N={key:1,class:`ai-preview__result`},P={key:3,class:`ai-preview__footer`},F=j((0,e.defineComponent)({__name:`AIResponsePreview`,props:{isVisible:{type:Boolean},originalText:{},responseText:{},action:{},isLoading:{type:Boolean},error:{default:void 0},allowEdit:{type:Boolean,default:!0},showDiff:{type:Boolean,default:!0},showRetry:{type:Boolean,default:!0},labels:{default:()=>({})}},emits:[`accept`,`reject`,`retry`],setup(t,{emit:r}){let i=t,a=r,o=(0,e.ref)(!1),s=(0,e.ref)(``),c=(0,e.computed)(()=>({loading:i.labels?.loading??n.aiPreview.loading,original:i.labels?.original??n.aiPreview.original,suggested:i.labels?.suggested??n.aiPreview.suggested,edit:i.labels?.edit??n.aiPreview.edit,discard:i.labels?.discard??n.aiPreview.discard,accept:i.labels?.accept??n.aiPreview.accept,retry:i.labels?.retry??n.aiPreview.retry,close:i.labels?.close??n.aiPreview.close})),l=(0,e.computed)(()=>i.labels?.actionTitles?.[i.action]||(n.aiPreview.labels[i.action]??n.aiPreview.defaultTitle));(0,e.watch)(()=>i.responseText,e=>{s.value=e,o.value=!1});function u(){a(`accept`,o.value?s.value:i.responseText)}return(n,r)=>t.isVisible?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:`ai-preview`,role:`region`,"aria-label":l.value,tabindex:`-1`,onKeydown:r[5]||=(0,e.withKeys)((0,e.withModifiers)(e=>a(`reject`),[`stop`]),[`esc`])},[(0,e.createElementVNode)(`div`,te,[(0,e.createElementVNode)(`span`,ne,(0,e.toDisplayString)(l.value),1),(0,e.createElementVNode)(`button`,{class:`ai-preview__close`,"aria-label":c.value.close,onClick:r[0]||=e=>a(`reject`)},` ✕ `,8,re)]),t.isLoading?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,ie,[r[6]||=(0,e.createElementVNode)(`span`,{class:`ai-preview__spinner`},null,-1),(0,e.createElementVNode)(`span`,null,(0,e.toDisplayString)(c.value.loading),1)])):t.error?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,ae,[(0,e.createElementVNode)(`span`,null,(0,e.toDisplayString)(t.error),1),t.showRetry?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{key:0,class:`ai-preview__retry`,onMousedown:r[1]||=(0,e.withModifiers)(e=>a(`retry`),[`prevent`])},(0,e.toDisplayString)(c.value.retry),33)):(0,e.createCommentVNode)(``,!0)])):((0,e.openBlock)(),(0,e.createElementBlock)(`div`,oe,[t.showDiff?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,se,[(0,e.createElementVNode)(`div`,ce,(0,e.toDisplayString)(c.value.original),1),(0,e.createElementVNode)(`div`,le,(0,e.toDisplayString)(t.originalText),1),(0,e.createElementVNode)(`div`,ue,(0,e.toDisplayString)(c.value.suggested),1),(0,e.createElementVNode)(`div`,de,(0,e.toDisplayString)(t.responseText),1)])):((0,e.openBlock)(),(0,e.createElementBlock)(`div`,N,(0,e.toDisplayString)(t.responseText),1)),t.allowEdit&&o.value?(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createElementBlock)(`textarea`,{key:2,"onUpdate:modelValue":r[2]||=e=>s.value=e,class:`ai-preview__textarea`,rows:`4`},null,512)),[[e.vModelText,s.value]]):(0,e.createCommentVNode)(``,!0)])),!t.isLoading&&!t.error?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,P,[t.allowEdit&&!o.value?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{key:0,class:`ai-preview__btn`,onMousedown:r[3]||=(0,e.withModifiers)(e=>o.value=!0,[`prevent`])},(0,e.toDisplayString)(c.value.edit),33)):(0,e.createCommentVNode)(``,!0),(0,e.createElementVNode)(`button`,{class:`ai-preview__btn`,onMousedown:r[4]||=(0,e.withModifiers)(e=>a(`reject`),[`prevent`])},(0,e.toDisplayString)(c.value.discard),33),(0,e.createElementVNode)(`button`,{class:`ai-preview__btn ai-preview__btn--primary`,onMousedown:(0,e.withModifiers)(u,[`prevent`])},(0,e.toDisplayString)(c.value.accept),33)])):(0,e.createCommentVNode)(``,!0)],40,ee)):(0,e.createCommentVNode)(``,!0)}}),[[`__scopeId`,`data-v-1226b741`]]),I=[`single`,`words`,`double`,`thick`,`dotted`,`dottedHeavy`,`dash`,`dashedHeavy`,`dashLong`,`dashLongHeavy`,`dotDash`,`dashDotHeavy`,`dotDotDash`,`dashDotDotHeavy`,`wave`,`wavyHeavy`,`wavyDouble`,`none`],L=[`black`,`blue`,`cyan`,`darkBlue`,`darkCyan`,`darkGray`,`darkGreen`,`darkMagenta`,`darkRed`,`darkYellow`,`green`,`lightGray`,`magenta`,`red`,`white`,`yellow`,`none`],R=[{name:`read_document`,displayName:`Reading document`,description:'Read the document content. Returns lines tagged with a stable paragraph id, e.g. "[2A1F3B] First paragraph". Use the bracketed id as `paraId` when commenting or suggesting changes — it survives edits, unlike ordinal indices. Returns the vanilla document (the doc as it exists right now, before any tracked suggestions are accepted): pending insertions are HIDDEN, pending deletions are shown as plain text (still part of the document until accepted), and comment markers are stripped. Use read_changes / read_comments to inspect what is pending.',inputSchema:{type:`object`,properties:{fromIndex:{type:`number`,description:`Start ordinal index (inclusive). Optional.`},toIndex:{type:`number`,description:`End ordinal index (inclusive). Optional.`}}},handler:(e,t)=>({success:!0,data:t.getContentAsText({fromIndex:e.fromIndex,toIndex:e.toIndex,includeTrackedChanges:!1,includeCommentAnchors:!1})})},{name:`read_selection`,displayName:`Reading selection`,description:`Read the user's current cursor or selection. Returns the selected text, the paragraph it lives in, and that paragraph's \`paraId\`. Use this when the user asks "fix this" or "review what I have selected".`,inputSchema:{type:`object`,properties:{}},handler:(e,t)=>{let n=t.getSelection();return n?{success:!0,data:n}:{success:!1,error:`No selection (editor not focused).`}}},{name:`read_page`,displayName:`Reading page`,description:`Read the contents of one rendered page (1-indexed). Returns paragraphs on the page, each tagged with its stable paraId. Use this when the user asks "summarize page 3" or "comment on what's on this page".`,inputSchema:{type:`object`,properties:{pageNumber:{type:`number`,description:`1-indexed page number.`}},required:[`pageNumber`]},handler:(e,t)=>{let n=t.getPage(e.pageNumber);if(!n){let n=t.getTotalPages();return n===0?{success:!1,error:`No pages rendered (headless mode or empty document).`}:{success:!1,error:`Page ${e.pageNumber} does not exist (document has ${n} page${n===1?``:`s`}).`}}return{success:!0,data:n.text||`(empty page)`}}},{name:`read_pages`,displayName:`Reading pages`,description:`Read a contiguous range of rendered pages (1-indexed, inclusive). Returns paragraphs across the range, each tagged with paraId. Cheaper than calling read_page repeatedly — single round-trip.`,inputSchema:{type:`object`,properties:{from:{type:`number`,description:`1-indexed start page (inclusive).`},to:{type:`number`,description:`1-indexed end page (inclusive).`}},required:[`from`,`to`]},handler:(e,t)=>{let n=t.getPages({from:e.from,to:e.to});if(n.length===0){let n=t.getTotalPages();return n===0?{success:!1,error:`No pages rendered (headless mode or empty document).`}:{success:!1,error:`No pages in range ${e.from}–${e.to} (document has ${n} page${n===1?``:`s`}).`}}return{success:!0,data:n.map(e=>`--- Page ${e.pageNumber} ---\n${e.text||`(empty page)`}`).join(`
|
|
9
|
+
`,document.head.appendChild(e)}let s={flex:1,overflow:`auto`,padding:`16px 14px 8px`,display:`flex`,flexDirection:`column`,gap:`10px`},c={messageGroup:{display:`flex`,flexDirection:`column`,gap:`6px`,width:`100%`},userBubble:{background:`#0b57d0`,color:`#fff`,padding:`10px 14px`,borderRadius:`20px 20px 4px 20px`,fontSize:`13.5px`,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.5px`,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:`4px`,alignItems:`center`},dot:{width:`6px`,height:`6px`,borderRadius:`50%`,background:`#5f6368`,display:`inline-block`,animation:`epAgentDot 1.4s infinite ease-in-out`},errorBubble:{background:`#fce8e6`,color:`#b3261e`,padding:`10px 14px`,borderRadius:`16px`,fontSize:`12.5px`,alignSelf:`flex-start`,maxWidth:`92%`,whiteSpace:`pre-wrap`,fontFamily:`'Google Sans Text', system-ui, sans-serif`}};return(n,a)=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:(0,e.normalizeClass)([`ep-agent-chat-log`,t.className]),style:s,role:`log`,"aria-live":`polite`,"aria-atomic":`false`},[i.value?(0,e.renderSlot)(n.$slots,`empty`,{key:0}):(0,e.createCommentVNode)(``,!0),((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.messages,n=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:n.id,style:(0,e.normalizeStyle)(c.messageGroup),"data-role":n.role},[n.role===`assistant`&&n.toolCalls&&n.toolCalls.length>0?((0,e.openBlock)(),(0,e.createBlock)(p,{key:0,"tool-calls":n.toolCalls,streaming:n.status===`streaming`,"humanize-name":t.humanizeToolName,"max-visible-calls":t.maxVisibleCalls,"working-label":t.workingLabel,"summary-label":t.summaryLabel,"earlier-label":t.earlierLabel},null,8,[`tool-calls`,`streaming`,`humanize-name`,`max-visible-calls`,`working-label`,`summary-label`,`earlier-label`])):(0,e.createCommentVNode)(``,!0),n.text.length>0?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,style:(0,e.normalizeStyle)(n.role===`user`?c.userBubble:c.assistantBubble)},(0,e.toDisplayString)(n.text),5)):(0,e.createCommentVNode)(``,!0)],12,m))),128)),t.loading?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,style:(0,e.normalizeStyle)(c.thinkingBubble),"aria-label":t.thinkingLabel},[(0,e.createElementVNode)(`span`,{style:(0,e.normalizeStyle)({...c.dot,animationDelay:`0s`})},null,4),(0,e.createElementVNode)(`span`,{style:(0,e.normalizeStyle)({...c.dot,animationDelay:`0.15s`})},null,4),(0,e.createElementVNode)(`span`,{style:(0,e.normalizeStyle)({...c.dot,animationDelay:`0.3s`})},null,4)],12,h)):(0,e.createCommentVNode)(``,!0),t.error?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:2,style:(0,e.normalizeStyle)(c.errorBubble),role:`alert`},(0,e.toDisplayString)(t.error),5)):(0,e.createCommentVNode)(``,!0),(0,e.createElementVNode)(`div`,{ref_key:`endEl`,ref:r},null,512)],2))}}),v=[`value`,`placeholder`,`disabled`],y=[`aria-label`,`disabled`],b=(0,e.defineComponent)({__name:`AgentComposer`,props:{modelValue:{},disabled:{type:Boolean,default:!1},placeholder:{default:()=>n.agentPanel.composerPlaceholder},sendLabel:{default:()=>n.agentPanel.send},className:{default:``}},emits:[`update:modelValue`,`submit`],setup(t,{emit:n}){let r=t,i=n,a=(0,e.computed)(()=>r.modelValue.trim().length>0&&!r.disabled);function o(){a.value&&i(`submit`)}let s=(0,e.computed)(()=>({width:`36px`,height:`36px`,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`,opacity:a.value?1:.35,cursor:a.value?`pointer`:`not-allowed`})),c={composerWrap:{padding:`8px 12px 14px`,background:`#fff`,flex:`0 0 auto`},composerShell:{display:`flex`,alignItems:`center`,gap:`4px`,padding:`6px 6px 6px 18px`,background:`#fff`,border:`1px solid #c4c7c5`,borderRadius:`28px`,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:`14px`,border:`none`,outline:`none`,background:`transparent`,fontFamily:`inherit`,color:`#1f1f1f`},footnote:{fontSize:`11px`,color:`#5f6368`,textAlign:`center`,marginTop:`10px`,fontFamily:`'Google Sans Text', system-ui, sans-serif`}};return(n,r)=>((0,e.openBlock)(),(0,e.createElementBlock)(`form`,{class:(0,e.normalizeClass)([`ep-agent-composer`,t.className]),style:(0,e.normalizeStyle)(c.composerWrap),onSubmit:(0,e.withModifiers)(o,[`prevent`])},[(0,e.createElementVNode)(`div`,{style:(0,e.normalizeStyle)(c.composerShell)},[(0,e.createElementVNode)(`input`,{style:(0,e.normalizeStyle)(c.composerInput),value:t.modelValue,placeholder:t.placeholder,disabled:t.disabled,onInput:r[0]||=e=>i(`update:modelValue`,e.target.value)},null,44,v),(0,e.createElementVNode)(`button`,{type:`submit`,"aria-label":t.sendLabel,disabled:!a.value,style:(0,e.normalizeStyle)(s.value)},[...r[1]||=[(0,e.createElementVNode)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,"aria-hidden":`true`},[(0,e.createElementVNode)(`path`,{d:`M12 19V5M5 12l7-7 7 7`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`})],-1)]],12,y)],4),n.$slots.footnote?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,style:(0,e.normalizeStyle)(c.footnote)},[(0,e.renderSlot)(n.$slots,`footnote`)],4)):(0,e.createCommentVNode)(``,!0)],38))}}),x=[`disabled`],S=(0,e.defineComponent)({__name:`AgentSuggestionChip`,props:{label:{},disabled:{type:Boolean}},emits:[`click`],setup(t,{emit:n}){let r=n,i={textAlign:`left`,background:`#fff`,border:`1px solid #dadce0`,borderRadius:`18px`,padding:`10px 14px`,fontSize:`13px`,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%`};return(n,a)=>((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{type:`button`,style:i,disabled:t.disabled,onClick:a[0]||=e=>r(`click`)},(0,e.toDisplayString)(t.label),9,x))}}),C=[`aria-label`],w={class:`ai-ctx-menu__header`,"aria-hidden":`true`},T=[`onMousedown`],E=[`innerHTML`],D={class:`ai-ctx-menu__label`},O={key:0,class:`ai-ctx-menu__custom`},k=[`placeholder`],A=(0,e.defineComponent)({__name:`AIContextMenu`,props:{isOpen:{type:Boolean},position:{},selectedText:{},showCustomPrompt:{type:Boolean,default:!0},labels:{default:()=>({})}},emits:[`close`,`action`],setup(t,{emit:r}){let i=t,a=r,o=(0,e.ref)(``),s=(0,e.ref)([]);(0,e.watch)(()=>i.isOpen,t=>{t&&(0,e.nextTick)(()=>s.value[0]?.focus())},{immediate:!0});let c=[{id:`rewrite`,icon:`✍`},{id:`expand`,icon:`↔`},{id:`summarize`,icon:`📝`},{id:`fixGrammar`,icon:`✔`},{id:`makeFormal`,icon:`👔`},{id:`makeCasual`,icon:`😊`},{id:`translate`,icon:`🌐`},{id:`explain`,icon:`💡`}],l=(0,e.computed)(()=>i.labels?.header??n.aiActions.header),u=(0,e.computed)(()=>i.labels?.customPlaceholder??n.aiActions.customPlaceholder);function d(e){return i.labels?.[e]||(n.aiActions[e]??e)}let f=(0,e.computed)(()=>{let e=i.position.x,t=i.position.y;return typeof window<`u`&&(e+220+10>window.innerWidth&&(e=window.innerWidth-220-10),t+360+10>window.innerHeight&&(t=window.innerHeight-360-10)),{position:`fixed`,left:`${e}px`,top:`${t}px`,zIndex:500}});function p(e){a(`action`,e,e===`custom`?o.value:void 0),o.value=``,a(`close`)}return(n,r)=>((0,e.openBlock)(),(0,e.createBlock)(e.Teleport,{to:`body`},[t.isOpen?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:`ai-ctx-backdrop`,onMousedown:r[0]||=e=>a(`close`),onContextmenu:r[1]||=(0,e.withModifiers)(e=>a(`close`),[`prevent`])},null,32)):(0,e.createCommentVNode)(``,!0),t.isOpen?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,class:`ai-ctx-menu`,"aria-label":l.value,style:(0,e.normalizeStyle)(f.value),tabindex:`-1`,onContextmenu:r[4]||=(0,e.withModifiers)(()=>{},[`prevent`]),onKeydown:r[5]||=(0,e.withKeys)((0,e.withModifiers)(e=>a(`close`),[`stop`]),[`esc`])},[(0,e.createElementVNode)(`div`,w,(0,e.toDisplayString)(l.value),1),((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(c,t=>(0,e.createElementVNode)(`button`,{key:t.id,ref_for:!0,ref_key:`itemRefs`,ref:s,class:`ai-ctx-menu__item`,onMousedown:(0,e.withModifiers)(e=>p(t.id),[`prevent`])},[(0,e.createElementVNode)(`span`,{class:`ai-ctx-menu__icon`,innerHTML:t.icon},null,8,E),(0,e.createElementVNode)(`span`,D,(0,e.toDisplayString)(d(t.id)),1)],40,T)),64)),r[6]||=(0,e.createElementVNode)(`div`,{class:`ai-ctx-menu__divider`},null,-1),t.showCustomPrompt?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,O,[(0,e.withDirectives)((0,e.createElementVNode)(`input`,{"onUpdate:modelValue":r[2]||=e=>o.value=e,class:`ai-ctx-menu__input`,placeholder:u.value,onKeydown:r[3]||=(0,e.withKeys)((0,e.withModifiers)(e=>p(`custom`),[`prevent`]),[`enter`])},null,40,k),[[e.vModelText,o.value]])])):(0,e.createCommentVNode)(``,!0)],44,C)):(0,e.createCommentVNode)(``,!0)]))}}),j=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},M=j(A,[[`__scopeId`,`data-v-c30da7a7`]]),ee=[`aria-label`],te={class:`ai-preview__header`},ne={class:`ai-preview__title`},re=[`aria-label`],ie={key:0,class:`ai-preview__loading`},ae={key:1,class:`ai-preview__error`},oe={key:2,class:`ai-preview__content`},se={key:0,class:`ai-preview__diff`},ce={class:`ai-preview__diff-label`},le={class:`ai-preview__diff-text ai-preview__diff-text--old`},ue={class:`ai-preview__diff-label`},de={class:`ai-preview__diff-text ai-preview__diff-text--new`},N={key:1,class:`ai-preview__result`},P={key:3,class:`ai-preview__footer`},F=j((0,e.defineComponent)({__name:`AIResponsePreview`,props:{isVisible:{type:Boolean},originalText:{},responseText:{},action:{},isLoading:{type:Boolean},error:{default:void 0},allowEdit:{type:Boolean,default:!0},showDiff:{type:Boolean,default:!0},showRetry:{type:Boolean,default:!0},labels:{default:()=>({})}},emits:[`accept`,`reject`,`retry`],setup(t,{emit:r}){let i=t,a=r,o=(0,e.ref)(!1),s=(0,e.ref)(``),c=(0,e.computed)(()=>({loading:i.labels?.loading??n.aiPreview.loading,original:i.labels?.original??n.aiPreview.original,suggested:i.labels?.suggested??n.aiPreview.suggested,edit:i.labels?.edit??n.aiPreview.edit,discard:i.labels?.discard??n.aiPreview.discard,accept:i.labels?.accept??n.aiPreview.accept,retry:i.labels?.retry??n.aiPreview.retry,close:i.labels?.close??n.aiPreview.close})),l=(0,e.computed)(()=>i.labels?.actionTitles?.[i.action]||(n.aiPreview.labels[i.action]??n.aiPreview.defaultTitle));(0,e.watch)(()=>i.responseText,e=>{s.value=e,o.value=!1});function u(){a(`accept`,o.value?s.value:i.responseText)}return(n,r)=>t.isVisible?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:`ai-preview`,role:`region`,"aria-label":l.value,tabindex:`-1`,onKeydown:r[5]||=(0,e.withKeys)((0,e.withModifiers)(e=>a(`reject`),[`stop`]),[`esc`])},[(0,e.createElementVNode)(`div`,te,[(0,e.createElementVNode)(`span`,ne,(0,e.toDisplayString)(l.value),1),(0,e.createElementVNode)(`button`,{class:`ai-preview__close`,"aria-label":c.value.close,onClick:r[0]||=e=>a(`reject`)},` ✕ `,8,re)]),t.isLoading?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,ie,[r[6]||=(0,e.createElementVNode)(`span`,{class:`ai-preview__spinner`},null,-1),(0,e.createElementVNode)(`span`,null,(0,e.toDisplayString)(c.value.loading),1)])):t.error?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,ae,[(0,e.createElementVNode)(`span`,null,(0,e.toDisplayString)(t.error),1),t.showRetry?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{key:0,class:`ai-preview__retry`,onMousedown:r[1]||=(0,e.withModifiers)(e=>a(`retry`),[`prevent`])},(0,e.toDisplayString)(c.value.retry),33)):(0,e.createCommentVNode)(``,!0)])):((0,e.openBlock)(),(0,e.createElementBlock)(`div`,oe,[t.showDiff?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,se,[(0,e.createElementVNode)(`div`,ce,(0,e.toDisplayString)(c.value.original),1),(0,e.createElementVNode)(`div`,le,(0,e.toDisplayString)(t.originalText),1),(0,e.createElementVNode)(`div`,ue,(0,e.toDisplayString)(c.value.suggested),1),(0,e.createElementVNode)(`div`,de,(0,e.toDisplayString)(t.responseText),1)])):((0,e.openBlock)(),(0,e.createElementBlock)(`div`,N,(0,e.toDisplayString)(t.responseText),1)),t.allowEdit&&o.value?(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createElementBlock)(`textarea`,{key:2,"onUpdate:modelValue":r[2]||=e=>s.value=e,class:`ai-preview__textarea`,rows:`4`},null,512)),[[e.vModelText,s.value]]):(0,e.createCommentVNode)(``,!0)])),!t.isLoading&&!t.error?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,P,[t.allowEdit&&!o.value?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{key:0,class:`ai-preview__btn`,onMousedown:r[3]||=(0,e.withModifiers)(e=>o.value=!0,[`prevent`])},(0,e.toDisplayString)(c.value.edit),33)):(0,e.createCommentVNode)(``,!0),(0,e.createElementVNode)(`button`,{class:`ai-preview__btn`,onMousedown:r[4]||=(0,e.withModifiers)(e=>a(`reject`),[`prevent`])},(0,e.toDisplayString)(c.value.discard),33),(0,e.createElementVNode)(`button`,{class:`ai-preview__btn ai-preview__btn--primary`,onMousedown:(0,e.withModifiers)(u,[`prevent`])},(0,e.toDisplayString)(c.value.accept),33)])):(0,e.createCommentVNode)(``,!0)],40,ee)):(0,e.createCommentVNode)(``,!0)}}),[[`__scopeId`,`data-v-1226b741`]]),I=[`single`,`words`,`double`,`thick`,`dotted`,`dottedHeavy`,`dash`,`dashedHeavy`,`dashLong`,`dashLongHeavy`,`dotDash`,`dashDotHeavy`,`dotDotDash`,`dashDotDotHeavy`,`wave`,`wavyHeavy`,`wavyDouble`,`none`],L=[`black`,`blue`,`cyan`,`darkBlue`,`darkCyan`,`darkGray`,`darkGreen`,`darkMagenta`,`darkRed`,`darkYellow`,`green`,`lightGray`,`magenta`,`red`,`white`,`yellow`,`none`],R=[{name:`read_document`,displayName:`Reading document`,description:'Read the document content. Returns lines tagged with a stable paragraph id, e.g. "[2A1F3B] First paragraph". Use the bracketed id as `paraId` when commenting or suggesting changes — it survives edits, unlike ordinal indices. Returns the vanilla document (the doc as it exists right now, before any tracked suggestions are accepted): pending insertions are HIDDEN, pending deletions are shown as plain text (still part of the document until accepted), and comment markers are stripped. Use read_changes / read_comments to inspect what is pending.',inputSchema:{type:`object`,properties:{fromIndex:{type:`number`,description:`Start ordinal index (inclusive). Optional.`},toIndex:{type:`number`,description:`End ordinal index (inclusive). Optional.`}}},handler:(e,t)=>({success:!0,data:t.getContentAsText({fromIndex:e.fromIndex,toIndex:e.toIndex,includeTrackedChanges:!1,includeCommentAnchors:!1})})},{name:`read_selection`,displayName:`Reading selection`,description:`Read the user's current cursor or selection. Returns the selected text, the paragraph it lives in, and that paragraph's \`paraId\`. Use this when the user asks "fix this" or "review what I have selected".`,inputSchema:{type:`object`,properties:{}},handler:(e,t)=>{let n=t.getSelection();return n?{success:!0,data:n}:{success:!1,error:`No selection (editor not focused).`}}},{name:`read_page`,displayName:`Reading page`,description:`Read the contents of one rendered page (1-indexed). Returns paragraphs on the page, each tagged with its stable paraId. Use this when the user asks "summarize page 3" or "comment on what's on this page".`,inputSchema:{type:`object`,properties:{pageNumber:{type:`number`,description:`1-indexed page number.`}},required:[`pageNumber`]},handler:(e,t)=>{let n=t.getPage(e.pageNumber);if(!n){let n=t.getTotalPages();return n===0?{success:!1,error:`No pages rendered (headless mode or empty document).`}:{success:!1,error:`Page ${e.pageNumber} does not exist (document has ${n} page${n===1?``:`s`}).`}}return{success:!0,data:n.text||`(empty page)`}}},{name:`read_pages`,displayName:`Reading pages`,description:`Read a contiguous range of rendered pages (1-indexed, inclusive). Returns paragraphs across the range, each tagged with paraId. Cheaper than calling read_page repeatedly — single round-trip.`,inputSchema:{type:`object`,properties:{from:{type:`number`,description:`1-indexed start page (inclusive).`},to:{type:`number`,description:`1-indexed end page (inclusive).`}},required:[`from`,`to`]},handler:(e,t)=>{let n=t.getPages({from:e.from,to:e.to});if(n.length===0){let n=t.getTotalPages();return n===0?{success:!1,error:`No pages rendered (headless mode or empty document).`}:{success:!1,error:`No pages in range ${e.from}–${e.to} (document has ${n} page${n===1?``:`s`}).`}}return{success:!0,data:n.map(e=>`--- Page ${e.pageNumber} ---\n${e.text||`(empty page)`}`).join(`
|
|
10
10
|
|
|
11
11
|
`)}}},{name:`find_text`,displayName:`Finding text`,description:"Locate paragraphs containing `query`. Returns up to `limit` handles, each with `paraId`, the matched substring, and surrounding context. Pass any returned `paraId` (and the `match` as `search`) to add_comment / suggest_change.",inputSchema:{type:`object`,properties:{query:{type:`string`,description:`Text to find (substring match).`},caseSensitive:{type:`boolean`,description:`Default: false.`},limit:{type:`number`,description:`Max paragraphs to return. Default: 20.`}},required:[`query`]},handler:(e,t)=>{let n=t.findText(e.query,{caseSensitive:e.caseSensitive,limit:e.limit});return n.length===0?{success:!0,data:`No matches.`}:{success:!0,data:n}}},{name:`read_comments`,displayName:`Reading comments`,description:`List all comments in the document with their paragraph anchors.`,inputSchema:{type:`object`,properties:{}},handler:(e,t)=>{let n=t.getComments();return n.length===0?{success:!0,data:`No comments.`}:{success:!0,data:n.map(e=>`[Comment #${e.id}] ${e.author}: "${e.text}"`+(e.anchoredText?` (anchored to: "${e.anchoredText}")`:``)+(e.replies.length>0?`
|
|
12
12
|
`+e.replies.map(e=>` Reply by ${e.author}: "${e.text}"`).join(`
|
package/dist/vue.mjs
CHANGED
|
@@ -551,36 +551,36 @@ var I = ["aria-expanded"], L = {
|
|
|
551
551
|
className: { default: "" }
|
|
552
552
|
},
|
|
553
553
|
setup(t) {
|
|
554
|
-
let s = t, c = h(null), f =
|
|
555
|
-
function
|
|
554
|
+
let s = t, c = h(null), f = n(() => s.messages.length === 0 && !s.loading && !s.error);
|
|
555
|
+
function y() {
|
|
556
556
|
if (!s.autoScroll) return;
|
|
557
557
|
let e = s.messages[s.messages.length - 1]?.status === "streaming";
|
|
558
|
-
|
|
558
|
+
c.value?.scrollIntoView({
|
|
559
559
|
behavior: e || s.loading ? "auto" : "smooth",
|
|
560
560
|
block: "end"
|
|
561
561
|
});
|
|
562
562
|
}
|
|
563
563
|
p(() => {
|
|
564
|
-
l(
|
|
564
|
+
l(y), b();
|
|
565
565
|
}), x([
|
|
566
566
|
() => s.messages.length,
|
|
567
567
|
() => s.messages[s.messages.length - 1]?.toolCalls?.length ?? 0,
|
|
568
568
|
() => s.loading,
|
|
569
569
|
() => s.messages[s.messages.length - 1]?.status === "streaming"
|
|
570
|
-
],
|
|
571
|
-
function
|
|
570
|
+
], y, { flush: "post" });
|
|
571
|
+
function b() {
|
|
572
572
|
if (typeof document > "u" || document.getElementById(z)) return;
|
|
573
573
|
let e = document.createElement("style");
|
|
574
574
|
e.id = z, e.textContent = "\n@keyframes epAgentDot {\n 0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }\n 40% { transform: scale(1); opacity: 1; }\n}\n@keyframes epAgentSpin {\n to { transform: rotate(360deg); }\n}\n", document.head.appendChild(e);
|
|
575
575
|
}
|
|
576
|
-
let
|
|
576
|
+
let S = {
|
|
577
577
|
flex: 1,
|
|
578
578
|
overflow: "auto",
|
|
579
579
|
padding: "16px 14px 8px",
|
|
580
580
|
display: "flex",
|
|
581
581
|
flexDirection: "column",
|
|
582
582
|
gap: "10px"
|
|
583
|
-
},
|
|
583
|
+
}, C = {
|
|
584
584
|
messageGroup: {
|
|
585
585
|
display: "flex",
|
|
586
586
|
flexDirection: "column",
|
|
@@ -644,17 +644,15 @@ var I = ["aria-expanded"], L = {
|
|
|
644
644
|
};
|
|
645
645
|
return (n, s) => (m(), a("div", {
|
|
646
646
|
class: u(["ep-agent-chat-log", t.className]),
|
|
647
|
-
style:
|
|
648
|
-
ref_key: "rootEl",
|
|
649
|
-
ref: c,
|
|
647
|
+
style: S,
|
|
650
648
|
role: "log",
|
|
651
649
|
"aria-live": "polite",
|
|
652
650
|
"aria-atomic": "false"
|
|
653
651
|
}, [
|
|
654
|
-
|
|
652
|
+
f.value ? _(n.$slots, "empty", { key: 0 }) : i("", !0),
|
|
655
653
|
(m(!0), a(e, null, g(t.messages, (e) => (m(), a("div", {
|
|
656
654
|
key: e.id,
|
|
657
|
-
style: d(
|
|
655
|
+
style: d(C.messageGroup),
|
|
658
656
|
"data-role": e.role
|
|
659
657
|
}, [e.role === "assistant" && e.toolCalls && e.toolCalls.length > 0 ? (m(), r(R, {
|
|
660
658
|
key: 0,
|
|
@@ -675,34 +673,34 @@ var I = ["aria-expanded"], L = {
|
|
|
675
673
|
"earlier-label"
|
|
676
674
|
])) : i("", !0), e.text.length > 0 ? (m(), a("div", {
|
|
677
675
|
key: 1,
|
|
678
|
-
style: d(e.role === "user" ?
|
|
676
|
+
style: d(e.role === "user" ? C.userBubble : C.assistantBubble)
|
|
679
677
|
}, v(e.text), 5)) : i("", !0)], 12, ne))), 128)),
|
|
680
678
|
t.loading ? (m(), a("div", {
|
|
681
679
|
key: 1,
|
|
682
|
-
style: d(
|
|
680
|
+
style: d(C.thinkingBubble),
|
|
683
681
|
"aria-label": t.thinkingLabel
|
|
684
682
|
}, [
|
|
685
683
|
o("span", { style: d({
|
|
686
|
-
...
|
|
684
|
+
...C.dot,
|
|
687
685
|
animationDelay: "0s"
|
|
688
686
|
}) }, null, 4),
|
|
689
687
|
o("span", { style: d({
|
|
690
|
-
...
|
|
688
|
+
...C.dot,
|
|
691
689
|
animationDelay: "0.15s"
|
|
692
690
|
}) }, null, 4),
|
|
693
691
|
o("span", { style: d({
|
|
694
|
-
...
|
|
692
|
+
...C.dot,
|
|
695
693
|
animationDelay: "0.3s"
|
|
696
694
|
}) }, null, 4)
|
|
697
695
|
], 12, re)) : i("", !0),
|
|
698
696
|
t.error ? (m(), a("div", {
|
|
699
697
|
key: 2,
|
|
700
|
-
style: d(
|
|
698
|
+
style: d(C.errorBubble),
|
|
701
699
|
role: "alert"
|
|
702
700
|
}, v(t.error), 5)) : i("", !0),
|
|
703
701
|
o("div", {
|
|
704
702
|
ref_key: "endEl",
|
|
705
|
-
ref:
|
|
703
|
+
ref: c
|
|
706
704
|
}, null, 512)
|
|
707
705
|
], 2));
|
|
708
706
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eigenpal/docx-editor-agents",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Agent SDK and chat UI for the DOCX editor — framework-agnostic bridge, MCP server, AI SDK adapters, plus React UI (and Vue UI in 1.x)",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"*.css"
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"vite": "^8.0.10",
|
|
111
111
|
"vite-plugin-dts": "^5.0.0",
|
|
112
112
|
"vue": "^3.4.0",
|
|
113
|
-
"vue-tsc": "^
|
|
113
|
+
"vue-tsc": "^3.3.0"
|
|
114
114
|
},
|
|
115
115
|
"files": [
|
|
116
116
|
"dist",
|