commandmate 0.49.0 → 0.49.2

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 (806) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-build-manifest.json +251 -248
  3. package/.next/app-path-routes-manifest.json +22 -21
  4. package/.next/build-manifest.json +2 -2
  5. package/.next/prerender-manifest.json +9 -9
  6. package/.next/required-server-files.json +1 -1
  7. package/.next/routes-manifest.json +8 -0
  8. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  9. package/.next/server/app/api/agents/update/route_client-reference-manifest.js +1 -1
  10. package/.next/server/app/api/agents/versions/route_client-reference-manifest.js +1 -1
  11. package/.next/server/app/api/app/release-notes/route_client-reference-manifest.js +1 -1
  12. package/.next/server/app/api/app/update/route_client-reference-manifest.js +1 -1
  13. package/.next/server/app/api/app/update-check/route_client-reference-manifest.js +1 -1
  14. package/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -1
  15. package/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -1
  16. package/.next/server/app/api/auth/status/route_client-reference-manifest.js +1 -1
  17. package/.next/server/app/api/capabilities/route.js +1 -1
  18. package/.next/server/app/api/capabilities/route_client-reference-manifest.js +1 -1
  19. package/.next/server/app/api/daily-summary/route_client-reference-manifest.js +1 -1
  20. package/.next/server/app/api/daily-summary/status/route_client-reference-manifest.js +1 -1
  21. package/.next/server/app/api/external-apps/[id]/health/route_client-reference-manifest.js +1 -1
  22. package/.next/server/app/api/external-apps/[id]/route_client-reference-manifest.js +1 -1
  23. package/.next/server/app/api/external-apps/route_client-reference-manifest.js +1 -1
  24. package/.next/server/app/api/fs/browse/route_client-reference-manifest.js +1 -1
  25. package/.next/server/app/api/fs/recent-paths/route_client-reference-manifest.js +1 -1
  26. package/.next/server/app/api/hooks/agent-event/route.js +2 -2
  27. package/.next/server/app/api/hooks/agent-event/route.js.nft.json +1 -1
  28. package/.next/server/app/api/hooks/agent-event/route_client-reference-manifest.js +1 -1
  29. package/.next/server/app/api/hooks/claude-done/route.js +2 -2
  30. package/.next/server/app/api/hooks/claude-done/route.js.nft.json +1 -1
  31. package/.next/server/app/api/hooks/claude-done/route_client-reference-manifest.js +1 -1
  32. package/.next/server/app/api/hooks/permission-request/route.js +1 -1
  33. package/.next/server/app/api/hooks/permission-request/route.js.nft.json +1 -1
  34. package/.next/server/app/api/hooks/permission-request/route_client-reference-manifest.js +1 -1
  35. package/.next/server/app/api/metrics/vibe/route_client-reference-manifest.js +1 -1
  36. package/.next/server/app/api/ollama/models/route_client-reference-manifest.js +1 -1
  37. package/.next/server/app/api/push/escalation/route_client-reference-manifest.js +1 -1
  38. package/.next/server/app/api/push/subscriptions/route.js +1 -1
  39. package/.next/server/app/api/push/subscriptions/route_client-reference-manifest.js +1 -1
  40. package/.next/server/app/api/push/vapid/route_client-reference-manifest.js +1 -1
  41. package/.next/server/app/api/relays/[relayId]/cancel/route.js +1 -1
  42. package/.next/server/app/api/relays/[relayId]/cancel/route.js.nft.json +1 -1
  43. package/.next/server/app/api/relays/[relayId]/cancel/route_client-reference-manifest.js +1 -1
  44. package/.next/server/app/api/relays/[relayId]/route.js +1 -0
  45. package/.next/server/app/api/relays/[relayId]/route.js.nft.json +1 -0
  46. package/.next/server/app/api/relays/[relayId]/route_client-reference-manifest.js +1 -0
  47. package/.next/server/app/api/relays/route.js +1 -1
  48. package/.next/server/app/api/relays/route.js.nft.json +1 -1
  49. package/.next/server/app/api/relays/route_client-reference-manifest.js +1 -1
  50. package/.next/server/app/api/remote/pair/route_client-reference-manifest.js +1 -1
  51. package/.next/server/app/api/repositories/[id]/route_client-reference-manifest.js +1 -1
  52. package/.next/server/app/api/repositories/clone/[jobId]/route.js +1 -1
  53. package/.next/server/app/api/repositories/clone/[jobId]/route.js.nft.json +1 -1
  54. package/.next/server/app/api/repositories/clone/[jobId]/route_client-reference-manifest.js +1 -1
  55. package/.next/server/app/api/repositories/clone/route.js +1 -1
  56. package/.next/server/app/api/repositories/clone/route.js.nft.json +1 -1
  57. package/.next/server/app/api/repositories/clone/route_client-reference-manifest.js +1 -1
  58. package/.next/server/app/api/repositories/excluded/route_client-reference-manifest.js +1 -1
  59. package/.next/server/app/api/repositories/restore/route.js +1 -1
  60. package/.next/server/app/api/repositories/restore/route.js.nft.json +1 -1
  61. package/.next/server/app/api/repositories/restore/route_client-reference-manifest.js +1 -1
  62. package/.next/server/app/api/repositories/route.js +1 -1
  63. package/.next/server/app/api/repositories/route.js.nft.json +1 -1
  64. package/.next/server/app/api/repositories/route_client-reference-manifest.js +1 -1
  65. package/.next/server/app/api/repositories/scan/route.js +1 -1
  66. package/.next/server/app/api/repositories/scan/route.js.nft.json +1 -1
  67. package/.next/server/app/api/repositories/scan/route_client-reference-manifest.js +1 -1
  68. package/.next/server/app/api/repositories/sync/route.js +1 -1
  69. package/.next/server/app/api/repositories/sync/route.js.nft.json +1 -1
  70. package/.next/server/app/api/repositories/sync/route_client-reference-manifest.js +1 -1
  71. package/.next/server/app/api/repositories/validate-path/route_client-reference-manifest.js +1 -1
  72. package/.next/server/app/api/settings/default-agents/route.js +1 -1
  73. package/.next/server/app/api/settings/default-agents/route.js.nft.json +1 -1
  74. package/.next/server/app/api/settings/default-agents/route_client-reference-manifest.js +1 -1
  75. package/.next/server/app/api/settings/default-surface-mode/route_client-reference-manifest.js +1 -1
  76. package/.next/server/app/api/sidebar/group-order/route_client-reference-manifest.js +1 -1
  77. package/.next/server/app/api/skills/[id]/route_client-reference-manifest.js +1 -1
  78. package/.next/server/app/api/skills/installations/route_client-reference-manifest.js +1 -1
  79. package/.next/server/app/api/skills/operations/route_client-reference-manifest.js +1 -1
  80. package/.next/server/app/api/skills/reindex/route_client-reference-manifest.js +1 -1
  81. package/.next/server/app/api/skills/route_client-reference-manifest.js +1 -1
  82. package/.next/server/app/api/slash-commands/route_client-reference-manifest.js +1 -1
  83. package/.next/server/app/api/tasks/[taskId]/cancel/route_client-reference-manifest.js +1 -1
  84. package/.next/server/app/api/tasks/[taskId]/route.js +1 -1
  85. package/.next/server/app/api/tasks/[taskId]/route_client-reference-manifest.js +1 -1
  86. package/.next/server/app/api/templates/[id]/route_client-reference-manifest.js +1 -1
  87. package/.next/server/app/api/templates/route_client-reference-manifest.js +1 -1
  88. package/.next/server/app/api/verification/runs/[runId]/route.js +1 -1
  89. package/.next/server/app/api/verification/runs/[runId]/route_client-reference-manifest.js +1 -1
  90. package/.next/server/app/api/verification/runs/route.js +1 -1
  91. package/.next/server/app/api/verification/runs/route_client-reference-manifest.js +1 -1
  92. package/.next/server/app/api/worktrees/[id]/auto-yes/route.js +1 -1
  93. package/.next/server/app/api/worktrees/[id]/auto-yes/route.js.nft.json +1 -1
  94. package/.next/server/app/api/worktrees/[id]/auto-yes/route_client-reference-manifest.js +1 -1
  95. package/.next/server/app/api/worktrees/[id]/capture/route.js +1 -1
  96. package/.next/server/app/api/worktrees/[id]/capture/route.js.nft.json +1 -1
  97. package/.next/server/app/api/worktrees/[id]/capture/route_client-reference-manifest.js +1 -1
  98. package/.next/server/app/api/worktrees/[id]/clear-composer/route.js +1 -1
  99. package/.next/server/app/api/worktrees/[id]/clear-composer/route.js.nft.json +1 -1
  100. package/.next/server/app/api/worktrees/[id]/clear-composer/route_client-reference-manifest.js +1 -1
  101. package/.next/server/app/api/worktrees/[id]/cli-reference/route.js +1 -1
  102. package/.next/server/app/api/worktrees/[id]/cli-reference/route_client-reference-manifest.js +1 -1
  103. package/.next/server/app/api/worktrees/[id]/cli-tool/route.js +1 -1
  104. package/.next/server/app/api/worktrees/[id]/cli-tool/route_client-reference-manifest.js +1 -1
  105. package/.next/server/app/api/worktrees/[id]/cmate/schedules/route.js +1 -1
  106. package/.next/server/app/api/worktrees/[id]/cmate/schedules/route_client-reference-manifest.js +1 -1
  107. package/.next/server/app/api/worktrees/[id]/current-output/route.js +1 -1
  108. package/.next/server/app/api/worktrees/[id]/current-output/route.js.nft.json +1 -1
  109. package/.next/server/app/api/worktrees/[id]/current-output/route_client-reference-manifest.js +1 -1
  110. package/.next/server/app/api/worktrees/[id]/direct-input/route.js +1 -1
  111. package/.next/server/app/api/worktrees/[id]/direct-input/route.js.nft.json +1 -1
  112. package/.next/server/app/api/worktrees/[id]/direct-input/route_client-reference-manifest.js +1 -1
  113. package/.next/server/app/api/worktrees/[id]/env/route.js +1 -1
  114. package/.next/server/app/api/worktrees/[id]/env/route_client-reference-manifest.js +1 -1
  115. package/.next/server/app/api/worktrees/[id]/execution-logs/[logId]/route.js +1 -1
  116. package/.next/server/app/api/worktrees/[id]/execution-logs/[logId]/route_client-reference-manifest.js +1 -1
  117. package/.next/server/app/api/worktrees/[id]/execution-logs/route.js +1 -1
  118. package/.next/server/app/api/worktrees/[id]/execution-logs/route_client-reference-manifest.js +1 -1
  119. package/.next/server/app/api/worktrees/[id]/files/[...path]/route_client-reference-manifest.js +1 -1
  120. package/.next/server/app/api/worktrees/[id]/git/branch/create/route.js +1 -1
  121. package/.next/server/app/api/worktrees/[id]/git/branch/create/route_client-reference-manifest.js +1 -1
  122. package/.next/server/app/api/worktrees/[id]/git/branch/delete/route.js +1 -1
  123. package/.next/server/app/api/worktrees/[id]/git/branch/delete/route_client-reference-manifest.js +1 -1
  124. package/.next/server/app/api/worktrees/[id]/git/branches/route.js +1 -1
  125. package/.next/server/app/api/worktrees/[id]/git/branches/route_client-reference-manifest.js +1 -1
  126. package/.next/server/app/api/worktrees/[id]/git/checkout/route.js +1 -1
  127. package/.next/server/app/api/worktrees/[id]/git/checkout/route_client-reference-manifest.js +1 -1
  128. package/.next/server/app/api/worktrees/[id]/git/commit/route.js +1 -1
  129. package/.next/server/app/api/worktrees/[id]/git/commit/route_client-reference-manifest.js +1 -1
  130. package/.next/server/app/api/worktrees/[id]/git/diff/route.js +1 -1
  131. package/.next/server/app/api/worktrees/[id]/git/diff/route_client-reference-manifest.js +1 -1
  132. package/.next/server/app/api/worktrees/[id]/git/fetch/route.js +1 -1
  133. package/.next/server/app/api/worktrees/[id]/git/fetch/route_client-reference-manifest.js +1 -1
  134. package/.next/server/app/api/worktrees/[id]/git/log/route.js +1 -1
  135. package/.next/server/app/api/worktrees/[id]/git/log/route_client-reference-manifest.js +1 -1
  136. package/.next/server/app/api/worktrees/[id]/git/pull/route.js +1 -1
  137. package/.next/server/app/api/worktrees/[id]/git/pull/route_client-reference-manifest.js +1 -1
  138. package/.next/server/app/api/worktrees/[id]/git/push/route.js +1 -1
  139. package/.next/server/app/api/worktrees/[id]/git/push/route_client-reference-manifest.js +1 -1
  140. package/.next/server/app/api/worktrees/[id]/git/reset/route.js +1 -1
  141. package/.next/server/app/api/worktrees/[id]/git/reset/route_client-reference-manifest.js +1 -1
  142. package/.next/server/app/api/worktrees/[id]/git/revert/route.js +1 -1
  143. package/.next/server/app/api/worktrees/[id]/git/revert/route_client-reference-manifest.js +1 -1
  144. package/.next/server/app/api/worktrees/[id]/git/show/[commitHash]/route.js +1 -1
  145. package/.next/server/app/api/worktrees/[id]/git/show/[commitHash]/route_client-reference-manifest.js +1 -1
  146. package/.next/server/app/api/worktrees/[id]/git/stage/route.js +1 -1
  147. package/.next/server/app/api/worktrees/[id]/git/stage/route_client-reference-manifest.js +1 -1
  148. package/.next/server/app/api/worktrees/[id]/git/staged/route.js +1 -1
  149. package/.next/server/app/api/worktrees/[id]/git/staged/route_client-reference-manifest.js +1 -1
  150. package/.next/server/app/api/worktrees/[id]/git/stash/[index]/route.js +1 -1
  151. package/.next/server/app/api/worktrees/[id]/git/stash/[index]/route_client-reference-manifest.js +1 -1
  152. package/.next/server/app/api/worktrees/[id]/git/stash/apply/route.js +1 -1
  153. package/.next/server/app/api/worktrees/[id]/git/stash/apply/route_client-reference-manifest.js +1 -1
  154. package/.next/server/app/api/worktrees/[id]/git/stash/pop/route.js +1 -1
  155. package/.next/server/app/api/worktrees/[id]/git/stash/pop/route_client-reference-manifest.js +1 -1
  156. package/.next/server/app/api/worktrees/[id]/git/stash/push/route.js +1 -1
  157. package/.next/server/app/api/worktrees/[id]/git/stash/push/route_client-reference-manifest.js +1 -1
  158. package/.next/server/app/api/worktrees/[id]/git/stash/route.js +1 -1
  159. package/.next/server/app/api/worktrees/[id]/git/stash/route_client-reference-manifest.js +1 -1
  160. package/.next/server/app/api/worktrees/[id]/git/status/route.js +1 -1
  161. package/.next/server/app/api/worktrees/[id]/git/status/route_client-reference-manifest.js +1 -1
  162. package/.next/server/app/api/worktrees/[id]/git/unstage/route.js +1 -1
  163. package/.next/server/app/api/worktrees/[id]/git/unstage/route_client-reference-manifest.js +1 -1
  164. package/.next/server/app/api/worktrees/[id]/git/working-diff/route.js +1 -1
  165. package/.next/server/app/api/worktrees/[id]/git/working-diff/route_client-reference-manifest.js +1 -1
  166. package/.next/server/app/api/worktrees/[id]/instances/notes/route.js +1 -1
  167. package/.next/server/app/api/worktrees/[id]/instances/notes/route_client-reference-manifest.js +1 -1
  168. package/.next/server/app/api/worktrees/[id]/instances/opencode/route.js +1 -1
  169. package/.next/server/app/api/worktrees/[id]/instances/opencode/route.js.nft.json +1 -1
  170. package/.next/server/app/api/worktrees/[id]/instances/opencode/route_client-reference-manifest.js +1 -1
  171. package/.next/server/app/api/worktrees/[id]/interrupt/route.js +1 -1
  172. package/.next/server/app/api/worktrees/[id]/interrupt/route.js.nft.json +1 -1
  173. package/.next/server/app/api/worktrees/[id]/interrupt/route_client-reference-manifest.js +1 -1
  174. package/.next/server/app/api/worktrees/[id]/kill-session/route.js +2 -1
  175. package/.next/server/app/api/worktrees/[id]/kill-session/route.js.nft.json +1 -1
  176. package/.next/server/app/api/worktrees/[id]/kill-session/route_client-reference-manifest.js +1 -1
  177. package/.next/server/app/api/worktrees/[id]/logs/[filename]/route.js +1 -1
  178. package/.next/server/app/api/worktrees/[id]/logs/[filename]/route.js.nft.json +1 -1
  179. package/.next/server/app/api/worktrees/[id]/logs/[filename]/route_client-reference-manifest.js +1 -1
  180. package/.next/server/app/api/worktrees/[id]/logs/route.js +2 -2
  181. package/.next/server/app/api/worktrees/[id]/logs/route.js.nft.json +1 -1
  182. package/.next/server/app/api/worktrees/[id]/logs/route_client-reference-manifest.js +1 -1
  183. package/.next/server/app/api/worktrees/[id]/marp-render/route.js +1 -1
  184. package/.next/server/app/api/worktrees/[id]/marp-render/route_client-reference-manifest.js +1 -1
  185. package/.next/server/app/api/worktrees/[id]/memos/[memoId]/route.js +1 -1
  186. package/.next/server/app/api/worktrees/[id]/memos/[memoId]/route_client-reference-manifest.js +1 -1
  187. package/.next/server/app/api/worktrees/[id]/memos/route.js +1 -1
  188. package/.next/server/app/api/worktrees/[id]/memos/route_client-reference-manifest.js +1 -1
  189. package/.next/server/app/api/worktrees/[id]/messages/route.js +1 -1
  190. package/.next/server/app/api/worktrees/[id]/messages/route_client-reference-manifest.js +1 -1
  191. package/.next/server/app/api/worktrees/[id]/opencode/diff/route.js +1 -1
  192. package/.next/server/app/api/worktrees/[id]/opencode/diff/route.js.nft.json +1 -1
  193. package/.next/server/app/api/worktrees/[id]/opencode/diff/route_client-reference-manifest.js +1 -1
  194. package/.next/server/app/api/worktrees/[id]/opencode/session/route.js +1 -1
  195. package/.next/server/app/api/worktrees/[id]/opencode/session/route.js.nft.json +1 -1
  196. package/.next/server/app/api/worktrees/[id]/opencode/session/route_client-reference-manifest.js +1 -1
  197. package/.next/server/app/api/worktrees/[id]/opencode/share/route.js +1 -1
  198. package/.next/server/app/api/worktrees/[id]/opencode/share/route.js.nft.json +1 -1
  199. package/.next/server/app/api/worktrees/[id]/opencode/share/route_client-reference-manifest.js +1 -1
  200. package/.next/server/app/api/worktrees/[id]/prompt-response/route.js +1 -1
  201. package/.next/server/app/api/worktrees/[id]/prompt-response/route.js.nft.json +1 -1
  202. package/.next/server/app/api/worktrees/[id]/prompt-response/route_client-reference-manifest.js +1 -1
  203. package/.next/server/app/api/worktrees/[id]/prompt-response/strict/route.js +1 -1
  204. package/.next/server/app/api/worktrees/[id]/prompt-response/strict/route.js.nft.json +1 -1
  205. package/.next/server/app/api/worktrees/[id]/prompt-response/strict/route_client-reference-manifest.js +1 -1
  206. package/.next/server/app/api/worktrees/[id]/resolve-target/route.js +1 -1
  207. package/.next/server/app/api/worktrees/[id]/resolve-target/route_client-reference-manifest.js +1 -1
  208. package/.next/server/app/api/worktrees/[id]/respond/route.js +1 -1
  209. package/.next/server/app/api/worktrees/[id]/respond/route.js.nft.json +1 -1
  210. package/.next/server/app/api/worktrees/[id]/respond/route_client-reference-manifest.js +1 -1
  211. package/.next/server/app/api/worktrees/[id]/route.js +1 -1
  212. package/.next/server/app/api/worktrees/[id]/route.js.nft.json +1 -1
  213. package/.next/server/app/api/worktrees/[id]/route_client-reference-manifest.js +1 -1
  214. package/.next/server/app/api/worktrees/[id]/schedules/[scheduleId]/route.js +1 -1
  215. package/.next/server/app/api/worktrees/[id]/schedules/[scheduleId]/route_client-reference-manifest.js +1 -1
  216. package/.next/server/app/api/worktrees/[id]/schedules/active/route.js +1 -1
  217. package/.next/server/app/api/worktrees/[id]/schedules/active/route_client-reference-manifest.js +1 -1
  218. package/.next/server/app/api/worktrees/[id]/schedules/route.js +1 -1
  219. package/.next/server/app/api/worktrees/[id]/schedules/route_client-reference-manifest.js +1 -1
  220. package/.next/server/app/api/worktrees/[id]/search/route_client-reference-manifest.js +1 -1
  221. package/.next/server/app/api/worktrees/[id]/send/route.js +144 -1
  222. package/.next/server/app/api/worktrees/[id]/send/route.js.nft.json +1 -1
  223. package/.next/server/app/api/worktrees/[id]/send/route_client-reference-manifest.js +1 -1
  224. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/git-workflow/route.js +2 -2
  225. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/git-workflow/route.js.nft.json +1 -1
  226. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/git-workflow/route_client-reference-manifest.js +1 -1
  227. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/install/route_client-reference-manifest.js +1 -1
  228. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/plan/route_client-reference-manifest.js +1 -1
  229. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/uninstall/route_client-reference-manifest.js +1 -1
  230. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/uninstall-plan/route_client-reference-manifest.js +1 -1
  231. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/update/route_client-reference-manifest.js +1 -1
  232. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/update-plan/route_client-reference-manifest.js +1 -1
  233. package/.next/server/app/api/worktrees/[id]/skills/route.js +1 -1
  234. package/.next/server/app/api/worktrees/[id]/skills/route_client-reference-manifest.js +1 -1
  235. package/.next/server/app/api/worktrees/[id]/slash-commands/route.js +1 -1
  236. package/.next/server/app/api/worktrees/[id]/slash-commands/route_client-reference-manifest.js +1 -1
  237. package/.next/server/app/api/worktrees/[id]/special-keys/route.js +1 -1
  238. package/.next/server/app/api/worktrees/[id]/special-keys/route.js.nft.json +1 -1
  239. package/.next/server/app/api/worktrees/[id]/special-keys/route_client-reference-manifest.js +1 -1
  240. package/.next/server/app/api/worktrees/[id]/tasks/route.js +1 -1
  241. package/.next/server/app/api/worktrees/[id]/tasks/route_client-reference-manifest.js +1 -1
  242. package/.next/server/app/api/worktrees/[id]/terminal/route.js +103 -1
  243. package/.next/server/app/api/worktrees/[id]/terminal/route.js.nft.json +1 -1
  244. package/.next/server/app/api/worktrees/[id]/terminal/route_client-reference-manifest.js +1 -1
  245. package/.next/server/app/api/worktrees/[id]/timers/history/route.js +1 -1
  246. package/.next/server/app/api/worktrees/[id]/timers/history/route_client-reference-manifest.js +1 -1
  247. package/.next/server/app/api/worktrees/[id]/timers/route.js +1 -1
  248. package/.next/server/app/api/worktrees/[id]/timers/route.js.nft.json +1 -1
  249. package/.next/server/app/api/worktrees/[id]/timers/route_client-reference-manifest.js +1 -1
  250. package/.next/server/app/api/worktrees/[id]/todos/[todoId]/route.js +1 -1
  251. package/.next/server/app/api/worktrees/[id]/todos/[todoId]/route.js.nft.json +1 -1
  252. package/.next/server/app/api/worktrees/[id]/todos/[todoId]/route_client-reference-manifest.js +1 -1
  253. package/.next/server/app/api/worktrees/[id]/todos/route.js +1 -1
  254. package/.next/server/app/api/worktrees/[id]/todos/route.js.nft.json +1 -1
  255. package/.next/server/app/api/worktrees/[id]/todos/route_client-reference-manifest.js +1 -1
  256. package/.next/server/app/api/worktrees/[id]/tree/[...path]/route_client-reference-manifest.js +1 -1
  257. package/.next/server/app/api/worktrees/[id]/tree/route_client-reference-manifest.js +1 -1
  258. package/.next/server/app/api/worktrees/[id]/upload/[...path]/route_client-reference-manifest.js +1 -1
  259. package/.next/server/app/api/worktrees/[id]/verify/config/route.js +1 -1
  260. package/.next/server/app/api/worktrees/[id]/verify/config/route_client-reference-manifest.js +1 -1
  261. package/.next/server/app/api/worktrees/[id]/verify/route.js +1 -1
  262. package/.next/server/app/api/worktrees/[id]/verify/route.js.nft.json +1 -1
  263. package/.next/server/app/api/worktrees/[id]/verify/route_client-reference-manifest.js +1 -1
  264. package/.next/server/app/api/worktrees/[id]/verify/runs/[runId]/cancel/route.js +1 -1
  265. package/.next/server/app/api/worktrees/[id]/verify/runs/[runId]/cancel/route.js.nft.json +1 -1
  266. package/.next/server/app/api/worktrees/[id]/verify/runs/[runId]/cancel/route_client-reference-manifest.js +1 -1
  267. package/.next/server/app/api/worktrees/[id]/verify/runs/[runId]/route.js +1 -1
  268. package/.next/server/app/api/worktrees/[id]/verify/runs/[runId]/route_client-reference-manifest.js +1 -1
  269. package/.next/server/app/api/worktrees/[id]/verify/runs/route.js +1 -1
  270. package/.next/server/app/api/worktrees/[id]/verify/runs/route_client-reference-manifest.js +1 -1
  271. package/.next/server/app/api/worktrees/[id]/viewed/route.js +1 -1
  272. package/.next/server/app/api/worktrees/[id]/viewed/route_client-reference-manifest.js +1 -1
  273. package/.next/server/app/api/worktrees/apply-default-agents/route_client-reference-manifest.js +1 -1
  274. package/.next/server/app/api/worktrees/route.js +1 -1
  275. package/.next/server/app/api/worktrees/route.js.nft.json +1 -1
  276. package/.next/server/app/api/worktrees/route_client-reference-manifest.js +1 -1
  277. package/.next/server/app/login/page_client-reference-manifest.js +1 -1
  278. package/.next/server/app/manifest.webmanifest/route_client-reference-manifest.js +1 -1
  279. package/.next/server/app/more/page_client-reference-manifest.js +1 -1
  280. package/.next/server/app/offline/page_client-reference-manifest.js +1 -1
  281. package/.next/server/app/page_client-reference-manifest.js +1 -1
  282. package/.next/server/app/proxy/[...path]/route_client-reference-manifest.js +1 -1
  283. package/.next/server/app/repositories/page_client-reference-manifest.js +1 -1
  284. package/.next/server/app/review/page.js +1 -1
  285. package/.next/server/app/review/page_client-reference-manifest.js +1 -1
  286. package/.next/server/app/sessions/page.js +1 -1
  287. package/.next/server/app/sessions/page.js.nft.json +1 -1
  288. package/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
  289. package/.next/server/app/skills/[skillId]/page_client-reference-manifest.js +1 -1
  290. package/.next/server/app/skills/installed/page_client-reference-manifest.js +1 -1
  291. package/.next/server/app/skills/page_client-reference-manifest.js +1 -1
  292. package/.next/server/app/worktrees/[id]/files/[...path]/page_client-reference-manifest.js +1 -1
  293. package/.next/server/app/worktrees/[id]/page.js +11 -11
  294. package/.next/server/app/worktrees/[id]/page.js.nft.json +1 -1
  295. package/.next/server/app/worktrees/[id]/page_client-reference-manifest.js +1 -1
  296. package/.next/server/app/worktrees/[id]/terminal/page_client-reference-manifest.js +1 -1
  297. package/.next/server/app-paths-manifest.json +22 -21
  298. package/.next/server/chunks/1062.js +1 -0
  299. package/.next/server/chunks/{936.js → 110.js} +1 -1
  300. package/.next/server/chunks/1501.js +5 -4
  301. package/.next/server/chunks/1656.js +2 -2
  302. package/.next/server/chunks/1957.js +2 -0
  303. package/.next/server/chunks/2119.js +1 -1
  304. package/.next/server/chunks/2404.js +1 -1
  305. package/.next/server/chunks/2445.js +1 -1
  306. package/.next/server/chunks/2897.js +1 -0
  307. package/.next/server/chunks/3417.js +1 -0
  308. package/.next/server/chunks/3505.js +1 -1
  309. package/.next/server/chunks/{4280.js → 3756.js} +1 -1
  310. package/.next/server/chunks/3801.js +31 -0
  311. package/.next/server/chunks/4911.js +1 -0
  312. package/.next/server/chunks/4936.js +1 -0
  313. package/.next/server/chunks/5209.js +2 -1
  314. package/.next/server/chunks/5354.js +1 -1
  315. package/.next/server/chunks/{9130.js → 5630.js} +1 -1
  316. package/.next/server/chunks/610.js +1 -0
  317. package/.next/server/chunks/6119.js +1 -1
  318. package/.next/server/chunks/6130.js +1 -1
  319. package/.next/server/chunks/6401.js +1 -1
  320. package/.next/server/chunks/6486.js +1 -1
  321. package/.next/server/chunks/6781.js +1 -1
  322. package/.next/server/chunks/6808.js +4 -0
  323. package/.next/server/chunks/7023.js +14 -0
  324. package/.next/server/chunks/7905.js +1 -1
  325. package/.next/server/chunks/8581.js +8 -8
  326. package/.next/server/chunks/8728.js +2 -2
  327. package/.next/server/chunks/8782.js +1 -1
  328. package/.next/server/chunks/8807.js +63 -53
  329. package/.next/server/chunks/8918.js +103 -1
  330. package/.next/server/chunks/9198.js +144 -0
  331. package/.next/server/chunks/9390.js +1 -1
  332. package/.next/server/chunks/9584.js +1 -1
  333. package/.next/server/chunks/9627.js +1 -1
  334. package/.next/server/chunks/9731.js +3 -3
  335. package/.next/server/middleware-manifest.json +5 -5
  336. package/.next/server/pages/500.html +1 -1
  337. package/.next/server/server-reference-manifest.json +1 -1
  338. package/.next/static/chunks/{2407-ab92ae9837c39dce.js → 2407-07a237575e1ceb9e.js} +1 -1
  339. package/.next/static/chunks/3931-61ad1a4fc0208d0e.js +1 -0
  340. package/.next/static/chunks/5794-7975b8e51e731b19.js +1 -0
  341. package/.next/static/chunks/6966-d8dc6032410ffaba.js +1 -0
  342. package/.next/static/chunks/7197-ed3b3d99ac3bd450.js +1 -0
  343. package/.next/static/chunks/7636-a48cf0f7110250c5.js +1 -0
  344. package/.next/static/chunks/app/api/agents/update/route-a4f129c451de7859.js +1 -0
  345. package/.next/static/chunks/app/api/agents/versions/route-a4f129c451de7859.js +1 -0
  346. package/.next/static/chunks/app/api/app/release-notes/route-a4f129c451de7859.js +1 -0
  347. package/.next/static/chunks/app/api/app/update/route-a4f129c451de7859.js +1 -0
  348. package/.next/static/chunks/app/api/app/update-check/route-a4f129c451de7859.js +1 -0
  349. package/.next/static/chunks/app/api/auth/login/route-a4f129c451de7859.js +1 -0
  350. package/.next/static/chunks/app/api/auth/logout/route-a4f129c451de7859.js +1 -0
  351. package/.next/static/chunks/app/api/auth/status/route-a4f129c451de7859.js +1 -0
  352. package/.next/static/chunks/app/api/capabilities/route-a4f129c451de7859.js +1 -0
  353. package/.next/static/chunks/app/api/daily-summary/route-a4f129c451de7859.js +1 -0
  354. package/.next/static/chunks/app/api/daily-summary/status/route-a4f129c451de7859.js +1 -0
  355. package/.next/static/chunks/app/api/external-apps/[id]/health/route-a4f129c451de7859.js +1 -0
  356. package/.next/static/chunks/app/api/external-apps/[id]/route-a4f129c451de7859.js +1 -0
  357. package/.next/static/chunks/app/api/external-apps/route-a4f129c451de7859.js +1 -0
  358. package/.next/static/chunks/app/api/fs/browse/route-a4f129c451de7859.js +1 -0
  359. package/.next/static/chunks/app/api/fs/recent-paths/route-a4f129c451de7859.js +1 -0
  360. package/.next/static/chunks/app/api/hooks/agent-event/route-a4f129c451de7859.js +1 -0
  361. package/.next/static/chunks/app/api/hooks/claude-done/route-a4f129c451de7859.js +1 -0
  362. package/.next/static/chunks/app/api/hooks/permission-request/route-a4f129c451de7859.js +1 -0
  363. package/.next/static/chunks/app/api/metrics/vibe/route-a4f129c451de7859.js +1 -0
  364. package/.next/static/chunks/app/api/ollama/models/route-a4f129c451de7859.js +1 -0
  365. package/.next/static/chunks/app/api/push/escalation/route-a4f129c451de7859.js +1 -0
  366. package/.next/static/chunks/app/api/push/subscriptions/route-a4f129c451de7859.js +1 -0
  367. package/.next/static/chunks/app/api/push/vapid/route-a4f129c451de7859.js +1 -0
  368. package/.next/static/chunks/app/api/relays/[relayId]/cancel/route-a4f129c451de7859.js +1 -0
  369. package/.next/static/chunks/app/api/relays/[relayId]/route-a4f129c451de7859.js +1 -0
  370. package/.next/static/chunks/app/api/relays/route-a4f129c451de7859.js +1 -0
  371. package/.next/static/chunks/app/api/remote/pair/route-a4f129c451de7859.js +1 -0
  372. package/.next/static/chunks/app/api/repositories/[id]/route-a4f129c451de7859.js +1 -0
  373. package/.next/static/chunks/app/api/repositories/clone/[jobId]/route-a4f129c451de7859.js +1 -0
  374. package/.next/static/chunks/app/api/repositories/clone/route-a4f129c451de7859.js +1 -0
  375. package/.next/static/chunks/app/api/repositories/excluded/route-a4f129c451de7859.js +1 -0
  376. package/.next/static/chunks/app/api/repositories/restore/route-a4f129c451de7859.js +1 -0
  377. package/.next/static/chunks/app/api/repositories/route-a4f129c451de7859.js +1 -0
  378. package/.next/static/chunks/app/api/repositories/scan/route-a4f129c451de7859.js +1 -0
  379. package/.next/static/chunks/app/api/repositories/sync/route-a4f129c451de7859.js +1 -0
  380. package/.next/static/chunks/app/api/repositories/validate-path/route-a4f129c451de7859.js +1 -0
  381. package/.next/static/chunks/app/api/settings/default-agents/route-a4f129c451de7859.js +1 -0
  382. package/.next/static/chunks/app/api/settings/default-surface-mode/route-a4f129c451de7859.js +1 -0
  383. package/.next/static/chunks/app/api/sidebar/group-order/route-a4f129c451de7859.js +1 -0
  384. package/.next/static/chunks/app/api/skills/[id]/route-a4f129c451de7859.js +1 -0
  385. package/.next/static/chunks/app/api/skills/installations/route-a4f129c451de7859.js +1 -0
  386. package/.next/static/chunks/app/api/skills/operations/route-a4f129c451de7859.js +1 -0
  387. package/.next/static/chunks/app/api/skills/reindex/route-a4f129c451de7859.js +1 -0
  388. package/.next/static/chunks/app/api/skills/route-a4f129c451de7859.js +1 -0
  389. package/.next/static/chunks/app/api/slash-commands/route-a4f129c451de7859.js +1 -0
  390. package/.next/static/chunks/app/api/tasks/[taskId]/cancel/route-a4f129c451de7859.js +1 -0
  391. package/.next/static/chunks/app/api/tasks/[taskId]/route-a4f129c451de7859.js +1 -0
  392. package/.next/static/chunks/app/api/templates/[id]/route-a4f129c451de7859.js +1 -0
  393. package/.next/static/chunks/app/api/templates/route-a4f129c451de7859.js +1 -0
  394. package/.next/static/chunks/app/api/verification/runs/[runId]/route-a4f129c451de7859.js +1 -0
  395. package/.next/static/chunks/app/api/verification/runs/route-a4f129c451de7859.js +1 -0
  396. package/.next/static/chunks/app/api/worktrees/[id]/auto-yes/route-a4f129c451de7859.js +1 -0
  397. package/.next/static/chunks/app/api/worktrees/[id]/capture/route-a4f129c451de7859.js +1 -0
  398. package/.next/static/chunks/app/api/worktrees/[id]/clear-composer/route-a4f129c451de7859.js +1 -0
  399. package/.next/static/chunks/app/api/worktrees/[id]/cli-reference/route-a4f129c451de7859.js +1 -0
  400. package/.next/static/chunks/app/api/worktrees/[id]/cli-tool/route-a4f129c451de7859.js +1 -0
  401. package/.next/static/chunks/app/api/worktrees/[id]/cmate/schedules/route-a4f129c451de7859.js +1 -0
  402. package/.next/static/chunks/app/api/worktrees/[id]/current-output/route-a4f129c451de7859.js +1 -0
  403. package/.next/static/chunks/app/api/worktrees/[id]/direct-input/route-a4f129c451de7859.js +1 -0
  404. package/.next/static/chunks/app/api/worktrees/[id]/env/route-a4f129c451de7859.js +1 -0
  405. package/.next/static/chunks/app/api/worktrees/[id]/execution-logs/[logId]/route-a4f129c451de7859.js +1 -0
  406. package/.next/static/chunks/app/api/worktrees/[id]/execution-logs/route-a4f129c451de7859.js +1 -0
  407. package/.next/static/chunks/app/api/worktrees/[id]/files/[...path]/route-a4f129c451de7859.js +1 -0
  408. package/.next/static/chunks/app/api/worktrees/[id]/git/branch/create/route-a4f129c451de7859.js +1 -0
  409. package/.next/static/chunks/app/api/worktrees/[id]/git/branch/delete/route-a4f129c451de7859.js +1 -0
  410. package/.next/static/chunks/app/api/worktrees/[id]/git/branches/route-a4f129c451de7859.js +1 -0
  411. package/.next/static/chunks/app/api/worktrees/[id]/git/checkout/route-a4f129c451de7859.js +1 -0
  412. package/.next/static/chunks/app/api/worktrees/[id]/git/commit/route-a4f129c451de7859.js +1 -0
  413. package/.next/static/chunks/app/api/worktrees/[id]/git/diff/route-a4f129c451de7859.js +1 -0
  414. package/.next/static/chunks/app/api/worktrees/[id]/git/fetch/route-a4f129c451de7859.js +1 -0
  415. package/.next/static/chunks/app/api/worktrees/[id]/git/log/route-a4f129c451de7859.js +1 -0
  416. package/.next/static/chunks/app/api/worktrees/[id]/git/pull/route-a4f129c451de7859.js +1 -0
  417. package/.next/static/chunks/app/api/worktrees/[id]/git/push/route-a4f129c451de7859.js +1 -0
  418. package/.next/static/chunks/app/api/worktrees/[id]/git/reset/route-a4f129c451de7859.js +1 -0
  419. package/.next/static/chunks/app/api/worktrees/[id]/git/revert/route-a4f129c451de7859.js +1 -0
  420. package/.next/static/chunks/app/api/worktrees/[id]/git/show/[commitHash]/route-a4f129c451de7859.js +1 -0
  421. package/.next/static/chunks/app/api/worktrees/[id]/git/stage/route-a4f129c451de7859.js +1 -0
  422. package/.next/static/chunks/app/api/worktrees/[id]/git/staged/route-a4f129c451de7859.js +1 -0
  423. package/.next/static/chunks/app/api/worktrees/[id]/git/stash/[index]/route-a4f129c451de7859.js +1 -0
  424. package/.next/static/chunks/app/api/worktrees/[id]/git/stash/apply/route-a4f129c451de7859.js +1 -0
  425. package/.next/static/chunks/app/api/worktrees/[id]/git/stash/pop/route-a4f129c451de7859.js +1 -0
  426. package/.next/static/chunks/app/api/worktrees/[id]/git/stash/push/route-a4f129c451de7859.js +1 -0
  427. package/.next/static/chunks/app/api/worktrees/[id]/git/stash/route-a4f129c451de7859.js +1 -0
  428. package/.next/static/chunks/app/api/worktrees/[id]/git/status/route-a4f129c451de7859.js +1 -0
  429. package/.next/static/chunks/app/api/worktrees/[id]/git/unstage/route-a4f129c451de7859.js +1 -0
  430. package/.next/static/chunks/app/api/worktrees/[id]/git/working-diff/route-a4f129c451de7859.js +1 -0
  431. package/.next/static/chunks/app/api/worktrees/[id]/instances/notes/route-a4f129c451de7859.js +1 -0
  432. package/.next/static/chunks/app/api/worktrees/[id]/instances/opencode/route-a4f129c451de7859.js +1 -0
  433. package/.next/static/chunks/app/api/worktrees/[id]/interrupt/route-a4f129c451de7859.js +1 -0
  434. package/.next/static/chunks/app/api/worktrees/[id]/kill-session/route-a4f129c451de7859.js +1 -0
  435. package/.next/static/chunks/app/api/worktrees/[id]/logs/[filename]/route-a4f129c451de7859.js +1 -0
  436. package/.next/static/chunks/app/api/worktrees/[id]/logs/route-a4f129c451de7859.js +1 -0
  437. package/.next/static/chunks/app/api/worktrees/[id]/marp-render/route-a4f129c451de7859.js +1 -0
  438. package/.next/static/chunks/app/api/worktrees/[id]/memos/[memoId]/route-a4f129c451de7859.js +1 -0
  439. package/.next/static/chunks/app/api/worktrees/[id]/memos/route-a4f129c451de7859.js +1 -0
  440. package/.next/static/chunks/app/api/worktrees/[id]/messages/route-a4f129c451de7859.js +1 -0
  441. package/.next/static/chunks/app/api/worktrees/[id]/opencode/diff/route-a4f129c451de7859.js +1 -0
  442. package/.next/static/chunks/app/api/worktrees/[id]/opencode/session/route-a4f129c451de7859.js +1 -0
  443. package/.next/static/chunks/app/api/worktrees/[id]/opencode/share/route-a4f129c451de7859.js +1 -0
  444. package/.next/static/chunks/app/api/worktrees/[id]/prompt-response/route-a4f129c451de7859.js +1 -0
  445. package/.next/static/chunks/app/api/worktrees/[id]/prompt-response/strict/route-a4f129c451de7859.js +1 -0
  446. package/.next/static/chunks/app/api/worktrees/[id]/resolve-target/route-a4f129c451de7859.js +1 -0
  447. package/.next/static/chunks/app/api/worktrees/[id]/respond/route-a4f129c451de7859.js +1 -0
  448. package/.next/static/chunks/app/api/worktrees/[id]/route-a4f129c451de7859.js +1 -0
  449. package/.next/static/chunks/app/api/worktrees/[id]/schedules/[scheduleId]/route-a4f129c451de7859.js +1 -0
  450. package/.next/static/chunks/app/api/worktrees/[id]/schedules/active/route-a4f129c451de7859.js +1 -0
  451. package/.next/static/chunks/app/api/worktrees/[id]/schedules/route-a4f129c451de7859.js +1 -0
  452. package/.next/static/chunks/app/api/worktrees/[id]/search/route-a4f129c451de7859.js +1 -0
  453. package/.next/static/chunks/app/api/worktrees/[id]/send/route-a4f129c451de7859.js +1 -0
  454. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/git-workflow/route-a4f129c451de7859.js +1 -0
  455. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/install/route-a4f129c451de7859.js +1 -0
  456. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/plan/route-a4f129c451de7859.js +1 -0
  457. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/uninstall/route-a4f129c451de7859.js +1 -0
  458. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/uninstall-plan/route-a4f129c451de7859.js +1 -0
  459. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/update/route-a4f129c451de7859.js +1 -0
  460. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/update-plan/route-a4f129c451de7859.js +1 -0
  461. package/.next/static/chunks/app/api/worktrees/[id]/skills/route-a4f129c451de7859.js +1 -0
  462. package/.next/static/chunks/app/api/worktrees/[id]/slash-commands/route-a4f129c451de7859.js +1 -0
  463. package/.next/static/chunks/app/api/worktrees/[id]/special-keys/route-a4f129c451de7859.js +1 -0
  464. package/.next/static/chunks/app/api/worktrees/[id]/tasks/route-a4f129c451de7859.js +1 -0
  465. package/.next/static/chunks/app/api/worktrees/[id]/terminal/route-a4f129c451de7859.js +1 -0
  466. package/.next/static/chunks/app/api/worktrees/[id]/timers/history/route-a4f129c451de7859.js +1 -0
  467. package/.next/static/chunks/app/api/worktrees/[id]/timers/route-a4f129c451de7859.js +1 -0
  468. package/.next/static/chunks/app/api/worktrees/[id]/todos/[todoId]/route-a4f129c451de7859.js +1 -0
  469. package/.next/static/chunks/app/api/worktrees/[id]/todos/route-a4f129c451de7859.js +1 -0
  470. package/.next/static/chunks/app/api/worktrees/[id]/tree/[...path]/route-a4f129c451de7859.js +1 -0
  471. package/.next/static/chunks/app/api/worktrees/[id]/tree/route-a4f129c451de7859.js +1 -0
  472. package/.next/static/chunks/app/api/worktrees/[id]/upload/[...path]/route-a4f129c451de7859.js +1 -0
  473. package/.next/static/chunks/app/api/worktrees/[id]/verify/config/route-a4f129c451de7859.js +1 -0
  474. package/.next/static/chunks/app/api/worktrees/[id]/verify/route-a4f129c451de7859.js +1 -0
  475. package/.next/static/chunks/app/api/worktrees/[id]/verify/runs/[runId]/cancel/route-a4f129c451de7859.js +1 -0
  476. package/.next/static/chunks/app/api/worktrees/[id]/verify/runs/[runId]/route-a4f129c451de7859.js +1 -0
  477. package/.next/static/chunks/app/api/worktrees/[id]/verify/runs/route-a4f129c451de7859.js +1 -0
  478. package/.next/static/chunks/app/api/worktrees/[id]/viewed/route-a4f129c451de7859.js +1 -0
  479. package/.next/static/chunks/app/api/worktrees/apply-default-agents/route-a4f129c451de7859.js +1 -0
  480. package/.next/static/chunks/app/api/worktrees/route-a4f129c451de7859.js +1 -0
  481. package/.next/static/chunks/app/layout-4f64316957b0a8e5.js +1 -0
  482. package/.next/static/chunks/app/manifest.webmanifest/route-a4f129c451de7859.js +1 -0
  483. package/.next/static/chunks/app/more/page-ff5af5ca48774c89.js +1 -0
  484. package/.next/static/chunks/app/page-b4863bfe0452e09d.js +1 -0
  485. package/.next/static/chunks/app/proxy/[...path]/route-a4f129c451de7859.js +1 -0
  486. package/.next/static/chunks/app/review/page-ff3efb96fdf9bb4b.js +1 -0
  487. package/.next/static/chunks/app/sessions/page-c6eb7c02db2f4c80.js +1 -0
  488. package/.next/static/chunks/app/worktrees/[id]/layout-a4f129c451de7859.js +1 -0
  489. package/.next/static/chunks/app/worktrees/[id]/page-33afc6aa96289fb0.js +1 -0
  490. package/.next/static/css/c1e307d05daf93b6.css +1 -0
  491. package/.next/trace +13 -13
  492. package/.next/types/app/api/relays/[relayId]/route.ts +347 -0
  493. package/.next/types/routes.d.ts +2 -1
  494. package/.next/types/validator.ts +9 -0
  495. package/dist/cli/commands/ask.d.ts.map +1 -1
  496. package/dist/cli/commands/ask.js +233 -17
  497. package/dist/cli/commands/attach.d.ts +4 -1
  498. package/dist/cli/commands/attach.d.ts.map +1 -1
  499. package/dist/cli/commands/attach.js +19 -7
  500. package/dist/cli/commands/command-target.d.ts +7 -0
  501. package/dist/cli/commands/command-target.d.ts.map +1 -1
  502. package/dist/cli/commands/command-target.js +10 -0
  503. package/dist/cli/commands/instances.d.ts.map +1 -1
  504. package/dist/cli/commands/instances.js +38 -2
  505. package/dist/cli/commands/message-dispatch.d.ts +39 -5
  506. package/dist/cli/commands/message-dispatch.d.ts.map +1 -1
  507. package/dist/cli/commands/message-dispatch.js +100 -8
  508. package/dist/cli/commands/relays.d.ts +26 -2
  509. package/dist/cli/commands/relays.d.ts.map +1 -1
  510. package/dist/cli/commands/relays.js +70 -5
  511. package/dist/cli/commands/respond-strict.d.ts.map +1 -1
  512. package/dist/cli/commands/respond-strict.js +22 -5
  513. package/dist/cli/commands/respond.d.ts +12 -0
  514. package/dist/cli/commands/respond.d.ts.map +1 -1
  515. package/dist/cli/commands/respond.js +83 -18
  516. package/dist/cli/commands/send.d.ts.map +1 -1
  517. package/dist/cli/commands/send.js +14 -8
  518. package/dist/cli/commands/wait-hook-stop-settle.d.ts +66 -0
  519. package/dist/cli/commands/wait-hook-stop-settle.d.ts.map +1 -0
  520. package/dist/cli/commands/wait-hook-stop-settle.js +150 -0
  521. package/dist/cli/commands/wait-instance.d.ts +29 -0
  522. package/dist/cli/commands/wait-instance.d.ts.map +1 -0
  523. package/dist/cli/commands/wait-instance.js +56 -0
  524. package/dist/cli/commands/wait-notices.d.ts +87 -0
  525. package/dist/cli/commands/wait-notices.d.ts.map +1 -0
  526. package/dist/cli/commands/wait-notices.js +301 -0
  527. package/dist/cli/commands/wait-poll-bookkeeping.d.ts +15 -0
  528. package/dist/cli/commands/wait-poll-bookkeeping.d.ts.map +1 -0
  529. package/dist/cli/commands/wait-poll-bookkeeping.js +57 -0
  530. package/dist/cli/commands/wait-poll-state.d.ts +136 -0
  531. package/dist/cli/commands/wait-poll-state.d.ts.map +1 -0
  532. package/dist/cli/commands/wait-poll-state.js +6 -0
  533. package/dist/cli/commands/wait-timing.d.ts +46 -0
  534. package/dist/cli/commands/wait-timing.d.ts.map +1 -0
  535. package/dist/cli/commands/wait-timing.js +99 -0
  536. package/dist/cli/commands/wait-turn-boundary.d.ts +284 -0
  537. package/dist/cli/commands/wait-turn-boundary.d.ts.map +1 -0
  538. package/dist/cli/commands/wait-turn-boundary.js +427 -0
  539. package/dist/cli/commands/wait-verify.d.ts +51 -0
  540. package/dist/cli/commands/wait-verify.d.ts.map +1 -0
  541. package/dist/cli/commands/wait-verify.js +128 -0
  542. package/dist/cli/commands/wait.d.ts +6 -105
  543. package/dist/cli/commands/wait.d.ts.map +1 -1
  544. package/dist/cli/commands/wait.js +240 -968
  545. package/dist/cli/commands/whoami.d.ts.map +1 -1
  546. package/dist/cli/commands/whoami.js +3 -1
  547. package/dist/cli/docs/agent-operations.d.ts +2 -2
  548. package/dist/cli/docs/agent-operations.d.ts.map +1 -1
  549. package/dist/cli/docs/agent-operations.js +24 -1
  550. package/dist/cli/types/api-responses.d.ts +49 -3
  551. package/dist/cli/types/api-responses.d.ts.map +1 -1
  552. package/dist/cli/utils/api-client.d.ts +69 -1
  553. package/dist/cli/utils/api-client.d.ts.map +1 -1
  554. package/dist/cli/utils/api-client.js +226 -18
  555. package/dist/cli/utils/follow-up-command.d.ts +38 -0
  556. package/dist/cli/utils/follow-up-command.d.ts.map +1 -0
  557. package/dist/cli/utils/follow-up-command.js +57 -0
  558. package/dist/cli/utils/reply-ledger.d.ts +80 -1
  559. package/dist/cli/utils/reply-ledger.d.ts.map +1 -1
  560. package/dist/cli/utils/reply-ledger.js +147 -2
  561. package/dist/cli/utils/server-capabilities.d.ts +18 -0
  562. package/dist/cli/utils/server-capabilities.d.ts.map +1 -1
  563. package/dist/cli/utils/server-capabilities.js +36 -3
  564. package/dist/cli/utils/session-target.d.ts +1 -1
  565. package/dist/cli/utils/session-target.d.ts.map +1 -1
  566. package/dist/cli/utils/session-target.js +3 -0
  567. package/dist/cli/utils/verify-runner.d.ts +7 -0
  568. package/dist/cli/utils/verify-runner.d.ts.map +1 -1
  569. package/dist/cli/utils/verify-runner.js +51 -15
  570. package/dist/lib/cli-tools/session-name.d.ts.map +1 -1
  571. package/dist/lib/cli-tools/session-name.js +11 -3
  572. package/dist/lib/session/send-attempt-types.d.ts +48 -1
  573. package/dist/lib/session/send-attempt-types.d.ts.map +1 -1
  574. package/dist/lib/session/send-attempt-types.js +18 -1
  575. package/dist/lib/verification/session-kill-ledger.d.ts +110 -0
  576. package/dist/lib/verification/session-kill-ledger.d.ts.map +1 -0
  577. package/dist/lib/verification/session-kill-ledger.js +174 -0
  578. package/dist/server/locales/en/worktree.json +20 -3
  579. package/dist/server/locales/ja/worktree.json +20 -3
  580. package/dist/server/src/config/cli-tool-timing-config.js +1 -7
  581. package/dist/server/src/lib/auto-yes-poller.js +54 -11
  582. package/dist/server/src/lib/cli-tools/antigravity.js +45 -9
  583. package/dist/server/src/lib/cli-tools/base.js +39 -0
  584. package/dist/server/src/lib/cli-tools/codex.js +67 -15
  585. package/dist/server/src/lib/cli-tools/command-code-plan-review.js +24 -2
  586. package/dist/server/src/lib/cli-tools/command-code.js +7 -3
  587. package/dist/server/src/lib/cli-tools/copilot.js +125 -33
  588. package/dist/server/src/lib/cli-tools/gemini.js +37 -10
  589. package/dist/server/src/lib/cli-tools/launch-keys.js +39 -0
  590. package/dist/server/src/lib/cli-tools/opencode-v2.js +6 -2
  591. package/dist/server/src/lib/cli-tools/opencode.js +60 -15
  592. package/dist/server/src/lib/cli-tools/session-name.js +11 -3
  593. package/dist/server/src/lib/cli-tools/submit-composer-read.js +590 -0
  594. package/dist/server/src/lib/cli-tools/submit-verified-sender.js +512 -620
  595. package/dist/server/src/lib/cli-tools/vibe-local.js +4 -2
  596. package/dist/server/src/lib/db/db-migration-path.js +63 -2
  597. package/dist/server/src/lib/db/migrations/index.js +2 -0
  598. package/dist/server/src/lib/db/migrations/pre-migration-backup.js +266 -0
  599. package/dist/server/src/lib/db/migrations/runner.js +37 -4
  600. package/dist/server/src/lib/db/migrations/v62-session-relays-bind.js +102 -0
  601. package/dist/server/src/lib/db/relay-bind-db.js +437 -0
  602. package/dist/server/src/lib/db/relay-db.js +59 -96
  603. package/dist/server/src/lib/detection/prompt-detect-multiple-choice.js +5 -4
  604. package/dist/server/src/lib/detection/upstream-faults.js +40 -6
  605. package/dist/server/src/lib/hooks/sources/copilot/hook-settings.js +2 -3
  606. package/dist/server/src/lib/hooks/sources/opencode/client.js +12 -6
  607. package/dist/server/src/lib/polling/response-checker.js +7 -5
  608. package/dist/server/src/lib/prompt-answer-errors.js +362 -0
  609. package/dist/server/src/lib/prompt-answer-sender.js +264 -288
  610. package/dist/server/src/lib/push/failure-episode-state.js +4 -1
  611. package/dist/server/src/lib/realtime/terminal-broadcast.js +1 -4
  612. package/dist/server/src/lib/realtime-snippet.js +54 -0
  613. package/dist/server/src/lib/relay/relay-bind.js +294 -0
  614. package/dist/server/src/lib/relay/relay-boot.js +51 -0
  615. package/dist/server/src/lib/relay/relay-bound-reply.js +519 -0
  616. package/dist/server/src/lib/relay/relay-delivery.js +134 -220
  617. package/dist/server/src/lib/relay/relay-messages.js +39 -4
  618. package/dist/server/src/lib/relay/relay-overlap.js +92 -0
  619. package/dist/server/src/lib/relay/relay-system-line.js +3 -2
  620. package/dist/server/src/lib/relay/types.js +12 -1
  621. package/dist/server/src/lib/session/agent-event-state.js +4 -0
  622. package/dist/server/src/lib/session/agent-session-lifecycle.js +23 -0
  623. package/dist/server/src/lib/session/claude-session.js +59 -8
  624. package/dist/server/src/lib/session/composer-clear.js +54 -1
  625. package/dist/server/src/lib/session/current-output-builder.js +26 -8
  626. package/dist/server/src/lib/session/current-output-history-writers.js +1 -1
  627. package/dist/server/src/lib/session/instance-input-lock.js +664 -0
  628. package/dist/server/src/lib/session/prompt-submit-receipt.js +155 -0
  629. package/dist/server/src/lib/session/prompt-waiting-guard.js +10 -3
  630. package/dist/server/src/lib/session/send-attempt-state.js +65 -0
  631. package/dist/server/src/lib/session/send-attempt-types.js +18 -1
  632. package/dist/server/src/lib/session/send-user-message.js +84 -14
  633. package/dist/server/src/lib/session/session-launch-flight.js +243 -0
  634. package/dist/server/src/lib/session/session-starting-state.js +40 -4
  635. package/dist/server/src/lib/session/structured-prompt.js +12 -9
  636. package/dist/server/src/lib/session/waiting-episode-binding.js +4 -2
  637. package/dist/server/src/lib/session-cleanup.js +32 -0
  638. package/dist/server/src/lib/session-key-sender.js +0 -27
  639. package/dist/server/src/lib/verification/env-clean-gate.js +129 -0
  640. package/dist/server/src/lib/verification/env-snapshot.js +11 -2
  641. package/dist/server/src/lib/verification/session-kill-ledger.js +174 -0
  642. package/package.json +5 -1
  643. package/release-notes/0.49.1.json +66 -0
  644. package/release-notes/0.49.2.json +49 -0
  645. package/.next/server/chunks/1210.js +0 -1
  646. package/.next/server/chunks/1945.js +0 -14
  647. package/.next/server/chunks/1990.js +0 -103
  648. package/.next/server/chunks/4194.js +0 -67
  649. package/.next/server/chunks/5845.js +0 -1
  650. package/.next/server/chunks/720.js +0 -103
  651. package/.next/server/chunks/7604.js +0 -2
  652. package/.next/server/chunks/9540.js +0 -1
  653. package/.next/static/chunks/4768-ad6f82f034f21eae.js +0 -1
  654. package/.next/static/chunks/5794-80ac3f06f098ea29.js +0 -1
  655. package/.next/static/chunks/6654-f3534f35f16644bc.js +0 -1
  656. package/.next/static/chunks/7665-e9ef6e0a85b9fa49.js +0 -1
  657. package/.next/static/chunks/8606-cf6bdbff44a764cf.js +0 -1
  658. package/.next/static/chunks/9079-987939d231704218.js +0 -1
  659. package/.next/static/chunks/app/api/agents/update/route-c81284a9d8b35304.js +0 -1
  660. package/.next/static/chunks/app/api/agents/versions/route-c81284a9d8b35304.js +0 -1
  661. package/.next/static/chunks/app/api/app/release-notes/route-c81284a9d8b35304.js +0 -1
  662. package/.next/static/chunks/app/api/app/update/route-c81284a9d8b35304.js +0 -1
  663. package/.next/static/chunks/app/api/app/update-check/route-c81284a9d8b35304.js +0 -1
  664. package/.next/static/chunks/app/api/auth/login/route-c81284a9d8b35304.js +0 -1
  665. package/.next/static/chunks/app/api/auth/logout/route-c81284a9d8b35304.js +0 -1
  666. package/.next/static/chunks/app/api/auth/status/route-c81284a9d8b35304.js +0 -1
  667. package/.next/static/chunks/app/api/capabilities/route-c81284a9d8b35304.js +0 -1
  668. package/.next/static/chunks/app/api/daily-summary/route-c81284a9d8b35304.js +0 -1
  669. package/.next/static/chunks/app/api/daily-summary/status/route-c81284a9d8b35304.js +0 -1
  670. package/.next/static/chunks/app/api/external-apps/[id]/health/route-c81284a9d8b35304.js +0 -1
  671. package/.next/static/chunks/app/api/external-apps/[id]/route-c81284a9d8b35304.js +0 -1
  672. package/.next/static/chunks/app/api/external-apps/route-c81284a9d8b35304.js +0 -1
  673. package/.next/static/chunks/app/api/fs/browse/route-c81284a9d8b35304.js +0 -1
  674. package/.next/static/chunks/app/api/fs/recent-paths/route-c81284a9d8b35304.js +0 -1
  675. package/.next/static/chunks/app/api/hooks/agent-event/route-c81284a9d8b35304.js +0 -1
  676. package/.next/static/chunks/app/api/hooks/claude-done/route-c81284a9d8b35304.js +0 -1
  677. package/.next/static/chunks/app/api/hooks/permission-request/route-c81284a9d8b35304.js +0 -1
  678. package/.next/static/chunks/app/api/metrics/vibe/route-c81284a9d8b35304.js +0 -1
  679. package/.next/static/chunks/app/api/ollama/models/route-c81284a9d8b35304.js +0 -1
  680. package/.next/static/chunks/app/api/push/escalation/route-c81284a9d8b35304.js +0 -1
  681. package/.next/static/chunks/app/api/push/subscriptions/route-c81284a9d8b35304.js +0 -1
  682. package/.next/static/chunks/app/api/push/vapid/route-c81284a9d8b35304.js +0 -1
  683. package/.next/static/chunks/app/api/relays/[relayId]/cancel/route-c81284a9d8b35304.js +0 -1
  684. package/.next/static/chunks/app/api/relays/route-c81284a9d8b35304.js +0 -1
  685. package/.next/static/chunks/app/api/remote/pair/route-c81284a9d8b35304.js +0 -1
  686. package/.next/static/chunks/app/api/repositories/[id]/route-c81284a9d8b35304.js +0 -1
  687. package/.next/static/chunks/app/api/repositories/clone/[jobId]/route-c81284a9d8b35304.js +0 -1
  688. package/.next/static/chunks/app/api/repositories/clone/route-c81284a9d8b35304.js +0 -1
  689. package/.next/static/chunks/app/api/repositories/excluded/route-c81284a9d8b35304.js +0 -1
  690. package/.next/static/chunks/app/api/repositories/restore/route-c81284a9d8b35304.js +0 -1
  691. package/.next/static/chunks/app/api/repositories/route-c81284a9d8b35304.js +0 -1
  692. package/.next/static/chunks/app/api/repositories/scan/route-c81284a9d8b35304.js +0 -1
  693. package/.next/static/chunks/app/api/repositories/sync/route-c81284a9d8b35304.js +0 -1
  694. package/.next/static/chunks/app/api/repositories/validate-path/route-c81284a9d8b35304.js +0 -1
  695. package/.next/static/chunks/app/api/settings/default-agents/route-c81284a9d8b35304.js +0 -1
  696. package/.next/static/chunks/app/api/settings/default-surface-mode/route-c81284a9d8b35304.js +0 -1
  697. package/.next/static/chunks/app/api/sidebar/group-order/route-c81284a9d8b35304.js +0 -1
  698. package/.next/static/chunks/app/api/skills/[id]/route-c81284a9d8b35304.js +0 -1
  699. package/.next/static/chunks/app/api/skills/installations/route-c81284a9d8b35304.js +0 -1
  700. package/.next/static/chunks/app/api/skills/operations/route-c81284a9d8b35304.js +0 -1
  701. package/.next/static/chunks/app/api/skills/reindex/route-c81284a9d8b35304.js +0 -1
  702. package/.next/static/chunks/app/api/skills/route-c81284a9d8b35304.js +0 -1
  703. package/.next/static/chunks/app/api/slash-commands/route-c81284a9d8b35304.js +0 -1
  704. package/.next/static/chunks/app/api/tasks/[taskId]/cancel/route-c81284a9d8b35304.js +0 -1
  705. package/.next/static/chunks/app/api/tasks/[taskId]/route-c81284a9d8b35304.js +0 -1
  706. package/.next/static/chunks/app/api/templates/[id]/route-c81284a9d8b35304.js +0 -1
  707. package/.next/static/chunks/app/api/templates/route-c81284a9d8b35304.js +0 -1
  708. package/.next/static/chunks/app/api/verification/runs/[runId]/route-c81284a9d8b35304.js +0 -1
  709. package/.next/static/chunks/app/api/verification/runs/route-c81284a9d8b35304.js +0 -1
  710. package/.next/static/chunks/app/api/worktrees/[id]/auto-yes/route-c81284a9d8b35304.js +0 -1
  711. package/.next/static/chunks/app/api/worktrees/[id]/capture/route-c81284a9d8b35304.js +0 -1
  712. package/.next/static/chunks/app/api/worktrees/[id]/clear-composer/route-c81284a9d8b35304.js +0 -1
  713. package/.next/static/chunks/app/api/worktrees/[id]/cli-reference/route-c81284a9d8b35304.js +0 -1
  714. package/.next/static/chunks/app/api/worktrees/[id]/cli-tool/route-c81284a9d8b35304.js +0 -1
  715. package/.next/static/chunks/app/api/worktrees/[id]/cmate/schedules/route-c81284a9d8b35304.js +0 -1
  716. package/.next/static/chunks/app/api/worktrees/[id]/current-output/route-c81284a9d8b35304.js +0 -1
  717. package/.next/static/chunks/app/api/worktrees/[id]/direct-input/route-c81284a9d8b35304.js +0 -1
  718. package/.next/static/chunks/app/api/worktrees/[id]/env/route-c81284a9d8b35304.js +0 -1
  719. package/.next/static/chunks/app/api/worktrees/[id]/execution-logs/[logId]/route-c81284a9d8b35304.js +0 -1
  720. package/.next/static/chunks/app/api/worktrees/[id]/execution-logs/route-c81284a9d8b35304.js +0 -1
  721. package/.next/static/chunks/app/api/worktrees/[id]/files/[...path]/route-c81284a9d8b35304.js +0 -1
  722. package/.next/static/chunks/app/api/worktrees/[id]/git/branch/create/route-c81284a9d8b35304.js +0 -1
  723. package/.next/static/chunks/app/api/worktrees/[id]/git/branch/delete/route-c81284a9d8b35304.js +0 -1
  724. package/.next/static/chunks/app/api/worktrees/[id]/git/branches/route-c81284a9d8b35304.js +0 -1
  725. package/.next/static/chunks/app/api/worktrees/[id]/git/checkout/route-c81284a9d8b35304.js +0 -1
  726. package/.next/static/chunks/app/api/worktrees/[id]/git/commit/route-c81284a9d8b35304.js +0 -1
  727. package/.next/static/chunks/app/api/worktrees/[id]/git/diff/route-c81284a9d8b35304.js +0 -1
  728. package/.next/static/chunks/app/api/worktrees/[id]/git/fetch/route-c81284a9d8b35304.js +0 -1
  729. package/.next/static/chunks/app/api/worktrees/[id]/git/log/route-c81284a9d8b35304.js +0 -1
  730. package/.next/static/chunks/app/api/worktrees/[id]/git/pull/route-c81284a9d8b35304.js +0 -1
  731. package/.next/static/chunks/app/api/worktrees/[id]/git/push/route-c81284a9d8b35304.js +0 -1
  732. package/.next/static/chunks/app/api/worktrees/[id]/git/reset/route-c81284a9d8b35304.js +0 -1
  733. package/.next/static/chunks/app/api/worktrees/[id]/git/revert/route-c81284a9d8b35304.js +0 -1
  734. package/.next/static/chunks/app/api/worktrees/[id]/git/show/[commitHash]/route-c81284a9d8b35304.js +0 -1
  735. package/.next/static/chunks/app/api/worktrees/[id]/git/stage/route-c81284a9d8b35304.js +0 -1
  736. package/.next/static/chunks/app/api/worktrees/[id]/git/staged/route-c81284a9d8b35304.js +0 -1
  737. package/.next/static/chunks/app/api/worktrees/[id]/git/stash/[index]/route-c81284a9d8b35304.js +0 -1
  738. package/.next/static/chunks/app/api/worktrees/[id]/git/stash/apply/route-c81284a9d8b35304.js +0 -1
  739. package/.next/static/chunks/app/api/worktrees/[id]/git/stash/pop/route-c81284a9d8b35304.js +0 -1
  740. package/.next/static/chunks/app/api/worktrees/[id]/git/stash/push/route-c81284a9d8b35304.js +0 -1
  741. package/.next/static/chunks/app/api/worktrees/[id]/git/stash/route-c81284a9d8b35304.js +0 -1
  742. package/.next/static/chunks/app/api/worktrees/[id]/git/status/route-c81284a9d8b35304.js +0 -1
  743. package/.next/static/chunks/app/api/worktrees/[id]/git/unstage/route-c81284a9d8b35304.js +0 -1
  744. package/.next/static/chunks/app/api/worktrees/[id]/git/working-diff/route-c81284a9d8b35304.js +0 -1
  745. package/.next/static/chunks/app/api/worktrees/[id]/instances/notes/route-c81284a9d8b35304.js +0 -1
  746. package/.next/static/chunks/app/api/worktrees/[id]/instances/opencode/route-c81284a9d8b35304.js +0 -1
  747. package/.next/static/chunks/app/api/worktrees/[id]/interrupt/route-c81284a9d8b35304.js +0 -1
  748. package/.next/static/chunks/app/api/worktrees/[id]/kill-session/route-c81284a9d8b35304.js +0 -1
  749. package/.next/static/chunks/app/api/worktrees/[id]/logs/[filename]/route-c81284a9d8b35304.js +0 -1
  750. package/.next/static/chunks/app/api/worktrees/[id]/logs/route-c81284a9d8b35304.js +0 -1
  751. package/.next/static/chunks/app/api/worktrees/[id]/marp-render/route-c81284a9d8b35304.js +0 -1
  752. package/.next/static/chunks/app/api/worktrees/[id]/memos/[memoId]/route-c81284a9d8b35304.js +0 -1
  753. package/.next/static/chunks/app/api/worktrees/[id]/memos/route-c81284a9d8b35304.js +0 -1
  754. package/.next/static/chunks/app/api/worktrees/[id]/messages/route-c81284a9d8b35304.js +0 -1
  755. package/.next/static/chunks/app/api/worktrees/[id]/opencode/diff/route-c81284a9d8b35304.js +0 -1
  756. package/.next/static/chunks/app/api/worktrees/[id]/opencode/session/route-c81284a9d8b35304.js +0 -1
  757. package/.next/static/chunks/app/api/worktrees/[id]/opencode/share/route-c81284a9d8b35304.js +0 -1
  758. package/.next/static/chunks/app/api/worktrees/[id]/prompt-response/route-c81284a9d8b35304.js +0 -1
  759. package/.next/static/chunks/app/api/worktrees/[id]/prompt-response/strict/route-c81284a9d8b35304.js +0 -1
  760. package/.next/static/chunks/app/api/worktrees/[id]/resolve-target/route-c81284a9d8b35304.js +0 -1
  761. package/.next/static/chunks/app/api/worktrees/[id]/respond/route-c81284a9d8b35304.js +0 -1
  762. package/.next/static/chunks/app/api/worktrees/[id]/route-c81284a9d8b35304.js +0 -1
  763. package/.next/static/chunks/app/api/worktrees/[id]/schedules/[scheduleId]/route-c81284a9d8b35304.js +0 -1
  764. package/.next/static/chunks/app/api/worktrees/[id]/schedules/active/route-c81284a9d8b35304.js +0 -1
  765. package/.next/static/chunks/app/api/worktrees/[id]/schedules/route-c81284a9d8b35304.js +0 -1
  766. package/.next/static/chunks/app/api/worktrees/[id]/search/route-c81284a9d8b35304.js +0 -1
  767. package/.next/static/chunks/app/api/worktrees/[id]/send/route-c81284a9d8b35304.js +0 -1
  768. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/git-workflow/route-c81284a9d8b35304.js +0 -1
  769. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/install/route-c81284a9d8b35304.js +0 -1
  770. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/plan/route-c81284a9d8b35304.js +0 -1
  771. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/uninstall/route-c81284a9d8b35304.js +0 -1
  772. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/uninstall-plan/route-c81284a9d8b35304.js +0 -1
  773. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/update/route-c81284a9d8b35304.js +0 -1
  774. package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/update-plan/route-c81284a9d8b35304.js +0 -1
  775. package/.next/static/chunks/app/api/worktrees/[id]/skills/route-c81284a9d8b35304.js +0 -1
  776. package/.next/static/chunks/app/api/worktrees/[id]/slash-commands/route-c81284a9d8b35304.js +0 -1
  777. package/.next/static/chunks/app/api/worktrees/[id]/special-keys/route-c81284a9d8b35304.js +0 -1
  778. package/.next/static/chunks/app/api/worktrees/[id]/tasks/route-c81284a9d8b35304.js +0 -1
  779. package/.next/static/chunks/app/api/worktrees/[id]/terminal/route-c81284a9d8b35304.js +0 -1
  780. package/.next/static/chunks/app/api/worktrees/[id]/timers/history/route-c81284a9d8b35304.js +0 -1
  781. package/.next/static/chunks/app/api/worktrees/[id]/timers/route-c81284a9d8b35304.js +0 -1
  782. package/.next/static/chunks/app/api/worktrees/[id]/todos/[todoId]/route-c81284a9d8b35304.js +0 -1
  783. package/.next/static/chunks/app/api/worktrees/[id]/todos/route-c81284a9d8b35304.js +0 -1
  784. package/.next/static/chunks/app/api/worktrees/[id]/tree/[...path]/route-c81284a9d8b35304.js +0 -1
  785. package/.next/static/chunks/app/api/worktrees/[id]/tree/route-c81284a9d8b35304.js +0 -1
  786. package/.next/static/chunks/app/api/worktrees/[id]/upload/[...path]/route-c81284a9d8b35304.js +0 -1
  787. package/.next/static/chunks/app/api/worktrees/[id]/verify/config/route-c81284a9d8b35304.js +0 -1
  788. package/.next/static/chunks/app/api/worktrees/[id]/verify/route-c81284a9d8b35304.js +0 -1
  789. package/.next/static/chunks/app/api/worktrees/[id]/verify/runs/[runId]/cancel/route-c81284a9d8b35304.js +0 -1
  790. package/.next/static/chunks/app/api/worktrees/[id]/verify/runs/[runId]/route-c81284a9d8b35304.js +0 -1
  791. package/.next/static/chunks/app/api/worktrees/[id]/verify/runs/route-c81284a9d8b35304.js +0 -1
  792. package/.next/static/chunks/app/api/worktrees/[id]/viewed/route-c81284a9d8b35304.js +0 -1
  793. package/.next/static/chunks/app/api/worktrees/apply-default-agents/route-c81284a9d8b35304.js +0 -1
  794. package/.next/static/chunks/app/api/worktrees/route-c81284a9d8b35304.js +0 -1
  795. package/.next/static/chunks/app/layout-aa8e66164a4367af.js +0 -1
  796. package/.next/static/chunks/app/manifest.webmanifest/route-c81284a9d8b35304.js +0 -1
  797. package/.next/static/chunks/app/more/page-87c84987b2765213.js +0 -1
  798. package/.next/static/chunks/app/page-1b820c421db48c2c.js +0 -1
  799. package/.next/static/chunks/app/proxy/[...path]/route-c81284a9d8b35304.js +0 -1
  800. package/.next/static/chunks/app/review/page-e2fd4a590646a2d8.js +0 -1
  801. package/.next/static/chunks/app/sessions/page-cfd645305e25fd33.js +0 -1
  802. package/.next/static/chunks/app/worktrees/[id]/layout-c81284a9d8b35304.js +0 -1
  803. package/.next/static/chunks/app/worktrees/[id]/page-a8d7886703ffc7b4.js +0 -1
  804. package/.next/static/css/db8959555c3d9c96.css +0 -1
  805. /package/.next/static/{3_JtAZaKMJEDFIIfkHv4n → yGatWDsS532awSs51kXyd}/_buildManifest.js +0 -0
  806. /package/.next/static/{3_JtAZaKMJEDFIIfkHv4n → yGatWDsS532awSs51kXyd}/_ssgManifest.js +0 -0
@@ -2,6 +2,6 @@
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
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**
4
4
  >
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:()=>k,NN:()=>n,Ze:()=>l,mf:()=>m});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}$/,j=[...d.XH].sort((a,b)=>b.length-a.length);function k(){return globalThis.__cmTmuxSessionNamespace??null}function l(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 m(a,b,c){let d=k(),e=l(d,a,b,c);return null===d?e:(0,g.mc)(e)??e}function n(a){if(!a.startsWith(h))return null;let b=a.slice(h.length),c=null,d=b.indexOf("-");d>0&&i.test(b.slice(0,d))&&(c=b.slice(0,d),b=b.slice(d+1));let e=j.find(a=>b.startsWith(`${a}-`));if(!e)return null;let f=b.slice(e.length+1);return""===f?null:{namespace:c,cliToolId:e,rest:f}}},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)}
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
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
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)}}}};
@@ -1 +1 @@
1
- "use strict";exports.id=4280,exports.ids=[4280,9130],exports.modules={2669:(a,b,c)=>{c.d(b,{JI:()=>n,M7:()=>d,Sr:()=>h,Zf:()=>f,c7:()=>e,lU:()=>k,mR:()=>j,qO:()=>i,su:()=>m,wQ:()=>l});let d="SESSION_STARTING",e="SESSION_START_FAILED",f="SESSION_START_UNAVAILABLE",g=[d,e];class h extends Error{constructor(a,b,c){super(`${a} did not reach its input prompt within ${Math.round(c/1e3)}s (initialization timeout). The tmux session '${b}' and its process are still running, so this is a slow start, not a failed one — the message was not delivered, but nothing needs repairing. Retry the send in a few seconds, or run \`commandmate capture <worktree-id>\` to see what it is waiting on.`),this.toolName=a,this.sessionName=b,this.timeoutMs=c,this.code=d,this.name="SessionStartTimeoutError"}}function i(a,b){return`${a} exited before reaching its input prompt: the tmux session '${b}' is back at a shell, so this is not a slow start and waiting will not help. The message was not delivered. Run \`commandmate capture <worktree-id>\` to see why it exited (for example a startup dialog answered with exit, or a missing login), fix that, then send again.`}class j extends Error{constructor(a,b,c){super(`${a} reported an error while starting in tmux session '${b}': "${c}". Retrying will not help until that is resolved; run \`commandmate capture <worktree-id>\` to see the session output.`),this.toolName=a,this.sessionName=b,this.detectedPattern=c,this.code=e,this.name="SessionStartFailedError"}}class k extends Error{constructor(a,b=`${a} is not installed. Please install it first.`){super(b),this.toolName=a,this.code=f,this.name="SessionStartUnavailableError"}}function l(a){return o(a)===d}function m(a){let b=o(a);return void 0!==b&&g.includes(b)}function n(a){return o(a)===f}function o(a){if("object"!=typeof a||null===a)return;let b=a.code;return"string"==typeof b?b:void 0}},22354:(a,b,c)=>{c.d(b,{F0:()=>j.F,K9:()=>e.K9,VM:()=>d.VM,_0:()=>f._0,c1:()=>k.c,o:()=>i.o,vm:()=>h.v,y_:()=>g.y_});var d=c(70096);c(66101);var e=c(45567);c(57510),c(38367);var f=c(25071),g=c(50474),h=c(70997),i=c(77904),j=c(76835),k=c(2734)},23197:(a,b,c)=>{c.d(b,{H:()=>d});let d="__global__"},32002:(a,b,c)=>{c.d(b,{e:()=>h});var d=c(56791),e=c(26923),f=c(52201),g=c(15194);function h(a,b,c){let h=(0,d.getAgentInstances)(a,b);return h.length>0?h:(0,g.lu)((0,f.eG)({worktree:c,appSettings:(0,e.Ds)(a)}))}},50474:(a,b,c)=>{c.d(b,{y_:()=>d});function d(a){var b=a.noDecision;switch(b.kind){case"proceeds":return{safe:!0,blocksForMs:0,summary:"the agent continues with its own approval flow"};case"blocks":return{safe:!1,blocksForMs:null,summary:"the agent waits indefinitely; nothing else will unblock it"};case"blocksUntil":return{safe:!1,blocksForMs:b.timeoutMs,summary:`the agent waits up to ${b.timeoutMs}ms before continuing`}}}},56714:(a,b,c)=>{c.d(b,{B:()=>E,z:()=>B});var d=c(8360),e=c(15194),f=c(31990),g=c(95595),h=c(37717),i=c(35583),j=c(67882),k=c(64501),l=c(70594),m=c(23365),n=c(50945),o=c(35524),p=c(23197),q=c(30008),r=c(49891),s=c(40043),t=c(36261),u=c(15044),v=c(93373),w=c(95375),x=c(26547),y=c(70096),z=c(66101);let A=(0,c(72626).h)("lib/session/worktree-status-helper");function B(){return{probeCount:0,captureCount:0,healthCheckCount:0}}let C={prompt:3,menu:2,unclassified:1};async function D(a,b,d,e,p,B,C,D,E,F){let G=F??(0,u.ic)(a,b,d),H=p.has(e),I=H,J=null,K=(0,i.Bk)(a,b,d);if(I&&null===K){E&&E.healthCheckCount++;let a=await (0,n.S)(e,b);a.alive||(I=!1,J=a.reason)}let L={startingSince:K,isWaitingForResponse:!1,isProcessing:!1,waitingKind:null,structuredWaitingSince:null,statusEvidence:null,sessionStatusReason:null,isUnclassified:!1,reading:null},M={frameCapturedAt:0,frameFetchedAfterStart:!1};if(I)try{let e=(0,m.y)(b).statusLines;E&&E.captureCount++;let h=await (0,u.IW)(()=>(0,f.Wh)(a,b,e,d)),n=h.frame;M=h.frameTime;let p={db:B,worktreeId:a,cliToolId:b,instanceId:d},{compositeKey:t,statusResult:z}=function(a,b,c){let{worktreeId:d,cliToolId:e,instanceId:f}=b,h=(0,o.v7)(d,e,f),k=(0,o.xU)(h),l=k?new Date(k):void 0,m=(0,g.WC)(c,e,l);a.startingSince=(0,i.a3)(d,e,f,"waiting"===m.status||m.hasActivePrompt);let n=null===a.startingSince?m:(0,i.Gz)(m);return(0,w.recordCapturedModelInfo)(d,e,f,(0,x.jw)(e,c)),a.isUnclassified=(0,s.Q4)(n.status,n.reason),{isWaitingForResponse:a.isWaitingForResponse,isProcessing:a.isProcessing}=(0,j.O_)(n.status,a.isUnclassified),a.sessionStatusReason=n.reason,a.statusEvidence=n.evidence,{compositeKey:h,statusResult:n}}(L,p,n),{db:F,worktreeId:G,cliToolId:H,instanceId:I}=p,J=(0,q.xF)({worktreeId:G,cliToolId:H,instanceId:I,scraper:{status:z.status,reason:z.reason,hasActivePrompt:z.hasActivePrompt}});L.isWaitingForResponse=L.isWaitingForResponse||null===L.startingSince&&J.waiting;let K=null!==L.startingSince||L.isWaitingForResponse?null:function(a){let{worktreeId:b,cliToolId:c,instanceId:d,output:e,statusResult:f}=a;if(!a.isProcessing&&!(0,k.NV)(b,c,d,e))return null;let h=(0,k.$K)(b,c,d,(0,k.$x)(b,c,d),e);if(null===h)return null;let i={status:f.status,reason:f.reason,thinking:(0,g.f8)(f),evidence:f.evidence,isUnclassifiedActive:a.isUnclassified},j=(0,w.getPublishedAgentTurn)(b,c,d),m=(0,l.wG)(i,h,j)?(0,l.mi)(a.db,b,c,d):null;return(0,l.aT)(i,h,null,j,m)}({db:F,worktreeId:G,cliToolId:H,instanceId:I,output:n,statusResult:z,isUnclassified:L.isUnclassified,isProcessing:L.isProcessing});null!==K&&(L.isProcessing="running"===K.status),(0,s.ox)(t,K??{status:z.status,reason:z.reason,evidence:z.evidence}),L.structuredWaitingSince=null===L.startingSince?J.structured?.at??null:null,L.waitingKind=(0,r.t)({waiting:L.isWaitingForResponse,hasActivePrompt:z.hasActivePrompt,scraperStatus:z.status,scraperReason:z.reason,apiAnswerable:null===L.startingSince&&(0,q.$G)(J.structured,(0,y.VM)(H).capabilities.eventIdentity)}),L.reading=(0,v.Xn)({verdict:z,waiting:L.isWaitingForResponse,waitingKind:L.waitingKind,structuredWaiting:null===L.startingSince&&null!==J.structured,structuredSince:L.structuredWaitingSince});let{db:N,worktreeId:O,cliToolId:P,instanceId:Q}=p;!z.hasActivePrompt&&C(N,O,{limit:10,cliToolId:P,instanceId:Q}).some(a=>"prompt"===a.messageType&&a.promptData?.status!=="answered")&&D(N,O,P,Q,a=>{Promise.resolve().then(c.bind(c,43015)).then(({broadcastMessage:b})=>{b("message_updated",{worktreeId:O,message:a})}).catch(a=>{A.warn("prompt-sweep-broadcast-failed",{worktreeId:O,error:a instanceof Error?a.message:String(a)})})})}catch{L.isProcessing=!0}let N=I?L.reading??{kind:"not-waiting"}:{kind:"gone"};(0,u.cY)({worktreeId:a,cliToolId:b,instanceId:d,observer:"status-probe",start:G,reading:N,...M});let O=L.isWaitingForResponse?(0,t.Jp)(a,b,d)?.since??null:null,{model:P,effort:Q}=(0,w.getResolvedAgentModelInfo)(a,b,d),R=(0,o.v7)(a,b,d);I||(0,s.xG)(R);let S=I?(0,s.AD)(R):null,T=I?function(a,b,c){try{let d=(0,y.VM)(b),e=(0,z.Kf)(d,d.liveness({worktreeId:a,cliToolId:b,instanceId:c}),Date.now());if(void 0===e.degradedReason&&void 0===e.liveness)return null;return e}catch{return null}}(a,b,d):null;try{H?await (0,f.N5)({sessionName:e,worktreeId:a,cliToolId:b,instanceId:d,status:(0,j.kA)({isRunning:I,isWaitingForResponse:L.isWaitingForResponse,isProcessing:L.isProcessing})}):(0,f.Lw)(e)}catch(a){A.debug("tmux-surface:publish-failed",{sessionName:e,error:a instanceof Error?a.message:String(a)})}var U={worktreeId:a,cliToolId:b,instanceId:d,isRunning:I,exitedReason:J,waitingSince:O,model:P,effort:Q,lastKnown:S,eventSource:T};let{worktreeId:V,cliToolId:W,instanceId:X,isRunning:Y,exitedReason:Z,model:$,effort:_,lastKnown:aa,eventSource:ab}=U,{isWaitingForResponse:ac,isProcessing:ad,waitingKind:ae,statusEvidence:af,sessionStatusReason:ag,isUnclassified:ah,startingSince:ai}=L;return{isRunning:Y,isWaitingForResponse:ac,isProcessing:ad,waitingKind:ae,waitingSince:U.waitingSince,awaitingInstruction:Y&&(0,w.isAwaitingInstruction)(V,W,X),...null!==$?{model:$}:{},...null!==_?{reasoningEffort:_}:{},...null!==af?{statusEvidence:af}:{},...null!==ag?{sessionStatusReason:ag}:{},...ah?{isUnclassified:!0}:{},...null!==Z?{sessionStatusReason:h.g.EXITED,statusEvidence:"positive"}:{},...null!==aa?{lastKnownStatus:aa.status,lastKnownStatusAt:aa.at}:{},...null!==ab?{eventSource:ab}:{},...null!==ai?{startingSince:ai}:{}}}async function E(a,b,c,f,g,h,i,j){if(a===p.H)return{sessionStatusByCli:{},sessionStatusByInstance:{},isSessionRunning:!1,isWaitingForResponse:!1,isProcessing:!1};let k=d.CLIToolManager.getInstance(),l=e.XH,m=h(c,a).filter(a=>a.id!==a.cliTool),n=l.map(b=>({cliToolId:b,instanceId:b,sessionName:k.getTool(b).getSessionName(a,b)}));for(let b of m)n.push({cliToolId:b.cliTool,instanceId:b.id,sessionName:k.getTool(b.cliTool).getSessionName(a,b.id)});i&&(i.probeCount+=n.length);let o=await Promise.all(n.map(async d=>{let e=await D(a,d.cliToolId,d.instanceId,d.sessionName,b,c,f,g,i,j?.startFor(d.cliToolId,d.instanceId));return{...d,status:e}})),q={},r={};for(let{cliToolId:a,instanceId:b,status:c}of o){r[b]=c;let d=q[a];q[a]=d?function(a,b){var c,d,e,f;return{isRunning:a.isRunning||b.isRunning,isWaitingForResponse:a.isWaitingForResponse||b.isWaitingForResponse,isProcessing:a.isProcessing||b.isProcessing,waitingKind:(c=a.waitingKind,d=b.waitingKind,null===c?d:null===d||C[c]>=C[d]?c:d),waitingSince:(e=a.waitingSince,f=b.waitingSince,null===e?f:null===f?e:Math.min(e,f)),awaitingInstruction:a.awaitingInstruction||b.awaitingInstruction,...a.isUnclassified||b.isUnclassified?{isUnclassified:!0}:{}}}(d,c):c}let s=!1,t=!1,u=!1;for(let a of Object.values(q))a&&(a.isRunning&&(s=!0),a.isWaitingForResponse&&(t=!0),a.isProcessing&&(u=!0));return{sessionStatusByCli:q,sessionStatusByInstance:r,isSessionRunning:s,isWaitingForResponse:t,isProcessing:u}}}};
1
+ "use strict";exports.id=3756,exports.ids=[3756,5630],exports.modules={2669:(a,b,c)=>{c.d(b,{JI:()=>n,M7:()=>d,Sr:()=>h,Zf:()=>f,c7:()=>e,lU:()=>k,mR:()=>j,qO:()=>i,su:()=>m,wQ:()=>l});let d="SESSION_STARTING",e="SESSION_START_FAILED",f="SESSION_START_UNAVAILABLE",g=[d,e];class h extends Error{constructor(a,b,c){super(`${a} did not reach its input prompt within ${Math.round(c/1e3)}s (initialization timeout). The tmux session '${b}' and its process are still running, so this is a slow start, not a failed one — the message was not delivered, but nothing needs repairing. Retry the send in a few seconds, or run \`commandmate capture <worktree-id>\` to see what it is waiting on.`),this.toolName=a,this.sessionName=b,this.timeoutMs=c,this.code=d,this.name="SessionStartTimeoutError"}}function i(a,b){return`${a} exited before reaching its input prompt: the tmux session '${b}' is back at a shell, so this is not a slow start and waiting will not help. The message was not delivered. Run \`commandmate capture <worktree-id>\` to see why it exited (for example a startup dialog answered with exit, or a missing login), fix that, then send again.`}class j extends Error{constructor(a,b,c){super(`${a} reported an error while starting in tmux session '${b}': "${c}". Retrying will not help until that is resolved; run \`commandmate capture <worktree-id>\` to see the session output.`),this.toolName=a,this.sessionName=b,this.detectedPattern=c,this.code=e,this.name="SessionStartFailedError"}}class k extends Error{constructor(a,b=`${a} is not installed. Please install it first.`){super(b),this.toolName=a,this.code=f,this.name="SessionStartUnavailableError"}}function l(a){return o(a)===d}function m(a){let b=o(a);return void 0!==b&&g.includes(b)}function n(a){return o(a)===f}function o(a){if("object"!=typeof a||null===a)return;let b=a.code;return"string"==typeof b?b:void 0}},22354:(a,b,c)=>{c.d(b,{F0:()=>j.F,K9:()=>e.K9,VM:()=>d.VM,_0:()=>f._0,c1:()=>k.c,o:()=>i.o,vm:()=>h.v,y_:()=>g.y_});var d=c(70096);c(66101);var e=c(45567);c(57510),c(38367);var f=c(25071),g=c(50474),h=c(70997),i=c(77904),j=c(76835),k=c(2734)},23197:(a,b,c)=>{c.d(b,{H:()=>d});let d="__global__"},32002:(a,b,c)=>{c.d(b,{e:()=>h});var d=c(56791),e=c(26923),f=c(52201),g=c(15194);function h(a,b,c){let h=(0,d.getAgentInstances)(a,b);return h.length>0?h:(0,g.lu)((0,f.eG)({worktree:c,appSettings:(0,e.Ds)(a)}))}},50474:(a,b,c)=>{c.d(b,{y_:()=>d});function d(a){var b=a.noDecision;switch(b.kind){case"proceeds":return{safe:!0,blocksForMs:0,summary:"the agent continues with its own approval flow"};case"blocks":return{safe:!1,blocksForMs:null,summary:"the agent waits indefinitely; nothing else will unblock it"};case"blocksUntil":return{safe:!1,blocksForMs:b.timeoutMs,summary:`the agent waits up to ${b.timeoutMs}ms before continuing`}}}},56714:(a,b,c)=>{c.d(b,{B:()=>E,z:()=>B});var d=c(8360),e=c(15194),f=c(31990),g=c(95595),h=c(37717),i=c(56588),j=c(67882),k=c(64501),l=c(70594),m=c(23365),n=c(50945),o=c(35524),p=c(23197),q=c(30008),r=c(49891),s=c(40043),t=c(36261),u=c(15044),v=c(93373),w=c(95375),x=c(26547),y=c(70096),z=c(66101);let A=(0,c(72626).h)("lib/session/worktree-status-helper");function B(){return{probeCount:0,captureCount:0,healthCheckCount:0}}let C={prompt:3,menu:2,unclassified:1};async function D(a,b,d,e,p,B,C,D,E,F){let G=F??(0,u.ic)(a,b,d),H=p.has(e),I=H,J=null,K=(0,i.Bk)(a,b,d);if(I&&null===K){E&&E.healthCheckCount++;let a=await (0,n.S)(e,b);a.alive||(I=!1,J=a.reason)}let L={startingSince:K,isWaitingForResponse:!1,isProcessing:!1,waitingKind:null,structuredWaitingSince:null,statusEvidence:null,sessionStatusReason:null,isUnclassified:!1,reading:null},M={frameCapturedAt:0,frameFetchedAfterStart:!1};if(I)try{let e=(0,m.y)(b).statusLines;E&&E.captureCount++;let h=await (0,u.IW)(()=>(0,f.Wh)(a,b,e,d)),n=h.frame;M=h.frameTime;let p={db:B,worktreeId:a,cliToolId:b,instanceId:d},{compositeKey:t,statusResult:z}=function(a,b,c){let{worktreeId:d,cliToolId:e,instanceId:f}=b,h=(0,o.v7)(d,e,f),k=(0,o.xU)(h),l=k?new Date(k):void 0,m=(0,g.WC)(c,e,l);a.startingSince=(0,i.a3)(d,e,f,"waiting"===m.status||m.hasActivePrompt);let n=null===a.startingSince?m:(0,i.Gz)(m);return(0,w.recordCapturedModelInfo)(d,e,f,(0,x.jw)(e,c)),a.isUnclassified=(0,s.Q4)(n.status,n.reason),{isWaitingForResponse:a.isWaitingForResponse,isProcessing:a.isProcessing}=(0,j.O_)(n.status,a.isUnclassified),a.sessionStatusReason=n.reason,a.statusEvidence=n.evidence,{compositeKey:h,statusResult:n}}(L,p,n),{db:F,worktreeId:G,cliToolId:H,instanceId:I}=p,J=(0,q.xF)({worktreeId:G,cliToolId:H,instanceId:I,scraper:{status:z.status,reason:z.reason,hasActivePrompt:z.hasActivePrompt}});L.isWaitingForResponse=L.isWaitingForResponse||null===L.startingSince&&J.waiting;let K=null!==L.startingSince||L.isWaitingForResponse?null:function(a){let{worktreeId:b,cliToolId:c,instanceId:d,output:e,statusResult:f}=a;if(!a.isProcessing&&!(0,k.NV)(b,c,d,e))return null;let h=(0,k.$K)(b,c,d,(0,k.$x)(b,c,d),e);if(null===h)return null;let i={status:f.status,reason:f.reason,thinking:(0,g.f8)(f),evidence:f.evidence,isUnclassifiedActive:a.isUnclassified},j=(0,w.getPublishedAgentTurn)(b,c,d),m=(0,l.wG)(i,h,j)?(0,l.mi)(a.db,b,c,d):null;return(0,l.aT)(i,h,null,j,m)}({db:F,worktreeId:G,cliToolId:H,instanceId:I,output:n,statusResult:z,isUnclassified:L.isUnclassified,isProcessing:L.isProcessing});null!==K&&(L.isProcessing="running"===K.status),(0,s.ox)(t,K??{status:z.status,reason:z.reason,evidence:z.evidence}),L.structuredWaitingSince=null===L.startingSince?J.structured?.at??null:null,L.waitingKind=(0,r.t)({waiting:L.isWaitingForResponse,hasActivePrompt:z.hasActivePrompt,scraperStatus:z.status,scraperReason:z.reason,apiAnswerable:null===L.startingSince&&(0,q.$G)(J.structured,(0,y.VM)(H).capabilities.eventIdentity)}),L.reading=(0,v.Xn)({verdict:z,waiting:L.isWaitingForResponse,waitingKind:L.waitingKind,structuredWaiting:null===L.startingSince&&null!==J.structured,structuredSince:L.structuredWaitingSince});let{db:N,worktreeId:O,cliToolId:P,instanceId:Q}=p;!z.hasActivePrompt&&C(N,O,{limit:10,cliToolId:P,instanceId:Q}).some(a=>"prompt"===a.messageType&&a.promptData?.status!=="answered")&&D(N,O,P,Q,a=>{Promise.resolve().then(c.bind(c,43015)).then(({broadcastMessage:b})=>{b("message_updated",{worktreeId:O,message:a})}).catch(a=>{A.warn("prompt-sweep-broadcast-failed",{worktreeId:O,error:a instanceof Error?a.message:String(a)})})})}catch{L.isProcessing=!0}let N=I?L.reading??{kind:"not-waiting"}:{kind:"gone"};(0,u.cY)({worktreeId:a,cliToolId:b,instanceId:d,observer:"status-probe",start:G,reading:N,...M});let O=L.isWaitingForResponse?(0,t.Jp)(a,b,d)?.since??null:null,{model:P,effort:Q}=(0,w.getResolvedAgentModelInfo)(a,b,d),R=(0,o.v7)(a,b,d);I||(0,s.xG)(R);let S=I?(0,s.AD)(R):null,T=I?function(a,b,c){try{let d=(0,y.VM)(b),e=(0,z.Kf)(d,d.liveness({worktreeId:a,cliToolId:b,instanceId:c}),Date.now());if(void 0===e.degradedReason&&void 0===e.liveness)return null;return e}catch{return null}}(a,b,d):null;try{H?await (0,f.N5)({sessionName:e,worktreeId:a,cliToolId:b,instanceId:d,status:(0,j.kA)({isRunning:I,isWaitingForResponse:L.isWaitingForResponse,isProcessing:L.isProcessing})}):(0,f.Lw)(e)}catch(a){A.debug("tmux-surface:publish-failed",{sessionName:e,error:a instanceof Error?a.message:String(a)})}var U={worktreeId:a,cliToolId:b,instanceId:d,isRunning:I,exitedReason:J,waitingSince:O,model:P,effort:Q,lastKnown:S,eventSource:T};let{worktreeId:V,cliToolId:W,instanceId:X,isRunning:Y,exitedReason:Z,model:$,effort:_,lastKnown:aa,eventSource:ab}=U,{isWaitingForResponse:ac,isProcessing:ad,waitingKind:ae,statusEvidence:af,sessionStatusReason:ag,isUnclassified:ah,startingSince:ai}=L;return{isRunning:Y,isWaitingForResponse:ac,isProcessing:ad,waitingKind:ae,waitingSince:U.waitingSince,awaitingInstruction:Y&&(0,w.isAwaitingInstruction)(V,W,X),...null!==$?{model:$}:{},...null!==_?{reasoningEffort:_}:{},...null!==af?{statusEvidence:af}:{},...null!==ag?{sessionStatusReason:ag}:{},...ah?{isUnclassified:!0}:{},...null!==Z?{sessionStatusReason:h.g.EXITED,statusEvidence:"positive"}:{},...null!==aa?{lastKnownStatus:aa.status,lastKnownStatusAt:aa.at}:{},...null!==ab?{eventSource:ab}:{},...null!==ai?{startingSince:ai}:{}}}async function E(a,b,c,f,g,h,i,j){if(a===p.H)return{sessionStatusByCli:{},sessionStatusByInstance:{},isSessionRunning:!1,isWaitingForResponse:!1,isProcessing:!1};let k=d.CLIToolManager.getInstance(),l=e.XH,m=h(c,a).filter(a=>a.id!==a.cliTool),n=l.map(b=>({cliToolId:b,instanceId:b,sessionName:k.getTool(b).getSessionName(a,b)}));for(let b of m)n.push({cliToolId:b.cliTool,instanceId:b.id,sessionName:k.getTool(b.cliTool).getSessionName(a,b.id)});i&&(i.probeCount+=n.length);let o=await Promise.all(n.map(async d=>{let e=await D(a,d.cliToolId,d.instanceId,d.sessionName,b,c,f,g,i,j?.startFor(d.cliToolId,d.instanceId));return{...d,status:e}})),q={},r={};for(let{cliToolId:a,instanceId:b,status:c}of o){r[b]=c;let d=q[a];q[a]=d?function(a,b){var c,d,e,f;return{isRunning:a.isRunning||b.isRunning,isWaitingForResponse:a.isWaitingForResponse||b.isWaitingForResponse,isProcessing:a.isProcessing||b.isProcessing,waitingKind:(c=a.waitingKind,d=b.waitingKind,null===c?d:null===d||C[c]>=C[d]?c:d),waitingSince:(e=a.waitingSince,f=b.waitingSince,null===e?f:null===f?e:Math.min(e,f)),awaitingInstruction:a.awaitingInstruction||b.awaitingInstruction,...a.isUnclassified||b.isUnclassified?{isUnclassified:!0}:{}}}(d,c):c}let s=!1,t=!1,u=!1;for(let a of Object.values(q))a&&(a.isRunning&&(s=!0),a.isWaitingForResponse&&(t=!0),a.isProcessing&&(u=!0));return{sessionStatusByCli:q,sessionStatusByInstance:r,isSessionRunning:s,isWaitingForResponse:t,isProcessing:u}}},73495:(a,b,c)=>{c.d(b,{Me:()=>h});let d="don['’]t",e=["deny",/^No(?:,|$)/],f={claude:[["allow-once",/^Yes$/],["allow-persistent",/^Yes, and always allow\b/],["mode-change",/^Yes, allow all edits\b/],["mode-change",/^Yes, and switch to\b/],e],codex:[["allow-once",/^Yes$/],["allow-once",/^Yes, proceed\b/],["allow-once",/^Allow(?:\s{2,}|$)/],["allow-persistent",RegExp(`^Yes, and ${d} ask again\\b`)],["allow-persistent",/^Always allow\b/],["mode-change",/^Ask for approval\b/],["mode-change",/^Approve for me\b/],["mode-change",/^Full Access\b/],["deny",/^Cancel\b/],e],antigravity:[["allow-once",/^Yes$/],["allow-once",/^Yes, run command$/],["allow-once",/^Yes, allow creation$/],["allow-persistent",/^Yes, and always allow\b/],e],"command-code":[["allow-once",/^Yes$/],["allow-persistent",RegExp(`^Yes, ${d} ask again\\b`)],["mode-change",/^Yes, allow all edits\b/],e],copilot:[["allow-once",/^Yes$/],["allow-persistent",RegExp(`^Yes, and ${d} ask again\\b`)],["mode-change",/^Manual\b/],["mode-change",/^Allow all\b/],e]},g=Object.values(f).flat();function h(a,b){let c=void 0===b?g:f[b]??null;if(null===c)return{kind:"not-a-permission-dialog"};let d=a.map(a=>(function(a,b){let c=b.trim();for(let[b,d]of a)if(d.test(c))return b;return"unknown"})(c,a.label));if(!d.some(a=>"allow-once"===a||"allow-persistent"===a||"mode-change"===a))return{kind:"not-a-permission-dialog"};let e=a.filter((a,b)=>"allow-once"===d[b]);return 1===e.length?{kind:"allow-once",option:e[0]}:{kind:"unidentified",allowOnceCount:e.length}}Object.keys(f)}};
@@ -0,0 +1,31 @@
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
+ ${c}
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."},ja:{requested:"{alias} へ委任、返信待ち",replied:"{alias} から返信",waiting:"{alias} が確認待ち",expired:"{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}`),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(69198),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:()=>$,runRelayMaintenanceTick:()=>ac});var d=c(88807),e=c(69198),f=c(52660),g=c(55233),h=c(39687),i=c(640),j=c(10168),k=c(55511),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=[f.RELAY_SYSTEM_REQUEST_ID_PREFIX,f.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,f.getMessages)(a,b.worktreeId,{limit:40,cliToolId:b.cliToolId,instanceId:b.instanceId,matchResolvedInstance:!0}),e=A(b.cliToolId);for(let a of d){var g;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(g=a.requestId)&&w.test(g))&&""!==a.content.trim())return a.timestamp.getTime()<c?null:a}}return null}function C(a,b,c){let d=(0,e.ix)(a,{worktreeId:b.worktreeId,instanceId:b.instanceId});if(0===d.length)return 0;let f=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 f of F(a,b,c.inputBoundaryAt??c.createdAt))(0,e.EG)(a,c.id,{messageId:f.row.id,timestamp:f.orderAt,requestId:f.row.requestId??null},d);return!1}if("sent"!==c.sendState||null===c.inputBoundaryAt)return!1;let f=(0,e.TN)(a,c.id);if(!f||!E(a,b,f))return!1;let[g]=F(a,b,c.inputBoundaryAt);return!!g&&G(a,b,f,g.row,d)})(a,b,g,c)&&(f+=1);continue}let d=B(a,b,g.createdAt);if(!d)continue;let h=(0,i.z0)(z(a,g),d.content);D(a,g.id,{candidateId:d.id,body:h,overlap:null,basis:"legacy"},c)&&(f+=1)}return f}function D(a,b,c,d){let f={...c,payloadId:(0,k.randomUUID)()};if((0,e.be)(a,b,"reply",f.body,d,{payloadId:f.payloadId,overlap:f.overlap??void 0}))return!0;let g=(0,e.V9)(a,b);return!!g&&"prompt"===g.kind&&(!!(!(0,s.p5)(b)&&(0,e.Iq)(a,b,g.payloadId,f,d))||(0,e.nR)(a,b,f,d))}function E(a,b,c){if("invalid"===c.relay.obsState)return!1;let d=(0,j.Vg)(b.worktreeId,b.cliToolId,b.instanceId);if(c.obsSource===d)return!0;let f=(0,j.BR)(c.obsSource)!==(0,j.YT)();return(0,e.FO)(a,c.relay.id,f?m.yk.serverRestarted:m.yk.generationChanged,{invalidate:!0}),v.info("relay-observation-mismatch",{relayId:c.relay.id,restarted:f}),!1}function F(a,b,c){let d=A(b.cliToolId),e=x.map(()=>"request_id NOT LIKE ?").join(" AND "),g=a.prepare(`
5
+ SELECT id, request_id, timestamp FROM chat_messages
6
+ WHERE worktree_id = ? ${f.ACTIVE_FILTER}
7
+ AND COALESCE(cli_tool_id, 'claude') = ?
8
+ AND COALESCE(instance_id, cli_tool_id, 'claude') = ?
9
+ AND role = 'assistant' AND COALESCE(message_type, 'normal') != 'prompt'
10
+ AND (request_id IS NULL OR (${e}))
11
+ ${d?"AND request_id LIKE '%-turn:%'":""}
12
+ AND TRIM(content, ' ' || char(9, 10, 13)) != ''
13
+ AND timestamp >= ?
14
+ ORDER BY timestamp ASC, rowid ASC
15
+ LIMIT ?
16
+ `).all(b.worktreeId,b.cliToolId,b.instanceId,...x.map(a=>`${a}%`),c,500),h=[],i=new Set;for(let c of g){if(null!==c.request_id){if(i.has(c.request_id))continue;i.add(c.request_id);let d=function(a,b,c){let d=a.prepare(`
17
+ SELECT id FROM chat_messages
18
+ WHERE worktree_id = ? ${f.ACTIVE_FILTER}
19
+ AND COALESCE(cli_tool_id, 'claude') = ?
20
+ AND COALESCE(instance_id, cli_tool_id, 'claude') = ?
21
+ AND role = 'assistant' AND request_id = ?
22
+ AND TRIM(content, ' ' || char(9, 10, 13)) != ''
23
+ ORDER BY timestamp DESC, rowid DESC
24
+ LIMIT 1
25
+ `).get(b.worktreeId,b.cliToolId,b.instanceId,c);return d?(0,f.getMessageById)(a,d.id):null}(a,b,c.request_id);d&&h.push({row:d,orderAt:c.timestamp});continue}let d=(0,f.getMessageById)(a,c.id);d&&h.push({row:d,orderAt:c.timestamp})}return h}function G(a,b,c,d,e){let h=function(a,b,c,d){let{relay:e}=b,g=!0===e.turnOpenAtSend,h=!1===e.turnOpenAtSend&&"valid"===e.obsState,i=function(a,b,c,d){let e=b.relay.inputBoundaryAt;if(null===e)return"ambiguous";let g=a.prepare("SELECT rowid AS seq FROM chat_messages WHERE id = ?").get(d.id);if(!g)return"ambiguous";let h=a.prepare(`
26
+ SELECT id, content, rowid AS seq FROM chat_messages
27
+ WHERE worktree_id = ? AND role = 'user' ${f.ACTIVE_FILTER}
28
+ AND COALESCE(cli_tool_id, 'claude') = ?
29
+ AND COALESCE(instance_id, cli_tool_id, 'claude') = ?
30
+ AND timestamp >= ? AND timestamp < ?
31
+ `).all(c.worktreeId,c.cliToolId,c.instanceId,e,d.timestamp.getTime()),i=b.inputMessageId?(0,f.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>g.seq){k=!0;continue}return"proven"}return k?"ambiguous":"none"}(a,b,c,d);return g&&"proven"===i?{overlap:"both",basis:"turn-open-at-send+foreign-input"}:g?{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),j=(0,i.Py)((0,g.dV)(a),h.overlap),k=(0,i.z0)(z(a,c.relay),d.content,j),l=D(a,c.relay.id,{candidateId:d.id,body:k,overlap:h.overlap,basis:h.basis},e);return l&&v.info("relay-reply-decided",{relayId:c.relay.id,candidateId:d.id,overlap:h.overlap,basis:h.basis}),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 f=(0,e.TN)(a,c.id);return null!==f&&E(a,b,f)}(a,b,c,d)||(0,e.GC)(a,c.id)===d.id)return!1;let f=(0,g.dV)(a),h=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),j=(0,l.XF)(d.promptData)?d.promptData.question:d.promptData?.question??d.content,k=(0,i.Hr)(f,z(a,c),{question:j,options:h});return!!(0,e.be)(a,c.id,"prompt",k)&&((0,e.UC)(a,c.id,d.id),!0)}var I=c(23854),J=c(8360),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,d.getDbInstance)(),c=(0,e.TN)(b,a);if(!c)return;let{relay:g}=c;if("sent"!==g.sendState||!(0,t.Lo)(g.state)||null===g.inputBoundaryAt)return;let h=(0,r.S)(b,g.to),i={worktreeId:h.worktreeId,cliToolId:h.cliToolId,instanceId:h.instanceId},j=g.inputBoundaryAt,k=Date.now(),l=b.transaction(()=>{if((0,e.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 g=(0,f.getLatestOpenPromptMessage)(a,b.worktreeId,b.cliToolId,b.instanceId);if(!g)return!1;let h=(0,e.Ip)(a,c);return!!h&&!!(0,t.Lo)(h.state)&&H(a,b,h,g)}(b,i,a);(l||m)&&ab()}catch(b){U.warn("relay-after-send-failed",{relayId:a,error:b instanceof Error?b.message:String(b)})}}function X(a){let b=(0,j.YT)();if(globalThis.__relayRecoveredBootId!==b){globalThis.__relayRecoveredBootId=b;try{!function(a,b=Date.now()){let c=(0,j.YT)(),d=0;for(let f of(0,e.hA)(a)){let{relay:g}=f;if("awaiting"===g.sendState){if(null===f.bindAttemptId||f.bindOwner===c)continue;(0,e.Yt)(a,g.id,f.bindAttemptId,m.yk.serverRestartedBeforeInput,b)&&(d+=1);continue}if("input_started"===g.sendState){if(f.bindOwner===c||null===f.bindAttemptId)continue;(0,e.ky)(a,{relayId:g.id,attemptId:f.bindAttemptId,from:["input_started"],to:"unknown",holdReason:m.yk.serverRestarted,now:b})&&(d+=1);continue}if("sent"===g.sendState){if(null!==f.pendingKind)continue;if(null!==f.pendingReply){(0,e.jn)(a,g.id,b)&&(d+=1);continue}if((0,j.BR)(f.obsSource)===c||"invalid"===g.obsState)continue;(0,e.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 ab();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,d.getDbInstance)(),f=(0,e.ix)(c,{worktreeId:a.worktreeId,instanceId:a.instanceId});if(0===f.length)return;if(b.settled){C(c,a,Date.now())>0&&ab();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&&ab();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,d.getDbInstance)(),c=(0,e.ix)(b,{worktreeId:a.worktreeId,instanceId:a.instanceId});if(0===c.length)return;let g=(0,f.getLatestOpenPromptMessage)(b,a.worktreeId,a.cliToolId,a.instanceId);if(!g)return;let h=0;for(let d of c)H(b,a,d,g)&&(h+=1);h>0&&ab()}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,d){let g=(0,e.Ip)(a,b);if(!g)return"skipped";let i=(0,r.S)(a,g.from),j=await R(i.worktreeId,i.cliToolId,i.instanceId,a);if(j)return U.debug("relay-delivery-held",{relayId:b,kind:c,reason:j}),"held";let k=(0,e.V9)(a,b);if(!k||k.kind!==c||k.body!==d)return U.info("relay-delivery-superseded",{relayId:b,kind:c}),"skipped";if("expired"!==c&&!(0,t.Lo)(k.relay.state))return U.info("relay-delivery-closed",{relayId:b,kind:c,state:k.relay.state}),"skipped";let l=k.relay,m=(0,r.S)(a,l.from);(0,s.o5)(b);let n=!1;try{let g=await (0,h.d)(a,{worktreeId:m.worktreeId,content:d,cliToolId:m.cliToolId,instanceId:m.instanceId,messageType:"relay",requestId:"reply"===c?(0,f.relayRequestId)(l.id):void 0});if(!g.ok)return U.info("relay-delivery-refused",{relayId:b,kind:c,stage:g.stage}),"prompt_waiting"===g.stage?"held":"failed";let i=Date.now();return"reply"===c?((0,e.Bf)(a,l.id,(0,f.relayRequestId)(l.id),i)||U.info("relay-already-closed-on-deliver",{relayId:b}),(0,S._)(a,l.id,"replied",m,(0,r.S)(a,l.to),i,{overlap:l.overlap,holdReason:l.holdReason})):"prompt"===c&&(0,S._)(a,l.id,"waiting",m,(0,r.S)(a,l.to),i),(0,e.uJ)(a,l.id,i,k.payloadId),"prompt"===c&&(0,e.jn)(a,l.id,i)&&(globalThis.__relayPumpAgain=!0),U.info("relay-delivered",{relayId:b,kind:c,to:`${m.worktreeId}/${m.instanceId}`}),n=!0,"delivered"}finally{if(!n&&"prompt"===c)try{(0,e.T)(a,l.id,k.payloadId)&&(U.info("relay-prompt-superseded-after-failed-delivery",{relayId:b}),globalThis.__relayPumpAgain=!0)}catch(a){U.warn("relay-prompt-supersede-failed",{relayId:b,error:a instanceof Error?a.message:String(a)})}(0,s.dJ)(b)}}async function ab(){if(!globalThis.__relayPumpRunning){globalThis.__relayPumpRunning=!0;try{let a=(0,d.getDbInstance)();X(a);for(let b=0;b<3;b+=1){for(let b of(globalThis.__relayPumpAgain=!1,(0,e.uG)(a)))if(!V.has(b.relay.id)){V.add(b.relay.id);try{await aa(a,b.relay.id,b.kind,b.body)}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}}}async function ac(){try{X((0,d.getDbInstance)()),function(a,b=Date.now()){for(let c of(0,e.s7)(a,b))if(!(0,s.p5)(c.id))try{let d=(0,g.dV)(a);(0,e.uJ)(a,c.id,b),(0,e.wE)(a,c.id,b);let f=(0,i.KA)(d,z(a,c),c.expiresAt-c.createdAt),h=(0,e.be)(a,c.id,"expired",f,b);if(!(0,e.Cz)(a,c.id,b)){h&&(0,e.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,d.getDbInstance)())}catch(a){U.warn("relay-sweep-failed",{error:a instanceof Error?a.message:String(a)})}await ab()}},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={}){let n=`${d.RELAY_SYSTEM_REQUEST_ID_PREFIX}${b}:${c}`;try{if((0,d.findMessageByRequestId)(a,j.worktreeId,n))return!1;let i=(0,e.dV)(a),o=(0,d.createRelaySystemMessage)(a,{worktreeId:j.worktreeId,cliToolId:j.cliToolId,instanceId:j.instanceId,content:(0,g.Nl)(i,c,k.alias,m),relayId:b,kind:c,at:l});try{(0,f.broadcastMessage)("message",{worktreeId:j.worktreeId,message:{...o,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)}}};
@@ -0,0 +1 @@
1
+ "use strict";exports.id=4911,exports.ids=[4911],exports.modules={3421:(a,b,c)=>{Object.defineProperty(b,"I",{enumerable:!0,get:function(){return g}});let d=c(71237),e=c(55088),f=c(17679);async function g(a,b,c,g){if((0,d.isNodeNextResponse)(b)){var h;b.statusCode=c.status,b.statusMessage=c.statusText;let d=["set-cookie","www-authenticate","proxy-authenticate","vary"];null==(h=c.headers)||h.forEach((a,c)=>{if("x-middleware-set-cookie"!==c.toLowerCase())if("set-cookie"===c.toLowerCase())for(let d of(0,f.splitCookiesString)(a))b.appendHeader(c,d);else{let e=void 0!==b.getHeader(c);(d.includes(c.toLowerCase())||!e)&&b.appendHeader(c,a)}});let{originalResponse:i}=b;c.body&&"HEAD"!==a.method?await (0,e.pipeToNodeResponse)(c.body,i,g):i.end()}}},5007:(a,b,c)=>{c.d(b,{Sw:()=>g,nE:()=>e,of:()=>f});var d=c(10641);async function e(a){try{return{ok:!0,body:await a.json()}}catch{return{ok:!1,response:d.NextResponse.json({error:"Invalid request body"},{status:400})}}}async function f(a){let b=await e(a);if(!b.ok)return b;let c=b.body;return"object"!=typeof c||null===c||Array.isArray(c)?{ok:!1,response:d.NextResponse.json({error:"Invalid request body"},{status:400})}:{ok:!0,body:c}}async function g(a){let b;try{b=await a.json()}catch{return{ok:!0,body:{}}}return"object"!=typeof b||null===b||Array.isArray(b)?{ok:!1,response:d.NextResponse.json({error:"Invalid request body"},{status:400})}:{ok:!0,body:b}}},27289:(a,b,c)=>{c.d(b,{t:()=>j,z:()=>i});var d=c(10641),e=c(88807),f=c(56791),g=c(95506),h=c(66007);function i(a){if(!a)return a;try{if(!(0,h.h6)(a))return a;let b=(0,e.getDbInstance)();return(0,g.l0)(b,a)??a}catch{return a}}function j(a){if(!(0,h.h6)(a))return d.NextResponse.json({error:"Invalid worktree ID format"},{status:400});let b=(0,e.getDbInstance)(),c=(0,f.getWorktreeById)(b,i(a));return c||d.NextResponse.json({error:"Worktree not found"},{status:404})}},56791:(a,b,c)=>{c.r(b),c.d(b,{ACTIVE_FILTER:()=>d.ks,ACTIVE_TASK_STATUSES:()=>d.EL,AgentInstanceLimitError:()=>d.AC,CURRENT_SCHEMA_VERSION:()=>f.FT,DEFAULT_RUN_HISTORY_LIMIT:()=>d.Tu,InvalidAgentInstanceError:()=>d.ug,MAX_DISABLED_REPOSITORIES:()=>h.nc,MAX_RUN_HISTORY_DAYS:()=>d.eP,MAX_RUN_HISTORY_LIMIT:()=>d.mg,MemoDbError:()=>d.lm,NEW_SUBSCRIPTION_DEFAULTS:()=>d.s6,PUSH_DEFAULTS_VERSION:()=>d.VP,RepositoryDbError:()=>h.j8,TASK_STATUSES:()=>d.Hi,TERMINAL_TASK_STATUSES:()=>d.sA,VERIFICATION_GATE_SOURCES:()=>d.Dx,VERIFICATION_TRIGGERS:()=>d.af,WORKTREE_TODO_STATUSES:()=>d.KG,addAgentInstance:()=>d.Uq,cancelTimer:()=>d.Ud,cancelTimersByWorktree:()=>d.$$,cleanupOldTimers:()=>d.ul,clearInProgressMessageId:()=>d.YX,clearLastUserMessage:()=>d.cf,clearTimerHistory:()=>d.jf,closeDbInstance:()=>e.closeDbInstance,countAgentInstances:()=>d.fs,countDisabledRepositories:()=>h.QJ,countPushSubscriptionsForKind:()=>d.rC,countWorktreesByRepositoryPath:()=>h.kp,createCloneJob:()=>h.tw,createGateResult:()=>d.hl,createMemo:()=>d.To,createMessage:()=>d.oH,createRepository:()=>h.vB,createTask:()=>d.UT,createTimer:()=>d.CR,createVerificationRun:()=>d.rY,createWorktreeTodo:()=>d.yy,deleteAllMessages:()=>d.pE,deleteMemo:()=>d.cP,deleteMessageById:()=>d.DF,deleteMessagesByCliTool:()=>d.lA,deleteMessagesByInstance:()=>d.Qp,deletePushSubscriptionByEndpoint:()=>d.th,deleteRepository:()=>h.oG,deleteRepositoryWorktrees:()=>d.oZ,deleteSessionState:()=>d.ZP,deleteWorktreeTodo:()=>d.vg,deleteWorktreesByIds:()=>d.Rm,disableExistingRepository:()=>h.eP,disableRepository:()=>h.l$,ensureEnvRepositoriesRegistered:()=>h.ES,filterExcludedPaths:()=>h.Ho,findMessageByRequestId:()=>d.Ow,finishGateResult:()=>d.C8,finishVerificationRun:()=>d.u$,getActiveCloneJobByUrl:()=>h.fD,getActiveTask:()=>d.__,getActiveTaskForInstance:()=>d.MH,getAgentInstance:()=>d.BN,getAgentInstances:()=>d.m0,getAliasedWorktreeIds:()=>d.r3,getAllPushSubscriptions:()=>d.Se,getAllRepositories:()=>h.Yg,getAllRepositoriesWithWorktreeCount:()=>h._D,getAllWorktreeAliases:()=>d.fX,getAllWorktreeIds:()=>d.nO,getAllWorktreePathIds:()=>d.Sj,getCloneJob:()=>h.bM,getCloneJobsByStatus:()=>h.n_,getCurrentVersion:()=>f.Mj,getDailyReport:()=>d.ap,getDbInstance:()=>e.getDbInstance,getDefaultDbPath:()=>g.$b,getExcludedRepositories:()=>h.lS,getExcludedRepositoryPaths:()=>h.pr,getInitialBranch:()=>d.p4,getIssueDbPath:()=>g.zm,getLastAssistantMessageAt:()=>d.nP,getLastMessage:()=>d.sy,getLastUserMessage:()=>d.r8,getLegacyDbPaths:()=>u,getMemoById:()=>d.DN,getMemosByWorktreeId:()=>d.pZ,getMessageById:()=>d.kA,getMessages:()=>d.VL,getMessagesByDateRange:()=>d.lr,getMigrationHistory:()=>f.PS,getPendingTimerCountByWorktree:()=>d.GF,getPendingTimers:()=>d._O,getPushSubscriptionByEndpoint:()=>d.CF,getPushSubscriptionsForKind:()=>d.gn,getRepositories:()=>d.NV,getRepositoryById:()=>h.r,getRepositoryByNormalizedUrl:()=>h.Uj,getRepositoryByPath:()=>h.Dp,getRunningVerificationRun:()=>d.WZ,getSessionState:()=>d.y1,getTask:()=>d.gg,getTimerById:()=>d.kx,getTimersByWorktree:()=>d.DP,getTodosByWorktreeId:()=>d.fr,getVerificationRun:()=>d.J6,getWorktreeAliases:()=>d.Q2,getWorktreeById:()=>d.Ui,getWorktreeIdsByRepository:()=>d.P9,getWorktreeTodoById:()=>d.eN,getWorktrees:()=>d.vi,getWorktreesByRepository:()=>d.uJ,initDatabase:()=>d.s4,isTerminalTaskStatus:()=>d.uB,isWorktreeTodoStatus:()=>d.yT,listRunningVerificationRuns:()=>d.Fi,listTaskEvents:()=>d.HB,listTasks:()=>d.Vk,listVerificationRuns:()=>d.Mt,listVerificationRunsForPeriod:()=>d.UE,markPendingPromptsAsAnswered:()=>d.PL,migrateDbIfNeeded:()=>w,migrateWorktreeIdPreservingChildren:()=>d._h,pushSubscriptionNeedsDefaultsNotice:()=>d.Zj,recomputeLastUserMessage:()=>d.jp,recordAnsweredPrompt:()=>d.pG,recordWorktreeAlias:()=>d.xJ,recoverStuckSendingTimers:()=>d.Xm,registerAndFilterRepositories:()=>h.$G,removeAgentInstance:()=>d.NU,reorderMemos:()=>d.nQ,reorderWorktreeTodos:()=>d.yb,resolveAndValidatePath:()=>t,resolveRepositoryPath:()=>h.mE,resolveWorktreeIdWithAlias:()=>d.l0,restoreRepository:()=>h.RS,rollbackMigrations:()=>f.Wy,runMigrations:()=>f.vI,saveDailyReport:()=>d.tt,saveInitialBranch:()=>d.GA,setAgentInstances:()=>d.Cs,setInProgressMessageId:()=>d.OF,setRepositoryEnabled:()=>h.iQ,updateCliToolId:()=>d.WU,updateCloneJob:()=>h.k5,updateDailyReportContent:()=>d.IF,updateFavorite:()=>d.O,updateLastUserMessage:()=>d.EU,updateLastViewedAt:()=>d.HZ,updateMemo:()=>d.UY,updateMessageContent:()=>d.e8,updatePromptData:()=>d.cw,updatePushSubscriptionPreferences:()=>d.jJ,updateRepository:()=>h.Ir,updateSelectedAgents:()=>d.DC,updateSessionState:()=>d.PP,updateStatus:()=>d.yB,updateTimerStatus:()=>d.j2,updateVibeLocalContextWindow:()=>d.s,updateVibeLocalModel:()=>d.iu,updateWorktreeDescription:()=>d.hq,updateWorktreeLink:()=>d.z1,updateWorktreeTodo:()=>d.bl,upsertPushSubscription:()=>d.jA,upsertWorktree:()=>d.ZL,validateDbPath:()=>g.Sv,validateRepositoryPath:()=>h.Ux,validateSchema:()=>f.i6});var d=c(683),e=c(88807),f=c(55741),g=c(20416),h=c(10406),i=c(87550),j=c.n(i),k=c(55511),l=c.n(k),m=c(29021),n=c.n(m),o=c(33873),p=c.n(o),q=c(21820),r=c(7956);let s=(0,c(72626).h)("db-migration-path");function t(a,b){try{if(!n().existsSync(a))return null;let c=n().realpathSync(a);if((0,r.fW)(c))return s.warn(`[Security] ${b} points to system directory, skipping: ${c}`),null;return c}catch{return s.warn(`[Security] Failed to resolve ${b}: ${a}`),null}}function u(){let a=[];a.push(p().join(process.cwd(),"data","db.sqlite")),a.push(p().join(process.cwd(),"data","cm.db")),a.push(p().join((0,q.homedir)(),".commandmate","data","db.sqlite"));let b=process.env.DATABASE_PATH;if(b)try{let c=p().resolve(b);(0,r.fW)(c)?s.warn(`[Security] Skipping DATABASE_PATH in system directory: ${c}`):a.push(b)}catch{s.warn(`[Security] Invalid DATABASE_PATH: ${b}`)}return a}function v(a,b){if(function(a){try{return n().statSync(`${a}-wal`).size>0}catch{return!1}}(a)){let c=`${b}.${l().randomBytes(4).toString("hex")}.partial`;try{n().closeSync(n().openSync(c,"wx",384));let d=new(j())(a,{readonly:!0,fileMustExist:!0});try{d.prepare("VACUUM INTO ?").run(c)}finally{d.close()}n().renameSync(c,b)}catch(a){throw n().rmSync(c,{force:!0}),a}}else n().copyFileSync(a,b)}function w(a){let b=p().resolve(a);if((0,r.fW)(b))throw Error(`Security error: Target path cannot be in system directory: ${b}`);if(n().existsSync(a)){let b=t(a,"target path");if(b)return{migrated:!1,targetPath:b}}for(let a of u()){let c=t(a,"legacy path");if(!c)continue;let d=`${c}.bak`;v(c,d),n().chmodSync(d,384);let e=p().dirname(b);return n().existsSync(e)||n().mkdirSync(e,{recursive:!0,mode:448}),v(c,b),s.info(`[Migration] Database migrated from ${c} to ${b}`),s.info(`[Migration] Backup created at ${d}`),{migrated:!0,sourcePath:c,targetPath:b,backupPath:d}}return{migrated:!1,targetPath:b}}},79498:(a,b,c)=>{c.d(b,{Ll:()=>e,Z:()=>d,bu:()=>f});let d=50,e=2e3,f=4e3},95736:(a,b,c)=>{a.exports=c(44870)}};
@@ -0,0 +1 @@
1
+ "use strict";exports.id=4936,exports.ids=[2839,4936,5220,5630],exports.modules={2669:(a,b,c)=>{c.d(b,{JI:()=>n,M7:()=>d,Sr:()=>h,Zf:()=>f,c7:()=>e,lU:()=>k,mR:()=>j,qO:()=>i,su:()=>m,wQ:()=>l});let d="SESSION_STARTING",e="SESSION_START_FAILED",f="SESSION_START_UNAVAILABLE",g=[d,e];class h extends Error{constructor(a,b,c){super(`${a} did not reach its input prompt within ${Math.round(c/1e3)}s (initialization timeout). The tmux session '${b}' and its process are still running, so this is a slow start, not a failed one — the message was not delivered, but nothing needs repairing. Retry the send in a few seconds, or run \`commandmate capture <worktree-id>\` to see what it is waiting on.`),this.toolName=a,this.sessionName=b,this.timeoutMs=c,this.code=d,this.name="SessionStartTimeoutError"}}function i(a,b){return`${a} exited before reaching its input prompt: the tmux session '${b}' is back at a shell, so this is not a slow start and waiting will not help. The message was not delivered. Run \`commandmate capture <worktree-id>\` to see why it exited (for example a startup dialog answered with exit, or a missing login), fix that, then send again.`}class j extends Error{constructor(a,b,c){super(`${a} reported an error while starting in tmux session '${b}': "${c}". Retrying will not help until that is resolved; run \`commandmate capture <worktree-id>\` to see the session output.`),this.toolName=a,this.sessionName=b,this.detectedPattern=c,this.code=e,this.name="SessionStartFailedError"}}class k extends Error{constructor(a,b=`${a} is not installed. Please install it first.`){super(b),this.toolName=a,this.code=f,this.name="SessionStartUnavailableError"}}function l(a){return o(a)===d}function m(a){let b=o(a);return void 0!==b&&g.includes(b)}function n(a){return o(a)===f}function o(a){if("object"!=typeof a||null===a)return;let b=a.code;return"string"==typeof b?b:void 0}},22354:(a,b,c)=>{c.d(b,{F0:()=>j.F,K9:()=>e.K9,VM:()=>d.VM,_0:()=>f._0,c1:()=>k.c,o:()=>i.o,vm:()=>h.v,y_:()=>g.y_});var d=c(70096);c(66101);var e=c(45567);c(57510),c(38367);var f=c(25071),g=c(50474),h=c(70997),i=c(77904),j=c(76835),k=c(2734)},39687:(a,b,c)=>{c.d(b,{d:()=>A});var d=c(56791),e=c(8360),f=c(15194),g=c(95220),h=c(12462),i=c(43015),j=c(54325),k=c(72626),l=c(34331),m=c(40964),n=c(58707),o=c(2669),p=c(31990),q=c(20029),r=c(7321),s=c(94154),t=c(34405),u=c(49973),v=c(49319);let w=(0,k.h)("session/send-user-message");function x(a){return a instanceof Error?a.message:String(a)}async function y(a,b){let c=`${a}:${b}`,d=Date.now()+5e3;for(;(0,g.getActivePollers)().includes(c);){if(Date.now()>=d)return!1;await new Promise(a=>setTimeout(a,100))}return!0}async function z(a,b,c,d){if(!s.wn.has(b))return!1;try{let e=await (0,p.WD)(a,b,t._,c),f=(0,s.ji)(e,b);return"content"===f.state&&(0,q.C7)(f.text,d)}catch(a){return w.warn("send-composer-residue-read-failed",{error:x(a)}),!1}}async function A(a,b){let{worktreeId:c,content:k,cliToolId:p,instanceId:t,absoluteImagePath:A,copilotModel:B}=b,C=b.messageType??"normal",D=t??p,E=e.CLIToolManager.getInstance().getTool(p),F=(a,d)=>{(0,q.zE)({worktreeId:c,cliToolId:p,instanceId:D},{state:a,reason:d,content:k}),b.onAttempt?.({state:a,reason:d})},G=(0,m.mf)(p,c,t),H=await (0,l.L)(c,G,a);if(null===H||"foreign"===H.verdict)return F("not-sent","foreign-session"),w.warn("send-refused-foreign-session",{worktreeId:c,cliToolId:p,instanceId:D,sessionName:G,sessionPath:H?.sessionPath??null,reason:H?"foreign":"worktree_not_found"}),{ok:!1,stage:"foreign_session",error:H?`tmux session "${G}" belongs to another CommandMate server`:`Worktree '${c}' not found; cannot confirm tmux session "${G}" is this server's`};let I=await (0,n.a3)(c,p,t,{ignoreStructured:b.ignoreStructuredPromptGuard});if(I.waiting)return F("not-sent","prompt-waiting"),w.info("send-refused-prompt-waiting",{worktreeId:c,cliToolId:p,reason:I.reason,blockedBy:I.blockedBy}),{ok:!1,stage:"prompt_waiting",error:(0,n.br)(c,I.blockedBy,t)};if(B&&"copilot"===p){try{await E.sendModelCommand(c,B,t),w.info("copilot-model-command-sent",{model:B})}catch(b){w.error("failed-to-send-model-command:",{error:x(b)});let a=b?.code;if(a===r.a9)return F("not-sent","prompt-waiting"),{ok:!1,stage:"prompt_waiting",error:(0,n.br)(c,void 0,t)};return F("not-sent",a===r.$_?"recheck-failed":"model-switch-failed"),{ok:!1,stage:"model",error:x(b)}}await y(c,D)||w.warn("previous-turn-poller-still-running",{worktreeId:c,instanceId:D,waitedMs:5e3})}let J=new Date;try{await (0,h.o4)(a,c,p,J,t)}catch(a){w.error("failed-to-save-pending-assistant-response:",{error:x(a)})}let K=null;try{let b=(0,d.getMessages)(a,c,{limit:1,cliToolId:p,instanceId:D,matchResolvedInstance:!0});b.length>0&&"user"===b[0].role&&b[0].content===k&&(K=b[0].id)}catch(a){w.error("failed-to-detect-orphaned-messages:",{error:x(a)})}async function L(){try{let{inputStartedAt:a}=await (0,u.x1)(M,b.onInputStart,b.inputBoundary);return{sent:!0,inputStartedAt:a}}catch(b){if(w.error("failed-to-send-message-to:",{error:x(b)}),(0,u.fi)(b))return{error:b,failure:{state:"not-sent",reason:"relay-reservation-lost"}};let a=(0,q.Nq)(b);return("submit-unconfirmed"===a.reason||"prompt-unreported"===a.reason)&&await z(c,p,t,k)&&(a={state:"indeterminate",reason:"composer-residue"}),{error:b,failure:a}}}async function M(){A?(0,f._J)(E)?await E.sendMessageWithImage(c,k,A,t):await E.sendMessage(c,(0,v.TZ)(k,A),t):await E.sendMessage(c,k,t)}let N=s.wn.has(p)?await (0,u.hC)(G,()=>L()).catch(a=>({error:a,failure:(0,q.Nq)(a)})):await L();if(!("sent"in N)){let{error:a,failure:b}=N;return(F(b.state,b.reason),"prompt-waiting"===b.reason)?{ok:!1,stage:"prompt_waiting",error:(0,n.br)(c,void 0,t)}:(0,o.wQ)(a)?{ok:!1,stage:"send",error:a.message,code:o.M7}:{ok:!1,stage:"send",error:x(a)}}F("sent","submitted");let O=N.inputStartedAt,P=null!==O&&O.getTime()>J.getTime()?O:J,Q=(0,d.createMessage)(a,{worktreeId:c,role:"user",content:k,messageType:C,timestamp:P,cliToolId:p,instanceId:t,requestId:b.requestId});try{(0,i.broadcastMessage)("message",{worktreeId:c,message:{...Q,cliToolId:p,instanceId:D}})}catch(a){w.warn("user-message-broadcast-failed",{error:x(a)})}if(K)try{if((0,d.deleteMessageById)(a,K)){w.info("cleaned-up-orphaned-user");try{(0,i.broadcastMessage)(j.dz,{worktreeId:c,cliToolId:p,instanceId:D,reason:"orphan_cleanup"})}catch(a){w.warn("orphan-cleanup-broadcast-failed",{error:x(a)})}}}catch(a){w.error("failed-to-clean-up-orphaned-message:",{error:x(a)})}return(0,d.updateLastUserMessage)(a,c,k,P),(0,d.clearInProgressMessageId)(a,c,p,t),w.info("cleared-in-progress-message"),(0,g.startPolling)(c,p,t),{ok:!0,message:Q}}},50474:(a,b,c)=>{c.d(b,{y_:()=>d});function d(a){var b=a.noDecision;switch(b.kind){case"proceeds":return{safe:!0,blocksForMs:0,summary:"the agent continues with its own approval flow"};case"blocks":return{safe:!1,blocksForMs:null,summary:"the agent waits indefinitely; nothing else will unblock it"};case"blocksUntil":return{safe:!1,blocksForMs:b.timeoutMs,summary:`the agent waits up to ${b.timeoutMs}ms before continuing`}}}},58707:(a,b,c)=>{c.d(b,{$n:()=>k,a3:()=>l,br:()=>m});var d=c(8360),e=c(31990),f=c(95595),g=c(34405),h=c(72626),i=c(30008);let j=(0,h.h)("prompt-waiting-guard"),k="PROMPT_WAITING";async function l(a,b,c,h){try{let k=d.CLIToolManager.getInstance().getTool(b);if(!await k.isRunning(a,c))return{waiting:!1};let l=await (0,e.Wh)(a,b,g._,c),m=(0,f.WC)(l,b),n=(0,i._G)({worktreeId:a,cliToolId:b,instanceId:c,scraper:{status:m.status,reason:m.reason,hasActivePrompt:m.hasActivePrompt},ignoreStructured:h?.ignoreStructured});if(!n.blocksSend)return null!==n.structuredSendBlockSuppressed&&j.info("structured-send-guard-not-applied",{worktreeId:a,cliToolId:b,instanceId:c,suppressed:n.structuredSendBlockSuppressed,promptWaitingSince:n.structured?.at??null}),{waiting:!1};return{waiting:!0,reason:n.blockReason??void 0,blockedBy:n.blockedBy??void 0}}catch(c){return j.warn("prompt-waiting-check-failed",{worktreeId:a,cliToolId:b,error:c instanceof Error?c.message:String(c)}),{waiting:!1}}}function m(a,b,c){let d=c?` --instance ${c}`:"",e=`${a} is waiting on a prompt. Sending now would type into the prompt's input line instead of reaching the agent, and would leave that text in place for the next answer. Answer the prompt first: \`commandmate respond ${a} <answer>${d}\`.`;if("structured"!==b)return e;let f=Math.round(i.j0/6e4);return`${e} This dialog was reported by the agent's own hooks and is not visible to the terminal scraper, so if the pane looks idle the record has outlived its dialog: it stops blocking sends ${f} minutes after it was reported, or immediately with \`commandmate send ${a} <message>${d} --ignore-structured-prompt\` (server-wide: ${i.F1}=off).`}},73495:(a,b,c)=>{c.d(b,{Me:()=>h});let d="don['’]t",e=["deny",/^No(?:,|$)/],f={claude:[["allow-once",/^Yes$/],["allow-persistent",/^Yes, and always allow\b/],["mode-change",/^Yes, allow all edits\b/],["mode-change",/^Yes, and switch to\b/],e],codex:[["allow-once",/^Yes$/],["allow-once",/^Yes, proceed\b/],["allow-once",/^Allow(?:\s{2,}|$)/],["allow-persistent",RegExp(`^Yes, and ${d} ask again\\b`)],["allow-persistent",/^Always allow\b/],["mode-change",/^Ask for approval\b/],["mode-change",/^Approve for me\b/],["mode-change",/^Full Access\b/],["deny",/^Cancel\b/],e],antigravity:[["allow-once",/^Yes$/],["allow-once",/^Yes, run command$/],["allow-once",/^Yes, allow creation$/],["allow-persistent",/^Yes, and always allow\b/],e],"command-code":[["allow-once",/^Yes$/],["allow-persistent",RegExp(`^Yes, ${d} ask again\\b`)],["mode-change",/^Yes, allow all edits\b/],e],copilot:[["allow-once",/^Yes$/],["allow-persistent",RegExp(`^Yes, and ${d} ask again\\b`)],["mode-change",/^Manual\b/],["mode-change",/^Allow all\b/],e]},g=Object.values(f).flat();function h(a,b){let c=void 0===b?g:f[b]??null;if(null===c)return{kind:"not-a-permission-dialog"};let d=a.map(a=>(function(a,b){let c=b.trim();for(let[b,d]of a)if(d.test(c))return b;return"unknown"})(c,a.label));if(!d.some(a=>"allow-once"===a||"allow-persistent"===a||"mode-change"===a))return{kind:"not-a-permission-dialog"};let e=a.filter((a,b)=>"allow-once"===d[b]);return 1===e.length?{kind:"allow-once",option:e[0]}:{kind:"unidentified",allowOnceCount:e.length}}Object.keys(f)},95220:(a,b,c)=>{c.r(b),c.d(b,{accumulateTuiContent:()=>g.IZ,cleanClaudeResponse:()=>f.NN,cleanCopilotResponse:()=>f.LH,cleanGeminiResponse:()=>f.IS,cleanOpenCodeResponse:()=>f.aW,clearPromptHashCache:()=>h.iX,clearTuiAccumulator:()=>g.q1,extractCopilotContentLines:()=>g.o0,extractTuiContentLines:()=>g.K0,findOverlapIndex:()=>g.vQ,getAccumulatedContent:()=>g.Uz,getActivePollers:()=>d.KQ,initTuiAccumulator:()=>g.tb,isDuplicatePrompt:()=>h.gv,isOpenCodeComplete:()=>e.bE,migrateResponsePollerWorktreeIds:()=>d.sR,normalizeCopilotLine:()=>g.IW,normalizePromptForDedup:()=>h.zm,renamePromptHashCacheKey:()=>h.i2,resolveExtractionStartIndex:()=>e.QM,startPolling:()=>d.g8,stopAllPolling:()=>d.fq,stopPolling:()=>d.Et,truncateMessage:()=>f.Sj});var d=c(45146),e=c(60),f=c(82450),g=c(13033),h=c(72457)}};
@@ -1 +1,2 @@
1
- "use strict";exports.id=5209,exports.ids=[5209],exports.modules={998:(a,b,c)=>{c.d(b,{BF:()=>h,EH:()=>k,_R:()=>j});var d=c(11456),e=c(35524);let f={"session-killed":{state:"disable",poller:"stop"},"instance-removed":{state:"delete",poller:"stop"},"worktree-deleted":{state:"delete",poller:"stop"},"orphan-swept":{state:"delete",poller:"stop"},"consecutive-errors":{state:"disable",stopReason:"consecutive_errors",poller:"stop"},"server-shutdown":{state:"none",poller:"stop"}},g={"session-killed":"session-killed","instance-removed":"instance-removed","worktree-deleted":"worktree-deleted","orphan-swept":"orphan-swept","consecutive-errors":"consecutive-errors","server-shutdown":"shutdown"};function h(a,b){"stop"===f[a].poller&&(0,d.z)(g[a],()=>(function(a){switch(a.scope){case"instance":(0,e._i)((0,e.v7)(a.worktreeId,a.cliToolId,a.instanceId));return;case"worktree":(0,e._C)(a.worktreeId);return;case"key":(0,e._i)(a.compositeKey);return;case"all":(0,e.BS)();return}})(b))}function i(a,b){let c=(0,e.pL)(a);c&&(0,e.XK)((0,e.Ue)(a),c,b,(0,e.GE)(a)??void 0)}function j(a,b){let c=f[a];if("none"!==c.state)switch(b.scope){case"instance":"disable"===c.state?(0,e.XK)(b.worktreeId,b.cliToolId,c.stopReason,b.instanceId):(0,e.DR)((0,e.v7)(b.worktreeId,b.cliToolId,b.instanceId));return;case"worktree":"disable"===c.state?(0,e.kC)(b.worktreeId).forEach(a=>i(a,c.stopReason)):(0,e.LP)(b.worktreeId);return;case"key":"disable"===c.state?i(b.compositeKey,c.stopReason):(0,e.DR)(b.compositeKey);return;case"all":(0,e.hN)().forEach(a=>"disable"===c.state?i(a,c.stopReason):(0,e.DR)(a));return}}function k(a,b){h(a,b),j(a,b)}},23197:(a,b,c)=>{c.d(b,{H:()=>d});let d="__global__"},65209:(a,b,c)=>{c.d(b,{Nz:()=>t,l7:()=>x,vr:()=>v});var d=c(95220),e=c(998),f=c(56793),g=c(85775),h=c(93997),i=c(15194),j=c(23197),k=c(77093),l=c(72626),m=c(8360),n=c(79892),o=c(82325),p=c(73753),q=c(31347);let r=(0,l.h)("session-cleanup");async function s(a,b){let c={worktreeId:a,sessionsKilled:[],sessionErrors:[],pollersStopped:[],pollerErrors:[]};for(let e of((0,h.pc)(),i.XH)){try{await b(a,e)&&(c.sessionsKilled.push(e),r.info("session:killed",{worktreeId:a,cliToolId:e}))}catch(d){let b=`${e}: ${(0,k.u1)(d)}`;c.sessionErrors.push(b),r.warn("session:kill-failed",{worktreeId:a,cliToolId:e,error:d instanceof Error?d.message:String(d)})}try{(0,d.stopPolling)(a,e),c.pollersStopped.push(`response-poller:${e}`)}catch(d){let b=`response-poller:${e}: ${(0,k.u1)(d)}`;c.pollerErrors.push(b),r.warn("response-poller:stop-failed",{worktreeId:a,cliToolId:e,error:d instanceof Error?d.message:String(d)})}}try{(0,e.BF)("worktree-deleted",{scope:"worktree",worktreeId:a}),c.pollersStopped.push("auto-yes-poller")}catch(d){let b=`auto-yes-poller: ${(0,k.u1)(d)}`;c.pollerErrors.push(b),r.warn("auto-yes-poller:stop-failed",{worktreeId:a,error:d instanceof Error?d.message:String(d)})}try{(0,e._R)("worktree-deleted",{scope:"worktree",worktreeId:a}),c.pollersStopped.push("auto-yes-state")}catch(d){let b=`auto-yes-state: ${(0,k.u1)(d)}`;c.pollerErrors.push(b),r.warn("auto-yes-state:delete-failed",{worktreeId:a,error:d instanceof Error?d.message:String(d)})}try{(0,f.Yg)(a),c.pollersStopped.push("schedule-manager")}catch(d){let b=`schedule-manager: ${(0,k.u1)(d)}`;c.pollerErrors.push(b),r.warn("schedule-manager:stop-failed",{worktreeId:a,error:d instanceof Error?d.message:String(d)})}try{(0,g.Tm)(a),c.pollersStopped.push("timer-manager")}catch(d){let b=`timer-manager: ${(0,k.u1)(d)}`;c.pollerErrors.push(b),r.warn("timer-manager:stop-failed",{worktreeId:a,error:d instanceof Error?d.message:String(d)})}return c}async function t(a,b){let c=await Promise.allSettled(a.map(a=>s(a,b))),d=[],e=[];for(let b=0;b<c.length;b++){let f=c[b],g=a[b];if("fulfilled"===f.status){let a=f.value;for(let b of(d.push(a),a.sessionErrors))e.push(`Session kill error (${g}): ${b}`);for(let b of a.pollerErrors)e.push(`Poller stop error (${g}): ${b}`)}else e.push(`Cleanup failed (${g}): ${(0,k.u1)(f.reason)}`)}return{results:d,warnings:e}}async function u(a,b,c){try{let e=m.CLIToolManager.getInstance().getTool(b);if(!await e.isRunning(a))return!1;let f=e.getSessionName(a),g=await (0,q.s_)(f,c);if("owned"!==g.verdict)return!1;let h=`${a}:${b}`;return(0,d.clearPromptHashCache)(h),(0,n.fY)(f)}catch{return!1}}function v(a){return async(b,c)=>{let d=a.get(b);return void 0!==d&&u(b,c,d)}}async function w(){let a=0,b=m.CLIToolManager.getInstance();for(let c of i.XH)try{let d=b.getTool(c).getSessionName(j.H);await (0,n.N)(d)&&await (0,n.fY)(d)&&(a++,r.info("global-session:killed",{cliToolId:c,sessionName:d}))}catch(a){r.warn("global-session:kill-failed",{cliToolId:c,error:(0,k.u1)(a)})}return a}async function x(a,b){let c=new Map((0,p.Sj)(a).map(a=>[a.id,a.path])),d=(0,o.L0)(a,b);try{await w()}catch(a){r.warn("sync:global-cleanup-failed",{error:(0,k.u1)(a)})}let e=[];if(d.deletedIds.length>0)try{let a=await t(d.deletedIds,v(c));a.warnings.length>0&&(r.warn("sync:cleanup-warnings",{warnings:a.warnings}),e=[`${a.warnings.length} session cleanup warning(s) occurred`])}catch(a){r.error("sync:cleanup-failed",{error:(0,k.u1)(a)}),e=["Session cleanup encountered an error"]}return{syncResult:d,cleanupWarnings:e}}},82325:(a,b,c)=>{c.d(b,{Hz:()=>o,L0:()=>r,Mg:()=>s,YM:()=>p,Yp:()=>q});var d=c(79646),e=c(28354),f=c(29021),g=c.n(f),h=c(33873),i=c.n(h),j=c(23718),k=c(56791),l=c(72626),m=c(64185);let n=(0,l.h)("worktrees");function o(){let a=process.env.WORKTREE_REPOS;return a&&a.trim()?a.split(",").map(a=>a.trim()).filter(a=>a.length>0):[]}async function p(a){let b=(0,e.promisify)(d.exec);if(function(a){if(!a)return!1;try{return g().lstatSync(a),!1}catch(b){let a=b.code;return"ENOENT"===a||"ENOTDIR"===a}}(a))return n.warn("repository:scan-skipped-missing-dir",{repoPath:a}),[];try{let{stdout:c}=await b("git worktree list",{cwd:a}),d=function(a){if(!a||""===a.trim())return[];let b=a.trim().split("\n"),c=[];for(let a of b){let b=a.trim();if(!b)continue;let d=b.match(/^(.+?)\s+([a-z0-9]+)\s+(?:\[(.+?)\]|\(detached HEAD\))/);if(d){let[,a,b,e]=d;c.push({path:a.trim(),branch:e||`detached-${b}`,commit:b})}}return c}(c),e=i().resolve(a),f=i().basename(e);return(0,m.oZ)(e),d.map(a=>{let b=i().resolve(a.path);return{id:(0,j.ko)(b),name:a.branch,branch:a.branch,path:b,repositoryPath:e,repositoryName:f}}).filter(a=>["/etc","/root","/sys","/proc","/dev","/boot","/bin","/sbin","/usr/bin","/usr/sbin"].some(b=>a.path.startsWith(b))?(n.warn("worktree:unsafe-path-skipped",{path:a.path}),!1):!(a.path.includes("\0")||a.path.includes(".."))||(n.warn("worktree:malicious-path-skipped",{path:a.path}),!1))}catch(c){let a=c instanceof Error?c.message:String(c),b=c.code;if(a?.includes("not a git repository")||128===b)return[];throw c}}async function q(a){let b=await Promise.allSettled(a.map(async a=>{n.info("repository:scan-start",{repoPath:a});let b=await p(a);return n.info("repository:scan-complete",{repoPath:a,worktreeCount:b.length}),b})),c=[];for(let d=0;d<b.length;d++){let e=b[d];"fulfilled"===e.status?c.push(...e.value):n.error("repository:scan-failed",{repoPath:a[d],error:e.reason instanceof Error?e.reason.message:String(e.reason)})}return c}function r(a,b){if(0===b.length)return{deletedIds:[],upsertedCount:0};let c=[],d=0,e=new Map;for(let a of b){let b=a.repositoryPath||"";e.has(b)||e.set(b,[]),e.get(b).push(a)}let f=new Set([...(0,k.getAllWorktreeIds)(a),...(0,k.getAliasedWorktreeIds)(a)]),g=new Map((0,k.getAllWorktreePathIds)(a).map(a=>[i().resolve(a.path),a.id])),h=new Map,l=new Map;for(let[a,b]of g)h.set(a,new Set([b])),l.set(b,a);for(let b of(0,k.getAllWorktreeAliases)(a)){let a=l.get(b.worktreeId);a&&h.get(a)?.add(b.oldId)}let m=new Set(b.map(a=>i().resolve(a.path)));for(let[b,o]of e){if(!b)continue;let e=(0,k.getWorktreesByRepository)(a,b).filter(a=>!m.has(i().resolve(a.path))).map(a=>a.id);if(e.length>0){let b=(0,k.deleteWorktreesByIds)(a,e);for(let a of(c.push(...e),e)){f.delete(a);let b=l.get(a);void 0!==b&&(g.delete(b),h.delete(b))}n.info("worktree:cleanup",{deletedCount:b.deletedCount})}for(let b of o){let c=i().resolve(b.path),e=g.get(c),m=b.id,n=e??(m&&!f.has(m)?m:function(a,b,c){if(!c||0===c.size)return(0,j.ko)(a,b);let d=new Set(b);for(let a of c)d.delete(a);return(0,j.ko)(a,d)}(c,f,h.get(c)));f.add(n),g.set(c,n),l.set(n,c),(0,k.upsertWorktree)(a,{...b,id:n,name:b.branch??b.name}),d++}}return{deletedIds:c,upsertedCount:d}}function s(a,b){let c=new Set(b.map(a=>a.repositoryPath).filter(a=>!!a)),d=[];for(let b of(0,k.getRepositories)(a)){let e=b.path;if(!e||c.has(e)||function(a){if(!a)return!1;try{return g().existsSync(a)&&g().existsSync(i().join(a,".git"))}catch{return!0}}(e))continue;let f=(0,k.getWorktreesByRepository)(a,e).map(a=>a.id);if(0===f.length)continue;let h=(0,k.deleteWorktreesByIds)(a,f);d.push(...f),n.info("worktree:stale-repo-pruned",{repoPath:e,deletedCount:h.deletedCount})}return d}},85775:(a,b,c)=>{c.d(b,{Tm:()=>p,x4:()=>n,xJ:()=>o});var d=c(34129),e=c(8360),f=c(88807),g=c(72626),h=c(87374),i=c(39687),j=c(36925);let k=(0,g.h)("timer-manager");function l(){return(0,j.v)("__timerManagerState",()=>({timers:new Map,timerWorktrees:new Map,initialized:!1}))}async function m(a){let b=l(),c=(0,f.getDbInstance)();try{let b=(0,d.kx)(c,a);if(!b||"pending"!==b.status)return;let f=e.CLIToolManager.getInstance().getTool(b.cliToolId),g=b.instanceId,j=await f.isRunning(b.worktreeId,g),l=(0,d.kx)(c,a);if(!l||"pending"!==l.status)return;if(!j){k.warn("timer:no-session",{timerId:a,worktreeId:b.worktreeId,instanceId:g}),(0,d.j2)(c,a,h.HR.NO_SESSION);return}(0,d.j2)(c,a,"sending");let m=await (0,i.d)(c,{worktreeId:b.worktreeId,content:b.message,cliToolId:b.cliToolId,instanceId:g});if(!m.ok){let b=`[${m.stage}] ${m.error}`;(0,d.j2)(c,a,"failed",void 0,b),k.error("timer:send-failed",{timerId:a,stage:m.stage,error:m.error});return}(0,d.j2)(c,a,"sent",Date.now()),k.info("timer:sent",{timerId:a,worktreeId:b.worktreeId})}catch(e){let b=e instanceof Error?e.message:String(e);try{(0,d.j2)(c,a,"failed",void 0,b)}catch{}k.error("timer:send-failed",{timerId:a,error:b})}finally{b.timers.delete(a),b.timerWorktrees.delete(a)}}function n(a,b,c){let d=l(),e=setTimeout(()=>{m(a)},c);d.timers.set(a,e),d.timerWorktrees.set(a,b)}function o(a){let b=l(),c=b.timers.get(a);c&&(clearTimeout(c),b.timers.delete(a),b.timerWorktrees.delete(a));let e=(0,f.getDbInstance)();(0,d.Ud)(e,a)}function p(a){let b=l(),c=(0,f.getDbInstance)();for(let[c,d]of b.timerWorktrees)if(d===a){let a=b.timers.get(c);a&&clearTimeout(a),b.timers.delete(c),b.timerWorktrees.delete(c)}(0,d.$$)(c,a)}}};
1
+ "use strict";exports.id=5209,exports.ids=[5209],exports.modules={998:(a,b,c)=>{c.d(b,{BF:()=>h,EH:()=>k,_R:()=>j});var d=c(11456),e=c(35524);let f={"session-killed":{state:"disable",poller:"stop"},"instance-removed":{state:"delete",poller:"stop"},"worktree-deleted":{state:"delete",poller:"stop"},"orphan-swept":{state:"delete",poller:"stop"},"consecutive-errors":{state:"disable",stopReason:"consecutive_errors",poller:"stop"},"server-shutdown":{state:"none",poller:"stop"}},g={"session-killed":"session-killed","instance-removed":"instance-removed","worktree-deleted":"worktree-deleted","orphan-swept":"orphan-swept","consecutive-errors":"consecutive-errors","server-shutdown":"shutdown"};function h(a,b){"stop"===f[a].poller&&(0,d.z)(g[a],()=>(function(a){switch(a.scope){case"instance":(0,e._i)((0,e.v7)(a.worktreeId,a.cliToolId,a.instanceId));return;case"worktree":(0,e._C)(a.worktreeId);return;case"key":(0,e._i)(a.compositeKey);return;case"all":(0,e.BS)();return}})(b))}function i(a,b){let c=(0,e.pL)(a);c&&(0,e.XK)((0,e.Ue)(a),c,b,(0,e.GE)(a)??void 0)}function j(a,b){let c=f[a];if("none"!==c.state)switch(b.scope){case"instance":"disable"===c.state?(0,e.XK)(b.worktreeId,b.cliToolId,c.stopReason,b.instanceId):(0,e.DR)((0,e.v7)(b.worktreeId,b.cliToolId,b.instanceId));return;case"worktree":"disable"===c.state?(0,e.kC)(b.worktreeId).forEach(a=>i(a,c.stopReason)):(0,e.LP)(b.worktreeId);return;case"key":"disable"===c.state?i(b.compositeKey,c.stopReason):(0,e.DR)(b.compositeKey);return;case"all":(0,e.hN)().forEach(a=>"disable"===c.state?i(a,c.stopReason):(0,e.DR)(a));return}}function k(a,b){h(a,b),j(a,b)}},23197:(a,b,c)=>{c.d(b,{H:()=>d});let d="__global__"},65209:(a,b,c)=>{c.d(b,{Nz:()=>v,l7:()=>z,vr:()=>x});var d=c(95220),e=c(998),f=c(56793),g=c(85775),h=c(93997),i=c(15194),j=c(23197),k=c(77093),l=c(72626),m=c(8360),n=c(79892),o=c(82325),p=c(73753),q=c(31347),r=c(72389);let s=(0,l.h)("session-cleanup");function t(a,b,c){let d=c;if(void 0===d)try{d=m.CLIToolManager.getInstance().getTool(b).getSessionName(a)}catch{d=void 0}(0,r.E8)({version:r.lf,at:Date.now(),api:"session-cleanup",origin:"server",worktreeId:a,instanceId:b,sessionNames:d?[d]:[],callerCwd:null,callerSession:null})}async function u(a,b){let c={worktreeId:a,sessionsKilled:[],sessionErrors:[],pollersStopped:[],pollerErrors:[]};for(let e of((0,h.pc)(),i.XH)){try{await b(a,e)&&(c.sessionsKilled.push(e),s.info("session:killed",{worktreeId:a,cliToolId:e}),t(a,e))}catch(d){let b=`${e}: ${(0,k.u1)(d)}`;c.sessionErrors.push(b),s.warn("session:kill-failed",{worktreeId:a,cliToolId:e,error:d instanceof Error?d.message:String(d)})}try{(0,d.stopPolling)(a,e),c.pollersStopped.push(`response-poller:${e}`)}catch(d){let b=`response-poller:${e}: ${(0,k.u1)(d)}`;c.pollerErrors.push(b),s.warn("response-poller:stop-failed",{worktreeId:a,cliToolId:e,error:d instanceof Error?d.message:String(d)})}}try{(0,e.BF)("worktree-deleted",{scope:"worktree",worktreeId:a}),c.pollersStopped.push("auto-yes-poller")}catch(d){let b=`auto-yes-poller: ${(0,k.u1)(d)}`;c.pollerErrors.push(b),s.warn("auto-yes-poller:stop-failed",{worktreeId:a,error:d instanceof Error?d.message:String(d)})}try{(0,e._R)("worktree-deleted",{scope:"worktree",worktreeId:a}),c.pollersStopped.push("auto-yes-state")}catch(d){let b=`auto-yes-state: ${(0,k.u1)(d)}`;c.pollerErrors.push(b),s.warn("auto-yes-state:delete-failed",{worktreeId:a,error:d instanceof Error?d.message:String(d)})}try{(0,f.Yg)(a),c.pollersStopped.push("schedule-manager")}catch(d){let b=`schedule-manager: ${(0,k.u1)(d)}`;c.pollerErrors.push(b),s.warn("schedule-manager:stop-failed",{worktreeId:a,error:d instanceof Error?d.message:String(d)})}try{(0,g.Tm)(a),c.pollersStopped.push("timer-manager")}catch(d){let b=`timer-manager: ${(0,k.u1)(d)}`;c.pollerErrors.push(b),s.warn("timer-manager:stop-failed",{worktreeId:a,error:d instanceof Error?d.message:String(d)})}return c}async function v(a,b){let c=await Promise.allSettled(a.map(a=>u(a,b))),d=[],e=[];for(let b=0;b<c.length;b++){let f=c[b],g=a[b];if("fulfilled"===f.status){let a=f.value;for(let b of(d.push(a),a.sessionErrors))e.push(`Session kill error (${g}): ${b}`);for(let b of a.pollerErrors)e.push(`Poller stop error (${g}): ${b}`)}else e.push(`Cleanup failed (${g}): ${(0,k.u1)(f.reason)}`)}return{results:d,warnings:e}}async function w(a,b,c){try{let e=m.CLIToolManager.getInstance().getTool(b);if(!await e.isRunning(a))return!1;let f=e.getSessionName(a),g=await (0,q.s_)(f,c);if("owned"!==g.verdict)return!1;let h=`${a}:${b}`;return(0,d.clearPromptHashCache)(h),(0,n.fY)(f)}catch{return!1}}function x(a){return async(b,c)=>{let d=a.get(b);return void 0!==d&&w(b,c,d)}}async function y(){let a=0,b=m.CLIToolManager.getInstance();for(let c of i.XH)try{let d=b.getTool(c).getSessionName(j.H);await (0,n.N)(d)&&await (0,n.fY)(d)&&(a++,s.info("global-session:killed",{cliToolId:c,sessionName:d}),t(j.H,c,d))}catch(a){s.warn("global-session:kill-failed",{cliToolId:c,error:(0,k.u1)(a)})}return a}async function z(a,b){let c=new Map((0,p.Sj)(a).map(a=>[a.id,a.path])),d=(0,o.L0)(a,b);try{await y()}catch(a){s.warn("sync:global-cleanup-failed",{error:(0,k.u1)(a)})}let e=[];if(d.deletedIds.length>0)try{let a=await v(d.deletedIds,x(c));a.warnings.length>0&&(s.warn("sync:cleanup-warnings",{warnings:a.warnings}),e=[`${a.warnings.length} session cleanup warning(s) occurred`])}catch(a){s.error("sync:cleanup-failed",{error:(0,k.u1)(a)}),e=["Session cleanup encountered an error"]}return{syncResult:d,cleanupWarnings:e}}},72389:(a,b,c)=>{c.d(b,{E8:()=>n,_L:()=>g,lf:()=>h,pz:()=>p});var d=c(29021),e=c(21820),f=c(33873);let g="session-kills",h=1,i=/^(\d{4}-\d{2}-\d{2})\.jsonl$/,j=["kill-session","session-cleanup"],k=["cli","browser","http","server"];function l(a=process.env){let b=a.CM_SESSION_KILL_LEDGER_ROOT;return b&&""!==b.trim()?b:(0,f.join)((0,e.homedir)(),".commandmate",g)}function m(a){return new Date(a).toISOString().slice(0,10)}function n(a,b=l()){try{return(0,d.mkdirSync)(b,{recursive:!0,mode:448}),(0,d.appendFileSync)((0,f.join)(b,`${m(a.at)}.jsonl`),`${JSON.stringify(a)}
2
+ `,{encoding:"utf8",mode:384}),!function(a,b){let c,e=m(b-2592e6);try{c=(0,d.readdirSync)(a)}catch{return}for(let b of c){let c=i.exec(b)?.[1];if(void 0!==c&&!(c>=e))try{(0,d.rmSync)((0,f.join)(a,b),{force:!0})}catch{}}}(b,a.at),!0}catch{return!1}}function o(a){return null===a||"string"==typeof a}function p(a,b,c=l()){if(!(a<=b))return[];a=Math.max(a,b-2592e6-864e5);let e=[];for(let i=Date.parse(`${m(a)}T00:00:00.000Z`);i<=b;i+=864e5){let l;try{l=(0,d.readFileSync)((0,f.join)(c,`${m(i)}.jsonl`),"utf8")}catch{continue}for(let c of l.split("\n")){let d;if(""!==c.trim()){var g;try{d=JSON.parse(c)}catch{continue}"object"==typeof(g=d)&&null!==g&&g.version===h&&"number"==typeof g.at&&"string"==typeof g.api&&j.includes(g.api)&&"string"==typeof g.origin&&k.includes(g.origin)&&"string"==typeof g.worktreeId&&""!==g.worktreeId&&o(g.instanceId)&&Array.isArray(g.sessionNames)&&g.sessionNames.every(a=>"string"==typeof a)&&o(g.callerCwd)&&o(g.callerSession)&&d.at>=a&&d.at<=b&&e.push(d)}}}return e}},82325:(a,b,c)=>{c.d(b,{Hz:()=>o,L0:()=>r,Mg:()=>s,YM:()=>p,Yp:()=>q});var d=c(79646),e=c(28354),f=c(29021),g=c.n(f),h=c(33873),i=c.n(h),j=c(23718),k=c(56791),l=c(72626),m=c(64185);let n=(0,l.h)("worktrees");function o(){let a=process.env.WORKTREE_REPOS;return a&&a.trim()?a.split(",").map(a=>a.trim()).filter(a=>a.length>0):[]}async function p(a){let b=(0,e.promisify)(d.exec);if(function(a){if(!a)return!1;try{return g().lstatSync(a),!1}catch(b){let a=b.code;return"ENOENT"===a||"ENOTDIR"===a}}(a))return n.warn("repository:scan-skipped-missing-dir",{repoPath:a}),[];try{let{stdout:c}=await b("git worktree list",{cwd:a}),d=function(a){if(!a||""===a.trim())return[];let b=a.trim().split("\n"),c=[];for(let a of b){let b=a.trim();if(!b)continue;let d=b.match(/^(.+?)\s+([a-z0-9]+)\s+(?:\[(.+?)\]|\(detached HEAD\))/);if(d){let[,a,b,e]=d;c.push({path:a.trim(),branch:e||`detached-${b}`,commit:b})}}return c}(c),e=i().resolve(a),f=i().basename(e);return(0,m.oZ)(e),d.map(a=>{let b=i().resolve(a.path);return{id:(0,j.ko)(b),name:a.branch,branch:a.branch,path:b,repositoryPath:e,repositoryName:f}}).filter(a=>["/etc","/root","/sys","/proc","/dev","/boot","/bin","/sbin","/usr/bin","/usr/sbin"].some(b=>a.path.startsWith(b))?(n.warn("worktree:unsafe-path-skipped",{path:a.path}),!1):!(a.path.includes("\0")||a.path.includes(".."))||(n.warn("worktree:malicious-path-skipped",{path:a.path}),!1))}catch(c){let a=c instanceof Error?c.message:String(c),b=c.code;if(a?.includes("not a git repository")||128===b)return[];throw c}}async function q(a){let b=await Promise.allSettled(a.map(async a=>{n.info("repository:scan-start",{repoPath:a});let b=await p(a);return n.info("repository:scan-complete",{repoPath:a,worktreeCount:b.length}),b})),c=[];for(let d=0;d<b.length;d++){let e=b[d];"fulfilled"===e.status?c.push(...e.value):n.error("repository:scan-failed",{repoPath:a[d],error:e.reason instanceof Error?e.reason.message:String(e.reason)})}return c}function r(a,b){if(0===b.length)return{deletedIds:[],upsertedCount:0};let c=[],d=0,e=new Map;for(let a of b){let b=a.repositoryPath||"";e.has(b)||e.set(b,[]),e.get(b).push(a)}let f=new Set([...(0,k.getAllWorktreeIds)(a),...(0,k.getAliasedWorktreeIds)(a)]),g=new Map((0,k.getAllWorktreePathIds)(a).map(a=>[i().resolve(a.path),a.id])),h=new Map,l=new Map;for(let[a,b]of g)h.set(a,new Set([b])),l.set(b,a);for(let b of(0,k.getAllWorktreeAliases)(a)){let a=l.get(b.worktreeId);a&&h.get(a)?.add(b.oldId)}let m=new Set(b.map(a=>i().resolve(a.path)));for(let[b,o]of e){if(!b)continue;let e=(0,k.getWorktreesByRepository)(a,b).filter(a=>!m.has(i().resolve(a.path))).map(a=>a.id);if(e.length>0){let b=(0,k.deleteWorktreesByIds)(a,e);for(let a of(c.push(...e),e)){f.delete(a);let b=l.get(a);void 0!==b&&(g.delete(b),h.delete(b))}n.info("worktree:cleanup",{deletedCount:b.deletedCount})}for(let b of o){let c=i().resolve(b.path),e=g.get(c),m=b.id,n=e??(m&&!f.has(m)?m:function(a,b,c){if(!c||0===c.size)return(0,j.ko)(a,b);let d=new Set(b);for(let a of c)d.delete(a);return(0,j.ko)(a,d)}(c,f,h.get(c)));f.add(n),g.set(c,n),l.set(n,c),(0,k.upsertWorktree)(a,{...b,id:n,name:b.branch??b.name}),d++}}return{deletedIds:c,upsertedCount:d}}function s(a,b){let c=new Set(b.map(a=>a.repositoryPath).filter(a=>!!a)),d=[];for(let b of(0,k.getRepositories)(a)){let e=b.path;if(!e||c.has(e)||function(a){if(!a)return!1;try{return g().existsSync(a)&&g().existsSync(i().join(a,".git"))}catch{return!0}}(e))continue;let f=(0,k.getWorktreesByRepository)(a,e).map(a=>a.id);if(0===f.length)continue;let h=(0,k.deleteWorktreesByIds)(a,f);d.push(...f),n.info("worktree:stale-repo-pruned",{repoPath:e,deletedCount:h.deletedCount})}return d}},85775:(a,b,c)=>{c.d(b,{Tm:()=>p,x4:()=>n,xJ:()=>o});var d=c(34129),e=c(8360),f=c(88807),g=c(72626),h=c(87374),i=c(39687),j=c(36925);let k=(0,g.h)("timer-manager");function l(){return(0,j.v)("__timerManagerState",()=>({timers:new Map,timerWorktrees:new Map,initialized:!1}))}async function m(a){let b=l(),c=(0,f.getDbInstance)();try{let b=(0,d.kx)(c,a);if(!b||"pending"!==b.status)return;let f=e.CLIToolManager.getInstance().getTool(b.cliToolId),g=b.instanceId,j=await f.isRunning(b.worktreeId,g),l=(0,d.kx)(c,a);if(!l||"pending"!==l.status)return;if(!j){k.warn("timer:no-session",{timerId:a,worktreeId:b.worktreeId,instanceId:g}),(0,d.j2)(c,a,h.HR.NO_SESSION);return}(0,d.j2)(c,a,"sending");let m=await (0,i.d)(c,{worktreeId:b.worktreeId,content:b.message,cliToolId:b.cliToolId,instanceId:g});if(!m.ok){let b=`[${m.stage}] ${m.error}`;(0,d.j2)(c,a,"failed",void 0,b),k.error("timer:send-failed",{timerId:a,stage:m.stage,error:m.error});return}(0,d.j2)(c,a,"sent",Date.now()),k.info("timer:sent",{timerId:a,worktreeId:b.worktreeId})}catch(e){let b=e instanceof Error?e.message:String(e);try{(0,d.j2)(c,a,"failed",void 0,b)}catch{}k.error("timer:send-failed",{timerId:a,error:b})}finally{b.timers.delete(a),b.timerWorktrees.delete(a)}}function n(a,b,c){let d=l(),e=setTimeout(()=>{m(a)},c);d.timers.set(a,e),d.timerWorktrees.set(a,b)}function o(a){let b=l(),c=b.timers.get(a);c&&(clearTimeout(c),b.timers.delete(a),b.timerWorktrees.delete(a));let e=(0,f.getDbInstance)();(0,d.Ud)(e,a)}function p(a){let b=l(),c=(0,f.getDbInstance)();for(let[c,d]of b.timerWorktrees)if(d===a){let a=b.timers.get(c);a&&clearTimeout(a),b.timers.delete(c),b.timerWorktrees.delete(c)}(0,d.$$)(c,a)}}};
@@ -1 +1 @@
1
- "use strict";exports.id=5354,exports.ids=[5354],exports.modules={3421:(a,b,c)=>{Object.defineProperty(b,"I",{enumerable:!0,get:function(){return g}});let d=c(71237),e=c(55088),f=c(17679);async function g(a,b,c,g){if((0,d.isNodeNextResponse)(b)){var h;b.statusCode=c.status,b.statusMessage=c.statusText;let d=["set-cookie","www-authenticate","proxy-authenticate","vary"];null==(h=c.headers)||h.forEach((a,c)=>{if("x-middleware-set-cookie"!==c.toLowerCase())if("set-cookie"===c.toLowerCase())for(let d of(0,f.splitCookiesString)(a))b.appendHeader(c,d);else{let e=void 0!==b.getHeader(c);(d.includes(c.toLowerCase())||!e)&&b.appendHeader(c,a)}});let{originalResponse:i}=b;c.body&&"HEAD"!==a.method?await (0,e.pipeToNodeResponse)(c.body,i,g):i.end()}}},27289:(a,b,c)=>{c.d(b,{t:()=>j,z:()=>i});var d=c(10641),e=c(88807),f=c(56791),g=c(95506),h=c(66007);function i(a){if(!a)return a;try{if(!(0,h.h6)(a))return a;let b=(0,e.getDbInstance)();return(0,g.l0)(b,a)??a}catch{return a}}function j(a){if(!(0,h.h6)(a))return d.NextResponse.json({error:"Invalid worktree ID format"},{status:400});let b=(0,e.getDbInstance)(),c=(0,f.getWorktreeById)(b,i(a));return c||d.NextResponse.json({error:"Worktree not found"},{status:404})}},56791:(a,b,c)=>{c.r(b),c.d(b,{ACTIVE_FILTER:()=>d.ks,ACTIVE_TASK_STATUSES:()=>d.EL,AgentInstanceLimitError:()=>d.AC,CURRENT_SCHEMA_VERSION:()=>f.FT,DEFAULT_RUN_HISTORY_LIMIT:()=>d.Tu,InvalidAgentInstanceError:()=>d.ug,MAX_DISABLED_REPOSITORIES:()=>h.nc,MAX_RUN_HISTORY_DAYS:()=>d.eP,MAX_RUN_HISTORY_LIMIT:()=>d.mg,MemoDbError:()=>d.lm,NEW_SUBSCRIPTION_DEFAULTS:()=>d.s6,PUSH_DEFAULTS_VERSION:()=>d.VP,RepositoryDbError:()=>h.j8,TASK_STATUSES:()=>d.Hi,TERMINAL_TASK_STATUSES:()=>d.sA,VERIFICATION_GATE_SOURCES:()=>d.Dx,VERIFICATION_TRIGGERS:()=>d.af,WORKTREE_TODO_STATUSES:()=>d.KG,addAgentInstance:()=>d.Uq,cancelTimer:()=>d.Ud,cancelTimersByWorktree:()=>d.$$,cleanupOldTimers:()=>d.ul,clearInProgressMessageId:()=>d.YX,clearLastUserMessage:()=>d.cf,clearTimerHistory:()=>d.jf,closeDbInstance:()=>e.closeDbInstance,countAgentInstances:()=>d.fs,countDisabledRepositories:()=>h.QJ,countPushSubscriptionsForKind:()=>d.rC,countWorktreesByRepositoryPath:()=>h.kp,createCloneJob:()=>h.tw,createGateResult:()=>d.hl,createMemo:()=>d.To,createMessage:()=>d.oH,createRepository:()=>h.vB,createTask:()=>d.UT,createTimer:()=>d.CR,createVerificationRun:()=>d.rY,createWorktreeTodo:()=>d.yy,deleteAllMessages:()=>d.pE,deleteMemo:()=>d.cP,deleteMessageById:()=>d.DF,deleteMessagesByCliTool:()=>d.lA,deleteMessagesByInstance:()=>d.Qp,deletePushSubscriptionByEndpoint:()=>d.th,deleteRepository:()=>h.oG,deleteRepositoryWorktrees:()=>d.oZ,deleteSessionState:()=>d.ZP,deleteWorktreeTodo:()=>d.vg,deleteWorktreesByIds:()=>d.Rm,disableExistingRepository:()=>h.eP,disableRepository:()=>h.l$,ensureEnvRepositoriesRegistered:()=>h.ES,filterExcludedPaths:()=>h.Ho,findMessageByRequestId:()=>d.Ow,finishGateResult:()=>d.C8,finishVerificationRun:()=>d.u$,getActiveCloneJobByUrl:()=>h.fD,getActiveTask:()=>d.__,getActiveTaskForInstance:()=>d.MH,getAgentInstance:()=>d.BN,getAgentInstances:()=>d.m0,getAliasedWorktreeIds:()=>d.r3,getAllPushSubscriptions:()=>d.Se,getAllRepositories:()=>h.Yg,getAllRepositoriesWithWorktreeCount:()=>h._D,getAllWorktreeAliases:()=>d.fX,getAllWorktreeIds:()=>d.nO,getAllWorktreePathIds:()=>d.Sj,getCloneJob:()=>h.bM,getCloneJobsByStatus:()=>h.n_,getCurrentVersion:()=>f.Mj,getDailyReport:()=>d.ap,getDbInstance:()=>e.getDbInstance,getDefaultDbPath:()=>g.$b,getExcludedRepositories:()=>h.lS,getExcludedRepositoryPaths:()=>h.pr,getInitialBranch:()=>d.p4,getIssueDbPath:()=>g.zm,getLastAssistantMessageAt:()=>d.nP,getLastMessage:()=>d.sy,getLastUserMessage:()=>d.r8,getLegacyDbPaths:()=>q,getMemoById:()=>d.DN,getMemosByWorktreeId:()=>d.pZ,getMessageById:()=>d.kA,getMessages:()=>d.VL,getMessagesByDateRange:()=>d.lr,getMigrationHistory:()=>f.PS,getPendingTimerCountByWorktree:()=>d.GF,getPendingTimers:()=>d._O,getPushSubscriptionByEndpoint:()=>d.CF,getPushSubscriptionsForKind:()=>d.gn,getRepositories:()=>d.NV,getRepositoryById:()=>h.r,getRepositoryByNormalizedUrl:()=>h.Uj,getRepositoryByPath:()=>h.Dp,getRunningVerificationRun:()=>d.WZ,getSessionState:()=>d.y1,getTask:()=>d.gg,getTimerById:()=>d.kx,getTimersByWorktree:()=>d.DP,getTodosByWorktreeId:()=>d.fr,getVerificationRun:()=>d.J6,getWorktreeAliases:()=>d.Q2,getWorktreeById:()=>d.Ui,getWorktreeIdsByRepository:()=>d.P9,getWorktreeTodoById:()=>d.eN,getWorktrees:()=>d.vi,getWorktreesByRepository:()=>d.uJ,initDatabase:()=>d.s4,isTerminalTaskStatus:()=>d.uB,isWorktreeTodoStatus:()=>d.yT,listRunningVerificationRuns:()=>d.Fi,listTaskEvents:()=>d.HB,listTasks:()=>d.Vk,listVerificationRuns:()=>d.Mt,listVerificationRunsForPeriod:()=>d.UE,markPendingPromptsAsAnswered:()=>d.PL,migrateDbIfNeeded:()=>r,migrateWorktreeIdPreservingChildren:()=>d._h,pushSubscriptionNeedsDefaultsNotice:()=>d.Zj,recomputeLastUserMessage:()=>d.jp,recordAnsweredPrompt:()=>d.pG,recordWorktreeAlias:()=>d.xJ,recoverStuckSendingTimers:()=>d.Xm,registerAndFilterRepositories:()=>h.$G,removeAgentInstance:()=>d.NU,reorderMemos:()=>d.nQ,reorderWorktreeTodos:()=>d.yb,resolveAndValidatePath:()=>p,resolveRepositoryPath:()=>h.mE,resolveWorktreeIdWithAlias:()=>d.l0,restoreRepository:()=>h.RS,rollbackMigrations:()=>f.Wy,runMigrations:()=>f.vI,saveDailyReport:()=>d.tt,saveInitialBranch:()=>d.GA,setAgentInstances:()=>d.Cs,setInProgressMessageId:()=>d.OF,setRepositoryEnabled:()=>h.iQ,updateCliToolId:()=>d.WU,updateCloneJob:()=>h.k5,updateDailyReportContent:()=>d.IF,updateFavorite:()=>d.O,updateLastUserMessage:()=>d.EU,updateLastViewedAt:()=>d.HZ,updateMemo:()=>d.UY,updateMessageContent:()=>d.e8,updatePromptData:()=>d.cw,updatePushSubscriptionPreferences:()=>d.jJ,updateRepository:()=>h.Ir,updateSelectedAgents:()=>d.DC,updateSessionState:()=>d.PP,updateStatus:()=>d.yB,updateTimerStatus:()=>d.j2,updateVibeLocalContextWindow:()=>d.s,updateVibeLocalModel:()=>d.iu,updateWorktreeDescription:()=>d.hq,updateWorktreeLink:()=>d.z1,updateWorktreeTodo:()=>d.bl,upsertPushSubscription:()=>d.jA,upsertWorktree:()=>d.ZL,validateDbPath:()=>g.Sv,validateRepositoryPath:()=>h.Ux,validateSchema:()=>f.i6});var d=c(683),e=c(88807),f=c(67469),g=c(20416),h=c(10406),i=c(29021),j=c.n(i),k=c(33873),l=c.n(k),m=c(21820),n=c(7956);let o=(0,c(72626).h)("db-migration-path");function p(a,b){try{if(!j().existsSync(a))return null;let c=j().realpathSync(a);if((0,n.fW)(c))return o.warn(`[Security] ${b} points to system directory, skipping: ${c}`),null;return c}catch{return o.warn(`[Security] Failed to resolve ${b}: ${a}`),null}}function q(){let a=[];a.push(l().join(process.cwd(),"data","db.sqlite")),a.push(l().join(process.cwd(),"data","cm.db")),a.push(l().join((0,m.homedir)(),".commandmate","data","db.sqlite"));let b=process.env.DATABASE_PATH;if(b)try{let c=l().resolve(b);(0,n.fW)(c)?o.warn(`[Security] Skipping DATABASE_PATH in system directory: ${c}`):a.push(b)}catch{o.warn(`[Security] Invalid DATABASE_PATH: ${b}`)}return a}function r(a){let b=l().resolve(a);if((0,n.fW)(b))throw Error(`Security error: Target path cannot be in system directory: ${b}`);if(j().existsSync(a)){let b=p(a,"target path");if(b)return{migrated:!1,targetPath:b}}for(let a of q()){let c=p(a,"legacy path");if(!c)continue;let d=`${c}.bak`;j().copyFileSync(c,d),j().chmodSync(d,384);let e=l().dirname(b);return j().existsSync(e)||j().mkdirSync(e,{recursive:!0,mode:448}),j().copyFileSync(c,b),o.info(`[Migration] Database migrated from ${c} to ${b}`),o.info(`[Migration] Backup created at ${d}`),{migrated:!0,sourcePath:c,targetPath:b,backupPath:d}}return{migrated:!1,targetPath:b}}},93813:(a,b,c)=>{c.d(b,{B1:()=>m,Bx:()=>i,Nc:()=>h,b1:()=>g,ef:()=>n,gZ:()=>k,lp:()=>l});var d=c(79748),e=c(33873);let f=[".git",".env",".env.*","node_modules",".DS_Store","Thumbs.db","*.pem","*.key",".env.local",".env.development",".env.production",".env.test"],g={MAX_ITEMS_PER_DIR:500,MAX_DEPTH:10,MAX_FILE_SIZE_PREVIEW:1048576};function h(a,b){if(b===a)return!0;if(b.startsWith("*.")){let c=b.slice(1);if(a.endsWith(c))return!0}if(b.endsWith(".*")){let c=b.slice(0,-2);if(a.startsWith(c+"."))return!0}return!1}function i(a){return f.some(b=>h(a,b))}async function j(a){try{return(await (0,d.readdir)(a)).filter(a=>!i(a)).length}catch{return 0}}async function k(a,b=""){let c,f=b?(0,e.join)(a,b):a;try{c=await (0,d.stat)(f)}catch{throw Error(`Directory not found: ${b||"(root)"}`)}if(!c.isDirectory())throw Error(`Path is not a directory: ${b}`);let h=await (0,d.readdir)(f),l=[];for(let a of h){if(i(a))continue;let b=(0,e.join)(f,a);try{let c=await (0,d.lstat)(b);if(c.isSymbolicLink())continue;if(c.isDirectory()){let c=await j(b);l.push({name:a,type:"directory",itemCount:c})}else if(c.isFile()){let b=(0,e.extname)(a),d={name:a,type:"file",size:c.size,birthtime:c.birthtime.toISOString(),mtime:c.mtime.toISOString()};b&&b.length>1&&(d.extension=b.slice(1)),l.push(d)}}catch{continue}if(l.length>=g.MAX_ITEMS_PER_DIR)break}let m=[...l].sort((a,b)=>a.type!==b.type?"directory"===a.type?-1:1:a.name.toLowerCase().localeCompare(b.name.toLowerCase())),n=null;if(b){let a=(0,e.dirname)(b);n="."===a?"":a}return{path:b,name:b?(0,e.basename)(b):"",items:m,parentPath:n}}function l(a){let b=a instanceof Error?a.message:"Unknown error";return b.includes("not found")?{error:"Directory not found",status:404}:b.includes("not a directory")?{error:"Path is not a directory",status:400}:{error:"Failed to read directory",status:500}}function m(a){return{error:`Worktree '${a}' not found`,status:404}}function n(a="Invalid path"){return{error:`Access denied: ${a}`,status:403}}},95736:(a,b,c)=>{a.exports=c(44870)}};
1
+ "use strict";exports.id=5354,exports.ids=[5354],exports.modules={3421:(a,b,c)=>{Object.defineProperty(b,"I",{enumerable:!0,get:function(){return g}});let d=c(71237),e=c(55088),f=c(17679);async function g(a,b,c,g){if((0,d.isNodeNextResponse)(b)){var h;b.statusCode=c.status,b.statusMessage=c.statusText;let d=["set-cookie","www-authenticate","proxy-authenticate","vary"];null==(h=c.headers)||h.forEach((a,c)=>{if("x-middleware-set-cookie"!==c.toLowerCase())if("set-cookie"===c.toLowerCase())for(let d of(0,f.splitCookiesString)(a))b.appendHeader(c,d);else{let e=void 0!==b.getHeader(c);(d.includes(c.toLowerCase())||!e)&&b.appendHeader(c,a)}});let{originalResponse:i}=b;c.body&&"HEAD"!==a.method?await (0,e.pipeToNodeResponse)(c.body,i,g):i.end()}}},27289:(a,b,c)=>{c.d(b,{t:()=>j,z:()=>i});var d=c(10641),e=c(88807),f=c(56791),g=c(95506),h=c(66007);function i(a){if(!a)return a;try{if(!(0,h.h6)(a))return a;let b=(0,e.getDbInstance)();return(0,g.l0)(b,a)??a}catch{return a}}function j(a){if(!(0,h.h6)(a))return d.NextResponse.json({error:"Invalid worktree ID format"},{status:400});let b=(0,e.getDbInstance)(),c=(0,f.getWorktreeById)(b,i(a));return c||d.NextResponse.json({error:"Worktree not found"},{status:404})}},56791:(a,b,c)=>{c.r(b),c.d(b,{ACTIVE_FILTER:()=>d.ks,ACTIVE_TASK_STATUSES:()=>d.EL,AgentInstanceLimitError:()=>d.AC,CURRENT_SCHEMA_VERSION:()=>f.FT,DEFAULT_RUN_HISTORY_LIMIT:()=>d.Tu,InvalidAgentInstanceError:()=>d.ug,MAX_DISABLED_REPOSITORIES:()=>h.nc,MAX_RUN_HISTORY_DAYS:()=>d.eP,MAX_RUN_HISTORY_LIMIT:()=>d.mg,MemoDbError:()=>d.lm,NEW_SUBSCRIPTION_DEFAULTS:()=>d.s6,PUSH_DEFAULTS_VERSION:()=>d.VP,RepositoryDbError:()=>h.j8,TASK_STATUSES:()=>d.Hi,TERMINAL_TASK_STATUSES:()=>d.sA,VERIFICATION_GATE_SOURCES:()=>d.Dx,VERIFICATION_TRIGGERS:()=>d.af,WORKTREE_TODO_STATUSES:()=>d.KG,addAgentInstance:()=>d.Uq,cancelTimer:()=>d.Ud,cancelTimersByWorktree:()=>d.$$,cleanupOldTimers:()=>d.ul,clearInProgressMessageId:()=>d.YX,clearLastUserMessage:()=>d.cf,clearTimerHistory:()=>d.jf,closeDbInstance:()=>e.closeDbInstance,countAgentInstances:()=>d.fs,countDisabledRepositories:()=>h.QJ,countPushSubscriptionsForKind:()=>d.rC,countWorktreesByRepositoryPath:()=>h.kp,createCloneJob:()=>h.tw,createGateResult:()=>d.hl,createMemo:()=>d.To,createMessage:()=>d.oH,createRepository:()=>h.vB,createTask:()=>d.UT,createTimer:()=>d.CR,createVerificationRun:()=>d.rY,createWorktreeTodo:()=>d.yy,deleteAllMessages:()=>d.pE,deleteMemo:()=>d.cP,deleteMessageById:()=>d.DF,deleteMessagesByCliTool:()=>d.lA,deleteMessagesByInstance:()=>d.Qp,deletePushSubscriptionByEndpoint:()=>d.th,deleteRepository:()=>h.oG,deleteRepositoryWorktrees:()=>d.oZ,deleteSessionState:()=>d.ZP,deleteWorktreeTodo:()=>d.vg,deleteWorktreesByIds:()=>d.Rm,disableExistingRepository:()=>h.eP,disableRepository:()=>h.l$,ensureEnvRepositoriesRegistered:()=>h.ES,filterExcludedPaths:()=>h.Ho,findMessageByRequestId:()=>d.Ow,finishGateResult:()=>d.C8,finishVerificationRun:()=>d.u$,getActiveCloneJobByUrl:()=>h.fD,getActiveTask:()=>d.__,getActiveTaskForInstance:()=>d.MH,getAgentInstance:()=>d.BN,getAgentInstances:()=>d.m0,getAliasedWorktreeIds:()=>d.r3,getAllPushSubscriptions:()=>d.Se,getAllRepositories:()=>h.Yg,getAllRepositoriesWithWorktreeCount:()=>h._D,getAllWorktreeAliases:()=>d.fX,getAllWorktreeIds:()=>d.nO,getAllWorktreePathIds:()=>d.Sj,getCloneJob:()=>h.bM,getCloneJobsByStatus:()=>h.n_,getCurrentVersion:()=>f.Mj,getDailyReport:()=>d.ap,getDbInstance:()=>e.getDbInstance,getDefaultDbPath:()=>g.$b,getExcludedRepositories:()=>h.lS,getExcludedRepositoryPaths:()=>h.pr,getInitialBranch:()=>d.p4,getIssueDbPath:()=>g.zm,getLastAssistantMessageAt:()=>d.nP,getLastMessage:()=>d.sy,getLastUserMessage:()=>d.r8,getLegacyDbPaths:()=>u,getMemoById:()=>d.DN,getMemosByWorktreeId:()=>d.pZ,getMessageById:()=>d.kA,getMessages:()=>d.VL,getMessagesByDateRange:()=>d.lr,getMigrationHistory:()=>f.PS,getPendingTimerCountByWorktree:()=>d.GF,getPendingTimers:()=>d._O,getPushSubscriptionByEndpoint:()=>d.CF,getPushSubscriptionsForKind:()=>d.gn,getRepositories:()=>d.NV,getRepositoryById:()=>h.r,getRepositoryByNormalizedUrl:()=>h.Uj,getRepositoryByPath:()=>h.Dp,getRunningVerificationRun:()=>d.WZ,getSessionState:()=>d.y1,getTask:()=>d.gg,getTimerById:()=>d.kx,getTimersByWorktree:()=>d.DP,getTodosByWorktreeId:()=>d.fr,getVerificationRun:()=>d.J6,getWorktreeAliases:()=>d.Q2,getWorktreeById:()=>d.Ui,getWorktreeIdsByRepository:()=>d.P9,getWorktreeTodoById:()=>d.eN,getWorktrees:()=>d.vi,getWorktreesByRepository:()=>d.uJ,initDatabase:()=>d.s4,isTerminalTaskStatus:()=>d.uB,isWorktreeTodoStatus:()=>d.yT,listRunningVerificationRuns:()=>d.Fi,listTaskEvents:()=>d.HB,listTasks:()=>d.Vk,listVerificationRuns:()=>d.Mt,listVerificationRunsForPeriod:()=>d.UE,markPendingPromptsAsAnswered:()=>d.PL,migrateDbIfNeeded:()=>w,migrateWorktreeIdPreservingChildren:()=>d._h,pushSubscriptionNeedsDefaultsNotice:()=>d.Zj,recomputeLastUserMessage:()=>d.jp,recordAnsweredPrompt:()=>d.pG,recordWorktreeAlias:()=>d.xJ,recoverStuckSendingTimers:()=>d.Xm,registerAndFilterRepositories:()=>h.$G,removeAgentInstance:()=>d.NU,reorderMemos:()=>d.nQ,reorderWorktreeTodos:()=>d.yb,resolveAndValidatePath:()=>t,resolveRepositoryPath:()=>h.mE,resolveWorktreeIdWithAlias:()=>d.l0,restoreRepository:()=>h.RS,rollbackMigrations:()=>f.Wy,runMigrations:()=>f.vI,saveDailyReport:()=>d.tt,saveInitialBranch:()=>d.GA,setAgentInstances:()=>d.Cs,setInProgressMessageId:()=>d.OF,setRepositoryEnabled:()=>h.iQ,updateCliToolId:()=>d.WU,updateCloneJob:()=>h.k5,updateDailyReportContent:()=>d.IF,updateFavorite:()=>d.O,updateLastUserMessage:()=>d.EU,updateLastViewedAt:()=>d.HZ,updateMemo:()=>d.UY,updateMessageContent:()=>d.e8,updatePromptData:()=>d.cw,updatePushSubscriptionPreferences:()=>d.jJ,updateRepository:()=>h.Ir,updateSelectedAgents:()=>d.DC,updateSessionState:()=>d.PP,updateStatus:()=>d.yB,updateTimerStatus:()=>d.j2,updateVibeLocalContextWindow:()=>d.s,updateVibeLocalModel:()=>d.iu,updateWorktreeDescription:()=>d.hq,updateWorktreeLink:()=>d.z1,updateWorktreeTodo:()=>d.bl,upsertPushSubscription:()=>d.jA,upsertWorktree:()=>d.ZL,validateDbPath:()=>g.Sv,validateRepositoryPath:()=>h.Ux,validateSchema:()=>f.i6});var d=c(683),e=c(88807),f=c(55741),g=c(20416),h=c(10406),i=c(87550),j=c.n(i),k=c(55511),l=c.n(k),m=c(29021),n=c.n(m),o=c(33873),p=c.n(o),q=c(21820),r=c(7956);let s=(0,c(72626).h)("db-migration-path");function t(a,b){try{if(!n().existsSync(a))return null;let c=n().realpathSync(a);if((0,r.fW)(c))return s.warn(`[Security] ${b} points to system directory, skipping: ${c}`),null;return c}catch{return s.warn(`[Security] Failed to resolve ${b}: ${a}`),null}}function u(){let a=[];a.push(p().join(process.cwd(),"data","db.sqlite")),a.push(p().join(process.cwd(),"data","cm.db")),a.push(p().join((0,q.homedir)(),".commandmate","data","db.sqlite"));let b=process.env.DATABASE_PATH;if(b)try{let c=p().resolve(b);(0,r.fW)(c)?s.warn(`[Security] Skipping DATABASE_PATH in system directory: ${c}`):a.push(b)}catch{s.warn(`[Security] Invalid DATABASE_PATH: ${b}`)}return a}function v(a,b){if(function(a){try{return n().statSync(`${a}-wal`).size>0}catch{return!1}}(a)){let c=`${b}.${l().randomBytes(4).toString("hex")}.partial`;try{n().closeSync(n().openSync(c,"wx",384));let d=new(j())(a,{readonly:!0,fileMustExist:!0});try{d.prepare("VACUUM INTO ?").run(c)}finally{d.close()}n().renameSync(c,b)}catch(a){throw n().rmSync(c,{force:!0}),a}}else n().copyFileSync(a,b)}function w(a){let b=p().resolve(a);if((0,r.fW)(b))throw Error(`Security error: Target path cannot be in system directory: ${b}`);if(n().existsSync(a)){let b=t(a,"target path");if(b)return{migrated:!1,targetPath:b}}for(let a of u()){let c=t(a,"legacy path");if(!c)continue;let d=`${c}.bak`;v(c,d),n().chmodSync(d,384);let e=p().dirname(b);return n().existsSync(e)||n().mkdirSync(e,{recursive:!0,mode:448}),v(c,b),s.info(`[Migration] Database migrated from ${c} to ${b}`),s.info(`[Migration] Backup created at ${d}`),{migrated:!0,sourcePath:c,targetPath:b,backupPath:d}}return{migrated:!1,targetPath:b}}},93813:(a,b,c)=>{c.d(b,{B1:()=>m,Bx:()=>i,Nc:()=>h,b1:()=>g,ef:()=>n,gZ:()=>k,lp:()=>l});var d=c(79748),e=c(33873);let f=[".git",".env",".env.*","node_modules",".DS_Store","Thumbs.db","*.pem","*.key",".env.local",".env.development",".env.production",".env.test"],g={MAX_ITEMS_PER_DIR:500,MAX_DEPTH:10,MAX_FILE_SIZE_PREVIEW:1048576};function h(a,b){if(b===a)return!0;if(b.startsWith("*.")){let c=b.slice(1);if(a.endsWith(c))return!0}if(b.endsWith(".*")){let c=b.slice(0,-2);if(a.startsWith(c+"."))return!0}return!1}function i(a){return f.some(b=>h(a,b))}async function j(a){try{return(await (0,d.readdir)(a)).filter(a=>!i(a)).length}catch{return 0}}async function k(a,b=""){let c,f=b?(0,e.join)(a,b):a;try{c=await (0,d.stat)(f)}catch{throw Error(`Directory not found: ${b||"(root)"}`)}if(!c.isDirectory())throw Error(`Path is not a directory: ${b}`);let h=await (0,d.readdir)(f),l=[];for(let a of h){if(i(a))continue;let b=(0,e.join)(f,a);try{let c=await (0,d.lstat)(b);if(c.isSymbolicLink())continue;if(c.isDirectory()){let c=await j(b);l.push({name:a,type:"directory",itemCount:c})}else if(c.isFile()){let b=(0,e.extname)(a),d={name:a,type:"file",size:c.size,birthtime:c.birthtime.toISOString(),mtime:c.mtime.toISOString()};b&&b.length>1&&(d.extension=b.slice(1)),l.push(d)}}catch{continue}if(l.length>=g.MAX_ITEMS_PER_DIR)break}let m=[...l].sort((a,b)=>a.type!==b.type?"directory"===a.type?-1:1:a.name.toLowerCase().localeCompare(b.name.toLowerCase())),n=null;if(b){let a=(0,e.dirname)(b);n="."===a?"":a}return{path:b,name:b?(0,e.basename)(b):"",items:m,parentPath:n}}function l(a){let b=a instanceof Error?a.message:"Unknown error";return b.includes("not found")?{error:"Directory not found",status:404}:b.includes("not a directory")?{error:"Path is not a directory",status:400}:{error:"Failed to read directory",status:500}}function m(a){return{error:`Worktree '${a}' not found`,status:404}}function n(a="Invalid path"){return{error:`Access denied: ${a}`,status:403}}},95736:(a,b,c)=>{a.exports=c(44870)}};
@@ -1 +1 @@
1
- "use strict";exports.id=9130,exports.ids=[9130],exports.modules={2669:(a,b,c)=>{c.d(b,{JI:()=>n,M7:()=>d,Sr:()=>h,Zf:()=>f,c7:()=>e,lU:()=>k,mR:()=>j,qO:()=>i,su:()=>m,wQ:()=>l});let d="SESSION_STARTING",e="SESSION_START_FAILED",f="SESSION_START_UNAVAILABLE",g=[d,e];class h extends Error{constructor(a,b,c){super(`${a} did not reach its input prompt within ${Math.round(c/1e3)}s (initialization timeout). The tmux session '${b}' and its process are still running, so this is a slow start, not a failed one — the message was not delivered, but nothing needs repairing. Retry the send in a few seconds, or run \`commandmate capture <worktree-id>\` to see what it is waiting on.`),this.toolName=a,this.sessionName=b,this.timeoutMs=c,this.code=d,this.name="SessionStartTimeoutError"}}function i(a,b){return`${a} exited before reaching its input prompt: the tmux session '${b}' is back at a shell, so this is not a slow start and waiting will not help. The message was not delivered. Run \`commandmate capture <worktree-id>\` to see why it exited (for example a startup dialog answered with exit, or a missing login), fix that, then send again.`}class j extends Error{constructor(a,b,c){super(`${a} reported an error while starting in tmux session '${b}': "${c}". Retrying will not help until that is resolved; run \`commandmate capture <worktree-id>\` to see the session output.`),this.toolName=a,this.sessionName=b,this.detectedPattern=c,this.code=e,this.name="SessionStartFailedError"}}class k extends Error{constructor(a,b=`${a} is not installed. Please install it first.`){super(b),this.toolName=a,this.code=f,this.name="SessionStartUnavailableError"}}function l(a){return o(a)===d}function m(a){let b=o(a);return void 0!==b&&g.includes(b)}function n(a){return o(a)===f}function o(a){if("object"!=typeof a||null===a)return;let b=a.code;return"string"==typeof b?b:void 0}},22354:(a,b,c)=>{c.d(b,{F0:()=>j.F,K9:()=>e.K9,VM:()=>d.VM,_0:()=>f._0,c1:()=>k.c,o:()=>i.o,vm:()=>h.v,y_:()=>g.y_});var d=c(70096);c(66101);var e=c(45567);c(57510),c(38367);var f=c(25071),g=c(50474),h=c(70997),i=c(77904),j=c(76835),k=c(2734)},50474:(a,b,c)=>{c.d(b,{y_:()=>d});function d(a){var b=a.noDecision;switch(b.kind){case"proceeds":return{safe:!0,blocksForMs:0,summary:"the agent continues with its own approval flow"};case"blocks":return{safe:!1,blocksForMs:null,summary:"the agent waits indefinitely; nothing else will unblock it"};case"blocksUntil":return{safe:!1,blocksForMs:b.timeoutMs,summary:`the agent waits up to ${b.timeoutMs}ms before continuing`}}}}};
1
+ "use strict";exports.id=5630,exports.ids=[5630],exports.modules={2669:(a,b,c)=>{c.d(b,{JI:()=>n,M7:()=>d,Sr:()=>h,Zf:()=>f,c7:()=>e,lU:()=>k,mR:()=>j,qO:()=>i,su:()=>m,wQ:()=>l});let d="SESSION_STARTING",e="SESSION_START_FAILED",f="SESSION_START_UNAVAILABLE",g=[d,e];class h extends Error{constructor(a,b,c){super(`${a} did not reach its input prompt within ${Math.round(c/1e3)}s (initialization timeout). The tmux session '${b}' and its process are still running, so this is a slow start, not a failed one — the message was not delivered, but nothing needs repairing. Retry the send in a few seconds, or run \`commandmate capture <worktree-id>\` to see what it is waiting on.`),this.toolName=a,this.sessionName=b,this.timeoutMs=c,this.code=d,this.name="SessionStartTimeoutError"}}function i(a,b){return`${a} exited before reaching its input prompt: the tmux session '${b}' is back at a shell, so this is not a slow start and waiting will not help. The message was not delivered. Run \`commandmate capture <worktree-id>\` to see why it exited (for example a startup dialog answered with exit, or a missing login), fix that, then send again.`}class j extends Error{constructor(a,b,c){super(`${a} reported an error while starting in tmux session '${b}': "${c}". Retrying will not help until that is resolved; run \`commandmate capture <worktree-id>\` to see the session output.`),this.toolName=a,this.sessionName=b,this.detectedPattern=c,this.code=e,this.name="SessionStartFailedError"}}class k extends Error{constructor(a,b=`${a} is not installed. Please install it first.`){super(b),this.toolName=a,this.code=f,this.name="SessionStartUnavailableError"}}function l(a){return o(a)===d}function m(a){let b=o(a);return void 0!==b&&g.includes(b)}function n(a){return o(a)===f}function o(a){if("object"!=typeof a||null===a)return;let b=a.code;return"string"==typeof b?b:void 0}},22354:(a,b,c)=>{c.d(b,{F0:()=>j.F,K9:()=>e.K9,VM:()=>d.VM,_0:()=>f._0,c1:()=>k.c,o:()=>i.o,vm:()=>h.v,y_:()=>g.y_});var d=c(70096);c(66101);var e=c(45567);c(57510),c(38367);var f=c(25071),g=c(50474),h=c(70997),i=c(77904),j=c(76835),k=c(2734)},50474:(a,b,c)=>{c.d(b,{y_:()=>d});function d(a){var b=a.noDecision;switch(b.kind){case"proceeds":return{safe:!0,blocksForMs:0,summary:"the agent continues with its own approval flow"};case"blocks":return{safe:!1,blocksForMs:null,summary:"the agent waits indefinitely; nothing else will unblock it"};case"blocksUntil":return{safe:!1,blocksForMs:b.timeoutMs,summary:`the agent waits up to ${b.timeoutMs}ms before continuing`}}}},73495:(a,b,c)=>{c.d(b,{Me:()=>h});let d="don['’]t",e=["deny",/^No(?:,|$)/],f={claude:[["allow-once",/^Yes$/],["allow-persistent",/^Yes, and always allow\b/],["mode-change",/^Yes, allow all edits\b/],["mode-change",/^Yes, and switch to\b/],e],codex:[["allow-once",/^Yes$/],["allow-once",/^Yes, proceed\b/],["allow-once",/^Allow(?:\s{2,}|$)/],["allow-persistent",RegExp(`^Yes, and ${d} ask again\\b`)],["allow-persistent",/^Always allow\b/],["mode-change",/^Ask for approval\b/],["mode-change",/^Approve for me\b/],["mode-change",/^Full Access\b/],["deny",/^Cancel\b/],e],antigravity:[["allow-once",/^Yes$/],["allow-once",/^Yes, run command$/],["allow-once",/^Yes, allow creation$/],["allow-persistent",/^Yes, and always allow\b/],e],"command-code":[["allow-once",/^Yes$/],["allow-persistent",RegExp(`^Yes, ${d} ask again\\b`)],["mode-change",/^Yes, allow all edits\b/],e],copilot:[["allow-once",/^Yes$/],["allow-persistent",RegExp(`^Yes, and ${d} ask again\\b`)],["mode-change",/^Manual\b/],["mode-change",/^Allow all\b/],e]},g=Object.values(f).flat();function h(a,b){let c=void 0===b?g:f[b]??null;if(null===c)return{kind:"not-a-permission-dialog"};let d=a.map(a=>(function(a,b){let c=b.trim();for(let[b,d]of a)if(d.test(c))return b;return"unknown"})(c,a.label));if(!d.some(a=>"allow-once"===a||"allow-persistent"===a||"mode-change"===a))return{kind:"not-a-permission-dialog"};let e=a.filter((a,b)=>"allow-once"===d[b]);return 1===e.length?{kind:"allow-once",option:e[0]}:{kind:"unidentified",allowOnceCount:e.length}}Object.keys(f)}};
@@ -0,0 +1 @@
1
+ "use strict";exports.id=610,exports.ids=[610,6119],exports.modules={4803:(a,b,c)=>{c.d(b,{H2:()=>i,eM:()=>f,kN:()=>e,tP:()=>l});let d=/^\[[ xX\u2714]\] /;function e(a){return a.some(a=>d.test(a.label))}function f(a){return!0===a.multiSelect||e(a.options)}let g=/^yes\b/i,h=[/^no\b/i,/\bdeny\b/i];class i extends Error{constructor(a){super(a),this.name="PromptAnswerResolutionError"}}function j(a){return h.some(b=>b.test(a))}function k(a){return g.test(a)&&!j(a)}function l(a){let{answer:b,useDefault:c,promptData:d,fallbackPromptType:e}=a;if(c){if(d?.type==="multiple_choice"){if(f(d))throw new i('Multi-select (checkbox) prompts have no default answer: the cursor marks the row a key would toggle, not a choice. Answer with the option numbers you want ticked, comma-separated (for example "1,3").');let a=function(a){let b=a.find(a=>a.isDefault)??a.find(a=>1===a.number)??a[0];if(!b)throw new i("The prompt has no options to select a default from.");return b}(d.options);return{input:String(a.number),resolved:{via:"default",optionNumber:a.number,optionLabel:a.label}}}if(d?.type==="yes_no"){if(d.defaultOption)return{input:d.defaultOption,resolved:{via:"default",optionLabel:d.defaultOption}};throw new i("The yes/no prompt declares no default option.")}throw new i("Cannot select the default option: no active prompt was detected.")}let g=b??"",h=function(a){let b=a.trim().toLowerCase();return"yes"===b||"y"===b?"yes":"no"===b||"n"===b?"no":null}(g);if(null===h)return{input:g};if(d?.type==="multiple_choice"){let a=function(a,b){let c=a.options;if(f(a))throw new i('Multi-select (checkbox) prompts cannot be answered with yes/no. Answer with the option numbers you want ticked, comma-separated (for example "1,3").');let d="yes"===b?k:j,e=c.filter(a=>d(a.label));if(0===e.length)throw new i(`No option label matches "${b}". Answer with an option number.`);return e.reduce((a,b)=>a.number<=b.number?a:b)}(d,h);return{input:String(a.number),resolved:{via:"semantic",optionNumber:a.number,optionLabel:a.label}}}if(!d&&"multiple_choice"===e)throw new i("Cannot resolve yes/no: the prompt is multiple choice but its options could not be read.");return{input:g}}},15388:(a,b,c)=>{c.d(b,{RJ:()=>f,SQ:()=>g});var d=c(24455);let e=(0,c(36925).v)("__toolInputNormalizations",()=>new Map);function f(a,b,c,g,h,i=Date.now()){e.set((0,d.v7)(a,b,c),{...g,toolName:h,at:i})}function g(a,b,c){return e.get((0,d.v7)(a,b,c))??null}},27354:(a,b,c)=>{c.d(b,{PF:()=>d,PP:()=>k,S6:()=>n,UT:()=>m,Yy:()=>l,dr:()=>e,eS:()=>i,lO:()=>h,m0:()=>g,uZ:()=>f});let d=new Set(["mode-off","deny-pattern","deny-pattern-unusable","type-not-allowed","policy-lookup-failed","allow-once-unidentified","recommended-option-unidentified"]),e="policy-lookup-failed",f="partial-answer",g="startup-trust-unhandled",h="question-confirm-page",i="question-left-to-human",j=new Set(["allow-once-unidentified","recommended-option-unidentified"]);function k(a){return j.has(a)}let l="allow-once-unidentified",m="recommended-option-unidentified",n="no-hook-receipt"},31517:(a,b,c)=>{c.d(b,{DL:()=>j,sD:()=>f});var d=c(2734);let e=(0,c(72626).h)("lib/hooks/stop-history-capture"),f=[150,500,2e3,5e3],g=new Set([d.c]);function h(a){return new Promise(b=>{setTimeout(b,a)})}async function i(a,b,c,d,f,g){let i=Date.now();try{for(let[j,k]of g.entries()){await h(k);let l={};if(await a.captureStructuredHistoryTurn(b.id,c,d,f,l))return e.info("stop-history-capture-deferred-captured",{worktreeId:b.id,cliToolId:c,instanceId:d,attempt:j+1,attempts:g.length,elapsedMs:Date.now()-i}),!0;e.debug("stop-history-capture-deferred-open",{worktreeId:b.id,cliToolId:c,instanceId:d,attempt:j+1,attempts:g.length,outcome:l.outcome??"unavailable",elapsedMs:Date.now()-i})}return e.info("stop-history-capture-deferred-exhausted",{worktreeId:b.id,cliToolId:c,instanceId:d,attempts:g.length,elapsedMs:Date.now()-i}),!1}catch(a){return e.warn("stop-history-capture-deferred-failed",{worktreeId:b.id,cliToolId:c,instanceId:d,error:a instanceof Error?a.message:String(a)}),!1}}async function j(a,b,d,k={}){try{let j=await Promise.all([c.e(1503),c.e(8791),c.e(1719),c.e(2119),c.e(2445),c.e(252),c.e(8800),c.e(7905),c.e(255),c.e(9731),c.e(8728),c.e(8918)]).then(c.bind(c,28918));if(!j.isPullTranscriptHistory(b))return{status:"unavailable"};let l={worktreePath:a.path,transcriptPathHint:null},m={};if(await j.captureStructuredHistoryTurn(a.id,b,d,l,m))return{status:"captured"};let n=()=>"not_yet_closed"===m.outcome?Promise.resolve(!0):j.hasStructuredHistoryTranscript(a.id,b,d,l);if(g.has(b)){let c=k.deferredDelaysMs??f;if(0===c.length||!await n())return{status:"unavailable"};let g=i(j,a,b,d,l,c);return e.info("stop-history-capture-deferred",{worktreeId:a.id,cliToolId:b,instanceId:d,delaysMs:c}),{status:"deferred",deferred:g}}let o=k.retryDelayMs??500;if(o<=0||!await n())return{status:"unavailable"};let p=Math.max(1,k.maxAttempts??3);for(let c=2;c<=p;c+=1){await h(o);let f={},g=await j.captureStructuredHistoryTurn(a.id,b,d,l,f);if(e.debug("stop-history-capture-retried",{worktreeId:a.id,cliToolId:b,instanceId:d,attempt:c,maxAttempts:p,captured:g,outcome:f.outcome??"unavailable"}),g)return{status:"captured"}}return{status:"unavailable"}}catch(c){return e.warn("stop-history-capture-failed",{worktreeId:a.id,cliToolId:b,instanceId:d,error:c instanceof Error?c.message:String(c)}),{status:"unavailable"}}}},48736:(a,b,c)=>{c.d(b,{cV:()=>h,Tb:()=>k,Lj:()=>l,Bz:()=>i,_1:()=>j,sD:()=>m});var d=c(2232),e=c(27354),f=c(4803),g=c(73495);let h=Object.freeze({lookupFailed:!0});function i(a){return null!=a&&"lookupFailed"in a&&!0===a.lookupFailed}function j(a){return a&&!i(a)?a.mode:null}let k=2e4;function l(a,b,c,f=!1){if(!c)return null;if(i(c))return{reason:e.dr};if("off"===c.mode)return{reason:"mode-off"};let g=function(a,b){if(0===b.length)return{outcome:"no-match"};let c=a.some(a=>a.length>k),e=a.map(a=>a.length>k?a.slice(0,k):a);for(let a of b){if(a.length>200||!(0,d.P0)(a).valid)return{outcome:"unusable",pattern:a};let b=new RegExp(a);for(let c of e){let e=(0,d.eJ)(b,c);if(null===e)return{outcome:"unusable",pattern:a};if(e)return{outcome:"match",pattern:a}}}return c?{outcome:"unusable"}:{outcome:"no-match"}}(b,c.denyPatterns);return"match"===g.outcome?{reason:"deny-pattern",pattern:g.pattern}:"unusable"===g.outcome?{reason:"deny-pattern-unusable",pattern:g.pattern}:f&&c.denyPatterns.length>0?{reason:"deny-pattern-unusable"}:"safe"===c.mode?"yes_no"===a?null:{reason:"type-not-allowed"}:"allow-listed"===c.mode?c.allowPromptTypes.includes(a)?null:{reason:"type-not-allowed"}:null}function m(a,b,c,d){let{answer:h,withheldBy:i}=function(a,b,c){if("yes_no"===a.type)return{answer:"y"};if("multiple_choice"===a.type){if(void 0!==c&&"not-a-permission-dialog"===(0,g.Me)(a.options,b).kind){let b=function(a,b,c){if(c)return{kind:"unidentified",cause:"multi-select"};if(0===a.length)return{kind:"unidentified",cause:"no-options"};if(void 0===b||b.length!==a.length||b.some(a=>"unknown"===a))return{kind:"unidentified",cause:"unknown-title"};let d=a.filter((a,c)=>!0===b[c]);if(d.length>1)return{kind:"unidentified",cause:"several-recommended"};let[e,f]=1===d.length?[d[0],"recommended"]:[a.find(a=>a.isDefault)??a[0],"default"];return e.requiresTextInput?{kind:"unidentified",cause:"typed-text"}:{kind:"chosen",option:e,basis:f}}(a.options,c.optionRecommendations,(0,f.eM)(a));return"chosen"===b.kind?{answer:b.option.number.toString()}:{answer:null,withheldBy:e.UT}}if((0,f.eM)(a))return{answer:null};let d=(0,g.Me)(a.options,b);if("unidentified"===d.kind)return{answer:null,withheldBy:e.Yy};let h="allow-once"===d.kind?d.option:a.options.find(a=>a.isDefault)??a.options[0];return!h||h.requiresTextInput?{answer:null}:{answer:h.number.toString()}}return{answer:null}}(a,c,d);if(i)return{answer:null,suppressedBy:i};if(null===h)return{answer:null,suppressedBy:null};let j=l(a.type,function(a){let b=[a.question];if(a.approvalTarget&&b.push(a.approvalTarget),"multiple_choice"===a.type)for(let c of a.options)b.push(c.label);else b.push(...a.options);return b}(a),b,void 0!==a.approvalTargetCompleteness);return j?{answer:null,suppressedBy:j.reason,pattern:j.pattern}:{answer:h,suppressedBy:null}}},52767:(a,b,c)=>{c.d(b,{r:()=>i,g:()=>h});var d=c(48524),e=c(87009),f=c(72626);let g=(0,f.h)("lib/tasks/task-transition-service");function h(a,b,c,f){let h=a.transaction(()=>{let g=(0,d.gg)(a,b);if(!g)return null;let h=g.status,i=function(a,b){switch(a){case"pending":switch(b){case"message_sent":return"running";case"send_failed":case"cancel":return"cancelled";default:return null}case"running":switch(b){case"prompt_detected":return"waiting_input";case"agent_idle":return"running";case"verify_started":return"verifying";case"send_failed":return"failed";case"cancel":return"cancelled";default:return null}case"waiting_input":switch(b){case"prompt_answered_auto":case"prompt_answered_human":case"agent_idle":return"running";case"verify_started":return"verifying";case"cancel":return"cancelled";default:return null}case"verifying":switch(b){case"verify_passed":return"succeeded";case"verify_failed":return"failed";case"verify_not_started":return"not_started";case"cancel":return"cancelled";default:return null}case"failed":case"not_started":switch(b){case"message_sent":return"running";case"verify_started":return"verifying";case"cancel":return"cancelled";default:return null}default:return null}}(h,c),j=Date.now(),k=(0,e.P)(a,{taskId:b,event:c,fromStatus:h,toStatus:i,payload:f,createdAt:j});return null===i?{task:g,fromStatus:h,toStatus:null,eventId:k}:{task:(0,d.xZ)(a,b,i,f?.runId===void 0?{}:{lastVerificationRunId:f.runId}),fromStatus:h,toStatus:i,eventId:k}})();return null===h?g.warn("task-event-unknown-task",{taskId:b,event:c}):null===h.toStatus&&g.warn("task-event-rejected",{taskId:b,event:c,fromStatus:h.fromStatus}),h}function i(a,b,c,e,f,i){try{let g=(0,d.MH)(a,b,c,e);if(!g)return null;return h(a,g.id,f,i)}catch(a){return g.warn("task-event-failed",{worktreeId:b,cliToolId:c,instanceId:e,event:f,error:a instanceof Error?a.message:String(a)}),null}}},77244:(a,b,c)=>{c.d(b,{FD:()=>i,Wo:()=>f,fA:()=>h,nB:()=>k,nh:()=>j});var d=c(24455),e=c(36925);let f=8e3,g=(0,e.v)("__antigravityPermissionReceipts",()=>new Map);function h(a,b,c,e,f=Date.now(),i=null){if(null!==e){for(let[a,b]of g)f-b.at>36e5&&g.delete(a);g.set((0,d.v7)(a,b,c),{toolName:e,at:f,callId:i})}}function i(a,b,c,e,h=Date.now()){let j=g.get((0,d.v7)(a,b,c));return!!j&&(void 0===e||j.toolName===e)&&h-j.at<=f}function j(a,b,c){return g.get((0,d.v7)(a,b,c))?.at??null}function k(a,b,c){return g.get((0,d.v7)(a,b,c))?.callId??null}(0,e.v)("__antigravityReceiptObservations",()=>new Map)},91318:(a,b,c)=>{c.d(b,{Fv:()=>o,JJ:()=>m,d8:()=>l,ie:()=>q,n:()=>k,wO:()=>n});var d=c(56791),e=c(88807),f=c(24455),g=c(72626),h=c(48736);let i=(0,g.h)("auto-yes-policy"),j=new Map;function k(a,b,c,d){return p(a,b,c,d?.fresh===!0).policy}function l(a,b,c){let{policy:d,taskId:e}=p(a,b,c);return(0,h.Bz)(d)?{policy:null,taskId:null}:{policy:d,taskId:e}}function m(a,b,c){let{policy:d,taskId:e}=p(a,b,c);return{policy:d,taskId:e}}function n(a,b,c){var d;return d=l(a,b,c).policy,d?.mode==="off"}function o(a,b,c){let{policy:d,taskId:e}=l(a,b,c);return d?{taskId:e,mode:d.mode,allowPromptTypes:d.allowPromptTypes,denyPatternCount:d.denyPatterns.length}:null}function p(a,b,c,g=!1){let k=c??b,l=(0,f.v7)(a,b,k),m=Date.now(),n=j.get(l);if(!g&&n&&n.expiresAt>m)return n;let{policy:o,taskId:q}=function(a,b,c){try{let f=(0,d.getActiveTaskForInstance)((0,e.getDbInstance)(),a,b,c);if(!f)return{policy:null,taskId:null};return{policy:f.contract.autoYes,taskId:f.id}}catch(d){return i.warn("policy-lookup-failed",{worktreeId:a,cliToolId:b,instanceId:c,error:d instanceof Error?d.message:String(d)}),{policy:h.cV,taskId:null}}}(a,b,k);if((0,h.Bz)(o))return g&&j.delete(l),{policy:o,taskId:q,expiresAt:m};j.size>=200&&function(a){for(let[b,c]of j.entries())c.expiresAt<=a&&j.delete(b)}(m);let r={policy:o,taskId:q,expiresAt:m+5e3};return j.set(l,r),r}function q(a){j.delete(a)}}};