@shawnstack/quickforge 1.7.12 → 1.8.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/README.md +1 -1
- package/dist/assets/AgentProfilesPage-lKGIE5Dj.js +1 -0
- package/dist/assets/ChatPanelHost-CWUYIkXG.js +11 -0
- package/dist/assets/CloudAccountSettingsPage-BhXH0ups.js +1 -0
- package/dist/assets/{PluginsPage-BIbIDfWY.js → PluginsPage-DHWF13mN.js} +1 -1
- package/dist/assets/{ScheduledTasksPage-BOqmBNCx.js → ScheduledTasksPage-DLAg-i8c.js} +2 -2
- package/dist/assets/{SettingsWorkspacePage-BCRtycRN.js → SettingsWorkspacePage-BhUzL5oi.js} +128 -128
- package/dist/assets/ShareLinksSettingsPage-DogGa3lH.js +1 -0
- package/dist/assets/SharedConversationPage-7QpeaG_P.js +1 -0
- package/dist/assets/{TerminalDock-Cqz_9mTC.js → TerminalDock-CWSKcuiU.js} +2 -2
- package/dist/assets/WorkspaceInspector-CEfyYqWy.js +36 -0
- package/dist/assets/{index-BWf6y3Kh.css → index-CX36XjVA.css} +1 -1
- package/dist/assets/index-CgVTwN15.js +66 -0
- package/dist/assets/local-tools-CJVNO1aW.js +388 -0
- package/dist/assets/{mcp-servers-dialog-7Xwu2RVW.js → mcp-servers-dialog-xf3UR49J.js} +2 -2
- package/dist/assets/{skills-dialog-C_JvWbAa.js → skills-dialog-Bbqtuy2h.js} +1 -1
- package/dist/index.html +4 -4
- package/dist/licenses/material-icon-theme.txt +8 -8
- package/package.json +1 -1
- package/server/agent-manager.mjs +175 -47
- package/server/context-references.mjs +139 -0
- package/server/custom-commands.mjs +43 -0
- package/server/index.mjs +1 -1
- package/server/project-config.mjs +17 -5
- package/server/routes/agent-profiles.mjs +16 -1
- package/server/routes/agent.mjs +1 -1
- package/server/routes/shared-conversation.mjs +13 -1
- package/server/routes/skills.mjs +22 -0
- package/server/routes/workspace.mjs +166 -2
- package/server/selected-capabilities.mjs +76 -0
- package/server/skills.mjs +1 -1
- package/server/system-prompt.mjs +1 -3
- package/server/tools/definitions.mjs +0 -10
- package/server/utils/workspace.mjs +13 -4
- package/skills/skill-creator/SKILL.md +485 -485
- package/skills/skill-creator/agents/analyzer.md +274 -274
- package/skills/skill-creator/agents/comparator.md +202 -202
- package/skills/skill-creator/agents/grader.md +223 -223
- package/skills/skill-creator/assets/eval_review.html +146 -146
- package/skills/skill-creator/eval-viewer/viewer.html +1325 -1325
- package/skills/skill-creator/references/schemas.md +430 -430
- package/dist/assets/AgentProfilesPage-CApCpsDd.js +0 -1
- package/dist/assets/ChatPanelHost-COTO7swS.js +0 -48
- package/dist/assets/CloudAccountSettingsPage-Be5r3dtv.js +0 -1
- package/dist/assets/ShareLinksSettingsPage-BrxQacJn.js +0 -1
- package/dist/assets/SharedConversationPage-DJa0M0El.js +0 -1
- package/dist/assets/WorkspaceInspector-C-GOK81D.js +0 -36
- package/dist/assets/index-D3GWkXJR.js +0 -66
- package/dist/assets/local-tools-DY0yEU3T.js +0 -350
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-CwXTzYjs.js","assets/pi-ai-Cr2ee4a0.js","assets/rolldown-runtime-DWdDZTNf.js","assets/chunk-HOUHSVGY-C9QO8omv.js","assets/src-PYsDme0X.js","assets/chunk-Y2CYZVJY-D6N-CrJv.js","assets/chunk-WYO6CB5R-C0azl-fk.js","assets/chunk-ICXQ74PX-ClbGPgLV.js","assets/dist-CLg13NtV.js","assets/chunk-52WLFC77-CYq4hT4f.js","assets/line-SbxJR8ZT.js","assets/path-6uRLdFF7.js","assets/array-B9UHiPd-.js","assets/chunk-7BUUIJ7U-CCcsI9XE.js","assets/chunk-C7G6YPKG-KFaGpP_Z.js","assets/chunk-OGEWGWER-DczhQmcx.js","assets/chunk-Q4XR5HBZ-CiF6T--X.js","assets/pi-web-ui-BNuvqKDT.js","assets/lit-vendor-CinchGmI.js","assets/chunk-ZGVPDNZ5-D_8F4Akx.js","assets/rough.esm-Bud4g4fh.js","assets/chunk-FWX5IMBZ-BxRjZkOP.js","assets/chunk-VAUOI2AC-D3J5bw1P.js","assets/chunk-ZIRB5QZD-Dc1s5bLM.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Bt as t,Jt as n,u as r,zt as i}from"./icons-DM_qJ7VJ.js";import{t as a}from"./react-vendor-BpWW_Nvp.js";import{f as o,l as s,u as c}from"./lit-vendor-CinchGmI.js";import{y as l}from"./pi-web-ui-BNuvqKDT.js";import{J as u}from"./pi-ai-Cr2ee4a0.js";import{$t as d,Dt as f,Mt as p,Nt as m,Ot as h,Pt as g,Qt as _,Un as v,Xt as y,Yt as b,Zt as x,an as S,cn as C,d as w,dn as T,en as E,fn as D,in as O,jt as k,kt as A,ln as ee,nn as te,on as j,pn as M,r as ne,rn as re,sn as N,st as ie,tn as ae,un as P}from"./index-CgVTwN15.js";import{t as oe}from"./plugin-api-BrdQeM4B.js";function F(e){return!!(e&&typeof e==`object`&&!Array.isArray(e))}function se(e,t,n){if(!e||e.isError||t||!F(e.details))return``;let r=e.details.action,i=e.details.status,a=e.details.markdown;if(typeof a!=`string`)return``;if(r===`read`){if(a)return a;if(i===`empty`||i===void 0)return n(`memoryContentEmpty`)}return r===`write`&&(i===`saved`||i===void 0)?n(`memoryContentSaved`):``}var ce=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}\.(?:png|jpg|webp|gif)$/i,le=new Set([`image/png`,`image/jpeg`,`image/webp`,`image/gif`]);function ue(e){return!!(e&&typeof e==`object`&&!Array.isArray(e))}function de(e){if(!ue(e)||e.type!==`generated_image_result`||typeof e.sessionId!=`string`||!e.sessionId||typeof e.prompt!=`string`||typeof e.model!=`string`||!Array.isArray(e.assets))return null;let t=e.assets.flatMap(e=>!ue(e)||typeof e.assetId!=`string`||!ce.test(e.assetId)||typeof e.mimeType!=`string`||!le.has(e.mimeType)||typeof e.size!=`number`||!Number.isFinite(e.size)||e.size<0?[]:[{assetId:e.assetId,mimeType:e.mimeType,size:e.size}]);return t.length?{type:`generated_image_result`,sessionId:e.sessionId,prompt:e.prompt,model:e.model,assets:t,...typeof e.text==`string`&&e.text?{text:e.text}:{}}:null}function fe(e,t,n=window.location.pathname){let r=n.match(/^\/share\/([^/]+)\/?$/)?.[1];return r?`/api/shared/${encodeURIComponent(decodeURIComponent(r))}/assets/${encodeURIComponent(t.assetId)}`:`/api/session-assets/${encodeURIComponent(e.sessionId)}/${encodeURIComponent(t.assetId)}`}var pe=1e3,me=1e3,he=`cubic-bezier(.22, 1, .36, 1)`,ge=class{runtimes;current;roll;generation=0;text=``;running=!1;host;env;constructor(e,t){this.host=e,this.env=t,this.runtimes=e.views.map(e=>({view:e})),this.current=this.runtimes[0],this.runtimes[1].view.el.style.visibility=`hidden`}dispose(){this.generation+=1,this.roll&&=(this.roll.animations.forEach(e=>e.cancel()),void 0);for(let e of this.runtimes)this.clearViewTimer(e),this.stopViewAnimation(e),e.view.el.style.transform=``}sync(e,t,n=!1){if(this.running=t,e===this.text){if(!t){this.finishRoll(),this.clearViewTimer(this.current),this.stopViewAnimation(this.current);return}if(n&&!this.roll){this.scheduleHorizontal(this.current,e,!0);return}!this.roll&&this.current.restartTimer===void 0&&this.current.animation===void 0&&this.scheduleHorizontal(this.current,e,!1);return}let r=this.text;this.text=e;let i=!!(r&&e&&t)&&!this.env.prefersReducedMotion();if(this.finishRoll(),!i){this.applyInstant(e);return}this.beginRoll()}applyInstant(e){this.current.view.staticSpan.textContent=e,this.current.view.movingSpan.textContent=e,this.resetOtherView(),this.scheduleHorizontal(this.current,e,!0)}beginRoll(){let e=this.current,t=this.otherOf(e);t.view.staticSpan.textContent=this.text,t.view.movingSpan.textContent=this.text,this.stopViewAnimation(t);let n=++this.generation;t.view.el.style.visibility=``,t.view.el.style.transform=`translateY(100%)`,e.view.el.style.transform=`translateY(0)`;let r=[this.env.animate(e.view.el,[{transform:`translateY(0)`,offset:0,easing:he},{transform:`translateY(-100%)`,offset:1,easing:he}],{duration:260,fill:`forwards`}),this.env.animate(t.view.el,[{transform:`translateY(100%)`,offset:0,easing:he},{transform:`translateY(0)`,offset:1,easing:he}],{duration:260,fill:`forwards`})];this.roll={animations:r,outgoing:e,incoming:t,text:this.text,generation:n},Promise.all(r.map(e=>e.finished)).then(()=>{!this.roll||this.roll.generation!==n||this.finishRoll()}).catch(()=>void 0)}finishRoll(){let e=this.roll;e&&(this.roll=void 0,e.animations.forEach(e=>e.cancel()),this.stopViewAnimation(e.outgoing),e.outgoing.view.el.style.transform=``,e.outgoing.view.el.style.visibility=`hidden`,e.incoming.view.el.style.transform=``,e.incoming.view.el.style.visibility=``,this.current=e.incoming,this.scheduleHorizontal(e.incoming,e.text,!0))}scheduleHorizontal(e,t,n){if(this.clearViewTimer(e),!this.running||!t||this.env.prefersReducedMotion()){this.stopViewAnimation(e);return}e.view.movingSpan.style.display=`inline-block`;let r=e.view.movingSpan.scrollWidth-this.host.getClientWidth();if(e.view.movingSpan.style.display=``,r<=1||this.host.getClientWidth()<=0){this.stopViewAnimation(e);return}if(!n&&e.animation&&e.animatedText===t)return;this.stopViewAnimation(e);let i=++this.generation;e.restartTimer=this.env.setTimeout(()=>{e.restartTimer=void 0,i===this.generation&&this.runCycle(e,i,t,r)},400)}runCycle(e,t,n,r){if(t!==this.generation)return;let{staticSpan:i,movingSpan:a}=e.view;i.style.visibility=`hidden`,a.style.display=`inline-block`;let o=r/35*1e3,s=Math.min(500,Math.max(240,o*.25)),c=o+pe+s,l=o/c,u=(o+pe)/c,d=this.env.animate(a,[{transform:`translateX(0)`,offset:0,easing:`linear`},{transform:`translateX(-${r}px)`,offset:l,easing:`linear`},{transform:`translateX(-${r}px)`,offset:u,easing:`ease-out`},{transform:`translateX(0)`,offset:1,easing:`linear`}],{duration:c,fill:`forwards`});e.animation=d,e.animatedText=n,d.finished.then(()=>{e.animation!==d||t!==this.generation||(d.cancel(),e.animation=void 0,i.style.visibility=``,a.style.display=``,a.style.transform=``,e.restartTimer=this.env.setTimeout(()=>{e.restartTimer=void 0,t===this.generation&&this.runCycle(e,t,n,r)},me))}).catch(()=>void 0)}otherOf(e){return this.runtimes[0]===e?this.runtimes[1]:this.runtimes[0]}resetOtherView(){let e=this.otherOf(this.current);this.clearViewTimer(e),this.stopViewAnimation(e),e.view.el.style.transform=``,e.view.el.style.visibility=`hidden`}clearViewTimer(e){e.restartTimer!==void 0&&(this.env.clearTimeout(e.restartTimer),e.restartTimer=void 0)}stopViewAnimation(e){e.animation&&=(e.animation.cancel(),void 0),e.view.staticSpan.style.visibility=``,e.view.movingSpan.style.display=``,e.view.movingSpan.style.transform=``,e.animatedText=void 0}};function _e(e,t,n=6){if(!Number.isFinite(e)||e<=0)return 0;let r=Math.max(1,Math.round(n)),i=Number.isFinite(t)&&t>0?t:0;return Math.ceil(r*e+i)}function ve(e,t,n=6,r=30){let i=_e(e,t,n);return i<=0?0:Math.ceil(i+(Number.isFinite(r)&&r>0?r:0))}function ye(e,t,n){return!Number.isFinite(t)||t<=0||!Number.isFinite(e)||e<=t+.5?`fits`:n?`expanded`:`collapsed`}var be=class{expanded=!1;settleTimer;options;constructor(e){this.options=e}isExpanded(){return this.expanded}sync(){this.clearSettleTimer();let e=ye(this.options.getNaturalHeightPx(),this.options.getClampHeightPx(),this.expanded);if(e===`fits`){this.options.box.setAttribute(`data-quickforge-fits`,`true`),this.options.box.setAttribute(`data-quickforge-clamped`,`false`),this.options.box.setAttribute(`data-quickforge-expanded`,`false`),this.options.box.style.maxHeight=``,this.options.onStateApplied?.(this.expanded,e);return}this.options.box.setAttribute(`data-quickforge-fits`,`false`),this.expanded?(this.options.box.setAttribute(`data-quickforge-clamped`,`false`),this.options.box.setAttribute(`data-quickforge-expanded`,`true`),this.options.box.style.maxHeight=`none`):(this.options.box.setAttribute(`data-quickforge-clamped`,`true`),this.options.box.setAttribute(`data-quickforge-expanded`,`false`),this.options.box.style.maxHeight=``),this.options.onStateApplied?.(this.expanded,e)}setExpanded(e){if(e===this.expanded){this.sync();return}if(this.expanded=e,this.options.env.prefersReducedMotion()){this.sync();return}this.clearSettleTimer();let t=Math.ceil(this.options.getLayoutHeightPx?.()??this.options.getNaturalHeightPx());if(this.options.box.setAttribute(`data-quickforge-fits`,`false`),e)this.options.box.setAttribute(`data-quickforge-clamped`,`false`),this.options.box.setAttribute(`data-quickforge-expanded`,`true`),this.options.box.style.maxHeight=`${t}px`,this.settleTimer=this.options.env.setTimeout(()=>{this.settleTimer=void 0,this.expanded&&(this.options.box.style.maxHeight=`none`)},320);else{let e=Math.ceil(this.options.getCollapsedHeightPx?.()??this.options.getClampHeightPx());this.options.box.setAttribute(`data-quickforge-clamped`,`true`),this.options.box.setAttribute(`data-quickforge-expanded`,`false`),this.options.box.style.maxHeight=`${t}px`,this.options.box.offsetHeight,this.options.box.style.maxHeight=e>0?`${e}px`:``}this.options.onStateApplied?.(this.expanded,this.expanded?`expanded`:`collapsed`)}toggle(){this.setExpanded(!this.expanded)}dispose(){this.clearSettleTimer()}clearSettleTimer(){this.settleTimer!==void 0&&(this.options.env.clearTimeout(this.settleTimer),this.settleTimer=void 0)}},xe=`<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg>`,Se=new WeakMap,Ce=new WeakMap;function we(){return{prefersReducedMotion:()=>window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,setTimeout:(e,t)=>window.setTimeout(e,t),clearTimeout:e=>window.clearTimeout(e)}}function Te(e){let t=window.getComputedStyle(e),n=parseFloat(t.lineHeight),r=(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0)+(parseFloat(t.borderTopWidth)||0)+(parseFloat(t.borderBottomWidth)||0);return{contentHeight:_e(n,r),clampHeight:ve(n,r)}}function Ee(e){let{clampHeight:t}=Te(e);return t>0?e.style.setProperty(`--quickforge-input-clamp-h`,`${t}px`):e.style.removeProperty(`--quickforge-input-clamp-h`),t}function De(e){return e.querySelector(`:scope > .quickforge-input-clamp-safe-area`)?.offsetHeight??0}function Oe(e){let t=window.getComputedStyle(e),n=(parseFloat(t.borderTopWidth)||0)+(parseFloat(t.borderBottomWidth)||0);return e.scrollHeight-De(e)+n}function ke(e){let t=window.getComputedStyle(e),n=(parseFloat(t.borderTopWidth)||0)+(parseFloat(t.borderBottomWidth)||0);return e.scrollHeight+n}function Ae(e,t){if(!e.querySelector(`:scope > .quickforge-input-clamp-safe-area`)){let t=document.createElement(`div`);t.className=`quickforge-input-clamp-safe-area`,t.setAttribute(`aria-hidden`,`true`),e.append(t)}if(!e.querySelector(`:scope > .quickforge-input-clamp-fade`)){let t=document.createElement(`div`);t.className=`quickforge-input-clamp-fade`,t.setAttribute(`aria-hidden`,`true`),e.append(t)}if(!e.querySelector(`:scope > .quickforge-input-clamp-toggle`)){let n=document.createElement(`button`);n.type=`button`,n.className=`quickforge-input-clamp-toggle`,n.setAttribute(`aria-expanded`,`false`),n.innerHTML=`${xe}<span class="quickforge-input-clamp-toggle-label">${t.collapsed()}</span>`,n.addEventListener(`click`,t=>{t.stopPropagation(),Fe(e)}),e.append(n)}}function je(e,t){let n=e.querySelector(`:scope > .quickforge-input-clamp-toggle`);if(!n)return;n.setAttribute(`aria-expanded`,String(t));let r=n.querySelector(`:scope > .quickforge-input-clamp-toggle-label`),i=Ce.get(e);r&&i&&(r.textContent=t?i.expanded():i.collapsed())}function Me(e,t){Ce.set(e,t);let n=Se.get(e);return n||(Ae(e,t),n=new be({box:e,env:we(),getClampHeightPx:()=>Te(e).contentHeight,getCollapsedHeightPx:()=>Ee(e),getNaturalHeightPx:()=>Oe(e),getLayoutHeightPx:()=>ke(e),onStateApplied:(t,n)=>{n===`collapsed`&&(e.style.maxHeight=`${Ee(e)}px`),je(e,t)}}),Se.set(e,n)),n}function Ne(e,t){Me(e,t).sync()}function Pe(e,t){e.querySelectorAll(`[data-quickforge-input-clamp]`).forEach(e=>Ne(e,t))}function Fe(e){let t=Se.get(e);return t?(t.toggle(),t.isExpanded()):!1}function Ie(e,t){let n=e.querySelector(`.user-message-container`);n&&(n.classList.add(`quickforge-input-clamp`),n.setAttribute(`data-quickforge-input-clamp`,`true`),Ne(n,t))}function Le(e){return Math.max(0,Math.round(Number.isFinite(e)?e:0))}var Re=class{root;env;addSide;delSide;constructor(e,t){for(this.root=e,this.env=t;e.children.length>0;)e.removeChild(e.children[0])}dispose(){for(let e of[this.addSide,this.delSide])for(let t of e?.digits??[])t.enterTimer!==void 0&&this.env.clearTimeout(t.enterTimer)}sync(e,t,n){let r=this.env.prefersReducedMotion();this.root.classList.toggle(`quickforge-diff-counter`,!0),this.root.classList.toggle(`quickforge-diff-counter-running`,n),this.root.classList.toggle(`quickforge-odometer-reduced`,r),this.syncSide(this.addSide??=this.createSide(`add`,`+`),Le(e)),this.syncSide(this.delSide??=this.createSide(`del`,`−`),Le(t))}createSide(e,t){let n=this.env.createElement(`span`);n.className=`quickforge-odometer-side ${e}`;let r=this.env.createElement(`span`);return r.className=`quickforge-odometer-sign`,r.textContent=t,n.appendChild(r),this.root.appendChild(n),{group:n,sign:r,digits:[]}}createDigitColumn(e){let t=this.env.createElement(`span`);t.className=`quickforge-odometer-digit enter`;let n=this.env.createElement(`span`);n.className=`quickforge-odometer-strip`;for(let e=0;e<=9;e++){let t=this.env.createElement(`span`);t.textContent=String(e),n.appendChild(t)}return n.style.transform=`translateY(-${e}em)`,t.appendChild(n),{holder:t,strip:n,enterTimer:void 0}}syncSide(e,t){let n=String(t).split(``).map(Number);for(;e.digits.length>n.length;){let t=e.digits.shift();if(!t)break;t.enterTimer!==void 0&&this.env.clearTimeout(t.enterTimer),e.group.removeChild(t.holder)}for(;e.digits.length<n.length;){let t=this.createDigitColumn(0);e.group.insertBefore(t.holder,e.group.children[1]??null),t.enterTimer=this.env.setTimeout(()=>{t.enterTimer=void 0,t.holder.className=`quickforge-odometer-digit`},380),e.digits.unshift(t)}e.digits.forEach((e,t)=>{e.strip.style.transform=`translateY(-${n[t]}em)`})}},ze=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/,Be=4e4;function Ve(e){let t=/^\+\+\+ b\/(.+)$/m.exec(e);if(!t?.[1])return null;let n=/^--- (?:a\/(.+)|\/dev\/null)$/m.exec(e);return{path:t[1],isNewFile:n!==null&&n[1]===void 0}}function He(e){let t=e.split(`
|
|
3
|
+
`);t.length>1&&t[t.length-1]===``&&t.pop();let n=[],r=0,i=0,a=0,o=!1,s=!0;for(let e of t){if(e.startsWith(`--- `)||e.startsWith(`+++ `))continue;let t=ze.exec(e);if(t){let e=Number.parseInt(t[1]??`1`,10),c=e-a-1;c>0&&n.push({kind:`gap`,count:c,first:s&&!o}),r=e,i=Number.parseInt(t[2]??`1`,10),s=!1;continue}e.startsWith(`+`)?n.push({kind:`add`,text:e.slice(1),oldNo:null,newNo:i++}):e.startsWith(`-`)?n.push({kind:`del`,text:e.slice(1),oldNo:r++,newNo:null}):n.push({kind:`ctx`,text:e.length>0?e.slice(1):e,oldNo:r++,newNo:i++}),a=r-1,o=!0}return Ue(n),n}function Ue(e){for(let t=0;t<e.length;t++){if(e[t]?.kind!==`del`)continue;let n=t,r=[],i=[];for(;e[n]?.kind===`del`;)r.push(e[n++]);for(;e[n]?.kind===`add`;)i.push(e[n++]);let a=Math.min(r.length,i.length);for(let e=0;e<a;e++){let t=r[e],n=i[e],a=We(t.text),o=We(n.text),{aMarks:s,bMarks:c}=Ge(a,o);t.segments=Ke(a,s),n.segments=Ke(o,c)}t=n-1}}function We(e){return e.match(/\s+|[A-Za-z0-9_$]+|./gu)??[]}function Ge(e,t){let n=Array(e.length).fill(!0),r=Array(t.length).fill(!0);if(e.length===0||t.length===0||e.length*t.length>Be)return{aMarks:n,bMarks:r};let i=Array.from({length:e.length+1},()=>new Uint32Array(t.length+1));for(let n=e.length-1;n>=0;n--)for(let r=t.length-1;r>=0;r--)i[n][r]=e[n]===t[r]?(i[n+1][r+1]??0)+1:Math.max(i[n+1][r]??0,i[n][r+1]??0);let a=0,o=0;for(;a<e.length&&o<t.length;)e[a]===t[o]?(n[a]=!1,r[o]=!1,a++,o++):(i[a+1][o]??0)>=(i[a][o+1]??0)?a++:o++;return{aMarks:n,bMarks:r}}function Ke(e,t){let n=[],r;for(let i=0;i<e.length;i++){let a=e[i]??``;r&&r.changed===t[i]?r.text+=a:(r={text:a,changed:t[i]??!0},n.push(r))}return n}var I=`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>`,qe=`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg>`,Je=`<svg xmlns="http://www.w3.org/2000/svg" width="17" height="17" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 14 4 9l5-5"/><path d="M4 9h10.5a5.5 5.5 0 0 1 0 11H11"/></svg>`,Ye=`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="18" r="3"/><circle cx="6" cy="6" r="3"/><circle cx="18" cy="6" r="3"/><path d="M18 9v1a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2V9"/><path d="M12 12v3"/></svg>`,Xe=`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 2v6h-6"/><path d="M3 12a9 9 0 0 1 15.36-5.64L21 9"/><path d="M3 22v-6h6"/><path d="M21 12a9 9 0 0 1-15.36 5.64L3 15"/></svg>`,Ze=`<svg class="quickforge-plan-mode-icon" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 6h1"/><path d="M4 12h1"/><path d="M4 18h1"/><path d="M9 6h11"/><path d="M9 12h11"/><path d="M9 18h11"/></svg>`,Qe=`<svg class="quickforge-plan-remove-icon" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>`,$e=`<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 5v14"/><path d="M5 12h14"/></svg>`,et=`<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"/></svg>`,tt=`<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7.5 4.5h5a1.5 1.5 0 0 1 1.5 1.5v2h1a2.5 2.5 0 0 1 0 5h-1v2a1.5 1.5 0 0 1-1.5 1.5h-2v1a2.5 2.5 0 0 1-5 0v-1h-2A1.5 1.5 0 0 1 2 15.5v-3h1a2 2 0 1 0 0-4H2v-2A1.5 1.5 0 0 1 3.5 5h2v-1a2.5 2.5 0 0 1 5 0v.5Z"/></svg>`,nt=`<svg viewBox="0 0 20 20" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.65" stroke-linecap="round" stroke-linejoin="round"><path d="M5.4 2.8h6.1L15.8 7v10.2H5.4z"/><path d="M11.4 2.9V7h4.1"/><path d="M7.6 10.2h5"/><path d="M7.6 13h4.3"/></svg>`,rt=`<svg viewBox="0 0 20 20" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.65" stroke-linecap="round" stroke-linejoin="round"><rect x="3.4" y="4" width="13.2" height="12.2" rx="1.5"/><path d="M3.4 8h13.2"/><path d="M7.8 4v12.2"/><path d="M12.2 4v12.2"/><path d="M3.4 12h13.2"/></svg>`,it=`<svg viewBox="0 0 20 20" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.65" stroke-linecap="round" stroke-linejoin="round"><path d="M3 4.2h14"/><rect x="4.2" y="4.2" width="11.6" height="8.4" rx="1.2"/><path d="M10 12.6v3.2"/><path d="m7.2 17 2.8-1.2 2.8 1.2"/><path d="M7.1 9.5 9 7.7l1.5 1.3 2.4-2.5"/></svg>`,at=`<svg class="quickforge-agent-access-trigger-icon" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3 19 6v5c0 4.5-2.8 8.4-7 10-4.2-1.6-7-5.5-7-10V6l7-3Z"/><path d="M9 12h6"/></svg>`,ot=`<svg class="quickforge-agent-access-option-icon" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m21.73 18-8-14a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"/><path d="M12 9v4"/><path d="M12 17h.01"/></svg>`,st=`<svg class="quickforge-agent-access-check" xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg>`,ct=`<svg class="quickforge-agent-access-chevron" xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg>`,lt=`<svg class="quickforge-opencode-config-icon" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 20V10"/><path d="M18 20V4"/><path d="M6 20v-4"/><path d="M18 4a2 2 0 0 0-4 0"/><path d="M6 16a2 2 0 0 0-4 0"/><path d="M12 10a2 2 0 0 0-4 0"/></svg>`;function ut(e){return v(e===`full-access`?`agentAccessFullLabel`:`agentAccessDefaultLabel`)}function L(e){let t=document.querySelector(`.quickforge-agent-access-menu`);t?.__quickforgeDismissHandler&&(document.removeEventListener(`pointerdown`,t.__quickforgeDismissHandler,!0),document.removeEventListener(`keydown`,t.__quickforgeDismissHandler,!0),window.removeEventListener(`resize`,t.__quickforgeDismissHandler,!0),window.removeEventListener(`scroll`,t.__quickforgeDismissHandler,!0),t.__quickforgeDismissHandler=void 0),t?.remove(),e.querySelector(`.quickforge-agent-access-inline`)?.setAttribute(`aria-expanded`,`false`)}function dt(e,t,n){let r=e===t,i=document.createElement(`button`);return i.type=`button`,i.className=`quickforge-agent-access-item`,i.setAttribute(`role`,`menuitemradio`),i.setAttribute(`aria-checked`,String(r)),i.dataset.quickforgeAgentAccessMode=e,i.innerHTML=`
|
|
4
|
+
<span class="quickforge-agent-access-check-slot">${r?st:``}</span>
|
|
5
|
+
<span class="quickforge-agent-access-option-icon-wrap">${e===`full-access`?ot:at}</span>
|
|
6
|
+
<span class="quickforge-agent-access-item-label"></span>
|
|
7
|
+
`,i.querySelector(`.quickforge-agent-access-item-label`).textContent=ut(e),i.onpointerdown=t=>{t.preventDefault(),t.stopPropagation(),n(e)},i}function ft(e){let{panel:t,trigger:n,agentAccessMode:r,onAccessModeChange:i,dismissComposerMenus:a}=e;if(document.querySelector(`.quickforge-agent-access-menu`)){L(t);return}a(),L(t);let o=document.createElement(`div`);o.className=`quickforge-agent-access-menu`,o.setAttribute(`role`,`menu`),o.setAttribute(`aria-label`,v(`agentAccessMenuLabel`));let s=e=>{L(t),e!==r&&i(e)};o.append(dt(`default`,r,s),dt(`full-access`,r,s));let c=()=>{let e=n.getBoundingClientRect(),t=Math.min(196,window.innerWidth-24);o.style.width=`${t}px`;let r=o.offsetHeight||96,i=Math.max(12,Math.min(e.left,window.innerWidth-t-12)),a=Math.max(12,e.top-r-8);o.style.left=`${i}px`,o.style.top=`${a}px`},l=e=>{if(e.type===`resize`||e.type===`scroll`){c();return}if(e instanceof KeyboardEvent){if(e.key!==`Escape`)return;e.preventDefault()}else{let t=e.target;if(o.contains(t)||n.contains(t))return}L(t)};o.__quickforgeDismissHandler=l,o.addEventListener(`pointerdown`,e=>e.stopPropagation()),document.addEventListener(`pointerdown`,l,!0),document.addEventListener(`keydown`,l,!0),window.addEventListener(`resize`,l,!0),window.addEventListener(`scroll`,l,!0),document.body.append(o),c(),n.setAttribute(`aria-expanded`,`true`)}function pt(e){let{panel:t,leftControls:n,agentAccessMode:r,onAccessModeChange:i,dismissComposerMenus:a}=e;n.classList.add(`quickforge-composer-left-controls`),t.querySelector(`.quickforge-yolo-inline`)?.remove();let o=ut(r),s=v(r===`full-access`?`agentAccessFullTitle`:`agentAccessDefaultTitle`),c=`${r===`full-access`?ot:at}<span class="quickforge-agent-access-label"></span>${ct}`,l=`quickforge-agent-access-inline inline-flex h-8 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 text-xs font-medium text-muted-foreground${r===`full-access`?` quickforge-agent-access-inline-full`:``}`,u=n.querySelector(`.quickforge-agent-access-inline`),f=e=>{d(e,c),e.querySelector(`.quickforge-agent-access-label`).textContent=o,e.title=s,e.setAttribute(`aria-label`,s),e.setAttribute(`aria-haspopup`,`menu`),e.setAttribute(`aria-expanded`,document.querySelector(`.quickforge-agent-access-menu`)?`true`:`false`),e.dataset.quickforgeAgentAccessMode=r,e.className=l,e.onpointerdown=n=>{n.preventDefault(),n.stopPropagation(),ft({panel:t,trigger:e,agentAccessMode:r,onAccessModeChange:i,dismissComposerMenus:a})},e.onclick=e=>{e.preventDefault(),e.stopPropagation()},e.onkeydown=n=>{n.key!==`Enter`&&n.key!==` `&&n.key!==`ArrowDown`||(n.preventDefault(),ft({panel:t,trigger:e,agentAccessMode:r,onAccessModeChange:i,dismissComposerMenus:a}))}};if(u)f(u);else{let e=document.createElement(`button`);e.type=`button`,f(e),n.append(e)}let p=n.querySelector(`.quickforge-agent-access-inline`),m=n.querySelector(`.quickforge-plan-inline`);p&&m&&p.nextSibling!==m&&n.insertBefore(m,p.nextSibling)}function mt(e){return typeof e.group==`string`&&Array.isArray(e.options)}function ht(e){let t=e?.configOptions;return Array.isArray(t)&&t.length>0}function gt(e){return e.description?`${e.name} — ${e.description}`:e.name}function _t(e){if(!Array.isArray(e))return{groups:[],flat:[]};let t=[],n=[];for(let r of e)r&&mt(r)?(t.push({group:r.group,options:r.options}),n.push(...r.options)):r&&typeof r.value==`string`&&n.push(r);return{groups:t,flat:n}}function R(e){let t=document.querySelector(`.quickforge-opencode-config-menu`);t?.__quickforgeDismissHandler&&(document.removeEventListener(`pointerdown`,t.__quickforgeDismissHandler,!0),document.removeEventListener(`keydown`,t.__quickforgeDismissHandler,!0),window.removeEventListener(`resize`,t.__quickforgeDismissHandler,!0),window.removeEventListener(`scroll`,t.__quickforgeDismissHandler,!0),t.__quickforgeDismissHandler=void 0),t?.remove(),e.querySelector(`.quickforge-opencode-config-inline`)?.setAttribute(`aria-expanded`,`false`)}function vt(e,t,n){let r=e.currentValue===!0,i=document.createElement(`button`);return i.type=`button`,i.className=`quickforge-opencode-config-item quickforge-opencode-config-toggle`,i.setAttribute(`role`,`menuitemcheckbox`),i.setAttribute(`aria-checked`,String(r)),i.disabled=t,i.innerHTML=`
|
|
8
|
+
<span class="quickforge-opencode-config-check-slot">${r?st:``}</span>
|
|
9
|
+
<span class="quickforge-opencode-config-item-label"></span>
|
|
10
|
+
`,i.querySelector(`.quickforge-opencode-config-item-label`).textContent=e.name,e.description&&(i.title=e.description),i.onpointerdown=e=>{e.preventDefault(),e.stopPropagation(),t||n(!r)},i}function yt(e,t,n,r){let i=e.value===t,a=document.createElement(`button`);return a.type=`button`,a.className=`quickforge-opencode-config-item quickforge-opencode-config-select-option`,a.setAttribute(`role`,`menuitemradio`),a.setAttribute(`aria-checked`,String(i)),a.disabled=n,a.innerHTML=`
|
|
11
|
+
<span class="quickforge-opencode-config-check-slot">${i?st:``}</span>
|
|
12
|
+
<span class="quickforge-opencode-config-item-label"></span>
|
|
13
|
+
`,a.querySelector(`.quickforge-opencode-config-item-label`).textContent=gt(e),a.onpointerdown=t=>{t.preventDefault(),t.stopPropagation(),!n&&!i&&r(e.value)},a}function bt(e){let t=document.createElement(`div`);return t.className=`quickforge-opencode-config-section-title`,t.textContent=e,t}function xt(e){let{panel:t,trigger:n,acpSession:r,disabled:i,onConfigOptionChange:a,dismissComposerMenus:o}=e;if(document.querySelector(`.quickforge-opencode-config-menu`)){R(t);return}if(!ht(r)){R(t);return}o(),R(t);let s=document.createElement(`div`);s.className=`quickforge-opencode-config-menu`,s.setAttribute(`role`,`menu`),s.setAttribute(`aria-label`,v(`openCodeConfigMenuLabel`));let c=Array.isArray(r?.configOptions)?r.configOptions:[];if(c.length>0){s.append(bt(v(`openCodeConfigOptionsTitle`)));for(let e of c){if(e.type===`boolean`){s.append(vt(e,i,t=>a(e.id,t)));continue}if(e.type===`select`){let{groups:t,flat:n}=_t(e.options),r=typeof e.currentValue==`string`?e.currentValue:``,o=bt(e.name);if(e.description&&(o.title=e.description),s.append(o),t.length>0)for(let n of t){let t=document.createElement(`div`);t.className=`quickforge-opencode-config-group-label`,t.textContent=n.group,s.append(t);for(let t of n.options)s.append(yt(t,r,i,t=>a(e.id,t)))}else for(let t of n)s.append(yt(t,r,i,t=>a(e.id,t)))}}}let l=()=>{let e=n.getBoundingClientRect(),t=Math.min(232,window.innerWidth-24);s.style.width=`${t}px`,s.style.maxHeight=`${Math.max(180,window.innerHeight-32)}px`;let r=s.offsetHeight||160,i=Math.max(12,Math.min(e.left,window.innerWidth-t-12)),a=Math.max(12,e.top-r-8);s.style.left=`${i}px`,s.style.top=`${a}px`},u=e=>{if(e.type===`resize`||e.type===`scroll`){l();return}if(e instanceof KeyboardEvent){if(e.key!==`Escape`)return;e.preventDefault()}else{let t=e.target;if(s.contains(t)||n.contains(t))return}R(t)};s.__quickforgeDismissHandler=u,s.addEventListener(`pointerdown`,e=>e.stopPropagation()),document.addEventListener(`pointerdown`,u,!0),document.addEventListener(`keydown`,u,!0),window.addEventListener(`resize`,u,!0),window.addEventListener(`scroll`,u,!0),document.body.append(s),l(),n.setAttribute(`aria-expanded`,`true`)}function St(e){let{panel:t,leftControls:n,getAcpSession:r,isStreaming:i,onConfigOptionChange:a,onModeChange:o,dismissComposerMenus:s}=e;if(n.classList.add(`quickforge-composer-left-controls`),!ht(r())){n.querySelector(`.quickforge-opencode-config-inline`)?.remove(),R(t);return}let c=e=>{xt({panel:t,leftControls:n,getAcpSession:r,isStreaming:i,trigger:e,acpSession:r(),disabled:i(),onConfigOptionChange:a,onModeChange:o,dismissComposerMenus:s})},l=e=>{let t=i(),n=v(t?`openCodeConfigDisabledWhileStreaming`:`openCodeConfigMenuLabel`);d(e,`${lt}<span class="quickforge-opencode-config-label"></span>${ct}`),e.querySelector(`.quickforge-opencode-config-label`).textContent=v(`openCodeConfigButtonLabel`),e.title=n,e.setAttribute(`aria-label`,n),e.setAttribute(`aria-haspopup`,`menu`),e.setAttribute(`aria-expanded`,document.querySelector(`.quickforge-opencode-config-menu`)?`true`:`false`),e.disabled=t,e.className=`quickforge-opencode-config-inline inline-flex h-8 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 text-xs font-medium text-muted-foreground`,e.onpointerdown=t=>{t.preventDefault(),t.stopPropagation(),e.disabled||c(e)},e.onclick=e=>{e.preventDefault(),e.stopPropagation()},e.onkeydown=t=>{t.key!==`Enter`&&t.key!==` `&&t.key!==`ArrowDown`||(t.preventDefault(),e.disabled||c(e))}},u=n.querySelector(`.quickforge-opencode-config-inline`);if(u)l(u);else{let e=document.createElement(`button`);e.type=`button`,l(e),n.append(e)}}function Ct(e){let t=e?.modes;return!!(t&&Array.isArray(t.availableModes)&&t.availableModes.length>0)}function wt(e){let t=e?.modes?.currentModeId;return t?e?.modes?.availableModes?.find(e=>e.id===t)?.name??t:``}function z(e){let t=document.querySelector(`.quickforge-opencode-mode-menu`);t?.__quickforgeDismissHandler&&(document.removeEventListener(`pointerdown`,t.__quickforgeDismissHandler,!0),document.removeEventListener(`keydown`,t.__quickforgeDismissHandler,!0),window.removeEventListener(`resize`,t.__quickforgeDismissHandler,!0),window.removeEventListener(`scroll`,t.__quickforgeDismissHandler,!0),t.__quickforgeDismissHandler=void 0),t?.remove(),e.querySelector(`.quickforge-opencode-mode-inline`)?.setAttribute(`aria-expanded`,`false`)}function Tt(e,t,n,r){let i=e.id===t,a=document.createElement(`button`);a.type=`button`,a.className=`quickforge-model-menu-item`,a.setAttribute(`role`,`menuitemradio`),a.setAttribute(`aria-checked`,String(i)),a.disabled=n;let o=document.createElement(`span`);o.className=`quickforge-model-menu-item-label`,o.textContent=e.description?`${e.name} — ${e.description}`:e.name;let s=document.createElement(`span`);return s.className=`quickforge-model-menu-item-suffix`,s.textContent=i?`✓`:``,a.append(o,s),a.onpointerdown=t=>{t.preventDefault(),t.stopPropagation(),r(e.id)},a}function Et(e){let{panel:t,trigger:n,acpSession:r,disabled:i,onModeChange:a,dismissComposerMenus:o}=e;if(document.querySelector(`.quickforge-opencode-mode-menu`)){z(t);return}if(!Ct(r)){z(t);return}o(),z(t);let s=document.createElement(`div`);s.className=`quickforge-opencode-mode-menu quickforge-model-menu`,s.setAttribute(`role`,`menu`),s.setAttribute(`aria-label`,v(`openCodeModeMenuLabel`));let c=r?.modes?.currentModeId??``,l=document.createElement(`div`);l.className=`quickforge-model-menu-header`,l.textContent=v(`openCodeConfigModesTitle`),s.append(l);let u=e=>{z(t),e!==c&&a(e)};for(let e of r?.modes?.availableModes??[])s.append(Tt(e,c,i,u));let d=()=>{let e=n.getBoundingClientRect(),t=Math.min(260,window.innerWidth-24);s.style.width=`${t}px`;let r=s.offsetHeight||160,i=Math.max(12,Math.min(e.right-t,window.innerWidth-t-12)),a=e.top-r-8,o=e.bottom+8,c=a>=12?a:Math.min(o,window.innerHeight-r-12);s.style.left=`${i}px`,s.style.top=`${Math.max(12,c)}px`},f=e=>{if(e.type===`resize`||e.type===`scroll`){d();return}if(e instanceof KeyboardEvent){if(e.key!==`Escape`)return;e.preventDefault()}else{let t=e.target;if(s.contains(t)||n.contains(t))return}z(t)};s.__quickforgeDismissHandler=f,s.addEventListener(`pointerdown`,e=>e.stopPropagation()),document.addEventListener(`pointerdown`,f,!0),document.addEventListener(`keydown`,f,!0),window.addEventListener(`resize`,f,!0),window.addEventListener(`scroll`,f,!0),document.body.append(s),d(),n.setAttribute(`aria-expanded`,`true`)}function Dt(e){let{panel:t,rightControls:n,getAcpSession:r,isStreaming:i,onModeChange:a,dismissComposerMenus:o}=e;if(!Ct(r())){t.querySelector(`.quickforge-opencode-mode-inline`)?.remove(),z(t);return}let s=e=>{Et({panel:t,rightControls:n,getAcpSession:r,isStreaming:i,onModeChange:a,dismissComposerMenus:o,trigger:e,acpSession:r(),disabled:i()})},c=n.querySelector(`.quickforge-opencode-mode-inline`)??document.createElement(`button`);c.type=`button`;let l=i(),u=v(l?`openCodeModeDisabledWhileStreaming`:`openCodeModeMenuLabel`);d(c,`<span class="quickforge-opencode-mode-label"></span>`),c.querySelector(`.quickforge-opencode-mode-label`).textContent=wt(r()),c.title=u,c.setAttribute(`aria-label`,u),c.setAttribute(`aria-haspopup`,`menu`),c.setAttribute(`aria-expanded`,document.querySelector(`.quickforge-opencode-mode-menu`)?`true`:`false`),c.disabled=l,c.className=`quickforge-opencode-mode-inline quickforge-model-trigger inline-flex h-8 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 text-xs font-medium text-muted-foreground`,c.onpointerdown=e=>{e.preventDefault(),e.stopPropagation(),c.disabled||s(c)},c.onclick=e=>{e.preventDefault(),e.stopPropagation()},c.onkeydown=e=>{e.key!==`Enter`&&e.key!==` `&&e.key!==`ArrowDown`||(e.preventDefault(),c.disabled||s(c))};let f=n.querySelector(`button:last-child`);if(!f)n.append(c);else if(f!==c)n.insertBefore(c,f);else{let e=Array.from(n.querySelectorAll(`button`)).filter(e=>e!==c).pop();e?n.insertBefore(c,e.nextSibling):n.prepend(c)}}var Ot={plugin:tt,document:nt,spreadsheet:rt,presentation:it,skill:tt,tool:tt,command:tt};function B(e){let t=e.querySelector(`.quickforge-plus-popover`);t?.__quickforgeDismissHandler&&(document.removeEventListener(`pointerdown`,t.__quickforgeDismissHandler,!0),t.__quickforgeDismissHandler=void 0),t?.remove(),e.querySelector(`.quickforge-plus-inline`)?.setAttribute(`aria-expanded`,`false`)}function kt(e,t){e.querySelectorAll(`.quickforge-native-attachment-hidden`).forEach(e=>{t.contains(e)||e.classList.remove(`quickforge-native-attachment-hidden`)})}function At(e){return e.querySelector(`.quickforge-native-attachment-hidden`)||Array.from(e.querySelectorAll(`button`)).find(e=>!e.classList.contains(`quickforge-plus-inline`)&&!e.classList.contains(`quickforge-agent-access-inline`)&&!e.classList.contains(`quickforge-yolo-inline`)&&!e.classList.contains(`quickforge-plan-inline`))}function jt(e,t){e.querySelectorAll(`input[type="file"]`).forEach(e=>{e.disabled=!0}),t&&(kt(e,t),At(t)?.classList.add(`quickforge-native-attachment-hidden`))}function Mt(e,t){let n=e.querySelector(`input[type="file"]`);if(n){n.click();return}At(t)?.click()}function Nt({className:e,icon:t,label:n,description:r,pluginName:i,onSelect:a}){let o=document.createElement(`button`);o.type=`button`,o.className=`quickforge-plus-popover-item${e?` ${e}`:``}`,i&&(o.dataset.quickforgePluginName=i),o.innerHTML=`
|
|
14
|
+
<span class="quickforge-plus-popover-item-icon">${t}</span>
|
|
15
|
+
<span class="quickforge-plus-popover-item-main">
|
|
16
|
+
<span class="quickforge-plus-popover-item-label"></span>
|
|
17
|
+
${r?`<span class="quickforge-plus-popover-item-description"></span>`:``}
|
|
18
|
+
</span>
|
|
19
|
+
`,o.querySelector(`.quickforge-plus-popover-item-label`).textContent=n;let s=o.querySelector(`.quickforge-plus-popover-item-description`);return s&&r&&(s.textContent=r),o.onpointerdown=e=>{e.preventDefault(),e.stopPropagation(),a()},o}function Pt(e,t){let{panel:n,editor:r,leftControls:i,selectPluginCapability:a,removeCommandSuggestions:o,removeCapabilitySuggestions:s,removeFileReferenceSuggestions:c}=e;z(n),o(),s(),c();let l=n.querySelector(`.quickforge-plus-popover`)??document.createElement(`div`);l.className=`quickforge-plus-popover`,l.setAttribute(`role`,`menu`),l.innerHTML=``;let u=document.createElement(`div`);if(u.className=`quickforge-plus-popover-header`,u.textContent=v(t===`plugins`?`composerAddPlugins`:`composerAddMenu`),l.append(u),t===`main`)e.attachmentsEnabled&&l.append(Nt({icon:et,label:v(`composerAddAttachment`),onSelect:()=>{B(n),Mt(r,i)}})),e.pluginsEnabled&&e.availablePluginRows().length>0&&l.append(Nt({icon:tt,label:v(`composerAddPlugins`),onSelect:()=>Pt(e,`plugins`)}));else{let t=Nt({className:`quickforge-plus-popover-back`,icon:`<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg>`,label:v(`composerAddBack`),onSelect:()=>Pt(e,`main`)});l.append(t);for(let t of e.availablePluginRows())l.append(Nt({icon:Ot[t.iconKind],label:t.label,description:t.description,pluginName:t.pluginName,onSelect:()=>{a(t.pluginName),B(n)}}))}l.isConnected||r.parentElement?.insertBefore(l,r),l.__quickforgeDismissHandler&&document.removeEventListener(`pointerdown`,l.__quickforgeDismissHandler,!0),l.__quickforgeDismissHandler=e=>{let t=e.target;l.contains(t)||n.querySelector(`.quickforge-plus-inline`)?.contains(t)||B(n)},document.addEventListener(`pointerdown`,l.__quickforgeDismissHandler,!0),n.querySelector(`.quickforge-plus-inline`)?.setAttribute(`aria-expanded`,`true`)}function Ft(e){let{panel:t,editor:n,leftControls:r}=e;kt(n,r),At(r)?.classList.add(`quickforge-native-attachment-hidden`);let i=r.querySelector(`.quickforge-plus-inline`),a=n=>{n.type=`button`,d(n,$e),n.title=v(`composerAddMenu`),n.setAttribute(`aria-label`,v(`composerAddMenu`)),n.setAttribute(`aria-haspopup`,`menu`),n.setAttribute(`aria-expanded`,t.querySelector(`.quickforge-plus-popover`)?`true`:`false`),n.className=`quickforge-plus-inline inline-flex h-8 w-8 items-center justify-center rounded-md border border-transparent text-muted-foreground`,n.onpointerdown=n=>{n.preventDefault(),n.stopPropagation(),t.querySelector(`.quickforge-plus-popover`)?B(t):Pt(e,`main`)},n.onclick=e=>{e.preventDefault(),e.stopPropagation()}};if(i){a(i);return}let o=document.createElement(`button`);a(o),r.prepend(o)}function It(e){switch(e){case`low`:return v(`thinkingLow`);case`medium`:return v(`thinkingMedium`);case`high`:return v(`thinkingHigh`);case`xhigh`:return v(`thinkingXHigh`);default:return v(`thinkingOff`)}}function Lt(e,t){let n=e,r=n?.currentModel;t.querySelector(`[data-quickforge-thinking-badge]`)?.remove();let i=Array.from(t.querySelectorAll(`button:not(.quickforge-agent-access-inline):not(.quickforge-yolo-inline):not(.quickforge-plan-inline):not(.quickforge-opencode-mode-inline)`)).find(e=>!!(r?.id&&e.textContent?.includes(r.id)));i&&(i.classList.add(`quickforge-model-trigger`),i.setAttribute(`aria-haspopup`,`menu`),i.setAttribute(`aria-expanded`,document.querySelector(`.quickforge-model-menu`)?`true`:`false`),r?.reasoning?i.dataset.quickforgeThinkingLevel=`· ${It(n?.thinkingLevel)}`:delete i.dataset.quickforgeThinkingLevel)}function Rt(e){let t=e?.querySelector(`textarea`);t?.__quickforgePlanModeHandler&&(t.removeEventListener(`keydown`,t.__quickforgePlanModeHandler,!0),t.__quickforgePlanModeHandler=void 0),e&&delete e.dataset.quickforgePlanMode}function zt(e,t,n){let r=e?.querySelector(`textarea`);if(!r)return;let i=r;i.__quickforgePlanModeHandler&&i.removeEventListener(`keydown`,i.__quickforgePlanModeHandler,!0),i.__quickforgePlanModeHandler=e=>{e.isComposing||e.key===`Process`||e.key!==`Tab`||!e.shiftKey||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),n())},i.addEventListener(`keydown`,i.__quickforgePlanModeHandler,!0),e&&(e.dataset.quickforgePlanMode=String(t))}function Bt(e){let{panel:t,leftControls:n,planMode:r,onTogglePlanMode:i}=e,a=v(`planModeEnabledTitle`),o=`${Ze}${Qe}<span>${v(`planModeLabel`)}</span>`,s=e=>{e.preventDefault(),e.stopPropagation(),i()},c=e=>{e.key!==`Enter`&&e.key!==` `||s(e)},l=t.querySelector(`.quickforge-plan-inline`),u=e=>{d(e,o),e.title=a,e.setAttribute(`aria-label`,a),e.setAttribute(`aria-pressed`,String(r)),e.className=`quickforge-plan-inline inline-flex h-8 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 text-xs font-medium text-muted-foreground`,e.onpointerdown=s,e.onclick=e=>{e.preventDefault(),e.stopPropagation()},e.onkeydown=c};if(!r)l?.remove();else if(l)u(l);else{let e=document.createElement(`button`);e.type=`button`,u(e);let t=n.querySelector(`.quickforge-agent-access-inline`);t?n.insertBefore(e,t.nextSibling):n.append(e)}}function Vt(e){let{rightControls:t,isStreaming:n,isWaiting:r,abort:i,removeCommandSuggestions:a}=e,o=t.querySelector(`button:last-child`);if(!o)return;let s=()=>{o.__quickforgeStopHandler&&=(o.removeEventListener(`pointerdown`,o.__quickforgeStopHandler,!0),o.removeEventListener(`click`,o.__quickforgeStopHandler,!0),void 0)};if(n())o.disabled=!1,o.classList.remove(`quickforge-send-button`),o.classList.add(`quickforge-stop-button`),o.classList.toggle(`quickforge-stop-button--waiting`,r?r():!1),o.title=`Stop`,o.setAttribute(`aria-label`,`Stop`),delete o.dataset.quickforgeSendIcon,E(o,`<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><rect x="6" y="6" width="12" height="12" rx="2"/></svg>`),o.__quickforgeStopHandler||(o.__quickforgeStopHandler=e=>{e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),a(),i()},o.addEventListener(`pointerdown`,o.__quickforgeStopHandler,!0),o.addEventListener(`click`,o.__quickforgeStopHandler,!0));else if(s(),o.classList.remove(`quickforge-stop-button`),o.classList.remove(`quickforge-stop-button--waiting`),o.classList.add(`quickforge-send-button`),o.dataset.quickforgeSendIcon!==`arrow-up`){o.dataset.quickforgeSendIcon=`arrow-up`,E(o,`<svg xmlns="http://www.w3.org/2000/svg" width="17" height="17" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 19V5"/><path d="m5 12 7-7 7 7"/></svg>`);let e=o.querySelector(`svg`)?.parentElement;e&&e!==o&&e.style.transform&&(e.style.transform=``)}}function Ht(e){let{editor:t,onInput:n,onFilesChange:r,removeCommandSuggestions:i,updateCommandSuggestions:a,removeCapabilitySuggestions:o,updateCapabilitySuggestions:s,removeFileReferenceSuggestions:c=()=>{},updateFileReferenceSuggestions:l=()=>{},attachmentsEnabled:u=!0,onBeforeSend:d}=e;if(!t)return;t.__quickforgeAttachmentPasteGuard&&t.removeEventListener(`paste`,t.__quickforgeAttachmentPasteGuard,!0),t.__quickforgeAttachmentDropGuard&&t.removeEventListener(`drop`,t.__quickforgeAttachmentDropGuard,!0),u?(t.__quickforgeAttachmentPasteGuard=void 0,t.__quickforgeAttachmentDropGuard=void 0,t.onFilesChange=e=>{r(e?[...e]:[])}):(t.attachments=[],t.onFilesChange=()=>r([]),t.__quickforgeAttachmentPasteGuard=e=>{[...e.clipboardData?.items??[]].some(e=>e.kind===`file`)&&(e.preventDefault(),e.stopPropagation())},t.__quickforgeAttachmentDropGuard=e=>{(e.dataTransfer?.files.length??0)!==0&&(e.preventDefault(),e.stopPropagation())},t.addEventListener(`paste`,t.__quickforgeAttachmentPasteGuard,!0),t.addEventListener(`drop`,t.__quickforgeAttachmentDropGuard,!0)),t.onInput=e=>{n(e),a(e),s(e),l(e)};let f=t.onSend;f&&f!==t.__quickforgePlanWrappedOnSend&&(t.__quickforgePlanBaseOnSend=f);let p=t.__quickforgePlanBaseOnSend;if(p){let e=(e,t)=>{let n=String(e??``);ne({attachments:u},n,t)&&(d?.(n),i(),o(),c(),p(n,u?t:[]))};t.__quickforgePlanWrappedOnSend=e,t.onSend=e}a(),s(),l()}function Ut(e){let t=e.querySelector(`message-editor`),n=t?.querySelector(`textarea`);return{text:t?.value??n?.value??``,attachments:t?.attachments?[...t.attachments]:[],contextReferences:t?.contextReferences?[...t.contextReferences]:[],selectedCapabilities:t?.selectedCapabilities?[...t.selectedCapabilities]:[]}}function Wt(e,t,n){let r=Ut(e);x(r)?t.set(n,r):t.delete(n)}function Gt(e,t,n,r){if(!x(t))return!1;let i={text:t.text,attachments:t.attachments?[...t.attachments]:[],contextReferences:t.contextReferences?[...t.contextReferences]:[],selectedCapabilities:t.selectedCapabilities?[...t.selectedCapabilities]:[]},a=e.querySelector(`message-editor`),o=a?.querySelector(`textarea`);return!a&&!o?!1:(a&&(a.value=i.text,a.attachments=i.attachments,a.contextReferences=i.contextReferences,a.selectedCapabilities=i.selectedCapabilities,a.requestUpdate?.(),a.onInput?.(i.text),a.onFilesChange?.(i.attachments)),o&&(o.value=i.text,o.dispatchEvent(new Event(`input`,{bubbles:!0})),o.focus()),n.set(r,i),!0)}function Kt(e,t,n,r,i={}){let a=!0,o,s=new Set,c=()=>{o!==void 0&&(window.cancelAnimationFrame(o),o=void 0);for(let e of s)window.clearTimeout(e);s.clear()},l=()=>{a&&(a=!1,c())},u=()=>{if(a){if(i.shouldApply&&!i.shouldApply()){l();return}i.onApplyStart?.();try{if(!Gt(e,t,n,r))return;i.onApplied?.(),l()}finally{i.onApplyEnd?.()}}};if(u(),a){o=window.requestAnimationFrame(u);for(let e of[0,50,150,300,600]){let t=window.setTimeout(()=>{s.delete(t),u()},e);s.add(t)}i.updateComplete?.then(u)}return{cancel:l}}function V(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`)}function qt(e){return e.split(`
|
|
20
|
+
`).map(e=>{let t=V(e);return e.startsWith(`+`)?`<span style="color:rgb(22 101 52);background:rgba(34,197,94,.14);display:block;">${t}</span>`:e.startsWith(`-`)?`<span style="color:rgb(153 27 27);background:rgba(239,68,68,.12);display:block;">${t}</span>`:e.startsWith(`@@`)?`<span style="color:rgb(37 99 235);background:rgba(37,99,235,.10);display:block;">${t}</span>`:`<span style="display:block;">${t||` `}</span>`}).join(`
|
|
21
|
+
`)}function Jt(e,t){let n=e.split(`
|
|
22
|
+
`),r=t.split(`
|
|
23
|
+
`),i=[];for(let e of n)i.push(`<span style="color:rgb(153 27 27);background:rgba(239,68,68,.12);display:block;">- ${V(e)}</span>`);for(let e of r)i.push(`<span style="color:rgb(22 101 52);background:rgba(34,197,94,.14);display:block;">+ ${V(e)}</span>`);return i.join(`
|
|
24
|
+
`)}function Yt(e){return JSON.stringify({tone:e.tone,disabled:e.disabled,disabledReason:e.disabledReason,copy:{status:e.status,title:e.title,risk:e.risk,approve:e.approveLabel,reject:e.rejectLabel},toolDisplayName:e.toolDisplayName,badges:e.badges,criticalParameters:e.criticalParameters,keySummary:e.keySummary,details:e.details,integration:e.integration})}var Xt=`.quickforge-approval-card`,Zt={manage_global_memory:`manageGlobalMemory`,read_file:`readFile`,grep_files:`searchFiles`,write_file:`writeFile`,edit_file:`editFile`,run_command:`runCommand`,present_files:`presentFiles`,activate_skill:`activateSkill`,read_skill_resource:`readSkillResource`,run_subagent:`runSubagent`,generate_image:`generateImage`};function Qt(e){if(typeof e!=`string`||!e.startsWith(`mcp__`))return null;let t=e.slice(5),n=t.indexOf(`__`);return n<=0||n>=t.length-2?null:{serverName:t.slice(0,n),toolName:t.slice(n+2)}}function $t(e){if(typeof e!=`string`||!e.startsWith(`plugin__`))return null;let t=e.slice(8),n=t.indexOf(`__`);return n<=0||n>=t.length-2?null:{pluginName:t.slice(0,n),toolName:t.slice(n+2)}}function en(e,t=v){let n=Zt[e];if(n)return t(n);let r=Qt(e);if(r)return`MCP · ${r.serverName} · ${r.toolName}`;let i=$t(e);return i?`Plugin · ${i.pluginName} · ${i.toolName}`:e}function tn(e,t){return typeof t.summary==`string`?t.summary:e===`run_command`&&typeof t.command==`string`?t.command:e===`activate_skill`&&typeof t.name==`string`?t.name:e===`read_skill_resource`&&typeof t.path==`string`||typeof t.path==`string`?t.path:typeof t.query==`string`?t.query:typeof t.name==`string`?t.name:``}function nn(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function rn({toolName:e,args:t,source:n,tone:r=`warning`,copy:i,disabled:a=!1,disabledReason:o=``,translate:s=v}){let c=Qt(e),l=$t(e),u=en(e,s),d=[];c?d.push({label:s(`toolApprovalSource`),value:`MCP`},{label:s(`toolApprovalServer`),value:c.serverName},{label:s(`toolApprovalTool`),value:c.toolName}):l&&d.push({label:s(`toolApprovalSource`),value:`Plugin`},{label:s(`toolApprovalPlugin`),value:l.pluginName},{label:s(`toolApprovalTool`),value:l.toolName}),typeof t.path==`string`&&t.path&&d.push({label:s(`toolApprovalPath`),value:t.path}),typeof t.command==`string`&&t.command&&d.push({label:s(`toolApprovalCommand`),value:t.command});let f=n?.type===`subagent`?n.label||n.subagent||`Subagent`:``,p=[...c?[`MCP`]:[],...l?[`Plugin`]:[],...f?[f]:[]],m=typeof t.keepRecentTurns==`number`?t.keepRecentTurns:3,h=r===`info`?s(`autoCompactApprovalRisk`,{keepRecentTurns:m}):s(e===`run_command`?`toolApprovalRiskCommand`:e===`write_file`||e===`edit_file`?`toolApprovalRiskFileChange`:c||l?`toolApprovalRiskExternal`:`toolApprovalRiskGeneric`);return{tone:r,status:i?.status??s(r===`info`?`autoCompactApprovalStatus`:`toolApprovalNeedsConfirmation`),title:i?.title??(r===`info`?s(`autoCompactApprovalTitle`):u),risk:i?.risk??h,approveLabel:i?.approve??s(r===`info`?`autoCompactApprovalAccept`:`toolApprovalAccept`),rejectLabel:i?.reject??s(r===`info`?`autoCompactApprovalReject`:`toolApprovalReject`),toolDisplayName:u,badges:p,criticalParameters:d,keySummary:tn(e,t),details:nn(t),disabled:a,disabledReason:a?o||s(`toolApprovalDisabled`):``,integration:c?`mcp`:l?`plugin`:null}}function an(e){return e.role===`user`||e.role===`user-with-attachments`||e.role===`assistant`}function on(e){return e.role===`user`||e.role===`user-with-attachments`}function sn(e,t,n){if(n<=0||t.length===0)return null;let r=[];for(let e=0;e<t.length;e++)on(t[e])&&r.push(e);if(r.length===0)return null;let i=Math.min(n,r.length),a=r[r.length-i],o=e.querySelector(`message-list`);if(!o)return null;let s=Array.from(o.querySelectorAll(`user-message, assistant-message`)).filter(e=>e.closest(`message-list`)===o),c=0;for(let e=0;e<=a;e++)if(an(t[e])){if(e===a)return s[c]??null;c+=1}return null}function cn(e){return e===`info`?`<svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="9"/><path d="M12 11v5"/><path d="M12 8h.01"/></svg>`:`<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0Z"/><path d="M12 9v4"/><path d="M12 17h.01"/></svg>`}function ln(e,t,n){let r=n.criticalParameters.map(({label:n,value:r})=>e===`run_command`&&r===t.command?``:`<div class="quickforge-approval-impact-row"><span>${V(n)}</span><strong>${V(r)}</strong></div>`).join(``),i=``;if(e===`run_command`&&typeof t.command==`string`)i=`<pre class="quickforge-approval-code"><span class="quickforge-approval-prompt">$</span> ${V(t.command)}</pre>`;else if(e===`edit_file`)i=`<pre class="quickforge-approval-code">${Jt(String(t.oldText??``),String(t.newText??``))}</pre>`;else if(e===`write_file`&&typeof t.content==`string`){let e=t.content.length>800;i=`<pre class="quickforge-approval-code">${qt(t.content.slice(0,800))}${e?`\n${V(v(`toolApprovalTruncated`))}`:``}</pre>`}else n.keySummary&&!n.criticalParameters.some(({value:e})=>e===n.keySummary)&&(i=`<pre class="quickforge-approval-code">${V(n.keySummary)}</pre>`);return r||i?`<div class="quickforge-approval-impact">${r}${i}</div>`:``}function un(e,t,n,r,i){let{panel:a,onApprove:o,onReject:s}=e,c=rn({toolName:t,args:r,source:i,tone:e.tone,copy:e.copy,disabled:e.disabled,disabledReason:e.disabledReason}),l=Yt(c);if(a.querySelector(`.quickforge-approval-card[data-tool-call-id="${CSS.escape(n)}"]`)?.dataset.displaySignature===l)return;dn(a);let u=document.createElement(`section`);u.className=`quickforge-approval-card quickforge-approval-card--${c.tone}`,u.dataset.toolCallId=n,u.dataset.displaySignature=l;let d=document.createElement(`div`);d.className=`quickforge-approval-body`,d.innerHTML=`
|
|
25
|
+
<div class="quickforge-approval-status-row">
|
|
26
|
+
<div class="quickforge-approval-status">${cn(c.tone)}<span>${V(c.status)}</span></div>
|
|
27
|
+
${c.badges.length?`<div class="quickforge-approval-badges">${c.badges.map(e=>`<span class="quickforge-approval-badge">${V(e)}</span>`).join(``)}</div>`:``}
|
|
28
|
+
</div>
|
|
29
|
+
<h3 class="quickforge-approval-title">${V(c.title)}</h3>
|
|
30
|
+
<p class="quickforge-approval-risk">${V(c.risk)}</p>
|
|
31
|
+
${ln(t,r,c)}
|
|
32
|
+
`,u.append(d);let f=document.createElement(`div`);f.className=`quickforge-approval-details`;let p=document.createElement(`button`);p.type=`button`,p.className=`quickforge-approval-details-toggle`,p.setAttribute(`aria-expanded`,`false`),p.innerHTML=`<svg viewBox="0 0 24 24" aria-hidden="true"><path d="m9 18 6-6-6-6"/></svg>`;let m=document.createElement(`span`);m.textContent=v(`toolApprovalViewDetails`),p.append(m);let h=document.createElement(`div`);h.className=`quickforge-approval-details-content`,h.innerHTML=`<pre class="quickforge-approval-code">${V(c.details)}</pre>`,p.addEventListener(`click`,e=>{e.stopPropagation();let t=f.classList.toggle(`quickforge-approval-details--open`);p.setAttribute(`aria-expanded`,String(t)),m.textContent=v(t?`toolApprovalHideDetails`:`toolApprovalViewDetails`)}),f.append(p,h),d.append(f);let g=document.createElement(`div`);g.className=`quickforge-approval-message`,c.disabledReason?(g.textContent=c.disabledReason,g.classList.add(`quickforge-approval-message--disabled`)):g.hidden=!0,d.append(g);let _=document.createElement(`div`);_.className=`quickforge-approval-actions`;let y=document.createElement(`button`),b=document.createElement(`button`);y.type=`button`,y.className=`quickforge-approval-button quickforge-approval-button--primary`,y.textContent=c.approveLabel,b.type=`button`,b.className=`quickforge-approval-button quickforge-approval-button--reject`,b.textContent=c.rejectLabel;let x=(e,t)=>{y.disabled=e||c.disabled,b.disabled=e||c.disabled,y.classList.toggle(`quickforge-approval-button--loading`,e&&t===y),b.classList.toggle(`quickforge-approval-button--loading`,e&&t===b),e&&t&&(t.textContent=v(`toolApprovalSubmitting`))},S=async(e,t,n)=>{g.hidden=!0,g.textContent=``,g.classList.remove(`quickforge-approval-message--disabled`),x(!0,t);try{await e()}catch(e){g.textContent=e instanceof Error&&e.message?e.message:v(`toolApprovalFailed`),g.hidden=!1,t.textContent=v(`toolApprovalRetry`);let n=t===y?b:y;n.textContent=t===y?c.rejectLabel:c.approveLabel,x(!1),t.textContent=v(`toolApprovalRetry`);return}t.textContent=n};y.addEventListener(`click`,e=>{e.stopPropagation(),e.preventDefault(),S(o,y,c.approveLabel)}),b.addEventListener(`click`,e=>{e.stopPropagation(),e.preventDefault(),S(s,b,c.rejectLabel)}),x(!1),_.append(b,y),d.append(_);let C=e.keepRecentTurns?sn(a,e.getMessages?.()??[],e.keepRecentTurns):null,w=a.querySelector(`message-list`);C?C.before(u):w?w.append(u):a.querySelector(`agent-interface`)?.append(u),C||u.scrollIntoView({behavior:`smooth`,block:`end`})}function dn(e){e.querySelectorAll(Xt).forEach(e=>e.remove())}var fn=`.quickforge-ask-card`;function pn(e){return e?Array.isArray(e.choices)&&e.choices.length>0?!0:typeof e.custom==`string`&&e.custom.trim().length>0:!1}function mn(e){return[Array.isArray(e?.choices)&&e.choices.length?e.choices.join(` · `):``,typeof e?.custom==`string`&&e.custom.trim()?e.custom.trim():``].filter(Boolean).join(` 补充:`)}function hn(e,t){return JSON.stringify({askId:e.askId,count:e.questions.length,disabled:t})}function gn(e,t){let{panel:n}=e,r=e.disabled===!0,i=hn(t,r);if(n.querySelector(`${fn}[data-ask-id="${CSS.escape(t.askId)}"]`)?.dataset.displaySignature===i)return;_n(n);let a=t.questions,o=a.map(()=>({})),s=0,c=document.createElement(`section`);c.className=`quickforge-ask-card`,c.dataset.askId=t.askId,c.dataset.displaySignature=i;let l=document.createElement(`div`);l.className=`quickforge-ask-head`,l.innerHTML=`
|
|
33
|
+
<svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>
|
|
34
|
+
<span class="quickforge-ask-who">${V(v(`askUserTitle`))}</span>
|
|
35
|
+
<span class="quickforge-ask-waiting"><span class="quickforge-ask-dot"></span><span class="quickforge-ask-progress"></span></span>
|
|
36
|
+
`;let u=document.createElement(`div`);u.className=`quickforge-ask-dots`,u.innerHTML=a.map(()=>`<span class="quickforge-ask-step"></span>`).join(``);let d=document.createElement(`div`);d.className=`quickforge-ask-body`;let f=document.createElement(`div`);f.className=`quickforge-ask-message`,f.hidden=!0;let p=document.createElement(`div`);p.className=`quickforge-ask-actions`;let m=document.createElement(`button`);m.type=`button`,m.className=`quickforge-ask-button quickforge-ask-button--ghost`,m.textContent=v(`askUserBack`);let h=document.createElement(`button`);h.type=`button`,h.className=`quickforge-ask-button quickforge-ask-button--ghost`,h.textContent=v(`askUserNext`);let g=document.createElement(`button`);g.type=`button`,g.className=`quickforge-ask-button quickforge-ask-button--primary`,g.textContent=v(`askUserSubmit`);let _=document.createElement(`button`);_.type=`button`,_.className=`quickforge-ask-button quickforge-ask-button--ghost`,_.textContent=v(`askUserSkip`);let y=document.createElement(`span`);y.className=`quickforge-ask-note`,p.append(m,h,g,_,y),c.append(l,u,d,f,p);let b=()=>{let e=s>=a.length,t=a[s];if(l.querySelector(`.quickforge-ask-progress`).textContent=e?v(`askUserReviewTitle`):v(`askUserProgress`,{current:String(s+1),total:String(a.length)}),Array.from(u.children).forEach((t,n)=>{t.className=`quickforge-ask-step`+(n<s||e&&n<=a.length-1?` quickforge-ask-step--done`:``)+(n===s?` quickforge-ask-step--current`:``)}),m.style.visibility=s>0&&!e||e?`visible`:`hidden`,h.style.display=!e&&(t.multiSelect===!0||t.allowCustom!==!1)?``:`none`,g.style.display=e?``:`none`,_.style.display=e?`none`:``,e){y.textContent=``,d.innerHTML=`
|
|
37
|
+
<div class="quickforge-ask-review">
|
|
38
|
+
${a.map((e,t)=>`
|
|
39
|
+
<div class="quickforge-ask-review-row">
|
|
40
|
+
<div class="quickforge-ask-review-content">
|
|
41
|
+
<span class="quickforge-ask-review-question">${V(`${t+1}. ${e.question}`)}</span>
|
|
42
|
+
<span class="quickforge-ask-review-answer">${V(mn(o[t])||v(`askUserUnanswered`))}</span>
|
|
43
|
+
</div>
|
|
44
|
+
<button type="button" class="quickforge-ask-review-edit" data-review-index="${t}">${V(v(`askUserEdit`))}</button>
|
|
45
|
+
</div>
|
|
46
|
+
`).join(``)}
|
|
47
|
+
</div>
|
|
48
|
+
`,d.querySelectorAll(`.quickforge-ask-review-edit`).forEach(e=>{e.addEventListener(`click`,()=>{let t=Number(e.dataset.reviewIndex);t<0||t>=a.length||(f.hidden=!0,C(),s=t,b())})}),d.classList.remove(`quickforge-ask-body--enter`);return}let n=t.multiSelect===!0,i=t.allowCustom!==!1;y.textContent=v(n?`askUserMultiHint`:`askUserAutoAdvanceHint`),d.innerHTML=`
|
|
49
|
+
<div class="quickforge-ask-question">
|
|
50
|
+
${V(`${s+1}. ${t.question}`)}
|
|
51
|
+
<span class="quickforge-ask-chip">${V(v(n?`askUserMultiChip`:`askUserSingleChip`))}</span>
|
|
52
|
+
</div>
|
|
53
|
+
<div class="quickforge-ask-options">
|
|
54
|
+
${(t.options??[]).map((e,t)=>`
|
|
55
|
+
<button type="button" class="quickforge-ask-option${o[s].choices?.includes(e.label)?` quickforge-ask-option--picked`:``}" data-option-index="${t}">
|
|
56
|
+
<span class="quickforge-ask-check"></span>
|
|
57
|
+
<span class="quickforge-ask-option-body">
|
|
58
|
+
<span class="quickforge-ask-option-label">${V(e.label)}</span>
|
|
59
|
+
${e.description?`<span class="quickforge-ask-option-desc">${V(e.description)}</span>`:``}
|
|
60
|
+
</span>
|
|
61
|
+
${n?``:`<span class="quickforge-ask-option-arrow" aria-hidden="true">→</span>`}
|
|
62
|
+
</button>
|
|
63
|
+
`).join(``)}
|
|
64
|
+
</div>
|
|
65
|
+
${i?`<button type="button" class="quickforge-ask-custom-toggle">${V(v(`askUserCustomToggle`))}</button>
|
|
66
|
+
<div class="quickforge-ask-custom" hidden>
|
|
67
|
+
<textarea class="quickforge-ask-custom-input" rows="3" placeholder="${V(v(`askUserCustomPlaceholder`))}"></textarea>
|
|
68
|
+
</div>`:``}
|
|
69
|
+
`,d.querySelectorAll(`.quickforge-ask-option`).forEach(e=>{e.disabled=r,e.addEventListener(`click`,()=>{let r=Number(e.dataset.optionIndex),i=t.options?.[r]?.label;if(typeof i!=`string`)return;let a=o[s];if(a.choices=a.choices??[],n){let e=a.choices.indexOf(i);e>=0?a.choices.splice(e,1):a.choices.push(i)}else{a.choices=[i],T();return}e.classList.toggle(`quickforge-ask-option--picked`,a.choices.includes(i))})});let c=d.querySelector(`.quickforge-ask-custom-toggle`),p=d.querySelector(`.quickforge-ask-custom`),x=d.querySelector(`.quickforge-ask-custom-input`);c?.addEventListener(`click`,()=>{if(!p||!x)return;let e=p.hidden;p.hidden=!e,e&&(x.value=x.value||o[s].custom||``,x.disabled=r,x.focus())}),x?.addEventListener(`input`,()=>{o[s].custom=x.value}),x?.addEventListener(`keydown`,e=>{if(e.key===`Enter`&&!e.shiftKey){if(e.preventDefault(),!pn(o[s])){E(v(`askUserNeedAnswer`));return}T()}})},x=!1,S,C=()=>{S!==void 0&&window.clearTimeout(S),S=void 0,x=!1,_.textContent=v(`askUserSkip`)},w=!1,T=()=>{w||(C(),w=!0,d.classList.add(`quickforge-ask-body--leaving`),window.setTimeout(()=>{w=!1,s=Math.min(s+1,a.length),d.classList.remove(`quickforge-ask-body--leaving`),b(),d.classList.add(`quickforge-ask-body--enter`),window.setTimeout(()=>d.classList.remove(`quickforge-ask-body--enter`),220)},150))},E=e=>{f.textContent=e,f.hidden=!1};h.addEventListener(`click`,()=>{if(!pn(o[s])){E(v(`askUserNeedAnswer`));return}T()}),m.addEventListener(`click`,()=>{f.hidden=!0,C(),s=Math.max(0,s-1),b()});let D=e=>{g.disabled=e||r,_.disabled=e||r,h.disabled=e||r,m.disabled=e,e?g.textContent=v(`askUserSubmitting`):g.textContent=v(`askUserSubmit`)};g.addEventListener(`click`,t=>{t.stopPropagation(),t.preventDefault(),f.hidden=!0,C(),D(!0),Promise.resolve(e.onSubmit(o.map(e=>({...e})))).catch(()=>{E(v(`askUserFailed`)),D(!1)})}),_.addEventListener(`click`,t=>{if(t.stopPropagation(),t.preventDefault(),f.hidden=!0,!x){x=!0,_.textContent=v(`askUserSkipConfirm`),S=window.setTimeout(C,5e3);return}C(),D(!0),Promise.resolve(e.onSkip()).catch(()=>{E(v(`askUserFailed`)),D(!1)})}),r&&(_.disabled=!0,e.disabledReason?E(e.disabledReason):e.disabledReason||E(v(`askUserUnavailable`))),D(!1),b();let O=n.querySelector(`message-list`);O?O.append(c):n.querySelector(`agent-interface`)?.append(c),c.scrollIntoView({behavior:`smooth`,block:`end`})}function _n(e){e.querySelectorAll(fn).forEach(e=>e.remove())}function vn(e,t,n){let r=v(`copied`),i=Number(e.dataset.quickforgeCopyFeedbackTimer);i&&window.clearTimeout(i),E(e,qe),e.title=r,e.setAttribute(`aria-label`,r),e.style.color=`rgb(5 150 105)`;let a=window.setTimeout(()=>{E(e,n),e.title=t,e.setAttribute(`aria-label`,t),e.style.color=``,delete e.dataset.quickforgeCopyFeedbackTimer},1200);e.dataset.quickforgeCopyFeedbackTimer=String(a)}function yn(e){return e.role===`user`||e.role===`user-with-attachments`||e.role===`assistant`}function bn(e){return e.role===`user`||e.role===`user-with-attachments`}function xn(e,t){for(let n=Math.min(t,e.length-1);n>=0;n--)if(bn(e[n]))return n;return 0}function Sn(e){let t=e.querySelector(`message-list`);return t?Array.from(t.querySelectorAll(`user-message, assistant-message`)).filter(e=>e.closest(`message-list`)===t):[]}function Cn(e,t,n,r){let i=Sn(e),a=0;for(let e=0;e<t.length;e++)if(yn(t[e])){if(e===n){let e=i[a];if(e){r.nextElementSibling!==e&&e.before(r);return}break}a+=1}let o=e.querySelector(`message-list`);o&&o.firstElementChild!==r&&o.prepend(r)}function wn(e){let t=e,n=t?.role===`assistant`?f(t):A(t);return(n.match(/<compact_summary>\s*([\s\S]*?)\s*<\/compact_summary>/i)?.[1]??n).trim()}function Tn(e,t,n=!1){let r=e.querySelector(`.quickforge-context-compaction-details`),i=e.querySelector(`.quickforge-context-compaction-summary`),a=e.querySelector(`.quickforge-context-compaction-toggle-label`),o=e.querySelector(`[data-quickforge-action="copy-compact-summary"]`);r&&(r.open=n);let s=()=>{a&&r&&(a.textContent=r.open?v(`contextCompactedHideSummary`):v(`contextCompactedViewSummary`))};i&&!i.dataset.quickforgeCompactionBound&&(i.dataset.quickforgeCompactionBound=`true`,i.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),r&&(r.open=!r.open,s())})),r&&!r.dataset.quickforgeCompactionBound&&(r.dataset.quickforgeCompactionBound=`true`,r.addEventListener(`toggle`,s)),s(),o&&(o.onclick=async e=>{e.preventDefault(),e.stopPropagation(),await h(t),vn(o,v(`contextCompactedCopySummary`),I)})}function En(e){let{panel:t,getMessages:n,getContextCompaction:r,messageIndexOffset:i=0}=e,a=r(),o=n(),s=t.querySelector(`.quickforge-context-compaction-notice`);if(!a||o.length===0){s?.remove();return}let c=Math.max(0,Number(a.compactedUpToIndex)||0),l=i+o.length;if(c<=0||c>=l){s?.remove();return}let u=xn(o,Math.max(0,c-i)),d=a.summaryMessage?wn(a.summaryMessage):``,f=s?.querySelector(`.quickforge-context-compaction-details`)?.open??!1,p=s??document.createElement(`div`),m=p.dataset.summaryText??``,h=p.dataset.hasSummary===`true`,g=!s||m!==d||h!==!!d;p.className=`quickforge-context-compaction-notice`,p.dataset.tailStart=String(u),p.dataset.summaryText=d,p.dataset.hasSummary=String(!!d),p.title=v(`contextCompactedTooltip`),p.setAttribute(`aria-label`,v(`contextCompactedTooltip`)),g&&(p.innerHTML=d?`
|
|
70
|
+
<details class="quickforge-context-compaction-details">
|
|
71
|
+
<summary class="quickforge-context-compaction-summary">
|
|
72
|
+
<div class="quickforge-context-compaction-line"></div>
|
|
73
|
+
<div class="quickforge-context-compaction-pill">
|
|
74
|
+
<span class="quickforge-context-compaction-dot" aria-hidden="true"></span>
|
|
75
|
+
<span><strong>${V(v(`contextCompactedLabel`))}</strong> · ${V(v(`contextCompactedTimelineLabel`))} · <span class="quickforge-context-compaction-toggle-label"></span></span>
|
|
76
|
+
</div>
|
|
77
|
+
<div class="quickforge-context-compaction-line"></div>
|
|
78
|
+
</summary>
|
|
79
|
+
<div class="quickforge-context-compaction-card">
|
|
80
|
+
<div class="quickforge-context-compaction-card-header">
|
|
81
|
+
<span>${V(v(`contextCompactedSummaryTitle`))}</span>
|
|
82
|
+
<button type="button" class="quickforge-context-compaction-copy" data-quickforge-action="copy-compact-summary">${I}<span>${V(v(`contextCompactedCopySummary`))}</span></button>
|
|
83
|
+
</div>
|
|
84
|
+
<pre class="quickforge-context-compaction-text">${V(d)}</pre>
|
|
85
|
+
</div>
|
|
86
|
+
</details>
|
|
87
|
+
`:`
|
|
88
|
+
<div class="quickforge-context-compaction-summary" role="separator">
|
|
89
|
+
<div class="quickforge-context-compaction-line"></div>
|
|
90
|
+
<div class="quickforge-context-compaction-pill">
|
|
91
|
+
<span class="quickforge-context-compaction-dot" aria-hidden="true"></span>
|
|
92
|
+
<span><strong>${V(v(`contextCompactedLabel`))}</strong> · ${V(v(`contextCompactedTimelineLabel`))}</span>
|
|
93
|
+
</div>
|
|
94
|
+
<div class="quickforge-context-compaction-line"></div>
|
|
95
|
+
</div>
|
|
96
|
+
`),d&&Tn(p,d,f),Cn(t,o,u,p)}function Dn(e){let{panel:t,isDegraded:n}=e,r=t.querySelector(`.quickforge-persist-degraded-notice`);if(!n()){r?.remove();return}let i=v(`persistDegradedWarning`);if(r){let e=r.querySelector(`.quickforge-persist-degraded-text`);e&&e.textContent!==i&&(e.textContent=i);return}let a=document.createElement(`div`);a.className=`quickforge-persist-degraded-notice`,a.setAttribute(`role`,`alert`),a.innerHTML=`<span class="quickforge-persist-degraded-dot" aria-hidden="true"></span><span class="quickforge-persist-degraded-text">${V(i)}</span>`;let o=t.querySelector(`message-list`);o&&o.firstElementChild!==a&&o.prepend(a)}function On(e){return String(e).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function kn(e){return Number.isFinite(e)?e>=1e6?`${(e/1e6).toFixed(e>=1e7?0:1)}M`:e>=1e3?`${(e/1e3).toFixed(e>=1e4?0:1)}k`:String(Math.round(e)):``}function An(e){let t=[v(`openCodeUsageTokensTitle`,{used:kn(e.used)||`0`,size:kn(e.size)||`0`})];return e.cost&&Number.isFinite(e.cost.amount)&&t.push(v(`openCodeUsageCostTitle`,{amount:e.cost.amount,currency:e.cost.currency})),t.join(`
|
|
97
|
+
`)}function jn(e){let t=`${kn(e.used)} / ${kn(e.size)} tokens`;return e.cost&&Number.isFinite(e.cost.amount)?`${t} · ${e.cost.amount} ${e.cost.currency}`:t}function Mn({panel:e,getAcpSession:t}){return{update:()=>{let n=t()?.usage??null,r=e.querySelector(`.quickforge-opencode-usage-inline`),i=e.querySelector(`message-editor`)?.parentElement?.querySelector(`.ml-auto.items-center`);if(!n||!i){r?.remove();return}let a=An(n),o=jn(n);if(r){if(r.dataset.quickforgeOpenCodeUsage===o)return;r.dataset.quickforgeOpenCodeUsage=o,r.innerHTML=`<span class="quickforge-opencode-usage-text">${On(o)}</span>`,r.title=a,r.setAttribute(`aria-label`,a);return}let s=document.createElement(`span`);s.className=`quickforge-opencode-usage-inline`,s.dataset.quickforgeOpenCodeUsage=o,s.title=a,s.setAttribute(`aria-label`,a),s.innerHTML=`<span class="quickforge-opencode-usage-text">${On(o)}</span>`,i.prepend(s)},cleanup:()=>{}}}var H=`.quickforge-process-group`,Nn=`.quickforge-process-body`,Pn=`.quickforge-process-tools`,Fn=`.quickforge-process-tools-body`,In=`.quickforge-process-stage`,Ln=`.quickforge-process-stage-body`,Rn=`thinking-block, tool-message`,U=`thinking-block, tool-message, markdown-block`,zn=`data-quickforge-process-final-summary`,Bn=`data-quickforge-process-folded`,Vn=500,Hn=new Set([`edit_file`,`write_file`]),Un=new WeakMap,Wn=new WeakMap,W=new WeakMap,Gn=1;function Kn(e){let t=Un.get(e);return t||(t=new Map,Un.set(e,t)),t}function qn(e,t,n){let r=Kn(e);if(r.set(t,n),r.size<=Vn)return;let i=r.keys().next().value;i&&r.delete(i)}function Jn(e){return e.findIndex(e=>e.connected)}function Yn(e){let t=Wn.get(e);return t===void 0&&(t=Gn++,Wn.set(e,t)),t}function Xn(e,t,n){let r=er(t[0]?.message?.timestamp);return`scope:${Yn(e)}:turn:${n}:started:${r??`unknown`}`}function Zn(e,t,n,r){return e===void 0?t?n:r:e}function Qn(e,t,n,r=!1){let i=t.dataset.quickforgeProcessKey;t.dataset.quickforgeProcessKey=n;let a=Kn(e).get(n),o=Zn(a,i===n,t.dataset.expanded===`true`,r);t.dataset.expanded=String(o),a===void 0&&r&&qn(e,n,o)}function G(e){return!!(e&&typeof e==`object`&&!Array.isArray(e))}function $n(e){return typeof e==`number`&&Number.isFinite(e)?e:void 0}function er(e){if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e==`string`){let t=e.trim();if(!t)return;let n=Number(t);if(Number.isFinite(n))return n;let r=Date.parse(t);return Number.isNaN(r)?void 0:r}}function tr(e){if(!G(e))return;let t=e.details;if(!G(t))return;let n=t.quickforgeTiming;if(G(n))return{startedAt:$n(n.startedAt),finishedAt:$n(n.finishedAt),durationMs:$n(n.durationMs)}}function nr(e){let t=tr(e.result);if(t?.finishedAt!==void 0)return t.finishedAt;if(t?.startedAt!==void 0&&t.durationMs!==void 0)return t.startedAt+t.durationMs}function rr(e){return tr(e.result)?.startedAt}function ir(e){if(G(e.details))return er(e.details.quickforgeProcessFinishedAt)}function ar(e){let t=e.map(ir).filter(e=>e!==void 0);return t.length>0?Math.max(...t):void 0}function or(e){if(e===void 0||e<1e3)return``;let t=Math.max(1,Math.round(e/1e3)),n=Math.floor(t/60),r=t%60;return n>0?v(`processDurationMinutesSeconds`,{minutes:n,seconds:r}):v(`processDurationSeconds`,{seconds:r})}function K(e){return e.tool?.name||e.toolCall?.name||``}function sr(e){return e!==`run_subagent`&&e!==`generate_image`}function cr(e){return e.tagName.toLowerCase()===`tool-message`&&sr(K(e))}function lr(e){return e.aborted?!0:G(e.result)&&e.result.isError===!0}function ur(e){if(!Hn.has(K(e)))return;let t=e.toolCall?.arguments?.path;if(typeof t==`string`&&t.trim())return t.trim();let n=G(e.result)?e.result.details:void 0,r=G(n)?n.path:void 0;return typeof r==`string`&&r.trim()?r.trim():void 0}function dr(e){let t=Array.from(e),n=t.map(ur),r=new Set(n.filter(e=>!!e)),i=t.length>0&&t.every(e=>Hn.has(K(e))),a=n.every(e=>e!==void 0);return{count:t.length,errorCount:t.filter(lr).length,commandsOnly:t.length>0&&t.every(e=>K(e)===`run_command`),...i&&a?{editedFileCount:r.size}:{}}}function fr(e){let t=Array.from(e),n=t.map(ur),r=new Set(n.filter(e=>!!e));return{toolCallCount:t.length,commandCount:t.filter(e=>K(e)===`run_command`).length,editedFileCount:r.size}}function pr(e,t){let n=[];e.toolCallCount>0&&n.push(v(`processGroupToolsCalled`,{count:e.toolCallCount})),e.commandCount>0&&n.push(v(`processGroupCommandsRan`,{count:e.commandCount})),e.editedFileCount>0&&n.push(v(`processGroupFilesEdited`,{count:e.editedFileCount}));let r=v(t?`processExecuting`:`processExecuted`);return n.length>0?`${r} ${n.join(` · `)}`:r}function mr(e){let t=v(e.commandsOnly?`processCommandsRan`:e.editedFileCount===void 0?`processToolsCalled`:`processFilesEdited`,{count:e.editedFileCount??e.count});return e.errorCount>0?`${t} · ${v(`processToolsFailedCount`,{count:e.errorCount})}`:t}function hr(e,t){return[e,t].filter(Boolean).join(` · `)}function gr(e,t,n){let r=Xr(t).map(({node:e})=>e).filter(e=>e.tagName.toLowerCase()===`tool-message`),i=[...e.map(e=>er(e.message?.timestamp)),...r.map(rr)].filter(e=>e!==void 0),a=[ar(e.map(e=>e.message??{})),...r.map(nr)].filter(e=>e!==void 0),o=i.length>0?Math.min(...i):void 0,s=a.length>0?Math.max(...a):void 0;if(n)s=Date.now();else{let e=er(t.dataset.quickforgeFinishedAt);e!==void 0&&e>0?s=e:(s??=Date.now(),t.dataset.quickforgeFinishedAt=String(s))}let c=o!==void 0&&s!==void 0?or(Math.max(0,s-o)):``,l=[...e].reverse().find(e=>e.message?.stopReason)?.message?.stopReason;return hr(v(l===`error`?`processFailed`:l===`aborted`?`processAborted`:n?`processExecuting`:`processExecuted`),c)}function _r(e){return e.closest(`message-list`)}function vr(e,t){return e.closest(`message-list`)===_r(t)&&Lr(e)}function yr(e){return Array.from(e.querySelectorAll(H)).filter(t=>t.closest(`assistant-message`)===e)}function br(e){let t=e.querySelector(`${U}, ${H}`);return t?.closest(`.px-4.flex.flex-col`)??t?.parentElement??null}function xr(){let e=document.createElement(`div`);return e.className=`quickforge-process-step`,e}function Sr(){return`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 18V5"/><path d="M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4"/><path d="M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5"/><path d="M17.997 5.125a4 4 0 0 1 2.526 5.77"/><path d="M18 18a4 4 0 0 0 2-7.464"/><path d="M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517"/><path d="M6 18a4 4 0 0 1-2-7.464"/><path d="M6.003 5.125a4 4 0 0 0-2.526 5.77"/></svg>`}function Cr(){return`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="18" height="14" x="3" y="5" rx="2"/><path d="m7 9 3 3-3 3"/><path d="M13 15h4"/></svg>`}function wr(e){let t=e.map((e,t)=>({child:e,index:t})).filter(({child:e})=>!e.quickforgeIcon),n=t.find(({child:e})=>e.markedChevron)??t.find(({child:e})=>e.hasSvg),r=t.find(({child:e,index:t})=>e.markedLabel&&t!==n?.index)??t.find(({index:e})=>e!==n?.index);return{chevronIndex:n?.index,labelIndex:r?.index,chevronExpanded:n?.child.rotated===!0}}function Tr(e){e.querySelectorAll(`thinking-block`).forEach(t=>{if(t.closest(H)!==e)return;let n=t.querySelector(`:scope > .thinking-block > .thinking-header`);if(!n)return;let r=Array.from(n.children).filter(e=>e instanceof HTMLElement),{chevronIndex:i,labelIndex:a,chevronExpanded:o}=wr(r.map(e=>({quickforgeIcon:e.dataset.quickforgeThinkingRole===`icon`||e.classList.contains(`quickforge-process-thinking-icon`),markedChevron:e.dataset.quickforgeThinkingRole===`chevron`,markedLabel:e.dataset.quickforgeThinkingRole===`label`,hasSvg:!!e.querySelector(`svg`),rotated:e.classList.contains(`rotate-90`)||e.classList.contains(`quickforge-process-thinking-chevron-expanded`)}))),s=i===void 0?void 0:r[i],c=a===void 0?void 0:r[a];if(!s||!c)return;s.dataset.quickforgeThinkingRole=`chevron`,c.dataset.quickforgeThinkingRole=`label`,s.className=`quickforge-process-thinking-chevron`,s.classList.toggle(`quickforge-process-thinking-chevron-expanded`,o),c.className=`quickforge-process-thinking-label`,c.textContent=v(`processThinking`);let l=r.find(e=>e.dataset.quickforgeThinkingRole===`icon`||e.classList.contains(`quickforge-process-thinking-icon`));l||(l=document.createElement(`span`),l.setAttribute(`aria-hidden`,`true`),l.innerHTML=Sr()),l.dataset.quickforgeThinkingRole=`icon`,l.classList.add(`quickforge-process-thinking-icon`),n.prepend(l),n.append(c,s),n.className=`thinking-header quickforge-process-thinking-header`})}function Er(){let e=document.createElement(`div`);e.className=`quickforge-process-tools`,e.dataset.expanded=`false`;let t=document.createElement(`button`);t.type=`button`,t.className=`quickforge-process-tools-summary`,t.innerHTML=`
|
|
98
|
+
<span class="quickforge-process-tools-icon" aria-hidden="true">
|
|
99
|
+
${Cr()}
|
|
100
|
+
</span>
|
|
101
|
+
<span class="quickforge-process-tools-label"></span>
|
|
102
|
+
<span class="quickforge-process-tools-chevron" aria-hidden="true">
|
|
103
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6"/></svg>
|
|
104
|
+
</span>
|
|
105
|
+
`;let n=document.createElement(`div`);return n.className=`quickforge-process-tools-body`,e.append(t,n),e}function Dr(){let e=document.createElement(`div`);e.className=`quickforge-process-stage`,e.dataset.expanded=`false`;let t=document.createElement(`button`);t.type=`button`,t.className=`quickforge-process-stage-summary`,t.innerHTML=`
|
|
106
|
+
<span class="quickforge-process-stage-label"></span>
|
|
107
|
+
<span class="quickforge-process-stage-chevron" aria-hidden="true">
|
|
108
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6"/></svg>
|
|
109
|
+
</span>
|
|
110
|
+
`;let n=document.createElement(`div`);return n.className=`quickforge-process-stage-body`,e.append(t,n),e}function Or(){let e=document.createElement(`div`);e.className=`quickforge-process-group`,e.dataset.expanded=`false`;let t=document.createElement(`button`);t.type=`button`,t.className=`quickforge-process-summary`,t.innerHTML=`
|
|
111
|
+
<span class="quickforge-process-label"></span>
|
|
112
|
+
<span class="quickforge-process-chevron" aria-hidden="true">
|
|
113
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6"/></svg>
|
|
114
|
+
</span>
|
|
115
|
+
`;let n=document.createElement(`div`);return n.className=`quickforge-process-body`,e.append(t,n),e}function kr(){return!1}function Ar(e,t){return`${e}:stage:${t}`}function jr(e,t,n,r){let i=Array.from(n.querySelectorAll(In)).filter(e=>e.closest(H)===n);i.forEach((n,a)=>{let o=n.querySelector(`:scope > ${Ln}`),s=n.querySelector(`:scope > .quickforge-process-stage-summary`),c=n.querySelector(`:scope > .quickforge-process-stage-summary > .quickforge-process-stage-label`);if(!o||!s||!c)return;let l=Ar(t,a),u=`quickforge-${l.replace(/[^a-z0-9_-]+/gi,`-`)}`,d=n.dataset.quickforgeProcessKey;n.dataset.quickforgeProcessKey=l;let f=Zn(Kn(e).get(l),d===l,n.dataset.expanded===`true`,kr());n.dataset.expanded=String(f);let p=r&&a===i.length-1;c.textContent=pr(fr(o.querySelectorAll(`tool-message`)),p),o.id=u,s.setAttribute(`aria-controls`,u),s.setAttribute(`aria-expanded`,String(f)),s.setAttribute(`aria-label`,`${c.textContent} · ${v(f?`collapseProcess`:`expandProcess`)}`),s.onclick=t=>{t.preventDefault(),t.stopPropagation();let r=n.dataset.expanded!==`true`;n.dataset.expanded=String(r),qn(e,l,r),s.setAttribute(`aria-expanded`,String(r)),s.setAttribute(`aria-label`,`${c.textContent} · ${v(r?`collapseProcess`:`expandProcess`)}`)}})}function Mr(e,t,n){return t?`${e}:tools:${t}`:`${e}:tools:${n}`}function Nr(e,t,n){return Mr(e,Array.from(t.querySelectorAll(`tool-message`))[0]?.toolCall?.id,n)}function Pr(e,t,n){n.querySelectorAll(Pn).forEach((r,i)=>{if(r.closest(H)!==n)return;let a=r.querySelector(`:scope > ${Fn}`),o=r.querySelector(`.quickforge-process-tools-summary`),s=r.querySelector(`.quickforge-process-tools-label`);if(!a||!o||!s)return;let c=dr(a.querySelectorAll(`:scope > tool-message`));if(r.hidden=c.count===0,c.count===0)return;let l=Nr(t,r,i),u=`quickforge-${l.replace(/[^a-z0-9_-]+/gi,`-`)}`;a.id=u,o.setAttribute(`aria-controls`,u);let d=g().toolDisplayMode===`detailed`,f=d?`detailed`:`compact`,p=r.dataset.quickforgeProcessKey,m=r.dataset.quickforgeToolDisplayMode;r.dataset.quickforgeProcessKey=l,r.dataset.quickforgeToolDisplayMode=f;let h=Zn(Kn(e).get(l),p===l&&m===f,r.dataset.expanded===`true`,d);r.dataset.expanded=String(h),s.textContent=mr(c),o.setAttribute(`aria-expanded`,String(h)),o.setAttribute(`aria-label`,v(h?`collapseProcessTools`:`expandProcessTools`)),o.onclick=t=>{t.preventDefault(),t.stopPropagation();let n=r.dataset.expanded===`false`;r.dataset.expanded=String(n),qn(e,l,n),o.setAttribute(`aria-expanded`,String(n)),o.setAttribute(`aria-label`,v(n?`collapseProcessTools`:`expandProcessTools`))}})}function Fr(e,t,n={}){return t===`pointerdown`?e&&(n.button??0)===0&&n.isPrimary!==!1:!e||(n.detail??0)===0}function Ir(e,t,n,r,i){Qn(e,r,t,i),r.dataset.streaming=String(i);let a=r.querySelector(`:scope > ${Nn}`),o=r.querySelector(`.quickforge-process-summary`),s=r.querySelector(`.quickforge-process-label`);if(!a||!o||!s)return;let c=gr(n,r,i);s.textContent!==c&&(s.textContent=c);let l=r.dataset.expanded===`true`,u=`quickforge-${t.replace(/[^a-z0-9_-]+/gi,`-`)}`;a.id=u,o.setAttribute(`aria-controls`,u),o.setAttribute(`aria-expanded`,String(l)),o.setAttribute(`aria-label`,`${c} · ${v(l?`collapseProcess`:`expandProcess`)}`);let d=()=>{let n=r.dataset.expanded!==`true`;r.dataset.expanded=String(n),qn(e,t,n),o.setAttribute(`aria-expanded`,String(n)),o.setAttribute(`aria-label`,`${c} · ${v(n?`collapseProcess`:`expandProcess`)}`)};o.onpointerdown=e=>{Fr(i,`pointerdown`,e)&&(e.stopPropagation(),d())},o.onclick=e=>{e.preventDefault(),e.stopPropagation(),Fr(i,`click`,e)&&d()},jr(e,t,r,i),Pr(e,t,r),Tr(r)}function q(e,t,n){if(n){e.hasAttribute(t)||e.setAttribute(t,`true`);return}e.hasAttribute(t)&&e.removeAttribute(t)}function Lr(e){let t=e.closest(`message-list`),n=e.parentElement?.closest(U);return!n||n.closest(`message-list`)!==t}function Rr(e){let t=_r(e);return Array.from(e.querySelectorAll(`markdown-block`)).filter(e=>{if(e.closest(`message-list`)!==t)return!1;let n=e.parentElement?.closest(Rn);return!n||n.closest(`message-list`)!==t})}function zr(e){let t=e.filter(e=>(e.textContent??``).trim().length>0);return t[t.length-1]??e[e.length-1]??null}function Br(e,t){return Array.from(e.querySelectorAll(U)).filter(n=>n!==t&&vr(n,e)).some(e=>!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING))}function Vr(e,t){let n=Rr(e);if(t){let t=zr(n);return t&&!Br(e,t)?t:null}return zr(n.filter(e=>e.hasAttribute(zn)))||(zr(n.filter(e=>!e.closest(Nn)))??zr(n))}function Hr(e,t){Rr(e).forEach(e=>{q(e,zn,e===t),e===t&&q(e,Bn,!1)})}function Ur(e){return e.length>1||e.some(e=>Array.from(e.querySelectorAll(Rn)).some(t=>t.closest(`message-list`)===_r(e)))}function Wr(e){let t=new Map;return e.forEach(e=>{yr(e).forEach(e=>{W.get(e)?.forEach(e=>t.set(e.node,e))})}),e.flatMap(e=>Array.from(e.querySelectorAll(U)).filter(t=>vr(t,e)).map(n=>t.get(n)??{node:n,sourceAssistant:e,sourceParent:n.parentElement,sourceNextSibling:n.nextSibling}))}function Gr(e,t,n,r){return e.filter(e=>!t(e)&&(!n(e)||r))}function Kr(e,t,n){return Gr(Wr(e),e=>e.node===t,e=>e.node.tagName.toLowerCase()===`markdown-block`,n)}function qr(e,t){let n=[],r=[],i=!1,a=()=>{r.length!==0&&(n.push({kind:i?`stage`:`detail`,items:r}),r=[])};for(let o of e)t(o)?(a(),n.push({kind:`detail`,items:[o]}),i=!0):r.push(o);return a(),n}function Jr(e,t){let n=[];for(let r of e){let e=t(r)?`tools`:`detail`,i=n[n.length-1];i?.kind===e?i.items.push(r):n.push({kind:e,items:[r]})}return n}function Yr(e){return!!e.querySelector(`${Nn} ${U}`)}function Xr(e){return W.get(e)??Array.from(e.querySelectorAll(`${Nn} ${U}`)).filter(t=>t.closest(H)===e).map(t=>({node:t,sourceAssistant:e.closest(`assistant-message`)??e.parentElement,sourceParent:e.parentElement,sourceNextSibling:e}))}function Zr(e,t){let{node:n,sourceParent:r,sourceNextSibling:i}=e;if(q(n,Bn,!1),q(n,zn,!1),r?.isConnected){i?.parentNode===r?r.insertBefore(n,i):r.append(n);return}let a=br(e.sourceAssistant);a?a.insertBefore(n,a.querySelector(H)):t.parentElement?.insertBefore(n,t)}function Qr(e,t){return!e||t}function $r(e){if(!e.sourceAssistant.isConnected)return!1;let t=e.node.tagName.toLowerCase(),n=t===`tool-message`?e.node.toolCall?.id:void 0;return Array.from(e.sourceAssistant.querySelectorAll(Rn)).filter(t=>t!==e.node&&!t.closest(H)).filter(t=>vr(t,e.sourceAssistant)).some(e=>e.tagName.toLowerCase()===t?t!==`tool-message`||!n?!0:e.toolCall?.id===n:!1)}function ei(e){q(e.node,Bn,!1),q(e.node,zn,!1),e.node.remove()}function ti(e,t=!1){let n=new Set(e);for(let r of e)r.classList.remove(`quickforge-process-source-empty`),yr(r).forEach(e=>{Xr(e).slice().reverse().forEach(r=>{t&&Qr(n.has(r.sourceAssistant),$r(r))?ei(r):Zr(r,e)}),W.delete(e),e.remove()})}function ni(e){e.querySelectorAll(`${H}[data-streaming="true"]`).forEach(e=>{let t=Xr(e),n=new Set(t.map(e=>e.sourceAssistant)),r=e.closest(`assistant-message`);r&&n.add(r),n.forEach(e=>e.classList.remove(`quickforge-process-source-empty`)),t.slice().reverse().forEach(t=>Zr(t,e)),W.delete(e),e.remove()})}function ri(e,t){return!!(e&&e.length===t.length&&e.every((e,n)=>e.node.isConnected&&e.node===t[n]?.node&&e.sourceAssistant===t[n]?.sourceAssistant))}function ii(e,t){let n=xr(),r=Jr(t,e=>cr(e.node));for(let e of r){if(e.kind===`tools`){let t=Er(),r=t.querySelector(Fn);if(!r)continue;e.items.forEach(({node:e})=>{q(e,Bn,!0),r.append(e)}),n.append(t);continue}e.items.forEach(({node:e})=>{q(e,Bn,!0),n.append(e)})}e.append(n)}function ai(e,t){let n=e.querySelector(`:scope > ${Nn}`);if(!n)return!1;let r=qr(t,e=>e.node.tagName.toLowerCase()===`markdown-block`);for(let e of r){if(e.kind===`detail`){ii(n,e.items);continue}let t=Dr(),r=t.querySelector(Ln);r&&(ii(r,e.items),n.append(t))}return W.set(e,t),Yr(e)}function oi(e,t){let n=Jn(e.map(e=>({connected:e.sourceParent?.isConnected===!0&&e.node.isConnected}))),r=n>=0?e[n]:void 0,i=[...t].reverse().find(e=>e.isStreaming!==!0),a=i?br(i):null;if(!r?.sourceParent?.isConnected&&!a)return null;let o=Or();return r?.sourceParent?.isConnected?r.sourceParent.insertBefore(o,r.node):a&&a.append(o),ai(o,e)?o:null}function si(e){let t=e?.stopReason;return(t===`error`||t===`aborted`)&&typeof e?.errorMessage==`string`&&e.errorMessage.trim().length>0}function ci(e){for(let t of e){let e=si(t.message)||!!Array.from(t.querySelectorAll(`markdown-block, thinking-block, tool-message, .quickforge-process-group, .quickforge-approval-card`)).some(e=>e.closest(`message-list`)===_r(t));t.classList.toggle(`quickforge-process-source-empty`,!e)}}function li(e){let t=new Map(e.map((e,t)=>[e,t])),n=Wr(e).map(({node:e,sourceAssistant:n})=>{let r=t.get(n)??0,i=e.tagName.toLowerCase();if(i!==`tool-message`)return`${r}:${i}`;let a=e;return`${r}:${i}:${a.toolCall?.id??K(a)}`});return`${e.length}|${n.join(`|`)}`}function ui(e,t,n,r,i=!0){return!n||!r||!i?`full`:e?`update`:t?`skip`:`full`}function di(e,t,n){return!e&&t&&n}function fi(e,t,n,r,i){if(t.length===0)return;let a=Xn(e,t,r),o=t[t.length-1],s=t.flatMap(yr),c=s.length===1?s[0]:void 0,l=li(t),u=Ur(t),d=Kr(t,u?Vr(o,n):null,u),f=!c||ri(W.get(c),d),p=ui(n,i,!!c,c?.dataset.quickforgeProcessFp===l,f);if(p===`skip`)return;if(p===`update`&&c){Ir(e,a,t,c,!0);return}if(d.length===0&&di(!1,s.length>0,e.dataset.quickforgeProcessHandoff!==void 0))return;ti(t,!0);let m=Ur(t),h=m?Vr(o,n):null;m&&Hr(o,h);let g=Kr(t,h,m);if(g.length===0)return;let _=oi(g,t);_&&(_.dataset.quickforgeProcessFp=l,Ir(e,a,t,_,n),ci(t))}function pi(e,t,n){let r=t[t.length-1]?.tagName.toLowerCase()===`assistant-message`,i=[],a=[];for(let e of t){if(e.tagName.toLowerCase()===`user-message`){a.length>0&&i.push(a),a=[];continue}a.push(e)}a.length>0&&i.push(a),i.forEach((t,a)=>{let o=n&&r&&a===i.length-1;fi(e,t,o,a,n&&!o)})}var mi=/<\s*(script|foreignObject|iframe|object|embed)\b|\son[a-z]+\s*=|(?:javascript|vbscript|data\s*:\s*text\/html)\s*:/i,hi=/\b(?:href|xlink:href|src)\s*=\s*(["'])\s*(?:https?:)?\/\//i,gi=/url\(\s*(["']?)\s*(?:https?:)?\/\//i,_i=/@import\s+(?:url\(\s*)?["']?\s*(?:https?:)?\/\//i,vi=null,yi=0;function bi(e){return String(e??``).trim().toLowerCase()===`mermaid`}function xi(e){let t=e.trim();return/^<svg[\s>]/i.test(t)&&/<\/svg>\s*$/i.test(t)&&!mi.test(t)&&!hi.test(t)&&!gi.test(t)&&!_i.test(t)}function Si(e){if(!xi(e))throw Error(`Unsafe Mermaid SVG output`);return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`}async function Ci(){return vi??=u(async()=>{let{default:e}=await import(`./mermaid.core-CwXTzYjs.js`);return{default:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])).then(({default:e})=>(e.initialize({startOnLoad:!1,securityLevel:`strict`,theme:`neutral`,htmlLabels:!1}),e)),vi}async function wi(e){let t=e.trim();if(!t)throw Error(`Mermaid source is empty`);if(t.length>1e5)throw Error(`Mermaid source is too large`);let n=await Ci(),r=`quickforge-mermaid-${Date.now().toString(36)}-${++yi}`,{svg:i}=await n.render(r,t);if(!xi(i))throw Error(`Unsafe Mermaid SVG output`);return i}var Ti=new Set([`bash`,`sh`,`shell`,`zsh`,`fish`,`cmd`,`bat`,`batch`,`powershell`,`ps1`,`terminal`,`console`]),Ei=/\b(rm\s+-rf|sudo|chmod\b|chown\b|npm\s+publish|pnpm\s+publish|yarn\s+publish|git\s+push|curl\b[^\n|;]*\|\s*(sh|bash)|wget\b[^\n|;]*\|\s*(sh|bash))\b/i,Di=/<\s*(script|foreignObject)\b|\son[a-z]+\s*=|javascript\s*:/i;function Oi(e,t,n){let r=v(`copied`),i=Number(e.dataset.quickforgeCopyFeedbackTimer);i&&window.clearTimeout(i),E(e,qe),e.title=r,e.setAttribute(`aria-label`,r),e.style.color=`rgb(5 150 105)`;let a=window.setTimeout(()=>{E(e,n),e.title=t,e.setAttribute(`aria-label`,t),e.style.color=``,delete e.dataset.quickforgeCopyFeedbackTimer},1200);e.dataset.quickforgeCopyFeedbackTimer=String(a)}function ki(e,t,n,r){let i=document.createElement(`button`);return i.type=`button`,i.dataset.quickforgeAction=e,i.title=t,i.setAttribute(`aria-label`,t),E(i,n),i.className=`pointer-events-auto inline-flex size-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-transparent hover:text-foreground disabled:cursor-not-allowed disabled:opacity-40`,i.onclick=e=>{e.stopPropagation(),r(i)},i}function J(e){if(typeof e.getDecodedCode==`function`)try{return e.getDecodedCode()}catch{}let t=typeof e.code==`string`?e.code:e.getAttribute(`code`)??``;if(!t)return``;try{return decodeURIComponent(escape(window.atob(t)))}catch{return t}}function Ai(e){return e.replace(/\r\n/g,`
|
|
116
|
+
`).split(`
|
|
117
|
+
`).map(e=>e.replace(/^\s*\$\s+/,``).replace(/^\s*>\s+/,``).replace(/^\s*PS\s+[^>\n]+>\s+/i,``)).join(`
|
|
118
|
+
`).trim()}function ji(e){return e.split(`
|
|
119
|
+
`).map(e=>e.trim()).filter(Boolean).length}function Mi(e){let t=String(e.language??e.getAttribute(`language`)??``).trim().toLowerCase();return Ti.has(t)}function Ni(e){return String(e.language??e.getAttribute(`language`)??``).trim().toLowerCase()===`svg`}function Pi(e){let t=e.trim();return/^<svg[\s>]/i.test(t)&&/<\/svg>\s*$/i.test(t)&&!Di.test(t)}function Fi(e){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`}function Ii(){let e=document.querySelector(`.quickforge-svg-code-lightbox`);e?.quickforgeCleanup?.(),e?.remove()}function Li(e,t=`SVG preview`){Ii();let n=document.createElement(`div`);n.className=`quickforge-svg-code-lightbox`,n.setAttribute(`role`,`dialog`),n.setAttribute(`aria-modal`,`true`),n.setAttribute(`aria-label`,t);let r=document.createElement(`img`);r.alt=t,r.src=e,r.addEventListener(`click`,e=>e.stopPropagation()),n.append(r);let i=()=>Ii(),a=e=>{e.key===`Escape`&&i()};n.quickforgeCleanup=()=>document.removeEventListener(`keydown`,a),n.addEventListener(`click`,i),document.addEventListener(`keydown`,a),document.body.append(n)}function Ri(e,t,n){let r=new Blob([t],{type:n}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=e,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}function zi(e){let t=0;for(let n=0;n<e.length;n++)t=Math.imul(31,t)+e.charCodeAt(n)|0;return`${e.length}:${t}`}function Bi(e){e.nextElementSibling instanceof HTMLElement&&e.nextElementSibling.dataset.quickforgeSvgPreview===`true`&&e.nextElementSibling.remove(),e.querySelector(`[data-quickforge-svg-preview="true"]`)?.remove(),e.classList.contains(`quickforge-mermaid-code-block`)||e.classList.remove(`quickforge-svg-code-block`),e.querySelector(`copy-button[data-quickforge-svg-original-copy="true"]`)?.removeAttribute(`hidden`),e.querySelector(`copy-button[data-quickforge-svg-original-copy="true"]`)?.removeAttribute(`data-quickforge-svg-original-copy`),e.querySelector(`[data-quickforge-svg-toolbar="true"]`)?.remove();let t=e.querySelector(`pre`)?.parentElement,n=e.querySelector(`[data-quickforge-mermaid-preview="true"]`)!==null;t instanceof HTMLElement&&!n&&(t.hidden=!1),delete e.dataset.quickforgeSvgPreviewSource,delete e.dataset.quickforgeSvgMode}function Vi(e,t){let n=e.querySelector(`[data-quickforge-svg-preview="true"]`),r=e.querySelector(`:scope > div > div:first-child`),i=e.querySelector(`pre`)?.parentElement;e.dataset.quickforgeSvgMode=t,n&&(n.hidden=t!==`preview`),r&&r.classList.toggle(`quickforge-svg-code-toolbar-floating`,t===`preview`),i instanceof HTMLElement&&(i.hidden=t===`preview`)}function Y(e,t,n){let r=document.createElement(`button`);return r.type=`button`,r.dataset.quickforgeAction=e,r.className=`quickforge-svg-code-menu-item`,r.title=t,r.setAttribute(`aria-label`,t),r.setAttribute(`role`,`menuitem`),E(r,n),r}function Hi(e=document,t){e.querySelectorAll(`.quickforge-svg-code-menu[open]`).forEach(e=>{e!==t&&(e.open=!1)})}var Ui=!1;function Wi(){Ui||(Ui=!0,document.addEventListener(`pointerdown`,e=>{e.target?.closest(`.quickforge-svg-code-menu`)||Hi(document)},!0),document.addEventListener(`keydown`,e=>{e.key===`Escape`&&Hi(document)}))}function Gi(e,t){Wi();let n=e.querySelector(`:scope > div > div:first-child`),r=n?.querySelector(`copy-button`);if(!n||!r)return;let i=n.querySelector(`[data-quickforge-svg-toolbar="true"]`);if(!i){i=document.createElement(`div`),i.dataset.quickforgeSvgToolbar=`true`,i.className=`quickforge-svg-code-toolbar`;let e=document.createElement(`details`);e.className=`quickforge-svg-code-menu`;let t=document.createElement(`summary`);t.className=`quickforge-svg-code-menu-trigger`,t.title=v(`moreActions`),t.setAttribute(`aria-label`,v(`moreActions`)),t.textContent=`⋯`;let n=document.createElement(`div`);n.className=`quickforge-svg-code-menu-content`,n.setAttribute(`role`,`menu`);let a=Y(`svg-preview-mode`,v(`svgPreviewMode`),`<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"/><circle cx="12" cy="12" r="3"/></svg>`),o=Y(`svg-source-mode`,v(`svgSourceMode`),`<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m16 18 6-6-6-6"/><path d="m8 6-6 6 6 6"/></svg>`),s=Y(`copy-svg-code`,v(`copySvgSource`),I),c=Y(`download-svg-code`,v(`downloadSvg`),`<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="M7 10l5 5 5-5"/><path d="M12 15V3"/></svg>`);n.append(a,o,s,c),r.before(i),r.dataset.quickforgeSvgOriginalCopy=`true`,r.setAttribute(`hidden`,``),e.append(t,n),i.append(e)}let a=i.querySelector(`.quickforge-svg-code-menu`),o=i.querySelector(`[data-quickforge-action="svg-preview-mode"]`),s=i.querySelector(`[data-quickforge-action="svg-source-mode"]`),c=i.querySelector(`[data-quickforge-action="copy-svg-code"]`),l=i.querySelector(`[data-quickforge-action="download-svg-code"]`),u=()=>{a&&(a.open=!1)};a&&!a.dataset.quickforgeSvgMenuBound&&(a.dataset.quickforgeSvgMenuBound=`true`,a.addEventListener(`toggle`,()=>{a.open&&Hi(e.closest(`markdown-block`)??document,a)})),o&&(o.onclick=()=>{Vi(e,`preview`),u()}),s&&(s.onclick=()=>{Vi(e,`source`),u()}),c&&(c.onclick=async()=>{await h(t),Oi(c,v(`copySvgSource`),I)}),l&&(l.onclick=()=>{Ri(`quickforge-svg-${Date.now()}.svg`,t,`image/svg+xml;charset=utf-8`),u()})}function Ki(e,t){e.querySelectorAll(`assistant-message markdown-block code-block`).forEach(e=>{if(!Ni(e)){Bi(e);return}if(t)return;let n=J(e).trim();if(!n||!Pi(n)){Bi(e);return}let r=zi(n);if(e.querySelector(`[data-quickforge-svg-preview="true"]`)&&e.dataset.quickforgeSvgPreviewSource===r){Gi(e,n),Vi(e,e.dataset.quickforgeSvgMode===`source`?`source`:`preview`);return}let i=e.querySelector(`:scope > div > div:first-child`);if(!i)return;Bi(e);let a=document.createElement(`div`);e.classList.add(`quickforge-svg-code-block`),a.dataset.quickforgeSvgPreview=`true`,a.className=`quickforge-svg-code-preview`,a.setAttribute(`aria-label`,`SVG preview`);let o=document.createElement(`img`);o.alt=`SVG preview`,o.src=Fi(n),o.title=v(`svgEnlargePreview`),o.addEventListener(`click`,()=>Li(o.src)),a.replaceChildren(o),i.after(a),Gi(e,n),e.dataset.quickforgeSvgPreviewSource=r,Vi(e,e.dataset.quickforgeSvgMode===`source`?`source`:`preview`)})}var qi=0;function Ji(e){return bi(String(e.language??e.getAttribute(`language`)??``))}function Yi(e){let t=e.classList.contains(`quickforge-mermaid-code-block`);if(!(t||e.dataset.quickforgeMermaidRequestToken!==void 0||e.dataset.quickforgeMermaidPendingSource!==void 0||e.dataset.quickforgeMermaidPreviewSource!==void 0||e.dataset.quickforgeMermaidFailedSource!==void 0||e.querySelector(`[data-quickforge-mermaid-preview="true"], [data-quickforge-mermaid-error="true"], [data-quickforge-mermaid-toolbar="true"], copy-button[data-quickforge-mermaid-original-copy="true"]`)!==null))return;e.dataset.quickforgeMermaidRequestToken&&(e.dataset.quickforgeMermaidRequestToken=String(++qi)),e.querySelector(`[data-quickforge-mermaid-preview="true"]`)?.remove(),e.querySelector(`[data-quickforge-mermaid-error="true"]`)?.remove(),e.querySelector(`[data-quickforge-mermaid-toolbar="true"]`)?.remove(),e.classList.remove(`quickforge-mermaid-code-block`),t&&!e.querySelector(`[data-quickforge-svg-preview="true"]`)&&e.classList.remove(`quickforge-svg-code-block`),e.querySelector(`copy-button[data-quickforge-mermaid-original-copy="true"]`)?.removeAttribute(`hidden`),e.querySelector(`copy-button[data-quickforge-mermaid-original-copy="true"]`)?.removeAttribute(`data-quickforge-mermaid-original-copy`);let n=e.querySelector(`pre`)?.parentElement,r=e.querySelector(`[data-quickforge-svg-preview="true"]`)!==null;n instanceof HTMLElement&&!r&&(n.hidden=!1),delete e.dataset.quickforgeMermaidMode,delete e.dataset.quickforgeMermaidPreviewSource,delete e.dataset.quickforgeMermaidPendingSource,delete e.dataset.quickforgeMermaidFailedSource,delete e.dataset.quickforgeMermaidRequestToken}function Xi(e,t){let n=e.querySelector(`[data-quickforge-mermaid-preview="true"]`),r=e.querySelector(`:scope > div > div:first-child`),i=e.querySelector(`pre`)?.parentElement;e.dataset.quickforgeMermaidMode=t,n&&(n.hidden=t!==`preview`),r&&r.classList.toggle(`quickforge-svg-code-toolbar-floating`,t===`preview`),i instanceof HTMLElement&&(i.hidden=t===`preview`)}function Zi(e,t,n){Wi();let r=e.querySelector(`:scope > div > div:first-child`),i=r?.querySelector(`copy-button`);if(!r||!i)return;let a=r.querySelector(`[data-quickforge-mermaid-toolbar="true"]`);if(!a){a=document.createElement(`div`),a.dataset.quickforgeMermaidToolbar=`true`,a.className=`quickforge-svg-code-toolbar`;let e=document.createElement(`details`);e.className=`quickforge-svg-code-menu quickforge-mermaid-code-menu`;let t=document.createElement(`summary`);t.className=`quickforge-svg-code-menu-trigger`,t.title=v(`moreActions`),t.setAttribute(`aria-label`,v(`moreActions`)),t.textContent=`⋯`;let n=document.createElement(`div`);n.className=`quickforge-svg-code-menu-content`,n.setAttribute(`role`,`menu`);let r=Y(`mermaid-preview-mode`,v(`svgPreviewMode`),`<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"/><circle cx="12" cy="12" r="3"/></svg>`),o=Y(`mermaid-source-mode`,v(`svgSourceMode`),`<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m16 18 6-6-6-6"/><path d="m8 6-6 6 6 6"/></svg>`),s=Y(`copy-mermaid-code`,v(`copyMermaidSource`),I),c=Y(`download-mermaid-svg`,v(`downloadMermaidSvg`),`<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="M7 10l5 5 5-5"/><path d="M12 15V3"/></svg>`);n.append(r,o,s,c),i.before(a),i.dataset.quickforgeMermaidOriginalCopy=`true`,i.setAttribute(`hidden`,``),e.append(t,n),a.append(e)}let o=a.querySelector(`.quickforge-mermaid-code-menu`),s=a.querySelector(`[data-quickforge-action="mermaid-preview-mode"]`),c=a.querySelector(`[data-quickforge-action="mermaid-source-mode"]`),l=a.querySelector(`[data-quickforge-action="copy-mermaid-code"]`),u=a.querySelector(`[data-quickforge-action="download-mermaid-svg"]`),d=()=>{o&&(o.open=!1)};o&&!o.dataset.quickforgeMermaidMenuBound&&(o.dataset.quickforgeMermaidMenuBound=`true`,o.addEventListener(`toggle`,()=>{o.open&&Hi(e.closest(`markdown-block`)??document,o)})),s&&(s.onclick=()=>{Xi(e,`preview`),d()}),c&&(c.onclick=()=>{Xi(e,`source`),d()}),l&&(l.onclick=async()=>{await h(t),Oi(l,v(`copyMermaidSource`),I)}),u&&(u.onclick=()=>{Ri(`quickforge-mermaid-${Date.now()}.svg`,n,`image/svg+xml;charset=utf-8`),d()})}function Qi(e){let t=e.querySelector(`:scope > div > div:first-child`);if(!t||e.querySelector(`[data-quickforge-mermaid-error="true"]`))return;let n=document.createElement(`div`);n.dataset.quickforgeMermaidError=`true`,n.className=`quickforge-mermaid-code-error`,n.textContent=v(`mermaidRenderFailed`),t.after(n)}function $i(e,t){e.querySelectorAll(`assistant-message markdown-block code-block`).forEach(n=>{try{if(!Ji(n)){Yi(n);return}let r=J(n).trim();if(!r){Yi(n);return}let i=zi(r);if(n.querySelector(`[data-quickforge-mermaid-preview="true"]`)&&n.dataset.quickforgeMermaidPreviewSource===i){Xi(n,n.dataset.quickforgeMermaidMode===`source`?`source`:`preview`);return}if(t){(n.dataset.quickforgeMermaidPendingSource||n.dataset.quickforgeMermaidPreviewSource)&&Yi(n);return}if(n.dataset.quickforgeMermaidPendingSource===i||n.dataset.quickforgeMermaidFailedSource===i||!n.querySelector(`:scope > div > div:first-child`))return;Yi(n);let a=String(++qi);n.dataset.quickforgeMermaidRequestToken=a,n.dataset.quickforgeMermaidPendingSource=i,(async()=>{try{let t=await wi(r);if(!t)throw Error(`Empty Mermaid SVG`);let o=Si(t);if(!n.isConnected||n.dataset.quickforgeMermaidRequestToken!==a||e.dataset.quickforgeAgentStreaming===`true`||!Ji(n)||zi(J(n).trim())!==i){n.dataset.quickforgeMermaidRequestToken===a&&(delete n.dataset.quickforgeMermaidPendingSource,delete n.dataset.quickforgeMermaidRequestToken);return}let s=n.querySelector(`:scope > div > div:first-child`);if(!s){delete n.dataset.quickforgeMermaidPendingSource,delete n.dataset.quickforgeMermaidRequestToken;return}let c=document.createElement(`div`);c.dataset.quickforgeMermaidPreview=`true`,c.className=`quickforge-svg-code-preview quickforge-mermaid-code-preview`,c.setAttribute(`aria-label`,v(`mermaidPreviewLabel`));let l=document.createElement(`img`);l.alt=v(`mermaidPreviewLabel`),l.src=o,l.title=v(`mermaidEnlargePreview`),l.addEventListener(`click`,()=>Li(l.src,v(`mermaidPreviewLabel`))),c.replaceChildren(l),n.classList.add(`quickforge-svg-code-block`,`quickforge-mermaid-code-block`),s.after(c),Zi(n,r,t),n.dataset.quickforgeMermaidPreviewSource=i,delete n.dataset.quickforgeMermaidPendingSource,delete n.dataset.quickforgeMermaidFailedSource,delete n.dataset.quickforgeMermaidRequestToken,Xi(n,`preview`)}catch{if(!n.isConnected||n.dataset.quickforgeMermaidRequestToken!==a||!Ji(n)||zi(J(n).trim())!==i)return;delete n.dataset.quickforgeMermaidPendingSource,delete n.dataset.quickforgeMermaidRequestToken,n.dataset.quickforgeMermaidFailedSource=i,Qi(n)}})()}catch{Yi(n),Qi(n)}})}function ea(e,t){e.querySelectorAll(`assistant-message markdown-block code-block`).forEach(e=>{let n=e.querySelector(`[data-quickforge-action="execute-markdown-command"]`);if(!Mi(e)){n?.remove(),delete e.dataset.quickforgeCommand;return}let r;if(n&&e.dataset.quickforgeCommand!==void 0){if(n.disabled===t)return;r=e.dataset.quickforgeCommand}else r=Ai(J(e));if(!r){n?.remove(),delete e.dataset.quickforgeCommand;return}e.dataset.quickforgeCommand=r;let i=v(`executeInTerminal`),a=n??ki(`execute-markdown-command`,i,`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polygon points="6 3 20 12 6 21 6 3"/></svg>`,()=>{let t=Ai(J(e));t&&window.dispatchEvent(new CustomEvent(`quickforge:execute-markdown-command`,{detail:{command:t,confirm:ji(t)>1,dangerous:Ei.test(t)}}))});if(a.title=i,a.setAttribute(`aria-label`,i),a.disabled=t,a.className=`pointer-events-auto inline-flex size-8 items-center justify-center rounded-md text-emerald-600 transition-colors hover:bg-emerald-500/10 hover:text-emerald-700 disabled:cursor-not-allowed disabled:opacity-40 dark:text-emerald-400 dark:hover:text-emerald-300`,!n){let t=e.querySelector(`:scope > div > div:first-child`),n=t?.querySelector(`copy-button`);if(t&&n){let e=document.createElement(`div`);e.className=`flex items-center gap-1`,n.before(e),e.appendChild(n),e.appendChild(a)}}})}var ta=/[A-Za-z]:[\\/][^\s"'<>`]+|(?:\/Users|\/home|\/workspace|\/mnt|\/Volumes)\/[^\s"'<>`]+/g,na=new Set([`.`,`,`,`;`,`:`,`!`,`?`,`)`,`]`,`}`,`>`,`。`,`,`,`;`,`:`,`!`,`?`,`)`,`】`,`》`]),ra=[`pre`,`code`,`a`,`button`,`textarea`,`input`,`select`,`thinking-block`,`tool-message`,`.quickforge-file-path-link`,`.quickforge-message-actions`,`.quickforge-process-group`,`.quickforge-approval-card`].join(`,`);function ia(e){let t=e.length;for(;t>0&&na.has(e[t-1]);)--t;return{path:e.slice(0,t),suffix:e.slice(t)}}function aa(e,t){let n=document.createElement(`button`);return n.type=`button`,n.className=`quickforge-file-path-link`,n.dataset.quickforgeFilePath=e,n.textContent=e,n.title=`Open file`,n.setAttribute(`aria-label`,`Open file ${e}`),n.onclick=n=>{n.preventDefault(),n.stopPropagation(),t(e)},n}function oa(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(e){let t=e.textContent??``;if(!ta.test(t))return NodeFilter.FILTER_REJECT;ta.lastIndex=0;let n=e.parentElement;return!n||n.closest(ra)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),r=n.nextNode();for(;r;)t.push(r),r=n.nextNode();return t}function sa(e,t){let n=e.textContent??``;ta.lastIndex=0;let r,i=0,a=document.createDocumentFragment(),o=!1;for(;r=ta.exec(n);){let e=r[0],{path:s,suffix:c}=ia(e);if(!s)continue;let l=r.index,u=l+e.length;l>i&&a.append(document.createTextNode(n.slice(i,l))),a.append(aa(s,t)),c&&a.append(document.createTextNode(c)),i=u,o=!0}o&&(i<n.length&&a.append(document.createTextNode(n.slice(i))),e.replaceWith(a))}function ca(e,t,n){let r=Array.from(e.querySelectorAll(`markdown-block`)),i=r.reduce((e,t)=>e+(t.textContent?.length??0),0),a=f(t).length,o=`${String(t.timestamp??``)}:${a}:${r.length}:${i}`;e.dataset.quickforgeLocalPathSignature!==o&&(r.forEach(e=>{oa(e).forEach(e=>sa(e,n))}),e.dataset.quickforgeLocalPathSignature=o)}var la=e(n(),1),ua=a(),da=Object.fromEntries(Object.entries({command:r,skill:t,agent:i}).map(([e,t])=>[e,(0,ua.renderToStaticMarkup)((0,la.createElement)(t,{size:16,strokeWidth:1.8,"aria-hidden":!0}))])),fa=`quickforge-slash-source-text`,pa=/^\/(skill|agent)[\s]+(\S+)(?=\s|$)/i;function ma(e){let t=pa.exec(e);return t?{kind:t[1].toLowerCase(),name:t[2],cmd:`/${t[1]} ${t[2]}`}:null}function ha(e,t){if(!e.toLowerCase().startsWith(t.toLowerCase()))return!1;let n=e.charAt(t.length);return n===``||/\s/.test(n)}function ga(e){let t=ma(e);if(!t)return null;let n=e.slice(t.cmd.length),r=n.startsWith(` `)?` `:``;return{invocation:t,prefix:e.slice(0,t.cmd.length)+r,rest:n.slice(r.length)}}function _a(e,t){return Math.max(0,(Number.isFinite(e)?e:0)-(Number.isFinite(t)?t:0))}function va(e){let t=document.createElement(`span`);t.className=`quickforge-slash-chip quickforge-slash-chip-${e.kind}`;let n=document.createElement(`span`);n.className=`quickforge-slash-chip-icon`,n.innerHTML=da[e.kind];let r=document.createElement(`span`);return r.className=`quickforge-slash-chip-name`,r.textContent=e.name,t.append(n,r),t.title=e.cmd,t.setAttribute(`aria-label`,`${v(e.kind===`skill`?`slashGroupSkills`:`slashGroupAgents`)} · ${e.name}`),t}var ya={fontFamily:``,fontSize:``,fontWeight:``,letterSpacing:``,lineHeight:``,tabSize:``,paddingTop:``,paddingRight:``,paddingBottom:``,paddingLeft:``},X;function ba(){if(X!==void 0)return X;X=null;try{X=document.createElement(`canvas`).getContext?.(`2d`)??null}catch{X=null}return X}var xa={getFont(e){let t=typeof window<`u`?window:void 0;if(!t?.getComputedStyle)return ya;let n=t.getComputedStyle(e);return{fontFamily:n.fontFamily??``,fontSize:n.fontSize??``,fontWeight:n.fontWeight??``,letterSpacing:n.letterSpacing??``,lineHeight:n.lineHeight??``,tabSize:n.tabSize??``,paddingTop:n.paddingTop??``,paddingRight:n.paddingRight??``,paddingBottom:n.paddingBottom??``,paddingLeft:n.paddingLeft??``}},measure(e,t){let n=ba();if(!n)return 0;try{n.font=`${t.fontWeight} ${t.fontSize} ${t.fontFamily}`.trim();let r=n;return t.letterSpacing&&(r.letterSpacing=t.letterSpacing),n.measureText(e).width}catch{return 0}},measureElementWidth(e){let t=e.getBoundingClientRect?.();return e.offsetWidth??t?.width??0},observeResize(e,t){if(typeof ResizeObserver>`u`)return()=>{};let n=new ResizeObserver(()=>t());return n.observe(e),()=>n.disconnect()}};function Sa(e){let{panel:t}=e,n={...xa,...e.env},r=null,i=null,a=!1,o=null,s=null,c=null,l=null,u=null,d=null,f=null,p=null,m=null,h=null,g=null,_=()=>{let e=t.querySelector(`message-editor`),n=e?.querySelector(`textarea`);return e?.value??n?.value??``},v=()=>(s=t.querySelector(`message-editor`),c=s?.querySelector(`textarea`)??null,l=s?.closest(`.quickforge-composer-shell`)??null,!!(s&&c&&l)),y=e=>{a=!0,o=e?.data??``,r&&j(_())},b=e=>{a&&(o=e?.data??``,r&&j(_()))},x=e=>{a=!1;let t=e?.data,n=_();if(o=null,r){if(t&&!n.includes(t)){j(`${n}${t}`);return}ne(n)}},S=()=>{!d||!c||typeof c.scrollTop==`number`&&typeof d.scrollTop==`number`&&(d.scrollTop=c.scrollTop)},C=()=>{if(!r||a||!c||typeof c.isConnected==`boolean`&&!c.isConnected)return;let e=c.selectionStart;typeof e==`number`&&(e<r.cmd.length?(u&&(u.style.display=`none`),c.classList.remove(fa)):(u&&(u.style.display=``),c.classList.add(fa)))},w=e=>{if(e?.preventDefault?.(),!c)return;let t=c.value??``;c.focus?.(),c.selectionStart=t.length,c.selectionEnd=t.length},T=()=>{c&&(c.addEventListener(`compositionstart`,y),c.addEventListener(`compositionupdate`,b),c.addEventListener(`compositionend`,x),c.addEventListener(`scroll`,S),globalThis.document?.addEventListener?.(`selectionchange`,C),g=n.observeResize(c,()=>{ee(),te()}))},E=()=>{c?.removeEventListener?.(`compositionstart`,y),c?.removeEventListener?.(`compositionupdate`,b),c?.removeEventListener?.(`compositionend`,x),c?.removeEventListener?.(`scroll`,S),globalThis.document?.removeEventListener?.(`selectionchange`,C),g?.(),g=null},D=()=>{E(),u?.remove(),u=null,d=null,f=null,p=null,m=null,h=null,c?.classList?.remove(fa),r=null,o=null},O=()=>{u=document.createElement(`div`),u.className=`quickforge-slash-overlay`,u.setAttribute(`aria-hidden`,`true`),d=document.createElement(`div`),d.className=`quickforge-slash-ghost`,u.append(d),l?.append(u)},k=e=>{d&&(f?.remove(),p?.remove(),m?.remove(),h?.remove(),f=va(e),f.addEventListener(`pointerdown`,w),p=document.createElement(`span`),p.className=`quickforge-slash-spacer`,m=document.createTextNode(``),h=document.createElement(`span`),h.className=`quickforge-slash-preedit`,d.append(f,p,m,h))},A=()=>{if(!d||!c)return;let e=n.getFont(c),t=d.style;t.fontFamily=e.fontFamily,t.fontSize=e.fontSize,t.fontWeight=e.fontWeight,t.letterSpacing=e.letterSpacing,t.lineHeight=e.lineHeight,t.tabSize=e.tabSize,t.paddingTop=e.paddingTop,t.paddingRight=e.paddingRight,t.paddingBottom=e.paddingBottom,t.paddingLeft=e.paddingLeft},ee=()=>{if(!u||!l||!c||typeof l.getBoundingClientRect!=`function`||typeof c.getBoundingClientRect!=`function`)return;let e=l.getBoundingClientRect(),t=c.getBoundingClientRect();u.style.left=`${t.left-e.left}px`,u.style.top=`${t.top-e.top}px`,Number.isFinite(c.clientWidth)&&(u.style.width=`${c.clientWidth}px`),Number.isFinite(c.clientHeight)&&(u.style.height=`${c.clientHeight}px`)},te=()=>{if(!r||!p||!f||!c)return;let e=n.getFont(c),t=n.measure(r.cmd,e),i=n.measureElementWidth(f);p.style.width=`${_a(t,i)}px`},j=e=>{if(!r)return;A();let t=e.slice(r.cmd.length),n=``;a&&o!==null&&(o&&t.endsWith(o)&&(t=t.slice(0,t.length-o.length)),n=o),m&&(m.textContent=t),h&&(h.textContent=n),ee(),te(),S()},M=e=>{if(E(),!v()){D();return}let t=r;r=e,i=null,u?u.parentElement!==l&&l?.append(u):O(),(!f||!t||t.cmd!==e.cmd||t.kind!==e.kind)&&k(e),T(),c?.classList?.add(fa),j(_())},ne=e=>{if(!r)return;let t=e??_();if(a){j(t);return}if(!ha(t,r.cmd)){D();return}if(!u||!u.isConnected||!c||typeof c.isConnected==`boolean`&&!c.isConnected){if(E(),!v()){D();return}u?.remove(),u=null,d=null,f=null,p=null,m=null,O(),k(r),T(),c?.classList?.add(fa)}j(t)};return{engage:M,isActive:()=>r!==null,getInvocation:()=>r,isDismissed:e=>i!==null&&i===e.toLowerCase(),update:ne,clear:()=>{r&&(i=r.cmd.toLowerCase(),D())},removePrefix:()=>{if(!r||!s||!c)return;let e=c.value??``;if(!ha(e,r.cmd)){D();return}let t=r.cmd.length+ +(e.charAt(r.cmd.length)===` `),n=e.slice(t),i=s;s.value=n,i.requestUpdate?.(),s.onInput?.(n),c.value=n,typeof c.dispatchEvent==`function`&&typeof Event==`function`&&c.dispatchEvent(new Event(`input`,{bubbles:!0})),D(),c.focus?.(),c.selectionStart=0,c.selectionEnd=0},cleanup:()=>{i=null,D()}}}var Ca=`
|
|
120
|
+
<svg viewBox="0 0 20 20" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.65" stroke-linecap="round" stroke-linejoin="round">
|
|
121
|
+
<path d="M2.8 5.2h5l1.5 1.7h7.9v8.3a1.7 1.7 0 0 1-1.7 1.7h-11a1.7 1.7 0 0 1-1.7-1.7z" />
|
|
122
|
+
<path d="M2.8 7h14.4" />
|
|
123
|
+
</svg>`,wa={plugin:`
|
|
124
|
+
<svg viewBox="0 0 20 20" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round">
|
|
125
|
+
<path d="M7.4 3.2h5.2a1.2 1.2 0 0 1 1.2 1.2v2.1h.9a2.1 2.1 0 1 1 0 4.2h-.9v2.1a1.2 1.2 0 0 1-1.2 1.2h-2.1v.7a2.1 2.1 0 1 1-4.2 0V14H4.4a1.2 1.2 0 0 1-1.2-1.2V9.9h.8a1.8 1.8 0 1 0 0-3.6h-.8V4.4a1.2 1.2 0 0 1 1.2-1.2h2.1v-.8a1.8 1.8 0 1 1 3.6 0v.8Z" />
|
|
126
|
+
</svg>`,document:`
|
|
127
|
+
<svg viewBox="0 0 20 20" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.65" stroke-linecap="round" stroke-linejoin="round">
|
|
128
|
+
<path d="M5.4 2.8h6.1L15.8 7v10.2H5.4z" />
|
|
129
|
+
<path d="M11.4 2.9V7h4.1" />
|
|
130
|
+
<path d="M7.6 10.2h5" />
|
|
131
|
+
<path d="M7.6 13h4.3" />
|
|
132
|
+
</svg>`,spreadsheet:`
|
|
133
|
+
<svg viewBox="0 0 20 20" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.65" stroke-linecap="round" stroke-linejoin="round">
|
|
134
|
+
<rect x="3.4" y="4" width="13.2" height="12.2" rx="1.5" />
|
|
135
|
+
<path d="M3.4 8h13.2" />
|
|
136
|
+
<path d="M7.8 4v12.2" />
|
|
137
|
+
<path d="M12.2 4v12.2" />
|
|
138
|
+
<path d="M3.4 12h13.2" />
|
|
139
|
+
</svg>`,presentation:`
|
|
140
|
+
<svg viewBox="0 0 20 20" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.65" stroke-linecap="round" stroke-linejoin="round">
|
|
141
|
+
<path d="M3 4.2h14" />
|
|
142
|
+
<rect x="4.2" y="4.2" width="11.6" height="8.4" rx="1.2" />
|
|
143
|
+
<path d="M10 12.6v3.2" />
|
|
144
|
+
<path d="m7.2 17 2.8-1.2 2.8 1.2" />
|
|
145
|
+
<path d="M7.1 9.5 9 7.7l1.5 1.3 2.4-2.5" />
|
|
146
|
+
</svg>`,skill:`
|
|
147
|
+
<svg viewBox="0 0 20 20" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round">
|
|
148
|
+
<path d="M4.2 3.2h4.4A2.4 2.4 0 0 1 11 5.6v11a2.4 2.4 0 0 0-2.4-2.4H4.2V3.2Z" />
|
|
149
|
+
<path d="M11 5.6a2.4 2.4 0 0 1 2.4-2.4h2.4v11.1h-2.4A2.4 2.4 0 0 0 11 16.7" />
|
|
150
|
+
</svg>`,tool:`
|
|
151
|
+
<svg viewBox="0 0 20 20" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
|
|
152
|
+
<path d="M12.8 3.5a4.2 4.2 0 0 0 4 5.5l-7.6 7.6a2.2 2.2 0 0 1-3.1-3.1l7.6-7.6a4.2 4.2 0 0 0-5.5-4" />
|
|
153
|
+
</svg>`,command:`
|
|
154
|
+
<svg viewBox="0 0 20 20" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
|
|
155
|
+
<path d="m5 6 4 4-4 4" />
|
|
156
|
+
<path d="M10.5 14h4.5" />
|
|
157
|
+
</svg>`},Ta=8;function Ea(e){return!!(e.projectId&&!e.readOnly&&e.harness===`quickforge`&&!e.shared)}function Da(e,t){let n=e.slice(0,t),r=/(^|\s)@([^\s@]*)$/.exec(n);if(!r)return null;let i=r[1]?.length??0;return{start:n.length-r[0].length+i,end:t,query:r[2]??``}}function Oa(e,t){return`${e.slice(0,t.start)}${e.slice(t.end)}`}function ka(e){if(!Array.isArray(e))return[];let t=new Set,n=[];for(let r of e){if(!r||typeof r!=`object`||Array.isArray(r))continue;let e=r;if(e.type!==`file`&&e.type!==`directory`||typeof e.name!=`string`||typeof e.path!=`string`)continue;let i=e.path.trim().replace(/\\/g,`/`),a=e.name.trim();!a||!i||i.startsWith(`/`)||/^[a-zA-Z]:\//.test(i)||i.split(`/`).includes(`..`)||t.has(i)||(t.add(i),n.push({name:a,path:i,type:e.type}))}return n}function Aa(e,t){return e.some(e=>e.projectId===t.projectId&&e.path===t.path)?e:[...e,t].slice(0,Ta)}function ja(e,t,n){if(!n){e.textContent=t;return}let r=t.toLowerCase().indexOf(n.toLowerCase());if(r<0){e.textContent=t;return}let i=document.createElement(`mark`);i.textContent=t.slice(r,r+n.length),e.append(document.createTextNode(t.slice(0,r)),i,document.createTextNode(t.slice(r+n.length)))}function Ma(e,t){let n=document.createElement(`span`);n.className=`quickforge-context-chip quickforge-file-reference-chip`,n.dataset.quickforgeFileReference=`${e.projectId}:${e.path}`,n.title=e.path;let r=document.createElement(`span`);r.className=`quickforge-context-chip-icon`,r.innerHTML=wa.document;let i=document.createElement(`span`);if(i.className=`quickforge-context-chip-label`,i.textContent=e.path.split(`/`).filter(Boolean).at(-1)??e.path,n.append(r,i),t){let r=document.createElement(`button`);r.type=`button`,r.className=`quickforge-context-chip-remove`,r.setAttribute(`aria-label`,v(`removeFileReference`,{path:e.path})),r.textContent=`×`,r.onpointerdown=e=>{e.preventDefault(),e.stopPropagation(),t()},n.append(r)}return n}function Na({panel:e,projectId:t,enabled:n,restoreDraftIntoComposer:r,removeCommandSuggestions:i,removeCapabilitySuggestions:a,removePlusMenu:o,fetchImpl:s=fetch}){let c,l=0,u=0,d=[],f=`idle`,p=`.`,m=``,h=!1,g=()=>e.querySelector(`.quickforge-file-reference-suggestions`),_=()=>{let t=e.querySelector(`message-editor`),n=t?.querySelector(`textarea`);return{editor:t,textarea:n,text:t?.value??n?.value??``}},y=()=>{c?.abort(),c=void 0,l+=1,p=`.`,m=``,d=[],f=`idle`;let e=g();e?.__quickforgeDismissHandler&&document.removeEventListener(`pointerdown`,e.__quickforgeDismissHandler,!0),e?.remove()},x=()=>{let{editor:e}=_();if(!e)return;let t=e.contextReferences??[],n=e.querySelector(`.quickforge-context-chips`);if(t.length===0&&!n?.querySelector(`.quickforge-capability-chip`)){n?.remove();return}let i=b(e);if(i){i.querySelectorAll(`.quickforge-file-reference-chip`).forEach(e=>e.remove());for(let n of t)i.append(Ma(n,()=>{e.contextReferences=(e.contextReferences??[]).filter(e=>!(e.projectId===n.projectId&&e.path===n.path)),e.requestUpdate?.(),x();let{text:t}=_();r({text:t,attachments:e.attachments?[...e.attachments]:[],contextReferences:[...e.contextReferences??[]],selectedCapabilities:e.selectedCapabilities?[...e.selectedCapabilities]:[]})}));ae(i,{plugins:v(`selectedCapabilities`),files:v(`fileReferences`),mixed:v(`selectedPluginsAndFiles`)})}},S=()=>f===`loading`?v(`fileReferenceLoading`):f===`error`?v(`fileReferenceError`):f===`empty`?v(m?`fileReferenceEmpty`:`fileReferenceDirectoryEmpty`):``,C=()=>{let e=m.toLocaleLowerCase();return e?d.filter(t=>t.name.toLocaleLowerCase().includes(e)):d},w=(e,t)=>{e.length!==0&&(u=(t+e.length)%e.length,e.forEach((e,t)=>e.setAttribute(`aria-selected`,t===u?`true`:`false`)),e[u]?.scrollIntoView?.({block:`nearest`}))},T=(e,n)=>{if(!t)return;let{editor:i,textarea:a,text:o}=_();if(!i||!a)return;let s=n??Da(o,a.selectionStart??o.length);if(!s)return;if(e.type===`directory`){p=e.path,m=``,r({text:`${o.slice(0,s.start)}@${o.slice(s.end)}`,attachments:i.attachments?[...i.attachments]:[],contextReferences:i.contextReferences?[...i.contextReferences]:[],selectedCapabilities:i.selectedCapabilities?[...i.selectedCapabilities]:[]});let t=i.querySelector(`textarea`);t?.focus(),t&&(t.selectionStart=t.selectionEnd=s.start+1),D({start:s.start,end:s.start+1,query:``});return}let c=Oa(o,s);i.contextReferences=Aa(i.contextReferences??[],{type:`file`,projectId:t,path:e.path}),r({text:c,attachments:i.attachments?[...i.attachments]:[],contextReferences:[...i.contextReferences],selectedCapabilities:i.selectedCapabilities?[...i.selectedCapabilities]:[]}),x();let l=i.querySelector(`textarea`);l?.focus(),l&&(l.selectionStart=l.selectionEnd=s.start),y()},E=e=>{let{editor:t}=_();if(!t)return;i(),a?.(),o?.();let n=g();n?.__quickforgeDismissHandler&&document.removeEventListener(`pointerdown`,n.__quickforgeDismissHandler,!0);let r=n??document.createElement(`div`);r.className=`quickforge-file-reference-suggestions`,r.setAttribute(`role`,`listbox`),r.setAttribute(`aria-label`,v(`fileReferenceMenuLabel`)),r.innerHTML=``,r.replaceChildren();let s=document.createElement(`div`);s.className=`quickforge-file-reference-header`,s.textContent=p===`.`?v(`fileReferenceProjectRoot`):p,r.append(s),C().forEach(t=>{let n=document.createElement(`button`);n.type=`button`,n.className=`quickforge-file-reference-item`,n.setAttribute(`role`,`option`),n.dataset.quickforgeFilePath=t.path,n.dataset.quickforgeFileType=t.type;let i=document.createElement(`span`);i.className=`quickforge-file-reference-icon quickforge-file-reference-icon-${t.type}`,i.innerHTML=t.type===`directory`?Ca:wa.document;let a=document.createElement(`span`);a.className=`quickforge-file-reference-main`;let o=document.createElement(`span`);o.className=`quickforge-file-reference-name`,ja(o,t.name,m);let s=document.createElement(`span`);s.className=`quickforge-file-reference-path`,s.textContent=t.type===`directory`?v(`fileReferenceOpenDirectory`):t.path,a.append(o,s),n.append(i,a),n.onpointerdown=n=>{n.preventDefault(),n.stopPropagation(),T(t,e)},r.append(n)});let c=document.createElement(`div`);c.className=`quickforge-file-reference-status`,c.setAttribute(`aria-live`,`polite`),c.textContent=S(),c.textContent&&r.append(c);let l=document.createElement(`div`);l.className=`quickforge-file-reference-footer`,l.textContent=v(`fileReferenceFooter`),r.append(l),n||t.parentElement?.insertBefore(r,t),w(Array.from(r.querySelectorAll(`.quickforge-file-reference-item`)),0),r.__quickforgeDismissHandler=e=>{r.contains(e.target)||t.contains(e.target)||y()},document.addEventListener(`pointerdown`,r.__quickforgeDismissHandler,!0)},D=async e=>{if(!t)return;let n=++l;c?.abort(),c=new AbortController,f=`loading`,d=[],E(e);try{let r=await s(`/api/workspace/mention-children?${new URLSearchParams({projectId:t,path:p})}`,{cache:`no-store`,signal:c.signal});if(!r.ok)throw Error(`HTTP ${r.status}`);let i=await r.json();if(n!==l)return;typeof i.path==`string`&&i.path&&(p=i.path),d=ka(i.entries),f=C().length>0?`ready`:`empty`,E(e)}catch(t){if(n!==l||t instanceof DOMException&&t.name===`AbortError`)return;d=[],f=`error`,E(e)}},O=e=>{let{editor:r,textarea:i,text:a}=_(),o=e??a,s=Da(o,i?.selectionStart??o.length);if(h||!n||!t||!r||!i||!s){y();return}if(m=s.query,f===`idle`||f===`error`){D(s);return}f=C().length>0?`ready`:`empty`,E(s)};return{update:O,remove:y,setupTextareaHandler:e=>{let t=e?.querySelector(`textarea`);t&&(t.__quickforgeFileReferenceHandler&&t.removeEventListener(`keydown`,t.__quickforgeFileReferenceHandler,!0),t.__quickforgeFileReferenceCompositionStart&&t.removeEventListener(`compositionstart`,t.__quickforgeFileReferenceCompositionStart),t.__quickforgeFileReferenceCompositionEnd&&t.removeEventListener(`compositionend`,t.__quickforgeFileReferenceCompositionEnd),t.__quickforgeFileReferenceHandler=e=>{if(e.isComposing||e.key===`Process`)return;let t=g();if(!t)return;let n=Array.from(t.querySelectorAll(`.quickforge-file-reference-item`));if(e.key===`Escape`){e.preventDefault(),y();return}if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault(),w(n,u+(e.key===`ArrowDown`?1:-1));return}if((e.key===`Enter`||e.key===`Tab`)&&!e.shiftKey&&n[u]){let t=n[u].dataset.quickforgeFilePath,r=n[u].dataset.quickforgeFileType,i=d.find(e=>e.path===t&&e.type===r);if(!i)return;e.preventDefault(),e.stopPropagation(),T(i)}},t.__quickforgeFileReferenceCompositionStart=()=>{h=!0,y()},t.__quickforgeFileReferenceCompositionEnd=()=>{h=!1,O()},t.addEventListener(`keydown`,t.__quickforgeFileReferenceHandler,!0),t.addEventListener(`compositionstart`,t.__quickforgeFileReferenceCompositionStart),t.addEventListener(`compositionend`,t.__quickforgeFileReferenceCompositionEnd))},cleanupTextareaHandler:()=>{let t=e.querySelector(`message-editor textarea`);t&&(h=!1,t.__quickforgeFileReferenceHandler&&t.removeEventListener(`keydown`,t.__quickforgeFileReferenceHandler,!0),t.__quickforgeFileReferenceCompositionStart&&t.removeEventListener(`compositionstart`,t.__quickforgeFileReferenceCompositionStart),t.__quickforgeFileReferenceCompositionEnd&&t.removeEventListener(`compositionend`,t.__quickforgeFileReferenceCompositionEnd),t.__quickforgeFileReferenceHandler=void 0,t.__quickforgeFileReferenceCompositionStart=void 0,t.__quickforgeFileReferenceCompositionEnd=void 0)},syncChips:x}}function Pa(e){return e.split(/[-_/\\]+/).filter(Boolean).map(e=>e&&`${e[0].toUpperCase()}${e.slice(1)}`).join(` `)}function Fa(e){switch(e.name){case`documents`:return{label:v(`pluginDocumentsName`),description:v(`pluginDocumentsDescription`),iconKind:`document`};case`spreadsheets`:return{label:v(`pluginSpreadsheetsName`),description:v(`pluginSpreadsheetsDescription`),iconKind:`spreadsheet`};case`presentations`:return{label:v(`pluginPresentationsName`),description:v(`pluginPresentationsDescription`),iconKind:`presentation`};default:return null}}function Ia(e){let t=Fa(e);return t?t.label:(e.displayName||Pa(e.name.replace(/^openai-/,``))).replace(/^OpenAI\s+/i,``)}function La(e){let t=Fa(e);return[{type:`plugin`,iconKind:t?.iconKind??`plugin`,pluginName:e.name,name:e.name,label:t?.label??Ia(e),description:t?.description??e.description}]}function Ra(e){if(e.type!==`plugin`)return`plugin`;switch(e.pluginName){case`documents`:return`document`;case`spreadsheets`:return`spreadsheet`;case`presentations`:return`presentation`;default:return`plugin`}}function za(e,t){let n=document.createElement(`span`);n.className=`quickforge-context-chip quickforge-capability-chip`,n.dataset.quickforgeCapabilityKey=m(e),n.title=e.description??e.label;let r=document.createElement(`span`);r.className=`quickforge-context-chip-icon`,r.innerHTML=wa[Ra(e)];let i=document.createElement(`span`);if(i.className=`quickforge-context-chip-label`,i.textContent=e.label,n.append(r,i),t){let r=document.createElement(`button`);r.type=`button`,r.className=`quickforge-context-chip-remove`,r.setAttribute(`aria-label`,v(`removeCapabilityReference`,{name:e.label})),r.textContent=`×`,r.onpointerdown=e=>{e.preventDefault(),e.stopPropagation(),t()},n.append(r)}return n}function Ba({panel:e,restoreDraftIntoComposer:t,onSelectionChange:n,enabled:r=!0}){let i=[],a=null,o=`idle`,s=new Map,c=()=>n?.([...s.values()]),l=()=>a||(o===`loaded`?Promise.resolve():(o=`loading`,a=oe().then(e=>{i=(e.plugins??[]).filter(e=>e.enabled&&e.status===`loaded`)}).catch(()=>{i=[]}).finally(()=>{a=null,o=`loaded`}),a));r&&l();let u=()=>i.flatMap(La),d=(e,n=[...s.values()])=>{let r=e.querySelector(`textarea`);t({text:e.value??r?.value??``,attachments:e.attachments?[...e.attachments]:[],contextReferences:e.contextReferences?[...e.contextReferences]:[],selectedCapabilities:n})},f=()=>{let t=e.querySelector(`message-editor`);if(!t)return;let n=t.querySelector(`.quickforge-context-chips`);if(s.size===0&&!n?.querySelector(`.quickforge-file-reference-chip`)){n?.remove();return}let r=b(t);if(r){r.querySelectorAll(`.quickforge-capability-chip`).forEach(e=>e.remove());for(let t of s.values())r.append(za(t,()=>{s.delete(m(t));let n=e.querySelector(`message-editor`);if(n){let e=[...s.values()];n.selectedCapabilities=e,d(n,e)}c(),f()}));ae(r,{plugins:v(`selectedCapabilities`),files:v(`fileReferences`),mixed:v(`selectedPluginsAndFiles`)})}},p=t=>{s.set(m(t),t);let n=e.querySelector(`message-editor`);if(n){let e=[...s.values()];n.selectedCapabilities=e,d(n,e)}c(),f(),(n?.querySelector(`textarea`))?.focus()};return{refresh:l,availablePluginRows:u,selectPlugin:e=>{let t=()=>{let t=u().find(t=>t.pluginName===e);t&&p(t)};if(o===`loaded`){t();return}r&&l().then(t)},consumeSelectedCapabilities:()=>{let t=k([...s.values()]);s=new Map;let n=e.querySelector(`message-editor`);return n&&(n.selectedCapabilities=[]),c(),f(),t},snapshotSelectedCapabilities:()=>k([...s.values()]),restoreSelectedCapabilities:t=>{s=new Map(k(t).map(e=>[m(e),e]));let n=e.querySelector(`message-editor`);n&&(n.selectedCapabilities=[...s.values()]),c(),f()},syncChips:f,update:()=>{},remove:()=>{},setupTextareaHandler:()=>{},cleanupTextareaHandler:()=>{}}}function Va(e,t){let n=new Set,r;e.forEach((e,t)=>{if(e.role===`assistant`){r=t;return}r!==void 0&&n.add(r),r=void 0});let i=t&&e[e.length-1]?.role===`assistant`;return r!==void 0&&!i&&n.add(r),n}var Ha={collapsed:()=>v(`expand`),expanded:()=>v(`collapse`)};function Ua(e,t,n){let r=v(`copied`),i=Number(e.dataset.quickforgeCopyFeedbackTimer);i&&window.clearTimeout(i),E(e,qe),e.title=r,e.setAttribute(`aria-label`,r),e.style.color=`rgb(5 150 105)`;let a=window.setTimeout(()=>{E(e,n),e.title=t,e.setAttribute(`aria-label`,t),e.style.color=``,delete e.dataset.quickforgeCopyFeedbackTimer},1200);e.dataset.quickforgeCopyFeedbackTimer=String(a)}function Wa(e,t,n,r){let i=document.createElement(`button`);return i.type=`button`,i.dataset.quickforgeAction=e,i.title=t,i.setAttribute(`aria-label`,t),E(i,n),i.className=`pointer-events-auto inline-flex size-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-transparent hover:text-foreground disabled:cursor-not-allowed disabled:opacity-40`,i.onclick=e=>{e.stopPropagation(),r(i)},i}function Ga(e){if(!e)return null;let t=document.createElement(`span`);return t.className=`quickforge-message-time`,t.textContent=y(e),t}function Ka(e){e.querySelectorAll(`.quickforge-rollback-popover`).forEach(e=>{e.quickforgeCleanup?.(),(e.closest(`.quickforge-rollback-action`)?.querySelector(`button[data-quickforge-action="rollback"]`))?.setAttribute(`aria-expanded`,`false`),e.remove()})}function qa(e){let{panel:t,button:n,messageIndex:r,title:i,description:a,onConfirm:o}=e,s=n.closest(`.quickforge-rollback-action`);if(!s||n.disabled)return;if(s.querySelector(`.quickforge-rollback-popover`)){Ka(t);return}Ka(t);let c=document.createElement(`div`);c.className=`quickforge-rollback-popover`,c.setAttribute(`role`,`dialog`),c.setAttribute(`aria-label`,i),c.tabIndex=-1;let l=document.createElement(`div`);l.className=`quickforge-rollback-popover-arrow`;let u=document.createElement(`div`);u.className=`quickforge-rollback-popover-title`,u.textContent=i;let d=document.createElement(`div`);d.className=`quickforge-rollback-popover-description`,d.textContent=a;let f=document.createElement(`div`);f.className=`quickforge-rollback-popover-footer`;let p=document.createElement(`button`);p.type=`button`,p.className=`quickforge-rollback-popover-cancel`,p.textContent=v(`cancel`);let m=document.createElement(`button`);m.type=`button`,m.className=`quickforge-rollback-popover-confirm`,m.textContent=v(`confirmRollback`),f.append(p,m),c.append(l,u,d,f);let h=()=>Ka(t),g=e=>{let t=e.target;!t||c.contains(t)||n.contains(t)||h()},_=e=>{e.key===`Escape`&&(e.preventDefault(),h())};c.quickforgeCleanup=()=>{document.removeEventListener(`pointerdown`,g,!0),document.removeEventListener(`keydown`,_)},c.addEventListener(`pointerdown`,e=>e.stopPropagation()),c.addEventListener(`click`,e=>e.stopPropagation()),p.addEventListener(`click`,h),m.addEventListener(`click`,async()=>{m.disabled=!0,p.disabled=!0,m.textContent=v(`rollingBack`);try{await o(r)}finally{h()}}),s.append(c),n.setAttribute(`aria-expanded`,`true`),document.addEventListener(`pointerdown`,g,!0),document.addEventListener(`keydown`,_),window.requestAnimationFrame(()=>m.focus())}function Ja(e){let t=document.createElement(`span`);t.className=`quickforge-rollback-action`;let n=Wa(`rollback`,v(`rollback`),Je,t=>{qa({panel:e.panel,button:t,messageIndex:e.messageIndex,title:e.title,description:e.description,onConfirm:e.onConfirm})});return n.disabled=e.isDisabled,n.setAttribute(`aria-haspopup`,`dialog`),n.setAttribute(`aria-expanded`,`false`),t.append(n),t}function Ya(e){return e.querySelector(`message-list`)}function Xa(e){return Array.from(e.querySelectorAll(`user-message, assistant-message`)).filter(t=>t.closest(`message-list`)===e)}function Za(e){let t=Ya(e);return t?Xa(t):[]}function Qa(e){return(Ya(e)?.parentElement?.querySelector(`:scope > streaming-message-container:not(.hidden)`))?.querySelector(`:scope > div > assistant-message`)??null}var $a=`data-quickforge-slash-chip-el`;function eo(e){for(let t of Array.from(e.childNodes)){if(t.nodeType===Node.TEXT_NODE){if((t.textContent??``).trim())return t;continue}if(t.nodeType!==Node.ELEMENT_NODE)continue;let e=eo(t);if(e)return e}return null}function to(e,t){let n=e.querySelector(`.user-message-container`);if(!n)return;for(let e of Array.from(n.querySelectorAll(`[${$a}]`))){let t=e.dataset.quickforgeSlashChipPrefix??``,n=e.nextSibling,r=e.parentElement;e.remove(),n&&n.nodeType===Node.TEXT_NODE?n.textContent=t+(n.textContent??``):t&&r&&r.insertBefore(document.createTextNode(t),n??null)}if(!ma(A(t)))return;let r=eo(n);if(!r?.parentElement)return;let i=ga(r.textContent??``);if(!i)return;r.textContent=i.rest;let a=va(i.invocation);a.setAttribute($a,``),a.dataset.quickforgeSlashChipPrefix=i.prefix,a.classList.add(`quickforge-slash-chip-in-message`),r.parentElement.insertBefore(a,r)}function no(e){let t=e.details;if(!t||typeof t!=`object`||Array.isArray(t))return[];let n=t.contextReferences;return Array.isArray(n)?n.filter(e=>!!(e&&typeof e==`object`&&!Array.isArray(e)&&e.type===`file`&&typeof e.projectId==`string`&&typeof e.path==`string`)).slice(0,8):[]}function ro(e,t){let n=e.querySelector(`.user-message-container`);if(!n)return;let r=p(t.details),i=no(t),a=n.querySelector(`.quickforge-message-context-references`);if(r.length===0&&i.length===0){a?.remove();return}let o=a??document.createElement(`div`);o.className=`quickforge-message-context-references`,o.setAttribute(`aria-label`,r.length>0&&i.length>0?v(`selectedPluginsAndFiles`):r.length>0?v(`selectedCapabilities`):v(`fileReferences`)),o.replaceChildren(...r.map(e=>za(e)),...i.map(e=>Ma(e))),a||n.prepend(o)}function io(e){e.querySelectorAll(`message-list[data-quickforge-subagent-process="true"]`).forEach(e=>{pi(e,Xa(e),e.dataset.quickforgeSubagentStreaming===`true`)})}function ao(e){let{panel:t,getMessages:n,messageIndexOffset:r=0,isStreaming:i,onCopyAnswer:a,onRollbackFromMessage:o,onRetryFromMessage:s,onForkFromMessage:c,onOpenLocalFilePath:l,disableFork:u,allowRollback:d=!0,allowRetry:p=!0,readOnly:m=!1,enableTerminalCommandActions:h=!0,rollbackConfirmTitle:g=v(`rollbackConfirmTitle`),rollbackConfirmDescription:b=v(`rollbackConfirm`)}=e,x=n().map((e,t)=>({message:e,index:t+r})).filter(({message:e})=>e.role===`user`||e.role===`user-with-attachments`||e.role===`assistant`),S=(()=>{for(let e=x.length-1;e>=0;e--)if(x[e].message.role!==`assistant`)return x[e]})(),C=Za(t),w=i(),T=Va(x.map(({message:e})=>e),w),E=e=>{let t=v(`copy`);return Wa(`copy`,t,I,async n=>{let r=e();if(r)try{await a(r),Ua(n,t,I)}catch{}})};C.forEach((e,r)=>{let a=x[r];if(!a)return;e.classList.add(`group`,`relative`),e.classList.toggle(`quickforge-assistant-message`,a.message.role===`assistant`),e.classList.toggle(`quickforge-user-message`,a.message.role!==`assistant`),a.message.role===`user`&&(Ie(e,Ha),to(e,a.message)),(a.message.role===`user`||a.message.role===`user-with-attachments`)&&ro(e,a.message);let h=_(a.message),C=e=>{let t=e.querySelector(`.quickforge-message-time`);if(h>0){if(t){t.textContent=y(h);return}let n=Ga(h);if(!n)return;a.message.role===`assistant`?e.append(n):e.prepend(n)}else t?.remove()};a.message.role===`assistant`&&l&&ca(e,a.message,l);let w=`quickforge-message-actions pointer-events-none mt-1 flex gap-1 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100 ${a.message.role===`assistant`?`px-4 justify-start`:`mx-4 justify-end`}`,D=e.querySelector(`.quickforge-message-actions`);if(!(a.message.role!==`assistant`||T.has(r))){D?.remove();return}if(D?.dataset.quickforgeLayout===`message-bottom`){D.className=w,D.parentElement===e&&D!==e.lastElementChild&&e.append(D),m&&Ka(t),D.querySelectorAll(`button[data-quickforge-action="rollback"], button[data-quickforge-action="retry"], button[data-quickforge-action="fork"]`).forEach(e=>{let t=e.dataset.quickforgeAction;if(m||t===`rollback`&&!d||t===`retry`&&!p||t===`fork`&&u){e.closest(`.quickforge-rollback-action`)?.remove(),e.remove();return}e.disabled=i()}),i()&&Ka(t);let n=D.querySelector(`button[data-quickforge-action="retry"]`),r=!m&&p&&S&&a.index===S.index&&a.message.role!==`assistant`;if(n&&!r)n.remove();else if(!n&&r){let e=Wa(`retry`,v(`retry`),Xe,()=>{s(a.index)});e.disabled=i(),D.append(e)}C(D);return}D?.remove();let O=document.createElement(`div`);if(O.dataset.quickforgeLayout=`message-bottom`,O.className=w,a.message.role===`assistant`){let e=f(a.message);if(!e)return;let t=E(()=>{let t=n()[a.index];return t?f(t):e});if(O.append(t),!m&&!u){let e=Wa(`fork`,v(`forkConversation`),Ye,()=>{c(a.index)});e.disabled=i(),O.append(e)}}else{let e=A(a.message);if(e){let t=E(()=>{let t=n()[a.index];return t?A(t):e});O.append(t)}if(!m&&d){let e=Ja({panel:t,messageIndex:a.index,isDisabled:i(),title:g,description:b,onConfirm:o});O.append(e)}if(!m&&p&&S&&a.index===S.index){let e=Wa(`retry`,v(`retry`),Xe,()=>{s(a.index)});e.disabled=i(),O.append(e)}}C(O),e.append(O)}),Hi(t);let D=[...C];if(w){let e=Qa(t);e&&(e.classList.add(`quickforge-assistant-message`),D.push(e))}pi(t,D,w),io(t),Ki(t,i()),$i(t,i()),h?ea(t,i()):t.querySelectorAll(`[data-quickforge-action="execute-markdown-command"]`).forEach(e=>e.remove())}function oo(e){return e.role===`user`||e.role===`user-with-attachments`||e.role===`assistant`}function so(e){return e.role===`user`||e.role===`user-with-attachments`}function co(e){return e.role===`assistant`?f(e).trim().length>0:!1}function lo(e){return e.querySelector(`message-list`)}function uo(e){let t=lo(e);return t?Array.from(t.querySelectorAll(`user-message, assistant-message`)).filter(e=>e.closest(`message-list`)===t):[]}var fo=`.quickforge-assistant-waiting`;function po(e){e.querySelectorAll(fo).forEach(e=>e.remove())}function mo(e){let t=e.querySelectorAll(`thinking-block, tool-message`);for(let e of t)if(!e.closest(`.quickforge-process-body`))return!0;let n=e.querySelectorAll(`markdown-block, code-block`);for(let e of n)if(!e.closest(`.quickforge-process-body`)&&(e.textContent??``).trim().length>0)return!0;let r=e.cloneNode(!0);return r.querySelectorAll(`.quickforge-message-actions`).forEach(e=>e.remove()),r.querySelectorAll(`.quickforge-process-body`).forEach(e=>e.remove()),(r.textContent??``).trim().length>0}function ho(e){let{panel:t,getMessages:n,isStreaming:r,isActive:i}=e,a=t.querySelector(fo);if(!r()||!i)return po(t),!1;let o=lo(t),s=n(),c=s.map((e,t)=>({message:e,index:t})).filter(({message:e})=>oo(e)),l=(()=>{for(let e=c.length-1;e>=0;e--)if(so(c[e].message))return e;return-1})();if(!o||l<0)return a?.remove(),!1;let u=c[l],d=s.slice(u.index+1).some(co),f=uo(t),p=f[l],m=f.slice(l+1).some(e=>e.matches(`assistant-message`)&&mo(e));if(!p||d||m)return a?.remove(),!1;let h=a??document.createElement(`div`);return h.className=`quickforge-assistant-waiting`,h.setAttribute(`role`,`status`),h.setAttribute(`aria-live`,`polite`),h.setAttribute(`aria-label`,v(`assistantWaitingAriaLabel`)),a||(h.innerHTML=`
|
|
158
|
+
<div class="quickforge-assistant-waiting-dots" aria-hidden="true">
|
|
159
|
+
<span></span>
|
|
160
|
+
<span></span>
|
|
161
|
+
<span></span>
|
|
162
|
+
</div>
|
|
163
|
+
`),h.previousElementSibling!==p&&p.after(h),!0}var go=280,_o=120,vo=900,yo=`<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 17V3"/><path d="m6 11 6 6 6-6"/><path d="M19 21H5"/></svg>`;function bo({panel:e,onJumpSettled:t}){let n=null,r=null,i=null,a=!1,o=0,s=()=>e.querySelector(`agent-interface .overflow-y-auto`),c=()=>i?i.scrollHeight-i.scrollTop-i.clientHeight:0,l=()=>{if(!n||!r)return;r.textContent=String(o),r.classList.toggle(`quickforge-scroll-bottom-badge-empty`,o===0);let e=o>0?v(`scrollToBottomUnreadLabel`,{count:o}):v(`scrollToBottomLabel`);n.setAttribute(`aria-label`,e),n.title=e},u=e=>{a!==e&&(a=e,n?.classList.toggle(`is-visible`,e),!e&&o>0&&(o=0,l()))},d=()=>{let e=c();u(a?e>_o:e>go)},f=()=>{let e=i;if(!e)return;o=0,l(),u(!1);let n=e.scrollHeight-e.clientHeight,r=typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;if(Math.abs(e.scrollTop-n)<=1||r){e.scrollTop=n,t();return}let a=!1,s=!1,c=e=>{e.deltaY<0&&(s=!0)},d=()=>{a||(a=!0,e.removeEventListener(`scrollend`,d),e.removeEventListener(`wheel`,c),window.clearTimeout(f),s||t())};e.addEventListener(`wheel`,c,{passive:!0}),e.addEventListener(`scrollend`,d,{once:!0});let f=window.setTimeout(d,vo);e.scrollTo({top:n,behavior:`smooth`})},p=()=>{let e=document.createElement(`button`);return e.type=`button`,e.className=`quickforge-scroll-bottom-button`,e.innerHTML=yo,r=document.createElement(`span`),r.className=`quickforge-scroll-bottom-badge quickforge-scroll-bottom-badge-empty`,r.setAttribute(`aria-hidden`,`true`),e.append(r),e.addEventListener(`click`,f),n=e,l(),e};return{setup:()=>{let t=s();t!==i&&(i?.removeEventListener(`scroll`,d),i=t,i?.addEventListener(`scroll`,d,{passive:!0}));let a=e.querySelector(`.quickforge-composer-shell`);if(!a){n?.remove(),n=null,r=null;return}n||=p(),n.parentElement!==a&&a.append(n),d()},cleanup:()=>{i?.removeEventListener(`scroll`,d),i=null,n?.remove(),n=null,r=null,a=!1,o=0},notifyNewAssistantMessage:()=>{a&&(o+=1,l())}}}function xo(e){let{panel:t,isStreaming:n,isWaiting:r,abort:i,agentAccessMode:a,harness:o,getAcpSession:s,onOpenCodeConfigOptionChange:c,onOpenCodeModeChange:l,planMode:u,workspaceToolsEnabled:d,readOnly:f,allowModelControls:p,planModeEnabled:m,accessModeEnabled:h,commandSuggestionsEnabled:g,capabilitySuggestionsEnabled:_,attachmentsEnabled:y,onAccessModeChange:b,onTogglePlanMode:x,onInput:S,onFilesChange:C,removeCommandSuggestions:w,updateCommandSuggestions:T,setupCommandTextareaHandler:E,removeCapabilitySuggestions:D,updateCapabilitySuggestions:O,setupCapabilityTextareaHandler:k,removeFileReferenceSuggestions:A,updateFileReferenceSuggestions:ee,setupFileReferenceTextareaHandler:te,syncContextChips:j,selectPluginCapability:M,availablePluginRows:ne,onBeforeSend:re}=e,N=t.querySelector(`message-editor`);N?.classList.add(`quickforge-composer`),N?.parentElement?.classList.add(`quickforge-composer-shell`),N?.parentElement?.parentElement?.classList.add(`quickforge-composer-dock`);let ae=N?.querySelector(`textarea`);if(ae&&(ae.placeholder=v(`composerPlaceholder`)),f){t.querySelector(`.quickforge-composer-dock`)?.remove();return}Ht({editor:N,onInput:S,onFilesChange:C,removeCommandSuggestions:w,updateCommandSuggestions:g?T:()=>w(),removeCapabilitySuggestions:D,updateCapabilitySuggestions:_?O:()=>D(),removeFileReferenceSuggestions:A,updateFileReferenceSuggestions:ee,attachmentsEnabled:y,onBeforeSend:re}),g?E(N):w(),_?k(N):D(),te(N),j(),m?zt(N,u,x):Rt(N);let P=t.querySelector(`agent-interface`);if(P){let e=P.enableModelSelector!==p;P.enableModelSelector=p,P.enableThinkingSelector=!1,e&&P.requestUpdate?.()}let oe=N?.querySelectorAll(`.flex.gap-2.items-center`),F=oe?.[0],se=oe?.[oe.length-1];if(!se)return;if(Lt(N,se),Vt({rightControls:se,isStreaming:n,isWaiting:r,abort:i,removeCommandSuggestions:w}),!F){t.querySelector(`.quickforge-plus-inline`)?.remove(),B(t),!y&&N&&jt(N),t.querySelector(`.quickforge-agent-access-inline`)?.remove(),L(t),t.querySelector(`.quickforge-opencode-config-inline`)?.remove(),R(t),t.querySelector(`.quickforge-opencode-mode-inline`)?.remove(),z(t),t.querySelector(`.quickforge-yolo-inline`)?.remove(),t.querySelector(`.quickforge-plan-inline`)?.remove();return}let ce=()=>{B(t),R(t),z(t),L(t),ie()};if(N&&(N.querySelectorAll(`input[type="file"]`).forEach(e=>{e.disabled=!y}),y||jt(N,F)),N&&(y||_)?Ft({panel:t,editor:N,leftControls:F,selectPluginCapability:M,availablePluginRows:ne,removeCommandSuggestions:w,removeCapabilitySuggestions:D,removeFileReferenceSuggestions:A,attachmentsEnabled:y,pluginsEnabled:_}):(t.querySelector(`.quickforge-plus-inline`)?.remove(),B(t),N&&jt(N,F)),m?Bt({panel:t,leftControls:F,planMode:u,onTogglePlanMode:x}):t.querySelector(`.quickforge-plan-inline`)?.remove(),o===`opencode`&&s&&c&&l?(St({panel:t,leftControls:F,getAcpSession:s,isStreaming:n,onConfigOptionChange:c,onModeChange:l,dismissComposerMenus:ce}),Dt({panel:t,rightControls:se,getAcpSession:s,isStreaming:n,onModeChange:l,dismissComposerMenus:ce})):(t.querySelector(`.quickforge-opencode-config-inline`)?.remove(),R(t),t.querySelector(`.quickforge-opencode-mode-inline`)?.remove(),z(t)),!d||!h){t.querySelector(`.quickforge-agent-access-inline`)?.remove(),L(t),t.querySelector(`.quickforge-yolo-inline`)?.remove();return}pt({panel:t,leftControls:F,agentAccessMode:a,onAccessModeChange:b,dismissComposerMenus:ce})}var So={collapsed:()=>v(`expand`),expanded:()=>v(`collapse`)};function Co(e,t){let n=Q(e?.details)?e.details:void 0;return e?.isError||n?.aborted===!0||n?.timedOut===!0?`error`:t?`running`:e?`done`:`called`}function Z(e){if(e==null)return``;if(typeof e==`string`)try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}try{return JSON.stringify(e,null,2)}catch{return String(e)}}function wo(e){return e?.content?.filter(e=>e.type===`text`).map(e=>e.text??``).join(`
|
|
164
|
+
`)??``}function Q(e){return!!(e&&typeof e==`object`&&!Array.isArray(e))}function To(e,t){let n=Q(e?.__quickforgeAcp)?e.__quickforgeAcp:void 0,r=Q(t)?t:void 0;return(Q(r?.__quickforgeAcp)?r.__quickforgeAcp:void 0)??n}function Eo(e){if(!e||!(`__quickforgeAcp`in e))return e;let{__quickforgeAcp:t,...n}=e;return n}function Do(e){if(!Q(e)||!(`__quickforgeAcp`in e))return e;let{__quickforgeAcp:t,...n}=e;return n}function Oo(e,t){if(e.running===!0||t)return`Status: running`;let n=[e.timedOut?`timed out`:null,e.aborted?`aborted`:null].filter(Boolean),r=n.length?` (${n.join(`, `)})`:``;return`Exit code: ${e.code??`unknown`}${typeof e.signal==`string`&&e.signal?`, signal: ${e.signal}`:``}${r}`}function ko(e,t,n){let r=Q(t)?t:void 0,i=typeof r?.command==`string`?r.command:typeof e?.command==`string`?e.command:``;if(!i||!r)return``;let a=typeof r?.stdout_preview==`string`?r.stdout_preview:typeof r?.stdout==`string`?r.stdout:``,o=typeof r?.stderr_preview==`string`?r.stderr_preview:typeof r?.stderr==`string`?r.stderr:``,s=!!(a||o),c=r.running===!0||r.code!==void 0||r.signal!==void 0||r.timedOut===!0||r.aborted===!0;return!s&&!c&&!n?``:[`Command: ${i}`,Oo(r,n),``,`STDOUT:`,a||`(empty)`,``,`STDERR:`,o||`(empty)`].join(`
|
|
165
|
+
`)}function Ao(e,t,n,r){let i=wo(n);return e===`manage_global_memory`?se(n,r,v)||i:i||(e===`run_command`?ko(t,n?.details,r):``)}function jo(e){if(!e||typeof e!=`object`)return;let t=e.diff;if(!t||typeof t!=`object`)return;let n=t;return typeof n.text==`string`?n:void 0}function Mo(e){if(!e||typeof e!=`object`)return e;let t=e,n=t.diff;if(!n||typeof n!=`object`)return e;let{text:r,...i}=n;return{...t,diff:i}}function No(e){if(!e||typeof e!=`object`)return{};let t=e;return{sessionId:typeof t.sessionId==`string`?t.sessionId:void 0,toolCallId:typeof t.toolCallId==`string`?t.toolCallId:void 0}}async function Po(e,t,n){let r=n.getAttribute(`aria-label`)||v(`terminateCommand`);n.disabled=!0,n.setAttribute(`aria-label`,v(`commandTerminateRequested`)),n.setAttribute(`title`,v(`commandTerminateRequested`));try{let n=await fetch(`/api/agents/${encodeURIComponent(e)}/abort-tool`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({toolCallId:t})});if(!n.ok)throw Error(`HTTP ${n.status}`)}catch{n.disabled=!1,n.setAttribute(`aria-label`,r),n.setAttribute(`title`,v(`terminateCommandTitle`))}}function Fo(e,t,n=!1){if(e!==`write_file`&&e!==`edit_file`||!t)return c;let r=Number(t.addedLines??0),i=Number(t.removedLines??0);return o`
|
|
166
|
+
<quickforge-diff-counter
|
|
167
|
+
class="quickforge-tool-meta-hover shrink-0"
|
|
168
|
+
added=${r}
|
|
169
|
+
removed=${i}
|
|
170
|
+
?running=${n}
|
|
171
|
+
title="+${r} -${i}"
|
|
172
|
+
></quickforge-diff-counter>
|
|
173
|
+
`}function Io(e){return!e.segments||e.segments.length===0?e.text||` `:e.segments.map(e=>e.changed?o`<mark>${e.text}</mark>`:e.text)}function Lo(e){return e.kind===`gap`?o`
|
|
174
|
+
<div class="quickforge-diff-gap${e.first?` quickforge-diff-gap-first`:``}" aria-hidden="true">
|
|
175
|
+
<span class="quickforge-diff-gap-dots">⋯⋯</span>
|
|
176
|
+
<span>${v(`diffOmittedLines`,{count:e.count})}</span>
|
|
177
|
+
</div>
|
|
178
|
+
`:o`
|
|
179
|
+
<div class="quickforge-diff-row quickforge-diff-row-${e.kind}">
|
|
180
|
+
<span class="quickforge-diff-ln">${e.oldNo??``}</span>
|
|
181
|
+
<span class="quickforge-diff-ln">${e.newNo??``}</span>
|
|
182
|
+
<span class="quickforge-diff-code">${Io(e)}</span>
|
|
183
|
+
</div>
|
|
184
|
+
`}function Ro(e){let t=Number(e.addedLines??0),n=Number(e.removedLines??0),r=e.text??``,i=He(r),a=Ve(r);return o`
|
|
185
|
+
<div>
|
|
186
|
+
<div class="mb-1 flex items-center gap-2 text-xs font-medium text-muted-foreground">
|
|
187
|
+
<span>Diff</span>
|
|
188
|
+
<span class="quickforge-diff-badge quickforge-diff-badge-add">+${t}</span>
|
|
189
|
+
<span class="quickforge-diff-badge quickforge-diff-badge-del">-${n}</span>
|
|
190
|
+
${e.truncated?o`<span class="text-muted-foreground/80">truncated</span>`:c}
|
|
191
|
+
${a?.isNewFile?o`<span class="quickforge-diff-newfile">${v(`diffNewFile`)}</span>`:c}
|
|
192
|
+
${a?o`<span class="quickforge-diff-path" title=${a.path}>${a.path}</span>`:c}
|
|
193
|
+
</div>
|
|
194
|
+
<div class="quickforge-diff-block">${i.map(Lo)}</div>
|
|
195
|
+
</div>
|
|
196
|
+
`}function zo(e){if(!Number.isFinite(e)||e<0)return``;if(e<1e3)return`${Math.max(0,Math.round(e))}ms`;let t=e/1e3;return t<10?`${t.toFixed(1)}s`:t<60?`${Math.round(t)}s`:`${Math.floor(t/60)}m ${Math.floor(t%60).toString().padStart(2,`0`)}s`}function Bo(e){if(e){if(typeof e.durationMs==`number`)return e.durationMs;if(typeof e.startedAt==`number`)return Date.now()-e.startedAt}}var Vo=class extends HTMLElement{timer;static get observedAttributes(){return[`duration-ms`,`running`,`started-at`]}connectedCallback(){this.render(),this.syncTimer()}disconnectedCallback(){this.stopTimer()}attributeChangedCallback(){this.render(),this.syncTimer()}readNumberAttribute(e){let t=this.getAttribute(e);if(t===null||t.trim()===``)return;let n=Number(t);return Number.isFinite(n)&&n>=0?n:void 0}syncTimer(){this.getAttribute(`running`)===`true`&&this.readNumberAttribute(`duration-ms`)===void 0?this.timer||=setInterval(()=>this.render(),500):this.stopTimer()}stopTimer(){this.timer&&=(clearInterval(this.timer),void 0)}render(){let e=this.readNumberAttribute(`duration-ms`),t=this.readNumberAttribute(`started-at`),n=e===void 0?t!==void 0&&t>0?Date.now()-t:0:e;this.textContent=zo(n)}};customElements.get(`quickforge-elapsed-time`)||customElements.define(`quickforge-elapsed-time`,Vo);var Ho={prefersReducedMotion:()=>!!(window.matchMedia&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches),animate:(e,t,n)=>e.animate(t,n),setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e)},Uo=class extends HTMLElement{controller;resizeObserver;ready=!1;static get observedAttributes(){return[`text`,`running`]}connectedCallback(){let e=this.marqueeViews();e[0].el.style.visibility=``,e[1].el.setAttribute(`aria-hidden`,`true`),this.controller=new ge({views:e,getClientWidth:()=>this.clientWidth},Ho),this.ready=!0,typeof ResizeObserver==`function`&&(this.resizeObserver=new ResizeObserver(()=>this.scheduleRestart()),this.resizeObserver.observe(this)),this.sync()}disconnectedCallback(){this.ready=!1,this.resizeObserver&&=(this.resizeObserver.disconnect(),void 0),this.controller?.dispose(),this.controller=void 0}attributeChangedCallback(){this.ready&&this.sync()}marqueeViews(){let e=Array.from(this.children).filter(e=>e instanceof HTMLElement&&e.classList.contains(`quickforge-marquee-view`));if(e.length===2){let t=e.map(e=>{let t=e.querySelector(`.quickforge-marquee-static`),n=e.querySelector(`.quickforge-marquee-moving`);return t&&n?{el:e,staticSpan:t,movingSpan:n}:void 0});if(t[0]&&t[1])return[t[0],t[1]]}this.replaceChildren();let t=[0,1].map(()=>{let e=document.createElement(`span`);e.className=`quickforge-marquee-view`;let t=document.createElement(`span`);t.className=`quickforge-marquee-static`;let n=document.createElement(`span`);return n.className=`quickforge-marquee-moving`,n.setAttribute(`aria-hidden`,`true`),e.appendChild(t),e.appendChild(n),this.appendChild(e),{el:e,staticSpan:t,movingSpan:n}});return[t[0],t[1]]}sync(){this.controller?.sync(this.getAttribute(`text`)||``,this.getAttribute(`running`)===`true`)}scheduleRestart(){requestAnimationFrame(()=>{this.ready&&this.controller?.sync(this.getAttribute(`text`)||``,this.getAttribute(`running`)===`true`,!0)})}};customElements.get(`quickforge-tool-marquee`)||customElements.define(`quickforge-tool-marquee`,Uo);var Wo={prefersReducedMotion:()=>!!(window.matchMedia&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches),createElement:e=>document.createElement(e),setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e)},Go=class extends HTMLElement{controller;ready=!1;static get observedAttributes(){return[`added`,`removed`,`running`]}connectedCallback(){this.controller||=new Re(this,Wo),this.ready=!0,this.sync()}disconnectedCallback(){this.ready=!1,this.controller?.dispose()}attributeChangedCallback(){this.ready&&this.sync()}sync(){this.controller?.sync(Number(this.getAttribute(`added`)??0)||0,Number(this.getAttribute(`removed`)??0)||0,this.getAttribute(`running`)===`true`)}};customElements.get(`quickforge-diff-counter`)||customElements.define(`quickforge-diff-counter`,Go);function Ko(e,t){return Bo(e)===void 0?c:o`
|
|
197
|
+
<quickforge-elapsed-time
|
|
198
|
+
class="quickforge-tool-meta-hover text-xs text-muted-foreground/70"
|
|
199
|
+
started-at=${String(e?.startedAt??``)}
|
|
200
|
+
duration-ms=${typeof e?.durationMs==`number`?String(e.durationMs):``}
|
|
201
|
+
running=${String(t===`running`)}
|
|
202
|
+
></quickforge-elapsed-time>
|
|
203
|
+
`}function qo(){return`text-muted-foreground/60`}function Jo(e){let t=`quickforge-tool-type-icon shrink-0 ${qo()}`;return e===`manage_global_memory`?o`<svg class=${t} xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 18V5"/><path d="M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4"/><path d="M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5"/><path d="M17.997 5.125a4 4 0 0 1 2.526 5.77"/><path d="M18 18a4 4 0 0 0 2-7.464"/><path d="M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517"/><path d="M6 18a4 4 0 0 1-2-7.464"/><path d="M6.003 5.125a4 4 0 0 0-2.526 5.77"/></svg>`:e===`edit_file`?o`<svg class=${t} xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z"/></svg>`:e===`write_file`?o`<svg class=${t} xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"/><path d="M14 2v6h6"/><path d="M12 18v-6"/><path d="M9 15h6"/></svg>`:e===`read_file`?o`<svg class=${t} xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"/><path d="M14 2v6h6"/><path d="M16 13H8"/><path d="M16 17H8"/><path d="M10 9H8"/></svg>`:e===`grep_files`?o`<svg class=${t} xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>`:e===`present_files`?o`<svg class=${t} xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"/><path d="M14 2v6h6"/><path d="M10 13.5 8 16l2 2.5"/><path d="m14 13.5 2 2.5-2 2.5"/></svg>`:e===`generate_image`?o`<svg class=${t} xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect width="18" height="18" x="3" y="3" rx="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.1-3.1a2 2 0 0 0-2.8 0L6 21"/><path d="m14 19.5-2-2a2 2 0 0 0-2.8 0L5.5 21"/></svg>`:e===`read_skill_resource`?o`<svg class=${t} xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 7v14"/><path d="M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3Z"/></svg>`:e===`run_command`?o`<svg class=${t} xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="4 17 10 11 4 5"/><line x1="12" x2="20" y1="19" y2="19"/></svg>`:e===`run_subagent`?o`<svg class=${t} xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 8V4H8"/><rect width="16" height="12" x="4" y="8" rx="2"/><path d="M2 14h2"/><path d="M20 14h2"/><path d="M15 13v2"/><path d="M9 13v2"/></svg>`:e===`ask_user`?o`<svg class=${t} xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><line x1="12" x2="12.01" y1="17" y2="17"/></svg>`:e===`activate_skill`?o`<svg class=${t} xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9.9 2.1 8.5 8.5 2.1 9.9l6.4 1.4 1.4 6.4 1.4-6.4 6.4-1.4-6.4-1.4Z"/><path d="M19 15v4"/><path d="M21 17h-4"/></svg>`:o`<svg class=${t} xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.8-3.8a6 6 0 0 1-7.9 7.9l-6.9 6.9a2.1 2.1 0 0 1-3-3l6.9-6.9a6 6 0 0 1 7.9-7.9Z"/></svg>`}function Yo(e){return e===`error`?`text-destructive`:e===`running`?`text-primary animate-spin`:e===`done`?`text-emerald-600 dark:text-emerald-500`:`text-muted-foreground/70`}function Xo(e){let t=`quickforge-tool-status-icon shrink-0 ${Yo(e)}`,n=v(e);return e===`running`?o`<svg class=${t} xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" role="img" aria-label=${n}><path d="M21 12a9 9 0 1 1-6.2-8.6"/></svg>`:e===`done`?o`<svg class=${t} xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" role="img" aria-label=${n}><path d="M22 11.1V12a10 10 0 1 1-5.9-9.1"/><path d="m9 11 3 3L22 4"/></svg>`:e===`error`?o`<svg class=${t} xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" role="img" aria-label=${n}><circle cx="12" cy="12" r="10"/><path d="m15 9-6 6"/><path d="m9 9 6 6"/></svg>`:o`<svg class=${t} xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" role="img" aria-label=${n}><circle cx="12" cy="12" r="10"/><circle cx="12" cy="12" r="2" fill="currentColor" stroke="none"/></svg>`}function Zo(e,t){return o`
|
|
204
|
+
<span class="${e===`done`?`quickforge-tool-meta-hover`:`quickforge-tool-meta-important`} shrink-0 inline-flex items-center gap-1.5" title=${v(e)}>
|
|
205
|
+
${Xo(e)}${Ko(t,e)}
|
|
206
|
+
</span>
|
|
207
|
+
`}function Qo(e,t,n){if(e!==`run_command`||t!==`running`)return c;let{sessionId:r,toolCallId:i}=No(n);return!r||!i?c:o`
|
|
208
|
+
<button
|
|
209
|
+
type="button"
|
|
210
|
+
class="shrink-0 inline-flex size-5 items-center justify-center text-foreground transition-opacity hover:opacity-70 disabled:cursor-not-allowed disabled:opacity-40"
|
|
211
|
+
title=${v(`terminateCommandTitle`)}
|
|
212
|
+
aria-label=${v(`terminateCommandTitle`)}
|
|
213
|
+
@click=${e=>{e.preventDefault(),e.stopPropagation(),Po(r,i,e.currentTarget)}}
|
|
214
|
+
><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="7" y="7" width="10" height="10" rx="2.4"/></svg></button>
|
|
215
|
+
`}var $o=`quickforge:preview-artifact`;function es(e,t){let n=t===`html`||t===`image`||t===`markdown`||t===`code`||t===`unknown`?t:void 0;return w(e,n)?{path:e,kind:n}:void 0}function ts(e,t){if(e===`write_file`||e===`edit_file`){let e=t&&`path`in t&&typeof t.path==`string`?t.path:``;return e?es(e):void 0}if(e===`present_files`){let e=(t&&Array.isArray(t.files)?t.files:[]).map(e=>{if(typeof e==`string`)return{path:e,kind:void 0};if(!(!Q(e)||typeof e.path!=`string`))return{path:e.path,kind:typeof e.kind==`string`?e.kind:void 0}}).filter(e=>!!e),n=t&&typeof t.defaultPreview==`string`?t.defaultPreview:``,r=e.find(e=>e.path===n);if(r){let e=es(r.path,r.kind);if(e)return e}for(let t of e){let e=es(t.path,t.kind);if(e)return e}}}function ns(e,t){let n=ts(e,t);return n?o`
|
|
216
|
+
<button
|
|
217
|
+
type="button"
|
|
218
|
+
class="shrink-0 inline-flex size-5 items-center justify-center text-muted-foreground transition-colors hover:text-foreground"
|
|
219
|
+
title=${v(`previewArtifact`)}
|
|
220
|
+
aria-label=${v(`previewArtifact`)}
|
|
221
|
+
@click=${e=>{e.preventDefault(),e.stopPropagation(),window.dispatchEvent(new CustomEvent($o,{detail:n}))}}
|
|
222
|
+
><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"/><circle cx="12" cy="12" r="3"/></svg></button>
|
|
223
|
+
`:c}var $=new Map,rs=200;function is(e,t){if(e){if(!$.has(e)&&$.size>=rs){let e=$.keys().next().value;e&&$.delete(e)}$.set(e,t)}}function as(e,t,n){let{toolCallId:r}=No(n);return r||`${e}:${Z(t)}`}var os=new re;function ss(e){let t=S(e),n=t?v(`viewSubagentRunDetails`):e.statusLabel,r=j(e,os);return o`
|
|
224
|
+
<div class="quickforge-subagent-tool">
|
|
225
|
+
<button
|
|
226
|
+
type="button"
|
|
227
|
+
class="quickforge-tool-summary flex w-full cursor-pointer list-none items-center gap-2 text-left text-sm text-muted-foreground select-none disabled:cursor-not-allowed disabled:opacity-70"
|
|
228
|
+
title=${n}
|
|
229
|
+
aria-label=${`${e.statusLabel} · ${n}`}
|
|
230
|
+
aria-disabled=${String(!t)}
|
|
231
|
+
?disabled=${!t}
|
|
232
|
+
@click=${()=>{if(!t)return;let n=N(e,P.get(e.runId));window.dispatchEvent(new CustomEvent(te,{detail:{runId:n.runId,payload:n}}))}}
|
|
233
|
+
>
|
|
234
|
+
${Jo(`run_subagent`)}
|
|
235
|
+
<span class="quickforge-subagent-title min-w-0">
|
|
236
|
+
<span class="quickforge-subagent-label">${e.statusLabel}</span>
|
|
237
|
+
${r.length>0?o`
|
|
238
|
+
<quickforge-tool-marquee
|
|
239
|
+
class="quickforge-subagent-marquee"
|
|
240
|
+
text=${r.join(` · `)}
|
|
241
|
+
running="true"
|
|
242
|
+
aria-label=${v(`subagentRunningTools`)}
|
|
243
|
+
></quickforge-tool-marquee>
|
|
244
|
+
`:c}
|
|
245
|
+
${Zo(e.status,e.timing)}
|
|
246
|
+
</span>
|
|
247
|
+
</button>
|
|
248
|
+
</div>
|
|
249
|
+
`}function cs(e){let t=new Set(ee(e)),n=T(e),r=new Set(e.pendingToolCalls);return o`
|
|
250
|
+
<div class="mt-3 space-y-3">
|
|
251
|
+
${t.has(`task`)?o`<div class="quickforge-subagent-task quickforge-input-clamp" data-quickforge-input-clamp="true">
|
|
252
|
+
<div class="space-y-1">
|
|
253
|
+
${e.task?o`<div><span class="font-medium">${v(`subagentTask`)}:</span> <span class="quickforge-subagent-task-value">${e.task}</span></div>`:c}
|
|
254
|
+
${e.context?o`<div><span class="font-medium">${v(`subagentContext`)}:</span> <span class="quickforge-subagent-task-value">${e.context}</span></div>`:c}
|
|
255
|
+
${e.expectedOutput?o`<div><span class="font-medium">${v(`subagentExpectedOutput`)}:</span> <span class="quickforge-subagent-task-value">${e.expectedOutput}</span></div>`:c}
|
|
256
|
+
</div>
|
|
257
|
+
</div>`:c}
|
|
258
|
+
${t.has(`summary`)?o`<div class="quickforge-subagent-summary rounded-lg border border-border/75 bg-muted/20 px-3 py-2.5 text-sm">
|
|
259
|
+
<div class="flex flex-wrap items-center gap-x-3 gap-y-1 text-muted-foreground">
|
|
260
|
+
<span class="font-medium text-foreground/85">${e.label}</span>
|
|
261
|
+
${e.toolCalls===void 0?c:o`<span>${v(`subagentToolCalls`)}: ${e.toolCalls}</span>`}
|
|
262
|
+
${e.timing?o`<span>${Ko(e.timing,e.status)}</span>`:c}
|
|
263
|
+
</div>
|
|
264
|
+
${e.allowedTools.length>0?o`<div class="mt-2 flex flex-wrap gap-1.5">${e.allowedTools.map(e=>o`<span class="rounded-full bg-background/80 px-2 py-0.5 text-[11px] text-muted-foreground/80">${e}</span>`)}</div>`:c}
|
|
265
|
+
</div>`:c}
|
|
266
|
+
${t.has(`trace`)?o`<div class="quickforge-subagent-trace p-2.5"><message-list data-quickforge-subagent-process="true" data-quickforge-subagent-streaming=${String(e.status===`running`)} .messages=${n} .tools=${e.tools} .pendingToolCalls=${r} .isStreaming=${!1}></message-list></div>`:c}
|
|
267
|
+
${t.has(`error`)?o`<div class="quickforge-subagent-error rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive" role="alert"><span class="font-medium">${v(`subagentErrorReason`)}:</span> ${e.errorMessage||v(`subagentErrorUnavailable`)}</div>`:c}
|
|
268
|
+
${t.has(`output`)?o`<div><div class="mb-1 text-xs font-medium text-muted-foreground">${v(`subagentResult`)}</div><code-block .code=${e.output} language="text"></code-block></div>`:c}
|
|
269
|
+
${t.has(`input`)?o`<div><div class="mb-1 text-xs font-medium text-muted-foreground">${v(`input`)}</div><code-block .code=${e.input} language="json"></code-block></div>`:c}
|
|
270
|
+
${t.has(`details`)?o`<div><div class="mb-1 text-xs font-medium text-muted-foreground">${v(`details`)}</div><code-block .code=${e.details} language="json"></code-block></div>`:c}
|
|
271
|
+
</div>
|
|
272
|
+
`}var ls=class extends s{static properties={payload:{attribute:!1}};__processDecorationScheduled=!1;__processDecorationPending=!1;__processDecorationDisposed=!1;createRenderRoot(){return this}connectedCallback(){super.connectedCallback?.(),this.__processDecorationDisposed=!1}disconnectedCallback(){this.__processDecorationDisposed=!0,super.disconnectedCallback?.()}render(){return this.payload?cs(this.payload):o`<div class="rounded-lg border border-border bg-background/60 px-3 py-6 text-center text-sm text-muted-foreground/70">${v(`subagentRunEmpty`)}</div>`}updated(){this.scheduleProcessDecoration()}scheduleProcessDecoration(){if(!this.__processDecorationDisposed){if(this.__processDecorationScheduled){this.__processDecorationPending=!0;return}this.__processDecorationScheduled=!0,(async()=>{try{if(await this.updateComplete,this.__processDecorationDisposed||!this.isConnected)return;Pe(this,So);let e=this.querySelector(`message-list[data-quickforge-subagent-process="true"]`)?.updateComplete;if(e&&await e,this.__processDecorationDisposed||!this.isConnected)return;io(this)}catch{}finally{this.__processDecorationScheduled=!1,this.__processDecorationPending&&!this.__processDecorationDisposed&&(this.__processDecorationPending=!1,this.scheduleProcessDecoration())}})()}}};customElements.get(`subagent-run-detail-body`)||customElements.define(`subagent-run-detail-body`,ls);var us=class{render(e,t,n){let r=O(e,t,n,g().toolDisplayMode,v,t?.toolCallId);return C(r,P.get(r.runId))&&P.publish(r),{isCustom:!1,content:ss(r)}}},ds=class{render(e,t,n){let r=Co(t,n),i=M(t?.details),a=de(t?.details),s=D(`generate_image`,e,t),l=wo(t),u=a?.model||(typeof e?.model==`string`?e.model:``);return{isCustom:!0,content:o`
|
|
273
|
+
<div class="quickforge-generated-image-tool space-y-3">
|
|
274
|
+
<div class="flex items-center gap-2 text-sm text-muted-foreground">
|
|
275
|
+
${Jo(`generate_image`)}
|
|
276
|
+
<span class="min-w-0 flex-1 truncate">${v(`generateImage`)}${s?o`<span class="text-muted-foreground/70"> · ${s}</span>`:c}</span>
|
|
277
|
+
${Zo(r,i)}
|
|
278
|
+
</div>
|
|
279
|
+
${a?o`
|
|
280
|
+
<div class=${a.assets.length>1?`grid grid-cols-1 gap-3 sm:grid-cols-2`:`grid grid-cols-1 gap-3`}>
|
|
281
|
+
${a.assets.map((e,t)=>{let n=fe(a,e),r=v(`generatedImageAlt`,{index:t+1});return o`
|
|
282
|
+
<figure class="overflow-hidden rounded-lg border border-border bg-background/60">
|
|
283
|
+
<a href=${n} target="_blank" rel="noopener noreferrer" title=${v(`openGeneratedImage`)} aria-label=${v(`openGeneratedImage`)}>
|
|
284
|
+
<img class="block max-h-[32rem] w-full object-contain" src=${n} alt=${r} loading="lazy" referrerpolicy="no-referrer" />
|
|
285
|
+
</a>
|
|
286
|
+
<figcaption class="flex items-center gap-2 border-t border-border px-3 py-2 text-xs text-muted-foreground">
|
|
287
|
+
<span class="min-w-0 flex-1 truncate">${u||e.mimeType}</span>
|
|
288
|
+
<a class="text-muted-foreground transition-colors hover:text-foreground" href=${n} download=${e.assetId} title=${v(`downloadGeneratedImage`)} aria-label=${v(`downloadGeneratedImage`)}>${v(`downloadGeneratedImage`)}</a>
|
|
289
|
+
</figcaption>
|
|
290
|
+
</figure>
|
|
291
|
+
`})}
|
|
292
|
+
</div>
|
|
293
|
+
${a.text?o`<div class="text-sm leading-relaxed text-muted-foreground">${a.text}</div>`:c}
|
|
294
|
+
`:r===`running`?o`
|
|
295
|
+
<div class="rounded-lg border border-border bg-background/60 px-3 py-6 text-center text-sm text-muted-foreground">${v(`generatingImage`)}</div>
|
|
296
|
+
`:l?o`<code-block .code=${l} language="text"></code-block>`:c}
|
|
297
|
+
</div>
|
|
298
|
+
`}}},fs=class{toolName;labelKey;constructor(e,t){this.toolName=e,this.labelKey=t}render(e,t,n){let r=Co(t,n),i=M(t?.details),a=Eo(e),s=Do(t?.details),c=To(e,t?.details),l=typeof c?.title==`string`&&c.title?c.title:typeof c?.kind==`string`?c.kind:``,u=typeof c?.kind==`string`&&c.kind!==l?c.kind:``,d=D(this.toolName,a,t),f=g().toolDisplayMode===`detailed`,p=f?Z(a):``,m=Ao(this.toolName,a,t,n),h=jo(s),_=f?Z(h?Mo(s):s):``,y=as(this.toolName,a,t?.details),b=$.get(y)??f,x=t?.isError?`error`:`default`;return{isCustom:!0,content:o`
|
|
299
|
+
<div class="quickforge-local-tool-shell">
|
|
300
|
+
<details class="group/tool quickforge-local-tool" ?open=${b} @toggle=${e=>{e.isTrusted&&is(y,e.currentTarget.open)}}>
|
|
301
|
+
<summary class="quickforge-tool-summary flex cursor-pointer list-none items-center gap-2 text-sm text-muted-foreground select-none">
|
|
302
|
+
${Jo(this.toolName)}
|
|
303
|
+
<span class="quickforge-tool-title min-w-0">
|
|
304
|
+
<span class="quickforge-tool-label">${l?o`OpenCode<span class="quickforge-tool-summary-detail text-muted-foreground/70"> · ${l}${u?`/${u}`:``}</span>`:v(this.labelKey)}${d?o`<span class="quickforge-tool-summary-detail text-muted-foreground/70"> · ${d}</span>`:``}</span>
|
|
305
|
+
<svg class="quickforge-tool-chevron shrink-0 group-open/tool:rotate-90" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 18 6-6-6-6"/></svg>
|
|
306
|
+
${Fo(this.toolName,h,r===`running`)}
|
|
307
|
+
${Zo(r,i)}
|
|
308
|
+
</span>
|
|
309
|
+
</summary>
|
|
310
|
+
<div class="mt-3 space-y-3">
|
|
311
|
+
${p?o`<div><div class="mb-1 text-xs font-medium text-muted-foreground">${v(`input`)}</div><code-block .code=${p} language="json"></code-block></div>`:``}
|
|
312
|
+
${m?o`<div><div class="mb-1 text-xs font-medium text-muted-foreground">${v(`output`)}</div>${this.toolName===`run_command`?o`<console-block .content=${m} .variant=${x}></console-block>`:o`<code-block .code=${m} language="text"></code-block>`}</div>`:``}
|
|
313
|
+
${h?Ro(h):``}
|
|
314
|
+
${_?o`<div><div class="mb-1 text-xs font-medium text-muted-foreground">${v(`details`)}</div><code-block .code=${_} language="json"></code-block></div>`:``}
|
|
315
|
+
</div>
|
|
316
|
+
</details>
|
|
317
|
+
<span class="quickforge-tool-actions inline-flex shrink-0 items-center gap-1">
|
|
318
|
+
${ns(this.toolName,a)}
|
|
319
|
+
${Qo(this.toolName,r,t?.details)}
|
|
320
|
+
</span>
|
|
321
|
+
</div>
|
|
322
|
+
`}}};function ps(e){let t=Array.isArray(e?.questions)?e.questions.filter(e=>Q(e)&&typeof e.question==`string`&&!!e.question.trim()):[];return t.length?t.map(e=>String(e.question)):typeof e?.question==`string`&&e.question.trim()?[e.question]:[]}function ms(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,n=t.questions,r=t.answers;if(!Array.isArray(n)||n.length===0||!Array.isArray(r))return null;let i=[];for(let e of n){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e.question;if(typeof t!=`string`||!t)return null;i.push({question:t})}return{questions:i,answers:i.map((e,t)=>{let n=r[t];if(!n||typeof n!=`object`||Array.isArray(n))return;let i=n;return{choices:Array.isArray(i.choices)?i.choices.filter(e=>typeof e==`string`):void 0,custom:typeof i.custom==`string`?i.custom:void 0}}),skipped:t.skipped===!0,skipReason:typeof t.skipReason==`string`&&t.skipReason?t.skipReason:void 0}}var hs={timeout:`askUserSkipReasonTimeout`,aborted:`askUserSkipReasonAborted`,"no-questions":`askUserSkipReasonNoQuestions`};function gs(e){return v(e&&hs[e]?hs[e]:`askUserSkipReasonUser`)}var _s=class{render(e,t,n){let r=Co(t,n),i=M(t?.details),a=Eo(e),s=ps(a),l=g().toolDisplayMode===`detailed`,u=l?Z(a):``,d=ms(t?.details),f=d!==null&&!l,p=f?``:wo(t),m=d&&f?d.questions.map((e,t)=>({question:`${t+1}. ${e.question}`,answer:d.skipped?v(`askUserUnanswered`):mn(d.answers[t])||v(`askUserUnanswered`)})):[],h=d&&f&&d.skipped?gs(d.skipReason):``,_=as(`ask_user`,a,t?.details),y=$.get(_)??l,b=s.length?`${v(`askUserSummaryCount`,{count:String(s.length)})}${s[0]?` · ${s[0]}`:``}`:``;return{isCustom:!0,content:o`
|
|
323
|
+
<div class="quickforge-local-tool-shell">
|
|
324
|
+
<details class="group/tool quickforge-local-tool" ?open=${y} @toggle=${e=>{e.isTrusted&&is(_,e.currentTarget.open)}}>
|
|
325
|
+
<summary class="quickforge-tool-summary flex cursor-pointer list-none items-center gap-2 text-sm text-muted-foreground select-none">
|
|
326
|
+
${Jo(`ask_user`)}
|
|
327
|
+
<span class="quickforge-tool-title min-w-0">
|
|
328
|
+
<span class="quickforge-tool-label">${v(`askUserTitle`)}${b?o`<span class="quickforge-tool-summary-detail text-muted-foreground/70"> · ${b}</span>`:``}</span>
|
|
329
|
+
<svg class="quickforge-tool-chevron shrink-0 group-open/tool:rotate-90" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 18 6-6-6-6"/></svg>
|
|
330
|
+
${Zo(r,i)}
|
|
331
|
+
</span>
|
|
332
|
+
</summary>
|
|
333
|
+
<div class="mt-3 space-y-3">
|
|
334
|
+
${m.length?o`
|
|
335
|
+
<div class="quickforge-ask-review">
|
|
336
|
+
${h?o`<div class="quickforge-ask-review-answer">${h}</div>`:c}
|
|
337
|
+
${m.map(e=>o`
|
|
338
|
+
<div class="quickforge-ask-review-row">
|
|
339
|
+
<div class="quickforge-ask-review-content">
|
|
340
|
+
<span class="quickforge-ask-review-question">${e.question}</span>
|
|
341
|
+
<span class="quickforge-ask-review-answer">${e.answer}</span>
|
|
342
|
+
</div>
|
|
343
|
+
</div>
|
|
344
|
+
`)}
|
|
345
|
+
</div>
|
|
346
|
+
`:c}
|
|
347
|
+
${s.length&&!l&&d===null?o`<div><div class="mb-1 text-xs font-medium text-muted-foreground">${v(`input`)}</div><div class="quickforge-ask-tool-questions">${s.map(e=>o`<div>${e}</div>`)}</div></div>`:c}
|
|
348
|
+
${u?o`<div><div class="mb-1 text-xs font-medium text-muted-foreground">${v(`input`)}</div><code-block .code=${u} language="json"></code-block></div>`:c}
|
|
349
|
+
${p?o`<div><div class="mb-1 text-xs font-medium text-muted-foreground">${v(`output`)}</div><code-block .code=${p} language="text"></code-block></div>`:c}
|
|
350
|
+
</div>
|
|
351
|
+
</details>
|
|
352
|
+
</div>
|
|
353
|
+
`}}},vs=class{render(e,t,n){let r=Co(t,n),i=M(t?.details),a=To(e,t?.details),s=typeof a?.title==`string`&&a.title?a.title:typeof a?.kind==`string`&&a.kind?a.kind:`tool`,l=typeof a?.kind==`string`&&a.kind&&a.kind!==s?a.kind:``,u=Eo(e),d=Do(t?.details),f=g().toolDisplayMode===`detailed`,p=f?Z(u):``,m=wo(t),h=jo(d),_=f?Z(h?Mo(d):d):``,y=as(`opencode_tool`,u,t?.details);return{isCustom:!0,content:o`
|
|
354
|
+
<div class="quickforge-local-tool-shell quickforge-opencode-tool-shell">
|
|
355
|
+
<details class="group/tool quickforge-local-tool quickforge-opencode-tool" ?open=${$.get(y)??f} @toggle=${e=>{e.isTrusted&&is(y,e.currentTarget.open)}}>
|
|
356
|
+
<summary class="quickforge-tool-summary flex cursor-pointer list-none items-center gap-2 text-sm text-muted-foreground select-none">
|
|
357
|
+
${Jo(`opencode_tool`)}
|
|
358
|
+
<span class="quickforge-tool-title min-w-0">
|
|
359
|
+
<span class="quickforge-tool-label">OpenCode<span class="quickforge-tool-summary-detail text-muted-foreground/70"> · ${s}${l?`/${l}`:``}</span></span>
|
|
360
|
+
<svg class="quickforge-tool-chevron shrink-0 group-open/tool:rotate-90" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 18 6-6-6-6"/></svg>
|
|
361
|
+
${Zo(r,i)}
|
|
362
|
+
</span>
|
|
363
|
+
</summary>
|
|
364
|
+
<div class="mt-3 space-y-3">
|
|
365
|
+
${p?o`<div><div class="mb-1 text-xs font-medium text-muted-foreground">${v(`input`)}</div><code-block .code=${p} language="json"></code-block></div>`:c}
|
|
366
|
+
${m?o`<div><div class="mb-1 text-xs font-medium text-muted-foreground">${v(`output`)}</div><code-block .code=${m} language=${xs(m)}></code-block></div>`:c}
|
|
367
|
+
${h?Ro(h):c}
|
|
368
|
+
${_?o`<div><div class="mb-1 text-xs font-medium text-muted-foreground">${v(`details`)}</div><code-block .code=${_} language="json"></code-block></div>`:c}
|
|
369
|
+
</div>
|
|
370
|
+
</details>
|
|
371
|
+
</div>
|
|
372
|
+
`}}};function ys(e){if(!e.startsWith(`mcp__`))return null;let t=e.slice(5),n=t.indexOf(`__`);return n<=0||n>=t.length-2?null:{serverName:t.slice(0,n),toolName:t.slice(n+2)}}function bs(e,t){let n=ys(e),r=Q(t)?t:void 0,i=typeof r?.server==`string`&&r.server?r.server:n?.serverName??``,a=typeof r?.tool==`string`&&r.tool?r.tool:n?.toolName??e;return n||r?.mcp===!0?{serverName:i,toolName:a}:null}function xs(e){if(!e)return`text`;try{return JSON.parse(e),`json`}catch{return`text`}}var Ss=class{toolName;label;constructor(e,t){this.toolName=e,this.label=t}render(e,t,n){let r=Co(t,n),i=M(t?.details),a=bs(this.toolName,t?.details)??ys(this.toolName),s=a?.serverName??``,l=a?.toolName??this.toolName,u=D(this.toolName,e,t),d=g().toolDisplayMode===`detailed`,f=d?Z(e):``,p=Ao(this.toolName,e,t,n),m=d?Z(t?.details):``,h=as(this.toolName,e,t?.details),_=$.get(h)??d,y=this.label&&this.label!==l?`${this.label} (${l})`:l;return{isCustom:!1,content:o`
|
|
373
|
+
<details class="group/tool quickforge-mcp-tool" ?open=${_} @toggle=${e=>{e.isTrusted&&is(h,e.currentTarget.open)}}>
|
|
374
|
+
<summary class="quickforge-tool-summary flex cursor-pointer list-none items-center gap-2 text-sm text-muted-foreground select-none">
|
|
375
|
+
${Jo(this.toolName)}
|
|
376
|
+
<span class="quickforge-tool-title min-w-0">
|
|
377
|
+
<span class="quickforge-tool-label">MCP${s?o`<span class="quickforge-tool-summary-detail text-muted-foreground/70"> · ${s}</span>`:c}<span class="quickforge-tool-summary-detail text-muted-foreground/70"> · ${y}</span>${u?o`<span class="quickforge-tool-summary-detail text-muted-foreground/70"> · ${u}</span>`:c}</span>
|
|
378
|
+
<svg class="quickforge-tool-chevron shrink-0 group-open/tool:rotate-90" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 18 6-6-6-6"/></svg>
|
|
379
|
+
${Zo(r,i)}
|
|
380
|
+
</span>
|
|
381
|
+
</summary>
|
|
382
|
+
<div class="mt-3 space-y-3">
|
|
383
|
+
${f?o`<div><div class="mb-1 text-xs font-medium text-muted-foreground">${v(`input`)}</div><code-block .code=${f} language="json"></code-block></div>`:c}
|
|
384
|
+
${p?o`<div><div class="mb-1 text-xs font-medium text-muted-foreground">${v(`output`)}</div><code-block .code=${p} language=${xs(p)}></code-block></div>`:c}
|
|
385
|
+
${m?o`<div><div class="mb-1 text-xs font-medium text-muted-foreground">${v(`details`)}</div><code-block .code=${m} language="json"></code-block></div>`:c}
|
|
386
|
+
</div>
|
|
387
|
+
</details>
|
|
388
|
+
`}}},Cs=new Set;function ws(e){for(let t of e){if(!Q(t)||typeof t.name!=`string`||!ys(t.name)||Cs.has(t.name))continue;let e=typeof t.label==`string`?t.label:typeof t.description==`string`?t.description.replace(/^\[MCP:[^\]]+\]\s*/,``):void 0;l(t.name,new Ss(t.name,e)),Cs.add(t.name)}}for(let[e,t]of[[`manage_global_memory`,`manageGlobalMemory`],[`read_file`,`readFile`],[`grep_files`,`searchFiles`],[`write_file`,`writeFile`],[`edit_file`,`editFile`],[`run_command`,`runCommand`],[`present_files`,`presentFiles`],[`activate_skill`,`activateSkill`],[`read_skill_resource`,`readSkillResource`]])l(e,new fs(e,t));l(`run_subagent`,new us),l(`generate_image`,new ds),l(`opencode_tool`,new vs),l(`ask_user`,new _s);function Ts(e=[]){return ws(e),e}export{dn as C,Kt as D,Gt as E,B as O,un as S,Ut as T,Mn as _,ao as a,gn as b,Na as c,ha as d,da as f,ni as g,wi as h,ho as i,Sa as l,bi as m,xo as n,Ba as o,Si as p,bo as r,Ea as s,Ts as t,ma as u,Dn as v,Wt as w,_n as x,En as y};
|