commandmate 0.2.9 → 0.2.11

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 (66) hide show
  1. package/.env.example +2 -1
  2. package/.next/BUILD_ID +1 -1
  3. package/.next/app-build-manifest.json +12 -12
  4. package/.next/app-path-routes-manifest.json +1 -1
  5. package/.next/build-manifest.json +2 -2
  6. package/.next/cache/.tsbuildinfo +1 -1
  7. package/.next/cache/config.json +3 -3
  8. package/.next/cache/webpack/client-production/0.pack +0 -0
  9. package/.next/cache/webpack/client-production/1.pack +0 -0
  10. package/.next/cache/webpack/client-production/2.pack +0 -0
  11. package/.next/cache/webpack/client-production/index.pack +0 -0
  12. package/.next/cache/webpack/client-production/index.pack.old +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-minimal-server.js.nft.json +1 -1
  17. package/.next/next-server.js.nft.json +1 -1
  18. package/.next/prerender-manifest.json +1 -1
  19. package/.next/required-server-files.json +1 -1
  20. package/.next/routes-manifest.json +1 -1
  21. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  22. package/.next/server/app/api/app/update-check/route.js +1 -1
  23. package/.next/server/app/api/repositories/clone/[jobId]/route.js +1 -1
  24. package/.next/server/app/api/repositories/clone/route.js +1 -1
  25. package/.next/server/app/api/repositories/route.js +10 -10
  26. package/.next/server/app/api/repositories/route.js.nft.json +1 -1
  27. package/.next/server/app/api/worktrees/[id]/auto-yes/route.js +1 -1
  28. package/.next/server/app/api/worktrees/[id]/auto-yes/route.js.nft.json +1 -1
  29. package/.next/server/app/api/worktrees/[id]/current-output/route.js +1 -1
  30. package/.next/server/app/api/worktrees/[id]/current-output/route.js.nft.json +1 -1
  31. package/.next/server/app/api/worktrees/[id]/files/[...path]/route.js +1 -1
  32. package/.next/server/app/api/worktrees/[id]/prompt-response/route.js +1 -1
  33. package/.next/server/app/api/worktrees/[id]/search/route.js +1 -1
  34. package/.next/server/app/api/worktrees/[id]/upload/[...path]/route.js +1 -1
  35. package/.next/server/app/page_client-reference-manifest.js +1 -1
  36. package/.next/server/app/worktrees/[id]/files/[...path]/page.js +1 -1
  37. package/.next/server/app/worktrees/[id]/files/[...path]/page_client-reference-manifest.js +1 -1
  38. package/.next/server/app/worktrees/[id]/page.js +3 -3
  39. package/.next/server/app/worktrees/[id]/page_client-reference-manifest.js +1 -1
  40. package/.next/server/app/worktrees/[id]/terminal/page_client-reference-manifest.js +1 -1
  41. package/.next/server/app-paths-manifest.json +5 -5
  42. package/.next/server/chunks/5488.js +4 -4
  43. package/.next/server/chunks/7536.js +1 -1
  44. package/.next/server/chunks/8693.js +1 -0
  45. package/.next/server/chunks/9238.js +14 -14
  46. package/.next/server/chunks/9367.js +2 -2
  47. package/.next/server/pages/500.html +1 -1
  48. package/.next/server/server-reference-manifest.json +1 -1
  49. package/.next/static/chunks/5970-2e18108d0cabd8af.js +1 -0
  50. package/.next/static/chunks/app/worktrees/[id]/files/[...path]/page-4a3c0861367e0391.js +1 -0
  51. package/.next/static/chunks/app/worktrees/[id]/page-dc0dde49ed95076f.js +1 -0
  52. package/.next/static/css/7c6675f6f65b4990.css +3 -0
  53. package/.next/trace +5 -5
  54. package/README.md +232 -46
  55. package/dist/server/src/lib/auto-yes-manager.js +124 -84
  56. package/dist/server/src/lib/claude-session.js +60 -21
  57. package/dist/server/src/lib/prompt-answer-sender.js +89 -0
  58. package/dist/server/src/lib/prompt-detector.js +9 -0
  59. package/dist/server/src/lib/prompt-key.js +30 -0
  60. package/package.json +12 -1
  61. package/.next/static/chunks/5970-9e999084275f2995.js +0 -1
  62. package/.next/static/chunks/app/worktrees/[id]/files/[...path]/page-ce9ac3658f2b7d91.js +0 -1
  63. package/.next/static/chunks/app/worktrees/[id]/page-5abc1e9b59430db1.js +0 -1
  64. package/.next/static/css/a69d9c70fce558b4.css +0 -3
  65. /package/.next/static/{5sR3jeFe8ymnzcEan6Rdt → ZTtC8-q8xrYUSilnXmMHl}/_buildManifest.js +0 -0
  66. /package/.next/static/{5sR3jeFe8ymnzcEan6Rdt → ZTtC8-q8xrYUSilnXmMHl}/_ssgManifest.js +0 -0
@@ -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}},"18828":{"*":{"id":"2108","name":"*","chunks":[],"async":false}},"19107":{"*":{"id":"96114","name":"*","chunks":[],"async":false}},"36423":{"*":{"id":"84759","name":"*","chunks":[],"async":false}},"41845":{"*":{"id":"37398","name":"*","chunks":[],"async":false}},"43095":{"*":{"id":"94881","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","816","static/chunks/816-af44cb865b0c980e.js","3185","static/chunks/app/layout-07755491d5d57242.js"],"async":false},"/home/runner/work/CommandMate/CommandMate/src/components/providers/AppProviders.tsx":{"id":18828,"name":"*","chunks":["9234","static/chunks/9234-b0304101384ca079.js","816","static/chunks/816-af44cb865b0c980e.js","3185","static/chunks/app/layout-07755491d5d57242.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","816","static/chunks/816-af44cb865b0c980e.js","5970","static/chunks/5970-9e999084275f2995.js","1931","static/chunks/app/page-a6593b9640df66a6.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":43095,"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","8864","static/chunks/8864-2f60eadc8404fdd0.js","816","static/chunks/816-af44cb865b0c980e.js","5970","static/chunks/5970-9e999084275f2995.js","130","static/chunks/app/worktrees/%5Bid%5D/page-5abc1e9b59430db1.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/a69d9c70fce558b4.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}},"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","816","static/chunks/816-af44cb865b0c980e.js","3185","static/chunks/app/layout-07755491d5d57242.js"],"async":false},"/home/runner/work/CommandMate/CommandMate/src/components/providers/AppProviders.tsx":{"id":18828,"name":"*","chunks":["9234","static/chunks/9234-b0304101384ca079.js","816","static/chunks/816-af44cb865b0c980e.js","3185","static/chunks/app/layout-07755491d5d57242.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","816","static/chunks/816-af44cb865b0c980e.js","5970","static/chunks/5970-2e18108d0cabd8af.js","1931","static/chunks/app/page-a6593b9640df66a6.js"],"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","8864","static/chunks/8864-2f60eadc8404fdd0.js","816","static/chunks/816-af44cb865b0c980e.js","5970","static/chunks/5970-2e18108d0cabd8af.js","130","static/chunks/app/worktrees/%5Bid%5D/page-dc0dde49ed95076f.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]/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/7c6675f6f65b4990.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}},"18828":{"*":{"id":"2108","name":"*","chunks":[],"async":false}},"19107":{"*":{"id":"96114","name":"*","chunks":[],"async":false}},"36423":{"*":{"id":"84759","name":"*","chunks":[],"async":false}},"41845":{"*":{"id":"37398","name":"*","chunks":[],"async":false}},"43095":{"*":{"id":"94881","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","816","static/chunks/816-af44cb865b0c980e.js","3185","static/chunks/app/layout-07755491d5d57242.js"],"async":false},"/home/runner/work/CommandMate/CommandMate/src/components/providers/AppProviders.tsx":{"id":18828,"name":"*","chunks":["9234","static/chunks/9234-b0304101384ca079.js","816","static/chunks/816-af44cb865b0c980e.js","3185","static/chunks/app/layout-07755491d5d57242.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","816","static/chunks/816-af44cb865b0c980e.js","5970","static/chunks/5970-9e999084275f2995.js","1931","static/chunks/app/page-a6593b9640df66a6.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":43095,"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","8864","static/chunks/8864-2f60eadc8404fdd0.js","816","static/chunks/816-af44cb865b0c980e.js","5970","static/chunks/5970-9e999084275f2995.js","130","static/chunks/app/worktrees/%5Bid%5D/page-5abc1e9b59430db1.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/a69d9c70fce558b4.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}},"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","816","static/chunks/816-af44cb865b0c980e.js","3185","static/chunks/app/layout-07755491d5d57242.js"],"async":false},"/home/runner/work/CommandMate/CommandMate/src/components/providers/AppProviders.tsx":{"id":18828,"name":"*","chunks":["9234","static/chunks/9234-b0304101384ca079.js","816","static/chunks/816-af44cb865b0c980e.js","3185","static/chunks/app/layout-07755491d5d57242.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","816","static/chunks/816-af44cb865b0c980e.js","5970","static/chunks/5970-2e18108d0cabd8af.js","1931","static/chunks/app/page-a6593b9640df66a6.js"],"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","8864","static/chunks/8864-2f60eadc8404fdd0.js","816","static/chunks/816-af44cb865b0c980e.js","5970","static/chunks/5970-2e18108d0cabd8af.js","130","static/chunks/app/worktrees/%5Bid%5D/page-dc0dde49ed95076f.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]/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/7c6675f6f65b4990.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,9 +5,9 @@
5
5
  "/api/repositories/clone/route": "app/api/repositories/clone/route.js",
6
6
  "/api/repositories/excluded/route": "app/api/repositories/excluded/route.js",
7
7
  "/api/repositories/restore/route": "app/api/repositories/restore/route.js",
8
+ "/api/repositories/scan/route": "app/api/repositories/scan/route.js",
8
9
  "/api/repositories/route": "app/api/repositories/route.js",
9
10
  "/api/repositories/sync/route": "app/api/repositories/sync/route.js",
10
- "/api/repositories/scan/route": "app/api/repositories/scan/route.js",
11
11
  "/api/slash-commands/route": "app/api/slash-commands/route.js",
12
12
  "/api/worktrees/[id]/auto-yes/route": "app/api/worktrees/[id]/auto-yes/route.js",
13
13
  "/api/worktrees/[id]/capture/route": "app/api/worktrees/[id]/capture/route.js",
@@ -15,8 +15,8 @@
15
15
  "/api/worktrees/[id]/current-output/route": "app/api/worktrees/[id]/current-output/route.js",
16
16
  "/api/worktrees/[id]/files/[...path]/route": "app/api/worktrees/[id]/files/[...path]/route.js",
17
17
  "/api/worktrees/[id]/interrupt/route": "app/api/worktrees/[id]/interrupt/route.js",
18
- "/api/worktrees/[id]/kill-session/route": "app/api/worktrees/[id]/kill-session/route.js",
19
18
  "/api/worktrees/[id]/memos/[memoId]/route": "app/api/worktrees/[id]/memos/[memoId]/route.js",
19
+ "/api/worktrees/[id]/kill-session/route": "app/api/worktrees/[id]/kill-session/route.js",
20
20
  "/api/worktrees/[id]/memos/route": "app/api/worktrees/[id]/memos/route.js",
21
21
  "/api/worktrees/[id]/messages/route": "app/api/worktrees/[id]/messages/route.js",
22
22
  "/api/worktrees/[id]/prompt-response/route": "app/api/worktrees/[id]/prompt-response/route.js",
@@ -25,8 +25,8 @@
25
25
  "/api/worktrees/[id]/search/route": "app/api/worktrees/[id]/search/route.js",
26
26
  "/api/worktrees/[id]/send/route": "app/api/worktrees/[id]/send/route.js",
27
27
  "/api/worktrees/[id]/slash-commands/route": "app/api/worktrees/[id]/slash-commands/route.js",
28
- "/api/worktrees/[id]/terminal/route": "app/api/worktrees/[id]/terminal/route.js",
29
28
  "/api/worktrees/[id]/start-polling/route": "app/api/worktrees/[id]/start-polling/route.js",
29
+ "/api/worktrees/[id]/terminal/route": "app/api/worktrees/[id]/terminal/route.js",
30
30
  "/api/worktrees/[id]/tree/[...path]/route": "app/api/worktrees/[id]/tree/[...path]/route.js",
31
31
  "/api/worktrees/[id]/tree/route": "app/api/worktrees/[id]/tree/route.js",
32
32
  "/api/worktrees/[id]/upload/[...path]/route": "app/api/worktrees/[id]/upload/[...path]/route.js",
@@ -34,13 +34,13 @@
34
34
  "/apple-icon.png/route": "app/apple-icon.png/route.js",
35
35
  "/page": "app/page.js",
36
36
  "/icon.png/route": "app/icon.png/route.js",
37
- "/worktrees/[id]/files/[...path]/page": "app/worktrees/[id]/files/[...path]/page.js",
38
37
  "/worktrees/[id]/page": "app/worktrees/[id]/page.js",
38
+ "/worktrees/[id]/files/[...path]/page": "app/worktrees/[id]/files/[...path]/page.js",
39
39
  "/worktrees/[id]/terminal/page": "app/worktrees/[id]/terminal/page.js",
40
40
  "/api/app/update-check/route": "app/api/app/update-check/route.js",
41
41
  "/api/external-apps/[id]/health/route": "app/api/external-apps/[id]/health/route.js",
42
- "/api/external-apps/route": "app/api/external-apps/route.js",
43
42
  "/api/external-apps/[id]/route": "app/api/external-apps/[id]/route.js",
43
+ "/api/external-apps/route": "app/api/external-apps/route.js",
44
44
  "/api/worktrees/[id]/logs/route": "app/api/worktrees/[id]/logs/route.js",
45
45
  "/api/worktrees/[id]/logs/[filename]/route": "app/api/worktrees/[id]/logs/[filename]/route.js",
46
46
  "/api/worktrees/route": "app/api/worktrees/route.js",
@@ -1,4 +1,4 @@
1
- "use strict";exports.id=5488,exports.ids=[5488],exports.modules={65488:(e,t,r)=>{r.d(t,{v:()=>g});var o=r(61282),s=r(92048),a=r(55315),n=r.n(a);class i{constructor(){}static getInstance(){return i.instance||(i.instance=new i),i.instance}normalize(e){let t=e.match(/^ssh:\/\/git@([^:\/]+)(:\d+)?\/(.+?)(\.git)?$/);if(t)return`https://${t[1]}/${t[3]}`.toLowerCase().replace(/\/$/,"");let r=e.match(/^git@([^:]+):(.+?)(\.git)?$/);return r?`https://${r[1]}/${r[2]}`.toLowerCase().replace(/\/$/,""):e.replace(/\.git\/?$/,"").replace(/\/$/,"").toLowerCase()}isSameRepository(e,t){return this.normalize(e)===this.normalize(t)}extractRepoName(e){let t=e.match(/^ssh:\/\/git@[^\/]+\/(.+?)(\.git)?$/);if(t){let e=t[1].split("/");return e[e.length-1]}let r=e.match(/:(.+?)(\.git)?$/);if(r&&e.startsWith("git@")){let e=r[1].split("/");return e[e.length-1]}let o=e.match(/\/([^\/]+?)(\.git)?$/);return o?o[1]:""}getUrlType(e){return e.startsWith("https://")?"https":e.startsWith("git@")||e.startsWith("ssh://")?"ssh":null}validate(e){if(!e||"string"!=typeof e||""===e.trim())return{valid:!1,error:"EMPTY_URL"};let t=e.trim();return t.startsWith("https://")?/^https:\/\/[^\/]+\/[^\/]+\/[^\/]+(\.git)?$/.test(t)?{valid:!0}:{valid:!1,error:"INVALID_URL_FORMAT"}:t.startsWith("git@")?/^git@[^:]+:.+\/.+(\.git)?$/.test(t)?{valid:!0}:{valid:!1,error:"INVALID_URL_FORMAT"}:t.startsWith("ssh://")&&/^ssh:\/\/git@[^\/]+(:\d+)?\/[^\/]+\/.+(\.git)?$/.test(t)?{valid:!0}:{valid:!1,error:"INVALID_URL_FORMAT"}}}var l=r(57440),c=r(4709),d=r(67722);class u extends Error{constructor(e){super(e.message),this.name="CloneManagerError",this.category=e.category,this.code=e.code,this.recoverable=e.recoverable,this.suggestedAction=e.suggestedAction}}let p={EMPTY_URL:{category:"validation",code:"EMPTY_URL",message:"Clone URL is required",recoverable:!0,suggestedAction:"Please enter a valid git clone URL"},INVALID_URL_FORMAT:{category:"validation",code:"INVALID_URL_FORMAT",message:"Invalid URL format. Please use HTTPS or SSH URL.",recoverable:!0,suggestedAction:"Enter a valid URL like https://github.com/owner/repo or git@github.com:owner/repo"},DUPLICATE_CLONE_URL:{category:"validation",code:"DUPLICATE_CLONE_URL",message:"This repository is already registered",recoverable:!1,suggestedAction:"Use the existing repository instead"},CLONE_IN_PROGRESS:{category:"validation",code:"CLONE_IN_PROGRESS",message:"A clone operation is already in progress for this URL",recoverable:!1,suggestedAction:"Wait for the current clone to complete"},DIRECTORY_EXISTS:{category:"filesystem",code:"DIRECTORY_EXISTS",message:"Target directory already exists",recoverable:!0,suggestedAction:"Choose a different directory or remove the existing one"},INVALID_TARGET_PATH:{category:"validation",code:"INVALID_TARGET_PATH",message:"Target path is invalid or outside allowed directory",recoverable:!0,suggestedAction:"Use a path within the configured base directory"},AUTH_FAILED:{category:"auth",code:"AUTH_FAILED",message:"Authentication failed",recoverable:!0,suggestedAction:"Check your credentials or SSH keys"},NETWORK_ERROR:{category:"network",code:"NETWORK_ERROR",message:"Network error occurred",recoverable:!0,suggestedAction:"Check your internet connection and try again"},GIT_ERROR:{category:"git",code:"GIT_ERROR",message:"Git command failed",recoverable:!1,suggestedAction:"Check the error message for details"},CLONE_TIMEOUT:{category:"network",code:"CLONE_TIMEOUT",message:"Clone operation timed out",recoverable:!0,suggestedAction:"Try again or clone a smaller repository"}};class g{constructor(e,t={}){this.db=e,this.urlNormalizer=i.getInstance(),this.config={basePath:t.basePath||process.env.WORKTREE_BASE_PATH||"/tmp/repos",timeout:t.timeout||6e5},this.activeProcesses=new Map}validateCloneRequest(e){let t=this.urlNormalizer.validate(e);return t.valid?{valid:!0,normalizedUrl:this.urlNormalizer.normalize(e),repoName:this.urlNormalizer.extractRepoName(e)}:{valid:!1,error:p[t.error||"INVALID_URL_FORMAT"]}}checkDuplicateRepository(e){return(0,c.nb)(this.db,e)}checkActiveCloneJob(e){return(0,c.fC)(this.db,e)}createCloneJob(e){return(0,c.Bm)(this.db,e)}getTargetPath(e){return n().join(this.config.basePath,e)}async startCloneJob(e,t){let r=this.validateCloneRequest(e);if(!r.valid)return{success:!1,error:r.error};let o=r.normalizedUrl,a=r.repoName,n=this.checkDuplicateRepository(o);if(n)return{success:!1,error:{...p.DUPLICATE_CLONE_URL,message:`This repository is already registered as "${n.name}"`}};let i=this.checkActiveCloneJob(o);if(i)return{success:!1,jobId:i.id,error:p.CLONE_IN_PROGRESS};let c=t||this.getTargetPath(a);if(t&&!(0,l.j)(t,this.config.basePath))return{success:!1,error:{...p.INVALID_TARGET_PATH,message:`Target path must be within ${this.config.basePath}`}};if((0,s.existsSync)(c))return{success:!1,error:{...p.DIRECTORY_EXISTS,message:`Target directory already exists: ${c}`}};let d=this.createCloneJob({cloneUrl:e,normalizedCloneUrl:o,targetPath:c});return this.executeClone(d.id,e,c).catch(e=>{console.error(`[CloneManager] Clone failed for job ${d.id}:`,e)}),{success:!0,jobId:d.id}}async executeClone(e,t,r){(0,c.sN)(this.db,e,{status:"running",startedAt:new Date});let a=n().dirname(r);return(0,s.existsSync)(a)||(0,s.mkdirSync)(a,{recursive:!0}),new Promise((s,a)=>{let n=(0,o.spawn)("git",["clone","--progress",t,r],{stdio:["ignore","pipe","pipe"]});this.activeProcesses.set(e,n),n.pid&&(0,c.sN)(this.db,e,{pid:n.pid});let i="";n.stderr?.on("data",t=>{i+=t.toString();let r=this.parseGitProgress(t.toString());null!==r&&c.sN(this.db,e,{progress:r})});let l=setTimeout(()=>{n.kill("SIGTERM"),(0,c.sN)(this.db,e,{status:"failed",errorCategory:"network",errorCode:"CLONE_TIMEOUT",errorMessage:"Clone operation timed out",completedAt:new Date}),this.activeProcesses.delete(e),a(new u(p.CLONE_TIMEOUT))},this.config.timeout);n.on("close",async o=>{if(clearTimeout(l),this.activeProcesses.delete(e),0===o)await this.onCloneSuccess(e,t,r),s();else{let t=this.parseGitError(i,o);(0,c.sN)(this.db,e,{status:"failed",errorCategory:t.category,errorCode:t.code,errorMessage:t.message,completedAt:new Date}),a(new u(t))}}),n.on("error",t=>{clearTimeout(l),this.activeProcesses.delete(e);let r={category:"system",code:"SPAWN_ERROR",message:`Failed to spawn git process: ${t.message}`,recoverable:!1,suggestedAction:"Ensure git is installed and available in PATH"};(0,c.sN)(this.db,e,{status:"failed",errorCategory:r.category,errorCode:r.code,errorMessage:r.message,completedAt:new Date}),a(new u(r))})})}async onCloneSuccess(e,t,r){let o=(0,c.L_)(this.db,e);if(!o)return;let s=this.urlNormalizer.getUrlType(t),a=(0,c.h4)(this.db,{name:n().basename(r),path:r,cloneUrl:t,normalizedCloneUrl:o.normalizedCloneUrl,cloneSource:s||"https"});try{let e=await (0,d.e9)(r);e.length>0&&((0,d.h2)(this.db,e),console.log(`[CloneManager] Registered ${e.length} worktree(s) for ${r}`))}catch(e){console.error(`[CloneManager] Failed to scan worktrees for ${r}:`,e)}(0,c.sN)(this.db,e,{status:"completed",progress:100,repositoryId:a.id,completedAt:new Date})}parseGitProgress(e){let t=e.match(/(?:Receiving objects|Resolving deltas|Cloning into[^:]*?):\s*(\d+)%/);if(t){let e=parseInt(t[1],10);return isNaN(e)?null:e}return null}parseGitError(e,t){let r=e.toLowerCase(),o=e.substring(0,200);return["authentication failed","permission denied","could not read from remote repository"].some(e=>r.includes(e))?{...p.AUTH_FAILED,message:`Authentication failed: ${o}`}:["could not resolve host","connection refused","network is unreachable"].some(e=>r.includes(e))?{...p.NETWORK_ERROR,message:`Network error: ${o}`}:{...p.GIT_ERROR,message:`Git clone failed (exit code ${t}): ${o}`}}getCloneJobStatus(e){let t=(0,c.L_)(this.db,e);if(!t)return null;let r={jobId:t.id,status:t.status,progress:t.progress,repositoryId:t.repositoryId};return"failed"===t.status&&t.errorCode&&(r.error={category:t.errorCategory||"system",code:t.errorCode,message:t.errorMessage||"Unknown error"}),r}cancelCloneJob(e){let t=this.activeProcesses.get(e);if(t)return t.kill("SIGTERM"),this.activeProcesses.delete(e),(0,c.sN)(this.db,e,{status:"cancelled",completedAt:new Date}),!0;let r=(0,c.L_)(this.db,e);return!!r&&"pending"===r.status&&((0,c.sN)(this.db,e,{status:"cancelled",completedAt:new Date}),!0)}}},4709:(e,t,r)=>{r.d(t,{Bj:()=>_,Bm:()=>R,L_:()=>v,RT:()=>f,VZ:()=>h,fC:()=>C,h4:()=>c,mm:()=>E,nJ:()=>m,nb:()=>d,sN:()=>b});var o=r(84770),s=r(55315),a=r.n(s),n=r(43753);function i(e){return{id:e.id,name:e.name,path:e.path,enabled:1===e.enabled,cloneUrl:e.clone_url||void 0,normalizedCloneUrl:e.normalized_clone_url||void 0,cloneSource:e.clone_source,isEnvManaged:1===e.is_env_managed,createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at)}}function l(e){return{id:e.id,cloneUrl:e.clone_url,normalizedCloneUrl:e.normalized_clone_url,targetPath:e.target_path,repositoryId:e.repository_id||void 0,status:e.status,pid:e.pid||void 0,progress:e.progress,errorCategory:e.error_category||void 0,errorCode:e.error_code||void 0,errorMessage:e.error_message||void 0,startedAt:e.started_at?new Date(e.started_at):void 0,completedAt:e.completed_at?new Date(e.completed_at):void 0,createdAt:new Date(e.created_at)}}function c(e,t){let r=(0,o.randomUUID)(),s=Date.now();return e.prepare(`
1
+ "use strict";exports.id=5488,exports.ids=[5488],exports.modules={65488:(e,t,r)=>{r.d(t,{v9:()=>h});var o=r(61282),s=r(92048),a=r(55315),n=r.n(a);class i{constructor(){}static getInstance(){return i.instance||(i.instance=new i),i.instance}normalize(e){let t=e.match(/^ssh:\/\/git@([^:\/]+)(:\d+)?\/(.+?)(\.git)?$/);if(t)return`https://${t[1]}/${t[3]}`.toLowerCase().replace(/\/$/,"");let r=e.match(/^git@([^:]+):(.+?)(\.git)?$/);return r?`https://${r[1]}/${r[2]}`.toLowerCase().replace(/\/$/,""):e.replace(/\.git\/?$/,"").replace(/\/$/,"").toLowerCase()}isSameRepository(e,t){return this.normalize(e)===this.normalize(t)}extractRepoName(e){let t=e.match(/^ssh:\/\/git@[^\/]+\/(.+?)(\.git)?$/);if(t){let e=t[1].split("/");return e[e.length-1]}let r=e.match(/:(.+?)(\.git)?$/);if(r&&e.startsWith("git@")){let e=r[1].split("/");return e[e.length-1]}let o=e.match(/\/([^\/]+?)(\.git)?$/);return o?o[1]:""}getUrlType(e){return e.startsWith("https://")?"https":e.startsWith("git@")||e.startsWith("ssh://")?"ssh":null}validate(e){if(!e||"string"!=typeof e||""===e.trim())return{valid:!1,error:"EMPTY_URL"};let t=e.trim();return t.startsWith("https://")?/^https:\/\/[^\/]+\/[^\/]+\/[^\/]+(\.git)?$/.test(t)?{valid:!0}:{valid:!1,error:"INVALID_URL_FORMAT"}:t.startsWith("git@")?/^git@[^:]+:.+\/.+(\.git)?$/.test(t)?{valid:!0}:{valid:!1,error:"INVALID_URL_FORMAT"}:t.startsWith("ssh://")&&/^ssh:\/\/git@[^\/]+(:\d+)?\/[^\/]+\/.+(\.git)?$/.test(t)?{valid:!0}:{valid:!1,error:"INVALID_URL_FORMAT"}}}var l=r(57440),c=r(4709),d=r(67722);class u extends Error{constructor(e){super(e.message),this.name="CloneManagerError",this.category=e.category,this.code=e.code,this.recoverable=e.recoverable,this.suggestedAction=e.suggestedAction}}let p={EMPTY_URL:{category:"validation",code:"EMPTY_URL",message:"Clone URL is required",recoverable:!0,suggestedAction:"Please enter a valid git clone URL"},INVALID_URL_FORMAT:{category:"validation",code:"INVALID_URL_FORMAT",message:"Invalid URL format. Please use HTTPS or SSH URL.",recoverable:!0,suggestedAction:"Enter a valid URL like https://github.com/owner/repo or git@github.com:owner/repo"},DUPLICATE_CLONE_URL:{category:"validation",code:"DUPLICATE_CLONE_URL",message:"This repository is already registered",recoverable:!1,suggestedAction:"Use the existing repository instead"},CLONE_IN_PROGRESS:{category:"validation",code:"CLONE_IN_PROGRESS",message:"A clone operation is already in progress for this URL",recoverable:!1,suggestedAction:"Wait for the current clone to complete"},DIRECTORY_EXISTS:{category:"filesystem",code:"DIRECTORY_EXISTS",message:"Target directory already exists",recoverable:!0,suggestedAction:"Choose a different directory or remove the existing one"},INVALID_TARGET_PATH:{category:"validation",code:"INVALID_TARGET_PATH",message:"Target path is invalid or outside allowed directory",recoverable:!0,suggestedAction:"Use a path within the configured base directory"},AUTH_FAILED:{category:"auth",code:"AUTH_FAILED",message:"Authentication failed",recoverable:!0,suggestedAction:"Check your credentials or SSH keys"},NETWORK_ERROR:{category:"network",code:"NETWORK_ERROR",message:"Network error occurred",recoverable:!0,suggestedAction:"Check your internet connection and try again"},GIT_ERROR:{category:"git",code:"GIT_ERROR",message:"Git command failed",recoverable:!1,suggestedAction:"Check the error message for details"},CLONE_TIMEOUT:{category:"network",code:"CLONE_TIMEOUT",message:"Clone operation timed out",recoverable:!0,suggestedAction:"Try again or clone a smaller repository"}},g=!1;class h{constructor(e,t={}){this.db=e,this.urlNormalizer=i.getInstance(),this.config={basePath:t.basePath||this.resolveDefaultBasePath(),timeout:t.timeout||6e5},this.activeProcesses=new Map}resolveDefaultBasePath(){let e=process.env.WORKTREE_BASE_PATH;return e?(g||(console.warn("[DEPRECATED] WORKTREE_BASE_PATH is deprecated. Set CM_ROOT_DIR in your .env file instead."),g=!0),n().resolve(e)):process.cwd()}validateCloneRequest(e){let t=this.urlNormalizer.validate(e);return t.valid?{valid:!0,normalizedUrl:this.urlNormalizer.normalize(e),repoName:this.urlNormalizer.extractRepoName(e)}:{valid:!1,error:p[t.error||"INVALID_URL_FORMAT"]}}checkDuplicateRepository(e){return(0,c.nb)(this.db,e)}checkActiveCloneJob(e){return(0,c.fC)(this.db,e)}createCloneJob(e){return(0,c.Bm)(this.db,e)}getTargetPath(e){return n().join(this.config.basePath,e)}async startCloneJob(e,t){let r=this.validateCloneRequest(e);if(!r.valid)return{success:!1,error:r.error};let o=r.normalizedUrl,a=r.repoName,n=this.checkDuplicateRepository(o);if(n)return{success:!1,error:{...p.DUPLICATE_CLONE_URL,message:`This repository is already registered as "${n.name}"`}};let i=this.checkActiveCloneJob(o);if(i)return{success:!1,jobId:i.id,error:p.CLONE_IN_PROGRESS};let c=t||this.getTargetPath(a);if(t&&!(0,l.j)(t,this.config.basePath))return{success:!1,error:p.INVALID_TARGET_PATH};if((0,s.existsSync)(c))return{success:!1,error:p.DIRECTORY_EXISTS};let d=this.createCloneJob({cloneUrl:e,normalizedCloneUrl:o,targetPath:c});return this.executeClone(d.id,e,c).catch(e=>{console.error(`[CloneManager] Clone failed for job ${d.id}:`,e)}),{success:!0,jobId:d.id}}async executeClone(e,t,r){(0,c.sN)(this.db,e,{status:"running",startedAt:new Date});let a=n().dirname(r);return(0,s.existsSync)(a)||(0,s.mkdirSync)(a,{recursive:!0}),new Promise((s,a)=>{let n=(0,o.spawn)("git",["clone","--progress",t,r],{stdio:["ignore","pipe","pipe"]});this.activeProcesses.set(e,n),n.pid&&(0,c.sN)(this.db,e,{pid:n.pid});let i="";n.stderr?.on("data",t=>{i+=t.toString();let r=this.parseGitProgress(t.toString());null!==r&&c.sN(this.db,e,{progress:r})});let l=setTimeout(()=>{n.kill("SIGTERM"),(0,c.sN)(this.db,e,{status:"failed",errorCategory:"network",errorCode:"CLONE_TIMEOUT",errorMessage:"Clone operation timed out",completedAt:new Date}),this.activeProcesses.delete(e),a(new u(p.CLONE_TIMEOUT))},this.config.timeout);n.on("close",async o=>{if(clearTimeout(l),this.activeProcesses.delete(e),0===o)await this.onCloneSuccess(e,t,r),s();else{let t=this.parseGitError(i,o);(0,c.sN)(this.db,e,{status:"failed",errorCategory:t.category,errorCode:t.code,errorMessage:t.message,completedAt:new Date}),a(new u(t))}}),n.on("error",t=>{clearTimeout(l),this.activeProcesses.delete(e);let r={category:"system",code:"SPAWN_ERROR",message:`Failed to spawn git process: ${t.message}`,recoverable:!1,suggestedAction:"Ensure git is installed and available in PATH"};(0,c.sN)(this.db,e,{status:"failed",errorCategory:r.category,errorCode:r.code,errorMessage:r.message,completedAt:new Date}),a(new u(r))})})}async onCloneSuccess(e,t,r){let o=(0,c.L_)(this.db,e);if(!o)return;let s=this.urlNormalizer.getUrlType(t),a=(0,c.h4)(this.db,{name:n().basename(r),path:r,cloneUrl:t,normalizedCloneUrl:o.normalizedCloneUrl,cloneSource:s||"https"});try{let e=await (0,d.e9)(r);e.length>0&&((0,d.h2)(this.db,e),console.log(`[CloneManager] Registered ${e.length} worktree(s) for ${r}`))}catch(e){console.error(`[CloneManager] Failed to scan worktrees for ${r}:`,e)}(0,c.sN)(this.db,e,{status:"completed",progress:100,repositoryId:a.id,completedAt:new Date})}parseGitProgress(e){let t=e.match(/(?:Receiving objects|Resolving deltas|Cloning into[^:]*?):\s*(\d+)%/);if(t){let e=parseInt(t[1],10);return isNaN(e)?null:e}return null}parseGitError(e,t){let r=e.toLowerCase(),o=e.substring(0,200);return["authentication failed","permission denied","could not read from remote repository"].some(e=>r.includes(e))?{...p.AUTH_FAILED,message:`Authentication failed: ${o}`}:["could not resolve host","connection refused","network is unreachable"].some(e=>r.includes(e))?{...p.NETWORK_ERROR,message:`Network error: ${o}`}:{...p.GIT_ERROR,message:`Git clone failed (exit code ${t}): ${o}`}}getCloneJobStatus(e){let t=(0,c.L_)(this.db,e);if(!t)return null;let r={jobId:t.id,status:t.status,progress:t.progress,repositoryId:t.repositoryId};return"failed"===t.status&&t.errorCode&&(r.error={category:t.errorCategory||"system",code:t.errorCode,message:t.errorMessage||"Unknown error"}),r}cancelCloneJob(e){let t=this.activeProcesses.get(e);if(t)return t.kill("SIGTERM"),this.activeProcesses.delete(e),(0,c.sN)(this.db,e,{status:"cancelled",completedAt:new Date}),!0;let r=(0,c.L_)(this.db,e);return!!r&&"pending"===r.status&&((0,c.sN)(this.db,e,{status:"cancelled",completedAt:new Date}),!0)}}},4709:(e,t,r)=>{r.d(t,{Bj:()=>_,Bm:()=>f,L_:()=>v,RT:()=>R,VZ:()=>h,fC:()=>b,h4:()=>c,mm:()=>E,nJ:()=>m,nb:()=>d,sN:()=>C});var o=r(84770),s=r(55315),a=r.n(s),n=r(43753);function i(e){return{id:e.id,name:e.name,path:e.path,enabled:1===e.enabled,cloneUrl:e.clone_url||void 0,normalizedCloneUrl:e.normalized_clone_url||void 0,cloneSource:e.clone_source,isEnvManaged:1===e.is_env_managed,createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at)}}function l(e){return{id:e.id,cloneUrl:e.clone_url,normalizedCloneUrl:e.normalized_clone_url,targetPath:e.target_path,repositoryId:e.repository_id||void 0,status:e.status,pid:e.pid||void 0,progress:e.progress,errorCategory:e.error_category||void 0,errorCode:e.error_code||void 0,errorMessage:e.error_message||void 0,startedAt:e.started_at?new Date(e.started_at):void 0,completedAt:e.completed_at?new Date(e.completed_at):void 0,createdAt:new Date(e.created_at)}}function c(e,t){let r=(0,o.randomUUID)(),s=Date.now();return e.prepare(`
2
2
  INSERT INTO repositories (
3
3
  id, name, path, enabled, clone_url, normalized_clone_url,
4
4
  clone_source, is_env_managed, created_at, updated_at
@@ -14,7 +14,7 @@
14
14
  UPDATE repositories
15
15
  SET ${s.join(", ")}
16
16
  WHERE id = ?
17
- `).run(...a)}function g(e){return a().resolve(e)}function h(e){if(!e||"string"!=typeof e)return{valid:!1,error:"repositoryPath is required"};if(e.includes("\0"))return{valid:!1,error:"Invalid repository path"};let t=g(e);return(0,n.F)(t)?{valid:!1,error:"Invalid repository path"}:{valid:!0,resolvedPath:t}}function m(e,t){!function(e,t){for(let r of t){let t=g(r);u(e,t)||c(e,{name:a().basename(t),path:t,cloneSource:"local",isEnvManaged:!0,enabled:!0})}}(e,t);let r=function(e,t){let r=e.prepare("SELECT path FROM repositories WHERE enabled = 0").all().map(e=>e.path);return t.filter(e=>!r.includes(g(e)))}(e,t),o=t.filter(e=>!r.includes(e));return{filteredPaths:r,excludedPaths:o,excludedCount:o.length}}function E(e,t){let r=g(t),o=u(e,r);if(o)p(e,o.id,{enabled:!1});else{if(e.prepare("SELECT COUNT(*) as count FROM repositories WHERE enabled = 0").get().count>=1e3)throw Error("Disabled repository limit exceeded");c(e,{name:a().basename(r),path:r,cloneSource:"local",isEnvManaged:!1,enabled:!1})}}function _(e){return e.prepare("SELECT * FROM repositories WHERE enabled = 0 ORDER BY name ASC").all().map(i)}function f(e,t){let r=u(e,g(t));return r?(p(e,r.id,{enabled:!0}),{...r,enabled:!0}):null}function R(e,t){let r=(0,o.randomUUID)(),s=Date.now();return e.prepare(`
17
+ `).run(...a)}function g(e){return a().resolve(e)}function h(e){if(!e||"string"!=typeof e)return{valid:!1,error:"repositoryPath is required"};if(e.includes("\0"))return{valid:!1,error:"Invalid repository path"};let t=g(e);return(0,n.F)(t)?{valid:!1,error:"Invalid repository path"}:{valid:!0,resolvedPath:t}}function m(e,t){!function(e,t){for(let r of t){let t=g(r);u(e,t)||c(e,{name:a().basename(t),path:t,cloneSource:"local",isEnvManaged:!0,enabled:!0})}}(e,t);let r=function(e,t){let r=e.prepare("SELECT path FROM repositories WHERE enabled = 0").all().map(e=>e.path);return t.filter(e=>!r.includes(g(e)))}(e,t),o=t.filter(e=>!r.includes(e));return{filteredPaths:r,excludedPaths:o,excludedCount:o.length}}function E(e,t){let r=g(t),o=u(e,r);if(o)p(e,o.id,{enabled:!1});else{if(e.prepare("SELECT COUNT(*) as count FROM repositories WHERE enabled = 0").get().count>=1e3)throw Error("Disabled repository limit exceeded");c(e,{name:a().basename(r),path:r,cloneSource:"local",isEnvManaged:!1,enabled:!1})}}function _(e){return e.prepare("SELECT * FROM repositories WHERE enabled = 0 ORDER BY name ASC").all().map(i)}function R(e,t){let r=u(e,g(t));return r?(p(e,r.id,{enabled:!0}),{...r,enabled:!0}):null}function f(e,t){let r=(0,o.randomUUID)(),s=Date.now();return e.prepare(`
18
18
  INSERT INTO clone_jobs (
19
19
  id, clone_url, normalized_clone_url, target_path,
20
20
  status, progress, created_at
@@ -23,11 +23,11 @@
23
23
  `).run(r,t.cloneUrl,t.normalizedCloneUrl,t.targetPath,s),{id:r,cloneUrl:t.cloneUrl,normalizedCloneUrl:t.normalizedCloneUrl,targetPath:t.targetPath,status:"pending",progress:0,createdAt:new Date(s)}}function v(e,t){let r=e.prepare(`
24
24
  SELECT * FROM clone_jobs
25
25
  WHERE id = ?
26
- `).get(t);return r?l(r):null}function b(e,t,r){let o=[],s=[];void 0!==r.status&&(o.push("status = ?"),s.push(r.status)),void 0!==r.pid&&(o.push("pid = ?"),s.push(r.pid)),void 0!==r.progress&&(o.push("progress = ?"),s.push(r.progress)),void 0!==r.repositoryId&&(o.push("repository_id = ?"),s.push(r.repositoryId)),void 0!==r.errorCategory&&(o.push("error_category = ?"),s.push(r.errorCategory)),void 0!==r.errorCode&&(o.push("error_code = ?"),s.push(r.errorCode)),void 0!==r.errorMessage&&(o.push("error_message = ?"),s.push(r.errorMessage)),void 0!==r.startedAt&&(o.push("started_at = ?"),s.push(r.startedAt.getTime())),void 0!==r.completedAt&&(o.push("completed_at = ?"),s.push(r.completedAt.getTime())),0!==o.length&&(s.push(t),e.prepare(`
26
+ `).get(t);return r?l(r):null}function C(e,t,r){let o=[],s=[];void 0!==r.status&&(o.push("status = ?"),s.push(r.status)),void 0!==r.pid&&(o.push("pid = ?"),s.push(r.pid)),void 0!==r.progress&&(o.push("progress = ?"),s.push(r.progress)),void 0!==r.repositoryId&&(o.push("repository_id = ?"),s.push(r.repositoryId)),void 0!==r.errorCategory&&(o.push("error_category = ?"),s.push(r.errorCategory)),void 0!==r.errorCode&&(o.push("error_code = ?"),s.push(r.errorCode)),void 0!==r.errorMessage&&(o.push("error_message = ?"),s.push(r.errorMessage)),void 0!==r.startedAt&&(o.push("started_at = ?"),s.push(r.startedAt.getTime())),void 0!==r.completedAt&&(o.push("completed_at = ?"),s.push(r.completedAt.getTime())),0!==o.length&&(s.push(t),e.prepare(`
27
27
  UPDATE clone_jobs
28
28
  SET ${o.join(", ")}
29
29
  WHERE id = ?
30
- `).run(...s))}function C(e,t){let r=e.prepare(`
30
+ `).run(...s))}function b(e,t){let r=e.prepare(`
31
31
  SELECT * FROM clone_jobs
32
32
  WHERE normalized_clone_url = ?
33
33
  AND status IN ('pending', 'running')
@@ -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 g=(0,i.promisify)(n.exec);class h 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 g(`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 h)}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 e=i-1;e>=r;e--){let t=n[e].trim(),s=t.match(l);if(s){let e=parseInt(s[1],10),t=s[2].trim();o.unshift({number:e,label:t,isDefault:!0});continue}let i=t.match(u);if(i){let e=parseInt(i[1],10),t=i[2].trim();o.unshift({number:e,label:t,isDefault:!1});continue}if(o.length>0&&t&&!c.test(t)){if(d(t)){p=e;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[e],t))continue;p=e;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 g=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),h=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:g.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:h},cleanContent:g.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:()=>x,RJ:()=>w,ci:()=>h,cn:()=>$});var n=s(89194),i=s(97425),r=s(75748),o=s(25079),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}}let d=new Map,f=new Map;function g(e,t){let s=(0,c.Sg)(t);return(0,a.F)((0,c.vp)(e),s)}function h(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 w(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()}async function y(e,t){let s=(0,i.n)();try{if(!(0,r.gU)(s,e))return console.error(`Worktree ${e} not found, stopping poller`),x(e,t),!1;if(!await (0,n.Lg)(e,t))return x(e,t),!1;let i=(0,r.zl)(s,e,t),a=i?.lastCapturedLine||0,d=await (0,n.NA)(e,t,1e4),f=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 d=Math.max(0,o-20),f=r.slice(d).join("\n"),{promptPattern:h,separatorPattern:w,thinkingPattern:y,skipPatterns:$}=(0,c.bs)(s),x=(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){let e=r.join("\n");if(g(e,s).isPrompt)return{response:(0,c.vp)(e),isComplete:!0,lineCount:o}}let C=(0,c.vp)(f),S=h.test(C),I=w.test(C),k=y.test(C),v=("codex"===s||"gemini"===s)&&S&&!k,P="claude"===s&&S&&I&&!k;if(v||P){let e;let n=[];if(t>=o||u){let t=x(40);e=t>=0?t+1:0}else if("codex"===s)e=Math.max(0,t);else if(t>=o-5){let t=x(50);e=t>=0?t+1:Math.max(0,o-40)}else e=Math.max(0,t);let i=o;for(let t=e;t<o;t++){let e=r[t],o=(0,c.vp)(e);if("codex"===s&&/^›\s+/.test(o)||"gemini"===s&&/^(%|\$|.*@.*[%$#])\s*$/.test(o)){i=t;break}$.some(e=>e.test(o))||n.push(e)}let a=n.join("\n").trim(),l=a.split("\n").slice(-5).join("\n");if(y.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&&!$.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}}let E=r.join("\n");if(g(E,s).isPrompt)return{response:E,isComplete:!0,lineCount:o};let T=[],b=u||t>=o-5,M=b?x(80):-1,N=b?M>=0?M+1:Math.max(0,o-80):Math.max(0,t);for(let e=N;e<o;e++){let t=r[e],s=(0,c.vp)(t);$.some(e=>e.test(s))||T.push(t)}let D=T.join("\n").trim();return D?{response:D,isComplete:!1,lineCount:o}:p(o)}(d,a,t);if(!f||!f.isComplete){let{thinkingPattern:n}=(0,c.bs)(t),i=(0,c.vp)(d).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(f.lineCount===a&&!i?.inProgressMessageId)return!1;if(f.lineCount<=a)return console.log(`[checkForResponse] Already saved up to line ${a}, skipping (result: ${f.lineCount})`),!1;let y=g(f.response,t);if(y.isPrompt){(0,r.Mf)(s,e,t);let n=(0,r.tn)(s,{worktreeId:e,role:"assistant",content:y.rawContent||y.cleanContent,messageType:"prompt",promptData:y.promptData,timestamp:new Date,cliToolId:t});return(0,r.IH)(s,e,t,f.lineCount),(0,o.ps)("message",{worktreeId:e,message:n}),x(e,t),!0}if(!f.response||""===f.response.trim())return(0,r.IH)(s,e,t,f.lineCount),!1;let $="claude"===t?(0,u.Z)(f.response):void 0,C=f.response;if("gemini"===t?C=w(f.response):"claude"===t&&(C=h(f.response)),!C||""===C.trim()||"[No content]"===C)return(0,r.IH)(s,e,t,f.lineCount),(0,r.Mf)(s,e,t),!1;C&&await (0,l.o)(s,e,C,t);let S=(0,r.GP)(s,e,t);S>0&&console.log(`Marked ${S} pending prompt(s) as answered for ${e}`);let I=(0,r.zl)(s,e,t);if(I&&f.lineCount<=I.lastCapturedLine)return console.log(`[checkForResponse] Race condition detected, skipping save (result: ${f.lineCount}, current: ${I.lastCapturedLine})`),!1;let k=(0,r.tn)(s,{worktreeId:e,role:"assistant",content:C,messageType:"normal",timestamp:new Date,cliToolId:t,summary:$?.summary,logFileName:$?.logFileName,requestId:$?.requestId});return(0,o.ps)("message",{worktreeId:e,message:k}),(0,r.IH)(s,e,t,f.lineCount),!0}catch(t){return console.error(`Error checking for response (${e}):`,t instanceof Error?t.message:String(t)),!1}}function $(e,t){let s=`${e}:${t}`;x(e,t),f.set(s,Date.now());let n=setInterval(async()=>{let n=f.get(s);if(n&&Date.now()-n>3e5){x(e,t);return}try{await y(e,t)}catch(e){console.error("[Poller] Error:",e)}},2e3);d.set(s,n)}function x(e,t){let s=`${e}:${t}`,n=d.get(s);n&&(clearInterval(n),d.delete(s),f.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 g=(0,i.promisify)(n.exec);class h 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 g(`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 h)}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 g=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),h=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:g.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:h},cleanContent:g.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:()=>x,RJ:()=>w,ci:()=>h,cn:()=>$});var n=s(89194),i=s(97425),r=s(75748),o=s(25079),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}}let d=new Map,f=new Map;function g(e,t){let s=(0,c.Sg)(t);return(0,a.F)((0,c.vp)(e),s)}function h(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 w(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()}async function y(e,t){let s=(0,i.n)();try{if(!(0,r.gU)(s,e))return console.error(`Worktree ${e} not found, stopping poller`),x(e,t),!1;if(!await (0,n.Lg)(e,t))return x(e,t),!1;let i=(0,r.zl)(s,e,t),a=i?.lastCapturedLine||0,d=await (0,n.NA)(e,t,1e4),f=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 d=Math.max(0,o-20),f=r.slice(d).join("\n"),{promptPattern:h,separatorPattern:w,thinkingPattern:y,skipPatterns:$}=(0,c.bs)(s),x=(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){let e=r.join("\n");if(g(e,s).isPrompt)return{response:(0,c.vp)(e),isComplete:!0,lineCount:o}}let C=(0,c.vp)(f),S=h.test(C),I=w.test(C),k=y.test(C),v=("codex"===s||"gemini"===s)&&S&&!k,P="claude"===s&&S&&I&&!k;if(v||P){let e;let n=[];if(t>=o||u){let t=x(40);e=t>=0?t+1:0}else if("codex"===s)e=Math.max(0,t);else if(t>=o-5){let t=x(50);e=t>=0?t+1:Math.max(0,o-40)}else e=Math.max(0,t);let i=o;for(let t=e;t<o;t++){let e=r[t],o=(0,c.vp)(e);if("codex"===s&&/^›\s+/.test(o)||"gemini"===s&&/^(%|\$|.*@.*[%$#])\s*$/.test(o)){i=t;break}$.some(e=>e.test(o))||n.push(e)}let a=n.join("\n").trim(),l=a.split("\n").slice(-5).join("\n");if(y.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&&!$.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}}let E=r.join("\n");if(g(E,s).isPrompt)return{response:E,isComplete:!0,lineCount:o};let T=[],b=u||t>=o-5,M=b?x(80):-1,N=b?M>=0?M+1:Math.max(0,o-80):Math.max(0,t);for(let e=N;e<o;e++){let t=r[e],s=(0,c.vp)(t);$.some(e=>e.test(s))||T.push(t)}let D=T.join("\n").trim();return D?{response:D,isComplete:!1,lineCount:o}:p(o)}(d,a,t);if(!f||!f.isComplete){let{thinkingPattern:n}=(0,c.bs)(t),i=(0,c.vp)(d).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(f.lineCount===a&&!i?.inProgressMessageId)return!1;if(f.lineCount<=a)return console.log(`[checkForResponse] Already saved up to line ${a}, skipping (result: ${f.lineCount})`),!1;let y=g(f.response,t);if(y.isPrompt){(0,r.Mf)(s,e,t);let n=(0,r.tn)(s,{worktreeId:e,role:"assistant",content:y.rawContent||y.cleanContent,messageType:"prompt",promptData:y.promptData,timestamp:new Date,cliToolId:t});return(0,r.IH)(s,e,t,f.lineCount),(0,o.ps)("message",{worktreeId:e,message:n}),x(e,t),!0}if(!f.response||""===f.response.trim())return(0,r.IH)(s,e,t,f.lineCount),!1;let $="claude"===t?(0,u.Z)(f.response):void 0,C=f.response;if("gemini"===t?C=w(f.response):"claude"===t&&(C=h(f.response)),!C||""===C.trim()||"[No content]"===C)return(0,r.IH)(s,e,t,f.lineCount),(0,r.Mf)(s,e,t),!1;C&&await (0,l.o)(s,e,C,t);let S=(0,r.GP)(s,e,t);S>0&&console.log(`Marked ${S} pending prompt(s) as answered for ${e}`);let I=(0,r.zl)(s,e,t);if(I&&f.lineCount<=I.lastCapturedLine)return console.log(`[checkForResponse] Race condition detected, skipping save (result: ${f.lineCount}, current: ${I.lastCapturedLine})`),!1;let k=(0,r.tn)(s,{worktreeId:e,role:"assistant",content:C,messageType:"normal",timestamp:new Date,cliToolId:t,summary:$?.summary,logFileName:$?.logFileName,requestId:$?.requestId});return(0,o.ps)("message",{worktreeId:e,message:k}),(0,r.IH)(s,e,t,f.lineCount),!0}catch(t){return console.error(`Error checking for response (${e}):`,t instanceof Error?t.message:String(t)),!1}}function $(e,t){let s=`${e}:${t}`;x(e,t),f.set(s,Date.now());let n=setInterval(async()=>{let n=f.get(s);if(n&&Date.now()-n>3e5){x(e,t);return}try{await y(e,t)}catch(e){console.error("[Poller] Error:",e)}},2e3);d.set(s,n)}function x(e,t){let s=`${e}:${t}`,n=d.get(s);n&&(clearInterval(n),d.delete(s),f.delete(s))}}};
@@ -0,0 +1 @@
1
+ "use strict";exports.id=8693,exports.ids=[8693],exports.modules={87946:(e,t,r)=>{r.d(t,{Ad:()=>l,l1:()=>o});let n=[36e5,108e5,288e5],l=36e5;function o(e){return"number"==typeof e&&n.includes(e)}},38693:(e,t,r)=>{r.d(t,{bq:()=>d,gf:()=>g,m$:()=>f,bY:()=>w,w:()=>A,Qz:()=>v});var n=r(89194),l=r(63661),o=r(49528),s=r(43839),a=r(19377),i=r(87946);let u=/^[a-zA-Z0-9_-]+$/,c=globalThis.__autoYesStates??(globalThis.__autoYesStates=new Map),p=globalThis.__autoYesPollerStates??(globalThis.__autoYesPollerStates=new Map);function f(e){return!!e&&0!==e.length&&u.test(e)}function m(e){return Date.now()>e.expiresAt}function d(e){let t=c.get(e);if(!t)return null;if(m(t)){let r={...t,enabled:!1};return c.set(e,r),r}return t}function w(e,t,r){if(t){let t=Date.now(),n={enabled:!0,enabledAt:t,expiresAt:t+(r??i.Ad)};return c.set(e,n),n}{let t=c.get(e),r={enabled:!1,enabledAt:t?.enabledAt??0,expiresAt:t?.expiresAt??0};return c.set(e,r),r}}function g(e){let t=p.get(e);return t?.lastServerResponseTimestamp??null}async function h(e,t){var r;let i=p.get(e);if(!i)return;let u=d(e);if(!u?.enabled||m(u)){v(e);return}try{let u=await (0,n.NA)(e,t,5e3),c=(0,a.vp)(u),f=c.split("\n").slice(-50).join("\n");if((0,a.Wg)(t,f)){b(e,t);return}let m=(0,a.Sg)(t),d=(0,l.F)(c,m);if(!d.isPrompt||!d.promptData){i.lastAnsweredPromptKey=null,b(e,t);return}let w=(r=d.promptData,`${r.type}:${r.question}`);if(i.lastAnsweredPromptKey===w){b(e,t);return}let g=function(e){if("yes_no"===e.type)return"y";if("multiple_choice"===e.type){let t=e.options.find(e=>e.isDefault)??e.options[0];return!t||t.requiresTextInput?null:t.number.toString()}return null}(d.promptData);if(null===g){b(e,t);return}let h=s.g.getInstance().getTool(t).getSessionName(e);await (0,o.z)({sessionName:h,answer:g,cliToolId:t,promptData:d.promptData}),function(e,t){let r=p.get(e);r&&(r.lastServerResponseTimestamp=t)}(e,Date.now()),function(e){let t=p.get(e);t&&(t.consecutiveErrors=0,t.currentInterval=2e3)}(e),i.lastAnsweredPromptKey=w,console.info(`[Auto-Yes Poller] Sent response for worktree: ${e}`),b(e,t,5e3);return}catch(t){(function(e){let t=p.get(e);if(t){var r;t.consecutiveErrors++,t.currentInterval=(r=t.consecutiveErrors)<5?2e3:Math.min(2e3*Math.pow(2,r-5+1),6e4)}})(e),console.warn(`[Auto-Yes Poller] Error for worktree ${e}: ${t instanceof Error?t.message:"Unknown error"}`)}b(e,t)}function b(e,t,r){let n=p.get(e);if(!n)return;let l=Math.max(r??n.currentInterval,2e3);n.timerId=setTimeout(()=>{h(e,t)},l)}function A(e,t){if(!f(e))return{started:!1,reason:"invalid worktree ID"};let r=d(e);if(!r?.enabled)return{started:!1,reason:"auto-yes not enabled"};let n=p.has(e);if(!n&&p.size>=50)return{started:!1,reason:"max concurrent pollers reached"};n&&v(e);let l={timerId:null,cliToolId:t,consecutiveErrors:0,currentInterval:2e3,lastServerResponseTimestamp:null,lastAnsweredPromptKey:null};return p.set(e,l),l.timerId=setTimeout(()=>{h(e,t)},2e3),console.info(`[Auto-Yes Poller] Started for worktree: ${e}, cliTool: ${t}`),{started:!0}}function v(e){let t=p.get(e);t&&(t.timerId&&clearTimeout(t.timerId),p.delete(e),console.info(`[Auto-Yes Poller] Stopped for worktree: ${e}`))}},49528:(e,t,r)=>{r.d(t,{z:()=>s});var n=r(10927);let l=/^\[[ x]\] /;function o(e){if(0===e)return[];let t=e>0?"Down":"Up";return Array.from({length:Math.abs(e)},()=>t)}async function s(e){let{sessionName:t,answer:r,cliToolId:s,promptData:a,fallbackPromptType:i,fallbackDefaultOptionNumber:u}=e;if("claude"===s&&(a?.type==="multiple_choice"||"multiple_choice"===i)&&/^\d+$/.test(r)){let e;let s=parseInt(r,10),i=null;if(a?.type==="multiple_choice"){let t=(i=a.options).find(e=>e.isDefault);e=t?.number??1}else e=u??1;let c=s-e;if(null!==i&&i.some(e=>l.test(e.label))&&null!==i){let e=i.filter(e=>l.test(e.label)).length,r=[...o(c),"Space"];r.push(...o(e-s+1)),r.push("Enter"),await (0,n.hL)(t,r)}else{let e=[...o(c),"Enter"];await (0,n.hL)(t,e)}}else await (0,n.Is)(t,r,!1),await new Promise(e=>setTimeout(e,100)),await (0,n.Is)(t,"",!0)}}};
@@ -1,35 +1,35 @@
1
- "use strict";exports.id=9238,exports.ids=[9238],exports.modules={11865:(e,t,a)=>{a.d(t,{Ix:()=>x,pm:()=>m});var s=a(10326),r=a(17577),l=a(30361),n=a(69669),o=a(18019),i=a(94019);let c=3e3;function d({type:e,iconColor:t}){let a=`h-5 w-5 ${t}`;switch(e){case"success":return s.jsx(l.Z,{className:a,"data-testid":"toast-icon-success"});case"error":return s.jsx(n.Z,{className:a,"data-testid":"toast-icon-error"});default:return s.jsx(o.Z,{className:a,"data-testid":"toast-icon-info"})}}function u({id:e,message:t,type:a,onClose:l,duration:n=c}){let o=(0,r.useRef)(null),u=function(e){switch(e){case"success":return{bgColor:"bg-green-50",borderColor:"border-green-200",textColor:"text-green-800",iconColor:"text-green-500"};case"error":return{bgColor:"bg-red-50",borderColor:"border-red-200",textColor:"text-red-800",iconColor:"text-red-500"};default:return{bgColor:"bg-blue-50",borderColor:"border-blue-200",textColor:"text-blue-800",iconColor:"text-blue-500"}}}(a),x=(0,r.useCallback)(()=>{o.current&&clearTimeout(o.current),l(e)},[e,l]);return(0,s.jsxs)("div",{"data-testid":`toast-${e}`,role:"alert",className:`
2
- ${u.bgColor}
3
- ${u.borderColor}
4
- ${u.textColor}
1
+ "use strict";exports.id=9238,exports.ids=[9238],exports.modules={11865:(e,t,s)=>{s.d(t,{Ix:()=>m,pm:()=>h});var a=s(10326),r=s(17577),l=s(30361),n=s(69669),i=s(18019),o=s(94019),c=s(22202);let d=3e3;function u({type:e,iconColor:t}){let s=`h-5 w-5 ${t}`;switch(e){case"success":return a.jsx(l.Z,{className:s,"data-testid":"toast-icon-success"});case"error":return a.jsx(n.Z,{className:s,"data-testid":"toast-icon-error"});default:return a.jsx(i.Z,{className:s,"data-testid":"toast-icon-info"})}}function x({id:e,message:t,type:s,onClose:l,duration:n=d}){let i=(0,r.useRef)(null),c=function(e){switch(e){case"success":return{bgColor:"bg-green-50",borderColor:"border-green-200",textColor:"text-green-800",iconColor:"text-green-500"};case"error":return{bgColor:"bg-red-50",borderColor:"border-red-200",textColor:"text-red-800",iconColor:"text-red-500"};default:return{bgColor:"bg-blue-50",borderColor:"border-blue-200",textColor:"text-blue-800",iconColor:"text-blue-500"}}}(s),x=(0,r.useCallback)(()=>{i.current&&clearTimeout(i.current),l(e)},[e,l]);return(0,a.jsxs)("div",{"data-testid":`toast-${e}`,role:"alert",className:`
2
+ ${c.bgColor}
3
+ ${c.borderColor}
4
+ ${c.textColor}
5
5
  border rounded-lg shadow-lg p-4 min-w-[300px] max-w-[400px]
6
6
  flex items-start gap-3
7
7
  animate-slide-in
8
- `,children:[s.jsx(d,{type:a,iconColor:u.iconColor}),s.jsx("p",{className:"flex-1 text-sm font-medium",children:t}),s.jsx("button",{"data-testid":"toast-close-button",onClick:x,"aria-label":"Close notification",className:`
9
- ${u.textColor}
8
+ `,children:[a.jsx(u,{type:s,iconColor:c.iconColor}),a.jsx("p",{className:"flex-1 text-sm font-medium",children:t}),a.jsx("button",{"data-testid":"toast-close-button",onClick:x,"aria-label":"Close notification",className:`
9
+ ${c.textColor}
10
10
  hover:opacity-70
11
11
  focus:outline-none focus:ring-2 focus:ring-offset-2
12
12
  transition-opacity
13
- `,children:s.jsx(i.Z,{className:"h-4 w-4"})})]})}function x({toasts:e,onClose:t}){return s.jsx("div",{"data-testid":"toast-container","aria-live":"polite",className:"fixed bottom-4 right-4 z-50 flex flex-col gap-2",children:e.map(e=>s.jsx(u,{id:e.id,message:e.message,type:e.type,onClose:t,duration:e.duration},e.id))})}function m(){let[e,t]=(0,r.useState)([]),a=(0,r.useRef)(0);return{toasts:e,showToast:(0,r.useCallback)((e,s="info",r=c)=>{let l=`toast-${++a.current}-${Date.now()}`,n={id:l,message:e,type:s,duration:r};return t(e=>[...e,n]),l},[]),removeToast:(0,r.useCallback)(e=>{t(t=>t.filter(t=>t.id!==e))},[]),clearToasts:(0,r.useCallback)(()=>{t([])},[])}}},2583:(e,t,a)=>{a.d(t,{Vw:()=>S});var s=a(10326),r=a(17577);a(90434);var l=a(87403),n=a(2982),o=a(35047),i=a(3885),c=a(61421);function d({status:e,label:t}){let a=c.F4[e],r=`${t}: ${a.label}`;return"spinner"===a.type?s.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 border-2 border-t-transparent animate-spin ${a.className}`,title:r,"aria-label":r}):s.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${a.className}`,title:r,"aria-label":r})}let u=(0,r.memo)(function({branch:e,isSelected:t,onClick:a}){return(0,s.jsxs)("button",{"data-testid":"branch-list-item",onClick:a,"aria-current":t?"true":void 0,className:`
13
+ `,children:a.jsx(o.Z,{className:"h-4 w-4"})})]})}function m({toasts:e,onClose:t}){return a.jsx("div",{"data-testid":"toast-container","aria-live":"polite",className:"fixed bottom-4 right-4 flex flex-col gap-2",style:{zIndex:c.k.TOAST},children:e.map(e=>a.jsx(x,{id:e.id,message:e.message,type:e.type,onClose:t,duration:e.duration},e.id))})}function h(){let[e,t]=(0,r.useState)([]),s=(0,r.useRef)(0);return{toasts:e,showToast:(0,r.useCallback)((e,a="info",r=d)=>{let l=`toast-${++s.current}-${Date.now()}`,n={id:l,message:e,type:a,duration:r};return t(e=>[...e,n]),l},[]),removeToast:(0,r.useCallback)(e=>{t(t=>t.filter(t=>t.id!==e))},[]),clearToasts:(0,r.useCallback)(()=>{t([])},[])}}},2583:(e,t,s)=>{s.d(t,{Vw:()=>S});var a=s(10326),r=s(17577);s(90434);var l=s(87403),n=s(2982),i=s(35047),o=s(3885),c=s(61421);function d({status:e,label:t}){let s=c.F4[e],r=`${t}: ${s.label}`;return"spinner"===s.type?a.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 border-2 border-t-transparent animate-spin ${s.className}`,title:r,"aria-label":r}):a.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${s.className}`,title:r,"aria-label":r})}let u=(0,r.memo)(function({branch:e,isSelected:t,onClick:s}){return(0,a.jsxs)("button",{"data-testid":"branch-list-item",onClick:s,"aria-current":t?"true":void 0,className:`
14
14
  w-full px-4 py-3 flex flex-col gap-1
15
15
  hover:bg-gray-800 transition-colors
16
16
  focus:outline-none focus:ring-2 focus:ring-inset focus:ring-blue-500
17
17
  ${t?"bg-gray-700 border-l-2 border-blue-500":"border-l-2 border-transparent"}
18
- `,children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 w-full",children:[e.cliStatus&&(0,s.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0","aria-label":"CLI tool status",children:[s.jsx(d,{status:e.cliStatus.claude,label:"Claude"}),s.jsx(d,{status:e.cliStatus.codex,label:"Codex"})]}),(0,s.jsxs)("div",{className:"flex-1 min-w-0 text-left",children:[s.jsx("p",{className:"text-sm font-medium text-white truncate",children:e.name}),s.jsx("p",{className:"text-xs text-gray-400 truncate",children:e.repositoryName})]}),e.hasUnread&&s.jsx("span",{"data-testid":"unread-indicator",className:"w-2 h-2 rounded-full bg-blue-500 flex-shrink-0","aria-label":"Has unread messages"})]}),e.description&&s.jsx("div",{"data-testid":"branch-description",className:"pl-6 pr-2 mt-1 text-left",children:s.jsx("p",{className:"text-xs text-gray-400 line-clamp-2",children:e.description})})]})}),x=[{key:"updatedAt",label:"Updated"},{key:"repositoryName",label:"Repository"},{key:"branchName",label:"Branch"},{key:"status",label:"Status"}],m=(0,r.memo)(function(){let{sortKey:e,sortDirection:t,setSortKey:a,setSortDirection:n}=(0,l.Sz)(),[o,i]=(0,r.useState)(!1),c=(0,r.useRef)(null);(0,r.useEffect)(()=>{function e(e){c.current&&!c.current.contains(e.target)&&i(!1)}if(o)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[o]),(0,r.useEffect)(()=>{function e(e){"Escape"===e.key&&i(!1)}if(o)return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[o]);let d=(0,r.useCallback)(()=>{i(e=>!e)},[]),u=(0,r.useCallback)(s=>{s===e?n("asc"===t?"desc":"asc"):(a(s),n("updatedAt"===s?"desc":"asc")),i(!1)},[e,t,a,n]),m=(0,r.useCallback)(()=>{n("asc"===t?"desc":"asc")},[t,n]),b=x.find(t=>t.key===e)?.label||"Sort";return(0,s.jsxs)("div",{ref:c,className:"relative","data-testid":"sort-selector",children:[(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsxs)("button",{type:"button",onClick:d,"aria-expanded":o,"aria-haspopup":"listbox","aria-label":`Sort by ${b}`,className:" flex items-center gap-1 px-2 py-1 rounded text-xs text-gray-300 hover:text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-blue-500 transition-colors ",children:[s.jsx(h,{className:"w-3 h-3"}),s.jsx("span",{className:"hidden sm:inline",children:b})]}),s.jsx("button",{type:"button",onClick:m,"aria-label":"asc"===t?"Sort ascending":"Sort descending",className:" p-1 rounded text-gray-300 hover:text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-blue-500 transition-colors ",children:"asc"===t?s.jsx(p,{className:"w-3 h-3"}):s.jsx(g,{className:"w-3 h-3"})})]}),o&&s.jsx("div",{role:"listbox","aria-label":"Sort options",className:" absolute right-0 top-full mt-1 z-50 min-w-[140px] py-1 rounded-md shadow-lg bg-gray-800 border border-gray-600 ",children:x.map(a=>(0,s.jsxs)("button",{type:"button",role:"option","aria-selected":e===a.key,onClick:()=>u(a.key),className:`
18
+ `,children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 w-full",children:[e.cliStatus&&(0,a.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0","aria-label":"CLI tool status",children:[a.jsx(d,{status:e.cliStatus.claude,label:"Claude"}),a.jsx(d,{status:e.cliStatus.codex,label:"Codex"})]}),(0,a.jsxs)("div",{className:"flex-1 min-w-0 text-left",children:[a.jsx("p",{className:"text-sm font-medium text-white truncate",children:e.name}),a.jsx("p",{className:"text-xs text-gray-400 truncate",children:e.repositoryName})]}),e.hasUnread&&a.jsx("span",{"data-testid":"unread-indicator",className:"w-2 h-2 rounded-full bg-blue-500 flex-shrink-0","aria-label":"Has unread messages"})]}),e.description&&a.jsx("div",{"data-testid":"branch-description",className:"pl-6 pr-2 mt-1 text-left",children:a.jsx("p",{className:"text-xs text-gray-400 line-clamp-2",children:e.description})})]})}),x=[{key:"updatedAt",label:"Updated"},{key:"repositoryName",label:"Repository"},{key:"branchName",label:"Branch"},{key:"status",label:"Status"}],m=(0,r.memo)(function(){let{sortKey:e,sortDirection:t,setSortKey:s,setSortDirection:n}=(0,l.Sz)(),[i,o]=(0,r.useState)(!1),c=(0,r.useRef)(null);(0,r.useEffect)(()=>{function e(e){c.current&&!c.current.contains(e.target)&&o(!1)}if(i)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[i]),(0,r.useEffect)(()=>{function e(e){"Escape"===e.key&&o(!1)}if(i)return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[i]);let d=(0,r.useCallback)(()=>{o(e=>!e)},[]),u=(0,r.useCallback)(a=>{a===e?n("asc"===t?"desc":"asc"):(s(a),n("updatedAt"===a?"desc":"asc")),o(!1)},[e,t,s,n]),m=(0,r.useCallback)(()=>{n("asc"===t?"desc":"asc")},[t,n]),b=x.find(t=>t.key===e)?.label||"Sort";return(0,a.jsxs)("div",{ref:c,className:"relative","data-testid":"sort-selector",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsxs)("button",{type:"button",onClick:d,"aria-expanded":i,"aria-haspopup":"listbox","aria-label":`Sort by ${b}`,className:" flex items-center gap-1 px-2 py-1 rounded text-xs text-gray-300 hover:text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-blue-500 transition-colors ",children:[a.jsx(h,{className:"w-3 h-3"}),a.jsx("span",{className:"hidden sm:inline",children:b})]}),a.jsx("button",{type:"button",onClick:m,"aria-label":"asc"===t?"Sort ascending":"Sort descending",className:" p-1 rounded text-gray-300 hover:text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-blue-500 transition-colors ",children:"asc"===t?a.jsx(p,{className:"w-3 h-3"}):a.jsx(g,{className:"w-3 h-3"})})]}),i&&a.jsx("div",{role:"listbox","aria-label":"Sort options",className:" absolute right-0 top-full mt-1 z-50 min-w-[140px] py-1 rounded-md shadow-lg bg-gray-800 border border-gray-600 ",children:x.map(s=>(0,a.jsxs)("button",{type:"button",role:"option","aria-selected":e===s.key,onClick:()=>u(s.key),className:`
19
19
  w-full px-3 py-2 text-left text-sm
20
20
  flex items-center justify-between
21
21
  hover:bg-gray-700 transition-colors
22
- ${e===a.key?"text-blue-400":"text-gray-300"}
23
- `,children:[s.jsx("span",{children:a.label}),e===a.key&&s.jsx("span",{className:"text-xs",children:"asc"===t?"ASC":"DESC"})]},a.key))})]})});function h({className:e}){return s.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 4h13M3 8h9m-9 4h6m4 0l4-4m0 0l4 4m-4-4v12"})})}function p({className:e}){return s.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})})}function g({className:e}){return s.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}var b=a(34643);let f=["en","ja"],y={en:"English",ja:"日本語"};function v(){let{currentLocale:e,switchLocale:t}={currentLocale:(0,b.bU)(),switchLocale:e=>{f.includes(e)&&(function(e){let t="https:"===window.location.protocol;document.cookie=`locale=${e};path=/;max-age=31536000;SameSite=Lax${t?";Secure":""}`}(e),localStorage.setItem("locale",e),window.location.reload())}};return s.jsx("select",{value:e,onChange:e=>t(e.target.value),"aria-label":"Language",className:" w-full px-3 py-2 rounded-md bg-gray-800 text-white border border-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent text-sm ",children:f.map(e=>s.jsx("option",{value:e,children:y[e]},e))})}var j=a(18421);let w={waiting:0,ready:1,running:2,generating:3,idle:4},N=(0,r.memo)(function(){let e=(0,o.useRouter)(),{worktrees:t,selectedWorktreeId:a,selectWorktree:n}=(0,i.Mu)(),{closeMobileDrawer:c,sortKey:d,sortDirection:x}=(0,l.Sz)(),[h,p]=(0,r.useState)(""),g=(0,r.useMemo)(()=>{let e=t.map(j.I_),a=e;if(h.trim()){let t=h.toLowerCase();a=e.filter(e=>e.name.toLowerCase().includes(t)||e.repositoryName.toLowerCase().includes(t))}return function(e,t,a){let s=[...e];return s.sort((e,s)=>{let r=0;switch(t){case"updatedAt":{let t=e=>e?e instanceof Date?e.getTime():new Date(e).getTime():0,a=t(e.lastActivity);r=t(s.lastActivity)-a;break}case"repositoryName":{let t=e.repositoryName.toLowerCase(),a=s.repositoryName.toLowerCase();r=t.localeCompare(a);break}case"branchName":{let t=e.name.toLowerCase(),a=s.name.toLowerCase();r=t.localeCompare(a);break}case"status":r=w[e.status]-w[s.status]}return("updatedAt"===t?"desc"===a:"asc"===a)?r:-r}),s}(a,d,x)},[t,h,d,x]),b=t=>{n(t),e.push(`/worktrees/${t}`),c()};return(0,s.jsxs)("nav",{"data-testid":"sidebar","aria-label":"Branch navigation",className:"h-full flex flex-col bg-gray-900 text-white",role:"navigation",children:[s.jsx("div",{"data-testid":"sidebar-header",className:"flex-shrink-0 px-4 py-4 border-b border-gray-700",children:(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[s.jsx("h2",{className:"text-lg font-semibold text-white",children:"Branches"}),s.jsx(m,{})]})}),s.jsx("div",{className:"flex-shrink-0 px-4 py-3 border-b border-gray-700",children:s.jsx("input",{type:"text",placeholder:"Search branches...",value:h,onChange:e=>p(e.target.value),className:" w-full px-3 py-2 rounded-md bg-gray-800 text-white placeholder-gray-400 border border-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent "})}),s.jsx("div",{"data-testid":"branch-list",className:"flex-1 overflow-y-auto",children:0===g.length?s.jsx("div",{className:"px-4 py-8 text-center text-gray-400",children:h?"No branches found":"No branches available"}):g.map(e=>s.jsx(u,{branch:e,isSelected:e.id===a,onClick:()=>b(e.id)},e.id))}),s.jsx("div",{className:"flex-shrink-0 px-4 py-3 border-t border-gray-700",children:s.jsx(v,{})})]})});var k=a(22202);let C="transform transition-transform duration-300 ease-out",S=(0,r.memo)(function({children:e}){let{isOpen:t,isMobileDrawerOpen:a,closeMobileDrawer:r}=(0,l.Sz)();return(0,n.d)()?(0,s.jsxs)("div",{"data-testid":"app-shell",className:"h-screen flex flex-col",children:[a&&s.jsx("div",{"data-testid":"drawer-overlay",className:"fixed inset-0 bg-black/50 z-40",onClick:r,"aria-hidden":"true"}),s.jsx("aside",{"data-testid":"sidebar-container",className:`
22
+ ${e===s.key?"text-blue-400":"text-gray-300"}
23
+ `,children:[a.jsx("span",{children:s.label}),e===s.key&&a.jsx("span",{className:"text-xs",children:"asc"===t?"ASC":"DESC"})]},s.key))})]})});function h({className:e}){return a.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 4h13M3 8h9m-9 4h6m4 0l4-4m0 0l4 4m-4-4v12"})})}function p({className:e}){return a.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})})}function g({className:e}){return a.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}var b=s(34643);let f=["en","ja"],y={en:"English",ja:"日本語"};function v(){let{currentLocale:e,switchLocale:t}={currentLocale:(0,b.bU)(),switchLocale:e=>{f.includes(e)&&(function(e){let t="https:"===window.location.protocol;document.cookie=`locale=${e};path=/;max-age=31536000;SameSite=Lax${t?";Secure":""}`}(e),localStorage.setItem("locale",e),window.location.reload())}};return a.jsx("select",{value:e,onChange:e=>t(e.target.value),"aria-label":"Language",className:" w-full px-3 py-2 rounded-md bg-gray-800 text-white border border-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent text-sm ",children:f.map(e=>a.jsx("option",{value:e,children:y[e]},e))})}var j=s(18421);let w={waiting:0,ready:1,running:2,generating:3,idle:4},N=(0,r.memo)(function(){let e=(0,i.useRouter)(),{worktrees:t,selectedWorktreeId:s,selectWorktree:n}=(0,o.Mu)(),{closeMobileDrawer:c,sortKey:d,sortDirection:x}=(0,l.Sz)(),[h,p]=(0,r.useState)(""),g=(0,r.useMemo)(()=>{let e=t.map(j.I_),s=e;if(h.trim()){let t=h.toLowerCase();s=e.filter(e=>e.name.toLowerCase().includes(t)||e.repositoryName.toLowerCase().includes(t))}return function(e,t,s){let a=[...e];return a.sort((e,a)=>{let r=0;switch(t){case"updatedAt":{let t=e=>e?e instanceof Date?e.getTime():new Date(e).getTime():0,s=t(e.lastActivity);r=t(a.lastActivity)-s;break}case"repositoryName":{let t=e.repositoryName.toLowerCase(),s=a.repositoryName.toLowerCase();r=t.localeCompare(s);break}case"branchName":{let t=e.name.toLowerCase(),s=a.name.toLowerCase();r=t.localeCompare(s);break}case"status":r=w[e.status]-w[a.status]}return("updatedAt"===t?"desc"===s:"asc"===s)?r:-r}),a}(s,d,x)},[t,h,d,x]),b=t=>{n(t),e.push(`/worktrees/${t}`),c()};return(0,a.jsxs)("nav",{"data-testid":"sidebar","aria-label":"Branch navigation",className:"h-full flex flex-col bg-gray-900 text-white",role:"navigation",children:[a.jsx("div",{"data-testid":"sidebar-header",className:"flex-shrink-0 px-4 py-4 border-b border-gray-700",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[a.jsx("h2",{className:"text-lg font-semibold text-white",children:"Branches"}),a.jsx(m,{})]})}),a.jsx("div",{className:"flex-shrink-0 px-4 py-3 border-b border-gray-700",children:a.jsx("input",{type:"text",placeholder:"Search branches...",value:h,onChange:e=>p(e.target.value),className:" w-full px-3 py-2 rounded-md bg-gray-800 text-white placeholder-gray-400 border border-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent "})}),a.jsx("div",{"data-testid":"branch-list",className:"flex-1 overflow-y-auto",children:0===g.length?a.jsx("div",{className:"px-4 py-8 text-center text-gray-400",children:h?"No branches found":"No branches available"}):g.map(e=>a.jsx(u,{branch:e,isSelected:e.id===s,onClick:()=>b(e.id)},e.id))}),a.jsx("div",{className:"flex-shrink-0 px-4 py-3 border-t border-gray-700",children:a.jsx(v,{})})]})});var k=s(22202);let C="transform transition-transform duration-300 ease-out",S=(0,r.memo)(function({children:e}){let{isOpen:t,isMobileDrawerOpen:s,closeMobileDrawer:r}=(0,l.Sz)();return(0,n.d)()?(0,a.jsxs)("div",{"data-testid":"app-shell",className:"h-screen flex flex-col",children:[s&&a.jsx("div",{"data-testid":"drawer-overlay",className:"fixed inset-0 bg-black/50 z-40",onClick:r,"aria-hidden":"true"}),a.jsx("aside",{"data-testid":"sidebar-container",className:`
24
24
  fixed left-0 top-0 h-full w-72 z-50
25
25
  ${C}
26
- ${a?"translate-x-0":"-translate-x-full"}
27
- `,role:"complementary",children:s.jsx(N,{})}),s.jsx("main",{className:"flex-1 min-h-0 overflow-hidden",role:"main",children:e})]}):(0,s.jsxs)("div",{"data-testid":"app-shell",className:"h-screen flex",children:[s.jsx("aside",{"data-testid":"sidebar-container",className:`
26
+ ${s?"translate-x-0":"-translate-x-full"}
27
+ `,role:"complementary",children:a.jsx(N,{})}),a.jsx("main",{className:"flex-1 min-h-0 overflow-hidden",role:"main",children:e})]}):(0,a.jsxs)("div",{"data-testid":"app-shell",className:"h-screen flex",children:[a.jsx("aside",{"data-testid":"sidebar-container",className:`
28
28
  fixed left-0 top-0 h-full w-72
29
29
  ${C}
30
30
  ${t?"translate-x-0":"-translate-x-full"}
31
- `,style:{zIndex:k.k.SIDEBAR},role:"complementary","aria-hidden":!t,children:s.jsx(N,{})}),s.jsx("main",{className:`
31
+ `,style:{zIndex:k.k.SIDEBAR},role:"complementary","aria-hidden":!t,children:a.jsx(N,{})}),a.jsx("main",{className:`
32
32
  flex-1 min-w-0 h-full overflow-hidden
33
33
  transition-[padding] duration-300 ease-out
34
34
  ${t?"md:pl-72":"md:pl-0"}
35
- `,role:"main",children:e})]})})},28676:(e,t,a)=>{a.d(t,{u:()=>n});var s=a(10326),r=a(17577),l=a(60962);function n({isOpen:e,onClose:t,title:a,children:n,size:o="lg",showCloseButton:i=!0,disableClose:c=!1}){let d=(0,r.useRef)(null);return e?(0,l.createPortal)((0,s.jsxs)("div",{className:"fixed inset-0 z-[9999] overflow-y-auto",children:[s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 transition-opacity",onClick:c?void 0:t}),s.jsx("div",{className:"relative flex min-h-full items-center justify-center p-2 sm:p-4",children:(0,s.jsxs)("div",{ref:d,className:`relative w-full ${{sm:"max-w-[calc(100vw-2rem)] sm:max-w-md",md:"max-w-[calc(100vw-2rem)] sm:max-w-2xl",lg:"max-w-[calc(100vw-2rem)] sm:max-w-4xl",xl:"max-w-[calc(100vw-2rem)] sm:max-w-6xl",full:"max-w-[calc(100vw-2rem)] sm:max-w-[95vw]"}[o]} max-h-[calc(100vh-1rem)] sm:max-h-[calc(100vh-2rem)] flex flex-col bg-white rounded-lg shadow-xl transform transition-all`,children:[(a||i)&&(0,s.jsxs)("div",{className:"flex items-center justify-between px-4 sm:px-6 py-3 sm:py-4 border-b border-gray-200 flex-shrink-0",children:[s.jsx("h3",{className:"text-base sm:text-lg font-semibold text-gray-900 truncate pr-2",children:a}),i&&s.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-600 transition-colors flex-shrink-0",children:s.jsx("svg",{className:"w-5 h-5 sm:w-6 sm:h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),s.jsx("div",{className:"px-4 sm:px-6 py-3 sm:py-4 overflow-y-auto flex-1 min-h-0",children:n})]})})]}),document.body):null}},77758:(e,t,a)=>{a.d(t,{Ct:()=>c,zx:()=>r,Zb:()=>l,aY:()=>i,Ol:()=>n,ll:()=>o,u_:()=>d.u});var s=a(10326);function r({variant:e="primary",size:t="md",fullWidth:a=!1,loading:r=!1,disabled:l,className:n="",children:o,...i}){let c=["btn",{primary:"btn-primary",secondary:"btn-secondary",danger:"btn-danger",ghost:"bg-transparent text-gray-700 hover:bg-gray-100 focus:ring-gray-500"}[e],{sm:"btn-sm",md:"",lg:"btn-lg"}[t],a?"w-full":"",l||r?"opacity-50 cursor-not-allowed":"",n].filter(Boolean).join(" ");return(0,s.jsxs)("button",{className:c,disabled:l||r,...i,children:[r&&(0,s.jsxs)("svg",{className:"animate-spin -ml-1 mr-2 h-4 w-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),o]})}function l({hover:e=!1,padding:t="md",className:a="",children:r,...l}){let n=["card",e?"card-hover":"",{none:"",sm:"p-3",md:"p-4",lg:"p-6"}[t],a].filter(Boolean).join(" ");return s.jsx("div",{className:n,...l,children:r})}function n({className:e="",children:t,...a}){return s.jsx("div",{className:`mb-3 ${e}`,...a,children:t})}function o({className:e="",children:t,...a}){return s.jsx("h3",{className:`text-lg font-semibold text-gray-900 ${e}`,...a,children:t})}function i({className:e="",children:t,...a}){return s.jsx("div",{className:e,...a,children:t})}function c({variant:e="gray",dot:t=!1,className:a="",children:r,...l}){let n=["badge",{success:"badge-success",warning:"badge-warning",error:"badge-error",info:"badge-info",gray:"badge-gray"}[e],a].filter(Boolean).join(" ");return(0,s.jsxs)("span",{className:n,...l,children:[t&&s.jsx("span",{className:`mr-1.5 inline-block h-2 w-2 rounded-full ${{success:"bg-green-600",warning:"bg-yellow-600",error:"bg-red-600",info:"bg-blue-600",gray:"bg-gray-600"}[e]}`,"aria-hidden":"true"}),r]})}a(17577);var d=a(28676)},11867:(e,t,a)=>{a.d(t,{n:()=>d});var s=a(10326),r=a(17577),l=a(77758),n=a(11865),o=a(73002),i=a(91515),c=a(51223);function d({worktreeId:e}){let[t,a]=(0,r.useState)([]),[d,u]=(0,r.useState)(null),[x,m]=(0,r.useState)(null),[h,p]=(0,r.useState)(!0),[g,b]=(0,r.useState)(null),[f,y]=(0,r.useState)(""),[v,j]=(0,r.useState)(0),[w,N]=(0,r.useState)("all"),[k,C]=(0,r.useState)(!1),{toasts:S,showToast:L,removeToast:z}=(0,n.pm)(),$=(0,r.useMemo)(()=>"all"===w?t:t.filter(e=>e.toLowerCase().includes(w)),[t,w]),M=async t=>{try{p(!0),b(null);let a=await o.Iv.getLogFile(e,t);m(a.content),u(t),y(""),j(0)}catch(e){b((0,o.zG)(e))}finally{p(!1)}},E=(0,r.useCallback)(async()=>{if(d)try{C(!0);let t=await o.Iv.getLogFile(e,d,{sanitize:!0});await (0,i.v)(t.content),L("Log copied to clipboard (sanitized)","success")}catch(e){L(`Failed to export log: ${(0,o.zG)(e)}`,"error")}finally{C(!1)}},[e,d,L]),T=(0,r.useMemo)(()=>{let e;if(!f||!x)return[];let t=RegExp((0,c.hr)(f),"gi"),a=[];for(;null!==(e=t.exec(x));)a.push({index:e.index,length:e[0].length});return a},[f,x]),A=()=>{T.length>0&&j(e=>(e+1)%T.length)},I=()=>{T.length>0&&j(e=>(e-1+T.length)%T.length)},B=(0,r.useMemo)(()=>{if(!x||!f||0===T.length)return x;let e="",t=0;return T.forEach((a,s)=>{e+=(0,c.Xv)(x.substring(t,a.index));let r=x.substring(a.index,a.index+a.length),l=s===v;e+=`<mark class="${l?"bg-yellow-400 text-black":"bg-yellow-200 text-black"}" data-match-index="${s}">${(0,c.Xv)(r)}</mark>`,t=a.index+a.length}),e+=(0,c.Xv)(x.substring(t))},[x,f,T,v]);return(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)(l.Zb,{padding:"md",children:[s.jsx(l.Ol,{children:(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[s.jsx(l.ll,{children:"Log Files"}),s.jsx(l.Ct,{variant:"gray",children:$.length})]}),(0,s.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[(0,s.jsxs)(l.zx,{variant:"all"===w?"primary":"ghost",size:"sm",onClick:()=>N("all"),children:["All (",t.length,")"]}),(0,s.jsxs)(l.zx,{variant:"claude"===w?"primary":"ghost",size:"sm",onClick:()=>N("claude"),children:["Claude (",t.filter(e=>e.toLowerCase().includes("claude")).length,")"]}),(0,s.jsxs)(l.zx,{variant:"codex"===w?"primary":"ghost",size:"sm",onClick:()=>N("codex"),children:["Codex (",t.filter(e=>e.toLowerCase().includes("codex")).length,")"]}),(0,s.jsxs)(l.zx,{variant:"gemini"===w?"primary":"ghost",size:"sm",onClick:()=>N("gemini"),children:["Gemini (",t.filter(e=>e.toLowerCase().includes("gemini")).length,")"]})]})]})}),(0,s.jsxs)(l.aY,{children:[h&&0===t.length&&s.jsx("div",{className:"text-center py-4",children:s.jsx("div",{className:"inline-block animate-spin rounded-full h-6 w-6 border-4 border-gray-300 border-t-blue-600"})}),g&&s.jsx("div",{className:"p-3 bg-red-50 border border-red-200 rounded text-sm text-red-800",children:g}),!h&&0===$.length&&!g&&s.jsx("p",{className:"text-sm text-gray-600 text-center py-4",children:"all"===w?"No log files found":`No ${w} log files found`}),$.length>0&&s.jsx("div",{className:"space-y-2",children:$.map(e=>s.jsx("button",{onClick:()=>M(e),className:`w-full text-left px-3 py-2 rounded text-sm font-mono transition-colors ${d===e?"bg-blue-50 text-blue-700 border border-blue-200":"hover:bg-gray-50 border border-transparent"}`,children:e},e))})]})]}),d&&(0,s.jsxs)(l.Zb,{padding:"md",children:[s.jsx(l.Ol,{children:(0,s.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[s.jsx(l.ll,{className:"font-mono text-base",children:d}),(0,s.jsxs)("div",{className:"flex gap-2",children:[s.jsx(l.zx,{variant:"ghost",size:"sm",onClick:E,disabled:!d||k,title:"Copy sanitized log to clipboard",children:k?"Exporting...":"Export"}),s.jsx(l.zx,{variant:"ghost",size:"sm",onClick:()=>{u(null),m(null),y(""),j(0)},children:"Close"})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)("div",{className:"relative flex-1",children:[s.jsx("input",{type:"text",value:f,onChange:e=>y(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),e.shiftKey?I():A())},placeholder:"Search in log file...",className:"input w-full pr-20"}),T.length>0&&(0,s.jsxs)("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 text-xs text-gray-500",children:[v+1," / ",T.length]})]}),T.length>0&&(0,s.jsxs)("div",{className:"flex gap-1",children:[s.jsx(l.zx,{variant:"ghost",size:"sm",onClick:I,disabled:0===T.length,title:"Previous match (Shift+Enter)",children:"↑"}),s.jsx(l.zx,{variant:"ghost",size:"sm",onClick:A,disabled:0===T.length,title:"Next match (Enter)",children:"↓"})]})]})]})}),(0,s.jsxs)(l.aY,{children:[h&&s.jsx("div",{className:"text-center py-8",children:s.jsx("div",{className:"inline-block animate-spin rounded-full h-8 w-8 border-4 border-gray-300 border-t-blue-600"})}),!h&&x&&s.jsx("div",{className:"bg-gray-900 text-gray-100 rounded p-4 overflow-x-auto max-h-[500px] scrollbar-thin",children:f&&T.length>0?s.jsx("pre",{className:"text-xs font-mono whitespace-pre-wrap",dangerouslySetInnerHTML:{__html:B||""}}):s.jsx("pre",{className:"text-xs font-mono whitespace-pre-wrap",children:x})}),!h&&f&&0===T.length&&x&&(0,s.jsxs)("div",{className:"text-center py-4 text-sm text-gray-500",children:['No matches found for "',f,'"']})]})]}),s.jsx(n.Ix,{toasts:S,onClose:z})]})}},15470:(e,t,a)=>{a.d(t,{R:()=>x});var s=a(10326),r=a(17577),l=a(73002);function n(e,t){if(!t.trim())return e;let a=t.toLowerCase();return e.map(e=>({...e,commands:e.commands.filter(e=>{let t=e.name.toLowerCase().includes(a),s=e.description.toLowerCase().includes(a);return t||s})})).filter(e=>e.commands.length>0)}function o({groups:e,onSelect:t,highlightedIndex:a=-1,className:r=""}){let l=0;return 0===e.length?s.jsx("div",{className:`text-sm text-gray-500 p-4 text-center ${r}`,children:"No commands available"}):s.jsx("div",{className:`overflow-y-auto ${r}`,children:e.map(e=>(0,s.jsxs)("div",{className:"mb-2",children:[s.jsx("div",{className:"px-3 py-1.5 text-xs font-semibold text-gray-500 uppercase tracking-wider bg-gray-50",children:e.label}),s.jsx("div",{children:e.commands.map(e=>{let r=l;l++;let n=r===a;return(0,s.jsxs)("button",{type:"button","data-command-item":!0,"data-highlighted":n,onClick:()=>t(e),className:`w-full px-3 py-2 text-left flex items-start gap-2 hover:bg-blue-50 transition-colors ${n?"bg-blue-100":""}`,children:[(0,s.jsxs)("span",{className:"text-blue-600 font-mono text-sm flex-shrink-0",children:["/",e.name]}),s.jsx("span",{className:"text-gray-600 text-sm truncate",children:e.description})]},e.name)})})]},e.category))})}function i({isOpen:e,groups:t,onSelect:a,onClose:l,isMobile:i=!1,position:c,onFreeInput:d}){let[u,x]=(0,r.useState)(""),[m,h]=(0,r.useState)(0),p=(0,r.useRef)(null),g=(0,r.useMemo)(()=>n(t,u),[t,u]),b=(0,r.useMemo)(()=>g.flatMap(e=>e.commands),[g]),f=(0,r.useCallback)(e=>{a(e),l()},[a,l]);return((0,r.useCallback)(t=>{if(e)switch(t.key){case"Escape":t.preventDefault(),l();break;case"ArrowDown":t.preventDefault(),h(e=>Math.min(e+1,b.length-1));break;case"ArrowUp":t.preventDefault(),h(e=>Math.max(e-1,0));break;case"Enter":t.preventDefault(),b[m]&&f(b[m])}},[e,b,m,l,f]),e)?i?(0,s.jsxs)(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/50 z-40",onClick:l,"aria-hidden":"true"}),(0,s.jsxs)("div",{"data-testid":"slash-command-bottom-sheet",className:"fixed bottom-0 left-0 right-0 bg-white rounded-t-xl z-50 max-h-[70vh] flex flex-col shadow-xl",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200",children:[s.jsx("h2",{className:"text-lg font-semibold",children:"Commands"}),s.jsx("button",{type:"button",onClick:l,"aria-label":"Close",className:"p-2 rounded-full hover:bg-gray-100",children:s.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),s.jsx("div",{className:"px-4 py-2 border-b border-gray-100",children:s.jsx("input",{ref:p,type:"text",value:u,onChange:e=>x(e.target.value),placeholder:"Search commands...",className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"})}),d&&(0,s.jsxs)("button",{type:"button","data-testid":"free-input-button",onClick:d,className:"w-full px-4 py-3 text-left border-b border-gray-100 flex items-center gap-2 hover:bg-blue-50 transition-colors",children:[s.jsx("span",{className:"text-blue-600",children:s.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),s.jsx("span",{className:"text-gray-600",children:"Enter custom command..."})]}),s.jsx(o,{groups:g,onSelect:f,highlightedIndex:m,className:"flex-1 overflow-y-auto pb-20"})]})]}):(0,s.jsxs)("div",{role:"listbox",className:"absolute bg-white border border-gray-200 rounded-lg shadow-lg z-50 w-80 max-h-96 flex flex-col",style:c?{top:c.top,left:c.left}:{bottom:"100%",left:0,marginBottom:"4px"},children:[s.jsx("div",{className:"px-3 py-2 border-b border-gray-100",children:s.jsx("input",{ref:p,type:"text",value:u,onChange:e=>x(e.target.value),placeholder:"Search commands...",className:"w-full px-3 py-1.5 text-sm border border-gray-300 rounded focus:outline-none focus:ring-1 focus:ring-blue-500"})}),d&&(0,s.jsxs)("button",{type:"button","data-testid":"free-input-button",onClick:d,className:"w-full px-3 py-2 text-left border-b border-gray-100 flex items-center gap-2 hover:bg-blue-50 transition-colors text-sm",children:[s.jsx("span",{className:"text-blue-600",children:s.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),s.jsx("span",{className:"text-gray-600",children:"Enter custom command..."})]}),s.jsx(o,{groups:g,onSelect:f,highlightedIndex:m,className:"flex-1 overflow-y-auto"}),(0,s.jsxs)("div",{className:"px-3 py-1.5 border-t border-gray-100 text-xs text-gray-400 flex gap-3",children:[(0,s.jsxs)("span",{children:[s.jsx("kbd",{className:"px-1 py-0.5 bg-gray-100 rounded",children:"Enter"})," select"]}),(0,s.jsxs)("span",{children:[s.jsx("kbd",{className:"px-1 py-0.5 bg-gray-100 rounded",children:"Esc"})," close"]})]})]}):null}function c({worktreeId:e,cliToolId:t,disabled:a=!1,onInterrupt:l}){let[n,o]=(0,r.useState)(!1),i=(0,r.useRef)(0),c=(0,r.useCallback)(async()=>{let a=Date.now();if(!(a-i.current<1e3)){i.current=a,o(!0);try{let a=await fetch(`/api/worktrees/${e}/interrupt`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cliToolId:t})});if(a.ok)l?.();else{let e=await a.json().catch(()=>({}));console.error("[InterruptButton] Failed to send interrupt:",e.error||a.statusText)}}catch(e){console.error("[InterruptButton] Error sending interrupt:",e)}finally{o(!1)}}},[e,t,l]);return s.jsx("button",{type:"button",onClick:c,disabled:a||n,className:"flex-shrink-0 p-2 text-orange-600 hover:bg-orange-50 rounded-full transition-colors disabled:text-gray-300 disabled:hover:bg-transparent","aria-label":"Stop processing","data-testid":"interrupt-button",children:n?(0,s.jsxs)("svg",{className:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}):s.jsx(d,{})})}function d(){return s.jsx("svg",{className:"h-5 w-5",fill:"currentColor",viewBox:"0 0 24 24",children:s.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})}var u=a(2982);function x({worktreeId:e,onMessageSent:t,cliToolId:a,isSessionRunning:o=!1}){let[d,x]=(0,r.useState)(""),[m,h]=(0,r.useState)(!1),[p,g]=(0,r.useState)(null),[b,f]=(0,r.useState)(!1),[y,v]=(0,r.useState)(!1),j=(0,r.useRef)(null),w=(0,r.useRef)(null),N=(0,r.useRef)(!1),k=(0,r.useRef)(null),C=(0,u.d)(),{groups:S}=function(e,t){let[a,s]=(0,r.useState)([]),[o,i]=(0,r.useState)(!0),[c,d]=(0,r.useState)(null),[u,x]=(0,r.useState)(""),[m,h]=(0,r.useState)(t||"claude"),p=(0,r.useCallback)(async()=>{try{i(!0),d(null);let a=e?`/api/worktrees/${e}/slash-commands`:"/api/slash-commands";t&&(a+=`?cliTool=${t}`);let r=await fetch(a);if(!r.ok)throw Error(`HTTP error ${r.status}`);let l=await r.json();s(l.groups),h(l.cliTool||t||"claude")}catch(e){d((0,l.zG)(e)),s([])}finally{i(!1)}},[e,t]),g=(0,r.useMemo)(()=>a.flatMap(e=>e.commands),[a]),b=(0,r.useMemo)(()=>n(a,u),[a,u]);return{groups:a,filteredGroups:b,allCommands:g,loading:o,error:c,filter:u,setFilter:x,refresh:(0,r.useCallback)(()=>{p()},[p]),cliTool:m}}(e,a),L=async()=>{if(!b&&d.trim()&&!m)try{h(!0),g(null);let s=a||"claude";await l.Iv.sendMessage(e,d.trim(),s),x(""),t?.(s)}catch(e){g((0,l.zG)(e))}finally{h(!1)}},z=async e=>{e.preventDefault(),await L()},$=()=>{v(!1),j.current?.focus()};return(0,s.jsxs)("div",{ref:k,className:"space-y-2 relative",children:[p&&s.jsx("div",{className:"p-2 bg-red-50 border border-red-200 rounded text-sm text-red-800",children:p}),(0,s.jsxs)("form",{onSubmit:z,className:"flex items-end gap-2 bg-white border border-gray-300 rounded-lg px-4 py-2 focus-within:border-blue-500 focus-within:ring-1 focus-within:ring-blue-500",children:[C&&s.jsx("button",{type:"button",onClick:()=>v(!0),className:"flex-shrink-0 p-2 text-gray-500 hover:text-blue-600 hover:bg-blue-50 rounded-full transition-colors","aria-label":"Show slash commands","data-testid":"mobile-command-button",children:s.jsx("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 20l4-16m2 16l4-16M6 9h14M4 15h14"})})}),s.jsx("textarea",{ref:j,value:d,onChange:e=>{let t=e.target.value;x(t),"/"===t||t.startsWith("/")&&!t.includes(" ")?v(!0):v(!1)},onKeyDown:e=>{let{keyCode:t}=e.nativeEvent;if(229!==t){if("Escape"===e.key&&y){e.preventDefault(),$();return}if(N.current&&"Enter"===e.key){N.current=!1;return}if("Enter"===e.key&&!b&&!y){if(C)return;e.shiftKey||(e.preventDefault(),L())}}},onCompositionStart:()=>{f(!0),N.current=!1,w.current&&clearTimeout(w.current)},onCompositionEnd:()=>{f(!1),N.current=!0,w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{N.current=!1},300)},placeholder:C?"Type your message...":"Type your message... (/ for commands, Shift+Enter for line break)",disabled:m,rows:1,className:"flex-1 outline-none bg-transparent resize-none py-1 overflow-y-auto scrollbar-thin",style:{minHeight:"24px",maxHeight:"160px"}}),s.jsx(c,{worktreeId:e,cliToolId:a||"claude",disabled:!o}),s.jsx("button",{type:"submit",disabled:!d.trim()||m,className:"flex-shrink-0 p-2 text-blue-600 hover:bg-blue-50 rounded-full transition-colors disabled:text-gray-300 disabled:hover:bg-transparent","aria-label":"Send message",children:m?(0,s.jsxs)("svg",{className:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}):s.jsx("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"})})})]}),s.jsx(i,{isOpen:y,groups:S,onSelect:e=>{x(`/${e.name} `),v(!1),j.current?.focus()},onClose:$,isMobile:C,onFreeInput:()=>{v(!1),x("/"),setTimeout(()=>{j.current?.focus()},50)}})]})}},61421:(e,t,a)=>{a.d(t,{F4:()=>r,Ie:()=>n,xh:()=>l});let s={idle:"bg-gray-500",ready:"bg-green-500",spinner:"border-blue-500",waiting:"bg-yellow-500",error:"bg-red-500"},r={idle:{className:s.idle,label:"Idle",type:"dot"},ready:{className:s.ready,label:"Ready",type:"dot"},running:{className:s.spinner,label:"Running",type:"spinner"},waiting:{className:s.waiting,label:"Waiting for response",type:"dot"},generating:{className:s.spinner,label:"Generating",type:"spinner"}},l={idle:{className:s.idle,label:"Idle",type:"dot"},ready:{className:s.ready,label:"Ready",type:"dot"},running:{className:s.spinner,label:"Running",type:"spinner"},waiting:{className:s.waiting,label:"Waiting for response",type:"dot"},error:{className:s.error,label:"Error",type:"dot"}},n={idle:{className:s.idle,label:"Idle - No active session",type:"dot"},ready:{className:s.ready,label:"Ready - Waiting for input",type:"dot"},running:{className:s.spinner,label:"Running - Processing",type:"spinner"},waiting:{className:s.waiting,label:"Waiting - User input required",type:"dot"},error:{className:s.error,label:"Error",type:"dot"}}},22202:(e,t,a)=>{a.d(t,{k:()=>s});let s={DROPDOWN:10,SIDEBAR:30,MODAL:50,MAXIMIZED_EDITOR:55,TOAST:60,CONTEXT_MENU:70}},2982:(e,t,a)=>{a.d(t,{d:()=>r});var s=a(17577);function r(e={}){let{breakpoint:t=768}=e,[a,r]=(0,s.useState)(!1);return a}},91515:(e,t,a)=>{a.d(t,{v:()=>r});let s=/\x1b\[[0-9;]*[a-zA-Z]|\x1b\][^\x07]*\x07|\[[0-9;]*m/g;async function r(e){if(!e||0===e.trim().length)return;let t=e.replace(s,"");await navigator.clipboard.writeText(t)}},41593:(e,t,a)=>{a.d(t,{G:()=>n});var s=a(27808),r=a(18811);let l={en:r._,ja:s.ja};function n(e){return l[e]??r._}},51223:(e,t,a)=>{function s(e,t){let a=null;return(...s)=>{a&&clearTimeout(a),a=setTimeout(()=>{e(...s),a=null},t)}}function r(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function l(e){let t=new Set;for(let a of e){t.add(a);let e=a.split("/"),s="";for(let a=0;a<e.length-1;a++)s=s?`${s}/${e[a]}`:e[a],t.add(s)}return t}function n(e,t=30){return e.length<=t?e:`${e.substring(0,t-3)}...`}function o(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}a.d(t,{Ds:()=>s,Ps:()=>l,Xv:()=>o,aS:()=>n,hr:()=>r})},18421:(e,t,a)=>{function s(e){return e?e.isWaitingForResponse?"waiting":e.isProcessing?"running":e.isRunning?"ready":"idle":"idle"}function r(e){let t=!!e.lastAssistantMessageAt&&(!e.lastViewedAt||new Date(e.lastAssistantMessageAt)>new Date(e.lastViewedAt));return{id:e.id,name:e.name,repositoryName:e.repositoryName,status:"idle",hasUnread:t,lastActivity:e.updatedAt,description:e.description,cliStatus:{claude:s(e.sessionStatusByCli?.claude),codex:s(e.sessionStatusByCli?.codex)}}}a.d(t,{He:()=>s,I_:()=>r})},63601:(e,t,a)=>{a.r(t),a.d(t,{default:()=>r});var s=a(66621);let r=e=>[{type:"image/png",sizes:"180x180",url:(0,s.fillMetadataSegment)(".",e.params,"apple-icon.png")+"?31a89e65aa4ac65b"}]},71150:(e,t,a)=>{a.r(t),a.d(t,{default:()=>r});var s=a(66621);let r=e=>[{type:"image/png",sizes:"32x32",url:(0,s.fillMetadataSegment)(".",e.params,"icon.png")+"?32d9127ba30ee286"}]}};
35
+ `,role:"main",children:e})]})})},28676:(e,t,s)=>{s.d(t,{u:()=>i});var a=s(10326),r=s(17577),l=s(60962),n=s(22202);function i({isOpen:e,onClose:t,title:s,children:i,size:o="lg",showCloseButton:c=!0,disableClose:d=!1}){let u=(0,r.useRef)(null);return e?(0,l.createPortal)((0,a.jsxs)("div",{className:"fixed inset-0 overflow-y-auto",style:{zIndex:n.k.MODAL},children:[a.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 transition-opacity",onClick:d?void 0:t}),a.jsx("div",{className:"relative flex min-h-full items-center justify-center p-2 sm:p-4",children:(0,a.jsxs)("div",{ref:u,className:`relative w-full ${{sm:"max-w-[calc(100vw-2rem)] sm:max-w-md",md:"max-w-[calc(100vw-2rem)] sm:max-w-2xl",lg:"max-w-[calc(100vw-2rem)] sm:max-w-4xl",xl:"max-w-[calc(100vw-2rem)] sm:max-w-6xl",full:"max-w-[calc(100vw-2rem)] sm:max-w-[95vw]"}[o]} max-h-[calc(100vh-1rem)] sm:max-h-[calc(100vh-2rem)] flex flex-col bg-white rounded-lg shadow-xl transform transition-all`,children:[(s||c)&&(0,a.jsxs)("div",{className:"flex items-center justify-between px-4 sm:px-6 py-3 sm:py-4 border-b border-gray-200 flex-shrink-0",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold text-gray-900 truncate pr-2",children:s}),c&&a.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-600 transition-colors flex-shrink-0",children:a.jsx("svg",{className:"w-5 h-5 sm:w-6 sm:h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsx("div",{className:"px-4 sm:px-6 py-3 sm:py-4 overflow-y-auto flex-1 min-h-0",children:i})]})})]}),document.body):null}},77758:(e,t,s)=>{s.d(t,{Ct:()=>c,zx:()=>r,Zb:()=>l,aY:()=>o,Ol:()=>n,ll:()=>i,u_:()=>d.u});var a=s(10326);function r({variant:e="primary",size:t="md",fullWidth:s=!1,loading:r=!1,disabled:l,className:n="",children:i,...o}){let c=["btn",{primary:"btn-primary",secondary:"btn-secondary",danger:"btn-danger",ghost:"bg-transparent text-gray-700 hover:bg-gray-100 focus:ring-gray-500"}[e],{sm:"btn-sm",md:"",lg:"btn-lg"}[t],s?"w-full":"",l||r?"opacity-50 cursor-not-allowed":"",n].filter(Boolean).join(" ");return(0,a.jsxs)("button",{className:c,disabled:l||r,...o,children:[r&&(0,a.jsxs)("svg",{className:"animate-spin -ml-1 mr-2 h-4 w-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),i]})}function l({hover:e=!1,padding:t="md",className:s="",children:r,...l}){let n=["card",e?"card-hover":"",{none:"",sm:"p-3",md:"p-4",lg:"p-6"}[t],s].filter(Boolean).join(" ");return a.jsx("div",{className:n,...l,children:r})}function n({className:e="",children:t,...s}){return a.jsx("div",{className:`mb-3 ${e}`,...s,children:t})}function i({className:e="",children:t,...s}){return a.jsx("h3",{className:`text-lg font-semibold text-gray-900 ${e}`,...s,children:t})}function o({className:e="",children:t,...s}){return a.jsx("div",{className:e,...s,children:t})}function c({variant:e="gray",dot:t=!1,className:s="",children:r,...l}){let n=["badge",{success:"badge-success",warning:"badge-warning",error:"badge-error",info:"badge-info",gray:"badge-gray"}[e],s].filter(Boolean).join(" ");return(0,a.jsxs)("span",{className:n,...l,children:[t&&a.jsx("span",{className:`mr-1.5 inline-block h-2 w-2 rounded-full ${{success:"bg-green-600",warning:"bg-yellow-600",error:"bg-red-600",info:"bg-blue-600",gray:"bg-gray-600"}[e]}`,"aria-hidden":"true"}),r]})}s(17577);var d=s(28676)},11867:(e,t,s)=>{s.d(t,{n:()=>d});var a=s(10326),r=s(17577),l=s(77758),n=s(11865),i=s(73002),o=s(91515),c=s(51223);function d({worktreeId:e}){let[t,s]=(0,r.useState)([]),[d,u]=(0,r.useState)(null),[x,m]=(0,r.useState)(null),[h,p]=(0,r.useState)(!0),[g,b]=(0,r.useState)(null),[f,y]=(0,r.useState)(""),[v,j]=(0,r.useState)(0),[w,N]=(0,r.useState)("all"),[k,C]=(0,r.useState)(!1),{toasts:S,showToast:L,removeToast:z}=(0,n.pm)(),$=(0,r.useMemo)(()=>"all"===w?t:t.filter(e=>e.toLowerCase().includes(w)),[t,w]),M=async t=>{try{p(!0),b(null);let s=await i.Iv.getLogFile(e,t);m(s.content),u(t),y(""),j(0)}catch(e){b((0,i.zG)(e))}finally{p(!1)}},E=(0,r.useCallback)(async()=>{if(d)try{C(!0);let t=await i.Iv.getLogFile(e,d,{sanitize:!0});await (0,o.v)(t.content),L("Log copied to clipboard (sanitized)","success")}catch(e){L(`Failed to export log: ${(0,i.zG)(e)}`,"error")}finally{C(!1)}},[e,d,L]),T=(0,r.useMemo)(()=>{let e;if(!f||!x)return[];let t=RegExp((0,c.hr)(f),"gi"),s=[];for(;null!==(e=t.exec(x));)s.push({index:e.index,length:e[0].length});return s},[f,x]),A=()=>{T.length>0&&j(e=>(e+1)%T.length)},I=()=>{T.length>0&&j(e=>(e-1+T.length)%T.length)},D=(0,r.useMemo)(()=>{if(!x||!f||0===T.length)return x;let e="",t=0;return T.forEach((s,a)=>{e+=(0,c.Xv)(x.substring(t,s.index));let r=x.substring(s.index,s.index+s.length),l=a===v;e+=`<mark class="${l?"bg-yellow-400 text-black":"bg-yellow-200 text-black"}" data-match-index="${a}">${(0,c.Xv)(r)}</mark>`,t=s.index+s.length}),e+=(0,c.Xv)(x.substring(t))},[x,f,T,v]);return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)(l.Zb,{padding:"md",children:[a.jsx(l.Ol,{children:(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[a.jsx(l.ll,{children:"Log Files"}),a.jsx(l.Ct,{variant:"gray",children:$.length})]}),(0,a.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[(0,a.jsxs)(l.zx,{variant:"all"===w?"primary":"ghost",size:"sm",onClick:()=>N("all"),children:["All (",t.length,")"]}),(0,a.jsxs)(l.zx,{variant:"claude"===w?"primary":"ghost",size:"sm",onClick:()=>N("claude"),children:["Claude (",t.filter(e=>e.toLowerCase().includes("claude")).length,")"]}),(0,a.jsxs)(l.zx,{variant:"codex"===w?"primary":"ghost",size:"sm",onClick:()=>N("codex"),children:["Codex (",t.filter(e=>e.toLowerCase().includes("codex")).length,")"]}),(0,a.jsxs)(l.zx,{variant:"gemini"===w?"primary":"ghost",size:"sm",onClick:()=>N("gemini"),children:["Gemini (",t.filter(e=>e.toLowerCase().includes("gemini")).length,")"]})]})]})}),(0,a.jsxs)(l.aY,{children:[h&&0===t.length&&a.jsx("div",{className:"text-center py-4",children:a.jsx("div",{className:"inline-block animate-spin rounded-full h-6 w-6 border-4 border-gray-300 border-t-blue-600"})}),g&&a.jsx("div",{className:"p-3 bg-red-50 border border-red-200 rounded text-sm text-red-800",children:g}),!h&&0===$.length&&!g&&a.jsx("p",{className:"text-sm text-gray-600 text-center py-4",children:"all"===w?"No log files found":`No ${w} log files found`}),$.length>0&&a.jsx("div",{className:"space-y-2",children:$.map(e=>a.jsx("button",{onClick:()=>M(e),className:`w-full text-left px-3 py-2 rounded text-sm font-mono transition-colors ${d===e?"bg-blue-50 text-blue-700 border border-blue-200":"hover:bg-gray-50 border border-transparent"}`,children:e},e))})]})]}),d&&(0,a.jsxs)(l.Zb,{padding:"md",children:[a.jsx(l.Ol,{children:(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[a.jsx(l.ll,{className:"font-mono text-base",children:d}),(0,a.jsxs)("div",{className:"flex gap-2",children:[a.jsx(l.zx,{variant:"ghost",size:"sm",onClick:E,disabled:!d||k,title:"Copy sanitized log to clipboard",children:k?"Exporting...":"Export"}),a.jsx(l.zx,{variant:"ghost",size:"sm",onClick:()=>{u(null),m(null),y(""),j(0)},children:"Close"})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("div",{className:"relative flex-1",children:[a.jsx("input",{type:"text",value:f,onChange:e=>y(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),e.shiftKey?I():A())},placeholder:"Search in log file...",className:"input w-full pr-20"}),T.length>0&&(0,a.jsxs)("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 text-xs text-gray-500",children:[v+1," / ",T.length]})]}),T.length>0&&(0,a.jsxs)("div",{className:"flex gap-1",children:[a.jsx(l.zx,{variant:"ghost",size:"sm",onClick:I,disabled:0===T.length,title:"Previous match (Shift+Enter)",children:"↑"}),a.jsx(l.zx,{variant:"ghost",size:"sm",onClick:A,disabled:0===T.length,title:"Next match (Enter)",children:"↓"})]})]})]})}),(0,a.jsxs)(l.aY,{children:[h&&a.jsx("div",{className:"text-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"})}),!h&&x&&a.jsx("div",{className:"bg-gray-900 text-gray-100 rounded p-4 overflow-x-auto max-h-[500px] scrollbar-thin",children:f&&T.length>0?a.jsx("pre",{className:"text-xs font-mono whitespace-pre-wrap",dangerouslySetInnerHTML:{__html:D||""}}):a.jsx("pre",{className:"text-xs font-mono whitespace-pre-wrap",children:x})}),!h&&f&&0===T.length&&x&&(0,a.jsxs)("div",{className:"text-center py-4 text-sm text-gray-500",children:['No matches found for "',f,'"']})]})]}),a.jsx(n.Ix,{toasts:S,onClose:z})]})}},15470:(e,t,s)=>{s.d(t,{R:()=>x});var a=s(10326),r=s(17577),l=s(73002);function n(e,t){if(!t.trim())return e;let s=t.toLowerCase();return e.map(e=>({...e,commands:e.commands.filter(e=>{let t=e.name.toLowerCase().includes(s),a=e.description.toLowerCase().includes(s);return t||a})})).filter(e=>e.commands.length>0)}function i({groups:e,onSelect:t,highlightedIndex:s=-1,className:r=""}){let l=0;return 0===e.length?a.jsx("div",{className:`text-sm text-gray-500 p-4 text-center ${r}`,children:"No commands available"}):a.jsx("div",{className:`overflow-y-auto ${r}`,children:e.map(e=>(0,a.jsxs)("div",{className:"mb-2",children:[a.jsx("div",{className:"px-3 py-1.5 text-xs font-semibold text-gray-500 uppercase tracking-wider bg-gray-50",children:e.label}),a.jsx("div",{children:e.commands.map(e=>{let r=l;l++;let n=r===s;return(0,a.jsxs)("button",{type:"button","data-command-item":!0,"data-highlighted":n,onClick:()=>t(e),className:`w-full px-3 py-2 text-left flex items-start gap-2 hover:bg-blue-50 transition-colors ${n?"bg-blue-100":""}`,children:[(0,a.jsxs)("span",{className:"text-blue-600 font-mono text-sm flex-shrink-0",children:["/",e.name]}),a.jsx("span",{className:"text-gray-600 text-sm truncate",children:e.description})]},e.name)})})]},e.category))})}function o({isOpen:e,groups:t,onSelect:s,onClose:l,isMobile:o=!1,position:c,onFreeInput:d}){let[u,x]=(0,r.useState)(""),[m,h]=(0,r.useState)(0),p=(0,r.useRef)(null),g=(0,r.useMemo)(()=>n(t,u),[t,u]),b=(0,r.useMemo)(()=>g.flatMap(e=>e.commands),[g]),f=(0,r.useCallback)(e=>{s(e),l()},[s,l]);return((0,r.useCallback)(t=>{if(e)switch(t.key){case"Escape":t.preventDefault(),l();break;case"ArrowDown":t.preventDefault(),h(e=>Math.min(e+1,b.length-1));break;case"ArrowUp":t.preventDefault(),h(e=>Math.max(e-1,0));break;case"Enter":t.preventDefault(),b[m]&&f(b[m])}},[e,b,m,l,f]),e)?o?(0,a.jsxs)(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 bg-black/50 z-40",onClick:l,"aria-hidden":"true"}),(0,a.jsxs)("div",{"data-testid":"slash-command-bottom-sheet",className:"fixed bottom-0 left-0 right-0 bg-white rounded-t-xl z-50 max-h-[70vh] flex flex-col shadow-xl",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200",children:[a.jsx("h2",{className:"text-lg font-semibold",children:"Commands"}),a.jsx("button",{type:"button",onClick:l,"aria-label":"Close",className:"p-2 rounded-full hover:bg-gray-100",children:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsx("div",{className:"px-4 py-2 border-b border-gray-100",children:a.jsx("input",{ref:p,type:"text",value:u,onChange:e=>x(e.target.value),placeholder:"Search commands...",className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"})}),d&&(0,a.jsxs)("button",{type:"button","data-testid":"free-input-button",onClick:()=>d(u),className:"w-full px-4 py-3 text-left border-b border-gray-100 flex items-center gap-2 hover:bg-blue-50 transition-colors",children:[a.jsx("span",{className:"text-blue-600",children:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),a.jsx("span",{className:"text-gray-600",children:"Enter custom command..."})]}),a.jsx(i,{groups:g,onSelect:f,highlightedIndex:m,className:"flex-1 overflow-y-auto pb-20"})]})]}):(0,a.jsxs)("div",{role:"listbox",className:"absolute bg-white border border-gray-200 rounded-lg shadow-lg z-50 w-80 max-h-96 flex flex-col",style:c?{top:c.top,left:c.left}:{bottom:"100%",left:0,marginBottom:"4px"},children:[a.jsx("div",{className:"px-3 py-2 border-b border-gray-100",children:a.jsx("input",{ref:p,type:"text",value:u,onChange:e=>x(e.target.value),placeholder:"Search commands...",className:"w-full px-3 py-1.5 text-sm border border-gray-300 rounded focus:outline-none focus:ring-1 focus:ring-blue-500"})}),d&&(0,a.jsxs)("button",{type:"button","data-testid":"free-input-button",onClick:()=>d(u),className:"w-full px-3 py-2 text-left border-b border-gray-100 flex items-center gap-2 hover:bg-blue-50 transition-colors text-sm",children:[a.jsx("span",{className:"text-blue-600",children:a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),a.jsx("span",{className:"text-gray-600",children:"Enter custom command..."})]}),a.jsx(i,{groups:g,onSelect:f,highlightedIndex:m,className:"flex-1 overflow-y-auto"}),(0,a.jsxs)("div",{className:"px-3 py-1.5 border-t border-gray-100 text-xs text-gray-400 flex gap-3",children:[(0,a.jsxs)("span",{children:[a.jsx("kbd",{className:"px-1 py-0.5 bg-gray-100 rounded",children:"Enter"})," select"]}),(0,a.jsxs)("span",{children:[a.jsx("kbd",{className:"px-1 py-0.5 bg-gray-100 rounded",children:"Esc"})," close"]})]})]}):null}function c({worktreeId:e,cliToolId:t,disabled:s=!1,onInterrupt:l}){let[n,i]=(0,r.useState)(!1),o=(0,r.useRef)(0),c=(0,r.useCallback)(async()=>{let s=Date.now();if(!(s-o.current<1e3)){o.current=s,i(!0);try{let s=await fetch(`/api/worktrees/${e}/interrupt`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cliToolId:t})});if(s.ok)l?.();else{let e=await s.json().catch(()=>({}));console.error("[InterruptButton] Failed to send interrupt:",e.error||s.statusText)}}catch(e){console.error("[InterruptButton] Error sending interrupt:",e)}finally{i(!1)}}},[e,t,l]);return a.jsx("button",{type:"button",onClick:c,disabled:s||n,className:"flex-shrink-0 p-2 text-orange-600 hover:bg-orange-50 rounded-full transition-colors disabled:text-gray-300 disabled:hover:bg-transparent","aria-label":"Stop processing","data-testid":"interrupt-button",children:n?(0,a.jsxs)("svg",{className:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}):a.jsx(d,{})})}function d(){return a.jsx("svg",{className:"h-5 w-5",fill:"currentColor",viewBox:"0 0 24 24",children:a.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})}var u=s(2982);function x({worktreeId:e,onMessageSent:t,cliToolId:s,isSessionRunning:i=!1}){let[d,x]=(0,r.useState)(""),[m,h]=(0,r.useState)(!1),[p,g]=(0,r.useState)(null),[b,f]=(0,r.useState)(!1),[y,v]=(0,r.useState)(!1),[j,w]=(0,r.useState)(!1),N=(0,r.useRef)(null),k=(0,r.useRef)(null),C=(0,r.useRef)(!1),S=(0,r.useRef)(null),L=(0,u.d)(),{groups:z}=function(e,t){let[s,a]=(0,r.useState)([]),[i,o]=(0,r.useState)(!0),[c,d]=(0,r.useState)(null),[u,x]=(0,r.useState)(""),[m,h]=(0,r.useState)(t||"claude"),p=(0,r.useCallback)(async()=>{try{o(!0),d(null);let s=e?`/api/worktrees/${e}/slash-commands`:"/api/slash-commands";t&&(s+=`?cliTool=${t}`);let r=await fetch(s);if(!r.ok)throw Error(`HTTP error ${r.status}`);let l=await r.json();a(l.groups),h(l.cliTool||t||"claude")}catch(e){d((0,l.zG)(e)),a([])}finally{o(!1)}},[e,t]),g=(0,r.useMemo)(()=>s.flatMap(e=>e.commands),[s]),b=(0,r.useMemo)(()=>n(s,u),[s,u]);return{groups:s,filteredGroups:b,allCommands:g,loading:i,error:c,filter:u,setFilter:x,refresh:(0,r.useCallback)(()=>{p()},[p]),cliTool:m}}(e,s),$=async()=>{if(!b&&d.trim()&&!m)try{h(!0),g(null);let a=s||"claude";await l.Iv.sendMessage(e,d.trim(),a),x(""),w(!1),t?.(a)}catch(e){g((0,l.zG)(e))}finally{h(!1)}},M=async e=>{e.preventDefault(),await $()},E=()=>{v(!1),w(!1),N.current?.focus()};return(0,a.jsxs)("div",{ref:S,className:"space-y-2 relative",children:[p&&a.jsx("div",{className:"p-2 bg-red-50 border border-red-200 rounded text-sm text-red-800",children:p}),(0,a.jsxs)("form",{onSubmit:M,className:"flex items-end gap-2 bg-white border border-gray-300 rounded-lg px-4 py-2 focus-within:border-blue-500 focus-within:ring-1 focus-within:ring-blue-500",children:[L&&a.jsx("button",{type:"button",onClick:()=>{j&&w(!1),v(!0)},className:"flex-shrink-0 p-2 text-gray-500 hover:text-blue-600 hover:bg-blue-50 rounded-full transition-colors","aria-label":"Show slash commands","data-testid":"mobile-command-button",children:a.jsx("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 20l4-16m2 16l4-16M6 9h14M4 15h14"})})}),a.jsx("textarea",{ref:N,value:d,onChange:e=>{let t=e.target.value;if(x(t),""===t){w(!1),v(!1);return}j||("/"===t||t.startsWith("/")&&!t.includes(" ")?v(!0):v(!1))},onKeyDown:e=>{let{keyCode:t}=e.nativeEvent;if(229!==t){if("Escape"===e.key&&y){e.preventDefault(),E();return}if(C.current&&"Enter"===e.key){C.current=!1;return}if("Enter"===e.key&&!b&&(!y||j)){if(L)return;e.shiftKey||(e.preventDefault(),$())}}},onCompositionStart:()=>{f(!0),C.current=!1,k.current&&clearTimeout(k.current)},onCompositionEnd:()=>{f(!1),C.current=!0,k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{C.current=!1},300)},placeholder:L?"Type your message...":"Type your message... (/ for commands, Shift+Enter for line break)",disabled:m,rows:1,className:"flex-1 outline-none bg-transparent resize-none py-1 overflow-y-auto scrollbar-thin",style:{minHeight:"24px",maxHeight:"160px"}}),a.jsx(c,{worktreeId:e,cliToolId:s||"claude",disabled:!i}),a.jsx("button",{type:"submit",disabled:!d.trim()||m,className:"flex-shrink-0 p-2 text-blue-600 hover:bg-blue-50 rounded-full transition-colors disabled:text-gray-300 disabled:hover:bg-transparent","aria-label":"Send message",children:m?(0,a.jsxs)("svg",{className:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}):a.jsx("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"})})})]}),a.jsx(o,{isOpen:y,groups:z,onSelect:e=>{x(`/${e.name} `),v(!1),N.current?.focus()},onClose:E,isMobile:L,onFreeInput:e=>{v(!1),w(!0),x(e?`/${e}`:"/"),setTimeout(()=>{N.current?.focus()},50)}})]})}},61421:(e,t,s)=>{s.d(t,{F4:()=>r,Ie:()=>n,xh:()=>l});let a={idle:"bg-gray-500",ready:"bg-green-500",spinner:"border-blue-500",waiting:"bg-yellow-500",error:"bg-red-500"},r={idle:{className:a.idle,label:"Idle",type:"dot"},ready:{className:a.ready,label:"Ready",type:"dot"},running:{className:a.spinner,label:"Running",type:"spinner"},waiting:{className:a.waiting,label:"Waiting for response",type:"dot"},generating:{className:a.spinner,label:"Generating",type:"spinner"}},l={idle:{className:a.idle,label:"Idle",type:"dot"},ready:{className:a.ready,label:"Ready",type:"dot"},running:{className:a.spinner,label:"Running",type:"spinner"},waiting:{className:a.waiting,label:"Waiting for response",type:"dot"},error:{className:a.error,label:"Error",type:"dot"}},n={idle:{className:a.idle,label:"Idle - No active session",type:"dot"},ready:{className:a.ready,label:"Ready - Waiting for input",type:"dot"},running:{className:a.spinner,label:"Running - Processing",type:"spinner"},waiting:{className:a.waiting,label:"Waiting - User input required",type:"dot"},error:{className:a.error,label:"Error",type:"dot"}}},22202:(e,t,s)=>{s.d(t,{k:()=>a});let a={DROPDOWN:10,SIDEBAR:30,MODAL:50,MAXIMIZED_EDITOR:55,TOAST:60,CONTEXT_MENU:70}},2982:(e,t,s)=>{s.d(t,{G:()=>r,d:()=>l});var a=s(17577);let r=768;function l(e={}){let{breakpoint:t=r}=e,[s,l]=(0,a.useState)(!1);return s}},91515:(e,t,s)=>{s.d(t,{v:()=>r});let a=/\x1b\[[0-9;]*[a-zA-Z]|\x1b\][^\x07]*\x07|\[[0-9;]*m/g;async function r(e){if(!e||0===e.trim().length)return;let t=e.replace(a,"");await navigator.clipboard.writeText(t)}},41593:(e,t,s)=>{s.d(t,{G:()=>n});var a=s(27808),r=s(18811);let l={en:r._,ja:a.ja};function n(e){return l[e]??r._}},51223:(e,t,s)=>{function a(e,t){let s=null;return(...a)=>{s&&clearTimeout(s),s=setTimeout(()=>{e(...a),s=null},t)}}function r(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function l(e){let t=new Set;for(let s of e){t.add(s);let e=s.split("/"),a="";for(let s=0;s<e.length-1;s++)a=a?`${a}/${e[s]}`:e[s],t.add(a)}return t}function n(e,t=30){return e.length<=t?e:`${e.substring(0,t-3)}...`}function i(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}s.d(t,{Ds:()=>a,Ps:()=>l,Xv:()=>i,aS:()=>n,hr:()=>r})},18421:(e,t,s)=>{function a(e){return e?e.isWaitingForResponse?"waiting":e.isProcessing?"running":e.isRunning?"ready":"idle":"idle"}function r(e){let t=!!e.lastAssistantMessageAt&&(!e.lastViewedAt||new Date(e.lastAssistantMessageAt)>new Date(e.lastViewedAt));return{id:e.id,name:e.name,repositoryName:e.repositoryName,status:"idle",hasUnread:t,lastActivity:e.updatedAt,description:e.description,cliStatus:{claude:a(e.sessionStatusByCli?.claude),codex:a(e.sessionStatusByCli?.codex)}}}s.d(t,{He:()=>a,I_:()=>r})},63601:(e,t,s)=>{s.r(t),s.d(t,{default:()=>r});var a=s(66621);let r=e=>[{type:"image/png",sizes:"180x180",url:(0,a.fillMetadataSegment)(".",e.params,"apple-icon.png")+"?31a89e65aa4ac65b"}]},71150:(e,t,s)=>{s.r(t),s.d(t,{default:()=>r});var a=s(66621);let r=e=>[{type:"image/png",sizes:"32x32",url:(0,a.fillMetadataSegment)(".",e.params,"icon.png")+"?32d9127ba30ee286"}]}};