trybeacon 0.1.33 → 0.1.35

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 (330) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +14 -13
  3. package/.next/build-manifest.json +2 -2
  4. package/.next/prerender-manifest.json +3 -3
  5. package/.next/routes-manifest.json +6 -0
  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/board-layout/route.js +1 -1
  29. package/.next/server/app/api/bug-flags/[id]/route.js +1 -1
  30. package/.next/server/app/api/bug-flags/route.js +1 -1
  31. package/.next/server/app/api/code-graph/position/route.js +1 -1
  32. package/.next/server/app/api/code-graph/route.js +1 -1
  33. package/.next/server/app/api/context/feature/route.js +1 -1
  34. package/.next/server/app/api/context/file/route.js +1 -1
  35. package/.next/server/app/api/context/route.js +2 -2
  36. package/.next/server/app/api/db/arrange/route.js +1 -1
  37. package/.next/server/app/api/db/backfill-access/route.js +1 -1
  38. package/.next/server/app/api/db/position/route.js +1 -1
  39. package/.next/server/app/api/db/position/route.js.nft.json +1 -1
  40. package/.next/server/app/api/db/prune-planned/route.js +1 -1
  41. package/.next/server/app/api/db/reconcile-endpoints/route.js +1 -1
  42. package/.next/server/app/api/db/relations/[id]/route.js +1 -1
  43. package/.next/server/app/api/db/tables/[id]/route.js +1 -1
  44. package/.next/server/app/api/draft/approve/route.js +1 -1
  45. package/.next/server/app/api/draft/route.js +1 -1
  46. package/.next/server/app/api/draft/status/route.js +1 -1
  47. package/.next/server/app/api/edges/[id]/route.js +1 -1
  48. package/.next/server/app/api/edges/route.js +1 -1
  49. package/.next/server/app/api/edges/route.js.nft.json +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/init/route.js.nft.json +1 -1
  58. package/.next/server/app/api/map/describe/route.js +2 -2
  59. package/.next/server/app/api/map/describe/route.js.nft.json +1 -1
  60. package/.next/server/app/api/map/files/route.js +1 -1
  61. package/.next/server/app/api/map/files/route.js.nft.json +1 -1
  62. package/.next/server/app/api/map/finish/route.js +1 -1
  63. package/.next/server/app/api/map/finish/route.js.nft.json +1 -1
  64. package/.next/server/app/api/map/route.js +1 -1
  65. package/.next/server/app/api/map/route.js.nft.json +1 -1
  66. package/.next/server/app/api/map/start/route.js +1 -1
  67. package/.next/server/app/api/map/start/route.js.nft.json +1 -1
  68. package/.next/server/app/api/map/touch-active/route.js +1 -1
  69. package/.next/server/app/api/map/touch-active/route.js.nft.json +1 -1
  70. package/.next/server/app/api/nodes/[id]/position/route.js +1 -1
  71. package/.next/server/app/api/nodes/[id]/position/route.js.nft.json +1 -1
  72. package/.next/server/app/api/nodes/[id]/route.js +1 -1
  73. package/.next/server/app/api/nodes/[id]/route.js.nft.json +1 -1
  74. package/.next/server/app/api/nodes/positions/route.js +1 -1
  75. package/.next/server/app/api/nodes/positions/route.js.nft.json +1 -1
  76. package/.next/server/app/api/nodes/route.js +1 -1
  77. package/.next/server/app/api/nodes/route.js.nft.json +1 -1
  78. package/.next/server/app/api/nodes/subtasks/route.js +1 -1
  79. package/.next/server/app/api/nodes/subtasks/route.js.nft.json +1 -1
  80. package/.next/server/app/api/notes/[id]/route.js +1 -1
  81. package/.next/server/app/api/notes/route.js +1 -1
  82. package/.next/server/app/api/open/route.js +1 -1
  83. package/.next/server/app/api/plan/annotations/route.js +3 -3
  84. package/.next/server/app/api/plan/approve/route.js +2 -2
  85. package/.next/server/app/api/plan/history/route.js +1 -1
  86. package/.next/server/app/api/plan/markdown/route.js +1 -1
  87. package/.next/server/app/api/plan/markdown/route.js.nft.json +1 -1
  88. package/.next/server/app/api/plan/presence/route.js +1 -1
  89. package/.next/server/app/api/plan/route.js +1 -1
  90. package/.next/server/app/api/plan/route.js.nft.json +1 -1
  91. package/.next/server/app/api/plan/verdict/route.js +1 -1
  92. package/.next/server/app/api/preferences/route.js +1 -1
  93. package/.next/server/app/api/project-meta/route.js +1 -0
  94. package/.next/server/app/api/project-meta/route.js.nft.json +1 -0
  95. package/.next/server/app/api/project-meta/route_client-reference-manifest.js +1 -0
  96. package/.next/server/app/api/reset/route.js +1 -1
  97. package/.next/server/app/api/stream/route.js +2 -2
  98. package/.next/server/app/api/version/route.js +1 -1
  99. package/.next/server/app/api/workspace/activate/route.js +1 -1
  100. package/.next/server/app/api/workspace/route.js +1 -1
  101. package/.next/server/app/apple-icon.png/route.js +1 -1
  102. package/.next/server/app/docs/page.js +2 -2
  103. package/.next/server/app/docs/page_client-reference-manifest.js +1 -1
  104. package/.next/server/app/docs.html +1 -1
  105. package/.next/server/app/docs.rsc +2 -2
  106. package/.next/server/app/docs.segments/_full.segment.rsc +2 -2
  107. package/.next/server/app/docs.segments/_head.segment.rsc +1 -1
  108. package/.next/server/app/docs.segments/_index.segment.rsc +2 -2
  109. package/.next/server/app/docs.segments/_tree.segment.rsc +2 -2
  110. package/.next/server/app/docs.segments/docs/__PAGE__.segment.rsc +1 -1
  111. package/.next/server/app/docs.segments/docs.segment.rsc +1 -1
  112. package/.next/server/app/feedback/page.js +2 -2
  113. package/.next/server/app/feedback/page_client-reference-manifest.js +1 -1
  114. package/.next/server/app/feedback.html +1 -1
  115. package/.next/server/app/feedback.rsc +2 -2
  116. package/.next/server/app/feedback.segments/_full.segment.rsc +2 -2
  117. package/.next/server/app/feedback.segments/_head.segment.rsc +1 -1
  118. package/.next/server/app/feedback.segments/_index.segment.rsc +2 -2
  119. package/.next/server/app/feedback.segments/_tree.segment.rsc +2 -2
  120. package/.next/server/app/feedback.segments/feedback/__PAGE__.segment.rsc +1 -1
  121. package/.next/server/app/feedback.segments/feedback.segment.rsc +1 -1
  122. package/.next/server/app/help/page.js +2 -2
  123. package/.next/server/app/help/page.js.nft.json +1 -1
  124. package/.next/server/app/help/page_client-reference-manifest.js +1 -1
  125. package/.next/server/app/help.html +1 -1
  126. package/.next/server/app/help.rsc +2 -2
  127. package/.next/server/app/help.segments/_full.segment.rsc +2 -2
  128. package/.next/server/app/help.segments/_head.segment.rsc +1 -1
  129. package/.next/server/app/help.segments/_index.segment.rsc +2 -2
  130. package/.next/server/app/help.segments/_tree.segment.rsc +2 -2
  131. package/.next/server/app/help.segments/help/__PAGE__.segment.rsc +1 -1
  132. package/.next/server/app/help.segments/help.segment.rsc +1 -1
  133. package/.next/server/app/icon.svg/route.js +1 -1
  134. package/.next/server/app/index.html +1 -1
  135. package/.next/server/app/index.rsc +2 -2
  136. package/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  137. package/.next/server/app/index.segments/_full.segment.rsc +2 -2
  138. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  139. package/.next/server/app/index.segments/_index.segment.rsc +2 -2
  140. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  141. package/.next/server/app/map/page.js +2 -2
  142. package/.next/server/app/map/page.js.nft.json +1 -1
  143. package/.next/server/app/map/page_client-reference-manifest.js +1 -1
  144. package/.next/server/app/page.js +2 -2
  145. package/.next/server/app/page_client-reference-manifest.js +1 -1
  146. package/.next/server/app/plan/page.js +2 -2
  147. package/.next/server/app/plan/page.js.nft.json +1 -1
  148. package/.next/server/app/plan/page_client-reference-manifest.js +1 -1
  149. package/.next/server/app/settings/page.js +2 -2
  150. package/.next/server/app/settings/page.js.nft.json +1 -1
  151. package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  152. package/.next/server/app-paths-manifest.json +14 -13
  153. package/.next/server/chunks/1130.js +1 -0
  154. package/.next/server/chunks/1341.js +1 -0
  155. package/.next/server/chunks/249.js +1 -1
  156. package/.next/server/chunks/2933.js +1 -1
  157. package/.next/server/chunks/{4274.js → 3269.js} +2 -2
  158. package/.next/server/chunks/3622.js +1 -0
  159. package/.next/server/chunks/4378.js +1 -1
  160. package/.next/server/chunks/4940.js +1 -0
  161. package/.next/server/chunks/7154.js +1 -0
  162. package/.next/server/chunks/9213.js +1 -1
  163. package/.next/server/chunks/9313.js +3 -3
  164. package/.next/server/chunks/9683.js +1 -1
  165. package/.next/server/chunks/9734.js +1 -1
  166. package/.next/server/middleware-build-manifest.js +1 -1
  167. package/.next/server/middleware.js +3 -3
  168. package/.next/server/pages/404.html +1 -1
  169. package/.next/server/pages/500.html +1 -1
  170. package/.next/server/server-reference-manifest.js +1 -1
  171. package/.next/server/server-reference-manifest.json +1 -1
  172. package/.next/static/chunks/1551-c19a41da7732c31e.js +1 -0
  173. package/.next/static/chunks/{1202-dfeac8ec49693586.js → 6955-c21412b6dcd86d80.js} +1 -1
  174. package/.next/static/chunks/app/_global-error/page-68515a67eece5248.js +1 -0
  175. package/.next/static/chunks/app/api/board-annotations/[id]/route-68515a67eece5248.js +1 -0
  176. package/.next/static/chunks/app/api/board-annotations/route-68515a67eece5248.js +1 -0
  177. package/.next/static/chunks/app/api/board-layout/route-68515a67eece5248.js +1 -0
  178. package/.next/static/chunks/app/api/bug-flags/[id]/route-68515a67eece5248.js +1 -0
  179. package/.next/static/chunks/app/api/bug-flags/route-68515a67eece5248.js +1 -0
  180. package/.next/static/chunks/app/api/code-graph/position/route-68515a67eece5248.js +1 -0
  181. package/.next/static/chunks/app/api/code-graph/route-68515a67eece5248.js +1 -0
  182. package/.next/static/chunks/app/api/context/feature/route-68515a67eece5248.js +1 -0
  183. package/.next/static/chunks/app/api/context/file/route-68515a67eece5248.js +1 -0
  184. package/.next/static/chunks/app/api/context/route-68515a67eece5248.js +1 -0
  185. package/.next/static/chunks/app/api/db/arrange/route-68515a67eece5248.js +1 -0
  186. package/.next/static/chunks/app/api/db/backfill-access/route-68515a67eece5248.js +1 -0
  187. package/.next/static/chunks/app/api/db/position/route-68515a67eece5248.js +1 -0
  188. package/.next/static/chunks/app/api/db/prune-planned/route-68515a67eece5248.js +1 -0
  189. package/.next/static/chunks/app/api/db/reconcile-endpoints/route-68515a67eece5248.js +1 -0
  190. package/.next/static/chunks/app/api/db/relations/[id]/route-68515a67eece5248.js +1 -0
  191. package/.next/static/chunks/app/api/db/tables/[id]/route-68515a67eece5248.js +1 -0
  192. package/.next/static/chunks/app/api/draft/approve/route-68515a67eece5248.js +1 -0
  193. package/.next/static/chunks/app/api/draft/route-68515a67eece5248.js +1 -0
  194. package/.next/static/chunks/app/api/draft/status/route-68515a67eece5248.js +1 -0
  195. package/.next/static/chunks/app/api/edges/[id]/route-68515a67eece5248.js +1 -0
  196. package/.next/static/chunks/app/api/edges/route-68515a67eece5248.js +1 -0
  197. package/.next/static/chunks/app/api/endpoints/[id]/route-68515a67eece5248.js +1 -0
  198. package/.next/static/chunks/app/api/entities/route-68515a67eece5248.js +1 -0
  199. package/.next/static/chunks/app/api/feedback/[id]/route-68515a67eece5248.js +1 -0
  200. package/.next/static/chunks/app/api/feedback/[id]/vote/route-68515a67eece5248.js +1 -0
  201. package/.next/static/chunks/app/api/feedback/route-68515a67eece5248.js +1 -0
  202. package/.next/static/chunks/app/api/ingest/route-68515a67eece5248.js +1 -0
  203. package/.next/static/chunks/app/api/init/route-68515a67eece5248.js +1 -0
  204. package/.next/static/chunks/app/api/map/describe/route-68515a67eece5248.js +1 -0
  205. package/.next/static/chunks/app/api/map/files/route-68515a67eece5248.js +1 -0
  206. package/.next/static/chunks/app/api/map/finish/route-68515a67eece5248.js +1 -0
  207. package/.next/static/chunks/app/api/map/route-68515a67eece5248.js +1 -0
  208. package/.next/static/chunks/app/api/map/start/route-68515a67eece5248.js +1 -0
  209. package/.next/static/chunks/app/api/map/touch-active/route-68515a67eece5248.js +1 -0
  210. package/.next/static/chunks/app/api/nodes/[id]/position/route-68515a67eece5248.js +1 -0
  211. package/.next/static/chunks/app/api/nodes/[id]/route-68515a67eece5248.js +1 -0
  212. package/.next/static/chunks/app/api/nodes/positions/route-68515a67eece5248.js +1 -0
  213. package/.next/static/chunks/app/api/nodes/route-68515a67eece5248.js +1 -0
  214. package/.next/static/chunks/app/api/nodes/subtasks/route-68515a67eece5248.js +1 -0
  215. package/.next/static/chunks/app/api/notes/[id]/route-68515a67eece5248.js +1 -0
  216. package/.next/static/chunks/app/api/notes/route-68515a67eece5248.js +1 -0
  217. package/.next/static/chunks/app/api/open/route-68515a67eece5248.js +1 -0
  218. package/.next/static/chunks/app/api/plan/annotations/route-68515a67eece5248.js +1 -0
  219. package/.next/static/chunks/app/api/plan/approve/route-68515a67eece5248.js +1 -0
  220. package/.next/static/chunks/app/api/plan/history/route-68515a67eece5248.js +1 -0
  221. package/.next/static/chunks/app/api/plan/markdown/route-68515a67eece5248.js +1 -0
  222. package/.next/static/chunks/app/api/plan/presence/route-68515a67eece5248.js +1 -0
  223. package/.next/static/chunks/app/api/plan/route-68515a67eece5248.js +1 -0
  224. package/.next/static/chunks/app/api/plan/verdict/route-68515a67eece5248.js +1 -0
  225. package/.next/static/chunks/app/api/preferences/route-68515a67eece5248.js +1 -0
  226. package/.next/static/chunks/app/api/project-meta/route-68515a67eece5248.js +1 -0
  227. package/.next/static/chunks/app/api/reset/route-68515a67eece5248.js +1 -0
  228. package/.next/static/chunks/app/api/stream/route-68515a67eece5248.js +1 -0
  229. package/.next/static/chunks/app/api/version/route-68515a67eece5248.js +1 -0
  230. package/.next/static/chunks/app/api/workspace/activate/route-68515a67eece5248.js +1 -0
  231. package/.next/static/chunks/app/api/workspace/route-68515a67eece5248.js +1 -0
  232. package/.next/static/chunks/app/map/page-8417d6e5dc33e7fb.js +1 -0
  233. package/.next/static/chunks/app/plan/page-af54cdc9fb6058a3.js +1 -0
  234. package/.next/static/chunks/next/dist/client/components/builtin/app-error-68515a67eece5248.js +1 -0
  235. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-68515a67eece5248.js +1 -0
  236. package/.next/static/chunks/next/dist/client/components/builtin/not-found-68515a67eece5248.js +1 -0
  237. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-68515a67eece5248.js +1 -0
  238. package/.next/static/css/496162fa86c30a1d.css +1 -0
  239. package/.next/static/p7RuAgL_wa-K9PsrN1Js0/_buildManifest.js +1 -0
  240. package/.next/trace +38 -38
  241. package/.next/trace-build +1 -1
  242. package/.next/types/app/api/{plan → project-meta}/route.ts +3 -3
  243. package/.next/types/routes.d.ts +2 -1
  244. package/.next/types/validator.ts +9 -0
  245. package/dist/bin/beacon.js +9 -6
  246. package/dist/bin/doctor.js +31 -28
  247. package/dist/bin/hook.js +28 -25
  248. package/dist/bin/mcp.js +40 -37
  249. package/dist/bin/plan.js +31 -28
  250. package/dist/bin/remove.js +6 -6
  251. package/dist/bin/uninstall.js +30 -27
  252. package/dist/lib/assets.js +6 -3
  253. package/dist/lib/codex-install.js +6 -3
  254. package/dist/lib/global-install.js +6 -3
  255. package/dist/lib/release.js +2 -0
  256. package/dist/lib/semver.js +2 -0
  257. package/dist/lib/workspaces.js +1 -1
  258. package/drizzle/0006_optimal_chronomancer.sql +2 -0
  259. package/drizzle/meta/0006_snapshot.json +1765 -0
  260. package/drizzle/meta/_journal.json +7 -0
  261. package/package.json +1 -1
  262. package/.next/server/chunks/7138.js +0 -1
  263. package/.next/server/chunks/7373.js +0 -1
  264. package/.next/static/chunks/8252-326851ad274762f5.js +0 -1
  265. package/.next/static/chunks/app/_global-error/page-4cdc03c65547f289.js +0 -1
  266. package/.next/static/chunks/app/api/board-annotations/[id]/route-4cdc03c65547f289.js +0 -1
  267. package/.next/static/chunks/app/api/board-annotations/route-4cdc03c65547f289.js +0 -1
  268. package/.next/static/chunks/app/api/board-layout/route-4cdc03c65547f289.js +0 -1
  269. package/.next/static/chunks/app/api/bug-flags/[id]/route-4cdc03c65547f289.js +0 -1
  270. package/.next/static/chunks/app/api/bug-flags/route-4cdc03c65547f289.js +0 -1
  271. package/.next/static/chunks/app/api/code-graph/position/route-4cdc03c65547f289.js +0 -1
  272. package/.next/static/chunks/app/api/code-graph/route-4cdc03c65547f289.js +0 -1
  273. package/.next/static/chunks/app/api/context/feature/route-4cdc03c65547f289.js +0 -1
  274. package/.next/static/chunks/app/api/context/file/route-4cdc03c65547f289.js +0 -1
  275. package/.next/static/chunks/app/api/context/route-4cdc03c65547f289.js +0 -1
  276. package/.next/static/chunks/app/api/db/arrange/route-4cdc03c65547f289.js +0 -1
  277. package/.next/static/chunks/app/api/db/backfill-access/route-4cdc03c65547f289.js +0 -1
  278. package/.next/static/chunks/app/api/db/position/route-4cdc03c65547f289.js +0 -1
  279. package/.next/static/chunks/app/api/db/prune-planned/route-4cdc03c65547f289.js +0 -1
  280. package/.next/static/chunks/app/api/db/reconcile-endpoints/route-4cdc03c65547f289.js +0 -1
  281. package/.next/static/chunks/app/api/db/relations/[id]/route-4cdc03c65547f289.js +0 -1
  282. package/.next/static/chunks/app/api/db/tables/[id]/route-4cdc03c65547f289.js +0 -1
  283. package/.next/static/chunks/app/api/draft/approve/route-4cdc03c65547f289.js +0 -1
  284. package/.next/static/chunks/app/api/draft/route-4cdc03c65547f289.js +0 -1
  285. package/.next/static/chunks/app/api/draft/status/route-4cdc03c65547f289.js +0 -1
  286. package/.next/static/chunks/app/api/edges/[id]/route-4cdc03c65547f289.js +0 -1
  287. package/.next/static/chunks/app/api/edges/route-4cdc03c65547f289.js +0 -1
  288. package/.next/static/chunks/app/api/endpoints/[id]/route-4cdc03c65547f289.js +0 -1
  289. package/.next/static/chunks/app/api/entities/route-4cdc03c65547f289.js +0 -1
  290. package/.next/static/chunks/app/api/feedback/[id]/route-4cdc03c65547f289.js +0 -1
  291. package/.next/static/chunks/app/api/feedback/[id]/vote/route-4cdc03c65547f289.js +0 -1
  292. package/.next/static/chunks/app/api/feedback/route-4cdc03c65547f289.js +0 -1
  293. package/.next/static/chunks/app/api/ingest/route-4cdc03c65547f289.js +0 -1
  294. package/.next/static/chunks/app/api/init/route-4cdc03c65547f289.js +0 -1
  295. package/.next/static/chunks/app/api/map/describe/route-4cdc03c65547f289.js +0 -1
  296. package/.next/static/chunks/app/api/map/files/route-4cdc03c65547f289.js +0 -1
  297. package/.next/static/chunks/app/api/map/finish/route-4cdc03c65547f289.js +0 -1
  298. package/.next/static/chunks/app/api/map/route-4cdc03c65547f289.js +0 -1
  299. package/.next/static/chunks/app/api/map/start/route-4cdc03c65547f289.js +0 -1
  300. package/.next/static/chunks/app/api/map/touch-active/route-4cdc03c65547f289.js +0 -1
  301. package/.next/static/chunks/app/api/nodes/[id]/position/route-4cdc03c65547f289.js +0 -1
  302. package/.next/static/chunks/app/api/nodes/[id]/route-4cdc03c65547f289.js +0 -1
  303. package/.next/static/chunks/app/api/nodes/positions/route-4cdc03c65547f289.js +0 -1
  304. package/.next/static/chunks/app/api/nodes/route-4cdc03c65547f289.js +0 -1
  305. package/.next/static/chunks/app/api/nodes/subtasks/route-4cdc03c65547f289.js +0 -1
  306. package/.next/static/chunks/app/api/notes/[id]/route-4cdc03c65547f289.js +0 -1
  307. package/.next/static/chunks/app/api/notes/route-4cdc03c65547f289.js +0 -1
  308. package/.next/static/chunks/app/api/open/route-4cdc03c65547f289.js +0 -1
  309. package/.next/static/chunks/app/api/plan/annotations/route-4cdc03c65547f289.js +0 -1
  310. package/.next/static/chunks/app/api/plan/approve/route-4cdc03c65547f289.js +0 -1
  311. package/.next/static/chunks/app/api/plan/history/route-4cdc03c65547f289.js +0 -1
  312. package/.next/static/chunks/app/api/plan/markdown/route-4cdc03c65547f289.js +0 -1
  313. package/.next/static/chunks/app/api/plan/presence/route-4cdc03c65547f289.js +0 -1
  314. package/.next/static/chunks/app/api/plan/route-4cdc03c65547f289.js +0 -1
  315. package/.next/static/chunks/app/api/plan/verdict/route-4cdc03c65547f289.js +0 -1
  316. package/.next/static/chunks/app/api/preferences/route-4cdc03c65547f289.js +0 -1
  317. package/.next/static/chunks/app/api/reset/route-4cdc03c65547f289.js +0 -1
  318. package/.next/static/chunks/app/api/stream/route-4cdc03c65547f289.js +0 -1
  319. package/.next/static/chunks/app/api/version/route-4cdc03c65547f289.js +0 -1
  320. package/.next/static/chunks/app/api/workspace/activate/route-4cdc03c65547f289.js +0 -1
  321. package/.next/static/chunks/app/api/workspace/route-4cdc03c65547f289.js +0 -1
  322. package/.next/static/chunks/app/map/page-ac03f88297a40d47.js +0 -1
  323. package/.next/static/chunks/app/plan/page-47e880f3e83a2753.js +0 -1
  324. package/.next/static/chunks/next/dist/client/components/builtin/app-error-4cdc03c65547f289.js +0 -1
  325. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-4cdc03c65547f289.js +0 -1
  326. package/.next/static/chunks/next/dist/client/components/builtin/not-found-4cdc03c65547f289.js +0 -1
  327. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-4cdc03c65547f289.js +0 -1
  328. package/.next/static/css/cb2ba3334a6b2336.css +0 -1
  329. package/.next/static/kJSpkyKRHr2jFBQoOGP8P/_buildManifest.js +0 -1
  330. /package/.next/static/{kJSpkyKRHr2jFBQoOGP8P → p7RuAgL_wa-K9PsrN1Js0}/_ssgManifest.js +0 -0
package/dist/bin/plan.js CHANGED
@@ -1,21 +1,21 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- var xZ=Object.defineProperty;var GZ=(Q)=>Q;function KZ(Q,Z){this[Q]=GZ.bind(null,Z)}var $Q=(Q,Z)=>{for(var $ in Z)xZ(Q,$,{get:Z[$],enumerable:!0,configurable:!0,set:KZ.bind(Z,$)})};var T=(Q,Z)=>()=>(Q&&(Z=Q(Q=0)),Z);var zQ={};$Q(zQ,{removeRepoAssets:()=>uZ,installRefreshSkill:()=>vZ,installPlanSkill:()=>CZ,installInitSkill:()=>NZ,installCodexRepoSkills:()=>TZ,ensureWorkflowDoc:()=>gZ,ensureMcp:()=>wZ,auditRepo:()=>FZ,REFRESH_SKILL:()=>JQ,PLAN_SKILL:()=>bQ,INIT_SKILL:()=>YQ});import{existsSync as v,mkdirSync as D,readFileSync as P,rmSync as b,writeFileSync as H}from"fs";import{join as W}from"path";function NZ(Q){let Z=W(Q,".claude","skills","beacon-init");D(Z,{recursive:!0});let $=W(Z,"SKILL.md");return H($,YQ),$}function vZ(Q){let Z=W(Q,".claude","skills","beacon-refresh");D(Z,{recursive:!0});let $=W(Z,"SKILL.md");return H($,JQ),$}function CZ(Q){let Z=W(Q,".claude","skills","beacon-plan");D(Z,{recursive:!0});let $=W(Z,"SKILL.md");return H($,bQ),$}function TZ(Q){let Z=[];for(let $ of MZ){let Y=W(Q,".agents","skills",$.name);D(Y,{recursive:!0});let J=W(Y,"SKILL.md");H(J,$.body()),Z.push(J)}return Z}function gZ(Q){let Z=W(Q,"AGENTS.md"),$="";try{$=P(Z,"utf8")}catch{}let Y=new RegExp(`${I}[\\s\\S]*?${VQ}`);$=Y.test($)?$.replace(Y,fQ):`${$.trim()}
3
+ var gZ=Object.defineProperty;var uZ=(Q)=>Q;function wZ(Q,Z){this[Q]=uZ.bind(null,Z)}var YQ=(Q,Z)=>{for(var $ in Z)gZ(Q,$,{get:Z[$],enumerable:!0,configurable:!0,set:wZ.bind(Z,$)})};var T=(Q,Z)=>()=>(Q&&(Z=Q(Q=0)),Z);var qQ={};YQ(qQ,{removeRepoAssets:()=>OZ,installRefreshSkill:()=>RZ,installPlanSkill:()=>fZ,installInitSkill:()=>FZ,installCodexRepoSkills:()=>IZ,ensureWorkflowDoc:()=>AZ,ensureMcp:()=>EZ,auditRepo:()=>DZ,REFRESH_SKILL:()=>VQ,PLAN_SKILL:()=>DQ,INIT_SKILL:()=>JQ});import{existsSync as v,mkdirSync as A,readFileSync as j,rmSync as I,writeFileSync as H}from"fs";import{join as U}from"path";function FZ(Q){let Z=U(Q,".claude","skills","beacon-init");A(Z,{recursive:!0});let $=U(Z,"SKILL.md");return H($,JQ),$}function RZ(Q){let Z=U(Q,".claude","skills","beacon-refresh");A(Z,{recursive:!0});let $=U(Z,"SKILL.md");return H($,VQ),$}function fZ(Q){let Z=U(Q,".claude","skills","beacon-plan");A(Z,{recursive:!0});let $=U(Z,"SKILL.md");return H($,DQ),$}function IZ(Q){let Z=[];for(let $ of bZ){let Y=U(Q,".agents","skills",$.name);A(Y,{recursive:!0});let J=U(Y,"SKILL.md");H(J,$.body()),Z.push(J)}return Z}function AZ(Q){let Z=U(Q,"AGENTS.md"),$="";try{$=j(Z,"utf8")}catch{}let Y=new RegExp(`${E}[\\s\\S]*?${zQ}`);$=Y.test($)?$.replace(Y,EQ):`${$.trim()}
4
4
 
5
- ${fQ}
5
+ ${EQ}
6
6
  `.trimStart(),H(Z,$.endsWith(`
7
7
  `)?$:`${$}
8
- `);let J=W(Q,"CLAUDE.md"),V="";try{V=P(J,"utf8")}catch{}if(!/@AGENTS\.md/.test(V))H(J,`${V?`${V.trim()}
8
+ `);let J=U(Q,"CLAUDE.md"),V="";try{V=j(J,"utf8")}catch{}if(!/@AGENTS\.md/.test(V))H(J,`${V?`${V.trim()}
9
9
 
10
10
  `:""}@AGENTS.md
11
- `)}function wZ(Q){let Z=W(Q,".mcp.json"),$={};try{$=JSON.parse(P(Z,"utf8"))}catch{}if($.mcpServers=$.mcpServers??{},$.mcpServers.beacon)return{path:Z,added:!1};return $.mcpServers.beacon={command:"beacon",args:["mcp"]},H(Z,JSON.stringify($,null,2)+`
12
- `),{path:Z,added:!0}}function FZ(Q){let Z=W(Q,".mcp.json"),$=!1;try{$=!!JSON.parse(P(Z,"utf8")).mcpServers?.beacon}catch{}let Y=!1;try{Y=P(W(Q,"AGENTS.md"),"utf8").includes(I)}catch{}let J=!1;try{J=/@AGENTS\.md/.test(P(W(Q,"CLAUDE.md"),"utf8"))}catch{}return{repo:Q,mcpRegistered:$,agentsMdBlock:Y,claudeMdImport:J,skills:{"beacon-init":v(W(Q,".claude","skills","beacon-init","SKILL.md")),"beacon-refresh":v(W(Q,".claude","skills","beacon-refresh","SKILL.md"))},codexSkills:{"beacon-init":v(W(Q,".agents","skills","beacon-init","SKILL.md")),"beacon-refresh":v(W(Q,".agents","skills","beacon-refresh","SKILL.md"))}}}function uZ(Q){let Z=[];for(let z of["beacon-init","beacon-refresh","beacon-db-design"]){let U=W(Q,".claude","skills",z);if(v(U))b(U,{recursive:!0,force:!0}),Z.push(z)}for(let z of["beacon-init","beacon-refresh"]){let U=W(Q,".agents","skills",z);if(v(U))b(U,{recursive:!0,force:!0}),Z.push(`codex:${z}`)}let $=!1,Y=W(Q,".mcp.json");try{let z=JSON.parse(P(Y,"utf8"));if(z.mcpServers?.beacon){if(delete z.mcpServers.beacon,$=!0,z.mcpServers&&Object.keys(z.mcpServers).length===0)delete z.mcpServers;if(Object.keys(z).length===0)b(Y,{force:!0});else H(Y,JSON.stringify(z,null,2)+`
13
- `)}}catch{}let J=!1,V=W(Q,"AGENTS.md");try{let z=P(V,"utf8"),U=new RegExp(`\\n?${I}[\\s\\S]*?${VQ}\\n?`);if(U.test(z)){let M=z.replace(U,`
11
+ `)}function EZ(Q){let Z=U(Q,".mcp.json"),$={};try{$=JSON.parse(j(Z,"utf8"))}catch{}if($.mcpServers=$.mcpServers??{},$.mcpServers.beacon)return{path:Z,added:!1};return $.mcpServers.beacon={command:"beacon",args:["mcp"]},H(Z,JSON.stringify($,null,2)+`
12
+ `),{path:Z,added:!0}}function DZ(Q){let Z=U(Q,".mcp.json"),$=!1;try{$=!!JSON.parse(j(Z,"utf8")).mcpServers?.beacon}catch{}let Y=!1;try{Y=j(U(Q,"AGENTS.md"),"utf8").includes(E)}catch{}let J=!1;try{J=/@AGENTS\.md/.test(j(U(Q,"CLAUDE.md"),"utf8"))}catch{}return{repo:Q,mcpRegistered:$,agentsMdBlock:Y,claudeMdImport:J,skills:{"beacon-init":v(U(Q,".claude","skills","beacon-init","SKILL.md")),"beacon-refresh":v(U(Q,".claude","skills","beacon-refresh","SKILL.md"))},codexSkills:{"beacon-init":v(U(Q,".agents","skills","beacon-init","SKILL.md")),"beacon-refresh":v(U(Q,".agents","skills","beacon-refresh","SKILL.md"))}}}function OZ(Q){let Z=[];for(let z of["beacon-init","beacon-refresh","beacon-db-design"]){let W=U(Q,".claude","skills",z);if(v(W))I(W,{recursive:!0,force:!0}),Z.push(z)}for(let z of["beacon-init","beacon-refresh"]){let W=U(Q,".agents","skills",z);if(v(W))I(W,{recursive:!0,force:!0}),Z.push(`codex:${z}`)}let $=!1,Y=U(Q,".mcp.json");try{let z=JSON.parse(j(Y,"utf8"));if(z.mcpServers?.beacon){if(delete z.mcpServers.beacon,$=!0,z.mcpServers&&Object.keys(z.mcpServers).length===0)delete z.mcpServers;if(Object.keys(z).length===0)I(Y,{force:!0});else H(Y,JSON.stringify(z,null,2)+`
13
+ `)}}catch{}let J=!1,V=U(Q,"AGENTS.md");try{let z=j(V,"utf8"),W=new RegExp(`\\n?${E}[\\s\\S]*?${zQ}\\n?`);if(W.test(z)){let M=z.replace(W,`
14
14
  `).replace(/\n{3,}/g,`
15
15
 
16
16
  `).trimStart();H(V,M.endsWith(`
17
17
  `)?M:`${M}
18
- `),J=!0}}catch{}let X=!1,q=W(Q,"CLAUDE.md");try{let z=P(q,"utf8"),U=z.replace(/^[ \t]*@AGENTS\.md[ \t]*\n?/m,"");if(U!==z){if(!U.trim())b(q,{force:!0});else H(q,U);X=!0}}catch{}return{skillsRemoved:Z,mcpUnregistered:$,agentsBlockRemoved:J,claudeImportRemoved:X}}var YQ=`---
18
+ `),J=!0}}catch{}let X=!1,q=U(Q,"CLAUDE.md");try{let z=j(q,"utf8"),W=z.replace(/^[ \t]*@AGENTS\.md[ \t]*\n?/m,"");if(W!==z){if(!W.trim())I(q,{force:!0});else H(q,W);X=!0}}catch{}return{skillsRemoved:Z,mcpUnregistered:$,agentsBlockRemoved:J,claudeImportRemoved:X}}var JQ=`---
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,8 +28,9 @@ 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. 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
- - **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\`. If one of them is a concrete BUG to fix (something broken you saw in the code), add \`kind: "BUG"\` so it renders as a typed bug card.
31
+ - **hasFrontend**: \`true\` or \`false\` \u2014 does this repo have a frontend surface (UI code)? You just read the repo, so you know. Set it explicitly; it gates the frontend/backend \`layer\` distinction on the boards (a pure-backend repo never shows it).
32
+ - **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), \`depends\` listing other component titles it relies on \u2014 and, when \`hasFrontend\` is true, \`layer\` (\`"frontend" | "backend" | "fullstack"\`). 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.
33
+ - **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\`. If one of them is a concrete BUG to fix (something broken you saw in the code), add \`kind: "BUG"\` so it renders as a typed bug card. When \`hasFrontend\` is true, give each a \`layer\` too (\`"frontend" | "backend" | "fullstack"\`).
33
34
  - **overview**: one paragraph describing what this project is and its stack. This lands in AGENTS.md as the project intro.
34
35
  - **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.
35
36
  - **snapshot** (optional but encouraged): \`{ tables, relations, endpoints }\` for the existing database. If the project uses Prisma, read \`prisma/schema.prisma\`. If SQLAlchemy, read the model files. If Django, read \`models.py\`. If you find no obvious schema source, skip the snapshot \u2014 don't fabricate.
@@ -52,7 +53,7 @@ A single \`beacon_init_persist\` MCP tool call with:
52
53
  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
54
 
54
55
  After the tool returns, tell the user the counts (components / roadmap / tables / endpoints) and point them at the running Beacon panel.
55
- `,JQ=`---
56
+ `,VQ=`---
56
57
  name: beacon-refresh
57
58
  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
59
  ---
@@ -87,7 +88,7 @@ The one caveat: if the user manually edited an INIT-source node on the canvas (e
87
88
  - **~ changed**: COMPONENT_X (role expanded to cover Y)
88
89
  - **schema**: + 2 new tables (TableA, TableB); + 3 new endpoints; \u2212 1 deprecated endpoint
89
90
  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\`. 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
+ 5. **Call \`beacon_init_persist\`** ONCE with the refreshed full analysis (same shape as init: \`components\`, \`roadmap\`, \`overview\`, \`conventions\`, \`snapshot\`, \`hasFrontend\` \u2014 re-assert it, the stack may have changed). 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
92
 
92
93
  ## What you should NOT do
93
94
 
@@ -99,7 +100,7 @@ The one caveat: if the user manually edited an INIT-source node on the canvas (e
99
100
  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
101
 
101
102
  After the tool returns, report the final counts plus a one-line summary of the diff you surfaced.
102
- `,bQ=`---
103
+ `,DQ=`---
103
104
  name: beacon-plan
104
105
  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
106
  ---
@@ -141,7 +142,7 @@ If it returns feedback, revise and call it again.
141
142
  If \`beacon_present_plan\` isn't available, the panel isn't wired here \u2014 fall back to ExitPlanMode
142
143
  with the same \`\`\`beacon block (Claude Code only; Codex has no ExitPlanMode), or tell the user to
143
144
  run \`beacon\` in this repo once.
144
- `,MZ,I="<!-- beacon:workflow:start -->",VQ="<!-- beacon:workflow:end -->",fQ;var qQ=T(()=>{MZ=[{name:"beacon-init",body:()=>YQ},{name:"beacon-refresh",body:()=>JQ}];fQ=`${I}
145
+ `,bZ,E="<!-- beacon:workflow:start -->",zQ="<!-- beacon:workflow:end -->",EQ;var XQ=T(()=>{bZ=[{name:"beacon-init",body:()=>JQ},{name:"beacon-refresh",body:()=>VQ}];EQ=`${E}
145
146
  ## Beacon \u2014 feature workflow
146
147
 
147
148
  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:
@@ -166,6 +167,8 @@ When listing endpoints, give each \`uses: [{ table, access }]\` so the endpoint\
166
167
 
167
168
  EVERY feature MUST carry \`category\` (e.g. AUTH | SEARCH | DATA | INTEL | BILLING | \u2026; \`cluster\` is accepted as an alias) and \`priority\` (0 = P0 critical, 1 = P1 high, 2 = P2 medium, 3 = P3 low). Beacon REJECTS a plan whose features omit either \u2014 \`beacon_propose_plan\` returns the list of what's missing, and an ExitPlanMode \`\`\`beacon block is denied \u2014 so set both on every feature instead of relying on defaults.
168
169
 
170
+ When the workspace HAS A FRONTEND (Beacon knows \u2014 the agent set \`hasFrontend\` at init, or frontend files were detected), every feature must ALSO carry \`layer\`: \`"frontend" | "backend" | "fullstack"\` \u2014 which side of the stack the work lands on. Plans omitting it are REJECTED the same way category/priority are. It works on every surface that creates roadmap cards (\`beacon_propose_plan\`, the \`\`\`beacon block, \`beacon_start_feature\`, \`beacon_add_subtasks\` \u2014 sub-tasks default to the parent's layer) and on architecture components (\`beacon_describe_feature\` / \`beacon_init_persist\`). In a pure-backend repo, never set it \u2014 the boards don't show it there.
171
+
169
172
  REUSE before you create. Call \`beacon_map\` to see the features + categories that already exist. Beacon HARD-BLOCKS a feature that duplicates an existing one (it returns the existing feature to use instead) and one created without a category \u2014 so don't re-create work that's already on the board, and reuse an existing category rather than a near-synonym. \`category\` is the ONLY domain field. \`front\` (in \`beacon_start_feature\`) nests a feature UNDER an existing parent feature \u2014 it is NOT a domain tag; a \`front\` that matches no real feature is rejected.
170
173
 
171
174
  When listing features, give each \`dependsOn: ["Other feature title", \u2026]\` for any feature that must ship after another in the same plan. Beacon draws these as "depends on" links so the roadmap shows the dependency chain instead of loose, disconnected cards.
@@ -197,18 +200,18 @@ Register them all in that single batched call. If a plan added five features, th
197
200
  If the feature added or materially changed a REAL architectural component (a subsystem \u2014 NOT a file), also pass \`architecture: [{ title, domain, role, \u2026 }]\` so the Architecture map stays accurate. It upserts curated components by title; never list files as components. If you found a bug or something worth investigating in a component's code, add \`bugs: [{ note }]\` to its architecture entry \u2014 it renders as a bug flag on the node (attributed to the agent); identical open flags are not duplicated. Only flag what you actually saw in the code.
198
201
 
199
202
  Pull raw planning data anytime with \`beacon_entities\` (features / architecture / tables / endpoints).
200
- ${VQ}`});import{existsSync as DQ,mkdirSync as XQ,readFileSync as E,rmSync as RZ,writeFileSync as O}from"fs";import{dirname as IQ,join as A}from"path";function WQ(Q){try{return JSON.parse(E(Q,"utf8"))}catch{return{}}}function AQ(Q,Z){XQ(IQ(Q),{recursive:!0}),O(Q,JSON.stringify(Z,null,2)+`
201
- `)}function k(Q,Z){let $=WQ(Q);$.hooks=$.hooks??{},$.hooks[Z.event]=$.hooks[Z.event]??[];let Y=$.hooks[Z.event];if(Y.some((V)=>V.matcher===Z.matcher&&V.hooks?.some((X)=>X.command===Z.command)))return!1;return Y.push({matcher:Z.matcher,hooks:[{type:"command",command:Z.command}]}),AQ(Q,$),!0}function L(Q,Z){return(WQ(Q).hooks?.[Z.event]??[]).some((J)=>J.hooks?.some((V)=>V.command===Z.command))}function _(Q,Z){let $=WQ(Q),Y=$.hooks?.[Z.event];if(!Y)return!1;let J=!1,V=Y.map((X)=>{let q=X.hooks?.length??0,z=(X.hooks??[]).filter((U)=>U.command!==Z.command);if(z.length!==q)J=!0;return{...X,hooks:z}}).filter((X)=>(X.hooks??[]).length>0);if(!J)return!1;if(V.length)$.hooks[Z.event]=V;else delete $.hooks[Z.event];if($.hooks&&Object.keys($.hooks).length===0)delete $.hooks;return AQ(Q,$),!0}function h(Q,Z,$,Y){let J=`${Z}
203
+ ${zQ}`});import{existsSync as OQ,mkdirSync as UQ,readFileSync as O,rmSync as yZ,writeFileSync as y}from"fs";import{dirname as yQ,join as D}from"path";function WQ(Q){try{return JSON.parse(O(Q,"utf8"))}catch{return{}}}function LQ(Q,Z){UQ(yQ(Q),{recursive:!0}),y(Q,JSON.stringify(Z,null,2)+`
204
+ `)}function k(Q,Z){let $=WQ(Q);$.hooks=$.hooks??{},$.hooks[Z.event]=$.hooks[Z.event]??[];let Y=$.hooks[Z.event];if(Y.some((V)=>V.matcher===Z.matcher&&V.hooks?.some((X)=>X.command===Z.command)))return!1;return Y.push({matcher:Z.matcher,hooks:[{type:"command",command:Z.command}]}),LQ(Q,$),!0}function _(Q,Z){return(WQ(Q).hooks?.[Z.event]??[]).some((J)=>J.hooks?.some((V)=>V.command===Z.command))}function S(Q,Z){let $=WQ(Q),Y=$.hooks?.[Z.event];if(!Y)return!1;let J=!1,V=Y.map((X)=>{let q=X.hooks?.length??0,z=(X.hooks??[]).filter((W)=>W.command!==Z.command);if(z.length!==q)J=!0;return{...X,hooks:z}}).filter((X)=>(X.hooks??[]).length>0);if(!J)return!1;if(V.length)$.hooks[Z.event]=V;else delete $.hooks[Z.event];if($.hooks&&Object.keys($.hooks).length===0)delete $.hooks;return LQ(Q,$),!0}function h(Q,Z,$,Y){let J=`${Z}
202
205
  ${Y.trim()}
203
- ${$}`,V="";try{V=E(Q,"utf8")}catch{}let X=new RegExp(`${Z}[\\s\\S]*?${$}`);V=X.test(V)?V.replace(X,J):V.trim()?`${V.trim()}
206
+ ${$}`,V="";try{V=O(Q,"utf8")}catch{}let X=new RegExp(`${Z}[\\s\\S]*?${$}`);V=X.test(V)?V.replace(X,J):V.trim()?`${V.trim()}
204
207
 
205
208
  ${J}
206
209
  `:`${J}
207
- `,XQ(IQ(Q),{recursive:!0}),O(Q,V.endsWith(`
210
+ `,UQ(yQ(Q),{recursive:!0}),y(Q,V.endsWith(`
208
211
  `)?V:`${V}
209
- `)}function g(Q,Z){try{return E(Q,"utf8").includes(Z)}catch{return!1}}function S(Q,Z,$){let Y="";try{Y=E(Q,"utf8")}catch{return!1}let J=new RegExp(`${Z}[\\s\\S]*?${$}\\n?`);if(!J.test(Y))return!1;let V=Y.replace(J,"").replace(/\n{3,}/g,`
212
+ `)}function g(Q,Z){try{return O(Q,"utf8").includes(Z)}catch{return!1}}function m(Q,Z,$){let Y="";try{Y=O(Q,"utf8")}catch{return!1}let J=new RegExp(`${Z}[\\s\\S]*?${$}\\n?`);if(!J.test(Y))return!1;let V=Y.replace(J,"").replace(/\n{3,}/g,`
210
213
 
211
- `).trimStart();return O(Q,V),!0}function m(Q,Z,$){let Y=A(Q,Z);XQ(Y,{recursive:!0});let J=A(Y,"SKILL.md");return O(J,$),J}function w(Q,Z){return DQ(A(Q,Z,"SKILL.md"))}function p(Q,Z){let $=A(Q,Z);if(!DQ($))return!1;return RZ($,{recursive:!0,force:!0}),!0}var j,y=`## Beacon (visual planning panel)
214
+ `).trimStart();return y(Q,V),!0}function p(Q,Z,$){let Y=D(Q,Z);UQ(Y,{recursive:!0});let J=D(Y,"SKILL.md");return y(J,$),J}function u(Q,Z){return OQ(D(Q,Z,"SKILL.md"))}function c(Q,Z){let $=D(Q,Z);if(!OQ($))return!1;return yZ($,{recursive:!0,force:!0}),!0}var x,L=`## Beacon (visual planning panel)
212
215
 
213
216
  This machine has Beacon installed \u2014 a local visual planning surface for the terminal-side
214
217
  agent. Beacon proposes feature plans (roadmap features + DB schema + endpoints) via MCP,
@@ -229,24 +232,24 @@ the user reviews on a canvas at /plan, and feedback flows back as the next round
229
232
  Feedback bundles inline annotations on the markdown PLUS any edits the user made directly
230
233
  on the /map and /db boards (added features, attached subtasks, edited columns, new
231
234
  endpoints). Treat board edits as the user's revision intent \u2014 re-propose matching them
232
- verbatim. Do NOT implement until the tool returns approval.`;var UQ=T(()=>{j=["beacon-init","beacon-refresh","beacon-plan"]});import{mkdirSync as fZ,renameSync as bZ,rmSync as DZ,writeFileSync as IZ}from"fs";import{dirname as AZ}from"path";function BQ(Q,Z){fZ(AZ(Q),{recursive:!0});let $=`${Q}.tmp`;try{IZ($,Z),bZ($,Q)}catch(Y){throw DZ($,{force:!0}),Y}}var EQ=()=>{};var mQ={};$Q(mQ,{setupCodexAssets:()=>kZ,removeCodexMcp:()=>SQ,removeCodexArtifacts:()=>_Z,hasCodexMcp:()=>xQ,ensureCodexMcp:()=>hQ,codexMcpProblem:()=>yZ,codexDetected:()=>kQ,auditCodex:()=>LZ,CODEX_HOOKS:()=>n});import{readFileSync as a}from"fs";import{homedir as EZ}from"os";import{join as R}from"path";function OQ(){return process.env.HOME||process.env.USERPROFILE||EZ()}function kQ(){if(process.env.BEACON_CODEX==="1")return!0;if(process.env.BEACON_CODEX==="0")return!1;if(HQ===void 0)HQ=Bun.which("codex")!==null;return HQ}function u(Q){try{return Bun.TOML.parse(Q)}catch{return null}}function xQ(){try{return Boolean(u(a(C(),"utf8"))?.mcp_servers?.beacon)}catch{return!1}}function yZ(){let Q="";try{Q=a(C(),"utf8")}catch{return null}let Z=u(Q);if(!Z)return`~/.codex/config.toml does not parse \u2014 ${F}`;if(Z.mcp_servers?.beacon)return null;if(/^\s*mcp_servers\s*=/m.test(Q))return`mcp_servers is an inline table \u2014 ${F}`;return null}function hQ(){let Q="",Z=!1;try{Q=a(C(),"utf8"),Z=!0}catch{}if(Z){let V=u(Q);if(!V)return{added:!1,error:`~/.codex/config.toml does not parse \u2014 ${F}`};if(V.mcp_servers?.beacon)return{added:!1};if(/^\s*mcp_servers\s*=/m.test(Q))return{added:!1,error:`mcp_servers is an inline table \u2014 ${F}`}}let $=!Q?"":Q.endsWith(`
235
+ verbatim. Do NOT implement until the tool returns approval.`;var BQ=T(()=>{x=["beacon-init","beacon-refresh","beacon-plan"]});import{mkdirSync as LZ,renameSync as kZ,rmSync as _Z,writeFileSync as SZ}from"fs";import{dirname as hZ}from"path";function HQ(Q,Z){LZ(hZ(Q),{recursive:!0});let $=`${Q}.tmp`;try{SZ($,Z),kZ($,Q)}catch(Y){throw _Z($,{force:!0}),Y}}var kQ=()=>{};var dQ={};YQ(dQ,{setupCodexAssets:()=>lZ,removeCodexMcp:()=>lQ,removeCodexArtifacts:()=>nZ,hasCodexMcp:()=>PQ,ensureCodexMcp:()=>cQ,codexMcpProblem:()=>cZ,codexDetected:()=>hQ,auditCodex:()=>dZ,CODEX_HOOKS:()=>s});import{readFileSync as a}from"fs";import{homedir as mZ}from"os";import{join as R}from"path";function _Q(){return process.env.HOME||process.env.USERPROFILE||mZ()}function hQ(){if(process.env.BEACON_CODEX==="1")return!0;if(process.env.BEACON_CODEX==="0")return!1;if(jQ===void 0)jQ=Bun.which("codex")!==null;return jQ}function F(Q){try{return Bun.TOML.parse(Q)}catch{return null}}function PQ(){try{return Boolean(F(a(C(),"utf8"))?.mcp_servers?.beacon)}catch{return!1}}function cZ(){let Q="";try{Q=a(C(),"utf8")}catch{return null}let Z=F(Q);if(!Z)return`~/.codex/config.toml does not parse \u2014 ${w}`;if(Z.mcp_servers?.beacon)return null;if(/^\s*mcp_servers\s*=/m.test(Q))return`mcp_servers is an inline table \u2014 ${w}`;return null}function cQ(){let Q="",Z=!1;try{Q=a(C(),"utf8"),Z=!0}catch{}if(Z){let V=F(Q);if(!V)return{added:!1,error:`~/.codex/config.toml does not parse \u2014 ${w}`};if(V.mcp_servers?.beacon)return{added:!1};if(/^\s*mcp_servers\s*=/m.test(Q))return{added:!1,error:`mcp_servers is an inline table \u2014 ${w}`}}let $=!Q?"":Q.endsWith(`
233
236
  `)?`
234
237
  `:`
235
238
 
236
- `,Y=Q+$+OZ;if(u(Y)?.mcp_servers?.beacon?.command!=="beacon")return{added:!1,error:`could not safely append [mcp_servers.beacon] \u2014 ${F}`};return BQ(C(),Y),{added:!0}}function SQ(){let Q="";try{Q=a(C(),"utf8")}catch{return{removed:!1}}let Z=Q.split(`
237
- `),$=Z.indexOf(LQ);if($===-1)return{removed:!1,skipped:xQ()};let Y=Z.indexOf(_Q,$);if(Y===-1)return{removed:!1,skipped:!0};Z.splice($,Y-$+1);let J=Z.join(`
239
+ `,Y=Q+$+pZ;if(F(Y)?.mcp_servers?.beacon?.command!=="beacon")return{added:!1,error:`could not safely append [mcp_servers.beacon] \u2014 ${w}`};return HQ(C(),Y),{added:!0}}function lQ(){let Q="";try{Q=a(C(),"utf8")}catch{return{removed:!1}}let Z=Q.split(`
240
+ `),$=Z.indexOf(mQ);if($===-1)return{removed:!1,skipped:PQ()};let Y=Z.indexOf(pQ,$);if(Y===-1)return{removed:!1,skipped:!0};Z.splice($,Y-$+1);let J=Z.join(`
238
241
  `).replace(/\n{3,}/g,`
239
242
 
240
- `).replace(/^\n+/,"");if(u(J)===null)return{removed:!1,skipped:!0};return BQ(C(),J),{removed:!0}}async function kZ(){let{INIT_SKILL:Q,REFRESH_SKILL:Z,PLAN_SKILL:$}=await Promise.resolve().then(() => (qQ(),zQ)),Y={"beacon-init":Q,"beacon-refresh":Z,"beacon-plan":$},J=[];for(let z of j){if(!w(l(),z))J.push(z);m(l(),z,Y[z])}let V=0;for(let z of n)if(k(jQ(),{event:z.event,matcher:z.matcher,command:z.command}))V++;let X=g(c(),d);h(c(),d,yQ,y);let q=hQ();return{skillsAdded:J,hooksAdded:V,agentsMdBlockTouched:!X,mcp:q}}function LZ(){let Q={};for(let $ of j)Q[$]=w(l(),$);let Z={};for(let $ of n)Z[$.event]=L(jQ(),{event:$.event,command:$.command});return{detected:kQ(),skills:Q,hooks:Z,agentsMdBlock:g(c(),d),mcp:xQ()}}function _Z(){let Q=[];for(let J of j)if(p(l(),J))Q.push(J);let Z=0;for(let J of n)if(_(jQ(),{event:J.event,command:J.command}))Z++;let $=S(c(),d,yQ),Y=SQ();return{skillsRemoved:Q,hooksRemoved:Z,agentsMdBlockRemoved:$,mcpRemoved:Y.removed,mcpSkipped:Y.skipped}}var PQ=()=>R(OQ(),".codex"),jQ=()=>R(PQ(),"hooks.json"),C=()=>R(PQ(),"config.toml"),c=()=>R(PQ(),"AGENTS.md"),l=()=>R(OQ(),".agents","skills"),d="<!-- beacon:global:start -->",yQ="<!-- beacon:global:end -->",n,HQ,LQ="# beacon:start (managed by Beacon \u2014 `beacon uninstall` removes this block)",_Q="# beacon:end",OZ,F="add it manually: codex mcp add beacon -- beacon mcp";var pQ=T(()=>{UQ();EQ();n=[{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."}];OZ=`${LQ}
243
+ `).replace(/^\n+/,"");if(F(J)===null)return{removed:!1,skipped:!0};return HQ(C(),J),{removed:!0}}async function lZ(){let{INIT_SKILL:Q,REFRESH_SKILL:Z,PLAN_SKILL:$}=await Promise.resolve().then(() => (XQ(),qQ)),Y={"beacon-init":Q,"beacon-refresh":Z,"beacon-plan":$},J=[];for(let z of x){if(!u(d(),z))J.push(z);p(d(),z,Y[z])}let V=0;for(let z of s)if(k(xQ(),{event:z.event,matcher:z.matcher,command:z.command}))V++;let X=g(l(),n);h(l(),n,SQ,L);let q=cQ();return{skillsAdded:J,hooksAdded:V,agentsMdBlockTouched:!X,mcp:q}}function dZ(){let Q={};for(let $ of x)Q[$]=u(d(),$);let Z={};for(let $ of s)Z[$.event]=_(xQ(),{event:$.event,command:$.command});return{detected:hQ(),skills:Q,hooks:Z,agentsMdBlock:g(l(),n),mcp:PQ()}}function nZ(){let Q=[];for(let J of x)if(c(d(),J))Q.push(J);let Z=0;for(let J of s)if(S(xQ(),{event:J.event,command:J.command}))Z++;let $=m(l(),n,SQ),Y=lQ();return{skillsRemoved:Q,hooksRemoved:Z,agentsMdBlockRemoved:$,mcpRemoved:Y.removed,mcpSkipped:Y.skipped}}var GQ=()=>R(_Q(),".codex"),xQ=()=>R(GQ(),"hooks.json"),C=()=>R(GQ(),"config.toml"),l=()=>R(GQ(),"AGENTS.md"),d=()=>R(_Q(),".agents","skills"),n="<!-- beacon:global:start -->",SQ="<!-- beacon:global:end -->",s,jQ,mQ="# beacon:start (managed by Beacon \u2014 `beacon uninstall` removes this block)",pQ="# beacon:end",pZ,w="add it manually: codex mcp add beacon -- beacon mcp";var nQ=T(()=>{BQ();kQ();s=[{event:"PostToolUse",matcher:"apply_patch",command:"beacon hook",description:"Report file edits to Beacon's active feature so the map stays fresh."},{event:"UserPromptSubmit",matcher:"*",command:"beacon prompt",description:"On feature-y prompts in a Beacon-wired repo, remind the agent to run the context\u2192propose\u2192describe loop (no-op otherwise)."},{event:"Stop",matcher:"*",command:"beacon stop-hook",description:"When the agent ends a turn asking for plan approval in prose, nudge it to present the plan on Beacon's /plan canvas."}];pZ=`${mQ}
241
244
  [mcp_servers.beacon]
242
245
  command = "beacon"
243
246
  args = ["mcp"]
244
- ${_Q}
245
- `});var tQ={};$Q(tQ,{provisionDb:()=>X0});import{createClient as oZ}from"@libsql/client";import{drizzle as iZ}from"drizzle-orm/libsql";import{migrate as eZ}from"drizzle-orm/libsql/migrator";import{readMigrationFiles as Q0}from"drizzle-orm/migrator";import{dirname as MQ,join as Z0}from"path";import{fileURLToPath as $0}from"url";async function r(Q,Z){return(await Q.execute({sql:"SELECT 1 FROM sqlite_master WHERE type='table' AND name = ?",args:[Z]})).rows.length>0}async function z0(Q,Z){let $=await Q.execute(`PRAGMA table_info("${Z}")`);return new Set($.rows.map((Y)=>String(Y.name)))}async function nQ(Q){if(!await r(Q,"__drizzle_migrations"))return 0;let Z=await Q.execute('SELECT count(*) AS n FROM "__drizzle_migrations"');return Number(Z.rows[0]?.n??0)}async function q0(Q){for(let[Z,$]of Object.entries(V0)){if(!await r(Q,Z))continue;let Y=await z0(Q,Z);for(let J of $){if(!Y.has(J))continue;await Q.execute(`UPDATE "${Z}" SET "${J}" = CAST((julianday("${J}") - 2440587.5) * 86400000 AS INTEGER) WHERE typeof("${J}") = 'text'`)}}}async function X0(Q,Z=J0){let $=oZ({url:Q});try{await $.execute("PRAGMA journal_mode = WAL;"),await $.execute("PRAGMA foreign_keys = ON;"),await $.execute("PRAGMA busy_timeout = 5000;");let Y=await r($,"__drizzle_migrations"),J=await r($,"Node"),V=!1;if(J&&!Y){let q=Q0({migrationsFolder:Z})[0];if(q)await $.execute('CREATE TABLE IF NOT EXISTS "__drizzle_migrations" (id SERIAL PRIMARY KEY, hash text NOT NULL, created_at numeric)'),await $.execute({sql:'INSERT INTO "__drizzle_migrations" ("hash", "created_at") VALUES (?, ?)',args:[q.hash,q.folderMillis]}),V=!0}let X=await nQ($);if(await eZ(iZ($),{migrationsFolder:Z}),await nQ($)>X)V=!0;return await q0($),{migrated:V}}finally{$.close()}}var Y0,J0,V0;var sQ=T(async()=>{Y0=MQ(MQ(MQ($0(import.meta.url)))),J0=process.env.BEACON_MIGRATIONS_DIR||Z0(Y0,"drizzle"),V0={Node:["createdAt","updatedAt"],Note:["createdAt","updatedAt"],DbTable:["createdAt","updatedAt"],Endpoint:["createdAt","updatedAt"],DraftTable:["createdAt"],SyncState:["codeGraphSyncedAt","updatedAt"],AppSetting:["updatedAt"],ProjectMeta:["updatedAt"],CodeFile:["updatedAt"]}});UQ();import{existsSync as hZ}from"fs";import{homedir as SZ}from"os";import{join as t}from"path";function mZ(){return process.env.HOME||process.env.USERPROFILE||SZ()}var s=()=>t(mZ(),".claude"),GQ=()=>t(s(),"skills"),KQ=()=>t(s(),"settings.json"),NQ=()=>t(s(),"CLAUDE.md"),vQ="<!-- beacon:global:start -->",cQ="<!-- beacon:global:end -->";var pZ=y,CQ=[{event:"PostToolUse",matcher:"Edit|Write|MultiEdit",command:"beacon hook",description:"Report file edits to Beacon's active feature so the map stays fresh."},{event:"PermissionRequest",matcher:"ExitPlanMode",command:"beacon plan",description:"Pipe the agent's plan markdown into Beacon's /plan canvas for review."},{event:"UserPromptSubmit",matcher:"*",command:"beacon prompt",description:"On feature-y prompts in a Beacon-wired repo, remind the agent to run the context\u2192propose\u2192describe loop (no-op otherwise)."},{event:"Stop",matcher:"*",command:"beacon stop-hook",description:"When the agent ends a turn asking for plan approval in prose (instead of presenting it), nudge it to present the plan on Beacon's /plan canvas. Bounded by stop_hook_active \u2014 at most one nudge."}];function cZ(Q,Z){return m(GQ(),Q,Z)}function lQ(Q){return w(GQ(),Q)}function lZ(Q){return p(GQ(),Q)}function dZ(Q){return k(KQ(),Q)}function aZ(Q){return L(KQ(),Q)}function nZ(Q){return _(KQ(),Q)}function tZ(Q){h(NQ(),vQ,cQ,Q)}function dQ(){return g(NQ(),vQ)}function sZ(){return S(NQ(),vQ,cQ)}function X1(){let Q={};for(let $ of j)Q[$]=lQ($);let Z={};for(let $ of CQ)Z[$.event]=aZ({event:$.event,command:$.command});return{homeExists:hZ(s()),skills:Q,hooks:Z,claudeMdBlock:dQ()}}async function rZ(){let{INIT_SKILL:Q,REFRESH_SKILL:Z,PLAN_SKILL:$}=await Promise.resolve().then(() => (qQ(),zQ)),Y={"beacon-init":Q,"beacon-refresh":Z,"beacon-plan":$},J=[];for(let q of j){if(!lQ(q))J.push(q);cZ(q,Y[q])}let V=0;for(let q of CQ)if(dZ({event:q.event,matcher:q.matcher,command:q.command}))V++;let X=dQ();return tZ(pZ),{skillsAdded:J,hooksAdded:V,claudeMdBlockTouched:!X}}async function aQ(){let Q;try{Q={ok:!0,...await rZ()}}catch(Z){Q={ok:!1,error:Z instanceof Error?Z.message:String(Z),skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1}}try{let Z=await Promise.resolve().then(() => (pQ(),mQ));if(Z.codexDetected())Q.codex={ok:!0,...await Z.setupCodexAssets()}}catch(Z){Q.codex={ok:!1,error:Z instanceof Error?Z.message:String(Z),skillsAdded:[],hooksAdded:0,agentsMdBlockTouched:!1,mcp:{added:!1}}}return Q}function W1(){let Q=[];for(let Y of j)if(lZ(Y))Q.push(Y);let Z=0;for(let Y of CQ)if(nZ(Y))Z++;let $=sZ();return{skillsRemoved:Q,hooksRemoved:Z,claudeMdBlockRemoved:$}}import{AsyncLocalStorage as W0}from"async_hooks";import{spawnSync as U0}from"child_process";import{createHash as B0}from"crypto";import{existsSync as rQ,mkdirSync as o,readFileSync as oQ,writeFileSync as iQ}from"fs";import{homedir as H0}from"os";import{basename as P0,join as G}from"path";function K(){return process.env.BEACON_HOME||G(H0(),".beacon")}function gQ(){return G(K(),"workspaces.json")}function eQ(Q){return B0("sha256").update(Q).digest("hex").slice(0,12)}function g1(Q=process.cwd()){let Z=U0("git",["rev-parse","--show-toplevel"],{cwd:Q,stdio:["ignore","pipe","ignore"]});if(Z.status===0){let $=Z.stdout?.toString().trim();if($)return $}return Q}function i(Q){return G(K(),Q)}function j0(Q){return`file:${G(i(Q),"db.sqlite")}`}function f(){try{let Q=JSON.parse(oQ(gQ(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function wQ(Q){o(K(),{recursive:!0}),iQ(gQ(),JSON.stringify(Q,null,2))}function x0(){return f().sort((Q,Z)=>Z.lastOpenedAt.localeCompare(Q.lastOpenedAt))}function x(Q){return f().find((Z)=>Z.id===Q)??null}function G0(Q,Z,$=new Date().toISOString()){let Y=eQ(Q),J=f(),V=J.find((z)=>z.id===Y),X={id:Y,path:Q,name:Z||V?.name||P0(Q),lastOpenedAt:$},q=[X,...J.filter((z)=>z.id!==Y)];return o(i(Y),{recursive:!0}),wQ(q),X}function w1(Q,Z=new Date().toISOString()){let $=f(),Y=$.find((J)=>J.id===Q);if(!Y)return;Y.lastOpenedAt=Z,wQ($)}function F1(Q){if(wQ(f().filter((Z)=>Z.id!==Q)),FQ()===Q)K0(x0()[0]?.id??null)}function QZ(){return G(K(),"active")}function FQ(){try{return oQ(QZ(),"utf8").trim()||null}catch{return null}}function K0(Q){o(K(),{recursive:!0}),iQ(QZ(),Q??"")}function u1(){let Q=FQ();return Q?x(Q):null}function R1(){let Q=v0()??FQ();return Q?x(Q):null}function f1(Q){return x(Q)?.path??null}function b1(){return rQ(gQ())}var ZZ="beacon_ws";function $Z(Q,Z){let $=Q.headers.get("cookie");if(!$)return null;for(let Y of $.split(";")){let J=Y.indexOf("=");if(J===-1)continue;if(Y.slice(0,J).trim()===Z)return decodeURIComponent(Y.slice(J+1).trim())}return null}function D1(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&x(Z))return Z;let $=$Z(Q,ZZ);if($&&x($))return $;return null}var N0="x-beacon-workspace-path";async function I1(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&x(Z))return Z;let $=Q.headers.get(N0);if($&&(!Z||eQ($)===Z)){let J=G0($);return await C0(J.id),J.id}let Y=$Z(Q,ZZ);if(Y&&x(Y))return Y;return null}var YZ=new W0;function A1(Q,Z){return Q?YZ.run(Q,Z):Z()}function v0(){return YZ.getStore()??null}var TQ=new Set;function E1(Q){TQ.delete(G(i(Q),"db.sqlite"))}async function C0(Q){let Z=i(Q),$=G(Z,"db.sqlite"),Y=rQ($);if(Y&&TQ.has($))return{ok:!0,created:!1,migrated:!1};try{o(Z,{recursive:!0});let{provisionDb:J}=await sQ().then(() => tQ),V=await J(j0(Q));return TQ.add($),{ok:!0,created:!Y,migrated:Y&&V.migrated}}catch(J){return{ok:!1,created:!1,migrated:!1,error:J instanceof Error?J.message:String(J)}}}import{execSync as HZ,spawn as F0}from"child_process";import{mkdirSync as u0,openSync as R0,readFileSync as f0,writeFileSync as b0}from"fs";import{homedir as D0,platform as UZ}from"os";import{dirname as I0,join as QQ}from"path";import{fileURLToPath as A0}from"url";import{createHash as E0}from"crypto";var JZ=1500,VZ=345600000,y1=1800000,k1=3000;import{mkdirSync as S1,readFileSync as T0,writeFileSync as m1}from"fs";import{join as g0}from"path";var M0=["default","acceptEdits","bypassPermissions","auto"];function zZ(Q){return typeof Q==="string"&&M0.includes(Q)}function qZ(Q,Z){let $={behavior:"allow"};if(Q)$.updatedPermissions=[{type:"setMode",mode:Q,destination:"session"}];let Y={hookEventName:"PermissionRequest",decision:$};if(Z?.trim())Y.additionalContext=Z;return{hookSpecificOutput:Y}}function w0(){return g0(K(),"preferences.json")}function XZ(){try{let Q=JSON.parse(T0(w0(),"utf8"));return{planApprovalMode:zZ(Q.planApprovalMode)?Q.planApprovalMode:void 0,planApprovalModeConfigured:Q.planApprovalModeConfigured===!0}}catch{return{}}}function WZ(Q){if(!Q?.length)return"";let Z=Q.map((Y)=>Y.id?` \u2022 ${Y.title} \u2014 id: ${Y.id}`:` \u2022 ${Y.title}`),$=Q.some((Y)=>Y.id);return`
247
+ ${pQ}
248
+ `});var iQ={};YQ(iQ,{provisionDb:()=>P0});import{createClient as V0}from"@libsql/client";import{drizzle as z0}from"drizzle-orm/libsql";import{migrate as q0}from"drizzle-orm/libsql/migrator";import{readMigrationFiles as X0}from"drizzle-orm/migrator";import{dirname as TQ,join as U0}from"path";import{fileURLToPath as W0}from"url";async function o(Q,Z){return(await Q.execute({sql:"SELECT 1 FROM sqlite_master WHERE type='table' AND name = ?",args:[Z]})).rows.length>0}async function G0(Q,Z){let $=await Q.execute(`PRAGMA table_info("${Z}")`);return new Set($.rows.map((Y)=>String(Y.name)))}async function oQ(Q){if(!await o(Q,"__drizzle_migrations"))return 0;let Z=await Q.execute('SELECT count(*) AS n FROM "__drizzle_migrations"');return Number(Z.rows[0]?.n??0)}async function x0(Q){for(let[Z,$]of Object.entries(j0)){if(!await o(Q,Z))continue;let Y=await G0(Q,Z);for(let J of $){if(!Y.has(J))continue;await Q.execute(`UPDATE "${Z}" SET "${J}" = CAST((julianday("${J}") - 2440587.5) * 86400000 AS INTEGER) WHERE typeof("${J}") = 'text'`)}}}async function P0(Q,Z=H0){let $=V0({url:Q});try{await $.execute("PRAGMA journal_mode = WAL;"),await $.execute("PRAGMA foreign_keys = ON;"),await $.execute("PRAGMA busy_timeout = 5000;");let Y=await o($,"__drizzle_migrations"),J=await o($,"Node"),V=!1;if(J&&!Y){let q=X0({migrationsFolder:Z})[0];if(q)await $.execute('CREATE TABLE IF NOT EXISTS "__drizzle_migrations" (id SERIAL PRIMARY KEY, hash text NOT NULL, created_at numeric)'),await $.execute({sql:'INSERT INTO "__drizzle_migrations" ("hash", "created_at") VALUES (?, ?)',args:[q.hash,q.folderMillis]}),V=!0}let X=await oQ($);if(await q0(z0($),{migrationsFolder:Z}),await oQ($)>X)V=!0;return await x0($),{migrated:V}}finally{$.close()}}var B0,H0,j0;var eQ=T(async()=>{B0=TQ(TQ(TQ(W0(import.meta.url)))),H0=process.env.BEACON_MIGRATIONS_DIR||U0(B0,"drizzle"),j0={Node:["createdAt","updatedAt"],Note:["createdAt","updatedAt"],DbTable:["createdAt","updatedAt"],Endpoint:["createdAt","updatedAt"],DraftTable:["createdAt"],SyncState:["codeGraphSyncedAt","updatedAt"],AppSetting:["updatedAt"],ProjectMeta:["updatedAt"],CodeFile:["updatedAt"]}});BQ();import{existsSync as aZ}from"fs";import{homedir as sZ}from"os";import{join as t}from"path";function tZ(){return process.env.HOME||process.env.USERPROFILE||sZ()}var r=()=>t(tZ(),".claude"),KQ=()=>t(r(),"skills"),NQ=()=>t(r(),"settings.json"),vQ=()=>t(r(),"CLAUDE.md"),CQ="<!-- beacon:global:start -->",aQ="<!-- beacon:global:end -->";var rZ=L,MQ=[{event:"PostToolUse",matcher:"Edit|Write|MultiEdit",command:"beacon hook",description:"Report file edits to Beacon's active feature so the map stays fresh."},{event:"PermissionRequest",matcher:"ExitPlanMode",command:"beacon plan",description:"Pipe the agent's plan markdown into Beacon's /plan canvas for review."},{event:"UserPromptSubmit",matcher:"*",command:"beacon prompt",description:"On feature-y prompts in a Beacon-wired repo, remind the agent to run the context\u2192propose\u2192describe loop (no-op otherwise)."},{event:"Stop",matcher:"*",command:"beacon stop-hook",description:"When the agent ends a turn asking for plan approval in prose (instead of presenting it), nudge it to present the plan on Beacon's /plan canvas. Bounded by stop_hook_active \u2014 at most one nudge."}];function oZ(Q,Z){return p(KQ(),Q,Z)}function sQ(Q){return u(KQ(),Q)}function iZ(Q){return c(KQ(),Q)}function eZ(Q){return k(NQ(),Q)}function Q0(Q){return _(NQ(),Q)}function Z0(Q){return S(NQ(),Q)}function $0(Q){h(vQ(),CQ,aQ,Q)}function tQ(){return g(vQ(),CQ)}function Y0(){return m(vQ(),CQ,aQ)}function P1(){let Q={};for(let $ of x)Q[$]=sQ($);let Z={};for(let $ of MQ)Z[$.event]=Q0({event:$.event,command:$.command});return{homeExists:aZ(r()),skills:Q,hooks:Z,claudeMdBlock:tQ()}}async function J0(){let{INIT_SKILL:Q,REFRESH_SKILL:Z,PLAN_SKILL:$}=await Promise.resolve().then(() => (XQ(),qQ)),Y={"beacon-init":Q,"beacon-refresh":Z,"beacon-plan":$},J=[];for(let q of x){if(!sQ(q))J.push(q);oZ(q,Y[q])}let V=0;for(let q of MQ)if(eZ({event:q.event,matcher:q.matcher,command:q.command}))V++;let X=tQ();return $0(rZ),{skillsAdded:J,hooksAdded:V,claudeMdBlockTouched:!X}}async function rQ(){let Q;try{Q={ok:!0,...await J0()}}catch(Z){Q={ok:!1,error:Z instanceof Error?Z.message:String(Z),skillsAdded:[],hooksAdded:0,claudeMdBlockTouched:!1}}try{let Z=await Promise.resolve().then(() => (nQ(),dQ));if(Z.codexDetected())Q.codex={ok:!0,...await Z.setupCodexAssets()}}catch(Z){Q.codex={ok:!1,error:Z instanceof Error?Z.message:String(Z),skillsAdded:[],hooksAdded:0,agentsMdBlockTouched:!1,mcp:{added:!1}}}return Q}function K1(){let Q=[];for(let Y of x)if(iZ(Y))Q.push(Y);let Z=0;for(let Y of MQ)if(Z0(Y))Z++;let $=Y0();return{skillsRemoved:Q,hooksRemoved:Z,claudeMdBlockRemoved:$}}import{AsyncLocalStorage as K0}from"async_hooks";import{spawnSync as N0}from"child_process";import{createHash as v0}from"crypto";import{existsSync as ZZ,mkdirSync as f,readFileSync as uQ,writeFileSync as wQ}from"fs";import{homedir as $Z}from"os";import{basename as C0,join as P,parse as M0,resolve as QZ}from"path";function G(){return process.env.BEACON_HOME||P($Z(),".beacon")}function FQ(){return P(G(),"workspaces.json")}function i(Q){return v0("sha256").update(Q).digest("hex").slice(0,12)}function A1(Q=process.cwd()){let Z=N0("git",["rev-parse","--show-toplevel"],{cwd:Q,stdio:["ignore","pipe","ignore"]});if(Z.status===0){let $=Z.stdout?.toString().trim();if($)return $}return Q}function YZ(Q){let Z=QZ(Q);return Z!==QZ($Z())&&Z!==M0(Z).root}function JZ(){return P(G(),"deleted.json")}function RQ(){try{let Q=JSON.parse(uQ(JZ(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function VZ(Q){f(G(),{recursive:!0}),wQ(JZ(),JSON.stringify(Q,null,2))}function zZ(Q){return RQ().includes(Q)}function E1(Q){let Z=RQ();if(!Z.includes(Q))VZ([...Z,Q])}function T0(Q){let Z=RQ();if(Z.includes(Q))VZ(Z.filter(($)=>$!==Q))}function e(Q){return P(G(),Q)}function g0(Q){return`file:${P(e(Q),"db.sqlite")}`}function b(){try{let Q=JSON.parse(uQ(FQ(),"utf8"));return Array.isArray(Q)?Q:[]}catch{return[]}}function fQ(Q){f(G(),{recursive:!0}),wQ(FQ(),JSON.stringify(Q,null,2))}function u0(){return b().sort((Q,Z)=>Z.lastOpenedAt.localeCompare(Q.lastOpenedAt))}function K(Q){return b().find((Z)=>Z.id===Q)??null}function qZ(Q,Z,$=new Date().toISOString()){if(!YZ(Q))throw Error(`beacon: refusing to register a non-repo path as a workspace: ${Q}`);let Y=i(Q);if(zZ(Y))throw Error(`beacon: workspace ${Y} (${Q}) was deleted \u2014 run \`beacon\` or /beacon-init to re-add it`);let J=b(),V=J.find((z)=>z.id===Y),X={id:Y,path:Q,name:Z||V?.name||C0(Q),lastOpenedAt:$},q=[X,...J.filter((z)=>z.id!==Y)];return f(e(Y),{recursive:!0}),fQ(q),X}function D1(Q,Z){return T0(i(Q)),qZ(Q,Z)}function O1(Q,Z=new Date().toISOString()){let $=b(),Y=$.find((J)=>J.id===Q);if(!Y)return;Y.lastOpenedAt=Z,fQ($)}function y1(Q){if(fQ(b().filter((Z)=>Z.id!==Q)),bQ()===Q)w0(u0()[0]?.id??null)}function XZ(){return P(G(),"active")}function bQ(){try{return uQ(XZ(),"utf8").trim()||null}catch{return null}}function w0(Q){f(G(),{recursive:!0}),wQ(XZ(),Q??"")}function L1(){let Q=bQ();return Q?K(Q):null}function k1(){let Q=R0()??bQ();return Q?K(Q):null}function _1(Q){return K(Q)?.path??null}function S1(){return ZZ(FQ())}var UZ="beacon_ws";function WZ(Q,Z){let $=Q.headers.get("cookie");if(!$)return null;for(let Y of $.split(";")){let J=Y.indexOf("=");if(J===-1)continue;if(Y.slice(0,J).trim()===Z)return decodeURIComponent(Y.slice(J+1).trim())}return null}function h1(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&K(Z))return Z;let $=WZ(Q,UZ);if($&&K($))return $;return null}var F0="x-beacon-workspace-path";async function m1(Q){let Z=Q.headers.get("x-beacon-workspace");if(Z&&K(Z))return Z;let $=Q.headers.get(F0);if($&&YZ($)&&!zZ(i($))&&(!Z||i($)===Z)){let J=qZ($);return await f0(J.id),J.id}let Y=WZ(Q,UZ);if(Y&&K(Y))return Y;return null}var BZ=new K0;function p1(Q,Z){return Q?BZ.run(Q,Z):Z()}function R0(){return BZ.getStore()??null}var gQ=new Set;function c1(Q){gQ.delete(P(e(Q),"db.sqlite"))}async function f0(Q){let Z=e(Q),$=P(Z,"db.sqlite"),Y=ZZ($);if(Y&&gQ.has($))return{ok:!0,created:!1,migrated:!1};try{f(Z,{recursive:!0});let{provisionDb:J}=await eQ().then(() => iQ),V=await J(g0(Q));return gQ.add($),{ok:!0,created:!Y,migrated:Y&&V.migrated}}catch(J){return{ok:!1,created:!1,migrated:!1,error:J instanceof Error?J.message:String(J)}}}import{execSync as CZ,spawn as D0}from"child_process";import{mkdirSync as O0,openSync as y0,readFileSync as L0,writeFileSync as k0}from"fs";import{homedir as _0,platform as NZ}from"os";import{dirname as S0,join as ZQ}from"path";import{fileURLToPath as h0}from"url";import{createHash as m0}from"crypto";var HZ=1500,jZ=345600000,d1=1800000,n1=3000;import{mkdirSync as r1,readFileSync as I0,writeFileSync as o1}from"fs";import{join as A0}from"path";var b0=["default","acceptEdits","bypassPermissions","auto"];function GZ(Q){return typeof Q==="string"&&b0.includes(Q)}function xZ(Q,Z){let $={behavior:"allow"};if(Q)$.updatedPermissions=[{type:"setMode",mode:Q,destination:"session"}];let Y={hookEventName:"PermissionRequest",decision:$};if(Z?.trim())Y.additionalContext=Z;return{hookSpecificOutput:Y}}function E0(){return A0(G(),"preferences.json")}function PZ(){try{let Q=JSON.parse(I0(E0(),"utf8"));return{planApprovalMode:GZ(Q.planApprovalMode)?Q.planApprovalMode:void 0,planApprovalModeConfigured:Q.planApprovalModeConfigured===!0}}catch{return{}}}function KZ(Q){if(!Q?.length)return"";let Z=Q.map((Y)=>Y.id?` \u2022 ${Y.title} \u2014 id: ${Y.id}`:` \u2022 ${Y.title}`),$=Q.some((Y)=>Y.id);return`
246
249
 
247
250
  This plan created these roadmap feature(s):
248
251
  `+Z.join(`
249
- `)+"\n\nWhen the work ships, register them in ONE call: `beacon_describe_feature` with a "+"`features` array \u2014 one entry per feature"+($?", 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 O0=QQ(I0(A0(import.meta.url)),".."),RQ=process.env.BEACON_HOME||QQ(D0(),".beacon"),PZ=QQ(RQ,"server.json"),BZ=process.env.PORT||"4319";function y0(Q){try{return process.kill(Q,0),!0}catch{return!1}}function k0(Q){try{return JSON.parse(f0(Q,"utf8"))}catch{return null}}async function jZ(Q){try{return(await fetch(Q)).ok}catch{return!1}}async function L0(Q,Z=60){for(let $=0;$<Z;$++){if(await jZ(Q))return!0;await new Promise((Y)=>setTimeout(Y,500))}return!1}function _0(){u0(RQ,{recursive:!0});let Q=R0(QQ(RQ,"server.log"),"a"),Z={...process.env,PORT:BZ,BEACON_NO_OPEN:"1"};delete Z.BEACON_REPO,delete Z.BEACON_DATA_DIR,delete Z.DATABASE_URL;let $=F0("bun",["run","dev"],{cwd:O0,env:Z,detached:!0,stdio:["ignore",Q,Q]});$.unref();let Y={pid:$.pid??0,port:BZ};return b0(PZ,JSON.stringify(Y)),Y}async function h0(){let Q=k0(PZ);if(Q&&y0(Q.pid)&&await jZ(`http://localhost:${Q.port}/api/workspace`))return Q.port;let{port:Z}=_0();return await L0(`http://localhost:${Z}/api/workspace`),Z}function S0(Q){if(process.env.BEACON_NO_OPEN)return;let Z=UZ()==="darwin"?"open":UZ()==="win32"?"start":"xdg-open";try{HZ(`${Z} "${Q}"`,{stdio:"ignore"})}catch{}}function m0(){try{return HZ("git rev-parse --show-toplevel",{cwd:process.cwd(),stdio:["ignore","pipe","ignore"]}).toString().trim()}catch{return""}}function p0(Q){return E0("sha256").update(Q).digest("hex").slice(0,12)}async function c0(){if(process.stdin.isTTY)return null;let Q=[];for await(let $ of process.stdin)Q.push($);let Z=Buffer.concat(Q).toString("utf8").trim();if(!Z)return null;try{return JSON.parse(Z)}catch{return null}}function uQ(Q,Z){return qZ(Q,Z)}function e(Q){return{hookSpecificOutput:{hookEventName:"PermissionRequest",decision:{behavior:"deny",message:Q}}}}function N(Q){process.stdout.write(JSON.stringify(Q)),process.exit(0)}(async()=>{await aQ();let Z=(await c0())?.tool_input?.plan;if(!Z||!Z.trim())N(uQ());let Y=`http://localhost:${await h0()}`,J=m0()||process.cwd(),V=p0(J);await fetch(`${Y}/api/workspace/activate?id=${V}`).catch(()=>{});let X=Z.split(`
250
- `,1)[0]?.replace(/^#+\s*/,"").slice(0,160)||"Plan review",q=await fetch(`${Y}/api/plan`,{method:"POST",headers:{"content-type":"application/json","x-beacon-workspace":V},body:JSON.stringify({description:X,markdown:Z})});if(q.status===422){let B=await q.json().catch(()=>({}));N(e(B.error??"Beacon rejected the plan: every roadmap feature needs a category and a priority. Add them and re-present."))}if(!q.ok)N(uQ());if(!await fetch(`${Y}/api/plan/presence`,{headers:{"x-beacon-workspace":V}}).then((B)=>B.json()).then((B)=>!!B?.live).catch(()=>!1)){let B=encodeURIComponent(`/plan?ws=${V}`);S0(`${Y}/api/workspace/activate?id=${V}&redirect=${B}`)}let U=Date.now()+VZ,M=(B)=>new Promise((ZQ)=>setTimeout(ZQ,B));while(Date.now()<U){await M(JZ);let B=await fetch(`${Y}/api/plan/verdict`,{headers:{"x-beacon-workspace":V}}).then((ZQ)=>ZQ.json()).catch(()=>null);if(!B)continue;if(B.kind==="approved")N(uQ(XZ().planApprovalMode,WZ(B.features)));if(B.kind==="discarded")N(e("The user discarded the plan in Beacon. Ask what they want to adjust before re-presenting."));if(B.kind==="feedback")N(e(`The user left feedback on the plan in Beacon (inline comments and/or edits on the /map and /db boards). Revise the plan based on the feedback below, then re-present (call ExitPlanMode again):
252
+ `)+"\n\nWhen the work ships, register them in ONE call: `beacon_describe_feature` with a "+"`features` array \u2014 one entry per feature"+($?", 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 p0=ZQ(S0(h0(import.meta.url)),".."),AQ=process.env.BEACON_HOME||ZQ(_0(),".beacon"),MZ=ZQ(AQ,"server.json"),vZ=process.env.PORT||"4319";function c0(Q){try{return process.kill(Q,0),!0}catch{return!1}}function l0(Q){try{return JSON.parse(L0(Q,"utf8"))}catch{return null}}async function TZ(Q){try{return(await fetch(Q)).ok}catch{return!1}}async function d0(Q,Z=60){for(let $=0;$<Z;$++){if(await TZ(Q))return!0;await new Promise((Y)=>setTimeout(Y,500))}return!1}function n0(){O0(AQ,{recursive:!0});let Q=y0(ZQ(AQ,"server.log"),"a"),Z={...process.env,PORT:vZ,BEACON_NO_OPEN:"1"};delete Z.BEACON_REPO,delete Z.BEACON_DATA_DIR,delete Z.DATABASE_URL;let $=D0("bun",["run","dev"],{cwd:p0,env:Z,detached:!0,stdio:["ignore",Q,Q]});$.unref();let Y={pid:$.pid??0,port:vZ};return k0(MZ,JSON.stringify(Y)),Y}async function a0(){let Q=l0(MZ);if(Q&&c0(Q.pid)&&await TZ(`http://localhost:${Q.port}/api/workspace`))return Q.port;let{port:Z}=n0();return await d0(`http://localhost:${Z}/api/workspace`),Z}function s0(Q){if(process.env.BEACON_NO_OPEN)return;let Z=NZ()==="darwin"?"open":NZ()==="win32"?"start":"xdg-open";try{CZ(`${Z} "${Q}"`,{stdio:"ignore"})}catch{}}function t0(){try{return CZ("git rev-parse --show-toplevel",{cwd:process.cwd(),stdio:["ignore","pipe","ignore"]}).toString().trim()}catch{return""}}function r0(Q){return m0("sha256").update(Q).digest("hex").slice(0,12)}async function o0(){if(process.stdin.isTTY)return null;let Q=[];for await(let $ of process.stdin)Q.push($);let Z=Buffer.concat(Q).toString("utf8").trim();if(!Z)return null;try{return JSON.parse(Z)}catch{return null}}function IQ(Q,Z){return xZ(Q,Z)}function QQ(Q){return{hookSpecificOutput:{hookEventName:"PermissionRequest",decision:{behavior:"deny",message:Q}}}}function N(Q){process.stdout.write(JSON.stringify(Q)),process.exit(0)}(async()=>{await rQ();let Z=(await o0())?.tool_input?.plan;if(!Z||!Z.trim())N(IQ());let Y=`http://localhost:${await a0()}`,J=t0()||process.cwd(),V=r0(J);await fetch(`${Y}/api/workspace/activate?id=${V}`).catch(()=>{});let X=Z.split(`
253
+ `,1)[0]?.replace(/^#+\s*/,"").slice(0,160)||"Plan review",q=await fetch(`${Y}/api/plan`,{method:"POST",headers:{"content-type":"application/json","x-beacon-workspace":V},body:JSON.stringify({description:X,markdown:Z})});if(q.status===422){let B=await q.json().catch(()=>({}));N(QQ(B.error??"Beacon rejected the plan: every roadmap feature needs a category and a priority. Add them and re-present."))}if(!q.ok)N(IQ());if(!await fetch(`${Y}/api/plan/presence`,{headers:{"x-beacon-workspace":V}}).then((B)=>B.json()).then((B)=>!!B?.live).catch(()=>!1)){let B=encodeURIComponent(`/plan?ws=${V}`);s0(`${Y}/api/workspace/activate?id=${V}&redirect=${B}`)}let W=Date.now()+jZ,M=(B)=>new Promise(($Q)=>setTimeout($Q,B));while(Date.now()<W){await M(HZ);let B=await fetch(`${Y}/api/plan/verdict`,{headers:{"x-beacon-workspace":V}}).then(($Q)=>$Q.json()).catch(()=>null);if(!B)continue;if(B.kind==="approved")N(IQ(PZ().planApprovalMode,KZ(B.features)));if(B.kind==="discarded")N(QQ("The user discarded the plan in Beacon. Ask what they want to adjust before re-presenting."));if(B.kind==="feedback")N(QQ(`The user left feedback on the plan in Beacon (inline comments and/or edits on the /map and /db boards). Revise the plan based on the feedback below, then re-present (call ExitPlanMode again):
251
254
 
252
- `+B.feedback))}N(e("Beacon plan review timed out without a verdict. Re-present the plan and ask the user to review it."))})();
255
+ `+B.feedback))}N(QQ("Beacon plan review timed out without a verdict. Re-present the plan and ask the user to review it."))})();