trybeacon 0.1.72 → 0.1.74

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 (432) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.next/BUILD_ID +1 -1
  3. package/.next/app-path-routes-manifest.json +17 -9
  4. package/.next/build-manifest.json +3 -3
  5. package/.next/prerender-manifest.json +3 -3
  6. package/.next/routes-manifest.json +54 -6
  7. package/.next/server/app/_global-error/page.js +3 -3
  8. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  9. package/.next/server/app/_global-error.html +1 -1
  10. package/.next/server/app/_global-error.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  14. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  15. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  16. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  17. package/.next/server/app/_not-found/page.js +2 -2
  18. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  19. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  20. package/.next/server/app/_not-found.html +1 -1
  21. package/.next/server/app/_not-found.rsc +23 -22
  22. package/.next/server/app/_not-found.segments/_full.segment.rsc +23 -22
  23. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  24. package/.next/server/app/_not-found.segments/_index.segment.rsc +12 -11
  25. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  26. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  27. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  28. package/.next/server/app/api/ask/answer/route.js +1 -0
  29. package/.next/server/app/api/ask/answer/route.js.nft.json +1 -0
  30. package/.next/server/app/api/ask/answer/route_client-reference-manifest.js +1 -0
  31. package/.next/server/app/api/ask/route.js +1 -0
  32. package/.next/server/app/api/ask/route.js.nft.json +1 -0
  33. package/.next/server/app/api/ask/route_client-reference-manifest.js +1 -0
  34. package/.next/server/app/api/ask/verdict/route.js +1 -0
  35. package/.next/server/app/api/ask/verdict/route.js.nft.json +1 -0
  36. package/.next/server/app/api/ask/verdict/route_client-reference-manifest.js +1 -0
  37. package/.next/server/app/api/board-annotations/[id]/route.js +1 -1
  38. package/.next/server/app/api/board-annotations/route.js +1 -1
  39. package/.next/server/app/api/board-layout/route.js +1 -1
  40. package/.next/server/app/api/bug-flags/[id]/route.js +1 -1
  41. package/.next/server/app/api/bug-flags/route.js +1 -1
  42. package/.next/server/app/api/changes/comment/answer/route.js +4 -0
  43. package/.next/server/app/api/changes/comment/answer/route.js.nft.json +1 -0
  44. package/.next/server/app/api/changes/comment/answer/route_client-reference-manifest.js +1 -0
  45. package/.next/server/app/api/changes/comment/claim/route.js +4 -0
  46. package/.next/server/app/api/changes/comment/claim/route.js.nft.json +1 -0
  47. package/.next/server/app/api/changes/comment/claim/route_client-reference-manifest.js +1 -0
  48. package/.next/server/app/api/changes/comment/route.js +4 -0
  49. package/.next/server/app/api/changes/comment/route.js.nft.json +1 -0
  50. package/.next/server/app/api/changes/comment/route_client-reference-manifest.js +1 -0
  51. package/.next/server/app/api/changes/quality/route.js +1 -0
  52. package/.next/server/app/api/changes/quality/route.js.nft.json +1 -0
  53. package/.next/server/app/api/changes/quality/route_client-reference-manifest.js +1 -0
  54. package/.next/server/app/api/changes/route.js +1 -0
  55. package/.next/server/app/api/{flags → changes}/route.js.nft.json +1 -1
  56. package/.next/server/app/api/changes/route_client-reference-manifest.js +1 -0
  57. package/.next/server/app/api/changes/viewed/route.js +1 -0
  58. package/.next/server/app/api/changes/viewed/route.js.nft.json +1 -0
  59. package/.next/server/app/api/changes/viewed/route_client-reference-manifest.js +1 -0
  60. package/.next/server/app/api/code-graph/position/route.js +1 -1
  61. package/.next/server/app/api/code-graph/route.js +1 -1
  62. package/.next/server/app/api/context/feature/route.js +1 -1
  63. package/.next/server/app/api/context/file/route.js +1 -1
  64. package/.next/server/app/api/context/route.js +1 -9
  65. package/.next/server/app/api/context/route.js.nft.json +1 -1
  66. package/.next/server/app/api/db/arrange/route.js +1 -1
  67. package/.next/server/app/api/db/backfill-access/route.js +1 -1
  68. package/.next/server/app/api/db/position/route.js +1 -1
  69. package/.next/server/app/api/db/position/route.js.nft.json +1 -1
  70. package/.next/server/app/api/db/prune-planned/route.js +1 -1
  71. package/.next/server/app/api/db/reconcile-endpoints/route.js +1 -1
  72. package/.next/server/app/api/db/relations/[id]/route.js +1 -1
  73. package/.next/server/app/api/db/tables/[id]/route.js +1 -1
  74. package/.next/server/app/api/draft/approve/route.js +1 -1
  75. package/.next/server/app/api/draft/approve/route.js.nft.json +1 -1
  76. package/.next/server/app/api/draft/route.js +1 -1
  77. package/.next/server/app/api/draft/route.js.nft.json +1 -1
  78. package/.next/server/app/api/draft/status/route.js +1 -1
  79. package/.next/server/app/api/edges/[id]/route.js +1 -1
  80. package/.next/server/app/api/edges/route.js +1 -1
  81. package/.next/server/app/api/edges/route.js.nft.json +1 -1
  82. package/.next/server/app/api/endpoints/[id]/route.js +1 -1
  83. package/.next/server/app/api/entities/route.js +1 -1
  84. package/.next/server/app/api/ingest/route.js +1 -9
  85. package/.next/server/app/api/ingest/route.js.nft.json +1 -1
  86. package/.next/server/app/api/init/route.js +1 -9
  87. package/.next/server/app/api/init/route.js.nft.json +1 -1
  88. package/.next/server/app/api/lesson/close/route.js +1 -1
  89. package/.next/server/app/api/lesson/presence/route.js +1 -1
  90. package/.next/server/app/api/lesson/questions/route.js +1 -1
  91. package/.next/server/app/api/lesson/route.js +1 -1
  92. package/.next/server/app/api/lesson/save/route.js +1 -1
  93. package/.next/server/app/api/lesson/verdict/route.js +1 -1
  94. package/.next/server/app/api/map/describe/route.js +1 -9
  95. package/.next/server/app/api/map/describe/route.js.nft.json +1 -1
  96. package/.next/server/app/api/map/files/route.js +1 -1
  97. package/.next/server/app/api/map/files/route.js.nft.json +1 -1
  98. package/.next/server/app/api/map/finish/route.js +1 -1
  99. package/.next/server/app/api/map/finish/route.js.nft.json +1 -1
  100. package/.next/server/app/api/map/route.js +1 -1
  101. package/.next/server/app/api/map/route.js.nft.json +1 -1
  102. package/.next/server/app/api/map/start/route.js +1 -1
  103. package/.next/server/app/api/map/start/route.js.nft.json +1 -1
  104. package/.next/server/app/api/map/touch-active/route.js +1 -1
  105. package/.next/server/app/api/map/touch-active/route.js.nft.json +1 -1
  106. package/.next/server/app/api/mention-search/route.js +1 -1
  107. package/.next/server/app/api/nodes/[id]/position/route.js +1 -1
  108. package/.next/server/app/api/nodes/[id]/position/route.js.nft.json +1 -1
  109. package/.next/server/app/api/nodes/[id]/route.js +1 -1
  110. package/.next/server/app/api/nodes/[id]/route.js.nft.json +1 -1
  111. package/.next/server/app/api/nodes/positions/route.js +1 -1
  112. package/.next/server/app/api/nodes/positions/route.js.nft.json +1 -1
  113. package/.next/server/app/api/nodes/route.js +1 -1
  114. package/.next/server/app/api/nodes/route.js.nft.json +1 -1
  115. package/.next/server/app/api/nodes/subtasks/route.js +1 -1
  116. package/.next/server/app/api/nodes/subtasks/route.js.nft.json +1 -1
  117. package/.next/server/app/api/notes/[id]/route.js +1 -1
  118. package/.next/server/app/api/notes/route.js +1 -1
  119. package/.next/server/app/api/open/route.js +1 -1
  120. package/.next/server/app/api/plan/annotations/route.js +2 -2
  121. package/.next/server/app/api/plan/approve/route.js +1 -9
  122. package/.next/server/app/api/plan/approve/route.js.nft.json +1 -1
  123. package/.next/server/app/api/plan/history/route.js +1 -1
  124. package/.next/server/app/api/plan/markdown/route.js +1 -1
  125. package/.next/server/app/api/plan/markdown/route.js.nft.json +1 -1
  126. package/.next/server/app/api/plan/presence/route.js +1 -1
  127. package/.next/server/app/api/plan/route.js +1 -1
  128. package/.next/server/app/api/plan/route.js.nft.json +1 -1
  129. package/.next/server/app/api/plan/verdict/route.js +1 -1
  130. package/.next/server/app/api/plan/verdict/route.js.nft.json +1 -1
  131. package/.next/server/app/api/preferences/route.js +1 -1
  132. package/.next/server/app/api/project-meta/route.js +1 -1
  133. package/.next/server/app/api/reset/route.js +1 -1
  134. package/.next/server/app/api/scope-guard/check/route.js +4 -1
  135. package/.next/server/app/api/scope-guard/check/route.js.nft.json +1 -1
  136. package/.next/server/app/api/share/create/route.js +1 -1
  137. package/.next/server/app/api/share/create/route.js.nft.json +1 -1
  138. package/.next/server/app/api/share/route.js +1 -1
  139. package/.next/server/app/api/stream/route.js +2 -2
  140. package/.next/server/app/api/tab/nav/route.js +1 -1
  141. package/.next/server/app/api/tab/presence/route.js +1 -1
  142. package/.next/server/app/api/telemetry/route.js +1 -1
  143. package/.next/server/app/api/telemetry/stats/route.js +1 -1
  144. package/.next/server/app/api/version/route.js +1 -1
  145. package/.next/server/app/api/workspace/activate/route.js +1 -1
  146. package/.next/server/app/api/workspace/route.js +1 -1
  147. package/.next/server/app/apple-icon.png/route.js +1 -1
  148. package/.next/server/app/docs/page.js +2 -2
  149. package/.next/server/app/docs/page.js.nft.json +1 -1
  150. package/.next/server/app/docs/page_client-reference-manifest.js +1 -1
  151. package/.next/server/app/docs.html +1 -1
  152. package/.next/server/app/docs.rsc +24 -23
  153. package/.next/server/app/docs.segments/_full.segment.rsc +24 -23
  154. package/.next/server/app/docs.segments/_head.segment.rsc +1 -1
  155. package/.next/server/app/docs.segments/_index.segment.rsc +12 -11
  156. package/.next/server/app/docs.segments/_tree.segment.rsc +2 -2
  157. package/.next/server/app/docs.segments/docs/__PAGE__.segment.rsc +1 -1
  158. package/.next/server/app/docs.segments/docs.segment.rsc +1 -1
  159. package/.next/server/app/help/page.js +2 -2
  160. package/.next/server/app/help/page.js.nft.json +1 -1
  161. package/.next/server/app/help/page_client-reference-manifest.js +1 -1
  162. package/.next/server/app/help.html +1 -1
  163. package/.next/server/app/help.rsc +32 -31
  164. package/.next/server/app/help.segments/_full.segment.rsc +32 -31
  165. package/.next/server/app/help.segments/_head.segment.rsc +1 -1
  166. package/.next/server/app/help.segments/_index.segment.rsc +12 -11
  167. package/.next/server/app/help.segments/_tree.segment.rsc +2 -2
  168. package/.next/server/app/help.segments/help/__PAGE__.segment.rsc +1 -1
  169. package/.next/server/app/help.segments/help.segment.rsc +1 -1
  170. package/.next/server/app/icon.svg/route.js +1 -1
  171. package/.next/server/app/index.html +1 -1
  172. package/.next/server/app/index.rsc +22 -21
  173. package/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  174. package/.next/server/app/index.segments/_full.segment.rsc +22 -21
  175. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  176. package/.next/server/app/index.segments/_index.segment.rsc +12 -11
  177. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  178. package/.next/server/app/learn/page.js +3 -3
  179. package/.next/server/app/learn/page.js.nft.json +1 -1
  180. package/.next/server/app/learn/page_client-reference-manifest.js +1 -1
  181. package/.next/server/app/map/page.js +2 -2
  182. package/.next/server/app/map/page.js.nft.json +1 -1
  183. package/.next/server/app/map/page_client-reference-manifest.js +1 -1
  184. package/.next/server/app/page.js +2 -2
  185. package/.next/server/app/page.js.nft.json +1 -1
  186. package/.next/server/app/page_client-reference-manifest.js +1 -1
  187. package/.next/server/app/plan/page.js +12 -2
  188. package/.next/server/app/plan/page.js.nft.json +1 -1
  189. package/.next/server/app/plan/page_client-reference-manifest.js +1 -1
  190. package/.next/server/app/s/[token]/page.js +2 -2
  191. package/.next/server/app/s/[token]/page.js.nft.json +1 -1
  192. package/.next/server/app/s/[token]/page_client-reference-manifest.js +1 -1
  193. package/.next/server/app/settings/page.js +2 -2
  194. package/.next/server/app/settings/page.js.nft.json +1 -1
  195. package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  196. package/.next/server/app-paths-manifest.json +17 -9
  197. package/.next/server/chunks/1130.js +1 -1
  198. package/.next/server/chunks/2031.js +1 -0
  199. package/.next/server/chunks/230.js +1 -0
  200. package/.next/server/chunks/2693.js +8 -0
  201. package/.next/server/chunks/374.js +1 -0
  202. package/.next/server/chunks/5295.js +1 -0
  203. package/.next/server/chunks/{4700.js → 5704.js} +2 -2
  204. package/.next/server/chunks/6469.js +10 -0
  205. package/.next/server/chunks/6962.js +1 -0
  206. package/.next/server/chunks/8227.js +1 -0
  207. package/.next/server/chunks/8674.js +7 -0
  208. package/.next/server/middleware-build-manifest.js +1 -1
  209. package/.next/server/pages/404.html +1 -1
  210. package/.next/server/pages/500.html +1 -1
  211. package/.next/server/server-reference-manifest.js +1 -1
  212. package/.next/server/server-reference-manifest.json +1 -1
  213. package/.next/static/chunks/3151-861a6caa40f70f79.js +1 -0
  214. package/.next/static/chunks/3908-80efc60050779adf.js +1 -0
  215. package/.next/static/chunks/5697-5b9719b81806b4cf.js +1 -0
  216. package/.next/static/chunks/654-8e68a43e4c589e9c.js +1 -0
  217. package/.next/static/chunks/7424-d7fa15ef452064dd.js +1 -0
  218. package/.next/static/chunks/app/_global-error/page-d54a69e7dc6b4008.js +1 -0
  219. package/.next/static/chunks/app/api/ask/answer/route-d54a69e7dc6b4008.js +1 -0
  220. package/.next/static/chunks/app/api/ask/route-d54a69e7dc6b4008.js +1 -0
  221. package/.next/static/chunks/app/api/ask/verdict/route-d54a69e7dc6b4008.js +1 -0
  222. package/.next/static/chunks/app/api/board-annotations/[id]/route-d54a69e7dc6b4008.js +1 -0
  223. package/.next/static/chunks/app/api/board-annotations/route-d54a69e7dc6b4008.js +1 -0
  224. package/.next/static/chunks/app/api/board-layout/route-d54a69e7dc6b4008.js +1 -0
  225. package/.next/static/chunks/app/api/bug-flags/[id]/route-d54a69e7dc6b4008.js +1 -0
  226. package/.next/static/chunks/app/api/bug-flags/route-d54a69e7dc6b4008.js +1 -0
  227. package/.next/static/chunks/app/api/changes/comment/answer/route-d54a69e7dc6b4008.js +1 -0
  228. package/.next/static/chunks/app/api/changes/comment/claim/route-d54a69e7dc6b4008.js +1 -0
  229. package/.next/static/chunks/app/api/changes/comment/route-d54a69e7dc6b4008.js +1 -0
  230. package/.next/static/chunks/app/api/changes/quality/route-d54a69e7dc6b4008.js +1 -0
  231. package/.next/static/chunks/app/api/changes/route-d54a69e7dc6b4008.js +1 -0
  232. package/.next/static/chunks/app/api/changes/viewed/route-d54a69e7dc6b4008.js +1 -0
  233. package/.next/static/chunks/app/api/code-graph/position/route-d54a69e7dc6b4008.js +1 -0
  234. package/.next/static/chunks/app/api/code-graph/route-d54a69e7dc6b4008.js +1 -0
  235. package/.next/static/chunks/app/api/context/feature/route-d54a69e7dc6b4008.js +1 -0
  236. package/.next/static/chunks/app/api/context/file/route-d54a69e7dc6b4008.js +1 -0
  237. package/.next/static/chunks/app/api/context/route-d54a69e7dc6b4008.js +1 -0
  238. package/.next/static/chunks/app/api/db/arrange/route-d54a69e7dc6b4008.js +1 -0
  239. package/.next/static/chunks/app/api/db/backfill-access/route-d54a69e7dc6b4008.js +1 -0
  240. package/.next/static/chunks/app/api/db/position/route-d54a69e7dc6b4008.js +1 -0
  241. package/.next/static/chunks/app/api/db/prune-planned/route-d54a69e7dc6b4008.js +1 -0
  242. package/.next/static/chunks/app/api/db/reconcile-endpoints/route-d54a69e7dc6b4008.js +1 -0
  243. package/.next/static/chunks/app/api/db/relations/[id]/route-d54a69e7dc6b4008.js +1 -0
  244. package/.next/static/chunks/app/api/db/tables/[id]/route-d54a69e7dc6b4008.js +1 -0
  245. package/.next/static/chunks/app/api/draft/approve/route-d54a69e7dc6b4008.js +1 -0
  246. package/.next/static/chunks/app/api/draft/route-d54a69e7dc6b4008.js +1 -0
  247. package/.next/static/chunks/app/api/draft/status/route-d54a69e7dc6b4008.js +1 -0
  248. package/.next/static/chunks/app/api/edges/[id]/route-d54a69e7dc6b4008.js +1 -0
  249. package/.next/static/chunks/app/api/edges/route-d54a69e7dc6b4008.js +1 -0
  250. package/.next/static/chunks/app/api/endpoints/[id]/route-d54a69e7dc6b4008.js +1 -0
  251. package/.next/static/chunks/app/api/entities/route-d54a69e7dc6b4008.js +1 -0
  252. package/.next/static/chunks/app/api/ingest/route-d54a69e7dc6b4008.js +1 -0
  253. package/.next/static/chunks/app/api/init/route-d54a69e7dc6b4008.js +1 -0
  254. package/.next/static/chunks/app/api/lesson/close/route-d54a69e7dc6b4008.js +1 -0
  255. package/.next/static/chunks/app/api/lesson/presence/route-d54a69e7dc6b4008.js +1 -0
  256. package/.next/static/chunks/app/api/lesson/questions/route-d54a69e7dc6b4008.js +1 -0
  257. package/.next/static/chunks/app/api/lesson/route-d54a69e7dc6b4008.js +1 -0
  258. package/.next/static/chunks/app/api/lesson/save/route-d54a69e7dc6b4008.js +1 -0
  259. package/.next/static/chunks/app/api/lesson/verdict/route-d54a69e7dc6b4008.js +1 -0
  260. package/.next/static/chunks/app/api/map/describe/route-d54a69e7dc6b4008.js +1 -0
  261. package/.next/static/chunks/app/api/map/files/route-d54a69e7dc6b4008.js +1 -0
  262. package/.next/static/chunks/app/api/map/finish/route-d54a69e7dc6b4008.js +1 -0
  263. package/.next/static/chunks/app/api/map/route-d54a69e7dc6b4008.js +1 -0
  264. package/.next/static/chunks/app/api/map/start/route-d54a69e7dc6b4008.js +1 -0
  265. package/.next/static/chunks/app/api/map/touch-active/route-d54a69e7dc6b4008.js +1 -0
  266. package/.next/static/chunks/app/api/mention-search/route-d54a69e7dc6b4008.js +1 -0
  267. package/.next/static/chunks/app/api/nodes/[id]/position/route-d54a69e7dc6b4008.js +1 -0
  268. package/.next/static/chunks/app/api/nodes/[id]/route-d54a69e7dc6b4008.js +1 -0
  269. package/.next/static/chunks/app/api/nodes/positions/route-d54a69e7dc6b4008.js +1 -0
  270. package/.next/static/chunks/app/api/nodes/route-d54a69e7dc6b4008.js +1 -0
  271. package/.next/static/chunks/app/api/nodes/subtasks/route-d54a69e7dc6b4008.js +1 -0
  272. package/.next/static/chunks/app/api/notes/[id]/route-d54a69e7dc6b4008.js +1 -0
  273. package/.next/static/chunks/app/api/notes/route-d54a69e7dc6b4008.js +1 -0
  274. package/.next/static/chunks/app/api/open/route-d54a69e7dc6b4008.js +1 -0
  275. package/.next/static/chunks/app/api/plan/annotations/route-d54a69e7dc6b4008.js +1 -0
  276. package/.next/static/chunks/app/api/plan/approve/route-d54a69e7dc6b4008.js +1 -0
  277. package/.next/static/chunks/app/api/plan/history/route-d54a69e7dc6b4008.js +1 -0
  278. package/.next/static/chunks/app/api/plan/markdown/route-d54a69e7dc6b4008.js +1 -0
  279. package/.next/static/chunks/app/api/plan/presence/route-d54a69e7dc6b4008.js +1 -0
  280. package/.next/static/chunks/app/api/plan/route-d54a69e7dc6b4008.js +1 -0
  281. package/.next/static/chunks/app/api/plan/verdict/route-d54a69e7dc6b4008.js +1 -0
  282. package/.next/static/chunks/app/api/preferences/route-d54a69e7dc6b4008.js +1 -0
  283. package/.next/static/chunks/app/api/project-meta/route-d54a69e7dc6b4008.js +1 -0
  284. package/.next/static/chunks/app/api/reset/route-d54a69e7dc6b4008.js +1 -0
  285. package/.next/static/chunks/app/api/scope-guard/check/route-d54a69e7dc6b4008.js +1 -0
  286. package/.next/static/chunks/app/api/share/create/route-d54a69e7dc6b4008.js +1 -0
  287. package/.next/static/chunks/app/api/share/route-d54a69e7dc6b4008.js +1 -0
  288. package/.next/static/chunks/app/api/stream/route-d54a69e7dc6b4008.js +1 -0
  289. package/.next/static/chunks/app/api/tab/nav/route-d54a69e7dc6b4008.js +1 -0
  290. package/.next/static/chunks/app/api/tab/presence/route-d54a69e7dc6b4008.js +1 -0
  291. package/.next/static/chunks/app/api/telemetry/route-d54a69e7dc6b4008.js +1 -0
  292. package/.next/static/chunks/app/api/telemetry/stats/route-d54a69e7dc6b4008.js +1 -0
  293. package/.next/static/chunks/app/api/version/route-d54a69e7dc6b4008.js +1 -0
  294. package/.next/static/chunks/app/api/workspace/activate/route-d54a69e7dc6b4008.js +1 -0
  295. package/.next/static/chunks/app/api/workspace/route-d54a69e7dc6b4008.js +1 -0
  296. package/.next/static/chunks/app/layout-f908dc26e06f4302.js +1 -0
  297. package/.next/static/chunks/app/learn/{page-e5bd3257170098e7.js → page-bc40746566d115e5.js} +1 -1
  298. package/.next/static/chunks/app/map/{page-5ab46e5ea28ecd79.js → page-233ccd830873114b.js} +1 -1
  299. package/.next/static/chunks/app/plan/page-8ec1e1d8ea40686a.js +11 -0
  300. package/.next/static/chunks/app/s/[token]/{page-8e4ffccdf7cd0309.js → page-2a3f04bc3f60ec49.js} +1 -1
  301. package/.next/static/chunks/app/settings/page-a751eabdd933f685.js +1 -0
  302. package/.next/static/chunks/next/dist/client/components/builtin/app-error-d54a69e7dc6b4008.js +1 -0
  303. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-d54a69e7dc6b4008.js +1 -0
  304. package/.next/static/chunks/next/dist/client/components/builtin/not-found-d54a69e7dc6b4008.js +1 -0
  305. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-d54a69e7dc6b4008.js +1 -0
  306. package/.next/static/chunks/{webpack-de4a0d9611ec2cad.js → webpack-6c27b0ed1ac1459c.js} +1 -1
  307. package/.next/static/css/60048003a8c96562.css +1 -0
  308. package/.next/static/css/a5d17568738ef1e9.css +1 -0
  309. package/.next/static/yescmIM6BeSzGgwZ-Dwpq/_buildManifest.js +1 -0
  310. package/.next/trace +46 -43
  311. package/.next/trace-build +1 -1
  312. package/.next/types/app/api/ask/answer/route.ts +351 -0
  313. package/.next/types/app/api/{flags → ask}/route.ts +3 -3
  314. package/.next/types/app/api/ask/verdict/route.ts +351 -0
  315. package/.next/types/app/api/changes/comment/answer/route.ts +351 -0
  316. package/.next/types/app/api/changes/comment/claim/route.ts +351 -0
  317. package/.next/types/app/api/changes/comment/route.ts +351 -0
  318. package/.next/types/app/api/changes/quality/route.ts +351 -0
  319. package/.next/types/app/api/changes/route.ts +351 -0
  320. package/.next/types/app/api/changes/viewed/route.ts +351 -0
  321. package/.next/types/routes.d.ts +10 -2
  322. package/.next/types/validator.ts +81 -9
  323. package/bun.lock +54 -0
  324. package/dist/bin/answer.js +8 -0
  325. package/dist/bin/ask.js +5 -0
  326. package/dist/bin/beacon.js +5 -5
  327. package/dist/bin/doctor.js +36 -35
  328. package/dist/bin/guard.js +1 -1
  329. package/dist/bin/hook.js +33 -32
  330. package/dist/bin/mcp.js +45 -44
  331. package/dist/bin/plan.js +36 -35
  332. package/dist/bin/remove.js +6 -6
  333. package/dist/bin/stop-hook.js +7 -3
  334. package/dist/bin/uninstall.js +35 -34
  335. package/dist/lib/assets.js +25 -24
  336. package/dist/lib/codex-install.js +32 -31
  337. package/dist/lib/global-install.js +33 -32
  338. package/dist/lib/telemetry.js +1 -1
  339. package/dist/lib/workspaces.js +1 -1
  340. package/package.json +3 -1
  341. package/plugin/skills/beacon-plan/SKILL.md +5 -4
  342. package/.next/server/app/api/flags/route.js +0 -1
  343. package/.next/server/app/api/flags/route_client-reference-manifest.js +0 -1
  344. package/.next/server/chunks/3098.js +0 -1
  345. package/.next/server/chunks/3221.js +0 -5
  346. package/.next/server/chunks/4307.js +0 -1
  347. package/.next/server/chunks/5719.js +0 -1
  348. package/.next/server/chunks/7604.js +0 -1
  349. package/.next/static/chunks/2231-63ad38ec8fb7cb6f.js +0 -1
  350. package/.next/static/chunks/2416-dbbbff4e4c9abad1.js +0 -1
  351. package/.next/static/chunks/766-242213d211df0afd.js +0 -1
  352. package/.next/static/chunks/8997-78a359d0d238622e.js +0 -1
  353. package/.next/static/chunks/app/_global-error/page-93569b5eb93a61e9.js +0 -1
  354. package/.next/static/chunks/app/api/board-annotations/[id]/route-93569b5eb93a61e9.js +0 -1
  355. package/.next/static/chunks/app/api/board-annotations/route-93569b5eb93a61e9.js +0 -1
  356. package/.next/static/chunks/app/api/board-layout/route-93569b5eb93a61e9.js +0 -1
  357. package/.next/static/chunks/app/api/bug-flags/[id]/route-93569b5eb93a61e9.js +0 -1
  358. package/.next/static/chunks/app/api/bug-flags/route-93569b5eb93a61e9.js +0 -1
  359. package/.next/static/chunks/app/api/code-graph/position/route-93569b5eb93a61e9.js +0 -1
  360. package/.next/static/chunks/app/api/code-graph/route-93569b5eb93a61e9.js +0 -1
  361. package/.next/static/chunks/app/api/context/feature/route-93569b5eb93a61e9.js +0 -1
  362. package/.next/static/chunks/app/api/context/file/route-93569b5eb93a61e9.js +0 -1
  363. package/.next/static/chunks/app/api/context/route-93569b5eb93a61e9.js +0 -1
  364. package/.next/static/chunks/app/api/db/arrange/route-93569b5eb93a61e9.js +0 -1
  365. package/.next/static/chunks/app/api/db/backfill-access/route-93569b5eb93a61e9.js +0 -1
  366. package/.next/static/chunks/app/api/db/position/route-93569b5eb93a61e9.js +0 -1
  367. package/.next/static/chunks/app/api/db/prune-planned/route-93569b5eb93a61e9.js +0 -1
  368. package/.next/static/chunks/app/api/db/reconcile-endpoints/route-93569b5eb93a61e9.js +0 -1
  369. package/.next/static/chunks/app/api/db/relations/[id]/route-93569b5eb93a61e9.js +0 -1
  370. package/.next/static/chunks/app/api/db/tables/[id]/route-93569b5eb93a61e9.js +0 -1
  371. package/.next/static/chunks/app/api/draft/approve/route-93569b5eb93a61e9.js +0 -1
  372. package/.next/static/chunks/app/api/draft/route-93569b5eb93a61e9.js +0 -1
  373. package/.next/static/chunks/app/api/draft/status/route-93569b5eb93a61e9.js +0 -1
  374. package/.next/static/chunks/app/api/edges/[id]/route-93569b5eb93a61e9.js +0 -1
  375. package/.next/static/chunks/app/api/edges/route-93569b5eb93a61e9.js +0 -1
  376. package/.next/static/chunks/app/api/endpoints/[id]/route-93569b5eb93a61e9.js +0 -1
  377. package/.next/static/chunks/app/api/entities/route-93569b5eb93a61e9.js +0 -1
  378. package/.next/static/chunks/app/api/flags/route-93569b5eb93a61e9.js +0 -1
  379. package/.next/static/chunks/app/api/ingest/route-93569b5eb93a61e9.js +0 -1
  380. package/.next/static/chunks/app/api/init/route-93569b5eb93a61e9.js +0 -1
  381. package/.next/static/chunks/app/api/lesson/close/route-93569b5eb93a61e9.js +0 -1
  382. package/.next/static/chunks/app/api/lesson/presence/route-93569b5eb93a61e9.js +0 -1
  383. package/.next/static/chunks/app/api/lesson/questions/route-93569b5eb93a61e9.js +0 -1
  384. package/.next/static/chunks/app/api/lesson/route-93569b5eb93a61e9.js +0 -1
  385. package/.next/static/chunks/app/api/lesson/save/route-93569b5eb93a61e9.js +0 -1
  386. package/.next/static/chunks/app/api/lesson/verdict/route-93569b5eb93a61e9.js +0 -1
  387. package/.next/static/chunks/app/api/map/describe/route-93569b5eb93a61e9.js +0 -1
  388. package/.next/static/chunks/app/api/map/files/route-93569b5eb93a61e9.js +0 -1
  389. package/.next/static/chunks/app/api/map/finish/route-93569b5eb93a61e9.js +0 -1
  390. package/.next/static/chunks/app/api/map/route-93569b5eb93a61e9.js +0 -1
  391. package/.next/static/chunks/app/api/map/start/route-93569b5eb93a61e9.js +0 -1
  392. package/.next/static/chunks/app/api/map/touch-active/route-93569b5eb93a61e9.js +0 -1
  393. package/.next/static/chunks/app/api/mention-search/route-93569b5eb93a61e9.js +0 -1
  394. package/.next/static/chunks/app/api/nodes/[id]/position/route-93569b5eb93a61e9.js +0 -1
  395. package/.next/static/chunks/app/api/nodes/[id]/route-93569b5eb93a61e9.js +0 -1
  396. package/.next/static/chunks/app/api/nodes/positions/route-93569b5eb93a61e9.js +0 -1
  397. package/.next/static/chunks/app/api/nodes/route-93569b5eb93a61e9.js +0 -1
  398. package/.next/static/chunks/app/api/nodes/subtasks/route-93569b5eb93a61e9.js +0 -1
  399. package/.next/static/chunks/app/api/notes/[id]/route-93569b5eb93a61e9.js +0 -1
  400. package/.next/static/chunks/app/api/notes/route-93569b5eb93a61e9.js +0 -1
  401. package/.next/static/chunks/app/api/open/route-93569b5eb93a61e9.js +0 -1
  402. package/.next/static/chunks/app/api/plan/annotations/route-93569b5eb93a61e9.js +0 -1
  403. package/.next/static/chunks/app/api/plan/approve/route-93569b5eb93a61e9.js +0 -1
  404. package/.next/static/chunks/app/api/plan/history/route-93569b5eb93a61e9.js +0 -1
  405. package/.next/static/chunks/app/api/plan/markdown/route-93569b5eb93a61e9.js +0 -1
  406. package/.next/static/chunks/app/api/plan/presence/route-93569b5eb93a61e9.js +0 -1
  407. package/.next/static/chunks/app/api/plan/route-93569b5eb93a61e9.js +0 -1
  408. package/.next/static/chunks/app/api/plan/verdict/route-93569b5eb93a61e9.js +0 -1
  409. package/.next/static/chunks/app/api/preferences/route-93569b5eb93a61e9.js +0 -1
  410. package/.next/static/chunks/app/api/project-meta/route-93569b5eb93a61e9.js +0 -1
  411. package/.next/static/chunks/app/api/reset/route-93569b5eb93a61e9.js +0 -1
  412. package/.next/static/chunks/app/api/scope-guard/check/route-93569b5eb93a61e9.js +0 -1
  413. package/.next/static/chunks/app/api/share/create/route-93569b5eb93a61e9.js +0 -1
  414. package/.next/static/chunks/app/api/share/route-93569b5eb93a61e9.js +0 -1
  415. package/.next/static/chunks/app/api/stream/route-93569b5eb93a61e9.js +0 -1
  416. package/.next/static/chunks/app/api/tab/nav/route-93569b5eb93a61e9.js +0 -1
  417. package/.next/static/chunks/app/api/tab/presence/route-93569b5eb93a61e9.js +0 -1
  418. package/.next/static/chunks/app/api/telemetry/route-93569b5eb93a61e9.js +0 -1
  419. package/.next/static/chunks/app/api/telemetry/stats/route-93569b5eb93a61e9.js +0 -1
  420. package/.next/static/chunks/app/api/version/route-93569b5eb93a61e9.js +0 -1
  421. package/.next/static/chunks/app/api/workspace/activate/route-93569b5eb93a61e9.js +0 -1
  422. package/.next/static/chunks/app/api/workspace/route-93569b5eb93a61e9.js +0 -1
  423. package/.next/static/chunks/app/layout-d3b7276f116dce46.js +0 -1
  424. package/.next/static/chunks/app/plan/page-948f3eca400e746a.js +0 -1
  425. package/.next/static/chunks/app/settings/page-7e176d120b1effa9.js +0 -1
  426. package/.next/static/chunks/next/dist/client/components/builtin/app-error-93569b5eb93a61e9.js +0 -1
  427. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-93569b5eb93a61e9.js +0 -1
  428. package/.next/static/chunks/next/dist/client/components/builtin/not-found-93569b5eb93a61e9.js +0 -1
  429. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-93569b5eb93a61e9.js +0 -1
  430. package/.next/static/css/446974879473fd01.css +0 -1
  431. package/.next/static/lnOOQsWRymiliRmMEQ95F/_buildManifest.js +0 -1
  432. /package/.next/static/{lnOOQsWRymiliRmMEQ95F → yescmIM6BeSzGgwZ-Dwpq}/_ssgManifest.js +0 -0
@@ -1,22 +1,22 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- var uZ=Object.defineProperty;var gZ=(Q)=>Q;function EZ(Q,Z){this[Q]=gZ.bind(null,Z)}var BQ=(Q,Z)=>{for(var $ in Z)uZ(Q,$,{get:Z[$],enumerable:!0,configurable:!0,set:EZ.bind(Z,$)})};var F=(Q,Z)=>()=>(Q&&(Z=Q(Q=0)),Z);var n0=1500,s0=480000,t0=1800000,S=3600000,a0=3000;var pQ=()=>{};var KQ={};BQ(KQ,{removeRepoAssets:()=>LZ,installRefreshSkill:()=>IZ,installPlanSkill:()=>OZ,installInitSkill:()=>DZ,installExplainSkill:()=>yZ,installCodexRepoSkills:()=>bZ,ensureWorkflowDoc:()=>_Z,ensureMcp:()=>kZ,auditRepo:()=>xQ,REFRESH_SKILL:()=>GQ,PLAN_SKILL:()=>lQ,INIT_SKILL:()=>NQ,EXPLAIN_SKILL:()=>nQ});import{existsSync as R,mkdirSync as I,readFileSync as K,rmSync as h,writeFileSync as N}from"fs";import{join as X}from"path";function DZ(Q){let Z=X(Q,".claude","skills","beacon-init");I(Z,{recursive:!0});let $=X(Z,"SKILL.md");return N($,NQ),$}function IZ(Q){let Z=X(Q,".claude","skills","beacon-refresh");I(Z,{recursive:!0});let $=X(Z,"SKILL.md");return N($,GQ),$}function OZ(Q){let Z=X(Q,".claude","skills","beacon-plan");I(Z,{recursive:!0});let $=X(Z,"SKILL.md");return N($,lQ),$}function yZ(Q){let Z=X(Q,".claude","skills","beacon-explain");I(Z,{recursive:!0});let $=X(Z,"SKILL.md");return N($,nQ),$}function bZ(Q){let Z=[];for(let $ of AZ){let J=X(Q,".agents","skills",$.name);I(J,{recursive:!0});let Y=X(J,"SKILL.md");N(Y,$.body()),Z.push(Y)}return Z}function _Z(Q){let Z=X(Q,"AGENTS.md"),$="";try{$=K(Z,"utf8")}catch{}let J=new RegExp(`${m}[\\s\\S]*?${PQ}`);$=J.test($)?$.replace(J,cQ):`${$.trim()}
4
-
5
- ${cQ}
6
- `.trimStart(),N(Z,$.endsWith(`
7
- `)?$:`${$}
8
- `);let Y=X(Q,"CLAUDE.md"),V="";try{V=K(Y,"utf8")}catch{}if(!/@AGENTS\.md/.test(V))N(Y,`${V?`${V.trim()}
9
-
10
- `:""}@AGENTS.md
11
- `)}function kZ(Q){let Z=X(Q,".mcp.json"),$={};try{$=JSON.parse(K(Z,"utf8"))}catch{}$.mcpServers=$.mcpServers??{};let J=$.mcpServers.beacon;if(J){if(!J.timeout||J.timeout<S)return J.timeout=S,N(Z,JSON.stringify($,null,2)+`
12
- `),{path:Z,added:!1,updated:!0};return{path:Z,added:!1,updated:!1}}return $.mcpServers.beacon={command:"beacon",args:["mcp"],timeout:S},N(Z,JSON.stringify($,null,2)+`
13
- `),{path:Z,added:!0,updated:!1}}function xQ(Q){let Z=X(Q,".mcp.json"),$=!1;try{$=!!JSON.parse(K(Z,"utf8")).mcpServers?.beacon}catch{}let J=!1;try{J=K(X(Q,"AGENTS.md"),"utf8").includes(m)}catch{}let Y=!1;try{Y=/@AGENTS\.md/.test(K(X(Q,"CLAUDE.md"),"utf8"))}catch{}return{repo:Q,mcpRegistered:$,agentsMdBlock:J,claudeMdImport:Y,skills:{"beacon-init":R(X(Q,".claude","skills","beacon-init","SKILL.md")),"beacon-refresh":R(X(Q,".claude","skills","beacon-refresh","SKILL.md"))},codexSkills:{"beacon-init":R(X(Q,".agents","skills","beacon-init","SKILL.md")),"beacon-refresh":R(X(Q,".agents","skills","beacon-refresh","SKILL.md"))}}}function LZ(Q){let Z=[];for(let z of["beacon-init","beacon-refresh","beacon-db-design"]){let U=X(Q,".claude","skills",z);if(R(U))h(U,{recursive:!0,force:!0}),Z.push(z)}for(let z of["beacon-init","beacon-refresh"]){let U=X(Q,".agents","skills",z);if(R(U))h(U,{recursive:!0,force:!0}),Z.push(`codex:${z}`)}let $=!1,J=X(Q,".mcp.json");try{let z=JSON.parse(K(J,"utf8"));if(z.mcpServers?.beacon){if(delete z.mcpServers.beacon,$=!0,z.mcpServers&&Object.keys(z.mcpServers).length===0)delete z.mcpServers;if(Object.keys(z).length===0)h(J,{force:!0});else N(J,JSON.stringify(z,null,2)+`
14
- `)}}catch{}let Y=!1,V=X(Q,"AGENTS.md");try{let z=K(V,"utf8"),U=new RegExp(`\\n?${m}[\\s\\S]*?${PQ}\\n?`);if(U.test(z)){let vQ=z.replace(U,`
3
+ var IZ=Object.defineProperty;var DZ=(Q)=>Q;function OZ(Q,Z){this[Q]=DZ.bind(null,Z)}var BQ=(Q,Z)=>{for(var $ in Z)IZ(Q,$,{get:Z[$],enumerable:!0,configurable:!0,set:OZ.bind(Z,$)})};var F=(Q,Z)=>()=>(Q&&(Z=Q(Q=0)),Z);var a0=1500,d0=480000,r0=1800000,m=3600000,o0=3000;var cQ=()=>{};var CQ={};BQ(CQ,{stripAgentsPointer:()=>tQ,removeRepoAssets:()=>hZ,installRefreshSkill:()=>AZ,installPlanSkill:()=>bZ,installInitSkill:()=>yZ,installExplainSkill:()=>kZ,installCodexRepoSkills:()=>LZ,ensureWorkflowDoc:()=>SZ,ensureMcp:()=>mZ,contextDocTargets:()=>KQ,auditRepo:()=>xQ,REFRESH_SKILL:()=>GQ,PLAN_SKILL:()=>nQ,INIT_SKILL:()=>NQ,EXPLAIN_SKILL:()=>sQ});import{existsSync as x,mkdirSync as D,readFileSync as C,rmSync as h,writeFileSync as N}from"fs";import{join as X}from"path";function yZ(Q){let Z=X(Q,".claude","skills","beacon-init");D(Z,{recursive:!0});let $=X(Z,"SKILL.md");return N($,NQ),$}function AZ(Q){let Z=X(Q,".claude","skills","beacon-refresh");D(Z,{recursive:!0});let $=X(Z,"SKILL.md");return N($,GQ),$}function bZ(Q){let Z=X(Q,".claude","skills","beacon-plan");D(Z,{recursive:!0});let $=X(Z,"SKILL.md");return N($,nQ),$}function kZ(Q){let Z=X(Q,".claude","skills","beacon-explain");D(Z,{recursive:!0});let $=X(Z,"SKILL.md");return N($,sQ),$}function LZ(Q){let Z=[];for(let $ of _Z){let J=X(Q,".agents","skills",$.name);D(J,{recursive:!0});let Y=X(J,"SKILL.md");N(Y,$.body()),Z.push(Y)}return Z}function KQ(Q){let Z=X(Q,"AGENTS.md"),$=X(Q,"CLAUDE.md"),J=x(Z),Y=x($);if(!J&&!Y)return[Z,$];let V=[];if(J)V.push(Z);if(Y)V.push($);return V}function tQ(Q){let Z=X(Q,"CLAUDE.md");if(!x(Z))return;let $=C(Z,"utf8"),J=$.split(`
4
+ `).filter((Y)=>!/^\s*@\.?\/?AGENTS\.md\s*$/.test(Y)).join(`
5
+ `).trim();if(J&&J!==$.trim())N(Z,`${J}
6
+ `)}function SZ(Q){let Z=new RegExp(`${p}[\\s\\S]*?${PQ}`);for(let $ of KQ(Q)){let J="";try{J=C($,"utf8")}catch{}J=Z.test(J)?J.replace(Z,lQ):`${J.trim()}
7
+
8
+ ${lQ}
9
+ `.trimStart(),N($,J.endsWith(`
10
+ `)?J:`${J}
11
+ `)}tQ(Q)}function mZ(Q){let Z=X(Q,".mcp.json"),$={};try{$=JSON.parse(C(Z,"utf8"))}catch{}$.mcpServers=$.mcpServers??{};let J=$.mcpServers.beacon;if(J){if(!J.timeout||J.timeout<m)return J.timeout=m,N(Z,JSON.stringify($,null,2)+`
12
+ `),{path:Z,added:!1,updated:!0};return{path:Z,added:!1,updated:!1}}return $.mcpServers.beacon={command:"beacon",args:["mcp"],timeout:m},N(Z,JSON.stringify($,null,2)+`
13
+ `),{path:Z,added:!0,updated:!1}}function xQ(Q){let Z=X(Q,".mcp.json"),$=!1;try{$=!!JSON.parse(C(Z,"utf8")).mcpServers?.beacon}catch{}let J=KQ(Q).some((Y)=>{try{return C(Y,"utf8").includes(p)}catch{return!1}});return{repo:Q,mcpRegistered:$,workflowBlock:J,skills:{"beacon-init":x(X(Q,".claude","skills","beacon-init","SKILL.md")),"beacon-refresh":x(X(Q,".claude","skills","beacon-refresh","SKILL.md"))},codexSkills:{"beacon-init":x(X(Q,".agents","skills","beacon-init","SKILL.md")),"beacon-refresh":x(X(Q,".agents","skills","beacon-refresh","SKILL.md"))}}}function hZ(Q){let Z=[];for(let z of["beacon-init","beacon-refresh","beacon-db-design"]){let U=X(Q,".claude","skills",z);if(x(U))h(U,{recursive:!0,force:!0}),Z.push(z)}for(let z of["beacon-init","beacon-refresh"]){let U=X(Q,".agents","skills",z);if(x(U))h(U,{recursive:!0,force:!0}),Z.push(`codex:${z}`)}let $=!1,J=X(Q,".mcp.json");try{let z=JSON.parse(C(J,"utf8"));if(z.mcpServers?.beacon){if(delete z.mcpServers.beacon,$=!0,z.mcpServers&&Object.keys(z.mcpServers).length===0)delete z.mcpServers;if(Object.keys(z).length===0)h(J,{force:!0});else N(J,JSON.stringify(z,null,2)+`
14
+ `)}}catch{}let Y=!1,V=new RegExp(`\\n?${p}[\\s\\S]*?${PQ}\\n?`);for(let z of[X(Q,"AGENTS.md"),X(Q,"CLAUDE.md")])try{let U=C(z,"utf8");if(V.test(U)){let vQ=U.replace(V,`
15
15
  `).replace(/\n{3,}/g,`
16
16
 
17
- `).trimStart();N(V,vQ.endsWith(`
17
+ `).trimStart();N(z,vQ.endsWith(`
18
18
  `)?vQ:`${vQ}
19
- `),Y=!0}}catch{}let q=!1,H=X(Q,"CLAUDE.md");try{let z=K(H,"utf8"),U=z.replace(/^[ \t]*@AGENTS\.md[ \t]*\n?/m,"");if(U!==z){if(!U.trim())h(H,{force:!0});else N(H,U);q=!0}}catch{}return{skillsRemoved:Z,mcpUnregistered:$,agentsBlockRemoved:Y,claudeImportRemoved:q}}var NQ=`---
19
+ `),Y=!0}}catch{}let q=!1,H=X(Q,"CLAUDE.md");try{let z=C(H,"utf8"),U=z.replace(/^[ \t]*@AGENTS\.md[ \t]*\n?/m,"");if(U!==z){if(!U.trim())h(H,{force:!0});else N(H,U);q=!0}}catch{}return{skillsRemoved:Z,mcpUnregistered:$,agentsBlockRemoved:Y,claudeImportRemoved:q}}var NQ=`---
20
20
  name: beacon-init
21
21
  description: Read this repository and map its architecture, schema, and roadmap into Beacon (the local visual planning panel). Use when the user runs /beacon-init, asks to "set up Beacon for this repo", or asks to initialize/bootstrap Beacon's map of this codebase.
22
22
  ---
@@ -110,7 +110,7 @@ The one caveat: if the user manually edited an INIT-source node on the canvas (e
110
110
  If \`beacon_entities\` or \`beacon_init_persist\` isn't available, the Beacon panel isn't running in this repo. Tell the user to run \`beacon\` here first, then re-invoke /beacon-refresh.
111
111
 
112
112
  After the tool returns, report the final counts plus a one-line summary of the diff you surfaced.
113
- `,lQ=`---
113
+ `,nQ=`---
114
114
  name: beacon-plan
115
115
  description: Present your current plan or approach to the user on Beacon's /plan canvas for review \u2014 instead of asking for approval in prose. Use when the user says "present the plan", "show me the plan", "let me see it / the plan", or whenever you are about to end a turn asking whether to proceed with a plan, design, or approach.
116
116
  ---
@@ -139,10 +139,11 @@ board on /plan. The board is built ONLY from the block \u2014 prose is never par
139
139
  table/endpoint/feature you mention in the prose into the block, or that board will be empty.
140
140
 
141
141
  - **Declare your scope.** List the repo-relative files this plan will touch in a top-level
142
- \`"contract"\` array in the block (or the \`contract\` arg of \`beacon_propose_plan\`). When the user
143
- has the plan scope-guard enabled, those files are frozen at approval and you're held to them while
144
- implementing \u2014 editing an undeclared file pauses for the user's authorization (which then adds it
145
- to the contract). Harmless when the guard is off. Declare the files you genuinely expect to edit.
142
+ \`"contract"\` array in the block (or the \`contract\` arg of \`beacon_propose_plan\`). Those files are
143
+ frozen at approval and you're held to them while implementing \u2014 editing an undeclared file pauses
144
+ for the user's authorization (which then adds it to the contract), and the /plan Changes view
145
+ groups your edits On-plan vs Strayed against them. Declare the files you genuinely expect to edit
146
+ (if omitted, the scope is inferred from the files you name in backticks).
146
147
 
147
148
  \`beacon_present_plan\` opens /plan and BLOCKS until the user clicks Approve / Discard / submits
148
149
  feedback, then returns their verdict. Implement code or migrations ONLY after it returns approval.
@@ -158,7 +159,7 @@ If it returns feedback, revise and call it again.
158
159
  If \`beacon_present_plan\` isn't available, the panel isn't wired here \u2014 fall back to ExitPlanMode
159
160
  with the same \`\`\`beacon block (Claude Code only; Codex has no ExitPlanMode), or tell the user to
160
161
  run \`beacon\` in this repo once.
161
- `,nQ=`---
162
+ `,sQ=`---
162
163
  name: beacon-explain
163
164
  description: Teach the user part of THIS codebase as an interactive visual lesson on Beacon's /learn page \u2014 a concept map + plain-English narrative they can question \u2014 instead of a wall of text. Use when the user says "explain", "teach me", "walk me through", "how does X work", or "help me understand the Y category".
164
165
  ---
@@ -228,7 +229,7 @@ so the learner sees the table IN CONTEXT, wired to the code that uses it.
228
229
  Every answer must ADD understanding (rationale, trade-off) \u2014 never just restate the question. Expand
229
230
  the narrative or add nodes where it helps. Keep looping until the tool reports the user saved or closed
230
231
  the lesson.
231
- `,AZ,m="<!-- beacon:workflow:start -->",PQ="<!-- beacon:workflow:end -->",cQ;var p=F(()=>{pQ();AZ=[{name:"beacon-init",body:()=>NQ},{name:"beacon-refresh",body:()=>GQ}];cQ=`${m}
232
+ `,_Z,p="<!-- beacon:workflow:start -->",PQ="<!-- beacon:workflow:end -->",lQ;var c=F(()=>{cQ();_Z=[{name:"beacon-init",body:()=>NQ},{name:"beacon-refresh",body:()=>GQ}];lQ=`${p}
232
233
  ## Beacon \u2014 feature workflow
233
234
 
234
235
  This project uses Beacon (a local planning/visualization panel; run \`beacon\` to open it). When you start work on a FEATURE \u2014 whether referenced via an \`@beacon:feature://\u2026\` mention, an \`@beacon:note://\u2026\` note the user wrote in the Notes panel (treat its checkbox \`- [ ]\` todos as subtasks and order features by their dependencies), or just described in chat \u2014 follow these steps in order:
@@ -300,18 +301,18 @@ Register them all in that single batched call. If a plan added five features, th
300
301
  If the feature added or materially changed a REAL architectural component (a subsystem \u2014 NOT a file), also pass \`architecture: [{ title, domain, role, \u2026 }]\` so the Architecture map stays accurate. It upserts curated components by title; never list files as components. If you found a bug or something worth investigating in a component's code, add \`bugs: [{ note }]\` to its architecture entry \u2014 it renders as a bug flag on the node (attributed to the agent); identical open flags are not duplicated. Only flag what you actually saw in the code.
301
302
 
302
303
  Pull raw planning data anytime with \`beacon_entities\` (features / architecture / tables / endpoints).
303
- ${PQ}`});import{existsSync as c,mkdirSync as CQ,readdirSync as SZ,readFileSync as u,rmSync as hZ,writeFileSync as l}from"fs";import{dirname as sQ,join as C}from"path";function tQ(){return!!process.env.CLAUDE_PLUGIN_ROOT}function n(Q=process.env.HOME||process.env.USERPROFILE||""){if(!Q)return null;let Z=C(Q,".claude","plugins");if(!c(Z))return null;let $=[Z];for(let J=0;J<3&&$.length;J++){let Y=[];for(let V of $){let q=C(V,".claude-plugin","plugin.json");try{if(c(q)&&JSON.parse(u(q,"utf8")).name==="beacon")return V}catch{}try{for(let H of SZ(V,{withFileTypes:!0}))if(H.isDirectory())Y.push(C(V,H.name))}catch{}}$=Y}return null}function aQ(Q){return n(Q)!==null}function mZ(Q){return/[\\/]\.claude[\\/]plugins[\\/]/.test(Q)}function pZ(Q=process.env.HOME||process.env.USERPROFILE||""){if(!Q)return null;try{let Z=JSON.parse(u(C(Q,".claude","plugins","installed_plugins.json"),"utf8"));for(let $ of Object.keys(Z.plugins??{}))if(/^beacon@/.test($))return{key:$,marketplace:$.split("@")[1]??""}}catch{}return null}function MQ(Q){try{return JSON.parse(u(Q,"utf8"))}catch{return{}}}function dQ(Q,Z){CQ(sQ(Q),{recursive:!0}),l(Q,JSON.stringify(Z,null,2)+`
304
- `)}function t(Q,Z){let $=MQ(Q);$.hooks=$.hooks??{},$.hooks[Z.event]=$.hooks[Z.event]??[];let J=$.hooks[Z.event];if(J.some((V)=>V.matcher===Z.matcher&&V.hooks?.some((q)=>q.command===Z.command)))return!1;return J.push({matcher:Z.matcher,hooks:[{type:"command",command:Z.command}]}),dQ(Q,$),!0}function a(Q,Z){return(MQ(Q).hooks?.[Z.event]??[]).some((Y)=>Y.hooks?.some((V)=>V.command===Z.command))}function d(Q,Z){let $=MQ(Q),J=$.hooks?.[Z.event];if(!J)return!1;let Y=!1,V=J.map((q)=>{let H=q.hooks?.length??0,z=(q.hooks??[]).filter((U)=>U.command!==Z.command);if(z.length!==H)Y=!0;return{...q,hooks:z}}).filter((q)=>(q.hooks??[]).length>0);if(!Y)return!1;if(V.length)$.hooks[Z.event]=V;else delete $.hooks[Z.event];if($.hooks&&Object.keys($.hooks).length===0)delete $.hooks;return dQ(Q,$),!0}function r(Q,Z,$,J){let Y=`${Z}
304
+ ${PQ}`});import{existsSync as l,mkdirSync as MQ,readdirSync as pZ,readFileSync as R,rmSync as cZ,writeFileSync as n}from"fs";import{dirname as aQ,join as M}from"path";function dQ(){return!!process.env.CLAUDE_PLUGIN_ROOT}function s(Q=process.env.HOME||process.env.USERPROFILE||""){if(!Q)return null;let Z=M(Q,".claude","plugins");if(!l(Z))return null;let $=[Z];for(let J=0;J<3&&$.length;J++){let Y=[];for(let V of $){let q=M(V,".claude-plugin","plugin.json");try{if(l(q)&&JSON.parse(R(q,"utf8")).name==="beacon")return V}catch{}try{for(let H of pZ(V,{withFileTypes:!0}))if(H.isDirectory())Y.push(M(V,H.name))}catch{}}$=Y}return null}function rQ(Q){return s(Q)!==null}function lZ(Q){return/[\\/]\.claude[\\/]plugins[\\/]/.test(Q)}function nZ(Q=process.env.HOME||process.env.USERPROFILE||""){if(!Q)return null;try{let Z=JSON.parse(R(M(Q,".claude","plugins","installed_plugins.json"),"utf8"));for(let $ of Object.keys(Z.plugins??{}))if(/^beacon@/.test($))return{key:$,marketplace:$.split("@")[1]??""}}catch{}return null}function wQ(Q){try{return JSON.parse(R(Q,"utf8"))}catch{return{}}}function oQ(Q,Z){MQ(aQ(Q),{recursive:!0}),n(Q,JSON.stringify(Z,null,2)+`
305
+ `)}function a(Q,Z){let $=wQ(Q);$.hooks=$.hooks??{},$.hooks[Z.event]=$.hooks[Z.event]??[];let J=$.hooks[Z.event];if(J.some((V)=>V.matcher===Z.matcher&&V.hooks?.some((q)=>q.command===Z.command)))return!1;return J.push({matcher:Z.matcher,hooks:[{type:"command",command:Z.command}]}),oQ(Q,$),!0}function d(Q,Z){return(wQ(Q).hooks?.[Z.event]??[]).some((Y)=>Y.hooks?.some((V)=>V.command===Z.command))}function r(Q,Z){let $=wQ(Q),J=$.hooks?.[Z.event];if(!J)return!1;let Y=!1,V=J.map((q)=>{let H=q.hooks?.length??0,z=(q.hooks??[]).filter((U)=>U.command!==Z.command);if(z.length!==H)Y=!0;return{...q,hooks:z}}).filter((q)=>(q.hooks??[]).length>0);if(!Y)return!1;if(V.length)$.hooks[Z.event]=V;else delete $.hooks[Z.event];if($.hooks&&Object.keys($.hooks).length===0)delete $.hooks;return oQ(Q,$),!0}function o(Q,Z,$,J){let Y=`${Z}
305
306
  ${J.trim()}
306
- ${$}`,V="";try{V=u(Q,"utf8")}catch{}let q=new RegExp(`${Z}[\\s\\S]*?${$}`);V=q.test(V)?V.replace(q,Y):V.trim()?`${V.trim()}
307
+ ${$}`,V="";try{V=R(Q,"utf8")}catch{}let q=new RegExp(`${Z}[\\s\\S]*?${$}`);V=q.test(V)?V.replace(q,Y):V.trim()?`${V.trim()}
307
308
 
308
309
  ${Y}
309
310
  `:`${Y}
310
- `,CQ(sQ(Q),{recursive:!0}),l(Q,V.endsWith(`
311
+ `,MQ(aQ(Q),{recursive:!0}),n(Q,V.endsWith(`
311
312
  `)?V:`${V}
312
- `)}function O(Q,Z){try{return u(Q,"utf8").includes(Z)}catch{return!1}}function o(Q,Z,$){let J="";try{J=u(Q,"utf8")}catch{return!1}let Y=new RegExp(`${Z}[\\s\\S]*?${$}\\n?`);if(!Y.test(J))return!1;let V=J.replace(Y,"").replace(/\n{3,}/g,`
313
+ `)}function O(Q,Z){try{return R(Q,"utf8").includes(Z)}catch{return!1}}function i(Q,Z,$){let J="";try{J=R(Q,"utf8")}catch{return!1}let Y=new RegExp(`${Z}[\\s\\S]*?${$}\\n?`);if(!Y.test(J))return!1;let V=J.replace(Y,"").replace(/\n{3,}/g,`
313
314
 
314
- `).trimStart();return l(Q,V),!0}function i(Q,Z,$){let J=C(Q,Z);CQ(J,{recursive:!0});let Y=C(J,"SKILL.md");return l(Y,$),Y}function y(Q,Z){return c(C(Q,Z,"SKILL.md"))}function e(Q,Z){let $=C(Q,Z);if(!c($))return!1;return hZ($,{recursive:!0,force:!0}),!0}var B,s=`## Beacon (visual planning panel)
315
+ `).trimStart();return n(Q,V),!0}function e(Q,Z,$){let J=M(Q,Z);MQ(J,{recursive:!0});let Y=M(J,"SKILL.md");return n(Y,$),Y}function y(Q,Z){return l(M(Q,Z,"SKILL.md"))}function QQ(Q,Z){let $=M(Q,Z);if(!l($))return!1;return cZ($,{recursive:!0,force:!0}),!0}var v,t=`## Beacon (visual planning panel)
315
316
 
316
317
  This machine has Beacon installed \u2014 a local visual planning surface for the terminal-side
317
318
  agent. Beacon proposes feature plans (roadmap features + DB schema + endpoints) via MCP,
@@ -335,19 +336,19 @@ the user reviews on a canvas at /plan, and feedback flows back as the next round
335
336
  Feedback bundles inline annotations on the markdown PLUS any edits the user made directly
336
337
  on the /map and /db boards (added features, attached subtasks, edited columns, new
337
338
  endpoints). Treat board edits as the user's revision intent \u2014 re-propose matching them
338
- verbatim. Do NOT implement until the tool returns approval.`;var wQ=F(()=>{B=["beacon-init","beacon-refresh","beacon-plan","beacon-explain"]});import{mkdirSync as cZ,renameSync as lZ,rmSync as nZ,writeFileSync as sZ}from"fs";import{dirname as tZ}from"path";function QQ(Q,Z){cZ(tZ(Q),{recursive:!0});let $=`${Q}.tmp`;try{sZ($,Z),lZ($,Q)}catch(J){throw nZ($,{force:!0}),J}}function Y1(Q,Z,$=!1){QQ(Q,JSON.stringify(Z,null,$?2:void 0))}var rQ=()=>{};var JZ={};BQ(JZ,{setupCodexAssets:()=>rZ,removeCodexMcp:()=>$Z,removeCodexArtifacts:()=>oZ,hasCodexMcp:()=>RQ,ensureCodexMcp:()=>ZZ,codexMcpProblem:()=>uQ,codexDetected:()=>VQ,auditCodex:()=>gQ,CODEX_HOOKS:()=>f});import{readFileSync as YQ}from"fs";import{homedir as aZ}from"os";import{join as _}from"path";function oQ(){return process.env.HOME||process.env.USERPROFILE||aZ()}function VQ(){if(process.env.BEACON_CODEX==="1")return!0;if(process.env.BEACON_CODEX==="0")return!1;if(fQ===void 0)fQ=Bun.which("codex")!==null;return fQ}function b(Q){try{return Bun.TOML.parse(Q)}catch{return null}}function RQ(){try{return Boolean(b(YQ(g(),"utf8"))?.mcp_servers?.beacon)}catch{return!1}}function uQ(){let Q="";try{Q=YQ(g(),"utf8")}catch{return null}let Z=b(Q);if(!Z)return`~/.codex/config.toml does not parse \u2014 ${A}`;if(Z.mcp_servers?.beacon)return null;if(/^\s*mcp_servers\s*=/m.test(Q))return`mcp_servers is an inline table \u2014 ${A}`;return null}function ZZ(){let Q="",Z=!1;try{Q=YQ(g(),"utf8"),Z=!0}catch{}if(Z){let V=b(Q);if(!V)return{added:!1,error:`~/.codex/config.toml does not parse \u2014 ${A}`};if(V.mcp_servers?.beacon)return{added:!1};if(/^\s*mcp_servers\s*=/m.test(Q))return{added:!1,error:`mcp_servers is an inline table \u2014 ${A}`}}let $=!Q?"":Q.endsWith(`
339
+ verbatim. Do NOT implement until the tool returns approval.`;var fQ=F(()=>{v=["beacon-init","beacon-refresh","beacon-plan","beacon-explain"]});import{mkdirSync as sZ,renameSync as tZ,rmSync as aZ,writeFileSync as dZ}from"fs";import{dirname as rZ}from"path";function ZQ(Q,Z){sZ(rZ(Q),{recursive:!0});let $=`${Q}.tmp`;try{dZ($,Z),tZ($,Q)}catch(J){throw aZ($,{force:!0}),J}}function q1(Q,Z,$=!1){ZQ(Q,JSON.stringify(Z,null,$?2:void 0))}var iQ=()=>{};var VZ={};BQ(VZ,{setupCodexAssets:()=>eZ,removeCodexMcp:()=>YZ,removeCodexArtifacts:()=>Q0,hasCodexMcp:()=>RQ,ensureCodexMcp:()=>JZ,codexMcpProblem:()=>gQ,codexDetected:()=>zQ,auditCodex:()=>EQ,CODEX_HOOKS:()=>T});import{readFileSync as VQ}from"fs";import{homedir as oZ}from"os";import{join as k}from"path";function eQ(){return process.env.HOME||process.env.USERPROFILE||oZ()}function zQ(){if(process.env.BEACON_CODEX==="1")return!0;if(process.env.BEACON_CODEX==="0")return!1;if(TQ===void 0)TQ=Bun.which("codex")!==null;return TQ}function b(Q){try{return Bun.TOML.parse(Q)}catch{return null}}function RQ(){try{return Boolean(b(VQ(g(),"utf8"))?.mcp_servers?.beacon)}catch{return!1}}function gQ(){let Q="";try{Q=VQ(g(),"utf8")}catch{return null}let Z=b(Q);if(!Z)return`~/.codex/config.toml does not parse \u2014 ${A}`;if(Z.mcp_servers?.beacon)return null;if(/^\s*mcp_servers\s*=/m.test(Q))return`mcp_servers is an inline table \u2014 ${A}`;return null}function JZ(){let Q="",Z=!1;try{Q=VQ(g(),"utf8"),Z=!0}catch{}if(Z){let V=b(Q);if(!V)return{added:!1,error:`~/.codex/config.toml does not parse \u2014 ${A}`};if(V.mcp_servers?.beacon)return{added:!1};if(/^\s*mcp_servers\s*=/m.test(Q))return{added:!1,error:`mcp_servers is an inline table \u2014 ${A}`}}let $=!Q?"":Q.endsWith(`
339
340
  `)?`
340
341
  `:`
341
342
 
342
- `,J=Q+$+dZ;if(b(J)?.mcp_servers?.beacon?.command!=="beacon")return{added:!1,error:`could not safely append [mcp_servers.beacon] \u2014 ${A}`};return QQ(g(),J),{added:!0}}function $Z(){let Q="";try{Q=YQ(g(),"utf8")}catch{return{removed:!1}}let Z=Q.split(`
343
- `),$=Z.indexOf(eQ);if($===-1)return{removed:!1,skipped:RQ()};let J=Z.indexOf(QZ,$);if(J===-1)return{removed:!1,skipped:!0};Z.splice($,J-$+1);let Y=Z.join(`
343
+ `,J=Q+$+iZ;if(b(J)?.mcp_servers?.beacon?.command!=="beacon")return{added:!1,error:`could not safely append [mcp_servers.beacon] \u2014 ${A}`};return ZQ(g(),J),{added:!0}}function YZ(){let Q="";try{Q=VQ(g(),"utf8")}catch{return{removed:!1}}let Z=Q.split(`
344
+ `),$=Z.indexOf(ZZ);if($===-1)return{removed:!1,skipped:RQ()};let J=Z.indexOf($Z,$);if(J===-1)return{removed:!1,skipped:!0};Z.splice($,J-$+1);let Y=Z.join(`
344
345
  `).replace(/\n{3,}/g,`
345
346
 
346
- `).replace(/^\n+/,"");if(b(Y)===null)return{removed:!1,skipped:!0};return QQ(g(),Y),{removed:!0}}async function rZ(){let{INIT_SKILL:Q,REFRESH_SKILL:Z,PLAN_SKILL:$,EXPLAIN_SKILL:J}=await Promise.resolve().then(() => (p(),KQ)),Y={"beacon-init":Q,"beacon-refresh":Z,"beacon-plan":$,"beacon-explain":J},V=[];for(let U of B){if(!y($Q(),U))V.push(U);i($Q(),U,Y[U])}let q=0;for(let U of f)if(t(FQ(),{event:U.event,matcher:U.matcher,command:U.command}))q++;let H=O(ZQ(),JQ);r(ZQ(),JQ,iQ,s);let z=ZZ();return{skillsAdded:V,hooksAdded:q,agentsMdBlockTouched:!H,mcp:z}}function gQ(){let Q={};for(let $ of B)Q[$]=y($Q(),$);let Z={};for(let $ of f)Z[$.event]=a(FQ(),{event:$.event,command:$.command});return{detected:VQ(),skills:Q,hooks:Z,agentsMdBlock:O(ZQ(),JQ),mcp:RQ()}}function oZ(){let Q=[];for(let Y of B)if(e($Q(),Y))Q.push(Y);let Z=0;for(let Y of f)if(d(FQ(),{event:Y.event,command:Y.command}))Z++;let $=o(ZQ(),JQ,iQ),J=$Z();return{skillsRemoved:Q,hooksRemoved:Z,agentsMdBlockRemoved:$,mcpRemoved:J.removed,mcpSkipped:J.skipped}}var TQ=()=>_(oQ(),".codex"),FQ=()=>_(TQ(),"hooks.json"),g=()=>_(TQ(),"config.toml"),ZQ=()=>_(TQ(),"AGENTS.md"),$Q=()=>_(oQ(),".agents","skills"),JQ="<!-- beacon:global:start -->",iQ="<!-- beacon:global:end -->",f,fQ,eQ="# beacon:start (managed by Beacon \u2014 `beacon uninstall` removes this block)",QZ="# beacon:end",dZ,A="add it manually: codex mcp add beacon -- beacon mcp";var EQ=F(()=>{wQ();rQ();f=[{event:"PostToolUse",matcher:"apply_patch",command:"beacon hook",description:"Report file edits to Beacon's active feature so the map stays fresh."},{event:"UserPromptSubmit",matcher:"*",command:"beacon prompt",description:"On feature-y prompts in a Beacon-wired repo, remind the agent to run the context\u2192propose\u2192describe loop (no-op otherwise)."},{event:"Stop",matcher:"*",command:"beacon stop-hook",description:"When the agent ends a turn asking for plan approval in prose, nudge it to present the plan on Beacon's /plan canvas."}];dZ=`${eQ}
347
+ `).replace(/^\n+/,"");if(b(Y)===null)return{removed:!1,skipped:!0};return ZQ(g(),Y),{removed:!0}}async function eZ(){let{INIT_SKILL:Q,REFRESH_SKILL:Z,PLAN_SKILL:$,EXPLAIN_SKILL:J}=await Promise.resolve().then(() => (c(),CQ)),Y={"beacon-init":Q,"beacon-refresh":Z,"beacon-plan":$,"beacon-explain":J},V=[];for(let U of v){if(!y(JQ(),U))V.push(U);e(JQ(),U,Y[U])}let q=0;for(let U of T)if(a(FQ(),{event:U.event,matcher:U.matcher,command:U.command}))q++;let H=O($Q(),YQ);o($Q(),YQ,QZ,t);let z=JZ();return{skillsAdded:V,hooksAdded:q,agentsMdBlockTouched:!H,mcp:z}}function EQ(){let Q={};for(let $ of v)Q[$]=y(JQ(),$);let Z={};for(let $ of T)Z[$.event]=d(FQ(),{event:$.event,command:$.command});return{detected:zQ(),skills:Q,hooks:Z,agentsMdBlock:O($Q(),YQ),mcp:RQ()}}function Q0(){let Q=[];for(let Y of v)if(QQ(JQ(),Y))Q.push(Y);let Z=0;for(let Y of T)if(r(FQ(),{event:Y.event,command:Y.command}))Z++;let $=i($Q(),YQ,QZ),J=YZ();return{skillsRemoved:Q,hooksRemoved:Z,agentsMdBlockRemoved:$,mcpRemoved:J.removed,mcpSkipped:J.skipped}}var uQ=()=>k(eQ(),".codex"),FQ=()=>k(uQ(),"hooks.json"),g=()=>k(uQ(),"config.toml"),$Q=()=>k(uQ(),"AGENTS.md"),JQ=()=>k(eQ(),".agents","skills"),YQ="<!-- beacon:global:start -->",QZ="<!-- beacon:global:end -->",T,TQ,ZZ="# beacon:start (managed by Beacon \u2014 `beacon uninstall` removes this block)",$Z="# beacon:end",iZ,A="add it manually: codex mcp add beacon -- beacon mcp";var IQ=F(()=>{fQ();iQ();T=[{event:"PostToolUse",matcher:"apply_patch",command:"beacon hook",description:"Report file edits to Beacon's active feature so the map stays fresh."},{event:"UserPromptSubmit",matcher:"*",command:"beacon prompt",description:"On feature-y prompts in a Beacon-wired repo, remind the agent to run the context\u2192propose\u2192describe loop (no-op otherwise)."},{event:"Stop",matcher:"*",command:"beacon stop-hook",description:"When the agent ends a turn asking for plan approval in prose, nudge it to present the plan on Beacon's /plan canvas."}];iZ=`${ZZ}
347
348
  [mcp_servers.beacon]
348
349
  command = "beacon"
349
350
  args = ["mcp"]
350
- ${QZ}
351
- `});var UZ={};BQ(UZ,{provisionDb:()=>w0});import{createClient as H0}from"@libsql/client";import{drizzle as j0}from"drizzle-orm/libsql";import{migrate as v0}from"drizzle-orm/libsql/migrator";import{readMigrationFiles as B0}from"drizzle-orm/migrator";import{dirname as AQ,join as N0}from"path";import{fileURLToPath as G0}from"url";async function XQ(Q,Z){return(await Q.execute({sql:"SELECT 1 FROM sqlite_master WHERE type='table' AND name = ?",args:[Z]})).rows.length>0}async function C0(Q,Z){let $=await Q.execute(`PRAGMA table_info("${Z}")`);return new Set($.rows.map((J)=>String(J.name)))}async function XZ(Q){if(!await XQ(Q,"__drizzle_migrations"))return 0;let Z=await Q.execute('SELECT count(*) AS n FROM "__drizzle_migrations"');return Number(Z.rows[0]?.n??0)}async function M0(Q){for(let[Z,$]of Object.entries(K0)){if(!await XQ(Q,Z))continue;let J=await C0(Q,Z);for(let Y of $){if(!J.has(Y))continue;await Q.execute(`UPDATE "${Z}" SET "${Y}" = CAST((julianday("${Y}") - 2440587.5) * 86400000 AS INTEGER) WHERE typeof("${Y}") = 'text'`)}}}async function w0(Q,Z=x0){let $=H0({url:Q});try{await $.execute("PRAGMA journal_mode = WAL;"),await $.execute("PRAGMA foreign_keys = ON;"),await $.execute("PRAGMA busy_timeout = 5000;");let J=await XQ($,"__drizzle_migrations"),Y=await XQ($,"Node"),V=!1;if(Y&&!J){let H=B0({migrationsFolder:Z})[0];if(H)await $.execute('CREATE TABLE IF NOT EXISTS "__drizzle_migrations" (id SERIAL PRIMARY KEY, hash text NOT NULL, created_at numeric)'),await $.execute({sql:'INSERT INTO "__drizzle_migrations" ("hash", "created_at") VALUES (?, ?)',args:[H.hash,H.folderMillis]}),V=!0}let q=await XZ($);if(await v0(j0($),{migrationsFolder:Z}),await XZ($)>q)V=!0;return await M0($),{migrated:V}}finally{$.close()}}var P0,x0,K0;var WZ=F(async()=>{P0=AQ(AQ(AQ(G0(import.meta.url)))),x0=process.env.BEACON_MIGRATIONS_DIR||N0(P0,"drizzle"),K0={Node:["createdAt","updatedAt"],Note:["createdAt","updatedAt"],DbTable:["createdAt","updatedAt"],Endpoint:["createdAt","updatedAt"],DraftTable:["createdAt"],SyncState:["codeGraphSyncedAt","updatedAt"],AppSetting:["updatedAt"],ProjectMeta:["updatedAt"],CodeFile:["updatedAt"]}});wQ();import{existsSync as iZ}from"fs";import{homedir as eZ}from"os";import{join as zQ}from"path";function Q0(){return process.env.HOME||process.env.USERPROFILE||eZ()}var qQ=()=>zQ(Q0(),".claude"),DQ=()=>zQ(qQ(),"skills"),IQ=()=>zQ(qQ(),"settings.json"),OQ=()=>zQ(qQ(),"CLAUDE.md"),yQ="<!-- beacon:global:start -->",YZ="<!-- beacon:global:end -->";var Z0=s,E=[{event:"PreToolUse",matcher:"Edit|Write|MultiEdit",command:"beacon guard",description:"Gate edits against the active plan's scope contract (when the scope-guard flag is on): in-scope \u2192 allow, off-scope \u2192 ask the user to authorize. No-op + fail-open otherwise."},{event:"PostToolUse",matcher:"Edit|Write|MultiEdit",command:"beacon hook",description:"Report file edits to Beacon's active feature so the map stays fresh."},{event:"PermissionRequest",matcher:"ExitPlanMode",command:"beacon plan",description:"Pipe the agent's plan markdown into Beacon's /plan canvas for review."},{event:"UserPromptSubmit",matcher:"*",command:"beacon prompt",description:"On feature-y prompts in a Beacon-wired repo, remind the agent to run the context\u2192propose\u2192describe loop (no-op otherwise)."},{event:"Stop",matcher:"*",command:"beacon stop-hook",description:"When the agent ends a turn asking for plan approval in prose (instead of presenting it), nudge it to present the plan on Beacon's /plan canvas. Bounded by stop_hook_active \u2014 at most one nudge."}];function $0(Q,Z){return i(DQ(),Q,Z)}function VZ(Q){return y(DQ(),Q)}function J0(Q){return e(DQ(),Q)}function Y0(Q){return t(IQ(),Q)}function V0(Q){return a(IQ(),Q)}function z0(Q){return d(IQ(),Q)}function q0(Q){r(OQ(),yQ,YZ,Q)}function zZ(){return O(OQ(),yQ)}function X0(){return o(OQ(),yQ,YZ)}function qZ(){let Q={};for(let $ of B)Q[$]=VZ($);let Z={};for(let $ of E)Z[$.event]=V0({event:$.event,command:$.command});return{homeExists:iZ(qQ()),skills:Q,hooks:Z,claudeMdBlock:zZ()}}async function U0(){let{INIT_SKILL:Q,REFRESH_SKILL:Z,PLAN_SKILL:$,EXPLAIN_SKILL:J}=await Promise.resolve().then(() => (p(),KQ)),Y={"beacon-init":Q,"beacon-refresh":Z,"beacon-plan":$,"beacon-explain":J},V=[];for(let z of B){if(!VZ(z))V.push(z);$0(z,Y[z])}let q=0;for(let z of E)if(Y0({event:z.event,matcher:z.matcher,command:z.command}))q++;let H=zZ();return q0(Z0),{skillsAdded:V,hooksAdded:q,claudeMdBlockTouched:!H}}async function N1(){if(tQ())return{ok:!0,skipped:"plugin",skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1};let Q;if(aQ()){try{W0()}catch{}Q={ok:!0,skipped:"plugin-present",skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1}}else try{Q={ok:!0,...await U0()}}catch(Z){Q={ok:!1,error:Z instanceof Error?Z.message:String(Z),skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1}}try{let Z=await Promise.resolve().then(() => (EQ(),JZ));if(Z.codexDetected())Q.codex={ok:!0,...await Z.setupCodexAssets()}}catch(Z){Q.codex={ok:!1,error:Z instanceof Error?Z.message:String(Z),skillsAdded:[],hooksAdded:0,agentsMdBlockTouched:!1,mcp:{added:!1}}}return Q}function W0(){let Q=[];for(let J of B)if(J0(J))Q.push(J);let Z=0;for(let J of E)if(z0(J))Z++;let $=X0();return{skillsRemoved:Q,hooksRemoved:Z,claudeMdBlockRemoved:$}}import{AsyncLocalStorage as f0}from"async_hooks";import{spawnSync as T0}from"child_process";import{createHash as F0}from"crypto";import{existsSync as jZ,mkdirSync as k,readFileSync as _Q,writeFileSync as kQ}from"fs";import{homedir as vZ}from"os";import{basename as R0,join as M,parse as u0,resolve as HZ}from"path";function P(){return process.env.BEACON_HOME||M(vZ(),".beacon")}function LQ(){return M(P(),"workspaces.json")}function UQ(Q){return F0("sha256").update(Q).digest("hex").slice(0,12)}function E1(Q=process.cwd()){let Z=T0("git",["rev-parse","--show-toplevel"],{cwd:Q,stdio:["ignore","pipe","ignore"]});if(Z.status===0){let $=Z.stdout?.toString().trim();if($)return $}return Q}function BZ(Q){let Z=HZ(Q);return Z!==HZ(vZ())&&Z!==u0(Z).root}function NZ(){return M(P(),"deleted.json")}function SQ(){try{let Q=JSON.parse(_Q(NZ(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function GZ(Q){k(P(),{recursive:!0}),kQ(NZ(),JSON.stringify(Q,null,2))}function PZ(Q){return SQ().includes(Q)}function D1(Q){let Z=SQ();if(!Z.includes(Q))GZ([...Z,Q])}function g0(Q){let Z=SQ();if(Z.includes(Q))GZ(Z.filter(($)=>$!==Q))}function WQ(Q){return M(P(),Q)}function E0(Q){return`file:${M(WQ(Q),"db.sqlite")}`}function L(){try{let Q=JSON.parse(_Q(LQ(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function hQ(Q){k(P(),{recursive:!0}),kQ(LQ(),JSON.stringify(Q,null,2))}function HQ(){return L().sort((Q,Z)=>Z.lastOpenedAt.localeCompare(Q.lastOpenedAt))}function T(Q){return L().find((Z)=>Z.id===Q)??null}function xZ(Q,Z,$=new Date().toISOString()){if(!BZ(Q))throw Error(`beacon: refusing to register a non-repo path as a workspace: ${Q}`);let J=UQ(Q);if(PZ(J))throw Error(`beacon: workspace ${J} (${Q}) was deleted \u2014 run \`beacon\` or /beacon-init to re-add it`);let Y=L(),V=Y.find((z)=>z.id===J),q={id:J,path:Q,name:Z||V?.name||R0(Q),lastOpenedAt:$},H=[q,...Y.filter((z)=>z.id!==J)];return k(WQ(J),{recursive:!0}),hQ(H),q}function I1(Q,Z){return g0(UQ(Q)),xZ(Q,Z)}function O1(Q,Z=new Date().toISOString()){let $=L(),J=$.find((Y)=>Y.id===Q);if(!J)return;J.lastOpenedAt=Z,hQ($)}function y1(Q){if(hQ(L().filter((Z)=>Z.id!==Q)),mQ()===Q)D0(HQ()[0]?.id??null)}function KZ(){return M(P(),"active")}function mQ(){try{return _Q(KZ(),"utf8").trim()||null}catch{return null}}function D0(Q){k(P(),{recursive:!0}),kQ(KZ(),Q??"")}function A1(){let Q=mQ();return Q?T(Q):null}function b1(){let Q=y0()??mQ();return Q?T(Q):null}function _1(Q){return T(Q)?.path??null}function k1(){return jZ(LQ())}var CZ="beacon_ws";function MZ(Q,Z){let $=Q.headers.get("cookie");if(!$)return null;for(let J of $.split(";")){let Y=J.indexOf("=");if(Y===-1)continue;if(J.slice(0,Y).trim()===Z)return decodeURIComponent(J.slice(Y+1).trim())}return null}function L1(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&T(Z))return Z;let $=MZ(Q,CZ);if($&&T($))return $;return I0()}function I0(){let Q=HQ();return Q.length===1?Q[0].id:null}var O0="x-beacon-workspace-path";async function S1(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&T(Z))return Z;let $=Q.headers.get(O0);if($&&BZ($)&&!PZ(UQ($))&&(!Z||UQ($)===Z)){let Y=xZ($);return await A0(Y.id),Y.id}let J=MZ(Q,CZ);if(J&&T(J))return J;return null}var wZ=new f0;function h1(Q,Z){return Q?wZ.run(Q,Z):Z()}function y0(){return wZ.getStore()??null}var bQ=new Set;function m1(Q){bQ.delete(M(WQ(Q),"db.sqlite"))}async function A0(Q){let Z=WQ(Q),$=M(Z,"db.sqlite"),J=jZ($);if(J&&bQ.has($))return{ok:!0,created:!1,migrated:!1};try{k(Z,{recursive:!0});let{provisionDb:Y}=await WZ().then(() => UZ),V=await Y(E0(Q));return bQ.add($),{ok:!0,created:!J,migrated:J&&V.migrated}}catch(Y){return{ok:!1,created:!1,migrated:!1,error:Y instanceof Error?Y.message:String(Y)}}}p();EQ();import{execSync as b0,spawnSync as TZ}from"child_process";import{existsSync as _0,readFileSync as k0}from"fs";import{join as FZ}from"path";var W=(Q)=>`\x1B[32m\u2713\x1B[0m ${Q}`,j=(Q)=>`\x1B[31m\u2717\x1B[0m ${Q}`,x=(Q)=>`\x1B[2m${Q}\x1B[0m`,D=(Q)=>`
352
- \x1B[1m${Q}\x1B[0m`;function L0(){try{return b0("git rev-parse --show-toplevel",{cwd:process.cwd(),stdio:["ignore","pipe","ignore"]}).toString().trim()}catch{return""}}function S0(){let Q=FZ(P(),"server.json");try{let Z=JSON.parse(k0(Q,"utf8"));if(!Z.pid)return j("daemon: no server.json yet");try{return process.kill(Z.pid,0),W(`daemon running (pid ${Z.pid}, port ${Z.port??"?"})`)}catch{return j(`daemon NOT running (server.json stale: pid ${Z.pid})`)}}catch{return j("daemon: no server.json (never started)")}}function h0(){let Q=TZ("bun",["--version"],{stdio:["ignore","pipe","ignore"]});if(Q.status===0)return W(`bun ${Q.stdout.toString().trim()}`);return j("bun NOT found on PATH (required to run Beacon)")}function m0(){return L0()||process.cwd()}var jQ=m0(),w=qZ(),RZ=HQ(),p0=RZ.some((Q)=>Q.path===jQ),v=p0||_0(FZ(jQ,".mcp.json"))?xQ(jQ):null;console.log(D("Beacon \xB7 doctor"));console.log(D("Runtime"));console.log(` ${h0()}`);console.log(` ${S0()}`);console.log(` ${W(`home: ${P()}`)}`);console.log(` ${W(`workspaces registered: ${RZ.length}`)}`);console.log(D("Global (~/.claude/)"));for(let Q of B)console.log(` ${w.skills[Q]?W(`skill ${Q}`):j(`skill ${Q} \u2014 missing`)}`);for(let Q of E)console.log(` ${w.hooks[Q.event]?W(`hook ${Q.event} \u2192 ${Q.command}`):j(`hook ${Q.event} \u2192 ${Q.command} \u2014 missing`)} ${x(Q.description)}`);console.log(` ${w.claudeMdBlock?W("global CLAUDE.md block"):j("global CLAUDE.md block \u2014 missing (every Claude session won't auto-discover Beacon)")}`);console.log(D("Plugin (Claude Code)"));var fZ=n();if(fZ)if(console.log(` ${W(`installed as a Claude Code plugin \u2192 ${fZ}`)}`),console.log(` ${x("the plugin owns the Claude-side skills/hooks/MCP")}`),w.hooks.PostToolUse||B.some((Q)=>w.skills[Q]))console.log(` ${x("npm-global ~/.claude entries still present \u2014 they'll be removed automatically on the next `beacon` run (run `beacon` once to deconflict now).")}`);else console.log(` ${W("npm-global ~/.claude layer stepped aside \u2014 no double-registration")}`);else console.log(` ${x("not installed as a Claude Code plugin (using the npm `trybeacon` CLI).")}`);console.log(D("Codex (~/.codex/ + ~/.agents/)"));var G=VQ()?gQ():null;if(!G)console.log(` ${x("codex not on PATH \u2014 Codex integration inactive (wires automatically once codex is installed)")}`);else{let Q=TZ("codex",["--version"],{stdio:["ignore","pipe","ignore"]});console.log(` ${Q.status===0?W(`codex ${Q.stdout.toString().trim()}`):x("codex version unavailable (BEACON_CODEX override?)")}`);for(let $ of B)console.log(` ${G.skills[$]?W(`skill ${$} (~/.agents/skills)`):j(`skill ${$} (~/.agents/skills) \u2014 missing`)}`);for(let $ of f)console.log(` ${G.hooks[$.event]?W(`hook ${$.event} \u2192 ${$.command}`):j(`hook ${$.event} \u2192 ${$.command} \u2014 missing`)} ${x($.description)}`);console.log(` ${G.agentsMdBlock?W("global ~/.codex/AGENTS.md block"):j("global ~/.codex/AGENTS.md block \u2014 missing")}`);let Z=uQ();console.log(` ${G.mcp?W("config.toml has [mcp_servers.beacon]"):j(`config.toml missing [mcp_servers.beacon]${Z?` \u2014 ${Z}`:""}`)}`)}console.log(D(`Current repo (${jQ})`));if(!v)console.log(` ${x("not registered with Beacon and no .mcp.json \u2014 run `beacon` here to wire it.")}`);else if(console.log(` ${v.mcpRegistered?W(".mcp.json has beacon entry"):j(".mcp.json missing beacon entry")}`),console.log(` ${v.agentsMdBlock?W("AGENTS.md has Beacon workflow block"):j("AGENTS.md missing Beacon workflow block")}`),console.log(` ${v.claudeMdImport?W("CLAUDE.md @-imports AGENTS.md"):j("CLAUDE.md does NOT @-import AGENTS.md")}`),console.log(` ${v.skills["beacon-init"]?W("skill beacon-init (repo)"):j("skill beacon-init (repo) \u2014 missing")}`),console.log(` ${v.skills["beacon-refresh"]?W("skill beacon-refresh (repo)"):j("skill beacon-refresh (repo) \u2014 missing")}`),G)console.log(` ${v.codexSkills["beacon-init"]?W("skill beacon-init (.agents/skills)"):j("skill beacon-init (.agents/skills) \u2014 missing")}`),console.log(` ${v.codexSkills["beacon-refresh"]?W("skill beacon-refresh (.agents/skills)"):j("skill beacon-refresh (.agents/skills) \u2014 missing")}`);var c0=B.some((Q)=>!w.skills[Q])||E.some((Q)=>!w.hooks[Q.event])||!w.claudeMdBlock||(G?B.some((Q)=>!G.skills[Q])||f.some((Q)=>!G.hooks[Q.event])||!G.agentsMdBlock||!G.mcp:!1)||(v?!v.mcpRegistered||!v.agentsMdBlock||!v.claudeMdImport||!v.skills["beacon-init"]||!v.skills["beacon-refresh"]||(G?!v.codexSkills["beacon-init"]||!v.codexSkills["beacon-refresh"]:!1):!1);if(c0)console.log(`
353
- ${x("Fix everything marked \u2717 by running")} \x1B[1mbeacon\x1B[0m ${x("in this repo.")}`);console.log();
351
+ ${$Z}
352
+ `});var HZ={};BQ(HZ,{provisionDb:()=>u0});import{createClient as B0}from"@libsql/client";import{drizzle as N0}from"drizzle-orm/libsql";import{migrate as G0}from"drizzle-orm/libsql/migrator";import{readMigrationFiles as P0}from"drizzle-orm/migrator";import{dirname as bQ,join as K0}from"path";import{fileURLToPath as x0}from"url";async function UQ(Q,Z){return(await Q.execute({sql:"SELECT 1 FROM sqlite_master WHERE type='table' AND name = ?",args:[Z]})).rows.length>0}async function f0(Q,Z){let $=await Q.execute(`PRAGMA table_info("${Z}")`);return new Set($.rows.map((J)=>String(J.name)))}async function WZ(Q){if(!await UQ(Q,"__drizzle_migrations"))return 0;let Z=await Q.execute('SELECT count(*) AS n FROM "__drizzle_migrations"');return Number(Z.rows[0]?.n??0)}async function T0(Q){for(let[Z,$]of Object.entries(w0)){if(!await UQ(Q,Z))continue;let J=await f0(Q,Z);for(let Y of $){if(!J.has(Y))continue;await Q.execute(`UPDATE "${Z}" SET "${Y}" = CAST((julianday("${Y}") - 2440587.5) * 86400000 AS INTEGER) WHERE typeof("${Y}") = 'text'`)}}}async function u0(Q,Z=M0){let $=B0({url:Q});try{await $.execute("PRAGMA journal_mode = WAL;"),await $.execute("PRAGMA foreign_keys = ON;"),await $.execute("PRAGMA busy_timeout = 5000;");let J=await UQ($,"__drizzle_migrations"),Y=await UQ($,"Node"),V=!1;if(Y&&!J){let H=P0({migrationsFolder:Z})[0];if(H)await $.execute('CREATE TABLE IF NOT EXISTS "__drizzle_migrations" (id SERIAL PRIMARY KEY, hash text NOT NULL, created_at numeric)'),await $.execute({sql:'INSERT INTO "__drizzle_migrations" ("hash", "created_at") VALUES (?, ?)',args:[H.hash,H.folderMillis]}),V=!0}let q=await WZ($);if(await G0(N0($),{migrationsFolder:Z}),await WZ($)>q)V=!0;return await T0($),{migrated:V}}finally{$.close()}}var C0,M0,w0;var jZ=F(async()=>{C0=bQ(bQ(bQ(x0(import.meta.url)))),M0=process.env.BEACON_MIGRATIONS_DIR||K0(C0,"drizzle"),w0={Node:["createdAt","updatedAt"],Note:["createdAt","updatedAt"],DbTable:["createdAt","updatedAt"],Endpoint:["createdAt","updatedAt"],DraftTable:["createdAt"],SyncState:["codeGraphSyncedAt","updatedAt"],AppSetting:["updatedAt"],ProjectMeta:["updatedAt"],CodeFile:["updatedAt"]}});fQ();import{existsSync as Z0}from"fs";import{homedir as $0}from"os";import{join as qQ}from"path";function J0(){return process.env.HOME||process.env.USERPROFILE||$0()}var XQ=()=>qQ(J0(),".claude"),DQ=()=>qQ(XQ(),"skills"),OQ=()=>qQ(XQ(),"settings.json"),yQ=()=>qQ(XQ(),"CLAUDE.md"),AQ="<!-- beacon:global:start -->",zZ="<!-- beacon:global:end -->";var Y0=t,E=[{event:"PreToolUse",matcher:"Edit|Write|MultiEdit",command:"beacon guard",description:"Gate edits against the active plan's scope contract: in-scope \u2192 allow, off-scope \u2192 ask the user to authorize. Fail-open when there's no active contract."},{event:"PostToolUse",matcher:"Edit|Write|MultiEdit",command:"beacon hook",description:"Report file edits to Beacon's active feature so the map stays fresh."},{event:"PermissionRequest",matcher:"ExitPlanMode",command:"beacon plan",description:"Pipe the agent's plan markdown into Beacon's /plan canvas for review."},{event:"PreToolUse",matcher:"AskUserQuestion",command:"beacon ask",description:"Surface the agent's AskUserQuestion in Beacon's modal; your pick flows back as the answer (falls through to the terminal if Beacon isn't open)."},{event:"PermissionRequest",matcher:"Edit|Write|MultiEdit|Bash|NotebookEdit",command:"beacon ask",description:"Surface edit/create/run approvals in Beacon's modal; your allow/deny flows back (falls through to the terminal prompt if Beacon isn't open)."},{event:"UserPromptSubmit",matcher:"*",command:"beacon prompt",description:"On feature-y prompts in a Beacon-wired repo, remind the agent to run the context\u2192propose\u2192describe loop (no-op otherwise)."},{event:"Stop",matcher:"*",command:"beacon stop-hook",description:"When the agent ends a turn asking for plan approval in prose (instead of presenting it), nudge it to present the plan on Beacon's /plan canvas. Bounded by stop_hook_active \u2014 at most one nudge."}];function V0(Q,Z){return e(DQ(),Q,Z)}function qZ(Q){return y(DQ(),Q)}function z0(Q){return QQ(DQ(),Q)}function q0(Q){return a(OQ(),Q)}function X0(Q){return d(OQ(),Q)}function U0(Q){return r(OQ(),Q)}function W0(Q){o(yQ(),AQ,zZ,Q)}function XZ(){return O(yQ(),AQ)}function H0(){return i(yQ(),AQ,zZ)}function UZ(){let Q={};for(let $ of v)Q[$]=qZ($);let Z={};for(let $ of E)Z[$.event]=X0({event:$.event,command:$.command});return{homeExists:Z0(XQ()),skills:Q,hooks:Z,claudeMdBlock:XZ()}}async function j0(){let{INIT_SKILL:Q,REFRESH_SKILL:Z,PLAN_SKILL:$,EXPLAIN_SKILL:J}=await Promise.resolve().then(() => (c(),CQ)),Y={"beacon-init":Q,"beacon-refresh":Z,"beacon-plan":$,"beacon-explain":J},V=[];for(let z of v){if(!qZ(z))V.push(z);V0(z,Y[z])}let q=0;for(let z of E)if(q0({event:z.event,matcher:z.matcher,command:z.command}))q++;let H=XZ();return W0(Y0),{skillsAdded:V,hooksAdded:q,claudeMdBlockTouched:!H}}async function K1(){if(dQ())return{ok:!0,skipped:"plugin",skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1};let Q;if(rQ()){try{v0()}catch{}Q={ok:!0,skipped:"plugin-present",skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1}}else try{Q={ok:!0,...await j0()}}catch(Z){Q={ok:!1,error:Z instanceof Error?Z.message:String(Z),skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1}}try{let Z=await Promise.resolve().then(() => (IQ(),VZ));if(Z.codexDetected())Q.codex={ok:!0,...await Z.setupCodexAssets()}}catch(Z){Q.codex={ok:!1,error:Z instanceof Error?Z.message:String(Z),skillsAdded:[],hooksAdded:0,agentsMdBlockTouched:!1,mcp:{added:!1}}}return Q}function v0(){let Q=[];for(let J of v)if(z0(J))Q.push(J);let Z=0;for(let J of E)if(U0(J))Z++;let $=H0();return{skillsRemoved:Q,hooksRemoved:Z,claudeMdBlockRemoved:$}}import{AsyncLocalStorage as F0}from"async_hooks";import{spawnSync as R0}from"child_process";import{createHash as g0}from"crypto";import{existsSync as BZ,mkdirSync as L,readFileSync as _Q,writeFileSync as LQ}from"fs";import{homedir as NZ}from"os";import{basename as E0,join as w,parse as I0,resolve as vZ}from"path";function P(){return process.env.BEACON_HOME||w(NZ(),".beacon")}function SQ(){return w(P(),"workspaces.json")}function _(Q){return g0("sha256").update(Q).digest("hex").slice(0,12)}function D0(Q=process.cwd()){let Z=R0("git",["rev-parse","--show-toplevel"],{cwd:Q,stdio:["ignore","pipe","ignore"]});if(Z.status===0){let $=Z.stdout?.toString().trim();if($)return $}return Q}function GZ(Q){let Z=vZ(Q);return Z!==vZ(NZ())&&Z!==I0(Z).root}function PZ(){return w(P(),"deleted.json")}function mQ(){try{let Q=JSON.parse(_Q(PZ(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function KZ(Q){L(P(),{recursive:!0}),LQ(PZ(),JSON.stringify(Q,null,2))}function xZ(Q){return mQ().includes(Q)}function O1(Q){let Z=mQ();if(!Z.includes(Q))KZ([...Z,Q])}function O0(Q){let Z=mQ();if(Z.includes(Q))KZ(Z.filter(($)=>$!==Q))}function WQ(Q){return w(P(),Q)}function y0(Q){return`file:${w(WQ(Q),"db.sqlite")}`}function S(){try{let Q=JSON.parse(_Q(SQ(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function hQ(Q){L(P(),{recursive:!0}),LQ(SQ(),JSON.stringify(Q,null,2))}function HQ(){return S().sort((Q,Z)=>Z.lastOpenedAt.localeCompare(Q.lastOpenedAt))}function u(Q){return S().find((Z)=>Z.id===Q)??null}function CZ(Q,Z,$=new Date().toISOString()){if(!GZ(Q))throw Error(`beacon: refusing to register a non-repo path as a workspace: ${Q}`);let J=_(Q);if(xZ(J))throw Error(`beacon: workspace ${J} (${Q}) was deleted \u2014 run \`beacon\` or /beacon-init to re-add it`);let Y=S(),V=Y.find((z)=>z.id===J),q={id:J,path:Q,name:Z||V?.name||E0(Q),lastOpenedAt:$},H=[q,...Y.filter((z)=>z.id!==J)];return L(WQ(J),{recursive:!0}),hQ(H),q}function y1(Q,Z){return O0(_(Q)),CZ(Q,Z)}function A1(Q,Z=new Date().toISOString()){let $=S(),J=$.find((Y)=>Y.id===Q);if(!J)return;J.lastOpenedAt=Z,hQ($)}function b1(Q){if(hQ(S().filter((Z)=>Z.id!==Q)),pQ()===Q)A0(HQ()[0]?.id??null)}function MZ(){return w(P(),"active")}function pQ(){try{return _Q(MZ(),"utf8").trim()||null}catch{return null}}function A0(Q){L(P(),{recursive:!0}),LQ(MZ(),Q??"")}function k1(){let Q=pQ();return Q?u(Q):null}function _1(){let Q=k0()??pQ();return Q?u(Q):null}function L1(Q){return u(Q)?.path??null}function S1(){return BZ(SQ())}var wZ="beacon_ws";function fZ(Q,Z){let $=Q.headers.get("cookie");if(!$)return null;for(let J of $.split(";")){let Y=J.indexOf("=");if(Y===-1)continue;if(J.slice(0,Y).trim()===Z)return decodeURIComponent(J.slice(Y+1).trim())}return null}function m1(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&u(Z))return Z;let $=fZ(Q,wZ);if($&&u($))return $;return b0()}function b0(){let Q=HQ();return Q.length===1?Q[0].id:null}var TZ="x-beacon-workspace-path";function h1(Q=process.cwd()){let Z=D0(Q);return{"x-beacon-workspace":_(Z),[TZ]:Z}}async function p1(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&u(Z))return Z;let $=Q.headers.get(TZ);if($&&GZ($)&&!xZ(_($))&&(!Z||_($)===Z)){let Y=CZ($);return await _0(Y.id),Y.id}let J=fZ(Q,wZ);if(J&&u(J))return J;return null}var uZ=new F0;function c1(Q,Z){return Q?uZ.run(Q,Z):Z()}function k0(){return uZ.getStore()??null}var kQ=new Set;function l1(Q){kQ.delete(w(WQ(Q),"db.sqlite"))}async function _0(Q){let Z=WQ(Q),$=w(Z,"db.sqlite"),J=BZ($);if(J&&kQ.has($))return{ok:!0,created:!1,migrated:!1};try{L(Z,{recursive:!0});let{provisionDb:Y}=await jZ().then(() => HZ),V=await Y(y0(Q));return kQ.add($),{ok:!0,created:!J,migrated:J&&V.migrated}}catch(Y){return{ok:!1,created:!1,migrated:!1,error:Y instanceof Error?Y.message:String(Y)}}}c();IQ();import{execSync as L0,spawnSync as RZ}from"child_process";import{existsSync as S0,readFileSync as m0}from"fs";import{join as gZ}from"path";var W=(Q)=>`\x1B[32m\u2713\x1B[0m ${Q}`,j=(Q)=>`\x1B[31m\u2717\x1B[0m ${Q}`,K=(Q)=>`\x1B[2m${Q}\x1B[0m`,I=(Q)=>`
353
+ \x1B[1m${Q}\x1B[0m`;function h0(){try{return L0("git rev-parse --show-toplevel",{cwd:process.cwd(),stdio:["ignore","pipe","ignore"]}).toString().trim()}catch{return""}}function p0(){let Q=gZ(P(),"server.json");try{let Z=JSON.parse(m0(Q,"utf8"));if(!Z.pid)return j("daemon: no server.json yet");try{return process.kill(Z.pid,0),W(`daemon running (pid ${Z.pid}, port ${Z.port??"?"})`)}catch{return j(`daemon NOT running (server.json stale: pid ${Z.pid})`)}}catch{return j("daemon: no server.json (never started)")}}function c0(){let Q=RZ("bun",["--version"],{stdio:["ignore","pipe","ignore"]});if(Q.status===0)return W(`bun ${Q.stdout.toString().trim()}`);return j("bun NOT found on PATH (required to run Beacon)")}function l0(){return h0()||process.cwd()}var jQ=l0(),f=UZ(),EZ=HQ(),n0=EZ.some((Q)=>Q.path===jQ),B=n0||S0(gZ(jQ,".mcp.json"))?xQ(jQ):null;console.log(I("Beacon \xB7 doctor"));console.log(I("Runtime"));console.log(` ${c0()}`);console.log(` ${p0()}`);console.log(` ${W(`home: ${P()}`)}`);console.log(` ${W(`workspaces registered: ${EZ.length}`)}`);console.log(I("Global (~/.claude/)"));for(let Q of v)console.log(` ${f.skills[Q]?W(`skill ${Q}`):j(`skill ${Q} \u2014 missing`)}`);for(let Q of E)console.log(` ${f.hooks[Q.event]?W(`hook ${Q.event} \u2192 ${Q.command}`):j(`hook ${Q.event} \u2192 ${Q.command} \u2014 missing`)} ${K(Q.description)}`);console.log(` ${f.claudeMdBlock?W("global CLAUDE.md block"):j("global CLAUDE.md block \u2014 missing (every Claude session won't auto-discover Beacon)")}`);console.log(I("Plugin (Claude Code)"));var FZ=s();if(FZ)if(console.log(` ${W(`installed as a Claude Code plugin \u2192 ${FZ}`)}`),console.log(` ${K("the plugin owns the Claude-side skills/hooks/MCP")}`),f.hooks.PostToolUse||v.some((Q)=>f.skills[Q]))console.log(` ${K("npm-global ~/.claude entries still present \u2014 they'll be removed automatically on the next `beacon` run (run `beacon` once to deconflict now).")}`);else console.log(` ${W("npm-global ~/.claude layer stepped aside \u2014 no double-registration")}`);else console.log(` ${K("not installed as a Claude Code plugin (using the npm `trybeacon` CLI).")}`);console.log(I("Codex (~/.codex/ + ~/.agents/)"));var G=zQ()?EQ():null;if(!G)console.log(` ${K("codex not on PATH \u2014 Codex integration inactive (wires automatically once codex is installed)")}`);else{let Q=RZ("codex",["--version"],{stdio:["ignore","pipe","ignore"]});console.log(` ${Q.status===0?W(`codex ${Q.stdout.toString().trim()}`):K("codex version unavailable (BEACON_CODEX override?)")}`);for(let $ of v)console.log(` ${G.skills[$]?W(`skill ${$} (~/.agents/skills)`):j(`skill ${$} (~/.agents/skills) \u2014 missing`)}`);for(let $ of T)console.log(` ${G.hooks[$.event]?W(`hook ${$.event} \u2192 ${$.command}`):j(`hook ${$.event} \u2192 ${$.command} \u2014 missing`)} ${K($.description)}`);console.log(` ${G.agentsMdBlock?W("global ~/.codex/AGENTS.md block"):j("global ~/.codex/AGENTS.md block \u2014 missing")}`);let Z=gQ();console.log(` ${G.mcp?W("config.toml has [mcp_servers.beacon]"):j(`config.toml missing [mcp_servers.beacon]${Z?` \u2014 ${Z}`:""}`)}`)}console.log(I(`Current repo (${jQ})`));if(!B)console.log(` ${K("not registered with Beacon and no .mcp.json \u2014 run `beacon` here to wire it.")}`);else if(console.log(` ${B.mcpRegistered?W(".mcp.json has beacon entry"):j(".mcp.json missing beacon entry")}`),console.log(` ${B.workflowBlock?W("AGENTS.md / CLAUDE.md has Beacon workflow block"):j("AGENTS.md / CLAUDE.md missing Beacon workflow block")}`),console.log(` ${B.skills["beacon-init"]?W("skill beacon-init (repo)"):j("skill beacon-init (repo) \u2014 missing")}`),console.log(` ${B.skills["beacon-refresh"]?W("skill beacon-refresh (repo)"):j("skill beacon-refresh (repo) \u2014 missing")}`),G)console.log(` ${B.codexSkills["beacon-init"]?W("skill beacon-init (.agents/skills)"):j("skill beacon-init (.agents/skills) \u2014 missing")}`),console.log(` ${B.codexSkills["beacon-refresh"]?W("skill beacon-refresh (.agents/skills)"):j("skill beacon-refresh (.agents/skills) \u2014 missing")}`);var s0=v.some((Q)=>!f.skills[Q])||E.some((Q)=>!f.hooks[Q.event])||!f.claudeMdBlock||(G?v.some((Q)=>!G.skills[Q])||T.some((Q)=>!G.hooks[Q.event])||!G.agentsMdBlock||!G.mcp:!1)||(B?!B.mcpRegistered||!B.workflowBlock||!B.skills["beacon-init"]||!B.skills["beacon-refresh"]||(G?!B.codexSkills["beacon-init"]||!B.codexSkills["beacon-refresh"]:!1):!1);if(s0)console.log(`
354
+ ${K("Fix everything marked \u2717 by running")} \x1B[1mbeacon\x1B[0m ${K("in this repo.")}`);console.log();
package/dist/bin/guard.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- var n=Object.defineProperty;var s=(Q)=>Q;function d(Q,X){this[Q]=s.bind(null,X)}var o=(Q,X)=>{for(var Z in X)n(Q,Z,{get:X[Z],enumerable:!0,configurable:!0,set:d.bind(X,Z)})};var a=(Q,X)=>()=>(Q&&(X=Q(Q=0)),X);var R={};o(R,{provisionDb:()=>VQ});import{createClient as t}from"@libsql/client";import{drizzle as r}from"drizzle-orm/libsql";import{migrate as i}from"drizzle-orm/libsql/migrator";import{readMigrationFiles as e}from"drizzle-orm/migrator";import{dirname as H,join as QQ}from"path";import{fileURLToPath as XQ}from"url";async function j(Q,X){return(await Q.execute({sql:"SELECT 1 FROM sqlite_master WHERE type='table' AND name = ?",args:[X]})).rows.length>0}async function YQ(Q,X){let Z=await Q.execute(`PRAGMA table_info("${X}")`);return new Set(Z.rows.map(($)=>String($.name)))}async function q(Q){if(!await j(Q,"__drizzle_migrations"))return 0;let X=await Q.execute('SELECT count(*) AS n FROM "__drizzle_migrations"');return Number(X.rows[0]?.n??0)}async function GQ(Q){for(let[X,Z]of Object.entries(JQ)){if(!await j(Q,X))continue;let $=await YQ(Q,X);for(let J of Z){if(!$.has(J))continue;await Q.execute(`UPDATE "${X}" SET "${J}" = CAST((julianday("${J}") - 2440587.5) * 86400000 AS INTEGER) WHERE typeof("${J}") = 'text'`)}}}async function VQ(Q,X=$Q){let Z=t({url:Q});try{await Z.execute("PRAGMA journal_mode = WAL;"),await Z.execute("PRAGMA foreign_keys = ON;"),await Z.execute("PRAGMA busy_timeout = 5000;");let $=await j(Z,"__drizzle_migrations"),J=await j(Z,"Node"),Y=!1;if(J&&!$){let B=e({migrationsFolder:X})[0];if(B)await Z.execute('CREATE TABLE IF NOT EXISTS "__drizzle_migrations" (id SERIAL PRIMARY KEY, hash text NOT NULL, created_at numeric)'),await Z.execute({sql:'INSERT INTO "__drizzle_migrations" ("hash", "created_at") VALUES (?, ?)',args:[B.hash,B.folderMillis]}),Y=!0}let V=await q(Z);if(await i(r(Z),{migrationsFolder:X}),await q(Z)>V)Y=!0;return await GQ(Z),{migrated:Y}}finally{Z.close()}}var ZQ,$Q,JQ;var D=a(async()=>{ZQ=H(H(H(XQ(import.meta.url)))),$Q=process.env.BEACON_MIGRATIONS_DIR||QQ(ZQ,"drizzle"),JQ={Node:["createdAt","updatedAt"],Note:["createdAt","updatedAt"],DbTable:["createdAt","updatedAt"],Endpoint:["createdAt","updatedAt"],DraftTable:["createdAt"],SyncState:["codeGraphSyncedAt","updatedAt"],AppSetting:["updatedAt"],ProjectMeta:["updatedAt"],CodeFile:["updatedAt"]}});import{AsyncLocalStorage as KQ}from"async_hooks";import{spawnSync as BQ}from"child_process";import{createHash as NQ}from"crypto";import{existsSync as v,mkdirSync as U,readFileSync as _,writeFileSync as T}from"fs";import{homedir as W}from"os";import{basename as MQ,join as K,parse as UQ,resolve as I}from"path";function G(){return process.env.BEACON_HOME||K(W(),".beacon")}function x(){return K(G(),"workspaces.json")}function M(Q){return NQ("sha256").update(Q).digest("hex").slice(0,12)}function S(Q=process.cwd()){let X=BQ("git",["rev-parse","--show-toplevel"],{cwd:Q,stdio:["ignore","pipe","ignore"]});if(X.status===0){let Z=X.stdout?.toString().trim();if(Z)return Z}return Q}function F(Q){let X=I(Q);return X!==I(W())&&X!==UQ(X).root}function P(){return K(G(),"deleted.json")}function E(){try{let Q=JSON.parse(_(P(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function y(Q){U(G(),{recursive:!0}),T(P(),JSON.stringify(Q,null,2))}function f(Q){return E().includes(Q)}function bQ(Q){let X=E();if(!X.includes(Q))y([...X,Q])}function LQ(Q){let X=E();if(X.includes(Q))y(X.filter((Z)=>Z!==Q))}function z(Q){return K(G(),Q)}function jQ(Q){return`file:${K(z(Q),"db.sqlite")}`}function L(){try{let Q=JSON.parse(_(x(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function u(Q){U(G(),{recursive:!0}),T(x(),JSON.stringify(Q,null,2))}function k(){return L().sort((Q,X)=>X.lastOpenedAt.localeCompare(Q.lastOpenedAt))}function N(Q){return L().find((X)=>X.id===Q)??null}function g(Q,X,Z=new Date().toISOString()){if(!F(Q))throw Error(`beacon: refusing to register a non-repo path as a workspace: ${Q}`);let $=M(Q);if(f($))throw Error(`beacon: workspace ${$} (${Q}) was deleted \u2014 run \`beacon\` or /beacon-init to re-add it`);let J=L(),Y=J.find((C)=>C.id===$),V={id:$,path:Q,name:X||Y?.name||MQ(Q),lastOpenedAt:Z},B=[V,...J.filter((C)=>C.id!==$)];return U(z($),{recursive:!0}),u(B),V}function mQ(Q,X){return LQ(M(Q)),g(Q,X)}function hQ(Q,X=new Date().toISOString()){let Z=L(),$=Z.find((J)=>J.id===Q);if(!$)return;$.lastOpenedAt=X,u(Z)}function pQ(Q){if(u(L().filter((X)=>X.id!==Q)),A()===Q)zQ(k()[0]?.id??null)}function w(){return K(G(),"active")}function A(){try{return _(w(),"utf8").trim()||null}catch{return null}}function zQ(Q){U(G(),{recursive:!0}),T(w(),Q??"")}function cQ(){let Q=A();return Q?N(Q):null}function lQ(){let Q=OQ()??A();return Q?N(Q):null}function nQ(Q){return N(Q)?.path??null}function sQ(){return v(x())}var b="beacon_ws";function m(Q,X){let Z=Q.headers.get("cookie");if(!Z)return null;for(let $ of Z.split(";")){let J=$.indexOf("=");if(J===-1)continue;if($.slice(0,J).trim()===X)return decodeURIComponent($.slice(J+1).trim())}return null}function dQ(Q){let X=Q.headers.get("x-beacon-workspace");if(X&&N(X))return X;let Z=m(Q,b);if(Z&&N(Z))return Z;return CQ()}function CQ(){let Q=k();return Q.length===1?Q[0].id:null}var HQ="x-beacon-workspace-path";async function oQ(Q){let X=Q.headers.get("x-beacon-workspace");if(X&&N(X))return X;let Z=Q.headers.get(HQ);if(Z&&F(Z)&&!f(M(Z))&&(!X||M(Z)===X)){let J=g(Z);return await _Q(J.id),J.id}let $=m(Q,b);if($&&N($))return $;return null}var h=new KQ;function aQ(Q,X){return Q?h.run(Q,X):X()}function OQ(){return h.getStore()??null}var O=new Set;function tQ(Q){O.delete(K(z(Q),"db.sqlite"))}async function _Q(Q){let X=z(Q),Z=K(X,"db.sqlite"),$=v(Z);if($&&O.has(Z))return{ok:!0,created:!1,migrated:!1};try{U(X,{recursive:!0});let{provisionDb:J}=await D().then(() => R),Y=await J(jQ(Q));return O.add(Z),{ok:!0,created:!$,migrated:$&&Y.migrated}}catch(J){return{ok:!1,created:!1,migrated:!1,error:J instanceof Error?J.message:String(J)}}}import{connect as TQ}from"net";var p=4319;function xQ(Q,X,Z=400){return new Promise(($)=>{let J=TQ({host:Q,port:X}),Y=!1,V=(B)=>{if(Y)return;Y=!0,J.destroy(),$(B)};J.once("connect",()=>V(!0)),J.once("error",()=>V(!1)),J.setTimeout(Z,()=>V(!1))})}async function EQ(Q){for(let X of["127.0.0.1","::1"])if(await xQ(X,Q))return!1;return!0}async function eQ(Q,X=20){for(let Z=Q;Z<Q+X;Z++)if(await EQ(Z))return Z;return Q}import{readFileSync as uQ}from"fs";import{join as AQ}from"path";function qQ(){try{return JSON.parse(uQ(AQ(G(),"server.json"),"utf8"))}catch{return null}}function c(){if(process.env.BEACON_URL)return process.env.BEACON_URL;return`http://localhost:${qQ()?.port||process.env.PORT||p}`}var l="";for await(let Q of process.stdin)l+=Q;try{let Q=JSON.parse(l||"{}"),X=Q?.tool_input?.file_path;if(typeof X==="string"&&X){let Z=M(S(typeof Q.cwd==="string"?Q.cwd:void 0)),$=await fetch(`${c()}/api/scope-guard/check?file=${encodeURIComponent(X)}`,{headers:{"x-beacon-workspace":Z}}).catch(()=>null);if($?.ok){let J=await $.json().catch(()=>null);if(J?.decision==="ask")process.stdout.write(JSON.stringify({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"ask",permissionDecisionReason:J.reason??"This edit is outside the current plan's declared scope."}}))}}}catch{}process.exit(0);
3
+ var s=Object.defineProperty;var d=(Q)=>Q;function o(Q,X){this[Q]=d.bind(null,X)}var a=(Q,X)=>{for(var Z in X)s(Q,Z,{get:X[Z],enumerable:!0,configurable:!0,set:o.bind(X,Z)})};var t=(Q,X)=>()=>(Q&&(X=Q(Q=0)),X);var R={};a(R,{provisionDb:()=>KQ});import{createClient as r}from"@libsql/client";import{drizzle as i}from"drizzle-orm/libsql";import{migrate as e}from"drizzle-orm/libsql/migrator";import{readMigrationFiles as QQ}from"drizzle-orm/migrator";import{dirname as O,join as XQ}from"path";import{fileURLToPath as ZQ}from"url";async function z(Q,X){return(await Q.execute({sql:"SELECT 1 FROM sqlite_master WHERE type='table' AND name = ?",args:[X]})).rows.length>0}async function GQ(Q,X){let Z=await Q.execute(`PRAGMA table_info("${X}")`);return new Set(Z.rows.map((J)=>String(J.name)))}async function I(Q){if(!await z(Q,"__drizzle_migrations"))return 0;let X=await Q.execute('SELECT count(*) AS n FROM "__drizzle_migrations"');return Number(X.rows[0]?.n??0)}async function VQ(Q){for(let[X,Z]of Object.entries(YQ)){if(!await z(Q,X))continue;let J=await GQ(Q,X);for(let $ of Z){if(!J.has($))continue;await Q.execute(`UPDATE "${X}" SET "${$}" = CAST((julianday("${$}") - 2440587.5) * 86400000 AS INTEGER) WHERE typeof("${$}") = 'text'`)}}}async function KQ(Q,X=JQ){let Z=r({url:Q});try{await Z.execute("PRAGMA journal_mode = WAL;"),await Z.execute("PRAGMA foreign_keys = ON;"),await Z.execute("PRAGMA busy_timeout = 5000;");let J=await z(Z,"__drizzle_migrations"),$=await z(Z,"Node"),Y=!1;if($&&!J){let V=QQ({migrationsFolder:X})[0];if(V)await Z.execute('CREATE TABLE IF NOT EXISTS "__drizzle_migrations" (id SERIAL PRIMARY KEY, hash text NOT NULL, created_at numeric)'),await Z.execute({sql:'INSERT INTO "__drizzle_migrations" ("hash", "created_at") VALUES (?, ?)',args:[V.hash,V.folderMillis]}),Y=!0}let G=await I(Z);if(await e(i(Z),{migrationsFolder:X}),await I(Z)>G)Y=!0;return await VQ(Z),{migrated:Y}}finally{Z.close()}}var $Q,JQ,YQ;var D=t(async()=>{$Q=O(O(O(ZQ(import.meta.url)))),JQ=process.env.BEACON_MIGRATIONS_DIR||XQ($Q,"drizzle"),YQ={Node:["createdAt","updatedAt"],Note:["createdAt","updatedAt"],DbTable:["createdAt","updatedAt"],Endpoint:["createdAt","updatedAt"],DraftTable:["createdAt"],SyncState:["codeGraphSyncedAt","updatedAt"],AppSetting:["updatedAt"],ProjectMeta:["updatedAt"],CodeFile:["updatedAt"]}});import{AsyncLocalStorage as BQ}from"async_hooks";import{spawnSync as MQ}from"child_process";import{createHash as NQ}from"crypto";import{existsSync as v,mkdirSync as L,readFileSync as T,writeFileSync as x}from"fs";import{homedir as F}from"os";import{basename as UQ,join as M,parse as LQ,resolve as u}from"path";function K(){return process.env.BEACON_HOME||M(F(),".beacon")}function _(){return M(K(),"workspaces.json")}function U(Q){return NQ("sha256").update(Q).digest("hex").slice(0,12)}function jQ(Q=process.cwd()){let X=MQ("git",["rev-parse","--show-toplevel"],{cwd:Q,stdio:["ignore","pipe","ignore"]});if(X.status===0){let Z=X.stdout?.toString().trim();if(Z)return Z}return Q}function S(Q){let X=u(Q);return X!==u(F())&&X!==LQ(X).root}function W(){return M(K(),"deleted.json")}function q(){try{let Q=JSON.parse(T(W(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function P(Q){L(K(),{recursive:!0}),x(W(),JSON.stringify(Q,null,2))}function y(Q){return q().includes(Q)}function mQ(Q){let X=q();if(!X.includes(Q))P([...X,Q])}function zQ(Q){let X=q();if(X.includes(Q))P(X.filter((Z)=>Z!==Q))}function C(Q){return M(K(),Q)}function CQ(Q){return`file:${M(C(Q),"db.sqlite")}`}function j(){try{let Q=JSON.parse(T(_(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function E(Q){L(K(),{recursive:!0}),x(_(),JSON.stringify(Q,null,2))}function f(){return j().sort((Q,X)=>X.lastOpenedAt.localeCompare(Q.lastOpenedAt))}function N(Q){return j().find((X)=>X.id===Q)??null}function k(Q,X,Z=new Date().toISOString()){if(!S(Q))throw Error(`beacon: refusing to register a non-repo path as a workspace: ${Q}`);let J=U(Q);if(y(J))throw Error(`beacon: workspace ${J} (${Q}) was deleted \u2014 run \`beacon\` or /beacon-init to re-add it`);let $=j(),Y=$.find((B)=>B.id===J),G={id:J,path:Q,name:X||Y?.name||UQ(Q),lastOpenedAt:Z},V=[G,...$.filter((B)=>B.id!==J)];return L(C(J),{recursive:!0}),E(V),G}function hQ(Q,X){return zQ(U(Q)),k(Q,X)}function pQ(Q,X=new Date().toISOString()){let Z=j(),J=Z.find(($)=>$.id===Q);if(!J)return;J.lastOpenedAt=X,E(Z)}function cQ(Q){if(E(j().filter((X)=>X.id!==Q)),A()===Q)OQ(f()[0]?.id??null)}function g(){return M(K(),"active")}function A(){try{return T(g(),"utf8").trim()||null}catch{return null}}function OQ(Q){L(K(),{recursive:!0}),x(g(),Q??"")}function lQ(){let Q=A();return Q?N(Q):null}function nQ(){let Q=TQ()??A();return Q?N(Q):null}function sQ(Q){return N(Q)?.path??null}function dQ(){return v(_())}var w="beacon_ws";function b(Q,X){let Z=Q.headers.get("cookie");if(!Z)return null;for(let J of Z.split(";")){let $=J.indexOf("=");if($===-1)continue;if(J.slice(0,$).trim()===X)return decodeURIComponent(J.slice($+1).trim())}return null}function oQ(Q){let X=Q.headers.get("x-beacon-workspace");if(X&&N(X))return X;let Z=b(Q,w);if(Z&&N(Z))return Z;return HQ()}function HQ(){let Q=f();return Q.length===1?Q[0].id:null}var m="x-beacon-workspace-path";function h(Q=process.cwd()){let X=jQ(Q);return{"x-beacon-workspace":U(X),[m]:X}}async function aQ(Q){let X=Q.headers.get("x-beacon-workspace");if(X&&N(X))return X;let Z=Q.headers.get(m);if(Z&&S(Z)&&!y(U(Z))&&(!X||U(Z)===X)){let $=k(Z);return await xQ($.id),$.id}let J=b(Q,w);if(J&&N(J))return J;return null}var p=new BQ;function tQ(Q,X){return Q?p.run(Q,X):X()}function TQ(){return p.getStore()??null}var H=new Set;function rQ(Q){H.delete(M(C(Q),"db.sqlite"))}async function xQ(Q){let X=C(Q),Z=M(X,"db.sqlite"),J=v(Z);if(J&&H.has(Z))return{ok:!0,created:!1,migrated:!1};try{L(X,{recursive:!0});let{provisionDb:$}=await D().then(() => R),Y=await $(CQ(Q));return H.add(Z),{ok:!0,created:!J,migrated:J&&Y.migrated}}catch($){return{ok:!1,created:!1,migrated:!1,error:$ instanceof Error?$.message:String($)}}}import{connect as _Q}from"net";var c=4319;function qQ(Q,X,Z=400){return new Promise((J)=>{let $=_Q({host:Q,port:X}),Y=!1,G=(V)=>{if(Y)return;Y=!0,$.destroy(),J(V)};$.once("connect",()=>G(!0)),$.once("error",()=>G(!1)),$.setTimeout(Z,()=>G(!1))})}async function EQ(Q){for(let X of["127.0.0.1","::1"])if(await qQ(X,Q))return!1;return!0}async function QX(Q,X=20){for(let Z=Q;Z<Q+X;Z++)if(await EQ(Z))return Z;return Q}import{readFileSync as AQ}from"fs";import{join as IQ}from"path";function RQ(){try{return JSON.parse(AQ(IQ(K(),"server.json"),"utf8"))}catch{return null}}function l(){if(process.env.BEACON_URL)return process.env.BEACON_URL;return`http://localhost:${RQ()?.port||process.env.PORT||c}`}var n="";for await(let Q of process.stdin)n+=Q;try{let Q=JSON.parse(n||"{}"),X=Q?.tool_input?.file_path,Z=l(),J=h(typeof Q.cwd==="string"?Q.cwd:void 0),$={hookEventName:"PreToolUse"},Y=Q?.permission_mode==="bypassPermissions",G=typeof Q.session_id==="string"?Q.session_id:"",V=await fetch(`${Z}/api/scope-guard/check?claim=1&session=${encodeURIComponent(G)}&file=${encodeURIComponent(typeof X==="string"?X:"")}`,{headers:J}).catch(()=>null);if(V?.ok){let B=await V.json().catch(()=>null);if(!Y&&B?.decision==="ask"&&typeof X==="string"&&X)$.permissionDecision="ask",$.permissionDecisionReason=B.reason??"This edit is outside the current plan's declared scope.";if(B?.additionalContext)$.additionalContext=B.additionalContext}if($.permissionDecision||$.additionalContext)process.stdout.write(JSON.stringify({hookSpecificOutput:$}))}catch{}process.exit(0);
package/dist/bin/hook.js CHANGED
@@ -1,22 +1,22 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- var KZ=Object.defineProperty;var PZ=(Q)=>Q;function vZ(Q,Z){this[Q]=PZ.bind(null,Z)}var ZQ=(Q,Z)=>{for(var $ in Z)KZ(Q,$,{get:Z[$],enumerable:!0,configurable:!0,set:vZ.bind(Z,$)})};var P=(Q,Z)=>()=>(Q&&(Z=Q(Q=0)),Z);var S0=1500,h0=480000,m0=1800000,D=3600000,p0=3000;var FQ=()=>{};var VQ={};ZQ(VQ,{removeRepoAssets:()=>bZ,installRefreshSkill:()=>uZ,installPlanSkill:()=>MZ,installInitSkill:()=>CZ,installExplainSkill:()=>wZ,installCodexRepoSkills:()=>TZ,ensureWorkflowDoc:()=>gZ,ensureMcp:()=>FZ,auditRepo:()=>OZ,REFRESH_SKILL:()=>JQ,PLAN_SKILL:()=>bQ,INIT_SKILL:()=>$Q,EXPLAIN_SKILL:()=>fQ});import{existsSync as v,mkdirSync as w,readFileSync as x,rmSync as A,writeFileSync as H}from"fs";import{join as X}from"path";function CZ(Q){let Z=X(Q,".claude","skills","beacon-init");w(Z,{recursive:!0});let $=X(Z,"SKILL.md");return H($,$Q),$}function uZ(Q){let Z=X(Q,".claude","skills","beacon-refresh");w(Z,{recursive:!0});let $=X(Z,"SKILL.md");return H($,JQ),$}function MZ(Q){let Z=X(Q,".claude","skills","beacon-plan");w(Z,{recursive:!0});let $=X(Z,"SKILL.md");return H($,bQ),$}function wZ(Q){let Z=X(Q,".claude","skills","beacon-explain");w(Z,{recursive:!0});let $=X(Z,"SKILL.md");return H($,fQ),$}function TZ(Q){let Z=[];for(let $ of RZ){let J=X(Q,".agents","skills",$.name);w(J,{recursive:!0});let Y=X(J,"SKILL.md");H(Y,$.body()),Z.push(Y)}return Z}function gZ(Q){let Z=X(Q,"AGENTS.md"),$="";try{$=x(Z,"utf8")}catch{}let J=new RegExp(`${E}[\\s\\S]*?${YQ}`);$=J.test($)?$.replace(J,OQ):`${$.trim()}
4
-
5
- ${OQ}
6
- `.trimStart(),H(Z,$.endsWith(`
7
- `)?$:`${$}
8
- `);let Y=X(Q,"CLAUDE.md"),V="";try{V=x(Y,"utf8")}catch{}if(!/@AGENTS\.md/.test(V))H(Y,`${V?`${V.trim()}
9
-
10
- `:""}@AGENTS.md
11
- `)}function FZ(Q){let Z=X(Q,".mcp.json"),$={};try{$=JSON.parse(x(Z,"utf8"))}catch{}$.mcpServers=$.mcpServers??{};let J=$.mcpServers.beacon;if(J){if(!J.timeout||J.timeout<D)return J.timeout=D,H(Z,JSON.stringify($,null,2)+`
12
- `),{path:Z,added:!1,updated:!0};return{path:Z,added:!1,updated:!1}}return $.mcpServers.beacon={command:"beacon",args:["mcp"],timeout:D},H(Z,JSON.stringify($,null,2)+`
13
- `),{path:Z,added:!0,updated:!1}}function OZ(Q){let Z=X(Q,".mcp.json"),$=!1;try{$=!!JSON.parse(x(Z,"utf8")).mcpServers?.beacon}catch{}let J=!1;try{J=x(X(Q,"AGENTS.md"),"utf8").includes(E)}catch{}let Y=!1;try{Y=/@AGENTS\.md/.test(x(X(Q,"CLAUDE.md"),"utf8"))}catch{}return{repo:Q,mcpRegistered:$,agentsMdBlock:J,claudeMdImport:Y,skills:{"beacon-init":v(X(Q,".claude","skills","beacon-init","SKILL.md")),"beacon-refresh":v(X(Q,".claude","skills","beacon-refresh","SKILL.md"))},codexSkills:{"beacon-init":v(X(Q,".agents","skills","beacon-init","SKILL.md")),"beacon-refresh":v(X(Q,".agents","skills","beacon-refresh","SKILL.md"))}}}function bZ(Q){let Z=[];for(let z of["beacon-init","beacon-refresh","beacon-db-design"]){let U=X(Q,".claude","skills",z);if(v(U))A(U,{recursive:!0,force:!0}),Z.push(z)}for(let z of["beacon-init","beacon-refresh"]){let U=X(Q,".agents","skills",z);if(v(U))A(U,{recursive:!0,force:!0}),Z.push(`codex:${z}`)}let $=!1,J=X(Q,".mcp.json");try{let z=JSON.parse(x(J,"utf8"));if(z.mcpServers?.beacon){if(delete z.mcpServers.beacon,$=!0,z.mcpServers&&Object.keys(z.mcpServers).length===0)delete z.mcpServers;if(Object.keys(z).length===0)A(J,{force:!0});else H(J,JSON.stringify(z,null,2)+`
14
- `)}}catch{}let Y=!1,V=X(Q,"AGENTS.md");try{let z=x(V,"utf8"),U=new RegExp(`\\n?${E}[\\s\\S]*?${YQ}\\n?`);if(U.test(z)){let QQ=z.replace(U,`
3
+ var CZ=Object.defineProperty;var MZ=(Q)=>Q;function uZ(Q,Z){this[Q]=MZ.bind(null,Z)}var ZQ=(Q,Z)=>{for(var $ in Z)CZ(Q,$,{get:Z[$],enumerable:!0,configurable:!0,set:uZ.bind(Z,$)})};var v=(Q,Z)=>()=>(Q&&(Z=Q(Q=0)),Z);var p0=1500,c0=480000,d0=1800000,f=3600000,l0=3000;var OQ=()=>{};var zQ={};ZQ(zQ,{stripAgentsPointer:()=>DQ,removeRepoAssets:()=>DZ,installRefreshSkill:()=>RZ,installPlanSkill:()=>TZ,installInitSkill:()=>wZ,installExplainSkill:()=>FZ,installCodexRepoSkills:()=>OZ,ensureWorkflowDoc:()=>bZ,ensureMcp:()=>IZ,contextDocTargets:()=>VQ,auditRepo:()=>fZ,REFRESH_SKILL:()=>JQ,PLAN_SKILL:()=>IQ,INIT_SKILL:()=>$Q,EXPLAIN_SKILL:()=>fQ});import{existsSync as B,mkdirSync as u,readFileSync as x,rmSync as D,writeFileSync as H}from"fs";import{join as X}from"path";function wZ(Q){let Z=X(Q,".claude","skills","beacon-init");u(Z,{recursive:!0});let $=X(Z,"SKILL.md");return H($,$Q),$}function RZ(Q){let Z=X(Q,".claude","skills","beacon-refresh");u(Z,{recursive:!0});let $=X(Z,"SKILL.md");return H($,JQ),$}function TZ(Q){let Z=X(Q,".claude","skills","beacon-plan");u(Z,{recursive:!0});let $=X(Z,"SKILL.md");return H($,IQ),$}function FZ(Q){let Z=X(Q,".claude","skills","beacon-explain");u(Z,{recursive:!0});let $=X(Z,"SKILL.md");return H($,fQ),$}function OZ(Q){let Z=[];for(let $ of gZ){let J=X(Q,".agents","skills",$.name);u(J,{recursive:!0});let Y=X(J,"SKILL.md");H(Y,$.body()),Z.push(Y)}return Z}function VQ(Q){let Z=X(Q,"AGENTS.md"),$=X(Q,"CLAUDE.md"),J=B(Z),Y=B($);if(!J&&!Y)return[Z,$];let V=[];if(J)V.push(Z);if(Y)V.push($);return V}function DQ(Q){let Z=X(Q,"CLAUDE.md");if(!B(Z))return;let $=x(Z,"utf8"),J=$.split(`
4
+ `).filter((Y)=>!/^\s*@\.?\/?AGENTS\.md\s*$/.test(Y)).join(`
5
+ `).trim();if(J&&J!==$.trim())H(Z,`${J}
6
+ `)}function bZ(Q){let Z=new RegExp(`${E}[\\s\\S]*?${YQ}`);for(let $ of VQ(Q)){let J="";try{J=x($,"utf8")}catch{}J=Z.test(J)?J.replace(Z,bQ):`${J.trim()}
7
+
8
+ ${bQ}
9
+ `.trimStart(),H($,J.endsWith(`
10
+ `)?J:`${J}
11
+ `)}DQ(Q)}function IZ(Q){let Z=X(Q,".mcp.json"),$={};try{$=JSON.parse(x(Z,"utf8"))}catch{}$.mcpServers=$.mcpServers??{};let J=$.mcpServers.beacon;if(J){if(!J.timeout||J.timeout<f)return J.timeout=f,H(Z,JSON.stringify($,null,2)+`
12
+ `),{path:Z,added:!1,updated:!0};return{path:Z,added:!1,updated:!1}}return $.mcpServers.beacon={command:"beacon",args:["mcp"],timeout:f},H(Z,JSON.stringify($,null,2)+`
13
+ `),{path:Z,added:!0,updated:!1}}function fZ(Q){let Z=X(Q,".mcp.json"),$=!1;try{$=!!JSON.parse(x(Z,"utf8")).mcpServers?.beacon}catch{}let J=VQ(Q).some((Y)=>{try{return x(Y,"utf8").includes(E)}catch{return!1}});return{repo:Q,mcpRegistered:$,workflowBlock:J,skills:{"beacon-init":B(X(Q,".claude","skills","beacon-init","SKILL.md")),"beacon-refresh":B(X(Q,".claude","skills","beacon-refresh","SKILL.md"))},codexSkills:{"beacon-init":B(X(Q,".agents","skills","beacon-init","SKILL.md")),"beacon-refresh":B(X(Q,".agents","skills","beacon-refresh","SKILL.md"))}}}function DZ(Q){let Z=[];for(let z of["beacon-init","beacon-refresh","beacon-db-design"]){let U=X(Q,".claude","skills",z);if(B(U))D(U,{recursive:!0,force:!0}),Z.push(z)}for(let z of["beacon-init","beacon-refresh"]){let U=X(Q,".agents","skills",z);if(B(U))D(U,{recursive:!0,force:!0}),Z.push(`codex:${z}`)}let $=!1,J=X(Q,".mcp.json");try{let z=JSON.parse(x(J,"utf8"));if(z.mcpServers?.beacon){if(delete z.mcpServers.beacon,$=!0,z.mcpServers&&Object.keys(z.mcpServers).length===0)delete z.mcpServers;if(Object.keys(z).length===0)D(J,{force:!0});else H(J,JSON.stringify(z,null,2)+`
14
+ `)}}catch{}let Y=!1,V=new RegExp(`\\n?${E}[\\s\\S]*?${YQ}\\n?`);for(let z of[X(Q,"AGENTS.md"),X(Q,"CLAUDE.md")])try{let U=x(z,"utf8");if(V.test(U)){let QQ=U.replace(V,`
15
15
  `).replace(/\n{3,}/g,`
16
16
 
17
- `).trimStart();H(V,QQ.endsWith(`
17
+ `).trimStart();H(z,QQ.endsWith(`
18
18
  `)?QQ:`${QQ}
19
- `),Y=!0}}catch{}let q=!1,W=X(Q,"CLAUDE.md");try{let z=x(W,"utf8"),U=z.replace(/^[ \t]*@AGENTS\.md[ \t]*\n?/m,"");if(U!==z){if(!U.trim())A(W,{force:!0});else H(W,U);q=!0}}catch{}return{skillsRemoved:Z,mcpUnregistered:$,agentsBlockRemoved:Y,claudeImportRemoved:q}}var $Q=`---
19
+ `),Y=!0}}catch{}let q=!1,W=X(Q,"CLAUDE.md");try{let z=x(W,"utf8"),U=z.replace(/^[ \t]*@AGENTS\.md[ \t]*\n?/m,"");if(U!==z){if(!U.trim())D(W,{force:!0});else H(W,U);q=!0}}catch{}return{skillsRemoved:Z,mcpUnregistered:$,agentsBlockRemoved:Y,claudeImportRemoved:q}}var $Q=`---
20
20
  name: beacon-init
21
21
  description: Read this repository and map its architecture, schema, and roadmap into Beacon (the local visual planning panel). Use when the user runs /beacon-init, asks to "set up Beacon for this repo", or asks to initialize/bootstrap Beacon's map of this codebase.
22
22
  ---
@@ -110,7 +110,7 @@ The one caveat: if the user manually edited an INIT-source node on the canvas (e
110
110
  If \`beacon_entities\` or \`beacon_init_persist\` isn't available, the Beacon panel isn't running in this repo. Tell the user to run \`beacon\` here first, then re-invoke /beacon-refresh.
111
111
 
112
112
  After the tool returns, report the final counts plus a one-line summary of the diff you surfaced.
113
- `,bQ=`---
113
+ `,IQ=`---
114
114
  name: beacon-plan
115
115
  description: Present your current plan or approach to the user on Beacon's /plan canvas for review \u2014 instead of asking for approval in prose. Use when the user says "present the plan", "show me the plan", "let me see it / the plan", or whenever you are about to end a turn asking whether to proceed with a plan, design, or approach.
116
116
  ---
@@ -139,10 +139,11 @@ board on /plan. The board is built ONLY from the block \u2014 prose is never par
139
139
  table/endpoint/feature you mention in the prose into the block, or that board will be empty.
140
140
 
141
141
  - **Declare your scope.** List the repo-relative files this plan will touch in a top-level
142
- \`"contract"\` array in the block (or the \`contract\` arg of \`beacon_propose_plan\`). When the user
143
- has the plan scope-guard enabled, those files are frozen at approval and you're held to them while
144
- implementing \u2014 editing an undeclared file pauses for the user's authorization (which then adds it
145
- to the contract). Harmless when the guard is off. Declare the files you genuinely expect to edit.
142
+ \`"contract"\` array in the block (or the \`contract\` arg of \`beacon_propose_plan\`). Those files are
143
+ frozen at approval and you're held to them while implementing \u2014 editing an undeclared file pauses
144
+ for the user's authorization (which then adds it to the contract), and the /plan Changes view
145
+ groups your edits On-plan vs Strayed against them. Declare the files you genuinely expect to edit
146
+ (if omitted, the scope is inferred from the files you name in backticks).
146
147
 
147
148
  \`beacon_present_plan\` opens /plan and BLOCKS until the user clicks Approve / Discard / submits
148
149
  feedback, then returns their verdict. Implement code or migrations ONLY after it returns approval.
@@ -228,7 +229,7 @@ so the learner sees the table IN CONTEXT, wired to the code that uses it.
228
229
  Every answer must ADD understanding (rationale, trade-off) \u2014 never just restate the question. Expand
229
230
  the narrative or add nodes where it helps. Keep looping until the tool reports the user saved or closed
230
231
  the lesson.
231
- `,RZ,E="<!-- beacon:workflow:start -->",YQ="<!-- beacon:workflow:end -->",OQ;var zQ=P(()=>{FQ();RZ=[{name:"beacon-init",body:()=>$Q},{name:"beacon-refresh",body:()=>JQ}];OQ=`${E}
232
+ `,gZ,E="<!-- beacon:workflow:start -->",YQ="<!-- beacon:workflow:end -->",bQ;var qQ=v(()=>{OQ();gZ=[{name:"beacon-init",body:()=>$Q},{name:"beacon-refresh",body:()=>JQ}];bQ=`${E}
232
233
  ## Beacon \u2014 feature workflow
233
234
 
234
235
  This project uses Beacon (a local planning/visualization panel; run \`beacon\` to open it). When you start work on a FEATURE \u2014 whether referenced via an \`@beacon:feature://\u2026\` mention, an \`@beacon:note://\u2026\` note the user wrote in the Notes panel (treat its checkbox \`- [ ]\` todos as subtasks and order features by their dependencies), or just described in chat \u2014 follow these steps in order:
@@ -300,18 +301,18 @@ Register them all in that single batched call. If a plan added five features, th
300
301
  If the feature added or materially changed a REAL architectural component (a subsystem \u2014 NOT a file), also pass \`architecture: [{ title, domain, role, \u2026 }]\` so the Architecture map stays accurate. It upserts curated components by title; never list files as components. If you found a bug or something worth investigating in a component's code, add \`bugs: [{ note }]\` to its architecture entry \u2014 it renders as a bug flag on the node (attributed to the agent); identical open flags are not duplicated. Only flag what you actually saw in the code.
301
302
 
302
303
  Pull raw planning data anytime with \`beacon_entities\` (features / architecture / tables / endpoints).
303
- ${YQ}`});import{existsSync as I,mkdirSync as qQ,readdirSync as fZ,readFileSync as C,rmSync as DZ,writeFileSync as y}from"fs";import{dirname as DQ,join as j}from"path";function AQ(){return!!process.env.CLAUDE_PLUGIN_ROOT}function EQ(Q=process.env.HOME||process.env.USERPROFILE||""){if(!Q)return null;let Z=j(Q,".claude","plugins");if(!I(Z))return null;let $=[Z];for(let J=0;J<3&&$.length;J++){let Y=[];for(let V of $){let q=j(V,".claude-plugin","plugin.json");try{if(I(q)&&JSON.parse(C(q,"utf8")).name==="beacon")return V}catch{}try{for(let W of fZ(V,{withFileTypes:!0}))if(W.isDirectory())Y.push(j(V,W.name))}catch{}}$=Y}return null}function IQ(Q){return EQ(Q)!==null}function AZ(Q){return/[\\/]\.claude[\\/]plugins[\\/]/.test(Q)}function EZ(Q=process.env.HOME||process.env.USERPROFILE||""){if(!Q)return null;try{let Z=JSON.parse(C(j(Q,".claude","plugins","installed_plugins.json"),"utf8"));for(let $ of Object.keys(Z.plugins??{}))if(/^beacon@/.test($))return{key:$,marketplace:$.split("@")[1]??""}}catch{}return null}function XQ(Q){try{return JSON.parse(C(Q,"utf8"))}catch{return{}}}function yQ(Q,Z){qQ(DQ(Q),{recursive:!0}),y(Q,JSON.stringify(Z,null,2)+`
304
- `)}function L(Q,Z){let $=XQ(Q);$.hooks=$.hooks??{},$.hooks[Z.event]=$.hooks[Z.event]??[];let J=$.hooks[Z.event];if(J.some((V)=>V.matcher===Z.matcher&&V.hooks?.some((q)=>q.command===Z.command)))return!1;return J.push({matcher:Z.matcher,hooks:[{type:"command",command:Z.command}]}),yQ(Q,$),!0}function _(Q,Z){return(XQ(Q).hooks?.[Z.event]??[]).some((Y)=>Y.hooks?.some((V)=>V.command===Z.command))}function S(Q,Z){let $=XQ(Q),J=$.hooks?.[Z.event];if(!J)return!1;let Y=!1,V=J.map((q)=>{let W=q.hooks?.length??0,z=(q.hooks??[]).filter((U)=>U.command!==Z.command);if(z.length!==W)Y=!0;return{...q,hooks:z}}).filter((q)=>(q.hooks??[]).length>0);if(!Y)return!1;if(V.length)$.hooks[Z.event]=V;else delete $.hooks[Z.event];if($.hooks&&Object.keys($.hooks).length===0)delete $.hooks;return yQ(Q,$),!0}function h(Q,Z,$,J){let Y=`${Z}
304
+ ${YQ}`});import{existsSync as A,mkdirSync as XQ,readdirSync as EZ,readFileSync as C,rmSync as AZ,writeFileSync as y}from"fs";import{dirname as EQ,join as G}from"path";function AQ(){return!!process.env.CLAUDE_PLUGIN_ROOT}function yQ(Q=process.env.HOME||process.env.USERPROFILE||""){if(!Q)return null;let Z=G(Q,".claude","plugins");if(!A(Z))return null;let $=[Z];for(let J=0;J<3&&$.length;J++){let Y=[];for(let V of $){let q=G(V,".claude-plugin","plugin.json");try{if(A(q)&&JSON.parse(C(q,"utf8")).name==="beacon")return V}catch{}try{for(let W of EZ(V,{withFileTypes:!0}))if(W.isDirectory())Y.push(G(V,W.name))}catch{}}$=Y}return null}function kQ(Q){return yQ(Q)!==null}function yZ(Q){return/[\\/]\.claude[\\/]plugins[\\/]/.test(Q)}function kZ(Q=process.env.HOME||process.env.USERPROFILE||""){if(!Q)return null;try{let Z=JSON.parse(C(G(Q,".claude","plugins","installed_plugins.json"),"utf8"));for(let $ of Object.keys(Z.plugins??{}))if(/^beacon@/.test($))return{key:$,marketplace:$.split("@")[1]??""}}catch{}return null}function UQ(Q){try{return JSON.parse(C(Q,"utf8"))}catch{return{}}}function LQ(Q,Z){XQ(EQ(Q),{recursive:!0}),y(Q,JSON.stringify(Z,null,2)+`
305
+ `)}function L(Q,Z){let $=UQ(Q);$.hooks=$.hooks??{},$.hooks[Z.event]=$.hooks[Z.event]??[];let J=$.hooks[Z.event];if(J.some((V)=>V.matcher===Z.matcher&&V.hooks?.some((q)=>q.command===Z.command)))return!1;return J.push({matcher:Z.matcher,hooks:[{type:"command",command:Z.command}]}),LQ(Q,$),!0}function _(Q,Z){return(UQ(Q).hooks?.[Z.event]??[]).some((Y)=>Y.hooks?.some((V)=>V.command===Z.command))}function S(Q,Z){let $=UQ(Q),J=$.hooks?.[Z.event];if(!J)return!1;let Y=!1,V=J.map((q)=>{let W=q.hooks?.length??0,z=(q.hooks??[]).filter((U)=>U.command!==Z.command);if(z.length!==W)Y=!0;return{...q,hooks:z}}).filter((q)=>(q.hooks??[]).length>0);if(!Y)return!1;if(V.length)$.hooks[Z.event]=V;else delete $.hooks[Z.event];if($.hooks&&Object.keys($.hooks).length===0)delete $.hooks;return LQ(Q,$),!0}function m(Q,Z,$,J){let Y=`${Z}
305
306
  ${J.trim()}
306
307
  ${$}`,V="";try{V=C(Q,"utf8")}catch{}let q=new RegExp(`${Z}[\\s\\S]*?${$}`);V=q.test(V)?V.replace(q,Y):V.trim()?`${V.trim()}
307
308
 
308
309
  ${Y}
309
310
  `:`${Y}
310
- `,qQ(DQ(Q),{recursive:!0}),y(Q,V.endsWith(`
311
+ `,XQ(EQ(Q),{recursive:!0}),y(Q,V.endsWith(`
311
312
  `)?V:`${V}
312
- `)}function R(Q,Z){try{return C(Q,"utf8").includes(Z)}catch{return!1}}function m(Q,Z,$){let J="";try{J=C(Q,"utf8")}catch{return!1}let Y=new RegExp(`${Z}[\\s\\S]*?${$}\\n?`);if(!Y.test(J))return!1;let V=J.replace(Y,"").replace(/\n{3,}/g,`
313
+ `)}function w(Q,Z){try{return C(Q,"utf8").includes(Z)}catch{return!1}}function h(Q,Z,$){let J="";try{J=C(Q,"utf8")}catch{return!1}let Y=new RegExp(`${Z}[\\s\\S]*?${$}\\n?`);if(!Y.test(J))return!1;let V=J.replace(Y,"").replace(/\n{3,}/g,`
313
314
 
314
- `).trimStart();return y(Q,V),!0}function p(Q,Z,$){let J=j(Q,Z);qQ(J,{recursive:!0});let Y=j(J,"SKILL.md");return y(Y,$),Y}function T(Q,Z){return I(j(Q,Z,"SKILL.md"))}function c(Q,Z){let $=j(Q,Z);if(!I($))return!1;return DZ($,{recursive:!0,force:!0}),!0}var G,k=`## Beacon (visual planning panel)
315
+ `).trimStart();return y(Q,V),!0}function p(Q,Z,$){let J=G(Q,Z);XQ(J,{recursive:!0});let Y=G(J,"SKILL.md");return y(Y,$),Y}function R(Q,Z){return A(G(Q,Z,"SKILL.md"))}function c(Q,Z){let $=G(Q,Z);if(!A($))return!1;return AZ($,{recursive:!0,force:!0}),!0}var K,k=`## Beacon (visual planning panel)
315
316
 
316
317
  This machine has Beacon installed \u2014 a local visual planning surface for the terminal-side
317
318
  agent. Beacon proposes feature plans (roadmap features + DB schema + endpoints) via MCP,
@@ -335,18 +336,18 @@ the user reviews on a canvas at /plan, and feedback flows back as the next round
335
336
  Feedback bundles inline annotations on the markdown PLUS any edits the user made directly
336
337
  on the /map and /db boards (added features, attached subtasks, edited columns, new
337
338
  endpoints). Treat board edits as the user's revision intent \u2014 re-propose matching them
338
- verbatim. Do NOT implement until the tool returns approval.`;var UQ=P(()=>{G=["beacon-init","beacon-refresh","beacon-plan","beacon-explain"]});import{mkdirSync as IZ,renameSync as yZ,rmSync as kZ,writeFileSync as LZ}from"fs";import{dirname as _Z}from"path";function l(Q,Z){IZ(_Z(Q),{recursive:!0});let $=`${Q}.tmp`;try{LZ($,Z),yZ($,Q)}catch(J){throw kZ($,{force:!0}),J}}function i0(Q,Z,$=!1){l(Q,JSON.stringify(Z,null,$?2:void 0))}var kQ=()=>{};var lQ={};ZQ(lQ,{setupCodexAssets:()=>pZ,removeCodexMcp:()=>cQ,removeCodexArtifacts:()=>lZ,hasCodexMcp:()=>BQ,ensureCodexMcp:()=>pQ,codexMcpProblem:()=>mZ,codexDetected:()=>SQ,auditCodex:()=>cZ,CODEX_HOOKS:()=>t});import{readFileSync as s}from"fs";import{homedir as SZ}from"os";import{join as O}from"path";function LQ(){return process.env.HOME||process.env.USERPROFILE||SZ()}function SQ(){if(process.env.BEACON_CODEX==="1")return!0;if(process.env.BEACON_CODEX==="0")return!1;if(WQ===void 0)WQ=Bun.which("codex")!==null;return WQ}function F(Q){try{return Bun.TOML.parse(Q)}catch{return null}}function BQ(){try{return Boolean(F(s(u(),"utf8"))?.mcp_servers?.beacon)}catch{return!1}}function mZ(){let Q="";try{Q=s(u(),"utf8")}catch{return null}let Z=F(Q);if(!Z)return`~/.codex/config.toml does not parse \u2014 ${g}`;if(Z.mcp_servers?.beacon)return null;if(/^\s*mcp_servers\s*=/m.test(Q))return`mcp_servers is an inline table \u2014 ${g}`;return null}function pQ(){let Q="",Z=!1;try{Q=s(u(),"utf8"),Z=!0}catch{}if(Z){let V=F(Q);if(!V)return{added:!1,error:`~/.codex/config.toml does not parse \u2014 ${g}`};if(V.mcp_servers?.beacon)return{added:!1};if(/^\s*mcp_servers\s*=/m.test(Q))return{added:!1,error:`mcp_servers is an inline table \u2014 ${g}`}}let $=!Q?"":Q.endsWith(`
339
+ verbatim. Do NOT implement until the tool returns approval.`;var WQ=v(()=>{K=["beacon-init","beacon-refresh","beacon-plan","beacon-explain"]});import{mkdirSync as LZ,renameSync as _Z,rmSync as SZ,writeFileSync as mZ}from"fs";import{dirname as hZ}from"path";function d(Q,Z){LZ(hZ(Q),{recursive:!0});let $=`${Q}.tmp`;try{mZ($,Z),_Z($,Q)}catch(J){throw SZ($,{force:!0}),J}}function Z1(Q,Z,$=!1){d(Q,JSON.stringify(Z,null,$?2:void 0))}var _Q=()=>{};var nQ={};ZQ(nQ,{setupCodexAssets:()=>lZ,removeCodexMcp:()=>lQ,removeCodexArtifacts:()=>aZ,hasCodexMcp:()=>xQ,ensureCodexMcp:()=>dQ,codexMcpProblem:()=>dZ,codexDetected:()=>hQ,auditCodex:()=>nZ,CODEX_HOOKS:()=>t});import{readFileSync as s}from"fs";import{homedir as pZ}from"os";import{join as g}from"path";function SQ(){return process.env.HOME||process.env.USERPROFILE||pZ()}function hQ(){if(process.env.BEACON_CODEX==="1")return!0;if(process.env.BEACON_CODEX==="0")return!1;if(HQ===void 0)HQ=Bun.which("codex")!==null;return HQ}function F(Q){try{return Bun.TOML.parse(Q)}catch{return null}}function xQ(){try{return Boolean(F(s(M(),"utf8"))?.mcp_servers?.beacon)}catch{return!1}}function dZ(){let Q="";try{Q=s(M(),"utf8")}catch{return null}let Z=F(Q);if(!Z)return`~/.codex/config.toml does not parse \u2014 ${T}`;if(Z.mcp_servers?.beacon)return null;if(/^\s*mcp_servers\s*=/m.test(Q))return`mcp_servers is an inline table \u2014 ${T}`;return null}function dQ(){let Q="",Z=!1;try{Q=s(M(),"utf8"),Z=!0}catch{}if(Z){let V=F(Q);if(!V)return{added:!1,error:`~/.codex/config.toml does not parse \u2014 ${T}`};if(V.mcp_servers?.beacon)return{added:!1};if(/^\s*mcp_servers\s*=/m.test(Q))return{added:!1,error:`mcp_servers is an inline table \u2014 ${T}`}}let $=!Q?"":Q.endsWith(`
339
340
  `)?`
340
341
  `:`
341
342
 
342
- `,J=Q+$+hZ;if(F(J)?.mcp_servers?.beacon?.command!=="beacon")return{added:!1,error:`could not safely append [mcp_servers.beacon] \u2014 ${g}`};return l(u(),J),{added:!0}}function cQ(){let Q="";try{Q=s(u(),"utf8")}catch{return{removed:!1}}let Z=Q.split(`
343
- `),$=Z.indexOf(hQ);if($===-1)return{removed:!1,skipped:BQ()};let J=Z.indexOf(mQ,$);if(J===-1)return{removed:!1,skipped:!0};Z.splice($,J-$+1);let Y=Z.join(`
343
+ `,J=Q+$+cZ;if(F(J)?.mcp_servers?.beacon?.command!=="beacon")return{added:!1,error:`could not safely append [mcp_servers.beacon] \u2014 ${T}`};return d(M(),J),{added:!0}}function lQ(){let Q="";try{Q=s(M(),"utf8")}catch{return{removed:!1}}let Z=Q.split(`
344
+ `),$=Z.indexOf(pQ);if($===-1)return{removed:!1,skipped:xQ()};let J=Z.indexOf(cQ,$);if(J===-1)return{removed:!1,skipped:!0};Z.splice($,J-$+1);let Y=Z.join(`
344
345
  `).replace(/\n{3,}/g,`
345
346
 
346
- `).replace(/^\n+/,"");if(F(Y)===null)return{removed:!1,skipped:!0};return l(u(),Y),{removed:!0}}async function pZ(){let{INIT_SKILL:Q,REFRESH_SKILL:Z,PLAN_SKILL:$,EXPLAIN_SKILL:J}=await Promise.resolve().then(() => (zQ(),VQ)),Y={"beacon-init":Q,"beacon-refresh":Z,"beacon-plan":$,"beacon-explain":J},V=[];for(let U of G){if(!T(n(),U))V.push(U);p(n(),U,Y[U])}let q=0;for(let U of t)if(L(xQ(),{event:U.event,matcher:U.matcher,command:U.command}))q++;let W=R(d(),a);h(d(),a,_Q,k);let z=pQ();return{skillsAdded:V,hooksAdded:q,agentsMdBlockTouched:!W,mcp:z}}function cZ(){let Q={};for(let $ of G)Q[$]=T(n(),$);let Z={};for(let $ of t)Z[$.event]=_(xQ(),{event:$.event,command:$.command});return{detected:SQ(),skills:Q,hooks:Z,agentsMdBlock:R(d(),a),mcp:BQ()}}function lZ(){let Q=[];for(let Y of G)if(c(n(),Y))Q.push(Y);let Z=0;for(let Y of t)if(S(xQ(),{event:Y.event,command:Y.command}))Z++;let $=m(d(),a,_Q),J=cQ();return{skillsRemoved:Q,hooksRemoved:Z,agentsMdBlockRemoved:$,mcpRemoved:J.removed,mcpSkipped:J.skipped}}var HQ=()=>O(LQ(),".codex"),xQ=()=>O(HQ(),"hooks.json"),u=()=>O(HQ(),"config.toml"),d=()=>O(HQ(),"AGENTS.md"),n=()=>O(LQ(),".agents","skills"),a="<!-- beacon:global:start -->",_Q="<!-- beacon:global:end -->",t,WQ,hQ="# beacon:start (managed by Beacon \u2014 `beacon uninstall` removes this block)",mQ="# beacon:end",hZ,g="add it manually: codex mcp add beacon -- beacon mcp";var dQ=P(()=>{UQ();kQ();t=[{event:"PostToolUse",matcher:"apply_patch",command:"beacon hook",description:"Report file edits to Beacon's active feature so the map stays fresh."},{event:"UserPromptSubmit",matcher:"*",command:"beacon prompt",description:"On feature-y prompts in a Beacon-wired repo, remind the agent to run the context\u2192propose\u2192describe loop (no-op otherwise)."},{event:"Stop",matcher:"*",command:"beacon stop-hook",description:"When the agent ends a turn asking for plan approval in prose, nudge it to present the plan on Beacon's /plan canvas."}];hZ=`${hQ}
347
+ `).replace(/^\n+/,"");if(F(Y)===null)return{removed:!1,skipped:!0};return d(M(),Y),{removed:!0}}async function lZ(){let{INIT_SKILL:Q,REFRESH_SKILL:Z,PLAN_SKILL:$,EXPLAIN_SKILL:J}=await Promise.resolve().then(() => (qQ(),zQ)),Y={"beacon-init":Q,"beacon-refresh":Z,"beacon-plan":$,"beacon-explain":J},V=[];for(let U of K){if(!R(n(),U))V.push(U);p(n(),U,Y[U])}let q=0;for(let U of t)if(L(jQ(),{event:U.event,matcher:U.matcher,command:U.command}))q++;let W=w(l(),a);m(l(),a,mQ,k);let z=dQ();return{skillsAdded:V,hooksAdded:q,agentsMdBlockTouched:!W,mcp:z}}function nZ(){let Q={};for(let $ of K)Q[$]=R(n(),$);let Z={};for(let $ of t)Z[$.event]=_(jQ(),{event:$.event,command:$.command});return{detected:hQ(),skills:Q,hooks:Z,agentsMdBlock:w(l(),a),mcp:xQ()}}function aZ(){let Q=[];for(let Y of K)if(c(n(),Y))Q.push(Y);let Z=0;for(let Y of t)if(S(jQ(),{event:Y.event,command:Y.command}))Z++;let $=h(l(),a,mQ),J=lQ();return{skillsRemoved:Q,hooksRemoved:Z,agentsMdBlockRemoved:$,mcpRemoved:J.removed,mcpSkipped:J.skipped}}var BQ=()=>g(SQ(),".codex"),jQ=()=>g(BQ(),"hooks.json"),M=()=>g(BQ(),"config.toml"),l=()=>g(BQ(),"AGENTS.md"),n=()=>g(SQ(),".agents","skills"),a="<!-- beacon:global:start -->",mQ="<!-- beacon:global:end -->",t,HQ,pQ="# beacon:start (managed by Beacon \u2014 `beacon uninstall` removes this block)",cQ="# beacon:end",cZ,T="add it manually: codex mcp add beacon -- beacon mcp";var aQ=v(()=>{WQ();_Q();t=[{event:"PostToolUse",matcher:"apply_patch",command:"beacon hook",description:"Report file edits to Beacon's active feature so the map stays fresh."},{event:"UserPromptSubmit",matcher:"*",command:"beacon prompt",description:"On feature-y prompts in a Beacon-wired repo, remind the agent to run the context\u2192propose\u2192describe loop (no-op otherwise)."},{event:"Stop",matcher:"*",command:"beacon stop-hook",description:"When the agent ends a turn asking for plan approval in prose, nudge it to present the plan on Beacon's /plan canvas."}];cZ=`${pQ}
347
348
  [mcp_servers.beacon]
348
349
  command = "beacon"
349
350
  args = ["mcp"]
350
- ${mQ}
351
- `});var oQ={};ZQ(oQ,{provisionDb:()=>G0});import{createClient as Y0}from"@libsql/client";import{drizzle as V0}from"drizzle-orm/libsql";import{migrate as z0}from"drizzle-orm/libsql/migrator";import{readMigrationFiles as q0}from"drizzle-orm/migrator";import{dirname as vQ,join as X0}from"path";import{fileURLToPath as U0}from"url";async function i(Q,Z){return(await Q.execute({sql:"SELECT 1 FROM sqlite_master WHERE type='table' AND name = ?",args:[Z]})).rows.length>0}async function B0(Q,Z){let $=await Q.execute(`PRAGMA table_info("${Z}")`);return new Set($.rows.map((J)=>String(J.name)))}async function rQ(Q){if(!await i(Q,"__drizzle_migrations"))return 0;let Z=await Q.execute('SELECT count(*) AS n FROM "__drizzle_migrations"');return Number(Z.rows[0]?.n??0)}async function j0(Q){for(let[Z,$]of Object.entries(x0)){if(!await i(Q,Z))continue;let J=await B0(Q,Z);for(let Y of $){if(!J.has(Y))continue;await Q.execute(`UPDATE "${Z}" SET "${Y}" = CAST((julianday("${Y}") - 2440587.5) * 86400000 AS INTEGER) WHERE typeof("${Y}") = 'text'`)}}}async function G0(Q,Z=H0){let $=Y0({url:Q});try{await $.execute("PRAGMA journal_mode = WAL;"),await $.execute("PRAGMA foreign_keys = ON;"),await $.execute("PRAGMA busy_timeout = 5000;");let J=await i($,"__drizzle_migrations"),Y=await i($,"Node"),V=!1;if(Y&&!J){let W=q0({migrationsFolder:Z})[0];if(W)await $.execute('CREATE TABLE IF NOT EXISTS "__drizzle_migrations" (id SERIAL PRIMARY KEY, hash text NOT NULL, created_at numeric)'),await $.execute({sql:'INSERT INTO "__drizzle_migrations" ("hash", "created_at") VALUES (?, ?)',args:[W.hash,W.folderMillis]}),V=!0}let q=await rQ($);if(await z0(V0($),{migrationsFolder:Z}),await rQ($)>q)V=!0;return await j0($),{migrated:V}}finally{$.close()}}var W0,H0,x0;var iQ=P(async()=>{W0=vQ(vQ(vQ(U0(import.meta.url)))),H0=process.env.BEACON_MIGRATIONS_DIR||X0(W0,"drizzle"),x0={Node:["createdAt","updatedAt"],Note:["createdAt","updatedAt"],DbTable:["createdAt","updatedAt"],Endpoint:["createdAt","updatedAt"],DraftTable:["createdAt"],SyncState:["codeGraphSyncedAt","updatedAt"],AppSetting:["updatedAt"],ProjectMeta:["updatedAt"],CodeFile:["updatedAt"]}});UQ();import{existsSync as dZ}from"fs";import{homedir as nZ}from"os";import{join as r}from"path";function aZ(){return process.env.HOME||process.env.USERPROFILE||nZ()}var o=()=>r(aZ(),".claude"),jQ=()=>r(o(),"skills"),GQ=()=>r(o(),"settings.json"),NQ=()=>r(o(),"CLAUDE.md"),KQ="<!-- beacon:global:start -->",nQ="<!-- beacon:global:end -->";var sZ=k,PQ=[{event:"PreToolUse",matcher:"Edit|Write|MultiEdit",command:"beacon guard",description:"Gate edits against the active plan's scope contract (when the scope-guard flag is on): in-scope \u2192 allow, off-scope \u2192 ask the user to authorize. No-op + fail-open otherwise."},{event:"PostToolUse",matcher:"Edit|Write|MultiEdit",command:"beacon hook",description:"Report file edits to Beacon's active feature so the map stays fresh."},{event:"PermissionRequest",matcher:"ExitPlanMode",command:"beacon plan",description:"Pipe the agent's plan markdown into Beacon's /plan canvas for review."},{event:"UserPromptSubmit",matcher:"*",command:"beacon prompt",description:"On feature-y prompts in a Beacon-wired repo, remind the agent to run the context\u2192propose\u2192describe loop (no-op otherwise)."},{event:"Stop",matcher:"*",command:"beacon stop-hook",description:"When the agent ends a turn asking for plan approval in prose (instead of presenting it), nudge it to present the plan on Beacon's /plan canvas. Bounded by stop_hook_active \u2014 at most one nudge."}];function tZ(Q,Z){return p(jQ(),Q,Z)}function aQ(Q){return T(jQ(),Q)}function rZ(Q){return c(jQ(),Q)}function oZ(Q){return L(GQ(),Q)}function iZ(Q){return _(GQ(),Q)}function eZ(Q){return S(GQ(),Q)}function Q0(Q){h(NQ(),KQ,nQ,Q)}function sQ(){return R(NQ(),KQ)}function Z0(){return m(NQ(),KQ,nQ)}function U1(){let Q={};for(let $ of G)Q[$]=aQ($);let Z={};for(let $ of PQ)Z[$.event]=iZ({event:$.event,command:$.command});return{homeExists:dZ(o()),skills:Q,hooks:Z,claudeMdBlock:sQ()}}async function $0(){let{INIT_SKILL:Q,REFRESH_SKILL:Z,PLAN_SKILL:$,EXPLAIN_SKILL:J}=await Promise.resolve().then(() => (zQ(),VQ)),Y={"beacon-init":Q,"beacon-refresh":Z,"beacon-plan":$,"beacon-explain":J},V=[];for(let z of G){if(!aQ(z))V.push(z);tZ(z,Y[z])}let q=0;for(let z of PQ)if(oZ({event:z.event,matcher:z.matcher,command:z.command}))q++;let W=sQ();return Q0(sZ),{skillsAdded:V,hooksAdded:q,claudeMdBlockTouched:!W}}async function tQ(){if(AQ())return{ok:!0,skipped:"plugin",skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1};let Q;if(IQ()){try{J0()}catch{}Q={ok:!0,skipped:"plugin-present",skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1}}else try{Q={ok:!0,...await $0()}}catch(Z){Q={ok:!1,error:Z instanceof Error?Z.message:String(Z),skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1}}try{let Z=await Promise.resolve().then(() => (dQ(),lQ));if(Z.codexDetected())Q.codex={ok:!0,...await Z.setupCodexAssets()}}catch(Z){Q.codex={ok:!1,error:Z instanceof Error?Z.message:String(Z),skillsAdded:[],hooksAdded:0,agentsMdBlockTouched:!1,mcp:{added:!1}}}return Q}function J0(){let Q=[];for(let J of G)if(rZ(J))Q.push(J);let Z=0;for(let J of PQ)if(eZ(J))Z++;let $=Z0();return{skillsRemoved:Q,hooksRemoved:Z,claudeMdBlockRemoved:$}}import{AsyncLocalStorage as N0}from"async_hooks";import{spawnSync as K0}from"child_process";import{createHash as P0}from"crypto";import{existsSync as QZ,mkdirSync as b,readFileSync as uQ,writeFileSync as MQ}from"fs";import{homedir as ZZ}from"os";import{basename as v0,join as N,parse as C0,resolve as eQ}from"path";function B(){return process.env.BEACON_HOME||N(ZZ(),".beacon")}function wQ(){return N(B(),"workspaces.json")}function M(Q){return P0("sha256").update(Q).digest("hex").slice(0,12)}function $Z(Q=process.cwd()){let Z=K0("git",["rev-parse","--show-toplevel"],{cwd:Q,stdio:["ignore","pipe","ignore"]});if(Z.status===0){let $=Z.stdout?.toString().trim();if($)return $}return Q}function JZ(Q){let Z=eQ(Q);return Z!==eQ(ZZ())&&Z!==C0(Z).root}function YZ(){return N(B(),"deleted.json")}function RQ(){try{let Q=JSON.parse(uQ(YZ(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function VZ(Q){b(B(),{recursive:!0}),MQ(YZ(),JSON.stringify(Q,null,2))}function zZ(Q){return RQ().includes(Q)}function w1(Q){let Z=RQ();if(!Z.includes(Q))VZ([...Z,Q])}function u0(Q){let Z=RQ();if(Z.includes(Q))VZ(Z.filter(($)=>$!==Q))}function e(Q){return N(B(),Q)}function M0(Q){return`file:${N(e(Q),"db.sqlite")}`}function f(){try{let Q=JSON.parse(uQ(wQ(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function TQ(Q){b(B(),{recursive:!0}),MQ(wQ(),JSON.stringify(Q,null,2))}function qZ(){return f().sort((Q,Z)=>Z.lastOpenedAt.localeCompare(Q.lastOpenedAt))}function K(Q){return f().find((Z)=>Z.id===Q)??null}function XZ(Q,Z,$=new Date().toISOString()){if(!JZ(Q))throw Error(`beacon: refusing to register a non-repo path as a workspace: ${Q}`);let J=M(Q);if(zZ(J))throw Error(`beacon: workspace ${J} (${Q}) was deleted \u2014 run \`beacon\` or /beacon-init to re-add it`);let Y=f(),V=Y.find((z)=>z.id===J),q={id:J,path:Q,name:Z||V?.name||v0(Q),lastOpenedAt:$},W=[q,...Y.filter((z)=>z.id!==J)];return b(e(J),{recursive:!0}),TQ(W),q}function R1(Q,Z){return u0(M(Q)),XZ(Q,Z)}function T1(Q,Z=new Date().toISOString()){let $=f(),J=$.find((Y)=>Y.id===Q);if(!J)return;J.lastOpenedAt=Z,TQ($)}function g1(Q){if(TQ(f().filter((Z)=>Z.id!==Q)),gQ()===Q)w0(qZ()[0]?.id??null)}function UZ(){return N(B(),"active")}function gQ(){try{return uQ(UZ(),"utf8").trim()||null}catch{return null}}function w0(Q){b(B(),{recursive:!0}),MQ(UZ(),Q??"")}function F1(){let Q=gQ();return Q?K(Q):null}function O1(){let Q=g0()??gQ();return Q?K(Q):null}function b1(Q){return K(Q)?.path??null}function f1(){return QZ(wQ())}var WZ="beacon_ws";function HZ(Q,Z){let $=Q.headers.get("cookie");if(!$)return null;for(let J of $.split(";")){let Y=J.indexOf("=");if(Y===-1)continue;if(J.slice(0,Y).trim()===Z)return decodeURIComponent(J.slice(Y+1).trim())}return null}function D1(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&K(Z))return Z;let $=HZ(Q,WZ);if($&&K($))return $;return R0()}function R0(){let Q=qZ();return Q.length===1?Q[0].id:null}var T0="x-beacon-workspace-path";async function A1(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&K(Z))return Z;let $=Q.headers.get(T0);if($&&JZ($)&&!zZ(M($))&&(!Z||M($)===Z)){let Y=XZ($);return await F0(Y.id),Y.id}let J=HZ(Q,WZ);if(J&&K(J))return J;return null}var xZ=new N0;function E1(Q,Z){return Q?xZ.run(Q,Z):Z()}function g0(){return xZ.getStore()??null}var CQ=new Set;function I1(Q){CQ.delete(N(e(Q),"db.sqlite"))}async function F0(Q){let Z=e(Q),$=N(Z,"db.sqlite"),J=QZ($);if(J&&CQ.has($))return{ok:!0,created:!1,migrated:!1};try{b(Z,{recursive:!0});let{provisionDb:Y}=await iQ().then(() => oQ),V=await Y(M0(Q));return CQ.add($),{ok:!0,created:!J,migrated:J&&V.migrated}}catch(Y){return{ok:!1,created:!1,migrated:!1,error:Y instanceof Error?Y.message:String(Y)}}}import{connect as O0}from"net";var BZ=4319;function b0(Q,Z,$=400){return new Promise((J)=>{let Y=O0({host:Q,port:Z}),V=!1,q=(W)=>{if(V)return;V=!0,Y.destroy(),J(W)};Y.once("connect",()=>q(!0)),Y.once("error",()=>q(!1)),Y.setTimeout($,()=>q(!1))})}async function f0(Q){for(let Z of["127.0.0.1","::1"])if(await b0(Z,Q))return!1;return!0}async function L1(Q,Z=20){for(let $=Q;$<Q+Z;$++)if(await f0($))return $;return Q}import{resolve as D0}from"path";var A0="*** Begin Patch",E0=/^\*\*\* (Update File|Add File|Move to): (.+)$/;function I0(Q){let Z=[];for(let $ of Q.split(`
352
- `)){let J=E0.exec($.trim());if(!J)continue;let Y=J[2].trim();if(J[1]==="Move to")Z.pop();Z.push(Y)}return Z}function jZ(Q){let Z=Q.tool_input;if(Z===null||typeof Z!=="object")return[];let $=Z,J=[];if(typeof $.file_path==="string")J.push($.file_path);if(typeof $.path==="string")J.push($.path);if(Array.isArray($.files))for(let V of $.files){let q=V?.file_path;if(typeof q==="string")J.push(q)}if(J.length)return J;let Y=typeof Q.cwd==="string"?Q.cwd:process.cwd();for(let V of Object.values($)){if(typeof V!=="string"||!V.includes(A0))continue;return I0(V).map((q)=>D0(Y,q))}return[]}import{readFileSync as y0}from"fs";import{join as k0}from"path";function L0(){try{return JSON.parse(y0(k0(B(),"server.json"),"utf8"))}catch{return null}}function GZ(){if(process.env.BEACON_URL)return process.env.BEACON_URL;return`http://localhost:${L0()?.port||process.env.PORT||BZ}`}await tQ();var NZ="";for await(let Q of process.stdin)NZ+=Q;try{let Q=JSON.parse(NZ||"{}"),Z=jZ(Q);if(Z.length){let $=M($Z(typeof Q.cwd==="string"?Q.cwd:void 0));await fetch(`${GZ()}/api/map/touch-active`,{method:"POST",headers:{"content-type":"application/json","x-beacon-workspace":$},body:JSON.stringify({files:Z})}).catch(()=>{})}}catch{}process.exit(0);
351
+ ${cQ}
352
+ `});var eQ={};ZQ(eQ,{provisionDb:()=>P0});import{createClient as q0}from"@libsql/client";import{drizzle as X0}from"drizzle-orm/libsql";import{migrate as U0}from"drizzle-orm/libsql/migrator";import{readMigrationFiles as W0}from"drizzle-orm/migrator";import{dirname as CQ,join as H0}from"path";import{fileURLToPath as B0}from"url";async function i(Q,Z){return(await Q.execute({sql:"SELECT 1 FROM sqlite_master WHERE type='table' AND name = ?",args:[Z]})).rows.length>0}async function K0(Q,Z){let $=await Q.execute(`PRAGMA table_info("${Z}")`);return new Set($.rows.map((J)=>String(J.name)))}async function iQ(Q){if(!await i(Q,"__drizzle_migrations"))return 0;let Z=await Q.execute('SELECT count(*) AS n FROM "__drizzle_migrations"');return Number(Z.rows[0]?.n??0)}async function N0(Q){for(let[Z,$]of Object.entries(G0)){if(!await i(Q,Z))continue;let J=await K0(Q,Z);for(let Y of $){if(!J.has(Y))continue;await Q.execute(`UPDATE "${Z}" SET "${Y}" = CAST((julianday("${Y}") - 2440587.5) * 86400000 AS INTEGER) WHERE typeof("${Y}") = 'text'`)}}}async function P0(Q,Z=x0){let $=q0({url:Q});try{await $.execute("PRAGMA journal_mode = WAL;"),await $.execute("PRAGMA foreign_keys = ON;"),await $.execute("PRAGMA busy_timeout = 5000;");let J=await i($,"__drizzle_migrations"),Y=await i($,"Node"),V=!1;if(Y&&!J){let W=W0({migrationsFolder:Z})[0];if(W)await $.execute('CREATE TABLE IF NOT EXISTS "__drizzle_migrations" (id SERIAL PRIMARY KEY, hash text NOT NULL, created_at numeric)'),await $.execute({sql:'INSERT INTO "__drizzle_migrations" ("hash", "created_at") VALUES (?, ?)',args:[W.hash,W.folderMillis]}),V=!0}let q=await iQ($);if(await U0(X0($),{migrationsFolder:Z}),await iQ($)>q)V=!0;return await N0($),{migrated:V}}finally{$.close()}}var j0,x0,G0;var QZ=v(async()=>{j0=CQ(CQ(CQ(B0(import.meta.url)))),x0=process.env.BEACON_MIGRATIONS_DIR||H0(j0,"drizzle"),G0={Node:["createdAt","updatedAt"],Note:["createdAt","updatedAt"],DbTable:["createdAt","updatedAt"],Endpoint:["createdAt","updatedAt"],DraftTable:["createdAt"],SyncState:["codeGraphSyncedAt","updatedAt"],AppSetting:["updatedAt"],ProjectMeta:["updatedAt"],CodeFile:["updatedAt"]}});WQ();import{existsSync as sZ}from"fs";import{homedir as tZ}from"os";import{join as r}from"path";function rZ(){return process.env.HOME||process.env.USERPROFILE||tZ()}var o=()=>r(rZ(),".claude"),GQ=()=>r(o(),"skills"),KQ=()=>r(o(),"settings.json"),NQ=()=>r(o(),"CLAUDE.md"),PQ="<!-- beacon:global:start -->",sQ="<!-- beacon:global:end -->";var oZ=k,vQ=[{event:"PreToolUse",matcher:"Edit|Write|MultiEdit",command:"beacon guard",description:"Gate edits against the active plan's scope contract: in-scope \u2192 allow, off-scope \u2192 ask the user to authorize. Fail-open when there's no active contract."},{event:"PostToolUse",matcher:"Edit|Write|MultiEdit",command:"beacon hook",description:"Report file edits to Beacon's active feature so the map stays fresh."},{event:"PermissionRequest",matcher:"ExitPlanMode",command:"beacon plan",description:"Pipe the agent's plan markdown into Beacon's /plan canvas for review."},{event:"PreToolUse",matcher:"AskUserQuestion",command:"beacon ask",description:"Surface the agent's AskUserQuestion in Beacon's modal; your pick flows back as the answer (falls through to the terminal if Beacon isn't open)."},{event:"PermissionRequest",matcher:"Edit|Write|MultiEdit|Bash|NotebookEdit",command:"beacon ask",description:"Surface edit/create/run approvals in Beacon's modal; your allow/deny flows back (falls through to the terminal prompt if Beacon isn't open)."},{event:"UserPromptSubmit",matcher:"*",command:"beacon prompt",description:"On feature-y prompts in a Beacon-wired repo, remind the agent to run the context\u2192propose\u2192describe loop (no-op otherwise)."},{event:"Stop",matcher:"*",command:"beacon stop-hook",description:"When the agent ends a turn asking for plan approval in prose (instead of presenting it), nudge it to present the plan on Beacon's /plan canvas. Bounded by stop_hook_active \u2014 at most one nudge."}];function iZ(Q,Z){return p(GQ(),Q,Z)}function tQ(Q){return R(GQ(),Q)}function eZ(Q){return c(GQ(),Q)}function Q0(Q){return L(KQ(),Q)}function Z0(Q){return _(KQ(),Q)}function $0(Q){return S(KQ(),Q)}function J0(Q){m(NQ(),PQ,sQ,Q)}function rQ(){return w(NQ(),PQ)}function Y0(){return h(NQ(),PQ,sQ)}function B1(){let Q={};for(let $ of K)Q[$]=tQ($);let Z={};for(let $ of vQ)Z[$.event]=Z0({event:$.event,command:$.command});return{homeExists:sZ(o()),skills:Q,hooks:Z,claudeMdBlock:rQ()}}async function V0(){let{INIT_SKILL:Q,REFRESH_SKILL:Z,PLAN_SKILL:$,EXPLAIN_SKILL:J}=await Promise.resolve().then(() => (qQ(),zQ)),Y={"beacon-init":Q,"beacon-refresh":Z,"beacon-plan":$,"beacon-explain":J},V=[];for(let z of K){if(!tQ(z))V.push(z);iZ(z,Y[z])}let q=0;for(let z of vQ)if(Q0({event:z.event,matcher:z.matcher,command:z.command}))q++;let W=rQ();return J0(oZ),{skillsAdded:V,hooksAdded:q,claudeMdBlockTouched:!W}}async function oQ(){if(AQ())return{ok:!0,skipped:"plugin",skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1};let Q;if(kQ()){try{z0()}catch{}Q={ok:!0,skipped:"plugin-present",skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1}}else try{Q={ok:!0,...await V0()}}catch(Z){Q={ok:!1,error:Z instanceof Error?Z.message:String(Z),skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1}}try{let Z=await Promise.resolve().then(() => (aQ(),nQ));if(Z.codexDetected())Q.codex={ok:!0,...await Z.setupCodexAssets()}}catch(Z){Q.codex={ok:!1,error:Z instanceof Error?Z.message:String(Z),skillsAdded:[],hooksAdded:0,agentsMdBlockTouched:!1,mcp:{added:!1}}}return Q}function z0(){let Q=[];for(let J of K)if(eZ(J))Q.push(J);let Z=0;for(let J of vQ)if($0(J))Z++;let $=Y0();return{skillsRemoved:Q,hooksRemoved:Z,claudeMdBlockRemoved:$}}import{AsyncLocalStorage as v0}from"async_hooks";import{spawnSync as C0}from"child_process";import{createHash as M0}from"crypto";import{existsSync as $Z,mkdirSync as b,readFileSync as uQ,writeFileSync as wQ}from"fs";import{homedir as JZ}from"os";import{basename as u0,join as N,parse as w0,resolve as ZZ}from"path";function j(){return process.env.BEACON_HOME||N(JZ(),".beacon")}function RQ(){return N(j(),"workspaces.json")}function O(Q){return M0("sha256").update(Q).digest("hex").slice(0,12)}function R0(Q=process.cwd()){let Z=C0("git",["rev-parse","--show-toplevel"],{cwd:Q,stdio:["ignore","pipe","ignore"]});if(Z.status===0){let $=Z.stdout?.toString().trim();if($)return $}return Q}function YZ(Q){let Z=ZZ(Q);return Z!==ZZ(JZ())&&Z!==w0(Z).root}function VZ(){return N(j(),"deleted.json")}function TQ(){try{let Q=JSON.parse(uQ(VZ(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function zZ(Q){b(j(),{recursive:!0}),wQ(VZ(),JSON.stringify(Q,null,2))}function qZ(Q){return TQ().includes(Q)}function F1(Q){let Z=TQ();if(!Z.includes(Q))zZ([...Z,Q])}function T0(Q){let Z=TQ();if(Z.includes(Q))zZ(Z.filter(($)=>$!==Q))}function e(Q){return N(j(),Q)}function F0(Q){return`file:${N(e(Q),"db.sqlite")}`}function I(){try{let Q=JSON.parse(uQ(RQ(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function FQ(Q){b(j(),{recursive:!0}),wQ(RQ(),JSON.stringify(Q,null,2))}function XZ(){return I().sort((Q,Z)=>Z.lastOpenedAt.localeCompare(Q.lastOpenedAt))}function P(Q){return I().find((Z)=>Z.id===Q)??null}function UZ(Q,Z,$=new Date().toISOString()){if(!YZ(Q))throw Error(`beacon: refusing to register a non-repo path as a workspace: ${Q}`);let J=O(Q);if(qZ(J))throw Error(`beacon: workspace ${J} (${Q}) was deleted \u2014 run \`beacon\` or /beacon-init to re-add it`);let Y=I(),V=Y.find((z)=>z.id===J),q={id:J,path:Q,name:Z||V?.name||u0(Q),lastOpenedAt:$},W=[q,...Y.filter((z)=>z.id!==J)];return b(e(J),{recursive:!0}),FQ(W),q}function g1(Q,Z){return T0(O(Q)),UZ(Q,Z)}function O1(Q,Z=new Date().toISOString()){let $=I(),J=$.find((Y)=>Y.id===Q);if(!J)return;J.lastOpenedAt=Z,FQ($)}function b1(Q){if(FQ(I().filter((Z)=>Z.id!==Q)),gQ()===Q)g0(XZ()[0]?.id??null)}function WZ(){return N(j(),"active")}function gQ(){try{return uQ(WZ(),"utf8").trim()||null}catch{return null}}function g0(Q){b(j(),{recursive:!0}),wQ(WZ(),Q??"")}function I1(){let Q=gQ();return Q?P(Q):null}function f1(){let Q=b0()??gQ();return Q?P(Q):null}function D1(Q){return P(Q)?.path??null}function E1(){return $Z(RQ())}var HZ="beacon_ws";function BZ(Q,Z){let $=Q.headers.get("cookie");if(!$)return null;for(let J of $.split(";")){let Y=J.indexOf("=");if(Y===-1)continue;if(J.slice(0,Y).trim()===Z)return decodeURIComponent(J.slice(Y+1).trim())}return null}function A1(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&P(Z))return Z;let $=BZ(Q,HZ);if($&&P($))return $;return O0()}function O0(){let Q=XZ();return Q.length===1?Q[0].id:null}var jZ="x-beacon-workspace-path";function xZ(Q=process.cwd()){let Z=R0(Q);return{"x-beacon-workspace":O(Z),[jZ]:Z}}async function y1(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&P(Z))return Z;let $=Q.headers.get(jZ);if($&&YZ($)&&!qZ(O($))&&(!Z||O($)===Z)){let Y=UZ($);return await I0(Y.id),Y.id}let J=BZ(Q,HZ);if(J&&P(J))return J;return null}var GZ=new v0;function k1(Q,Z){return Q?GZ.run(Q,Z):Z()}function b0(){return GZ.getStore()??null}var MQ=new Set;function L1(Q){MQ.delete(N(e(Q),"db.sqlite"))}async function I0(Q){let Z=e(Q),$=N(Z,"db.sqlite"),J=$Z($);if(J&&MQ.has($))return{ok:!0,created:!1,migrated:!1};try{b(Z,{recursive:!0});let{provisionDb:Y}=await QZ().then(() => eQ),V=await Y(F0(Q));return MQ.add($),{ok:!0,created:!J,migrated:J&&V.migrated}}catch(Y){return{ok:!1,created:!1,migrated:!1,error:Y instanceof Error?Y.message:String(Y)}}}import{connect as f0}from"net";var KZ=4319;function D0(Q,Z,$=400){return new Promise((J)=>{let Y=f0({host:Q,port:Z}),V=!1,q=(W)=>{if(V)return;V=!0,Y.destroy(),J(W)};Y.once("connect",()=>q(!0)),Y.once("error",()=>q(!1)),Y.setTimeout($,()=>q(!1))})}async function E0(Q){for(let Z of["127.0.0.1","::1"])if(await D0(Z,Q))return!1;return!0}async function m1(Q,Z=20){for(let $=Q;$<Q+Z;$++)if(await E0($))return $;return Q}import{resolve as A0}from"path";var y0="*** Begin Patch",k0=/^\*\*\* (Update File|Add File|Move to): (.+)$/;function L0(Q){let Z=[];for(let $ of Q.split(`
353
+ `)){let J=k0.exec($.trim());if(!J)continue;let Y=J[2].trim();if(J[1]==="Move to")Z.pop();Z.push(Y)}return Z}function NZ(Q){let Z=Q.tool_input;if(Z===null||typeof Z!=="object")return[];let $=Z,J=[];if(typeof $.file_path==="string")J.push($.file_path);if(typeof $.path==="string")J.push($.path);if(Array.isArray($.files))for(let V of $.files){let q=V?.file_path;if(typeof q==="string")J.push(q)}if(J.length)return J;let Y=typeof Q.cwd==="string"?Q.cwd:process.cwd();for(let V of Object.values($)){if(typeof V!=="string"||!V.includes(y0))continue;return L0(V).map((q)=>A0(Y,q))}return[]}import{readFileSync as _0}from"fs";import{join as S0}from"path";function m0(){try{return JSON.parse(_0(S0(j(),"server.json"),"utf8"))}catch{return null}}function PZ(){if(process.env.BEACON_URL)return process.env.BEACON_URL;return`http://localhost:${m0()?.port||process.env.PORT||KZ}`}await oQ();var vZ="";for await(let Q of process.stdin)vZ+=Q;try{let Q=JSON.parse(vZ||"{}"),Z=NZ(Q);if(Z.length)await fetch(`${PZ()}/api/map/touch-active`,{method:"POST",headers:{"content-type":"application/json",...xZ(typeof Q.cwd==="string"?Q.cwd:void 0)},body:JSON.stringify({files:Z,session:typeof Q.session_id==="string"?Q.session_id:void 0})}).catch(()=>{})}catch{}process.exit(0);