"use strict";(()=>{var e={};e.id=9495,e.ids=[9495],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")},2838:(e,r,t)=>{t.r(r),t.d(r,{originalPathname:()=>w,patchFetch:()=>v,requestAsyncStorage:()=>f,routeModule:()=>g,serverHooks:()=>m,staticGenerationAsyncStorage:()=>h});var s={};t.r(s),t.d(s,{POST:()=>q});var o=t(49303),n=t(88716),i=t(60670),u=t(87070),p=t(94925),a=t(30721),d=t(55837),l=t(43895),c=t(83513);let x=(0,l.h)("interrupt");async function q(e,{params:r}){let{id:t}=await r,s=(0,l.Y)(),o=x.withContext({worktreeId:t,requestId:s});o.info("interrupt:request");try{let r=(0,p.getDbInstance)();if(!(0,a.gU)(r,t))return o.warn("interrupt:worktree_not_found"),u.NextResponse.json({error:`Worktree '${t}' not found`},{status:404});let s={};try{s=await e.json()}catch{}let n=d.g.getInstance(),i=[];for(let e of s.cliToolId?[s.cliToolId]:c.tK){let r=n.getTool(e);if(await r.isRunning(t)){let s=r.getSessionName(t);o.debug("interrupt:sending",{cliToolId:e,sessionName:s}),await r.interrupt(t),i.push({cliToolId:e,sessionName:s}),o.info("interrupt:sent",{cliToolId:e,sessionName:s})}}if(0===i.length)return o.warn("interrupt:no_active_sessions"),u.NextResponse.json({error:"No active sessions found"},{status:404});return o.info("interrupt:success",{interruptedCount:i.length}),u.NextResponse.json({success:!0,message:`Interrupt sent to ${i.length} session(s)`,interrupted:i},{status:200})}catch(r){let e=r instanceof Error?r.message:String(r);return o.error("interrupt:error",{error:e}),u.NextResponse.json({error:"Failed to send interrupt"},{status:500})}}let g=new o.AppRouteRouteModule({definition:{kind:n.x.APP_ROUTE,page:"/api/worktrees/[id]/interrupt/route",pathname:"/api/worktrees/[id]/interrupt",filename:"route",bundlePath:"app/api/worktrees/[id]/interrupt/route"},resolvedPagePath:"/home/runner/work/CommandMate/CommandMate/src/app/api/worktrees/[id]/interrupt/route.ts",nextConfigOutput:"",userland:s}),{requestAsyncStorage:f,staticGenerationAsyncStorage:h,serverHooks:m}=g,w="/api/worktrees/[id]/interrupt/route";function v(){return(0,i.patchFetch)({serverHooks:m,staticGenerationAsyncStorage:h})}}};var r=require("../../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[8948,5972,3853,4893,3895,4925,721,9228],()=>t(2838));module.exports=s})();