@aoagents/ao-web 0.2.5 → 0.3.0

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 (264) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-build-manifest.json +160 -94
  3. package/.next/app-path-routes-manifest.json +17 -10
  4. package/.next/build-manifest.json +5 -5
  5. package/.next/prerender-manifest.json +26 -26
  6. package/.next/react-loadable-manifest.json +12 -12
  7. package/.next/required-server-files.json +5 -3
  8. package/.next/routes-manifest.json +33 -0
  9. package/.next/server/app/_not-found/page.js +2 -2
  10. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  11. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  12. package/.next/server/app/_not-found.html +1 -1
  13. package/.next/server/app/_not-found.rsc +2 -2
  14. package/.next/server/app/api/backlog/route.js +1 -1
  15. package/.next/server/app/api/backlog/route.js.nft.json +1 -1
  16. package/.next/server/app/api/backlog/route_client-reference-manifest.js +1 -1
  17. package/.next/server/app/api/browse-directory/route.js +1 -0
  18. package/.next/server/app/api/browse-directory/route.js.nft.json +1 -0
  19. package/.next/server/app/api/browse-directory/route_client-reference-manifest.js +1 -0
  20. package/.next/server/app/api/events/route.js +3 -3
  21. package/.next/server/app/api/events/route.js.nft.json +1 -1
  22. package/.next/server/app/api/events/route_client-reference-manifest.js +1 -1
  23. package/.next/server/app/api/filesystem/browse/route.js +1 -0
  24. package/.next/server/app/api/filesystem/browse/route.js.nft.json +1 -0
  25. package/.next/server/app/api/filesystem/browse/route_client-reference-manifest.js +1 -0
  26. package/.next/server/app/api/issues/route.js +1 -1
  27. package/.next/server/app/api/issues/route.js.nft.json +1 -1
  28. package/.next/server/app/api/issues/route_client-reference-manifest.js +1 -1
  29. package/.next/server/app/api/observability/route.js +1 -1
  30. package/.next/server/app/api/observability/route.js.nft.json +1 -1
  31. package/.next/server/app/api/observability/route_client-reference-manifest.js +1 -1
  32. package/.next/server/app/api/orchestrators/route.js +1 -1
  33. package/.next/server/app/api/orchestrators/route.js.nft.json +1 -1
  34. package/.next/server/app/api/orchestrators/route_client-reference-manifest.js +1 -1
  35. package/.next/server/app/api/projects/[id]/route.js +1 -0
  36. package/.next/server/app/api/projects/[id]/route.js.nft.json +1 -0
  37. package/.next/server/app/api/projects/[id]/route_client-reference-manifest.js +1 -0
  38. package/.next/server/app/api/projects/reload/route.js +1 -0
  39. package/.next/server/app/api/projects/reload/route.js.nft.json +1 -0
  40. package/.next/server/app/api/projects/reload/route_client-reference-manifest.js +1 -0
  41. package/.next/server/app/api/projects/route.js +1 -1
  42. package/.next/server/app/api/projects/route.js.nft.json +1 -1
  43. package/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
  44. package/.next/server/app/api/prs/[id]/merge/route.js +1 -1
  45. package/.next/server/app/api/prs/[id]/merge/route.js.nft.json +1 -1
  46. package/.next/server/app/api/prs/[id]/merge/route_client-reference-manifest.js +1 -1
  47. package/.next/server/app/api/runtime/terminal/route.js +1 -1
  48. package/.next/server/app/api/runtime/terminal/route.js.nft.json +1 -1
  49. package/.next/server/app/api/runtime/terminal/route_client-reference-manifest.js +1 -1
  50. package/.next/server/app/api/sessions/[id]/kill/route.js +1 -1
  51. package/.next/server/app/api/sessions/[id]/kill/route.js.nft.json +1 -1
  52. package/.next/server/app/api/sessions/[id]/kill/route_client-reference-manifest.js +1 -1
  53. package/.next/server/app/api/sessions/[id]/message/route.js +1 -1
  54. package/.next/server/app/api/sessions/[id]/message/route.js.nft.json +1 -1
  55. package/.next/server/app/api/sessions/[id]/message/route_client-reference-manifest.js +1 -1
  56. package/.next/server/app/api/sessions/[id]/remap/route.js +1 -1
  57. package/.next/server/app/api/sessions/[id]/remap/route.js.nft.json +1 -1
  58. package/.next/server/app/api/sessions/[id]/remap/route_client-reference-manifest.js +1 -1
  59. package/.next/server/app/api/sessions/[id]/restore/route.js +1 -1
  60. package/.next/server/app/api/sessions/[id]/restore/route.js.nft.json +1 -1
  61. package/.next/server/app/api/sessions/[id]/restore/route_client-reference-manifest.js +1 -1
  62. package/.next/server/app/api/sessions/[id]/route.js +1 -1
  63. package/.next/server/app/api/sessions/[id]/route.js.nft.json +1 -1
  64. package/.next/server/app/api/sessions/[id]/route_client-reference-manifest.js +1 -1
  65. package/.next/server/app/api/sessions/[id]/send/route.js +1 -1
  66. package/.next/server/app/api/sessions/[id]/send/route.js.nft.json +1 -1
  67. package/.next/server/app/api/sessions/[id]/send/route_client-reference-manifest.js +1 -1
  68. package/.next/server/app/api/sessions/patches/route.js +1 -1
  69. package/.next/server/app/api/sessions/patches/route.js.nft.json +1 -1
  70. package/.next/server/app/api/sessions/patches/route_client-reference-manifest.js +1 -1
  71. package/.next/server/app/api/sessions/route.js +1 -1
  72. package/.next/server/app/api/sessions/route.js.nft.json +1 -1
  73. package/.next/server/app/api/sessions/route_client-reference-manifest.js +1 -1
  74. package/.next/server/app/api/setup-labels/route.js +1 -1
  75. package/.next/server/app/api/setup-labels/route.js.nft.json +1 -1
  76. package/.next/server/app/api/setup-labels/route_client-reference-manifest.js +1 -1
  77. package/.next/server/app/api/spawn/route.js +1 -1
  78. package/.next/server/app/api/spawn/route.js.nft.json +1 -1
  79. package/.next/server/app/api/spawn/route_client-reference-manifest.js +1 -1
  80. package/.next/server/app/api/verify/route.js +1 -1
  81. package/.next/server/app/api/verify/route.js.nft.json +1 -1
  82. package/.next/server/app/api/verify/route_client-reference-manifest.js +1 -1
  83. package/.next/server/app/api/webhooks/[...slug]/route.js +1 -1
  84. package/.next/server/app/api/webhooks/[...slug]/route.js.nft.json +1 -1
  85. package/.next/server/app/api/webhooks/[...slug]/route_client-reference-manifest.js +1 -1
  86. package/.next/server/app/apple-icon/route.js +1 -1
  87. package/.next/server/app/apple-icon/route.js.nft.json +1 -1
  88. package/.next/server/app/apple-icon/route_client-reference-manifest.js +1 -1
  89. package/.next/server/app/dev/terminal-test/page.js +2 -2
  90. package/.next/server/app/dev/terminal-test/page.js.nft.json +1 -1
  91. package/.next/server/app/dev/terminal-test/page_client-reference-manifest.js +1 -1
  92. package/.next/server/app/dev/terminal-test.html +1 -1
  93. package/.next/server/app/dev/terminal-test.rsc +3 -3
  94. package/.next/server/app/icon/route.js +1 -1
  95. package/.next/server/app/icon/route.js.nft.json +1 -1
  96. package/.next/server/app/icon/route_client-reference-manifest.js +1 -1
  97. package/.next/server/app/icon-192/route.js +1 -1
  98. package/.next/server/app/icon-192/route.js.nft.json +1 -1
  99. package/.next/server/app/icon-192/route_client-reference-manifest.js +1 -1
  100. package/.next/server/app/icon-512/route.js +1 -1
  101. package/.next/server/app/icon-512/route.js.nft.json +1 -1
  102. package/.next/server/app/icon-512/route_client-reference-manifest.js +1 -1
  103. package/.next/server/app/manifest.webmanifest/route.js +2 -2
  104. package/.next/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  105. package/.next/server/app/manifest.webmanifest/route_client-reference-manifest.js +1 -1
  106. package/.next/server/app/orchestrators/page.js +2 -2
  107. package/.next/server/app/orchestrators/page.js.nft.json +1 -1
  108. package/.next/server/app/orchestrators/page_client-reference-manifest.js +1 -1
  109. package/.next/server/app/page.js +2 -2
  110. package/.next/server/app/page.js.nft.json +1 -1
  111. package/.next/server/app/page_client-reference-manifest.js +1 -1
  112. package/.next/server/app/projects/[projectId]/page.js +2 -0
  113. package/.next/server/app/projects/[projectId]/page.js.nft.json +1 -0
  114. package/.next/server/app/projects/[projectId]/page_client-reference-manifest.js +1 -0
  115. package/.next/server/app/projects/[projectId]/sessions/[id]/page.js +2 -0
  116. package/.next/server/app/projects/[projectId]/sessions/[id]/page.js.nft.json +1 -0
  117. package/.next/server/app/projects/[projectId]/sessions/[id]/page_client-reference-manifest.js +1 -0
  118. package/.next/server/app/projects/[projectId]/settings/page.js +2 -0
  119. package/.next/server/app/projects/[projectId]/settings/page.js.nft.json +1 -0
  120. package/.next/server/app/projects/[projectId]/settings/page_client-reference-manifest.js +1 -0
  121. package/.next/server/app/prs/page.js +2 -2
  122. package/.next/server/app/prs/page.js.nft.json +1 -1
  123. package/.next/server/app/prs/page_client-reference-manifest.js +1 -1
  124. package/.next/server/app/sessions/[id]/page.js +2 -12
  125. package/.next/server/app/sessions/[id]/page.js.nft.json +1 -1
  126. package/.next/server/app/sessions/[id]/page_client-reference-manifest.js +1 -1
  127. package/.next/server/app/test-direct/page.js +2 -2
  128. package/.next/server/app/test-direct/page.js.nft.json +1 -1
  129. package/.next/server/app/test-direct/page_client-reference-manifest.js +1 -1
  130. package/.next/server/app/test-direct.html +1 -1
  131. package/.next/server/app/test-direct.rsc +3 -3
  132. package/.next/server/app-paths-manifest.json +17 -10
  133. package/.next/server/chunks/1172.js +1 -0
  134. package/.next/server/chunks/1271.js +1 -0
  135. package/.next/server/chunks/2106.js +1 -0
  136. package/.next/server/chunks/252.js +11 -0
  137. package/.next/server/chunks/2810.js +1 -0
  138. package/.next/server/chunks/3602.js +382 -0
  139. package/.next/server/chunks/3667.js +277 -0
  140. package/.next/server/chunks/3714.js +1 -0
  141. package/.next/server/chunks/4520.js +1 -0
  142. package/.next/server/chunks/6086.js +25 -0
  143. package/.next/server/chunks/6172.js +9 -0
  144. package/.next/server/chunks/8367.js +3 -0
  145. package/.next/server/chunks/8386.js +1 -0
  146. package/.next/server/chunks/{803.js → 8803.js} +1 -1
  147. package/.next/server/chunks/{561.js → 9561.js} +1 -1
  148. package/.next/server/middleware-build-manifest.js +1 -1
  149. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  150. package/.next/server/next-font-manifest.js +1 -1
  151. package/.next/server/next-font-manifest.json +1 -1
  152. package/.next/server/pages/404.html +1 -1
  153. package/.next/server/pages/500.html +1 -1
  154. package/.next/server/pages/_document.js +1 -1
  155. package/.next/server/pages/_document.js.nft.json +1 -1
  156. package/.next/server/pages/_error.js +2 -2
  157. package/.next/server/pages/_error.js.nft.json +1 -1
  158. package/.next/server/server-reference-manifest.json +1 -1
  159. package/.next/server/webpack-runtime.js +1 -1
  160. package/.next/static/chunks/1d2d5650.1ef8611b5325bd83.js +18 -0
  161. package/.next/static/chunks/3697.4d6d86c5f0caf73e.js +1 -0
  162. package/.next/static/chunks/4465-aaba60a6355de914.js +1 -0
  163. package/.next/static/chunks/6078.47ce88bee96cfaee.js +1 -0
  164. package/.next/static/chunks/6607-405ce4d15e595f4a.js +1 -0
  165. package/.next/static/chunks/7008-71ebb186f0549f41.js +1 -0
  166. package/.next/static/chunks/9331-fcdd652218ac6f68.js +1 -0
  167. package/.next/static/chunks/app/_not-found/page-e2dea9178b4af8db.js +1 -0
  168. package/.next/static/chunks/app/api/backlog/route-e2dea9178b4af8db.js +1 -0
  169. package/.next/static/chunks/app/api/browse-directory/route-e2dea9178b4af8db.js +1 -0
  170. package/.next/static/chunks/app/api/events/route-e2dea9178b4af8db.js +1 -0
  171. package/.next/static/chunks/app/api/filesystem/browse/route-e2dea9178b4af8db.js +1 -0
  172. package/.next/static/chunks/app/api/issues/route-e2dea9178b4af8db.js +1 -0
  173. package/.next/static/chunks/app/api/observability/route-e2dea9178b4af8db.js +1 -0
  174. package/.next/static/chunks/app/api/orchestrators/route-e2dea9178b4af8db.js +1 -0
  175. package/.next/static/chunks/app/api/projects/[id]/route-e2dea9178b4af8db.js +1 -0
  176. package/.next/static/chunks/app/api/projects/reload/route-e2dea9178b4af8db.js +1 -0
  177. package/.next/static/chunks/app/api/projects/route-e2dea9178b4af8db.js +1 -0
  178. package/.next/static/chunks/app/api/prs/[id]/merge/route-e2dea9178b4af8db.js +1 -0
  179. package/.next/static/chunks/app/api/runtime/terminal/route-e2dea9178b4af8db.js +1 -0
  180. package/.next/static/chunks/app/api/sessions/[id]/kill/route-e2dea9178b4af8db.js +1 -0
  181. package/.next/static/chunks/app/api/sessions/[id]/message/route-e2dea9178b4af8db.js +1 -0
  182. package/.next/static/chunks/app/api/sessions/[id]/remap/route-e2dea9178b4af8db.js +1 -0
  183. package/.next/static/chunks/app/api/sessions/[id]/restore/route-e2dea9178b4af8db.js +1 -0
  184. package/.next/static/chunks/app/api/sessions/[id]/route-e2dea9178b4af8db.js +1 -0
  185. package/.next/static/chunks/app/api/sessions/[id]/send/route-e2dea9178b4af8db.js +1 -0
  186. package/.next/static/chunks/app/api/sessions/patches/route-e2dea9178b4af8db.js +1 -0
  187. package/.next/static/chunks/app/api/sessions/route-e2dea9178b4af8db.js +1 -0
  188. package/.next/static/chunks/app/api/setup-labels/route-e2dea9178b4af8db.js +1 -0
  189. package/.next/static/chunks/app/api/spawn/route-e2dea9178b4af8db.js +1 -0
  190. package/.next/static/chunks/app/api/verify/route-e2dea9178b4af8db.js +1 -0
  191. package/.next/static/chunks/app/api/webhooks/[...slug]/route-e2dea9178b4af8db.js +1 -0
  192. package/.next/static/chunks/app/apple-icon/route-e2dea9178b4af8db.js +1 -0
  193. package/.next/static/chunks/app/dev/terminal-test/{page-4912fa9e6459f124.js → page-5765f0465db56fed.js} +1 -1
  194. package/.next/static/chunks/app/icon/route-e2dea9178b4af8db.js +1 -0
  195. package/.next/static/chunks/app/icon-192/route-e2dea9178b4af8db.js +1 -0
  196. package/.next/static/chunks/app/icon-512/route-e2dea9178b4af8db.js +1 -0
  197. package/.next/static/chunks/app/loading-e2dea9178b4af8db.js +1 -0
  198. package/.next/static/chunks/app/manifest.webmanifest/route-e2dea9178b4af8db.js +1 -0
  199. package/.next/static/chunks/app/orchestrators/page-4c190484788aaaa3.js +1 -0
  200. package/.next/static/chunks/app/page-d3b83ad5f09b6ec7.js +1 -0
  201. package/.next/static/chunks/app/projects/[projectId]/loading-e2dea9178b4af8db.js +1 -0
  202. package/.next/static/chunks/app/projects/[projectId]/page-9f3dfbea006747cf.js +1 -0
  203. package/.next/static/chunks/app/projects/[projectId]/sessions/[id]/page-a7090a06948f9a6b.js +1 -0
  204. package/.next/static/chunks/app/projects/[projectId]/settings/page-219df6dcbc6d1107.js +1 -0
  205. package/.next/static/chunks/app/prs/page-a285e930235a23af.js +1 -0
  206. package/.next/static/chunks/app/sessions/[id]/loading-e2dea9178b4af8db.js +1 -0
  207. package/.next/static/chunks/app/sessions/[id]/page-98f398b822092218.js +1 -0
  208. package/.next/static/chunks/app/test-direct/{page-1fd63edb9a9ca8be.js → page-f9bff7d7b4dfe728.js} +1 -1
  209. package/.next/static/chunks/{webpack-ab6c08c78ffc8113.js → webpack-d4ff5ed5e153ca3e.js} +1 -1
  210. package/.next/static/css/577ea7f5ad4f0576.css +1 -0
  211. package/.next/static/css/659eccb5db697b76.css +1 -0
  212. package/.next/static/q6yh3n8jgvyI9JIbexzuH/_buildManifest.js +1 -0
  213. package/next.config.js +5 -1
  214. package/package.json +17 -14
  215. package/.next/server/chunks/100.js +0 -1
  216. package/.next/server/chunks/106.js +0 -1
  217. package/.next/server/chunks/172.js +0 -9
  218. package/.next/server/chunks/180.js +0 -25
  219. package/.next/server/chunks/333.js +0 -1
  220. package/.next/server/chunks/367.js +0 -3
  221. package/.next/server/chunks/627.js +0 -408
  222. package/.next/server/chunks/886.js +0 -384
  223. package/.next/server/chunks/907.js +0 -1
  224. package/.next/static/OyzSw2fQpoJHXyoBWoZ2X/_buildManifest.js +0 -1
  225. package/.next/static/chunks/6923-ef8434dfec6f2a3c.js +0 -1
  226. package/.next/static/chunks/7097.fc904e5f313c4994.js +0 -1
  227. package/.next/static/chunks/8785-6b4b3ff260617997.js +0 -1
  228. package/.next/static/chunks/9478.656c9c263bc55893.js +0 -1
  229. package/.next/static/chunks/app/_not-found/page-019391920005654f.js +0 -1
  230. package/.next/static/chunks/app/api/backlog/route-019391920005654f.js +0 -1
  231. package/.next/static/chunks/app/api/events/route-019391920005654f.js +0 -1
  232. package/.next/static/chunks/app/api/issues/route-019391920005654f.js +0 -1
  233. package/.next/static/chunks/app/api/observability/route-019391920005654f.js +0 -1
  234. package/.next/static/chunks/app/api/orchestrators/route-019391920005654f.js +0 -1
  235. package/.next/static/chunks/app/api/projects/route-019391920005654f.js +0 -1
  236. package/.next/static/chunks/app/api/prs/[id]/merge/route-019391920005654f.js +0 -1
  237. package/.next/static/chunks/app/api/runtime/terminal/route-019391920005654f.js +0 -1
  238. package/.next/static/chunks/app/api/sessions/[id]/kill/route-019391920005654f.js +0 -1
  239. package/.next/static/chunks/app/api/sessions/[id]/message/route-019391920005654f.js +0 -1
  240. package/.next/static/chunks/app/api/sessions/[id]/remap/route-019391920005654f.js +0 -1
  241. package/.next/static/chunks/app/api/sessions/[id]/restore/route-019391920005654f.js +0 -1
  242. package/.next/static/chunks/app/api/sessions/[id]/route-019391920005654f.js +0 -1
  243. package/.next/static/chunks/app/api/sessions/[id]/send/route-019391920005654f.js +0 -1
  244. package/.next/static/chunks/app/api/sessions/patches/route-019391920005654f.js +0 -1
  245. package/.next/static/chunks/app/api/sessions/route-019391920005654f.js +0 -1
  246. package/.next/static/chunks/app/api/setup-labels/route-019391920005654f.js +0 -1
  247. package/.next/static/chunks/app/api/spawn/route-019391920005654f.js +0 -1
  248. package/.next/static/chunks/app/api/verify/route-019391920005654f.js +0 -1
  249. package/.next/static/chunks/app/api/webhooks/[...slug]/route-019391920005654f.js +0 -1
  250. package/.next/static/chunks/app/apple-icon/route-019391920005654f.js +0 -1
  251. package/.next/static/chunks/app/icon/route-019391920005654f.js +0 -1
  252. package/.next/static/chunks/app/icon-192/route-019391920005654f.js +0 -1
  253. package/.next/static/chunks/app/icon-512/route-019391920005654f.js +0 -1
  254. package/.next/static/chunks/app/loading-019391920005654f.js +0 -1
  255. package/.next/static/chunks/app/manifest.webmanifest/route-019391920005654f.js +0 -1
  256. package/.next/static/chunks/app/orchestrators/page-4da04720a09483d2.js +0 -1
  257. package/.next/static/chunks/app/page-abf3e3c98cac072f.js +0 -1
  258. package/.next/static/chunks/app/prs/page-46455c406183ffbf.js +0 -1
  259. package/.next/static/chunks/app/sessions/[id]/loading-019391920005654f.js +0 -1
  260. package/.next/static/chunks/app/sessions/[id]/page-7eb67fd32f39b15f.js +0 -1
  261. package/.next/static/chunks/df4ed4d4.b6997d8b8ce9d79b.js +0 -3
  262. package/.next/static/css/6ef2fa08dd043252.css +0 -1
  263. package/.next/static/css/a5398483e6b75ad3.css +0 -1
  264. /package/.next/static/{OyzSw2fQpoJHXyoBWoZ2X → q6yh3n8jgvyI9JIbexzuH}/_ssgManifest.js +0 -0
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7097,9478],{1715:()=>{},2286:(e,t,r)=>{"use strict";r.d(t,{D:()=>d,N:()=>u});var n=r(6749),o=(e,t,r,n,o,a,s,l)=>{let i=document.documentElement,c=["light","dark"];function d(t){var r;(Array.isArray(e)?e:[e]).forEach(e=>{let r="class"===e,n=r&&a?o.map(e=>a[e]||e):o;r?(i.classList.remove(...n),i.classList.add(a&&a[t]?a[t]:t)):i.setAttribute(e,t)}),r=t,l&&c.includes(r)&&(i.style.colorScheme=r)}if(n)d(n);else try{let e=localStorage.getItem(t)||r,n=s&&"system"===e?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e;d(n)}catch(e){}},a=["light","dark"],s="(prefers-color-scheme: dark)",l="undefined"==typeof window,i=n.createContext(void 0),c={setTheme:e=>{},themes:[]},d=()=>{var e;return null!=(e=n.useContext(i))?e:c},u=e=>n.useContext(i)?n.createElement(n.Fragment,null,e.children):n.createElement(h,{...e}),m=["light","dark"],h=e=>{let{forcedTheme:t,disableTransitionOnChange:r=!1,enableSystem:o=!0,enableColorScheme:l=!0,storageKey:c="theme",themes:d=m,defaultTheme:u=o?"system":"light",attribute:h="data-theme",value:x,children:v,nonce:y,scriptProps:w}=e,[k,S]=n.useState(()=>p(c,u)),[C,T]=n.useState(()=>"system"===k?b():k),E=x?Object.values(x):d,N=n.useCallback(e=>{let t=e;if(!t)return;"system"===e&&o&&(t=b());let n=x?x[t]:t,s=r?g(y):null,i=document.documentElement,c=e=>{"class"===e?(i.classList.remove(...E),n&&i.classList.add(n)):e.startsWith("data-")&&(n?i.setAttribute(e,n):i.removeAttribute(e))};if(Array.isArray(h)?h.forEach(c):c(h),l){let e=a.includes(u)?u:null,r=a.includes(t)?t:e;i.style.colorScheme=r}null==s||s()},[y]),j=n.useCallback(e=>{let t="function"==typeof e?e(k):e;S(t);try{localStorage.setItem(c,t)}catch(e){}},[k]),M=n.useCallback(e=>{T(b(e)),"system"===k&&o&&!t&&N("system")},[k,t]);n.useEffect(()=>{let e=window.matchMedia(s);return e.addListener(M),M(e),()=>e.removeListener(M)},[M]),n.useEffect(()=>{let e=e=>{e.key===c&&(e.newValue?S(e.newValue):j(u))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[j]),n.useEffect(()=>{N(null!=t?t:k)},[t,k]);let P=n.useMemo(()=>({theme:k,setTheme:j,forcedTheme:t,resolvedTheme:"system"===k?C:k,themes:o?[...d,"system"]:d,systemTheme:o?C:void 0}),[k,j,t,C,o,d]);return n.createElement(i.Provider,{value:P},n.createElement(f,{forcedTheme:t,storageKey:c,attribute:h,enableSystem:o,enableColorScheme:l,defaultTheme:u,value:x,themes:d,nonce:y,scriptProps:w}),v)},f=n.memo(e=>{let{forcedTheme:t,storageKey:r,attribute:a,enableSystem:s,enableColorScheme:l,defaultTheme:i,value:c,themes:d,nonce:u,scriptProps:m}=e,h=JSON.stringify([a,r,i,t,d,c,s,l]).slice(1,-1);return n.createElement("script",{...m,suppressHydrationWarning:!0,nonce:"undefined"==typeof window?u:"",dangerouslySetInnerHTML:{__html:"(".concat(o.toString(),")(").concat(h,")")}})}),p=(e,t)=>{let r;if(!l){try{r=localStorage.getItem(e)||void 0}catch(e){}return r||t}},g=e=>{let t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.appendChild(document.createTextNode("*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(t),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(t)},1)}},b=e=>(e||(e=window.matchMedia(s)),e.matches?"dark":"light")},4901:(e,t,r)=>{"use strict";function n(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.filter(Boolean).join(" ")}r.d(t,{cn:()=>n})},5184:(e,t,r)=>{"use strict";r.d(t,{Ug:()=>l,eT:()=>i,i2:()=>c});var n=r(3817),o=r(6749),a=r(1806);let s=o.createContext(void 0);function l(){let e=o.useContext(s);if(!e)throw Error("useMux() must be used within <MuxProvider>");return e}function i(){return o.useContext(s)}function c(e){let{children:t}=e,r=(0,o.useRef)(null),l=(0,o.useRef)(new Map),i=(0,o.useRef)(new Set),[c,d]=(0,o.useState)("connecting"),[u,m]=(0,o.useState)([]),h=(0,o.useRef)(0),f=(0,o.useRef)(null),p=(0,o.useRef)({}),g=(0,o.useRef)(!1),b=(0,o.useCallback)(()=>{if(!r.current){d("connecting");try{let e=function(e){var t,r,n;let o=window.location,s="https:"===o.protocol?"wss:":"ws:",l=null!=(t=e.proxyWsPath)?t:a.env.NEXT_PUBLIC_TERMINAL_WS_PATH;if(l){let e=l.replace(/\/ws\/?$/,"");return"".concat(s,"//").concat(o.host).concat(e,"/mux")}if(""===o.port||"443"===o.port||"80"===o.port)return"".concat(s,"//").concat(o.hostname,"/ao-terminal-mux");let i=null!=(n=null!=(r=e.directTerminalPort)?r:a.env.NEXT_PUBLIC_DIRECT_TERMINAL_PORT)?n:"14801";return"".concat(s,"//").concat(o.hostname,":").concat(i,"/mux")}(p.current);console.log("[MuxProvider] Connecting to",e);let t=new WebSocket(e);r.current=t,t.addEventListener("open",()=>{if(g.current)return void t.close();for(let e of(console.log("[MuxProvider] Connected"),d("connected"),h.current=0,i.current)){let r={ch:"terminal",id:e,type:"open"};t.send(JSON.stringify(r))}t.send(JSON.stringify({ch:"subscribe",topics:["sessions"]}))}),t.addEventListener("message",e=>{try{let t=JSON.parse(e.data);if("terminal"===t.ch)if("data"===t.type){let e=l.current.get(t.id);if(e)for(let r of e)r(t.data)}else if("opened"===t.type)i.current.add(t.id);else if("exited"===t.type){i.current.delete(t.id);let e=l.current.get(t.id);if(e){let r="\r\n\x1b[31m[Terminal exited with code ".concat(t.code,"]\x1b[0m\r\n");for(let t of e)t(r)}}else"error"===t.type&&console.error("[MuxProvider] Terminal error for ".concat(t.id,":"),t.message);else"sessions"===t.ch&&"snapshot"===t.type&&m(t.sessions)}catch(e){console.error("[MuxProvider] Error processing message:",e)}}),t.addEventListener("error",e=>{console.error("[MuxProvider] WebSocket error:",e)}),t.addEventListener("close",()=>{if(console.log("[MuxProvider] Disconnected"),r.current===t&&(r.current=null),g.current)return;let e=Math.min(1e3*Math.pow(2,h.current),3e4);h.current+=1,d("reconnecting"),f.current=setTimeout(()=>{console.log("[MuxProvider] Reconnecting (attempt ".concat(h.current,")...")),b()},e)})}catch(e){console.error("[MuxProvider] Failed to create WebSocket:",e),d("disconnected")}}},[]);(0,o.useEffect)(()=>{g.current=!1;let e=!1;return(async()=>{try{let e=await fetch("/api/runtime/terminal");if(e.ok){let t=await e.json();p.current={directTerminalPort:function(e){if("string"!=typeof e&&"number"!=typeof e)return;let t=Number.parseInt(String(e),10);if(Number.isInteger(t)&&!(t<=0)&&!(t>65535))return String(t)}(t.directTerminalPort),proxyWsPath:function(e){if("string"!=typeof e)return;let t=e.trim();if(t.startsWith("/"))return t}(t.proxyWsPath)}}}catch(e){}e||b()})(),()=>{var t;e=!0,g.current=!0,f.current&&clearTimeout(f.current),null==(t=r.current)||t.close()}},[b]);let x=(0,o.useCallback)((e,t)=>{var n;let o=l.current.get(e);return o||(o=new Set,l.current.set(e,o)),o.add(t),i.current.has(e)||(null==(n=r.current)?void 0:n.readyState)!==WebSocket.OPEN||r.current.send(JSON.stringify({ch:"terminal",id:e,type:"open"})),()=>{let r=l.current.get(e);r&&(r.delete(t),0===r.size&&l.current.delete(e))}},[]),v=(0,o.useCallback)((e,t)=>{var n;(null==(n=r.current)?void 0:n.readyState)===WebSocket.OPEN&&r.current.send(JSON.stringify({ch:"terminal",id:e,type:"data",data:t}))},[]),y=(0,o.useCallback)(e=>{var t;i.current.add(e),(null==(t=r.current)?void 0:t.readyState)===WebSocket.OPEN&&r.current.send(JSON.stringify({ch:"terminal",id:e,type:"open"}))},[]),w=(0,o.useCallback)(e=>{var t;i.current.delete(e),(null==(t=r.current)?void 0:t.readyState)===WebSocket.OPEN&&r.current.send(JSON.stringify({ch:"terminal",id:e,type:"close"}))},[]),k=(0,o.useCallback)((e,t,n)=>{var o;(null==(o=r.current)?void 0:o.readyState)===WebSocket.OPEN&&r.current.send(JSON.stringify({ch:"terminal",id:e,type:"resize",cols:t,rows:n}))},[]),S=(0,o.useMemo)(()=>({subscribeTerminal:x,writeTerminal:v,openTerminal:y,closeTerminal:w,resizeTerminal:k,status:c,sessions:u}),[x,v,y,w,k,c,u]);return(0,n.jsx)(s.Provider,{value:S,children:t})}},7097:(e,t,r)=>{"use strict";r.r(t),r.d(t,{DirectTerminal:()=>d,buildTerminalThemes:()=>c});var n=r(3817),o=r(6749),a=r(7594),s=r(2286),l=r(4901),i=r(5184);function c(e){let t="#5b7ef8",r="rgba(91, 126, 248, 0.30)",n="rgba(91, 126, 248, 0.25)";return{dark:{background:"#0a0a0f",foreground:"#d4d4d8",cursor:t,cursorAccent:"#0a0a0f",selectionBackground:r,selectionInactiveBackground:"rgba(128, 128, 128, 0.2)",black:"#1a1a24",red:"#ef4444",green:"#22c55e",yellow:"#f59e0b",blue:"#5b7ef8",magenta:"#a371f7",cyan:"#22d3ee",white:"#d4d4d8",brightBlack:"#50506a",brightRed:"#f87171",brightGreen:"#4ade80",brightYellow:"#fbbf24",brightBlue:"#7b9cfb",brightMagenta:"#c084fc",brightCyan:"#67e8f9",brightWhite:"#eeeef5"},light:{background:"#fafafa",foreground:"#24292f",cursor:t,cursorAccent:"#fafafa",selectionBackground:n,selectionInactiveBackground:"rgba(128, 128, 128, 0.15)",black:"#24292f",red:"#b42318",green:"#1f7a3d",yellow:"#8a5a00",blue:"#175cd3",magenta:"#8e24aa",cyan:"#0b7285",white:"#4b5563",brightBlack:"#374151",brightRed:"#912018",brightGreen:"#176639",brightYellow:"#6f4a00",brightBlue:"#1d4ed8",brightMagenta:"#7b1fa2",brightCyan:"#155e75",brightWhite:"#374151"}}}function d(e){let{sessionId:t,startFullscreen:d=!1,variant:u="agent",appearance:m="theme",height:h="max(440px, calc(100dvh - 440px))",isOpenCodeSession:f=!1,reloadCommand:p,chromeless:g=!1}=e,b=(0,a.useRouter)(),x=(0,a.usePathname)(),v=(0,a.useSearchParams)(),{resolvedTheme:y}=(0,s.D)(),w=(0,o.useMemo)(()=>c(u),[u]),{subscribeTerminal:k,writeTerminal:S,resizeTerminal:C,openTerminal:T,closeTerminal:E,status:N}=(0,i.Ug)(),j=(0,o.useRef)(null),M=(0,o.useRef)(null),P=(0,o.useRef)(null),R=(0,o.useRef)(N);R.current=N;let[O,A]=(0,o.useState)(d),[W,L]=(0,o.useState)(null),[_,B]=(0,o.useState)(!1),[F,I]=(0,o.useState)(null);async function D(){if(f&&!_){I(null),B(!0);try{let e=p;if(!e){let r=await fetch("/api/sessions/".concat(encodeURIComponent(t),"/remap"),{method:"POST"});if(!r.ok)throw Error("Failed to remap OpenCode session: ".concat(r.status));let n=await r.json();if("string"!=typeof n.opencodeSessionId||0===n.opencodeSessionId.length)throw Error("Missing OpenCode session id after remap");e="/exit\nopencode --session ".concat(n.opencodeSessionId,"\n")}let r=await fetch("/api/sessions/".concat(encodeURIComponent(t),"/send"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:e})});if(!r.ok)throw Error("Failed to send reload command: ".concat(r.status))}catch(e){I(e instanceof Error?e.message:"Failed to reload OpenCode session")}finally{B(!1)}}}(0,o.useEffect)(()=>{let e=new URLSearchParams(v.toString());O?e.set("fullscreen","true"):e.delete("fullscreen");let t=e.toString()?"".concat(x,"?").concat(e.toString()):x;b.replace(t,{scroll:!1})},[O,x,b,v]),(0,o.useEffect)(()=>{if(!j.current)return;let e=!0,n=null,o=null,a=null;return Promise.all([r.e(9524).then(r.t.bind(r,116,23)).then(e=>e.Terminal),r.e(2529).then(r.bind(r,2529)).then(e=>e.FitAddon),r.e(5491).then(r.bind(r,5491)).then(e=>e.WebLinksAddon),document.fonts.ready]).then(r=>{let[s,l,i]=r;if(!e||!j.current)return;let c="dark"===m||"light"!==y,d=new s({cursorBlink:!0,fontSize:13,fontFamily:'var(--font-jetbrains-mono), "JetBrains Mono", "SF Mono", Menlo, Monaco, "Courier New", monospace',theme:c?w.dark:w.light,minimumContrastRatio:c?1:7,scrollback:1e4,allowProposedApi:!0,fastScrollModifier:"alt",fastScrollSensitivity:3,scrollSensitivity:1}),u=new l;d.loadAddon(u),P.current=u;let h=new i;d.loadAddon(h),d.parser.registerCsiHandler({prefix:">",final:"q"},()=>(d.write("\x1bP>|XTerm(370)\x1b\\"),console.log("[DirectTerminal] Sent XDA response for clipboard support"),!0)),d.parser.registerOscHandler(52,e=>{let t=e.split(";");if(t.length<2)return!1;let r=t[t.length-1];try{var n;let e=atob(r),t=Uint8Array.from(e,e=>e.charCodeAt(0)),o=new TextDecoder().decode(t);null==(n=navigator.clipboard)||n.writeText(o).catch(()=>{})}catch(e){}return!0}),d.open(j.current),M.current=d,u.fit();let f=[],p=!1,g=null,b=0,x=()=>{g&&(clearTimeout(g),g=null),f.length>0&&(d.write(f.join("")),f.length=0,b=0)},v=d.onSelectionChange(()=>{d.hasSelection()?(p=!0,g||(g=setTimeout(()=>{p=!1,x()},5e3))):(p=!1,x())});d.attachCustomKeyEventHandler(e=>{if("keydown"!==e.type)return!0;if((e.metaKey&&!e.ctrlKey&&!e.altKey&&"KeyC"===e.code||e.ctrlKey&&e.shiftKey&&"KeyC"===e.code)&&d.hasSelection()){var t;return null==(t=navigator.clipboard)||t.writeText(d.getSelection()).catch(()=>{}),d.clearSelection(),!1}return!0}),T(t),a=k(t,e=>{p?(f.push(e),(b+=e.length)>1048576&&(p=!1,x())):d.write(e)});let N=()=>{u&&(u.fit(),C(t,d.cols,d.rows))};window.addEventListener("resize",N),o=d.onData(e=>{S(t,e)}),C(t,d.cols,d.rows),n=()=>{v.dispose(),g&&clearTimeout(g),window.removeEventListener("resize",N),null==o||o.dispose(),o=null,null==a||a(),E(t),d.dispose()}}).catch(e=>{console.error("[DirectTerminal] Failed to load xterm.js:",e),L("Failed to load terminal")}),()=>{e=!1,null==n||n()}},[m,t,u,y,w,k,S,C,T,E]),(0,o.useEffect)(()=>{if("connected"!==N)return;let e=P.current,r=M.current;e&&r&&(e.fit(),C(t,r.cols,r.rows))},[N,t,C]),(0,o.useEffect)(()=>{let e=M.current;if(!e)return;let t="dark"===m||"light"!==y;e.options.theme=t?w.dark:w.light,e.options.minimumContrastRatio=t?1:7},[m,y,w]),(0,o.useEffect)(()=>{let e=P.current,r=M.current,n=j.current;if(!e||!r||"connected"!==R.current||!n)return;let o=0,a=!1,s=0,l=-1,i=()=>{if(a)return;o++;let c=n.getBoundingClientRect().height,d=l>=0&&1>Math.abs(c-l);if(l=c,!d&&o<60){s=requestAnimationFrame(i);return}r.refresh(0,r.rows-1),e.fit(),r.refresh(0,r.rows-1),C(t,r.cols,r.rows)};s=requestAnimationFrame(i);let c=e=>{a||e.target===n.parentElement&&(o=0,l=-1,setTimeout(()=>{a||(s=requestAnimationFrame(i))},50))},d=n.parentElement;null==d||d.addEventListener("transitionend",c);let u=setTimeout(()=>{a||(o=0,l=-1,i())},300),m=setTimeout(()=>{a||(o=0,l=-1,i())},600);return()=>{a=!0,cancelAnimationFrame(s),null==d||d.removeEventListener("transitionend",c),clearTimeout(u),clearTimeout(m)}},[O,t,C]);let J="var(--color-accent)",K=W?"error":N,z="dark"===m||"light"!==y,H=(0,n.jsx)("button",{onClick:()=>A(!O),className:(0,l.cn)("flex items-center gap-1 px-2 py-0.5 text-[11px] text-[var(--color-text-tertiary)] transition-colors hover:bg-[var(--color-bg-subtle)] hover:text-[var(--color-text-primary)]",!f&&!g&&"ml-auto"),"aria-label":O?"exit fullscreen":"fullscreen",children:O?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("svg",{className:"h-3 w-3",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"M8 3v3a2 2 0 01-2 2H3m18 0h-3a2 2 0 01-2-2V3m0 18v-3a2 2 0 012-2h3M3 16h3a2 2 0 012 2v3"})}),"exit fullscreen"]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("svg",{className:"h-3 w-3",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"M8 3H5a2 2 0 00-2 2v3m18 0V5a2 2 0 00-2-2h-3m0 18h3a2 2 0 002-2v-3M3 16v3a2 2 0 002 2h3"})}),"fullscreen"]})});return(0,n.jsxs)("div",{className:(0,l.cn)("relative overflow-hidden border border-[var(--color-border-default)]",z?"bg-[#0a0a0f]":"bg-[#fafafa]",O&&"fixed inset-0 z-50 rounded-none border-0",g&&"border-0"),children:[g?null:(0,n.jsxs)("div",{className:"flex items-center gap-2 border-b border-[var(--color-border-subtle)] bg-[var(--color-bg-elevated)] px-3 py-2",children:[(0,n.jsx)("div",{className:(0,l.cn)("h-2 w-2 shrink-0 rounded-full","connected"===K?"bg-[var(--color-status-ready)]":"error"===K||"disconnected"===K?"bg-[var(--color-status-error)]":"bg-[var(--color-status-attention)] animate-[pulse_1.5s_ease-in-out_infinite]")}),(0,n.jsx)("span",{className:"font-[var(--font-mono)] text-[11px]",style:{color:J},children:t}),(0,n.jsx)("span",{className:(0,l.cn)("text-[10px] font-medium uppercase tracking-[0.06em]","connected"===K?"text-[var(--color-status-ready)]":"error"===K||"disconnected"===K?"text-[var(--color-status-error)]":"text-[var(--color-text-tertiary)]"),children:"connected"===K?"Connected":"error"===K?null!=W?W:"Error":"disconnected"===K?"Disconnected":"Connecting…"}),(0,n.jsx)("span",{className:"px-1.5 py-0.5 text-[9px] font-semibold uppercase tracking-[0.06em]",style:{color:J,background:"color-mix(in srgb, ".concat(J," 12%, transparent)")},children:"XDA"}),f?(0,n.jsx)("button",{onClick:D,disabled:_||"connected"!==N,title:"Restart OpenCode session (/exit then resume mapped session)","aria-label":"Restart OpenCode session",className:"ml-auto flex items-center gap-1 px-2 py-0.5 text-[11px] text-[var(--color-text-tertiary)] transition-colors hover:bg-[var(--color-bg-subtle)] hover:text-[var(--color-text-primary)] disabled:cursor-not-allowed disabled:opacity-70",children:_?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("svg",{className:"h-3 w-3 animate-spin",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"M12 3a9 9 0 109 9"})}),"restarting"]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("svg",{className:"h-3 w-3",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,n.jsx)("path",{d:"M21 12a9 9 0 11-2.64-6.36"}),(0,n.jsx)("path",{d:"M21 3v6h-6"})]}),"restart"]})}):null,F?(0,n.jsx)("span",{className:"max-w-[40ch] truncate text-[10px] font-medium text-[var(--color-status-error)]",title:F,children:F}):null,H]}),g?(0,n.jsxs)("div",{className:"absolute right-3 top-3 z-10 flex items-center gap-1 rounded-[6px] border border-[var(--color-border-subtle)] bg-[color-mix(in_srgb,var(--color-bg-elevated)_92%,transparent)] px-1.5 py-1 shadow-[0_8px_24px_rgba(0,0,0,0.18)] backdrop-blur-sm",children:[f?(0,n.jsx)("button",{onClick:D,disabled:_||"connected"!==N,title:"Restart OpenCode session (/exit then resume mapped session)","aria-label":"Restart OpenCode session",className:"flex items-center gap-1 px-2 py-0.5 text-[11px] text-[var(--color-text-tertiary)] transition-colors hover:bg-[var(--color-bg-subtle)] hover:text-[var(--color-text-primary)] disabled:cursor-not-allowed disabled:opacity-70",children:_?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("svg",{className:"h-3 w-3 animate-spin",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"M12 3a9 9 0 109 9"})}),"restarting"]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("svg",{className:"h-3 w-3",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,n.jsx)("path",{d:"M21 12a9 9 0 11-2.64-6.36"}),(0,n.jsx)("path",{d:"M21 3v6h-6"})]}),"restart"]})}):null,H]}):null,(0,n.jsx)("div",{ref:j,className:(0,l.cn)("w-full p-1.5"),style:{overflow:"hidden",display:"flex",flexDirection:"column",height:O?"calc(100dvh - ".concat(g?"0px":"37px",")"):h}})]})}r(1715)}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8785],{545:(e,t,r)=>{r.d(t,{CM:()=>s.CM,QN:()=>i,Rt:()=>s.Rt,U1:()=>s.U1,fZ:()=>a,ng:()=>o,sZ:()=>n});var s=r(5425);function a(e){return e.mergeability.blockers.includes("API rate limited or unavailable")}function n(e){return!1===e.enriched}function i(e){return"open"===e.state&&e.mergeability.mergeable&&e.mergeability.ciPassing&&e.mergeability.approved&&e.mergeability.noConflicts}function o(e){if("merged"===e.status||"killed"===e.status||"cleanup"===e.status||"done"===e.status||"terminated"===e.status||e.pr&&("merged"===e.pr.state||"closed"===e.pr.state))return"done";if("mergeable"===e.status||"approved"===e.status||e.pr&&!n(e.pr)&&e.pr.mergeability.mergeable)return"merge";if(e.status===s.SB.ERRORED||e.status===s.SB.NEEDS_INPUT||e.status===s.SB.STUCK||e.activity===s.u3.WAITING_INPUT||e.activity===s.u3.BLOCKED||e.activity===s.u3.EXITED)return"respond";if("ci_failed"===e.status||"changes_requested"===e.status)return"review";if(e.pr&&!a(e.pr)&&!n(e.pr)){let t=e.pr;if(t.ciStatus===s.U1.FAILING||"changes_requested"===t.reviewDecision||!t.mergeability.noConflicts)return"review"}if("review_pending"===e.status)return"pending";if(e.pr&&!a(e.pr)&&!n(e.pr)){let t=e.pr;if(!t.isDraft&&t.unresolvedThreads>0||!t.isDraft&&("pending"===t.reviewDecision||"none"===t.reviewDecision))return"pending"}return"working"}},2236:(e,t,r)=>{r.d(t,{u:()=>h});var s=r(3817),a=r(6749),n=r(7594),i=r(4901),o=r(545),l=r(5425),c=r(7387),d=r(6004);function u(e){let{level:t}=e;return(0,s.jsx)("div",{className:(0,i.cn)("sidebar-session-dot shrink-0 rounded-full","working"===t&&"sidebar-session-dot--glow"),"data-level":t})}let m={working:"working",pending:"pending",review:"review",respond:"respond",merge:"merge",done:"done"};function h(e){return 0===e.projects.length?null:(0,s.jsx)(p,{...e})}function p(e){let{projects:t,sessions:r,activeProjectId:h,activeSessionId:p,collapsed:v=!1,onToggleCollapsed:f,mobileOpen:b=!1,onMobileClose:g}=e,j=(0,n.useRouter)(),[x,_]=(0,a.useState)(()=>new Set(h&&"all"!==h?[h]:[]));(0,a.useEffect)(()=>{h&&"all"!==h&&_(e=>new Set([...e,h]))},[h]);let w=(0,a.useMemo)(()=>new Map(t.map(e=>{var t;return[e.id,null!=(t=e.sessionPrefix)?t:e.id]})),[t]),E=(0,a.useMemo)(()=>t.map(e=>{var t;return null!=(t=e.sessionPrefix)?t:e.id}),[t]),N=(0,a.useMemo)(()=>{let e=new Map;for(let s of r){var t;if((0,l.tT)(s,w.get(s.projectId),E))continue;let r=null!=(t=e.get(s.projectId))?t:[];r.push(s),e.set(s.projectId,r)}return e},[r,w,E]),y=e=>{j.push(e),null==g||g()};return v?(0,s.jsxs)(s.Fragment,{children:[b&&(0,s.jsx)("div",{className:"sidebar-mobile-backdrop",onClick:g}),(0,s.jsx)("aside",{className:(0,i.cn)("project-sidebar project-sidebar--collapsed flex h-full flex-col",b&&"project-sidebar--mobile-open")})]}):(0,s.jsxs)(s.Fragment,{children:[b&&(0,s.jsx)("div",{className:"sidebar-mobile-backdrop",onClick:g}),(0,s.jsxs)("aside",{className:(0,i.cn)("project-sidebar flex h-full flex-col",b&&"project-sidebar--mobile-open"),children:[(0,s.jsxs)("div",{className:"project-sidebar__compact-hdr",children:[(0,s.jsx)("span",{className:"project-sidebar__sect-label",children:"Projects"}),(0,s.jsx)("button",{type:"button",className:"project-sidebar__add-btn","aria-label":"New project",children:(0,s.jsx)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{d:"M12 5v14M5 12h14"})})})]}),(0,s.jsx)("div",{className:"project-sidebar__tree flex-1 overflow-y-auto overflow-x-hidden",children:t.map(e=>{var t;let r=null!=(t=N.get(e.id))?t:[],a=x.has(e.id),n=h===e.id,l=r.filter(e=>"done"!==(0,o.ng)(e)),d=l.length>0;return(0,s.jsxs)("div",{className:"project-sidebar__project",children:[(0,s.jsxs)("button",{type:"button",onClick:()=>{var t;t=e.id,_(e=>{let r=new Set(e);return r.has(t)?r.delete(t):r.add(t),r}),y("/?project=".concat(encodeURIComponent(e.id)))},className:(0,i.cn)("project-sidebar__proj-toggle",n&&"project-sidebar__proj-toggle--active"),"aria-expanded":a,"aria-current":n?"page":void 0,children:[(0,s.jsx)("svg",{className:(0,i.cn)("project-sidebar__proj-chevron",a&&"project-sidebar__proj-chevron--open"),width:"10",height:"10",fill:"none",stroke:"currentColor",strokeWidth:"2.5",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{d:"m9 18 6-6-6-6"})}),(0,s.jsx)("span",{className:"project-sidebar__proj-name",children:e.name}),(0,s.jsx)("span",{className:(0,i.cn)("project-sidebar__proj-badge",d&&"project-sidebar__proj-badge--active"),children:r.length})]}),a&&(0,s.jsx)("div",{className:"project-sidebar__sessions",children:l.length>0?l.map(t=>{var r;let a=(0,o.ng)(t),n=p===t.id,l=null!=(r=t.branch)?r:(0,c.P)(t);return(0,s.jsxs)("button",{type:"button",onClick:()=>y("/sessions/".concat(encodeURIComponent(t.id),"?project=").concat(encodeURIComponent(e.id))),className:(0,i.cn)("project-sidebar__sess-row",n&&"project-sidebar__sess-row--active"),"aria-current":n?"page":void 0,"aria-label":"Open ".concat(l),children:[(0,s.jsx)(u,{level:a}),(0,s.jsx)("span",{className:(0,i.cn)("project-sidebar__sess-label",n&&"project-sidebar__sess-label--active"),children:l}),(0,s.jsx)("span",{className:"project-sidebar__sess-status",children:m[a]})]},t.id)}):(0,s.jsx)("div",{className:"project-sidebar__empty",children:"No active sessions"})})]},e.id)})}),(0,s.jsxs)("div",{className:"project-sidebar__footer",children:[(0,s.jsx)(d.U,{className:"project-sidebar__theme-toggle"}),(0,s.jsx)("span",{className:"project-sidebar__theme-label",children:"Theme"})]})]})]})}},2286:(e,t,r)=>{r.d(t,{D:()=>d,N:()=>u});var s=r(6749),a=(e,t,r,s,a,n,i,o)=>{let l=document.documentElement,c=["light","dark"];function d(t){var r;(Array.isArray(e)?e:[e]).forEach(e=>{let r="class"===e,s=r&&n?a.map(e=>n[e]||e):a;r?(l.classList.remove(...s),l.classList.add(n&&n[t]?n[t]:t)):l.setAttribute(e,t)}),r=t,o&&c.includes(r)&&(l.style.colorScheme=r)}if(s)d(s);else try{let e=localStorage.getItem(t)||r,s=i&&"system"===e?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e;d(s)}catch(e){}},n=["light","dark"],i="(prefers-color-scheme: dark)",o="undefined"==typeof window,l=s.createContext(void 0),c={setTheme:e=>{},themes:[]},d=()=>{var e;return null!=(e=s.useContext(l))?e:c},u=e=>s.useContext(l)?s.createElement(s.Fragment,null,e.children):s.createElement(h,{...e}),m=["light","dark"],h=e=>{let{forcedTheme:t,disableTransitionOnChange:r=!1,enableSystem:a=!0,enableColorScheme:o=!0,storageKey:c="theme",themes:d=m,defaultTheme:u=a?"system":"light",attribute:h="data-theme",value:g,children:j,nonce:x,scriptProps:_}=e,[w,E]=s.useState(()=>v(c,u)),[N,y]=s.useState(()=>"system"===w?b():w),k=g?Object.values(g):d,C=s.useCallback(e=>{let t=e;if(!t)return;"system"===e&&a&&(t=b());let s=g?g[t]:t,i=r?f(x):null,l=document.documentElement,c=e=>{"class"===e?(l.classList.remove(...k),s&&l.classList.add(s)):e.startsWith("data-")&&(s?l.setAttribute(e,s):l.removeAttribute(e))};if(Array.isArray(h)?h.forEach(c):c(h),o){let e=n.includes(u)?u:null,r=n.includes(t)?t:e;l.style.colorScheme=r}null==i||i()},[x]),S=s.useCallback(e=>{let t="function"==typeof e?e(w):e;E(t);try{localStorage.setItem(c,t)}catch(e){}},[w]),M=s.useCallback(e=>{y(b(e)),"system"===w&&a&&!t&&C("system")},[w,t]);s.useEffect(()=>{let e=window.matchMedia(i);return e.addListener(M),M(e),()=>e.removeListener(M)},[M]),s.useEffect(()=>{let e=e=>{e.key===c&&(e.newValue?E(e.newValue):S(u))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[S]),s.useEffect(()=>{C(null!=t?t:w)},[t,w]);let I=s.useMemo(()=>({theme:w,setTheme:S,forcedTheme:t,resolvedTheme:"system"===w?N:w,themes:a?[...d,"system"]:d,systemTheme:a?N:void 0}),[w,S,t,N,a,d]);return s.createElement(l.Provider,{value:I},s.createElement(p,{forcedTheme:t,storageKey:c,attribute:h,enableSystem:a,enableColorScheme:o,defaultTheme:u,value:g,themes:d,nonce:x,scriptProps:_}),j)},p=s.memo(e=>{let{forcedTheme:t,storageKey:r,attribute:n,enableSystem:i,enableColorScheme:o,defaultTheme:l,value:c,themes:d,nonce:u,scriptProps:m}=e,h=JSON.stringify([n,r,l,t,d,c,i,o]).slice(1,-1);return s.createElement("script",{...m,suppressHydrationWarning:!0,nonce:"undefined"==typeof window?u:"",dangerouslySetInnerHTML:{__html:"(".concat(a.toString(),")(").concat(h,")")}})}),v=(e,t)=>{let r;if(!o){try{r=localStorage.getItem(e)||void 0}catch(e){}return r||t}},f=e=>{let t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.appendChild(document.createTextNode("*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(t),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(t)},1)}},b=e=>(e||(e=window.matchMedia(i)),e.matches?"dark":"light")},2537:(e,t,r)=>{r.d(t,{X:()=>i});var s=r(3817),a=r(8713),n=r.n(a);function i(e){let{ariaLabel:t,activeTab:r,dashboardHref:a,prsHref:i,showOrchestrator:o=!0,orchestratorHref:l=null}=e;return(0,s.jsxs)("nav",{className:"mobile-bottom-nav","aria-label":t,children:[(0,s.jsxs)(n(),{href:a,className:"mobile-bottom-nav__item","data-active":"dashboard"===r?"true":"false","aria-current":"dashboard"===r?"page":void 0,children:[(0,s.jsx)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,s.jsx)("path",{d:"M3 13h8V3H3zm10 8h8V11h-8zM3 21h8v-6H3zm10-10h8V3h-8z"})}),(0,s.jsx)("span",{children:"Dashboard"})]}),(0,s.jsxs)(n(),{href:i,className:"mobile-bottom-nav__item","data-active":"prs"===r?"true":"false","aria-current":"prs"===r?"page":void 0,children:[(0,s.jsx)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,s.jsx)("path",{d:"M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01"})}),(0,s.jsx)("span",{children:"PRs"})]}),o?l?(0,s.jsxs)(n(),{href:l,className:"mobile-bottom-nav__item","data-active":"orchestrator"===r?"true":"false","aria-current":"orchestrator"===r?"page":void 0,children:[(0,s.jsxs)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,s.jsx)("path",{d:"M9 3H5a2 2 0 0 0-2 2v4m16 0V5a2 2 0 0 0-2-2h-4m0 18h4a2 2 0 0 0 2-2v-4M3 15v4a2 2 0 0 0 2 2h4"}),(0,s.jsx)("path",{d:"M9 9h6v6H9z"})]}),(0,s.jsx)("span",{children:"Orchestrator"})]}):(0,s.jsxs)("button",{type:"button",className:"mobile-bottom-nav__item",disabled:!0,children:[(0,s.jsxs)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,s.jsx)("path",{d:"M9 3H5a2 2 0 0 0-2 2v4m16 0V5a2 2 0 0 0-2-2h-4m0 18h4a2 2 0 0 0 2-2v-4M3 15v4a2 2 0 0 0 2 2h4"}),(0,s.jsx)("path",{d:"M9 9h6v6H9z"})]}),(0,s.jsx)("span",{children:"Orchestrator"})]}):null]})}},4901:(e,t,r)=>{r.d(t,{cn:()=>s});function s(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.filter(Boolean).join(" ")}},5425:(e,t,r)=>{r.d(t,{CM:()=>n,Rt:()=>i,SB:()=>a,U1:()=>l,tT:()=>o,u3:()=>s});let s={ACTIVE:"active",READY:"ready",IDLE:"idle",WAITING_INPUT:"waiting_input",BLOCKED:"blocked",EXITED:"exited"},a={SPAWNING:"spawning",WORKING:"working",PR_OPEN:"pr_open",CI_FAILED:"ci_failed",REVIEW_PENDING:"review_pending",CHANGES_REQUESTED:"changes_requested",APPROVED:"approved",MERGEABLE:"mergeable",MERGED:"merged",CLEANUP:"cleanup",NEEDS_INPUT:"needs_input",STUCK:"stuck",ERRORED:"errored",IDLE:"idle",KILLED:"killed",DONE:"done",TERMINATED:"terminated"},n=new Set(["killed","terminated","done","cleanup","errored","merged"]),i=new Set(["exited"]);function o(e,t,r){var s;if((null==(s=e.metadata)?void 0:s.role)==="orchestrator"||e.id.endsWith("-orchestrator"))return!0;if(!t)return!1;let a=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(!new RegExp("^".concat(a,"-orchestrator-\\d+$")).test(e.id))return!1;if(r){for(let s of r)if(s!==t&&new RegExp("^".concat(s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"-\\d+$")).test(e.id))return!1}return!0}let l={PENDING:"pending",PASSING:"passing",FAILING:"failing",NONE:"none"}},6004:(e,t,r)=>{r.d(t,{U:()=>i});var s=r(3817),a=r(2286),n=r(6749);function i(e){let{className:t,label:r}=e,{resolvedTheme:i,setTheme:o}=(0,a.D)(),[l,c]=(0,n.useState)(!1);if((0,n.useEffect)(()=>c(!0),[]),!l)return(0,s.jsx)("div",{className:null!=t?t:"h-9 w-9"});let d="dark"===i;return(0,s.jsxs)("button",{onClick:()=>o(d?"light":"dark"),className:null!=t?t:"flex h-9 w-9 items-center justify-center border border-[var(--color-border-strong)] bg-[var(--color-bg-elevated)] text-[var(--color-text-primary)] transition-colors hover:bg-[var(--color-bg-elevated-hover)]","aria-label":"Switch to ".concat(d?"light":"dark"," mode"),title:"Switch to ".concat(d?"light":"dark"," mode"),children:[d?(0,s.jsxs)("svg",{className:"h-[18px] w-[18px]",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,s.jsx)("circle",{cx:"12",cy:"12",r:"5"}),(0,s.jsx)("path",{d:"M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42"})]}):(0,s.jsx)("svg",{className:"h-[18px] w-[18px]",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{d:"M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"})}),r?(0,s.jsx)("span",{children:r}):null]})}},7387:(e,t,r)=>{r.d(t,{P:()=>s});function s(e){var t;if(null==(t=e.pr)?void 0:t.title)return e.pr.title;if(e.issueTitle)return e.issueTitle;if(e.userPrompt)return e.userPrompt;if(e.branch)return e.branch.replace(/^(?:feat|fix|chore|refactor|docs|test|ci|session|release|hotfix|feature|bugfix|build|wip|improvement)\//,"").replace(/[-_]/g," ").replace(/\b\w/g,e=>e.toUpperCase()).trim();let r=e.metadata.pinnedSummary;return r||(e.summary&&!e.summaryIsFallback||e.summary?e.summary:e.status)}},7594:(e,t,r)=>{var s=r(9582);r.o(s,"notFound")&&r.d(t,{notFound:function(){return s.notFound}}),r.o(s,"useParams")&&r.d(t,{useParams:function(){return s.useParams}}),r.o(s,"usePathname")&&r.d(t,{usePathname:function(){return s.usePathname}}),r.o(s,"useRouter")&&r.d(t,{useRouter:function(){return s.useRouter}}),r.o(s,"useSearchParams")&&r.d(t,{useSearchParams:function(){return s.useSearchParams}})},9120:(e,t,r)=>{r.d(t,{D:()=>a,U:()=>n});var s=r(6749);let a=767;function n(e){let t="number"==typeof e?"(max-width: ".concat(e,"px)"):e,[r,a]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{let e=window.matchMedia(t);a(e.matches);let r=e=>{a(e.matches)};return"function"==typeof e.addEventListener?(e.addEventListener("change",r),()=>{e.removeEventListener("change",r)}):(e.addListener(r),()=>{e.removeListener(r)})},[t]),r}}}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9478],{1715:()=>{},5184:(e,t,r)=>{"use strict";r.d(t,{Ug:()=>l,eT:()=>i,i2:()=>c});var n=r(3817),o=r(6749),a=r(1806);let s=o.createContext(void 0);function l(){let e=o.useContext(s);if(!e)throw Error("useMux() must be used within <MuxProvider>");return e}function i(){return o.useContext(s)}function c(e){let{children:t}=e,r=(0,o.useRef)(null),l=(0,o.useRef)(new Map),i=(0,o.useRef)(new Set),[c,d]=(0,o.useState)("connecting"),[u,f]=(0,o.useState)([]),h=(0,o.useRef)(0),m=(0,o.useRef)(null),p=(0,o.useRef)({}),g=(0,o.useRef)(!1),x=(0,o.useCallback)(()=>{if(!r.current){d("connecting");try{let e=function(e){var t,r,n;let o=window.location,s="https:"===o.protocol?"wss:":"ws:",l=null!=(t=e.proxyWsPath)?t:a.env.NEXT_PUBLIC_TERMINAL_WS_PATH;if(l){let e=l.replace(/\/ws\/?$/,"");return"".concat(s,"//").concat(o.host).concat(e,"/mux")}if(""===o.port||"443"===o.port||"80"===o.port)return"".concat(s,"//").concat(o.hostname,"/ao-terminal-mux");let i=null!=(n=null!=(r=e.directTerminalPort)?r:a.env.NEXT_PUBLIC_DIRECT_TERMINAL_PORT)?n:"14801";return"".concat(s,"//").concat(o.hostname,":").concat(i,"/mux")}(p.current);console.log("[MuxProvider] Connecting to",e);let t=new WebSocket(e);r.current=t,t.addEventListener("open",()=>{if(g.current)return void t.close();for(let e of(console.log("[MuxProvider] Connected"),d("connected"),h.current=0,i.current)){let r={ch:"terminal",id:e,type:"open"};t.send(JSON.stringify(r))}t.send(JSON.stringify({ch:"subscribe",topics:["sessions"]}))}),t.addEventListener("message",e=>{try{let t=JSON.parse(e.data);if("terminal"===t.ch)if("data"===t.type){let e=l.current.get(t.id);if(e)for(let r of e)r(t.data)}else if("opened"===t.type)i.current.add(t.id);else if("exited"===t.type){i.current.delete(t.id);let e=l.current.get(t.id);if(e){let r="\r\n\x1b[31m[Terminal exited with code ".concat(t.code,"]\x1b[0m\r\n");for(let t of e)t(r)}}else"error"===t.type&&console.error("[MuxProvider] Terminal error for ".concat(t.id,":"),t.message);else"sessions"===t.ch&&"snapshot"===t.type&&f(t.sessions)}catch(e){console.error("[MuxProvider] Error processing message:",e)}}),t.addEventListener("error",e=>{console.error("[MuxProvider] WebSocket error:",e)}),t.addEventListener("close",()=>{if(console.log("[MuxProvider] Disconnected"),r.current===t&&(r.current=null),g.current)return;let e=Math.min(1e3*Math.pow(2,h.current),3e4);h.current+=1,d("reconnecting"),m.current=setTimeout(()=>{console.log("[MuxProvider] Reconnecting (attempt ".concat(h.current,")...")),x()},e)})}catch(e){console.error("[MuxProvider] Failed to create WebSocket:",e),d("disconnected")}}},[]);(0,o.useEffect)(()=>{g.current=!1;let e=!1;return(async()=>{try{let e=await fetch("/api/runtime/terminal");if(e.ok){let t=await e.json();p.current={directTerminalPort:function(e){if("string"!=typeof e&&"number"!=typeof e)return;let t=Number.parseInt(String(e),10);if(Number.isInteger(t)&&!(t<=0)&&!(t>65535))return String(t)}(t.directTerminalPort),proxyWsPath:function(e){if("string"!=typeof e)return;let t=e.trim();if(t.startsWith("/"))return t}(t.proxyWsPath)}}}catch(e){}e||x()})(),()=>{var t;e=!0,g.current=!0,m.current&&clearTimeout(m.current),null==(t=r.current)||t.close()}},[x]);let b=(0,o.useCallback)((e,t)=>{var n;let o=l.current.get(e);return o||(o=new Set,l.current.set(e,o)),o.add(t),i.current.has(e)||(null==(n=r.current)?void 0:n.readyState)!==WebSocket.OPEN||r.current.send(JSON.stringify({ch:"terminal",id:e,type:"open"})),()=>{let r=l.current.get(e);r&&(r.delete(t),0===r.size&&l.current.delete(e))}},[]),v=(0,o.useCallback)((e,t)=>{var n;(null==(n=r.current)?void 0:n.readyState)===WebSocket.OPEN&&r.current.send(JSON.stringify({ch:"terminal",id:e,type:"data",data:t}))},[]),y=(0,o.useCallback)(e=>{var t;i.current.add(e),(null==(t=r.current)?void 0:t.readyState)===WebSocket.OPEN&&r.current.send(JSON.stringify({ch:"terminal",id:e,type:"open"}))},[]),w=(0,o.useCallback)(e=>{var t;i.current.delete(e),(null==(t=r.current)?void 0:t.readyState)===WebSocket.OPEN&&r.current.send(JSON.stringify({ch:"terminal",id:e,type:"close"}))},[]),k=(0,o.useCallback)((e,t,n)=>{var o;(null==(o=r.current)?void 0:o.readyState)===WebSocket.OPEN&&r.current.send(JSON.stringify({ch:"terminal",id:e,type:"resize",cols:t,rows:n}))},[]),S=(0,o.useMemo)(()=>({subscribeTerminal:b,writeTerminal:v,openTerminal:y,closeTerminal:w,resizeTerminal:k,status:c,sessions:u}),[b,v,y,w,k,c,u]);return(0,n.jsx)(s.Provider,{value:S,children:t})}},7097:(e,t,r)=>{"use strict";r.r(t),r.d(t,{DirectTerminal:()=>d,buildTerminalThemes:()=>c});var n=r(3817),o=r(6749),a=r(7594),s=r(2286),l=r(4901),i=r(5184);function c(e){let t="#5b7ef8",r="rgba(91, 126, 248, 0.30)",n="rgba(91, 126, 248, 0.25)";return{dark:{background:"#0a0a0f",foreground:"#d4d4d8",cursor:t,cursorAccent:"#0a0a0f",selectionBackground:r,selectionInactiveBackground:"rgba(128, 128, 128, 0.2)",black:"#1a1a24",red:"#ef4444",green:"#22c55e",yellow:"#f59e0b",blue:"#5b7ef8",magenta:"#a371f7",cyan:"#22d3ee",white:"#d4d4d8",brightBlack:"#50506a",brightRed:"#f87171",brightGreen:"#4ade80",brightYellow:"#fbbf24",brightBlue:"#7b9cfb",brightMagenta:"#c084fc",brightCyan:"#67e8f9",brightWhite:"#eeeef5"},light:{background:"#fafafa",foreground:"#24292f",cursor:t,cursorAccent:"#fafafa",selectionBackground:n,selectionInactiveBackground:"rgba(128, 128, 128, 0.15)",black:"#24292f",red:"#b42318",green:"#1f7a3d",yellow:"#8a5a00",blue:"#175cd3",magenta:"#8e24aa",cyan:"#0b7285",white:"#4b5563",brightBlack:"#374151",brightRed:"#912018",brightGreen:"#176639",brightYellow:"#6f4a00",brightBlue:"#1d4ed8",brightMagenta:"#7b1fa2",brightCyan:"#155e75",brightWhite:"#374151"}}}function d(e){let{sessionId:t,startFullscreen:d=!1,variant:u="agent",appearance:f="theme",height:h="max(440px, calc(100dvh - 440px))",isOpenCodeSession:m=!1,reloadCommand:p,chromeless:g=!1}=e,x=(0,a.useRouter)(),b=(0,a.usePathname)(),v=(0,a.useSearchParams)(),{resolvedTheme:y}=(0,s.D)(),w=(0,o.useMemo)(()=>c(u),[u]),{subscribeTerminal:k,writeTerminal:S,resizeTerminal:C,openTerminal:N,closeTerminal:j,status:T}=(0,i.Ug)(),E=(0,o.useRef)(null),M=(0,o.useRef)(null),P=(0,o.useRef)(null),R=(0,o.useRef)(T);R.current=T;let[O,W]=(0,o.useState)(d),[_,B]=(0,o.useState)(null),[F,A]=(0,o.useState)(!1),[I,L]=(0,o.useState)(null);async function D(){if(m&&!F){L(null),A(!0);try{let e=p;if(!e){let r=await fetch("/api/sessions/".concat(encodeURIComponent(t),"/remap"),{method:"POST"});if(!r.ok)throw Error("Failed to remap OpenCode session: ".concat(r.status));let n=await r.json();if("string"!=typeof n.opencodeSessionId||0===n.opencodeSessionId.length)throw Error("Missing OpenCode session id after remap");e="/exit\nopencode --session ".concat(n.opencodeSessionId,"\n")}let r=await fetch("/api/sessions/".concat(encodeURIComponent(t),"/send"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:e})});if(!r.ok)throw Error("Failed to send reload command: ".concat(r.status))}catch(e){L(e instanceof Error?e.message:"Failed to reload OpenCode session")}finally{A(!1)}}}(0,o.useEffect)(()=>{let e=new URLSearchParams(v.toString());O?e.set("fullscreen","true"):e.delete("fullscreen");let t=e.toString()?"".concat(b,"?").concat(e.toString()):b;x.replace(t,{scroll:!1})},[O,b,x,v]),(0,o.useEffect)(()=>{if(!E.current)return;let e=!0,n=null,o=null,a=null;return Promise.all([r.e(9524).then(r.t.bind(r,116,23)).then(e=>e.Terminal),r.e(2529).then(r.bind(r,2529)).then(e=>e.FitAddon),r.e(5491).then(r.bind(r,5491)).then(e=>e.WebLinksAddon),document.fonts.ready]).then(r=>{let[s,l,i]=r;if(!e||!E.current)return;let c="dark"===f||"light"!==y,d=new s({cursorBlink:!0,fontSize:13,fontFamily:'var(--font-jetbrains-mono), "JetBrains Mono", "SF Mono", Menlo, Monaco, "Courier New", monospace',theme:c?w.dark:w.light,minimumContrastRatio:c?1:7,scrollback:1e4,allowProposedApi:!0,fastScrollModifier:"alt",fastScrollSensitivity:3,scrollSensitivity:1}),u=new l;d.loadAddon(u),P.current=u;let h=new i;d.loadAddon(h),d.parser.registerCsiHandler({prefix:">",final:"q"},()=>(d.write("\x1bP>|XTerm(370)\x1b\\"),console.log("[DirectTerminal] Sent XDA response for clipboard support"),!0)),d.parser.registerOscHandler(52,e=>{let t=e.split(";");if(t.length<2)return!1;let r=t[t.length-1];try{var n;let e=atob(r),t=Uint8Array.from(e,e=>e.charCodeAt(0)),o=new TextDecoder().decode(t);null==(n=navigator.clipboard)||n.writeText(o).catch(()=>{})}catch(e){}return!0}),d.open(E.current),M.current=d,u.fit();let m=[],p=!1,g=null,x=0,b=()=>{g&&(clearTimeout(g),g=null),m.length>0&&(d.write(m.join("")),m.length=0,x=0)},v=d.onSelectionChange(()=>{d.hasSelection()?(p=!0,g||(g=setTimeout(()=>{p=!1,b()},5e3))):(p=!1,b())});d.attachCustomKeyEventHandler(e=>{if("keydown"!==e.type)return!0;if((e.metaKey&&!e.ctrlKey&&!e.altKey&&"KeyC"===e.code||e.ctrlKey&&e.shiftKey&&"KeyC"===e.code)&&d.hasSelection()){var t;return null==(t=navigator.clipboard)||t.writeText(d.getSelection()).catch(()=>{}),d.clearSelection(),!1}return!0}),N(t),a=k(t,e=>{p?(m.push(e),(x+=e.length)>1048576&&(p=!1,b())):d.write(e)});let T=()=>{u&&(u.fit(),C(t,d.cols,d.rows))};window.addEventListener("resize",T),o=d.onData(e=>{S(t,e)}),C(t,d.cols,d.rows),n=()=>{v.dispose(),g&&clearTimeout(g),window.removeEventListener("resize",T),null==o||o.dispose(),o=null,null==a||a(),j(t),d.dispose()}}).catch(e=>{console.error("[DirectTerminal] Failed to load xterm.js:",e),B("Failed to load terminal")}),()=>{e=!1,null==n||n()}},[f,t,u,y,w,k,S,C,N,j]),(0,o.useEffect)(()=>{if("connected"!==T)return;let e=P.current,r=M.current;e&&r&&(e.fit(),C(t,r.cols,r.rows))},[T,t,C]),(0,o.useEffect)(()=>{let e=M.current;if(!e)return;let t="dark"===f||"light"!==y;e.options.theme=t?w.dark:w.light,e.options.minimumContrastRatio=t?1:7},[f,y,w]),(0,o.useEffect)(()=>{let e=P.current,r=M.current,n=E.current;if(!e||!r||"connected"!==R.current||!n)return;let o=0,a=!1,s=0,l=-1,i=()=>{if(a)return;o++;let c=n.getBoundingClientRect().height,d=l>=0&&1>Math.abs(c-l);if(l=c,!d&&o<60){s=requestAnimationFrame(i);return}r.refresh(0,r.rows-1),e.fit(),r.refresh(0,r.rows-1),C(t,r.cols,r.rows)};s=requestAnimationFrame(i);let c=e=>{a||e.target===n.parentElement&&(o=0,l=-1,setTimeout(()=>{a||(s=requestAnimationFrame(i))},50))},d=n.parentElement;null==d||d.addEventListener("transitionend",c);let u=setTimeout(()=>{a||(o=0,l=-1,i())},300),f=setTimeout(()=>{a||(o=0,l=-1,i())},600);return()=>{a=!0,cancelAnimationFrame(s),null==d||d.removeEventListener("transitionend",c),clearTimeout(u),clearTimeout(f)}},[O,t,C]);let J="var(--color-accent)",z=_?"error":T,K="dark"===f||"light"!==y,U=(0,n.jsx)("button",{onClick:()=>W(!O),className:(0,l.cn)("flex items-center gap-1 px-2 py-0.5 text-[11px] text-[var(--color-text-tertiary)] transition-colors hover:bg-[var(--color-bg-subtle)] hover:text-[var(--color-text-primary)]",!m&&!g&&"ml-auto"),"aria-label":O?"exit fullscreen":"fullscreen",children:O?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("svg",{className:"h-3 w-3",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"M8 3v3a2 2 0 01-2 2H3m18 0h-3a2 2 0 01-2-2V3m0 18v-3a2 2 0 012-2h3M3 16h3a2 2 0 012 2v3"})}),"exit fullscreen"]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("svg",{className:"h-3 w-3",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"M8 3H5a2 2 0 00-2 2v3m18 0V5a2 2 0 00-2-2h-3m0 18h3a2 2 0 002-2v-3M3 16v3a2 2 0 002 2h3"})}),"fullscreen"]})});return(0,n.jsxs)("div",{className:(0,l.cn)("relative overflow-hidden border border-[var(--color-border-default)]",K?"bg-[#0a0a0f]":"bg-[#fafafa]",O&&"fixed inset-0 z-50 rounded-none border-0",g&&"border-0"),children:[g?null:(0,n.jsxs)("div",{className:"flex items-center gap-2 border-b border-[var(--color-border-subtle)] bg-[var(--color-bg-elevated)] px-3 py-2",children:[(0,n.jsx)("div",{className:(0,l.cn)("h-2 w-2 shrink-0 rounded-full","connected"===z?"bg-[var(--color-status-ready)]":"error"===z||"disconnected"===z?"bg-[var(--color-status-error)]":"bg-[var(--color-status-attention)] animate-[pulse_1.5s_ease-in-out_infinite]")}),(0,n.jsx)("span",{className:"font-[var(--font-mono)] text-[11px]",style:{color:J},children:t}),(0,n.jsx)("span",{className:(0,l.cn)("text-[10px] font-medium uppercase tracking-[0.06em]","connected"===z?"text-[var(--color-status-ready)]":"error"===z||"disconnected"===z?"text-[var(--color-status-error)]":"text-[var(--color-text-tertiary)]"),children:"connected"===z?"Connected":"error"===z?null!=_?_:"Error":"disconnected"===z?"Disconnected":"Connecting…"}),(0,n.jsx)("span",{className:"px-1.5 py-0.5 text-[9px] font-semibold uppercase tracking-[0.06em]",style:{color:J,background:"color-mix(in srgb, ".concat(J," 12%, transparent)")},children:"XDA"}),m?(0,n.jsx)("button",{onClick:D,disabled:F||"connected"!==T,title:"Restart OpenCode session (/exit then resume mapped session)","aria-label":"Restart OpenCode session",className:"ml-auto flex items-center gap-1 px-2 py-0.5 text-[11px] text-[var(--color-text-tertiary)] transition-colors hover:bg-[var(--color-bg-subtle)] hover:text-[var(--color-text-primary)] disabled:cursor-not-allowed disabled:opacity-70",children:F?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("svg",{className:"h-3 w-3 animate-spin",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"M12 3a9 9 0 109 9"})}),"restarting"]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("svg",{className:"h-3 w-3",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,n.jsx)("path",{d:"M21 12a9 9 0 11-2.64-6.36"}),(0,n.jsx)("path",{d:"M21 3v6h-6"})]}),"restart"]})}):null,I?(0,n.jsx)("span",{className:"max-w-[40ch] truncate text-[10px] font-medium text-[var(--color-status-error)]",title:I,children:I}):null,U]}),g?(0,n.jsxs)("div",{className:"absolute right-3 top-3 z-10 flex items-center gap-1 rounded-[6px] border border-[var(--color-border-subtle)] bg-[color-mix(in_srgb,var(--color-bg-elevated)_92%,transparent)] px-1.5 py-1 shadow-[0_8px_24px_rgba(0,0,0,0.18)] backdrop-blur-sm",children:[m?(0,n.jsx)("button",{onClick:D,disabled:F||"connected"!==T,title:"Restart OpenCode session (/exit then resume mapped session)","aria-label":"Restart OpenCode session",className:"flex items-center gap-1 px-2 py-0.5 text-[11px] text-[var(--color-text-tertiary)] transition-colors hover:bg-[var(--color-bg-subtle)] hover:text-[var(--color-text-primary)] disabled:cursor-not-allowed disabled:opacity-70",children:F?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("svg",{className:"h-3 w-3 animate-spin",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"M12 3a9 9 0 109 9"})}),"restarting"]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("svg",{className:"h-3 w-3",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,n.jsx)("path",{d:"M21 12a9 9 0 11-2.64-6.36"}),(0,n.jsx)("path",{d:"M21 3v6h-6"})]}),"restart"]})}):null,U]}):null,(0,n.jsx)("div",{ref:E,className:(0,l.cn)("w-full p-1.5"),style:{overflow:"hidden",display:"flex",flexDirection:"column",height:O?"calc(100dvh - ".concat(g?"0px":"37px",")"):h}})]})}r(1715)}}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[25,64,403,719,816,1097,1105,1214,1337,1762,1797,2007,2079,2438,2985,3675,4209,5214,6681,6849,6865,6946,6999,7462,8301,8581,9002,9492],{687:()=>{}},_=>{_.O(0,[131,1461,7358],()=>_(_.s=687)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[25,64,403,719,816,1097,1105,1214,1337,1762,1797,2007,2079,2438,2985,3675,4209,5214,6681,6849,6865,6946,6999,7462,8301,8581,9002,9492],{687:()=>{}},_=>{_.O(0,[131,1461,7358],()=>_(_.s=687)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[25,64,403,719,816,1097,1105,1214,1337,1762,1797,2007,2079,2438,2985,3675,4209,5214,6681,6849,6865,6946,6999,7462,8301,8581,9002,9492],{687:()=>{}},_=>{_.O(0,[131,1461,7358],()=>_(_.s=687)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[25,64,403,719,816,1097,1105,1214,1337,1762,1797,2007,2079,2438,2985,3675,4209,5214,6681,6849,6865,6946,6999,7462,8301,8581,9002,9492],{687:()=>{}},_=>{_.O(0,[131,1461,7358],()=>_(_.s=687)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[25,64,403,719,816,1097,1105,1214,1337,1762,1797,2007,2079,2438,2985,3675,4209,5214,6681,6849,6865,6946,6999,7462,8301,8581,9002,9492],{687:()=>{}},_=>{_.O(0,[131,1461,7358],()=>_(_.s=687)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[25,64,403,719,816,1097,1105,1214,1337,1762,1797,2007,2079,2438,2985,3675,4209,5214,6681,6849,6865,6946,6999,7462,8301,8581,9002,9492],{687:()=>{}},_=>{_.O(0,[131,1461,7358],()=>_(_.s=687)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[25,64,403,719,816,1097,1105,1214,1337,1762,1797,2007,2079,2438,2985,3675,4209,5214,6681,6849,6865,6946,6999,7462,8301,8581,9002,9492],{687:()=>{}},_=>{_.O(0,[131,1461,7358],()=>_(_.s=687)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[25,64,403,719,816,1097,1105,1214,1337,1762,1797,2007,2079,2438,2985,3675,4209,5214,6681,6849,6865,6946,6999,7462,8301,8581,9002,9492],{687:()=>{}},_=>{_.O(0,[131,1461,7358],()=>_(_.s=687)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[25,64,403,719,816,1097,1105,1214,1337,1762,1797,2007,2079,2438,2985,3675,4209,5214,6681,6849,6865,6946,6999,7462,8301,8581,9002,9492],{687:()=>{}},_=>{_.O(0,[131,1461,7358],()=>_(_.s=687)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[25,64,403,719,816,1097,1105,1214,1337,1762,1797,2007,2079,2438,2985,3675,4209,5214,6681,6849,6865,6946,6999,7462,8301,8581,9002,9492],{687:()=>{}},_=>{_.O(0,[131,1461,7358],()=>_(_.s=687)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[25,64,403,719,816,1097,1105,1214,1337,1762,1797,2007,2079,2438,2985,3675,4209,5214,6681,6849,6865,6946,6999,7462,8301,8581,9002,9492],{687:()=>{}},_=>{_.O(0,[131,1461,7358],()=>_(_.s=687)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[25,64,403,719,816,1097,1105,1214,1337,1762,1797,2007,2079,2438,2985,3675,4209,5214,6681,6849,6865,6946,6999,7462,8301,8581,9002,9492],{687:()=>{}},_=>{_.O(0,[131,1461,7358],()=>_(_.s=687)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[25,64,403,719,816,1097,1105,1214,1337,1762,1797,2007,2079,2438,2985,3675,4209,5214,6681,6849,6865,6946,6999,7462,8301,8581,9002,9492],{687:()=>{}},_=>{_.O(0,[131,1461,7358],()=>_(_.s=687)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[25,64,403,719,816,1097,1105,1214,1337,1762,1797,2007,2079,2438,2985,3675,4209,5214,6681,6849,6865,6946,6999,7462,8301,8581,9002,9492],{687:()=>{}},_=>{_.O(0,[131,1461,7358],()=>_(_.s=687)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[25,64,403,719,816,1097,1105,1214,1337,1762,1797,2007,2079,2438,2985,3675,4209,5214,6681,6849,6865,6946,6999,7462,8301,8581,9002,9492],{687:()=>{}},_=>{_.O(0,[131,1461,7358],()=>_(_.s=687)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[25,64,403,719,816,1097,1105,1214,1337,1762,1797,2007,2079,2438,2985,3675,4209,5214,6681,6849,6865,6946,6999,7462,8301,8581,9002,9492],{687:()=>{}},_=>{_.O(0,[131,1461,7358],()=>_(_.s=687)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[25,64,403,719,816,1097,1105,1214,1337,1762,1797,2007,2079,2438,2985,3675,4209,5214,6681,6849,6865,6946,6999,7462,8301,8581,9002,9492],{687:()=>{}},_=>{_.O(0,[131,1461,7358],()=>_(_.s=687)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[25,64,403,719,816,1097,1105,1214,1337,1762,1797,2007,2079,2438,2985,3675,4209,5214,6681,6849,6865,6946,6999,7462,8301,8581,9002,9492],{687:()=>{}},_=>{_.O(0,[131,1461,7358],()=>_(_.s=687)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[25,64,403,719,816,1097,1105,1214,1337,1762,1797,2007,2079,2438,2985,3675,4209,5214,6681,6849,6865,6946,6999,7462,8301,8581,9002,9492],{687:()=>{}},_=>{_.O(0,[131,1461,7358],()=>_(_.s=687)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[25,64,403,719,816,1097,1105,1214,1337,1762,1797,2007,2079,2438,2985,3675,4209,5214,6681,6849,6865,6946,6999,7462,8301,8581,9002,9492],{687:()=>{}},_=>{_.O(0,[131,1461,7358],()=>_(_.s=687)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[25,64,403,719,816,1097,1105,1214,1337,1762,1797,2007,2079,2438,2985,3675,4209,5214,6681,6849,6865,6946,6999,7462,8301,8581,9002,9492],{687:()=>{}},_=>{_.O(0,[131,1461,7358],()=>_(_.s=687)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[25,64,403,719,816,1097,1105,1214,1337,1762,1797,2007,2079,2438,2985,3675,4209,5214,6681,6849,6865,6946,6999,7462,8301,8581,9002,9492],{687:()=>{}},_=>{_.O(0,[131,1461,7358],()=>_(_.s=687)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[25,64,403,719,816,1097,1105,1214,1337,1762,1797,2007,2079,2438,2985,3675,4209,5214,6681,6849,6865,6946,6999,7462,8301,8581,9002,9492],{687:()=>{}},_=>{_.O(0,[131,1461,7358],()=>_(_.s=687)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[25,64,403,719,816,1097,1105,1214,1337,1762,1797,2007,2079,2438,2985,3675,4209,5214,6681,6849,6865,6946,6999,7462,8301,8581,9002,9492],{687:()=>{}},_=>{_.O(0,[131,1461,7358],()=>_(_.s=687)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[25,64,403,719,816,1097,1105,1214,1337,1762,1797,2007,2079,2438,2985,3675,4209,5214,6681,6849,6865,6946,6999,7462,8301,8581,9002,9492],{687:()=>{}},_=>{_.O(0,[131,1461,7358],()=>_(_.s=687)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[25,64,403,719,816,1097,1105,1214,1337,1762,1797,2007,2079,2438,2985,3675,4209,5214,6681,6849,6865,6946,6999,7462,8301,8581,9002,9492],{687:()=>{}},_=>{_.O(0,[131,1461,7358],()=>_(_.s=687)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[25,64,403,719,816,1097,1105,1214,1337,1762,1797,2007,2079,2438,2985,3675,4209,5214,6681,6849,6865,6946,6999,7462,8301,8581,9002,9492],{687:()=>{}},_=>{_.O(0,[131,1461,7358],()=>_(_.s=687)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9428],{2900:(e,r,t)=>{Promise.resolve().then(t.bind(t,9574))},4901:(e,r,t)=>{"use strict";function s(){for(var e=arguments.length,r=Array(e),t=0;t<e;t++)r[t]=arguments[t];return r.filter(Boolean).join(" ")}t.d(r,{cn:()=>s})},7594:(e,r,t)=>{"use strict";var s=t(9582);t.o(s,"notFound")&&t.d(r,{notFound:function(){return s.notFound}}),t.o(s,"useParams")&&t.d(r,{useParams:function(){return s.useParams}}),t.o(s,"usePathname")&&t.d(r,{usePathname:function(){return s.usePathname}}),t.o(s,"useRouter")&&t.d(r,{useRouter:function(){return s.useRouter}}),t.o(s,"useSearchParams")&&t.d(r,{useSearchParams:function(){return s.useSearchParams}})},9574:(e,r,t)=>{"use strict";t.d(r,{OrchestratorSelector:()=>d});var s=t(3817),a=t(6749),o=t(7594),c=t(8713),n=t.n(c),i=t(4901);function l(e){if(!e)return"Unknown";let r=new Date(e).getTime();if(!Number.isFinite(r))return"Unknown";let t=new Date().getTime()-r;if(t<0)return"Just now";let s=Math.floor(t/6e4),a=Math.floor(s/60),o=Math.floor(a/24);return s<1?"Just now":s<60?"".concat(s,"m ago"):a<24?"".concat(a,"h ago"):"".concat(o,"d ago")}function d(e){let{orchestrators:r,projectId:t,projectName:c,error:d}=e,u=(0,o.useRouter)(),[x,m]=(0,a.useState)(!1),[h,v]=(0,a.useState)(null),f=(0,a.useRef)(!1),p=async()=>{if(!f.current){f.current=!0,m(!0),v(null);try{let e=await fetch("/api/orchestrators",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:t})});if(!e.ok){let r=await e.json();throw Error(r.error||"Failed to spawn orchestrator")}let r=await e.json();u.push("/sessions/".concat(r.orchestrator.id))}catch(e){v(e instanceof Error?e.message:"Failed to spawn orchestrator")}finally{m(!1),f.current=!1}}};return d?(0,s.jsx)("div",{className:"flex h-screen items-center justify-center bg-[var(--color-bg-base)]",children:(0,s.jsxs)("div",{className:"text-center",children:[(0,s.jsx)("h1",{className:"text-xl font-semibold text-[var(--color-text-primary)]",children:"Error"}),(0,s.jsx)("p",{className:"mt-2 text-[var(--color-text-secondary)]",children:d}),(0,s.jsx)(n(),{href:"/",className:"orchestrator-btn mt-4 inline-flex items-center gap-2 px-4 py-2 text-sm font-medium",children:"Go to Dashboard"})]})}):(0,s.jsxs)("div",{className:"flex min-h-screen flex-col bg-[var(--color-bg-base)]",children:[(0,s.jsx)("header",{className:"nav-glass sticky top-0 z-10 border-b border-[var(--color-border-subtle)] px-6 py-4",children:(0,s.jsxs)("div",{className:"mx-auto flex max-w-3xl items-center justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"text-lg font-semibold text-[var(--color-text-primary)]",children:c}),(0,s.jsx)("p",{className:"text-sm text-[var(--color-text-secondary)]",children:"Select an orchestrator"})]}),(0,s.jsx)(n(),{href:"/?project=".concat(t),className:"text-sm text-[var(--color-text-secondary)] hover:text-[var(--color-text-primary)]",children:"Dashboard"})]})}),(0,s.jsx)("main",{className:"flex-1 px-6 py-8",children:(0,s.jsxs)("div",{className:"mx-auto max-w-3xl",children:[(0,s.jsx)("div",{className:"mb-6 rounded-lg border border-[var(--color-border-subtle)] bg-[var(--color-bg-surface)] p-4",children:(0,s.jsxs)("p",{className:"text-sm text-[var(--color-text-secondary)]",children:["Found"," ",(0,s.jsx)("span",{className:"font-medium text-[var(--color-text-primary)]",children:r.length})," ","existing orchestrator session",1!==r.length?"s":"",". You can resume an existing session or start a new one."]})}),(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)("h2",{className:"mb-3 text-sm font-medium text-[var(--color-text-secondary)]",children:"Existing Sessions"}),(0,s.jsx)("div",{className:"space-y-2",children:r.map(e=>(0,s.jsxs)(n(),{href:"/sessions/".concat(e.id),className:(0,i.cn)("flex items-center justify-between rounded-lg border border-[var(--color-border-subtle)] bg-[var(--color-bg-surface)] p-4","transition-all hover:border-[var(--color-border-default)] hover:shadow-sm"),children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("div",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:function(e){switch(e){case"working":return"var(--color-status-working)";case"spawning":return"var(--color-status-attention)";case"pr_open":case"review_pending":case"approved":case"mergeable":return"var(--color-status-ready)";case"ci_failed":case"changes_requested":return"var(--color-status-error)";case"merged":case"done":case"killed":case"terminated":return"var(--color-text-tertiary)";default:return"var(--color-text-secondary)"}}(e.status)}}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"font-medium text-[var(--color-text-primary)]",children:e.id}),(0,s.jsxs)("div",{className:"flex items-center gap-2 text-xs text-[var(--color-text-secondary)]",children:[(0,s.jsx)("span",{className:"capitalize",children:e.status.replace(/_/g," ")}),e.activity&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"text-[var(--color-text-tertiary)]",children:"\xb7"}),(0,s.jsx)("span",{children:function(e){if(!e)return"";switch(e){case"active":return"Active";case"ready":return"Ready";case"idle":return"Idle";case"waiting_input":return"Waiting";case"blocked":return"Blocked";case"exited":return"Exited";default:return e}}(e.activity)})]})]})]})]}),(0,s.jsxs)("div",{className:"text-right text-xs text-[var(--color-text-tertiary)]",children:[(0,s.jsxs)("div",{children:["Created ",l(e.createdAt)]}),e.lastActivityAt&&(0,s.jsxs)("div",{children:["Active ",l(e.lastActivityAt)]})]})]},e.id))})]}),(0,s.jsxs)("div",{className:"border-t border-[var(--color-border-subtle)] pt-6",children:[(0,s.jsx)("h2",{className:"mb-3 text-sm font-medium text-[var(--color-text-secondary)]",children:"Or Start Fresh"}),(0,s.jsx)("button",{type:"button",onClick:p,disabled:x,className:(0,i.cn)("orchestrator-btn w-full px-4 py-3 text-sm font-medium","disabled:cursor-wait disabled:opacity-70"),children:x?(0,s.jsxs)("span",{className:"flex items-center justify-center gap-2",children:[(0,s.jsxs)("svg",{className:"h-4 w-4 animate-spin",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,s.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,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"})]}),"Creating new orchestrator..."]}):"Start New Orchestrator"}),h&&(0,s.jsx)("p",{className:"mt-2 text-sm text-[var(--color-status-error)]",children:h})]})]})})]})}}},e=>{e.O(0,[8713,131,1461,7358],()=>e(e.s=2900)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8974],{5619:(e,s,a)=>{Promise.resolve().then(a.bind(a,8649))},8649:(e,s,a)=>{"use strict";a.d(s,{Dashboard:()=>U});var t=a(3817),r=a(6749),n=a(7594),l=a(9120),o=a(545),i=a(4901),c=a(7387),d=a(4906),h=a(1237);let m=(0,r.memo)(function(e){var s,a,n,l;let{session:m,onSend:u,onKill:p,onMerge:x,onRestore:b}=e,[v,j]=(0,r.useState)(!1),[g,_]=(0,r.useState)(null),[f,N]=(0,r.useState)(null),[k,w]=(0,r.useState)(null),[y,C]=(0,r.useState)(null),[M,P]=(0,r.useState)(!1),[S,R]=(0,r.useState)(""),I=(0,r.useRef)(null),T=(0,r.useRef)(null),D=(0,o.ng)(m),W=m.pr,A=async e=>{let s=e.trim();if(!s||null!==k)return!1;w(s),C(null);try{return await Promise.resolve(null==u?void 0:u(m.id,s)),C(s),T.current&&clearTimeout(T.current),T.current=setTimeout(()=>C(null),2e3),!0}catch(e){return!1}finally{w(null)}},E=async e=>{"Enter"===e.key&&!e.shiftKey&&(e.preventDefault(),await A(S)&&R(""))};(0,r.useEffect)(()=>()=>{I.current&&clearTimeout(I.current),T.current&&clearTimeout(T.current)},[]);let B=async(e,s)=>{if(null===g){_(e),N(null);try{await Promise.resolve(null==u?void 0:u(m.id,s)),I.current&&clearTimeout(I.current),I.current=setTimeout(()=>_(null),2e3)}catch(s){_(null),N(e),I.current&&clearTimeout(I.current),I.current=setTimeout(()=>N(null),2e3)}}},L=!!W&&(0,o.fZ)(W),O=!!W&&(0,o.sZ)(W),F=function(e){var s,a,r;let n=e.pr;if(!n||"open"!==n.state||(0,o.fZ)(n)||(0,o.sZ)(n))return[];let l=e.metadata,i=[],c=l.status,d=n.ciStatus===o.U1.FAILING||"ci_failed"===c,h="changes_requested"===n.reviewDecision||"changes_requested"===c,m=!n.mergeability.noConflicts;if(d){let e=n.ciChecks.find(e=>"failed"===e.status),a=n.ciChecks.filter(e=>"failed"===e.status).length;0===a&&n.ciStatus!==o.U1.FAILING?i.push({key:"ci-fail",type:"ci",icon:"✗",label:"CI failing",url:n.url+"/checks",notified:!!l.lastCIFailureDispatchHash,actionLabel:"Ask to fix",actionMessage:"Please fix the failing CI checks on ".concat(n.url)}):0===a?i.push({key:"ci-unknown",type:"ci",icon:"?",label:"CI unknown",url:n.url+"/checks"}):i.push({key:"ci-fail",type:"ci",icon:"✗",count:a,label:"check".concat(a>1?"s":""," failing"),url:null!=(s=null==e?void 0:e.url)?s:n.url+"/checks",notified:!!l.lastCIFailureDispatchHash,actionLabel:"Ask to fix",actionMessage:"Please fix the failing CI checks on ".concat(n.url)})}if(h?i.push({key:"changes",type:"changes",icon:"↻",label:"changes requested",url:n.url,notified:!!l.lastPendingReviewDispatchHash,actionLabel:"Ask to address",actionMessage:"Please address the requested changes on ".concat(n.url)}):n.isDraft||"pending"!==n.reviewDecision&&"none"!==n.reviewDecision||i.push({key:"review",type:"review",icon:(0,t.jsxs)("svg",{width:"9",height:"9",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),(0,t.jsx)("circle",{cx:"9",cy:"7",r:"4"}),(0,t.jsx)("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75"})]}),label:"needs review",url:n.url,actionLabel:"Ask to post",actionMessage:"Post ".concat(n.url," on slack asking for a review.")}),m&&i.push({key:"conflict",type:"conflict",icon:"⚠",label:"merge conflict",url:n.url,notified:"true"===l.lastMergeConflictDispatched,actionLabel:"Ask to fix",actionMessage:"Please resolve the merge conflicts on ".concat(n.url," by rebasing on the base branch")}),n.unresolvedThreads>0){let e=null!=(r=null==(a=n.unresolvedComments[0])?void 0:a.url)?r:n.url+"/files";i.push({key:"comments",type:"comment",icon:"\uD83D\uDCAC",label:"unresolved comments",count:n.unresolvedThreads,url:e,actionLabel:"Ask to resolve",actionMessage:"Please address all unresolved review comments on ".concat(n.url)})}return i}(m),H=!L&&(null==W?void 0:W.mergeability.mergeable)&&"open"===W.state,Z=o.CM.has(m.status)||null!==m.activity&&o.Rt.has(m.activity),U=Z&&"merged"!==m.status,K=(0,c.P)(m),q=(n=m,l=D,H||"merge"===l?"mergeable":"respond"===l?"waiting_input":"ci_failed"===n.status?"ci_failed":"review"===l?"review_pending":"working"===l?"working":n.status),V=L||!W||O?[]:W.ciChecks.filter(e=>"passed"===e.status).slice(0,3),z="done"===D,G=m.issueLabel?"".concat(m.issueLabel).concat(m.issueTitle?" \xb7 ".concat(m.issueTitle):""):null!=(s=m.issueTitle)?s:m.summary&&m.summary!==K?m.summary:null,J=H?"session-card--merge-frame":F.length>0?"session-card--alert-frame":"session-card--fixed",Q=H?"session-card--accent-merge":"working"===D?"session-card--accent-working":"respond"===D?"session-card--accent-respond":"review"===D||"pending"===D?"session-card--accent-attention":"session-card--accent-default";if(z){let e=function(e){var s;let a=e.activity,r=e.status;return"merged"===(null==(s=e.pr)?void 0:s.state)||"merged"===r?{label:"merged",pillClass:"done-status-pill--merged",icon:(0,t.jsx)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2.5",viewBox:"0 0 24 24",className:"h-3 w-3",children:(0,t.jsx)("path",{d:"M20 6 9 17l-5-5"})})}:"killed"===r||"terminated"===r?{label:r,pillClass:"done-status-pill--killed",icon:(0,t.jsx)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2.5",viewBox:"0 0 24 24",className:"h-3 w-3",children:(0,t.jsx)("path",{d:"M18 6 6 18M6 6l12 12"})})}:{label:"exited"===a?"exited":r,pillClass:"done-status-pill--exited",icon:(0,t.jsxs)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",className:"h-3 w-3",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,t.jsx)("path",{d:"M9 12h6"})]})}}(m);return(0,t.jsxs)("div",{className:(0,i.cn)("session-card-done",v&&"done-expanded"),onClick:e=>{e.target.closest("a, button, textarea")||j(!v)},children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3.5 pt-3 pb-1.5",children:[(0,t.jsxs)("span",{className:(0,i.cn)("done-status-pill",e.pillClass),children:[e.icon,e.label]}),(0,t.jsx)("span",{className:"font-[var(--font-mono)] text-[10px] tracking-wide text-[var(--color-text-muted)]",children:m.id}),(0,t.jsx)("div",{className:"flex-1"}),U&&(0,t.jsxs)("button",{onClick:e=>{e.stopPropagation(),null==b||b(m.id)},className:"done-restore-btn",children:[(0,t.jsxs)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",className:"h-3 w-3",children:[(0,t.jsx)("polyline",{points:"1 4 1 10 7 10"}),(0,t.jsx)("path",{d:"M3.51 15a9 9 0 1 0 2.13-9.36L1 10"})]}),"restore"]})]}),(0,t.jsx)("div",{className:"px-3.5 pb-2",children:(0,t.jsx)("p",{className:"session-card-done__title text-[13px] font-semibold leading-snug [display:-webkit-box] [-webkit-box-orient:vertical] [-webkit-line-clamp:2] overflow-hidden",children:K})}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 px-3.5 pb-3",children:[m.branch&&(0,t.jsxs)("span",{className:"done-meta-chip font-[var(--font-mono)]",children:[(0,t.jsxs)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",className:"h-2.5 w-2.5 opacity-50",children:[(0,t.jsx)("path",{d:"M6 3v12M18 9a3 3 0 0 1-3 3H9a3 3 0 0 0-3 3"}),(0,t.jsx)("circle",{cx:"18",cy:"6",r:"3"})]}),m.branch]}),W&&(0,t.jsxs)("a",{href:W.url,target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),className:"done-meta-chip font-[var(--font-mono)] font-bold text-[var(--color-text-primary)] no-underline underline-offset-2 hover:underline",children:["#",W.number]}),W&&!L&&(O?(0,t.jsx)("span",{className:"inline-block h-[14px] w-16 animate-pulse rounded-full bg-[var(--color-bg-subtle)]"}):(0,t.jsxs)("span",{className:"done-meta-chip font-[var(--font-mono)]",children:[(0,t.jsxs)("span",{className:"text-[var(--color-status-ready)]",children:["+",W.additions]})," ",(0,t.jsxs)("span",{className:"text-[var(--color-status-error)]",children:["-",W.deletions]})," ",(0,h.i_)(W.additions,W.deletions),(0,t.jsx)("span",{className:"sr-only",children:"+".concat(W.additions," -").concat(W.deletions," ").concat((0,h.i_)(W.additions,W.deletions))})]}))]}),v&&(0,t.jsxs)("div",{className:"done-expand-section px-3.5 py-3",children:[m.summary&&(null==W?void 0:W.title)&&m.summary!==W.title&&(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsxs)("div",{className:"done-detail-heading",children:[(0,t.jsx)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M4 6h16M4 12h16M4 18h10"})}),"Summary"]}),(0,t.jsx)("p",{className:"text-[12px] leading-relaxed text-[var(--color-text-secondary)]",children:m.summary})]}),m.issueUrl&&(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsxs)("div",{className:"done-detail-heading",children:[(0,t.jsxs)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,t.jsx)("path",{d:"M12 8v4M12 16h.01"})]}),"Issue"]}),(0,t.jsxs)("a",{href:m.issueUrl,target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),className:"text-[12px] text-[var(--color-accent)] hover:underline",children:[m.issueLabel||m.issueUrl,m.issueTitle&&": ".concat(m.issueTitle)]})]}),W&&W.ciChecks.length>0&&(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsxs)("div",{className:"done-detail-heading",children:[(0,t.jsxs)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,t.jsx)("path",{d:"M9 12l2 2 4-4"}),(0,t.jsx)("circle",{cx:"12",cy:"12",r:"10"})]}),"CI Checks"]}),(0,t.jsx)(d.zm,{checks:W.ciChecks})]}),W&&(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsxs)("div",{className:"done-detail-heading",children:[(0,t.jsxs)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,t.jsx)("path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65S8.93 17.38 9 18v4"}),(0,t.jsx)("path",{d:"M9 18c-4.51 2-5-2-7-2"})]}),"PR"]}),(0,t.jsxs)("p",{className:"text-[12px] text-[var(--color-text-secondary)]",children:[(0,t.jsx)("a",{href:W.url,target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),className:"hover:underline",children:W.title}),O?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("br",{}),(0,t.jsxs)("span",{className:"mt-1 inline-flex items-center gap-2 text-[10px] text-[var(--color-text-muted)]",children:[(0,t.jsx)("span",{className:"inline-block h-3 w-12 animate-pulse rounded bg-[var(--color-bg-subtle)]"}),(0,t.jsx)("span",{children:"PR details loading..."})]})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("br",{}),(0,t.jsxs)("span",{className:"mt-1 inline-flex items-center gap-2",children:[(0,t.jsxs)("span",{className:"done-meta-chip font-[var(--font-mono)]",children:[(0,t.jsxs)("span",{className:"text-[var(--color-status-ready)]",children:["+",W.additions]})," ",(0,t.jsxs)("span",{className:"text-[var(--color-status-error)]",children:["-",W.deletions]})]}),(0,t.jsx)("span",{className:"text-[var(--color-text-muted)]",children:"\xb7"}),(0,t.jsxs)("span",{className:"text-[10px] text-[var(--color-text-muted)]",children:["mergeable: ",W.mergeability.mergeable?"yes":"no"]}),(0,t.jsx)("span",{className:"text-[var(--color-text-muted)]",children:"\xb7"}),(0,t.jsxs)("span",{className:"text-[10px] text-[var(--color-text-muted)]",children:["review: ",W.reviewDecision]})]})]})]})]}),!W&&(0,t.jsx)("p",{className:"text-[12px] text-[var(--color-text-tertiary)]",children:"No PR associated with this session."})]})]})}let Y=Z?"exited":H||"merge"===D||"review"===D?"ready":"respond"===D?"waiting":"pending"===D?"idle":"working"===D?"working":"idle";return(0,t.jsxs)("div",{className:(0,i.cn)("session-card kanban-card-enter border",J,Q,H&&"card-merge-ready"),children:[(0,t.jsxs)("div",{className:"session-card__header",children:[(0,t.jsx)("span",{className:(0,i.cn)("card__adot","working"===Y&&"card__adot--working","ready"===Y&&"card__adot--ready","idle"===Y&&"card__adot--idle","waiting"===Y&&"card__adot--waiting","exited"===Y&&"card__adot--exited")}),(0,t.jsx)("span",{className:"card__id",children:m.id}),(0,t.jsx)("div",{className:"flex-1"}),U&&(0,t.jsxs)("button",{onClick:e=>{e.stopPropagation(),null==b||b(m.id)},className:"inline-flex items-center gap-1 border border-[color-mix(in_srgb,var(--color-accent)_35%,transparent)] px-2 py-0.5 text-[11px] text-[var(--color-accent)] transition-colors hover:bg-[var(--color-tint-blue)]",children:[(0,t.jsxs)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",className:"h-3 w-3",children:[(0,t.jsx)("polyline",{points:"1 4 1 10 7 10"}),(0,t.jsx)("path",{d:"M3.51 15a9 9 0 1 0 2.13-9.36L1 10"})]}),"restore"]}),!Z&&(0,t.jsxs)("a",{href:"/sessions/".concat(encodeURIComponent(m.id)),onClick:e=>e.stopPropagation(),className:"session-card__control session-card__terminal-link",children:[(0,t.jsxs)("svg",{className:"session-card__control-icon",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,t.jsx)("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),(0,t.jsx)("path",{d:"M6 10l4 2-4 2"}),(0,t.jsx)("path",{d:"M14 14h4"})]}),"terminal"]})]}),(0,t.jsxs)("div",{className:"session-card__body flex min-h-0 flex-1 flex-col",children:[(0,t.jsx)("div",{className:"card__title-wrap",children:(0,t.jsx)("p",{className:"card__title",children:K})}),(0,t.jsxs)("div",{className:"card__meta",children:[m.branch&&(0,t.jsx)("span",{className:"card__branch",children:m.branch}),m.branch&&W?(0,t.jsx)("span",{className:"card__meta-sep","aria-hidden":"true",children:"\xb7"}):null,W&&(0,t.jsxs)("a",{href:W.url,target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),className:"card__pr",children:["#",W.number]}),W&&!L&&(O?(0,t.jsx)("span",{className:"inline-block h-[14px] w-16 animate-pulse rounded-full bg-[var(--color-bg-subtle)]"}):(0,t.jsxs)("span",{className:"card__diff inline-flex items-center",children:[(0,t.jsxs)("span",{className:"card__diff-add",children:["+",W.additions]})," ",(0,t.jsxs)("span",{className:"card__diff-del",children:["-",W.deletions]})," ",(0,t.jsx)("span",{className:"card__diff-size",children:(0,h.i_)(W.additions,W.deletions)}),(0,t.jsx)("span",{className:"sr-only",children:"+".concat(W.additions," -").concat(W.deletions," ").concat((0,h.i_)(W.additions,W.deletions))})]}))]}),G&&(0,t.jsx)("div",{className:"px-[10px] pb-[5px]",children:"merge"===D||H?(0,t.jsxs)("p",{className:"session-card__secondary session-card__secondary--merge",children:[(0,t.jsx)("svg",{width:"9",height:"9",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M20 6 9 17l-5-5"})}),(0,t.jsx)("span",{children:G})]}):(0,t.jsx)("p",{className:"session-card__secondary",children:G})}),L&&(null==W?void 0:W.state)==="open"&&(0,t.jsx)("div",{className:"px-[10px] pb-[5px]",children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 text-[10px] text-[var(--color-text-muted)]",children:[(0,t.jsxs)("svg",{className:"h-3 w-3 text-[var(--color-text-tertiary)]",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,t.jsx)("path",{d:"M12 8v4M12 16h.01"})]}),"PR data rate limited"]})}),V.length>0&&(0,t.jsx)("div",{className:"card__ci",children:V.map(e=>(0,t.jsxs)("span",{className:"ci-chip ci-chip--pass",children:[(0,t.jsx)("svg",{width:"8",height:"8",fill:"none",stroke:"currentColor",strokeWidth:"2.5",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M20 6 9 17l-5-5"})}),e.name]},e.name))}),!L&&F.length>0&&(0,t.jsx)("div",{className:"card__alerts flex flex-col",children:F.slice(0,3).map(e=>(0,t.jsxs)("div",{className:(0,i.cn)("alert-row","alert-row--".concat(e.type)),children:[(0,t.jsx)("span",{className:"alert-row__icon",children:e.icon}),(0,t.jsxs)("span",{className:"alert-row__text",children:[(0,t.jsxs)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:[void 0!==e.count&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"font-bold",children:e.count})," "]}),e.label]}),e.notified&&(0,t.jsxs)("span",{className:"alert-row__notified",title:"Agent has been notified",children:[" ","\xb7 notified"]})]}),e.actionLabel&&(0,t.jsx)("button",{onClick:s=>{var a;s.stopPropagation(),B(e.key,null!=(a=e.actionMessage)?a:"")},disabled:g===e.key,className:"alert-row__action",children:g===e.key?"sent!":f===e.key?"failed":e.actionLabel})]},e.key))}),"respond"===D&&(0,t.jsxs)("div",{className:"quick-reply",onClick:e=>e.stopPropagation(),children:[m.summary&&!m.summaryIsFallback&&(0,t.jsxs)("div",{className:"card__agent-msg",children:[(0,t.jsx)("svg",{className:"card__agent-msg-icon",width:"10",height:"10",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),(0,t.jsx)("span",{children:m.summary})]}),(0,t.jsx)("a",{href:"/sessions/".concat(encodeURIComponent(m.id)),onClick:e=>e.stopPropagation(),className:"card__view-context",children:"View current context →"}),(0,t.jsxs)("div",{className:"card__presets",children:[(0,t.jsx)("button",{className:"card__preset",onClick:()=>void A("continue"),disabled:null!==k,children:"continue"===k?"Sending...":"continue"===y?"Sent":"Continue"}),(0,t.jsx)("button",{className:"card__preset",onClick:()=>void A("abort"),disabled:null!==k,children:"abort"===k?"Sending...":"abort"===y?"Sent":"Abort"}),(0,t.jsx)("button",{className:"card__preset",onClick:()=>void A("skip"),disabled:null!==k,children:"skip"===k?"Sending...":"skip"===y?"Sent":"Skip"})]}),(0,t.jsx)("div",{className:"card__reply-wrap",children:(0,t.jsx)("textarea",{className:"card__reply",placeholder:null!==k?"Sending...":"Type a reply... (Enter to send)","aria-label":"Type a reply to the agent",value:S,onChange:e=>R(e.target.value),onKeyDown:e=>{E(e)},rows:1,disabled:null!==k})})]}),(0,t.jsxs)("div",{className:"session-card__footer",children:[(0,t.jsx)("span",{className:"card__status min-w-0 truncate",title:null!=(a=m.userPrompt)?a:void 0,children:!m.issueUrl&&m.userPrompt?m.userPrompt.length>60?m.userPrompt.slice(0,60)+"…":m.userPrompt:q}),H&&W?(0,t.jsxs)("button",{onClick:e=>{e.stopPropagation(),null==x||x(W.number)},className:"session-card__control session-card__merge-control",children:[(0,t.jsxs)("svg",{className:"session-card__control-icon",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{cx:"6",cy:"6",r:"2"}),(0,t.jsx)("circle",{cx:"18",cy:"18",r:"2"}),(0,t.jsx)("circle",{cx:"18",cy:"6",r:"2"}),(0,t.jsx)("path",{d:"M8 6h5a3 3 0 0 1 3 3v7"})]}),"Merge PR #",W.number]}):!Z&&(0,t.jsx)("button",{onClick:e=>{if(e.stopPropagation(),!M)return void P(!0);P(!1),null==p||p(m.id)},onMouseLeave:()=>P(!1),onBlur:()=>P(!1),"aria-label":M?"Confirm terminate session":"Terminate session",className:(0,i.cn)("session-card__control session-card__terminate btn--danger",M&&"is-confirming"),children:M?(0,t.jsx)("span",{className:"font-mono text-[10px] font-semibold tracking-[0.04em]",children:"kill?"}):(0,t.jsxs)("svg",{className:"session-card__control-icon",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,t.jsx)("path",{d:"M3 6h18"}),(0,t.jsx)("path",{d:"M8 6V4h8v2"}),(0,t.jsx)("path",{d:"M19 6l-1 14H6L5 6"})]})})]})]})]})},function(e,s){return e.session===s.session&&e.onSend===s.onSend&&e.onKill===s.onKill&&e.onMerge===s.onMerge&&e.onRestore===s.onRestore}),u={merge:{label:"Ready",emptyMessage:"Nothing cleared to land yet."},respond:{label:"Respond",emptyMessage:"No agents need your input."},review:{label:"Review",emptyMessage:"No code waiting for review."},pending:{label:"Pending",emptyMessage:"Nothing blocked."},working:{label:"Working",emptyMessage:"No agents running."},done:{label:"Done",emptyMessage:"No completed sessions."}},p=(0,r.memo)(function(e){let{level:s,sessions:a,onSend:n,onKill:l,onMerge:o,onRestore:i,collapsed:c,onToggle:d,compactMobile:h,onPreview:p,resetKey:b}=e,v=u[s],j=void 0!==d,[g,_]=(0,r.useState)(!1),f=j&&h&&!g?a.slice(0,5):a,N=a.length-f.length;return((0,r.useEffect)(()=>{c&&_(!1)},[c]),(0,r.useEffect)(()=>{_(!1)},[b]),j)?(0,t.jsxs)("div",{className:"accordion-section".concat(c?" accordion-section--collapsed":" accordion-section--expanded"),"data-level":s,children:[(0,t.jsxs)("button",{type:"button",className:"accordion-header",onClick:()=>d(s),"aria-expanded":!c,"aria-controls":"accordion-body-".concat(s),children:[(0,t.jsx)("span",{className:"accordion-header__dot","data-level":s}),(0,t.jsx)("span",{className:"accordion-header__label",children:v.label}),(0,t.jsx)("span",{className:"accordion-header__count",children:a.length}),(0,t.jsx)("span",{className:"accordion-header__chevron","aria-hidden":"true",children:"▶"})]}),(0,t.jsx)("div",{id:"accordion-body-".concat(s),className:"accordion-body",children:a.length>0?(0,t.jsxs)("div",{className:h?"mobile-session-list":"flex flex-col gap-2 p-3",children:[f.map(e=>h?(0,t.jsx)(x,{session:e,level:s,onPreview:p},e.id):(0,t.jsx)(m,{session:e,onSend:n,onKill:l,onMerge:o,onRestore:i},e.id)),h&&N>0?(0,t.jsxs)("button",{type:"button",className:"mobile-session-list__view-all",onClick:()=>_(!0),children:["View all ",a.length]}):null]}):h?(0,t.jsx)("div",{className:"mobile-session-list",children:(0,t.jsx)("div",{className:"mobile-session-list__empty",children:v.emptyMessage})}):null})]}):(0,t.jsxs)("div",{className:"kanban-column","data-level":s,children:[(0,t.jsx)("div",{className:"kanban-column__header",children:(0,t.jsxs)("div",{className:"kanban-column__title-row",children:[(0,t.jsx)("div",{className:"kanban-column__dot","data-level":s}),(0,t.jsx)("span",{className:"kanban-column__title",children:v.label}),(0,t.jsx)("span",{className:"kanban-column__count",children:a.length})]})}),(0,t.jsx)("div",{className:"kanban-column-body",children:a.length>0?(0,t.jsx)("div",{className:"kanban-column__stack",children:a.map(e=>(0,t.jsx)(m,{session:e,onSend:n,onKill:l,onMerge:o,onRestore:i},e.id))}):null})]})},function(e,s){return e.level===s.level&&e.collapsed===s.collapsed&&e.onToggle===s.onToggle&&e.onSend===s.onSend&&e.onKill===s.onKill&&e.onMerge===s.onMerge&&e.onRestore===s.onRestore&&e.compactMobile===s.compactMobile&&e.onPreview===s.onPreview&&e.resetKey===s.resetKey&&e.sessions.length===s.sessions.length&&e.sessions.every((e,a)=>e===s.sessions[a])});function x(e){let{session:s,level:a,onPreview:r}=e,n=[s.branch,s.pr?"PR #".concat(s.pr.number):null,s.issueLabel].filter(Boolean);return(0,t.jsxs)("div",{className:"mobile-session-row",children:[(0,t.jsxs)("button",{type:"button",className:"mobile-session-row__preview",onClick:()=>null==r?void 0:r(s),"aria-label":"Open ".concat((0,c.P)(s)),children:[(0,t.jsxs)("div",{className:"mobile-session-row__line",children:[(0,t.jsx)("span",{className:"mobile-session-row__dot","data-level":a,"aria-hidden":"true"}),(0,t.jsx)("span",{className:"mobile-session-row__title",children:(0,c.P)(s)})]}),(0,t.jsx)("div",{className:"mobile-session-row__meta",children:n.length>0?n.join(" \xb7 "):"No branch or PR metadata"})]}),(0,t.jsxs)("div",{className:"mobile-session-row__side",children:[(0,t.jsx)(b,{session:s,level:a}),(0,t.jsx)("a",{href:"/sessions/".concat(encodeURIComponent(s.id)),className:"mobile-session-row__open","aria-label":"Go to ".concat((0,c.P)(s)),children:(0,t.jsxs)("svg",{className:"mobile-session-row__open-icon",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M4 17V7a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2Z"}),(0,t.jsx)("path",{d:"m8 10 2 2-2 2M12 14h4"})]})})]})]})}function b(e){var s,a;let{session:r,level:n}=e,l=u[n].label.toLowerCase();return"merge"===n&&r.pr&&(0,o.QN)(r.pr)?l="ready":"respond"===n?l="waiting_input"===r.activity?"waiting":"needs input":"review"===n?l=(null==(s=r.pr)?void 0:s.reviewDecision)==="changes_requested"?"changes":"review":"pending"===n?l=(null==(a=r.pr)?void 0:a.unresolvedThreads)?"threads":"pending":"working"===n&&(l="idle"===r.activity?"idle":"active"),(0,t.jsx)("span",{className:"mobile-session-row__chip",children:l})}var v=a(7848),j=a(5309),g=a(5184),_=a(2236);let f=["Working","Pending","Review","Respond","Merge"];function N(e){let{message:s,orchestratorHref:a}=e;return(0,t.jsxs)("div",{className:"board-wrapper",children:[(0,t.jsx)("div",{className:"kanban-ghost","aria-hidden":"true",children:f.map(e=>(0,t.jsx)("div",{className:"kanban-ghost__col",children:(0,t.jsx)("div",{className:"kanban-ghost__head",children:e})},e))}),(0,t.jsx)("div",{className:"board-center",children:(0,t.jsxs)("div",{className:"empty-state",role:"status",children:[(0,t.jsx)("div",{className:"empty-state__icon",children:(0,t.jsxs)("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"12",cy:"5.5",r:"2.5",fill:"rgba(249,115,22,0.18)",stroke:"#f97316",strokeWidth:"1.5"}),(0,t.jsx)("circle",{cx:"5.5",cy:"17",r:"2.5",fill:"var(--color-bg-subtle)",stroke:"var(--color-border-strong)",strokeWidth:"1.5"}),(0,t.jsx)("circle",{cx:"18.5",cy:"17",r:"2.5",fill:"var(--color-bg-subtle)",stroke:"var(--color-border-strong)",strokeWidth:"1.5"}),(0,t.jsx)("line",{x1:"12",y1:"8",x2:"6.7",y2:"14.8",stroke:"rgba(249,115,22,0.22)",strokeWidth:"1",strokeDasharray:"2.5 2"}),(0,t.jsx)("line",{x1:"12",y1:"8",x2:"17.3",y2:"14.8",stroke:"rgba(249,115,22,0.22)",strokeWidth:"1",strokeDasharray:"2.5 2"}),(0,t.jsx)("line",{x1:"7.8",y1:"17",x2:"16.2",y2:"17",stroke:"var(--color-border-subtle)",strokeWidth:"1",strokeDasharray:"2.5 2"})]})}),s?(0,t.jsx)("p",{className:"empty-state__text",children:s}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"empty-state__headline",children:"Ready to orchestrate"}),(0,t.jsx)("p",{className:"empty-state__hint",children:"Open the main orchestrator to start a session and fan out parallel agents across your codebase."}),a?(0,t.jsxs)("a",{href:a,className:"empty-state__cta",children:[(0,t.jsxs)("svg",{width:"12",height:"12",fill:"none",stroke:"currentColor",strokeWidth:"1.6",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"12",cy:"5",r:"2",fill:"currentColor",stroke:"none"}),(0,t.jsx)("path",{d:"M12 7v4M12 11H6M12 11h6M6 11v3M12 11v3M18 11v3"}),(0,t.jsx)("circle",{cx:"6",cy:"17",r:"2"}),(0,t.jsx)("circle",{cx:"12",cy:"17",r:"2"}),(0,t.jsx)("circle",{cx:"18",cy:"17",r:"2"})]}),"Open Orchestrator"]}):null]})]})})]})}function k(e,s){return"SHOW"===s.type?{message:s.message,variant:s.variant,key:s.key}:null}let w=(0,r.createContext)(null);function y(e){let{children:s}=e,[a,n]=(0,r.useReducer)(k,null),l=(0,r.useRef)(null),o=(0,r.useRef)(0);(0,r.useEffect)(()=>()=>{null!==l.current&&clearTimeout(l.current)},[]);let c=(0,r.useCallback)(function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info";null!==l.current&&clearTimeout(l.current),o.current+=1,n({type:"SHOW",message:e,variant:s,key:o.current}),l.current=setTimeout(()=>{n({type:"HIDE"}),l.current=null},3e3)},[]);return(0,t.jsxs)(w.Provider,{value:{showToast:c},children:[s,(0,t.jsx)("div",{className:"toast-container",role:"status","aria-live":"polite","aria-atomic":"true",children:a&&(0,t.jsxs)("div",{className:(0,i.cn)("toast","success"===a.variant&&"toast--success","error"===a.variant&&"toast--error","info"===a.variant&&"toast--info"),children:[(0,t.jsx)("span",{className:"toast__icon","aria-hidden":"true"}),(0,t.jsx)("span",{className:"toast__message",children:a.message})]},a.key)})]})}function C(e){let s=Date.now(),a=Math.floor((s-new Date(e).getTime())/1e3);if(a<60)return"".concat(a,"s ago");let t=Math.floor(a/60);if(t<60)return"".concat(t,"m ago");let r=Math.floor(t/60);if(r<24)return"".concat(r,"h ago");let n=Math.floor(r/24);return"".concat(n,"d ago")}function M(e){return e.replaceAll("_"," ")}function P(e){return null!==e}function S(e){var s,a;let{session:n,mode:l,onCancel:i,onConfirm:d,onRequestKill:h,onMerge:m,isMergeReady:u=!1}=e,p=(0,r.useRef)(null),x=(0,r.useRef)(null),b=(0,r.useRef)(null),v=null!=(a=null==n||null==(s=n.pr)?void 0:s.number)?a:null;if((0,r.useEffect)(()=>{if(!n){b.current=null;return}function e(e){"Escape"===e.key&&i()}return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[n,i]),(0,r.useEffect)(()=>{if(!n||!x.current)return;let e=x.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(0===e.length)return;let s=e[0],a=e[e.length-1],t=b.current!==n.id;function r(e){"Tab"===e.key&&(e.shiftKey&&document.activeElement===s?(e.preventDefault(),a.focus()):e.shiftKey||document.activeElement!==a||(e.preventDefault(),s.focus()))}b.current=n.id,t&&s.focus();let l=x.current;return l.addEventListener("keydown",r),()=>l.removeEventListener("keydown",r)},[n,l]),!n)return null;let j=(0,c.P)(n),g=(0,o.ng)(n),_=n.summary&&!n.summaryIsFallback?n.summary:null,f="done"!==g&&"merge"!==g&&"terminated"!==n.status,N=n.pr,k=!!(N&&!(0,o.fZ)(N)&&!(0,o.sZ)(N)),w="done"===g||"terminated"===n.status||"exited"===n.activity,y=[{label:M(g),tone:"accent"},{label:M(n.status),tone:"neutral"},n.activity?{label:M(n.activity),tone:"neutral"}:null,n.branch?{label:n.branch,tone:"mono"}:null,n.pr?{label:"PR #".concat(n.pr.number),tone:"neutral"}:null,n.issueLabel?{label:n.issueLabel,tone:"neutral"}:null].filter(P);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"bottom-sheet-backdrop",onClick:i,"aria-hidden":"true"}),(0,t.jsxs)("div",{ref:x,className:"bottom-sheet",role:"dialog","aria-modal":"true","aria-labelledby":"bottom-sheet-title",onTouchStart:function(e){var s,a;p.current=null!=(a=null==(s=e.touches[0])?void 0:s.clientY)?a:null},onTouchEnd:function(e){var s,a;if(null===p.current)return;let t=(null!=(a=null==(s=e.changedTouches[0])?void 0:s.clientY)?a:0)-p.current;p.current=null,t>80&&i()},children:[(0,t.jsx)("div",{className:"bottom-sheet__handle","aria-hidden":"true"}),"confirm-kill"===l?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"bottom-sheet__header",children:[(0,t.jsx)("h2",{id:"bottom-sheet-title",className:"bottom-sheet__title",children:"Terminate session?"}),(0,t.jsx)("p",{className:"bottom-sheet__subtitle",children:"This action cannot be undone."})]}),(0,t.jsxs)("div",{className:"bottom-sheet__session-info",children:[(0,t.jsx)("div",{className:"bottom-sheet__session-name",children:j}),(0,t.jsx)("div",{className:"bottom-sheet__session-meta",children:y.map(e=>(0,t.jsx)("span",{className:"bottom-sheet__tag bottom-sheet__tag--".concat(e.tone),children:e.label},"".concat(e.tone,"-").concat(e.label)))}),_?(0,t.jsx)("p",{className:"bottom-sheet__summary",children:_}):null]})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"bottom-sheet__preview-card",children:[(0,t.jsx)("div",{className:"bottom-sheet__preview-strip","data-level":g}),(0,t.jsxs)("div",{className:"bottom-sheet__preview-content",children:[(0,t.jsxs)("div",{className:"bottom-sheet__preview-header",children:[(0,t.jsx)("span",{className:"bottom-sheet__preview-id",children:n.id}),(0,t.jsx)("span",{className:"bottom-sheet__preview-time",children:C(n.lastActivityAt)})]}),(0,t.jsx)("h2",{id:"bottom-sheet-title",className:"bottom-sheet__title",children:j}),(0,t.jsxs)("p",{className:"bottom-sheet__subtitle",children:[M(g)," \xb7 started ",C(n.createdAt)]}),(0,t.jsxs)("div",{className:"bottom-sheet__preview-meta",children:[n.branch?(0,t.jsx)("span",{className:"bottom-sheet__preview-branch",children:n.branch}):null,N?(0,t.jsxs)("span",{className:"bottom-sheet__preview-pr",children:["#",N.number]}):null,k&&N?(0,t.jsxs)("span",{className:"bottom-sheet__preview-diff",children:[(0,t.jsxs)("span",{className:"bottom-sheet__preview-diff-add",children:["+",N.additions]})," ",(0,t.jsxs)("span",{className:"bottom-sheet__preview-diff-del",children:["-",N.deletions]})]}):null]}),k&&N?(0,t.jsxs)("div",{className:"bottom-sheet__preview-pills",children:[(0,t.jsx)("span",{className:"bottom-sheet__tag bottom-sheet__tag--neutral",children:"passing"===N.ciStatus?"CI passing":"failing"===N.ciStatus?"CI failed":"CI pending"}),(0,t.jsx)("span",{className:"bottom-sheet__tag bottom-sheet__tag--accent",children:"approved"===N.reviewDecision?"approved":"changes_requested"===N.reviewDecision?"changes requested":"needs review"}),w?(0,t.jsx)("span",{className:"bottom-sheet__tag bottom-sheet__tag--accent",children:M(n.status)}):null,w&&n.activity?(0,t.jsx)("span",{className:"bottom-sheet__tag bottom-sheet__tag--neutral",children:M(n.activity)}):null]}):(0,t.jsxs)("div",{className:"bottom-sheet__preview-pills",children:[(0,t.jsx)("span",{className:"bottom-sheet__tag bottom-sheet__tag--accent",children:M(n.status)}),n.activity?(0,t.jsx)("span",{className:"bottom-sheet__tag bottom-sheet__tag--neutral",children:M(n.activity)}):null]})]})]}),_?(0,t.jsx)("p",{className:"bottom-sheet__summary",children:_}):null]}),(0,t.jsx)("div",{className:"bottom-sheet__actions",children:"confirm-kill"===l?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{type:"button",className:"bottom-sheet__btn bottom-sheet__btn--cancel",onClick:i,children:"Cancel"}),(0,t.jsx)("button",{type:"button",className:"bottom-sheet__btn bottom-sheet__btn--danger",onClick:d,children:"Terminate"})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("a",{href:"/sessions/".concat(encodeURIComponent(n.id)),className:"bottom-sheet__btn bottom-sheet__btn--primary",children:"Open session"}),u&&n.pr&&m?(0,t.jsx)("button",{type:"button",className:"bottom-sheet__btn bottom-sheet__btn--secondary",onClick:()=>{null!==v&&m(v)},children:"Merge"}):f&&h?(0,t.jsxs)("button",{type:"button",className:"bottom-sheet__btn bottom-sheet__btn--danger",onClick:h,children:[(0,t.jsxs)("svg",{className:"bottom-sheet__btn-icon",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M3 6h18"}),(0,t.jsx)("path",{d:"M8 6V4h8v2"}),(0,t.jsx)("path",{d:"M19 6l-1 14H6L5 6"}),(0,t.jsx)("path",{d:"M10 11v6M14 11v6"})]}),"Terminate"]}):null]})})]})]})}function R(e){let{status:s}=e;return"connected"===s?null:"disconnected"===s?(0,t.jsx)("button",{type:"button",className:"connection-bar connection-bar--disconnected","aria-live":"assertive","aria-atomic":"true",onClick:()=>window.location.reload(),children:"Offline \xb7 tap to retry"}):(0,t.jsx)("div",{className:"connection-bar connection-bar--reconnecting",role:"status","aria-live":"polite","aria-atomic":"true",children:"Reconnecting…"})}var I=a(2537),T=a(1213);let D=["working","pending","review","respond","merge"],W=["respond","merge","review","pending","working"],A=[{value:"all",label:"All"},{value:"respond",label:"Respond"},{value:"merge",label:"Ready"},{value:"review",label:"Review"},{value:"pending",label:"Pending"},{value:"working",label:"Working"}],E=[];function B(e){if(!e)return"just now";let s=new Date(e).getTime();if(!Number.isFinite(s))return"just now";let a=Date.now()-s;if(a<=0)return"just now";let t=Math.floor(a/1e3),r=Math.floor(t/60),n=Math.floor(r/60),l=Math.floor(n/24);return t<60?"".concat(t,"s ago"):r<60?"".concat(r,"m ago"):n<24?"".concat(n,"h ago"):"".concat(l,"d ago")}function L(e){var s;let{session:a,onRestore:r}=e,n=!a.summaryIsFallback&&a.summary||a.issueTitle||a.summary||a.id,l=(null==(s=a.pr)?void 0:s.state)==="merged",o="killed"===a.status||"terminated"===a.status;return(0,t.jsxs)("div",{className:"done-card",children:[(0,t.jsx)("p",{className:"done-card__title",children:n}),(0,t.jsxs)("div",{className:"done-card__meta",children:[(0,t.jsx)("span",{className:"done-card__badge ".concat(o?"done-card__badge--terminated":"done-card__badge--merged"),children:l?"merged":o?"terminated":"done"}),a.pr?(0,t.jsxs)("a",{href:a.pr.url,target:"_blank",rel:"noopener noreferrer",className:"done-card__pr",onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)("svg",{width:"9",height:"9",fill:"none",stroke:"currentColor",strokeWidth:"1.8",viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{cx:"18",cy:"18",r:"3"}),(0,t.jsx)("circle",{cx:"6",cy:"6",r:"3"}),(0,t.jsx)("path",{d:"M6 9v3a6 6 0 0 0 6 6h3"})]}),"#",a.pr.number]}):null,(0,t.jsx)("span",{className:"done-card__age",children:B(a.lastActivityAt)}),(0,t.jsx)("button",{type:"button",className:"done-card__restore",onClick:e=>{e.stopPropagation(),r(a.id)},children:"Restore"})]})]})}function O(e){return(0,o.fZ)(e)||(0,o.sZ)(e)?"":"passing"===e.ciStatus?"CI passing":"failing"===e.ciStatus?"CI failed":"CI pending"}function F(e){return(0,o.fZ)(e)||(0,o.sZ)(e)?"":"approved"===e.reviewDecision?"approved":"changes_requested"===e.reviewDecision?"changes requested":"needs review"}function H(e){let{session:s,level:a,onTap:r}=e,n=!s.summaryIsFallback&&s.summary||s.issueTitle||s.summary||s.id,l=s.pr;return(0,t.jsxs)("button",{type:"button",className:"mobile-feed-card",onClick:()=>r(s),children:[(0,t.jsx)("div",{className:"mobile-feed-card__strip","data-level":a}),(0,t.jsxs)("div",{className:"mobile-feed-card__content",children:[(0,t.jsxs)("div",{className:"mobile-feed-card__header",children:[(0,t.jsx)("span",{className:"mobile-feed-card__id",children:s.id}),(0,t.jsx)("span",{className:"mobile-feed-card__time",children:B(s.lastActivityAt)})]}),(0,t.jsx)("div",{className:"mobile-feed-card__title",children:n}),(0,t.jsxs)("div",{className:"mobile-feed-card__meta",children:[s.branch?(0,t.jsx)("span",{className:"mobile-feed-card__branch",children:s.branch}):null,l?(0,t.jsxs)("span",{className:"mobile-feed-card__pr",children:["#",l.number]}):null,!l||(0,o.fZ)(l)||(0,o.sZ)(l)?null:(0,t.jsxs)("span",{className:"mobile-feed-card__diff",children:[(0,t.jsxs)("span",{style:{color:"var(--color-accent-green)"},children:["+",l.additions]})," ",(0,t.jsxs)("span",{style:{color:"var(--color-accent-red)"},children:["-",l.deletions]})]})]}),!l||(0,o.fZ)(l)||(0,o.sZ)(l)?null:(0,t.jsxs)("div",{className:"mobile-feed-card__pills",children:[O(l)?(0,t.jsx)("span",{className:"mobile-feed-card__pill ".concat((0,o.fZ)(l)||(0,o.sZ)(l)?"":"passing"===l.ciStatus?"mobile-feed-card__pill--green":"failing"===l.ciStatus?"mobile-feed-card__pill--red":"mobile-feed-card__pill--amber"),children:O(l)}):null,F(l)?(0,t.jsx)("span",{className:"mobile-feed-card__pill ".concat((0,o.fZ)(l)||(0,o.sZ)(l)?"":"approved"===l.reviewDecision?"mobile-feed-card__pill--green":"changes_requested"===l.reviewDecision?"mobile-feed-card__pill--red":"mobile-feed-card__pill--amber"),children:F(l)}):null]})]})]})}function Z(e){var s,a,i;let{initialSessions:c,projectId:d,projectName:h,projects:m=[],orchestrators:u}=e,x=null!=u?u:E,b=(0,g.eT)(),f=(0,r.useMemo)(()=>{let e={};for(let s of c)e[s.id]=(0,o.ng)(s);return e},[c]),{sessions:k,connectionStatus:y,sseAttentionLevels:C}=(0,j.D)(c,d,(null==b?void 0:b.status)==="connected"?b.sessions:void 0,f,!1),M=(0,n.useSearchParams)(),P=null!=(s=M.get("session"))?s:void 0,[O,F]=(0,r.useState)(!1),[Z,U]=(0,r.useState)(x),[q,V]=(0,r.useState)([]),[G,J]=(0,r.useState)({}),[Q,Y]=(0,r.useState)(!1),[X,$]=(0,r.useState)(!1),ee=(0,l.U)(l.D),[es,ea]=(0,r.useState)(!1),[et,er]=(0,r.useState)("all"),en=m.length>=1,{showToast:el}=function(){let e=(0,r.useContext)(w);if(!e)throw Error("useToast must be used within a ToastProvider");return e}(),[eo,ei]=(0,r.useState)(null),[ec,ed]=(0,r.useState)(null),[eh,em]=(0,r.useState)(!1),eu=(0,r.useRef)(k);eu.current=k;let ep=m.length>1&&en&&void 0===d,ex=(0,r.useMemo)(()=>{var e;return d&&null!=(e=Z.find(e=>e.projectId===d))?e:null},[Z,d]),eb=(0,T.Jy)("/",d),ev=(0,T.Jy)("/prs",d),ej=ex?"/sessions/".concat(encodeURIComponent(ex.id)):null,eg=(0,r.useMemo)(()=>{if(0===k.length)return null;let e=null,s=-1/0;for(let a of k){let t=new Date(a.lastActivityAt).getTime();Number.isFinite(t)&&!(t<=s)&&(s=t,e=a.lastActivityAt)}return e},[k]),[e_,ef]=(0,r.useState)(!1);(0,r.useEffect)(()=>{ef(!0)},[]);let eN=(0,r.useMemo)(()=>{let e="".concat(k.length," session").concat(1===k.length?"":"s");return e_?"".concat(e," \xb7 ").concat(B(eg)):e},[eg,k.length,e_]),ek=(0,r.useMemo)(()=>ep||!P?k:k.filter(e=>e.id===P),[k,ep,P]),ew=(0,r.useMemo)(()=>{var e;return eo&&null!=(e=k.find(e=>e.id===eo.sessionId))?e:null},[k,eo]),ey=(0,r.useMemo)(()=>ew?ec?{...ew,...ec,status:ew.status,activity:ew.activity,lastActivityAt:ew.lastActivityAt}:ew:null,[ew,ec]);(0,r.useEffect)(()=>{U(e=>(function(e,s){let a=new Map(e.map(e=>[e.projectId,e]));for(let e of s)a.set(e.projectId,e);return[...a.values()]})(e,x))},[x]),(0,r.useEffect)(()=>{let e=(0,v.S)(C),s=null!=h?h:"ao";document.title=e>0?"".concat(s," (").concat(e," need attention)"):s},[C,h]),(0,r.useEffect)(()=>{$(!1)},[M]),(0,r.useEffect)(()=>{eo&&null===ew&&ei(null)},[ew,eo]),(0,r.useEffect)(()=>{eo&&"confirm-kill"===eo.mode&&ey&&"done"===(0,o.ng)(ey)&&ei(null)},[ey,eo]),(0,r.useEffect)(()=>{if(!eo)return void ed(null);let e=!1,s=eo.sessionId,a=async()=>{try{let a=await fetch("/api/sessions/".concat(encodeURIComponent(s)));if(!a.ok)return;let t=await a.json();if(!t||t.id!==s)return;e||ed(t)}catch(e){}};a();let t=setInterval(a,15e3);return()=>{e=!0,clearInterval(t)}},[eo]);let eC=(0,r.useMemo)(()=>{let e={merge:[],respond:[],review:[],pending:[],working:[],done:[]};for(let s of ek)e[(0,o.ng)(s)].push(s);return e},[ek]);(0,r.useEffect)(()=>{ea(!0)},[]);let eM=(0,r.useMemo)(()=>{let e=new Map;for(let s of k){let a=e.get(s.projectId);if(a){a.push(s);continue}e.set(s.projectId,[s])}return e},[k]),eP=(0,r.useMemo)(()=>ep?m.map(e=>{var s,a;let t=null!=(s=eM.get(e.id))?s:[],r={merge:0,respond:0,review:0,pending:0,working:0,done:0};for(let e of t)r[(0,o.ng)(e)]++;return{project:e,orchestrator:null!=(a=Z.find(s=>s.projectId===e.id))?a:null,sessionCount:t.length,openPRCount:t.filter(e=>{var s;return(null==(s=e.pr)?void 0:s.state)==="open"}).length,counts:r}}):[],[Z,ep,m,eM]),eS=(0,r.useCallback)(e=>{var s;if("done"===e)return;er(e);let a=window.matchMedia("(prefers-reduced-motion: reduce)").matches?"instant":"smooth";null==(s=document.getElementById("mobile-board"))||s.scrollIntoView({behavior:a,block:"start"})},[]),eR=(0,r.useMemo)(()=>{let e="all"===et?W:W.filter(e=>e===et),s=[];for(let a of e)for(let e of eC[a])s.push({session:e,level:a});return s},[eC,et]),eI=es&&!ee,eT=(0,r.useCallback)(async(e,s)=>{try{let a=await fetch("/api/sessions/".concat(encodeURIComponent(e),"/send"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:s})});if(!a.ok){let s=await a.text()||"Unknown error";console.error("Failed to send message to ".concat(e,":"),s),el("Send failed: ".concat(s),"error");let t=Error(s);throw t.toastShown=!0,t}}catch(s){throw s instanceof Error&&"toastShown"in s&&s.toastShown||(console.error("Network error sending message to ".concat(e,":"),s),el("Network error while sending message","error")),s}},[el]),eD=(0,r.useCallback)(async e=>{try{let s=await fetch("/api/sessions/".concat(encodeURIComponent(e),"/kill"),{method:"POST"});if(s.ok)el("Session terminated","success");else{let a=await s.text();console.error("Failed to kill ".concat(e,":"),a),el("Terminate failed: ".concat(a),"error")}}catch(s){console.error("Network error killing ".concat(e,":"),s),el("Network error while terminating session","error")}},[el]),eW=(0,r.useCallback)(e=>{var s;let a=null!=(s=eu.current.find(s=>s.id===e))?s:null;if(a){if(!ee)return void eD(a.id);ei({sessionId:a.id,mode:"confirm-kill"})}},[ee,eD]),eA=(0,r.useCallback)(e=>{ei({sessionId:e.id,mode:"preview"})},[]),eE=(0,r.useCallback)(()=>{ei(e=>e?{sessionId:e.sessionId,mode:"confirm-kill"}:e)},[]),eB=(0,r.useCallback)(async()=>{ei(null),ey&&await eD(ey.id)},[ey,eD]),eL=(0,r.useCallback)(async e=>{try{let s=await fetch("/api/prs/".concat(e,"/merge"),{method:"POST"});if(s.ok)el("PR #".concat(e," merged"),"success"),ei(null);else{let a=await s.text();console.error("Failed to merge PR #".concat(e,":"),a),el("Merge failed: ".concat(a),"error");return}}catch(s){console.error("Network error merging PR #".concat(e,":"),s),el("Network error while merging PR","error")}},[el]),eO=(0,r.useCallback)(async e=>{try{let s=await fetch("/api/sessions/".concat(encodeURIComponent(e),"/restore"),{method:"POST"});if(s.ok)el("Session restored","success");else{let a=await s.text();console.error("Failed to restore ".concat(e,":"),a),el("Restore failed: ".concat(a),"error")}}catch(s){console.error("Network error restoring ".concat(e,":"),s),el("Network error while restoring session","error")}},[el]),eF=async e=>{V(s=>s.includes(e.id)?s:[...s,e.id]),J(s=>{let{[e.id]:a,...t}=s;return t});try{let a=await fetch("/api/orchestrators",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:e.id})}),t=await a.json().catch(()=>null);if(!a.ok||!(null==t?void 0:t.orchestrator)){var s;throw Error(null!=(s=null==t?void 0:t.error)?s:"Failed to spawn orchestrator for ".concat(e.name))}let r=t.orchestrator;U(s=>{let a=s.filter(s=>s.projectId!==e.id);return a.push(r),a})}catch(a){let s=a instanceof Error?a.message:"Failed to spawn orchestrator";J(a=>({...a,[e.id]:s})),console.error("Failed to spawn orchestrator for ".concat(e.id,":"),a)}finally{V(s=>s.filter(s=>s!==e.id))}},eH=D.some(e=>eC[e].length>0),eZ=!ep&&!eH,eU=(0,r.useMemo)(()=>k.some(e=>e.pr&&(0,o.fZ)(e.pr)),[k]),eK="agent orchestrator"===(null==h?void 0:h.trim().toLowerCase())?null!=(a=null!=d?d:h)?a:ep?"All projects":"Dashboard":null!=h?h:ep?"All projects":"Dashboard",eq=!ep&&eK.trim().length>0;return ee?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(R,{status:y}),(0,t.jsxs)("div",{className:"dashboard-shell flex h-screen",children:[en&&(0,t.jsx)(_.u,{projects:m,sessions:k,activeProjectId:d,activeSessionId:P,collapsed:Q,onToggleCollapsed:()=>Y(e=>!e),mobileOpen:X,onMobileClose:()=>$(!1)}),(0,t.jsxs)("div",{className:"dashboard-main flex-1 overflow-y-auto",children:[(0,t.jsx)("div",{id:"mobile-dashboard-anchor","aria-hidden":"true"}),(0,t.jsx)(v.u,{sseAttentionLevels:C,projectName:h}),(0,t.jsxs)("section",{className:"dashboard-hero",children:[(0,t.jsx)("div",{className:"dashboard-hero__backdrop"}),(0,t.jsxs)("div",{className:"dashboard-hero__content",children:[en&&(0,t.jsx)("button",{type:"button",className:"mobile-menu-toggle",onClick:()=>$(!0),"aria-label":"Open menu",children:(0,t.jsx)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",className:"h-5 w-5",children:(0,t.jsx)("path",{d:"M4 6h16M4 12h16M4 18h16"})})}),(0,t.jsx)("div",{className:"dashboard-hero__primary",children:(0,t.jsx)("div",{className:"dashboard-hero__heading",children:(0,t.jsxs)("div",{className:"dashboard-hero__copy",children:[(0,t.jsx)("h1",{className:"dashboard-title",children:"Kanban"}),h?(0,t.jsx)("p",{className:"dashboard-subtitle",children:h}):null]})})}),(0,t.jsx)("div",{className:"dashboard-hero__meta",children:(0,t.jsxs)("div",{className:"dashboard-topbar-meta",children:[(0,t.jsx)("span",{className:"dashboard-topbar-summary",children:eN}),eI?(0,t.jsx)("a",{href:ev,className:"dashboard-topbar-link dashboard-prs-link",children:"PRs"}):null,ep||ee||!ej?null:(0,t.jsxs)("a",{href:ej,className:"dashboard-topbar-link dashboard-topbar-link--orchestrator","aria-label":"Orchestrator",children:[(0,t.jsx)("span",{className:"dashboard-topbar-link__chip","aria-hidden":"true",children:"Main"}),(0,t.jsx)("span",{className:"dashboard-topbar-link__label",children:"Orchestrator"}),(0,t.jsx)("span",{className:"dashboard-topbar-link__arrow","aria-hidden":"true",children:"→"})]})]})})]})]}),(0,t.jsxs)("div",{className:"px-4 pt-4 md:px-7 md:pt-6",children:[ee?(0,t.jsxs)("section",{className:"mobile-priority-row","aria-label":"Needs attention",children:[(0,t.jsx)("div",{className:"mobile-priority-row__label",children:"Needs attention"}),(0,t.jsx)(z,{grouped:eC,onPillTap:eS})]}):null,ee?(0,t.jsx)("section",{className:"mobile-filter-row","aria-label":"Dashboard filters",children:A.map(e=>(0,t.jsx)("button",{type:"button",className:"mobile-filter-chip","data-active":et===e.value?"true":"false",onClick:()=>er(e.value),children:e.label},e.value))}):null,eU&&!O&&(0,t.jsxs)("div",{className:"dashboard-alert mb-6 flex items-center gap-2.5 border border-[color-mix(in_srgb,var(--color-status-attention)_25%,transparent)] bg-[var(--color-tint-yellow)] px-3.5 py-2.5 text-[11px] text-[var(--color-status-attention)]",children:[(0,t.jsxs)("svg",{className:"h-3.5 w-3.5 shrink-0",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,t.jsx)("path",{d:"M12 8v4M12 16h.01"})]}),(0,t.jsx)("span",{className:"flex-1",children:"GitHub API rate limited — PR data (CI status, review state, sizes) may be stale. Will retry automatically on next refresh."}),(0,t.jsx)("button",{onClick:()=>F(!0),className:"ml-1 shrink-0 opacity-60 hover:opacity-100","aria-label":"Dismiss",children:(0,t.jsx)("svg",{className:"h-3.5 w-3.5",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M18 6 6 18M6 6l12 12"})})})]}),ep&&(0,t.jsx)(K,{overviews:eP,onSpawnOrchestrator:eF,spawningProjectIds:q,spawnErrors:G}),!ep&&eH&&(0,t.jsx)("div",{className:"kanban-board-wrap",children:ee?(0,t.jsx)("div",{id:"mobile-board",className:"mobile-feed",children:eR.length>0?eR.map(e=>{let{session:s,level:a}=e;return(0,t.jsx)(H,{session:s,level:a,onTap:eA},s.id)}):(0,t.jsx)("div",{className:"mobile-feed-empty",children:"No sessions match this filter."})}):(0,t.jsx)("div",{className:"kanban-board",children:D.map(e=>(0,t.jsx)(p,{level:e,sessions:eC[e],onSend:eT,onKill:eW,onMerge:eL,onRestore:eO},e))})}),!ep&&!eH&&(0,t.jsx)(N,{orchestratorHref:ej}),!ep&&eC.done.length>0&&(0,t.jsxs)("div",{className:"done-bar mt-6",children:[(0,t.jsxs)("button",{type:"button",className:"done-bar__toggle",onClick:()=>em(e=>!e),"aria-expanded":eh,children:[(0,t.jsx)("svg",{className:"done-bar__chevron".concat(eh?" done-bar__chevron--open":""),fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,t.jsx)("path",{d:"m9 18 6-6-6-6"})}),(0,t.jsx)("span",{className:"done-bar__label",children:"Done / Terminated"}),(0,t.jsx)("span",{className:"done-bar__count",children:eC.done.length})]}),eh&&(0,t.jsx)("div",{className:"done-bar__cards",children:eC.done.map(e=>(0,t.jsx)(L,{session:e,onRestore:eO},e.id))})]})]})]})]}),ee?(0,t.jsx)(I.X,{ariaLabel:"Dashboard navigation",activeTab:"dashboard",dashboardHref:eb,prsHref:ev,showOrchestrator:!ep,orchestratorHref:ej}):null,ee?(0,t.jsx)(S,{session:ey,mode:null!=(i=null==eo?void 0:eo.mode)?i:"preview",onConfirm:eB,onCancel:()=>ei(null),onRequestKill:eE,onMerge:eL,isMergeReady:null!=ey&&!!ey.pr&&(0,o.QN)(ey.pr)}):null]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(R,{status:y}),(0,t.jsxs)("div",{className:"dashboard-app-shell",children:[(0,t.jsxs)("header",{className:"dashboard-app-header",children:[en?(0,t.jsx)("button",{type:"button",className:"dashboard-app-sidebar-toggle",onClick:()=>Y(e=>!e),"aria-label":"Toggle sidebar",children:(0,t.jsxs)("svg",{width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"1.75",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,t.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),(0,t.jsx)("path",{d:"M9 3v18"})]})}):null,(0,t.jsxs)("div",{className:"dashboard-app-header__brand",children:[(0,t.jsx)("span",{className:"dashboard-app-header__brand-dot","aria-hidden":"true"}),(0,t.jsx)("span",{children:"Agent Orchestrator"})]}),eq?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"dashboard-app-header__sep","aria-hidden":"true"}),(0,t.jsx)("span",{className:"dashboard-app-header__project",children:eK})]}):null,(0,t.jsx)("div",{className:"dashboard-app-header__spacer"}),(0,t.jsx)("div",{className:"dashboard-app-header__actions",children:!ep&&ej?(0,t.jsxs)("a",{href:ej,className:"dashboard-app-btn dashboard-app-btn--amber","aria-label":"Orchestrator",children:[(0,t.jsxs)("svg",{width:"12",height:"12",fill:"none",stroke:"currentColor",strokeWidth:"1.6",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"12",cy:"5",r:"2",fill:"currentColor",stroke:"none"}),(0,t.jsx)("path",{d:"M12 7v4M12 11H6M12 11h6M6 11v3M12 11v3M18 11v3"}),(0,t.jsx)("circle",{cx:"6",cy:"17",r:"2"}),(0,t.jsx)("circle",{cx:"12",cy:"17",r:"2"}),(0,t.jsx)("circle",{cx:"18",cy:"17",r:"2"})]}),"Orchestrator"]}):null})]}),(0,t.jsxs)("div",{className:"dashboard-shell dashboard-shell--desktop".concat(Q?" dashboard-shell--sidebar-collapsed":""),children:[en&&(0,t.jsx)(_.u,{projects:m,sessions:k,activeProjectId:d,activeSessionId:P,collapsed:Q,onToggleCollapsed:()=>Y(e=>!e),mobileOpen:X,onMobileClose:()=>$(!1)}),(0,t.jsxs)("main",{className:"dashboard-main dashboard-main--desktop",children:[(0,t.jsx)(v.u,{sseAttentionLevels:C,projectName:h}),(0,t.jsxs)("div",{className:"dashboard-main__subhead",children:[(0,t.jsx)("h1",{className:"dashboard-main__title",children:"Dashboard"}),(0,t.jsx)("p",{className:"dashboard-main__subtitle",children:"Live agent sessions, pull requests, and merge status."})]}),(0,t.jsxs)("div",{className:"dashboard-main__body",children:[eU&&!O&&(0,t.jsxs)("div",{className:"dashboard-alert mb-4 flex items-center gap-2.5 border border-[color-mix(in_srgb,var(--color-status-attention)_25%,transparent)] bg-[var(--color-tint-yellow)] px-3.5 py-2.5 text-[11px] text-[var(--color-status-attention)]",children:[(0,t.jsxs)("svg",{className:"h-3.5 w-3.5 shrink-0",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,t.jsx)("path",{d:"M12 8v4M12 16h.01"})]}),(0,t.jsx)("span",{className:"flex-1",children:"GitHub API rate limited — PR data (CI status, review state, sizes) may be stale. Will retry automatically on next refresh."}),(0,t.jsx)("button",{onClick:()=>F(!0),className:"ml-1 shrink-0 opacity-60 hover:opacity-100","aria-label":"Dismiss",children:(0,t.jsx)("svg",{className:"h-3.5 w-3.5",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M18 6 6 18M6 6l12 12"})})})]}),ep&&(0,t.jsx)(K,{overviews:eP,onSpawnOrchestrator:eF,spawningProjectIds:q,spawnErrors:G}),!ep&&eH&&(0,t.jsx)("div",{className:"kanban-board-wrap",children:(0,t.jsx)("div",{className:"kanban-board",children:D.map(e=>(0,t.jsx)(p,{level:e,sessions:eC[e],onSend:eT,onKill:eW,onMerge:eL,onRestore:eO},e))})}),eZ?(0,t.jsx)(N,{orchestratorHref:ej}):null,!ep&&eC.done.length>0&&(0,t.jsxs)("div",{className:"done-bar mt-6",children:[(0,t.jsxs)("button",{type:"button",className:"done-bar__toggle",onClick:()=>em(e=>!e),"aria-expanded":eh,children:[(0,t.jsx)("svg",{className:"done-bar__chevron".concat(eh?" done-bar__chevron--open":""),fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,t.jsx)("path",{d:"m9 18 6-6-6-6"})}),(0,t.jsx)("span",{className:"done-bar__label",children:"Done / Terminated"}),(0,t.jsx)("span",{className:"done-bar__count",children:eC.done.length})]}),eh&&(0,t.jsx)("div",{className:"done-bar__cards",children:eC.done.map(e=>(0,t.jsx)(L,{session:e,onRestore:eO},e.id))})]})]})]})]})]})]})}function U(e){return(0,t.jsx)(y,{children:(0,t.jsx)(Z,{...e})})}function K(e){let{overviews:s,onSpawnOrchestrator:a,spawningProjectIds:r,spawnErrors:n}=e;return(0,t.jsx)("div",{className:"mb-8 grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:s.map(e=>{let{project:s,orchestrator:l,sessionCount:o,openPRCount:i,counts:c}=e;return(0,t.jsxs)("section",{className:"border border-[var(--color-border-default)] bg-[var(--color-bg-surface)] p-4",children:[(0,t.jsxs)("div",{className:"mb-4 flex items-start justify-between gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"text-[14px] font-semibold text-[var(--color-text-primary)]",children:s.name}),(0,t.jsxs)("div",{className:"mt-1 text-[11px] text-[var(--color-text-muted)]",children:[o," active session",1!==o?"s":"",i>0?" \xb7 ".concat(i," open PR").concat(1!==i?"s":""):""]})]}),(0,t.jsx)("a",{href:"/?project=".concat(encodeURIComponent(s.id)),className:"border border-[var(--color-border-default)] px-3 py-1.5 text-[11px] font-medium text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-hover)] hover:no-underline",children:"Open project"})]}),(0,t.jsxs)("div",{className:"mb-4 flex flex-wrap gap-2",children:[(0,t.jsx)(q,{label:"Merge",value:c.merge,tone:"ready"}),(0,t.jsx)(q,{label:"Respond",value:c.respond,tone:"error"}),(0,t.jsx)(q,{label:"Review",value:c.review,tone:"orange"}),(0,t.jsx)(q,{label:"Pending",value:c.pending,tone:"attention"}),(0,t.jsx)(q,{label:"Working",value:c.working,tone:"working"})]}),(0,t.jsxs)("div",{className:"border-t border-[var(--color-border-subtle)] pt-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,t.jsx)("div",{className:"text-[11px] text-[var(--color-text-muted)]",children:l?"Per-project orchestrator available":"No running orchestrator"}),l?(0,t.jsxs)("a",{href:"/sessions/".concat(encodeURIComponent(l.id)),className:"orchestrator-btn flex items-center gap-2 px-3 py-1.5 text-[11px] font-semibold hover:no-underline",children:[(0,t.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-[var(--color-accent)] opacity-80"}),"orchestrator"]}):(0,t.jsx)("button",{type:"button",onClick:()=>void a(s),disabled:r.includes(s.id),className:"orchestrator-btn px-3 py-1.5 text-[11px] font-semibold disabled:cursor-wait disabled:opacity-70",children:r.includes(s.id)?"Spawning...":"Spawn Orchestrator"})]}),n[s.id]?(0,t.jsx)("p",{className:"mt-2 text-[11px] text-[var(--color-status-error)]",children:n[s.id]}):null]})]},s.id)})})}function q(e){let{label:s,value:a,tone:r}=e;return(0,t.jsxs)("div",{className:"min-w-[78px] border border-[var(--color-border-subtle)] px-2.5 py-2",children:[(0,t.jsx)("div",{className:"text-[10px] uppercase tracking-[0.08em] text-[var(--color-text-tertiary)]",children:s}),(0,t.jsx)("div",{className:"project-metric__value mt-1 text-[18px] font-semibold tabular-nums","data-tone":r,children:a})]})}let V=[{level:"respond",label:"respond"},{level:"merge",label:"merge"},{level:"review",label:"review"}];function z(e){let{grouped:s,onPillTap:a}=e,r=V.filter(e=>{let{level:a}=e;return s[a].length>0});return 0===r.length?(0,t.jsx)("div",{role:"status",className:"mobile-action-strip mobile-action-strip--all-good",children:(0,t.jsx)("span",{className:"mobile-action-strip__all-good",children:"All clear — agents are working"})}):(0,t.jsx)("div",{className:"mobile-action-strip",role:"group","aria-label":"Session priorities",children:r.map(e=>{let{level:r,label:n}=e;return(0,t.jsxs)("button",{type:"button",className:"mobile-action-pill",onClick:()=>a(r),"aria-label":"".concat(s[r].length," ").concat(n," — scroll to section"),children:[(0,t.jsx)("span",{className:"mobile-action-pill__dot","data-level":r,"aria-hidden":"true"}),(0,t.jsx)("span",{className:"mobile-action-pill__count","data-level":r,children:s[r].length}),(0,t.jsx)("span",{className:"mobile-action-pill__label",children:n})]},r)})})}}},e=>{e.O(0,[8713,8785,6923,131,1461,7358],()=>e(e.s=5619)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6450],{4579:(e,s,r)=>{Promise.resolve().then(r.bind(r,6195))},6195:(e,s,r)=>{"use strict";r.d(s,{PullRequestsPage:()=>g});var l=r(3817),t=r(6749),a=r(7594),o=r(9120),n=r(545),c=r(5309),d=r(5184),i=r(2236),p=r(6004),m=r(7848),x=r(1237),h=r(2537),b=r(1213);let u=[];function j(e){return"open"===e?"Open PRs":"merged"===e?"Merged PRs":"closed"===e?"Closed PRs":"All PRs"}function g(e){let{initialSessions:s,projectId:r,projectName:g,projects:v=[],orchestrators:N}=e,f=null!=N?N:u,_=(0,d.eT)(),y=(0,t.useMemo)(()=>{let e={};for(let r of s)e[r.id]=(0,n.ng)(r);return e},[s]),{sessions:k,sseAttentionLevels:w}=(0,c.D)(s,r,(null==_?void 0:_.status)==="connected"?_.sessions:void 0,y),P=(0,a.useSearchParams)(),[M,R]=(0,t.useState)(!1),[C,O]=(0,t.useState)(!1),q=(0,o.U)(o.D),S=v.length>1,I=S&&void 0===r,T=(0,t.useMemo)(()=>{var e;return r&&null!=(e=f.find(e=>e.projectId===r))?e:null},[f,r]),[A,E]=(0,t.useState)("all"),F=(0,t.useMemo)(()=>k.filter(e=>!!e.pr).map(e=>e.pr).sort((e,s)=>s.number-e.number),[k]),G=(0,t.useMemo)(()=>F.filter(e=>"open"===e.state),[F]),U=(0,t.useMemo)(()=>F.filter(e=>"merged"===e.state),[F]),H=(0,t.useMemo)(()=>F.filter(e=>"closed"===e.state),[F]),B=(0,b.Jy)("/",r),D=(0,b.Jy)("/prs",r),J=T?"/sessions/".concat(encodeURIComponent(T.id)):null,L="open"===A?G:"merged"===A?U:"closed"===A?H:F;return(0,t.useEffect)(()=>{O(!1)},[P]),(0,l.jsxs)("div",{className:"dashboard-shell flex h-screen".concat(!q&&M?" dashboard-shell--sidebar-collapsed":""),children:[S?(0,l.jsx)(i.u,{projects:v,sessions:k,activeProjectId:r,activeSessionId:void 0,collapsed:M,onToggleCollapsed:()=>R(e=>!e),mobileOpen:C,onMobileClose:()=>O(!1)}):null,(0,l.jsxs)("div",{className:"dashboard-main flex-1 overflow-y-auto px-4 py-4 md:px-7 md:py-6",children:[(0,l.jsx)(m.u,{sseAttentionLevels:w,projectName:g?"".concat(g," PRs"):"Pull Requests"}),q?(0,l.jsxs)("section",{className:"mobile-pr-page-header",children:[(0,l.jsxs)("div",{className:"mobile-pr-page-header__top",children:[(0,l.jsxs)("div",{className:"mobile-pr-page-header__title-row",children:[S?(0,l.jsx)("button",{type:"button",className:"mobile-menu-toggle",onClick:()=>O(!0),"aria-label":"Open menu",children:(0,l.jsx)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",className:"h-5 w-5",children:(0,l.jsx)("path",{d:"M4 6h16M4 12h16M4 18h16"})})}):null,(0,l.jsx)("h1",{className:"mobile-pr-page-header__title",children:g?"".concat(g," PRs"):"Pull Requests"})]}),(0,l.jsxs)("div",{className:"mobile-pr-page-header__meta",children:[(0,l.jsx)("span",{className:"mobile-pr-page-header__count",children:F.length}),(0,l.jsx)(p.U,{})]})]}),(0,l.jsxs)("p",{className:"mobile-pr-page-header__subtitle",children:["Open pull requests created by agents",I?" across projects":" in this project","."]})]}):(0,l.jsxs)("section",{className:"dashboard-hero mb-5",children:[(0,l.jsx)("div",{className:"dashboard-hero__backdrop"}),(0,l.jsxs)("div",{className:"dashboard-hero__content",children:[S?(0,l.jsx)("button",{type:"button",className:"mobile-menu-toggle",onClick:()=>O(!0),"aria-label":"Open menu",children:(0,l.jsx)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",className:"h-5 w-5",children:(0,l.jsx)("path",{d:"M4 6h16M4 12h16M4 18h16"})})}):null,(0,l.jsxs)("div",{className:"dashboard-hero__primary",children:[(0,l.jsx)("div",{className:"dashboard-hero__heading",children:(0,l.jsxs)("div",{children:[(0,l.jsx)("h1",{className:"dashboard-title",children:g?"".concat(g," PRs"):"Pull Requests"}),(0,l.jsxs)("p",{className:"dashboard-subtitle",children:["Open pull requests created by agents",I?" across all projects":" in this project","."]})]})}),(0,l.jsx)("div",{className:"dashboard-stat-cards dashboard-stat-cards--persist-mobile",children:(0,l.jsxs)("div",{className:"dashboard-stat-card",children:[(0,l.jsx)("span",{className:"dashboard-stat-card__value",children:G.length}),(0,l.jsx)("span",{className:"dashboard-stat-card__label",children:"Open PRs"}),(0,l.jsx)("span",{className:"dashboard-stat-card__meta",children:I?"Across all projects":"In this project"})]})})]}),(0,l.jsx)("div",{className:"dashboard-hero__meta",children:(0,l.jsx)("div",{className:"flex items-center gap-3",children:(0,l.jsx)(p.U,{})})})]})]}),(0,l.jsxs)("section",{className:"mx-auto max-w-[900px]",children:[(0,l.jsx)("div",{className:q?"mobile-pr-filter-tabs":"mb-4 flex items-center gap-1.5",children:[{value:"all",label:"All",count:F.length},{value:"open",label:"Open",count:G.length},{value:"merged",label:"Merged",count:U.length},{value:"closed",label:"Closed",count:H.length}].map(e=>{let{value:s,label:r,count:t}=e;return(0,l.jsxs)("button",{type:"button",onClick:()=>E(s),className:q?"mobile-pr-filter-tab":["inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-[11px] font-semibold transition-colors",A===s?"border-[var(--color-border-default)] bg-[var(--color-bg-elevated)] text-[var(--color-text-primary)]":"border-transparent bg-transparent text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)]"].join(" "),"data-active":q?String(A===s):void 0,children:[r,(0,l.jsx)("span",{className:q?"mobile-pr-filter-tab__count":"rounded-full bg-[var(--color-chip-bg)] px-1.5 py-px text-[9.5px] font-mono text-[var(--color-text-muted)]",children:t})]},s)})}),q?(0,l.jsx)("div",{className:"mobile-pr-mobile-layout",children:"all"===A?(0,l.jsxs)(l.Fragment,{children:[G.length>0&&(0,l.jsxs)("section",{className:"mobile-pr-group","aria-label":"Open pull requests",children:[(0,l.jsxs)("div",{className:"mobile-pr-section-header",children:[(0,l.jsx)("span",{children:"Open"}),(0,l.jsx)("span",{children:G.length})]}),(0,l.jsx)("div",{className:"mobile-pr-list",children:G.map(e=>(0,l.jsx)(x.dG,{pr:e},"".concat(e.owner,"/").concat(e.repo,"-").concat(e.number)))})]}),U.length>0&&(0,l.jsxs)("section",{className:"mobile-pr-group","aria-label":"Merged pull requests",children:[(0,l.jsxs)("div",{className:"mobile-pr-section-header",children:[(0,l.jsx)("span",{children:"Merged"}),(0,l.jsx)("span",{children:U.length})]}),(0,l.jsx)("div",{className:"mobile-pr-list",children:U.map(e=>(0,l.jsx)(x.dG,{pr:e,muted:!0},"".concat(e.owner,"/").concat(e.repo,"-").concat(e.number)))})]}),H.length>0&&(0,l.jsxs)("section",{className:"mobile-pr-group","aria-label":"Closed pull requests",children:[(0,l.jsxs)("div",{className:"mobile-pr-section-header",children:[(0,l.jsx)("span",{children:"Closed"}),(0,l.jsx)("span",{children:H.length})]}),(0,l.jsx)("div",{className:"mobile-pr-list",children:H.map(e=>(0,l.jsx)(x.dG,{pr:e,muted:!0},"".concat(e.owner,"/").concat(e.repo,"-").concat(e.number)))})]}),0===F.length&&(0,l.jsx)("div",{className:"mobile-pr-empty",children:"No pull requests yet."})]}):(0,l.jsxs)("section",{className:"mobile-pr-group","aria-label":j(A),children:[(0,l.jsxs)("div",{className:"mobile-pr-section-header",children:[(0,l.jsx)("span",{children:j(A).replace(" PRs","")}),(0,l.jsx)("span",{children:L.length})]}),(0,l.jsx)("div",{className:"mobile-pr-list",children:L.length>0?L.map(e=>(0,l.jsx)(x.dG,{pr:e,muted:"open"!==A},"".concat(e.owner,"/").concat(e.repo,"-").concat(e.number))):(0,l.jsx)("div",{className:"mobile-pr-empty",children:"No pull requests in this view."})})]})}):(0,l.jsx)("div",{className:"overflow-hidden rounded-[7px] border border-[var(--color-border-subtle)]",children:(0,l.jsxs)("table",{className:"w-full border-collapse",children:[(0,l.jsx)("thead",{children:(0,l.jsxs)("tr",{className:"border-b border-[var(--color-border-subtle)] bg-[var(--color-bg-elevated)]",children:[(0,l.jsx)("th",{className:"px-3 py-2 text-left text-[10.5px] font-mono font-500 uppercase tracking-[0.05em] text-[var(--color-text-muted)]",children:"PR"}),(0,l.jsx)("th",{className:"px-3 py-2 text-left text-[10.5px] font-mono font-500 uppercase tracking-[0.05em] text-[var(--color-text-muted)]",children:"Title"}),(0,l.jsx)("th",{className:"px-3 py-2 text-left text-[10.5px] font-mono font-500 uppercase tracking-[0.05em] text-[var(--color-text-muted)]",children:"Size"}),(0,l.jsx)("th",{className:"px-3 py-2 text-left text-[10.5px] font-mono font-500 uppercase tracking-[0.05em] text-[var(--color-text-muted)]",children:"CI"}),(0,l.jsx)("th",{className:"px-3 py-2 text-left text-[10.5px] font-mono font-500 uppercase tracking-[0.05em] text-[var(--color-text-muted)]",children:"Review"}),(0,l.jsx)("th",{className:"px-3 py-2 text-left text-[10.5px] font-mono font-500 uppercase tracking-[0.05em] text-[var(--color-text-muted)]",children:"Threads"})]})}),(0,l.jsxs)("tbody",{children:[("all"===A||"open"===A)&&G.length>0&&(0,l.jsxs)(l.Fragment,{children:["all"===A&&(0,l.jsx)("tr",{children:(0,l.jsx)("td",{colSpan:6,className:"border-b border-[var(--color-border-subtle)] bg-[var(--color-bg-base)] px-3 py-1.5 text-[9.5px] font-mono font-semibold uppercase tracking-[0.06em] text-[var(--color-text-muted)]",children:"Open"})}),G.map(e=>(0,l.jsx)(x.j6,{pr:e},"".concat(e.owner,"/").concat(e.repo,"-").concat(e.number)))]}),("all"===A||"merged"===A)&&U.length>0&&(0,l.jsxs)(l.Fragment,{children:["all"===A&&(0,l.jsx)("tr",{children:(0,l.jsx)("td",{colSpan:6,className:"border-b border-t border-[var(--color-border-subtle)] bg-[var(--color-bg-base)] px-3 py-1.5 text-[9.5px] font-mono font-semibold uppercase tracking-[0.06em] text-[var(--color-text-muted)]",children:"Merged"})}),U.map(e=>(0,l.jsx)(x.j6,{pr:e,muted:!0},"".concat(e.owner,"/").concat(e.repo,"-").concat(e.number)))]}),("all"===A||"closed"===A)&&H.length>0&&(0,l.jsxs)(l.Fragment,{children:["all"===A&&(0,l.jsx)("tr",{children:(0,l.jsx)("td",{colSpan:6,className:"border-b border-t border-[var(--color-border-subtle)] bg-[var(--color-bg-base)] px-3 py-1.5 text-[9.5px] font-mono font-semibold uppercase tracking-[0.06em] text-[var(--color-text-muted)]",children:"Closed"})}),H.map(e=>(0,l.jsx)(x.j6,{pr:e,muted:!0},"".concat(e.owner,"/").concat(e.repo,"-").concat(e.number)))]}),0===F.length&&(0,l.jsx)("tr",{children:(0,l.jsx)("td",{colSpan:6,className:"px-4 py-6 text-[12px] text-[var(--color-text-secondary)]",children:"No pull requests yet."})})]})]})})]})]}),q?(0,l.jsx)(h.X,{ariaLabel:"PR navigation",activeTab:"prs",dashboardHref:B,prsHref:D,showOrchestrator:!I,orchestratorHref:J}):null]})}}},e=>{e.O(0,[8713,8785,6923,131,1461,7358],()=>e(e.s=4579)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[25,64,403,719,816,1097,1105,1214,1337,1762,1797,2007,2079,2438,2985,3675,4209,5214,6681,6849,6865,6946,6999,7462,8301,8581,9002,9492],{687:()=>{}},_=>{_.O(0,[131,1461,7358],()=>_(_.s=687)),_N_E=_.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[824],{1712:(e,s,t)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"default",{enumerable:!0,get:function(){return n}});let a=t(1903)._(t(5864));function n(e,s){var t;let n={};"function"==typeof e&&(n.loader=e);let i={...n,...s};return(0,a.default)({...i,modules:null==(t=i.loadableGenerated)?void 0:t.modules})}("function"==typeof s.default||"object"==typeof s.default&&null!==s.default)&&void 0===s.default.__esModule&&(Object.defineProperty(s.default,"__esModule",{value:!0}),Object.assign(s.default,s),e.exports=s.default)},4562:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>N});var a=t(3817),n=t(6749),i=t(7594),r=t(5425),l=t(9120),o=t(545),c=t(4901),d=t(9891),u=t(7387),h=t(2537),p=t(2236);let m=(0,d.default)(()=>Promise.all([t.e(7120),t.e(9478)]).then(t.bind(t,7097)).then(e=>({default:e.DirectTerminal})),{loadableGenerated:{webpack:()=>[7097]},ssr:!1,loading:()=>(0,a.jsx)("div",{className:"h-[440px] animate-pulse rounded bg-[var(--color-bg-primary)]"})}),f={active:{label:"Active",color:"var(--color-status-working)"},ready:{label:"Ready",color:"var(--color-status-ready)"},idle:{label:"Idle",color:"var(--color-status-idle)"},waiting_input:{label:"Waiting for input",color:"var(--color-status-attention)"},blocked:{label:"Blocked",color:"var(--color-status-error)"},exited:{label:"Exited",color:"var(--color-status-error)"}};function x(e){if(e.includes("\x3c!-- DESCRIPTION START --\x3e")||e.includes("### ")){let s=e.match(/###\s+(.+?)(?:\n|$)/),t=s?s[1].replace(/\*\*/g,"").trim():"Comment",a=e.match(/<!-- DESCRIPTION START -->\s*([\s\S]*?)\s*<!-- DESCRIPTION END -->/);return{title:t,description:a?a[1].trim():e.split("\n")[0]||"No description"}}return{title:"Comment",description:e.trim()}}function v(e){let{headline:s,crumbId:t,activityLabel:n,activityColor:i,branch:r,pr:l,isOrchestrator:o=!1,crumbHref:d,crumbLabel:u,rightSlot:h,onKill:p}=e;return(0,a.jsxs)("div",{className:"session-detail-top-strip",children:[(0,a.jsxs)("div",{className:"session-detail-crumbs",children:[(0,a.jsxs)("a",{href:d,className:"session-detail-crumb-back",children:[(0,a.jsx)("svg",{className:"h-3 w-3 opacity-60",fill:"none",stroke:"currentColor",strokeWidth:"2.5",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{d:"M15 18l-6-6 6-6"})}),u]}),(0,a.jsx)("span",{className:"session-detail-crumb-sep",children:"/"}),(0,a.jsx)("span",{className:"session-detail-crumb-id",children:t}),o?(0,a.jsx)("span",{className:"session-detail-mode-badge",children:"orchestrator"}):null]}),(0,a.jsxs)("div",{className:"session-detail-identity",children:[(0,a.jsxs)("div",{className:"session-detail-identity__info",children:[(0,a.jsx)("h1",{className:"session-detail-identity__title",children:s}),(0,a.jsxs)("div",{className:"session-detail-identity__pills",children:[(0,a.jsxs)("div",{className:(0,c.cn)("session-detail-status-pill",function(e){let s=e.toLowerCase();return"active"===s?"session-detail-status-pill--active":"ready"===s?"session-detail-status-pill--ready":"idle"===s?"session-detail-status-pill--idle":"waiting for input"===s?"session-detail-status-pill--waiting":"blocked"===s||"exited"===s?"session-detail-status-pill--error":"session-detail-status-pill--neutral"}(n)),children:[(0,a.jsx)("span",{className:"session-detail-status-pill__dot",style:{background:i}}),(0,a.jsx)("span",{className:"session-detail-status-pill__label",children:n})]}),r?l?(0,a.jsx)("a",{href:"https://github.com/".concat(l.owner,"/").concat(l.repo,"/tree/").concat(l.branch),target:"_blank",rel:"noopener noreferrer",className:"session-detail-link-pill session-detail-link-pill--branch session-detail-link-pill--branch-link hover:no-underline",children:r}):(0,a.jsx)("span",{className:"session-detail-link-pill session-detail-link-pill--branch",children:r}):null,l?(0,a.jsxs)("a",{href:l.url,target:"_blank",rel:"noopener noreferrer",className:"session-detail-link-pill session-detail-link-pill--pr hover:no-underline",children:["PR #",l.number]}):null,l&&(l.additions>0||l.deletions>0)?(0,a.jsxs)("span",{className:"session-detail-link-pill session-detail-link-pill--diff",children:[(0,a.jsxs)("span",{className:"session-detail-diff--add",children:["+",l.additions]})," ",(0,a.jsxs)("span",{className:"session-detail-diff--del",children:["-",l.deletions]})]}):null]})]}),h?(0,a.jsx)("div",{className:"session-detail-identity__actions session-detail-identity__actions--custom",children:h}):(0,a.jsx)("div",{className:"session-detail-identity__actions",children:p?(0,a.jsxs)("button",{type:"button",className:"session-detail-action-btn session-detail-action-btn--danger",onClick:p,children:[(0,a.jsx)("svg",{className:"h-3.5 w-3.5",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{d:"M3 6h18M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})}),"Kill"]}):null})]})]})}async function j(e,s,t,a){try{let{title:a,description:n}=x(s.body),i="Please address this review comment:\n\nFile: ".concat(s.path,"\nComment: ").concat(a,"\nDescription: ").concat(n,"\n\nComment URL: ").concat(s.url,"\n\nAfter fixing, mark the comment as resolved at ").concat(s.url),r=await fetch("/api/sessions/".concat(encodeURIComponent(e),"/message"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:i})});if(!r.ok)throw Error("HTTP ".concat(r.status));t()}catch(e){console.error("Failed to send message to agent:",e),a()}}function b(e){var s,t,r,c;let{session:d,isOrchestrator:x=!1,orchestratorZones:j,projectOrchestratorId:b=null,projects:_=[],sidebarSessions:N=[]}=e,y=(0,i.useSearchParams)(),w=(0,l.U)(l.D),k="true"===y.get("fullscreen"),[S,C]=(0,n.useState)(!1),[I,P]=(0,n.useState)(!1),O=d.pr,T=o.CM.has(d.status),D=null!=(r=d.activity&&f[d.activity])?r:{label:null!=(t=d.activity)?t:"unknown",color:"var(--color-text-muted)"},M=(0,u.P)(d),E=x?"orchestrator":"agent",R=x?"clamp(400px, 52vh, 620px)":"clamp(380px, 48vh, 560px)",A="opencode"===d.metadata.agent,F="string"==typeof d.metadata.opencodeSessionId&&d.metadata.opencodeSessionId.length>0?d.metadata.opencodeSessionId:void 0,L=F?"/exit\nopencode --session ".concat(F,"\n"):void 0,U=d.projectId?"/?project=".concat(encodeURIComponent(d.projectId)):"/",B=d.projectId?"/prs?project=".concat(encodeURIComponent(d.projectId)):"/prs",H=null!=(c=null==(s=_.find(e=>e.id===d.projectId))?void 0:s.name)?c:d.projectId,W="agent orchestrator"!==H.trim().toLowerCase(),Z=(0,n.useMemo)(()=>x?"/sessions/".concat(encodeURIComponent(d.id)):b?"/sessions/".concat(encodeURIComponent(b)):null,[x,b,d.id]);if((0,n.useEffect)(()=>{let e=window.requestAnimationFrame(()=>P(!0));return()=>{window.cancelAnimationFrame(e),P(!1)}},[d.id]),!w)return(0,a.jsxs)("div",{className:"dashboard-app-shell",children:[(0,a.jsxs)("header",{className:"dashboard-app-header",children:[_.length>0?(0,a.jsx)("button",{type:"button",className:"dashboard-app-sidebar-toggle",onClick:()=>C(e=>!e),"aria-label":"Toggle sidebar",children:(0,a.jsxs)("svg",{width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"1.75",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,a.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),(0,a.jsx)("path",{d:"M9 3v18"})]})}):null,(0,a.jsx)("div",{className:"dashboard-app-header__brand",children:(0,a.jsx)("span",{children:"Agent Orchestrator"})}),W?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"dashboard-app-header__sep","aria-hidden":"true"}),(0,a.jsx)("span",{className:"dashboard-app-header__project",children:H})]}):null,(0,a.jsx)("div",{className:"dashboard-app-header__spacer"}),(0,a.jsx)("div",{className:"dashboard-app-header__actions",children:Z?(0,a.jsxs)("a",{href:Z,className:"dashboard-app-btn dashboard-app-btn--amber","aria-label":"Orchestrator",children:[(0,a.jsxs)("svg",{width:"12",height:"12",fill:"none",stroke:"currentColor",strokeWidth:"1.6",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,a.jsx)("circle",{cx:"12",cy:"5",r:"2",fill:"currentColor",stroke:"none"}),(0,a.jsx)("path",{d:"M12 7v4M12 11H6M12 11h6M6 11v3M12 11v3M18 11v3"}),(0,a.jsx)("circle",{cx:"6",cy:"17",r:"2"}),(0,a.jsx)("circle",{cx:"12",cy:"17",r:"2"}),(0,a.jsx)("circle",{cx:"18",cy:"17",r:"2"})]}),"Orchestrator"]}):null})]}),(0,a.jsxs)("div",{className:"dashboard-shell dashboard-shell--desktop".concat(S?" dashboard-shell--sidebar-collapsed":""),children:[_.length>0?(0,a.jsx)(p.u,{projects:_,sessions:N,activeProjectId:d.projectId,activeSessionId:d.id,collapsed:S,onToggleCollapsed:()=>C(e=>!e)}):null,(0,a.jsx)("div",{className:"dashboard-main dashboard-main--desktop",children:(0,a.jsx)("main",{className:"session-detail-page min-h-0 flex-1 overflow-y-auto bg-[var(--color-bg-base)]",children:(0,a.jsx)("div",{className:"session-detail-layout",children:(0,a.jsxs)("main",{className:"min-w-0",children:[(!x||x&&j)&&(0,a.jsx)(v,{headline:M,crumbId:d.id,activityLabel:D.label,activityColor:D.color,branch:d.branch,pr:O,isOrchestrator:x,crumbHref:U,crumbLabel:"Dashboard",onKill:x?void 0:()=>{}}),O?(0,a.jsx)("section",{id:"session-pr-section",className:"session-detail-pr-section",children:(0,a.jsx)(g,{pr:O,sessionId:d.id,metadata:d.metadata})}):null,(0,a.jsxs)("section",{className:"session-detail-terminal-wrap",children:[(0,a.jsx)("div",{id:"session-terminal-section","aria-hidden":"true"}),(0,a.jsxs)("div",{className:"session-detail-section-label",children:[(0,a.jsx)("div",{className:"session-detail-section-label__bar",style:{background:x?"var(--color-accent)":D.color}}),(0,a.jsx)("span",{className:"session-detail-section-label__text",children:"Live Terminal"})]}),I?T?(0,a.jsx)("div",{className:"terminal-exited-placeholder",style:{height:R},children:(0,a.jsx)("span",{className:"terminal-exited-placeholder__text",children:"Terminal session has ended"})}):(0,a.jsx)(m,{sessionId:d.id,startFullscreen:k,variant:E,appearance:"dark",height:R,isOpenCodeSession:A,reloadCommand:A?L:void 0}):(0,a.jsx)("div",{className:"session-detail-terminal-placeholder",style:{height:R}})]})]})})})})]})]});let q="var(--color-status-working)"===D.color?"color-mix(in srgb, var(--color-status-working) 12%, transparent)":"var(--color-status-attention)"===D.color?"color-mix(in srgb, var(--color-status-attention) 12%, transparent)":"var(--color-status-error)"===D.color?"color-mix(in srgb, var(--color-status-error) 12%, transparent)":"color-mix(in srgb, var(--color-accent) 12%, transparent)";return(0,a.jsxs)("div",{className:"session-detail--terminal-first",children:[(0,a.jsxs)("div",{className:"session-detail__floating-header",children:[(0,a.jsx)("a",{href:U,className:"session-detail__back","aria-label":"Back to dashboard",children:(0,a.jsx)("svg",{width:"18",height:"18",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{d:"M19 12H5M12 19l-7-7 7-7"})})}),(0,a.jsx)("span",{className:"session-detail__status-dot",style:{background:D.color}}),(0,a.jsx)("span",{className:"session-detail__session-id",children:d.id}),(0,a.jsx)("span",{className:"session-detail__status-pill",style:{background:q,color:D.color},children:D.label.toLowerCase()}),(0,a.jsx)("span",{className:"session-detail__time",children:function(e){if(!e)return"just now";let s=new Date(e).getTime();if(!Number.isFinite(s))return"just now";let t=Date.now()-s;if(t<=0)return"just now";let a=Math.floor(t/6e4),n=Math.floor(a/60);return a<1?"just now":a<60?"".concat(a,"m ago"):n<24?"".concat(n,"h ago"):"".concat(Math.floor(n/24),"d ago")}(d.lastActivityAt)})]}),(0,a.jsx)("div",{className:"session-detail__terminal-full".concat(O?" session-detail__terminal-full--with-sheet":""),children:I?T?(0,a.jsx)("div",{className:"terminal-exited-placeholder",style:{height:"100%"},children:(0,a.jsx)("span",{className:"terminal-exited-placeholder__text",children:"Terminal session has ended"})}):(0,a.jsx)(m,{sessionId:d.id,startFullscreen:k,variant:E,appearance:"dark",height:"100%",chromeless:!0,isOpenCodeSession:A,reloadCommand:A?L:void 0}):(0,a.jsx)("div",{className:"session-detail-terminal-placeholder",style:{height:"100%"}})}),O?(0,a.jsxs)("div",{className:"session-detail__bottom-sheet",children:[(0,a.jsx)("div",{className:"session-detail__sheet-handle"}),(0,a.jsxs)("div",{className:"session-detail__sheet-row",children:[(0,a.jsxs)("a",{href:O.url,target:"_blank",rel:"noopener noreferrer",className:"session-detail__sheet-pr",children:["PR #",O.number]}),(0,a.jsxs)("span",{className:"session-detail__sheet-item",children:[(0,a.jsx)("span",{className:"session-detail__sheet-ci-dot",style:{background:(0,o.fZ)(O)||(0,o.sZ)(O)?"var(--color-text-tertiary)":"passing"===O.ciStatus?"var(--color-accent-green)":"failing"===O.ciStatus?"var(--color-accent-red)":"var(--color-status-attention)"}}),(0,o.fZ)(O)||(0,o.sZ)(O)?"CI":"passing"===O.ciStatus?"CI passing":"failing"===O.ciStatus?"CI failed":"CI pending"]}),(0,a.jsx)("span",{className:"session-detail__sheet-item",children:((0,o.fZ)(O)||(0,o.sZ)(O)?"":"approved"===O.reviewDecision?"approved":"changes_requested"===O.reviewDecision?"changes":"review")||"—"})]})]}):null,(0,a.jsx)(h.X,{ariaLabel:"Session navigation",activeTab:x?"orchestrator":void 0,dashboardHref:U,prsHref:B,showOrchestrator:null!==Z,orchestratorHref:Z})]})}function g(e){var s;let{pr:t,sessionId:i,metadata:l}=e,[d,u]=(0,n.useState)(new Set),[h,p]=(0,n.useState)(new Set),[m,f]=(0,n.useState)(new Set),v=(0,n.useRef)(new Map);(0,n.useEffect)(()=>()=>{v.current.forEach(e=>clearTimeout(e)),v.current.clear()},[]);let b=async e=>{p(s=>{let t=new Set(s);return t.delete(e.url),t}),f(s=>{let t=new Set(s);return t.delete(e.url),t}),u(s=>new Set(s).add(e.url)),await j(i,e,()=>{u(s=>{let t=new Set(s);return t.delete(e.url),t}),p(s=>new Set(s).add(e.url));let s=v.current.get(e.url);s&&clearTimeout(s);let t=setTimeout(()=>{p(s=>{let t=new Set(s);return t.delete(e.url),t}),v.current.delete(e.url)},3e3);v.current.set(e.url,t)},()=>{u(s=>{let t=new Set(s);return t.delete(e.url),t}),f(s=>new Set(s).add(e.url));let s=v.current.get(e.url);s&&clearTimeout(s);let t=setTimeout(()=>{f(s=>{let t=new Set(s);return t.delete(e.url),t}),v.current.delete(e.url)},3e3);v.current.set(e.url,t)})},g=(0,o.QN)(t),_=function(e,s){let t=[],a=!!s.lastCIFailureDispatchHash,n="true"===s.lastMergeConflictDispatched,i=!!s.lastPendingReviewDispatchHash,l=s.status,o=e.ciStatus===r.U1.FAILING||"ci_failed"===l,c="changes_requested"===e.reviewDecision||"changes_requested"===l,d="merged"!==e.state&&!e.mergeability.noConflicts;if(o){let s=e.ciChecks.filter(e=>"failed"===e.status).length;t.push({icon:"✗",variant:"fail",text:s>0?"".concat(s," check").concat(1!==s?"s":""," failing"):"CI failing",notified:a})}else e.ciStatus===r.U1.PENDING&&t.push({icon:"●",variant:"warn",text:"CI pending"});return c?t.push({icon:"✗",variant:"fail",text:"Changes requested",notified:i}):e.mergeability.approved||t.push({icon:"○",variant:"muted",text:"Awaiting reviewer"}),d&&t.push({icon:"✗",variant:"fail",text:"Merge conflicts",notified:n}),e.isDraft&&t.push({icon:"○",variant:"muted",text:"Draft"}),t}(t,l),N=null!=(s=t.changedFiles)?s:0;return(0,a.jsxs)("div",{className:(0,c.cn)("session-detail-pr-card",g&&"session-detail-pr-card--green"),children:[(0,a.jsxs)("div",{className:"session-detail-pr-card__row",children:[(0,a.jsxs)("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"session-detail-pr-card__title-link",children:["PR #",t.number,": ",t.title]}),(0,a.jsxs)("span",{className:"session-detail-pr-card__diff-stats",children:[(0,a.jsxs)("span",{className:"session-detail-diff--add",children:["+",t.additions]})," ",(0,a.jsxs)("span",{className:"session-detail-diff--del",children:["-",t.deletions]})]}),N>0&&(0,a.jsxs)("span",{className:"session-detail-pr-card__diff-label",children:[N," file",1!==N?"s":""]}),t.isDraft&&(0,a.jsx)("span",{className:"session-detail-pr-card__diff-label",children:"Draft"}),"merged"===t.state&&(0,a.jsx)("span",{className:"session-detail-pr-card__diff-label",children:"Merged"})]}),(0,a.jsxs)("div",{className:"session-detail-pr-card__details",children:[g?(0,a.jsxs)("div",{className:"session-detail-merge-banner",children:[(0,a.jsx)("svg",{width:"11",height:"11",fill:"none",stroke:"currentColor",strokeWidth:"2.5",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{d:"M20 6L9 17l-5-5"})}),"Ready to merge"]}):_.map(e=>(0,a.jsxs)("span",{className:(0,c.cn)("session-detail-blocker-chip","fail"===e.variant&&"session-detail-blocker-chip--fail","warn"===e.variant&&"session-detail-blocker-chip--warn","muted"===e.variant&&"session-detail-blocker-chip--muted"),children:[e.icon," ",e.text,e.notified&&(0,a.jsx)("span",{className:"session-detail-blocker-chip__note",children:"\xb7 notified"})]},e.text)),t.ciChecks.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"session-detail-pr-sep"}),t.ciChecks.map(e=>(0,a.jsxs)("span",{className:(0,c.cn)("session-detail-ci-chip","passed"===e.status&&"session-detail-ci-chip--pass","failed"===e.status&&"session-detail-ci-chip--fail","pending"===e.status&&"session-detail-ci-chip--pending","passed"!==e.status&&"failed"!==e.status&&"pending"!==e.status&&"session-detail-ci-chip--queued"),children:["passed"===e.status?"✓":"failed"===e.status?"✗":"pending"===e.status?"●":"○"," ",e.name]},e.name))]})]}),t.unresolvedComments.length>0&&(0,a.jsxs)("details",{className:"session-detail-comments-strip",children:[(0,a.jsx)("summary",{children:(0,a.jsxs)("div",{className:"session-detail-comments-strip__toggle",children:[(0,a.jsx)("svg",{className:"session-detail-comments-strip__chevron",fill:"none",stroke:"currentColor",strokeWidth:"2.5",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{d:"M9 5l7 7-7 7"})}),(0,a.jsx)("span",{className:"session-detail-comments-strip__label",children:"Unresolved Comments"}),(0,a.jsx)("span",{className:"session-detail-comments-strip__count",children:t.unresolvedThreads}),(0,a.jsx)("span",{className:"session-detail-comments-strip__hint",children:"click to expand"})]})}),(0,a.jsx)("div",{className:"session-detail-comments-strip__body",children:t.unresolvedComments.map((e,s)=>{let{title:t,description:n}=x(e.body);return(0,a.jsxs)("details",{className:"session-detail-comment",open:0===s,children:[(0,a.jsx)("summary",{children:(0,a.jsxs)("div",{className:"session-detail-comment__row",children:[(0,a.jsx)("svg",{className:"session-detail-comment__chevron",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{d:"M9 5l7 7-7 7"})}),(0,a.jsx)("span",{className:"session-detail-comment__title",children:t}),(0,a.jsxs)("span",{className:"session-detail-comment__author",children:["\xb7 ",e.author]}),(0,a.jsx)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),className:"session-detail-comment__view",children:"view →"})]})}),(0,a.jsxs)("div",{className:"session-detail-comment__body",children:[(0,a.jsx)("div",{className:"session-detail-comment__file",children:e.path}),(0,a.jsx)("p",{className:"session-detail-comment__text",children:n}),(0,a.jsx)("button",{onClick:()=>b(e),disabled:d.has(e.url),className:(0,c.cn)("session-detail-comment__fix-btn",h.has(e.url)&&"session-detail-comment__fix-btn--sent",m.has(e.url)&&"session-detail-comment__fix-btn--error"),children:d.has(e.url)?"Sending…":h.has(e.url)?"Sent ✓":m.has(e.url)?"Failed":"Ask Agent to Fix"})]})]},e.url)})})]})]})}let _={active:"⚡",ready:"\uD83D\uDFE2",idle:"\uD83D\uDCA4",waiting_input:"❓",blocked:"\uD83D\uDEA7",exited:"\uD83D\uDC80"};function N(){var e;let s=(0,i.useParams)().id,[t,l]=(0,n.useState)(null),[c,d]=(0,n.useState)(null),[h,p]=(0,n.useState)(void 0),[m,f]=(0,n.useState)([]),[x,v]=(0,n.useState)([]),[j,g]=(0,n.useState)(!0),[N,y]=(0,n.useState)(null),[w,k]=(0,n.useState)(!1),[S,C]=(0,n.useState)(new Map),I=null!=(e=null==t?void 0:t.projectId)?e:null,P=[...S.values()],O=!!t&&(0,r.tT)(t,S.get(t.projectId),P),T=(0,n.useRef)(null),D=(0,n.useRef)(!1),M=(0,n.useRef)(null),E=(0,n.useRef)(new Map),R=(0,n.useRef)(!1);(0,n.useEffect)(()=>{E.current=S},[S]),(0,n.useEffect)(()=>{fetch("/api/projects").then(e=>e.ok?e.json():null).then(e=>{(null==e?void 0:e.projects)&&(f(e.projects),C(new Map(e.projects.map(e=>{var s;return[e.id,null!=(s=e.sessionPrefix)?s:e.id]}))))}).catch(()=>{})},[]);let A=function(e,s){let[t,a]=(0,n.useState)(null);return(0,n.useEffect)(()=>{a(null);let s=new EventSource("/api/events"),t=!1;return s.onmessage=s=>{if(!t)try{let t=JSON.parse(s.data);if("snapshot"!==t.type)return;let n=t.sessions.find(s=>s.id===e);if(!n)return;a(e=>e&&e.activity===n.activity?e:{activity:n.activity})}catch(e){return}},()=>{t=!0,s.close()}},[e,void 0]),t}(s);(0,n.useEffect)(()=>{t?document.title=function(e,s,t){var a,n;let i,l=e.id,o=void 0!==t?t:e.activity,c=o&&null!=(a=_[o])?a:"",d=[...s.values()];return(0,r.tT)(e,s.get(e.projectId),d)?i="Orchestrator Terminal":(n=(0,u.P)(e),i=n.length>40?n.slice(0,40)+"...":n),c?"".concat(c," ").concat(l," | ").concat(i):"".concat(l," | ").concat(i)}(t,S,null==A?void 0:A.activity):document.title="".concat(s," | Session Detail")},[t,s,S,A]),(0,n.useEffect)(()=>{T.current=I},[I]),(0,n.useEffect)(()=>{D.current=O},[O]);let F=(0,n.useCallback)(async()=>{try{let e=await fetch("/api/sessions/".concat(encodeURIComponent(s)));if(404===e.status){R.current||k(!0),g(!1);return}if(!e.ok)throw Error("HTTP ".concat(e.status));let t=await e.json();l(t),y(null),k(!1),R.current=!0}catch(e){console.error("Failed to fetch session:",e),R.current||y(e instanceof Error?e:Error("Failed to load session"))}finally{g(!1)}},[s]),L=(0,n.useCallback)(async()=>{let e=T.current;if(!e)return;let s=D.current,t="".concat(e,":").concat(s?"orchestrator":"worker");if(s||M.current!==t)try{var a,n,i,l,c;let u=s?"/api/sessions?project=".concat(encodeURIComponent(e)):"/api/sessions?project=".concat(encodeURIComponent(e),"&orchestratorOnly=true"),h=await fetch(u);if(!h.ok)return;let m=await h.json(),f=null!=(i=m.sessions)?i:[],x=null!=(c=null!=(l=m.orchestratorId)?l:null==(n=m.orchestrators)||null==(a=n.find(s=>s.projectId===e))?void 0:a.id)?c:null;if(p(e=>e===x?e:x),!s){M.current=t;return}let v={merge:0,respond:0,review:0,pending:0,working:0,done:0},j=[...E.current.values()];for(let e of f)!(0,r.tT)(e,E.current.get(e.projectId),j)&&v[(0,o.ng)(e)]++;d(v)}catch(e){}},[]),U=(0,n.useCallback)(async()=>{try{var e;let s=await fetch("/api/sessions");if(!s.ok)return;let t=await s.json();v(null!=(e=null==t?void 0:t.sessions)?e:[])}catch(e){}},[]);if((0,n.useEffect)(()=>{O||d(null)},[O]),(0,n.useEffect)(()=>{F(),U();let e=setTimeout(L,2e3);return()=>clearTimeout(e)},[F,L,U]),(0,n.useEffect)(()=>{let e=setInterval(()=>{F(),L(),U()},5e3);return()=>clearInterval(e)},[F,L,U]),j)return(0,a.jsx)("div",{className:"flex min-h-screen items-center justify-center bg-[var(--color-bg-base)]",children:(0,a.jsx)("div",{className:"text-[13px] text-[var(--color-text-tertiary)]",children:"Loading session…"})});if(w)return(0,i.notFound)(),null;if(N)throw N;if(!t)throw Error("Session data was unavailable after loading completed");return(0,a.jsx)(b,{session:t,isOrchestrator:O,orchestratorZones:null!=c?c:void 0,projectOrchestratorId:h,projects:m,sidebarSessions:x})}},5459:(e,s,t)=>{Promise.resolve().then(t.bind(t,4562))},5468:(e,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0}),!function(e,s){for(var t in s)Object.defineProperty(e,t,{enumerable:!0,get:s[t]})}(s,{bindSnapshot:function(){return r},createAsyncLocalStorage:function(){return i},createSnapshot:function(){return l}});let t=Object.defineProperty(Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available"),"__NEXT_ERROR_CODE",{value:"E504",enumerable:!1,configurable:!0});class a{disable(){throw t}getStore(){}run(){throw t}exit(){throw t}enterWith(){throw t}static bind(e){return e}}let n="undefined"!=typeof globalThis&&globalThis.AsyncLocalStorage;function i(){return n?new n:new a}function r(e){return n?n.bind(e):a.bind(e)}function l(){return n?n.snapshot():function(e,...s){return e(...s)}}},5864:(e,s,t)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"default",{enumerable:!0,get:function(){return o}});let a=t(3817),n=t(6749),i=t(6943);function r(e){return{default:e&&"default"in e?e.default:e}}t(6418);let l={loader:()=>Promise.resolve(r(()=>null)),loading:null,ssr:!0},o=function(e){let s={...l,...e},t=(0,n.lazy)(()=>s.loader().then(r)),o=s.loading;function c(e){let r=o?(0,a.jsx)(o,{isLoading:!0,pastDelay:!0,error:null}):null,l=!s.ssr||!!s.loading,c=l?n.Suspense:n.Fragment,d=s.ssr?(0,a.jsxs)(a.Fragment,{children:[null,(0,a.jsx)(t,{...e})]}):(0,a.jsx)(i.BailoutToCSR,{reason:"next/dynamic",children:(0,a.jsx)(t,{...e})});return(0,a.jsx)(c,{...l?{fallback:r}:{},children:d})}return c.displayName="LoadableComponent",c}},6313:(e,s,t)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"workAsyncStorage",{enumerable:!0,get:function(){return a.workAsyncStorageInstance}});let a=t(8394)},6418:(e,s,t)=>{"use strict";function a(e){let{moduleIds:s}=e;return null}Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"PreloadChunks",{enumerable:!0,get:function(){return a}}),t(3817),t(4768),t(6313),t(5152)},6943:(e,s,t)=>{"use strict";function a(e){let{reason:s,children:t}=e;return t}Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"BailoutToCSR",{enumerable:!0,get:function(){return a}}),t(1763)},8394:(e,s,t)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"workAsyncStorageInstance",{enumerable:!0,get:function(){return a}});let a=(0,t(5468).createAsyncLocalStorage)()},9891:(e,s,t)=>{"use strict";t.d(s,{default:()=>n.a});var a=t(1712),n=t.n(a)}},e=>{e.O(0,[8713,8785,131,1461,7358],()=>e(e.s=5459)),_N_E=e.O()}]);