@shawnstack/quickforge 1.7.9 → 1.7.11
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/dist/assets/{AgentProfilesPage-BSM5w3bn.js → AgentProfilesPage-Cvb1KTz5.js} +1 -1
- package/dist/assets/ChatPanelHost-C7zV-xE_.js +48 -0
- package/dist/assets/{CloudAccountSettingsPage-BJMrfgy9.js → CloudAccountSettingsPage-mAs_nbvw.js} +1 -1
- package/dist/assets/{PluginsPage-mJkTmVVV.js → PluginsPage-mLvwvTmL.js} +1 -1
- package/dist/assets/{ScheduledTasksPage-DJj_NLm9.js → ScheduledTasksPage-CuUW_9lq.js} +1 -1
- package/dist/assets/{SettingsWorkspacePage-7lQ0Wl63.js → SettingsWorkspacePage-0OINfEqK.js} +390 -390
- package/dist/assets/{ShareLinksSettingsPage-DjFq_Lnb.js → ShareLinksSettingsPage-DqeyJYoD.js} +1 -1
- package/dist/assets/{SharedConversationPage-BbuNpcpP.js → SharedConversationPage-C7CDEoX9.js} +1 -1
- package/dist/assets/TerminalDock-CZXcuMpq.js +2 -0
- package/dist/assets/{WorkspaceInspector-0i6x-diB.js → WorkspaceInspector-CNSBOEvP.js} +3 -3
- package/dist/assets/index-BgMvQW1b.js +66 -0
- package/dist/assets/index-CB1g2D0f.css +3 -0
- package/dist/assets/local-tools-Dopjg9xq.js +270 -0
- package/dist/assets/{mcp-servers-dialog-BG4b67ea.js → mcp-servers-dialog-B2lALtTE.js} +1 -1
- package/dist/assets/{skills-dialog-DIzZvQqW.js → skills-dialog-DYp35JM3.js} +1 -1
- package/dist/index.html +4 -4
- package/package.json +1 -1
- package/server/acp/server.mjs +3 -6
- package/server/agent-manager.mjs +125 -43
- package/server/auto-archive.mjs +55 -8
- package/server/auto-compaction.mjs +0 -2
- package/server/context-usage.mjs +9 -7
- package/server/index.mjs +172 -51
- package/server/lan-access-cutover.mjs +21 -4
- package/server/maintenance/downgrade-session-state-v1.mjs +50 -87
- package/server/maintenance/export-session-state-v1.mjs +5 -13
- package/server/routes/backup.mjs +8 -1
- package/server/routes/storage.mjs +85 -48
- package/server/scheduled-runs-cutover.mjs +15 -1
- package/server/session-index-service.mjs +57 -391
- package/server/session-persistence-lock.mjs +17 -6
- package/server/session-state-backup.mjs +60 -7
- package/server/session-state-import.mjs +157 -0
- package/server/session-state-maintenance.mjs +126 -0
- package/server/session-state-service.mjs +133 -194
- package/server/share-cutover.mjs +21 -4
- package/server/sqlite/database.mjs +142 -7
- package/server/sqlite/lan-access-repository.mjs +6 -4
- package/server/sqlite/migrations.mjs +109 -0
- package/server/sqlite/scheduled-task-runs-repository.mjs +6 -3
- package/server/sqlite/session-index-repository.mjs +59 -208
- package/server/sqlite/session-state-repository.mjs +359 -289
- package/server/sqlite/share-repository.mjs +56 -45
- package/server/startup-state.mjs +107 -0
- package/server/storage.mjs +240 -448
- package/server/utils/logger.mjs +15 -4
- package/server/utils/process-tree.mjs +14 -2
- package/dist/assets/ChatPanelHost-cd80S4EX.js +0 -48
- package/dist/assets/TerminalDock-CczcCJJE.js +0 -2
- package/dist/assets/index-D-J_8Smf.css +0 -3
- package/dist/assets/index-DFASc15l.js +0 -66
- package/dist/assets/local-tools-Dn1Y9aPe.js +0 -270
- package/server/session-state-cutover.mjs +0 -370
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-DWpShXCs.js","assets/pi-ai-Cr2ee4a0.js","assets/rolldown-runtime-DWdDZTNf.js","assets/chunk-HOUHSVGY-tdc-Z9eW.js","assets/src-PYsDme0X.js","assets/chunk-Y2CYZVJY-D6N-CrJv.js","assets/chunk-WYO6CB5R-NF-MsJJR.js","assets/chunk-ICXQ74PX-Cd7igVGt.js","assets/dist-CLg13NtV.js","assets/chunk-52WLFC77-CDbaHw80.js","assets/line-B4DxX7tC.js","assets/path-6uRLdFF7.js","assets/array-B9UHiPd-.js","assets/chunk-7BUUIJ7U-CCcsI9XE.js","assets/chunk-C7G6YPKG-ZMLUvfLy.js","assets/chunk-OGEWGWER-TgvkXkFX.js","assets/chunk-Q4XR5HBZ-fo5-HsqY.js","assets/pi-web-ui-DV5jKjSg.js","assets/lit-vendor-DvaQX_UQ.js","assets/chunk-ZGVPDNZ5-CRrAYi4g.js","assets/rough.esm-Bud4g4fh.js","assets/chunk-FWX5IMBZ-DrnrdrSu.js","assets/chunk-VAUOI2AC-CWYjg8zE.js","assets/chunk-ZIRB5QZD-Dc1s5bLM.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{d as e,p as t,t as n,u as r}from"./lit-vendor-DvaQX_UQ.js";import{y as i}from"./pi-web-ui-DV5jKjSg.js";import{J as a}from"./pi-ai-Cr2ee4a0.js";import{$t as o,At as s,Dt as c,Et as l,Gt as u,Jt as d,Kt as f,Ot as p,Pn as m,Qt as h,Xt as g,Yt as _,Zt as v,d as y,en as b,in as x,nn as S,ot as C,qt as w,r as T,rn as ee,tn as E}from"./index-BgMvQW1b.js";function D(e){return!!(e&&typeof e==`object`&&!Array.isArray(e))}function O(e,t,n){if(!e||e.isError||t||!D(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 te=/^[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,ne=new Set([`image/png`,`image/jpeg`,`image/webp`,`image/gif`]);function re(e){return!!(e&&typeof e==`object`&&!Array.isArray(e))}function k(e){if(!re(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=>!re(e)||typeof e.assetId!=`string`||!te.test(e.assetId)||typeof e.mimeType!=`string`||!ne.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 ie(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 A=`<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>`,j=`<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>`,M=`<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>`,N=`<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>`,ae=`<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>`,oe=`<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>`,se=`<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>`,ce=`<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>`,le=`<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>`,ue=`<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>`,de=`<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>`,fe=`<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>`,pe=`<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>`,me=`<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>`,he=`<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>`,ge=`<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>`,_e=`<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>`,ve=`<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 ye(e){return m(e===`full-access`?`agentAccessFullLabel`:`agentAccessDefaultLabel`)}function P(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 be(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=`
|
|
3
|
+
<span class="quickforge-agent-access-check-slot">${r?ge:``}</span>
|
|
4
|
+
<span class="quickforge-agent-access-option-icon-wrap">${e===`full-access`?he:me}</span>
|
|
5
|
+
<span class="quickforge-agent-access-item-label"></span>
|
|
6
|
+
`,i.querySelector(`.quickforge-agent-access-item-label`).textContent=ye(e),i.onpointerdown=t=>{t.preventDefault(),t.stopPropagation(),n(e)},i}function xe(e){let{panel:t,trigger:n,agentAccessMode:r,onAccessModeChange:i,dismissComposerMenus:a}=e;if(document.querySelector(`.quickforge-agent-access-menu`)){P(t);return}a(),P(t);let o=document.createElement(`div`);o.className=`quickforge-agent-access-menu`,o.setAttribute(`role`,`menu`),o.setAttribute(`aria-label`,m(`agentAccessMenuLabel`));let s=e=>{P(t),e!==r&&i(e)};o.append(be(`default`,r,s),be(`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}P(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 Se(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=ye(r),s=m(r===`full-access`?`agentAccessFullTitle`:`agentAccessDefaultTitle`),c=`${r===`full-access`?he:me}<span class="quickforge-agent-access-label"></span>${_e}`,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(),xe({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(),xe({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`),h=n.querySelector(`.quickforge-plan-inline`);p&&h&&p.nextSibling!==h&&n.insertBefore(h,p.nextSibling)}function Ce(e){return typeof e.group==`string`&&Array.isArray(e.options)}function we(e){let t=e?.configOptions;return Array.isArray(t)&&t.length>0}function Te(e){return e.description?`${e.name} — ${e.description}`:e.name}function Ee(e){if(!Array.isArray(e))return{groups:[],flat:[]};let t=[],n=[];for(let r of e)r&&Ce(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 F(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 De(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=`
|
|
7
|
+
<span class="quickforge-opencode-config-check-slot">${r?ge:``}</span>
|
|
8
|
+
<span class="quickforge-opencode-config-item-label"></span>
|
|
9
|
+
`,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 Oe(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=`
|
|
10
|
+
<span class="quickforge-opencode-config-check-slot">${i?ge:``}</span>
|
|
11
|
+
<span class="quickforge-opencode-config-item-label"></span>
|
|
12
|
+
`,a.querySelector(`.quickforge-opencode-config-item-label`).textContent=Te(e),a.onpointerdown=t=>{t.preventDefault(),t.stopPropagation(),!n&&!i&&r(e.value)},a}function ke(e){let t=document.createElement(`div`);return t.className=`quickforge-opencode-config-section-title`,t.textContent=e,t}function Ae(e){let{panel:t,trigger:n,acpSession:r,disabled:i,onConfigOptionChange:a,dismissComposerMenus:o}=e;if(document.querySelector(`.quickforge-opencode-config-menu`)){F(t);return}if(!we(r)){F(t);return}o(),F(t);let s=document.createElement(`div`);s.className=`quickforge-opencode-config-menu`,s.setAttribute(`role`,`menu`),s.setAttribute(`aria-label`,m(`openCodeConfigMenuLabel`));let c=Array.isArray(r?.configOptions)?r.configOptions:[];if(c.length>0){s.append(ke(m(`openCodeConfigOptionsTitle`)));for(let e of c){if(e.type===`boolean`){s.append(De(e,i,t=>a(e.id,t)));continue}if(e.type===`select`){let{groups:t,flat:n}=Ee(e.options),r=typeof e.currentValue==`string`?e.currentValue:``,o=ke(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(Oe(t,r,i,t=>a(e.id,t)))}else for(let t of n)s.append(Oe(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}F(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 je(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`),!we(r())){n.querySelector(`.quickforge-opencode-config-inline`)?.remove(),F(t);return}let c=e=>{Ae({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=m(t?`openCodeConfigDisabledWhileStreaming`:`openCodeConfigMenuLabel`);d(e,`${ve}<span class="quickforge-opencode-config-label"></span>${_e}`),e.querySelector(`.quickforge-opencode-config-label`).textContent=m(`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 Me(e){let t=e?.modes;return!!(t&&Array.isArray(t.availableModes)&&t.availableModes.length>0)}function Ne(e){let t=e?.modes?.currentModeId;return t?e?.modes?.availableModes?.find(e=>e.id===t)?.name??t:``}function I(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 Pe(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 Fe(e){let{panel:t,trigger:n,acpSession:r,disabled:i,onModeChange:a,dismissComposerMenus:o}=e;if(document.querySelector(`.quickforge-opencode-mode-menu`)){I(t);return}if(!Me(r)){I(t);return}o(),I(t);let s=document.createElement(`div`);s.className=`quickforge-opencode-mode-menu quickforge-model-menu`,s.setAttribute(`role`,`menu`),s.setAttribute(`aria-label`,m(`openCodeModeMenuLabel`));let c=r?.modes?.currentModeId??``,l=document.createElement(`div`);l.className=`quickforge-model-menu-header`,l.textContent=m(`openCodeConfigModesTitle`),s.append(l);let u=e=>{I(t),e!==c&&a(e)};for(let e of r?.modes?.availableModes??[])s.append(Pe(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}I(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 Ie(e){let{panel:t,rightControls:n,getAcpSession:r,isStreaming:i,onModeChange:a,dismissComposerMenus:o}=e;if(!Me(r())){t.querySelector(`.quickforge-opencode-mode-inline`)?.remove(),I(t);return}let s=e=>{Fe({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=m(l?`openCodeModeDisabledWhileStreaming`:`openCodeModeMenuLabel`);d(c,`<span class="quickforge-opencode-mode-label"></span>`),c.querySelector(`.quickforge-opencode-mode-label`).textContent=Ne(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 Le={plugin:ue,document:de,spreadsheet:fe,presentation:pe,skill:ue,tool:ue,command:ue};function L(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 Re(e,t){e.querySelectorAll(`.quickforge-native-attachment-hidden`).forEach(e=>{t.contains(e)||e.classList.remove(`quickforge-native-attachment-hidden`)})}function ze(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 Be(e,t){e.querySelectorAll(`input[type="file"]`).forEach(e=>{e.disabled=!0}),t&&(Re(e,t),ze(t)?.classList.add(`quickforge-native-attachment-hidden`))}function Ve(e,t){let n=e.querySelector(`input[type="file"]`);if(n){n.click();return}ze(t)?.click()}function He({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=`
|
|
13
|
+
<span class="quickforge-plus-popover-item-icon">${t}</span>
|
|
14
|
+
<span class="quickforge-plus-popover-item-main">
|
|
15
|
+
<span class="quickforge-plus-popover-item-label"></span>
|
|
16
|
+
${r?`<span class="quickforge-plus-popover-item-description"></span>`:``}
|
|
17
|
+
</span>
|
|
18
|
+
`,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 Ue(e,t){let{panel:n,editor:r,leftControls:i,insertBuiltinPluginMention:a,removeCommandSuggestions:o,removeCapabilitySuggestions:s}=e;I(n),o(),s();let c=n.querySelector(`.quickforge-plus-popover`)??document.createElement(`div`);c.className=`quickforge-plus-popover`,c.setAttribute(`role`,`menu`),c.innerHTML=``;let l=document.createElement(`div`);if(l.className=`quickforge-plus-popover-header`,l.textContent=m(t===`plugins`?`composerAddPlugins`:`composerAddMenu`),c.append(l),t===`main`)e.attachmentsEnabled&&c.append(He({icon:le,label:m(`composerAddAttachment`),onSelect:()=>{L(n),Ve(r,i)}})),e.pluginsEnabled&&e.availablePluginRows().length>0&&c.append(He({icon:ue,label:m(`composerAddPlugins`),onSelect:()=>Ue(e,`plugins`)}));else{let t=He({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:m(`composerAddBack`),onSelect:()=>Ue(e,`main`)});c.append(t);for(let t of e.availablePluginRows())c.append(He({icon:Le[t.iconKind],label:t.label,description:t.description,pluginName:t.pluginName,onSelect:()=>{a(t.mention),L(n)}}))}c.isConnected||r.parentElement?.insertBefore(c,r),c.__quickforgeDismissHandler&&document.removeEventListener(`pointerdown`,c.__quickforgeDismissHandler,!0),c.__quickforgeDismissHandler=e=>{let t=e.target;c.contains(t)||n.querySelector(`.quickforge-plus-inline`)?.contains(t)||L(n)},document.addEventListener(`pointerdown`,c.__quickforgeDismissHandler,!0),n.querySelector(`.quickforge-plus-inline`)?.setAttribute(`aria-expanded`,`true`)}function We(e){let{panel:t,editor:n,leftControls:r}=e;Re(n,r),ze(r)?.classList.add(`quickforge-native-attachment-hidden`);let i=r.querySelector(`.quickforge-plus-inline`),a=n=>{n.type=`button`,d(n,ce),n.title=m(`composerAddMenu`),n.setAttribute(`aria-label`,m(`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`)?L(t):Ue(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 Ge(e){switch(e){case`low`:return m(`thinkingLow`);case`medium`:return m(`thinkingMedium`);case`high`:return m(`thinkingHigh`);case`xhigh`:return m(`thinkingXHigh`);default:return m(`thinkingOff`)}}function Ke(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=`· ${Ge(n?.thinkingLevel)}`:delete i.dataset.quickforgeThinkingLevel)}function qe(e){let t=e?.querySelector(`textarea`);t?.__quickforgePlanModeHandler&&(t.removeEventListener(`keydown`,t.__quickforgePlanModeHandler,!0),t.__quickforgePlanModeHandler=void 0),e&&delete e.dataset.quickforgePlanMode}function Je(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 Ye(e){let{panel:t,leftControls:n,planMode:r,onTogglePlanMode:i}=e,a=m(`planModeEnabledTitle`),o=`${oe}${se}<span>${m(`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 Xe(e){let{rightControls:t,isStreaming:n,abort:r,removeCommandSuggestions:i}=e,a=t.querySelector(`button:last-child`);if(!a)return;let o=()=>{a.__quickforgeStopHandler&&=(a.removeEventListener(`pointerdown`,a.__quickforgeStopHandler,!0),a.removeEventListener(`click`,a.__quickforgeStopHandler,!0),void 0)};if(n())a.disabled=!1,a.classList.remove(`quickforge-send-button`),a.classList.add(`quickforge-stop-button`),a.title=`Stop`,a.setAttribute(`aria-label`,`Stop`),delete a.dataset.quickforgeSendIcon,_(a,`<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>`),a.__quickforgeStopHandler||(a.__quickforgeStopHandler=e=>{e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),i(),r()},a.addEventListener(`pointerdown`,a.__quickforgeStopHandler,!0),a.addEventListener(`click`,a.__quickforgeStopHandler,!0));else if(o(),a.classList.remove(`quickforge-stop-button`),a.classList.add(`quickforge-send-button`),a.dataset.quickforgeSendIcon!==`arrow-up`){a.dataset.quickforgeSendIcon=`arrow-up`,_(a,`<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=a.querySelector(`svg`)?.parentElement;e&&e!==a&&e.style.transform&&(e.style.transform=``)}}function Ze(e){let{editor:t,onInput:n,onFilesChange:r,removeCommandSuggestions:i,updateCommandSuggestions:a,removeCapabilitySuggestions:o,updateCapabilitySuggestions:s,attachmentsEnabled:c=!0,onBeforeSend:l}=e;if(!t)return;t.__quickforgeAttachmentPasteGuard&&t.removeEventListener(`paste`,t.__quickforgeAttachmentPasteGuard,!0),t.__quickforgeAttachmentDropGuard&&t.removeEventListener(`drop`,t.__quickforgeAttachmentDropGuard,!0),c?(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)};let u=t.onSend;u&&u!==t.__quickforgePlanWrappedOnSend&&(t.__quickforgePlanBaseOnSend=u);let d=t.__quickforgePlanBaseOnSend;if(d){let e=(e,t)=>{let n=String(e??``);T({attachments:c},n,t)&&(l?.(n),i(),o(),d(n,c?t:[]))};t.__quickforgePlanWrappedOnSend=e,t.onSend=e}a(),s()}function Qe(e){let t=e.querySelector(`message-editor`),n=t?.querySelector(`textarea`);return{text:t?.value??n?.value??``,attachments:t?.attachments?[...t.attachments]:[]}}function $e(e,t,n){let r=Qe(e);f(r)?t.set(n,r):t.delete(n)}function et(e,t,n,r){if(!f(t))return!1;let i={text:t.text,attachments:t.attachments?[...t.attachments]:[]},a=e.querySelector(`message-editor`),o=a?.querySelector(`textarea`);return!a&&!o?!1:(a&&(a.value=i.text,a.attachments=i.attachments,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 tt(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(!et(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 R(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`)}function nt(e){return e.split(`
|
|
19
|
+
`).map(e=>{let t=R(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(`
|
|
20
|
+
`)}function rt(e,t){let n=e.split(`
|
|
21
|
+
`),r=t.split(`
|
|
22
|
+
`),i=[];for(let e of n)i.push(`<span style="color:rgb(153 27 27);background:rgba(239,68,68,.12);display:block;">- ${R(e)}</span>`);for(let e of r)i.push(`<span style="color:rgb(22 101 52);background:rgba(34,197,94,.14);display:block;">+ ${R(e)}</span>`);return i.join(`
|
|
23
|
+
`)}function it(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 at=`.quickforge-approval-card`,ot={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 st(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 ct(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 lt(e,t=m){let n=ot[e];if(n)return t(n);let r=st(e);if(r)return`MCP · ${r.serverName} · ${r.toolName}`;let i=ct(e);return i?`Plugin · ${i.pluginName} · ${i.toolName}`:e}function ut(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 dt(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function ft({toolName:e,args:t,source:n,tone:r=`warning`,copy:i,disabled:a=!1,disabledReason:o=``,translate:s=m}){let c=st(e),l=ct(e),u=lt(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]:[]],h=typeof t.keepRecentTurns==`number`?t.keepRecentTurns:3,g=r===`info`?s(`autoCompactApprovalRisk`,{keepRecentTurns:h}):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??g,approveLabel:i?.approve??s(r===`info`?`autoCompactApprovalAccept`:`toolApprovalAccept`),rejectLabel:i?.reject??s(r===`info`?`autoCompactApprovalReject`:`toolApprovalReject`),toolDisplayName:u,badges:p,criticalParameters:d,keySummary:ut(e,t),details:dt(t),disabled:a,disabledReason:a?o||s(`toolApprovalDisabled`):``,integration:c?`mcp`:l?`plugin`:null}}function pt(e){return e.role===`user`||e.role===`user-with-attachments`||e.role===`assistant`}function mt(e){return e.role===`user`||e.role===`user-with-attachments`}function ht(e,t,n){if(n<=0||t.length===0)return null;let r=[];for(let e=0;e<t.length;e++)mt(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(pt(t[e])){if(e===a)return s[c]??null;c+=1}return null}function gt(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 _t(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>${R(n)}</span><strong>${R(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> ${R(t.command)}</pre>`;else if(e===`edit_file`)i=`<pre class="quickforge-approval-code">${rt(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">${nt(t.content.slice(0,800))}${e?`\n${R(m(`toolApprovalTruncated`))}`:``}</pre>`}else n.keySummary&&!n.criticalParameters.some(({value:e})=>e===n.keySummary)&&(i=`<pre class="quickforge-approval-code">${R(n.keySummary)}</pre>`);return r||i?`<div class="quickforge-approval-impact">${r}${i}</div>`:``}function vt(e,t,n,r,i){let{panel:a,onApprove:o,onReject:s}=e,c=ft({toolName:t,args:r,source:i,tone:e.tone,copy:e.copy,disabled:e.disabled,disabledReason:e.disabledReason}),l=it(c);if(a.querySelector(`.quickforge-approval-card[data-tool-call-id="${CSS.escape(n)}"]`)?.dataset.displaySignature===l)return;yt(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=`
|
|
24
|
+
<div class="quickforge-approval-status-row">
|
|
25
|
+
<div class="quickforge-approval-status">${gt(c.tone)}<span>${R(c.status)}</span></div>
|
|
26
|
+
${c.badges.length?`<div class="quickforge-approval-badges">${c.badges.map(e=>`<span class="quickforge-approval-badge">${R(e)}</span>`).join(``)}</div>`:``}
|
|
27
|
+
</div>
|
|
28
|
+
<h3 class="quickforge-approval-title">${R(c.title)}</h3>
|
|
29
|
+
<p class="quickforge-approval-risk">${R(c.risk)}</p>
|
|
30
|
+
${_t(t,r,c)}
|
|
31
|
+
`,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 h=document.createElement(`span`);h.textContent=m(`toolApprovalViewDetails`),p.append(h);let g=document.createElement(`div`);g.className=`quickforge-approval-details-content`,g.innerHTML=`<pre class="quickforge-approval-code">${R(c.details)}</pre>`,p.addEventListener(`click`,e=>{e.stopPropagation();let t=f.classList.toggle(`quickforge-approval-details--open`);p.setAttribute(`aria-expanded`,String(t)),h.textContent=m(t?`toolApprovalHideDetails`:`toolApprovalViewDetails`)}),f.append(p,g),d.append(f);let _=document.createElement(`div`);_.className=`quickforge-approval-message`,c.disabledReason?(_.textContent=c.disabledReason,_.classList.add(`quickforge-approval-message--disabled`)):_.hidden=!0,d.append(_);let v=document.createElement(`div`);v.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=m(`toolApprovalSubmitting`))},S=async(e,t,n)=>{_.hidden=!0,_.textContent=``,_.classList.remove(`quickforge-approval-message--disabled`),x(!0,t);try{await e()}catch(e){_.textContent=e instanceof Error&&e.message?e.message:m(`toolApprovalFailed`),_.hidden=!1,t.textContent=m(`toolApprovalRetry`);let n=t===y?b:y;n.textContent=t===y?c.rejectLabel:c.approveLabel,x(!1),t.textContent=m(`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),v.append(b,y),d.append(v);let C=e.keepRecentTurns?ht(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 yt(e){e.querySelectorAll(at).forEach(e=>e.remove())}function bt(e,t,n){let r=m(`copied`),i=Number(e.dataset.quickforgeCopyFeedbackTimer);i&&window.clearTimeout(i),_(e,j),e.title=r,e.setAttribute(`aria-label`,r),e.style.color=`rgb(5 150 105)`;let a=window.setTimeout(()=>{_(e,n),e.title=t,e.setAttribute(`aria-label`,t),e.style.color=``,delete e.dataset.quickforgeCopyFeedbackTimer},1200);e.dataset.quickforgeCopyFeedbackTimer=String(a)}function xt(e){return e.role===`user`||e.role===`user-with-attachments`||e.role===`assistant`}function St(e){return e.role===`user`||e.role===`user-with-attachments`}function Ct(e,t){for(let n=Math.min(t,e.length-1);n>=0;n--)if(St(e[n]))return n;return 0}function wt(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 Tt(e,t,n,r){let i=wt(e),a=0;for(let e=0;e<t.length;e++)if(xt(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 Et(e){let t=e,n=t?.role===`assistant`?l(t):p(t);return(n.match(/<compact_summary>\s*([\s\S]*?)\s*<\/compact_summary>/i)?.[1]??n).trim()}function Dt(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?m(`contextCompactedHideSummary`):m(`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 c(t),bt(o,m(`contextCompactedCopySummary`),A)})}function Ot(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=Ct(o,Math.max(0,c-i)),d=a.summaryMessage?Et(a.summaryMessage):``,f=s?.querySelector(`.quickforge-context-compaction-details`)?.open??!1,p=s??document.createElement(`div`),h=p.dataset.summaryText??``,g=p.dataset.hasSummary===`true`,_=!s||h!==d||g!==!!d;p.className=`quickforge-context-compaction-notice`,p.dataset.tailStart=String(u),p.dataset.summaryText=d,p.dataset.hasSummary=String(!!d),p.title=m(`contextCompactedTooltip`),p.setAttribute(`aria-label`,m(`contextCompactedTooltip`)),_&&(p.innerHTML=d?`
|
|
32
|
+
<details class="quickforge-context-compaction-details">
|
|
33
|
+
<summary class="quickforge-context-compaction-summary">
|
|
34
|
+
<div class="quickforge-context-compaction-line"></div>
|
|
35
|
+
<div class="quickforge-context-compaction-pill">
|
|
36
|
+
<span class="quickforge-context-compaction-dot" aria-hidden="true"></span>
|
|
37
|
+
<span><strong>${R(m(`contextCompactedLabel`))}</strong> · ${R(m(`contextCompactedTimelineLabel`))} · <span class="quickforge-context-compaction-toggle-label"></span></span>
|
|
38
|
+
</div>
|
|
39
|
+
<div class="quickforge-context-compaction-line"></div>
|
|
40
|
+
</summary>
|
|
41
|
+
<div class="quickforge-context-compaction-card">
|
|
42
|
+
<div class="quickforge-context-compaction-card-header">
|
|
43
|
+
<span>${R(m(`contextCompactedSummaryTitle`))}</span>
|
|
44
|
+
<button type="button" class="quickforge-context-compaction-copy" data-quickforge-action="copy-compact-summary">${A}<span>${R(m(`contextCompactedCopySummary`))}</span></button>
|
|
45
|
+
</div>
|
|
46
|
+
<pre class="quickforge-context-compaction-text">${R(d)}</pre>
|
|
47
|
+
</div>
|
|
48
|
+
</details>
|
|
49
|
+
`:`
|
|
50
|
+
<div class="quickforge-context-compaction-summary" role="separator">
|
|
51
|
+
<div class="quickforge-context-compaction-line"></div>
|
|
52
|
+
<div class="quickforge-context-compaction-pill">
|
|
53
|
+
<span class="quickforge-context-compaction-dot" aria-hidden="true"></span>
|
|
54
|
+
<span><strong>${R(m(`contextCompactedLabel`))}</strong> · ${R(m(`contextCompactedTimelineLabel`))}</span>
|
|
55
|
+
</div>
|
|
56
|
+
<div class="quickforge-context-compaction-line"></div>
|
|
57
|
+
</div>
|
|
58
|
+
`),d&&Dt(p,d,f),Tt(t,o,u,p)}function kt(e){let{panel:t,isDegraded:n}=e,r=t.querySelector(`.quickforge-persist-degraded-notice`);if(!n()){r?.remove();return}let i=m(`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">${R(i)}</span>`;let o=t.querySelector(`message-list`);o&&o.firstElementChild!==a&&o.prepend(a)}function At(e){return String(e).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function jt(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 Mt(e){let t=[m(`openCodeUsageTokensTitle`,{used:jt(e.used)||`0`,size:jt(e.size)||`0`})];return e.cost&&Number.isFinite(e.cost.amount)&&t.push(m(`openCodeUsageCostTitle`,{amount:e.cost.amount,currency:e.cost.currency})),t.join(`
|
|
59
|
+
`)}function Nt(e){let t=`${jt(e.used)} / ${jt(e.size)} tokens`;return e.cost&&Number.isFinite(e.cost.amount)?`${t} · ${e.cost.amount} ${e.cost.currency}`:t}function Pt({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=Mt(n),o=Nt(n);if(r){if(r.dataset.quickforgeOpenCodeUsage===o)return;r.dataset.quickforgeOpenCodeUsage=o,r.innerHTML=`<span class="quickforge-opencode-usage-text">${At(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">${At(o)}</span>`,i.prepend(s)},cleanup:()=>{}}}var z=`.quickforge-process-group`,B=`.quickforge-process-body`,Ft=`.quickforge-process-tools`,It=`.quickforge-process-tools-body`,Lt=`.quickforge-process-stage`,Rt=`.quickforge-process-stage-body`,zt=`thinking-block, tool-message`,V=`thinking-block, tool-message, markdown-block`,Bt=`data-quickforge-process-final-summary`,H=`data-quickforge-process-folded`,Vt=500,Ht=new Set([`edit_file`,`write_file`]),Ut=new WeakMap,Wt=new WeakMap,U=new WeakMap,Gt=1;function Kt(e){let t=Ut.get(e);return t||(t=new Map,Ut.set(e,t)),t}function qt(e,t,n){let r=Kt(e);if(r.set(t,n),r.size<=Vt)return;let i=r.keys().next().value;i&&r.delete(i)}function Jt(e){return e.findIndex(e=>e.connected)}function Yt(e){let t=Wt.get(e);return t===void 0&&(t=Gt++,Wt.set(e,t)),t}function Xt(e,t,n){let r=en(t[0]?.message?.timestamp);return`scope:${Yt(e)}:turn:${n}:started:${r??`unknown`}`}function Zt(e,t,n,r){return e===void 0?t?n:r:e}function Qt(e,t,n,r=!1){let i=t.dataset.quickforgeProcessKey;t.dataset.quickforgeProcessKey=n;let a=Kt(e).get(n),o=Zt(a,i===n,t.dataset.expanded===`true`,r);t.dataset.expanded=String(o),a===void 0&&r&&qt(e,n,o)}function W(e){return!!(e&&typeof e==`object`&&!Array.isArray(e))}function $t(e){return typeof e==`number`&&Number.isFinite(e)?e:void 0}function en(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 tn(e){if(!W(e))return;let t=e.details;if(!W(t))return;let n=t.quickforgeTiming;if(W(n))return{startedAt:$t(n.startedAt),finishedAt:$t(n.finishedAt),durationMs:$t(n.durationMs)}}function nn(e){let t=tn(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 rn(e){return tn(e.result)?.startedAt}function an(e){if(W(e.details))return en(e.details.quickforgeProcessFinishedAt)}function on(e){let t=e.map(an).filter(e=>e!==void 0);return t.length>0?Math.max(...t):void 0}function sn(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?m(`processDurationMinutesSeconds`,{minutes:n,seconds:r}):m(`processDurationSeconds`,{seconds:r})}function G(e){return e.tool?.name||e.toolCall?.name||``}function cn(e){return e!==`run_subagent`&&e!==`generate_image`}function ln(e){return e.tagName.toLowerCase()===`tool-message`&&cn(G(e))}function un(e){return e.aborted?!0:W(e.result)&&e.result.isError===!0}function dn(e){if(!Ht.has(G(e)))return;let t=e.toolCall?.arguments?.path;if(typeof t==`string`&&t.trim())return t.trim();let n=W(e.result)?e.result.details:void 0,r=W(n)?n.path:void 0;return typeof r==`string`&&r.trim()?r.trim():void 0}function fn(e){let t=Array.from(e),n=t.map(dn),r=new Set(n.filter(e=>!!e)),i=t.length>0&&t.every(e=>Ht.has(G(e))),a=n.every(e=>e!==void 0);return{count:t.length,errorCount:t.filter(un).length,commandsOnly:t.length>0&&t.every(e=>G(e)===`run_command`),...i&&a?{editedFileCount:r.size}:{}}}function pn(e){let t=Array.from(e),n=t.map(dn),r=new Set(n.filter(e=>!!e));return{toolCallCount:t.length,commandCount:t.filter(e=>G(e)===`run_command`).length,editedFileCount:r.size}}function mn(e,t){let n=[];e.toolCallCount>0&&n.push(m(`processGroupToolsCalled`,{count:e.toolCallCount})),e.commandCount>0&&n.push(m(`processGroupCommandsRan`,{count:e.commandCount})),e.editedFileCount>0&&n.push(m(`processGroupFilesEdited`,{count:e.editedFileCount}));let r=m(t?`processExecuting`:`processExecuted`);return n.length>0?`${r} ${n.join(` · `)}`:r}function hn(e){let t=m(e.commandsOnly?`processCommandsRan`:e.editedFileCount===void 0?`processToolsCalled`:`processFilesEdited`,{count:e.editedFileCount??e.count});return e.errorCount>0?`${t} · ${m(`processToolsFailedCount`,{count:e.errorCount})}`:t}function gn(e,t){return[e,t].filter(Boolean).join(` · `)}function _n(e,t,n){let r=Zn(t).map(({node:e})=>e).filter(e=>e.tagName.toLowerCase()===`tool-message`),i=[...e.map(e=>en(e.message?.timestamp)),...r.map(rn)].filter(e=>e!==void 0),a=[on(e.map(e=>e.message??{})),...r.map(nn)].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=en(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?sn(Math.max(0,s-o)):``,l=[...e].reverse().find(e=>e.message?.stopReason)?.message?.stopReason;return gn(m(l===`error`?`processFailed`:l===`aborted`?`processAborted`:n?`processExecuting`:`processExecuted`),c)}function vn(e){return e.closest(`message-list`)}function yn(e,t){return e.closest(`message-list`)===vn(t)&&Rn(e)}function bn(e){return Array.from(e.querySelectorAll(z)).filter(t=>t.closest(`assistant-message`)===e)}function xn(e){let t=e.querySelector(`${V}, ${z}`);return t?.closest(`.px-4.flex.flex-col`)??t?.parentElement??null}function Sn(){let e=document.createElement(`div`);return e.className=`quickforge-process-step`,e}function Cn(){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 wn(){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 Tn(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 En(e){e.querySelectorAll(`thinking-block`).forEach(t=>{if(t.closest(z)!==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}=Tn(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=m(`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=Cn()),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 Dn(){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=`
|
|
60
|
+
<span class="quickforge-process-tools-icon" aria-hidden="true">
|
|
61
|
+
${wn()}
|
|
62
|
+
</span>
|
|
63
|
+
<span class="quickforge-process-tools-label"></span>
|
|
64
|
+
<span class="quickforge-process-tools-chevron" aria-hidden="true">
|
|
65
|
+
<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>
|
|
66
|
+
</span>
|
|
67
|
+
`;let n=document.createElement(`div`);return n.className=`quickforge-process-tools-body`,e.append(t,n),e}function On(){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=`
|
|
68
|
+
<span class="quickforge-process-stage-label"></span>
|
|
69
|
+
<span class="quickforge-process-stage-chevron" aria-hidden="true">
|
|
70
|
+
<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>
|
|
71
|
+
</span>
|
|
72
|
+
`;let n=document.createElement(`div`);return n.className=`quickforge-process-stage-body`,e.append(t,n),e}function kn(){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=`
|
|
73
|
+
<span class="quickforge-process-label"></span>
|
|
74
|
+
<span class="quickforge-process-chevron" aria-hidden="true">
|
|
75
|
+
<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>
|
|
76
|
+
</span>
|
|
77
|
+
`;let n=document.createElement(`div`);return n.className=`quickforge-process-body`,e.append(t,n),e}function An(){return!1}function jn(e,t){return`${e}:stage:${t}`}function Mn(e,t,n,r){let i=Array.from(n.querySelectorAll(Lt)).filter(e=>e.closest(z)===n);i.forEach((n,a)=>{let o=n.querySelector(`:scope > ${Rt}`),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=jn(t,a),u=`quickforge-${l.replace(/[^a-z0-9_-]+/gi,`-`)}`,d=n.dataset.quickforgeProcessKey;n.dataset.quickforgeProcessKey=l;let f=Zt(Kt(e).get(l),d===l,n.dataset.expanded===`true`,An());n.dataset.expanded=String(f);let p=r&&a===i.length-1;c.textContent=mn(pn(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} · ${m(f?`collapseProcess`:`expandProcess`)}`),s.onclick=t=>{t.preventDefault(),t.stopPropagation();let r=n.dataset.expanded!==`true`;n.dataset.expanded=String(r),qt(e,l,r),s.setAttribute(`aria-expanded`,String(r)),s.setAttribute(`aria-label`,`${c.textContent} · ${m(r?`collapseProcess`:`expandProcess`)}`)}})}function Nn(e,t,n){return t?`${e}:tools:${t}`:`${e}:tools:${n}`}function Pn(e,t,n){return Nn(e,Array.from(t.querySelectorAll(`tool-message`))[0]?.toolCall?.id,n)}function Fn(e,t,n){n.querySelectorAll(Ft).forEach((r,i)=>{if(r.closest(z)!==n)return;let a=r.querySelector(`:scope > ${It}`),o=r.querySelector(`.quickforge-process-tools-summary`),c=r.querySelector(`.quickforge-process-tools-label`);if(!a||!o||!c)return;let l=fn(a.querySelectorAll(`:scope > tool-message`));if(r.hidden=l.count===0,l.count===0)return;let u=Pn(t,r,i),d=`quickforge-${u.replace(/[^a-z0-9_-]+/gi,`-`)}`;a.id=d,o.setAttribute(`aria-controls`,d);let f=s().toolDisplayMode===`detailed`,p=f?`detailed`:`compact`,h=r.dataset.quickforgeProcessKey,g=r.dataset.quickforgeToolDisplayMode;r.dataset.quickforgeProcessKey=u,r.dataset.quickforgeToolDisplayMode=p;let _=Zt(Kt(e).get(u),h===u&&g===p,r.dataset.expanded===`true`,f);r.dataset.expanded=String(_),c.textContent=hn(l),o.setAttribute(`aria-expanded`,String(_)),o.setAttribute(`aria-label`,m(_?`collapseProcessTools`:`expandProcessTools`)),o.onclick=t=>{t.preventDefault(),t.stopPropagation();let n=r.dataset.expanded===`false`;r.dataset.expanded=String(n),qt(e,u,n),o.setAttribute(`aria-expanded`,String(n)),o.setAttribute(`aria-label`,m(n?`collapseProcessTools`:`expandProcessTools`))}})}function In(e,t,n={}){return t===`pointerdown`?e&&(n.button??0)===0&&n.isPrimary!==!1:!e||(n.detail??0)===0}function Ln(e,t,n,r,i){Qt(e,r,t,i),r.dataset.streaming=String(i);let a=r.querySelector(`:scope > ${B}`),o=r.querySelector(`.quickforge-process-summary`),s=r.querySelector(`.quickforge-process-label`);if(!a||!o||!s)return;let c=_n(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} · ${m(l?`collapseProcess`:`expandProcess`)}`);let d=()=>{let n=r.dataset.expanded!==`true`;r.dataset.expanded=String(n),qt(e,t,n),o.setAttribute(`aria-expanded`,String(n)),o.setAttribute(`aria-label`,`${c} · ${m(n?`collapseProcess`:`expandProcess`)}`)};o.onpointerdown=e=>{In(i,`pointerdown`,e)&&(e.stopPropagation(),d())},o.onclick=e=>{e.preventDefault(),e.stopPropagation(),In(i,`click`,e)&&d()},Mn(e,t,r,i),Fn(e,t,r),En(r)}function K(e,t,n){if(n){e.hasAttribute(t)||e.setAttribute(t,`true`);return}e.hasAttribute(t)&&e.removeAttribute(t)}function Rn(e){let t=e.closest(`message-list`),n=e.parentElement?.closest(V);return!n||n.closest(`message-list`)!==t}function zn(e){let t=vn(e);return Array.from(e.querySelectorAll(`markdown-block`)).filter(e=>{if(e.closest(`message-list`)!==t)return!1;let n=e.parentElement?.closest(zt);return!n||n.closest(`message-list`)!==t})}function Bn(e){let t=e.filter(e=>(e.textContent??``).trim().length>0);return t[t.length-1]??e[e.length-1]??null}function Vn(e,t){return Array.from(e.querySelectorAll(V)).filter(n=>n!==t&&yn(n,e)).some(e=>!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING))}function Hn(e,t){let n=zn(e);if(t){let t=Bn(n);return t&&!Vn(e,t)?t:null}return Bn(n.filter(e=>e.hasAttribute(Bt)))||(Bn(n.filter(e=>!e.closest(B)))??Bn(n))}function Un(e,t){zn(e).forEach(e=>{K(e,Bt,e===t),e===t&&K(e,H,!1)})}function Wn(e){return e.length>1||e.some(e=>Array.from(e.querySelectorAll(zt)).some(t=>t.closest(`message-list`)===vn(e)))}function Gn(e){let t=new Map;return e.forEach(e=>{bn(e).forEach(e=>{U.get(e)?.forEach(e=>t.set(e.node,e))})}),e.flatMap(e=>Array.from(e.querySelectorAll(V)).filter(t=>yn(t,e)).map(n=>t.get(n)??{node:n,sourceAssistant:e,sourceParent:n.parentElement,sourceNextSibling:n.nextSibling}))}function Kn(e,t,n,r){return e.filter(e=>!t(e)&&(!n(e)||r))}function qn(e,t,n){return Kn(Gn(e),e=>e.node===t,e=>e.node.tagName.toLowerCase()===`markdown-block`,n)}function Jn(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 Yn(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 Xn(e){return!!e.querySelector(`${B} ${V}`)}function Zn(e){return U.get(e)??Array.from(e.querySelectorAll(`${B} ${V}`)).filter(t=>t.closest(z)===e).map(t=>({node:t,sourceAssistant:e.closest(`assistant-message`)??e.parentElement,sourceParent:e.parentElement,sourceNextSibling:e}))}function Qn(e,t){let{node:n,sourceParent:r,sourceNextSibling:i}=e;if(K(n,H,!1),K(n,Bt,!1),r?.isConnected){i?.parentNode===r?r.insertBefore(n,i):r.append(n);return}let a=xn(e.sourceAssistant);a?a.insertBefore(n,a.querySelector(z)):t.parentElement?.insertBefore(n,t)}function $n(e,t){return!e||t}function er(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(zt)).filter(t=>t!==e.node&&!t.closest(z)).filter(t=>yn(t,e.sourceAssistant)).some(e=>e.tagName.toLowerCase()===t?t!==`tool-message`||!n?!0:e.toolCall?.id===n:!1)}function tr(e){K(e.node,H,!1),K(e.node,Bt,!1),e.node.remove()}function nr(e,t=!1){let n=new Set(e);for(let r of e)r.classList.remove(`quickforge-process-source-empty`),bn(r).forEach(e=>{Zn(e).slice().reverse().forEach(r=>{t&&$n(n.has(r.sourceAssistant),er(r))?tr(r):Qn(r,e)}),U.delete(e),e.remove()})}function rr(e){e.querySelectorAll(`${z}[data-streaming="true"]`).forEach(e=>{let t=Zn(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=>Qn(t,e)),U.delete(e),e.remove()})}function ir(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 ar(e,t){let n=Sn(),r=Yn(t,e=>ln(e.node));for(let e of r){if(e.kind===`tools`){let t=Dn(),r=t.querySelector(It);if(!r)continue;e.items.forEach(({node:e})=>{K(e,H,!0),r.append(e)}),n.append(t);continue}e.items.forEach(({node:e})=>{K(e,H,!0),n.append(e)})}e.append(n)}function or(e,t){let n=e.querySelector(`:scope > ${B}`);if(!n)return!1;let r=Jn(t,e=>e.node.tagName.toLowerCase()===`markdown-block`);for(let e of r){if(e.kind===`detail`){ar(n,e.items);continue}let t=On(),r=t.querySelector(Rt);r&&(ar(r,e.items),n.append(t))}return U.set(e,t),Xn(e)}function sr(e,t){let n=Jt(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?xn(i):null;if(!r?.sourceParent?.isConnected&&!a)return null;let o=kn();return r?.sourceParent?.isConnected?r.sourceParent.insertBefore(o,r.node):a&&a.append(o),or(o,e)?o:null}function cr(e){let t=e?.stopReason;return(t===`error`||t===`aborted`)&&typeof e?.errorMessage==`string`&&e.errorMessage.trim().length>0}function lr(e){for(let t of e){let e=cr(t.message)||!!Array.from(t.querySelectorAll(`markdown-block, thinking-block, tool-message, .quickforge-process-group, .quickforge-approval-card`)).some(e=>e.closest(`message-list`)===vn(t));t.classList.toggle(`quickforge-process-source-empty`,!e)}}function ur(e){let t=new Map(e.map((e,t)=>[e,t])),n=Gn(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??G(a)}`});return`${e.length}|${n.join(`|`)}`}function dr(e,t,n,r,i=!0){return!n||!r||!i?`full`:e?`update`:t?`skip`:`full`}function fr(e,t,n){return!e&&t&&n}function pr(e,t,n,r,i){if(t.length===0)return;let a=Xt(e,t,r),o=t[t.length-1],s=t.flatMap(bn),c=s.length===1?s[0]:void 0,l=ur(t),u=Wn(t),d=qn(t,u?Hn(o,n):null,u),f=!c||ir(U.get(c),d),p=dr(n,i,!!c,c?.dataset.quickforgeProcessFp===l,f);if(p===`skip`)return;if(p===`update`&&c){Ln(e,a,t,c,!0);return}if(d.length===0&&fr(!1,s.length>0,e.dataset.quickforgeProcessHandoff!==void 0))return;nr(t,!0);let m=Wn(t),h=m?Hn(o,n):null;m&&Un(o,h);let g=qn(t,h,m);if(g.length===0)return;let _=sr(g,t);_&&(_.dataset.quickforgeProcessFp=l,Ln(e,a,t,_,n),lr(t))}function mr(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;pr(e,t,o,a,n&&!o)})}var hr=/<\s*(script|foreignObject|iframe|object|embed)\b|\son[a-z]+\s*=|(?:javascript|vbscript|data\s*:\s*text\/html)\s*:/i,gr=/\b(?:href|xlink:href|src)\s*=\s*(["'])\s*(?:https?:)?\/\//i,_r=/url\(\s*(["']?)\s*(?:https?:)?\/\//i,vr=/@import\s+(?:url\(\s*)?["']?\s*(?:https?:)?\/\//i,yr=null,br=0;function xr(e){return String(e??``).trim().toLowerCase()===`mermaid`}function Sr(e){let t=e.trim();return/^<svg[\s>]/i.test(t)&&/<\/svg>\s*$/i.test(t)&&!hr.test(t)&&!gr.test(t)&&!_r.test(t)&&!vr.test(t)}function Cr(e){if(!Sr(e))throw Error(`Unsafe Mermaid SVG output`);return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`}async function wr(){return yr??=a(async()=>{let{default:e}=await import(`./mermaid.core-DWpShXCs.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)),yr}async function Tr(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 wr(),r=`quickforge-mermaid-${Date.now().toString(36)}-${++br}`,{svg:i}=await n.render(r,t);if(!Sr(i))throw Error(`Unsafe Mermaid SVG output`);return i}var Er=new Set([`bash`,`sh`,`shell`,`zsh`,`fish`,`cmd`,`bat`,`batch`,`powershell`,`ps1`,`terminal`,`console`]),Dr=/\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,Or=/<\s*(script|foreignObject)\b|\son[a-z]+\s*=|javascript\s*:/i;function kr(e,t,n){let r=m(`copied`),i=Number(e.dataset.quickforgeCopyFeedbackTimer);i&&window.clearTimeout(i),_(e,j),e.title=r,e.setAttribute(`aria-label`,r),e.style.color=`rgb(5 150 105)`;let a=window.setTimeout(()=>{_(e,n),e.title=t,e.setAttribute(`aria-label`,t),e.style.color=``,delete e.dataset.quickforgeCopyFeedbackTimer},1200);e.dataset.quickforgeCopyFeedbackTimer=String(a)}function Ar(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),_(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 q(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 jr(e){return e.replace(/\r\n/g,`
|
|
78
|
+
`).split(`
|
|
79
|
+
`).map(e=>e.replace(/^\s*\$\s+/,``).replace(/^\s*>\s+/,``).replace(/^\s*PS\s+[^>\n]+>\s+/i,``)).join(`
|
|
80
|
+
`).trim()}function Mr(e){return e.split(`
|
|
81
|
+
`).map(e=>e.trim()).filter(Boolean).length}function Nr(e){let t=String(e.language??e.getAttribute(`language`)??``).trim().toLowerCase();return Er.has(t)}function Pr(e){return String(e.language??e.getAttribute(`language`)??``).trim().toLowerCase()===`svg`}function Fr(e){let t=e.trim();return/^<svg[\s>]/i.test(t)&&/<\/svg>\s*$/i.test(t)&&!Or.test(t)}function Ir(e){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`}function Lr(){let e=document.querySelector(`.quickforge-svg-code-lightbox`);e?.quickforgeCleanup?.(),e?.remove()}function Rr(e,t=`SVG preview`){Lr();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=()=>Lr(),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 zr(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 Br(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 Vr(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 Hr(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 J(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`),_(r,n),r}function Y(e=document,t){e.querySelectorAll(`.quickforge-svg-code-menu[open]`).forEach(e=>{e!==t&&(e.open=!1)})}var Ur=!1;function Wr(){Ur||(Ur=!0,document.addEventListener(`pointerdown`,e=>{e.target?.closest(`.quickforge-svg-code-menu`)||Y(document)},!0),document.addEventListener(`keydown`,e=>{e.key===`Escape`&&Y(document)}))}function Gr(e,t){Wr();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=m(`moreActions`),t.setAttribute(`aria-label`,m(`moreActions`)),t.textContent=`⋯`;let n=document.createElement(`div`);n.className=`quickforge-svg-code-menu-content`,n.setAttribute(`role`,`menu`);let a=J(`svg-preview-mode`,m(`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=J(`svg-source-mode`,m(`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=J(`copy-svg-code`,m(`copySvgSource`),A),c=J(`download-svg-code`,m(`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"]`),l=i.querySelector(`[data-quickforge-action="copy-svg-code"]`),u=i.querySelector(`[data-quickforge-action="download-svg-code"]`),d=()=>{a&&(a.open=!1)};a&&!a.dataset.quickforgeSvgMenuBound&&(a.dataset.quickforgeSvgMenuBound=`true`,a.addEventListener(`toggle`,()=>{a.open&&Y(e.closest(`markdown-block`)??document,a)})),o&&(o.onclick=()=>{Hr(e,`preview`),d()}),s&&(s.onclick=()=>{Hr(e,`source`),d()}),l&&(l.onclick=async()=>{await c(t),kr(l,m(`copySvgSource`),A)}),u&&(u.onclick=()=>{zr(`quickforge-svg-${Date.now()}.svg`,t,`image/svg+xml;charset=utf-8`),d()})}function Kr(e,t){e.querySelectorAll(`assistant-message markdown-block code-block`).forEach(e=>{if(!Pr(e)){Vr(e);return}if(t)return;let n=q(e).trim();if(!n||!Fr(n)){Vr(e);return}let r=Br(n);if(e.querySelector(`[data-quickforge-svg-preview="true"]`)&&e.dataset.quickforgeSvgPreviewSource===r){Gr(e,n),Hr(e,e.dataset.quickforgeSvgMode===`source`?`source`:`preview`);return}let i=e.querySelector(`:scope > div > div:first-child`);if(!i)return;Vr(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=Ir(n),o.title=m(`svgEnlargePreview`),o.addEventListener(`click`,()=>Rr(o.src)),a.replaceChildren(o),i.after(a),Gr(e,n),e.dataset.quickforgeSvgPreviewSource=r,Hr(e,e.dataset.quickforgeSvgMode===`source`?`source`:`preview`)})}var qr=0;function Jr(e){return xr(String(e.language??e.getAttribute(`language`)??``))}function Yr(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(++qr)),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 Xr(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 Zr(e,t,n){Wr();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=m(`moreActions`),t.setAttribute(`aria-label`,m(`moreActions`)),t.textContent=`⋯`;let n=document.createElement(`div`);n.className=`quickforge-svg-code-menu-content`,n.setAttribute(`role`,`menu`);let r=J(`mermaid-preview-mode`,m(`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=J(`mermaid-source-mode`,m(`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=J(`copy-mermaid-code`,m(`copyMermaidSource`),A),c=J(`download-mermaid-svg`,m(`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"]`),l=a.querySelector(`[data-quickforge-action="mermaid-source-mode"]`),u=a.querySelector(`[data-quickforge-action="copy-mermaid-code"]`),d=a.querySelector(`[data-quickforge-action="download-mermaid-svg"]`),f=()=>{o&&(o.open=!1)};o&&!o.dataset.quickforgeMermaidMenuBound&&(o.dataset.quickforgeMermaidMenuBound=`true`,o.addEventListener(`toggle`,()=>{o.open&&Y(e.closest(`markdown-block`)??document,o)})),s&&(s.onclick=()=>{Xr(e,`preview`),f()}),l&&(l.onclick=()=>{Xr(e,`source`),f()}),u&&(u.onclick=async()=>{await c(t),kr(u,m(`copyMermaidSource`),A)}),d&&(d.onclick=()=>{zr(`quickforge-mermaid-${Date.now()}.svg`,n,`image/svg+xml;charset=utf-8`),f()})}function Qr(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=m(`mermaidRenderFailed`),t.after(n)}function $r(e,t){e.querySelectorAll(`assistant-message markdown-block code-block`).forEach(n=>{try{if(!Jr(n)){Yr(n);return}let r=q(n).trim();if(!r){Yr(n);return}let i=Br(r);if(n.querySelector(`[data-quickforge-mermaid-preview="true"]`)&&n.dataset.quickforgeMermaidPreviewSource===i){Xr(n,n.dataset.quickforgeMermaidMode===`source`?`source`:`preview`);return}if(t){(n.dataset.quickforgeMermaidPendingSource||n.dataset.quickforgeMermaidPreviewSource)&&Yr(n);return}if(n.dataset.quickforgeMermaidPendingSource===i||n.dataset.quickforgeMermaidFailedSource===i||!n.querySelector(`:scope > div > div:first-child`))return;Yr(n);let a=String(++qr);n.dataset.quickforgeMermaidRequestToken=a,n.dataset.quickforgeMermaidPendingSource=i,(async()=>{try{let t=await Tr(r);if(!t)throw Error(`Empty Mermaid SVG`);let o=Cr(t);if(!n.isConnected||n.dataset.quickforgeMermaidRequestToken!==a||e.dataset.quickforgeAgentStreaming===`true`||!Jr(n)||Br(q(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`,m(`mermaidPreviewLabel`));let l=document.createElement(`img`);l.alt=m(`mermaidPreviewLabel`),l.src=o,l.title=m(`mermaidEnlargePreview`),l.addEventListener(`click`,()=>Rr(l.src,m(`mermaidPreviewLabel`))),c.replaceChildren(l),n.classList.add(`quickforge-svg-code-block`,`quickforge-mermaid-code-block`),s.after(c),Zr(n,r,t),n.dataset.quickforgeMermaidPreviewSource=i,delete n.dataset.quickforgeMermaidPendingSource,delete n.dataset.quickforgeMermaidFailedSource,delete n.dataset.quickforgeMermaidRequestToken,Xr(n,`preview`)}catch{if(!n.isConnected||n.dataset.quickforgeMermaidRequestToken!==a||!Jr(n)||Br(q(n).trim())!==i)return;delete n.dataset.quickforgeMermaidPendingSource,delete n.dataset.quickforgeMermaidRequestToken,n.dataset.quickforgeMermaidFailedSource=i,Qr(n)}})()}catch{Yr(n),Qr(n)}})}function ei(e,t){e.querySelectorAll(`assistant-message markdown-block code-block`).forEach(e=>{let n=e.querySelector(`[data-quickforge-action="execute-markdown-command"]`);if(!Nr(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=jr(q(e));if(!r){n?.remove(),delete e.dataset.quickforgeCommand;return}e.dataset.quickforgeCommand=r;let i=m(`executeInTerminal`),a=n??Ar(`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=jr(q(e));t&&window.dispatchEvent(new CustomEvent(`quickforge:execute-markdown-command`,{detail:{command:t,confirm:Mr(t)>1,dangerous:Dr.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 ti=/[A-Za-z]:[\\/][^\s"'<>`]+|(?:\/Users|\/home|\/workspace|\/mnt|\/Volumes)\/[^\s"'<>`]+/g,ni=new Set([`.`,`,`,`;`,`:`,`!`,`?`,`)`,`]`,`}`,`>`,`。`,`,`,`;`,`:`,`!`,`?`,`)`,`】`,`》`]),ri=[`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 ii(e){let t=e.length;for(;t>0&&ni.has(e[t-1]);)--t;return{path:e.slice(0,t),suffix:e.slice(t)}}function ai(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 oi(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(e){let t=e.textContent??``;if(!ti.test(t))return NodeFilter.FILTER_REJECT;ti.lastIndex=0;let n=e.parentElement;return!n||n.closest(ri)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),r=n.nextNode();for(;r;)t.push(r),r=n.nextNode();return t}function si(e,t){let n=e.textContent??``;ti.lastIndex=0;let r,i=0,a=document.createDocumentFragment(),o=!1;for(;r=ti.exec(n);){let e=r[0],{path:s,suffix:c}=ii(e);if(!s)continue;let l=r.index,u=l+e.length;l>i&&a.append(document.createTextNode(n.slice(i,l))),a.append(ai(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 ci(e,t,n){let r=Array.from(e.querySelectorAll(`markdown-block`)),i=r.reduce((e,t)=>e+(t.textContent?.length??0),0),a=l(t).length,o=`${String(t.timestamp??``)}:${a}:${r.length}:${i}`;e.dataset.quickforgeLocalPathSignature!==o&&(r.forEach(e=>{oi(e).forEach(e=>si(e,n))}),e.dataset.quickforgeLocalPathSignature=o)}function li(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}function ui(e,t,n){let r=m(`copied`),i=Number(e.dataset.quickforgeCopyFeedbackTimer);i&&window.clearTimeout(i),_(e,j),e.title=r,e.setAttribute(`aria-label`,r),e.style.color=`rgb(5 150 105)`;let a=window.setTimeout(()=>{_(e,n),e.title=t,e.setAttribute(`aria-label`,t),e.style.color=``,delete e.dataset.quickforgeCopyFeedbackTimer},1200);e.dataset.quickforgeCopyFeedbackTimer=String(a)}function di(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),_(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 fi(e){if(!e)return null;let t=document.createElement(`span`);return t.className=`quickforge-message-time`,t.textContent=u(e),t}function pi(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 mi(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`)){pi(t);return}pi(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=m(`cancel`);let h=document.createElement(`button`);h.type=`button`,h.className=`quickforge-rollback-popover-confirm`,h.textContent=m(`confirmRollback`),f.append(p,h),c.append(l,u,d,f);let g=()=>pi(t),_=e=>{let t=e.target;!t||c.contains(t)||n.contains(t)||g()},v=e=>{e.key===`Escape`&&(e.preventDefault(),g())};c.quickforgeCleanup=()=>{document.removeEventListener(`pointerdown`,_,!0),document.removeEventListener(`keydown`,v)},c.addEventListener(`pointerdown`,e=>e.stopPropagation()),c.addEventListener(`click`,e=>e.stopPropagation()),p.addEventListener(`click`,g),h.addEventListener(`click`,async()=>{h.disabled=!0,p.disabled=!0,h.textContent=m(`rollingBack`);try{await o(r)}finally{g()}}),s.append(c),n.setAttribute(`aria-expanded`,`true`),document.addEventListener(`pointerdown`,_,!0),document.addEventListener(`keydown`,v),window.requestAnimationFrame(()=>h.focus())}function hi(e){let t=document.createElement(`span`);t.className=`quickforge-rollback-action`;let n=di(`rollback`,m(`rollback`),M,t=>{mi({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 gi(e){return e.querySelector(`message-list`)}function _i(e){return Array.from(e.querySelectorAll(`user-message, assistant-message`)).filter(t=>t.closest(`message-list`)===e)}function vi(e){let t=gi(e);return t?_i(t):[]}function yi(e){return(gi(e)?.parentElement?.querySelector(`:scope > streaming-message-container:not(.hidden)`))?.querySelector(`:scope > div > assistant-message`)??null}function bi(e){e.querySelectorAll(`message-list[data-quickforge-subagent-process="true"]`).forEach(e=>{mr(e,_i(e),e.dataset.quickforgeSubagentStreaming===`true`)})}function xi(e){let{panel:t,getMessages:n,messageIndexOffset:r=0,isStreaming:i,onCopyAnswer:a,onRollbackFromMessage:o,onRetryFromMessage:s,onForkFromMessage:c,onOpenLocalFilePath:d,disableFork:f,allowRollback:h=!0,allowRetry:g=!0,readOnly:_=!1,enableTerminalCommandActions:v=!0,rollbackConfirmTitle:y=m(`rollbackConfirmTitle`),rollbackConfirmDescription:b=m(`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=vi(t),T=i(),ee=li(x.map(({message:e})=>e),T),E=e=>{let t=m(`copy`);return di(`copy`,t,A,async n=>{let r=e();if(r)try{await a(r),ui(n,t,A)}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`);let v=w(a.message),C=e=>{let t=e.querySelector(`.quickforge-message-time`);if(v>0){if(t){t.textContent=u(v);return}let n=fi(v);if(!n)return;a.message.role===`assistant`?e.append(n):e.prepend(n)}else t?.remove()};a.message.role===`assistant`&&d&&ci(e,a.message,d);let T=`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`||ee.has(r))){D?.remove();return}if(D?.dataset.quickforgeLayout===`message-bottom`){D.className=T,D.parentElement===e&&D!==e.lastElementChild&&e.append(D),_&&pi(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(_||t===`rollback`&&!h||t===`retry`&&!g||t===`fork`&&f){e.closest(`.quickforge-rollback-action`)?.remove(),e.remove();return}e.disabled=i()}),i()&&pi(t);let n=D.querySelector(`button[data-quickforge-action="retry"]`),r=!_&&g&&S&&a.index===S.index&&a.message.role!==`assistant`;if(n&&!r)n.remove();else if(!n&&r){let e=di(`retry`,m(`retry`),ae,()=>{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=T,a.message.role===`assistant`){let e=l(a.message);if(!e)return;let t=E(()=>{let t=n()[a.index];return t?l(t):e});if(O.append(t),!_&&!f){let e=di(`fork`,m(`forkConversation`),N,()=>{c(a.index)});e.disabled=i(),O.append(e)}}else{let e=p(a.message);if(e){let t=E(()=>{let t=n()[a.index];return t?p(t):e});O.append(t)}if(!_&&h){let e=hi({panel:t,messageIndex:a.index,isDisabled:i(),title:y,description:b,onConfirm:o});O.append(e)}if(!_&&g&&S&&a.index===S.index){let e=di(`retry`,m(`retry`),ae,()=>{s(a.index)});e.disabled=i(),O.append(e)}}C(O),e.append(O)}),Y(t);let D=[...C];if(T){let e=yi(t);e&&(e.classList.add(`quickforge-assistant-message`),D.push(e))}mr(t,D,T),bi(t),Kr(t,i()),$r(t,i()),v?ei(t,i()):t.querySelectorAll(`[data-quickforge-action="execute-markdown-command"]`).forEach(e=>e.remove())}function Si(e){return e.role===`user`||e.role===`user-with-attachments`||e.role===`assistant`}function Ci(e){return e.role===`user`||e.role===`user-with-attachments`}function wi(e){return e.role===`assistant`?l(e).trim().length>0:!1}function Ti(e){return e.querySelector(`message-list`)}function Ei(e){let t=Ti(e);return t?Array.from(t.querySelectorAll(`user-message, assistant-message`)).filter(e=>e.closest(`message-list`)===t):[]}var Di=`.quickforge-assistant-waiting`;function Oi(e){e.querySelectorAll(Di).forEach(e=>e.remove())}function ki(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 Ai(e){let{panel:t,getMessages:n,isStreaming:r,isActive:i}=e,a=t.querySelector(Di);if(!r()||!i)return Oi(t),!1;let o=Ti(t),s=n(),c=s.map((e,t)=>({message:e,index:t})).filter(({message:e})=>Si(e)),l=(()=>{for(let e=c.length-1;e>=0;e--)if(Ci(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(wi),f=Ei(t),p=f[l],h=f.slice(l+1).some(e=>e.matches(`assistant-message`)&&ki(e));if(!p||d||h)return a?.remove(),!1;let g=a??document.createElement(`div`);return g.className=`quickforge-assistant-waiting`,g.setAttribute(`role`,`status`),g.setAttribute(`aria-live`,`polite`),g.setAttribute(`aria-label`,m(`assistantWaitingAriaLabel`)),a||(g.innerHTML=`
|
|
82
|
+
<div class="quickforge-assistant-waiting-dots" aria-hidden="true">
|
|
83
|
+
<span></span>
|
|
84
|
+
<span></span>
|
|
85
|
+
<span></span>
|
|
86
|
+
</div>
|
|
87
|
+
`),g.previousElementSibling!==p&&p.after(g),!0}function ji(e){let{panel:t,isStreaming:n,abort:r,agentAccessMode:i,harness:a,getAcpSession:o,onOpenCodeConfigOptionChange:s,onOpenCodeModeChange:c,planMode:l,workspaceToolsEnabled:u,readOnly:d,allowModelControls:f,planModeEnabled:p,accessModeEnabled:h,commandSuggestionsEnabled:g,capabilitySuggestionsEnabled:_,attachmentsEnabled:v,onAccessModeChange:y,onTogglePlanMode:b,onInput:x,onFilesChange:S,removeCommandSuggestions:w,updateCommandSuggestions:T,setupCommandTextareaHandler:ee,removeCapabilitySuggestions:E,updateCapabilitySuggestions:D,setupCapabilityTextareaHandler:O,insertBuiltinPluginMention:te,availablePluginRows:ne,onBeforeSend:re}=e,k=t.querySelector(`message-editor`);k?.classList.add(`quickforge-composer`),k?.parentElement?.classList.add(`quickforge-composer-shell`),k?.parentElement?.parentElement?.classList.add(`quickforge-composer-dock`);let ie=k?.querySelector(`textarea`);if(ie&&(ie.placeholder=m(`composerPlaceholder`)),d){t.querySelector(`.quickforge-composer-dock`)?.remove();return}Ze({editor:k,onInput:x,onFilesChange:S,removeCommandSuggestions:w,updateCommandSuggestions:g?T:()=>w(),removeCapabilitySuggestions:E,updateCapabilitySuggestions:_?D:()=>E(),attachmentsEnabled:v,onBeforeSend:re}),g?ee(k):w(),_?O(k):E(),p?Je(k,l,b):qe(k);let A=t.querySelector(`agent-interface`);if(A){let e=A.enableModelSelector!==f;A.enableModelSelector=f,A.enableThinkingSelector=!1,e&&A.requestUpdate?.()}let j=k?.querySelectorAll(`.flex.gap-2.items-center`),M=j?.[0],N=j?.[j.length-1];if(!N)return;if(Ke(k,N),Xe({rightControls:N,isStreaming:n,abort:r,removeCommandSuggestions:w}),!M){t.querySelector(`.quickforge-plus-inline`)?.remove(),L(t),!v&&k&&Be(k),t.querySelector(`.quickforge-agent-access-inline`)?.remove(),P(t),t.querySelector(`.quickforge-opencode-config-inline`)?.remove(),F(t),t.querySelector(`.quickforge-opencode-mode-inline`)?.remove(),I(t),t.querySelector(`.quickforge-yolo-inline`)?.remove(),t.querySelector(`.quickforge-plan-inline`)?.remove();return}let ae=()=>{L(t),F(t),I(t),P(t),C()};if(k&&(k.querySelectorAll(`input[type="file"]`).forEach(e=>{e.disabled=!v}),v||Be(k,M)),k&&(v||_)?We({panel:t,editor:k,leftControls:M,insertBuiltinPluginMention:te,availablePluginRows:ne,removeCommandSuggestions:w,removeCapabilitySuggestions:E,attachmentsEnabled:v,pluginsEnabled:_}):(t.querySelector(`.quickforge-plus-inline`)?.remove(),L(t),k&&Be(k,M)),p?Ye({panel:t,leftControls:M,planMode:l,onTogglePlanMode:b}):t.querySelector(`.quickforge-plan-inline`)?.remove(),a===`opencode`&&o&&s&&c?(je({panel:t,leftControls:M,getAcpSession:o,isStreaming:n,onConfigOptionChange:s,onModeChange:c,dismissComposerMenus:ae}),Ie({panel:t,rightControls:N,getAcpSession:o,isStreaming:n,onModeChange:c,dismissComposerMenus:ae})):(t.querySelector(`.quickforge-opencode-config-inline`)?.remove(),F(t),t.querySelector(`.quickforge-opencode-mode-inline`)?.remove(),I(t)),!u||!h){t.querySelector(`.quickforge-agent-access-inline`)?.remove(),P(t),t.querySelector(`.quickforge-yolo-inline`)?.remove();return}Se({panel:t,leftControls:M,agentAccessMode:i,onAccessModeChange:y,dismissComposerMenus:ae})}var Mi={maxHeight:`28rem`,overflow:`auto`,border:`1px solid color-mix(in oklab, var(--border) 75%, transparent)`,borderRadius:`0.75rem`,background:`color-mix(in oklab, var(--muted) 28%, transparent)`,fontFamily:`var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace)`,fontSize:`0.78rem`,lineHeight:`1.45`},Ni={minHeight:`1.35em`,padding:`0 0.75rem`,whiteSpace:`pre`},Pi={display:`inline-flex`,alignItems:`center`,borderRadius:`999px`,padding:`0.05rem 0.45rem`,fontFamily:`var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace)`,fontSize:`0.72rem`,fontWeight:`650`};function Fi(e,t){let n=Z(e?.details)?e.details:void 0;return e?.isError||n?.aborted===!0||n?.timedOut===!0?`error`:t?`running`:e?`done`:`called`}function X(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 Ii(e){return e?.content?.filter(e=>e.type===`text`).map(e=>e.text??``).join(`
|
|
88
|
+
`)??``}function Z(e){return!!(e&&typeof e==`object`&&!Array.isArray(e))}function Li(e,t){let n=Z(e?.__quickforgeAcp)?e.__quickforgeAcp:void 0,r=Z(t)?t:void 0;return(Z(r?.__quickforgeAcp)?r.__quickforgeAcp:void 0)??n}function Ri(e){if(!e||!(`__quickforgeAcp`in e))return e;let{__quickforgeAcp:t,...n}=e;return n}function zi(e){if(!Z(e)||!(`__quickforgeAcp`in e))return e;let{__quickforgeAcp:t,...n}=e;return n}function Bi(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 Vi(e,t,n){let r=Z(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}`,Bi(r,n),``,`STDOUT:`,a||`(empty)`,``,`STDERR:`,o||`(empty)`].join(`
|
|
89
|
+
`)}function Hi(e,t,n,r){let i=Ii(n);return e===`manage_global_memory`?O(n,r,m)||i:i||(e===`run_command`?Vi(t,n?.details,r):``)}function Ui(e,t){return Z(e)&&typeof e[t]==`string`?e[t]:``}function Wi(e,t,n){if(!t&&!n?.details)return``;if(e===`run_command`&&typeof t?.command==`string`)return t.command;if(e===`generate_image`){let e=typeof t?.prompt==`string`?t.prompt.trim():``;return e.length>100?`${e.slice(0,100)}…`:e}if(e===`present_files`){let e=(Array.isArray(t?.files)?t.files:Array.isArray(n?.details&&n.details.files)?(n?.details).files:[]).map(e=>typeof e==`string`?e:Z(e)&&typeof e.path==`string`?e.path:``).filter(Boolean);return e.length?e.slice(0,3).join(`, `)+(e.length>3?` +${e.length-3}`:``):``}if(e===`grep_files`){let e=typeof t?.query==`string`&&t.query?t.query:Ui(n?.details,`query`),r=typeof t?.path==`string`&&t.path?t.path:Ui(n?.details,`path`)||`.`,i=t?.regex||Z(n?.details)&&Z(n.details.searchOptions)&&n.details.searchOptions.regex?`regex`:`text`,a=r&&r!==`.`?` in ${r}`:` in current workspace`;return e?`${i}: ${e}${a}`:`searching${a}`}return e===`activate_skill`&&typeof t?.name==`string`?t.name:e===`read_skill_resource`&&typeof t?.path==`string`||t&&`path`in t&&typeof t.path==`string`?t.path:t&&`query`in t&&typeof t.query==`string`?t.query:t&&`search_query`in t&&typeof t.search_query==`string`?t.search_query:``}function Gi(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 Ki(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 qi(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 Ji(e,t,n){let r=n.getAttribute(`aria-label`)||m(`terminateCommand`);n.disabled=!0,n.setAttribute(`aria-label`,m(`commandTerminateRequested`)),n.setAttribute(`title`,m(`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`,m(`terminateCommandTitle`))}}function Yi(e){return e.startsWith(`+++`)||e.startsWith(`---`)?`quickforge-diff-file`:e.startsWith(`@@`)?`quickforge-diff-hunk`:e.startsWith(`+`)?`quickforge-diff-add`:e.startsWith(`-`)?`quickforge-diff-del`:`quickforge-diff-context`}function Xi(e){return e.startsWith(`+++`)||e.startsWith(`---`)?{...Ni,background:`color-mix(in oklab, var(--muted) 48%, transparent)`,color:`color-mix(in oklab, var(--muted-foreground) 88%, transparent)`}:e.startsWith(`@@`)?{...Ni,background:`color-mix(in oklab, rgb(37 99 235) 10%, transparent)`,color:`rgb(37 99 235)`}:e.startsWith(`+`)?{...Ni,background:`color-mix(in oklab, rgb(34 197 94) 16%, transparent)`,color:`rgb(22 101 52)`}:e.startsWith(`-`)?{...Ni,background:`color-mix(in oklab, rgb(239 68 68) 14%, transparent)`,color:`rgb(153 27 27)`}:{...Ni,color:`var(--foreground)`}}function Zi(r,i){if(r!==`write_file`&&r!==`edit_file`||!i)return e;let a=Number(i.addedLines??0),o=Number(i.removedLines??0);return t`
|
|
90
|
+
<span class="quickforge-tool-meta-hover shrink-0 inline-flex items-center gap-1" title="+${a} -${o}">
|
|
91
|
+
<span
|
|
92
|
+
class="quickforge-diff-badge quickforge-diff-badge-add"
|
|
93
|
+
style=${n({...Pi,background:`color-mix(in oklab, rgb(34 197 94) 16%, transparent)`,color:`rgb(22 101 52)`})}
|
|
94
|
+
>+${a}</span>
|
|
95
|
+
<span
|
|
96
|
+
class="quickforge-diff-badge quickforge-diff-badge-del"
|
|
97
|
+
style=${n({...Pi,background:`color-mix(in oklab, rgb(239 68 68) 14%, transparent)`,color:`rgb(153 27 27)`})}
|
|
98
|
+
>-${o}</span>
|
|
99
|
+
</span>
|
|
100
|
+
`}function Qi(r){let i=r.text?.split(`
|
|
101
|
+
`)??[],a=Number(r.addedLines??0),o=Number(r.removedLines??0);return t`
|
|
102
|
+
<div>
|
|
103
|
+
<div class="mb-1 flex items-center gap-2 text-xs font-medium text-muted-foreground">
|
|
104
|
+
<span>Diff</span>
|
|
105
|
+
<span
|
|
106
|
+
class="quickforge-diff-badge quickforge-diff-badge-add"
|
|
107
|
+
style=${n({...Pi,background:`color-mix(in oklab, rgb(34 197 94) 16%, transparent)`,color:`rgb(22 101 52)`})}
|
|
108
|
+
>+${a}</span>
|
|
109
|
+
<span
|
|
110
|
+
class="quickforge-diff-badge quickforge-diff-badge-del"
|
|
111
|
+
style=${n({...Pi,background:`color-mix(in oklab, rgb(239 68 68) 14%, transparent)`,color:`rgb(153 27 27)`})}
|
|
112
|
+
>-${o}</span>
|
|
113
|
+
${r.truncated?t`<span class="text-muted-foreground/80">truncated</span>`:e}
|
|
114
|
+
</div>
|
|
115
|
+
<div class="quickforge-diff-block" style=${n(Mi)}>${i.map(e=>t`
|
|
116
|
+
<div class=${Yi(e)} style=${n(Xi(e))}>${e||` `}</div>
|
|
117
|
+
`)}</div>
|
|
118
|
+
</div>
|
|
119
|
+
`}function $i(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 ea(e){if(e){if(typeof e.durationMs==`number`)return e.durationMs;if(typeof e.startedAt==`number`)return Date.now()-e.startedAt}}var ta=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=$i(n)}};customElements.get(`quickforge-elapsed-time`)||customElements.define(`quickforge-elapsed-time`,ta);function na(n,r){return ea(n)===void 0?e:t`
|
|
120
|
+
<quickforge-elapsed-time
|
|
121
|
+
class="quickforge-tool-meta-hover text-xs text-muted-foreground/70"
|
|
122
|
+
started-at=${String(n?.startedAt??``)}
|
|
123
|
+
duration-ms=${typeof n?.durationMs==`number`?String(n.durationMs):``}
|
|
124
|
+
running=${String(r===`running`)}
|
|
125
|
+
></quickforge-elapsed-time>
|
|
126
|
+
`}function ra(){return`text-muted-foreground/60`}function Q(e){let n=`quickforge-tool-type-icon shrink-0 ${ra()}`;return e===`manage_global_memory`?t`<svg class=${n} 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`?t`<svg class=${n} 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`?t`<svg class=${n} 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`?t`<svg class=${n} 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`?t`<svg class=${n} 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`?t`<svg class=${n} 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`?t`<svg class=${n} 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`?t`<svg class=${n} 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`?t`<svg class=${n} 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`?t`<svg class=${n} 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===`activate_skill`?t`<svg class=${n} 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>`:t`<svg class=${n} 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 ia(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 aa(e){let n=`quickforge-tool-status-icon shrink-0 ${ia(e)}`,r=m(e);return e===`running`?t`<svg class=${n} 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=${r}><path d="M21 12a9 9 0 1 1-6.2-8.6"/></svg>`:e===`done`?t`<svg class=${n} 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=${r}><path d="M22 11.1V12a10 10 0 1 1-5.9-9.1"/><path d="m9 11 3 3L22 4"/></svg>`:e===`error`?t`<svg class=${n} 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=${r}><circle cx="12" cy="12" r="10"/><path d="m15 9-6 6"/><path d="m9 9 6 6"/></svg>`:t`<svg class=${n} 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=${r}><circle cx="12" cy="12" r="10"/><circle cx="12" cy="12" r="2" fill="currentColor" stroke="none"/></svg>`}function oa(e,n){return t`
|
|
127
|
+
<span class="${e===`done`?`quickforge-tool-meta-hover`:`quickforge-tool-meta-important`} shrink-0 inline-flex items-center gap-1.5" title=${m(e)}>
|
|
128
|
+
${aa(e)}${na(n,e)}
|
|
129
|
+
</span>
|
|
130
|
+
`}function sa(n,r,i){if(n!==`run_command`||r!==`running`)return e;let{sessionId:a,toolCallId:o}=qi(i);return!a||!o?e:t`
|
|
131
|
+
<button
|
|
132
|
+
type="button"
|
|
133
|
+
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"
|
|
134
|
+
title=${m(`terminateCommandTitle`)}
|
|
135
|
+
aria-label=${m(`terminateCommandTitle`)}
|
|
136
|
+
@click=${e=>{e.preventDefault(),e.stopPropagation(),Ji(a,o,e.currentTarget)}}
|
|
137
|
+
><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>
|
|
138
|
+
`}var ca=`quickforge:preview-artifact`;function la(e,t){let n=t===`html`||t===`image`||t===`markdown`||t===`code`||t===`unknown`?t:void 0;return y(e,n)?{path:e,kind:n}:void 0}function ua(e,t){if(e===`write_file`||e===`edit_file`){let e=t&&`path`in t&&typeof t.path==`string`?t.path:``;return e?la(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(!(!Z(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=la(r.path,r.kind);if(e)return e}for(let t of e){let e=la(t.path,t.kind);if(e)return e}}}function da(n,r){let i=ua(n,r);return i?t`
|
|
139
|
+
<button
|
|
140
|
+
type="button"
|
|
141
|
+
class="shrink-0 inline-flex size-5 items-center justify-center text-muted-foreground transition-colors hover:text-foreground"
|
|
142
|
+
title=${m(`previewArtifact`)}
|
|
143
|
+
aria-label=${m(`previewArtifact`)}
|
|
144
|
+
@click=${e=>{e.preventDefault(),e.stopPropagation(),window.dispatchEvent(new CustomEvent(ca,{detail:i}))}}
|
|
145
|
+
><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>
|
|
146
|
+
`:e}var $=new Map,fa=200;function pa(e,t){if(e){if(!$.has(e)&&$.size>=fa){let e=$.keys().next().value;e&&$.delete(e)}$.set(e,t)}}function ma(e,t,n){let{toolCallId:r}=qi(n);return r||`${e}:${X(t)}`}function ha(e){let n=h(e),r=n?m(`viewSubagentRunDetails`):e.statusLabel;return t`
|
|
147
|
+
<div class="quickforge-subagent-tool">
|
|
148
|
+
<button
|
|
149
|
+
type="button"
|
|
150
|
+
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"
|
|
151
|
+
title=${r}
|
|
152
|
+
aria-label=${`${e.statusLabel} · ${r}`}
|
|
153
|
+
aria-disabled=${String(!n)}
|
|
154
|
+
?disabled=${!n}
|
|
155
|
+
@click=${()=>{if(!n)return;let t=o(e,S.get(e.runId));window.dispatchEvent(new CustomEvent(g,{detail:{runId:t.runId,payload:t}}))}}
|
|
156
|
+
>
|
|
157
|
+
${Q(`run_subagent`)}
|
|
158
|
+
<span class="quickforge-subagent-title min-w-0">
|
|
159
|
+
<span class="quickforge-subagent-label">${e.statusLabel}</span>
|
|
160
|
+
${oa(e.status,e.timing)}
|
|
161
|
+
</span>
|
|
162
|
+
</button>
|
|
163
|
+
</div>
|
|
164
|
+
`}function ga(n){let r=new Set(E(n)),i=ee(n),a=new Set(n.pendingToolCalls);return t`
|
|
165
|
+
<div class="mt-3 space-y-3">
|
|
166
|
+
${r.has(`task`)?t`<div class="quickforge-subagent-task space-y-1 rounded-lg border border-border bg-background/60 px-3 py-2 text-xs leading-relaxed text-muted-foreground/70">
|
|
167
|
+
${n.task?t`<div><span class="font-medium text-foreground/75">${m(`subagentTask`)}:</span> ${n.task}</div>`:e}
|
|
168
|
+
${n.context?t`<div><span class="font-medium text-foreground/75">${m(`subagentContext`)}:</span> ${n.context}</div>`:e}
|
|
169
|
+
${n.expectedOutput?t`<div><span class="font-medium text-foreground/75">${m(`subagentExpectedOutput`)}:</span> ${n.expectedOutput}</div>`:e}
|
|
170
|
+
</div>`:e}
|
|
171
|
+
${r.has(`summary`)?t`<div class="quickforge-subagent-summary rounded-lg border border-border/75 bg-muted/20 px-3 py-2.5 text-sm">
|
|
172
|
+
<div class="flex flex-wrap items-center gap-x-3 gap-y-1 text-muted-foreground">
|
|
173
|
+
<span class="font-medium text-foreground/85">${n.label}</span>
|
|
174
|
+
${n.toolCalls===void 0?e:t`<span>${m(`subagentToolCalls`)}: ${n.toolCalls}</span>`}
|
|
175
|
+
${n.timing?t`<span>${na(n.timing,n.status)}</span>`:e}
|
|
176
|
+
</div>
|
|
177
|
+
${n.allowedTools.length>0?t`<div class="mt-2 flex flex-wrap gap-1.5">${n.allowedTools.map(e=>t`<span class="rounded-full bg-background/80 px-2 py-0.5 text-[11px] text-muted-foreground/80">${e}</span>`)}</div>`:e}
|
|
178
|
+
</div>`:e}
|
|
179
|
+
${r.has(`trace`)?t`<div class="quickforge-subagent-trace rounded-lg border border-border bg-background/60 p-2.5"><message-list data-quickforge-subagent-process="true" data-quickforge-subagent-streaming=${String(n.status===`running`)} .messages=${i} .tools=${n.tools} .pendingToolCalls=${a} .isStreaming=${!1}></message-list></div>`:e}
|
|
180
|
+
${r.has(`error`)?t`<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">${m(`subagentErrorReason`)}:</span> ${n.errorMessage||m(`subagentErrorUnavailable`)}</div>`:e}
|
|
181
|
+
${r.has(`output`)?t`<div><div class="mb-1 text-xs font-medium text-muted-foreground">${m(`subagentResult`)}</div><code-block .code=${n.output} language="text"></code-block></div>`:e}
|
|
182
|
+
${r.has(`input`)?t`<div><div class="mb-1 text-xs font-medium text-muted-foreground">${m(`input`)}</div><code-block .code=${n.input} language="json"></code-block></div>`:e}
|
|
183
|
+
${r.has(`details`)?t`<div><div class="mb-1 text-xs font-medium text-muted-foreground">${m(`details`)}</div><code-block .code=${n.details} language="json"></code-block></div>`:e}
|
|
184
|
+
</div>
|
|
185
|
+
`}var _a=class extends r{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?ga(this.payload):t`<div class="rounded-lg border border-border bg-background/60 px-3 py-6 text-center text-sm text-muted-foreground/70">${m(`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;let e=this.querySelector(`message-list[data-quickforge-subagent-process="true"]`)?.updateComplete;if(e&&await e,this.__processDecorationDisposed||!this.isConnected)return;bi(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`,_a);var va=class{render(e,t,n){let r=v(e,t,n,s().toolDisplayMode,m,t?.toolCallId);return b(r,S.get(r.runId))&&S.publish(r),{isCustom:!1,content:ha(r)}}},ya=class{render(n,r,i){let a=Fi(r,i),o=x(r?.details),s=k(r?.details),c=Wi(`generate_image`,n,r),l=Ii(r),u=s?.model||(typeof n?.model==`string`?n.model:``);return{isCustom:!0,content:t`
|
|
186
|
+
<div class="quickforge-generated-image-tool space-y-3">
|
|
187
|
+
<div class="flex items-center gap-2 text-sm text-muted-foreground">
|
|
188
|
+
${Q(`generate_image`)}
|
|
189
|
+
<span class="min-w-0 flex-1 truncate">${m(`generateImage`)}${c?t`<span class="text-muted-foreground/70"> · ${c}</span>`:e}</span>
|
|
190
|
+
${oa(a,o)}
|
|
191
|
+
</div>
|
|
192
|
+
${s?t`
|
|
193
|
+
<div class=${s.assets.length>1?`grid grid-cols-1 gap-3 sm:grid-cols-2`:`grid grid-cols-1 gap-3`}>
|
|
194
|
+
${s.assets.map((e,n)=>{let r=ie(s,e),i=m(`generatedImageAlt`,{index:n+1});return t`
|
|
195
|
+
<figure class="overflow-hidden rounded-lg border border-border bg-background/60">
|
|
196
|
+
<a href=${r} target="_blank" rel="noopener noreferrer" title=${m(`openGeneratedImage`)} aria-label=${m(`openGeneratedImage`)}>
|
|
197
|
+
<img class="block max-h-[32rem] w-full object-contain" src=${r} alt=${i} loading="lazy" referrerpolicy="no-referrer" />
|
|
198
|
+
</a>
|
|
199
|
+
<figcaption class="flex items-center gap-2 border-t border-border px-3 py-2 text-xs text-muted-foreground">
|
|
200
|
+
<span class="min-w-0 flex-1 truncate">${u||e.mimeType}</span>
|
|
201
|
+
<a class="text-muted-foreground transition-colors hover:text-foreground" href=${r} download=${e.assetId} title=${m(`downloadGeneratedImage`)} aria-label=${m(`downloadGeneratedImage`)}>${m(`downloadGeneratedImage`)}</a>
|
|
202
|
+
</figcaption>
|
|
203
|
+
</figure>
|
|
204
|
+
`})}
|
|
205
|
+
</div>
|
|
206
|
+
${s.text?t`<div class="text-sm leading-relaxed text-muted-foreground">${s.text}</div>`:e}
|
|
207
|
+
`:a===`running`?t`
|
|
208
|
+
<div class="rounded-lg border border-border bg-background/60 px-3 py-6 text-center text-sm text-muted-foreground">${m(`generatingImage`)}</div>
|
|
209
|
+
`:l?t`<code-block .code=${l} language="text"></code-block>`:e}
|
|
210
|
+
</div>
|
|
211
|
+
`}}},ba=class{toolName;labelKey;constructor(e,t){this.toolName=e,this.labelKey=t}render(e,n,r){let i=Fi(n,r),a=x(n?.details),o=Ri(e),c=zi(n?.details),l=Li(e,n?.details),u=typeof l?.title==`string`&&l.title?l.title:typeof l?.kind==`string`?l.kind:``,d=typeof l?.kind==`string`&&l.kind!==u?l.kind:``,f=Wi(this.toolName,o,n),p=s().toolDisplayMode===`detailed`,h=p?X(o):``,g=Hi(this.toolName,o,n,r),_=Gi(c),v=p?X(_?Ki(c):c):``,y=ma(this.toolName,o,n?.details),b=$.get(y)??p,S=n?.isError?`error`:`default`;return{isCustom:!0,content:t`
|
|
212
|
+
<div class="quickforge-local-tool-shell">
|
|
213
|
+
<details class="group/tool quickforge-local-tool" ?open=${b} @toggle=${e=>{e.isTrusted&&pa(y,e.currentTarget.open)}}>
|
|
214
|
+
<summary class="quickforge-tool-summary flex cursor-pointer list-none items-center gap-2 text-sm text-muted-foreground select-none">
|
|
215
|
+
${Q(this.toolName)}
|
|
216
|
+
<span class="quickforge-tool-title min-w-0">
|
|
217
|
+
<span class="quickforge-tool-label">${u?t`OpenCode<span class="quickforge-tool-summary-detail text-muted-foreground/70"> · ${u}${d?`/${d}`:``}</span>`:m(this.labelKey)}${f?t`<span class="quickforge-tool-summary-detail text-muted-foreground/70"> · ${f}</span>`:``}</span>
|
|
218
|
+
<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>
|
|
219
|
+
${Zi(this.toolName,_)}
|
|
220
|
+
${oa(i,a)}
|
|
221
|
+
</span>
|
|
222
|
+
</summary>
|
|
223
|
+
<div class="mt-3 space-y-3">
|
|
224
|
+
${h?t`<div><div class="mb-1 text-xs font-medium text-muted-foreground">${m(`input`)}</div><code-block .code=${h} language="json"></code-block></div>`:``}
|
|
225
|
+
${g?t`<div><div class="mb-1 text-xs font-medium text-muted-foreground">${m(`output`)}</div>${this.toolName===`run_command`?t`<console-block .content=${g} .variant=${S}></console-block>`:t`<code-block .code=${g} language="text"></code-block>`}</div>`:``}
|
|
226
|
+
${_?Qi(_):``}
|
|
227
|
+
${v?t`<div><div class="mb-1 text-xs font-medium text-muted-foreground">${m(`details`)}</div><code-block .code=${v} language="json"></code-block></div>`:``}
|
|
228
|
+
</div>
|
|
229
|
+
</details>
|
|
230
|
+
<span class="quickforge-tool-actions inline-flex shrink-0 items-center gap-1">
|
|
231
|
+
${da(this.toolName,o)}
|
|
232
|
+
${sa(this.toolName,i,n?.details)}
|
|
233
|
+
</span>
|
|
234
|
+
</div>
|
|
235
|
+
`}}},xa=class{render(n,r,i){let a=Fi(r,i),o=x(r?.details),c=Li(n,r?.details),l=typeof c?.title==`string`&&c.title?c.title:typeof c?.kind==`string`&&c.kind?c.kind:`tool`,u=typeof c?.kind==`string`&&c.kind&&c.kind!==l?c.kind:``,d=Ri(n),f=zi(r?.details),p=s().toolDisplayMode===`detailed`,h=p?X(d):``,g=Ii(r),_=Gi(f),v=p?X(_?Ki(f):f):``,y=ma(`opencode_tool`,d,r?.details);return{isCustom:!0,content:t`
|
|
236
|
+
<div class="quickforge-local-tool-shell quickforge-opencode-tool-shell">
|
|
237
|
+
<details class="group/tool quickforge-local-tool quickforge-opencode-tool" ?open=${$.get(y)??p} @toggle=${e=>{e.isTrusted&&pa(y,e.currentTarget.open)}}>
|
|
238
|
+
<summary class="quickforge-tool-summary flex cursor-pointer list-none items-center gap-2 text-sm text-muted-foreground select-none">
|
|
239
|
+
${Q(`opencode_tool`)}
|
|
240
|
+
<span class="quickforge-tool-title min-w-0">
|
|
241
|
+
<span class="quickforge-tool-label">OpenCode<span class="quickforge-tool-summary-detail text-muted-foreground/70"> · ${l}${u?`/${u}`:``}</span></span>
|
|
242
|
+
<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>
|
|
243
|
+
${oa(a,o)}
|
|
244
|
+
</span>
|
|
245
|
+
</summary>
|
|
246
|
+
<div class="mt-3 space-y-3">
|
|
247
|
+
${h?t`<div><div class="mb-1 text-xs font-medium text-muted-foreground">${m(`input`)}</div><code-block .code=${h} language="json"></code-block></div>`:e}
|
|
248
|
+
${g?t`<div><div class="mb-1 text-xs font-medium text-muted-foreground">${m(`output`)}</div><code-block .code=${g} language=${wa(g)}></code-block></div>`:e}
|
|
249
|
+
${_?Qi(_):e}
|
|
250
|
+
${v?t`<div><div class="mb-1 text-xs font-medium text-muted-foreground">${m(`details`)}</div><code-block .code=${v} language="json"></code-block></div>`:e}
|
|
251
|
+
</div>
|
|
252
|
+
</details>
|
|
253
|
+
</div>
|
|
254
|
+
`}}};function Sa(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 Ca(e,t){let n=Sa(e),r=Z(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 wa(e){if(!e)return`text`;try{return JSON.parse(e),`json`}catch{return`text`}}var Ta=class{toolName;label;constructor(e,t){this.toolName=e,this.label=t}render(n,r,i){let a=Fi(r,i),o=x(r?.details),c=Ca(this.toolName,r?.details)??Sa(this.toolName),l=c?.serverName??``,u=c?.toolName??this.toolName,d=Wi(this.toolName,n,r),f=s().toolDisplayMode===`detailed`,p=f?X(n):``,h=Hi(this.toolName,n,r,i),g=f?X(r?.details):``,_=ma(this.toolName,n,r?.details),v=$.get(_)??f,y=this.label&&this.label!==u?`${this.label} (${u})`:u;return{isCustom:!1,content:t`
|
|
255
|
+
<details class="group/tool quickforge-mcp-tool" ?open=${v} @toggle=${e=>{e.isTrusted&&pa(_,e.currentTarget.open)}}>
|
|
256
|
+
<summary class="quickforge-tool-summary flex cursor-pointer list-none items-center gap-2 text-sm text-muted-foreground select-none">
|
|
257
|
+
${Q(this.toolName)}
|
|
258
|
+
<span class="quickforge-tool-title min-w-0">
|
|
259
|
+
<span class="quickforge-tool-label">MCP${l?t`<span class="quickforge-tool-summary-detail text-muted-foreground/70"> · ${l}</span>`:e}<span class="quickforge-tool-summary-detail text-muted-foreground/70"> · ${y}</span>${d?t`<span class="quickforge-tool-summary-detail text-muted-foreground/70"> · ${d}</span>`:e}</span>
|
|
260
|
+
<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>
|
|
261
|
+
${oa(a,o)}
|
|
262
|
+
</span>
|
|
263
|
+
</summary>
|
|
264
|
+
<div class="mt-3 space-y-3">
|
|
265
|
+
${p?t`<div><div class="mb-1 text-xs font-medium text-muted-foreground">${m(`input`)}</div><code-block .code=${p} language="json"></code-block></div>`:e}
|
|
266
|
+
${h?t`<div><div class="mb-1 text-xs font-medium text-muted-foreground">${m(`output`)}</div><code-block .code=${h} language=${wa(h)}></code-block></div>`:e}
|
|
267
|
+
${g?t`<div><div class="mb-1 text-xs font-medium text-muted-foreground">${m(`details`)}</div><code-block .code=${g} language="json"></code-block></div>`:e}
|
|
268
|
+
</div>
|
|
269
|
+
</details>
|
|
270
|
+
`}}},Ea=new Set;function Da(e){for(let t of e){if(!Z(t)||typeof t.name!=`string`||!Sa(t.name)||Ea.has(t.name))continue;let e=typeof t.label==`string`?t.label:typeof t.description==`string`?t.description.replace(/^\[MCP:[^\]]+\]\s*/,``):void 0;i(t.name,new Ta(t.name,e)),Ea.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`]])i(e,new ba(e,t));i(`run_subagent`,new va),i(`generate_image`,new ya),i(`opencode_tool`,new xa);function Oa(e=[]){return Da(e),e}export{tt as _,Cr as a,rr as c,Ot as d,vt as f,et as g,Qe as h,xi as i,Pt as l,$e as m,ji as n,xr as o,yt as p,Ai as r,Tr as s,Oa as t,kt as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{D as t,Gt as n,J as r,Jt as i,S as a,ft as o,j as s,s as c,v as l}from"./icons-DM_qJ7VJ.js";import{n as u}from"./react-vendor-BpWW_Nvp.js";import{An as d,Dn as f,H as p,Pn as m,Tt as h,kn as g}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{D as t,Gt as n,J as r,Jt as i,S as a,ft as o,j as s,s as c,v as l}from"./icons-DM_qJ7VJ.js";import{n as u}from"./react-vendor-BpWW_Nvp.js";import{An as d,Dn as f,H as p,Pn as m,Tt as h,kn as g}from"./index-BgMvQW1b.js";var _=e(i(),1),v=u();function y(e){return e===`connected`?`bg-emerald-500/12 text-emerald-700 dark:text-emerald-300`:e===`error`?`bg-destructive/12 text-destructive`:e===`disabled`?`bg-muted text-muted-foreground`:`bg-amber-500/12 text-amber-700 dark:text-amber-300`}var b=12;function x({server:e,toggling:t,reconnecting:n,onToggle:i,onEdit:o,onDelete:l,onReconnect:u}){let f=e.tools?.slice(0,b)??[],p=e.toolCount??e.tools?.length??0,h=Math.max(0,p-f.length),_=e.enabled&&e.status!==`connected`;return(0,v.jsxs)(`div`,{className:`rounded-lg border border-border p-3`,children:[(0,v.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,v.jsxs)(`div`,{className:`min-w-0`,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground/90`,children:e.name}),(0,v.jsx)(`span`,{className:d(`rounded-full px-2 py-0.5 text-[11px]`,y(e.status)),children:e.status||`unknown`}),(0,v.jsx)(`span`,{className:`text-[11px] text-muted-foreground/60`,children:m(`mcpToolsCount`,{count:p})})]}),(0,v.jsx)(`div`,{className:`mt-1 truncate text-xs text-muted-foreground/65`,children:e.transport===`stdio`?`${e.command} ${(e.args||[]).join(` `)}`:e.url}),e.error?(0,v.jsx)(`div`,{className:`mt-1 text-xs text-destructive`,children:e.error}):null]}),(0,v.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,v.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e.enabled,disabled:t,className:d(`relative h-6 w-11 rounded-full transition-colors disabled:cursor-not-allowed disabled:opacity-60`,e.enabled?`bg-emerald-500`:`bg-muted-foreground/30`),onClick:()=>i(e),title:e.enabled?m(`pauseTask`):m(`enable`),children:(0,v.jsx)(`span`,{className:d(`absolute left-0.5 top-0.5 size-5 rounded-full bg-white shadow transition-transform`,e.enabled?`translate-x-5`:`translate-x-0`)})}),_?(0,v.jsx)(g,{type:`button`,variant:`ghost`,size:`icon`,className:`size-8 text-muted-foreground`,onClick:()=>u(e.name),disabled:n,"aria-label":m(`mcpReconnectServer`),title:m(`mcpReconnectServer`),children:n?(0,v.jsx)(r,{className:`size-4 animate-spin`}):(0,v.jsx)(a,{className:`size-4`})}):null,(0,v.jsx)(g,{type:`button`,variant:`ghost`,size:`icon`,className:`size-8 text-muted-foreground`,onClick:()=>o(e),"aria-label":m(`editTask`),title:m(`editTask`),children:(0,v.jsx)(s,{className:`size-4`})}),(0,v.jsx)(g,{type:`button`,variant:`ghost`,size:`icon`,className:`size-8 text-destructive`,onClick:()=>l(e.name),"aria-label":m(`delete`),title:m(`delete`),children:(0,v.jsx)(c,{className:`size-4`})})]})]}),f.length>0?(0,v.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[f.map(e=>(0,v.jsx)(`span`,{className:`rounded-md bg-muted/28 px-1.5 py-0.5 text-[11px] text-muted-foreground/75`,title:e.quickForgeName,children:e.name},e.quickForgeName)),h>0?(0,v.jsx)(`span`,{className:`rounded-md px-1.5 py-0.5 text-[11px] text-muted-foreground/55`,children:m(`mcpMoreTools`,{count:h})}):null]}):null]})}function S(){return{name:``,transport:`stdio`,command:``,args:[],url:``,cwd:``,env:{}}}function C(e){return{name:e.name,transport:e.transport,command:e.command,args:e.args||[],url:e.url||``,cwd:e.cwd||``,env:e.env||{}}}function w(e){return(e||[]).join(`
|
|
2
2
|
`)}function T(e){return Object.entries(e||{}).map(([e,t])=>`${e}=${t}`).join(`
|
|
3
3
|
`)}function E(e){return e.split(`
|
|
4
4
|
`).map(e=>e.trim()).filter(Boolean)}function D(e){let t={};for(let n of e.split(`
|