"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")},61282:e=>{e.exports=require("child_process")},84770:e=>{e.exports=require("crypto")},92048:e=>{e.exports=require("fs")},19801:e=>{e.exports=require("os")},55315:e=>{e.exports=require("path")},21764:e=>{e.exports=require("util")},2838:(e,r,t)=>{t.r(r),t.d(r,{originalPathname:()=>E,patchFetch:()=>h,requestAsyncStorage:()=>g,routeModule:()=>f,serverHooks:()=>w,staticGenerationAsyncStorage:()=>m});var n={};t.r(n),t.d(n,{POST:()=>x});var o=t(49303),i=t(88716),s=t(60670),a=t(87070),u=t(97425),p=t(75748),l=t(97213),c=t(43895);let d=(0,c.h)("interrupt");async function x(e,{params:r}){let{id:t}=await r,n=(0,c.Y)(),o=d.withContext({worktreeId:t,requestId:n});o.info("interrupt:request");try{let r=(0,u.n)();if(!(0,p.gU)(r,t))return o.warn("interrupt:worktree_not_found"),a.NextResponse.json({error:`Worktree '${t}' not found`},{status:404});let n={};try{n=await e.json()}catch{}let i=l.g.getInstance(),s=[];for(let e of n.cliToolId?[n.cliToolId]:["claude","codex","gemini"]){let r=i.getTool(e);if(await r.isRunning(t)){let n=r.getSessionName(t);o.debug("interrupt:sending",{cliToolId:e,sessionName:n}),await r.interrupt(t),s.push({cliToolId:e,sessionName:n}),o.info("interrupt:sent",{cliToolId:e,sessionName:n})}}if(0===s.length)return o.warn("interrupt:no_active_sessions"),a.NextResponse.json({error:"No active sessions found"},{status:404});return o.info("interrupt:success",{interruptedCount:s.length}),a.NextResponse.json({success:!0,message:`Interrupt sent to ${s.length} session(s)`,interrupted:s},{status:200})}catch(r){let e=r instanceof Error?r.message:String(r);return o.error("interrupt:error",{error:e}),a.NextResponse.json({error:"Failed to send interrupt"},{status:500})}}let f=new o.AppRouteRouteModule({definition:{kind:i.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:n}),{requestAsyncStorage:g,staticGenerationAsyncStorage:m,serverHooks:w}=f,E="/api/worktrees/[id]/interrupt/route";function h(){return(0,s.patchFetch)({serverHooks:w,staticGenerationAsyncStorage:m})}},43895:(e,r,t)=>{t.d(r,{Y:()=>u,h:()=>p});var n=t(93346);let o=[{pattern:/Bearer\s+[A-Za-z0-9\-._~+/]+=*/gi,replacement:"Bearer [REDACTED]"},{pattern:/(password|passwd|pwd)[=:]\s*\S+/gi,replacement:"$1=[REDACTED]"},{pattern:/(token|secret|api_key|apikey|auth)[=:]\s*\S+/gi,replacement:"$1=[REDACTED]"},{pattern:/CM_AUTH_TOKEN=\S+/gi,replacement:"CM_AUTH_TOKEN=[REDACTED]"},{pattern:/MCBD_AUTH_TOKEN=\S+/gi,replacement:"MCBD_AUTH_TOKEN=[REDACTED]"},{pattern:/Authorization:\s*\S+/gi,replacement:"Authorization: [REDACTED]"},{pattern:/-----BEGIN\s+\w+\s+PRIVATE\s+KEY-----[\s\S]*?-----END\s+\w+\s+PRIVATE\s+KEY-----/g,replacement:"[SSH_KEY_REDACTED]"}],i=/password|secret|token|key|auth/i,s={debug:0,info:1,warn:2,error:3};function a(e,r,t,a,u){let p=(0,n.LI)().level;if(s[e]<s[p])return;let l=a?function e(r){if("string"==typeof r){let e=r;for(let{pattern:r,replacement:t}of o)e=e.replace(r,t);return e}if("object"==typeof r&&null!==r){if(Array.isArray(r))return r.map(e);let t={};for(let[n,o]of Object.entries(r))i.test(n)?t[n]="[REDACTED]":t[n]=e(o);return t}return r}(a):void 0,c=function(e){if("json"===(0,n.LI)().format)return JSON.stringify(e);let{timestamp:r,level:t,module:o,action:i,data:s,worktreeId:a,cliToolId:u,requestId:p}=e,l=[a,u].filter(Boolean),c=l.length>0?` [${l.join(":")}]`:"",d=p?` (${p.slice(0,8)})`:"",x=s?` ${JSON.stringify(s)}`:"";return`[${r}] [${t.toUpperCase()}] [${o}]${c}${d} ${i}${x}`}({level:e,module:r,action:t,timestamp:new Date().toISOString(),...u,...l&&{data:l}});switch(e){case"error":console.error(c);break;case"warn":console.warn(c);break;default:console.log(c)}}function u(){return"undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let r=16*Math.random()|0;return("x"===e?r:3&r|8).toString(16)})}function p(e){let r=t=>({debug:(r,n)=>a("debug",e,r,n,t),info:(r,n)=>a("info",e,r,n,t),warn:(r,n)=>a("warn",e,r,n,t),error:(r,n)=>a("error",e,r,n,t),withContext:e=>r({...t,...e})});return r()}}};var r=require("../../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),n=r.X(0,[8948,5972,7425,7213],()=>t(2838));module.exports=n})();