commandmate 0.49.3 → 0.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (877) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-build-manifest.json +454 -408
  3. package/.next/app-path-routes-manifest.json +19 -13
  4. package/.next/build-manifest.json +5 -5
  5. package/.next/prerender-manifest.json +9 -9
  6. package/.next/react-loadable-manifest.json +1 -1
  7. package/.next/required-server-files.json +1 -1
  8. package/.next/routes-manifest.json +32 -0
  9. package/.next/server/app/_not-found/page_client-reference-manifest.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_client-reference-manifest.js +1 -1
  12. package/.next/server/app/api/app/release-notes/route_client-reference-manifest.js +1 -1
  13. package/.next/server/app/api/app/update/route_client-reference-manifest.js +1 -1
  14. package/.next/server/app/api/app/update-check/route_client-reference-manifest.js +1 -1
  15. package/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -1
  16. package/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -1
  17. package/.next/server/app/api/auth/status/route_client-reference-manifest.js +1 -1
  18. package/.next/server/app/api/capabilities/route.js +1 -1
  19. package/.next/server/app/api/capabilities/route_client-reference-manifest.js +1 -1
  20. package/.next/server/app/api/daily-summary/route.js +1 -1
  21. package/.next/server/app/api/daily-summary/route.js.nft.json +1 -1
  22. package/.next/server/app/api/daily-summary/route_client-reference-manifest.js +1 -1
  23. package/.next/server/app/api/daily-summary/status/route.js +1 -1
  24. package/.next/server/app/api/daily-summary/status/route.js.nft.json +1 -1
  25. package/.next/server/app/api/daily-summary/status/route_client-reference-manifest.js +1 -1
  26. package/.next/server/app/api/external-apps/[id]/health/route_client-reference-manifest.js +1 -1
  27. package/.next/server/app/api/external-apps/[id]/route_client-reference-manifest.js +1 -1
  28. package/.next/server/app/api/external-apps/route_client-reference-manifest.js +1 -1
  29. package/.next/server/app/api/fs/browse/route_client-reference-manifest.js +1 -1
  30. package/.next/server/app/api/fs/recent-paths/route_client-reference-manifest.js +1 -1
  31. package/.next/server/app/api/hooks/agent-event/route.js +1 -103
  32. package/.next/server/app/api/hooks/agent-event/route.js.nft.json +1 -1
  33. package/.next/server/app/api/hooks/agent-event/route_client-reference-manifest.js +1 -1
  34. package/.next/server/app/api/hooks/claude-done/route.js +2 -2
  35. package/.next/server/app/api/hooks/claude-done/route.js.nft.json +1 -1
  36. package/.next/server/app/api/hooks/claude-done/route_client-reference-manifest.js +1 -1
  37. package/.next/server/app/api/hooks/permission-request/route.js +1 -1
  38. package/.next/server/app/api/hooks/permission-request/route.js.nft.json +1 -1
  39. package/.next/server/app/api/hooks/permission-request/route_client-reference-manifest.js +1 -1
  40. package/.next/server/app/api/metrics/vibe/route_client-reference-manifest.js +1 -1
  41. package/.next/server/app/api/ollama/models/route_client-reference-manifest.js +1 -1
  42. package/.next/server/app/api/push/escalation/route.js +1 -1
  43. package/.next/server/app/api/push/escalation/route.js.nft.json +1 -1
  44. package/.next/server/app/api/push/escalation/route_client-reference-manifest.js +1 -1
  45. package/.next/server/app/api/push/subscriptions/route.js +1 -1
  46. package/.next/server/app/api/push/subscriptions/route_client-reference-manifest.js +1 -1
  47. package/.next/server/app/api/push/vapid/route.js +1 -1
  48. package/.next/server/app/api/push/vapid/route.js.nft.json +1 -1
  49. package/.next/server/app/api/push/vapid/route_client-reference-manifest.js +1 -1
  50. package/.next/server/app/api/relays/[relayId]/cancel/route.js +1 -1
  51. package/.next/server/app/api/relays/[relayId]/cancel/route.js.nft.json +1 -1
  52. package/.next/server/app/api/relays/[relayId]/cancel/route_client-reference-manifest.js +1 -1
  53. package/.next/server/app/api/relays/[relayId]/resolve/route.js +1 -1
  54. package/.next/server/app/api/relays/[relayId]/resolve/route.js.nft.json +1 -1
  55. package/.next/server/app/api/relays/[relayId]/resolve/route_client-reference-manifest.js +1 -1
  56. package/.next/server/app/api/relays/[relayId]/route.js +1 -1
  57. package/.next/server/app/api/relays/[relayId]/route_client-reference-manifest.js +1 -1
  58. package/.next/server/app/api/relays/route.js +1 -1
  59. package/.next/server/app/api/relays/route.js.nft.json +1 -1
  60. package/.next/server/app/api/relays/route_client-reference-manifest.js +1 -1
  61. package/.next/server/app/api/remote/pair/route.js +2 -2
  62. package/.next/server/app/api/remote/pair/route_client-reference-manifest.js +1 -1
  63. package/.next/server/app/api/repositories/[id]/role-defaults/route.js +1 -0
  64. package/.next/server/app/api/repositories/[id]/role-defaults/route.js.nft.json +1 -0
  65. package/.next/server/app/api/repositories/[id]/role-defaults/route_client-reference-manifest.js +1 -0
  66. package/.next/server/app/api/repositories/[id]/route_client-reference-manifest.js +1 -1
  67. package/.next/server/app/api/repositories/clone/[jobId]/route.js +1 -1
  68. package/.next/server/app/api/repositories/clone/[jobId]/route.js.nft.json +1 -1
  69. package/.next/server/app/api/repositories/clone/[jobId]/route_client-reference-manifest.js +1 -1
  70. package/.next/server/app/api/repositories/clone/route.js +1 -1
  71. package/.next/server/app/api/repositories/clone/route.js.nft.json +1 -1
  72. package/.next/server/app/api/repositories/clone/route_client-reference-manifest.js +1 -1
  73. package/.next/server/app/api/repositories/excluded/route_client-reference-manifest.js +1 -1
  74. package/.next/server/app/api/repositories/restore/route.js +1 -1
  75. package/.next/server/app/api/repositories/restore/route.js.nft.json +1 -1
  76. package/.next/server/app/api/repositories/restore/route_client-reference-manifest.js +1 -1
  77. package/.next/server/app/api/repositories/route.js +1 -1
  78. package/.next/server/app/api/repositories/route.js.nft.json +1 -1
  79. package/.next/server/app/api/repositories/route_client-reference-manifest.js +1 -1
  80. package/.next/server/app/api/repositories/scan/route.js +1 -1
  81. package/.next/server/app/api/repositories/scan/route.js.nft.json +1 -1
  82. package/.next/server/app/api/repositories/scan/route_client-reference-manifest.js +1 -1
  83. package/.next/server/app/api/repositories/sync/route.js +1 -1
  84. package/.next/server/app/api/repositories/sync/route.js.nft.json +1 -1
  85. package/.next/server/app/api/repositories/sync/route_client-reference-manifest.js +1 -1
  86. package/.next/server/app/api/repositories/validate-path/route.js +1 -1
  87. package/.next/server/app/api/repositories/validate-path/route_client-reference-manifest.js +1 -1
  88. package/.next/server/app/api/roles/[id]/route.js +1 -0
  89. package/.next/server/app/api/roles/[id]/route.js.nft.json +1 -0
  90. package/.next/server/app/api/roles/[id]/route_client-reference-manifest.js +1 -0
  91. package/.next/server/app/api/roles/route.js +1 -0
  92. package/.next/server/app/api/roles/route.js.nft.json +1 -0
  93. package/.next/server/app/api/roles/route_client-reference-manifest.js +1 -0
  94. package/.next/server/app/api/settings/agent-role-defaults/route.js +1 -0
  95. package/.next/server/app/api/settings/agent-role-defaults/route.js.nft.json +1 -0
  96. package/.next/server/app/api/settings/agent-role-defaults/route_client-reference-manifest.js +1 -0
  97. package/.next/server/app/api/settings/default-agents/route.js +1 -1
  98. package/.next/server/app/api/settings/default-agents/route.js.nft.json +1 -1
  99. package/.next/server/app/api/settings/default-agents/route_client-reference-manifest.js +1 -1
  100. package/.next/server/app/api/settings/default-surface-mode/route_client-reference-manifest.js +1 -1
  101. package/.next/server/app/api/sidebar/group-order/route_client-reference-manifest.js +1 -1
  102. package/.next/server/app/api/skills/[id]/route_client-reference-manifest.js +1 -1
  103. package/.next/server/app/api/skills/installations/route_client-reference-manifest.js +1 -1
  104. package/.next/server/app/api/skills/operations/route_client-reference-manifest.js +1 -1
  105. package/.next/server/app/api/skills/reindex/route_client-reference-manifest.js +1 -1
  106. package/.next/server/app/api/skills/route_client-reference-manifest.js +1 -1
  107. package/.next/server/app/api/slash-commands/route.js +1 -1
  108. package/.next/server/app/api/slash-commands/route_client-reference-manifest.js +1 -1
  109. package/.next/server/app/api/tasks/[taskId]/cancel/route_client-reference-manifest.js +1 -1
  110. package/.next/server/app/api/tasks/[taskId]/route.js +1 -1
  111. package/.next/server/app/api/tasks/[taskId]/route_client-reference-manifest.js +1 -1
  112. package/.next/server/app/api/templates/[id]/route_client-reference-manifest.js +1 -1
  113. package/.next/server/app/api/templates/route_client-reference-manifest.js +1 -1
  114. package/.next/server/app/api/verification/runs/[runId]/route.js +1 -1
  115. package/.next/server/app/api/verification/runs/[runId]/route_client-reference-manifest.js +1 -1
  116. package/.next/server/app/api/verification/runs/route.js +1 -1
  117. package/.next/server/app/api/verification/runs/route_client-reference-manifest.js +1 -1
  118. package/.next/server/app/api/worktrees/[id]/auto-yes/route.js +1 -1
  119. package/.next/server/app/api/worktrees/[id]/auto-yes/route.js.nft.json +1 -1
  120. package/.next/server/app/api/worktrees/[id]/auto-yes/route_client-reference-manifest.js +1 -1
  121. package/.next/server/app/api/worktrees/[id]/capture/route.js +1 -1
  122. package/.next/server/app/api/worktrees/[id]/capture/route.js.nft.json +1 -1
  123. package/.next/server/app/api/worktrees/[id]/capture/route_client-reference-manifest.js +1 -1
  124. package/.next/server/app/api/worktrees/[id]/clear-composer/route.js +1 -1
  125. package/.next/server/app/api/worktrees/[id]/clear-composer/route.js.nft.json +1 -1
  126. package/.next/server/app/api/worktrees/[id]/clear-composer/route_client-reference-manifest.js +1 -1
  127. package/.next/server/app/api/worktrees/[id]/cli-reference/route.js +1 -1
  128. package/.next/server/app/api/worktrees/[id]/cli-reference/route_client-reference-manifest.js +1 -1
  129. package/.next/server/app/api/worktrees/[id]/cli-tool/route.js +1 -1
  130. package/.next/server/app/api/worktrees/[id]/cli-tool/route_client-reference-manifest.js +1 -1
  131. package/.next/server/app/api/worktrees/[id]/cmate/schedules/route.js +3 -3
  132. package/.next/server/app/api/worktrees/[id]/cmate/schedules/route.js.nft.json +1 -1
  133. package/.next/server/app/api/worktrees/[id]/cmate/schedules/route_client-reference-manifest.js +1 -1
  134. package/.next/server/app/api/worktrees/[id]/current-output/route.js +1 -1
  135. package/.next/server/app/api/worktrees/[id]/current-output/route.js.nft.json +1 -1
  136. package/.next/server/app/api/worktrees/[id]/current-output/route_client-reference-manifest.js +1 -1
  137. package/.next/server/app/api/worktrees/[id]/direct-input/route.js +1 -1
  138. package/.next/server/app/api/worktrees/[id]/direct-input/route.js.nft.json +1 -1
  139. package/.next/server/app/api/worktrees/[id]/direct-input/route_client-reference-manifest.js +1 -1
  140. package/.next/server/app/api/worktrees/[id]/env/route.js +1 -1
  141. package/.next/server/app/api/worktrees/[id]/env/route_client-reference-manifest.js +1 -1
  142. package/.next/server/app/api/worktrees/[id]/execution-logs/[logId]/route.js +1 -1
  143. package/.next/server/app/api/worktrees/[id]/execution-logs/[logId]/route_client-reference-manifest.js +1 -1
  144. package/.next/server/app/api/worktrees/[id]/execution-logs/route.js +2 -2
  145. package/.next/server/app/api/worktrees/[id]/execution-logs/route.js.nft.json +1 -1
  146. package/.next/server/app/api/worktrees/[id]/execution-logs/route_client-reference-manifest.js +1 -1
  147. package/.next/server/app/api/worktrees/[id]/files/[...path]/route_client-reference-manifest.js +1 -1
  148. package/.next/server/app/api/worktrees/[id]/git/branch/create/route.js +1 -1
  149. package/.next/server/app/api/worktrees/[id]/git/branch/create/route_client-reference-manifest.js +1 -1
  150. package/.next/server/app/api/worktrees/[id]/git/branch/delete/route.js +1 -1
  151. package/.next/server/app/api/worktrees/[id]/git/branch/delete/route_client-reference-manifest.js +1 -1
  152. package/.next/server/app/api/worktrees/[id]/git/branches/route.js +1 -1
  153. package/.next/server/app/api/worktrees/[id]/git/branches/route_client-reference-manifest.js +1 -1
  154. package/.next/server/app/api/worktrees/[id]/git/checkout/route.js +1 -1
  155. package/.next/server/app/api/worktrees/[id]/git/checkout/route_client-reference-manifest.js +1 -1
  156. package/.next/server/app/api/worktrees/[id]/git/commit/route.js +1 -1
  157. package/.next/server/app/api/worktrees/[id]/git/commit/route_client-reference-manifest.js +1 -1
  158. package/.next/server/app/api/worktrees/[id]/git/diff/route.js +1 -1
  159. package/.next/server/app/api/worktrees/[id]/git/diff/route_client-reference-manifest.js +1 -1
  160. package/.next/server/app/api/worktrees/[id]/git/fetch/route.js +1 -1
  161. package/.next/server/app/api/worktrees/[id]/git/fetch/route_client-reference-manifest.js +1 -1
  162. package/.next/server/app/api/worktrees/[id]/git/log/route.js +1 -1
  163. package/.next/server/app/api/worktrees/[id]/git/log/route_client-reference-manifest.js +1 -1
  164. package/.next/server/app/api/worktrees/[id]/git/pull/route.js +1 -1
  165. package/.next/server/app/api/worktrees/[id]/git/pull/route_client-reference-manifest.js +1 -1
  166. package/.next/server/app/api/worktrees/[id]/git/push/route.js +1 -1
  167. package/.next/server/app/api/worktrees/[id]/git/push/route_client-reference-manifest.js +1 -1
  168. package/.next/server/app/api/worktrees/[id]/git/reset/route.js +1 -1
  169. package/.next/server/app/api/worktrees/[id]/git/reset/route_client-reference-manifest.js +1 -1
  170. package/.next/server/app/api/worktrees/[id]/git/revert/route.js +1 -1
  171. package/.next/server/app/api/worktrees/[id]/git/revert/route_client-reference-manifest.js +1 -1
  172. package/.next/server/app/api/worktrees/[id]/git/show/[commitHash]/route.js +1 -1
  173. package/.next/server/app/api/worktrees/[id]/git/show/[commitHash]/route_client-reference-manifest.js +1 -1
  174. package/.next/server/app/api/worktrees/[id]/git/stage/route.js +1 -1
  175. package/.next/server/app/api/worktrees/[id]/git/stage/route_client-reference-manifest.js +1 -1
  176. package/.next/server/app/api/worktrees/[id]/git/staged/route.js +1 -1
  177. package/.next/server/app/api/worktrees/[id]/git/staged/route_client-reference-manifest.js +1 -1
  178. package/.next/server/app/api/worktrees/[id]/git/stash/[index]/route.js +1 -1
  179. package/.next/server/app/api/worktrees/[id]/git/stash/[index]/route_client-reference-manifest.js +1 -1
  180. package/.next/server/app/api/worktrees/[id]/git/stash/apply/route.js +1 -1
  181. package/.next/server/app/api/worktrees/[id]/git/stash/apply/route_client-reference-manifest.js +1 -1
  182. package/.next/server/app/api/worktrees/[id]/git/stash/pop/route.js +1 -1
  183. package/.next/server/app/api/worktrees/[id]/git/stash/pop/route_client-reference-manifest.js +1 -1
  184. package/.next/server/app/api/worktrees/[id]/git/stash/push/route.js +1 -1
  185. package/.next/server/app/api/worktrees/[id]/git/stash/push/route_client-reference-manifest.js +1 -1
  186. package/.next/server/app/api/worktrees/[id]/git/stash/route.js +1 -1
  187. package/.next/server/app/api/worktrees/[id]/git/stash/route_client-reference-manifest.js +1 -1
  188. package/.next/server/app/api/worktrees/[id]/git/status/route.js +1 -1
  189. package/.next/server/app/api/worktrees/[id]/git/status/route_client-reference-manifest.js +1 -1
  190. package/.next/server/app/api/worktrees/[id]/git/unstage/route.js +1 -1
  191. package/.next/server/app/api/worktrees/[id]/git/unstage/route_client-reference-manifest.js +1 -1
  192. package/.next/server/app/api/worktrees/[id]/git/working-diff/route.js +1 -1
  193. package/.next/server/app/api/worktrees/[id]/git/working-diff/route_client-reference-manifest.js +1 -1
  194. package/.next/server/app/api/worktrees/[id]/instances/notes/route.js +1 -1
  195. package/.next/server/app/api/worktrees/[id]/instances/notes/route_client-reference-manifest.js +1 -1
  196. package/.next/server/app/api/worktrees/[id]/instances/opencode/route.js +1 -1
  197. package/.next/server/app/api/worktrees/[id]/instances/opencode/route.js.nft.json +1 -1
  198. package/.next/server/app/api/worktrees/[id]/instances/opencode/route_client-reference-manifest.js +1 -1
  199. package/.next/server/app/api/worktrees/[id]/instances/roles/route.js +1 -0
  200. package/.next/server/app/api/worktrees/[id]/instances/roles/route.js.nft.json +1 -0
  201. package/.next/server/app/api/worktrees/[id]/instances/roles/route_client-reference-manifest.js +1 -0
  202. package/.next/server/app/api/worktrees/[id]/instances/roles/settle/route.js +1 -0
  203. package/.next/server/app/api/worktrees/[id]/instances/roles/settle/route.js.nft.json +1 -0
  204. package/.next/server/app/api/worktrees/[id]/instances/roles/settle/route_client-reference-manifest.js +1 -0
  205. package/.next/server/app/api/worktrees/[id]/interrupt/route.js +1 -1
  206. package/.next/server/app/api/worktrees/[id]/interrupt/route.js.nft.json +1 -1
  207. package/.next/server/app/api/worktrees/[id]/interrupt/route_client-reference-manifest.js +1 -1
  208. package/.next/server/app/api/worktrees/[id]/kill-session/route.js +2 -2
  209. package/.next/server/app/api/worktrees/[id]/kill-session/route.js.nft.json +1 -1
  210. package/.next/server/app/api/worktrees/[id]/kill-session/route_client-reference-manifest.js +1 -1
  211. package/.next/server/app/api/worktrees/[id]/logs/[filename]/route_client-reference-manifest.js +1 -1
  212. package/.next/server/app/api/worktrees/[id]/logs/route_client-reference-manifest.js +1 -1
  213. package/.next/server/app/api/worktrees/[id]/marp-render/route.js +1 -1
  214. package/.next/server/app/api/worktrees/[id]/marp-render/route_client-reference-manifest.js +1 -1
  215. package/.next/server/app/api/worktrees/[id]/memos/[memoId]/route.js +1 -1
  216. package/.next/server/app/api/worktrees/[id]/memos/[memoId]/route_client-reference-manifest.js +1 -1
  217. package/.next/server/app/api/worktrees/[id]/memos/route.js +1 -1
  218. package/.next/server/app/api/worktrees/[id]/memos/route_client-reference-manifest.js +1 -1
  219. package/.next/server/app/api/worktrees/[id]/messages/route.js +1 -1
  220. package/.next/server/app/api/worktrees/[id]/messages/route_client-reference-manifest.js +1 -1
  221. package/.next/server/app/api/worktrees/[id]/opencode/diff/route_client-reference-manifest.js +1 -1
  222. package/.next/server/app/api/worktrees/[id]/opencode/session/route.js +1 -1
  223. package/.next/server/app/api/worktrees/[id]/opencode/session/route.js.nft.json +1 -1
  224. package/.next/server/app/api/worktrees/[id]/opencode/session/route_client-reference-manifest.js +1 -1
  225. package/.next/server/app/api/worktrees/[id]/opencode/share/route.js +1 -1
  226. package/.next/server/app/api/worktrees/[id]/opencode/share/route.js.nft.json +1 -1
  227. package/.next/server/app/api/worktrees/[id]/opencode/share/route_client-reference-manifest.js +1 -1
  228. package/.next/server/app/api/worktrees/[id]/prompt-response/route.js +1 -1
  229. package/.next/server/app/api/worktrees/[id]/prompt-response/route.js.nft.json +1 -1
  230. package/.next/server/app/api/worktrees/[id]/prompt-response/route_client-reference-manifest.js +1 -1
  231. package/.next/server/app/api/worktrees/[id]/prompt-response/strict/route.js +1 -1
  232. package/.next/server/app/api/worktrees/[id]/prompt-response/strict/route.js.nft.json +1 -1
  233. package/.next/server/app/api/worktrees/[id]/prompt-response/strict/route_client-reference-manifest.js +1 -1
  234. package/.next/server/app/api/worktrees/[id]/resolve-target/route.js +1 -1
  235. package/.next/server/app/api/worktrees/[id]/resolve-target/route_client-reference-manifest.js +1 -1
  236. package/.next/server/app/api/worktrees/[id]/respond/route.js +1 -1
  237. package/.next/server/app/api/worktrees/[id]/respond/route.js.nft.json +1 -1
  238. package/.next/server/app/api/worktrees/[id]/respond/route_client-reference-manifest.js +1 -1
  239. package/.next/server/app/api/worktrees/[id]/route.js +1 -1
  240. package/.next/server/app/api/worktrees/[id]/route.js.nft.json +1 -1
  241. package/.next/server/app/api/worktrees/[id]/route_client-reference-manifest.js +1 -1
  242. package/.next/server/app/api/worktrees/[id]/schedules/[scheduleId]/route.js +2 -2
  243. package/.next/server/app/api/worktrees/[id]/schedules/[scheduleId]/route.js.nft.json +1 -1
  244. package/.next/server/app/api/worktrees/[id]/schedules/[scheduleId]/route_client-reference-manifest.js +1 -1
  245. package/.next/server/app/api/worktrees/[id]/schedules/active/route.js +2 -2
  246. package/.next/server/app/api/worktrees/[id]/schedules/active/route.js.nft.json +1 -1
  247. package/.next/server/app/api/worktrees/[id]/schedules/active/route_client-reference-manifest.js +1 -1
  248. package/.next/server/app/api/worktrees/[id]/schedules/route.js +2 -2
  249. package/.next/server/app/api/worktrees/[id]/schedules/route.js.nft.json +1 -1
  250. package/.next/server/app/api/worktrees/[id]/schedules/route_client-reference-manifest.js +1 -1
  251. package/.next/server/app/api/worktrees/[id]/search/route_client-reference-manifest.js +1 -1
  252. package/.next/server/app/api/worktrees/[id]/send/route.js +1 -1
  253. package/.next/server/app/api/worktrees/[id]/send/route.js.nft.json +1 -1
  254. package/.next/server/app/api/worktrees/[id]/send/route_client-reference-manifest.js +1 -1
  255. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/git-workflow/route.js +3 -104
  256. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/git-workflow/route.js.nft.json +1 -1
  257. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/git-workflow/route_client-reference-manifest.js +1 -1
  258. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/install/route.js +1 -1
  259. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/install/route.js.nft.json +1 -1
  260. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/install/route_client-reference-manifest.js +1 -1
  261. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/plan/route.js +1 -1
  262. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/plan/route.js.nft.json +1 -1
  263. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/plan/route_client-reference-manifest.js +1 -1
  264. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/uninstall/route.js +1 -1
  265. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/uninstall/route.js.nft.json +1 -1
  266. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/uninstall/route_client-reference-manifest.js +1 -1
  267. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/uninstall-plan/route.js +1 -1
  268. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/uninstall-plan/route.js.nft.json +1 -1
  269. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/uninstall-plan/route_client-reference-manifest.js +1 -1
  270. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/update/route.js +1 -1
  271. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/update/route.js.nft.json +1 -1
  272. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/update/route_client-reference-manifest.js +1 -1
  273. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/update-plan/route.js +1 -1
  274. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/update-plan/route.js.nft.json +1 -1
  275. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/update-plan/route_client-reference-manifest.js +1 -1
  276. package/.next/server/app/api/worktrees/[id]/skills/route.js +1 -1
  277. package/.next/server/app/api/worktrees/[id]/skills/route_client-reference-manifest.js +1 -1
  278. package/.next/server/app/api/worktrees/[id]/slash-commands/route.js +1 -1
  279. package/.next/server/app/api/worktrees/[id]/slash-commands/route.js.nft.json +1 -1
  280. package/.next/server/app/api/worktrees/[id]/slash-commands/route_client-reference-manifest.js +1 -1
  281. package/.next/server/app/api/worktrees/[id]/special-keys/route.js +1 -1
  282. package/.next/server/app/api/worktrees/[id]/special-keys/route.js.nft.json +1 -1
  283. package/.next/server/app/api/worktrees/[id]/special-keys/route_client-reference-manifest.js +1 -1
  284. package/.next/server/app/api/worktrees/[id]/tasks/route.js +2 -2
  285. package/.next/server/app/api/worktrees/[id]/tasks/route.js.nft.json +1 -1
  286. package/.next/server/app/api/worktrees/[id]/tasks/route_client-reference-manifest.js +1 -1
  287. package/.next/server/app/api/worktrees/[id]/terminal/route.js +1 -103
  288. package/.next/server/app/api/worktrees/[id]/terminal/route.js.nft.json +1 -1
  289. package/.next/server/app/api/worktrees/[id]/terminal/route_client-reference-manifest.js +1 -1
  290. package/.next/server/app/api/worktrees/[id]/timers/history/route.js +1 -1
  291. package/.next/server/app/api/worktrees/[id]/timers/history/route_client-reference-manifest.js +1 -1
  292. package/.next/server/app/api/worktrees/[id]/timers/route.js +1 -1
  293. package/.next/server/app/api/worktrees/[id]/timers/route.js.nft.json +1 -1
  294. package/.next/server/app/api/worktrees/[id]/timers/route_client-reference-manifest.js +1 -1
  295. package/.next/server/app/api/worktrees/[id]/todos/[todoId]/route_client-reference-manifest.js +1 -1
  296. package/.next/server/app/api/worktrees/[id]/todos/route_client-reference-manifest.js +1 -1
  297. package/.next/server/app/api/worktrees/[id]/tree/[...path]/route_client-reference-manifest.js +1 -1
  298. package/.next/server/app/api/worktrees/[id]/tree/route_client-reference-manifest.js +1 -1
  299. package/.next/server/app/api/worktrees/[id]/upload/[...path]/route_client-reference-manifest.js +1 -1
  300. package/.next/server/app/api/worktrees/[id]/verify/config/route.js +1 -1
  301. package/.next/server/app/api/worktrees/[id]/verify/config/route_client-reference-manifest.js +1 -1
  302. package/.next/server/app/api/worktrees/[id]/verify/route.js +1 -1
  303. package/.next/server/app/api/worktrees/[id]/verify/route.js.nft.json +1 -1
  304. package/.next/server/app/api/worktrees/[id]/verify/route_client-reference-manifest.js +1 -1
  305. package/.next/server/app/api/worktrees/[id]/verify/runs/[runId]/cancel/route.js +1 -1
  306. package/.next/server/app/api/worktrees/[id]/verify/runs/[runId]/cancel/route.js.nft.json +1 -1
  307. package/.next/server/app/api/worktrees/[id]/verify/runs/[runId]/cancel/route_client-reference-manifest.js +1 -1
  308. package/.next/server/app/api/worktrees/[id]/verify/runs/[runId]/route.js +1 -1
  309. package/.next/server/app/api/worktrees/[id]/verify/runs/[runId]/route_client-reference-manifest.js +1 -1
  310. package/.next/server/app/api/worktrees/[id]/verify/runs/route.js +1 -1
  311. package/.next/server/app/api/worktrees/[id]/verify/runs/route_client-reference-manifest.js +1 -1
  312. package/.next/server/app/api/worktrees/[id]/viewed/route.js +1 -1
  313. package/.next/server/app/api/worktrees/[id]/viewed/route_client-reference-manifest.js +1 -1
  314. package/.next/server/app/api/worktrees/apply-default-agents/route_client-reference-manifest.js +1 -1
  315. package/.next/server/app/api/worktrees/route.js +1 -1
  316. package/.next/server/app/api/worktrees/route.js.nft.json +1 -1
  317. package/.next/server/app/api/worktrees/route_client-reference-manifest.js +1 -1
  318. package/.next/server/app/login/page_client-reference-manifest.js +1 -1
  319. package/.next/server/app/manifest.webmanifest/route_client-reference-manifest.js +1 -1
  320. package/.next/server/app/more/page.js +1 -1
  321. package/.next/server/app/more/page_client-reference-manifest.js +1 -1
  322. package/.next/server/app/offline/page_client-reference-manifest.js +1 -1
  323. package/.next/server/app/page_client-reference-manifest.js +1 -1
  324. package/.next/server/app/proxy/[...path]/route_client-reference-manifest.js +1 -1
  325. package/.next/server/app/repositories/page.js +2 -2
  326. package/.next/server/app/repositories/page_client-reference-manifest.js +1 -1
  327. package/.next/server/app/review/page.js +1 -1
  328. package/.next/server/app/review/page_client-reference-manifest.js +1 -1
  329. package/.next/server/app/sessions/page.js +1 -1
  330. package/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
  331. package/.next/server/app/skills/[skillId]/page_client-reference-manifest.js +1 -1
  332. package/.next/server/app/skills/installed/page_client-reference-manifest.js +1 -1
  333. package/.next/server/app/skills/page_client-reference-manifest.js +1 -1
  334. package/.next/server/app/worktrees/[id]/files/[...path]/page_client-reference-manifest.js +1 -1
  335. package/.next/server/app/worktrees/[id]/page.js +11 -11
  336. package/.next/server/app/worktrees/[id]/page_client-reference-manifest.js +1 -1
  337. package/.next/server/app/worktrees/[id]/terminal/page_client-reference-manifest.js +1 -1
  338. package/.next/server/app-paths-manifest.json +19 -13
  339. package/.next/server/chunks/1184.js +5 -0
  340. package/.next/server/chunks/1501.js +5 -5
  341. package/.next/server/chunks/1656.js +2 -2
  342. package/.next/server/chunks/1957.js +2 -2
  343. package/.next/server/chunks/1990.js +103 -0
  344. package/.next/server/chunks/2119.js +1 -1
  345. package/.next/server/chunks/2404.js +1 -1
  346. package/.next/server/chunks/2445.js +1 -1
  347. package/.next/server/chunks/2819.js +1 -0
  348. package/.next/server/chunks/2897.js +1 -1
  349. package/.next/server/chunks/3042.js +2 -0
  350. package/.next/server/chunks/3241.js +1 -1
  351. package/.next/server/chunks/3294.js +3 -0
  352. package/.next/server/chunks/3417.js +1 -1
  353. package/.next/server/chunks/3480.js +1 -1
  354. package/.next/server/chunks/3505.js +2 -6
  355. package/.next/server/chunks/3543.js +1 -1
  356. package/.next/server/chunks/3801.js +2 -2
  357. package/.next/server/chunks/3945.js +1 -1
  358. package/.next/server/chunks/4207.js +1 -1
  359. package/.next/server/chunks/454.js +1 -0
  360. package/.next/server/chunks/4645.js +1 -0
  361. package/.next/server/chunks/4911.js +1 -1
  362. package/.next/server/chunks/5350.js +6 -2
  363. package/.next/server/chunks/5354.js +1 -1
  364. package/.next/server/chunks/5571.js +1 -1
  365. package/.next/server/chunks/6009.js +12 -0
  366. package/.next/server/chunks/6130.js +1 -1
  367. package/.next/server/chunks/6285.js +1 -1
  368. package/.next/server/chunks/6401.js +1 -1
  369. package/.next/server/chunks/6486.js +2 -2
  370. package/.next/server/chunks/6569.js +1 -0
  371. package/.next/server/chunks/6781.js +1 -1
  372. package/.next/server/chunks/6793.js +4 -4
  373. package/.next/server/chunks/696.js +3 -0
  374. package/.next/server/chunks/7023.js +3 -3
  375. package/.next/server/chunks/{9702.js → 7083.js} +1 -1
  376. package/.next/server/chunks/741.js +1 -0
  377. package/.next/server/chunks/7662.js +1 -0
  378. package/.next/server/chunks/7905.js +1 -1
  379. package/.next/server/chunks/8143.js +33 -0
  380. package/.next/server/chunks/8581.js +6 -6
  381. package/.next/server/chunks/8728.js +2 -2
  382. package/.next/server/chunks/8782.js +1 -1
  383. package/.next/server/chunks/8807.js +97 -10
  384. package/.next/server/chunks/8918.js +3 -105
  385. package/.next/server/chunks/8955.js +1 -0
  386. package/.next/server/chunks/923.js +1 -0
  387. package/.next/server/chunks/9390.js +2 -2
  388. package/.next/server/chunks/9627.js +5 -5
  389. package/.next/server/chunks/973.js +1 -0
  390. package/.next/server/chunks/9731.js +3 -3
  391. package/.next/server/middleware-build-manifest.js +1 -1
  392. package/.next/server/middleware-manifest.json +5 -5
  393. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  394. package/.next/server/pages/500.html +1 -1
  395. package/.next/server/server-reference-manifest.json +1 -1
  396. package/.next/static/chunks/2314-2c9d587a27e8f731.js +1 -0
  397. package/.next/static/chunks/2407-ee881c99e218975b.js +1 -0
  398. package/.next/static/chunks/3931-24d7e245a93feb25.js +1 -0
  399. package/.next/static/chunks/4548-9afa02fd18afa6c7.js +1 -0
  400. package/.next/static/chunks/{5794-7975b8e51e731b19.js → 5794-38b3b504b3d97e04.js} +1 -1
  401. package/.next/static/chunks/{6966-d8dc6032410ffaba.js → 6966-dbfa4a43397f8c6d.js} +1 -1
  402. package/.next/static/chunks/7090-28e83f5a0efdb3b4.js +1 -0
  403. package/.next/static/chunks/7229.016d007c467a3600.js +1 -0
  404. package/.next/static/chunks/{8407-35bbfc84793d7004.js → 8407-dd6a8062fc449899.js} +1 -1
  405. package/.next/static/chunks/app/api/agents/update/route-476063c3571b81dd.js +1 -0
  406. package/.next/static/chunks/app/api/agents/versions/route-476063c3571b81dd.js +1 -0
  407. package/.next/static/chunks/app/api/app/release-notes/route-476063c3571b81dd.js +1 -0
  408. package/.next/static/chunks/app/api/app/update/route-476063c3571b81dd.js +1 -0
  409. package/.next/static/chunks/app/api/app/update-check/route-476063c3571b81dd.js +1 -0
  410. package/.next/static/chunks/app/api/auth/login/route-476063c3571b81dd.js +1 -0
  411. package/.next/static/chunks/app/api/auth/logout/route-476063c3571b81dd.js +1 -0
  412. package/.next/static/chunks/app/api/auth/status/route-476063c3571b81dd.js +1 -0
  413. package/.next/static/chunks/app/api/capabilities/route-476063c3571b81dd.js +1 -0
  414. package/.next/static/chunks/app/api/daily-summary/route-476063c3571b81dd.js +1 -0
  415. package/.next/static/chunks/app/api/daily-summary/status/route-476063c3571b81dd.js +1 -0
  416. package/.next/static/chunks/app/api/external-apps/[id]/health/route-476063c3571b81dd.js +1 -0
  417. package/.next/static/chunks/app/api/external-apps/[id]/route-476063c3571b81dd.js +1 -0
  418. package/.next/static/chunks/app/api/external-apps/route-476063c3571b81dd.js +1 -0
  419. package/.next/static/chunks/app/api/fs/browse/route-476063c3571b81dd.js +1 -0
  420. package/.next/static/chunks/app/api/fs/recent-paths/route-476063c3571b81dd.js +1 -0
  421. package/.next/static/chunks/app/api/hooks/agent-event/route-476063c3571b81dd.js +1 -0
  422. package/.next/static/chunks/app/api/hooks/claude-done/route-476063c3571b81dd.js +1 -0
  423. package/.next/static/chunks/app/api/hooks/permission-request/route-476063c3571b81dd.js +1 -0
  424. package/.next/static/chunks/app/api/metrics/vibe/route-476063c3571b81dd.js +1 -0
  425. package/.next/static/chunks/app/api/ollama/models/route-476063c3571b81dd.js +1 -0
  426. package/.next/static/chunks/app/api/push/escalation/route-476063c3571b81dd.js +1 -0
  427. package/.next/static/chunks/app/api/push/subscriptions/route-476063c3571b81dd.js +1 -0
  428. package/.next/static/chunks/app/api/push/vapid/route-476063c3571b81dd.js +1 -0
  429. package/.next/static/chunks/app/api/relays/[relayId]/cancel/route-476063c3571b81dd.js +1 -0
  430. package/.next/static/chunks/app/api/relays/[relayId]/resolve/route-476063c3571b81dd.js +1 -0
  431. package/.next/static/chunks/app/api/relays/[relayId]/route-476063c3571b81dd.js +1 -0
  432. package/.next/static/chunks/app/api/relays/route-476063c3571b81dd.js +1 -0
  433. package/.next/static/chunks/app/api/remote/pair/route-476063c3571b81dd.js +1 -0
  434. package/.next/static/chunks/app/api/repositories/[id]/role-defaults/route-476063c3571b81dd.js +1 -0
  435. package/.next/static/chunks/app/api/repositories/[id]/route-476063c3571b81dd.js +1 -0
  436. package/.next/static/chunks/app/api/repositories/clone/[jobId]/route-476063c3571b81dd.js +1 -0
  437. package/.next/static/chunks/app/api/repositories/clone/route-476063c3571b81dd.js +1 -0
  438. package/.next/static/chunks/app/api/repositories/excluded/route-476063c3571b81dd.js +1 -0
  439. package/.next/static/chunks/app/api/repositories/restore/route-476063c3571b81dd.js +1 -0
  440. package/.next/static/chunks/app/api/repositories/route-476063c3571b81dd.js +1 -0
  441. package/.next/static/chunks/app/api/repositories/scan/route-476063c3571b81dd.js +1 -0
  442. package/.next/static/chunks/app/api/repositories/sync/route-476063c3571b81dd.js +1 -0
  443. package/.next/static/chunks/app/api/repositories/validate-path/route-476063c3571b81dd.js +1 -0
  444. package/.next/static/chunks/app/api/roles/[id]/route-476063c3571b81dd.js +1 -0
  445. package/.next/static/chunks/app/api/roles/route-476063c3571b81dd.js +1 -0
  446. package/.next/static/chunks/app/api/settings/agent-role-defaults/route-476063c3571b81dd.js +1 -0
  447. package/.next/static/chunks/app/api/settings/default-agents/route-476063c3571b81dd.js +1 -0
  448. package/.next/static/chunks/app/api/settings/default-surface-mode/route-476063c3571b81dd.js +1 -0
  449. package/.next/static/chunks/app/api/sidebar/group-order/route-476063c3571b81dd.js +1 -0
  450. package/.next/static/chunks/app/api/skills/[id]/route-476063c3571b81dd.js +1 -0
  451. package/.next/static/chunks/app/api/skills/installations/route-476063c3571b81dd.js +1 -0
  452. package/.next/static/chunks/app/api/skills/operations/route-476063c3571b81dd.js +1 -0
  453. package/.next/static/chunks/app/api/skills/reindex/route-476063c3571b81dd.js +1 -0
  454. package/.next/static/chunks/app/api/skills/route-476063c3571b81dd.js +1 -0
  455. package/.next/static/chunks/app/api/slash-commands/route-476063c3571b81dd.js +1 -0
  456. package/.next/static/chunks/app/api/tasks/[taskId]/cancel/route-476063c3571b81dd.js +1 -0
  457. package/.next/static/chunks/app/api/tasks/[taskId]/route-476063c3571b81dd.js +1 -0
  458. package/.next/static/chunks/app/api/templates/[id]/route-476063c3571b81dd.js +1 -0
  459. package/.next/static/chunks/app/api/templates/route-476063c3571b81dd.js +1 -0
  460. package/.next/static/chunks/app/api/verification/runs/[runId]/route-476063c3571b81dd.js +1 -0
  461. package/.next/static/chunks/app/api/verification/runs/route-476063c3571b81dd.js +1 -0
  462. package/.next/static/chunks/app/api/worktrees/[id]/auto-yes/route-476063c3571b81dd.js +1 -0
  463. package/.next/static/chunks/app/api/worktrees/[id]/capture/route-476063c3571b81dd.js +1 -0
  464. package/.next/static/chunks/app/api/worktrees/[id]/clear-composer/route-476063c3571b81dd.js +1 -0
  465. package/.next/static/chunks/app/api/worktrees/[id]/cli-reference/route-476063c3571b81dd.js +1 -0
  466. package/.next/static/chunks/app/api/worktrees/[id]/cli-tool/route-476063c3571b81dd.js +1 -0
  467. package/.next/static/chunks/app/api/worktrees/[id]/cmate/schedules/route-476063c3571b81dd.js +1 -0
  468. package/.next/static/chunks/app/api/worktrees/[id]/current-output/route-476063c3571b81dd.js +1 -0
  469. package/.next/static/chunks/app/api/worktrees/[id]/direct-input/route-476063c3571b81dd.js +1 -0
  470. package/.next/static/chunks/app/api/worktrees/[id]/env/route-476063c3571b81dd.js +1 -0
  471. package/.next/static/chunks/app/api/worktrees/[id]/execution-logs/[logId]/route-476063c3571b81dd.js +1 -0
  472. package/.next/static/chunks/app/api/worktrees/[id]/execution-logs/route-476063c3571b81dd.js +1 -0
  473. package/.next/static/chunks/app/api/worktrees/[id]/files/[...path]/route-476063c3571b81dd.js +1 -0
  474. package/.next/static/chunks/app/api/worktrees/[id]/git/branch/create/route-476063c3571b81dd.js +1 -0
  475. package/.next/static/chunks/app/api/worktrees/[id]/git/branch/delete/route-476063c3571b81dd.js +1 -0
  476. package/.next/static/chunks/app/api/worktrees/[id]/git/branches/route-476063c3571b81dd.js +1 -0
  477. package/.next/static/chunks/app/api/worktrees/[id]/git/checkout/route-476063c3571b81dd.js +1 -0
  478. package/.next/static/chunks/app/api/worktrees/[id]/git/commit/route-476063c3571b81dd.js +1 -0
  479. package/.next/static/chunks/app/api/worktrees/[id]/git/diff/route-476063c3571b81dd.js +1 -0
  480. package/.next/static/chunks/app/api/worktrees/[id]/git/fetch/route-476063c3571b81dd.js +1 -0
  481. package/.next/static/chunks/app/api/worktrees/[id]/git/log/route-476063c3571b81dd.js +1 -0
  482. package/.next/static/chunks/app/api/worktrees/[id]/git/pull/route-476063c3571b81dd.js +1 -0
  483. package/.next/static/chunks/app/api/worktrees/[id]/git/push/route-476063c3571b81dd.js +1 -0
  484. package/.next/static/chunks/app/api/worktrees/[id]/git/reset/route-476063c3571b81dd.js +1 -0
  485. package/.next/static/chunks/app/api/worktrees/[id]/git/revert/route-476063c3571b81dd.js +1 -0
  486. package/.next/static/chunks/app/api/worktrees/[id]/git/show/[commitHash]/route-476063c3571b81dd.js +1 -0
  487. package/.next/static/chunks/app/api/worktrees/[id]/git/stage/route-476063c3571b81dd.js +1 -0
  488. package/.next/static/chunks/app/api/worktrees/[id]/git/staged/route-476063c3571b81dd.js +1 -0
  489. package/.next/static/chunks/app/api/worktrees/[id]/git/stash/[index]/route-476063c3571b81dd.js +1 -0
  490. package/.next/static/chunks/app/api/worktrees/[id]/git/stash/apply/route-476063c3571b81dd.js +1 -0
  491. package/.next/static/chunks/app/api/worktrees/[id]/git/stash/pop/route-476063c3571b81dd.js +1 -0
  492. package/.next/static/chunks/app/api/worktrees/[id]/git/stash/push/route-476063c3571b81dd.js +1 -0
  493. package/.next/static/chunks/app/api/worktrees/[id]/git/stash/route-476063c3571b81dd.js +1 -0
  494. package/.next/static/chunks/app/api/worktrees/[id]/git/status/route-476063c3571b81dd.js +1 -0
  495. package/.next/static/chunks/app/api/worktrees/[id]/git/unstage/route-476063c3571b81dd.js +1 -0
  496. package/.next/static/chunks/app/api/worktrees/[id]/git/working-diff/route-476063c3571b81dd.js +1 -0
  497. package/.next/static/chunks/app/api/worktrees/[id]/instances/notes/route-476063c3571b81dd.js +1 -0
  498. package/.next/static/chunks/app/api/worktrees/[id]/instances/opencode/route-476063c3571b81dd.js +1 -0
  499. package/.next/static/chunks/app/api/worktrees/[id]/instances/roles/route-476063c3571b81dd.js +1 -0
  500. package/.next/static/chunks/app/api/worktrees/[id]/instances/roles/settle/route-476063c3571b81dd.js +1 -0
  501. package/.next/static/chunks/app/api/worktrees/[id]/interrupt/route-476063c3571b81dd.js +1 -0
  502. package/.next/static/chunks/app/api/worktrees/[id]/kill-session/route-476063c3571b81dd.js +1 -0
  503. package/.next/static/chunks/app/api/worktrees/[id]/logs/[filename]/route-476063c3571b81dd.js +1 -0
  504. package/.next/static/chunks/app/api/worktrees/[id]/logs/route-476063c3571b81dd.js +1 -0
  505. package/.next/static/chunks/app/api/worktrees/[id]/marp-render/route-476063c3571b81dd.js +1 -0
  506. package/.next/static/chunks/app/api/worktrees/[id]/memos/[memoId]/route-476063c3571b81dd.js +1 -0
  507. package/.next/static/chunks/app/api/worktrees/[id]/memos/route-476063c3571b81dd.js +1 -0
  508. package/.next/static/chunks/app/api/worktrees/[id]/messages/route-476063c3571b81dd.js +1 -0
  509. package/.next/static/chunks/app/api/worktrees/[id]/opencode/diff/route-476063c3571b81dd.js +1 -0
  510. package/.next/static/chunks/app/api/worktrees/[id]/opencode/session/route-476063c3571b81dd.js +1 -0
  511. package/.next/static/chunks/app/api/worktrees/[id]/opencode/share/route-476063c3571b81dd.js +1 -0
  512. package/.next/static/chunks/app/api/worktrees/[id]/prompt-response/route-476063c3571b81dd.js +1 -0
  513. package/.next/static/chunks/app/api/worktrees/[id]/prompt-response/strict/route-476063c3571b81dd.js +1 -0
  514. package/.next/static/chunks/app/api/worktrees/[id]/resolve-target/route-476063c3571b81dd.js +1 -0
  515. package/.next/static/chunks/app/api/worktrees/[id]/respond/route-476063c3571b81dd.js +1 -0
  516. package/.next/static/chunks/app/api/worktrees/[id]/route-476063c3571b81dd.js +1 -0
  517. package/.next/static/chunks/app/api/worktrees/[id]/schedules/[scheduleId]/route-476063c3571b81dd.js +1 -0
  518. package/.next/static/chunks/app/api/worktrees/[id]/schedules/active/route-476063c3571b81dd.js +1 -0
  519. package/.next/static/chunks/app/api/worktrees/[id]/schedules/route-476063c3571b81dd.js +1 -0
  520. package/.next/static/chunks/app/api/worktrees/[id]/search/route-476063c3571b81dd.js +1 -0
  521. package/.next/static/chunks/app/api/worktrees/[id]/send/route-476063c3571b81dd.js +1 -0
  522. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/git-workflow/route-476063c3571b81dd.js +1 -0
  523. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/install/route-476063c3571b81dd.js +1 -0
  524. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/plan/route-476063c3571b81dd.js +1 -0
  525. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/uninstall/route-476063c3571b81dd.js +1 -0
  526. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/uninstall-plan/route-476063c3571b81dd.js +1 -0
  527. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/update/route-476063c3571b81dd.js +1 -0
  528. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/update-plan/route-476063c3571b81dd.js +1 -0
  529. package/.next/static/chunks/app/api/worktrees/[id]/skills/route-476063c3571b81dd.js +1 -0
  530. package/.next/static/chunks/app/api/worktrees/[id]/slash-commands/route-476063c3571b81dd.js +1 -0
  531. package/.next/static/chunks/app/api/worktrees/[id]/special-keys/route-476063c3571b81dd.js +1 -0
  532. package/.next/static/chunks/app/api/worktrees/[id]/tasks/route-476063c3571b81dd.js +1 -0
  533. package/.next/static/chunks/app/api/worktrees/[id]/terminal/route-476063c3571b81dd.js +1 -0
  534. package/.next/static/chunks/app/api/worktrees/[id]/timers/history/route-476063c3571b81dd.js +1 -0
  535. package/.next/static/chunks/app/api/worktrees/[id]/timers/route-476063c3571b81dd.js +1 -0
  536. package/.next/static/chunks/app/api/worktrees/[id]/todos/[todoId]/route-476063c3571b81dd.js +1 -0
  537. package/.next/static/chunks/app/api/worktrees/[id]/todos/route-476063c3571b81dd.js +1 -0
  538. package/.next/static/chunks/app/api/worktrees/[id]/tree/[...path]/route-476063c3571b81dd.js +1 -0
  539. package/.next/static/chunks/app/api/worktrees/[id]/tree/route-476063c3571b81dd.js +1 -0
  540. package/.next/static/chunks/app/api/worktrees/[id]/upload/[...path]/route-476063c3571b81dd.js +1 -0
  541. package/.next/static/chunks/app/api/worktrees/[id]/verify/config/route-476063c3571b81dd.js +1 -0
  542. package/.next/static/chunks/app/api/worktrees/[id]/verify/route-476063c3571b81dd.js +1 -0
  543. package/.next/static/chunks/app/api/worktrees/[id]/verify/runs/[runId]/cancel/route-476063c3571b81dd.js +1 -0
  544. package/.next/static/chunks/app/api/worktrees/[id]/verify/runs/[runId]/route-476063c3571b81dd.js +1 -0
  545. package/.next/static/chunks/app/api/worktrees/[id]/verify/runs/route-476063c3571b81dd.js +1 -0
  546. package/.next/static/chunks/app/api/worktrees/[id]/viewed/route-476063c3571b81dd.js +1 -0
  547. package/.next/static/chunks/app/api/worktrees/apply-default-agents/route-476063c3571b81dd.js +1 -0
  548. package/.next/static/chunks/app/api/worktrees/route-476063c3571b81dd.js +1 -0
  549. package/.next/static/chunks/app/layout-7bf800fcc5e025b1.js +1 -0
  550. package/.next/static/chunks/app/manifest.webmanifest/route-476063c3571b81dd.js +1 -0
  551. package/.next/static/chunks/app/more/{page-ff5af5ca48774c89.js → page-e8f5780f6e4fb657.js} +1 -1
  552. package/.next/static/chunks/app/{page-b4863bfe0452e09d.js → page-869f353a4ac4e15b.js} +1 -1
  553. package/.next/static/chunks/app/proxy/[...path]/route-476063c3571b81dd.js +1 -0
  554. package/.next/static/chunks/app/repositories/page-bedb505687010f18.js +1 -0
  555. package/.next/static/chunks/app/review/page-87c4a9b0de50fa80.js +1 -0
  556. package/.next/static/chunks/app/sessions/{page-c6eb7c02db2f4c80.js → page-82ca46793789fce4.js} +1 -1
  557. package/.next/static/chunks/app/worktrees/[id]/layout-476063c3571b81dd.js +1 -0
  558. package/.next/static/chunks/app/worktrees/[id]/page-570eb79fbbd1a934.js +1 -0
  559. package/.next/static/chunks/{webpack-838df0273b03af19.js → webpack-16b1a3143fa42ca0.js} +1 -1
  560. package/.next/static/css/d4f2c9522cf1b449.css +1 -0
  561. package/.next/static/z4d8-5MaLkoD-4EhueZwk/_buildManifest.js +1 -0
  562. package/.next/trace +14 -13
  563. package/.next/types/app/api/repositories/[id]/role-defaults/route.ts +347 -0
  564. package/.next/types/app/api/roles/[id]/route.ts +347 -0
  565. package/.next/types/app/api/roles/route.ts +347 -0
  566. package/.next/types/app/api/settings/agent-role-defaults/route.ts +347 -0
  567. package/.next/types/app/api/worktrees/[id]/instances/roles/route.ts +347 -0
  568. package/.next/types/app/api/worktrees/[id]/instances/roles/settle/route.ts +347 -0
  569. package/.next/types/routes.d.ts +7 -1
  570. package/.next/types/validator.ts +54 -0
  571. package/dist/cli/commands/instances.d.ts +1 -0
  572. package/dist/cli/commands/instances.d.ts.map +1 -1
  573. package/dist/cli/commands/instances.js +290 -33
  574. package/dist/cli/commands/message-dispatch.d.ts +25 -3
  575. package/dist/cli/commands/message-dispatch.d.ts.map +1 -1
  576. package/dist/cli/commands/message-dispatch.js +26 -6
  577. package/dist/cli/commands/relays.d.ts +5 -0
  578. package/dist/cli/commands/relays.d.ts.map +1 -1
  579. package/dist/cli/commands/relays.js +37 -1
  580. package/dist/cli/commands/roles.d.ts +11 -0
  581. package/dist/cli/commands/roles.d.ts.map +1 -0
  582. package/dist/cli/commands/roles.js +392 -0
  583. package/dist/cli/commands/send.d.ts.map +1 -1
  584. package/dist/cli/commands/send.js +526 -38
  585. package/dist/cli/docs/agent-operations.d.ts +1 -1
  586. package/dist/cli/docs/agent-operations.d.ts.map +1 -1
  587. package/dist/cli/docs/agent-operations.js +91 -3
  588. package/dist/cli/index.d.ts +4 -0
  589. package/dist/cli/index.d.ts.map +1 -1
  590. package/dist/cli/index.js +6 -0
  591. package/dist/cli/types/api-responses.d.ts +54 -0
  592. package/dist/cli/types/api-responses.d.ts.map +1 -1
  593. package/dist/cli/types/index.d.ts +38 -0
  594. package/dist/cli/types/index.d.ts.map +1 -1
  595. package/dist/cli/types/index.js +15 -1
  596. package/dist/cli/utils/agent-instances.d.ts +29 -1
  597. package/dist/cli/utils/agent-instances.d.ts.map +1 -1
  598. package/dist/cli/utils/agent-instances.js +67 -7
  599. package/dist/cli/utils/agent-roles.d.ts +75 -0
  600. package/dist/cli/utils/agent-roles.d.ts.map +1 -0
  601. package/dist/cli/utils/agent-roles.js +238 -0
  602. package/dist/cli/utils/api-client-errors.d.ts +23 -1
  603. package/dist/cli/utils/api-client-errors.d.ts.map +1 -1
  604. package/dist/cli/utils/api-client-errors.js +14 -2
  605. package/dist/cli/utils/api-client.d.ts +8 -0
  606. package/dist/cli/utils/api-client.d.ts.map +1 -1
  607. package/dist/cli/utils/api-client.js +13 -1
  608. package/dist/cli/utils/role-failure.d.ts +31 -0
  609. package/dist/cli/utils/role-failure.d.ts.map +1 -0
  610. package/dist/cli/utils/role-failure.js +90 -0
  611. package/dist/cli/utils/role-input.d.ts +16 -0
  612. package/dist/cli/utils/role-input.d.ts.map +1 -0
  613. package/dist/cli/utils/role-input.js +78 -0
  614. package/dist/cli/utils/security-logger.d.ts +17 -0
  615. package/dist/cli/utils/security-logger.d.ts.map +1 -1
  616. package/dist/cli/utils/security-logger.js +44 -5
  617. package/dist/lib/detection/tools/verified-against.d.ts +16 -0
  618. package/dist/lib/detection/tools/verified-against.d.ts.map +1 -1
  619. package/dist/lib/detection/tools/verified-against.js +16 -0
  620. package/dist/lib/session/send-attempt-types.d.ts +4 -0
  621. package/dist/lib/session/send-attempt-types.d.ts.map +1 -1
  622. package/dist/lib/verification/verify-config.d.ts +22 -0
  623. package/dist/lib/verification/verify-config.d.ts.map +1 -1
  624. package/dist/lib/verification/verify-config.js +32 -2
  625. package/dist/server/locales/en/worktree.json +25 -6
  626. package/dist/server/locales/ja/worktree.json +25 -6
  627. package/dist/server/src/config/safe-directory.js +30 -0
  628. package/dist/server/src/lib/agent-roles/adapters.js +174 -0
  629. package/dist/server/src/lib/agent-roles/artifacts.js +638 -0
  630. package/dist/server/src/lib/agent-roles/composition.js +222 -0
  631. package/dist/server/src/lib/agent-roles/fingerprint.js +21 -0
  632. package/dist/server/src/lib/agent-roles/jsonc.js +85 -0
  633. package/dist/server/src/lib/agent-roles/launch-errors.js +58 -0
  634. package/dist/server/src/lib/agent-roles/pane-env.js +63 -0
  635. package/dist/server/src/lib/agent-roles/resolve.js +375 -0
  636. package/dist/server/src/lib/agent-roles/toml-basic.js +140 -0
  637. package/dist/server/src/lib/agent-roles/unicode.js +16 -0
  638. package/dist/server/src/lib/agent-roles/validation.js +61 -0
  639. package/dist/server/src/lib/cli-tools/antigravity.js +39 -6
  640. package/dist/server/src/lib/cli-tools/base.js +63 -5
  641. package/dist/server/src/lib/cli-tools/claude-auto-default-nudge.js +141 -0
  642. package/dist/server/src/lib/cli-tools/claude.js +7 -1
  643. package/dist/server/src/lib/cli-tools/codex.js +134 -21
  644. package/dist/server/src/lib/cli-tools/command-code.js +24 -1
  645. package/dist/server/src/lib/cli-tools/copilot.js +36 -7
  646. package/dist/server/src/lib/cli-tools/gemini.js +37 -3
  647. package/dist/server/src/lib/cli-tools/launch-answer-skips.js +76 -0
  648. package/dist/server/src/lib/cli-tools/opencode-v2.js +10 -0
  649. package/dist/server/src/lib/cli-tools/opencode.js +58 -7
  650. package/dist/server/src/lib/cli-tools/submit-composer-read.js +24 -4
  651. package/dist/server/src/lib/cli-tools/vibe-local.js +25 -1
  652. package/dist/server/src/lib/db/agent-instances-db.js +53 -0
  653. package/dist/server/src/lib/db/agent-roles-db.js +409 -0
  654. package/dist/server/src/lib/db/agent-session-cost-sampler.js +3 -2
  655. package/dist/server/src/lib/db/db-instance.js +7 -37
  656. package/dist/server/src/lib/db/migrations/index.js +4 -0
  657. package/dist/server/src/lib/db/migrations/runner.js +1 -1
  658. package/dist/server/src/lib/db/migrations/v64-agent-roles.js +123 -0
  659. package/dist/server/src/lib/db/migrations/v65-agent-instance-creation-keys.js +42 -0
  660. package/dist/server/src/lib/db/relay-db.js +35 -0
  661. package/dist/server/src/lib/detection/cli-patterns.js +13 -3
  662. package/dist/server/src/lib/detection/model-info-extractor.js +1 -1
  663. package/dist/server/src/lib/detection/tools/claude/patterns.js +76 -0
  664. package/dist/server/src/lib/detection/tools/codex/cli-patterns.js +5 -0
  665. package/dist/server/src/lib/detection/tools/codex/detect.js +5 -1
  666. package/dist/server/src/lib/detection/tools/codex/patterns.js +52 -2
  667. package/dist/server/src/lib/detection/tools/codex/prompt.js +23 -3
  668. package/dist/server/src/lib/detection/tools/opencode/detect.js +30 -15
  669. package/dist/server/src/lib/detection/tools/opencode/patterns.js +268 -7
  670. package/dist/server/src/lib/detection/tools/opencode/readiness.js +16 -7
  671. package/dist/server/src/lib/detection/tools/opencode-v2/detect.js +51 -15
  672. package/dist/server/src/lib/detection/tools/opencode-v2/patterns.js +195 -11
  673. package/dist/server/src/lib/detection/tools/run-detection.js +5 -2
  674. package/dist/server/src/lib/detection/tools/verified-against.js +16 -0
  675. package/dist/server/src/lib/detection/tools/vibe-local/readiness.js +22 -0
  676. package/dist/server/src/lib/git/git-common-dir.js +192 -0
  677. package/dist/server/src/lib/hooks/hook-settings-generator.js +8 -2
  678. package/dist/server/src/lib/hooks/sources/copilot/hook-settings.js +31 -1
  679. package/dist/server/src/lib/hooks/sources/launch-command.js +31 -8
  680. package/dist/server/src/lib/hooks/sources/opencode/client.js +20 -0
  681. package/dist/server/src/lib/hooks/sources/opencode-v2/client.js +24 -0
  682. package/dist/server/src/lib/hooks/sources/opencode-v2/history.js +208 -35
  683. package/dist/server/src/lib/hooks/sources/opencode-v2/secrets.js +7 -1
  684. package/dist/server/src/lib/hooks/sources/opencode-v2/subscription.js +117 -2
  685. package/dist/server/src/lib/job-executor.js +18 -1
  686. package/dist/server/src/lib/polling/response-checker-extraction-steps.js +58 -4
  687. package/dist/server/src/lib/polling/response-checker.js +32 -7
  688. package/dist/server/src/lib/relay/relay-delivery-block.js +150 -0
  689. package/dist/server/src/lib/relay/relay-delivery.js +59 -2
  690. package/dist/server/src/lib/response-cleaner.js +13 -3
  691. package/dist/server/src/lib/response-extractor.js +38 -3
  692. package/dist/server/src/lib/session/agent-session-lifecycle.js +9 -1
  693. package/dist/server/src/lib/session/claude-executor.js +13 -1
  694. package/dist/server/src/lib/session/claude-session.js +109 -13
  695. package/dist/server/src/lib/session/instance-input-lock.js +93 -4
  696. package/dist/server/src/lib/session/role-launch.js +722 -0
  697. package/dist/server/src/lib/session/send-attempt-state.js +7 -0
  698. package/dist/server/src/lib/session/send-user-message.js +6 -0
  699. package/dist/server/src/lib/session/session-generation-archive.js +7 -8
  700. package/dist/server/src/lib/session/session-launch-flight.js +33 -1
  701. package/dist/server/src/lib/session/worktree-session-reconcile.js +5 -0
  702. package/dist/server/src/lib/test-run-detection.js +53 -0
  703. package/dist/server/src/lib/tmux/read-mode.js +4 -0
  704. package/dist/server/src/lib/tmux/session-hook-scripts.js +36 -4
  705. package/dist/server/src/lib/tui-accumulator.js +14 -5
  706. package/dist/server/src/lib/verification/env-clean-gate.js +117 -12
  707. package/dist/server/src/lib/verification/gate-runner.js +9 -8
  708. package/dist/server/src/lib/verification/verify-config.js +32 -2
  709. package/dist/server/src/types/agent-roles.js +56 -0
  710. package/dist/types/agent-roles.d.ts +351 -0
  711. package/dist/types/agent-roles.d.ts.map +1 -0
  712. package/dist/types/agent-roles.js +56 -0
  713. package/docs/en/user-guide/webapp-guide.md +16 -0
  714. package/package.json +2 -1
  715. package/release-notes/0.50.0.json +113 -0
  716. package/.next/server/chunks/1308.js +0 -1
  717. package/.next/server/chunks/4490.js +0 -1
  718. package/.next/server/chunks/4936.js +0 -1
  719. package/.next/server/chunks/610.js +0 -1
  720. package/.next/server/chunks/6119.js +0 -1
  721. package/.next/server/chunks/7491.js +0 -3
  722. package/.next/server/chunks/7926.js +0 -1
  723. package/.next/server/chunks/9360.js +0 -2
  724. package/.next/server/chunks/9584.js +0 -1
  725. package/.next/static/LNfVZiq6FZwKsV7L9Mi6M/_buildManifest.js +0 -1
  726. package/.next/static/chunks/2407-87ec01332344ec2b.js +0 -1
  727. package/.next/static/chunks/344-e1cefd00787060e4.js +0 -1
  728. package/.next/static/chunks/3931-3ef48b8d97357282.js +0 -1
  729. package/.next/static/chunks/7229.7f0f5a7032b612b4.js +0 -1
  730. package/.next/static/chunks/8165-263172c17ae8e8c3.js +0 -1
  731. package/.next/static/chunks/app/api/agents/update/route-96fc12d400b49b13.js +0 -1
  732. package/.next/static/chunks/app/api/agents/versions/route-96fc12d400b49b13.js +0 -1
  733. package/.next/static/chunks/app/api/app/release-notes/route-96fc12d400b49b13.js +0 -1
  734. package/.next/static/chunks/app/api/app/update/route-96fc12d400b49b13.js +0 -1
  735. package/.next/static/chunks/app/api/app/update-check/route-96fc12d400b49b13.js +0 -1
  736. package/.next/static/chunks/app/api/auth/login/route-96fc12d400b49b13.js +0 -1
  737. package/.next/static/chunks/app/api/auth/logout/route-96fc12d400b49b13.js +0 -1
  738. package/.next/static/chunks/app/api/auth/status/route-96fc12d400b49b13.js +0 -1
  739. package/.next/static/chunks/app/api/capabilities/route-96fc12d400b49b13.js +0 -1
  740. package/.next/static/chunks/app/api/daily-summary/route-96fc12d400b49b13.js +0 -1
  741. package/.next/static/chunks/app/api/daily-summary/status/route-96fc12d400b49b13.js +0 -1
  742. package/.next/static/chunks/app/api/external-apps/[id]/health/route-96fc12d400b49b13.js +0 -1
  743. package/.next/static/chunks/app/api/external-apps/[id]/route-96fc12d400b49b13.js +0 -1
  744. package/.next/static/chunks/app/api/external-apps/route-96fc12d400b49b13.js +0 -1
  745. package/.next/static/chunks/app/api/fs/browse/route-96fc12d400b49b13.js +0 -1
  746. package/.next/static/chunks/app/api/fs/recent-paths/route-96fc12d400b49b13.js +0 -1
  747. package/.next/static/chunks/app/api/hooks/agent-event/route-96fc12d400b49b13.js +0 -1
  748. package/.next/static/chunks/app/api/hooks/claude-done/route-96fc12d400b49b13.js +0 -1
  749. package/.next/static/chunks/app/api/hooks/permission-request/route-96fc12d400b49b13.js +0 -1
  750. package/.next/static/chunks/app/api/metrics/vibe/route-96fc12d400b49b13.js +0 -1
  751. package/.next/static/chunks/app/api/ollama/models/route-96fc12d400b49b13.js +0 -1
  752. package/.next/static/chunks/app/api/push/escalation/route-96fc12d400b49b13.js +0 -1
  753. package/.next/static/chunks/app/api/push/subscriptions/route-96fc12d400b49b13.js +0 -1
  754. package/.next/static/chunks/app/api/push/vapid/route-96fc12d400b49b13.js +0 -1
  755. package/.next/static/chunks/app/api/relays/[relayId]/cancel/route-96fc12d400b49b13.js +0 -1
  756. package/.next/static/chunks/app/api/relays/[relayId]/resolve/route-96fc12d400b49b13.js +0 -1
  757. package/.next/static/chunks/app/api/relays/[relayId]/route-96fc12d400b49b13.js +0 -1
  758. package/.next/static/chunks/app/api/relays/route-96fc12d400b49b13.js +0 -1
  759. package/.next/static/chunks/app/api/remote/pair/route-96fc12d400b49b13.js +0 -1
  760. package/.next/static/chunks/app/api/repositories/[id]/route-96fc12d400b49b13.js +0 -1
  761. package/.next/static/chunks/app/api/repositories/clone/[jobId]/route-96fc12d400b49b13.js +0 -1
  762. package/.next/static/chunks/app/api/repositories/clone/route-96fc12d400b49b13.js +0 -1
  763. package/.next/static/chunks/app/api/repositories/excluded/route-96fc12d400b49b13.js +0 -1
  764. package/.next/static/chunks/app/api/repositories/restore/route-96fc12d400b49b13.js +0 -1
  765. package/.next/static/chunks/app/api/repositories/route-96fc12d400b49b13.js +0 -1
  766. package/.next/static/chunks/app/api/repositories/scan/route-96fc12d400b49b13.js +0 -1
  767. package/.next/static/chunks/app/api/repositories/sync/route-96fc12d400b49b13.js +0 -1
  768. package/.next/static/chunks/app/api/repositories/validate-path/route-96fc12d400b49b13.js +0 -1
  769. package/.next/static/chunks/app/api/settings/default-agents/route-96fc12d400b49b13.js +0 -1
  770. package/.next/static/chunks/app/api/settings/default-surface-mode/route-96fc12d400b49b13.js +0 -1
  771. package/.next/static/chunks/app/api/sidebar/group-order/route-96fc12d400b49b13.js +0 -1
  772. package/.next/static/chunks/app/api/skills/[id]/route-96fc12d400b49b13.js +0 -1
  773. package/.next/static/chunks/app/api/skills/installations/route-96fc12d400b49b13.js +0 -1
  774. package/.next/static/chunks/app/api/skills/operations/route-96fc12d400b49b13.js +0 -1
  775. package/.next/static/chunks/app/api/skills/reindex/route-96fc12d400b49b13.js +0 -1
  776. package/.next/static/chunks/app/api/skills/route-96fc12d400b49b13.js +0 -1
  777. package/.next/static/chunks/app/api/slash-commands/route-96fc12d400b49b13.js +0 -1
  778. package/.next/static/chunks/app/api/tasks/[taskId]/cancel/route-96fc12d400b49b13.js +0 -1
  779. package/.next/static/chunks/app/api/tasks/[taskId]/route-96fc12d400b49b13.js +0 -1
  780. package/.next/static/chunks/app/api/templates/[id]/route-96fc12d400b49b13.js +0 -1
  781. package/.next/static/chunks/app/api/templates/route-96fc12d400b49b13.js +0 -1
  782. package/.next/static/chunks/app/api/verification/runs/[runId]/route-96fc12d400b49b13.js +0 -1
  783. package/.next/static/chunks/app/api/verification/runs/route-96fc12d400b49b13.js +0 -1
  784. package/.next/static/chunks/app/api/worktrees/[id]/auto-yes/route-96fc12d400b49b13.js +0 -1
  785. package/.next/static/chunks/app/api/worktrees/[id]/capture/route-96fc12d400b49b13.js +0 -1
  786. package/.next/static/chunks/app/api/worktrees/[id]/clear-composer/route-96fc12d400b49b13.js +0 -1
  787. package/.next/static/chunks/app/api/worktrees/[id]/cli-reference/route-96fc12d400b49b13.js +0 -1
  788. package/.next/static/chunks/app/api/worktrees/[id]/cli-tool/route-96fc12d400b49b13.js +0 -1
  789. package/.next/static/chunks/app/api/worktrees/[id]/cmate/schedules/route-96fc12d400b49b13.js +0 -1
  790. package/.next/static/chunks/app/api/worktrees/[id]/current-output/route-96fc12d400b49b13.js +0 -1
  791. package/.next/static/chunks/app/api/worktrees/[id]/direct-input/route-96fc12d400b49b13.js +0 -1
  792. package/.next/static/chunks/app/api/worktrees/[id]/env/route-96fc12d400b49b13.js +0 -1
  793. package/.next/static/chunks/app/api/worktrees/[id]/execution-logs/[logId]/route-96fc12d400b49b13.js +0 -1
  794. package/.next/static/chunks/app/api/worktrees/[id]/execution-logs/route-96fc12d400b49b13.js +0 -1
  795. package/.next/static/chunks/app/api/worktrees/[id]/files/[...path]/route-96fc12d400b49b13.js +0 -1
  796. package/.next/static/chunks/app/api/worktrees/[id]/git/branch/create/route-96fc12d400b49b13.js +0 -1
  797. package/.next/static/chunks/app/api/worktrees/[id]/git/branch/delete/route-96fc12d400b49b13.js +0 -1
  798. package/.next/static/chunks/app/api/worktrees/[id]/git/branches/route-96fc12d400b49b13.js +0 -1
  799. package/.next/static/chunks/app/api/worktrees/[id]/git/checkout/route-96fc12d400b49b13.js +0 -1
  800. package/.next/static/chunks/app/api/worktrees/[id]/git/commit/route-96fc12d400b49b13.js +0 -1
  801. package/.next/static/chunks/app/api/worktrees/[id]/git/diff/route-96fc12d400b49b13.js +0 -1
  802. package/.next/static/chunks/app/api/worktrees/[id]/git/fetch/route-96fc12d400b49b13.js +0 -1
  803. package/.next/static/chunks/app/api/worktrees/[id]/git/log/route-96fc12d400b49b13.js +0 -1
  804. package/.next/static/chunks/app/api/worktrees/[id]/git/pull/route-96fc12d400b49b13.js +0 -1
  805. package/.next/static/chunks/app/api/worktrees/[id]/git/push/route-96fc12d400b49b13.js +0 -1
  806. package/.next/static/chunks/app/api/worktrees/[id]/git/reset/route-96fc12d400b49b13.js +0 -1
  807. package/.next/static/chunks/app/api/worktrees/[id]/git/revert/route-96fc12d400b49b13.js +0 -1
  808. package/.next/static/chunks/app/api/worktrees/[id]/git/show/[commitHash]/route-96fc12d400b49b13.js +0 -1
  809. package/.next/static/chunks/app/api/worktrees/[id]/git/stage/route-96fc12d400b49b13.js +0 -1
  810. package/.next/static/chunks/app/api/worktrees/[id]/git/staged/route-96fc12d400b49b13.js +0 -1
  811. package/.next/static/chunks/app/api/worktrees/[id]/git/stash/[index]/route-96fc12d400b49b13.js +0 -1
  812. package/.next/static/chunks/app/api/worktrees/[id]/git/stash/apply/route-96fc12d400b49b13.js +0 -1
  813. package/.next/static/chunks/app/api/worktrees/[id]/git/stash/pop/route-96fc12d400b49b13.js +0 -1
  814. package/.next/static/chunks/app/api/worktrees/[id]/git/stash/push/route-96fc12d400b49b13.js +0 -1
  815. package/.next/static/chunks/app/api/worktrees/[id]/git/stash/route-96fc12d400b49b13.js +0 -1
  816. package/.next/static/chunks/app/api/worktrees/[id]/git/status/route-96fc12d400b49b13.js +0 -1
  817. package/.next/static/chunks/app/api/worktrees/[id]/git/unstage/route-96fc12d400b49b13.js +0 -1
  818. package/.next/static/chunks/app/api/worktrees/[id]/git/working-diff/route-96fc12d400b49b13.js +0 -1
  819. package/.next/static/chunks/app/api/worktrees/[id]/instances/notes/route-96fc12d400b49b13.js +0 -1
  820. package/.next/static/chunks/app/api/worktrees/[id]/instances/opencode/route-96fc12d400b49b13.js +0 -1
  821. package/.next/static/chunks/app/api/worktrees/[id]/interrupt/route-96fc12d400b49b13.js +0 -1
  822. package/.next/static/chunks/app/api/worktrees/[id]/kill-session/route-96fc12d400b49b13.js +0 -1
  823. package/.next/static/chunks/app/api/worktrees/[id]/logs/[filename]/route-96fc12d400b49b13.js +0 -1
  824. package/.next/static/chunks/app/api/worktrees/[id]/logs/route-96fc12d400b49b13.js +0 -1
  825. package/.next/static/chunks/app/api/worktrees/[id]/marp-render/route-96fc12d400b49b13.js +0 -1
  826. package/.next/static/chunks/app/api/worktrees/[id]/memos/[memoId]/route-96fc12d400b49b13.js +0 -1
  827. package/.next/static/chunks/app/api/worktrees/[id]/memos/route-96fc12d400b49b13.js +0 -1
  828. package/.next/static/chunks/app/api/worktrees/[id]/messages/route-96fc12d400b49b13.js +0 -1
  829. package/.next/static/chunks/app/api/worktrees/[id]/opencode/diff/route-96fc12d400b49b13.js +0 -1
  830. package/.next/static/chunks/app/api/worktrees/[id]/opencode/session/route-96fc12d400b49b13.js +0 -1
  831. package/.next/static/chunks/app/api/worktrees/[id]/opencode/share/route-96fc12d400b49b13.js +0 -1
  832. package/.next/static/chunks/app/api/worktrees/[id]/prompt-response/route-96fc12d400b49b13.js +0 -1
  833. package/.next/static/chunks/app/api/worktrees/[id]/prompt-response/strict/route-96fc12d400b49b13.js +0 -1
  834. package/.next/static/chunks/app/api/worktrees/[id]/resolve-target/route-96fc12d400b49b13.js +0 -1
  835. package/.next/static/chunks/app/api/worktrees/[id]/respond/route-96fc12d400b49b13.js +0 -1
  836. package/.next/static/chunks/app/api/worktrees/[id]/route-96fc12d400b49b13.js +0 -1
  837. package/.next/static/chunks/app/api/worktrees/[id]/schedules/[scheduleId]/route-96fc12d400b49b13.js +0 -1
  838. package/.next/static/chunks/app/api/worktrees/[id]/schedules/active/route-96fc12d400b49b13.js +0 -1
  839. package/.next/static/chunks/app/api/worktrees/[id]/schedules/route-96fc12d400b49b13.js +0 -1
  840. package/.next/static/chunks/app/api/worktrees/[id]/search/route-96fc12d400b49b13.js +0 -1
  841. package/.next/static/chunks/app/api/worktrees/[id]/send/route-96fc12d400b49b13.js +0 -1
  842. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/git-workflow/route-96fc12d400b49b13.js +0 -1
  843. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/install/route-96fc12d400b49b13.js +0 -1
  844. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/plan/route-96fc12d400b49b13.js +0 -1
  845. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/uninstall/route-96fc12d400b49b13.js +0 -1
  846. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/uninstall-plan/route-96fc12d400b49b13.js +0 -1
  847. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/update/route-96fc12d400b49b13.js +0 -1
  848. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/update-plan/route-96fc12d400b49b13.js +0 -1
  849. package/.next/static/chunks/app/api/worktrees/[id]/skills/route-96fc12d400b49b13.js +0 -1
  850. package/.next/static/chunks/app/api/worktrees/[id]/slash-commands/route-96fc12d400b49b13.js +0 -1
  851. package/.next/static/chunks/app/api/worktrees/[id]/special-keys/route-96fc12d400b49b13.js +0 -1
  852. package/.next/static/chunks/app/api/worktrees/[id]/tasks/route-96fc12d400b49b13.js +0 -1
  853. package/.next/static/chunks/app/api/worktrees/[id]/terminal/route-96fc12d400b49b13.js +0 -1
  854. package/.next/static/chunks/app/api/worktrees/[id]/timers/history/route-96fc12d400b49b13.js +0 -1
  855. package/.next/static/chunks/app/api/worktrees/[id]/timers/route-96fc12d400b49b13.js +0 -1
  856. package/.next/static/chunks/app/api/worktrees/[id]/todos/[todoId]/route-96fc12d400b49b13.js +0 -1
  857. package/.next/static/chunks/app/api/worktrees/[id]/todos/route-96fc12d400b49b13.js +0 -1
  858. package/.next/static/chunks/app/api/worktrees/[id]/tree/[...path]/route-96fc12d400b49b13.js +0 -1
  859. package/.next/static/chunks/app/api/worktrees/[id]/tree/route-96fc12d400b49b13.js +0 -1
  860. package/.next/static/chunks/app/api/worktrees/[id]/upload/[...path]/route-96fc12d400b49b13.js +0 -1
  861. package/.next/static/chunks/app/api/worktrees/[id]/verify/config/route-96fc12d400b49b13.js +0 -1
  862. package/.next/static/chunks/app/api/worktrees/[id]/verify/route-96fc12d400b49b13.js +0 -1
  863. package/.next/static/chunks/app/api/worktrees/[id]/verify/runs/[runId]/cancel/route-96fc12d400b49b13.js +0 -1
  864. package/.next/static/chunks/app/api/worktrees/[id]/verify/runs/[runId]/route-96fc12d400b49b13.js +0 -1
  865. package/.next/static/chunks/app/api/worktrees/[id]/verify/runs/route-96fc12d400b49b13.js +0 -1
  866. package/.next/static/chunks/app/api/worktrees/[id]/viewed/route-96fc12d400b49b13.js +0 -1
  867. package/.next/static/chunks/app/api/worktrees/apply-default-agents/route-96fc12d400b49b13.js +0 -1
  868. package/.next/static/chunks/app/api/worktrees/route-96fc12d400b49b13.js +0 -1
  869. package/.next/static/chunks/app/layout-b9d8aef70e4f17b2.js +0 -1
  870. package/.next/static/chunks/app/manifest.webmanifest/route-96fc12d400b49b13.js +0 -1
  871. package/.next/static/chunks/app/proxy/[...path]/route-96fc12d400b49b13.js +0 -1
  872. package/.next/static/chunks/app/repositories/page-71f5a5ac29b0370d.js +0 -1
  873. package/.next/static/chunks/app/review/page-ff3efb96fdf9bb4b.js +0 -1
  874. package/.next/static/chunks/app/worktrees/[id]/layout-96fc12d400b49b13.js +0 -1
  875. package/.next/static/chunks/app/worktrees/[id]/page-f6a151304860b549.js +0 -1
  876. package/.next/static/css/c1e307d05daf93b6.css +0 -1
  877. /package/.next/static/{LNfVZiq6FZwKsV7L9Mi6M → z4d8-5MaLkoD-4EhueZwk}/_ssgManifest.js +0 -0
@@ -1,7 +1,3 @@
1
- "use strict";exports.id=3505,exports.ids=[3505],exports.modules={2734:(a,b,c)=>{c.d(b,{c:()=>d});let d="codex"},15425:(a,b,c)=>{c.d(b,{D8:()=>D,zW:()=>C});var d=c(67548),e=c(62887),f=c(13287),g=c(66101),h=c(57510),i=c(21820),j=c(33873),k=c(15194),l=c(43252),m=c(72626),n=c(46171),o=c(45567),p=c(76835);let q=(0,m.h)("lib/hooks/sources/antigravity/hooks-config"),r="commandmate",s=[["SessionStart","session_start"],["PostToolUse","post_tool_use"],["Stop","stop"]],t="CM_PERMISSION_HOOK_URL",u=l.sI,v=new Set(["PreToolUse","PostToolUse"]);function w(a={}){return a.path??(0,j.join)((0,i.homedir)(),".gemini","config","hooks.json")}function x(a,b){return[(0,l.ZL)(a),"--tool",p.F,"--event",b,"--stdin-json"].join(" ")}let y="fullyIdle";function z(a){let b={};for(let[c,d]of s){let f={type:"command",command:"stop"===d?function(a){let b=`'"${y}":false'`;return`p=$(cat); set --; case "$(printf '%s' "$p" | tr -d ' \\t\\r\\n')" in *${b}*) set -- --detail ${e.HV} ;; esac; printf '%s' "$p" | ${x(a,"stop")} "$@"`}(a):x(a,d),timeout:l.W6};b[c]=v.has(c)?[{matcher:"*",hooks:[f]}]:[f]}return b.PreToolUse=[{matcher:"*",hooks:[{type:"command",command:function(){let a=`"$${t}"`,b=`printf '%s' ${(0,l.ZL)('{"decision":"ask"}')}`;return`if [ -z "\${${t}:-}" ]; then cat >/dev/null; ${b}; exit 0; fi; set -- -sS -f -m 4 -X POST -H 'Content-Type: application/json'; if [ -n "\${${l.XE}:-}" ]; then set -- "$@" -H "Authorization: Bearer $${l.XE}"; fi; out=$(curl "$@" --data-binary @- ${a} 2>/dev/null); case "$out" in '{'*'"decision"'*) printf '%s' "$out" ;; *) ${b} ;; esac`}(),timeout:l.sI}]}],b}function A(a={}){var b;let c=w(a);if(!(0,l.q)())return{usable:!1,reason:"CM_AGENT_HOOKS_INJECT=0",fix:"Do not combine CM_AGENT_HOOKS_INJECT=0 with UAT isolation."};let e=(0,l.Os)();if(!e)return{usable:!1,reason:"this build ships no relay script",fix:d.f0};let f=(0,n.U)(c);if(null===f)return q.info("antigravity-hooks-config-absent-readonly",{configPath:c}),{usable:!1,reason:`${c} does not exist or cannot be read`,fix:d.f0};if(Object.keys(f).some(a=>a!==r))return q.info("antigravity-hooks-config-foreign-readonly",{configPath:c}),{usable:!1,reason:`${c} also holds hooks (or keys) CommandMate did not write, which would run in the UAT session`,fix:"Skip antigravity scenarios in this UAT, or run it where the shared hooks file holds only the hook CommandMate writes."};let g=(b=z(e),{...null,[r]:b});return JSON.stringify(f)!==JSON.stringify(g)?(q.info("antigravity-hooks-config-differs-readonly",{configPath:c}),{usable:!1,reason:`${c} differs from what this build writes`,fix:d.f0}):{usable:!0,configPath:c}}let B={decision:"ask"};function C(a){return(0,h.Qd)(a)?(0,f.LD)((0,h.O2)(a,"conversationId"),a.stepIdx):null}let D=(0,g.UB)({cliToolId:p.F,noDecision:{kind:"proceeds"},capabilities:{supportedEvents:["session_start","post_tool_use","stop"],configScope:"global-singleton",decisionTimeoutSeconds:u,permissionHookPredictsDialog:!1,sessionStartMayArriveLate:!1,permissionReplyReleasesPrompt:!1,permissionAllowSuppressesDialog:!1,eventIdentity:null,resync:"none",transcriptHistory:"pull",stopReportsSelfResume:!0},mappers:[],nativeEventNameFields:[],conversationIdFields:["conversationId"],toolCallIdFields:[],modelFields:["modelName"],extractDetail:function(a,b){return"pre_tool_use"===a||"post_tool_use"===a?(0,h.Wv)((0,h.NZ)(b,["toolCall","name"])):"stop"===a&&!1===b[y]?e.HV:null},parsePermissionRequest:function(a){if(!(0,h.Qd)(a))return null;let b=a.toolCall;if(!(0,h.Qd)(b))return null;let c=(0,h.O2)(b,"name");return c&&!(c.length>f.vy)&&(0,h.Qd)(b.args)?{toolName:c,toolInput:b.args,promptId:null,sessionId:(0,h.O2)(a,"conversationId"),permissionMode:null,permissionSuggestions:null}:null},parseQuestion:()=>null,encodeVerdict:function(a){return"allowOnce"===a.kind?{decision:"allow"}:"deny"===a.kind?{decision:"deny",reason:a.message??""}:{...B}},prepareLaunch:({target:a,executablePath:b})=>{let c=function(a={}){if(!(0,l.q)())return null;let b=(0,l.Os)();if(!b)return q.warn("antigravity-hook-relay-missing"),null;let c=w(a),e=(0,d.ox)("antigravity",[c]);try{var f,g;if("read-only"===e){let b=A(a);return b.usable?b.configPath:null}let d=(f=(0,n.U)(c),g=z(b),{...f,[r]:g});return(0,n.P)(c,d),c}catch(a){return q.warn("antigravity-hooks-config-write-failed",{error:a instanceof Error?a.message:String(a)}),null}}();if(null===c&&(0,d.WM)()){if("own-home"===(0,d.y3)())throw new d.ci("antigravity","~/.gemini/config/hooks.json could not be prepared",d.f0);let a=A();throw a.usable?new d.ci("antigravity","~/.gemini/config/hooks.json could not be prepared",d.f0):new d.ci("antigravity",a.reason,a.fix)}let{command:e,env:f}=function(a,b,c={}){if(!(0,l.q)())return{command:a,env:{}};if(!(0,k.n6)((0,l.g5)(b)))return q.warn("antigravity-hook-invalid-instance-id",{worktreeId:b.worktreeId}),{command:a,env:{}};let d={...b,cliToolId:p.F};return{command:(0,l.ZL)(a),env:{[o.ZM]:(0,l.xM)(d,c),[t]:(0,l.O$)(d,c)}}}(b,{worktreeId:a.worktreeId,instanceId:a.instanceId,cliToolId:p.F});return{command:e,settingsPath:c,env:f}}})},15608:(a,b,c)=>{c.d(b,{mc:()=>f,y:()=>g});var d=c(36925);function e(){return(0,d.v)("__cmLegacySessionAliases",()=>new Map)}function f(a){return e().get(a)}function g(a){let b=e(),c=!1;for(let[d,e]of b)e===a&&(b.delete(d),c=!0);return c}},16100:(a,b,c)=>{c.d(b,{Wp:()=>w});var d=c(29021),e=c(33873),f=c(43252),g=c(72626),h=c(66101),i=c(57510),j=c(25071),k=c(34114),l=c(51719),m=c(83738),n=c(26945),o=c(38892),p=c(32301),q=c(71193);let r=(0,g.h)("lib/hooks/sources/opencode-v2/source"),s=["scripts","opencode-v2","launch.sh"];function t(a){let b=(0,n.bH)(a);if(null===b)return{reason:"no-port"};let c=(0,o.X3)(a);return null===c?{reason:"no-password"}:{port:b,password:c}}async function u(a,b,c){let d=a.instanceId??a.cliToolId,e=e=>{r.info("opencode-v2-verdict-undelivered",{worktreeId:a.worktreeId,instanceId:d,decisionId:b.id,verdict:c.kind,reason:e}),(0,j.oy)(a,b.id,{delivered:!1,reason:e})};if("abstain"===c.kind)return e("abstained");let f=b.conversationId;if(!f)return e("no-session");let g=t(a);if("reason"in g)return e(g.reason);if("question"===b.kind){if("answer"!==c.kind)return e("question-needs-answer-verdict");let h=(0,m.oC)(b.raw,c.answers);if(null===h)return e("form-answer-does-not-fit");let i=await (0,k.yk)(g.port,g.password,f,b.id,h);return r.info("opencode-v2-form-replied",{worktreeId:a.worktreeId,instanceId:d,decisionId:b.id,delivered:i}),void(0,j.oy)(a,b.id,{delivered:i,reason:i?"form-reply":"form-reply-failed"})}let h=function(a){switch(a.kind){case"allowOnce":return"once";case"allowAlways":return"always";case"deny":return"reject";case"answer":case"abstain":return null}}(c);if(null===h)return e("no-wire-value");let i=await (0,k.Pf)(g.port,g.password,f,b.id,h,"deny"===c.kind?c.message:void 0);r.info("opencode-v2-permission-replied",{worktreeId:a.worktreeId,instanceId:d,decisionId:b.id,reply:h,delivered:i}),(0,j.oy)(a,b.id,{delivered:i,reason:i?`permission-reply:${h}`:"permission-reply-failed"})}async function v(a){let b=t(a);if("reason"in b)return[];let c=Date.now(),[d,e]=await Promise.all([(0,k.LO)(b.port,b.password),(0,k.CI)(b.port,b.password)]),f=[];for(let a of d??[]){if(!(0,i.Qd)(a))continue;let b=(0,m.hl)(a,c);b&&f.push(b)}for(let a of e??[]){if(!(0,i.Qd)(a))continue;let b=(0,m.gx)(a,c);b&&f.push(b)}return f}let w=(0,h.kS)({cliToolId:q.B,noDecision:{kind:"blocks"},capabilities:{supportedEvents:["user_prompt_submit","stop","notification"],configScope:"none",decisionTimeoutSeconds:null,permissionHookPredictsDialog:!1,sessionStartMayArriveLate:!1,permissionReplyReleasesPrompt:!0,permissionAllowSuppressesDialog:!0,eventIdentity:"permission-id",resync:"pending-list",transcriptHistory:"push",stopReportsSelfResume:!1},mappers:l.y8,nativeEventNameFields:["type"],conversationIdFields:[],extractModel:()=>null,extractEventIdentity:l.IQ,extractDetail:()=>null,parsePermissionRequest:m.RN,parseQuestion:m.rk,subscribe:async(a,b)=>{let c=(0,n.bH)(a);return null===c?{close:async()=>{},liveness:{state:"unknown"}}:(0,p.tc)(a,c,b,a=>w.normalizeEvent(a))},decide:u,listPending:v,probeActivity:async()=>null,liveness:a=>(0,p.RH)(a),prepareLaunch:function({target:a,executablePath:b,worktreePath:c}){let g={command:`${(0,f.ZL)(b)} --standalone ${(0,f.ZL)(c)}`,settingsPath:null,env:{}},h=(0,n.bH)(a);if(null===h)return g;let i=(0,o.ar)(a),j=function(){let a=(0,e.resolve)(process.cwd(),...s);return(0,d.existsSync)(a)?a:null}(),k=null===j?"launch-script-missing":(0,d.existsSync)(i)?null:"password-file-missing";return null===j||null!==k?(r.warn("opencode-v2-launch-degraded-to-standalone",{worktreeId:a.worktreeId,instanceId:a.instanceId??a.cliToolId,reason:k}),g):{command:["bash",(0,f.ZL)(j),"--port",String(h),"--password-file",(0,f.ZL)(i),"--directory",(0,f.ZL)(c),...b===q.V?[]:["--executable",(0,f.ZL)(b)]].join(" "),settingsPath:null,env:{}}}})},16659:(a,b,c)=>{c.d(b,{Hz:()=>i,Jj:()=>j,Lz:()=>l,NF:()=>o,Qb:()=>g,Ty:()=>h,bk:()=>k,c_:()=>n,sx:()=>m});var d=c(79748),e=c(33873),f=c(85038);function g(a,b,c,d){return!!(0,f.fp)(a)||(b.info(c,{worktreeId:a.worktreeId,instanceId:a.instanceId??a.cliToolId,generation:(0,f.Bh)()?.generation,write:d}),!1)}function h(a,b,c=0,d=null){return Math.max(null===b.timestampMs?a.startedAt:Math.max(a.startedAt,b.timestampMs+1),Math.min(c,null===d?1/0:d-1))}function i(a,b,c){let d=a[c+1];return d?b[c+1]?.timestampMs??d.startedAt:null}async function j(a){try{return(await (0,d.stat)(a)).isFile()}catch{return!1}}async function k(a,b,d){let[{getDbInstance:e},{findMessageByRequestId:f}]=await Promise.all([Promise.resolve().then(c.bind(c,88807)),Promise.resolve().then(c.bind(c,56791))]),g=e();for(let c=b.length-1;c>=0;c-=1){let e=d(b[c]);if(f(g,a.worktreeId,e))return{turns:b.slice(c+1),previousStartedAt:b[c].startedAt,anchored:!0}}return{turns:b.slice(-1),previousStartedAt:b.length>1?b[b.length-2].startedAt:0,anchored:!1}}async function l(a,b,d,e,f){try{let{getLastAgentEvent:e}=await Promise.resolve().then(c.bind(c,95375)),f=e(a.worktreeId,a.cliToolId,a.instanceId)?.sessionId;if("string"==typeof f&&f.length>0)return b.set(d,f),f}catch(b){e.debug(f,{worktreeId:a.worktreeId,instanceId:a.instanceId??a.cliToolId,error:b instanceof Error?b.message:String(b)})}return b.get(d)??null}function m(a,b,c){if(!c.endsWith(b)||c.includes("\0"))return null;let d=(0,e.resolve)(a),f=(0,e.resolve)(c);return f===d||f.startsWith(d+e.sep)?f:null}async function n(a,b,d,e,f,h){let i=a.instanceId??a.cliToolId,j=b.content.length;if(d.body.length<=j)return!1;let[{getDbInstance:k},{updateMessageContent:l},{broadcastMessage:m}]=await Promise.all([Promise.resolve().then(c.bind(c,88807)),Promise.resolve().then(c.bind(c,56791)),Promise.all([c.e(1356),c.e(1503),c.e(1191),c.e(8791),c.e(1719),c.e(2119),c.e(2445),c.e(8728)]).then(c.bind(c,43015))]);return!!g(a,f,"transcript-write-refused","grow")&&(l(k(),b.id,d.body),m("message_updated",{worktreeId:a.worktreeId,message:{...b,content:d.body}}),f.info(h,{worktreeId:a.worktreeId,instanceId:i,sessionId:d.sessionId,requestId:b.requestId,path:e,previousLength:j,bodyLength:d.body.length,textBlocks:d.textBlocks,toolBlocks:d.toolBlocks}),!0)}async function o(a,b,d,e){if(0===b.length)return 0;let[{getDbInstance:f},{findMessageByRequestId:g}]=await Promise.all([Promise.resolve().then(c.bind(c,88807)),Promise.resolve().then(c.bind(c,56791))]),h=f(),i=0;for(let c of b){if(!e.isWritable(c))continue;let b=g(h,a.worktreeId,e.requestIdOf(c));b&&await e.grow(a,b,e.render(c),d)&&(i+=1)}return i}},21758:(a,b,c)=>{c.d(b,{Rv:()=>T,TV:()=>s,cN:()=>x,nL:()=>q});var d=c(29021),e=c(21820),f=c(33873),g=c(8004),h=c(67548),i=c(15194),j=c(87447),k=c(43252),l=c(66007),m=c(72626),n=c(45567),o=c(54633);let p=(0,m.h)("lib/hooks/sources/copilot/hook-settings"),q="gh copilot",r="cmate-copilot-agent-hooks",s=10,t="CM_AGENT_WORKTREE_ID",u="CM_AGENT_INSTANCE_ID",v="CM_AUTH_TOKEN",w=n.wS,x="PreToolUse",y=[["SessionStart","session_start"],["UserPromptSubmit","user_prompt_submit"],["PostToolUse","post_tool_use"],["Stop","stop"],["SessionEnd","session_end"]];function z(){return(0,f.join)(function(){let a=(0,f.join)((0,e.homedir)(),".copilot");return(0,g.T)(process.env.COPILOT_HOME,a,"COPILOT_HOME")}(),"settings.json")}function A(a=""){return`: ${r}; if [ -z "\${${t}:-}" ]; then cat >/dev/null; ${a}exit 0; fi; case "$${w}" in ''|*[!0-9]*) cat >/dev/null; ${a}exit 0;; esac; `}let B=`"\${${u}:-${o.V}}"`,C=`"$${t}"`;function D(){return`set -- -fsS -m 4 -X POST -H 'Content-Type: application/json'; if [ -n "\${${v}:-}" ]; then set -- "$@" -H "Authorization: Bearer $${v}"; fi; `}function E(a){return`${(0,k.ZL)("http://127.0.0.1:")}"$${w}"${(0,k.ZL)(a)}`}function F(a){return`${E(`${a}?tool=${o.V}&worktreeId=`)}${C}'&instanceId='${B}`}function G(a){return`rc=$?; printf '%s\\n' "${r}: ${a} rc=$rc" >&2`}function H(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function I(a){return H(a)&&"string"==typeof a.command&&a.command.includes(r)}function J(a,b){return`${JSON.stringify(function(a,b){let c=a.hooks;if(void 0!==c&&!H(c))throw Error('copilot settings.json has a non-object "hooks" key');let d={...c??{}};for(let[a,c]of Object.entries(b.hooks)){let b=d[a];if(void 0!==b&&!Array.isArray(b)){p.warn("copilot-hook-event-not-an-array",{event:a});continue}d[a]=[...function(a){let b=[];for(let c of a)if(!I(c)){if(H(c)&&Array.isArray(c.hooks)){let a=c.hooks.filter(a=>!I(a));if(0===a.length&&c.hooks.length>0)continue;b.push({...c,hooks:a});continue}b.push(c)}return b}(b??[]),...c]}return{...a,hooks:d}}(a,function(a={}){let b={};for(let[c,d]of y)b[c]=[{hooks:[{type:"command",command:function(a,b={}){let c=void 0===b.relayScriptPath?(0,k.Os)():b.relayScriptPath,d=D()+`curl "$@" --data-binary @- ${F(k.jx)} >/dev/null 2>&1 || `+`{ ${G("agent_event_post_failed")}; }`;return c?A()+`if [ -x ${(0,k.ZL)(c)} ]; then `+[(0,k.ZL)(c),"--tool",(0,k.ZL)(o.V),"--event",(0,k.ZL)(a),"--worktree-id",C,"--instance-id",B,"--url",E(k.jx),"--stdin-json"].join(" ")+"; exit 0; fi; "+d:A()+d}(d,a)}]}];return b[x]=[{hooks:[{type:"command",command:function(a={}){return A("printf '{}'; ")+D()+`out=$(curl "$@" --data-binary @- ${F(k.WZ)} `+`2>/dev/null) || { ${G("permission_request_failed")}; out=''; }; `+"[ -n \"$out\" ] || out='{}'; printf '%s' \"$out\""}(a)}]}],{hooks:b}}(b)),null,2)}
2
- `}function K(a){try{return(0,d.readFileSync)(a,"utf8")}catch(a){if("ENOENT"===a.code)return"";throw a}}function L(a){if(""===a.trim())return{};let b=JSON.parse(a);if(!H(b))throw Error("copilot settings.json is not a JSON object");return b}function M(a){let b,c=K(a);if(""===c.trim())return"absent";try{b=JSON.parse(function(a){let b="",c=!1,d=!1;for(let e=0;e<a.length;e+=1){let f=a[e];if(c){b+=f,d?d=!1:"\\"===f?d=!0:'"'===f&&(c=!1);continue}if('"'===f){c=!0,b+=f;continue}if("/"===f&&"/"===a[e+1]){for(;e<a.length&&"\n"!==a[e];)e+=1;b+="\n";continue}if("/"===f&&"*"===a[e+1]){for(e+=2;e<a.length&&("*"!==a[e]||"/"!==a[e+1]);)e+=1;e+=1;continue}b+=f}return b}(c))}catch{return"unreadable"}if(!H(b))return"unreadable";let d=b.hooks;return null==d||H(d)&&0===Object.keys(d).length||Array.isArray(d)&&0===d.length?"absent":"present"}class N extends Error{constructor(a){super(`copilot config.json still has a "hooks" key (${a}); copilot migrates it over settings.json at startup, so CommandMate is not writing hooks this launch`),this.configPath=a,this.name="CopilotConfigHooksShadowError"}}let O=".cmate.lock",P=".cmate-backup";function Q(a){return`${a}.${process.pid}.tmp`}function R(a,b){return b.configPath??(0,f.join)((0,f.dirname)(a),"config.json")}function S(){return"0"!==process.env.CM_AGENT_HOOKS_INJECT}function T(a,b,c={}){let e={command:a,settingsPath:null,env:{}},g=(a,b)=>{if((0,h.WM)())throw new h.ci(o.V,a,b);return e};if(!S())return g("CM_AGENT_HOOKS_INJECT=0","Do not combine CM_AGENT_HOOKS_INJECT=0 with UAT isolation.");let k=b.instanceId??o.V;if(!(0,i.n6)(k)||!(0,l.h6)(b.worktreeId))return p.warn("copilot-hook-invalid-correlation-key",{worktreeId:b.worktreeId}),g("the worktree or instance id is not a valid correlation key","Use a valid worktree and instance id.");try{let e=function(a={}){let b=a.settingsPath??z();if("read-only"===(0,h.ox)(o.V,[(0,f.dirname)(b),b,`${b}${P}`,Q(b),(0,f.join)((0,f.dirname)(b),O)])){let b=function(a={}){let b=a.settingsPath??z(),c=R(b,a);if(!S())return{usable:!1,reason:"CM_AGENT_HOOKS_INJECT=0",fix:"Do not combine CM_AGENT_HOOKS_INJECT=0 with UAT isolation."};try{let d=M(c);if("absent"!==d)return p.info("copilot-hook-config-json-readonly",{configPath:c,configHooks:d}),{usable:!1,reason:"present"===d?`${c} has a "hooks" key, which copilot migrates over settings.json at startup`:`${c} could not be parsed, so it may hold hooks copilot migrates over settings.json`,fix:"Skip copilot scenarios in this UAT, or run it where copilot's config.json holds no hooks."};let e=K(b);if(""===e)return p.info("copilot-hook-settings-absent-readonly",{settingsPath:b}),{usable:!1,reason:`${b} does not exist or is empty`,fix:h.f0};if(e===J({},a))return{usable:!0,settingsPath:b};if(e===J(L(e),a))return p.info("copilot-hook-settings-foreign-readonly",{settingsPath:b}),{usable:!1,reason:`${b} also holds hooks (or keys) CommandMate did not write, which would run in the UAT session`,fix:"Skip copilot scenarios in this UAT, or run it where the shared settings file holds only the hooks CommandMate writes."};return p.info("copilot-hook-settings-differs-readonly",{settingsPath:b}),{usable:!1,reason:`${b} differs from what this build writes`,fix:h.f0}}catch(a){return p.warn("copilot-hook-settings-unreadable",{settingsPath:b,error:a instanceof Error?a.message:String(a)}),{usable:!1,reason:`${b} could not be read`,fix:h.f0}}}(a);if(b.usable)return b.settingsPath;throw new h.ci(o.V,b.reason,b.fix)}let c=R(b,a),e=M(c);if("present"===e)throw new N(c);return"unreadable"===e&&p.warn("copilot-config-json-unreadable",{configPath:c}),(0,d.mkdirSync)((0,f.dirname)(b),{recursive:!0,mode:448}),function(a,b){let c,e=(0,f.join)(a,O);try{c=(0,d.openSync)(e,"wx",384)}catch(b){if("EEXIST"!==b.code)throw b;let a=Date.now()-(0,d.statSync)(e).mtimeMs;if(a<1e4)throw Error(`copilot settings.json is locked by another CommandMate server (${e})`);p.warn("copilot-hook-settings-lock-stale",{lockPath:e,heldForMs:a}),(0,d.unlinkSync)(e),c=(0,d.openSync)(e,"wx",384)}try{(0,d.writeSync)(c,`${process.pid}
3
- `)}finally{(0,d.closeSync)(c)}try{return b()}finally{try{(0,d.unlinkSync)(e)}catch{}}}((0,f.dirname)(b),()=>{let c=K(b),e=J(L(c),a);if(c===e)return b;""!==c&&(0,d.copyFileSync)(b,`${b}${P}`);let f=Q(b);try{try{(0,d.unlinkSync)(f)}catch{}(0,d.writeFileSync)(f,e,{mode:384,flag:"wx"}),(0,d.renameSync)(f,b)}catch(a){try{(0,d.unlinkSync)(f)}catch{}throw a}return b})}(c);return{command:a,settingsPath:e,env:function(a,b,c={}){return{[t]:a,[u]:b,[w]:String(c.port??(0,j.D0)())}}(b.worktreeId,k,c)}}catch(a){if(a instanceof h.ci)throw a;if(a instanceof N)return p.warn("copilot-hook-config-json-shadows-settings",{worktreeId:b.worktreeId,configPath:a.configPath}),g(`${a.configPath} has a "hooks" key, which copilot migrates over settings.json at startup`,"Move the hooks out of copilot's config.json.");return p.warn("copilot-hook-settings-write-failed",{worktreeId:b.worktreeId,error:a instanceof Error?a.message:String(a)}),g("~/.copilot/settings.json could not be prepared",h.f0)}}},25071:(a,b,c)=>{c.d(b,{GW:()=>n,_0:()=>m,o4:()=>l,oy:()=>k,qK:()=>j});var d=c(24455),e=c(72626),f=c(36925);let g=(0,e.h)("lib/hooks/sources/pending-decisions"),h=(0,f.v)("__agentSourcePendingDecisions",()=>new Map);function i(a){return(0,d.v7)(a.worktreeId,a.cliToolId,a.instanceId)}function j(a){return(h.get(i(a))??[]).map(a=>a.decision)}function k(a,b,c){let d=h.get(i(a));if(!d)return!1;let e=d.find(a=>a.decision.id===b);return!!e&&(e.delivery=c,!0)}function l(a,b,c){let d=h.get(i(a));if(!d)return!1;let e=d.find(a=>a.decision.id===b);return!!e&&(e.body=c,!0)}async function m(a,b,c,d,e={}){let{body:f,delivery:g}=await n(a,b,c,d);try{e.onReceipt?.(g)}catch{}return f}async function n(a,b,c,d){let e=function(a,b){let c=i(a),d={key:c,ref:a,decision:b,body:null,delivery:null},e=h.get(c)??[];for(e.push(d);e.length>16;)e.shift();return h.set(c,e),d}(b,c);try{await a.decide(b,c,d)}catch(a){g.warn("agent-source-decide-failed",{worktreeId:b.worktreeId,cliToolId:b.cliToolId,instanceId:b.instanceId??b.cliToolId,decisionId:c.id,error:a instanceof Error?a.message:String(a)}),e.delivery={delivered:!1,reason:a instanceof Error?`decide-threw:${a.message}`:"decide-threw"}}let f=e.delivery;return{body:function(a){let b=h.get(a.key);if(b){let c=b.indexOf(a);c>=0&&b.splice(c,1),0===b.length&&h.delete(a.key)}return a.body??{}}(e),delivery:f}}},28862:(a,b,c)=>{c.d(b,{k:()=>d});let d="command-code"},30451:(a,b,c)=>{c.d(b,{ID:()=>s,JU:()=>z,Jd:()=>y,KJ:()=>j,Oc:()=>x,SS:()=>B,Yx:()=>u,aw:()=>t,jA:()=>h,lc:()=>g,rd:()=>k,ui:()=>i});var d=c(86594),e=c(57510),f=c(27128);let g=[".claude","projects"];function h(a){return a.replace(/[^a-zA-Z0-9]/g,"-")}let i=2e5,j="\n\n_(truncated)_",k=2048,l=["<local-command-caveat>","<local-command-stdout>","<command-name>"],m="<command-message>",n=/<command-name>([\s\S]*?)<\/command-name>/,o=/<command-args>([\s\S]*?)<\/command-args>/;function p(a){let b=a.trim();if(!b.startsWith(m))return null;let c=n.exec(b)?.[1].trim()??"";if(0===c.length)return null;let d=o.exec(b)?.[1].trim()??"";return 0===d.length?c:`${c} ${d}`}let q=/<pasted_content id="([^"<>\s]+)">\n?([\s\S]*?)\n?<\/pasted_content id="\1">/g,r=["command","file_path","notebook_path","path","pattern","query","url","description"];function s(a){if(!(0,e.Qd)(a))return null;let b=(0,e.O2)(a,"type");if(!b)return null;let c=(0,e.Qd)(a.message)?a.message:null,d=c?.content,g=[],h="";if("string"==typeof d)h=d;else if(Array.isArray(d))for(let a of d){let b=function(a){if(!(0,e.Qd)(a))return null;let b=(0,e.O2)(a,"type");if(!b)return null;if("tool_use"===b)return{type:b,text:null,toolName:(0,e.O2)(a,"name"),toolDetail:function(a){if(!(0,e.Qd)(a))return null;for(let c of r){let d=(0,e.O2)(a,c);if(d){var b;return b=(0,f.PB)(d),(0,f.Wv)(b,200)}}return null}(a.input)};let c="text"===b?(0,e.O2)(a,"text")??"":"thinking"===b?(0,e.O2)(a,"thinking")??"":null;return{type:b,text:c,toolName:null,toolDetail:null}}(a);b&&(g.push(b),b.text&&(h+=b.text))}let i=(0,e.O2)(a,"timestamp"),j=i?Date.parse(i):NaN,k=(0,e.Qd)(a.origin)?a.origin:null;return{type:b,uuid:(0,e.O2)(a,"uuid"),sessionId:(0,e.O2)(a,"sessionId")??(0,e.O2)(a,"session_id"),cwd:(0,e.O2)(a,"cwd"),isSidechain:!0===a.isSidechain,isMeta:!0===a.isMeta,originKind:k?(0,e.O2)(k,"kind"):null,promptSource:(0,e.O2)(a,"promptSource"),isCompactSummary:!0===a.isCompactSummary,isInterruption:null!==(0,e.O2)(a,"interruptedMessageId"),timestampMs:Number.isFinite(j)?j:null,stopReason:c?(0,e.O2)(c,"stop_reason"):null,blocks:g,text:h}}function t(a){let b=[],c=0;for(let d of a.split("\n")){let a;if(0===d.trim().length)continue;try{a=JSON.parse(d)}catch{c+=1;continue}let e=s(a);e?b.push(e):c+=1}return{records:b,malformedLines:c}}function u(a){if("user"!==a.type||a.isMeta||!a.uuid||a.blocks.some(a=>"tool_result"===a.type))return!1;let b=a.text.trim();return 0!==b.length&&(b.startsWith(m)?null!==p(b):!l.some(a=>b.startsWith(a)))}let v=["typed","queued"];function w(a){return"assistant"===a.type&&"end_turn"===a.stopReason&&a.blocks.some(a=>"text"===a.type&&(a.text??"").trim().length>0)}function x(a){return!!a.closed||!!a.superseded||!a.stopReasonObserved}function y(a,b){let c=[],d=null,e=0,f=0;for(let g of a){if(g.isSidechain){f+=1;continue}if(u(g)){d=function(a,b){return{sessionId:a.sessionId??b,promptUuid:a.uuid,startedAt:a.timestampMs??0,promptText:p(a.text)??function(a){if(!a.includes("<pasted_content id="))return a;let b=a.replace(q,(a,b,c)=>c);return 0===b.trim().length?a:b}(a.text),promptIsOperatorInput:!!u(a)&&!a.isCompactSummary&&!a.isInterruption&&(null!==a.originKind?"human"===a.originKind:null!==a.promptSource&&v.includes(a.promptSource)),blocks:[],assistantRecords:0,closed:!1,superseded:!1,stopReasonObserved:!1,overflowed:!1}}(g,b),c.push(d);continue}if("assistant"===g.type){if(!d){e+=1;continue}for(let a of(d.assistantRecords+=1,d.closed=w(g),null!==g.stopReason&&(d.stopReasonObserved=!0),g.blocks)){if(d.blocks.length>=k){d.overflowed=!0;break}d.blocks.push(a)}}}for(let a=0;a<c.length-1;a+=1)c[a].superseded=!0;return{turns:c,orphanedAssistantRecords:e,sidechainRecords:f}}function z(a,b){let c=[],e=0,f=!1,g=!1,h=!1,i=0,j=0,l=null;for(let b of a)if(!b.isSidechain){if(u(b)){h=!0;break}if("assistant"===b.type){for(let a of(e+=1,f=w(b),null!==b.stopReason&&(g=!0),null!==b.timestampMs&&(0===i&&(i=b.timestampMs),j=Math.max(j,b.timestampMs)),b.blocks))c.push(a);l=b}}if(null===l||!l.uuid)return null;let m=l.sessionId??b,n=c.length>k;return{turn:{sessionId:m,promptUuid:(0,d.Wr)(m,l.uuid),startedAt:i,promptText:"",promptIsOperatorInput:!1,blocks:n?c.slice(-k):c,assistantRecords:e,closed:f,superseded:h,stopReasonObserved:g,overflowed:n},lastRecordAt:j}}let A=new Set(["tool_result"]);function B(a){let b=[],c=new Set,d=0,e=0;for(let f of a.blocks){if("text"===f.type){let a=f.text?.trim()??"";if(0===a.length)continue;b.push({kind:"prose",text:a}),d+=1;continue}if("thinking"===f.type){let a=f.text?.trim()??"";if(0===a.length)continue;b.push({kind:"aside",text:function(a){let b=a.trim().split("\n").map(a=>a.length>0?`> ${a}`:">").join("\n");return`> **Thinking**
1
+ "use strict";exports.id=3505,exports.ids=[3505],exports.modules={15608:(a,b,c)=>{c.d(b,{mc:()=>f,y:()=>g});var d=c(36925);function e(){return(0,d.v)("__cmLegacySessionAliases",()=>new Map)}function f(a){return e().get(a)}function g(a){let b=e(),c=!1;for(let[d,e]of b)e===a&&(b.delete(d),c=!0);return c}},16100:(a,b,c)=>{c.d(b,{Wp:()=>w});var d=c(29021),e=c(33873),f=c(43252),g=c(72626),h=c(66101),i=c(57510),j=c(25071),k=c(34114),l=c(51719),m=c(83738),n=c(26945),o=c(38892),p=c(32301),q=c(71193);let r=(0,g.h)("lib/hooks/sources/opencode-v2/source"),s=["scripts","opencode-v2","launch.sh"];function t(a){let b=(0,n.bH)(a);if(null===b)return{reason:"no-port"};let c=(0,o.X3)(a);return null===c?{reason:"no-password"}:{port:b,password:c}}async function u(a,b,c){let d=a.instanceId??a.cliToolId,e=e=>{r.info("opencode-v2-verdict-undelivered",{worktreeId:a.worktreeId,instanceId:d,decisionId:b.id,verdict:c.kind,reason:e}),(0,j.oy)(a,b.id,{delivered:!1,reason:e})};if("abstain"===c.kind)return e("abstained");let f=b.conversationId;if(!f)return e("no-session");let g=t(a);if("reason"in g)return e(g.reason);if("question"===b.kind){if("answer"!==c.kind)return e("question-needs-answer-verdict");let h=(0,m.oC)(b.raw,c.answers);if(null===h)return e("form-answer-does-not-fit");let i=await (0,k.yk)(g.port,g.password,f,b.id,h);return r.info("opencode-v2-form-replied",{worktreeId:a.worktreeId,instanceId:d,decisionId:b.id,delivered:i}),void(0,j.oy)(a,b.id,{delivered:i,reason:i?"form-reply":"form-reply-failed"})}let h=function(a){switch(a.kind){case"allowOnce":return"once";case"allowAlways":return"always";case"deny":return"reject";case"answer":case"abstain":return null}}(c);if(null===h)return e("no-wire-value");let i=await (0,k.Pf)(g.port,g.password,f,b.id,h,"deny"===c.kind?c.message:void 0);r.info("opencode-v2-permission-replied",{worktreeId:a.worktreeId,instanceId:d,decisionId:b.id,reply:h,delivered:i}),(0,j.oy)(a,b.id,{delivered:i,reason:i?`permission-reply:${h}`:"permission-reply-failed"})}async function v(a){let b=t(a);if("reason"in b)return[];let c=Date.now(),[d,e]=await Promise.all([(0,k.LO)(b.port,b.password),(0,k.CI)(b.port,b.password)]),f=[];for(let a of d??[]){if(!(0,i.Qd)(a))continue;let b=(0,m.hl)(a,c);b&&f.push(b)}for(let a of e??[]){if(!(0,i.Qd)(a))continue;let b=(0,m.gx)(a,c);b&&f.push(b)}return f}let w=(0,h.kS)({cliToolId:q.B,noDecision:{kind:"blocks"},capabilities:{supportedEvents:["user_prompt_submit","stop","notification"],configScope:"none",decisionTimeoutSeconds:null,permissionHookPredictsDialog:!1,sessionStartMayArriveLate:!1,permissionReplyReleasesPrompt:!0,permissionAllowSuppressesDialog:!0,eventIdentity:"permission-id",resync:"pending-list",transcriptHistory:"push",stopReportsSelfResume:!1},mappers:l.y8,nativeEventNameFields:["type"],conversationIdFields:[],extractModel:()=>null,extractEventIdentity:l.IQ,extractDetail:()=>null,parsePermissionRequest:m.RN,parseQuestion:m.rk,subscribe:async(a,b)=>{let c=(0,n.bH)(a);return null===c?{close:async()=>{},liveness:{state:"unknown"}}:(0,p.tc)(a,c,b,a=>w.normalizeEvent(a))},decide:u,listPending:v,probeActivity:async()=>null,liveness:a=>(0,p.RH)(a),prepareLaunch:function({target:a,executablePath:b,worktreePath:c}){let g={command:`${(0,f.ZL)(b)} --standalone ${(0,f.ZL)(c)}`,settingsPath:null,env:{}},h=(0,n.bH)(a);if(null===h)return g;let i=(0,o.ar)(a),j=function(){let a=(0,e.resolve)(process.cwd(),...s);return(0,d.existsSync)(a)?a:null}(),k=null===j?"launch-script-missing":(0,d.existsSync)(i)?null:"password-file-missing";return null===j||null!==k?(r.warn("opencode-v2-launch-degraded-to-standalone",{worktreeId:a.worktreeId,instanceId:a.instanceId??a.cliToolId,reason:k}),g):{command:["bash",(0,f.ZL)(j),"--port",String(h),"--password-file",(0,f.ZL)(i),"--directory",(0,f.ZL)(c),...b===q.V?[]:["--executable",(0,f.ZL)(b)]].join(" "),settingsPath:null,env:{}}}})},16659:(a,b,c)=>{c.d(b,{Hz:()=>i,Jj:()=>j,Lz:()=>l,NF:()=>o,Qb:()=>g,Ty:()=>h,bk:()=>k,c_:()=>n,sx:()=>m});var d=c(79748),e=c(33873),f=c(85038);function g(a,b,c,d){return!!(0,f.fp)(a)||(b.info(c,{worktreeId:a.worktreeId,instanceId:a.instanceId??a.cliToolId,generation:(0,f.Bh)()?.generation,write:d}),!1)}function h(a,b,c=0,d=null){return Math.max(null===b.timestampMs?a.startedAt:Math.max(a.startedAt,b.timestampMs+1),Math.min(c,null===d?1/0:d-1))}function i(a,b,c){let d=a[c+1];return d?b[c+1]?.timestampMs??d.startedAt:null}async function j(a){try{return(await (0,d.stat)(a)).isFile()}catch{return!1}}async function k(a,b,d){let[{getDbInstance:e},{findMessageByRequestId:f}]=await Promise.all([Promise.resolve().then(c.bind(c,88807)),Promise.resolve().then(c.bind(c,56791))]),g=e();for(let c=b.length-1;c>=0;c-=1){let e=d(b[c]);if(f(g,a.worktreeId,e))return{turns:b.slice(c+1),previousStartedAt:b[c].startedAt,anchored:!0}}return{turns:b.slice(-1),previousStartedAt:b.length>1?b[b.length-2].startedAt:0,anchored:!1}}async function l(a,b,d,e,f){try{let{getLastAgentEvent:e}=await Promise.resolve().then(c.bind(c,95375)),f=e(a.worktreeId,a.cliToolId,a.instanceId)?.sessionId;if("string"==typeof f&&f.length>0)return b.set(d,f),f}catch(b){e.debug(f,{worktreeId:a.worktreeId,instanceId:a.instanceId??a.cliToolId,error:b instanceof Error?b.message:String(b)})}return b.get(d)??null}function m(a,b,c){if(!c.endsWith(b)||c.includes("\0"))return null;let d=(0,e.resolve)(a),f=(0,e.resolve)(c);return f===d||f.startsWith(d+e.sep)?f:null}async function n(a,b,d,e,f,h){let i=a.instanceId??a.cliToolId,j=b.content.length;if(d.body.length<=j)return!1;let[{getDbInstance:k},{updateMessageContent:l},{broadcastMessage:m}]=await Promise.all([Promise.resolve().then(c.bind(c,88807)),Promise.resolve().then(c.bind(c,56791)),Promise.all([c.e(1356),c.e(1503),c.e(1191),c.e(8791),c.e(1719),c.e(2119),c.e(2445),c.e(8728)]).then(c.bind(c,43015))]);return!!g(a,f,"transcript-write-refused","grow")&&(l(k(),b.id,d.body),m("message_updated",{worktreeId:a.worktreeId,message:{...b,content:d.body}}),f.info(h,{worktreeId:a.worktreeId,instanceId:i,sessionId:d.sessionId,requestId:b.requestId,path:e,previousLength:j,bodyLength:d.body.length,textBlocks:d.textBlocks,toolBlocks:d.toolBlocks}),!0)}async function o(a,b,d,e){if(0===b.length)return 0;let[{getDbInstance:f},{findMessageByRequestId:g}]=await Promise.all([Promise.resolve().then(c.bind(c,88807)),Promise.resolve().then(c.bind(c,56791))]),h=f(),i=0;for(let c of b){if(!e.isWritable(c))continue;let b=g(h,a.worktreeId,e.requestIdOf(c));b&&await e.grow(a,b,e.render(c),d)&&(i+=1)}return i}},25071:(a,b,c)=>{c.d(b,{GW:()=>n,_0:()=>m,o4:()=>l,oy:()=>k,qK:()=>j});var d=c(24455),e=c(72626),f=c(36925);let g=(0,e.h)("lib/hooks/sources/pending-decisions"),h=(0,f.v)("__agentSourcePendingDecisions",()=>new Map);function i(a){return(0,d.v7)(a.worktreeId,a.cliToolId,a.instanceId)}function j(a){return(h.get(i(a))??[]).map(a=>a.decision)}function k(a,b,c){let d=h.get(i(a));if(!d)return!1;let e=d.find(a=>a.decision.id===b);return!!e&&(e.delivery=c,!0)}function l(a,b,c){let d=h.get(i(a));if(!d)return!1;let e=d.find(a=>a.decision.id===b);return!!e&&(e.body=c,!0)}async function m(a,b,c,d,e={}){let{body:f,delivery:g}=await n(a,b,c,d);try{e.onReceipt?.(g)}catch{}return f}async function n(a,b,c,d){let e=function(a,b){let c=i(a),d={key:c,ref:a,decision:b,body:null,delivery:null},e=h.get(c)??[];for(e.push(d);e.length>16;)e.shift();return h.set(c,e),d}(b,c);try{await a.decide(b,c,d)}catch(a){g.warn("agent-source-decide-failed",{worktreeId:b.worktreeId,cliToolId:b.cliToolId,instanceId:b.instanceId??b.cliToolId,decisionId:c.id,error:a instanceof Error?a.message:String(a)}),e.delivery={delivered:!1,reason:a instanceof Error?`decide-threw:${a.message}`:"decide-threw"}}let f=e.delivery;return{body:function(a){let b=h.get(a.key);if(b){let c=b.indexOf(a);c>=0&&b.splice(c,1),0===b.length&&h.delete(a.key)}return a.body??{}}(e),delivery:f}}},28862:(a,b,c)=>{c.d(b,{k:()=>d});let d="command-code"},30451:(a,b,c)=>{c.d(b,{ID:()=>s,JU:()=>z,Jd:()=>y,KJ:()=>j,Oc:()=>x,SS:()=>B,Yx:()=>u,aw:()=>t,jA:()=>h,lc:()=>g,rd:()=>k,ui:()=>i});var d=c(86594),e=c(57510),f=c(27128);let g=[".claude","projects"];function h(a){return a.replace(/[^a-zA-Z0-9]/g,"-")}let i=2e5,j="\n\n_(truncated)_",k=2048,l=["<local-command-caveat>","<local-command-stdout>","<command-name>"],m="<command-message>",n=/<command-name>([\s\S]*?)<\/command-name>/,o=/<command-args>([\s\S]*?)<\/command-args>/;function p(a){let b=a.trim();if(!b.startsWith(m))return null;let c=n.exec(b)?.[1].trim()??"";if(0===c.length)return null;let d=o.exec(b)?.[1].trim()??"";return 0===d.length?c:`${c} ${d}`}let q=/<pasted_content id="([^"<>\s]+)">\n?([\s\S]*?)\n?<\/pasted_content id="\1">/g,r=["command","file_path","notebook_path","path","pattern","query","url","description"];function s(a){if(!(0,e.Qd)(a))return null;let b=(0,e.O2)(a,"type");if(!b)return null;let c=(0,e.Qd)(a.message)?a.message:null,d=c?.content,g=[],h="";if("string"==typeof d)h=d;else if(Array.isArray(d))for(let a of d){let b=function(a){if(!(0,e.Qd)(a))return null;let b=(0,e.O2)(a,"type");if(!b)return null;if("tool_use"===b)return{type:b,text:null,toolName:(0,e.O2)(a,"name"),toolDetail:function(a){if(!(0,e.Qd)(a))return null;for(let c of r){let d=(0,e.O2)(a,c);if(d){var b;return b=(0,f.PB)(d),(0,f.Wv)(b,200)}}return null}(a.input)};let c="text"===b?(0,e.O2)(a,"text")??"":"thinking"===b?(0,e.O2)(a,"thinking")??"":null;return{type:b,text:c,toolName:null,toolDetail:null}}(a);b&&(g.push(b),b.text&&(h+=b.text))}let i=(0,e.O2)(a,"timestamp"),j=i?Date.parse(i):NaN,k=(0,e.Qd)(a.origin)?a.origin:null;return{type:b,uuid:(0,e.O2)(a,"uuid"),sessionId:(0,e.O2)(a,"sessionId")??(0,e.O2)(a,"session_id"),cwd:(0,e.O2)(a,"cwd"),isSidechain:!0===a.isSidechain,isMeta:!0===a.isMeta,originKind:k?(0,e.O2)(k,"kind"):null,promptSource:(0,e.O2)(a,"promptSource"),isCompactSummary:!0===a.isCompactSummary,isInterruption:null!==(0,e.O2)(a,"interruptedMessageId"),timestampMs:Number.isFinite(j)?j:null,stopReason:c?(0,e.O2)(c,"stop_reason"):null,blocks:g,text:h}}function t(a){let b=[],c=0;for(let d of a.split("\n")){let a;if(0===d.trim().length)continue;try{a=JSON.parse(d)}catch{c+=1;continue}let e=s(a);e?b.push(e):c+=1}return{records:b,malformedLines:c}}function u(a){if("user"!==a.type||a.isMeta||!a.uuid||a.blocks.some(a=>"tool_result"===a.type))return!1;let b=a.text.trim();return 0!==b.length&&(b.startsWith(m)?null!==p(b):!l.some(a=>b.startsWith(a)))}let v=["typed","queued"];function w(a){return"assistant"===a.type&&"end_turn"===a.stopReason&&a.blocks.some(a=>"text"===a.type&&(a.text??"").trim().length>0)}function x(a){return!!a.closed||!!a.superseded||!a.stopReasonObserved}function y(a,b){let c=[],d=null,e=0,f=0;for(let g of a){if(g.isSidechain){f+=1;continue}if(u(g)){d=function(a,b){return{sessionId:a.sessionId??b,promptUuid:a.uuid,startedAt:a.timestampMs??0,promptText:p(a.text)??function(a){if(!a.includes("<pasted_content id="))return a;let b=a.replace(q,(a,b,c)=>c);return 0===b.trim().length?a:b}(a.text),promptIsOperatorInput:!!u(a)&&!a.isCompactSummary&&!a.isInterruption&&(null!==a.originKind?"human"===a.originKind:null!==a.promptSource&&v.includes(a.promptSource)),blocks:[],assistantRecords:0,closed:!1,superseded:!1,stopReasonObserved:!1,overflowed:!1}}(g,b),c.push(d);continue}if("assistant"===g.type){if(!d){e+=1;continue}for(let a of(d.assistantRecords+=1,d.closed=w(g),null!==g.stopReason&&(d.stopReasonObserved=!0),g.blocks)){if(d.blocks.length>=k){d.overflowed=!0;break}d.blocks.push(a)}}}for(let a=0;a<c.length-1;a+=1)c[a].superseded=!0;return{turns:c,orphanedAssistantRecords:e,sidechainRecords:f}}function z(a,b){let c=[],e=0,f=!1,g=!1,h=!1,i=0,j=0,l=null;for(let b of a)if(!b.isSidechain){if(u(b)){h=!0;break}if("assistant"===b.type){for(let a of(e+=1,f=w(b),null!==b.stopReason&&(g=!0),null!==b.timestampMs&&(0===i&&(i=b.timestampMs),j=Math.max(j,b.timestampMs)),b.blocks))c.push(a);l=b}}if(null===l||!l.uuid)return null;let m=l.sessionId??b,n=c.length>k;return{turn:{sessionId:m,promptUuid:(0,d.Wr)(m,l.uuid),startedAt:i,promptText:"",promptIsOperatorInput:!1,blocks:n?c.slice(-k):c,assistantRecords:e,closed:f,superseded:h,stopReasonObserved:g,overflowed:n},lastRecordAt:j}}let A=new Set(["tool_result"]);function B(a){let b=[],c=new Set,d=0,e=0;for(let f of a.blocks){if("text"===f.type){let a=f.text?.trim()??"";if(0===a.length)continue;b.push({kind:"prose",text:a}),d+=1;continue}if("thinking"===f.type){let a=f.text?.trim()??"";if(0===a.length)continue;b.push({kind:"aside",text:function(a){let b=a.trim().split("\n").map(a=>a.length>0?`> ${a}`:">").join("\n");return`> **Thinking**
4
2
  >
5
- ${b}`}(a)});continue}if("tool_use"===f.type){b.push({kind:"tool",text:function(a){let b=a.toolName??"tool";return a.toolDetail?`- \`${b}\` — ${a.toolDetail}`:`- \`${b}\``}(f)}),e+=1;continue}A.has(f.type)||c.add(f.type)}let g=(0,f.t3)(b).body;return g=(0,f.mg)(g,i,j),{sessionId:a.sessionId,promptUuid:a.promptUuid,body:g,textBlocks:d,toolBlocks:e,unknownBlockTypes:[...c]}}},32301:(a,b,c)=>{c.d(b,{VV:()=>J,RH:()=>F,rE:()=>G,yw:()=>E,tc:()=>I});var d=c(36925),e=c(3161),f=c(72626),g=c(57510),h=c(34114),i=c(95375),j=c(86594),k=c(98322),l=c(38892),m=c(71193);let n=(0,f.h)("lib/hooks/sources/opencode-v2/history"),o=["session.execution.succeeded","session.execution.failed","session.execution.interrupted"];function p(a){return null!==a&&o.includes(a)}function q(a){return"number"==typeof a&&Number.isFinite(a)?a:null}function r(a){let b=(0,g.Qd)(a.time)?a.time:null;return q(b?.created)??0}let s=(0,d.v)("__opencodeV2HistoryQueue",()=>new Map);async function t(a,b,c){let d=[],e=null;for(let f=0;f<5;f+=1){let i=await (0,h.VW)(a,b,c,e);if(null===i)return 0===f?null:d;if(d.push(...i.data),i.data.some(a=>(0,g.Qd)(a)&&"user"===(0,g.O2)(a,"type"))||null===i.next||0===i.data.length)break;e=i.next}return d}async function u(a,b,d){let e=a.instanceId??a.cliToolId;if(0===b.body.length)return n.info("opencode-v2-history-turn-empty",{worktreeId:a.worktreeId,instanceId:e,sessionId:b.sessionId}),!1;b.unknownPartTypes.length>0&&n.info("opencode-v2-history-unknown-parts",{worktreeId:a.worktreeId,instanceId:e,sessionId:b.sessionId,partTypes:b.unknownPartTypes});let f=(0,j.jT)(b.userMessageId),[{getDbInstance:g},{createMessage:h,findMessageByRequestId:i},{broadcastMessage:k}]=await Promise.all([Promise.resolve().then(c.bind(c,88807)),Promise.resolve().then(c.bind(c,56791)),Promise.all([c.e(1356),c.e(1503),c.e(1191),c.e(8791),c.e(1719),c.e(2119),c.e(2445),c.e(8728)]).then(c.bind(c,43015))]),l=g();if(i(l,a.worktreeId,f))return!1;let m=h(l,{worktreeId:a.worktreeId,role:"assistant",content:b.body,messageType:"normal",timestamp:new Date(d>0?d:Date.now()),cliToolId:a.cliToolId,instanceId:e,requestId:f});return k("message",{worktreeId:a.worktreeId,message:m}),n.info("opencode-v2-history-turn-saved",{worktreeId:a.worktreeId,instanceId:e,sessionId:b.sessionId,requestId:f,bodyLength:b.body.length,textParts:b.textParts,toolParts:b.toolParts}),!0}var v=c(51719);let w=(0,f.h)("lib/hooks/sources/opencode-v2/usage");function x(a,b){let c=a[b];return"number"==typeof c&&Number.isFinite(c)&&c>0?c:0}async function y(a,b,c,d=()=>!0){try{let f=(0,l.X3)(a);if(null===f)return null;let i=await (0,h.u7)(b,f,c),j=(0,e.Yv)(i,Date.now());if(!j||!j.id)return null;let k=j.provider,m=j.model,[n,o]=await Promise.all([(0,h.nR)(b,f,j.id),k&&m?(0,h.am)(b,f):Promise.resolve(null)]),p=n?function(a){let b=null;for(let c of a){if(!(0,g.Qd)(c)||"assistant"!==(0,g.O2)(c,"type"))continue;let a=(0,g.Qd)(c.tokens)?c.tokens:null;if(!a)continue;let d=x(a,"output");if(d<=0)continue;let e=(0,g.Qd)(a.cache)?a.cache:{},f=x(a,"input")+d+x(a,"reasoning")+x(e,"read")+x(e,"write"),h=function(a){let b=(0,g.Qd)(a.time)?a.time:null,c=b?.created;return"number"==typeof c&&Number.isFinite(c)?c:0}(c),i=(0,g.O2)(c,"id")??"";(null===b||h>b.at||h===b.at&&i>b.id)&&(b={at:h,id:i,total:f})}return b?.total??null}(n):null,q=o&&k&&m?function(a,b,c){for(let d of a){if(!(0,g.Qd)(d)||d.providerID!==b||d.id!==c)continue;let a=(0,g.Qd)(d.limit)?d.limit:null,e=a?.context;if("number"!=typeof e||!Number.isFinite(e)||e<=0)break;return e}return null}(o,k,m):null;if(!d())return null;return(0,e.G1)(a,j),(0,e.T9)(a,{tokens:p,limit:q,percent:(0,e.sI)(p,q),sessionAt:j.at,at:Date.now()}),j}catch(c){return w.warn("opencode-v2-usage-refresh-failed",{worktreeId:a.worktreeId,instanceId:a.instanceId??a.cliToolId,port:b,error:c instanceof Error?c.message:String(c)}),null}}let z=(0,d.v)("__opencodeV2UsageRefreshes",()=>new Map),A=(0,f.h)("lib/hooks/sources/opencode-v2/subscription"),B=[500,1e3,2e3,4e3,8e3,15e3,3e4],C=(0,d.v)("__opencodeV2Subscriptions",()=>new Map),D=(0,d.v)("__opencodeV2EndedLiveness",()=>new Map);function E(a){return C.has((0,l.Y_)(a))}function F(a){let b=(0,l.Y_)(a);return C.get(b)?.liveness??D.get(b)??{state:"unknown"}}function G(a){return"live"===F(a).state}function H(a){return{close:async()=>{await J(a.target)},get liveness(){return a.liveness}}}function I(a,b,c,d){let e=(0,l.Y_)(a),f=C.get(e);if(f)return H(f);D.delete(e);let g={key:e,target:a,port:b,onEvent:c,normalize:d,streamController:new AbortController,lifetimeController:new AbortController,liveness:{state:"unknown"},closed:!1,watchdog:null};return C.set(e,g),A.info("opencode-v2-subscription-opened",{worktreeId:a.worktreeId,instanceId:a.instanceId??a.cliToolId,port:b}),O(g),H(g)}async function J(a){let b=(0,l.Y_)(a);D.delete(b);let c=C.get(b);c&&(K(c),C.delete(b),(0,e.cI)(a),A.info("opencode-v2-subscription-closed",{worktreeId:a.worktreeId,instanceId:a.instanceId??a.cliToolId,port:c.port}))}function K(a){a.closed=!0,M(a),a.streamController.abort(),a.lifetimeController.abort()}function L(a,b){K(a),a.liveness={state:"lost",since:Date.now(),reason:b},C.get(a.key)===a&&C.delete(a.key),D.set(a.key,a.liveness),(0,e.cI)(a.target),A.warn("opencode-v2-subscription-ended",{worktreeId:a.target.worktreeId,instanceId:a.target.instanceId??a.target.cliToolId,port:a.port,reason:b})}function M(a){null!==a.watchdog&&(clearTimeout(a.watchdog),a.watchdog=null)}function N(a){a.liveness={state:"live",lastHeartbeatAt:Date.now()},M(a);let b=setTimeout(()=>{a.closed||(A.warn("opencode-v2-subscription-heartbeat-lost",{worktreeId:a.target.worktreeId,instanceId:a.target.instanceId??a.target.cliToolId,port:a.port,afterMs:6e4}),a.streamController.abort())},6e4);b.unref?.(),a.watchdog=b}async function O(a){let b=0,c=0;for(;!a.closed;){a.streamController=new AbortController;let d="stream-ended";try{let e=(0,l.X3)(a.target);if(null===e)return void L(a,"password-file-missing");let f=await (0,h.tJ)(a.port,e);if(a.closed)return;if("rejected"===f.kind){if(c+=1,d=`server-rejected-${f.status}`,c>=3)return void L(a,"port-identity-changed")}else if("unreachable"===f.kind)d="server-unreachable";else{c=0;let d=await (0,h.MT)(a.port,e,a.streamController.signal);for await(let c of(N(a),b=0,await P(a.target,a.port,e,b=>Q(a,b)),d)){if(a.closed)break;N(a),"frame"===c.kind&&Q(a,c.frame)}}}catch(a){d=a instanceof Error?a.message:String(a)}finally{M(a)}if(a.closed)return;a.liveness={state:"lost",since:Date.now(),reason:d},A.info("opencode-v2-subscription-disconnected",{worktreeId:a.target.worktreeId,instanceId:a.target.instanceId??a.target.cliToolId,port:a.port,reason:d,attempt:b}),await function(a,b){return new Promise(c=>{if(b.aborted)return void c();let d=()=>{clearTimeout(e),c()};b.addEventListener("abort",d,{once:!0});let e=setTimeout(()=>{b.removeEventListener("abort",d),c()},a);e.unref?.()})}(B[Math.min(b,B.length-1)],a.lifetimeController.signal),b+=1}}async function P(a,b,c,d){let e=0;try{let[f,i]=await Promise.all([(0,h.LO)(b,c),(0,h.CI)(b,c)]),j=(b,c,f)=>{let h=(b??[]).filter(g.Qd),i=h.slice(0,50);for(let b of(h.length>i.length&&A.warn("opencode-v2-resync-truncated",{worktreeId:a.worktreeId,instanceId:a.instanceId??a.cliToolId,type:c,examined:i.length,skipped:h.length-i.length,limit:50}),i)){let a="string"==typeof b.id&&""!==b.id?b.id:null;null!==a&&(d({id:`resync_${a}`,type:c,data:f(b)}),e+=1)}};j(f,"permission.asked",a=>a),j(i,"form.created",a=>({form:a}))}catch(b){A.warn("opencode-v2-resync-failed",{worktreeId:a.worktreeId,instanceId:a.instanceId??a.cliToolId,error:b instanceof Error?b.message:String(b)})}return e>0&&A.info("opencode-v2-resync",{worktreeId:a.worktreeId,instanceId:a.instanceId??a.cliToolId,replayed:e}),e}function Q(a,b){try{!function(a,b,c,d=Date.now()){if(!(0,v.cT)((0,v.Cr)(a)))return;let e=b({payload:a,receivedAt:d});e&&c(e)}(b,a.normalize,a.onEvent)}catch(c){A.warn("opencode-v2-frame-delivery-failed",{worktreeId:a.target.worktreeId,instanceId:a.target.instanceId??a.target.cliToolId,type:(0,v.Cr)(b),error:c instanceof Error?c.message:String(c)})}(function(a,b,c,d=()=>!0){try{if(!p((0,v.Cr)(c)))return null;let e=(0,v.lx)(c);if(null===e)return null;!function(a,b,c,d=()=>!0){!function(a,b){let c=(s.get(a)??Promise.resolve()).then(b,b).then(()=>void 0,()=>void 0);s.set(a,c),c.then(()=>{s.get(a)===c&&s.delete(a)})}((0,l.Y_)(a),async()=>{let e=a.instanceId??a.cliToolId;try{let f=(0,l.X3)(a);if(null===f)return n.info("opencode-v2-history-unavailable",{worktreeId:a.worktreeId,instanceId:e,reason:"password-file-missing"}),0;let h=await t(b,f,c);if(null===h)return n.warn("opencode-v2-history-unavailable",{worktreeId:a.worktreeId,instanceId:e,port:b,sessionId:c,reason:"messages-unreadable"}),0;d()&&(0,i.recordAgentReportedModel)(a.worktreeId,m.B,a.instanceId??m.B,function(a){let b=null;for(let c of a){if(!(0,g.Qd)(c)||"assistant"!==(0,g.O2)(c,"type"))continue;let a=(0,g.NZ)(c,["model","id"]);if(null===a)continue;let d=r(c),e=(0,g.O2)(c,"id")??"";(null===b||d>b.at||d===b.at&&e>b.id)&&(b={at:d,id:e,model:a})}return b?.model??null}(h));let j=(function(a,b){let c=a.filter(g.Qd).filter(a=>null!==(0,g.O2)(a,"id")).map((a,b)=>({message:a,index:b})).sort((a,b)=>{let c=r(a.message)-r(b.message);if(0!==c)return c;let d=(0,g.O2)(a.message,"id")??"",e=(0,g.O2)(b.message,"id")??"";return d<e?-1:d>e?1:a.index-b.index}).map(({message:a})=>a),d=[],e=null,f=a=>{e&&d.push({...e,closed:a}),e=null};for(let a of c){let c=(0,g.O2)(a,"id"),d=(0,g.O2)(a,"type");if("user"===d){f(!0),e={accumulator:(0,k.lp)(b,c,r(a)),completedAt:null};continue}if(!e)continue;let h=e;if("idle"===d){f(!0);continue}if("assistant"!==d)continue;h.accumulator.assistantMessageIds.add(c),(Array.isArray(a.content)?a.content:[]).forEach((a,b)=>{let d=function(a,b,c){if(!(0,g.Qd)(c))return null;let d=(0,g.O2)(c,"type");if(!d)return null;let e=(0,g.Qd)(c.state)?c.state:null;return{id:`${a}#${b}`,messageId:a,type:d,text:"string"==typeof c.text?c.text:null,tool:"tool"===d?(0,g.O2)(c,"name"):null,status:e?(0,g.O2)(e,"status"):null,title:e?(0,g.O2)(e,"title"):null,error:e?(0,g.O2)(e,"error")??(0,g.NZ)(e,["error","message"]):null}}(c,b,a);d&&(0,k.yG)(h.accumulator,d)});let i=(0,g.Qd)(a.time)?a.time:null,j=q(i?.completed)??q(i?.created);null!==j&&j>(h.completedAt??0)&&(h.completedAt=j)}return f(!1),d})(h,c).filter(a=>a.closed).slice(-50),o=0;for(let b of j){let c=(0,k.JZ)(b.accumulator),d=Math.max(b.accumulator.startedAt,b.completedAt??0);await u(a,c,d)&&(o+=1)}return o}catch(d){return n.error("opencode-v2-history-sync-failed",{worktreeId:a.worktreeId,instanceId:e,port:b,sessionId:c,error:d instanceof Error?d.message:String(d)}),0}})}(a,b,e,d)}catch(b){return A.warn("opencode-v2-history-trigger-failed",{worktreeId:a.worktreeId,instanceId:a.instanceId??a.cliToolId,error:b instanceof Error?b.message:String(b)}),null}})(a.target,a.port,b,()=>R(a)),function(a,b,c,d=()=>!0){try{var e;if(!("session.usage.updated"===(e=(0,v.Cr)(c))||p(e)))return null;let f=(0,v.lx)(c);if(null===f)return null;!function(a,b,c,d=()=>!0){let e=(0,l.Y_)(a),f=z.get(e);if(f)return f.queued={port:b,sessionId:c,isCurrent:d},f.running;let g={running:Promise.resolve(),queued:null};g.running=(async()=>{let f={port:b,sessionId:c,isCurrent:d};for(;null!==f;){let b=f;g.queued=null,await y(a,b.port,b.sessionId,b.isCurrent),f=g.queued}z.get(e)===g&&z.delete(e)})(),z.set(e,g),g.running}(a,b,f,d)}catch(b){return A.warn("opencode-v2-usage-trigger-failed",{worktreeId:a.worktreeId,instanceId:a.instanceId??a.cliToolId,error:b instanceof Error?b.message:String(b)}),null}}(a.target,a.port,b,()=>R(a))}function R(a){return!a.closed&&C.get(a.key)===a}},38367:(a,b,c)=>{c.d(b,{Jp:()=>h,WK:()=>e,lb:()=>f,ue:()=>g});var d=c(57510);let e={Stop:"stop",SubagentStop:"stop",Notification:"notification",SessionStart:"session_start",SessionEnd:"session_end",UserPromptSubmit:"user_prompt_submit",PreToolUse:"pre_tool_use",PostToolUse:"post_tool_use"},f=["session_id","conversationId"],g=["tool_use_id"];function h(a,b){let c="notification"===a?"notification_type":"session_end"===a?"reason":"session_start"===a?"source":"pre_tool_use"===a||"post_tool_use"===a?"tool_name":null;return null===c?null:(0,d.Wv)((0,d.O2)(b,c))}},40964:(a,b,c)=>{c.d(b,{s4:()=>j,NN:()=>m,Ze:()=>k,mf:()=>l});var d=c(15194);let e=/^[a-zA-Z0-9_-]+$/;function f(a){if(!e.test(a))throw Error(`Invalid session name format: ${a}`)}var g=c(15608);let h="mcbd-",i=/^[0-9a-f]{8}$/;function j(){return globalThis.__cmTmuxSessionNamespace??null}function k(a,b,c,e){var g=null===a?h:`${h}${a}-`;let i=`${g}${b}-${c}`;if(!e||e===b)return f(i),i;let j=(0,d.pL)(e,b),k=j?`${i}-${j}`:i;return f(k),k}function l(a,b,c){let d=j(),e=k(d,a,b,c);return null===d?e:(0,g.mc)(e)??e}function m(a){if(!a.startsWith(h))return null;let b=a.slice(h.length),c=null,e=b.indexOf("-");e>0&&i.test(b.slice(0,e))&&(c=b.slice(0,e),b=b.slice(e+1));let f=[...d.XH].sort((a,b)=>b.length-a.length).find(a=>b.startsWith(`${a}-`));if(!f)return null;let g=b.slice(f.length+1);return""===g?null:{namespace:c,cliToolId:f,rest:g}}},45567:(a,b,c)=>{c.d(b,{K9:()=>i,ZM:()=>f,wS:()=>g});var d=c(87447),e=c(43252);let f="CM_HOOK_URL",g="CM_HOOK_PORT",h="CM_PORT";function i(a){let b=Object.entries(h in a.env?a.env:{...a.env,[h]:String((0,d.D0)())}).map(([a,b])=>`${a}=${(0,e.ZL)(b)}`);return 0===b.length?a.command:`${b.join(" ")} ${a.command}`}},46171:(a,b,c)=>{c.d(b,{P:()=>i,U:()=>h});var d=c(29021),e=c(33873),f=c(7956),g=c(57510);function h(a){if(!(0,d.existsSync)(a))return null;try{let b=JSON.parse((0,d.readFileSync)(a,"utf8"));return(0,g.Qd)(b)?b:null}catch{return null}}function i(a,b){if((0,f.Mb)(a))throw Error(`Refusing to write inside a virtual filesystem: ${a} (a recursive mkdir under /proc, /sys or /dev never returns on Linux; Issue #1774)`);(0,d.mkdirSync)((0,e.dirname)(a),{recursive:!0,mode:448}),(0,d.writeFileSync)(a,`${JSON.stringify(b,null,2)}
6
- `,{mode:384})}},51719:(a,b,c)=>{c.d(b,{Ai:()=>g,Cr:()=>l,DH:()=>o,Dg:()=>q,IQ:()=>p,ZL:()=>r,cT:()=>k,dA:()=>i,er:()=>h,lx:()=>n,xz:()=>f,y8:()=>s});var d=c(62887),e=c(57510);let f="permission_prompt",g="question_prompt",h=d.KC,i="error",j=["session.execution.started","session.execution.succeeded","session.execution.failed","session.execution.interrupted","permission.asked","permission.replied","form.created","form.replied","form.cancelled"];function k(a){return null!==a&&j.includes(a)}function l(a){return(0,e.NZ)(a,["type"])}function m(a){return(0,e.Qd)(a.data)?a.data:{}}function n(a){return(0,e.NZ)(m(a),["sessionID"])??(0,e.NZ)(m(a),["form","sessionID"])??(0,e.NZ)(a,["durable","aggregateID"])}function o(a){let b=m(a);switch(l(a)){case"permission.asked":return(0,e.NZ)(b,["id"]);case"form.created":return(0,e.NZ)(b,["form","id"])??(0,e.NZ)(b,["id"]);case"permission.replied":return(0,e.NZ)(b,["requestID"])??(0,e.NZ)(b,["id"]);case"form.replied":case"form.cancelled":return(0,e.NZ)(b,["formID"])??(0,e.NZ)(b,["id"])??(0,e.NZ)(b,["requestID"]);default:return null}}function p(a){return(0,e.hY)(o(a))}function q(a){return(0,e.NZ)(m(a),["action"])}function r(a){let b=m(a);return(0,e.NZ)(b,["error","message"])??(0,e.NZ)(b,["error","data","message"])??(0,e.NZ)(b,["error","name"])??(0,e.NZ)(b,["message"])}let s=[(0,e.KR)("session.execution.started","user_prompt_submit"),(0,e.KR)("session.execution.succeeded","stop"),(0,e.KR)("session.execution.interrupted","stop"),(0,e.KR)("session.execution.failed","stop",i),(0,e.KR)("permission.asked","notification",f),(0,e.KR)("permission.replied","notification",h),(0,e.KR)("form.created","notification",g),(0,e.KR)("form.replied","notification",h),(0,e.KR)("form.cancelled","notification",h)].map(a=>(b,c)=>{let d=a(b,c);return d?{...d,conversationId:d.conversationId??n(c)}:null})},54633:(a,b,c)=>{c.d(b,{V:()=>d});let d="copilot"},66101:(a,b,c)=>{c.d(b,{Kf:()=>k,UB:()=>i,kS:()=>j});var d=c(62887),e=c(57510),f=c(25071);let g={close:async()=>{},liveness:{state:"unknown"}};function h(a,b,c){let f=c.receivedAt??Date.now(),g=b.length>0?(0,e.oJ)(c.payload,b):null;if(null!=c.event&&(0,d.o0)(c.event))return(0,e.Uq)({event:c.event},c.payload,f,{detail:a.extractDetail,conversationId:a.conversationIdFields,toolCallId:a.toolCallIdFields,modelFields:a.modelFields,extractModel:a.extractModel});let h=(0,e.qU)(a.mappers,g,c.payload);return h?(0,e.Uq)(h,c.payload,f,{detail:a.extractDetail,conversationId:a.conversationIdFields,toolCallId:a.toolCallIdFields,modelFields:a.modelFields,extractModel:a.extractModel}):((0,e.ex)(a.cliToolId,g),null)}function i(a){let b=a.nativeEventNameFields??["hook_event_name"];return{cliToolId:a.cliToolId,transport:"push",noDecision:a.noDecision,capabilities:a.capabilities,normalizeEvent:c=>h(a,b,c),eventIdentityOf:b=>a.extractEventIdentity?.(b)??null,promptJoinsOpenTurn:b=>a.promptJoinsOpenTurn?.(b)??!1,parsePermissionRequest:a.parsePermissionRequest,parseQuestion:a.parseQuestion,encodeVerdict:b=>({kind:"responseBody",body:a.encodeVerdict(b)}),prepareLaunch:a.prepareLaunch,subscribe:async()=>g,async decide(b,c,d){let e=(0,f.o4)(b,c.id,a.encodeVerdict(d));(0,f.oy)(b,c.id,{delivered:e,reason:e?"response-body":"slot-closed"})},listPending:async a=>(0,f.qK)(a),probeActivity:async()=>null,liveness:()=>({state:"unknown"})}}function j(a){let b=a.nativeEventNameFields??["type"];return{cliToolId:a.cliToolId,transport:"pull",noDecision:a.noDecision,capabilities:a.capabilities,normalizeEvent:c=>h(a,b,c),eventIdentityOf:b=>a.extractEventIdentity?.(b)??null,parsePermissionRequest:a.parsePermissionRequest,parseQuestion:a.parseQuestion,encodeVerdict:()=>({kind:"outOfBand"}),prepareLaunch:a.prepareLaunch??(a=>({command:a.executablePath,settingsPath:null,env:{}})),subscribe:a.subscribe,decide:a.decide,listPending:a.listPending,probeActivity:a.probeActivity,liveness:a.liveness}}function k(a,b,c){let d="pull"===a.transport?"sse":0===a.capabilities.supportedEvents.length?"scraper":"hooks";if("sse"!==d)return{kind:d};switch(b.state){case"live":return c-b.lastHeartbeatAt>=3e4?{kind:"sse",liveness:"stale",degradedReason:"heartbeat_stale"}:{kind:"sse",liveness:"live"};case"lost":return{kind:"scraper",liveness:"stale",degradedReason:b.reason};case"unknown":return{kind:"scraper",degradedReason:"not_subscribed"}}}},67548:(a,b,c)=>{c.d(b,{Hx:()=>s,WM:()=>o,ci:()=>p,f0:()=>q,mc:()=>m,ox:()=>t,y3:()=>n});var d=c(29021),e=c.n(d),f=c(21820),g=c.n(f),h=c(33873),i=c.n(h);let j="CM_UAT_ISOLATION",k="own-home",l="CM_UAT_DEDICATED_USER",m="project,local";function n(a=process.env){let b=a[j];return"1"===b?"shared-read-only":b===k?"own-home":"off"}function o(a=process.env){return"off"!==n(a)}class p extends Error{constructor(a,b,c){super("own-home"===n()?`${j}=${k}: refusing to start ${a}: ${b}. This server writes the hook config only inside the dedicated user's own HOME, and ${a} would otherwise start with hooks this server did not prepare. ${c}`:`${j}=1: refusing to start ${a}: ${b}. This server does not write the shared hook config in UAT isolation, and ${a} would read it anyway and run the production hooks. ${c}`),this.name="UatIsolationLaunchRefusedError"}}let q="Run the UAT with the same CommandMate build as the production server, so the shared file already matches what this build writes.",r=`Run ${j}=${k} as the user named by ${l}, with HOME set to that user's home and every hook config path (CODEX_HOME, CM_AGENT_HOOKS_DIR, ...) inside it.`;function s(a,b,c=process.env){if("own-home"!==n(c))return;let d=function(a,b=process.env,c=function(){let a=g().userInfo();return{username:a.username,uid:a.uid,homedir:a.homedir}}()){let d,f,h=b[l];if(!h)return`${l} is not set`;if(c.username!==h)return`this process runs as ${c.username}, not as the dedicated user ${h}`;let j=b.HOME;if(!j||!i().isAbsolute(j))return"HOME is not set to an absolute path";try{d=e().realpathSync(j),f=e().realpathSync(c.homedir)}catch{return`HOME (${j}) or ${h}'s home directory (${c.homedir}) does not exist`}if(d!==f)return`HOME (${j}) is not ${h}'s home directory (${c.homedir})`;if(e().statSync(d).uid!==c.uid)return`HOME (${j}) is not owned by ${h}`;for(let b of a){let a=function(a){let b,c=i().resolve(a),d=[];for(;;){let b=!1;try{e().lstatSync(c),b=!0}catch{b=!1}if(b)break;let f=i().dirname(c);if(f===c)return`${a} has no existing ancestor`;d.unshift(i().basename(c)),c=f}try{b=e().realpathSync(c)}catch{return`${c} is a symlink that points nowhere`}return{real:i().join(b,...d),owner:e().statSync(b).uid}}(b);if("string"==typeof a)return a;if(a.real!==d&&!a.real.startsWith(`${d}${i().sep}`))return`${b} resolves to ${a.real}, outside ${h}'s HOME (${d})`;if(a.owner!==c.uid)return`${b} (${a.real}) is not owned by ${h}`}return null}(b,c);if(d)throw new p(a,d,r)}function t(a,b,c=process.env){return"shared-read-only"===n(c)?"read-only":(s(a,b,c),"write")}},70096:(a,b,c)=>{c.d(b,{VM:()=>af});var d=c(2466),e=c(13287),f=c(67548),g=c(62887),h=c(43252),i=c(66101),j=c(57510),k=c(38367),l=c(34257);let m="<task-notification>";var n=c(29021),o=c(21820),p=c(33873),q=c(16659),r=c(30451);let s=/<task-id>([^<]+)<\/task-id>/;function t(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function u(a){return"string"==typeof a&&a.length>0?a:null}function v(a){return"string"==typeof a&&a.trimStart().startsWith(m)?s.exec(a)?.[1]??null:null}var w=c(70997);let x={};function y(a){return"allowOnce"!==a.kind?x:{hookSpecificOutput:{hookEventName:e.l9,decision:{behavior:"allow"}}}}let z=(0,i.UB)({cliToolId:w.v,noDecision:{kind:"proceeds"},capabilities:{supportedEvents:g.b0,configScope:"per-instance",decisionTimeoutSeconds:h.sI,permissionHookPredictsDialog:!0,sessionStartMayArriveLate:!1,permissionReplyReleasesPrompt:!1,permissionAllowSuppressesDialog:!0,eventIdentity:null,resync:"none",transcriptHistory:"pull",stopReportsSelfResume:!0},mappers:[...(0,j.mJ)(k.WK),l.Bo],nativeEventNameFields:["hook_event_name"],conversationIdFields:k.lb,toolCallIdFields:k.ue,modelFields:["model"],extractModel:l._P,promptJoinsOpenTurn:function(a){if(!0===a.queuedNotice)return!0;let b=a.prompt;return"string"==typeof b&&b.trimStart().startsWith(m)},extractDetail:function(a,b){return"stop"===a&&function(a,b={}){let c=u(a.transcript_path);if(!c)return!1;let d=(0,p.join)(b.homeDir??(0,o.homedir)(),...r.lc),e=(0,q.sx)(d,".jsonl",c);if(!e)return!1;let f=function(a,b){let c=null;try{c=(0,n.openSync)(a,"r");let d=(0,n.fstatSync)(c).size,e=Math.max(0,d-b),f=Buffer.alloc(d-e),g=0;for(;g<f.length;){let a=(0,n.readSync)(c,f,g,f.length-g,e+g);if(0===a)break;g+=a}let h=f.subarray(0,g).toString("utf8");return 0===e?h:h.slice(h.indexOf("\n")+1)}catch{return null}finally{if(null!==c)try{(0,n.closeSync)(c)}catch{}}}(e,b.tailBytes??4194304);return null!==f&&function(a){let b=[],c=new Set;for(let d of a.split("\n")){let a;if(""!==d.trim()){try{a=JSON.parse(d)}catch{continue}if(t(a)&&!0!==a.isSidechain){if("user"===a.type){let d=a.toolUseResult;if(t(d)){let a=function(a){let b=u(a.backgroundTaskId);if(b)return b;let c=u(a.taskId);if(c&&!1===a.persistent)return c;let d=u(a.agentId);return d&&!0===a.isAsync?d:null}(d);a&&b.push(a);let e=u(d.task_id);e&&c.add(e)}for(let b of function(a){let b=a.message;if(!t(b))return[];let c=b.content;return"string"==typeof c?[c]:Array.isArray(c)?c.filter(t).filter(a=>"text"===a.type).map(a=>a.text):[]}(a)){let a=v(b);a&&c.add(a)}}else if("attachment"===a.type&&t(a.attachment)){if("queued_command"!==a.attachment.type)continue;let b=v(a.attachment.prompt);b&&c.add(b)}}}}return[...new Set(b)].filter(a=>!c.has(a))}(f).length>0}(b)?g.HV:(0,k.Jp)(a,b)},parsePermissionRequest:a=>(0,e.ss)(a),parseQuestion:a=>(0,d.ek)(a),encodeVerdict:y,prepareLaunch:({target:a,executablePath:b})=>{let c="own-home"===(0,f.y3)(),d={worktreeId:a.worktreeId,instanceId:a.instanceId,cliToolId:a.cliToolId};(0,h.q)()&&(0,f.Hx)(w.v,[(0,h.K6)(),(0,h.iR)(d)]);let e=(0,h.D2)(b,d);if(c&&e===b)throw new f.ci(w.v,(0,h.q)()?"the hook settings file could not be written":"CM_AGENT_HOOKS_INJECT=0",(0,h.q)()?"Make CM_AGENT_HOOKS_DIR writable by the dedicated user.":"Do not combine CM_AGENT_HOOKS_INJECT=0 with own-home.");let g=(0,h.q)()&&e!==b?(0,h.iR)({worktreeId:a.worktreeId,instanceId:a.instanceId,cliToolId:a.cliToolId}):null;return{command:(0,f.WM)()?`${e} --setting-sources ${f.mc}`:e,settingsPath:g,env:{}}}});var A=c(92196),B=c(21758),C=c(54633);let D={},E=(0,i.UB)({cliToolId:C.V,noDecision:{kind:"proceeds"},capabilities:{supportedEvents:["stop","session_start","session_end","user_prompt_submit","post_tool_use"],configScope:"global-singleton",decisionTimeoutSeconds:B.TV,permissionHookPredictsDialog:!1,sessionStartMayArriveLate:!0,permissionReplyReleasesPrompt:!1,permissionAllowSuppressesDialog:!0,eventIdentity:null,resync:"none",transcriptHistory:null,stopReportsSelfResume:!1},mappers:(0,j.mJ)(k.WK),nativeEventNameFields:["hook_event_name"],conversationIdFields:k.lb,toolCallIdFields:k.ue,extractDetail:k.Jp,parsePermissionRequest:function(a){if(!(0,j.Qd)(a)||a.hook_event_name!==B.cN)return null;let b=(0,j.O2)(a,"tool_name");if(!b||b.length>e.vy)return null;let c=(0,A.mw)(a.tool_input);return c?{toolName:b,toolInput:c.toolInput,toolInputNormalization:c.normalization,promptId:null,sessionId:(0,j.O2)(a,"session_id"),permissionMode:null,permissionSuggestions:null}:null},parseQuestion:()=>null,encodeVerdict:function(a){return"allowOnce"===a.kind?{hookSpecificOutput:{hookEventName:B.cN,permissionDecision:"allow"}}:"deny"===a.kind?{hookSpecificOutput:{hookEventName:B.cN,permissionDecision:"deny",permissionDecisionReason:a.message??"denied by CommandMate"}}:D},prepareLaunch:({target:a,executablePath:b})=>(0,B.Rv)(b,a)});var F=c(15194);let G={ToolPermission:"permission_prompt"};var H=c(72626),I=c(45567),J=c(46171),K=c(77904);let L=(0,H.h)("lib/hooks/sources/gemini/settings-generator"),M=1e3*h.W6,N=[["SessionStart","session_start"],["BeforeAgent","user_prompt_submit"],["AfterAgent","stop"],["Notification","notification"],["SessionEnd","session_end"]];function O(a,b){return a.includes("cmate-agent-event.sh")&&a.includes(`--tool ${K.o}`)&&a.includes(`--worktree-id ${(0,h.ZL)(b)}`)}let P=(0,i.UB)({cliToolId:K.o,noDecision:{kind:"proceeds"},capabilities:{supportedEvents:["session_start","user_prompt_submit","stop","notification","session_end"],configScope:"per-worktree",decisionTimeoutSeconds:0,permissionHookPredictsDialog:!1,sessionStartMayArriveLate:!1,permissionReplyReleasesPrompt:!1,permissionAllowSuppressesDialog:!1,eventIdentity:null,resync:"none",transcriptHistory:null,stopReportsSelfResume:!1},mappers:(0,j.mJ)({SessionStart:"session_start",SessionEnd:"session_end",BeforeAgent:"user_prompt_submit",AfterAgent:"stop",BeforeTool:"pre_tool_use",AfterTool:"post_tool_use",Notification:"notification"}),nativeEventNameFields:["hook_event_name"],conversationIdFields:k.lb,toolCallIdFields:[],extractDetail:function(a,b){if("notification"!==a)return(0,k.Jp)(a,b);let c=(0,j.O2)(b,"notification_type");return null===c?null:(0,j.Wv)(G[c]??c)},parsePermissionRequest:()=>null,parseQuestion:()=>null,encodeVerdict:()=>({}),prepareLaunch:function({target:a,executablePath:b,worktreePath:c}){let d={worktreeId:a.worktreeId,instanceId:a.instanceId,cliToolId:K.o},e=(0,F.n6)(a.instanceId??K.o)?function(a,b){if(!(0,h.q)())return null;let c=(0,h.Os)();if(!c)return L.warn("gemini-hook-relay-missing",{worktreeId:b.worktreeId}),null;let d=(0,p.join)(a,".gemini","settings.json");try{let a=(0,J.U)(d),e=function(a,b){let c={};for(let[e,f]of N){var d;c[e]=[{hooks:[{type:"command",command:(d=b.worktreeId,[(0,h.ZL)(a),"--tool",K.o,"--event",f,"--worktree-id",(0,h.ZL)(d),"--stdin-json"].join(" ")),timeout:M}]}]}return c}(c,b);return(0,J.P)(d,function(a,b,c){let d=(0,j.Qd)(a?.hooks)?a.hooks:{},e={};for(let[a,b]of Object.entries(d)){if(!Array.isArray(b)){e[a]=b;continue}let d=b.filter(a=>!function(a,b){if(!(0,j.Qd)(a))return!1;let c=a.hooks;return Array.isArray(c)?c.length>0&&c.every(a=>(0,j.Qd)(a)&&"string"==typeof a.command&&O(a.command,b)):"string"==typeof a.command&&O(a.command,b)}(a,c));e[a]=d.length===b.length?b:d}for(let[a,c]of Object.entries(b)){let b=e[a];e[a]=Array.isArray(b)?[...b,...c]:[...c]}return{...a,hooks:e}}(a,e,b.worktreeId)),d}catch(a){return L.warn("gemini-hook-settings-write-failed",{worktreeId:b.worktreeId,error:a instanceof Error?a.message:String(a)}),null}}(c,d):null,{command:f,env:g}=function(a,b,c={}){if(!(0,h.q)())return{command:a,env:{}};if(!(0,F.n6)((0,h.g5)(b)))return L.warn("gemini-hook-invalid-instance-id",{worktreeId:b.worktreeId}),{command:a,env:{}};let d=(0,h.xM)({...b,cliToolId:K.o},c);return{command:(0,h.ZL)(a),env:{[I.ZM]:d}}}(b,d);return{command:f,settingsPath:e,env:g}}});var Q=c(15425),R=c(99432),S=c(2734);let T={},U=(0,i.UB)({cliToolId:S.c,noDecision:{kind:"proceeds"},capabilities:{supportedEvents:R.JD,configScope:"global-singleton",decisionTimeoutSeconds:5,permissionHookPredictsDialog:!0,sessionStartMayArriveLate:!1,permissionReplyReleasesPrompt:!1,permissionAllowSuppressesDialog:!0,eventIdentity:null,resync:"none",transcriptHistory:"pull",stopReportsSelfResume:!1},mappers:(0,j.mJ)(k.WK),nativeEventNameFields:["hook_event_name"],conversationIdFields:k.lb,toolCallIdFields:k.ue,modelFields:["model"],extractDetail:k.Jp,parsePermissionRequest:a=>(0,e.ss)(a),parseQuestion:()=>null,encodeVerdict:function(a){return"allowOnce"===a.kind?{hookSpecificOutput:{hookEventName:R.l1,decision:{behavior:"allow"}}}:"deny"===a.kind?{hookSpecificOutput:{hookEventName:R.l1,decision:{behavior:"deny",message:a.message??""}}}:T},prepareLaunch:({target:a,executablePath:b})=>(0,R.S9)(b,a)});var V=c(85965),W=c(28862);let X=(0,H.h)("lib/hooks/sources/command-code/hooks-config"),Y=[["SessionStart","session_start"],["PreToolUse","pre_tool_use"],["PostToolUse","post_tool_use"],["Stop","stop"]],Z=h.W6;function $(a,b){return a.includes("cmate-agent-event.sh")&&a.includes(`--tool ${W.k}`)&&a.includes(`--worktree-id ${(0,h.ZL)(b)}`)}let _=(0,i.UB)({cliToolId:W.k,noDecision:{kind:"proceeds"},capabilities:{supportedEvents:["session_start","pre_tool_use","post_tool_use","stop"],configScope:"per-worktree",decisionTimeoutSeconds:null,permissionHookPredictsDialog:!1,sessionStartMayArriveLate:!1,permissionReplyReleasesPrompt:!1,permissionAllowSuppressesDialog:!1,eventIdentity:null,resync:"none",transcriptHistory:"pull",stopReportsSelfResume:!1},mappers:(0,j.mJ)({SessionStart:"session_start",PreToolUse:"pre_tool_use",PostToolUse:"post_tool_use",Stop:"stop"}),nativeEventNameFields:["hook_event_name"],conversationIdFields:["session_id"],toolCallIdFields:k.ue,extractDetail:k.Jp,parsePermissionRequest:()=>null,parseQuestion:()=>null,encodeVerdict:function(a){return{}},prepareLaunch:({target:a,executablePath:b,worktreePath:c})=>{let d={worktreeId:a.worktreeId,instanceId:a.instanceId,cliToolId:W.k},e=function(a,b){if(!(0,h.q)())return null;let c=(0,h.Os)();if(!c)return X.warn("command-code-hook-relay-missing",{worktreeId:b.worktreeId}),null;let d=(0,p.join)(a,".commandcode","settings.local.json");try{let a=(0,J.U)(d),e=function(a,b){let c={};for(let[e,f]of Y){var d;c[e]=[{matcher:"",hooks:[{type:"command",command:(d=b.worktreeId,[(0,h.ZL)(a),"--tool",W.k,"--event",f,"--worktree-id",(0,h.ZL)(d),"--stdin-json"].join(" ")),timeout:Z}]}]}return c}(c,b);return(0,J.P)(d,function(a,b,c){let d=(0,j.Qd)(a?.hooks)?a.hooks:{},e={};for(let[a,b]of Object.entries(d)){if(!Array.isArray(b)){e[a]=b;continue}let d=b.filter(a=>!function(a,b){if(!(0,j.Qd)(a))return!1;let c=a.hooks;return Array.isArray(c)?c.length>0&&c.every(a=>(0,j.Qd)(a)&&"string"==typeof a.command&&$(a.command,b)):"string"==typeof a.command&&$(a.command,b)}(a,c));e[a]=d.length===b.length?b:d}for(let[a,c]of Object.entries(b)){let b=e[a];e[a]=Array.isArray(b)?[...b,...c]:[...c]}return{...a,hooks:e}}(a,e,b.worktreeId)),d}catch(a){return X.warn("command-code-hook-settings-write-failed",{worktreeId:b.worktreeId,error:a instanceof Error?a.message:String(a)}),null}}(c,d),{command:f,env:g}=function(a,b,c={}){if(!(0,h.q)())return{command:a,env:{}};if(!(0,F.n6)((0,h.g5)(b)))return X.warn("command-code-hook-invalid-instance-id",{worktreeId:b.worktreeId}),{command:a,env:{}};let d=(0,h.xM)({...b,cliToolId:W.k},c);return{command:(0,h.ZL)(a),env:{[I.ZM]:d}}}(b,d);return{command:f,settingsPath:e,env:g}}});var aa=c(16100),ab=c(36925);let ac=(0,ab.v)("__agentEventSources",()=>new Map),ad=(0,ab.v)("__agentEventLegacySources",()=>new Map);function ae(a){ac.set(a.cliToolId,a),ad.delete(a.cliToolId)}function af(a){let b=ac.get(a);if(b)return b;let c=ad.get(a);if(c)return c;let f=(0,i.UB)({cliToolId:a,noDecision:{kind:"proceeds"},capabilities:{supportedEvents:[],configScope:"none",decisionTimeoutSeconds:null,permissionHookPredictsDialog:!1,sessionStartMayArriveLate:!1,permissionReplyReleasesPrompt:!1,permissionAllowSuppressesDialog:!1,eventIdentity:null,resync:"none",transcriptHistory:null,stopReportsSelfResume:!1},mappers:(0,j.mJ)(k.WK),nativeEventNameFields:["hook_event_name"],conversationIdFields:k.lb,toolCallIdFields:k.ue,extractDetail:k.Jp,parsePermissionRequest:a=>(0,e.ss)(a),parseQuestion:a=>(0,d.ek)(a),encodeVerdict:y,prepareLaunch:({executablePath:a})=>({command:a,settingsPath:null,env:{}})});return ad.set(a,f),f}ae(z),ae(E),ae(P),ae(Q.D8),ae(U),ae(V.cC),ae(_),ae(aa.Wp)},76835:(a,b,c)=>{c.d(b,{F:()=>d});let d="antigravity"},77904:(a,b,c)=>{c.d(b,{o:()=>d});let d="gemini"},83738:(a,b,c)=>{c.d(b,{RN:()=>h,gx:()=>q,hl:()=>i,oC:()=>r,rk:()=>p,s8:()=>l,vF:()=>j});var d=c(2466),e=c(57510);function f(a){return"string"==typeof a.type&&(0,e.Qd)(a.data)?(0,e.Qd)(a.data.form)?a.data.form:a.data:a}function g(a){return Array.isArray(a)?a.filter(a=>"string"==typeof a):[]}function h(a){let b=f(a),c=(0,e.O2)(b,"id"),d=(0,e.O2)(b,"sessionID");if(!c||!d||Array.isArray(b.fields))return null;let h=(0,e.O2)(b,"action"),i=(0,e.Qd)(b.metadata)?b.metadata:{};return{toolName:h??"permission",toolInput:{action:h,resources:g(b.resources),...i},promptId:c,sessionId:d,permissionMode:null,permissionSuggestions:Array.isArray(b.save)?b.save:null}}function i(a,b){let c=h(a);return c&&c.promptId?{kind:"permission",id:c.promptId,conversationId:c.sessionId,subject:{kind:"permission",toolName:c.toolName,toolInput:c.toolInput},raw:a,askedAt:b}:null}function j(a){let b=h(a);return b?{toolName:b.toolName,patterns:g(b.permissionSuggestions)}:null}let k=/^(Index: |={3,}$|--- |\+\+\+ )/;function l(a){let b=h(a);if(!b)return null;let c=b.toolInput,d="string"==typeof c.command&&""!==c.command?c.command:g(c.resources).join(", "),f=[""===d?b.toolName:`${b.toolName} ${d}`],i=Array.isArray(c.files)?c.files.filter(e.Qd):[];for(let a of i){let b="string"==typeof a.patch?a.patch.split("\n").filter(a=>!k.test(a)).join("\n").replace(/\n+$/,""):"";""!==b&&(i.length>1&&"string"==typeof a.file&&f.push(a.file),f.push(b))}return f.join("\n")}let m=[{label:"Yes",description:null,value:!0},{label:"No",description:null,value:!1}];function n(a){return a.trim().slice(0,d.Gb)}function o(a){if(!Array.isArray(a.fields))return null;let b=(0,e.O2)(a,"title"),c=[];for(let d of a.fields){if(!(0,e.Qd)(d))return null;if(!0===d.hidden)continue;let a=(0,e.O2)(d,"key");if(null===a)return null;let f=(0,e.O2)(d,"type"),g="boolean"===f?[...m]:"string"===f||"multiselect"===f?function(a){if(!Array.isArray(a)||0===a.length)return null;let b=[];for(let c of a){if(!(0,e.Qd)(c))return null;let a=(0,e.O2)(c,"value"),d=(0,e.O2)(c,"label")??a;if(null===a||null===d)return null;b.push({label:d,description:(0,e.O2)(c,"description"),value:a})}return b}(d.options):null;if(null===g)return null;let h=(0,e.O2)(d,"description")??(0,e.O2)(d,"title")??b;if(null===h)return null;c.push({key:a,question:h,header:(0,e.O2)(d,"title")??b,multiSelect:"multiselect"===f,custom:!0===d.custom&&"boolean"!==f,choices:g})}return c.length>0?c:null}function p(a){let b=f(a),c=(0,e.O2)(b,"id");if(!c)return null;let g=o(b);if(null===g)return null;let h=(0,d.u_)({questions:g.map(a=>({question:a.question,header:a.header,multiSelect:a.multiSelect,options:a.choices.map(a=>({label:a.label,...a.description?{description:a.description}:{}}))}))});return null===h?null:{questions:h.map((a,b)=>g[b]?.custom?{...a,custom:!0}:a),promptId:c}}function q(a,b){let c=f(a),d=p(c);return d&&d.promptId?{kind:"question",id:d.promptId,conversationId:(0,e.O2)(c,"sessionID"),subject:{kind:"question",spec:d},raw:c,askedAt:b}:null}function r(a,b){let c=o(f(a));if(null===c||b.length!==c.length)return null;let d={};for(let[a,e]of c.entries()){let c=[];for(let d of b[a]){let a=n(d),b=e.choices.find(b=>n(b.label)===a)??e.choices.find(a=>a.value===d);if(b)c.push(b.value);else{if(!e.custom||""===d.trim())return null;c.push(d.trim())}}if(e.multiSelect)d[e.key]=c.map(String);else{if(1!==c.length)return null;d[e.key]=c[0]}}return d}},85038:(a,b,c)=>{c.d(b,{Bh:()=>g,LF:()=>k,SC:()=>m,Z:()=>l,_B:()=>h,fp:()=>j,pP:()=>i,tV:()=>f});var d=c(84297),e=c(36925);let f=(0,e.v)("__responsePollerOwnerStorage",()=>new d.AsyncLocalStorage);function g(){return f.getStore()}function h(a){let b=g();return void 0===b||b.pollerKey!==a||!b.stopped}function i(a,b,c){return`${a}:${c??b}`}function j(a){return h(i(a.worktreeId,a.cliToolId,a.instanceId))}let k=(0,e.v)("__responsePollerSnapshotStorage",()=>new d.AsyncLocalStorage);function l(){let a=k.getStore();return void 0===a||!a.superseded}class m extends Error{constructor(){super("terminal snapshot of a superseded poller tick"),this.name="RetiredSnapshotError"}}},85965:(a,b,c)=>{c.d(b,{cC:()=>u});var d=c(62887),e=c(43252),f=c(72626),g=c(66101),h=c(25071),i=c(49791),j=c(75356),k=c(98211),l=c(18529),m=c(84574),n=c(33198),o=c(85322);let p=(0,f.h)("lib/hooks/sources/opencode/source"),q=d.b0;async function r(a,b,c){let d=a.instanceId??a.cliToolId;if("abstain"===c.kind){p.warn("opencode-verdict-abstained",{worktreeId:a.worktreeId,instanceId:d,decisionId:b.id,consequence:"the agent waits indefinitely; nothing else will unblock it"}),(0,h.oy)(a,b.id,{delivered:!1,reason:"abstained"});return}let e=(0,m.hC)(a);if(null===e){p.warn("opencode-verdict-undeliverable-no-port",{worktreeId:a.worktreeId,instanceId:d,decisionId:b.id}),(0,h.oy)(a,b.id,{delivered:!1,reason:"no-port"});return}if("question"===b.kind){if("answer"!==c.kind){p.info("opencode-question-not-answerable",{worktreeId:a.worktreeId,instanceId:d,decisionId:b.id,verdict:c.kind}),(0,h.oy)(a,b.id,{delivered:!1,reason:"question-needs-answer-verdict"});return}let f=await (0,i.Ei)(e,b.id,c.answers);p.info("opencode-question-replied",{worktreeId:a.worktreeId,instanceId:d,decisionId:b.id,delivered:f}),(0,h.oy)(a,b.id,{delivered:f,reason:f?"question-reply":"question-reply-failed"});return}let f=function(a){switch(a.kind){case"allowOnce":return"once";case"allowAlways":return"always";case"deny":return"reject";case"answer":case"abstain":return null}}(c);if(null===f)return void(0,h.oy)(a,b.id,{delivered:!1,reason:"no-wire-value"});let g=await (0,i.LV)(e,b.id,f,"deny"===c.kind?c.message:void 0);p.info("opencode-permission-replied",{worktreeId:a.worktreeId,instanceId:d,decisionId:b.id,reply:f,delivered:g}),(0,h.oy)(a,b.id,{delivered:g,reason:g?`permission-reply:${f}`:"permission-reply-failed"})}async function s(a){let b=(0,m.hC)(a);if(null===b)return[];let c=Date.now(),[d,e]=await Promise.all([(0,i.Li)(b),(0,i.er)(b)]),f=[];for(let a of d){let b=(0,k.Lu)(a,c);b&&f.push(b)}for(let a of e){let b=(0,k.AB)(a,c);b&&f.push(b)}return f}async function t(a){let b=(0,m.hC)(a);return null===b?null:(0,i.xR)(b)}let u=(0,g.kS)({cliToolId:o.k,noDecision:{kind:"blocks"},capabilities:{supportedEvents:q,configScope:"none",decisionTimeoutSeconds:null,permissionHookPredictsDialog:!1,sessionStartMayArriveLate:!1,permissionReplyReleasesPrompt:!0,permissionAllowSuppressesDialog:!0,eventIdentity:"permission-id",resync:"session-status-poll",transcriptHistory:"push",stopReportsSelfResume:!1},mappers:j.lu,nativeEventNameFields:["type"],conversationIdFields:[],extractModel:j.pV,extractEventIdentity:j.oG,parsePermissionRequest:k.FZ,parseQuestion:k.v1,subscribe:(a,b)=>(0,n.bP)(a,b,a=>u.normalizeEvent(a),{resync:u.capabilities.resync}),decide:r,listPending:s,probeActivity:t,liveness:a=>(0,n.lf)(a),prepareLaunch:function({target:a,executablePath:b}){let c={command:/^[A-Za-z0-9_./-]+$/.test(b)?b:(0,e.ZL)(b),settingsPath:null,env:{}};if(!(0,e.q)())return c;let d=(0,m.hC)(a);if(null===d)return c;let f=(0,l.Lj)((0,l.Q1)(a));return{command:`${(0,e.ZL)(b)} --port ${d} --hostname ${i.Vc}`+f,settingsPath:null,env:{}}}})},99432:(a,b,c)=>{c.d(b,{l1:()=>H,JD:()=>I,S9:()=>Q,dO:()=>K});var d=c(79646),e=c(29021),f=c(21820),g=c(33873),h=c(8004),i=c(67548),j=c(15194),k=c(87447),l=c(43252),m=c(72626),n=c(73434),o=c(66007),p=c(57510);let q=(0,m.h)("lib/hooks/sources/codex/relay-install");function r(a){return(0,g.join)(a,"commandmate","cmate-agent-event.sh")}function s(a,b){var c;let d=(0,e.readFileSync)(a,"utf8");if(((0,e.existsSync)(b)?(0,e.readFileSync)(b,"utf8"):null)===d)return;(0,e.mkdirSync)((0,g.dirname)(b),{recursive:!0,mode:448});let f=(c=b,`${c}.tmp`);try{t(f),(0,e.writeFileSync)(f,d,{mode:448,flag:"wx"}),(0,e.renameSync)(f,b)}catch(a){throw t(f),a}q.info("codex-relay-installed",{target:b})}function t(a){try{(0,e.unlinkSync)(a)}catch{}}var u=c(2734);let v=(0,m.h)("lib/hooks/sources/codex/hooks-config"),w="127.0.0.1",x="commandmate:agent-hooks",y="CODEX_HOME",z="CM_AGENT_WORKTREE_ID",A="CM_AGENT_INSTANCE_ID",B="CM_HOOK_URL",C="CM_PERMISSION_HOOK_URL",D="--no-daemon",E=RegExp(`${D}(?![\\w-])`),F=new Map,G={SessionStart:"session_start",UserPromptSubmit:"user_prompt_submit",Stop:"stop",SessionEnd:"session_end"},H="PermissionRequest",I=Object.values(G);function J(){let a=process.env.CM_CODEX_HOOK_TRUST;return"bypass"===a||"never"===a||"auto"===a?a:"auto"}function K(a){if("never"===J()||"shared-read-only"===(0,i.y3)())return!1;try{if((0,e.existsSync)((0,g.join)(a,".codex","hooks.json")))return v.info("codex-hooks-trust-withheld-repo-hooks",{worktreePath:a}),!1}catch{return!1}return!0}function L(a={}){let b=(0,g.join)((0,f.homedir)(),".codex");return a.codexHome?(0,h.T)(a.codexHome,b,"CodexHookOptions.codexHome"):(0,h.T)(process.env[y],b,y)}function M(a={}){return(0,g.join)(L(a),"hooks.json")}function N(a,b){return`http://${w}:\${CM_PORT:-3000}${a}${b}`}function O(a,b){return`${JSON.stringify(function(a,b){let c=(0,p.Qd)(a)?{...a}:{},d=(0,p.Qd)(c.hooks)?c.hooks:{},e={};for(let[a,b]of Object.entries(d))e[a]=Array.isArray(b)?b.map(a=>{if(!(0,p.Qd)(a)||!Array.isArray(a.hooks))return a;let b=a.hooks.filter(a=>!((0,p.Qd)(a)&&"string"==typeof a.command&&a.command.includes(x)));return b.length===a.hooks.length?a:{...a,hooks:b}}).filter(a=>!((0,p.Qd)(a)&&Array.isArray(a.hooks))||a.hooks.length>0):b;for(let[a,c]of Object.entries(b.hooks)){let b=e[a];(void 0===b||Array.isArray(b))&&(e[a]=[...b??[],...c])}return c.hooks=e,c}(a,function(a={}){let b=(b,c)=>({hooks:[{type:"command",command:function(a,b={}){let c=` # ${x}`,d=function(a={}){if(void 0!==a.relayScriptPath)return a.relayScriptPath;let b=r(L(a));return(0,e.existsSync)(b)?b:null}(b);if(d)return[(0,l.ZL)(d),"--tool",u.c,"--event",a,"--worktree-id",`"$${z}"`,"--instance-id",`"$${A}"`,"--stdin-json"].join(" ")+c;let f=b.withAuthHeader??(0,l.yc)()?` -H "Authorization: Bearer $${l.XE}"`:"",g=`"\${${B}:-${N(l.jx,"")}}?tool=${u.c}\${${z}:+&worktreeId=$${z}}\${${A}:+&instanceId=$${A}}"`;return`curl -sS -f -m ${l.W6} -X POST -H 'Content-Type: application/json'${f} --data-binary @- ${g} >/dev/null 2>&1 || true${c}`}(b,a),timeout:c}]}),c={};for(let[a,d]of Object.entries(G)){let e="SessionEnd"===a?3:l.W6;c[a]=[b(d,e)]}return c[H]=[{hooks:[{type:"command",command:function(a={}){let b=a.withAuthHeader??(0,l.yc)()?` -H "Authorization: Bearer $${l.XE}"`:"",c=`"\${${C}:-${N(l.WZ,`?tool=${u.c}`)}}"`;return`curl -sS -f -m ${l.sI} -X POST -H 'Content-Type: application/json'${b} --data-binary @- ${c} 2>/dev/null || true # ${x}`}(a),timeout:l.sI}]}],{hooks:c}}(b)),null,2)}
7
- `}function P(a={}){let b=M(a);if(void 0===a.relayScriptPath){let b=(0,l.Os)(),c=r(L(a));try{if(b&&(0,e.existsSync)(c)&&(0,e.readFileSync)(b,"utf8")!==(0,e.readFileSync)(c,"utf8"))return v.info("codex-hooks-shared-relay-differs-readonly",{installed:c}),{usable:!1,reason:`the installed relay ${c} differs from the one this build ships`,fix:i.f0}}catch{return{usable:!1,reason:`the installed relay ${c} could not be read`,fix:i.f0}}}try{if(!(0,e.existsSync)(b))return v.info("codex-hooks-shared-absent-readonly",{settingsPath:b}),{usable:!1,reason:`${b} does not exist`,fix:i.f0};let c=(0,e.readFileSync)(b,"utf8");if(c===O(null,a))return{usable:!0,settingsPath:b};if(c===O(JSON.parse(c),a))return v.info("codex-hooks-shared-foreign-readonly",{settingsPath:b}),{usable:!1,reason:`${b} also holds hooks (or keys) CommandMate did not write, which would run in the UAT session`,fix:"Skip codex scenarios in this UAT, or run it where the shared hooks file holds only the hooks CommandMate writes."};return v.info("codex-hooks-shared-differs-readonly",{settingsPath:b}),{usable:!1,reason:`${b} differs from what this build writes`,fix:i.f0}}catch(a){return v.warn("codex-hooks-config-unreadable",{settingsPath:b,error:a instanceof Error?a.message:String(a)}),{usable:!1,reason:`${b} could not be read`,fix:i.f0}}}function Q(a,b,c={}){let f={command:a,settingsPath:null,env:{}},h=(a,b)=>{if((0,i.WM)())throw new i.ci("codex",a,b);return f};if(!(0,l.q)())return h("CM_AGENT_HOOKS_INJECT=0","Do not combine CM_AGENT_HOOKS_INJECT=0 with UAT isolation.");let m=b.instanceId??u.c;if(!(0,o.h6)(b.worktreeId)||!(0,j.n6)(m))return v.warn("codex-hooks-invalid-correlation-key",{worktreeId:b.worktreeId}),h("the worktree or instance id is not a valid correlation key","Use a valid worktree and instance id.");try{let f=function(a={}){let b=M(a),c=L(a),d=r(c);if("read-only"===(0,i.ox)("codex",[c,b,d,`${d}.tmp`,(0,g.join)(c,"config.toml")]))return function(a={}){let b=P(a);return b.usable?b.settingsPath:null}(a);void 0===a.relayScriptPath&&("own-home"===(0,i.y3)()?function(a,b){if(!b)throw Error("this build ships no relay script");let c=r(a);if(b!==c&&s(b,c),!(0,e.existsSync)(c)||(0,e.readFileSync)(c,"utf8")!==(0,e.readFileSync)(b,"utf8"))throw Error(`the installed relay ${c} differs from the one this build ships`)}(c,(0,l.Os)()):function(a,b){let c=r(a);if(b&&b!==c)try{s(b,c)}catch(a){q.warn("codex-relay-install-failed",{target:c,error:a instanceof Error?a.message:String(a)})}(0,e.existsSync)(c)}(c,(0,l.Os)()));let f=null,h=null;if((0,e.existsSync)(b))try{h=(0,e.readFileSync)(b,"utf8"),f=JSON.parse(h)}catch(a){return v.warn("codex-hooks-config-unreadable",{settingsPath:b,error:a instanceof Error?a.message:String(a)}),null}let j=O(f,a);return h===j||((0,e.mkdirSync)((0,g.dirname)(b),{recursive:!0,mode:448}),(0,e.writeFileSync)(b,j,{mode:384})),b}(c);if(!f){let a="shared-read-only"===(0,i.y3)()?P(c):null;if(a&&!a.usable)return h(a.reason,a.fix);return h(`${M(c)} or its relay is missing or differs from what this build writes`,i.f0)}let j=c.port??(0,k.D0)(),o=new URLSearchParams({tool:u.c,worktreeId:b.worktreeId,instanceId:m}),p={[y]:L(c),CM_AGENT_TOOL:u.c,[z]:b.worktreeId,[A]:m,[B]:`http://${w}:${j}${l.jx}`,[C]:`http://${w}:${j}${l.WZ}?${o.toString()}`},t=c.supportsNoDaemon??function(a){let b=F.get(a);if(void 0!==b)return b;let c=!1;try{let b=(0,d.spawnSync)(a,["--help"],{encoding:"utf8",timeout:5e3,env:(0,n.hh)()});c=!b.error&&0===b.status&&E.test(String(b.stdout??""))}catch{c=!1}return F.set(a,c),c}(a)?` ${D}`:"",x="bypass"===J()?" --dangerously-bypass-hook-trust":"";return{command:`${(0,l.ZL)(a)} -c features.daemon_auto_start=false${t}${x}`,settingsPath:f,env:p}}catch(a){if(a instanceof i.ci)throw a;return v.warn("codex-hooks-config-write-failed",{worktreeId:b.worktreeId,error:a instanceof Error?a.message:String(a)}),h(`the hook config could not be prepared (${a instanceof Error?a.message:String(a)})`,i.f0)}}}};
3
+ ${b}`}(a)});continue}if("tool_use"===f.type){b.push({kind:"tool",text:function(a){let b=a.toolName??"tool";return a.toolDetail?`- \`${b}\` — ${a.toolDetail}`:`- \`${b}\``}(f)}),e+=1;continue}A.has(f.type)||c.add(f.type)}let g=(0,f.t3)(b).body;return g=(0,f.mg)(g,i,j),{sessionId:a.sessionId,promptUuid:a.promptUuid,body:g,textBlocks:d,toolBlocks:e,unknownBlockTypes:[...c]}}},32301:(a,b,c)=>{c.d(b,{VV:()=>Q,RH:()=>M,rE:()=>N,yw:()=>L,tc:()=>P});var d=c(36925),e=c(3161),f=c(72626),g=c(57510),h=c(34114),i=c(95375),j=c(86594),k=c(98322),l=c(38892),m=c(71193);let n=(0,f.h)("lib/hooks/sources/opencode-v2/history"),o=["session.execution.succeeded","session.execution.failed","session.execution.interrupted"];function p(a){return null!==a&&o.includes(a)}function q(a){return"number"==typeof a&&Number.isFinite(a)?a:null}function r(a){let b=(0,g.Qd)(a.time)?a.time:null;return q(b?.created)??0}function s(a){return a.filter(g.Qd).filter(a=>null!==(0,g.O2)(a,"id")).map((a,b)=>({message:a,index:b})).sort((a,b)=>{let c=r(a.message)-r(b.message);if(0!==c)return c;let d=(0,g.O2)(a.message,"id")??"",e=(0,g.O2)(b.message,"id")??"";return d<e?-1:d>e?1:a.index-b.index}).map(({message:a})=>a)}let t=(0,d.v)("__opencodeV2HistoryQueue",()=>new Map);function u(a,b){let c=(t.get(a)??Promise.resolve()).then(b,b),d=c.then(()=>void 0,()=>void 0);return t.set(a,d),d.then(()=>{t.get(a)===d&&t.delete(a)}),c}async function v(a,b,c){let d=[],e=null;for(let f=0;f<5;f+=1){let i=await (0,h.VW)(a,b,c,e);if(null===i)return 0===f?null:d;if(d.push(...i.data),i.data.some(a=>(0,g.Qd)(a)&&"user"===(0,g.O2)(a,"type"))||null===i.next||0===i.data.length)break;e=i.next}return d}async function w(a,b){let[{getDbInstance:d},{findMessageByRequestId:e}]=await Promise.all([Promise.resolve().then(c.bind(c,88807)),Promise.resolve().then(c.bind(c,56791))]);return null!==e(d(),a.worktreeId,(0,j.jT)(b))}async function x(a,b,c,d){let e=[],f=null;for(let i=0;i<5;i+=1){let j=await (0,h.VW)(b,c,d,f);if(null===j)return{entries:e,unreadable:!0,pages:i,truncated:!1};if(e.push(...j.data),null===j.next||0===j.data.length)return{entries:e,unreadable:!1,pages:i+1,truncated:!1};if(4===i)return{entries:e,unreadable:!1,pages:i+1,truncated:function(a){for(let b of s(a)){let a=(0,g.O2)(b,"type");if("user"===a)break;if("assistant"===a)return!0}return!1}(e)||await y(a,j.data)};f=j.next}return{entries:e,unreadable:!1,pages:5,truncated:!1}}async function y(a,b){for(let c of b){if(!(0,g.Qd)(c)||"user"!==(0,g.O2)(c,"type"))continue;let b=(0,g.O2)(c,"id");if(null!==b&&!await w(a,b))return!0}return!1}async function z(a,b,d){let e=a.instanceId??a.cliToolId;if(0===b.body.length)return n.info("opencode-v2-history-turn-empty",{worktreeId:a.worktreeId,instanceId:e,sessionId:b.sessionId}),!1;b.unknownPartTypes.length>0&&n.info("opencode-v2-history-unknown-parts",{worktreeId:a.worktreeId,instanceId:e,sessionId:b.sessionId,partTypes:b.unknownPartTypes});let f=(0,j.jT)(b.userMessageId),[{getDbInstance:g},{createMessage:h,findMessageByRequestId:i},{broadcastMessage:k}]=await Promise.all([Promise.resolve().then(c.bind(c,88807)),Promise.resolve().then(c.bind(c,56791)),Promise.all([c.e(1356),c.e(1503),c.e(1191),c.e(8791),c.e(1719),c.e(2119),c.e(2445),c.e(8728)]).then(c.bind(c,43015))]),l=g();if(i(l,a.worktreeId,f))return!1;let m=h(l,{worktreeId:a.worktreeId,role:"assistant",content:b.body,messageType:"normal",timestamp:new Date(d>0?d:Date.now()),cliToolId:a.cliToolId,instanceId:e,requestId:f});return k("message",{worktreeId:a.worktreeId,message:m}),n.info("opencode-v2-history-turn-saved",{worktreeId:a.worktreeId,instanceId:e,sessionId:b.sessionId,requestId:f,bodyLength:b.body.length,textParts:b.textParts,toolParts:b.toolParts}),!0}async function A(a,b,c,d){d()&&(0,i.recordAgentReportedModel)(a.worktreeId,m.B,a.instanceId??m.B,function(a){let b=null;for(let c of a){if(!(0,g.Qd)(c)||"assistant"!==(0,g.O2)(c,"type"))continue;let a=(0,g.NZ)(c,["model","id"]);if(null===a)continue;let d=r(c),e=(0,g.O2)(c,"id")??"";(null===b||d>b.at||d===b.at&&e>b.id)&&(b={at:d,id:e,model:a})}return b?.model??null}(c));let e=(function(a,b){let c=s(a),d=[],e=null,f=a=>{e&&d.push({...e,closed:a}),e=null};for(let a of c){let c=(0,g.O2)(a,"id"),d=(0,g.O2)(a,"type");if("user"===d){f(!0),e={accumulator:(0,k.lp)(b,c,r(a)),completedAt:null};continue}if(!e)continue;let h=e;if("idle"===d){f(!0);continue}if("assistant"!==d)continue;h.accumulator.assistantMessageIds.add(c),(Array.isArray(a.content)?a.content:[]).forEach((a,b)=>{let d=function(a,b,c){if(!(0,g.Qd)(c))return null;let d=(0,g.O2)(c,"type");if(!d)return null;let e=(0,g.Qd)(c.state)?c.state:null;return{id:`${a}#${b}`,messageId:a,type:d,text:"string"==typeof c.text?c.text:null,tool:"tool"===d?(0,g.O2)(c,"name"):null,status:e?(0,g.O2)(e,"status"):null,title:e?(0,g.O2)(e,"title"):null,error:e?(0,g.O2)(e,"error")??(0,g.NZ)(e,["error","message"]):null}}(c,b,a);d&&(0,k.yG)(h.accumulator,d)});let i=(0,g.Qd)(a.time)?a.time:null,j=q(i?.completed)??q(i?.created);null!==j&&j>(h.completedAt??0)&&(h.completedAt=j)}return f(!1),d})(c,b).filter(a=>a.closed),f=e.slice(-50),h=0;for(let b of e.slice(0,e.length-f.length))await w(a,b.accumulator.userMessageId)||(h+=1);let j=0;for(let b of f){let c=(0,k.JZ)(b.accumulator),d=Math.max(b.accumulator.startedAt,b.completedAt??0);await z(a,c,d)&&(j+=1)}return{written:j,droppedUnsaved:h}}var B=c(51719);let C=(0,f.h)("lib/hooks/sources/opencode-v2/usage");function D(a,b){let c=a[b];return"number"==typeof c&&Number.isFinite(c)&&c>0?c:0}async function E(a,b,c,d=()=>!0){try{let f=(0,l.X3)(a);if(null===f)return null;let i=await (0,h.u7)(b,f,c),j=(0,e.Yv)(i,Date.now());if(!j||!j.id)return null;let k=j.provider,m=j.model,[n,o]=await Promise.all([(0,h.nR)(b,f,j.id),k&&m?(0,h.am)(b,f):Promise.resolve(null)]),p=n?function(a){let b=null;for(let c of a){if(!(0,g.Qd)(c)||"assistant"!==(0,g.O2)(c,"type"))continue;let a=(0,g.Qd)(c.tokens)?c.tokens:null;if(!a)continue;let d=D(a,"output");if(d<=0)continue;let e=(0,g.Qd)(a.cache)?a.cache:{},f=D(a,"input")+d+D(a,"reasoning")+D(e,"read")+D(e,"write"),h=function(a){let b=(0,g.Qd)(a.time)?a.time:null,c=b?.created;return"number"==typeof c&&Number.isFinite(c)?c:0}(c),i=(0,g.O2)(c,"id")??"";(null===b||h>b.at||h===b.at&&i>b.id)&&(b={at:h,id:i,total:f})}return b?.total??null}(n):null,q=o&&k&&m?function(a,b,c){for(let d of a){if(!(0,g.Qd)(d)||d.providerID!==b||d.id!==c)continue;let a=(0,g.Qd)(d.limit)?d.limit:null,e=a?.context;if("number"!=typeof e||!Number.isFinite(e)||e<=0)break;return e}return null}(o,k,m):null;if(!d())return null;return(0,e.G1)(a,j),(0,e.T9)(a,{tokens:p,limit:q,percent:(0,e.sI)(p,q),sessionAt:j.at,at:Date.now()}),j}catch(c){return C.warn("opencode-v2-usage-refresh-failed",{worktreeId:a.worktreeId,instanceId:a.instanceId??a.cliToolId,port:b,error:c instanceof Error?c.message:String(c)}),null}}let F=(0,d.v)("__opencodeV2UsageRefreshes",()=>new Map),G=(0,f.h)("lib/hooks/sources/opencode-v2/subscription"),H=[500,1e3,2e3,4e3,8e3,15e3,3e4],I=[2e3,5e3,15e3],J=(0,d.v)("__opencodeV2Subscriptions",()=>new Map),K=(0,d.v)("__opencodeV2EndedLiveness",()=>new Map);function L(a){return J.has((0,l.Y_)(a))}function M(a){let b=(0,l.Y_)(a);return J.get(b)?.liveness??K.get(b)??{state:"unknown"}}function N(a){return"live"===M(a).state}function O(a){return{close:async()=>{await Q(a.target)},get liveness(){return a.liveness}}}function P(a,b,c,d){let e=(0,l.Y_)(a),f=J.get(e);if(f)return O(f);K.delete(e);let g={key:e,target:a,port:b,onEvent:c,normalize:d,streamController:new AbortController,lifetimeController:new AbortController,liveness:{state:"unknown"},closed:!1,watchdog:null,connectedOnce:!1,currentSessionId:null,recoverySessions:new Map,recoveryController:new AbortController};return J.set(e,g),G.info("opencode-v2-subscription-opened",{worktreeId:a.worktreeId,instanceId:a.instanceId??a.cliToolId,port:b}),W(g),O(g)}async function Q(a){let b=(0,l.Y_)(a);K.delete(b);let c=J.get(b);c&&(R(c),J.delete(b),(0,e.cI)(a),G.info("opencode-v2-subscription-closed",{worktreeId:a.worktreeId,instanceId:a.instanceId??a.cliToolId,port:c.port}))}function R(a){a.closed=!0,T(a),a.streamController.abort(),a.lifetimeController.abort(),a.recoveryController.abort()}function S(a,b){R(a),a.liveness={state:"lost",since:Date.now(),reason:b},J.get(a.key)===a&&J.delete(a.key),K.set(a.key,a.liveness),(0,e.cI)(a.target),G.warn("opencode-v2-subscription-ended",{worktreeId:a.target.worktreeId,instanceId:a.target.instanceId??a.target.cliToolId,port:a.port,reason:b})}function T(a){null!==a.watchdog&&(clearTimeout(a.watchdog),a.watchdog=null)}function U(a){a.liveness={state:"live",lastHeartbeatAt:Date.now()},T(a);let b=setTimeout(()=>{a.closed||(G.warn("opencode-v2-subscription-heartbeat-lost",{worktreeId:a.target.worktreeId,instanceId:a.target.instanceId??a.target.cliToolId,port:a.port,afterMs:6e4}),a.streamController.abort())},6e4);b.unref?.(),a.watchdog=b}function V(a,b){return new Promise(c=>{if(b.aborted)return void c();let d=()=>{clearTimeout(e),c()};b.addEventListener("abort",d,{once:!0});let e=setTimeout(()=>{b.removeEventListener("abort",d),c()},a);e.unref?.()})}async function W(a){let b=0,c=0;for(;!a.closed;){a.streamController=new AbortController;let d="stream-ended";try{let e=(0,l.X3)(a.target);if(null===e)return void S(a,"password-file-missing");let f=await (0,h.tJ)(a.port,e);if(a.closed)return;if("rejected"===f.kind){if(c+=1,d=`server-rejected-${f.status}`,c>=3)return void S(a,"port-identity-changed")}else if("unreachable"===f.kind)d="server-unreachable";else{c=0;let d=await (0,h.MT)(a.port,e,a.streamController.signal),f=a.connectedOnce;for await(let c of(a.connectedOnce=!0,U(a),b=0,await X(a.target,a.port,e,b=>Z(a,b)),f&&$(a)&&function(a){a.recoveryController.abort();let b=new AbortController;a.recoveryController=b,Y(a,b.signal).catch(b=>{G.warn("opencode-v2-history-recovery-failed",{worktreeId:a.target.worktreeId,instanceId:a.target.instanceId??a.target.cliToolId,error:b instanceof Error?b.message:String(b)})})}(a),d)){if(a.closed)break;U(a),"frame"===c.kind&&Z(a,c.frame)}}}catch(a){d=a instanceof Error?a.message:String(a)}finally{T(a)}if(a.closed)return;a.liveness={state:"lost",since:Date.now(),reason:d},a.recoveryController.abort(),null!==a.currentSessionId&&a.recoverySessions.set(a.currentSessionId,{lostAt:a.liveness.since}),G.info("opencode-v2-subscription-disconnected",{worktreeId:a.target.worktreeId,instanceId:a.target.instanceId??a.target.cliToolId,port:a.port,reason:d,attempt:b}),await V(H[Math.min(b,H.length-1)],a.lifetimeController.signal),b+=1}}async function X(a,b,c,d){let e=0;try{let[f,i]=await Promise.all([(0,h.LO)(b,c),(0,h.CI)(b,c)]),j=(b,c,f)=>{let h=(b??[]).filter(g.Qd),i=h.slice(0,50);for(let b of(h.length>i.length&&G.warn("opencode-v2-resync-truncated",{worktreeId:a.worktreeId,instanceId:a.instanceId??a.cliToolId,type:c,examined:i.length,skipped:h.length-i.length,limit:50}),i)){let a="string"==typeof b.id&&""!==b.id?b.id:null;null!==a&&(d({id:`resync_${a}`,type:c,data:f(b)}),e+=1)}};j(f,"permission.asked",a=>a),j(i,"form.created",a=>({form:a}))}catch(b){G.warn("opencode-v2-resync-failed",{worktreeId:a.worktreeId,instanceId:a.instanceId??a.cliToolId,error:b instanceof Error?b.message:String(b)})}return e>0&&G.info("opencode-v2-resync",{worktreeId:a.worktreeId,instanceId:a.instanceId??a.cliToolId,replayed:e}),e}async function Y(a,b){let c=()=>!b.aborted&&$(a);for(let d=0;;d+=1){if(!c())return;let e=[...a.recoverySessions];if(0===e.length)return;for(let[b,d]of e){if(!c())return;(await function(a,b,c,d={}){let e=d.isCurrent??(()=>!0);return u((0,l.Y_)(a),async()=>{let d=a.instanceId??a.cliToolId;try{let f=(0,l.X3)(a);if(null===f)return n.info("opencode-v2-history-unavailable",{worktreeId:a.worktreeId,instanceId:d,reason:"password-file-missing"}),{written:0,unreadable:!1};let g=await x(a,b,f,c);if(g.unreadable&&0===g.entries.length)return n.warn("opencode-v2-history-unavailable",{worktreeId:a.worktreeId,instanceId:d,port:b,sessionId:c,reason:"messages-unreadable"}),{written:0,unreadable:!0};let{written:h,droppedUnsaved:i}=await A(a,c,g.entries,e);return(g.truncated||i>0)&&n.warn("opencode-v2-history-recovery-truncated",{worktreeId:a.worktreeId,instanceId:d,sessionId:c,pages:g.pages,droppedTurns:i}),{written:h,unreadable:g.unreadable}}catch(e){return n.error("opencode-v2-history-sync-failed",{worktreeId:a.worktreeId,instanceId:d,port:b,sessionId:c,recovery:!0,error:e instanceof Error?e.message:String(e)}),{written:0,unreadable:!0}}})}(a.target,a.port,b,{isCurrent:()=>_(a,b)})).unreadable||a.recoverySessions.get(b)!==d||a.recoverySessions.delete(b)}if(0===a.recoverySessions.size||!c())return;if(d>=I.length){let b=[...a.recoverySessions].filter(([,a])=>e.some(([,b])=>b===a));for(let[c]of(G.warn("opencode-v2-history-recovery-failed",{worktreeId:a.target.worktreeId,instanceId:a.target.instanceId??a.target.cliToolId,port:a.port,sessionIds:b.map(([a])=>a),attempts:d+1}),b))a.recoverySessions.delete(c);return}await V(I[d],b)}}function Z(a,b){let c=(0,B.lx)(b);null!==c&&(a.currentSessionId=c);try{!function(a,b,c,d=Date.now()){if(!(0,B.cT)((0,B.Cr)(a)))return;let e=b({payload:a,receivedAt:d});e&&c(e)}(b,a.normalize,a.onEvent)}catch(c){G.warn("opencode-v2-frame-delivery-failed",{worktreeId:a.target.worktreeId,instanceId:a.target.instanceId??a.target.cliToolId,type:(0,B.Cr)(b),error:c instanceof Error?c.message:String(c)})}(function(a,b,c,d=()=>!0){try{if(!p((0,B.Cr)(c)))return null;let e=(0,B.lx)(c);if(null===e)return null;!function(a,b,c,d=()=>!0){u((0,l.Y_)(a),async()=>{let e=a.instanceId??a.cliToolId;try{let f=(0,l.X3)(a);if(null===f)return n.info("opencode-v2-history-unavailable",{worktreeId:a.worktreeId,instanceId:e,reason:"password-file-missing"}),0;let g=await v(b,f,c);if(null===g)return n.warn("opencode-v2-history-unavailable",{worktreeId:a.worktreeId,instanceId:e,port:b,sessionId:c,reason:"messages-unreadable"}),0;return(await A(a,c,g,d)).written}catch(d){return n.error("opencode-v2-history-sync-failed",{worktreeId:a.worktreeId,instanceId:e,port:b,sessionId:c,error:d instanceof Error?d.message:String(d)}),0}})}(a,b,e,d)}catch(b){return G.warn("opencode-v2-history-trigger-failed",{worktreeId:a.worktreeId,instanceId:a.instanceId??a.cliToolId,error:b instanceof Error?b.message:String(b)}),null}})(a.target,a.port,b,()=>null!==c&&_(a,c)),function(a,b,c,d=()=>!0){try{var e;if(!("session.usage.updated"===(e=(0,B.Cr)(c))||p(e)))return null;let f=(0,B.lx)(c);if(null===f)return null;!function(a,b,c,d=()=>!0){let e=(0,l.Y_)(a),f=F.get(e);if(f)return f.queued={port:b,sessionId:c,isCurrent:d},f.running;let g={running:Promise.resolve(),queued:null};g.running=(async()=>{let f={port:b,sessionId:c,isCurrent:d};for(;null!==f;){let b=f;g.queued=null,await E(a,b.port,b.sessionId,b.isCurrent),f=g.queued}F.get(e)===g&&F.delete(e)})(),F.set(e,g),g.running}(a,b,f,d)}catch(b){return G.warn("opencode-v2-usage-trigger-failed",{worktreeId:a.worktreeId,instanceId:a.instanceId??a.cliToolId,error:b instanceof Error?b.message:String(b)}),null}}(a.target,a.port,b,()=>$(a))}function $(a){return!a.closed&&J.get(a.key)===a}function _(a,b){return $(a)&&a.currentSessionId===b}},38367:(a,b,c)=>{c.d(b,{Jp:()=>h,WK:()=>e,lb:()=>f,ue:()=>g});var d=c(57510);let e={Stop:"stop",SubagentStop:"stop",Notification:"notification",SessionStart:"session_start",SessionEnd:"session_end",UserPromptSubmit:"user_prompt_submit",PreToolUse:"pre_tool_use",PostToolUse:"post_tool_use"},f=["session_id","conversationId"],g=["tool_use_id"];function h(a,b){let c="notification"===a?"notification_type":"session_end"===a?"reason":"session_start"===a?"source":"pre_tool_use"===a||"post_tool_use"===a?"tool_name":null;return null===c?null:(0,d.Wv)((0,d.O2)(b,c))}},40964:(a,b,c)=>{c.d(b,{s4:()=>j,NN:()=>m,Ze:()=>k,mf:()=>l});var d=c(15194);let e=/^[a-zA-Z0-9_-]+$/;function f(a){if(!e.test(a))throw Error(`Invalid session name format: ${a}`)}var g=c(15608);let h="mcbd-",i=/^[0-9a-f]{8}$/;function j(){return globalThis.__cmTmuxSessionNamespace??null}function k(a,b,c,e){var g=null===a?h:`${h}${a}-`;let i=`${g}${b}-${c}`;if(!e||e===b)return f(i),i;let j=(0,d.pL)(e,b),k=j?`${i}-${j}`:i;return f(k),k}function l(a,b,c){let d=j(),e=k(d,a,b,c);return null===d?e:(0,g.mc)(e)??e}function m(a){if(!a.startsWith(h))return null;let b=a.slice(h.length),c=null,e=b.indexOf("-");e>0&&i.test(b.slice(0,e))&&(c=b.slice(0,e),b=b.slice(e+1));let f=[...d.XH].sort((a,b)=>b.length-a.length).find(a=>b.startsWith(`${a}-`));if(!f)return null;let g=b.slice(f.length+1);return""===g?null:{namespace:c,cliToolId:f,rest:g}}},51719:(a,b,c)=>{c.d(b,{Ai:()=>g,Cr:()=>l,DH:()=>o,Dg:()=>q,IQ:()=>p,ZL:()=>r,cT:()=>k,dA:()=>i,er:()=>h,lx:()=>n,xz:()=>f,y8:()=>s});var d=c(62887),e=c(57510);let f="permission_prompt",g="question_prompt",h=d.KC,i="error",j=["session.execution.started","session.execution.succeeded","session.execution.failed","session.execution.interrupted","permission.asked","permission.replied","form.created","form.replied","form.cancelled"];function k(a){return null!==a&&j.includes(a)}function l(a){return(0,e.NZ)(a,["type"])}function m(a){return(0,e.Qd)(a.data)?a.data:{}}function n(a){return(0,e.NZ)(m(a),["sessionID"])??(0,e.NZ)(m(a),["form","sessionID"])??(0,e.NZ)(a,["durable","aggregateID"])}function o(a){let b=m(a);switch(l(a)){case"permission.asked":return(0,e.NZ)(b,["id"]);case"form.created":return(0,e.NZ)(b,["form","id"])??(0,e.NZ)(b,["id"]);case"permission.replied":return(0,e.NZ)(b,["requestID"])??(0,e.NZ)(b,["id"]);case"form.replied":case"form.cancelled":return(0,e.NZ)(b,["formID"])??(0,e.NZ)(b,["id"])??(0,e.NZ)(b,["requestID"]);default:return null}}function p(a){return(0,e.hY)(o(a))}function q(a){return(0,e.NZ)(m(a),["action"])}function r(a){let b=m(a);return(0,e.NZ)(b,["error","message"])??(0,e.NZ)(b,["error","data","message"])??(0,e.NZ)(b,["error","name"])??(0,e.NZ)(b,["message"])}let s=[(0,e.KR)("session.execution.started","user_prompt_submit"),(0,e.KR)("session.execution.succeeded","stop"),(0,e.KR)("session.execution.interrupted","stop"),(0,e.KR)("session.execution.failed","stop",i),(0,e.KR)("permission.asked","notification",f),(0,e.KR)("permission.replied","notification",h),(0,e.KR)("form.created","notification",g),(0,e.KR)("form.replied","notification",h),(0,e.KR)("form.cancelled","notification",h)].map(a=>(b,c)=>{let d=a(b,c);return d?{...d,conversationId:d.conversationId??n(c)}:null})},54362:(a,b,c)=>{c.d(b,{D8:()=>m,zW:()=>l});var d=c(67548),e=c(62887),f=c(13287),g=c(66101),h=c(57510),i=c(83730),j=c(76835);let k={decision:"ask"};function l(a){return(0,h.Qd)(a)?(0,f.LD)((0,h.O2)(a,"conversationId"),a.stepIdx):null}let m=(0,g.UB)({cliToolId:j.F,noDecision:{kind:"proceeds"},capabilities:{supportedEvents:["session_start","post_tool_use","stop"],configScope:"global-singleton",decisionTimeoutSeconds:i.hp,permissionHookPredictsDialog:!1,sessionStartMayArriveLate:!1,permissionReplyReleasesPrompt:!1,permissionAllowSuppressesDialog:!1,eventIdentity:null,resync:"none",transcriptHistory:"pull",stopReportsSelfResume:!0},mappers:[],nativeEventNameFields:[],conversationIdFields:["conversationId"],toolCallIdFields:[],modelFields:["modelName"],extractDetail:function(a,b){return"pre_tool_use"===a||"post_tool_use"===a?(0,h.Wv)((0,h.NZ)(b,["toolCall","name"])):"stop"===a&&!1===b[i.a1]?e.HV:null},parsePermissionRequest:function(a){if(!(0,h.Qd)(a))return null;let b=a.toolCall;if(!(0,h.Qd)(b))return null;let c=(0,h.O2)(b,"name");return c&&!(c.length>f.vy)&&(0,h.Qd)(b.args)?{toolName:c,toolInput:b.args,promptId:null,sessionId:(0,h.O2)(a,"conversationId"),permissionMode:null,permissionSuggestions:null}:null},parseQuestion:()=>null,encodeVerdict:function(a){return"allowOnce"===a.kind?{decision:"allow"}:"deny"===a.kind?{decision:"deny",reason:a.message??""}:{...k}},prepareLaunch:({target:a,executablePath:b})=>{let c=(0,i.Gw)();if(null===c&&(0,d.WM)()){if("own-home"===(0,d.y3)())throw new d.ci("antigravity","~/.gemini/config/hooks.json could not be prepared",d.f0);let a=(0,i.NO)();throw a.usable?new d.ci("antigravity","~/.gemini/config/hooks.json could not be prepared",d.f0):new d.ci("antigravity",a.reason,a.fix)}let{command:e,env:f}=(0,i.bh)(b,{worktreeId:a.worktreeId,instanceId:a.instanceId,cliToolId:j.F});return{command:e,settingsPath:c,env:f}}})},66101:(a,b,c)=>{c.d(b,{Kf:()=>k,UB:()=>i,kS:()=>j});var d=c(62887),e=c(57510),f=c(25071);let g={close:async()=>{},liveness:{state:"unknown"}};function h(a,b,c){let f=c.receivedAt??Date.now(),g=b.length>0?(0,e.oJ)(c.payload,b):null;if(null!=c.event&&(0,d.o0)(c.event))return(0,e.Uq)({event:c.event},c.payload,f,{detail:a.extractDetail,conversationId:a.conversationIdFields,toolCallId:a.toolCallIdFields,modelFields:a.modelFields,extractModel:a.extractModel});let h=(0,e.qU)(a.mappers,g,c.payload);return h?(0,e.Uq)(h,c.payload,f,{detail:a.extractDetail,conversationId:a.conversationIdFields,toolCallId:a.toolCallIdFields,modelFields:a.modelFields,extractModel:a.extractModel}):((0,e.ex)(a.cliToolId,g),null)}function i(a){let b=a.nativeEventNameFields??["hook_event_name"];return{cliToolId:a.cliToolId,transport:"push",noDecision:a.noDecision,capabilities:a.capabilities,normalizeEvent:c=>h(a,b,c),eventIdentityOf:b=>a.extractEventIdentity?.(b)??null,promptJoinsOpenTurn:b=>a.promptJoinsOpenTurn?.(b)??!1,parsePermissionRequest:a.parsePermissionRequest,parseQuestion:a.parseQuestion,encodeVerdict:b=>({kind:"responseBody",body:a.encodeVerdict(b)}),prepareLaunch:a.prepareLaunch,subscribe:async()=>g,async decide(b,c,d){let e=(0,f.o4)(b,c.id,a.encodeVerdict(d));(0,f.oy)(b,c.id,{delivered:e,reason:e?"response-body":"slot-closed"})},listPending:async a=>(0,f.qK)(a),probeActivity:async()=>null,liveness:()=>({state:"unknown"})}}function j(a){let b=a.nativeEventNameFields??["type"];return{cliToolId:a.cliToolId,transport:"pull",noDecision:a.noDecision,capabilities:a.capabilities,normalizeEvent:c=>h(a,b,c),eventIdentityOf:b=>a.extractEventIdentity?.(b)??null,parsePermissionRequest:a.parsePermissionRequest,parseQuestion:a.parseQuestion,encodeVerdict:()=>({kind:"outOfBand"}),prepareLaunch:a.prepareLaunch??(a=>({command:a.executablePath,settingsPath:null,env:{}})),subscribe:a.subscribe,decide:a.decide,listPending:a.listPending,probeActivity:a.probeActivity,liveness:a.liveness}}function k(a,b,c){let d="pull"===a.transport?"sse":0===a.capabilities.supportedEvents.length?"scraper":"hooks";if("sse"!==d)return{kind:d};switch(b.state){case"live":return c-b.lastHeartbeatAt>=3e4?{kind:"sse",liveness:"stale",degradedReason:"heartbeat_stale"}:{kind:"sse",liveness:"live"};case"lost":return{kind:"scraper",liveness:"stale",degradedReason:b.reason};case"unknown":return{kind:"scraper",degradedReason:"not_subscribed"}}}},70096:(a,b,c)=>{c.d(b,{VM:()=>af});var d=c(2466),e=c(13287),f=c(67548),g=c(62887),h=c(43252),i=c(66101),j=c(57510),k=c(38367),l=c(34257);let m="<task-notification>";var n=c(29021),o=c(21820),p=c(33873),q=c(16659),r=c(30451);let s=/<task-id>([^<]+)<\/task-id>/;function t(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function u(a){return"string"==typeof a&&a.length>0?a:null}function v(a){return"string"==typeof a&&a.trimStart().startsWith(m)?s.exec(a)?.[1]??null:null}var w=c(70997);let x={};function y(a){return"allowOnce"!==a.kind?x:{hookSpecificOutput:{hookEventName:e.l9,decision:{behavior:"allow"}}}}let z=(0,i.UB)({cliToolId:w.v,noDecision:{kind:"proceeds"},capabilities:{supportedEvents:g.b0,configScope:"per-instance",decisionTimeoutSeconds:h.sI,permissionHookPredictsDialog:!0,sessionStartMayArriveLate:!1,permissionReplyReleasesPrompt:!1,permissionAllowSuppressesDialog:!0,eventIdentity:null,resync:"none",transcriptHistory:"pull",stopReportsSelfResume:!0},mappers:[...(0,j.mJ)(k.WK),l.Bo],nativeEventNameFields:["hook_event_name"],conversationIdFields:k.lb,toolCallIdFields:k.ue,modelFields:["model"],extractModel:l._P,promptJoinsOpenTurn:function(a){if(!0===a.queuedNotice)return!0;let b=a.prompt;return"string"==typeof b&&b.trimStart().startsWith(m)},extractDetail:function(a,b){return"stop"===a&&function(a,b={}){let c=u(a.transcript_path);if(!c)return!1;let d=(0,p.join)(b.homeDir??(0,o.homedir)(),...r.lc),e=(0,q.sx)(d,".jsonl",c);if(!e)return!1;let f=function(a,b){let c=null;try{c=(0,n.openSync)(a,"r");let d=(0,n.fstatSync)(c).size,e=Math.max(0,d-b),f=Buffer.alloc(d-e),g=0;for(;g<f.length;){let a=(0,n.readSync)(c,f,g,f.length-g,e+g);if(0===a)break;g+=a}let h=f.subarray(0,g).toString("utf8");return 0===e?h:h.slice(h.indexOf("\n")+1)}catch{return null}finally{if(null!==c)try{(0,n.closeSync)(c)}catch{}}}(e,b.tailBytes??4194304);return null!==f&&function(a){let b=[],c=new Set;for(let d of a.split("\n")){let a;if(""!==d.trim()){try{a=JSON.parse(d)}catch{continue}if(t(a)&&!0!==a.isSidechain){if("user"===a.type){let d=a.toolUseResult;if(t(d)){let a=function(a){let b=u(a.backgroundTaskId);if(b)return b;let c=u(a.taskId);if(c&&!1===a.persistent)return c;let d=u(a.agentId);return d&&!0===a.isAsync?d:null}(d);a&&b.push(a);let e=u(d.task_id);e&&c.add(e)}for(let b of function(a){let b=a.message;if(!t(b))return[];let c=b.content;return"string"==typeof c?[c]:Array.isArray(c)?c.filter(t).filter(a=>"text"===a.type).map(a=>a.text):[]}(a)){let a=v(b);a&&c.add(a)}}else if("attachment"===a.type&&t(a.attachment)){if("queued_command"!==a.attachment.type)continue;let b=v(a.attachment.prompt);b&&c.add(b)}}}}return[...new Set(b)].filter(a=>!c.has(a))}(f).length>0}(b)?g.HV:(0,k.Jp)(a,b)},parsePermissionRequest:a=>(0,e.ss)(a),parseQuestion:a=>(0,d.ek)(a),encodeVerdict:y,prepareLaunch:({target:a,executablePath:b})=>{let c="own-home"===(0,f.y3)(),d={worktreeId:a.worktreeId,instanceId:a.instanceId,cliToolId:a.cliToolId};(0,h.q)()&&(0,f.Hx)(w.v,[(0,h.K6)(),(0,h.iR)(d)]);let e=(0,h.D2)(b,d);if(c&&e===b)throw new f.ci(w.v,(0,h.q)()?"the hook settings file could not be written":"CM_AGENT_HOOKS_INJECT=0",(0,h.q)()?"Make CM_AGENT_HOOKS_DIR writable by the dedicated user.":"Do not combine CM_AGENT_HOOKS_INJECT=0 with own-home.");let g=(0,h.q)()&&e!==b?(0,h.iR)({worktreeId:a.worktreeId,instanceId:a.instanceId,cliToolId:a.cliToolId}):null;return{command:(0,f.WM)()?`${e} --setting-sources ${f.mc}`:e,settingsPath:g,env:{}}}});var A=c(92196),B=c(21758),C=c(54633);let D={},E=(0,i.UB)({cliToolId:C.V,noDecision:{kind:"proceeds"},capabilities:{supportedEvents:["stop","session_start","session_end","user_prompt_submit","post_tool_use"],configScope:"global-singleton",decisionTimeoutSeconds:B.TV,permissionHookPredictsDialog:!1,sessionStartMayArriveLate:!0,permissionReplyReleasesPrompt:!1,permissionAllowSuppressesDialog:!0,eventIdentity:null,resync:"none",transcriptHistory:null,stopReportsSelfResume:!1},mappers:(0,j.mJ)(k.WK),nativeEventNameFields:["hook_event_name"],conversationIdFields:k.lb,toolCallIdFields:k.ue,extractDetail:k.Jp,parsePermissionRequest:function(a){if(!(0,j.Qd)(a)||a.hook_event_name!==B.cN)return null;let b=(0,j.O2)(a,"tool_name");if(!b||b.length>e.vy)return null;let c=(0,A.mw)(a.tool_input);return c?{toolName:b,toolInput:c.toolInput,toolInputNormalization:c.normalization,promptId:null,sessionId:(0,j.O2)(a,"session_id"),permissionMode:null,permissionSuggestions:null}:null},parseQuestion:()=>null,encodeVerdict:function(a){return"allowOnce"===a.kind?{hookSpecificOutput:{hookEventName:B.cN,permissionDecision:"allow"}}:"deny"===a.kind?{hookSpecificOutput:{hookEventName:B.cN,permissionDecision:"deny",permissionDecisionReason:a.message??"denied by CommandMate"}}:D},prepareLaunch:({target:a,executablePath:b})=>(0,B.Rv)(b,a)});var F=c(15194);let G={ToolPermission:"permission_prompt"};var H=c(72626),I=c(45567),J=c(46171),K=c(77904);let L=(0,H.h)("lib/hooks/sources/gemini/settings-generator"),M=1e3*h.W6,N=[["SessionStart","session_start"],["BeforeAgent","user_prompt_submit"],["AfterAgent","stop"],["Notification","notification"],["SessionEnd","session_end"]];function O(a,b){return a.includes("cmate-agent-event.sh")&&a.includes(`--tool ${K.o}`)&&a.includes(`--worktree-id ${(0,h.ZL)(b)}`)}let P=(0,i.UB)({cliToolId:K.o,noDecision:{kind:"proceeds"},capabilities:{supportedEvents:["session_start","user_prompt_submit","stop","notification","session_end"],configScope:"per-worktree",decisionTimeoutSeconds:0,permissionHookPredictsDialog:!1,sessionStartMayArriveLate:!1,permissionReplyReleasesPrompt:!1,permissionAllowSuppressesDialog:!1,eventIdentity:null,resync:"none",transcriptHistory:null,stopReportsSelfResume:!1},mappers:(0,j.mJ)({SessionStart:"session_start",SessionEnd:"session_end",BeforeAgent:"user_prompt_submit",AfterAgent:"stop",BeforeTool:"pre_tool_use",AfterTool:"post_tool_use",Notification:"notification"}),nativeEventNameFields:["hook_event_name"],conversationIdFields:k.lb,toolCallIdFields:[],extractDetail:function(a,b){if("notification"!==a)return(0,k.Jp)(a,b);let c=(0,j.O2)(b,"notification_type");return null===c?null:(0,j.Wv)(G[c]??c)},parsePermissionRequest:()=>null,parseQuestion:()=>null,encodeVerdict:()=>({}),prepareLaunch:function({target:a,executablePath:b,worktreePath:c}){let d={worktreeId:a.worktreeId,instanceId:a.instanceId,cliToolId:K.o},e=(0,F.n6)(a.instanceId??K.o)?function(a,b){if(!(0,h.q)())return null;let c=(0,h.Os)();if(!c)return L.warn("gemini-hook-relay-missing",{worktreeId:b.worktreeId}),null;let d=(0,p.join)(a,".gemini","settings.json");try{let a=(0,J.U)(d),e=function(a,b){let c={};for(let[e,f]of N){var d;c[e]=[{hooks:[{type:"command",command:(d=b.worktreeId,[(0,h.ZL)(a),"--tool",K.o,"--event",f,"--worktree-id",(0,h.ZL)(d),"--stdin-json"].join(" ")),timeout:M}]}]}return c}(c,b);return(0,J.P)(d,function(a,b,c){let d=(0,j.Qd)(a?.hooks)?a.hooks:{},e={};for(let[a,b]of Object.entries(d)){if(!Array.isArray(b)){e[a]=b;continue}let d=b.filter(a=>!function(a,b){if(!(0,j.Qd)(a))return!1;let c=a.hooks;return Array.isArray(c)?c.length>0&&c.every(a=>(0,j.Qd)(a)&&"string"==typeof a.command&&O(a.command,b)):"string"==typeof a.command&&O(a.command,b)}(a,c));e[a]=d.length===b.length?b:d}for(let[a,c]of Object.entries(b)){let b=e[a];e[a]=Array.isArray(b)?[...b,...c]:[...c]}return{...a,hooks:e}}(a,e,b.worktreeId)),d}catch(a){return L.warn("gemini-hook-settings-write-failed",{worktreeId:b.worktreeId,error:a instanceof Error?a.message:String(a)}),null}}(c,d):null,{command:f,env:g}=function(a,b,c={}){if(!(0,h.q)())return{command:a,env:{}};if(!(0,F.n6)((0,h.g5)(b)))return L.warn("gemini-hook-invalid-instance-id",{worktreeId:b.worktreeId}),{command:a,env:{}};let d=(0,h.xM)({...b,cliToolId:K.o},c);return{command:(0,h.ZL)(a),env:{[I.ZM]:d}}}(b,d);return{command:f,settingsPath:e,env:g}}});var Q=c(54362),R=c(99432),S=c(2734);let T={},U=(0,i.UB)({cliToolId:S.c,noDecision:{kind:"proceeds"},capabilities:{supportedEvents:R.JD,configScope:"global-singleton",decisionTimeoutSeconds:5,permissionHookPredictsDialog:!0,sessionStartMayArriveLate:!1,permissionReplyReleasesPrompt:!1,permissionAllowSuppressesDialog:!0,eventIdentity:null,resync:"none",transcriptHistory:"pull",stopReportsSelfResume:!1},mappers:(0,j.mJ)(k.WK),nativeEventNameFields:["hook_event_name"],conversationIdFields:k.lb,toolCallIdFields:k.ue,modelFields:["model"],extractDetail:k.Jp,parsePermissionRequest:a=>(0,e.ss)(a),parseQuestion:()=>null,encodeVerdict:function(a){return"allowOnce"===a.kind?{hookSpecificOutput:{hookEventName:R.l1,decision:{behavior:"allow"}}}:"deny"===a.kind?{hookSpecificOutput:{hookEventName:R.l1,decision:{behavior:"deny",message:a.message??""}}}:T},prepareLaunch:({target:a,executablePath:b})=>(0,R.S9)(b,a)});var V=c(85965),W=c(28862);let X=(0,H.h)("lib/hooks/sources/command-code/hooks-config"),Y=[["SessionStart","session_start"],["PreToolUse","pre_tool_use"],["PostToolUse","post_tool_use"],["Stop","stop"]],Z=h.W6;function $(a,b){return a.includes("cmate-agent-event.sh")&&a.includes(`--tool ${W.k}`)&&a.includes(`--worktree-id ${(0,h.ZL)(b)}`)}let _=(0,i.UB)({cliToolId:W.k,noDecision:{kind:"proceeds"},capabilities:{supportedEvents:["session_start","pre_tool_use","post_tool_use","stop"],configScope:"per-worktree",decisionTimeoutSeconds:null,permissionHookPredictsDialog:!1,sessionStartMayArriveLate:!1,permissionReplyReleasesPrompt:!1,permissionAllowSuppressesDialog:!1,eventIdentity:null,resync:"none",transcriptHistory:"pull",stopReportsSelfResume:!1},mappers:(0,j.mJ)({SessionStart:"session_start",PreToolUse:"pre_tool_use",PostToolUse:"post_tool_use",Stop:"stop"}),nativeEventNameFields:["hook_event_name"],conversationIdFields:["session_id"],toolCallIdFields:k.ue,extractDetail:k.Jp,parsePermissionRequest:()=>null,parseQuestion:()=>null,encodeVerdict:function(a){return{}},prepareLaunch:({target:a,executablePath:b,worktreePath:c})=>{let d={worktreeId:a.worktreeId,instanceId:a.instanceId,cliToolId:W.k},e=function(a,b){if(!(0,h.q)())return null;let c=(0,h.Os)();if(!c)return X.warn("command-code-hook-relay-missing",{worktreeId:b.worktreeId}),null;let d=(0,p.join)(a,".commandcode","settings.local.json");try{let a=(0,J.U)(d),e=function(a,b){let c={};for(let[e,f]of Y){var d;c[e]=[{matcher:"",hooks:[{type:"command",command:(d=b.worktreeId,[(0,h.ZL)(a),"--tool",W.k,"--event",f,"--worktree-id",(0,h.ZL)(d),"--stdin-json"].join(" ")),timeout:Z}]}]}return c}(c,b);return(0,J.P)(d,function(a,b,c){let d=(0,j.Qd)(a?.hooks)?a.hooks:{},e={};for(let[a,b]of Object.entries(d)){if(!Array.isArray(b)){e[a]=b;continue}let d=b.filter(a=>!function(a,b){if(!(0,j.Qd)(a))return!1;let c=a.hooks;return Array.isArray(c)?c.length>0&&c.every(a=>(0,j.Qd)(a)&&"string"==typeof a.command&&$(a.command,b)):"string"==typeof a.command&&$(a.command,b)}(a,c));e[a]=d.length===b.length?b:d}for(let[a,c]of Object.entries(b)){let b=e[a];e[a]=Array.isArray(b)?[...b,...c]:[...c]}return{...a,hooks:e}}(a,e,b.worktreeId)),d}catch(a){return X.warn("command-code-hook-settings-write-failed",{worktreeId:b.worktreeId,error:a instanceof Error?a.message:String(a)}),null}}(c,d),{command:f,env:g}=function(a,b,c={}){if(!(0,h.q)())return{command:a,env:{}};if(!(0,F.n6)((0,h.g5)(b)))return X.warn("command-code-hook-invalid-instance-id",{worktreeId:b.worktreeId}),{command:a,env:{}};let d=(0,h.xM)({...b,cliToolId:W.k},c);return{command:(0,h.ZL)(a),env:{[I.ZM]:d}}}(b,d);return{command:f,settingsPath:e,env:g}}});var aa=c(16100),ab=c(36925);let ac=(0,ab.v)("__agentEventSources",()=>new Map),ad=(0,ab.v)("__agentEventLegacySources",()=>new Map);function ae(a){ac.set(a.cliToolId,a),ad.delete(a.cliToolId)}function af(a){let b=ac.get(a);if(b)return b;let c=ad.get(a);if(c)return c;let f=(0,i.UB)({cliToolId:a,noDecision:{kind:"proceeds"},capabilities:{supportedEvents:[],configScope:"none",decisionTimeoutSeconds:null,permissionHookPredictsDialog:!1,sessionStartMayArriveLate:!1,permissionReplyReleasesPrompt:!1,permissionAllowSuppressesDialog:!1,eventIdentity:null,resync:"none",transcriptHistory:null,stopReportsSelfResume:!1},mappers:(0,j.mJ)(k.WK),nativeEventNameFields:["hook_event_name"],conversationIdFields:k.lb,toolCallIdFields:k.ue,extractDetail:k.Jp,parsePermissionRequest:a=>(0,e.ss)(a),parseQuestion:a=>(0,d.ek)(a),encodeVerdict:y,prepareLaunch:({executablePath:a})=>({command:a,settingsPath:null,env:{}})});return ad.set(a,f),f}ae(z),ae(E),ae(P),ae(Q.D8),ae(U),ae(V.cC),ae(_),ae(aa.Wp)},77904:(a,b,c)=>{c.d(b,{o:()=>d});let d="gemini"},83738:(a,b,c)=>{c.d(b,{RN:()=>h,gx:()=>q,hl:()=>i,oC:()=>r,rk:()=>p,s8:()=>l,vF:()=>j});var d=c(2466),e=c(57510);function f(a){return"string"==typeof a.type&&(0,e.Qd)(a.data)?(0,e.Qd)(a.data.form)?a.data.form:a.data:a}function g(a){return Array.isArray(a)?a.filter(a=>"string"==typeof a):[]}function h(a){let b=f(a),c=(0,e.O2)(b,"id"),d=(0,e.O2)(b,"sessionID");if(!c||!d||Array.isArray(b.fields))return null;let h=(0,e.O2)(b,"action"),i=(0,e.Qd)(b.metadata)?b.metadata:{};return{toolName:h??"permission",toolInput:{action:h,resources:g(b.resources),...i},promptId:c,sessionId:d,permissionMode:null,permissionSuggestions:Array.isArray(b.save)?b.save:null}}function i(a,b){let c=h(a);return c&&c.promptId?{kind:"permission",id:c.promptId,conversationId:c.sessionId,subject:{kind:"permission",toolName:c.toolName,toolInput:c.toolInput},raw:a,askedAt:b}:null}function j(a){let b=h(a);return b?{toolName:b.toolName,patterns:g(b.permissionSuggestions)}:null}let k=/^(Index: |={3,}$|--- |\+\+\+ )/;function l(a){let b=h(a);if(!b)return null;let c=b.toolInput,d="string"==typeof c.command&&""!==c.command?c.command:g(c.resources).join(", "),f=[""===d?b.toolName:`${b.toolName} ${d}`],i=Array.isArray(c.files)?c.files.filter(e.Qd):[];for(let a of i){let b="string"==typeof a.patch?a.patch.split("\n").filter(a=>!k.test(a)).join("\n").replace(/\n+$/,""):"";""!==b&&(i.length>1&&"string"==typeof a.file&&f.push(a.file),f.push(b))}return f.join("\n")}let m=[{label:"Yes",description:null,value:!0},{label:"No",description:null,value:!1}];function n(a){return a.trim().slice(0,d.Gb)}function o(a){if(!Array.isArray(a.fields))return null;let b=(0,e.O2)(a,"title"),c=[];for(let d of a.fields){if(!(0,e.Qd)(d))return null;if(!0===d.hidden)continue;let a=(0,e.O2)(d,"key");if(null===a)return null;let f=(0,e.O2)(d,"type"),g="boolean"===f?[...m]:"string"===f||"multiselect"===f?function(a){if(!Array.isArray(a)||0===a.length)return null;let b=[];for(let c of a){if(!(0,e.Qd)(c))return null;let a=(0,e.O2)(c,"value"),d=(0,e.O2)(c,"label")??a;if(null===a||null===d)return null;b.push({label:d,description:(0,e.O2)(c,"description"),value:a})}return b}(d.options):null;if(null===g)return null;let h=(0,e.O2)(d,"description")??(0,e.O2)(d,"title")??b;if(null===h)return null;c.push({key:a,question:h,header:(0,e.O2)(d,"title")??b,multiSelect:"multiselect"===f,custom:!0===d.custom&&"boolean"!==f,choices:g})}return c.length>0?c:null}function p(a){let b=f(a),c=(0,e.O2)(b,"id");if(!c)return null;let g=o(b);if(null===g)return null;let h=(0,d.u_)({questions:g.map(a=>({question:a.question,header:a.header,multiSelect:a.multiSelect,options:a.choices.map(a=>({label:a.label,...a.description?{description:a.description}:{}}))}))});return null===h?null:{questions:h.map((a,b)=>g[b]?.custom?{...a,custom:!0}:a),promptId:c}}function q(a,b){let c=f(a),d=p(c);return d&&d.promptId?{kind:"question",id:d.promptId,conversationId:(0,e.O2)(c,"sessionID"),subject:{kind:"question",spec:d},raw:c,askedAt:b}:null}function r(a,b){let c=o(f(a));if(null===c||b.length!==c.length)return null;let d={};for(let[a,e]of c.entries()){let c=[];for(let d of b[a]){let a=n(d),b=e.choices.find(b=>n(b.label)===a)??e.choices.find(a=>a.value===d);if(b)c.push(b.value);else{if(!e.custom||""===d.trim())return null;c.push(d.trim())}}if(e.multiSelect)d[e.key]=c.map(String);else{if(1!==c.length)return null;d[e.key]=c[0]}}return d}},85038:(a,b,c)=>{c.d(b,{Bh:()=>g,LF:()=>k,SC:()=>m,Z:()=>l,_B:()=>h,fp:()=>j,pP:()=>i,tV:()=>f});var d=c(84297),e=c(36925);let f=(0,e.v)("__responsePollerOwnerStorage",()=>new d.AsyncLocalStorage);function g(){return f.getStore()}function h(a){let b=g();return void 0===b||b.pollerKey!==a||!b.stopped}function i(a,b,c){return`${a}:${c??b}`}function j(a){return h(i(a.worktreeId,a.cliToolId,a.instanceId))}let k=(0,e.v)("__responsePollerSnapshotStorage",()=>new d.AsyncLocalStorage);function l(){let a=k.getStore();return void 0===a||!a.superseded}class m extends Error{constructor(){super("terminal snapshot of a superseded poller tick"),this.name="RetiredSnapshotError"}}},85965:(a,b,c)=>{c.d(b,{cC:()=>u});var d=c(62887),e=c(43252),f=c(72626),g=c(66101),h=c(25071),i=c(49791),j=c(75356),k=c(98211),l=c(18529),m=c(84574),n=c(33198),o=c(85322);let p=(0,f.h)("lib/hooks/sources/opencode/source"),q=d.b0;async function r(a,b,c){let d=a.instanceId??a.cliToolId;if("abstain"===c.kind){p.warn("opencode-verdict-abstained",{worktreeId:a.worktreeId,instanceId:d,decisionId:b.id,consequence:"the agent waits indefinitely; nothing else will unblock it"}),(0,h.oy)(a,b.id,{delivered:!1,reason:"abstained"});return}let e=(0,m.hC)(a);if(null===e){p.warn("opencode-verdict-undeliverable-no-port",{worktreeId:a.worktreeId,instanceId:d,decisionId:b.id}),(0,h.oy)(a,b.id,{delivered:!1,reason:"no-port"});return}if("question"===b.kind){if("answer"!==c.kind){p.info("opencode-question-not-answerable",{worktreeId:a.worktreeId,instanceId:d,decisionId:b.id,verdict:c.kind}),(0,h.oy)(a,b.id,{delivered:!1,reason:"question-needs-answer-verdict"});return}let f=await (0,i.Ei)(e,b.id,c.answers);p.info("opencode-question-replied",{worktreeId:a.worktreeId,instanceId:d,decisionId:b.id,delivered:f}),(0,h.oy)(a,b.id,{delivered:f,reason:f?"question-reply":"question-reply-failed"});return}let f=function(a){switch(a.kind){case"allowOnce":return"once";case"allowAlways":return"always";case"deny":return"reject";case"answer":case"abstain":return null}}(c);if(null===f)return void(0,h.oy)(a,b.id,{delivered:!1,reason:"no-wire-value"});let g=await (0,i.LV)(e,b.id,f,"deny"===c.kind?c.message:void 0);p.info("opencode-permission-replied",{worktreeId:a.worktreeId,instanceId:d,decisionId:b.id,reply:f,delivered:g}),(0,h.oy)(a,b.id,{delivered:g,reason:g?`permission-reply:${f}`:"permission-reply-failed"})}async function s(a){let b=(0,m.hC)(a);if(null===b)return[];let c=Date.now(),[d,e]=await Promise.all([(0,i.Li)(b),(0,i.er)(b)]),f=[];for(let a of d){let b=(0,k.Lu)(a,c);b&&f.push(b)}for(let a of e){let b=(0,k.AB)(a,c);b&&f.push(b)}return f}async function t(a){let b=(0,m.hC)(a);return null===b?null:(0,i.xR)(b)}let u=(0,g.kS)({cliToolId:o.k,noDecision:{kind:"blocks"},capabilities:{supportedEvents:q,configScope:"none",decisionTimeoutSeconds:null,permissionHookPredictsDialog:!1,sessionStartMayArriveLate:!1,permissionReplyReleasesPrompt:!0,permissionAllowSuppressesDialog:!0,eventIdentity:"permission-id",resync:"session-status-poll",transcriptHistory:"push",stopReportsSelfResume:!1},mappers:j.lu,nativeEventNameFields:["type"],conversationIdFields:[],extractModel:j.pV,extractEventIdentity:j.oG,parsePermissionRequest:k.FZ,parseQuestion:k.v1,subscribe:(a,b)=>(0,n.bP)(a,b,a=>u.normalizeEvent(a),{resync:u.capabilities.resync}),decide:r,listPending:s,probeActivity:t,liveness:a=>(0,n.lf)(a),prepareLaunch:function({target:a,executablePath:b}){let c={command:/^[A-Za-z0-9_./-]+$/.test(b)?b:(0,e.ZL)(b),settingsPath:null,env:{}};if(!(0,e.q)())return c;let d=(0,m.hC)(a);if(null===d)return c;let f=(0,l.Lj)((0,l.Q1)(a));return{command:`${(0,e.ZL)(b)} --port ${d} --hostname ${i.Vc}`+f,settingsPath:null,env:{}}}})}};
@@ -1 +1 @@
1
- "use strict";exports.id=3543,exports.ids=[3543],exports.modules={73543:a=>{a.exports=JSON.parse('{"sessions":{"idleAgents":"{count} idle","activeAgents":"{count} active","title":"Sessions","description":"All worktree sessions across repositories.","filterPlaceholder":"Filter by name or repository...","filterAriaLabel":"Filter sessions by name or repository","sortByAriaLabel":"Sort by","sortAscending":"Sort ascending","sortDescending":"Sort descending","loadingAriaLabel":"Loading sessions","refreshError":"Failed to refresh sessions: {message}","loadError":"Failed to load sessions: {message}","noMatching":"No matching sessions found.","empty":"No sessions yet.","viewMode":{"groupAriaLabel":"Session layout","list":"List view","tile":"Tile view"},"tileAriaLabel":"Session tile for {branch}","tileInstanceAriaLabel":"Agent instance shown in this tile"},"nav":{"sessions":"Sessions","repositories":"Repositories","review":"Review","more":"Settings","skills":"Skills"},"repositories":{"pageDescription":"Manage repositories and worktrees.","empty":"No repositories registered yet.","add":"Add Repository","syncAll":"Sync All","syncing":"Syncing...","addNewTitle":"Add New Repository","localPathTab":"Local Path","cloneUrlTab":"Clone URL","localPathDescription":"Enter the absolute path to a git repository containing worktrees.","localPathLabel":"Repository Path","localPathExample":"Example: {example}","localPathAllowedRoots":"Allowed roots: {roots}","browse":"Browse…","pickerTitle":"Select a repository folder","pickerRootsLabel":"Allowed roots","pickerRecentLabel":"Recently used","pickerSelectHere":"Select this folder","pickerUp":"Up one level","pickerEmpty":"No subfolders here.","pickerTruncated":"Showing the first {limit} folders only.","pickerLoading":"Loading…","pickerWorktreeCount":"{count} worktree(s)","validationGitRepo":"Git repository detected ({count} worktree(s))","validationNotGitRepo":"This folder is not a git repository.","validationNotFound":"This folder does not exist.","validationOutsideRoots":"Outside the allowed roots ({roots}).","scan":"Scan & Add","scanning":"Scanning...","cloneUrlDescription":"Enter a git clone URL to clone a remote repository.","cloneUrlLabel":"Clone URL","cloneUrlHelp":"Supports HTTPS and SSH URLs","clone":"Clone","forkAndClone":"Fork & Add","forkOptionLabel":"Fork before adding (gh repo fork)","forkOptionHelp":"Creates a fork in your GitHub account and clones that (origin = your fork, upstream = original). Requires an authenticated GitHub CLI (gh).","cloning":"Cloning...","cloneSuccess":"Repository cloned successfully","cloneFailed":"Clone failed","pathRequired":"Repository path is required","urlRequired":"Clone URL is required","urlInvalid":"Invalid URL format","loading":"Loading repositories","filterAll":"All ({count})","filterDisabled":"Disabled ({count})","emptyDisabled":"No repositories are excluded from scans.","disableConfirmTitle":"Exclude from scans?","disableConfirmBody":"\\"{name}\\" will no longer be scanned for worktrees.\\n\\nNothing is deleted: its {count} worktree(s) and their chat history, tasks and verification runs stay in the database, and any tmux session running under it keeps running.\\n\\nIts worktrees also stay in the sidebar — use the Visibility toggle to hide them.","disableConfirmAction":"Exclude from scans","disableSuccess":"\\"{name}\\" is excluded from scans.","enableSuccess":"\\"{name}\\" is scanned again ({count} worktree(s)).","duplicateScanRootWarning":"Same git repository as an existing scan root: {paths}. Both will be scanned, and every worktree they share will be registered twice.","duplicateConfirmTitle":"Register a second scan root for the same repository?","duplicateConfirmBody":"\\"{path}\\" is the same git repository as:\\n{paths}\\n\\nBoth roots list the same worktrees, so every sync registers each of them twice and their \\"repository path\\" flips between the roots run to run.\\n\\nThis is allowed — continue if you want to manage these worktrees as separate roots. Otherwise cancel, or use the Scan toggle on the Repositories list to exclude one of them later.","duplicateConfirmAction":"Add anyway","duplicateRowBadge":"Duplicate scan root","duplicateRowDetail":"Same git repository as {paths}. Use the Scan toggle on one of these rows to exclude it from scans."},"cancel":"Cancel","sending":"Sending...","end":"End","ending":"Ending...","retry":"Retry","reload":"Reload","reconnect":"Reconnect","close":"Close","back":"Back","menu":"Menu","sidebar":{"railLabel":"App navigation","open":"Open sidebar","close":"Close sidebar","branchNavigation":"Branch navigation","branches":"Branches","searchBranches":"Search branches...","noBranchesFound":"No branches found","noBranchesAvailable":"No branches available","loadingBranches":"Loading branches...","branchesLoadFailed":"Failed to load branches","retryLoadBranches":"Retry","dragToReorderGroup":"Drag to reorder group","viewLabel":"View","listOptionsLabel":"View and sort ({summary})","listOptionsSummary":"{view} \xb7 {sort} \xb7 {direction}","needsAttention":"Needs attention","openInReview":"Open in Review","attentionMoreInReview":"+{count} more in Review","hiddenRepository":"Hidden repository","otherBranches":"Other ({count})","viewMode":{"grouped":"Repository","flat":"Branch","sessions":"Session"}},"confirmDelete":"Delete \\"{name}\\"?","favorites":{"add":"Add to favorites","remove":"Remove from favorites"},"syncSuccess":"Synced {count} worktrees","syncError":"Sync failed","syncAuthError":"Authentication error","syncButtonLabel":"Sync branches","tooltips":{"sync":"Sync worktrees"},"displaySize":{"ariaLabel":"Display size","large":"Large","medium":"Medium","small":"Small","xsmall":"Extra small"},"repoTabBar":{"settingLabel":"Repository tabs","overflow":"More repositories","switchBranch":"Switch to another branch of {repository}","mode":{"always":"Always show","collapsed":"Only when the sidebar is collapsed","hidden":"Hidden"}},"confirmDialog":{"title":"Confirm","confirm":"OK"},"language":"Language","loadingPage":"Loading page","closeNotification":"Close notification","status":{"idle":"Idle","ready":"Ready","running":"Running","generating":"Generating","waiting":"Waiting for response","error":"Error","unknown":"Unknown"},"sort":{"options":"Sort options","updatedAt":"Updated","repositoryName":"Repository name","branchName":"Branch name","status":"Status","lastSent":"Last Sent","label":"Sort","sortBy":"Sort by {label}","ascending":"Sort ascending","descending":"Sort descending","ascShort":"ASC","descShort":"DESC","directionLabel":"Order","direction":{"newestFirst":"Newest first","oldestFirst":"Oldest first","aToZ":"A→Z","zToA":"Z→A","attentionFirst":"Needs attention first","attentionLast":"Needs attention last"}},"branchItem":{"cliToolStatus":"CLI tool status","hasUnread":"Has unread messages","agentExited":"exited","actions":"Actions for {name}","openInNewTab":"Open in new tab","copyBranchName":"Copy branch name","copyPath":"Copy path","copied":"Copied","copyFailed":"Could not copy","status":"Status","statusChangeFailed":"Could not change the status"},"connection":{"reconnecting":"Reconnecting","offline":"Offline","reconnectingTooltip":"Re-establishing the live connection (running on polling)","offlineTooltip":"No live connection (running on polling)"},"versionMismatch":{"title":"A new version is running","description":"The server is now on {serverVersion}, but this tab is still on {clientVersion}. Reload to get the latest.","reload":"Reload","dismiss":"Dismiss"},"whatsNew":{"title":"What\'s new (v{from} → v{to})","highlight":"Highlights","added":"New","improved":"Improved","fixed":"Fixed","empty":"See the release page for the details of this update.","releaseLink":"Open the release page","close":"Close"},"meta":{"description":"Git worktree management with Claude CLI and tmux sessions"},"attention":{"label":"Needs attention","badgeLabel":"{count} worktrees need your attention"},"agentUpdates":{"title":"Agent CLI versions","description":"Installed versions of the agent CLIs on this machine. The update runs outside the agent pane, so a session that is already open is not interrupted.","installed":"installed {version}","notInstalled":"Not installed","available":"Update available: {version}","dismissed":"Marked as dismissed in codex","update":"Update","updating":"Updating...","running":"Running: {command}","succeeded":"Updated {from} to {to}.","failed":"Update failed: {error}","restartWarning":"These sessions keep the current version until they are restarted: {sessions}","restartNotice":"A session that is already running keeps its current version until it is restarted.","restart":"Restart {alias}","restarted":"Ended. The next message starts it on the new version.","restartError":"Could not restart the session.","loadError":"Could not read the agent CLI versions."},"settings":{"title":"Settings","pageDescription":"Defaults for new branches, notifications, external apps, and more.","sections":{"quickLinks":"Quick Links","general":"General","notifications":"Notifications","externalApps":"External Apps","about":"About"},"categoriesLabel":"Settings categories","defaultSurfaceMode":{"title":"Default output surface","description":"Which surface a session\'s output half opens in: the live terminal, or the conversation transcript. You can still switch either way from the session header.","appliesToNew":"Only affects surfaces you have not switched yet. A split or phone tab you already toggled keeps the mode you left it in.","mode":{"terminal":"Terminal","chat":"Chat"},"hint":{"terminal":"The agent\'s terminal, exactly as it is drawn in tmux.","chat":"The conversation transcript, as a message list."},"saving":"Saving...","saved":"Saved","configured":"Configured","usingBuiltIn":"Using the built-in default","saveError":"Could not save.","loadError":"Could not load the setting."},"defaultAgents":{"title":"Default agents for new branches","description":"The agents a newly discovered branch opens with, in order. The first one is the primary — the tab that opens first and the default target for sends.","appliesToNew":"Existing branches are left alone. Their tabs stay exactly as they are.","primary":"primary","installed":"Installed","notInstalled":"Not installed","addLabel":"Available to add","add":"Add","remove":"Remove","moveUp":"Move up","moveDown":"Move down","save":"Save","saving":"Saving...","saved":"Saved","reset":"Reset to default","builtIn":"Built-in default: {agents}","configured":"Configured","usingBuiltIn":"Using the built-in default","range":"Select between {min} and {max} agents.","saveError":"Could not save.","loadError":"Could not load the setting.","opencodeSharedData":"OpenCode and OpenCode V2 are both installed. They share ~/.local/share/opencode, and V2 changes the database in ways OpenCode 1.x cannot read — if OpenCode fails to start, use OpenCode V2 only or give OpenCode 1.x its own data directory."}},"newTask":{"title":"New task","loading":"Loading branches…","loadError":"Could not load the branch list.","noTargets":"No branch has an agent to send to.","recentLabel":"Recent","repositoryLabel":"Repository","branchLabel":"Branch","agentLabel":"Agent","agentStatus":{"running":"running","starting":"starting","stopped":"stopped"},"willStart":"{agent} is not running. It will be started, then the request is sent.","startingNotice":"{agent} is still starting. If the send is refused, wait a moment and send again.","messageLabel":"Request","messagePlaceholder":"What should the agent do?","modelLabel":"Model","modelPlaceholder":"Default","modelHintLaunch":"Applied when the session starts.","modelHintSwitch":"Switches the running session to this model.","modelUnavailable":{"unsupported":"{agent} does not take a model on send.","running":"{agent} is already running. A model can only be set when it starts — stop the session first to switch."},"autoYesLabel":"Auto-Yes","autoYesActive":"On for this agent, {remaining} left. Left as it is.","autoYesKeep":"Leave off","autoYesKeepUnknown":"Leave as it is (state unknown)","autoYesUnknown":"Could not confirm the Auto-Yes state; it may be on for this agent.","autoYesEnableFor":"Turn on for {duration}","autoYesScope":"Applies to this agent until it expires, not only to this request.","send":"Send","sending":"Sending…","sendHint":"to send","sentToast":"Sent to {target}. Click to go back.","errors":{"auto_yes_failed":"Auto-Yes could not be turned on, so nothing was sent.","prompt_waiting":"{agent} is waiting on a prompt, so nothing was sent. Answer it on the branch screen, then send again.","conflict":"The session refused the request.","starting":"{agent} is still starting. Wait a moment and send again.","start_failed":"{agent} could not be started.","model_rejected":"The model was not accepted. Clear it or change it, then send again.","invalid":"The request was not accepted.","failed":"Sending failed. Check the connection and send again."}}}')}};
1
+ "use strict";exports.id=3543,exports.ids=[3543],exports.modules={73543:a=>{a.exports=JSON.parse('{"sessions":{"idleAgents":"{count} idle","activeAgents":"{count} active","title":"Sessions","description":"All worktree sessions across repositories.","filterPlaceholder":"Filter by name or repository...","filterAriaLabel":"Filter sessions by name or repository","sortByAriaLabel":"Sort by","sortAscending":"Sort ascending","sortDescending":"Sort descending","loadingAriaLabel":"Loading sessions","refreshError":"Failed to refresh sessions: {message}","loadError":"Failed to load sessions: {message}","noMatching":"No matching sessions found.","empty":"No sessions yet.","viewMode":{"groupAriaLabel":"Session layout","list":"List view","tile":"Tile view"},"tileAriaLabel":"Session tile for {branch}","tileInstanceAriaLabel":"Agent instance shown in this tile"},"nav":{"sessions":"Sessions","repositories":"Repositories","review":"Review","more":"Settings","skills":"Skills"},"repositories":{"pageDescription":"Manage repositories and worktrees.","empty":"No repositories registered yet.","add":"Add Repository","syncAll":"Sync All","syncing":"Syncing...","addNewTitle":"Add New Repository","localPathTab":"Local Path","cloneUrlTab":"Clone URL","localPathDescription":"Enter the absolute path to a git repository containing worktrees.","localPathLabel":"Repository Path","localPathExample":"Example: {example}","localPathAllowedRoots":"Allowed roots: {roots}","browse":"Browse…","pickerTitle":"Select a repository folder","pickerRootsLabel":"Allowed roots","pickerRecentLabel":"Recently used","pickerSelectHere":"Select this folder","pickerUp":"Up one level","pickerEmpty":"No subfolders here.","pickerTruncated":"Showing the first {limit} folders only.","pickerLoading":"Loading…","pickerWorktreeCount":"{count} worktree(s)","validationGitRepo":"Git repository detected ({count} worktree(s))","validationNotGitRepo":"This folder is not a git repository.","validationNotFound":"This folder does not exist.","validationOutsideRoots":"Outside the allowed roots ({roots}).","scan":"Scan & Add","scanning":"Scanning...","cloneUrlDescription":"Enter a git clone URL to clone a remote repository.","cloneUrlLabel":"Clone URL","cloneUrlHelp":"Supports HTTPS and SSH URLs","clone":"Clone","forkAndClone":"Fork & Add","forkOptionLabel":"Fork before adding (gh repo fork)","forkOptionHelp":"Creates a fork in your GitHub account and clones that (origin = your fork, upstream = original). Requires an authenticated GitHub CLI (gh).","cloning":"Cloning...","cloneSuccess":"Repository cloned successfully","cloneFailed":"Clone failed","pathRequired":"Repository path is required","urlRequired":"Clone URL is required","urlInvalid":"Invalid URL format","loading":"Loading repositories","filterAll":"All ({count})","filterDisabled":"Disabled ({count})","emptyDisabled":"No repositories are excluded from scans.","disableConfirmTitle":"Exclude from scans?","disableConfirmBody":"\\"{name}\\" will no longer be scanned for worktrees.\\n\\nNothing is deleted: its {count} worktree(s) and their chat history, tasks and verification runs stay in the database, and any tmux session running under it keeps running.\\n\\nIts worktrees also stay in the sidebar — use the Visibility toggle to hide them.\\n\\nIts role defaults stay too, and apply again when it is scanned again.","disableConfirmAction":"Exclude from scans","disableSuccess":"\\"{name}\\" is excluded from scans.","enableSuccess":"\\"{name}\\" is scanned again ({count} worktree(s)).","duplicateScanRootWarning":"Same git repository as an existing scan root: {paths}. Both will be scanned, and every worktree they share will be registered twice.","duplicateConfirmTitle":"Register a second scan root for the same repository?","duplicateConfirmBody":"\\"{path}\\" is the same git repository as:\\n{paths}\\n\\nBoth roots list the same worktrees, so every sync registers each of them twice and their \\"repository path\\" flips between the roots run to run.\\n\\nThis is allowed — continue if you want to manage these worktrees as separate roots. Otherwise cancel, or use the Scan toggle on the Repositories list to exclude one of them later.","duplicateConfirmAction":"Add anyway","duplicateRowBadge":"Duplicate scan root","duplicateRowDetail":"Same git repository as {paths}. Use the Scan toggle on one of these rows to exclude it from scans.","rolesKeptNote":"An excluded repository keeps its role defaults, and uses them again when it is scanned again."},"cancel":"Cancel","sending":"Sending...","end":"End","ending":"Ending...","retry":"Retry","reload":"Reload","reconnect":"Reconnect","close":"Close","back":"Back","menu":"Menu","sidebar":{"railLabel":"App navigation","open":"Open sidebar","close":"Close sidebar","branchNavigation":"Branch navigation","branches":"Branches","searchBranches":"Search branches...","noBranchesFound":"No branches found","noBranchesAvailable":"No branches available","loadingBranches":"Loading branches...","branchesLoadFailed":"Failed to load branches","retryLoadBranches":"Retry","dragToReorderGroup":"Drag to reorder group","viewLabel":"View","listOptionsLabel":"View and sort ({summary})","listOptionsSummary":"{view} \xb7 {sort} \xb7 {direction}","needsAttention":"Needs attention","openInReview":"Open in Review","attentionMoreInReview":"+{count} more in Review","hiddenRepository":"Hidden repository","otherBranches":"Other ({count})","viewMode":{"grouped":"Repository","flat":"Branch","sessions":"Session"}},"confirmDelete":"Delete \\"{name}\\"?","favorites":{"add":"Add to favorites","remove":"Remove from favorites"},"syncSuccess":"Synced {count} worktrees","syncError":"Sync failed","syncAuthError":"Authentication error","syncButtonLabel":"Sync branches","tooltips":{"sync":"Sync worktrees"},"displaySize":{"ariaLabel":"Display size","large":"Large","medium":"Medium","small":"Small","xsmall":"Extra small"},"repoTabBar":{"settingLabel":"Repository tabs","overflow":"More repositories","switchBranch":"Switch to another branch of {repository}","mode":{"always":"Always show","collapsed":"Only when the sidebar is collapsed","hidden":"Hidden"}},"confirmDialog":{"title":"Confirm","confirm":"OK"},"language":"Language","loadingPage":"Loading page","closeNotification":"Close notification","status":{"idle":"Idle","ready":"Ready","running":"Running","generating":"Generating","waiting":"Waiting for response","error":"Error","unknown":"Unknown"},"sort":{"options":"Sort options","updatedAt":"Updated","repositoryName":"Repository name","branchName":"Branch name","status":"Status","lastSent":"Last Sent","label":"Sort","sortBy":"Sort by {label}","ascending":"Sort ascending","descending":"Sort descending","ascShort":"ASC","descShort":"DESC","directionLabel":"Order","direction":{"newestFirst":"Newest first","oldestFirst":"Oldest first","aToZ":"A→Z","zToA":"Z→A","attentionFirst":"Needs attention first","attentionLast":"Needs attention last"}},"branchItem":{"cliToolStatus":"CLI tool status","hasUnread":"Has unread messages","agentExited":"exited","actions":"Actions for {name}","openInNewTab":"Open in new tab","copyBranchName":"Copy branch name","copyPath":"Copy path","copied":"Copied","copyFailed":"Could not copy","status":"Status","statusChangeFailed":"Could not change the status"},"connection":{"reconnecting":"Reconnecting","offline":"Offline","reconnectingTooltip":"Re-establishing the live connection (running on polling)","offlineTooltip":"No live connection (running on polling)"},"versionMismatch":{"title":"A new version is running","description":"The server is now on {serverVersion}, but this tab is still on {clientVersion}. Reload to get the latest.","reload":"Reload","dismiss":"Dismiss"},"whatsNew":{"title":"What\'s new (v{from} → v{to})","highlight":"Highlights","added":"New","improved":"Improved","fixed":"Fixed","empty":"See the release page for the details of this update.","releaseLink":"Open the release page","close":"Close"},"meta":{"description":"Git worktree management with Claude CLI and tmux sessions"},"attention":{"label":"Needs attention","badgeLabel":"{count} worktrees need your attention"},"sessionKill":{"outcomeUnknown":"Whether the session of {label} ended could not be confirmed. Check whether it is still running.","inProgress":"The session of {label} is still running. Ending it may still be in progress. Wait a moment, then check whether it is still running."},"agentUpdates":{"title":"Agent CLI versions","description":"Installed versions of the agent CLIs on this machine. The update runs outside the agent pane, so a session that is already open is not interrupted.","installed":"installed {version}","notInstalled":"Not installed","available":"Update available: {version}","dismissed":"Marked as dismissed in codex","update":"Update","updating":"Updating...","running":"Running: {command}","succeeded":"Updated {from} to {to}.","failed":"Update failed: {error}","restartWarning":"These sessions keep the current version until they are restarted: {sessions}","restartNotice":"A session that is already running keeps its current version until it is restarted.","restart":"Restart {alias}","restarted":"Ended. The next message starts it on the new version.","restartError":"Could not restart the session.","restartUnknown":"Whether the session ended could not be confirmed. Check whether it is still running.","restartInProgress":"The session is still running. Ending it may still be in progress. Wait a moment, then check whether it is still running.","loadError":"Could not read the agent CLI versions."},"settings":{"title":"Settings","pageDescription":"Defaults for new branches, notifications, external apps, and more.","sections":{"quickLinks":"Quick Links","general":"General","notifications":"Notifications","externalApps":"External Apps","about":"About"},"categoriesLabel":"Settings categories","defaultSurfaceMode":{"title":"Default output surface","description":"Which surface a session\'s output half opens in: the live terminal, or the conversation transcript. You can still switch either way from the session header.","appliesToNew":"Only affects surfaces you have not switched yet. A split or phone tab you already toggled keeps the mode you left it in.","mode":{"terminal":"Terminal","chat":"Chat"},"hint":{"terminal":"The agent\'s terminal, exactly as it is drawn in tmux.","chat":"The conversation transcript, as a message list."},"saving":"Saving...","saved":"Saved","configured":"Configured","usingBuiltIn":"Using the built-in default","saveError":"Could not save.","loadError":"Could not load the setting."},"defaultAgents":{"title":"Default agents for new branches","description":"The agents a newly discovered branch opens with, in order. The first one is the primary — the tab that opens first and the default target for sends.","appliesToNew":"Existing branches are left alone. Their tabs stay exactly as they are.","primary":"primary","installed":"Installed","notInstalled":"Not installed","addLabel":"Available to add","add":"Add","remove":"Remove","moveUp":"Move up","moveDown":"Move down","save":"Save","saving":"Saving...","saved":"Saved","reset":"Reset to default","builtIn":"Built-in default: {agents}","configured":"Configured","usingBuiltIn":"Using the built-in default","range":"Select between {min} and {max} agents.","saveError":"Could not save.","loadError":"Could not load the setting.","opencodeSharedData":"OpenCode and OpenCode V2 are both installed. They share ~/.local/share/opencode, and V2 changes the database in ways OpenCode 1.x cannot read — if OpenCode fails to start, use OpenCode V2 only or give OpenCode 1.x its own data directory."}},"newTask":{"title":"New task","loading":"Loading branches…","loadError":"Could not load the branch list.","noTargets":"No branch has an agent to send to.","recentLabel":"Recent","repositoryLabel":"Repository","branchLabel":"Branch","agentLabel":"Agent","agentStatus":{"running":"running","starting":"starting","stopped":"stopped"},"willStart":"{agent} is not running. It will be started, then the request is sent.","startingNotice":"{agent} is still starting. If the send is refused, wait a moment and send again.","messageLabel":"Request","messagePlaceholder":"What should the agent do?","modelLabel":"Model","modelPlaceholder":"Default","modelHintLaunch":"Applied when the session starts.","modelHintSwitch":"Switches the running session to this model.","modelUnavailable":{"unsupported":"{agent} does not take a model on send.","running":"{agent} is already running. A model can only be set when it starts — stop the session first to switch."},"autoYesLabel":"Auto-Yes","autoYesActive":"On for this agent, {remaining} left. Left as it is.","autoYesKeep":"Leave off","autoYesKeepUnknown":"Leave as it is (state unknown)","autoYesUnknown":"Could not confirm the Auto-Yes state; it may be on for this agent.","autoYesEnableFor":"Turn on for {duration}","autoYesScope":"Applies to this agent until it expires, not only to this request.","send":"Send","sending":"Sending…","sendHint":"to send","sentToast":"Sent to {target}. Click to go back.","errors":{"auto_yes_failed":"Auto-Yes could not be turned on, so nothing was sent.","prompt_waiting":"{agent} is waiting on a prompt, so nothing was sent. Answer it on the branch screen, then send again.","conflict":"The session refused the request.","starting":"{agent} is still starting. Wait a moment and send again.","start_failed":"{agent} could not be started.","model_rejected":"The model was not accepted. Clear it or change it, then send again.","invalid":"The request was not accepted.","failed":"Sending failed. Check the connection and send again."}},"agentRoles":{"title":"Roles","loading":"Loading…","loadError":"Could not read the role information.","description":"A role is the instructions given to a session when it starts. Write a body per role, then use it as a per-tool default or on one session. It resolves session → repository → system. Changing a setting does not reach a running session until its next start.","personaNote":"OpenCode\'s persona (build, plan, …) is not a role. A persona is the agent you switch inside OpenCode; a role is instructions CommandMate gives at startup.","replacesDefaultNote":"On OpenCode V2 a role replaces the agent\'s default instructions rather than adding to them.","resumedAcrossRoleNote":"This start continued an earlier conversation, so replies from another role are still in its history. A new conversation can be started at the next start.","adapterDisabledNote":"Applying a role to this tool is not enabled yet. A start that resolves to a role is refused.","unsupportedNote":"Roles do not apply to this tool.","choice":{"inherit":"Use the default","inheritNamed":"Default ({label})","none":"None","useSystem":"Use the system default","unset":"Not set"},"source":{"inherited":"Inherited: {label}","assigned":"Set: {label}"},"label":{"roleSystem":"{name} [system]","roleRepository":"{name} [repository]","roleInstance":"{name} [this session]","noneRepository":"None [set on the repository]","noneInstance":"None [set on this session]","noneDefault":"None [no default]","noneUnsupported":"None [tool not supported]"},"ambiguous":{"rootSettingsDiffer":"Cannot tell: the repositories this branch belongs to hold different settings ({roots}). Starts are refused until the repositories agree or the session names a role.","membershipUndetermined":"Cannot tell: git could not confirm which repository this belongs to ({roots}). Starts are refused until that is resolved or the session names a role.","rootInherits":"system default"},"savedStale":"The latest state could not be read back after a change, so this may be out of date. Reload the page.","saveUnknown":"Whether this was saved could not be confirmed. Check the current setting.","application":{"startup":"At start: {name}","next":"Next: {name}","pending":"Pending","unknown":"Unknown","ambiguous":"Cannot tell","separator":" / ","restart":"Restart","restartHint":"Ends the session. The next message starts a new one with the current settings."},"instances":{"title":"Session roles","description":"Choose a role per session. A change is used from the next start.","selectLabel":"Role of {alias}","saveError":"Could not save the role.","restartConfirm":"End the session of {alias}? The next message starts a new one with the current settings.","restartError":"Could not end the session.","restartUnknown":"Whether the session ended could not be confirmed. Check whether it is still running.","restartInProgress":"The session is still running. Ending it may still be in progress. Wait a moment, then check whether it is still running.","runningUnknown":"Could not read which sessions are running, so the status below does not say whether they are."},"repository":{"toggle":"Roles","toggleLabel":"Role defaults of {name}","description":"The default per tool for this repository\'s branches.","selectLabel":"Default for {tool}","saveError":"Could not save the default."},"system":{"title":"System defaults","description":"Used when neither the repository nor the session says otherwise."},"manage":{"new":"Create a role","create":"Create","save":"Save","edit":"Edit","delete":"Delete","cancel":"Cancel","name":"Name","body":"Body","bodyPlaceholder":"e.g. You are the code reviewer.","bytes":"{bytes} / {max} bytes","empty":"No roles yet.","nameConflict":"A role with this name already exists.","versionConflict":"This role was edited elsewhere. Close this and open it again.","saveError":"Could not save.","deleteError":"Could not delete.","edited":"Saved. {count} setting(s) that name this role use the new body from their next start.","deleted":"Deleted \\"{name}\\".","deleteAsk":"Delete \\"{name}\\"?","inUse":"This role is used in these places. Deleting it removes these settings too. Launch records and generated files stay.","forceDelete":"Remove the settings and delete","referenceInstance":"Session: {worktree} / {instance}","referenceRepository":"Repository: {path} ({tool})","referenceSystem":"System default: {tool}"}}}')}};
@@ -1,7 +1,7 @@
1
1
  "use strict";exports.id=3801,exports.ids=[3801],exports.modules={640:(a,b,c)=>{function d(a){return`[from ${a.alias} / ${a.worktreeId}]`}function e(a,b,c=null){let f=b.trim();return null!==c?`${d(a)}
2
2
  ${c}
3
3
  ${""===f?"(no reply body)":f}`:""===f?`${d(a)} (no reply body)`:`${d(a)} ${f}`}c.d(b,{Hr:()=>j,KA:()=>l,Nl:()=>n,Py:()=>g,z0:()=>e});let f={en:"Note: this reply may have been processed in the same turn as another request (overlap={overlap}).",ja:"注意: この返答は、別の依頼と同じターンで処理された可能性があります(overlap={overlap})。"};function g(a,b){return null===b||"none"===b?null:`[CommandMate relay] ${f[a].replace("{overlap}",b)}`}function h(a,b){let c=a.replace(/\s+/g," ").trim();return c.length<=b?c:`${c.slice(0,b-1)}…`}let i={en:{waiting:"is waiting for a confirmation:",options:"Options:",more:"(+{n} more)"},ja:{waiting:"確認待ちです:",options:"選択肢:",more:"(他 {n} 件)"}};function j(a,b,c){let e=i[a],f=`${d(b)} ${e.waiting} ${h(c.question,200)}`;if(0===c.options.length)return f;let g=c.options.slice(0,9),j=c.options.length-g.length,k=g.map(a=>`${a.key}) ${h(a.label,60)}`).join(" "),l=j>0?` ${e.more.replace("{n}",String(j))}`:"";return`${f}
4
- ${e.options} ${k}${l}`}let k={en:"The reply you were waiting for did not arrive within {hours}h; the relay has expired.",ja:"待っていた返信が {hours} 時間以内に届かなかったため、委任は期限切れになりました。"};function l(a,b,c){let e=Math.max(1,Math.round(c/36e5));return`${d(b)} ${k[a].replace("{hours}",String(e))}`}let m={en:{requested:"Delegated to {alias}; waiting for the reply.",replied:"Reply from {alias}.",waiting:"{alias} is waiting for a confirmation.",expired:"The delegation to {alias} expired without a reply.",held:"Could not confirm that the relay from {alias} reached this session; it will not be resent automatically. Check this pane, then settle it with commandmate relays resolve.","reply-discarded":"The reply from {alias} that waited behind the settled confirmation notice was discarded: the delegation had already closed, so it is not delivered."},ja:{requested:"{alias} へ委任、返信待ち",replied:"{alias} から返信",waiting:"{alias} が確認待ち",expired:"{alias} への委任が返信のないまま期限切れ",held:"{alias} からの relay がこのセッションへ届いたか確認できません(自動では再送しません)。この画面を確かめてから commandmate relays resolve で片付けてください","reply-discarded":"片付けた確認の通知の後ろで待っていた {alias} の返信は、委任が既に閉じていたため破棄しました(配送しません)"}};function n(a,b,c,d={}){let e=m[a][b].replace("{alias}",c),f=[];return d.overlap&&f.push(`overlap=${d.overlap}`),d.holdReason&&f.push(`hold=${d.holdReason}`),d.relayId&&f.push(`relay=${d.relayId}`),d.payload&&f.push(`payload=${d.payload}`),d.attemptId&&f.push(`attempt=${d.attemptId}`),d.deliveryReason&&f.push(`reason=${d.deliveryReason}`),0===f.length?e:`${e} (${f.join(", ")})`}},10168:(a,b,c)=>{c.d(b,{BR:()=>j,Vg:()=>i,YT:()=>h});var d=c(55511),e=c(24455),f=c(91631),g=c(36925);function h(){return(0,g.v)("__relayServerBootId",()=>(0,d.randomUUID)())}function i(a,b,c){let d=(0,f.Ev)((0,e.v7)(a,b,c));return`${h()}#${d??"-"}`}function j(a){if(null===a)return null;let b=a.lastIndexOf("#");return b<=0?null:a.slice(0,b)}},14887:(a,b,c)=>{c.d(b,{E6:()=>j,yk:()=>i});var d=c(55511),e=c(5350),f=c(10168);let g=(0,c(72626).h)("relay-bind"),h=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,i={sendUnknown:"send_unknown",dispatchUnknown:"dispatch_unknown",generationChanged:"generation_changed",noInputBoundary:"no_input_boundary",serverRestarted:"server_restarted",serverRestartedBeforeInput:"server_restarted_before_input"};function j(a,b,c=Date.now()){if(!h.test(b.relayId))return{ok:!1,refusal:{status:400,code:"RELAY_BIND_INVALID",message:"relayId must be a relay id"}};let i=(0,d.randomUUID)();try{if(!(0,e.ZR)(a,{relayId:b.relayId,attemptId:i,owner:(0,f.YT)(),worktreeId:b.worktreeId,instanceId:b.instanceId,now:c}))return{ok:!1,refusal:(0,e.C$)(a,b.relayId,b.worktreeId,b.instanceId,c)}}catch(a){return g.warn("relay-bind-reserve-failed",{relayId:b.relayId,error:a instanceof Error?a.message:String(a)}),{ok:!1,refusal:{status:500,code:"RELAY_BIND_FAILED",message:"Failed to reserve the relay"}}}return g.info("relay-bind-reserved",{relayId:b.relayId,attemptId:i}),{ok:!0,binding:new k(a,b,i)}}class k{constructor(a,b,c){this.db=a,this.target=b,this.attemptId=c,this.generationBefore=null,this.boundaryWritten=!1,this.observationInvalid=!1,this.refused=!1,this.dispatch="none",this.retryDispatchOpen=!1}get relayId(){return this.target.relayId}begin(a){this.generationBefore=a}hooks(){return{beforeInput:(a,b)=>this.beforeInput(a,b),onDispatchFailed:a=>this.onDispatchFailed(a)}}beforeInput(a,b){let c;if("unknown"===this.dispatch){"dispatch"===b&&(this.retryDispatchOpen=!0);return}let d=this.target.readTurn(),g=d.generation===this.generationBefore,h=g?this.target.hooksReportTurns?"valid":"turn_unknown":"invalid",i=this.target.hooksReportTurns&&g?d.open:null;try{c=(0,e.bT)(this.db,{relayId:this.target.relayId,attemptId:this.attemptId,at:a.getTime(),kind:b,turnOpenAtSend:i,obsState:h,obsSource:(0,f.Vg)(this.target.worktreeId,this.target.cliToolId,this.target.instanceId),replaceDispatch:"not_sent"===this.dispatch})}catch(a){throw this.refused=!0,a}if(!c)throw this.refused=!0,Error(`relay ${this.target.relayId} is no longer reserved for this send`);this.boundaryWritten=!0,this.observationInvalid="invalid"===h,"dispatch"===b&&(this.dispatch="pending")}onDispatchFailed(a){if("unknown"===this.dispatch){this.retryDispatchOpen=!1;return}if("not_sent"===a){this.dispatch="not_sent";return}this.dispatch="unknown",(0,e.ky)(this.db,{relayId:this.target.relayId,attemptId:this.attemptId,from:["input_started"],to:"unknown",holdReason:i.dispatchUnknown})}finish(a){try{return this.settle(a)}catch(b){return g.warn("relay-bind-settle-failed",{relayId:this.target.relayId,error:b instanceof Error?b.message:String(b)}),"sent"===a.kind?"sent":"unknown"}}settle(a){let b={relayId:this.target.relayId,attemptId:this.attemptId};if("unknown"===this.dispatch){if("sent"===a.kind&&this.retryDispatchOpen){let c=this.observationInvalid||a.generationAfter!==this.generationBefore;return(0,e.ky)(this.db,{...b,from:["unknown"],to:"sent",inputMessageId:a.messageId,...c?{holdReason:i.generationChanged,invalidateObservation:!0}:{clearHoldReason:!0}}),"sent"}return"unknown"}if("sent"===a.kind){if(!this.boundaryWritten)return(0,e.ky)(this.db,{...b,from:["awaiting"],to:"unknown",holdReason:i.noInputBoundary}),"unknown";let c=this.observationInvalid||a.generationAfter!==this.generationBefore;return(0,e.ky)(this.db,{...b,from:["input_started"],to:"sent",inputMessageId:a.messageId,holdReason:c?i.generationChanged:null,invalidateObservation:c}),"sent"}return"sent"===a.attempt?((0,e.ky)(this.db,{...b,from:["awaiting","input_started"],to:"unknown",holdReason:i.sendUnknown}),"unknown"):!this.boundaryWritten||this.refused||"not-sent"===a.attempt?((0,e.ky)(this.db,{...b,from:["awaiting","input_started"],to:"failed"}),"not_sent"):((0,e.ky)(this.db,{...b,from:["input_started"],to:"unknown",holdReason:i.sendUnknown}),"unknown")}}},49798:(a,b,c)=>{c.d(b,{S:()=>h,r:()=>i});var d=c(28274),e=c(73753),f=c(83530);let g=(0,c(72626).h)("relay-session-ref");function h(a,b){let c="claude",e=b.instanceId;try{c=(0,f.iK)(a,b.worktreeId,{instanceId:b.instanceId}).cliToolId;let g=(0,d.BN)(a,b.worktreeId,b.instanceId);g?.alias&&(e=g.alias)}catch(a){g.warn("relay-session-resolve-failed",{worktreeId:b.worktreeId,instanceId:b.instanceId,error:a instanceof Error?a.message:String(a)})}return{worktreeId:b.worktreeId,instanceId:b.instanceId,cliToolId:c,alias:e}}function i(a,b){try{return null!==(0,e.getWorktreeById)(a,b)}catch{return!1}}},53801:(a,b,c)=>{c.d(b,{xK:()=>W,notifyRelayPromptWaiting:()=>_,notifyRelayTurnCompleted:()=>$,Ph:()=>ae,runRelayMaintenanceTick:()=>af});var d=c(55511),e=c(88807),f=c(5350),g=c(52660),h=c(55233),i=c(39687),j=c(640),k=c(10168),l=c(81254),m=c(14887),n=c(18201),o=c(36261),p=c(30008),q=c(70096),r=c(49798),s=c(85016),t=c(25539),u=c(72626);let v=(0,u.h)("relay-delivery"),w=/-turn:/,x=[g.RELAY_SYSTEM_REQUEST_ID_PREFIX,g.MODEL_CHANGE_REQUEST_ID_PREFIX],y={claude:!0,codex:!0,antigravity:!0,"command-code":!0,opencode:!0,copilot:!1,gemini:!1,"vibe-local":!1,"opencode-v2":!0};function z(a,b){let c=(0,r.S)(a,b.to);return{alias:c.alias,worktreeId:c.worktreeId}}function A(a){return!0===y[a]}function B(a,b,c){let d=(0,g.getMessages)(a,b.worktreeId,{limit:40,cliToolId:b.cliToolId,instanceId:b.instanceId,matchResolvedInstance:!0}),e=A(b.cliToolId);for(let a of d){var f;if(!("assistant"!==a.role||"prompt"===a.messageType||function(a){return"string"==typeof a&&x.some(b=>a.startsWith(b))}(a.requestId))){if((!e||"string"==typeof(f=a.requestId)&&w.test(f))&&""!==a.content.trim())return a.timestamp.getTime()<c?null:a}}return null}function C(a,b,c){let d=(0,f.ix)(a,{worktreeId:b.worktreeId,instanceId:b.instanceId});if(0===d.length)return 0;let e=0;for(let g of d){if("bound"===g.bindMode){(function(a,b,c,d){if("awaiting"===c.sendState||"input_started"===c.sendState){for(let e of F(a,b,c.inputBoundaryAt??c.createdAt))(0,f.EG)(a,c.id,{messageId:e.row.id,timestamp:e.orderAt,requestId:e.row.requestId??null},d);return!1}if("sent"!==c.sendState||null===c.inputBoundaryAt)return!1;let e=(0,f.TN)(a,c.id);if(!e||!E(a,b,e))return!1;let[g]=F(a,b,c.inputBoundaryAt);return!!g&&G(a,b,e,g.row,d)})(a,b,g,c)&&(e+=1);continue}let d=B(a,b,g.createdAt);if(!d)continue;let h=(0,j.z0)(z(a,g),d.content);null!==D(a,g.id,{candidateId:d.id,body:h,overlap:null,basis:"legacy"},c)&&(e+=1)}return e}function D(a,b,c,e){let g={...c,payloadId:(0,d.randomUUID)()};if((0,f.be)(a,b,"reply",g.body,e,{payloadId:g.payloadId,overlap:g.overlap??void 0}))return"stashed";let h=(0,f.V9)(a,b);if(!h||"prompt"!==h.kind)return null;if(!(0,s.p5)(b)){let d=(0,f.Iq)(a,b,h.payloadId,g,e);if("reply"===d)return"stashed";if("waiting-reply"===d)return v.info("relay-earlier-reply-kept",{relayId:b,laterCandidateId:c.candidateId}),"earlier-reply"}return(0,f.nR)(a,b,g,e)?"stashed":null}function E(a,b,c){if("invalid"===c.relay.obsState)return!1;let d=(0,k.Vg)(b.worktreeId,b.cliToolId,b.instanceId);if(c.obsSource===d)return!0;let e=(0,k.BR)(c.obsSource)!==(0,k.YT)();return(0,f.FO)(a,c.relay.id,e?m.yk.serverRestarted:m.yk.generationChanged,{invalidate:!0}),v.info("relay-observation-mismatch",{relayId:c.relay.id,restarted:e}),!1}function F(a,b,c){let d=A(b.cliToolId),e=x.map(()=>"request_id NOT LIKE ?").join(" AND "),f=a.prepare(`
4
+ ${e.options} ${k}${l}`}let k={en:"The reply you were waiting for did not arrive within {hours}h; the relay has expired.",ja:"待っていた返信が {hours} 時間以内に届かなかったため、委任は期限切れになりました。"};function l(a,b,c){let e=Math.max(1,Math.round(c/36e5));return`${d(b)} ${k[a].replace("{hours}",String(e))}`}let m={en:{requested:"Delegated to {alias}; waiting for the reply.",replied:"Reply from {alias}.",waiting:"{alias} is waiting for a confirmation.",expired:"The delegation to {alias} expired without a reply.",held:"Could not confirm that the relay from {alias} reached this session; it will not be resent automatically. Check this pane, then settle it with commandmate relays resolve.","reply-discarded":"The reply from {alias} that waited behind the settled confirmation notice was discarded: the delegation had already closed, so it is not delivered."},ja:{requested:"{alias} へ委任、返信待ち",replied:"{alias} から返信",waiting:"{alias} が確認待ち",expired:"{alias} への委任が返信のないまま期限切れ",held:"{alias} からの relay がこのセッションへ届いたか確認できません(自動では再送しません)。この画面を確かめてから commandmate relays resolve で片付けてください","reply-discarded":"片付けた確認の通知の後ろで待っていた {alias} の返信は、委任が既に閉じていたため破棄しました(配送しません)"}};function n(a,b,c,d={}){let e=m[a][b].replace("{alias}",c),f=[];return d.overlap&&f.push(`overlap=${d.overlap}`),d.holdReason&&f.push(`hold=${d.holdReason}`),d.relayId&&f.push(`relay=${d.relayId}`),d.payload&&f.push(`payload=${d.payload}`),d.attemptId&&f.push(`attempt=${d.attemptId}`),d.deliveryReason&&f.push(`reason=${d.deliveryReason}`),0===f.length?e:`${e} (${f.join(", ")})`}},10168:(a,b,c)=>{c.d(b,{BR:()=>j,Vg:()=>i,YT:()=>h});var d=c(55511),e=c(24455),f=c(91631),g=c(36925);function h(){return(0,g.v)("__relayServerBootId",()=>(0,d.randomUUID)())}function i(a,b,c){let d=(0,f.Ev)((0,e.v7)(a,b,c));return`${h()}#${d??"-"}`}function j(a){if(null===a)return null;let b=a.lastIndexOf("#");return b<=0?null:a.slice(0,b)}},11772:(a,b,c)=>{c.d(b,{LN:()=>m,eV:()=>k,fK:()=>i,qL:()=>j,x3:()=>l});var d=c(5350),e=c(72626),f=c(36925);let g=(0,e.h)("relay-delivery-block"),h=(0,f.v)("__relayLastDeliveryBlocks",()=>new Map);function i(a,b){try{null===b?h.delete(a):h.set(a,b)}catch(b){g.warn("relay-delivery-block-note-failed",{relayId:a,error:b instanceof Error?b.message:String(b)})}}function j(a){try{for(let b of[...h.keys()])a.has(b)||h.delete(b)}catch{}}function k(a,b){return{...b,lastDeliveryBlock:function(a,b){try{let c=h.get(b.id);if(!c)return null;let e=(0,d.V9)(a,b.id);if(!e||e.kind!==c.kind||e.payloadId!==c.payloadId||e.body!==c.body)return h.delete(b.id),null;if(null!==e.relay.deliveryHold)return null;return{reason:c.reason,kind:c.kind,payloadId:c.payloadId,observedAt:c.observedAt}}catch(a){return g.warn("relay-delivery-block-read-failed",{relayId:b.id,error:a instanceof Error?a.message:String(a)}),null}}(a,b)}}function l(a,b){return b.map(b=>k(a,b))}function m(a,b={}){try{return l(a,(0,d.OA)(a,b)).filter(a=>null!=a.lastDeliveryBlock)}catch(a){return g.warn("relay-closed-blocked-list-failed",{error:a instanceof Error?a.message:String(a)}),[]}}},14887:(a,b,c)=>{c.d(b,{E6:()=>j,yk:()=>i});var d=c(55511),e=c(5350),f=c(10168);let g=(0,c(72626).h)("relay-bind"),h=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,i={sendUnknown:"send_unknown",dispatchUnknown:"dispatch_unknown",generationChanged:"generation_changed",noInputBoundary:"no_input_boundary",serverRestarted:"server_restarted",serverRestartedBeforeInput:"server_restarted_before_input"};function j(a,b,c=Date.now()){if(!h.test(b.relayId))return{ok:!1,refusal:{status:400,code:"RELAY_BIND_INVALID",message:"relayId must be a relay id"}};let i=(0,d.randomUUID)();try{if(!(0,e.ZR)(a,{relayId:b.relayId,attemptId:i,owner:(0,f.YT)(),worktreeId:b.worktreeId,instanceId:b.instanceId,now:c}))return{ok:!1,refusal:(0,e.C$)(a,b.relayId,b.worktreeId,b.instanceId,c)}}catch(a){return g.warn("relay-bind-reserve-failed",{relayId:b.relayId,error:a instanceof Error?a.message:String(a)}),{ok:!1,refusal:{status:500,code:"RELAY_BIND_FAILED",message:"Failed to reserve the relay"}}}return g.info("relay-bind-reserved",{relayId:b.relayId,attemptId:i}),{ok:!0,binding:new k(a,b,i)}}class k{constructor(a,b,c){this.db=a,this.target=b,this.attemptId=c,this.generationBefore=null,this.boundaryWritten=!1,this.observationInvalid=!1,this.refused=!1,this.dispatch="none",this.retryDispatchOpen=!1}get relayId(){return this.target.relayId}begin(a){this.generationBefore=a}hooks(){return{beforeInput:(a,b)=>this.beforeInput(a,b),onDispatchFailed:a=>this.onDispatchFailed(a)}}beforeInput(a,b){let c;if("unknown"===this.dispatch){"dispatch"===b&&(this.retryDispatchOpen=!0);return}let d=this.target.readTurn(),g=d.generation===this.generationBefore,h=g?this.target.hooksReportTurns?"valid":"turn_unknown":"invalid",i=this.target.hooksReportTurns&&g?d.open:null;try{c=(0,e.bT)(this.db,{relayId:this.target.relayId,attemptId:this.attemptId,at:a.getTime(),kind:b,turnOpenAtSend:i,obsState:h,obsSource:(0,f.Vg)(this.target.worktreeId,this.target.cliToolId,this.target.instanceId),replaceDispatch:"not_sent"===this.dispatch})}catch(a){throw this.refused=!0,a}if(!c)throw this.refused=!0,Error(`relay ${this.target.relayId} is no longer reserved for this send`);this.boundaryWritten=!0,this.observationInvalid="invalid"===h,"dispatch"===b&&(this.dispatch="pending")}onDispatchFailed(a){if("unknown"===this.dispatch){this.retryDispatchOpen=!1;return}if("not_sent"===a){this.dispatch="not_sent";return}this.dispatch="unknown",(0,e.ky)(this.db,{relayId:this.target.relayId,attemptId:this.attemptId,from:["input_started"],to:"unknown",holdReason:i.dispatchUnknown})}finish(a){try{return this.settle(a)}catch(b){return g.warn("relay-bind-settle-failed",{relayId:this.target.relayId,error:b instanceof Error?b.message:String(b)}),"sent"===a.kind?"sent":"unknown"}}settle(a){let b={relayId:this.target.relayId,attemptId:this.attemptId};if("unknown"===this.dispatch){if("sent"===a.kind&&this.retryDispatchOpen){let c=this.observationInvalid||a.generationAfter!==this.generationBefore;return(0,e.ky)(this.db,{...b,from:["unknown"],to:"sent",inputMessageId:a.messageId,...c?{holdReason:i.generationChanged,invalidateObservation:!0}:{clearHoldReason:!0}}),"sent"}return"unknown"}if("sent"===a.kind){if(!this.boundaryWritten)return(0,e.ky)(this.db,{...b,from:["awaiting"],to:"unknown",holdReason:i.noInputBoundary}),"unknown";let c=this.observationInvalid||a.generationAfter!==this.generationBefore;return(0,e.ky)(this.db,{...b,from:["input_started"],to:"sent",inputMessageId:a.messageId,holdReason:c?i.generationChanged:null,invalidateObservation:c}),"sent"}return"sent"===a.attempt?((0,e.ky)(this.db,{...b,from:["awaiting","input_started"],to:"unknown",holdReason:i.sendUnknown}),"unknown"):!this.boundaryWritten||this.refused||"not-sent"===a.attempt?((0,e.ky)(this.db,{...b,from:["awaiting","input_started"],to:"failed"}),"not_sent"):((0,e.ky)(this.db,{...b,from:["input_started"],to:"unknown",holdReason:i.sendUnknown}),"unknown")}}},49798:(a,b,c)=>{c.d(b,{S:()=>h,r:()=>i});var d=c(28274),e=c(73753),f=c(83530);let g=(0,c(72626).h)("relay-session-ref");function h(a,b){let c="claude",e=b.instanceId;try{c=(0,f.iK)(a,b.worktreeId,{instanceId:b.instanceId}).cliToolId;let g=(0,d.BN)(a,b.worktreeId,b.instanceId);g?.alias&&(e=g.alias)}catch(a){g.warn("relay-session-resolve-failed",{worktreeId:b.worktreeId,instanceId:b.instanceId,error:a instanceof Error?a.message:String(a)})}return{worktreeId:b.worktreeId,instanceId:b.instanceId,cliToolId:c,alias:e}}function i(a,b){try{return null!==(0,e.getWorktreeById)(a,b)}catch{return!1}}},53801:(a,b,c)=>{c.d(b,{xK:()=>X,notifyRelayPromptWaiting:()=>aa,notifyRelayTurnCompleted:()=>_,Ph:()=>af,runRelayMaintenanceTick:()=>ag});var d=c(55511),e=c(88807),f=c(5350),g=c(52660),h=c(55233),i=c(39687),j=c(640),k=c(10168),l=c(81254),m=c(14887),n=c(18201),o=c(36261),p=c(30008),q=c(70096),r=c(49798),s=c(85016),t=c(25539),u=c(72626);let v=(0,u.h)("relay-delivery"),w=/-turn:/,x=[g.RELAY_SYSTEM_REQUEST_ID_PREFIX,g.MODEL_CHANGE_REQUEST_ID_PREFIX],y={claude:!0,codex:!0,antigravity:!0,"command-code":!0,opencode:!0,copilot:!1,gemini:!1,"vibe-local":!1,"opencode-v2":!0};function z(a,b){let c=(0,r.S)(a,b.to);return{alias:c.alias,worktreeId:c.worktreeId}}function A(a){return!0===y[a]}function B(a,b,c){let d=(0,g.getMessages)(a,b.worktreeId,{limit:40,cliToolId:b.cliToolId,instanceId:b.instanceId,matchResolvedInstance:!0}),e=A(b.cliToolId);for(let a of d){var f;if(!("assistant"!==a.role||"prompt"===a.messageType||function(a){return"string"==typeof a&&x.some(b=>a.startsWith(b))}(a.requestId))){if((!e||"string"==typeof(f=a.requestId)&&w.test(f))&&""!==a.content.trim())return a.timestamp.getTime()<c?null:a}}return null}function C(a,b,c){let d=(0,f.ix)(a,{worktreeId:b.worktreeId,instanceId:b.instanceId});if(0===d.length)return 0;let e=0;for(let g of d){if("bound"===g.bindMode){(function(a,b,c,d){if("awaiting"===c.sendState||"input_started"===c.sendState){for(let e of F(a,b,c.inputBoundaryAt??c.createdAt))(0,f.EG)(a,c.id,{messageId:e.row.id,timestamp:e.orderAt,requestId:e.row.requestId??null},d);return!1}if("sent"!==c.sendState||null===c.inputBoundaryAt)return!1;let e=(0,f.TN)(a,c.id);if(!e||!E(a,b,e))return!1;let[g]=F(a,b,c.inputBoundaryAt);return!!g&&G(a,b,e,g.row,d)})(a,b,g,c)&&(e+=1);continue}let d=B(a,b,g.createdAt);if(!d)continue;let h=(0,j.z0)(z(a,g),d.content);null!==D(a,g.id,{candidateId:d.id,body:h,overlap:null,basis:"legacy"},c)&&(e+=1)}return e}function D(a,b,c,e){let g={...c,payloadId:(0,d.randomUUID)()};if((0,f.be)(a,b,"reply",g.body,e,{payloadId:g.payloadId,overlap:g.overlap??void 0}))return"stashed";let h=(0,f.V9)(a,b);if(!h||"prompt"!==h.kind)return null;if(!(0,s.p5)(b)){let d=(0,f.Iq)(a,b,h.payloadId,g,e);if("reply"===d)return"stashed";if("waiting-reply"===d)return v.info("relay-earlier-reply-kept",{relayId:b,laterCandidateId:c.candidateId}),"earlier-reply"}return(0,f.nR)(a,b,g,e)?"stashed":null}function E(a,b,c){if("invalid"===c.relay.obsState)return!1;let d=(0,k.Vg)(b.worktreeId,b.cliToolId,b.instanceId);if(c.obsSource===d)return!0;let e=(0,k.BR)(c.obsSource)!==(0,k.YT)();return(0,f.FO)(a,c.relay.id,e?m.yk.serverRestarted:m.yk.generationChanged,{invalidate:!0}),v.info("relay-observation-mismatch",{relayId:c.relay.id,restarted:e}),!1}function F(a,b,c){let d=A(b.cliToolId),e=x.map(()=>"request_id NOT LIKE ?").join(" AND "),f=a.prepare(`
5
5
  SELECT id, request_id, timestamp FROM chat_messages
6
6
  WHERE worktree_id = ? ${g.ACTIVE_FILTER}
7
7
  AND COALESCE(cli_tool_id, 'claude') = ?
@@ -28,4 +28,4 @@ ${e.options} ${k}${l}`}let k={en:"The reply you were waiting for did not arrive
28
28
  AND COALESCE(cli_tool_id, 'claude') = ?
29
29
  AND COALESCE(instance_id, cli_tool_id, 'claude') = ?
30
30
  AND timestamp >= ? AND timestamp < ?
31
- `).all(c.worktreeId,c.cliToolId,c.instanceId,e,d.timestamp.getTime()),i=b.inputMessageId?(0,g.getMessageById)(a,b.inputMessageId):null,j=i?(0,n.pk)(i.content):null,k=!1;for(let a of h)if(a.id!==b.inputMessageId){if(null===j||(0,n.pk)(a.content)===j||a.seq>f.seq){k=!0;continue}return"proven"}return k?"ambiguous":"none"}(a,b,c,d);return f&&"proven"===i?{overlap:"both",basis:"turn-open-at-send+foreign-input"}:f?{overlap:"later",basis:"turn-open-at-send"}:"proven"===i?{overlap:"earlier",basis:"foreign-input"}:h&&"none"===i?{overlap:"none",basis:"no-open-turn+no-other-input"}:{overlap:"unknown",basis:h?"other-input-unproven":"turn-state-unknown"}}(a,c,b,d),i=(0,j.Py)((0,h.dV)(a),f.overlap),k=(0,j.z0)(z(a,c.relay),d.content,i),l=D(a,c.relay.id,{candidateId:d.id,body:k,overlap:f.overlap,basis:f.basis},e);return"stashed"===l&&v.info("relay-reply-decided",{relayId:c.relay.id,candidateId:d.id,overlap:f.overlap,basis:f.basis}),null!==l}function H(a,b,c,d){if(!function(a,b,c,d){if("bound"!==c.bindMode)return!0;if("sent"!==c.sendState||null===c.inputBoundaryAt||d.timestamp.getTime()<c.inputBoundaryAt)return!1;let e=(0,f.TN)(a,c.id);return null!==e&&E(a,b,e)}(a,b,c,d)||(0,f.GC)(a,c.id)===d.id)return!1;let e=(0,h.dV)(a),g=function(a){let b=a.promptData;return(0,l.XF)(b)?"yes_no"===b.type?b.options.map(a=>({key:a,label:a})):b.options.map(a=>({key:String(a.number),label:a.label})):[]}(d),i=(0,l.XF)(d.promptData)?d.promptData.question:d.promptData?.question??d.content,k=(0,j.Hr)(e,z(a,c),{question:i,options:g});return!!(0,f.be)(a,c.id,"prompt",k)&&((0,f.UC)(a,c.id,d.id),!0)}var I=c(23854),J=c(12693),K=c(40964),L=c(34331),M=c(31990),N=c(95595),O=c(64501),P=c(34405);let Q=(0,u.h)("relay-readiness");async function R(a,b,c,d){try{let e=(0,K.mf)(b,a,c),f=await (0,L.L)(a,e,d);if(null===f||"foreign"===f.verdict)return"foreign_session";if("absent"===f.verdict)return"session_stopped";let g=J.CLIToolManager.getInstance().getTool(b);if(!await g.isRunning(a,c))return"session_stopped";let h=await (0,M.Wh)(a,b,P._,c);if((0,O.NV)(a,b,c,h))return"generating";let i=(0,N.WC)(h,b);return"running"===i.status?"generating":null}catch(d){return Q.warn("relay-readiness-check-failed",{worktreeId:a,cliToolId:b,instanceId:c,error:d instanceof Error?d.message:String(d)}),null}}var S=c(67164),T=c(36925);let U=(0,u.h)("relay-delivery"),V=(0,T.v)("__relayDeliveryInFlight",()=>new Set);function W(a){try{let b=(0,e.getDbInstance)(),c=(0,f.TN)(b,a);if(!c)return;let{relay:d}=c;if("sent"!==d.sendState||!(0,t.Lo)(d.state)||null===d.inputBoundaryAt)return;let h=(0,r.S)(b,d.to),i={worktreeId:h.worktreeId,cliToolId:h.cliToolId,instanceId:h.instanceId},j=d.inputBoundaryAt,k=Date.now(),l=b.transaction(()=>{if((0,f.UA)(b,a),!E(b,i,c))return!1;let[d]=F(b,i,j);return!!d&&G(b,i,c,d.row,k)})(),m=!l&&function(a,b,c){let d=(0,o.Jp)(b.worktreeId,b.cliToolId,b.instanceId);if(!d||"prompt"!==d.kind||(0,p.yg)(b.worktreeId,b.cliToolId,b.instanceId,(0,q.VM)(b.cliToolId).capabilities.eventIdentity))return!1;let e=(0,g.getLatestOpenPromptMessage)(a,b.worktreeId,b.cliToolId,b.instanceId);if(!e)return!1;let h=(0,f.Ip)(a,c);return!!h&&!!(0,t.Lo)(h.state)&&H(a,b,h,e)}(b,i,a);(l||m)&&ad()}catch(b){U.warn("relay-after-send-failed",{relayId:a,error:b instanceof Error?b.message:String(b)})}}function X(a){let b=(0,k.YT)();if(globalThis.__relayAttemptsRecoveredBootId!==b)try{let c=(0,f.Yu)(a,b);for(let d of(globalThis.__relayAttemptsRecoveredBootId=b,c.length>0&&U.info("relay-interrupted-deliveries-held",{held:c.length}),c)){let b=(0,f.Ip)(a,d.relayId);b&&ac(a,b,(0,r.S)(a,b.from),d,b.deliveryHold?.kind??null,f.eH)}}catch(a){U.warn("relay-delivery-recovery-failed",{error:a instanceof Error?a.message:String(a)})}if(globalThis.__relayRecoveredBootId!==b){globalThis.__relayRecoveredBootId=b;try{!function(a,b=Date.now()){let c=(0,k.YT)(),d=0;for(let e of(0,f.hA)(a)){let{relay:g}=e;if("awaiting"===g.sendState){if(null===e.bindAttemptId||e.bindOwner===c)continue;(0,f.Yt)(a,g.id,e.bindAttemptId,m.yk.serverRestartedBeforeInput,b)&&(d+=1);continue}if("input_started"===g.sendState){if(e.bindOwner===c||null===e.bindAttemptId)continue;(0,f.ky)(a,{relayId:g.id,attemptId:e.bindAttemptId,from:["input_started"],to:"unknown",holdReason:m.yk.serverRestarted,now:b})&&(d+=1);continue}if("sent"===g.sendState){if(null!==e.pendingKind)continue;if(null!==e.pendingReply){(0,f.jn)(a,g.id,b)&&(d+=1);continue}if((0,k.BR)(e.obsSource)===c||"invalid"===g.obsState)continue;(0,f.FO)(a,g.id,m.yk.serverRestarted,{invalidate:!0,now:b}),d+=1}}d>0&&v.info("relay-bound-recovered",{recovered:d})}(a)}catch(a){U.warn("relay-recovery-failed",{error:a instanceof Error?a.message:String(a)})}}}function Y(a){return new Promise(b=>{setTimeout(b,a)})}async function Z(a,b){let c=Date.now()+15e3;for(;;){if(C(a,b,Date.now())>0)return void ad();if(Date.now()>=c)break;await Y(1e3)}U.info("relay-scrape-row-not-transcript-backed",{worktreeId:b.worktreeId,cliToolId:b.cliToolId,instanceId:b.instanceId,graceMs:15e3})}async function $(a,b){try{let c=(0,e.getDbInstance)(),d=(0,f.ix)(c,{worktreeId:a.worktreeId,instanceId:a.instanceId});if(0===d.length)return;if(b.settled){C(c,a,Date.now())>0&&ad();return}if(A(a.cliToolId))return void await Z(c,a);let g=null;for(let b=0;b<3;b+=1){let b=B(c,a,0);g=b?.id??null,await Y(I.DZ);let d=B(c,a,0);if((d?.id??null)===g){C(c,a,Date.now())>0&&ad();return}}U.info("relay-scrape-never-settled",{worktreeId:a.worktreeId,instanceId:a.instanceId,attempts:3})}catch(b){U.warn("relay-turn-completed-failed",{worktreeId:a.worktreeId,instanceId:a.instanceId,error:b instanceof Error?b.message:String(b)})}}function _(a){try{let b=(0,e.getDbInstance)(),c=(0,f.ix)(b,{worktreeId:a.worktreeId,instanceId:a.instanceId});if(0===c.length)return;let d=(0,g.getLatestOpenPromptMessage)(b,a.worktreeId,a.cliToolId,a.instanceId);if(!d)return;let h=0;for(let e of c)H(b,a,e,d)&&(h+=1);h>0&&ad()}catch(b){U.warn("relay-prompt-notify-failed",{worktreeId:a.worktreeId,instanceId:a.instanceId,error:b instanceof Error?b.message:String(b)})}}async function aa(a,b,c,e,h){let j,l=(0,f.Ip)(a,b);if(!l)return"skipped";let m=(0,r.S)(a,l.from),n=await R(m.worktreeId,m.cliToolId,m.instanceId,a);if(n)return U.debug("relay-delivery-held",{relayId:b,kind:c,reason:n}),"held";let o=function(a,b,c,d,e){let g=(0,f.V9)(a,b);return g&&g.kind===c&&g.body===d&&g.payloadId===e?"expired"===c||(0,t.Lo)(g.relay.state)?g:(U.info("relay-delivery-closed",{relayId:b,kind:c,state:g.relay.state}),null):(U.info("relay-delivery-superseded",{relayId:b,kind:c}),null)}(a,b,c,e,h);if(!o)return"skipped";let p=o.relay,q=(0,r.S)(a,p.from),u=(0,d.randomUUID)();try{j=(0,f.ud)(a,{relayId:b,payloadId:o.payloadId,kind:c,body:e,attemptId:u,owner:(0,k.YT)(),mintPayloadId:(0,d.randomUUID)()})}catch(a){return U.warn("relay-delivery-claim-failed",{relayId:b,kind:c,error:a instanceof Error?a.message:String(a)}),"failed"}if(null===j)return U.info("relay-delivery-taken",{relayId:b,kind:c}),"skipped";let v={relayId:b,payloadId:j,attemptId:u};(0,s.o5)(b);let w=!1;try{let d,h=null;try{d=await (0,i.d)(a,{worktreeId:q.worktreeId,content:e,cliToolId:q.cliToolId,instanceId:q.instanceId,messageType:"relay",requestId:"reply"===c?(0,g.relayRequestId)(p.id):void 0,onAttempt:a=>{h=a}})}catch(e){var x;let d=(x=h,null===x?"send-threw":"sent"===x.state?"threw-after-sent":x.reason);return U.warn("relay-delivery-uncertain",{relayId:b,kind:c,reason:d,error:e instanceof Error?e.message:String(e)}),ab(a,v,d)&&ac(a,p,q,v,c,d),"uncertain"}if(!d.ok){let b=function(a,b,c,d,e,g,h){let i=b.relayId;return null!==h&&"not-sent"!==h.state?(U.info("relay-delivery-uncertain",{relayId:i,kind:e,stage:g,reason:h.reason}),ab(a,b,h.reason)&&ac(a,c,d,b,e,h.reason),{outcome:"uncertain",requeued:!1}):(U.info("relay-delivery-refused",{relayId:i,kind:e,stage:g}),{outcome:"prompt_waiting"===g?"held":"failed",requeued:function(a,b){try{return(0,f.ZJ)(a,b)}catch(a){return U.warn("relay-delivery-release-failed",{relayId:b.relayId,error:a instanceof Error?a.message:String(a)}),!1}}(a,b)})}(a,v,p,q,c,d.stage,h);return w=b.requeued,b.outcome}let j=Date.now(),{completed:k,promoted:l}=function(a,b,c,d,e){let h,i=!1;if("reply"===d){let d=(0,f.vp)(a,{...b,sentRequestId:(0,g.relayRequestId)(c.id),now:e});(h=d.completed)&&!d.closed&&U.info("relay-already-closed-on-deliver",{relayId:b.relayId})}else"prompt"===d?{completed:h,promoted:i}=(0,f.jl)(a,{...b,now:e}):h=(0,f.Tw)(a,{...b,now:e});return{completed:h,promoted:i}}(a,v,p,c,j);if(!k)return U.warn("relay-delivery-result-stale",{relayId:b,kind:c,attemptId:u}),"skipped";return l&&(globalThis.__relayPumpAgain=!0),function(a,b,c,d,e){let f=b.id;try{"reply"===d?(0,S._)(a,b.id,"replied",c,(0,r.S)(a,b.to),e,{overlap:b.overlap,holdReason:b.holdReason}):"prompt"===d&&(0,S._)(a,b.id,"waiting",c,(0,r.S)(a,b.to),e)}catch(a){U.warn("relay-delivery-record-failed",{relayId:f,kind:d,error:a instanceof Error?a.message:String(a)})}}(a,p,q,c,j),U.info("relay-delivered",{relayId:b,kind:c,to:`${q.worktreeId}/${q.instanceId}`}),"delivered"}finally{w&&"prompt"===c&&function(a,b,c){let d=b.id;try{(0,f.T)(a,b.id,c)&&(U.info("relay-prompt-superseded-after-failed-delivery",{relayId:d}),globalThis.__relayPumpAgain=!0)}catch(a){U.warn("relay-prompt-supersede-failed",{relayId:d,error:a instanceof Error?a.message:String(a)})}}(a,p,j),(0,s.dJ)(b)}}function ab(a,b,c){try{return(0,f.pk)(a,{...b,reason:c})}catch(a){return U.warn("relay-delivery-hold-failed",{relayId:b.relayId,error:a instanceof Error?a.message:String(a)}),!1}}function ac(a,b,c,d,e,f){try{(0,S._)(a,b.id,"held",c,(0,r.S)(a,b.to),d.now??Date.now(),{relayId:b.id,payload:`${e??"-"}:${d.payloadId}`,attemptId:d.attemptId,deliveryReason:f},`${d.payloadId}:${d.attemptId}`)}catch(a){U.warn("relay-held-line-failed",{relayId:d.relayId,error:a instanceof Error?a.message:String(a)})}}async function ad(){if(!globalThis.__relayPumpRunning){globalThis.__relayPumpRunning=!0;try{let a=(0,e.getDbInstance)();X(a);for(let b=0;b<3;b+=1){for(let b of(globalThis.__relayPumpAgain=!1,(0,f.sB)(a)))if(!V.has(b.relay.id)){V.add(b.relay.id);try{await aa(a,b.relay.id,b.kind,b.body,b.payloadId)}catch(a){U.warn("relay-delivery-failed",{relayId:b.relay.id,error:a instanceof Error?a.message:String(a)})}finally{V.delete(b.relay.id)}}if(!globalThis.__relayPumpAgain)break}}catch(a){U.warn("relay-pump-failed",{error:a instanceof Error?a.message:String(a)})}finally{globalThis.__relayPumpRunning=!1}}}function ae(){globalThis.__relayPumpAgain=!0,ad()}async function af(){try{X((0,e.getDbInstance)()),function(a,b=Date.now()){for(let c of(0,f.s7)(a,b))if(!(0,s.p5)(c.id))try{let d=(0,h.dV)(a);(0,f.uJ)(a,c.id,b),(0,f.zM)(a,c.id,b);let e=(0,j.KA)(d,z(a,c),c.expiresAt-c.createdAt),g=(0,f.be)(a,c.id,"expired",e,b);if(!(0,f.Cz)(a,c.id,b)){g&&(0,f.uJ)(a,c.id,b);continue}(0,S._)(a,c.id,"expired",(0,r.S)(a,c.from),(0,r.S)(a,c.to),b)}catch(a){U.warn("relay-expire-failed",{relayId:c.id,error:a instanceof Error?a.message:String(a)})}}((0,e.getDbInstance)())}catch(a){U.warn("relay-sweep-failed",{error:a instanceof Error?a.message:String(a)})}await ad()}},67164:(a,b,c)=>{c.d(b,{_:()=>i});var d=c(52660),e=c(55233),f=c(43015),g=c(640);let h=(0,c(72626).h)("relay-system-line");function i(a,b,c,j,k,l=Date.now(),m={},n=null){let o=(0,d.relaySystemRequestId)(b,c,n);try{let i=a.transaction(()=>{if((0,d.findMessageByRequestId)(a,j.worktreeId,o))return null;let f=(0,e.dV)(a);return(0,d.createRelaySystemMessage)(a,{worktreeId:j.worktreeId,cliToolId:j.cliToolId,instanceId:j.instanceId,content:(0,g.Nl)(f,c,k.alias,m),relayId:b,kind:c,scope:n,at:l})}).immediate();if(null===i)return!1;try{(0,f.broadcastMessage)("message",{worktreeId:j.worktreeId,message:{...i,cliToolId:j.cliToolId,instanceId:j.instanceId}})}catch(a){h.warn("relay-system-line-broadcast-failed",{relayId:b,kind:c,error:a instanceof Error?a.message:String(a)})}return!0}catch(a){return h.warn("relay-system-line-failed",{relayId:b,kind:c,error:a instanceof Error?a.message:String(a)}),!1}}},85016:(a,b,c)=>{c.d(b,{dJ:()=>f,o5:()=>e,p5:()=>g});let d=(0,c(36925).v)("__relayDeliveryClaims",()=>new Set);function e(a){d.add(a)}function f(a){d.delete(a)}function g(a){return d.has(a)}}};
31
+ `).all(c.worktreeId,c.cliToolId,c.instanceId,e,d.timestamp.getTime()),i=b.inputMessageId?(0,g.getMessageById)(a,b.inputMessageId):null,j=i?(0,n.pk)(i.content):null,k=!1;for(let a of h)if(a.id!==b.inputMessageId){if(null===j||(0,n.pk)(a.content)===j||a.seq>f.seq){k=!0;continue}return"proven"}return k?"ambiguous":"none"}(a,b,c,d);return f&&"proven"===i?{overlap:"both",basis:"turn-open-at-send+foreign-input"}:f?{overlap:"later",basis:"turn-open-at-send"}:"proven"===i?{overlap:"earlier",basis:"foreign-input"}:h&&"none"===i?{overlap:"none",basis:"no-open-turn+no-other-input"}:{overlap:"unknown",basis:h?"other-input-unproven":"turn-state-unknown"}}(a,c,b,d),i=(0,j.Py)((0,h.dV)(a),f.overlap),k=(0,j.z0)(z(a,c.relay),d.content,i),l=D(a,c.relay.id,{candidateId:d.id,body:k,overlap:f.overlap,basis:f.basis},e);return"stashed"===l&&v.info("relay-reply-decided",{relayId:c.relay.id,candidateId:d.id,overlap:f.overlap,basis:f.basis}),null!==l}function H(a,b,c,d){if(!function(a,b,c,d){if("bound"!==c.bindMode)return!0;if("sent"!==c.sendState||null===c.inputBoundaryAt||d.timestamp.getTime()<c.inputBoundaryAt)return!1;let e=(0,f.TN)(a,c.id);return null!==e&&E(a,b,e)}(a,b,c,d)||(0,f.GC)(a,c.id)===d.id)return!1;let e=(0,h.dV)(a),g=function(a){let b=a.promptData;return(0,l.XF)(b)?"yes_no"===b.type?b.options.map(a=>({key:a,label:a})):b.options.map(a=>({key:String(a.number),label:a.label})):[]}(d),i=(0,l.XF)(d.promptData)?d.promptData.question:d.promptData?.question??d.content,k=(0,j.Hr)(e,z(a,c),{question:i,options:g});return!!(0,f.be)(a,c.id,"prompt",k)&&((0,f.UC)(a,c.id,d.id),!0)}var I=c(23854),J=c(12693),K=c(40964),L=c(34331),M=c(31990),N=c(95595),O=c(64501),P=c(34405);let Q=(0,u.h)("relay-readiness");async function R(a,b,c,d){try{let e=(0,K.mf)(b,a,c),f=await (0,L.L)(a,e,d);if(null===f||"foreign"===f.verdict)return"foreign_session";if("absent"===f.verdict)return"session_stopped";let g=J.CLIToolManager.getInstance().getTool(b);if(!await g.isRunning(a,c))return"session_stopped";let h=await (0,M.Wh)(a,b,P._,c);if((0,O.NV)(a,b,c,h))return"generating";let i=(0,N.WC)(h,b);return"running"===i.status?"generating":null}catch(d){return Q.warn("relay-readiness-check-failed",{worktreeId:a,cliToolId:b,instanceId:c,error:d instanceof Error?d.message:String(d)}),null}}var S=c(11772),T=c(67164),U=c(36925);let V=(0,u.h)("relay-delivery"),W=(0,U.v)("__relayDeliveryInFlight",()=>new Set);function X(a){try{let b=(0,e.getDbInstance)(),c=(0,f.TN)(b,a);if(!c)return;let{relay:d}=c;if("sent"!==d.sendState||!(0,t.Lo)(d.state)||null===d.inputBoundaryAt)return;let h=(0,r.S)(b,d.to),i={worktreeId:h.worktreeId,cliToolId:h.cliToolId,instanceId:h.instanceId},j=d.inputBoundaryAt,k=Date.now(),l=b.transaction(()=>{if((0,f.UA)(b,a),!E(b,i,c))return!1;let[d]=F(b,i,j);return!!d&&G(b,i,c,d.row,k)})(),m=!l&&function(a,b,c){let d=(0,o.Jp)(b.worktreeId,b.cliToolId,b.instanceId);if(!d||"prompt"!==d.kind||(0,p.yg)(b.worktreeId,b.cliToolId,b.instanceId,(0,q.VM)(b.cliToolId).capabilities.eventIdentity))return!1;let e=(0,g.getLatestOpenPromptMessage)(a,b.worktreeId,b.cliToolId,b.instanceId);if(!e)return!1;let h=(0,f.Ip)(a,c);return!!h&&!!(0,t.Lo)(h.state)&&H(a,b,h,e)}(b,i,a);(l||m)&&ae()}catch(b){V.warn("relay-after-send-failed",{relayId:a,error:b instanceof Error?b.message:String(b)})}}function Y(a){let b=(0,k.YT)();if(globalThis.__relayAttemptsRecoveredBootId!==b)try{let c=(0,f.Yu)(a,b);for(let d of(globalThis.__relayAttemptsRecoveredBootId=b,c.length>0&&V.info("relay-interrupted-deliveries-held",{held:c.length}),c)){let b=(0,f.Ip)(a,d.relayId);b&&ad(a,b,(0,r.S)(a,b.from),d,b.deliveryHold?.kind??null,f.eH)}}catch(a){V.warn("relay-delivery-recovery-failed",{error:a instanceof Error?a.message:String(a)})}if(globalThis.__relayRecoveredBootId!==b){globalThis.__relayRecoveredBootId=b;try{!function(a,b=Date.now()){let c=(0,k.YT)(),d=0;for(let e of(0,f.hA)(a)){let{relay:g}=e;if("awaiting"===g.sendState){if(null===e.bindAttemptId||e.bindOwner===c)continue;(0,f.Yt)(a,g.id,e.bindAttemptId,m.yk.serverRestartedBeforeInput,b)&&(d+=1);continue}if("input_started"===g.sendState){if(e.bindOwner===c||null===e.bindAttemptId)continue;(0,f.ky)(a,{relayId:g.id,attemptId:e.bindAttemptId,from:["input_started"],to:"unknown",holdReason:m.yk.serverRestarted,now:b})&&(d+=1);continue}if("sent"===g.sendState){if(null!==e.pendingKind)continue;if(null!==e.pendingReply){(0,f.jn)(a,g.id,b)&&(d+=1);continue}if((0,k.BR)(e.obsSource)===c||"invalid"===g.obsState)continue;(0,f.FO)(a,g.id,m.yk.serverRestarted,{invalidate:!0,now:b}),d+=1}}d>0&&v.info("relay-bound-recovered",{recovered:d})}(a)}catch(a){V.warn("relay-recovery-failed",{error:a instanceof Error?a.message:String(a)})}}}function Z(a){return new Promise(b=>{setTimeout(b,a)})}async function $(a,b){let c=Date.now()+15e3;for(;;){if(C(a,b,Date.now())>0)return void ae();if(Date.now()>=c)break;await Z(1e3)}V.info("relay-scrape-row-not-transcript-backed",{worktreeId:b.worktreeId,cliToolId:b.cliToolId,instanceId:b.instanceId,graceMs:15e3})}async function _(a,b){try{let c=(0,e.getDbInstance)(),d=(0,f.ix)(c,{worktreeId:a.worktreeId,instanceId:a.instanceId});if(0===d.length)return;if(b.settled){C(c,a,Date.now())>0&&ae();return}if(A(a.cliToolId))return void await $(c,a);let g=null;for(let b=0;b<3;b+=1){let b=B(c,a,0);g=b?.id??null,await Z(I.DZ);let d=B(c,a,0);if((d?.id??null)===g){C(c,a,Date.now())>0&&ae();return}}V.info("relay-scrape-never-settled",{worktreeId:a.worktreeId,instanceId:a.instanceId,attempts:3})}catch(b){V.warn("relay-turn-completed-failed",{worktreeId:a.worktreeId,instanceId:a.instanceId,error:b instanceof Error?b.message:String(b)})}}function aa(a){try{let b=(0,e.getDbInstance)(),c=(0,f.ix)(b,{worktreeId:a.worktreeId,instanceId:a.instanceId});if(0===c.length)return;let d=(0,g.getLatestOpenPromptMessage)(b,a.worktreeId,a.cliToolId,a.instanceId);if(!d)return;let h=0;for(let e of c)H(b,a,e,d)&&(h+=1);h>0&&ae()}catch(b){V.warn("relay-prompt-notify-failed",{worktreeId:a.worktreeId,instanceId:a.instanceId,error:b instanceof Error?b.message:String(b)})}}async function ab(a,b,c,e,h,j){let l,m=(0,f.Ip)(a,b);if(!m)return"skipped";let n=(0,r.S)(a,m.from),o=await R(n.worktreeId,n.cliToolId,n.instanceId,a);if(o)return V.debug("relay-delivery-held",{relayId:b,kind:c,reason:o}),function(a,b,c,d,e){try{let g=(0,f.V9)(a,b);if(!g||g.kind!==c||g.body!==d||g.payloadId!==e||null!==g.relay.deliveryHold)return!1;return"expired"===c||(0,t.Lo)(g.relay.state)}catch{return!1}}(a,b,c,e,h)&&(j.block={reason:o,kind:c,payloadId:h,body:e,observedAt:Date.now()}),"held";let p=function(a,b,c,d,e){let g=(0,f.V9)(a,b);return g&&g.kind===c&&g.body===d&&g.payloadId===e?"expired"===c||(0,t.Lo)(g.relay.state)?g:(V.info("relay-delivery-closed",{relayId:b,kind:c,state:g.relay.state}),null):(V.info("relay-delivery-superseded",{relayId:b,kind:c}),null)}(a,b,c,e,h);if(!p)return"skipped";let q=p.relay,u=(0,r.S)(a,q.from),v=(0,d.randomUUID)();try{l=(0,f.ud)(a,{relayId:b,payloadId:p.payloadId,kind:c,body:e,attemptId:v,owner:(0,k.YT)(),mintPayloadId:(0,d.randomUUID)()})}catch(a){return V.warn("relay-delivery-claim-failed",{relayId:b,kind:c,error:a instanceof Error?a.message:String(a)}),"failed"}if(null===l)return V.info("relay-delivery-taken",{relayId:b,kind:c}),"skipped";let w={relayId:b,payloadId:l,attemptId:v};(0,s.o5)(b);let x=!1;try{let d,h=null;try{d=await (0,i.d)(a,{worktreeId:u.worktreeId,content:e,cliToolId:u.cliToolId,instanceId:u.instanceId,messageType:"relay",requestId:"reply"===c?(0,g.relayRequestId)(q.id):void 0,onAttempt:a=>{h=a}})}catch(e){var y;let d=(y=h,null===y?"send-threw":"sent"===y.state?"threw-after-sent":y.reason);return V.warn("relay-delivery-uncertain",{relayId:b,kind:c,reason:d,error:e instanceof Error?e.message:String(e)}),ac(a,w,d)&&ad(a,q,u,w,c,d),"uncertain"}if(!d.ok){let b=function(a,b,c,d,e,g,h){let i=b.relayId;return null!==h&&"not-sent"!==h.state?(V.info("relay-delivery-uncertain",{relayId:i,kind:e,stage:g,reason:h.reason}),ac(a,b,h.reason)&&ad(a,c,d,b,e,h.reason),{outcome:"uncertain",requeued:!1}):(V.info("relay-delivery-refused",{relayId:i,kind:e,stage:g}),{outcome:"prompt_waiting"===g?"held":"failed",requeued:function(a,b){try{return(0,f.ZJ)(a,b)}catch(a){return V.warn("relay-delivery-release-failed",{relayId:b.relayId,error:a instanceof Error?a.message:String(a)}),!1}}(a,b)})}(a,w,q,u,c,d.stage,h);return x=b.requeued,"held"===b.outcome&&b.requeued&&(j.block={reason:"prompt_waiting",kind:c,payloadId:w.payloadId,body:e,observedAt:Date.now()}),b.outcome}let k=Date.now(),{completed:l,promoted:m}=function(a,b,c,d,e){let h,i=!1;if("reply"===d){let d=(0,f.vp)(a,{...b,sentRequestId:(0,g.relayRequestId)(c.id),now:e});(h=d.completed)&&!d.closed&&V.info("relay-already-closed-on-deliver",{relayId:b.relayId})}else"prompt"===d?{completed:h,promoted:i}=(0,f.jl)(a,{...b,now:e}):h=(0,f.Tw)(a,{...b,now:e});return{completed:h,promoted:i}}(a,w,q,c,k);if(!l)return V.warn("relay-delivery-result-stale",{relayId:b,kind:c,attemptId:v}),"skipped";return m&&(globalThis.__relayPumpAgain=!0),function(a,b,c,d,e){let f=b.id;try{"reply"===d?(0,T._)(a,b.id,"replied",c,(0,r.S)(a,b.to),e,{overlap:b.overlap,holdReason:b.holdReason}):"prompt"===d&&(0,T._)(a,b.id,"waiting",c,(0,r.S)(a,b.to),e)}catch(a){V.warn("relay-delivery-record-failed",{relayId:f,kind:d,error:a instanceof Error?a.message:String(a)})}}(a,q,u,c,k),V.info("relay-delivered",{relayId:b,kind:c,to:`${u.worktreeId}/${u.instanceId}`}),"delivered"}finally{x&&"prompt"===c&&function(a,b,c){let d=b.id;try{(0,f.T)(a,b.id,c)&&(V.info("relay-prompt-superseded-after-failed-delivery",{relayId:d}),globalThis.__relayPumpAgain=!0)}catch(a){V.warn("relay-prompt-supersede-failed",{relayId:d,error:a instanceof Error?a.message:String(a)})}}(a,q,l),(0,s.dJ)(b)}}function ac(a,b,c){try{return(0,f.pk)(a,{...b,reason:c})}catch(a){return V.warn("relay-delivery-hold-failed",{relayId:b.relayId,error:a instanceof Error?a.message:String(a)}),!1}}function ad(a,b,c,d,e,f){try{(0,T._)(a,b.id,"held",c,(0,r.S)(a,b.to),d.now??Date.now(),{relayId:b.id,payload:`${e??"-"}:${d.payloadId}`,attemptId:d.attemptId,deliveryReason:f},`${d.payloadId}:${d.attemptId}`)}catch(a){V.warn("relay-held-line-failed",{relayId:d.relayId,error:a instanceof Error?a.message:String(a)})}}async function ae(){if(!globalThis.__relayPumpRunning){globalThis.__relayPumpRunning=!0;try{let a=(0,e.getDbInstance)();Y(a);for(let b=0;b<3;b+=1){globalThis.__relayPumpAgain=!1;let b=(0,f.sB)(a);for(let c of((0,S.qL)(new Set(b.map(a=>a.relay.id))),b))if(!W.has(c.relay.id)){W.add(c.relay.id);try{await function(a,b,c,d,e){let f={block:null},g=ab(a,b,c,d,e,f),h=()=>(0,S.fK)(b,f.block);return g.then(h,h),g}(a,c.relay.id,c.kind,c.body,c.payloadId)}catch(a){V.warn("relay-delivery-failed",{relayId:c.relay.id,error:a instanceof Error?a.message:String(a)})}finally{W.delete(c.relay.id)}}if(!globalThis.__relayPumpAgain)break}}catch(a){V.warn("relay-pump-failed",{error:a instanceof Error?a.message:String(a)})}finally{globalThis.__relayPumpRunning=!1}}}function af(){globalThis.__relayPumpAgain=!0,ae()}async function ag(){try{Y((0,e.getDbInstance)()),function(a,b=Date.now()){for(let c of(0,f.s7)(a,b))if(!(0,s.p5)(c.id))try{let d=(0,h.dV)(a);(0,f.uJ)(a,c.id,b),(0,f.zM)(a,c.id,b);let e=(0,j.KA)(d,z(a,c),c.expiresAt-c.createdAt),g=(0,f.be)(a,c.id,"expired",e,b);if(!(0,f.Cz)(a,c.id,b)){g&&(0,f.uJ)(a,c.id,b);continue}(0,T._)(a,c.id,"expired",(0,r.S)(a,c.from),(0,r.S)(a,c.to),b)}catch(a){V.warn("relay-expire-failed",{relayId:c.id,error:a instanceof Error?a.message:String(a)})}}((0,e.getDbInstance)())}catch(a){V.warn("relay-sweep-failed",{error:a instanceof Error?a.message:String(a)})}await ae()}},67164:(a,b,c)=>{c.d(b,{_:()=>i});var d=c(52660),e=c(55233),f=c(43015),g=c(640);let h=(0,c(72626).h)("relay-system-line");function i(a,b,c,j,k,l=Date.now(),m={},n=null){let o=(0,d.relaySystemRequestId)(b,c,n);try{let i=a.transaction(()=>{if((0,d.findMessageByRequestId)(a,j.worktreeId,o))return null;let f=(0,e.dV)(a);return(0,d.createRelaySystemMessage)(a,{worktreeId:j.worktreeId,cliToolId:j.cliToolId,instanceId:j.instanceId,content:(0,g.Nl)(f,c,k.alias,m),relayId:b,kind:c,scope:n,at:l})}).immediate();if(null===i)return!1;try{(0,f.broadcastMessage)("message",{worktreeId:j.worktreeId,message:{...i,cliToolId:j.cliToolId,instanceId:j.instanceId}})}catch(a){h.warn("relay-system-line-broadcast-failed",{relayId:b,kind:c,error:a instanceof Error?a.message:String(a)})}return!0}catch(a){return h.warn("relay-system-line-failed",{relayId:b,kind:c,error:a instanceof Error?a.message:String(a)}),!1}}},85016:(a,b,c)=>{c.d(b,{dJ:()=>f,o5:()=>e,p5:()=>g});let d=(0,c(36925).v)("__relayDeliveryClaims",()=>new Set);function e(a){d.add(a)}function f(a){d.delete(a)}function g(a){return d.has(a)}}};