commandmate 0.39.0 → 0.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (657) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-build-manifest.json +457 -452
  3. package/.next/app-path-routes-manifest.json +32 -31
  4. package/.next/build-manifest.json +5 -5
  5. package/.next/prerender-manifest.json +15 -15
  6. package/.next/react-loadable-manifest.json +3 -3
  7. package/.next/required-server-files.json +1 -1
  8. package/.next/routes-manifest.json +8 -0
  9. package/.next/server/app/_not-found/page.js +1 -1
  10. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  11. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  12. package/.next/server/app/api/agents/update/route_client-reference-manifest.js +1 -1
  13. package/.next/server/app/api/agents/versions/route_client-reference-manifest.js +1 -1
  14. package/.next/server/app/api/app/release-notes/route_client-reference-manifest.js +1 -1
  15. package/.next/server/app/api/app/update/route_client-reference-manifest.js +1 -1
  16. package/.next/server/app/api/app/update-check/route.js +1 -1
  17. package/.next/server/app/api/app/update-check/route_client-reference-manifest.js +1 -1
  18. package/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -1
  19. package/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -1
  20. package/.next/server/app/api/auth/status/route_client-reference-manifest.js +1 -1
  21. package/.next/server/app/api/capabilities/route.js +1 -1
  22. package/.next/server/app/api/capabilities/route_client-reference-manifest.js +1 -1
  23. package/.next/server/app/api/daily-summary/route_client-reference-manifest.js +1 -1
  24. package/.next/server/app/api/daily-summary/status/route_client-reference-manifest.js +1 -1
  25. package/.next/server/app/api/external-apps/[id]/health/route_client-reference-manifest.js +1 -1
  26. package/.next/server/app/api/external-apps/[id]/route_client-reference-manifest.js +1 -1
  27. package/.next/server/app/api/external-apps/route_client-reference-manifest.js +1 -1
  28. package/.next/server/app/api/fs/browse/route_client-reference-manifest.js +1 -1
  29. package/.next/server/app/api/fs/recent-paths/route_client-reference-manifest.js +1 -1
  30. package/.next/server/app/api/hooks/agent-event/route.js.nft.json +1 -1
  31. package/.next/server/app/api/hooks/agent-event/route_client-reference-manifest.js +1 -1
  32. package/.next/server/app/api/hooks/claude-done/route.js +1 -1
  33. package/.next/server/app/api/hooks/claude-done/route.js.nft.json +1 -1
  34. package/.next/server/app/api/hooks/claude-done/route_client-reference-manifest.js +1 -1
  35. package/.next/server/app/api/hooks/permission-request/route.js.nft.json +1 -1
  36. package/.next/server/app/api/hooks/permission-request/route_client-reference-manifest.js +1 -1
  37. package/.next/server/app/api/metrics/vibe/route_client-reference-manifest.js +1 -1
  38. package/.next/server/app/api/ollama/models/route_client-reference-manifest.js +1 -1
  39. package/.next/server/app/api/push/escalation/route_client-reference-manifest.js +1 -1
  40. package/.next/server/app/api/push/subscriptions/route_client-reference-manifest.js +1 -1
  41. package/.next/server/app/api/push/vapid/route_client-reference-manifest.js +1 -1
  42. package/.next/server/app/api/relays/[relayId]/cancel/route.js.nft.json +1 -1
  43. package/.next/server/app/api/relays/[relayId]/cancel/route_client-reference-manifest.js +1 -1
  44. package/.next/server/app/api/relays/route.js.nft.json +1 -1
  45. package/.next/server/app/api/relays/route_client-reference-manifest.js +1 -1
  46. package/.next/server/app/api/remote/pair/route_client-reference-manifest.js +1 -1
  47. package/.next/server/app/api/repositories/[id]/route_client-reference-manifest.js +1 -1
  48. package/.next/server/app/api/repositories/clone/[jobId]/route.js +1 -1
  49. package/.next/server/app/api/repositories/clone/[jobId]/route.js.nft.json +1 -1
  50. package/.next/server/app/api/repositories/clone/[jobId]/route_client-reference-manifest.js +1 -1
  51. package/.next/server/app/api/repositories/clone/route.js +1 -1
  52. package/.next/server/app/api/repositories/clone/route.js.nft.json +1 -1
  53. package/.next/server/app/api/repositories/clone/route_client-reference-manifest.js +1 -1
  54. package/.next/server/app/api/repositories/excluded/route_client-reference-manifest.js +1 -1
  55. package/.next/server/app/api/repositories/restore/route.js +1 -1
  56. package/.next/server/app/api/repositories/restore/route.js.nft.json +1 -1
  57. package/.next/server/app/api/repositories/restore/route_client-reference-manifest.js +1 -1
  58. package/.next/server/app/api/repositories/route.js +1 -1
  59. package/.next/server/app/api/repositories/route.js.nft.json +1 -1
  60. package/.next/server/app/api/repositories/route_client-reference-manifest.js +1 -1
  61. package/.next/server/app/api/repositories/scan/route.js +1 -1
  62. package/.next/server/app/api/repositories/scan/route.js.nft.json +1 -1
  63. package/.next/server/app/api/repositories/scan/route_client-reference-manifest.js +1 -1
  64. package/.next/server/app/api/repositories/sync/route.js +1 -1
  65. package/.next/server/app/api/repositories/sync/route.js.nft.json +1 -1
  66. package/.next/server/app/api/repositories/sync/route_client-reference-manifest.js +1 -1
  67. package/.next/server/app/api/repositories/validate-path/route_client-reference-manifest.js +1 -1
  68. package/.next/server/app/api/settings/default-agents/route.js +1 -1
  69. package/.next/server/app/api/settings/default-agents/route.js.nft.json +1 -1
  70. package/.next/server/app/api/settings/default-agents/route_client-reference-manifest.js +1 -1
  71. package/.next/server/app/api/settings/default-surface-mode/route_client-reference-manifest.js +1 -1
  72. package/.next/server/app/api/sidebar/group-order/route_client-reference-manifest.js +1 -1
  73. package/.next/server/app/api/skills/[id]/route_client-reference-manifest.js +1 -1
  74. package/.next/server/app/api/skills/installations/route_client-reference-manifest.js +1 -1
  75. package/.next/server/app/api/skills/operations/route_client-reference-manifest.js +1 -1
  76. package/.next/server/app/api/skills/reindex/route_client-reference-manifest.js +1 -1
  77. package/.next/server/app/api/skills/route_client-reference-manifest.js +1 -1
  78. package/.next/server/app/api/slash-commands/route_client-reference-manifest.js +1 -1
  79. package/.next/server/app/api/tasks/[taskId]/cancel/route_client-reference-manifest.js +1 -1
  80. package/.next/server/app/api/tasks/[taskId]/route_client-reference-manifest.js +1 -1
  81. package/.next/server/app/api/templates/[id]/route_client-reference-manifest.js +1 -1
  82. package/.next/server/app/api/templates/route_client-reference-manifest.js +1 -1
  83. package/.next/server/app/api/verification/runs/[runId]/route_client-reference-manifest.js +1 -1
  84. package/.next/server/app/api/verification/runs/route_client-reference-manifest.js +1 -1
  85. package/.next/server/app/api/worktrees/[id]/auto-yes/route.js +1 -1
  86. package/.next/server/app/api/worktrees/[id]/auto-yes/route.js.nft.json +1 -1
  87. package/.next/server/app/api/worktrees/[id]/auto-yes/route_client-reference-manifest.js +1 -1
  88. package/.next/server/app/api/worktrees/[id]/capture/route.js +1 -1
  89. package/.next/server/app/api/worktrees/[id]/capture/route.js.nft.json +1 -1
  90. package/.next/server/app/api/worktrees/[id]/capture/route_client-reference-manifest.js +1 -1
  91. package/.next/server/app/api/worktrees/[id]/clear-composer/route.js +1 -1
  92. package/.next/server/app/api/worktrees/[id]/clear-composer/route.js.nft.json +1 -1
  93. package/.next/server/app/api/worktrees/[id]/clear-composer/route_client-reference-manifest.js +1 -1
  94. package/.next/server/app/api/worktrees/[id]/cli-reference/route_client-reference-manifest.js +1 -1
  95. package/.next/server/app/api/worktrees/[id]/cli-tool/route_client-reference-manifest.js +1 -1
  96. package/.next/server/app/api/worktrees/[id]/cmate/schedules/route.js +2 -2
  97. package/.next/server/app/api/worktrees/[id]/cmate/schedules/route.js.nft.json +1 -1
  98. package/.next/server/app/api/worktrees/[id]/cmate/schedules/route_client-reference-manifest.js +1 -1
  99. package/.next/server/app/api/worktrees/[id]/current-output/route.js +1 -1
  100. package/.next/server/app/api/worktrees/[id]/current-output/route.js.nft.json +1 -1
  101. package/.next/server/app/api/worktrees/[id]/current-output/route_client-reference-manifest.js +1 -1
  102. package/.next/server/app/api/worktrees/[id]/direct-input/route.js +1 -0
  103. package/.next/server/app/api/worktrees/[id]/direct-input/route.js.nft.json +1 -0
  104. package/.next/server/app/api/worktrees/[id]/direct-input/route_client-reference-manifest.js +1 -0
  105. package/.next/server/app/api/worktrees/[id]/env/route_client-reference-manifest.js +1 -1
  106. package/.next/server/app/api/worktrees/[id]/execution-logs/[logId]/route_client-reference-manifest.js +1 -1
  107. package/.next/server/app/api/worktrees/[id]/execution-logs/route_client-reference-manifest.js +1 -1
  108. package/.next/server/app/api/worktrees/[id]/files/[...path]/route_client-reference-manifest.js +1 -1
  109. package/.next/server/app/api/worktrees/[id]/git/branch/create/route_client-reference-manifest.js +1 -1
  110. package/.next/server/app/api/worktrees/[id]/git/branch/delete/route_client-reference-manifest.js +1 -1
  111. package/.next/server/app/api/worktrees/[id]/git/branches/route_client-reference-manifest.js +1 -1
  112. package/.next/server/app/api/worktrees/[id]/git/checkout/route_client-reference-manifest.js +1 -1
  113. package/.next/server/app/api/worktrees/[id]/git/commit/route_client-reference-manifest.js +1 -1
  114. package/.next/server/app/api/worktrees/[id]/git/diff/route_client-reference-manifest.js +1 -1
  115. package/.next/server/app/api/worktrees/[id]/git/fetch/route_client-reference-manifest.js +1 -1
  116. package/.next/server/app/api/worktrees/[id]/git/log/route_client-reference-manifest.js +1 -1
  117. package/.next/server/app/api/worktrees/[id]/git/pull/route_client-reference-manifest.js +1 -1
  118. package/.next/server/app/api/worktrees/[id]/git/push/route_client-reference-manifest.js +1 -1
  119. package/.next/server/app/api/worktrees/[id]/git/reset/route_client-reference-manifest.js +1 -1
  120. package/.next/server/app/api/worktrees/[id]/git/revert/route_client-reference-manifest.js +1 -1
  121. package/.next/server/app/api/worktrees/[id]/git/show/[commitHash]/route_client-reference-manifest.js +1 -1
  122. package/.next/server/app/api/worktrees/[id]/git/stage/route_client-reference-manifest.js +1 -1
  123. package/.next/server/app/api/worktrees/[id]/git/staged/route_client-reference-manifest.js +1 -1
  124. package/.next/server/app/api/worktrees/[id]/git/stash/[index]/route_client-reference-manifest.js +1 -1
  125. package/.next/server/app/api/worktrees/[id]/git/stash/apply/route_client-reference-manifest.js +1 -1
  126. package/.next/server/app/api/worktrees/[id]/git/stash/pop/route_client-reference-manifest.js +1 -1
  127. package/.next/server/app/api/worktrees/[id]/git/stash/push/route_client-reference-manifest.js +1 -1
  128. package/.next/server/app/api/worktrees/[id]/git/stash/route_client-reference-manifest.js +1 -1
  129. package/.next/server/app/api/worktrees/[id]/git/status/route_client-reference-manifest.js +1 -1
  130. package/.next/server/app/api/worktrees/[id]/git/unstage/route_client-reference-manifest.js +1 -1
  131. package/.next/server/app/api/worktrees/[id]/git/working-diff/route_client-reference-manifest.js +1 -1
  132. package/.next/server/app/api/worktrees/[id]/instances/notes/route_client-reference-manifest.js +1 -1
  133. package/.next/server/app/api/worktrees/[id]/instances/opencode/route.js.nft.json +1 -1
  134. package/.next/server/app/api/worktrees/[id]/instances/opencode/route_client-reference-manifest.js +1 -1
  135. package/.next/server/app/api/worktrees/[id]/interrupt/route.js +1 -1
  136. package/.next/server/app/api/worktrees/[id]/interrupt/route.js.nft.json +1 -1
  137. package/.next/server/app/api/worktrees/[id]/interrupt/route_client-reference-manifest.js +1 -1
  138. package/.next/server/app/api/worktrees/[id]/kill-session/route.js +1 -1
  139. package/.next/server/app/api/worktrees/[id]/kill-session/route.js.nft.json +1 -1
  140. package/.next/server/app/api/worktrees/[id]/kill-session/route_client-reference-manifest.js +1 -1
  141. package/.next/server/app/api/worktrees/[id]/logs/[filename]/route_client-reference-manifest.js +1 -1
  142. package/.next/server/app/api/worktrees/[id]/logs/route_client-reference-manifest.js +1 -1
  143. package/.next/server/app/api/worktrees/[id]/marp-render/route_client-reference-manifest.js +1 -1
  144. package/.next/server/app/api/worktrees/[id]/memos/[memoId]/route_client-reference-manifest.js +1 -1
  145. package/.next/server/app/api/worktrees/[id]/memos/route_client-reference-manifest.js +1 -1
  146. package/.next/server/app/api/worktrees/[id]/messages/route_client-reference-manifest.js +1 -1
  147. package/.next/server/app/api/worktrees/[id]/opencode/diff/route_client-reference-manifest.js +1 -1
  148. package/.next/server/app/api/worktrees/[id]/opencode/session/route_client-reference-manifest.js +1 -1
  149. package/.next/server/app/api/worktrees/[id]/opencode/share/route_client-reference-manifest.js +1 -1
  150. package/.next/server/app/api/worktrees/[id]/prompt-response/route.js +1 -1
  151. package/.next/server/app/api/worktrees/[id]/prompt-response/route.js.nft.json +1 -1
  152. package/.next/server/app/api/worktrees/[id]/prompt-response/route_client-reference-manifest.js +1 -1
  153. package/.next/server/app/api/worktrees/[id]/resolve-target/route_client-reference-manifest.js +1 -1
  154. package/.next/server/app/api/worktrees/[id]/respond/route.js +1 -1
  155. package/.next/server/app/api/worktrees/[id]/respond/route.js.nft.json +1 -1
  156. package/.next/server/app/api/worktrees/[id]/respond/route_client-reference-manifest.js +1 -1
  157. package/.next/server/app/api/worktrees/[id]/route.js +1 -1
  158. package/.next/server/app/api/worktrees/[id]/route.js.nft.json +1 -1
  159. package/.next/server/app/api/worktrees/[id]/route_client-reference-manifest.js +1 -1
  160. package/.next/server/app/api/worktrees/[id]/schedules/[scheduleId]/route_client-reference-manifest.js +1 -1
  161. package/.next/server/app/api/worktrees/[id]/schedules/active/route.js +1 -1
  162. package/.next/server/app/api/worktrees/[id]/schedules/active/route.js.nft.json +1 -1
  163. package/.next/server/app/api/worktrees/[id]/schedules/active/route_client-reference-manifest.js +1 -1
  164. package/.next/server/app/api/worktrees/[id]/schedules/route_client-reference-manifest.js +1 -1
  165. package/.next/server/app/api/worktrees/[id]/search/route_client-reference-manifest.js +1 -1
  166. package/.next/server/app/api/worktrees/[id]/send/route.js +1 -1
  167. package/.next/server/app/api/worktrees/[id]/send/route.js.nft.json +1 -1
  168. package/.next/server/app/api/worktrees/[id]/send/route_client-reference-manifest.js +1 -1
  169. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/git-workflow/route.js +1 -1
  170. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/git-workflow/route.js.nft.json +1 -1
  171. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/git-workflow/route_client-reference-manifest.js +1 -1
  172. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/install/route_client-reference-manifest.js +1 -1
  173. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/plan/route_client-reference-manifest.js +1 -1
  174. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/uninstall/route_client-reference-manifest.js +1 -1
  175. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/uninstall-plan/route_client-reference-manifest.js +1 -1
  176. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/update/route_client-reference-manifest.js +1 -1
  177. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/update-plan/route_client-reference-manifest.js +1 -1
  178. package/.next/server/app/api/worktrees/[id]/skills/route_client-reference-manifest.js +1 -1
  179. package/.next/server/app/api/worktrees/[id]/slash-commands/route_client-reference-manifest.js +1 -1
  180. package/.next/server/app/api/worktrees/[id]/special-keys/route.js +1 -1
  181. package/.next/server/app/api/worktrees/[id]/special-keys/route.js.nft.json +1 -1
  182. package/.next/server/app/api/worktrees/[id]/special-keys/route_client-reference-manifest.js +1 -1
  183. package/.next/server/app/api/worktrees/[id]/tasks/route_client-reference-manifest.js +1 -1
  184. package/.next/server/app/api/worktrees/[id]/terminal/route.js +1 -1
  185. package/.next/server/app/api/worktrees/[id]/terminal/route.js.nft.json +1 -1
  186. package/.next/server/app/api/worktrees/[id]/terminal/route_client-reference-manifest.js +1 -1
  187. package/.next/server/app/api/worktrees/[id]/timers/history/route_client-reference-manifest.js +1 -1
  188. package/.next/server/app/api/worktrees/[id]/timers/route.js +1 -1
  189. package/.next/server/app/api/worktrees/[id]/timers/route.js.nft.json +1 -1
  190. package/.next/server/app/api/worktrees/[id]/timers/route_client-reference-manifest.js +1 -1
  191. package/.next/server/app/api/worktrees/[id]/todos/[todoId]/route_client-reference-manifest.js +1 -1
  192. package/.next/server/app/api/worktrees/[id]/todos/route_client-reference-manifest.js +1 -1
  193. package/.next/server/app/api/worktrees/[id]/tree/[...path]/route_client-reference-manifest.js +1 -1
  194. package/.next/server/app/api/worktrees/[id]/tree/route_client-reference-manifest.js +1 -1
  195. package/.next/server/app/api/worktrees/[id]/upload/[...path]/route_client-reference-manifest.js +1 -1
  196. package/.next/server/app/api/worktrees/[id]/verify/config/route_client-reference-manifest.js +1 -1
  197. package/.next/server/app/api/worktrees/[id]/verify/route_client-reference-manifest.js +1 -1
  198. package/.next/server/app/api/worktrees/[id]/verify/runs/[runId]/cancel/route_client-reference-manifest.js +1 -1
  199. package/.next/server/app/api/worktrees/[id]/verify/runs/[runId]/route_client-reference-manifest.js +1 -1
  200. package/.next/server/app/api/worktrees/[id]/verify/runs/route_client-reference-manifest.js +1 -1
  201. package/.next/server/app/api/worktrees/[id]/viewed/route_client-reference-manifest.js +1 -1
  202. package/.next/server/app/api/worktrees/apply-default-agents/route_client-reference-manifest.js +1 -1
  203. package/.next/server/app/api/worktrees/route.js +1 -1
  204. package/.next/server/app/api/worktrees/route.js.nft.json +1 -1
  205. package/.next/server/app/api/worktrees/route_client-reference-manifest.js +1 -1
  206. package/.next/server/app/login/page.js +2 -2
  207. package/.next/server/app/login/page.js.nft.json +1 -1
  208. package/.next/server/app/login/page_client-reference-manifest.js +1 -1
  209. package/.next/server/app/manifest.webmanifest/route_client-reference-manifest.js +1 -1
  210. package/.next/server/app/more/page.js +2 -2
  211. package/.next/server/app/more/page.js.nft.json +1 -1
  212. package/.next/server/app/more/page_client-reference-manifest.js +1 -1
  213. package/.next/server/app/offline/page.js +1 -1
  214. package/.next/server/app/offline/page.js.nft.json +1 -1
  215. package/.next/server/app/offline/page_client-reference-manifest.js +1 -1
  216. package/.next/server/app/page.js +1 -1
  217. package/.next/server/app/page.js.nft.json +1 -1
  218. package/.next/server/app/page_client-reference-manifest.js +1 -1
  219. package/.next/server/app/proxy/[...path]/route_client-reference-manifest.js +1 -1
  220. package/.next/server/app/repositories/page.js +2 -2
  221. package/.next/server/app/repositories/page.js.nft.json +1 -1
  222. package/.next/server/app/repositories/page_client-reference-manifest.js +1 -1
  223. package/.next/server/app/review/page.js +1 -1
  224. package/.next/server/app/review/page.js.nft.json +1 -1
  225. package/.next/server/app/review/page_client-reference-manifest.js +1 -1
  226. package/.next/server/app/sessions/page.js +1 -1
  227. package/.next/server/app/sessions/page.js.nft.json +1 -1
  228. package/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
  229. package/.next/server/app/skills/[skillId]/page.js +2 -2
  230. package/.next/server/app/skills/[skillId]/page.js.nft.json +1 -1
  231. package/.next/server/app/skills/[skillId]/page_client-reference-manifest.js +1 -1
  232. package/.next/server/app/skills/installed/page.js +2 -2
  233. package/.next/server/app/skills/installed/page.js.nft.json +1 -1
  234. package/.next/server/app/skills/installed/page_client-reference-manifest.js +1 -1
  235. package/.next/server/app/skills/page.js +2 -2
  236. package/.next/server/app/skills/page.js.nft.json +1 -1
  237. package/.next/server/app/skills/page_client-reference-manifest.js +1 -1
  238. package/.next/server/app/worktrees/[id]/files/[...path]/page.js +1 -1
  239. package/.next/server/app/worktrees/[id]/files/[...path]/page.js.nft.json +1 -1
  240. package/.next/server/app/worktrees/[id]/files/[...path]/page_client-reference-manifest.js +1 -1
  241. package/.next/server/app/worktrees/[id]/page.js +10 -10
  242. package/.next/server/app/worktrees/[id]/page.js.nft.json +1 -1
  243. package/.next/server/app/worktrees/[id]/page_client-reference-manifest.js +1 -1
  244. package/.next/server/app/worktrees/[id]/terminal/page.js +1 -1
  245. package/.next/server/app/worktrees/[id]/terminal/page.js.nft.json +1 -1
  246. package/.next/server/app/worktrees/[id]/terminal/page_client-reference-manifest.js +1 -1
  247. package/.next/server/app-paths-manifest.json +32 -31
  248. package/.next/server/chunks/{7086.js → 1674.js} +4 -4
  249. package/.next/server/chunks/2119.js +1 -1
  250. package/.next/server/chunks/2445.js +1 -1
  251. package/.next/server/chunks/252.js +1 -0
  252. package/.next/server/chunks/2816.js +1 -1
  253. package/.next/server/chunks/3241.js +1 -1
  254. package/.next/server/chunks/3323.js +1 -1
  255. package/.next/server/chunks/3543.js +1 -1
  256. package/.next/server/chunks/3945.js +1 -1
  257. package/.next/server/chunks/4443.js +1 -1
  258. package/.next/server/chunks/4802.js +1 -1
  259. package/.next/server/chunks/5164.js +1 -1
  260. package/.next/server/chunks/5742.js +1 -0
  261. package/.next/server/chunks/6130.js +1 -1
  262. package/.next/server/chunks/650.js +1 -1
  263. package/.next/server/chunks/6661.js +1 -1
  264. package/.next/server/chunks/6793.js +1 -1
  265. package/.next/server/chunks/7685.js +1 -1
  266. package/.next/server/chunks/7905.js +1 -1
  267. package/.next/server/chunks/8581.js +29 -29
  268. package/.next/server/chunks/8673.js +14 -0
  269. package/.next/server/chunks/8728.js +4 -3
  270. package/.next/server/chunks/8800.js +1 -1
  271. package/.next/server/chunks/9080.js +1 -1
  272. package/.next/server/chunks/9731.js +2 -2
  273. package/.next/server/chunks/9882.js +3 -3
  274. package/.next/server/middleware-build-manifest.js +1 -1
  275. package/.next/server/middleware-manifest.json +5 -5
  276. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  277. package/.next/server/pages/500.html +1 -1
  278. package/.next/server/server-reference-manifest.json +1 -1
  279. package/.next/static/chunks/1642-767aed8e7c61ef7f.js +1 -0
  280. package/.next/static/chunks/{2053-ce3fe896ad45e50f.js → 2053-611dd27d42721b79.js} +1 -1
  281. package/.next/static/chunks/{2407-8fe4e4d0bab1931a.js → 2407-e259744922e0834c.js} +1 -1
  282. package/.next/static/chunks/{2619-04bc32f026a0d946.js → 2619-a305ad4810f1393a.js} +1 -1
  283. package/.next/static/chunks/{3922.9c1ec01fff819c88.js → 3922.8e79fc89f593280b.js} +1 -1
  284. package/.next/static/chunks/4768-979c8a03bed218e7.js +1 -0
  285. package/.next/static/chunks/6192-a67df090838b9aad.js +1 -0
  286. package/.next/static/chunks/7705-25076b57224da370.js +1 -0
  287. package/.next/static/chunks/8165-8944f74c53f3021f.js +1 -0
  288. package/.next/static/chunks/8318-01e7d1e5ad0a15a3.js +1 -0
  289. package/.next/static/chunks/8407-9a72e6f07c5d5458.js +1 -0
  290. package/.next/static/chunks/8606-9a381b996f9b6834.js +1 -0
  291. package/.next/static/chunks/9619-22adf5367c4b7080.js +1 -0
  292. package/.next/static/chunks/app/api/agents/update/{route-70779af8b4c8259a.js → route-0468c3c4baa46028.js} +1 -1
  293. package/.next/static/chunks/app/api/agents/versions/{route-70779af8b4c8259a.js → route-0468c3c4baa46028.js} +1 -1
  294. package/.next/static/chunks/app/api/app/release-notes/{route-70779af8b4c8259a.js → route-0468c3c4baa46028.js} +1 -1
  295. package/.next/static/chunks/app/api/app/update/route-0468c3c4baa46028.js +1 -0
  296. package/.next/static/chunks/app/api/app/update-check/{route-70779af8b4c8259a.js → route-0468c3c4baa46028.js} +1 -1
  297. package/.next/static/chunks/app/api/auth/login/route-0468c3c4baa46028.js +1 -0
  298. package/.next/static/chunks/app/api/auth/logout/route-0468c3c4baa46028.js +1 -0
  299. package/.next/static/chunks/app/api/auth/status/route-0468c3c4baa46028.js +1 -0
  300. package/.next/static/chunks/app/api/capabilities/route-0468c3c4baa46028.js +1 -0
  301. package/.next/static/chunks/app/api/daily-summary/route-0468c3c4baa46028.js +1 -0
  302. package/.next/static/chunks/app/api/daily-summary/status/route-0468c3c4baa46028.js +1 -0
  303. package/.next/static/chunks/app/api/external-apps/[id]/health/route-0468c3c4baa46028.js +1 -0
  304. package/.next/static/chunks/app/api/external-apps/[id]/route-0468c3c4baa46028.js +1 -0
  305. package/.next/static/chunks/app/api/external-apps/route-0468c3c4baa46028.js +1 -0
  306. package/.next/static/chunks/app/api/fs/browse/route-0468c3c4baa46028.js +1 -0
  307. package/.next/static/chunks/app/api/fs/recent-paths/route-0468c3c4baa46028.js +1 -0
  308. package/.next/static/chunks/app/api/hooks/agent-event/route-0468c3c4baa46028.js +1 -0
  309. package/.next/static/chunks/app/api/hooks/claude-done/route-0468c3c4baa46028.js +1 -0
  310. package/.next/static/chunks/app/api/hooks/permission-request/route-0468c3c4baa46028.js +1 -0
  311. package/.next/static/chunks/app/api/metrics/vibe/route-0468c3c4baa46028.js +1 -0
  312. package/.next/static/chunks/app/api/ollama/models/route-0468c3c4baa46028.js +1 -0
  313. package/.next/static/chunks/app/api/push/escalation/route-0468c3c4baa46028.js +1 -0
  314. package/.next/static/chunks/app/api/push/subscriptions/route-0468c3c4baa46028.js +1 -0
  315. package/.next/static/chunks/app/api/push/vapid/route-0468c3c4baa46028.js +1 -0
  316. package/.next/static/chunks/app/api/relays/[relayId]/cancel/route-0468c3c4baa46028.js +1 -0
  317. package/.next/static/chunks/app/api/relays/route-0468c3c4baa46028.js +1 -0
  318. package/.next/static/chunks/app/api/remote/pair/route-0468c3c4baa46028.js +1 -0
  319. package/.next/static/chunks/app/api/repositories/[id]/route-0468c3c4baa46028.js +1 -0
  320. package/.next/static/chunks/app/api/repositories/clone/[jobId]/route-0468c3c4baa46028.js +1 -0
  321. package/.next/static/chunks/app/api/repositories/clone/route-0468c3c4baa46028.js +1 -0
  322. package/.next/static/chunks/app/api/repositories/excluded/route-0468c3c4baa46028.js +1 -0
  323. package/.next/static/chunks/app/api/repositories/restore/route-0468c3c4baa46028.js +1 -0
  324. package/.next/static/chunks/app/api/repositories/route-0468c3c4baa46028.js +1 -0
  325. package/.next/static/chunks/app/api/repositories/scan/route-0468c3c4baa46028.js +1 -0
  326. package/.next/static/chunks/app/api/repositories/sync/route-0468c3c4baa46028.js +1 -0
  327. package/.next/static/chunks/app/api/repositories/validate-path/route-0468c3c4baa46028.js +1 -0
  328. package/.next/static/chunks/app/api/settings/default-agents/route-0468c3c4baa46028.js +1 -0
  329. package/.next/static/chunks/app/api/settings/default-surface-mode/route-0468c3c4baa46028.js +1 -0
  330. package/.next/static/chunks/app/api/sidebar/group-order/route-0468c3c4baa46028.js +1 -0
  331. package/.next/static/chunks/app/api/skills/[id]/route-0468c3c4baa46028.js +1 -0
  332. package/.next/static/chunks/app/api/skills/installations/route-0468c3c4baa46028.js +1 -0
  333. package/.next/static/chunks/app/api/skills/operations/route-0468c3c4baa46028.js +1 -0
  334. package/.next/static/chunks/app/api/skills/reindex/route-0468c3c4baa46028.js +1 -0
  335. package/.next/static/chunks/app/api/skills/route-0468c3c4baa46028.js +1 -0
  336. package/.next/static/chunks/app/api/slash-commands/route-0468c3c4baa46028.js +1 -0
  337. package/.next/static/chunks/app/api/tasks/[taskId]/cancel/route-0468c3c4baa46028.js +1 -0
  338. package/.next/static/chunks/app/api/tasks/[taskId]/route-0468c3c4baa46028.js +1 -0
  339. package/.next/static/chunks/app/api/templates/[id]/route-0468c3c4baa46028.js +1 -0
  340. package/.next/static/chunks/app/api/templates/route-0468c3c4baa46028.js +1 -0
  341. package/.next/static/chunks/app/api/verification/runs/[runId]/route-0468c3c4baa46028.js +1 -0
  342. package/.next/static/chunks/app/api/verification/runs/route-0468c3c4baa46028.js +1 -0
  343. package/.next/static/chunks/app/api/worktrees/[id]/auto-yes/route-0468c3c4baa46028.js +1 -0
  344. package/.next/static/chunks/app/api/worktrees/[id]/capture/route-0468c3c4baa46028.js +1 -0
  345. package/.next/static/chunks/app/api/worktrees/[id]/clear-composer/route-0468c3c4baa46028.js +1 -0
  346. package/.next/static/chunks/app/api/worktrees/[id]/cli-reference/route-0468c3c4baa46028.js +1 -0
  347. package/.next/static/chunks/app/api/worktrees/[id]/cli-tool/route-0468c3c4baa46028.js +1 -0
  348. package/.next/static/chunks/app/api/worktrees/[id]/cmate/schedules/route-0468c3c4baa46028.js +1 -0
  349. package/.next/static/chunks/app/api/worktrees/[id]/current-output/route-0468c3c4baa46028.js +1 -0
  350. package/.next/static/chunks/app/api/worktrees/[id]/direct-input/route-0468c3c4baa46028.js +1 -0
  351. package/.next/static/chunks/app/api/worktrees/[id]/env/route-0468c3c4baa46028.js +1 -0
  352. package/.next/static/chunks/app/api/worktrees/[id]/execution-logs/[logId]/route-0468c3c4baa46028.js +1 -0
  353. package/.next/static/chunks/app/api/worktrees/[id]/execution-logs/route-0468c3c4baa46028.js +1 -0
  354. package/.next/static/chunks/app/api/worktrees/[id]/files/[...path]/route-0468c3c4baa46028.js +1 -0
  355. package/.next/static/chunks/app/api/worktrees/[id]/git/branch/create/route-0468c3c4baa46028.js +1 -0
  356. package/.next/static/chunks/app/api/worktrees/[id]/git/branch/delete/route-0468c3c4baa46028.js +1 -0
  357. package/.next/static/chunks/app/api/worktrees/[id]/git/branches/route-0468c3c4baa46028.js +1 -0
  358. package/.next/static/chunks/app/api/worktrees/[id]/git/checkout/route-0468c3c4baa46028.js +1 -0
  359. package/.next/static/chunks/app/api/worktrees/[id]/git/commit/route-0468c3c4baa46028.js +1 -0
  360. package/.next/static/chunks/app/api/worktrees/[id]/git/diff/route-0468c3c4baa46028.js +1 -0
  361. package/.next/static/chunks/app/api/worktrees/[id]/git/fetch/route-0468c3c4baa46028.js +1 -0
  362. package/.next/static/chunks/app/api/worktrees/[id]/git/log/route-0468c3c4baa46028.js +1 -0
  363. package/.next/static/chunks/app/api/worktrees/[id]/git/pull/route-0468c3c4baa46028.js +1 -0
  364. package/.next/static/chunks/app/api/worktrees/[id]/git/push/route-0468c3c4baa46028.js +1 -0
  365. package/.next/static/chunks/app/api/worktrees/[id]/git/reset/route-0468c3c4baa46028.js +1 -0
  366. package/.next/static/chunks/app/api/worktrees/[id]/git/revert/route-0468c3c4baa46028.js +1 -0
  367. package/.next/static/chunks/app/api/worktrees/[id]/git/show/[commitHash]/route-0468c3c4baa46028.js +1 -0
  368. package/.next/static/chunks/app/api/worktrees/[id]/git/stage/route-0468c3c4baa46028.js +1 -0
  369. package/.next/static/chunks/app/api/worktrees/[id]/git/staged/route-0468c3c4baa46028.js +1 -0
  370. package/.next/static/chunks/app/api/worktrees/[id]/git/stash/[index]/route-0468c3c4baa46028.js +1 -0
  371. package/.next/static/chunks/app/api/worktrees/[id]/git/stash/apply/route-0468c3c4baa46028.js +1 -0
  372. package/.next/static/chunks/app/api/worktrees/[id]/git/stash/pop/route-0468c3c4baa46028.js +1 -0
  373. package/.next/static/chunks/app/api/worktrees/[id]/git/stash/push/route-0468c3c4baa46028.js +1 -0
  374. package/.next/static/chunks/app/api/worktrees/[id]/git/stash/route-0468c3c4baa46028.js +1 -0
  375. package/.next/static/chunks/app/api/worktrees/[id]/git/status/route-0468c3c4baa46028.js +1 -0
  376. package/.next/static/chunks/app/api/worktrees/[id]/git/unstage/route-0468c3c4baa46028.js +1 -0
  377. package/.next/static/chunks/app/api/worktrees/[id]/git/working-diff/route-0468c3c4baa46028.js +1 -0
  378. package/.next/static/chunks/app/api/worktrees/[id]/instances/notes/route-0468c3c4baa46028.js +1 -0
  379. package/.next/static/chunks/app/api/worktrees/[id]/instances/opencode/route-0468c3c4baa46028.js +1 -0
  380. package/.next/static/chunks/app/api/worktrees/[id]/interrupt/route-0468c3c4baa46028.js +1 -0
  381. package/.next/static/chunks/app/api/worktrees/[id]/kill-session/route-0468c3c4baa46028.js +1 -0
  382. package/.next/static/chunks/app/api/worktrees/[id]/logs/[filename]/route-0468c3c4baa46028.js +1 -0
  383. package/.next/static/chunks/app/api/worktrees/[id]/logs/route-0468c3c4baa46028.js +1 -0
  384. package/.next/static/chunks/app/api/worktrees/[id]/marp-render/route-0468c3c4baa46028.js +1 -0
  385. package/.next/static/chunks/app/api/worktrees/[id]/memos/[memoId]/route-0468c3c4baa46028.js +1 -0
  386. package/.next/static/chunks/app/api/worktrees/[id]/memos/route-0468c3c4baa46028.js +1 -0
  387. package/.next/static/chunks/app/api/worktrees/[id]/messages/route-0468c3c4baa46028.js +1 -0
  388. package/.next/static/chunks/app/api/worktrees/[id]/opencode/diff/route-0468c3c4baa46028.js +1 -0
  389. package/.next/static/chunks/app/api/worktrees/[id]/opencode/session/route-0468c3c4baa46028.js +1 -0
  390. package/.next/static/chunks/app/api/worktrees/[id]/opencode/share/route-0468c3c4baa46028.js +1 -0
  391. package/.next/static/chunks/app/api/worktrees/[id]/prompt-response/route-0468c3c4baa46028.js +1 -0
  392. package/.next/static/chunks/app/api/worktrees/[id]/resolve-target/route-0468c3c4baa46028.js +1 -0
  393. package/.next/static/chunks/app/api/worktrees/[id]/respond/route-0468c3c4baa46028.js +1 -0
  394. package/.next/static/chunks/app/api/worktrees/[id]/route-0468c3c4baa46028.js +1 -0
  395. package/.next/static/chunks/app/api/worktrees/[id]/schedules/[scheduleId]/route-0468c3c4baa46028.js +1 -0
  396. package/.next/static/chunks/app/api/worktrees/[id]/schedules/active/route-0468c3c4baa46028.js +1 -0
  397. package/.next/static/chunks/app/api/worktrees/[id]/schedules/route-0468c3c4baa46028.js +1 -0
  398. package/.next/static/chunks/app/api/worktrees/[id]/search/route-0468c3c4baa46028.js +1 -0
  399. package/.next/static/chunks/app/api/worktrees/[id]/send/route-0468c3c4baa46028.js +1 -0
  400. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/git-workflow/route-0468c3c4baa46028.js +1 -0
  401. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/install/route-0468c3c4baa46028.js +1 -0
  402. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/plan/route-0468c3c4baa46028.js +1 -0
  403. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/uninstall/route-0468c3c4baa46028.js +1 -0
  404. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/uninstall-plan/route-0468c3c4baa46028.js +1 -0
  405. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/update/route-0468c3c4baa46028.js +1 -0
  406. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/update-plan/route-0468c3c4baa46028.js +1 -0
  407. package/.next/static/chunks/app/api/worktrees/[id]/skills/route-0468c3c4baa46028.js +1 -0
  408. package/.next/static/chunks/app/api/worktrees/[id]/slash-commands/route-0468c3c4baa46028.js +1 -0
  409. package/.next/static/chunks/app/api/worktrees/[id]/special-keys/route-0468c3c4baa46028.js +1 -0
  410. package/.next/static/chunks/app/api/worktrees/[id]/tasks/route-0468c3c4baa46028.js +1 -0
  411. package/.next/static/chunks/app/api/worktrees/[id]/terminal/route-0468c3c4baa46028.js +1 -0
  412. package/.next/static/chunks/app/api/worktrees/[id]/timers/history/route-0468c3c4baa46028.js +1 -0
  413. package/.next/static/chunks/app/api/worktrees/[id]/timers/route-0468c3c4baa46028.js +1 -0
  414. package/.next/static/chunks/app/api/worktrees/[id]/todos/[todoId]/route-0468c3c4baa46028.js +1 -0
  415. package/.next/static/chunks/app/api/worktrees/[id]/todos/route-0468c3c4baa46028.js +1 -0
  416. package/.next/static/chunks/app/api/worktrees/[id]/tree/[...path]/route-0468c3c4baa46028.js +1 -0
  417. package/.next/static/chunks/app/api/worktrees/[id]/tree/route-0468c3c4baa46028.js +1 -0
  418. package/.next/static/chunks/app/api/worktrees/[id]/upload/[...path]/route-0468c3c4baa46028.js +1 -0
  419. package/.next/static/chunks/app/api/worktrees/[id]/verify/config/route-0468c3c4baa46028.js +1 -0
  420. package/.next/static/chunks/app/api/worktrees/[id]/verify/route-0468c3c4baa46028.js +1 -0
  421. package/.next/static/chunks/app/api/worktrees/[id]/verify/runs/[runId]/cancel/route-0468c3c4baa46028.js +1 -0
  422. package/.next/static/chunks/app/api/worktrees/[id]/verify/runs/[runId]/route-0468c3c4baa46028.js +1 -0
  423. package/.next/static/chunks/app/api/worktrees/[id]/verify/runs/route-0468c3c4baa46028.js +1 -0
  424. package/.next/static/chunks/app/api/worktrees/[id]/viewed/route-0468c3c4baa46028.js +1 -0
  425. package/.next/static/chunks/app/api/worktrees/apply-default-agents/route-0468c3c4baa46028.js +1 -0
  426. package/.next/static/chunks/app/api/worktrees/route-0468c3c4baa46028.js +1 -0
  427. package/.next/static/chunks/app/layout-b90cce6a51c91f4c.js +1 -0
  428. package/.next/static/chunks/app/login/{page-269a9de3b91a45a2.js → page-38d401f553693b03.js} +1 -1
  429. package/.next/static/chunks/app/manifest.webmanifest/route-0468c3c4baa46028.js +1 -0
  430. package/.next/static/chunks/app/more/page-30057cf1e0762ad2.js +1 -0
  431. package/.next/static/chunks/app/{page-0c1a29ff3609bd8b.js → page-8483ba400af011f5.js} +1 -1
  432. package/.next/static/chunks/app/proxy/[...path]/route-0468c3c4baa46028.js +1 -0
  433. package/.next/static/chunks/app/repositories/{page-e9ceeefacf87d470.js → page-6f7511f4ac8449e2.js} +1 -1
  434. package/.next/static/chunks/app/review/page-30616daa1dc595c2.js +1 -0
  435. package/.next/static/chunks/app/sessions/page-1a8ba152bbcb9efb.js +1 -0
  436. package/.next/static/chunks/app/skills/[skillId]/{page-6f62668eabb635f5.js → page-ab7e432b69fccb3b.js} +1 -1
  437. package/.next/static/chunks/app/skills/installed/{page-c6c4ac5e26c4e73e.js → page-e000102a01a42c98.js} +1 -1
  438. package/.next/static/chunks/app/skills/{page-bec1d4924004d4de.js → page-56b4fa11223e0cbd.js} +1 -1
  439. package/.next/static/chunks/app/worktrees/[id]/files/[...path]/{page-2e98f11956fe1aea.js → page-5445205c8dd80109.js} +1 -1
  440. package/.next/static/chunks/app/worktrees/[id]/layout-0468c3c4baa46028.js +1 -0
  441. package/.next/static/chunks/app/worktrees/[id]/page-e9ebdcd317b62e4a.js +1 -0
  442. package/.next/static/chunks/app/worktrees/[id]/terminal/{page-373ea37b16d930c7.js → page-c601f3b3ece6557e.js} +1 -1
  443. package/.next/static/chunks/{webpack-9f75198882fdaf08.js → webpack-7e5907979c182510.js} +1 -1
  444. package/.next/static/css/974314e796232f53.css +1 -0
  445. package/.next/trace +13 -13
  446. package/.next/types/app/api/worktrees/[id]/direct-input/route.ts +347 -0
  447. package/.next/types/routes.d.ts +2 -1
  448. package/.next/types/validator.ts +9 -0
  449. package/dist/cli/commands/ls.d.ts.map +1 -1
  450. package/dist/cli/commands/ls.js +9 -0
  451. package/dist/cli/commands/peers.d.ts.map +1 -1
  452. package/dist/cli/commands/peers.js +4 -0
  453. package/dist/cli/commands/send.d.ts.map +1 -1
  454. package/dist/cli/commands/send.js +20 -6
  455. package/dist/cli/config/model-validation.d.ts +22 -0
  456. package/dist/cli/config/model-validation.d.ts.map +1 -1
  457. package/dist/cli/config/model-validation.js +35 -1
  458. package/dist/cli/types/api-responses.d.ts +11 -0
  459. package/dist/cli/types/api-responses.d.ts.map +1 -1
  460. package/dist/lib/detection/status-reason.d.ts +13 -0
  461. package/dist/lib/detection/status-reason.d.ts.map +1 -1
  462. package/dist/lib/detection/status-reason.js +13 -0
  463. package/dist/lib/detection/tools/verified-against.d.ts +74 -5
  464. package/dist/lib/detection/tools/verified-against.d.ts.map +1 -1
  465. package/dist/lib/detection/tools/verified-against.js +74 -5
  466. package/dist/server/locales/en/worktree.json +58 -0
  467. package/dist/server/locales/ja/worktree.json +58 -0
  468. package/dist/server/src/config/claude-constants.js +27 -0
  469. package/dist/server/src/lib/cli-tools/base.js +2 -1
  470. package/dist/server/src/lib/cli-tools/claude.js +5 -1
  471. package/dist/server/src/lib/cli-tools/command-code.js +5 -1
  472. package/dist/server/src/lib/cli-tools/direct-input.js +22 -0
  473. package/dist/server/src/lib/cmate-cli-tool-parser.js +31 -0
  474. package/dist/server/src/lib/detection/cli-patterns.js +44 -5
  475. package/dist/server/src/lib/detection/selection-shape.js +274 -19
  476. package/dist/server/src/lib/detection/status-detector.js +2 -0
  477. package/dist/server/src/lib/detection/status-reason.js +13 -0
  478. package/dist/server/src/lib/detection/tools/codex/cli-patterns.js +67 -27
  479. package/dist/server/src/lib/detection/tools/codex/detect.js +18 -3
  480. package/dist/server/src/lib/detection/tools/command-code/detect.js +46 -0
  481. package/dist/server/src/lib/detection/tools/command-code/dialog.js +116 -25
  482. package/dist/server/src/lib/detection/tools/verified-against.js +74 -5
  483. package/dist/server/src/lib/detection/tui-detection-frame.js +18 -3
  484. package/dist/server/src/lib/polling/auto-yes-resolver.js +8 -0
  485. package/dist/server/src/lib/prompt-answer-sender.js +255 -1
  486. package/dist/server/src/lib/realtime-snippet.js +53 -0
  487. package/dist/server/src/lib/session/claude-session.js +19 -2
  488. package/dist/server/src/lib/session/current-output-builder.js +4 -1
  489. package/dist/server/src/lib/session/status-mapping.js +58 -8
  490. package/dist/server/src/lib/tmux/key-sequence.js +27 -1
  491. package/dist/server/src/lib/tmux/tmux-control-client.js +26 -3
  492. package/dist/server/src/lib/tmux/tmux.js +64 -3
  493. package/dist/server/src/types/direct-input.js +113 -0
  494. package/dist/server/src/types/sidebar.js +67 -7
  495. package/dist/server/src/types/terminal-keys.js +33 -1
  496. package/dist/types/terminal-keys.d.ts +28 -1
  497. package/dist/types/terminal-keys.d.ts.map +1 -1
  498. package/dist/types/terminal-keys.js +33 -1
  499. package/package.json +3 -2
  500. package/public/sw.js +5 -5
  501. package/release-notes/0.39.1.json +29 -0
  502. package/release-notes/0.40.0.json +69 -0
  503. package/.next/server/chunks/1707.js +0 -14
  504. package/.next/server/chunks/366.js +0 -1
  505. package/.next/server/chunks/8550.js +0 -1
  506. package/.next/static/chunks/1032-9e43405ac6bf6848.js +0 -1
  507. package/.next/static/chunks/3504-0100ab50762f591b.js +0 -1
  508. package/.next/static/chunks/4322-f54abdc5d16b7462.js +0 -1
  509. package/.next/static/chunks/4768-0ad5eb716bed5de9.js +0 -1
  510. package/.next/static/chunks/4949-a13ace141c0183d6.js +0 -1
  511. package/.next/static/chunks/5529-83e705fc4134a503.js +0 -1
  512. package/.next/static/chunks/6022-d2d7bd9373ff3ae9.js +0 -1
  513. package/.next/static/chunks/8019-cc6ac1cc033fd5f0.js +0 -1
  514. package/.next/static/chunks/8606-e893c1dab6fb81bc.js +0 -1
  515. package/.next/static/chunks/9619-c3c4c623b0a4f681.js +0 -1
  516. package/.next/static/chunks/998-292ebcd30f329eb1.js +0 -1
  517. package/.next/static/chunks/app/api/app/update/route-70779af8b4c8259a.js +0 -1
  518. package/.next/static/chunks/app/api/auth/login/route-70779af8b4c8259a.js +0 -1
  519. package/.next/static/chunks/app/api/auth/logout/route-70779af8b4c8259a.js +0 -1
  520. package/.next/static/chunks/app/api/auth/status/route-70779af8b4c8259a.js +0 -1
  521. package/.next/static/chunks/app/api/capabilities/route-70779af8b4c8259a.js +0 -1
  522. package/.next/static/chunks/app/api/daily-summary/route-70779af8b4c8259a.js +0 -1
  523. package/.next/static/chunks/app/api/daily-summary/status/route-70779af8b4c8259a.js +0 -1
  524. package/.next/static/chunks/app/api/external-apps/[id]/health/route-70779af8b4c8259a.js +0 -1
  525. package/.next/static/chunks/app/api/external-apps/[id]/route-70779af8b4c8259a.js +0 -1
  526. package/.next/static/chunks/app/api/external-apps/route-70779af8b4c8259a.js +0 -1
  527. package/.next/static/chunks/app/api/fs/browse/route-70779af8b4c8259a.js +0 -1
  528. package/.next/static/chunks/app/api/fs/recent-paths/route-70779af8b4c8259a.js +0 -1
  529. package/.next/static/chunks/app/api/hooks/agent-event/route-70779af8b4c8259a.js +0 -1
  530. package/.next/static/chunks/app/api/hooks/claude-done/route-70779af8b4c8259a.js +0 -1
  531. package/.next/static/chunks/app/api/hooks/permission-request/route-70779af8b4c8259a.js +0 -1
  532. package/.next/static/chunks/app/api/metrics/vibe/route-70779af8b4c8259a.js +0 -1
  533. package/.next/static/chunks/app/api/ollama/models/route-70779af8b4c8259a.js +0 -1
  534. package/.next/static/chunks/app/api/push/escalation/route-70779af8b4c8259a.js +0 -1
  535. package/.next/static/chunks/app/api/push/subscriptions/route-70779af8b4c8259a.js +0 -1
  536. package/.next/static/chunks/app/api/push/vapid/route-70779af8b4c8259a.js +0 -1
  537. package/.next/static/chunks/app/api/relays/[relayId]/cancel/route-70779af8b4c8259a.js +0 -1
  538. package/.next/static/chunks/app/api/relays/route-70779af8b4c8259a.js +0 -1
  539. package/.next/static/chunks/app/api/remote/pair/route-70779af8b4c8259a.js +0 -1
  540. package/.next/static/chunks/app/api/repositories/[id]/route-70779af8b4c8259a.js +0 -1
  541. package/.next/static/chunks/app/api/repositories/clone/[jobId]/route-70779af8b4c8259a.js +0 -1
  542. package/.next/static/chunks/app/api/repositories/clone/route-70779af8b4c8259a.js +0 -1
  543. package/.next/static/chunks/app/api/repositories/excluded/route-70779af8b4c8259a.js +0 -1
  544. package/.next/static/chunks/app/api/repositories/restore/route-70779af8b4c8259a.js +0 -1
  545. package/.next/static/chunks/app/api/repositories/route-70779af8b4c8259a.js +0 -1
  546. package/.next/static/chunks/app/api/repositories/scan/route-70779af8b4c8259a.js +0 -1
  547. package/.next/static/chunks/app/api/repositories/sync/route-70779af8b4c8259a.js +0 -1
  548. package/.next/static/chunks/app/api/repositories/validate-path/route-70779af8b4c8259a.js +0 -1
  549. package/.next/static/chunks/app/api/settings/default-agents/route-70779af8b4c8259a.js +0 -1
  550. package/.next/static/chunks/app/api/settings/default-surface-mode/route-70779af8b4c8259a.js +0 -1
  551. package/.next/static/chunks/app/api/sidebar/group-order/route-70779af8b4c8259a.js +0 -1
  552. package/.next/static/chunks/app/api/skills/[id]/route-70779af8b4c8259a.js +0 -1
  553. package/.next/static/chunks/app/api/skills/installations/route-70779af8b4c8259a.js +0 -1
  554. package/.next/static/chunks/app/api/skills/operations/route-70779af8b4c8259a.js +0 -1
  555. package/.next/static/chunks/app/api/skills/reindex/route-70779af8b4c8259a.js +0 -1
  556. package/.next/static/chunks/app/api/skills/route-70779af8b4c8259a.js +0 -1
  557. package/.next/static/chunks/app/api/slash-commands/route-70779af8b4c8259a.js +0 -1
  558. package/.next/static/chunks/app/api/tasks/[taskId]/cancel/route-70779af8b4c8259a.js +0 -1
  559. package/.next/static/chunks/app/api/tasks/[taskId]/route-70779af8b4c8259a.js +0 -1
  560. package/.next/static/chunks/app/api/templates/[id]/route-70779af8b4c8259a.js +0 -1
  561. package/.next/static/chunks/app/api/templates/route-70779af8b4c8259a.js +0 -1
  562. package/.next/static/chunks/app/api/verification/runs/[runId]/route-70779af8b4c8259a.js +0 -1
  563. package/.next/static/chunks/app/api/verification/runs/route-70779af8b4c8259a.js +0 -1
  564. package/.next/static/chunks/app/api/worktrees/[id]/auto-yes/route-70779af8b4c8259a.js +0 -1
  565. package/.next/static/chunks/app/api/worktrees/[id]/capture/route-70779af8b4c8259a.js +0 -1
  566. package/.next/static/chunks/app/api/worktrees/[id]/clear-composer/route-70779af8b4c8259a.js +0 -1
  567. package/.next/static/chunks/app/api/worktrees/[id]/cli-reference/route-70779af8b4c8259a.js +0 -1
  568. package/.next/static/chunks/app/api/worktrees/[id]/cli-tool/route-70779af8b4c8259a.js +0 -1
  569. package/.next/static/chunks/app/api/worktrees/[id]/cmate/schedules/route-70779af8b4c8259a.js +0 -1
  570. package/.next/static/chunks/app/api/worktrees/[id]/current-output/route-70779af8b4c8259a.js +0 -1
  571. package/.next/static/chunks/app/api/worktrees/[id]/env/route-70779af8b4c8259a.js +0 -1
  572. package/.next/static/chunks/app/api/worktrees/[id]/execution-logs/[logId]/route-70779af8b4c8259a.js +0 -1
  573. package/.next/static/chunks/app/api/worktrees/[id]/execution-logs/route-70779af8b4c8259a.js +0 -1
  574. package/.next/static/chunks/app/api/worktrees/[id]/files/[...path]/route-70779af8b4c8259a.js +0 -1
  575. package/.next/static/chunks/app/api/worktrees/[id]/git/branch/create/route-70779af8b4c8259a.js +0 -1
  576. package/.next/static/chunks/app/api/worktrees/[id]/git/branch/delete/route-70779af8b4c8259a.js +0 -1
  577. package/.next/static/chunks/app/api/worktrees/[id]/git/branches/route-70779af8b4c8259a.js +0 -1
  578. package/.next/static/chunks/app/api/worktrees/[id]/git/checkout/route-70779af8b4c8259a.js +0 -1
  579. package/.next/static/chunks/app/api/worktrees/[id]/git/commit/route-70779af8b4c8259a.js +0 -1
  580. package/.next/static/chunks/app/api/worktrees/[id]/git/diff/route-70779af8b4c8259a.js +0 -1
  581. package/.next/static/chunks/app/api/worktrees/[id]/git/fetch/route-70779af8b4c8259a.js +0 -1
  582. package/.next/static/chunks/app/api/worktrees/[id]/git/log/route-70779af8b4c8259a.js +0 -1
  583. package/.next/static/chunks/app/api/worktrees/[id]/git/pull/route-70779af8b4c8259a.js +0 -1
  584. package/.next/static/chunks/app/api/worktrees/[id]/git/push/route-70779af8b4c8259a.js +0 -1
  585. package/.next/static/chunks/app/api/worktrees/[id]/git/reset/route-70779af8b4c8259a.js +0 -1
  586. package/.next/static/chunks/app/api/worktrees/[id]/git/revert/route-70779af8b4c8259a.js +0 -1
  587. package/.next/static/chunks/app/api/worktrees/[id]/git/show/[commitHash]/route-70779af8b4c8259a.js +0 -1
  588. package/.next/static/chunks/app/api/worktrees/[id]/git/stage/route-70779af8b4c8259a.js +0 -1
  589. package/.next/static/chunks/app/api/worktrees/[id]/git/staged/route-70779af8b4c8259a.js +0 -1
  590. package/.next/static/chunks/app/api/worktrees/[id]/git/stash/[index]/route-70779af8b4c8259a.js +0 -1
  591. package/.next/static/chunks/app/api/worktrees/[id]/git/stash/apply/route-70779af8b4c8259a.js +0 -1
  592. package/.next/static/chunks/app/api/worktrees/[id]/git/stash/pop/route-70779af8b4c8259a.js +0 -1
  593. package/.next/static/chunks/app/api/worktrees/[id]/git/stash/push/route-70779af8b4c8259a.js +0 -1
  594. package/.next/static/chunks/app/api/worktrees/[id]/git/stash/route-70779af8b4c8259a.js +0 -1
  595. package/.next/static/chunks/app/api/worktrees/[id]/git/status/route-70779af8b4c8259a.js +0 -1
  596. package/.next/static/chunks/app/api/worktrees/[id]/git/unstage/route-70779af8b4c8259a.js +0 -1
  597. package/.next/static/chunks/app/api/worktrees/[id]/git/working-diff/route-70779af8b4c8259a.js +0 -1
  598. package/.next/static/chunks/app/api/worktrees/[id]/instances/notes/route-70779af8b4c8259a.js +0 -1
  599. package/.next/static/chunks/app/api/worktrees/[id]/instances/opencode/route-70779af8b4c8259a.js +0 -1
  600. package/.next/static/chunks/app/api/worktrees/[id]/interrupt/route-70779af8b4c8259a.js +0 -1
  601. package/.next/static/chunks/app/api/worktrees/[id]/kill-session/route-70779af8b4c8259a.js +0 -1
  602. package/.next/static/chunks/app/api/worktrees/[id]/logs/[filename]/route-70779af8b4c8259a.js +0 -1
  603. package/.next/static/chunks/app/api/worktrees/[id]/logs/route-70779af8b4c8259a.js +0 -1
  604. package/.next/static/chunks/app/api/worktrees/[id]/marp-render/route-70779af8b4c8259a.js +0 -1
  605. package/.next/static/chunks/app/api/worktrees/[id]/memos/[memoId]/route-70779af8b4c8259a.js +0 -1
  606. package/.next/static/chunks/app/api/worktrees/[id]/memos/route-70779af8b4c8259a.js +0 -1
  607. package/.next/static/chunks/app/api/worktrees/[id]/messages/route-70779af8b4c8259a.js +0 -1
  608. package/.next/static/chunks/app/api/worktrees/[id]/opencode/diff/route-70779af8b4c8259a.js +0 -1
  609. package/.next/static/chunks/app/api/worktrees/[id]/opencode/session/route-70779af8b4c8259a.js +0 -1
  610. package/.next/static/chunks/app/api/worktrees/[id]/opencode/share/route-70779af8b4c8259a.js +0 -1
  611. package/.next/static/chunks/app/api/worktrees/[id]/prompt-response/route-70779af8b4c8259a.js +0 -1
  612. package/.next/static/chunks/app/api/worktrees/[id]/resolve-target/route-70779af8b4c8259a.js +0 -1
  613. package/.next/static/chunks/app/api/worktrees/[id]/respond/route-70779af8b4c8259a.js +0 -1
  614. package/.next/static/chunks/app/api/worktrees/[id]/route-70779af8b4c8259a.js +0 -1
  615. package/.next/static/chunks/app/api/worktrees/[id]/schedules/[scheduleId]/route-70779af8b4c8259a.js +0 -1
  616. package/.next/static/chunks/app/api/worktrees/[id]/schedules/active/route-70779af8b4c8259a.js +0 -1
  617. package/.next/static/chunks/app/api/worktrees/[id]/schedules/route-70779af8b4c8259a.js +0 -1
  618. package/.next/static/chunks/app/api/worktrees/[id]/search/route-70779af8b4c8259a.js +0 -1
  619. package/.next/static/chunks/app/api/worktrees/[id]/send/route-70779af8b4c8259a.js +0 -1
  620. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/git-workflow/route-70779af8b4c8259a.js +0 -1
  621. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/install/route-70779af8b4c8259a.js +0 -1
  622. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/plan/route-70779af8b4c8259a.js +0 -1
  623. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/uninstall/route-70779af8b4c8259a.js +0 -1
  624. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/uninstall-plan/route-70779af8b4c8259a.js +0 -1
  625. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/update/route-70779af8b4c8259a.js +0 -1
  626. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/update-plan/route-70779af8b4c8259a.js +0 -1
  627. package/.next/static/chunks/app/api/worktrees/[id]/skills/route-70779af8b4c8259a.js +0 -1
  628. package/.next/static/chunks/app/api/worktrees/[id]/slash-commands/route-70779af8b4c8259a.js +0 -1
  629. package/.next/static/chunks/app/api/worktrees/[id]/special-keys/route-70779af8b4c8259a.js +0 -1
  630. package/.next/static/chunks/app/api/worktrees/[id]/tasks/route-70779af8b4c8259a.js +0 -1
  631. package/.next/static/chunks/app/api/worktrees/[id]/terminal/route-70779af8b4c8259a.js +0 -1
  632. package/.next/static/chunks/app/api/worktrees/[id]/timers/history/route-70779af8b4c8259a.js +0 -1
  633. package/.next/static/chunks/app/api/worktrees/[id]/timers/route-70779af8b4c8259a.js +0 -1
  634. package/.next/static/chunks/app/api/worktrees/[id]/todos/[todoId]/route-70779af8b4c8259a.js +0 -1
  635. package/.next/static/chunks/app/api/worktrees/[id]/todos/route-70779af8b4c8259a.js +0 -1
  636. package/.next/static/chunks/app/api/worktrees/[id]/tree/[...path]/route-70779af8b4c8259a.js +0 -1
  637. package/.next/static/chunks/app/api/worktrees/[id]/tree/route-70779af8b4c8259a.js +0 -1
  638. package/.next/static/chunks/app/api/worktrees/[id]/upload/[...path]/route-70779af8b4c8259a.js +0 -1
  639. package/.next/static/chunks/app/api/worktrees/[id]/verify/config/route-70779af8b4c8259a.js +0 -1
  640. package/.next/static/chunks/app/api/worktrees/[id]/verify/route-70779af8b4c8259a.js +0 -1
  641. package/.next/static/chunks/app/api/worktrees/[id]/verify/runs/[runId]/cancel/route-70779af8b4c8259a.js +0 -1
  642. package/.next/static/chunks/app/api/worktrees/[id]/verify/runs/[runId]/route-70779af8b4c8259a.js +0 -1
  643. package/.next/static/chunks/app/api/worktrees/[id]/verify/runs/route-70779af8b4c8259a.js +0 -1
  644. package/.next/static/chunks/app/api/worktrees/[id]/viewed/route-70779af8b4c8259a.js +0 -1
  645. package/.next/static/chunks/app/api/worktrees/apply-default-agents/route-70779af8b4c8259a.js +0 -1
  646. package/.next/static/chunks/app/api/worktrees/route-70779af8b4c8259a.js +0 -1
  647. package/.next/static/chunks/app/layout-f43045c9edbc4d1f.js +0 -1
  648. package/.next/static/chunks/app/manifest.webmanifest/route-70779af8b4c8259a.js +0 -1
  649. package/.next/static/chunks/app/more/page-3963a5e56e550442.js +0 -1
  650. package/.next/static/chunks/app/proxy/[...path]/route-70779af8b4c8259a.js +0 -1
  651. package/.next/static/chunks/app/review/page-3028fe95de490236.js +0 -1
  652. package/.next/static/chunks/app/sessions/page-3f39f99b878fdda0.js +0 -1
  653. package/.next/static/chunks/app/worktrees/[id]/layout-70779af8b4c8259a.js +0 -1
  654. package/.next/static/chunks/app/worktrees/[id]/page-0305d80c8ebda4cb.js +0 -1
  655. package/.next/static/css/2c63c5531f77719e.css +0 -1
  656. /package/.next/static/{CqFH31RhKQbrRZXsMNosJ → o3mZdwNhCks6IlcAOPinc}/_buildManifest.js +0 -0
  657. /package/.next/static/{CqFH31RhKQbrRZXsMNosJ → o3mZdwNhCks6IlcAOPinc}/_ssgManifest.js +0 -0
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4949],{308:(e,t,n)=>{n.d(t,{Md:()=>c});var r=n(12115),a=n(60199),l=n(52703),s=n(67149);s.tC.pollMs,s.tC.wsFallbackMs;let i="claude";function o(e,t,n){let r=e.findIndex(e=>e.id===t.id),a=[...e];r>=0?a[r]=t:a.push(t);var l=[...a].sort((e,t)=>e.timestamp.getTime()-t.timestamp.getTime());if(void 0===n||n<1)return l;let s=l.filter(e=>"user"===e.role).map(e=>e.timestamp.getTime()).sort((e,t)=>t-e);if(s.length<=n)return l;let i=s[n-1];return l.filter(e=>e.timestamp.getTime()>=i)}function c(e){let{worktreeId:t,cliToolId:n,instanceId:c,limit:u,includeArchived:d=!1,enabled:m=!0,cadence:f=s.tC}=e,[p,h]=(0,r.useState)([]),[g,x]=(0,r.useState)(!0),{connected:b,subscribe:v,unsubscribe:y,addListener:w}=(0,a.xM)(),k=null!=c?c:n,j=(0,r.useRef)(0),N=(0,r.useRef)(n);N.current=n;let C=(0,r.useRef)(k);C.current=k;let S=(0,r.useRef)(u);S.current=u;let T=(0,r.useRef)(d);T.current=d;let M=(0,r.useRef)(new Map),I=(0,r.useRef)(!1);(0,r.useEffect)(()=>(I.current=!0,()=>{I.current=!1}),[]);let E=(0,r.useCallback)(async()=>{let e=++j.current,r=new Map;M.current=r;let a=()=>!I.current||j.current!==e||N.current!==n||C.current!==k;try{let e=new URLSearchParams({cliTool:n,instance:k,unit:"pairs"});void 0!==u&&e.set("limit",String(u)),d&&e.set("includeArchived","true");let l=await fetch("/api/worktrees/".concat(t,"/messages?").concat(e.toString()));if(!l.ok)return;let s=await l.json();if(a())return;let i=s.map(e=>({...e,timestamp:new Date(e.timestamp)}));for(let e of r.values())i=o(i,e,u);M.current===r&&(M.current=new Map),h(i),x(!1)}catch(e){if(a())return;console.error("[useSplitMessages] fetch error:",e),x(!1)}},[t,n,k,u,d]),A="".concat(t,"::").concat(n,"::").concat(k),L=(0,r.useRef)(A);return(0,r.useEffect)(()=>{L.current!==A&&(L.current=A,j.current+=1,M.current=new Map,h([]),x(!0))},[A]),(0,r.useEffect)(()=>{if(!m)return;let e=!1,t=setInterval(()=>{"hidden"!==document.visibilityState&&E()},(0,s.z1)(f,{connected:b}));"undefined"!=typeof document&&"hidden"!==document.visibilityState&&E();let n=()=>{"visible"!==document.visibilityState||e||E()};return document.addEventListener("visibilitychange",n),()=>{e=!0,clearInterval(t),document.removeEventListener("visibilitychange",n)}},[m,f,b,E]),(0,r.useEffect)(()=>{if(m)return v(t),()=>y(t)},[m,t,v,y]),(0,r.useEffect)(()=>{if(m)return w(e=>{var n,r,a,s;if("message"===e.type||"message_updated"===e.type){if(e.worktreeId!==t)return;let a=e.message;if(!a||"string"!=typeof a.id)return;let l=null!=(n=a.cliToolId)?n:i,s=null!=(r=a.instanceId)?r:l;if(l!==N.current||s!==C.current||!a.content||""===a.content.trim()||a.archived&&!T.current)return;let c={...a,timestamp:new Date(a.timestamp),cliToolId:l,instanceId:s};M.current.set(c.id,c),h(e=>o(e,c,S.current));return}if(e.type===l.dz){if(e.worktreeId!==t)return;let n=null!=(a=e.cliToolId)?a:i,r=null!=(s=e.instanceId)?s:n;if(n!==N.current||r!==C.current)return;E();return}if("session_status_changed"===e.type)e.worktreeId===t&&!1===e.isRunning&&(null==e.instance||e.instance===C.current)&&(null==e.cliTool||e.cliTool===N.current)&&E()})},[m,t,w,E]),{messages:p,isLoading:g,refresh:(0,r.useCallback)(()=>E(),[E])}}},813:(e,t,n)=>{n.d(t,{D:()=>r});function r(e,t,n){let r=new TextEncoder;if(r.encode(e).length<=t)return e;let a=t-r.encode(n).length,l=0,s="";for(let t of e){let e=r.encode(t).length;if(l+e>a)break;l+=e,s+=t}return"".concat(s).concat(n)}},2954:(e,t,n)=>{n.d(t,{T:()=>m});var r=n(95155),a=n(12115),l=n(18955),s=n(91758),i=n(94465),o=n(76351);function c(e){let{isOpen:t,onConfirm:n,onCancel:s,cliToolName:c}=e,u=(0,l.c)("autoYes"),d=(0,l.c)("common"),[m,f]=(0,a.useState)(o.t6),[p,h]=(0,a.useState)(""),[g,x]=(0,a.useState)(null),[b,v]=(0,a.useState)(!1),y=(0,a.useRef)(null),w=e=>u(o.Ni[e].replace("autoYes.",""));return(0,a.useEffect)(()=>{t&&(h(""),x(null),v(!1))},[t]),(0,a.useEffect)(()=>{if(!b)return;let e=e=>{y.current&&!y.current.contains(e.target)&&v(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[b]),(0,a.useEffect)(()=>{if(!p.trim())return void x(null);let e=(0,o.P0)(p.trim());if(e.valid)x(null);else{var t;x(null!=(t=e.error)?t:u("invalidRegexPattern"))}},[p,u]),(0,r.jsx)(i.a,{isOpen:t,onClose:s,title:c?u("enableTitleWithTool",{toolName:c}):u("enableTitle"),size:"sm",showCloseButton:!0,children:(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{className:"text-sm text-foreground",children:[(0,r.jsx)("p",{className:"font-medium mb-2",children:u("featureDescription")}),(0,r.jsxs)("ul",{className:"list-disc list-inside space-y-1",children:[(0,r.jsx)("li",{children:u("yesNoAutoResponse")}),(0,r.jsx)("li",{children:u("multipleChoiceAutoSelect")})]}),(0,r.jsx)("p",{className:"mt-1",children:u("autoDisableAfter",{duration:w(m)})}),c&&(0,r.jsx)("p",{className:"mt-2 text-muted-foreground",children:u("appliesOnlyToCurrent",{toolName:c})})]}),(0,r.jsxs)("div",{className:"text-sm text-foreground",children:[(0,r.jsx)("p",{className:"font-medium mb-2",children:u("duration")}),(0,r.jsx)("div",{className:"flex gap-2",children:o.z9.map(e=>(0,r.jsx)("button",{type:"button",onClick:()=>f(e),className:"flex-1 py-2 px-3 text-sm font-medium rounded-md border-2 transition-colors ".concat(m===e?"border-accent-600 bg-accent-50 dark:bg-accent-900/30 text-accent-700 dark:text-accent-400":"border-border bg-surface dark:bg-surface-2 text-foreground hover:border-muted-foreground"),style:{minHeight:"44px"},children:w(e)},e))})]}),(0,r.jsxs)("div",{className:"text-sm text-foreground",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[(0,r.jsx)("label",{htmlFor:"stop-pattern-input",className:"font-medium",children:u("stopPatternLabel")}),(0,r.jsxs)("div",{className:"relative",ref:y,children:[(0,r.jsx)("button",{type:"button",onClick:()=>v(!b),className:"inline-flex items-center justify-center w-4 h-4 rounded-full bg-muted text-muted-foreground text-[10px] font-bold hover:bg-muted/80 focus:outline-none","aria-label":u("regexTipsLabel"),"data-testid":"regex-tips-button",children:"?"}),b&&(0,r.jsxs)("div",{className:"absolute left-0 top-6 z-50 w-72 rounded-md border border-border bg-surface p-3 shadow-lg text-xs text-foreground","data-testid":"regex-tips-tooltip",children:[(0,r.jsx)("p",{className:"font-medium mb-1.5",children:u("regexTipsTitle")}),(0,r.jsxs)("ul",{className:"space-y-1",children:[(0,r.jsxs)("li",{children:[(0,r.jsx)("code",{className:"bg-muted px-1 rounded",children:"\\bcat\\b"})," ",u("regexTipWordBoundary")]}),(0,r.jsxs)("li",{children:[(0,r.jsx)("code",{className:"bg-muted px-1 rounded",children:"error|fatal"})," ",u("regexTipOr")]}),(0,r.jsxs)("li",{children:[(0,r.jsx)("code",{className:"bg-muted px-1 rounded",children:"(?i)error"})," ",u("regexTipCaseNote")]})]})]})]})]}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground mb-2",children:u("stopPatternDescription")}),(0,r.jsx)("input",{id:"stop-pattern-input",type:"text",value:p,onChange:e=>h(e.target.value),placeholder:u("stopPatternPlaceholder"),className:"w-full px-3 py-2 border rounded-md text-sm font-mono bg-surface dark:bg-surface-2 text-foreground ".concat(g?"border-danger focus:ring-danger focus:border-danger":"border-input focus:ring-ring focus:border-accent-500"," focus:outline-none focus:ring-1"),"data-testid":"stop-pattern-input"}),g&&(0,r.jsx)("p",{className:"mt-1 text-xs text-danger","data-testid":"stop-pattern-error",children:g})]}),(0,r.jsxs)("div",{className:"text-sm text-foreground",children:[(0,r.jsx)("p",{className:"font-medium mb-2",children:u("aboutRisks")}),(0,r.jsx)("p",{children:u("riskWarning")})]}),(0,r.jsx)("div",{className:"bg-warning-subtle border-l-4 border-warning p-3",children:(0,r.jsxs)("p",{className:"text-sm text-warning-foreground",children:[(0,r.jsx)("span",{className:"font-medium",children:u("disclaimer")}),u("disclaimerText")]})}),(0,r.jsxs)("div",{className:"flex justify-end gap-3 pt-2",children:[(0,r.jsx)("button",{type:"button",onClick:s,className:"px-4 py-2 text-sm font-medium rounded-md bg-muted hover:bg-muted/80 text-foreground",children:d("cancel")}),(0,r.jsx)("button",{type:"button",onClick:()=>{n(m,p.trim()||void 0)},disabled:!!g,className:"px-4 py-2 text-sm font-medium rounded-md text-white ".concat(g?"bg-muted-foreground cursor-not-allowed":"bg-warning hover:bg-warning/90"),"data-testid":"confirm-button",children:u("agreeAndEnable")})]})]})})}var u=n(9900),d=n(54014);let m=(0,a.memo)(function(e){let{enabled:t,expiresAt:n,onToggle:i,lastAutoResponse:m,cliToolName:f,inline:p=!1,showToolName:h=!0,onExpire:g}=e,x=(0,l.c)("autoYes"),[b,v]=(0,a.useState)(""),[y,w]=(0,a.useState)(null),[k,j]=(0,a.useState)(!1),[N,C]=(0,a.useState)(!1),[S,T]=(0,a.useState)(!1);(0,a.useEffect)(()=>{if(!t||!n){v(""),T(!1);return}T(!1);let e=!1,r=()=>(v((0,o.$B)(n)),n-Date.now()<=0&&!e&&(e=!0,T(!0),null==g||g(),!0));if(r())return;let a=setInterval(()=>{r()&&clearInterval(a)},o.$s);return()=>clearInterval(a)},[t,n,g]),(0,a.useEffect)(()=>{if(!m)return;w('Auto responded: "'.concat(m,'"'));let e=setTimeout(()=>w(null),u.I2);return()=>clearTimeout(e)},[m]);let M=t&&!S,I=(0,a.useCallback)(()=>{M?(j(!0),i({enabled:!1}).finally(()=>j(!1))):C(!0)},[M,i]),E=(0,a.useCallback)((e,t)=>{C(!1),j(!0),i({enabled:!0,duration:e,stopPattern:t}).finally(()=>j(!1))},[i]),A=(0,a.useCallback)(()=>{C(!1)},[]);return(0,r.jsxs)("div",{className:p?"flex items-center gap-2":"flex items-center gap-3 px-4 py-2 bg-surface-2 border-b border-border",children:[(0,r.jsx)(s.d,{checked:M,onCheckedChange:I,disabled:k,"aria-label":x("toggleLabel")}),(0,r.jsx)("span",{className:"text-sm font-medium text-foreground",children:x("label")}),h&&f&&(0,r.jsxs)("span",{className:"text-xs text-accent-600 dark:text-accent-400 font-medium","aria-label":x("targetLabel"),children:["(",(0,d.f_)(f,""),")"]}),M&&b&&(0,r.jsx)("span",{className:"text-sm text-muted-foreground","aria-label":x("timeRemaining"),children:b}),y&&(0,r.jsx)("span",{className:"text-sm text-success animate-pulse",children:y}),(0,r.jsx)(c,{isOpen:N,onConfirm:E,onCancel:A,cliToolName:(0,d.f_)(f,"")})]})})},4300:(e,t,n)=>{n.d(t,{QN:()=>u,Qu:()=>c,bx:()=>i});let r="claude-turn:",a="antigravity-turn:",l="command-code-turn:",s=["oc-turn:",r,"codex-turn:",a,l];function i(e){return"string"==typeof e&&s.some(t=>e.startsWith(t))}let o=[[r,"claude-prompt:"],[a,"antigravity-prompt:"],[l,"command-code-prompt:"]];function c(e){if("string"!=typeof e)return null;for(let t of s)if(e.startsWith(t))return 0===e.slice(t.length).trim().length?null:e;return null}function u(e){for(let[t,n]of o){if(!e.startsWith(t))continue;let r=e.slice(t.length);return 0===r.trim().length?null:"".concat(n).concat(r)}return null}},8355:(e,t,n)=>{n.d(t,{CM:()=>o,LA:()=>c,S5:()=>s,bS:()=>l,bw:()=>r,h0:()=>i,vF:()=>a});let r=36,a=160,l=4096,s="commandmate:composer-height:";function i(e){return"split:".concat(e)}let o="session-tile",c=160},9708:(e,t,n)=>{n.d(t,{O:()=>i,k:()=>s});var r=n(12115);let a=Object.freeze({}),l=(0,r.createContext)(a),s=l.Provider;function i(){return(0,r.useContext)(l)}},14006:(e,t,n)=>{n.d(t,{D:()=>b});var r=n(95155),a=n(12115),l=n(18955),s=n(20562),i=n(8803),o=n(78596),c=n(68872);let u=/\x1b(?:\[[0-9;?]*)?$/;var d=n(51515);function m(e){return""===(0,d.aJ)(e).trim()}var f=n(18341),p=n(78660);function h(e){let{query:t,onQueryChange:n,matchCount:l,currentIndex:s,onNext:i,onPrev:o,onClose:c,isAtMaxMatches:u=!1}=e,d=(0,a.useRef)(null);(0,a.useEffect)(()=>{var e;null==(e=d.current)||e.focus()},[]);let m=(0,a.useCallback)(e=>{"Escape"===e.key&&c()},[c]),f=(0,a.useCallback)(e=>{n(e.target.value)},[n]),h=0===l?"0/0":u?"".concat(s+1,"/").concat(p.F0,"以上"):"".concat(s+1,"/").concat(l);return(0,r.jsxs)("div",{className:"flex items-center gap-1 px-2 py-1 bg-gray-800 border border-gray-600 rounded shadow-lg",role:"search","aria-label":"ターミナル内テキスト検索",children:[(0,r.jsx)("input",{ref:d,type:"text",value:t,onChange:f,onKeyDown:m,placeholder:"検索...",className:"bg-transparent text-gray-200 text-sm outline-none w-32 sm:w-40 placeholder-gray-500","aria-label":"検索キーワード",autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1}),(0,r.jsx)("span",{role:"status","aria-live":"polite","aria-atomic":"true",className:"text-gray-400 text-xs min-w-[3rem] text-right",children:h}),(0,r.jsx)("button",{onClick:o,disabled:0===l,"aria-label":"前の結果",className:"text-gray-300 hover:text-white disabled:text-gray-600 min-w-[36px] min-h-[36px] flex items-center justify-center text-base",children:"▲"}),(0,r.jsx)("button",{onClick:i,disabled:0===l,"aria-label":"次の結果",className:"text-gray-300 hover:text-white disabled:text-gray-600 min-w-[36px] min-h-[36px] flex items-center justify-center text-base",children:"▼"}),(0,r.jsx)("button",{onClick:c,"aria-label":"検索を閉じる",className:"text-gray-400 hover:text-white min-w-[36px] min-h-[36px] flex items-center justify-center text-base ml-1",children:"✕"})]})}var g=n(68394);function x(){return(0,r.jsxs)("div",{"data-testid":"thinking-indicator",className:"flex items-center gap-2 py-2 px-1 text-gray-400",children:[(0,r.jsxs)("span",{className:"flex gap-1",children:[(0,r.jsx)("span",{className:"animate-pulse delay-0",children:"."}),(0,r.jsx)("span",{className:"animate-pulse delay-150",children:"."}),(0,r.jsx)("span",{className:"animate-pulse delay-300",children:"."})]}),(0,r.jsx)("span",{className:"text-sm",children:"Thinking"})]})}let b=(0,a.memo)(function(e){let{output:t,isActive:n,attaching:b=!1,isThinking:v=!1,autoScroll:y=!0,onScrollChange:w,disableAutoFollow:k=!1,compactTuiLayoutPadding:j=!1,preservePaintedPanelRows:N=!1,wrapMode:C="viewport",density:S="regular",className:T=""}=e,M=(0,l.c)("worktree"),{scrollRef:I,autoScroll:E,handleScroll:A,scrollToBottom:L,scrollToTop:R}=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{initialAutoScroll:t=!0,onAutoScrollChange:n}=e,r=(0,a.useRef)(null),[l,s]=(0,a.useState)(t),i=(0,a.useRef)(!1),o=(0,a.useRef)(null);(0,a.useEffect)(()=>()=>{o.current&&clearTimeout(o.current)},[]);let c=(0,a.useCallback)(e=>{s(e),null==n||n(e)},[n]),u=(0,a.useCallback)(()=>{let e=r.current;if(!e)return!0;let{scrollTop:t,scrollHeight:n,clientHeight:a}=e;return n-a-t<=50},[]),d=(0,a.useCallback)(()=>{if(i.current)return;let e=u();e&&!l?c(!0):!e&&l&&c(!1)},[l,u,c]),m=(0,a.useCallback)(()=>{let e=r.current;e&&(i.current=!0,e.scrollTo({top:e.scrollHeight,behavior:"smooth"}),l||c(!0),o.current=setTimeout(()=>{i.current=!1,o.current=null},500))},[l,c]),f=(0,a.useCallback)(()=>{let e=r.current;e&&(i.current=!0,e.scrollTo({top:0,behavior:"smooth"}),l&&c(!1),o.current=setTimeout(()=>{i.current=!1,o.current=null},500))},[l,c]);return{scrollRef:r,autoScroll:l,setAutoScroll:c,scrollToBottom:m,scrollToTop:f,handleScroll:d}}({initialAutoScroll:y,onAutoScrollChange:w}),P=null!=t?t:"",D=(0,a.useMemo)(()=>j?N?(0,f.Dk)(P):function(e){if(""===e)return"";let t=e.split("\n"),n=[],r=!1,a=0;for(;a<t.length;){if(!m(t[a])){n.push(t[a]),r=!0,a++;continue}let e=a;for(;e<t.length&&m(t[e]);)e++;let l=e-a,s=!r,i=e>=t.length;if(!s&&!i)if(l<=2)for(let r=a;r<e;r++)n.push(t[r]);else n.push((0,d.x6)(t.slice(a,e).join("")));a=e}return n.join("\n")}(P):P,[j,N,P]),z=(0,a.useMemo)(()=>{if("frame"===C)return{minWidth:"".concat((0,g.pN)(D),"ch")}},[C,D]),{isOpen:O,query:F,matchCount:H,currentIndex:B,isAtMaxMatches:K,openSearch:q,closeSearch:U,setQuery:W,nextMatch:$,prevMatch:_}=(0,p.Yr)({output:D,containerRef:I}),J=(0,a.useCallback)(e=>{(e.ctrlKey||e.metaKey)&&"f"===e.key&&(e.preventDefault(),q())},[q]);(0,a.useEffect)(()=>{let e=()=>q();return window.addEventListener("terminal-search-open",e),()=>window.removeEventListener("terminal-search-open",e)},[q]);let[Q,Y]=(0,a.useState)(()=>D?[{key:0,html:(0,o.l5)(D)}]:[]),G=(0,a.useRef)(D),V=(0,a.useRef)(0);(0,a.useEffect)(()=>{let e=function(e,t){if(e===t)return{mode:"noop",text:t,appended:"",retainedLength:e.length};if(0===e.length||t.length<=e.length||!t.startsWith(e))return{mode:"replace",text:t,appended:"",retainedLength:0};let n=e.match(u),r=n?e.length-n[0].length:e.length;return{mode:"append",text:t,appended:t.slice(r),retainedLength:r}}(G.current,D);if(G.current=D,"noop"===e.mode)return;let t="append"===e.mode&&e.appended.length>c.ZJ;if("append"===e.mode&&!t)return void Y(t=>(V.current+=1,t.length>=400)?[{key:V.current,html:(0,o.l5)(D)}]:[...t,{key:V.current,html:(0,o.l5)(e.appended)}]);V.current+=1,Y(D?[{key:V.current,html:(0,o.l5)(D)}]:[])},[D]);let[Z,X]=(0,a.useState)(!1);(0,a.useEffect)(()=>{b?X(!1):n&&X(!0)},[b,n]);let ee=!t,et=ee&&b,en=ee&&!b&&!n&&Z,er=(0,a.useRef)(!1);(0,a.useEffect)(()=>{k&&(er.current=!0)},[k]),(0,a.useEffect)(()=>{if(I.current){if(er.current&&k&&D){I.current.scrollTo({top:0,behavior:"instant"}),er.current=!1;return}!k&&E&&I.current.scrollTo({top:I.current.scrollHeight,behavior:"instant"})}},[Q,D,E,k,I]);let ea=(0,a.useMemo)(()=>["terminal","font-mono","compact"===S?"text-xs":"text-sm","compact"===S?"p-2":"p-4","rounded-lg","overflow-y-auto","frame"===C?"overflow-x-auto":"overflow-x-hidden","bg-gray-900","text-gray-300","border","border-gray-700","h-full",n?"active":"",T].filter(Boolean).join(" "),[n,T,C,S]),[el,es]=(0,a.useState)(!1),ei=(0,a.useRef)(null),eo=(0,a.useCallback)(()=>{es(!0),ei.current&&clearTimeout(ei.current),ei.current=setTimeout(()=>es(!1),1500)},[]);(0,a.useEffect)(()=>()=>{ei.current&&clearTimeout(ei.current)},[]);let ec=(0,a.useCallback)(()=>{A(),eo()},[A,eo]),eu=["absolute bottom-4 right-4 flex items-center justify-center h-9 w-9 rounded-full bg-surface/80 backdrop-blur border border-border text-muted-foreground shadow-lg transition-opacity hover:text-surface-foreground hover:opacity-100 focus-visible:opacity-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",el?"opacity-100":"opacity-60"].join(" ");return(0,r.jsxs)("div",{className:"relative h-full flex flex-col",children:[O&&(0,r.jsx)("div",{className:"absolute top-2 right-2 z-10",children:(0,r.jsx)(h,{query:F,onQueryChange:W,matchCount:H,currentIndex:B,onNext:$,onPrev:_,onClose:U,isAtMaxMatches:K})}),(0,r.jsxs)("div",{ref:I,role:"log","aria-live":"polite","aria-label":"Terminal output",className:ea,onScroll:ec,onKeyDown:J,tabIndex:0,children:[(0,r.jsx)("div",{className:"frame"===C?"whitespace-pre w-max":"whitespace-pre-wrap break-words",style:z,children:Q.map(e=>(0,r.jsx)("span",{dangerouslySetInnerHTML:{__html:e.html}},e.key))}),et&&(0,r.jsx)("div",{"data-testid":"terminal-loading-placeholder",className:"flex h-full items-center justify-center px-4 text-center text-sm text-gray-500 select-none",children:M("terminal.loading")}),en&&(0,r.jsx)("div",{"data-testid":"terminal-ended-placeholder",className:"flex h-full items-center justify-center px-4 text-center text-sm text-gray-500 select-none",children:M("terminal.sessionEnded")}),n&&v&&(0,r.jsx)(x,{})]}),E?(0,r.jsx)("button",{type:"button",onClick:R,className:eu,"aria-label":"Scroll to top",children:(0,r.jsx)(s.A,{size:16,"aria-hidden":"true"})}):(0,r.jsx)("button",{type:"button",onClick:L,className:eu,"aria-label":"Scroll to bottom",children:(0,r.jsx)(i.A,{size:16,"aria-hidden":"true"})})]})})},16342:(e,t,n)=>{n.d(t,{LQ:()=>s,Ml:()=>l,sh:()=>a});let r=RegExp("^\\p{M}$","u");function a(e,t){if(e.length<=t)return e.length;let n=0,a=0;for(let l of e){let e=+!r.test(l);if(1===e&&n>=t)break;n+=e,a+=l.length}return a}function l(e,t,n){return e.slice(a(e,t),a(e,n))}function s(e){let t=0;for(let n of e)r.test(n)||(t+=1);return t}},18341:(e,t,n)=>{n.d(t,{CG:()=>s,Dk:()=>o,Uw:()=>i});var r=n(51515);let a=/\x1b\[([0-9;]*)m/g;function l(e){return""===(0,r.aJ)(e).trim()}function s(e){return l(e)&&""!==(0,r.aJ)(e)&&function(e){let t;for(a.lastIndex=0;null!==(t=a.exec(e));)if(function(e){let t=0;for(;t<e.length;){let n=e[t];if(38===n||48===n||58===n){if(48===n)return!0;let r=e[t+1];t+=5===r?3:2===r?5:2;continue}if(n>=40&&n<=47||n>=100&&n<=107)return!0;t+=1}return!1}(t[1].split(";").filter(e=>""!==e).map(e=>Number(e)).filter(e=>Number.isInteger(e))))return!0;return!1}(e)}function i(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(""===e)return"";let{isStructuralRow:n}=t,a=e.split("\n"),s=[],i=!1,o=0,c=e=>{var t;return l(e)&&!(null!=(t=null==n?void 0:n(e))&&t)};for(;o<a.length;){if(!c(a[o])){s.push(a[o]),i=!0,o++;continue}let e=o;for(;e<a.length&&c(a[e]);)e++;let t=e-o,n=!i,l=e>=a.length;if(!n&&!l)if(t<=2)for(let t=o;t<e;t++)s.push(a[t]);else s.push((0,r.x6)(a.slice(o,e).join("")));o=e}return s.join("\n")}function o(e){return i(e,{isStructuralRow:s})}},19985:(e,t,n)=>{n.d(t,{F5:()=>i,Fg:()=>r,HB:()=>l,Hv:()=>s});let r=0x1400000,a=[{extension:".png",mimeType:"image/png",magicBytes:[137,80,78,71]},{extension:".jpg",mimeType:"image/jpeg",magicBytes:[255,216,255]},{extension:".jpeg",mimeType:"image/jpeg",magicBytes:[255,216,255]},{extension:".gif",mimeType:"image/gif",magicBytes:[71,73,70,56]},{extension:".webp",mimeType:"image/webp",magicBytes:[82,73,70,70]},{extension:".svg",mimeType:"image/svg+xml"}];function l(e){return e?e.startsWith(".")?e.toLowerCase():"."+e.toLowerCase():""}let s=[".png",".jpg",".jpeg",".gif",".webp",".svg"].filter(e=>".svg"!==e),i=s.map(e=>(function(e){let t=l(e),n=a.find(e=>e.extension===t);return(null==n?void 0:n.mimeType)||"application/octet-stream"})(e)).filter(e=>"application/octet-stream"!==e).join(",")},20877:(e,t,n)=>{n.d(t,{Gg:()=>f,Gw:()=>a,HI:()=>u,aX:()=>d,eu:()=>l,fq:()=>m});let r={highlightName:"terminal-search",currentHighlightName:"terminal-search-current",fallbackOverlayId:"terminal-search-fallback-overlay",fallbackOverlayBgColor:"rgba(255, 165, 0, 0.6)"},a={highlightName:"history-search",currentHighlightName:"history-search-current",fallbackOverlayId:"history-search-fallback-overlay",fallbackOverlayBgColor:"rgba(59, 130, 246, 0.6)"};function l(e){return{highlightName:"history-search-".concat(e),currentHighlightName:"history-search-current-".concat(e),fallbackOverlayId:"history-search-fallback-overlay-".concat(e),fallbackOverlayBgColor:a.fallbackOverlayBgColor}}function s(){return"undefined"!=typeof CSS&&null!==CSS&&"highlights"in CSS}function i(e,t,n){let r=document.createRange(),a=!1;for(let{node:l,start:s,end:i}of e)if(!a&&t<i&&t>=s&&(r.setStart(l,t-s),a=!0),a&&n<=i)return r.setEnd(l,n-s),r;return a?r:null}function o(e){var t;s()&&(CSS.highlights.delete(e.highlightName),CSS.highlights.delete(e.currentHighlightName)),null==(t=document.getElementById(e.fallbackOverlayId))||t.remove()}function c(e,t,n,r){if(0===t.length)return void o(r);let a=function(e){let t,n=[],r=0,a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;t=a.nextNode();){var l,s;let e=null!=(s=null==(l=t.nodeValue)?void 0:l.length)?s:0;n.push({node:t,start:r,end:r+e}),r+=e}return n}(e),l=t[n],c=l?i(a,l.start,l.end):null;if(s()){let e=[];t.forEach((t,r)=>{if(r===n)return;let l=i(a,t.start,t.end);l&&e.push(l)}),CSS.highlights.set(r.highlightName,new Highlight(...e)),CSS.highlights.delete(r.currentHighlightName)}if(function(e,t,n){let r=document.getElementById(n.fallbackOverlayId);if(!t||"function"!=typeof t.getBoundingClientRect){null==r||r.remove();return}let a=t.getBoundingClientRect(),l=e.getBoundingClientRect();r?r.style.backgroundColor=n.fallbackOverlayBgColor:((r=document.createElement("div")).id=n.fallbackOverlayId,r.style.position="absolute",r.style.backgroundColor=n.fallbackOverlayBgColor,r.style.borderRadius="2px",r.style.pointerEvents="none",r.style.zIndex="5",e instanceof HTMLElement&&(e.style.position="relative"),e.appendChild(r)),r.style.top="".concat(a.top-l.top+e.scrollTop,"px"),r.style.left="".concat(a.left-l.left+e.scrollLeft,"px"),r.style.width="".concat(a.width,"px"),r.style.height="".concat(a.height,"px")}(e,c,r),c){let e=c.startContainer,t=e.nodeType===Node.TEXT_NODE?e.parentElement:e;t&&"function"==typeof t.scrollIntoView&&t.scrollIntoView({block:"center",behavior:"smooth"})}}function u(){o(r)}function d(e,t,n){c(e,t,n,r)}function m(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a;o(e)}function f(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:a;c(e,t,n,r)}},23570:(e,t,n)=>{n.d(t,{cV:()=>c,g6:()=>o});var r=n(95155),a=n(12115),l=n(87364),s=n(81507),i=n(72115);let o="worktree-history-pane",c=(0,a.memo)(function(e){let{history:t,terminal:n}=e,{visible:c,width:u,setWidth:d}=(0,s.TG)(),m=(0,a.useRef)(null),f=(0,a.useCallback)(e=>{let t=m.current;if(!t)return;let n=t.offsetWidth;0!==n&&d(u+e/n*100)},[u,d]);return(0,r.jsxs)("div",{ref:m,className:"flex h-full min-h-0 w-full",children:[null!=t&&(c?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{id:o,"data-testid":"terminal-container-history-slot","aria-label":"History pane",style:{width:"".concat(u,"%")},className:"flex-shrink-0 overflow-hidden transition-[width] duration-200 ease-in-out",children:(0,r.jsx)(l.t,{componentName:"HistoryPane",children:t})}),(0,r.jsx)(i.f,{onResize:f,orientation:"horizontal",ariaValueNow:u})]}):null),(0,r.jsx)("div",{"data-testid":"terminal-container-terminal-slot","aria-label":"Terminal pane",className:"flex-grow overflow-hidden min-w-0",children:(0,r.jsx)(l.t,{componentName:"TerminalAndFilePanel",children:n})})]})})},35252:(e,t,n)=>{n.d(t,{w:()=>s});var r=n(12115),a=n(78660);function l(e){if(0===e.length)return"0";let t=e[e.length-1],n=t.timestamp instanceof Date?t.timestamp.getTime():String(t.timestamp);return"".concat(e.length,"|").concat(t.id,"|").concat(n)}function s(e){let{messages:t}=e,[n,s]=(0,r.useState)(!1),[i,o]=(0,r.useState)(""),[c,u]=(0,r.useState)([]),[d,m]=(0,r.useState)(0),[f,p]=(0,r.useState)(!1),h=(0,r.useRef)(null),g=(0,r.useRef)(""),x=(0,r.useRef)(!1),b=(0,r.useRef)(l(t)),v=(0,r.useRef)(t);v.current=t;let y=c.reduce((e,t)=>e+t.ranges.length,0),w=(0,r.useMemo)(()=>(function(e,t){if(0===e.length||t<0)return null;let n=0;for(let r of e){if(t<n+r.ranges.length)return{messageId:r.messageId,localIndex:t-n};n+=r.ranges.length}return null})(c,d),[c,d]),k=(0,r.useCallback)(()=>{h.current&&(clearTimeout(h.current),h.current=null)},[]),j=(0,r.useCallback)(e=>{let{positions:t,capped:n}=function(e,t){if(t.length<a.E2||0===e.length)return{positions:[],capped:!1};let n=t.toLowerCase(),r=t.length,l=[],s=0,i=!1;for(let t of e){if(i)break;let o=t.content;if(!o)continue;let c=o.toLowerCase(),u=[],d=0;for(;;){let l=c.indexOf(n,d);if(-1===l)break;if(u.push({start:l,end:l+r}),d=l+1,(s+=1)>=a.F0){if(-1!==c.indexOf(n,d))i=!0;else{let r=e.indexOf(t)+1;for(let t=r;t<e.length;t++){let r=e[t].content;if(r&&-1!==r.toLowerCase().indexOf(n)){i=!0;break}}}break}}u.length>0&&l.push({messageId:t.id,ranges:u})}return{positions:l,capped:i}}(v.current,e);u(t),m(0),p(n)},[]),N=(0,r.useCallback)(e=>{k(),g.current=e,x.current||(h.current=setTimeout(()=>{j(e)},a.e1))},[k,j]),C=(0,r.useCallback)(e=>{o(e),N(e)},[N]),S=(0,r.useCallback)(()=>{s(!0)},[]),T=(0,r.useCallback)(()=>{s(!1),o(""),g.current="",u([]),m(0),p(!1),k()},[k]),M=(0,r.useCallback)(()=>{m(e=>0===y?0:(e+1)%y)},[y]),I=(0,r.useCallback)(()=>{m(e=>0===y?0:(e-1+y)%y)},[y]),E=(0,r.useCallback)(()=>{x.current=!0,k()},[k]),A=(0,r.useCallback)(()=>{x.current=!1;let e=g.current;e.length>=a.E2&&(k(),h.current=setTimeout(()=>{j(e)},a.e1))},[k,j]);return(0,r.useEffect)(()=>{let e=l(t);if(e===b.current)return;b.current=e;let n=g.current;n.length>=a.E2&&j(n)},[t,j]),(0,r.useEffect)(()=>()=>{k(),g.current=""},[k]),{isOpen:n,query:i,matchCount:y,currentIndex:d,isAtMaxMatches:f,matchPositions:c,currentMatch:w,openSearch:S,closeSearch:T,setQuery:C,onCompositionStart:E,onCompositionEnd:A,nextMatch:M,prevMatch:I}}},38218:(e,t,n)=>{n.d(t,{D:()=>l,a:()=>s});var r=n(12115);let a=r.useLayoutEffect,l=768;function s(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{breakpoint:t=l}=e,[n,s]=(0,r.useState)(!1);return a(()=>{let e=window.matchMedia("(max-width: ".concat(t-1,"px)"));s(e.matches);let n=e=>{s(e.matches)};return e.addEventListener("change",n),()=>{e.removeEventListener("change",n)}},[t]),n}},40240:(e,t,n)=>{n.d(t,{tY:()=>y,XU:()=>b});var r=n(95155),a=n(12115),l=n(18955),s=n(24033),i=n(51021),o=n(56827),c=n(49509),u=n(2317);let d={mobile:{storageKey:"commandmate:mobile:opencodeQuickKeysOpen",defaultOpen:!1},desktop:{storageKey:"commandmate:desktop:opencodeQuickKeysOpen",defaultOpen:!0}},m=e=>"boolean"==typeof e;function f(e){return[i.Mx,e]}let p=[{id:"agentNext",keys:["Tab"],notation:"tab"},{id:"agentPrev",keys:["BTab"],notation:"shift+tab"},{id:"commands",keys:["C-p"],notation:"ctrl+p"},{id:"variant",keys:["C-t"],notation:"ctrl+t"}],h=[{id:"agents",keys:f("a"),notation:"ctrl+x a"},{id:"sessions",keys:f("l"),notation:"ctrl+x l"},{id:"newSession",keys:f("n"),notation:"ctrl+x n"},{id:"models",keys:f("m"),notation:"ctrl+x m"},{id:"themes",keys:f("t"),notation:"ctrl+x t"}],g=[p,h,[{id:"timeline",keys:f("g"),notation:"ctrl+x g",sessionScoped:!0},{id:"undo",keys:f("u"),notation:"ctrl+x u",sessionScoped:!0},{id:"redo",keys:f("r"),notation:"ctrl+x r",sessionScoped:!0},{id:"compact",keys:f("c"),notation:"ctrl+x c",sessionScoped:!0}],[{id:"pageUp",keys:["PageUp"],notation:"pgup"},{id:"pageDown",keys:["PageDown"],notation:"pgdn"},{id:"first",keys:["Home"],notation:"home"},{id:"last",keys:["End"],notation:"end"}]],x=g.reduce((e,t)=>e+t.length,0),b=(0,a.memo)(function(e){let{worktreeId:t,cliToolId:n,instanceId:i,hasAgentSession:f,onKeysSent:p,compact:h=!1,collapsible:b=!1,layout:v="mobile"}=e,y=(0,l.c)("worktree"),{activeKey:w,markPressed:k}=(0,c.t)(),j=(0,o.B)(t,n,i,p),{open:N,toggle:C}=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"mobile",{storageKey:t,defaultOpen:n}=d[e],{value:r,setValue:l,isAvailable:s}=(0,u.V)({key:t,defaultValue:n,validate:m});return{open:r,toggle:(0,a.useCallback)(()=>l(e=>!e),[l]),isPersistent:s}}(v),S=(0,a.useId)(),T=(0,a.useCallback)(e=>{k(e.id),j([...e.keys])},[k,j]);if("opencode"!==n)return null;let M=(0,r.jsxs)("div",{className:"@container flex flex-wrap items-center gap-1.5 ".concat(b?"px-1.5 pb-1.5":"py-1.5 bg-muted rounded-lg"),id:b?S:void 0,role:"toolbar","aria-label":y("opencodeQuickKeys.toolbarLabel"),"data-testid":"opencode-quick-keys",children:[b?null:(0,r.jsx)("span",{className:"text-xs text-muted-foreground mx-2",children:y("opencodeQuickKeys.caption")}),g.map((e,t)=>(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[t>0?(0,r.jsx)("span",{className:"w-px h-6 bg-border mx-0.5","aria-hidden":"true"}):null,e.map(e=>{let t=y("opencodeQuickKeys.keys.".concat(e.id)),n=!0===e.sessionScoped&&!f;return(0,r.jsxs)("button",{type:"button",disabled:n,className:"min-h-[44px] px-3 py-2 text-sm font-medium rounded-md\n border border-border\n focus:outline-none focus:ring-2 focus:ring-ring\n transition-colors duration-75\n disabled:opacity-50 disabled:cursor-not-allowed\n ".concat(w===e.id?"bg-accent-500 text-white border-accent-500 scale-95":"bg-surface dark:bg-surface-2 hover:bg-muted active:bg-muted disabled:hover:bg-surface"),"aria-label":"".concat(t," (").concat(e.notation,")"),title:n?y("opencodeQuickKeys.needsSession",{notation:e.notation}):"".concat(t," — ").concat(e.notation),"data-testid":"opencode-quick-key-".concat(e.id),onClick:()=>T(e),children:[t,h?null:(0,r.jsx)("span",{className:"ml-1.5 text-xs text-muted-foreground hidden @min-[640px]:inline",children:e.notation})]},e.id)})]},e[0].id))]});return b?(0,r.jsxs)("div",{className:"bg-muted rounded-lg","data-testid":"opencode-quick-keys-disclosure",children:[(0,r.jsxs)("button",{type:"button",className:"w-full min-h-[44px] flex items-center gap-2 px-3 py-2 text-sm font-medium rounded-lg touch-manipulation transition-colors hover:bg-surface-2 active:bg-surface-2 focus:outline-none focus:ring-2 focus:ring-ring","aria-expanded":N,"aria-controls":S,"aria-label":N?y("opencodeQuickKeys.hideKeys"):y("opencodeQuickKeys.showKeys"),"data-testid":"opencode-quick-keys-toggle",onClick:C,children:[(0,r.jsx)(s.A,{className:"w-4 h-4 shrink-0 transition-transform duration-150 ".concat(N?"":"-rotate-90"),"aria-hidden":"true"}),(0,r.jsx)("span",{children:y("opencodeQuickKeys.toolbarLabel")}),(0,r.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:x})]}),N?M:null]}):M}),v=["variant","models","commands"].map(e=>{let t=[...p,...h].find(t=>t.id===e);if(!t)throw Error("OpencodeQuickKeys: unknown model key id ".concat(e));return t}),y=(0,a.memo)(function(e){let{worktreeId:t,cliToolId:n,instanceId:s,onKeysSent:i}=e,u=(0,l.c)("worktree"),{activeKey:d,markPressed:m}=(0,c.t)(),f=(0,o.B)(t,n,s,i),p=(0,a.useCallback)(e=>{m(e.id),f([...e.keys])},[m,f]);return"opencode"!==n?null:(0,r.jsxs)("div",{"data-testid":"opencode-model-keys",role:"toolbar","aria-label":u("selectionKeys.opencodeToolbarLabel"),className:"flex flex-wrap items-center gap-1.5 rounded-lg bg-muted px-2 py-1.5",children:[(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:u("selectionKeys.opencodeCaption")}),v.map(e=>{let t=u("opencodeQuickKeys.keys.".concat(e.id));return(0,r.jsxs)("button",{type:"button","data-testid":"opencode-model-key-".concat(e.id),"aria-label":"".concat(t," (").concat(e.notation,")"),title:"".concat(t," — ").concat(e.notation),onClick:()=>p(e),className:"min-h-[44px] rounded-md border border-border px-3 py-2 text-sm font-medium transition-colors duration-75 touch-manipulation focus:outline-none focus:ring-2 focus:ring-ring ".concat(d===e.id?"border-accent-500 bg-accent-500 text-white scale-95":"bg-surface hover:bg-muted active:bg-muted dark:bg-surface-2"),children:[t,(0,r.jsx)("span",{className:"ml-1.5 text-xs text-muted-foreground",children:e.notation})]},e.id)})]})})},41108:(e,t,n)=>{n.d(t,{UI:()=>c});var r=n(12115);function a(){return{pending:0,delivered:0,prompt:0,expired:0,cancelled:0}}let l=[],s=new Map;function i(){return{open:l,counts:a()}}async function o(e,t){try{var n;let r=await fetch("/api/relays?worktree=".concat(encodeURIComponent(e)));if(!r.ok)return;let i=await r.json();if(s.get(e)!==t)return;for(let e of(t.snapshot={open:Array.isArray(i.open)?i.open:l,counts:null!=(n=i.counts)?n:a()},t.listeners))e()}catch(e){}}function c(e){let[t]=(0,r.useState)(i),n=(0,r.useCallback)(t=>{let n;if(!e)return()=>{};let r=((n=s.get(e))||(n={snapshot:i(),listeners:new Set,timer:null,refs:0},s.set(e,n)),n.refs+=1,null===n.timer&&(o(e,n),n.timer=setInterval(()=>void o(e,n),2e4)),n);return r.listeners.add(t),()=>{r.listeners.delete(t),function(e){let t=s.get(e);t&&(t.refs-=1,t.refs>0||(t.timer&&clearInterval(t.timer),s.delete(e)))}(e)}},[e]),a=(0,r.useCallback)(()=>{var n,r;return e&&null!=(r=null==(n=s.get(e))?void 0:n.snapshot)?r:t},[e,t]),{open:l,counts:c}=(0,r.useSyncExternalStore)(n,a,a),u=(0,r.useCallback)(()=>{let t=e?s.get(e):void 0;e&&t&&o(e,t)},[e]);return(0,r.useMemo)(()=>({open:l,counts:c,owedBy:t=>l.filter(n=>n.to.worktreeId===e&&n.to.instanceId===t),awaitedBy:t=>l.filter(n=>n.from.worktreeId===e&&n.from.instanceId===t),refresh:u}),[l,c,e,u])}},49509:(e,t,n)=>{n.d(t,{t:()=>l});var r=n(12115),a=n(9900);function l(){let[e,t]=(0,r.useState)(null),n=(0,r.useRef)(null);return(0,r.useEffect)(()=>()=>{null!==n.current&&(clearTimeout(n.current),n.current=null)},[]),{activeKey:e,markPressed:(0,r.useCallback)(e=>{t(e),null!==n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{n.current=null,t(null)},a.tX)},[])}}},50857:(e,t,n)=>{function r(e){return"running"===e||"generating"===e||"waiting"===e}function a(e){return e.isActive||r(e.status)}function l(e,t){let n=e.map((e,t)=>({it:e,index:t})).filter(e=>{let{it:t}=e;return a(t)}),r=new Set;return t>0&&n.length>0&&[...n].sort((e,t)=>Number(t.it.isActive)-Number(e.it.isActive)||e.index-t.index).slice(0,t).forEach(e=>{let{index:t}=e;return r.add(t)}),e.map((e,t)=>a(e)?{...e,slot:r.has(t)?"pill":"overflow"}:{...e,slot:"dot"})}n.d(t,{Lm:()=>a,Qo:()=>r,Uw:()=>l})},51021:(e,t,n)=>{n.d(t,{Mx:()=>s,mE:()=>r,qL:()=>l});let r="s",a=["Up","Down","Left","Right","Enter","Escape","Tab","BTab","PageUp","PageDown","Home","End","q","1","2","3","4","5","6","7","8","9","y","n"];[...a];let l=["claude","command-code"],s="C-x",i=["C-p","C-t"],o=["a","l","t","m","g","u","r","c"];[...a,...i,...o],[...a,...i,...o]},51515:(e,t,n)=>{n.d(t,{aJ:()=>s,wJ:()=>i,x6:()=>o});let r="\\x1b\\][^\\x07\\x1b]*(?:\\x07|\\x1b\\\\)",a=RegExp(r,"g"),l=RegExp("\\x1b\\[[0-9;]*[a-zA-Z]|".concat(r,"|\\[[0-9;]*m"),"g");function s(e){return e.replace(l,"")}function i(e){return e.replace(a,"")}function o(e){let t=e.match(l);return t?t.join(""):""}},52771:(e,t,n)=>{n.d(t,{AO:()=>a.A,OS:()=>s,PD:()=>i});var r=n(68955),a=n(88894),l=n(51515);function s(e,t){let n=(0,a.h)(e);if(null===n)return r.J_;var s=null!=t?t:"";if(""===s)return r.J_;let i=function(e,t){let n=e.split("\n"),r=[];for(let e=n.length-1;e>=0&&r.length<t;e--){var a;let t=(0,l.aJ)(null!=(a=n[e])?a:"");""!==t.trim()&&r.push(t)}return r.reverse()}(s,n.tailRows);if(0===i.length)return r.J_;for(let e of n.indicators)if(i.some(t=>e.pattern.test(t)))return e.mode;return r.J_}function i(e){return"string"==typeof e&&(0,r.WK)(e)}},55813:(e,t,n)=>{n.d(t,{M:()=>s});var r=n(55041),a=n(8574);let l={en:a.c,ja:r.ja};function s(e){var t;return null!=(t=l[e])?t:a.c}},56827:(e,t,n)=>{n.d(t,{B:()=>l});var r=n(12115),a=n(9900);function l(e,t,n,l){return(0,r.useCallback)(r=>{let s=n&&n!==t?{cliToolId:t,keys:r,instanceId:n}:{cliToolId:t,keys:r};fetch("/api/worktrees/".concat(encodeURIComponent(e),"/special-keys"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}).then(()=>{l&&setTimeout(l,a.LK)}).catch(e=>{console.error("Failed to send special keys:",e)})},[e,t,n,l])}},60734:(e,t,n)=>{n.d(t,{y:()=>u});var r=n(95155),a=n(12115),l=n(18955),s=n(56827),i=n(49509);let o=[{key:"Left",label:"◀",ariaLabel:"Left"},{key:"Up",label:"▲",ariaLabel:"Up"},{key:"Down",label:"▼",ariaLabel:"Down"},{key:"Right",label:"▶",ariaLabel:"Right"},{key:"Enter",label:"↵",ariaLabel:"Enter"},{key:"Escape",label:"Esc",ariaLabel:"Escape"}],c=[{key:"PageUp",label:"PgUp",ariaLabel:"Page Up"},{key:"PageDown",label:"PgDn",ariaLabel:"Page Down"},{key:"Home",label:"Home",ariaLabel:"Home"},{key:"End",label:"End",ariaLabel:"End"},{key:"q",label:"q",ariaLabelKey:"navigation.quitPager"}];function u(e){let{worktreeId:t,cliToolId:n,instanceId:u,onKeysSent:d,showPagerKeys:m=!1}=e,f=(0,l.c)("worktree"),{activeKey:p,markPressed:h}=(0,i.t)(),g=(0,s.B)(t,n,u,d),x=(0,a.useCallback)(e=>{h(e[0]),g(e)},[h,g]),b=(0,a.useMemo)(()=>m?[...o,...c]:o,[m]),v=(0,a.useCallback)(e=>{let t={ArrowLeft:"Left",ArrowUp:"Up",ArrowDown:"Down",ArrowRight:"Right",Enter:"Enter",Escape:"Escape"}[e.key];t&&(e.preventDefault(),x([t]))},[x]);return(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 py-1.5 bg-muted rounded-lg",onKeyDown:v,role:"toolbar","aria-label":f("navigation.toolbarLabel"),children:[(0,r.jsx)("span",{className:"text-xs text-muted-foreground mx-2",children:f("navigation.caption")}),b.map(e=>{let{key:t,label:n,ariaLabel:a,ariaLabelKey:l}=e;return(0,r.jsx)("button",{type:"button",className:"min-w-[44px] min-h-[44px] px-3 py-2 text-sm font-medium rounded-md\n border border-border\n focus:outline-none focus:ring-2 focus:ring-ring\n transition-colors duration-75\n ".concat(p===t?"bg-accent-500 text-white border-accent-500 scale-95":"bg-surface dark:bg-surface-2 hover:bg-muted active:bg-muted"),"aria-label":l?f(l):a,onClick:()=>x([t]),children:n},t)})]})}},62560:(e,t,n)=>{n.d(t,{NK:()=>b});var r=n(12115),a=n(60199),l=n(51515);let s=/^[>❯]/,i=/^\u203A/;function o(e){return void 0===e||""===(0,l.aJ)(e).trim()}function c(e){let t=[],n={dim:!1,bold:!1},r=0;for(;r<e.length;){let a=e[r];if("\x1b"!==a){t.push({ch:a,dim:n.dim,bold:n.bold}),r++;continue}let l=e[r+1];if("["===l){let t=r+2;for(;t<e.length&&!/[A-Za-z]/.test(e[t]);)t++;if(t>=e.length)break;"m"===e[t]&&(n=function(e,t){let n=""===e?["0"]:e.split(";"),{dim:r,bold:a}=t;for(let e=0;e<n.length;e++){let t=""===n[e]?0:Number(n[e]);if(!Number.isNaN(t)){if(38===t||48===t||58===t){let t=""===n[e+1]||void 0===n[e+1]?-1:Number(n[e+1]);5===t?e+=2:2===t?e+=4:e+=1;continue}0===t||22===t?(r=!1,a=!1):1===t?a=!0:2===t&&(r=!0)}}return{dim:r,bold:a}}(e.slice(r+2,t),n)),r=t+1;continue}if("]"===l){let t=r+2;for(;t<e.length;){if("\x07"===e[t]){t++;break}if("\x1b"===e[t]&&"\\"===e[t+1]){t+=2;break}t++}r=t;continue}r+=2}return t}let u=new Set(["claude","codex"]);function d(e){let t=e.length;for(;t>0&&""===e[t-1].trim();)t--;return e.slice(0,t)}var m=n(52771),f=n(68955),p=n(67149);p.$C.activeMs,p.$C.idleMs,p.$C.wsFallbackMs;let h={session:null,context:null,diff:null};function g(e){var t,n,r,a,l,s,i,o,c,u,d,m;let f=e.session,p=e.context,h=e.diff;return JSON.stringify([null!=(t=null==f?void 0:f.title)?t:null,null!=(n=null==f?void 0:f.agent)?n:null,null!=(r=null==f?void 0:f.model)?r:null,null!=(a=null==f?void 0:f.cost)?a:null,null!=(l=null==f?void 0:f.tokens)?l:null,null!=(s=null==p?void 0:p.tokens)?s:null,null!=(i=null==p?void 0:p.limit)?i:null,null!=(o=null==p?void 0:p.percent)?o:null,null!=(c=null==h?void 0:h.turnMessageId)?c:null,null!=(u=null==h?void 0:h.revertedMessageId)?u:null,null!=(d=null==h?void 0:h.files.map(x))?d:null,null!=(m=null==h?void 0:h.revertedFiles.map(x))?m:null])}function x(e){var t,n;return"".concat(null!=(t=e.file)?t:"",":").concat(null!=(n=e.status)?n:"",":").concat(e.additions,":").concat(e.deletions)}function b(e){let{worktreeId:t,cliToolId:n,instanceId:x,enabled:b=!0,cadence:v=p.$C}=e,y=null!=x?x:n,[w,k]=(0,r.useState)(()=>({output:"",realtimeSnippet:"",isRunning:!1,isThinking:!1,sessionStatus:"",isSelectionListActive:!1,isPagerActive:!1,isDismissablePanelActive:!1,isUnclassifiedActive:!1,composerText:"",agentMode:f.J_,attaching:!0,autoScroll:!0})),[j,N]=(0,r.useState)(()=>({visible:!1,data:null,messageId:null,answering:!1})),[C,S]=(0,r.useState)(h),T=(0,r.useRef)(0),M=(0,r.useRef)(n);M.current=n;let I=(0,r.useRef)(y);I.current=y;let E=(0,r.useRef)(!1);(0,r.useEffect)(()=>(E.current=!0,()=>{E.current=!1}),[]);let A=(0,r.useRef)(j.visible);A.current=j.visible;let{connected:L,subscribe:R,unsubscribe:P,addListener:D}=(0,a.xM)(),z=(0,r.useRef)(0),O=(0,r.useRef)(0),F=(0,r.useRef)(null),H=(0,r.useRef)(null),[B,K]=(0,r.useState)(!1),q=(0,r.useCallback)(()=>{K(!0),null!==H.current&&clearTimeout(H.current),H.current=setTimeout(()=>{H.current=null,K(!1)},5e3)},[]),U=(0,r.useCallback)(e=>{var t,n;let r=null!=(n=null!=(t=e.fullOutput)?t:e.realtimeSnippet)?n:"";!0===e.isUnclassifiedActive&&!0!==e.isPromptWaiting&&!0!==e.isSelectionListActive&&!0!==e.isPagerActive&&!0!==e.isDismissablePanelActive?(O.current+=1,null!=F.current||(F.current=Date.now())):(O.current=0,F.current=null);let a=O.current>=2&&null!==F.current&&Date.now()-F.current>=500,p=e.isRunning?function(e,t){if(!u.has(t))return{text:"",state:"unsupported_tool"};let n=e.split("\n"),r=function(e,t){if("claude"===t){let t=function(e){var t;let n=e=>/^─{10,}$/.test((0,l.aJ)(e).trimEnd()),r=e.length-1;for(;r>=0&&""===e[r].trim();)r--;if(r<0)return null;let a=-1;for(let t=r;t>=Math.max(0,r-4);t--)if(n(e[t])){a=t;break}if(a<0)return null;let i=-1;for(let t=a-1;t>=Math.max(0,a-40);t--)if(n(e[t])){i=t;break}return i<0||!s.test((0,l.aJ)(null!=(t=e[i+1])?t:""))?null:{openingSeparator:i,closingSeparator:a}}(e);return null===t?null:{firstRow:t.openingSeparator+1,lastRow:t.closingSeparator-1,glyph:s}}let n=function(e){let t=e.length-1;for(;t>=0&&o(e[t]);)t--;if(t<0)return null;for(let n=0;n<4&&t>=0;n++){let n=t,r=t;for(;r>0&&!o(e[r-1]);)r--;if(function(e){if(void 0===e)return!1;let t=c(e);if(0===t.length||"›"!==t[0].ch||t[0].dim||t.length>1&&" "!==t[1].ch)return!1;let n=t.slice(2).find(e=>" "!==e.ch);return void 0===n||!n.bold}(e[r]))return{firstRow:r,lastRow:Math.min(n,r+40-1)};for(t=r-1;t>=0&&o(e[t]);)t--}return null}(e);return null===n?null:{firstRow:n.firstRow,lastRow:n.lastRow,glyph:i}}(n,t);if(null===r)return{text:"",state:"no_composer"};let a=[],m=[];for(let e=r.firstRow;e<=r.lastRow;e++){var f;let t=function(e,t,n){if(t){let t=e.findIndex(e=>n.test(e.ch));if(t<0)return e;let r=t+1;return r<e.length&&/\s/.test(e[r].ch)&&r++,e.slice(r)}let r=0;for(;r<2&&r<e.length&&" "===e[r].ch;)r++;return e.slice(r)}(c(null!=(f=n[e])?f:""),e===r.firstRow,r.glyph);a.push(t.filter(e=>!e.dim).map(e=>e.ch).join("").trimEnd()),m.push(t.map(e=>e.ch).join("").trimEnd())}let p=d(a).join("\n");return""!==p.trim()?{text:p.slice(0,2e3),state:"content"}:{text:"",state:""===d(m).join("\n").trim()?"empty":"ghost"}}(r,M.current).text:"",h=e.isRunning?(0,m.OS)(M.current,r):f.J_;k(t=>{var n,l,s,i,o,c,u;let d=!1===e.isRunning,m=!!r||!!e.isRunning||d;return{...t,output:m?r:t.output,realtimeSnippet:null!=(n=e.realtimeSnippet)?n:"",isRunning:null!=(l=e.isRunning)&&l,isThinking:null!=(s=e.thinking)&&s,sessionStatus:null!=(i=e.sessionStatus)?i:t.sessionStatus,isSelectionListActive:null!=(o=e.isSelectionListActive)&&o,isPagerActive:null!=(c=e.isPagerActive)&&c,isDismissablePanelActive:null!=(u=e.isDismissablePanelActive)&&u,isUnclassifiedActive:a,composerText:p,agentMode:h,attaching:!1}}),e.isPromptWaiting&&e.promptData?N(t=>{var n,r;return{...t,visible:!0,data:null!=(n=e.promptData)?n:t.data,messageId:null!=(r=t.messageId)?r:"prompt-".concat(Date.now())}}):!e.isPromptWaiting&&A.current&&N({visible:!1,data:null,messageId:null,answering:!1})},[]),W=(0,r.useCallback)(async()=>{let e=++T.current,r=()=>!E.current||T.current!==e||M.current!==n||I.current!==y;try{var a,l,s,i,o,c;let e=await fetch("/api/worktrees/".concat(t,"/current-output?cliTool=").concat(n,"&instance=").concat(encodeURIComponent(y)));if(!e.ok)return;let u=await e.json();if(r()||u.cliToolId&&u.cliToolId!==n)return;U(u);let d={session:null!=(i=null==(a=u.structuredEvents)?void 0:a.session)?i:null,context:null!=(o=null==(l=u.structuredEvents)?void 0:l.sessionContext)?o:null,diff:null!=(c=null==(s=u.structuredEvents)?void 0:s.sessionDiff)?c:null};S(e=>g(e)===g(d)?e:d)}catch(e){if(r())return;console.error("[useTerminalPanePolling] fetch error:",e)}},[t,n,y,U]),$="".concat(t,"::").concat(n,"::").concat(y),_=(0,r.useRef)($);(0,r.useEffect)(()=>{_.current!==$&&(_.current=$,T.current+=1,z.current=0,O.current=0,F.current=null,K(!1),null!==H.current&&(clearTimeout(H.current),H.current=null),k(e=>({...e,output:"",realtimeSnippet:"",isRunning:!1,isThinking:!1,sessionStatus:"",isSelectionListActive:!1,isPagerActive:!1,isDismissablePanelActive:!1,isUnclassifiedActive:!1,composerText:"",agentMode:f.J_,attaching:!0})),N({visible:!1,data:null,messageId:null,answering:!1}),S(h))},[$]),(0,r.useEffect)(()=>{if(b)return R(t),()=>P(t)},[b,t,R,P]),(0,r.useEffect)(()=>{z.current=0,K(!1),null!==H.current&&(clearTimeout(H.current),H.current=null)},[L]),(0,r.useEffect)(()=>()=>{null!==H.current&&clearTimeout(H.current)},[]),(0,r.useEffect)(()=>{if(b)return D(e=>{var n;if("terminal_snapshot"!==e.type||e.worktreeId!==t||e.cliToolId!==M.current||e.instanceId!==I.current||e.version<=z.current)return;z.current=e.version,q();let r=e.output.split("\n").slice(-100).join("\n");U({fullOutput:e.output,realtimeSnippet:r,isRunning:e.isRunning,sessionStatus:e.sessionStatus,thinking:e.thinking,isSelectionListActive:e.isSelectionListActive,isPagerActive:e.isPagerActive,isDismissablePanelActive:e.isDismissablePanelActive,isUnclassifiedActive:e.isUnclassifiedActive,isPromptWaiting:e.isPromptWaiting,promptData:null!=(n=e.promptData)?n:null})})},[b,t,D,U,q]),(0,r.useEffect)(()=>{if(b)return D(e=>{if("session_status_changed"===e.type)e.worktreeId===t&&!1===e.isRunning&&(null==e.instance||e.instance===I.current)&&(null==e.cliTool||e.cliTool===M.current)&&(z.current=0,U({fullOutput:"",realtimeSnippet:"",isRunning:!1,sessionStatus:"idle",thinking:!1,isSelectionListActive:!1,isPagerActive:!1,isDismissablePanelActive:!1,isUnclassifiedActive:!1,isPromptWaiting:!1,promptData:null}))})},[b,t,D,U]),(0,r.useEffect)(()=>{if(!b)return;let e=!1,t=j.visible||w.isSelectionListActive||w.isPagerActive||w.isDismissablePanelActive||w.isUnclassifiedActive,n=setInterval(()=>{"hidden"!==document.visibilityState&&W()},(0,p.lN)(v,{connected:L,pushHealthy:B,interactionActive:t,sessionAlive:w.isRunning,generating:(0,p.f8)(w.sessionStatus)}));"undefined"!=typeof document&&"hidden"!==document.visibilityState&&W();let r=()=>{"visible"!==document.visibilityState||e||W()};return document.addEventListener("visibilitychange",r),()=>{e=!0,null!==n&&(clearInterval(n),n=null),document.removeEventListener("visibilitychange",r)}},[b,v,L,B,w.isRunning,w.sessionStatus,w.isSelectionListActive,w.isPagerActive,w.isDismissablePanelActive,w.isUnclassifiedActive,j.visible,W]);let J=(0,r.useCallback)(e=>{k(t=>t.autoScroll===e?t:{...t,autoScroll:e})},[]),Q=(0,r.useCallback)(e=>{N(t=>({...t,answering:e}))},[]);return{terminal:w,prompt:j,agentSession:C,setAutoScroll:J,setPromptAnswering:Q,clearPrompt:(0,r.useCallback)(()=>{N({visible:!1,data:null,messageId:null,answering:!1})},[]),refresh:(0,r.useCallback)(()=>W(),[W])}}},63881:(e,t,n)=>{n.d(t,{b4:()=>c,lo:()=>o});var r=n(12115),a=n(8355);let l=r.useLayoutEffect;function s(e,t){return"".concat(a.S5).concat(e,":").concat(t)}function i(e,t){let n=null!=t&&Number.isFinite(t)?Math.min(t,a.bS):a.bS;return Math.max(a.bw,Math.min(Math.round(e),n))}function o(e){let{worktreeId:t,scope:n,maxHeight:o,enabled:c=!0}=e,u=c&&!!n,[d,m]=(0,r.useState)(null),f=(0,r.useRef)(null),p=(0,r.useRef)(o);l(()=>{let e=u&&n?function(e,t){try{return function(e){if(null===e)return null;let t=e.trim();if(""===t)return null;let n=Number(t);if(!Number.isFinite(n))return null;let r=Math.round(n);return r<a.bw||r>a.bS?null:r}(window.localStorage.getItem(s(e,t)))}catch(e){return null}}(t,n):null;f.current=e,m(e)},[u,t,n]),l(()=>{p.current=o},[o]);let h=(0,r.useCallback)((e,r)=>{if(!u||!n||!Number.isFinite(e))return;let a=p.current,l=null===f.current?i(r,a):i(f.current,a),o=i(l+e,a);f.current=o,m(o);try{window.localStorage.setItem(s(t,n),String(i(o)))}catch(e){}},[u,t,n]),g=(0,r.useCallback)(()=>{if(u&&n){f.current=null,m(null);try{window.localStorage.removeItem(s(t,n))}catch(e){}}},[u,t,n]),x=u?d:null,b=null===x?null:i(x,o);return{storedHeight:x,height:b,resizeBy:h,reset:g}}function c(e,t,n){let[a,s]=(0,r.useState)(null),i=(0,r.useRef)(null);return l(()=>{if(!e||!t||"undefined"==typeof ResizeObserver)return;let r=t.querySelector('[data-testid="message-input-textarea"]');if(!r)return;let a=()=>{let t=function(e,t,n){let r=e.parentElement;if(!r)return null;let a=t.getBoundingClientRect().height;if(a<=0)return null;let l=0;for(let t of Array.from(r.children)){if(t===e||!(t instanceof HTMLElement))continue;let{display:n,position:r}=window.getComputedStyle(t);"none"!==n&&"absolute"!==r&&"fixed"!==r&&(l+=t.getBoundingClientRect().height)}return Math.floor(a+(function(e){let t=window.getComputedStyle(e),n=e=>parseFloat(e)||0;return e.getBoundingClientRect().height-n(t.borderTopWidth)-n(t.borderBottomWidth)-n(t.paddingTop)-n(t.paddingBottom)}(r)-l)-n)}(e,r,n);null!==t&&t!==i.current&&(i.current=t,s(t))},l=new ResizeObserver(a),o=e.parentElement;return o&&l.observe(o),l.observe(e),l.observe(t),l.observe(r),a(),()=>l.disconnect()},[e,t,n]),a}},64653:(e,t,n)=>{n.d(t,{o4:()=>s});var r=n(76246);let a={method:"HEAD",cache:"no-store"},l=(e,t)=>fetch(e,t);async function s(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l;try{var s;return(s=await n("/api/worktrees/".concat(encodeURIComponent(e),"/files/").concat((0,r.o)(t)),a)).ok?"present":404===s.status||400===s.status||403===s.status?"missing":"unknown"}catch(e){return"unknown"}}},67149:(e,t,n)=>{n.d(t,{$C:()=>r,WT:()=>s,f8:()=>o,lN:()=>c,sD:()=>a,tC:()=>l,z1:()=>u});let r={activeMs:2e3,idleMs:5e3,wsFallbackMs:15e3,activeRequiresGenerating:!1,idleTrustsConnection:!1},a={activeMs:4e3,idleMs:1e4,wsFallbackMs:15e3,activeRequiresGenerating:!0,idleTrustsConnection:!0},l={pollMs:5e3,wsFallbackMs:15e3},s={pollMs:15e3,wsFallbackMs:3e4},i=new Set(["running","waiting"]);function o(e){return i.has(e)}function c(e,t){if(t.interactionActive)return e.activeMs;let n=e.activeRequiresGenerating?t.generating:t.sessionAlive;return t.connected&&t.pushHealthy||t.connected&&!n&&e.idleTrustsConnection?e.wsFallbackMs:n?e.activeMs:e.idleMs}function u(e,t){return t.connected?e.wsFallbackMs:e.pollMs}},68276:(e,t,n)=>{n.d(t,{LT:()=>r,XF:()=>a});let r="unclassified";function a(e){return null!=e&&e.type!==r}},68394:(e,t,n)=>{n.d(t,{EK:()=>c,Wq:()=>i,pN:()=>u});var r=n(51515);let a=new Set(["claude","codex","opencode"]),l=new Set(["opencode"]),s=new Set(["opencode"]),i={wrapMode:"frame",density:"compact"},o=/\x1b\[[0-9;]*m/g;function c(e){return{compactTuiLayoutPadding:a.has(e),preservePaintedPanelRows:l.has(e),mobileWrapMode:s.has(e)?"frame":"viewport"}}function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:400,n=1;for(let a of e.split("\n")){let e=(0,r.wJ)(a).replace(o,"").trimEnd().length;if(e>n&&(n=e),n>=t)return t}return n}},68872:(e,t,n)=>{n.d(t,{ED:()=>a,ZJ:()=>r,yi:()=>l});let r=1048576,a="[... 古い出力を省略しました / older output truncated ...]",l=65536},68955:(e,t,n)=>{n.d(t,{J_:()=>a,WK:()=>l});let r=["default","manual","accept-edits","plan","auto","autopilot","bypass","dont-ask"],a="unknown";function l(e){return r.includes(e)}},70738:(e,t,n)=>{n.d(t,{h:()=>u,z:()=>o});var r=n(69352);let a=/^(https?|mailto|tel|file):/i,l=/^[a-zA-Z][a-zA-Z0-9+.-]*:/,s=/^file:\/\/(localhost)?/i,i=/:\d+(?::\d+)?$/;function o(e){let t=(0,r.d3)(e.trim());return t?t.startsWith("#")?"anchor":s.test(t)?"file":l.test(t)&&!a.test(t)?null:"external"===(0,r.dj)(t)?"external":"file":null}function c(e){let t=[];for(let n of e.split("/"))if(""!==n&&"."!==n){if(".."===n){t.pop();continue}t.push(n)}return t.join("/")}function u(e,t){var n;if("file"!==o(e))return null;let r=(function(e){try{return decodeURIComponent(e)}catch(t){return e}})((function(e){let t=e.indexOf("#");return -1===t?e:e.slice(0,t)})(e.trim().replace(s,"")).replace(i,"")).trim();if(!r)return null;if(!r.startsWith("/"))return c(r)||null;let a=t?(n=t.trim()).length>1&&n.endsWith("/")?n.replace(/\/+$/,""):n:"";return a&&a.startsWith("/")?r===a?null:r.startsWith("".concat(a,"/"))?c(r.slice(a.length+1))||null:r:r}},72115:(e,t,n)=>{n.d(t,{f:()=>u});var r=n(95155),a=n(12115),l=n(18955);let s=["relative","flex-shrink-0","bg-border","transition-colors","duration-150","hover:bg-accent-500","dark:hover:bg-accent-500","focus:outline-none","focus:ring-2","focus:ring-ring","focus:ring-offset-2","focus:ring-offset-background"],i=["w-1","h-full","cursor-col-resize","before:content-['']","before:absolute","before:inset-y-0","before:-inset-x-1"],o=["h-1","w-full","cursor-row-resize","before:content-['']","before:absolute","before:inset-x-0","before:-inset-y-1"];function c(e,t){return"touches"in e&&e.touches.length>0?t?e.touches[0].clientX:e.touches[0].clientY:"clientX"in e?t?e.clientX:e.clientY:0}let u=(0,a.memo)(function(e){let{onResize:t,orientation:n="horizontal",ariaValueNow:u=50,onDoubleClick:d,minRatio:m=.1,ariaLabel:f}=e,p=(0,l.c)("worktree"),[h,g]=(0,a.useState)(!1),x=(0,a.useRef)(0),b=(0,a.useRef)(null),v="horizontal"===n,y=(0,a.useCallback)(e=>{e.preventDefault(),g(!0),x.current=c(e,v)},[v]),w=(0,a.useCallback)(e=>{1===e.touches.length&&(g(!0),x.current=c(e,v))},[v]),k=(0,a.useCallback)(e=>{if(!h)return;let n=c(e,v);t(n-x.current),x.current=n},[h,v,t]),j=(0,a.useCallback)(e=>{if(!h||1!==e.touches.length)return;let n=c(e,v);t(n-x.current),x.current=n},[h,v,t]),N=(0,a.useCallback)(()=>{g(!1)},[]),C=(0,a.useCallback)(()=>{d&&d()},[d]),S=(0,a.useCallback)(e=>{let n=0;v?"ArrowRight"===e.key?n=10:"ArrowLeft"===e.key&&(n=-10):"ArrowDown"===e.key?n=10:"ArrowUp"===e.key&&(n=-10),0!==n&&(e.preventDefault(),t(n))},[v,t]);(0,a.useEffect)(()=>(h&&(document.addEventListener("mousemove",k),document.addEventListener("mouseup",N),document.addEventListener("touchmove",j),document.addEventListener("touchend",N),document.body.style.userSelect="none",document.body.style.cursor=v?"col-resize":"row-resize"),()=>{document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",N),document.removeEventListener("touchmove",j),document.removeEventListener("touchend",N),document.body.style.userSelect="",document.body.style.cursor=""}),[h,k,N,j,v]);let T=(0,a.useMemo)(()=>[...s,...v?i:o,...h?["bg-accent-500","dark:bg-accent-500","dragging",v?"w-2":"h-2"]:[]].join(" "),[v,h]);return(0,r.jsx)("div",{ref:b,role:"separator","aria-orientation":n,"aria-valuenow":u,"aria-valuemin":0,"aria-valuemax":100,"aria-label":null!=f?f:p("paneResizer.label",{arrows:p(v?"paneResizer.arrowsHorizontal":"paneResizer.arrowsVertical")}),tabIndex:0,className:T,onMouseDown:y,onTouchStart:w,onKeyDown:S,onDoubleClick:C})})},73190:(e,t,n)=>{n.d(t,{U:()=>u});var r=n(95155),a=n(12115),l=n(56827),s=n(49509);let i=[{key:"Left",label:"◀",ariaLabel:"Send Left"},{key:"Up",label:"▲",ariaLabel:"Send Up"},{key:"Down",label:"▼",ariaLabel:"Send Down"},{key:"Right",label:"▶",ariaLabel:"Send Right"},{key:"Enter",label:"↵",ariaLabel:"Send Enter"}],o={key:"Escape",label:"Esc",ariaLabel:"Send Escape"},c={key:"q",label:"q",ariaLabel:"Send q (quit)"};function u(e){let{worktreeId:t,cliToolId:n,instanceId:u,onKeysSent:d}=e,{activeKey:m,markPressed:f}=(0,s.t)(),p=(0,l.B)(t,n,u,d),h="codex"===n?[...i,o,c]:[...i,o],g=(0,a.useCallback)(e=>{f(e),p([e])},[f,p]);return(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 py-1.5 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800/50 rounded-lg",role:"toolbar","aria-label":"Terminal navigation keys",children:[(0,r.jsx)("span",{className:"text-xs text-amber-700 dark:text-amber-400 mx-2",title:"Send navigation / escape keys when the terminal is stuck in a TUI overlay",children:"Navigate"}),h.map(e=>{let{key:t,label:n,ariaLabel:a}=e;return(0,r.jsx)("button",{type:"button",className:"min-w-[44px] min-h-[44px] px-3 py-2 text-sm font-medium rounded-md\n border border-amber-300 dark:border-amber-700\n focus:outline-none focus:ring-2 focus:ring-amber-500\n transition-colors duration-75\n ".concat(m===t?"bg-amber-500 text-white border-amber-500 scale-95":"bg-white dark:bg-gray-700 hover:bg-amber-50 dark:hover:bg-gray-600 active:bg-amber-100 dark:active:bg-gray-500"),"aria-label":a,onClick:()=>g(t),children:n},t)})]})}},73333:(e,t,n)=>{n.d(t,{E:()=>z});var r=n(95155),a=n(12115),l=n(18955),s=n(80344),i=n(79651),o=n(28019);function c(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e=>{var t;return null!=(t=e.description)?t:""};if(!t.trim())return e;let r=t.toLowerCase();return e.map(e=>({...e,commands:e.commands.filter(e=>{let t=e.name.toLowerCase().includes(r),a=n(e).toLowerCase().includes(r);return t||a})})).filter(e=>e.commands.length>0)}function u(e,t){return"codex-skill"===e.source?"antigravity"===t?"/".concat(e.name):"$".concat(e.name):"/".concat(e.name)}function d(e,t){var n;return e.descriptionKey?t(e.descriptionKey):null!=(n=e.description)?n:""}function m(e){let{groups:t,onSelect:n,highlightedIndex:a=-1,className:s="",cliToolId:i}=e,o=(0,l.c)("worktree"),c=0;return 0===t.length?(0,r.jsx)("div",{className:"text-sm text-muted-foreground p-4 text-center ".concat(s),children:o("slashCommands.empty")}):(0,r.jsx)("div",{className:"overflow-y-auto ".concat(s),children:t.map(e=>(0,r.jsxs)("div",{className:"mb-2",children:[(0,r.jsx)("div",{className:"px-3 py-1.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider bg-muted",children:e.label}),(0,r.jsx)("div",{children:e.commands.map(e=>{var t;let l=c;c++;let s=l===a;return(0,r.jsxs)("button",{type:"button","data-command-item":!0,"data-highlighted":s,onClick:()=>n(e),className:"w-full px-3 py-2 text-left flex items-start gap-2 hover:bg-accent-50 dark:hover:bg-accent-900/30 transition-colors ".concat(s?"bg-accent-100 dark:bg-accent-900/40":""),children:[(0,r.jsx)("span",{className:"text-accent-600 dark:text-accent-400 font-mono text-sm flex-shrink-0",children:u(e,i)}),(null==(t=e.cliTools)?void 0:t.length)===1&&"codex"===e.cliTools[0]&&(0,r.jsx)("span",{className:"mt-0.5 rounded border border-accent-200 bg-accent-50 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-accent-700 dark:border-accent-800 dark:bg-accent-950/40 dark:text-accent-300",children:"Codex"}),"user-catalog"===e.source&&(0,r.jsx)("span",{"data-testid":"user-catalog-badge",className:"mt-0.5 rounded border border-border bg-muted px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:o("slashCommands.sourceBadge.userCatalog")}),(0,r.jsx)("span",{className:"text-muted-foreground text-sm truncate",children:d(e,o)})]},e.name)})})]},e.category))})}function f(e,t,n){if(t<=0||n<=0)return 0;let r=e+t+8-n;return r>0?-Math.min(r,Math.max(0,e-8)):e<8?8-e:0}let p=(0,a.memo)(function(e){let{isOpen:t,groups:n,onSelect:s,onClose:i,isMobile:o=!1,position:u,onFreeInput:p,isCatalogStale:h=!1,cliToolId:g}=e,[x,b]=(0,a.useState)(""),[v,y]=(0,a.useState)(0),w=(0,a.useRef)(null),k=(0,a.useRef)(null),j=(0,a.useRef)({x:0,y:0}),[N,C]=(0,a.useState)({x:0,y:0}),S=(0,l.c)("worktree"),T=(0,l.c)("common"),M=(0,a.useMemo)(()=>c(n,x,e=>d(e,S)),[n,x,S]),I=(0,a.useMemo)(()=>M.flatMap(e=>e.commands),[M]);(0,a.useEffect)(()=>{t&&(b(""),y(0),setTimeout(()=>{var e;null==(e=w.current)||e.focus()},50))},[t]);let E=(0,a.useCallback)(e=>{s(e),i()},[s,i]),A=(0,a.useCallback)(e=>{if(t)switch(e.key){case"Escape":e.preventDefault(),i();break;case"ArrowDown":e.preventDefault(),y(e=>Math.min(e+1,I.length-1));break;case"ArrowUp":e.preventDefault(),y(e=>Math.max(e-1,0));break;case"Enter":e.preventDefault(),I[v]&&E(I[v])}},[t,I,v,i,E]);if((0,a.useEffect)(()=>{if(t)return document.addEventListener("keydown",A),()=>{document.removeEventListener("keydown",A)}},[t,A]),(0,a.useLayoutEffect)(()=>{let e=e=>{j.current=e,C(t=>t.x===e.x&&t.y===e.y?t:e)};if(!t||o)return void e({x:0,y:0});let n=k.current;if(!n)return;let r=n.getBoundingClientRect();e({x:f(r.left-j.current.x,r.width,window.innerWidth),y:f(r.top-j.current.y,r.height,window.innerHeight)})},[t,o,M,null==u?void 0:u.top,null==u?void 0:u.left]),!t)return null;let L=h?(0,r.jsx)("div",{"data-testid":"slash-command-stale-note",className:"px-3 py-2 border-t border-border text-xs text-muted-foreground",children:S("slashCommands.catalogStale.hint")}):null;if(o)return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"fixed inset-0 bg-black/50 z-40",onClick:i,"aria-hidden":"true"}),(0,r.jsxs)("div",{"data-testid":"slash-command-bottom-sheet",className:"fixed bottom-0 left-0 right-0 bg-surface rounded-t-xl z-50 max-h-[70vh] flex flex-col shadow-xl",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold text-foreground",children:S("slashCommands.title")}),(0,r.jsx)("button",{type:"button",onClick:i,"aria-label":T("close"),className:"p-2 rounded-full hover:bg-muted",children:(0,r.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,r.jsx)("div",{className:"px-4 py-2 border-b border-border",children:(0,r.jsx)("input",{ref:w,type:"text",value:x,onChange:e=>b(e.target.value),placeholder:S("slashCommands.searchPlaceholder"),className:"w-full px-3 py-2 border border-input bg-surface dark:bg-surface-2 text-foreground rounded-lg focus:outline-none focus:ring-2 focus:ring-ring"})}),p&&(0,r.jsxs)("button",{type:"button","data-testid":"free-input-button",onClick:()=>p(x),className:"w-full px-4 py-3 text-left border-b border-border flex items-center gap-2 hover:bg-accent-50 dark:hover:bg-accent-900/30 transition-colors",children:[(0,r.jsx)("span",{className:"text-accent-600 dark:text-accent-400",children:(0,r.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),(0,r.jsx)("span",{className:"text-muted-foreground",children:S("slashCommands.enterCustomCommand")})]}),(0,r.jsx)(m,{groups:M,onSelect:E,highlightedIndex:v,className:"flex-1 overflow-y-auto pb-20",cliToolId:g}),L]})]});let R=u?{top:u.top,left:u.left}:{bottom:"100%",left:0,marginBottom:"4px"};return(0,r.jsxs)("div",{ref:k,role:"listbox","data-testid":"slash-command-dropdown",className:"absolute bg-surface border border-border rounded-lg shadow-lg z-50 w-80 max-h-96 flex flex-col",style:0!==N.x||0!==N.y?{...R,transform:"translate(".concat(N.x,"px, ").concat(N.y,"px)")}:R,children:[(0,r.jsx)("div",{className:"px-3 py-2 border-b border-border",children:(0,r.jsx)("input",{ref:w,type:"text",value:x,onChange:e=>b(e.target.value),placeholder:S("slashCommands.searchPlaceholder"),className:"w-full px-3 py-1.5 text-sm border border-input bg-surface dark:bg-surface-2 text-foreground rounded focus:outline-none focus:ring-1 focus:ring-ring"})}),p&&(0,r.jsxs)("button",{type:"button","data-testid":"free-input-button",onClick:()=>p(x),className:"w-full px-3 py-2 text-left border-b border-border flex items-center gap-2 hover:bg-accent-50 dark:hover:bg-accent-900/30 transition-colors text-sm",children:[(0,r.jsx)("span",{className:"text-accent-600 dark:text-accent-400",children:(0,r.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),(0,r.jsx)("span",{className:"text-muted-foreground",children:S("slashCommands.enterCustomCommand")})]}),(0,r.jsx)(m,{groups:M,onSelect:E,highlightedIndex:v,className:"flex-1 overflow-y-auto",cliToolId:g}),L,(0,r.jsxs)("div",{className:"px-3 py-1.5 border-t border-border text-xs text-muted-foreground flex gap-3",children:[(0,r.jsxs)("span",{children:[(0,r.jsx)("kbd",{className:"px-1 py-0.5 bg-muted rounded",children:"Enter"})," ",S("slashCommands.selectHint")]}),(0,r.jsxs)("span",{children:[(0,r.jsx)("kbd",{className:"px-1 py-0.5 bg-muted rounded",children:"Esc"})," ",S("slashCommands.closeHint")]})]})]})});var h=n(3005);let g=(0,a.memo)(function(e){let{worktreeId:t,cliToolId:n,instanceId:s,disabled:i=!1,onInterrupt:o}=e,c=(0,l.c)("worktree"),[u,d]=(0,a.useState)(!1),m=(0,a.useRef)(0),f=(0,a.useCallback)(async()=>{let e=Date.now();if(!(e-m.current<1e3)){m.current=e,d(!0);try{let e=s&&s!==n?{cliToolId:n,instanceId:s}:{cliToolId:n},r=await fetch("/api/worktrees/".concat(t,"/interrupt"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(r.ok)null==o||o();else{let e=await r.json().catch(()=>({}));console.error("[InterruptButton] Failed to send interrupt:",e.error||r.statusText)}}catch(e){console.error("[InterruptButton] Error sending interrupt:",e)}finally{d(!1)}}},[t,n,s,o]);return(0,r.jsx)("button",{type:"button",onClick:f,disabled:i||u,className:"flex-shrink-0 p-2 text-danger hover:bg-danger/10 rounded-full transition-colors disabled:text-muted-foreground/40 disabled:hover:bg-transparent","aria-label":c("interrupt.stopProcessing"),"data-testid":"interrupt-button",children:u?(0,r.jsx)(h.y,{size:"md"}):(0,r.jsx)(x,{})})});function x(){return(0,r.jsx)("svg",{className:"h-5 w-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})}var b=n(44309),v=n(50386),y=n(62512),w=n(4788),k=n(5917),j=n(75426),N=n(77588);let C=(0,a.memo)(function(e){let{worktreeId:t,cliToolId:n,instanceId:s,disabled:i=!1,onActionComplete:c,showToast:u}=e,d=(0,l.c)("worktree.opencodeSession"),m=(0,o.SC)(),[f,p]=(0,a.useState)(null),[h,g]=(0,a.useState)(null),[x,C]=(0,a.useState)(null),[S,T]=(0,a.useState)(!1),[M,I]=(0,a.useState)(null),E="opencode"===n,A=null!=s?s:n,L=(0,a.useCallback)(e=>{if(u){I(null),u(e,"error");return}I(e)},[u]),R=(0,a.useCallback)((e,t,n)=>"NO_OPENCODE_PORT"===e.code?d("errorNoPort"):"NO_OPENCODE_SESSION"===e.code?d(n):e.error||t||d("errorUnknown"),[d]),P=(0,a.useCallback)(async()=>{if(E)try{let e=await fetch("/api/worktrees/".concat(t,"/opencode/share?instance=").concat(encodeURIComponent(A)));if(!e.ok)return void g(null);g(await e.json())}catch(e){g(null)}},[E,t,A]);(0,a.useEffect)(()=>{P()},[P]);let D=(0,a.useCallback)(async e=>{p(e),I(null);try{let n=await fetch("/api/worktrees/".concat(t,"/opencode/session"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e,instanceId:A})});if(!n.ok){let t=await n.json().catch(()=>({}));console.error("[OpencodeSessionControls] action failed:",e,t.error||n.statusText),L(R(t,n.statusText,"errorNoSessionFork"));return}null==c||c(e),"list"!==e&&(C(null),P())}catch(e){console.error("[OpencodeSessionControls] request error:",e),L(d("errorRequestFailed"))}finally{p(null)}},[t,A,c,P,L,R,d]),z=(0,a.useCallback)(async()=>{if(await m({title:d("shareConfirmTitle"),description:d("shareConfirmBody"),confirmLabel:d("shareConfirmLabel"),variant:"danger"})){p("share"),I(null);try{let e=await fetch("/api/worktrees/".concat(t,"/opencode/share"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({instanceId:A})}),n=await e.json().catch(()=>({}));if(!e.ok||"string"!=typeof n.url){console.error("[OpencodeSessionControls] share failed:",n.error||e.statusText),L(R(n,e.statusText,"errorNoSessionShare")),P();return}C(n.url),T(!1),P()}catch(e){console.error("[OpencodeSessionControls] share request error:",e),L(d("errorRequestFailed"))}finally{p(null)}}},[m,d,t,A,P,L,R]),O=(0,a.useCallback)(async()=>{p("unshare"),I(null);try{let e=await fetch("/api/worktrees/".concat(t,"/opencode/share?instance=").concat(encodeURIComponent(A)),{method:"DELETE"});if(!e.ok){let t=await e.json().catch(()=>({}));console.error("[OpencodeSessionControls] unshare failed:",t.error||e.statusText),L(R(t,e.statusText,"errorNoSessionShare"));return}C(null),T(!1),P()}catch(e){console.error("[OpencodeSessionControls] unshare request error:",e),L(d("errorRequestFailed"))}finally{p(null)}},[t,A,P,L,R,d]),F=(0,a.useCallback)(async()=>{if(null!==x)try{await navigator.clipboard.writeText(x),T(!0),I(null)}catch(e){console.error("[OpencodeSessionControls] clipboard write failed:",e),L(d("errorCopyFailed"))}},[x,L,d]);if(!E)return null;let H=[{action:"new",icon:(0,r.jsx)(b.A,{className:"h-5 w-5","aria-hidden":"true"})},{action:"list",icon:(0,r.jsx)(v.A,{className:"h-5 w-5","aria-hidden":"true"})},{action:"fork",icon:(0,r.jsx)(y.A,{className:"h-5 w-5","aria-hidden":"true"})}],B="flex-shrink-0 p-2 text-muted-foreground hover:text-accent-600 hover:bg-accent-50 dark:hover:text-accent-400 dark:hover:bg-accent-900/30 rounded-full transition-colors disabled:text-muted-foreground/50 disabled:hover:bg-transparent";return(0,r.jsxs)("div",{className:"flex items-center gap-1","data-testid":"opencode-session-controls",children:[H.map(e=>{let{action:t,icon:n}=e;return(0,r.jsx)(o.$n,{variant:"ghost",type:"button",onClick:()=>void D(t),disabled:i||null!==f,className:B,"aria-label":d(t),title:d(t),"data-testid":"opencode-session-".concat(t),children:f===t?(0,r.jsx)(o.y$,{size:"md"}):n},t)}),(null==h?void 0:h.canShare)?(0,r.jsx)(o.$n,{variant:"ghost",type:"button",onClick:()=>void z(),disabled:i||null!==f,className:B,"aria-label":d("share"),title:d("share"),"data-testid":"opencode-session-share",children:"share"===f?(0,r.jsx)(o.y$,{size:"md"}):(0,r.jsx)(w.A,{className:"h-5 w-5","aria-hidden":"true"})}):null,null!==x?(0,r.jsxs)("span",{className:"flex min-w-0 items-center gap-1 rounded-full border border-warning-border bg-warning-subtle px-2 py-0.5 text-xs text-warning-foreground","data-testid":"opencode-share-result",children:[(0,r.jsx)("span",{className:"sr-only",children:d("sharePublicNotice")}),(0,r.jsx)("a",{href:x,target:"_blank",rel:"noopener noreferrer",className:"truncate text-accent-600 underline dark:text-accent-400",title:x,"data-testid":"opencode-share-url",children:x}),(0,r.jsx)(o.$n,{variant:"ghost",type:"button",onClick:()=>void F(),className:"flex-shrink-0 rounded-full p-1 text-muted-foreground hover:text-accent-600","aria-label":d("shareCopy"),title:d("shareCopy"),"data-testid":"opencode-share-copy",children:S?(0,r.jsx)(k.A,{className:"h-3.5 w-3.5","aria-hidden":"true"}):(0,r.jsx)(j.A,{className:"h-3.5 w-3.5","aria-hidden":"true"})}),(0,r.jsx)(o.$n,{variant:"ghost",type:"button",onClick:()=>void O(),disabled:null!==f,className:"flex-shrink-0 rounded-full p-1 text-muted-foreground hover:text-danger-foreground","aria-label":d("unshare"),title:d("unshare"),"data-testid":"opencode-session-unshare",children:"unshare"===f?(0,r.jsx)(o.y$,{size:"sm"}):(0,r.jsx)(N.A,{className:"h-3.5 w-3.5","aria-hidden":"true"})})]}):null,null!==M?(0,r.jsx)("span",{role:"alert",className:"flex min-w-0 items-center rounded-full border border-danger-border bg-danger-subtle px-2 py-0.5 text-xs text-danger-foreground",title:M,"data-testid":"opencode-session-error",children:(0,r.jsx)("span",{className:"truncate",children:M})}):null]})});var S=n(72115),T=n(74385),M=n(38218),I=n(19985),E=n(63881),A=n(8355);let L="commandmate:draft-message:",R="Queued (session busy) — your message will run after the current task finishes.",P=a.useLayoutEffect;function D(e,t){return"".concat(L).concat(e,":").concat(t)}let z=(0,a.memo)(function(e){let{worktreeId:t,onMessageSent:n,cliToolId:d,instanceId:m,isSessionRunning:f=!1,pendingInsertText:h,onInsertConsumed:x,splitIndex:b=0,onFocus:v,isProcessing:y=!1,showToast:w,autoYesSlot:k,agentModeSlot:j,onOptimisticSend:N,heightScope:z,maxHeight:O}=e,F=(0,l.c)("worktree"),[H,B]=(0,a.useState)(""),[K,q]=(0,a.useState)(!1),[U,W]=(0,a.useState)(null),[$,_]=(0,a.useState)(!1),[J,Q]=(0,a.useState)(!1),[Y,G]=(0,a.useState)(!1),V=(0,a.useRef)(null),Z=(0,a.useRef)(null),X=(0,a.useRef)(!1),ee=(0,a.useRef)(null),et=(0,a.useRef)(null),en=(0,M.a)(),{groups:er,isCatalogStale:ea}=function(e,t){let[n,r]=(0,a.useState)([]),[l,i]=(0,a.useState)(!0),[o,u]=(0,a.useState)(null),[d,m]=(0,a.useState)(""),[f,p]=(0,a.useState)(t||"claude"),[h,g]=(0,a.useState)({}),x=(0,a.useCallback)(async()=>{try{var n;i(!0),u(null);let a=e?"/api/worktrees/".concat(e,"/slash-commands"):"/api/slash-commands";t&&(a+="?cliTool=".concat(t));let l=await fetch(a,{cache:"no-store"});if(!l.ok)throw Error("HTTP error ".concat(l.status));let s=await l.json();r(s.groups),p(s.cliTool||t||"claude"),g(null!=(n=s.catalogStaleness)?n:{})}catch(e){u((0,s.hS)(e)),r([]),g({})}finally{i(!1)}},[e,t]);(0,a.useEffect)(()=>{x()},[x]),(0,a.useEffect)(()=>{if(!e)return;let t=t=>{let n=t.detail;(null==n?void 0:n.worktreeId)===e&&x()};return window.addEventListener(T.I,t),()=>window.removeEventListener(T.I,t)},[e,x]);let b=(0,a.useMemo)(()=>n.flatMap(e=>e.commands),[n]),v=(0,a.useMemo)(()=>c(n,d),[n,d]),y=(0,a.useMemo)(()=>Object.values(h).some(e=>e.stale),[h]);return{groups:n,filteredGroups:v,allCommands:b,loading:l,error:o,filter:d,setFilter:m,refresh:(0,a.useCallback)(()=>{x()},[x]),cliTool:f,isCatalogStale:y}}(t,d),el=!en&&!!z,{height:es,resizeBy:ei,reset:eo}=(0,E.lo)({worktreeId:t,scope:z,maxHeight:O,enabled:el}),ec="number"==typeof O&&Number.isFinite(O)?O:1/0,eu=(0,a.useCallback)(e=>{var t,n;ei(-e,null!=(n=null==(t=V.current)?void 0:t.getBoundingClientRect().height)?n:A.bw)},[ei]),{attachedImage:ed,fileInputRef:em,isUploading:ef,error:ep,acceptAttribute:eh,openFileDialog:eg,handleFileSelect:ex,removeAttachment:eb,resetAfterSend:ev}=function(e,t){let[n,r]=(0,a.useState)(null),[l,s]=(0,a.useState)(!1),[i,o]=(0,a.useState)(null),c=(0,a.useRef)(null),u=(0,a.useCallback)(()=>{var e;null==(e=c.current)||e.click()},[]),d=(0,a.useCallback)(async n=>{var a;let l=null==(a=n.target.files)?void 0:a[0];if(!l)return;o(null);let i=function(e){let t=e.name.lastIndexOf(".");if(-1===t)return"Unsupported file format";let n=(0,I.HB)(e.name.substring(t));if(!I.Hv.includes(n))return"Unsupported file format: ".concat(n);if(e.size>I.Fg){let e=I.Fg/1024/1024;return"File size exceeds ".concat(e,"MB limit")}return null}(l);if(i){o(i),c.current&&(c.current.value="");return}s(!0);try{let n=await t(e,l);r({file:l,path:n.path})}catch(e){o(e instanceof Error?e.message:"Upload failed")}finally{s(!1),c.current&&(c.current.value="")}},[e,t]),m=(0,a.useCallback)(()=>{r(null),o(null)},[]),f=(0,a.useCallback)(()=>{r(null)},[]);return{attachedImage:n,fileInputRef:c,isUploading:l,error:i,acceptAttribute:I.F5,openFileDialog:u,handleFileSelect:d,removeAttachment:m,resetAfterSend:f}}(t,(0,a.useCallback)((e,t)=>s.y.uploadImageFile(e,t),[]));(0,a.useEffect)(()=>{try{0===b&&function(e){try{let t="".concat(L).concat(e),n=window.localStorage.getItem(t);if(null===n)return;let r=D(e,0);null===window.localStorage.getItem(r)&&window.localStorage.setItem(r,n),window.localStorage.removeItem(t)}catch(e){}}(t);let e=window.localStorage.getItem(D(t,b));e?B(e):B("")}catch(e){}return()=>{et.current&&clearTimeout(et.current)}},[t,b]),(0,a.useEffect)(()=>{et.current&&clearTimeout(et.current),et.current=setTimeout(()=>{try{let e=D(t,b);H?window.localStorage.setItem(e,H):window.localStorage.removeItem(e)}catch(e){}},500)},[H,t,b]),P(()=>{let e=V.current;if(!e)return;let t="number"==typeof O&&Number.isFinite(O)?O:1/0,n=Math.min(null!=es?es:A.bw,t);if(!H){e.style.height="".concat(n,"px");return}e.style.height="auto";let r=Math.min(e.scrollHeight,A.vF);e.style.height="".concat(Math.min(Math.max(n,r),t),"px")},[H,es,O]),(0,a.useEffect)(()=>{h&&(B(e=>""===e.trim()?h:e+"\n\n"+h),null==x||x())},[h,x]);let ey=(0,a.useCallback)(async()=>{if($||!H.trim()&&!ed||K)return;let e=H.trim(),r=d||"claude",a={cliToolId:r};if(m&&m!==r&&(a.instanceId=m),ed&&(a.imagePath=ed.path),N){W(null),N(e,a),B(""),G(!1),ev();try{window.localStorage.removeItem(D(t,b))}catch(e){}y&&(null==w||w(R,"warning")),null==n||n(r);return}try{q(!0),W(null);let l=await s.y.sendMessage(t,e,a);B(""),G(!1),ev();try{window.localStorage.removeItem(D(t,b))}catch(e){}y&&(null==w||w(R,"warning")),null==n||n(r,l)}catch(e){W((0,s.hS)(e))}finally{q(!1)}},[$,H,ed,K,t,d,m,n,ev,b,y,w,N]),ew=(0,a.useCallback)(async e=>{e.preventDefault(),await ey()},[ey]),ek=(0,a.useCallback)(()=>{_(!0),X.current=!1,Z.current&&clearTimeout(Z.current)},[]),ej=(0,a.useCallback)(()=>{_(!1),X.current=!0,Z.current&&clearTimeout(Z.current),Z.current=setTimeout(()=>{X.current=!1},300)},[]),eN=(0,a.useCallback)(e=>{var t;B("".concat(u(e,d)," ")),Q(!1),null==(t=V.current)||t.focus()},[d]),eC=(0,a.useCallback)(()=>{var e;Q(!1),G(!1),null==(e=V.current)||e.focus()},[]),eS=(0,a.useCallback)(e=>{Q(!1),G(!0),B(e?"/".concat(e):"/"),setTimeout(()=>{var e;null==(e=V.current)||e.focus()},50)},[]),eT=(0,a.useCallback)(e=>{let t=e.target.value;if(B(t),""===t){G(!1),Q(!1);return}if(Y)return;let n="/"===t||t.startsWith("/")&&!t.includes(" "),r="codex"===d&&("$"===t||t.startsWith("$")&&!t.includes(" "));n||r?Q(!0):Q(!1)},[Y,d]),eM=(0,a.useCallback)(e=>{let{keyCode:t}=e.nativeEvent;if(229!==t){if("Escape"===e.key&&J){e.preventDefault(),eC();return}if(X.current&&"Enter"===e.key){X.current=!1;return}if("Enter"===e.key&&!$&&(!J||Y)){if(en)return;e.shiftKey||(e.preventDefault(),ey())}}},[J,Y,$,en,ey,eC]),eI=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.$n,{variant:"ghost",type:"button",onClick:eg,disabled:ef||K,className:"flex-shrink-0 p-2 text-muted-foreground hover:text-accent-600 hover:bg-accent-50 dark:hover:text-accent-400 dark:hover:bg-accent-900/30 rounded-full transition-colors disabled:text-muted-foreground/50 disabled:hover:bg-transparent","aria-label":F("composer.attachImage"),"data-testid":"attach-image-button",children:ef?(0,r.jsx)(o.y$,{size:"md"}):(0,r.jsx)("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.172 7l-6.586 6.586a2 2 0 102.828 2.828l6.414-6.586a4 4 0 00-5.656-5.656l-6.415 6.585a6 6 0 108.486 8.486L20.5 13"})})}),(0,r.jsx)(C,{worktreeId:t,cliToolId:d||"claude",instanceId:m,disabled:!f,showToast:w}),j]}),eE=(0,r.jsx)(g,{worktreeId:t,cliToolId:d||"claude",instanceId:m,disabled:!f});return(0,r.jsxs)("div",{ref:ee,className:"space-y-2 relative","data-testid":"message-input-container",children:[(U||ep)&&(0,r.jsx)("div",{className:"p-2 bg-danger-subtle border border-danger-border rounded text-sm text-danger-foreground",children:U||ep}),ed&&(0,r.jsxs)("div",{className:"flex items-center gap-2 px-4 py-1.5 bg-accent-50 dark:bg-accent-900/20 border border-accent-200 dark:border-accent-800 rounded-lg text-sm","data-testid":"image-attachment-preview",children:[(0,r.jsx)("svg",{className:"h-4 w-4 flex-shrink-0 text-accent-600 dark:text-accent-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})}),(0,r.jsx)("span",{className:"truncate text-accent-800 dark:text-accent-300",children:ed.file.name}),(0,r.jsx)("button",{type:"button",onClick:eb,className:"flex-shrink-0 p-0.5 text-accent-600 hover:text-danger-foreground dark:text-accent-400 rounded transition-colors","aria-label":F("composer.removeAttachment"),"data-testid":"remove-attachment-button",children:(0,r.jsx)("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,r.jsx)("input",{ref:em,type:"file",accept:eh,onChange:ex,className:"hidden","data-testid":"image-file-input"}),(0,r.jsxs)("form",{onSubmit:ew,className:"relative rounded-xl bg-surface border border-border shadow-sm px-3 py-2 focus-within:ring-2 focus-within:ring-accent-500/40 transition-shadow flex flex-col gap-1.5",children:[el&&(0,r.jsx)("div",{className:"absolute inset-x-3 top-0 -translate-y-1/2","data-testid":"composer-resize-handle","data-height-mode":null===es?"auto":"floor",children:(0,r.jsx)(S.f,{orientation:"vertical",onResize:eu,onDoubleClick:eo,ariaLabel:F("composer.resizeHandle"),ariaValueNow:function(e,t){if(null===e||null==t)return 0;let n=t-A.bw;return n<=0?100:Math.round(Math.min(100,Math.max(0,(e-A.bw)/n*100)))}(es,O)})}),(0,r.jsxs)("div",{className:"@container flex flex-col gap-1","data-testid":"composer-input-row",children:[(0,r.jsx)("div",{className:"flex items-center gap-1","data-testid":"composer-toolbar",children:en?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.$n,{variant:"ghost",type:"button",onClick:()=>{Y&&G(!1),Q(!0)},className:"flex-shrink-0 p-2 text-muted-foreground hover:text-accent-600 hover:bg-accent-50 dark:hover:text-accent-400 dark:hover:bg-accent-900/30 rounded-full transition-colors","aria-label":F("composer.showSlashCommands"),"data-testid":"mobile-command-button",children:(0,r.jsx)("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 20l4-16m2 16l4-16M6 9h14M4 15h14"})})}),eI,eE]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto scrollbar-hide","data-testid":"composer-toolbar-start",children:eI}),(0,r.jsx)("div",{className:"flex flex-shrink-0 items-center","data-testid":"composer-toolbar-end",children:eE})]})}),(0,r.jsxs)("div",{className:"flex ".concat(en?"items-center":"items-end"," gap-2 flex-1 min-w-0"),"data-testid":"composer-textarea-row",children:[(0,r.jsx)("textarea",{ref:V,"data-testid":"message-input-textarea",value:H,onChange:eT,onKeyDown:eM,onCompositionStart:ek,onCompositionEnd:ej,onFocus:v,placeholder:F("composer.placeholder"),disabled:K,rows:1,inputMode:"text",enterKeyHint:"send",className:"flex-1 outline-none bg-transparent resize-none overflow-y-auto scrollbar-thin",style:{minHeight:"".concat(Math.min(null!=es?es:A.bw,ec),"px"),maxHeight:"".concat(Math.min(Math.max(null!=es?es:0,A.vF),ec),"px"),paddingTop:"8px",paddingBottom:"8px",lineHeight:"20px"}}),(0,r.jsx)(o.$n,{variant:"ghost",type:"submit","data-testid":"send-message-button","data-can-send":String((!!H.trim()||!!ed)&&!K),disabled:!H.trim()&&!ed||K,className:"flex-shrink-0 p-2 rounded-full transition-colors disabled:hover:bg-transparent ".concat((H.trim()||ed)&&!K?"bg-accent-600 text-white hover:bg-accent-700 shadow-sm":"text-muted-foreground/50"),"aria-label":F("composer.sendMessage"),children:K?(0,r.jsx)(o.y$,{size:"md"}):(0,r.jsx)("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"})})})]})]}),(k||!en)&&(0,r.jsxs)("div",{className:"".concat(en?"":"@container ","flex items-center justify-between gap-2 min-w-0"),"data-testid":"composer-meta-row",children:[(0,r.jsx)("div",{className:"flex items-center gap-2 min-w-0 overflow-x-auto scrollbar-hide".concat(en?"":" whitespace-nowrap"),"data-testid":"composer-auto-yes",children:k}),!en&&(0,r.jsxs)("div",{className:"hidden @min-[420px]:flex flex-shrink-0 items-center gap-1.5 whitespace-nowrap text-[11px] text-muted-foreground select-none","data-testid":"composer-hints",children:[(0,r.jsx)(i.u,{children:"/"}),(0,r.jsx)("span",{children:F("composer.commandsHint")}),(0,r.jsx)("span",{"aria-hidden":"true",className:"opacity-50",children:"\xb7"}),(0,r.jsx)(i.u,{children:"⇧"}),(0,r.jsx)(i.u,{children:"↵"}),(0,r.jsx)("span",{children:F("composer.newlineHint")})]})]})]}),(0,r.jsx)(p,{isOpen:J,groups:er,onSelect:eN,onClose:eC,isMobile:en,onFreeInput:eS,isCatalogStale:ea,cliToolId:d})]})})},75676:(e,t,n)=>{n.d(t,{jg:()=>l,kQ:()=>s,mR:()=>c,mS:()=>o,wf:()=>r});let r="terminal",a=new Set(["terminal","chat"]);function l(e){return"string"==typeof e&&a.has(e)}let s={data:null,messageId:null,visible:!1,answering:!1},i={mode:"split",mobileActivePane:"terminal",leftPaneTab:"history",splitRatio:.5,leftPaneCollapsed:!1,activityBar:{active:"files"},historyPane:{visible:!0,width:25,collapsed:!1}},o={type:null,message:null,retryable:!1,retryCount:0};function c(){return{phase:"idle",prompt:{...s},layout:{...i},error:{...o},messages:[],wsConnected:!1}}},76351:(e,t,n)=>{n.d(t,{z9:()=>l,$s:()=>o,t6:()=>s,Ni:()=>i,eJ:()=>u,$B:()=>d,P0:()=>c});var r=n(82912),a=n.n(r);n(95704);let l=[36e5,108e5,288e5],s=36e5,i={36e5:"autoYes.durations.1h",108e5:"autoYes.durations.3h",288e5:"autoYes.durations.8h"},o=1e3;function c(e){if(e.length>500)return{valid:!1,error:"Pattern must be ".concat(500," characters or less")};if(!a()(e))return{valid:!1,error:"Pattern may cause performance issues (catastrophic backtracking detected)"};try{return new RegExp(e),{valid:!0}}catch(e){return{valid:!1,error:"Invalid regular expression syntax"}}}function u(e,t){arguments.length>2&&void 0!==arguments[2]&&arguments[2];try{return e.test(t)}catch(e){return null}}function d(e){let t=Math.max(0,e-Date.now()),n=Math.floor(t/36e5),r=Math.floor(t%36e5/6e4),a=Math.floor(t%6e4/1e3);return n>0?"".concat(n,":").concat(r.toString().padStart(2,"0"),":").concat(a.toString().padStart(2,"0")):"".concat(r.toString().padStart(2,"0"),":").concat(a.toString().padStart(2,"0"))}},78596:(e,t,n)=>{n.d(t,{l5:()=>d});var r=n(46980),a=n.n(r),l=n(62459),s=n.n(l),i=n(68872),o=n(51515);let c=new(s())({fg:"#d1d5db",bg:"#1f2937",newline:!0,escapeXML:!0}),u=/[\x40-\x7e]/;function d(e){let t=function(e){if(e.length<=i.ZJ)return e;let t=i.ED+"\n",n=i.ZJ-t.length;if(n<=0)return i.ED.slice(0,i.ZJ);let r=e.length-n,a=e.indexOf("\n",r);if(-1!==a&&a-r<=i.yi)return t+e.slice(a+1);let l=function(e,t){let n=e.lastIndexOf("\x1b",t-1);if(-1===n)return t;let r=e.slice(n+1,t);if(u.test(r.slice(1)))return t;for(let n=t;n<e.length;n++)if(u.test(e[n]))return n+1;return e.length}(e,r),s=e.charCodeAt(l);return s>=56320&&s<=57343&&(l+=1),t+e.slice(l)}(e.replace(/\0/g,"")),n=(0,o.wJ)(t),r=c.toHtml(n);return a().sanitize(r,{ALLOWED_TAGS:["span","br"],ALLOWED_ATTR:["style"],ALLOW_DATA_ATTR:!1})}},78660:(e,t,n)=>{n.d(t,{E2:()=>i,F0:()=>l,Yr:()=>o,e1:()=>s});var r=n(12115),a=n(20877);let l=500,s=300,i=2;function o(e){let{output:t,containerRef:n}=e,[o,c]=(0,r.useState)(!1),[u,d]=(0,r.useState)(""),[m,f]=(0,r.useState)([]),[p,h]=(0,r.useState)(0),[g,x]=(0,r.useState)(!1),b=(0,r.useRef)(null),v=(0,r.useRef)(""),y=m.length,w=(0,r.useCallback)(e=>{var t;if(e.length<i||!n.current)return{positions:[],capped:!1};let r=(null!=(t=n.current.textContent)?t:"").toLowerCase(),a=e.toLowerCase(),s=[],o=0;for(;s.length<l;){let t=r.indexOf(a,o);if(-1===t)break;s.push({start:t,end:t+e.length}),o=t+1}let c=s.length>=l&&-1!==r.indexOf(a,o);return{positions:s,capped:c}},[n]),k=(0,r.useCallback)(e=>{let{positions:t,capped:r}=w(e);f(t),h(0),x(r),n.current&&(t.length>0?(0,a.aX)(n.current,t,0):(0,a.HI)())},[w,n]),j=(0,r.useCallback)(e=>{d(e),b.current&&clearTimeout(b.current),v.current=e,b.current=setTimeout(()=>{k(e)},s)},[k]),N=(0,r.useCallback)(()=>{c(!0)},[]),C=(0,r.useCallback)(()=>{c(!1),d(""),v.current="",f([]),h(0),x(!1),b.current&&clearTimeout(b.current),(0,a.HI)()},[]),S=(0,r.useCallback)(()=>{0!==y&&h(e=>{let t=(e+1)%y;return n.current&&m.length>0&&(0,a.aX)(n.current,m,t),t})},[y,m,n]),T=(0,r.useCallback)(()=>{0!==y&&h(e=>{let t=(e-1+y)%y;return n.current&&m.length>0&&(0,a.aX)(n.current,m,t),t})},[y,m,n]);return(0,r.useEffect)(()=>{v.current.length<i||k(v.current)},[t,k]),(0,r.useEffect)(()=>()=>{b.current&&clearTimeout(b.current),(0,a.HI)()},[]),{isOpen:o,query:u,matchCount:y,currentIndex:p,isAtMaxMatches:g,openSearch:N,closeSearch:C,setQuery:j,nextMatch:S,prevMatch:T}}},79321:(e,t,n)=>{n.d(t,{CL:()=>z,Et:()=>q,UI:()=>B,a3:()=>O,vY:()=>$,ZS:()=>Z,Gn:()=>ee,qI:()=>ea,PZ:()=>W,ZK:()=>er});var r=n(95155),a=n(12115),l=n(18955),s=n(24033),i=n(27937),o=n(1473),c=n(53842),u=n(22479),d=n(76907),m=n(49502),f=n(35299),p=n(6132),h=n(48314),g=n(65229),x=n(75426),b=n(82437),v=n(54916),y=n(51238),w=n(10934),k=n(5225),j=n(4300),N=n(83012),C=n(51515),S=n(89568),T=n(99112),M=n(70738);let I=/^>[ \t]*\*\*Thinking(?:[ \t]*\((\d+)\))?\*\*[ \t]*$/,E="Tool calls",A=new RegExp("^>[ \\t]*\\*\\*".concat(E,"(?:[ \\t]*\\((\\d+)\\))?\\*\\*[ \\t]*$")),L=/^- `[^`\n]+`(?: — .*)?$/;function R(e){return{prose:e,toolLog:"",toolCalls:0}}function P(e){let t=function(e){if("string"!=typeof e||0===e.length)return R(null!=e?e:"");if(!e.includes(E)&&!e.startsWith("- `"))return R(e);let t=e.split("\n"),n=t.length;for(;n>0&&0===t[n-1].trim().length;)n-=1;for(let e=n-1;e>=0;e-=1){let r=A.exec(t[e]);if(!r){if(!t[e].startsWith(">"))break;continue}if(e>0&&t[e-1].startsWith(">"))break;let a=t.slice(e+1,n).map(e=>e.replace(/^>[ \t]?/,"")).join("\n").replace(/^\n+/,"").replace(/\n+$/,""),l=r[1]?Number.parseInt(r[1],10):0;return{prose:t.slice(0,e).join("\n").replace(/\n+$/,""),toolLog:a,toolCalls:Number.isFinite(l)&&l>0?l:a.split("\n").filter(e=>e.trim().length>0).length}}let r=0;for(;r<t.length&&L.test(t[r]);)r+=1;return 0===r?R(e):{prose:t.slice(r).join("\n").replace(/^\n+/,""),toolLog:t.slice(0,r).join("\n"),toolCalls:r}}(e),n=function(e){if(!e.includes("Thinking"))return{body:e,reasoning:null,blocks:0};let t=e.split("\n"),n=[],r=[],a=0,l=0;for(;l<t.length;){let e=I.exec(t[l]),s=0===l||!t[l-1].startsWith(">");if(!e||!s){n.push(t[l]),l+=1;continue}let i=l+1;for(;i<t.length&&t[i].startsWith(">");)i+=1;let o=e[1]?Number.parseInt(e[1],10):1;a+=Number.isFinite(o)&&o>0?o:1,r.push(t.slice(l+1,i).map(e=>e.replace(/^>[ \t]?/,"")).join("\n").replace(/^\n+/,"").replace(/\n+$/,"")),l=i}return 0===a?{body:e,reasoning:null,blocks:0}:{body:n.join("\n").replace(/\n{3,}/g,"\n\n").trim(),reasoning:r.join("\n\n").replace(/^\n+/,"").replace(/\n+$/,""),blocks:a}}(t.prose);return{body:n.body,reasoning:n.reasoning,reasoningBlocks:n.blocks,toolLog:t.toolLog,toolCalls:t.toolCalls,folded:t.prose!==e||null!==n.reasoning}}var D=n(92147);let z="mr-auto w-full max-w-full px-1 text-sm text-foreground",O="chat-bubble",F="chat-turn-header",H="chat-turn-time",B="flex w-full flex-col gap-1 pb-3",K="max-w-full overflow-x-hidden break-words [word-break:break-word]",q="".concat(K," chat-md"),U=a.createContext({showAll:!1}),W=U.Provider,$={showAll:!0},_="mr-auto flex w-fit max-w-full items-center gap-1.5 rounded-full border border-border bg-surface-2 px-2.5 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring";function J(){let{showAll:e}=a.useContext(U),[t,n]=(0,a.useState)(null),r=null!==t&&t.against===e?t.isOpen:e,l=(0,a.useCallback)(()=>n({against:e,isOpen:!r}),[e,r]);return{isOpen:r,toggle:l}}let Q=(0,a.memo)(function(e){let{blocks:t,children:n}=e,a=(0,l.c)("worktree"),{isOpen:c,toggle:u}=J(),d=c?s.A:i.A;return(0,r.jsxs)("div",{"data-testid":"chat-thinking-group","data-thinking-blocks":t,className:"mt-2 flex w-full flex-col gap-1",children:[(0,r.jsxs)("button",{type:"button","data-testid":"chat-thinking-toggle",onClick:u,"aria-expanded":c,"aria-label":a(c?"chatTranscript.thinking.collapse":"chatTranscript.thinking.expand"),className:_,children:[(0,r.jsx)(o.A,{size:12,"aria-hidden":"true"}),(0,r.jsx)("span",{children:a("chatTranscript.thinking.summary",{count:t})}),(0,r.jsx)(d,{size:12,"aria-hidden":"true"})]}),c&&(0,r.jsx)("div",{"data-testid":"chat-thinking-body",className:"max-w-full border-l-2 border-border pl-2 text-muted-foreground",children:n})]})}),Y=(0,a.memo)(function(e){let{toolCalls:t,children:n}=e,a=(0,l.c)("worktree"),{isOpen:o,toggle:u}=J(),d=o?s.A:i.A;return(0,r.jsxs)("div",{"data-testid":"chat-tool-log-group","data-tool-calls":t,className:"mt-2 flex w-full flex-col gap-1",children:[(0,r.jsxs)("button",{type:"button","data-testid":"chat-tool-log-toggle",onClick:u,"aria-expanded":o,"aria-label":a(o?"chatTranscript.toolLog.collapse":"chatTranscript.toolLog.expand"),className:_,children:[(0,r.jsx)(c.A,{size:12,"aria-hidden":"true"}),(0,r.jsx)("span",{children:a("chatTranscript.toolLog.summary",{count:t})}),(0,r.jsx)(d,{size:12,"aria-hidden":"true"})]}),o&&(0,r.jsx)("div",{"data-testid":"chat-tool-log-body",className:"max-w-full border-l-2 border-border pl-2 text-muted-foreground",children:n})]})}),G={claude:!0,codex:!0,antigravity:!0,"command-code":!0,opencode:!0,copilot:!1,gemini:!1,"vibe-local":!1},V=(0,a.memo)(function(e){let{children:t}=e,n=(0,l.c)("worktree"),{isOpen:a,toggle:o}=J(),c=a?s.A:i.A;return(0,r.jsxs)("div",{"data-testid":"chat-pane-scrape-group",className:"flex w-full flex-col gap-1",children:[(0,r.jsxs)("button",{type:"button","data-testid":"chat-pane-scrape-toggle",onClick:o,"aria-expanded":a,className:_,children:[(0,r.jsx)(u.A,{size:12,"aria-hidden":"true"}),(0,r.jsx)("span",{children:n("agentSource.kindScraper")}),(0,r.jsx)(c,{size:12,"aria-hidden":"true"})]}),a&&(0,r.jsx)("div",{"data-testid":"chat-pane-scrape-body",className:"max-w-full border-l-2 border-border pl-2 text-muted-foreground",children:t})]})}),Z=(0,a.memo)(function(e){var t;let{href:n,children:s,onFilePathClick:i,...o}=e,c=(0,l.c)("worktree"),u=n?(0,M.z)(n):null,d=(0,a.useCallback)(e=>{n&&(e.preventDefault(),i(n))},[n,i]);return n&&null!==u&&"anchor"!==u?"external"===u?(0,r.jsx)("a",{...o,href:n,target:"_blank",rel:"noopener noreferrer",children:s}):(0,r.jsx)("a",{...o,href:n,"data-testid":"chat-file-link",onClick:d,className:"cursor-pointer font-mono text-sm text-accent-700 underline-offset-2 hover:underline dark:text-accent-400","aria-label":c("conversation.openFile",{path:null!=(t=(0,M.h)(n))?t:n}),children:s}):(0,r.jsx)("a",{...o,href:n,children:s})}),X=(0,a.memo)(function(e){let{content:t,onFilePathClick:n}=e,s=(0,l.c)("worktree"),i=(0,a.useMemo)(()=>(0,S.ML)(t),[t]),o=(0,a.useCallback)(e=>()=>n(e),[n]);return(0,r.jsx)("span",{children:i.map((e,t)=>"path"===e.type?(0,r.jsx)("button",{type:"button",onClick:o(e.content),className:"cursor-pointer font-mono text-sm text-accent-700 underline-offset-2 hover:underline dark:text-accent-400","aria-label":s("conversation.openFile",{path:e.content}),children:e.content},t):(0,r.jsx)("span",{children:e.content},t))})}),ee=(0,a.memo)(function(e){let{content:t,onFilePathClick:n}=e,l=(0,a.useMemo)(()=>{let e=e=>a.Children.map(e,e=>"string"==typeof e?(0,r.jsx)(X,{content:e,onFilePathClick:n}):e);return{p:t=>{let{children:n}=t;return(0,r.jsx)("p",{children:e(n)})},li:t=>{let{children:n}=t;return(0,r.jsx)("li",{children:e(n)})},td:t=>{let{children:n}=t;return(0,r.jsx)("td",{children:e(n)})},th:t=>{let{children:n}=t;return(0,r.jsx)("th",{children:e(n)})},strong:t=>{let{children:n}=t;return(0,r.jsx)("strong",{children:e(n)})},em:t=>{let{children:n}=t;return(0,r.jsx)("em",{children:e(n)})},a:e=>{let{href:t,children:a,node:l,...s}=e;return(0,r.jsx)(Z,{...s,href:t,onFilePathClick:n,children:a})}}},[n]),s=(0,a.useMemo)(()=>[w.A,k.A],[]),i=(0,a.useMemo)(()=>P(t),[t]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(y.oz,{remarkPlugins:T.eT,rehypePlugins:s,components:l,children:i.body}),null!==i.reasoning&&(0,r.jsx)(Q,{blocks:i.reasoningBlocks,children:(0,r.jsx)(y.oz,{remarkPlugins:T.eT,rehypePlugins:s,components:l,children:i.reasoning})}),i.toolCalls>0&&(0,r.jsx)(Y,{toolCalls:i.toolCalls,children:(0,r.jsx)(y.oz,{remarkPlugins:T.eT,rehypePlugins:s,components:l,children:i.toolLog})})]})}),et={human:"chatTranscript.toolApproval.answeredByHuman",auto:"chatTranscript.toolApproval.autoApproved",terminal:"chatTranscript.toolApproval.answeredInTerminal",pending:"chatTranscript.toolApproval.awaitingAnswer",unclassified:"chatTranscript.toolApproval.unclassified",unknown:"chatTranscript.toolApproval.resolved"},en={...et,auto:"chatTranscript.toolApproval.autoAnswered"},er=(0,a.memo)(function(e){let{entries:t}=e,n=(0,l.c)("worktree"),{isOpen:a,toggle:o}=J();if(0===t.length)return null;let c=a?s.A:i.A,u=(0,D.rS)(t),f=u.questions+u.confirmations>0,p=u.approvals>0,h=[];p&&h.push(n("chatTranscript.toolApproval.summary",{count:u.approvals})),u.questions>0&&h.push(n("chatTranscript.toolApproval.summaryQuestions",{count:u.questions})),u.confirmations>0&&h.push(n(p||u.questions>0?"chatTranscript.toolApproval.summaryConfirmations":"chatTranscript.toolApproval.summaryConfirmationsOnly",{count:u.confirmations}));let g=p?d.A:m.A;return(0,r.jsxs)("div",{"data-testid":"chat-tool-approval-group","data-approval-count":t.length,"data-approvals":u.approvals,"data-questions":u.questions,"data-confirmations":u.confirmations,className:"".concat(B," items-start"),children:[(0,r.jsxs)("button",{type:"button","data-testid":"chat-tool-approval-toggle",onClick:o,"aria-expanded":a,"aria-label":n("chatTranscript.toolApproval.".concat(a?"collapse":"expand").concat(f&&p?"Mixed":f?"Questions":"")),className:_,children:[(0,r.jsx)(g,{size:12,"aria-hidden":"true"}),(0,r.jsx)("span",{children:h.join(n("chatTranscript.toolApproval.summarySeparator"))}),(0,r.jsx)(c,{size:12,"aria-hidden":"true"})]}),a&&(0,r.jsx)("ul",{"data-testid":"chat-tool-approval-list",className:"mr-auto flex w-full max-w-full flex-col gap-1 pl-1",children:t.map(e=>{let t="question"===e.kind,a=t?en:et,l=t?"confirmation"===e.phase?"chatTranscript.toolApproval.submitConfirmation":"chatTranscript.toolApproval.unlabeledQuestion":"chatTranscript.toolApproval.unlabeled";return(0,r.jsxs)("li",{"data-testid":"chat-tool-approval-entry","data-approval-outcome":e.outcome,"data-approval-kind":e.kind,"data-approval-phase":e.phase,"data-approval-confirmation":e.confirmationOutcome,"data-approval-audit":e.isPermissionAudit?"true":void 0,"data-approval-merged":e.messageIds.length,className:"flex max-w-full flex-wrap items-baseline gap-x-2 gap-y-0.5 text-xs text-muted-foreground",children:["confirmation"===e.phase&&e.label&&(0,r.jsx)("span",{"data-testid":"chat-tool-approval-phase",children:n("chatTranscript.toolApproval.submitConfirmation")}),(0,r.jsx)("span",{className:"min-w-0 break-words [word-break:break-word] font-mono text-foreground",children:e.label||n(l)}),(0,r.jsx)("span",{"data-testid":"chat-tool-approval-outcome",children:n(a[e.outcome])}),e.confirmationOutcome&&(0,r.jsx)("span",{"data-testid":"chat-tool-approval-confirmation",children:n("chatTranscript.toolApproval.confirmation",{outcome:n(en[e.confirmationOutcome])})})]},e.id)})})]})}),ea=(0,a.memo)(function(e){var t,n;let{message:s,showHeader:i,header:o,onFilePathClick:c,onCopy:u,onInsertToMessage:d,onRetryPending:m,onDiscardPending:y}=e,w=(0,l.c)("worktree"),k=(0,l.c)("common"),S="user"===s.role,T=s.optimisticState,M=(0,j.bx)(s.requestId),I="assistant"===s.role&&"normal"===s.messageType&&("string"!=typeof s.requestId||!(s.requestId.length>0))&&!0===G[null!=(t=s.cliToolId)?t:"claude"],E=(0,a.useMemo)(()=>"number"==typeof(null==o?void 0:o.startedAtMs)?new Date(o.startedAtMs):null,[null==o?void 0:o.startedAtMs]),A=(0,N.g8)(s.timestamp,E),L=i?"role":(null==o?void 0:o.variant)==="time"?"time":"none",R=(0,a.useMemo)(()=>{var e;return"string"==typeof(e=s.content)?(0,C.aJ)(e):""},[s.content]),D=M?s.content:R,U=(0,a.useMemo)(()=>M?P(s.content):null,[M,s.content]),W=U?U.body.trim().length>0?U.body:null:R,$=U?(n=s.content,U.folded?n:null):null,_=[S?"".concat("w-fit rounded-2xl border px-3 py-2 text-sm text-foreground"," ").concat("ml-auto"," ").concat("max-w-[85%] sm:max-w-[75%]"," rounded-br-md"):z,S&&"error"===T?"border-danger-border bg-danger-subtle":"",S&&"error"!==T?"border-accent-500/30 bg-accent-500/10":"","sending"===T?"opacity-70":""].filter(Boolean).join(" "),J=M?q:"".concat(K," whitespace-pre-wrap");return(0,r.jsxs)("div",{"data-testid":"chat-message-row","data-role":s.role,"data-row-message-id":s.id,className:[B,s.archived?"opacity-60":""].filter(Boolean).join(" "),children:["role"===L&&(0,r.jsxs)("div",{"data-testid":F,"data-header-variant":"role",className:["flex flex-wrap items-center gap-x-2 px-1 text-xs text-muted-foreground",S?"justify-end":""].filter(Boolean).join(" "),children:[(0,r.jsx)("span",{className:S?"font-medium text-accent-700 dark:text-accent-400":"font-medium",children:w(S?"conversation.you":"conversation.assistant")}),A&&(0,r.jsx)("span",{"data-testid":H,children:A})]}),"time"===L&&A&&(0,r.jsxs)("div",{"data-testid":F,"data-header-variant":"time",role:"separator","aria-label":w("chatTranscript.turnBoundary"),className:"flex w-full items-center gap-2 px-1 pt-2 text-xs text-muted-foreground",children:[(0,r.jsx)("span",{className:"h-px min-w-[1rem] flex-1 bg-border","aria-hidden":"true"}),(0,r.jsx)("span",{"data-testid":H,className:"shrink-0 whitespace-nowrap",children:A}),(0,r.jsx)("span",{className:"h-px min-w-[1rem] flex-1 bg-border","aria-hidden":"true"})]}),(0,r.jsx)("div",{"data-testid":O,className:_,children:I?(0,r.jsx)(V,{children:(0,r.jsx)("div",{"data-message-id":s.id,className:J,children:(0,r.jsx)(X,{content:R,onFilePathClick:c})})}):(0,r.jsx)("div",{"data-message-id":s.id,"data-markdown":M?"true":void 0,className:J,children:M?(0,r.jsx)(ee,{content:s.content,onFilePathClick:c}):(0,r.jsx)(X,{content:R,onFilePathClick:c})})}),(0,r.jsxs)("div",{"data-testid":"chat-message-actions",className:["flex items-center gap-1 px-1",S?"justify-end":""].filter(Boolean).join(" "),children:["sending"===T&&(0,r.jsxs)("span",{"data-testid":"chat-optimistic-sending",className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,r.jsx)(f.A,{size:12,className:"animate-spin","aria-hidden":"true"}),(0,r.jsx)("span",{children:w("conversation.sending")})]}),"error"===T&&(0,r.jsxs)("span",{"data-testid":"chat-optimistic-error",className:"flex items-center gap-1 text-xs text-danger-foreground",children:[(0,r.jsx)(p.A,{size:12,"aria-hidden":"true"}),(0,r.jsx)("span",{children:w("conversation.failedToSend")})]}),"error"===T?(0,r.jsxs)(r.Fragment,{children:[m&&(0,r.jsxs)("button",{type:"button","data-testid":"chat-pending-retry",onClick:()=>m(s.id),className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-xs text-accent-700 transition-colors hover:bg-muted dark:text-accent-400","aria-label":w("conversation.retrySending"),title:k("retry"),children:[(0,r.jsx)(h.A,{size:12,"aria-hidden":"true"}),k("retry")]}),y&&(0,r.jsxs)("button",{type:"button","data-testid":"chat-pending-discard",onClick:()=>y(s.id),className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-danger-foreground","aria-label":w("conversation.discardMessage"),title:w("conversation.discard"),children:[(0,r.jsx)(g.A,{size:12,"aria-hidden":"true"}),w("conversation.discard")]})]}):(0,r.jsxs)(r.Fragment,{children:[u&&null!==W&&(0,r.jsx)("button",{type:"button","data-testid":"chat-copy-message",onClick:()=>u(W),className:"rounded p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground","aria-label":w("conversation.copyMessage"),title:w("conversation.copy"),children:(0,r.jsx)(x.A,{size:14,"aria-hidden":"true"})}),u&&null!==$&&(0,r.jsxs)("button",{type:"button","data-testid":"chat-copy-full-message",onClick:()=>u($),className:"flex items-center gap-1 rounded px-1.5 py-1 text-xs leading-none text-muted-foreground transition-colors hover:bg-muted hover:text-foreground","aria-label":w("chatTranscript.copyFull.action"),title:w("chatTranscript.copyFull.title"),children:[(0,r.jsx)(b.A,{size:14,"aria-hidden":"true"}),(0,r.jsx)("span",{children:w("chatTranscript.copyFull.label")})]}),S&&d&&(0,r.jsx)("button",{type:"button","data-testid":"chat-insert-user-message",onClick:()=>d(D),className:"rounded p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-accent-600 dark:hover:text-accent-400","aria-label":w("conversation.insertToMessage"),title:w("conversation.insertToMessage"),children:(0,r.jsx)(v.A,{size:14,"aria-hidden":"true"})})]})]})]})})},80635:(e,t,n)=>{n.d(t,{v4:()=>s});var r=n(12115);function a(e){let t=new Set;for(let n of e)"user"===n.role&&t.add(n.id);return t}function l(e,t,n){let r=new Set,a=new Set,l=e.filter(e=>"sending"===e.status);if(0===l.length)return{reconciledTempIds:r,consumedServerIds:a};let s=t.filter(e=>"user"===e.role&&!n.has(e.id)).sort((e,t)=>e.timestamp.getTime()-t.timestamp.getTime()),i=new Set;for(let e of[...l].sort((e,t)=>e.timestamp.getTime()-t.timestamp.getTime())){let t=s.find(t=>!i.has(t.id)&&!e.baselineUserIds.has(t.id)&&t.content===e.content);t&&(i.add(t.id),r.add(e.tempId),a.add(t.id))}return{reconciledTempIds:r,consumedServerIds:a}}function s(e){var t,n;let{worktreeId:s,serverMessages:i,sendFn:o,onSent:c,timeoutMs:u=3e4,connectivity:d,resendGraceMs:m=250}=e,[f,p]=(0,r.useState)([]),h=null!=(t=null==d?void 0:d.offline)&&t,g=null==(n=null==d?void 0:d.reachable)||n,x=(0,r.useRef)(i);x.current=i;let b=(0,r.useRef)(f);b.current=f;let v=(0,r.useRef)(c);v.current=c;let y=(0,r.useRef)(o);y.current=o;let w=(0,r.useRef)(h);w.current=h;let k=(0,r.useRef)(0),j=(0,r.useRef)(new Map),N=(0,r.useRef)(new Set),C=(0,r.useRef)(new Set),S=(0,r.useRef)(new Set),T=(0,r.useCallback)(e=>{let t=j.current.get(e);void 0!==t&&(clearTimeout(t),j.current.delete(e))},[]),M=(0,r.useCallback)(e=>{T(e),p(t=>t.map(t=>t.tempId!==e||"sending"!==t.status?t:w.current&&!t.autoResendAttempted?t.queued?t:{...t,queued:!0}:{...t,status:"error",queued:!1}))},[T]),I=(0,r.useCallback)(e=>{T(e);let t=setTimeout(()=>{j.current.delete(e),M(e)},u);j.current.set(e,t)},[T,M,u]),E=(0,r.useCallback)(async e=>{I(e.tempId),N.current.add(e.tempId);try{var t;await y.current(e.content,e.options),p(t=>t.map(t=>t.tempId!==e.tempId||t.accepted?t:{...t,accepted:!0})),null==(t=v.current)||t.call(v)}catch(t){M(e.tempId)}finally{N.current.delete(e.tempId)}},[I,M]),A=(0,r.useCallback)((e,t)=>{let n={tempId:"pending-".concat(k.current++),content:e,options:t,timestamp:new Date,status:"sending",baselineUserIds:a(x.current),queued:!1,accepted:!1,autoResendAttempted:!1};p(e=>[...e,n]),E(n)},[E]),L=(0,r.useCallback)(e=>{let t=b.current.find(t=>t.tempId===e);if(!t)return;let n={...t,status:"sending",timestamp:new Date,baselineUserIds:a(x.current),queued:!1,accepted:!1,autoResendAttempted:!1};p(t=>t.map(t=>t.tempId===e?n:t)),E(n)},[E]),R=(0,r.useCallback)(e=>{let t=b.current.find(t=>t.tempId===e);return T(e),N.current.delete(e),p(t=>t.filter(t=>t.tempId!==e)),null==t?void 0:t.content},[T]);(0,r.useEffect)(()=>{let{reconciledTempIds:e,consumedServerIds:t}=l(b.current,i,C.current),n=new Set(i.map(e=>e.id)),r=new Set;C.current.forEach(e=>{n.has(e)&&r.add(e)}),t.forEach(e=>r.add(e)),C.current=r,0!==e.size&&(e.forEach(e=>S.current.add(e)),e.forEach(T),p(t=>t.filter(t=>!e.has(t.tempId))))},[i,T]),(0,r.useEffect)(()=>{if(!h)return;let e=f.filter(e=>"sending"===e.status&&!e.queued&&!e.autoResendAttempted);if(0===e.length)return;let t=new Set(e.map(e=>e.tempId));t.forEach(T),p(e=>e.map(e=>t.has(e.tempId)?{...e,queued:!0}:e))},[h,f,T]);let P=(0,r.useRef)(!1),[D,z]=(0,r.useState)(0),[O,F]=(0,r.useState)(0),H=(0,r.useRef)(m);H.current=m;let B=f.reduce((e,t)=>t.queued&&"sending"===t.status?e+1:e,0);return(0,r.useEffect)(()=>{(!g||B>0)&&(P.current=!0),g&&P.current&&(P.current=!1,b.current.some(e=>"sending"===e.status)&&z(e=>e+1))},[g,B]),(0,r.useEffect)(()=>{let e;if(0===D)return;let t=!1;return(async()=>{try{var n;await (null==(n=v.current)?void 0:n.call(v))}catch(e){}t||(e=setTimeout(()=>F(e=>e+1),H.current))})(),()=>{t=!0,void 0!==e&&clearTimeout(e)}},[D]),(0,r.useEffect)(()=>{if(0===O)return;let e=b.current,t=e.filter(e=>"sending"===e.status);if(0===t.length)return;let{reconciledTempIds:n}=l(e,x.current,C.current),r=[],a=[];for(let e of t)!(n.has(e.tempId)||S.current.has(e.tempId))&&(e.accepted||N.current.has(e.tempId)?a.push(e.tempId):e.queued?r.push(e):j.current.has(e.tempId)||a.push(e.tempId));if(a.forEach(I),0===r.length)return;let s=new Set(r.map(e=>e.tempId));p(e=>e.map(e=>s.has(e.tempId)?{...e,queued:!1,autoResendAttempted:!0}:e)),r.forEach(e=>{E({...e,queued:!1,autoResendAttempted:!0})})},[O,I,E]),(0,r.useEffect)(()=>{let e=j.current;return()=>{e.forEach(e=>clearTimeout(e)),e.clear()}},[]),{messages:(0,r.useMemo)(()=>{if(0===f.length)return i;let{reconciledTempIds:e}=l(f,i,C.current),t=f.filter(t=>!e.has(t.tempId)).map(e=>({id:e.tempId,worktreeId:s,role:"user",content:e.content,timestamp:e.timestamp,messageType:"normal",archived:!1,cliToolId:e.options.cliToolId,instanceId:e.options.instanceId,optimisticState:e.status}));return 0===t.length?i:[...i,...t]},[i,f,s]),pending:f,sendOptimistic:A,retry:L,discard:R}}},81507:(e,t,n)=>{n.d(t,{Ce:()=>d,TG:()=>u,jt:()=>l,sg:()=>s});var r=n(12115);let a={visible:"commandmate.worktree.historyVisible",width:"commandmate.worktree.historyWidth"},l={visible:"commandmate.sessions.tileHistoryVisible",width:"commandmate.sessions.tileHistoryWidth"},s=40;function i(e){return Number.isFinite(e)?Math.min(60,Math.max(10,e)):s}let o="commandmate:historyPaneStateChange";function c(e){try{window.dispatchEvent(new CustomEvent(o,{detail:e}))}catch(e){}}function u(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a,{visible:t,width:n}=e,[l,u]=(0,r.useState)(!0),[d,m]=(0,r.useState)(s),f=(0,r.useRef)(l);f.current=l;let p=(0,r.useRef)(d);return p.current=d,(0,r.useEffect)(()=>{let e=function(e){try{let t=window.localStorage.getItem(e);if("true"===t)return!0;if("false"===t)return!1}catch(e){}return!0}(t),r=function(e){try{let t=window.localStorage.getItem(e);if(null===t)return s;let n=Number(t);if(Number.isFinite(n))return i(n)}catch(e){}return s}(n);u(e),m(r)},[t,n]),(0,r.useEffect)(()=>{let e=e=>{e.detail&&e.detail.scope===t&&(e.detail.visible!==f.current&&u(e.detail.visible),e.detail.width!==p.current&&m(e.detail.width))};return window.addEventListener(o,e),()=>window.removeEventListener(o,e)},[t]),{visible:l,width:d,toggle:(0,r.useCallback)(()=>{let e=!f.current;u(e);try{window.localStorage.setItem(t,String(e))}catch(e){}c({scope:t,visible:e,width:p.current})},[t]),setWidth:(0,r.useCallback)(e=>{let r=i(e);m(r);try{window.localStorage.setItem(n,String(r))}catch(e){}c({scope:t,visible:f.current,width:r})},[t,n])}}function d(e){return"split-history-slot-".concat(e)}},83012:(e,t,n)=>{n.d(t,{Fx:()=>s,Uq:()=>o,bg:()=>i,fw:()=>l,g8:()=>c});var r=n(53298),a=n(73683);function l(e,t){let n=new Date(e);return isNaN(n.getTime())?"":(0,r.m)(n,{addSuffix:!0,...t?{locale:t}:{}})}function s(e){let t=new Date(e);if(isNaN(t.getTime()))return"";let n=Math.round((Date.now()-t.getTime())/1e3);if(n<45)return"now";let r=Math.round(n/60);if(r<60)return"".concat(r,"m ago");let a=Math.round(r/60);if(a<24)return"".concat(a,"h ago");let l=Math.round(a/24);return l<7?"".concat(l,"d ago"):l<30?"".concat(Math.round(l/7),"w ago"):l<365?"".concat(Math.round(l/30),"mo ago"):"".concat(Math.round(l/365),"y ago")}function i(e,t){return!(e instanceof Date)||isNaN(e.getTime())?"":(0,a.GP)(e,"PPp",t?{locale:t}:void 0)}function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date;if(!(e instanceof Date)||isNaN(e.getTime()))return"";let n=t instanceof Date&&!isNaN(t.getTime())?t:new Date,r=e.getFullYear()===n.getFullYear()&&e.getMonth()===n.getMonth()&&e.getDate()===n.getDate();return(0,a.GP)(e,r?"HH:mm":"M/d HH:mm")}function c(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Date;if(!d(e))return"";let r=d(n)?n:new Date,l=d(t)?t:null,s=m(e,r)&&(null===l||m(l,r)&&m(l,e))?"HH:mm":"M/d HH:mm",i=(0,a.GP)(e,s);if(null===l)return i;let o=(0,a.GP)(l,s);return o===i?i:"".concat(o).concat(u).concat(i)}let u=" → ";function d(e){return e instanceof Date&&!isNaN(e.getTime())}function m(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}},83051:(e,t,n)=>{n.d(t,{bl:()=>X,Ce:()=>f.Ce});var r=n(95155),a=n(12115),l=n(18955),s=n(96195),i=n(7620),o=n(12181),c=n(20508),u=n(86651),d=n(90368),m=n(28019),f=n(81507),p=n(35252),h=n(35299),g=n(6132),x=n(48314),b=n(65229),v=n(54916),y=n(75426),w=n(24033),k=n(36809),j=n(51238),N=n(10934),C=n(5225),S=n(4300),T=n(55813),M=n(83012),I=n(89568),E=n(99112),A=n(79321);function L(e){let t=e.split("\n");if(t.length<=2&&e.length<=100)return{text:e,isTruncated:!1};let n=t.slice(0,2).join("\n");return n.length>100&&(n=n.slice(0,100)),{text:n,isTruncated:!0}}let R=(0,a.memo)(function(e){let{content:t,onFilePathClick:n}=e,s=(0,l.c)("worktree"),i=(0,a.useMemo)(()=>(0,I.ML)(t),[t]),o=(0,a.useCallback)(e=>()=>n(e),[n]);return(0,r.jsx)("span",{children:i.map((e,t)=>"path"===e.type?(0,r.jsx)("button",{type:"button",onClick:o(e.content),className:"text-accent-700 dark:text-accent-400 hover:text-accent-600 dark:hover:text-accent-300 hover:underline cursor-pointer font-mono text-sm","aria-label":s("conversation.openFile",{path:e.content}),children:e.content},t):(0,r.jsx)("span",{children:e.content},t))})}),P=(0,a.memo)(function(e){let{content:t,onFilePathClick:n}=e,l=(0,a.useMemo)(()=>{let e=e=>a.Children.map(e,e=>"string"==typeof e?(0,r.jsx)(R,{content:e,onFilePathClick:n}):e);return{p:t=>{let{children:n}=t;return(0,r.jsx)("p",{children:e(n)})},li:t=>{let{children:n}=t;return(0,r.jsx)("li",{children:e(n)})},td:t=>{let{children:n}=t;return(0,r.jsx)("td",{children:e(n)})},th:t=>{let{children:n}=t;return(0,r.jsx)("th",{children:e(n)})},strong:t=>{let{children:n}=t;return(0,r.jsx)("strong",{children:e(n)})},em:t=>{let{children:n}=t;return(0,r.jsx)("em",{children:e(n)})},a:e=>{let{href:t,children:a,node:l,...s}=e;return(0,r.jsx)(A.ZS,{...s,href:t,onFilePathClick:n,children:a})}}},[n]),s=(0,a.useMemo)(()=>[N.A,C.A],[]);return(0,r.jsx)(j.oz,{remarkPlugins:E.eT,rehypePlugins:s,components:l,children:t})});function D(){let e=(0,l.c)("worktree");return(0,r.jsxs)("div",{"data-testid":"pending-indicator",className:"flex items-center gap-2 text-muted-foreground py-2",children:[(0,r.jsxs)("div",{className:"flex gap-1","aria-hidden":"true",children:[(0,r.jsx)("span",{className:"w-2 h-2 bg-muted-foreground rounded-full animate-pulse"}),(0,r.jsx)("span",{className:"w-2 h-2 bg-muted-foreground rounded-full animate-pulse",style:{animationDelay:"150ms"}}),(0,r.jsx)("span",{className:"w-2 h-2 bg-muted-foreground rounded-full animate-pulse",style:{animationDelay:"300ms"}})]}),(0,r.jsx)("span",{className:"text-sm",children:e("conversation.waitingForResponse")})]})}let z=(0,a.memo)(function(e){let{message:t,onFilePathClick:n,onCopy:a,onInsertToMessage:s,onRetryPending:i,onDiscardPending:o}=e,c=(0,k.Ym)(),u=(0,l.c)("worktree"),d=(0,l.c)("common"),m=(0,T.M)(c),f=(0,M.bg)(t.timestamp,m),p=t.optimisticState,w=["group relative border-l-2 p-3 transition-opacity","error"===p?"border-danger-border bg-danger-subtle":"border-accent-500 bg-accent-500/10","sending"===p?"opacity-70":""].filter(Boolean).join(" ");return(0,r.jsxs)("div",{className:w,children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,r.jsx)("span",{className:"text-xs font-medium text-accent-700 dark:text-accent-400",children:u("conversation.you")}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:f}),"sending"===p&&(0,r.jsxs)("span",{"data-testid":"optimistic-sending",className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,r.jsx)(h.A,{size:12,className:"animate-spin","aria-hidden":"true"}),(0,r.jsx)("span",{children:u("conversation.sending")})]}),"error"===p&&(0,r.jsxs)("span",{"data-testid":"optimistic-error",className:"flex items-center gap-1 text-xs text-danger-foreground",children:[(0,r.jsx)(g.A,{size:12,"aria-hidden":"true"}),(0,r.jsx)("span",{children:u("conversation.failedToSend")})]}),"error"===p?(0,r.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[i&&(0,r.jsxs)("button",{type:"button","data-testid":"pending-retry",onClick:()=>i(t.id),className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-xs text-accent-700 dark:text-accent-400 hover:bg-muted transition-colors","aria-label":u("conversation.retrySending"),title:d("retry"),children:[(0,r.jsx)(x.A,{size:12,"aria-hidden":"true"}),d("retry")]}),o&&(0,r.jsxs)("button",{type:"button","data-testid":"pending-discard",onClick:()=>o(t.id),className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-xs text-muted-foreground hover:text-danger-foreground hover:bg-muted transition-colors","aria-label":u("conversation.discardMessage"),title:u("conversation.discard"),children:[(0,r.jsx)(b.A,{size:12,"aria-hidden":"true"}),u("conversation.discard")]})]}):(0,r.jsxs)("div",{className:"ml-auto flex items-center gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100 [@media(hover:none)]:opacity-100",children:[s&&(0,r.jsx)("button",{type:"button","data-testid":"insert-user-message",onClick:()=>s(t.content),className:"p-1 text-muted-foreground hover:text-accent-600 dark:hover:text-accent-400 hover:bg-muted rounded transition-colors","aria-label":u("conversation.insertToMessage"),title:u("conversation.insertToMessage"),children:(0,r.jsx)(v.A,{size:14,"aria-hidden":"true"})}),a&&(0,r.jsx)("button",{type:"button","data-testid":"copy-user-message",onClick:()=>a(t.content),className:"p-1 text-muted-foreground hover:text-foreground hover:bg-muted rounded transition-colors","aria-label":u("conversation.copyMessage"),title:u("conversation.copy"),children:(0,r.jsx)(y.A,{size:14,"aria-hidden":"true"})})]})]}),(0,r.jsx)("div",{"data-message-id":t.id,className:"text-sm text-foreground whitespace-pre-wrap break-words [word-break:break-word] max-w-full overflow-x-hidden",children:(0,r.jsx)(R,{content:t.content,onFilePathClick:n})})]})}),O=(0,a.memo)(function(e){let{message:t,index:n,total:s,isExpanded:i,onFilePathClick:o,onCopy:c,hasLongContent:u=!1,onToggleExpand:d}=e,m=(0,k.Ym)(),f=(0,l.c)("worktree"),p=(0,T.M)(m),h=(0,M.bg)(t.timestamp,p),{text:g,isTruncated:x}=(0,a.useMemo)(()=>L(t.content),[t.content]),b=i||!x?t.content:g,v=(0,S.bx)(t.requestId),j=v&&x&&!i;return(0,r.jsxs)("div",{className:"assistant-message-item group relative",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,r.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:f("conversation.assistant")}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:h}),s>1&&(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",n+1,"/",s,")"]}),(0,r.jsxs)("div",{className:"ml-auto flex items-center gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100 [@media(hover:none)]:opacity-100",children:[0===n&&u&&!!d&&(0,r.jsxs)("button",{type:"button",onClick:d,className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-xs text-accent-700 dark:text-accent-400 hover:text-accent-600 dark:hover:text-accent-300 hover:bg-muted transition-colors","aria-expanded":i,"aria-label":f(i?"conversation.collapseMessage":"conversation.expandMessage"),children:[(0,r.jsx)(w.A,{size:12,className:"transition-transform ".concat(i?"rotate-180":""),"aria-hidden":"true"}),f(i?"conversation.collapse":"conversation.expand")]}),c&&(0,r.jsx)("button",{type:"button","data-testid":"copy-assistant-message",onClick:()=>c(t.content),className:"p-1 text-muted-foreground hover:text-foreground hover:bg-muted rounded transition-colors","aria-label":f("conversation.copyMessage"),title:f("conversation.copy"),children:(0,r.jsx)(y.A,{size:14,"aria-hidden":"true"})})]})]}),v?(0,r.jsx)("div",{"data-message-id":t.id,"data-markdown":"true",className:["assistant-md text-xs text-foreground break-words [word-break:break-word] max-w-full overflow-x-hidden",j?"".concat("max-h-[3.25rem]"," overflow-y-hidden"):""].filter(Boolean).join(" "),children:(0,r.jsx)(P,{content:t.content,onFilePathClick:o})}):(0,r.jsxs)("div",{"data-message-id":t.id,className:"text-xs text-foreground whitespace-pre-wrap break-words [word-break:break-word] max-w-full overflow-x-hidden",children:[(0,r.jsx)(R,{content:b,onFilePathClick:o}),!i&&x&&(0,r.jsx)("span",{className:"text-muted-foreground",children:"..."})]})]})}),F=(0,a.memo)(function(e){let{messages:t,isExpanded:n,onFilePathClick:l,onCopy:s,hasLongContent:i=!1,onToggleExpand:o}=e;return(0,r.jsx)("div",{className:"bg-surface-2/50 border-l-2 border-border p-2 border-t border-border space-y-2",children:t.map((e,c)=>(0,r.jsxs)(a.Fragment,{children:[c>0&&(0,r.jsx)("div",{"data-testid":"assistant-message-divider",className:"border-t border-dashed border-border"}),(0,r.jsx)(O,{message:e,index:c,total:t.length,isExpanded:n,onFilePathClick:l,onCopy:s,hasLongContent:i,onToggleExpand:o})]},e.id))})});function H(){let e=(0,l.c)("worktree");return(0,r.jsxs)("div",{"data-testid":"orphan-indicator",className:"bg-warning/10 text-warning-foreground text-xs px-3 py-1 flex items-center gap-2",children:[(0,r.jsx)("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,r.jsx)("span",{children:e("conversation.systemMessage")})]})}let B=(0,a.memo)(function(e){var t;let{pair:n,onFilePathClick:s,isExpanded:i=!1,onToggleExpand:o,onCopy:c,onInsertToMessage:u,showAssistant:d=!0,onRetryPending:m,onDiscardPending:f}=e,p=(0,l.c)("worktree"),h=(null==(t=n.userMessage)?void 0:t.optimisticState)!==void 0,g=(0,a.useMemo)(()=>n.assistantMessages.some(e=>{let{isTruncated:t}=L(e.content);return t}),[n.assistantMessages]),x=(0,a.useCallback)(()=>{o&&o()},[o]),b=(0,a.useMemo)(()=>{let e="pending"===n.status?"pending":"orphan"===n.status?"orphan border-l-4 border-warning":"";return"".concat("border border-border rounded-lg overflow-hidden mb-4 transition-colors"," ").concat(e).trim()},[n.status]),v=n.userMessage?p("conversation.conversationLabel",{preview:"".concat(n.userMessage.content.substring(0,50)).concat(n.userMessage.content.length>50?"...":"")}):p("conversation.systemMessageLabel");return(0,r.jsxs)("div",{"data-testid":"conversation-pair-card",role:"article","aria-label":v,className:b,children:["orphan"===n.status&&(0,r.jsx)(H,{}),n.userMessage&&(0,r.jsx)(z,{message:n.userMessage,onFilePathClick:s,onCopy:c,onInsertToMessage:u,onRetryPending:m,onDiscardPending:f}),"pending"!==n.status||h?d&&n.assistantMessages.length>0?(0,r.jsx)(F,{messages:n.assistantMessages,isExpanded:i,onFilePathClick:s,onCopy:c,hasLongContent:g,onToggleExpand:x}):null:(0,r.jsx)("div",{className:"bg-muted/40 border-l-2 border-border p-3 border-t border-border",children:(0,r.jsx)(D,{})})]})});var K=n(92710),q=n(23570),U=n(60322),W=n(70738),$=n(64653),_=n(9708),J=n(20877),Q=n(88731),Y=n(96802);function G(){let e=(0,l.c)("worktree");return(0,r.jsx)("div",{"data-testid":"loading-indicator",role:"status","aria-label":e("history.loading"),children:[0,1,2].map(e=>(0,r.jsxs)("div",{className:"mb-4 overflow-hidden rounded-lg border border-border",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 p-3",children:[(0,r.jsx)(m.EA,{className:"h-4 w-4 rounded-full"}),(0,r.jsx)(m.EA,{className:"h-4 w-1/3"})]}),(0,r.jsxs)("div",{className:"space-y-2 px-3 pb-3",children:[(0,r.jsx)(m.EA,{className:"h-3 w-full"}),(0,r.jsx)(m.EA,{className:"h-3 w-5/6"}),(0,r.jsx)(m.EA,{className:"h-3 w-2/3"})]})]},e))})}function V(){let e=(0,l.c)("worktree");return(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground",children:[(0,r.jsx)("svg",{className:"w-12 h-12 mb-2 opacity-50",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),(0,r.jsx)("p",{className:"text-sm",children:e("history.empty")})]})}let Z=["h-full","flex","flex-col","overflow-hidden","bg-surface-2","rounded-lg","border","border-border"],X=(0,a.memo)(function(e){let{messages:t,worktreeId:n,worktreePath:h,onFilePathClick:g,isLoading:x=!1,className:b="",showToast:v,onInsertToMessage:y,onRetryPending:w,onDiscardPending:k,showArchived:j=!1,onShowArchivedChange:N,historyDisplayLimit:C,onHistoryDisplayLimitChange:S,historyUserOnly:T=!1,onHistoryUserOnlyChange:M,onCollapse:I,splitIndex:E,cliToolId:A}=e,L=(0,l.c)("worktree"),R=(0,a.useRef)(null),P=(0,_.O)(),D=null!=h?h:P.worktreePath,z=(0,a.useMemo)(()=>void 0===E?J.Gw:(0,J.eu)(E),[E]),O=void 0===E?"history-pane-collapse-button":"history-pane-collapse-button-".concat(E),F=void 0===E?q.g6:(0,f.Ce)(E),H=(0,a.useRef)(!0),X=(0,a.useRef)(-1),ee=(0,a.useRef)(null),{pairs:et,isExpanded:en,toggleExpand:er}=function(e){let t=(0,a.useMemo)(()=>(function(e){if(0===e.length)return[];let t=[...e].sort((e,t)=>e.timestamp.getTime()-t.timestamp.getTime()),n=[],r=null;for(let e of t)if("user"===e.role)r={id:e.id,userMessage:e,assistantMessages:[],status:"pending"},n.push(r);else if("assistant"===e.role)if(r&&null!==r.userMessage)r.assistantMessages.push(e),r.status="completed";else if(r&&null===r.userMessage)r.assistantMessages.push(e);else{let t={id:"orphan-".concat(e.id),userMessage:null,assistantMessages:[e],status:"orphan"};n.push(t),r=t}return n})(e),[e]),[n,r]=(0,a.useState)(new Set),l=(0,a.useCallback)(e=>{r(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),s=(0,a.useCallback)(e=>n.has(e),[n]),i=(0,a.useCallback)(()=>{r(new Set(t.map(e=>e.id)))},[t]);return{pairs:t,expandedPairs:n,toggleExpand:l,isExpanded:s,expandAll:i,collapseAll:(0,a.useCallback)(()=>{r(new Set)},[])}}(t),ea=(0,a.useMemo)(()=>t.filter(e=>!e.archived&&"string"==typeof e.content&&e.content.length>0&&(!T||"user"===e.role)),[t,T]),{isOpen:el,query:es,matchCount:ei,currentIndex:eo,isAtMaxMatches:ec,matchPositions:eu,currentMatch:ed,openSearch:em,closeSearch:ef,setQuery:ep,onCompositionStart:eh,onCompositionEnd:eg,nextMatch:ex,prevMatch:eb}=(0,p.w)({messages:ea}),ev=el&&eu.length>0,ey=(0,a.useMemo)(()=>t.filter(e=>"relay"===e.messageType).length,[t]),[ew,ek]=(0,a.useState)(new Set);(0,a.useEffect)(()=>{ef()},[n]);let ej=(0,a.useMemo)(()=>T?et.filter(e=>e.userMessage):et,[et,T]),eN=(0,a.useMemo)(()=>{let e=new Map;for(let t of ej)for(let n of(t.userMessage&&e.set(t.userMessage.id,t.id),t.assistantMessages))e.set(n.id,t.id);return e},[ej]),eC=(0,a.useMemo)(()=>{let e=new Map;return ej.forEach((t,n)=>e.set(t.id,n)),e},[ej]),eS=(0,s.Te)({count:ej.length,getScrollElement:()=>R.current,estimateSize:()=>Y.__,overscan:Y.b,getItemKey:e=>{var t,n;return null!=(n=null==(t=ej[e])?void 0:t.id)?n:e}}),eT=eS.getVirtualItems(),eM=eT.length>0?"".concat(eT[0].index,"-").concat(eT[eT.length-1].index):"",eI=(0,a.useCallback)(()=>{let e=R.current;e&&(H.current=(0,Y.Mp)({scrollTop:e.scrollTop,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight}))},[]);(0,a.useLayoutEffect)(()=>{let e=X.current,t=ej.length;X.current=t,-1!==e&&t>e&&t>0&&H.current&&!ev&&eS.scrollToIndex(t-1,{align:"end"})},[ej.length,ev,eS]),(0,a.useLayoutEffect)(()=>{if(!el||0===eu.length)return void ek(e=>0===e.size?e:new Set);ek(function(e,t){let n=new Map;for(let e of t)for(let t of(e.userMessage&&n.set(e.userMessage.id,e.id),e.assistantMessages))n.set(t.id,e.id);let r=new Set;for(let t of e){let e=n.get(t.messageId);e&&r.add(e)}return r}(eu,et))},[el,eu,et]),(0,a.useEffect)(()=>{if(!el||!ed)return;let e=eN.get(ed.messageId);if(void 0===e)return;let t=eC.get(e);void 0!==t&&eS.scrollToIndex(t,{align:"center"})},[el,ed,eN,eC,eS]),(0,a.useLayoutEffect)(()=>{let e=R.current;if(!e)return;if(!el||0===eu.length)return void(0,J.fq)(z);let t=null;for(let r of eu){var n;let a=(n=r.messageId,e.querySelector('[data-message-id="'.concat(CSS.escape(n),'"]')));if(!a)continue;let l=(null==ed?void 0:ed.messageId)===r.messageId,s=l?ed.localIndex:-1;(0,J.Gg)(a,r.ranges,s,z),l&&a instanceof HTMLElement&&(t=a)}return t&&"function"==typeof t.scrollIntoView&&t.scrollIntoView({block:"center",behavior:"smooth"}),()=>{(0,J.fq)(z)}},[el,eu,ed,ew,z,eM]),(0,a.useEffect)(()=>{let e=R.current;if(el)null===ee.current&&e&&(ee.current=e.scrollTop);else{if(null!==ee.current&&e){let t=ee.current;requestAnimationFrame(()=>{e.scrollTop=t})}ee.current=null}},[el]);let eE=(0,a.useMemo)(()=>[...Z,b].filter(Boolean).join(" "),[b]),eA=(0,a.useRef)(L);eA.current=L;let eL=(0,a.useCallback)(e=>{let t=(0,W.h)(e,D);null!==t&&(async()=>{if("missing"===await (0,$.o4)(n,t)){null==v||v(eA.current("conversation.filePathMissing"),"error");return}g(t)})()},[g,n,D,v]),eR=(0,a.useCallback)(e=>()=>er(e),[er]),eP=(0,a.useCallback)(async e=>{try{await (0,U.l)(e),null==v||v(eA.current("history.copied"),"success")}catch(e){console.error("[HistoryPane] Failed to copy to clipboard"),null==v||v(eA.current("history.copyFailed"),"error")}},[v]),eD=e=>{var t,n;let a=(null==(t=e.userMessage)?void 0:t.archived)===!0||(null==(n=e.assistantMessages)?void 0:n.some(e=>!0===e.archived)),l=en(e.id)||ew.has(e.id);return(0,r.jsx)("div",{className:a?"opacity-60":"",children:(0,r.jsx)(B,{pair:e,onFilePathClick:eL,isExpanded:l,onToggleExpand:eR(e.id),onCopy:eP,onInsertToMessage:y,onRetryPending:w,onDiscardPending:k,showAssistant:!T})})},ez=(0,a.useCallback)(e=>{let t=parseInt(e.target.value,10);(0,Q.UK)(t)&&(null==S||S(t))},[S]),eO=(0,a.useCallback)(()=>{el?ef():em()},[el,em,ef]);return(0,r.jsxs)("div",{role:"region","aria-label":L("history.regionLabel"),className:eE,children:[(0,r.jsxs)("div",{className:"flex-shrink-0 bg-surface-2 border-b border-border px-4 py-2 flex items-center justify-between flex-wrap gap-1",children:[(0,r.jsx)("h3",{className:"text-sm font-medium text-foreground",children:L("history.title")}),ey>0&&(0,r.jsxs)("span",{"data-testid":"history-relay-count",title:L("relay.historyBadgeTitle"),className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,r.jsx)(i.A,{size:12,className:"shrink-0","aria-hidden":"true"}),L("relay.historyCount",{count:ey})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[S&&void 0!==C&&(0,r.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground cursor-pointer",children:[(0,r.jsx)("span",{children:L("history.show")}),(0,r.jsx)("select",{value:C,onChange:ez,"aria-label":L("history.displayLimit"),className:"rounded border border-input bg-surface text-foreground text-xs px-1.5 py-0.5 focus:outline-none focus:ring-1 focus:ring-ring",children:Q.dl.map(e=>(0,r.jsx)("option",{value:e,children:e},e))})]}),N&&(0,r.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground cursor-pointer",children:[(0,r.jsx)(m.Sc,{checked:j,onCheckedChange:e=>N(!0===e),className:"h-3.5 w-3.5"}),L("history.showArchived")]}),M&&(0,r.jsx)("button",{type:"button",onClick:()=>M(!T),"aria-label":L("history.showUserOnly"),"aria-pressed":T,className:"p-1 rounded transition-colors ".concat(T?"bg-accent-500/15 text-accent-700 dark:text-accent-300":"text-muted-foreground hover:text-foreground"),title:L(T?"history.showAllMessages":"history.showUserOnly"),children:T?(0,r.jsx)(o.A,{size:14,"aria-hidden":"true"}):(0,r.jsx)(c.A,{size:14,"aria-hidden":"true"})}),(0,r.jsx)("button",{type:"button",onClick:eO,"aria-label":L(el?"history.closeSearch":"history.openSearch"),"aria-pressed":el,className:"p-1 text-muted-foreground hover:text-foreground rounded transition-colors",title:L(el?"history.closeSearch":"history.openSearch"),children:(0,r.jsx)(u.A,{size:14,"aria-hidden":"true"})}),I&&(0,r.jsx)("button",{type:"button",onClick:I,"aria-label":L("terminal.hideHistory"),"aria-expanded":"true","aria-controls":F,className:"p-1 text-muted-foreground hover:text-foreground rounded transition-colors",title:L("terminal.hideHistory"),"data-testid":O,children:(0,r.jsx)(d.A,{size:14,"aria-hidden":"true"})})]})]}),el&&(0,r.jsx)("div",{className:"flex-shrink-0 px-3 py-2 bg-surface-2 border-b border-border",children:(0,r.jsx)(K.Y,{query:es,onQueryChange:ep,matchCount:ei,currentIndex:eo,onNext:ex,onPrev:eb,onClose:ef,isAtMaxMatches:ec,onCompositionStart:eh,onCompositionEnd:eg})}),(0,r.jsx)("div",{ref:R,"data-testid":"history-scroll-container",onScroll:eI,className:"flex-1 min-h-0 overflow-y-auto overflow-x-hidden p-4",children:x?(0,r.jsx)(G,{}):0===ej.length?(0,r.jsx)(V,{}):0===eT.length?(0,r.jsx)("div",{"data-testid":"history-fallback-list",children:ej.slice(0,Y.vC).map(e=>(0,r.jsx)("div",{children:eD(e)},e.id))}):(0,r.jsx)("div",{style:{height:eS.getTotalSize(),width:"100%",position:"relative"},children:eT.map(e=>{let t=ej[e.index];return t?(0,r.jsx)("div",{"data-index":e.index,ref:eS.measureElement,className:"absolute left-0 top-0 w-full",style:{transform:"translateY(".concat(e.start,"px)")},children:eD(t)},e.key):null})})})]})})},84228:(e,t,n)=>{n.d(t,{wY:()=>eK});var r=n(95155),a=n(12115),l=n(18955),s=n(7620),i=n(35299),o=n(8803),c=n(22479),u=n(41108),d=n(95342),m=n(96195),f=n(24033),p=n(27937),h=n(54485),g=n(37586),x=n(20562),b=n(53842),v=n(86651),y=n(28019),w=n(35252),k=n(60322),j=n(70738),N=n(64653),C=n(9708),S=n(20877),T=n(96802),M=n(89568),I=n(92147);let E={highlightName:"chat-search",currentHighlightName:"chat-search-current",fallbackOverlayId:"chat-search-fallback-overlay",fallbackOverlayBgColor:"rgba(59, 130, 246, 0.6)"},A="commandmate:chatShowToolActivity";function L(){try{return"true"===window.localStorage.getItem(A)}catch(e){return!1}}var R=n(79321);let P="chat-live-turn",D=(0,a.memo)(function(e){let{turnKey:t,version:n,body:a,partial:s=!1,isThinking:o=!1,showHeader:c=!1,onFilePathClick:u}=e,d=(0,l.c)("worktree"),m="string"==typeof a&&a.length>0;return(0,r.jsxs)("div",{"data-testid":P,"data-role":"assistant","data-turn-key":t,"data-version":void 0===n?void 0:String(n),"data-has-body":m?"true":"false",role:"group","aria-label":d("chatSurface.progressLabel"),className:R.UI,children:[c&&(0,r.jsx)("div",{className:"flex items-center gap-2 px-1 text-xs text-muted-foreground",children:(0,r.jsx)("span",{className:"font-medium",children:d("conversation.assistant")})}),(0,r.jsxs)("div",{"data-testid":R.a3,className:R.CL,children:[m&&(0,r.jsx)("div",{"data-testid":"chat-live-turn-body","data-markdown":"true",className:R.Et,children:(0,r.jsx)(R.Gn,{content:a,onFilePathClick:u})}),(0,r.jsxs)("div",{"data-testid":"chat-live-turn-indicator",role:"status","aria-live":"polite",className:["flex flex-wrap items-center gap-2 text-xs text-muted-foreground",m?"mt-1.5":""].filter(Boolean).join(" "),children:[(0,r.jsx)(i.A,{size:14,className:"animate-spin","aria-hidden":"true"}),(0,r.jsx)("span",{children:d(o?"chatSurface.thinking":"chatSurface.generating")}),s&&(0,r.jsx)("span",{"data-testid":"chat-live-turn-partial",className:"rounded border border-warning-border bg-warning-subtle px-1 py-0.5 text-warning-foreground",children:d("chatSurface.progressPartial")})]})]})]})});var z=n(92710);let O="chat-transcript-scroll-container",F="chat-transcript-jump-fab",H="absolute bottom-3 right-3 z-10 flex h-9 w-9 items-center justify-center rounded-full border border-border bg-surface-2/80 text-muted-foreground shadow-lg backdrop-blur transition-colors hover:bg-muted hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring touch-manipulation";function B(){let e=(0,l.c)("worktree");return(0,r.jsx)("div",{"data-testid":"chat-transcript-loading",role:"status","aria-label":e("chatTranscript.loading"),children:[0,1,2].map(e=>(0,r.jsxs)("div",{className:"mb-4 flex flex-col gap-1 ".concat(e%2==0?"items-end":"items-start"),children:[(0,r.jsx)(y.EA,{className:"h-3 w-24"}),(0,r.jsx)(y.EA,{className:"h-14 rounded-2xl ".concat(e%2==0?"w-2/3":"w-11/12")})]},e))})}function K(e){let{turnKey:t,version:n,body:a,partial:s=!1,showHeader:i=!1,onFilePathClick:o}=e,c=(0,l.c)("worktree"),u="string"==typeof a&&a.length>0;return(0,r.jsxs)("div",{"data-testid":P,"data-role":"assistant","data-settling":"true","data-turn-key":t,"data-version":void 0===n?void 0:String(n),"data-has-body":u?"true":"false",role:"group","aria-label":c("chatSurface.settlingLabel"),className:R.UI,children:[i&&(0,r.jsx)("div",{className:"flex items-center gap-2 px-1 text-xs text-muted-foreground",children:(0,r.jsx)("span",{className:"font-medium",children:c("conversation.assistant")})}),(0,r.jsxs)("div",{"data-testid":R.a3,className:R.CL,children:[u&&(0,r.jsx)("div",{"data-testid":"chat-live-turn-body","data-markdown":"true",className:R.Et,children:(0,r.jsx)(R.Gn,{content:a,onFilePathClick:o})}),(0,r.jsxs)("div",{"data-testid":"chat-settling-turn-note",className:["flex flex-wrap items-center gap-2 text-xs text-muted-foreground",u?"mt-1.5":""].filter(Boolean).join(" "),children:[(0,r.jsx)("span",{children:c("chatSurface.settling")}),s&&(0,r.jsx)("span",{"data-testid":"chat-live-turn-partial",className:"rounded border border-warning-border bg-warning-subtle px-1 py-0.5 text-warning-foreground",children:c("chatSurface.progressPartial")})]})]})]})}function q(e){let{count:t,isOpen:n,regionId:a,onToggle:s}=e,i=(0,l.c)("worktree"),o=n?f.A:p.A;return(0,r.jsx)("div",{className:"mb-2 flex w-full items-center",children:(0,r.jsxs)("button",{type:"button","data-testid":"chat-previous-session-toggle","data-count":String(t),onClick:s,"aria-expanded":n,"aria-controls":a,"aria-label":i(n?"chatTranscript.previousSession.collapse":"chatTranscript.previousSession.expand"),className:"flex min-h-[32px] items-center gap-1.5 rounded-full border border-border bg-surface-2 px-3 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring touch-manipulation",children:[(0,r.jsx)(h.A,{size:12,"aria-hidden":"true"}),(0,r.jsx)("span",{children:i("chatTranscript.previousSession.summary",{count:t})}),(0,r.jsx)(o,{size:12,"aria-hidden":"true"})]})})}function U(){let e=(0,l.c)("worktree");return(0,r.jsxs)("div",{"data-testid":"chat-session-ended-banner",role:"status",className:"mt-2 flex flex-col gap-0.5 rounded-lg border border-border bg-surface-2 px-3 py-2 text-xs text-muted-foreground",children:[(0,r.jsx)("span",{children:e("terminal.sessionEnded")}),(0,r.jsx)("span",{children:e("chatTranscript.previousSession.hint")})]})}function W(){let e=(0,l.c)("worktree");return(0,r.jsxs)("div",{"data-testid":"chat-transcript-empty",className:"flex flex-col items-center justify-center gap-1 py-10 text-center text-muted-foreground",children:[(0,r.jsx)(g.A,{className:"mb-1 h-10 w-10 opacity-50","aria-hidden":"true"}),(0,r.jsx)("p",{className:"text-sm",children:e("chatTranscript.empty")}),(0,r.jsx)("p",{className:"text-xs",children:e("chatTranscript.emptyHint")})]})}let $=(0,a.memo)(function(e){let{messages:t,worktreeId:n,worktreePath:s,cliToolId:c,instanceId:u,isLoading:d=!1,className:f="",onFilePathClick:p,showToast:h,onInsertToMessage:g,onRetryPending:y,onDiscardPending:P,splitIndex:$,liveTurn:_=null,sessionEnded:J=!1,onScrollControlsChange:Q}=e,Y=(0,l.c)("worktree"),G=(0,a.useRef)(null),V=(0,a.useMemo)(()=>void 0===$?E:{highlightName:"chat-search-".concat($),currentHighlightName:"chat-search-current-".concat($),fallbackOverlayId:"chat-search-fallback-overlay-".concat($),fallbackOverlayBgColor:E.fallbackOverlayBgColor},[$]),Z=(0,a.useMemo)(()=>{let e=t.filter(e=>!e.archived);return e.length===t.length?t:e},[t]),X=J&&!d,ee="".concat(n,"|").concat(null!=c?c:"","|").concat(null!=u?u:""),et=(0,a.useRef)(null),en=(0,a.useRef)(ee);en.current!==ee&&(en.current=ee,et.current=null),X?null===et.current&&(et.current=new Set(Z.filter(e=>!e.optimisticState).map(e=>e.id))):et.current=null;let er=et.current,{previousMessages:ea,currentMessages:el}=(0,a.useMemo)(()=>{if(null===er||0===er.size)return{previousMessages:[],currentMessages:Z};let e=[],t=[];for(let n of Z)!n.optimisticState&&er.has(n.id)?e.push(n):t.push(n);return{previousMessages:e,currentMessages:t}},[er,Z]),es=ea.length,ei=X&&es>0,[eo,ec]=(0,a.useState)(!1),eu=(0,a.useCallback)(()=>{ec(e=>!e)},[]);(0,a.useEffect)(()=>{ei||ec(!1)},[ei]),(0,a.useEffect)(()=>{ec(!1)},[ee]);let ed=(0,a.useMemo)(()=>void 0===$?"chat-previous-session-region":"chat-previous-session-region-".concat($),[$]),em=(0,a.useRef)(!0),ef=(0,a.useRef)(-1),ep=(0,a.useRef)(d),eh=(0,a.useRef)(0),[eg,ex]=(0,a.useState)(!0),eb=(0,a.useMemo)(()=>(eo?Z:el).filter(e=>!e.archived&&!(0,I.nY)(e)&&"string"==typeof e.content&&e.content.length>0),[Z,el,eo]),{isOpen:ev,query:ey,matchCount:ew,currentIndex:ek,isAtMaxMatches:ej,matchPositions:eN,currentMatch:eC,openSearch:eS,closeSearch:eT,setQuery:eM,onCompositionStart:eI,onCompositionEnd:eE,nextMatch:eA,prevMatch:eL}=(0,w.w)({messages:eb}),eR=ev&&eN.length>0,[eP,eD]=(0,a.useState)(L),ez=(0,a.useCallback)(()=>{let e=!eP;eD(e);try{window.localStorage.setItem(A,String(e))}catch(e){}},[eP]),eO=(0,a.useMemo)(()=>({showAll:eP}),[eP]),eF=(0,a.useMemo)(()=>ev&&0!==eN.length?new Set(eN.map(e=>e.messageId)):null,[ev,eN]);(0,a.useEffect)(()=>{eT()},[n]);let eH=(0,a.useMemo)(()=>ei?[{kind:"previousSessionHeader",key:"previous-session-header",count:es},...eo?(0,M.UY)(ea).map(e=>({...e,previousSession:!0})):[],...(0,M.UY)(el)]:(0,M.UY)(Z),[ei,eo,Z,ea,el,es]);eh.current=eH.length;let eB=(0,m.Te)({count:eH.length,getScrollElement:()=>G.current,estimateSize:()=>M.hM,overscan:M.B7,getItemKey:e=>{var t,n;return null!=(n=null==(t=eH[e])?void 0:t.key)?n:e}}),eK=eB.getVirtualItems(),eq=eK.length>0?"".concat(eK[0].index,"-").concat(eK[eK.length-1].index):"",eU=(0,a.useMemo)(()=>{let e=new Map;return eH.forEach((t,n)=>{if("previousSessionHeader"!==t.kind)if("message"===t.kind)e.set(t.message.id,n);else for(let r of t.entries)for(let t of r.messageIds)e.set(t,n)}),e},[eH]),eW=(0,a.useRef)(null),e$=(0,a.useCallback)(()=>{let e=eW.current;eW.current=null,e&&null!==e.frame&&cancelAnimationFrame(e.frame)},[]),e_=(0,a.useCallback)(()=>{e$();let e=eh.current-1;if(e<0||(eB.scrollToIndex(e,{align:"end"}),"function"!=typeof requestAnimationFrame))return;let t={frame:null,frames:0,stableFrames:0,totalSize:eB.getTotalSize(),deadline:Date.now()+600},n=()=>{if(t.frame=null,eW.current!==t)return;t.frames+=1;let e=eh.current-1;if(e<0||!em.current||t.frames>12||Date.now()>t.deadline){eW.current=null;return}let r=eB.getTotalSize();if(r===t.totalSize){if(t.stableFrames+=1,t.stableFrames>=3){eW.current=null;return}}else t.stableFrames=0,t.totalSize=r,eB.scrollToIndex(e,{align:"end"});t.frame=requestAnimationFrame(n)};eW.current=t,t.frame=requestAnimationFrame(n)},[eB,e$]);(0,a.useEffect)(()=>e$,[e$]);let eJ=(0,a.useCallback)(()=>{em.current=!0,ex(!0),e_()},[e_]),eQ=(0,a.useCallback)(()=>{e$(),em.current=!1,ex(!1),eh.current>0&&eB.scrollToIndex(0,{align:"start"})},[eB,e$]),eY=(0,a.useCallback)(()=>{let e=G.current;if(!e)return;let t=(0,T.Mp)({scrollTop:e.scrollTop,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight});(t||null===eW.current)&&(em.current=t,ex(t))},[]);(0,a.useLayoutEffect)(()=>{let e=ef.current,t=ep.current,n=Z.length;ef.current=n,ep.current=d,d||eR||0===eH.length||!em.current||(-1===e||t||!(n<=e))&&e_()},[Z.length,eH.length,d,eR,e_]),(0,a.useEffect)(()=>{if(Q)return Q({scrollToLatest:eJ,scrollToTop:eQ}),()=>Q(null)},[Q,eJ,eQ]);let eG=(0,a.useCallback)(e=>{if("Home"!==e.key&&"End"!==e.key)return;let t=e.target;t&&("INPUT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable)||0!==eh.current&&(e.preventDefault(),"End"===e.key?eJ():eQ())},[eJ,eQ]);(0,a.useEffect)(()=>{if(!ev||!eC)return;let e=eU.get(eC.messageId);void 0!==e&&eB.scrollToIndex(e,{align:"center"})},[ev,eC,eU,eB]),(0,a.useLayoutEffect)(()=>{let e=G.current;if(!e)return;if(!ev||0===eN.length)return void(0,S.fq)(V);let t=null;for(let n of eN){let r=e.querySelector('[data-message-id="'.concat(CSS.escape(n.messageId),'"]'));if(!r)continue;let a=(null==eC?void 0:eC.messageId)===n.messageId;(0,S.Gg)(r,n.ranges,a?eC.localIndex:-1,V),a&&r instanceof HTMLElement&&(t=r)}return t&&"function"==typeof t.scrollIntoView&&t.scrollIntoView({block:"center",behavior:"smooth"}),()=>{(0,S.fq)(V)}},[ev,eN,eC,V,eq]);let eV=(0,a.useRef)(Y);eV.current=Y;let eZ=(0,C.O)(),eX=null!=s?s:eZ.worktreePath,e0=(0,a.useCallback)(e=>{if(!p)return;let t=(0,j.h)(e,eX);null!==t&&(async()=>{if("missing"===await (0,N.o4)(n,t)){null==h||h(eV.current("conversation.filePathMissing"),"error");return}p(t)})()},[p,n,eX,h]),e1=(0,a.useCallback)(async e=>{try{await (0,k.l)(e),null==h||h(eV.current("history.copied"),"success")}catch(e){null==h||h(eV.current("history.copyFailed"),"error")}},[h]),e2=(0,a.useCallback)(e=>{let t=eH[e];if(!t)return null;if("previousSessionHeader"===t.kind)return(0,r.jsx)(q,{count:t.count,isOpen:eo,regionId:ed,onToggle:eu});let n=e=>t.previousSession?(0,r.jsx)("div",{"data-previous-session":"true",className:"opacity-60",children:e}):e;if("approvals"===t.kind)return n((0,r.jsx)(R.ZK,{entries:t.entries}));let a=(0,r.jsx)(R.qI,{message:t.message,showHeader:t.showHeader,header:t.header,onFilePathClick:e0,onCopy:e1,onInsertToMessage:g,onRetryPending:y,onDiscardPending:P});return n((null==eF?void 0:eF.has(t.message.id))?(0,r.jsx)(R.PZ,{value:R.vY,children:a}):a)},[eH,e0,e1,g,y,P,eF,eo,ed,eu]),e5=null!==_&&!0!==_.settling;return(0,r.jsxs)("div",{"data-testid":"chat-transcript","data-tool-activity":eP?"shown":"folded",role:"log","aria-label":Y("chatTranscript.regionLabel"),className:["relative flex h-full min-h-0 w-full flex-col overflow-hidden bg-surface",f].filter(Boolean).join(" "),children:[(0,r.jsx)("div",{ref:G,"data-testid":O,onScroll:eY,onKeyDown:eG,tabIndex:0,className:"min-h-0 flex-1 overflow-y-auto overflow-x-hidden px-3 py-3",children:(0,r.jsxs)(R.PZ,{value:eO,children:[d?(0,r.jsx)(B,{}):0===eH.length?_?null:(0,r.jsx)(W,{}):0===eK.length?(0,r.jsx)("div",{"data-testid":"chat-transcript-fallback-list",id:ei?ed:void 0,children:eH.slice(0,M.JD).map((e,t)=>(0,r.jsx)("div",{children:e2(t)},e.key))}):(0,r.jsx)("div",{id:ei?ed:void 0,style:{height:eB.getTotalSize(),width:"100%",position:"relative"},children:eK.map(e=>(0,r.jsx)("div",{"data-index":e.index,ref:eB.measureElement,className:"absolute left-0 top-0 w-full",style:{transform:"translateY(".concat(e.start,"px)")},children:e2(e.index)},e.key))}),_&&(_.settling?(0,r.jsx)(K,{turnKey:_.turnKey,version:_.version,body:_.body,partial:_.partial,showHeader:(0,M.CK)(Z[Z.length-1]),onFilePathClick:e0}):(0,r.jsx)(D,{turnKey:_.turnKey,version:_.version,body:_.body,partial:_.partial,isThinking:_.isThinking,showHeader:(0,M.CK)(Z[Z.length-1]),onFilePathClick:e0})),ei&&(0,r.jsx)(U,{})]})}),eH.length>0&&(eg?(0,r.jsx)("button",{type:"button","data-testid":F,"data-direction":"top",onClick:eQ,"aria-label":Y("chatTranscript.jumpToTop"),title:Y("chatTranscript.jumpToTop"),className:H,children:(0,r.jsx)(x.A,{size:16,"aria-hidden":"true"})}):(0,r.jsx)("button",{type:"button","data-testid":F,"data-direction":"latest","data-generating":e5?"true":void 0,onClick:eJ,"aria-label":Y(e5?"chatSurface.jumpToLatestGenerating":"chatSurface.jumpToLatest"),title:Y(e5?"chatSurface.jumpToLatestGenerating":"chatSurface.jumpToLatest"),className:H,children:e5?(0,r.jsx)(i.A,{size:16,className:"animate-spin","aria-hidden":"true"}):(0,r.jsx)(o.A,{size:16,"aria-hidden":"true"})})),(0,r.jsxs)("div",{className:"pointer-events-none absolute right-2 top-2 z-10 flex items-start justify-end gap-1",children:[!ev&&(0,r.jsx)("div",{className:"pointer-events-auto",children:(0,r.jsx)("button",{type:"button","data-testid":"chat-transcript-tool-activity-toggle",onClick:ez,"aria-pressed":eP,"aria-label":Y(eP?"chatTranscript.toolActivity.hide":"chatTranscript.toolActivity.show"),title:Y(eP?"chatTranscript.toolActivity.hide":"chatTranscript.toolActivity.show"),className:["rounded-full border border-border p-1.5 shadow-sm backdrop-blur transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-ring touch-manipulation",eP?"bg-accent-500/15 text-accent-700 hover:bg-accent-500/25 dark:text-accent-400":"bg-surface-2/80 text-muted-foreground hover:bg-muted hover:text-foreground"].join(" "),children:(0,r.jsx)(b.A,{size:14,"aria-hidden":"true"})})}),(0,r.jsx)("div",{className:"pointer-events-auto",children:ev?(0,r.jsx)(z.Y,{query:ey,onQueryChange:eM,matchCount:ew,currentIndex:ek,onNext:eA,onPrev:eL,onClose:eT,isAtMaxMatches:ej,onCompositionStart:eI,onCompositionEnd:eE}):(0,r.jsx)("button",{type:"button","data-testid":"chat-transcript-search-toggle",onClick:eS,"aria-label":Y("chatTranscript.openSearch"),title:Y("chatTranscript.openSearch"),className:"rounded-full border border-border bg-surface-2/80 p-1.5 text-muted-foreground shadow-sm backdrop-blur transition-colors hover:bg-muted hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring touch-manipulation",children:(0,r.jsx)(v.A,{size:14,"aria-hidden":"true"})})})]})]})});var _=n(78596),J=n(51515),Q=n(16342);let Y=/\x1b\[[0-9;]*[a-zA-Z]|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)|\[[0-9;]*m/g,G=/^(?:\x1b\[|\[)([0-9;]*)m$/,V=new Set([38,48,58]);function Z(e){let t;Y.lastIndex=0;let n=[],r="",a=null,l=0,s=0,i=0;for(;null!==(t=Y.exec(e));){let o=e.slice(i,t.index);r+=o,l+=(0,Q.LQ)(o),i=t.index+t[0].length;let c=G.exec(t[0]);if(null===c)continue;let u=function(e,t){let n=(""===t?"0":t).split(";"),r=e;for(let e=0;e<n.length;e++){let t=Number(""===n[e]?"0":n[e]);if(Number.isFinite(t)){if(V.has(t)){let a="2"===n[e+1]?4:2*("5"===n[e+1]);a>0&&48===t&&(r=n.slice(e,e+1+a).join(";")),e+=a;continue}0===t||49===t?r=null:(t>=40&&t<=47||t>=100&&t<=107)&&(r=n[e])}}return r}(a,c[1]);u!==a&&(l>s&&n.push({bg:a,start:s,end:l}),a=u,s=l)}let o=e.slice(i);r+=o,(l+=(0,Q.LQ)(o))>s&&n.push({bg:a,start:s,end:l});let c=new Set(n.map(e=>e.start));return n.length>0&&c.add(n[n.length-1].end),{text:r,segments:n,edges:c,width:l}}function X(e,t){for(let n of e.segments)if(n.start<=t&&t<n.end)return n.bg;return null}function ee(e){let t=new Set;for(let n of e.segments)null!==n.bg&&t.add(n.bg);return t}function et(e){let t=new Map;for(let r of e.segments){var n;null!==r.bg&&t.set(r.bg,(null!=(n=t.get(r.bg))?n:0)+(r.end-r.start))}let r=null,a=0;for(let[e,n]of t)n>a&&(r=e,a=n);return{bg:r,columns:a}}var en=n(18341),er=n(813);let ea=/\S[^\S\n]{2,}esc[^\S\n]*$/,el=/^[│┃╹]/;function es(e,t,n){if(!e.edges.has(t)||!e.edges.has(n))return!1;for(let r of e.segments)if(!(r.end<=t)&&!(r.start>=n)&&null===r.bg)return!1;return!(X(e,t-1)===X(e,t)||n<e.width&&X(e,n)===X(e,n-1)||el.test((0,Q.Ml)(e.text,t-1,t)))&&!el.test((0,Q.Ml)(e.text,t,n))}let ei=/^[^0-9A-Za-z]*([1-9])[.)]\s+\S/,eo=/\bs\s+to\s+use\s+this\s+session\s+only\b/i,ec=/\bEnter\s+to\s+set\s+as\s+default\b/i,eu=/\btype\s+to\s+search\b|\bsearch\s+\w+\s*(?:…|\.\.\.)|(?:^|·)\s*\/\s+search\b/im,ed=/\benter\s+to\s+select\b\s*[·•]\s*esc\s+to\s+cancel\b/i,em=/^\s*(?:press|hit|type)?\s*(?:<)?esc(?:ape)?(?:>)?\s+to\s+(?:close|dismiss|exit)\b[\s.·•]*$/im,ef=/^\u2500+$/,ep="●◉⦿",eh=new RegExp("^\\s*([".concat(ep).concat("◯○◌⚪","])\\s+\\S")),eg=/\besc\s+to\s+interrupt\b|^[^\S\n]*✻[^\S\n]+\S/im;function ex(e){let t=function(e){if(!e)return null;let t=e.replace(/\r\n/g,"\n").split("\n").map(J.aJ),n=t.length-1;for(;n>=0&&""===t[n].trim();)n-=1;if(n<1)return null;let r=-1;for(let e=n-1;e>=0;e-=1){let n=t[e].trim();if(!(n.length<40)&&ef.test(n)){r=e;break}}if(r<0)return null;let a=t.slice(r+1,n+1),l=a.join("\n");if(eu.test(l)||ed.test(l)||em.test(l)||eg.test(l))return null;let s=a.findIndex(e=>""!==e.trim());if(s<0||!function(e){let t=e.split("|");if(t.length<2)return!1;let n=0,r=0;for(let e of t){let t=eh.exec(e);if(null===t)return!1;ep.includes(t[1])?n+=1:r+=1}return n>0&&r>0}(a[s]))return null;let i=[],o=-1;for(let e=s+1;e<a.length;e+=1){let t=ei.exec(a[e]);null!==t&&(o<0&&(o=e),i.push(Number(t[1])))}if(i.length<2||!a.slice(s+1,o).some(e=>""!==e.trim()))return null;let c=0,u=-1;for(let e=0;e<a.length;e+=1){let t=a[e].split("❯").length-1;0!==t&&(c+=t,ei.test(a[e])&&(u=e))}return 0===c||u<0?null:{ruleLineIndex:r,firstLineIndex:r+1,lastLineIndex:n,tabLineIndex:r+1+s,numbers:i,cursorCount:c,cursorLineIndex:r+1+u}}(e);return null!==t&&t.numbers.every((e,t)=>e===t+1)&&1===t.cursorCount?{ruleLineIndex:t.ruleLineIndex,firstLineIndex:t.firstLineIndex,lastLineIndex:t.lastLineIndex,tabLineIndex:t.tabLineIndex,cursorLineIndex:t.cursorLineIndex,optionCount:t.numbers.length}:null}let eb={optionCount:0,offersSessionScope:!1,commitsDefaultOnEnter:!1,hasFilterInput:!1},ev=[function(e){let t=function(e){let t=e.split("\n").map(Z),n=new Set,r=null;for(let e of t){if(!e.text.includes("esc"))continue;let a=[...e.edges].sort((e,t)=>e-t);for(let l of a)if(!(l<1))for(let s of a){if(s-l<16)continue;let a="".concat(l,":").concat(s);if(n.has(a)||!es(e,l,s))continue;let i=(0,Q.Ml)(e.text,l,s);if(!ea.test(i))continue;n.add(a);let o=t.filter(e=>es(e,l,s));if(o.length<3)continue;let c=o.indexOf(e);c<0||c>=3||(null===r||o.length>r.rows)&&(r={id:"opencode_modal_overlay",headerText:(0,er.D)(i.trim(),200,"…[truncated]"),left:l,right:s,rows:o.length,headerRow:c,frameRowStart:t.indexOf(o[0]),frameRowEnd:t.indexOf(o[o.length-1])})}}return r}(e);return null===t?null:e.split("\n").slice(t.frameRowStart,t.frameRowEnd+1).join("\n")},function(e){let t=e.replace(/\r\n/g,"\n").split("\n"),n=-1;for(let e=t.length-1;e>=0;e-=1)if(ed.test((0,J.aJ)(t[e]))){n=e;break}if(n<0){let n=ex(e);return null===n?null:t.slice(n.firstLineIndex,n.lastLineIndex+1).join("\n")}for(let e=n-1;e>=0;e-=1){let r=(0,J.aJ)(t[e]).trim();if(!(r.length<40)&&ef.test(r))return t.slice(e+1,n+1).join("\n")}return null}];function ey(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e)return"";let n=e.replace(/\r\n/g,"\n");if(t.selectionList)for(let e of ev){let t=e(n);if(null===t)continue;let r=(0,en.Uw)(t,{isStructuralRow:en.CG});if(""!==r)return r}let r=(0,en.Uw)(n,{isStructuralRow:en.CG});if(""===r)return"";if(t.selectionList)return r;let a=r.split("\n"),l=function(e){if(void 0===e||!Number.isFinite(e))return 16;let t=Math.trunc(e);return t<12?12:t>20?20:t}(t.maxLines);return a.slice(-l).join("\n")}let ew=/^[^\S\n]*[❯›●][^\S\n]/;function ek(e){let{frame:t,maxLines:n=16,maxHeightClassName:s="max-h-64",actions:i,reason:o,className:c=""}=e,u=(0,l.c)("worktree"),d="selectionList"===o,m=(0,a.useMemo)(()=>ey(t,{maxLines:n,selectionList:d}),[t,n,d]),f=(0,a.useMemo)(()=>m?(0,_.l5)(m):"",[m]),p=(0,a.useRef)(null),h=(0,a.useMemo)(()=>d&&m?function(e){let t=e.split("\n"),n=-1;for(let e=t.length-1;e>=0;e-=1)if(ew.test((0,J.aJ)(t[e]))){n=e;break}return Math.max(n,function(e){let t=e.map(Z),n=t.map(et),r=t.map(ee);for(let e=t.length-1;e>=0;e-=1){let{bg:a,columns:l}=n[e];if(!(null===a||l<8||e>0&&r[e-1].has(a))&&!(e+1<t.length&&r[e+1].has(a)))return e}return -1}(t))}(m):-1,[d,m]);return((0,a.useLayoutEffect)(()=>{if(h<0)return;let e=p.current;if(!e)return;let t=(0,J.aJ)(m).split("\n").length;if(t<=1)return;let n=e.scrollHeight-e.clientHeight;if(n<=0)return;let r=window.getComputedStyle(e),a=Number.parseFloat(r.paddingTop)||0,l=Number.parseFloat(r.paddingBottom)||0,s=Math.max(0,e.scrollHeight-a-l)/t,i=a+h*s-(e.clientHeight-s)/2;e.scrollTop=Math.min(n,Math.max(0,i))},[h,m]),m)?(0,r.jsxs)("div",{"data-testid":"chat-dialog-card","data-reason":o,role:"group","aria-label":u("chatSurface.dialogCardLabel"),className:["flex min-w-0 flex-col gap-2",c].filter(Boolean).join(" "),children:[(0,r.jsx)("div",{ref:p,"data-testid":"chat-dialog-card-frame",className:"overflow-auto rounded-lg border border-border bg-terminal-surface p-2 font-mono text-[11px] leading-snug text-terminal-foreground ".concat(s),children:(0,r.jsx)("div",{className:"whitespace-pre w-max",dangerouslySetInnerHTML:{__html:f}})}),i?(0,r.jsx)("div",{"data-testid":"chat-dialog-card-actions",className:"min-w-0",children:i}):null]}):null}var ej=n(60734),eN=n(73190),eC=n(51021),eS=n(56827),eT=n(49509);let eM=[{key:"1",label:"1",ariaLabel:"Send 1"},{key:"2",label:"2",ariaLabel:"Send 2"},{key:"3",label:"3",ariaLabel:"Send 3"},{key:"4",label:"4",ariaLabel:"Send 4"},{key:"5",label:"5",ariaLabel:"Send 5"},{key:"6",label:"6",ariaLabel:"Send 6"},{key:"7",label:"7",ariaLabel:"Send 7"},{key:"8",label:"8",ariaLabel:"Send 8"},{key:"9",label:"9",ariaLabel:"Send 9"}],eI=[{key:"y",label:"y",ariaLabel:"Send y"},{key:"n",label:"n",ariaLabel:"Send n"},{key:"Enter",label:"↵",ariaLabel:"Send Enter"}],eE="Escape";function eA(e){let{worktreeId:t,cliToolId:n,instanceId:s,onKeysSent:i}=e,o=(0,l.c)("worktree"),{activeKey:c,markPressed:u}=(0,eT.t)(),d=(0,eS.B)(t,n,s,i),m=(0,a.useCallback)(e=>{u(e),d([e])},[u,d]);return(0,r.jsxs)("div",{"data-testid":"prompt-answer-keys",role:"toolbar","aria-label":o("promptAnswerKeys.toolbarLabel"),className:"flex flex-wrap items-center gap-1.5 rounded-lg bg-muted px-2 py-1.5",children:[(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:o("promptAnswerKeys.caption")}),[...eM,...eI].map(e=>{let{key:t,label:n,ariaLabel:a}=e;return(0,r.jsx)("button",{type:"button","data-testid":"prompt-answer-key-".concat(t),"aria-label":a,onClick:()=>m(t),className:"min-h-[44px] min-w-[44px] rounded-md border border-border px-3 py-2 text-sm font-medium transition-colors duration-75 touch-manipulation focus:outline-none focus:ring-2 focus:ring-ring ".concat(c===t?"border-accent-500 bg-accent-500 text-white scale-95":"bg-surface hover:bg-muted active:bg-muted dark:bg-surface-2"),children:n},t)})]})}function eL(e){let{worktreeId:t,cliToolId:n,instanceId:s,onKeysSent:i,optionCount:o}=e,c=(0,l.c)("worktree"),{activeKey:u,markPressed:d}=(0,eT.t)(),m=(0,eS.B)(t,n,s,i),f=(0,a.useMemo)(()=>{let e=Math.min(Math.trunc(o),9);return!Number.isFinite(e)||e<1?[]:eM.slice(0,e)},[o]),p=(0,a.useCallback)(e=>{d(e),m([e])},[d,m]);return 0===f.length?null:(0,r.jsxs)("div",{"data-testid":"selection-number-keys","data-option-count":String(f.length),role:"toolbar","aria-label":c("selectionKeys.numbersToolbarLabel"),className:"flex flex-wrap items-center gap-1.5 rounded-lg bg-muted px-2 py-1.5",children:[(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:c("selectionKeys.numbersCaption")}),f.map(e=>{let{key:t,label:n,ariaLabel:a}=e;return(0,r.jsx)("button",{type:"button","data-testid":"selection-number-key-".concat(t),"aria-label":a,onClick:()=>p(t),className:"min-h-[44px] min-w-[44px] rounded-md border border-border px-3 py-2 text-sm font-medium transition-colors duration-75 touch-manipulation focus:outline-none focus:ring-2 focus:ring-ring ".concat(u===t?"border-accent-500 bg-accent-500 text-white scale-95":"bg-surface hover:bg-muted active:bg-muted dark:bg-surface-2"),children:n},t)})]})}function eR(e){let{worktreeId:t,cliToolId:n,instanceId:s,onKeysSent:i,commitsDefaultOnEnter:o}=e,c=(0,l.c)("worktree"),{activeKey:u,markPressed:d}=(0,eT.t)(),m=(0,eS.B)(t,n,s,i),f=(0,a.useCallback)(e=>{d(e),m([e])},[d,m]);return(0,r.jsxs)("div",{"data-testid":"selection-commit-keys",role:"toolbar","aria-label":c("selectionKeys.commitToolbarLabel"),className:"flex flex-wrap items-center gap-1.5 rounded-lg bg-muted px-2 py-1.5",children:[(0,r.jsx)("button",{type:"button","data-testid":"selection-commit-session","aria-label":c("selectionKeys.sessionOnlyAria"),title:c("selectionKeys.sessionOnlyAria"),onClick:()=>f(eC.mE),className:"min-h-[44px] rounded-md border px-3 py-2 text-sm font-medium transition-colors duration-75 touch-manipulation focus:outline-none focus:ring-2 focus:ring-ring ".concat(u===eC.mE?"border-accent-500 bg-accent-500 text-white scale-95":"border-accent-500 bg-surface text-accent-600 hover:bg-muted active:bg-muted dark:bg-surface-2 dark:text-accent-400"),children:c("selectionKeys.sessionOnly")}),(0,r.jsx)("button",{type:"button","data-testid":"selection-commit-default","aria-label":c("selectionKeys.setDefaultAria"),title:c("selectionKeys.setDefaultAria"),onClick:()=>f("Enter"),className:"min-h-[44px] rounded-md border border-border px-3 py-2 text-sm font-medium transition-colors duration-75 touch-manipulation focus:outline-none focus:ring-2 focus:ring-ring ".concat("Enter"===u?"border-accent-500 bg-accent-500 text-white scale-95":"bg-surface hover:bg-muted active:bg-muted dark:bg-surface-2"),children:c("selectionKeys.setDefault")}),o?(0,r.jsx)("p",{"data-testid":"selection-commit-warning",className:"w-full text-xs text-muted-foreground",children:c("selectionKeys.defaultWarning")}):null]})}function eP(e){let{worktreeId:t,cliToolId:n,instanceId:s,onKeysSent:i}=e,o=(0,l.c)("worktree"),{activeKey:c,markPressed:u}=(0,eT.t)(),d=(0,eS.B)(t,n,s,i),m=(0,a.useCallback)(()=>{u(eE),d([eE])},[u,d]);return(0,r.jsx)("div",{"data-testid":"dismiss-panel-keys",role:"toolbar","aria-label":o("dismissPanelKeys.toolbarLabel"),className:"flex flex-wrap items-center gap-1.5 rounded-lg bg-muted px-2 py-1.5",children:(0,r.jsx)("button",{type:"button","data-testid":"dismiss-panel-key-Escape","aria-label":o("dismissPanelKeys.closeAria"),title:o("dismissPanelKeys.closeAria"),onClick:m,className:"min-h-[44px] rounded-md border px-3 py-2 text-sm font-medium transition-colors duration-75 touch-manipulation focus:outline-none focus:ring-2 focus:ring-ring ".concat(c===eE?"border-accent-500 bg-accent-500 text-white scale-95":"border-accent-500 bg-surface text-accent-600 hover:bg-muted active:bg-muted dark:bg-surface-2 dark:text-accent-400"),children:o("dismissPanelKeys.close")})})}[...eM.map(e=>e.key),...eI.map(e=>e.key)];var eD=n(40240),ez=n(68276),eO=n(60199),eF=n(52703);let eH='[data-testid="'.concat(O,'"]'),eB={pager:"chatSurface.reasonPager",selectionList:"chatSurface.reasonSelectionList",dismissablePanel:"chatSurface.reasonDismissablePanel",unclassified:"chatSurface.reasonUnclassified",promptUnreadable:"chatSurface.reasonPromptUnreadable"},eK=(0,a.memo)(function(e){var t,n;let{messages:m,worktreeId:f,worktreePath:p,cliToolId:h,instanceId:g,live:x,onSurfaceModeChange:b,frame:v,onKeysSent:y,compact:w=!1,history:k,className:j=""}=e,N=(0,l.c)("worktree"),C=(0,a.useRef)(null),S=(0,a.useMemo)(()=>(function(e){let t=new Map;for(let n of e)t.set(n.id,n);return t.size===e.length?e:Array.from(t.values())})(m),[m]),M=!1===x.attaching&&!1===x.isRunning,I=(0,a.useRef)(!0),E=(0,a.useRef)(-1),[A,L]=(0,a.useState)(!1),[R,P]=(0,a.useState)(!0),D=(0,a.useCallback)(()=>{var e,t;return null!=(t=null==(e=C.current)?void 0:e.querySelector(eH))?t:null},[]),[z,O]=(0,a.useState)(!1),F=(0,a.useCallback)(e=>{O(null!==e)},[]),H=(0,a.useCallback)(()=>{let e=D();e&&(e.scrollTop=e.scrollHeight),I.current=!0,P(!0),L(!1)},[D]);(0,a.useEffect)(()=>{let e=D();if(!e)return;let t=()=>{let t=(0,T.Mp)({scrollTop:e.scrollTop,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight});I.current=t,P(t),t&&L(!1)};return e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)},[D,null==k?void 0:k.isLoading]),(0,a.useLayoutEffect)(()=>{let e=E.current,t=S.length;if(E.current=t,-1!==e&&!(t<=e)){if(I.current){let e=D();e&&(e.scrollTop=e.scrollHeight);return}L(!0)}},[S.length,D]);let B="running"===x.sessionStatus,K=function(e){let{worktreeId:t,cliToolId:n,instanceId:r,enabled:l=!0}=e,{addListener:s,connected:i}=(0,eO.xM)(),[o,c]=(0,a.useState)(null),u=(0,a.useRef)(0),d=null!=r?r:n;(0,a.useEffect)(()=>{u.current=0,c(null)},[t,n,d]),(0,a.useEffect)(()=>{l&&(u.current=0,c(null))},[l]),(0,a.useEffect)(()=>{!i&&l&&(u.current=0,c(null))},[i,l]),(0,a.useEffect)(()=>{if(l||null===o)return;let e=setTimeout(()=>c(null),6e5);return()=>clearTimeout(e)},[l,o]),(0,a.useEffect)(()=>{if(l&&void 0!==n)return s(e=>{e.type===eF.rz&&void 0!==n&&void 0!==d&&e.worktreeId===t&&e.cliToolId===n&&e.instanceId===d&&"string"==typeof e.turnKey&&0!==e.turnKey.length&&"string"==typeof e.body&&"number"==typeof e.version&&Number.isFinite(e.version)&&(e.version<=u.current||(u.current=e.version,c({turnKey:e.turnKey,body:e.body,partial:!0===e.partial,version:e.version,settling:!1})))})},[s,l,t,n,d]);let m=(0,a.useMemo)(()=>null===o?null:{...o,settling:!0},[o]);return l?i?o:null:m}({worktreeId:f,cliToolId:h,instanceId:g,enabled:B}),q=S.length?S[S.length-1].id:null,U=(null==K?void 0:K.settling)===!0,W=(0,a.useRef)(null),[_,Q]=(0,a.useState)(!1);(0,a.useEffect)(()=>{if(!U){W.current=null,Q(!1);return}if(null===W.current){W.current={id:q};return}W.current.id!==q&&Q(!0)},[U,q]);let[Y,G]=(0,a.useState)(null);(0,a.useEffect)(()=>{M&&null!==K&&G(K.turnKey)},[M,K]);let V=null===K||K.turnKey===Y||function(e,t){for(let n=e.length-1;n>=0;n-=1)if(e[n].requestId===t)return!0;return!1}(S,K.turnKey)||K.settling&&_?null:K,Z=(0,a.useMemo)(()=>M?null:null!==V?{turnKey:V.turnKey,version:V.version,body:V.body,partial:V.partial,isThinking:!V.settling&&!0===x.isThinking,settling:V.settling}:B?{isThinking:!0===x.isThinking}:null,[V,B,x.isThinking,M]),X=null!==Z,ee=X&&!0!==Z.settling,et=(0,a.useRef)(!1);(0,a.useLayoutEffect)(()=>{if(!et.current){et.current=!0;return}if(!I.current)return;let e=D();e&&(e.scrollTop=e.scrollHeight)},[null==V?void 0:V.body,X,D]);let en=x.isPagerActive?"pager":x.isSelectionListActive?"selectionList":(null!=(n=x.isDismissablePanelActive)?n:function(e){if(!e)return!1;let t=(0,J.aJ)(e.replace(/\r\n/g,"\n")).split("\n"),n=t.length-1;for(;n>=0&&""===t[n].trim();)n-=1;return!(n<0)&&t.slice(Math.max(0,n+1-15),n+1).some(e=>em.test(e))}(v))?"dismissablePanel":x.isUnclassifiedActive?"unclassified":x.isPromptWaiting&&!(0,ez.XF)(x.promptData)?"promptUnreadable":null,er=(0,a.useCallback)(()=>{b("terminal")},[b]),ea=(0,a.useRef)(null);(0,a.useEffect)(()=>()=>{null!==ea.current&&clearTimeout(ea.current)},[]);let el=(0,a.useCallback)(()=>{null==y||y(),null!==ea.current&&clearTimeout(ea.current),ea.current=setTimeout(()=>{ea.current=null,null==y||y()},400)},[y]),es=(0,a.useMemo)(()=>"selectionList"===en?function(e){if(!e)return eb;let t=function(e){let t=(0,J.aJ)(e.replace(/\r\n/g,"\n")).split("\n"),n=t.length-1;for(;n>=0&&""===t[n].trim();)n-=1;return n<0?[]:t.slice(Math.max(0,n+1-40),n+1)}(e);if(0===t.length)return eb;let n=t.join("\n");return{optionCount:function(e){let t=0,n=0;for(let r of e){let e=ei.exec(r);if(null===e)continue;let a=Number(e[1]);a===n+1?(n=a,t=a):1===a?(n=1,t=1):n=0}return Math.min(t,9)}(t),offersSessionScope:eo.test(n),commitsDefaultOnEnter:ec.test(n),hasFilterInput:eu.test(n)}}(v):null,[en,v]),ed=(0,a.useMemo)(()=>"selectionList"===en&&null!==ex(v),[en,v]),ef=(0,a.useMemo)(()=>"selectionList"===en&&v?ey(v,{selectionList:!0}).split("\n").length:0,[en,v]),ep=(0,a.useMemo)(()=>{if(null===en||!h)return null;let e={worktreeId:f,cliToolId:h,instanceId:g,onKeysSent:el};switch(en){case"pager":return(0,r.jsx)(ej.y,{...e,showPagerKeys:!0});case"selectionList":{var t;let n=(null==es?void 0:es.offersSessionScope)===!0&&eC.qL.includes(h);return(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(ej.y,{...e}),!es||ed||!((t=es).optionCount>0)||t.offersSessionScope||t.hasFilterInput?null:(0,r.jsx)(eL,{...e,optionCount:es.optionCount}),n&&es?(0,r.jsx)(eR,{...e,commitsDefaultOnEnter:es.commitsDefaultOnEnter}):null,(0,r.jsx)(eD.tY,{worktreeId:f,cliToolId:h,instanceId:g,onKeysSent:el})]})}case"dismissablePanel":return(0,r.jsx)(eP,{...e});case"unclassified":return(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(eN.U,{...e}),(0,r.jsx)(eA,{...e})]});case"promptUnreadable":return(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("p",{"data-testid":"chat-surface-unreadable-hint",className:"text-xs text-muted-foreground",children:N("chatSurface.unreadableHint")}),(0,r.jsx)(eA,{...e})]})}},[en,h,f,g,el,es,ed,N]),eh=null!=k?k:{},eg=(0,u.UI)(f),ev=null!=(t=null!=g?g:h)?t:null,ew=(0,a.useMemo)(()=>ev?(0,d.y)((0,d.g)({owed:eg.owedBy(ev),awaiting:eg.awaitedBy(ev),aliasOf:e=>e.worktreeId===f?e.instanceId:"".concat(e.instanceId," @ ").concat(e.worktreeId)})):null,[eg,ev,f]);return(0,r.jsxs)("div",{ref:C,"data-testid":"chat-surface","data-instance-id":null!=g?g:h,className:["flex h-full min-h-0 w-full flex-col overflow-hidden bg-surface text-surface-foreground",j].filter(Boolean).join(" "),children:[ew&&(0,r.jsxs)("div",{"data-testid":"chat-surface-relay","data-relay-tone":ew.tone,role:"status",className:"flex shrink-0 items-center gap-1.5 border-b border-border px-3 py-1 text-xs ".concat("prompt"===ew.tone?"bg-warning-subtle text-warning-foreground":"bg-surface-2 text-muted-foreground"),children:[(0,r.jsx)(s.A,{size:12,className:"shrink-0","aria-hidden":"true"}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate",children:N("relay.".concat(ew.key),ew.params)})]}),(0,r.jsxs)("div",{className:"relative min-h-0 flex-1 overflow-hidden",children:[(0,r.jsx)($,{...eh,messages:S,worktreeId:f,worktreePath:p,cliToolId:h,liveTurn:Z,instanceId:g,sessionEnded:M,onScrollControlsChange:F,className:"h-full"}),!z&&(A||X&&!R)&&(0,r.jsxs)("button",{type:"button","data-testid":"chat-surface-new-messages","data-generating":ee?"true":void 0,onClick:H,"aria-label":ee?N("chatSurface.jumpToLatestGenerating"):void 0,className:"absolute bottom-3 left-1/2 z-10 flex min-h-[36px] -translate-x-1/2 items-center gap-1.5 rounded-full border border-border bg-surface-2 px-3 py-1.5 text-xs font-medium text-foreground shadow-lg transition-colors hover:bg-muted focus:outline-none focus-visible:ring-2 focus-visible:ring-ring touch-manipulation",children:[ee?(0,r.jsx)(i.A,{size:14,className:"animate-spin","aria-hidden":"true"}):(0,r.jsx)(o.A,{size:14,"aria-hidden":"true"}),N("chatSurface.jumpToLatest")]})]}),null!==en&&(0,r.jsxs)("div",{"data-testid":"chat-surface-live",role:"group","aria-label":N("chatSurface.liveRegionLabel"),className:"flex shrink-0 flex-col gap-2 border-t border-border bg-surface px-3 py-2",children:[(0,r.jsxs)("div",{"data-testid":"chat-surface-terminal-banner","data-reason":en,role:"status","aria-label":N("chatSurface.bannerLabel"),className:"flex flex-wrap items-center gap-2 rounded-lg border border-warning-border bg-warning-subtle px-2 py-1.5",children:[(0,r.jsx)("span",{className:"min-w-0 flex-1 text-xs text-foreground",children:N(eB[en])}),(0,r.jsxs)("button",{type:"button","data-testid":"chat-surface-open-terminal",onClick:er,className:"flex min-h-[32px] shrink-0 items-center gap-1 rounded-md border border-warning-border bg-surface px-2 py-1 text-xs font-medium text-warning-foreground transition-colors hover:bg-muted focus:outline-none focus-visible:ring-2 focus-visible:ring-ring touch-manipulation",children:[(0,r.jsx)(c.A,{size:14,"aria-hidden":"true"}),N("chatSurface.openTerminal")]})]}),v?(0,r.jsx)(ek,{frame:v,reason:en,maxLines:w?12:void 0,maxHeightClassName:ef>24?"max-h-[35vh]":w?"max-h-32":"max-h-64",actions:ep}):null]})]})})},87364:(e,t,n)=>{n.d(t,{t:()=>s});var r=n(95155),a=n(12115),l=n(18955);class s extends a.Component{static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){var n,r;console.error("[ErrorBoundary:".concat(this.props.componentName||"unknown","]"),e,t),null==(n=(r=this.props).onError)||n.call(r,e,t)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,r.jsx)(i,{componentName:this.props.componentName,error:this.state.error,onRetry:this.handleRetry}):this.props.children}constructor(e){super(e),this.handleRetry=()=>{this.setState({hasError:!1,error:null})},this.state={hasError:!1,error:null}}}function i(e){let{componentName:t,error:n,onRetry:a}=e,s=(0,l.c)("error"),i=(0,l.c)("common");return(0,r.jsxs)("div",{className:"p-4 bg-danger-subtle border border-danger-border rounded-lg",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 text-danger-foreground mb-2",children:[(0,r.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),(0,r.jsx)("span",{className:"font-medium",children:t?s("boundary.errorOccurredIn",{componentName:t}):s("boundary.errorOccurred")})]}),n&&(0,r.jsx)("p",{className:"text-sm text-danger-foreground/80 mb-3",children:n.message}),a&&(0,r.jsx)("button",{onClick:a,className:"px-4 py-2 bg-danger-foreground text-danger-subtle rounded hover:opacity-90 transition-opacity text-sm",children:i("retry")})]})}},88731:(e,t,n)=>{n.d(t,{UK:()=>s,dl:()=>r,gP:()=>i,v8:()=>a,wP:()=>l});let r=[50,100,150,200,250,500,1e3],a=50,l="commandmate:historyDisplayLimit";function s(e){return r.includes(e)}let i="commandmate:historyUserOnly"},88894:(e,t,n)=>{function r(e){let t="[^\\S\\n]";return RegExp("(?:^".concat(t,"*|\xb7").concat(t,"*|").concat(t,"{2})").concat(e)+"(?:".concat(t,"\\([^()\\n]{1,32}\\))?")+"(?:".concat(t,"*\xb7|").concat(t,"{2}|").concat(t,"*$)"),"i")}n.d(t,{A:()=>s,h:()=>l});let a={claude:{key:"BTab",cycle:["auto","manual","accept-edits","plan"],indicators:[{mode:"accept-edits",pattern:/⏵⏵\s*accept edits on\b/},{mode:"auto",pattern:/⏵⏵\s*auto mode on\b/},{mode:"plan",pattern:/⏸\s*plan mode on\b/},{mode:"manual",pattern:/⏸\s*manual mode on\b/}],tailRows:3,noteId:null},"command-code":{key:"BTab",cycle:["default","accept-edits","plan"],indicators:[{mode:"accept-edits",pattern:/»\s*accept edits on\b/},{mode:"bypass",pattern:/»\s*permission bypass on\b/},{mode:"dont-ask",pattern:/»\s*don't-ask on\b/},{mode:"plan",pattern:/^[^\S\n]*plan mode\b/},{mode:"default",pattern:/\?\s+for\s+shortcuts\b/}],tailRows:4,noteId:null},codex:{key:"BTab",cycle:["default","plan"],indicators:[{mode:"plan",pattern:/\bPlan mode\s*\(shift\+tab to cycle\)/i}],tailRows:3,noteId:"codexModelCoupled"},copilot:{key:"BTab",cycle:["default","plan","autopilot"],indicators:[{mode:"autopilot",pattern:r("autopilot")},{mode:"plan",pattern:r("plan(?:[^\\S\\n]mode)?")}],tailRows:2,noteId:null},antigravity:{key:"BTab",cycle:["default","accept-edits","plan"],indicators:[{mode:"accept-edits",pattern:r("accept-edits")},{mode:"plan",pattern:r("plan(?:[^\\S\\n]mode)?")}],tailRows:2,noteId:null}};function l(e){var t;return null!=(t=a[e])?t:null}let s=Object.keys(a)},89568:(e,t,n)=>{n.d(t,{B7:()=>l,CK:()=>f,JD:()=>i,ML:()=>m,UY:()=>u,hM:()=>s});var r=n(4300),a=n(92147);let l=8,s=120,i=40,o={variant:"none",startedAtMs:null};function c(e){var t,n;return"".concat(null!=(t=e.cliToolId)?t:"","|").concat(null!=(n=e.instanceId)?n:"")}function u(e){let t,n=function(e){let t=[],n=[],r=[],l=!1,s=()=>{t.push(...n,...r),n=[],r=[]};for(let i of e){if("user"===i.role&&!(0,a.nY)(i)){s(),t.push(i);continue}if(!(0,a.nY)(i)){r.push(i);continue}r.length>0&&(l=!0),n.push(i)}return s(),l?t:e}(e),l=function(e){let t=new Map;for(let n of e){if("user"!==n.role||(0,a.nY)(n)||n.optimisticState||n.archived)continue;let e=n.requestId;if("string"!=typeof e||0===e.length)continue;if(t.has(e)){t.set(e,null);continue}let r=n.timestamp instanceof Date?n.timestamp.getTime():NaN;t.set(e,Number.isFinite(r)?{atMs:r,scope:c(n)}:null)}return t}(n),s=[],i=function(e){let t=new Map,n=0,r=!1;for(let l of e){if(!(0,a.nY)(l)){r=!1;continue}r||(n+=1,r=!0),t.has(l.id)||t.set(l.id,n)}return t}(e),u=[],d=null,m=null,f=()=>{0!==u.length&&(s.push({kind:"approvals",key:"approvals:".concat(u[0].id),entries:(0,a.GV)(u,{runIds:i})}),u=[])};for(let e of n){var p;if((0,a.nY)(e)){u.push(e);continue}f();let n=!(p=t)||p.role!==e.role,i=o;if("assistant"!==e.role)d=null,m=null,n&&(i={variant:"role",startedAtMs:null});else{let t=c(e);(n||m!==t)&&(d=null),m=t;let a=(0,r.Qu)(e.requestId),s=function(e,t,n){if(null===t)return null;let a=(0,r.QN)(t);if(null===a)return null;let l=n.get(a);if(!l||l.scope!==c(e))return null;let s=e.timestamp instanceof Date?e.timestamp.getTime():NaN;return!Number.isFinite(s)||l.atMs>s?null:l.atMs}(e,a,l);n?i={variant:"role",startedAtMs:s}:null!==a&&null!==d&&a!==d&&(i={variant:"time",startedAtMs:s}),null!==a&&(d=a)}s.push({kind:"message",key:e.id,message:e,showHeader:n,header:i}),t=e}return f(),s}let d=/(^|[\s`"'(\[<(「『【])(\/[^\s\n<>"']+\.[a-zA-Z0-9]+)/g;function m(e){if("string"!=typeof e||0===e.length)return[{type:"text",content:""}];let t=[],n=0;for(let l of e.matchAll(d)){var r,a;let s=null!=(r=l[1])?r:"",i=l[2];if(!i)continue;let o=(null!=(a=l.index)?a:0)+s.length;o>n&&t.push({type:"text",content:e.slice(n,o)}),t.push({type:"path",content:i}),n=o+i.length}return 0===t.length?[{type:"text",content:e}]:(n<e.length&&t.push({type:"text",content:e.slice(n)}),t)}function f(e){return!e||"assistant"!==e.role}},92147:(e,t,n)=>{n.d(t,{GV:()=>N,rS:()=>C,nY:()=>y});var r=n(68276),a=n(3648);function l(){let e=(0,a._)(["←s*(?:[☐☒☑][^←→☐☒☑✔]*)+✔s*Submits*→"],["←\\s*(?:[☐☒☑][^←→☐☒☑✔]*)+✔\\s*Submit\\s*→"]);return l=function(){return e},e}let s=String.raw(l()),i=new RegExp("^".concat(s,"\\s*"));new RegExp("^\\s?".concat(s,"$"));let o=/\s*Ready to submit your answers\?\s*$/,c=/^Review your answers\s*/,u=/●\s*([^●→]+)/g,d=/^submit answers$/i,m=/^cancel$/i,f={human:5,auto:4,terminal:3,pending:2,unclassified:1,unknown:0};function p(e){return"object"==typeof e&&null!==e?e:null}function h(e,t){let n=null==e?void 0:e[t];return"string"==typeof n?n:""}function g(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if("string"==typeof n){t.push(n);continue}let e=h(p(n),"label");e&&t.push(e)}return t}function x(e){return e.replace(/\s+/g," ").trim()}function b(e){return e.length<=160?e:"".concat(e.slice(0,159).trimEnd(),"…")}function v(e){return x(e).replace(i,"").trim()}function y(e){return(null==e?void 0:e.messageType)==="prompt"}function w(e){let t=null==e?void 0:e.summary;return"string"==typeof t&&t.startsWith("PermissionRequest allow")}function k(e){return{...e,messageIds:[...e.messageIds],reviewQuestions:[...e.reviewQuestions]}}function j(e,t,n){if(e<=0||t<=0)return!1;let r=t-e;return r>=0&&r<=n}function N(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{windowMs:n=5e3,runIds:a}=t;return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5e3,n=[];for(let r of e){if("question"===r.kind){let e=n[n.length-1];if("confirmation"===r.phase){if(e&&"question"===e.kind&&"question"===e.phase&&e.scopeKey===r.scopeKey&&e.runId===r.runId&&""!==e.questionText&&r.reviewQuestions.includes(e.questionText)&&j(e.timestampMs,r.timestampMs,t)){e.messageIds.push(...r.messageIds),e.confirmationOutcome=r.outcome;continue}n.push(k(r));continue}if(e&&"question"===e.kind&&"question"===e.phase&&""!==r.mergeKey&&e.mergeKey===r.mergeKey&&e.runId===r.runId&&j(e.timestampMs,r.timestampMs,t)){e.messageIds.push(...r.messageIds),e.label||(e.label=r.label),f[r.outcome]>f[e.outcome]&&(e.outcome=r.outcome);continue}n.push(k(r));continue}let e=r.mergeKey?n.find(e=>"approval"===e.kind&&e.mergeKey===r.mergeKey&&Math.abs(r.timestampMs-e.timestampMs)<=t):void 0;if(!e){n.push(k(r));continue}e.messageIds.push(...r.messageIds),e.isPermissionAudit=e.isPermissionAudit||r.isPermissionAudit,e.label||(e.label=r.label),f[r.outcome]>f[e.outcome]&&(e.outcome=r.outcome)}return n}(e.map(e=>{var t;return function(e){let t,n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,l=p(e.promptData),s=w(e),i=h(l,"question"),f=h(l,"approvalTarget"),y=h(l,"answeredBy"),k=h(l,"status"),j=h(l,"type"),N="string"==typeof e.summary?e.summary:"",C=function(e,t){let n=v(e),r=o.test(n),a=g(t),l=n.replace(o,"").replace(c,"").trim();return{hasTail:r,hasSubmitOptions:a.some(e=>d.test(e.trim()))&&a.some(e=>m.test(e.trim())),reviewQuestions:[...l.matchAll(u)].map(e=>{var t;return(null!=(t=e[1])?t:"").trim()}).filter(e=>e.length>0)}}(i,null==l?void 0:l.options),{kind:S,phase:T}=w(e)?{kind:"approval"}:(null==l?void 0:l.isAskUserQuestion)===!0?{kind:"question",phase:C.hasTail||C.hasSubmitOptions?"confirmation":"question"}:C.hasTail&&(C.hasSubmitOptions||C.reviewQuestions.length>0)?{kind:"question",phase:"confirmation"}:{kind:"approval"};t=s?"auto":"auto"===y||"human"===y||"terminal"===y?y:j===r.LT||"unclassified"===k?"unclassified":"pending"===k?"pending":"unknown";let M=function(e){let t="string"==typeof e.cliToolId&&e.cliToolId?e.cliToolId:"claude",n="string"==typeof e.instanceId&&e.instanceId?e.instanceId:t;return JSON.stringify(["string"==typeof e.worktreeId?e.worktreeId:"",t,n])}(e),I="question"===S&&"question"===T,E=I?v(i):"",A="question"===S&&"confirmation"===T&&1===C.reviewQuestions.length?C.reviewQuestions[0]:"";n="question"===S?b(I?E:A):b(x(i||N));let L="";if(I){let e=p(null==l?void 0:l.askUserQuestion),t="number"==typeof(null==e?void 0:e.questionIndex)?e.questionIndex:null;L=E?JSON.stringify(["question",M,E,t,g(null==l?void 0:l.options)]):""}else"approval"===S&&(L=i?JSON.stringify([i,f]):"");return{id:e.id,messageIds:[e.id],label:n,outcome:t,isPermissionAudit:s,timestampMs:function(e){if(e instanceof Date){let t=e.getTime();return Number.isFinite(t)?t:0}if("string"==typeof e||"number"==typeof e){let t=new Date(e).getTime();return Number.isFinite(t)?t:0}return 0}(e.timestamp),mergeKey:L,kind:S,...T?{phase:T}:{},questionText:E,reviewQuestions:C.reviewQuestions,scopeKey:M,runId:a}}(e,null!=(t=null==a?void 0:a.get(e.id))?t:0)}),n)}function C(e){let t=0,n=0,r=0;for(let a of e)"question"!==a.kind?t+=1:"confirmation"===a.phase?r+=1:n+=1;return{approvals:t,questions:n,confirmations:r,total:e.length}}},92710:(e,t,n)=>{n.d(t,{Y:()=>i});var r=n(95155),a=n(12115),l=n(18955),s=n(78660);function i(e){let{query:t,onQueryChange:n,matchCount:i,currentIndex:o,onNext:c,onPrev:u,onClose:d,isAtMaxMatches:m,onCompositionStart:f,onCompositionEnd:p}=e,h=(0,a.useRef)(null),g=(0,l.c)("worktree");(0,a.useEffect)(()=>{var e;null==(e=h.current)||e.focus()},[]);let x=(0,a.useCallback)(e=>{"Escape"===e.key&&d()},[d]),b=(0,a.useCallback)(e=>{n(e.target.value)},[n]),v=0===i?"0/0":m?g("history.search.countAtMax",{current:o+1,max:s.F0}):"".concat(o+1,"/").concat(i);return(0,r.jsxs)("div",{className:"flex items-center gap-1 px-2 py-1 bg-surface border border-border rounded shadow-lg",role:"search","aria-label":g("history.search.regionLabel"),children:[(0,r.jsx)("input",{ref:h,type:"text",value:t,onChange:b,onKeyDown:x,onCompositionStart:f,onCompositionEnd:p,placeholder:g("history.search.placeholder"),className:"bg-transparent text-foreground text-sm outline-none w-32 sm:w-40 placeholder-muted-foreground","aria-label":g("history.search.keywordLabel"),autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1}),(0,r.jsx)("span",{role:"status","aria-live":"polite","aria-atomic":"true",className:"text-muted-foreground text-xs min-w-[3rem] text-right",children:v}),(0,r.jsx)("button",{type:"button",onClick:u,disabled:0===i,"aria-label":g("history.search.prev"),className:"text-muted-foreground hover:text-foreground disabled:opacity-40 min-w-[36px] min-h-[36px] flex items-center justify-center text-base",children:"▲"}),(0,r.jsx)("button",{type:"button",onClick:c,disabled:0===i,"aria-label":g("history.search.next"),className:"text-muted-foreground hover:text-foreground disabled:opacity-40 min-w-[36px] min-h-[36px] flex items-center justify-center text-base",children:"▼"}),(0,r.jsx)("button",{type:"button",onClick:d,"aria-label":g("history.search.close"),className:"text-muted-foreground hover:text-foreground min-w-[36px] min-h-[36px] flex items-center justify-center text-base ml-1",children:"✕"})]})}},95342:(e,t,n)=>{function r(e){let t=[],n=e.awaiting.filter(e=>"prompt"===e.state);n.length>0&&t.push({tone:"prompt",key:"badgePrompt",params:{count:n.length,alias:e.aliasOf(n[0].to)},titleKey:"promptTitle",count:n.length});let r=e.awaiting.filter(e=>"prompt"!==e.state);return 1===r.length?t.push({tone:"awaiting",key:"badgeAwaiting",params:{alias:e.aliasOf(r[0].to)},titleKey:"awaitingTitle",count:1}):r.length>1&&t.push({tone:"awaiting",key:"badgeAwaitingMany",params:{count:r.length},titleKey:"awaitingTitle",count:r.length}),1===e.owed.length?t.push({tone:"owed",key:"badgeOwed",params:{alias:e.aliasOf(e.owed[0].from)},titleKey:"owedTitle",count:1}):e.owed.length>1&&t.push({tone:"owed",key:"badgeOwedMany",params:{count:e.owed.length},titleKey:"owedTitle",count:e.owed.length}),t}function a(e){if(0===e.length)return null;let[t]=e,n="prompt"===t.tone?"stripPrompt":"owed"===t.tone?"stripOwed":t.count>1?"stripAwaitingMany":"stripAwaiting";return{...t,key:n}}n.d(t,{g:()=>r,y:()=>a})},96802:(e,t,n)=>{n.d(t,{Mp:()=>s,__:()=>a,b:()=>r,vC:()=>l});let r=6,a=160,l=30;function s(e){let{scrollTop:t,scrollHeight:n,clientHeight:r}=e,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:80,l=n-t-r;return!!Number.isFinite(l)&&l<=a}}}]);