"use strict";exports.id=9395,exports.ids=[9395],exports.modules={61942:(t,e,n)=>{n.d(e,{_:()=>r,n:()=>o});var i=n(79171),s=n(37502);let o={PROMPT_DETECTED:"prompt_detected",THINKING_INDICATOR:"thinking_indicator",OPENCODE_PROCESSING_INDICATOR:"opencode_processing_indicator",OPENCODE_SELECTION_LIST:"opencode_selection_list",CLAUDE_SELECTION_LIST:"claude_selection_list",OPENCODE_RESPONSE_COMPLETE:"opencode_response_complete",INPUT_PROMPT:"input_prompt",NO_RECENT_OUTPUT:"no_recent_output",DEFAULT:"default"};function r(t,e,n){let r=(0,i.vp)(t),a=r.split("\n"),c=a.length-1;for(;c>=0&&""===a[c].trim();)c--;let h=a.slice(0,c+1),p=h.slice(-15).join("\n"),l=h.slice(-5).join("\n"),u=(0,i.Sg)(e),d="opencode"===e||"codex"===e||"claude"===e?(0,i.BN)(r):(0,i.BN)(p),g=(0,s.FS)(d,u);if(g.isPrompt)return{status:"waiting",confidence:"high",reason:"prompt_detected",hasActivePrompt:!0,promptDetection:g};if("claude"===e&&i.eS.test(p))return{status:"waiting",confidence:"high",reason:o.CLAUDE_SELECTION_LIST,hasActivePrompt:!1,promptDetection:g};if((0,i.Wg)(e,l))return{status:"running",confidence:"high",reason:"thinking_indicator",hasActivePrompt:!1,promptDetection:g};if("opencode"===e){if(i.nT.test(p))return{status:"running",confidence:"high",reason:"opencode_processing_indicator",hasActivePrompt:!1,promptDetection:g};let t=(0,i.BN)(r).split("\n"),e=Math.max(0,t.length-7);for(let n=t.length-1;n>=Math.max(0,t.length-10);n--)if(/ctrl\+[tp]/.test(t[n])){e=Math.max(0,n-2);break}let n=t.slice(0,e),s=n.length-1;for(;s>=0&&""===n[s].trim();)s--;if(s>=0){let t=n.slice(Math.max(0,s-5+1),s+1).join("\n");if((0,i.Wg)("opencode",t))return{status:"running",confidence:"high",reason:"thinking_indicator",hasActivePrompt:!1,promptDetection:g};let e=n.slice(Math.max(0,s-15+1),s+1).join("\n"),r=n.join("\n");if(i.mI.test(r))return{status:"waiting",confidence:"high",reason:o.OPENCODE_SELECTION_LIST,hasActivePrompt:!1,promptDetection:g};if(i.n9.test(e))return{status:"ready",confidence:"high",reason:o.OPENCODE_RESPONSE_COMPLETE,hasActivePrompt:!1,promptDetection:g};let{promptPattern:a}=(0,i.bs)("opencode");if(a.test(e))return{status:"ready",confidence:"high",reason:o.PROMPT_DETECTED,hasActivePrompt:!0,promptDetection:g}}}if("codex"===e){let t=/^\s*\S+.*\d+%\s+left\s+·/,e=-1;for(let n=h.length-1;n>=Math.max(0,h.length-10);n--)if(t.test(h[n])){e=n;break}if(e>=0){let t=e-1;for(;t>=0&&""===h[t].trim();)t--;if(t>=0){let e=h.slice(Math.max(0,t-5+1),t+1).join("\n");if((0,i.Wg)("codex",e))return{status:"running",confidence:"high",reason:"thinking_indicator",hasActivePrompt:!1,promptDetection:g};let n=h[t].trim();return i.hr.test(n)?{status:"ready",confidence:"high",reason:"input_prompt",hasActivePrompt:!1,promptDetection:g}:{status:"running",confidence:"high",reason:"thinking_indicator",hasActivePrompt:!1,promptDetection:g}}}}let{promptPattern:_}=(0,i.bs)(e);return _.test(p)?{status:"ready",confidence:"high",reason:"input_prompt",hasActivePrompt:!1,promptDetection:g}:n&&Date.now()-n.getTime()>5e3?{status:"ready",confidence:"low",reason:"no_recent_output",hasActivePrompt:!1,promptDetection:g}:{status:"running",confidence:"low",reason:"default",hasActivePrompt:!1,promptDetection:g}}},69395:(t,e,n)=>{n.d(e,{r:()=>p});var i=n(55837),s=n(83513),o=n(33603),r=n(61942),a=n(2693),c=n(98134),h=n(50550);async function p(t,e,n,p,l){let u=i.g.getInstance(),d=s.tK,g=await Promise.all(d.map(async i=>{let s=u.getTool(i).getSessionName(t),d=e.has(s);d&&"claude"===i&&!(await (0,c.i_)(s)).healthy&&(d=!1);let g=!1,_=!1;if(d)try{let e="opencode"===i?a.uC:100,s=await (0,o.NA)(t,i,e),c=(0,h.Kk)(t,i),u=(0,h.gf)(c),d=u?new Date(u):void 0,m=(0,r._)(s,i,d);g="waiting"===m.status,_="running"===m.status,!m.hasActivePrompt&&p(n,t,{limit:10,cliToolId:i}).some(t=>"prompt"===t.messageType&&t.promptData?.status!=="answered")&&l(n,t,i)}catch{_=!0}return[i,{isRunning:d,isWaitingForResponse:g,isProcessing:_}]})),_={},m=!1,f=!1,E=!1;for(let[t,e]of g)_[t]=e,e.isRunning&&(m=!0),e.isWaitingForResponse&&(f=!0),e.isProcessing&&(E=!0);return{sessionStatusByCli:_,isSessionRunning:m,isWaitingForResponse:f,isProcessing:E}}}};