"use strict";(()=>{var e={};e.id=6366,e.ids=[6366],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")},45762:(e,r,t)=>{t.r(r),t.d(r,{originalPathname:()=>h,patchFetch:()=>q,requestAsyncStorage:()=>x,routeModule:()=>m,serverHooks:()=>g,staticGenerationAsyncStorage:()=>w});var s={};t.r(s),t.d(s,{POST:()=>l});var o=t(49303),n=t(88716),i=t(60670),a=t(87070),p=t(97425),u=t(75748),d=t(10927),c=t(97213);async function l(e,{params:r}){try{let{answer:t,cliTool:s}=await e.json();if(!t)return a.NextResponse.json({error:"answer is required"},{status:400});let o=(0,p.n)(),n=(0,u.gU)(o,r.id);if(!n)return a.NextResponse.json({error:`Worktree '${r.id}' not found`},{status:404});let i=s||n.cliToolId||"claude",l=c.g.getInstance().getTool(i);if(!await l.isRunning(r.id))return a.NextResponse.json({error:`${l.name} session is not running`},{status:400});let m=l.getSessionName(r.id);try{await (0,d.Is)(m,t,!1),await new Promise(e=>setTimeout(e,100)),await (0,d.Is)(m,"",!0)}catch(r){let e=r instanceof Error?r.message:"Unknown error";return a.NextResponse.json({error:`Failed to send answer to tmux: ${e}`},{status:500})}return a.NextResponse.json({success:!0,answer:t})}catch(r){console.error("Failed to respond to prompt:",r);let e=r instanceof Error?r.message:"Internal server error";return a.NextResponse.json({error:e},{status:500})}}let m=new o.AppRouteRouteModule({definition:{kind:n.x.APP_ROUTE,page:"/api/worktrees/[id]/prompt-response/route",pathname:"/api/worktrees/[id]/prompt-response",filename:"route",bundlePath:"app/api/worktrees/[id]/prompt-response/route"},resolvedPagePath:"/home/runner/work/CommandMate/CommandMate/src/app/api/worktrees/[id]/prompt-response/route.ts",nextConfigOutput:"",userland:s}),{requestAsyncStorage:x,staticGenerationAsyncStorage:w,serverHooks:g}=m,h="/api/worktrees/[id]/prompt-response/route";function q(){return(0,i.patchFetch)({serverHooks:g,staticGenerationAsyncStorage:w})}}};var r=require("../../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[8948,5972,7425,7213],()=>t(45762));module.exports=s})();