"use strict";Object.assign(CodemanApp.prototype,{_onRalphLoopUpdate(t){this.ralphClosedSessions.has(t.sessionId)||this.updateRalphState(t.sessionId,{loop:t.state})},_onRalphTodoUpdate(t){this.ralphClosedSessions.has(t.sessionId)||this.updateRalphState(t.sessionId,{todos:t.todos})},_onRalphCompletionDetected(t){if(this.ralphClosedSessions.has(t.sessionId))return;const e=`${t.sessionId}:${t.phrase}`;if(this._shownCompletions?.has(e))return;this._shownCompletions||(this._shownCompletions=new Set),this._shownCompletions.add(e),setTimeout(()=>this._shownCompletions?.delete(e),3e4);const s=this.ralphStates.get(t.sessionId)||{};s.loop&&(s.loop.active=!1,this.updateRalphState(t.sessionId,s)),this._notifySession(t.sessionId,"warning","ralph-complete","Loop Complete",`Completion: ${t.phrase||"unknown"}`)},_onRalphStatusUpdate(t){this.ralphClosedSessions.has(t.sessionId)||this.updateRalphState(t.sessionId,{statusBlock:t.block})},_onCircuitBreakerUpdate(t){this.ralphClosedSessions.has(t.sessionId)||(this.updateRalphState(t.sessionId,{circuitBreaker:t.status}),t.status.state==="OPEN"&&this._notifySession(t.sessionId,"critical","circuit-breaker","Circuit Breaker Open",t.status.reason||"Loop stuck - no progress detected"))},_onExitGateMet(t){this._notifySession(t.sessionId,"warning","exit-gate","Exit Gate Met",`Loop ready to exit (indicators: ${t.completionIndicators})`)},_onPlanSubagent(t){console.log("[Plan Subagent]",t),this.handlePlanSubagentEvent(t)},_onPlanProgress(t){console.log("[Plan Progress]",t),this._planProgressHandler&&this._planProgressHandler({type:"plan:progress",data:t});const e=document.getElementById("planLoadingTitle"),s=document.getElementById("planLoadingHint");if(e&&t.phase){const a={"parallel-analysis":"Running parallel analysis...",subagent:t.detail||"Subagent working...",synthesis:"Synthesizing results...",verification:"Running verification..."};e.textContent=a[t.phase]||t.phase}s&&t.detail&&(s.textContent=t.detail)},_onPlanStarted(t){console.log("[Plan Started]",t),this.activePlanOrchestratorId=t.orchestratorId,this.planGenerationStopped=!1,this.renderMonitorPlanAgents()},_onPlanCancelled(t){console.log("[Plan Cancelled]",t),this.activePlanOrchestratorId===t.orchestratorId&&(this.activePlanOrchestratorId=null),this.renderMonitorPlanAgents()},_onPlanCompleted(t){console.log("[Plan Completed]",t),this.activePlanOrchestratorId===t.orchestratorId&&(this.activePlanOrchestratorId=null),this.renderMonitorPlanAgents()},updateRalphState(t,e){const a={...this.ralphStates.get(t)||{loop:null,todos:[]},...e};this.ralphStates.set(t,a),t===this.activeSessionId&&this.renderRalphStatePanel()},toggleRalphStatePanel(){const t=this.terminal?.element?.querySelector(".xterm-viewport"),e=t?.scrollTop;this.ralphStatePanelCollapsed=!this.ralphStatePanelCollapsed,this.renderRalphStatePanel(),requestAnimationFrame(()=>{t&&e!==void 0&&(t.scrollTop=e),this.terminal&&this.fitAddon&&this.fitAddon.fit()})},async closeRalphTracker(){this.activeSessionId&&(this.ralphClosedSessions.add(this.activeSessionId),await this._apiPost(`/api/sessions/${this.activeSessionId}/ralph-config`,{enabled:!1}),this.ralphStates.delete(this.activeSessionId),this.renderRalphStatePanel())},toggleRalphMenu(){const t=document.getElementById("ralphDropdown");t&&t.classList.toggle("show")},closeRalphMenu(){const t=document.getElementById("ralphDropdown");t&&t.classList.remove("show")},async resetCircuitBreaker(){if(this.activeSessionId)try{(await(await this._apiPost(`/api/sessions/${this.activeSessionId}/ralph-circuit-breaker/reset`,{}))?.json())?.success&&this.notificationManager?.notify({urgency:"info",category:"circuit-breaker",title:"Reset",message:"Circuit breaker reset to CLOSED"})}catch(t){console.error("Error resetting circuit breaker:",t)}},async showFixPlan(){if(this.activeSessionId)try{const e=await(await fetch(`/api/sessions/${this.activeSessionId}/fix-plan`)).json();if(!e.success){this.notificationManager?.notify({urgency:"error",category:"fix-plan",title:"Error",message:e.error||"Failed to generate fix plan"});return}this.showFixPlanModal(e.data.content,e.data.todoCount)}catch(t){console.error("Error fetching fix plan:",t)}},showFixPlanModal(t,e){let s=document.getElementById("fixPlanModal");s||(s=document.createElement("div"),s.id="fixPlanModal",s.className="modal",s.innerHTML=`
        <div class="modal-content fix-plan-modal">
          <div class="modal-header">
            <h3>@fix_plan.md</h3>
            <button class="btn-close" onclick="app.closeFixPlanModal()">&times;</button>
          </div>
          <div class="modal-body">
            <textarea id="fixPlanContent" class="fix-plan-textarea" readonly></textarea>
          </div>
          <div class="modal-footer">
            <span class="fix-plan-stats" id="fixPlanStats"></span>
            <button class="btn btn-secondary" onclick="app.copyFixPlan()">Copy</button>
            <button class="btn btn-primary" onclick="app.writeFixPlanToFile()">Write to File</button>
            <button class="btn btn-secondary" onclick="app.closeFixPlanModal()">Close</button>
          </div>
        </div>
      `,document.body.appendChild(s)),document.getElementById("fixPlanContent").value=t,document.getElementById("fixPlanStats").textContent=`${e} tasks`,s.classList.add("show")},closeFixPlanModal(){const t=document.getElementById("fixPlanModal");t&&t.classList.remove("show")},async copyFixPlan(){const t=document.getElementById("fixPlanContent")?.value;t&&(await navigator.clipboard.writeText(t),this.notificationManager?.notify({urgency:"info",category:"fix-plan",title:"Copied",message:"Fix plan copied to clipboard"}))},async writeFixPlanToFile(){if(this.activeSessionId)try{const e=await(await fetch(`/api/sessions/${this.activeSessionId}/fix-plan/write`,{method:"POST"})).json();e.success?(this.notificationManager?.notify({urgency:"info",category:"fix-plan",title:"Written",message:`@fix_plan.md written to ${e.data.filePath}`}),this.closeFixPlanModal()):this.notificationManager?.notify({urgency:"error",category:"fix-plan",title:"Error",message:e.error||"Failed to write file"})}catch(t){console.error("Error writing fix plan:",t)}},async importFixPlanFromFile(){if(this.activeSessionId)try{const e=await(await fetch(`/api/sessions/${this.activeSessionId}/fix-plan/read`,{method:"POST"})).json();e.success?(this.notificationManager?.notify({urgency:"info",category:"fix-plan",title:"Imported",message:`Imported ${e.data.importedCount} tasks from @fix_plan.md`}),this.updateRalphState(this.activeSessionId,{todos:e.data.todos})):this.notificationManager?.notify({urgency:"warning",category:"fix-plan",title:"Not Found",message:e.error||"@fix_plan.md not found"})}catch(t){console.error("Error importing fix plan:",t)}},toggleRalphDetach(){const t=this.$("ralphStatePanel"),e=this.$("ralphDetachBtn");t&&(t.classList.contains("detached")?(t.classList.remove("detached"),t.style.top="",t.style.left="",t.style.width="",t.style.height="",e&&(e.innerHTML="&#x29C9;",e.title="Detach panel")):(t.classList.add("detached"),this.ralphStatePanelCollapsed=!1,t.classList.remove("collapsed"),e&&(e.innerHTML="&#x229E;",e.title="Attach panel"),this.setupRalphDrag()),this.renderRalphStatePanel())},setupRalphDrag(){const t=this.$("ralphStatePanel"),e=this.$("ralphSummary");if(!t||!e)return;let s=!1,a,i,r,o;const l=p=>{if(p.target.closest("button")||p.target.closest(".ralph-toggle")||!t.classList.contains("detached"))return;s=!0,a=p.clientX,i=p.clientY;const d=t.getBoundingClientRect();r=d.left,o=d.top,document.addEventListener("mousemove",n),document.addEventListener("mouseup",c),p.preventDefault()},n=p=>{if(!s)return;const d=p.clientX-a,h=p.clientY-i;let u=r+d,m=o+h;const f=t.getBoundingClientRect();u=Math.max(0,Math.min(window.innerWidth-f.width,u)),m=Math.max(0,Math.min(window.innerHeight-f.height,m)),t.style.left=u+"px",t.style.top=m+"px"},c=()=>{s=!1,document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",c)};e.removeEventListener("mousedown",e._ralphDragHandler),e._ralphDragHandler=l,e.addEventListener("mousedown",l)},renderRalphStatePanel(){this._debouncedCall("ralphStatePanel",this._renderRalphStatePanelImmediate,50)},_renderRalphStatePanelImmediate(){const t=this.$("ralphStatePanel"),e=this.$("ralphToggle");if(!t)return;if(this.ralphClosedSessions.has(this.activeSessionId)){t.style.display="none";return}const s=this.ralphStates.get(this.activeSessionId),a=s?.loop?.enabled===!0,i=s?.loop?.active||s?.loop?.completionPhrase,r=s?.todos?.length>0,o=s?.circuitBreaker&&s.circuitBreaker.state!=="CLOSED",l=s?.statusBlock!==void 0;if(!a&&!i&&!r&&!o&&!l){t.style.display="none";return}t.style.display="";const n=s?.todos||[],c=n.filter(h=>h.status==="completed").length,p=n.length,d=p>0?Math.round(c/p*100):0;this.updateRalphRing(d),this.updateRalphStatus(s?.loop,c,p),this.updateRalphStats(s?.loop,c,p),this.updateCircuitBreakerBadge(s?.circuitBreaker),this.ralphStatePanelCollapsed?(t.classList.add("collapsed"),e&&(e.innerHTML="&#x25BC;")):(t.classList.remove("collapsed"),e&&(e.innerHTML="&#x25B2;"),this.updateRalphExpandedView(s))},updateRalphRing(t){const e=Math.max(0,Math.min(100,Number(t)||0)),s=this.$("ralphRingMiniProgress"),a=this.$("ralphRingMiniText");if(s){const o=100-e;s.style.strokeDashoffset=o}a&&(a.textContent=`${e}%`);const i=this.$("ralphRingProgress"),r=this.$("ralphRingPercent");if(i){const o=264-264*e/100;i.style.strokeDashoffset=o}r&&(r.textContent=`${e}%`)},updateRalphStatus(t,e=0,s=0){const a=this.$("ralphStatusBadge"),i=a?.querySelector(".ralph-status-text");!a||!i||(a.classList.remove("active","completed","tracking"),t?.active?(a.classList.add("active"),i.textContent="Running"):s>0&&e===s?(a.classList.add("completed"),i.textContent="Complete"):t?.enabled||s>0?(a.classList.add("tracking"),i.textContent="Tracking"):i.textContent="Idle")},updateCircuitBreakerBadge(t){let e=this.$("ralphCircuitBreakerBadge");if(!e){const s=this.$("ralphSummary");if(!s)return;if(e=s.querySelector(".ralph-circuit-breaker"),!e){e=document.createElement("div"),e.id="ralphCircuitBreakerBadge",e.className="ralph-circuit-breaker";const a=this.$("ralphStatusBadge");a&&a.nextSibling?a.parentNode.insertBefore(e,a.nextSibling):s.appendChild(e)}}if(!t||t.state==="CLOSED"){e.style.display="none";return}e.style.display="",e.classList.remove("half-open","open"),t.state==="HALF_OPEN"?(e.classList.add("half-open"),e.innerHTML='<span class="cb-icon">\u26A0</span><span class="cb-text">Warning</span>',e.title=t.reason||"Circuit breaker warning"):t.state==="OPEN"&&(e.classList.add("open"),e.innerHTML='<span class="cb-icon">\u{1F6D1}</span><span class="cb-text">Stuck</span>',e.title=t.reason||"Loop appears stuck"),e.onclick=()=>this.resetCircuitBreaker()},updateRalphStats(t,e,s){const a=this.$("ralphStatTime");if(a)if(t?.elapsedHours!==null&&t?.elapsedHours!==void 0)a.textContent=this.formatRalphTime(t.elapsedHours);else if(t?.startedAt){const o=(Date.now()-t.startedAt)/36e5;a.textContent=this.formatRalphTime(o)}else a.textContent="0m";const i=this.$("ralphStatCycles");i&&(t?.maxIterations?i.textContent=`${t.cycleCount||0}/${t.maxIterations}`:i.textContent=String(t?.cycleCount||0));const r=this.$("ralphStatTasks");r&&(r.textContent=`${e}/${s}`)},formatRalphTime(t){if(t<.0167)return"0m";if(t<1)return`${Math.round(t*60)}m`;const e=Math.floor(t),s=Math.round((t-e)*60);return s===0?`${e}h`:`${e}h ${s}m`},updateRalphExpandedView(t){const e=this.$("ralphPhrase");e&&(e.textContent=t?.loop?.completionPhrase||"--");const s=this.$("ralphElapsed");if(s)if(t?.loop?.elapsedHours!==null&&t?.loop?.elapsedHours!==void 0)s.textContent=this.formatRalphTime(t.loop.elapsedHours);else if(t?.loop?.startedAt){const l=(Date.now()-t.loop.startedAt)/36e5;s.textContent=this.formatRalphTime(l)}else s.textContent="0m";const a=this.$("ralphIterations");a&&(t?.loop?.maxIterations?a.textContent=`${t.loop.cycleCount||0} / ${t.loop.maxIterations}`:a.textContent=String(t?.loop?.cycleCount||0));const i=t?.todos||[],r=i.filter(l=>l.status==="completed").length,o=this.$("ralphTasksCount");o&&(o.textContent=`${r}/${i.length}`),t?.loop?.planVersion?this.updatePlanVersionDisplay(t.loop.planVersion,t.loop.planHistoryLength||1):this.updatePlanVersionDisplay(null,0),this.renderRalphTasks(i),this.renderRalphStatusBlock(t?.statusBlock)},renderRalphStatusBlock(t){let e=this.$("ralphStatusBlockDisplay");const s=this.$("ralphExpandedContent");if(!t){e&&e.remove();return}if(!e&&s&&(e=document.createElement("div"),e.id="ralphStatusBlockDisplay",e.className="ralph-status-block",s.insertBefore(e,s.firstChild)),!e)return;const a=t.status==="IN_PROGRESS"?"in-progress":t.status==="COMPLETE"?"complete":t.status==="BLOCKED"?"blocked":"",i=t.testsStatus==="PASSING"?"\u2705":t.testsStatus==="FAILING"?"\u274C":"\u23F8",r=t.workType==="IMPLEMENTATION"?"\u{1F527}":t.workType==="TESTING"?"\u{1F9EA}":t.workType==="DOCUMENTATION"?"\u{1F4DD}":t.workType==="REFACTORING"?"\u267B\uFE0F":"\u{1F4CB}";let o=`
      <div class="ralph-status-block-header">
        <span>RALPH_STATUS</span>
        <span class="ralph-status-block-status ${a}">${escapeHtml(t.status)}</span>
        ${t.exitSignal?'<span style="color: #4caf50;">\u{1F6AA} EXIT</span>':""}
      </div>
      <div class="ralph-status-block-stats">
        <span>${r} ${escapeHtml(t.workType)}</span>
        <span>\u{1F4C1} ${t.filesModified} files</span>
        <span>\u2713 ${escapeHtml(String(t.tasksCompletedThisLoop))} tasks</span>
        <span>${i} Tests: ${escapeHtml(t.testsStatus)}</span>
      </div>
    `;t.recommendation&&(o+=`<div class="ralph-status-block-recommendation">${escapeHtml(t.recommendation)}</div>`),e.innerHTML=o},renderRalphTasks(t){const e=this.$("ralphTasksGrid");if(!e)return;if(t.length===0){(e.children.length!==1||!e.querySelector(".ralph-state-empty"))&&(e.innerHTML='<div class="ralph-state-empty">No tasks detected</div>');return}const s={P0:0,P1:1,P2:2,null:3},a={in_progress:0,pending:1,completed:2},i=[...t].sort((o,l)=>{const n=s[o.priority]??3,c=s[l.priority]??3;return n!==c?n-c:(a[o.status]||1)-(a[l.status]||1)}),r=document.createDocumentFragment();i.forEach((o,l)=>{const n=this.createRalphTaskCard(o,l);r.appendChild(n)}),e.innerHTML="",e.appendChild(r)},createRalphTaskCard(t,e){const s=document.createElement("div"),a=`task-${t.status.replace("_","-")}`,i=t.priority?`task-priority-${t.priority.toLowerCase()}`:"";s.className=`ralph-task-card ${a} ${i}`.trim(),s.dataset.taskId=t.id||e;const r=document.createElement("span");if(r.className="ralph-task-icon",r.textContent=this.getRalphTaskIcon(t.status),s.appendChild(r),t.priority){const n=document.createElement("span");n.className=`ralph-task-priority priority-${t.priority.toLowerCase()}`,n.textContent=t.priority,s.appendChild(n)}const o=document.createElement("span");if(o.className="ralph-task-content",o.textContent=t.content,s.appendChild(o),t.attempts&&t.attempts>0){const n=document.createElement("span");n.className="ralph-task-attempts",t.lastError&&(n.classList.add("has-errors"),n.title=`Last error: ${t.lastError}`),n.textContent=`#${t.attempts}`,s.appendChild(n)}if(t.verificationCriteria){const n=document.createElement("span");n.className="ralph-task-verify-badge",n.title=`Verify: ${t.verificationCriteria}`,n.textContent="\u2713",s.appendChild(n)}if(t.dependencies&&t.dependencies.length>0){const n=document.createElement("span");n.className="ralph-task-deps-indicator",n.title=`Depends on: ${t.dependencies.join(", ")}`,n.textContent=`\u2197${t.dependencies.length}`,s.appendChild(n)}const l=document.createElement("div");if(l.className="ralph-task-actions",t.status!=="completed"){const n=document.createElement("button");n.className="ralph-task-action-btn",n.textContent="\u2713",n.title="Mark complete",n.onclick=c=>{c.stopPropagation(),this.updateRalphTaskStatus(t.id,"completed")},l.appendChild(n)}if(t.status==="completed"){const n=document.createElement("button");n.className="ralph-task-action-btn",n.textContent="\u21BA",n.title="Reopen",n.onclick=c=>{c.stopPropagation(),this.updateRalphTaskStatus(t.id,"pending")},l.appendChild(n)}if(t.lastError){const n=document.createElement("button");n.className="ralph-task-action-btn",n.textContent="\u21BB",n.title="Retry (clear error)",n.onclick=c=>{c.stopPropagation(),this.retryRalphTask(t.id)},l.appendChild(n)}return s.appendChild(l),s},async updateRalphTaskStatus(t,e){if(this.activeSessionId)try{const s=await fetch(`/api/sessions/${this.activeSessionId}/plan/task/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:e})});if(!s.ok){const a=await s.json();throw new Error(a.error||"Failed to update task")}this.showToast(`Task ${e==="completed"?"completed":"reopened"}`,"success")}catch(s){this.showToast("Failed to update task: "+s.message,"error")}},async retryRalphTask(t){if(this.activeSessionId)try{const e=await fetch(`/api/sessions/${this.activeSessionId}/plan/task/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({attempts:0,lastError:null,status:"pending"})});if(!e.ok){const s=await e.json();throw new Error(s.error||"Failed to retry task")}this.showToast("Task reset for retry","success")}catch(e){this.showToast("Failed to retry task: "+e.message,"error")}},getRalphTaskIcon(t){switch(t){case"completed":return"\u2713";case"in_progress":return"\u25D0";default:return"\u25CB"}},getTodoIcon(t){return this.getRalphTaskIcon(t)},updatePlanVersionDisplay(t,e){const s=this.$("ralphVersionRow"),a=this.$("ralphPlanVersion"),i=this.$("ralphRollbackBtn");s&&(t&&t>0?(s.style.display="",a&&(a.textContent=`v${t}`),i&&(i.style.display=e>1?"":"none")):s.style.display="none")},async showPlanHistory(){if(this.activeSessionId)try{const e=await(await fetch(`/api/sessions/${this.activeSessionId}/plan/history`)).json();if(e.error){this.showToast("Failed to load plan history: "+e.error,"error");return}const s=e.data.history||[];if(s.length===0){this.showToast("No plan history available","info");return}this.showPlanHistoryModal(s,e.data.currentVersion)}catch(t){this.showToast("Failed to load plan history: "+t.message,"error")}},showPlanHistoryModal(t,e){const s=document.getElementById("planHistoryModal");s&&s.remove();const a=document.createElement("div");a.id="planHistoryModal",a.className="modal active",a.innerHTML=`
      <div class="modal-backdrop" onclick="app.closePlanHistoryModal()"></div>
      <div class="modal-content modal-sm">
        <div class="modal-header">
          <h3>Plan Version History</h3>
          <button class="modal-close" onclick="app.closePlanHistoryModal()">&times;</button>
        </div>
        <div class="modal-body">
          <p style="font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.75rem;">
            Current version: <strong>v${e}</strong>
          </p>
          <div class="plan-history-list">
            ${t.map(i=>`
              <div class="plan-history-item ${i.version===e?"current":""}"
                   onclick="app.rollbackToPlanVersion(${i.version})">
                <div>
                  <span class="plan-history-version">v${i.version}</span>
                  <span class="plan-history-tasks">${i.stats?.total??0} tasks</span>
                </div>
                <span class="plan-history-time">${this.formatRelativeTime(i.timestamp)}</span>
              </div>
            `).join("")}
          </div>
        </div>
        <div class="modal-footer">
          <button class="btn-toolbar" onclick="app.closePlanHistoryModal()">Close</button>
        </div>
      </div>
    `,document.body.appendChild(a)},closePlanHistoryModal(){const t=document.getElementById("planHistoryModal");t&&t.remove()},async rollbackToPlanVersion(t){if(this.activeSessionId&&confirm(`Rollback to plan version ${t}? Current changes will be preserved in history.`))try{const s=await(await fetch(`/api/sessions/${this.activeSessionId}/plan/rollback/${t}`,{method:"POST"})).json();if(s.error){this.showToast("Failed to rollback: "+s.error,"error");return}this.showToast(`Rolled back to plan v${t}`,"success"),this.closePlanHistoryModal(),this.renderRalphStatePanel()}catch(e){this.showToast("Failed to rollback: "+e.message,"error")}},formatRelativeTime(t){if(!t)return"";const s=Date.now()-t,a=Math.floor(s/6e4),i=Math.floor(s/36e5),r=Math.floor(s/864e5);return a<1?"just now":a<60?`${a}m ago`:i<24?`${i}h ago`:`${r}d ago`},renderMonitorPlanAgents(){const t=document.getElementById("monitorPlanAgentsSection"),e=document.getElementById("monitorPlanAgentsBody"),s=document.getElementById("monitorPlanAgentStats");if(!t||!e)return;const a=Array.from(this.planSubagents?.values()||[]),i=!!this.activePlanOrchestratorId;if(a.length===0&&!i){t.style.display="none";return}t.style.display="";const r=a.filter(n=>n.status==="running").length,o=a.filter(n=>n.status==="completed"||n.status==="failed").length;if(s&&(i?s.textContent=`${r} running, ${o} done`:s.textContent=`${a.length} total`),a.length===0){e.innerHTML=`<div class="monitor-empty">${i?"Plan generation starting...":"No plan agents"}</div>`;return}let l="";for(const n of a){const c=n.status==="running"?"active":n.status==="completed"?"completed":"error",p=n.agentType||n.agentId,d=n.model?'<span class="model-badge opus">opus</span>':"",h=n.detail?escapeHtml(n.detail.substring(0,50)):"",u=n.durationMs?`${(n.durationMs/1e3).toFixed(1)}s`:"",m=n.itemCount?`${n.itemCount} items`:"";l+=`
        <div class="process-item">
          <span class="process-mode ${c}">${n.status||"pending"}</span>
          <div class="process-info">
            <div class="process-name">${d} ${escapeHtml(p)}</div>
            <div class="process-meta">
              ${h?`<span>${h}</span>`:""}
              ${m?`<span>${m}</span>`:""}
              ${u?`<span>${u}</span>`:""}
            </div>
          </div>
        </div>
      `}e.innerHTML=l},async cancelPlanFromMonitor(){if(!this.activePlanOrchestratorId&&this.planSubagents?.size===0){this.showToast("No active plan generation","info");return}if(!confirm("Cancel plan generation and close all plan agent windows?"))return;await this.cancelPlanGeneration(),document.getElementById("ralphWizardModal")?.classList.contains("active")&&this.closeRalphWizard(),this.renderMonitorPlanAgents(),this.showToast("Plan generation cancelled","success")}});
