trybeacon 0.1.72 → 0.1.73

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 (388) 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 +22 -18
  4. package/.next/build-manifest.json +3 -3
  5. package/.next/prerender-manifest.json +3 -3
  6. package/.next/routes-manifest.json +30 -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_client-reference-manifest.js +1 -1
  19. package/.next/server/app/_not-found.html +1 -1
  20. package/.next/server/app/_not-found.rsc +11 -11
  21. package/.next/server/app/_not-found.segments/_full.segment.rsc +11 -11
  22. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  23. package/.next/server/app/_not-found.segments/_index.segment.rsc +11 -11
  24. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  25. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  26. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  27. package/.next/server/app/api/board-annotations/[id]/route.js +1 -1
  28. package/.next/server/app/api/board-annotations/route.js +1 -1
  29. package/.next/server/app/api/board-layout/route.js +1 -1
  30. package/.next/server/app/api/bug-flags/[id]/route.js +1 -1
  31. package/.next/server/app/api/bug-flags/route.js +1 -1
  32. package/.next/server/app/api/changes/comment/claim/route.js +1 -0
  33. package/.next/server/app/api/changes/comment/claim/route.js.nft.json +1 -0
  34. package/.next/server/app/api/changes/comment/claim/route_client-reference-manifest.js +1 -0
  35. package/.next/server/app/api/changes/comment/route.js +1 -0
  36. package/.next/server/app/api/changes/comment/route.js.nft.json +1 -0
  37. package/.next/server/app/api/changes/comment/route_client-reference-manifest.js +1 -0
  38. package/.next/server/app/api/changes/quality/route.js +1 -0
  39. package/.next/server/app/api/changes/quality/route.js.nft.json +1 -0
  40. package/.next/server/app/api/changes/quality/route_client-reference-manifest.js +1 -0
  41. package/.next/server/app/api/changes/route.js +1 -0
  42. package/.next/server/app/api/{flags → changes}/route.js.nft.json +1 -1
  43. package/.next/server/app/api/changes/route_client-reference-manifest.js +1 -0
  44. package/.next/server/app/api/changes/viewed/route.js +1 -0
  45. package/.next/server/app/api/changes/viewed/route.js.nft.json +1 -0
  46. package/.next/server/app/api/changes/viewed/route_client-reference-manifest.js +1 -0
  47. package/.next/server/app/api/code-graph/position/route.js +1 -1
  48. package/.next/server/app/api/code-graph/route.js +1 -1
  49. package/.next/server/app/api/context/feature/route.js +1 -1
  50. package/.next/server/app/api/context/file/route.js +1 -1
  51. package/.next/server/app/api/context/route.js +1 -9
  52. package/.next/server/app/api/context/route.js.nft.json +1 -1
  53. package/.next/server/app/api/db/arrange/route.js +1 -1
  54. package/.next/server/app/api/db/backfill-access/route.js +1 -1
  55. package/.next/server/app/api/db/position/route.js +1 -1
  56. package/.next/server/app/api/db/position/route.js.nft.json +1 -1
  57. package/.next/server/app/api/db/prune-planned/route.js +1 -1
  58. package/.next/server/app/api/db/reconcile-endpoints/route.js +1 -1
  59. package/.next/server/app/api/db/relations/[id]/route.js +1 -1
  60. package/.next/server/app/api/db/tables/[id]/route.js +1 -1
  61. package/.next/server/app/api/draft/approve/route.js +1 -1
  62. package/.next/server/app/api/draft/approve/route.js.nft.json +1 -1
  63. package/.next/server/app/api/draft/route.js +1 -1
  64. package/.next/server/app/api/draft/route.js.nft.json +1 -1
  65. package/.next/server/app/api/draft/status/route.js +1 -1
  66. package/.next/server/app/api/edges/[id]/route.js +1 -1
  67. package/.next/server/app/api/edges/route.js +1 -1
  68. package/.next/server/app/api/edges/route.js.nft.json +1 -1
  69. package/.next/server/app/api/endpoints/[id]/route.js +1 -1
  70. package/.next/server/app/api/entities/route.js +1 -1
  71. package/.next/server/app/api/ingest/route.js +1 -9
  72. package/.next/server/app/api/ingest/route.js.nft.json +1 -1
  73. package/.next/server/app/api/init/route.js +1 -9
  74. package/.next/server/app/api/init/route.js.nft.json +1 -1
  75. package/.next/server/app/api/lesson/close/route.js +1 -1
  76. package/.next/server/app/api/lesson/presence/route.js +1 -1
  77. package/.next/server/app/api/lesson/questions/route.js +1 -1
  78. package/.next/server/app/api/lesson/route.js +1 -1
  79. package/.next/server/app/api/lesson/save/route.js +1 -1
  80. package/.next/server/app/api/lesson/verdict/route.js +1 -1
  81. package/.next/server/app/api/map/describe/route.js +1 -9
  82. package/.next/server/app/api/map/describe/route.js.nft.json +1 -1
  83. package/.next/server/app/api/map/files/route.js +1 -1
  84. package/.next/server/app/api/map/files/route.js.nft.json +1 -1
  85. package/.next/server/app/api/map/finish/route.js +1 -1
  86. package/.next/server/app/api/map/finish/route.js.nft.json +1 -1
  87. package/.next/server/app/api/map/route.js +1 -1
  88. package/.next/server/app/api/map/route.js.nft.json +1 -1
  89. package/.next/server/app/api/map/start/route.js +1 -1
  90. package/.next/server/app/api/map/start/route.js.nft.json +1 -1
  91. package/.next/server/app/api/map/touch-active/route.js +1 -1
  92. package/.next/server/app/api/map/touch-active/route.js.nft.json +1 -1
  93. package/.next/server/app/api/mention-search/route.js +1 -1
  94. package/.next/server/app/api/nodes/[id]/position/route.js +1 -1
  95. package/.next/server/app/api/nodes/[id]/position/route.js.nft.json +1 -1
  96. package/.next/server/app/api/nodes/[id]/route.js +1 -1
  97. package/.next/server/app/api/nodes/[id]/route.js.nft.json +1 -1
  98. package/.next/server/app/api/nodes/positions/route.js +1 -1
  99. package/.next/server/app/api/nodes/positions/route.js.nft.json +1 -1
  100. package/.next/server/app/api/nodes/route.js +1 -1
  101. package/.next/server/app/api/nodes/route.js.nft.json +1 -1
  102. package/.next/server/app/api/nodes/subtasks/route.js +1 -1
  103. package/.next/server/app/api/nodes/subtasks/route.js.nft.json +1 -1
  104. package/.next/server/app/api/notes/[id]/route.js +1 -1
  105. package/.next/server/app/api/notes/route.js +1 -1
  106. package/.next/server/app/api/open/route.js +1 -1
  107. package/.next/server/app/api/plan/annotations/route.js +3 -3
  108. package/.next/server/app/api/plan/approve/route.js +1 -9
  109. package/.next/server/app/api/plan/approve/route.js.nft.json +1 -1
  110. package/.next/server/app/api/plan/history/route.js +1 -1
  111. package/.next/server/app/api/plan/markdown/route.js +1 -1
  112. package/.next/server/app/api/plan/markdown/route.js.nft.json +1 -1
  113. package/.next/server/app/api/plan/presence/route.js +1 -1
  114. package/.next/server/app/api/plan/route.js +1 -1
  115. package/.next/server/app/api/plan/route.js.nft.json +1 -1
  116. package/.next/server/app/api/plan/verdict/route.js +1 -1
  117. package/.next/server/app/api/plan/verdict/route.js.nft.json +1 -1
  118. package/.next/server/app/api/preferences/route.js +1 -1
  119. package/.next/server/app/api/project-meta/route.js +1 -1
  120. package/.next/server/app/api/reset/route.js +1 -1
  121. package/.next/server/app/api/scope-guard/check/route.js +1 -1
  122. package/.next/server/app/api/scope-guard/check/route.js.nft.json +1 -1
  123. package/.next/server/app/api/share/create/route.js +1 -1
  124. package/.next/server/app/api/share/create/route.js.nft.json +1 -1
  125. package/.next/server/app/api/share/route.js +1 -1
  126. package/.next/server/app/api/stream/route.js +2 -2
  127. package/.next/server/app/api/tab/nav/route.js +1 -1
  128. package/.next/server/app/api/tab/presence/route.js +1 -1
  129. package/.next/server/app/api/telemetry/route.js +1 -1
  130. package/.next/server/app/api/telemetry/stats/route.js +1 -1
  131. package/.next/server/app/api/version/route.js +1 -1
  132. package/.next/server/app/api/workspace/activate/route.js +1 -1
  133. package/.next/server/app/api/workspace/route.js +1 -1
  134. package/.next/server/app/apple-icon.png/route.js +1 -1
  135. package/.next/server/app/docs/page.js +2 -2
  136. package/.next/server/app/docs/page_client-reference-manifest.js +1 -1
  137. package/.next/server/app/docs.html +1 -1
  138. package/.next/server/app/docs.rsc +11 -11
  139. package/.next/server/app/docs.segments/_full.segment.rsc +11 -11
  140. package/.next/server/app/docs.segments/_head.segment.rsc +1 -1
  141. package/.next/server/app/docs.segments/_index.segment.rsc +11 -11
  142. package/.next/server/app/docs.segments/_tree.segment.rsc +2 -2
  143. package/.next/server/app/docs.segments/docs/__PAGE__.segment.rsc +1 -1
  144. package/.next/server/app/docs.segments/docs.segment.rsc +1 -1
  145. package/.next/server/app/help/page.js +2 -2
  146. package/.next/server/app/help/page_client-reference-manifest.js +1 -1
  147. package/.next/server/app/help.html +1 -1
  148. package/.next/server/app/help.rsc +11 -11
  149. package/.next/server/app/help.segments/_full.segment.rsc +11 -11
  150. package/.next/server/app/help.segments/_head.segment.rsc +1 -1
  151. package/.next/server/app/help.segments/_index.segment.rsc +11 -11
  152. package/.next/server/app/help.segments/_tree.segment.rsc +2 -2
  153. package/.next/server/app/help.segments/help/__PAGE__.segment.rsc +1 -1
  154. package/.next/server/app/help.segments/help.segment.rsc +1 -1
  155. package/.next/server/app/icon.svg/route.js +1 -1
  156. package/.next/server/app/index.html +1 -1
  157. package/.next/server/app/index.rsc +11 -11
  158. package/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  159. package/.next/server/app/index.segments/_full.segment.rsc +11 -11
  160. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  161. package/.next/server/app/index.segments/_index.segment.rsc +11 -11
  162. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  163. package/.next/server/app/learn/page.js +4 -4
  164. package/.next/server/app/learn/page.js.nft.json +1 -1
  165. package/.next/server/app/learn/page_client-reference-manifest.js +1 -1
  166. package/.next/server/app/map/page.js +2 -2
  167. package/.next/server/app/map/page.js.nft.json +1 -1
  168. package/.next/server/app/map/page_client-reference-manifest.js +1 -1
  169. package/.next/server/app/page.js +2 -2
  170. package/.next/server/app/page_client-reference-manifest.js +1 -1
  171. package/.next/server/app/plan/page.js +12 -2
  172. package/.next/server/app/plan/page.js.nft.json +1 -1
  173. package/.next/server/app/plan/page_client-reference-manifest.js +1 -1
  174. package/.next/server/app/s/[token]/page.js +2 -2
  175. package/.next/server/app/s/[token]/page.js.nft.json +1 -1
  176. package/.next/server/app/s/[token]/page_client-reference-manifest.js +1 -1
  177. package/.next/server/app/settings/page.js +2 -2
  178. package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  179. package/.next/server/app-paths-manifest.json +22 -18
  180. package/.next/server/chunks/1130.js +1 -1
  181. package/.next/server/chunks/230.js +1 -0
  182. package/.next/server/chunks/2693.js +5 -0
  183. package/.next/server/chunks/4307.js +1 -1
  184. package/.next/server/chunks/6469.js +10 -0
  185. package/.next/server/chunks/8190.js +1 -0
  186. package/.next/server/chunks/8227.js +1 -0
  187. package/.next/server/chunks/8674.js +7 -0
  188. package/.next/server/middleware-build-manifest.js +1 -1
  189. package/.next/server/pages/404.html +1 -1
  190. package/.next/server/pages/500.html +1 -1
  191. package/.next/server/server-reference-manifest.js +1 -1
  192. package/.next/server/server-reference-manifest.json +1 -1
  193. package/.next/static/chunks/5909-387573cddda35a48.js +1 -0
  194. package/.next/static/chunks/654-8e68a43e4c589e9c.js +1 -0
  195. package/.next/static/chunks/app/_global-error/page-5f4c3e6e9cc8e6c9.js +1 -0
  196. package/.next/static/chunks/app/api/board-annotations/[id]/route-5f4c3e6e9cc8e6c9.js +1 -0
  197. package/.next/static/chunks/app/api/board-annotations/route-5f4c3e6e9cc8e6c9.js +1 -0
  198. package/.next/static/chunks/app/api/board-layout/route-5f4c3e6e9cc8e6c9.js +1 -0
  199. package/.next/static/chunks/app/api/bug-flags/[id]/route-5f4c3e6e9cc8e6c9.js +1 -0
  200. package/.next/static/chunks/app/api/bug-flags/route-5f4c3e6e9cc8e6c9.js +1 -0
  201. package/.next/static/chunks/app/api/changes/comment/claim/route-5f4c3e6e9cc8e6c9.js +1 -0
  202. package/.next/static/chunks/app/api/changes/comment/route-5f4c3e6e9cc8e6c9.js +1 -0
  203. package/.next/static/chunks/app/api/changes/quality/route-5f4c3e6e9cc8e6c9.js +1 -0
  204. package/.next/static/chunks/app/api/changes/route-5f4c3e6e9cc8e6c9.js +1 -0
  205. package/.next/static/chunks/app/api/changes/viewed/route-5f4c3e6e9cc8e6c9.js +1 -0
  206. package/.next/static/chunks/app/api/code-graph/position/route-5f4c3e6e9cc8e6c9.js +1 -0
  207. package/.next/static/chunks/app/api/code-graph/route-5f4c3e6e9cc8e6c9.js +1 -0
  208. package/.next/static/chunks/app/api/context/feature/route-5f4c3e6e9cc8e6c9.js +1 -0
  209. package/.next/static/chunks/app/api/context/file/route-5f4c3e6e9cc8e6c9.js +1 -0
  210. package/.next/static/chunks/app/api/context/route-5f4c3e6e9cc8e6c9.js +1 -0
  211. package/.next/static/chunks/app/api/db/arrange/route-5f4c3e6e9cc8e6c9.js +1 -0
  212. package/.next/static/chunks/app/api/db/backfill-access/route-5f4c3e6e9cc8e6c9.js +1 -0
  213. package/.next/static/chunks/app/api/db/position/route-5f4c3e6e9cc8e6c9.js +1 -0
  214. package/.next/static/chunks/app/api/db/prune-planned/route-5f4c3e6e9cc8e6c9.js +1 -0
  215. package/.next/static/chunks/app/api/db/reconcile-endpoints/route-5f4c3e6e9cc8e6c9.js +1 -0
  216. package/.next/static/chunks/app/api/db/relations/[id]/route-5f4c3e6e9cc8e6c9.js +1 -0
  217. package/.next/static/chunks/app/api/db/tables/[id]/route-5f4c3e6e9cc8e6c9.js +1 -0
  218. package/.next/static/chunks/app/api/draft/approve/route-5f4c3e6e9cc8e6c9.js +1 -0
  219. package/.next/static/chunks/app/api/draft/route-5f4c3e6e9cc8e6c9.js +1 -0
  220. package/.next/static/chunks/app/api/draft/status/route-5f4c3e6e9cc8e6c9.js +1 -0
  221. package/.next/static/chunks/app/api/edges/[id]/route-5f4c3e6e9cc8e6c9.js +1 -0
  222. package/.next/static/chunks/app/api/edges/route-5f4c3e6e9cc8e6c9.js +1 -0
  223. package/.next/static/chunks/app/api/endpoints/[id]/route-5f4c3e6e9cc8e6c9.js +1 -0
  224. package/.next/static/chunks/app/api/entities/route-5f4c3e6e9cc8e6c9.js +1 -0
  225. package/.next/static/chunks/app/api/ingest/route-5f4c3e6e9cc8e6c9.js +1 -0
  226. package/.next/static/chunks/app/api/init/route-5f4c3e6e9cc8e6c9.js +1 -0
  227. package/.next/static/chunks/app/api/lesson/close/route-5f4c3e6e9cc8e6c9.js +1 -0
  228. package/.next/static/chunks/app/api/lesson/presence/route-5f4c3e6e9cc8e6c9.js +1 -0
  229. package/.next/static/chunks/app/api/lesson/questions/route-5f4c3e6e9cc8e6c9.js +1 -0
  230. package/.next/static/chunks/app/api/lesson/route-5f4c3e6e9cc8e6c9.js +1 -0
  231. package/.next/static/chunks/app/api/lesson/save/route-5f4c3e6e9cc8e6c9.js +1 -0
  232. package/.next/static/chunks/app/api/lesson/verdict/route-5f4c3e6e9cc8e6c9.js +1 -0
  233. package/.next/static/chunks/app/api/map/describe/route-5f4c3e6e9cc8e6c9.js +1 -0
  234. package/.next/static/chunks/app/api/map/files/route-5f4c3e6e9cc8e6c9.js +1 -0
  235. package/.next/static/chunks/app/api/map/finish/route-5f4c3e6e9cc8e6c9.js +1 -0
  236. package/.next/static/chunks/app/api/map/route-5f4c3e6e9cc8e6c9.js +1 -0
  237. package/.next/static/chunks/app/api/map/start/route-5f4c3e6e9cc8e6c9.js +1 -0
  238. package/.next/static/chunks/app/api/map/touch-active/route-5f4c3e6e9cc8e6c9.js +1 -0
  239. package/.next/static/chunks/app/api/mention-search/route-5f4c3e6e9cc8e6c9.js +1 -0
  240. package/.next/static/chunks/app/api/nodes/[id]/position/route-5f4c3e6e9cc8e6c9.js +1 -0
  241. package/.next/static/chunks/app/api/nodes/[id]/route-5f4c3e6e9cc8e6c9.js +1 -0
  242. package/.next/static/chunks/app/api/nodes/positions/route-5f4c3e6e9cc8e6c9.js +1 -0
  243. package/.next/static/chunks/app/api/nodes/route-5f4c3e6e9cc8e6c9.js +1 -0
  244. package/.next/static/chunks/app/api/nodes/subtasks/route-5f4c3e6e9cc8e6c9.js +1 -0
  245. package/.next/static/chunks/app/api/notes/[id]/route-5f4c3e6e9cc8e6c9.js +1 -0
  246. package/.next/static/chunks/app/api/notes/route-5f4c3e6e9cc8e6c9.js +1 -0
  247. package/.next/static/chunks/app/api/open/route-5f4c3e6e9cc8e6c9.js +1 -0
  248. package/.next/static/chunks/app/api/plan/annotations/route-5f4c3e6e9cc8e6c9.js +1 -0
  249. package/.next/static/chunks/app/api/plan/approve/route-5f4c3e6e9cc8e6c9.js +1 -0
  250. package/.next/static/chunks/app/api/plan/history/route-5f4c3e6e9cc8e6c9.js +1 -0
  251. package/.next/static/chunks/app/api/plan/markdown/route-5f4c3e6e9cc8e6c9.js +1 -0
  252. package/.next/static/chunks/app/api/plan/presence/route-5f4c3e6e9cc8e6c9.js +1 -0
  253. package/.next/static/chunks/app/api/plan/route-5f4c3e6e9cc8e6c9.js +1 -0
  254. package/.next/static/chunks/app/api/plan/verdict/route-5f4c3e6e9cc8e6c9.js +1 -0
  255. package/.next/static/chunks/app/api/preferences/route-5f4c3e6e9cc8e6c9.js +1 -0
  256. package/.next/static/chunks/app/api/project-meta/route-5f4c3e6e9cc8e6c9.js +1 -0
  257. package/.next/static/chunks/app/api/reset/route-5f4c3e6e9cc8e6c9.js +1 -0
  258. package/.next/static/chunks/app/api/scope-guard/check/route-5f4c3e6e9cc8e6c9.js +1 -0
  259. package/.next/static/chunks/app/api/share/create/route-5f4c3e6e9cc8e6c9.js +1 -0
  260. package/.next/static/chunks/app/api/share/route-5f4c3e6e9cc8e6c9.js +1 -0
  261. package/.next/static/chunks/app/api/stream/route-5f4c3e6e9cc8e6c9.js +1 -0
  262. package/.next/static/chunks/app/api/tab/nav/route-5f4c3e6e9cc8e6c9.js +1 -0
  263. package/.next/static/chunks/app/api/tab/presence/route-5f4c3e6e9cc8e6c9.js +1 -0
  264. package/.next/static/chunks/app/api/telemetry/route-5f4c3e6e9cc8e6c9.js +1 -0
  265. package/.next/static/chunks/app/api/telemetry/stats/route-5f4c3e6e9cc8e6c9.js +1 -0
  266. package/.next/static/chunks/app/api/version/route-5f4c3e6e9cc8e6c9.js +1 -0
  267. package/.next/static/chunks/app/api/workspace/activate/route-5f4c3e6e9cc8e6c9.js +1 -0
  268. package/.next/static/chunks/app/api/workspace/route-5f4c3e6e9cc8e6c9.js +1 -0
  269. package/.next/static/chunks/app/{layout-d3b7276f116dce46.js → layout-6e934a2850efd223.js} +1 -1
  270. package/.next/static/chunks/app/learn/{page-e5bd3257170098e7.js → page-a14eaf5143e2df55.js} +1 -1
  271. package/.next/static/chunks/app/map/{page-5ab46e5ea28ecd79.js → page-06282017c592fb3c.js} +1 -1
  272. package/.next/static/chunks/app/plan/page-41a3990cb858c5f2.js +11 -0
  273. package/.next/static/chunks/app/s/[token]/{page-8e4ffccdf7cd0309.js → page-a4deb16beff21840.js} +1 -1
  274. package/.next/static/chunks/app/settings/page-67cab634be8bfef2.js +1 -0
  275. package/.next/static/chunks/next/dist/client/components/builtin/app-error-5f4c3e6e9cc8e6c9.js +1 -0
  276. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-5f4c3e6e9cc8e6c9.js +1 -0
  277. package/.next/static/chunks/next/dist/client/components/builtin/not-found-5f4c3e6e9cc8e6c9.js +1 -0
  278. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-5f4c3e6e9cc8e6c9.js +1 -0
  279. package/.next/static/chunks/{webpack-de4a0d9611ec2cad.js → webpack-6c27b0ed1ac1459c.js} +1 -1
  280. package/.next/static/css/95dc31edc34789a7.css +1 -0
  281. package/.next/static/css/a5d17568738ef1e9.css +1 -0
  282. package/.next/static/mB9lqGEsIvB7tTvv9GU48/_buildManifest.js +1 -0
  283. package/.next/trace +45 -43
  284. package/.next/trace-build +1 -1
  285. package/.next/types/app/api/changes/comment/claim/route.ts +351 -0
  286. package/.next/types/app/api/changes/comment/route.ts +351 -0
  287. package/.next/types/app/api/changes/quality/route.ts +351 -0
  288. package/.next/types/app/api/{flags → changes}/route.ts +3 -3
  289. package/.next/types/app/api/changes/viewed/route.ts +351 -0
  290. package/.next/types/routes.d.ts +6 -2
  291. package/.next/types/validator.ts +45 -9
  292. package/bun.lock +54 -0
  293. package/dist/bin/doctor.js +33 -32
  294. package/dist/bin/guard.js +1 -1
  295. package/dist/bin/hook.js +33 -32
  296. package/dist/bin/mcp.js +43 -42
  297. package/dist/bin/plan.js +35 -34
  298. package/dist/bin/uninstall.js +34 -33
  299. package/dist/lib/assets.js +25 -24
  300. package/dist/lib/codex-install.js +32 -31
  301. package/dist/lib/global-install.js +33 -32
  302. package/package.json +3 -1
  303. package/plugin/skills/beacon-plan/SKILL.md +5 -4
  304. package/.next/server/app/api/flags/route.js +0 -1
  305. package/.next/server/app/api/flags/route_client-reference-manifest.js +0 -1
  306. package/.next/server/chunks/3098.js +0 -1
  307. package/.next/server/chunks/3221.js +0 -5
  308. package/.next/server/chunks/7604.js +0 -1
  309. package/.next/static/chunks/2416-dbbbff4e4c9abad1.js +0 -1
  310. package/.next/static/chunks/app/_global-error/page-93569b5eb93a61e9.js +0 -1
  311. package/.next/static/chunks/app/api/board-annotations/[id]/route-93569b5eb93a61e9.js +0 -1
  312. package/.next/static/chunks/app/api/board-annotations/route-93569b5eb93a61e9.js +0 -1
  313. package/.next/static/chunks/app/api/board-layout/route-93569b5eb93a61e9.js +0 -1
  314. package/.next/static/chunks/app/api/bug-flags/[id]/route-93569b5eb93a61e9.js +0 -1
  315. package/.next/static/chunks/app/api/bug-flags/route-93569b5eb93a61e9.js +0 -1
  316. package/.next/static/chunks/app/api/code-graph/position/route-93569b5eb93a61e9.js +0 -1
  317. package/.next/static/chunks/app/api/code-graph/route-93569b5eb93a61e9.js +0 -1
  318. package/.next/static/chunks/app/api/context/feature/route-93569b5eb93a61e9.js +0 -1
  319. package/.next/static/chunks/app/api/context/file/route-93569b5eb93a61e9.js +0 -1
  320. package/.next/static/chunks/app/api/context/route-93569b5eb93a61e9.js +0 -1
  321. package/.next/static/chunks/app/api/db/arrange/route-93569b5eb93a61e9.js +0 -1
  322. package/.next/static/chunks/app/api/db/backfill-access/route-93569b5eb93a61e9.js +0 -1
  323. package/.next/static/chunks/app/api/db/position/route-93569b5eb93a61e9.js +0 -1
  324. package/.next/static/chunks/app/api/db/prune-planned/route-93569b5eb93a61e9.js +0 -1
  325. package/.next/static/chunks/app/api/db/reconcile-endpoints/route-93569b5eb93a61e9.js +0 -1
  326. package/.next/static/chunks/app/api/db/relations/[id]/route-93569b5eb93a61e9.js +0 -1
  327. package/.next/static/chunks/app/api/db/tables/[id]/route-93569b5eb93a61e9.js +0 -1
  328. package/.next/static/chunks/app/api/draft/approve/route-93569b5eb93a61e9.js +0 -1
  329. package/.next/static/chunks/app/api/draft/route-93569b5eb93a61e9.js +0 -1
  330. package/.next/static/chunks/app/api/draft/status/route-93569b5eb93a61e9.js +0 -1
  331. package/.next/static/chunks/app/api/edges/[id]/route-93569b5eb93a61e9.js +0 -1
  332. package/.next/static/chunks/app/api/edges/route-93569b5eb93a61e9.js +0 -1
  333. package/.next/static/chunks/app/api/endpoints/[id]/route-93569b5eb93a61e9.js +0 -1
  334. package/.next/static/chunks/app/api/entities/route-93569b5eb93a61e9.js +0 -1
  335. package/.next/static/chunks/app/api/flags/route-93569b5eb93a61e9.js +0 -1
  336. package/.next/static/chunks/app/api/ingest/route-93569b5eb93a61e9.js +0 -1
  337. package/.next/static/chunks/app/api/init/route-93569b5eb93a61e9.js +0 -1
  338. package/.next/static/chunks/app/api/lesson/close/route-93569b5eb93a61e9.js +0 -1
  339. package/.next/static/chunks/app/api/lesson/presence/route-93569b5eb93a61e9.js +0 -1
  340. package/.next/static/chunks/app/api/lesson/questions/route-93569b5eb93a61e9.js +0 -1
  341. package/.next/static/chunks/app/api/lesson/route-93569b5eb93a61e9.js +0 -1
  342. package/.next/static/chunks/app/api/lesson/save/route-93569b5eb93a61e9.js +0 -1
  343. package/.next/static/chunks/app/api/lesson/verdict/route-93569b5eb93a61e9.js +0 -1
  344. package/.next/static/chunks/app/api/map/describe/route-93569b5eb93a61e9.js +0 -1
  345. package/.next/static/chunks/app/api/map/files/route-93569b5eb93a61e9.js +0 -1
  346. package/.next/static/chunks/app/api/map/finish/route-93569b5eb93a61e9.js +0 -1
  347. package/.next/static/chunks/app/api/map/route-93569b5eb93a61e9.js +0 -1
  348. package/.next/static/chunks/app/api/map/start/route-93569b5eb93a61e9.js +0 -1
  349. package/.next/static/chunks/app/api/map/touch-active/route-93569b5eb93a61e9.js +0 -1
  350. package/.next/static/chunks/app/api/mention-search/route-93569b5eb93a61e9.js +0 -1
  351. package/.next/static/chunks/app/api/nodes/[id]/position/route-93569b5eb93a61e9.js +0 -1
  352. package/.next/static/chunks/app/api/nodes/[id]/route-93569b5eb93a61e9.js +0 -1
  353. package/.next/static/chunks/app/api/nodes/positions/route-93569b5eb93a61e9.js +0 -1
  354. package/.next/static/chunks/app/api/nodes/route-93569b5eb93a61e9.js +0 -1
  355. package/.next/static/chunks/app/api/nodes/subtasks/route-93569b5eb93a61e9.js +0 -1
  356. package/.next/static/chunks/app/api/notes/[id]/route-93569b5eb93a61e9.js +0 -1
  357. package/.next/static/chunks/app/api/notes/route-93569b5eb93a61e9.js +0 -1
  358. package/.next/static/chunks/app/api/open/route-93569b5eb93a61e9.js +0 -1
  359. package/.next/static/chunks/app/api/plan/annotations/route-93569b5eb93a61e9.js +0 -1
  360. package/.next/static/chunks/app/api/plan/approve/route-93569b5eb93a61e9.js +0 -1
  361. package/.next/static/chunks/app/api/plan/history/route-93569b5eb93a61e9.js +0 -1
  362. package/.next/static/chunks/app/api/plan/markdown/route-93569b5eb93a61e9.js +0 -1
  363. package/.next/static/chunks/app/api/plan/presence/route-93569b5eb93a61e9.js +0 -1
  364. package/.next/static/chunks/app/api/plan/route-93569b5eb93a61e9.js +0 -1
  365. package/.next/static/chunks/app/api/plan/verdict/route-93569b5eb93a61e9.js +0 -1
  366. package/.next/static/chunks/app/api/preferences/route-93569b5eb93a61e9.js +0 -1
  367. package/.next/static/chunks/app/api/project-meta/route-93569b5eb93a61e9.js +0 -1
  368. package/.next/static/chunks/app/api/reset/route-93569b5eb93a61e9.js +0 -1
  369. package/.next/static/chunks/app/api/scope-guard/check/route-93569b5eb93a61e9.js +0 -1
  370. package/.next/static/chunks/app/api/share/create/route-93569b5eb93a61e9.js +0 -1
  371. package/.next/static/chunks/app/api/share/route-93569b5eb93a61e9.js +0 -1
  372. package/.next/static/chunks/app/api/stream/route-93569b5eb93a61e9.js +0 -1
  373. package/.next/static/chunks/app/api/tab/nav/route-93569b5eb93a61e9.js +0 -1
  374. package/.next/static/chunks/app/api/tab/presence/route-93569b5eb93a61e9.js +0 -1
  375. package/.next/static/chunks/app/api/telemetry/route-93569b5eb93a61e9.js +0 -1
  376. package/.next/static/chunks/app/api/telemetry/stats/route-93569b5eb93a61e9.js +0 -1
  377. package/.next/static/chunks/app/api/version/route-93569b5eb93a61e9.js +0 -1
  378. package/.next/static/chunks/app/api/workspace/activate/route-93569b5eb93a61e9.js +0 -1
  379. package/.next/static/chunks/app/api/workspace/route-93569b5eb93a61e9.js +0 -1
  380. package/.next/static/chunks/app/plan/page-948f3eca400e746a.js +0 -1
  381. package/.next/static/chunks/app/settings/page-7e176d120b1effa9.js +0 -1
  382. package/.next/static/chunks/next/dist/client/components/builtin/app-error-93569b5eb93a61e9.js +0 -1
  383. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-93569b5eb93a61e9.js +0 -1
  384. package/.next/static/chunks/next/dist/client/components/builtin/not-found-93569b5eb93a61e9.js +0 -1
  385. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-93569b5eb93a61e9.js +0 -1
  386. package/.next/static/css/446974879473fd01.css +0 -1
  387. package/.next/static/lnOOQsWRymiliRmMEQ95F/_buildManifest.js +0 -1
  388. /package/.next/static/{lnOOQsWRymiliRmMEQ95F → mB9lqGEsIvB7tTvv9GU48}/_ssgManifest.js +0 -0
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 I={};a(I,{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 C(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(($)=>String($.name)))}async function D(Q){if(!await C(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 C(Q,X))continue;let $=await GQ(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 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 $=await C(Z,"__drizzle_migrations"),J=await C(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 D(Z);if(await e(i(Z),{migrationsFolder:X}),await D(Z)>G)Y=!0;return await VQ(Z),{migrated:Y}}finally{Z.close()}}var $Q,JQ,YQ;var u=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 NQ}from"child_process";import{createHash as MQ}from"crypto";import{existsSync as S,mkdirSync as L,readFileSync as T,writeFileSync as x}from"fs";import{homedir as v}from"os";import{basename as UQ,join as B,parse as LQ,resolve as W}from"path";function K(){return process.env.BEACON_HOME||B(v(),".beacon")}function E(){return B(K(),"workspaces.json")}function U(Q){return MQ("sha256").update(Q).digest("hex").slice(0,12)}function F(Q=process.cwd()){let X=NQ("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 P(Q){let X=W(Q);return X!==W(v())&&X!==LQ(X).root}function y(){return B(K(),"deleted.json")}function A(){try{let Q=JSON.parse(T(y(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function f(Q){L(K(),{recursive:!0}),x(y(),JSON.stringify(Q,null,2))}function k(Q){return A().includes(Q)}function mQ(Q){let X=A();if(!X.includes(Q))f([...X,Q])}function jQ(Q){let X=A();if(X.includes(Q))f(X.filter((Z)=>Z!==Q))}function H(Q){return B(K(),Q)}function zQ(Q){return`file:${B(H(Q),"db.sqlite")}`}function j(){try{let Q=JSON.parse(T(E(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function q(Q){L(K(),{recursive:!0}),x(E(),JSON.stringify(Q,null,2))}function g(){return j().sort((Q,X)=>X.lastOpenedAt.localeCompare(Q.lastOpenedAt))}function N(Q){return j().find((X)=>X.id===Q)??null}function w(Q,X,Z=new Date().toISOString()){if(!P(Q))throw Error(`beacon: refusing to register a non-repo path as a workspace: ${Q}`);let $=U(Q);if(k($))throw Error(`beacon: workspace ${$} (${Q}) was deleted \u2014 run \`beacon\` or /beacon-init to re-add it`);let J=j(),Y=J.find((M)=>M.id===$),G={id:$,path:Q,name:X||Y?.name||UQ(Q),lastOpenedAt:Z},V=[G,...J.filter((M)=>M.id!==$)];return L(H($),{recursive:!0}),q(V),G}function hQ(Q,X){return jQ(U(Q)),w(Q,X)}function pQ(Q,X=new Date().toISOString()){let Z=j(),$=Z.find((J)=>J.id===Q);if(!$)return;$.lastOpenedAt=X,q(Z)}function cQ(Q){if(q(j().filter((X)=>X.id!==Q)),R()===Q)CQ(g()[0]?.id??null)}function b(){return B(K(),"active")}function R(){try{return T(b(),"utf8").trim()||null}catch{return null}}function CQ(Q){L(K(),{recursive:!0}),x(b(),Q??"")}function lQ(){let Q=R();return Q?N(Q):null}function nQ(){let Q=_Q()??R();return Q?N(Q):null}function sQ(Q){return N(Q)?.path??null}function dQ(){return S(E())}var m="beacon_ws";function h(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 oQ(Q){let X=Q.headers.get("x-beacon-workspace");if(X&&N(X))return X;let Z=h(Q,m);if(Z&&N(Z))return Z;return HQ()}function HQ(){let Q=g();return Q.length===1?Q[0].id:null}var OQ="x-beacon-workspace-path";async function aQ(Q){let X=Q.headers.get("x-beacon-workspace");if(X&&N(X))return X;let Z=Q.headers.get(OQ);if(Z&&P(Z)&&!k(U(Z))&&(!X||U(Z)===X)){let J=w(Z);return await TQ(J.id),J.id}let $=h(Q,m);if($&&N($))return $;return null}var p=new BQ;function tQ(Q,X){return Q?p.run(Q,X):X()}function _Q(){return p.getStore()??null}var _=new Set;function rQ(Q){_.delete(B(H(Q),"db.sqlite"))}async function TQ(Q){let X=H(Q),Z=B(X,"db.sqlite"),$=S(Z);if($&&_.has(Z))return{ok:!0,created:!1,migrated:!1};try{L(X,{recursive:!0});let{provisionDb:J}=await u().then(() => I),Y=await J(zQ(Q));return _.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 xQ}from"net";var c=4319;function EQ(Q,X,Z=400){return new Promise(($)=>{let J=xQ({host:Q,port:X}),Y=!1,G=(V)=>{if(Y)return;Y=!0,J.destroy(),$(V)};J.once("connect",()=>G(!0)),J.once("error",()=>G(!1)),J.setTimeout(Z,()=>G(!1))})}async function AQ(Q){for(let X of["127.0.0.1","::1"])if(await EQ(X,Q))return!1;return!0}async function QX(Q,X=20){for(let Z=Q;Z<Q+X;Z++)if(await AQ(Z))return Z;return Q}import{readFileSync as qQ}from"fs";import{join as RQ}from"path";function DQ(){try{return JSON.parse(qQ(RQ(K(),"server.json"),"utf8"))}catch{return null}}function l(){if(process.env.BEACON_URL)return process.env.BEACON_URL;return`http://localhost:${DQ()?.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=U(F(typeof Q.cwd==="string"?Q.cwd:void 0)),$=l(),J={"x-beacon-workspace":Z},Y={hookEventName:"PreToolUse"},G=Q?.permission_mode==="bypassPermissions",V=typeof Q.session_id==="string"?Q.session_id:"",M=await fetch(`${$}/api/scope-guard/check?claim=1&session=${encodeURIComponent(V)}&file=${encodeURIComponent(typeof X==="string"?X:"")}`,{headers:J}).catch(()=>null);if(M?.ok){let z=await M.json().catch(()=>null);if(!G&&z?.decision==="ask"&&typeof X==="string"&&X)Y.permissionDecision="ask",Y.permissionDecisionReason=z.reason??"This edit is outside the current plan's declared scope.";if(z?.additionalContext)Y.additionalContext=z.additionalContext}if(Y.permissionDecision||Y.additionalContext)process.stdout.write(JSON.stringify({hookSpecificOutput:Y}))}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 vZ=Object.defineProperty;var CZ=(Q)=>Q;function MZ(Q,Z){this[Q]=CZ.bind(null,Z)}var ZQ=(Q,Z)=>{for(var $ in Z)vZ(Q,$,{get:Z[$],enumerable:!0,configurable:!0,set:MZ.bind(Z,$)})};var v=(Q,Z)=>()=>(Q&&(Z=Q(Q=0)),Z);var m0=1500,p0=480000,c0=1800000,E=3600000,d0=3000;var OQ=()=>{};var zQ={};ZQ(zQ,{stripAgentsPointer:()=>IQ,removeRepoAssets:()=>EZ,installRefreshSkill:()=>wZ,installPlanSkill:()=>RZ,installInitSkill:()=>uZ,installExplainSkill:()=>TZ,installCodexRepoSkills:()=>gZ,ensureWorkflowDoc:()=>OZ,ensureMcp:()=>bZ,contextDocTargets:()=>VQ,auditRepo:()=>DZ,REFRESH_SKILL:()=>JQ,PLAN_SKILL:()=>DQ,INIT_SKILL:()=>$Q,EXPLAIN_SKILL:()=>EQ});import{existsSync as B,mkdirSync as w,readFileSync as x,rmSync as I,writeFileSync as H}from"fs";import{join as X}from"path";function uZ(Q){let Z=X(Q,".claude","skills","beacon-init");w(Z,{recursive:!0});let $=X(Z,"SKILL.md");return H($,$Q),$}function wZ(Q){let Z=X(Q,".claude","skills","beacon-refresh");w(Z,{recursive:!0});let $=X(Z,"SKILL.md");return H($,JQ),$}function RZ(Q){let Z=X(Q,".claude","skills","beacon-plan");w(Z,{recursive:!0});let $=X(Z,"SKILL.md");return H($,DQ),$}function TZ(Q){let Z=X(Q,".claude","skills","beacon-explain");w(Z,{recursive:!0});let $=X(Z,"SKILL.md");return H($,EQ),$}function gZ(Q){let Z=[];for(let $ of FZ){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 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 IQ(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 OZ(Q){let Z=new RegExp(`${f}[\\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
+ `)}IQ(Q)}function bZ(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<E)return J.timeout=E,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:E},H(Z,JSON.stringify($,null,2)+`
13
+ `),{path:Z,added:!0,updated:!1}}function DZ(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(f)}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 EZ(Q){let Z=[];for(let z of["beacon-init","beacon-refresh","beacon-db-design"]){let U=X(Q,".claude","skills",z);if(B(U))I(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))I(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)I(J,{force:!0});else H(J,JSON.stringify(z,null,2)+`
14
+ `)}}catch{}let Y=!1,V=new RegExp(`\\n?${f}[\\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())I(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
+ `,DQ=`---
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
- `,fQ=`---
162
+ `,EQ=`---
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
- `,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
+ `,FZ,f="<!-- beacon:workflow:start -->",YQ="<!-- beacon:workflow:end -->",bQ;var qQ=v(()=>{OQ();FZ=[{name:"beacon-init",body:()=>$Q},{name:"beacon-refresh",body:()=>JQ}];bQ=`${f}
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 IZ,readFileSync as C,rmSync as fZ,writeFileSync as y}from"fs";import{dirname as fQ,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 IZ(V,{withFileTypes:!0}))if(W.isDirectory())Y.push(G(V,W.name))}catch{}}$=Y}return null}function kQ(Q){return yQ(Q)!==null}function AZ(Q){return/[\\/]\.claude[\\/]plugins[\\/]/.test(Q)}function yZ(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(fQ(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 h(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(fQ(Q),{recursive:!0}),y(Q,V.endsWith(`
311
312
  `)?V:`${V}
312
313
  `)}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
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 T(Q,Z){return A(G(Q,Z,"SKILL.md"))}function c(Q,Z){let $=G(Q,Z);if(!A($))return!1;return fZ($,{recursive:!0,force:!0}),!0}var N,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(()=>{N=["beacon-init","beacon-refresh","beacon-plan","beacon-explain"]});import{mkdirSync as kZ,renameSync as LZ,rmSync as _Z,writeFileSync as SZ}from"fs";import{dirname as hZ}from"path";function d(Q,Z){kZ(hZ(Q),{recursive:!0});let $=`${Q}.tmp`;try{SZ($,Z),LZ($,Q)}catch(J){throw _Z($,{force:!0}),J}}function Q1(Q,Z,$=!1){d(Q,JSON.stringify(Z,null,$?2:void 0))}var _Q=()=>{};var nQ={};ZQ(nQ,{setupCodexAssets:()=>dZ,removeCodexMcp:()=>lQ,removeCodexArtifacts:()=>nZ,hasCodexMcp:()=>xQ,ensureCodexMcp:()=>dQ,codexMcpProblem:()=>cZ,codexDetected:()=>mQ,auditCodex:()=>lZ,CODEX_HOOKS:()=>t});import{readFileSync as s}from"fs";import{homedir as mZ}from"os";import{join as O}from"path";function SQ(){return process.env.HOME||process.env.USERPROFILE||mZ()}function mQ(){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 g(Q){try{return Bun.TOML.parse(Q)}catch{return null}}function xQ(){try{return Boolean(g(s(M(),"utf8"))?.mcp_servers?.beacon)}catch{return!1}}function cZ(){let Q="";try{Q=s(M(),"utf8")}catch{return null}let Z=g(Q);if(!Z)return`~/.codex/config.toml does not parse \u2014 ${F}`;if(Z.mcp_servers?.beacon)return null;if(/^\s*mcp_servers\s*=/m.test(Q))return`mcp_servers is an inline table \u2014 ${F}`;return null}function dQ(){let Q="",Z=!1;try{Q=s(M(),"utf8"),Z=!0}catch{}if(Z){let V=g(Q);if(!V)return{added:!1,error:`~/.codex/config.toml does not parse \u2014 ${F}`};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 ${F}`}}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+$+pZ;if(g(J)?.mcp_servers?.beacon?.command!=="beacon")return{added:!1,error:`could not safely append [mcp_servers.beacon] \u2014 ${F}`};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(g(Y)===null)return{removed:!1,skipped:!0};return d(M(),Y),{removed:!0}}async function dZ(){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 N){if(!T(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=R(l(),a);h(l(),a,hQ,k);let z=dQ();return{skillsAdded:V,hooksAdded:q,agentsMdBlockTouched:!W,mcp:z}}function lZ(){let Q={};for(let $ of N)Q[$]=T(n(),$);let Z={};for(let $ of t)Z[$.event]=_(jQ(),{event:$.event,command:$.command});return{detected:mQ(),skills:Q,hooks:Z,agentsMdBlock:R(l(),a),mcp:xQ()}}function nZ(){let Q=[];for(let Y of N)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 $=m(l(),a,hQ),J=lQ();return{skillsRemoved:Q,hooksRemoved:Z,agentsMdBlockRemoved:$,mcpRemoved:J.removed,mcpSkipped:J.skipped}}var BQ=()=>O(SQ(),".codex"),jQ=()=>O(BQ(),"hooks.json"),M=()=>O(BQ(),"config.toml"),l=()=>O(BQ(),"AGENTS.md"),n=()=>O(SQ(),".agents","skills"),a="<!-- beacon:global:start -->",hQ="<!-- beacon:global:end -->",t,HQ,pQ="# beacon:start (managed by Beacon \u2014 `beacon uninstall` removes this block)",cQ="# beacon:end",pZ,F="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."}];pZ=`${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:()=>K0});import{createClient as z0}from"@libsql/client";import{drizzle as q0}from"drizzle-orm/libsql";import{migrate as X0}from"drizzle-orm/libsql/migrator";import{readMigrationFiles as U0}from"drizzle-orm/migrator";import{dirname as CQ,join as W0}from"path";import{fileURLToPath as H0}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 G0(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(x0)){if(!await i(Q,Z))continue;let J=await G0(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 K0(Q,Z=j0){let $=z0({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=U0({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 X0(q0($),{migrationsFolder:Z}),await iQ($)>q)V=!0;return await N0($),{migrated:V}}finally{$.close()}}var B0,j0,x0;var QZ=v(async()=>{B0=CQ(CQ(CQ(H0(import.meta.url)))),j0=process.env.BEACON_MIGRATIONS_DIR||W0(B0,"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"]}});WQ();import{existsSync as aZ}from"fs";import{homedir as sZ}from"os";import{join as r}from"path";function tZ(){return process.env.HOME||process.env.USERPROFILE||sZ()}var o=()=>r(tZ(),".claude"),GQ=()=>r(o(),"skills"),NQ=()=>r(o(),"settings.json"),KQ=()=>r(o(),"CLAUDE.md"),PQ="<!-- beacon:global:start -->",sQ="<!-- beacon:global:end -->";var rZ=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:"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 oZ(Q,Z){return p(GQ(),Q,Z)}function tQ(Q){return T(GQ(),Q)}function iZ(Q){return c(GQ(),Q)}function eZ(Q){return L(NQ(),Q)}function Q0(Q){return _(NQ(),Q)}function Z0(Q){return S(NQ(),Q)}function $0(Q){h(KQ(),PQ,sQ,Q)}function rQ(){return R(KQ(),PQ)}function J0(){return m(KQ(),PQ,sQ)}function H1(){let Q={};for(let $ of N)Q[$]=tQ($);let Z={};for(let $ of vQ)Z[$.event]=Q0({event:$.event,command:$.command});return{homeExists:aZ(o()),skills:Q,hooks:Z,claudeMdBlock:rQ()}}async function Y0(){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 N){if(!tQ(z))V.push(z);oZ(z,Y[z])}let q=0;for(let z of vQ)if(eZ({event:z.event,matcher:z.matcher,command:z.command}))q++;let W=rQ();return $0(rZ),{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{V0()}catch{}Q={ok:!0,skipped:"plugin-present",skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1}}else try{Q={ok:!0,...await Y0()}}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 V0(){let Q=[];for(let J of N)if(iZ(J))Q.push(J);let Z=0;for(let J of vQ)if(Z0(J))Z++;let $=J0();return{skillsRemoved:Q,hooksRemoved:Z,claudeMdBlockRemoved:$}}import{AsyncLocalStorage as P0}from"async_hooks";import{spawnSync as v0}from"child_process";import{createHash as C0}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 M0,join as K,parse as u0,resolve as ZZ}from"path";function j(){return process.env.BEACON_HOME||K(JZ(),".beacon")}function RQ(){return K(j(),"workspaces.json")}function u(Q){return C0("sha256").update(Q).digest("hex").slice(0,12)}function YZ(Q=process.cwd()){let Z=v0("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 VZ(Q){let Z=ZZ(Q);return Z!==ZZ(JZ())&&Z!==u0(Z).root}function zZ(){return K(j(),"deleted.json")}function TQ(){try{let Q=JSON.parse(uQ(zZ(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function qZ(Q){b(j(),{recursive:!0}),wQ(zZ(),JSON.stringify(Q,null,2))}function XZ(Q){return TQ().includes(Q)}function T1(Q){let Z=TQ();if(!Z.includes(Q))qZ([...Z,Q])}function w0(Q){let Z=TQ();if(Z.includes(Q))qZ(Z.filter(($)=>$!==Q))}function e(Q){return K(j(),Q)}function R0(Q){return`file:${K(e(Q),"db.sqlite")}`}function D(){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 UZ(){return D().sort((Q,Z)=>Z.lastOpenedAt.localeCompare(Q.lastOpenedAt))}function P(Q){return D().find((Z)=>Z.id===Q)??null}function WZ(Q,Z,$=new Date().toISOString()){if(!VZ(Q))throw Error(`beacon: refusing to register a non-repo path as a workspace: ${Q}`);let J=u(Q);if(XZ(J))throw Error(`beacon: workspace ${J} (${Q}) was deleted \u2014 run \`beacon\` or /beacon-init to re-add it`);let Y=D(),V=Y.find((z)=>z.id===J),q={id:J,path:Q,name:Z||V?.name||M0(Q),lastOpenedAt:$},W=[q,...Y.filter((z)=>z.id!==J)];return b(e(J),{recursive:!0}),FQ(W),q}function F1(Q,Z){return w0(u(Q)),WZ(Q,Z)}function g1(Q,Z=new Date().toISOString()){let $=D(),J=$.find((Y)=>Y.id===Q);if(!J)return;J.lastOpenedAt=Z,FQ($)}function O1(Q){if(FQ(D().filter((Z)=>Z.id!==Q)),gQ()===Q)T0(UZ()[0]?.id??null)}function HZ(){return K(j(),"active")}function gQ(){try{return uQ(HZ(),"utf8").trim()||null}catch{return null}}function T0(Q){b(j(),{recursive:!0}),wQ(HZ(),Q??"")}function b1(){let Q=gQ();return Q?P(Q):null}function D1(){let Q=O0()??gQ();return Q?P(Q):null}function E1(Q){return P(Q)?.path??null}function I1(){return $Z(RQ())}var BZ="beacon_ws";function jZ(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 f1(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&P(Z))return Z;let $=jZ(Q,BZ);if($&&P($))return $;return F0()}function F0(){let Q=UZ();return Q.length===1?Q[0].id:null}var g0="x-beacon-workspace-path";async function A1(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&P(Z))return Z;let $=Q.headers.get(g0);if($&&VZ($)&&!XZ(u($))&&(!Z||u($)===Z)){let Y=WZ($);return await b0(Y.id),Y.id}let J=jZ(Q,BZ);if(J&&P(J))return J;return null}var xZ=new P0;function y1(Q,Z){return Q?xZ.run(Q,Z):Z()}function O0(){return xZ.getStore()??null}var MQ=new Set;function k1(Q){MQ.delete(K(e(Q),"db.sqlite"))}async function b0(Q){let Z=e(Q),$=K(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(R0(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 D0}from"net";var GZ=4319;function E0(Q,Z,$=400){return new Promise((J)=>{let Y=D0({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 I0(Q){for(let Z of["127.0.0.1","::1"])if(await E0(Z,Q))return!1;return!0}async function S1(Q,Z=20){for(let $=Q;$<Q+Z;$++)if(await I0($))return $;return Q}import{resolve as f0}from"path";var A0="*** Begin Patch",y0=/^\*\*\* (Update File|Add File|Move to): (.+)$/;function k0(Q){let Z=[];for(let $ of Q.split(`
353
+ `)){let J=y0.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(A0))continue;return k0(V).map((q)=>f0(Y,q))}return[]}import{readFileSync as L0}from"fs";import{join as _0}from"path";function S0(){try{return JSON.parse(L0(_0(j(),"server.json"),"utf8"))}catch{return null}}function KZ(){if(process.env.BEACON_URL)return process.env.BEACON_URL;return`http://localhost:${S0()?.port||process.env.PORT||GZ}`}await oQ();var PZ="";for await(let Q of process.stdin)PZ+=Q;try{let Q=JSON.parse(PZ||"{}"),Z=NZ(Q);if(Z.length){let $=u(YZ(typeof Q.cwd==="string"?Q.cwd:void 0));await fetch(`${KZ()}/api/map/touch-active`,{method:"POST",headers:{"content-type":"application/json","x-beacon-workspace":$},body:JSON.stringify({files:Z,session:typeof Q.session_id==="string"?Q.session_id:void 0})}).catch(()=>{})}}catch{}process.exit(0);