@alexjbarnes/cockpit 0.3.1 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (767) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +10 -2
  3. package/.next/build-manifest.json +4 -4
  4. package/.next/next-server.js.nft.json +1 -1
  5. package/.next/prerender-manifest.json +21 -45
  6. package/.next/react-loadable-manifest.json +279 -267
  7. package/.next/routes-manifest.json +68 -12
  8. package/.next/server/app/(app)/agents/[name]/page.js +3 -3
  9. package/.next/server/app/(app)/agents/[name]/page.js.nft.json +1 -1
  10. package/.next/server/app/(app)/agents/[name]/page_client-reference-manifest.js +1 -1
  11. package/.next/server/app/(app)/agents/page.js +2 -2
  12. package/.next/server/app/(app)/agents/page.js.nft.json +1 -1
  13. package/.next/server/app/(app)/agents/page_client-reference-manifest.js +1 -1
  14. package/.next/server/app/(app)/claude-md/edit/page.js +2 -2
  15. package/.next/server/app/(app)/claude-md/edit/page.js.nft.json +1 -1
  16. package/.next/server/app/(app)/claude-md/edit/page_client-reference-manifest.js +1 -1
  17. package/.next/server/app/(app)/claude-md/page.js +2 -2
  18. package/.next/server/app/(app)/claude-md/page.js.nft.json +1 -1
  19. package/.next/server/app/(app)/claude-md/page_client-reference-manifest.js +1 -1
  20. package/.next/server/app/(app)/commands/[name]/page.js +3 -3
  21. package/.next/server/app/(app)/commands/[name]/page.js.nft.json +1 -1
  22. package/.next/server/app/(app)/commands/[name]/page_client-reference-manifest.js +1 -1
  23. package/.next/server/app/(app)/commands/page.js +2 -2
  24. package/.next/server/app/(app)/commands/page.js.nft.json +1 -1
  25. package/.next/server/app/(app)/commands/page_client-reference-manifest.js +1 -1
  26. package/.next/server/app/(app)/hooks/[event]/page.js +3 -3
  27. package/.next/server/app/(app)/hooks/[event]/page.js.nft.json +1 -1
  28. package/.next/server/app/(app)/hooks/[event]/page_client-reference-manifest.js +1 -1
  29. package/.next/server/app/(app)/hooks/page.js +2 -2
  30. package/.next/server/app/(app)/hooks/page.js.nft.json +1 -1
  31. package/.next/server/app/(app)/hooks/page_client-reference-manifest.js +1 -1
  32. package/.next/server/app/(app)/inbox/[id]/page.js +2 -2
  33. package/.next/server/app/(app)/inbox/[id]/page.js.nft.json +1 -1
  34. package/.next/server/app/(app)/inbox/[id]/page_client-reference-manifest.js +1 -1
  35. package/.next/server/app/(app)/inbox/page.js +2 -2
  36. package/.next/server/app/(app)/inbox/page.js.nft.json +1 -1
  37. package/.next/server/app/(app)/inbox/page_client-reference-manifest.js +1 -1
  38. package/.next/server/app/(app)/jobs/[id]/edit/page.js +2 -2
  39. package/.next/server/app/(app)/jobs/[id]/edit/page.js.nft.json +1 -1
  40. package/.next/server/app/(app)/jobs/[id]/edit/page_client-reference-manifest.js +1 -1
  41. package/.next/server/app/(app)/jobs/[id]/page.js +2 -2
  42. package/.next/server/app/(app)/jobs/[id]/page.js.nft.json +1 -1
  43. package/.next/server/app/(app)/jobs/[id]/page_client-reference-manifest.js +1 -1
  44. package/.next/server/app/(app)/jobs/[id]/runs/[runId]/page.js +2 -2
  45. package/.next/server/app/(app)/jobs/[id]/runs/[runId]/page.js.nft.json +1 -1
  46. package/.next/server/app/(app)/jobs/[id]/runs/[runId]/page_client-reference-manifest.js +1 -1
  47. package/.next/server/app/(app)/jobs/page.js +2 -2
  48. package/.next/server/app/(app)/jobs/page.js.nft.json +1 -1
  49. package/.next/server/app/(app)/jobs/page_client-reference-manifest.js +1 -1
  50. package/.next/server/app/(app)/mcp-servers/[name]/page.js +2 -2
  51. package/.next/server/app/(app)/mcp-servers/[name]/page.js.nft.json +1 -1
  52. package/.next/server/app/(app)/mcp-servers/[name]/page_client-reference-manifest.js +1 -1
  53. package/.next/server/app/(app)/mcp-servers/page.js +2 -2
  54. package/.next/server/app/(app)/mcp-servers/page.js.nft.json +1 -1
  55. package/.next/server/app/(app)/mcp-servers/page_client-reference-manifest.js +1 -1
  56. package/.next/server/app/(app)/page.js +2 -2
  57. package/.next/server/app/(app)/page.js.nft.json +1 -1
  58. package/.next/server/app/(app)/page_client-reference-manifest.js +1 -1
  59. package/.next/server/app/(app)/plugins/page.js +2 -0
  60. package/.next/server/app/(app)/{files → plugins}/page.js.nft.json +1 -1
  61. package/.next/server/app/(app)/plugins/page_client-reference-manifest.js +1 -0
  62. package/.next/server/app/(app)/reviews/[owner]/[repo]/[number]/page.js +4 -4
  63. package/.next/server/app/(app)/reviews/[owner]/[repo]/[number]/page.js.nft.json +1 -1
  64. package/.next/server/app/(app)/reviews/[owner]/[repo]/[number]/page_client-reference-manifest.js +1 -1
  65. package/.next/server/app/(app)/reviews/[owner]/[repo]/page.js +2 -2
  66. package/.next/server/app/(app)/reviews/[owner]/[repo]/page.js.nft.json +1 -1
  67. package/.next/server/app/(app)/reviews/[owner]/[repo]/page_client-reference-manifest.js +1 -1
  68. package/.next/server/app/(app)/reviews/page.js +2 -2
  69. package/.next/server/app/(app)/reviews/page.js.nft.json +1 -1
  70. package/.next/server/app/(app)/reviews/page_client-reference-manifest.js +1 -1
  71. package/.next/server/app/(app)/sessions/[id]/page.js +2 -2
  72. package/.next/server/app/(app)/sessions/[id]/page.js.nft.json +1 -1
  73. package/.next/server/app/(app)/sessions/[id]/page_client-reference-manifest.js +1 -1
  74. package/.next/server/app/(app)/settings/appearance/page.js +2 -2
  75. package/.next/server/app/(app)/settings/appearance/page.js.nft.json +1 -1
  76. package/.next/server/app/(app)/settings/appearance/page_client-reference-manifest.js +1 -1
  77. package/.next/server/app/(app)/settings/notifications/page.js +2 -2
  78. package/.next/server/app/(app)/settings/notifications/page.js.nft.json +1 -1
  79. package/.next/server/app/(app)/settings/notifications/page_client-reference-manifest.js +1 -1
  80. package/.next/server/app/(app)/settings/page.js +2 -2
  81. package/.next/server/app/(app)/settings/page.js.nft.json +1 -1
  82. package/.next/server/app/(app)/settings/page_client-reference-manifest.js +1 -1
  83. package/.next/server/app/(app)/settings/providers/[id]/page.js +2 -2
  84. package/.next/server/app/(app)/settings/providers/[id]/page.js.nft.json +1 -1
  85. package/.next/server/app/(app)/settings/providers/[id]/page_client-reference-manifest.js +1 -1
  86. package/.next/server/app/(app)/settings/providers/new/page.js +2 -2
  87. package/.next/server/app/(app)/settings/providers/new/page.js.nft.json +1 -1
  88. package/.next/server/app/(app)/settings/providers/new/page_client-reference-manifest.js +1 -1
  89. package/.next/server/app/(app)/settings/providers/page.js +2 -2
  90. package/.next/server/app/(app)/settings/providers/page.js.nft.json +1 -1
  91. package/.next/server/app/(app)/settings/providers/page_client-reference-manifest.js +1 -1
  92. package/.next/server/app/(app)/settings/session/page.js +2 -2
  93. package/.next/server/app/(app)/settings/session/page.js.nft.json +1 -1
  94. package/.next/server/app/(app)/settings/session/page_client-reference-manifest.js +1 -1
  95. package/.next/server/app/(app)/skills/[name]/page.js +3 -3
  96. package/.next/server/app/(app)/skills/[name]/page.js.nft.json +1 -1
  97. package/.next/server/app/(app)/skills/[name]/page_client-reference-manifest.js +1 -1
  98. package/.next/server/app/(app)/skills/page.js +2 -2
  99. package/.next/server/app/(app)/skills/page.js.nft.json +1 -1
  100. package/.next/server/app/(app)/skills/page_client-reference-manifest.js +1 -1
  101. package/.next/server/app/_global-error/page.js +3 -3
  102. package/.next/server/app/_global-error/page.js.nft.json +1 -1
  103. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  104. package/.next/server/app/_global-error.html +1 -1
  105. package/.next/server/app/_global-error.rsc +1 -1
  106. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  107. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  108. package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  109. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  110. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  111. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  112. package/.next/server/app/_not-found/page.js +2 -2
  113. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  114. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  115. package/.next/server/app/_not-found.html +1 -1
  116. package/.next/server/app/_not-found.rsc +2 -2
  117. package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  118. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  119. package/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  120. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  121. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  122. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  123. package/.next/server/app/agents.html +1 -1
  124. package/.next/server/app/agents.rsc +4 -4
  125. package/.next/server/app/agents.segments/!KGFwcCk/agents/__PAGE__.segment.rsc +2 -2
  126. package/.next/server/app/agents.segments/!KGFwcCk/agents.segment.rsc +1 -1
  127. package/.next/server/app/agents.segments/!KGFwcCk.segment.rsc +2 -2
  128. package/.next/server/app/agents.segments/_full.segment.rsc +4 -4
  129. package/.next/server/app/agents.segments/_head.segment.rsc +1 -1
  130. package/.next/server/app/agents.segments/_index.segment.rsc +2 -2
  131. package/.next/server/app/agents.segments/_tree.segment.rsc +2 -2
  132. package/.next/server/app/api/agents/[name]/route.js +1 -1
  133. package/.next/server/app/api/agents/route.js +1 -1
  134. package/.next/server/app/api/assistant-session/route.js +1 -0
  135. package/.next/server/app/api/assistant-session/route.js.nft.json +1 -0
  136. package/.next/server/app/api/assistant-session/route_client-reference-manifest.js +1 -0
  137. package/.next/server/app/api/auth/check/route.js +1 -1
  138. package/.next/server/app/api/auth/login/route.js +1 -1
  139. package/.next/server/app/api/auth/setup/route.js +1 -1
  140. package/.next/server/app/api/auth/ws-token/route.js +1 -1
  141. package/.next/server/app/api/btw/route.js +2 -2
  142. package/.next/server/app/api/claude-md/route.js +1 -1
  143. package/.next/server/app/api/commands/[name]/route.js +1 -1
  144. package/.next/server/app/api/commands/route.js +1 -1
  145. package/.next/server/app/api/config/cwd/route.js +1 -0
  146. package/.next/server/app/api/config/cwd/route.js.nft.json +1 -0
  147. package/.next/server/app/api/config/cwd/route_client-reference-manifest.js +1 -0
  148. package/.next/server/app/api/defaults/route.js +1 -1
  149. package/.next/server/app/api/filesystem/browse/route.js +1 -1
  150. package/.next/server/app/api/filesystem/files/route.js +1 -1
  151. package/.next/server/app/api/filesystem/mkdir/route.js +1 -1
  152. package/.next/server/app/api/filesystem/read/route.js +1 -1
  153. package/.next/server/app/api/git/clone/route.js +1 -1
  154. package/.next/server/app/api/git/commit/route.js +1 -1
  155. package/.next/server/app/api/git/diff/route.js +1 -1
  156. package/.next/server/app/api/git/discard/route.js +1 -1
  157. package/.next/server/app/api/git/generate-message/route.js +2 -2
  158. package/.next/server/app/api/git/push/route.js +1 -1
  159. package/.next/server/app/api/git/status/route.js +1 -1
  160. package/.next/server/app/api/github/file-content/route.js +1 -1
  161. package/.next/server/app/api/github/orgs/route.js +1 -1
  162. package/.next/server/app/api/github/prs/checks/route.js +1 -1
  163. package/.next/server/app/api/github/prs/diff/route.js +1 -1
  164. package/.next/server/app/api/github/prs/review/route.js +1 -1
  165. package/.next/server/app/api/github/prs/route.js +1 -1
  166. package/.next/server/app/api/github/prs/view/route.js +1 -1
  167. package/.next/server/app/api/github/repos/route.js +1 -1
  168. package/.next/server/app/api/github/review-session/route.js +1 -1
  169. package/.next/server/app/api/github/review-session/route.js.nft.json +1 -1
  170. package/.next/server/app/api/health/route.js +1 -1
  171. package/.next/server/app/api/hooks/route.js +1 -1
  172. package/.next/server/app/api/inbox/[id]/route.js +1 -5
  173. package/.next/server/app/api/inbox/[id]/route.js.nft.json +1 -1
  174. package/.next/server/app/api/inbox/route.js +1 -5
  175. package/.next/server/app/api/inbox/route.js.nft.json +1 -1
  176. package/.next/server/app/api/jobs/[id]/route.js +1 -1
  177. package/.next/server/app/api/jobs/[id]/route.js.nft.json +1 -1
  178. package/.next/server/app/api/jobs/[id]/runs/[runId]/route.js +1 -1
  179. package/.next/server/app/api/jobs/[id]/runs/[runId]/transcript/route.js +1 -1
  180. package/.next/server/app/api/jobs/[id]/runs/[runId]/transcript/route.js.nft.json +1 -1
  181. package/.next/server/app/api/jobs/[id]/runs/route.js +1 -1
  182. package/.next/server/app/api/jobs/[id]/stop/route.js +1 -0
  183. package/.next/server/app/api/jobs/[id]/stop/route.js.nft.json +1 -0
  184. package/.next/server/app/api/jobs/[id]/stop/route_client-reference-manifest.js +1 -0
  185. package/.next/server/app/api/jobs/[id]/trigger/route.js +1 -1
  186. package/.next/server/app/api/jobs/[id]/trigger/route.js.nft.json +1 -1
  187. package/.next/server/app/api/jobs/mcp-discover/route.js +1 -1
  188. package/.next/server/app/api/jobs/mcp-discover/route.js.nft.json +1 -1
  189. package/.next/server/app/api/jobs/route.js +1 -1
  190. package/.next/server/app/api/jobs/route.js.nft.json +1 -1
  191. package/.next/server/app/api/jobs/status/route.js +1 -1
  192. package/.next/server/app/api/mcp-servers/[name]/route.js +1 -1
  193. package/.next/server/app/api/mcp-servers/[name]/test/route.js +1 -1
  194. package/.next/server/app/api/mcp-servers/[name]/tools/route.js +1 -0
  195. package/.next/server/app/api/mcp-servers/[name]/tools/route.js.nft.json +1 -0
  196. package/.next/server/app/api/mcp-servers/[name]/tools/route_client-reference-manifest.js +1 -0
  197. package/.next/server/app/api/mcp-servers/route.js +1 -1
  198. package/.next/server/app/api/notifications/route.js +1 -1
  199. package/.next/server/app/api/notifications/test/route.js +3 -3
  200. package/.next/server/app/api/plugins/[id]/route.js +1 -0
  201. package/.next/server/app/api/plugins/[id]/route.js.nft.json +1 -0
  202. package/.next/server/app/api/plugins/[id]/route_client-reference-manifest.js +1 -0
  203. package/.next/server/app/api/plugins/install/route.js +1 -0
  204. package/.next/server/app/api/plugins/install/route.js.nft.json +1 -0
  205. package/.next/server/app/api/plugins/install/route_client-reference-manifest.js +1 -0
  206. package/.next/server/app/api/plugins/marketplaces/[name]/route.js +1 -0
  207. package/.next/server/app/api/plugins/marketplaces/[name]/route.js.nft.json +1 -0
  208. package/.next/server/app/api/plugins/marketplaces/[name]/route_client-reference-manifest.js +1 -0
  209. package/.next/server/app/api/plugins/marketplaces/route.js +1 -0
  210. package/.next/server/app/api/plugins/marketplaces/route.js.nft.json +1 -0
  211. package/.next/server/app/api/plugins/marketplaces/route_client-reference-manifest.js +1 -0
  212. package/.next/server/app/api/plugins/route.js +1 -0
  213. package/.next/server/app/api/plugins/route.js.nft.json +1 -0
  214. package/.next/server/app/api/plugins/route_client-reference-manifest.js +1 -0
  215. package/.next/server/app/api/providers/[id]/route.js +1 -1
  216. package/.next/server/app/api/providers/route.js +1 -1
  217. package/.next/server/app/api/reviews/pinned/route.js +1 -1
  218. package/.next/server/app/api/sessions/[id]/context/route.js +1 -1
  219. package/.next/server/app/api/sessions/[id]/context/route.js.nft.json +1 -1
  220. package/.next/server/app/api/sessions/[id]/mcp/route.js +1 -1
  221. package/.next/server/app/api/sessions/[id]/mcp/route.js.nft.json +1 -1
  222. package/.next/server/app/api/sessions/[id]/route.js +1 -1
  223. package/.next/server/app/api/sessions/[id]/route.js.nft.json +1 -1
  224. package/.next/server/app/api/sessions/[id]/search/route.js +1 -1
  225. package/.next/server/app/api/sessions/[id]/search/route.js.nft.json +1 -1
  226. package/.next/server/app/api/sessions/[id]/tabs/route.js +1 -1
  227. package/.next/server/app/api/sessions/bulk-delete/route.js +1 -1
  228. package/.next/server/app/api/sessions/bulk-delete/route.js.nft.json +1 -1
  229. package/.next/server/app/api/sessions/by-ids/route.js +1 -1
  230. package/.next/server/app/api/sessions/by-ids/route.js.nft.json +1 -1
  231. package/.next/server/app/api/sessions/group/route.js +1 -1
  232. package/.next/server/app/api/sessions/group/route.js.nft.json +1 -1
  233. package/.next/server/app/api/sessions/pinned/route.js +1 -1
  234. package/.next/server/app/api/sessions/route.js +1 -1
  235. package/.next/server/app/api/sessions/route.js.nft.json +1 -1
  236. package/.next/server/app/api/sessions/search/route.js +1 -1
  237. package/.next/server/app/api/sessions/search/route.js.nft.json +1 -1
  238. package/.next/server/app/api/sessions/thinking/route.js +1 -1
  239. package/.next/server/app/api/sessions/thinking/route.js.nft.json +1 -1
  240. package/.next/server/app/api/skills/[name]/route.js +1 -1
  241. package/.next/server/app/api/skills/route.js +1 -1
  242. package/.next/server/app/api/terminal/[id]/route.js +1 -1
  243. package/.next/server/app/api/terminal/[id]/route.js.nft.json +1 -1
  244. package/.next/server/app/api/terminal/route.js +1 -1
  245. package/.next/server/app/api/terminal/route.js.nft.json +1 -1
  246. package/.next/server/app/api/usage/route.js +1 -1
  247. package/.next/server/app/api/version/changelog/route.js +1 -1
  248. package/.next/server/app/api/version/cockpit/changelog/route.js +1 -1
  249. package/.next/server/app/api/version/cockpit/route.js +1 -1
  250. package/.next/server/app/api/version/route.js +2 -2
  251. package/.next/server/app/claude-md/edit.html +1 -1
  252. package/.next/server/app/claude-md/edit.rsc +4 -4
  253. package/.next/server/app/claude-md/edit.segments/!KGFwcCk/claude-md/edit/__PAGE__.segment.rsc +2 -2
  254. package/.next/server/app/claude-md/edit.segments/!KGFwcCk/claude-md/edit.segment.rsc +1 -1
  255. package/.next/server/app/claude-md/edit.segments/!KGFwcCk/claude-md.segment.rsc +1 -1
  256. package/.next/server/app/claude-md/edit.segments/!KGFwcCk.segment.rsc +2 -2
  257. package/.next/server/app/claude-md/edit.segments/_full.segment.rsc +4 -4
  258. package/.next/server/app/claude-md/edit.segments/_head.segment.rsc +1 -1
  259. package/.next/server/app/claude-md/edit.segments/_index.segment.rsc +2 -2
  260. package/.next/server/app/claude-md/edit.segments/_tree.segment.rsc +2 -2
  261. package/.next/server/app/claude-md.html +1 -1
  262. package/.next/server/app/claude-md.rsc +4 -4
  263. package/.next/server/app/claude-md.segments/!KGFwcCk/claude-md/__PAGE__.segment.rsc +2 -2
  264. package/.next/server/app/claude-md.segments/!KGFwcCk/claude-md.segment.rsc +1 -1
  265. package/.next/server/app/claude-md.segments/!KGFwcCk.segment.rsc +2 -2
  266. package/.next/server/app/claude-md.segments/_full.segment.rsc +4 -4
  267. package/.next/server/app/claude-md.segments/_head.segment.rsc +1 -1
  268. package/.next/server/app/claude-md.segments/_index.segment.rsc +2 -2
  269. package/.next/server/app/claude-md.segments/_tree.segment.rsc +2 -2
  270. package/.next/server/app/commands.html +1 -1
  271. package/.next/server/app/commands.rsc +4 -4
  272. package/.next/server/app/commands.segments/!KGFwcCk/commands/__PAGE__.segment.rsc +2 -2
  273. package/.next/server/app/commands.segments/!KGFwcCk/commands.segment.rsc +1 -1
  274. package/.next/server/app/commands.segments/!KGFwcCk.segment.rsc +2 -2
  275. package/.next/server/app/commands.segments/_full.segment.rsc +4 -4
  276. package/.next/server/app/commands.segments/_head.segment.rsc +1 -1
  277. package/.next/server/app/commands.segments/_index.segment.rsc +2 -2
  278. package/.next/server/app/commands.segments/_tree.segment.rsc +2 -2
  279. package/.next/server/app/hooks.html +1 -1
  280. package/.next/server/app/hooks.rsc +4 -4
  281. package/.next/server/app/hooks.segments/!KGFwcCk/hooks/__PAGE__.segment.rsc +2 -2
  282. package/.next/server/app/hooks.segments/!KGFwcCk/hooks.segment.rsc +1 -1
  283. package/.next/server/app/hooks.segments/!KGFwcCk.segment.rsc +2 -2
  284. package/.next/server/app/hooks.segments/_full.segment.rsc +4 -4
  285. package/.next/server/app/hooks.segments/_head.segment.rsc +1 -1
  286. package/.next/server/app/hooks.segments/_index.segment.rsc +2 -2
  287. package/.next/server/app/hooks.segments/_tree.segment.rsc +2 -2
  288. package/.next/server/app/inbox.html +1 -1
  289. package/.next/server/app/inbox.rsc +4 -4
  290. package/.next/server/app/inbox.segments/!KGFwcCk/inbox/__PAGE__.segment.rsc +2 -2
  291. package/.next/server/app/inbox.segments/!KGFwcCk/inbox.segment.rsc +1 -1
  292. package/.next/server/app/inbox.segments/!KGFwcCk.segment.rsc +2 -2
  293. package/.next/server/app/inbox.segments/_full.segment.rsc +4 -4
  294. package/.next/server/app/inbox.segments/_head.segment.rsc +1 -1
  295. package/.next/server/app/inbox.segments/_index.segment.rsc +2 -2
  296. package/.next/server/app/inbox.segments/_tree.segment.rsc +2 -2
  297. package/.next/server/app/index.html +1 -1
  298. package/.next/server/app/index.rsc +4 -4
  299. package/.next/server/app/index.segments/!KGFwcCk/__PAGE__.segment.rsc +2 -2
  300. package/.next/server/app/index.segments/!KGFwcCk.segment.rsc +2 -2
  301. package/.next/server/app/index.segments/_full.segment.rsc +4 -4
  302. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  303. package/.next/server/app/index.segments/_index.segment.rsc +2 -2
  304. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  305. package/.next/server/app/jobs.html +1 -1
  306. package/.next/server/app/jobs.rsc +4 -4
  307. package/.next/server/app/jobs.segments/!KGFwcCk/jobs/__PAGE__.segment.rsc +2 -2
  308. package/.next/server/app/jobs.segments/!KGFwcCk/jobs.segment.rsc +1 -1
  309. package/.next/server/app/jobs.segments/!KGFwcCk.segment.rsc +2 -2
  310. package/.next/server/app/jobs.segments/_full.segment.rsc +4 -4
  311. package/.next/server/app/jobs.segments/_head.segment.rsc +1 -1
  312. package/.next/server/app/jobs.segments/_index.segment.rsc +2 -2
  313. package/.next/server/app/jobs.segments/_tree.segment.rsc +2 -2
  314. package/.next/server/app/login/page.js +2 -2
  315. package/.next/server/app/login/page.js.nft.json +1 -1
  316. package/.next/server/app/login/page_client-reference-manifest.js +1 -1
  317. package/.next/server/app/login.html +1 -1
  318. package/.next/server/app/login.rsc +3 -3
  319. package/.next/server/app/login.segments/_full.segment.rsc +3 -3
  320. package/.next/server/app/login.segments/_head.segment.rsc +1 -1
  321. package/.next/server/app/login.segments/_index.segment.rsc +2 -2
  322. package/.next/server/app/login.segments/_tree.segment.rsc +2 -2
  323. package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
  324. package/.next/server/app/login.segments/login.segment.rsc +1 -1
  325. package/.next/server/app/mcp-servers.html +1 -1
  326. package/.next/server/app/mcp-servers.rsc +4 -4
  327. package/.next/server/app/mcp-servers.segments/!KGFwcCk/mcp-servers/__PAGE__.segment.rsc +2 -2
  328. package/.next/server/app/mcp-servers.segments/!KGFwcCk/mcp-servers.segment.rsc +1 -1
  329. package/.next/server/app/mcp-servers.segments/!KGFwcCk.segment.rsc +2 -2
  330. package/.next/server/app/mcp-servers.segments/_full.segment.rsc +4 -4
  331. package/.next/server/app/mcp-servers.segments/_head.segment.rsc +1 -1
  332. package/.next/server/app/mcp-servers.segments/_index.segment.rsc +2 -2
  333. package/.next/server/app/mcp-servers.segments/_tree.segment.rsc +2 -2
  334. package/.next/server/app/plugins.html +1 -0
  335. package/.next/server/app/{changes.meta → plugins.meta} +3 -3
  336. package/.next/server/app/{changes.rsc → plugins.rsc} +4 -4
  337. package/.next/server/app/{files.segments/!KGFwcCk/files → plugins.segments/!KGFwcCk/plugins}/__PAGE__.segment.rsc +2 -2
  338. package/.next/server/app/{changes.segments/!KGFwcCk/changes.segment.rsc → plugins.segments/!KGFwcCk/plugins.segment.rsc} +1 -1
  339. package/.next/server/app/{changes.segments → plugins.segments}/!KGFwcCk.segment.rsc +2 -2
  340. package/.next/server/app/{changes.segments → plugins.segments}/_full.segment.rsc +4 -4
  341. package/.next/server/app/{changes.segments → plugins.segments}/_head.segment.rsc +1 -1
  342. package/.next/server/app/{files.segments → plugins.segments}/_index.segment.rsc +2 -2
  343. package/.next/server/app/{changes.segments → plugins.segments}/_tree.segment.rsc +2 -2
  344. package/.next/server/app/reviews.html +1 -1
  345. package/.next/server/app/reviews.rsc +4 -4
  346. package/.next/server/app/reviews.segments/!KGFwcCk/reviews/__PAGE__.segment.rsc +2 -2
  347. package/.next/server/app/reviews.segments/!KGFwcCk/reviews.segment.rsc +1 -1
  348. package/.next/server/app/reviews.segments/!KGFwcCk.segment.rsc +2 -2
  349. package/.next/server/app/reviews.segments/_full.segment.rsc +4 -4
  350. package/.next/server/app/reviews.segments/_head.segment.rsc +1 -1
  351. package/.next/server/app/reviews.segments/_index.segment.rsc +2 -2
  352. package/.next/server/app/reviews.segments/_tree.segment.rsc +2 -2
  353. package/.next/server/app/settings/appearance.html +1 -1
  354. package/.next/server/app/settings/appearance.rsc +4 -4
  355. package/.next/server/app/settings/appearance.segments/!KGFwcCk/settings/appearance/__PAGE__.segment.rsc +2 -2
  356. package/.next/server/app/settings/appearance.segments/!KGFwcCk/settings/appearance.segment.rsc +1 -1
  357. package/.next/server/app/settings/appearance.segments/!KGFwcCk/settings.segment.rsc +1 -1
  358. package/.next/server/app/settings/appearance.segments/!KGFwcCk.segment.rsc +2 -2
  359. package/.next/server/app/settings/appearance.segments/_full.segment.rsc +4 -4
  360. package/.next/server/app/settings/appearance.segments/_head.segment.rsc +1 -1
  361. package/.next/server/app/settings/appearance.segments/_index.segment.rsc +2 -2
  362. package/.next/server/app/settings/appearance.segments/_tree.segment.rsc +2 -2
  363. package/.next/server/app/settings/notifications.html +1 -1
  364. package/.next/server/app/settings/notifications.rsc +4 -4
  365. package/.next/server/app/settings/notifications.segments/!KGFwcCk/settings/notifications/__PAGE__.segment.rsc +2 -2
  366. package/.next/server/app/settings/notifications.segments/!KGFwcCk/settings/notifications.segment.rsc +1 -1
  367. package/.next/server/app/settings/notifications.segments/!KGFwcCk/settings.segment.rsc +1 -1
  368. package/.next/server/app/settings/notifications.segments/!KGFwcCk.segment.rsc +2 -2
  369. package/.next/server/app/settings/notifications.segments/_full.segment.rsc +4 -4
  370. package/.next/server/app/settings/notifications.segments/_head.segment.rsc +1 -1
  371. package/.next/server/app/settings/notifications.segments/_index.segment.rsc +2 -2
  372. package/.next/server/app/settings/notifications.segments/_tree.segment.rsc +2 -2
  373. package/.next/server/app/settings/providers/new.html +1 -1
  374. package/.next/server/app/settings/providers/new.rsc +4 -4
  375. package/.next/server/app/settings/providers/new.segments/!KGFwcCk/settings/providers/new/__PAGE__.segment.rsc +2 -2
  376. package/.next/server/app/settings/providers/new.segments/!KGFwcCk/settings/providers/new.segment.rsc +1 -1
  377. package/.next/server/app/settings/providers/new.segments/!KGFwcCk/settings/providers.segment.rsc +1 -1
  378. package/.next/server/app/settings/providers/new.segments/!KGFwcCk/settings.segment.rsc +1 -1
  379. package/.next/server/app/settings/providers/new.segments/!KGFwcCk.segment.rsc +2 -2
  380. package/.next/server/app/settings/providers/new.segments/_full.segment.rsc +4 -4
  381. package/.next/server/app/settings/providers/new.segments/_head.segment.rsc +1 -1
  382. package/.next/server/app/settings/providers/new.segments/_index.segment.rsc +2 -2
  383. package/.next/server/app/settings/providers/new.segments/_tree.segment.rsc +2 -2
  384. package/.next/server/app/settings/providers.html +1 -1
  385. package/.next/server/app/settings/providers.rsc +4 -4
  386. package/.next/server/app/settings/providers.segments/!KGFwcCk/settings/providers/__PAGE__.segment.rsc +2 -2
  387. package/.next/server/app/settings/providers.segments/!KGFwcCk/settings/providers.segment.rsc +1 -1
  388. package/.next/server/app/settings/providers.segments/!KGFwcCk/settings.segment.rsc +1 -1
  389. package/.next/server/app/settings/providers.segments/!KGFwcCk.segment.rsc +2 -2
  390. package/.next/server/app/settings/providers.segments/_full.segment.rsc +4 -4
  391. package/.next/server/app/settings/providers.segments/_head.segment.rsc +1 -1
  392. package/.next/server/app/settings/providers.segments/_index.segment.rsc +2 -2
  393. package/.next/server/app/settings/providers.segments/_tree.segment.rsc +2 -2
  394. package/.next/server/app/settings/session.html +1 -1
  395. package/.next/server/app/settings/session.rsc +4 -4
  396. package/.next/server/app/settings/session.segments/!KGFwcCk/settings/session/__PAGE__.segment.rsc +2 -2
  397. package/.next/server/app/settings/session.segments/!KGFwcCk/settings/session.segment.rsc +1 -1
  398. package/.next/server/app/settings/session.segments/!KGFwcCk/settings.segment.rsc +1 -1
  399. package/.next/server/app/settings/session.segments/!KGFwcCk.segment.rsc +2 -2
  400. package/.next/server/app/settings/session.segments/_full.segment.rsc +4 -4
  401. package/.next/server/app/settings/session.segments/_head.segment.rsc +1 -1
  402. package/.next/server/app/settings/session.segments/_index.segment.rsc +2 -2
  403. package/.next/server/app/settings/session.segments/_tree.segment.rsc +2 -2
  404. package/.next/server/app/settings.html +1 -1
  405. package/.next/server/app/settings.rsc +4 -4
  406. package/.next/server/app/settings.segments/!KGFwcCk/settings/__PAGE__.segment.rsc +2 -2
  407. package/.next/server/app/settings.segments/!KGFwcCk/settings.segment.rsc +1 -1
  408. package/.next/server/app/settings.segments/!KGFwcCk.segment.rsc +2 -2
  409. package/.next/server/app/settings.segments/_full.segment.rsc +4 -4
  410. package/.next/server/app/settings.segments/_head.segment.rsc +1 -1
  411. package/.next/server/app/settings.segments/_index.segment.rsc +2 -2
  412. package/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
  413. package/.next/server/app/skills.html +1 -1
  414. package/.next/server/app/skills.rsc +4 -4
  415. package/.next/server/app/skills.segments/!KGFwcCk/skills/__PAGE__.segment.rsc +2 -2
  416. package/.next/server/app/skills.segments/!KGFwcCk/skills.segment.rsc +1 -1
  417. package/.next/server/app/skills.segments/!KGFwcCk.segment.rsc +2 -2
  418. package/.next/server/app/skills.segments/_full.segment.rsc +4 -4
  419. package/.next/server/app/skills.segments/_head.segment.rsc +1 -1
  420. package/.next/server/app/skills.segments/_index.segment.rsc +2 -2
  421. package/.next/server/app/skills.segments/_tree.segment.rsc +2 -2
  422. package/.next/server/app-paths-manifest.json +10 -2
  423. package/.next/server/chunks/1011.js +1 -1
  424. package/.next/server/chunks/1327.js +1 -1
  425. package/.next/server/chunks/1979.js +7 -2
  426. package/.next/server/chunks/2666.js +1 -0
  427. package/.next/server/chunks/3136.js +11 -0
  428. package/.next/server/chunks/319.js +45 -0
  429. package/.next/server/chunks/3445.js +2 -2
  430. package/.next/server/chunks/3764.js +1 -1
  431. package/.next/server/chunks/4053.js +4971 -0
  432. package/.next/server/chunks/4734.js +201 -0
  433. package/.next/server/chunks/5318.js +1 -1
  434. package/.next/server/chunks/5472.js +1 -1
  435. package/.next/server/chunks/6304.js +1 -1
  436. package/.next/server/chunks/6705.js +1 -1
  437. package/.next/server/chunks/7539.js +5 -0
  438. package/.next/server/chunks/7891.js +3 -0
  439. package/.next/server/chunks/8578.js +1 -1
  440. package/.next/server/chunks/8728.js +1 -0
  441. package/.next/server/middleware-build-manifest.js +1 -1
  442. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  443. package/.next/server/pages/404.html +1 -1
  444. package/.next/server/pages/500.html +1 -1
  445. package/.next/server/server-reference-manifest.json +1 -1
  446. package/.next/static/NTa6G91R3HtKCLYuQqdR0/_buildManifest.js +1 -0
  447. package/.next/static/chunks/12644.84908edd1bec8b5a.js +1 -0
  448. package/.next/static/chunks/14371-46bd93e838a73082.js +201 -0
  449. package/.next/static/chunks/1550-2b61396833da3dec.js +25 -0
  450. package/.next/static/chunks/18977.393a8bc1bef44fc4.js +1 -0
  451. package/.next/static/chunks/{2503.bb9d3528c3c7ccae.js → 2503.68e12779c4b14adb.js} +1 -1
  452. package/.next/static/chunks/{27455.1bce740b63d7c3cc.js → 27455.8f2189c777c63368.js} +1 -1
  453. package/.next/static/chunks/33072.3d32bb7b2a85ca9b.js +1 -0
  454. package/.next/static/chunks/39267.0c93a6bed8e46ac0.js +1 -0
  455. package/.next/static/chunks/52333.ff3bf0753b68875e.js +1 -0
  456. package/.next/static/chunks/69940.42e1ca99efc62caf.js +1 -0
  457. package/.next/static/chunks/70400.ffe0412efe741888.js +1 -0
  458. package/.next/static/chunks/7113.336a2a8deabe2aa5.js +1 -0
  459. package/.next/static/chunks/{71642.852436e8f0287b89.js → 71642.e11bcaa30efbf1f2.js} +1 -1
  460. package/.next/static/chunks/{72839.a5325a99f8c12fed.js → 72839.225c36dd5e767a20.js} +1 -1
  461. package/.next/static/chunks/{69427.a0b463c808aa54c8.js → 81272.b0027c9bc80050aa.js} +1 -1
  462. package/.next/static/chunks/85853.421f0c913b3d332b.js +1 -0
  463. package/.next/static/chunks/86155.3c5c1468fa2f446e.js +1 -0
  464. package/.next/static/chunks/86339.ba009abde9765665.js +1 -0
  465. package/.next/static/chunks/86939-ba1fb2321ef9cd80.js +1 -0
  466. package/.next/static/chunks/93794-b87eef7d177fe7b3.js +32 -0
  467. package/.next/static/chunks/989-6074551b2b54a168.js +3 -0
  468. package/.next/static/chunks/app/(app)/agents/[name]/page-2b04446e17990f1a.js +8 -0
  469. package/.next/static/chunks/app/(app)/agents/page-ba23fc2296a7be83.js +1 -0
  470. package/.next/static/chunks/app/(app)/claude-md/edit/page-a281913e0b8add64.js +1 -0
  471. package/.next/static/chunks/app/(app)/claude-md/{page-cd9e2176a12ba241.js → page-2d96e3554ef23d18.js} +1 -1
  472. package/.next/static/chunks/app/(app)/commands/[name]/page-fb34a46c0c086dab.js +6 -0
  473. package/.next/static/chunks/app/(app)/commands/page-3802984c62d8ac69.js +1 -0
  474. package/.next/static/chunks/app/(app)/hooks/[event]/{page-28038323fd29adfa.js → page-9481839e736408cb.js} +2 -2
  475. package/.next/static/chunks/app/(app)/hooks/page-f430735f702c7219.js +1 -0
  476. package/.next/static/chunks/app/(app)/inbox/[id]/page-aadeab885f4845b0.js +1 -0
  477. package/.next/static/chunks/app/(app)/inbox/page-b95594cb0a1a5cac.js +1 -0
  478. package/.next/static/chunks/app/(app)/jobs/[id]/edit/page-cc5a314765daff0b.js +1 -0
  479. package/.next/static/chunks/app/(app)/jobs/[id]/page-5890d22a832830ae.js +1 -0
  480. package/.next/static/chunks/app/(app)/jobs/[id]/runs/[runId]/page-0b99d3ca8a0db5a4.js +1 -0
  481. package/.next/static/chunks/app/(app)/jobs/page-3112e52c1cf2a1c6.js +1 -0
  482. package/.next/static/chunks/app/(app)/{layout-ce9e1be301c60fe5.js → layout-62bd7715bd974abb.js} +1 -1
  483. package/.next/static/chunks/app/(app)/mcp-servers/[name]/{page-d6d805a27ec0b0c0.js → page-c8586b1dc6f9824d.js} +1 -1
  484. package/.next/static/chunks/app/(app)/mcp-servers/page-bfc2a6ca8f7968c9.js +1 -0
  485. package/.next/static/chunks/app/(app)/page-7fa2e1ffac49c78b.js +1 -0
  486. package/.next/static/chunks/app/(app)/plugins/page-f37a96c5d3bd20a1.js +1 -0
  487. package/.next/static/chunks/app/(app)/reviews/[owner]/[repo]/[number]/page-9bdb676f496d53bd.js +13 -0
  488. package/.next/static/chunks/app/(app)/reviews/[owner]/[repo]/{page-c5fd013309ab3eba.js → page-200fefe31b935564.js} +1 -1
  489. package/.next/static/chunks/app/(app)/reviews/page-2b8118a506454063.js +1 -0
  490. package/.next/static/chunks/app/(app)/sessions/[id]/page-428e74d62712abe2.js +1 -0
  491. package/.next/static/chunks/app/(app)/settings/appearance/{page-95902da748ac5f1e.js → page-e2b21c857330b047.js} +1 -1
  492. package/.next/static/chunks/app/(app)/settings/notifications/page-4c4e5802b3993e7f.js +1 -0
  493. package/.next/static/chunks/app/(app)/settings/page-3c1d956c719f0160.js +1 -0
  494. package/.next/static/chunks/app/(app)/settings/providers/[id]/page-020f2eab5c3a93ee.js +1 -0
  495. package/.next/static/chunks/app/(app)/settings/providers/new/page-9010d32aeca78d7f.js +1 -0
  496. package/.next/static/chunks/app/(app)/settings/providers/page-d86ebcd6d1cb033d.js +1 -0
  497. package/.next/static/chunks/app/(app)/settings/session/page-174370077dbb9079.js +1 -0
  498. package/.next/static/chunks/app/(app)/skills/[name]/page-dfea5f58b95c01b6.js +6 -0
  499. package/.next/static/chunks/app/(app)/skills/page-c33dbb722dbdf826.js +1 -0
  500. package/.next/static/chunks/app/_global-error/page-bf8153dffcb47d46.js +1 -0
  501. package/.next/static/chunks/app/api/agents/[name]/route-bf8153dffcb47d46.js +1 -0
  502. package/.next/static/chunks/app/api/agents/route-bf8153dffcb47d46.js +1 -0
  503. package/.next/static/chunks/app/api/assistant-session/route-bf8153dffcb47d46.js +1 -0
  504. package/.next/static/chunks/app/api/auth/check/route-bf8153dffcb47d46.js +1 -0
  505. package/.next/static/chunks/app/api/auth/login/route-bf8153dffcb47d46.js +1 -0
  506. package/.next/static/chunks/app/api/auth/setup/route-bf8153dffcb47d46.js +1 -0
  507. package/.next/static/chunks/app/api/auth/ws-token/route-bf8153dffcb47d46.js +1 -0
  508. package/.next/static/chunks/app/api/btw/route-bf8153dffcb47d46.js +1 -0
  509. package/.next/static/chunks/app/api/claude-md/route-bf8153dffcb47d46.js +1 -0
  510. package/.next/static/chunks/app/api/commands/[name]/route-bf8153dffcb47d46.js +1 -0
  511. package/.next/static/chunks/app/api/commands/route-bf8153dffcb47d46.js +1 -0
  512. package/.next/static/chunks/app/api/config/cwd/route-bf8153dffcb47d46.js +1 -0
  513. package/.next/static/chunks/app/api/defaults/route-bf8153dffcb47d46.js +1 -0
  514. package/.next/static/chunks/app/api/filesystem/browse/route-bf8153dffcb47d46.js +1 -0
  515. package/.next/static/chunks/app/api/filesystem/files/route-bf8153dffcb47d46.js +1 -0
  516. package/.next/static/chunks/app/api/filesystem/mkdir/route-bf8153dffcb47d46.js +1 -0
  517. package/.next/static/chunks/app/api/filesystem/read/route-bf8153dffcb47d46.js +1 -0
  518. package/.next/static/chunks/app/api/git/clone/route-bf8153dffcb47d46.js +1 -0
  519. package/.next/static/chunks/app/api/git/commit/route-bf8153dffcb47d46.js +1 -0
  520. package/.next/static/chunks/app/api/git/diff/route-bf8153dffcb47d46.js +1 -0
  521. package/.next/static/chunks/app/api/git/discard/route-bf8153dffcb47d46.js +1 -0
  522. package/.next/static/chunks/app/api/git/generate-message/route-bf8153dffcb47d46.js +1 -0
  523. package/.next/static/chunks/app/api/git/push/route-bf8153dffcb47d46.js +1 -0
  524. package/.next/static/chunks/app/api/git/status/route-bf8153dffcb47d46.js +1 -0
  525. package/.next/static/chunks/app/api/github/file-content/route-bf8153dffcb47d46.js +1 -0
  526. package/.next/static/chunks/app/api/github/orgs/route-bf8153dffcb47d46.js +1 -0
  527. package/.next/static/chunks/app/api/github/prs/checks/route-bf8153dffcb47d46.js +1 -0
  528. package/.next/static/chunks/app/api/github/prs/diff/route-bf8153dffcb47d46.js +1 -0
  529. package/.next/static/chunks/app/api/github/prs/review/route-bf8153dffcb47d46.js +1 -0
  530. package/.next/static/chunks/app/api/github/prs/route-bf8153dffcb47d46.js +1 -0
  531. package/.next/static/chunks/app/api/github/prs/view/route-bf8153dffcb47d46.js +1 -0
  532. package/.next/static/chunks/app/api/github/repos/route-bf8153dffcb47d46.js +1 -0
  533. package/.next/static/chunks/app/api/github/review-session/route-bf8153dffcb47d46.js +1 -0
  534. package/.next/static/chunks/app/api/health/route-bf8153dffcb47d46.js +1 -0
  535. package/.next/static/chunks/app/api/hooks/route-bf8153dffcb47d46.js +1 -0
  536. package/.next/static/chunks/app/api/inbox/[id]/route-bf8153dffcb47d46.js +1 -0
  537. package/.next/static/chunks/app/api/inbox/route-bf8153dffcb47d46.js +1 -0
  538. package/.next/static/chunks/app/api/jobs/[id]/route-bf8153dffcb47d46.js +1 -0
  539. package/.next/static/chunks/app/api/jobs/[id]/runs/[runId]/route-bf8153dffcb47d46.js +1 -0
  540. package/.next/static/chunks/app/api/jobs/[id]/runs/[runId]/transcript/route-bf8153dffcb47d46.js +1 -0
  541. package/.next/static/chunks/app/api/jobs/[id]/runs/route-bf8153dffcb47d46.js +1 -0
  542. package/.next/static/chunks/app/api/jobs/[id]/stop/route-bf8153dffcb47d46.js +1 -0
  543. package/.next/static/chunks/app/api/jobs/[id]/trigger/route-bf8153dffcb47d46.js +1 -0
  544. package/.next/static/chunks/app/api/jobs/mcp-discover/route-bf8153dffcb47d46.js +1 -0
  545. package/.next/static/chunks/app/api/jobs/route-bf8153dffcb47d46.js +1 -0
  546. package/.next/static/chunks/app/api/jobs/status/route-bf8153dffcb47d46.js +1 -0
  547. package/.next/static/chunks/app/api/mcp-servers/[name]/route-bf8153dffcb47d46.js +1 -0
  548. package/.next/static/chunks/app/api/mcp-servers/[name]/test/route-bf8153dffcb47d46.js +1 -0
  549. package/.next/static/chunks/app/api/mcp-servers/[name]/tools/route-bf8153dffcb47d46.js +1 -0
  550. package/.next/static/chunks/app/api/mcp-servers/route-bf8153dffcb47d46.js +1 -0
  551. package/.next/static/chunks/app/api/notifications/route-bf8153dffcb47d46.js +1 -0
  552. package/.next/static/chunks/app/api/notifications/test/route-bf8153dffcb47d46.js +1 -0
  553. package/.next/static/chunks/app/api/plugins/[id]/route-bf8153dffcb47d46.js +1 -0
  554. package/.next/static/chunks/app/api/plugins/install/route-bf8153dffcb47d46.js +1 -0
  555. package/.next/static/chunks/app/api/plugins/marketplaces/[name]/route-bf8153dffcb47d46.js +1 -0
  556. package/.next/static/chunks/app/api/plugins/marketplaces/route-bf8153dffcb47d46.js +1 -0
  557. package/.next/static/chunks/app/api/plugins/route-bf8153dffcb47d46.js +1 -0
  558. package/.next/static/chunks/app/api/providers/[id]/route-bf8153dffcb47d46.js +1 -0
  559. package/.next/static/chunks/app/api/providers/route-bf8153dffcb47d46.js +1 -0
  560. package/.next/static/chunks/app/api/reviews/pinned/route-bf8153dffcb47d46.js +1 -0
  561. package/.next/static/chunks/app/api/sessions/[id]/context/route-bf8153dffcb47d46.js +1 -0
  562. package/.next/static/chunks/app/api/sessions/[id]/mcp/route-bf8153dffcb47d46.js +1 -0
  563. package/.next/static/chunks/app/api/sessions/[id]/route-bf8153dffcb47d46.js +1 -0
  564. package/.next/static/chunks/app/api/sessions/[id]/search/route-bf8153dffcb47d46.js +1 -0
  565. package/.next/static/chunks/app/api/sessions/[id]/tabs/route-bf8153dffcb47d46.js +1 -0
  566. package/.next/static/chunks/app/api/sessions/bulk-delete/route-bf8153dffcb47d46.js +1 -0
  567. package/.next/static/chunks/app/api/sessions/by-ids/route-bf8153dffcb47d46.js +1 -0
  568. package/.next/static/chunks/app/api/sessions/group/route-bf8153dffcb47d46.js +1 -0
  569. package/.next/static/chunks/app/api/sessions/pinned/route-bf8153dffcb47d46.js +1 -0
  570. package/.next/static/chunks/app/api/sessions/route-bf8153dffcb47d46.js +1 -0
  571. package/.next/static/chunks/app/api/sessions/search/route-bf8153dffcb47d46.js +1 -0
  572. package/.next/static/chunks/app/api/sessions/thinking/route-bf8153dffcb47d46.js +1 -0
  573. package/.next/static/chunks/app/api/skills/[name]/route-bf8153dffcb47d46.js +1 -0
  574. package/.next/static/chunks/app/api/skills/route-bf8153dffcb47d46.js +1 -0
  575. package/.next/static/chunks/app/api/terminal/[id]/route-bf8153dffcb47d46.js +1 -0
  576. package/.next/static/chunks/app/api/terminal/route-bf8153dffcb47d46.js +1 -0
  577. package/.next/static/chunks/app/api/usage/route-bf8153dffcb47d46.js +1 -0
  578. package/.next/static/chunks/app/api/version/changelog/route-bf8153dffcb47d46.js +1 -0
  579. package/.next/static/chunks/app/api/version/cockpit/changelog/route-bf8153dffcb47d46.js +1 -0
  580. package/.next/static/chunks/app/api/version/cockpit/route-bf8153dffcb47d46.js +1 -0
  581. package/.next/static/chunks/app/api/version/route-bf8153dffcb47d46.js +1 -0
  582. package/.next/static/chunks/{framework-6fd9f138158c42e0.js → framework-45a1aae1a0f575fd.js} +1 -1
  583. package/.next/static/chunks/{main-5dac9bfffcc23702.js → main-eb9ff0b73c75808a.js} +3 -3
  584. package/.next/static/chunks/next/dist/client/components/builtin/app-error-bf8153dffcb47d46.js +1 -0
  585. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-bf8153dffcb47d46.js +1 -0
  586. package/.next/static/chunks/next/dist/client/components/builtin/not-found-bf8153dffcb47d46.js +1 -0
  587. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-bf8153dffcb47d46.js +1 -0
  588. package/.next/static/chunks/webpack-76a545b642140725.js +1 -0
  589. package/.next/static/css/4cc7360c7e3ca504.css +1 -0
  590. package/README.md +2 -2
  591. package/dist/server.js +10 -0
  592. package/dist/src/lib/cli-commands.js +147 -0
  593. package/dist/src/lib/models.js +57 -1
  594. package/dist/src/lib/paste-detect.js +161 -0
  595. package/dist/src/server/assistant-settings.js +35 -0
  596. package/dist/src/server/claude-bin.js +32 -0
  597. package/dist/src/server/claude-settings.js +3 -0
  598. package/dist/src/server/cli-init-fetch.js +6 -1
  599. package/dist/src/server/inbox.js +2 -2
  600. package/dist/src/server/job-scheduler.js +146 -4
  601. package/dist/src/server/job-storage.js +33 -0
  602. package/dist/src/server/mcp/cockpit-agent-prompt.js +5 -0
  603. package/dist/src/server/mcp/cockpit-config-server.js +632 -0
  604. package/dist/src/server/mcp/run-context.js +23 -0
  605. package/dist/src/server/notifications.js +51 -10
  606. package/dist/src/server/plugins.js +103 -0
  607. package/dist/src/server/providers.js +25 -2
  608. package/dist/src/server/pty-runtime.js +113 -3
  609. package/dist/src/server/pty-session.js +7 -4
  610. package/dist/src/server/session-manager.js +394 -116
  611. package/dist/src/server/singleton.js +9 -0
  612. package/dist/src/server/terminal-buffer.js +17 -0
  613. package/dist/src/server/terminal-manager.js +9 -13
  614. package/dist/src/server/transcript.js +65 -27
  615. package/dist/src/server/ws-handler.js +19 -7
  616. package/next.config.ts +1 -0
  617. package/package.json +3 -2
  618. package/.next/server/app/(app)/changes/page.js +0 -2
  619. package/.next/server/app/(app)/changes/page.js.nft.json +0 -1
  620. package/.next/server/app/(app)/changes/page_client-reference-manifest.js +0 -1
  621. package/.next/server/app/(app)/files/page.js +0 -2
  622. package/.next/server/app/(app)/files/page_client-reference-manifest.js +0 -1
  623. package/.next/server/app/changes.html +0 -1
  624. package/.next/server/app/changes.segments/!KGFwcCk/changes/__PAGE__.segment.rsc +0 -9
  625. package/.next/server/app/changes.segments/_index.segment.rsc +0 -5
  626. package/.next/server/app/files.html +0 -1
  627. package/.next/server/app/files.meta +0 -16
  628. package/.next/server/app/files.rsc +0 -23
  629. package/.next/server/app/files.segments/!KGFwcCk/files.segment.rsc +0 -5
  630. package/.next/server/app/files.segments/!KGFwcCk.segment.rsc +0 -7
  631. package/.next/server/app/files.segments/_full.segment.rsc +0 -23
  632. package/.next/server/app/files.segments/_head.segment.rsc +0 -6
  633. package/.next/server/app/files.segments/_tree.segment.rsc +0 -2
  634. package/.next/server/chunks/3006.js +0 -199
  635. package/.next/server/chunks/4342.js +0 -1
  636. package/.next/server/chunks/4352.js +0 -1
  637. package/.next/server/chunks/4445.js +0 -1
  638. package/.next/server/chunks/63.js +0 -45
  639. package/.next/server/chunks/7782.js +0 -6
  640. package/.next/server/chunks/8148.js +0 -1
  641. package/.next/server/chunks/9599.js +0 -11
  642. package/.next/static/I-rxZaJEzhe3ZUTjSqB11/_buildManifest.js +0 -1
  643. package/.next/static/chunks/18977.a98edaf19c6df2d4.js +0 -1
  644. package/.next/static/chunks/26126-97874904b42befb8.js +0 -1
  645. package/.next/static/chunks/31010-6e87f77b97544424.js +0 -1
  646. package/.next/static/chunks/33072.9c3cd19e8d515dea.js +0 -1
  647. package/.next/static/chunks/3765-d323c6675307a63e.js +0 -20
  648. package/.next/static/chunks/39267.ef60669ade47cf4c.js +0 -1
  649. package/.next/static/chunks/41487-d802643f4a8fad3c.js +0 -199
  650. package/.next/static/chunks/48273-fb393846bb4333c0.js +0 -6
  651. package/.next/static/chunks/52333.f98d1cca9a127b34.js +0 -1
  652. package/.next/static/chunks/6935-f436a624267529fb.js +0 -1
  653. package/.next/static/chunks/70400.1816c247ad90f9bc.js +0 -1
  654. package/.next/static/chunks/7113.39704408fef3d26e.js +0 -1
  655. package/.next/static/chunks/85853.39872899093b140a.js +0 -1
  656. package/.next/static/chunks/86155.40f687f9aaa13854.js +0 -1
  657. package/.next/static/chunks/86339.4dbd51a9b9871f65.js +0 -1
  658. package/.next/static/chunks/86939-dfc6f8eb395caa89.js +0 -1
  659. package/.next/static/chunks/93794-5f89a674d8cefcff.js +0 -32
  660. package/.next/static/chunks/989-94bf2b9d242776c3.js +0 -3
  661. package/.next/static/chunks/app/(app)/agents/[name]/page-8bdd0359043537d4.js +0 -8
  662. package/.next/static/chunks/app/(app)/agents/page-6fcfd7ab6781814e.js +0 -1
  663. package/.next/static/chunks/app/(app)/changes/page-4549a5bd72d77e3e.js +0 -1
  664. package/.next/static/chunks/app/(app)/claude-md/edit/page-08e6e120e71979f4.js +0 -1
  665. package/.next/static/chunks/app/(app)/commands/[name]/page-7cdfdef29ded0aa0.js +0 -6
  666. package/.next/static/chunks/app/(app)/commands/page-f126b608b04747ac.js +0 -1
  667. package/.next/static/chunks/app/(app)/files/page-f526eb95821e000e.js +0 -1
  668. package/.next/static/chunks/app/(app)/hooks/page-f1f39284e53c0344.js +0 -1
  669. package/.next/static/chunks/app/(app)/inbox/[id]/page-bc1ff3a0db0114a4.js +0 -1
  670. package/.next/static/chunks/app/(app)/inbox/page-82e03870103ce9bd.js +0 -1
  671. package/.next/static/chunks/app/(app)/jobs/[id]/edit/page-7fb788f772ff2129.js +0 -1
  672. package/.next/static/chunks/app/(app)/jobs/[id]/page-a5856b9ae967ff59.js +0 -1
  673. package/.next/static/chunks/app/(app)/jobs/[id]/runs/[runId]/page-b7c513402db11db6.js +0 -1
  674. package/.next/static/chunks/app/(app)/jobs/page-e9bbd6c116b9699f.js +0 -1
  675. package/.next/static/chunks/app/(app)/mcp-servers/page-4b7276d43451cd43.js +0 -1
  676. package/.next/static/chunks/app/(app)/page-027a5382da30ddb9.js +0 -1
  677. package/.next/static/chunks/app/(app)/reviews/[owner]/[repo]/[number]/page-9ab2955c455bb5fa.js +0 -13
  678. package/.next/static/chunks/app/(app)/reviews/page-47530d93bb9d4a76.js +0 -1
  679. package/.next/static/chunks/app/(app)/sessions/[id]/page-94f891e1b54fd05f.js +0 -1
  680. package/.next/static/chunks/app/(app)/settings/notifications/page-229f1db6beb1d19c.js +0 -1
  681. package/.next/static/chunks/app/(app)/settings/page-8ed16a66fdde10cd.js +0 -1
  682. package/.next/static/chunks/app/(app)/settings/providers/[id]/page-13654263246617b3.js +0 -1
  683. package/.next/static/chunks/app/(app)/settings/providers/new/page-e1798e321ccbc6df.js +0 -1
  684. package/.next/static/chunks/app/(app)/settings/providers/page-0bb4c1db2ee35b3d.js +0 -1
  685. package/.next/static/chunks/app/(app)/settings/session/page-ab216a8fa37a0f76.js +0 -1
  686. package/.next/static/chunks/app/(app)/skills/[name]/page-8ab85d5090967ee4.js +0 -6
  687. package/.next/static/chunks/app/(app)/skills/page-c52773eacb27c04e.js +0 -1
  688. package/.next/static/chunks/app/_global-error/page-fc747760bd4c8a4b.js +0 -1
  689. package/.next/static/chunks/app/api/agents/[name]/route-fc747760bd4c8a4b.js +0 -1
  690. package/.next/static/chunks/app/api/agents/route-fc747760bd4c8a4b.js +0 -1
  691. package/.next/static/chunks/app/api/auth/check/route-fc747760bd4c8a4b.js +0 -1
  692. package/.next/static/chunks/app/api/auth/login/route-fc747760bd4c8a4b.js +0 -1
  693. package/.next/static/chunks/app/api/auth/setup/route-fc747760bd4c8a4b.js +0 -1
  694. package/.next/static/chunks/app/api/auth/ws-token/route-fc747760bd4c8a4b.js +0 -1
  695. package/.next/static/chunks/app/api/btw/route-fc747760bd4c8a4b.js +0 -1
  696. package/.next/static/chunks/app/api/claude-md/route-fc747760bd4c8a4b.js +0 -1
  697. package/.next/static/chunks/app/api/commands/[name]/route-fc747760bd4c8a4b.js +0 -1
  698. package/.next/static/chunks/app/api/commands/route-fc747760bd4c8a4b.js +0 -1
  699. package/.next/static/chunks/app/api/defaults/route-fc747760bd4c8a4b.js +0 -1
  700. package/.next/static/chunks/app/api/filesystem/browse/route-fc747760bd4c8a4b.js +0 -1
  701. package/.next/static/chunks/app/api/filesystem/files/route-fc747760bd4c8a4b.js +0 -1
  702. package/.next/static/chunks/app/api/filesystem/mkdir/route-fc747760bd4c8a4b.js +0 -1
  703. package/.next/static/chunks/app/api/filesystem/read/route-fc747760bd4c8a4b.js +0 -1
  704. package/.next/static/chunks/app/api/git/clone/route-fc747760bd4c8a4b.js +0 -1
  705. package/.next/static/chunks/app/api/git/commit/route-fc747760bd4c8a4b.js +0 -1
  706. package/.next/static/chunks/app/api/git/diff/route-fc747760bd4c8a4b.js +0 -1
  707. package/.next/static/chunks/app/api/git/discard/route-fc747760bd4c8a4b.js +0 -1
  708. package/.next/static/chunks/app/api/git/generate-message/route-fc747760bd4c8a4b.js +0 -1
  709. package/.next/static/chunks/app/api/git/push/route-fc747760bd4c8a4b.js +0 -1
  710. package/.next/static/chunks/app/api/git/status/route-fc747760bd4c8a4b.js +0 -1
  711. package/.next/static/chunks/app/api/github/file-content/route-fc747760bd4c8a4b.js +0 -1
  712. package/.next/static/chunks/app/api/github/orgs/route-fc747760bd4c8a4b.js +0 -1
  713. package/.next/static/chunks/app/api/github/prs/checks/route-fc747760bd4c8a4b.js +0 -1
  714. package/.next/static/chunks/app/api/github/prs/diff/route-fc747760bd4c8a4b.js +0 -1
  715. package/.next/static/chunks/app/api/github/prs/review/route-fc747760bd4c8a4b.js +0 -1
  716. package/.next/static/chunks/app/api/github/prs/route-fc747760bd4c8a4b.js +0 -1
  717. package/.next/static/chunks/app/api/github/prs/view/route-fc747760bd4c8a4b.js +0 -1
  718. package/.next/static/chunks/app/api/github/repos/route-fc747760bd4c8a4b.js +0 -1
  719. package/.next/static/chunks/app/api/github/review-session/route-fc747760bd4c8a4b.js +0 -1
  720. package/.next/static/chunks/app/api/health/route-fc747760bd4c8a4b.js +0 -1
  721. package/.next/static/chunks/app/api/hooks/route-fc747760bd4c8a4b.js +0 -1
  722. package/.next/static/chunks/app/api/inbox/[id]/route-fc747760bd4c8a4b.js +0 -1
  723. package/.next/static/chunks/app/api/inbox/route-fc747760bd4c8a4b.js +0 -1
  724. package/.next/static/chunks/app/api/jobs/[id]/route-fc747760bd4c8a4b.js +0 -1
  725. package/.next/static/chunks/app/api/jobs/[id]/runs/[runId]/route-fc747760bd4c8a4b.js +0 -1
  726. package/.next/static/chunks/app/api/jobs/[id]/runs/[runId]/transcript/route-fc747760bd4c8a4b.js +0 -1
  727. package/.next/static/chunks/app/api/jobs/[id]/runs/route-fc747760bd4c8a4b.js +0 -1
  728. package/.next/static/chunks/app/api/jobs/[id]/trigger/route-fc747760bd4c8a4b.js +0 -1
  729. package/.next/static/chunks/app/api/jobs/mcp-discover/route-fc747760bd4c8a4b.js +0 -1
  730. package/.next/static/chunks/app/api/jobs/route-fc747760bd4c8a4b.js +0 -1
  731. package/.next/static/chunks/app/api/jobs/status/route-fc747760bd4c8a4b.js +0 -1
  732. package/.next/static/chunks/app/api/mcp-servers/[name]/route-fc747760bd4c8a4b.js +0 -1
  733. package/.next/static/chunks/app/api/mcp-servers/[name]/test/route-fc747760bd4c8a4b.js +0 -1
  734. package/.next/static/chunks/app/api/mcp-servers/route-fc747760bd4c8a4b.js +0 -1
  735. package/.next/static/chunks/app/api/notifications/route-fc747760bd4c8a4b.js +0 -1
  736. package/.next/static/chunks/app/api/notifications/test/route-fc747760bd4c8a4b.js +0 -1
  737. package/.next/static/chunks/app/api/providers/[id]/route-fc747760bd4c8a4b.js +0 -1
  738. package/.next/static/chunks/app/api/providers/route-fc747760bd4c8a4b.js +0 -1
  739. package/.next/static/chunks/app/api/reviews/pinned/route-fc747760bd4c8a4b.js +0 -1
  740. package/.next/static/chunks/app/api/sessions/[id]/context/route-fc747760bd4c8a4b.js +0 -1
  741. package/.next/static/chunks/app/api/sessions/[id]/mcp/route-fc747760bd4c8a4b.js +0 -1
  742. package/.next/static/chunks/app/api/sessions/[id]/route-fc747760bd4c8a4b.js +0 -1
  743. package/.next/static/chunks/app/api/sessions/[id]/search/route-fc747760bd4c8a4b.js +0 -1
  744. package/.next/static/chunks/app/api/sessions/[id]/tabs/route-fc747760bd4c8a4b.js +0 -1
  745. package/.next/static/chunks/app/api/sessions/bulk-delete/route-fc747760bd4c8a4b.js +0 -1
  746. package/.next/static/chunks/app/api/sessions/by-ids/route-fc747760bd4c8a4b.js +0 -1
  747. package/.next/static/chunks/app/api/sessions/group/route-fc747760bd4c8a4b.js +0 -1
  748. package/.next/static/chunks/app/api/sessions/pinned/route-fc747760bd4c8a4b.js +0 -1
  749. package/.next/static/chunks/app/api/sessions/route-fc747760bd4c8a4b.js +0 -1
  750. package/.next/static/chunks/app/api/sessions/search/route-fc747760bd4c8a4b.js +0 -1
  751. package/.next/static/chunks/app/api/sessions/thinking/route-fc747760bd4c8a4b.js +0 -1
  752. package/.next/static/chunks/app/api/skills/[name]/route-fc747760bd4c8a4b.js +0 -1
  753. package/.next/static/chunks/app/api/skills/route-fc747760bd4c8a4b.js +0 -1
  754. package/.next/static/chunks/app/api/terminal/[id]/route-fc747760bd4c8a4b.js +0 -1
  755. package/.next/static/chunks/app/api/terminal/route-fc747760bd4c8a4b.js +0 -1
  756. package/.next/static/chunks/app/api/usage/route-fc747760bd4c8a4b.js +0 -1
  757. package/.next/static/chunks/app/api/version/changelog/route-fc747760bd4c8a4b.js +0 -1
  758. package/.next/static/chunks/app/api/version/cockpit/changelog/route-fc747760bd4c8a4b.js +0 -1
  759. package/.next/static/chunks/app/api/version/cockpit/route-fc747760bd4c8a4b.js +0 -1
  760. package/.next/static/chunks/app/api/version/route-fc747760bd4c8a4b.js +0 -1
  761. package/.next/static/chunks/next/dist/client/components/builtin/app-error-fc747760bd4c8a4b.js +0 -1
  762. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-fc747760bd4c8a4b.js +0 -1
  763. package/.next/static/chunks/next/dist/client/components/builtin/not-found-fc747760bd4c8a4b.js +0 -1
  764. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-fc747760bd4c8a4b.js +0 -1
  765. package/.next/static/chunks/webpack-e31bb45fa59caed8.js +0 -1
  766. package/.next/static/css/3f8af4ae6f812d5c.css +0 -1
  767. /package/.next/static/{I-rxZaJEzhe3ZUTjSqB11 → NTa6G91R3HtKCLYuQqdR0}/_ssgManifest.js +0 -0
@@ -0,0 +1,25 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1550],{513:(e,t,s)=>{s.d(t,{s:()=>z});var n=s(95155),r=s(92571),a=s(76721),l=s(12363),o=s(36483),i=s(9107),c=s(5045),d=s(12115),u=s(18189),m=s(64233),x=s(42763),h=s(22317),p=s(40980),f=s(52750),g=s(1275),b=s(53972),j=s(1550),v=s(57594),w=s(89723);function y(e,t){let s=e.toLowerCase();return("write"===s||"edit"===s)&&(t.includes("/.claude/plans/")||t.startsWith("~/.claude/plans/"))&&t.endsWith(".md")}function N({tool:e,expandedToolIds:t}){let s=function(){let[e,t]=(0,d.useState)(!1);return(0,d.useEffect)(()=>{let e=()=>{t(document.documentElement.classList.contains("dark"))};e();let s=new MutationObserver(e);return s.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>s.disconnect()},[]),e}(),{backgroundTasks:r}=(0,j.E2)(),{settings:l,loaded:o}=(0,h.t)(),i=(0,d.useMemo)(()=>(function(e){if(!e)return{};try{return JSON.parse(e)}catch{return{}}})(e.input),[e.input]),[c,m]=(0,d.useState)(()=>t?.current?.has(e.id)??!1),[x,g]=(0,d.useState)(!1),b=(0,d.useRef)(t?.current?.has(e.id)??!1);(0,d.useEffect)(()=>{var t;let s;o&&!b.current&&m((t=e.name,"read"===(s=t.toLowerCase())?l.readExpanded:"edit"===s?l.editExpanded:l.toolCallsExpanded))},[o,e.name,l]);let v=i.file_path||e.filePath||"",k=y(e.name,v),C=i.content||"",E=k&&("Write"===e.name||"write"===e.name)&&C;(0,d.useEffect)(()=>{let t=e.name;if(("Read"===t||"read"===t)&&e.output){let t=i.file_path||e.filePath||"",n=t?(0,u.WG)(t):void 0;n&&(0,u.Ik)(e.output,n,s)}else if(("Write"===t||"write"===t)&&i.content){let t=i.file_path||e.filePath||"",n=t?(0,u.WG)(t):void 0;n&&(0,u.Ik)(i.content,n,s)}},[e.name,e.output,e.filePath,i,s]);let I="EnterPlanMode"!==e.name&&"ExitPlanMode"!==e.name&&"TaskCreate"!==e.name&&"TaskUpdate"!==e.name&&"TaskList"!==e.name&&"TaskGet"!==e.name&&"TodoWrite"!==e.name&&(e.input||e.output),T=(0,d.useMemo)(()=>({current:!1}),[]),R=(0,d.useCallback)(e=>{e&&T.current&&(T.current=!1,requestAnimationFrame(()=>{let t=e.closest("[tabindex]");if(!t)return;let s=t.getBoundingClientRect();e.getBoundingClientRect().bottom>s.bottom&&e.scrollIntoView({block:"nearest",behavior:"smooth"})}))},[T]);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"rounded border border-border bg-card text-card-foreground text-xs overflow-hidden",children:[(0,n.jsxs)("button",{onClick:()=>{if(E)return void g(!0);if(!I)return;let s=!c;T.current=s,b.current=!0,m(s),t?.current&&(s?t.current.add(e.id):t.current.delete(e.id))},className:(0,p.cn)("flex w-full items-start gap-2 px-3 py-1.5 text-left",I&&"cursor-pointer hover:bg-muted/50",!I&&"cursor-default"),children:[E?(0,n.jsx)(f.A,{className:"h-3 w-3 shrink-0 text-blue-500"}):(0,n.jsx)(a.A,{className:(0,p.cn)("h-3 w-3 shrink-0 text-muted-foreground transition-transform",c&&"rotate-90")}),"Agent"===e.name?(0,n.jsx)(S,{tool:e,input:i,backgroundTasks:r}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"font-mono font-medium",children:e.name}),(0,n.jsx)(A,{tool:e,input:i})]})]}),c&&I&&(0,n.jsx)("div",{ref:R,className:"border-t border-border px-3 py-2 space-y-2",children:(0,n.jsx)($,{tool:e,input:i,dark:s,expandedToolIds:t})})]}),E&&(0,n.jsx)(w.G,{open:x,onOpenChange:g,content:C,filePath:v})]})}function k({filePath:e}){let{tabActions:t}=(0,j.E2)();return(0,n.jsx)("span",{role:"button",tabIndex:0,onClick:s=>{s.stopPropagation(),t?.openFile(e)},onKeyDown:s=>{("Enter"===s.key||" "===s.key)&&(s.preventDefault(),s.stopPropagation(),t?.openFile(e))},title:e,className:"shrink-0 text-muted-foreground hover:text-foreground cursor-pointer",children:(0,n.jsx)(g.A,{className:"h-3 w-3"})})}function C({filePath:e,children:t}){let{tabActions:s}=(0,j.E2)();return(0,n.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),s?.openFile(e)},title:e,className:"font-mono text-muted-foreground break-all hover:underline text-left",children:t})}function S({tool:e,input:t,backgroundTasks:s}){let a=t.description||t.prompt||"",l=a.length>80?a.slice(0,80)+"...":a,o=t.model,i=[t.subagent_type,o].filter(Boolean),c="running"===e.status||s.some(t=>t.toolUseId===e.id&&"running"===t.status);return(0,n.jsxs)("div",{className:"flex flex-col gap-0.5 min-w-0 flex-1",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"font-mono font-medium",children:"Agent"}),c&&(0,n.jsx)(r.A,{className:"h-3 w-3 shrink-0 animate-spin text-muted-foreground"}),i.map(e=>(0,n.jsx)("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground",children:e},e))]}),l&&(0,n.jsx)("span",{className:"text-muted-foreground truncate",children:l})]})}function A({tool:e,input:t}){let s=e.name;if("Edit"===s||"edit"===s){let r=t.file_path||e.filePath||"";if(!r)return null;let a=y(s,r);return(0,n.jsxs)("span",{className:"flex items-center gap-1.5 min-w-0",children:[(0,n.jsxs)("span",{className:"text-muted-foreground truncate",children:[(0,b._1)(r),a?" (plan edit)":""]}),(0,n.jsx)(k,{filePath:r})]})}if("Write"===s||"write"===s){let r=t.file_path||e.filePath||"";if(!r)return null;let a=t.content||"";return y(s,r)&&a?(0,n.jsx)("span",{className:"text-blue-500 truncate",children:"View plan"}):(0,n.jsxs)("span",{className:"flex items-center gap-1.5 min-w-0",children:[(0,n.jsx)("span",{className:"text-muted-foreground truncate",children:(0,b._1)(r)}),(0,n.jsx)(k,{filePath:r})]})}if("Read"===s||"read"===s){let s=t.file_path||e.filePath||"";return s?(0,n.jsxs)("span",{className:"flex items-center gap-1.5 min-w-0",children:[(0,n.jsx)("span",{className:"text-muted-foreground truncate",children:(0,b._1)(s)}),(0,n.jsx)(k,{filePath:s})]}):null}if("Bash"===s||"bash"===s){let e=t.command||"",s=e.length>60?e.slice(0,60)+"...":e;return s?(0,n.jsx)("span",{className:"font-mono text-muted-foreground truncate",children:s}):null}if("Grep"===s||"grep"===s){let e=t.pattern||"";return e?(0,n.jsxs)("span",{className:"font-mono text-muted-foreground truncate",children:["/",e,"/"]}):null}if("Glob"===s||"glob"===s){let e=t.pattern||"";return e?(0,n.jsx)("span",{className:"font-mono text-muted-foreground truncate",children:e}):null}if("EnterPlanMode"===s)return(0,n.jsx)("span",{className:"text-muted-foreground",children:"Entering plan mode"});if("ExitPlanMode"===s)return(0,n.jsx)("span",{className:"text-muted-foreground",children:"Exiting plan mode"});if("TaskCreate"===s){let e=t.subject||t.content||"";return e?(0,n.jsx)("span",{className:"text-muted-foreground truncate",children:e}):null}if("TaskUpdate"===s){let e=t.taskId||"",s=t.status||"";return e?(0,n.jsxs)("span",{className:"text-muted-foreground truncate",children:["#",e," ",s]}):null}if("TaskList"===s)return(0,n.jsx)("span",{className:"text-muted-foreground",children:"Listing tasks"});if("TaskGet"===s){let e=t.taskId||"";return e?(0,n.jsxs)("span",{className:"text-muted-foreground",children:["#",e]}):null}return null}function $({tool:e,input:t,dark:s,expandedToolIds:r}){let a=e.name;return"Edit"===a||"edit"===a?(0,n.jsx)(E,{input:t,tool:e,dark:s}):"Write"===a||"write"===a?(0,n.jsx)(I,{input:t,tool:e,dark:s}):"Read"===a||"read"===a?(0,n.jsx)(T,{input:t,tool:e,dark:s}):"Bash"===a||"bash"===a?(0,n.jsx)(R,{input:t,tool:e}):"Grep"===a||"grep"===a||"Glob"===a||"glob"===a?(0,n.jsx)(D,{input:t,tool:e}):"Agent"===a?(0,n.jsx)(_,{input:t,tool:e,dark:s,expandedToolIds:r}):(0,n.jsx)(P,{input:t,tool:e})}function E({input:e,tool:t,dark:s}){let r=e.file_path||t.filePath||"file",a=e.old_string||"",l=e.new_string||"";return a||l?(0,n.jsx)(v.Mh,{filePath:r,oldString:a,newString:l,dark:s}):(0,n.jsx)(P,{input:e,tool:t})}function I({input:e,tool:t,dark:s}){let r=e.file_path||t.filePath||"",a=e.content||"",l=r?(0,u.WG)(r):void 0;return(0,n.jsxs)("div",{className:"space-y-1",children:[r&&(0,n.jsx)(C,{filePath:r,children:r}),a&&(0,n.jsx)(u.NG,{code:a,language:l,dark:s}),t.output&&(0,n.jsx)("pre",{className:"overflow-x-auto rounded bg-muted/50 p-2 text-[11px] leading-relaxed max-h-32 overflow-y-auto text-muted-foreground",children:t.output})]})}function T({input:e,tool:t,dark:s}){let r=e.file_path||t.filePath||"",a=r?(0,u.WG)(r):void 0;return(0,n.jsxs)("div",{className:"space-y-1",children:[r&&(0,n.jsx)(C,{filePath:r,children:r}),t.output&&(0,n.jsx)(u.NG,{code:t.output,language:a,dark:s})]})}function R({input:e,tool:t}){let s=e.command||"";return(0,n.jsxs)("div",{className:"space-y-1",children:[s&&(0,n.jsxs)("div",{className:"font-mono text-muted-foreground break-all",children:[(0,n.jsx)("span",{className:"text-foreground/60",children:"$"})," ",s]}),t.output&&(0,n.jsx)("pre",{className:"whitespace-pre-wrap break-all rounded bg-muted/50 p-2 text-[11px] leading-relaxed max-h-64 overflow-y-auto",children:t.output})]})}function D({input:e,tool:t}){let s=e.pattern||"",r=e.path||"";return(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsxs)("div",{className:"font-mono text-muted-foreground",children:[s&&(0,n.jsxs)("span",{children:["/",s,"/"]}),r&&(0,n.jsxs)("span",{children:[" in ",(0,b._1)(r)]})]}),t.output&&(0,n.jsx)("pre",{className:"overflow-x-auto rounded bg-muted/50 p-2 text-[11px] leading-relaxed max-h-64 overflow-y-auto",children:t.output})]})}function _({input:e,tool:t,expandedToolIds:s}){let r=e.prompt||"",a=t.children||[];return(0,n.jsxs)("div",{className:"space-y-2",children:[r&&(0,n.jsx)("pre",{className:"overflow-x-auto rounded bg-muted/50 p-2 text-[11px] leading-relaxed max-h-32 overflow-y-auto text-muted-foreground",children:r}),a.length>0&&(0,n.jsx)("div",{className:"pl-3 border-l-2 border-border space-y-1",children:a.map(e=>(0,n.jsx)(N,{tool:e,expandedToolIds:s},e.id))}),t.output&&(0,n.jsx)("pre",{className:"overflow-x-auto rounded bg-muted/50 p-2 text-[11px] leading-relaxed max-h-48 overflow-y-auto text-muted-foreground",children:t.output})]})}function P({input:e,tool:t}){let s=Object.keys(e).length>0;return(0,n.jsxs)("div",{className:"space-y-1",children:[s&&(0,n.jsx)("pre",{className:"overflow-x-auto rounded bg-muted/50 p-2 text-[11px] leading-relaxed max-h-48 overflow-y-auto",children:JSON.stringify(e,null,2)}),t.output&&(0,n.jsx)("pre",{className:"overflow-x-auto rounded bg-muted/50 p-2 text-[11px] leading-relaxed max-h-48 overflow-y-auto text-muted-foreground",children:t.output})]})}let M=/<(?:task-notification|local-command-caveat|local-command-stdout|command-name|command-message|command-args|system-reminder)[^>]*>[\s\S]*?<\/(?:task-notification|local-command-caveat|local-command-stdout|command-name|command-message|command-args|system-reminder)>[\s\S]*/g;function q(e){return e.replace(M,"").trim()}let z=(0,d.memo)(function({message:e,collapsedByDefault:t=!1,expandedToolIds:s,selectionMode:i=!1,selected:c=!1,onEnterSelection:u,onToggleSelect:h}){let[f,g]=(0,d.useState)(t),[b,j]=(0,d.useState)(null),v="user"===e.role,w="system"===e.role,y=!w,k=new Set(["AskUserQuestion","TodoWrite"]),C=e.blocks?.filter(e=>!("tool_use"===e.type&&k.has(e.toolUse.name)))||[],S=C.length>0,A=C.some(e=>"tool_use"===e.type)||e.toolUses.some(e=>!k.has(e.name)),$=(0,d.useRef)(!1),E=(0,d.useRef)(null),I=(0,d.useCallback)(t=>{$.current||i&&(t.preventDefault(),y&&h?.(e.id))},[y,i,e.id,h]),T=(0,d.useCallback)(()=>{$.current=!0},[]),R=(0,d.useCallback)(()=>{$.current=!1},[]),D=(0,d.useCallback)(t=>{if(i){y&&h?.(e.id);return}if(!y)return;let s=Date.now(),n=E.current;if(n&&s-n.time<300){let s=t.clientX-n.x,r=t.clientY-n.y;if(s*s+r*r<400){E.current=null,window.getSelection()?.removeAllRanges(),u?.(e.id);return}}E.current={time:s,x:t.clientX,y:t.clientY}},[i,y,e.id,h,u]);if(w){let t="__compacting__"===e.content,s="__compacted__"===e.content;return t||s?(0,n.jsxs)("div",{className:"flex w-full items-center gap-3 py-2",children:[(0,n.jsx)("div",{className:"flex-1 border-t border-border"}),(0,n.jsxs)("div",{className:"flex items-center gap-1.5 text-[10px] text-muted-foreground uppercase tracking-wider",children:[t&&(0,n.jsx)(r.A,{className:"h-3 w-3 animate-spin"}),t?"Compacting...":"Compacted"]}),(0,n.jsx)("div",{className:"flex-1 border-t border-border"})]}):"__context_reset__"===e.content?(0,n.jsxs)("div",{className:"flex w-full items-center gap-3 py-2",children:[(0,n.jsx)("div",{className:"flex-1 border-t border-border"}),(0,n.jsx)("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Context cleared"}),(0,n.jsx)("div",{className:"flex-1 border-t border-border"})]}):(0,n.jsx)("div",{className:"flex w-full justify-center",children:(0,n.jsx)("div",{className:"text-xs text-muted-foreground whitespace-pre-wrap py-1",children:e.content})})}return!v&&!w&&!S&&!e.content&&e.toolUses.every(e=>k.has(e.name))||v&&e.content.startsWith("[Request interrupted")?null:f?(e.content.slice(0,80).replace(/\n/g," "),(0,n.jsx)("div",{className:"flex w-full justify-start",children:(0,n.jsx)("button",{onClick:()=>g(!1),className:"max-w-[85%] rounded-lg px-4 py-2 bg-muted text-foreground text-left overflow-hidden",children:(0,n.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,n.jsx)(a.A,{className:"h-3 w-3"}),(0,n.jsx)("span",{className:"font-medium",children:"Compaction summary"})]})})})):(0,n.jsxs)("div",{className:(0,p.cn)("flex w-full",v&&!t?"justify-end":"justify-start",i&&"cursor-pointer select-none"),onContextMenu:I,onTouchStart:T,onMouseDown:R,onClick:D,children:[(0,n.jsxs)("div",{className:(0,p.cn)("max-w-[85%] rounded-lg px-4 py-2 overflow-hidden transition-colors select-text",!v&&A&&"w-full",v&&!t?"bg-primary text-primary-foreground":"bg-muted text-foreground",c&&"ring-2 ring-blue-500"),children:[t&&(0,n.jsxs)("button",{onClick:()=>g(!0),className:"flex items-center gap-1 text-xs text-muted-foreground mb-2 hover:text-foreground",children:[(0,n.jsx)(l.A,{className:"h-3 w-3"}),(0,n.jsx)("span",{className:"font-medium",children:"Compaction summary"})]}),v?(0,n.jsxs)(n.Fragment,{children:[e.images&&e.images.length>0&&(0,n.jsx)("div",{className:"flex gap-2 flex-wrap mb-2",children:e.images.map((e,t)=>(0,n.jsx)("img",{src:`data:${e.mediaType};base64,${e.data}`,className:"max-h-60 rounded border border-primary-foreground/20 object-contain cursor-pointer",alt:"",onClick:t=>{t.stopPropagation(),j(`data:${e.mediaType};base64,${e.data}`)}},t))}),e.documents&&e.documents.length>0&&(0,n.jsx)("div",{className:"flex gap-2 flex-wrap mb-2",children:e.documents.map((e,t)=>(0,n.jsxs)("div",{className:"flex items-center gap-1.5 rounded border border-primary-foreground/20 px-2 py-1 text-xs",children:[(0,n.jsx)(o.A,{className:"h-3.5 w-3.5"}),(0,n.jsx)("span",{children:e.name})]},t))}),e.textFiles&&e.textFiles.length>0&&(0,n.jsx)("div",{className:"space-y-1.5 mb-2",children:e.textFiles.map((e,t)=>(0,n.jsx)(U,{name:e.name,content:e.content},t))}),e.content&&(0,n.jsx)("p",{className:"whitespace-pre-wrap break-words text-base leading-relaxed",children:e.content})]}):S?(0,n.jsx)("div",{className:"space-y-2",children:C.map((e,t)=>"tool_use"===e.type?(0,n.jsx)(N,{tool:e.toolUse,expandedToolIds:s},e.toolUse.id):"thinking"===e.type?(0,n.jsx)(F,{text:e.text,tokens:e.tokens,durationMs:e.durationMs,redacted:e.redacted},`thinking-${t}`):(0,n.jsx)(m.Y,{content:q(e.text)},`text-${t}`))}):(0,n.jsxs)(n.Fragment,{children:[e.toolUses.filter(e=>!k.has(e.name)).length>0&&(0,n.jsx)("div",{className:"mb-2 space-y-1",children:e.toolUses.filter(e=>!k.has(e.name)).map(e=>(0,n.jsx)(N,{tool:e,expandedToolIds:s},e.id))}),(0,n.jsx)(m.Y,{content:q(e.content)})]})]}),(0,n.jsx)(x.lG,{open:null!==b,onOpenChange:()=>j(null),className:"max-w-3xl",children:(0,n.jsx)(x.Cf,{className:"max-h-[80vh] overflow-auto",onClose:()=>j(null),children:b&&(0,n.jsx)("img",{src:b,className:"w-full rounded object-contain",alt:""})})})]})});function U({name:e,content:t}){let[s,r]=(0,d.useState)(!1),a=t.split(/\r?\n/).length;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{onClick:e=>{e.stopPropagation(),r(!0)},className:"flex w-full items-center gap-1.5 rounded border border-blue-500/20 bg-blue-500/5 px-3 py-1.5 text-xs text-blue-400 hover:text-blue-300",children:[(0,n.jsx)(i.A,{className:"h-3 w-3"}),(0,n.jsx)("span",{className:"font-medium",children:e}),(0,n.jsxs)("span",{className:"text-muted-foreground ml-1",children:[a," lines"]})]}),(0,n.jsx)(x.lG,{open:s,onOpenChange:r,className:"max-w-3xl",children:(0,n.jsxs)(x.Cf,{className:"max-h-[80vh] flex flex-col",onClose:()=>r(!1),children:[(0,n.jsxs)("div",{className:"text-sm font-medium px-1 pb-2 border-b border-border flex items-center gap-1.5",children:[(0,n.jsx)(i.A,{className:"h-3.5 w-3.5 text-blue-400"}),e]}),(0,n.jsx)("div",{className:"flex-1 min-h-0 overflow-auto",children:(0,n.jsx)(u.NG,{code:t,language:(0,u.WG)(e),dark:!0,fullHeight:!0})})]})})]})}function F({text:e,tokens:t,durationMs:s}){let{settings:r}=(0,h.t)(),[o,i]=(0,d.useState)(null),u=o??r.thinkingExpanded,m=e.length>0,x=null!=s?`${Math.max(1,Math.round(s/1e3))}s`:null!=t?`${t.toLocaleString()} token${1===t?"":"s"}`:m?`${e.length.toLocaleString()} chars`:null;return(0,n.jsxs)("div",{className:"rounded border border-purple-500/20 bg-purple-500/5",children:[(0,n.jsxs)("button",{onClick:()=>m&&i(!u),disabled:!m,className:"flex w-full items-center gap-1.5 px-3 py-1.5 text-xs text-purple-400 hover:text-purple-300 disabled:cursor-default disabled:hover:text-purple-400",children:[(0,n.jsx)(c.A,{className:"h-3 w-3"}),(0,n.jsx)("span",{className:"font-medium",children:"Thinking"}),x&&(0,n.jsx)("span",{className:"text-muted-foreground ml-1",children:x}),m&&(u?(0,n.jsx)(l.A,{className:"h-3 w-3 ml-auto"}):(0,n.jsx)(a.A,{className:"h-3 w-3 ml-auto"}))]}),m&&u&&(0,n.jsx)("div",{className:"border-t border-purple-500/20 px-3 py-2 text-xs text-muted-foreground whitespace-pre-wrap max-h-60 overflow-y-auto",children:e})]})}},1550:(e,t,s)=>{s.d(t,{GV:()=>Q,si:()=>B,E2:()=>W,mq:()=>J,tB:()=>H});var n=s(95155),r=s(16449),a=s(96304),l=s(5772),o=s(12115),i=s(73321);let c=!1;function d({children:e}){let t=(0,i.useRouter)(),[s,r]=(0,o.useState)(c);return((0,o.useEffect)(()=>{c||fetch("/api/auth/check").then(e=>{e.ok?(c=!0,r(!0)):t.replace("/login")}).catch(()=>{t.replace("/login")})},[t]),s)?(0,n.jsx)(n.Fragment,{children:e}):null}var u=s(64577),m=s(99314),x=s(65377),h=s(92571),p=s(9005),f=s(45160),g=s(89239),b=s(81477),j=s(16617);function v({preview:e,matchStart:t,matchLength:s}){let r=e.slice(0,t),a=e.slice(t,t+s),l=e.slice(t+s);return(0,n.jsxs)("span",{className:"text-sm text-muted-foreground whitespace-pre-wrap break-words select-text",children:[r,(0,n.jsx)("mark",{className:"bg-yellow-300/30 text-foreground rounded-sm px-0.5",children:a}),l]})}function w({text:e}){let[t,s]=(0,o.useState)(!1),r=(0,o.useCallback)(t=>{t.stopPropagation(),navigator.clipboard.writeText(e),s(!0),setTimeout(()=>s(!1),1500)},[e]);return(0,n.jsx)(g.$,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:r,title:"Copy full message",children:t?(0,n.jsx)(u.A,{className:"h-3 w-3"}):(0,n.jsx)(m.A,{className:"h-3 w-3"})})}function y({onClose:e}){let{sessionId:t,cwd:s}=W(),[r,a]=(0,o.useState)(""),[l,i]=(0,o.useState)([]),[c,d]=(0,o.useState)(!1),[u,m]=(0,o.useState)(!1),[N,k]=(0,o.useState)(null),C=(0,o.useRef)(null),S=(0,o.useRef)(null);(0,o.useEffect)(()=>{C.current?.focus()},[]),(0,o.useEffect)(()=>{if(r.length<2){i([]),m(!1);return}let e=setTimeout(()=>{S.current?.abort();let e=new AbortController;S.current=e,d(!0);let n=new URLSearchParams({q:r});s&&n.set("cwd",s),fetch(`/api/sessions/${t}/search?${n}`,{signal:e.signal}).then(e=>e.json()).then(t=>{e.signal.aborted||(i(t.results||[]),m(!0),d(!1))}).catch(e=>{"AbortError"!==e.name&&(d(!1),m(!0))})},300);return()=>{clearTimeout(e)}},[r,t,s]),(0,o.useEffect)(()=>()=>{S.current?.abort()},[]);let A=(0,o.useCallback)(e=>{k(e)},[]),$=(0,o.useCallback)(t=>{t.target===t.currentTarget&&e()},[e]);return(0,o.useEffect)(()=>{let t=t=>{"Escape"===t.key&&(t.preventDefault(),t.stopPropagation(),e())};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[e]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"fixed inset-0 z-50 bg-black/50 flex items-center justify-center p-4",onClick:$,children:(0,n.jsxs)(b.Zp,{className:"w-full max-w-2xl flex flex-col",style:{maxHeight:"calc(100dvh - 2rem)"},children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 p-4 border-b",children:[(0,n.jsx)(x.A,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,n.jsx)("input",{ref:C,value:r,onChange:e=>a(e.target.value),placeholder:"Search messages...",className:"flex-1 bg-transparent outline-none text-sm"}),c&&(0,n.jsx)(h.A,{className:"h-4 w-4 animate-spin text-muted-foreground shrink-0"}),(0,n.jsx)(g.$,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:e,children:(0,n.jsx)(p.A,{className:"h-4 w-4"})})]}),(0,n.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[u&&0===l.length&&(0,n.jsx)("div",{className:"p-8 text-center text-sm text-muted-foreground",children:"No results"}),l.map((e,t)=>(0,n.jsxs)("div",{role:"button",tabIndex:0,onClick:()=>A(e.timestamp),onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),A(e.timestamp))},className:"w-full text-left p-4 border-b last:border-b-0 hover:bg-muted/50 transition-colors cursor-pointer",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,n.jsx)(f.E,{variant:"user"===e.role?"default":"secondary",className:"text-[10px] px-1.5 py-0",children:"user"===e.role?"User":"Assistant"}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground select-text",children:new Date(e.timestamp).toLocaleString()}),(0,n.jsx)("div",{className:"ml-auto",children:(0,n.jsx)(w,{text:e.fullContent})})]}),(0,n.jsx)(v,{preview:e.preview,matchStart:e.matchStart,matchLength:e.matchLength})]},`${e.messageId}-${t}`))]})]})}),null!==N&&(0,n.jsx)(j.Q,{timestamp:N,onClose:()=>k(null)})]})}function N(){let{sessionId:e}=W(),[t,s]=(0,o.useState)(!1);return((0,o.useEffect)(()=>{let t=t=>{(t.metaKey||t.ctrlKey)&&"f"===t.key&&e&&(t.preventDefault(),s(!0))};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e]),e)?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(g.$,{variant:"ghost",size:"icon",onClick:()=>s(!0),title:"Search messages (Ctrl+F)",children:(0,n.jsx)(x.A,{className:"h-4 w-4"})}),t&&(0,n.jsx)(y,{onClose:()=>s(!1)})]}):null}var k=s(23965),C=s(36338),S=s(64962);function A({tasks:e}){let[t,s]=(0,o.useState)(!1);(0,o.useEffect)(()=>{if(!t)return;let e=e=>{"Escape"===e.key&&s(!1)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t]);let r=e.filter(e=>"running"===e.status);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(g.$,{variant:"ghost",size:"icon",className:"h-8 w-8 relative",onClick:()=>s(!0),title:`${r.length} background task${1!==r.length?"s":""}`,children:[(0,n.jsx)(C.A,{className:"h-4 w-4"}),r.length>0&&(0,n.jsx)("span",{className:"absolute -top-0.5 -right-0.5 flex h-3.5 w-3.5 items-center justify-center rounded-full bg-primary text-[9px] font-bold text-primary-foreground",children:r.length})]}),t&&(0,n.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onMouseDown:e=>{e.target===e.currentTarget&&s(!1)},children:(0,n.jsxs)("div",{className:"w-full max-w-md mx-4 rounded-lg border bg-background p-5 shadow-lg",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,n.jsx)("h2",{className:"text-base font-semibold",children:"Background Tasks"}),(0,n.jsx)(g.$,{variant:"ghost",size:"icon",onClick:()=>s(!1),children:(0,n.jsx)(p.A,{className:"h-4 w-4"})})]}),0===e.length?(0,n.jsx)("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No background tasks"}):(0,n.jsx)("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:e.map(e=>(0,n.jsxs)("div",{className:"flex items-start gap-3 rounded-md border border-border px-3 py-2.5",children:["completed"===e.status?(0,n.jsx)(S.A,{className:"h-4 w-4 shrink-0 mt-0.5 text-green-500"}):(0,n.jsx)(h.A,{className:"h-4 w-4 shrink-0 mt-0.5 animate-spin text-muted-foreground"}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)("div",{className:"text-sm truncate",children:e.title||e.description}),e.title&&e.description&&e.description!==e.title&&(0,n.jsx)("div",{className:"text-xs text-muted-foreground truncate mt-0.5",children:e.description}),e.activity&&e.activity!==(e.title||e.description)&&(0,n.jsx)("div",{className:"text-xs text-muted-foreground truncate mt-0.5",children:e.activity}),"completed"===e.status&&e.summary&&(0,n.jsx)("div",{className:"text-xs text-muted-foreground truncate mt-0.5",children:e.summary})]})]},e.taskId))})]})})]})}var $=s(8143),E=s(67401);function I({todos:e}){let[t,s]=(0,o.useState)(!1);(0,o.useEffect)(()=>{if(!t)return;let e=e=>{"Escape"===e.key&&s(!1)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t]);let r=(0,o.useMemo)(()=>e.filter(e=>"completed"!==e.status).length,[e]);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(g.$,{variant:"ghost",size:"icon",className:"h-8 w-8 relative",onClick:()=>s(!0),title:`${r} todo${1!==r?"s":""}`,children:[(0,n.jsx)($.A,{className:"h-4 w-4"}),r>0&&(0,n.jsx)("span",{className:"absolute -top-0.5 -right-0.5 flex h-3.5 w-3.5 items-center justify-center rounded-full bg-primary text-[9px] font-bold text-primary-foreground",children:r})]}),t&&(0,n.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onMouseDown:e=>{e.target===e.currentTarget&&s(!1)},children:(0,n.jsxs)("div",{className:"w-full max-w-md mx-4 rounded-lg border bg-background p-5 shadow-lg",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,n.jsx)("h2",{className:"text-base font-semibold",children:"Todo"}),(0,n.jsx)(g.$,{variant:"ghost",size:"icon",onClick:()=>s(!1),children:(0,n.jsx)(p.A,{className:"h-4 w-4"})})]}),0===e.length?(0,n.jsx)("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No todo items"}):(0,n.jsx)("div",{className:"space-y-1 max-h-80 overflow-y-auto",children:e.map((e,t)=>(0,n.jsxs)("div",{className:"flex items-start gap-2.5 rounded-md px-3 py-2",children:[(0,n.jsx)(T,{status:e.status}),(0,n.jsx)("div",{className:`min-w-0 flex-1 text-sm ${"completed"===e.status?"text-muted-foreground line-through":""}`,children:"in_progress"===e.status&&e.activeForm?e.activeForm:e.content})]},t))})]})})]})}function T({status:e}){return"completed"===e?(0,n.jsx)(S.A,{className:"h-4 w-4 shrink-0 mt-0.5 text-green-500"}):"in_progress"===e?(0,n.jsx)(h.A,{className:"h-4 w-4 shrink-0 mt-0.5 animate-spin text-blue-500"}):(0,n.jsx)(E.A,{className:"h-4 w-4 shrink-0 mt-0.5 text-muted-foreground"})}var R=s(94774),D=s(82749);let _=null,P=0,M=null,q=null;async function z(e=!1){let t=Date.now();return!e&&_&&t-P<3e4?_:q||(q=(async()=>{try{let e=await fetch("/api/usage");if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error||`HTTP ${e.status}`)}let t=await e.json();return _=t,P=Date.now(),M=null,t}catch(e){return M=e instanceof Error?e.message:"Unknown error",null}finally{q=null}})())}function U({label:e,limit:t}){let s=Math.round(t.utilization),r=s>80?"#ef4444":s>50?"#f97316":"#22c55e";return(0,n.jsxs)("div",{className:"mb-4 last:mb-0",children:[(0,n.jsxs)("div",{className:"flex justify-between text-sm mb-1",children:[(0,n.jsx)("span",{children:e}),(0,n.jsxs)("span",{className:"text-muted-foreground",children:[s,"% \xb7 resets in ",function(e){let t=new Date(e).getTime()-Date.now();if(t<=0)return"now";let s=Math.floor(t/6e4),n=Math.floor(s/60),r=Math.floor(n/24);return r>0?`${r}d ${n%24}h`:n>0?`${n}h ${s%60}m`:`${s}m`}(t.resets_at)]})]}),(0,n.jsx)("div",{className:"h-2.5 rounded-full bg-muted overflow-hidden",children:(0,n.jsx)("div",{className:"h-full rounded-full transition-all",style:{width:`${Math.min(s,100)}%`,backgroundColor:r}})})]})}function F({className:e}){let[t,s]=(0,o.useState)(!1),{usage:r,loading:a,error:l,refresh:i}=function(){let[e,t]=(0,o.useState)(_),[s,n]=(0,o.useState)(null===_),[r,a]=(0,o.useState)(null),l=(0,o.useRef)(!0),i=(0,o.useCallback)(async(e=!1)=>{e&&n(!0);let s=await z(e);l.current&&(s?(t(s),a(null)):_||a(M||"Failed to load usage data"),n(!1))},[]);return(0,o.useEffect)(()=>{l.current=!0,i();let e=setInterval(i,3e5);return()=>{l.current=!1,clearInterval(e)}},[i]),{usage:e,loading:s,error:r,refresh:i}}();(0,o.useEffect)(()=>{if(!t)return;let e=e=>{"Escape"===e.key&&s(!1)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t]);let c=r?.seven_day&&r.seven_day.utilization>=100?100:r?.five_hour?.utilization??0;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(g.$,{variant:"ghost",size:"icon",onClick:()=>s(!0),title:"Account usage",className:e,children:(0,n.jsx)(R.A,{className:`h-4 w-4 ${r?c>80?"text-red-500":c>50?"text-orange-500":"text-green-500":""}`})}),t&&(0,n.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onMouseDown:e=>{e.target===e.currentTarget&&s(!1)},children:(0,n.jsxs)("div",{className:"w-full max-w-md mx-4 rounded-lg border bg-background p-5 shadow-lg",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,n.jsx)("h2",{className:"text-base font-semibold",children:"Account Usage"}),(0,n.jsxs)("div",{className:"flex gap-1",children:[(0,n.jsx)(g.$,{variant:"ghost",size:"icon",onClick:()=>i(!0),disabled:a,title:"Refresh usage",children:(0,n.jsx)(D.A,{className:`h-4 w-4 ${a?"animate-spin":""}`})}),(0,n.jsx)(g.$,{variant:"ghost",size:"icon",onClick:()=>s(!1),children:(0,n.jsx)(p.A,{className:"h-4 w-4"})})]})]}),a&&!r&&(0,n.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,n.jsx)(h.A,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),l&&!r&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground py-4 text-center",children:l}),r&&(0,n.jsxs)(n.Fragment,{children:[r.five_hour&&(0,n.jsx)(U,{label:"5-hour limit",limit:r.five_hour}),r.seven_day&&(0,n.jsx)(U,{label:"7-day limit",limit:r.seven_day}),r.seven_day_sonnet&&(0,n.jsx)(U,{label:"7-day Sonnet",limit:r.seven_day_sonnet}),r.seven_day_opus&&(0,n.jsx)(U,{label:"7-day Opus",limit:r.seven_day_opus}),r.extra_usage?.enabled&&(0,n.jsx)("div",{className:"mt-4 pt-3 border-t text-sm",children:(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{children:"Extra usage credits"}),(0,n.jsxs)("span",{className:"font-medium",children:["$",r.extra_usage.remaining_credits.toFixed(2)," remaining"]})]})})]})]})})]})}var L=s(89323);let O=(0,o.createContext)({setHeader:()=>{},cwd:void 0,setCwd:()=>{},sessionId:void 0,setSessionId:()=>{},runtime:"stream",setRuntime:()=>{},backgroundTasks:[],setBackgroundTasks:()=>{},todos:[],setTodos:()=>{},initData:null,setInitData:()=>{},sidebarSections:new Map,setSidebarSection:()=>{},removeSidebarSection:()=>{},closeSidebar:()=>{},tabActions:null,setTabActions:()=>{}});function W(){return(0,o.useContext)(O)}function B(e,t){let{setHeader:s}=W(),n=t?.hideActions,r=t?.usageOnly;(0,o.useEffect)(()=>{s({title:e,hideActions:n,usageOnly:r})},[e,n,r,s])}function J(e){let{setCwd:t}=W();(0,o.useEffect)(()=>{e&&t(e)},[e,t])}function H(e){let{setSessionId:t}=W();(0,o.useEffect)(()=>{e&&t(e)},[e,t])}function G({title:e,onRename:t}){let[s,r]=(0,o.useState)(!1),[a,l]=(0,o.useState)(e),i=(0,o.useRef)(null);if((0,o.useEffect)(()=>{l(e)},[e]),(0,o.useEffect)(()=>{s&&i.current?.select()},[s]),!t)return(0,n.jsx)("span",{className:"text-sm font-bold truncate",children:e});if(!s)return(0,n.jsx)("button",{onClick:()=>r(!0),className:"text-sm font-bold truncate hover:text-muted-foreground transition-colors text-left",title:"Click to rename",children:e});let c=()=>{let s=a.trim();s&&s!==e&&t(s),r(!1)};return(0,n.jsx)("input",{ref:i,value:a,onChange:e=>l(e.target.value),onBlur:c,onKeyDown:t=>{"Enter"===t.key&&c(),"Escape"===t.key&&(l(e),r(!1))},className:"text-sm font-bold bg-transparent border-b border-primary outline-none w-40"})}function K({cwd:e}){let{tabActions:t}=W(),[s,a]=(0,o.useState)(!1),l=(0,o.useCallback)(async()=>{if(t?.openTerminal){a(!0);try{let s=await fetch("/api/terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e})});if(!s.ok)return;let{terminalId:n}=await s.json();t.openTerminal(n)}finally{a(!1)}}},[e,t]);return(0,n.jsx)(g.$,{variant:"ghost",size:"icon",onClick:l,disabled:s,title:"New terminal (Ctrl+`)",children:(0,n.jsx)(r.A,{className:"h-4 w-4"})})}function Q({children:e}){let t=(0,o.useRef)(null),[s,r]=(0,o.useState)({title:"Cockpit"}),[i,c]=(0,o.useState)(void 0),[u,m]=(0,o.useState)(void 0),[x,h]=(0,o.useState)([]),[p,f]=(0,o.useState)([]),[b,j]=(0,o.useState)(null),[v,w]=(0,o.useState)(new Map),[y,C]=(0,o.useState)("stream"),[S,$]=(0,o.useState)(null),E=(0,o.useCallback)(e=>{w(t=>{let s=new Map(t);return s.set(e.id,e),s})},[]),T=(0,o.useCallback)(e=>{w(t=>{if(!t.has(e))return t;let s=new Map(t);return s.delete(e),s})},[]),R=(0,o.useCallback)(e=>{r(e)},[]),D=(0,o.useCallback)(e=>{c(e)},[]),_=(0,o.useCallback)(e=>{m(e)},[]),P=(0,o.useCallback)(()=>{t.current?.toggle()},[]),M=(0,o.useCallback)(()=>{t.current?.close()},[]),q=(0,o.useCallback)(e=>{C(e)},[]),z=(0,o.useCallback)(e=>{$(e)},[]);(0,o.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&"b"===e.key&&(e.preventDefault(),P())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[P]);let U=s&&!s.hideActions?s.usageOnly?{showSessionActions:!1,showUsage:!0}:{showSessionActions:!0,showUsage:!0}:{showSessionActions:!1,showUsage:!1};return(0,n.jsx)(d,{children:(0,n.jsx)(L.f,{children:(0,n.jsx)(O.Provider,{value:{setHeader:R,cwd:i,setCwd:D,sessionId:u,setSessionId:_,runtime:y,setRuntime:q,backgroundTasks:x,setBackgroundTasks:h,todos:p,setTodos:f,initData:b,setInitData:j,sidebarSections:v,setSidebarSection:E,removeSidebarSection:T,closeSidebar:M,tabActions:S,setTabActions:z},children:(0,n.jsxs)("div",{className:"fixed inset-0 flex",children:[(0,n.jsx)(k.Bx,{ref:t}),(0,n.jsxs)("div",{className:"flex-1 min-h-0 min-w-0 flex flex-col",children:[(0,n.jsxs)("header",{className:"shrink-0 flex items-center gap-2 border-b px-4 py-2 bg-background",children:[(0,n.jsx)(g.$,{variant:"ghost",size:"icon",onClick:P,title:"Toggle sidebar (Ctrl+B)",className:"md:hidden",children:(0,n.jsx)(a.A,{className:"h-4 w-4"})}),(0,n.jsxs)("div",{className:"hidden md:flex items-center gap-2 min-w-0 flex-1 overflow-hidden",children:[(0,n.jsx)(l.default,{src:"/icon-192.png",alt:"",width:22,height:22,className:"shrink-0 dark:invert"}),(0,n.jsx)(G,{title:s.title,onRename:s.onRename})]}),(U.showSessionActions||U.showUsage)&&(0,n.jsxs)("div",{className:"flex items-center gap-2 shrink-0 ml-auto",children:[U.showSessionActions&&(0,n.jsxs)(n.Fragment,{children:[i&&(0,n.jsx)(K,{cwd:i}),(0,n.jsx)(N,{}),i&&(0,n.jsx)(I,{todos:p}),i&&(0,n.jsx)(A,{tasks:x})]}),U.showUsage&&(0,n.jsx)(F,{})]})]}),(0,n.jsx)("main",{className:"flex-1 min-h-0 min-w-0 flex flex-col",children:e})]})]})})})})}},8081:(e,t,s)=>{s.d(t,{AX:()=>c,Mi:()=>u,XR:()=>n,bs:()=>l,iz:()=>d,j5:()=>h,jp:()=>m,r5:()=>o,rs:()=>x,w6:()=>r,zQ:()=>i});let n={"200k":{label:"200K",disableEnv:!0,window:2e5},"1m":{label:"1M",disableEnv:!1,window:1e6}},r="200k",a=[{alias:"haiku",version:"4.5",modelId:"claude-haiku-4-5-20251001",displayName:"Haiku 4.5",description:"Fastest",contextSizes:["200k"],contextWindow:2e5,isDefault:!0},{alias:"sonnet",version:"4.6",modelId:"claude-sonnet-4-6",displayName:"Sonnet 4.6",description:"Balanced",contextSizes:["200k","1m"],contextWindow:2e5,isDefault:!0},{alias:"opus",version:"4.6",modelId:"claude-opus-4-6",displayName:"Opus 4.6",description:"Previous generation",contextSizes:["200k","1m"],contextWindow:2e5},{alias:"opus",version:"4.7",modelId:"claude-opus-4-7",displayName:"Opus 4.7",description:"Previous generation",contextSizes:["200k","1m"],contextWindow:2e5,supportsXhigh:!0},{alias:"opus",version:"4.8",modelId:"claude-opus-4-8",displayName:"Opus 4.8",description:"Most capable",contextSizes:["200k","1m"],contextWindow:2e5,isDefault:!0,supportsXhigh:!0},{alias:"fable",version:"5",modelId:"claude-fable-5",displayName:"Fable 5",description:"Most powerful",contextSizes:["200k","1m"],contextWindow:2e5,isDefault:!0,supportsXhigh:!0}];function l(e){if(e)return a.find(t=>t.modelId===e)}function o(e){return a.filter(t=>t.alias===e)}function i(e){return a.find(t=>t.alias===e&&t.isDefault)??o(e)[0]}function c(e){if(!e)return null;let t=e.replace(/\[.*\]$/,"");return"opus"===t||"sonnet"===t||"haiku"===t||"fable"===t?i(t)??null:l(t)??null}function d(e){if(!e||"haiku"===e.alias)return[];let t=["low","medium","high"];return e.supportsXhigh&&t.push("xhigh"),t.push("max"),t}function u(e){return e&&"haiku"!==e.alias?e.supportsXhigh?"xhigh":"sonnet"===e.alias?"medium":"high":null}function m(e){if(!e)return{model:void 0,contextSize:r};let t=/\[1m\]$/i.test(e);return{model:e.replace(/\[.*\]$/,"")||void 0,contextSize:t?"1m":"200k"}}function x(e,t){if(!t)return"anthropic";let s=e.replace(/\[.*\]$/,""),n=t.find(e=>e.models.some(t=>t.modelId===s||`${e.id}:${t.modelId}`===s));return n?.id??"anthropic"}function h(e,t,s,n){let r=c(e);if(r){let e=d(r);return{label:r.displayName,thinking:e.length>0&&("off"===t||e.includes(t))?t:null,context:r.contextSizes.length>=2?s:null}}let a=e.replace(/\[.*\]$/,"");for(let e of n??[]){let n=e.models.find(t=>t.modelId===a||`${e.id}:${t.modelId}`===a);if(n){let e=n.effortLevels??[];return{label:n.displayName||n.modelId,thinking:e.length>0&&("off"===t||e.includes(t))?t:null,context:(n.contextSizes??[]).length>=2?s:null}}}return{label:a.replace(/^[^:]+:/,"")||a,thinking:null,context:null}}},8187:(e,t,s)=>{s.d(t,{N:()=>m});var n=s(95155),r=s(76721),a=s(92571),l=s(20966),o=s(14225),i=s(9107),c=s(12115),d=s(89239),u=s(53972);function m({onSelect:e,onCancel:t,startPath:s}){let[x,h]=(0,c.useState)(s??""),[p,f]=(0,c.useState)([]),[g,b]=(0,c.useState)(!0),[j,v]=(0,c.useState)(""),w=(0,c.useCallback)(async e=>{b(!0),v("");let t=new URLSearchParams({includeFiles:"true"});e&&t.set("path",e);try{let e=await fetch(`/api/filesystem/browse?${t}`);if(!e.ok){let t=await e.json().catch(()=>({error:"Failed to browse"}));v(t.error||"Failed to browse"),f([]);return}let s=await e.json();h(s.path),f(s.entries)}catch{v("Failed to connect"),f([])}finally{b(!1)}},[]);(0,c.useEffect)(()=>{w(s)},[w,s]);let y=/^[a-zA-Z]:[/\\]/.test(x),N=y?x.slice(0,3):"/",k=y?x.slice(0,3):"/",C=(0,u.cs)(x),S=y?C.slice(1):C;return(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1 text-xs font-mono overflow-x-auto",children:[(0,n.jsx)("button",{type:"button",onClick:()=>w(k),className:"shrink-0 text-muted-foreground hover:text-foreground",children:N}),S.map((e,t)=>{let s=k+S.slice(0,t+1).join("/"),a=t===S.length-1;return(0,n.jsxs)("span",{className:"flex items-center gap-1",children:[(0,n.jsx)(r.A,{className:"h-3 w-3 text-muted-foreground shrink-0"}),a?(0,n.jsx)("span",{className:"text-foreground font-medium",children:e}):(0,n.jsx)("button",{type:"button",onClick:()=>w(s),className:"text-muted-foreground hover:text-foreground",children:e})]},s)})]}),(0,n.jsxs)("div",{className:"border rounded-md max-h-56 overflow-y-auto",children:[g&&(0,n.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,n.jsx)(a.A,{className:"h-4 w-4 animate-spin text-muted-foreground"})}),j&&(0,n.jsx)("div",{className:"px-3 py-4 text-sm text-destructive",children:j}),!g&&!j&&x!==k&&(0,n.jsxs)("button",{type:"button",onClick:()=>{w(x.replace(/\/[^/]+\/?$/,"")||k)},className:"flex w-full items-center gap-2 px-3 py-1.5 text-sm hover:bg-muted/50 text-left text-muted-foreground",children:[(0,n.jsx)(l.A,{className:"h-4 w-4 shrink-0"}),(0,n.jsx)("span",{children:".."})]}),!g&&!j&&0===p.length&&(0,n.jsx)("div",{className:"px-3 py-4 text-sm text-muted-foreground",children:"Empty directory"}),!g&&!j&&p.map(t=>"directory"===t.type?(0,n.jsxs)("button",{type:"button",onClick:()=>w(t.path),className:"flex w-full items-center gap-2 px-3 py-1.5 text-sm hover:bg-muted/50 text-left",children:[(0,n.jsx)(o.A,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),(0,n.jsx)("span",{className:"truncate",children:t.name})]},t.path):(0,n.jsxs)("button",{type:"button",onClick:()=>e(t.path),className:"flex w-full items-center gap-2 px-3 py-1.5 text-sm hover:bg-muted/50 text-left",children:[(0,n.jsx)(i.A,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),(0,n.jsx)("span",{className:"truncate",children:t.name})]},t.path))]}),(0,n.jsx)("div",{className:"flex justify-end",children:(0,n.jsx)(d.$,{type:"button",variant:"outline",size:"sm",onClick:t,children:"Cancel"})})]})}},16617:(e,t,s)=>{s.d(t,{Q:()=>x});var n=s(95155),r=s(9751),a=s(9005),l=s(92571),o=s(73321),i=s(12115),c=s(89239),d=s(81477),u=s(1550),m=s(513);function x(e){let{timestamp:t,onClose:s}=e,x=(0,u.E2)(),h=(0,o.useRouter)(),p=e.sessionId??x.sessionId,f=e.cwd??x.cwd,[g,b]=(0,i.useState)([]),[j,v]=(0,i.useState)(""),[w,y]=(0,i.useState)(!0),[N,k]=(0,i.useState)(null),C=(0,i.useRef)(null),S=(0,i.useRef)(new Set);(0,i.useEffect)(()=>{let e=new URLSearchParams({timestamp:String(t)});f&&e.set("cwd",f),fetch(`/api/sessions/${p}/context?${e}`).then(e=>{if(!e.ok)throw Error("Failed to load context");return e.json()}).then(e=>{b(e.messages),v(e.targetMessageId),y(!1)}).catch(e=>{k(e.message),y(!1)})},[p,f,t]),(0,i.useEffect)(()=>{!w&&C.current&&C.current.scrollIntoView({block:"center"})},[w]),(0,i.useEffect)(()=>{let e=e=>{"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),s())};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[s]);let A=(0,i.useCallback)(e=>{e.target===e.currentTarget&&s()},[s]);return(0,n.jsx)("div",{className:"fixed inset-0 z-50 bg-black/50 flex items-center justify-center p-4",onClick:A,children:(0,n.jsxs)(d.Zp,{className:"w-full max-w-3xl flex flex-col",style:{maxHeight:"calc(100dvh - 2rem)"},children:[(0,n.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b shrink-0",children:[(0,n.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:"Message context"}),(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[e.sessionId&&(0,n.jsxs)(c.$,{variant:"ghost",size:"sm",className:"h-6 gap-1 px-2 text-xs",title:"Open session",onClick:()=>{h.push(`/sessions/${p}?cwd=${encodeURIComponent(f??"")}&historyView=true`),s()},children:[(0,n.jsx)(r.A,{className:"h-3 w-3"}),"Open session"]}),(0,n.jsx)(c.$,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:s,children:(0,n.jsx)(a.A,{className:"h-4 w-4"})})]})]}),(0,n.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[w&&(0,n.jsx)("div",{className:"flex justify-center py-12",children:(0,n.jsx)(l.A,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),N&&(0,n.jsx)("div",{className:"text-center text-sm text-red-500 py-12",children:N}),!w&&g.map(e=>(0,n.jsx)("div",{ref:e.id===j?C:void 0,className:e.id===j?"ring-2 ring-primary/50 rounded-lg":void 0,children:(0,n.jsx)(m.s,{message:e,expandedToolIds:S})},e.id))]})]})})}},18189:(e,t,s)=>{s.d(t,{NG:()=>x,WG:()=>o,Ik:()=>m});var n=s(95155),r=s(12115),a=s(53972);let l={ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",py:"python",rb:"ruby",rs:"rust",go:"go",java:"java",kt:"kotlin",swift:"swift",c:"c",cpp:"cpp",h:"c",hpp:"cpp",cs:"csharp",css:"css",scss:"scss",html:"html",vue:"vue",svelte:"svelte",json:"json",yaml:"yaml",yml:"yaml",toml:"toml",xml:"xml",sql:"sql",sh:"bash",bash:"bash",zsh:"bash",fish:"fish",ps1:"powershell",md:"markdown",mdx:"mdx",graphql:"graphql",gql:"graphql",dockerfile:"dockerfile",tf:"hcl",lua:"lua",r:"r",php:"php",scala:"scala",ex:"elixir",exs:"elixir",erl:"erlang",hs:"haskell",ml:"ocaml",zig:"zig"};function o(e){let t=(0,a.uk)(e)||"",s=t.toLowerCase();if("dockerfile"===s)return"dockerfile";if("makefile"===s)return"makefile";let n=t.includes(".")?t.split(".").pop()?.toLowerCase():void 0;if(n)return l[n]}function i(e){let t=e.split(/\r?\n/),s=/^\s*(\d+)\u2192(.*)$/,n=t[0]?.match(s);if(!n)return{code:e,startLine:1};let r=parseInt(n[1],10);return{code:t.map(e=>{let t=e.match(s);return t?t[2]:e}).join("\n"),startLine:r}}async function c(e,t,n){try{let r=await s.e(81272).then(s.bind(s,81272));return await r.codeToHtml(e,{lang:t,theme:n})}catch{return null}}let d=new Map;function u(e,t,s){return`${s}:${t}:${e}`}function m(e,t,s){let{code:n}=i(e),r=s?"github-dark":"github-light",a=u(n,t,r);d.has(a)||c(n,t,r).then(e=>{e&&d.set(a,e)})}function x({code:e,language:t,dark:s,fullHeight:a,wrap:l}){let{code:o,startLine:m}=i(e),h=s?"github-dark":"github-light",p=t?u(o,t,h):"",[f,g]=(0,r.useState)(t?d.get(p)??null:null);(0,r.useEffect)(()=>{if(!t)return void g(null);let e=d.get(p);if(e)return void g(e);let s=!1;return c(o,t,h).then(e=>{e&&d.set(p,e),s||g(e)}),()=>{s=!0}},[o,t,h,p]);let b=`
2
+ .code-block-lines code {
3
+ counter-reset: line ${m-1};
4
+ }
5
+ .code-block-lines code .line::before {
6
+ counter-increment: line;
7
+ content: counter(line);
8
+ display: inline-block;
9
+ width: 3ch;
10
+ margin-right: 1.5ch;
11
+ text-align: right;
12
+ color: var(--line-number-color, rgba(115,138,148,0.4));
13
+ user-select: none;
14
+ }${l?`
15
+ .code-block-lines.code-block-wrap code .line {
16
+ display: block;
17
+ padding-left: 4.5ch;
18
+ text-indent: -4.5ch;
19
+ }`:""}
20
+ `,j=l?"overflow-x-hidden":"overflow-x-auto",v=l?" code-block-wrap [&_pre]:whitespace-pre-wrap [&_pre]:[overflow-wrap:anywhere]":"",w=l?" whitespace-pre-wrap [overflow-wrap:anywhere]":"",y=l&&f?f.replace(/\n/g,""):f;return f?(0,n.jsxs)("div",{className:`code-block-lines ${j} rounded text-[11px] leading-relaxed overflow-y-auto [&_pre]:!bg-transparent [&_pre]:p-2 [&_pre]:m-0${v}${a?"":" max-h-64"}`,children:[(0,n.jsx)("style",{children:b}),(0,n.jsx)("div",{dangerouslySetInnerHTML:{__html:y??""}})]}):(0,n.jsx)("pre",{className:`${j} rounded bg-muted/50 p-2 text-[11px] leading-relaxed overflow-y-auto${w}${a?"":" max-h-64"}`,children:o})}},20108:(e,t,s)=>{s.d(t,{t:()=>p});var n=s(95155),r=s(31966),a=s(16449),l=s(49804),o=s(15480),i=s(95660),c=s(92571),d=s(12115),u=s(89239),m=s(42763),x=s(60529),h=s(41158);function p({open:e,onOpenChange:t,onSubmit:s}){let[g,b]=(0,d.useState)("backend"),[j,v]=(0,d.useState)("session"),[w,y]=(0,d.useState)(""),[N,k]=(0,d.useState)(""),[C,S]=(0,d.useState)(null),[A,$]=(0,d.useState)(!1),[E,I]=(0,d.useState)(""),[T,R]=(0,d.useState)(""),[D,_]=(0,d.useState)(""),[P,M]=(0,d.useState)(!1),[q,z]=(0,d.useState)(!1),[U,F]=(0,d.useState)(""),L=()=>{b("backend"),y(""),k(""),S(null),$(!1),I(""),R(""),_(""),M(!1),z(!1),F("")},O=e=>{S(e),b("details")},W=async e=>{if(e.preventDefault(),E.trim()&&T.trim()&&C){z(!0),F("");try{let e=await fetch("/api/git/clone",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:E.trim(),parentPath:T.trim(),folderName:D.trim()||void 0})}),n=await e.json();if(!e.ok)return void F(n.error||"Clone failed");s(n.path,N.trim(),C),L(),t(!1)}catch{F("Failed to connect")}finally{z(!1)}}};return(0,n.jsx)(m.lG,{open:e,onOpenChange:e=>{e||L(),t(e)},children:(0,n.jsxs)(m.Cf,{className:"flex flex-col",onClose:()=>{L(),t(!1)},children:[(0,n.jsx)(m.c7,{children:(0,n.jsxs)(m.L3,{className:"flex items-center gap-2",children:["details"===g&&(0,n.jsx)("button",{type:"button",onClick:()=>b("backend"),className:"rounded-md p-1 text-muted-foreground hover:bg-accent hover:text-foreground",title:"Back to backend selection",children:(0,n.jsx)(r.A,{className:"h-4 w-4"})}),"backend"===g?"Choose Backend":"New Session"]})}),"backend"===g&&(0,n.jsxs)("div",{className:"space-y-3 mt-2",children:[(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Pick how Claude runs for this session."}),(0,n.jsx)(f,{icon:(0,n.jsx)(a.A,{className:"h-5 w-5"}),title:"PTY (interactive)",subtitle:"Pseudo-terminal",description:"Spawns a real Claude TUI in a pseudo-terminal. Supports interactive features like slash commands.",onClick:()=>O("pty")}),(0,n.jsx)(f,{icon:(0,n.jsx)(l.A,{className:"h-5 w-5"}),title:"Stream (headless)",subtitle:"Structured output",description:"Runs Claude with structured JSON streaming. Lower overhead, better for automated workflows.",onClick:()=>O("stream")})]}),"details"===g&&(0,n.jsxs)("div",{className:"flex flex-1 flex-col min-h-0 mt-2",children:[(0,n.jsxs)("div",{className:"flex gap-1 border-b shrink-0",children:[(0,n.jsx)("button",{type:"button",onClick:()=>v("session"),className:`px-3 py-1.5 text-sm font-medium border-b-2 transition-colors ${"session"===j?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"Open Directory"}),(0,n.jsxs)("button",{type:"button",onClick:()=>v("clone"),className:`px-3 py-1.5 text-sm font-medium border-b-2 transition-colors flex items-center gap-1.5 ${"clone"===j?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[(0,n.jsx)(o.A,{className:"h-3.5 w-3.5"}),"Clone Repo"]})]}),"session"===j&&(0,n.jsxs)("form",{onSubmit:e=>{e.preventDefault(),w.trim()&&C&&(s(w.trim(),N.trim(),C),L(),t(!1))},className:"flex flex-1 flex-col min-h-0",children:[(0,n.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto space-y-4 pt-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"text-sm font-medium",children:"Working Directory"}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(x.p,{value:w,onChange:e=>y(e.target.value),placeholder:"/home/user/project",required:!0}),(0,n.jsx)(u.$,{type:"button",variant:"outline",size:"icon",onClick:()=>$(!A),title:"Browse directories",children:(0,n.jsx)(i.A,{className:"h-4 w-4"})})]})]}),A&&(0,n.jsx)(h.K,{onSelect:e=>{y(e),$(!1)},onCancel:()=>$(!1)}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"text-sm font-medium",children:"Name (optional)"}),(0,n.jsx)(x.p,{value:N,onChange:e=>k(e.target.value),placeholder:"My Project"})]})]}),(0,n.jsx)("div",{className:"shrink-0 -mx-6 border-t bg-background px-6 pt-3",children:(0,n.jsx)(u.$,{type:"submit",className:"w-full",disabled:!w.trim(),children:"Create Session"})})]}),"clone"===j&&(0,n.jsxs)("form",{onSubmit:W,className:"flex flex-1 flex-col min-h-0",children:[(0,n.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto space-y-4 pt-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"text-sm font-medium",children:"Repository URL"}),(0,n.jsx)(x.p,{value:E,onChange:e=>I(e.target.value),placeholder:"https://github.com/user/repo.git",required:!0})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"text-sm font-medium",children:"Clone Into"}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(x.p,{value:T,onChange:e=>R(e.target.value),placeholder:"/home/user/projects",required:!0}),(0,n.jsx)(u.$,{type:"button",variant:"outline",size:"icon",onClick:()=>M(!P),title:"Browse directories",children:(0,n.jsx)(i.A,{className:"h-4 w-4"})})]})]}),P&&(0,n.jsx)(h.K,{onSelect:e=>{R(e),M(!1)},onCancel:()=>M(!1)}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"text-sm font-medium",children:"Folder Name (optional)"}),(0,n.jsx)(x.p,{value:D,onChange:e=>_(e.target.value),placeholder:"Defaults to repository name"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"text-sm font-medium",children:"Session Name (optional)"}),(0,n.jsx)(x.p,{value:N,onChange:e=>k(e.target.value),placeholder:"My Project"})]}),U&&(0,n.jsx)("p",{className:"text-sm text-destructive",children:U})]}),(0,n.jsx)("div",{className:"shrink-0 -mx-6 border-t bg-background px-6 pt-3",children:(0,n.jsx)(u.$,{type:"submit",className:"w-full",disabled:!E.trim()||!T.trim()||q,children:q?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(c.A,{className:"h-4 w-4 animate-spin mr-2"}),"Cloning..."]}):"Clone & Create Session"})})]})]})]})})}function f({icon:e,title:t,subtitle:s,description:r,onClick:a}){return(0,n.jsxs)("button",{type:"button",onClick:a,className:"w-full text-left rounded-lg border border-input bg-card px-4 py-3 transition-colors hover:border-foreground hover:bg-accent",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3 mb-1",children:[(0,n.jsx)("span",{className:"text-foreground",children:e}),(0,n.jsxs)("div",{className:"flex-1",children:[(0,n.jsx)("div",{className:"text-sm font-medium",children:t}),(0,n.jsx)("div",{className:"text-xs text-muted-foreground",children:s})]})]}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground mt-2",children:r})]})}},22317:(e,t,s)=>{s.d(t,{t:()=>l});var n=s(12115),r=s(8081);let a={diffStyle:"split",dismissKeyboardOnSend:!0,thinkingLevel:"high",bypassAllPermissions:!1,thinkingExpanded:!1,readExpanded:!1,editExpanded:!1,toolCallsExpanded:!1,modelSlots:{main:"sonnet"},messageStitching:!0,reviewsEnabled:!0,terminalFontSize:14,terminalTheme:"dark",terminalScrollback:1e3};function l(){let[e,t]=(0,n.useState)(a),[s,l]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{fetch("/api/defaults").then(e=>e.json()).then(e=>{if(e.model&&!e.modelSlots&&(e.modelSlots={main:e.model},delete e.model),e.modelSlots?.main?.includes("[")){let t=(0,r.jp)(e.modelSlots.main);e.modelSlots={...e.modelSlots,main:t.model,mainContext:e.modelSlots.mainContext??t.contextSize}}t({...a,...e}),l(!0)}).catch(()=>l(!0))},[]),{settings:e,updateSetting:(0,n.useCallback)((e,s)=>{t(t=>{let n={...t,[e]:s};return fetch("/api/defaults",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[e]:s})}).catch(()=>{}),n})},[]),loaded:s}}},23965:(e,t,s)=>{s.d(t,{Bx:()=>et,HC:()=>Z,MJ:()=>K,MN:()=>B});var n=s(95155),r=s(44923),a=s(87256),l=s(39768),o=s(58274),i=s(9005),c=s(2125),d=s(85618),u=s(88074),m=s(35397),x=s(44354),h=s(83212),p=s(19257),f=s(797),g=s(1275),b=s(64577),j=s(77618),v=s(61665),w=s(90710),y=s(73321),N=s(12115),k=s(1550),C=s(8187),S=s(96301),A=s(76721),$=s(40980);let E="cockpit_sidebar_sections";function I({id:e,title:t,badge:s,defaultOpen:r=!0,actions:a,children:l}){let[o,i]=(0,N.useState)(r);return(0,N.useEffect)(()=>{i(function(e,t){try{let t=localStorage.getItem(E);if(t){let s=JSON.parse(t);if(e in s)return s[e]}}catch{}return t}(e,r))},[e,r]),(0,n.jsxs)("div",{className:"border-b last:border-b-0",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsxs)("button",{type:"button",onClick:()=>{let t=!o;i(t);try{let s=localStorage.getItem(E),n=s?JSON.parse(s):{};n[e]=t,localStorage.setItem(E,JSON.stringify(n))}catch{}},className:"flex flex-1 items-center gap-1.5 px-3 py-2 text-left text-xs font-semibold uppercase tracking-wide text-muted-foreground hover:bg-accent/50 transition-colors min-w-0",children:[(0,n.jsx)(A.A,{className:(0,$.cn)("h-3 w-3 shrink-0 transition-transform",o&&"rotate-90")}),(0,n.jsx)("span",{className:"flex-1 min-w-0 truncate",children:t}),s&&(0,n.jsx)("span",{className:"shrink-0 rounded-full bg-muted px-1.5 py-0.5 text-[10px] leading-none",children:s})]}),a&&(0,n.jsx)("div",{className:"shrink-0 pr-2 flex items-center",children:a})]}),o&&l]})}var T=s(89239),R=s(42763),D=s(67032),_=s(22317),P=s(89323),M=s(30090),q=s(92571),z=s(59184);function U({open:e,onOpenChange:t}){let s=(0,N.useRef)(null),[r,a]=(0,N.useState)(null),[l,o]=(0,N.useState)(!1),[c,d]=(0,N.useState)(null),[u,m]=(0,N.useState)("");(0,N.useRef)(!1),(0,N.useEffect)(()=>{e&&d(null)},[e]),(0,N.useEffect)(()=>{if(!e)return;let t=s.current;if(t)return void a(t);let n=!1;return o(!0),async function(){try{let e=await fetch("/api/assistant-session");if(!e.ok)throw Error("Failed to initialize assistant");let{sessionId:t,cwd:r}=await e.json();n||(s.current=t,a(t),m(r))}catch(e){n||d(e instanceof Error?e.message:"Failed to initialize")}finally{n||o(!1)}}(),()=>{n=!0}},[e]);let x=(0,N.useCallback)(e=>{e||a(null),t(e)},[t]);return(0,n.jsx)(R.lG,{open:e,onOpenChange:x,children:(0,n.jsxs)(R.Cf,{className:"sm:max-w-3xl h-[80vh] flex flex-col p-0 gap-0 overflow-hidden",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 px-4 py-3 border-b shrink-0",children:[(0,n.jsx)(w.A,{className:"h-4 w-4 text-muted-foreground"}),(0,n.jsx)("span",{className:"text-sm font-medium",children:"Cockpit Assistant"}),(0,n.jsx)("button",{type:"button",onClick:()=>x(!1),"aria-label":"Close assistant",className:"ml-auto rounded-sm text-muted-foreground opacity-70 transition-opacity hover:opacity-100",children:(0,n.jsx)(i.A,{className:"h-4 w-4"})})]}),(0,n.jsxs)("div",{className:"flex-1 min-h-0 flex flex-col",children:[l&&(0,n.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,n.jsx)(q.A,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),c&&(0,n.jsx)("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground px-4",children:c}),r&&!l&&!c&&(0,n.jsx)(z.I,{sessionId:r,cwd:u,showPlanToggle:!1,isCockpitAgent:!0})]})]})})}var F=s(20108);let L="cockpit_sidebar_width";function O({onResize:e}){let t=(0,N.useRef)(!1),s=(0,N.useRef)(0),r=(0,N.useCallback)(n=>{n.preventDefault(),t.current=!0,s.current=n.clientX;let r=n=>{if(!t.current)return;let r=n.clientX-s.current;s.current=n.clientX,e(r)},a=()=>{t.current=!1,document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",a),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",r),document.addEventListener("mouseup",a)},[e]);return(0,n.jsx)("div",{onMouseDown:r,className:"hidden md:block absolute inset-y-0 right-0 w-1 cursor-col-resize hover:bg-primary/30 transition-colors z-10"})}let W="cockpit_unread_sessions";async function B(e){await fetch("/api/sessions/pinned",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({add:e})}).catch(()=>{})}async function J(e){await fetch("/api/sessions/pinned",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({remove:e})}).catch(()=>{})}async function H(){try{let e=await fetch("/api/sessions/pinned");if(!e.ok)return[];let t=await e.json();return Array.isArray(t.pinned)?t.pinned:[]}catch{return[]}}let G=new Set;async function K(e){for(let t of(await fetch("/api/reviews/pinned",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({add:e})}).catch(()=>{}),G))t()}async function Q(e){await fetch("/api/reviews/pinned",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({remove:e})}).catch(()=>{})}async function X(){try{let e=await fetch("/api/reviews/pinned");if(!e.ok)return[];let t=await e.json();return Array.isArray(t.pinned)?t.pinned:[]}catch{return[]}}let V=/^Review:\s*(?:(.+?)\/)?(.+?)#(\d+)(?:\s+-\s+(.*))?$/;function Y(){try{let e=localStorage.getItem(W);if(e)return new Set(JSON.parse(e))}catch{}return new Set}function Z(e){let t=Y();t.delete(e),localStorage.setItem(W,JSON.stringify([...t]))}function ee({session:e,isCurrent:t,isUnread:s,onNavigate:r,onAction:c}){var d;let u,{attributes:m,listeners:x,setNodeRef:h,transform:p,transition:f,isDragging:g}=(0,a.gl)({id:e.id}),b={transform:l.Ks.Transform.toString(p),transition:f,opacity:g?.5:1};return(0,n.jsxs)("div",{ref:h,style:b,role:"button",tabIndex:0,onClick:()=>r(e),onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),r(e))},className:(0,$.cn)("w-full flex items-center gap-2 px-3 py-2 text-left text-sm hover:bg-accent/50 transition-colors cursor-pointer",t&&"bg-accent"),children:[(0,n.jsx)("button",{type:"button",...m,...x,onClick:e=>e.stopPropagation(),className:"shrink-0 cursor-grab active:cursor-grabbing text-muted-foreground/60 hover:text-muted-foreground touch-none",title:"Drag to reorder","aria-label":"Drag to reorder",children:(0,n.jsx)(o.A,{className:"h-4 w-4"})}),(0,n.jsx)("div",{className:"shrink-0 relative flex items-center justify-center h-4 w-4",children:(e.pendingRequestCount??0)>0?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"absolute h-4 w-4 rounded-full bg-blue-500/20 animate-ping"}),(0,n.jsx)("div",{className:"h-2.5 w-2.5 rounded-full bg-blue-500",title:"Awaiting your input","data-testid":"status-pending"})]}):"running"===e.status?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"absolute h-4 w-4 rounded-full bg-yellow-500/20 animate-ping"}),(0,n.jsx)("div",{className:"h-2.5 w-2.5 rounded-full bg-yellow-500",title:"Working","data-testid":"status-running"})]}):s?(0,n.jsx)("div",{className:"h-2.5 w-2.5 rounded-full bg-green-500",title:"New response","data-testid":"status-unread"}):(0,n.jsx)("div",{className:"h-2.5 w-2.5 rounded-full bg-muted-foreground/30","data-testid":"status-idle"})}),(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)("div",{className:"truncate font-medium text-left",dir:"rtl",title:e.cwd,children:(0,n.jsx)("bdo",{dir:"ltr",children:(u=(d=e.cwd).split(/[/\\]/)).length>2?"~/"+u.slice(-2).join("/"):d})}),(0,n.jsx)("div",{className:"truncate text-xs text-muted-foreground",children:e.name})]}),(0,n.jsx)(T.$,{variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0 text-red-500 hover:text-red-600 hover:bg-red-500/10",onClick:t=>c(t,e),title:"running"===e.status?"Stop session":"Remove from sidebar",children:(0,n.jsx)(i.A,{className:"h-4 w-4"})})]})}let et=(0,N.forwardRef)(function(e,t){let s=(0,y.useRouter)(),l=(0,y.usePathname)(),{send:o,subscribe:m,connected:x}=(0,P.h)(),{sidebarSections:h,cwd:p,sessionId:f}=(0,k.E2)(),{settings:g}=(0,_.t)(),[b,j]=(0,N.useState)(!1),[v,w]=(0,N.useState)([]),[C,S]=(0,N.useState)(new Set),[A,E]=(0,N.useState)(!1),[R,D]=(0,N.useState)(!1),[M,q]=(0,N.useState)(288);(0,N.useEffect)(()=>{q(function(){try{let e=localStorage.getItem(L);if(e){let t=parseInt(e,10);if(t>=200&&t<=480)return t}}catch{}return 288}())},[]),(0,N.useEffect)(()=>{s.prefetch("/sessions/_")},[s]);let z=(0,N.useCallback)(e=>{q(t=>{let s=Math.max(200,Math.min(480,t+e));return localStorage.setItem(L,String(s)),s})},[]),G=(0,N.useRef)(new Map),K=(0,r.FR)((0,r.MS)(r.AN,{activationConstraint:{delay:150,tolerance:5}}));(0,N.useImperativeHandle)(t,()=>({toggle:()=>j(e=>!e),close:()=>j(!1)}),[]);let Q=(0,N.useCallback)(()=>j(!1),[]),X=l.startsWith("/sessions/")?l.split("/")[2]:null;(0,N.useEffect)(()=>m(e=>{if("session:status"===e.type){let{sessionId:t,status:s}=e,n=new Set(v.map(e=>e.id));if(!n.has(t))return void console.log("[sidebar] status update for unknown session",t.slice(0,8),"known:",[...n].map(e=>e.slice(0,8)));console.log("[sidebar] status updated",t.slice(0,8),"->",s);let r=G.current.get(t);if(G.current.set(t,s),"running"===r&&"idle"===s&&X!==t){let e;(e=Y()).add(t),localStorage.setItem(W,JSON.stringify([...e])),S(Y())}w(e=>e.map(e=>e.id===t?{...e,status:s}:e))}else if("session:pending"===e.type){let{sessionId:t,count:s}=e;if(!new Set(v.map(e=>e.id)).has(t))return void console.log("[sidebar] pending update for unknown session",t.slice(0,8));console.log("[sidebar] pending updated",t.slice(0,8),"->",s),w(e=>e.map(e=>e.id===t?{...e,pendingRequestCount:s}:e))}else if("session:info_updated"===e.type){let{sessionId:t,info:s}=e;w(e=>e.map(e=>e.id===t?{...e,name:s.name,model:s.model}:e))}}),[m,X,v]);let V=(0,N.useCallback)(async()=>{S(Y());let e=await H();if(0===e.length)return void w([]);let t=e.join(","),s=await fetch(`/api/sessions/by-ids?ids=${encodeURIComponent(t)}`).then(e=>e.ok?e.json():null).catch(()=>null);if(!s)return;let n=(s.sessions||[]).filter(e=>!e.cwd.endsWith(".cockpit/reviews")),r=new Set(Array.isArray(s.foundIds)?s.foundIds:n.map(e=>e.id)),a=new Map(n.map(e=>[e.id,e])),l=[],i=[];for(let t of e){let e=a.get(t);e&&(l.push(e),i.push(t))}for(let t of(e.some(e=>!r.has(e))&&fetch("/api/sessions/pinned",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({pinned:i})}).catch(()=>{}),l))G.current.has(t.id)||G.current.set(t.id,t.status);w(l),l.length>0&&o({type:"session:subscribe",sessionIds:l.map(e=>e.id)})},[o]),et=(0,N.useRef)(!1);(0,N.useEffect)(()=>{et.current||(et.current=!0,V())},[V]),(0,N.useEffect)(()=>{(b||x)&&V()},[b,x,l,V]);let ed=async(e,t)=>{e.stopPropagation(),(await fetch(`/api/sessions/${t}`,{method:"DELETE"})).ok&&(await J(t),Z(t),S(Y()),w(e=>e.filter(e=>e.id!==t)),X===t&&s.push("/"))},eu=async(e,t)=>{e.stopPropagation(),await J(t),Z(t),S(Y()),w(e=>e.filter(e=>e.id!==t)),X===t&&s.push("/")},em=(0,N.useCallback)(e=>{let{active:t,over:s}=e;if(!s||t.id===s.id)return;let n=v.findIndex(e=>e.id===t.id),r=v.findIndex(e=>e.id===s.id);if(n<0||r<0)return;let l=(0,a.be)(v,n,r);w(l),fetch("/api/sessions/pinned",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({pinned:l.map(e=>e.id)})}).catch(e=>console.error("Failed to persist sidebar order",e))},[v]),ex=async(e,t,n)=>{let r=await fetch("/api/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e,name:t||void 0,runtime:n})});if(r.ok){let t=await r.json();await B(t.sessionId),await V(),Q(),s.push(`/sessions/${t.sessionId}?cwd=${encodeURIComponent(e)}`)}},eh=e=>{Z(e.id),S(Y()),Q();let t=new URLSearchParams({cwd:e.cwd});e.name&&t.set("name",e.name),s.push(`/sessions/${e.id}?${t}`)};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:(0,$.cn)("fixed inset-0 z-40 bg-black/50 transition-opacity md:hidden",b?"opacity-100":"opacity-0 pointer-events-none"),onMouseDown:Q}),(0,n.jsxs)("div",{className:(0,$.cn)("fixed inset-y-0 left-0 z-50 bg-background border-r flex flex-col transition-transform duration-200","md:relative md:inset-auto md:z-auto md:translate-x-0 md:shrink-0 md:transition-none",b?"translate-x-0":"-translate-x-full"),style:{width:M},children:[(0,n.jsx)(O,{onResize:z}),(0,n.jsx)("div",{className:"flex items-center justify-end px-3 py-1 border-b md:hidden",children:(0,n.jsx)(T.$,{variant:"ghost",size:"icon",onClick:Q,children:(0,n.jsx)(i.A,{className:"h-4 w-4"})})}),(0,n.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[(0,n.jsx)(I,{id:"sessions",title:"Sessions",badge:v.length>0?String(v.length):void 0,actions:(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(T.$,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>E(!0),title:"New session",children:(0,n.jsx)(c.A,{className:"h-3.5 w-3.5"})}),(0,n.jsx)(T.$,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>{Q(),s.push("/")},title:"All sessions",children:(0,n.jsx)(d.A,{className:"h-3 w-3"})})]}),children:0===v.length?(0,n.jsx)("p",{className:"px-3 py-3 text-sm text-muted-foreground",children:"No active sessions."}):(0,n.jsx)(r.Mp,{sensors:K,onDragEnd:em,children:(0,n.jsx)(a.gB,{items:v.map(e=>e.id),strategy:a._G,children:v.map(e=>(0,n.jsx)(ee,{session:e,isCurrent:X===e.id,isUnread:C.has(e.id),onNavigate:eh,onAction:(e,t)=>"running"===t.status?ed(e,t.id):eu(e,t.id)},e.id))})})}),(0,n.jsx)(er,{sections:h,exclude:en}),p&&!h.has("git-changes")&&(0,n.jsx)(el,{cwd:p,sessionId:f}),p&&!h.has("file-tree")&&(0,n.jsx)(ea,{cwd:p}),g.reviewsEnabled&&(0,n.jsx)(es,{onNavigate:Q}),g.reviewsEnabled&&(0,n.jsx)(I,{id:"pr-files",title:h.get("pr-files")?.title||"PR Files",badge:h.get("pr-files")?.badge,defaultOpen:!1,children:h.has("pr-files")?h.get("pr-files").content:(0,n.jsx)("div",{className:"px-3 py-3 text-xs text-muted-foreground",children:"No PR open"})})]}),(0,n.jsxs)("div",{className:"border-t px-3 py-2 flex items-center justify-end gap-2",children:[(0,n.jsx)(ec,{onClick:()=>D(!0)}),(0,n.jsx)(eo,{onClick:()=>{Q(),s.push("/jobs")}}),(0,n.jsx)(ei,{onClick:()=>{Q(),s.push("/inbox")}}),(0,n.jsx)(T.$,{variant:"ghost",size:"icon",className:"shrink-0 h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>{sessionStorage.removeItem("settings-scroll"),Q(),s.push("/settings")},title:"Settings",children:(0,n.jsx)(u.A,{className:"h-4 w-4"})})]})]}),(0,n.jsx)(F.t,{open:A,onOpenChange:E,onSubmit:ex}),(0,n.jsx)(U,{open:R,onOpenChange:D})]})});function es({onNavigate:e}){let t=(0,y.useRouter)(),s=(0,y.usePathname)(),{subscribe:r,send:a}=(0,P.h)(),[l,o]=(0,N.useState)([]),c=(0,N.useCallback)(async()=>{let e=await X();if(0===e.length)return void o([]);let t=await fetch(`/api/sessions/by-ids?ids=${encodeURIComponent(e.join(","))}`).then(e=>e.ok?e.json():null).catch(()=>null);if(!t)return;let s=t.sessions||[],n=new Set(Array.isArray(t.foundIds)?t.foundIds:s.map(e=>e.id)),r=new Map(s.map(e=>[e.id,e])),l=[],i=[];for(let t of e){let e=r.get(t);if(e){let s=function(e){let t=V.exec(e.name);return t?{id:e.id,owner:t[1]||"",repo:t[2],number:parseInt(t[3],10),title:t[4]||"",status:e.status,pendingRequestCount:e.pendingRequestCount??0}:null}(e);s&&l.push(s),i.push(t)}}e.some(e=>!n.has(e))&&fetch("/api/reviews/pinned",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({pinned:i})}).catch(()=>{}),o(l),l.length>0&&a({type:"session:subscribe",sessionIds:l.map(e=>e.id)})},[a]);(0,N.useEffect)(()=>{c()},[s,c]),(0,N.useEffect)(()=>{var e;return e=()=>c(),G.add(e),()=>{G.delete(e)}},[c]),(0,N.useEffect)(()=>r(e=>{if("session:status"===e.type){let{sessionId:t,status:s}=e;o(e=>e.map(e=>e.id===t?{...e,status:s}:e))}else if("session:pending"===e.type){let{sessionId:t,count:s}=e;o(e=>e.map(e=>e.id===t?{...e,pendingRequestCount:s}:e))}}),[r]);let d=s=>{e(),s.owner?t.push(`/reviews/${s.owner}/${s.repo}/${s.number}`):t.push("/reviews")};return(0,n.jsx)(I,{id:"reviews",title:"Reviews",badge:l.length>0?String(l.length):void 0,actions:(0,n.jsx)(T.$,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>{e(),t.push("/reviews")},title:"All reviews",children:(0,n.jsx)(m.A,{className:"h-3 w-3"})}),children:0===l.length?(0,n.jsx)("p",{className:"px-3 py-3 text-sm text-muted-foreground",children:"No pinned reviews."}):l.map(e=>(0,n.jsxs)("div",{role:"button",tabIndex:0,onClick:()=>d(e),onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),d(e))},className:"w-full flex items-center gap-2 px-3 py-2 text-left text-sm hover:bg-accent/50 transition-colors cursor-pointer",children:[(0,n.jsx)("div",{className:"shrink-0 relative flex items-center justify-center h-4 w-4",children:e.pendingRequestCount>0?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"absolute h-4 w-4 rounded-full bg-blue-500/20 animate-ping"}),(0,n.jsx)("div",{className:"h-2.5 w-2.5 rounded-full bg-blue-500",title:"Awaiting input"})]}):"running"===e.status?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"absolute h-4 w-4 rounded-full bg-yellow-500/20 animate-ping"}),(0,n.jsx)("div",{className:"h-2.5 w-2.5 rounded-full bg-yellow-500",title:"Working"})]}):(0,n.jsx)("div",{className:"h-2.5 w-2.5 rounded-full bg-muted-foreground/30"})}),(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsxs)("div",{className:"truncate font-medium",children:[e.repo,"#",e.number]}),e.title&&(0,n.jsx)("div",{className:"truncate text-xs text-muted-foreground",children:e.title})]}),(0,n.jsx)(T.$,{variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0 text-red-500 hover:text-red-600 hover:bg-red-500/10",onClick:t=>{var s;return s=e.id,void(t.stopPropagation(),o(e=>e.filter(e=>e.id!==s)),Q(s))},title:"Remove",children:(0,n.jsx)(i.A,{className:"h-4 w-4"})})]},e.id))})}let en=new Set(["pr-files"]);function er({sections:e,exclude:t}){let s=(0,N.useMemo)(()=>Array.from(e.values()).filter(e=>!t?.has(e.id)).sort((e,t)=>(e.order??50)-(t.order??50)),[e,t]);return(0,n.jsx)(n.Fragment,{children:s.map(e=>(0,n.jsx)(I,{id:e.id,title:e.title,badge:e.badge,actions:e.actions,children:e.content},e.id))})}function ea({cwd:e}){let{tabActions:t,closeSidebar:s}=(0,k.E2)(),[r,a]=(0,N.useState)(!1),l=(0,N.useCallback)(e=>{t?.openFile(e),window.innerWidth<768&&s()},[t,s]),o=(0,N.useCallback)(e=>{l(e),a(!1)},[l]);return(0,n.jsxs)(I,{id:"files",title:"Session Files",defaultOpen:!1,actions:(0,n.jsx)("button",{onClick:()=>a(!0),title:"Open file",className:"flex items-center justify-center rounded p-0.5 hover:bg-accent text-muted-foreground",children:(0,n.jsx)(c.A,{className:"h-3.5 w-3.5"})}),children:[(0,n.jsx)(S.h,{cwd:e,selectedFile:null,onSelectFile:l}),(0,n.jsx)(R.lG,{open:r,onOpenChange:a,children:(0,n.jsxs)(R.Cf,{className:"sm:max-w-lg",children:[(0,n.jsx)(R.c7,{children:(0,n.jsx)(R.L3,{children:"Open File"})}),(0,n.jsx)(C.N,{startPath:e,onSelect:o,onCancel:()=>a(!1)})]})})]})}function el({cwd:e}){let t=(0,y.usePathname)(),{tabActions:s}=(0,k.E2)(),{subscribe:r}=(0,P.h)(),{checkedFiles:a,toggleFile:l}=(0,M.e)(e),[o,i]=(0,N.useState)(""),[c,d]=(0,N.useState)(null),[u,m]=(0,N.useState)([]),j=(0,N.useRef)(e);j.current=e;let v=(0,N.useCallback)(()=>{fetch(`/api/git/status?cwd=${encodeURIComponent(j.current)}`).then(e=>{if(!e.ok)throw Error("Not a git repository");return e.json()}).then(e=>{m(e.files||[]),i(e.branch||""),d(null)}).catch(e=>{m([]),i(""),d(e instanceof Error?e.message:"Failed to load")})},[]);(0,N.useEffect)(()=>{v()},[e,t,v]),(0,N.useEffect)(()=>r(e=>{"session:fs_changed"===e.type&&v()}),[r,v]);let w=u.reduce((e,t)=>e+t.additions,0),C=u.reduce((e,t)=>e+t.deletions,0);return(0,n.jsx)(I,{id:"session-changes",title:"Session Changes",badge:u.length>0?String(u.length):void 0,defaultOpen:!1,children:c?(0,n.jsx)("p",{className:"px-3 py-3 text-sm text-muted-foreground",children:c}):0===u.length?(0,n.jsx)("p",{className:"px-3 py-3 text-sm text-muted-foreground",children:"Working tree clean"}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"px-3 py-1.5 text-xs text-muted-foreground flex items-center gap-2 border-b",children:[o&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{children:"Branch:"}),(0,n.jsx)("span",{className:"font-mono font-bold text-foreground",children:o}),(0,n.jsx)("span",{className:"mx-0.5",children:"\xb7"})]}),(0,n.jsxs)("span",{children:[u.length," changed"]}),w>0&&(0,n.jsxs)("span",{className:"text-green-500",children:["+",w]}),C>0&&(0,n.jsxs)("span",{className:"text-red-500",children:["-",C]}),(0,n.jsx)("div",{className:"flex-1"}),(0,n.jsx)("button",{type:"button",title:"Open commit view",onClick:()=>{s?.openChanges()},className:"hover:text-foreground transition-colors",children:(0,n.jsx)(g.A,{className:"h-3 w-3"})})]}),u.map(e=>(0,n.jsxs)("div",{className:"flex items-center gap-1 px-3 py-1 text-xs hover:bg-accent/50 transition-colors",children:[(0,n.jsx)("button",{type:"button",role:"checkbox","aria-checked":a.has(e.path),onClick:t=>{t.stopPropagation(),l(e.path)},className:(0,$.cn)("h-3.5 w-3.5 shrink-0 rounded-full border flex items-center justify-center transition-colors",a.has(e.path)?"border-primary bg-primary text-primary-foreground":"border-muted-foreground/30 bg-transparent hover:border-muted-foreground/50"),children:a.has(e.path)&&(0,n.jsx)(b.A,{className:"h-2 w-2",strokeWidth:3})}),(0,n.jsxs)("button",{type:"button",onClick:()=>{s?.openDiff(e.path)},className:"flex items-center gap-2 flex-1 min-w-0 text-left",children:[function(e){switch(e){case"added":case"untracked":return(0,n.jsx)(x.A,{className:"h-3.5 w-3.5 text-green-500"});case"deleted":return(0,n.jsx)(h.A,{className:"h-3.5 w-3.5 text-red-500"});case"renamed":return(0,n.jsx)(p.A,{className:"h-3.5 w-3.5 text-blue-500"});default:return(0,n.jsx)(f.A,{className:"h-3.5 w-3.5 text-yellow-500"})}}(e.status),(0,n.jsx)("span",{className:"font-mono truncate flex-1 min-w-0",children:e.path}),(0,n.jsxs)("span",{className:"shrink-0 flex gap-1 text-[10px] font-mono",children:[e.additions>0&&(0,n.jsxs)("span",{className:"text-green-500",children:["+",e.additions]}),e.deletions>0&&(0,n.jsxs)("span",{className:"text-red-500",children:["-",e.deletions]})]})]})]},e.path))]})})}function eo({onClick:e}){let{count:t}=(0,D.wA)();return(0,n.jsxs)(T.$,{variant:"ghost",size:"icon",className:"shrink-0 h-8 w-8 text-muted-foreground hover:text-foreground relative",onClick:e,title:"Scheduled Jobs",children:[(0,n.jsx)(j.A,{className:"h-4 w-4"}),t>0&&(0,n.jsx)("span",{className:"absolute top-1 right-1 h-2 w-2 rounded-full bg-red-500"})]})}function ei({onClick:e}){let[t,s]=(0,N.useState)(0),r=(0,y.usePathname)();return(0,N.useEffect)(()=>{let e=()=>{fetch("/api/inbox?count=true").then(e=>e.json()).then(e=>s(e.unread||0)).catch(()=>{})};e();let t=setInterval(e,15e3);return()=>clearInterval(t)},[r]),(0,n.jsxs)(T.$,{variant:"ghost",size:"icon",className:"shrink-0 h-8 w-8 text-muted-foreground hover:text-foreground relative",onClick:e,title:"Inbox",children:[(0,n.jsx)(v.A,{className:"h-4 w-4"}),t>0&&(0,n.jsx)("span",{className:"absolute top-1 right-1 h-2 w-2 rounded-full bg-blue-500"})]})}function ec({onClick:e}){return(0,n.jsx)(T.$,{variant:"ghost",size:"icon",className:"shrink-0 h-8 w-8 text-muted-foreground hover:text-foreground",onClick:e,title:"Cockpit Assistant",children:(0,n.jsx)(w.A,{className:"h-4 w-4"})})}},30090:(e,t,s)=>{s.d(t,{e:()=>c});var n=s(12115);let r=new Map,a=new Set,l=new Set;function o(){for(let e of a)e()}function i(e){return a.add(e),()=>{a.delete(e)}}function c(e){let t=(0,n.useSyncExternalStore)(i,()=>r.get(e)||l),s=(0,n.useCallback)(t=>{let s=new Set(r.get(e)||new Set);s.has(t)?s.delete(t):s.add(t),r.set(e,s),o()},[e]);return{checkedFiles:t,toggleFile:s,toggleAll:(0,n.useCallback)(t=>{let s=r.get(e)||new Set;r.set(e,s.size===t.length?new Set:new Set(t)),o()},[e]),setCheckedFiles:(0,n.useCallback)(t=>{r.set(e,t),o()},[e])}}},40980:(e,t,s)=>{s.d(t,{cn:()=>a});var n=s(29722),r=s(622);function a(...e){return(0,r.QP)((0,n.$)(e))}},41158:(e,t,s)=>{s.d(t,{K:()=>m});var n=s(95155),r=s(76721),a=s(92571),l=s(14225),o=s(30600),i=s(12115),c=s(89239),d=s(60529),u=s(53972);function m({onSelect:e,onCancel:t}){let[s,x]=(0,i.useState)(""),[h,p]=(0,i.useState)([]),[f,g]=(0,i.useState)(!0),[b,j]=(0,i.useState)(""),[v,w]=(0,i.useState)(!1),[y,N]=(0,i.useState)(""),[k,C]=(0,i.useState)(""),S=(0,i.useCallback)(async e=>{g(!0),j("");let t=new URLSearchParams;e&&t.set("path",e);try{let e=await fetch(`/api/filesystem/browse?${t}`);if(!e.ok){let t=await e.json().catch(()=>({error:"Failed to browse"}));j(t.error||"Failed to browse"),p([]);return}let s=await e.json();x(s.path),p(s.entries)}catch{j("Failed to connect"),p([])}finally{g(!1)}},[]);(0,i.useEffect)(()=>{S()},[S]);let A=async()=>{let e=y.trim();if(e){C("");try{let t=await fetch("/api/filesystem/mkdir",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({parentPath:s,name:e})});if(!t.ok){let e=await t.json().catch(()=>({error:"Failed to create folder"}));C(e.error||"Failed to create folder");return}let n=await t.json();w(!1),N(""),S(n.path)}catch{C("Failed to connect")}}},$=(0,u.cs)(s),E=/^[a-zA-Z]:[/\\]/.test(s),I=E?s.slice(0,3):"/",T=E?s.slice(0,3):"/",R=E?$.slice(1):$;return(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1 text-xs font-mono overflow-x-auto",children:[(0,n.jsx)("button",{type:"button",onClick:()=>S(T),className:"shrink-0 text-muted-foreground hover:text-foreground",children:I}),R.map((e,t)=>{let s=T+R.slice(0,t+1).join("/"),a=t===R.length-1;return(0,n.jsxs)("span",{className:"flex items-center gap-1",children:[(0,n.jsx)(r.A,{className:"h-3 w-3 text-muted-foreground shrink-0"}),a?(0,n.jsx)("span",{className:"text-foreground font-medium",children:e}):(0,n.jsx)("button",{type:"button",onClick:()=>S(s),className:"text-muted-foreground hover:text-foreground",children:e})]},s)})]}),(0,n.jsxs)("div",{className:"border rounded-md max-h-56 overflow-y-auto",children:[f&&(0,n.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,n.jsx)(a.A,{className:"h-4 w-4 animate-spin text-muted-foreground"})}),b&&(0,n.jsx)("div",{className:"px-3 py-4 text-sm text-destructive",children:b}),!f&&!b&&0===h.length&&!v&&(0,n.jsx)("div",{className:"px-3 py-4 text-sm text-muted-foreground",children:"No subdirectories"}),!f&&!b&&h.map(e=>(0,n.jsxs)("button",{type:"button",onClick:()=>S(e.path),className:"flex w-full items-center gap-2 px-3 py-1.5 text-sm hover:bg-muted/50 text-left",children:[(0,n.jsx)(l.A,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),(0,n.jsx)("span",{className:"truncate",children:e.name})]},e.path)),v&&(0,n.jsxs)("div",{className:"px-3 py-1.5 space-y-1",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(o.A,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),(0,n.jsx)(d.p,{value:y,onChange:e=>N(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),A()),"Escape"===e.key&&(w(!1),N(""),C(""))},placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0}),(0,n.jsx)(c.$,{type:"button",size:"sm",variant:"ghost",className:"h-7 px-2 text-xs",onClick:A,children:"Create"})]}),k&&(0,n.jsx)("p",{className:"text-xs text-destructive pl-6",children:k})]})]}),(0,n.jsxs)("div",{className:"flex gap-2 justify-end",children:[!v&&(0,n.jsxs)(c.$,{type:"button",variant:"outline",size:"sm",onClick:()=>{w(!0),C("")},disabled:!s,children:[(0,n.jsx)(o.A,{className:"h-3.5 w-3.5 mr-1.5"}),"New Folder"]}),(0,n.jsx)("div",{className:"flex-1"}),(0,n.jsx)(c.$,{type:"button",variant:"outline",size:"sm",onClick:t,children:"Cancel"}),(0,n.jsxs)(c.$,{type:"button",size:"sm",disabled:!s,onClick:()=>e(s),children:["Select ",s?(0,u.uk)(s)||"/":""]})]})]})}},42763:(e,t,s)=>{s.d(t,{Cf:()=>d,L3:()=>m,c7:()=>u,lG:()=>c});var n=s(95155),r=s(9005),a=s(65738),l=s(12115),o=s(47650),i=s(40980);function c({open:e,onOpenChange:t,children:s,className:r}){return(l.useEffect(()=>{if(!e)return;let s=e=>{"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),t(!1))};return window.addEventListener("keydown",s,!0),()=>window.removeEventListener("keydown",s,!0)},[e,t]),e)?(0,o.createPortal)((0,n.jsx)("div",{className:"fixed inset-0 z-50 bg-black/80 flex items-center justify-center px-4 py-12",onMouseDown:e=>{e.target===e.currentTarget&&t(!1)},children:(0,n.jsx)("div",{className:(0,i.cn)("w-full max-h-full flex flex-col",r||"max-w-lg"),children:s})}),document.body):null}function d({className:e,children:t,...s}){return(0,n.jsxs)("div",{className:(0,i.cn)("relative rounded-lg border bg-background text-foreground p-6 shadow-lg overflow-y-auto",e),...s,children:[(s.onClose||s.onDelete)&&(0,n.jsxs)("div",{className:"sticky top-0 z-10 flex justify-between -mx-2 -mt-2 mb-2",children:[s.onClose?(0,n.jsx)("button",{className:"rounded-sm opacity-70 hover:opacity-100",onClick:s.onClose,children:(0,n.jsx)(r.A,{className:"h-4 w-4"})}):(0,n.jsx)("span",{}),s.onDelete&&(0,n.jsx)("button",{className:"rounded-sm opacity-70 hover:opacity-100 text-destructive",onClick:s.onDelete,children:(0,n.jsx)(a.A,{className:"h-4 w-4"})})]}),t]})}function u({className:e,...t}){return(0,n.jsx)("div",{className:(0,i.cn)("flex flex-col space-y-1.5 text-center sm:text-left",e),...t})}function m({className:e,...t}){return(0,n.jsx)("h2",{className:(0,i.cn)("text-lg font-semibold leading-none tracking-tight",e),...t})}},45160:(e,t,s)=>{s.d(t,{E:()=>o});var n=s(95155),r=s(18460);s(12115);var a=s(40980);let l=(0,r.F)("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-transparent bg-destructive text-white",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function o({className:e,variant:t,...s}){return(0,n.jsx)("div",{className:(0,a.cn)(l({variant:t}),e),...s})}},53972:(e,t,s)=>{function n(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t<0?e:e.slice(t+1)}function r(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t<0?"":e.slice(0,t)}function a(e,t=3){let s=e.split(/[/\\]/);return s.length<=t?e:".../"+s.slice(-2).join("/")}function l(e){return e.split(/[/\\]/).filter(Boolean)}s.d(t,{_1:()=>a,cs:()=>l,uk:()=>n,ww:()=>r})},57594:(e,t,s)=>{s.d(t,{Mh:()=>d,j8:()=>c,sU:()=>i});var n=s(95155),r=s(89811),a=s(49199),l=s(12115),o=s(22317);class i extends l.Component{static getDerivedStateFromError(){return{error:!0}}render(){return this.state.error?this.props.fallback||(0,n.jsx)("pre",{className:"p-3 text-xs text-muted-foreground",children:"Unable to render diff"}):this.props.children}constructor(...e){super(...e),this.state={error:!1}}}let c="[data-column-content] { user-select: text; -webkit-user-select: text; }";function d({filePath:e,oldString:t,newString:s,dark:u}){let{settings:m}=(0,o.t)(),x=(0,l.useMemo)(()=>(0,a.ss)(`a/${e}`,`b/${e}`,t,s,"","",{context:3}),[e,t,s]);return(0,n.jsx)("div",{className:"overflow-x-auto rounded text-xs",children:(0,n.jsx)(i,{children:(0,n.jsx)(r.C,{patch:x,options:{theme:{dark:"pierre-dark",light:"pierre-light"},themeType:u?"dark":"light",disableFileHeader:!0,overflow:"wrap",diffStyle:m.diffStyle,unsafeCSS:c}})})})}},59184:(e,t,s)=>{s.d(t,{I:()=>eK});var n=s(95155),r=s(92571),a=s(11012),l=s(92298),o=s(19805),i=s(73321),c=s(12115);function d(e){if("system"===e.role)return"";if("user"===e.role)return e.content;let t=e.blocks.filter(e=>"text"===e.type).map(e=>e.text);return t.length>0?t.join("\n"):e.content}var u=s(8081);let m=/<file\s+path="([^"]+)">\n([\s\S]*?)\n<\/file>/g,x={asm:"asm",awk:"awk",batch:"bat",c:"c",clojure:"clj",cmake:"cmake",cobol:"cob",coffeescript:"coffee",cpp:"cpp",cs:"cs",css:"css",csv:"csv",dart:"dart",diff:"diff",dockerfile:"dockerfile",elixir:"ex",erlang:"erl",fortran:"f90",gleam:"gleam",go:"go",gradle:"gradle",groovy:"groovy",h:"h",handlebars:"hbs",haskell:"hs",hcl:"tf",hpp:"hpp",html:"html",ini:"ini",java:"java",javascript:"js",json:"json",jsonc:"jsonc",jsonl:"jsonl",jsx:"jsx",julia:"jl",kotlin:"kt",latex:"tex",less:"less",lisp:"lisp",lua:"lua",makefile:"makefile",markdown:"md",matlab:"m",nim:"nim",objectivec:"m",ocaml:"ml",odin:"odin",pascal:"pas",perl:"pl",php:"php",powershell:"ps1",prolog:"pl",proto:"proto",python:"py",r:"r",rst:"rst",ruby:"rb",rust:"rs",scala:"scala",scheme:"scm",scss:"scss",shell:"sh",solidity:"sol",sql:"sql",svelte:"svelte",svg:"svg",swift:"swift",tcl:"tcl",toml:"toml",tsx:"tsx",typescript:"ts",vba:"vba",verilog:"v",vhdl:"vhdl",vue:"vue",xml:"xml",yaml:"yaml",yara:"yar",zig:"zig"};function h(e){return e.split(/\r?\n/).length>=10}let p=null;async function f(e){try{p||(p=Promise.all([s.e(63690),s.e(30272),s.e(63660),s.e(5056),s.e(37087),s.e(56251),s.e(12674),s.e(77607),s.e(43209)]).then(s.bind(s,55681)).then(e=>e.Magika.create()));let t=await p,n=new TextEncoder().encode(e.slice(0,8192)),r=(await t.identifyBytes(n)).prediction.output.label;if("txt"===r||"unknown"===r||"empty"===r)return null;return x[r]?r:null}catch{return null}}let g=e=>e.replace(/^\[Attached [^\]]+\]\n*/gm,"").trim();var b=s(89323),j=s(22317),v=s(53972),w=s(40980),y=s(1550),N=s(64577),k=s(9005);let C={job:{name:"Name",schedule:"Schedule",schedules:"Schedules",prompt:"Prompt",cwd:"Working directory",enabled:"Enabled",model:"Model",contextSize:"Context size",thinkingLevel:"Thinking level",bypassPermissions:"Bypass permissions",maxDurationMinutes:"Max duration",retentionDays:"Retention days",skipIfMissed:"Skip if missed",inboxOutput:"Inbox output",runtime:"Runtime",allowedTools:"Allowed tools",mcpServers:"MCP servers",mcpToolFilters:"MCP tool filters",notifyProviders:"Notify providers",id:"Job ID"},settings:{thinkingLevel:"Thinking level",diffStyle:"Diff style",dismissKeyboardOnSend:"Dismiss keyboard on send",thinkingExpanded:"Thinking expanded",readExpanded:"Read expanded",editExpanded:"Edit expanded",toolCallsExpanded:"Tool calls expanded",messageStitching:"Message stitching",reviewsEnabled:"Reviews enabled",bypassAllPermissions:"Bypass all permissions",modelSlots:"Model"},provider:{id:"Provider ID",name:"Name",envVars:"Environment variables"},mcp_server:{name:"Name",command:"Command",args:"Arguments"},notification_settings:{baseUrl:"Base URL"},notification_provider:{id:"Provider ID",type:"Type",name:"Name",enabled:"Enabled",botToken:"Bot token",chatId:"Chat ID",serverUrl:"Server URL",topic:"Topic",token:"Token",filterPriorities:"Filter priorities",filterSources:"Filter sources"}};function S(e){return e.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase())}function A({permission:e,onRespond:t}){let{domain:s,action:r}=e.configProposal||{},a=(0,c.useMemo)(()=>{if(s&&r&&e.input){try{let t=JSON.parse(e.input);if("object"==typeof t&&null!==t&&!Array.isArray(t))return function(e,t,s){let n=t.charAt(0).toUpperCase()+t.slice(1),r=`${n} ${e.replace(/_/g," ")}`,a=C[e]||{},l=new Set("job"===e&&"update"===t?["id"]:[]),o=Object.entries(s).filter(([e])=>!l.has(e));if(0===o.length)return{title:r,rows:[{label:"Change",value:JSON.stringify(s),block:!1}]};let i=[];for(let[e,t]of o)if("config"!==e||"object"!=typeof t||null===t||Array.isArray(t))i.push([e,t]);else for(let[e,s]of Object.entries(t))i.push([e,s]);return{title:r,rows:i.map(([e,t])=>{var s;let n=a[e]||S(e),{value:r,block:l}=(s=t,null==s?{value:"",block:!1}:"string"==typeof s?s.length>80||s.includes("\n")?{value:s,block:!0}:{value:s,block:!1}:"boolean"==typeof s?{value:s?"Yes":"No",block:!1}:"number"==typeof s?{value:String(s),block:!1}:Array.isArray(s)?{value:s.join(", "),block:!1}:"object"==typeof s?{value:Object.entries(s).map(([e,t])=>{let s=S(e),n="object"==typeof t&&null!==t?JSON.stringify(t):String(t);return`${s}: ${n}`}).join("\n"),block:!0}:{value:String(s),block:!1}),o={label:n,value:r};return l&&(o.block=!0),o})}}(s,r,t)}catch{}return{title:`${r||"Change"} ${(s||"").replace(/_/g," ")}`,rows:[{label:"Change",value:e.input,block:!0}]}}return{title:"Configuration change",rows:[{label:"Change",value:e.input||"",block:!1}]}},[s,r,e.input]),{displayName:l}=e.configProposal||{},o=l?`${a.title}: ${l}`:a.title;return(0,n.jsx)("div",{className:"mx-auto max-w-3xl","data-testid":"config-proposal-card",children:(0,n.jsx)("div",{className:"rounded-lg border border-blue-500/50 bg-blue-500/10 p-4",children:(0,n.jsx)("div",{className:"flex items-start gap-3",children:(0,n.jsxs)("div",{className:"flex-1 min-w-0 space-y-3",children:[(0,n.jsx)("div",{className:"text-sm font-medium capitalize text-foreground",children:o}),(0,n.jsx)("div",{className:"space-y-1.5",children:a.rows.map((e,t)=>(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"text-[11px] text-muted-foreground",children:e.label}),e.block?(0,n.jsx)("pre",{className:"mt-0.5 rounded bg-muted/50 px-2 py-1.5 text-[11px] text-foreground leading-relaxed whitespace-pre-wrap break-words max-h-48 overflow-y-auto",children:e.value}):(0,n.jsx)("div",{className:"text-sm text-foreground",children:e.value})]},t))}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2 pt-1",children:[(0,n.jsxs)("button",{onClick:()=>t(e.requestId,!0,"allow"),className:"rounded bg-primary px-3 py-1 text-xs font-medium text-primary-foreground hover:bg-primary/90","data-testid":"btn-approve",children:[(0,n.jsx)(N.A,{className:"h-3 w-3 inline mr-1"}),"Approve"]}),(0,n.jsxs)("button",{onClick:()=>t(e.requestId,!1,"deny"),className:"rounded bg-muted px-3 py-1 text-xs font-medium text-muted-foreground hover:bg-muted/80",children:[(0,n.jsx)(k.A,{className:"h-3 w-3 inline mr-1"}),"Reject"]})]})]})})})})}var $=s(25494),E=s(66763),I=s(5045),T=s(16449),R=s(12651),D=s(19707),_=s(8962),P=s(49804),M=s(82749),q=s(28750),z=s(50981),U=s(55737),F=s(76721),L=s(65738),O=s(36483),W=s(15561),B=s(40852),J=s(9383),H=s(25182),G=s(14283),K=s(18189),Q=s(64233),X=s(30966),V=s(18402),Y=s(88074),Z=s(45160),ee=s(89239);function et({open:e,onOpenChange:t,sessionId:s,initData:a}){let l=(0,i.useRouter)(),[o,d]=(0,c.useState)([]),[u,m]=(0,c.useState)(!1),[x,h]=(0,c.useState)(null),[p,f]=(0,c.useState)(null);(0,c.useEffect)(()=>{a?.mcpServers&&d(a.mcpServers.map(e=>({name:e.name,status:e.status})))},[a]);let g=(0,c.useCallback)(()=>{s&&(m(!0),fetch(`/api/sessions/${encodeURIComponent(s)}/mcp`).then(e=>{if(!e.ok)throw Error("Failed to fetch");return e.json()}).then(e=>{e.mcpServers&&d(e.mcpServers)}).catch(()=>{}).finally(()=>m(!1)))},[s]);(0,c.useEffect)(()=>{if(!e)return;let s=e=>{"Escape"===e.key&&t(!1)};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[e,t]);let b=(0,c.useCallback)(async(e,t)=>{if(!s)return;let n="disabled"===t;f(e),d(t=>t.map(t=>t.name===e?{...t,status:n?"connecting":"disabled"}:t));try{await fetch(`/api/sessions/${encodeURIComponent(s)}/mcp`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"toggle",serverName:e,enabled:n})}),d(t=>t.map(t=>t.name===e?{...t,status:n?"connected":"disabled"}:t))}catch{d(s=>s.map(s=>s.name===e?{...s,status:t}:s))}finally{f(null)}},[s]),j=(0,c.useCallback)(async e=>{if(s){f(e),d(t=>t.map(t=>t.name===e?{...t,status:"connecting",error:void 0}:t));try{await fetch(`/api/sessions/${encodeURIComponent(s)}/mcp`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"reconnect",serverName:e})}),d(t=>t.map(t=>t.name===e?{...t,status:"connected"}:t))}catch{d(t=>t.map(t=>t.name===e?{...t,status:"failed"}:t))}finally{f(null)}}},[s]);return 0!==(a?.mcpServers?.length??0)&&e?(0,n.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onMouseDown:e=>{e.target===e.currentTarget&&t(!1)},children:(0,n.jsxs)("div",{className:"w-full max-w-lg mx-4 rounded-lg border bg-background p-5 shadow-lg max-h-[80vh] flex flex-col",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(U.A,{className:"h-4 w-4"}),(0,n.jsx)("h2",{className:"text-base font-semibold",children:"MCP Servers"}),(0,n.jsx)(Z.E,{variant:"secondary",className:"text-xs",children:o.length})]}),(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)(ee.$,{variant:"ghost",size:"icon",onClick:g,title:"Refresh",children:(0,n.jsx)(M.A,{className:(0,w.cn)("h-4 w-4",u&&"animate-spin")})}),(0,n.jsx)(ee.$,{variant:"ghost",size:"icon",onClick:()=>t(!1),children:(0,n.jsx)(k.A,{className:"h-4 w-4"})})]})]}),u&&0===o.length&&(0,n.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,n.jsx)(r.A,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),!u&&x&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground py-4 text-center",children:x}),o.length>0&&(0,n.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto border rounded",children:o.map(e=>(0,n.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2.5 border-b last:border-b-0",children:[(0,n.jsx)("div",{className:(0,w.cn)("h-2 w-2 rounded-full shrink-0",function(e){switch(e){case"connected":return"bg-green-500";case"disabled":return"bg-muted-foreground/40";case"failed":return"bg-red-500";default:return"bg-yellow-500"}}(e.status))}),(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"font-mono text-sm font-bold truncate",children:e.name}),e.scope&&(0,n.jsx)(Z.E,{variant:"outline",className:"text-[10px] shrink-0",children:e.scope})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:function(e){switch(e){case"connected":return"Connected";case"connecting":return"Connecting...";case"disabled":return"Disabled";case"failed":return"Failed";default:return e}}(e.status)}),e.tools&&e.tools.length>0&&(0,n.jsxs)("span",{className:"text-xs text-muted-foreground",children:[e.tools.length," tools"]}),e.config?.type&&(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:e.config.type})]}),e.error&&(0,n.jsx)("p",{className:"text-xs text-red-500 mt-0.5 truncate",children:e.error})]}),(0,n.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:["failed"===e.status&&s&&(0,n.jsx)(ee.$,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>j(e.name),disabled:p===e.name,title:"Reconnect",children:(0,n.jsx)(M.A,{className:(0,w.cn)("h-3.5 w-3.5",p===e.name&&"animate-spin")})}),s&&(0,n.jsx)(ee.$,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>b(e.name,e.status),disabled:p===e.name,title:"disabled"===e.status?"Enable":"Disable",children:"disabled"===e.status?(0,n.jsx)(X.A,{className:"h-3.5 w-3.5"}):(0,n.jsx)(V.A,{className:"h-3.5 w-3.5"})})]})]},e.name))}),!u&&0===o.length&&!x&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No MCP servers configured"}),(0,n.jsx)("div",{className:"flex justify-end mt-3",children:(0,n.jsxs)(ee.$,{variant:"outline",size:"sm",className:"gap-1.5",onClick:()=>{t(!1),l.push("/mcp-servers")},children:[(0,n.jsx)(Y.A,{className:"h-3.5 w-3.5"}),"Manage servers"]})})]})}):null}function es(e,t){if(0===e.length)return 0;let s=e.toLowerCase(),n=t.toLowerCase(),r=0,a=0,l=!1;for(let e=0;e<n.length&&r<s.length;e++)if(n[e]===s[r]){let s=0===r,n=e>0?t[e-1]:"",o=0===e||"-"===n||"_"===n||n>="a"&&n<="z"&&t[e]>="A"&&t[e]<="Z";a+=1,l&&(a+=2),s&&o&&(a+=3),0===e&&(a+=5),l=!0,r++}else l=!1;return r<s.length?0:a}function en(e,t,s,n){if(0===e.length)return[...t];let r=[];for(let a=0;a<t.length;a++){let l=t[a],o=es(e,s(l)),i=0;if(n){let t=n(l);t&&t.length>0&&(i=es(e,t))}(o>0||i>0)&&r.push({candidate:l,nameScore:o,descriptionScore:i,index:a})}return r.sort((e,t)=>{if(e.nameScore>0&&t.nameScore>0){let s=t.nameScore-e.nameScore;return 0!==s?s:e.index-t.index}if(e.nameScore>0)return -1;if(t.nameScore>0)return 1;let s=t.descriptionScore-e.descriptionScore;return 0!==s?s:e.index-t.index}),r.map(e=>e.candidate)}let er=[{name:"Explore",description:"Fast codebase exploration"},{name:"Plan",description:"Design implementation plans"},{name:"general-purpose",description:"Multi-step tasks and code changes"},{name:"claude-code-guide",description:"Claude Code documentation"}];function ea({query:e,cwd:t,selectedIndex:s,onSelect:r,onItemsChange:a,initAgents:l}){let o=(0,c.useRef)(null),[i,d]=(0,c.useState)([]),[u,m]=(0,c.useState)([]),x=(0,c.useRef)(null);(0,c.useEffect)(()=>{if(l)return;let e=new URLSearchParams;t&&e.set("cwd",t),fetch(`/api/agents?${e}`).then(e=>e.json()).then(e=>m(e.agents)).catch(()=>{})},[t,l]),(0,c.useEffect)(()=>(x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{let s=new URLSearchParams({cwd:t});e&&s.set("query",e),fetch(`/api/filesystem/files?${s}`).then(e=>e.json()).then(e=>d(e.files)).catch(()=>d([]))},150),()=>{x.current&&clearTimeout(x.current)}),[e,t]);let h=(0,c.useMemo)(()=>{if(l&&l.length>0)return l.map(e=>({name:e.name,description:e.description}));let e=new Set(u.map(e=>e.name));return[...er.filter(t=>!e.has(t.name)).map(e=>({name:e.name,description:e.description})),...u.map(e=>({name:e.name,description:e.description}))]},[l,u]),p=(0,c.useMemo)(()=>en(e,h,e=>e.name,e=>e.description).map(e=>({value:e.name,label:e.name,description:e.description,kind:"agent"})),[e,h]),f=(0,c.useMemo)(()=>i.map(e=>({value:e,label:e,kind:"file"})),[i]),g=(0,c.useMemo)(()=>[...p,...f],[p,f]);return((0,c.useEffect)(()=>{a?.(g)},[g,a]),(0,c.useEffect)(()=>{let e=o.current;if(!e)return;let t=e.querySelector(`[data-index="${s}"]`);t?.scrollIntoView({block:"nearest"})},[s]),0===g.length)?null:(0,n.jsxs)("div",{ref:o,className:"absolute bottom-full left-0 mb-1 w-80 max-h-60 overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md",children:[p.length>0&&f.length>0&&(0,n.jsx)("div",{className:"px-3 py-1 text-xs text-muted-foreground font-medium",children:"Agents"}),p.map((e,t)=>(0,n.jsxs)("button",{type:"button","data-index":t,className:`flex w-full items-baseline gap-3 px-3 py-2 text-sm text-left ${t===s?"bg-accent text-accent-foreground":""}`,onMouseDown:t=>{t.preventDefault(),r(e.value)},children:[(0,n.jsx)("span",{className:"font-mono font-bold shrink-0",children:e.label}),(0,n.jsx)("span",{className:"text-muted-foreground truncate",children:e.description})]},e.value)),f.length>0&&p.length>0&&(0,n.jsx)("div",{className:"px-3 py-1 text-xs text-muted-foreground font-medium",children:"Files"}),f.map((e,t)=>{let a=p.length+t,l=(0,v.uk)(e.value),o=(0,v.ww)(e.value)||null;return(0,n.jsxs)("button",{type:"button","data-index":a,className:`flex w-full items-baseline gap-3 px-3 py-2 text-sm text-left ${a===s?"bg-accent text-accent-foreground":""}`,onMouseDown:t=>{t.preventDefault(),r(e.value)},children:[(0,n.jsx)("span",{className:"font-mono font-bold shrink-0",children:l}),o&&(0,n.jsx)("span",{className:"text-muted-foreground truncate",children:o})]},e.value)})]})}let el=[{command:"/clear",description:"Clear conversation and start fresh"},{command:"/compact",description:"Compact conversation context"},{command:"/cost",description:"Show token usage"},{command:"/context",description:"Show context window usage"},{command:"/model",description:"Show or switch model"},{command:"/rename",description:"Rename this session"},{command:"/commit",description:"Commit changes"},{command:"/review",description:"Review code changes"},{command:"/help",description:"Show available commands"}],eo=[{command:"/btw",description:"Nudge Claude while it's working"},{command:"/mcp",description:"Show MCP server status"}];function ei({query:e,selectedIndex:t,onSelect:s,cwd:r,onItemsChange:a,initCommands:l}){let o,i,d,u,m=(0,c.useRef)(null),[x,h]=(0,c.useState)([]);(0,c.useEffect)(()=>{if(l)return;let e=new URLSearchParams;r&&e.set("cwd",r),Promise.all([fetch(`/api/skills?${e}`).then(e=>e.json()).then(e=>e.skills.map(e=>({command:"/"+e.name,description:e.description||"Custom skill"}))).catch(()=>[]),fetch(`/api/commands?${e}`).then(e=>e.json()).then(e=>e.commands.map(e=>({command:"/"+e.name,description:e.description||"Custom command"}))).catch(()=>[])]).then(([e,t])=>{let s=new Set,n=[];for(let t of e)s.add(t.command),n.push(t);for(let e of t)s.has(e.command)||n.push(e);h(n)})},[r,l]);let p=l?(o=new Map(el.map(e=>[e.command,e])),d=new Set((i=l.map(e=>{let t=e.startsWith("/")?e:"/"+e;return o.get(t)||{command:t,description:""}})).map(e=>e.command)),[...i,...el.filter(e=>!d.has(e.command))]):(u=new Set(el.map(e=>e.command)),[...el,...x.filter(e=>!u.has(e.command))]),f=new Set,g=[];for(let e of[...p,...eo])f.has(e.command)||(f.add(e.command),g.push(e));let b=en(e,g,e=>e.command.slice(1),e=>e.description);return((0,c.useEffect)(()=>{a?.(b)},[b.length,a,b]),(0,c.useEffect)(()=>{let e=m.current;if(!e)return;let s=e.children[t];s?.scrollIntoView({block:"nearest"})},[t]),0===b.length)?null:(0,n.jsx)("div",{ref:m,className:"absolute bottom-full left-0 mb-1 w-80 max-h-60 overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md",children:b.map((e,r)=>(0,n.jsxs)("button",{type:"button",className:`flex w-full items-baseline gap-3 px-3 py-2 text-sm text-left ${r===t?"bg-accent text-accent-foreground":""}`,onMouseDown:t=>{t.preventDefault(),s(e)},children:[(0,n.jsx)("span",{className:"font-mono font-bold shrink-0",children:e.command}),(0,n.jsx)("span",{className:"text-muted-foreground truncate",children:e.description})]},e.command))})}var ec=s(42763),ed=s(64350);function eu(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function em({usage:e,onCompact:t}){let[s,r]=(0,c.useState)(!1);(0,c.useEffect)(()=>{if(!s)return;let e=e=>{"Escape"===e.key&&r(!1)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[s]);let a=Math.round(e.used/e.total*100),l=a>80?"#ef4444":a>50?"#f97316":"#22c55e",o=2*Math.PI*6,i=Math.min(a,100)/100*o;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{onClick:()=>r(!0),className:"flex items-center justify-center w-8 h-6 rounded-md hover:bg-muted transition-colors",title:`Context: ${a}%`,"data-testid":"context-indicator",children:(0,n.jsxs)("svg",{width:14,height:14,className:"-rotate-90",children:[(0,n.jsx)("circle",{cx:7,cy:7,r:6,fill:"none",stroke:"currentColor",strokeWidth:2,className:"text-muted-foreground/25"}),(0,n.jsx)("circle",{cx:7,cy:7,r:6,fill:"none",stroke:l,strokeWidth:2,strokeDasharray:o,strokeDashoffset:o-i,strokeLinecap:"round"})]})}),s&&(0,n.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onMouseDown:e=>{e.target===e.currentTarget&&r(!1)},children:(0,n.jsxs)("div",{className:"w-full max-w-sm mx-4 rounded-lg border bg-background p-5 shadow-lg",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,n.jsx)("h2",{className:"text-base font-semibold",children:"Context Usage"}),(0,n.jsx)(ee.$,{variant:"ghost",size:"icon",onClick:()=>r(!1),children:(0,n.jsx)(k.A,{className:"h-4 w-4"})})]}),(0,n.jsxs)("div",{className:"flex justify-between text-sm mb-2",children:[(0,n.jsx)("span",{children:"Tokens used"}),(0,n.jsxs)("span",{className:"text-muted-foreground",children:[a,"%"]})]}),(0,n.jsx)("div",{className:"h-2.5 rounded-full bg-muted overflow-hidden mb-2",children:(0,n.jsx)("div",{className:"h-full rounded-full transition-all",style:{width:`${Math.min(a,100)}%`,backgroundColor:l}})}),(0,n.jsxs)("div",{className:"flex justify-between text-xs text-muted-foreground",children:[(0,n.jsxs)("span",{"data-testid":"context-used",children:[eu(e.used)," used"]}),(0,n.jsxs)("span",{"data-testid":"context-total",children:[eu(e.total)," total"]})]}),t&&(0,n.jsxs)(ee.$,{variant:"outline",size:"sm",className:"w-full mt-4",onClick:()=>{t(),r(!1)},children:[(0,n.jsx)(ed.A,{className:"h-3.5 w-3.5 mr-2"}),"Compact now"]})]})})]})}var ex=s(65377);function eh({open:e,prompts:t,onSelect:s,onClose:r}){let[a,l]=(0,c.useState)(""),[o,i]=(0,c.useState)(0),d=(0,c.useRef)(null),u=(0,c.useRef)(null),m=(0,c.useMemo)(()=>{if(!a.trim())return t;let e=a.toLowerCase();return t.filter(t=>t.toLowerCase().includes(e))},[t,a]);(0,c.useEffect)(()=>{e&&(l(""),i(0),requestAnimationFrame(()=>d.current?.focus()))},[e]),(0,c.useEffect)(()=>{i(0)},[a]),(0,c.useEffect)(()=>{if(!u.current)return;let e=u.current.children;e[o]&&e[o].scrollIntoView({block:"nearest"})},[o]);let x=(0,c.useCallback)(e=>{if("Escape"===e.key){e.preventDefault(),r();return}if("ArrowUp"===e.key){e.preventDefault(),i(e=>e<m.length-1?e+1:0);return}if("ArrowDown"===e.key){e.preventDefault(),i(e=>e>0?e-1:m.length-1);return}if("Enter"===e.key){e.preventDefault(),m[o]&&s(m[o]);return}},[m,o,s,r]);return e?(0,n.jsx)("div",{className:"fixed inset-0 z-50 flex items-end justify-center",onMouseDown:e=>e.target===e.currentTarget&&r(),children:(0,n.jsxs)("div",{className:"w-full max-w-3xl mb-24 mx-4 rounded-lg border bg-background shadow-lg overflow-hidden",onKeyDown:x,children:[(0,n.jsxs)("div",{ref:u,className:"max-h-80 overflow-y-auto p-1 flex flex-col-reverse",children:[0===m.length&&(0,n.jsx)("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:a?"No matching prompts":"No prompt history"}),m.map((e,t)=>(0,n.jsxs)("button",{onClick:()=>s(e),onMouseEnter:()=>i(t),className:`flex w-full items-start gap-2 rounded px-3 py-2 text-left text-sm transition-colors ${o===t?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,n.jsx)("span",{className:"shrink-0 font-mono text-xs text-muted-foreground/50 w-5 text-right pt-0.5",children:t+1}),(0,n.jsx)("span",{className:"line-clamp-2 break-all",children:e})]},`${t}-${e.slice(0,20)}`))]}),(0,n.jsxs)("div",{className:"border-t px-3 py-2 flex items-center gap-2",children:[(0,n.jsx)(ex.A,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,n.jsx)("input",{ref:d,value:a,onChange:e=>l(e.target.value),placeholder:"Search prompts...",className:"flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"}),(0,n.jsxs)("span",{className:"text-xs text-muted-foreground shrink-0",children:[m.length," prompt",1!==m.length?"s":""]})]})]})}):null}var ep=s(18986),ef=s(36619);function eg({open:e,onOpenChange:t,messages:s,paused:r,onDelete:a,onEdit:l,onResume:o}){return((0,c.useEffect)(()=>{if(!e)return;let s=e=>{"Escape"===e.key&&t(!1)};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[e,t]),e)?(0,n.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onMouseDown:e=>{e.target===e.currentTarget&&t(!1)},children:(0,n.jsxs)("div",{className:"w-full max-w-md mx-4 rounded-lg border bg-background p-5 shadow-lg",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,n.jsx)("h2",{className:"text-base font-semibold",children:"Queued Messages"}),(0,n.jsx)(ee.$,{variant:"ghost",size:"icon",onClick:()=>t(!1),children:(0,n.jsx)(k.A,{className:"h-4 w-4"})})]}),0===s.length?(0,n.jsx)("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No queued messages"}):(0,n.jsx)("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:s.map((e,s)=>(0,n.jsxs)("div",{className:"flex items-start gap-3 rounded-md border border-border px-3 py-2.5",children:[(0,n.jsxs)("span",{className:"text-xs text-muted-foreground mt-0.5 shrink-0",children:[s+1,"."]}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)("p",{className:"text-sm break-words line-clamp-3",children:e.text}),(0,n.jsx)("span",{className:`text-[10px] mt-0.5 inline-block ${r?"text-yellow-500":"text-muted-foreground"}`,children:r?"paused":"queued"})]}),(0,n.jsxs)("div",{className:"flex gap-1 shrink-0",children:[(0,n.jsx)("button",{onClick:()=>{l(e.id),t(!1)},className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:"Edit (move to input)",children:(0,n.jsx)(ep.A,{className:"h-3.5 w-3.5"})}),(0,n.jsx)("button",{onClick:()=>a(e.id),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-destructive transition-colors",title:"Delete",children:(0,n.jsx)(L.A,{className:"h-3.5 w-3.5"})})]})]},e.id))}),r&&s.length>0&&(0,n.jsx)("div",{className:"mt-4 pt-4 border-t",children:(0,n.jsxs)(ee.$,{variant:"default",size:"sm",className:"w-full",onClick:()=>{o(),t(!1)},children:[(0,n.jsx)(ef.A,{className:"h-3.5 w-3.5 mr-2"}),"Resume queue"]})})]})}):null}let eb=[{value:"haiku",label:"Haiku"},{value:"sonnet",label:"Sonnet"},{value:"opus",label:"Opus"},{value:"fable",label:"Fable"}];function ej(e,t){let s=e.replace(/\[.*\]$/,"");if("opus"===s||"sonnet"===s||"haiku"===s||"fable"===s)return{alias:s,entry:(0,u.zQ)(s)??null,contextSize:t};let n=(0,u.bs)(s)??null;return{alias:n?.alias??null,entry:n,contextSize:t}}function ev(e){return 1===(0,u.r5)(e.alias).length&&e.isDefault?e.alias:e.modelId}let ew=[{value:"off",label:"Off"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"xhigh",label:"XHigh"},{value:"max",label:"Max"}],ey=new Set(["image/png","image/jpeg","image/gif","image/webp"]),eN=new Set([".txt",".md",".py",".js",".ts",".tsx",".jsx",".json",".csv",".xml",".yaml",".yml",".html",".css",".log",".sh",".go",".rs",".java",".c",".cpp",".h",".rb",".swift",".kt",".toml",".cfg",".ini",".env",".sql",".r",".lua",".pl",".php"]);function ek(e){return new Promise(t=>{let s=new FileReader;s.onload=()=>{t(s.result.split(",")[1]||null)},s.onerror=()=>t(null),s.readAsDataURL(e)})}let eC=["image/*",".pdf",...Array.from(eN)].join(","),eS=new Map;function eA({sessionId:e,promptHistory:t=[],onSend:s,onInterrupt:a,isResponding:l,bypassActive:o,onSetBypass:i,planMode:d,onSetPlanMode:m,showPlanToggle:p=!0,isCockpitAgent:g=!1,thinkingLevel:j,onSetThinking:v,currentModel:w,currentContextSize:y,onSetModel:C,contextUsage:S,dismissKeyboard:A,cwd:X,onCompact:V,initData:Y,hasQueuedMessage:Z,queuedMessages:es,queuePaused:en,onDeleteQueued:er,onEditQueued:el,onResumeQueue:eo,restoredText:ed,onClearRestoredText:eu,btw:ex,onDismissBtw:ep,currentRuntime:ef,onSetRuntime:e$,onRestart:eE,providers:eI}){let eT,eR,eD,e_,eP,eM,eq,ez,eU,eF,eL,eO,eW,{connected:eB}=(0,b.h)(),[eJ,eH]=(0,c.useState)(()=>eS.get(e)||""),[eG,eK]=(0,c.useState)(!1),[eQ,eX]=(0,c.useState)(!1);(0,c.useEffect)(()=>{eH(eS.get(e)||"")},[e]),(0,c.useEffect)(()=>{eS.set(e,eJ)},[e,eJ]),(0,c.useEffect)(()=>{ed&&(eH(ed),eu?.(),tx.current?.focus())},[ed,eu]);let[eV,eY]=(0,c.useState)(!1),[eZ,e0]=(0,c.useState)(0),[e1,e5]=(0,c.useState)(!1),[e2,e3]=(0,c.useState)(!1),[e4,e8]=(0,c.useState)("model"),[e6,e9]=(0,c.useState)("anthropic"),[e7,te]=(0,c.useState)(0),[tt,ts]=(0,c.useState)(0),[tn,tr]=(0,c.useState)([]),[ta,tl]=(0,c.useState)([]),[to,ti]=(0,c.useState)([]),[tc,td]=(0,c.useState)(!1),[tu,tm]=(0,c.useState)(null),tx=(0,c.useRef)(null),th=(0,c.useRef)(null),tp=(0,c.useRef)([]),tf=(0,c.useRef)([]),tg=(0,c.useRef)(!1),tb=(eT=eJ.slice(0,tt).match(/(?:^|\s)\/([^\s]*)$/))?{active:!0,query:eT[1],start:tt-1-eT[1].length}:{active:!1,query:"",start:0},tj=tb.active,tv=tb.query,tw=(eR=eJ.slice(0,tt).match(/@([^\s]*)$/))?{active:!0,query:eR[1],start:tt-eR[0].length}:{active:!1,query:"",start:0},ty=!tj&&tw.active&&!!X,tN=(0,c.useCallback)(e=>{let t=eJ.slice(0,tb.start),s=eJ.slice(tt);eH(t+e.command+" "+s),e0(0);let n=tb.start+e.command.length+1;ts(n),requestAnimationFrame(()=>{let e=tx.current;e&&(e.focus(),e.setSelectionRange(n,n))})},[eJ,tb.start,tt]),tk=(0,c.useCallback)(e=>{eH(eJ.slice(0,tw.start)+"@"+e+" "+eJ.slice(tt)),te(0);let t=tw.start+1+e.length+1;ts(t),requestAnimationFrame(()=>{let e=tx.current;e&&(e.focus(),e.setSelectionRange(t,t))})},[eJ,tw.start,tt]),tC=tn.length>0||ta.length>0||to.length>0,tS=(0,c.useCallback)(()=>{let e=eJ.trim();if((e||tC)&&eB){if(/^\/mcp\s*$/i.test(e)){eH(""),eX(!0);return}s(e,tn.length>0?tn:void 0,ta.length>0?ta:void 0,to.length>0?to:void 0),eH(""),tr([]),tl([]),ti([]),e0(0),tx.current&&(tx.current.style.height="auto",A&&"ontouchstart"in window?tx.current.blur():tx.current.focus())}},[eJ,tC,tn,ta,to,s,A,eB]),tA=(0,c.useCallback)(e=>{if(tj){let t=tf.current;if(t.length>0){if("ArrowDown"===e.key){e.preventDefault(),e0(e=>(e+1)%t.length);return}if("ArrowUp"===e.key){e.preventDefault(),e0(e=>(e-1+t.length)%t.length);return}if("Enter"===e.key||"Tab"===e.key){e.preventDefault(),tN(t[eZ]);return}}if("Escape"===e.key){e.preventDefault(),e.stopPropagation(),eH(eJ.slice(0,tb.start)+eJ.slice(tt));let t=tb.start;ts(t),requestAnimationFrame(()=>{let e=tx.current;e&&e.setSelectionRange(t,t)});return}}if(ty&&tp.current.length>0){let t=tp.current.length;if("ArrowDown"===e.key){e.preventDefault(),te(e=>(e+1)%t);return}if("ArrowUp"===e.key){e.preventDefault(),te(e=>(e-1+t)%t);return}if("Enter"===e.key||"Tab"===e.key){e.preventDefault(),tk(tp.current[e7].value);return}if("Escape"===e.key){e.preventDefault(),e.stopPropagation(),eH(eJ.slice(0,tw.start)+eJ.slice(tt));let t=tw.start;ts(t),requestAnimationFrame(()=>{let e=tx.current;e&&e.setSelectionRange(t,t)});return}}if("Tab"===e.key&&!e.shiftKey&&p){e.preventDefault(),m(!d);return}if("Escape"===e.key&&l){e.preventDefault(),a();return}if("ArrowUp"===e.key&&!eJ.trim()&&t.length>0){e.preventDefault(),eY(!0);return}"Enter"!==e.key||e.shiftKey||tg.current||(e.preventDefault(),tS())},[tj,ty,eZ,e7,tS,tN,tk,eJ,tw.start,tb.start,tt,l,a,d,m,p,t]),t$=(0,c.useCallback)(()=>{let e=tx.current;e&&(e.style.height="auto",e.style.height=Math.min(e.scrollHeight,200)+"px")},[]),tE=(0,c.useRef)(0),tI=(0,c.useCallback)(e=>{tE.current+=1;let t=tE.current,s=t>1?`-${t}`:"",n=`paste${s}`;ti(t=>[...t,{name:n,content:e}]),f(e).then(t=>{if(!t)return;let r=x[t];if(!r)return;let a=`paste${s}.${r}`;ti(s=>s.map(s=>s.name===n&&s.content===e?{...s,name:a,language:t}:s))})},[]),tT=(0,c.useCallback)(e=>{let t=e.target.value,s=t.length-eJ.length;if(s>0){let n=e.target.selectionStart??t.length,r=t.slice(n-s,n);if(h(r)){let e=t.slice(0,n-s);eH(e+t.slice(n)),tI(r),ts(e.length),e0(0),te(0);return}}eH(t),ts(e.target.selectionStart??0),e0(0),te(0)},[eJ,tI]),tR=(0,c.useCallback)(async e=>{for(let t of e)if(ey.has(t.type)){let e=await function(e){return e.size<=35e5?ek(e).then(t=>t?{mediaType:e.type,data:t}:null):function(e){return new Promise(t=>{let s=URL.createObjectURL(e),n=new Image;n.onload=()=>{URL.revokeObjectURL(s);let r=document.createElement("canvas"),a=Math.sqrt(35e5/e.size),l=Math.round(n.width*a),o=Math.round(n.height*a);r.width=l,r.height=o;let i=r.getContext("2d");if(!i)return void t(null);i.drawImage(n,0,0,l,o);let c=.85,d=r.toDataURL("image/jpeg",c).split(",")[1]||"";for(;d.length>45e5&&c>.3;)c-=.1,d=r.toDataURL("image/jpeg",c).split(",")[1]||"";t({mediaType:"image/jpeg",data:d})},n.onerror=()=>{URL.revokeObjectURL(s),t(null)},n.src=s})}(e)}(t);e&&tr(t=>[...t,e])}else if("application/pdf"===t.type){let e=await ek(t);e&&tl(s=>[...s,{mediaType:"application/pdf",data:e,name:t.name}])}else if(eN.has(function(e){let t=e.lastIndexOf(".");return t>=0?e.slice(t).toLowerCase():""}(t.name))||t.type.startsWith("text/")){let e=await function(e){return new Promise(t=>{let s=new FileReader;s.onload=()=>t(s.result),s.onerror=()=>t(null),s.readAsText(e)})}(t);null!==e&&ti(s=>[...s,{name:t.name,content:e}])}},[]),tD=(0,c.useCallback)(e=>{tg.current=!0,requestAnimationFrame(()=>{tg.current=!1});let t=e.clipboardData?.items;if(!t)return;let s=[];for(let e=0;e<t.length;e++){let n=t[e];if("file"===n.kind){let e=n.getAsFile();e&&s.push(e)}}if(0===s.length&&e.clipboardData?.files?.length)for(let t=0;t<e.clipboardData.files.length;t++)s.push(e.clipboardData.files[t]);if(0===s.length){let t=e.clipboardData?.getData("text/html");if(t){let e=t.match(/<img[^>]+src="(data:image\/[^;]+;base64,[^"]+)"/);if(e){let[t,n]=e[1].split(","),r=t.match(/data:([^;]+)/);if(r&&n){let e=r[1],t=atob(n),a=new Uint8Array(t.length);for(let e=0;e<t.length;e++)a[e]=t.charCodeAt(e);let l=new Blob([a],{type:e});s.push(new File([l],`pasted-image.${e.split("/")[1]||"png"}`,{type:e}))}}}}if(s.length>0){e.preventDefault(),tR(s);return}let n=e.clipboardData?.getData("text/plain");n&&h(n)&&(e.preventDefault(),tI(n))},[tR,tI]),t_=(0,c.useCallback)(e=>{e.preventDefault(),td(!0)},[]),tP=(0,c.useCallback)(e=>{e.preventDefault(),td(!1)},[]),tM=(0,c.useCallback)(e=>{e.preventDefault(),td(!1);let t=[];if(e.dataTransfer?.files)for(let s=0;s<e.dataTransfer.files.length;s++)t.push(e.dataTransfer.files[s]);t.length>0&&tR(t)},[tR]),tq=(0,c.useCallback)(e=>{tr(t=>t.filter((t,s)=>s!==e))},[]),tz=(0,c.useCallback)(e=>{tl(t=>t.filter((t,s)=>s!==e))},[]),tU=(0,c.useCallback)(e=>{ti(t=>t.filter((t,s)=>s!==e))},[]),tF=(0,c.useCallback)(()=>{th.current?.click()},[]),tL=(0,c.useCallback)(e=>{let t=e.target.files;t&&0!==t.length&&(tR(Array.from(t)),e.target.value="")},[tR]),tO=(0,u.j5)(w,j,y,eI),tW=tO.thinking?ew.find(e=>e.value===tO.thinking)?.label??null:null,tB=tO.context?u.XR[tO.context].label:null;return(0,n.jsxs)("div",{className:`border-t bg-background px-1 pt-2 pb-1 ${tc?"ring-2 ring-primary ring-inset":""}`,onDragOver:t_,onDragLeave:tP,onDrop:tM,children:[(0,n.jsxs)("div",{className:"mx-auto max-w-3xl",children:[ex&&(0,n.jsxs)("div",{className:"mb-2 rounded-md border border-input bg-muted/50 p-2",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,n.jsx)($.A,{className:"h-3.5 w-3.5"}),(0,n.jsx)("span",{children:"Side question"})]}),(0,n.jsx)("button",{onClick:ep,className:"text-muted-foreground hover:text-foreground",children:(0,n.jsx)(k.A,{className:"h-3.5 w-3.5"})})]}),(0,n.jsx)("p",{className:"text-sm font-medium px-1 mb-1",children:ex.question}),ex.loading&&(0,n.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground px-1 py-1",children:[(0,n.jsx)(r.A,{className:"h-3.5 w-3.5 animate-spin"}),(0,n.jsx)("span",{children:"Thinking..."})]}),ex.error&&(0,n.jsx)("p",{className:"text-xs text-destructive px-1",children:ex.error}),ex.answer&&(0,n.jsx)(Q.Y,{variant:"lite",content:ex.answer,className:"text-xs px-1 border-t pt-1 max-h-48 overflow-y-auto"})]}),e1&&(eD=ej(w,y),e_=[{id:"anthropic",name:"Anthropic"},...(eI||[]).filter(e=>!e.isBuiltin).map(e=>({id:e.id,name:e.name}))],eM=(eP=eD.alias?(0,u.r5)(eD.alias):[]).length>=1,eq=(e,t)=>w===t.modelId||w===`${e.id}:${t.modelId}`,ez=(()=>{if(eD.entry)return eD.entry.contextSizes;if(!eI||!w)return[];for(let e of eI){let t=e.models.find(t=>eq(e,t));if(t)return t.contextSizes??[]}return[]})(),eF=new Set((eU=(()=>{if(!eI||!w)return[];for(let e of eI){let t=e.models.find(t=>eq(e,t));if(t)return t.effortLevels??[]}return[]})()).length>0?eU:(0,u.iz)(eD.entry)),eL=ew.filter(e=>"off"===e.value?eF.size>0:eF.has(e.value)),(0,n.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onMouseDown:e=>{e.target===e.currentTarget&&e5(!1)},children:(0,n.jsxs)("div",{className:"w-full max-w-xl mx-4 rounded-lg border bg-background shadow-lg overflow-hidden flex flex-col max-h-[85vh]",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between px-5 py-3 border-b shrink-0",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(E.A,{className:"h-4 w-4"}),(0,n.jsx)("h2",{className:"text-sm font-semibold",children:"Session settings"})]}),(0,n.jsx)("button",{onClick:()=>e5(!1),className:"rounded p-1 text-muted-foreground hover:text-foreground hover:bg-muted",children:(0,n.jsx)(k.A,{className:"h-4 w-4"})})]}),(0,n.jsxs)("div",{className:"flex flex-1 min-h-0",children:[(0,n.jsxs)("aside",{className:"w-28 border-r shrink-0 p-2 flex flex-col gap-1",children:[(0,n.jsxs)("button",{onClick:()=>e8("model"),className:`flex items-center gap-2 px-3 py-2 rounded text-xs font-medium transition-colors ${"model"===e4?"bg-primary/10 text-primary border-l-2 border-primary":"text-muted-foreground hover:text-foreground hover:bg-muted border-l-2 border-transparent"}`,children:[(0,n.jsx)(I.A,{className:"h-3.5 w-3.5"}),"Model"]}),(0,n.jsxs)("button",{onClick:()=>e8("runtime"),className:`flex items-center gap-2 px-3 py-2 rounded text-xs font-medium transition-colors ${"runtime"===e4?"bg-primary/10 text-primary border-l-2 border-primary":"text-muted-foreground hover:text-foreground hover:bg-muted border-l-2 border-transparent"}`,children:[(0,n.jsx)(T.A,{className:"h-3.5 w-3.5"}),"Harness"]})]}),(0,n.jsxs)("div",{className:"flex-1 overflow-y-auto p-4 space-y-4 min-h-[320px]",children:["model"===e4&&(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(R.A,{className:"h-3.5 w-3.5 text-muted-foreground"}),(0,n.jsx)("span",{className:"text-xs font-medium text-foreground",children:"Provider"})]}),(0,n.jsx)("select",{value:e6,"data-testid":"provider-select",onChange:e=>e9(e.target.value),className:"rounded border border-input bg-background px-2 py-1 text-xs focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:e_.map(e=>(0,n.jsx)("option",{value:e.id,children:e.name},e.id))})]}),"anthropic"===e6?(0,n.jsx)("div",{className:"space-y-0.5",children:eb.map(e=>{let t=eD.alias===e.value;return(0,n.jsxs)("button",{onClick:()=>{var t;let s;return C((t=e.value,(s=(0,u.zQ)(t))?ev(s):t))},className:`flex w-full items-center gap-3 rounded px-3 py-2 text-xs transition-colors ${t?"bg-primary/10 text-primary":"hover:bg-muted text-foreground"}`,children:[(0,n.jsx)("div",{className:"w-3 shrink-0",children:t?(0,n.jsx)(N.A,{className:"h-3 w-3"}):(0,n.jsx)("div",{className:"h-3 w-3 rounded-full border border-muted-foreground/40"})}),(0,n.jsx)("span",{className:"font-mono font-medium",children:e.label})]},e.value)})}):(eO=eI?.find(e=>e.id===e6))?(0,n.jsx)("div",{className:"space-y-0.5",children:eO.models.map(e=>{let t=`${eO.id}:${e.modelId}`,s=w===t||w===e.modelId;return(0,n.jsxs)("button",{onClick:()=>C(t),className:`flex w-full items-center gap-3 rounded px-3 py-2 text-xs transition-colors ${s?"bg-primary/10 text-primary":"hover:bg-muted text-foreground"}`,children:[(0,n.jsx)("div",{className:"w-3 shrink-0",children:s?(0,n.jsx)(N.A,{className:"h-3 w-3"}):(0,n.jsx)("div",{className:"h-3 w-3 rounded-full border border-muted-foreground/40"})}),(0,n.jsx)("span",{className:"font-mono font-medium",children:e.modelId}),(0,n.jsx)("span",{className:"text-muted-foreground ml-auto",children:e.displayName})]},e.modelId)})}):null,eM&&(0,n.jsxs)("div",{className:"flex items-center gap-2 pt-1",children:[(0,n.jsx)(D.A,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:"Version"}),(0,n.jsx)("div",{className:"ml-auto flex gap-1",children:eP.map(e=>(0,n.jsx)("button",{onClick:()=>C(ev(e)),className:`rounded px-2 py-0.5 text-xs transition-colors ${eD.entry?.modelId===e.modelId?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:text-foreground"}`,children:e.version},e.modelId))})]}),ez.length>=2&&(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(_.A,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:"Context"}),(0,n.jsx)("div",{className:"ml-auto flex gap-1",children:ez.map(e=>(0,n.jsx)("button",{onClick:()=>C(w,e),className:`rounded px-2 py-0.5 text-xs transition-colors ${eD.contextSize===e?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:text-foreground"}`,children:u.XR[e].label},e))})]}),eF.size>0&&(0,n.jsxs)("div",{className:"flex items-start gap-2",children:[(0,n.jsx)(I.A,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0 mt-0.5"}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground py-0.5 shrink-0",children:"Thinking"}),(0,n.jsx)("div",{className:"ml-auto flex flex-wrap gap-1 justify-end",children:eL.map(e=>(0,n.jsx)("button",{onClick:()=>v(e.value),"data-testid":`thinking-${e.value}`,className:`rounded px-2 py-0.5 text-xs transition-colors ${j===e.value?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:text-foreground"}`,children:e.label},e.value))})]})]}),"runtime"===e4&&(0,n.jsxs)("div",{className:"space-y-5",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(T.A,{className:"h-3.5 w-3.5 text-muted-foreground"}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:"Agent harness:"}),(0,n.jsx)("span",{className:"text-xs font-medium text-foreground",children:"Claude Code"})]}),e$&&(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(P.A,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:"Backend"}),(0,n.jsxs)("div",{className:"ml-auto flex gap-1",children:[(0,n.jsx)("button",{onClick:()=>e$("pty"),"data-testid":"runtime-pty",className:`rounded px-2 py-0.5 text-xs transition-colors ${"pty"===ef?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:text-foreground"}`,children:"PTY"}),(0,n.jsx)("button",{onClick:()=>e$("stream"),"data-testid":"runtime-stream",className:`rounded px-2 py-0.5 text-xs transition-colors ${"stream"===ef?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:text-foreground"}`,children:"Stream"})]})]}),(0,n.jsxs)("button",{onClick:()=>{eE?.(),e5(!1)},className:"flex w-full items-center justify-center gap-2 rounded-lg border border-border px-4 py-2.5 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors",children:[(0,n.jsx)(M.A,{className:"h-3.5 w-3.5"}),"Restart agent harness"]}),!g&&(0,n.jsxs)("button",{onClick:()=>i(!o),className:"flex w-full items-center justify-between rounded-lg border border-border px-4 py-3 text-xs hover:bg-muted/50 transition-colors","data-testid":"bypass-toggle",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[o?(0,n.jsx)(q.A,{className:"h-4 w-4 text-orange-500"}):(0,n.jsx)(z.A,{className:"h-4 w-4 text-muted-foreground"}),(0,n.jsx)("span",{className:o?"text-orange-500 font-medium":"text-muted-foreground",children:"Bypass all permissions"})]}),(0,n.jsx)("span",{className:`inline-flex h-5 w-9 items-center rounded-full transition-colors shrink-0 ${o?"bg-orange-500":"bg-muted-foreground/30"}`,children:(0,n.jsx)("span",{className:`inline-block h-4 w-4 rounded-full bg-white transition-transform shadow-sm ${o?"translate-x-4.5":"translate-x-0.5"}`})})]}),Y?.mcpServers&&Y.mcpServers.length>0&&(0,n.jsxs)("button",{onClick:()=>eX(!0),className:"flex w-full items-center justify-between rounded-lg border border-border px-4 py-3 text-xs hover:bg-muted/50 transition-colors",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)(U.A,{className:"h-4 w-4 text-muted-foreground"}),(0,n.jsx)("span",{className:"text-muted-foreground",children:"MCP Servers"})]}),(0,n.jsxs)("span",{className:"flex items-center gap-1 text-muted-foreground",children:[Y.mcpServers.filter(e=>"connected"===e.status).length,"/",Y.mcpServers.length,(0,n.jsx)(F.A,{className:"h-3 w-3"})]})]})]})]})]}),(0,n.jsx)("div",{className:"flex items-center justify-end px-5 py-3 border-t shrink-0",children:(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)("button",{onClick:()=>e5(!1),className:"px-3 py-1.5 text-xs rounded-md border border-input text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:"Cancel"}),(0,n.jsx)("button",{onClick:()=>e5(!1),className:"px-4 py-1.5 text-xs rounded-md bg-primary text-primary-foreground hover:brightness-110 transition-all",children:"Done"})]})})]})})),tC&&(0,n.jsxs)("div",{className:"mb-1 flex gap-2 flex-wrap px-9",children:[tn.map((e,t)=>(0,n.jsxs)("div",{className:"relative group",children:[(0,n.jsx)("img",{src:`data:${e.mediaType};base64,${e.data}`,className:"h-16 rounded border object-contain cursor-pointer",alt:"",onClick:()=>tm({type:"image",src:`data:${e.mediaType};base64,${e.data}`,index:t})}),(0,n.jsx)("button",{onClick:()=>tq(t),className:"absolute top-0.5 right-0.5 opacity-0 group-hover:opacity-100 transition-opacity text-destructive",children:(0,n.jsx)(L.A,{className:"h-3.5 w-3.5"})})]},`img-${t}`)),ta.map((e,t)=>(0,n.jsxs)("div",{className:"relative group flex items-center gap-1.5 rounded border px-2 py-1 text-xs bg-muted h-16",children:[(0,n.jsx)(O.A,{className:"h-4 w-4 text-red-500 shrink-0"}),(0,n.jsx)("span",{className:"truncate max-w-[120px]",children:e.name}),(0,n.jsx)("button",{onClick:()=>tz(t),className:"absolute top-0.5 right-0.5 opacity-0 group-hover:opacity-100 transition-opacity text-destructive",children:(0,n.jsx)(L.A,{className:"h-3.5 w-3.5"})})]},`doc-${t}`)),to.map((e,t)=>(0,n.jsxs)("div",{className:"relative group flex items-center gap-1.5 rounded border px-2 py-1 text-xs bg-muted h-16 cursor-pointer",onClick:()=>tm({type:"text",content:e.content,name:e.name,index:t}),children:[(0,n.jsx)(O.A,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,n.jsx)("span",{className:"truncate max-w-[120px]",children:e.name}),(0,n.jsx)("button",{onClick:e=>{e.stopPropagation(),tU(t)},className:"absolute top-0.5 right-0.5 opacity-0 group-hover:opacity-100 transition-opacity text-destructive",children:(0,n.jsx)(L.A,{className:"h-3.5 w-3.5"})})]},`txt-${t}`))]}),Z&&(0,n.jsxs)("button",{type:"button",onClick:()=>eK(!0),className:"mb-2 mx-9 flex items-center gap-2 rounded-md border border-dashed px-3 py-1.5 text-xs hover:bg-muted transition-colors cursor-pointer",children:[(0,n.jsx)($.A,{className:`h-3.5 w-3.5 shrink-0 ${en?"text-yellow-500":"text-primary"}`}),(0,n.jsxs)("span",{className:en?"text-yellow-500":"text-muted-foreground",children:[es?.length??0," message",(es?.length??0)!==1?"s":""," ",en?"paused":"queued"]}),(0,n.jsx)("span",{className:"text-muted-foreground/50 ml-auto",children:"click to manage"})]}),(0,n.jsxs)("div",{className:"relative flex items-stretch gap-1",children:[tj&&(0,n.jsx)(ei,{query:tv,selectedIndex:eZ,onSelect:tN,cwd:X,onItemsChange:e=>{tf.current=e},initCommands:Y?.slashCommands}),ty&&X&&(0,n.jsx)(ea,{query:tw.query,cwd:X,selectedIndex:e7,onSelect:tk,onItemsChange:e=>{tp.current=e},initAgents:Y?.agents}),(0,n.jsx)("input",{ref:th,type:"file",accept:eC,multiple:!0,onChange:tL,className:"hidden"}),(0,n.jsxs)("div",{className:"flex flex-col items-center justify-evenly w-8 shrink-0",children:[S&&(0,n.jsx)(em,{usage:S,onCompact:V}),(0,n.jsx)(ee.$,{size:"icon",variant:"ghost","data-testid":"btn-session-settings",className:`h-8 w-8 ${o?"text-orange-500":""}`,onClick:()=>e5(e=>(e||(ej(w,y).alias?e9("anthropic"):e9((0,u.rs)(w,eI))),!e)),children:(0,n.jsx)(E.A,{className:"h-4 w-4"})})]}),(0,n.jsxs)("div",{className:"relative flex-1 mr-1",children:[(0,n.jsx)("textarea",{ref:tx,"data-testid":"message-input",value:eJ,onChange:tT,onKeyDown:tA,onInput:t$,onPaste:tD,onFocus:()=>e3(!0),onBlur:()=>e3(!1),placeholder:Z?en?"Queue paused (send to discard, or manage in modal)":"Message queued (Esc to interrupt)":l?"Use /btw to nudge, or type to queue...":d?"Plan with Claude...":"Send a message...",rows:2,className:`block w-full resize-none rounded-md border bg-background px-3 py-2 pb-7 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 overflow-y-auto scrollbar-none ${d?"border-blue-500/50 focus-visible:ring-blue-500/50":"border-input focus-visible:ring-ring"}`}),(0,n.jsx)("button",{onClick:tF,title:"Attach file",className:"absolute bottom-2.5 right-1.5 rounded p-1 text-muted-foreground hover:text-foreground hover:bg-muted transition-colors disabled:opacity-50",children:(0,n.jsx)(W.A,{className:"h-4 w-4"})}),!e2&&(0,n.jsxs)("button",{type:"button","data-testid":"model-pill",title:"Model and thinking level — click to change",onClick:()=>{e9(ej(w,y).alias?"anthropic":(0,u.rs)(w,eI)),e5(!0)},className:"absolute bottom-2.5 left-2.5 flex max-w-[60%] items-center gap-1 rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground transition-colors hover:bg-muted/70 hover:text-foreground",children:[(0,n.jsx)(R.A,{className:"h-2.5 w-2.5 shrink-0"}),(0,n.jsx)("span",{className:"truncate",children:tO.label}),tW&&(0,n.jsxs)("span",{className:"shrink-0 text-muted-foreground/60",children:["\xb7 ",tW]}),tB&&(0,n.jsxs)("span",{className:"shrink-0 text-muted-foreground/60",children:["\xb7 ",tB]})]})]}),(0,n.jsxs)("div",{className:"flex flex-col items-center justify-center w-12 shrink-0 overflow-visible",children:[eB?!l||eJ.trim()||tC?(0,n.jsx)(ee.$,{size:"icon",className:"h-8 w-8",onClick:tS,disabled:!eJ.trim()&&!tC,"data-testid":"btn-send",children:(0,n.jsx)(J.A,{className:"h-4 w-4"})}):(0,n.jsx)(ee.$,{size:"icon",variant:"destructive",className:"h-8 w-8",onClick:()=>a(),children:(0,n.jsx)(B.A,{className:"h-4 w-4"})}):(0,n.jsx)(ee.$,{size:"icon",variant:"ghost",className:"h-8 w-8",disabled:!0,title:"Connecting...",children:(0,n.jsx)(r.A,{className:"h-4 w-4 animate-spin text-muted-foreground"})}),p&&(0,n.jsxs)("button",{onClick:()=>m(!d),title:d?"Switch to Build mode (Tab)":"Switch to Plan mode (Tab)",className:`mt-4 flex items-center gap-0.5 whitespace-nowrap rounded-full px-1.5 py-0.5 text-[10px] font-medium transition-colors ${d?"bg-blue-500/15 text-blue-500 hover:bg-blue-500/25":"bg-muted text-muted-foreground hover:bg-muted/80 hover:text-foreground"}`,children:[d?(0,n.jsx)(H.A,{className:"h-2.5 w-2.5"}):(0,n.jsx)(G.A,{className:"h-2.5 w-2.5"}),d?"Plan":"Build"]})]})]})]}),(0,n.jsx)(ec.lG,{open:null!==tu,onOpenChange:()=>tm(null),className:"max-w-3xl",children:(0,n.jsxs)(ec.Cf,{className:"max-h-[80vh] overflow-auto",onClose:()=>tm(null),onDelete:()=>{tu&&("image"===tu.type?tq(tu.index):tU(tu.index),tm(null))},children:[tu?.type==="image"&&(0,n.jsx)("img",{src:tu.src,className:"w-full rounded object-contain",alt:""}),tu?.type==="text"&&((eW=(0,K.WG)(tu.name))?(0,n.jsx)(K.NG,{code:tu.content,language:eW,fullHeight:!0}):(0,n.jsx)("pre",{className:"whitespace-pre-wrap text-sm font-mono",children:tu.content}))]})}),(0,n.jsx)(eg,{open:eG,onOpenChange:eK,messages:es??[],paused:en??!1,onDelete:er??(()=>{}),onEdit:el??(()=>{}),onResume:eo??(()=>{})}),(0,n.jsx)(et,{open:eQ,onOpenChange:eX,sessionId:e,initData:Y}),(0,n.jsx)(eh,{open:eV,prompts:t,onSelect:e=>{eY(!1),eH(e),requestAnimationFrame(()=>tx.current?.focus())},onClose:()=>{eY(!1),requestAnimationFrame(()=>tx.current?.focus())}})]})}var e$=s(513);function eE({currentModel:e,currentContextSize:t,onSelect:s,providers:r,slot:a}){let l=function(e){let t=[];for(let s of e)for(let e of s.models){let n=e.effortLevels.length>0?`Thinking: ${e.effortLevels.join(", ")}`:"No thinking";t.push({key:`${s.id}::${e.modelId}`,value:e.modelId,label:e.displayName,description:n,providerId:s.id,providerName:s.name,sizes:e.contextSizes})}return t}(r),o="";return(0,n.jsx)("div",{className:"mx-auto max-w-3xl",children:(0,n.jsxs)("div",{className:"rounded-lg border border-border bg-card p-4 space-y-1",children:[(0,n.jsxs)("div",{className:"flex items-baseline justify-between pb-2",children:[(0,n.jsx)("div",{className:"text-sm font-medium",children:a?`Switch ${a} model`:"Switch model"}),(0,n.jsxs)("div",{className:"text-xs text-muted-foreground font-mono",children:["Current: ",e]})]}),l.map(r=>{let a=r.providerName!==o;o=r.providerName;let l=r.value===e;return(0,n.jsxs)("div",{children:[a&&(0,n.jsx)("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider pt-3 pb-1 px-3",children:r.providerName}),(0,n.jsxs)("button",{onClick:()=>s(r.value),className:`w-full flex items-center gap-3 rounded-md px-3 py-2 text-left text-sm transition-colors ${l?"bg-primary/10 text-primary":"hover:bg-muted text-foreground"}`,children:[(0,n.jsx)("div",{className:"w-4 shrink-0",children:l&&(0,n.jsx)(N.A,{className:"h-4 w-4"})}),(0,n.jsx)("span",{className:"font-mono font-bold",children:r.value}),(0,n.jsx)("span",{className:"text-muted-foreground",children:r.label}),(0,n.jsx)("span",{className:"text-muted-foreground ml-auto text-xs",children:r.description})]}),r.sizes.length>=2&&(0,n.jsx)("div",{className:"flex gap-1 pl-10 pt-1 pb-2",children:r.sizes.map(a=>(0,n.jsx)("button",{onClick:()=>s(r.value,a),className:`rounded px-2 py-0.5 text-xs transition-colors ${r.value===e&&t===a?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:text-foreground"}`,children:u.XR[a].label},a))})]},r.key)})]})})}var eI=s(69203);let eT={session:"session",localSettings:"project (local)",projectSettings:"project",userSettings:"global",cliArg:"session"};function eR({permission:e,onRespond:t}){let s=(0,c.useRef)(null);(0,c.useEffect)(()=>{s.current?.focus()},[]);let r=(0,c.useMemo)(()=>{if(!e.input)return{};try{return JSON.parse(e.input)}catch{return{}}},[e.input]),a=function(e,t){switch(e){case"Bash":case"bash":{let e=t.command||"";return e.length>80?e.slice(0,80)+"...":e}case"Write":case"write":case"Edit":case"edit":case"Read":case"read":{let e=t.file_path||"";return e?(0,v._1)(e):""}default:return""}}(e.toolName,r),l=e.suggestions,o=l&&l.length>0;return(0,n.jsx)("div",{className:"mx-auto max-w-3xl","data-testid":"permission-prompt",children:(0,n.jsx)("div",{className:"rounded-lg border border-yellow-500/50 bg-yellow-500/10 p-4",children:(0,n.jsxs)("div",{className:"flex items-start gap-3",children:[(0,n.jsx)(eI.A,{className:"h-5 w-5 shrink-0 text-yellow-500 mt-0.5"}),(0,n.jsxs)("div",{className:"flex-1 min-w-0 space-y-2",children:[(0,n.jsxs)("div",{className:"text-sm font-medium",children:["Permission requested: ",(0,n.jsx)("span",{className:"font-mono",children:e.toolName})]}),a&&(0,n.jsx)("div",{className:"font-mono text-xs text-muted-foreground truncate",children:a}),e.input&&(0,n.jsx)("pre",{className:"overflow-x-auto rounded bg-black/10 dark:bg-white/5 p-2 text-[11px] leading-relaxed max-h-32 overflow-y-auto",children:e.input.length>500?e.input.slice(0,500)+"\n... (truncated)":e.input}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2 pt-1",children:[(0,n.jsx)("button",{ref:s,onClick:()=>t(e.requestId,!0,"allow"),className:"rounded bg-primary px-3 py-1 text-xs font-medium text-primary-foreground hover:bg-primary/90","data-testid":"btn-allow",children:"Allow"}),o?l.map((s,r)=>(0,n.jsx)("button",{onClick:()=>t(e.requestId,!0,"allow_always",r),className:"rounded bg-primary/70 px-3 py-1 text-xs font-medium text-primary-foreground hover:bg-primary/60",title:JSON.stringify(s,null,2),children:function(e){let t=eT[e.destination||""]||e.destination||"session";if("setMode"===e.type&&e.mode)return`${e.mode} mode (${t})`;if("addDirectories"===e.type&&e.directories?.length){let s=e.directories[0],n=(0,v.uk)(s)||s;return`Allow dir ${n} (${t})`}if(!e.rules?.length)return`Always allow (${t})`;let s=e.rules[0],n=s.toolName,r=s.ruleContent;if(!r)return`Always ${n} (${t})`;let a=r.length>30?r.slice(0,30)+"...":r;return`${n}(${a}) (${t})`}(s)},r)):(0,n.jsxs)("button",{onClick:()=>t(e.requestId,!0,"allow_always"),className:"rounded bg-primary/70 px-3 py-1 text-xs font-medium text-primary-foreground hover:bg-primary/60",children:["Always for ",e.toolName]}),(0,n.jsx)("button",{onClick:()=>t(e.requestId,!0,"allow_all"),className:"rounded bg-orange-600 px-3 py-1 text-xs font-medium text-white hover:bg-orange-700",children:"Bypass All"}),(0,n.jsx)("button",{onClick:()=>t(e.requestId,!1,"deny"),className:"rounded bg-muted px-3 py-1 text-xs font-medium text-muted-foreground hover:bg-muted/80",children:"Deny"})]})]})]})})})}var eD=s(36672),e_=s(52750),eP=s(89723);let eM=[{label:"Yes, clear context and auto-accept edits",clearContext:!0,autoAccept:!0},{label:"Yes, clear context and manually approve edits",clearContext:!0,autoAccept:!1},{label:"Yes, auto-accept edits",clearContext:!1,autoAccept:!0},{label:"Yes, manually approve edits",clearContext:!1,autoAccept:!1}],eq=[{label:"Yes, clear context and implement",clearContext:!0,autoAccept:!0},{label:"Yes, continue implementing",clearContext:!1,autoAccept:!0}];function ez({permission:e,bypassActive:t,onRespond:s,onSendMessage:r,onSetBypass:a,onSetPlanMode:l}){let o=t?eq:eM,[i,d]=(0,c.useState)(0),[u,m]=(0,c.useState)(!1),[x,h]=(0,c.useState)(""),[p,f]=(0,c.useState)(!1),g=(0,c.useRef)(null),b=(0,c.useRef)(null),j=(0,c.useMemo)(()=>{if(!e.input)return[];try{return JSON.parse(e.input).allowedPrompts||[]}catch{return[]}},[e.input]);(0,c.useEffect)(()=>{g.current?.focus()},[]),(0,c.useEffect)(()=>{u&&b.current?.focus()},[u]);let v=(0,c.useCallback)(t=>{let n=o[t];if(n.autoAccept&&a(!0),n.clearContext){let t=e.planFilePath?` at ${e.planFilePath}`:"";s(e.requestId,!1,"deny"),l(!1),setTimeout(()=>{r("/clear"),setTimeout(()=>r(`Implement the plan${t}`),200)},100)}else s(e.requestId,!0,"allow")},[o,e.requestId,e.planFilePath,s,r,a,l]),w=(0,c.useCallback)(()=>{s(e.requestId,!1,"deny"),setTimeout(()=>l(!0),100)},[e.requestId,s,l]),y=(0,c.useCallback)(()=>{let t=x.trim();t&&(s(e.requestId,!1,"deny"),setTimeout(()=>r(t),100))},[x,e.requestId,s,r]),N=(0,c.useCallback)(e=>{if(u)return void("Escape"===e.key?(e.preventDefault(),m(!1),g.current?.focus()):"Enter"!==e.key||e.shiftKey||(e.preventDefault(),y()));if("Escape"===e.key){e.preventDefault(),w();return}"ArrowUp"===e.key||"k"===e.key?(e.preventDefault(),d(e=>Math.max(0,e-1))):"ArrowDown"===e.key||"j"===e.key?(e.preventDefault(),d(e=>Math.min(o.length+1,e+1))):"Enter"===e.key&&(e.preventDefault(),i===o.length?m(!0):i===o.length+1?w():v(i))},[o,u,i,v,y,w]);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"mx-auto max-w-3xl","data-testid":"plan-approval-prompt",children:(0,n.jsx)("div",{ref:g,tabIndex:-1,onKeyDown:N,className:"rounded-lg border border-blue-500/50 bg-blue-500/10 p-4 outline-none",children:(0,n.jsxs)("div",{className:"flex items-start gap-3",children:[(0,n.jsx)(eD.A,{className:"h-5 w-5 shrink-0 text-blue-500 mt-0.5"}),(0,n.jsxs)("div",{className:"flex-1 min-w-0 space-y-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("div",{className:"text-sm font-medium",children:"Would you like to proceed?"}),e.planContent&&(0,n.jsxs)("button",{onClick:()=>f(!0),className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-xs text-blue-500 hover:bg-blue-500/10",children:[(0,n.jsx)(e_.A,{className:"h-3 w-3"}),"View plan"]})]}),j.length>0&&(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsx)("div",{className:"text-xs text-muted-foreground",children:"Permissions requested for implementation:"}),(0,n.jsx)("ul",{className:"text-xs text-muted-foreground space-y-0.5",children:j.map((e,t)=>(0,n.jsxs)("li",{className:"flex items-center gap-1.5 pl-2",children:[(0,n.jsx)("span",{className:"font-mono text-foreground/70",children:e.tool}),(0,n.jsx)("span",{children:e.prompt})]},t))})]}),(0,n.jsxs)("div",{className:"space-y-0.5",children:[o.map((e,t)=>(0,n.jsxs)("button",{onClick:()=>v(t),onMouseEnter:()=>d(t),className:`flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs transition-colors ${i===t?"bg-blue-600/20 text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,n.jsxs)("span",{className:"shrink-0 font-mono text-blue-500 w-4",children:[t+1,"."]}),(0,n.jsx)("span",{children:e.label}),0===t&&(0,n.jsx)("span",{className:"ml-auto text-[10px] text-muted-foreground hidden sm:inline",children:"default"})]},t)),(0,n.jsxs)("button",{onClick:()=>m(!0),onMouseEnter:()=>d(o.length),className:`flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs transition-colors ${i===o.length?"bg-blue-600/20 text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,n.jsxs)("span",{className:"shrink-0 font-mono text-blue-500 w-4",children:[o.length+1,"."]}),(0,n.jsx)("span",{children:"Tell Claude what to change"})]}),(0,n.jsxs)("button",{onClick:w,onMouseEnter:()=>d(o.length+1),className:`flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs transition-colors ${i===o.length+1?"bg-blue-600/20 text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,n.jsx)("span",{className:"shrink-0 font-mono text-muted-foreground w-4",children:"Esc"}),(0,n.jsx)("span",{children:"Dismiss"})]})]}),u&&(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)("textarea",{ref:b,value:x,onChange:e=>h(e.target.value),placeholder:"Describe what you'd like to change about the plan...",className:"w-full rounded border border-border bg-background px-3 py-2 text-xs resize-none focus:outline-none focus:ring-1 focus:ring-blue-500",rows:3}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsxs)("button",{onClick:y,disabled:!x.trim(),className:"flex items-center gap-1.5 rounded bg-blue-600 px-3 py-1.5 text-xs font-medium text-white hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,n.jsx)(J.A,{className:"h-3 w-3"}),"Send feedback"]}),(0,n.jsx)("button",{onClick:()=>{m(!1),g.current?.focus()},className:"rounded px-3 py-1.5 text-xs text-muted-foreground hover:bg-muted",children:"Cancel"})]})]})]})]})})}),e.planContent&&e.planFilePath&&(0,n.jsx)(eP.G,{open:p,onOpenChange:f,content:e.planContent,filePath:e.planFilePath})]})}var eU=s(40638),eF=s(67401);function eL(e){try{return JSON.parse(e).questions||[]}catch{return[]}}function eO({tool:e}){let t=(0,c.useMemo)(()=>eL(e.input),[e.input]),s=(0,c.useMemo)(()=>(function(e){let t=new Map;for(let s of e.matchAll(/"([^"]+)"="([^"]+)"/g))t.set(s[1],s[2]);return t})(e.output||""),[e.output]);return 0===t.length?null:(0,n.jsx)("div",{className:"rounded-lg border border-border bg-background/50 p-3 space-y-3",children:t.map((e,t)=>{let r=s.get(e.question),a=r&&!e.options.some(e=>e.label===r);return(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsxs)("div",{className:"text-sm font-medium flex items-center gap-2",children:[(0,n.jsx)(eU.A,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e.question]}),(0,n.jsxs)("div",{className:"space-y-0.5 pl-6",children:[e.options.map((e,t)=>{let s=r===e.label;return(0,n.jsxs)("div",{className:`flex w-full items-start gap-2.5 rounded-md px-2.5 py-2 text-xs ${s?"bg-primary/10":""}`,children:[s?(0,n.jsx)(N.A,{className:"h-3.5 w-3.5 shrink-0 mt-0.5 text-primary"}):(0,n.jsx)(eF.A,{className:"h-3.5 w-3.5 shrink-0 mt-0.5 text-muted-foreground/40"}),(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("div",{className:s?"font-medium text-foreground":"text-muted-foreground",children:e.label}),s&&e.description&&(0,n.jsx)("div",{className:"text-muted-foreground text-[11px] mt-0.5",children:e.description})]})]},t)}),a&&(0,n.jsxs)("div",{className:"flex w-full items-start gap-2.5 rounded-md px-2.5 py-2 text-xs bg-primary/10",children:[(0,n.jsx)(ep.A,{className:"h-3.5 w-3.5 shrink-0 mt-0.5 text-primary"}),(0,n.jsx)("div",{className:"min-w-0",children:(0,n.jsx)("div",{className:"font-medium text-foreground",children:r})})]})]})]},t)})})}let eW="__other__";function eB({questions:e,requestId:t,onSubmit:s}){let[r,a]=(0,c.useState)({}),[l,o]=(0,c.useState)({}),[i,d]=(0,c.useState)(!1),u=(0,c.useRef)({}),m=(0,c.useCallback)((e,t)=>{i||a(s=>({...s,[e]:s[e]===t?"":t}))},[i]),x=(0,c.useCallback)(e=>{i||(a(t=>({...t,[e]:eW})),setTimeout(()=>u.current[e]?.focus(),0))},[i]),h=e.every(e=>{let t=r[e.question];return!!t&&(t!==eW||!!l[e.question]?.trim())}),p=(0,c.useCallback)(()=>{if(!h||i)return;d(!0);let n={};for(let t of e){let e=r[t.question];n[t.question]=e===eW?l[t.question]:e}s(t,n)},[h,i,t,r,l,e,s]);return(0,n.jsx)("div",{className:"rounded-lg border border-border bg-card p-4",children:(0,n.jsxs)("div",{className:"space-y-3",children:[e.map((e,t)=>{let s=r[e.question],a=s===eW;return(0,n.jsxs)("div",{className:"space-y-2",children:[e.header&&(0,n.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:e.header}),(0,n.jsxs)("div",{className:"text-sm font-medium flex items-center gap-2",children:[(0,n.jsx)(eU.A,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e.question]}),(0,n.jsxs)("div",{className:"space-y-0.5 pl-6",children:[e.options.map((t,r)=>{let a=s===t.label,l=i?"div":"button";return(0,n.jsxs)(l,{onClick:i?void 0:()=>m(e.question,t.label),className:`flex w-full items-start gap-2.5 rounded-md px-2.5 py-2 text-xs text-left transition-colors ${a?"bg-primary/10":i?"":"hover:bg-muted/50 cursor-pointer"}`,children:[a?(0,n.jsx)(N.A,{className:"h-3.5 w-3.5 shrink-0 mt-0.5 text-primary"}):(0,n.jsx)(eF.A,{className:"h-3.5 w-3.5 shrink-0 mt-0.5 text-muted-foreground/40"}),(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("div",{className:a?"font-medium text-foreground":i?"text-muted-foreground":"text-foreground",children:t.label}),t.description&&(0,n.jsx)("div",{className:"text-muted-foreground text-[11px] mt-0.5",children:t.description})]})]},r)}),i?a&&(0,n.jsxs)("div",{className:"flex w-full items-start gap-2.5 rounded-md px-2.5 py-2 text-xs bg-primary/10",children:[(0,n.jsx)(N.A,{className:"h-3.5 w-3.5 shrink-0 mt-0.5 text-primary"}),(0,n.jsx)("div",{className:"min-w-0",children:(0,n.jsx)("div",{className:"font-medium text-foreground",children:l[e.question]})})]}):(0,n.jsxs)("div",{className:`rounded-md transition-colors ${a?"bg-primary/10":"hover:bg-muted/50"}`,children:[(0,n.jsxs)("button",{type:"button",onClick:()=>x(e.question),className:"flex w-full items-start gap-2.5 px-2.5 py-2 text-xs text-left cursor-pointer",children:[a?(0,n.jsx)(N.A,{className:"h-3.5 w-3.5 shrink-0 mt-0.5 text-primary"}):(0,n.jsx)(eF.A,{className:"h-3.5 w-3.5 shrink-0 mt-0.5 text-muted-foreground/40"}),(0,n.jsx)("div",{className:"min-w-0 flex-1",children:(0,n.jsx)("div",{className:a?"font-medium text-foreground":"text-foreground",children:"Other"})})]}),a&&(0,n.jsx)("div",{className:"px-2.5 pb-2 pl-9",children:(0,n.jsx)("input",{ref:t=>{u.current[e.question]=t},type:"text",value:l[e.question]||"",onChange:t=>o(s=>({...s,[e.question]:t.target.value})),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),p())},placeholder:"Tell Claude what to do instead...",className:"w-full rounded border border-border bg-background px-2 py-1 text-xs text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary"})})]})]})]},t)}),!i&&(0,n.jsx)("div",{className:"flex justify-end pt-1",children:(0,n.jsx)("button",{disabled:!h,onClick:p,className:`rounded px-4 py-1.5 text-xs font-medium transition-colors ${h?"bg-primary text-primary-foreground hover:bg-primary/90":"bg-muted text-muted-foreground cursor-not-allowed"}`,children:"Submit"})})]})})}var eJ=s(99314);function eH({count:e,onCopy:t,onCancel:s}){return(0,n.jsx)("div",{className:"fixed bottom-20 left-1/2 -translate-x-1/2 z-50 animate-in slide-in-from-bottom-4 fade-in duration-200",children:(0,n.jsxs)("div",{className:"flex items-center gap-2 rounded-full border bg-background px-4 py-2 shadow-lg",children:[(0,n.jsxs)("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:[e," selected"]}),(0,n.jsxs)(ee.$,{size:"sm",variant:"default",onClick:t,className:"gap-1.5",children:[(0,n.jsx)(eJ.A,{className:"h-3.5 w-3.5"}),"Copy"]}),(0,n.jsx)(ee.$,{size:"sm",variant:"ghost",onClick:s,children:(0,n.jsx)(k.A,{className:"h-3.5 w-3.5"})})]})})}function eG({open:e,models:t,onStrip:s,onNewSession:l,onCancel:o}){let[i,d]=(0,c.useState)(!1),u=async()=>{d(!0);try{await s()}finally{d(!1)}};return(0,n.jsx)(ec.lG,{open:e,onOpenChange:e=>!e&&o(),children:(0,n.jsxs)(ec.Cf,{onClose:o,children:[(0,n.jsx)(ec.c7,{children:(0,n.jsxs)(ec.L3,{className:"flex items-center gap-2",children:[(0,n.jsx)(a.A,{className:"h-5 w-5 text-amber-500"}),"Incompatible Thinking Blocks"]})}),(0,n.jsxs)("div",{className:"space-y-3 mt-1",children:[(0,n.jsxs)("p",{className:"text-sm text-muted-foreground",children:["This session contains thinking blocks from ",(0,n.jsx)("span",{className:"font-mono text-foreground",children:t.join(", ")}),". Anthropic models cannot continue a conversation that includes non-Anthropic thinking blocks."]}),(0,n.jsxs)("div",{className:"flex flex-col gap-2 pt-2",children:[(0,n.jsx)(ee.$,{onClick:u,disabled:i,variant:"default",children:i?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(r.A,{className:"h-4 w-4 animate-spin mr-2"}),"Stripping..."]}):"Strip thinking blocks and switch"}),(0,n.jsx)(ee.$,{onClick:l,variant:"outline",disabled:i,children:"Start a new session instead"}),(0,n.jsx)(ee.$,{onClick:o,variant:"ghost",disabled:i,className:"text-muted-foreground",children:"Cancel"})]})]})]})})}function eK({sessionId:e,cwd:t,initialName:s,initialContext:x,historyView:h,onSendMessage:p,className:f,showPlanToggle:N=!0,isCockpitAgent:k=!1}){let{messages:C,historyLoaded:S,isResponding:$,errorActive:E,pendingPermissions:I,pendingQuestions:T,modelPicker:R,currentModel:D,currentContextSize:_,bypassActive:P,planMode:M,thinkingLevel:q,contextUsage:z,rateLimitStatus:U,apiError:F,sessionName:L,initData:O,activeModelId:W,hasQueuedMessage:B,queuedMessages:J,queuePaused:H,backgroundTasks:G,todos:K,btw:Q,promptHistory:X,hasMoreHistory:V,loadingMore:Y,requestMoreHistory:Z,sendMessage:ee,interrupt:et,respondToPermission:es,respondToQuestion:en,setModel:er,setBypassAll:ea,setPlanMode:el,setThinkingLevel:eo,cancelQueuedMessage:ei,deleteQueuedMessage:ec,editQueuedMessage:ed,resumeQueue:eu,restoredText:em,clearRestoredText:ex,dismissBtw:eh,retry:ep,currentRuntime:ef,setRuntime:eg,restartSession:eb,thinkingCheck:ej,confirmThinkingStrip:ev,cancelThinkingCheck:ew}=function(e,t,s){let{send:n,subscribe:r,connected:a}=(0,b.h)(),[l,o]=(0,c.useState)([]),[i,d]=(0,c.useState)(!1),[x,h]=(0,c.useState)([]),[p,f]=(0,c.useState)([]),[j,v]=(0,c.useState)(null),[w,y]=(0,c.useState)("sonnet"),[N,k]=(0,c.useState)(u.w6),[C,S]=(0,c.useState)("stream"),[A,$]=(0,c.useState)(!1),[E,I]=(0,c.useState)(!1),[T,R]=(0,c.useState)("high"),[D,_]=(0,c.useState)(!1),[P,M]=(0,c.useState)(null),[q,z]=(0,c.useState)(null),[U,F]=(0,c.useState)(null),[L,O]=(0,c.useState)([]),[W,B]=(0,c.useState)(null),[J,H]=(0,c.useState)(null),[G,K]=(0,c.useState)(null),[Q,X]=(0,c.useState)([]),[V,Y]=(0,c.useState)([]),[Z,ee]=(0,c.useState)(null),[et,es]=(0,c.useState)([]),[en,er]=(0,c.useState)(!1),[ea,el]=(0,c.useState)(!1),[eo,ei]=(0,c.useState)(!1),[ec,ed]=(0,c.useState)([]),[eu,em]=(0,c.useState)(!1),[ex,eh]=(0,c.useState)(null),[ep,ef]=(0,c.useState)(!1),eg=(0,c.useRef)(void 0),eb=(0,c.useRef)(!1),ej=(0,c.useRef)([]),ev=(0,c.useRef)(w),ew=(0,c.useRef)(null),ey=(0,c.useRef)([]),eN=(0,c.useRef)(null),ek=(0,c.useRef)([]),eC=(0,c.useRef)(null);null!==eC.current&&eC.current!==e&&(eN.current=null,ek.current=[],eC.current=null,es([]),er(!1),el(!1)),(0,c.useEffect)(()=>{ej.current=l},[l]),(0,c.useEffect)(()=>{ev.current=w},[w]),(0,c.useEffect)(()=>{if(a){h([]),f(e=>(e.length>0&&console.log(`[question-debug] connect: clearing ${e.length} pendingQuestions`,e.map(e=>e.requestId)),[]));let r=eC.current===e;console.log(`[session] sending session:connect for ${e.slice(0,8)}`),window.__sessionConnectTime=performance.now(),n({type:"session:connect",sessionId:e,cwd:t||void 0,lastMessageId:r?eN.current:void 0,historyView:s||void 0})}},[a,e,t,s,n]),(0,c.useEffect)(()=>r(t=>{if(!("sessionId"in t)||t.sessionId===e)switch(t.type){case"history":{let s=t.messages;if(s.length>0&&(eN.current=s[s.length-1].id),t.delta)ew.current=null,ey.current=[],o(e=>{let t=e.filter(e=>"streaming"!==e.id);if(0===s.length)return t.length===e.length?e:t;let n=new Set(t.map(e=>e.id)),r=s.filter(e=>!n.has(e.id));if(0===r.length&&t.length===e.length)return e;let a=new Set(r.filter(e=>"user"===e.role).map(e=>e.content));return[...a.size>0?t.filter(e=>!("user"===e.role&&e.id.startsWith("user-")&&a.has(e.content))):t,...r]});else{let e=new Set,t=s.filter(t=>!e.has(t.id)&&(e.add(t.id),!0));o(t),ew.current=null,ey.current=[];for(let e=t.length-1;e>=0;e--){let s=t[e];if("assistant"===s.role&&s.model){K(s.model);break}}}if(t.status){let e="running"===t.status;d(e),eb.current=e,"idle"===t.status&&(ew.current=null,ey.current=[],o(e=>e.filter(e=>"streaming"!==e.id)),f(e=>(e.length>0&&console.log(`[question-debug] history:idle clearing ${e.length} pendingQuestions`,e.map(e=>e.requestId)),[])),z(null),X(e=>e.some(e=>"running"===e.status)?e.filter(e=>"running"!==e.status):e))}void 0!==t.hasMore&&er(t.hasMore),t.promptHistory&&es(t.promptHistory);let n=window.__sessionConnectTime;n&&console.log(`[session] history received for ${e.slice(0,8)} in ${(performance.now()-n).toFixed(0)}ms (${s.length} msgs, delta=${!!t.delta}, hasMore=${!!t.hasMore})`),_(!0),eC.current=e;break}case"history:more":{let e=t.messages;er(t.hasMore),el(!1),e.length>0&&o(t=>{let s=new Set(t.map(e=>e.id)),n=e.filter(e=>!s.has(e.id));return 0===n.length?t:[...n,...t]});break}case"session:transcript":{let e=t.messages;e.length>0&&(eN.current=e[e.length-1].id);for(let t=e.length-1;t>=0;t--)if("assistant"===e[t].role&&e[t].model){K(e[t].model);break}if(o(t=>(function(e,t){let s=new Set(t.filter(e=>"user"===e.role).map(e=>g(e.content))),n=new Set(t.filter(e=>"system"===e.role).map(e=>e.content)),r=new Map;for(let s of t){if("user"!==s.role||s.images?.length){r.set(s.id,s);continue}let t=g(s.content),n=e.find(e=>"user"===e.role&&(e.images?.length||e.documents?.length)&&g(e.content)===t);r.set(s.id,n?{...s,content:n.content,images:n.images,documents:n.documents,textFiles:n.textFiles}:s)}let a=new Set(t.map(e=>e.id)),l=new Map;for(let n of e){if(!n.id.startsWith("user-")||a.has(n.id))continue;let e=g(n.content);if(!s.has(e))continue;let r=t.find(t=>"user"===t.role&&g(t.content)===e&&!l.has(t.id));r&&l.set(n.id,r.id)}let o=[];for(let t=0;t<e.length;t++){let r=e[t];if("streaming"===r.id||a.has(r.id)||l.has(r.id))continue;let i="system"===r.role&&!n.has(r.content),c=r.id.startsWith("user-")&&!s.has(g(r.content));(i||c)&&o.push({msg:r,prevIdx:t})}let i=t.map(e=>r.get(e.id));for(let{msg:t,prevIdx:s}of o){let n=-1;for(let t=s-1;t>=0;t--){let s=e[t],r=l.get(s.id)||s.id,a=i.findIndex(e=>e.id===r);if(a>=0){n=a;break}}i.splice(n+1,0,t)}return i})(t,e)),"pty"!==C)break;let s=new Map;for(let t of e)for(let e of t.toolUses)if("Agent"===e.name)try{let t=JSON.parse(e.input||"{}"),n=t.subagent_type||"",r=t.description||"";n&&r&&s.set(n,r)}catch{}s.size>0&&X(e=>{let t=!1,n=e.map(e=>e.title&&s.has(e.title)&&(!e.description||e.description===e.title)?(t=!0,{...e,description:s.get(e.title)}):e);return t?n:e});break}case"session:streaming_snapshot":{ey.current=t.toolUses.filter(e=>"Agent"===e.name&&"running"===e.status),ew.current={content:t.content,toolUses:t.toolUses,blocks:t.blocks};let e={id:"streaming",role:"assistant",content:t.content,toolUses:t.toolUses,blocks:t.blocks,timestamp:Date.now()};o(s=>{let n=s.filter(e=>"streaming"!==e.id),r=n.findLastIndex(e=>"user"===e.role);return[...n.filter((e,s)=>e.id!==t.messageId||s<=r),e]});break}case"assistant:thinking":{if(ey.current.length>0)break;o(e=>e.filter(e=>"compact-progress"!==e.id)),ew.current||(ew.current={content:"",toolUses:[],blocks:[]});let e=ew.current.blocks,s=e[e.length-1];s&&"thinking"===s.type?(s.text+=t.text,t.tokens&&(s.tokens=(s.tokens??0)+t.tokens),t.redacted&&(s.redacted=!0),t.durationMs&&(s.durationMs=t.durationMs)):e.push({type:"thinking",text:t.text,tokens:t.tokens,redacted:t.redacted,durationMs:t.durationMs});let n=ew.current;o(e=>{let t={id:"streaming",role:"assistant",content:n.content,toolUses:n.toolUses,blocks:[...n.blocks],timestamp:Date.now()},s=e[e.length-1];return s?.id==="streaming"?[...e.slice(0,-1),t]:[...e,t]});break}case"assistant:text":{if(ey.current.length>0)break;o(e=>e.filter(e=>"compact-progress"!==e.id)),ew.current||(ew.current={content:"",toolUses:[],blocks:[]}),ew.current.content+=t.text;let e=ew.current.blocks,s=e[e.length-1];s&&"text"===s.type?s.text+=t.text:e.push({type:"text",text:t.text});let n=ew.current;o(e=>{let t=e[e.length-1],s={id:"streaming",role:"assistant",content:n.content,toolUses:n.toolUses,blocks:[...n.blocks],timestamp:Date.now()};return t?.id==="streaming"?[...e.slice(0,-1),s]:[...e,s]});break}case"assistant:tool_use":{o(e=>e.filter(e=>"compact-progress"!==e.id)),ew.current||(ew.current={content:"",toolUses:[],blocks:[]});let e=ew.current.toolUses.find(e=>e.id===t.toolId&&"running"===e.status);if(e)e.input=t.input,e.status="done";else{let e={id:t.toolId||t.name+"-"+Date.now(),name:t.name,input:t.input||"",output:"",status:t.input?"done":"running"},s="Agent"===e.name,n=ey.current,r=!1!==t.isMainThread;if(n.length>0&&!r){let t=n[n.length-1];t.children||(t.children=[]),t.children.push(e)}else ew.current.toolUses.push(e),ew.current.blocks.push({type:"tool_use",toolUse:e});s&&n.push(e)}let s=ew.current;o(e=>{let t={id:"streaming",role:"assistant",content:s.content,toolUses:[...s.toolUses],blocks:[...s.blocks],timestamp:Date.now()},n=e[e.length-1];return n?.id==="streaming"?[...e.slice(0,-1),t]:[...e,t]});break}case"assistant:tool_result":{if(!ew.current)break;let e=ey.current,s=e.findIndex(e=>e.id===t.toolId);if(-1!==s)e[s].output=t.output,t.filePath&&(e[s].filePath=t.filePath),e[s].status="done",e.splice(s,1);else if(e.length>0)for(let s of e){let e=s.children?.find(e=>e.id===t.toolId);if(e){e.output=t.output,t.filePath&&(e.filePath=t.filePath),e.status="done";break}}else{let e=ew.current.toolUses.find(e=>e.id===t.toolId);e&&(e.output=t.output,t.filePath&&(e.filePath=t.filePath),e.status="done")}let n=ew.current;o(e=>{let t={id:"streaming",role:"assistant",content:n.content,toolUses:[...n.toolUses],blocks:[...n.blocks],timestamp:Date.now()},s=e[e.length-1];return s?.id==="streaming"?[...e.slice(0,-1),t]:[...e,t]});break}case"assistant:message_done":{let e=ew.current?.toolUses||[],s=ew.current?.blocks||[];ew.current=null,ey.current=[],t.message.model&&K(t.message.model),o(n=>{let r={...t.message};e.length>r.toolUses.length&&(r.toolUses=e),s.length>(r.blocks?.length??0)&&(r.blocks=s),eN.current=r.id;let a=n.findIndex(e=>"streaming"===e.id),l=n.filter(e=>"streaming"!==e.id);if(l.some(e=>e.id===r.id))return l;if(a>=0){let e=[...l];return e.splice(a,0,r),e}return[...l,r]});break}case"assistant:tool_progress":{if(!ew.current)break;let e=ey.current,s=e.find(e=>e.id===t.toolId);if(s)s.output+=t.content;else if(e.length>0){let s=!1;for(let n of e){let e=n.children?.find(e=>e.id===t.toolId);if(e){e.output+=t.content,s=!0;break}}if(!s){let e=ew.current.toolUses.find(e=>e.id===t.toolId);e&&(e.output+=t.content)}}else{let e=ew.current.toolUses.find(e=>e.id===t.toolId);e&&(e.output+=t.content)}let n=ew.current;o(e=>{let t={id:"streaming",role:"assistant",content:n.content,toolUses:[...n.toolUses],blocks:[...n.blocks],timestamp:Date.now()},s=e[e.length-1];return s?.id==="streaming"?[...e.slice(0,-1),t]:[...e,t]});break}case"session:rate_limit":"rate_limited"===t.status?z(t.status):z(null);break;case"session:suggestions":O(t.suggestions);break;case"session:init":H(t.data),t.data?.model&&K(t.data.model);break;case"session:todos":Y(t.todos);break;case"session:task_update":X(e=>e.find(e=>e.taskId===t.task.taskId)?e.map(e=>e.taskId===t.task.taskId?{...e,status:t.task.status,title:e.title||t.task.title,description:t.task.description||e.description,activity:t.task.activity||e.activity,summary:t.task.summary||e.summary}:e):[...e,t.task]),"completed"===t.task.status&&setTimeout(()=>{X(e=>e.filter(e=>e.taskId!==t.task.taskId))},5e3);break;case"assistant:tool_children":o(e=>e.map(e=>{if(e.id!==t.messageId)return e;let s=e.toolUses.map(e=>e.id===t.toolId?{...e,children:t.children}:e),n=e.blocks.map(e=>"tool_use"===e.type&&e.toolUse.id===t.toolId?{...e,toolUse:{...e.toolUse,children:t.children}}:e);return{...e,toolUses:s,blocks:n}}));break;case"session:status":{let e="running"===t.status;d(e),eb.current=e,e&&(F(null),ef(!1),clearTimeout(eg.current)),"idle"===t.status&&(ew.current=null,ey.current=[],o(e=>e.filter(e=>"streaming"!==e.id)),f(e=>(e.length>0&&console.log(`[question-debug] status:idle clearing ${e.length} pendingQuestions`,e.map(e=>e.requestId)),[])),z(null),X(e=>0===e.filter(e=>"running"===e.status).length?e:e.filter(e=>"running"!==e.status)));break}case"session:error":{console.error("Session error:",t.error),ew.current=null,ey.current=[];let e=t.error||"Unknown error",s=e.match(/"message"\s*:\s*"([^"]+)"/);F(s?s[1]:e.slice(0,200)),(/\(HTTP 529\)/.test(e)||/API Error: 529\b/.test(e))&&(ef(!0),clearTimeout(eg.current),eg.current=setTimeout(()=>ef(!1),15e3));break}case"session:queued":if(ei(t.count>0),t.messages&&ed(t.messages),void 0!==t.paused&&em(t.paused),t.cancelledText){eh(t.cancelledText);let e=ek.current,s=e.findIndex(e=>e.text===t.cancelledText);-1!==s&&e.splice(s,1)}if(t.editText&&eh(t.editText),t.sentText){let{message:e,matchedIndex:s}=function(e,t,s,n){let r,{cleaned:a,textFiles:l}=(r=[],{cleaned:e.replace(m,(e,t,s)=>(r.push({name:t,content:s}),"")).replace(/\n{3,}/g,"\n\n").trim(),textFiles:r}),o=t.findIndex(t=>t.apiText===e),i=-1!==o?t[o]:null;return{matchedIndex:o,message:{id:s,role:"user",content:a,toolUses:[],blocks:[],timestamp:n,images:i?.images,documents:i?.documents,textFiles:i?.textFiles??(l.length>0?l:void 0)}}}(t.sentText,ek.current,"user-queued-"+Date.now(),Date.now());-1!==s&&ek.current.splice(s,1),o(t=>[...t,e])}break;case"session:clear":o(e=>[...e,{id:"clear-"+Date.now(),role:"system",content:"__context_reset__",toolUses:[],blocks:[],timestamp:Date.now()}]),eN.current=null,ew.current=null,ey.current=[],X([]),Y([]),ei(!1),ed([]),em(!1),h([]),f([]);break;case"session:system":{let e="__model_picker::";if(t.text.startsWith(e)){let s=t.text.slice(e.length);v(s),y(s);break}let s="__model::";if(t.text.startsWith(s)){y(t.text.slice(s.length));break}let n="__bypass_state::";if(t.text.startsWith(n)){$("on"===t.text.slice(n.length));break}let r="__plan_state::";if(t.text.startsWith(r)){I("on"===t.text.slice(r.length));break}let a="__thinking_level::";if(t.text.startsWith(a)){R(t.text.slice(a.length));break}let l="__runtime::";if(t.text.startsWith(l)){S(t.text.slice(l.length));break}if("__compact_boundary__"===t.text){o(e=>{let t="compact-done-"+Date.now();return e.some(e=>"compact-progress"===e.id)?e.map(e=>"compact-progress"===e.id?{...e,id:t,content:"__compacted__"}:e):[...e,{id:t,role:"system",content:"__compacted__",toolUses:[],blocks:[],timestamp:Date.now()}]});break}let i="__compact::";if(t.text.startsWith(i)){let e=t.text.slice(i.length);"start"===e?o(e=>e.some(e=>"compact-progress"===e.id)?e:[...e,{id:"compact-progress",role:"system",content:"__compacting__",toolUses:[],blocks:[],timestamp:Date.now()}]):"done"===e&&o(e=>e.map(e=>"compact-progress"===e.id?{...e,id:"compact-done-"+Date.now(),content:"__compacted__"}:e));break}if(t.text.startsWith("__"))break;let c={id:"system-"+Date.now(),role:"system",content:t.text,toolUses:[],blocks:[],timestamp:Date.now()};o(e=>[...e,c]);break}case"session:info_updated":B(t.info.name),t.info.model&&y(t.info.model),t.info.contextSize&&k(t.info.contextSize),t.info.runtime&&S(t.info.runtime);break;case"session:usage":M(t.usage);break;case"permission:request":h(e=>[...e,{requestId:t.requestId,toolName:t.toolName,input:t.input,suggestions:t.suggestions,planFilePath:t.planFilePath,planContent:t.planContent,configProposal:t.configProposal}]);break;case"question:request":console.log("[question-debug] question:request received",t.requestId),console.trace("[question-debug] question:request stack"),f(e=>(console.log(`[question-debug] question:request adding to ${e.length} existing`,[...e.map(e=>e.requestId),t.requestId]),[...e,{requestId:t.requestId,questions:t.questions}]))}}),[e,r,C]);let eS=(0,c.useCallback)(()=>{if(ea||!en)return;let t=ej.current[0];t&&(el(!0),n({type:"history:request_more",sessionId:e,beforeMessageId:t.id}))},[ea,en,e,n]),eA=(0,c.useRef)(0),e$=(0,c.useCallback)(async()=>{try{let s=new URLSearchParams;t&&s.set("cwd",t);let n=await fetch(`/api/sessions/${e}?${s}`);if(!n.ok)return void console.warn(`[fallback] HTTP check failed (${n.status})`);let r=await n.json();if("idle"===r.session.status){console.log("[fallback] session is idle, recovering");let e=new Set,t=r.messages.filter(t=>!e.has(t.id)&&(e.add(t.id),!0));o(t),t.length>0&&(eN.current=t[t.length-1].id);for(let e=t.length-1;e>=0;e--){let s=t[e];if("assistant"===s.role&&s.model){K(s.model);break}}d(!1),eb.current=!1,ew.current=null,ey.current=[]}}catch{}},[e,t]);(0,c.useEffect)(()=>{if(!i){eA.current=0;return}eA.current=Date.now();let t=r(t=>{"sessionId"in t&&t.sessionId===e&&("assistant:text"===t.type||"assistant:thinking"===t.type||"assistant:tool_use"===t.type||"assistant:tool_result"===t.type||"session:status"===t.type)&&(eA.current=Date.now())}),s=setInterval(async()=>{Date.now()-eA.current<1e4||(console.log("[fallback] no events for 10s, checking session via HTTP"),await e$())},5e3),n=()=>{"visible"===document.visibilityState&&eb.current&&(console.log("[fallback] page visible while responding, checking session"),e$())};return document.addEventListener("visibilitychange",n),()=>{t(),clearInterval(s),document.removeEventListener("visibilitychange",n)}},[i,e,r,e$]);let eE=(0,c.useCallback)((r,a,l,i)=>{let c=r;if(i?.length&&(c=i.map(e=>`<file path="${e.name}">
21
+ ${e.content}
22
+ </file>`).join("\n\n")+(r?"\n\n"+r:"")),eb.current&&/^\/btw\s/i.test(r.trim())){let e=r.trim().replace(/^\/btw\s+/i,"");if(!e)return;ee({question:e,answer:null,loading:!0,error:null}),fetch("/api/btw",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({question:e,context:ej.current.filter(e=>"user"===e.role||"assistant"===e.role).slice(-20).map(e=>({role:e.role,content:e.content.slice(0,2e3)})),model:ev.current,cwd:t})}).then(e=>e.json()).then(e=>{e.error?ee(t=>t?{...t,loading:!1,error:e.error}:null):ee(t=>t?{...t,loading:!1,answer:e.answer}:null)}).catch(e=>{ee(t=>t?{...t,loading:!1,error:e.message}:null)});return}if(eb.current){ek.current.push({text:r,apiText:c,images:a,documents:l,textFiles:i}),n({type:"message:send",sessionId:e,text:c,images:a?.length?a:void 0,documents:l?.length?l:void 0});return}eu&&(ek.current=[],ed([]),em(!1),ei(!1));let d={id:"user-"+Date.now(),role:"user",content:r,toolUses:[],blocks:[],timestamp:Date.now(),images:a?.length?a:void 0,documents:l?.length?l:void 0,textFiles:i?.length?i:void 0};o(e=>[...e,d]),O([]);let u=r.replace(/^\[Attached [^\]]+\]\n*/gm,"").trim();u&&!u.startsWith("/")&&es(e=>e[0]===u?e:[u,...e.filter(e=>e!==u)]),n({type:"message:send",sessionId:e,text:c,images:a?.length?a:void 0,documents:l?.length?l:void 0,cwd:t||void 0,historyView:s||void 0})},[n,e,eu,t,s]),eI=(0,c.useCallback)(()=>{n({type:"session:interrupt",sessionId:e})},[n,e]),eT=(0,c.useCallback)((t,s,r,a)=>{n({type:"permission:response",sessionId:e,requestId:t,allowed:s,permissionMode:r,suggestionIndex:a}),h(e=>e.filter(e=>e.requestId!==t))},[n,e]),eR=(0,c.useCallback)((t,s)=>{console.log("[question-debug] respondToQuestion",t),n({type:"question:response",sessionId:e,requestId:t,answers:s}),f(e=>(console.log("[question-debug] marking answered, current pending:",e.map(e=>({id:e.requestId,answered:e.answered}))),e.map(e=>e.requestId===t?{...e,answered:!0}:e)))},[n,e]),[eD,e_]=(0,c.useState)(null),eP=(0,c.useCallback)((t,s)=>{v(null),y(t),void 0!==s&&k(s),n({type:"session:set_model",sessionId:e,model:t,contextSize:s})},[n,e]),eM=(0,c.useCallback)(async(t,s)=>{let n=t.replace(/\[.*\]$/,"");if(!(n.startsWith("claude")||null!==(0,u.AX)(n)))return void eP(t,s);try{let n=await fetch(`/api/sessions/thinking?sessionId=${encodeURIComponent(e)}`),r=await n.json();if(r.hasNonAnthropicThinking){v(null),e_({pending:!0,targetModel:t,models:r.models,contextSize:s});return}}catch{}eP(t,s)},[e,eP]),eq=(0,c.useCallback)((e,t)=>{eM(e,t)},[eM]),ez=(0,c.useCallback)(async()=>{if(!eD)return;let{targetModel:t,contextSize:s}=eD;await fetch("/api/sessions/thinking",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e})}),e_(null),eP(t,s)},[eD,e,eP]),eU=(0,c.useCallback)(()=>{e_(null)},[]),eF=(0,c.useCallback)((t,s)=>{"main"===t&&y(s),n({type:"session:set_model_slot",sessionId:e,slot:t,modelId:s})},[n,e]),eL=(0,c.useCallback)(t=>{$(t),n({type:"permission:set_bypass",sessionId:e,enabled:t})},[n,e]),eO=(0,c.useCallback)(t=>{I(t),n({type:"session:set_plan_mode",sessionId:e,enabled:t})},[n,e]),eW=(0,c.useCallback)(t=>{R(t),o(e=>[...e,{id:"thinking-"+Date.now(),role:"system",content:`Thinking: ${t}`,toolUses:[],blocks:[],timestamp:Date.now()}]),n({type:"session:set_thinking",sessionId:e,level:t})},[n,e]),eB=(0,c.useCallback)(()=>{n({type:"message:cancel_queued",sessionId:e})},[n,e]),eJ=(0,c.useCallback)(t=>{n({type:"message:delete_queued",sessionId:e,messageId:t})},[n,e]),eH=(0,c.useCallback)(t=>{n({type:"message:edit_queued",sessionId:e,messageId:t})},[n,e]),eG=(0,c.useCallback)(()=>{n({type:"message:resume_queue",sessionId:e})},[n,e]),eK=(0,c.useCallback)(()=>{eh(null)},[]),eQ=(0,c.useCallback)(()=>{if(Z?.answer){let e=Date.now();o(t=>[...t,{id:`btw-q-${e}`,role:"user",content:`[side question] ${Z.question}`,toolUses:[],blocks:[],timestamp:e},{id:`btw-a-${e}`,role:"assistant",content:Z.answer,toolUses:[],blocks:[],timestamp:e+1}])}ee(null)},[Z]),eX=(0,c.useCallback)(()=>{F(null),n({type:"message:send",sessionId:e,text:"Continue from where you left off."})},[n,e]);return{messages:l,historyLoaded:D,isResponding:i,errorActive:ep,pendingPermissions:x,pendingQuestions:p,modelPicker:j,currentModel:w,currentContextSize:N,bypassActive:A,planMode:E,thinkingLevel:T,contextUsage:P,rateLimitStatus:q,apiError:U,suggestions:L,sessionName:W,initData:J,activeModelId:G,hasQueuedMessage:eo,queuedMessages:ec,queuePaused:eu,backgroundTasks:Q,todos:V,btw:Z,promptHistory:et,hasMoreHistory:en,loadingMore:ea,requestMoreHistory:eS,sendMessage:eE,interrupt:eI,respondToPermission:eT,respondToQuestion:eR,setModel:eq,setModelSlot:eF,setBypassAll:eL,setPlanMode:eO,setThinkingLevel:eW,cancelQueuedMessage:eB,deleteQueuedMessage:eJ,editQueuedMessage:eH,resumeQueue:eG,restoredText:ex,clearRestoredText:eK,dismissBtw:eQ,retry:eX,currentRuntime:C,setRuntime:(0,c.useCallback)(t=>{S(t),n({type:"session:set_runtime",sessionId:e,runtime:t})},[n,e]),restartSession:(0,c.useCallback)(()=>{n({type:"session:restart",sessionId:e})},[n,e]),thinkingCheck:eD,confirmThinkingStrip:ez,cancelThinkingCheck:eU}}(e,t,h),{settings:ey}=(0,j.t)(),eN=(0,i.useRouter)(),{setHeader:ek,setBackgroundTasks:eC,setTodos:eS,setInitData:eI,setRuntime:eT}=(0,y.E2)(),eD=(0,c.useRef)(null),e_=(0,c.useRef)(!0),[eP,eM]=(0,c.useState)(!1),eq=(0,c.useRef)(0),[eU,eF]=(0,c.useState)(50),eW=(0,c.useRef)(0),eJ=(0,c.useRef)(0),{selectedIds:eQ,selectionMode:eX,enterSelection:eV,toggleSelect:eY,clearSelection:eZ,copySelected:e0}=function(){let[e,t]=(0,c.useState)(new Set),s=e.size>0,n=(0,c.useCallback)(e=>{t(new Set([e]))},[]),r=(0,c.useCallback)(e=>{t(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]),a=(0,c.useCallback)(()=>{t(new Set)},[]),l=(0,c.useCallback)(async s=>{let n=s.filter(t=>e.has(t.id)&&"system"!==t.role).map(d).filter(Boolean).join("\n\n---\n\n");if(n)if(navigator.clipboard?.writeText)await navigator.clipboard.writeText(n);else{let e=document.createElement("textarea");e.value=n,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)}t(new Set)},[e]);return{selectedIds:e,selectionMode:s,enterSelection:n,toggleSelect:r,clearSelection:a,copySelected:l}}(),e1=(0,c.useRef)(new Set),[e5,e2]=(0,c.useState)(!1),[e3,e4]=(0,c.useState)([]);(0,c.useEffect)(()=>{e2(matchMedia("(pointer: coarse)").matches)},[]),(0,c.useEffect)(()=>{fetch("/api/providers").then(e=>e.json()).then(e=>{Array.isArray(e)&&e4(e)}).catch(()=>{})},[]);let e8=(0,c.useMemo)(()=>{let e=new Set;return C.filter(t=>!e.has(t.id)&&(e.add(t.id),!0))},[C]),e6=Math.max(0,e8.length-eU),e9=(0,c.useMemo)(()=>e8.slice(e6),[e8,e6]),e7=e6>0;(0,c.useEffect)(()=>{eF(50)},[]);let{send:te}=(0,b.h)(),tt=(0,c.useCallback)(t=>{te({type:"message:send",sessionId:e,text:`/rename ${t}`})},[te,e]);(0,c.useEffect)(()=>{ek({title:L||s||(t?(0,v.uk)(t):"")||"Session",onRename:tt})},[L,s,t,ek,tt]),(0,c.useEffect)(()=>{eC(G)},[G,eC]),(0,c.useEffect)(()=>{eS(K)},[K,eS]),(0,c.useEffect)(()=>{eI(O)},[O,eI]),(0,c.useEffect)(()=>{eT(ef)},[ef,eT]),(0,c.useLayoutEffect)(()=>{let e=eD.current;if(!e||0===eJ.current)return;let t=e.scrollHeight-eJ.current;t>0&&(e.scrollTop+=t,eq.current=Date.now()+150),eJ.current=0},[]);let ts=(0,c.useCallback)(()=>{if(Date.now()<eq.current)return;let e=eD.current;if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight;e_.current=t<80,eM(t>300),e.scrollTop<800&&Date.now()>eW.current&&(eW.current=Date.now()+100,e7?(eJ.current=e.scrollHeight,eF(e=>e+30)):V&&!Y&&(eJ.current=e.scrollHeight,Z()))},[e7,V,Y,Z]),tn=(0,c.useCallback)(()=>{let e=eD.current;e&&(e.scrollTop=e.scrollHeight),eq.current=Date.now()+150,eM(!1)},[]);(0,c.useEffect)(()=>{e_.current&&tn()},[C,$,T,I,tn]),(0,c.useEffect)(()=>{if(!S)return;let e="cockpit:scrollPos:"+window.location.pathname,t=sessionStorage.getItem(e);if(!t)return;sessionStorage.removeItem(e);let s=Number(t),n=eD.current;n&&s>0&&(e_.current=!1,requestAnimationFrame(()=>{n.scrollTop=s}))},[S]),(0,c.useEffect)(()=>{let e=window.visualViewport;if(!e)return;let t=()=>{e_.current&&tn()};return e.addEventListener("resize",t),()=>e.removeEventListener("resize",t)},[tn]),(0,c.useEffect)(()=>{if(e5)return;let e=eD.current,t=()=>{document.activeElement?.closest("textarea, input, [contenteditable]")||document.activeElement!==e&&(e?.focus({preventScroll:!0}),e_.current&&tn())},s=()=>{"visible"===document.visibilityState&&e_.current&&tn()};return e?.addEventListener("pointermove",t),window.addEventListener("focus",t),document.addEventListener("visibilitychange",s),()=>{e?.removeEventListener("pointermove",t),window.removeEventListener("focus",t),document.removeEventListener("visibilitychange",s)}},[e5,tn]),(0,c.useEffect)(()=>{let e=e=>{if("Escape"!==e.key||!($||E)||document.querySelector(".fixed.inset-0.z-50"))return;let t=e.target?.tagName;"TEXTAREA"!==t&&"INPUT"!==t&&(e.preventDefault(),et())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[$,E,et]);let tr=(0,c.useRef)(!1),ta=(0,c.useCallback)((e,t,s,n)=>{e_.current=!0,x&&!tr.current&&0===C.length?(tr.current=!0,ee(`${e}
23
+
24
+ ---
25
+ ${x}`,t,s,n)):ee(e,t,s,n)},[ee,x,C.length]);(0,c.useEffect)(()=>{p&&p(e=>ta(e))},[p,ta]);let tl=(0,c.useCallback)(()=>{ee("/compact")},[ee]),to=(0,c.useCallback)(()=>{e0(e8)},[e0,e8]),ti=(0,c.useCallback)(async()=>{if(!t)return;ew();let e=ej?.targetModel;try{let s=await fetch("/api/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:t,runtime:ef,model:e})});if(s.ok){let e=await s.json();eN.push(`/sessions/${e.sessionId}?cwd=${encodeURIComponent(t)}`)}}catch{}},[t,ef,ej?.targetModel,ew,eN]);return(0,n.jsxs)("div",{className:(0,w.cn)("flex flex-col flex-1 min-h-0",f),children:[(0,n.jsx)("div",{ref:eD,"data-chat-scroll":!0,tabIndex:e5?void 0:-1,className:"flex-1 min-h-0 overflow-y-auto p-4 outline-none",onScroll:ts,children:(0,n.jsxs)("div",{className:"mx-auto max-w-3xl lg:max-w-4xl xl:max-w-5xl 2xl:max-w-6xl space-y-4",children:[0===e8.length&&(0,n.jsx)("div",{className:"flex flex-col items-center pt-20 text-sm text-muted-foreground",children:S?(0,n.jsx)("p",{children:"Send a message to start the conversation."}):(0,n.jsx)(r.A,{className:"h-5 w-5 animate-spin"})}),(e7||Y)&&(0,n.jsx)("div",{className:"flex justify-center py-2",children:(0,n.jsx)(r.A,{className:"h-4 w-4 animate-spin text-muted-foreground"})}),e9.map((e,t)=>{let s=t>0&&"__compacted__"===e9[t-1].content;if("assistant"===e.role){let{before:t,questionBlock:r,after:a}=function(e){let t=e.findIndex(e=>"tool_use"===e.type&&"AskUserQuestion"===e.toolUse.name);if(t<0)return{before:e,questionBlock:null,after:[]};let s=e[t];return{before:e.slice(0,t),questionBlock:s,after:e.slice(t+1).filter(e=>"tool_use"!==e.type||"AskUserQuestion"!==e.toolUse.name)}}(e.blocks||[]);if(r){let l=T.find(e=>!e.answered),o=!!r.toolUse.output;return console.log(`[question-debug] Place1 render: msgId=${e.id.slice(0,8)}, hasOutput=${o}, pending=${!!l}, pendingCount=${T.length}`),(0,n.jsxs)("div",{"data-message-id":e.id,className:"space-y-4",children:[t.length>0&&(0,n.jsx)(e$.s,{message:{...e,blocks:t,content:""},collapsedByDefault:s,expandedToolIds:e1,selectionMode:eX,selected:eQ.has(e.id),onEnterSelection:eV,onToggleSelect:eY}),(0,n.jsx)("div",{className:"flex w-full justify-start",children:(0,n.jsx)("div",{className:"max-w-[85%]",children:o?(0,n.jsx)(eO,{tool:r.toolUse}):l?(0,n.jsx)(eB,{questions:eL(l.questions),onSubmit:en,requestId:l.requestId}):null})}),a.length>0&&(0,n.jsx)(e$.s,{message:{...e,blocks:a,content:""},collapsedByDefault:!1,expandedToolIds:e1,selectionMode:eX,selected:eQ.has(e.id),onEnterSelection:eV,onToggleSelect:eY})]},e.id)}}return(0,n.jsx)("div",{"data-message-id":e.id,className:"space-y-4",children:(0,n.jsx)(e$.s,{message:e,collapsedByDefault:s,expandedToolIds:e1,selectionMode:eX,selected:eQ.has(e.id),onEnterSelection:eV,onToggleSelect:eY})},e.id)}),($||E)&&0===I.length&&!T.some(e=>!e.answered)&&(0,n.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,n.jsx)(r.A,{className:"h-4 w-4 animate-spin"}),E&&!$&&(0,n.jsx)("span",{className:"text-xs text-red-500",children:"API error, retrying..."}),U&&(0,n.jsx)("span",{className:"text-xs",children:"Rate limited, retrying..."})]}),F&&!$&&!E&&(0,n.jsx)("div",{className:"flex w-full justify-start",children:(0,n.jsxs)("div",{className:"max-w-[85%] rounded-lg border border-red-500/30 bg-red-500/5 px-4 py-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 text-red-500 mb-1",children:[(0,n.jsx)(a.A,{className:"h-4 w-4 shrink-0"}),(0,n.jsx)("span",{className:"text-sm font-medium",children:"API Error"})]}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground mb-3",children:F}),(0,n.jsxs)("button",{onClick:ep,className:"flex items-center gap-1.5 rounded-md border px-3 py-1.5 text-xs hover:bg-muted transition-colors",children:[(0,n.jsx)(l.A,{className:"h-3 w-3"}),"Retry"]})]})}),I.map(e=>"ExitPlanMode"===e.toolName?(0,n.jsx)(ez,{permission:e,bypassActive:P,onRespond:es,onSendMessage:ee,onSetBypass:ea,onSetPlanMode:el},e.requestId):e.configProposal?(0,n.jsx)(A,{permission:e,onRespond:es},e.requestId):(0,n.jsx)(eR,{permission:e,onRespond:es},e.requestId)),T.some(e=>!e.answered)&&!e9.some(e=>"assistant"===e.role&&(e.blocks||[]).some(e=>"tool_use"===e.type&&"AskUserQuestion"===e.toolUse.name&&!e.toolUse.output))&&T.filter(e=>!e.answered).map(e=>(0,n.jsx)("div",{className:"flex w-full justify-start",children:(0,n.jsx)("div",{className:"max-w-[85%]",children:(0,n.jsx)(eB,{questions:eL(e.questions),onSubmit:en,requestId:e.requestId})})},e.requestId)),null!==R&&(0,n.jsx)(eE,{currentModel:R,currentContextSize:_,activeModelId:W,onSelect:(e,t)=>er(e,t),providers:e3}),(0,n.jsx)(eG,{open:null!==ej,models:ej?.models??[],onStrip:ev,onNewSession:ti,onCancel:ew}),(0,n.jsx)("div",{})]})}),eX&&(0,n.jsx)(eH,{count:eQ.size,onCopy:to,onCancel:eZ}),eP&&(0,n.jsx)("div",{className:"relative z-10 flex justify-center pointer-events-none",style:{marginTop:-52},children:(0,n.jsx)("button",{onClick:()=>{tn(),e_.current=!0,eM(!1)},className:"pointer-events-auto rounded-full border bg-background/90 backdrop-blur p-3 shadow-md text-muted-foreground hover:text-foreground transition-colors",children:(0,n.jsx)(o.A,{className:"h-5 w-5"})})}),(0,n.jsx)("div",{className:"shrink-0",children:(0,n.jsx)(eA,{sessionId:e,promptHistory:X,onSend:ta,onInterrupt:et,isResponding:$||E,bypassActive:P,onSetBypass:ea,planMode:M,onSetPlanMode:el,showPlanToggle:N,isCockpitAgent:k,thinkingLevel:q,onSetThinking:eo,currentModel:D,currentContextSize:_,onSetModel:er,contextUsage:z,dismissKeyboard:ey.dismissKeyboardOnSend,cwd:t,onCompact:tl,initData:O,hasQueuedMessage:B,queuedMessages:J,queuePaused:H,onCancelQueued:ei,onDeleteQueued:ec,onEditQueued:ed,onResumeQueue:eu,restoredText:em,onClearRestoredText:ex,btw:Q,onDismissBtw:eh,currentRuntime:ef,onSetRuntime:eg,onRestart:eb,providers:e3})})]})}},60529:(e,t,s)=>{s.d(t,{p:()=>l});var n=s(95155),r=s(12115),a=s(40980);let l=r.forwardRef(({className:e,type:t,...s},r)=>(0,n.jsx)("input",{type:t,className:(0,a.cn)("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...s}));l.displayName="Input"},64233:(e,t,s)=>{s.d(t,{Y:()=>p});var n=s(95155),r=s(57966),a=s(98076),l=s(44605),o=s(64577),i=s(99314),c=s(12115);function d(e){let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();try{return document.execCommand("copy")}finally{document.body.removeChild(t)}}var u=s(40980);function m(e){return(0,n.jsx)("a",{...e,target:"_blank",rel:"noopener noreferrer"})}let x={pre:function(e){let[t,s]=(0,c.useState)(!1),r=(0,c.useRef)(null),a=(0,c.useCallback)(()=>{let e=r.current?.textContent??"",t=()=>{s(!0),setTimeout(()=>s(!1),1500)};navigator.clipboard?.writeText?navigator.clipboard.writeText(e).then(t).catch(()=>{d(e)&&t()}):d(e)&&t()},[]);return(0,n.jsxs)("div",{className:"group/code relative",children:[(0,n.jsx)("pre",{ref:r,...e}),(0,n.jsx)("button",{onClick:a,className:"absolute top-2 right-2 p-1.5 rounded bg-background/80 border border-border text-muted-foreground hover:text-foreground opacity-60 sm:opacity-0 sm:group-hover/code:opacity-100 transition-opacity",title:"Copy code",children:t?(0,n.jsx)(o.A,{className:"h-3.5 w-3.5 text-green-500"}):(0,n.jsx)(i.A,{className:"h-3.5 w-3.5"})})]})},a:m},h={a:m};function p({content:e,variant:t="full",className:s}){return"lite"===t?(0,n.jsx)("div",{className:(0,u.cn)("prose prose-sm max-w-none dark:prose-invert",s),children:(0,n.jsx)(r.oz,{remarkPlugins:[l.A],components:h,children:e})}):(0,n.jsx)("div",{className:(0,u.cn)("message-prose prose prose-sm max-w-none dark:prose-invert",s),children:(0,n.jsx)(r.oz,{remarkPlugins:[l.A],rehypePlugins:[a.A],components:x,children:e})})}},67032:(e,t,s)=>{s.d(t,{Jm:()=>a,Os:()=>r,wA:()=>l});var n=s(12115);function r(){let[e,t]=(0,n.useState)([]),[s,r]=(0,n.useState)(!0),a=(0,n.useCallback)(()=>{r(!0),fetch("/api/jobs").then(e=>e.json()).then(e=>t(e.jobs)).catch(()=>t([])).finally(()=>r(!1))},[]);(0,n.useEffect)(()=>{a()},[a]);let l=(0,n.useCallback)(async e=>{try{if((await fetch(`/api/jobs/${e}`,{method:"DELETE"})).ok)return a(),!0;return!1}catch{return!1}},[a]),o=(0,n.useCallback)(async e=>{try{return(await fetch(`/api/jobs/${e}/trigger`,{method:"POST"})).ok}catch{return!1}},[]),i=(0,n.useCallback)(async e=>{try{if((await fetch(`/api/jobs/${e}/stop`,{method:"POST"})).ok)return a(),!0;return!1}catch{return!1}},[a]);return{jobs:e,loading:s,refresh:a,deleteJob:l,triggerJob:o,stopJob:i}}function a(e){let[t,s]=(0,n.useState)([]),[r,a]=(0,n.useState)(!0),[l,o]=(0,n.useState)(!1),[i,c]=(0,n.useState)(!1),d=(0,n.useCallback)(()=>{if(!e){s([]),a(!1),c(!1);return}a(!0),fetch(`/api/jobs/${e}/runs?limit=25`).then(e=>e.json()).then(e=>{s(e.runs),c(e.hasMore??!1)}).catch(()=>s([])).finally(()=>a(!1))},[e]),u=(0,n.useCallback)(()=>{e&&!l&&i&&(o(!0),fetch(`/api/jobs/${e}/runs?limit=25&offset=${t.length}`).then(e=>e.json()).then(e=>{s(t=>[...t,...e.runs]),c(e.hasMore??!1)}).catch(()=>{}).finally(()=>o(!1)))},[e,l,i,t.length]);return(0,n.useEffect)(()=>{d()},[d]),{runs:t,loading:r,loadingMore:l,hasMore:i,refresh:d,loadMore:u}}function l(){let[e,t]=(0,n.useState)(0),s=(0,n.useRef)(void 0);return(0,n.useEffect)(()=>{let e=()=>{fetch("/api/jobs/status").then(e=>e.json()).then(e=>t(e.count)).catch(()=>{})};return e(),s.current=setInterval(e,6e4),()=>clearInterval(s.current)},[]),{count:e}}},81477:(e,t,s)=>{s.d(t,{BT:()=>c,Wu:()=>d,ZB:()=>i,Zp:()=>l,aR:()=>o});var n=s(95155),r=s(12115),a=s(40980);let l=r.forwardRef(({className:e,...t},s)=>(0,n.jsx)("div",{ref:s,className:(0,a.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));l.displayName="Card";let o=r.forwardRef(({className:e,...t},s)=>(0,n.jsx)("div",{ref:s,className:(0,a.cn)("flex flex-col space-y-1.5 p-6",e),...t}));o.displayName="CardHeader";let i=r.forwardRef(({className:e,...t},s)=>(0,n.jsx)("div",{ref:s,className:(0,a.cn)("text-2xl font-semibold leading-none tracking-tight",e),...t}));i.displayName="CardTitle";let c=r.forwardRef(({className:e,...t},s)=>(0,n.jsx)("div",{ref:s,className:(0,a.cn)("text-sm text-muted-foreground",e),...t}));c.displayName="CardDescription";let d=r.forwardRef(({className:e,...t},s)=>(0,n.jsx)("div",{ref:s,className:(0,a.cn)("p-6 pt-0",e),...t}));d.displayName="CardContent"},89239:(e,t,s)=>{s.d(t,{$:()=>c});var n=s(95155),r=s(54850),a=s(18460),l=s(12115),o=s(40980);let i=(0,a.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),c=l.forwardRef(({className:e,variant:t,size:s,asChild:a=!1,...l},c)=>{let d=a?r.DX:"button";return(0,n.jsx)(d,{className:(0,o.cn)(i({variant:t,size:s,className:e})),ref:c,...l})});c.displayName="Button"},89323:(e,t,s)=>{s.d(t,{f:()=>l,h:()=>o});var n=s(95155),r=s(12115);let a=(0,r.createContext)(null);function l({children:e}){let[t,s]=(0,r.useState)(!1),o=(0,r.useRef)(null),i=(0,r.useRef)(new Set),c=(0,r.useRef)(void 0),d=(0,r.useRef)(500),u=(0,r.useRef)([]),m=(0,r.useRef)(!1),x=(0,r.useRef)(!0),h=(0,r.useRef)(void 0),p=(0,r.useRef)(null),f=(0,r.useRef)(void 0),g=(0,r.useRef)(!1),b=(0,r.useRef)(void 0),j=(0,r.useCallback)(()=>{if(!x.current)return;clearTimeout(c.current);let e="visible"===document.visibilityState?5e3:3e4,t=Math.min(d.current,e);console.log(`[ws] reconnect scheduled in ${t}ms`),c.current=setTimeout(()=>{d.current=Math.min(2*d.current,3e4),h.current?.()},t)},[]),v=(0,r.useCallback)(async()=>{if(m.current||o.current)return void console.log(`[ws] connect skipped (connecting=${m.current}, hasWs=${!!o.current})`);m.current=!0;let e=performance.now();console.log("[ws] connecting...");let t=p.current;if(t)console.log("[ws] using cached token");else try{let s=await fetch("/api/auth/ws-token");if(!s.ok){console.warn(`[ws] ws-token fetch failed (${s.status})`),m.current=!1,j();return}t=(await s.json()).token,console.log(`[ws] token fetched in ${(performance.now()-e).toFixed(0)}ms`)}catch(e){console.warn("[ws] ws-token fetch error:",e),m.current=!1,j();return}if(o.current||!x.current){console.log(`[ws] connect aborted (hasWs=${!!o.current}, mounted=${x.current})`),m.current=!1;return}let n="https:"===window.location.protocol?"wss:":"ws:",r=new WebSocket(`${n}//${window.location.host}/ws?token=${t}`);o.current=r,m.current=!1,r.onopen=()=>{for(let n of(console.log(`[ws] connected in ${(performance.now()-e).toFixed(0)}ms`),s(!0),p.current=t,d.current=500,u.current))r.send(JSON.stringify(n));u.current=[]},r.onmessage=e=>{let t=JSON.parse(e.data);for(let e of("pong"===t.type&&(clearTimeout(f.current),g.current=!1),"message:ack"===t.type&&y.current.length>0&&(y.current=[]),i.current))e(t)},r.onclose=e=>{console.log(`[ws] closed (code=${e.code}), reconnecting immediately`),s(!1),o.current===r&&(o.current=null),y.current.length>0&&(u.current.push(...y.current),y.current=[]),(1008===e.code||4401===e.code)&&(p.current=null),d.current=500,h.current?.()},r.onerror=()=>{r.close()}},[j]);h.current=v,(0,r.useEffect)(()=>(x.current=!0,v(),()=>{x.current=!1,clearTimeout(c.current),clearInterval(b.current),o.current&&(o.current.onclose=null,o.current.close(),o.current=null),m.current=!1}),[v]);let w=(0,r.useCallback)(()=>{let e=o.current;e&&(e.onclose=null,e.onerror=null,e.close(),o.current=null),s(!1),d.current=500,h.current?.()},[]);(0,r.useEffect)(()=>{let e=()=>{clearInterval(b.current),"visible"===document.visibilityState&&(b.current=setInterval(()=>{if(!o.current&&!m.current){console.log("[ws] health: no connection, forcing reconnect"),clearTimeout(c.current),d.current=500,h.current?.();return}let e=o.current;if(e){if(e.readyState!==WebSocket.OPEN){console.log(`[ws] health: dead connection (readyState=${e.readyState}), tearing down`),w();return}if(!g.current){g.current=!0;try{e.send(JSON.stringify({type:"ping"}))}catch{g.current=!1,w();return}clearTimeout(f.current),f.current=setTimeout(()=>{g.current=!1,w()},2e3)}}},3e3))},t=()=>{if("visible"===document.visibilityState){if(console.log(`[ws] page visible (hasWs=${!!o.current}, connecting=${m.current})`),e(),!o.current&&!m.current){console.log("[ws] no connection on visibility, reconnecting now"),clearTimeout(c.current),d.current=500,h.current?.();return}let t=o.current;if(t){if(t.readyState!==WebSocket.OPEN)return void w();if(!g.current){g.current=!0;try{t.send(JSON.stringify({type:"ping"}))}catch{g.current=!1,w();return}clearTimeout(f.current),f.current=setTimeout(()=>{g.current=!1,w()},2e3)}}}else clearInterval(b.current)};return document.addEventListener("visibilitychange",t),e(),()=>{document.removeEventListener("visibilitychange",t),clearInterval(b.current),clearTimeout(f.current)}},[w]);let y=(0,r.useRef)([]),N=(0,r.useCallback)(e=>{o.current?.readyState===WebSocket.OPEN?("message:send"===e.type&&y.current.push(e),o.current.send(JSON.stringify(e))):u.current.push(e)},[]),k=(0,r.useCallback)(e=>(i.current.add(e),()=>{i.current.delete(e)}),[]);return(0,n.jsx)(a.Provider,{value:{connected:t,send:N,subscribe:k},children:e})}function o(){let e=(0,r.useContext)(a);if(!e)throw Error("useWebSocket must be used within WebSocketProvider");return e}},89723:(e,t,s)=>{s.d(t,{G:()=>d});var n=s(95155),r=s(9005),a=s(12115),l=s(64233),o=s(89239),i=s(81477),c=s(53972);function d({open:e,onOpenChange:t,content:s,filePath:u}){let m=(0,a.useCallback)(()=>t(!1),[t]);(0,a.useEffect)(()=>{if(!e)return;let t=e=>{"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),m())};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[e,m]);let x=(0,a.useCallback)(e=>{e.target===e.currentTarget&&m()},[m]);if(!e)return null;let h=(0,c.uk)(u)||u;return(0,n.jsx)("div",{className:"fixed inset-0 z-50 bg-black/50 flex items-center justify-center p-4",onClick:x,children:(0,n.jsxs)(i.Zp,{className:"w-full max-w-3xl flex flex-col",style:{maxHeight:"calc(100dvh - 2rem)"},children:[(0,n.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b shrink-0",children:[(0,n.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:h}),(0,n.jsx)(o.$,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:m,children:(0,n.jsx)(r.A,{className:"h-4 w-4"})})]}),(0,n.jsx)(l.Y,{content:s,className:"flex-1 min-h-0 overflow-y-auto p-4"})]})})}},96301:(e,t,s)=>{s.d(t,{h:()=>b});var n=s(95155),r=s(92571),a=s(12363),l=s(76721),o=s(95660),i=s(14225),c=s(9107),d=s(12115),u=s(89323),m=s(40980);let x=new Map;async function h(e,t=!1){if(!t){let t=x.get(e);if(t)return t}let s=new URLSearchParams({path:e,includeFiles:"true",showHidden:"true"}),n=await fetch(`/api/filesystem/browse?${s}`);if(!n.ok)return x.get(e)||[];let r=((await n.json()).entries||[]).map(e=>({name:e.name,path:e.path,type:e.type}));return x.set(e,r),r}let p=new Map;function f(e){let t=p.get(e);return t||(t=new Set,p.set(e,t)),t}function g({node:e,depth:t,selectedFile:s,onSelectFile:u,expandedSet:p,onToggleExpand:f,refreshTick:b}){let j="directory"===e.type,v=p.has(e.path),[w,y]=(0,d.useState)(x.get(e.path)||[]),[N,k]=(0,d.useState)(!1),C=(0,d.useCallback)(()=>{j?(f(e.path),p.has(e.path)||x.has(e.path)||(k(!0),h(e.path).then(e=>{y(e),k(!1)}))):u(e.path)},[j,e.path,f,u,p]);return(0,d.useEffect)(()=>{if(j&&v&&0===w.length&&!N){let t=x.get(e.path);t?y(t):(k(!0),h(e.path).then(e=>{y(e),k(!1)}))}},[j,v,w.length,N,e.path]),(0,d.useEffect)(()=>{if(!j||!v||0===b)return;let t=x.get(e.path);t&&y(t)},[j,v,e.path,b]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:(0,m.cn)("flex items-center gap-1 px-2 py-1 text-sm cursor-pointer hover:bg-muted/50",!j&&s===e.path&&"bg-muted"),style:{paddingLeft:`${16*t+8}px`},onClick:C,children:[j?(0,n.jsxs)(n.Fragment,{children:[N?(0,n.jsx)(r.A,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-muted-foreground"}):v?(0,n.jsx)(a.A,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}):(0,n.jsx)(l.A,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),v?(0,n.jsx)(o.A,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}):(0,n.jsx)(i.A,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"w-3.5 shrink-0"}),(0,n.jsx)(c.A,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"})]}),(0,n.jsx)("span",{className:"font-mono text-xs truncate",children:e.name})]}),j&&v&&w.map(e=>(0,n.jsx)(g,{node:e,depth:t+1,selectedFile:s,onSelectFile:u,expandedSet:p,onToggleExpand:f,refreshTick:b},e.path))]})}function b({cwd:e,selectedFile:t,onSelectFile:s}){let[a,l]=(0,d.useState)(x.get(e)||[]),[o,i]=(0,d.useState)(0===a.length),[c,m]=(0,d.useState)(()=>f(e)),[j,v]=(0,d.useState)(0),w=(0,d.useRef)(e),y=(0,d.useRef)(c);y.current=c;let{subscribe:N}=(0,u.h)();(0,d.useEffect)(()=>{w.current=e,m(f(e));let t=x.get(e);t?(l(t),i(!1)):(i(!0),h(e).then(t=>{w.current===e&&(l(t),i(!1))}))},[e]),(0,d.useEffect)(()=>{let e=!0,t=async()=>{let t=[w.current,...y.current],s=!1;for(let n of t){if(!e)return;let t=x.get(n),r=await h(n,!0);if(!e)return;(!t||function(e,t){if(e.length!==t.length)return!0;for(let s=0;s<e.length;s++)if(e[s].path!==t[s].path||e[s].type!==t[s].type)return!0;return!1}(t,r))&&(s=!0)}s&&e&&(l(x.get(w.current)||[]),v(e=>e+1))},s=N(e=>{"session:fs_changed"===e.type&&t()});return()=>{e=!1,s()}},[N]);let k=(0,d.useCallback)(t=>{m(s=>{let n=new Set(s);return n.has(t)?n.delete(t):n.add(t),p.set(e,n),n})},[e]);return o?(0,n.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,n.jsx)(r.A,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):0===a.length?(0,n.jsx)("div",{className:"flex items-center justify-center py-12 text-sm text-muted-foreground",children:"Empty directory"}):(0,n.jsx)("div",{className:"py-1",children:a.map(e=>(0,n.jsx)(g,{node:e,depth:0,selectedFile:t,onSelectFile:s,expandedSet:c,onToggleExpand:k,refreshTick:j},e.path))})}}}]);