commandmate 0.33.2 → 0.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (370) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-build-manifest.json +160 -160
  3. package/.next/app-path-routes-manifest.json +28 -28
  4. package/.next/build-manifest.json +2 -2
  5. package/.next/prerender-manifest.json +12 -12
  6. package/.next/required-server-files.json +1 -1
  7. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  8. package/.next/server/app/api/agents/update/route_client-reference-manifest.js +1 -1
  9. package/.next/server/app/api/agents/versions/route_client-reference-manifest.js +1 -1
  10. package/.next/server/app/api/app/update/route_client-reference-manifest.js +1 -1
  11. package/.next/server/app/api/app/update-check/route.js +1 -1
  12. package/.next/server/app/api/app/update-check/route.js.nft.json +1 -1
  13. package/.next/server/app/api/app/update-check/route_client-reference-manifest.js +1 -1
  14. package/.next/server/app/api/assistant/conversation/route.js +1 -1
  15. package/.next/server/app/api/assistant/conversation/route.js.nft.json +1 -1
  16. package/.next/server/app/api/assistant/conversation/route_client-reference-manifest.js +1 -1
  17. package/.next/server/app/api/assistant/current-output/route.js +1 -1
  18. package/.next/server/app/api/assistant/current-output/route.js.nft.json +1 -1
  19. package/.next/server/app/api/assistant/current-output/route_client-reference-manifest.js +1 -1
  20. package/.next/server/app/api/assistant/messages/route.js +1 -1
  21. package/.next/server/app/api/assistant/messages/route.js.nft.json +1 -1
  22. package/.next/server/app/api/assistant/messages/route_client-reference-manifest.js +1 -1
  23. package/.next/server/app/api/assistant/session/route.js +1 -1
  24. package/.next/server/app/api/assistant/session/route.js.nft.json +1 -1
  25. package/.next/server/app/api/assistant/session/route_client-reference-manifest.js +1 -1
  26. package/.next/server/app/api/assistant/start/route.js +2 -2
  27. package/.next/server/app/api/assistant/start/route.js.nft.json +1 -1
  28. package/.next/server/app/api/assistant/start/route_client-reference-manifest.js +1 -1
  29. package/.next/server/app/api/assistant/terminal/route.js +3 -3
  30. package/.next/server/app/api/assistant/terminal/route.js.nft.json +1 -1
  31. package/.next/server/app/api/assistant/terminal/route_client-reference-manifest.js +1 -1
  32. package/.next/server/app/api/assistant/tools/route.js +1 -1
  33. package/.next/server/app/api/assistant/tools/route.js.nft.json +1 -1
  34. package/.next/server/app/api/assistant/tools/route_client-reference-manifest.js +1 -1
  35. package/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -1
  36. package/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -1
  37. package/.next/server/app/api/auth/status/route_client-reference-manifest.js +1 -1
  38. package/.next/server/app/api/capabilities/route.js +1 -1
  39. package/.next/server/app/api/capabilities/route.js.nft.json +1 -1
  40. package/.next/server/app/api/capabilities/route_client-reference-manifest.js +1 -1
  41. package/.next/server/app/api/daily-summary/route_client-reference-manifest.js +1 -1
  42. package/.next/server/app/api/daily-summary/status/route_client-reference-manifest.js +1 -1
  43. package/.next/server/app/api/external-apps/[id]/health/route_client-reference-manifest.js +1 -1
  44. package/.next/server/app/api/external-apps/[id]/route_client-reference-manifest.js +1 -1
  45. package/.next/server/app/api/external-apps/route_client-reference-manifest.js +1 -1
  46. package/.next/server/app/api/fs/browse/route_client-reference-manifest.js +1 -1
  47. package/.next/server/app/api/fs/recent-paths/route_client-reference-manifest.js +1 -1
  48. package/.next/server/app/api/hooks/agent-event/route.js +1 -1
  49. package/.next/server/app/api/hooks/agent-event/route.js.nft.json +1 -1
  50. package/.next/server/app/api/hooks/agent-event/route_client-reference-manifest.js +1 -1
  51. package/.next/server/app/api/hooks/claude-done/route.js +2 -2
  52. package/.next/server/app/api/hooks/claude-done/route.js.nft.json +1 -1
  53. package/.next/server/app/api/hooks/claude-done/route_client-reference-manifest.js +1 -1
  54. package/.next/server/app/api/hooks/permission-request/route.js +1 -1
  55. package/.next/server/app/api/hooks/permission-request/route.js.nft.json +1 -1
  56. package/.next/server/app/api/hooks/permission-request/route_client-reference-manifest.js +1 -1
  57. package/.next/server/app/api/metrics/vibe/route_client-reference-manifest.js +1 -1
  58. package/.next/server/app/api/ollama/models/route_client-reference-manifest.js +1 -1
  59. package/.next/server/app/api/push/escalation/route.js +1 -1
  60. package/.next/server/app/api/push/escalation/route_client-reference-manifest.js +1 -1
  61. package/.next/server/app/api/push/subscriptions/route_client-reference-manifest.js +1 -1
  62. package/.next/server/app/api/push/vapid/route.js +1 -1
  63. package/.next/server/app/api/push/vapid/route_client-reference-manifest.js +1 -1
  64. package/.next/server/app/api/relays/[relayId]/cancel/route.js +1 -1
  65. package/.next/server/app/api/relays/[relayId]/cancel/route.js.nft.json +1 -1
  66. package/.next/server/app/api/relays/[relayId]/cancel/route_client-reference-manifest.js +1 -1
  67. package/.next/server/app/api/relays/route.js +1 -1
  68. package/.next/server/app/api/relays/route.js.nft.json +1 -1
  69. package/.next/server/app/api/relays/route_client-reference-manifest.js +1 -1
  70. package/.next/server/app/api/remote/pair/route_client-reference-manifest.js +1 -1
  71. package/.next/server/app/api/repositories/[id]/route_client-reference-manifest.js +1 -1
  72. package/.next/server/app/api/repositories/[id]/todos/[todoId]/route_client-reference-manifest.js +1 -1
  73. package/.next/server/app/api/repositories/[id]/todos/route_client-reference-manifest.js +1 -1
  74. package/.next/server/app/api/repositories/clone/[jobId]/route.js +1 -1
  75. package/.next/server/app/api/repositories/clone/[jobId]/route.js.nft.json +1 -1
  76. package/.next/server/app/api/repositories/clone/[jobId]/route_client-reference-manifest.js +1 -1
  77. package/.next/server/app/api/repositories/clone/route.js +1 -1
  78. package/.next/server/app/api/repositories/clone/route.js.nft.json +1 -1
  79. package/.next/server/app/api/repositories/clone/route_client-reference-manifest.js +1 -1
  80. package/.next/server/app/api/repositories/excluded/route_client-reference-manifest.js +1 -1
  81. package/.next/server/app/api/repositories/restore/route.js +1 -1
  82. package/.next/server/app/api/repositories/restore/route.js.nft.json +1 -1
  83. package/.next/server/app/api/repositories/restore/route_client-reference-manifest.js +1 -1
  84. package/.next/server/app/api/repositories/route.js +1 -1
  85. package/.next/server/app/api/repositories/route.js.nft.json +1 -1
  86. package/.next/server/app/api/repositories/route_client-reference-manifest.js +1 -1
  87. package/.next/server/app/api/repositories/scan/route.js +1 -1
  88. package/.next/server/app/api/repositories/scan/route.js.nft.json +1 -1
  89. package/.next/server/app/api/repositories/scan/route_client-reference-manifest.js +1 -1
  90. package/.next/server/app/api/repositories/sync/route.js +1 -1
  91. package/.next/server/app/api/repositories/sync/route.js.nft.json +1 -1
  92. package/.next/server/app/api/repositories/sync/route_client-reference-manifest.js +1 -1
  93. package/.next/server/app/api/repositories/validate-path/route_client-reference-manifest.js +1 -1
  94. package/.next/server/app/api/settings/default-agents/route.js +1 -1
  95. package/.next/server/app/api/settings/default-agents/route.js.nft.json +1 -1
  96. package/.next/server/app/api/settings/default-agents/route_client-reference-manifest.js +1 -1
  97. package/.next/server/app/api/settings/default-surface-mode/route_client-reference-manifest.js +1 -1
  98. package/.next/server/app/api/sidebar/group-order/route_client-reference-manifest.js +1 -1
  99. package/.next/server/app/api/skills/[id]/route.js +1 -1
  100. package/.next/server/app/api/skills/[id]/route.js.nft.json +1 -1
  101. package/.next/server/app/api/skills/[id]/route_client-reference-manifest.js +1 -1
  102. package/.next/server/app/api/skills/installations/route.js +1 -1
  103. package/.next/server/app/api/skills/installations/route.js.nft.json +1 -1
  104. package/.next/server/app/api/skills/installations/route_client-reference-manifest.js +1 -1
  105. package/.next/server/app/api/skills/operations/route_client-reference-manifest.js +1 -1
  106. package/.next/server/app/api/skills/reindex/route_client-reference-manifest.js +1 -1
  107. package/.next/server/app/api/skills/route.js +1 -1
  108. package/.next/server/app/api/skills/route.js.nft.json +1 -1
  109. package/.next/server/app/api/skills/route_client-reference-manifest.js +1 -1
  110. package/.next/server/app/api/slash-commands/route_client-reference-manifest.js +1 -1
  111. package/.next/server/app/api/tasks/[taskId]/cancel/route_client-reference-manifest.js +1 -1
  112. package/.next/server/app/api/tasks/[taskId]/route_client-reference-manifest.js +1 -1
  113. package/.next/server/app/api/templates/[id]/route_client-reference-manifest.js +1 -1
  114. package/.next/server/app/api/templates/route_client-reference-manifest.js +1 -1
  115. package/.next/server/app/api/todos/route_client-reference-manifest.js +1 -1
  116. package/.next/server/app/api/verification/runs/[runId]/route_client-reference-manifest.js +1 -1
  117. package/.next/server/app/api/verification/runs/route_client-reference-manifest.js +1 -1
  118. package/.next/server/app/api/worktrees/[id]/auto-yes/route.js +1 -1
  119. package/.next/server/app/api/worktrees/[id]/auto-yes/route.js.nft.json +1 -1
  120. package/.next/server/app/api/worktrees/[id]/auto-yes/route_client-reference-manifest.js +1 -1
  121. package/.next/server/app/api/worktrees/[id]/capture/route.js +1 -1
  122. package/.next/server/app/api/worktrees/[id]/capture/route.js.nft.json +1 -1
  123. package/.next/server/app/api/worktrees/[id]/capture/route_client-reference-manifest.js +1 -1
  124. package/.next/server/app/api/worktrees/[id]/clear-composer/route.js +1 -1
  125. package/.next/server/app/api/worktrees/[id]/clear-composer/route.js.nft.json +1 -1
  126. package/.next/server/app/api/worktrees/[id]/clear-composer/route_client-reference-manifest.js +1 -1
  127. package/.next/server/app/api/worktrees/[id]/cli-reference/route_client-reference-manifest.js +1 -1
  128. package/.next/server/app/api/worktrees/[id]/cli-tool/route_client-reference-manifest.js +1 -1
  129. package/.next/server/app/api/worktrees/[id]/cmate/schedules/route_client-reference-manifest.js +1 -1
  130. package/.next/server/app/api/worktrees/[id]/current-output/route.js +1 -1
  131. package/.next/server/app/api/worktrees/[id]/current-output/route.js.nft.json +1 -1
  132. package/.next/server/app/api/worktrees/[id]/current-output/route_client-reference-manifest.js +1 -1
  133. package/.next/server/app/api/worktrees/[id]/env/route_client-reference-manifest.js +1 -1
  134. package/.next/server/app/api/worktrees/[id]/execution-logs/[logId]/route.js +1 -1
  135. package/.next/server/app/api/worktrees/[id]/execution-logs/[logId]/route_client-reference-manifest.js +1 -1
  136. package/.next/server/app/api/worktrees/[id]/execution-logs/route_client-reference-manifest.js +1 -1
  137. package/.next/server/app/api/worktrees/[id]/files/[...path]/route_client-reference-manifest.js +1 -1
  138. package/.next/server/app/api/worktrees/[id]/git/branch/create/route_client-reference-manifest.js +1 -1
  139. package/.next/server/app/api/worktrees/[id]/git/branch/delete/route_client-reference-manifest.js +1 -1
  140. package/.next/server/app/api/worktrees/[id]/git/branches/route_client-reference-manifest.js +1 -1
  141. package/.next/server/app/api/worktrees/[id]/git/checkout/route_client-reference-manifest.js +1 -1
  142. package/.next/server/app/api/worktrees/[id]/git/commit/route_client-reference-manifest.js +1 -1
  143. package/.next/server/app/api/worktrees/[id]/git/diff/route_client-reference-manifest.js +1 -1
  144. package/.next/server/app/api/worktrees/[id]/git/fetch/route_client-reference-manifest.js +1 -1
  145. package/.next/server/app/api/worktrees/[id]/git/log/route_client-reference-manifest.js +1 -1
  146. package/.next/server/app/api/worktrees/[id]/git/pull/route_client-reference-manifest.js +1 -1
  147. package/.next/server/app/api/worktrees/[id]/git/push/route_client-reference-manifest.js +1 -1
  148. package/.next/server/app/api/worktrees/[id]/git/reset/route_client-reference-manifest.js +1 -1
  149. package/.next/server/app/api/worktrees/[id]/git/revert/route_client-reference-manifest.js +1 -1
  150. package/.next/server/app/api/worktrees/[id]/git/show/[commitHash]/route_client-reference-manifest.js +1 -1
  151. package/.next/server/app/api/worktrees/[id]/git/stage/route_client-reference-manifest.js +1 -1
  152. package/.next/server/app/api/worktrees/[id]/git/staged/route_client-reference-manifest.js +1 -1
  153. package/.next/server/app/api/worktrees/[id]/git/stash/[index]/route_client-reference-manifest.js +1 -1
  154. package/.next/server/app/api/worktrees/[id]/git/stash/apply/route_client-reference-manifest.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_client-reference-manifest.js +1 -1
  157. package/.next/server/app/api/worktrees/[id]/git/stash/route_client-reference-manifest.js +1 -1
  158. package/.next/server/app/api/worktrees/[id]/git/status/route_client-reference-manifest.js +1 -1
  159. package/.next/server/app/api/worktrees/[id]/git/unstage/route_client-reference-manifest.js +1 -1
  160. package/.next/server/app/api/worktrees/[id]/git/working-diff/route_client-reference-manifest.js +1 -1
  161. package/.next/server/app/api/worktrees/[id]/instances/notes/route_client-reference-manifest.js +1 -1
  162. package/.next/server/app/api/worktrees/[id]/instances/opencode/route.js.nft.json +1 -1
  163. package/.next/server/app/api/worktrees/[id]/instances/opencode/route_client-reference-manifest.js +1 -1
  164. package/.next/server/app/api/worktrees/[id]/interrupt/route.js +1 -1
  165. package/.next/server/app/api/worktrees/[id]/interrupt/route.js.nft.json +1 -1
  166. package/.next/server/app/api/worktrees/[id]/interrupt/route_client-reference-manifest.js +1 -1
  167. package/.next/server/app/api/worktrees/[id]/kill-session/route.js +1 -1
  168. package/.next/server/app/api/worktrees/[id]/kill-session/route.js.nft.json +1 -1
  169. package/.next/server/app/api/worktrees/[id]/kill-session/route_client-reference-manifest.js +1 -1
  170. package/.next/server/app/api/worktrees/[id]/logs/[filename]/route_client-reference-manifest.js +1 -1
  171. package/.next/server/app/api/worktrees/[id]/logs/route_client-reference-manifest.js +1 -1
  172. package/.next/server/app/api/worktrees/[id]/marp-render/route_client-reference-manifest.js +1 -1
  173. package/.next/server/app/api/worktrees/[id]/memos/[memoId]/route_client-reference-manifest.js +1 -1
  174. package/.next/server/app/api/worktrees/[id]/memos/route_client-reference-manifest.js +1 -1
  175. package/.next/server/app/api/worktrees/[id]/messages/route_client-reference-manifest.js +1 -1
  176. package/.next/server/app/api/worktrees/[id]/opencode/diff/route_client-reference-manifest.js +1 -1
  177. package/.next/server/app/api/worktrees/[id]/opencode/session/route_client-reference-manifest.js +1 -1
  178. package/.next/server/app/api/worktrees/[id]/opencode/share/route_client-reference-manifest.js +1 -1
  179. package/.next/server/app/api/worktrees/[id]/prompt-response/route.js +1 -1
  180. package/.next/server/app/api/worktrees/[id]/prompt-response/route.js.nft.json +1 -1
  181. package/.next/server/app/api/worktrees/[id]/prompt-response/route_client-reference-manifest.js +1 -1
  182. package/.next/server/app/api/worktrees/[id]/resolve-target/route.js +1 -1
  183. package/.next/server/app/api/worktrees/[id]/resolve-target/route_client-reference-manifest.js +1 -1
  184. package/.next/server/app/api/worktrees/[id]/respond/route.js +1 -1
  185. package/.next/server/app/api/worktrees/[id]/respond/route.js.nft.json +1 -1
  186. package/.next/server/app/api/worktrees/[id]/respond/route_client-reference-manifest.js +1 -1
  187. package/.next/server/app/api/worktrees/[id]/route.js +1 -1
  188. package/.next/server/app/api/worktrees/[id]/route.js.nft.json +1 -1
  189. package/.next/server/app/api/worktrees/[id]/route_client-reference-manifest.js +1 -1
  190. package/.next/server/app/api/worktrees/[id]/schedules/[scheduleId]/route.js +1 -1
  191. package/.next/server/app/api/worktrees/[id]/schedules/[scheduleId]/route_client-reference-manifest.js +1 -1
  192. package/.next/server/app/api/worktrees/[id]/schedules/active/route_client-reference-manifest.js +1 -1
  193. package/.next/server/app/api/worktrees/[id]/schedules/route.js +1 -1
  194. package/.next/server/app/api/worktrees/[id]/schedules/route_client-reference-manifest.js +1 -1
  195. package/.next/server/app/api/worktrees/[id]/search/route_client-reference-manifest.js +1 -1
  196. package/.next/server/app/api/worktrees/[id]/send/route.js +1 -1
  197. package/.next/server/app/api/worktrees/[id]/send/route.js.nft.json +1 -1
  198. package/.next/server/app/api/worktrees/[id]/send/route_client-reference-manifest.js +1 -1
  199. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/git-workflow/route.js +2 -2
  200. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/git-workflow/route.js.nft.json +1 -1
  201. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/git-workflow/route_client-reference-manifest.js +1 -1
  202. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/install/route_client-reference-manifest.js +1 -1
  203. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/plan/route.js +1 -1
  204. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/plan/route.js.nft.json +1 -1
  205. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/plan/route_client-reference-manifest.js +1 -1
  206. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/uninstall/route_client-reference-manifest.js +1 -1
  207. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/uninstall-plan/route_client-reference-manifest.js +1 -1
  208. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/update/route_client-reference-manifest.js +1 -1
  209. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/update-plan/route.js +1 -1
  210. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/update-plan/route.js.nft.json +1 -1
  211. package/.next/server/app/api/worktrees/[id]/skills/[skillId]/update-plan/route_client-reference-manifest.js +1 -1
  212. package/.next/server/app/api/worktrees/[id]/skills/route_client-reference-manifest.js +1 -1
  213. package/.next/server/app/api/worktrees/[id]/slash-commands/route_client-reference-manifest.js +1 -1
  214. package/.next/server/app/api/worktrees/[id]/special-keys/route.js +1 -1
  215. package/.next/server/app/api/worktrees/[id]/special-keys/route.js.nft.json +1 -1
  216. package/.next/server/app/api/worktrees/[id]/special-keys/route_client-reference-manifest.js +1 -1
  217. package/.next/server/app/api/worktrees/[id]/tasks/route.js +2 -2
  218. package/.next/server/app/api/worktrees/[id]/tasks/route.js.nft.json +1 -1
  219. package/.next/server/app/api/worktrees/[id]/tasks/route_client-reference-manifest.js +1 -1
  220. package/.next/server/app/api/worktrees/[id]/terminal/route.js +2 -2
  221. package/.next/server/app/api/worktrees/[id]/terminal/route.js.nft.json +1 -1
  222. package/.next/server/app/api/worktrees/[id]/terminal/route_client-reference-manifest.js +1 -1
  223. package/.next/server/app/api/worktrees/[id]/timers/history/route_client-reference-manifest.js +1 -1
  224. package/.next/server/app/api/worktrees/[id]/timers/route.js +1 -1
  225. package/.next/server/app/api/worktrees/[id]/timers/route.js.nft.json +1 -1
  226. package/.next/server/app/api/worktrees/[id]/timers/route_client-reference-manifest.js +1 -1
  227. package/.next/server/app/api/worktrees/[id]/todos/[todoId]/route_client-reference-manifest.js +1 -1
  228. package/.next/server/app/api/worktrees/[id]/todos/route_client-reference-manifest.js +1 -1
  229. package/.next/server/app/api/worktrees/[id]/tree/[...path]/route_client-reference-manifest.js +1 -1
  230. package/.next/server/app/api/worktrees/[id]/tree/route_client-reference-manifest.js +1 -1
  231. package/.next/server/app/api/worktrees/[id]/upload/[...path]/route_client-reference-manifest.js +1 -1
  232. package/.next/server/app/api/worktrees/[id]/verify/config/route.js +1 -1
  233. package/.next/server/app/api/worktrees/[id]/verify/config/route_client-reference-manifest.js +1 -1
  234. package/.next/server/app/api/worktrees/[id]/verify/route.js +1 -1
  235. package/.next/server/app/api/worktrees/[id]/verify/route.js.nft.json +1 -1
  236. package/.next/server/app/api/worktrees/[id]/verify/route_client-reference-manifest.js +1 -1
  237. package/.next/server/app/api/worktrees/[id]/verify/runs/[runId]/cancel/route.js +1 -1
  238. package/.next/server/app/api/worktrees/[id]/verify/runs/[runId]/cancel/route.js.nft.json +1 -1
  239. package/.next/server/app/api/worktrees/[id]/verify/runs/[runId]/cancel/route_client-reference-manifest.js +1 -1
  240. package/.next/server/app/api/worktrees/[id]/verify/runs/[runId]/route_client-reference-manifest.js +1 -1
  241. package/.next/server/app/api/worktrees/[id]/verify/runs/route_client-reference-manifest.js +1 -1
  242. package/.next/server/app/api/worktrees/[id]/viewed/route_client-reference-manifest.js +1 -1
  243. package/.next/server/app/api/worktrees/apply-default-agents/route_client-reference-manifest.js +1 -1
  244. package/.next/server/app/api/worktrees/route.js +1 -1
  245. package/.next/server/app/api/worktrees/route.js.nft.json +1 -1
  246. package/.next/server/app/api/worktrees/route_client-reference-manifest.js +1 -1
  247. package/.next/server/app/chat/page_client-reference-manifest.js +1 -1
  248. package/.next/server/app/login/page_client-reference-manifest.js +1 -1
  249. package/.next/server/app/manifest.webmanifest/route_client-reference-manifest.js +1 -1
  250. package/.next/server/app/more/page_client-reference-manifest.js +1 -1
  251. package/.next/server/app/offline/page_client-reference-manifest.js +1 -1
  252. package/.next/server/app/page.js +1 -1
  253. package/.next/server/app/page_client-reference-manifest.js +1 -1
  254. package/.next/server/app/proxy/[...path]/route_client-reference-manifest.js +1 -1
  255. package/.next/server/app/repositories/page_client-reference-manifest.js +1 -1
  256. package/.next/server/app/review/page_client-reference-manifest.js +1 -1
  257. package/.next/server/app/sessions/page.js +1 -1
  258. package/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
  259. package/.next/server/app/skills/[skillId]/page_client-reference-manifest.js +1 -1
  260. package/.next/server/app/skills/installed/page_client-reference-manifest.js +1 -1
  261. package/.next/server/app/skills/page_client-reference-manifest.js +1 -1
  262. package/.next/server/app/worktrees/[id]/files/[...path]/page_client-reference-manifest.js +1 -1
  263. package/.next/server/app/worktrees/[id]/page.js +10 -10
  264. package/.next/server/app/worktrees/[id]/page_client-reference-manifest.js +1 -1
  265. package/.next/server/app/worktrees/[id]/terminal/page_client-reference-manifest.js +1 -1
  266. package/.next/server/app-paths-manifest.json +28 -28
  267. package/.next/server/chunks/1049.js +1 -0
  268. package/.next/server/chunks/1501.js +6 -2
  269. package/.next/server/chunks/1886.js +3 -3
  270. package/.next/server/chunks/2119.js +1 -1
  271. package/.next/server/chunks/2404.js +1 -1
  272. package/.next/server/chunks/2445.js +1 -1
  273. package/.next/server/chunks/3123.js +1 -1
  274. package/.next/server/chunks/3241.js +1 -1
  275. package/.next/server/chunks/3323.js +1 -1
  276. package/.next/server/chunks/3480.js +2 -2
  277. package/.next/server/chunks/4443.js +1 -1
  278. package/.next/server/chunks/4802.js +1 -1
  279. package/.next/server/chunks/5164.js +1 -1
  280. package/.next/server/chunks/5571.js +1 -1
  281. package/.next/server/chunks/595.js +2 -2
  282. package/.next/server/chunks/6130.js +1 -0
  283. package/.next/server/chunks/6285.js +1 -1
  284. package/.next/server/chunks/6286.js +7 -7
  285. package/.next/server/chunks/6337.js +1 -1
  286. package/.next/server/chunks/650.js +1 -1
  287. package/.next/server/chunks/663.js +1 -1
  288. package/.next/server/chunks/6661.js +1 -1
  289. package/.next/server/chunks/6677.js +25 -0
  290. package/.next/server/chunks/6781.js +1 -1
  291. package/.next/server/chunks/7075.js +1 -0
  292. package/.next/server/chunks/7905.js +1 -1
  293. package/.next/server/chunks/8583.js +1 -0
  294. package/.next/server/chunks/8918.js +7 -5
  295. package/.next/server/chunks/9080.js +1 -0
  296. package/.next/server/chunks/9627.js +1 -1
  297. package/.next/server/chunks/964.js +1 -0
  298. package/.next/server/middleware-manifest.json +5 -5
  299. package/.next/server/pages/500.html +1 -1
  300. package/.next/server/server-reference-manifest.json +1 -1
  301. package/.next/static/chunks/2053-9ac860ab4e92ac89.js +1 -0
  302. package/.next/static/chunks/2652-18b8fea64413467e.js +1 -0
  303. package/.next/static/chunks/{4718-441a2af91f0374e9.js → 4718-2d9f0397a8f931c4.js} +1 -1
  304. package/.next/static/chunks/6022-7a7d1760fc9814c7.js +1 -0
  305. package/.next/static/chunks/{8361-9bb887203c456edb.js → 8361-0142beb59be2abf3.js} +1 -1
  306. package/.next/static/chunks/app/{page-022090bf6f932818.js → page-26a42881c8648cd3.js} +1 -1
  307. package/.next/static/chunks/app/sessions/page-a3ab6f122ec60d5a.js +1 -0
  308. package/.next/static/chunks/app/worktrees/[id]/page-a39ec2a0732d11a6.js +1 -0
  309. package/.next/static/css/b09bede85744e1cf.css +1 -0
  310. package/.next/trace +13 -13
  311. package/dist/cli/commands/ask.d.ts.map +1 -1
  312. package/dist/cli/commands/ask.js +11 -2
  313. package/dist/cli/commands/respond.d.ts.map +1 -1
  314. package/dist/cli/commands/respond.js +8 -4
  315. package/dist/cli/commands/send.d.ts.map +1 -1
  316. package/dist/cli/commands/send.js +18 -0
  317. package/dist/cli/commands/wait.d.ts +18 -3
  318. package/dist/cli/commands/wait.d.ts.map +1 -1
  319. package/dist/cli/commands/wait.js +137 -2
  320. package/dist/cli/docs/agent-operations.d.ts +2 -2
  321. package/dist/cli/docs/agent-operations.d.ts.map +1 -1
  322. package/dist/cli/docs/agent-operations.js +41 -1
  323. package/dist/cli/utils/session-target.d.ts +23 -6
  324. package/dist/cli/utils/session-target.d.ts.map +1 -1
  325. package/dist/cli/utils/session-target.js +33 -5
  326. package/dist/server/locales/en/worktree.json +30 -4
  327. package/dist/server/locales/ja/worktree.json +30 -4
  328. package/dist/server/src/config/schedule-config.js +45 -3
  329. package/dist/server/src/lib/cli-tools/antigravity.js +95 -10
  330. package/dist/server/src/lib/cli-tools/submit-verified-sender.js +377 -16
  331. package/dist/server/src/lib/cli-tools/vibe-local.js +10 -0
  332. package/dist/server/src/lib/cmate-parser.js +8 -1
  333. package/dist/server/src/lib/detection/prompt-detect-multiple-choice.js +140 -19
  334. package/dist/server/src/lib/detection/tools/claude/detect.js +13 -2
  335. package/dist/server/src/lib/detection/tools/claude/picker-chrome.js +239 -0
  336. package/dist/server/src/lib/detection/tools/claude/prompt.js +74 -6
  337. package/dist/server/src/lib/hooks/hook-settings-generator.js +61 -1
  338. package/dist/server/src/lib/hooks/sources/antigravity/history.js +302 -27
  339. package/dist/server/src/lib/hooks/sources/antigravity/transcript.js +103 -0
  340. package/dist/server/src/lib/hooks/sources/claude/history.js +391 -34
  341. package/dist/server/src/lib/hooks/sources/claude/transcript.js +91 -0
  342. package/dist/server/src/lib/polling/auto-yes-dialog-gate.js +114 -11
  343. package/dist/server/src/lib/polling/response-checker.js +82 -3
  344. package/dist/server/src/lib/polling/structured-history-gate.js +68 -4
  345. package/dist/server/src/lib/schedule-manager.js +178 -19
  346. package/dist/server/src/lib/session/agent-session-lifecycle.js +31 -1
  347. package/dist/server/src/lib/session/ask-user-question-prompt.js +4 -2
  348. package/dist/server/src/lib/session/claude-executor.js +33 -2
  349. package/dist/server/src/lib/session/resolve-session-target.js +37 -9
  350. package/dist/server/src/lib/session/session-generation-archive.js +194 -0
  351. package/dist/server/src/lib/tasks/contract-message.js +83 -9
  352. package/dist/server/src/lib/tasks/contract-parser.js +2 -0
  353. package/dist/server/src/lib/verification/env-clean-gate.js +81 -4
  354. package/dist/server/src/types/agent-transcript.js +143 -1
  355. package/package.json +1 -1
  356. package/.next/server/chunks/1068.js +0 -1
  357. package/.next/server/chunks/153.js +0 -1
  358. package/.next/server/chunks/4299.js +0 -1
  359. package/.next/server/chunks/6808.js +0 -1
  360. package/.next/server/chunks/6838.js +0 -1
  361. package/.next/server/chunks/7366.js +0 -5
  362. package/.next/server/chunks/7875.js +0 -25
  363. package/.next/static/chunks/2053-3f299a7a2c7d6767.js +0 -1
  364. package/.next/static/chunks/6022-2fa0b5a82d4ce7b6.js +0 -1
  365. package/.next/static/chunks/8772-9be53a530950d804.js +0 -1
  366. package/.next/static/chunks/app/sessions/page-584adf11ae51df10.js +0 -1
  367. package/.next/static/chunks/app/worktrees/[id]/page-38edcd53e51f53b0.js +0 -1
  368. package/.next/static/css/acd46e25427a2080.css +0 -1
  369. /package/.next/static/{0a4qrU8WdUwQrlO4mfLMu → gniPBCKoXtbIOQey8kNcx}/_buildManifest.js +0 -0
  370. /package/.next/static/{0a4qrU8WdUwQrlO4mfLMu → gniPBCKoXtbIOQey8kNcx}/_ssgManifest.js +0 -0
@@ -20,7 +20,9 @@
20
20
  * the pkill (#1739) and `kill-server` (#1624) case. New things are a
21
21
  * violation *unless they are attributable to another worker*, because
22
22
  * parallel delegations legitimately start their own sessions and servers
23
- * inside each other's measurement windows.
23
+ * inside each other's measurement windows — or unless they are the one
24
+ * agent session the delegation itself started (#2472), which the baseline
25
+ * names and which is excused by that exact name only.
24
26
  *
25
27
  * Server-only: consumes snapshots produced by env-snapshot.
26
28
  *
@@ -31,11 +33,15 @@ exports.ENV_CLEAN_GUIDANCE = exports.MAX_REPORTED_ENV_CHANGES = exports.REQUIRE_
31
33
  exports.resolveRequireEnvClean = resolveRequireEnvClean;
32
34
  exports.attributeSessionName = attributeSessionName;
33
35
  exports.attributeAnchor = attributeAnchor;
36
+ exports.resolveTaskSessionName = resolveTaskSessionName;
37
+ exports.recordTaskSession = recordTaskSession;
38
+ exports.readTaskSession = readTaskSession;
34
39
  exports.diffEnvSnapshots = diffEnvSnapshots;
35
40
  exports.formatEnvCleanReport = formatEnvCleanReport;
36
41
  exports.envCleanNoBaseline = envCleanNoBaseline;
37
42
  exports.evaluateEnvClean = evaluateEnvClean;
38
43
  const path_1 = require("path");
44
+ const session_name_1 = require("../../lib/cli-tools/session-name");
39
45
  const types_1 = require("../../lib/cli-tools/types");
40
46
  const env_snapshot_1 = require("./env-snapshot");
41
47
  const verify_config_1 = require("./verify-config");
@@ -139,6 +145,41 @@ function attributeEntry(probeId, entry, context) {
139
145
  return 'unattributed';
140
146
  }
141
147
  }
148
+ /**
149
+ * The tmux session a task's delegation runs in.
150
+ *
151
+ * `resolveSessionName` is the function that names the session when it is
152
+ * started, so the naming rule stays in one place: a second copy here would be
153
+ * free to drift, and the drift would read as a leak.
154
+ *
155
+ * @returns null when the row cannot name a session — a CLI tool id this build
156
+ * does not know, or a name `validateSessionName` refuses
157
+ */
158
+ function resolveTaskSessionName(task) {
159
+ if (!(0, types_1.isCliToolType)(task.cliToolId))
160
+ return null;
161
+ try {
162
+ return (0, session_name_1.resolveSessionName)(task.cliToolId, task.worktreeId, task.instanceId ?? undefined);
163
+ }
164
+ catch {
165
+ return null;
166
+ }
167
+ }
168
+ /** A freshly captured baseline, stamped with its task's own agent session. */
169
+ function recordTaskSession(snapshot, task) {
170
+ return { ...snapshot, taskSession: resolveTaskSessionName(task) };
171
+ }
172
+ /**
173
+ * The session a baseline excuses: its name, `null` when it was recorded as
174
+ * unresolvable, or `undefined` when the baseline predates the field. Only a
175
+ * non-empty string excuses anything.
176
+ */
177
+ function readTaskSession(baseline) {
178
+ if (!('taskSession' in baseline))
179
+ return undefined;
180
+ const recorded = baseline.taskSession;
181
+ return typeof recorded === 'string' && recorded !== '' ? recorded : null;
182
+ }
142
183
  function toChange(entry, owner) {
143
184
  return { key: entry.key, detail: entry.detail, owner };
144
185
  }
@@ -151,6 +192,7 @@ function toChange(entry, owner) {
151
192
  * than useless, and treating it as equal would be the fail-open.
152
193
  */
153
194
  function diffEnvSnapshots(baseline, final, context) {
195
+ const taskSession = readTaskSession(baseline);
154
196
  const probes = env_snapshot_1.ENV_PROBE_IDS.map((probeId) => {
155
197
  const before = baseline.probes[probeId];
156
198
  const after = final.probes[probeId];
@@ -161,6 +203,7 @@ function diffEnvSnapshots(baseline, final, context) {
161
203
  reason: `baseline probe unavailable: ${before?.reason ?? 'not recorded'}`,
162
204
  added: [],
163
205
  ignoredAdded: [],
206
+ taskSessionAdded: [],
164
207
  removed: [],
165
208
  };
166
209
  }
@@ -171,6 +214,7 @@ function diffEnvSnapshots(baseline, final, context) {
171
214
  reason: `current probe unavailable: ${after?.reason ?? 'not recorded'}`,
172
215
  added: [],
173
216
  ignoredAdded: [],
217
+ taskSessionAdded: [],
174
218
  removed: [],
175
219
  };
176
220
  }
@@ -178,10 +222,17 @@ function diffEnvSnapshots(baseline, final, context) {
178
222
  const afterKeys = new Set(after.entries.map((entry) => entry.key));
179
223
  const added = [];
180
224
  const ignoredAdded = [];
225
+ const taskSessionAdded = [];
181
226
  for (const entry of after.entries) {
182
227
  if (beforeKeys.has(entry.key))
183
228
  continue;
184
229
  const owner = attributeEntry(probeId, entry, context);
230
+ if (probeId === 'tmux-sessions' && taskSession && entry.key === taskSession) {
231
+ // Additions only: a task session that existed at task start and is gone
232
+ // falls through to `removed` below like everything else (#1624).
233
+ taskSessionAdded.push(toChange(entry, owner));
234
+ continue;
235
+ }
185
236
  (owner === 'other' ? ignoredAdded : added).push(toChange(entry, owner));
186
237
  }
187
238
  const removed = before.entries
@@ -193,6 +244,7 @@ function diffEnvSnapshots(baseline, final, context) {
193
244
  reason: null,
194
245
  added,
195
246
  ignoredAdded,
247
+ taskSessionAdded,
196
248
  removed,
197
249
  };
198
250
  });
@@ -204,7 +256,7 @@ function diffEnvSnapshots(baseline, final, context) {
204
256
  : probes.some((probe) => probe.status === 'unknown')
205
257
  ? 'unknown'
206
258
  : 'clean';
207
- return { status, probes };
259
+ return { status, taskSession, probes };
208
260
  }
209
261
  // =============================================================================
210
262
  // Reporting
@@ -217,7 +269,9 @@ exports.MAX_REPORTED_ENV_CHANGES = 25;
217
269
  * different actions.
218
270
  */
219
271
  exports.ENV_CLEAN_GUIDANCE = 'Anything listed under "+" was started or created during this task and left behind — ' +
220
- 'stop it by PID and remove it. Anything under "-" existed when the task started and is ' +
272
+ 'stop it by PID and remove it. The one exception is a "+" line marked "task session, ' +
273
+ 'excused": that is the agent session this delegation itself started, it is not counted, ' +
274
+ 'and it must be left running. Anything under "-" existed when the task started and is ' +
221
275
  'now gone — it was killed or deleted; restart or restore it. Never stop a process by ' +
222
276
  'pattern (`pkill -f`): it takes every process whose command line matches, which is how ' +
223
277
  'the production server was stopped in #1739.';
@@ -232,6 +286,27 @@ function formatChanges(sign, changes) {
232
286
  lines.push(` ... and ${remainder} more`);
233
287
  return lines;
234
288
  }
289
+ /**
290
+ * The excused task session, listed rather than dropped (#2472): a verdict that
291
+ * silently discounted a session would read exactly like one that never saw it.
292
+ */
293
+ function formatTaskSessionChanges(changes) {
294
+ return changes.map((change) => {
295
+ const detail = change.detail ? ` ${change.detail}` : '';
296
+ return ` + ${change.key}${detail} [task session, excused]`;
297
+ });
298
+ }
299
+ /**
300
+ * The header's account of what could be excused, so a report judged against a
301
+ * baseline written before #2472 says why the task's own session was not.
302
+ */
303
+ function describeTaskSession(taskSession) {
304
+ if (taskSession === undefined)
305
+ return 'unrecorded (baseline predates #2472; nothing excused)';
306
+ if (taskSession === null)
307
+ return 'unresolved (nothing excused)';
308
+ return taskSession;
309
+ }
235
310
  /** Render a diff for `log_tail`. */
236
311
  function formatEnvCleanReport(diff) {
237
312
  const lines = [];
@@ -246,11 +321,13 @@ function formatEnvCleanReport(diff) {
246
321
  ? ` (${probe.ignoredAdded.length} addition(s) attributed to another worktree)`
247
322
  : '';
248
323
  lines.push(` ${probe.probeId} clean (${label})${excused}`);
324
+ lines.push(...formatTaskSessionChanges(probe.taskSessionAdded));
249
325
  continue;
250
326
  }
251
327
  lines.push(` ${probe.probeId} VIOLATED (${label}): +${probe.added.length} -${probe.removed.length}`);
252
328
  lines.push(...formatChanges('+', probe.added));
253
329
  lines.push(...formatChanges('-', probe.removed));
330
+ lines.push(...formatTaskSessionChanges(probe.taskSessionAdded));
254
331
  for (const excused of probe.ignoredAdded) {
255
332
  lines.push(` · ${excused.key} (ignored: belongs to another worktree)`);
256
333
  }
@@ -308,7 +385,7 @@ async function evaluateEnvClean(input) {
308
385
  }
309
386
  const diff = diffEnvSnapshots(input.baseline, final, input);
310
387
  const header = `${verify_config_1.ENV_CLEAN_GATE_ID}: baseline=${new Date(input.baseline.capturedAt).toISOString()} ` +
311
- `status=${diff.status}`;
388
+ `status=${diff.status} task-session=${describeTaskSession(diff.taskSession)}`;
312
389
  const report = `${header}\n${formatEnvCleanReport(diff)}`;
313
390
  if (diff.status === 'clean')
314
391
  return done('passed', report, 0);
@@ -39,17 +39,20 @@
39
39
  * @module types/agent-transcript
40
40
  */
41
41
  Object.defineProperty(exports, "__esModule", { value: true });
42
- exports.AGENT_MARKDOWN_REQUEST_ID_PREFIXES = exports.COMMAND_CODE_PROMPT_REQUEST_ID_PREFIX = exports.COMMAND_CODE_MARKDOWN_REQUEST_ID_PREFIX = exports.ANTIGRAVITY_PROMPT_REQUEST_ID_PREFIX = exports.ANTIGRAVITY_MARKDOWN_REQUEST_ID_PREFIX = exports.CODEX_PROMPT_REQUEST_ID_PREFIX = exports.CODEX_MARKDOWN_REQUEST_ID_PREFIX = exports.CLAUDE_PROMPT_REQUEST_ID_PREFIX = exports.CLAUDE_MARKDOWN_REQUEST_ID_PREFIX = exports.AGENT_MARKDOWN_REQUEST_ID_PREFIX = void 0;
42
+ exports.CLAUDE_HEADLESS_TURN_ID_PREFIX = exports.AGENT_MARKDOWN_REQUEST_ID_PREFIXES = exports.COMMAND_CODE_PROMPT_REQUEST_ID_PREFIX = exports.COMMAND_CODE_MARKDOWN_REQUEST_ID_PREFIX = exports.ANTIGRAVITY_PROMPT_REQUEST_ID_PREFIX = exports.ANTIGRAVITY_MARKDOWN_REQUEST_ID_PREFIX = exports.CODEX_PROMPT_REQUEST_ID_PREFIX = exports.CODEX_MARKDOWN_REQUEST_ID_PREFIX = exports.CLAUDE_PROMPT_REQUEST_ID_PREFIX = exports.CLAUDE_MARKDOWN_REQUEST_ID_PREFIX = exports.AGENT_MARKDOWN_REQUEST_ID_PREFIX = void 0;
43
43
  exports.isAgentAuthoredMarkdown = isAgentAuthoredMarkdown;
44
44
  exports.opencodeTurnRequestId = opencodeTurnRequestId;
45
45
  exports.claudeTurnRequestId = claudeTurnRequestId;
46
46
  exports.claudePromptRequestId = claudePromptRequestId;
47
+ exports.claudeHeadlessTurnId = claudeHeadlessTurnId;
47
48
  exports.codexTurnRequestId = codexTurnRequestId;
48
49
  exports.codexPromptRequestId = codexPromptRequestId;
49
50
  exports.antigravityTurnRequestId = antigravityTurnRequestId;
50
51
  exports.antigravityPromptRequestId = antigravityPromptRequestId;
51
52
  exports.commandCodeTurnRequestId = commandCodeTurnRequestId;
52
53
  exports.commandCodePromptRequestId = commandCodePromptRequestId;
54
+ exports.resolveAgentTurnKey = resolveAgentTurnKey;
55
+ exports.correlatedPromptRequestId = correlatedPromptRequestId;
53
56
  /**
54
57
  * Prefix on `chat_messages.request_id` for a row whose `content` is opencode's
55
58
  * own Markdown rather than a scrape of its terminal.
@@ -269,6 +272,53 @@ function claudeTurnRequestId(promptUuid) {
269
272
  function claudePromptRequestId(promptUuid) {
270
273
  return `${exports.CLAUDE_PROMPT_REQUEST_ID_PREFIX}${promptUuid}`;
271
274
  }
275
+ /**
276
+ * The segment a Claude turn id opens with when no prompt record names the turn
277
+ * (Issue #2199, made durable by Issue #2470).
278
+ *
279
+ * `partial:` cannot be the start of a UUID, so no turn id built on it can equal
280
+ * a prompt record's `uuid` — which is what keeps every key built on it apart
281
+ * from {@link claudeTurnRequestId} of a real prompt.
282
+ */
283
+ exports.CLAUDE_HEADLESS_TURN_ID_PREFIX = 'partial:';
284
+ /**
285
+ * The turn id for a Claude reply whose prompt record could not be read (Issue #2470).
286
+ *
287
+ * `partial:<sessionId>:<closingRecordUuid>`, handed to {@link claudeTurnRequestId}
288
+ * where a prompt `uuid` would otherwise go. A turn longer than the widest window
289
+ * `lib/hooks/sources/claude/history` reads back has no prompt record in reach,
290
+ * and #2470 saves what can be read of it rather than nothing. That row still
291
+ * needs a key that does both jobs every key in this module does — idempotency
292
+ * and provenance — without the record that normally provides one.
293
+ *
294
+ * Three candidates were available, and the other two fail on the first job:
295
+ *
296
+ * - **`partial:<sessionId>`**, the live bubble's key (#2199). One per session,
297
+ * so a second long turn in the same session would find the first one's row,
298
+ * read "already saved" and be lost. It stays the live key and only that.
299
+ * - **The first assistant record in the window.** The window is the file's last
300
+ * N bytes, and Claude keeps appending after a turn closes — measured on
301
+ * 2026-09-11 over 298 transcripts, the records between a closing `end_turn`
302
+ * and the next prompt were `attachment` (1,929), `system:turn_duration`
303
+ * (1,927), `system:stop_hook_summary` (1,923), `queue-operation` (1,487) and
304
+ * more. Every one of them moves the window's head, so two reads of one
305
+ * finished turn could name two different records and write the reply twice.
306
+ * - **The record that closed the turn** — its last assistant record. In the
307
+ * same census, across 1,973 closed turns, not one assistant record followed a
308
+ * closing `end_turn` before the next prompt. Every read that can see the turn
309
+ * at all therefore names the same record, and no two turns share one.
310
+ *
311
+ * The second `:` is what separates this from the live key: a session id is a
312
+ * UUID and has none. {@link correlatedPromptRequestId} turns it into a
313
+ * `claude-prompt:partial:…` id that no writer produces, which is correct — a
314
+ * turn with no prompt record in reach gets no user row.
315
+ *
316
+ * @param sessionId - The session the turn was read from
317
+ * @param closingRecordUuid - `uuid` of the turn's last assistant record
318
+ */
319
+ function claudeHeadlessTurnId(sessionId, closingRecordUuid) {
320
+ return `${exports.CLAUDE_HEADLESS_TURN_ID_PREFIX}${sessionId}:${closingRecordUuid}`;
321
+ }
272
322
  /**
273
323
  * The row id for one codex turn (Issue #2197).
274
324
  *
@@ -386,3 +436,95 @@ function commandCodeTurnRequestId(promptId) {
386
436
  function commandCodePromptRequestId(promptId) {
387
437
  return `${exports.COMMAND_CODE_PROMPT_REQUEST_ID_PREFIX}${promptId}`;
388
438
  }
439
+ // ============================================================================
440
+ // Turn keys, read back off a saved row (Issue #2458)
441
+ // ============================================================================
442
+ /**
443
+ * Every turn prefix paired with the **prompt** prefix that names the same turn.
444
+ *
445
+ * Three tools, and the two that are absent are absent for a reason rather than
446
+ * by oversight:
447
+ *
448
+ * - **codex** keys its assistant row on `turn_id` and its user row on the
449
+ * `UserMessage` item's own id (see {@link CODEX_PROMPT_REQUEST_ID_PREFIX} for
450
+ * the measurement that forces that). The two are different ids in the
451
+ * database, so there is no string this map could produce that would find the
452
+ * prompt, and producing one anyway would silently correlate a turn with
453
+ * whatever row happened to carry that id.
454
+ * - **opencode** names a turn by the user message it answers
455
+ * ({@link opencodeTurnRequestId}), but the user row itself is not written
456
+ * with a matching `oc-prompt:` marker — there is no such constant — so the
457
+ * same objection applies.
458
+ *
459
+ * Issue #2458 therefore shows a turn boundary for all five tools and a
460
+ * start-side time for these three only. That asymmetry is the contract, not a
461
+ * gap in it: the alternative is guessing which prompt opened a turn, and a
462
+ * guessed clock time is worse than no clock time.
463
+ */
464
+ const TURN_PREFIX_TO_PROMPT_PREFIX = [
465
+ [exports.CLAUDE_MARKDOWN_REQUEST_ID_PREFIX, exports.CLAUDE_PROMPT_REQUEST_ID_PREFIX],
466
+ [exports.ANTIGRAVITY_MARKDOWN_REQUEST_ID_PREFIX, exports.ANTIGRAVITY_PROMPT_REQUEST_ID_PREFIX],
467
+ [exports.COMMAND_CODE_MARKDOWN_REQUEST_ID_PREFIX, exports.COMMAND_CODE_PROMPT_REQUEST_ID_PREFIX],
468
+ ];
469
+ /**
470
+ * The turn a saved row belongs to, as a comparable key, or `null`.
471
+ *
472
+ * The key is the **whole `request_id`**, prefix included, and that is
473
+ * load-bearing: `antigravity-turn:53b7…#0` and `claude-turn:53b7…#0` are
474
+ * different turns even if the suffixes ever collided, and comparing suffixes
475
+ * alone would fold two tools' turns into one. It also means a caller never
476
+ * needs to know which prefix matched — which is the point of this helper
477
+ * existing at all, since Issue #2458's rule ("the key CHANGED") is a string
478
+ * comparison and nothing more.
479
+ *
480
+ * Conservative in exactly the way {@link isAgentAuthoredMarkdown} is:
481
+ *
482
+ * - a non-string (`undefined`, `null`, or a number that survived a bad
483
+ * round-trip) is unknown;
484
+ * - an unrecognised prefix — the scraper's `req_…`, a `claude-prompt:` user
485
+ * row, anything a future producer invents — is unknown;
486
+ * - a recognised prefix with an EMPTY or whitespace-only suffix is unknown.
487
+ * `claude-turn:` on its own names no turn, and treating it as one would make
488
+ * every such row read as the same turn as every other such row.
489
+ *
490
+ * "Unknown" never means "a new turn" at the call site: see
491
+ * `buildChatTranscriptRows`, which carries the last known key across unknown
492
+ * rows rather than letting one split a reply in half.
493
+ *
494
+ * @param requestId - `ChatMessage.requestId`, which is usually absent
495
+ * @returns The full `request_id`, or `null` when it names no known turn
496
+ */
497
+ function resolveAgentTurnKey(requestId) {
498
+ if (typeof requestId !== 'string')
499
+ return null;
500
+ for (const prefix of exports.AGENT_MARKDOWN_REQUEST_ID_PREFIXES) {
501
+ if (!requestId.startsWith(prefix))
502
+ continue;
503
+ return requestId.slice(prefix.length).trim().length === 0 ? null : requestId;
504
+ }
505
+ return null;
506
+ }
507
+ /**
508
+ * The `request_id` the **user row** of this turn would carry, or `null`.
509
+ *
510
+ * `claude-turn:<uuid>` → `claude-prompt:<uuid>`, and the same for antigravity
511
+ * and Command Code. `null` for codex, for opencode, and for anything that is
512
+ * not a turn key at all — see {@link TURN_PREFIX_TO_PROMPT_PREFIX} for why
513
+ * those two are refused rather than approximated.
514
+ *
515
+ * This is a pure rename of the id, not a lookup: whether a row with that id
516
+ * exists, is in the same scope, is on screen and is older than the reply are
517
+ * four separate questions the caller answers against the rows it actually has.
518
+ *
519
+ * @param turnKey - A key from {@link resolveAgentTurnKey}
520
+ * @returns The correlated prompt `request_id`, or `null` when none can be named
521
+ */
522
+ function correlatedPromptRequestId(turnKey) {
523
+ for (const [turnPrefix, promptPrefix] of TURN_PREFIX_TO_PROMPT_PREFIX) {
524
+ if (!turnKey.startsWith(turnPrefix))
525
+ continue;
526
+ const suffix = turnKey.slice(turnPrefix.length);
527
+ return suffix.trim().length === 0 ? null : `${promptPrefix}${suffix}`;
528
+ }
529
+ return null;
530
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commandmate",
3
- "version": "0.33.2",
3
+ "version": "0.34.0",
4
4
  "description": "A local control plane for agent CLIs — orchestration and visibility for Claude Code, Codex, Gemini CLI, and more across Git worktrees",
5
5
  "keywords": [
6
6
  "claude-code",
@@ -1 +0,0 @@
1
- "use strict";exports.id=1068,exports.ids=[1068,2839,5220],exports.modules={23197:(a,b,c)=>{c.d(b,{$M:()=>e,H1:()=>d,q5:()=>f});let d="__global__",e=2e3,f=900},39687:(a,b,c)=>{c.d(b,{d:()=>p});var d=c(56791),e=c(43234),f=c(15194),g=c(95220),h=c(12462),i=c(49640),j=c(54325),k=c(72626),l=c(58707),m=c(41466);let n=(0,k.h)("session/send-user-message");function o(a){return a instanceof Error?a.message:String(a)}async function p(a,b){let{worktreeId:c,content:k,cliToolId:p,instanceId:q,absoluteImagePath:r,copilotModel:s}=b,t=b.messageType??"normal",u=q??p,v=e.CLIToolManager.getInstance().getTool(p),w=await (0,l.a3)(c,p,q,{ignoreStructured:b.ignoreStructuredPromptGuard});if(w.waiting)return n.info("send-refused-prompt-waiting",{worktreeId:c,cliToolId:p,reason:w.reason,blockedBy:w.blockedBy}),{ok:!1,stage:"prompt_waiting",error:(0,l.br)(c,w.blockedBy)};let x=new Date;try{await (0,h.o4)(a,c,p,x,q)}catch(a){n.error("failed-to-save-pending-assistant-response:",{error:o(a)})}let y=null;try{let b=(0,d.getMessages)(a,c,{limit:1,cliToolId:p,instanceId:u,matchResolvedInstance:!0});b.length>0&&"user"===b[0].role&&b[0].content===k&&(y=b[0].id)}catch(a){n.error("failed-to-detect-orphaned-messages:",{error:o(a)})}if(s&&"copilot"===p)try{await v.sendModelCommand(c,s,q),n.info("copilot-model-command-sent",{model:s})}catch(a){return n.error("failed-to-send-model-command:",{error:o(a)}),{ok:!1,stage:"model",error:o(a)}}try{r?(0,f._J)(v)?await v.sendMessageWithImage(c,k,r,q):await v.sendMessage(c,(0,m.TZ)(k,r),q):await v.sendMessage(c,k,q)}catch(a){return n.error("failed-to-send-message-to:",{error:o(a)}),{ok:!1,stage:"send",error:o(a)}}let z=(0,d.createMessage)(a,{worktreeId:c,role:"user",content:k,messageType:t,timestamp:x,cliToolId:p,instanceId:q,requestId:b.requestId});try{(0,i.broadcastMessage)("message",{worktreeId:c,message:{...z,cliToolId:p,instanceId:u}})}catch(a){n.warn("user-message-broadcast-failed",{error:o(a)})}if(y)try{if((0,d.deleteMessageById)(a,y)){n.info("cleaned-up-orphaned-user");try{(0,i.broadcastMessage)(j.dz,{worktreeId:c,cliToolId:p,instanceId:u,reason:"orphan_cleanup"})}catch(a){n.warn("orphan-cleanup-broadcast-failed",{error:o(a)})}}}catch(a){n.error("failed-to-clean-up-orphaned-message:",{error:o(a)})}return(0,d.updateLastUserMessage)(a,c,k,x),(0,d.clearInProgressMessageId)(a,c,p,q),n.info("cleared-in-progress-message-for"),(0,g.startPolling)(c,p,q),{ok:!0,message:z}}},58707:(a,b,c)=>{c.d(b,{$n:()=>k,a3:()=>l,br:()=>m});var d=c(43234),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){let c=`${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>\`.`;if("structured"!==b)return c;let d=Math.round(i.j0/6e4);return`${c} 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 ${d} minutes after it was reported, or immediately with \`commandmate send ${a} <message> --ignore-structured-prompt\` (server-wide: ${i.F1}=off).`}},61068:(a,b,c)=>{c.d(b,{Nz:()=>u,EB:()=>v,l7:()=>x});var d=c(95220),e=c(45017),f=c(11099),g=c(85775),h=c(72626),i=c(43234),j=c(79892);let k=(0,h.h)("global-session-poller"),l=new Map,m=new Map;var n=c(93997),o=c(15194),p=c(23197),q=c(77093),r=c(82325);let s=(0,h.h)("session-cleanup");async function t(a,b){let c={worktreeId:a,sessionsKilled:[],sessionErrors:[],pollersStopped:[],pollerErrors:[]};for(let e of((0,n.pc)(),o.XH)){try{await b(a,e)&&(c.sessionsKilled.push(e),s.info("session:killed",{worktreeId:a,cliToolId:e}))}catch(d){let b=`${e}: ${(0,q.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,q.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._C)(a),c.pollersStopped.push("auto-yes-poller")}catch(d){let b=`auto-yes-poller: ${(0,q.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.LP)(a),c.pollersStopped.push("auto-yes-state")}catch(d){let b=`auto-yes-state: ${(0,q.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,q.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,q.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 u(a,b){let c=await Promise.allSettled(a.map(a=>t(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,q.u1)(f.reason)}`)}return{results:d,warnings:e}}async function v(a,b){try{let c=i.CLIToolManager.getInstance().getTool(b);if(!await c.isRunning(a))return!1;let e=`${a}:${b}`;(0,d.clearPromptHashCache)(e);let f=c.getSessionName(a);return(0,j.fY)(f)}catch{return!1}}async function w(){for(let a of l.keys()){let b=l.get(a);b&&clearTimeout(b)}l.clear(),m.clear(),k.info("poll:all-stopped");let a=0,b=i.CLIToolManager.getInstance();for(let c of o.XH)try{let d=b.getTool(c).getSessionName(p.H1);await (0,j.N)(d)&&await (0,j.fY)(d)&&(a++,s.info("global-session:killed",{cliToolId:c,sessionName:d}))}catch(a){s.warn("global-session:kill-failed",{cliToolId:c,error:(0,q.u1)(a)})}return a}async function x(a,b){let c=(0,r.L0)(a,b);try{await w()}catch(a){s.warn("sync:global-cleanup-failed",{error:(0,q.u1)(a)})}let d=[];if(c.deletedIds.length>0)try{let a=await u(c.deletedIds,v);a.warnings.length>0&&(s.warn("sync:cleanup-warnings",{warnings:a.warnings}),d=[`${a.warnings.length} session cleanup warning(s) occurred`])}catch(a){s.error("sync:cleanup-failed",{error:(0,q.u1)(a)}),d=["Session cleanup encountered an error"]}return{syncResult:c,cleanupWarnings:d}}},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:()=>o,x4:()=>m,xJ:()=>n});var d=c(34129),e=c(43234),f=c(88807),g=c(72626),h=c(87374),i=c(39687);let j=(0,g.h)("timer-manager");function k(){return globalThis.__timerManagerState||(globalThis.__timerManagerState={timers:new Map,timerWorktrees:new Map,initialized:!1}),globalThis.__timerManagerState}async function l(a){let b=k(),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;if(!await f.isRunning(b.worktreeId,g)){j.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 k=await (0,i.d)(c,{worktreeId:b.worktreeId,content:b.message,cliToolId:b.cliToolId,instanceId:g});if(!k.ok){let b=`[${k.stage}] ${k.error}`;(0,d.j2)(c,a,"failed",void 0,b),j.error("timer:send-failed",{timerId:a,stage:k.stage,error:k.error});return}(0,d.j2)(c,a,"sent",Date.now()),j.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{}j.error("timer:send-failed",{timerId:a,error:b})}finally{b.timers.delete(a),b.timerWorktrees.delete(a)}}function m(a,b,c){let d=k(),e=setTimeout(()=>{l(a)},c);d.timers.set(a,e),d.timerWorktrees.set(a,b)}function n(a){let b=k(),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 o(a){let b=k(),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)}},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 +0,0 @@
1
- "use strict";exports.id=153,exports.ids=[153],exports.modules={35613:(a,b,c)=>{c.d(b,{_M:()=>p});var d=c(32520),e=c(93356),f=c(26838);let g=new Set([301,302,303,307,308]);function h(a,b){let c;try{c=new URL(a)}catch{throw new e.q2(e.Fk.URL_INVALID,{reason:"malformed"})}if("https:"!==c.protocol)throw new e.q2(e.Fk.URL_INVALID,{reason:"scheme"});if(""!==c.username||""!==c.password)throw new e.q2(e.Fk.URL_INVALID,{reason:"userinfo"});if(""!==c.port)throw new e.q2(e.Fk.URL_INVALID,{reason:"port"});let d=c.hostname.toLowerCase(),f=b.find(a=>a.host===d);if(!f||void 0!==f.pathPrefix&&!c.pathname.startsWith(f.pathPrefix))throw new e.q2(e.Fk.SOURCE_NOT_ALLOWED,{host:d});return c}class i{constructor(a){this.controller=new AbortController,this.timedOut=!1,this.callerAborted=!1,this.onCallerAbort=()=>{this.callerAborted=!0,this.controller.abort()},this.totalTimer=setTimeout(()=>{this.timedOut=!0,this.controller.abort()},d.rV),a&&(this.callerSignal=a,a.aborted?this.onCallerAbort():a.addEventListener("abort",this.onCallerAbort,{once:!0}))}async withHeaderTimeout(a){let b=setTimeout(()=>{this.timedOut=!0,this.controller.abort()},d.WS);try{return await a()}finally{clearTimeout(b)}}dispose(){clearTimeout(this.totalTimer),this.callerSignal?.removeEventListener("abort",this.onCallerAbort)}translate(a){return a instanceof e.q2?a:new e.q2(this.timedOut?e.Fk.TIMEOUT:this.callerAborted?e.Fk.ABORTED:e.Fk.NETWORK)}}async function j(a){try{await a.body?.cancel()}catch{}}async function k(a,b,c){let i=h(a,b.entryHosts),k={accept:b.accept,"user-agent":`${d.gT}/${(0,f.Mj)()}`};for(let a=0;;a++){let f,l=await c.withHeaderTimeout(()=>fetch(i.toString(),{method:"GET",redirect:"manual",cache:"no-store",headers:k,signal:c.controller.signal}));if(!g.has(l.status))return l;let m=l.headers.get("location");if(await j(l),a>=d.KX)throw new e.q2(e.Fk.REDIRECT_LIMIT_EXCEEDED,{limit:d.KX});if(!m)throw new e.q2(e.Fk.REDIRECT_INVALID,{reason:"no-location"});try{f=new URL(m,i)}catch{throw new e.q2(e.Fk.REDIRECT_INVALID,{reason:"malformed"})}let n=h(f.toString(),b.redirectHosts);n.origin!==i.origin&&(k=function(a){let b={};for(let[c,e]of Object.entries(a))d.F5.includes(c.toLowerCase())||(b[c]=e);return b}(k)),i=n}}async function l(a,b){let c=a.body;if(!c)throw new e.q2(e.Fk.BODY_MISSING);let d=c.getReader(),f=(0,e.of)(),g=[],h=0;for(;;){let{done:a,value:c}=await d.read();if(a)break;if(c&&0!==c.byteLength){if((h+=c.byteLength)>b)throw await d.cancel().catch(()=>void 0),new e.q2(e.Fk.SIZE_LIMIT_EXCEEDED,{limit:b});f.update(c),g.push(c)}}return{bytes:Buffer.concat(g,h),sha256:f.hex(),size:h}}async function m(a,b,c={}){let f=d.Bi[b],g=new i(c.signal);try{let b=await k(a,f,g);try{!function(a,b,c){if(!a.ok)throw new e.q2(e.Fk.HTTP_STATUS,{status:a.status});let d=a.headers.get("content-type"),f=d?.split(";")[0]?.trim().toLowerCase()??"";if(!b.contentTypes.includes(f))throw new e.q2(e.Fk.CONTENT_TYPE_INVALID,{received:f||"<absent>"});let g=a.headers.get("content-length");if(null===g)return;let h=Number(g);if(!Number.isSafeInteger(h)||h<0)throw new e.q2(e.Fk.SIZE_MISMATCH,{reason:"content-length"});if(h>b.maxBytes)throw new e.q2(e.Fk.SIZE_LIMIT_EXCEEDED,{limit:b.maxBytes});if(void 0!==c&&h!==c)throw new e.q2(e.Fk.SIZE_MISMATCH,{expected:c,actual:h})}(b,f,c.expectedSize)}catch(a){throw await j(b),a}return await l(b,f.maxBytes)}catch(a){throw g.translate(a)}finally{g.dispose()}}let n=globalThis.__skillArtifactDownloads??(globalThis.__skillArtifactDownloads=new Map);async function o(a,b){let{artifact:c}=b,d=await m(c.url,"artifact",{expectedSize:c.size});return(0,e.Ld)({expectedSha256:c.sha256,expectedSize:c.size,actualSha256:d.sha256,actualSize:d.size}),{...d,skillId:a,version:b.version,commit:b.source.commit}}async function p(a,b,c={}){var d,f;(0,e.i1)(a,b);let g=`${a}@${b.version}#${b.artifact.sha256}`,h=n.get(g);return h||(h=o(a,b),n.set(g,h),h.catch(()=>void 0).finally(()=>{n.get(g)===h&&n.delete(g)})),c.signal?(d=h,(f=c.signal).aborted?Promise.reject(new e.q2(e.Fk.ABORTED)):new Promise((a,b)=>{let c=()=>b(new e.q2(e.Fk.ABORTED));f.addEventListener("abort",c,{once:!0}),d.then(b=>{f.removeEventListener("abort",c),a(b)},a=>{f.removeEventListener("abort",c),b(a)})})):h}},88573:(a,b,c)=>{c.d(b,{Lw:()=>s});let d="https://raw.githubusercontent.com/Kewton/commandmate-skills/main/catalog/v1/catalog.json",e=[d],f=/^[A-Za-z0-9/+=_."-]{1,128}$/;var g=c(72626),h=c(13075);let i=(0,g.h)("lib/skills/catalog-client"),j={FETCH_FAILED:"SKILL_CATALOG_FETCH_FAILED",RATE_LIMITED:"SKILL_CATALOG_RATE_LIMITED",OVERSIZED:"SKILL_CATALOG_OVERSIZED",MALFORMED:"SKILL_CATALOG_MALFORMED",INVALID_SCHEMA:"SKILL_CATALOG_INVALID_SCHEMA"},k=globalThis.__skillCatalogCache??={catalog:null,validatedAt:0,confirmedAt:0,etag:null,revision:null,rateLimitResetAt:null,inflight:null};class l extends Error{}let m={[j.FETCH_FAILED]:"The Skill Catalog could not be retrieved.",[j.RATE_LIMITED]:"The Skill Catalog origin is rate limiting requests.",[j.OVERSIZED]:"The Skill Catalog response exceeded the allowed size.",[j.MALFORMED]:"The Skill Catalog response was not valid JSON.",[j.INVALID_SCHEMA]:"The Skill Catalog response did not match the supported Catalog schema."};function n(a){return new Date(a).toISOString()}function o(a,b,c){return{catalog:a,fetchedAt:n(k.validatedAt),revalidatedAt:n(k.confirmedAt),state:b,stale:"stale"===b,offline:"stale"===b,staleReason:c,source:{repository:"Kewton/commandmate-skills",ref:"main",revision:k.revision}}}function p(a,b=[]){return k.catalog?{ok:!0,snapshot:o(k.catalog,"stale",a)}:{ok:!1,failure:{code:a,message:m[a],errors:b}}}async function q(a,b){let c=a.headers.get("Content-Length");if(null!==c){let a=Number(c);if(!Number.isFinite(a)||a<0||a>b)throw new l("content-length out of bounds")}let d=a.body;if(!d||"function"!=typeof d.getReader){let c=await a.text();if(new TextEncoder().encode(c).length>b)throw new l("body exceeded size cap");return c}let e=d.getReader(),f=[],g=0;for(;;){let{done:a,value:c}=await e.read();if(a)break;if(c){if((g+=c.byteLength)>b)throw await e.cancel(),new l("body exceeded size cap");f.push(c)}}let h=new Uint8Array(g),i=0;for(let a of f)h.set(a,i),i+=a.byteLength;return new TextDecoder("utf-8").decode(h)}async function r(a){let b,c,g;if(!e.includes(d))return p(j.FETCH_FAILED);let m={Accept:"application/json","User-Agent":`CommandMate/${a}`};null!==k.catalog&&null!==k.etag&&(m["If-None-Match"]=k.etag);try{b=await fetch(d,{headers:m,cache:"no-store",signal:AbortSignal.timeout(5e3)})}catch{return i.warn("catalog-fetch-failed",{reason:j.FETCH_FAILED}),p(j.FETCH_FAILED)}if(304===b.status&&null!==k.catalog)return k.confirmedAt=Date.now(),{ok:!0,snapshot:o(k.catalog,"revalidated",null)};if(403===b.status||429===b.status)return!function(a){let b=Date.now(),c=b+864e5,d=a.headers.get("X-RateLimit-Reset");if(null!==d){let a=Number(d);if(Number.isFinite(a)&&a>0){k.rateLimitResetAt=Math.min(1e3*a,c);return}}let e=a.headers.get("Retry-After");if(null!==e){let a=Number(e);if(Number.isFinite(a)&&a>0){k.rateLimitResetAt=Math.min(b+1e3*a,c);return}}k.rateLimitResetAt=b+36e5}(b),i.warn("catalog-rate-limited",{status:b.status}),p(j.RATE_LIMITED);if(!b.ok)return i.warn("catalog-fetch-failed",{status:b.status}),p(j.FETCH_FAILED);try{c=await q(b,1048576)}catch(b){let a=b instanceof l?j.OVERSIZED:j.FETCH_FAILED;return i.warn("catalog-body-rejected",{reason:a}),p(a)}try{g=JSON.parse(c)}catch{return i.warn("catalog-malformed",{reason:j.MALFORMED}),p(j.MALFORMED)}let n=(0,h.JJ)(g);if(!n.ok)return i.warn("catalog-invalid-schema",{errorCount:n.errors.length}),p(j.INVALID_SCHEMA,n.errors);let r=Date.now();return k.catalog=n.value,k.validatedAt=r,k.confirmedAt=r,k.etag=b.headers.get("ETag"),k.revision=function(a){if(null===a)return null;let b=a.trim();return f.test(b)?b:null}(k.etag),{ok:!0,snapshot:o(n.value,"fresh",null)}}async function s(a={}){let{hostVersion:b="0.0.0",forceRevalidate:c=!1}=a;return!c&&null!==k.catalog&&Date.now()-k.confirmedAt<9e5&&null!==k.catalog?{ok:!0,snapshot:o(k.catalog,"cached",null)}:null!==k.rateLimitResetAt&&(!(Date.now()>=k.rateLimitResetAt)||(k.rateLimitResetAt=null,0))?p(j.RATE_LIMITED):(null===k.inflight&&(k.inflight=r(b).finally(()=>{k.inflight=null})),k.inflight)}}};
@@ -1 +0,0 @@
1
- "use strict";exports.id=4299,exports.ids=[4299],exports.modules={8953:(a,b,c)=>{c.d(b,{Mx:()=>f,pU:()=>e,qD:()=>d,sM:()=>i});let d=["Up","Down","Left","Right","Enter","Escape","Tab","BTab","PageUp","PageDown","Home","End","q","1","2","3","4","5","6","7","8","9","y","n"],e=[...d,"s"],f="C-x",g=["C-p","C-t"],h=["a","l","t","m","g","u","r","c"],i=[...d,f,...g,...h];[...d,...g,...h]},31442:(a,b,c)=>{c.d(b,{$D:()=>u,Bl:()=>z,Fk:()=>s,HL:()=>e,Ix:()=>y,KB:()=>t,L0:()=>k,Ls:()=>L,N2:()=>m,ND:()=>p,N_:()=>g,RS:()=>N,Rr:()=>J,Ys:()=>r,bq:()=>n,cD:()=>q,eC:()=>h,g4:()=>K,gM:()=>E,jp:()=>i,jx:()=>F,lY:()=>o,n9:()=>B,om:()=>v,sL:()=>M,tx:()=>l,wv:()=>j});var d=c(16983);let e="mcbd-";function f(a){return`=${a}:`}function g(a){return a.startsWith(e)}let h="@cm_status",i="@cm_worktree",j="@cm_tool",k="@cm_instance",l="@cm_updated",m="@cm_delegated",n=[h,i,j,k,l,m],o="[CommandMate #{@cm_tool}/#{@cm_instance} #{@cm_status}] #{window_width}x#{window_height}";function p(a,b,c){return["set-option","-t",f(a),b,c]}function q(a,b){return["set-option","-u","-t",f(a),b]}function r(a,b){return["show-options","-t",f(a),b]}function s(a,b){return["show-options","-v","-t",f(a),b]}function t(a,b){return p(a,"status-right",b)}function u(a){return q(a,"status-right")}function v(a=process.env){let b=(a.CM_TMUX_STATUS??"").trim().toLowerCase();return"off"!==b&&"0"!==b&&"false"!==b}function w(a,b,c){return["set-hook","-t",f(a),b,c]}function x(a,b){return["set-hook","-u","-t",f(a),b]}function y(a){return["list-clients","-t",f(a),"-F","#{client_control_mode}"]}function z(a){return a.split("\n").map(a=>a.trim()).filter(a=>"0"===a).length}let A=["claude"];function B(a){return!!g(a)&&A.some(b=>a.startsWith(`${e}${b}-`))}let C="client-attached[0]",D="client-attached[1]";function E(a=process.env){return"on"===(a.CM_LIVE_ATTACH_HOOK??"").trim().toLowerCase()}function F(a=process.env){return"on"===(a.CM_READ_MODE_AUTO_POPUP??"").trim().toLowerCase()}function G(a){if(!/["$`\\\n\r]/.test(a))return`"${a}"`}function H(a,b,c=[]){let d=[a,...b,...c].join(" ");return`run-shell -b '${d}'`}let I=["#{session_name}","#{client_control_mode}","#{client_name}"];function J(a,b){let c=G(b);if(void 0!==c)return w(a,C,H(c,I))}function K(a){return x(a,C)}function L(a,b){let c=G(b);if(void 0!==c)return w(a,D,H(c,I))}function M(a){return x(a,D)}function N(a,b=d.Jn,c=d.sO){return[["set-window-option","-t",f(a),"window-size","manual"],["resize-window","-t",f(a),"-x",String(b),"-y",String(c)],q(a,m)]}},40964:(a,b,c)=>{c.d(b,{m:()=>g});var d=c(15194);let e=/^[a-zA-Z0-9_-]+$/;function f(a){if(!e.test(a))throw Error(`Invalid session name format: ${a}`)}function g(a,b,c){let e=`mcbd-${a}-${b}`;if(!c||c===a)return f(e),e;let g=(0,d.pL)(c,a),h=g?`${e}-${g}`:e;return f(h),h}},79892:(a,b,c)=>{c.d(b,{Xg:()=>w,ou:()=>B,Ce:()=>A,jw:()=>s,lA:()=>n,nS:()=>q,N:()=>p,N6:()=>C,fY:()=>x,GW:()=>r,zT:()=>o,V1:()=>t,ds:()=>z,KB:()=>v,Sb:()=>D});var d=c(79646),e=c(28354),f=c(93997),g=c(83598),h=c(16983),i=c(72626),j=c(8953),k=c(86069);let l=(0,e.promisify)(d.execFile),m=(0,i.h)("tmux");function n(a){return`=${a}:`}async function o(a,b={}){let c,d,e,f=b.windowWidth??h.Jn,i=b.windowHeight??h.sO,j=n(a);try{c=(await l("tmux",["show-window-options","-v","-t",j,"window-size"],{timeout:5e3})).stdout.trim();let[a,b]=(await l("tmux",["display-message","-p","-t",j,"#{window_width}|#{window_height}"],{timeout:5e3})).stdout.trim().split("|").map(Number);Number.isFinite(a)&&(d=a),Number.isFinite(b)&&(e=b)}catch{}let k="manual"===c,p=d===f&&e===i;if(k&&p)return!1;if((b.respectAttachedClient??!0)&&await (0,g.Fh)(a))return m.info("session-geometry:delegated-to-client",{sessionName:a}),!1;try{return k||await l("tmux",["set-window-option","-t",j,"window-size","manual"],{timeout:5e3}),p||await l("tmux",["resize-window","-t",j,"-x",String(f),"-y",String(i)],{timeout:5e3}),!0}catch(b){return m.warn("session-geometry:reconcile-failed",{sessionName:a,error:b instanceof Error?b.message:String(b)}),!1}}async function p(a){try{return await l("tmux",["has-session","-t",n(a)],{timeout:5e3}),!0}catch{return!1}}async function q(a){try{let{stdout:b}=await l("tmux",["display-message","-p","-t",n(a),"#{session_path}"],{timeout:5e3}),c=b.trim();return""===c?null:c}catch{return null}}async function r(){try{let{stdout:a}=await l("tmux",["list-sessions","-F","#{session_name}|#{session_windows}|#{session_attached}"],{timeout:5e3});if(!a||""===a.trim())return[];return a.trim().split("\n").map(a=>{let[b,c,d]=a.split("|");return{name:b,windows:parseInt(c,10)||0,attached:"1"===d}})}catch{return[]}}async function s(a,b){let c,d,e,f,g;"string"==typeof a?(c=a,d=b,e=h.eu,f=h.Jn,g=h.sO):(c=a.sessionName,d=a.workingDirectory,e=a.historyLimit||h.eu,f=a.windowWidth||h.Jn,g=a.windowHeight||h.sO);try{await l("tmux",["new-session","-d","-s",c,"-c",d,"-x",String(f),"-y",String(g)],{timeout:5e3}),await l("tmux",["set-option","-t",n(c),"history-limit",String(e)],{timeout:5e3});try{await l("tmux",["new-window","-k","-t",`${n(c)}0`,"-c",d],{timeout:5e3})}catch(a){m.warn("session-history-limit:window-rebuild-failed",{sessionName:c,historyLimit:e,error:a instanceof Error?a.message:String(a)})}await o(c,{windowWidth:f,windowHeight:g,respectAttachedClient:!1})}catch(b){let a=b instanceof Error?b.message:String(b);throw Error(`Failed to create tmux session: ${a}`)}}async function t(a,b,c=!0,d){if(d?.literal&&c)throw Error("sendKeys: { literal: true } cannot be combined with sendEnter — a trailing C-m would be typed as text. Send Enter as a separate key.");let e=d?.literal?function(a,b){if("literal"===b.kind)return["send-keys","-t",a,"-l","--",b.text];if(!(0,k.vY)(b.name))throw Error(`Invalid key sequence key name: ${b.name}`);return["send-keys","-t",a,"--",b.name]}(n(a),{kind:"literal",text:b}):c?["send-keys","-t",n(a),b,"C-m"]:["send-keys","-t",n(a),b];try{await l("tmux",e,{timeout:5e3})}catch(b){let a=b instanceof Error?b.message:String(b);throw Error(`Failed to send keys to tmux session: ${a}`)}}let u=new Set(["Up","Down","Left","Right","Enter","Space","Tab","Escape","BTab","BSpace","DC","PageUp","PageDown","Home","End","q","1","2","3","4","5","6","7","8","9","y","s","C-x","C-p","C-t","a","l","n","t","m","g","u","r","c"]);async function v(a,b){if(0!==b.length){for(let a of b)if(!u.has(a))throw Error(`Invalid special key: ${a}`);try{for(let c=0;c<b.length;c++)await l("tmux",["send-keys","-t",n(a),b[c]],{timeout:5e3}),c<b.length-1&&await new Promise(a=>setTimeout(a,100))}catch(b){let a=b instanceof Error?b.message:String(b);throw Error(`Failed to send special keys to tmux session: ${a}`)}}}async function w(a,b){let c,d;"number"==typeof b?(c=-b,d="-"):b?(c=b.startLine??-1e4,d=b.endLine??"-"):(c=-1e3,d="-");try{let{stdout:b}=await l("tmux",["capture-pane","-t",n(a),"-p","-e","-S",String(c),"-E",String(d)],{timeout:5e3,maxBuffer:0xa00000});return b}catch(b){let a=b instanceof Error?b.message:String(b);throw Error(`Failed to capture pane: ${a}`)}}async function x(a){try{return await l("tmux",["kill-session","-t",n(a)],{timeout:5e3}),!0}catch(b){let a=b instanceof Error?b.message:String(b);if(a?.includes("no server running")||a?.includes("can't find session"))return!1;throw Error(`Failed to kill tmux session: ${a}`)}}let y=new Set(["Escape","C-c","C-d","C-m","Enter"]);async function z(a,b){if(!y.has(b))throw Error(`Invalid special key: ${b}`);try{await l("tmux",["send-keys","-t",n(a),b],{timeout:5e3})}catch(b){let a=b instanceof Error?b.message:String(b);throw Error(`Failed to send special key: ${a}`)}}async function A(a){try{await l("tmux",["send-keys","-t",n(a),"C-u"],{timeout:5e3})}catch(b){let a=b instanceof Error?b.message:String(b);throw Error(`Failed to clear tmux input line: ${a}`)}}async function B(a){try{await l("tmux",["send-keys","-t",n(a),"C-e","C-u"],{timeout:5e3})}catch(b){let a=b instanceof Error?b.message:String(b);throw Error(`Failed to clear tmux composer line: ${a}`)}}function C(a,b=j.qD){return b.includes(a)&&u.has(a)}async function D(a,b){await v(a,b),(0,f.gm)(a);let c=setTimeout(()=>(0,f.gm)(a),250);c.unref?.()}},83598:(a,b,c)=>{c.d(b,{Fh:()=>l,G9:()=>m,Us:()=>j,zQ:()=>k});var d=c(79646),e=c(28354),f=c(31442);let g=(0,e.promisify)(d.execFile),h=globalThis.__cmGeometryDelegationCache??(globalThis.__cmGeometryDelegationCache=new Map),i=globalThis.__cmGeometryDelegationEdge??(globalThis.__cmGeometryDelegationEdge=new Map);async function j(a,b=Date.now()){let c=h.get(a);if(c&&b-c.readAt<1e3)return c.delegated;let d=!1;try{let{stdout:b}=await g("tmux",(0,f.Fk)(a,f.N2),{timeout:5e3});d="1"===b.trim()}catch{d=!1}return h.set(a,{delegated:d,readAt:b}),d}async function k(a,b=Date.now()){let c=await j(a,b),d=i.get(a)??!1;return i.set(a,c),{delegated:c,released:d&&!c}}async function l(a){try{let{stdout:b}=await g("tmux",(0,f.Ix)(a),{timeout:5e3});return(0,f.Bl)(b)>0}catch{return!1}}function m(a){h.delete(a),i.delete(a)}},86069:(a,b,c)=>{c.d(b,{IS:()=>e,iF:()=>f,vY:()=>g});let d=["Escape","C-c","C-d","C-m","Enter"];function e(a,b){return void 0===b?{kind:"key",name:a}:{kind:"key",name:a,delayAfterMs:b}}function f(a,b){return void 0===b?{kind:"literal",text:a}:{kind:"literal",text:a,delayAfterMs:b}}function g(a){return d.includes(a)}},93997:(a,b,c)=>{c.d(b,{aq:()=>m,gm:()=>k,pc:()=>l,sl:()=>f,vF:()=>j,wd:()=>i,xE:()=>e});let d=(0,c(72626).h)("tmux-capture-cache"),e=1e4;function f(a,b=e){return b>0&&a>=b}function g(){return globalThis.__tmuxCaptureCache??=new Map}function h(){return globalThis.__tmuxCaptureCacheInflight??=new Map}function i(a,b){if(""===a)return"";let c=a.split("\n");return b>=c.length?a:c.slice(-b).join("\n")}function j(a,b,c){let d=g(),e=Date.now();for(let[a,b]of d)e-b.timestamp>5e3&&d.delete(a);if(d.size>=100&&!d.has(a)){let a=null,b=1/0;for(let[c,e]of d)e.timestamp<b&&(b=e.timestamp,a=c);a&&d.delete(a)}d.set(a,{output:b,capturedLines:c,timestamp:e})}function k(a){g().delete(a),d.debug("cache:invalidate",{sessionName:a})}function l(){g().clear(),h().clear()}async function m(a,b,c){let d=function(a,b){let c=g(),d=c.get(a);return d?Date.now()-d.timestamp>5e3?(c.delete(a),null):b>d.capturedLines?null:i(d.output,b):null}(a,b);if(null!==d)return d;let f=h(),k=f.get(a);if(k)return i(await k,b);let l=c();f.set(a,l);try{let c=await l;return c.length>0&&j(a,c,e),i(c,b)}finally{f.delete(a)}}}};
@@ -1 +0,0 @@
1
- "use strict";exports.id=6808,exports.ids=[6808],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()}}},7329:(a,b,c)=>{c.d(b,{Hv:()=>m,W3:()=>k,uK:()=>l});var d=c(90787),e=c(52660),f=c(18201),g=c(23854),h=c(49798),i=c(67164);let j=(0,c(72626).h)("relay-service");function k(a,b){for(let c of[b.from.worktreeId,b.to.worktreeId])if(!(0,h.r)(a,c))return{ok:!1,refusal:{code:"RELAY_WORKTREE_NOT_FOUND",message:`Worktree '${c}' not found`,worktreeId:c}};let c=(0,g.$G)({from:b.from,to:b.to,parentHops:function(a,b){try{let g=(0,h.S)(a,b),i=(0,e.getMessages)(a,b.worktreeId,{limit:5,limitUnit:"pairs",cliToolId:g.cliToolId,instanceId:b.instanceId,matchResolvedInstance:!0}).filter(a=>"user"===a.role),j=i.findIndex(a=>"relay"===a.messageType);if(-1===j)return null;let k=i[j];for(let a=0;a<j;a+=1){var c;if(c=i[a],c.timestamp.getTime()<k.timestamp.getTime()||(0,f.pk)(c.content)!==(0,f.pk)(k.content))return null}let l=(0,e.parseRelayRequestId)(k.requestId);if(!l)return null;return(0,d.Ip)(a,l)?.hops??null}catch(a){return j.warn("relay-parent-lookup-failed",{worktreeId:b.worktreeId,instanceId:b.instanceId,error:a instanceof Error?a.message:String(a)}),null}}(a,b.from),allowRelayChain:!0===b.allowRelayChain,openBetween:(0,d.Oz)(a,b.from,b.to)});if((0,g.Qe)(c))return{ok:!1,refusal:c};let k=b.now??Date.now(),l=(0,d.CR)(a,{from:b.from,to:b.to,hops:c.hops,expiresAt:k+(0,g.AL)(b.ttlMs),now:k});return j.info("relay-opened",{relayId:l.id,from:`${l.from.worktreeId}/${l.from.instanceId}`,to:`${l.to.worktreeId}/${l.to.instanceId}`,hops:l.hops}),(0,i._)(a,l.id,"requested",(0,h.S)(a,l.from),(0,h.S)(a,l.to),k),{ok:!0,relay:l}}function l(a,b,c=Date.now()){let e=(0,d.Ip)(a,b);return e?(0,d.m_)(a,b,c)?(j.info("relay-cancelled",{relayId:b}),{ok:!0,relay:(0,d.Ip)(a,b)??e}):{ok:!1,reason:"already_closed",relay:e}:{ok:!1,reason:"not_found",relay:null}}function m(a,b){return(0,d.M4)(a,b)}},18201:(a,b,c)=>{c.d(b,{Ce:()=>g,pk:()=>e});let d=(0,c(72626).h)("lib/history/user-turn-recorder");function e(a){return a.replace(/\r\n?/g,"\n").split("\n").map(a=>a.replace(/[ \t ]+$/u,"")).join("\n").trim()}function f(a){return{worktreeId:a.worktreeId,cliToolId:a.cliToolId,instanceId:a.instanceId??a.cliToolId}}async function g(a,b,h,i,j={}){let k=a.instanceId??a.cliToolId,l=e(h);if(0===b.length||0===l.length)return{outcome:"skipped",messageId:null,timestampMs:null};try{let[{getDbInstance:g},m,{broadcastMessage:n}]=await Promise.all([Promise.resolve().then(c.bind(c,88807)),Promise.resolve().then(c.bind(c,52660)),Promise.resolve().then(c.bind(c,49640))]),o=g(),p=m.findMessageByRequestId(o,a.worktreeId,b);if(p)return{outcome:"already-recorded",messageId:p.id,timestampMs:p.timestamp.getTime()};let q=i>0?i:Date.now(),r=function(a,b,c,g,h,i,j,k){var l,m,n;let o=Math.min(j-12e4,k.adoptionFromMs??1/0),p=(l=a.findUnkeyedUserMessages(b,{worktreeId:c.worktreeId,cliToolId:c.cliToolId,instanceId:g,fromMs:o,toMs:j+12e4,includeRelayDelivered:!0}),m=i,n=j,l.filter(a=>e(a.content)===m).sort((a,b)=>Math.abs(a.timestamp.getTime()-n)-Math.abs(b.timestamp.getTime()-n)));for(let e of p)if(!e.requestId&&a.setMessageRequestId(b,e.id,h))return d.info("user-turn-adopted",{...f(c),requestId:h,messageId:e.id,driftMs:e.timestamp.getTime()-j}),{outcome:"adopted",messageId:e.id,timestampMs:e.timestamp.getTime()};let q=p.find(a=>a.requestId);return q?(d.info("user-turn-already-relayed",{...f(c),requestId:h,messageId:q.id,relayRequestId:q.requestId??null,driftMs:q.timestamp.getTime()-j}),{outcome:"already-recorded",messageId:q.id,timestampMs:q.timestamp.getTime()}):null}(m,o,a,k,b,l,q,j);if(r)return r;let s=m.createMessage(o,{worktreeId:a.worktreeId,role:"user",content:h,messageType:"normal",timestamp:new Date(q),cliToolId:a.cliToolId,instanceId:k,requestId:b});return n("message",{worktreeId:a.worktreeId,message:s}),d.info("user-turn-recorded",{...f(a),requestId:b,contentLength:h.length}),{outcome:"inserted",messageId:s.id,timestampMs:q}}catch(c){return d.error("user-turn-record-failed",{...f(a),requestId:b,error:c instanceof Error?c.message:String(c)}),{outcome:"failed",messageId:null,timestampMs:null}}}},95736:(a,b,c)=>{a.exports=c(44870)}};
@@ -1 +0,0 @@
1
- "use strict";exports.id=6838,exports.ids=[6838],exports.modules={26838:(a,b,c)=>{c.d(b,{E2:()=>o,Mj:()=>m,Sw:()=>l,lX:()=>p});var d=c(29021),e=c(33873),f=c(54325),g=c(90164);let h=/^v?\d+\.\d+\.\d+$/,i=/^[a-zA-Z0-9.\-\s_v]+$/,j=[".next","required-server-files.json"],k=globalThis.__versionCheckCache??(globalThis.__versionCheckCache={result:null,fetchedAt:0,rateLimitResetAt:null});function l(){return function(){try{let a=(0,d.readFileSync)((0,e.join)(process.cwd(),"package.json"),"utf-8"),b=JSON.parse(a);if("commandmate"===b.name&&"string"==typeof b.version&&b.version.length>0)return b.version;return null}catch{return null}}()??"0.33.2"}function m(){return l()}let n=null;function o(a){let b=n??=function(){{let a=function(){try{let a=(0,d.readFileSync)((0,e.join)(process.cwd(),...j),"utf-8"),b=JSON.parse(a),c=b.config?.env?.NEXT_PUBLIC_APP_VERSION;if("string"==typeof c&&c.length>0)return c;return null}catch{return null}}();if(a)return a}return"0.33.2"}();return(0,f.LE)(b,a)?{serverVersion:b,clientVersion:a}:null}async function p(){try{var a,b,c;if(null!==k.result&&Date.now()-k.fetchedAt<36e5||k.rateLimitResetAt&&(!(Date.now()>=k.rateLimitResetAt)||(k.rateLimitResetAt=null,0)))return k.result;let d=await fetch("https://api.github.com/repos/Kewton/CommandMate/releases/latest",{headers:{Accept:"application/vnd.github+json","User-Agent":`CommandMate/${m()}`},cache:"no-store",signal:AbortSignal.timeout(5e3)});if(403===d.status)return function(a){let b=a.headers.get("X-RateLimit-Reset");b?k.rateLimitResetAt=1e3*parseInt(b,10):k.rateLimitResetAt=Date.now()+36e5}(d),k.result;if(!d.ok)return k.result;let e=await d.json(),f=m(),j=e.tag_name.replace(/^v/,""),l={hasUpdate:function(a,b){if(!h.test(a)||!h.test(b))return!1;let c=a=>a.replace(/^v/,"").split(".").map(Number),[d,e,f]=c(a),[g,i,j]=c(b);return g!==d?g>d:i!==e?i>e:j>f}(f,e.tag_name),currentVersion:f,latestVersion:j,releaseUrl:(a=e.html_url).startsWith(g.Dk)?a:null,releaseName:(b=e.name,c=e.tag_name,i.test(b)&&b.length<=128?b:c),publishedAt:e.published_at};return k.result=l,k.fetchedAt=Date.now(),l}catch{return k.result}}},54325:(a,b,c)=>{c.d(b,{LE:()=>f,Oo:()=>e,ST:()=>d,T4:()=>k,dz:()=>j,r9:()=>h,rx:()=>i,rz:()=>g});let d="client_version",e="version_mismatch";function f(a,b){return!!a&&!!b&&"0.0.0"!==a&&"0.0.0"!==b&&a!==b}let g="chat_turn_progress",h=1e3;function i(a,b=65536){return b<=0?{body:"",truncated:a.length>0}:a.length<=b?{body:a,truncated:!1}:{body:a.slice(a.length-b),truncated:!0}}let j="messages_invalidated",k="model_changed"},90164:(a,b,c)=>{c.d(b,{Dk:()=>e,kD:()=>f});let d="https://github.com/Kewton/CommandMate",e=`${d}/releases/`,f=`${d}/blob/main/docs/security-guide.md`}};
@@ -1,5 +0,0 @@
1
- "use strict";exports.id=7366,exports.ids=[7366],exports.modules={49987:(a,b,c)=>{c.d(b,{H:()=>l,Iq:()=>i,M:()=>k,xL:()=>o});var d=c(29021),e=c(21820),f=c(33873),g=c(55511);let h=(0,c(72626).h)("lib/verification/machine-lock"),i="locks",j="owner";function k(a,b){return(0,f.join)(b,`${a}.lock`)}function l(a=process.env){let b=a.CM_VERIFY_LOCK_ROOT;return b&&""!==b.trim()?b:(0,f.join)((0,e.homedir)(),".commandmate",i)}function m(a){try{let b=JSON.parse((0,d.readFileSync)((0,f.join)(a,j),"utf8"));if("number"!=typeof b.pid||"string"!=typeof b.token)return null;return{pid:b.pid,host:"string"==typeof b.host?b.host:"",token:b.token,acquiredAt:"number"==typeof b.acquiredAt?b.acquiredAt:0}}catch{return null}}function n(a){return a?`pid ${a.pid} on ${a.host||"unknown host"}`:null}async function o(a,b){let c=b.root??l(),i=b.pollIntervalMs??250,o=k(a,c),p=Date.now(),q=p+Math.max(0,b.timeoutMs),r=(0,g.randomUUID)();(0,d.mkdirSync)(c,{recursive:!0});let s=new Set;for(;;){if(b.shouldAbandon?.())return{acquired:!1,waitedMs:Date.now()-p,heldBy:n(m(o)),abandoned:!0};if(function(a,b){try{(0,d.mkdirSync)(a)}catch(a){if("EEXIST"===a.code)return!1;throw a}return(0,d.writeFileSync)((0,f.join)(a,j),JSON.stringify(b),{encoding:"utf8"}),!0}(o,{pid:process.pid,host:(0,e.hostname)(),token:r,acquiredAt:Date.now()}))return{acquired:!0,waitedMs:Date.now()-p,handle:{name:a,path:o,release:()=>{let a=m(o);if(!a||a.token===r)try{(0,d.rmSync)(o,{recursive:!0,force:!0})}catch(a){h.warn("machine-lock-release-failed",{lockPath:o,error:a instanceof Error?a.message:String(a)})}}}};let c=m(o);if(c&&!s.has(c.token)&&function(a){if(a.host!==(0,e.hostname)())return!1;try{return process.kill(a.pid,0),!1}catch(a){return"ESRCH"===a.code}}(c)){s.add(c.token);let a=m(o);if(a&&a.token===c.token)try{(0,d.rmSync)(o,{recursive:!0,force:!0}),h.warn("machine-lock-broken-stale",{lockPath:o,pid:c.pid})}catch{}continue}let g=Date.now();if(g>=q)return{acquired:!1,waitedMs:g-p,heldBy:n(c)};await function(a){return new Promise(b=>setTimeout(b,a))}(Math.min(i,q-g))}}},53604:(a,b,c)=>{c.d(b,{Cr:()=>k,L8:()=>i});var d=c(55511),e=c(29021),f=c(21820),g=c(33873);let h=(0,c(72626).h)("lib/verification/worktree-index"),i="worktree-index";function j(a,b){try{return(0,e.readFileSync)((0,g.join)(a,b),"utf8").trim()}catch{return null}}function k(a,b={}){let c=b.root??function(a=process.env){let b=a.CM_VERIFY_WORKTREE_INDEX_ROOT;return b&&""!==b.trim()?b:(0,g.join)((0,f.homedir)(),".commandmate",i)}();try{(0,e.mkdirSync)(c,{recursive:!0});let b=new Set;for(let d of(0,e.readdirSync)(c))if(/^\d+$/.test(d)){if(j(c,d)===a)return Number(d);b.add(Number(d))}for(let d=0;d<1024;d++)if(!b.has(d)&&function(a,b,c){try{return(0,e.writeFileSync)((0,g.join)(a,String(b)),`${c}
2
- `,{encoding:"utf8",flag:"wx"}),!0}catch(d){if("EEXIST"!==d.code)throw d;return j(a,String(b))===c}}(c,d,a))return d;h.warn("worktree-index-exhausted",{worktreeId:a,root:c})}catch(b){h.warn("worktree-index-unavailable",{worktreeId:a,root:c,error:b instanceof Error?b.message:String(b)})}return Number.parseInt((0,d.createHash)("sha256").update(a).digest("hex").slice(0,8),16)%1024}},74985:(a,b,c)=>{c.d(b,{Uq:()=>i,uT:()=>n});var d=c(33873),e=c(15194),f=c(77142),g=c(90384);let h=`options.requireEnvClean (${g.aT})`;function i(a,b){let c=[];return b?.options.requireEnvClean&&c.push(h),a&&!0===a.success.requireEnvClean&&c.push("success.requireEnvClean (task contract)"),{required:c.length>0,sources:c}}let j=[...e.XH].sort((a,b)=>b.length-a.length);function k(a,b,c){switch(a){case"tmux-sessions":return function(a,b){if(!a.startsWith(f.HL))return"unattributed";let c=a.slice(f.HL.length),d=j.find(a=>c.startsWith(`${a}-`));if(!d)return"unattributed";let e=c.slice(d.length+1);return e===b||e.startsWith(`${b}-`)?"self":"other"}(b.key,c.worktreeId);case"listeners":return function(a,b){if(!a)return"unattributed";let c=(0,d.resolve)(b),e=(0,d.resolve)(a);if(e===c||e.startsWith(c+d.sep))return"self";let f=(0,d.dirname)(c);return e!==f&&e.startsWith(f+d.sep)?"other":"unattributed"}(b.anchor,c.worktreePath);default:return"unattributed"}}function l(a,b){return{key:a.key,detail:a.detail,owner:b}}function m(a,b){let c=b.slice(0,25),d=b.length-c.length,e=c.map(b=>{let c=b.detail?` ${b.detail}`:"";return` ${a} ${b.key}${c} [${b.owner}]`});return d>0&&e.push(` ... and ${d} more`),e}async function n(a){let b,c=Date.now(),d=(a,b,d)=>({status:a,exitCode:d,startedAt:c,durationMs:Date.now()-c,logTail:b});if(!a.baseline)return d("error",function(a,b){let c=a?`task ${a}`:"this run",d=b.length>0?b.join(" and "):"nothing";return`${g.Q5}: UNKNOWN — no baseline snapshot exists for ${c}, so nothing can be compared. This is NOT "the environment is unchanged": no measurement was taken. A baseline is recorded when the task is created (\`send --contract\`) and only while the gate is switched on (currently: ${d}). Switch it on, then re-send the task.`}(a.taskId,a.sources),null);let e=a.capture??(()=>(0,f._8)({worktreeId:a.worktreeId}));try{b=await e()}catch(a){return d("error",`${g.Q5}: UNKNOWN — the current snapshot could not be taken: ${a instanceof Error?a.message:String(a)}`,null)}let h=function(a,b,c){let d=f.I1.map(d=>{let e=a.probes[d],f=b.probes[d];if(!e||"ok"!==e.status)return{probeId:d,status:"unknown",reason:`baseline probe unavailable: ${e?.reason??"not recorded"}`,added:[],ignoredAdded:[],removed:[]};if(!f||"ok"!==f.status)return{probeId:d,status:"unknown",reason:`current probe unavailable: ${f?.reason??"not recorded"}`,added:[],ignoredAdded:[],removed:[]};let g=new Set(e.entries.map(a=>a.key)),h=new Set(f.entries.map(a=>a.key)),i=[],j=[];for(let a of f.entries){if(g.has(a.key))continue;let b=k(d,a,c);("other"===b?j:i).push(l(a,b))}let m=e.entries.filter(a=>!h.has(a.key)).map(a=>l(a,k(d,a,c)));return{probeId:d,status:i.length+m.length>0?"violated":"clean",reason:null,added:i,ignoredAdded:j,removed:m}});return{status:d.some(a=>"violated"===a.status)?"violated":d.some(a=>"unknown"===a.status)?"unknown":"clean",probes:d}}(a.baseline,b,a),i=`${g.Q5}: baseline=${new Date(a.baseline.capturedAt).toISOString()} status=${h.status}`,j=`${i}
3
- ${function(a){let b=[];for(let c of a.probes){let a=f.J6[c.probeId];if("unknown"===c.status){b.push(` ${c.probeId} UNKNOWN (${a}): ${c.reason??"no reason recorded"}`);continue}if("clean"===c.status){let d=c.ignoredAdded.length>0?` (${c.ignoredAdded.length} addition(s) attributed to another worktree)`:"";b.push(` ${c.probeId} clean (${a})${d}`);continue}for(let d of(b.push(` ${c.probeId} VIOLATED (${a}): +${c.added.length} -${c.removed.length}`),b.push(...m("+",c.added)),b.push(...m("-",c.removed)),c.ignoredAdded))b.push(` \xb7 ${d.key} (ignored: belongs to another worktree)`)}return b.join("\n")}(h)}`;return"clean"===h.status?d("passed",j,0):"unknown"===h.status?d("error",`${j}
4
- UNKNOWN is not a pass: at least one probe could not be compared, so the environment was not measured.`,null):d("failed",`${j}
5
- Anything listed under "+" was started or created during this task and left behind — stop it by PID and remove it. Anything under "-" existed when the task started and is now gone — it was killed or deleted; restart or restore it. Never stop a process by pattern (\`pkill -f\`): it takes every process whose command line matches, which is how the production server was stopped in #1739.`,1)}},77142:(a,b,c)=>{c.d(b,{HL:()=>u,I1:()=>m,J6:()=>n,_8:()=>A,dV:()=>E,g9:()=>F});var d=c(79646),e=c(29021),f=c(21820),g=c(33873),h=c(87447),i=c(72626),j=c(49987),k=c(53604);let l=(0,i.h)("lib/verification/env-snapshot"),m=["listeners","tmux-sessions","home-entries","commandmate-entries"],n={listeners:"CommandMate TCP listeners","tmux-sessions":"mcbd-* tmux sessions","home-entries":"$HOME entries","commandmate-entries":"~/.commandmate entries"},o={run:function(a,b){return new Promise(c=>{(0,d.execFile)(a,b,{timeout:5e3,maxBuffer:4194304,encoding:"utf8"},(b,d,e)=>b?"number"!=typeof b.code||b.killed?void c({code:null,stdout:d,stderr:e,failure:b.killed?`${a} exceeded 5000ms and was terminated`:`${a} could not be run: ${b.message}`}):void c({code:b.code,stdout:d,stderr:e,failure:null}):void c({code:0,stdout:d,stderr:e,failure:null}))})},readDir:a=>(0,e.readdirSync)(a),homeDir:()=>(0,f.homedir)()},p=/commandmate|dist\/server\/server\.js|next-server|next (dev|start)|server\.ts/i;function q(a){let b=[],c=null;for(let d of a.split("\n")){if(""===d)continue;let a=d[0],e=d.slice(1);if("p"===a){let a=Number(e);if(!Number.isInteger(a)){c=null;continue}c={pid:a,fields:new Map},b.push(c);continue}if(!c)continue;let f=c.fields.get(a);f?f.push(e):c.fields.set(a,[e])}return b}function r(a){return{status:"unavailable",entries:[],reason:a}}function s(a){let b=new Map;for(let c of a)b.has(c.key)||b.set(c.key,c);return{status:"ok",entries:[...b.values()].sort((a,b)=>a.key<b.key?-1:+(a.key>b.key)),reason:null}}async function t(a){let b=await a.run("lsof",["-nP","-iTCP","-sTCP:LISTEN","-F","pcn"]);if(null!==b.failure)return r(b.failure);if(0!==b.code&&1!==b.code)return r(`lsof exited ${b.code}: ${b.stderr.trim()||"no diagnostic output"}`);let c=q(b.stdout);if(0===c.length)return s([]);let d=await a.run("ps",["-A","-o","pid=,command="]);if(null!==d.failure||0!==d.code)return r(d.failure??`ps exited ${d.code}: ${d.stderr.trim()||"no diagnostic output"}`);let e=function(a){let b=new Map;for(let c of a.split("\n")){let a=/^\s*(\d+)\s+(.*)$/.exec(c);a&&b.set(Number(a[1]),a[2].trim())}return b}(d.stdout),f=c.filter(a=>{let b=e.get(a.pid);return void 0!==b&&p.test(b)});if(0===f.length)return s([]);let g=new Map,h=f.map(a=>String(a.pid)),i=await a.run("lsof",["-a","-d","cwd","-p",h.join(","),"-F","pn"]);if(null===i.failure&&(0===i.code||1===i.code))for(let a of q(i.stdout)){let[b]=a.fields.get("n")??[];b&&g.set(a.pid,b)}let j=[];for(let a of f){let b=a.fields.get("c")?.[0]??"unknown";for(let c of a.fields.get("n")??[]){let d=function(a){let b=a.lastIndexOf(":");if(b<0)return null;let c=a.slice(b+1);return/^\d+$/.test(c)?c:null}(c);d&&j.push({key:`tcp/${d}`,detail:`${b} pid=${a.pid}`,anchor:g.get(a.pid)??null})}}return s(j)}let u="mcbd-";async function v(a){let b=await a.run("tmux",["list-sessions","-F","#{session_name}"]);return null!==b.failure?r(b.failure):0!==b.code?/no server running|error connecting to|no sessions/i.test(b.stderr)?s([]):r(`tmux list-sessions exited ${b.code}: ${b.stderr.trim()||"no diagnostic output"}`):s(b.stdout.split("\n").map(a=>a.trim()).filter(a=>a.startsWith(u)).map(a=>({key:a,detail:null,anchor:null})))}let w=[/-wal$/,/-shm$/,/-journal$/,/^\.DS_Store$/],x="env-snapshots",y=[j.Iq,k.L8];function z(a,b,{missingIsEmpty:c,alsoIgnored:d=[]}){let e;try{e=a.readDir(b)}catch(d){let a=d.code;if(c&&"ENOENT"===a)return s([]);return r(`could not list ${b}: ${d.message}`)}return s(e.filter(a=>!(a===x||w.some(b=>b.test(a)))&&!d.includes(a)).map(a=>({key:a,detail:null,anchor:null})))}async function A(a){let b=a.deps??o,[c,d]=await Promise.all([t(b).catch(a=>r(`listeners probe threw: ${a.message}`)),v(b).catch(a=>r(`tmux probe threw: ${a.message}`))]);return{version:1,capturedAt:a.now??Date.now(),worktreeId:a.worktreeId,probes:{listeners:c,"tmux-sessions":d,"home-entries":z(b,b.homeDir(),{missingIsEmpty:!1}),"commandmate-entries":z(b,(0,g.join)(b.homeDir(),".commandmate"),{missingIsEmpty:!0,alsoIgnored:y})}}}function B(){return(0,g.join)((0,g.dirname)((0,h._$)().CM_DB_PATH),x)}let C=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function D(a,b){return C.test(b)?(0,g.join)(a,`${b}.json`):null}function E(a,b,c=B()){let d=D(c,a);if(!d)return l.warn("env-snapshot-rejected-task-id",{taskId:a}),!1;try{return(0,e.mkdirSync)(c,{recursive:!0,mode:448}),(0,e.writeFileSync)(d,JSON.stringify(b),{encoding:"utf8",mode:384}),!function(a,b){let c;try{c=(0,e.readdirSync)(a)}catch{return}for(let d of c){if(!d.endsWith(".json"))continue;let c=(0,g.join)(a,d);try{b-(0,e.statSync)(c).mtimeMs>2592e6&&(0,e.rmSync)(c,{force:!0})}catch{}}}(c,b.capturedAt),!0}catch(b){return l.warn("env-snapshot-write-failed",{taskId:a,error:b instanceof Error?b.message:String(b)}),!1}}function F(a,b=B()){let c=D(b,a);if(!c)return null;try{let a=JSON.parse((0,e.readFileSync)(c,"utf8"));if(!function(a){if("object"!=typeof a||null===a||1!==a.version||"number"!=typeof a.capturedAt)return!1;let b=a.probes;return"object"==typeof b&&null!==b&&m.every(a=>{var c;return"object"==typeof(c=b[a])&&null!==c&&("ok"===c.status||"unavailable"===c.status)&&Array.isArray(c.entries)})}(a))return null;return a}catch{return null}}}};