@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
package/dist/vue.js
CHANGED
|
@@ -6,15 +6,15 @@ 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 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`},fe={key:1,class:`ai-preview__result`},pe={key:3,class:`ai-preview__footer`},me=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`,fe,(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`,pe,[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`]]),N=[`single`,`words`,`double`,`thick`,`dotted`,`dottedHeavy`,`dash`,`dashedHeavy`,`dashLong`,`dashLongHeavy`,`dotDash`,`dashDotHeavy`,`dotDotDash`,`dashDotDotHeavy`,`wave`,`wavyHeavy`,`wavyDouble`,`none`],P=[`black`,`blue`,`cyan`,`darkBlue`,`darkCyan`,`darkGray`,`darkGreen`,`darkMagenta`,`darkRed`,`darkYellow`,`green`,`lightGray`,`magenta`,`red`,`white`,`yellow`,`none`],F=[{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`],ee=(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)]))}}),A=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},j=A(ee,[[`__scopeId`,`data-v-c30da7a7`]]),te=[`aria-label`],ne={class:`ai-preview__header`},re={class:`ai-preview__title`},ie=[`aria-label`],ae={key:0,class:`ai-preview__loading`},oe={key:1,class:`ai-preview__error`},se={key:2,class:`ai-preview__content`},ce={key:0,class:`ai-preview__diff`},le={class:`ai-preview__diff-label`},ue={class:`ai-preview__diff-text ai-preview__diff-text--old`},de={class:`ai-preview__diff-label`},fe={class:`ai-preview__diff-text ai-preview__diff-text--new`},pe={key:1,class:`ai-preview__result`},me={key:3,class:`ai-preview__footer`},he=A((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`,ne,[(0,e.createElementVNode)(`span`,re,(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,ie)]),t.isLoading?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,ae,[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`,oe,[(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`,se,[t.showDiff?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,ce,[(0,e.createElementVNode)(`div`,le,(0,e.toDisplayString)(c.value.original),1),(0,e.createElementVNode)(`div`,ue,(0,e.toDisplayString)(t.originalText),1),(0,e.createElementVNode)(`div`,de,(0,e.toDisplayString)(c.value.suggested),1),(0,e.createElementVNode)(`div`,fe,(0,e.toDisplayString)(t.responseText),1)])):((0,e.openBlock)(),(0,e.createElementBlock)(`div`,pe,(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`,me,[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,te)):(0,e.createCommentVNode)(``,!0)}}),[[`__scopeId`,`data-v-1226b741`]]),M=[`single`,`words`,`double`,`thick`,`dotted`,`dottedHeavy`,`dash`,`dashedHeavy`,`dashLong`,`dashLongHeavy`,`dotDash`,`dashDotHeavy`,`dotDotDash`,`dashDotDotHeavy`,`wave`,`wavyHeavy`,`wavyDouble`,`none`],N=[`black`,`blue`,`cyan`,`darkBlue`,`darkCyan`,`darkGray`,`darkGreen`,`darkMagenta`,`darkRed`,`darkYellow`,`green`,`lightGray`,`magenta`,`red`,`white`,`yellow`,`none`],P={name:`apply_formatting`,displayName:`Applying formatting`,description:'Apply character formatting (bold, italic, underline, strike, color, highlight, font size, font family) to a paragraph or to a unique phrase within it. Pass `search` to scope the change to part of the paragraph; omit it to format the whole paragraph. Direct edit — does not create a tracked change. Pass `false` to clear a mark; omit a key to leave it untouched. Color uses `{rgb: "FF0000"}` (no hash) or `{themeColor: "accent1"}`. Font size is in points. Font family takes `{ascii, hAnsi}`.',inputSchema:{type:`object`,properties:{paraId:{type:`string`,description:`Paragraph id from read_document / find_text.`},search:{type:`string`,description:`Optional: format only this exact phrase within the paragraph (must be unique).`},marks:{type:`object`,description:`Marks to set or clear. Omit a key to leave it untouched.`,properties:{bold:{type:`boolean`},italic:{type:`boolean`},underline:{description:`true → single underline; false → clear; or { style: "single"|"double"|"thick"|"dotted"|"dottedHeavy"|"dash"|"dashedHeavy"|"dashLong"|"dashLongHeavy"|"dotDash"|"dashDotHeavy"|"dotDotDash"|"dashDotDotHeavy"|"wave"|"wavyHeavy"|"wavyDouble"|"words"|"none" }. Other values are rejected.`},strike:{type:`boolean`},color:{type:`object`,description:`Either {rgb: "RRGGBB"} (no hash) or {themeColor: "accent1"|"text1"|...}.`,properties:{rgb:{type:`string`},themeColor:{type:`string`}}},highlight:{type:`string`,enum:[...N],description:`Highlight color — must be one of the Word-supported names: `+N.join(`, `)+`. Pass "none" to clear. Hex values are rejected (Word does not accept hex for <w:highlight>).`},fontSize:{type:`number`,description:`Size in points (e.g. 12, 14, 24).`},fontFamily:{type:`object`,properties:{ascii:{type:`string`},hAnsi:{type:`string`}}}}}},required:[`paraId`,`marks`]},handler:(e,t)=>{if(!e.marks||Object.keys(e.marks).length===0)return{success:!1,error:`No marks provided. Specify at least one of bold/italic/etc.`};let n=typeof e.marks.underline==`object`&&e.marks.underline!==null?e.marks.underline.style:void 0;if(n&&!M.includes(n))return{success:!1,error:`Invalid underline.style "${n}". Must be one of: ${M.join(`, `)}.`};let r=typeof e.marks.highlight==`string`?e.marks.highlight:void 0;if(r&&!N.includes(r))return{success:!1,error:`Invalid highlight "${r}". Must be one of: ${N.join(`, `)}. Hex values are not supported by Word's highlight attribute.`};let i=r===`none`?{...e.marks,highlight:``}:e.marks;return t.applyFormatting({paraId:e.paraId,search:e.search,marks:i})?{success:!0,data:`Formatting applied to ${e.search?`"${e.search}" in ${e.paraId}`:e.paraId}.`}:{success:!1,error:"Could not apply formatting. The paraId may not exist, or `search` is missing / ambiguous."}}},F={name:`set_paragraph_style`,displayName:`Setting paragraph style`,description:`Apply a paragraph style by id (e.g. "Heading1", "Heading2", "Title", "Quote", "Normal"). The styleId must exist in the document's style definitions — unknown ids are no-ops. Direct edit, not a tracked change.`,inputSchema:{type:`object`,properties:{paraId:{type:`string`,description:`Paragraph id from read_document / find_text.`},styleId:{type:`string`,description:`Style id (e.g. "Heading1", "Title", "Quote", "Normal").`}},required:[`paraId`,`styleId`]},handler:(e,t)=>t.setParagraphStyle({paraId:e.paraId,styleId:e.styleId})?{success:!0,data:`Style "${e.styleId}" applied to ${e.paraId}.`}:{success:!1,error:`Could not set style. paraId "${e.paraId}" not found, or styleId "${e.styleId}" is not defined.`}},I=[`page`,`sectionNextPage`,`sectionContinuous`],L={page:`Page break`,sectionNextPage:`Section break (next page)`,sectionContinuous:`Section break (continuous)`},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(`
|
|
13
13
|
`):``)).join(`
|
|
14
14
|
`)}}},{name:`read_changes`,displayName:`Reading changes`,description:`List tracked changes (insertions / deletions) currently in the document.`,inputSchema:{type:`object`,properties:{}},handler:(e,t)=>{let n=t.getChanges();return n.length===0?{success:!0,data:`No tracked changes.`}:{success:!0,data:n.map(e=>`[Change #${e.id}] ${e.type} by ${e.author}: "${e.text}"`).join(`
|
|
15
|
-
`)}}},{name:`add_comment`,displayName:`Adding comment`,description:`Attach a comment to a paragraph, optionally anchored to a unique phrase within it. The user sees it instantly in the comments sidebar.`,inputSchema:{type:`object`,properties:{paraId:{type:`string`,description:`Paragraph id from read_document / find_text.`},text:{type:`string`,description:`Comment body.`},search:{type:`string`,description:`Optional: anchor to this exact phrase within the paragraph. Must be unique.`}},required:[`paraId`,`text`]},handler:(e,t)=>{let n=t.addComment({paraId:e.paraId,text:e.text,search:e.search});return n===null?{success:!1,error:"Could not add comment. The paraId may not exist, or `search` is missing / ambiguous."}:{success:!0,data:`Comment ${n} added on ${e.paraId}.`}}},{name:`suggest_change`,displayName:`Suggesting change`,description:"Suggest a tracked change. Three modes: (1) replacement — `search` non-empty, `replaceWith` non-empty; (2) deletion — `search` non-empty, `replaceWith` empty; (3) insertion at paragraph end — `search` empty, `replaceWith` non-empty. The user can accept or reject in the editor UI.",inputSchema:{type:`object`,properties:{paraId:{type:`string`,description:`Paragraph id from read_document / find_text.`},search:{type:`string`,description:`Phrase to find (must be unique). Empty string = insert at paragraph end.`},replaceWith:{type:`string`,description:`Replacement text. Empty string = delete the matched phrase.`}},required:[`paraId`,`search`,`replaceWith`]},handler:(e,t)=>t.proposeChange({paraId:e.paraId,search:e.search,replaceWith:e.replaceWith})?e.search?e.replaceWith?{success:!0,data:`Replacement proposed: "${e.search}" → "${e.replaceWith}" on ${e.paraId}.`}:{success:!0,data:`Deletion proposed: "${e.search}" on ${e.paraId}.`}:{success:!0,data:`Insertion proposed on ${e.paraId}.`}:{success:!1,error:`Could not propose change. Possible causes: paraId not found; search missing or ambiguous; or the target overlaps an existing tracked change.`}},{name:`
|
|
16
|
-
`)),o.push(a)}i.push(e),a.push(o)}return{type:`table`,index:t,rows:i,cellParaIds:a}}function
|
|
15
|
+
`)}}},{name:`add_comment`,displayName:`Adding comment`,description:`Attach a comment to a paragraph, optionally anchored to a unique phrase within it. The user sees it instantly in the comments sidebar.`,inputSchema:{type:`object`,properties:{paraId:{type:`string`,description:`Paragraph id from read_document / find_text.`},text:{type:`string`,description:`Comment body.`},search:{type:`string`,description:`Optional: anchor to this exact phrase within the paragraph. Must be unique.`}},required:[`paraId`,`text`]},handler:(e,t)=>{let n=t.addComment({paraId:e.paraId,text:e.text,search:e.search});return n===null?{success:!1,error:"Could not add comment. The paraId may not exist, or `search` is missing / ambiguous."}:{success:!0,data:`Comment ${n} added on ${e.paraId}.`}}},{name:`suggest_change`,displayName:`Suggesting change`,description:"Suggest a tracked change. Three modes: (1) replacement — `search` non-empty, `replaceWith` non-empty; (2) deletion — `search` non-empty, `replaceWith` empty; (3) insertion at paragraph end — `search` empty, `replaceWith` non-empty. The user can accept or reject in the editor UI.",inputSchema:{type:`object`,properties:{paraId:{type:`string`,description:`Paragraph id from read_document / find_text.`},search:{type:`string`,description:`Phrase to find (must be unique). Empty string = insert at paragraph end.`},replaceWith:{type:`string`,description:`Replacement text. Empty string = delete the matched phrase.`}},required:[`paraId`,`search`,`replaceWith`]},handler:(e,t)=>t.proposeChange({paraId:e.paraId,search:e.search,replaceWith:e.replaceWith})?e.search?e.replaceWith?{success:!0,data:`Replacement proposed: "${e.search}" → "${e.replaceWith}" on ${e.paraId}.`}:{success:!0,data:`Deletion proposed: "${e.search}" on ${e.paraId}.`}:{success:!0,data:`Insertion proposed on ${e.paraId}.`}:{success:!1,error:`Could not propose change. Possible causes: paraId not found; search missing or ambiguous; or the target overlaps an existing tracked change.`}},P,F,{name:`insert_break`,displayName:`Inserting break`,description:'Insert a break after a paragraph (located by paraId). `type: "page"` adds a page break so following content starts on a new page. `type: "sectionNextPage"` starts a new document section on a new page. `type: "sectionContinuous"` starts a new section on the same page (use this to change column layout or margins from that point onward). The target paragraph becomes the end of its page/section and the next paragraph begins the new one. Direct edit — not a tracked change.',inputSchema:{type:`object`,properties:{paraId:{type:`string`,description:`Paragraph id from read_document / find_text. The break is inserted after this paragraph.`},type:{type:`string`,enum:[...I],description:`Break kind: "page" (page break), "sectionNextPage" (new section, new page), or "sectionContinuous" (new section, same page).`}},required:[`paraId`,`type`]},handler:(e,t)=>I.includes(e.type)?t.insertBreak({paraId:e.paraId,type:e.type})?{success:!0,data:`${L[e.type]} inserted after ${e.paraId}.`}:{success:!1,error:`Could not insert break. paraId "${e.paraId}" not found.`}:{success:!1,error:`Invalid break type "${e.type}". Must be one of: ${I.join(`, `)}.`}},{name:`reply_comment`,displayName:`Replying to comment`,description:`Reply to an existing comment by id. Threaded under the original.`,inputSchema:{type:`object`,properties:{commentId:{type:`number`,description:`Comment id from read_comments.`},text:{type:`string`,description:`Reply body.`}},required:[`commentId`,`text`]},handler:(e,t)=>{let n=t.replyTo(e.commentId,{text:e.text});return n===null?{success:!1,error:`Comment #${e.commentId} not found.`}:{success:!0,data:`Reply ${n} added to comment ${e.commentId}.`}}},{name:`resolve_comment`,displayName:`Resolving comment`,description:`Mark a comment as resolved (done).`,inputSchema:{type:`object`,properties:{commentId:{type:`number`,description:`Comment id from read_comments.`}},required:[`commentId`]},handler:(e,t)=>(t.resolveComment(e.commentId),{success:!0,data:`Comment ${e.commentId} resolved.`})},{name:`scroll`,displayName:`Scrolling`,description:`Scroll the editor to a paragraph by paraId. Does not move the user's cursor.`,inputSchema:{type:`object`,properties:{paraId:{type:`string`,description:`Paragraph id from read_document / find_text.`}},required:[`paraId`]},handler:(e,t)=>t.scrollTo(e.paraId)?{success:!0,data:`Scrolled to ${e.paraId}.`}:{success:!1,error:`paraId ${e.paraId} not found.`}}];function ge(e,t,n){let r=R.find(t=>t.name===e);if(!r)return{success:!1,error:`Unknown tool: ${e}`};try{return r.handler(t,n)}catch(e){return{success:!1,error:e instanceof Error?e.message:String(e)}}}function _e(e){let t=R.find(t=>t.name===e);if(t?.displayName)return t.displayName;let n=e.replace(/_/g,` `);return n.charAt(0).toUpperCase()+n.slice(1)}function ve(){return R.map(e=>({type:`function`,function:{name:e.name,description:e.description,parameters:e.inputSchema}}))}function z(e){return e.type===`insertion`||e.type===`deletion`||e.type===`moveFrom`||e.type===`moveTo`}function B(e){let n=[];for(let r of e)r.type===`run`?n.push((0,t.getRunText)(r)):r.type===`hyperlink`&&n.push((0,t.getHyperlinkText)(r));return n.join(``)}function V(e,t,n){let r=0;for(let i of e)if(i.type===`paragraph`){if(n(i,r)===!1)return;r++}else if(i.type===`table`){for(let e of i.rows)for(let t of e.cells)for(let e of t.content)if(e.type===`paragraph`){if(n(e,r)===!1)return;r++}}else t&&r++}function H(e,t){V(e.content,!0,t)}function U(e,t){V(e.content,!1,t)}function W(e,t={}){let{fromIndex:n,toIndex:r,includeTrackedChanges:i=!0,includeCommentAnchors:a=!0}=t,o=[],s=0;for(let t of e.content)if(t.type===`paragraph`)G(s,n,r)&&o.push(ye(t,s,i,a)),s++;else if(t.type===`table`){G(s,n,r)&&o.push(be(t,s,i,a));for(let e of t.rows)for(let t of e.cells)for(let e of t.content)e.type===`paragraph`&&s++}else s++;return o}function G(e,t,n){return(t===void 0||e>=t)&&(n===void 0||e<=n)}function ye(e,n,r,i){let a=K(e,r,i),o=e.formatting?.styleId,s=e.paraId;return(0,t.isHeadingStyle)(o)?{type:`heading`,index:n,paraId:s,level:(0,t.parseHeadingLevel)(o)??1,text:a}:e.listRendering?{type:`list-item`,index:n,paraId:s,text:a,listLevel:e.listRendering.level??0,listType:e.listRendering.isBullet?`bullet`:`number`}:{type:`paragraph`,index:n,paraId:s,text:a}}function be(e,t,n,r){let i=[],a=[];for(let t of e.rows){let e=[],o=[];for(let i of t.cells){let t=[],a;for(let e of i.content)e.type===`paragraph`&&(a===void 0&&(a=e.paraId),t.push(K(e,n,r)));e.push(t.join(`
|
|
16
|
+
`)),o.push(a)}i.push(e),a.push(o)}return{type:`table`,index:t,rows:i,cellParaIds:a}}function xe(e){let t=[],n=e=>e.paraId?e.paraId:String(e.index);for(let r of e)switch(r.type){case`heading`:t.push(`[${n(r)}] (h${r.level}) ${r.text}`);break;case`paragraph`:t.push(`[${n(r)}] ${r.text}`);break;case`list-item`:{let e=` `.repeat(r.listLevel),i=r.listType===`bullet`?`•`:`-`;t.push(`[${n(r)}] ${e}${i} ${r.text}`);break}case`table`:{let e=r.index;for(let n=0;n<r.rows.length;n++)for(let i=0;i<r.rows[n].length;i++){let a=r.rows[n][i].split(`
|
|
17
17
|
`),o=r.cellParaIds?.[n]?.[i];for(let r=0;r<a.length;r++){let s=r===0&&o?o:String(e);t.push(`[${s}] (table, row ${n+1}, col ${i+1}) ${a[r]}`),e++}}break}}return t.join(`
|
|
18
|
-
`)}function K(e,n,r){let i=[],a=new Set;for(let o of e.content){if(o.type===`commentRangeStart`&&r){a.add(o.id),i.push(`[comment:${o.id}]`);continue}if(o.type===`commentRangeEnd`&&r){a.has(o.id)&&(a.delete(o.id),i.push(`[/comment]`));continue}if(o.type===`run`)i.push((0,t.getRunText)(o));else if(o.type===`hyperlink`)i.push((0,t.getHyperlinkText)(o));else if(z(o)){let e=B(o.content);o.type===`insertion`||o.type===`moveTo`?n&&i.push(`[+${e}+]{by:${o.info.author}}`):n?i.push(`[-${e}-]{by:${o.info.author}}`):i.push(e)}}return i.join(``)}function
|
|
19
|
-
`)}function
|
|
20
|
-
`)}function
|
|
18
|
+
`)}function K(e,n,r){let i=[],a=new Set;for(let o of e.content){if(o.type===`commentRangeStart`&&r){a.add(o.id),i.push(`[comment:${o.id}]`);continue}if(o.type===`commentRangeEnd`&&r){a.has(o.id)&&(a.delete(o.id),i.push(`[/comment]`));continue}if(o.type===`run`)i.push((0,t.getRunText)(o));else if(o.type===`hyperlink`)i.push((0,t.getHyperlinkText)(o));else if(z(o)){let e=B(o.content);o.type===`insertion`||o.type===`moveTo`?n&&i.push(`[+${e}+]{by:${o.info.author}}`):n?i.push(`[-${e}-]{by:${o.info.author}}`):i.push(e)}}return i.join(``)}function Se(e){let n=[],r=0;for(let i=0;i<e.content.length;i++){let a=e.content[i];if(a.type===`run`){let e=(0,t.getRunText)(a);n.push({contentIndex:i,run:a,text:e,startPos:r}),r+=e.length}else if(a.type===`hyperlink`)for(let e=0;e<a.children.length;e++){let o=a.children[e];if(o.type===`run`){let e=(0,t.getRunText)(o);n.push({contentIndex:i,run:o,text:e,startPos:r}),r+=e.length}}else if(z(a)){if(a.type===`insertion`||a.type===`moveTo`)continue;for(let e=0;e<a.content.length;e++){let o=a.content[e];if(o.type===`run`){let e=(0,t.getRunText)(o);n.push({contentIndex:i,run:o,text:e,startPos:r}),r+=e.length}else if(o.type===`hyperlink`){for(let e of o.children)if(e.type===`run`){let a=(0,t.getRunText)(e);n.push({contentIndex:i,run:e,text:a,startPos:r}),r+=a.length}}}}}return n}function q(e){return Se(e).map(e=>e.text).join(``)}function J(e,t,n){let r=new Map,i=(e,t,n)=>{let i=null;for(let a of e.content)if(z(a)){i===null&&(i=q(e));let o=B(a.content),s=a.info.id,c=`${n.noteType??`body`}:${n.noteId??``}:${s}`,l=r.get(c);l&&l.paragraphIndex===t?l.text+=o:r.set(c,{id:s,type:a.type,author:a.info.author,date:a.info.date??null,text:o,context:i,paragraphIndex:t,...n.noteId===void 0?{}:{noteId:n.noteId},...n.noteType===void 0?{}:{noteType:n.noteType}})}};if(H(e,(e,t)=>i(e,t,{})),t?.includeFootnotes&&n?.footnotes)for(let e of n.footnotes)U(e,(t,n)=>i(t,n,{noteId:e.id,noteType:`footnote`}));if(t?.includeEndnotes&&n?.endnotes)for(let e of n.endnotes)U(e,(t,n)=>i(t,n,{noteId:e.id,noteType:`endnote`}));return Array.from(r.values()).filter(e=>!(t?.author&&e.author!==t.author||t?.type&&e.type!==t.type))}function Y(e,t){let n=e.comments??[];if(n.length===0)return[];let r=Ce(e),i=[],a=new Map;for(let e of n)if(e.parentId!==void 0){let t=a.get(e.parentId)??[];t.push(e),a.set(e.parentId,t)}else i.push(e);return i.map(e=>{let t=r.get(e.id),n=(a.get(e.id)??[]).map(e=>({id:e.id,author:e.author,date:e.date??null,text:X(e)}));return{id:e.id,author:e.author,date:e.date??null,text:X(e),anchoredText:t?.text??``,paragraphIndex:t?.paragraphIndex??-1,replies:n,done:e.done??!1}}).filter(e=>!(t?.author&&e.author!==t.author||t?.done!==void 0&&e.done!==t.done))}function X(e){return e.content.map(e=>q(e)).join(`
|
|
19
|
+
`)}function Ce(e){let n=new Map,r=new Map;return H(e,(e,i)=>{for(let a of e.content)if(a.type===`commentRangeStart`)r.set(a.id,{paragraphIndex:i,parts:[]});else if(a.type===`commentRangeEnd`){let e=r.get(a.id);e&&(n.set(a.id,{text:e.parts.join(``),paragraphIndex:e.paragraphIndex}),r.delete(a.id))}else if(a.type===`run`){let e=(0,t.getRunText)(a);for(let t of r.values())t.parts.push(e)}else if(a.type===`hyperlink`){let e=a.children.filter(e=>e.type===`run`).map(t.getRunText).join(``);for(let t of r.values())t.parts.push(e)}else if(z(a)){if(a.type===`insertion`||a.type===`moveTo`)continue;let e=B(a.content);for(let t of r.values())t.parts.push(e)}}),n}function Z(e){return!e||e.length===0?``:e.map(e=>{let t=e;return t?.content?t.content.map(e=>e.content?.map(e=>e.text||``).join(``)||``).join(``):``}).join(`
|
|
20
|
+
`)}function Q(e){let t=e.getEditorRef();if(t){let e=t.getDocument();if(e?.package?.document)return e.package.document}return e.getDocument()?.package?.document??null}function $(e,t=`AI`){function n(e){return e??t}return{getContentAsText(t){let n=Q(e);return n?xe(W(n,t)):``},getContent(t){let n=Q(e);return n?W(n,t):[]},getComments(t){let n=Q(e);if(!n)return[];let r=Y(n,t);if(r.length>0)return r;let i=e.getComments();if(i.length===0)return[];let a=new Map,o=[];for(let e of i)if(e.parentId){let t=a.get(e.parentId);t?t.push(e):a.set(e.parentId,[e])}else o.push(e);let s=[];for(let e of o){if(t?.author&&e.author!==t.author||t?.done!==void 0&&(e.done??!1)!==t.done)continue;let n=a.get(e.id)??[];s.push({id:e.id,author:e.author,date:e.date??null,text:Z(e.content),anchoredText:``,paragraphIndex:-1,replies:n.map(e=>({id:e.id,author:e.author,date:e.date??null,text:Z(e.content)})),done:e.done??!1})}return s},getChanges(t){let n=Q(e);return n?J(n,t):[]},findText(t,n){return e.findInDocument(t,n)},getSelection(){return e.getSelectionInfo()},addComment(t){return e.addComment({paraId:t.paraId,text:t.text,author:n(t.author),search:t.search})},replyTo(t,r){return e.replyToComment(t,r.text,n(r.author))},resolveComment(t){e.resolveComment(t)},proposeChange(t){return e.proposeChange({paraId:t.paraId,search:t.search,replaceWith:t.replaceWith,author:n(t.author)})},applyFormatting(t){return e.applyFormatting({paraId:t.paraId,search:t.search,marks:t.marks})},setParagraphStyle(t){return e.setParagraphStyle({paraId:t.paraId,styleId:t.styleId})},insertBreak(t){return e.insertBreak({paraId:t.paraId,type:t.type})},getPage(t){return e.getPageContent(t)},getPages(t){let n=e.getTotalPages(),r=Math.max(1,Math.min(t.from,n)),i=Math.max(r,Math.min(t.to,n)),a=[];for(let t=r;t<=i;t++){let n=e.getPageContent(t);n&&a.push(n)}return a},getTotalPages(){return e.getTotalPages()},getCurrentPage(){return e.getCurrentPage()},scrollTo(t){return e.scrollToParaId(t)},onContentChange(t){return e.onContentChange(()=>{let n=Q(e),r=n?Y(n):[],i=n?J(n):[];try{t({commentCount:r.length,changeCount:i.length,comments:r,changes:i})}catch(e){console.error(`onContentChange listener threw:`,e)}})},onSelectionChange(t){return e.onSelectionChange(()=>{try{t(e.getSelectionInfo())}catch(e){console.error(`onSelectionChange listener threw:`,e)}})}}}var we=ve();function Te(t){let{editorRef:n,author:r=`AI`}=t,i=(0,e.computed)(()=>n.value?$(n.value,(0,e.unref)(r)):null);function a(e,t){let n=i.value;return n?ge(e,t,n):{success:!1,error:`Editor not ready`}}return{executeToolCall:a,toolSchemas:we}}exports.AIContextMenu=j,exports.AIResponsePreview=he,exports.AgentChatLog=_,exports.AgentComposer=b,exports.AgentPanel=s,exports.AgentSuggestionChip=S,exports.AgentTimeline=p,exports.getToolDisplayName=_e,exports.useAgentBridge=Te;
|