commandmate 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-build-manifest.json +9 -9
  3. package/.next/app-path-routes-manifest.json +1 -1
  4. package/.next/build-manifest.json +2 -2
  5. package/.next/cache/.tsbuildinfo +1 -1
  6. package/.next/cache/config.json +3 -3
  7. package/.next/cache/webpack/client-production/0.pack +0 -0
  8. package/.next/cache/webpack/client-production/1.pack +0 -0
  9. package/.next/cache/webpack/client-production/2.pack +0 -0
  10. package/.next/cache/webpack/client-production/index.pack +0 -0
  11. package/.next/cache/webpack/client-production/index.pack.old +0 -0
  12. package/.next/cache/webpack/edge-server-production/0.pack +0 -0
  13. package/.next/cache/webpack/edge-server-production/index.pack +0 -0
  14. package/.next/cache/webpack/server-production/0.pack +0 -0
  15. package/.next/cache/webpack/server-production/index.pack +0 -0
  16. package/.next/next-server.js.nft.json +1 -1
  17. package/.next/prerender-manifest.json +1 -1
  18. package/.next/required-server-files.json +1 -1
  19. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  20. package/.next/server/app/api/app/update-check/route.js +1 -1
  21. package/.next/server/app/login/page_client-reference-manifest.js +1 -1
  22. package/.next/server/app/page_client-reference-manifest.js +1 -1
  23. package/.next/server/app/worktrees/[id]/files/[...path]/page_client-reference-manifest.js +1 -1
  24. package/.next/server/app/worktrees/[id]/page.js +1 -1
  25. package/.next/server/app/worktrees/[id]/page_client-reference-manifest.js +1 -1
  26. package/.next/server/app/worktrees/[id]/terminal/page_client-reference-manifest.js +1 -1
  27. package/.next/server/app-paths-manifest.json +10 -10
  28. package/.next/server/chunks/7536.js +1 -1
  29. package/.next/server/chunks/7566.js +2 -2
  30. package/.next/server/functions-config-manifest.json +1 -1
  31. package/.next/server/middleware-manifest.json +5 -5
  32. package/.next/server/pages/500.html +1 -1
  33. package/.next/server/server-reference-manifest.json +1 -1
  34. package/.next/static/chunks/app/worktrees/[id]/{page-9418e49bdc1de02c.js → page-a556551ce5c69dec.js} +1 -1
  35. package/.next/trace +5 -5
  36. package/dist/server/src/lib/claude-session.js +31 -6
  37. package/dist/server/src/lib/cli-patterns.js +1 -1
  38. package/dist/server/src/lib/response-poller.js +3 -2
  39. package/package.json +1 -1
  40. /package/.next/static/{clTo9tuAoPMLcGRuVENfO → hmAjbCPjxX_C0Os7rphI1}/_buildManifest.js +0 -0
  41. /package/.next/static/{clTo9tuAoPMLcGRuVENfO → hmAjbCPjxX_C0Os7rphI1}/_ssgManifest.js +0 -0
@@ -6,4 +6,4 @@
6
6
  flex items-center gap-2 px-4 py-2 rounded-lg border-2 border-dashed
7
7
  transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500
8
8
  ${l?"border-gray-200 text-gray-400 cursor-not-allowed opacity-50":"border-gray-300 text-gray-600 hover:border-blue-400 hover:text-blue-600 hover:bg-blue-50"}
9
- `,children:[s?a.jsx("span",{"data-testid":"loading-indicator",className:"w-5 h-5 border-2 border-gray-300 border-t-blue-500 rounded-full animate-spin"}):a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),a.jsx("span",{className:"text-sm font-medium",children:"Add Memo"})]}),(0,a.jsxs)("span",{className:"text-xs text-gray-500",children:[Math.max(0,t-e)," remaining"]})]})}),tD=(0,l.memo)(function({worktreeId:e,className:t=""}){let[r,s]=(0,l.useState)([]),[n,i]=(0,l.useState)(!0),[o,c]=(0,l.useState)(!1),[d,u]=(0,l.useState)(null),[m,p]=(0,l.useState)(null),h=(0,l.useCallback)(async()=>{i(!0),u(null);try{let t=await tO.nE.getAll(e);s(t.sort((e,t)=>e.position-t.position))}catch(e){u((0,tO.zG)(e))}finally{i(!1)}},[e]);(0,l.useEffect)(()=>{h()},[h]);let f=(0,l.useCallback)(async()=>{c(!0),p(null);try{let t=await tO.nE.create(e,{title:"Memo",content:""});s(e=>[...e,t])}catch(e){p((0,tO.zG)(e))}finally{c(!1)}},[e]),x=(0,l.useCallback)(async(t,r)=>{await tO.nE.update(e,t,r),s(e=>e.map(e=>e.id===t?{...e,...r}:e))},[e]),g=(0,l.useCallback)(async t=>{try{await tO.nE.delete(e,t),s(e=>e.filter(e=>e.id!==t))}catch(e){console.error("Failed to delete memo:",e)}},[e]),y=(0,l.useCallback)(()=>{h()},[h]);return n?a.jsx("div",{"data-testid":"memo-pane",className:`flex flex-col items-center justify-center h-full p-4 ${t}`,children:(0,a.jsxs)("div",{"data-testid":"memo-loading",className:"flex flex-col items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 border-4 border-gray-200 border-t-blue-500 rounded-full animate-spin"}),a.jsx("span",{className:"text-sm text-gray-500",children:"Loading memos..."})]})}):d?a.jsx("div",{"data-testid":"memo-pane",className:`flex flex-col items-center justify-center h-full p-4 ${t}`,children:(0,a.jsxs)("div",{className:"flex flex-col items-center gap-3 text-center",children:[a.jsx("svg",{className:"w-12 h-12 text-red-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),a.jsx("span",{className:"text-sm text-red-600",children:d}),a.jsx("button",{type:"button",onClick:y,"aria-label":"Retry",className:"px-4 py-2 text-sm font-medium text-white bg-blue-500 rounded-lg hover:bg-blue-600 transition-colors",children:"Retry"})]})}):(0,a.jsxs)("div",{"data-testid":"memo-pane",className:`flex flex-col gap-4 p-4 overflow-y-auto ${t}`,children:[0===r.length&&!m&&(0,a.jsxs)("div",{className:"text-center py-8 text-gray-500",children:[a.jsx("p",{children:"No memos yet."}),a.jsx("p",{className:"text-sm",children:"Click the button below to add one."})]}),r.map(e=>a.jsx(tL,{memo:e,onUpdate:x,onDelete:g},e.id)),m&&a.jsx("div",{className:"text-center py-2 text-sm text-red-500",children:m}),a.jsx(tI,{currentCount:r.length,maxCount:5,onAdd:f,isLoading:o,className:"mt-2"})]})});var t$=r(11867);function tF(){let[e,t]=(0,l.useState)(null),[r,a]=(0,l.useState)(!0),[s,n]=(0,l.useState)(null);return{data:e,loading:r,error:s}}function tz({hasUpdate:e,latestVersion:t,releaseUrl:r,updateCommand:s,installType:n}){let l=(0,x.T)("worktree");return e?(0,a.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3 mt-2",role:"status","aria-label":l("update.available"),"data-testid":"update-notification-banner",children:[a.jsx("p",{className:"text-sm font-medium text-blue-800 mb-1",children:l("update.available")}),t&&a.jsx("p",{className:"text-sm text-blue-700 mb-2",children:l("update.latestVersion",{version:t})}),s&&"global"===n&&(0,a.jsxs)("div",{className:"mb-2",children:[a.jsx("p",{className:"text-xs text-blue-600 mb-1",children:l("update.updateCommand")}),a.jsx("code",{className:"block bg-blue-100 rounded px-2 py-1 text-xs text-blue-900 font-mono",children:s})]}),r&&(0,a.jsxs)("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center text-sm text-blue-600 hover:text-blue-800 underline",children:[l("update.viewRelease"),a.jsx("span",{className:"ml-1","aria-hidden":"true",children:"→"})]}),a.jsx("p",{className:"text-xs text-blue-500 mt-2",children:l("update.dataPreserved")})]}):null}function tH({version:e,className:t}){let r=(0,x.T)("worktree"),{data:s,loading:n}=tF(),i=(0,l.useMemo)(()=>s&&s.hasUpdate?{hasUpdate:s.hasUpdate,latestVersion:s.latestVersion,releaseUrl:s.releaseUrl,updateCommand:s.updateCommand,installType:s.installType}:null,[s]);return(0,a.jsxs)("div",{className:t,"data-testid":"version-section",children:[a.jsx("h2",{className:"text-sm font-medium text-gray-500 mb-1",children:r("update.version")}),a.jsx("p",{className:"text-sm text-gray-700",children:e}),n&&a.jsx("p",{className:"text-xs text-gray-400 mt-1","data-testid":"version-loading",children:"..."}),i&&a.jsx(tz,{...i})]})}let tW="https://github.com/Kewton/CommandMate",tB=`${tW}/issues`,tU=`${tW}/issues/new`,tG=`${tU}?template=bug_report.md`,tV=`${tU}?template=feature_request.md`,tq=`${tU}?template=question.md`;function tY({className:e}){let t=(0,x.T)("worktree"),r=[{href:tG,label:t("feedback.bugReport")},{href:tV,label:t("feedback.featureRequest")},{href:tq,label:t("feedback.question")},{href:tB,label:t("feedback.viewIssues")}];return(0,a.jsxs)("div",{className:e,"data-testid":"feedback-section",children:[a.jsx("h2",{className:"text-sm font-medium text-gray-500 mb-2",children:t("feedback.title")}),a.jsx("div",{className:"flex flex-col gap-1",children:r.map(({href:e,label:t})=>(0,a.jsxs)("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center text-sm text-blue-600 hover:text-blue-800 underline",children:[t,a.jsx("span",{className:"ml-1","aria-hidden":"true",children:"→"})]},e))})]})}var tZ=r(28676);r(63817);let tK=[36e5,108e5,288e5],tX={36e5:"autoYes.durations.1h",108e5:"autoYes.durations.3h",288e5:"autoYes.durations.8h"};function tJ({isOpen:e,onConfirm:t,onCancel:r,cliToolName:s}){let n=(0,x.T)("autoYes"),i=(0,x.T)("common"),[o,c]=(0,l.useState)(36e5),[d,u]=(0,l.useState)(""),[m,p]=(0,l.useState)(null),[h,f]=(0,l.useState)(!1),g=(0,l.useRef)(null),y=e=>n(tX[e].replace("autoYes.",""));return a.jsx(tZ.u,{isOpen:e,onClose:r,title:s?n("enableTitleWithTool",{toolName:s}):n("enableTitle"),size:"sm",showCloseButton:!0,children:(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"text-sm text-gray-700",children:[a.jsx("p",{className:"font-medium mb-2",children:n("featureDescription")}),(0,a.jsxs)("ul",{className:"list-disc list-inside space-y-1",children:[a.jsx("li",{children:n("yesNoAutoResponse")}),a.jsx("li",{children:n("multipleChoiceAutoSelect")})]}),a.jsx("p",{className:"mt-1",children:n("autoDisableAfter",{duration:y(o)})}),s&&a.jsx("p",{className:"mt-2 text-gray-500",children:n("appliesOnlyToCurrent",{toolName:s})})]}),(0,a.jsxs)("div",{className:"text-sm text-gray-700",children:[a.jsx("p",{className:"font-medium mb-2",children:n("duration")}),a.jsx("div",{className:"flex gap-2",children:tK.map(e=>a.jsx("button",{type:"button",onClick:()=>c(e),className:`flex-1 py-2 px-3 text-sm font-medium rounded-md border-2 transition-colors ${o===e?"border-blue-600 bg-blue-50 text-blue-700":"border-gray-300 bg-white text-gray-700 hover:border-gray-400"}`,style:{minHeight:"44px"},children:y(e)},e))})]}),(0,a.jsxs)("div",{className:"text-sm text-gray-700",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[a.jsx("label",{htmlFor:"stop-pattern-input",className:"font-medium",children:n("stopPatternLabel")}),(0,a.jsxs)("div",{className:"relative",ref:g,children:[a.jsx("button",{type:"button",onClick:()=>f(!h),className:"inline-flex items-center justify-center w-4 h-4 rounded-full bg-gray-300 text-gray-600 text-[10px] font-bold hover:bg-gray-400 focus:outline-none","aria-label":n("regexTipsLabel"),"data-testid":"regex-tips-button",children:"?"}),h&&(0,a.jsxs)("div",{className:"absolute left-0 top-6 z-50 w-72 rounded-md border border-gray-200 bg-white p-3 shadow-lg text-xs text-gray-700","data-testid":"regex-tips-tooltip",children:[a.jsx("p",{className:"font-medium mb-1.5",children:n("regexTipsTitle")}),(0,a.jsxs)("ul",{className:"space-y-1",children:[(0,a.jsxs)("li",{children:[a.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"\\bcat\\b"})," ",n("regexTipWordBoundary")]}),(0,a.jsxs)("li",{children:[a.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"error|fatal"})," ",n("regexTipOr")]}),(0,a.jsxs)("li",{children:[a.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"(?i)error"})," ",n("regexTipCaseNote")]})]})]})]})]}),a.jsx("p",{className:"text-xs text-gray-500 mb-2",children:n("stopPatternDescription")}),a.jsx("input",{id:"stop-pattern-input",type:"text",value:d,onChange:e=>u(e.target.value),placeholder:n("stopPatternPlaceholder"),className:`w-full px-3 py-2 border rounded-md text-sm font-mono ${m?"border-red-500 focus:ring-red-500 focus:border-red-500":"border-gray-300 focus:ring-blue-500 focus:border-blue-500"} focus:outline-none focus:ring-1`,"data-testid":"stop-pattern-input"}),m&&a.jsx("p",{className:"mt-1 text-xs text-red-600","data-testid":"stop-pattern-error",children:m})]}),(0,a.jsxs)("div",{className:"text-sm text-gray-700",children:[a.jsx("p",{className:"font-medium mb-2",children:n("aboutRisks")}),a.jsx("p",{children:n("riskWarning")})]}),a.jsx("div",{className:"bg-yellow-50 border-l-4 border-yellow-400 p-3",children:(0,a.jsxs)("p",{className:"text-sm text-yellow-800",children:[a.jsx("span",{className:"font-medium",children:n("disclaimer")}),n("disclaimerText")]})}),(0,a.jsxs)("div",{className:"flex justify-end gap-3 pt-2",children:[a.jsx("button",{type:"button",onClick:r,className:"px-4 py-2 text-sm font-medium rounded-md bg-gray-200 hover:bg-gray-300 text-gray-700",children:i("cancel")}),a.jsx("button",{type:"button",onClick:()=>{t(o,d.trim()||void 0)},disabled:!!m,className:`px-4 py-2 text-sm font-medium rounded-md text-white ${m?"bg-gray-400 cursor-not-allowed":"bg-yellow-600 hover:bg-yellow-700"}`,"data-testid":"confirm-button",children:n("agreeAndEnable")})]})]})})}function tQ(e){return e?e.charAt(0).toUpperCase()+e.slice(1):""}let t0=(0,l.memo)(function({enabled:e,expiresAt:t,onToggle:r,lastAutoResponse:s,cliToolName:n,inline:i=!1}){let[o,c]=(0,l.useState)(""),[d,u]=(0,l.useState)(null),[m,p]=(0,l.useState)(!1),[h,f]=(0,l.useState)(!1);(0,l.useEffect)(()=>{if(!e||!t){c("");return}let r=()=>{c(function(e){let t=Math.max(0,e-Date.now()),r=Math.floor(t/36e5),a=Math.floor(t%36e5/6e4),s=Math.floor(t%6e4/1e3);return r>0?`${r}:${a.toString().padStart(2,"0")}:${s.toString().padStart(2,"0")}`:`${a.toString().padStart(2,"0")}:${s.toString().padStart(2,"0")}`}(t))};r();let a=setInterval(r,1e3);return()=>clearInterval(a)},[e,t]),(0,l.useEffect)(()=>{if(!s)return;u(`Auto responded: "${s}"`);let e=setTimeout(()=>u(null),2e3);return()=>clearTimeout(e)},[s]);let x=(0,l.useCallback)(()=>{e?(p(!0),r({enabled:!1}).finally(()=>p(!1))):f(!0)},[e,r]),g=(0,l.useCallback)((e,t)=>{f(!1),p(!0),r({enabled:!0,duration:e,stopPattern:t}).finally(()=>p(!1))},[r]),y=(0,l.useCallback)(()=>{f(!1)},[]);return(0,a.jsxs)("div",{className:i?"flex items-center gap-2":"flex items-center gap-3 px-4 py-2 bg-gray-50 border-b border-gray-200",children:[a.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":"Auto Yes mode",disabled:m,onClick:x,className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 ${e?"bg-blue-600":"bg-gray-300"} ${m?"opacity-50":""}`,children:a.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${e?"translate-x-6":"translate-x-1"}`})}),a.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Auto Yes"}),e&&n&&(0,a.jsxs)("span",{className:"text-xs text-blue-600 font-medium","aria-label":"Auto Yes target",children:["(",tQ(n),")"]}),e&&o&&a.jsx("span",{className:"text-sm text-gray-500","aria-label":"Time remaining",children:o}),d&&a.jsx("span",{className:"text-sm text-green-600 animate-pulse",children:d}),a.jsx(tJ,{isOpen:h,onConfirm:g,onCancel:y,cliToolName:tQ(n)})]})}),t1=(0,l.memo)(function({isBranchMismatch:e,currentBranch:t,initialBranch:r}){let[s,n]=(0,l.useState)(!1);return((0,l.useEffect)(()=>{n(!1)},[t]),!e||s||null===r)?null:(0,a.jsxs)("div",{"data-testid":"branch-mismatch-alert",role:"alert",className:"flex items-center gap-3 px-4 py-2 bg-amber-50 border border-amber-200 text-amber-800 rounded-lg",children:[a.jsx(tl,{className:"w-5 h-5 text-amber-500 flex-shrink-0"}),a.jsx("div",{className:"flex-1 min-w-0",children:(0,a.jsxs)("span",{className:"text-sm",children:["Branch changed from"," ",a.jsx("span",{className:"font-medium",children:r})," ","to"," ",a.jsx("span",{className:"font-medium",children:t})]})}),a.jsx("button",{type:"button",onClick:()=>n(!0),className:"p-1 rounded hover:bg-amber-100 transition-colors","aria-label":"Dismiss alert",children:a.jsx(tp.Z,{className:"w-4 h-4"})})]})});var t2=r(18421);let t4=(0,I.Z)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),t5=(0,I.Z)("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]),t3=(0,I.Z)("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),t6=(0,l.memo)(function({isOpen:e,onClose:t,onConfirm:r,worktreeId:s,sourcePath:n,sourceType:i}){let o=(0,x.T)("worktree"),c=(0,x.T)("common"),[d,u]=(0,l.useState)(""),[m,p]=(0,l.useState)(new Set([""])),[h,f]=(0,l.useState)([]),[g,y]=(0,l.useState)(!1),[b,v]=(0,l.useState)(new Set),w=n.includes("/")?n.substring(0,n.lastIndexOf("/")):"";(0,l.useEffect)(()=>{e&&(u(w),p(new Set([""])),f([]),j())},[e,s]);let j=(0,l.useCallback)(async()=>{y(!0);try{let e=await fetch(`/api/worktrees/${s}/tree`);if(!e.ok)return;let t=(await e.json()).items.filter(e=>"directory"===e.type).map(e=>({name:e.name,path:e.name,loaded:!1}));f(t)}catch{}finally{y(!1)}},[s]),N=(0,l.useCallback)(async e=>{v(t=>new Set(t).add(e));try{let t=await fetch(`/api/worktrees/${s}/tree/${e}`);if(!t.ok)return;let r=(await t.json()).items.filter(e=>"directory"===e.type).map(t=>({name:t.name,path:`${e}/${t.name}`,loaded:!1}));f(t=>(function e(t,r,a){return t.map(t=>t.path===r?{...t,children:a,loaded:!0}:t.children?{...t,children:e(t.children,r,a)}:t)})(t,e,r))}catch{}finally{v(t=>{let r=new Set(t);return r.delete(e),r})}},[s]),k=(0,l.useCallback)(async e=>{p(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r});let t=function e(t,r){for(let a of t){if(a.path===r)return a;if(a.children){let t=e(a.children,r);if(t)return t}}return null}(h,e);t&&!t.loaded&&await N(e)},[h,N]),C=(0,l.useCallback)(e=>!(e===w||"directory"===i&&(e===n||e.startsWith(n+"/"))),[w,n,i]),S=(e,t=0)=>{let r=m.has(e.path),s=d===e.path,n=b.has(e.path),l=C(e.path);return(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:`flex items-center gap-1 py-1.5 px-2 cursor-pointer rounded text-sm transition-colors ${s?"bg-blue-100 text-blue-800":"hover:bg-gray-100 text-gray-700"} ${l?"":"opacity-40 cursor-not-allowed"}`,style:{paddingLeft:`${.5+1.25*t}rem`},onClick:()=>{l&&u(e.path)},children:[a.jsx("button",{className:"w-4 h-4 flex items-center justify-center flex-shrink-0",onClick:t=>{t.stopPropagation(),k(e.path)},children:n?a.jsx(tg,{className:"w-3 h-3 animate-spin text-gray-400"}):a.jsx(t4,{className:`w-3 h-3 text-gray-400 transition-transform ${r?"rotate-90":""}`})}),r?a.jsx(t5,{className:"w-4 h-4 text-yellow-500 flex-shrink-0"}):a.jsx(t3,{className:"w-4 h-4 text-yellow-500 flex-shrink-0"}),a.jsx("span",{className:"truncate",children:e.name})]}),r&&e.children&&a.jsx("div",{children:e.children.map(e=>S(e,t+1))})]},e.path)},T=C(d);return a.jsx(tZ.u,{isOpen:e,onClose:t,title:o("fileTree.moveDialogTitle"),size:"md",children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"text-sm text-gray-600",children:[o("fileTree.moveTo"),": ",a.jsx("span",{className:"font-mono text-gray-800",children:n})]}),(0,a.jsxs)("div",{className:"border border-gray-200 rounded-lg max-h-64 overflow-y-auto p-2",children:[(0,a.jsxs)("div",{className:`flex items-center gap-1 py-1.5 px-2 cursor-pointer rounded text-sm transition-colors ${""===d?"bg-blue-100 text-blue-800":"hover:bg-gray-100 text-gray-700"} ${C("")?"":"opacity-40 cursor-not-allowed"}`,onClick:()=>{C("")&&u("")},children:[a.jsx("span",{className:"w-4 h-4"}),a.jsx(t3,{className:"w-4 h-4 text-yellow-500 flex-shrink-0"}),a.jsx("span",{children:o("fileTree.rootDirectory")})]}),g?a.jsx("div",{className:"flex items-center justify-center py-4",children:a.jsx(tg,{className:"w-5 h-5 animate-spin text-gray-400"})}):h.map(e=>S(e,1))]}),(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{onClick:t,className:"px-4 py-2 text-sm text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 transition-colors",children:c("cancel")}),a.jsx("button",{onClick:()=>r(d),disabled:!T,className:"px-4 py-2 text-sm text-white bg-blue-600 rounded-md hover:bg-blue-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:o("fileTree.moveConfirm")})]})]})})});function t8(e){return e?e.split("/").map(encodeURIComponent).join("/"):""}function t7(e){return e.charAt(0).toUpperCase()+e.slice(1)}function t9(e,t,r,a){let[s,n]=(0,l.useState)(!1),[i,o]=(0,l.useState)(""),[c,d]=(0,l.useState)(!1),u=(0,l.useCallback)(async()=>{if(e){d(!0);try{let r=await tO.Iv.updateDescription(e.id,i);t(r),n(!1)}catch(e){console.error("Failed to save description:",e)}finally{d(!1)}}},[e,i,t]),m=(0,l.useCallback)(()=>{o(e?.description||""),n(!1)},[e]);return{isEditing:s,text:i,setText:o,isSaving:c,handleSave:u,handleCancel:m,startEditing:(0,l.useCallback)(()=>{n(!0)},[])}}let re=(0,l.memo)(function({worktreeId:e,worktree:t,cardClassName:r,descriptionEditor:s,showLogs:n,onToggleLogs:l}){let{isEditing:i,text:o,setText:c,isSaving:d,handleSave:u,handleCancel:m,startEditing:p}=s;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:r,children:[a.jsx("h2",{className:"text-sm font-medium text-gray-500 mb-1",children:"Worktree"}),a.jsx("p",{className:"text-lg font-semibold text-gray-900",children:t.name})]}),(0,a.jsxs)("div",{className:r,children:[a.jsx("h2",{className:"text-sm font-medium text-gray-500 mb-1",children:"Repository"}),a.jsx("p",{className:"text-base text-gray-900",children:t.repositoryName}),a.jsx("p",{className:"text-xs text-gray-500 mt-1 break-all",children:t.repositoryPath})]}),(0,a.jsxs)("div",{className:r,children:[a.jsx("h2",{className:"text-sm font-medium text-gray-500 mb-1",children:"Path"}),a.jsx("p",{className:"text-sm text-gray-700 break-all font-mono",children:t.path})]}),t.status&&(0,a.jsxs)("div",{className:r,children:[a.jsx("h2",{className:"text-sm font-medium text-gray-500 mb-1",children:"Status"}),a.jsx("span",{className:`inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${"done"===t.status?"bg-green-100 text-green-800":"doing"===t.status?"bg-blue-100 text-blue-800":"bg-gray-100 text-gray-800"}`,children:t.status.toUpperCase()})]}),(0,a.jsxs)("div",{className:r,children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("h2",{className:"text-sm font-medium text-gray-500",children:"Description"}),!i&&a.jsx("button",{type:"button",onClick:p,className:"text-sm text-blue-600 hover:text-blue-800",children:"Edit"})]}),i?(0,a.jsxs)("div",{className:"space-y-3",children:[a.jsx("textarea",{value:o,onChange:e=>c(e.target.value),placeholder:"Add notes about this branch...",className:"w-full min-h-[150px] p-3 border border-gray-300 rounded-lg resize-y focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",autoFocus:!0}),(0,a.jsxs)("div",{className:"flex gap-2",children:[a.jsx("button",{type:"button",onClick:u,disabled:d,className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 text-sm font-medium",children:d?"Saving...":"Save"}),a.jsx("button",{type:"button",onClick:m,disabled:d,className:"px-4 py-2 bg-gray-200 text-gray-700 rounded-lg hover:bg-gray-300 disabled:opacity-50 text-sm font-medium",children:"Cancel"})]})]}):a.jsx("div",{className:"min-h-[50px]",children:t.description?a.jsx("p",{className:"text-sm text-gray-700 whitespace-pre-wrap",children:t.description}):a.jsx("p",{className:"text-sm text-gray-400 italic",children:"No description added yet"})})]}),t.link&&(0,a.jsxs)("div",{className:r,children:[a.jsx("h2",{className:"text-sm font-medium text-gray-500 mb-1",children:"Link"}),a.jsx("a",{href:t.link,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-blue-600 hover:underline break-all",children:t.link})]}),t.updatedAt&&(0,a.jsxs)("div",{className:r,children:[a.jsx("h2",{className:"text-sm font-medium text-gray-500 mb-1",children:"Last Updated"}),a.jsx("p",{className:"text-sm text-gray-700",children:new Date(t.updatedAt).toLocaleString()})]}),a.jsx(tH,{version:"v0.3.0",className:r}),a.jsx(tY,{className:r}),(0,a.jsxs)("div",{className:r,children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("h2",{className:"text-sm font-medium text-gray-500",children:"Logs"}),a.jsx("button",{type:"button",onClick:l,className:"text-sm text-blue-600 hover:text-blue-800",children:n?"Hide":"Show"})]}),n&&a.jsx(t$.n,{worktreeId:e})]})]})}),rt=(0,l.memo)(function({worktreeName:e,repositoryName:t,description:r,status:s,gitStatus:n,onBackClick:l,onInfoClick:i,onMenuClick:o,hasUpdate:c}){let d=el.Ie[s],u=r?(0,ei.aS)(r,50):null;return(0,a.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 bg-white border-b border-gray-200",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[a.jsx("button",{type:"button",onClick:o,className:"p-2 -ml-2 rounded-lg text-gray-600 hover:text-gray-900 hover:bg-gray-100 transition-colors","aria-label":"Toggle sidebar",children:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})}),a.jsx("div",{className:"w-px h-6 bg-gray-300","aria-hidden":"true"}),(0,a.jsxs)("button",{type:"button",onClick:l,className:"flex items-center gap-1 text-gray-600 hover:text-gray-900 transition-colors","aria-label":"Go back to worktree list",children:[a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})}),a.jsx("span",{className:"text-sm font-medium",children:"Back"})]}),a.jsx("div",{className:"w-px h-6 bg-gray-300","aria-hidden":"true"}),"spinner"===d.type?a.jsx("span",{"data-testid":"desktop-status-indicator",title:d.label,"aria-label":d.label,className:`w-3 h-3 rounded-full flex-shrink-0 border-2 border-t-transparent animate-spin ${d.className}`}):a.jsx("span",{"data-testid":"desktop-status-indicator",title:d.label,"aria-label":d.label,className:`w-3 h-3 rounded-full flex-shrink-0 ${d.className}`}),(0,a.jsxs)("div",{className:"flex flex-col min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[a.jsx("h1",{className:"text-lg font-semibold text-gray-900 truncate max-w-[200px] leading-tight",children:e}),u&&a.jsx("span",{className:"text-sm text-gray-500 truncate max-w-md",title:r,children:u})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[a.jsx("span",{className:"truncate max-w-[200px]",children:t}),n&&"(unknown)"!==n.currentBranch&&(0,a.jsxs)(a.Fragment,{children:[a.jsx("span",{className:"text-gray-300",children:"/"}),a.jsx("span",{className:"truncate max-w-[150px] font-mono",title:n.currentBranch,"data-testid":"desktop-branch-name",children:(0,ei.aS)(n.currentBranch,30)}),n.isDirty&&a.jsx("span",{className:"text-amber-500",title:"Uncommitted changes",children:"*"})]})]})]})]}),(0,a.jsxs)("button",{type:"button",onClick:i,className:"relative flex items-center gap-1.5 px-3 py-1.5 text-gray-600 hover:text-gray-900 hover:bg-gray-100 rounded-lg transition-colors","aria-label":"View worktree information",children:[a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),a.jsx("span",{className:"text-sm font-medium",children:"Info"}),c&&a.jsx(eu,{"data-testid":"info-update-indicator",className:"absolute top-0 right-0","aria-label":"Update available"})]})]})}),rr=(0,l.memo)(function({worktreeId:e,worktree:t,isOpen:r,onClose:s,onWorktreeUpdate:n}){let[i,o]=(0,l.useState)(!1),c=(0,l.useRef)(r),d=t9(t,n,r,()=>{let e=r&&!c.current;return c.current=r,e});return t?a.jsx(tZ.u,{isOpen:r,onClose:s,title:"Worktree Information",size:"md",children:a.jsx("div",{className:"space-y-4 max-h-[70vh] overflow-y-auto",children:a.jsx(re,{worktreeId:e,worktree:t,cardClassName:"bg-gray-50 rounded-lg p-4",descriptionEditor:d,showLogs:i,onToggleLogs:()=>o(!i)})})}):null}),ra=(0,l.memo)(function(){return a.jsx("div",{className:"flex items-center justify-center h-full min-h-[200px]",role:"status","aria-live":"polite",children:(0,a.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-4 border-gray-300 border-t-blue-600","aria-hidden":"true"}),a.jsx("p",{className:"text-gray-600",children:"Loading worktree..."})]})})}),rs=(0,l.memo)(function({message:e,onRetry:t}){return a.jsx("div",{className:"flex items-center justify-center h-full min-h-[200px]",role:"alert","aria-live":"assertive",children:(0,a.jsxs)("div",{className:"text-center p-6 bg-red-50 rounded-lg border border-red-200 max-w-md",children:[a.jsx("svg",{className:"mx-auto h-12 w-12 text-red-400 mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),a.jsx("p",{className:"text-red-600 font-medium",children:"Error loading worktree"}),a.jsx("p",{className:"text-red-500 text-sm mt-2",children:e}),t&&a.jsx("button",{type:"button",onClick:t,className:"mt-4 px-4 py-2 bg-red-600 text-white rounded-lg hover:bg-red-700 transition-colors focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2",children:"Retry"})]})})}),rn=(0,l.memo)(function({worktreeId:e,worktree:t,onWorktreeUpdate:r}){let[s,n]=(0,l.useState)(!1),i=(0,l.useRef)(t?.id),o=(0,l.useRef)(!1),c=t9(t,r,t?.id,()=>{let e=t?.id!==i.current;return i.current=t?.id,e&&!o.current});return(o.current=c.isEditing,t)?a.jsx("div",{className:"p-4 space-y-4 overflow-y-auto h-full",children:a.jsx(re,{worktreeId:e,worktree:t,cardClassName:"bg-white rounded-lg border border-gray-200 p-4",descriptionEditor:c,showLogs:s,onToggleLogs:()=>n(!s)})}):a.jsx("div",{className:"text-gray-500 text-center py-8",children:"Loading worktree info..."})}),rl=(0,l.memo)(function({activeTab:e,worktreeId:t,worktree:r,messages:s,terminalOutput:n,isTerminalActive:l,isThinking:i,onFilePathClick:o,onFileSelect:c,onWorktreeUpdate:d,onNewFile:u,onNewDirectory:m,onRename:p,onDelete:h,onUpload:f,onMove:x,refreshTrigger:y,fileSearch:b,showToast:v}){switch(e){case"terminal":return a.jsx(g,{componentName:"TerminalDisplay",children:a.jsx(L,{output:n,isActive:l,isThinking:i,className:"h-full"})});case"history":return a.jsx(g,{componentName:"HistoryPane",children:a.jsx(X,{messages:s,worktreeId:t,onFilePathClick:o,className:"h-full",showToast:v})});case"files":return a.jsx(g,{componentName:"FileTreeView",children:(0,a.jsxs)("div",{className:"h-full flex flex-col",children:[a.jsx(eB,{query:b.query,mode:b.mode,isSearching:b.isSearching,error:b.error,onQueryChange:b.setQuery,onModeChange:b.setMode,onClear:b.clearSearch}),a.jsx(eF,{worktreeId:t,onFileSelect:c,onNewFile:u,onNewDirectory:m,onRename:p,onDelete:h,onUpload:f,onMove:x,refreshTrigger:y,searchQuery:b.query,searchMode:b.mode,searchResults:b.results?.results,className:"flex-1 min-h-0"})]})});case"memo":return a.jsx(g,{componentName:"MemoPane",children:a.jsx(tD,{worktreeId:t,className:"h-full"})});case"info":return a.jsx(rn,{worktreeId:t,worktree:r,onWorktreeUpdate:d});default:return null}}),ri=(0,l.memo)(function({worktreeId:e}){let t=(0,s.useRouter)(),r=(0,h.d)(),{toggle:n,openMobileDrawer:i}=(0,f.Sz)(),{state:o,actions:c}=function(){let[e,t]=(0,l.useReducer)(p,void 0,m),r=(0,l.useMemo)(()=>({setPhase:e=>t({type:"SET_PHASE",phase:e}),setTerminalOutput:(e,r)=>t({type:"SET_TERMINAL_OUTPUT",output:e,realtimeSnippet:r}),setTerminalActive:e=>t({type:"SET_TERMINAL_ACTIVE",isActive:e}),setTerminalThinking:e=>t({type:"SET_TERMINAL_THINKING",isThinking:e}),showPrompt:(e,r)=>t({type:"SHOW_PROMPT",data:e,messageId:r}),clearPrompt:()=>t({type:"CLEAR_PROMPT"}),setPromptAnswering:e=>t({type:"SET_PROMPT_ANSWERING",answering:e}),setError:e=>t({type:"SET_ERROR",error:e}),clearError:()=>t({type:"CLEAR_ERROR"}),setMessages:e=>t({type:"SET_MESSAGES",messages:e}),addMessage:e=>t({type:"ADD_MESSAGE",message:e}),updateMessage:(e,r)=>t({type:"UPDATE_MESSAGE",id:e,updates:r}),clearMessages:()=>t({type:"CLEAR_MESSAGES"}),startWaitingForResponse:e=>t({type:"START_WAITING_FOR_RESPONSE",cliToolId:e}),responseReceived:e=>t({type:"RESPONSE_RECEIVED",message:e}),sessionEnded:()=>t({type:"SESSION_ENDED"}),setAutoScroll:e=>t({type:"SET_AUTO_SCROLL",enabled:e}),setMobileActivePane:e=>t({type:"SET_MOBILE_ACTIVE_PANE",pane:e}),setLeftPaneTab:e=>t({type:"SET_LEFT_PANE_TAB",tab:e}),setLayoutMode:e=>t({type:"SET_LAYOUT_MODE",mode:e}),setSplitRatio:e=>t({type:"SET_SPLIT_RATIO",ratio:e}),setWsConnected:e=>t({type:"SET_WS_CONNECTED",connected:e})}),[]);return{state:e,dispatch:t,actions:r}}(),d=(0,x.T)("worktree"),u=(0,x.T)("error"),y=(0,x.T)("common"),b=(0,x.T)("autoYes"),[v,w]=(0,l.useState)(null),[j,N]=(0,l.useState)(!0),[k,C]=(0,l.useState)(null),[S,T]=(0,l.useState)(!1),[E,A]=(0,l.useState)(null),[R,_]=(0,l.useState)(null),[O,P]=(0,l.useState)(!1),[I,D]=(0,l.useState)(!1),[$,F]=(0,l.useState)(null),z=(0,l.useRef)(!1),[H,W]=(0,l.useState)(!1),[B,U]=(0,l.useState)("claude"),G=(0,l.useRef)(B);G.current=B;let[V,q]=(0,l.useState)(0),Y=function(e){let{worktreeId:t,initialMode:r="name",debounceMs:a=300}=e,[s,n]=(0,l.useState)(""),[i,o]=(0,l.useState)(""),[c,d]=(0,l.useState)(r),[u,m]=(0,l.useState)(!1),[p,h]=(0,l.useState)(null),[f,x]=(0,l.useState)(null),g=(0,l.useRef)(null),y=(0,l.useMemo)(()=>(0,ei.Ds)(e=>{o(e)},a),[a]),b=(0,l.useCallback)(e=>{n(e),y(e),x(null)},[y]),v=(0,l.useCallback)(()=>{n(""),o(""),h(null),x(null),m(!1),g.current&&(g.current.abort(),g.current=null)},[]),w=(0,l.useCallback)(e=>{if(!i.trim())return e;let t=i.toLowerCase();return e.filter(e=>e.name.toLowerCase().includes(t))},[i]),j=(0,l.useCallback)(()=>p&&0!==p.results.length?(0,ei.Ps)(p.results.map(e=>e.filePath)):new Set,[p]);return{query:s,mode:c,isSearching:u,results:p,error:f,setQuery:b,setMode:d,clearSearch:v,filterByName:w,getMatchedPaths:j}}({worktreeId:e}),Z=(0,l.useRef)(!1),K=(0,l.useRef)(e);(0,l.useEffect)(()=>{K.current!==e&&(c.clearMessages(),Z.current=!1,c.setTerminalOutput("",""),K.current=e)},[e,c]);let J=(0,l.useCallback)(async()=>{try{let t=await fetch(`/api/worktrees/${e}`);if(!t.ok)throw Error(`Failed to fetch worktree: ${t.status}`);let r=await t.json();return w(r),r}catch(e){return C(e instanceof Error?e.message:"Unknown error"),null}},[e]),Q=(0,l.useCallback)(async()=>{try{let t=await fetch(`/api/worktrees/${e}/messages?cliTool=${G.current}`);if(!t.ok)throw Error(`Failed to fetch messages: ${t.status}`);let r=await t.json();c.setMessages(r.map(e=>({...e,timestamp:new Date(e.timestamp)})))}catch(e){console.error("[WorktreeDetailRefactored] Error fetching messages:",e)}},[e,c]),ee=(0,l.useCallback)(async()=>{try{let t=await fetch(`/api/worktrees/${e}/current-output?cliTool=${G.current}`);if(!t.ok)return;let r=await t.json(),a=r.fullOutput??r.realtimeSnippet??"";if((a||r.isRunning)&&c.setTerminalOutput(a,r.realtimeSnippet??""),c.setTerminalActive(r.isRunning??!1),c.setTerminalThinking(r.thinking??!1),r.isPromptWaiting&&r.promptData?c.showPrompt(r.promptData,`prompt-${Date.now()}`):!r.isPromptWaiting&&o.prompt.visible&&c.clearPrompt(),r.autoYes){let e=z.current;D(r.autoYes.enabled),F(r.autoYes.expiresAt),z.current=r.autoYes.enabled,e&&!r.autoYes.enabled&&"stop_pattern_matched"===r.autoYes.stopReason&&W(!0)}}catch(e){console.error("[WorktreeDetailRefactored] Error fetching current output:",e)}},[e,c,o.prompt.visible]),et=(0,l.useRef)(B);(0,l.useEffect)(()=>{et.current!==B&&(et.current=B,c.clearMessages(),c.setTerminalOutput("",""),Q(),ee())},[B,c,Q,ee]);let er=(0,l.useCallback)(e=>{A(e)},[]),ea=(0,l.useCallback)(e=>{let t=e.split(".").pop()?.toLowerCase(),r=t?`.${t}`:"";tA.includes(r)?_(e):A(e)},[]),es=(0,l.useCallback)(()=>{A(null)},[]),eo=(0,l.useCallback)(()=>{_(null)},[]),ec=(0,l.useCallback)(e=>{q(e=>e+1)},[]),eu=(0,l.useCallback)(e=>{c.setLeftPaneTab(e)},[c]),em=(0,l.useCallback)(()=>{t.push("/")},[t]),ep=(0,l.useCallback)(()=>{T(!0)},[]),eh=(0,l.useCallback)(()=>{T(!1)},[]),ex=(0,l.useCallback)(async t=>{c.setPromptAnswering(!0);try{let r=function(e,t,r){let a={answer:e,cliTool:t};if(r&&(a.promptType=r.type,"multiple_choice"===r.type)){let e=r.options.find(e=>e.isDefault);e&&(a.defaultOptionNumber=e.number)}return a}(t,B,o.prompt.data),a=await fetch(`/api/worktrees/${e}/prompt-response`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!a.ok)throw Error(`Failed to send prompt response: ${a.status}`);c.clearPrompt(),await ee()}catch(e){console.error("[WorktreeDetailRefactored] Error sending prompt response:",e)}finally{c.setPromptAnswering(!1)}},[e,c,ee,B,o.prompt.data]),ey=(0,l.useCallback)(()=>{c.clearPrompt()},[c]),eb=(0,l.useCallback)(e=>{c.setMobileActivePane(e)},[c]),ev=(0,l.useCallback)(e=>{c.setAutoScroll(e)},[c]),ej=(0,l.useCallback)(()=>{Q(),ee()},[Q,ee]),eN=(0,l.useCallback)(async t=>{try{let r=await fetch(`/api/worktrees/${e}/auto-yes`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:t.enabled,cliToolId:B,duration:t.duration,stopPattern:t.stopPattern})});if(r.ok){let e=await r.json();D(e.enabled),F(e.expiresAt),z.current=e.enabled}}catch(e){console.error("[WorktreeDetailRefactored] Error toggling auto-yes:",e)}},[e,B]),[ek,eC]=(0,l.useState)(!1),eS=(0,l.useCallback)(()=>{eC(!0)},[]),eT=(0,l.useCallback)(async()=>{eC(!1);try{if(!(await fetch(`/api/worktrees/${e}/kill-session?cliTool=${B}`,{method:"POST"})).ok)return;c.clearMessages(),c.setTerminalOutput("",""),c.setTerminalActive(!1),c.setTerminalThinking(!1),c.clearPrompt(),await J()}catch(e){console.error("[WorktreeDetailRefactored] Error killing session:",e)}},[e,B,c,J]),eE=(0,l.useCallback)(()=>{eC(!1)},[]),eM=(0,l.useCallback)(async t=>{let r=window.prompt("Enter file name (e.g., document.md):");if(!r)return;let a=r.endsWith(".md")?r:`${r}.md`,s=t?`${t}/${a}`:a;try{if(!(await fetch(`/api/worktrees/${e}/files/${t8(s)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"file",content:""})})).ok)throw Error("Failed to create file");q(e=>e+1)}catch(e){console.error("[WorktreeDetailRefactored] Failed to create file:",e),window.alert(u("fileOps.failedToCreateFile"))}},[e,u]),eA=(0,l.useCallback)(async t=>{let r=window.prompt("Enter directory name:");if(!r)return;let a=t?`${t}/${r}`:r;try{if(!(await fetch(`/api/worktrees/${e}/files/${t8(a)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"directory"})})).ok)throw Error("Failed to create directory");q(e=>e+1)}catch(e){console.error("[WorktreeDetailRefactored] Failed to create directory:",e),window.alert(u("fileOps.failedToCreateDirectory"))}},[e,u]),eR=(0,l.useCallback)(async t=>{let r=t.split("/").pop()||"",a=window.prompt("Enter new name:",r);if(a&&a!==r)try{if(!(await fetch(`/api/worktrees/${e}/files/${t8(t)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"rename",newName:a})})).ok)throw Error("Failed to rename");q(e=>e+1)}catch(e){console.error("[WorktreeDetailRefactored] Failed to rename:",e),window.alert(u("fileOps.failedToRename"))}},[e,u]),e_=(0,l.useCallback)(async t=>{let r=t.split("/").pop()||t;if(window.confirm(y("confirmDelete",{name:r})))try{if(!(await fetch(`/api/worktrees/${e}/files/${t8(t)}?recursive=true`,{method:"DELETE"})).ok)throw Error("Failed to delete");(R===t||R?.startsWith(`${t}/`))&&_(null),q(e=>e+1)}catch(e){console.error("[WorktreeDetailRefactored] Failed to delete:",e),window.alert(u("fileOps.failedToDelete"))}},[e,R,y,u]),{toasts:eO,showToast:eP,removeToast:eL}=(0,th.pm)();(0,l.useEffect)(()=>{H&&(eP(b("stopPatternMatched"),"info"),W(!1))},[H,eP,b]);let{moveTarget:eI,isMoveDialogOpen:eD,handleMove:e$,handleMoveConfirm:ez,handleMoveCancel:eH}=function(e,t,r,a){let[s,n]=(0,l.useState)(null),[i,o]=(0,l.useState)(!1),c=(0,l.useCallback)((e,t)=>{n({path:e,type:t}),o(!0)},[]),d=(0,l.useCallback)(async l=>{if(s)try{let n=await fetch(`/api/worktrees/${e}/files/${s.path}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"move",destination:l})}),i=await n.json();if(!n.ok||!i.success){let e=i.error?.message||"Failed to move";a?.(e);return}r?.("Moved successfully"),t()}catch{a?.("Failed to move")}finally{n(null),o(!1)}},[s,e,t,r,a]);return{moveTarget:s,isMoveDialogOpen:i,handleMove:c,handleMoveConfirm:d,handleMoveCancel:(0,l.useCallback)(()=>{n(null),o(!1)},[])}}(e,()=>q(e=>e+1),e=>eP(e,"success"),e=>eP(e,"error")),eW=(0,l.useRef)(null),eU=(0,l.useRef)(""),eG=(0,l.useCallback)(e=>{eU.current=e,eW.current?.click()},[]),eV=(0,l.useCallback)(async t=>{let r=t.target.files?.[0];if(!r)return;t.target.value="";let a=eU.current,s=`.${r.name.split(".").pop()?.toLowerCase()}`;if(!function(e){if(!e)return!1;let t=e.toLowerCase();return t_.includes(t)}(s)){eP(`Unsupported file type: ${s}. Allowed: ${t_.join(", ")}`,"error");return}let n=function(e){let t=function(e){let t=e.toLowerCase();return tR.find(e=>e.extension===t)}(e);return t?.maxFileSize??5242880}(s);if(r.size>n){eP(`File too large. Maximum size: ${(n/1024/1024).toFixed(1)}MB`,"error");return}let l=new FormData;l.append("file",r);try{let t=await fetch(`/api/worktrees/${e}/upload/${t8(a||".")}`,{method:"POST",body:l});if(!t.ok){let e=await t.json().catch(()=>({})),r=e?.error?.message||"Failed to upload file";eP(r,"error");return}let r=await t.json();eP(`Uploaded: ${r.filename}`,"success"),q(e=>e+1)}catch(e){console.error("[WorktreeDetailRefactored] Failed to upload:",e),eP("Upload failed. Please try again.","error")}},[e,eP]),{data:eq}=tF(),eZ=eq?.hasUpdate??!1,{lastAutoResponse:eK}=function({worktreeId:e,cliTool:t,isPromptWaiting:r,promptData:a,autoYesEnabled:s,lastServerResponseTimestamp:n}){(0,l.useRef)(null);let[i,o]=(0,l.useState)(null);return{lastAutoResponse:i}}({worktreeId:e,cliTool:B,isPromptWaiting:o.prompt.visible,promptData:o.prompt.data,autoYesEnabled:I}),eX=(0,l.useCallback)(async()=>{C(null),N(!0),await J()&&await Promise.all([Q(),ee()]),N(!1)},[J,Q,ee]),eJ=(0,l.useRef)(0),e0=(0,l.useCallback)(async()=>{if("visible"!==document.visibilityState)return;let e=Date.now();if(!(e-eJ.current<5e3)){if(eJ.current=e,k){eX();return}try{await Promise.all([J(),Q(),ee()])}finally{C(null)}}},[k,eX,J,Q,ee]);(0,l.useEffect)(()=>{if(Z.current)return;let e=!0;return(async()=>{N(!0);let t=await J();e&&(t&&await Promise.all([Q(),ee()]),e&&(N(!1),Z.current=!0))})(),()=>{e=!1}},[J,Q,ee]),(0,l.useEffect)(()=>(document.addEventListener("visibilitychange",e0),()=>{document.removeEventListener("visibilitychange",e0)}),[e0]),(0,l.useEffect)(()=>{if(j||k)return;let e=setInterval(async()=>{await Promise.all([ee(),J(),Q()])},o.terminal.isActive?2e3:5e3);return()=>clearInterval(e)},[j,k,ee,J,Q,o.terminal.isActive]),(0,l.useEffect)(()=>{c.setLayoutMode(r?"tabs":"split")},[r,c]);let e1=(0,l.useMemo)(()=>(function(e,t,r="claude"){if(t)return"error";if(!e)return"idle";let a=e.sessionStatusByCli?.[r];if(a){if(a.isWaitingForResponse)return"waiting";if(a.isProcessing)return"running";if(a.isRunning)return"ready"}if("claude"===r){if(e.isWaitingForResponse)return"waiting";if(e.isProcessing)return"running";if(e.isSessionRunning)return"ready"}return"idle"})(v,null!==o.error.type,B),[v,o.error.type,B]),e2=(0,l.useMemo)(()=>o.layout.mobileActivePane,[o.layout.mobileActivePane]),e4=(0,l.useMemo)(()=>o.layout.leftPaneTab,[o.layout.leftPaneTab]),e5=v?.name??"Unknown";return j?a.jsx(ra,{}):k?a.jsx(rs,{message:k,onRetry:eX}):r?a.jsx(g,{componentName:"WorktreeDetailRefactored",children:(0,a.jsxs)("div",{className:"h-full flex flex-col",children:[a.jsx(ed,{worktreeName:e5,repositoryName:v?.repositoryName,status:e1,gitStatus:v?.gitStatus,onBackClick:em,onMenuClick:i}),v?.gitStatus&&v.gitStatus.isBranchMismatch&&a.jsx("div",{className:"fixed top-14 inset-x-0 z-35",children:a.jsx(t1,{isBranchMismatch:v.gitStatus.isBranchMismatch,currentBranch:v.gitStatus.currentBranch,initialBranch:v.gitStatus.initialBranch})}),(0,a.jsxs)("div",{className:"fixed top-14 inset-x-0 z-30 flex items-center justify-between px-3 py-1.5 bg-gray-50 border-b border-gray-200",children:[a.jsx(t0,{enabled:I,expiresAt:$,onToggle:eN,lastAutoResponse:eK,cliToolName:B,inline:!0}),(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[a.jsx("nav",{className:"flex gap-2","aria-label":"CLI Tool Selection",children:["claude","codex"].map(e=>{let t=(0,t2.He)(v?.sessionStatusByCli?.[e]),r=el.F4[t];return(0,a.jsxs)("button",{onClick:()=>U(e),className:`px-1.5 py-0.5 rounded font-medium text-xs transition-colors flex items-center gap-1 ${B===e?"bg-blue-100 text-blue-700":"text-gray-500 hover:text-gray-700"}`,"aria-current":B===e?"page":void 0,children:["spinner"===r.type?a.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 border-2 border-t-transparent animate-spin ${r.className}`,title:r.label}):a.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${r.className}`,title:r.label}),t7(e)]},e)})}),(0,a.jsxs)("button",{onClick:eS,disabled:!v?.sessionStatusByCli?.[B]?.isRunning,className:`flex items-center gap-0.5 px-1.5 py-0.5 text-xs font-medium rounded transition-colors ${v?.sessionStatusByCli?.[B]?.isRunning?"text-red-600 hover:bg-red-50":"invisible"}`,"aria-label":`End ${B} session`,children:[a.jsx("span",{"aria-hidden":"true",children:"✕"}),"End"]})]})]}),a.jsx("main",{className:"flex-1 pt-[6.25rem] pb-32 overflow-hidden",style:{paddingBottom:"calc(8rem + env(safe-area-inset-bottom, 0px))"},children:a.jsx(rl,{activeTab:e2,worktreeId:e,worktree:v,messages:o.messages,terminalOutput:o.terminal.output,isTerminalActive:o.terminal.isActive,isThinking:o.terminal.isThinking,onFilePathClick:er,onFileSelect:ea,onWorktreeUpdate:w,onNewFile:eM,onNewDirectory:eA,onRename:eR,onDelete:e_,onUpload:eG,onMove:e$,refreshTrigger:V,fileSearch:Y,showToast:eP})}),a.jsx("div",{className:"fixed left-0 right-0 border-t border-gray-200 bg-white p-2 z-30",style:{bottom:"calc(4rem + env(safe-area-inset-bottom, 0px))"},children:a.jsx(ew.R,{worktreeId:e,onMessageSent:ej,cliToolId:B,isSessionRunning:o.terminal.isActive})}),a.jsx(ef,{activeTab:e2,onTabChange:eb,hasNewOutput:!1,hasPrompt:o.prompt.visible,hasUpdate:eZ}),!I&&a.jsx(eg,{promptData:o.prompt.data,visible:o.prompt.visible,answering:o.prompt.answering,onRespond:ex,onDismiss:ey}),a.jsx(eQ,{isOpen:null!==E,onClose:es,worktreeId:e,filePath:E??""}),R&&a.jsx(tZ.u,{isOpen:!0,onClose:eo,title:R.split("/").pop()||"Editor",size:"full",disableClose:O,children:a.jsx("div",{className:"h-[80vh]",children:a.jsx(tM,{worktreeId:e,filePath:R,onClose:eo,onSave:ec,onMaximizedChange:P})})}),a.jsx("input",{ref:eW,type:"file",accept:t_.join(","),onChange:eV,className:"hidden","aria-label":"Upload file"}),a.jsx(tZ.u,{isOpen:ek,onClose:eE,title:d("session.confirmEnd",{tool:t7(B)}),size:"sm",showCloseButton:!0,children:(0,a.jsxs)("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-gray-700",children:d("session.endWarning")}),(0,a.jsxs)("div",{className:"flex justify-end gap-3 pt-2",children:[a.jsx("button",{type:"button",onClick:eE,className:"px-4 py-2 text-sm font-medium rounded-md bg-gray-200 hover:bg-gray-300 text-gray-700",children:y("cancel")}),a.jsx("button",{type:"button",onClick:eT,className:"px-4 py-2 text-sm font-medium rounded-md bg-red-600 hover:bg-red-700 text-white",children:y("end")})]})]})}),eI&&a.jsx(t6,{isOpen:eD,onClose:eH,onConfirm:ez,worktreeId:e,sourcePath:eI.path,sourceType:eI.type}),a.jsx(th.Ix,{toasts:eO,onClose:eL})]})}):a.jsx(g,{componentName:"WorktreeDetailRefactored",children:(0,a.jsxs)("div",{className:"h-full flex flex-col relative",children:[a.jsx(rt,{worktreeName:e5,repositoryName:v?.repositoryName??"Unknown",description:v?.description,status:e1,gitStatus:v?.gitStatus,onBackClick:em,onInfoClick:ep,onMenuClick:n,hasUpdate:eZ}),(0,a.jsxs)("div",{className:"px-4 py-2 bg-white border-b border-gray-200 flex items-center justify-between",children:[a.jsx("nav",{className:"flex gap-4","aria-label":"CLI Tool Selection",children:["claude","codex"].map(e=>{let t=(0,t2.He)(v?.sessionStatusByCli?.[e]),r=el.F4[t];return(0,a.jsxs)("button",{onClick:()=>U(e),className:`pb-2 px-2 border-b-2 font-medium text-sm transition-colors flex items-center gap-1.5 ${B===e?"border-blue-600 text-blue-600":"border-transparent text-gray-600 hover:text-gray-900"}`,"aria-current":B===e?"page":void 0,children:["spinner"===r.type?a.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 border-2 border-t-transparent animate-spin ${r.className}`,title:r.label,"aria-label":`${e} status: ${r.label}`}):a.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${r.className}`,title:r.label,"aria-label":`${e} status: ${r.label}`}),t7(e)]},e)})}),v?.sessionStatusByCli?.[B]?.isRunning&&(0,a.jsxs)("button",{onClick:eS,className:"flex items-center gap-1 px-2 py-1 text-xs font-medium text-red-600 hover:text-red-800 hover:bg-red-50 rounded transition-colors","aria-label":`End ${B} session`,children:[a.jsx("span",{"aria-hidden":"true",children:"✕"}),"End Session"]})]}),v?.gitStatus&&a.jsx(t1,{isBranchMismatch:v.gitStatus.isBranchMismatch,currentBranch:v.gitStatus.currentBranch,initialBranch:v.gitStatus.initialBranch}),a.jsx("div",{className:"flex-1 min-h-0",children:a.jsx(M,{leftPane:(0,a.jsxs)("div",{className:"h-full flex flex-col",children:[a.jsx(eY,{activeTab:e4,onTabChange:eu}),(0,a.jsxs)("div",{className:"flex-1 min-h-0 overflow-hidden",children:["history"===e4&&a.jsx(X,{messages:o.messages,worktreeId:e,onFilePathClick:er,className:"h-full",showToast:eP}),"files"===e4&&a.jsx(g,{componentName:"FileTreeView",children:(0,a.jsxs)("div",{className:"h-full flex flex-col",children:[a.jsx(eB,{query:Y.query,mode:Y.mode,isSearching:Y.isSearching,error:Y.error,onQueryChange:Y.setQuery,onModeChange:Y.setMode,onClear:Y.clearSearch}),a.jsx(eF,{worktreeId:e,onFileSelect:ea,onNewFile:eM,onNewDirectory:eA,onRename:eR,onDelete:e_,onUpload:eG,onMove:e$,refreshTrigger:V,searchQuery:Y.query,searchMode:Y.mode,searchResults:Y.results?.results,className:"flex-1 min-h-0"})]})}),"memo"===e4&&a.jsx(g,{componentName:"MemoPane",children:a.jsx(tD,{worktreeId:e,className:"h-full"})})]})]}),rightPane:a.jsx(L,{output:o.terminal.output,isActive:o.terminal.isActive,isThinking:o.terminal.isThinking,autoScroll:o.terminal.autoScroll,onScrollChange:ev}),initialLeftWidth:40,minLeftWidth:20,maxLeftWidth:60})}),a.jsx("div",{className:"flex-shrink-0 border-t border-gray-200 p-4 bg-gray-50",children:a.jsx(ew.R,{worktreeId:e,onMessageSent:ej,cliToolId:B,isSessionRunning:o.terminal.isActive})}),a.jsx(t0,{enabled:I,expiresAt:$,onToggle:eN,lastAutoResponse:eK,cliToolName:B}),o.prompt.visible&&!I&&a.jsx("div",{className:"fixed bottom-20 left-1/2 transform -translate-x-1/2 z-50 w-full max-w-2xl px-4",children:a.jsx(en,{promptData:o.prompt.data,messageId:o.prompt.messageId,visible:o.prompt.visible,answering:o.prompt.answering,onRespond:ex,onDismiss:ey})}),a.jsx(rr,{worktreeId:e,worktree:v,isOpen:S,onClose:eh,onWorktreeUpdate:w}),a.jsx(eQ,{isOpen:null!==E,onClose:es,worktreeId:e,filePath:E??""}),R&&a.jsx(tZ.u,{isOpen:!0,onClose:eo,title:R.split("/").pop()||"Editor",size:"full",disableClose:O,children:a.jsx("div",{className:"h-[80vh]",children:a.jsx(tM,{worktreeId:e,filePath:R,onClose:eo,onSave:ec,onMaximizedChange:P})})}),a.jsx("input",{ref:eW,type:"file",accept:t_.join(","),onChange:eV,className:"hidden","aria-label":"Upload file"}),a.jsx(tZ.u,{isOpen:ek,onClose:eE,title:d("session.confirmEnd",{tool:t7(B)}),size:"sm",showCloseButton:!0,children:(0,a.jsxs)("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-gray-700",children:d("session.endWarning")}),(0,a.jsxs)("div",{className:"flex justify-end gap-3 pt-2",children:[a.jsx("button",{type:"button",onClick:eE,className:"px-4 py-2 text-sm font-medium rounded-md bg-gray-200 hover:bg-gray-300 text-gray-700",children:y("cancel")}),a.jsx("button",{type:"button",onClick:eT,className:"px-4 py-2 text-sm font-medium rounded-md bg-red-600 hover:bg-red-700 text-white",children:y("end")})]})]})}),eI&&a.jsx(t6,{isOpen:eD,onClose:eH,onConfirm:ez,worktreeId:e,sourcePath:eI.path,sourceType:eI.type}),a.jsx(th.Ix,{toasts:eO,onClose:eL})]})})});function ro(){let e=(0,s.useParams)().id;return a.jsx(n.Vw,{children:a.jsx(ri,{worktreeId:e})})}},81194:(e,t,r)=>{"use strict";r.d(t,{O:()=>n});var a=r(10326),s=r(17577);function n({src:e,alt:t,onError:r}){let[n,l]=(0,s.useState)(!1);return n?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500",children:[a.jsx("svg",{className:"w-16 h-16 mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})}),a.jsx("p",{className:"text-sm",children:"Failed to load image"}),a.jsx("p",{className:"text-xs text-gray-400 mt-1",children:t})]}):a.jsx("div",{className:"flex items-center justify-center p-4",children:a.jsx("img",{src:e,alt:t,onError:()=>{l(!0),r?.()},style:{maxWidth:"100%",maxHeight:"500px",objectFit:"contain"},className:"rounded-lg shadow-sm"})})}},89918:(e,t,r)=>{"use strict";r.d(t,{R:()=>n});var a=r(10326),s=r(17577);function n({src:e,onError:t}){let[r,n]=(0,s.useState)(!0),[l,i]=(0,s.useState)(!1);return l?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500",children:[a.jsx("svg",{className:"w-16 h-16 mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z"})}),a.jsx("p",{className:"text-sm",children:"Failed to load video"})]}):(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center p-4",children:[r&&(0,a.jsxs)("div",{className:"flex items-center justify-center py-8",children:[a.jsx("div",{className:"inline-block animate-spin rounded-full h-8 w-8 border-4 border-gray-300 border-t-blue-600"}),a.jsx("p",{className:"ml-3 text-gray-600",children:"Loading video..."})]}),a.jsx("video",{controls:!0,src:e,onLoadedData:()=>{n(!1)},onError:()=>{n(!1),i(!0),t?.()},style:{maxWidth:"100%",maxHeight:"500px",display:r?"none":"block"},className:"rounded-lg shadow-sm",children:"Your browser does not support the video tag."})]})}},22570:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>a});let a=(0,r(68570).createProxy)(String.raw`/home/runner/work/CommandMate/CommandMate/src/app/worktrees/[id]/page.tsx#default`)},4803:()=>{},63817:(e,t,r)=>{"use strict";let a=r(51387),s=a.types;function n(e,t){var r;t||(t={});let n=void 0===t.limit?25:t.limit;(r=e,"[object RegExp]"===({}).toString.call(r))?e=e.source:"string"!=typeof e&&(e=String(e));try{e=a(e)}catch{return!1}let l=0;return function e(t,r){let a,i;if(t.type===s.REPETITION&&(r++,l++,r>1||l>n))return!1;if(t.options){for(a=0,i=t.options.length;a<i;a++)if(!e({stack:t.options[a]},r))return!1}let o=t.stack||t.value?.stack;if(!o)return!0;for(a=0;a<o.length;a++)if(!e(o[a],r))return!1;return!0}(e,0)}e.exports=n,e.exports.default=n,e.exports.safeRegex=n}};var t=require("../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),a=t.X(0,[8948,3294,6621,8705,7458,7808,3860,539],()=>r(80205));module.exports=a})();
9
+ `,children:[s?a.jsx("span",{"data-testid":"loading-indicator",className:"w-5 h-5 border-2 border-gray-300 border-t-blue-500 rounded-full animate-spin"}):a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),a.jsx("span",{className:"text-sm font-medium",children:"Add Memo"})]}),(0,a.jsxs)("span",{className:"text-xs text-gray-500",children:[Math.max(0,t-e)," remaining"]})]})}),tD=(0,l.memo)(function({worktreeId:e,className:t=""}){let[r,s]=(0,l.useState)([]),[n,i]=(0,l.useState)(!0),[o,c]=(0,l.useState)(!1),[d,u]=(0,l.useState)(null),[m,p]=(0,l.useState)(null),h=(0,l.useCallback)(async()=>{i(!0),u(null);try{let t=await tO.nE.getAll(e);s(t.sort((e,t)=>e.position-t.position))}catch(e){u((0,tO.zG)(e))}finally{i(!1)}},[e]);(0,l.useEffect)(()=>{h()},[h]);let f=(0,l.useCallback)(async()=>{c(!0),p(null);try{let t=await tO.nE.create(e,{title:"Memo",content:""});s(e=>[...e,t])}catch(e){p((0,tO.zG)(e))}finally{c(!1)}},[e]),x=(0,l.useCallback)(async(t,r)=>{await tO.nE.update(e,t,r),s(e=>e.map(e=>e.id===t?{...e,...r}:e))},[e]),g=(0,l.useCallback)(async t=>{try{await tO.nE.delete(e,t),s(e=>e.filter(e=>e.id!==t))}catch(e){console.error("Failed to delete memo:",e)}},[e]),y=(0,l.useCallback)(()=>{h()},[h]);return n?a.jsx("div",{"data-testid":"memo-pane",className:`flex flex-col items-center justify-center h-full p-4 ${t}`,children:(0,a.jsxs)("div",{"data-testid":"memo-loading",className:"flex flex-col items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 border-4 border-gray-200 border-t-blue-500 rounded-full animate-spin"}),a.jsx("span",{className:"text-sm text-gray-500",children:"Loading memos..."})]})}):d?a.jsx("div",{"data-testid":"memo-pane",className:`flex flex-col items-center justify-center h-full p-4 ${t}`,children:(0,a.jsxs)("div",{className:"flex flex-col items-center gap-3 text-center",children:[a.jsx("svg",{className:"w-12 h-12 text-red-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),a.jsx("span",{className:"text-sm text-red-600",children:d}),a.jsx("button",{type:"button",onClick:y,"aria-label":"Retry",className:"px-4 py-2 text-sm font-medium text-white bg-blue-500 rounded-lg hover:bg-blue-600 transition-colors",children:"Retry"})]})}):(0,a.jsxs)("div",{"data-testid":"memo-pane",className:`flex flex-col gap-4 p-4 overflow-y-auto ${t}`,children:[0===r.length&&!m&&(0,a.jsxs)("div",{className:"text-center py-8 text-gray-500",children:[a.jsx("p",{children:"No memos yet."}),a.jsx("p",{className:"text-sm",children:"Click the button below to add one."})]}),r.map(e=>a.jsx(tL,{memo:e,onUpdate:x,onDelete:g},e.id)),m&&a.jsx("div",{className:"text-center py-2 text-sm text-red-500",children:m}),a.jsx(tI,{currentCount:r.length,maxCount:5,onAdd:f,isLoading:o,className:"mt-2"})]})});var t$=r(11867);function tF(){let[e,t]=(0,l.useState)(null),[r,a]=(0,l.useState)(!0),[s,n]=(0,l.useState)(null);return{data:e,loading:r,error:s}}function tz({hasUpdate:e,latestVersion:t,releaseUrl:r,updateCommand:s,installType:n}){let l=(0,x.T)("worktree");return e?(0,a.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3 mt-2",role:"status","aria-label":l("update.available"),"data-testid":"update-notification-banner",children:[a.jsx("p",{className:"text-sm font-medium text-blue-800 mb-1",children:l("update.available")}),t&&a.jsx("p",{className:"text-sm text-blue-700 mb-2",children:l("update.latestVersion",{version:t})}),s&&"global"===n&&(0,a.jsxs)("div",{className:"mb-2",children:[a.jsx("p",{className:"text-xs text-blue-600 mb-1",children:l("update.updateCommand")}),a.jsx("code",{className:"block bg-blue-100 rounded px-2 py-1 text-xs text-blue-900 font-mono",children:s})]}),r&&(0,a.jsxs)("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center text-sm text-blue-600 hover:text-blue-800 underline",children:[l("update.viewRelease"),a.jsx("span",{className:"ml-1","aria-hidden":"true",children:"→"})]}),a.jsx("p",{className:"text-xs text-blue-500 mt-2",children:l("update.dataPreserved")})]}):null}function tH({version:e,className:t}){let r=(0,x.T)("worktree"),{data:s,loading:n}=tF(),i=(0,l.useMemo)(()=>s&&s.hasUpdate?{hasUpdate:s.hasUpdate,latestVersion:s.latestVersion,releaseUrl:s.releaseUrl,updateCommand:s.updateCommand,installType:s.installType}:null,[s]);return(0,a.jsxs)("div",{className:t,"data-testid":"version-section",children:[a.jsx("h2",{className:"text-sm font-medium text-gray-500 mb-1",children:r("update.version")}),a.jsx("p",{className:"text-sm text-gray-700",children:e}),n&&a.jsx("p",{className:"text-xs text-gray-400 mt-1","data-testid":"version-loading",children:"..."}),i&&a.jsx(tz,{...i})]})}let tW="https://github.com/Kewton/CommandMate",tB=`${tW}/issues`,tU=`${tW}/issues/new`,tG=`${tU}?template=bug_report.md`,tV=`${tU}?template=feature_request.md`,tq=`${tU}?template=question.md`;function tY({className:e}){let t=(0,x.T)("worktree"),r=[{href:tG,label:t("feedback.bugReport")},{href:tV,label:t("feedback.featureRequest")},{href:tq,label:t("feedback.question")},{href:tB,label:t("feedback.viewIssues")}];return(0,a.jsxs)("div",{className:e,"data-testid":"feedback-section",children:[a.jsx("h2",{className:"text-sm font-medium text-gray-500 mb-2",children:t("feedback.title")}),a.jsx("div",{className:"flex flex-col gap-1",children:r.map(({href:e,label:t})=>(0,a.jsxs)("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center text-sm text-blue-600 hover:text-blue-800 underline",children:[t,a.jsx("span",{className:"ml-1","aria-hidden":"true",children:"→"})]},e))})]})}var tZ=r(28676);r(63817);let tK=[36e5,108e5,288e5],tX={36e5:"autoYes.durations.1h",108e5:"autoYes.durations.3h",288e5:"autoYes.durations.8h"};function tJ({isOpen:e,onConfirm:t,onCancel:r,cliToolName:s}){let n=(0,x.T)("autoYes"),i=(0,x.T)("common"),[o,c]=(0,l.useState)(36e5),[d,u]=(0,l.useState)(""),[m,p]=(0,l.useState)(null),[h,f]=(0,l.useState)(!1),g=(0,l.useRef)(null),y=e=>n(tX[e].replace("autoYes.",""));return a.jsx(tZ.u,{isOpen:e,onClose:r,title:s?n("enableTitleWithTool",{toolName:s}):n("enableTitle"),size:"sm",showCloseButton:!0,children:(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"text-sm text-gray-700",children:[a.jsx("p",{className:"font-medium mb-2",children:n("featureDescription")}),(0,a.jsxs)("ul",{className:"list-disc list-inside space-y-1",children:[a.jsx("li",{children:n("yesNoAutoResponse")}),a.jsx("li",{children:n("multipleChoiceAutoSelect")})]}),a.jsx("p",{className:"mt-1",children:n("autoDisableAfter",{duration:y(o)})}),s&&a.jsx("p",{className:"mt-2 text-gray-500",children:n("appliesOnlyToCurrent",{toolName:s})})]}),(0,a.jsxs)("div",{className:"text-sm text-gray-700",children:[a.jsx("p",{className:"font-medium mb-2",children:n("duration")}),a.jsx("div",{className:"flex gap-2",children:tK.map(e=>a.jsx("button",{type:"button",onClick:()=>c(e),className:`flex-1 py-2 px-3 text-sm font-medium rounded-md border-2 transition-colors ${o===e?"border-blue-600 bg-blue-50 text-blue-700":"border-gray-300 bg-white text-gray-700 hover:border-gray-400"}`,style:{minHeight:"44px"},children:y(e)},e))})]}),(0,a.jsxs)("div",{className:"text-sm text-gray-700",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[a.jsx("label",{htmlFor:"stop-pattern-input",className:"font-medium",children:n("stopPatternLabel")}),(0,a.jsxs)("div",{className:"relative",ref:g,children:[a.jsx("button",{type:"button",onClick:()=>f(!h),className:"inline-flex items-center justify-center w-4 h-4 rounded-full bg-gray-300 text-gray-600 text-[10px] font-bold hover:bg-gray-400 focus:outline-none","aria-label":n("regexTipsLabel"),"data-testid":"regex-tips-button",children:"?"}),h&&(0,a.jsxs)("div",{className:"absolute left-0 top-6 z-50 w-72 rounded-md border border-gray-200 bg-white p-3 shadow-lg text-xs text-gray-700","data-testid":"regex-tips-tooltip",children:[a.jsx("p",{className:"font-medium mb-1.5",children:n("regexTipsTitle")}),(0,a.jsxs)("ul",{className:"space-y-1",children:[(0,a.jsxs)("li",{children:[a.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"\\bcat\\b"})," ",n("regexTipWordBoundary")]}),(0,a.jsxs)("li",{children:[a.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"error|fatal"})," ",n("regexTipOr")]}),(0,a.jsxs)("li",{children:[a.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"(?i)error"})," ",n("regexTipCaseNote")]})]})]})]})]}),a.jsx("p",{className:"text-xs text-gray-500 mb-2",children:n("stopPatternDescription")}),a.jsx("input",{id:"stop-pattern-input",type:"text",value:d,onChange:e=>u(e.target.value),placeholder:n("stopPatternPlaceholder"),className:`w-full px-3 py-2 border rounded-md text-sm font-mono ${m?"border-red-500 focus:ring-red-500 focus:border-red-500":"border-gray-300 focus:ring-blue-500 focus:border-blue-500"} focus:outline-none focus:ring-1`,"data-testid":"stop-pattern-input"}),m&&a.jsx("p",{className:"mt-1 text-xs text-red-600","data-testid":"stop-pattern-error",children:m})]}),(0,a.jsxs)("div",{className:"text-sm text-gray-700",children:[a.jsx("p",{className:"font-medium mb-2",children:n("aboutRisks")}),a.jsx("p",{children:n("riskWarning")})]}),a.jsx("div",{className:"bg-yellow-50 border-l-4 border-yellow-400 p-3",children:(0,a.jsxs)("p",{className:"text-sm text-yellow-800",children:[a.jsx("span",{className:"font-medium",children:n("disclaimer")}),n("disclaimerText")]})}),(0,a.jsxs)("div",{className:"flex justify-end gap-3 pt-2",children:[a.jsx("button",{type:"button",onClick:r,className:"px-4 py-2 text-sm font-medium rounded-md bg-gray-200 hover:bg-gray-300 text-gray-700",children:i("cancel")}),a.jsx("button",{type:"button",onClick:()=>{t(o,d.trim()||void 0)},disabled:!!m,className:`px-4 py-2 text-sm font-medium rounded-md text-white ${m?"bg-gray-400 cursor-not-allowed":"bg-yellow-600 hover:bg-yellow-700"}`,"data-testid":"confirm-button",children:n("agreeAndEnable")})]})]})})}function tQ(e){return e?e.charAt(0).toUpperCase()+e.slice(1):""}let t0=(0,l.memo)(function({enabled:e,expiresAt:t,onToggle:r,lastAutoResponse:s,cliToolName:n,inline:i=!1}){let[o,c]=(0,l.useState)(""),[d,u]=(0,l.useState)(null),[m,p]=(0,l.useState)(!1),[h,f]=(0,l.useState)(!1);(0,l.useEffect)(()=>{if(!e||!t){c("");return}let r=()=>{c(function(e){let t=Math.max(0,e-Date.now()),r=Math.floor(t/36e5),a=Math.floor(t%36e5/6e4),s=Math.floor(t%6e4/1e3);return r>0?`${r}:${a.toString().padStart(2,"0")}:${s.toString().padStart(2,"0")}`:`${a.toString().padStart(2,"0")}:${s.toString().padStart(2,"0")}`}(t))};r();let a=setInterval(r,1e3);return()=>clearInterval(a)},[e,t]),(0,l.useEffect)(()=>{if(!s)return;u(`Auto responded: "${s}"`);let e=setTimeout(()=>u(null),2e3);return()=>clearTimeout(e)},[s]);let x=(0,l.useCallback)(()=>{e?(p(!0),r({enabled:!1}).finally(()=>p(!1))):f(!0)},[e,r]),g=(0,l.useCallback)((e,t)=>{f(!1),p(!0),r({enabled:!0,duration:e,stopPattern:t}).finally(()=>p(!1))},[r]),y=(0,l.useCallback)(()=>{f(!1)},[]);return(0,a.jsxs)("div",{className:i?"flex items-center gap-2":"flex items-center gap-3 px-4 py-2 bg-gray-50 border-b border-gray-200",children:[a.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":"Auto Yes mode",disabled:m,onClick:x,className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 ${e?"bg-blue-600":"bg-gray-300"} ${m?"opacity-50":""}`,children:a.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${e?"translate-x-6":"translate-x-1"}`})}),a.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Auto Yes"}),e&&n&&(0,a.jsxs)("span",{className:"text-xs text-blue-600 font-medium","aria-label":"Auto Yes target",children:["(",tQ(n),")"]}),e&&o&&a.jsx("span",{className:"text-sm text-gray-500","aria-label":"Time remaining",children:o}),d&&a.jsx("span",{className:"text-sm text-green-600 animate-pulse",children:d}),a.jsx(tJ,{isOpen:h,onConfirm:g,onCancel:y,cliToolName:tQ(n)})]})}),t1=(0,l.memo)(function({isBranchMismatch:e,currentBranch:t,initialBranch:r}){let[s,n]=(0,l.useState)(!1);return((0,l.useEffect)(()=>{n(!1)},[t]),!e||s||null===r)?null:(0,a.jsxs)("div",{"data-testid":"branch-mismatch-alert",role:"alert",className:"flex items-center gap-3 px-4 py-2 bg-amber-50 border border-amber-200 text-amber-800 rounded-lg",children:[a.jsx(tl,{className:"w-5 h-5 text-amber-500 flex-shrink-0"}),a.jsx("div",{className:"flex-1 min-w-0",children:(0,a.jsxs)("span",{className:"text-sm",children:["Branch changed from"," ",a.jsx("span",{className:"font-medium",children:r})," ","to"," ",a.jsx("span",{className:"font-medium",children:t})]})}),a.jsx("button",{type:"button",onClick:()=>n(!0),className:"p-1 rounded hover:bg-amber-100 transition-colors","aria-label":"Dismiss alert",children:a.jsx(tp.Z,{className:"w-4 h-4"})})]})});var t2=r(18421);let t4=(0,I.Z)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),t5=(0,I.Z)("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]),t3=(0,I.Z)("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),t6=(0,l.memo)(function({isOpen:e,onClose:t,onConfirm:r,worktreeId:s,sourcePath:n,sourceType:i}){let o=(0,x.T)("worktree"),c=(0,x.T)("common"),[d,u]=(0,l.useState)(""),[m,p]=(0,l.useState)(new Set([""])),[h,f]=(0,l.useState)([]),[g,y]=(0,l.useState)(!1),[b,v]=(0,l.useState)(new Set),w=n.includes("/")?n.substring(0,n.lastIndexOf("/")):"";(0,l.useEffect)(()=>{e&&(u(w),p(new Set([""])),f([]),j())},[e,s]);let j=(0,l.useCallback)(async()=>{y(!0);try{let e=await fetch(`/api/worktrees/${s}/tree`);if(!e.ok)return;let t=(await e.json()).items.filter(e=>"directory"===e.type).map(e=>({name:e.name,path:e.name,loaded:!1}));f(t)}catch{}finally{y(!1)}},[s]),N=(0,l.useCallback)(async e=>{v(t=>new Set(t).add(e));try{let t=await fetch(`/api/worktrees/${s}/tree/${e}`);if(!t.ok)return;let r=(await t.json()).items.filter(e=>"directory"===e.type).map(t=>({name:t.name,path:`${e}/${t.name}`,loaded:!1}));f(t=>(function e(t,r,a){return t.map(t=>t.path===r?{...t,children:a,loaded:!0}:t.children?{...t,children:e(t.children,r,a)}:t)})(t,e,r))}catch{}finally{v(t=>{let r=new Set(t);return r.delete(e),r})}},[s]),k=(0,l.useCallback)(async e=>{p(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r});let t=function e(t,r){for(let a of t){if(a.path===r)return a;if(a.children){let t=e(a.children,r);if(t)return t}}return null}(h,e);t&&!t.loaded&&await N(e)},[h,N]),C=(0,l.useCallback)(e=>!(e===w||"directory"===i&&(e===n||e.startsWith(n+"/"))),[w,n,i]),S=(e,t=0)=>{let r=m.has(e.path),s=d===e.path,n=b.has(e.path),l=C(e.path);return(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:`flex items-center gap-1 py-1.5 px-2 cursor-pointer rounded text-sm transition-colors ${s?"bg-blue-100 text-blue-800":"hover:bg-gray-100 text-gray-700"} ${l?"":"opacity-40 cursor-not-allowed"}`,style:{paddingLeft:`${.5+1.25*t}rem`},onClick:()=>{l&&u(e.path)},children:[a.jsx("button",{className:"w-4 h-4 flex items-center justify-center flex-shrink-0",onClick:t=>{t.stopPropagation(),k(e.path)},children:n?a.jsx(tg,{className:"w-3 h-3 animate-spin text-gray-400"}):a.jsx(t4,{className:`w-3 h-3 text-gray-400 transition-transform ${r?"rotate-90":""}`})}),r?a.jsx(t5,{className:"w-4 h-4 text-yellow-500 flex-shrink-0"}):a.jsx(t3,{className:"w-4 h-4 text-yellow-500 flex-shrink-0"}),a.jsx("span",{className:"truncate",children:e.name})]}),r&&e.children&&a.jsx("div",{children:e.children.map(e=>S(e,t+1))})]},e.path)},T=C(d);return a.jsx(tZ.u,{isOpen:e,onClose:t,title:o("fileTree.moveDialogTitle"),size:"md",children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"text-sm text-gray-600",children:[o("fileTree.moveTo"),": ",a.jsx("span",{className:"font-mono text-gray-800",children:n})]}),(0,a.jsxs)("div",{className:"border border-gray-200 rounded-lg max-h-64 overflow-y-auto p-2",children:[(0,a.jsxs)("div",{className:`flex items-center gap-1 py-1.5 px-2 cursor-pointer rounded text-sm transition-colors ${""===d?"bg-blue-100 text-blue-800":"hover:bg-gray-100 text-gray-700"} ${C("")?"":"opacity-40 cursor-not-allowed"}`,onClick:()=>{C("")&&u("")},children:[a.jsx("span",{className:"w-4 h-4"}),a.jsx(t3,{className:"w-4 h-4 text-yellow-500 flex-shrink-0"}),a.jsx("span",{children:o("fileTree.rootDirectory")})]}),g?a.jsx("div",{className:"flex items-center justify-center py-4",children:a.jsx(tg,{className:"w-5 h-5 animate-spin text-gray-400"})}):h.map(e=>S(e,1))]}),(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{onClick:t,className:"px-4 py-2 text-sm text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 transition-colors",children:c("cancel")}),a.jsx("button",{onClick:()=>r(d),disabled:!T,className:"px-4 py-2 text-sm text-white bg-blue-600 rounded-md hover:bg-blue-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:o("fileTree.moveConfirm")})]})]})})});function t8(e){return e?e.split("/").map(encodeURIComponent).join("/"):""}function t7(e){return e.charAt(0).toUpperCase()+e.slice(1)}function t9(e,t,r,a){let[s,n]=(0,l.useState)(!1),[i,o]=(0,l.useState)(""),[c,d]=(0,l.useState)(!1),u=(0,l.useCallback)(async()=>{if(e){d(!0);try{let r=await tO.Iv.updateDescription(e.id,i);t(r),n(!1)}catch(e){console.error("Failed to save description:",e)}finally{d(!1)}}},[e,i,t]),m=(0,l.useCallback)(()=>{o(e?.description||""),n(!1)},[e]);return{isEditing:s,text:i,setText:o,isSaving:c,handleSave:u,handleCancel:m,startEditing:(0,l.useCallback)(()=>{n(!0)},[])}}let re=(0,l.memo)(function({worktreeId:e,worktree:t,cardClassName:r,descriptionEditor:s,showLogs:n,onToggleLogs:l}){let{isEditing:i,text:o,setText:c,isSaving:d,handleSave:u,handleCancel:m,startEditing:p}=s;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:r,children:[a.jsx("h2",{className:"text-sm font-medium text-gray-500 mb-1",children:"Worktree"}),a.jsx("p",{className:"text-lg font-semibold text-gray-900",children:t.name})]}),(0,a.jsxs)("div",{className:r,children:[a.jsx("h2",{className:"text-sm font-medium text-gray-500 mb-1",children:"Repository"}),a.jsx("p",{className:"text-base text-gray-900",children:t.repositoryName}),a.jsx("p",{className:"text-xs text-gray-500 mt-1 break-all",children:t.repositoryPath})]}),(0,a.jsxs)("div",{className:r,children:[a.jsx("h2",{className:"text-sm font-medium text-gray-500 mb-1",children:"Path"}),a.jsx("p",{className:"text-sm text-gray-700 break-all font-mono",children:t.path})]}),t.status&&(0,a.jsxs)("div",{className:r,children:[a.jsx("h2",{className:"text-sm font-medium text-gray-500 mb-1",children:"Status"}),a.jsx("span",{className:`inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${"done"===t.status?"bg-green-100 text-green-800":"doing"===t.status?"bg-blue-100 text-blue-800":"bg-gray-100 text-gray-800"}`,children:t.status.toUpperCase()})]}),(0,a.jsxs)("div",{className:r,children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("h2",{className:"text-sm font-medium text-gray-500",children:"Description"}),!i&&a.jsx("button",{type:"button",onClick:p,className:"text-sm text-blue-600 hover:text-blue-800",children:"Edit"})]}),i?(0,a.jsxs)("div",{className:"space-y-3",children:[a.jsx("textarea",{value:o,onChange:e=>c(e.target.value),placeholder:"Add notes about this branch...",className:"w-full min-h-[150px] p-3 border border-gray-300 rounded-lg resize-y focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",autoFocus:!0}),(0,a.jsxs)("div",{className:"flex gap-2",children:[a.jsx("button",{type:"button",onClick:u,disabled:d,className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 text-sm font-medium",children:d?"Saving...":"Save"}),a.jsx("button",{type:"button",onClick:m,disabled:d,className:"px-4 py-2 bg-gray-200 text-gray-700 rounded-lg hover:bg-gray-300 disabled:opacity-50 text-sm font-medium",children:"Cancel"})]})]}):a.jsx("div",{className:"min-h-[50px]",children:t.description?a.jsx("p",{className:"text-sm text-gray-700 whitespace-pre-wrap",children:t.description}):a.jsx("p",{className:"text-sm text-gray-400 italic",children:"No description added yet"})})]}),t.link&&(0,a.jsxs)("div",{className:r,children:[a.jsx("h2",{className:"text-sm font-medium text-gray-500 mb-1",children:"Link"}),a.jsx("a",{href:t.link,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-blue-600 hover:underline break-all",children:t.link})]}),t.updatedAt&&(0,a.jsxs)("div",{className:r,children:[a.jsx("h2",{className:"text-sm font-medium text-gray-500 mb-1",children:"Last Updated"}),a.jsx("p",{className:"text-sm text-gray-700",children:new Date(t.updatedAt).toLocaleString()})]}),a.jsx(tH,{version:"v0.3.1",className:r}),a.jsx(tY,{className:r}),(0,a.jsxs)("div",{className:r,children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("h2",{className:"text-sm font-medium text-gray-500",children:"Logs"}),a.jsx("button",{type:"button",onClick:l,className:"text-sm text-blue-600 hover:text-blue-800",children:n?"Hide":"Show"})]}),n&&a.jsx(t$.n,{worktreeId:e})]})]})}),rt=(0,l.memo)(function({worktreeName:e,repositoryName:t,description:r,status:s,gitStatus:n,onBackClick:l,onInfoClick:i,onMenuClick:o,hasUpdate:c}){let d=el.Ie[s],u=r?(0,ei.aS)(r,50):null;return(0,a.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 bg-white border-b border-gray-200",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[a.jsx("button",{type:"button",onClick:o,className:"p-2 -ml-2 rounded-lg text-gray-600 hover:text-gray-900 hover:bg-gray-100 transition-colors","aria-label":"Toggle sidebar",children:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})}),a.jsx("div",{className:"w-px h-6 bg-gray-300","aria-hidden":"true"}),(0,a.jsxs)("button",{type:"button",onClick:l,className:"flex items-center gap-1 text-gray-600 hover:text-gray-900 transition-colors","aria-label":"Go back to worktree list",children:[a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})}),a.jsx("span",{className:"text-sm font-medium",children:"Back"})]}),a.jsx("div",{className:"w-px h-6 bg-gray-300","aria-hidden":"true"}),"spinner"===d.type?a.jsx("span",{"data-testid":"desktop-status-indicator",title:d.label,"aria-label":d.label,className:`w-3 h-3 rounded-full flex-shrink-0 border-2 border-t-transparent animate-spin ${d.className}`}):a.jsx("span",{"data-testid":"desktop-status-indicator",title:d.label,"aria-label":d.label,className:`w-3 h-3 rounded-full flex-shrink-0 ${d.className}`}),(0,a.jsxs)("div",{className:"flex flex-col min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[a.jsx("h1",{className:"text-lg font-semibold text-gray-900 truncate max-w-[200px] leading-tight",children:e}),u&&a.jsx("span",{className:"text-sm text-gray-500 truncate max-w-md",title:r,children:u})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[a.jsx("span",{className:"truncate max-w-[200px]",children:t}),n&&"(unknown)"!==n.currentBranch&&(0,a.jsxs)(a.Fragment,{children:[a.jsx("span",{className:"text-gray-300",children:"/"}),a.jsx("span",{className:"truncate max-w-[150px] font-mono",title:n.currentBranch,"data-testid":"desktop-branch-name",children:(0,ei.aS)(n.currentBranch,30)}),n.isDirty&&a.jsx("span",{className:"text-amber-500",title:"Uncommitted changes",children:"*"})]})]})]})]}),(0,a.jsxs)("button",{type:"button",onClick:i,className:"relative flex items-center gap-1.5 px-3 py-1.5 text-gray-600 hover:text-gray-900 hover:bg-gray-100 rounded-lg transition-colors","aria-label":"View worktree information",children:[a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),a.jsx("span",{className:"text-sm font-medium",children:"Info"}),c&&a.jsx(eu,{"data-testid":"info-update-indicator",className:"absolute top-0 right-0","aria-label":"Update available"})]})]})}),rr=(0,l.memo)(function({worktreeId:e,worktree:t,isOpen:r,onClose:s,onWorktreeUpdate:n}){let[i,o]=(0,l.useState)(!1),c=(0,l.useRef)(r),d=t9(t,n,r,()=>{let e=r&&!c.current;return c.current=r,e});return t?a.jsx(tZ.u,{isOpen:r,onClose:s,title:"Worktree Information",size:"md",children:a.jsx("div",{className:"space-y-4 max-h-[70vh] overflow-y-auto",children:a.jsx(re,{worktreeId:e,worktree:t,cardClassName:"bg-gray-50 rounded-lg p-4",descriptionEditor:d,showLogs:i,onToggleLogs:()=>o(!i)})})}):null}),ra=(0,l.memo)(function(){return a.jsx("div",{className:"flex items-center justify-center h-full min-h-[200px]",role:"status","aria-live":"polite",children:(0,a.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-4 border-gray-300 border-t-blue-600","aria-hidden":"true"}),a.jsx("p",{className:"text-gray-600",children:"Loading worktree..."})]})})}),rs=(0,l.memo)(function({message:e,onRetry:t}){return a.jsx("div",{className:"flex items-center justify-center h-full min-h-[200px]",role:"alert","aria-live":"assertive",children:(0,a.jsxs)("div",{className:"text-center p-6 bg-red-50 rounded-lg border border-red-200 max-w-md",children:[a.jsx("svg",{className:"mx-auto h-12 w-12 text-red-400 mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),a.jsx("p",{className:"text-red-600 font-medium",children:"Error loading worktree"}),a.jsx("p",{className:"text-red-500 text-sm mt-2",children:e}),t&&a.jsx("button",{type:"button",onClick:t,className:"mt-4 px-4 py-2 bg-red-600 text-white rounded-lg hover:bg-red-700 transition-colors focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2",children:"Retry"})]})})}),rn=(0,l.memo)(function({worktreeId:e,worktree:t,onWorktreeUpdate:r}){let[s,n]=(0,l.useState)(!1),i=(0,l.useRef)(t?.id),o=(0,l.useRef)(!1),c=t9(t,r,t?.id,()=>{let e=t?.id!==i.current;return i.current=t?.id,e&&!o.current});return(o.current=c.isEditing,t)?a.jsx("div",{className:"p-4 space-y-4 overflow-y-auto h-full",children:a.jsx(re,{worktreeId:e,worktree:t,cardClassName:"bg-white rounded-lg border border-gray-200 p-4",descriptionEditor:c,showLogs:s,onToggleLogs:()=>n(!s)})}):a.jsx("div",{className:"text-gray-500 text-center py-8",children:"Loading worktree info..."})}),rl=(0,l.memo)(function({activeTab:e,worktreeId:t,worktree:r,messages:s,terminalOutput:n,isTerminalActive:l,isThinking:i,onFilePathClick:o,onFileSelect:c,onWorktreeUpdate:d,onNewFile:u,onNewDirectory:m,onRename:p,onDelete:h,onUpload:f,onMove:x,refreshTrigger:y,fileSearch:b,showToast:v}){switch(e){case"terminal":return a.jsx(g,{componentName:"TerminalDisplay",children:a.jsx(L,{output:n,isActive:l,isThinking:i,className:"h-full"})});case"history":return a.jsx(g,{componentName:"HistoryPane",children:a.jsx(X,{messages:s,worktreeId:t,onFilePathClick:o,className:"h-full",showToast:v})});case"files":return a.jsx(g,{componentName:"FileTreeView",children:(0,a.jsxs)("div",{className:"h-full flex flex-col",children:[a.jsx(eB,{query:b.query,mode:b.mode,isSearching:b.isSearching,error:b.error,onQueryChange:b.setQuery,onModeChange:b.setMode,onClear:b.clearSearch}),a.jsx(eF,{worktreeId:t,onFileSelect:c,onNewFile:u,onNewDirectory:m,onRename:p,onDelete:h,onUpload:f,onMove:x,refreshTrigger:y,searchQuery:b.query,searchMode:b.mode,searchResults:b.results?.results,className:"flex-1 min-h-0"})]})});case"memo":return a.jsx(g,{componentName:"MemoPane",children:a.jsx(tD,{worktreeId:t,className:"h-full"})});case"info":return a.jsx(rn,{worktreeId:t,worktree:r,onWorktreeUpdate:d});default:return null}}),ri=(0,l.memo)(function({worktreeId:e}){let t=(0,s.useRouter)(),r=(0,h.d)(),{toggle:n,openMobileDrawer:i}=(0,f.Sz)(),{state:o,actions:c}=function(){let[e,t]=(0,l.useReducer)(p,void 0,m),r=(0,l.useMemo)(()=>({setPhase:e=>t({type:"SET_PHASE",phase:e}),setTerminalOutput:(e,r)=>t({type:"SET_TERMINAL_OUTPUT",output:e,realtimeSnippet:r}),setTerminalActive:e=>t({type:"SET_TERMINAL_ACTIVE",isActive:e}),setTerminalThinking:e=>t({type:"SET_TERMINAL_THINKING",isThinking:e}),showPrompt:(e,r)=>t({type:"SHOW_PROMPT",data:e,messageId:r}),clearPrompt:()=>t({type:"CLEAR_PROMPT"}),setPromptAnswering:e=>t({type:"SET_PROMPT_ANSWERING",answering:e}),setError:e=>t({type:"SET_ERROR",error:e}),clearError:()=>t({type:"CLEAR_ERROR"}),setMessages:e=>t({type:"SET_MESSAGES",messages:e}),addMessage:e=>t({type:"ADD_MESSAGE",message:e}),updateMessage:(e,r)=>t({type:"UPDATE_MESSAGE",id:e,updates:r}),clearMessages:()=>t({type:"CLEAR_MESSAGES"}),startWaitingForResponse:e=>t({type:"START_WAITING_FOR_RESPONSE",cliToolId:e}),responseReceived:e=>t({type:"RESPONSE_RECEIVED",message:e}),sessionEnded:()=>t({type:"SESSION_ENDED"}),setAutoScroll:e=>t({type:"SET_AUTO_SCROLL",enabled:e}),setMobileActivePane:e=>t({type:"SET_MOBILE_ACTIVE_PANE",pane:e}),setLeftPaneTab:e=>t({type:"SET_LEFT_PANE_TAB",tab:e}),setLayoutMode:e=>t({type:"SET_LAYOUT_MODE",mode:e}),setSplitRatio:e=>t({type:"SET_SPLIT_RATIO",ratio:e}),setWsConnected:e=>t({type:"SET_WS_CONNECTED",connected:e})}),[]);return{state:e,dispatch:t,actions:r}}(),d=(0,x.T)("worktree"),u=(0,x.T)("error"),y=(0,x.T)("common"),b=(0,x.T)("autoYes"),[v,w]=(0,l.useState)(null),[j,N]=(0,l.useState)(!0),[k,C]=(0,l.useState)(null),[S,T]=(0,l.useState)(!1),[E,A]=(0,l.useState)(null),[R,_]=(0,l.useState)(null),[O,P]=(0,l.useState)(!1),[I,D]=(0,l.useState)(!1),[$,F]=(0,l.useState)(null),z=(0,l.useRef)(!1),[H,W]=(0,l.useState)(!1),[B,U]=(0,l.useState)("claude"),G=(0,l.useRef)(B);G.current=B;let[V,q]=(0,l.useState)(0),Y=function(e){let{worktreeId:t,initialMode:r="name",debounceMs:a=300}=e,[s,n]=(0,l.useState)(""),[i,o]=(0,l.useState)(""),[c,d]=(0,l.useState)(r),[u,m]=(0,l.useState)(!1),[p,h]=(0,l.useState)(null),[f,x]=(0,l.useState)(null),g=(0,l.useRef)(null),y=(0,l.useMemo)(()=>(0,ei.Ds)(e=>{o(e)},a),[a]),b=(0,l.useCallback)(e=>{n(e),y(e),x(null)},[y]),v=(0,l.useCallback)(()=>{n(""),o(""),h(null),x(null),m(!1),g.current&&(g.current.abort(),g.current=null)},[]),w=(0,l.useCallback)(e=>{if(!i.trim())return e;let t=i.toLowerCase();return e.filter(e=>e.name.toLowerCase().includes(t))},[i]),j=(0,l.useCallback)(()=>p&&0!==p.results.length?(0,ei.Ps)(p.results.map(e=>e.filePath)):new Set,[p]);return{query:s,mode:c,isSearching:u,results:p,error:f,setQuery:b,setMode:d,clearSearch:v,filterByName:w,getMatchedPaths:j}}({worktreeId:e}),Z=(0,l.useRef)(!1),K=(0,l.useRef)(e);(0,l.useEffect)(()=>{K.current!==e&&(c.clearMessages(),Z.current=!1,c.setTerminalOutput("",""),K.current=e)},[e,c]);let J=(0,l.useCallback)(async()=>{try{let t=await fetch(`/api/worktrees/${e}`);if(!t.ok)throw Error(`Failed to fetch worktree: ${t.status}`);let r=await t.json();return w(r),r}catch(e){return C(e instanceof Error?e.message:"Unknown error"),null}},[e]),Q=(0,l.useCallback)(async()=>{try{let t=await fetch(`/api/worktrees/${e}/messages?cliTool=${G.current}`);if(!t.ok)throw Error(`Failed to fetch messages: ${t.status}`);let r=await t.json();c.setMessages(r.map(e=>({...e,timestamp:new Date(e.timestamp)})))}catch(e){console.error("[WorktreeDetailRefactored] Error fetching messages:",e)}},[e,c]),ee=(0,l.useCallback)(async()=>{try{let t=await fetch(`/api/worktrees/${e}/current-output?cliTool=${G.current}`);if(!t.ok)return;let r=await t.json(),a=r.fullOutput??r.realtimeSnippet??"";if((a||r.isRunning)&&c.setTerminalOutput(a,r.realtimeSnippet??""),c.setTerminalActive(r.isRunning??!1),c.setTerminalThinking(r.thinking??!1),r.isPromptWaiting&&r.promptData?c.showPrompt(r.promptData,`prompt-${Date.now()}`):!r.isPromptWaiting&&o.prompt.visible&&c.clearPrompt(),r.autoYes){let e=z.current;D(r.autoYes.enabled),F(r.autoYes.expiresAt),z.current=r.autoYes.enabled,e&&!r.autoYes.enabled&&"stop_pattern_matched"===r.autoYes.stopReason&&W(!0)}}catch(e){console.error("[WorktreeDetailRefactored] Error fetching current output:",e)}},[e,c,o.prompt.visible]),et=(0,l.useRef)(B);(0,l.useEffect)(()=>{et.current!==B&&(et.current=B,c.clearMessages(),c.setTerminalOutput("",""),Q(),ee())},[B,c,Q,ee]);let er=(0,l.useCallback)(e=>{A(e)},[]),ea=(0,l.useCallback)(e=>{let t=e.split(".").pop()?.toLowerCase(),r=t?`.${t}`:"";tA.includes(r)?_(e):A(e)},[]),es=(0,l.useCallback)(()=>{A(null)},[]),eo=(0,l.useCallback)(()=>{_(null)},[]),ec=(0,l.useCallback)(e=>{q(e=>e+1)},[]),eu=(0,l.useCallback)(e=>{c.setLeftPaneTab(e)},[c]),em=(0,l.useCallback)(()=>{t.push("/")},[t]),ep=(0,l.useCallback)(()=>{T(!0)},[]),eh=(0,l.useCallback)(()=>{T(!1)},[]),ex=(0,l.useCallback)(async t=>{c.setPromptAnswering(!0);try{let r=function(e,t,r){let a={answer:e,cliTool:t};if(r&&(a.promptType=r.type,"multiple_choice"===r.type)){let e=r.options.find(e=>e.isDefault);e&&(a.defaultOptionNumber=e.number)}return a}(t,B,o.prompt.data),a=await fetch(`/api/worktrees/${e}/prompt-response`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!a.ok)throw Error(`Failed to send prompt response: ${a.status}`);c.clearPrompt(),await ee()}catch(e){console.error("[WorktreeDetailRefactored] Error sending prompt response:",e)}finally{c.setPromptAnswering(!1)}},[e,c,ee,B,o.prompt.data]),ey=(0,l.useCallback)(()=>{c.clearPrompt()},[c]),eb=(0,l.useCallback)(e=>{c.setMobileActivePane(e)},[c]),ev=(0,l.useCallback)(e=>{c.setAutoScroll(e)},[c]),ej=(0,l.useCallback)(()=>{Q(),ee()},[Q,ee]),eN=(0,l.useCallback)(async t=>{try{let r=await fetch(`/api/worktrees/${e}/auto-yes`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:t.enabled,cliToolId:B,duration:t.duration,stopPattern:t.stopPattern})});if(r.ok){let e=await r.json();D(e.enabled),F(e.expiresAt),z.current=e.enabled}}catch(e){console.error("[WorktreeDetailRefactored] Error toggling auto-yes:",e)}},[e,B]),[ek,eC]=(0,l.useState)(!1),eS=(0,l.useCallback)(()=>{eC(!0)},[]),eT=(0,l.useCallback)(async()=>{eC(!1);try{if(!(await fetch(`/api/worktrees/${e}/kill-session?cliTool=${B}`,{method:"POST"})).ok)return;c.clearMessages(),c.setTerminalOutput("",""),c.setTerminalActive(!1),c.setTerminalThinking(!1),c.clearPrompt(),await J()}catch(e){console.error("[WorktreeDetailRefactored] Error killing session:",e)}},[e,B,c,J]),eE=(0,l.useCallback)(()=>{eC(!1)},[]),eM=(0,l.useCallback)(async t=>{let r=window.prompt("Enter file name (e.g., document.md):");if(!r)return;let a=r.endsWith(".md")?r:`${r}.md`,s=t?`${t}/${a}`:a;try{if(!(await fetch(`/api/worktrees/${e}/files/${t8(s)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"file",content:""})})).ok)throw Error("Failed to create file");q(e=>e+1)}catch(e){console.error("[WorktreeDetailRefactored] Failed to create file:",e),window.alert(u("fileOps.failedToCreateFile"))}},[e,u]),eA=(0,l.useCallback)(async t=>{let r=window.prompt("Enter directory name:");if(!r)return;let a=t?`${t}/${r}`:r;try{if(!(await fetch(`/api/worktrees/${e}/files/${t8(a)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"directory"})})).ok)throw Error("Failed to create directory");q(e=>e+1)}catch(e){console.error("[WorktreeDetailRefactored] Failed to create directory:",e),window.alert(u("fileOps.failedToCreateDirectory"))}},[e,u]),eR=(0,l.useCallback)(async t=>{let r=t.split("/").pop()||"",a=window.prompt("Enter new name:",r);if(a&&a!==r)try{if(!(await fetch(`/api/worktrees/${e}/files/${t8(t)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"rename",newName:a})})).ok)throw Error("Failed to rename");q(e=>e+1)}catch(e){console.error("[WorktreeDetailRefactored] Failed to rename:",e),window.alert(u("fileOps.failedToRename"))}},[e,u]),e_=(0,l.useCallback)(async t=>{let r=t.split("/").pop()||t;if(window.confirm(y("confirmDelete",{name:r})))try{if(!(await fetch(`/api/worktrees/${e}/files/${t8(t)}?recursive=true`,{method:"DELETE"})).ok)throw Error("Failed to delete");(R===t||R?.startsWith(`${t}/`))&&_(null),q(e=>e+1)}catch(e){console.error("[WorktreeDetailRefactored] Failed to delete:",e),window.alert(u("fileOps.failedToDelete"))}},[e,R,y,u]),{toasts:eO,showToast:eP,removeToast:eL}=(0,th.pm)();(0,l.useEffect)(()=>{H&&(eP(b("stopPatternMatched"),"info"),W(!1))},[H,eP,b]);let{moveTarget:eI,isMoveDialogOpen:eD,handleMove:e$,handleMoveConfirm:ez,handleMoveCancel:eH}=function(e,t,r,a){let[s,n]=(0,l.useState)(null),[i,o]=(0,l.useState)(!1),c=(0,l.useCallback)((e,t)=>{n({path:e,type:t}),o(!0)},[]),d=(0,l.useCallback)(async l=>{if(s)try{let n=await fetch(`/api/worktrees/${e}/files/${s.path}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"move",destination:l})}),i=await n.json();if(!n.ok||!i.success){let e=i.error?.message||"Failed to move";a?.(e);return}r?.("Moved successfully"),t()}catch{a?.("Failed to move")}finally{n(null),o(!1)}},[s,e,t,r,a]);return{moveTarget:s,isMoveDialogOpen:i,handleMove:c,handleMoveConfirm:d,handleMoveCancel:(0,l.useCallback)(()=>{n(null),o(!1)},[])}}(e,()=>q(e=>e+1),e=>eP(e,"success"),e=>eP(e,"error")),eW=(0,l.useRef)(null),eU=(0,l.useRef)(""),eG=(0,l.useCallback)(e=>{eU.current=e,eW.current?.click()},[]),eV=(0,l.useCallback)(async t=>{let r=t.target.files?.[0];if(!r)return;t.target.value="";let a=eU.current,s=`.${r.name.split(".").pop()?.toLowerCase()}`;if(!function(e){if(!e)return!1;let t=e.toLowerCase();return t_.includes(t)}(s)){eP(`Unsupported file type: ${s}. Allowed: ${t_.join(", ")}`,"error");return}let n=function(e){let t=function(e){let t=e.toLowerCase();return tR.find(e=>e.extension===t)}(e);return t?.maxFileSize??5242880}(s);if(r.size>n){eP(`File too large. Maximum size: ${(n/1024/1024).toFixed(1)}MB`,"error");return}let l=new FormData;l.append("file",r);try{let t=await fetch(`/api/worktrees/${e}/upload/${t8(a||".")}`,{method:"POST",body:l});if(!t.ok){let e=await t.json().catch(()=>({})),r=e?.error?.message||"Failed to upload file";eP(r,"error");return}let r=await t.json();eP(`Uploaded: ${r.filename}`,"success"),q(e=>e+1)}catch(e){console.error("[WorktreeDetailRefactored] Failed to upload:",e),eP("Upload failed. Please try again.","error")}},[e,eP]),{data:eq}=tF(),eZ=eq?.hasUpdate??!1,{lastAutoResponse:eK}=function({worktreeId:e,cliTool:t,isPromptWaiting:r,promptData:a,autoYesEnabled:s,lastServerResponseTimestamp:n}){(0,l.useRef)(null);let[i,o]=(0,l.useState)(null);return{lastAutoResponse:i}}({worktreeId:e,cliTool:B,isPromptWaiting:o.prompt.visible,promptData:o.prompt.data,autoYesEnabled:I}),eX=(0,l.useCallback)(async()=>{C(null),N(!0),await J()&&await Promise.all([Q(),ee()]),N(!1)},[J,Q,ee]),eJ=(0,l.useRef)(0),e0=(0,l.useCallback)(async()=>{if("visible"!==document.visibilityState)return;let e=Date.now();if(!(e-eJ.current<5e3)){if(eJ.current=e,k){eX();return}try{await Promise.all([J(),Q(),ee()])}finally{C(null)}}},[k,eX,J,Q,ee]);(0,l.useEffect)(()=>{if(Z.current)return;let e=!0;return(async()=>{N(!0);let t=await J();e&&(t&&await Promise.all([Q(),ee()]),e&&(N(!1),Z.current=!0))})(),()=>{e=!1}},[J,Q,ee]),(0,l.useEffect)(()=>(document.addEventListener("visibilitychange",e0),()=>{document.removeEventListener("visibilitychange",e0)}),[e0]),(0,l.useEffect)(()=>{if(j||k)return;let e=setInterval(async()=>{await Promise.all([ee(),J(),Q()])},o.terminal.isActive?2e3:5e3);return()=>clearInterval(e)},[j,k,ee,J,Q,o.terminal.isActive]),(0,l.useEffect)(()=>{c.setLayoutMode(r?"tabs":"split")},[r,c]);let e1=(0,l.useMemo)(()=>(function(e,t,r="claude"){if(t)return"error";if(!e)return"idle";let a=e.sessionStatusByCli?.[r];if(a){if(a.isWaitingForResponse)return"waiting";if(a.isProcessing)return"running";if(a.isRunning)return"ready"}if("claude"===r){if(e.isWaitingForResponse)return"waiting";if(e.isProcessing)return"running";if(e.isSessionRunning)return"ready"}return"idle"})(v,null!==o.error.type,B),[v,o.error.type,B]),e2=(0,l.useMemo)(()=>o.layout.mobileActivePane,[o.layout.mobileActivePane]),e4=(0,l.useMemo)(()=>o.layout.leftPaneTab,[o.layout.leftPaneTab]),e5=v?.name??"Unknown";return j?a.jsx(ra,{}):k?a.jsx(rs,{message:k,onRetry:eX}):r?a.jsx(g,{componentName:"WorktreeDetailRefactored",children:(0,a.jsxs)("div",{className:"h-full flex flex-col",children:[a.jsx(ed,{worktreeName:e5,repositoryName:v?.repositoryName,status:e1,gitStatus:v?.gitStatus,onBackClick:em,onMenuClick:i}),v?.gitStatus&&v.gitStatus.isBranchMismatch&&a.jsx("div",{className:"fixed top-14 inset-x-0 z-35",children:a.jsx(t1,{isBranchMismatch:v.gitStatus.isBranchMismatch,currentBranch:v.gitStatus.currentBranch,initialBranch:v.gitStatus.initialBranch})}),(0,a.jsxs)("div",{className:"fixed top-14 inset-x-0 z-30 flex items-center justify-between px-3 py-1.5 bg-gray-50 border-b border-gray-200",children:[a.jsx(t0,{enabled:I,expiresAt:$,onToggle:eN,lastAutoResponse:eK,cliToolName:B,inline:!0}),(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[a.jsx("nav",{className:"flex gap-2","aria-label":"CLI Tool Selection",children:["claude","codex"].map(e=>{let t=(0,t2.He)(v?.sessionStatusByCli?.[e]),r=el.F4[t];return(0,a.jsxs)("button",{onClick:()=>U(e),className:`px-1.5 py-0.5 rounded font-medium text-xs transition-colors flex items-center gap-1 ${B===e?"bg-blue-100 text-blue-700":"text-gray-500 hover:text-gray-700"}`,"aria-current":B===e?"page":void 0,children:["spinner"===r.type?a.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 border-2 border-t-transparent animate-spin ${r.className}`,title:r.label}):a.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${r.className}`,title:r.label}),t7(e)]},e)})}),(0,a.jsxs)("button",{onClick:eS,disabled:!v?.sessionStatusByCli?.[B]?.isRunning,className:`flex items-center gap-0.5 px-1.5 py-0.5 text-xs font-medium rounded transition-colors ${v?.sessionStatusByCli?.[B]?.isRunning?"text-red-600 hover:bg-red-50":"invisible"}`,"aria-label":`End ${B} session`,children:[a.jsx("span",{"aria-hidden":"true",children:"✕"}),"End"]})]})]}),a.jsx("main",{className:"flex-1 pt-[6.25rem] pb-32 overflow-hidden",style:{paddingBottom:"calc(8rem + env(safe-area-inset-bottom, 0px))"},children:a.jsx(rl,{activeTab:e2,worktreeId:e,worktree:v,messages:o.messages,terminalOutput:o.terminal.output,isTerminalActive:o.terminal.isActive,isThinking:o.terminal.isThinking,onFilePathClick:er,onFileSelect:ea,onWorktreeUpdate:w,onNewFile:eM,onNewDirectory:eA,onRename:eR,onDelete:e_,onUpload:eG,onMove:e$,refreshTrigger:V,fileSearch:Y,showToast:eP})}),a.jsx("div",{className:"fixed left-0 right-0 border-t border-gray-200 bg-white p-2 z-30",style:{bottom:"calc(4rem + env(safe-area-inset-bottom, 0px))"},children:a.jsx(ew.R,{worktreeId:e,onMessageSent:ej,cliToolId:B,isSessionRunning:o.terminal.isActive})}),a.jsx(ef,{activeTab:e2,onTabChange:eb,hasNewOutput:!1,hasPrompt:o.prompt.visible,hasUpdate:eZ}),!I&&a.jsx(eg,{promptData:o.prompt.data,visible:o.prompt.visible,answering:o.prompt.answering,onRespond:ex,onDismiss:ey}),a.jsx(eQ,{isOpen:null!==E,onClose:es,worktreeId:e,filePath:E??""}),R&&a.jsx(tZ.u,{isOpen:!0,onClose:eo,title:R.split("/").pop()||"Editor",size:"full",disableClose:O,children:a.jsx("div",{className:"h-[80vh]",children:a.jsx(tM,{worktreeId:e,filePath:R,onClose:eo,onSave:ec,onMaximizedChange:P})})}),a.jsx("input",{ref:eW,type:"file",accept:t_.join(","),onChange:eV,className:"hidden","aria-label":"Upload file"}),a.jsx(tZ.u,{isOpen:ek,onClose:eE,title:d("session.confirmEnd",{tool:t7(B)}),size:"sm",showCloseButton:!0,children:(0,a.jsxs)("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-gray-700",children:d("session.endWarning")}),(0,a.jsxs)("div",{className:"flex justify-end gap-3 pt-2",children:[a.jsx("button",{type:"button",onClick:eE,className:"px-4 py-2 text-sm font-medium rounded-md bg-gray-200 hover:bg-gray-300 text-gray-700",children:y("cancel")}),a.jsx("button",{type:"button",onClick:eT,className:"px-4 py-2 text-sm font-medium rounded-md bg-red-600 hover:bg-red-700 text-white",children:y("end")})]})]})}),eI&&a.jsx(t6,{isOpen:eD,onClose:eH,onConfirm:ez,worktreeId:e,sourcePath:eI.path,sourceType:eI.type}),a.jsx(th.Ix,{toasts:eO,onClose:eL})]})}):a.jsx(g,{componentName:"WorktreeDetailRefactored",children:(0,a.jsxs)("div",{className:"h-full flex flex-col relative",children:[a.jsx(rt,{worktreeName:e5,repositoryName:v?.repositoryName??"Unknown",description:v?.description,status:e1,gitStatus:v?.gitStatus,onBackClick:em,onInfoClick:ep,onMenuClick:n,hasUpdate:eZ}),(0,a.jsxs)("div",{className:"px-4 py-2 bg-white border-b border-gray-200 flex items-center justify-between",children:[a.jsx("nav",{className:"flex gap-4","aria-label":"CLI Tool Selection",children:["claude","codex"].map(e=>{let t=(0,t2.He)(v?.sessionStatusByCli?.[e]),r=el.F4[t];return(0,a.jsxs)("button",{onClick:()=>U(e),className:`pb-2 px-2 border-b-2 font-medium text-sm transition-colors flex items-center gap-1.5 ${B===e?"border-blue-600 text-blue-600":"border-transparent text-gray-600 hover:text-gray-900"}`,"aria-current":B===e?"page":void 0,children:["spinner"===r.type?a.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 border-2 border-t-transparent animate-spin ${r.className}`,title:r.label,"aria-label":`${e} status: ${r.label}`}):a.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${r.className}`,title:r.label,"aria-label":`${e} status: ${r.label}`}),t7(e)]},e)})}),v?.sessionStatusByCli?.[B]?.isRunning&&(0,a.jsxs)("button",{onClick:eS,className:"flex items-center gap-1 px-2 py-1 text-xs font-medium text-red-600 hover:text-red-800 hover:bg-red-50 rounded transition-colors","aria-label":`End ${B} session`,children:[a.jsx("span",{"aria-hidden":"true",children:"✕"}),"End Session"]})]}),v?.gitStatus&&a.jsx(t1,{isBranchMismatch:v.gitStatus.isBranchMismatch,currentBranch:v.gitStatus.currentBranch,initialBranch:v.gitStatus.initialBranch}),a.jsx("div",{className:"flex-1 min-h-0",children:a.jsx(M,{leftPane:(0,a.jsxs)("div",{className:"h-full flex flex-col",children:[a.jsx(eY,{activeTab:e4,onTabChange:eu}),(0,a.jsxs)("div",{className:"flex-1 min-h-0 overflow-hidden",children:["history"===e4&&a.jsx(X,{messages:o.messages,worktreeId:e,onFilePathClick:er,className:"h-full",showToast:eP}),"files"===e4&&a.jsx(g,{componentName:"FileTreeView",children:(0,a.jsxs)("div",{className:"h-full flex flex-col",children:[a.jsx(eB,{query:Y.query,mode:Y.mode,isSearching:Y.isSearching,error:Y.error,onQueryChange:Y.setQuery,onModeChange:Y.setMode,onClear:Y.clearSearch}),a.jsx(eF,{worktreeId:e,onFileSelect:ea,onNewFile:eM,onNewDirectory:eA,onRename:eR,onDelete:e_,onUpload:eG,onMove:e$,refreshTrigger:V,searchQuery:Y.query,searchMode:Y.mode,searchResults:Y.results?.results,className:"flex-1 min-h-0"})]})}),"memo"===e4&&a.jsx(g,{componentName:"MemoPane",children:a.jsx(tD,{worktreeId:e,className:"h-full"})})]})]}),rightPane:a.jsx(L,{output:o.terminal.output,isActive:o.terminal.isActive,isThinking:o.terminal.isThinking,autoScroll:o.terminal.autoScroll,onScrollChange:ev}),initialLeftWidth:40,minLeftWidth:20,maxLeftWidth:60})}),a.jsx("div",{className:"flex-shrink-0 border-t border-gray-200 p-4 bg-gray-50",children:a.jsx(ew.R,{worktreeId:e,onMessageSent:ej,cliToolId:B,isSessionRunning:o.terminal.isActive})}),a.jsx(t0,{enabled:I,expiresAt:$,onToggle:eN,lastAutoResponse:eK,cliToolName:B}),o.prompt.visible&&!I&&a.jsx("div",{className:"fixed bottom-20 left-1/2 transform -translate-x-1/2 z-50 w-full max-w-2xl px-4",children:a.jsx(en,{promptData:o.prompt.data,messageId:o.prompt.messageId,visible:o.prompt.visible,answering:o.prompt.answering,onRespond:ex,onDismiss:ey})}),a.jsx(rr,{worktreeId:e,worktree:v,isOpen:S,onClose:eh,onWorktreeUpdate:w}),a.jsx(eQ,{isOpen:null!==E,onClose:es,worktreeId:e,filePath:E??""}),R&&a.jsx(tZ.u,{isOpen:!0,onClose:eo,title:R.split("/").pop()||"Editor",size:"full",disableClose:O,children:a.jsx("div",{className:"h-[80vh]",children:a.jsx(tM,{worktreeId:e,filePath:R,onClose:eo,onSave:ec,onMaximizedChange:P})})}),a.jsx("input",{ref:eW,type:"file",accept:t_.join(","),onChange:eV,className:"hidden","aria-label":"Upload file"}),a.jsx(tZ.u,{isOpen:ek,onClose:eE,title:d("session.confirmEnd",{tool:t7(B)}),size:"sm",showCloseButton:!0,children:(0,a.jsxs)("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-gray-700",children:d("session.endWarning")}),(0,a.jsxs)("div",{className:"flex justify-end gap-3 pt-2",children:[a.jsx("button",{type:"button",onClick:eE,className:"px-4 py-2 text-sm font-medium rounded-md bg-gray-200 hover:bg-gray-300 text-gray-700",children:y("cancel")}),a.jsx("button",{type:"button",onClick:eT,className:"px-4 py-2 text-sm font-medium rounded-md bg-red-600 hover:bg-red-700 text-white",children:y("end")})]})]})}),eI&&a.jsx(t6,{isOpen:eD,onClose:eH,onConfirm:ez,worktreeId:e,sourcePath:eI.path,sourceType:eI.type}),a.jsx(th.Ix,{toasts:eO,onClose:eL})]})})});function ro(){let e=(0,s.useParams)().id;return a.jsx(n.Vw,{children:a.jsx(ri,{worktreeId:e})})}},81194:(e,t,r)=>{"use strict";r.d(t,{O:()=>n});var a=r(10326),s=r(17577);function n({src:e,alt:t,onError:r}){let[n,l]=(0,s.useState)(!1);return n?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500",children:[a.jsx("svg",{className:"w-16 h-16 mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})}),a.jsx("p",{className:"text-sm",children:"Failed to load image"}),a.jsx("p",{className:"text-xs text-gray-400 mt-1",children:t})]}):a.jsx("div",{className:"flex items-center justify-center p-4",children:a.jsx("img",{src:e,alt:t,onError:()=>{l(!0),r?.()},style:{maxWidth:"100%",maxHeight:"500px",objectFit:"contain"},className:"rounded-lg shadow-sm"})})}},89918:(e,t,r)=>{"use strict";r.d(t,{R:()=>n});var a=r(10326),s=r(17577);function n({src:e,onError:t}){let[r,n]=(0,s.useState)(!0),[l,i]=(0,s.useState)(!1);return l?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500",children:[a.jsx("svg",{className:"w-16 h-16 mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z"})}),a.jsx("p",{className:"text-sm",children:"Failed to load video"})]}):(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center p-4",children:[r&&(0,a.jsxs)("div",{className:"flex items-center justify-center py-8",children:[a.jsx("div",{className:"inline-block animate-spin rounded-full h-8 w-8 border-4 border-gray-300 border-t-blue-600"}),a.jsx("p",{className:"ml-3 text-gray-600",children:"Loading video..."})]}),a.jsx("video",{controls:!0,src:e,onLoadedData:()=>{n(!1)},onError:()=>{n(!1),i(!0),t?.()},style:{maxWidth:"100%",maxHeight:"500px",display:r?"none":"block"},className:"rounded-lg shadow-sm",children:"Your browser does not support the video tag."})]})}},22570:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>a});let a=(0,r(68570).createProxy)(String.raw`/home/runner/work/CommandMate/CommandMate/src/app/worktrees/[id]/page.tsx#default`)},4803:()=>{},63817:(e,t,r)=>{"use strict";let a=r(51387),s=a.types;function n(e,t){var r;t||(t={});let n=void 0===t.limit?25:t.limit;(r=e,"[object RegExp]"===({}).toString.call(r))?e=e.source:"string"!=typeof e&&(e=String(e));try{e=a(e)}catch{return!1}let l=0;return function e(t,r){let a,i;if(t.type===s.REPETITION&&(r++,l++,r>1||l>n))return!1;if(t.options){for(a=0,i=t.options.length;a<i;a++)if(!e({stack:t.options[a]},r))return!1}let o=t.stack||t.value?.stack;if(!o)return!0;for(a=0;a<o.length;a++)if(!e(o[a],r))return!1;return!0}(e,0)}e.exports=n,e.exports.default=n,e.exports.safeRegex=n}};var t=require("../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),a=t.X(0,[8948,3294,6621,8705,7458,7808,3860,539],()=>r(80205));module.exports=a})();
@@ -1 +1 @@
1
- globalThis.__RSC_MANIFEST=(globalThis.__RSC_MANIFEST||{});globalThis.__RSC_MANIFEST["/worktrees/[id]/page"]={"moduleLoading":{"prefix":"/_next/","crossOrigin":null},"ssrModuleMapping":{"80":{"*":{"id":"41868","name":"*","chunks":[],"async":false}},"4707":{"*":{"id":"79671","name":"*","chunks":[],"async":false}},"12846":{"*":{"id":"12994","name":"*","chunks":[],"async":false}},"18390":{"*":{"id":"74810","name":"*","chunks":[],"async":false}},"18828":{"*":{"id":"2108","name":"*","chunks":[],"async":false}},"19107":{"*":{"id":"96114","name":"*","chunks":[],"async":false}},"36423":{"*":{"id":"84759","name":"*","chunks":[],"async":false}},"38991":{"*":{"id":"24146","name":"*","chunks":[],"async":false}},"41845":{"*":{"id":"37398","name":"*","chunks":[],"async":false}},"50653":{"*":{"id":"84442","name":"*","chunks":[],"async":false}},"61060":{"*":{"id":"9727","name":"*","chunks":[],"async":false}},"66677":{"*":{"id":"42106","name":"*","chunks":[],"async":false}}},"edgeSSRModuleMapping":{},"clientModules":{"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/client/components/app-router.js":{"id":12846,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/esm/client/components/app-router.js":{"id":12846,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/client/components/client-page.js":{"id":19107,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/esm/client/components/client-page.js":{"id":19107,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/client/components/error-boundary.js":{"id":61060,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/esm/client/components/error-boundary.js":{"id":61060,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/client/components/layout-router.js":{"id":4707,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/esm/client/components/layout-router.js":{"id":4707,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/client/components/not-found-boundary.js":{"id":80,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/esm/client/components/not-found-boundary.js":{"id":80,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/client/components/render-from-template-context.js":{"id":36423,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/esm/client/components/render-from-template-context.js":{"id":36423,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/src/app/globals.css":{"id":2778,"name":"*","chunks":["9234","static/chunks/9234-b0304101384ca079.js","8528","static/chunks/8528-4d554d3b94d4cf9b.js","3185","static/chunks/app/layout-9110f9a5e41c6bf4.js"],"async":false},"/home/runner/work/CommandMate/CommandMate/src/components/providers/AppProviders.tsx":{"id":18828,"name":"*","chunks":["9234","static/chunks/9234-b0304101384ca079.js","8528","static/chunks/8528-4d554d3b94d4cf9b.js","3185","static/chunks/app/layout-9110f9a5e41c6bf4.js"],"async":false},"/home/runner/work/CommandMate/CommandMate/src/app/login/page.tsx":{"id":38991,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/src/app/page.tsx":{"id":66677,"name":"*","chunks":["9234","static/chunks/9234-b0304101384ca079.js","216","static/chunks/216-f18f4a9d8b04a91e.js","2335","static/chunks/2335-98a211e00b94c7ac.js","8528","static/chunks/8528-4d554d3b94d4cf9b.js","8091","static/chunks/8091-925542bdfc843dce.js","1931","static/chunks/app/page-238b5a70d8c101e9.js"],"async":false},"/home/runner/work/CommandMate/CommandMate/src/app/worktrees/[id]/files/[...path]/page.tsx":{"id":50653,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/src/app/worktrees/[id]/page.tsx":{"id":18390,"name":"*","chunks":["9234","static/chunks/9234-b0304101384ca079.js","216","static/chunks/216-f18f4a9d8b04a91e.js","1038","static/chunks/1038-3509435b68c0967e.js","2335","static/chunks/2335-98a211e00b94c7ac.js","9178","static/chunks/9178-88850a7c48deea07.js","8528","static/chunks/8528-4d554d3b94d4cf9b.js","8091","static/chunks/8091-925542bdfc843dce.js","130","static/chunks/app/worktrees/%5Bid%5D/page-9418e49bdc1de02c.js"],"async":false},"/home/runner/work/CommandMate/CommandMate/src/app/worktrees/[id]/terminal/page.tsx":{"id":41845,"name":"*","chunks":[],"async":false}},"entryCSSFiles":{"/home/runner/work/CommandMate/CommandMate/src/":[],"/home/runner/work/CommandMate/CommandMate/src/app/layout":["static/css/b9ea6a4fad17dc32.css"],"/home/runner/work/CommandMate/CommandMate/src/app/page":[],"/home/runner/work/CommandMate/CommandMate/src/app/worktrees/[id]/page":["static/css/5eacd01f773eed7f.css"]}}
1
+ globalThis.__RSC_MANIFEST=(globalThis.__RSC_MANIFEST||{});globalThis.__RSC_MANIFEST["/worktrees/[id]/page"]={"moduleLoading":{"prefix":"/_next/","crossOrigin":null},"ssrModuleMapping":{"80":{"*":{"id":"41868","name":"*","chunks":[],"async":false}},"4707":{"*":{"id":"79671","name":"*","chunks":[],"async":false}},"12846":{"*":{"id":"12994","name":"*","chunks":[],"async":false}},"18390":{"*":{"id":"74810","name":"*","chunks":[],"async":false}},"18828":{"*":{"id":"2108","name":"*","chunks":[],"async":false}},"19107":{"*":{"id":"96114","name":"*","chunks":[],"async":false}},"36423":{"*":{"id":"84759","name":"*","chunks":[],"async":false}},"38991":{"*":{"id":"24146","name":"*","chunks":[],"async":false}},"41845":{"*":{"id":"37398","name":"*","chunks":[],"async":false}},"50653":{"*":{"id":"84442","name":"*","chunks":[],"async":false}},"61060":{"*":{"id":"9727","name":"*","chunks":[],"async":false}},"66677":{"*":{"id":"42106","name":"*","chunks":[],"async":false}}},"edgeSSRModuleMapping":{},"clientModules":{"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/client/components/app-router.js":{"id":12846,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/esm/client/components/app-router.js":{"id":12846,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/client/components/client-page.js":{"id":19107,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/esm/client/components/client-page.js":{"id":19107,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/client/components/error-boundary.js":{"id":61060,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/esm/client/components/error-boundary.js":{"id":61060,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/client/components/layout-router.js":{"id":4707,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/esm/client/components/layout-router.js":{"id":4707,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/client/components/not-found-boundary.js":{"id":80,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/esm/client/components/not-found-boundary.js":{"id":80,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/client/components/render-from-template-context.js":{"id":36423,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/esm/client/components/render-from-template-context.js":{"id":36423,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/src/app/globals.css":{"id":2778,"name":"*","chunks":["9234","static/chunks/9234-b0304101384ca079.js","8528","static/chunks/8528-4d554d3b94d4cf9b.js","3185","static/chunks/app/layout-9110f9a5e41c6bf4.js"],"async":false},"/home/runner/work/CommandMate/CommandMate/src/components/providers/AppProviders.tsx":{"id":18828,"name":"*","chunks":["9234","static/chunks/9234-b0304101384ca079.js","8528","static/chunks/8528-4d554d3b94d4cf9b.js","3185","static/chunks/app/layout-9110f9a5e41c6bf4.js"],"async":false},"/home/runner/work/CommandMate/CommandMate/src/app/page.tsx":{"id":66677,"name":"*","chunks":["9234","static/chunks/9234-b0304101384ca079.js","216","static/chunks/216-f18f4a9d8b04a91e.js","2335","static/chunks/2335-98a211e00b94c7ac.js","8528","static/chunks/8528-4d554d3b94d4cf9b.js","8091","static/chunks/8091-925542bdfc843dce.js","1931","static/chunks/app/page-238b5a70d8c101e9.js"],"async":false},"/home/runner/work/CommandMate/CommandMate/src/app/login/page.tsx":{"id":38991,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/src/app/worktrees/[id]/files/[...path]/page.tsx":{"id":50653,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/src/app/worktrees/[id]/page.tsx":{"id":18390,"name":"*","chunks":["9234","static/chunks/9234-b0304101384ca079.js","216","static/chunks/216-f18f4a9d8b04a91e.js","1038","static/chunks/1038-3509435b68c0967e.js","2335","static/chunks/2335-98a211e00b94c7ac.js","9178","static/chunks/9178-88850a7c48deea07.js","8528","static/chunks/8528-4d554d3b94d4cf9b.js","8091","static/chunks/8091-925542bdfc843dce.js","130","static/chunks/app/worktrees/%5Bid%5D/page-a556551ce5c69dec.js"],"async":false},"/home/runner/work/CommandMate/CommandMate/src/app/worktrees/[id]/terminal/page.tsx":{"id":41845,"name":"*","chunks":[],"async":false}},"entryCSSFiles":{"/home/runner/work/CommandMate/CommandMate/src/":[],"/home/runner/work/CommandMate/CommandMate/src/app/layout":["static/css/b9ea6a4fad17dc32.css"],"/home/runner/work/CommandMate/CommandMate/src/app/page":[],"/home/runner/work/CommandMate/CommandMate/src/app/worktrees/[id]/page":["static/css/5eacd01f773eed7f.css"]}}
@@ -1 +1 @@
1
- globalThis.__RSC_MANIFEST=(globalThis.__RSC_MANIFEST||{});globalThis.__RSC_MANIFEST["/worktrees/[id]/terminal/page"]={"moduleLoading":{"prefix":"/_next/","crossOrigin":null},"ssrModuleMapping":{"80":{"*":{"id":"41868","name":"*","chunks":[],"async":false}},"4707":{"*":{"id":"79671","name":"*","chunks":[],"async":false}},"12846":{"*":{"id":"12994","name":"*","chunks":[],"async":false}},"18390":{"*":{"id":"74810","name":"*","chunks":[],"async":false}},"18828":{"*":{"id":"2108","name":"*","chunks":[],"async":false}},"19107":{"*":{"id":"96114","name":"*","chunks":[],"async":false}},"36423":{"*":{"id":"84759","name":"*","chunks":[],"async":false}},"38991":{"*":{"id":"24146","name":"*","chunks":[],"async":false}},"41845":{"*":{"id":"37398","name":"*","chunks":[],"async":false}},"50653":{"*":{"id":"84442","name":"*","chunks":[],"async":false}},"61060":{"*":{"id":"9727","name":"*","chunks":[],"async":false}},"66677":{"*":{"id":"42106","name":"*","chunks":[],"async":false}}},"edgeSSRModuleMapping":{},"clientModules":{"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/client/components/app-router.js":{"id":12846,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/esm/client/components/app-router.js":{"id":12846,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/client/components/client-page.js":{"id":19107,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/esm/client/components/client-page.js":{"id":19107,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/client/components/error-boundary.js":{"id":61060,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/esm/client/components/error-boundary.js":{"id":61060,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/client/components/layout-router.js":{"id":4707,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/esm/client/components/layout-router.js":{"id":4707,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/client/components/not-found-boundary.js":{"id":80,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/esm/client/components/not-found-boundary.js":{"id":80,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/client/components/render-from-template-context.js":{"id":36423,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/esm/client/components/render-from-template-context.js":{"id":36423,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/src/app/globals.css":{"id":2778,"name":"*","chunks":["9234","static/chunks/9234-b0304101384ca079.js","8528","static/chunks/8528-4d554d3b94d4cf9b.js","3185","static/chunks/app/layout-9110f9a5e41c6bf4.js"],"async":false},"/home/runner/work/CommandMate/CommandMate/src/components/providers/AppProviders.tsx":{"id":18828,"name":"*","chunks":["9234","static/chunks/9234-b0304101384ca079.js","8528","static/chunks/8528-4d554d3b94d4cf9b.js","3185","static/chunks/app/layout-9110f9a5e41c6bf4.js"],"async":false},"/home/runner/work/CommandMate/CommandMate/src/app/login/page.tsx":{"id":38991,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/src/app/page.tsx":{"id":66677,"name":"*","chunks":["9234","static/chunks/9234-b0304101384ca079.js","216","static/chunks/216-f18f4a9d8b04a91e.js","2335","static/chunks/2335-98a211e00b94c7ac.js","8528","static/chunks/8528-4d554d3b94d4cf9b.js","8091","static/chunks/8091-925542bdfc843dce.js","1931","static/chunks/app/page-238b5a70d8c101e9.js"],"async":false},"/home/runner/work/CommandMate/CommandMate/src/app/worktrees/[id]/files/[...path]/page.tsx":{"id":50653,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/src/app/worktrees/[id]/page.tsx":{"id":18390,"name":"*","chunks":["9234","static/chunks/9234-b0304101384ca079.js","216","static/chunks/216-f18f4a9d8b04a91e.js","1038","static/chunks/1038-3509435b68c0967e.js","2335","static/chunks/2335-98a211e00b94c7ac.js","9178","static/chunks/9178-88850a7c48deea07.js","8528","static/chunks/8528-4d554d3b94d4cf9b.js","8091","static/chunks/8091-925542bdfc843dce.js","130","static/chunks/app/worktrees/%5Bid%5D/page-9418e49bdc1de02c.js"],"async":false},"/home/runner/work/CommandMate/CommandMate/src/app/worktrees/[id]/terminal/page.tsx":{"id":41845,"name":"*","chunks":["9838","static/chunks/30d07d85-393352a92199f695.js","216","static/chunks/216-f18f4a9d8b04a91e.js","1224","static/chunks/app/worktrees/%5Bid%5D/terminal/page-5d85a7e508ce36d3.js"],"async":false}},"entryCSSFiles":{"/home/runner/work/CommandMate/CommandMate/src/":[],"/home/runner/work/CommandMate/CommandMate/src/app/layout":["static/css/b9ea6a4fad17dc32.css"],"/home/runner/work/CommandMate/CommandMate/src/app/page":[],"/home/runner/work/CommandMate/CommandMate/src/app/worktrees/[id]/page":["static/css/5eacd01f773eed7f.css"],"/home/runner/work/CommandMate/CommandMate/src/app/worktrees/[id]/terminal/page":["static/css/85fa6dafca566008.css"]}}
1
+ globalThis.__RSC_MANIFEST=(globalThis.__RSC_MANIFEST||{});globalThis.__RSC_MANIFEST["/worktrees/[id]/terminal/page"]={"moduleLoading":{"prefix":"/_next/","crossOrigin":null},"ssrModuleMapping":{"80":{"*":{"id":"41868","name":"*","chunks":[],"async":false}},"4707":{"*":{"id":"79671","name":"*","chunks":[],"async":false}},"12846":{"*":{"id":"12994","name":"*","chunks":[],"async":false}},"18390":{"*":{"id":"74810","name":"*","chunks":[],"async":false}},"18828":{"*":{"id":"2108","name":"*","chunks":[],"async":false}},"19107":{"*":{"id":"96114","name":"*","chunks":[],"async":false}},"36423":{"*":{"id":"84759","name":"*","chunks":[],"async":false}},"38991":{"*":{"id":"24146","name":"*","chunks":[],"async":false}},"41845":{"*":{"id":"37398","name":"*","chunks":[],"async":false}},"50653":{"*":{"id":"84442","name":"*","chunks":[],"async":false}},"61060":{"*":{"id":"9727","name":"*","chunks":[],"async":false}},"66677":{"*":{"id":"42106","name":"*","chunks":[],"async":false}}},"edgeSSRModuleMapping":{},"clientModules":{"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/client/components/app-router.js":{"id":12846,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/esm/client/components/app-router.js":{"id":12846,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/client/components/client-page.js":{"id":19107,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/esm/client/components/client-page.js":{"id":19107,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/client/components/error-boundary.js":{"id":61060,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/esm/client/components/error-boundary.js":{"id":61060,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/client/components/layout-router.js":{"id":4707,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/esm/client/components/layout-router.js":{"id":4707,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/client/components/not-found-boundary.js":{"id":80,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/esm/client/components/not-found-boundary.js":{"id":80,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/client/components/render-from-template-context.js":{"id":36423,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/esm/client/components/render-from-template-context.js":{"id":36423,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/src/app/globals.css":{"id":2778,"name":"*","chunks":["9234","static/chunks/9234-b0304101384ca079.js","8528","static/chunks/8528-4d554d3b94d4cf9b.js","3185","static/chunks/app/layout-9110f9a5e41c6bf4.js"],"async":false},"/home/runner/work/CommandMate/CommandMate/src/components/providers/AppProviders.tsx":{"id":18828,"name":"*","chunks":["9234","static/chunks/9234-b0304101384ca079.js","8528","static/chunks/8528-4d554d3b94d4cf9b.js","3185","static/chunks/app/layout-9110f9a5e41c6bf4.js"],"async":false},"/home/runner/work/CommandMate/CommandMate/src/app/page.tsx":{"id":66677,"name":"*","chunks":["9234","static/chunks/9234-b0304101384ca079.js","216","static/chunks/216-f18f4a9d8b04a91e.js","2335","static/chunks/2335-98a211e00b94c7ac.js","8528","static/chunks/8528-4d554d3b94d4cf9b.js","8091","static/chunks/8091-925542bdfc843dce.js","1931","static/chunks/app/page-238b5a70d8c101e9.js"],"async":false},"/home/runner/work/CommandMate/CommandMate/src/app/login/page.tsx":{"id":38991,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/src/app/worktrees/[id]/files/[...path]/page.tsx":{"id":50653,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/src/app/worktrees/[id]/page.tsx":{"id":18390,"name":"*","chunks":["9234","static/chunks/9234-b0304101384ca079.js","216","static/chunks/216-f18f4a9d8b04a91e.js","1038","static/chunks/1038-3509435b68c0967e.js","2335","static/chunks/2335-98a211e00b94c7ac.js","9178","static/chunks/9178-88850a7c48deea07.js","8528","static/chunks/8528-4d554d3b94d4cf9b.js","8091","static/chunks/8091-925542bdfc843dce.js","130","static/chunks/app/worktrees/%5Bid%5D/page-a556551ce5c69dec.js"],"async":false},"/home/runner/work/CommandMate/CommandMate/src/app/worktrees/[id]/terminal/page.tsx":{"id":41845,"name":"*","chunks":["9838","static/chunks/30d07d85-393352a92199f695.js","216","static/chunks/216-f18f4a9d8b04a91e.js","1224","static/chunks/app/worktrees/%5Bid%5D/terminal/page-5d85a7e508ce36d3.js"],"async":false}},"entryCSSFiles":{"/home/runner/work/CommandMate/CommandMate/src/":[],"/home/runner/work/CommandMate/CommandMate/src/app/layout":["static/css/b9ea6a4fad17dc32.css"],"/home/runner/work/CommandMate/CommandMate/src/app/page":[],"/home/runner/work/CommandMate/CommandMate/src/app/worktrees/[id]/page":["static/css/5eacd01f773eed7f.css"],"/home/runner/work/CommandMate/CommandMate/src/app/worktrees/[id]/terminal/page":["static/css/85fa6dafca566008.css"]}}
@@ -5,46 +5,46 @@
5
5
  "/api/hooks/claude-done/route": "app/api/hooks/claude-done/route.js",
6
6
  "/api/repositories/clone/[jobId]/route": "app/api/repositories/clone/[jobId]/route.js",
7
7
  "/api/repositories/clone/route": "app/api/repositories/clone/route.js",
8
- "/api/repositories/restore/route": "app/api/repositories/restore/route.js",
9
8
  "/api/repositories/excluded/route": "app/api/repositories/excluded/route.js",
9
+ "/api/repositories/restore/route": "app/api/repositories/restore/route.js",
10
10
  "/api/repositories/route": "app/api/repositories/route.js",
11
11
  "/api/repositories/scan/route": "app/api/repositories/scan/route.js",
12
12
  "/api/repositories/sync/route": "app/api/repositories/sync/route.js",
13
13
  "/api/slash-commands/route": "app/api/slash-commands/route.js",
14
- "/api/worktrees/[id]/auto-yes/route": "app/api/worktrees/[id]/auto-yes/route.js",
15
14
  "/api/worktrees/[id]/capture/route": "app/api/worktrees/[id]/capture/route.js",
16
15
  "/api/worktrees/[id]/cli-tool/route": "app/api/worktrees/[id]/cli-tool/route.js",
17
- "/api/worktrees/[id]/files/[...path]/route": "app/api/worktrees/[id]/files/[...path]/route.js",
16
+ "/api/worktrees/[id]/auto-yes/route": "app/api/worktrees/[id]/auto-yes/route.js",
18
17
  "/api/worktrees/[id]/current-output/route": "app/api/worktrees/[id]/current-output/route.js",
18
+ "/api/worktrees/[id]/files/[...path]/route": "app/api/worktrees/[id]/files/[...path]/route.js",
19
19
  "/api/worktrees/[id]/interrupt/route": "app/api/worktrees/[id]/interrupt/route.js",
20
20
  "/api/worktrees/[id]/kill-session/route": "app/api/worktrees/[id]/kill-session/route.js",
21
21
  "/api/worktrees/[id]/memos/[memoId]/route": "app/api/worktrees/[id]/memos/[memoId]/route.js",
22
- "/api/worktrees/[id]/memos/route": "app/api/worktrees/[id]/memos/route.js",
23
22
  "/api/worktrees/[id]/messages/route": "app/api/worktrees/[id]/messages/route.js",
24
- "/api/worktrees/[id]/respond/route": "app/api/worktrees/[id]/respond/route.js",
23
+ "/api/worktrees/[id]/memos/route": "app/api/worktrees/[id]/memos/route.js",
25
24
  "/api/worktrees/[id]/prompt-response/route": "app/api/worktrees/[id]/prompt-response/route.js",
25
+ "/api/worktrees/[id]/respond/route": "app/api/worktrees/[id]/respond/route.js",
26
26
  "/api/worktrees/[id]/route": "app/api/worktrees/[id]/route.js",
27
27
  "/api/worktrees/[id]/search/route": "app/api/worktrees/[id]/search/route.js",
28
28
  "/api/worktrees/[id]/send/route": "app/api/worktrees/[id]/send/route.js",
29
+ "/api/worktrees/[id]/start-polling/route": "app/api/worktrees/[id]/start-polling/route.js",
29
30
  "/api/worktrees/[id]/slash-commands/route": "app/api/worktrees/[id]/slash-commands/route.js",
30
31
  "/api/worktrees/[id]/terminal/route": "app/api/worktrees/[id]/terminal/route.js",
31
- "/api/worktrees/[id]/start-polling/route": "app/api/worktrees/[id]/start-polling/route.js",
32
- "/api/worktrees/[id]/tree/[...path]/route": "app/api/worktrees/[id]/tree/[...path]/route.js",
33
32
  "/api/worktrees/[id]/tree/route": "app/api/worktrees/[id]/tree/route.js",
33
+ "/api/worktrees/[id]/tree/[...path]/route": "app/api/worktrees/[id]/tree/[...path]/route.js",
34
34
  "/api/worktrees/[id]/upload/[...path]/route": "app/api/worktrees/[id]/upload/[...path]/route.js",
35
35
  "/api/worktrees/[id]/viewed/route": "app/api/worktrees/[id]/viewed/route.js",
36
- "/icon.png/route": "app/icon.png/route.js",
37
36
  "/apple-icon.png/route": "app/apple-icon.png/route.js",
38
- "/login/page": "app/login/page.js",
37
+ "/icon.png/route": "app/icon.png/route.js",
39
38
  "/page": "app/page.js",
39
+ "/login/page": "app/login/page.js",
40
40
  "/worktrees/[id]/files/[...path]/page": "app/worktrees/[id]/files/[...path]/page.js",
41
41
  "/worktrees/[id]/page": "app/worktrees/[id]/page.js",
42
42
  "/worktrees/[id]/terminal/page": "app/worktrees/[id]/terminal/page.js",
43
43
  "/api/auth/status/route": "app/api/auth/status/route.js",
44
44
  "/api/app/update-check/route": "app/api/app/update-check/route.js",
45
45
  "/api/external-apps/[id]/health/route": "app/api/external-apps/[id]/health/route.js",
46
- "/api/external-apps/route": "app/api/external-apps/route.js",
47
46
  "/api/external-apps/[id]/route": "app/api/external-apps/[id]/route.js",
47
+ "/api/external-apps/route": "app/api/external-apps/route.js",
48
48
  "/api/worktrees/[id]/logs/route": "app/api/worktrees/[id]/logs/route.js",
49
49
  "/api/worktrees/[id]/logs/[filename]/route": "app/api/worktrees/[id]/logs/[filename]/route.js",
50
50
  "/api/worktrees/route": "app/api/worktrees/route.js",
@@ -1 +1 @@
1
- "use strict";exports.id=7536,exports.ids=[7536],exports.modules={89194:(e,t,s)=>{s.d(t,{Lg:()=>o,NA:()=>a});var n=s(10927),i=s(43839);let r=(0,s(43895).h)("cli-session");async function o(e,t){let s=i.g.getInstance().getTool(t).getSessionName(e);return await (0,n.Hk)(s)}async function a(e,t,s=1e3){let o=r.withContext({worktreeId:e,cliToolId:t});o.debug("captureSessionOutput:start",{requestedLines:s});let a=i.g.getInstance().getTool(t),l=a.getSessionName(e);if(!await (0,n.Hk)(l))throw o.debug("captureSessionOutput:sessionNotFound",{sessionName:l}),Error(`${a.name} session ${l} does not exist`);try{let e=await (0,n.xq)(l,{startLine:-s}),t=e.split("\n").length;return o.debug("captureSessionOutput:success",{actualLines:t,lastFewLines:e.split("\n").slice(-3).join(" | ")}),e}catch(t){let e=t instanceof Error?t.message:String(t);throw o.error("captureSessionOutput:failed",{error:e}),Error(`Failed to capture ${a.name} output: ${e}`)}}},43839:(e,t,s)=>{s.d(t,{g:()=>y});var n=s(61282),i=s(21764);let r=/^[a-zA-Z0-9_-]+$/;var o=s(10927);let a=(0,i.promisify)(n.exec);class l{async isInstalled(){try{return await a(`which ${this.command}`,{timeout:5e3}),!0}catch{return!1}}getSessionName(e){let t=`mcbd-${this.id}-${e}`;return function(e){if(!r.test(e))throw Error(`Invalid session name format: ${e}`)}(t),t}async interrupt(e){let t=this.getSessionName(e);await (0,o.ZV)(t,"Escape")}}var u=s(62648);class c extends l{async isInstalled(){return await (0,u.Uv)()}async isRunning(e){return await (0,u.YI)(e)}async startSession(e,t){await (0,u.ym)({worktreeId:e,worktreePath:t})}async sendMessage(e,t){await (0,u.xd)(e,t)}async killSession(e){await (0,u._f)(e)}constructor(...e){super(...e),this.id="claude",this.name="Claude Code",this.command="claude"}}var m=s(92900);let p=(0,i.promisify)(n.exec);function d(e){return e instanceof Error?e.message:String(e)}class f extends l{async isRunning(e){let t=this.getSessionName(e);return await (0,o.Hk)(t)}async startSession(e,t){if(!await this.isInstalled())throw Error("Codex CLI is not installed or not in PATH");let s=this.getSessionName(e);if(await (0,o.Hk)(s)){console.log(`Codex session ${s} already exists`);return}try{await (0,o.ed)({sessionName:s,workingDirectory:t,historyLimit:5e4}),await new Promise(e=>setTimeout(e,100)),await (0,o.Is)(s,"codex",!0),await new Promise(e=>setTimeout(e,3e3)),await (0,o.Is)(s,"2",!0),await new Promise(e=>setTimeout(e,200)),await p(`tmux send-keys -t "${s}" Down`),await new Promise(e=>setTimeout(e,200)),await p(`tmux send-keys -t "${s}" Enter`),await new Promise(e=>setTimeout(e,200)),console.log(`✓ Started Codex session: ${s}`)}catch(t){let e=d(t);throw Error(`Failed to start Codex session: ${e}`)}}async sendMessage(e,t){let s=this.getSessionName(e);if(!await (0,o.Hk)(s))throw Error(`Codex session ${s} does not exist. Start the session first.`);try{await (0,o.Is)(s,t,!1),await new Promise(e=>setTimeout(e,100)),await p(`tmux send-keys -t "${s}" C-m`),await new Promise(e=>setTimeout(e,200)),t.includes("\n")&&await (0,m.N)(s),console.log(`✓ Sent message to Codex session: ${s}`)}catch(t){let e=d(t);throw Error(`Failed to send message to Codex: ${e}`)}}async killSession(e){let t=this.getSessionName(e);try{await (0,o.Hk)(t)&&(await p(`tmux send-keys -t "${t}" C-d`),await new Promise(e=>setTimeout(e,500))),await (0,o.AJ)(t)&&console.log(`✓ Stopped Codex session: ${t}`)}catch(t){let e=d(t);throw console.error(`Error stopping Codex session: ${e}`),t}}constructor(...e){super(...e),this.id="codex",this.name="Codex CLI",this.command="codex"}}let h=(0,i.promisify)(n.exec);class g extends l{async isRunning(e){let t=this.getSessionName(e);return await (0,o.Hk)(t)}async startSession(e,t){if(!await this.isInstalled())throw Error("Gemini CLI is not installed or not in PATH");let s=this.getSessionName(e);if(await (0,o.Hk)(s)){console.log(`Gemini session ${s} already exists`);return}try{await (0,o.ed)({sessionName:s,workingDirectory:t,historyLimit:5e4}),console.log(`✓ Started Gemini session: ${s}`)}catch(t){let e=t instanceof Error?t.message:String(t);throw Error(`Failed to start Gemini session: ${e}`)}}async sendMessage(e,t){let s=this.getSessionName(e);if(!await (0,o.Hk)(s))throw Error(`Gemini session ${s} does not exist. Start the session first.`);try{let e=t.replace(/'/g,"'\\''");await (0,o.Is)(s,`echo '${e}' | gemini`,!0),console.log(`✓ Sent message to Gemini session: ${s}`)}catch(t){let e=t instanceof Error?t.message:String(t);throw Error(`Failed to send message to Gemini: ${e}`)}}async killSession(e){let t=this.getSessionName(e);try{await (0,o.Hk)(t)&&(await h(`tmux send-keys -t "${t}" C-d`),await new Promise(e=>setTimeout(e,500))),await (0,o.AJ)(t)&&console.log(`✓ Stopped Gemini session: ${t}`)}catch(t){let e=t instanceof Error?t.message:String(t);throw console.error(`Error stopping Gemini session: ${e}`),t}}constructor(...e){super(...e),this.id="gemini",this.name="Gemini CLI",this.command="gemini"}}var w=s(59991);class y{constructor(){this.tools=new Map,this.tools.set("claude",new c),this.tools.set("codex",new f),this.tools.set("gemini",new g)}static getInstance(){return y.instance||(y.instance=new y),y.instance}getTool(e){let t=this.tools.get(e);if(!t)throw Error(`CLI tool '${e}' not found`);return t}getAllTools(){return Array.from(this.tools.values())}async getToolInfo(e){let t=this.getTool(e),s=await t.isInstalled();return{id:t.id,name:t.name,command:t.command,installed:s}}async getAllToolsInfo(){return Promise.all(this.getAllTools().map(async e=>{let t=await e.isInstalled();return{id:e.id,name:e.name,command:e.command,installed:t}}))}async getInstalledTools(){return(await this.getAllToolsInfo()).filter(e=>e.installed)}stopPollers(e,t){(0,w.FN)(e,t)}}},63661:(e,t,s)=>{s.d(t,{F:()=>o,J:()=>f});let n=(0,s(43895).h)("prompt-detector"),i=[{regex:/^(.+)\s+\(y\/n\)\s*$/m},{regex:/^(.+)\s+\[y\/N\]\s*$/m,defaultOption:"no"},{regex:/^(.+)\s+\[Y\/n\]\s*$/m,defaultOption:"yes"},{regex:/^(.+)\s+\(yes\/no\)\s*$/m}];function r(e,t,s,n){return{isPrompt:!0,promptData:{type:"yes_no",question:e,options:["yes","no"],status:"pending",...void 0!==n&&{defaultOption:n},instructionText:s},cleanContent:t,rawContent:s}}function o(e,t){n.debug("detectPrompt:start",{outputLength:e.length});let s=e.split("\n").slice(-20).join("\n"),o=function(e,t){let s=t?.requireDefaultIndicator??!0,n=e.split("\n"),i=n.length;for(;i>0&&""===n[i-1].trim();)i--;let r=Math.max(0,i-50);if(s){let t=!1;for(let e=r;e<i;e++){let s=n[e].trim();if(l.test(s)){t=!0;break}}if(!t)return m(e)}let o=[],p=-1;for(let t=i-1;t>=r;t--){let s=n[t].trim(),i=s.match(l);if(i){let e=parseInt(i[1],10),t=i[2].trim();o.unshift({number:e,label:t,isDefault:!0});continue}let r=s.match(u);if(r){let e=parseInt(r[1],10),t=r[2].trim();o.unshift({number:e,label:t,isDefault:!1});continue}if(0===o.length&&s.startsWith("❯"))return m(e);if(o.length>0&&s&&!c.test(s)){if(d(s)){p=t;break}if(function(e,t){let s=t.endsWith("?")||t.endsWith("?");return!!(!s&&/^\s{2,}[^\d]/.test(e)&&!/^\s*\d+\./.test(e)||t.length<5&&!s||/^[\/~]/.test(t)||t.length>=2&&/^[a-zA-Z0-9_-]+$/.test(t))}(n[t],s))continue;p=t;break}}if(!function(e){if(0===e.length||1!==e[0])return!1;for(let t=1;t<e.length;t++)if(e[t]!==e[t-1]+1)return!1;return!0}(o.map(e=>e.number)))return m(e);let f=o.some(e=>e.isDefault);if(o.length<2||s&&!f||!s&&(-1===p||!d(n[p]?.trim()??"")&&!function(e,t,s,n){let i=Math.max(n,t-3);for(let s=t-1;s>=i;s--){let t=e[s]?.trim()??"";if(!(!t||c.test(t))&&d(t))return!0}return!1}(n,p,0,r)))return m(e);let h=function(e,t){if(t<0)return"Please select an option:";let s=[];for(let n=Math.max(0,t-5);n<=t;n++){let t=e[n].trim();t&&!c.test(t)&&s.push(t)}return s.join(" ")}(n,p),g=function(e,t,s){if(t<0)return;let n=e.slice(Math.max(0,t-19),s).map(e=>e.trimEnd()).join("\n").trim();return n.length>0?n:void 0}(n,p,i);return{isPrompt:!0,promptData:{type:"multiple_choice",question:h.trim(),options:o.map(e=>{let t=a.some(t=>t.test(e.label));return{number:e.number,label:e.label,isDefault:e.isDefault,requiresTextInput:t}}),status:"pending",instructionText:g},cleanContent:h.trim(),rawContent:function(e){let t=e.split("\n"),s=(t.length>200?t.slice(-200):t).join("\n");return s.length>5e3&&(s=s.slice(-5e3)),s}(e.trim())}}(e,t);if(o.isPrompt)return n.info("detectPrompt:multipleChoice",{isPrompt:!0,question:o.promptData?.question,optionsCount:o.promptData?.options?.length}),o;let p=s.trim();for(let e of i){let t=s.match(e.regex);if(t){let s=t[1].trim();return r(s,s,p,e.defaultOption)}}let f=s.match(/^(.*?)Approve\?\s*$/m);if(f){let e=f[1].trim();return r(e?`${e} Approve?`:"Approve?",e||"Approve?",p)}return n.debug("detectPrompt:complete",{isPrompt:!1}),{isPrompt:!1,cleanContent:e.trim()}}let a=[/type\s+here/i,/tell\s+(me|claude)/i,/enter\s+/i,/custom/i,/differently/i],l=/^\s*\u276F\s*(\d+)\.\s*(.+)$/,u=/^\s*(\d+)\.\s*(.+)$/,c=/^[-─]+$/;function m(e){return{isPrompt:!1,cleanContent:e.trim()}}let p=/(?:select|choose|pick|which|what|how|where|enter|type|specify|confirm|approve|accept|reject|decide|preference|option)/i;function d(e){return 0!==e.length&&!!(e.includes("?")||e.includes("?")||p.test(e))}function f(e,t="yes_no"){let s=e.toLowerCase().trim();if("multiple_choice"===t){if(/^\d+$/.test(s))return s;throw Error("Invalid answer for multiple choice prompt. Expected a number.")}if("yes"===s||"y"===s)return"y";if("no"===s||"n"===s)return"n";throw Error("Invalid answer for yes/no prompt. Expected 'yes', 'no', 'y', or 'n'.")}},59991:(e,t,s)=>{s.d(t,{FN:()=>S,RJ:()=>y,ci:()=>w,cn:()=>C});var n=s(89194),i=s(97425),r=s(75748),o=s(68507),a=s(63661),l=s(76966),u=s(89287),c=s(19377);let m=["Waiting for auth","⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];function p(e){return{response:"",isComplete:!1,lineCount:e}}function d(e,t,s,n,i,r){let o=$(t,s,n,i,r),a=e.slice(o);return{response:(0,c.vp)(a.join("\n")),isComplete:!0,lineCount:s}}let f=new Map,h=new Map;function g(e,t){let s=(0,c.Sg)(t);return(0,a.F)((0,c.vp)(e),s)}function w(e){let t=(0,c.vp)(e).split("\n"),s=-1;for(let e=t.length-1;e>=0;e--)if(/^❯\s+\S/.test(t[e])){s=e;break}let n=s>=0?s+1:0,i=t.slice(n),r=[/CLAUDE_HOOKS_/,/\/bin\/claude/,/^claude\s*$/,/@.*\s+%\s*$/,/^[^⏺]*curl.*POST/,/^[^⏺]*Content-Type/,/^[^⏺]*export\s+CLAUDE_/,/^\s*$/,/^[╭╮╰╯│─\s]+$/,/^[│╭╮╰╯].*[│╭╮╰╯]$/,/Claude Code v[\d.]+/,/^Tips for getting started/,/^Welcome back/,/Run \/init to create/,/^Recent activity/,/^No recent activity/,/▐▛███▜▌|▝▜█████▛▘|▘▘ ▝▝/,/^\s*Opus \d+\.\d+\s*·\s*Claude Max/,/\.com's Organization/,/\?\s*for shortcuts\s*$/,/^─{10,}$/,/^❯\s*$/,c.d8],o=[];for(let e of i)!r.some(t=>t.test(e))&&e.trim()&&o.push(e);return o.join("\n").trim()}function y(e){let t=e.split("\n"),s=[],n=[/^maenokota@.*%/,/^zsh:/,/^feature-issue-\d+/,/^\s*$/],i=!1,r=[];for(let e of t){if(e.includes("✦")){i=!0;let t=e.indexOf("✦"),s=e.substring(t+1).trim();s&&r.push(s);continue}if(i){if(n.some(t=>t.test(e)))continue;r.push(e)}}if(r.length>0)return r.join("\n").trim();for(let e of t)n.some(t=>t.test(e))||s.push(e);return s.join("\n").trim()}function $(e,t,s,n,i){if((e=Math.max(0,e))>=t||s){let e=i(40);return e>=0?e+1:0}if("codex"===n)return Math.max(0,e);if(e>=t-5){let e=i(50);return e>=0?e+1:Math.max(0,t-40)}return Math.max(0,e)}async function x(e,t){let s=(0,i.n)();try{if(!(0,r.gU)(s,e))return console.error(`Worktree ${e} not found, stopping poller`),S(e,t),!1;if(!await (0,n.Lg)(e,t))return S(e,t),!1;let i=(0,r.zl)(s,e,t),a=i?.lastCapturedLine||0,f=await (0,n.NA)(e,t,1e4),h=function(e,t,s){let n=e.split("\n"),i=n.length;for(;i>0&&""===n[i-1].trim();)i--;let r=n.slice(0,i),o=r.length,a=o>0&&t>25&&o+25<t,l=o>0&&t>50&&o<50,u=a||l;if(!u&&o<t-5)return null;let f=Math.max(0,o-20),h=r.slice(f).join("\n"),{promptPattern:w,separatorPattern:y,thinkingPattern:x,skipPatterns:C}=(0,c.bs)(s),S=(e=60)=>{let t="codex"===s?/^›\s+(?!Implement|Find and fix|Type|Summarize)/:/^[>❯]\s+\S/;for(let s=o-1;s>=Math.max(0,o-e);s--){let e=(0,c.vp)(r[s]);if(t.test(e))return s}return -1};if("claude"===s&&g(r.join("\n"),s).isPrompt)return d(r,t,o,u,s,S);let I=(0,c.vp)(h),k=w.test(I),v=y.test(I),P=x.test(I),E=("codex"===s||"gemini"===s)&&k&&!P,T="claude"===s&&k&&v&&!P;if(E||T){let e=[],n=$(t,o,u,s,S),i=o;for(let t=n;t<o;t++){let n=r[t],o=(0,c.vp)(n);if("codex"===s&&/^›\s+/.test(o)||"gemini"===s&&/^(%|\$|.*@.*[%$#])\s*$/.test(o)){i=t;break}C.some(e=>e.test(o))||e.push(n)}let a=e.join("\n").trim(),l=a.split("\n").slice(-5).join("\n");if(x.test(l))return p(o);if("claude"===s){let e=(0,c.vp)(a),t=/[╭╮╰╯│]/.test(e)||/░{3,}/.test(e)||/▓{3,}/.test(e),s=/Claude Code|claude\/|v\d+\.\d+/.test(e),n=/Tip:|for shortcuts|\?\s*for help/.test(e),i=/^\s*\/Users\/.*$/m.test(e)&&e.split("\n").length<30,r=e.match(/^[>❯]\s+(\S.*)$/m);if(r){let t=e.indexOf(r[0]);if(0===e.substring(t+r[0].length).trim().split("\n").filter(e=>{let t=e.trim();return t&&!C.some(e=>e.test(t))&&!/^─+$/.test(t)}).length)return p(o)}else if((t||s||n||i)&&a.length<2e3)return p(o)}return"gemini"===s&&((a.match(/[░███]/g)||[]).length>.3*a.length||m.some(e=>a.includes(e))||!a.includes("✦")&&a.length<10)?p(o):{response:a,isComplete:!0,lineCount:i}}if(g(r.join("\n"),s).isPrompt)return d(r,t,o,u,s,S);let b=[],M=u||t>=o-5,N=M?S(80):-1,D=M?N>=0?N+1:Math.max(0,o-80):Math.max(0,t);for(let e=D;e<o;e++){let t=r[e],s=(0,c.vp)(t);C.some(e=>e.test(s))||b.push(t)}let A=b.join("\n").trim();return A?{response:A,isComplete:!1,lineCount:o}:p(o)}(f,a,t);if(!h||!h.isComplete){let{thinkingPattern:n}=(0,c.bs)(t),i=(0,c.vp)(f).split("\n").slice(-5).join("\n");if(n.test(i)){let n=(0,r.GP)(s,e,t);n>0&&console.log(`Marked ${n} pending prompt(s) as answered (thinking detected) for ${e}`)}return!1}if(h.lineCount===a&&!i?.inProgressMessageId)return!1;if(h.lineCount<=a)return console.log(`[checkForResponse] Already saved up to line ${a}, skipping (result: ${h.lineCount})`),!1;let x=g(h.response,t);if(x.isPrompt){(0,r.Mf)(s,e,t);let n=(0,r.tn)(s,{worktreeId:e,role:"assistant",content:x.rawContent||x.cleanContent,messageType:"prompt",promptData:x.promptData,timestamp:new Date,cliToolId:t});return(0,r.IH)(s,e,t,h.lineCount),(0,o.ps)("message",{worktreeId:e,message:n}),S(e,t),!0}if(!h.response||""===h.response.trim())return(0,r.IH)(s,e,t,h.lineCount),!1;let C="claude"===t?(0,u.Z)(h.response):void 0,I=h.response;if("gemini"===t?I=y(h.response):"claude"===t&&(I=w(h.response)),!I||""===I.trim()||"[No content]"===I)return(0,r.IH)(s,e,t,h.lineCount),(0,r.Mf)(s,e,t),!1;I&&await (0,l.o)(s,e,I,t);let k=(0,r.GP)(s,e,t);k>0&&console.log(`Marked ${k} pending prompt(s) as answered for ${e}`);let v=(0,r.zl)(s,e,t);if(v&&h.lineCount<=v.lastCapturedLine)return console.log(`[checkForResponse] Race condition detected, skipping save (result: ${h.lineCount}, current: ${v.lastCapturedLine})`),!1;let P=(0,r.tn)(s,{worktreeId:e,role:"assistant",content:I,messageType:"normal",timestamp:new Date,cliToolId:t,summary:C?.summary,logFileName:C?.logFileName,requestId:C?.requestId});return(0,o.ps)("message",{worktreeId:e,message:P}),(0,r.IH)(s,e,t,h.lineCount),!0}catch(t){return console.error(`Error checking for response (${e}):`,t instanceof Error?t.message:String(t)),!1}}function C(e,t){let s=`${e}:${t}`;S(e,t),h.set(s,Date.now());let n=setInterval(async()=>{let n=h.get(s);if(n&&Date.now()-n>3e5){S(e,t);return}try{await x(e,t)}catch(e){console.error("[Poller] Error:",e)}},2e3);f.set(s,n)}function S(e,t){let s=`${e}:${t}`,n=f.get(s);n&&(clearInterval(n),f.delete(s),h.delete(s))}}};
1
+ "use strict";exports.id=7536,exports.ids=[7536],exports.modules={89194:(e,t,s)=>{s.d(t,{Lg:()=>o,NA:()=>a});var n=s(10927),i=s(43839);let r=(0,s(43895).h)("cli-session");async function o(e,t){let s=i.g.getInstance().getTool(t).getSessionName(e);return await (0,n.Hk)(s)}async function a(e,t,s=1e3){let o=r.withContext({worktreeId:e,cliToolId:t});o.debug("captureSessionOutput:start",{requestedLines:s});let a=i.g.getInstance().getTool(t),l=a.getSessionName(e);if(!await (0,n.Hk)(l))throw o.debug("captureSessionOutput:sessionNotFound",{sessionName:l}),Error(`${a.name} session ${l} does not exist`);try{let e=await (0,n.xq)(l,{startLine:-s}),t=e.split("\n").length;return o.debug("captureSessionOutput:success",{actualLines:t,lastFewLines:e.split("\n").slice(-3).join(" | ")}),e}catch(t){let e=t instanceof Error?t.message:String(t);throw o.error("captureSessionOutput:failed",{error:e}),Error(`Failed to capture ${a.name} output: ${e}`)}}},43839:(e,t,s)=>{s.d(t,{g:()=>y});var n=s(61282),i=s(21764);let r=/^[a-zA-Z0-9_-]+$/;var o=s(10927);let a=(0,i.promisify)(n.exec);class l{async isInstalled(){try{return await a(`which ${this.command}`,{timeout:5e3}),!0}catch{return!1}}getSessionName(e){let t=`mcbd-${this.id}-${e}`;return function(e){if(!r.test(e))throw Error(`Invalid session name format: ${e}`)}(t),t}async interrupt(e){let t=this.getSessionName(e);await (0,o.ZV)(t,"Escape")}}var u=s(62648);class c extends l{async isInstalled(){return await (0,u.Uv)()}async isRunning(e){return await (0,u.YI)(e)}async startSession(e,t){await (0,u.ym)({worktreeId:e,worktreePath:t})}async sendMessage(e,t){await (0,u.xd)(e,t)}async killSession(e){await (0,u._f)(e)}constructor(...e){super(...e),this.id="claude",this.name="Claude Code",this.command="claude"}}var m=s(92900);let p=(0,i.promisify)(n.exec);function d(e){return e instanceof Error?e.message:String(e)}class f extends l{async isRunning(e){let t=this.getSessionName(e);return await (0,o.Hk)(t)}async startSession(e,t){if(!await this.isInstalled())throw Error("Codex CLI is not installed or not in PATH");let s=this.getSessionName(e);if(await (0,o.Hk)(s)){console.log(`Codex session ${s} already exists`);return}try{await (0,o.ed)({sessionName:s,workingDirectory:t,historyLimit:5e4}),await new Promise(e=>setTimeout(e,100)),await (0,o.Is)(s,"codex",!0),await new Promise(e=>setTimeout(e,3e3)),await (0,o.Is)(s,"2",!0),await new Promise(e=>setTimeout(e,200)),await p(`tmux send-keys -t "${s}" Down`),await new Promise(e=>setTimeout(e,200)),await p(`tmux send-keys -t "${s}" Enter`),await new Promise(e=>setTimeout(e,200)),console.log(`✓ Started Codex session: ${s}`)}catch(t){let e=d(t);throw Error(`Failed to start Codex session: ${e}`)}}async sendMessage(e,t){let s=this.getSessionName(e);if(!await (0,o.Hk)(s))throw Error(`Codex session ${s} does not exist. Start the session first.`);try{await (0,o.Is)(s,t,!1),await new Promise(e=>setTimeout(e,100)),await p(`tmux send-keys -t "${s}" C-m`),await new Promise(e=>setTimeout(e,200)),t.includes("\n")&&await (0,m.N)(s),console.log(`✓ Sent message to Codex session: ${s}`)}catch(t){let e=d(t);throw Error(`Failed to send message to Codex: ${e}`)}}async killSession(e){let t=this.getSessionName(e);try{await (0,o.Hk)(t)&&(await p(`tmux send-keys -t "${t}" C-d`),await new Promise(e=>setTimeout(e,500))),await (0,o.AJ)(t)&&console.log(`✓ Stopped Codex session: ${t}`)}catch(t){let e=d(t);throw console.error(`Error stopping Codex session: ${e}`),t}}constructor(...e){super(...e),this.id="codex",this.name="Codex CLI",this.command="codex"}}let h=(0,i.promisify)(n.exec);class g extends l{async isRunning(e){let t=this.getSessionName(e);return await (0,o.Hk)(t)}async startSession(e,t){if(!await this.isInstalled())throw Error("Gemini CLI is not installed or not in PATH");let s=this.getSessionName(e);if(await (0,o.Hk)(s)){console.log(`Gemini session ${s} already exists`);return}try{await (0,o.ed)({sessionName:s,workingDirectory:t,historyLimit:5e4}),console.log(`✓ Started Gemini session: ${s}`)}catch(t){let e=t instanceof Error?t.message:String(t);throw Error(`Failed to start Gemini session: ${e}`)}}async sendMessage(e,t){let s=this.getSessionName(e);if(!await (0,o.Hk)(s))throw Error(`Gemini session ${s} does not exist. Start the session first.`);try{let e=t.replace(/'/g,"'\\''");await (0,o.Is)(s,`echo '${e}' | gemini`,!0),console.log(`✓ Sent message to Gemini session: ${s}`)}catch(t){let e=t instanceof Error?t.message:String(t);throw Error(`Failed to send message to Gemini: ${e}`)}}async killSession(e){let t=this.getSessionName(e);try{await (0,o.Hk)(t)&&(await h(`tmux send-keys -t "${t}" C-d`),await new Promise(e=>setTimeout(e,500))),await (0,o.AJ)(t)&&console.log(`✓ Stopped Gemini session: ${t}`)}catch(t){let e=t instanceof Error?t.message:String(t);throw console.error(`Error stopping Gemini session: ${e}`),t}}constructor(...e){super(...e),this.id="gemini",this.name="Gemini CLI",this.command="gemini"}}var w=s(59991);class y{constructor(){this.tools=new Map,this.tools.set("claude",new c),this.tools.set("codex",new f),this.tools.set("gemini",new g)}static getInstance(){return y.instance||(y.instance=new y),y.instance}getTool(e){let t=this.tools.get(e);if(!t)throw Error(`CLI tool '${e}' not found`);return t}getAllTools(){return Array.from(this.tools.values())}async getToolInfo(e){let t=this.getTool(e),s=await t.isInstalled();return{id:t.id,name:t.name,command:t.command,installed:s}}async getAllToolsInfo(){return Promise.all(this.getAllTools().map(async e=>{let t=await e.isInstalled();return{id:e.id,name:e.name,command:e.command,installed:t}}))}async getInstalledTools(){return(await this.getAllToolsInfo()).filter(e=>e.installed)}stopPollers(e,t){(0,w.FN)(e,t)}}},63661:(e,t,s)=>{s.d(t,{F:()=>o,J:()=>f});let n=(0,s(43895).h)("prompt-detector"),i=[{regex:/^(.+)\s+\(y\/n\)\s*$/m},{regex:/^(.+)\s+\[y\/N\]\s*$/m,defaultOption:"no"},{regex:/^(.+)\s+\[Y\/n\]\s*$/m,defaultOption:"yes"},{regex:/^(.+)\s+\(yes\/no\)\s*$/m}];function r(e,t,s,n){return{isPrompt:!0,promptData:{type:"yes_no",question:e,options:["yes","no"],status:"pending",...void 0!==n&&{defaultOption:n},instructionText:s},cleanContent:t,rawContent:s}}function o(e,t){n.debug("detectPrompt:start",{outputLength:e.length});let s=e.split("\n").slice(-20).join("\n"),o=function(e,t){let s=t?.requireDefaultIndicator??!0,n=e.split("\n"),i=n.length;for(;i>0&&""===n[i-1].trim();)i--;let r=Math.max(0,i-50);if(s){let t=!1;for(let e=r;e<i;e++){let s=n[e].trim();if(l.test(s)){t=!0;break}}if(!t)return m(e)}let o=[],p=-1;for(let t=i-1;t>=r;t--){let s=n[t].trim(),i=s.match(l);if(i){let e=parseInt(i[1],10),t=i[2].trim();o.unshift({number:e,label:t,isDefault:!0});continue}let r=s.match(u);if(r){let e=parseInt(r[1],10),t=r[2].trim();o.unshift({number:e,label:t,isDefault:!1});continue}if(0===o.length&&s.startsWith("❯"))return m(e);if(o.length>0&&s&&!c.test(s)){if(d(s)){p=t;break}if(function(e,t){let s=t.endsWith("?")||t.endsWith("?");return!!(!s&&/^\s{2,}[^\d]/.test(e)&&!/^\s*\d+\./.test(e)||t.length<5&&!s||/^[\/~]/.test(t)||t.length>=2&&/^[a-zA-Z0-9_-]+$/.test(t))}(n[t],s))continue;p=t;break}}if(!function(e){if(0===e.length||1!==e[0])return!1;for(let t=1;t<e.length;t++)if(e[t]!==e[t-1]+1)return!1;return!0}(o.map(e=>e.number)))return m(e);let f=o.some(e=>e.isDefault);if(o.length<2||s&&!f||!s&&(-1===p||!d(n[p]?.trim()??"")&&!function(e,t,s,n){let i=Math.max(n,t-3);for(let s=t-1;s>=i;s--){let t=e[s]?.trim()??"";if(!(!t||c.test(t))&&d(t))return!0}return!1}(n,p,0,r)))return m(e);let h=function(e,t){if(t<0)return"Please select an option:";let s=[];for(let n=Math.max(0,t-5);n<=t;n++){let t=e[n].trim();t&&!c.test(t)&&s.push(t)}return s.join(" ")}(n,p),g=function(e,t,s){if(t<0)return;let n=e.slice(Math.max(0,t-19),s).map(e=>e.trimEnd()).join("\n").trim();return n.length>0?n:void 0}(n,p,i);return{isPrompt:!0,promptData:{type:"multiple_choice",question:h.trim(),options:o.map(e=>{let t=a.some(t=>t.test(e.label));return{number:e.number,label:e.label,isDefault:e.isDefault,requiresTextInput:t}}),status:"pending",instructionText:g},cleanContent:h.trim(),rawContent:function(e){let t=e.split("\n"),s=(t.length>200?t.slice(-200):t).join("\n");return s.length>5e3&&(s=s.slice(-5e3)),s}(e.trim())}}(e,t);if(o.isPrompt)return n.info("detectPrompt:multipleChoice",{isPrompt:!0,question:o.promptData?.question,optionsCount:o.promptData?.options?.length}),o;let p=s.trim();for(let e of i){let t=s.match(e.regex);if(t){let s=t[1].trim();return r(s,s,p,e.defaultOption)}}let f=s.match(/^(.*?)Approve\?\s*$/m);if(f){let e=f[1].trim();return r(e?`${e} Approve?`:"Approve?",e||"Approve?",p)}return n.debug("detectPrompt:complete",{isPrompt:!1}),{isPrompt:!1,cleanContent:e.trim()}}let a=[/type\s+here/i,/tell\s+(me|claude)/i,/enter\s+/i,/custom/i,/differently/i],l=/^\s*\u276F\s*(\d+)\.\s*(.+)$/,u=/^\s*(\d+)\.\s*(.+)$/,c=/^[-─]+$/;function m(e){return{isPrompt:!1,cleanContent:e.trim()}}let p=/(?:select|choose|pick|which|what|how|where|enter|type|specify|confirm|approve|accept|reject|decide|preference|option)/i;function d(e){return 0!==e.length&&!!(e.includes("?")||e.includes("?")||p.test(e))}function f(e,t="yes_no"){let s=e.toLowerCase().trim();if("multiple_choice"===t){if(/^\d+$/.test(s))return s;throw Error("Invalid answer for multiple choice prompt. Expected a number.")}if("yes"===s||"y"===s)return"y";if("no"===s||"n"===s)return"n";throw Error("Invalid answer for yes/no prompt. Expected 'yes', 'no', 'y', or 'n'.")}},59991:(e,t,s)=>{s.d(t,{FN:()=>S,RJ:()=>y,ci:()=>w,cn:()=>C});var n=s(89194),i=s(97425),r=s(75748),o=s(68507),a=s(63661),l=s(76966),u=s(89287),c=s(19377);let m=["Waiting for auth","⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];function p(e){return{response:"",isComplete:!1,lineCount:e}}function d(e,t,s,n,i,r){let o=$(t,s,n,i,r),a=e.slice(o);return{response:(0,c.vp)(a.join("\n")),isComplete:!0,lineCount:s}}let f=new Map,h=new Map;function g(e,t){let s=(0,c.Sg)(t);return(0,a.F)((0,c.vp)(e),s)}function w(e){let t=(0,c.vp)(e).split("\n"),s=-1;for(let e=t.length-1;e>=0;e--)if(/^❯\s+\S/.test(t[e])){s=e;break}let n=s>=0?s+1:0,i=t.slice(n),r=[/CLAUDE_HOOKS_/,/\/bin\/claude/,/^claude\s*$/,/@.*\s+%\s*$/,/^[^⏺]*curl.*POST/,/^[^⏺]*Content-Type/,/^[^⏺]*export\s+CLAUDE_/,/^\s*$/,/^[╭╮╰╯│─\s]+$/,/^[│╭╮╰╯].*[│╭╮╰╯]$/,/Claude Code v[\d.]+/,/^Tips for getting started/,/^Welcome back/,/Run \/init to create/,/^Recent activity/,/^No recent activity/,/▐▛███▜▌|▝▜█████▛▘|▘▘ ▝▝/,/^\s*Opus \d+\.\d+\s*·\s*Claude Max/,/\.com's Organization/,/\?\s*for shortcuts\s*$/,/^─{10,}$/,/^❯\s*$/,c.d8],o=[];for(let e of i)!r.some(t=>t.test(e))&&e.trim()&&o.push(e);return o.join("\n").trim()}function y(e){let t=e.split("\n"),s=[],n=[/^maenokota@.*%/,/^zsh:/,/^feature-issue-\d+/,/^\s*$/],i=!1,r=[];for(let e of t){if(e.includes("✦")){i=!0;let t=e.indexOf("✦"),s=e.substring(t+1).trim();s&&r.push(s);continue}if(i){if(n.some(t=>t.test(e)))continue;r.push(e)}}if(r.length>0)return r.join("\n").trim();for(let e of t)n.some(t=>t.test(e))||s.push(e);return s.join("\n").trim()}function $(e,t,s,n,i){if((e=Math.max(0,e))>=t||s){let e=i(40);return e>=0?e+1:0}if("codex"===n)return Math.max(0,e);if(e>=t-5){let e=i(50);return e>=0?e+1:Math.max(0,t-40)}return Math.max(0,e)}async function x(e,t){let s=(0,i.n)();try{if(!(0,r.gU)(s,e))return console.error(`Worktree ${e} not found, stopping poller`),S(e,t),!1;if(!await (0,n.Lg)(e,t))return S(e,t),!1;let i=(0,r.zl)(s,e,t),a=i?.lastCapturedLine||0,f=await (0,n.NA)(e,t,1e4),h=function(e,t,s){let n=e.split("\n"),i=n.length;for(;i>0&&""===n[i-1].trim();)i--;let r=n.slice(0,i),o=r.length,a=o>0&&t>25&&o+25<t,l=o>0&&t>50&&o<50,u=a||l;if(!u&&o<t-5)return null;let f=Math.max(0,o-20),h=r.slice(f).join("\n"),{promptPattern:w,separatorPattern:y,thinkingPattern:x,skipPatterns:C}=(0,c.bs)(s),S=(e=60)=>{let t="codex"===s?/^›\s+(?!Implement|Find and fix|Type|Summarize)/:/^[>❯]\s+\S/;for(let s=o-1;s>=Math.max(0,o-e);s--){let e=(0,c.vp)(r[s]);if(t.test(e))return s}return -1};if("claude"===s&&g(r.join("\n"),s).isPrompt)return d(r,t,o,u,s,S);let I=(0,c.vp)(h),k=w.test(I),v=y.test(I),P=x.test(I),E=("codex"===s||"gemini"===s)&&k&&!P,T="claude"===s&&k&&v&&!P;if(E||T){let e=[],n=$(t,o,u,s,S),i=o;for(let t=n;t<o;t++){let n=r[t],o=(0,c.vp)(n);if("codex"===s&&/^›\s+/.test(o)||"gemini"===s&&/^(%|\$|.*@.*[%$#])\s*$/.test(o)){i=t;break}C.some(e=>e.test(o))||e.push(n)}let a=e.join("\n").trim(),l=a.split("\n").slice(-5).join("\n");if(x.test(l))return p(o);if("claude"===s){let e=(0,c.vp)(a),t=/[╭╮╰╯│]/.test(e)||/░{3,}/.test(e)||/▓{3,}/.test(e),s=/Claude Code|claude\/|v\d+\.\d+/.test(e),n=/Tip:|for shortcuts|\?\s*for help/.test(e),i=/^\s*\/Users\/.*$/m.test(e)&&e.split("\n").length<30,r=e.match(/^[>❯]\s+(\S.*)$/m);if(r){let t=e.indexOf(r[0]);if(0===e.substring(t+r[0].length).trim().split("\n").filter(e=>{let t=e.trim();return t&&!C.some(e=>e.test(t))&&!/^─+$/.test(t)}).length)return p(o)}else if((t||s||n||i)&&a.length<2e3)return p(o)}return"gemini"===s&&((a.match(/[░███]/g)||[]).length>.3*a.length||m.some(e=>a.includes(e))||!a.includes("✦")&&a.length<10)?p(o):{response:a,isComplete:!0,lineCount:i}}if(g(r.join("\n"),s).isPrompt)return d(r,t,o,u,s,S);let b=[],M=u||t>=o-5,N=M?S(80):-1,D=M?N>=0?N+1:Math.max(0,o-80):Math.max(0,t);for(let e=D;e<o;e++){let t=r[e],s=(0,c.vp)(t);C.some(e=>e.test(s))||b.push(t)}let A=b.join("\n").trim();return A?{response:A,isComplete:!1,lineCount:o}:p(o)}(f,a,t);if(!h||!h.isComplete){let{thinkingPattern:n}=(0,c.bs)(t),i=(0,c.vp)(f).split("\n").slice(-5).join("\n");if(n.test(i)){let n=(0,r.GP)(s,e,t);n>0&&console.log(`Marked ${n} pending prompt(s) as answered (thinking detected) for ${e}`)}return!1}if(h.lineCount===a&&!i?.inProgressMessageId)return!1;if(h.lineCount<=a)return console.log(`[checkForResponse] Already saved up to line ${a}, skipping (result: ${h.lineCount})`),!1;let x=g(h.response,t);if(x.isPrompt){(0,r.Mf)(s,e,t);let n=(0,r.tn)(s,{worktreeId:e,role:"assistant",content:x.rawContent||x.cleanContent,messageType:"prompt",promptData:x.promptData,timestamp:new Date,cliToolId:t});return(0,r.IH)(s,e,t,h.lineCount),(0,o.ps)("message",{worktreeId:e,message:n}),S(e,t),!0}if(!h.response||""===h.response.trim())return(0,r.IH)(s,e,t,h.lineCount),!1;let C="claude"===t?(0,u.Z)(h.response):void 0,I=h.response;if("gemini"===t?I=y(h.response):"claude"===t&&(I=w(h.response)),!I||""===I.trim()||"[No content]"===I)return(0,r.IH)(s,e,t,h.lineCount),(0,r.Mf)(s,e,t),!1;I&&await (0,l.o)(s,e,I,t);let k=(0,r.GP)(s,e,t);k>0&&console.log(`Marked ${k} pending prompt(s) as answered for ${e}`);let v=(0,r.zl)(s,e,t);if(v&&h.lineCount<=v.lastCapturedLine)return console.log(`[checkForResponse] Race condition detected, skipping save (result: ${h.lineCount}, current: ${v.lastCapturedLine})`),!1;let P=(0,r.tn)(s,{worktreeId:e,role:"assistant",content:I,messageType:"normal",timestamp:new Date,cliToolId:t,summary:C?.summary,logFileName:C?.logFileName,requestId:C?.requestId});return(0,o.ps)("message",{worktreeId:e,message:P}),(0,r.IH)(s,e,t,h.lineCount),!0}catch(t){return console.error(`Error checking for response (${e}):`,t instanceof Error?t.message:String(t)),!1}}function C(e,t){let s=`${e}:${t}`;S(e,t),h.set(s,Date.now());let n=setInterval(async()=>{let n=h.get(s);if(n&&Date.now()-n>18e5){S(e,t);return}try{await x(e,t)}catch(e){console.error("[Poller] Error:",e)}},2e3);f.set(s,n)}function S(e,t){let s=`${e}:${t}`,n=f.get(s);n&&(clearInterval(n),f.delete(s),h.delete(s))}}};