"use strict";(()=>{var e={};e.id=2238,e.ids=[2238],e.modules={85890:e=>{e.exports=require("better-sqlite3")},20399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},30517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},78893:e=>{e.exports=require("buffer")},61282:e=>{e.exports=require("child_process")},84770:e=>{e.exports=require("crypto")},17702:e=>{e.exports=require("events")},92048:e=>{e.exports=require("fs")},20629:e=>{e.exports=require("fs/promises")},32615:e=>{e.exports=require("http")},35240:e=>{e.exports=require("https")},98216:e=>{e.exports=require("net")},19801:e=>{e.exports=require("os")},55315:e=>{e.exports=require("path")},76162:e=>{e.exports=require("stream")},82452:e=>{e.exports=require("tls")},17360:e=>{e.exports=require("url")},21764:e=>{e.exports=require("util")},71568:e=>{e.exports=require("zlib")},38877:(e,r,s)=>{s.r(r),s.d(r,{originalPathname:()=>h,patchFetch:()=>w,requestAsyncStorage:()=>m,routeModule:()=>k,serverHooks:()=>f,staticGenerationAsyncStorage:()=>g});var t={};s.r(t),s.d(t,{POST:()=>q});var o=s(49303),i=s(88716),n=s(60670),u=s(87070),a=s(97425),p=s(75748),l=s(97213),d=s(10927),c=s(25079),x=s(59991);async function q(e,{params:r}){try{let e=(0,a.n)();if(!(0,p.gU)(e,r.id))return u.NextResponse.json({error:`Worktree '${r.id}' not found`},{status:404});let s=l.g.getInstance(),t=[],o=!1;for(let i of["claude","codex","gemini"]){let n=s.getTool(i);if(await n.isRunning(r.id)){o=!0;let s=n.getSessionName(r.id);await (0,d.AJ)(s)&&(t.push(s),console.log(`[kill-session] Killed ${i} session: ${s}`)),(0,x.FN)(r.id,i),(0,p.j8)(e,r.id,i)}}if(!o)return u.NextResponse.json({error:"No active sessions found for this worktree"},{status:404});return(0,p.HE)(e,r.id),(0,c.fM)(r.id,{type:"session_status_changed",worktreeId:r.id,isRunning:!1,messagesCleared:!0}),u.NextResponse.json({success:!0,message:`All sessions killed successfully: ${t.join(", ")}`,killedSessions:t},{status:200})}catch(e){return console.error("Error killing sessions:",e),u.NextResponse.json({error:"Failed to kill sessions"},{status:500})}}let k=new o.AppRouteRouteModule({definition:{kind:i.x.APP_ROUTE,page:"/api/worktrees/[id]/kill-session/route",pathname:"/api/worktrees/[id]/kill-session",filename:"route",bundlePath:"app/api/worktrees/[id]/kill-session/route"},resolvedPagePath:"/home/runner/work/CommandMate/CommandMate/src/app/api/worktrees/[id]/kill-session/route.ts",nextConfigOutput:"",userland:t}),{requestAsyncStorage:m,staticGenerationAsyncStorage:g,serverHooks:f}=k,h="/api/worktrees/[id]/kill-session/route";function w(){return(0,n.patchFetch)({serverHooks:f,staticGenerationAsyncStorage:g})}}};var r=require("../../../../../webpack-runtime.js");r.C(e);var s=e=>r(r.s=e),t=r.X(0,[8948,5972,3853,4893,7425,7213,1528,9723],()=>s(38877));module.exports=t})();