commandmate 0.44.1 → 0.44.3

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 (604) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-build-manifest.json +169 -169
  3. package/.next/app-path-routes-manifest.json +35 -35
  4. package/.next/build-manifest.json +2 -2
  5. package/.next/prerender-manifest.json +3 -3
  6. package/.next/react-loadable-manifest.json +0 -6
  7. package/.next/required-server-files.json +1 -1
  8. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  9. package/.next/server/app/api/agents/update/route.js +1 -1
  10. package/.next/server/app/api/agents/update/route_client-reference-manifest.js +1 -1
  11. package/.next/server/app/api/agents/versions/route.js +1 -1
  12. package/.next/server/app/api/agents/versions/route_client-reference-manifest.js +1 -1
  13. package/.next/server/app/api/app/release-notes/route_client-reference-manifest.js +1 -1
  14. package/.next/server/app/api/app/update/route.js +2 -2
  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_client-reference-manifest.js +1 -1
  17. package/.next/server/app/api/auth/login/route.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.js +1 -1
  24. package/.next/server/app/api/daily-summary/route.js.nft.json +1 -1
  25. package/.next/server/app/api/daily-summary/route_client-reference-manifest.js +1 -1
  26. package/.next/server/app/api/daily-summary/status/route.js +1 -1
  27. package/.next/server/app/api/daily-summary/status/route.js.nft.json +1 -1
  28. package/.next/server/app/api/daily-summary/status/route_client-reference-manifest.js +1 -1
  29. package/.next/server/app/api/external-apps/[id]/health/route_client-reference-manifest.js +1 -1
  30. package/.next/server/app/api/external-apps/[id]/route.js +1 -1
  31. package/.next/server/app/api/external-apps/[id]/route_client-reference-manifest.js +1 -1
  32. package/.next/server/app/api/external-apps/route.js +1 -1
  33. package/.next/server/app/api/external-apps/route_client-reference-manifest.js +1 -1
  34. package/.next/server/app/api/fs/browse/route_client-reference-manifest.js +1 -1
  35. package/.next/server/app/api/fs/recent-paths/route_client-reference-manifest.js +1 -1
  36. package/.next/server/app/api/hooks/agent-event/route.js +2 -2
  37. package/.next/server/app/api/hooks/agent-event/route.js.nft.json +1 -1
  38. package/.next/server/app/api/hooks/agent-event/route_client-reference-manifest.js +1 -1
  39. package/.next/server/app/api/hooks/claude-done/route.js +2 -2
  40. package/.next/server/app/api/hooks/claude-done/route.js.nft.json +1 -1
  41. package/.next/server/app/api/hooks/claude-done/route_client-reference-manifest.js +1 -1
  42. package/.next/server/app/api/hooks/permission-request/route.js +1 -1
  43. package/.next/server/app/api/hooks/permission-request/route.js.nft.json +1 -1
  44. package/.next/server/app/api/hooks/permission-request/route_client-reference-manifest.js +1 -1
  45. package/.next/server/app/api/metrics/vibe/route_client-reference-manifest.js +1 -1
  46. package/.next/server/app/api/ollama/models/route_client-reference-manifest.js +1 -1
  47. package/.next/server/app/api/push/escalation/route.js +1 -1
  48. package/.next/server/app/api/push/escalation/route_client-reference-manifest.js +1 -1
  49. package/.next/server/app/api/push/subscriptions/route.js +2 -2
  50. package/.next/server/app/api/push/subscriptions/route_client-reference-manifest.js +1 -1
  51. package/.next/server/app/api/push/vapid/route.js +1 -1
  52. package/.next/server/app/api/push/vapid/route_client-reference-manifest.js +1 -1
  53. package/.next/server/app/api/relays/[relayId]/cancel/route.js +1 -1
  54. package/.next/server/app/api/relays/[relayId]/cancel/route.js.nft.json +1 -1
  55. package/.next/server/app/api/relays/[relayId]/cancel/route_client-reference-manifest.js +1 -1
  56. package/.next/server/app/api/relays/route.js +1 -1
  57. package/.next/server/app/api/relays/route.js.nft.json +1 -1
  58. package/.next/server/app/api/relays/route_client-reference-manifest.js +1 -1
  59. package/.next/server/app/api/remote/pair/route_client-reference-manifest.js +1 -1
  60. package/.next/server/app/api/repositories/[id]/route.js +1 -1
  61. package/.next/server/app/api/repositories/[id]/route_client-reference-manifest.js +1 -1
  62. package/.next/server/app/api/repositories/clone/[jobId]/route.js +1 -1
  63. package/.next/server/app/api/repositories/clone/[jobId]/route.js.nft.json +1 -1
  64. package/.next/server/app/api/repositories/clone/[jobId]/route_client-reference-manifest.js +1 -1
  65. package/.next/server/app/api/repositories/clone/route.js +1 -1
  66. package/.next/server/app/api/repositories/clone/route.js.nft.json +1 -1
  67. package/.next/server/app/api/repositories/clone/route_client-reference-manifest.js +1 -1
  68. package/.next/server/app/api/repositories/excluded/route_client-reference-manifest.js +1 -1
  69. package/.next/server/app/api/repositories/restore/route.js +1 -1
  70. package/.next/server/app/api/repositories/restore/route.js.nft.json +1 -1
  71. package/.next/server/app/api/repositories/restore/route_client-reference-manifest.js +1 -1
  72. package/.next/server/app/api/repositories/route.js +1 -1
  73. package/.next/server/app/api/repositories/route.js.nft.json +1 -1
  74. package/.next/server/app/api/repositories/route_client-reference-manifest.js +1 -1
  75. package/.next/server/app/api/repositories/scan/route.js +1 -1
  76. package/.next/server/app/api/repositories/scan/route.js.nft.json +1 -1
  77. package/.next/server/app/api/repositories/scan/route_client-reference-manifest.js +1 -1
  78. package/.next/server/app/api/repositories/sync/route.js +1 -1
  79. package/.next/server/app/api/repositories/sync/route.js.nft.json +1 -1
  80. package/.next/server/app/api/repositories/sync/route_client-reference-manifest.js +1 -1
  81. package/.next/server/app/api/repositories/validate-path/route_client-reference-manifest.js +1 -1
  82. package/.next/server/app/api/settings/default-agents/route.js +1 -1
  83. package/.next/server/app/api/settings/default-agents/route.js.nft.json +1 -1
  84. package/.next/server/app/api/settings/default-agents/route_client-reference-manifest.js +1 -1
  85. package/.next/server/app/api/settings/default-surface-mode/route_client-reference-manifest.js +1 -1
  86. package/.next/server/app/api/sidebar/group-order/route.js +1 -1
  87. package/.next/server/app/api/sidebar/group-order/route_client-reference-manifest.js +1 -1
  88. package/.next/server/app/api/skills/[id]/route.js +1 -1
  89. package/.next/server/app/api/skills/[id]/route_client-reference-manifest.js +1 -1
  90. package/.next/server/app/api/skills/installations/route_client-reference-manifest.js +1 -1
  91. package/.next/server/app/api/skills/operations/route_client-reference-manifest.js +1 -1
  92. package/.next/server/app/api/skills/reindex/route_client-reference-manifest.js +1 -1
  93. package/.next/server/app/api/skills/route.js +1 -1
  94. package/.next/server/app/api/skills/route_client-reference-manifest.js +1 -1
  95. package/.next/server/app/api/slash-commands/route_client-reference-manifest.js +1 -1
  96. package/.next/server/app/api/tasks/[taskId]/cancel/route_client-reference-manifest.js +1 -1
  97. package/.next/server/app/api/tasks/[taskId]/route_client-reference-manifest.js +1 -1
  98. package/.next/server/app/api/templates/[id]/route.js +2 -2
  99. package/.next/server/app/api/templates/[id]/route_client-reference-manifest.js +1 -1
  100. package/.next/server/app/api/templates/route.js +2 -2
  101. package/.next/server/app/api/templates/route_client-reference-manifest.js +1 -1
  102. package/.next/server/app/api/verification/runs/[runId]/route_client-reference-manifest.js +1 -1
  103. package/.next/server/app/api/verification/runs/route_client-reference-manifest.js +1 -1
  104. package/.next/server/app/api/worktrees/[id]/auto-yes/route.js +1 -1
  105. package/.next/server/app/api/worktrees/[id]/auto-yes/route.js.nft.json +1 -1
  106. package/.next/server/app/api/worktrees/[id]/auto-yes/route_client-reference-manifest.js +1 -1
  107. package/.next/server/app/api/worktrees/[id]/capture/route.js +1 -1
  108. package/.next/server/app/api/worktrees/[id]/capture/route.js.nft.json +1 -1
  109. package/.next/server/app/api/worktrees/[id]/capture/route_client-reference-manifest.js +1 -1
  110. package/.next/server/app/api/worktrees/[id]/clear-composer/route.js +1 -1
  111. package/.next/server/app/api/worktrees/[id]/clear-composer/route.js.nft.json +1 -1
  112. package/.next/server/app/api/worktrees/[id]/clear-composer/route_client-reference-manifest.js +1 -1
  113. package/.next/server/app/api/worktrees/[id]/cli-reference/route_client-reference-manifest.js +1 -1
  114. package/.next/server/app/api/worktrees/[id]/cli-tool/route.js +1 -1
  115. package/.next/server/app/api/worktrees/[id]/cli-tool/route_client-reference-manifest.js +1 -1
  116. package/.next/server/app/api/worktrees/[id]/cmate/schedules/route.js +3 -3
  117. package/.next/server/app/api/worktrees/[id]/cmate/schedules/route.js.nft.json +1 -1
  118. package/.next/server/app/api/worktrees/[id]/cmate/schedules/route_client-reference-manifest.js +1 -1
  119. package/.next/server/app/api/worktrees/[id]/current-output/route.js +1 -1
  120. package/.next/server/app/api/worktrees/[id]/current-output/route.js.nft.json +1 -1
  121. package/.next/server/app/api/worktrees/[id]/current-output/route_client-reference-manifest.js +1 -1
  122. package/.next/server/app/api/worktrees/[id]/direct-input/route.js +1 -1
  123. package/.next/server/app/api/worktrees/[id]/direct-input/route.js.nft.json +1 -1
  124. package/.next/server/app/api/worktrees/[id]/direct-input/route_client-reference-manifest.js +1 -1
  125. package/.next/server/app/api/worktrees/[id]/env/route_client-reference-manifest.js +1 -1
  126. package/.next/server/app/api/worktrees/[id]/execution-logs/[logId]/route_client-reference-manifest.js +1 -1
  127. package/.next/server/app/api/worktrees/[id]/execution-logs/route.js +2 -2
  128. package/.next/server/app/api/worktrees/[id]/execution-logs/route.js.nft.json +1 -1
  129. package/.next/server/app/api/worktrees/[id]/execution-logs/route_client-reference-manifest.js +1 -1
  130. package/.next/server/app/api/worktrees/[id]/files/[...path]/route.js +1 -1
  131. package/.next/server/app/api/worktrees/[id]/files/[...path]/route_client-reference-manifest.js +1 -1
  132. package/.next/server/app/api/worktrees/[id]/git/branch/create/route.js +1 -1
  133. package/.next/server/app/api/worktrees/[id]/git/branch/create/route_client-reference-manifest.js +1 -1
  134. package/.next/server/app/api/worktrees/[id]/git/branch/delete/route.js +1 -1
  135. package/.next/server/app/api/worktrees/[id]/git/branch/delete/route_client-reference-manifest.js +1 -1
  136. package/.next/server/app/api/worktrees/[id]/git/branches/route_client-reference-manifest.js +1 -1
  137. package/.next/server/app/api/worktrees/[id]/git/checkout/route.js +1 -1
  138. package/.next/server/app/api/worktrees/[id]/git/checkout/route_client-reference-manifest.js +1 -1
  139. package/.next/server/app/api/worktrees/[id]/git/commit/route.js +1 -1
  140. package/.next/server/app/api/worktrees/[id]/git/commit/route_client-reference-manifest.js +1 -1
  141. package/.next/server/app/api/worktrees/[id]/git/diff/route_client-reference-manifest.js +1 -1
  142. package/.next/server/app/api/worktrees/[id]/git/fetch/route.js +1 -1
  143. package/.next/server/app/api/worktrees/[id]/git/fetch/route_client-reference-manifest.js +1 -1
  144. package/.next/server/app/api/worktrees/[id]/git/log/route_client-reference-manifest.js +1 -1
  145. package/.next/server/app/api/worktrees/[id]/git/pull/route.js +1 -1
  146. package/.next/server/app/api/worktrees/[id]/git/pull/route_client-reference-manifest.js +1 -1
  147. package/.next/server/app/api/worktrees/[id]/git/push/route.js +1 -1
  148. package/.next/server/app/api/worktrees/[id]/git/push/route_client-reference-manifest.js +1 -1
  149. package/.next/server/app/api/worktrees/[id]/git/reset/route.js +1 -1
  150. package/.next/server/app/api/worktrees/[id]/git/reset/route_client-reference-manifest.js +1 -1
  151. package/.next/server/app/api/worktrees/[id]/git/revert/route.js +1 -1
  152. package/.next/server/app/api/worktrees/[id]/git/revert/route_client-reference-manifest.js +1 -1
  153. package/.next/server/app/api/worktrees/[id]/git/show/[commitHash]/route_client-reference-manifest.js +1 -1
  154. package/.next/server/app/api/worktrees/[id]/git/stage/route.js +1 -1
  155. package/.next/server/app/api/worktrees/[id]/git/stage/route_client-reference-manifest.js +1 -1
  156. package/.next/server/app/api/worktrees/[id]/git/staged/route_client-reference-manifest.js +1 -1
  157. package/.next/server/app/api/worktrees/[id]/git/stash/[index]/route_client-reference-manifest.js +1 -1
  158. package/.next/server/app/api/worktrees/[id]/git/stash/apply/route.js +1 -1
  159. package/.next/server/app/api/worktrees/[id]/git/stash/apply/route_client-reference-manifest.js +1 -1
  160. package/.next/server/app/api/worktrees/[id]/git/stash/pop/route.js +1 -1
  161. package/.next/server/app/api/worktrees/[id]/git/stash/pop/route_client-reference-manifest.js +1 -1
  162. package/.next/server/app/api/worktrees/[id]/git/stash/push/route.js +1 -1
  163. package/.next/server/app/api/worktrees/[id]/git/stash/push/route_client-reference-manifest.js +1 -1
  164. package/.next/server/app/api/worktrees/[id]/git/stash/route_client-reference-manifest.js +1 -1
  165. package/.next/server/app/api/worktrees/[id]/git/status/route_client-reference-manifest.js +1 -1
  166. package/.next/server/app/api/worktrees/[id]/git/unstage/route.js +1 -1
  167. package/.next/server/app/api/worktrees/[id]/git/unstage/route_client-reference-manifest.js +1 -1
  168. package/.next/server/app/api/worktrees/[id]/git/working-diff/route_client-reference-manifest.js +1 -1
  169. package/.next/server/app/api/worktrees/[id]/instances/notes/route.js +1 -1
  170. package/.next/server/app/api/worktrees/[id]/instances/notes/route_client-reference-manifest.js +1 -1
  171. package/.next/server/app/api/worktrees/[id]/instances/opencode/route.js +1 -1
  172. package/.next/server/app/api/worktrees/[id]/instances/opencode/route.js.nft.json +1 -1
  173. package/.next/server/app/api/worktrees/[id]/instances/opencode/route_client-reference-manifest.js +1 -1
  174. package/.next/server/app/api/worktrees/[id]/interrupt/route.js +1 -1
  175. package/.next/server/app/api/worktrees/[id]/interrupt/route.js.nft.json +1 -1
  176. package/.next/server/app/api/worktrees/[id]/interrupt/route_client-reference-manifest.js +1 -1
  177. package/.next/server/app/api/worktrees/[id]/kill-session/route.js +1 -1
  178. package/.next/server/app/api/worktrees/[id]/kill-session/route.js.nft.json +1 -1
  179. package/.next/server/app/api/worktrees/[id]/kill-session/route_client-reference-manifest.js +1 -1
  180. package/.next/server/app/api/worktrees/[id]/logs/[filename]/route_client-reference-manifest.js +1 -1
  181. package/.next/server/app/api/worktrees/[id]/logs/route_client-reference-manifest.js +1 -1
  182. package/.next/server/app/api/worktrees/[id]/marp-render/route.js +1 -1
  183. package/.next/server/app/api/worktrees/[id]/marp-render/route_client-reference-manifest.js +1 -1
  184. package/.next/server/app/api/worktrees/[id]/memos/[memoId]/route.js +1 -1
  185. package/.next/server/app/api/worktrees/[id]/memos/[memoId]/route_client-reference-manifest.js +1 -1
  186. package/.next/server/app/api/worktrees/[id]/memos/route.js +1 -1
  187. package/.next/server/app/api/worktrees/[id]/memos/route_client-reference-manifest.js +1 -1
  188. package/.next/server/app/api/worktrees/[id]/messages/route_client-reference-manifest.js +1 -1
  189. package/.next/server/app/api/worktrees/[id]/opencode/diff/route.js +1 -1
  190. package/.next/server/app/api/worktrees/[id]/opencode/diff/route_client-reference-manifest.js +1 -1
  191. package/.next/server/app/api/worktrees/[id]/opencode/session/route.js +1 -2
  192. package/.next/server/app/api/worktrees/[id]/opencode/session/route.js.nft.json +1 -1
  193. package/.next/server/app/api/worktrees/[id]/opencode/session/route_client-reference-manifest.js +1 -1
  194. package/.next/server/app/api/worktrees/[id]/opencode/share/route.js +1 -2
  195. package/.next/server/app/api/worktrees/[id]/opencode/share/route.js.nft.json +1 -1
  196. package/.next/server/app/api/worktrees/[id]/opencode/share/route_client-reference-manifest.js +1 -1
  197. package/.next/server/app/api/worktrees/[id]/prompt-response/route.js +1 -1
  198. package/.next/server/app/api/worktrees/[id]/prompt-response/route.js.nft.json +1 -1
  199. package/.next/server/app/api/worktrees/[id]/prompt-response/route_client-reference-manifest.js +1 -1
  200. package/.next/server/app/api/worktrees/[id]/resolve-target/route_client-reference-manifest.js +1 -1
  201. package/.next/server/app/api/worktrees/[id]/respond/route.js +1 -1
  202. package/.next/server/app/api/worktrees/[id]/respond/route.js.nft.json +1 -1
  203. package/.next/server/app/api/worktrees/[id]/respond/route_client-reference-manifest.js +1 -1
  204. package/.next/server/app/api/worktrees/[id]/route.js +1 -1
  205. package/.next/server/app/api/worktrees/[id]/route.js.nft.json +1 -1
  206. package/.next/server/app/api/worktrees/[id]/route_client-reference-manifest.js +1 -1
  207. package/.next/server/app/api/worktrees/[id]/schedules/[scheduleId]/route.js +2 -2
  208. package/.next/server/app/api/worktrees/[id]/schedules/[scheduleId]/route.js.nft.json +1 -1
  209. package/.next/server/app/api/worktrees/[id]/schedules/[scheduleId]/route_client-reference-manifest.js +1 -1
  210. package/.next/server/app/api/worktrees/[id]/schedules/active/route.js +2 -2
  211. package/.next/server/app/api/worktrees/[id]/schedules/active/route.js.nft.json +1 -1
  212. package/.next/server/app/api/worktrees/[id]/schedules/active/route_client-reference-manifest.js +1 -1
  213. package/.next/server/app/api/worktrees/[id]/schedules/route.js +3 -3
  214. package/.next/server/app/api/worktrees/[id]/schedules/route.js.nft.json +1 -1
  215. package/.next/server/app/api/worktrees/[id]/schedules/route_client-reference-manifest.js +1 -1
  216. package/.next/server/app/api/worktrees/[id]/search/route_client-reference-manifest.js +1 -1
  217. package/.next/server/app/api/worktrees/[id]/send/route.js +1 -1
  218. package/.next/server/app/api/worktrees/[id]/send/route.js.nft.json +1 -1
  219. package/.next/server/app/api/worktrees/[id]/send/route_client-reference-manifest.js +1 -1
  220. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/git-workflow/route.js +3 -3
  221. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/git-workflow/route.js.nft.json +1 -1
  222. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/git-workflow/route_client-reference-manifest.js +1 -1
  223. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/install/route_client-reference-manifest.js +1 -1
  224. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/plan/route.js +1 -1
  225. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/plan/route_client-reference-manifest.js +1 -1
  226. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/uninstall/route_client-reference-manifest.js +1 -1
  227. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/uninstall-plan/route_client-reference-manifest.js +1 -1
  228. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/update/route_client-reference-manifest.js +1 -1
  229. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/update-plan/route.js +1 -1
  230. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/update-plan/route_client-reference-manifest.js +1 -1
  231. package/.next/server/app/api/worktrees/[id]/skills/route_client-reference-manifest.js +1 -1
  232. package/.next/server/app/api/worktrees/[id]/slash-commands/route.js +1 -1
  233. package/.next/server/app/api/worktrees/[id]/slash-commands/route_client-reference-manifest.js +1 -1
  234. package/.next/server/app/api/worktrees/[id]/special-keys/route.js +1 -1
  235. package/.next/server/app/api/worktrees/[id]/special-keys/route.js.nft.json +1 -1
  236. package/.next/server/app/api/worktrees/[id]/special-keys/route_client-reference-manifest.js +1 -1
  237. package/.next/server/app/api/worktrees/[id]/tasks/route.js +1 -1
  238. package/.next/server/app/api/worktrees/[id]/tasks/route_client-reference-manifest.js +1 -1
  239. package/.next/server/app/api/worktrees/[id]/terminal/route.js +2 -2
  240. package/.next/server/app/api/worktrees/[id]/terminal/route.js.nft.json +1 -1
  241. package/.next/server/app/api/worktrees/[id]/terminal/route_client-reference-manifest.js +1 -1
  242. package/.next/server/app/api/worktrees/[id]/timers/history/route_client-reference-manifest.js +1 -1
  243. package/.next/server/app/api/worktrees/[id]/timers/route.js +1 -1
  244. package/.next/server/app/api/worktrees/[id]/timers/route.js.nft.json +1 -1
  245. package/.next/server/app/api/worktrees/[id]/timers/route_client-reference-manifest.js +1 -1
  246. package/.next/server/app/api/worktrees/[id]/todos/[todoId]/route.js +1 -1
  247. package/.next/server/app/api/worktrees/[id]/todos/[todoId]/route_client-reference-manifest.js +1 -1
  248. package/.next/server/app/api/worktrees/[id]/todos/route.js +1 -1
  249. package/.next/server/app/api/worktrees/[id]/todos/route_client-reference-manifest.js +1 -1
  250. package/.next/server/app/api/worktrees/[id]/tree/[...path]/route_client-reference-manifest.js +1 -1
  251. package/.next/server/app/api/worktrees/[id]/tree/route_client-reference-manifest.js +1 -1
  252. package/.next/server/app/api/worktrees/[id]/upload/[...path]/route_client-reference-manifest.js +1 -1
  253. package/.next/server/app/api/worktrees/[id]/verify/config/route.js +1 -1
  254. package/.next/server/app/api/worktrees/[id]/verify/config/route_client-reference-manifest.js +1 -1
  255. package/.next/server/app/api/worktrees/[id]/verify/route.js +1 -1
  256. package/.next/server/app/api/worktrees/[id]/verify/route_client-reference-manifest.js +1 -1
  257. package/.next/server/app/api/worktrees/[id]/verify/runs/[runId]/cancel/route.js +1 -1
  258. package/.next/server/app/api/worktrees/[id]/verify/runs/[runId]/cancel/route_client-reference-manifest.js +1 -1
  259. package/.next/server/app/api/worktrees/[id]/verify/runs/[runId]/route_client-reference-manifest.js +1 -1
  260. package/.next/server/app/api/worktrees/[id]/verify/runs/route_client-reference-manifest.js +1 -1
  261. package/.next/server/app/api/worktrees/[id]/viewed/route_client-reference-manifest.js +1 -1
  262. package/.next/server/app/api/worktrees/apply-default-agents/route_client-reference-manifest.js +1 -1
  263. package/.next/server/app/api/worktrees/route.js +1 -1
  264. package/.next/server/app/api/worktrees/route.js.nft.json +1 -1
  265. package/.next/server/app/api/worktrees/route_client-reference-manifest.js +1 -1
  266. package/.next/server/app/login/page_client-reference-manifest.js +1 -1
  267. package/.next/server/app/manifest.webmanifest/route_client-reference-manifest.js +1 -1
  268. package/.next/server/app/more/page_client-reference-manifest.js +1 -1
  269. package/.next/server/app/offline/page_client-reference-manifest.js +1 -1
  270. package/.next/server/app/page_client-reference-manifest.js +1 -1
  271. package/.next/server/app/proxy/[...path]/route_client-reference-manifest.js +1 -1
  272. package/.next/server/app/repositories/page_client-reference-manifest.js +1 -1
  273. package/.next/server/app/review/page_client-reference-manifest.js +1 -1
  274. package/.next/server/app/sessions/page.js +1 -1
  275. package/.next/server/app/sessions/page.js.nft.json +1 -1
  276. package/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
  277. package/.next/server/app/skills/[skillId]/page_client-reference-manifest.js +1 -1
  278. package/.next/server/app/skills/installed/page_client-reference-manifest.js +1 -1
  279. package/.next/server/app/skills/page_client-reference-manifest.js +1 -1
  280. package/.next/server/app/worktrees/[id]/files/[...path]/page_client-reference-manifest.js +1 -1
  281. package/.next/server/app/worktrees/[id]/page.js +11 -11
  282. package/.next/server/app/worktrees/[id]/page.js.nft.json +1 -1
  283. package/.next/server/app/worktrees/[id]/page_client-reference-manifest.js +1 -1
  284. package/.next/server/app/worktrees/[id]/terminal/page_client-reference-manifest.js +1 -1
  285. package/.next/server/app-paths-manifest.json +35 -35
  286. package/.next/server/chunks/1191.js +2 -2
  287. package/.next/server/chunks/1210.js +1 -1
  288. package/.next/server/chunks/1559.js +2 -0
  289. package/.next/server/chunks/1789.js +1 -0
  290. package/.next/server/chunks/2119.js +1 -1
  291. package/.next/server/chunks/2404.js +1 -1
  292. package/.next/server/chunks/2445.js +1 -1
  293. package/.next/server/chunks/2460.js +1 -0
  294. package/.next/server/chunks/2710.js +1 -1
  295. package/.next/server/chunks/2908.js +1 -0
  296. package/.next/server/chunks/2980.js +1 -1
  297. package/.next/server/chunks/3241.js +1 -1
  298. package/.next/server/chunks/3480.js +1 -1
  299. package/.next/server/chunks/3718.js +1 -1
  300. package/.next/server/chunks/4207.js +2 -2
  301. package/.next/server/chunks/450.js +1 -1
  302. package/.next/server/chunks/4672.js +5 -0
  303. package/.next/server/chunks/{9353.js → 4718.js} +2 -2
  304. package/.next/server/chunks/4837.js +14 -0
  305. package/.next/server/chunks/5048.js +1 -1
  306. package/.next/server/chunks/5209.js +1 -0
  307. package/.next/server/chunks/5595.js +1 -0
  308. package/.next/server/chunks/5625.js +25 -0
  309. package/.next/server/chunks/5845.js +1 -0
  310. package/.next/server/chunks/611.js +1 -1
  311. package/.next/server/chunks/6130.js +1 -1
  312. package/.next/server/chunks/6401.js +1 -1
  313. package/.next/server/chunks/6781.js +1 -1
  314. package/.next/server/chunks/6793.js +3 -3
  315. package/.next/server/chunks/7491.js +2 -2
  316. package/.next/server/chunks/7905.js +1 -1
  317. package/.next/server/chunks/850.js +1 -0
  318. package/.next/server/chunks/8543.js +1 -1
  319. package/.next/server/chunks/8728.js +3 -3
  320. package/.next/server/chunks/8791.js +1 -1
  321. package/.next/server/chunks/8800.js +1 -1
  322. package/.next/server/chunks/8918.js +7 -7
  323. package/.next/server/chunks/9130.js +1 -5
  324. package/.next/server/chunks/9390.js +2 -3
  325. package/.next/server/chunks/9584.js +1 -1
  326. package/.next/server/chunks/9627.js +6 -6
  327. package/.next/server/chunks/9731.js +3 -3
  328. package/.next/server/middleware-manifest.json +5 -5
  329. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  330. package/.next/server/pages/500.html +1 -1
  331. package/.next/server/server-reference-manifest.json +1 -1
  332. package/.next/static/chunks/{1642-fb2e176aaadbd137.js → 1642-767aed8e7c61ef7f.js} +1 -1
  333. package/.next/static/chunks/{2407-f1f258d4a1d92620.js → 2407-06d35bb1aa02de80.js} +1 -1
  334. package/.next/static/chunks/{2619-04bc32f026a0d946.js → 2619-a305ad4810f1393a.js} +1 -1
  335. package/.next/static/chunks/4727-5d695d71e3fdf97b.js +1 -0
  336. package/.next/static/chunks/{8165-3853772f6ae1299b.js → 8165-3525fb42f1b4976e.js} +1 -1
  337. package/.next/static/chunks/app/{layout-da66300cc20244ed.js → layout-0d1750b833f5cc3e.js} +1 -1
  338. package/.next/static/chunks/app/sessions/page-2af68c63211c751f.js +1 -0
  339. package/.next/static/chunks/app/worktrees/[id]/page-e36898c3a80e7302.js +1 -0
  340. package/.next/static/chunks/app/worktrees/[id]/terminal/{page-373ea37b16d930c7.js → page-c601f3b3ece6557e.js} +1 -1
  341. package/.next/static/css/057f64a65726c439.css +1 -0
  342. package/.next/trace +13 -13
  343. package/dist/cli/commands/ask.d.ts.map +1 -1
  344. package/dist/cli/commands/ask.js +120 -119
  345. package/dist/cli/commands/attach.d.ts +94 -0
  346. package/dist/cli/commands/attach.d.ts.map +1 -1
  347. package/dist/cli/commands/attach.js +145 -7
  348. package/dist/cli/commands/auto-yes.js +1 -1
  349. package/dist/cli/commands/capture.d.ts.map +1 -1
  350. package/dist/cli/commands/capture.js +10 -13
  351. package/dist/cli/commands/command-target.d.ts +23 -0
  352. package/dist/cli/commands/command-target.d.ts.map +1 -0
  353. package/dist/cli/commands/command-target.js +25 -0
  354. package/dist/cli/commands/instances.d.ts.map +1 -1
  355. package/dist/cli/commands/instances.js +41 -2
  356. package/dist/cli/commands/message-dispatch.d.ts +36 -0
  357. package/dist/cli/commands/message-dispatch.d.ts.map +1 -0
  358. package/dist/cli/commands/message-dispatch.js +63 -0
  359. package/dist/cli/commands/reply.d.ts.map +1 -1
  360. package/dist/cli/commands/reply.js +2 -5
  361. package/dist/cli/commands/respond.d.ts.map +1 -1
  362. package/dist/cli/commands/respond.js +3 -6
  363. package/dist/cli/commands/send.d.ts.map +1 -1
  364. package/dist/cli/commands/send.js +149 -146
  365. package/dist/cli/commands/wait.d.ts.map +1 -1
  366. package/dist/cli/commands/wait.js +608 -416
  367. package/dist/cli/types/api-responses.d.ts +174 -27
  368. package/dist/cli/types/api-responses.d.ts.map +1 -1
  369. package/dist/cli/types/api-responses.js +4 -2
  370. package/dist/cli/utils/api-client.d.ts +25 -5
  371. package/dist/cli/utils/api-client.d.ts.map +1 -1
  372. package/dist/cli/utils/api-client.js +87 -55
  373. package/dist/cli/utils/server-url.d.ts +1 -0
  374. package/dist/cli/utils/server-url.d.ts.map +1 -1
  375. package/dist/cli/utils/server-url.js +7 -0
  376. package/dist/config/uat-isolation.d.ts +140 -0
  377. package/dist/config/uat-isolation.d.ts.map +1 -0
  378. package/dist/config/uat-isolation.js +246 -0
  379. package/dist/lib/global-state.d.ts +12 -0
  380. package/dist/lib/global-state.d.ts.map +1 -0
  381. package/dist/lib/global-state.js +16 -0
  382. package/dist/lib/polling/auto-yes-suppression-reason.d.ts +33 -0
  383. package/dist/lib/polling/auto-yes-suppression-reason.d.ts.map +1 -0
  384. package/dist/lib/polling/auto-yes-suppression-reason.js +2 -0
  385. package/dist/lib/session/prompt-view.d.ts +228 -0
  386. package/dist/lib/session/prompt-view.d.ts.map +1 -0
  387. package/dist/lib/session/prompt-view.js +290 -0
  388. package/dist/lib/session/status-evidence-type.d.ts +16 -0
  389. package/dist/lib/session/status-evidence-type.d.ts.map +1 -0
  390. package/dist/lib/session/status-evidence-type.js +2 -0
  391. package/dist/lib/tmux/legacy-session-alias.d.ts.map +1 -1
  392. package/dist/lib/tmux/legacy-session-alias.js +2 -1
  393. package/dist/server/locales/en/worktree.json +3 -1
  394. package/dist/server/locales/ja/worktree.json +3 -1
  395. package/dist/server/server.js +5 -3
  396. package/dist/server/src/cli/types/api-responses.js +4 -2
  397. package/dist/server/src/config/cli-tool-timing-config.js +1 -6
  398. package/dist/server/src/config/uat-isolation.js +246 -0
  399. package/dist/server/src/lib/assistant-response-saver.js +62 -3
  400. package/dist/server/src/lib/auto-yes-lifecycle.js +139 -0
  401. package/dist/server/src/lib/auto-yes-poller.js +465 -160
  402. package/dist/server/src/lib/auto-yes-state.js +2 -2
  403. package/dist/server/src/lib/cli-tools/antigravity.js +39 -80
  404. package/dist/server/src/lib/cli-tools/base.js +151 -0
  405. package/dist/server/src/lib/cli-tools/codex.js +44 -80
  406. package/dist/server/src/lib/cli-tools/command-code.js +24 -56
  407. package/dist/server/src/lib/cli-tools/copilot.js +25 -67
  408. package/dist/server/src/lib/cli-tools/direct-input.js +8 -0
  409. package/dist/server/src/lib/cli-tools/gemini.js +23 -73
  410. package/dist/server/src/lib/cli-tools/opencode-pane-width.js +53 -0
  411. package/dist/server/src/lib/cli-tools/opencode-v2.js +9 -7
  412. package/dist/server/src/lib/cli-tools/opencode.js +21 -85
  413. package/dist/server/src/lib/cli-tools/submit-verified-sender.js +127 -4
  414. package/dist/server/src/lib/cli-tools/vibe-local.js +21 -66
  415. package/dist/server/src/lib/detection/cli-patterns.js +374 -3047
  416. package/dist/server/src/lib/detection/idle-evidence-observation.js +2 -2
  417. package/dist/server/src/lib/detection/prompt-detect-multiple-choice.js +7 -32
  418. package/dist/server/src/lib/detection/prompt-detector.js +2 -35
  419. package/dist/server/src/lib/detection/selection-shape-patterns.js +69 -0
  420. package/dist/server/src/lib/detection/selection-shape.js +32 -520
  421. package/dist/server/src/lib/detection/shared/pasted-text.js +41 -0
  422. package/dist/server/src/lib/detection/shared/shell-pane-command.js +16 -0
  423. package/dist/server/src/lib/detection/shared/strip-box-drawing.js +25 -0
  424. package/dist/server/src/lib/detection/status-detector.js +1 -1
  425. package/dist/server/src/lib/detection/tools/antigravity/detect.js +12 -60
  426. package/dist/server/src/lib/detection/tools/antigravity/dialog.js +2 -15
  427. package/dist/server/src/lib/detection/tools/antigravity/live-region.js +39 -0
  428. package/dist/server/src/lib/detection/tools/antigravity/patterns.js +286 -0
  429. package/dist/server/src/lib/detection/tools/claude/detect.js +11 -17
  430. package/dist/server/src/lib/detection/tools/claude/live-region.js +26 -0
  431. package/dist/server/src/lib/detection/tools/claude/patterns.js +264 -4
  432. package/dist/server/src/lib/detection/tools/claude/prompt.js +2 -10
  433. package/dist/server/src/lib/detection/tools/codex/cli-patterns.js +1 -1
  434. package/dist/server/src/lib/detection/tools/codex/detect.js +71 -130
  435. package/dist/server/src/lib/detection/tools/codex/live-region.js +104 -0
  436. package/dist/server/src/lib/detection/tools/codex/patterns.js +855 -0
  437. package/dist/server/src/lib/detection/tools/codex/prompt.js +2 -10
  438. package/dist/server/src/lib/detection/tools/command-code/detect.js +19 -50
  439. package/dist/server/src/lib/detection/tools/command-code/dialog.js +2 -18
  440. package/dist/server/src/lib/detection/tools/command-code/live-region.js +36 -0
  441. package/dist/server/src/lib/detection/tools/command-code/patterns.js +234 -0
  442. package/dist/server/src/lib/detection/tools/command-code/selection-shape.js +461 -0
  443. package/dist/server/src/lib/detection/tools/context-above.js +20 -0
  444. package/dist/server/src/lib/detection/tools/copilot/detect.js +13 -35
  445. package/dist/server/src/lib/detection/tools/copilot/live-region.js +52 -0
  446. package/dist/server/src/lib/detection/tools/copilot/patterns.js +640 -0
  447. package/dist/server/src/lib/detection/tools/copilot/prompt.js +2 -10
  448. package/dist/server/src/lib/detection/tools/frame.js +36 -2
  449. package/dist/server/src/lib/detection/tools/gemini/patterns.js +29 -0
  450. package/dist/server/src/lib/detection/tools/live-region-specs.js +31 -0
  451. package/dist/server/src/lib/detection/tools/live-region.js +204 -0
  452. package/dist/server/src/lib/detection/tools/opencode/detect.js +11 -49
  453. package/dist/server/src/lib/detection/tools/opencode/live-region.js +24 -0
  454. package/dist/server/src/lib/detection/tools/opencode/patterns.js +508 -0
  455. package/dist/server/src/lib/detection/tools/opencode-gutter-live-region.js +72 -0
  456. package/dist/server/src/lib/detection/tools/opencode-v2/detect.js +10 -42
  457. package/dist/server/src/lib/detection/tools/opencode-v2/live-region.js +24 -0
  458. package/dist/server/src/lib/detection/tools/opencode-v2/patterns.js +63 -0
  459. package/dist/server/src/lib/detection/tools/run-detection.js +31 -50
  460. package/dist/server/src/lib/detection/tools/verdicts.js +59 -0
  461. package/dist/server/src/lib/detection/tools/vibe-local/patterns.js +20 -0
  462. package/dist/server/src/lib/detection/truncate-raw-content.js +38 -0
  463. package/dist/server/src/lib/detection/turn-abandoned.js +66 -0
  464. package/dist/server/src/lib/detection/unclassified-frame-tracker.js +2 -2
  465. package/dist/server/src/lib/global-state.js +16 -0
  466. package/dist/server/src/lib/hooks/agent-session-telemetry.js +4 -6
  467. package/dist/server/src/lib/hooks/permission-decision-state.js +2 -2
  468. package/dist/server/src/lib/hooks/sources/antigravity/history.js +11 -76
  469. package/dist/server/src/lib/hooks/sources/antigravity/hooks-config.js +63 -1
  470. package/dist/server/src/lib/hooks/sources/antigravity/source.js +16 -0
  471. package/dist/server/src/lib/hooks/sources/antigravity/transcript.js +3 -12
  472. package/dist/server/src/lib/hooks/sources/claude/history.js +17 -156
  473. package/dist/server/src/lib/hooks/sources/claude/queued-notice.js +53 -0
  474. package/dist/server/src/lib/hooks/sources/claude/source.js +33 -3
  475. package/dist/server/src/lib/hooks/sources/claude/transcript.js +3 -13
  476. package/dist/server/src/lib/hooks/sources/codex/history.js +11 -74
  477. package/dist/server/src/lib/hooks/sources/codex/hooks-config.js +147 -11
  478. package/dist/server/src/lib/hooks/sources/codex/relay-install.js +64 -21
  479. package/dist/server/src/lib/hooks/sources/codex/transcript.js +5 -15
  480. package/dist/server/src/lib/hooks/sources/command-code/history.js +20 -121
  481. package/dist/server/src/lib/hooks/sources/command-code/transcript.js +3 -13
  482. package/dist/server/src/lib/hooks/sources/copilot/hook-settings.js +161 -31
  483. package/dist/server/src/lib/hooks/sources/define-source.js +40 -55
  484. package/dist/server/src/lib/hooks/sources/event-mapper.js +2 -1
  485. package/dist/server/src/lib/hooks/sources/opencode/diff.js +3 -4
  486. package/dist/server/src/lib/hooks/sources/opencode/history.js +2 -1
  487. package/dist/server/src/lib/hooks/sources/opencode/launch-settings.js +2 -1
  488. package/dist/server/src/lib/hooks/sources/opencode/payloads.js +2 -1
  489. package/dist/server/src/lib/hooks/sources/opencode/ports.js +2 -1
  490. package/dist/server/src/lib/hooks/sources/opencode/subscription.js +4 -3
  491. package/dist/server/src/lib/hooks/sources/opencode/transcript.js +3 -16
  492. package/dist/server/src/lib/hooks/sources/opencode-v2/history.js +2 -1
  493. package/dist/server/src/lib/hooks/sources/opencode-v2/mappers.js +5 -4
  494. package/dist/server/src/lib/hooks/sources/opencode-v2/ports.js +2 -1
  495. package/dist/server/src/lib/hooks/sources/opencode-v2/subscription.js +3 -7
  496. package/dist/server/src/lib/hooks/sources/opencode-v2/usage.js +2 -1
  497. package/dist/server/src/lib/hooks/sources/pending-decisions.js +2 -1
  498. package/dist/server/src/lib/hooks/sources/registry.js +3 -2
  499. package/dist/server/src/lib/hooks/sources/transcript-history.js +262 -0
  500. package/dist/server/src/lib/hooks/sources/turn-body.js +31 -0
  501. package/dist/server/src/lib/hooks/tool-input-normalization-state.js +2 -2
  502. package/dist/server/src/lib/polling/antigravity-permission-receipts.js +2 -2
  503. package/dist/server/src/lib/polling/auto-yes-dialog-gate.js +16 -4
  504. package/dist/server/src/lib/polling/auto-yes-enter-fallback-state.js +142 -0
  505. package/dist/server/src/lib/polling/auto-yes-enter-fallback.js +187 -0
  506. package/dist/server/src/lib/polling/auto-yes-resolver.js +9 -3
  507. package/dist/server/src/lib/polling/auto-yes-suppression-reason.js +2 -0
  508. package/dist/server/src/lib/polling/auto-yes-suppression-state.js +2 -2
  509. package/dist/server/src/lib/polling/pending-scraped-response.js +190 -0
  510. package/dist/server/src/lib/polling/prompt-dedup-state.js +2 -2
  511. package/dist/server/src/lib/polling/prompt-dedup.js +2 -2
  512. package/dist/server/src/lib/polling/response-checker-dialog-gate.js +95 -0
  513. package/dist/server/src/lib/polling/response-checker-extraction-result.js +50 -0
  514. package/dist/server/src/lib/polling/response-checker-extraction-steps.js +670 -0
  515. package/dist/server/src/lib/polling/response-checker.js +666 -1162
  516. package/dist/server/src/lib/polling/response-dedup.js +3 -4
  517. package/dist/server/src/lib/polling/response-poller-constants.js +17 -0
  518. package/dist/server/src/lib/polling/response-poller-core.js +54 -20
  519. package/dist/server/src/lib/polling/startup-screen.js +142 -0
  520. package/dist/server/src/lib/polling/structured-history-gate.js +3 -2
  521. package/dist/server/src/lib/prompt-answer-semantic.js +178 -0
  522. package/dist/server/src/lib/prompt-answer-sender.js +6 -5
  523. package/dist/server/src/lib/push/failure-episode-state.js +2 -2
  524. package/dist/server/src/lib/push/notification-dedup.js +3 -4
  525. package/dist/server/src/lib/push/prompt-card-state.js +2 -2
  526. package/dist/server/src/lib/push/waiting-push-notifier.js +3 -4
  527. package/dist/server/src/lib/realtime/publisher-registry.js +3 -2
  528. package/dist/server/src/lib/realtime/terminal-broadcast.js +38 -2
  529. package/dist/server/src/lib/realtime/terminal-session-ownership.js +45 -0
  530. package/dist/server/src/lib/relay/relay-delivery.js +6 -2
  531. package/dist/server/src/lib/relay/relay-readiness.js +38 -1
  532. package/dist/server/src/lib/relay/relay-triggers.js +9 -0
  533. package/dist/server/src/lib/resource-cleanup.js +6 -4
  534. package/dist/server/src/lib/response-cleaner.js +24 -1
  535. package/dist/server/src/lib/response-extractor.js +16 -0
  536. package/dist/server/src/lib/schedule-manager.js +8 -10
  537. package/dist/server/src/lib/session/agent-event-ask-user-question.js +168 -0
  538. package/dist/server/src/lib/session/agent-event-awaiting-instruction.js +104 -0
  539. package/dist/server/src/lib/session/agent-event-dedup.js +539 -0
  540. package/dist/server/src/lib/session/agent-event-model.js +562 -0
  541. package/dist/server/src/lib/session/agent-event-record.js +10 -0
  542. package/dist/server/src/lib/session/agent-event-state.js +106 -1854
  543. package/dist/server/src/lib/session/agent-event-structured-state.js +109 -0
  544. package/dist/server/src/lib/session/agent-event-turn.js +811 -0
  545. package/dist/server/src/lib/session/agent-session-lifecycle.js +11 -2
  546. package/dist/server/src/lib/session/chat-turn-progress.js +322 -0
  547. package/dist/server/src/lib/session/claude-executor.js +45 -5
  548. package/dist/server/src/lib/session/claude-session.js +21 -65
  549. package/dist/server/src/lib/session/cli-session.js +17 -0
  550. package/dist/server/src/lib/session/current-output-builder.js +454 -1103
  551. package/dist/server/src/lib/session/current-output-history-writers.js +255 -0
  552. package/dist/server/src/lib/session/current-output-types.js +9 -0
  553. package/dist/server/src/lib/session/detection-divergence.js +55 -0
  554. package/dist/server/src/lib/session/global-session-constants.js +2 -13
  555. package/dist/server/src/lib/session/hook-turn-hold.js +102 -0
  556. package/dist/server/src/lib/session/layer-disagreement.js +2 -2
  557. package/dist/server/src/lib/session/opencode-session-store.js +2 -1
  558. package/dist/server/src/lib/session/prompt-view.js +290 -0
  559. package/dist/server/src/lib/session/prompt-waiting-composition.js +35 -0
  560. package/dist/server/src/lib/session/provisional-turn.js +3 -1
  561. package/dist/server/src/lib/session/send-user-message.js +1 -1
  562. package/dist/server/src/lib/session/session-starting-state.js +4 -6
  563. package/dist/server/src/lib/session/status-evidence-type.js +2 -0
  564. package/dist/server/src/lib/session/status-evidence.js +2 -2
  565. package/dist/server/src/lib/session/structured-status-merge.js +335 -0
  566. package/dist/server/src/lib/session/waiting-episode-state.js +3 -4
  567. package/dist/server/src/lib/session/waiting-kind.js +3 -0
  568. package/dist/server/src/lib/session-cleanup.js +6 -8
  569. package/dist/server/src/lib/skills/install-plan.js +2 -1
  570. package/dist/server/src/lib/skills/snapshot-store.js +2 -2
  571. package/dist/server/src/lib/skills/uninstall-plan.js +2 -2
  572. package/dist/server/src/lib/timer-manager.js +6 -8
  573. package/dist/server/src/lib/tmux/geometry-delegation.js +3 -4
  574. package/dist/server/src/lib/tmux/legacy-session-alias.js +2 -1
  575. package/dist/server/src/lib/tmux/session-hooks.js +2 -1
  576. package/dist/server/src/lib/tmux/session-status-options.js +3 -3
  577. package/dist/server/src/lib/tmux/tmux-capture-cache.js +3 -2
  578. package/dist/server/src/lib/tmux/tmux.js +33 -59
  579. package/dist/server/src/lib/tui-accumulator.js +2 -2
  580. package/dist/server/src/lib/version-checker.js +6 -6
  581. package/dist/server/src/lib/ws-server.js +47 -11
  582. package/docs/en/user-guide/webapp-guide.md +27 -3
  583. package/package.json +1 -1
  584. package/release-notes/0.44.2.json +33 -0
  585. package/release-notes/0.44.3.json +82 -0
  586. package/scripts/hooks/cmate-agent-event.sh +18 -0
  587. package/.next/server/chunks/1068.js +0 -1
  588. package/.next/server/chunks/434.js +0 -1
  589. package/.next/server/chunks/5775.js +0 -1
  590. package/.next/server/chunks/6474.js +0 -14
  591. package/.next/server/chunks/650.js +0 -1
  592. package/.next/server/chunks/6661.js +0 -1
  593. package/.next/server/chunks/8583.js +0 -1
  594. package/.next/server/chunks/964.js +0 -1
  595. package/.next/server/chunks/967.js +0 -1
  596. package/.next/server/chunks/9882.js +0 -25
  597. package/.next/static/chunks/591-308072f285c34787.js +0 -1
  598. package/.next/static/chunks/app/sessions/page-049e06335187aa91.js +0 -1
  599. package/.next/static/chunks/app/worktrees/[id]/page-040c5f0f585e6812.js +0 -1
  600. package/.next/static/css/38070d879efa1371.css +0 -1
  601. package/dist/server/src/lib/cli-tools/index.js +0 -41
  602. package/dist/server/src/lib/polling/global-session-poller.js +0 -140
  603. /package/.next/static/{57lOiz8zSEHdw97XIm0af → tWwHQzmvc-rv9KKUtDWfQ}/_buildManifest.js +0 -0
  604. /package/.next/static/{57lOiz8zSEHdw97XIm0af → tWwHQzmvc-rv9KKUtDWfQ}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8165],{17683:(e,t,a)=>{a.d(t,{$2:()=>o,B1:()=>h,CO:()=>f,If:()=>u,NP:()=>d,TR:()=>m,wp:()=>l});var n=a(75676);let s="commandmate.worktree.surfaceMode-",r="commandmate.settings.defaultSurfaceMode",l="/api/settings/default-surface-mode",i="view";function o(e,t){return"".concat(s).concat(e,"-split-").concat(t)}function d(e){return"".concat(s).concat(e,"-mobile")}function c(e){try{let t=window.localStorage.getItem(e);return(0,n.jg)(t)?t:null}catch(e){return null}}function u(e,t){try{window.localStorage.setItem(e,t)}catch(e){}}function f(){try{let{location:e,history:t}=window,a=new URLSearchParams(e.search);if(!a.has(i))return;a.delete(i);let n=a.toString(),s="".concat(e.pathname).concat(n?"?".concat(n):"").concat(e.hash);t.replaceState(t.state,"",s)}catch(e){}}function m(e,t){var a;let s=void 0===t?function(){try{var e=window.location.search;if(!e)return null;try{let t=new URLSearchParams(e).get(i);return(0,n.jg)(t)?t:null}catch(e){return null}}catch(e){return null}}():t;return s?(u(e,s),s):(j||(j=!0,y()),null!=(a=c(e))?a:g())}let x=n.wf,p=new Set;function g(){var e;return null!=(e=c(r))?e:x}function h(e){if(!(0,n.jg)(e))return!1;let t=g()!==e;if(x=e,u(r,e),t)for(let e of p)e();return t}let b=null,v=!1,j=!1;async function y(){return v?g():b||("function"!=typeof fetch?g():b=(async()=>{try{let e=await fetch(l);if(e.ok){let t=await e.json();h(null==t?void 0:t.defaultSurfaceMode),v=!0}}catch(e){}finally{b=null}return g()})())}},24373:(e,t,a)=>{a.d(t,{Lv:()=>r});var n=a(12115),s=a(66966);function r(){let e=(0,s.rC)(),t=null==e?void 0:e.worktrees;return(0,n.useMemo)(()=>{let e=t?t.filter(e=>!0===e.isWaitingForResponse):[];return{count:e.length,worktrees:e}},[t])}a(44308)},40823:(e,t,a)=>{a.d(t,{NS:()=>i,V0:()=>o});var n=a(95155),s=a(12115);let r=()=>{},l=(0,s.createContext)({isOpen:!1,open:r,close:r});function i(e){let{children:t}=e,[a,r]=(0,s.useState)(!1),i=(0,s.useCallback)(()=>r(!0),[]),o=(0,s.useCallback)(()=>r(!1),[]),d=(0,s.useMemo)(()=>({isOpen:a,open:i,close:o}),[a,i,o]);return(0,n.jsx)(l.Provider,{value:d,children:t})}function o(){return(0,s.useContext)(l)}},44308:(e,t,a)=>{a.d(t,{$h:()=>u,DR:()=>s,IH:()=>d,Iu:()=>n,Nb:()=>f,SD:()=>r,_d:()=>o,bm:()=>m,ks:()=>i,t7:()=>c,z7:()=>l});let n=7e3,s=["in_review","approval","stalled"],r="in_review",l="filter",i="/review?".concat(l,"=approval");function o(e){return e&&s.includes(e)?e:null}let d=["claude","codex","copilot","antigravity","opencode"],c=1e3,u=5,f=100,m=1e3},58165:(e,t,a)=>{a.d(t,{uN:()=>k,gZ:()=>ea,O3:()=>G});var n=a(95155),s=a(12115),r=a(18955),l=a(5917),i=a(20562),o=a(8803),d=a(65229),c=a(6191),u=a(48407),f=a(54014),m=a(55449);function x(e){return!!e&&"object"==typeof e&&Array.isArray(e.defaultSelectedAgents)&&e.defaultSelectedAgents.length>0&&Array.isArray(e.available)&&e.available.length>0&&"number"==typeof e.minAgents&&"number"==typeof e.maxAgents}function p(){var e;let t=(0,r.c)("common"),[a,p]=(0,s.useState)(null),[g,h]=(0,s.useState)([]),[b,v]=(0,s.useState)(!0),[j,y]=(0,s.useState)("idle"),[N,w]=(0,s.useState)(null),k=(0,s.useCallback)(async()=>{try{let e=await fetch("".concat(m.zk,"?include=installed"));if(!e.ok)throw Error(String(e.status));let t=await e.json();if(!x(t))throw Error("unexpected body");p(t),h(t.defaultSelectedAgents),(0,m.IK)(t.defaultSelectedAgents)}catch(e){w(t("settings.defaultAgents.loadError"))}finally{v(!1)}},[t]);(0,s.useEffect)(()=>{k()},[k]);let C=(0,s.useCallback)(e=>{h(e),y("idle"),w(null)},[]),S=(0,s.useCallback)((e,t)=>{let a=e+t;if(a<0||a>=g.length)return;let n=[...g];[n[e],n[a]]=[n[a],n[e]],C(n)},[g,C]),A=(0,s.useCallback)(async e=>{y("saving"),w(null);try{let n=await fetch(m.zk,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({agents:e})}),s=await n.json().catch(()=>null);if(!n.ok||!x(s)){var a;y("error"),w(null!=(a=null==s?void 0:s.error)?a:t("settings.defaultAgents.saveError"));return}p(e=>({...s,installed:null==e?void 0:e.installed})),h(s.defaultSelectedAgents),(0,m.IK)(s.defaultSelectedAgents),y("saved")}catch(e){y("error"),w(t("settings.defaultAgents.saveError"))}},[t]);if(b)return(0,n.jsx)(u.Zp,{children:(0,n.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,n.jsx)(u.y$,{size:"sm"}),t("loadingPage")]})});if(!a)return(0,n.jsx)(u.Zp,{children:(0,n.jsx)("div",{className:"text-sm text-danger-foreground","data-testid":"default-agents-load-error",children:null!=N?N:t("settings.defaultAgents.loadError")})});let E=null!=(e=a.installed)?e:[],P=a.available.filter(e=>!g.includes(e)),T=g.length<a.minAgents,M=g.length>a.maxAgents,I=!T&&!M&&"saving"!==j,O=e=>E.includes(e)?(0,n.jsxs)("span",{className:"inline-flex items-center gap-1 rounded bg-success-subtle px-1.5 py-0.5 text-xs text-success-foreground","data-testid":"default-agents-installed-".concat(e),children:[(0,n.jsx)(l.A,{className:"h-3 w-3","aria-hidden":"true"}),t("settings.defaultAgents.installed")]}):(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:t("settings.defaultAgents.notInstalled")});return(0,n.jsx)(u.Zp,{children:(0,n.jsxs)("div",{className:"space-y-4","data-testid":"default-agents-settings",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"text-sm font-medium text-foreground",children:t("settings.defaultAgents.title")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:t("settings.defaultAgents.description")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:t("settings.defaultAgents.appliesToNew")}),E.includes("opencode")&&E.includes("opencode-v2")&&(0,n.jsx)("p",{className:"mt-1 text-xs text-warning-foreground","data-testid":"default-agents-opencode-shared-data",children:t("settings.defaultAgents.opencodeSharedData")})]}),(0,n.jsx)("ul",{className:"space-y-2","data-testid":"default-agents-selected",children:g.map((e,s)=>(0,n.jsxs)("li",{className:"flex items-center gap-2 rounded-md border border-border bg-surface px-3 py-2","data-testid":"default-agents-row-".concat(e),children:[(0,n.jsx)("span",{className:"w-6 text-xs text-muted-foreground",children:s+1}),(0,n.jsx)("span",{className:"text-sm text-foreground",children:(0,f.oo)(e)}),0===s&&(0,n.jsx)("span",{className:"rounded bg-info-subtle px-1.5 py-0.5 text-xs text-info-foreground","data-testid":"default-agents-primary-badge",children:t("settings.defaultAgents.primary")}),(0,n.jsx)("span",{className:"ml-auto",children:O(e)}),(0,n.jsx)("button",{type:"button",className:"rounded p-1 text-muted-foreground hover:bg-muted disabled:opacity-40",onClick:()=>S(s,-1),disabled:0===s,"aria-label":t("settings.defaultAgents.moveUp"),"data-testid":"default-agents-up-".concat(e),children:(0,n.jsx)(i.A,{className:"h-4 w-4","aria-hidden":"true"})}),(0,n.jsx)("button",{type:"button",className:"rounded p-1 text-muted-foreground hover:bg-muted disabled:opacity-40",onClick:()=>S(s,1),disabled:s===g.length-1,"aria-label":t("settings.defaultAgents.moveDown"),"data-testid":"default-agents-down-".concat(e),children:(0,n.jsx)(o.A,{className:"h-4 w-4","aria-hidden":"true"})}),(0,n.jsx)("button",{type:"button",className:"rounded p-1 text-muted-foreground hover:bg-muted disabled:opacity-40",onClick:()=>C(g.filter(t=>t!==e)),disabled:g.length<=a.minAgents,"aria-label":t("settings.defaultAgents.remove"),"data-testid":"default-agents-remove-".concat(e),children:(0,n.jsx)(d.A,{className:"h-4 w-4","aria-hidden":"true"})})]},e))}),P.length>0&&(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"mb-2 text-xs text-muted-foreground",children:t("settings.defaultAgents.addLabel")}),(0,n.jsx)("ul",{className:"space-y-2","data-testid":"default-agents-available",children:P.map(e=>(0,n.jsxs)("li",{className:"flex items-center gap-2 rounded-md border border-border px-3 py-2",children:[(0,n.jsx)("span",{className:"text-sm text-foreground",children:(0,f.oo)(e)}),(0,n.jsx)("span",{className:"ml-auto",children:O(e)}),(0,n.jsx)("button",{type:"button",className:"rounded p-1 text-muted-foreground hover:bg-muted disabled:opacity-40",onClick:()=>C([...g,e]),disabled:g.length>=a.maxAgents,"aria-label":t("settings.defaultAgents.add"),"data-testid":"default-agents-add-".concat(e),children:(0,n.jsx)(c.A,{className:"h-4 w-4","aria-hidden":"true"})})]},e))})]}),(T||M)&&(0,n.jsx)("div",{className:"text-xs text-danger-foreground","data-testid":"default-agents-range-error",children:t("settings.defaultAgents.range",{min:a.minAgents,max:a.maxAgents})}),N&&(0,n.jsx)("div",{className:"text-xs text-danger-foreground","data-testid":"default-agents-error",children:N}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(u.$n,{size:"sm",onClick:()=>void A(g),disabled:!I,"data-testid":"default-agents-save",children:"saving"===j?t("settings.defaultAgents.saving"):t("settings.defaultAgents.save")}),(0,n.jsx)(u.$n,{size:"sm",variant:"ghost",onClick:()=>void A(null),disabled:!a.configured||"saving"===j,"data-testid":"default-agents-reset",children:t("settings.defaultAgents.reset")}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":"default-agents-state",children:"saved"===j?t("settings.defaultAgents.saved"):a.configured?t("settings.defaultAgents.configured"):t("settings.defaultAgents.usingBuiltIn")})]}),a.configured&&(0,n.jsx)("div",{className:"text-xs text-muted-foreground","data-testid":"default-agents-builtin",children:t("settings.defaultAgents.builtIn",{agents:a.constantDefault.map(f.oo).join(", ")})})]})})}var g=a(17683),h=a(75676);function b(e){return!!e&&"object"==typeof e&&(0,h.jg)(e.defaultSurfaceMode)&&(0,h.jg)(e.constantDefault)&&Array.isArray(e.available)&&e.available.length>0&&e.available.every(h.jg)}function v(){var e;let t=(0,r.c)("common"),[a,l]=(0,s.useState)(null),[i,o]=(0,s.useState)(!0),[d,c]=(0,s.useState)("idle"),[f,m]=(0,s.useState)(null),x=(0,s.useCallback)(async()=>{try{let e=await fetch(g.wp);if(!e.ok)throw Error(String(e.status));let t=await e.json();if(!b(t))throw Error("unexpected body");l(t),(0,g.B1)(t.defaultSurfaceMode)}catch(e){m({kind:"load"})}finally{o(!1)}},[]);(0,s.useEffect)(()=>{x()},[x]);let p=(0,s.useCallback)(async e=>{c("saving"),m(null),l(t=>t?{...t,defaultSurfaceMode:e}:t);try{let t=await fetch(g.wp,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:e})}),a=await t.json().catch(()=>null);if(!t.ok||!b(a)){c("error"),m({kind:"save",detail:null==a?void 0:a.error}),x();return}l(a),(0,g.B1)(a.defaultSurfaceMode),c("saved")}catch(e){c("error"),m({kind:"save"}),x()}},[x]),h=f?null!=(e=f.detail)?e:t("load"===f.kind?"settings.defaultSurfaceMode.loadError":"settings.defaultSurfaceMode.saveError"):null;return i?(0,n.jsx)(u.Zp,{children:(0,n.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,n.jsx)(u.y$,{size:"sm"}),t("loadingPage")]})}):a?(0,n.jsx)(u.Zp,{children:(0,n.jsxs)("div",{className:"space-y-4","data-testid":"default-surface-mode-settings",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"text-sm font-medium text-foreground",children:t("settings.defaultSurfaceMode.title")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:t("settings.defaultSurfaceMode.description")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:t("settings.defaultSurfaceMode.appliesToNew")})]}),(0,n.jsx)("div",{role:"radiogroup","aria-label":t("settings.defaultSurfaceMode.title"),className:"space-y-2","data-selected":a.defaultSurfaceMode,children:a.available.map(e=>(0,n.jsxs)("label",{className:"flex cursor-pointer items-start gap-2 rounded-md border border-border bg-surface px-3 py-2","data-testid":"default-surface-mode-option-".concat(e),children:[(0,n.jsx)("input",{type:"radio",name:"default-surface-mode",value:e,className:"mt-0.5",checked:a.defaultSurfaceMode===e,disabled:"saving"===d,onChange:()=>void p(e),"data-testid":"default-surface-mode-radio-".concat(e)}),(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{className:"block text-sm text-foreground",children:t("settings.defaultSurfaceMode.mode.".concat(e))}),(0,n.jsx)("span",{className:"block text-xs text-muted-foreground",children:t("settings.defaultSurfaceMode.hint.".concat(e))})]})]},e))}),h&&(0,n.jsx)("div",{className:"text-xs text-danger-foreground","data-testid":"default-surface-mode-error",children:h}),(0,n.jsx)("div",{className:"text-xs text-muted-foreground","data-testid":"default-surface-mode-state",children:"saving"===d?t("settings.defaultSurfaceMode.saving"):"saved"===d?t("settings.defaultSurfaceMode.saved"):a.configured?t("settings.defaultSurfaceMode.configured"):t("settings.defaultSurfaceMode.usingBuiltIn")})]})}):(0,n.jsx)(u.Zp,{children:(0,n.jsx)("div",{className:"text-sm text-danger-foreground","data-testid":"default-surface-mode-load-error",children:null!=h?h:t("settings.defaultSurfaceMode.loadError")})})}var j=a(68695),y=a(52056),N=a(48314);function w(e){let t=e.trim();if(!t)return null;try{let e=JSON.parse(t);if(!e||"object"!=typeof e)return null;let a=e.type;if("plan"!==a&&"output"!==a&&"done"!==a)return null;return e}catch(e){return null}}function k(e){var t,a,l;let{worktreeId:i,instances:o,variant:d="card"}=e,c=(0,r.c)("common"),{versions:m,isLoading:x,loadError:p,run:g,isUpdating:h,update:b}=function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],[t,a]=(0,s.useState)(null),[n,r]=(0,s.useState)(!1),[l,i]=(0,s.useState)(e),[o,d]=(0,s.useState)(null),[c,u]=(0,s.useState)(!1),f=(0,s.useRef)(!0);(0,s.useEffect)(()=>(f.current=!0,()=>{f.current=!1}),[]);let m=(0,s.useCallback)(async function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(e){i(!0);try{let e=await fetch("/api/agents/versions".concat(t?"?refresh=1":""));if(!e.ok)throw Error(String(e.status));let n=await e.json();if(!(n&&"object"==typeof n&&Array.isArray(n.tools)&&Array.isArray(n.updatable)))throw Error("unexpected body");if(!f.current)return;a(n.tools),r(!1)}catch(e){if(!f.current)return;r(!0)}finally{f.current&&i(!1)}}},[e]);(0,s.useEffect)(()=>{m(!1)},[m]);let x=(0,s.useCallback)(async e=>{if(c)return;u(!0),d({tool:e,command:null,output:"",ok:null,previousVersion:null,installed:null,error:null});let t=e=>{f.current&&d(t=>t?{...t,ok:!1,error:e}:t)};try{var a,n;let s=await fetch("/api/agents/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:e})});if(!s.ok||!s.body){let e=await s.json().catch(()=>null);t(null!=(a=null==e?void 0:e.error)?a:"Request failed (".concat(s.status,")"));return}let r=s.body.getReader(),l=new TextDecoder,i="",o=e=>{f.current&&d(t=>{var a;return t?"plan"===e.type?{...t,command:e.command}:"output"===e.type?{...t,output:t.output+e.text}:{...t,ok:e.ok,previousVersion:e.previousVersion,installed:e.installed,error:null!=(a=e.error)?a:null}:t})};for(;;){let{done:e,value:t}=await r.read();if(e)break;let a=(i+=l.decode(t,{stream:!0})).split("\n");for(let e of(i=null!=(n=a.pop())?n:"",a)){let t=w(e);t&&o(t)}}let c=w(i);c&&o(c)}catch(e){t(e instanceof Error?e.message:String(e))}finally{f.current&&u(!1),await m(!0)}},[c,m]);return{versions:t,isLoading:l,loadError:n,run:o,isUpdating:c,reload:m,update:x}}(!0),[v,k]=(0,s.useState)(0),C=function(e,t,a){let[n,r]=(0,s.useState)({});return(0,s.useEffect)(()=>{if(!e||!t||0===t.length)return void r({});let a=!1;return(async()=>{try{let t=await fetch("/api/worktrees/".concat(e));if(!t.ok)return;let n=await t.json();if(a)return;let s=n.sessionStatusByInstance,l={};for(let[e,t]of Object.entries(null!=s?s:{}))(null==t?void 0:t.isRunning)&&(l[e]=!0);r(l)}catch(e){}})(),()=>{a=!0}},[e,t,a]),n}(i,o,v),[S,A]=(0,s.useState)({}),[E,P]=(0,s.useState)(null),T=(0,s.useRef)(null);(0,s.useEffect)(()=>{T.current&&(T.current.scrollTop=T.current.scrollHeight)},[null==g?void 0:g.output]);let M=(null==g?void 0:g.ok)===!0;(0,s.useEffect)(()=>{M&&k(e=>e+1)},[M]);let I=(0,s.useCallback)(e=>(null!=o?o:[]).filter(t=>t.cliTool===e&&C[t.id]),[o,C]),O=(0,s.useCallback)(async e=>{if(i){P(null);try{let t=new URLSearchParams({cliTool:e.cliTool,instance:e.id}),a=await fetch("/api/worktrees/".concat(i,"/kill-session?").concat(t.toString()),{method:"POST"});if(!a.ok&&404!==a.status)throw Error(String(a.status));A(t=>({...t,[e.id]:!0})),k(e=>e+1)}catch(e){P(c("agentUpdates.restartError"))}}},[i,c]),R=x&&!m?(0,n.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,n.jsx)(u.y$,{size:"sm"}),c("loadingPage")]}):p&&!m?(0,n.jsx)("div",{className:"text-sm text-danger-foreground","data-testid":"agent-updates-load-error",children:c("agentUpdates.loadError")}):(0,n.jsxs)("div",{className:"space-y-3","data-testid":"agent-updates",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"text-sm font-medium text-foreground",children:c("agentUpdates.title")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:c("agentUpdates.description")})]}),(0,n.jsx)("ul",{className:"space-y-2","data-testid":"agent-updates-rows",children:(null!=m?m:[]).map(e=>{var t,a;let s=I(e.tool),r=e.updatable&&null!==e.installed;return(0,n.jsxs)("li",{className:"rounded-md border border-border bg-surface px-3 py-2","data-testid":"agent-updates-row-".concat(e.tool),children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsx)("span",{className:"text-sm text-foreground",children:(a=e.tool,(0,f.oo)(a)||a)}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":"agent-updates-installed-".concat(e.tool),children:e.installed?c("agentUpdates.installed",{version:e.installed}):c("agentUpdates.notInstalled")}),e.updateAvailable&&(0,n.jsx)("span",{className:"rounded bg-info-subtle px-1.5 py-0.5 text-xs text-info-foreground","data-testid":"agent-updates-available-".concat(e.tool),children:c("agentUpdates.available",{version:null!=(t=e.latestVersion)?t:""})}),e.dismissedInCodex&&(0,n.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":"agent-updates-dismissed-".concat(e.tool),children:c("agentUpdates.dismissed")}),r&&(0,n.jsxs)(u.$n,{size:"sm",className:"ml-auto",disabled:h,onClick:()=>void b(e.tool),"data-testid":"agent-updates-update-".concat(e.tool),children:[(0,n.jsx)(j.A,{className:"h-4 w-4","aria-hidden":"true"}),h&&(null==g?void 0:g.tool)===e.tool?c("agentUpdates.updating"):c("agentUpdates.update")]})]}),r&&s.length>0&&(0,n.jsxs)("div",{className:"mt-2 flex items-start gap-1 text-xs text-warning-foreground","data-testid":"agent-updates-restart-warning-".concat(e.tool),children:[(0,n.jsx)(y.A,{className:"mt-0.5 h-3 w-3 shrink-0","aria-hidden":"true"}),(0,n.jsx)("span",{children:c("agentUpdates.restartWarning",{sessions:s.map(e=>e.alias).join(", ")})})]}),r&&0===s.length&&void 0===i&&(0,n.jsx)("p",{className:"mt-2 text-xs text-muted-foreground","data-testid":"agent-updates-restart-notice-".concat(e.tool),children:c("agentUpdates.restartNotice")}),M&&(null==g?void 0:g.tool)===e.tool&&s.map(e=>(0,n.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,n.jsxs)(u.$n,{size:"sm",variant:"ghost",disabled:S[e.id],onClick:()=>void O(e),"data-testid":"agent-updates-restart-".concat(e.id),children:[(0,n.jsx)(N.A,{className:"h-4 w-4","aria-hidden":"true"}),c("agentUpdates.restart",{alias:e.alias})]}),S[e.id]&&(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:c("agentUpdates.restarted")})]},e.id))]},e.tool)})}),g&&(0,n.jsxs)("div",{className:"space-y-2","data-testid":"agent-updates-run",children:[g.command&&(0,n.jsx)("div",{className:"text-xs text-muted-foreground","data-testid":"agent-updates-command",children:c("agentUpdates.running",{command:g.command})}),g.output&&(0,n.jsx)("pre",{ref:T,"data-testid":"agent-updates-output",className:"max-h-48 overflow-auto whitespace-pre-wrap rounded-md bg-terminal-surface p-2 text-xs text-terminal-foreground",children:g.output}),!0===g.ok&&(0,n.jsx)("div",{className:"text-xs text-success-foreground","data-testid":"agent-updates-success",children:c("agentUpdates.succeeded",{from:null!=(t=g.previousVersion)?t:"?",to:null!=(a=g.installed)?a:"?"})}),!1===g.ok&&(0,n.jsx)("div",{className:"text-xs text-danger-foreground","data-testid":"agent-updates-failure",children:c("agentUpdates.failed",{error:null!=(l=g.error)?l:""})})]}),E&&(0,n.jsx)("div",{className:"text-xs text-danger-foreground","data-testid":"agent-updates-restart-error",children:E})]});return"plain"===d?R:(0,n.jsx)(u.Zp,{children:R})}var C=a(52619),S=a.n(C);function A(e){var t;let{appId:a,pollInterval:l=3e4,showResponseTime:i=!1,compact:o=!1}=e,d=(0,r.c)("externalApps"),[c,u]=(0,s.useState)(null),[f,m]=(0,s.useState)(!0),x=(0,s.useCallback)(async()=>{try{let e=await fetch("/api/external-apps/".concat(a,"/health"));if(e.ok){let t=await e.json();u(t)}else u({id:a,healthy:!1,lastChecked:Date.now(),error:"Failed to check health"})}catch(e){u({id:a,healthy:!1,lastChecked:Date.now(),error:"Network error"})}finally{m(!1)}},[a]);if((0,s.useEffect)(()=>{x();let e=setInterval(x,l);return()=>clearInterval(e)},[x,l]),f)return(0,n.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,n.jsx)("span",{className:"inline-block h-2.5 w-2.5 rounded-full bg-muted-foreground animate-pulse"}),!o&&(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:d("status.checking")})]});let p=null!=(t=null==c?void 0:c.healthy)&&t,g=p?"bg-success":"bg-muted-foreground",h=d(p?"status.running":"status.stopped");return o?(0,n.jsx)("span",{className:"inline-block h-2.5 w-2.5 rounded-full ".concat(g),title:h}):(0,n.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,n.jsx)("span",{className:"inline-block h-2.5 w-2.5 rounded-full ".concat(g)}),(0,n.jsx)("span",{className:"text-xs ".concat(p?"text-success-foreground":"text-muted-foreground"),children:h}),i&&(null==c?void 0:c.responseTime)!==void 0&&(0,n.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",c.responseTime,"ms)"]})]})}function E(e){var t;let{app:a,onEdit:l,onDelete:i}=e,o=(0,r.c)("externalApps"),d=(0,r.c)("common"),[c,f]=(0,s.useState)(!1),[m,x]=(0,s.useState)(!1),p=async()=>{x(!0);try{await i(a.id)}finally{x(!1),f(!1)}},g="/proxy/".concat(a.pathPrefix,"/");return(0,n.jsxs)(u.Zp,{padding:"md",className:"relative",children:[(0,n.jsxs)("div",{className:"flex items-start justify-between mb-3",children:[(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)("h4",{className:"text-base font-semibold text-foreground truncate",children:a.displayName}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 font-mono truncate",children:a.name})]}),(0,n.jsx)(u.Ex,{variant:{sveltekit:"warning",streamlit:"error",nextjs:"info",other:"gray"}[a.appType]||"gray",children:{sveltekit:"SvelteKit",streamlit:"Streamlit",nextjs:"Next.js",other:"Other"}[t=a.appType]||t})]}),(0,n.jsxs)("div",{className:"space-y-2 mb-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-sm text-muted-foreground",children:o("card.status")}),(0,n.jsx)(A,{appId:a.id,pollInterval:3e4})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-sm text-muted-foreground",children:o("card.port")}),(0,n.jsxs)("span",{className:"text-sm font-mono text-foreground",children:[":",a.targetPort]})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-sm text-muted-foreground",children:o("card.path")}),(0,n.jsxs)("span",{className:"text-sm font-mono text-foreground truncate max-w-[150px]",children:["/proxy/",a.pathPrefix,"/"]})]}),a.websocketEnabled&&(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-sm text-muted-foreground",children:o("card.websocket")}),(0,n.jsx)(u.Ex,{variant:"info",children:o("card.enabled")})]}),!a.enabled&&(0,n.jsx)("div",{className:"mt-2 py-1 px-2 bg-warning-subtle border border-warning-border rounded text-xs text-warning-foreground",children:o("card.disabledNotice")})]}),c?(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:o("card.deleteConfirm",{name:a.displayName})}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(u.$n,{variant:"danger",size:"sm",onClick:p,disabled:m,loading:m,children:o("card.delete")}),(0,n.jsx)(u.$n,{variant:"ghost",size:"sm",onClick:()=>f(!1),disabled:m,children:d("cancel")})]})]}):(0,n.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[(0,n.jsx)(u.$n,{variant:"primary",size:"sm",onClick:()=>window.open(g,"_blank"),disabled:!a.enabled,children:o("card.open")}),(0,n.jsx)(u.$n,{variant:"secondary",size:"sm",onClick:()=>l(a),children:o("card.settings")}),(0,n.jsx)(u.$n,{variant:"ghost",size:"sm",onClick:()=>f(!0),className:"text-danger-foreground hover:bg-danger-subtle",children:o("card.delete")})]})]})}var P=a(87531);let T={MIN:1024,MAX:65535},M=/^[a-zA-Z0-9-]+$/,I={sveltekit:"SvelteKit",streamlit:"Streamlit",nextjs:"Next.js",other:"Other"},O=["sveltekit","streamlit","nextjs","other"].map(e=>({value:e,label:I[e]}));function R(e){let{isOpen:t,onClose:a,editApp:l,onSave:i}=e,o=(0,r.c)("externalApps"),d=(0,r.c)("common"),c=!!l,[f,m]=(0,s.useState)(""),[x,p]=(0,s.useState)(""),[g,h]=(0,s.useState)(""),[b,v]=(0,s.useState)(""),[j,y]=(0,s.useState)(""),[N,w]=(0,s.useState)(!1),[k,C]=(0,s.useState)(""),[S,A]=(0,s.useState)(!0),[E,I]=(0,s.useState)({}),[R,U]=(0,s.useState)(!1),[L,z]=(0,s.useState)(null);(0,s.useEffect)(()=>{t&&(l?(m(l.displayName),p(l.name),h(l.pathPrefix),v(l.targetPort),y(l.appType),w(l.websocketEnabled),C(l.description||""),A(l.enabled)):(m(""),p(""),h(""),v(""),y(""),w(!1),C(""),A(!0)),I({}),z(null))},[t,l]);let $=async e=>{e.preventDefault(),z(null);let t=function(e,t){var a,n,s,r;let l={};return((null==(a=e.displayName)?void 0:a.trim())||(l.displayName="Display name is required"),!t&&((null==(n=e.name)?void 0:n.trim())?M.test(e.name)||(l.name="Only alphanumeric characters and hyphens are allowed"):l.name="Identifier name is required",(null==(s=e.pathPrefix)?void 0:s.trim())?M.test(e.pathPrefix)||(l.pathPrefix="Only alphanumeric characters and hyphens are allowed"):l.pathPrefix="Path prefix is required"),e.targetPort)?"number"!=typeof e.targetPort||Number.isInteger(r=e.targetPort)&&r>=T.MIN&&r<=T.MAX||(l.targetPort="Port must be between ".concat(T.MIN," and ").concat(T.MAX)):l.targetPort="Port number is required",t||e.appType||(l.appType="App type is required"),l}({displayName:f,name:x,pathPrefix:g,targetPort:b,appType:j},c);if(Object.keys(t).length>0)return void I(t);I({}),U(!0);try{if(c&&l){let e=await fetch("/api/external-apps/".concat(l.id),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({displayName:f,description:k||void 0,targetPort:b||void 0,websocketEnabled:N,enabled:S})});if(!e.ok){let t=await e.json();throw Error(t.error||o("form.updateFailed"))}}else{let e=await fetch("/api/external-apps",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({displayName:f,name:x,pathPrefix:g,targetPort:b,appType:j,websocketEnabled:N,description:k||void 0})});if(!e.ok){let t=await e.json();throw Error(t.error||o("form.createFailed"))}}i(),a()}catch(e){z(e instanceof Error?e.message:o("form.genericError"))}finally{U(!1)}};return(0,n.jsx)(u.Jh,{isOpen:t,onClose:a,title:c?o("form.editTitle"):o("form.addTitle"),size:"md",children:(0,n.jsxs)("form",{onSubmit:$,className:"space-y-4",children:[(0,n.jsx)("div",{className:"rounded-md bg-warning-subtle p-3 mb-4 border border-warning-border",children:(0,n.jsx)("p",{className:"text-sm text-warning-foreground",children:o("form.securityWarning")})}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("label",{htmlFor:"displayName",className:"block text-sm font-medium text-foreground mb-1",children:[o("form.displayName")," ",(0,n.jsx)("span",{className:"text-danger",children:"*"})]}),(0,n.jsx)(u.pd,{id:"displayName",type:"text",value:f,onChange:e=>m(e.target.value),className:E.displayName?"border-danger":"",placeholder:o("form.displayNamePlaceholder"),disabled:R}),E.displayName&&(0,n.jsx)("p",{className:"mt-1 text-xs text-danger",children:E.displayName})]}),!c&&(0,n.jsxs)("div",{children:[(0,n.jsxs)("label",{htmlFor:"name",className:"block text-sm font-medium text-foreground mb-1",children:[o("form.identifierName")," ",(0,n.jsx)("span",{className:"text-danger",children:"*"})]}),(0,n.jsx)(u.pd,{id:"name",type:"text",value:x,onChange:e=>p(e.target.value),className:"font-mono ".concat(E.name?"border-danger":""),placeholder:o("form.identifierNamePlaceholder"),disabled:R}),(0,n.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:o("form.identifierNameHelp")}),E.name&&(0,n.jsx)("p",{className:"mt-1 text-xs text-danger",children:E.name})]}),!c&&(0,n.jsxs)("div",{children:[(0,n.jsxs)("label",{htmlFor:"pathPrefix",className:"block text-sm font-medium text-foreground mb-1",children:[o("form.pathPrefix")," ",(0,n.jsx)("span",{className:"text-danger",children:"*"})]}),(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)("span",{className:"text-sm text-muted-foreground mr-1",children:"/proxy/"}),(0,n.jsx)(u.pd,{id:"pathPrefix",type:"text",value:g,onChange:e=>h(e.target.value),className:"w-auto flex-1 font-mono ".concat(E.pathPrefix?"border-danger":""),placeholder:o("form.pathPrefixPlaceholder"),disabled:R}),(0,n.jsx)("span",{className:"text-sm text-muted-foreground ml-1",children:"/"})]}),(0,n.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:o("form.pathPrefixHelp")}),E.pathPrefix&&(0,n.jsx)("p",{className:"mt-1 text-xs text-danger",children:E.pathPrefix})]}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("label",{htmlFor:"targetPort",className:"block text-sm font-medium text-foreground mb-1",children:[o("form.portNumber")," ",(0,n.jsx)("span",{className:"text-danger",children:"*"})]}),(0,n.jsx)(u.pd,{id:"targetPort",type:"number",value:b,onChange:e=>v(e.target.value?parseInt(e.target.value,10):""),className:"font-mono ".concat(E.targetPort?"border-danger":""),placeholder:o("form.portNumberPlaceholder"),min:T.MIN,max:T.MAX,disabled:R}),(0,n.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:o("form.portNumberHelp",{min:T.MIN,max:T.MAX})}),E.targetPort&&(0,n.jsx)("p",{className:"mt-1 text-xs text-danger",children:E.targetPort})]}),!c&&(0,n.jsxs)("div",{children:[(0,n.jsxs)("label",{htmlFor:"appType",className:"block text-sm font-medium text-foreground mb-1",children:[o("form.appType")," ",(0,n.jsx)("span",{className:"text-danger",children:"*"})]}),(0,n.jsxs)("select",{id:"appType",value:j,onChange:e=>y(e.target.value),className:(0,P.cn)((0,u.j1)(),E.appType&&"border-danger"),disabled:R,children:[(0,n.jsx)("option",{value:"",children:o("form.appTypePlaceholder")}),O.map(e=>(0,n.jsx)("option",{value:e.value,children:e.label},e.value))]}),E.appType&&(0,n.jsx)("p",{className:"mt-1 text-xs text-danger",children:E.appType})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:"description",className:"block text-sm font-medium text-foreground mb-1",children:o("form.description")}),(0,n.jsx)(u.k_,{id:"description",value:k,onChange:e=>C(e.target.value),placeholder:o("form.descriptionPlaceholder"),rows:2,disabled:R})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(u.dO,{id:"websocketEnabled",checked:N,onCheckedChange:w,disabled:R}),(0,n.jsx)("label",{htmlFor:"websocketEnabled",className:"text-sm text-foreground",children:o("form.websocketLabel")})]}),c&&(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(u.dO,{id:"enabled",checked:S,onCheckedChange:A,disabled:R}),(0,n.jsx)("label",{htmlFor:"enabled",className:"text-sm text-foreground",children:o("form.enabledLabel")})]}),L&&(0,n.jsx)("div",{className:"p-3 bg-danger-subtle border border-danger-border rounded text-sm text-danger-foreground",children:L}),(0,n.jsxs)("div",{className:"flex justify-end gap-2 pt-4 border-t border-border",children:[(0,n.jsx)(u.$n,{type:"button",variant:"ghost",onClick:a,disabled:R,children:d("cancel")}),(0,n.jsx)(u.$n,{type:"submit",variant:"primary",loading:R,children:c?o("form.save"):o("form.add")})]})]})})}function U(){let e=(0,r.c)("externalApps"),t=(0,r.c)("common"),[a,l]=(0,s.useState)([]),[i,o]=(0,s.useState)(!0),[d,c]=(0,s.useState)(null),[f,m]=(0,s.useState)(!1),[x,p]=(0,s.useState)(null),g=(0,s.useCallback)(async()=>{try{c(null);let e=await fetch("/api/external-apps");if(!e.ok)throw Error("Failed to fetch external apps");let t=await e.json();l(t.apps||[])}catch(e){c(e instanceof Error?e.message:"An error occurred")}finally{o(!1)}},[]);(0,s.useEffect)(()=>{g();let e=setInterval(g,6e4);return()=>clearInterval(e)},[g]);let h=(0,s.useCallback)(e=>{p(e),m(!0)},[]),b=(0,s.useCallback)(()=>{p(null),m(!0)},[]),v=(0,s.useCallback)(async e=>{try{let t=await fetch("/api/external-apps/".concat(e),{method:"DELETE"});if(!t.ok){let e=await t.json();throw Error(e.error||"Failed to delete app")}g()}catch(e){console.error("Failed to delete app:",e)}},[g]),j=(0,s.useCallback)(()=>{g()},[g]),y=(0,s.useCallback)(()=>{m(!1),p(null)},[]);return(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)("div",{className:"flex items-center justify-end",children:(0,n.jsx)(u.$n,{variant:"primary",size:"sm",onClick:b,children:e("manager.addApp")})}),i?(0,n.jsx)(u.Zp,{padding:"lg",children:(0,n.jsxs)("div",{className:"flex items-center justify-center py-8",children:[(0,n.jsx)(u.y$,{size:"xl",variant:"accent"}),(0,n.jsx)("span",{className:"ml-3 text-muted-foreground",children:e("manager.loading")})]})}):d?(0,n.jsx)(u.Zp,{padding:"lg",children:(0,n.jsxs)("div",{className:"text-center py-8",children:[(0,n.jsx)("p",{className:"text-danger-foreground mb-4",children:e("manager.loadError")}),(0,n.jsx)(u.$n,{variant:"secondary",size:"sm",onClick:g,children:t("retry")})]})}):0===a.length?(0,n.jsx)(u.Zp,{padding:"lg",children:(0,n.jsxs)("div",{className:"text-center py-8",children:[(0,n.jsx)("p",{className:"text-muted-foreground mb-4",children:e("manager.empty")}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:e("manager.emptyHelp")}),(0,n.jsx)(u.$n,{variant:"primary",size:"sm",onClick:b,children:e("manager.addFirst")})]})}):(0,n.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:a.map(e=>(0,n.jsx)(E,{app:e,onEdit:h,onDelete:v},e.id))}),(0,n.jsx)(R,{isOpen:f,onClose:y,editApp:x,onSave:j})]})}var L=a(85998),z=a(94442),$=a(81978);function D(){return"undefined"!=typeof navigator&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window}let F={enabled:!0,thresholdMinutes:10},Z=[5,10,30,60];function H(){let e=(0,r.c)("notifications"),{showToast:t}=(0,z.dj)(),[a,l]=(0,s.useState)(!0),[i,o]=(0,s.useState)(!1),[d,c]=(0,s.useState)(!0),[f,m]=(0,s.useState)(!1),[x,p]=(0,s.useState)(null),[g,h]=(0,s.useState)(null),[b,v]=(0,s.useState)(!1),[j,y]=(0,s.useState)(null),[N,w]=(0,s.useState)({prompt:!0,completion:!1}),[k,C]=(0,s.useState)(!1),[S,A]=(0,s.useState)(null),[E,P]=(0,s.useState)(null),T=null!==j&&!1!==E;(0,s.useEffect)(()=>{let e=!1;return(async()=>{let t=function(){var e,t;let a=D(),n="undefined"!=typeof navigator&&(!!/iPad|iPhone|iPod/.test(navigator.userAgent)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1)&&!(null!=(e=(t=window).matchMedia)&&e.call(t,"(display-mode: standalone)").matches||!0===navigator.standalone);return{supported:a&&!n,iosNeedsInstall:n}}();e||(c(D()),m(t.iosNeedsInstall),"undefined"!=typeof Notification&&"denied"===Notification.permission&&v(!0));try{let t=await fetch("/api/push/vapid"),a=await t.json();e||(p(a.configured),h(a.publicKey))}catch(t){e||p(!1)}if(D())try{let t=await navigator.serviceWorker.getRegistration(),n=t?await t.pushManager.getSubscription():null;if(n&&!e){y(n.endpoint);let t=await fetch("/api/push/subscriptions?endpoint=".concat(encodeURIComponent(n.endpoint))),s=await t.json();if(!e){var a;P(!0===s.subscribed),A(null!=(a=s.delivery)?a:null)}s.subscribed&&s.subscription&&!e&&(w(s.subscription.preferences),C(!0===s.subscription.defaultsNoticePending))}}catch(e){}e||l(!1)})(),()=>{e=!0}},[]);let M=(0,s.useCallback)(async()=>{if(g){o(!0);try{var a,n;let s=await Notification.requestPermission();if("granted"!==s){v("denied"===s),t(e("toast.error"),"error");return}if(!await navigator.serviceWorker.getRegistration())return void t(e("toast.error"),"error");let r=await navigator.serviceWorker.ready,l=await r.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:function(e){let t="=".repeat((4-e.length%4)%4),a=atob((e+t).replace(/-/g,"+").replace(/_/g,"/")),n=new Uint8Array(new ArrayBuffer(a.length));for(let e=0;e<a.length;e++)n[e]=a.charCodeAt(e);return n}(g)}),i=await fetch("/api/push/subscriptions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({subscription:l.toJSON(),deviceLabel:navigator.userAgent.slice(0,120)})});if(!i.ok)throw Error("subscribe request failed");let o=await i.json();y(l.endpoint),P(!0),A(null),(null==(a=o.subscription)?void 0:a.preferences)&&w(o.subscription.preferences),C((null==(n=o.subscription)?void 0:n.defaultsNoticePending)===!0),v(!1),t(e("toast.enabled"),"success")}catch(a){t(e("toast.error"),"error")}finally{o(!1)}}},[g,t,e]),I=(0,s.useCallback)(async()=>{o(!0);try{var a;let n=await navigator.serviceWorker.getRegistration(),s=n?await n.pushManager.getSubscription():null,r=null!=(a=null==s?void 0:s.endpoint)?a:j;s&&await s.unsubscribe(),r&&await fetch("/api/push/subscriptions",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({endpoint:r})}),y(null),P(null),A(null),t(e("toast.disabled"),"info")}catch(a){t(e("toast.error"),"error")}finally{o(!1)}},[j,t,e]),O=(0,s.useCallback)(async(a,n)=>{if(!j)return;let s={...N,[a]:n};w(s);try{if(!(await fetch("/api/push/subscriptions",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({endpoint:j,preferences:s})})).ok)throw Error("update failed");t(e("toast.updated"),"success")}catch(a){w(N),t(e("toast.error"),"error")}},[j,N,t,e]),R=(0,s.useCallback)(async a=>{if(!j)return;let n=a?{...N,completion:!1}:N;C(!1),a&&w(n),o(!0);try{if(!(await fetch("/api/push/subscriptions",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({endpoint:j,...a?{preferences:n}:{},acknowledgeDefaultsNotice:!0})})).ok)throw Error("acknowledge failed");t(e(a?"defaultsNotice.adopted":"defaultsNotice.kept"),"success")}catch(a){w(N),C(!0),t(e("toast.error"),"error")}finally{o(!1)}},[j,N,t,e]);return(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)(u.Zp,{children:(0,n.jsx)(q,{})}),(0,n.jsx)(u.Zp,{children:a?(0,n.jsx)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:(0,n.jsx)(u.y$,{size:"sm"})}):d?f?(0,n.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"notifications-ios-guidance",children:e("ios.guidance")}):!1===x?(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:e("notConfigured")}):(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:e("description")}),b&&(0,n.jsx)("p",{className:"text-sm text-danger-foreground","data-testid":"notifications-permission-denied",children:e("permission.denied")}),(()=>{if(null===S)return null;let t="removed"===S.state,a=S.statusCode,s=t?null===a?e("delivery.removedUnknownStatus"):e("delivery.removed",{status:String(a)}):null===a?e("delivery.failingUnknownStatus",{count:S.failureCount}):e("delivery.failing",{count:S.failureCount,status:String(a)});return(0,n.jsxs)("div",{className:t?"space-y-2 rounded-lg border border-danger-border bg-danger-subtle p-3":"space-y-2 rounded-lg border border-warning-border bg-warning-subtle p-3","data-testid":"notifications-delivery-health","data-delivery-state":S.state,children:[(0,n.jsx)("p",{className:t?"text-sm font-semibold text-danger-foreground":"text-sm font-semibold text-warning-foreground",children:e(t?"delivery.headingRemoved":"delivery.headingFailing")}),(0,n.jsx)("p",{className:"text-xs text-foreground",children:s}),403===a&&(0,n.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"notifications-delivery-apns-hint",children:e("delivery.apnsHint")}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:e("delivery.since",{timestamp:new Date(S.firstFailureAt).toLocaleString()})})]})})(),T?(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)("p",{className:"text-sm font-medium text-foreground",children:e("enabledOnThisDevice")}),k&&(0,n.jsxs)("div",{className:"space-y-3 rounded-lg border border-info-border bg-info-subtle p-3","data-testid":"notifications-defaults-notice",children:[(0,n.jsx)("p",{className:"text-sm font-semibold text-info-foreground",children:e("defaultsNotice.heading")}),(0,n.jsx)("p",{className:"text-xs text-foreground",children:e("defaultsNotice.completionChanged")}),(0,n.jsx)("p",{className:"text-xs text-foreground",children:e("defaultsNotice.failuresAdded")}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.jsx)(u.$n,{variant:"primary",onClick:()=>R(!0),disabled:i,"data-testid":"notifications-defaults-notice-adopt",children:e("defaultsNotice.adopt")}),(0,n.jsx)(u.$n,{variant:"secondary",onClick:()=>R(!1),disabled:i,"data-testid":"notifications-defaults-notice-keep",children:e("defaultsNotice.keep")})]})]}),(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsx)("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:e("types.heading")}),(0,n.jsxs)("label",{className:"flex items-center justify-between gap-4",children:[(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{className:"block text-sm font-medium text-foreground",children:e("types.promptWaiting")}),(0,n.jsx)("span",{className:"block text-xs text-muted-foreground",children:e("types.promptWaitingDesc")})]}),(0,n.jsx)(u.dO,{checked:N.prompt,onCheckedChange:e=>O("prompt",e),disabled:i,"aria-label":e("types.promptWaiting"),"data-testid":"notifications-toggle-prompt"})]}),(0,n.jsxs)("label",{className:"flex items-center justify-between gap-4",children:[(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{className:"block text-sm font-medium text-foreground",children:e("types.completion")}),(0,n.jsx)("span",{className:"block text-xs text-muted-foreground",children:e("types.completionDesc")})]}),(0,n.jsx)(u.dO,{checked:N.completion,onCheckedChange:e=>O("completion",e),disabled:i,"aria-label":e("types.completion"),"data-testid":"notifications-toggle-completion"})]})]}),(0,n.jsx)(u.$n,{variant:"secondary",onClick:I,disabled:i,"data-testid":"notifications-unsubscribe",children:e("unsubscribe")})]}):(0,n.jsxs)(u.$n,{variant:"primary",onClick:M,disabled:i||b||!g,"data-testid":"notifications-enable",children:[(0,n.jsx)(L.A,{className:"h-4 w-4"}),i?e("enabling"):e("enable")]})]}):(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:e("unsupported")})}),(0,n.jsx)(u.Zp,{children:(0,n.jsx)(W,{})})]})}function W(){let e=(0,r.c)("notifications"),{showToast:t}=(0,z.dj)(),[a,l]=(0,s.useState)(!0),[i,o]=(0,s.useState)(!1),[d,c]=(0,s.useState)(F),[f,m]=(0,s.useState)([...Z]);(0,s.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await fetch("/api/push/escalation"),a=await t.json();!e&&(a.settings&&c(a.settings),Array.isArray(a.choices)&&a.choices.length>0&&m(a.choices))}catch(e){}finally{e||l(!1)}})(),()=>{e=!0}},[]);let x=(0,s.useCallback)(async a=>{c(a),o(!0);try{if(!(await fetch("/api/push/escalation",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:a})})).ok)throw Error("update failed");t(e("toast.updated"),"success")}catch(a){c(d),t(e("toast.error"),"error")}finally{o(!1)}},[d,t,e]);return(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsx)("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:e("escalation.heading")}),(0,n.jsxs)("label",{className:"flex items-center justify-between gap-4",children:[(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{className:"block text-sm font-medium text-foreground",children:e("escalation.toggle")}),(0,n.jsx)("span",{className:"block text-xs text-muted-foreground",children:e("escalation.toggleDesc")})]}),(0,n.jsx)(u.dO,{checked:d.enabled,onCheckedChange:e=>x({...d,enabled:e}),disabled:a||i,"aria-label":e("escalation.toggle"),"data-testid":"notifications-toggle-escalation"})]}),(0,n.jsxs)("label",{className:"flex items-center justify-between gap-4",children:[(0,n.jsx)("span",{className:"text-sm text-foreground",children:e("escalation.threshold")}),(0,n.jsx)("select",{className:"rounded-md border border-border bg-background px-2 py-1 text-sm text-foreground",value:String(d.thresholdMinutes),disabled:a||i||!d.enabled,"aria-label":e("escalation.threshold"),"data-testid":"notifications-escalation-threshold",onChange:e=>x({...d,thresholdMinutes:Number(e.target.value)}),children:f.map(t=>(0,n.jsx)("option",{value:String(t),children:e("escalation.minutes",{count:t})},t))})]})]})}function q(){let e=(0,r.c)("notifications"),{enabled:t,setEnabled:a}=(0,$.qG)(),{enabled:s,setEnabled:l}=(0,$.Ql)();return(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsx)("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:e("inApp.heading")}),(0,n.jsxs)("label",{className:"flex items-center justify-between gap-4",children:[(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{className:"block text-sm font-medium text-foreground",children:e("inApp.waitingToggle")}),(0,n.jsx)("span",{className:"block text-xs text-muted-foreground",children:e("inApp.waitingToggleDesc")})]}),(0,n.jsx)(u.dO,{checked:t,onCheckedChange:a,"aria-label":e("inApp.waitingToggle"),"data-testid":"notifications-toggle-inapp-waiting"})]}),(0,n.jsxs)("label",{className:"flex items-center justify-between gap-4",children:[(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{className:"block text-sm font-medium text-foreground",children:e("inApp.soundToggle")}),(0,n.jsx)("span",{className:"block text-xs text-muted-foreground",children:e("inApp.soundToggleDesc")})]}),(0,n.jsx)(u.dO,{checked:s,onCheckedChange:l,"aria-label":e("inApp.soundToggle"),"data-testid":"notifications-toggle-inapp-sound"})]})]})}function _(e){let{heading:t,children:a}=e;return(0,n.jsxs)("div",{className:"mb-8",children:[(0,n.jsx)("h2",{className:"text-lg font-semibold mb-4 text-foreground",children:t}),a]})}function B(e){let{onNavigate:t}=e,a=(0,r.c)("common"),s=(0,r.c)("skills");return(0,n.jsx)(_,{heading:a("settings.sections.quickLinks"),children:(0,n.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[(0,n.jsx)(S(),{href:"/repositories",className:"block","data-testid":"more-link-repositories",onClick:t,children:(0,n.jsxs)(u.Zp,{hover:!0,className:"transition-colors hover:border-accent-300 dark:hover:border-accent-700",children:[(0,n.jsx)("div",{className:"text-sm font-medium text-foreground",children:"Repositories"}),(0,n.jsx)("div",{className:"text-xs text-muted-foreground",children:"Manage repositories and worktrees"})]})}),(0,n.jsx)(S(),{href:"/skills",className:"block","data-testid":"more-link-skills",onClick:t,children:(0,n.jsxs)(u.Zp,{hover:!0,className:"transition-colors hover:border-accent-300 dark:hover:border-accent-700",children:[(0,n.jsx)("div",{className:"text-sm font-medium text-foreground",children:a("nav.skills")}),(0,n.jsx)("div",{className:"text-xs text-muted-foreground",children:s("page.description")})]})}),(0,n.jsx)(S(),{href:"/skills/installed",className:"block","data-testid":"more-link-skills-installed",onClick:t,children:(0,n.jsxs)(u.Zp,{hover:!0,className:"transition-colors hover:border-accent-300 dark:hover:border-accent-700",children:[(0,n.jsx)("div",{className:"text-sm font-medium text-foreground",children:s("dashboard.title")}),(0,n.jsx)("div",{className:"text-xs text-muted-foreground",children:s("dashboard.description")})]})})]})})}function J(){let e=(0,r.c)("common");return(0,n.jsx)(_,{heading:e("settings.sections.general"),children:(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)(p,{}),(0,n.jsx)(v,{}),(0,n.jsx)(k,{})]})})}function V(){let e=(0,r.c)("common");return(0,n.jsx)(_,{heading:e("settings.sections.notifications"),children:(0,n.jsx)(H,{})})}function K(){let e=(0,r.c)("common");return(0,n.jsx)(_,{heading:e("settings.sections.externalApps"),children:(0,n.jsx)(U,{})})}function X(){let e=(0,r.c)("common");return(0,n.jsx)(_,{heading:e("settings.sections.about"),children:(0,n.jsx)(u.Zp,{children:(0,n.jsx)("div",{className:"text-sm text-muted-foreground",children:"CommandMate - A local control plane for agent CLIs."})})})}function G(){return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(B,{}),(0,n.jsx)(J,{}),(0,n.jsx)(V,{}),(0,n.jsx)(K,{}),(0,n.jsx)(X,{})]})}a(72604),a(95275),a(79832);var Q=a(94465),Y=a(23838),ee=a(40823);let et=[{id:"general",labelKey:"settings.sections.general"},{id:"notifications",labelKey:"settings.sections.notifications"},{id:"externalApps",labelKey:"settings.sections.externalApps"},{id:"about",labelKey:"settings.sections.about"}];function ea(){let e=(0,r.c)("common"),{isOpen:t,close:a}=(0,ee.V0)();return(0,n.jsx)(Q.a,{isOpen:t,onClose:a,title:e("settings.title"),size:"lg",children:(0,n.jsxs)(Y.tU,{defaultValue:"general",orientation:"vertical",variant:"pill",className:"flex gap-6 min-h-[60vh]","data-testid":"settings-dialog",children:[(0,n.jsx)(Y.j7,{"aria-label":e("settings.categoriesLabel"),className:"sticky top-0 w-40 shrink-0 flex-col items-stretch self-start",children:et.map(t=>(0,n.jsx)(Y.Xi,{value:t.id,"data-testid":"settings-dialog-tab-".concat(t.id),className:"justify-start",children:e(t.labelKey)},t.id))}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)(Y.av,{value:"general",className:"mt-0",children:(0,n.jsx)(J,{})}),(0,n.jsx)(Y.av,{value:"notifications",className:"mt-0",children:(0,n.jsx)(V,{})}),(0,n.jsx)(Y.av,{value:"externalApps",className:"mt-0",children:(0,n.jsx)(K,{})}),(0,n.jsxs)(Y.av,{value:"about",className:"mt-0",children:[(0,n.jsx)(B,{onNavigate:a}),(0,n.jsx)(X,{})]})]})]})})}},72604:(e,t,a)=>{a.d(t,{dS:()=>c,rM:()=>u});var n=a(12115),s=a(20063),r=a(18955),l=a(94442),i=a(66966),o=a(60199),d=a(81978);function c(e,t,a){return"".concat(e,"|").concat(null!=t?t:"-","|").concat(null!=a?a:"no-since")}function u(){let e=(0,r.c)("notifications"),{showToast:t}=(0,l.dj)(),{addListener:a}=(0,o.xM)(),{enabled:u}=(0,d.qG)(),f=(0,s.usePathname)(),m=(0,s.useRouter)(),x=(0,i.rC)(),p=(0,n.useRef)({enabled:u,pathname:f,worktrees:null==x?void 0:x.worktrees,showToast:t,t:e,router:m});p.current={enabled:u,pathname:f,worktrees:null==x?void 0:x.worktrees,showToast:t,t:e,router:m};let g=(0,n.useRef)(new Set);return(0,n.useEffect)(()=>a(e=>{var t,a,n,s,r;if("session_status_changed"!==e.type)return;let l=e.worktreeId;if("string"!=typeof l||0===l.length)return;let i=e.isWaitingForResponse;if("boolean"!=typeof i)return;let o=null!=(n=e.instance)?n:null,d=null!=(s=e.waitingSince)?s:null;if(!i){let e="".concat(l,"|").concat(null!=o?o:"-","|");for(let t of g.current)t.startsWith(e)&&g.current.delete(t);return}let u=p.current;if(!u.enabled||function(e){if(!e)return null;let t=/^\/worktrees\/([^/]+)/.exec(e);if(!t)return null;try{return decodeURIComponent(t[1])}catch(e){return t[1]}}(u.pathname)===l)return;let f=c(l,o,d);if(g.current.has(f))return;g.current.size>=500&&g.current.clear(),g.current.add(f);let m=null!=(r=null==(a=u.worktrees)||null==(t=a.find(e=>e.id===l))?void 0:t.name)?r:l;u.showToast(u.t("inApp.waitingToast",{name:m}),"warning",8e3,{onClick:()=>u.router.push("/worktrees/".concat(encodeURIComponent(l)))})}),[a]),null}},75676:(e,t,a)=>{a.d(t,{jg:()=>r,kQ:()=>l,mR:()=>d,mS:()=>o,wf:()=>n});let n="terminal",s=new Set(["terminal","chat"]);function r(e){return"string"==typeof e&&s.has(e)}let l={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 d(){return{phase:"idle",prompt:{...l},layout:{...i},error:{...o},messages:[],wsConnected:!1}}},79832:(e,t,a)=>{a.d(t,{o:()=>o});var n=a(12115),s=a(24373);let r=/^\(\d+\+?\)(?:\s+|$)/;function l(e){return e.replace(r,"").trim()}function i(e){return Array.from(e.querySelectorAll('link[rel~="icon"]'))}function o(){return!function(){let{count:e}=(0,s.Lv)(),t=(0,n.useRef)([]),a=(0,n.useRef)(null);(0,n.useEffect)(()=>{if("undefined"==typeof document)return;let t=()=>{let t=function(e,t){let a=l(e);if(!Number.isFinite(t)||t<=0)return a;let n="(".concat(Math.floor(t),")");return a?"".concat(n," ").concat(a):n}(document.title,e);t!==document.title&&(document.title=t)};t();let a=null;return"undefined"!=typeof MutationObserver&&document.head&&(a=new MutationObserver(t)).observe(document.head,{childList:!0,subtree:!0,characterData:!0}),()=>{null==a||a.disconnect();let e=l(document.title);e!==document.title&&(document.title=e)}},[e]),(0,n.useEffect)(()=>{if("undefined"==typeof document||e<=0)return;let n=t.current,s=()=>{let t=a.current,s=function(e){var t,a;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Number.isFinite(e)||e<=0)return null;let s=null!=(t=n.document)?t:"undefined"!=typeof document?document:null;if(!s)return null;let r=null!=(a=n.size)?a:64;try{let t=s.createElement("canvas");t.width=r,t.height=r;let a=t.getContext("2d");if(!a)return null;a.clearRect(0,0,r,r),n.base?a.drawImage(n.base,0,0,r,r):(a.fillStyle="#111827",a.fillRect(0,0,r,r));let l=Math.floor(e)>9,i=.34*r,o=r-i-.03*r;a.beginPath(),a.arc(o,o,i,0,2*Math.PI),a.fillStyle=l?"#ef4444":"#f59e0b",a.fill(),a.lineWidth=.05*r,a.strokeStyle="rgba(0, 0, 0, 0.55)",a.stroke();let d=function(e){if(!Number.isFinite(e)||e<=0)return"";let t=Math.floor(e);return t>9?"".concat(9,"+"):String(t)}(e);return a.fillStyle=l?"#ffffff":"#1c1300",a.font="bold ".concat(Math.round(r*(d.length>1?.38:.48)),"px sans-serif"),a.textAlign="center",a.textBaseline="middle",a.fillText(d,o,o+.02*r),t.toDataURL("image/png")}catch(e){return null}}(e,{base:t&&t.complete&&t.naturalWidth>0?t:null,document});s&&function(e,t,a){let n=i(e);if(0===n.length){let t=e.createElement("link");t.setAttribute("rel","icon"),t.setAttribute("type","image/png"),e.head.appendChild(t),a.push({link:t,originalHref:null,created:!0}),n=[t]}for(let e of n)a.some(t=>t.link===e)||a.push({link:e,originalHref:e.getAttribute("href"),created:!1}),e.setAttribute("href",t)}(document,s,n)};s();let r=a.current;if(!r&&"undefined"!=typeof Image){let e=function(e,t){var a;for(let e of t)if(!e.created&&e.originalHref)return e.originalHref;let n=i(e).find(e=>e.getAttribute("href"));return null!=(a=null==n?void 0:n.getAttribute("href"))?a:null}(document,n);e&&(a.current=r=new Image,r.src=e)}let l=null;return r&&!(r.complete&&r.naturalWidth>0)?(l=()=>s(),r.addEventListener("load",l)):r&&s(),()=>{r&&l&&r.removeEventListener("load",l);for(let e of n){if(e.created){e.link.remove();continue}null===e.originalHref?e.link.removeAttribute("href"):e.link.setAttribute("href",e.originalHref)}n.length=0}},[e]),(0,n.useEffect)(()=>{!function(e,t){let a="undefined"!=typeof navigator?navigator:null;if(!a)return;let n=e=>{e&&"function"==typeof e.catch&&e.catch(()=>{})};try{if(Number.isFinite(e)&&e>0){if("function"!=typeof a.setAppBadge)return!1;return n(a.setAppBadge(Math.floor(e))),!0}if("function"!=typeof a.clearAppBadge)return!1;n(a.clearAppBadge())}catch(e){return!1}}(e)},[e])}(),null}},81978:(e,t,a)=>{a.d(t,{Ql:()=>o,qG:()=>l});var n=a(12115);let s="mcbd-inapp-waiting-toast",r="mcbd:inapp-notification-prefs-changed";function l(){let[e,t]=(0,n.useState)(!0);return(0,n.useEffect)(()=>{let e=()=>t(function(){try{let e=window.localStorage.getItem(s);if(null===e)return!0;return"false"!==e}catch(e){return!0}}());return e(),window.addEventListener(r,e),window.addEventListener("storage",e),()=>{window.removeEventListener(r,e),window.removeEventListener("storage",e)}},[]),{enabled:e,setEnabled:(0,n.useCallback)(e=>{t(e);try{window.localStorage.setItem(s,e?"true":"false")}catch(e){}window.dispatchEvent(new CustomEvent(r))},[])}}let i="mcbd-inapp-waiting-sound";function o(){let[e,t]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{let e=()=>t(function(){try{let e=window.localStorage.getItem(i);if(null===e)return!1;return"true"===e}catch(e){return!1}}());return e(),window.addEventListener(r,e),window.addEventListener("storage",e),()=>{window.removeEventListener(r,e),window.removeEventListener("storage",e)}},[]),{enabled:e,setEnabled:(0,n.useCallback)(e=>{t(e);try{window.localStorage.setItem(i,e?"true":"false")}catch(e){}window.dispatchEvent(new CustomEvent(r))},[])}}},94442:(e,t,a)=>{a.d(t,{dj:()=>y,tE:()=>j});var n=a(95155),s=a(12115),r=a(47650),l=a(18955),i=a(42529),o=a(78874),d=a(52056),c=a(23327),u=a(65229),f=a(59854),m=a(9900),x=a(9286);function p(e){let{type:t,iconColor:a}=e,s="h-5 w-5 ".concat(a);switch(t){case"success":return(0,n.jsx)(i.A,{className:s,"data-testid":"toast-icon-success"});case"error":return(0,n.jsx)(o.A,{className:s,"data-testid":"toast-icon-error"});case"warning":return(0,n.jsx)(d.A,{className:s,"data-testid":"toast-icon-warning"});default:return(0,n.jsx)(c.A,{className:s,"data-testid":"toast-icon-info"})}}function g(e){let{id:t,message:a,type:r,onClose:i,duration:o=3e3,onClick:d}=e,c=(0,l.c)("common"),f=(0,s.useRef)(null),g=function(e){switch(e){case"success":return{bgColor:"bg-success-subtle",borderColor:"border-success-border",textColor:"text-success-foreground",iconColor:"text-success-foreground"};case"error":return{bgColor:"bg-danger-subtle",borderColor:"border-danger-border",textColor:"text-danger-foreground",iconColor:"text-danger-foreground"};case"warning":return{bgColor:"bg-warning-subtle",borderColor:"border-warning-border",textColor:"text-warning-foreground",iconColor:"text-warning-foreground"};default:return{bgColor:"bg-info-subtle",borderColor:"border-info-border",textColor:"text-info-foreground",iconColor:"text-info-foreground"}}}(r),[h,b]=(0,s.useState)(!0),{shouldRender:v,isExiting:j}=(0,x.O)(h,m.Ys),y=(0,s.useRef)(i);y.current=i,(0,s.useEffect)(()=>{v||y.current(t)},[v,t]),(0,s.useEffect)(()=>(o>0&&(f.current=setTimeout(()=>{b(!1)},o)),()=>{f.current&&clearTimeout(f.current)}),[o]);let N=(0,s.useCallback)(()=>{f.current&&clearTimeout(f.current),b(!1)},[]);return(0,n.jsxs)("div",{"data-testid":"toast-".concat(t),role:"alert",className:"\n ".concat(g.bgColor,"\n ").concat(g.borderColor,"\n ").concat(g.textColor,"\n border rounded-lg shadow-lg p-4 min-w-[300px] max-w-[400px]\n flex items-start gap-3\n ").concat(j?"animate-out fade-out-0 slide-out-to-right-full duration-200 fill-mode-forwards pointer-events-none":"animate-slide-in","\n "),children:[(0,n.jsx)(p,{type:r,iconColor:g.iconColor}),d?(0,n.jsx)("button",{type:"button","data-testid":"toast-action-button",onClick:()=>{d(),N()},className:"flex-1 text-left text-sm font-medium underline-offset-2 hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm",children:a}):(0,n.jsx)("p",{className:"flex-1 text-sm font-medium",children:a}),(0,n.jsx)("button",{"data-testid":"toast-close-button",onClick:N,"aria-label":c("closeNotification"),className:"\n ".concat(g.textColor,"\n hover:opacity-70\n focus:outline-none focus:ring-2 focus:ring-offset-2\n transition-opacity\n "),children:(0,n.jsx)(u.A,{className:"h-4 w-4"})})]})}function h(e){let{toasts:t,onClose:a}=e,[l,i]=(0,s.useState)(!1);(0,s.useEffect)(()=>{i(!0)},[]);let o=(0,n.jsx)("div",{"data-testid":"toast-container","aria-live":"polite",className:"fixed bottom-4 right-4 flex flex-col gap-2",style:{zIndex:f.M.TOAST},children:t.map(e=>(0,n.jsx)(g,{id:e.id,message:e.message,type:e.type,onClose:a,duration:e.duration,onClick:e.onClick},e.id))});return l?(0,r.createPortal)(o,document.body):null}function b(){let[e,t]=(0,s.useState)([]),a=(0,s.useRef)(0),n=(0,s.useCallback)(function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3e3,r=arguments.length>3?arguments[3]:void 0,l="toast-".concat(++a.current,"-").concat(Date.now()),i={id:l,message:e,type:n,duration:s,...(null==r?void 0:r.onClick)?{onClick:r.onClick}:{}};return t(e=>[...e,i]),l},[]),r=(0,s.useCallback)(e=>{t(t=>t.filter(t=>t.id!==e))},[]),l=(0,s.useCallback)(()=>{t([])},[]);return(0,s.useMemo)(()=>({toasts:e,showToast:n,removeToast:r,clearToasts:l}),[e,n,r,l])}let v=(0,s.createContext)(null);function j(e){let{children:t}=e,a=b();return(0,n.jsxs)(v.Provider,{value:a,children:[t,(0,n.jsx)(h,{toasts:a.toasts,onClose:a.removeToast})]})}function y(){let e=(0,s.useContext)(v),t=b();return null!=e?e:t}},95275:(e,t,a)=>{a.d(t,{H:()=>f});var n=a(12115),s=a(60199),r=a(81978),l=a(72604);let i=[{frequency:880,offset:0,duration:.12},{frequency:1318.5,offset:.13,duration:.18}],o=null;function d(){if(o)return o;let e=function(){var e,t;let a=window;return null!=(t=null!=(e=a.AudioContext)?e:a.webkitAudioContext)?t:null}();if(!e)return null;try{o=new e}catch(e){return null}return o}function c(e){e&&"function"==typeof e.catch&&e.catch(()=>{})}let u=["pointerdown","touchstart","keydown"];function f(){let{addListener:e}=(0,s.xM)(),{enabled:t}=(0,r.Ql)(),a=(0,n.useRef)({enabled:t});a.current={enabled:t};let o=(0,n.useRef)(new Set);return(0,n.useEffect)(()=>{let e=()=>(function(){let e=d();if(e)try{var t;"suspended"===e.state&&c(null==(t=e.resume)?void 0:t.call(e))}catch(e){}})();for(let t of u)window.addEventListener(t,e,{once:!0,passive:!0});return()=>{for(let t of u)window.removeEventListener(t,e)}},[]),(0,n.useEffect)(()=>e(e=>{var t,n;if("session_status_changed"!==e.type)return;let s=e.worktreeId;if("string"!=typeof s||0===s.length)return;let r=e.isWaitingForResponse;if("boolean"!=typeof r)return;let u=null!=(t=e.instance)?t:null,f=null!=(n=e.waitingSince)?n:null;if(!r){let e="".concat(s,"|").concat(null!=u?u:"-","|");for(let t of o.current)t.startsWith(e)&&o.current.delete(t);return}if(!a.current.enabled)return;let m=(0,l.dS)(s,u,f);o.current.has(m)||(o.current.size>=500&&o.current.clear(),o.current.add(m),function(){let e=d();if(e)try{var t,a;"suspended"===e.state&&c(null==(t=e.resume)?void 0:t.call(e));let n=null!=(a=e.currentTime)?a:0;for(let t of i){let a=e.createOscillator(),s=e.createGain();a.type="sine",a.frequency.value=t.frequency;let r=n+t.offset,l=r+t.duration;s.gain.setValueAtTime(0,r),s.gain.linearRampToValueAtTime(.12,r+.015),s.gain.linearRampToValueAtTime(1e-4,l),a.connect(s),s.connect(e.destination),a.start(r),a.stop(l+.02)}}catch(e){return!1}}())}),[e]),null}}}]);
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8165],{17683:(e,t,a)=>{a.d(t,{$2:()=>o,B1:()=>h,CO:()=>f,If:()=>u,NP:()=>d,TR:()=>m,wp:()=>l});var n=a(75676);let s="commandmate.worktree.surfaceMode-",r="commandmate.settings.defaultSurfaceMode",l="/api/settings/default-surface-mode",i="view";function o(e,t){return"".concat(s).concat(e,"-split-").concat(t)}function d(e){return"".concat(s).concat(e,"-mobile")}function c(e){try{let t=window.localStorage.getItem(e);return(0,n.jg)(t)?t:null}catch(e){return null}}function u(e,t){try{window.localStorage.setItem(e,t)}catch(e){}}function f(){try{let{location:e,history:t}=window,a=new URLSearchParams(e.search);if(!a.has(i))return;a.delete(i);let n=a.toString(),s="".concat(e.pathname).concat(n?"?".concat(n):"").concat(e.hash);t.replaceState(t.state,"",s)}catch(e){}}function m(e,t){var a;let s=void 0===t?function(){try{var e=window.location.search;if(!e)return null;try{let t=new URLSearchParams(e).get(i);return(0,n.jg)(t)?t:null}catch(e){return null}}catch(e){return null}}():t;return s?(u(e,s),s):(j||(j=!0,y()),null!=(a=c(e))?a:g())}let x=n.wf,p=new Set;function g(){var e;return null!=(e=c(r))?e:x}function h(e){if(!(0,n.jg)(e))return!1;let t=g()!==e;if(x=e,u(r,e),t)for(let e of p)e();return t}let b=null,v=!1,j=!1;async function y(){return v?g():b||("function"!=typeof fetch?g():b=(async()=>{try{let e=await fetch(l);if(e.ok){let t=await e.json();h(null==t?void 0:t.defaultSurfaceMode),v=!0}}catch(e){}finally{b=null}return g()})())}},24373:(e,t,a)=>{a.d(t,{Lv:()=>r});var n=a(12115),s=a(66966);function r(){let e=(0,s.rC)(),t=null==e?void 0:e.worktrees;return(0,n.useMemo)(()=>{let e=t?t.filter(e=>!0===e.isWaitingForResponse):[];return{count:e.length,worktrees:e}},[t])}a(44308)},40823:(e,t,a)=>{a.d(t,{NS:()=>i,V0:()=>o});var n=a(95155),s=a(12115);let r=()=>{},l=(0,s.createContext)({isOpen:!1,open:r,close:r});function i(e){let{children:t}=e,[a,r]=(0,s.useState)(!1),i=(0,s.useCallback)(()=>r(!0),[]),o=(0,s.useCallback)(()=>r(!1),[]),d=(0,s.useMemo)(()=>({isOpen:a,open:i,close:o}),[a,i,o]);return(0,n.jsx)(l.Provider,{value:d,children:t})}function o(){return(0,s.useContext)(l)}},44308:(e,t,a)=>{a.d(t,{$h:()=>u,DR:()=>s,IH:()=>d,Iu:()=>n,Nb:()=>f,SD:()=>r,_d:()=>o,bm:()=>m,ks:()=>i,t7:()=>c,z7:()=>l});let n=7e3,s=["in_review","approval","stalled"],r="in_review",l="filter",i="/review?".concat(l,"=approval");function o(e){return e&&s.includes(e)?e:null}let d=["claude","codex","copilot","antigravity","opencode"],c=1e3,u=5,f=100,m=1e3},58165:(e,t,a)=>{a.d(t,{uN:()=>k,gZ:()=>ea,O3:()=>G});var n=a(95155),s=a(12115),r=a(18955),l=a(5917),i=a(20562),o=a(8803),d=a(65229),c=a(6191),u=a(48407),f=a(54014),m=a(55449);function x(e){return!!e&&"object"==typeof e&&Array.isArray(e.defaultSelectedAgents)&&e.defaultSelectedAgents.length>0&&Array.isArray(e.available)&&e.available.length>0&&"number"==typeof e.minAgents&&"number"==typeof e.maxAgents}function p(){var e;let t=(0,r.c)("common"),[a,p]=(0,s.useState)(null),[g,h]=(0,s.useState)([]),[b,v]=(0,s.useState)(!0),[j,y]=(0,s.useState)("idle"),[N,w]=(0,s.useState)(null),k=(0,s.useCallback)(async()=>{try{let e=await fetch("".concat(m.zk,"?include=installed"));if(!e.ok)throw Error(String(e.status));let t=await e.json();if(!x(t))throw Error("unexpected body");p(t),h(t.defaultSelectedAgents),(0,m.IK)(t.defaultSelectedAgents)}catch(e){w(t("settings.defaultAgents.loadError"))}finally{v(!1)}},[t]);(0,s.useEffect)(()=>{k()},[k]);let C=(0,s.useCallback)(e=>{h(e),y("idle"),w(null)},[]),S=(0,s.useCallback)((e,t)=>{let a=e+t;if(a<0||a>=g.length)return;let n=[...g];[n[e],n[a]]=[n[a],n[e]],C(n)},[g,C]),A=(0,s.useCallback)(async e=>{y("saving"),w(null);try{let n=await fetch(m.zk,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({agents:e})}),s=await n.json().catch(()=>null);if(!n.ok||!x(s)){var a;y("error"),w(null!=(a=null==s?void 0:s.error)?a:t("settings.defaultAgents.saveError"));return}p(e=>({...s,installed:null==e?void 0:e.installed})),h(s.defaultSelectedAgents),(0,m.IK)(s.defaultSelectedAgents),y("saved")}catch(e){y("error"),w(t("settings.defaultAgents.saveError"))}},[t]);if(b)return(0,n.jsx)(u.Zp,{children:(0,n.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,n.jsx)(u.y$,{size:"sm"}),t("loadingPage")]})});if(!a)return(0,n.jsx)(u.Zp,{children:(0,n.jsx)("div",{className:"text-sm text-danger-foreground","data-testid":"default-agents-load-error",children:null!=N?N:t("settings.defaultAgents.loadError")})});let E=null!=(e=a.installed)?e:[],P=a.available.filter(e=>!g.includes(e)),T=g.length<a.minAgents,M=g.length>a.maxAgents,I=!T&&!M&&"saving"!==j,O=e=>E.includes(e)?(0,n.jsxs)("span",{className:"inline-flex items-center gap-1 rounded bg-success-subtle px-1.5 py-0.5 text-xs text-success-foreground","data-testid":"default-agents-installed-".concat(e),children:[(0,n.jsx)(l.A,{className:"h-3 w-3","aria-hidden":"true"}),t("settings.defaultAgents.installed")]}):(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:t("settings.defaultAgents.notInstalled")});return(0,n.jsx)(u.Zp,{children:(0,n.jsxs)("div",{className:"space-y-4","data-testid":"default-agents-settings",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"text-sm font-medium text-foreground",children:t("settings.defaultAgents.title")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:t("settings.defaultAgents.description")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:t("settings.defaultAgents.appliesToNew")}),E.includes("opencode")&&E.includes("opencode-v2")&&(0,n.jsx)("p",{className:"mt-1 text-xs text-warning-foreground","data-testid":"default-agents-opencode-shared-data",children:t("settings.defaultAgents.opencodeSharedData")})]}),(0,n.jsx)("ul",{className:"space-y-2","data-testid":"default-agents-selected",children:g.map((e,s)=>(0,n.jsxs)("li",{className:"flex items-center gap-2 rounded-md border border-border bg-surface px-3 py-2","data-testid":"default-agents-row-".concat(e),children:[(0,n.jsx)("span",{className:"w-6 text-xs text-muted-foreground",children:s+1}),(0,n.jsx)("span",{className:"text-sm text-foreground",children:(0,f.oo)(e)}),0===s&&(0,n.jsx)("span",{className:"rounded bg-info-subtle px-1.5 py-0.5 text-xs text-info-foreground","data-testid":"default-agents-primary-badge",children:t("settings.defaultAgents.primary")}),(0,n.jsx)("span",{className:"ml-auto",children:O(e)}),(0,n.jsx)("button",{type:"button",className:"rounded p-1 text-muted-foreground hover:bg-muted disabled:opacity-40",onClick:()=>S(s,-1),disabled:0===s,"aria-label":t("settings.defaultAgents.moveUp"),"data-testid":"default-agents-up-".concat(e),children:(0,n.jsx)(i.A,{className:"h-4 w-4","aria-hidden":"true"})}),(0,n.jsx)("button",{type:"button",className:"rounded p-1 text-muted-foreground hover:bg-muted disabled:opacity-40",onClick:()=>S(s,1),disabled:s===g.length-1,"aria-label":t("settings.defaultAgents.moveDown"),"data-testid":"default-agents-down-".concat(e),children:(0,n.jsx)(o.A,{className:"h-4 w-4","aria-hidden":"true"})}),(0,n.jsx)("button",{type:"button",className:"rounded p-1 text-muted-foreground hover:bg-muted disabled:opacity-40",onClick:()=>C(g.filter(t=>t!==e)),disabled:g.length<=a.minAgents,"aria-label":t("settings.defaultAgents.remove"),"data-testid":"default-agents-remove-".concat(e),children:(0,n.jsx)(d.A,{className:"h-4 w-4","aria-hidden":"true"})})]},e))}),P.length>0&&(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"mb-2 text-xs text-muted-foreground",children:t("settings.defaultAgents.addLabel")}),(0,n.jsx)("ul",{className:"space-y-2","data-testid":"default-agents-available",children:P.map(e=>(0,n.jsxs)("li",{className:"flex items-center gap-2 rounded-md border border-border px-3 py-2",children:[(0,n.jsx)("span",{className:"text-sm text-foreground",children:(0,f.oo)(e)}),(0,n.jsx)("span",{className:"ml-auto",children:O(e)}),(0,n.jsx)("button",{type:"button",className:"rounded p-1 text-muted-foreground hover:bg-muted disabled:opacity-40",onClick:()=>C([...g,e]),disabled:g.length>=a.maxAgents,"aria-label":t("settings.defaultAgents.add"),"data-testid":"default-agents-add-".concat(e),children:(0,n.jsx)(c.A,{className:"h-4 w-4","aria-hidden":"true"})})]},e))})]}),(T||M)&&(0,n.jsx)("div",{className:"text-xs text-danger-foreground","data-testid":"default-agents-range-error",children:t("settings.defaultAgents.range",{min:a.minAgents,max:a.maxAgents})}),N&&(0,n.jsx)("div",{className:"text-xs text-danger-foreground","data-testid":"default-agents-error",children:N}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(u.$n,{size:"sm",onClick:()=>void A(g),disabled:!I,"data-testid":"default-agents-save",children:"saving"===j?t("settings.defaultAgents.saving"):t("settings.defaultAgents.save")}),(0,n.jsx)(u.$n,{size:"sm",variant:"ghost",onClick:()=>void A(null),disabled:!a.configured||"saving"===j,"data-testid":"default-agents-reset",children:t("settings.defaultAgents.reset")}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":"default-agents-state",children:"saved"===j?t("settings.defaultAgents.saved"):a.configured?t("settings.defaultAgents.configured"):t("settings.defaultAgents.usingBuiltIn")})]}),a.configured&&(0,n.jsx)("div",{className:"text-xs text-muted-foreground","data-testid":"default-agents-builtin",children:t("settings.defaultAgents.builtIn",{agents:a.constantDefault.map(f.oo).join(", ")})})]})})}var g=a(17683),h=a(75676);function b(e){return!!e&&"object"==typeof e&&(0,h.jg)(e.defaultSurfaceMode)&&(0,h.jg)(e.constantDefault)&&Array.isArray(e.available)&&e.available.length>0&&e.available.every(h.jg)}function v(){var e;let t=(0,r.c)("common"),[a,l]=(0,s.useState)(null),[i,o]=(0,s.useState)(!0),[d,c]=(0,s.useState)("idle"),[f,m]=(0,s.useState)(null),x=(0,s.useCallback)(async()=>{try{let e=await fetch(g.wp);if(!e.ok)throw Error(String(e.status));let t=await e.json();if(!b(t))throw Error("unexpected body");l(t),(0,g.B1)(t.defaultSurfaceMode)}catch(e){m({kind:"load"})}finally{o(!1)}},[]);(0,s.useEffect)(()=>{x()},[x]);let p=(0,s.useCallback)(async e=>{c("saving"),m(null),l(t=>t?{...t,defaultSurfaceMode:e}:t);try{let t=await fetch(g.wp,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:e})}),a=await t.json().catch(()=>null);if(!t.ok||!b(a)){c("error"),m({kind:"save",detail:null==a?void 0:a.error}),x();return}l(a),(0,g.B1)(a.defaultSurfaceMode),c("saved")}catch(e){c("error"),m({kind:"save"}),x()}},[x]),h=f?null!=(e=f.detail)?e:t("load"===f.kind?"settings.defaultSurfaceMode.loadError":"settings.defaultSurfaceMode.saveError"):null;return i?(0,n.jsx)(u.Zp,{children:(0,n.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,n.jsx)(u.y$,{size:"sm"}),t("loadingPage")]})}):a?(0,n.jsx)(u.Zp,{children:(0,n.jsxs)("div",{className:"space-y-4","data-testid":"default-surface-mode-settings",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"text-sm font-medium text-foreground",children:t("settings.defaultSurfaceMode.title")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:t("settings.defaultSurfaceMode.description")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:t("settings.defaultSurfaceMode.appliesToNew")})]}),(0,n.jsx)("div",{role:"radiogroup","aria-label":t("settings.defaultSurfaceMode.title"),className:"space-y-2","data-selected":a.defaultSurfaceMode,children:a.available.map(e=>(0,n.jsxs)("label",{className:"flex cursor-pointer items-start gap-2 rounded-md border border-border bg-surface px-3 py-2","data-testid":"default-surface-mode-option-".concat(e),children:[(0,n.jsx)("input",{type:"radio",name:"default-surface-mode",value:e,className:"mt-0.5",checked:a.defaultSurfaceMode===e,disabled:"saving"===d,onChange:()=>void p(e),"data-testid":"default-surface-mode-radio-".concat(e)}),(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{className:"block text-sm text-foreground",children:t("settings.defaultSurfaceMode.mode.".concat(e))}),(0,n.jsx)("span",{className:"block text-xs text-muted-foreground",children:t("settings.defaultSurfaceMode.hint.".concat(e))})]})]},e))}),h&&(0,n.jsx)("div",{className:"text-xs text-danger-foreground","data-testid":"default-surface-mode-error",children:h}),(0,n.jsx)("div",{className:"text-xs text-muted-foreground","data-testid":"default-surface-mode-state",children:"saving"===d?t("settings.defaultSurfaceMode.saving"):"saved"===d?t("settings.defaultSurfaceMode.saved"):a.configured?t("settings.defaultSurfaceMode.configured"):t("settings.defaultSurfaceMode.usingBuiltIn")})]})}):(0,n.jsx)(u.Zp,{children:(0,n.jsx)("div",{className:"text-sm text-danger-foreground","data-testid":"default-surface-mode-load-error",children:null!=h?h:t("settings.defaultSurfaceMode.loadError")})})}var j=a(68695),y=a(52056),N=a(48314);function w(e){let t=e.trim();if(!t)return null;try{let e=JSON.parse(t);if(!e||"object"!=typeof e)return null;let a=e.type;if("plan"!==a&&"output"!==a&&"done"!==a)return null;return e}catch(e){return null}}function k(e){var t,a,l;let{worktreeId:i,instances:o,variant:d="card"}=e,c=(0,r.c)("common"),{versions:m,isLoading:x,loadError:p,run:g,isUpdating:h,update:b}=function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],[t,a]=(0,s.useState)(null),[n,r]=(0,s.useState)(!1),[l,i]=(0,s.useState)(e),[o,d]=(0,s.useState)(null),[c,u]=(0,s.useState)(!1),f=(0,s.useRef)(!0);(0,s.useEffect)(()=>(f.current=!0,()=>{f.current=!1}),[]);let m=(0,s.useCallback)(async function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(e){i(!0);try{let e=await fetch("/api/agents/versions".concat(t?"?refresh=1":""));if(!e.ok)throw Error(String(e.status));let n=await e.json();if(!(n&&"object"==typeof n&&Array.isArray(n.tools)&&Array.isArray(n.updatable)))throw Error("unexpected body");if(!f.current)return;a(n.tools),r(!1)}catch(e){if(!f.current)return;r(!0)}finally{f.current&&i(!1)}}},[e]);(0,s.useEffect)(()=>{m(!1)},[m]);let x=(0,s.useCallback)(async e=>{if(c)return;u(!0),d({tool:e,command:null,output:"",ok:null,previousVersion:null,installed:null,error:null});let t=e=>{f.current&&d(t=>t?{...t,ok:!1,error:e}:t)};try{var a,n;let s=await fetch("/api/agents/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:e})});if(!s.ok||!s.body){let e=await s.json().catch(()=>null);t(null!=(a=null==e?void 0:e.error)?a:"Request failed (".concat(s.status,")"));return}let r=s.body.getReader(),l=new TextDecoder,i="",o=e=>{f.current&&d(t=>{var a;return t?"plan"===e.type?{...t,command:e.command}:"output"===e.type?{...t,output:t.output+e.text}:{...t,ok:e.ok,previousVersion:e.previousVersion,installed:e.installed,error:null!=(a=e.error)?a:null}:t})};for(;;){let{done:e,value:t}=await r.read();if(e)break;let a=(i+=l.decode(t,{stream:!0})).split("\n");for(let e of(i=null!=(n=a.pop())?n:"",a)){let t=w(e);t&&o(t)}}let c=w(i);c&&o(c)}catch(e){t(e instanceof Error?e.message:String(e))}finally{f.current&&u(!1),await m(!0)}},[c,m]);return{versions:t,isLoading:l,loadError:n,run:o,isUpdating:c,reload:m,update:x}}(!0),[v,k]=(0,s.useState)(0),C=function(e,t,a){let[n,r]=(0,s.useState)({});return(0,s.useEffect)(()=>{if(!e||!t||0===t.length)return void r({});let a=!1;return(async()=>{try{let t=await fetch("/api/worktrees/".concat(e));if(!t.ok)return;let n=await t.json();if(a)return;let s=n.sessionStatusByInstance,l={};for(let[e,t]of Object.entries(null!=s?s:{}))(null==t?void 0:t.isRunning)&&(l[e]=!0);r(l)}catch(e){}})(),()=>{a=!0}},[e,t,a]),n}(i,o,v),[S,A]=(0,s.useState)({}),[E,P]=(0,s.useState)(null),T=(0,s.useRef)(null);(0,s.useEffect)(()=>{T.current&&(T.current.scrollTop=T.current.scrollHeight)},[null==g?void 0:g.output]);let M=(null==g?void 0:g.ok)===!0;(0,s.useEffect)(()=>{M&&k(e=>e+1)},[M]);let I=(0,s.useCallback)(e=>(null!=o?o:[]).filter(t=>t.cliTool===e&&C[t.id]),[o,C]),O=(0,s.useCallback)(async e=>{if(i){P(null);try{let t=new URLSearchParams({cliTool:e.cliTool,instance:e.id}),a=await fetch("/api/worktrees/".concat(i,"/kill-session?").concat(t.toString()),{method:"POST"});if(!a.ok&&404!==a.status)throw Error(String(a.status));A(t=>({...t,[e.id]:!0})),k(e=>e+1)}catch(e){P(c("agentUpdates.restartError"))}}},[i,c]),R=x&&!m?(0,n.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,n.jsx)(u.y$,{size:"sm"}),c("loadingPage")]}):p&&!m?(0,n.jsx)("div",{className:"text-sm text-danger-foreground","data-testid":"agent-updates-load-error",children:c("agentUpdates.loadError")}):(0,n.jsxs)("div",{className:"space-y-3","data-testid":"agent-updates",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"text-sm font-medium text-foreground",children:c("agentUpdates.title")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:c("agentUpdates.description")})]}),(0,n.jsx)("ul",{className:"space-y-2","data-testid":"agent-updates-rows",children:(null!=m?m:[]).map(e=>{var t,a;let s=I(e.tool),r=e.updatable&&null!==e.installed;return(0,n.jsxs)("li",{className:"rounded-md border border-border bg-surface px-3 py-2","data-testid":"agent-updates-row-".concat(e.tool),children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsx)("span",{className:"text-sm text-foreground",children:(a=e.tool,(0,f.oo)(a)||a)}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":"agent-updates-installed-".concat(e.tool),children:e.installed?c("agentUpdates.installed",{version:e.installed}):c("agentUpdates.notInstalled")}),e.updateAvailable&&(0,n.jsx)("span",{className:"rounded bg-info-subtle px-1.5 py-0.5 text-xs text-info-foreground","data-testid":"agent-updates-available-".concat(e.tool),children:c("agentUpdates.available",{version:null!=(t=e.latestVersion)?t:""})}),e.dismissedInCodex&&(0,n.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":"agent-updates-dismissed-".concat(e.tool),children:c("agentUpdates.dismissed")}),r&&(0,n.jsxs)(u.$n,{size:"sm",className:"ml-auto",disabled:h,onClick:()=>void b(e.tool),"data-testid":"agent-updates-update-".concat(e.tool),children:[(0,n.jsx)(j.A,{className:"h-4 w-4","aria-hidden":"true"}),h&&(null==g?void 0:g.tool)===e.tool?c("agentUpdates.updating"):c("agentUpdates.update")]})]}),r&&s.length>0&&(0,n.jsxs)("div",{className:"mt-2 flex items-start gap-1 text-xs text-warning-foreground","data-testid":"agent-updates-restart-warning-".concat(e.tool),children:[(0,n.jsx)(y.A,{className:"mt-0.5 h-3 w-3 shrink-0","aria-hidden":"true"}),(0,n.jsx)("span",{children:c("agentUpdates.restartWarning",{sessions:s.map(e=>e.alias).join(", ")})})]}),r&&0===s.length&&void 0===i&&(0,n.jsx)("p",{className:"mt-2 text-xs text-muted-foreground","data-testid":"agent-updates-restart-notice-".concat(e.tool),children:c("agentUpdates.restartNotice")}),M&&(null==g?void 0:g.tool)===e.tool&&s.map(e=>(0,n.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,n.jsxs)(u.$n,{size:"sm",variant:"ghost",disabled:S[e.id],onClick:()=>void O(e),"data-testid":"agent-updates-restart-".concat(e.id),children:[(0,n.jsx)(N.A,{className:"h-4 w-4","aria-hidden":"true"}),c("agentUpdates.restart",{alias:e.alias})]}),S[e.id]&&(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:c("agentUpdates.restarted")})]},e.id))]},e.tool)})}),g&&(0,n.jsxs)("div",{className:"space-y-2","data-testid":"agent-updates-run",children:[g.command&&(0,n.jsx)("div",{className:"text-xs text-muted-foreground","data-testid":"agent-updates-command",children:c("agentUpdates.running",{command:g.command})}),g.output&&(0,n.jsx)("pre",{ref:T,"data-testid":"agent-updates-output",className:"max-h-48 overflow-auto whitespace-pre-wrap rounded-md bg-terminal-surface p-2 text-xs text-terminal-foreground",children:g.output}),!0===g.ok&&(0,n.jsx)("div",{className:"text-xs text-success-foreground","data-testid":"agent-updates-success",children:c("agentUpdates.succeeded",{from:null!=(t=g.previousVersion)?t:"?",to:null!=(a=g.installed)?a:"?"})}),!1===g.ok&&(0,n.jsx)("div",{className:"text-xs text-danger-foreground","data-testid":"agent-updates-failure",children:c("agentUpdates.failed",{error:null!=(l=g.error)?l:""})})]}),E&&(0,n.jsx)("div",{className:"text-xs text-danger-foreground","data-testid":"agent-updates-restart-error",children:E})]});return"plain"===d?R:(0,n.jsx)(u.Zp,{children:R})}var C=a(52619),S=a.n(C);function A(e){var t;let{appId:a,pollInterval:l=3e4,showResponseTime:i=!1,compact:o=!1}=e,d=(0,r.c)("externalApps"),[c,u]=(0,s.useState)(null),[f,m]=(0,s.useState)(!0),x=(0,s.useCallback)(async()=>{try{let e=await fetch("/api/external-apps/".concat(a,"/health"));if(e.ok){let t=await e.json();u(t)}else u({id:a,healthy:!1,lastChecked:Date.now(),error:"Failed to check health"})}catch(e){u({id:a,healthy:!1,lastChecked:Date.now(),error:"Network error"})}finally{m(!1)}},[a]);if((0,s.useEffect)(()=>{x();let e=setInterval(x,l);return()=>clearInterval(e)},[x,l]),f)return(0,n.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,n.jsx)("span",{className:"inline-block h-2.5 w-2.5 rounded-full bg-muted-foreground animate-pulse"}),!o&&(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:d("status.checking")})]});let p=null!=(t=null==c?void 0:c.healthy)&&t,g=p?"bg-success":"bg-muted-foreground",h=d(p?"status.running":"status.stopped");return o?(0,n.jsx)("span",{className:"inline-block h-2.5 w-2.5 rounded-full ".concat(g),title:h}):(0,n.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,n.jsx)("span",{className:"inline-block h-2.5 w-2.5 rounded-full ".concat(g)}),(0,n.jsx)("span",{className:"text-xs ".concat(p?"text-success-foreground":"text-muted-foreground"),children:h}),i&&(null==c?void 0:c.responseTime)!==void 0&&(0,n.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",c.responseTime,"ms)"]})]})}function E(e){var t;let{app:a,onEdit:l,onDelete:i}=e,o=(0,r.c)("externalApps"),d=(0,r.c)("common"),[c,f]=(0,s.useState)(!1),[m,x]=(0,s.useState)(!1),p=async()=>{x(!0);try{await i(a.id)}finally{x(!1),f(!1)}},g="/proxy/".concat(a.pathPrefix,"/");return(0,n.jsxs)(u.Zp,{padding:"md",className:"relative",children:[(0,n.jsxs)("div",{className:"flex items-start justify-between mb-3",children:[(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)("h4",{className:"text-base font-semibold text-foreground truncate",children:a.displayName}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 font-mono truncate",children:a.name})]}),(0,n.jsx)(u.Ex,{variant:{sveltekit:"warning",streamlit:"error",nextjs:"info",other:"gray"}[a.appType]||"gray",children:{sveltekit:"SvelteKit",streamlit:"Streamlit",nextjs:"Next.js",other:"Other"}[t=a.appType]||t})]}),(0,n.jsxs)("div",{className:"space-y-2 mb-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-sm text-muted-foreground",children:o("card.status")}),(0,n.jsx)(A,{appId:a.id,pollInterval:3e4})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-sm text-muted-foreground",children:o("card.port")}),(0,n.jsxs)("span",{className:"text-sm font-mono text-foreground",children:[":",a.targetPort]})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-sm text-muted-foreground",children:o("card.path")}),(0,n.jsxs)("span",{className:"text-sm font-mono text-foreground truncate max-w-[150px]",children:["/proxy/",a.pathPrefix,"/"]})]}),a.websocketEnabled&&(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-sm text-muted-foreground",children:o("card.websocket")}),(0,n.jsx)(u.Ex,{variant:"info",children:o("card.enabled")})]}),!a.enabled&&(0,n.jsx)("div",{className:"mt-2 py-1 px-2 bg-warning-subtle border border-warning-border rounded text-xs text-warning-foreground",children:o("card.disabledNotice")})]}),c?(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:o("card.deleteConfirm",{name:a.displayName})}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(u.$n,{variant:"danger",size:"sm",onClick:p,disabled:m,loading:m,children:o("card.delete")}),(0,n.jsx)(u.$n,{variant:"ghost",size:"sm",onClick:()=>f(!1),disabled:m,children:d("cancel")})]})]}):(0,n.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[(0,n.jsx)(u.$n,{variant:"primary",size:"sm",onClick:()=>window.open(g,"_blank"),disabled:!a.enabled,children:o("card.open")}),(0,n.jsx)(u.$n,{variant:"secondary",size:"sm",onClick:()=>l(a),children:o("card.settings")}),(0,n.jsx)(u.$n,{variant:"ghost",size:"sm",onClick:()=>f(!0),className:"text-danger-foreground hover:bg-danger-subtle",children:o("card.delete")})]})]})}var P=a(87531);let T={MIN:1024,MAX:65535},M=/^[a-zA-Z0-9-]+$/,I={sveltekit:"SvelteKit",streamlit:"Streamlit",nextjs:"Next.js",other:"Other"},O=["sveltekit","streamlit","nextjs","other"].map(e=>({value:e,label:I[e]}));function R(e){let{isOpen:t,onClose:a,editApp:l,onSave:i}=e,o=(0,r.c)("externalApps"),d=(0,r.c)("common"),c=!!l,[f,m]=(0,s.useState)(""),[x,p]=(0,s.useState)(""),[g,h]=(0,s.useState)(""),[b,v]=(0,s.useState)(""),[j,y]=(0,s.useState)(""),[N,w]=(0,s.useState)(!1),[k,C]=(0,s.useState)(""),[S,A]=(0,s.useState)(!0),[E,I]=(0,s.useState)({}),[R,U]=(0,s.useState)(!1),[L,z]=(0,s.useState)(null);(0,s.useEffect)(()=>{t&&(l?(m(l.displayName),p(l.name),h(l.pathPrefix),v(l.targetPort),y(l.appType),w(l.websocketEnabled),C(l.description||""),A(l.enabled)):(m(""),p(""),h(""),v(""),y(""),w(!1),C(""),A(!0)),I({}),z(null))},[t,l]);let $=async e=>{e.preventDefault(),z(null);let t=function(e,t){var a,n,s,r;let l={};return((null==(a=e.displayName)?void 0:a.trim())||(l.displayName="Display name is required"),!t&&((null==(n=e.name)?void 0:n.trim())?M.test(e.name)||(l.name="Only alphanumeric characters and hyphens are allowed"):l.name="Identifier name is required",(null==(s=e.pathPrefix)?void 0:s.trim())?M.test(e.pathPrefix)||(l.pathPrefix="Only alphanumeric characters and hyphens are allowed"):l.pathPrefix="Path prefix is required"),e.targetPort)?"number"!=typeof e.targetPort||Number.isInteger(r=e.targetPort)&&r>=T.MIN&&r<=T.MAX||(l.targetPort="Port must be between ".concat(T.MIN," and ").concat(T.MAX)):l.targetPort="Port number is required",t||e.appType||(l.appType="App type is required"),l}({displayName:f,name:x,pathPrefix:g,targetPort:b,appType:j},c);if(Object.keys(t).length>0)return void I(t);I({}),U(!0);try{if(c&&l){let e=await fetch("/api/external-apps/".concat(l.id),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({displayName:f,description:k||void 0,targetPort:b||void 0,websocketEnabled:N,enabled:S})});if(!e.ok){let t=await e.json();throw Error(t.error||o("form.updateFailed"))}}else{let e=await fetch("/api/external-apps",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({displayName:f,name:x,pathPrefix:g,targetPort:b,appType:j,websocketEnabled:N,description:k||void 0})});if(!e.ok){let t=await e.json();throw Error(t.error||o("form.createFailed"))}}i(),a()}catch(e){z(e instanceof Error?e.message:o("form.genericError"))}finally{U(!1)}};return(0,n.jsx)(u.Jh,{isOpen:t,onClose:a,title:c?o("form.editTitle"):o("form.addTitle"),size:"md",children:(0,n.jsxs)("form",{onSubmit:$,className:"space-y-4",children:[(0,n.jsx)("div",{className:"rounded-md bg-warning-subtle p-3 mb-4 border border-warning-border",children:(0,n.jsx)("p",{className:"text-sm text-warning-foreground",children:o("form.securityWarning")})}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("label",{htmlFor:"displayName",className:"block text-sm font-medium text-foreground mb-1",children:[o("form.displayName")," ",(0,n.jsx)("span",{className:"text-danger",children:"*"})]}),(0,n.jsx)(u.pd,{id:"displayName",type:"text",value:f,onChange:e=>m(e.target.value),className:E.displayName?"border-danger":"",placeholder:o("form.displayNamePlaceholder"),disabled:R}),E.displayName&&(0,n.jsx)("p",{className:"mt-1 text-xs text-danger",children:E.displayName})]}),!c&&(0,n.jsxs)("div",{children:[(0,n.jsxs)("label",{htmlFor:"name",className:"block text-sm font-medium text-foreground mb-1",children:[o("form.identifierName")," ",(0,n.jsx)("span",{className:"text-danger",children:"*"})]}),(0,n.jsx)(u.pd,{id:"name",type:"text",value:x,onChange:e=>p(e.target.value),className:"font-mono ".concat(E.name?"border-danger":""),placeholder:o("form.identifierNamePlaceholder"),disabled:R}),(0,n.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:o("form.identifierNameHelp")}),E.name&&(0,n.jsx)("p",{className:"mt-1 text-xs text-danger",children:E.name})]}),!c&&(0,n.jsxs)("div",{children:[(0,n.jsxs)("label",{htmlFor:"pathPrefix",className:"block text-sm font-medium text-foreground mb-1",children:[o("form.pathPrefix")," ",(0,n.jsx)("span",{className:"text-danger",children:"*"})]}),(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)("span",{className:"text-sm text-muted-foreground mr-1",children:"/proxy/"}),(0,n.jsx)(u.pd,{id:"pathPrefix",type:"text",value:g,onChange:e=>h(e.target.value),className:"w-auto flex-1 font-mono ".concat(E.pathPrefix?"border-danger":""),placeholder:o("form.pathPrefixPlaceholder"),disabled:R}),(0,n.jsx)("span",{className:"text-sm text-muted-foreground ml-1",children:"/"})]}),(0,n.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:o("form.pathPrefixHelp")}),E.pathPrefix&&(0,n.jsx)("p",{className:"mt-1 text-xs text-danger",children:E.pathPrefix})]}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("label",{htmlFor:"targetPort",className:"block text-sm font-medium text-foreground mb-1",children:[o("form.portNumber")," ",(0,n.jsx)("span",{className:"text-danger",children:"*"})]}),(0,n.jsx)(u.pd,{id:"targetPort",type:"number",value:b,onChange:e=>v(e.target.value?parseInt(e.target.value,10):""),className:"font-mono ".concat(E.targetPort?"border-danger":""),placeholder:o("form.portNumberPlaceholder"),min:T.MIN,max:T.MAX,disabled:R}),(0,n.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:o("form.portNumberHelp",{min:T.MIN,max:T.MAX})}),E.targetPort&&(0,n.jsx)("p",{className:"mt-1 text-xs text-danger",children:E.targetPort})]}),!c&&(0,n.jsxs)("div",{children:[(0,n.jsxs)("label",{htmlFor:"appType",className:"block text-sm font-medium text-foreground mb-1",children:[o("form.appType")," ",(0,n.jsx)("span",{className:"text-danger",children:"*"})]}),(0,n.jsxs)("select",{id:"appType",value:j,onChange:e=>y(e.target.value),className:(0,P.cn)((0,u.j1)(),E.appType&&"border-danger"),disabled:R,children:[(0,n.jsx)("option",{value:"",children:o("form.appTypePlaceholder")}),O.map(e=>(0,n.jsx)("option",{value:e.value,children:e.label},e.value))]}),E.appType&&(0,n.jsx)("p",{className:"mt-1 text-xs text-danger",children:E.appType})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:"description",className:"block text-sm font-medium text-foreground mb-1",children:o("form.description")}),(0,n.jsx)(u.k_,{id:"description",value:k,onChange:e=>C(e.target.value),placeholder:o("form.descriptionPlaceholder"),rows:2,disabled:R})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(u.dO,{id:"websocketEnabled",checked:N,onCheckedChange:w,disabled:R}),(0,n.jsx)("label",{htmlFor:"websocketEnabled",className:"text-sm text-foreground",children:o("form.websocketLabel")})]}),c&&(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(u.dO,{id:"enabled",checked:S,onCheckedChange:A,disabled:R}),(0,n.jsx)("label",{htmlFor:"enabled",className:"text-sm text-foreground",children:o("form.enabledLabel")})]}),L&&(0,n.jsx)("div",{className:"p-3 bg-danger-subtle border border-danger-border rounded text-sm text-danger-foreground",children:L}),(0,n.jsxs)("div",{className:"flex justify-end gap-2 pt-4 border-t border-border",children:[(0,n.jsx)(u.$n,{type:"button",variant:"ghost",onClick:a,disabled:R,children:d("cancel")}),(0,n.jsx)(u.$n,{type:"submit",variant:"primary",loading:R,children:c?o("form.save"):o("form.add")})]})]})})}function U(){let e=(0,r.c)("externalApps"),t=(0,r.c)("common"),[a,l]=(0,s.useState)([]),[i,o]=(0,s.useState)(!0),[d,c]=(0,s.useState)(null),[f,m]=(0,s.useState)(!1),[x,p]=(0,s.useState)(null),g=(0,s.useCallback)(async()=>{try{c(null);let e=await fetch("/api/external-apps");if(!e.ok)throw Error("Failed to fetch external apps");let t=await e.json();l(t.apps||[])}catch(e){c(e instanceof Error?e.message:"An error occurred")}finally{o(!1)}},[]);(0,s.useEffect)(()=>{g();let e=setInterval(g,6e4);return()=>clearInterval(e)},[g]);let h=(0,s.useCallback)(e=>{p(e),m(!0)},[]),b=(0,s.useCallback)(()=>{p(null),m(!0)},[]),v=(0,s.useCallback)(async e=>{try{let t=await fetch("/api/external-apps/".concat(e),{method:"DELETE"});if(!t.ok){let e=await t.json();throw Error(e.error||"Failed to delete app")}g()}catch(e){console.error("Failed to delete app:",e)}},[g]),j=(0,s.useCallback)(()=>{g()},[g]),y=(0,s.useCallback)(()=>{m(!1),p(null)},[]);return(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)("div",{className:"flex items-center justify-end",children:(0,n.jsx)(u.$n,{variant:"primary",size:"sm",onClick:b,children:e("manager.addApp")})}),i?(0,n.jsx)(u.Zp,{padding:"lg",children:(0,n.jsxs)("div",{className:"flex items-center justify-center py-8",children:[(0,n.jsx)(u.y$,{size:"xl",variant:"accent"}),(0,n.jsx)("span",{className:"ml-3 text-muted-foreground",children:e("manager.loading")})]})}):d?(0,n.jsx)(u.Zp,{padding:"lg",children:(0,n.jsxs)("div",{className:"text-center py-8",children:[(0,n.jsx)("p",{className:"text-danger-foreground mb-4",children:e("manager.loadError")}),(0,n.jsx)(u.$n,{variant:"secondary",size:"sm",onClick:g,children:t("retry")})]})}):0===a.length?(0,n.jsx)(u.Zp,{padding:"lg",children:(0,n.jsxs)("div",{className:"text-center py-8",children:[(0,n.jsx)("p",{className:"text-muted-foreground mb-4",children:e("manager.empty")}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:e("manager.emptyHelp")}),(0,n.jsx)(u.$n,{variant:"primary",size:"sm",onClick:b,children:e("manager.addFirst")})]})}):(0,n.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:a.map(e=>(0,n.jsx)(E,{app:e,onEdit:h,onDelete:v},e.id))}),(0,n.jsx)(R,{isOpen:f,onClose:y,editApp:x,onSave:j})]})}var L=a(85998),z=a(94442),$=a(59597);function D(){return"undefined"!=typeof navigator&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window}let F={enabled:!0,thresholdMinutes:10},Z=[5,10,30,60];function H(){let e=(0,r.c)("notifications"),{showToast:t}=(0,z.dj)(),[a,l]=(0,s.useState)(!0),[i,o]=(0,s.useState)(!1),[d,c]=(0,s.useState)(!0),[f,m]=(0,s.useState)(!1),[x,p]=(0,s.useState)(null),[g,h]=(0,s.useState)(null),[b,v]=(0,s.useState)(!1),[j,y]=(0,s.useState)(null),[N,w]=(0,s.useState)({prompt:!0,completion:!1}),[k,C]=(0,s.useState)(!1),[S,A]=(0,s.useState)(null),[E,P]=(0,s.useState)(null),T=null!==j&&!1!==E;(0,s.useEffect)(()=>{let e=!1;return(async()=>{let t=function(){var e,t;let a=D(),n="undefined"!=typeof navigator&&(!!/iPad|iPhone|iPod/.test(navigator.userAgent)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1)&&!(null!=(e=(t=window).matchMedia)&&e.call(t,"(display-mode: standalone)").matches||!0===navigator.standalone);return{supported:a&&!n,iosNeedsInstall:n}}();e||(c(D()),m(t.iosNeedsInstall),"undefined"!=typeof Notification&&"denied"===Notification.permission&&v(!0));try{let t=await fetch("/api/push/vapid"),a=await t.json();e||(p(a.configured),h(a.publicKey))}catch(t){e||p(!1)}if(D())try{let t=await navigator.serviceWorker.getRegistration(),n=t?await t.pushManager.getSubscription():null;if(n&&!e){y(n.endpoint);let t=await fetch("/api/push/subscriptions?endpoint=".concat(encodeURIComponent(n.endpoint))),s=await t.json();if(!e){var a;P(!0===s.subscribed),A(null!=(a=s.delivery)?a:null)}s.subscribed&&s.subscription&&!e&&(w(s.subscription.preferences),C(!0===s.subscription.defaultsNoticePending))}}catch(e){}e||l(!1)})(),()=>{e=!0}},[]);let M=(0,s.useCallback)(async()=>{if(g){o(!0);try{var a,n;let s=await Notification.requestPermission();if("granted"!==s){v("denied"===s),t(e("toast.error"),"error");return}if(!await navigator.serviceWorker.getRegistration())return void t(e("toast.error"),"error");let r=await navigator.serviceWorker.ready,l=await r.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:function(e){let t="=".repeat((4-e.length%4)%4),a=atob((e+t).replace(/-/g,"+").replace(/_/g,"/")),n=new Uint8Array(new ArrayBuffer(a.length));for(let e=0;e<a.length;e++)n[e]=a.charCodeAt(e);return n}(g)}),i=await fetch("/api/push/subscriptions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({subscription:l.toJSON(),deviceLabel:navigator.userAgent.slice(0,120)})});if(!i.ok)throw Error("subscribe request failed");let o=await i.json();y(l.endpoint),P(!0),A(null),(null==(a=o.subscription)?void 0:a.preferences)&&w(o.subscription.preferences),C((null==(n=o.subscription)?void 0:n.defaultsNoticePending)===!0),v(!1),t(e("toast.enabled"),"success")}catch(a){t(e("toast.error"),"error")}finally{o(!1)}}},[g,t,e]),I=(0,s.useCallback)(async()=>{o(!0);try{var a;let n=await navigator.serviceWorker.getRegistration(),s=n?await n.pushManager.getSubscription():null,r=null!=(a=null==s?void 0:s.endpoint)?a:j;s&&await s.unsubscribe(),r&&await fetch("/api/push/subscriptions",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({endpoint:r})}),y(null),P(null),A(null),t(e("toast.disabled"),"info")}catch(a){t(e("toast.error"),"error")}finally{o(!1)}},[j,t,e]),O=(0,s.useCallback)(async(a,n)=>{if(!j)return;let s={...N,[a]:n};w(s);try{if(!(await fetch("/api/push/subscriptions",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({endpoint:j,preferences:s})})).ok)throw Error("update failed");t(e("toast.updated"),"success")}catch(a){w(N),t(e("toast.error"),"error")}},[j,N,t,e]),R=(0,s.useCallback)(async a=>{if(!j)return;let n=a?{...N,completion:!1}:N;C(!1),a&&w(n),o(!0);try{if(!(await fetch("/api/push/subscriptions",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({endpoint:j,...a?{preferences:n}:{},acknowledgeDefaultsNotice:!0})})).ok)throw Error("acknowledge failed");t(e(a?"defaultsNotice.adopted":"defaultsNotice.kept"),"success")}catch(a){w(N),C(!0),t(e("toast.error"),"error")}finally{o(!1)}},[j,N,t,e]);return(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)(u.Zp,{children:(0,n.jsx)(q,{})}),(0,n.jsx)(u.Zp,{children:a?(0,n.jsx)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:(0,n.jsx)(u.y$,{size:"sm"})}):d?f?(0,n.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"notifications-ios-guidance",children:e("ios.guidance")}):!1===x?(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:e("notConfigured")}):(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:e("description")}),b&&(0,n.jsx)("p",{className:"text-sm text-danger-foreground","data-testid":"notifications-permission-denied",children:e("permission.denied")}),(()=>{if(null===S)return null;let t="removed"===S.state,a=S.statusCode,s=t?null===a?e("delivery.removedUnknownStatus"):e("delivery.removed",{status:String(a)}):null===a?e("delivery.failingUnknownStatus",{count:S.failureCount}):e("delivery.failing",{count:S.failureCount,status:String(a)});return(0,n.jsxs)("div",{className:t?"space-y-2 rounded-lg border border-danger-border bg-danger-subtle p-3":"space-y-2 rounded-lg border border-warning-border bg-warning-subtle p-3","data-testid":"notifications-delivery-health","data-delivery-state":S.state,children:[(0,n.jsx)("p",{className:t?"text-sm font-semibold text-danger-foreground":"text-sm font-semibold text-warning-foreground",children:e(t?"delivery.headingRemoved":"delivery.headingFailing")}),(0,n.jsx)("p",{className:"text-xs text-foreground",children:s}),403===a&&(0,n.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"notifications-delivery-apns-hint",children:e("delivery.apnsHint")}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:e("delivery.since",{timestamp:new Date(S.firstFailureAt).toLocaleString()})})]})})(),T?(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)("p",{className:"text-sm font-medium text-foreground",children:e("enabledOnThisDevice")}),k&&(0,n.jsxs)("div",{className:"space-y-3 rounded-lg border border-info-border bg-info-subtle p-3","data-testid":"notifications-defaults-notice",children:[(0,n.jsx)("p",{className:"text-sm font-semibold text-info-foreground",children:e("defaultsNotice.heading")}),(0,n.jsx)("p",{className:"text-xs text-foreground",children:e("defaultsNotice.completionChanged")}),(0,n.jsx)("p",{className:"text-xs text-foreground",children:e("defaultsNotice.failuresAdded")}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.jsx)(u.$n,{variant:"primary",onClick:()=>R(!0),disabled:i,"data-testid":"notifications-defaults-notice-adopt",children:e("defaultsNotice.adopt")}),(0,n.jsx)(u.$n,{variant:"secondary",onClick:()=>R(!1),disabled:i,"data-testid":"notifications-defaults-notice-keep",children:e("defaultsNotice.keep")})]})]}),(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsx)("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:e("types.heading")}),(0,n.jsxs)("label",{className:"flex items-center justify-between gap-4",children:[(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{className:"block text-sm font-medium text-foreground",children:e("types.promptWaiting")}),(0,n.jsx)("span",{className:"block text-xs text-muted-foreground",children:e("types.promptWaitingDesc")})]}),(0,n.jsx)(u.dO,{checked:N.prompt,onCheckedChange:e=>O("prompt",e),disabled:i,"aria-label":e("types.promptWaiting"),"data-testid":"notifications-toggle-prompt"})]}),(0,n.jsxs)("label",{className:"flex items-center justify-between gap-4",children:[(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{className:"block text-sm font-medium text-foreground",children:e("types.completion")}),(0,n.jsx)("span",{className:"block text-xs text-muted-foreground",children:e("types.completionDesc")})]}),(0,n.jsx)(u.dO,{checked:N.completion,onCheckedChange:e=>O("completion",e),disabled:i,"aria-label":e("types.completion"),"data-testid":"notifications-toggle-completion"})]})]}),(0,n.jsx)(u.$n,{variant:"secondary",onClick:I,disabled:i,"data-testid":"notifications-unsubscribe",children:e("unsubscribe")})]}):(0,n.jsxs)(u.$n,{variant:"primary",onClick:M,disabled:i||b||!g,"data-testid":"notifications-enable",children:[(0,n.jsx)(L.A,{className:"h-4 w-4"}),i?e("enabling"):e("enable")]})]}):(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:e("unsupported")})}),(0,n.jsx)(u.Zp,{children:(0,n.jsx)(W,{})})]})}function W(){let e=(0,r.c)("notifications"),{showToast:t}=(0,z.dj)(),[a,l]=(0,s.useState)(!0),[i,o]=(0,s.useState)(!1),[d,c]=(0,s.useState)(F),[f,m]=(0,s.useState)([...Z]);(0,s.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await fetch("/api/push/escalation"),a=await t.json();!e&&(a.settings&&c(a.settings),Array.isArray(a.choices)&&a.choices.length>0&&m(a.choices))}catch(e){}finally{e||l(!1)}})(),()=>{e=!0}},[]);let x=(0,s.useCallback)(async a=>{c(a),o(!0);try{if(!(await fetch("/api/push/escalation",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:a})})).ok)throw Error("update failed");t(e("toast.updated"),"success")}catch(a){c(d),t(e("toast.error"),"error")}finally{o(!1)}},[d,t,e]);return(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsx)("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:e("escalation.heading")}),(0,n.jsxs)("label",{className:"flex items-center justify-between gap-4",children:[(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{className:"block text-sm font-medium text-foreground",children:e("escalation.toggle")}),(0,n.jsx)("span",{className:"block text-xs text-muted-foreground",children:e("escalation.toggleDesc")})]}),(0,n.jsx)(u.dO,{checked:d.enabled,onCheckedChange:e=>x({...d,enabled:e}),disabled:a||i,"aria-label":e("escalation.toggle"),"data-testid":"notifications-toggle-escalation"})]}),(0,n.jsxs)("label",{className:"flex items-center justify-between gap-4",children:[(0,n.jsx)("span",{className:"text-sm text-foreground",children:e("escalation.threshold")}),(0,n.jsx)("select",{className:"rounded-md border border-border bg-background px-2 py-1 text-sm text-foreground",value:String(d.thresholdMinutes),disabled:a||i||!d.enabled,"aria-label":e("escalation.threshold"),"data-testid":"notifications-escalation-threshold",onChange:e=>x({...d,thresholdMinutes:Number(e.target.value)}),children:f.map(t=>(0,n.jsx)("option",{value:String(t),children:e("escalation.minutes",{count:t})},t))})]})]})}function q(){let e=(0,r.c)("notifications"),{enabled:t,setEnabled:a}=(0,$.qG)(),{enabled:s,setEnabled:l}=(0,$.Ql)();return(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsx)("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:e("inApp.heading")}),(0,n.jsxs)("label",{className:"flex items-center justify-between gap-4",children:[(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{className:"block text-sm font-medium text-foreground",children:e("inApp.waitingToggle")}),(0,n.jsx)("span",{className:"block text-xs text-muted-foreground",children:e("inApp.waitingToggleDesc")})]}),(0,n.jsx)(u.dO,{checked:t,onCheckedChange:a,"aria-label":e("inApp.waitingToggle"),"data-testid":"notifications-toggle-inapp-waiting"})]}),(0,n.jsxs)("label",{className:"flex items-center justify-between gap-4",children:[(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{className:"block text-sm font-medium text-foreground",children:e("inApp.soundToggle")}),(0,n.jsx)("span",{className:"block text-xs text-muted-foreground",children:e("inApp.soundToggleDesc")})]}),(0,n.jsx)(u.dO,{checked:s,onCheckedChange:l,"aria-label":e("inApp.soundToggle"),"data-testid":"notifications-toggle-inapp-sound"})]})]})}function _(e){let{heading:t,children:a}=e;return(0,n.jsxs)("div",{className:"mb-8",children:[(0,n.jsx)("h2",{className:"text-lg font-semibold mb-4 text-foreground",children:t}),a]})}function B(e){let{onNavigate:t}=e,a=(0,r.c)("common"),s=(0,r.c)("skills");return(0,n.jsx)(_,{heading:a("settings.sections.quickLinks"),children:(0,n.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[(0,n.jsx)(S(),{href:"/repositories",className:"block","data-testid":"more-link-repositories",onClick:t,children:(0,n.jsxs)(u.Zp,{hover:!0,className:"transition-colors hover:border-accent-300 dark:hover:border-accent-700",children:[(0,n.jsx)("div",{className:"text-sm font-medium text-foreground",children:"Repositories"}),(0,n.jsx)("div",{className:"text-xs text-muted-foreground",children:"Manage repositories and worktrees"})]})}),(0,n.jsx)(S(),{href:"/skills",className:"block","data-testid":"more-link-skills",onClick:t,children:(0,n.jsxs)(u.Zp,{hover:!0,className:"transition-colors hover:border-accent-300 dark:hover:border-accent-700",children:[(0,n.jsx)("div",{className:"text-sm font-medium text-foreground",children:a("nav.skills")}),(0,n.jsx)("div",{className:"text-xs text-muted-foreground",children:s("page.description")})]})}),(0,n.jsx)(S(),{href:"/skills/installed",className:"block","data-testid":"more-link-skills-installed",onClick:t,children:(0,n.jsxs)(u.Zp,{hover:!0,className:"transition-colors hover:border-accent-300 dark:hover:border-accent-700",children:[(0,n.jsx)("div",{className:"text-sm font-medium text-foreground",children:s("dashboard.title")}),(0,n.jsx)("div",{className:"text-xs text-muted-foreground",children:s("dashboard.description")})]})})]})})}function J(){let e=(0,r.c)("common");return(0,n.jsx)(_,{heading:e("settings.sections.general"),children:(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)(p,{}),(0,n.jsx)(v,{}),(0,n.jsx)(k,{})]})})}function V(){let e=(0,r.c)("common");return(0,n.jsx)(_,{heading:e("settings.sections.notifications"),children:(0,n.jsx)(H,{})})}function K(){let e=(0,r.c)("common");return(0,n.jsx)(_,{heading:e("settings.sections.externalApps"),children:(0,n.jsx)(U,{})})}function X(){let e=(0,r.c)("common");return(0,n.jsx)(_,{heading:e("settings.sections.about"),children:(0,n.jsx)(u.Zp,{children:(0,n.jsx)("div",{className:"text-sm text-muted-foreground",children:"CommandMate - A local control plane for agent CLIs."})})})}function G(){return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(B,{}),(0,n.jsx)(J,{}),(0,n.jsx)(V,{}),(0,n.jsx)(K,{}),(0,n.jsx)(X,{})]})}a(72604),a(95275),a(79832);var Q=a(94465),Y=a(23838),ee=a(40823);let et=[{id:"general",labelKey:"settings.sections.general"},{id:"notifications",labelKey:"settings.sections.notifications"},{id:"externalApps",labelKey:"settings.sections.externalApps"},{id:"about",labelKey:"settings.sections.about"}];function ea(){let e=(0,r.c)("common"),{isOpen:t,close:a}=(0,ee.V0)();return(0,n.jsx)(Q.a,{isOpen:t,onClose:a,title:e("settings.title"),size:"lg",children:(0,n.jsxs)(Y.tU,{defaultValue:"general",orientation:"vertical",variant:"pill",className:"flex gap-6 min-h-[60vh]","data-testid":"settings-dialog",children:[(0,n.jsx)(Y.j7,{"aria-label":e("settings.categoriesLabel"),className:"sticky top-0 w-40 shrink-0 flex-col items-stretch self-start",children:et.map(t=>(0,n.jsx)(Y.Xi,{value:t.id,"data-testid":"settings-dialog-tab-".concat(t.id),className:"justify-start",children:e(t.labelKey)},t.id))}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)(Y.av,{value:"general",className:"mt-0",children:(0,n.jsx)(J,{})}),(0,n.jsx)(Y.av,{value:"notifications",className:"mt-0",children:(0,n.jsx)(V,{})}),(0,n.jsx)(Y.av,{value:"externalApps",className:"mt-0",children:(0,n.jsx)(K,{})}),(0,n.jsxs)(Y.av,{value:"about",className:"mt-0",children:[(0,n.jsx)(B,{onNavigate:a}),(0,n.jsx)(X,{})]})]})]})})}},59597:(e,t,a)=>{a.d(t,{Ql:()=>o,qG:()=>l});var n=a(12115);let s="mcbd-inapp-waiting-toast",r="mcbd:inapp-notification-prefs-changed";function l(){let[e,t]=(0,n.useState)(!0);return(0,n.useEffect)(()=>{let e=()=>t(function(){try{let e=window.localStorage.getItem(s);if(null===e)return!0;return"false"!==e}catch(e){return!0}}());return e(),window.addEventListener(r,e),window.addEventListener("storage",e),()=>{window.removeEventListener(r,e),window.removeEventListener("storage",e)}},[]),{enabled:e,setEnabled:(0,n.useCallback)(e=>{t(e);try{window.localStorage.setItem(s,e?"true":"false")}catch(e){}window.dispatchEvent(new CustomEvent(r))},[])}}let i="mcbd-inapp-waiting-sound";function o(){let[e,t]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{let e=()=>t(function(){try{let e=window.localStorage.getItem(i);if(null===e)return!1;return"true"===e}catch(e){return!1}}());return e(),window.addEventListener(r,e),window.addEventListener("storage",e),()=>{window.removeEventListener(r,e),window.removeEventListener("storage",e)}},[]),{enabled:e,setEnabled:(0,n.useCallback)(e=>{t(e);try{window.localStorage.setItem(i,e?"true":"false")}catch(e){}window.dispatchEvent(new CustomEvent(r))},[])}}},72604:(e,t,a)=>{a.d(t,{dS:()=>c,rM:()=>u});var n=a(12115),s=a(20063),r=a(18955),l=a(94442),i=a(66966),o=a(60199),d=a(59597);function c(e,t,a){return"".concat(e,"|").concat(null!=t?t:"-","|").concat(null!=a?a:"no-since")}function u(){let e=(0,r.c)("notifications"),{showToast:t}=(0,l.dj)(),{addListener:a}=(0,o.xM)(),{enabled:u}=(0,d.qG)(),f=(0,s.usePathname)(),m=(0,s.useRouter)(),x=(0,i.rC)(),p=(0,n.useRef)({enabled:u,pathname:f,worktrees:null==x?void 0:x.worktrees,showToast:t,t:e,router:m});p.current={enabled:u,pathname:f,worktrees:null==x?void 0:x.worktrees,showToast:t,t:e,router:m};let g=(0,n.useRef)(new Set);return(0,n.useEffect)(()=>a(e=>{var t,a,n,s,r;if("session_status_changed"!==e.type)return;let l=e.worktreeId;if("string"!=typeof l||0===l.length)return;let i=e.isWaitingForResponse;if("boolean"!=typeof i)return;let o=null!=(n=e.instance)?n:null,d=null!=(s=e.waitingSince)?s:null;if(!i){let e="".concat(l,"|").concat(null!=o?o:"-","|");for(let t of g.current)t.startsWith(e)&&g.current.delete(t);return}let u=p.current;if(!u.enabled||function(e){if(!e)return null;let t=/^\/worktrees\/([^/]+)/.exec(e);if(!t)return null;try{return decodeURIComponent(t[1])}catch(e){return t[1]}}(u.pathname)===l)return;let f=c(l,o,d);if(g.current.has(f))return;g.current.size>=500&&g.current.clear(),g.current.add(f);let m=null!=(r=null==(a=u.worktrees)||null==(t=a.find(e=>e.id===l))?void 0:t.name)?r:l;u.showToast(u.t("inApp.waitingToast",{name:m}),"warning",8e3,{onClick:()=>u.router.push("/worktrees/".concat(encodeURIComponent(l)))})}),[a]),null}},75676:(e,t,a)=>{a.d(t,{jg:()=>r,kQ:()=>l,mR:()=>d,mS:()=>o,wf:()=>n});let n="terminal",s=new Set(["terminal","chat"]);function r(e){return"string"==typeof e&&s.has(e)}let l={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 d(){return{phase:"idle",prompt:{...l},layout:{...i},error:{...o},messages:[],wsConnected:!1}}},79832:(e,t,a)=>{a.d(t,{o:()=>o});var n=a(12115),s=a(24373);let r=/^\(\d+\+?\)(?:\s+|$)/;function l(e){return e.replace(r,"").trim()}function i(e){return Array.from(e.querySelectorAll('link[rel~="icon"]'))}function o(){return!function(){let{count:e}=(0,s.Lv)(),t=(0,n.useRef)([]),a=(0,n.useRef)(null);(0,n.useEffect)(()=>{if("undefined"==typeof document)return;let t=()=>{let t=function(e,t){let a=l(e);if(!Number.isFinite(t)||t<=0)return a;let n="(".concat(Math.floor(t),")");return a?"".concat(n," ").concat(a):n}(document.title,e);t!==document.title&&(document.title=t)};t();let a=null;return"undefined"!=typeof MutationObserver&&document.head&&(a=new MutationObserver(t)).observe(document.head,{childList:!0,subtree:!0,characterData:!0}),()=>{null==a||a.disconnect();let e=l(document.title);e!==document.title&&(document.title=e)}},[e]),(0,n.useEffect)(()=>{if("undefined"==typeof document||e<=0)return;let n=t.current,s=()=>{let t=a.current,s=function(e){var t,a;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Number.isFinite(e)||e<=0)return null;let s=null!=(t=n.document)?t:"undefined"!=typeof document?document:null;if(!s)return null;let r=null!=(a=n.size)?a:64;try{let t=s.createElement("canvas");t.width=r,t.height=r;let a=t.getContext("2d");if(!a)return null;a.clearRect(0,0,r,r),n.base?a.drawImage(n.base,0,0,r,r):(a.fillStyle="#111827",a.fillRect(0,0,r,r));let l=Math.floor(e)>9,i=.34*r,o=r-i-.03*r;a.beginPath(),a.arc(o,o,i,0,2*Math.PI),a.fillStyle=l?"#ef4444":"#f59e0b",a.fill(),a.lineWidth=.05*r,a.strokeStyle="rgba(0, 0, 0, 0.55)",a.stroke();let d=function(e){if(!Number.isFinite(e)||e<=0)return"";let t=Math.floor(e);return t>9?"".concat(9,"+"):String(t)}(e);return a.fillStyle=l?"#ffffff":"#1c1300",a.font="bold ".concat(Math.round(r*(d.length>1?.38:.48)),"px sans-serif"),a.textAlign="center",a.textBaseline="middle",a.fillText(d,o,o+.02*r),t.toDataURL("image/png")}catch(e){return null}}(e,{base:t&&t.complete&&t.naturalWidth>0?t:null,document});s&&function(e,t,a){let n=i(e);if(0===n.length){let t=e.createElement("link");t.setAttribute("rel","icon"),t.setAttribute("type","image/png"),e.head.appendChild(t),a.push({link:t,originalHref:null,created:!0}),n=[t]}for(let e of n)a.some(t=>t.link===e)||a.push({link:e,originalHref:e.getAttribute("href"),created:!1}),e.setAttribute("href",t)}(document,s,n)};s();let r=a.current;if(!r&&"undefined"!=typeof Image){let e=function(e,t){var a;for(let e of t)if(!e.created&&e.originalHref)return e.originalHref;let n=i(e).find(e=>e.getAttribute("href"));return null!=(a=null==n?void 0:n.getAttribute("href"))?a:null}(document,n);e&&(a.current=r=new Image,r.src=e)}let l=null;return r&&!(r.complete&&r.naturalWidth>0)?(l=()=>s(),r.addEventListener("load",l)):r&&s(),()=>{r&&l&&r.removeEventListener("load",l);for(let e of n){if(e.created){e.link.remove();continue}null===e.originalHref?e.link.removeAttribute("href"):e.link.setAttribute("href",e.originalHref)}n.length=0}},[e]),(0,n.useEffect)(()=>{!function(e,t){let a="undefined"!=typeof navigator?navigator:null;if(!a)return;let n=e=>{e&&"function"==typeof e.catch&&e.catch(()=>{})};try{if(Number.isFinite(e)&&e>0){if("function"!=typeof a.setAppBadge)return!1;return n(a.setAppBadge(Math.floor(e))),!0}if("function"!=typeof a.clearAppBadge)return!1;n(a.clearAppBadge())}catch(e){return!1}}(e)},[e])}(),null}},94442:(e,t,a)=>{a.d(t,{dj:()=>y,tE:()=>j});var n=a(95155),s=a(12115),r=a(47650),l=a(18955),i=a(42529),o=a(78874),d=a(52056),c=a(23327),u=a(65229),f=a(59854),m=a(9900),x=a(9286);function p(e){let{type:t,iconColor:a}=e,s="h-5 w-5 ".concat(a);switch(t){case"success":return(0,n.jsx)(i.A,{className:s,"data-testid":"toast-icon-success"});case"error":return(0,n.jsx)(o.A,{className:s,"data-testid":"toast-icon-error"});case"warning":return(0,n.jsx)(d.A,{className:s,"data-testid":"toast-icon-warning"});default:return(0,n.jsx)(c.A,{className:s,"data-testid":"toast-icon-info"})}}function g(e){let{id:t,message:a,type:r,onClose:i,duration:o=3e3,onClick:d}=e,c=(0,l.c)("common"),f=(0,s.useRef)(null),g=function(e){switch(e){case"success":return{bgColor:"bg-success-subtle",borderColor:"border-success-border",textColor:"text-success-foreground",iconColor:"text-success-foreground"};case"error":return{bgColor:"bg-danger-subtle",borderColor:"border-danger-border",textColor:"text-danger-foreground",iconColor:"text-danger-foreground"};case"warning":return{bgColor:"bg-warning-subtle",borderColor:"border-warning-border",textColor:"text-warning-foreground",iconColor:"text-warning-foreground"};default:return{bgColor:"bg-info-subtle",borderColor:"border-info-border",textColor:"text-info-foreground",iconColor:"text-info-foreground"}}}(r),[h,b]=(0,s.useState)(!0),{shouldRender:v,isExiting:j}=(0,x.O)(h,m.Ys),y=(0,s.useRef)(i);y.current=i,(0,s.useEffect)(()=>{v||y.current(t)},[v,t]),(0,s.useEffect)(()=>(o>0&&(f.current=setTimeout(()=>{b(!1)},o)),()=>{f.current&&clearTimeout(f.current)}),[o]);let N=(0,s.useCallback)(()=>{f.current&&clearTimeout(f.current),b(!1)},[]);return(0,n.jsxs)("div",{"data-testid":"toast-".concat(t),role:"alert",className:"\n ".concat(g.bgColor,"\n ").concat(g.borderColor,"\n ").concat(g.textColor,"\n border rounded-lg shadow-lg p-4 min-w-[300px] max-w-[400px]\n flex items-start gap-3\n ").concat(j?"animate-out fade-out-0 slide-out-to-right-full duration-200 fill-mode-forwards pointer-events-none":"animate-slide-in","\n "),children:[(0,n.jsx)(p,{type:r,iconColor:g.iconColor}),d?(0,n.jsx)("button",{type:"button","data-testid":"toast-action-button",onClick:()=>{d(),N()},className:"flex-1 text-left text-sm font-medium underline-offset-2 hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm",children:a}):(0,n.jsx)("p",{className:"flex-1 text-sm font-medium",children:a}),(0,n.jsx)("button",{"data-testid":"toast-close-button",onClick:N,"aria-label":c("closeNotification"),className:"\n ".concat(g.textColor,"\n hover:opacity-70\n focus:outline-none focus:ring-2 focus:ring-offset-2\n transition-opacity\n "),children:(0,n.jsx)(u.A,{className:"h-4 w-4"})})]})}function h(e){let{toasts:t,onClose:a}=e,[l,i]=(0,s.useState)(!1);(0,s.useEffect)(()=>{i(!0)},[]);let o=(0,n.jsx)("div",{"data-testid":"toast-container","aria-live":"polite",className:"fixed bottom-4 right-4 flex flex-col gap-2",style:{zIndex:f.M.TOAST},children:t.map(e=>(0,n.jsx)(g,{id:e.id,message:e.message,type:e.type,onClose:a,duration:e.duration,onClick:e.onClick},e.id))});return l?(0,r.createPortal)(o,document.body):null}function b(){let[e,t]=(0,s.useState)([]),a=(0,s.useRef)(0),n=(0,s.useCallback)(function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3e3,r=arguments.length>3?arguments[3]:void 0,l="toast-".concat(++a.current,"-").concat(Date.now()),i={id:l,message:e,type:n,duration:s,...(null==r?void 0:r.onClick)?{onClick:r.onClick}:{}};return t(e=>[...e,i]),l},[]),r=(0,s.useCallback)(e=>{t(t=>t.filter(t=>t.id!==e))},[]),l=(0,s.useCallback)(()=>{t([])},[]);return(0,s.useMemo)(()=>({toasts:e,showToast:n,removeToast:r,clearToasts:l}),[e,n,r,l])}let v=(0,s.createContext)(null);function j(e){let{children:t}=e,a=b();return(0,n.jsxs)(v.Provider,{value:a,children:[t,(0,n.jsx)(h,{toasts:a.toasts,onClose:a.removeToast})]})}function y(){let e=(0,s.useContext)(v),t=b();return null!=e?e:t}},95275:(e,t,a)=>{a.d(t,{H:()=>f});var n=a(12115),s=a(60199),r=a(59597),l=a(72604);let i=[{frequency:880,offset:0,duration:.12},{frequency:1318.5,offset:.13,duration:.18}],o=null;function d(){if(o)return o;let e=function(){var e,t;let a=window;return null!=(t=null!=(e=a.AudioContext)?e:a.webkitAudioContext)?t:null}();if(!e)return null;try{o=new e}catch(e){return null}return o}function c(e){e&&"function"==typeof e.catch&&e.catch(()=>{})}let u=["pointerdown","touchstart","keydown"];function f(){let{addListener:e}=(0,s.xM)(),{enabled:t}=(0,r.Ql)(),a=(0,n.useRef)({enabled:t});a.current={enabled:t};let o=(0,n.useRef)(new Set);return(0,n.useEffect)(()=>{let e=()=>(function(){let e=d();if(e)try{var t;"suspended"===e.state&&c(null==(t=e.resume)?void 0:t.call(e))}catch(e){}})();for(let t of u)window.addEventListener(t,e,{once:!0,passive:!0});return()=>{for(let t of u)window.removeEventListener(t,e)}},[]),(0,n.useEffect)(()=>e(e=>{var t,n;if("session_status_changed"!==e.type)return;let s=e.worktreeId;if("string"!=typeof s||0===s.length)return;let r=e.isWaitingForResponse;if("boolean"!=typeof r)return;let u=null!=(t=e.instance)?t:null,f=null!=(n=e.waitingSince)?n:null;if(!r){let e="".concat(s,"|").concat(null!=u?u:"-","|");for(let t of o.current)t.startsWith(e)&&o.current.delete(t);return}if(!a.current.enabled)return;let m=(0,l.dS)(s,u,f);o.current.has(m)||(o.current.size>=500&&o.current.clear(),o.current.add(m),function(){let e=d();if(e)try{var t,a;"suspended"===e.state&&c(null==(t=e.resume)?void 0:t.call(e));let n=null!=(a=e.currentTime)?a:0;for(let t of i){let a=e.createOscillator(),s=e.createGain();a.type="sine",a.frequency.value=t.frequency;let r=n+t.offset,l=r+t.duration;s.gain.setValueAtTime(0,r),s.gain.linearRampToValueAtTime(.12,r+.015),s.gain.linearRampToValueAtTime(1e-4,l),a.connect(s),s.connect(e.destination),a.start(r),a.stop(l+.02)}}catch(e){return!1}}())}),[e]),null}}}]);