trybeacon 0.1.15 → 0.1.17

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 (298) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +5 -4
  3. package/.next/build-manifest.json +2 -2
  4. package/.next/prerender-manifest.json +3 -3
  5. package/.next/routes-manifest.json +14 -6
  6. package/.next/server/app/_global-error/page.js +3 -3
  7. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  8. package/.next/server/app/_global-error.html +1 -1
  9. package/.next/server/app/_global-error.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  14. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  15. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  16. package/.next/server/app/_not-found/page.js +2 -2
  17. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  18. package/.next/server/app/_not-found.html +1 -1
  19. package/.next/server/app/_not-found.rsc +2 -2
  20. package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  21. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  22. package/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  23. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  24. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  25. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  26. package/.next/server/app/api/board-annotations/[id]/route.js +1 -1
  27. package/.next/server/app/api/board-annotations/route.js +1 -1
  28. package/.next/server/app/api/bug-flags/[id]/route.js +1 -0
  29. package/.next/server/app/api/bug-flags/[id]/route.js.nft.json +1 -0
  30. package/.next/server/app/api/bug-flags/[id]/route_client-reference-manifest.js +1 -0
  31. package/.next/server/app/api/bug-flags/route.js +1 -0
  32. package/.next/server/app/api/{settings → bug-flags}/route.js.nft.json +1 -1
  33. package/.next/server/app/api/bug-flags/route_client-reference-manifest.js +1 -0
  34. package/.next/server/app/api/code-graph/position/route.js +1 -1
  35. package/.next/server/app/api/code-graph/route.js +1 -1
  36. package/.next/server/app/api/context/feature/route.js +1 -1
  37. package/.next/server/app/api/context/file/route.js +1 -1
  38. package/.next/server/app/api/context/route.js +1 -1
  39. package/.next/server/app/api/db/arrange/route.js +1 -1
  40. package/.next/server/app/api/db/backfill-access/route.js +1 -1
  41. package/.next/server/app/api/db/position/route.js +1 -1
  42. package/.next/server/app/api/db/reconcile-endpoints/route.js +1 -1
  43. package/.next/server/app/api/db/relations/[id]/route.js +1 -1
  44. package/.next/server/app/api/db/tables/[id]/route.js +1 -1
  45. package/.next/server/app/api/draft/approve/route.js +2 -2
  46. package/.next/server/app/api/draft/route.js +2 -2
  47. package/.next/server/app/api/draft/status/route.js +1 -1
  48. package/.next/server/app/api/edges/[id]/route.js +1 -1
  49. package/.next/server/app/api/edges/route.js +1 -1
  50. package/.next/server/app/api/endpoints/[id]/route.js +1 -1
  51. package/.next/server/app/api/entities/route.js +1 -1
  52. package/.next/server/app/api/feedback/[id]/route.js +1 -1
  53. package/.next/server/app/api/feedback/[id]/vote/route.js +1 -1
  54. package/.next/server/app/api/feedback/route.js +1 -1
  55. package/.next/server/app/api/ingest/route.js +2 -2
  56. package/.next/server/app/api/init/route.js +2 -2
  57. package/.next/server/app/api/map/describe/route.js +2 -2
  58. package/.next/server/app/api/map/files/route.js +1 -1
  59. package/.next/server/app/api/map/finish/route.js +1 -1
  60. package/.next/server/app/api/map/route.js +1 -1
  61. package/.next/server/app/api/map/start/route.js +1 -1
  62. package/.next/server/app/api/map/touch-active/route.js +1 -1
  63. package/.next/server/app/api/nodes/[id]/position/route.js +1 -1
  64. package/.next/server/app/api/nodes/[id]/route.js +1 -1
  65. package/.next/server/app/api/nodes/positions/route.js +1 -1
  66. package/.next/server/app/api/nodes/route.js +1 -1
  67. package/.next/server/app/api/nodes/subtasks/route.js +1 -1
  68. package/.next/server/app/api/notes/[id]/route.js +1 -1
  69. package/.next/server/app/api/notes/route.js +1 -1
  70. package/.next/server/app/api/open/route.js +1 -1
  71. package/.next/server/app/api/plan/annotations/route.js +3 -3
  72. package/.next/server/app/api/plan/approve/route.js +2 -2
  73. package/.next/server/app/api/plan/history/route.js +1 -1
  74. package/.next/server/app/api/plan/markdown/route.js +1 -1
  75. package/.next/server/app/api/plan/presence/route.js +1 -1
  76. package/.next/server/app/api/plan/route.js +1 -1
  77. package/.next/server/app/api/plan/verdict/route.js +2 -2
  78. package/.next/server/app/api/preferences/route.js +1 -1
  79. package/.next/server/app/api/reset/route.js +1 -1
  80. package/.next/server/app/api/stream/route.js +2 -2
  81. package/.next/server/app/api/version/route.js +1 -1
  82. package/.next/server/app/api/workspace/activate/route.js +1 -1
  83. package/.next/server/app/api/workspace/route.js +1 -1
  84. package/.next/server/app/apple-icon.png/route.js +1 -1
  85. package/.next/server/app/docs/page.js +2 -2
  86. package/.next/server/app/docs/page_client-reference-manifest.js +1 -1
  87. package/.next/server/app/docs.html +1 -1
  88. package/.next/server/app/docs.rsc +2 -2
  89. package/.next/server/app/docs.segments/_full.segment.rsc +2 -2
  90. package/.next/server/app/docs.segments/_head.segment.rsc +1 -1
  91. package/.next/server/app/docs.segments/_index.segment.rsc +2 -2
  92. package/.next/server/app/docs.segments/_tree.segment.rsc +2 -2
  93. package/.next/server/app/docs.segments/docs/__PAGE__.segment.rsc +1 -1
  94. package/.next/server/app/docs.segments/docs.segment.rsc +1 -1
  95. package/.next/server/app/feedback/page.js +2 -2
  96. package/.next/server/app/feedback/page_client-reference-manifest.js +1 -1
  97. package/.next/server/app/feedback.html +1 -1
  98. package/.next/server/app/feedback.rsc +2 -2
  99. package/.next/server/app/feedback.segments/_full.segment.rsc +2 -2
  100. package/.next/server/app/feedback.segments/_head.segment.rsc +1 -1
  101. package/.next/server/app/feedback.segments/_index.segment.rsc +2 -2
  102. package/.next/server/app/feedback.segments/_tree.segment.rsc +2 -2
  103. package/.next/server/app/feedback.segments/feedback/__PAGE__.segment.rsc +1 -1
  104. package/.next/server/app/feedback.segments/feedback.segment.rsc +1 -1
  105. package/.next/server/app/help/page.js +2 -2
  106. package/.next/server/app/help/page_client-reference-manifest.js +1 -1
  107. package/.next/server/app/help.html +1 -1
  108. package/.next/server/app/help.rsc +20 -19
  109. package/.next/server/app/help.segments/_full.segment.rsc +20 -19
  110. package/.next/server/app/help.segments/_head.segment.rsc +1 -1
  111. package/.next/server/app/help.segments/_index.segment.rsc +2 -2
  112. package/.next/server/app/help.segments/_tree.segment.rsc +2 -2
  113. package/.next/server/app/help.segments/help/__PAGE__.segment.rsc +1 -1
  114. package/.next/server/app/help.segments/help.segment.rsc +1 -1
  115. package/.next/server/app/icon.svg/route.js +1 -1
  116. package/.next/server/app/index.html +1 -1
  117. package/.next/server/app/index.rsc +3 -3
  118. package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  119. package/.next/server/app/index.segments/_full.segment.rsc +3 -3
  120. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  121. package/.next/server/app/index.segments/_index.segment.rsc +2 -2
  122. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  123. package/.next/server/app/map/page.js +2 -2
  124. package/.next/server/app/map/page.js.nft.json +1 -1
  125. package/.next/server/app/map/page_client-reference-manifest.js +1 -1
  126. package/.next/server/app/page.js +2 -2
  127. package/.next/server/app/page_client-reference-manifest.js +1 -1
  128. package/.next/server/app/plan/page.js +2 -2
  129. package/.next/server/app/plan/page.js.nft.json +1 -1
  130. package/.next/server/app/plan/page_client-reference-manifest.js +1 -1
  131. package/.next/server/app/settings/page.js +2 -2
  132. package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  133. package/.next/server/app-paths-manifest.json +5 -4
  134. package/.next/server/chunks/1130.js +1 -1
  135. package/.next/server/chunks/{3968.js → 2574.js} +2 -2
  136. package/.next/server/chunks/2933.js +1 -1
  137. package/.next/server/chunks/6962.js +1 -0
  138. package/.next/server/chunks/9683.js +1 -1
  139. package/.next/server/instrumentation.js +1 -1
  140. package/.next/server/middleware-build-manifest.js +1 -1
  141. package/.next/server/middleware.js +3 -3
  142. package/.next/server/pages/404.html +1 -1
  143. package/.next/server/pages/500.html +1 -1
  144. package/.next/server/server-reference-manifest.js +1 -1
  145. package/.next/server/server-reference-manifest.json +1 -1
  146. package/.next/static/{ct96P0zTV3e7YqJ2NLI_X → O43psSufYlBZeD2MfUpT5}/_buildManifest.js +1 -1
  147. package/.next/static/chunks/1152-ce3b96f2d3495ed8.js +1 -0
  148. package/.next/static/chunks/1202-dfeac8ec49693586.js +1 -0
  149. package/.next/static/chunks/app/_global-error/{page-3b9ad860c9e9f7cb.js → page-0fdd2f2bb2631a50.js} +1 -1
  150. package/.next/static/chunks/app/api/board-annotations/[id]/{route-3b9ad860c9e9f7cb.js → route-0fdd2f2bb2631a50.js} +1 -1
  151. package/.next/static/chunks/app/api/board-annotations/{route-3b9ad860c9e9f7cb.js → route-0fdd2f2bb2631a50.js} +1 -1
  152. package/.next/static/chunks/app/api/{code-graph/position/route-3b9ad860c9e9f7cb.js → bug-flags/[id]/route-0fdd2f2bb2631a50.js} +1 -1
  153. package/.next/static/chunks/app/api/bug-flags/route-0fdd2f2bb2631a50.js +1 -0
  154. package/.next/static/chunks/app/api/code-graph/position/route-0fdd2f2bb2631a50.js +1 -0
  155. package/.next/static/chunks/app/api/code-graph/route-0fdd2f2bb2631a50.js +1 -0
  156. package/.next/static/chunks/app/api/context/feature/route-0fdd2f2bb2631a50.js +1 -0
  157. package/.next/static/chunks/app/api/context/file/route-0fdd2f2bb2631a50.js +1 -0
  158. package/.next/static/chunks/app/api/context/route-0fdd2f2bb2631a50.js +1 -0
  159. package/.next/static/chunks/app/api/db/arrange/route-0fdd2f2bb2631a50.js +1 -0
  160. package/.next/static/chunks/app/api/db/backfill-access/route-0fdd2f2bb2631a50.js +1 -0
  161. package/.next/static/chunks/app/api/db/position/route-0fdd2f2bb2631a50.js +1 -0
  162. package/.next/static/chunks/app/api/db/reconcile-endpoints/route-0fdd2f2bb2631a50.js +1 -0
  163. package/.next/static/chunks/app/api/db/relations/[id]/route-0fdd2f2bb2631a50.js +1 -0
  164. package/.next/static/chunks/app/api/db/tables/[id]/route-0fdd2f2bb2631a50.js +1 -0
  165. package/.next/static/chunks/app/api/draft/approve/route-0fdd2f2bb2631a50.js +1 -0
  166. package/.next/static/chunks/app/api/draft/route-0fdd2f2bb2631a50.js +1 -0
  167. package/.next/static/chunks/app/api/draft/status/route-0fdd2f2bb2631a50.js +1 -0
  168. package/.next/static/chunks/app/api/edges/[id]/route-0fdd2f2bb2631a50.js +1 -0
  169. package/.next/static/chunks/app/api/edges/route-0fdd2f2bb2631a50.js +1 -0
  170. package/.next/static/chunks/app/api/endpoints/[id]/route-0fdd2f2bb2631a50.js +1 -0
  171. package/.next/static/chunks/app/api/entities/route-0fdd2f2bb2631a50.js +1 -0
  172. package/.next/static/chunks/app/api/feedback/[id]/route-0fdd2f2bb2631a50.js +1 -0
  173. package/.next/static/chunks/app/api/feedback/[id]/vote/route-0fdd2f2bb2631a50.js +1 -0
  174. package/.next/static/chunks/app/api/feedback/route-0fdd2f2bb2631a50.js +1 -0
  175. package/.next/static/chunks/app/api/ingest/route-0fdd2f2bb2631a50.js +1 -0
  176. package/.next/static/chunks/app/api/init/route-0fdd2f2bb2631a50.js +1 -0
  177. package/.next/static/chunks/app/api/map/describe/route-0fdd2f2bb2631a50.js +1 -0
  178. package/.next/static/chunks/app/api/map/files/route-0fdd2f2bb2631a50.js +1 -0
  179. package/.next/static/chunks/app/api/map/finish/route-0fdd2f2bb2631a50.js +1 -0
  180. package/.next/static/chunks/app/api/map/route-0fdd2f2bb2631a50.js +1 -0
  181. package/.next/static/chunks/app/api/map/start/route-0fdd2f2bb2631a50.js +1 -0
  182. package/.next/static/chunks/app/api/map/touch-active/route-0fdd2f2bb2631a50.js +1 -0
  183. package/.next/static/chunks/app/api/nodes/[id]/position/route-0fdd2f2bb2631a50.js +1 -0
  184. package/.next/static/chunks/app/api/nodes/[id]/route-0fdd2f2bb2631a50.js +1 -0
  185. package/.next/static/chunks/app/api/nodes/positions/route-0fdd2f2bb2631a50.js +1 -0
  186. package/.next/static/chunks/app/api/nodes/route-0fdd2f2bb2631a50.js +1 -0
  187. package/.next/static/chunks/app/api/nodes/subtasks/route-0fdd2f2bb2631a50.js +1 -0
  188. package/.next/static/chunks/app/api/notes/[id]/route-0fdd2f2bb2631a50.js +1 -0
  189. package/.next/static/chunks/app/api/notes/route-0fdd2f2bb2631a50.js +1 -0
  190. package/.next/static/chunks/app/api/open/route-0fdd2f2bb2631a50.js +1 -0
  191. package/.next/static/chunks/app/api/plan/annotations/route-0fdd2f2bb2631a50.js +1 -0
  192. package/.next/static/chunks/app/api/plan/approve/route-0fdd2f2bb2631a50.js +1 -0
  193. package/.next/static/chunks/app/api/plan/history/route-0fdd2f2bb2631a50.js +1 -0
  194. package/.next/static/chunks/app/api/plan/markdown/route-0fdd2f2bb2631a50.js +1 -0
  195. package/.next/static/chunks/app/api/plan/presence/route-0fdd2f2bb2631a50.js +1 -0
  196. package/.next/static/chunks/app/api/plan/route-0fdd2f2bb2631a50.js +1 -0
  197. package/.next/static/chunks/app/api/plan/verdict/route-0fdd2f2bb2631a50.js +1 -0
  198. package/.next/static/chunks/app/api/preferences/route-0fdd2f2bb2631a50.js +1 -0
  199. package/.next/static/chunks/app/api/reset/route-0fdd2f2bb2631a50.js +1 -0
  200. package/.next/static/chunks/app/api/stream/route-0fdd2f2bb2631a50.js +1 -0
  201. package/.next/static/chunks/app/api/version/route-0fdd2f2bb2631a50.js +1 -0
  202. package/.next/static/chunks/app/api/workspace/activate/route-0fdd2f2bb2631a50.js +1 -0
  203. package/.next/static/chunks/app/api/workspace/route-0fdd2f2bb2631a50.js +1 -0
  204. package/.next/static/chunks/app/map/{page-3fe31101c63d9668.js → page-ed40021c6ab84daf.js} +1 -1
  205. package/.next/static/chunks/app/page-2c4582b256e877c0.js +1 -0
  206. package/.next/static/chunks/app/plan/{page-51bc3f04374541b9.js → page-645f031f5db46170.js} +1 -1
  207. package/.next/static/chunks/next/dist/client/components/builtin/app-error-0fdd2f2bb2631a50.js +1 -0
  208. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-0fdd2f2bb2631a50.js +1 -0
  209. package/.next/static/chunks/next/dist/client/components/builtin/not-found-0fdd2f2bb2631a50.js +1 -0
  210. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-0fdd2f2bb2631a50.js +1 -0
  211. package/.next/static/css/f0c8ee0772c6d74d.css +1 -0
  212. package/.next/trace +37 -37
  213. package/.next/trace-build +1 -1
  214. package/.next/types/app/api/bug-flags/[id]/route.ts +351 -0
  215. package/.next/types/app/api/{settings → bug-flags}/route.ts +3 -3
  216. package/.next/types/routes.d.ts +3 -2
  217. package/.next/types/validator.ts +18 -9
  218. package/dist/bin/beacon.js +6 -6
  219. package/dist/bin/doctor.js +50 -34
  220. package/dist/bin/hook.js +49 -32
  221. package/dist/bin/mcp.js +56 -40
  222. package/dist/bin/plan.js +50 -34
  223. package/dist/bin/prompt.js +1 -1
  224. package/dist/bin/stop-hook.js +2 -2
  225. package/dist/bin/uninstall.js +50 -34
  226. package/dist/lib/assets.js +23 -20
  227. package/dist/lib/codex-install.js +242 -0
  228. package/dist/lib/global-install.js +48 -32
  229. package/drizzle/0002_square_firestar.sql +2 -0
  230. package/drizzle/0003_glorious_stick.sql +12 -0
  231. package/drizzle/0004_fair_namora.sql +1 -0
  232. package/drizzle/meta/0002_snapshot.json +1655 -0
  233. package/drizzle/meta/0003_snapshot.json +1737 -0
  234. package/drizzle/meta/0004_snapshot.json +1730 -0
  235. package/drizzle/meta/_journal.json +21 -0
  236. package/package.json +1 -2
  237. package/.next/server/app/api/settings/route.js +0 -1
  238. package/.next/server/app/api/settings/route_client-reference-manifest.js +0 -1
  239. package/.next/server/chunks/9159.js +0 -1
  240. package/.next/static/chunks/5354-31b73f8e3dfd92b7.js +0 -1
  241. package/.next/static/chunks/58-aec6c638db75ae0a.js +0 -1
  242. package/.next/static/chunks/app/api/code-graph/route-3b9ad860c9e9f7cb.js +0 -1
  243. package/.next/static/chunks/app/api/context/feature/route-3b9ad860c9e9f7cb.js +0 -1
  244. package/.next/static/chunks/app/api/context/file/route-3b9ad860c9e9f7cb.js +0 -1
  245. package/.next/static/chunks/app/api/context/route-3b9ad860c9e9f7cb.js +0 -1
  246. package/.next/static/chunks/app/api/db/arrange/route-3b9ad860c9e9f7cb.js +0 -1
  247. package/.next/static/chunks/app/api/db/backfill-access/route-3b9ad860c9e9f7cb.js +0 -1
  248. package/.next/static/chunks/app/api/db/position/route-3b9ad860c9e9f7cb.js +0 -1
  249. package/.next/static/chunks/app/api/db/reconcile-endpoints/route-3b9ad860c9e9f7cb.js +0 -1
  250. package/.next/static/chunks/app/api/db/relations/[id]/route-3b9ad860c9e9f7cb.js +0 -1
  251. package/.next/static/chunks/app/api/db/tables/[id]/route-3b9ad860c9e9f7cb.js +0 -1
  252. package/.next/static/chunks/app/api/draft/approve/route-3b9ad860c9e9f7cb.js +0 -1
  253. package/.next/static/chunks/app/api/draft/route-3b9ad860c9e9f7cb.js +0 -1
  254. package/.next/static/chunks/app/api/draft/status/route-3b9ad860c9e9f7cb.js +0 -1
  255. package/.next/static/chunks/app/api/edges/[id]/route-3b9ad860c9e9f7cb.js +0 -1
  256. package/.next/static/chunks/app/api/edges/route-3b9ad860c9e9f7cb.js +0 -1
  257. package/.next/static/chunks/app/api/endpoints/[id]/route-3b9ad860c9e9f7cb.js +0 -1
  258. package/.next/static/chunks/app/api/entities/route-3b9ad860c9e9f7cb.js +0 -1
  259. package/.next/static/chunks/app/api/feedback/[id]/route-3b9ad860c9e9f7cb.js +0 -1
  260. package/.next/static/chunks/app/api/feedback/[id]/vote/route-3b9ad860c9e9f7cb.js +0 -1
  261. package/.next/static/chunks/app/api/feedback/route-3b9ad860c9e9f7cb.js +0 -1
  262. package/.next/static/chunks/app/api/ingest/route-3b9ad860c9e9f7cb.js +0 -1
  263. package/.next/static/chunks/app/api/init/route-3b9ad860c9e9f7cb.js +0 -1
  264. package/.next/static/chunks/app/api/map/describe/route-3b9ad860c9e9f7cb.js +0 -1
  265. package/.next/static/chunks/app/api/map/files/route-3b9ad860c9e9f7cb.js +0 -1
  266. package/.next/static/chunks/app/api/map/finish/route-3b9ad860c9e9f7cb.js +0 -1
  267. package/.next/static/chunks/app/api/map/route-3b9ad860c9e9f7cb.js +0 -1
  268. package/.next/static/chunks/app/api/map/start/route-3b9ad860c9e9f7cb.js +0 -1
  269. package/.next/static/chunks/app/api/map/touch-active/route-3b9ad860c9e9f7cb.js +0 -1
  270. package/.next/static/chunks/app/api/nodes/[id]/position/route-3b9ad860c9e9f7cb.js +0 -1
  271. package/.next/static/chunks/app/api/nodes/[id]/route-3b9ad860c9e9f7cb.js +0 -1
  272. package/.next/static/chunks/app/api/nodes/positions/route-3b9ad860c9e9f7cb.js +0 -1
  273. package/.next/static/chunks/app/api/nodes/route-3b9ad860c9e9f7cb.js +0 -1
  274. package/.next/static/chunks/app/api/nodes/subtasks/route-3b9ad860c9e9f7cb.js +0 -1
  275. package/.next/static/chunks/app/api/notes/[id]/route-3b9ad860c9e9f7cb.js +0 -1
  276. package/.next/static/chunks/app/api/notes/route-3b9ad860c9e9f7cb.js +0 -1
  277. package/.next/static/chunks/app/api/open/route-3b9ad860c9e9f7cb.js +0 -1
  278. package/.next/static/chunks/app/api/plan/annotations/route-3b9ad860c9e9f7cb.js +0 -1
  279. package/.next/static/chunks/app/api/plan/approve/route-3b9ad860c9e9f7cb.js +0 -1
  280. package/.next/static/chunks/app/api/plan/history/route-3b9ad860c9e9f7cb.js +0 -1
  281. package/.next/static/chunks/app/api/plan/markdown/route-3b9ad860c9e9f7cb.js +0 -1
  282. package/.next/static/chunks/app/api/plan/presence/route-3b9ad860c9e9f7cb.js +0 -1
  283. package/.next/static/chunks/app/api/plan/route-3b9ad860c9e9f7cb.js +0 -1
  284. package/.next/static/chunks/app/api/plan/verdict/route-3b9ad860c9e9f7cb.js +0 -1
  285. package/.next/static/chunks/app/api/preferences/route-3b9ad860c9e9f7cb.js +0 -1
  286. package/.next/static/chunks/app/api/reset/route-3b9ad860c9e9f7cb.js +0 -1
  287. package/.next/static/chunks/app/api/settings/route-3b9ad860c9e9f7cb.js +0 -1
  288. package/.next/static/chunks/app/api/stream/route-3b9ad860c9e9f7cb.js +0 -1
  289. package/.next/static/chunks/app/api/version/route-3b9ad860c9e9f7cb.js +0 -1
  290. package/.next/static/chunks/app/api/workspace/activate/route-3b9ad860c9e9f7cb.js +0 -1
  291. package/.next/static/chunks/app/api/workspace/route-3b9ad860c9e9f7cb.js +0 -1
  292. package/.next/static/chunks/app/page-ccb55081f850db63.js +0 -1
  293. package/.next/static/chunks/next/dist/client/components/builtin/app-error-3b9ad860c9e9f7cb.js +0 -1
  294. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-3b9ad860c9e9f7cb.js +0 -1
  295. package/.next/static/chunks/next/dist/client/components/builtin/not-found-3b9ad860c9e9f7cb.js +0 -1
  296. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-3b9ad860c9e9f7cb.js +0 -1
  297. package/.next/static/css/0745ea0e6e3229f6.css +0 -1
  298. /package/.next/static/{ct96P0zTV3e7YqJ2NLI_X → O43psSufYlBZeD2MfUpT5}/_ssgManifest.js +0 -0
package/dist/bin/mcp.js CHANGED
@@ -1,21 +1,21 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- var S5=Object.defineProperty;var y5=($)=>$;function h5($,Q){this[$]=y5.bind(null,Q)}var e=($,Q)=>{for(var Z in Q)S5($,Z,{get:Q[Z],enumerable:!0,configurable:!0,set:h5.bind(Q,Z)})};var b0=($,Q)=>()=>($&&(Q=$($=0)),Q);var s0={};e(s0,{removeRepoAssets:()=>m5,installRefreshSkill:()=>g5,installPlanSkill:()=>f5,installInitSkill:()=>x5,ensureWorkflowDoc:()=>z5,ensureMcp:()=>u5,auditRepo:()=>b5,REFRESH_SKILL:()=>c0,PLAN_SKILL:()=>l0,INIT_SKILL:()=>p0});import{existsSync as N0,mkdirSync as K0,readFileSync as _,rmSync as j0,writeFileSync as L}from"fs";import{join as O}from"path";function x5($){let Q=O($,".claude","skills","beacon-init");K0(Q,{recursive:!0});let Z=O(Q,"SKILL.md");return L(Z,p0),Z}function g5($){let Q=O($,".claude","skills","beacon-refresh");K0(Q,{recursive:!0});let Z=O(Q,"SKILL.md");return L(Z,c0),Z}function f5($){let Q=O($,".claude","skills","beacon-plan");K0(Q,{recursive:!0});let Z=O(Q,"SKILL.md");return L(Z,l0),Z}function z5($){let Q=O($,"AGENTS.md"),Z="";try{Z=_(Q,"utf8")}catch{}let X=new RegExp(`${$0}[\\s\\S]*?${M0}`);Z=X.test(Z)?Z.replace(X,m0):`${Z.trim()}
3
+ var q9=Object.defineProperty;var w9=($)=>$;function C9($,Q){this[$]=w9.bind(null,Q)}var o=($,Q)=>{for(var Z in Q)q9($,Z,{get:Q[Z],enumerable:!0,configurable:!0,set:C9.bind(Q,Z)})};var f=($,Q)=>()=>($&&(Q=$($=0)),Q);var z0={};o(z0,{removeRepoAssets:()=>L9,installRefreshSkill:()=>O9,installPlanSkill:()=>F9,installInitSkill:()=>v9,installCodexRepoSkills:()=>D9,ensureWorkflowDoc:()=>A9,ensureMcp:()=>E9,auditRepo:()=>I9,REFRESH_SKILL:()=>x0,PLAN_SKILL:()=>C5,INIT_SKILL:()=>y0});import{existsSync as b,mkdirSync as W0,readFileSync as L,rmSync as H0,writeFileSync as I}from"fs";import{join as B}from"path";function v9($){let Q=B($,".claude","skills","beacon-init");W0(Q,{recursive:!0});let Z=B(Q,"SKILL.md");return I(Z,y0),Z}function O9($){let Q=B($,".claude","skills","beacon-refresh");W0(Q,{recursive:!0});let Z=B(Q,"SKILL.md");return I(Z,x0),Z}function F9($){let Q=B($,".claude","skills","beacon-plan");W0(Q,{recursive:!0});let Z=B(Q,"SKILL.md");return I(Z,C5),Z}function D9($){let Q=[];for(let Z of R9){let Y=B($,".agents","skills",Z.name);W0(Y,{recursive:!0});let X=B(Y,"SKILL.md");I(X,Z.body()),Q.push(X)}return Q}function A9($){let Q=B($,"AGENTS.md"),Z="";try{Z=L(Q,"utf8")}catch{}let Y=new RegExp(`${U0}[\\s\\S]*?${h0}`);Z=Y.test(Z)?Z.replace(Y,w5):`${Z.trim()}
4
4
 
5
- ${m0}
6
- `.trimStart(),L(Q,Z.endsWith(`
5
+ ${w5}
6
+ `.trimStart(),I(Q,Z.endsWith(`
7
7
  `)?Z:`${Z}
8
- `);let V=O($,"CLAUDE.md"),H="";try{H=_(V,"utf8")}catch{}if(!/@AGENTS\.md/.test(H))L(V,`${H?`${H.trim()}
8
+ `);let X=B($,"CLAUDE.md"),H="";try{H=L(X,"utf8")}catch{}if(!/@AGENTS\.md/.test(H))I(X,`${H?`${H.trim()}
9
9
 
10
10
  `:""}@AGENTS.md
11
- `)}function u5($){let Q=O($,".mcp.json"),Z={};try{Z=JSON.parse(_(Q,"utf8"))}catch{}if(Z.mcpServers=Z.mcpServers??{},Z.mcpServers.beacon)return{path:Q,added:!1};return Z.mcpServers.beacon={command:"beacon",args:["mcp"]},L(Q,JSON.stringify(Z,null,2)+`
12
- `),{path:Q,added:!0}}function b5($){let Q=O($,".mcp.json"),Z=!1;try{Z=!!JSON.parse(_(Q,"utf8")).mcpServers?.beacon}catch{}let X=!1;try{X=_(O($,"AGENTS.md"),"utf8").includes($0)}catch{}let V=!1;try{V=/@AGENTS\.md/.test(_(O($,"CLAUDE.md"),"utf8"))}catch{}return{repo:$,mcpRegistered:Z,agentsMdBlock:X,claudeMdImport:V,skills:{"beacon-init":N0(O($,".claude","skills","beacon-init","SKILL.md")),"beacon-refresh":N0(O($,".claude","skills","beacon-refresh","SKILL.md"))}}}function m5($){let Q=[];for(let K of["beacon-init","beacon-refresh","beacon-db-design"]){let C=O($,".claude","skills",K);if(N0(C))j0(C,{recursive:!0,force:!0}),Q.push(K)}let Z=!1,X=O($,".mcp.json");try{let K=JSON.parse(_(X,"utf8"));if(K.mcpServers?.beacon){if(delete K.mcpServers.beacon,Z=!0,K.mcpServers&&Object.keys(K.mcpServers).length===0)delete K.mcpServers;if(Object.keys(K).length===0)j0(X,{force:!0});else L(X,JSON.stringify(K,null,2)+`
13
- `)}}catch{}let V=!1,H=O($,"AGENTS.md");try{let K=_(H,"utf8"),C=new RegExp(`\\n?${$0}[\\s\\S]*?${M0}\\n?`);if(C.test(K)){let l=K.replace(C,`
11
+ `)}function E9($){let Q=B($,".mcp.json"),Z={};try{Z=JSON.parse(L(Q,"utf8"))}catch{}if(Z.mcpServers=Z.mcpServers??{},Z.mcpServers.beacon)return{path:Q,added:!1};return Z.mcpServers.beacon={command:"beacon",args:["mcp"]},I(Q,JSON.stringify(Z,null,2)+`
12
+ `),{path:Q,added:!0}}function I9($){let Q=B($,".mcp.json"),Z=!1;try{Z=!!JSON.parse(L(Q,"utf8")).mcpServers?.beacon}catch{}let Y=!1;try{Y=L(B($,"AGENTS.md"),"utf8").includes(U0)}catch{}let X=!1;try{X=/@AGENTS\.md/.test(L(B($,"CLAUDE.md"),"utf8"))}catch{}return{repo:$,mcpRegistered:Z,agentsMdBlock:Y,claudeMdImport:X,skills:{"beacon-init":b(B($,".claude","skills","beacon-init","SKILL.md")),"beacon-refresh":b(B($,".claude","skills","beacon-refresh","SKILL.md"))},codexSkills:{"beacon-init":b(B($,".agents","skills","beacon-init","SKILL.md")),"beacon-refresh":b(B($,".agents","skills","beacon-refresh","SKILL.md"))}}}function L9($){let Q=[];for(let U of["beacon-init","beacon-refresh","beacon-db-design"]){let w=B($,".claude","skills",U);if(b(w))H0(w,{recursive:!0,force:!0}),Q.push(U)}for(let U of["beacon-init","beacon-refresh"]){let w=B($,".agents","skills",U);if(b(w))H0(w,{recursive:!0,force:!0}),Q.push(`codex:${U}`)}let Z=!1,Y=B($,".mcp.json");try{let U=JSON.parse(L(Y,"utf8"));if(U.mcpServers?.beacon){if(delete U.mcpServers.beacon,Z=!0,U.mcpServers&&Object.keys(U.mcpServers).length===0)delete U.mcpServers;if(Object.keys(U).length===0)H0(Y,{force:!0});else I(Y,JSON.stringify(U,null,2)+`
13
+ `)}}catch{}let X=!1,H=B($,"AGENTS.md");try{let U=L(H,"utf8"),w=new RegExp(`\\n?${U0}[\\s\\S]*?${h0}\\n?`);if(w.test(U)){let s=U.replace(w,`
14
14
  `).replace(/\n{3,}/g,`
15
15
 
16
- `).trimStart();L(H,l.endsWith(`
17
- `)?l:`${l}
18
- `),V=!0}}catch{}let G=!1,N=O($,"CLAUDE.md");try{let K=_(N,"utf8"),C=K.replace(/^[ \t]*@AGENTS\.md[ \t]*\n?/m,"");if(C!==K){if(!C.trim())j0(N,{force:!0});else L(N,C);G=!0}}catch{}return{skillsRemoved:Q,mcpUnregistered:Z,agentsBlockRemoved:V,claudeImportRemoved:G}}var p0=`---
16
+ `).trimStart();I(H,s.endsWith(`
17
+ `)?s:`${s}
18
+ `),X=!0}}catch{}let W=!1,G=B($,"CLAUDE.md");try{let U=L(G,"utf8"),w=U.replace(/^[ \t]*@AGENTS\.md[ \t]*\n?/m,"");if(w!==U){if(!w.trim())H0(G,{force:!0});else I(G,w);W=!0}}catch{}return{skillsRemoved:Q,mcpUnregistered:Z,agentsBlockRemoved:X,claudeImportRemoved:W}}var y0=`---
19
19
  name: beacon-init
20
20
  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.
21
21
  ---
@@ -28,7 +28,7 @@ The user already has Beacon running. You're going to map this repository's archi
28
28
 
29
29
  A single \`beacon_init_persist\` MCP tool call with:
30
30
 
31
- - **components**: 8\u201325 main building blocks of this codebase. NOT every file. Group them by \`domain\` (short UPPERCASE: AUTH, API, DATA, UI, JOBS, INFRA, BILLING, SEARCH, \u2026). For each: a one-line technical \`role\`, a one-sentence plain-language \`plain\`, the few \`files\` that implement it (repo-relative), and \`depends\` listing other component titles it relies on. Use the dependency graph you can see in the source \u2014 files that import each other heavily usually belong together.
31
+ - **components**: 8\u201325 main building blocks of this codebase. NOT every file. Group them by \`domain\` (short UPPERCASE: AUTH, API, DATA, UI, JOBS, INFRA, BILLING, SEARCH, \u2026). For each: a one-line technical \`role\`, a one-sentence plain-language \`plain\`, the few \`files\` that implement it (repo-relative), and \`depends\` listing other component titles it relies on. Use the dependency graph you can see in the source \u2014 files that import each other heavily usually belong together. If you spot a bug or something worth investigating while reading a component's code, add \`bugs: [{ note }]\` to that component \u2014 it renders as a bug flag on the node (attributed to the agent). Only flag what you actually saw in the code; don't speculate.
32
32
  - **roadmap**: 3\u20136 BROAD strategic directions. Big-picture themes only \u2014 "Harden auth & security", "Add observability", "Scale the data layer", "Pay down test-coverage debt". NOT detailed tasks. NOT file-level. Each gets a short title and one-line \`why\`.
33
33
  - **overview**: one paragraph describing what this project is and its stack. This lands in AGENTS.md as the project intro.
34
34
  - **conventions**: 3\u20138 concrete rules a contributor MUST follow \u2014 build/test commands, where code goes, patterns, things easy to get wrong. Infer from actual files, not assumptions.
@@ -52,7 +52,7 @@ A single \`beacon_init_persist\` MCP tool call with:
52
52
  If \`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-init.
53
53
 
54
54
  After the tool returns, tell the user the counts (components / roadmap / tables / endpoints) and point them at the running Beacon panel.
55
- `,c0=`---
55
+ `,x0=`---
56
56
  name: beacon-refresh
57
57
  description: Re-survey the repo and update Beacon's architecture / schema / endpoints map after /beacon-init was already run \u2014 picks up new components, removed ones, schema changes, and new routes. Use when the user runs /beacon-refresh or asks to "refresh", "update", "re-sync", or "bring Beacon up to date" with the current code.
58
58
  ---
@@ -87,7 +87,7 @@ The one caveat: if the user manually edited an INIT-source node on the canvas (e
87
87
  - **~ changed**: COMPONENT_X (role expanded to cover Y)
88
88
  - **schema**: + 2 new tables (TableA, TableB); + 3 new endpoints; \u2212 1 deprecated endpoint
89
89
  No need to wait for confirmation \u2014 just show the diff so the user sees what's about to land.
90
- 5. **Call \`beacon_init_persist\`** ONCE with the refreshed full analysis (same shape as init: \`components\`, \`roadmap\`, \`overview\`, \`conventions\`, \`snapshot\`). It replaces all init-source nodes and regenerates \`AGENTS.md\`.
90
+ 5. **Call \`beacon_init_persist\`** ONCE with the refreshed full analysis (same shape as init: \`components\`, \`roadmap\`, \`overview\`, \`conventions\`, \`snapshot\`). It replaces all init-source nodes and regenerates \`AGENTS.md\`. Bug flags already on a component survive the refresh (they're carried over by title); add \`bugs: [{ note }]\` for anything NEW you found worth investigating \u2014 identical open flags are not duplicated.
91
91
 
92
92
  ## What you should NOT do
93
93
 
@@ -99,7 +99,7 @@ The one caveat: if the user manually edited an INIT-source node on the canvas (e
99
99
  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.
100
100
 
101
101
  After the tool returns, report the final counts plus a one-line summary of the diff you surfaced.
102
- `,l0=`---
102
+ `,C5=`---
103
103
  name: beacon-plan
104
104
  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.
105
105
  ---
@@ -138,9 +138,10 @@ If it returns feedback, revise and call it again.
138
138
  - **Anything else** (a code-change plan, a mixed plan, a "how should I approach X") \u2192 use
139
139
  \`beacon_present_plan\` with markdown so the full reasoning shows on /plan.
140
140
 
141
- If \`beacon_present_plan\` isn't available, the panel isn't wired here \u2014 fall back to presenting via
142
- ExitPlanMode with the same \`\`\`beacon block, or tell the user to run \`beacon\` in this repo once.
143
- `,$0="<!-- beacon:workflow:start -->",M0="<!-- beacon:workflow:end -->",m0;var d0=b0(()=>{m0=`${$0}
141
+ If \`beacon_present_plan\` isn't available, the panel isn't wired here \u2014 fall back to ExitPlanMode
142
+ with the same \`\`\`beacon block (Claude Code only; Codex has no ExitPlanMode), or tell the user to
143
+ run \`beacon\` in this repo once.
144
+ `,R9,U0="<!-- beacon:workflow:start -->",h0="<!-- beacon:workflow:end -->",w5;var S0=f(()=>{R9=[{name:"beacon-init",body:()=>y0},{name:"beacon-refresh",body:()=>x0}];w5=`${U0}
144
145
  ## Beacon \u2014 feature workflow
145
146
 
146
147
  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:
@@ -171,6 +172,8 @@ When listing features, give each \`dependsOn: ["Other feature title", \u2026]\`
171
172
 
172
173
  ### 2b. Presenting a plan in plan mode (ExitPlanMode)
173
174
 
175
+ In Codex (which has no ExitPlanMode), always present plans via \`beacon_present_plan\` / \`beacon_propose_plan\` instead \u2014 this section applies to Claude Code's plan mode only.
176
+
174
177
  When you present a plan via ExitPlanMode (not \`beacon_propose_plan\`) and it proposes DB tables/relations/endpoints or roadmap features, embed ONE fenced \`\`\`beacon code block of JSON in the plan \u2014 the same shapes \`beacon_propose_plan\` accepts:
175
178
 
176
179
  \`\`\`beacon
@@ -183,7 +186,7 @@ Beacon extracts it deterministically and **strips the block from the prose** (it
183
186
 
184
187
  ### 3. At the end, register the work \u2014 in ONE call
185
188
 
186
- Call \`beacon_describe_feature\` **ONCE** with a \`features\` array \u2014 one entry per feature the plan created \u2014 each with the files you touched and a short markdown description. This flips each one to **Done** and keeps \`beacon_context_for_feature\` accurate for the next session.
189
+ Call \`beacon_describe_feature\` **ONCE** with a \`features\` array \u2014 one entry per feature the plan created \u2014 each with the files you touched and a short markdown description. This flips each one to **Done** \u2014 including its sub-tasks (the cascade completes every PENDING/IN_PROGRESS child; a sub-task you did NOT finish must be set BLOCKED or CANCELLED before registering, so it survives visibly) \u2014 and keeps \`beacon_context_for_feature\` accurate for the next session.
187
190
 
188
191
  Key each entry by its node \`id\`: the ids are handed back to you when the plan is approved (in the approval message / additionalContext), so you don't fuzzy-match titles or pay a disambiguation round-trip. If you don't have an id, \`title\` still works.
189
192
 
@@ -192,7 +195,18 @@ Register them all in that single batched call. If a plan added five features, th
192
195
  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.
193
196
 
194
197
  Pull raw planning data anytime with \`beacon_entities\` (features / architecture / tables / endpoints).
195
- ${M0}`});var e0={};e(e0,{provisionDb:()=>N9});import{createClient as $9}from"@libsql/client";import{drizzle as Q9}from"drizzle-orm/libsql";import{migrate as Z9}from"drizzle-orm/libsql/migrator";import{readMigrationFiles as J9}from"drizzle-orm/migrator";import{dirname as D0,join as X9}from"path";import{fileURLToPath as Y9}from"url";async function X0($,Q){return(await $.execute({sql:"SELECT 1 FROM sqlite_master WHERE type='table' AND name = ?",args:[Q]})).rows.length>0}async function B9($,Q){let Z=await $.execute(`PRAGMA table_info("${Q}")`);return new Set(Z.rows.map((X)=>String(X.name)))}async function t0($){if(!await X0($,"__drizzle_migrations"))return 0;let Q=await $.execute('SELECT count(*) AS n FROM "__drizzle_migrations"');return Number(Q.rows[0]?.n??0)}async function j9($){for(let[Q,Z]of Object.entries(G9)){if(!await X0($,Q))continue;let X=await B9($,Q);for(let V of Z){if(!X.has(V))continue;await $.execute(`UPDATE "${Q}" SET "${V}" = CAST((julianday("${V}") - 2440587.5) * 86400000 AS INTEGER) WHERE typeof("${V}") = 'text'`)}}}async function N9($,Q=H9){let Z=$9({url:$});try{await Z.execute("PRAGMA journal_mode = WAL;"),await Z.execute("PRAGMA foreign_keys = ON;");let X=await X0(Z,"__drizzle_migrations"),V=await X0(Z,"Node"),H=!1;if(V&&!X){let N=J9({migrationsFolder:Q})[0];if(N)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:[N.hash,N.folderMillis]}),H=!0}let G=await t0(Z);if(await Z9(Q9(Z),{migrationsFolder:Q}),await t0(Z)>G)H=!0;return await j9(Z),{migrated:H}}finally{Z.close()}}var V9,H9,G9;var $5=b0(async()=>{V9=D0(D0(D0(Y9(import.meta.url)))),H9=process.env.BEACON_MIGRATIONS_DIR||X9(V9,"drizzle"),G9={Node:["createdAt","updatedAt"],Note:["createdAt","updatedAt"],DbTable:["createdAt","updatedAt"],Endpoint:["createdAt","updatedAt"],DraftTable:["createdAt"],SyncState:["codeGraphSyncedAt","updatedAt"],AppSetting:["updatedAt"],ProjectMeta:["updatedAt"],CodeFile:["updatedAt"]}});import{existsSync as U0,mkdirSync as P0,readFileSync as Z0,rmSync as p5,writeFileSync as J0}from"fs";import{homedir as c5}from"os";import{join as T}from"path";function l5(){return process.env.HOME||process.env.USERPROFILE||c5()}var u=()=>T(l5(),".claude"),O0=()=>T(u(),"skills"),o0=()=>T(u(),"settings.json"),s=()=>T(u(),"CLAUDE.md"),Q0="<!-- beacon:global:start -->",W0="<!-- beacon:global:end -->",C0=["beacon-init","beacon-refresh","beacon-plan"],w0=[{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."}],s5=`## Beacon (visual planning panel)
198
+ ${h0}`});import{existsSync as v5,mkdirSync as u0,readFileSync as G0,rmSync as T9,writeFileSync as P0}from"fs";import{dirname as O5,join as j0}from"path";function f0($){try{return JSON.parse(G0($,"utf8"))}catch{return{}}}function F5($,Q){u0(O5($),{recursive:!0}),P0($,JSON.stringify(Q,null,2)+`
199
+ `)}function B0($,Q){let Z=f0($);Z.hooks=Z.hooks??{},Z.hooks[Q.event]=Z.hooks[Q.event]??[];let Y=Z.hooks[Q.event];if(Y.some((H)=>H.matcher===Q.matcher&&H.hooks?.some((W)=>W.command===Q.command)))return!1;return Y.push({matcher:Q.matcher,hooks:[{type:"command",command:Q.command}]}),F5($,Z),!0}function K0($,Q){return(f0($).hooks?.[Q.event]??[]).some((X)=>X.hooks?.some((H)=>H.command===Q.command))}function N0($,Q){let Z=f0($),Y=Z.hooks?.[Q.event];if(!Y)return!1;let X=!1,H=Y.map((W)=>{let G=W.hooks?.length??0,U=(W.hooks??[]).filter((w)=>w.command!==Q.command);if(U.length!==G)X=!0;return{...W,hooks:U}}).filter((W)=>(W.hooks??[]).length>0);if(!X)return!1;if(H.length)Z.hooks[Q.event]=H;else delete Z.hooks[Q.event];if(Z.hooks&&Object.keys(Z.hooks).length===0)delete Z.hooks;return F5($,Z),!0}function M0($,Q,Z,Y){let X=`${Q}
200
+ ${Y.trim()}
201
+ ${Z}`,H="";try{H=G0($,"utf8")}catch{}let W=new RegExp(`${Q}[\\s\\S]*?${Z}`);H=W.test(H)?H.replace(W,X):H.trim()?`${H.trim()}
202
+
203
+ ${X}
204
+ `:`${X}
205
+ `,u0(O5($),{recursive:!0}),P0($,H.endsWith(`
206
+ `)?H:`${H}
207
+ `)}function n($,Q){try{return G0($,"utf8").includes(Q)}catch{return!1}}function q0($,Q,Z){let Y="";try{Y=G0($,"utf8")}catch{return!1}let X=new RegExp(`${Q}[\\s\\S]*?${Z}\\n?`);if(!X.test(Y))return!1;let H=Y.replace(X,"").replace(/\n{3,}/g,`
208
+
209
+ `).trimStart();return P0($,H),!0}function w0($,Q,Z){let Y=j0($,Q);u0(Y,{recursive:!0});let X=j0(Y,"SKILL.md");return P0(X,Z),X}function a($,Q){return v5(j0($,Q,"SKILL.md"))}function C0($,Q){let Z=j0($,Q);if(!v5(Z))return!1;return T9(Z,{recursive:!0,force:!0}),!0}var b0=()=>{};import{mkdirSync as _9,renameSync as k9,rmSync as g9,writeFileSync as y9}from"fs";import{dirname as x9}from"path";function m0($,Q){_9(x9($),{recursive:!0});let Z=`${$}.tmp`;try{y9(Z,Q),k9(Z,$)}catch(Y){throw g9(Z,{force:!0}),Y}}var R5=()=>{};import{existsSync as h9}from"fs";import{homedir as z9}from"os";import{join as v0}from"path";function S9(){return process.env.HOME||process.env.USERPROFILE||z9()}function u9($,Q){return w0(p0(),$,Q)}function I5($){return a(p0(),$)}function f9($){return C0(p0(),$)}function b9($){return B0(c0(),$)}function m9($){return K0(c0(),$)}function p9($){return N0(c0(),$)}function c9($){M0(l0(),d0,E5,$)}function L5(){return n(l0(),d0)}function l9(){return q0(l0(),d0,E5)}function KQ(){let $={};for(let Z of g)$[Z]=I5(Z);let Q={};for(let Z of s0)Q[Z.event]=m9({event:Z.event,command:Z.command});return{homeExists:h9(O0()),skills:$,hooks:Q,claudeMdBlock:L5()}}async function d9(){let{INIT_SKILL:$,REFRESH_SKILL:Q,PLAN_SKILL:Z}=await Promise.resolve().then(() => (S0(),z0)),Y={"beacon-init":$,"beacon-refresh":Q,"beacon-plan":Z},X=[];for(let G of g){if(!I5(G))X.push(G);u9(G,Y[G])}let H=0;for(let G of s0)if(b9({event:G.event,matcher:G.matcher,command:G.command}))H++;let W=L5();return c9(o0),{skillsAdded:X,hooksAdded:H,claudeMdBlockTouched:!W}}async function T5(){let $;try{$={ok:!0,...await d9()}}catch(Q){$={ok:!1,error:Q instanceof Error?Q.message:String(Q),skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1}}try{let Q=await Promise.resolve().then(() => (A5(),D5));if(Q.codexDetected())$.codex={ok:!0,...await Q.setupCodexAssets()}}catch(Q){$.codex={ok:!1,error:Q instanceof Error?Q.message:String(Q),skillsAdded:[],hooksAdded:0,agentsMdBlockTouched:!1,mcp:{added:!1}}}return $}function NQ(){let $=[];for(let Y of g)if(f9(Y))$.push(Y);let Q=0;for(let Y of s0)if(p9(Y))Q++;let Z=l9();return{skillsRemoved:$,hooksRemoved:Q,claudeMdBlockRemoved:Z}}var O0=()=>v0(S9(),".claude"),p0=()=>v0(O0(),"skills"),c0=()=>v0(O0(),"settings.json"),l0=()=>v0(O0(),"CLAUDE.md"),d0="<!-- beacon:global:start -->",E5="<!-- beacon:global:end -->",g,s0,o0=`## Beacon (visual planning panel)
196
210
 
197
211
  This machine has Beacon installed \u2014 a local visual planning surface for the terminal-side
198
212
  agent. Beacon proposes feature plans (roadmap features + DB schema + endpoints) via MCP,
@@ -213,37 +227,39 @@ the user reviews on a canvas at /plan, and feedback flows back as the next round
213
227
  Feedback bundles inline annotations on the markdown PLUS any edits the user made directly
214
228
  on the /map and /db boards (added features, attached subtasks, edited columns, new
215
229
  endpoints). Treat board edits as the user's revision intent \u2014 re-propose matching them
216
- verbatim. Do NOT implement until the tool returns approval.`;function d5($,Q){let Z=T(O0(),$);P0(Z,{recursive:!0});let X=T(Z,"SKILL.md");return J0(X,Q),X}function n0($){return U0(T(O0(),$,"SKILL.md"))}function o5($){let Q=T(O0(),$);if(!U0(Q))return!1;return p5(Q,{recursive:!0,force:!0}),!0}function q0(){try{return JSON.parse(Z0(o0(),"utf8"))}catch{return{}}}function a0($){P0(u(),{recursive:!0}),J0(o0(),JSON.stringify($,null,2)+`
217
- `)}function n5($){let Q=q0();Q.hooks=Q.hooks??{},Q.hooks[$.event]=Q.hooks[$.event]??[];let Z=Q.hooks[$.event];if(Z.some((V)=>V.matcher===$.matcher&&V.hooks?.some((H)=>H.command===$.command)))return!1;return Z.push({matcher:$.matcher,hooks:[{type:"command",command:$.command}]}),a0(Q),!0}function a5($){return(q0().hooks?.[$.event]??[]).some((X)=>X.hooks?.some((V)=>V.command===$.command))}function r5($){let Q=q0(),Z=Q.hooks?.[$.event];if(!Z)return!1;let X=!1,V=Z.map((H)=>{let G=H.hooks?.length??0,N=(H.hooks??[]).filter((K)=>K.command!==$.command);if(N.length!==G)X=!0;return{...H,hooks:N}}).filter((H)=>(H.hooks??[]).length>0);if(!X)return!1;if(V.length)Q.hooks[$.event]=V;else delete Q.hooks[$.event];if(Q.hooks&&Object.keys(Q.hooks).length===0)delete Q.hooks;return a0(Q),!0}function i5($){let Q=`${Q0}
218
- ${$.trim()}
219
- ${W0}`,Z="";try{Z=Z0(s(),"utf8")}catch{}let X=new RegExp(`${Q0}[\\s\\S]*?${W0}`);Z=X.test(Z)?Z.replace(X,Q):Z.trim()?`${Z.trim()}
220
-
221
- ${Q}
222
- `:`${Q}
223
- `,P0(u(),{recursive:!0}),J0(s(),Z.endsWith(`
224
- `)?Z:`${Z}
225
- `)}function r0(){try{return Z0(s(),"utf8").includes(Q0)}catch{return!1}}function t5(){let $="";try{$=Z0(s(),"utf8")}catch{return!1}let Q=new RegExp(`${Q0}[\\s\\S]*?${W0}\\n?`);if(!Q.test($))return!1;let Z=$.replace(Q,"").replace(/\n{3,}/g,`
230
+ verbatim. Do NOT implement until the tool returns approval.`;var n0=f(()=>{b0();g=["beacon-init","beacon-refresh","beacon-plan"],s0=[{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."}]});var D5={};o(D5,{setupCodexAssets:()=>a9,removeCodexMcp:()=>z5,removeCodexArtifacts:()=>i9,hasCodexMcp:()=>t0,ensureCodexMcp:()=>h5,codexMcpProblem:()=>n9,codexDetected:()=>g5,auditCodex:()=>r9,CODEX_HOOKS:()=>E0});import{readFileSync as A0}from"fs";import{homedir as s9}from"os";import{join as t}from"path";function _5(){return process.env.HOME||process.env.USERPROFILE||s9()}function g5(){if(process.env.BEACON_CODEX==="1")return!0;if(process.env.BEACON_CODEX==="0")return!1;if(a0===void 0)a0=Bun.which("codex")!==null;return a0}function i($){try{return Bun.TOML.parse($)}catch{return null}}function t0(){try{return Boolean(i(A0(m(),"utf8"))?.mcp_servers?.beacon)}catch{return!1}}function n9(){let $="";try{$=A0(m(),"utf8")}catch{return null}let Q=i($);if(!Q)return`~/.codex/config.toml does not parse \u2014 ${r}`;if(Q.mcp_servers?.beacon)return null;if(/^\s*mcp_servers\s*=/m.test($))return`mcp_servers is an inline table \u2014 ${r}`;return null}function h5(){let $="",Q=!1;try{$=A0(m(),"utf8"),Q=!0}catch{}if(Q){let H=i($);if(!H)return{added:!1,error:`~/.codex/config.toml does not parse \u2014 ${r}`};if(H.mcp_servers?.beacon)return{added:!1};if(/^\s*mcp_servers\s*=/m.test($))return{added:!1,error:`mcp_servers is an inline table \u2014 ${r}`}}let Z=!$?"":$.endsWith(`
231
+ `)?`
232
+ `:`
233
+
234
+ `,Y=$+Z+o9;if(i(Y)?.mcp_servers?.beacon?.command!=="beacon")return{added:!1,error:`could not safely append [mcp_servers.beacon] \u2014 ${r}`};return m0(m(),Y),{added:!0}}function z5(){let $="";try{$=A0(m(),"utf8")}catch{return{removed:!1}}let Q=$.split(`
235
+ `),Z=Q.indexOf(y5);if(Z===-1)return{removed:!1,skipped:t0()};let Y=Q.indexOf(x5,Z);if(Y===-1)return{removed:!1,skipped:!0};Q.splice(Z,Y-Z+1);let X=Q.join(`
236
+ `).replace(/\n{3,}/g,`
226
237
 
227
- `).trimStart();return J0(s(),Z),!0}function G$(){let $={};for(let Z of C0)$[Z]=n0(Z);let Q={};for(let Z of w0)Q[Z.event]=a5({event:Z.event,command:Z.command});return{homeExists:U0(u()),skills:$,hooks:Q,claudeMdBlock:r0()}}async function e5(){let{INIT_SKILL:$,REFRESH_SKILL:Q,PLAN_SKILL:Z}=await Promise.resolve().then(() => (d0(),s0)),X={"beacon-init":$,"beacon-refresh":Q,"beacon-plan":Z},V=[];for(let N of C0){if(!n0(N))V.push(N);d5(N,X[N])}let H=0;for(let N of w0)if(n5({event:N.event,matcher:N.matcher,command:N.command}))H++;let G=r0();return i5(s5),{skillsAdded:V,hooksAdded:H,claudeMdBlockTouched:!G}}async function i0(){try{return{ok:!0,...await e5()}}catch($){return{ok:!1,error:$ instanceof Error?$.message:String($),skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1}}}function B$(){let $=[];for(let X of C0)if(o5(X))$.push(X);let Q=0;for(let X of w0)if(r5(X))Q++;let Z=t5();return{skillsRemoved:$,hooksRemoved:Q,claudeMdBlockRemoved:Z}}import{AsyncLocalStorage as K9}from"async_hooks";import{spawnSync as M9}from"child_process";import{createHash as W9}from"crypto";import{existsSync as Z5,mkdirSync as Y0,readFileSync as J5,writeFileSync as X5}from"fs";import{homedir as U9}from"os";import{basename as P9,join as b}from"path";function d(){return process.env.BEACON_HOME||b(U9(),".beacon")}function F0(){return b(d(),"workspaces.json")}function V0($){return W9("sha256").update($).digest("hex").slice(0,12)}function Y5($=process.cwd()){let Q=M9("git",["rev-parse","--show-toplevel"],{cwd:$,stdio:["ignore","pipe","ignore"]});if(Q.status===0){let Z=Q.stdout?.toString().trim();if(Z)return Z}return $}function v0($){return b(d(),$)}function A0($){return`file:${b(v0($),"db.sqlite")}`}function o(){try{let $=JSON.parse(J5(F0(),"utf8"));return Array.isArray($)?$:[]}catch{return[]}}function R0($){Y0(d(),{recursive:!0}),X5(F0(),JSON.stringify($,null,2))}function O9(){return o().sort(($,Q)=>Q.lastOpenedAt.localeCompare($.lastOpenedAt))}function y($){return o().find((Q)=>Q.id===$)??null}function E0($,Q,Z=new Date().toISOString()){let X=V0($),V=o(),H=V.find((K)=>K.id===X),G={id:X,path:$,name:Q||H?.name||P9($),lastOpenedAt:Z},N=[G,...V.filter((K)=>K.id!==X)];return Y0(v0(X),{recursive:!0}),R0(N),G}function v$($,Q=new Date().toISOString()){let Z=o(),X=Z.find((V)=>V.id===$);if(!X)return;X.lastOpenedAt=Q,R0(Z)}function A$($){if(R0(o().filter((Q)=>Q.id!==$)),n()===$)C9(O9()[0]?.id??null)}function V5(){return b(d(),"active")}function n(){try{return J5(V5(),"utf8").trim()||null}catch{return null}}function C9($){Y0(d(),{recursive:!0}),X5(V5(),$??"")}function R$(){let $=n();return $?y($):null}function E$(){let $=L0()??n();return $?y($):null}function _$($){return y($)?.path??null}function L$(){return Z5(F0())}var H5="beacon_ws";function G5($,Q){let Z=$.headers.get("cookie");if(!Z)return null;for(let X of Z.split(";")){let V=X.indexOf("=");if(V===-1)continue;if(X.slice(0,V).trim()===Q)return decodeURIComponent(X.slice(V+1).trim())}return null}function I$($){let Q=$.headers.get("x-beacon-workspace");if(Q&&y(Q))return Q;let Z=G5($,H5);if(Z&&y(Z))return Z;return null}var _0="x-beacon-workspace-path";async function k$($){let Q=$.headers.get("x-beacon-workspace");if(Q&&y(Q))return Q;let Z=$.headers.get(_0);if(Z&&(!Q||V0(Z)===Q)){let V=E0(Z);return await I0(V.id),V.id}let X=G5($,H5);if(X&&y(X))return X;return null}var B5=new K9;function w9($,Q){return $?B5.run($,Q):Q()}function L0(){return B5.getStore()??null}var Q5=new Set;async function I0($){let Q=v0($),Z=b(Q,"db.sqlite"),X=Z5(Z);if(X&&Q5.has(Z))return{ok:!0,created:!1,migrated:!1};try{Y0(Q,{recursive:!0});let{provisionDb:V}=await $5().then(() => e0),H=await V(A0($));return Q5.add(Z),{ok:!0,created:!X,migrated:X&&H.migrated}}catch(V){return{ok:!1,created:!1,migrated:!1,error:V instanceof Error?V.message:String(V)}}}import{McpServer as $$,ResourceTemplate as f0}from"@modelcontextprotocol/sdk/server/mcp.js";import{StdioServerTransport as Q$}from"@modelcontextprotocol/sdk/server/stdio.js";import{z as J}from"zod";import{z as B}from"zod";var q9=new Set(["GET","HEAD","OPTIONS"]);function j5($){return q9.has($.trim().toUpperCase())?"read":"write"}var D9=B.preprocess(($)=>{if(typeof $==="string"){let[Q,...Z]=$.trim().split(/\s+/);return{name:Q,type:Z.join(" ")||"text"}}return $},B.object({name:B.string().trim().min(1),type:B.string().trim().min(1),isPk:B.boolean().optional(),isFk:B.boolean().optional(),nullable:B.boolean().optional(),note:B.string().nullish()})),N5=B.object({name:B.string().trim().min(1),domain:B.string().nullish(),description:B.string().nullish(),columns:B.array(D9).default([])}),K5=B.object({fromTable:B.string(),fromColumn:B.string(),toTable:B.string(),toColumn:B.string(),label:B.string().nullish()}),M5=B.object({method:B.string().trim().min(1),path:B.string().trim().min(1),domain:B.string().nullish(),description:B.string().nullish(),uses:B.array(B.object({table:B.string().trim().min(1),access:B.string().optional()})).default([])}).transform(($)=>({...$,uses:$.uses.map((Q)=>({...Q,access:Q.access??j5($.method)}))})),x$=B.object({tables:B.array(N5).default([]),relations:B.array(K5).default([]),endpoints:B.array(M5).default([])});import{z as R}from"zod";import{and as ZQ,eq as JQ,inArray as XQ}from"drizzle-orm";import{drizzle as l9}from"drizzle-orm/libsql";import{createClient as s9}from"@libsql/client";var k0={};e(k0,{tag:()=>m,syncState:()=>E9,projectMeta:()=>L9,note:()=>A9,nodeTags:()=>h,nodeFile:()=>a,node:()=>U,endpointTable:()=>g,endpoint:()=>p,edge:()=>S,draftTable:()=>A,draftRelation:()=>f,draftColumn:()=>i,dbTable:()=>w,dbRelation:()=>x,dbColumn:()=>r,codeFileEdge:()=>z,codeFile:()=>I,boardAnnotation:()=>R9,appSetting:()=>_9});import{sqliteTable as P,index as W,foreignKey as F9,text as Y,integer as j,real as F,uniqueIndex as k,primaryKey as v9}from"drizzle-orm/sqlite-core";import{createId as v}from"@paralleldrive/cuid2";var U=P("Node",{id:Y().primaryKey().$defaultFn(()=>v()),view:Y().notNull(),cluster:Y(),title:Y().notNull(),role:Y(),plain:Y(),status:Y().default("PENDING").notNull(),priority:j().default(2).notNull(),progress:j().default(0).notNull(),x:F().default(0).notNull(),y:F().default(0).notNull(),sourceRef:Y(),externalId:Y(),source:Y().default("MANUAL").notNull(),parentId:Y(),createdAt:j({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date),updatedAt:j({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date).$onUpdate(()=>new Date),embedding:Y()},($)=>[W("Node_cluster_idx").on($.cluster),W("Node_parentId_idx").on($.parentId),W("Node_view_idx").on($.view),F9(()=>({columns:[$.parentId],foreignColumns:[$.id],name:"Node_parentId_Node_id_fk"})).onUpdate("cascade").onDelete("cascade")]),a=P("NodeFile",{id:Y().primaryKey().$defaultFn(()=>v()),nodeId:Y().notNull().references(()=>U.id,{onDelete:"cascade",onUpdate:"cascade"}),path:Y().notNull()},($)=>[k("NodeFile_nodeId_path_key").on($.nodeId,$.path),W("NodeFile_nodeId_idx").on($.nodeId)]),m=P("Tag",{id:Y().primaryKey().$defaultFn(()=>v()),label:Y().notNull(),color:Y()},($)=>[k("Tag_label_key").on($.label)]),S=P("Edge",{id:Y().primaryKey().$defaultFn(()=>v()),fromId:Y().notNull().references(()=>U.id,{onDelete:"cascade",onUpdate:"cascade"}),toId:Y().notNull().references(()=>U.id,{onDelete:"cascade",onUpdate:"cascade"}),kind:Y().default("DEPENDS").notNull(),label:Y(),sourceHandle:Y(),targetHandle:Y()},($)=>[k("Edge_fromId_toId_kind_key").on($.fromId,$.toId,$.kind),W("Edge_toId_idx").on($.toId),W("Edge_fromId_idx").on($.fromId)]),h=P("_NodeTags",{a:Y("A").notNull().references(()=>U.id,{onDelete:"cascade",onUpdate:"cascade"}),b:Y("B").notNull().references(()=>m.id,{onDelete:"cascade",onUpdate:"cascade"})},($)=>[k("_NodeTags_AB_unique").on($.a,$.b),W("_NodeTags_B_index").on($.b)]),A9=P("Note",{id:Y().primaryKey().$defaultFn(()=>v()),title:Y().default("Untitled").notNull(),body:Y().default("").notNull(),ord:F().default(0).notNull(),pinned:j({mode:"boolean"}).default(!1).notNull(),createdAt:j({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date),updatedAt:j({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date).$onUpdate(()=>new Date)},($)=>[W("Note_updatedAt_idx").on($.updatedAt)]),R9=P("BoardAnnotation",{id:Y().primaryKey().$defaultFn(()=>v()),targetKind:Y().notNull(),targetId:Y().notNull(),columnName:Y(),body:Y().default("").notNull(),x:F(),y:F(),createdAt:j({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date),updatedAt:j({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date).$onUpdate(()=>new Date)},($)=>[W("BoardAnnotation_target_idx").on($.targetId)]),w=P("DbTable",{id:Y().primaryKey().$defaultFn(()=>v()),name:Y().notNull(),domain:Y(),description:Y(),source:Y().default("MANUAL").notNull(),x:F().default(0).notNull(),y:F().default(0).notNull(),createdAt:j({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date),updatedAt:j({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date).$onUpdate(()=>new Date)},($)=>[W("DbTable_domain_idx").on($.domain),k("DbTable_name_key").on($.name)]),r=P("DbColumn",{id:Y().primaryKey().$defaultFn(()=>v()),tableId:Y().notNull().references(()=>w.id,{onDelete:"cascade",onUpdate:"cascade"}),name:Y().notNull(),type:Y().notNull(),isPk:j({mode:"boolean"}).default(!1).notNull(),isFk:j({mode:"boolean"}).default(!1).notNull(),nullable:j({mode:"boolean"}).default(!0).notNull(),note:Y(),ord:j().default(0).notNull()},($)=>[k("DbColumn_tableId_name_key").on($.tableId,$.name),W("DbColumn_tableId_idx").on($.tableId)]),x=P("DbRelation",{id:Y().primaryKey().$defaultFn(()=>v()),fromTableId:Y().notNull().references(()=>w.id,{onDelete:"cascade",onUpdate:"cascade"}),toTableId:Y().notNull().references(()=>w.id,{onDelete:"cascade",onUpdate:"cascade"}),fromColumn:Y().notNull(),toColumn:Y().notNull(),label:Y()},($)=>[W("DbRelation_toTableId_idx").on($.toTableId),W("DbRelation_fromTableId_idx").on($.fromTableId)]),p=P("Endpoint",{id:Y().primaryKey().$defaultFn(()=>v()),method:Y().notNull(),path:Y().notNull(),domain:Y(),description:Y(),source:Y().default("MANUAL").notNull(),x:F().default(0).notNull(),y:F().default(0).notNull(),createdAt:j({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date),updatedAt:j({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date).$onUpdate(()=>new Date)},($)=>[k("Endpoint_method_path_key").on($.method,$.path),W("Endpoint_domain_idx").on($.domain)]),g=P("EndpointTable",{id:Y().primaryKey().$defaultFn(()=>v()),endpointId:Y().notNull().references(()=>p.id,{onDelete:"cascade",onUpdate:"cascade"}),tableId:Y().notNull().references(()=>w.id,{onDelete:"cascade",onUpdate:"cascade"}),access:Y().default("read").notNull()},($)=>[k("EndpointTable_endpointId_tableId_key").on($.endpointId,$.tableId),W("EndpointTable_tableId_idx").on($.tableId)]),A=P("DraftTable",{id:Y().primaryKey().$defaultFn(()=>v()),name:Y().notNull(),domain:Y(),description:Y(),x:F().default(0).notNull(),y:F().default(0).notNull(),createdAt:j({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date)},($)=>[k("DraftTable_name_key").on($.name)]),i=P("DraftColumn",{id:Y().primaryKey().$defaultFn(()=>v()),tableId:Y().notNull().references(()=>A.id,{onDelete:"cascade",onUpdate:"cascade"}),name:Y().notNull(),type:Y().notNull(),isPk:j({mode:"boolean"}).default(!1).notNull(),isFk:j({mode:"boolean"}).default(!1).notNull(),nullable:j({mode:"boolean"}).default(!0).notNull(),note:Y(),ord:j().default(0).notNull()},($)=>[W("DraftColumn_tableId_idx").on($.tableId)]),f=P("DraftRelation",{id:Y().primaryKey().$defaultFn(()=>v()),fromTableId:Y().notNull().references(()=>A.id,{onDelete:"cascade",onUpdate:"cascade"}),toTableId:Y().notNull().references(()=>A.id,{onDelete:"cascade",onUpdate:"cascade"}),fromColumn:Y().notNull(),toColumn:Y().notNull(),label:Y()},($)=>[W("DraftRelation_toTableId_idx").on($.toTableId),W("DraftRelation_fromTableId_idx").on($.fromTableId)]),I=P("CodeFile",{path:Y().primaryKey(),root:Y(),lang:Y(),x:F().default(0).notNull(),y:F().default(0).notNull(),mtimeMs:F(),size:j(),inDegree:j().default(0).notNull(),outDegree:j().default(0).notNull(),updatedAt:j({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date).$onUpdate(()=>new Date)}),z=P("CodeFileEdge",{fromPath:Y().notNull().references(()=>I.path,{onDelete:"cascade",onUpdate:"cascade"}),toPath:Y().notNull().references(()=>I.path,{onDelete:"cascade",onUpdate:"cascade"}),circular:j({mode:"boolean"}).default(!1).notNull()},($)=>[W("CodeFileEdge_circular_idx").on($.circular),W("CodeFileEdge_toPath_idx").on($.toPath),W("CodeFileEdge_fromPath_idx").on($.fromPath),v9({columns:[$.fromPath,$.toPath],name:"CodeFileEdge_fromPath_toPath_pk"})]),E9=P("SyncState",{id:Y().primaryKey().default("singleton"),version:j().default(0).notNull(),codeGraphSyncedAt:j({mode:"timestamp_ms"}),updatedAt:j({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date).$onUpdate(()=>new Date)}),_9=P("AppSetting",{id:Y().primaryKey().default("singleton"),intelModel:Y().default("claude-haiku-4-5").notNull(),intelProvider:Y().default("auto").notNull(),editor:Y().default("auto").notNull(),currentFeatureId:Y(),updatedAt:j({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date).$onUpdate(()=>new Date)}),L9=P("ProjectMeta",{id:Y().primaryKey().default("singleton"),overview:Y(),conventions:Y().default("[]").notNull(),updatedAt:j({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date).$onUpdate(()=>new Date)});var T0={};e(T0,{tagRelations:()=>T9,nodeTagsRelations:()=>S9,nodeRelations:()=>I9,nodeFileRelations:()=>k9,endpointTableRelations:()=>z9,endpointRelations:()=>f9,edgeRelations:()=>y9,draftTableRelations:()=>u9,draftRelationRelations:()=>m9,draftColumnRelations:()=>b9,dbTableRelations:()=>h9,dbRelationRelations:()=>g9,dbColumnRelations:()=>x9,codeFileRelations:()=>p9,codeFileEdgeRelations:()=>c9});import{relations as q}from"drizzle-orm";var I9=q(U,({one:$,many:Q})=>({files:Q(a),nodeTags:Q(h),edgesOut:Q(S,{relationName:"EdgeFrom"}),edgesIn:Q(S,{relationName:"EdgeTo"}),parent:$(U,{fields:[U.parentId],references:[U.id],relationName:"NodeTree"}),children:Q(U,{relationName:"NodeTree"})})),k9=q(a,({one:$})=>({node:$(U,{fields:[a.nodeId],references:[U.id]})})),T9=q(m,({many:$})=>({nodeTags:$(h)})),S9=q(h,({one:$})=>({node:$(U,{fields:[h.a],references:[U.id]}),tag:$(m,{fields:[h.b],references:[m.id]})})),y9=q(S,({one:$})=>({from:$(U,{fields:[S.fromId],references:[U.id],relationName:"EdgeFrom"}),to:$(U,{fields:[S.toId],references:[U.id],relationName:"EdgeTo"})})),h9=q(w,({many:$})=>({columns:$(r),fksOut:$(x,{relationName:"FkFrom"}),fksIn:$(x,{relationName:"FkTo"}),usages:$(g)})),x9=q(r,({one:$})=>({table:$(w,{fields:[r.tableId],references:[w.id]})})),g9=q(x,({one:$})=>({fromTable:$(w,{fields:[x.fromTableId],references:[w.id],relationName:"FkFrom"}),toTable:$(w,{fields:[x.toTableId],references:[w.id],relationName:"FkTo"})})),f9=q(p,({many:$})=>({tables:$(g)})),z9=q(g,({one:$})=>({endpoint:$(p,{fields:[g.endpointId],references:[p.id]}),table:$(w,{fields:[g.tableId],references:[w.id]})})),u9=q(A,({many:$})=>({columns:$(i),fksOut:$(f,{relationName:"DraftFkFrom"}),fksIn:$(f,{relationName:"DraftFkTo"})})),b9=q(i,({one:$})=>({table:$(A,{fields:[i.tableId],references:[A.id]})})),m9=q(f,({one:$})=>({fromTable:$(A,{fields:[f.fromTableId],references:[A.id],relationName:"DraftFkFrom"}),toTable:$(A,{fields:[f.toTableId],references:[A.id],relationName:"DraftFkTo"})})),p9=q(I,({many:$})=>({edgesOut:$(z,{relationName:"CFEFrom"}),edgesIn:$(z,{relationName:"CFETo"})})),c9=q(z,({one:$})=>({fromFile:$(I,{fields:[z.fromPath],references:[I.path],relationName:"CFEFrom"}),toFile:$(I,{fields:[z.toPath],references:[I.path],relationName:"CFETo"})}));var d9={...k0,...T0};function o9(){let $=process.env.DATABASE_URL;if($&&/^(file:|libsql:|wss?:|https?:|:memory:)/i.test($))return $;return"file:./dev.db"}var n9=o9();function U5($){let Q=s9({url:$});return Q.execute("PRAGMA foreign_keys = ON;"),l9(Q,{schema:d9})}var y0=globalThis,S0=y0.dzDefault??U5(n9);y0.dzDefault=S0;var W5=y0.dzByUrl??=new Map;function a9($){let Q=W5.get($);if(!Q)Q=U5($),W5.set($,Q);return Q}function r9(){if(process.env.BEACON_REPO)return S0;let $=L0()??n();if(!$)return S0;return a9(A0($))}var i9=new Proxy({},{get($,Q){let Z=r9(),X=Z[Q];return typeof X==="function"?X.bind(Z):X}});import{forceCenter as o$,forceCollide as n$,forceLink as a$,forceManyBody as r$,forceSimulation as i$}from"d3-force";var P5=R.object({title:R.string().trim().min(1),role:R.string().nullish(),plain:R.string().nullish(),cluster:R.string().nullish(),category:R.string().nullish(),domain:R.string().nullish(),priority:R.number().nullish(),dependsOn:R.array(R.string()).nullish()}).transform(({category:$,domain:Q,priority:Z,...X})=>({...X,cluster:X.cluster??$??Q??null,priority:Z==null?null:Math.max(0,Math.min(3,Math.round(Z)))})),GQ=R.object({features:R.array(P5).default([])});var t9=/(\bmigrations?\b|\balembic\b|make revision|prisma migrate|unique\s?constraint|foreign\s?keys?|primary\s?keys?|\bFKs?\b|\bJSONB\b|create\s+table|alter\s+table|add\s+(a\s+)?column|new\s+(table|model|column)|app\/models\/|\bBaseModel\b|DeclarativeBase|schema\.prisma|@@unique|natural\s+keys?|\bpgvector\b|\bTSVECTOR\b|\bDbTable\b)/i;function O5($){return!!$&&t9.test($)}function e9($){return $.cluster??$.category??$.domain??null}function C5($){let Q=$.map((Z)=>{let X=[],V=e9(Z);if(!V||!V.trim())X.push("category");if(Z.priority==null)X.push("priority");return X.length?` \u2022 "${Z.title?.trim()||"(untitled)"}" \u2014 missing ${X.join(" + ")}`:null}).filter((Z)=>Z!==null);if(Q.length===0)return null;return"\u26D4 Every roadmap feature needs a category AND a priority \u2014 they drive grouping and ordering "+`on the board, and the user shouldn't have to add them by hand. Missing:
238
+ `).replace(/^\n+/,"");if(i(X)===null)return{removed:!1,skipped:!0};return m0(m(),X),{removed:!0}}async function a9(){let{INIT_SKILL:$,REFRESH_SKILL:Q,PLAN_SKILL:Z}=await Promise.resolve().then(() => (S0(),z0)),Y={"beacon-init":$,"beacon-refresh":Q,"beacon-plan":Z},X=[];for(let U of g){if(!a(R0(),U))X.push(U);w0(R0(),U,Y[U])}let H=0;for(let U of E0)if(B0(i0(),{event:U.event,matcher:U.matcher,command:U.command}))H++;let W=n(F0(),D0);M0(F0(),D0,k5,o0);let G=h5();return{skillsAdded:X,hooksAdded:H,agentsMdBlockTouched:!W,mcp:G}}function r9(){let $={};for(let Z of g)$[Z]=a(R0(),Z);let Q={};for(let Z of E0)Q[Z.event]=K0(i0(),{event:Z.event,command:Z.command});return{detected:g5(),skills:$,hooks:Q,agentsMdBlock:n(F0(),D0),mcp:t0()}}function i9(){let $=[];for(let X of g)if(C0(R0(),X))$.push(X);let Q=0;for(let X of E0)if(N0(i0(),{event:X.event,command:X.command}))Q++;let Z=q0(F0(),D0,k5),Y=z5();return{skillsRemoved:$,hooksRemoved:Q,agentsMdBlockRemoved:Z,mcpRemoved:Y.removed,mcpSkipped:Y.skipped}}var r0=()=>t(_5(),".codex"),i0=()=>t(r0(),"hooks.json"),m=()=>t(r0(),"config.toml"),F0=()=>t(r0(),"AGENTS.md"),R0=()=>t(_5(),".agents","skills"),D0="<!-- beacon:global:start -->",k5="<!-- beacon:global:end -->",E0,a0,y5="# beacon:start (managed by Beacon \u2014 `beacon uninstall` removes this block)",x5="# beacon:end",o9,r="add it manually: codex mcp add beacon -- beacon mcp";var A5=f(()=>{b0();R5();n0();E0=[{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."}];o9=`${y5}
239
+ [mcp_servers.beacon]
240
+ command = "beacon"
241
+ args = ["mcp"]
242
+ ${x5}
243
+ `});var u5={};o(u5,{provisionDb:()=>U$});import{createClient as t9}from"@libsql/client";import{drizzle as e9}from"drizzle-orm/libsql";import{migrate as $$}from"drizzle-orm/libsql/migrator";import{readMigrationFiles as Q$}from"drizzle-orm/migrator";import{dirname as e0,join as Z$}from"path";import{fileURLToPath as J$}from"url";async function I0($,Q){return(await $.execute({sql:"SELECT 1 FROM sqlite_master WHERE type='table' AND name = ?",args:[Q]})).rows.length>0}async function H$($,Q){let Z=await $.execute(`PRAGMA table_info("${Q}")`);return new Set(Z.rows.map((Y)=>String(Y.name)))}async function S5($){if(!await I0($,"__drizzle_migrations"))return 0;let Q=await $.execute('SELECT count(*) AS n FROM "__drizzle_migrations"');return Number(Q.rows[0]?.n??0)}async function W$($){for(let[Q,Z]of Object.entries(X$)){if(!await I0($,Q))continue;let Y=await H$($,Q);for(let X of Z){if(!Y.has(X))continue;await $.execute(`UPDATE "${Q}" SET "${X}" = CAST((julianday("${X}") - 2440587.5) * 86400000 AS INTEGER) WHERE typeof("${X}") = 'text'`)}}}async function U$($,Q=V$){let Z=t9({url:$});try{await Z.execute("PRAGMA journal_mode = WAL;"),await Z.execute("PRAGMA foreign_keys = ON;");let Y=await I0(Z,"__drizzle_migrations"),X=await I0(Z,"Node"),H=!1;if(X&&!Y){let G=Q$({migrationsFolder:Q})[0];if(G)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:[G.hash,G.folderMillis]}),H=!0}let W=await S5(Z);if(await $$(e9(Z),{migrationsFolder:Q}),await S5(Z)>W)H=!0;return await W$(Z),{migrated:H}}finally{Z.close()}}var Y$,V$,X$;var f5=f(async()=>{Y$=e0(e0(e0(J$(import.meta.url)))),V$=process.env.BEACON_MIGRATIONS_DIR||Z$(Y$,"drizzle"),X$={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 j$}from"async_hooks";import{spawnSync as G$}from"child_process";import{createHash as P$}from"crypto";import{existsSync as m5,mkdirSync as L0,readFileSync as p5,writeFileSync as c5}from"fs";import{homedir as B$}from"os";import{basename as K$,join as p}from"path";function e(){return process.env.BEACON_HOME||p(B$(),".beacon")}function $5(){return p(e(),"workspaces.json")}function T0($){return P$("sha256").update($).digest("hex").slice(0,12)}function l5($=process.cwd()){let Q=G$("git",["rev-parse","--show-toplevel"],{cwd:$,stdio:["ignore","pipe","ignore"]});if(Q.status===0){let Z=Q.stdout?.toString().trim();if(Z)return Z}return $}function Q5($){return p(e(),$)}function Z5($){return`file:${p(Q5($),"db.sqlite")}`}function $0(){try{let $=JSON.parse(p5($5(),"utf8"));return Array.isArray($)?$:[]}catch{return[]}}function J5($){L0(e(),{recursive:!0}),c5($5(),JSON.stringify($,null,2))}function N$(){return $0().sort(($,Q)=>Q.lastOpenedAt.localeCompare($.lastOpenedAt))}function y($){return $0().find((Q)=>Q.id===$)??null}function Y5($,Q,Z=new Date().toISOString()){let Y=T0($),X=$0(),H=X.find((U)=>U.id===Y),W={id:Y,path:$,name:Q||H?.name||K$($),lastOpenedAt:Z},G=[W,...X.filter((U)=>U.id!==Y)];return L0(Q5(Y),{recursive:!0}),J5(G),W}function hQ($,Q=new Date().toISOString()){let Z=$0(),Y=Z.find((X)=>X.id===$);if(!Y)return;Y.lastOpenedAt=Q,J5(Z)}function zQ($){if(J5($0().filter((Q)=>Q.id!==$)),Q0()===$)M$(N$()[0]?.id??null)}function d5(){return p(e(),"active")}function Q0(){try{return p5(d5(),"utf8").trim()||null}catch{return null}}function M$($){L0(e(),{recursive:!0}),c5(d5(),$??"")}function SQ(){let $=Q0();return $?y($):null}function uQ(){let $=X5()??Q0();return $?y($):null}function fQ($){return y($)?.path??null}function bQ(){return m5($5())}var s5="beacon_ws";function o5($,Q){let Z=$.headers.get("cookie");if(!Z)return null;for(let Y of Z.split(";")){let X=Y.indexOf("=");if(X===-1)continue;if(Y.slice(0,X).trim()===Q)return decodeURIComponent(Y.slice(X+1).trim())}return null}function mQ($){let Q=$.headers.get("x-beacon-workspace");if(Q&&y(Q))return Q;let Z=o5($,s5);if(Z&&y(Z))return Z;return null}var V5="x-beacon-workspace-path";async function pQ($){let Q=$.headers.get("x-beacon-workspace");if(Q&&y(Q))return Q;let Z=$.headers.get(V5);if(Z&&(!Q||T0(Z)===Q)){let X=Y5(Z);return await H5(X.id),X.id}let Y=o5($,s5);if(Y&&y(Y))return Y;return null}var n5=new j$;function q$($,Q){return $?n5.run($,Q):Q()}function X5(){return n5.getStore()??null}var b5=new Set;async function H5($){let Q=Q5($),Z=p(Q,"db.sqlite"),Y=m5(Z);if(Y&&b5.has(Z))return{ok:!0,created:!1,migrated:!1};try{L0(Q,{recursive:!0});let{provisionDb:X}=await f5().then(() => u5),H=await X(Z5($));return b5.add(Z),{ok:!0,created:!Y,migrated:Y&&H.migrated}}catch(X){return{ok:!1,created:!1,migrated:!1,error:X instanceof Error?X.message:String(X)}}}n0();import{McpServer as e$,ResourceTemplate as N5}from"@modelcontextprotocol/sdk/server/mcp.js";import{StdioServerTransport as $Q}from"@modelcontextprotocol/sdk/server/stdio.js";import{z as J}from"zod";import{z as P}from"zod";var w$=new Set(["GET","HEAD","OPTIONS"]);function a5($){return w$.has($.trim().toUpperCase())?"read":"write"}var C$=P.preprocess(($)=>{if(typeof $==="string"){let[Q,...Z]=$.trim().split(/\s+/);return{name:Q,type:Z.join(" ")||"text"}}return $},P.object({name:P.string().trim().min(1),type:P.string().trim().min(1),isPk:P.boolean().optional(),isFk:P.boolean().optional(),nullable:P.boolean().optional(),note:P.string().nullish()})),r5=P.object({name:P.string().trim().min(1),domain:P.string().nullish(),description:P.string().nullish(),columns:P.array(C$).default([])}),i5=P.object({fromTable:P.string(),fromColumn:P.string(),toTable:P.string(),toColumn:P.string(),label:P.string().nullish()}),t5=P.object({method:P.string().trim().min(1),path:P.string().trim().min(1),domain:P.string().nullish(),description:P.string().nullish(),uses:P.array(P.object({table:P.string().trim().min(1),access:P.string().optional()})).default([])}).transform(($)=>({...$,uses:$.uses.map((Q)=>({...Q,access:Q.access??a5($.method)}))})),oQ=P.object({tables:P.array(r5).default([]),relations:P.array(i5).default([]),endpoints:P.array(t5).default([])});import{z as A}from"zod";import{and as KZ,eq as NZ,inArray as MZ}from"drizzle-orm";import{drizzle as c$}from"drizzle-orm/libsql";import{createClient as l$}from"@libsql/client";var W5={};o(W5,{tag:()=>c,syncState:()=>D$,projectMeta:()=>E$,note:()=>F$,nodeTags:()=>x,nodeFile:()=>Z0,node:()=>K,endpointTable:()=>z,endpoint:()=>l,edge:()=>k,draftTable:()=>D,draftRelation:()=>S,draftColumn:()=>V0,dbTable:()=>v,dbRelation:()=>h,dbColumn:()=>Y0,codeFileEdge:()=>u,codeFile:()=>T,bugFlag:()=>J0,boardAnnotation:()=>R$,appSetting:()=>A$});import{sqliteTable as q,index as N,foreignKey as v$,text as V,integer as j,real as R,uniqueIndex as _,primaryKey as O$}from"drizzle-orm/sqlite-core";import{createId as O}from"@paralleldrive/cuid2";var K=q("Node",{id:V().primaryKey().$defaultFn(()=>O()),view:V().notNull(),kind:V().default("FEATURE").notNull(),cluster:V(),title:V().notNull(),role:V(),plain:V(),status:V().default("PENDING").notNull(),priority:j().default(2).notNull(),progress:j().default(0).notNull(),x:R().default(0).notNull(),y:R().default(0).notNull(),sourceRef:V(),externalId:V(),source:V().default("MANUAL").notNull(),parentId:V(),createdAt:j({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date),updatedAt:j({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date).$onUpdate(()=>new Date)},($)=>[N("Node_cluster_idx").on($.cluster),N("Node_parentId_idx").on($.parentId),N("Node_view_idx").on($.view),v$(()=>({columns:[$.parentId],foreignColumns:[$.id],name:"Node_parentId_Node_id_fk"})).onUpdate("cascade").onDelete("cascade")]),Z0=q("NodeFile",{id:V().primaryKey().$defaultFn(()=>O()),nodeId:V().notNull().references(()=>K.id,{onDelete:"cascade",onUpdate:"cascade"}),path:V().notNull()},($)=>[_("NodeFile_nodeId_path_key").on($.nodeId,$.path),N("NodeFile_nodeId_idx").on($.nodeId)]),c=q("Tag",{id:V().primaryKey().$defaultFn(()=>O()),label:V().notNull(),color:V()},($)=>[_("Tag_label_key").on($.label)]),k=q("Edge",{id:V().primaryKey().$defaultFn(()=>O()),fromId:V().notNull().references(()=>K.id,{onDelete:"cascade",onUpdate:"cascade"}),toId:V().notNull().references(()=>K.id,{onDelete:"cascade",onUpdate:"cascade"}),kind:V().default("DEPENDS").notNull(),label:V(),sourceHandle:V(),targetHandle:V()},($)=>[_("Edge_fromId_toId_kind_key").on($.fromId,$.toId,$.kind),N("Edge_toId_idx").on($.toId),N("Edge_fromId_idx").on($.fromId)]),x=q("_NodeTags",{a:V("A").notNull().references(()=>K.id,{onDelete:"cascade",onUpdate:"cascade"}),b:V("B").notNull().references(()=>c.id,{onDelete:"cascade",onUpdate:"cascade"})},($)=>[_("_NodeTags_AB_unique").on($.a,$.b),N("_NodeTags_B_index").on($.b)]),F$=q("Note",{id:V().primaryKey().$defaultFn(()=>O()),title:V().default("Untitled").notNull(),body:V().default("").notNull(),ord:R().default(0).notNull(),pinned:j({mode:"boolean"}).default(!1).notNull(),createdAt:j({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date),updatedAt:j({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date).$onUpdate(()=>new Date)},($)=>[N("Note_updatedAt_idx").on($.updatedAt)]),R$=q("BoardAnnotation",{id:V().primaryKey().$defaultFn(()=>O()),targetKind:V().notNull(),targetId:V().notNull(),columnName:V(),body:V().default("").notNull(),x:R(),y:R(),createdAt:j({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date),updatedAt:j({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date).$onUpdate(()=>new Date)},($)=>[N("BoardAnnotation_target_idx").on($.targetId)]),J0=q("BugFlag",{id:V().primaryKey().$defaultFn(()=>O()),nodeId:V().notNull().references(()=>K.id,{onDelete:"cascade",onUpdate:"cascade"}),by:V().notNull(),note:V().notNull(),resolvedAt:j({mode:"timestamp_ms"}),createdAt:j({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date)},($)=>[N("BugFlag_nodeId_idx").on($.nodeId)]),v=q("DbTable",{id:V().primaryKey().$defaultFn(()=>O()),name:V().notNull(),domain:V(),description:V(),source:V().default("MANUAL").notNull(),x:R().default(0).notNull(),y:R().default(0).notNull(),createdAt:j({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date),updatedAt:j({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date).$onUpdate(()=>new Date)},($)=>[N("DbTable_domain_idx").on($.domain),_("DbTable_name_key").on($.name)]),Y0=q("DbColumn",{id:V().primaryKey().$defaultFn(()=>O()),tableId:V().notNull().references(()=>v.id,{onDelete:"cascade",onUpdate:"cascade"}),name:V().notNull(),type:V().notNull(),isPk:j({mode:"boolean"}).default(!1).notNull(),isFk:j({mode:"boolean"}).default(!1).notNull(),nullable:j({mode:"boolean"}).default(!0).notNull(),note:V(),ord:j().default(0).notNull()},($)=>[_("DbColumn_tableId_name_key").on($.tableId,$.name),N("DbColumn_tableId_idx").on($.tableId)]),h=q("DbRelation",{id:V().primaryKey().$defaultFn(()=>O()),fromTableId:V().notNull().references(()=>v.id,{onDelete:"cascade",onUpdate:"cascade"}),toTableId:V().notNull().references(()=>v.id,{onDelete:"cascade",onUpdate:"cascade"}),fromColumn:V().notNull(),toColumn:V().notNull(),label:V()},($)=>[N("DbRelation_toTableId_idx").on($.toTableId),N("DbRelation_fromTableId_idx").on($.fromTableId)]),l=q("Endpoint",{id:V().primaryKey().$defaultFn(()=>O()),method:V().notNull(),path:V().notNull(),domain:V(),description:V(),source:V().default("MANUAL").notNull(),x:R().default(0).notNull(),y:R().default(0).notNull(),createdAt:j({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date),updatedAt:j({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date).$onUpdate(()=>new Date)},($)=>[_("Endpoint_method_path_key").on($.method,$.path),N("Endpoint_domain_idx").on($.domain)]),z=q("EndpointTable",{id:V().primaryKey().$defaultFn(()=>O()),endpointId:V().notNull().references(()=>l.id,{onDelete:"cascade",onUpdate:"cascade"}),tableId:V().notNull().references(()=>v.id,{onDelete:"cascade",onUpdate:"cascade"}),access:V().default("read").notNull()},($)=>[_("EndpointTable_endpointId_tableId_key").on($.endpointId,$.tableId),N("EndpointTable_tableId_idx").on($.tableId)]),D=q("DraftTable",{id:V().primaryKey().$defaultFn(()=>O()),name:V().notNull(),domain:V(),description:V(),x:R().default(0).notNull(),y:R().default(0).notNull(),createdAt:j({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date)},($)=>[_("DraftTable_name_key").on($.name)]),V0=q("DraftColumn",{id:V().primaryKey().$defaultFn(()=>O()),tableId:V().notNull().references(()=>D.id,{onDelete:"cascade",onUpdate:"cascade"}),name:V().notNull(),type:V().notNull(),isPk:j({mode:"boolean"}).default(!1).notNull(),isFk:j({mode:"boolean"}).default(!1).notNull(),nullable:j({mode:"boolean"}).default(!0).notNull(),note:V(),ord:j().default(0).notNull()},($)=>[N("DraftColumn_tableId_idx").on($.tableId)]),S=q("DraftRelation",{id:V().primaryKey().$defaultFn(()=>O()),fromTableId:V().notNull().references(()=>D.id,{onDelete:"cascade",onUpdate:"cascade"}),toTableId:V().notNull().references(()=>D.id,{onDelete:"cascade",onUpdate:"cascade"}),fromColumn:V().notNull(),toColumn:V().notNull(),label:V()},($)=>[N("DraftRelation_toTableId_idx").on($.toTableId),N("DraftRelation_fromTableId_idx").on($.fromTableId)]),T=q("CodeFile",{path:V().primaryKey(),root:V(),lang:V(),x:R().default(0).notNull(),y:R().default(0).notNull(),mtimeMs:R(),size:j(),inDegree:j().default(0).notNull(),outDegree:j().default(0).notNull(),updatedAt:j({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date).$onUpdate(()=>new Date)}),u=q("CodeFileEdge",{fromPath:V().notNull().references(()=>T.path,{onDelete:"cascade",onUpdate:"cascade"}),toPath:V().notNull().references(()=>T.path,{onDelete:"cascade",onUpdate:"cascade"}),circular:j({mode:"boolean"}).default(!1).notNull()},($)=>[N("CodeFileEdge_circular_idx").on($.circular),N("CodeFileEdge_toPath_idx").on($.toPath),N("CodeFileEdge_fromPath_idx").on($.fromPath),O$({columns:[$.fromPath,$.toPath],name:"CodeFileEdge_fromPath_toPath_pk"})]),D$=q("SyncState",{id:V().primaryKey().default("singleton"),version:j().default(0).notNull(),codeGraphSyncedAt:j({mode:"timestamp_ms"}),updatedAt:j({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date).$onUpdate(()=>new Date)}),A$=q("AppSetting",{id:V().primaryKey().default("singleton"),editor:V().default("auto").notNull(),currentFeatureId:V(),updatedAt:j({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date).$onUpdate(()=>new Date)}),E$=q("ProjectMeta",{id:V().primaryKey().default("singleton"),overview:V(),conventions:V().default("[]").notNull(),updatedAt:j({mode:"timestamp_ms"}).notNull().$defaultFn(()=>new Date).$onUpdate(()=>new Date)});var U5={};o(U5,{tagRelations:()=>_$,nodeTagsRelations:()=>k$,nodeRelations:()=>I$,nodeFileRelations:()=>L$,endpointTableRelations:()=>S$,endpointRelations:()=>z$,edgeRelations:()=>g$,draftTableRelations:()=>u$,draftRelationRelations:()=>b$,draftColumnRelations:()=>f$,dbTableRelations:()=>y$,dbRelationRelations:()=>h$,dbColumnRelations:()=>x$,codeFileRelations:()=>m$,codeFileEdgeRelations:()=>p$,bugFlagRelations:()=>T$});import{relations as C}from"drizzle-orm";var I$=C(K,({one:$,many:Q})=>({files:Q(Z0),bugFlags:Q(J0),nodeTags:Q(x),edgesOut:Q(k,{relationName:"EdgeFrom"}),edgesIn:Q(k,{relationName:"EdgeTo"}),parent:$(K,{fields:[K.parentId],references:[K.id],relationName:"NodeTree"}),children:Q(K,{relationName:"NodeTree"})})),L$=C(Z0,({one:$})=>({node:$(K,{fields:[Z0.nodeId],references:[K.id]})})),T$=C(J0,({one:$})=>({node:$(K,{fields:[J0.nodeId],references:[K.id]})})),_$=C(c,({many:$})=>({nodeTags:$(x)})),k$=C(x,({one:$})=>({node:$(K,{fields:[x.a],references:[K.id]}),tag:$(c,{fields:[x.b],references:[c.id]})})),g$=C(k,({one:$})=>({from:$(K,{fields:[k.fromId],references:[K.id],relationName:"EdgeFrom"}),to:$(K,{fields:[k.toId],references:[K.id],relationName:"EdgeTo"})})),y$=C(v,({many:$})=>({columns:$(Y0),fksOut:$(h,{relationName:"FkFrom"}),fksIn:$(h,{relationName:"FkTo"}),usages:$(z)})),x$=C(Y0,({one:$})=>({table:$(v,{fields:[Y0.tableId],references:[v.id]})})),h$=C(h,({one:$})=>({fromTable:$(v,{fields:[h.fromTableId],references:[v.id],relationName:"FkFrom"}),toTable:$(v,{fields:[h.toTableId],references:[v.id],relationName:"FkTo"})})),z$=C(l,({many:$})=>({tables:$(z)})),S$=C(z,({one:$})=>({endpoint:$(l,{fields:[z.endpointId],references:[l.id]}),table:$(v,{fields:[z.tableId],references:[v.id]})})),u$=C(D,({many:$})=>({columns:$(V0),fksOut:$(S,{relationName:"DraftFkFrom"}),fksIn:$(S,{relationName:"DraftFkTo"})})),f$=C(V0,({one:$})=>({table:$(D,{fields:[V0.tableId],references:[D.id]})})),b$=C(S,({one:$})=>({fromTable:$(D,{fields:[S.fromTableId],references:[D.id],relationName:"DraftFkFrom"}),toTable:$(D,{fields:[S.toTableId],references:[D.id],relationName:"DraftFkTo"})})),m$=C(T,({many:$})=>({edgesOut:$(u,{relationName:"CFEFrom"}),edgesIn:$(u,{relationName:"CFETo"})})),p$=C(u,({one:$})=>({fromFile:$(T,{fields:[u.fromPath],references:[T.path],relationName:"CFEFrom"}),toFile:$(T,{fields:[u.toPath],references:[T.path],relationName:"CFETo"})}));var d$={...W5,...U5};function s$(){let $=process.env.DATABASE_URL;if($&&/^(file:|libsql:|wss?:|https?:|:memory:)/i.test($))return $;return"file:./dev.db"}var o$=s$();function $9($){let Q=l$({url:$});return Q.execute("PRAGMA foreign_keys = ON;"),c$(Q,{schema:d$})}var G5=globalThis,j5=G5.dzDefault??$9(o$);G5.dzDefault=j5;var e5=G5.dzByUrl??=new Map;function n$($){let Q=e5.get($);if(!Q)Q=$9($),e5.set($,Q);return Q}function a$(){if(process.env.BEACON_REPO)return j5;let $=X5()??Q0();if(!$)return j5;return n$(Z5($))}var r$=new Proxy({},{get($,Q){let Z=a$(),Y=Z[Q];return typeof Y==="function"?Y.bind(Z):Y}});import{forceCenter as VZ,forceCollide as XZ,forceLink as HZ,forceManyBody as WZ,forceSimulation as UZ}from"d3-force";var Q9=A.object({title:A.string().trim().min(1),role:A.string().nullish(),plain:A.string().nullish(),cluster:A.string().nullish(),category:A.string().nullish(),domain:A.string().nullish(),priority:A.number().nullish(),dependsOn:A.array(A.string()).nullish()}).transform(({category:$,domain:Q,priority:Z,...Y})=>({...Y,cluster:Y.cluster??$??Q??null,priority:Z==null?null:Math.max(0,Math.min(3,Math.round(Z)))})),vZ=A.object({features:A.array(Q9).default([])});var i$=/(\bmigrations?\b|\balembic\b|make revision|prisma migrate|unique\s?constraint|foreign\s?keys?|primary\s?keys?|\bFKs?\b|\bJSONB\b|create\s+table|alter\s+table|add\s+(a\s+)?column|new\s+(table|model|column)|app\/models\/|\bBaseModel\b|DeclarativeBase|schema\.prisma|@@unique|natural\s+keys?|\bpgvector\b|\bTSVECTOR\b|\bDbTable\b)/i;function Z9($){return!!$&&i$.test($)}function t$($){return $.cluster??$.category??$.domain??null}function J9($){let Q=$.map((Z)=>{let Y=[],X=t$(Z);if(!X||!X.trim())Y.push("category");if(Z.priority==null)Y.push("priority");return Y.length?` \u2022 "${Z.title?.trim()||"(untitled)"}" \u2014 missing ${Y.join(" + ")}`:null}).filter((Z)=>Z!==null);if(Q.length===0)return null;return"\u26D4 Every roadmap feature needs a category AND a priority \u2014 they drive grouping and ordering "+`on the board, and the user shouldn't have to add them by hand. Missing:
228
244
  `+Q.join(`
229
- `)+"\n\nRe-present with each feature carrying its category as `category` (or `cluster` \u2014 both "+"work; e.g. AUTH, SEARCH, DATA, INTEL, BILLING \u2026) and `priority` (0 = P0 critical, 1 = P1 "+"high, 2 = P2 medium, 3 = P3 low). Set BOTH on EVERY feature; don't rely on defaults."}function h0($){if(!$?.length)return"";let Q=$.map((X)=>X.id?` \u2022 ${X.title} \u2014 id: ${X.id}`:` \u2022 ${X.title}`),Z=$.some((X)=>X.id);return`
245
+ `)+"\n\nRe-present with each feature carrying its category as `category` (or `cluster` \u2014 both "+"work; e.g. AUTH, SEARCH, DATA, INTEL, BILLING \u2026) and `priority` (0 = P0 critical, 1 = P1 "+"high, 2 = P2 medium, 3 = P3 low). Set BOTH on EVERY feature; don't rely on defaults."}function P5($){if(!$?.length)return"";let Q=$.map((Y)=>Y.id?` \u2022 ${Y.title} \u2014 id: ${Y.id}`:` \u2022 ${Y.title}`),Z=$.some((Y)=>Y.id);return`
230
246
 
231
247
  This plan created these roadmap feature(s):
232
248
  `+Q.join(`
233
- `)+"\n\nWhen the work ships, register them in ONE call: `beacon_describe_feature` with a "+"`features` array \u2014 one entry per feature"+(Z?", each keyed by the `id` above (no title-matching needed)":"")+", each with the files you touched + a short markdown summary. Do them all in that single "+"batched call so every feature flips to Done \u2014 do NOT register only the umbrella, and do "+"NOT make one call per feature."}var x0=1500,CQ=345600000,g0=1800000,w5=3000;function t($){return $.toLowerCase().normalize("NFD").replace(/[\u0300-\u036F]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,50)||"item"}function q5($){return`${t($.title)}-${$.id.slice(-6)}`}function D5($){return{resources:$.map((Q)=>({uri:`note://${q5(Q)}`,name:Q.title||"Untitled",description:`${Q.title||"Untitled"}${Q.pinned?" \xB7 pinned":""} \xB7 note`,mimeType:"text/markdown"}))}}function F5($,Q){return $.find((Z)=>q5(Z)===Q)}function v5($){let Q=$.body.trim()||"(this note is empty)";return[`# ${$.title||"Untitled"}`,"","_User note from Beacon. To turn it into roadmap work, call `beacon_propose_plan` \u2014"+" checkbox `- [ ]` / `- [x]` items become subtasks, and order the features with `dependsOn`. Do NOT implement until it returns approval._","","---","",Q].join(`
234
- `)}await i0();var z0=process.env.BEACON_URL||`http://localhost:${process.env.PORT||4319}`,u0=Y5(),B0=V0(u0);try{E0(u0);let $=await I0(B0);if(!$.ok)console.error(`[beacon mcp] db provisioning failed: ${$.error}`)}catch($){console.error(`[beacon mcp] workspace registration failed: ${$ instanceof Error?$.message:$}`)}async function E($,Q){let Z=new Headers(Q?.headers);Z.set("x-beacon-workspace",B0),Z.set(_0,u0);let X=await fetch(`${z0}${$}`,{...Q,headers:Z}),V=await X.text();if(!X.ok)throw Error(`Beacon ${$} -> ${X.status} ${V}`);return V?JSON.parse(V):null}function c($,Q){return E($,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(Q)})}function E5($){let Q=$ instanceof Error?$.message:String($),Z=Q.match(/\{[\s\S]*\}$/);if(Z)try{let X=JSON.parse(Z[0]);if(X?.error)return{content:[{type:"text",text:X.error}],isError:!0}}catch{}return{content:[{type:"text",text:Q}],isError:!0}}var D=new $$({name:"beacon",version:"0.1.0"});D.registerTool("beacon_map",{description:"List existing features on the roadmap. Call before starting work."},async()=>{let $=await E("/api/map");return{content:[{type:"text",text:JSON.stringify($)}]}});D.registerTool("beacon_start_feature",{description:"Flag that you're working on a feature. If the title matches an existing feature it just marks it IN_PROGRESS (no category needed); if it's NEW it creates the node \u2014 and a new feature REQUIRES a `category`. Call beacon_map first so you reuse an existing feature/category instead of duplicating one.",inputSchema:{title:J.string(),id:J.string().optional().describe("node id from beacon_map (preferred)"),category:J.string().optional().describe("Domain lane for a NEW feature: AUTH | SEARCH | DATA | INTEL | BILLING | INFRA | UI | \u2026 REQUIRED when this creates a new top-level feature; reuse a category already on the board. Ignored when flagging an existing feature or nesting under a `front` (inherits the parent's)."),front:J.string().optional().describe("Title of an EXISTING parent feature to nest this under (draws the parent \u2192 child edge). It must match a real feature \u2014 it is NOT a domain tag (use `category` for the domain). A `front` that matches nothing is REJECTED; create the parent first via beacon_propose_plan."),detail:J.string().optional().describe("One-line plain-language description shown on the canvas card. Replaced later by beacon_describe_feature's markdown when the work is done.")}},async({title:$,id:Q,front:Z,detail:X,category:V})=>{try{let H=await c("/api/map/start",{title:$,id:Q,front:Z,detail:X,category:V});return{content:[{type:"text",text:JSON.stringify(H)}]}}catch(H){return E5(H)}});D.registerTool("beacon_add_subtasks",{description:"Add N sub-tasks under an existing feature in one call. Use when the user says 'add these as subtasks to <feature>' or you want to record follow-ups discovered during work. Parent resolves by `parentId` (preferred \u2014 get it from beacon_map / beacon_entities) or by `parentTitle` (fuzzy-matched against top-level features). Children inherit the parent's view and cluster and land in a row beneath it; bumps the sync version so an open /map canvas refreshes.",inputSchema:{parentId:J.string().optional().describe("node id of the parent feature (preferred)"),parentTitle:J.string().optional().describe("fuzzy title of the parent feature; ignored if parentId is provided"),items:J.array(J.object({title:J.string().describe("short sub-task title"),plain:J.string().optional().describe("one-paragraph description / why / acceptance hint")})).describe("the sub-tasks to add")}},async({parentId:$,parentTitle:Q,items:Z})=>{try{let X=await c("/api/nodes/subtasks",{parentId:$,parentTitle:Q,items:Z});return{content:[{type:"text",text:JSON.stringify(X)}]}}catch(X){return E5(X)}});var A5=J.array(J.object({title:J.string().describe("real component/subsystem name (e.g. 'Plan review loop') \u2014 NEVER a file"),domain:J.string().describe("uppercase lane: PLAN | DATA | UI | MCP | INTEL | \u2026"),role:J.string().optional().describe("one-line technical role"),plain:J.string().optional().describe("one plain-language sentence"),status:J.enum(["KEEP","REBUILD","REPLACE","DROP"]).optional(),files:J.array(J.string()).optional(),depends:J.array(J.string()).optional().describe("titles of components this one depends on")})).optional().describe("Only when the feature adds/changes a REAL architectural component \u2014 upserts curated nodes, never one-per-file");D.registerTool("beacon_describe_feature",{description:"Register shipped feature(s) at the end of the work: marks status=DONE, records the files touched (kept on the FEATURE for context), and replaces each node's description with your markdown. Subsumes touch_files + finish_feature. REGISTER ALL FEATURES A PLAN CREATED IN ONE CALL via the `features` array (one entry per feature) \u2014 do NOT call this once per feature. Pass each feature's `id` (returned to you at plan approval) so no title-matching is needed. For a single feature you may pass the top-level fields instead. Pass `architecture` only when a feature added/changed a REAL subsystem (never a file).",inputSchema:{features:J.array(J.object({id:J.string().optional().describe("node id from plan approval / beacon_map (preferred over title)"),title:J.string().optional().describe("feature title (fuzzy-matched if no id)"),description:J.string().describe("Markdown: ### Overview ... ### Files - `path` \u2014 what it does"),files:J.array(J.string()).optional().describe("repo-relative files this feature touches"),architecture:A5})).optional().describe("Register many features at once \u2014 one entry per feature, each id-keyed. Use this instead of N separate calls."),description:J.string().optional().describe("Single-feature markdown (omit when using `features`): ### Overview ... ### Files - `path` \u2014 what it does"),files:J.array(J.string()).optional().describe("repo-relative files this feature touches (single form)"),id:J.string().optional().describe("node id from plan approval / beacon_map (preferred over title)"),title:J.string().optional().describe("feature title (fuzzy-matched if no id)"),architecture:A5}},async({features:$,description:Q,files:Z,id:X,title:V,architecture:H})=>{let G=$?.length?{features:$}:{description:Q,files:Z,id:X,title:V,architecture:H},N=await c("/api/map/describe",G);return{content:[{type:"text",text:JSON.stringify(N)}]}});D.registerTool("beacon_init_persist",{description:"Use ONLY inside the `beacon-init` skill. After YOU (Claude Code) have read the repo and built the architecture analysis, call this once to persist it into Beacon. Replaces any prior init-derived map. Same DB shape as `beacon_propose_plan` for tables/endpoints, but it commits directly (no /plan review step) because the user explicitly invoked init.",inputSchema:{overview:J.string().optional().describe("one-paragraph summary of the project \u2014 written to ProjectMeta + AGENTS.md"),conventions:J.array(J.string()).optional().describe("3-8 concrete conventions/gotchas a contributor must follow"),components:J.array(J.object({title:J.string(),domain:J.string().describe("short UPPERCASE area: AUTH, API, DATA, UI, JOBS, INFRA, \u2026"),role:J.string().optional().describe("one-line technical role"),plain:J.string().optional().describe("one plain-language sentence"),files:J.array(J.string()).optional().describe("repo-relative key files"),depends:J.array(J.string()).optional().describe("titles of other components it depends on")})).describe("8-25 main building blocks, not every file"),roadmap:J.array(J.object({title:J.string(),why:J.string().optional(),category:J.string().optional().describe("category for the board (AUTH | SEARCH | DATA | INTEL | \u2026) \u2014 set it so the item isn't category-less"),priority:J.number().int().min(0).max(3).optional().describe("0=P0 critical .. 3=P3 low")})).optional().describe("3-6 broad strategic directions (NOT detailed tasks); each with a `category` + `priority`. Re-runs DEDUPE roadmap features by title, so re-persisting won't double up existing ones."),snapshot:J.object({tables:J.array(J.object({name:J.string(),domain:J.string().optional(),description:J.string().optional(),columns:J.array(J.object({name:J.string(),type:J.string(),isPk:J.boolean().optional(),isFk:J.boolean().optional(),nullable:J.boolean().optional(),note:J.string().optional()}))})).optional(),relations:J.array(J.object({fromTable:J.string(),fromColumn:J.string(),toTable:J.string(),toColumn:J.string(),label:J.string().optional()})).optional(),endpoints:J.array(J.object({method:J.string(),path:J.string(),domain:J.string().optional(),description:J.string().optional(),uses:J.array(J.object({table:J.string(),access:J.string().optional()})).optional()})).optional()}).optional().describe("optional: also seed /db with the schema you discovered from prisma/SQLAlchemy/etc.")}},async($)=>{let Q=await c("/api/init",$);return{content:[{type:"text",text:JSON.stringify(Q)}]}});D.registerTool("beacon_context_for_feature",{description:"Use BEFORE Glob/Grep/Read when starting work on a feature. Returns a single bundle of everything Beacon knows about it: attached files, what those files import + what imports them (1-hop blast radius from the live code graph), endpoints in the feature's domain + the tables each touches, those tables' FK relations, sibling architecture components, and the project's conventions. Saves an entire discovery-phase round of file reads. Match by id (preferred), exact title, or a natural-language query.",inputSchema:{id:J.string().optional().describe("node id from beacon_map (preferred)"),title:J.string().optional().describe("feature title (case-insensitive contains)"),query:J.string().optional().describe("natural-language phrase \u2014 OR-matched against title + plain description")}},async({id:$,title:Q,query:Z})=>{let X=new URLSearchParams;if($)X.set("id",$);if(Q)X.set("title",Q);if(Z)X.set("query",Z);let V=await E(`/api/context/feature?${X.toString()}`);return{content:[{type:"text",text:JSON.stringify(V)}]}});D.registerTool("beacon_blast_radius",{description:"For 'if I change this file, what else cares?' \u2014 returns the file's 1-hop imports + importedBy, the TRANSITIVE blast radius both directions (downstream = who depends on it, upstream = what it depends on, grouped by depth), hub/centrality scoring (inDegree/outDegree + isHub), and every feature/component that has the file attached. Use mid-feature when deciding the impact of a change, or before refactoring a hub file.",inputSchema:{path:J.string().describe("repo-relative POSIX file path"),depth:J.number().optional().describe("how far to walk the transitive graph (default 2, capped at 5)")}},async({path:$,depth:Q})=>{let Z=new URLSearchParams({path:$});if(Q!=null)Z.set("depth",String(Q));let X=await E(`/api/context/file?${Z.toString()}`);return{content:[{type:"text",text:JSON.stringify(X)}]}});D.registerTool("beacon_entities",{description:"Read planning data. `features` = roadmap, `architecture` = components, `tables`/`endpoints` = DB map.",inputSchema:{kind:J.enum(["features","architecture","tables","endpoints"])}},async({kind:$})=>{let Q=await E(`/api/entities?kind=${$}`);return{content:[{type:"text",text:JSON.stringify(Q)}]}});D.registerTool("beacon_propose_plan",{description:"BLOCKS until the user reviews. Pushes a feature plan (top-level roadmap features + DB tables + endpoints) to Beacon's /plan page. Use when the user asks you to plan a feature. EVERY feature MUST include `cluster` (its category) and `priority` (0=P0 critical .. 3=P3 low) \u2014 the tool REJECTS a plan whose features omit either, so set both on every feature. Do not implement code or migrations until this returns approval. If it returns inline feedback, revise and call again.",inputSchema:{description:J.string().describe("Short summary the user will see in the review header"),features:J.array(J.object({title:J.string(),role:J.string().optional().describe("one-line technical role"),plain:J.string().optional().describe("one plain-language sentence for the user"),category:J.string().optional().describe("REQUIRED category for the board (AUTH | SEARCH | BILLING | DATA | INTEL | \u2026)"),cluster:J.string().optional().describe("alias for `category`"),domain:J.string().optional().describe("alias for `category`"),priority:J.number().int().min(0).max(3).optional().describe("REQUIRED priority: 0=P0 critical, 1=P1 high, 2=P2 medium, 3=P3 low"),dependsOn:J.array(J.string()).optional().describe("titles of other features in THIS plan that must ship first \u2014 drawn as 'depends on' links so the board shows the dependency chain, not loose cards")})).optional().describe("the top-level roadmap features this plan adds"),tables:J.array(J.object({name:J.string(),domain:J.string().optional(),description:J.string().optional(),columns:J.array(J.object({name:J.string(),type:J.string(),isPk:J.boolean().optional(),isFk:J.boolean().optional(),nullable:J.boolean().optional(),note:J.string().optional()}))})).optional(),relations:J.array(J.object({fromTable:J.string(),fromColumn:J.string(),toTable:J.string(),toColumn:J.string(),label:J.string().optional()})).optional(),endpoints:J.array(J.object({method:J.string().describe("GET|POST|PUT|PATCH|DELETE"),path:J.string(),domain:J.string().optional(),description:J.string().optional(),uses:J.array(J.object({table:J.string(),access:J.string().optional()})).optional()})).optional()}},async({description:$,features:Q,tables:Z,relations:X,endpoints:V})=>{let H=(M)=>new Promise((T5)=>setTimeout(T5,M)),G=(M)=>({content:[{type:"text",text:M}]}),N=(Z?.length??0)>0,K=(Q??[]).map((M)=>`${M.title} ${M.role??""} ${M.plain??""}`).join(`
235
- `),C=(V?.length??0)>0||O5(`${$}
236
- ${K}`);if(!N&&C)return G("\u26D4 This plan touches the database \u2014 it declares endpoints and/or its text describes "+"models/tables/migrations \u2014 but you passed NO `tables`. Beacon's schema board renders "+"ONLY from structured `tables`; prose is never parsed, so the /db tab would be empty and nothing would persist on approve.\n\nRe-call `beacon_propose_plan` with every table in `tables` (each with its `columns`), the `relations` (FKs), and keep the `endpoints` (each with `uses:[{table,access}]`). Mirror EVERY database entity your plan mentions into the structured fields.");if(Q?.length){let M=C5(Q);if(M)return G(M)}let l=(Z?.length??0)+(V?.length??0)>0;await c("/api/plan",{description:$,draft:l?{tables:Z??[],relations:X??[],endpoints:V??[]}:void 0,features:Q?.length?Q:void 0}),await fetch(`${z0}/api/workspace/activate?id=${B0}`).catch(()=>{});let k5=Date.now()+g0;while(Date.now()<k5){await H(x0);let M=await E("/api/plan/verdict").catch(()=>null);if(!M)continue;if(M.kind==="feedback")return G("\uD83D\uDCAC The user left feedback on the plan in Beacon \u2014 text comments and/or edits they "+"made directly on the /map and /db boards. Read everything below, revise the plan accordingly (matching the board changes verbatim), and call `beacon_propose_plan` "+`again with the revised version \u2014 DO NOT implement yet:
249
+ `)+"\n\nWhen the work ships, register them in ONE call: `beacon_describe_feature` with a "+"`features` array \u2014 one entry per feature"+(Z?", each keyed by the `id` above (no title-matching needed)":"")+", each with the files you touched + a short markdown summary. Do them all in that single "+"batched call so every feature flips to Done \u2014 do NOT register only the umbrella, and do "+"NOT make one call per feature."}var B5=1500,_Z=345600000,K5=1800000,Y9=3000;function X0($){return $.toLowerCase().normalize("NFD").replace(/[\u0300-\u036F]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,50)||"item"}function V9($){return`${X0($.title)}-${$.id.slice(-6)}`}function X9($){return{resources:$.map((Q)=>({uri:`note://${V9(Q)}`,name:Q.title||"Untitled",description:`${Q.title||"Untitled"}${Q.pinned?" \xB7 pinned":""} \xB7 note`,mimeType:"text/markdown"}))}}function H9($,Q){return $.find((Z)=>V9(Z)===Q)}function W9($){let Q=$.body.trim()||"(this note is empty)";return[`# ${$.title||"Untitled"}`,"","_User note from Beacon. To turn it into roadmap work, call `beacon_propose_plan` \u2014"+" checkbox `- [ ]` / `- [x]` items become subtasks, and order the features with `dependsOn`. Do NOT implement until it returns approval._","","---","",Q].join(`
250
+ `)}await T5();var M5=process.env.BEACON_URL||`http://localhost:${process.env.PORT||4319}`,q5=l5(),g0=T0(q5);try{Y5(q5);let $=await H5(g0);if(!$.ok)console.error(`[beacon mcp] db provisioning failed: ${$.error}`)}catch($){console.error(`[beacon mcp] workspace registration failed: ${$ instanceof Error?$.message:$}`)}async function E($,Q){let Z=new Headers(Q?.headers);Z.set("x-beacon-workspace",g0),Z.set(V5,q5);let Y=await fetch(`${M5}${$}`,{...Q,headers:Z}),X=await Y.text();if(!Y.ok)throw Error(`Beacon ${$} -> ${Y.status} ${X}`);return X?JSON.parse(X):null}function d($,Q){return E($,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(Q)})}function G9($){let Q=$ instanceof Error?$.message:String($),Z=Q.match(/\{[\s\S]*\}$/);if(Z)try{let Y=JSON.parse(Z[0]);if(Y?.error)return{content:[{type:"text",text:Y.error}],isError:!0}}catch{}return{content:[{type:"text",text:Q}],isError:!0}}var F=new e$({name:"beacon",version:"0.1.0"});F.registerTool("beacon_map",{description:"List existing features on the roadmap. Call before starting work."},async()=>{let $=await E("/api/map");return{content:[{type:"text",text:JSON.stringify($)}]}});F.registerTool("beacon_start_feature",{description:"Flag that you're working on a feature. If the title matches an existing feature it just marks it IN_PROGRESS (no category needed); if it's NEW it creates the node \u2014 and a new feature REQUIRES a `category`. Call beacon_map first so you reuse an existing feature/category instead of duplicating one.",inputSchema:{title:J.string(),id:J.string().optional().describe("node id from beacon_map (preferred)"),category:J.string().optional().describe("Domain lane for a NEW feature: AUTH | SEARCH | DATA | INTEL | BILLING | INFRA | UI | \u2026 REQUIRED when this creates a new top-level feature; reuse a category already on the board. Ignored when flagging an existing feature or nesting under a `front` (inherits the parent's)."),front:J.string().optional().describe("Title of an EXISTING parent feature to nest this under (draws the parent \u2192 child edge). It must match a real feature \u2014 it is NOT a domain tag (use `category` for the domain). A `front` that matches nothing is REJECTED; create the parent first via beacon_propose_plan."),detail:J.string().optional().describe("One-line plain-language description shown on the canvas card. Replaced later by beacon_describe_feature's markdown when the work is done.")}},async({title:$,id:Q,front:Z,detail:Y,category:X})=>{try{let H=await d("/api/map/start",{title:$,id:Q,front:Z,detail:Y,category:X});return{content:[{type:"text",text:JSON.stringify(H)}]}}catch(H){return G9(H)}});F.registerTool("beacon_add_subtasks",{description:"Add N sub-tasks under an existing feature in one call. Use when the user says 'add these as subtasks to <feature>' or you want to record follow-ups discovered during work. Parent resolves by `parentId` (preferred \u2014 get it from beacon_map / beacon_entities) or by `parentTitle` (fuzzy-matched against top-level features). Children inherit the parent's view and cluster and land in a row beneath it; bumps the sync version so an open /map canvas refreshes.",inputSchema:{parentId:J.string().optional().describe("node id of the parent feature (preferred)"),parentTitle:J.string().optional().describe("fuzzy title of the parent feature; ignored if parentId is provided"),items:J.array(J.object({title:J.string().describe("short sub-task title"),plain:J.string().optional().describe("one-paragraph description / why / acceptance hint")})).describe("the sub-tasks to add")}},async({parentId:$,parentTitle:Q,items:Z})=>{try{let Y=await d("/api/nodes/subtasks",{parentId:$,parentTitle:Q,items:Z});return{content:[{type:"text",text:JSON.stringify(Y)}]}}catch(Y){return G9(Y)}});var U9=J.array(J.object({title:J.string().describe("real component/subsystem name (e.g. 'Plan review loop') \u2014 NEVER a file"),domain:J.string().describe("uppercase lane: PLAN | DATA | UI | MCP | INTEL | \u2026"),role:J.string().optional().describe("one-line technical role"),plain:J.string().optional().describe("one plain-language sentence"),status:J.enum(["KEEP","REBUILD","REPLACE","DROP"]).optional(),files:J.array(J.string()).optional(),depends:J.array(J.string()).optional().describe("titles of components this one depends on"),bugs:J.array(J.object({note:J.string().describe("what was found / worth investigating")})).optional().describe("bugs or things worth investigating you found in this component's code \u2014 flagged on the node (by=agent); identical open flags are not duplicated")})).optional().describe("Only when the feature adds/changes a REAL architectural component \u2014 upserts curated nodes, never one-per-file");F.registerTool("beacon_describe_feature",{description:"Register shipped feature(s) at the end of the work: marks status=DONE, records the files touched (kept on the FEATURE for context), and replaces each node's description with your markdown. Subsumes touch_files + finish_feature. A feature's unfinished SUB-TASKS are completed along with it (cascade; reported as `subtasksCompleted`) \u2014 if a sub-task is genuinely NOT done, set it BLOCKED or CANCELLED via the nodes API/board FIRST, those are left alone (`subtasksBlocked` lists what stayed). REGISTER ALL FEATURES A PLAN CREATED IN ONE CALL via the `features` array (one entry per feature) \u2014 do NOT call this once per feature. Pass each feature's `id` (returned to you at plan approval) so no title-matching is needed. For a single feature you may pass the top-level fields instead. Pass `architecture` only when a feature added/changed a REAL subsystem (never a file).",inputSchema:{features:J.array(J.object({id:J.string().optional().describe("node id from plan approval / beacon_map (preferred over title)"),title:J.string().optional().describe("feature title (fuzzy-matched if no id)"),description:J.string().describe("Markdown: ### Overview ... ### Files - `path` \u2014 what it does"),files:J.array(J.string()).optional().describe("repo-relative files this feature touches"),architecture:U9})).optional().describe("Register many features at once \u2014 one entry per feature, each id-keyed. Use this instead of N separate calls."),description:J.string().optional().describe("Single-feature markdown (omit when using `features`): ### Overview ... ### Files - `path` \u2014 what it does"),files:J.array(J.string()).optional().describe("repo-relative files this feature touches (single form)"),id:J.string().optional().describe("node id from plan approval / beacon_map (preferred over title)"),title:J.string().optional().describe("feature title (fuzzy-matched if no id)"),architecture:U9}},async({features:$,description:Q,files:Z,id:Y,title:X,architecture:H})=>{let W=$?.length?{features:$}:{description:Q,files:Z,id:Y,title:X,architecture:H},G=await d("/api/map/describe",W);return{content:[{type:"text",text:JSON.stringify(G)}]}});F.registerTool("beacon_init_persist",{description:"Use ONLY inside the `beacon-init` skill. After YOU (Claude Code) have read the repo and built the architecture analysis, call this once to persist it into Beacon. Replaces any prior init-derived map. Same DB shape as `beacon_propose_plan` for tables/endpoints, but it commits directly (no /plan review step) because the user explicitly invoked init.",inputSchema:{overview:J.string().optional().describe("one-paragraph summary of the project \u2014 written to ProjectMeta + AGENTS.md"),conventions:J.array(J.string()).optional().describe("3-8 concrete conventions/gotchas a contributor must follow"),components:J.array(J.object({title:J.string(),domain:J.string().describe("short UPPERCASE area: AUTH, API, DATA, UI, JOBS, INFRA, \u2026"),role:J.string().optional().describe("one-line technical role"),plain:J.string().optional().describe("one plain-language sentence"),files:J.array(J.string()).optional().describe("repo-relative key files"),depends:J.array(J.string()).optional().describe("titles of other components it depends on"),bugs:J.array(J.object({note:J.string().describe("what was found / worth investigating")})).optional().describe("bugs or things worth investigating you found while examining this component \u2014 flagged on the node (by=agent)")})).describe("8-25 main building blocks, not every file"),roadmap:J.array(J.object({title:J.string(),why:J.string().optional(),category:J.string().optional().describe("category for the board (AUTH | SEARCH | DATA | INTEL | \u2026) \u2014 set it so the item isn't category-less"),priority:J.number().int().min(0).max(3).optional().describe("0=P0 critical .. 3=P3 low")})).optional().describe("3-6 broad strategic directions (NOT detailed tasks); each with a `category` + `priority`. Re-runs DEDUPE roadmap features by title, so re-persisting won't double up existing ones."),snapshot:J.object({tables:J.array(J.object({name:J.string(),domain:J.string().optional(),description:J.string().optional(),columns:J.array(J.object({name:J.string(),type:J.string(),isPk:J.boolean().optional(),isFk:J.boolean().optional(),nullable:J.boolean().optional(),note:J.string().optional()}))})).optional(),relations:J.array(J.object({fromTable:J.string(),fromColumn:J.string(),toTable:J.string(),toColumn:J.string(),label:J.string().optional()})).optional(),endpoints:J.array(J.object({method:J.string(),path:J.string(),domain:J.string().optional(),description:J.string().optional(),uses:J.array(J.object({table:J.string(),access:J.string().optional()})).optional()})).optional()}).optional().describe("optional: also seed /db with the schema you discovered from prisma/SQLAlchemy/etc.")}},async($)=>{let Q=await d("/api/init",$);return{content:[{type:"text",text:JSON.stringify(Q)}]}});F.registerTool("beacon_context_for_feature",{description:"Use BEFORE Glob/Grep/Read when starting work on a feature. Returns a single bundle of everything Beacon knows about it: attached files, what those files import + what imports them (1-hop blast radius from the live code graph), endpoints in the feature's domain + the tables each touches, those tables' FK relations, sibling architecture components, and the project's conventions. Saves an entire discovery-phase round of file reads. Match by id (preferred), exact title, or a natural-language query.",inputSchema:{id:J.string().optional().describe("node id from beacon_map (preferred)"),title:J.string().optional().describe("feature title (case-insensitive contains)"),query:J.string().optional().describe("natural-language phrase \u2014 OR-matched against title + plain description")}},async({id:$,title:Q,query:Z})=>{let Y=new URLSearchParams;if($)Y.set("id",$);if(Q)Y.set("title",Q);if(Z)Y.set("query",Z);let X=await E(`/api/context/feature?${Y.toString()}`);return{content:[{type:"text",text:JSON.stringify(X)}]}});F.registerTool("beacon_blast_radius",{description:"For 'if I change this file, what else cares?' \u2014 returns the file's 1-hop imports + importedBy, the TRANSITIVE blast radius both directions (downstream = who depends on it, upstream = what it depends on, grouped by depth), hub/centrality scoring (inDegree/outDegree + isHub), and every feature/component that has the file attached. Use mid-feature when deciding the impact of a change, or before refactoring a hub file.",inputSchema:{path:J.string().describe("repo-relative POSIX file path"),depth:J.number().optional().describe("how far to walk the transitive graph (default 2, capped at 5)")}},async({path:$,depth:Q})=>{let Z=new URLSearchParams({path:$});if(Q!=null)Z.set("depth",String(Q));let Y=await E(`/api/context/file?${Z.toString()}`);return{content:[{type:"text",text:JSON.stringify(Y)}]}});F.registerTool("beacon_entities",{description:"Read planning data. `features` = roadmap, `architecture` = components, `tables`/`endpoints` = DB map.",inputSchema:{kind:J.enum(["features","architecture","tables","endpoints"])}},async({kind:$})=>{let Q=await E(`/api/entities?kind=${$}`);return{content:[{type:"text",text:JSON.stringify(Q)}]}});F.registerTool("beacon_propose_plan",{description:"BLOCKS until the user reviews. Pushes a feature plan (top-level roadmap features + DB tables + endpoints) to Beacon's /plan page. Use when the user asks you to plan a feature. EVERY feature MUST include `cluster` (its category) and `priority` (0=P0 critical .. 3=P3 low) \u2014 the tool REJECTS a plan whose features omit either, so set both on every feature. Do not implement code or migrations until this returns approval. If it returns inline feedback, revise and call again.",inputSchema:{description:J.string().describe("Short summary the user will see in the review header"),features:J.array(J.object({title:J.string(),role:J.string().optional().describe("one-line technical role"),plain:J.string().optional().describe("one plain-language sentence for the user"),category:J.string().optional().describe("REQUIRED category for the board (AUTH | SEARCH | BILLING | DATA | INTEL | \u2026)"),cluster:J.string().optional().describe("alias for `category`"),domain:J.string().optional().describe("alias for `category`"),priority:J.number().int().min(0).max(3).optional().describe("REQUIRED priority: 0=P0 critical, 1=P1 high, 2=P2 medium, 3=P3 low"),dependsOn:J.array(J.string()).optional().describe("titles of other features in THIS plan that must ship first \u2014 drawn as 'depends on' links so the board shows the dependency chain, not loose cards")})).optional().describe("the top-level roadmap features this plan adds"),tables:J.array(J.object({name:J.string(),domain:J.string().optional(),description:J.string().optional(),columns:J.array(J.object({name:J.string(),type:J.string(),isPk:J.boolean().optional(),isFk:J.boolean().optional(),nullable:J.boolean().optional(),note:J.string().optional()}))})).optional(),relations:J.array(J.object({fromTable:J.string(),fromColumn:J.string(),toTable:J.string(),toColumn:J.string(),label:J.string().optional()})).optional(),endpoints:J.array(J.object({method:J.string().describe("GET|POST|PUT|PATCH|DELETE"),path:J.string(),domain:J.string().optional(),description:J.string().optional(),uses:J.array(J.object({table:J.string(),access:J.string().optional()})).optional()})).optional()}},async({description:$,features:Q,tables:Z,relations:Y,endpoints:X})=>{let H=(M)=>new Promise((M9)=>setTimeout(M9,M)),W=(M)=>({content:[{type:"text",text:M}]}),G=(Z?.length??0)>0,U=(Q??[]).map((M)=>`${M.title} ${M.role??""} ${M.plain??""}`).join(`
251
+ `),w=(X?.length??0)>0||Z9(`${$}
252
+ ${U}`);if(!G&&w)return W("\u26D4 This plan touches the database \u2014 it declares endpoints and/or its text describes "+"models/tables/migrations \u2014 but you passed NO `tables`. Beacon's schema board renders "+"ONLY from structured `tables`; prose is never parsed, so the /db tab would be empty and nothing would persist on approve.\n\nRe-call `beacon_propose_plan` with every table in `tables` (each with its `columns`), the `relations` (FKs), and keep the `endpoints` (each with `uses:[{table,access}]`). Mirror EVERY database entity your plan mentions into the structured fields.");if(Q?.length){let M=J9(Q);if(M)return W(M)}let s=(Z?.length??0)+(X?.length??0)>0;await d("/api/plan",{description:$,draft:s?{tables:Z??[],relations:Y??[],endpoints:X??[]}:void 0,features:Q?.length?Q:void 0}),await fetch(`${M5}/api/workspace/activate?id=${g0}`).catch(()=>{});let N9=Date.now()+K5;while(Date.now()<N9){await H(B5);let M=await E("/api/plan/verdict").catch(()=>null);if(!M)continue;if(M.kind==="feedback")return W("\uD83D\uDCAC The user left feedback on the plan in Beacon \u2014 text comments and/or edits they "+"made directly on the /map and /db boards. Read everything below, revise the plan accordingly (matching the board changes verbatim), and call `beacon_propose_plan` "+`again with the revised version \u2014 DO NOT implement yet:
237
253
 
238
- `+M.feedback);if(M.kind==="approved")return G(`\u2705 Plan approved by the user. ${M.summary}`+(M.detail?`
254
+ `+M.feedback);if(M.kind==="approved")return W(`\u2705 Plan approved by the user. ${M.summary}`+(M.detail?`
239
255
 
240
256
  Implement EXACTLY the schema below (migrations + code) \u2014 the user may have `+`edited columns on the canvas:
241
257
 
242
- `+M.detail:"")+h0(M.features));if(M.kind==="discarded")return G(`\u274C The user discarded the plan in Beacon. ${M.summary} Ask what they want to adjust before proposing again.`)}return G("Still waiting for the user to review in Beacon. Your plan is preserved \u2014 call "+"`beacon_propose_plan` again with the SAME plan to resume (the verdict is picked up immediately if they've since decided), or ask whether they've reviewed it.")});D.registerTool("beacon_present_plan",{description:"BLOCKS until the user reviews. Pushes ANY plan (as markdown) to Beacon's /plan page so the user reviews it on the canvas instead of in the terminal \u2014 use this whenever you'd otherwise end a turn asking 'does this look right / should I proceed?'. Embed ONE fenced ```beacon block of JSON ({tables,relations,endpoints,features}) for any DB/roadmap entities so they render as an editable board. Returns the verdict (approved / discarded / feedback). Do NOT implement until it returns approval; on feedback, revise and call again. (For a pure schema+features plan, beacon_propose_plan is the structured alternative.)",inputSchema:{description:J.string().describe("One-line summary shown in the review header"),markdown:J.string().describe("The full plan as markdown. Embed a ```beacon block for tables/endpoints/features.")}},async({description:$,markdown:Q})=>{let Z=(H)=>new Promise((G)=>setTimeout(G,H)),X=(H)=>({content:[{type:"text",text:H}]});await c("/api/plan",{description:$,markdown:Q}),await fetch(`${z0}/api/workspace/activate?id=${B0}`).catch(()=>{});let V=Date.now()+g0;while(Date.now()<V){await Z(x0);let H=await E("/api/plan/verdict").catch(()=>null);if(!H)continue;if(H.kind==="feedback")return X("\uD83D\uDCAC The user left feedback on the plan in Beacon (inline comments and/or edits on the "+"/map and /db boards). Revise the plan accordingly and call `beacon_present_plan` "+`again \u2014 do NOT implement yet:
258
+ `+M.detail:"")+P5(M.features));if(M.kind==="discarded")return W(`\u274C The user discarded the plan in Beacon. ${M.summary} Ask what they want to adjust before proposing again.`)}return W("Still waiting for the user to review in Beacon. Your plan is preserved \u2014 call "+"`beacon_propose_plan` again with the SAME plan to resume (the verdict is picked up immediately if they've since decided), or ask whether they've reviewed it.")});F.registerTool("beacon_present_plan",{description:"BLOCKS until the user reviews. Pushes ANY plan (as markdown) to Beacon's /plan page so the user reviews it on the canvas instead of in the terminal \u2014 use this whenever you'd otherwise end a turn asking 'does this look right / should I proceed?'. Embed ONE fenced ```beacon block of JSON ({tables,relations,endpoints,features}) for any DB/roadmap entities so they render as an editable board. Returns the verdict (approved / discarded / feedback). Do NOT implement until it returns approval; on feedback, revise and call again. (For a pure schema+features plan, beacon_propose_plan is the structured alternative.)",inputSchema:{description:J.string().describe("One-line summary shown in the review header"),markdown:J.string().describe("The full plan as markdown. Embed a ```beacon block for tables/endpoints/features.")}},async({description:$,markdown:Q})=>{let Z=(H)=>new Promise((W)=>setTimeout(W,H)),Y=(H)=>({content:[{type:"text",text:H}]});await d("/api/plan",{description:$,markdown:Q}),await fetch(`${M5}/api/workspace/activate?id=${g0}`).catch(()=>{});let X=Date.now()+K5;while(Date.now()<X){await Z(B5);let H=await E("/api/plan/verdict").catch(()=>null);if(!H)continue;if(H.kind==="feedback")return Y("\uD83D\uDCAC The user left feedback on the plan in Beacon (inline comments and/or edits on the "+"/map and /db boards). Revise the plan accordingly and call `beacon_present_plan` "+`again \u2014 do NOT implement yet:
243
259
 
244
- `+H.feedback);if(H.kind==="approved")return X(`\u2705 Plan approved by the user. ${H.summary??""}`.trim()+(H.detail?`
260
+ `+H.feedback);if(H.kind==="approved")return Y(`\u2705 Plan approved by the user. ${H.summary??""}`.trim()+(H.detail?`
245
261
 
246
262
  Implement exactly what's on the board:
247
263
 
248
- ${H.detail}`:"")+h0(H.features));if(H.kind==="discarded")return X(`\u274C The user discarded the plan in Beacon. ${H.summary??""} Ask what they want to adjust before presenting again.`.trim())}return X("Still waiting for the user to review in Beacon. Your plan is preserved \u2014 call "+"`beacon_present_plan` again with the SAME plan to resume, or ask whether they've reviewed it.")});var _5=($)=>Array.isArray($)?$[0]:$;async function G0($){return(await E(`/api/entities?kind=${$}`)).items}function L5($,Q){return{resources:$.map((Z)=>({uri:`${Q}${t(Z.title)}`,name:Z.title,description:`${Z.title}${Z.cluster?` \xB7 ${Z.cluster}`:""} \xB7 ${Z.status}`,mimeType:"text/markdown"}))}}async function I5($,Q,Z){let X=(await G0(Z)).find((N)=>t(N.title)===_5(Q));if(!X)return{contents:[{uri:$.href,mimeType:"text/markdown",text:"(not found)"}]};let H=((await E("/api/entities?kind=tables")).items??[]).map((N)=>N.name),G=[`# ${X.title}`];if(X.cluster)G.push(`*Domain:* \`${X.cluster}\``);if(X.status)G.push(`*Status:* \`${X.status}\``);if(G.push(""),G.push(X.plain?.trim()||"(this node has no description yet \u2014 add one on Beacon's /map page)"),G.push("","## Existing DB tables in this project"),G.push(H.length?H.join(", "):"(none yet)"),Z==="features"){let N=await G0("features"),K=[...new Set(N.map((C)=>C.cluster?.trim()).filter((C)=>!!C))].sort();G.push("","## Existing feature categories \u2014 reuse one before inventing a new one"),G.push(K.length?K.join(", "):"(none yet)"),G.push("","## Beacon feature loop \u2014 follow IN ORDER (do not jump to Glob/Grep/Read)","1. **Load context FIRST.** Call `beacon_context_for_feature({ title })` for this feature BEFORE any Glob/Grep/Read. It returns the attached files, 1-hop import blast radius, the domain's endpoints + tables + FK relations, sibling components, and the project conventions \u2014 and marks this feature active so your edits attach to it. That bundle replaces the discovery phase; Glob is a last resort.","2. **Design data before code.** Identify the tables this feature needs. If ANY are missing from the list above, design the schema and call `beacon_propose_plan` (tables + relations + endpoints, each endpoint with `uses:[{table,access}]`). It BLOCKS until the user approves on /plan \u2014 do NOT write migrations or code until it returns approval.","3. **Register at the end \u2014 in ONE call.** When the work is done, call `beacon_describe_feature` ONCE with a `features` array (one entry per feature the plan created, each keyed by the `id` you got back at approval, with the files you touched + a short markdown summary). Don't make one call per feature, and don't register only the umbrella \u2014 that leaves the rest Pending.")}return{contents:[{uri:$.href,mimeType:"text/markdown",text:G.join(`
249
- `)}]}}D.registerResource("beacon-feature",new f0("feature://{slug}",{list:async()=>L5(await G0("features"),"feature://")}),{title:"Beacon: features",description:"Roadmap features \u2014 picking one imports the node's description plus existing-DB context.",mimeType:"text/markdown"},($,{slug:Q})=>I5($,Q,"features"));D.registerResource("beacon-component",new f0("component://{slug}",{list:async()=>L5(await G0("architecture"),"component://")}),{title:"Beacon: architecture",description:"Architecture components \u2014 picking one imports 'what the agent sees'.",mimeType:"text/markdown"},($,{slug:Q})=>I5($,Q,"architecture"));async function R5(){return await E("/api/notes")}D.registerResource("beacon-note",new f0("note://{slug}",{list:async()=>D5(await R5())}),{title:"Beacon: notes",description:"Your Beacon notes \u2014 picking one imports its markdown verbatim so you can turn it into features.",mimeType:"text/markdown"},async($,{slug:Q})=>{let Z=F5(await R5(),_5(Q)),X=Z?v5(Z):"(not found)";return{contents:[{uri:$.href,mimeType:"text/markdown",text:X}]}});await D.connect(new Q$);var H0=-1;setInterval(async()=>{try{let{version:$}=await E("/api/version");if(H0===-1)H0=$;else if($!==H0)H0=$,D.sendResourceListChanged()}catch{}},w5);
264
+ ${H.detail}`:"")+P5(H.features));if(H.kind==="discarded")return Y(`\u274C The user discarded the plan in Beacon. ${H.summary??""} Ask what they want to adjust before presenting again.`.trim())}return Y("Still waiting for the user to review in Beacon. Your plan is preserved \u2014 call "+"`beacon_present_plan` again with the SAME plan to resume, or ask whether they've reviewed it.")});var P9=($)=>Array.isArray($)?$[0]:$;async function k0($){return(await E(`/api/entities?kind=${$}`)).items}function B9($,Q){return{resources:$.map((Z)=>({uri:`${Q}${X0(Z.title)}`,name:Z.title,description:`${Z.title}${Z.cluster?` \xB7 ${Z.cluster}`:""} \xB7 ${Z.status}`,mimeType:"text/markdown"}))}}async function K9($,Q,Z){let Y=(await k0(Z)).find((G)=>X0(G.title)===P9(Q));if(!Y)return{contents:[{uri:$.href,mimeType:"text/markdown",text:"(not found)"}]};let H=((await E("/api/entities?kind=tables")).items??[]).map((G)=>G.name),W=[`# ${Y.title}`];if(Y.cluster)W.push(`*Domain:* \`${Y.cluster}\``);if(Y.status)W.push(`*Status:* \`${Y.status}\``);if(W.push(""),W.push(Y.plain?.trim()||"(this node has no description yet \u2014 add one on Beacon's /map page)"),W.push("","## Existing DB tables in this project"),W.push(H.length?H.join(", "):"(none yet)"),Z==="features"){let G=await k0("features"),U=[...new Set(G.map((w)=>w.cluster?.trim()).filter((w)=>!!w))].sort();W.push("","## Existing feature categories \u2014 reuse one before inventing a new one"),W.push(U.length?U.join(", "):"(none yet)"),W.push("","## Beacon feature loop \u2014 follow IN ORDER (do not jump to Glob/Grep/Read)","1. **Load context FIRST.** Call `beacon_context_for_feature({ title })` for this feature BEFORE any Glob/Grep/Read. It returns the attached files, 1-hop import blast radius, the domain's endpoints + tables + FK relations, sibling components, and the project conventions \u2014 and marks this feature active so your edits attach to it. That bundle replaces the discovery phase; Glob is a last resort.","2. **Design data before code.** Identify the tables this feature needs. If ANY are missing from the list above, design the schema and call `beacon_propose_plan` (tables + relations + endpoints, each endpoint with `uses:[{table,access}]`). It BLOCKS until the user approves on /plan \u2014 do NOT write migrations or code until it returns approval.","3. **Register at the end \u2014 in ONE call.** When the work is done, call `beacon_describe_feature` ONCE with a `features` array (one entry per feature the plan created, each keyed by the `id` you got back at approval, with the files you touched + a short markdown summary). Don't make one call per feature, and don't register only the umbrella \u2014 that leaves the rest Pending.")}return{contents:[{uri:$.href,mimeType:"text/markdown",text:W.join(`
265
+ `)}]}}F.registerResource("beacon-feature",new N5("feature://{slug}",{list:async()=>B9(await k0("features"),"feature://")}),{title:"Beacon: features",description:"Roadmap features \u2014 picking one imports the node's description plus existing-DB context.",mimeType:"text/markdown"},($,{slug:Q})=>K9($,Q,"features"));F.registerResource("beacon-component",new N5("component://{slug}",{list:async()=>B9(await k0("architecture"),"component://")}),{title:"Beacon: architecture",description:"Architecture components \u2014 picking one imports 'what the agent sees'.",mimeType:"text/markdown"},($,{slug:Q})=>K9($,Q,"architecture"));async function j9(){return await E("/api/notes")}F.registerResource("beacon-note",new N5("note://{slug}",{list:async()=>X9(await j9())}),{title:"Beacon: notes",description:"Your Beacon notes \u2014 picking one imports its markdown verbatim so you can turn it into features.",mimeType:"text/markdown"},async($,{slug:Q})=>{let Z=H9(await j9(),P9(Q)),Y=Z?W9(Z):"(not found)";return{contents:[{uri:$.href,mimeType:"text/markdown",text:Y}]}});await F.connect(new $Q);var _0=-1;setInterval(async()=>{try{let{version:$}=await E("/api/version");if(_0===-1)_0=$;else if($!==_0)_0=$,F.sendResourceListChanged()}catch{}},Y9);