trybeacon 0.1.64 → 0.1.65

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 (99) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.next/BUILD_ID +1 -1
  3. package/.next/app-path-routes-manifest.json +9 -9
  4. package/.next/build-manifest.json +2 -2
  5. package/.next/prerender-manifest.json +3 -3
  6. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  7. package/.next/server/app/_global-error.html +1 -1
  8. package/.next/server/app/_global-error.rsc +1 -1
  9. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  14. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  15. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  16. package/.next/server/app/_not-found.html +1 -1
  17. package/.next/server/app/_not-found.rsc +2 -2
  18. package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  19. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  20. package/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  21. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  22. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  23. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  24. package/.next/server/app/docs/page_client-reference-manifest.js +1 -1
  25. package/.next/server/app/docs.html +1 -1
  26. package/.next/server/app/docs.rsc +2 -2
  27. package/.next/server/app/docs.segments/_full.segment.rsc +2 -2
  28. package/.next/server/app/docs.segments/_head.segment.rsc +1 -1
  29. package/.next/server/app/docs.segments/_index.segment.rsc +2 -2
  30. package/.next/server/app/docs.segments/_tree.segment.rsc +2 -2
  31. package/.next/server/app/docs.segments/docs/__PAGE__.segment.rsc +1 -1
  32. package/.next/server/app/docs.segments/docs.segment.rsc +1 -1
  33. package/.next/server/app/feedback/page_client-reference-manifest.js +1 -1
  34. package/.next/server/app/feedback.html +1 -1
  35. package/.next/server/app/feedback.rsc +2 -2
  36. package/.next/server/app/feedback.segments/_full.segment.rsc +2 -2
  37. package/.next/server/app/feedback.segments/_head.segment.rsc +1 -1
  38. package/.next/server/app/feedback.segments/_index.segment.rsc +2 -2
  39. package/.next/server/app/feedback.segments/_tree.segment.rsc +2 -2
  40. package/.next/server/app/feedback.segments/feedback/__PAGE__.segment.rsc +1 -1
  41. package/.next/server/app/feedback.segments/feedback.segment.rsc +1 -1
  42. package/.next/server/app/help/page_client-reference-manifest.js +1 -1
  43. package/.next/server/app/help.html +1 -1
  44. package/.next/server/app/help.rsc +2 -2
  45. package/.next/server/app/help.segments/_full.segment.rsc +2 -2
  46. package/.next/server/app/help.segments/_head.segment.rsc +1 -1
  47. package/.next/server/app/help.segments/_index.segment.rsc +2 -2
  48. package/.next/server/app/help.segments/_tree.segment.rsc +2 -2
  49. package/.next/server/app/help.segments/help/__PAGE__.segment.rsc +1 -1
  50. package/.next/server/app/help.segments/help.segment.rsc +1 -1
  51. package/.next/server/app/index.html +1 -1
  52. package/.next/server/app/index.rsc +2 -2
  53. package/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  54. package/.next/server/app/index.segments/_full.segment.rsc +2 -2
  55. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  56. package/.next/server/app/index.segments/_index.segment.rsc +2 -2
  57. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  58. package/.next/server/app/map/page.js +1 -1
  59. package/.next/server/app/map/page.js.nft.json +1 -1
  60. package/.next/server/app/map/page_client-reference-manifest.js +1 -1
  61. package/.next/server/app/page_client-reference-manifest.js +1 -1
  62. package/.next/server/app/plan/page.js +2 -2
  63. package/.next/server/app/plan/page.js.nft.json +1 -1
  64. package/.next/server/app/plan/page_client-reference-manifest.js +1 -1
  65. package/.next/server/app/s/[token]/page.js +1 -1
  66. package/.next/server/app/s/[token]/page.js.nft.json +1 -1
  67. package/.next/server/app/s/[token]/page_client-reference-manifest.js +1 -1
  68. package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  69. package/.next/server/app-paths-manifest.json +9 -9
  70. package/.next/server/chunks/{4384.js → 2813.js} +1 -1
  71. package/.next/server/chunks/3174.js +1 -0
  72. package/.next/server/middleware-build-manifest.js +1 -1
  73. package/.next/server/pages/404.html +1 -1
  74. package/.next/server/pages/500.html +1 -1
  75. package/.next/server/server-reference-manifest.js +1 -1
  76. package/.next/server/server-reference-manifest.json +1 -1
  77. package/.next/static/chunks/1909-98243a0473be2aae.js +1 -0
  78. package/.next/static/chunks/{3415-05007c2bd98125c7.js → 4491-0cd79f4195f4b111.js} +1 -1
  79. package/.next/static/chunks/app/map/{page-491d4767dbc4e954.js → page-66ec4b62a4153de8.js} +1 -1
  80. package/.next/static/chunks/app/plan/{page-a90e0981499546e3.js → page-008565f9049d55c9.js} +1 -1
  81. package/.next/static/chunks/app/s/[token]/{page-5c8f260e75758b02.js → page-1c10b26b300faffc.js} +1 -1
  82. package/.next/static/css/f871d81e526502c1.css +1 -0
  83. package/.next/trace +42 -42
  84. package/.next/trace-build +1 -1
  85. package/README.md +2 -1
  86. package/dist/bin/doctor.js +4 -0
  87. package/dist/bin/hook.js +4 -0
  88. package/dist/bin/mcp.js +6 -2
  89. package/dist/bin/plan.js +4 -0
  90. package/dist/bin/uninstall.js +4 -0
  91. package/dist/lib/assets.js +4 -0
  92. package/dist/lib/codex-install.js +4 -0
  93. package/dist/lib/global-install.js +4 -0
  94. package/package.json +1 -1
  95. package/.next/server/chunks/2942.js +0 -1
  96. package/.next/static/chunks/874-c750840a8644deb1.js +0 -1
  97. package/.next/static/css/490566ec68a48e1a.css +0 -1
  98. /package/.next/static/{qoq7TibU72duRZATxeVnT → fwNWsob4GcVUD5_xV0f1h}/_buildManifest.js +0 -0
  99. /package/.next/static/{qoq7TibU72duRZATxeVnT → fwNWsob4GcVUD5_xV0f1h}/_ssgManifest.js +0 -0
package/.next/trace-build CHANGED
@@ -1 +1 @@
1
- [{"name":"run-webpack","duration":23250584,"timestamp":224638106,"id":14,"parentId":1,"tags":{},"startTime":1781873583918,"traceId":"ce35914bd9e6e3f8"},{"name":"run-typescript","duration":10789292,"timestamp":247890959,"id":4492,"parentId":1,"tags":{},"startTime":1781873607171,"traceId":"ce35914bd9e6e3f8"},{"name":"static-check","duration":776410,"timestamp":258769183,"id":4495,"parentId":1,"tags":{},"startTime":1781873618049,"traceId":"ce35914bd9e6e3f8"},{"name":"static-generation","duration":3561969,"timestamp":260387359,"id":4657,"parentId":1,"tags":{},"startTime":1781873619667,"traceId":"ce35914bd9e6e3f8"},{"name":"collect-build-traces","duration":11250186,"timestamp":259548368,"id":4654,"parentId":1,"tags":{},"startTime":1781873618828,"traceId":"ce35914bd9e6e3f8"},{"name":"telemetry-flush","duration":63,"timestamp":270802189,"id":4666,"parentId":1,"tags":{},"startTime":1781873630082,"traceId":"ce35914bd9e6e3f8"},{"name":"next-build","duration":46271767,"timestamp":224530495,"id":1,"tags":{"buildMode":"default","version":"16.2.7","bundler":"webpack","has-custom-webpack-config":"false","use-build-worker":"true"},"startTime":1781873583810,"traceId":"ce35914bd9e6e3f8"}]
1
+ [{"name":"run-webpack","duration":23707988,"timestamp":107432910,"id":14,"parentId":1,"tags":{},"startTime":1781880987272,"traceId":"db1ed575747367b0"},{"name":"run-typescript","duration":10752482,"timestamp":131143208,"id":4494,"parentId":1,"tags":{},"startTime":1781881010982,"traceId":"db1ed575747367b0"},{"name":"static-check","duration":745194,"timestamp":141987752,"id":4497,"parentId":1,"tags":{},"startTime":1781881021827,"traceId":"db1ed575747367b0"},{"name":"static-generation","duration":3356814,"timestamp":143679804,"id":4659,"parentId":1,"tags":{},"startTime":1781881023519,"traceId":"db1ed575747367b0"},{"name":"collect-build-traces","duration":11132889,"timestamp":142735856,"id":4656,"parentId":1,"tags":{},"startTime":1781881022575,"traceId":"db1ed575747367b0"},{"name":"telemetry-flush","duration":62,"timestamp":153872401,"id":4668,"parentId":1,"tags":{},"startTime":1781881033712,"traceId":"db1ed575747367b0"},{"name":"next-build","duration":46569321,"timestamp":107303154,"id":1,"tags":{"buildMode":"default","version":"16.2.7","bundler":"webpack","has-custom-webpack-config":"false","use-build-worker":"true"},"startTime":1781880987142,"traceId":"db1ed575747367b0"}]
package/README.md CHANGED
@@ -57,7 +57,8 @@ beacon stop # stop the shared background server
57
57
  ```
58
58
 
59
59
  > Prefer Claude Code's plugin system? Add the marketplace and install the plugin instead:
60
- > `/plugin marketplace add wenzorithelly/beacon-plugin` then `/plugin install beacon@trybeacon`.
60
+ > `/plugin marketplace add wenzorithelly/beacon` then `/plugin install beacon@trybeacon`.
61
+ > (The plugin ships inside the `trybeacon` npm package — same artifacts, no separate repo.)
61
62
 
62
63
  One shared Beacon server (daemon) serves every repo you open; each repo keeps its own data in
63
64
  `~/.beacon/<id>/` (override the root with `BEACON_HOME`). On first run in a repo, run
@@ -215,6 +215,10 @@ Beacon extracts it deterministically and **strips the block from the prose** (it
215
215
 
216
216
  **The board is built ONLY from the block \u2014 prose is NOT parsed.** If your plan describes ANY database models/tables/columns in the prose (e.g. "Model \`legal_precedent.py\` \u2014 natural key (court, \u2026)"), you MUST also put them in the block's \`tables\` array (with \`columns\`), or the /db tab will be empty for that plan. Same for endpoints (\`endpoints\` with \`uses:[{table,access}]\`) and features (\`features\`). A plan that lists five tables in prose but ships a block with only \`features\` renders an empty database board \u2014 exactly the "I described models but the DB tab is empty" failure. Mirror every DB entity you mention into the block.
217
217
 
218
+ ### 2c. Mark the files you mention \u2014 write repo-relative paths in backticks
219
+
220
+ When a plan, feature, or architecture-component description mentions a source file, write its **repo-relative path inside backticks** \u2014 \`app/api/plan/route.ts\`, not "the plan route". On the /plan canvas Beacon turns every backticked token that matches a REAL repo file into a clickable mention that opens it in the user's editor; a bare filename matching several files (e.g. \`route.ts\`) opens a pick-one dropdown of the same-named candidates. The match is deterministic against the live code graph, so a path that isn't a real file just stays plain text \u2014 there's no special syntax to learn and no downside to over-marking: always name files by their real path so the reader can jump straight to the code.
221
+
218
222
  ### 3. At the end, register the work \u2014 in ONE call
219
223
 
220
224
  Call \`beacon_feature({ action: "done" })\` **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.
package/dist/bin/hook.js CHANGED
@@ -215,6 +215,10 @@ Beacon extracts it deterministically and **strips the block from the prose** (it
215
215
 
216
216
  **The board is built ONLY from the block \u2014 prose is NOT parsed.** If your plan describes ANY database models/tables/columns in the prose (e.g. "Model \`legal_precedent.py\` \u2014 natural key (court, \u2026)"), you MUST also put them in the block's \`tables\` array (with \`columns\`), or the /db tab will be empty for that plan. Same for endpoints (\`endpoints\` with \`uses:[{table,access}]\`) and features (\`features\`). A plan that lists five tables in prose but ships a block with only \`features\` renders an empty database board \u2014 exactly the "I described models but the DB tab is empty" failure. Mirror every DB entity you mention into the block.
217
217
 
218
+ ### 2c. Mark the files you mention \u2014 write repo-relative paths in backticks
219
+
220
+ When a plan, feature, or architecture-component description mentions a source file, write its **repo-relative path inside backticks** \u2014 \`app/api/plan/route.ts\`, not "the plan route". On the /plan canvas Beacon turns every backticked token that matches a REAL repo file into a clickable mention that opens it in the user's editor; a bare filename matching several files (e.g. \`route.ts\`) opens a pick-one dropdown of the same-named candidates. The match is deterministic against the live code graph, so a path that isn't a real file just stays plain text \u2014 there's no special syntax to learn and no downside to over-marking: always name files by their real path so the reader can jump straight to the code.
221
+
218
222
  ### 3. At the end, register the work \u2014 in ONE call
219
223
 
220
224
  Call \`beacon_feature({ action: "done" })\` **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.
package/dist/bin/mcp.js CHANGED
@@ -215,6 +215,10 @@ Beacon extracts it deterministically and **strips the block from the prose** (it
215
215
 
216
216
  **The board is built ONLY from the block \u2014 prose is NOT parsed.** If your plan describes ANY database models/tables/columns in the prose (e.g. "Model \`legal_precedent.py\` \u2014 natural key (court, \u2026)"), you MUST also put them in the block's \`tables\` array (with \`columns\`), or the /db tab will be empty for that plan. Same for endpoints (\`endpoints\` with \`uses:[{table,access}]\`) and features (\`features\`). A plan that lists five tables in prose but ships a block with only \`features\` renders an empty database board \u2014 exactly the "I described models but the DB tab is empty" failure. Mirror every DB entity you mention into the block.
217
217
 
218
+ ### 2c. Mark the files you mention \u2014 write repo-relative paths in backticks
219
+
220
+ When a plan, feature, or architecture-component description mentions a source file, write its **repo-relative path inside backticks** \u2014 \`app/api/plan/route.ts\`, not "the plan route". On the /plan canvas Beacon turns every backticked token that matches a REAL repo file into a clickable mention that opens it in the user's editor; a bare filename matching several files (e.g. \`route.ts\`) opens a pick-one dropdown of the same-named candidates. The match is deterministic against the live code graph, so a path that isn't a real file just stays plain text \u2014 there's no special syntax to learn and no downside to over-marking: always name files by their real path so the reader can jump straight to the code.
221
+
218
222
  ### 3. At the end, register the work \u2014 in ONE call
219
223
 
220
224
  Call \`beacon_feature({ action: "done" })\` **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.
@@ -278,7 +282,7 @@ ${l5}
278
282
  This plan created these roadmap feature(s):
279
283
  `+Q.join(`
280
284
  `)+'\n\nWhen the work ships, register them in ONE call: `beacon_feature({ action: "done" })` 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."}import{readFileSync as LQ}from"fs";import{join as _Q}from"path";function kQ(){try{return JSON.parse(LQ(_Q(_(),"server.json"),"utf8"))}catch{return null}}function r(){if(process.env.BEACON_URL)return process.env.BEACON_URL;return`http://localhost:${kQ()?.port||process.env.PORT||B9}`}import{execSync as yQ}from"child_process";import{platform as O9}from"os";function xQ($){if(process.env.BEACON_NO_OPEN)return;let Q=O9()==="darwin"?"open":O9()==="win32"?"start":"xdg-open";try{yQ(`${Q} "${$}"`,{stdio:"ignore"})}catch{}}async function L5($,Q){if(await fetch(`${$}/api/plan/presence`,{headers:{"x-beacon-workspace":Q}}).then((X)=>X.json()).then((X)=>!!X?.live).catch(()=>!1))return;let Y=encodeURIComponent(`/plan?ws=${Q}`);xQ(`${$}/api/workspace/activate?id=${Q}&redirect=${Y}`)}i0();function B0($){return $.toLowerCase().normalize("NFD").replace(/[\u0300-\u036F]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,50)||"item"}function D9($){return`${B0($.title)}-${$.id.slice(-6)}`}function R9($){return{resources:$.map((Q)=>({uri:`note://${D9(Q)}`,name:Q.title||"Untitled",description:`${Q.title||"Untitled"}${Q.pinned?" \xB7 pinned":""} \xB7 note`,mimeType:"text/markdown"}))}}function A9($,Q){return $.find((Z)=>D9(Z)===Q)}function E9($){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(`
281
- `)}await t5();var S=V9(),c=o(S);if(!f0(S)){let $=b0();if($.length===1)console.error(`[beacon mcp] cwd ${S} isn't a registered repo \u2014 falling back to your only Beacon workspace "${$[0].name}".`);else if($.length>1)console.error(`[beacon mcp] cwd ${S} isn't a registered repo and you have ${$.length} Beacon workspaces \u2014 can't auto-detect which. Run /beacon-init in this repo, or name the project explicitly in your request.`);else console.error(`[beacon mcp] not registering ${S} \u2014 home/non-repo dir.`)}else if(g0(c))console.error(`[beacon mcp] not registering ${S} \u2014 workspace was deleted; run /beacon-init to re-add it.`);else try{m0(S);let $=await D5(c);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",c),Z.set(F5,S);let Y=await fetch(`${r()}${$}`,{...Q,headers:Z}),X=await Y.text();if(!Y.ok)throw Error(`Beacon ${$} -> ${Y.status} ${X}`);return X?JSON.parse(X):null}function s0($,Q){return E($,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(Q)})}function L9($){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 R=new zQ({name:"beacon",version:"0.1.0"});R.registerTool("beacon_map",{description:"List the roadmap: every feature + its sub-tasks with `category`, `priority`, `layer`, `kind`, and `status`. Call this BEFORE creating anything with `beacon_feature` \u2014 it's the cheap way to learn which categories already exist (reuse one instead of inventing a synonym) and whether a card already exists. You do NOT need `beacon_entities` just to see categories."},async()=>{let $=await E("/api/map");return{content:[{type:"text",text:JSON.stringify($)}]}});var I9=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"),layer:J.enum(["frontend","backend","fullstack"]).optional().describe("which side of the stack the component lives on (only when the repo has a frontend); omitting it on an update keeps the prior value"),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");R.registerTool("beacon_feature",{description:'Manage a roadmap feature\'s whole lifecycle in ONE tool \u2014 no approval gate (that\'s `beacon_propose_plan`/`beacon_present_plan`). `action:"add"` puts a card on the board, defaulting to BACKLOG/PENDING (pass `status:"active"` to start it now); `"start"` marks an existing card IN_PROGRESS (create-or-flag); `"subtasks"` adds child tasks under a card; `"done"` completes feature(s) and registers the files/architecture touched (marks DONE + cascades to sub-tasks). A NEW card REQUIRES `category` + `priority` (and `layer` when the workspace has a frontend). Call `beacon_map` FIRST \u2014 it lists every card\'s category/priority/layer/status, so reuse a category and avoid an EXACT duplicate (same title + category + layer) \u2014 a same-named card in a different category, or on a different layer (FE/BE/FS), is allowed as its own card. `add` never activates an existing match \u2014 it returns `exists` so you can reuse it.',inputSchema:{action:J.enum(["add","start","subtasks","done"]).describe("add = put a card on the board (defaults to BACKLOG/PENDING); start = mark an existing card IN_PROGRESS; subtasks = add child tasks under a card; done = complete feature(s) + register files/architecture."),title:J.string().optional().describe("card title (add/start); for done's single form, the feature title (id preferred)."),id:J.string().optional().describe("node id from beacon_map (preferred over title) \u2014 start/done, or add to reference a known card."),category:J.string().optional().describe("REQUIRED for a NEW card (add/start): domain lane \u2014 AUTH | SEARCH | DATA | INTEL | BILLING | INFRA | UI | \u2026 Reuse one from beacon_map; ignored when matching an existing card or nesting under a `front`."),priority:J.number().int().min(0).max(3).optional().describe("priority of a NEW card (add/start): 0=P0 critical .. 3=P3 low. Defaults to P2."),front:J.string().optional().describe("title of an EXISTING parent feature to nest a NEW card under (add/start). NOT a domain tag (use `category`); a `front` matching nothing is REJECTED."),detail:J.string().optional().describe("one-line plain-language description shown on the card (add/start)."),kind:J.enum(["FEATURE","BUG"]).optional().describe("BUG renders a typed bug card; defaults to FEATURE (add/start)."),layer:J.enum(["frontend","backend","fullstack"]).optional().describe("which side of the stack a NEW card lands on (add/start). REQUIRED when the workspace has a frontend; a card nested under a `front` inherits the parent's. Omit in pure-backend repos."),status:J.enum(["backlog","active"]).optional().describe(`add only: "backlog" (default) creates a PENDING card you're not working on yet; "active" creates it IN_PROGRESS.`),parentId:J.string().optional().describe("subtasks: node id of the parent card (preferred)."),parentTitle:J.string().optional().describe("subtasks: fuzzy title of the parent card; ignored if parentId is given."),items:J.array(J.object({title:J.string().describe("short sub-task title"),plain:J.string().optional().describe("one-paragraph description / why / acceptance hint"),kind:J.enum(["FEATURE","BUG"]).optional().describe("BUG for a bug discovered during work; defaults to FEATURE"),layer:J.enum(["frontend","backend","fullstack"]).optional().describe("which side of the stack the sub-task lands on; defaults to the parent's layer")})).optional().describe("subtasks: the child tasks to add under the parent."),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:I9})).optional().describe("done: register MANY features at once \u2014 one entry per feature the plan created, each id-keyed. Use this instead of N separate calls."),description:J.string().optional().describe("done (single form, omit when using `features`): the markdown summary of the shipped feature."),files:J.array(J.string()).optional().describe("done (single form): repo-relative files the feature touched."),architecture:I9}},async($)=>{try{let{path:Q,body:Z}=v9($.action,$),Y=await s0(Q,Z);return{content:[{type:"text",text:JSON.stringify(Y)}]}}catch(Q){return L9(Q)}});R.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"),hasFrontend:J.boolean().optional().describe("Whether this repo has a frontend surface (UI code) \u2014 you just read the repo, so you know. Gates the per-item `layer` requirement + the layer UI on the boards. Set it explicitly (true or false); omitting leaves Beacon to detect it from the code graph."),classificationRoots:J.array(J.string()).optional().describe("Top-level dirs whose immediate children are the meaningful groups on the Files canvas \u2014 e.g. ['frontend','backend/app']. The canvas groups files ONE level below each (so 'frontend' \u2192 'frontend/components', 'frontend/app', \u2026). Pick the dir sitting directly ABOVE the real package dirs (use 'frontend/src' if there's a src/ wrapper). Not every dir \u2014 just where grouping should start. Omit for a simple single-root repo (the canvas auto-groups)."),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"),layer:J.enum(["frontend","backend","fullstack"]).optional().describe("which side of the stack the component lives on \u2014 set it when hasFrontend is true"),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"),kind:J.enum(["FEATURE","BUG"]).optional().describe("BUG when the survey found a concrete bug to fix \u2014 renders as a typed bug card; defaults to FEATURE"),layer:J.enum(["frontend","backend","fullstack"]).optional().describe("which side of the stack the item lands on \u2014 set it when hasFrontend is true")})).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 s0("/api/init",$);return{content:[{type:"text",text:JSON.stringify(Q)}]}});R.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)}]}});R.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)}]}});R.registerTool("beacon_entities",{description:"Read raw planning data: `features` (roadmap), `architecture` (components), `tables`/`endpoints` (DB map). Descriptions are truncated to ~160 chars by default to stay within the tool-result limit \u2014 pass `full:true` for complete text and `limit` to cap rows. For just titles + categories + status, prefer the lighter `beacon_map`.",inputSchema:{kind:J.enum(["features","architecture","tables","endpoints"]),full:J.boolean().optional().describe("return complete descriptions instead of the truncated default (features/architecture)"),limit:J.number().int().positive().optional().describe("cap the number of rows returned")}},async({kind:$,full:Q,limit:Z})=>{let Y=new URLSearchParams({kind:$});if(Q)Y.set("full","1");if(Z)Y.set("limit",String(Z));let X=await E(`/api/entities?${Y.toString()}`);return{content:[{type:"text",text:JSON.stringify(X)}]}});R.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 and, when the workspace has a frontend, `layer` (frontend | backend | fullstack). The tool REJECTS a plan whose features omit any required field, so set them 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"),kind:J.enum(["FEATURE","BUG"]).optional().describe("BUG when this roadmap item is a bug to fix \u2014 renders as a typed bug card; defaults to FEATURE"),layer:J.enum(["frontend","backend","fullstack"]).optional().describe("Which side of the stack the work lands on. REQUIRED on every feature when the workspace has a frontend (the tool rejects the plan otherwise); omit in pure-backend repos.")})).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(),contract:J.array(J.string()).optional().describe("Repo-relative files THIS plan will touch \u2014 the scope contract. When the user has the plan scope-guard enabled, these are frozen at approval and you are held to them while implementing: editing an undeclared file pauses for the user's authorization (which adds it to the contract). Safe to always include; ignored when the guard is off.")}},async({description:$,features:Q,tables:Z,relations:Y,endpoints:X,contract:H})=>{let G=(P)=>new Promise((K0)=>setTimeout(K0,P)),j=(P)=>({content:[{type:"text",text:P}]}),U=(Z?.length??0)>0,w=(Q??[]).map((P)=>`${P.title} ${P.role??""} ${P.plain??""}`).join(`
285
+ `)}await t5();var S=V9(),c=o(S);if(!f0(S)){let $=b0();if($.length===1)console.error(`[beacon mcp] cwd ${S} isn't a registered repo \u2014 falling back to your only Beacon workspace "${$[0].name}".`);else if($.length>1)console.error(`[beacon mcp] cwd ${S} isn't a registered repo and you have ${$.length} Beacon workspaces \u2014 can't auto-detect which. Run /beacon-init in this repo, or name the project explicitly in your request.`);else console.error(`[beacon mcp] not registering ${S} \u2014 home/non-repo dir.`)}else if(g0(c))console.error(`[beacon mcp] not registering ${S} \u2014 workspace was deleted; run /beacon-init to re-add it.`);else try{m0(S);let $=await D5(c);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",c),Z.set(F5,S);let Y=await fetch(`${r()}${$}`,{...Q,headers:Z}),X=await Y.text();if(!Y.ok)throw Error(`Beacon ${$} -> ${Y.status} ${X}`);return X?JSON.parse(X):null}function s0($,Q){return E($,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(Q)})}function L9($){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 R=new zQ({name:"beacon",version:"0.1.0"});R.registerTool("beacon_map",{description:"List the roadmap: every feature + its sub-tasks with `category`, `priority`, `layer`, `kind`, and `status`. Call this BEFORE creating anything with `beacon_feature` \u2014 it's the cheap way to learn which categories already exist (reuse one instead of inventing a synonym) and whether a card already exists. You do NOT need `beacon_entities` just to see categories."},async()=>{let $=await E("/api/map");return{content:[{type:"text",text:JSON.stringify($)}]}});var I9=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"),layer:J.enum(["frontend","backend","fullstack"]).optional().describe("which side of the stack the component lives on (only when the repo has a frontend); omitting it on an update keeps the prior value"),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");R.registerTool("beacon_feature",{description:'Manage a roadmap feature\'s whole lifecycle in ONE tool \u2014 no approval gate (that\'s `beacon_propose_plan`/`beacon_present_plan`). `action:"add"` puts a card on the board, defaulting to BACKLOG/PENDING (pass `status:"active"` to start it now); `"start"` marks an existing card IN_PROGRESS (create-or-flag); `"subtasks"` adds child tasks under a card; `"done"` completes feature(s) and registers the files/architecture touched (marks DONE + cascades to sub-tasks). A NEW card REQUIRES `category` + `priority` (and `layer` when the workspace has a frontend). Call `beacon_map` FIRST \u2014 it lists every card\'s category/priority/layer/status, so reuse a category and avoid an EXACT duplicate (same title + category + layer) \u2014 a same-named card in a different category, or on a different layer (FE/BE/FS), is allowed as its own card. `add` never activates an existing match \u2014 it returns `exists` so you can reuse it.',inputSchema:{action:J.enum(["add","start","subtasks","done"]).describe("add = put a card on the board (defaults to BACKLOG/PENDING); start = mark an existing card IN_PROGRESS; subtasks = add child tasks under a card; done = complete feature(s) + register files/architecture."),title:J.string().optional().describe("card title (add/start); for done's single form, the feature title (id preferred)."),id:J.string().optional().describe("node id from beacon_map (preferred over title) \u2014 start/done, or add to reference a known card."),category:J.string().optional().describe("REQUIRED for a NEW card (add/start): domain lane \u2014 AUTH | SEARCH | DATA | INTEL | BILLING | INFRA | UI | \u2026 Reuse one from beacon_map; ignored when matching an existing card or nesting under a `front`."),priority:J.number().int().min(0).max(3).optional().describe("priority of a NEW card (add/start): 0=P0 critical .. 3=P3 low. Defaults to P2."),front:J.string().optional().describe("title of an EXISTING parent feature to nest a NEW card under (add/start). NOT a domain tag (use `category`); a `front` matching nothing is REJECTED."),detail:J.string().optional().describe("one-line plain-language description shown on the card (add/start)."),kind:J.enum(["FEATURE","BUG"]).optional().describe("BUG renders a typed bug card; defaults to FEATURE (add/start)."),layer:J.enum(["frontend","backend","fullstack"]).optional().describe("which side of the stack a NEW card lands on (add/start). REQUIRED when the workspace has a frontend; a card nested under a `front` inherits the parent's. Omit in pure-backend repos."),status:J.enum(["backlog","active"]).optional().describe(`add only: "backlog" (default) creates a PENDING card you're not working on yet; "active" creates it IN_PROGRESS.`),parentId:J.string().optional().describe("subtasks: node id of the parent card (preferred)."),parentTitle:J.string().optional().describe("subtasks: fuzzy title of the parent card; ignored if parentId is given."),items:J.array(J.object({title:J.string().describe("short sub-task title"),plain:J.string().optional().describe("one-paragraph description / why / acceptance hint"),kind:J.enum(["FEATURE","BUG"]).optional().describe("BUG for a bug discovered during work; defaults to FEATURE"),layer:J.enum(["frontend","backend","fullstack"]).optional().describe("which side of the stack the sub-task lands on; defaults to the parent's layer")})).optional().describe("subtasks: the child tasks to add under the parent."),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:I9})).optional().describe("done: register MANY features at once \u2014 one entry per feature the plan created, each id-keyed. Use this instead of N separate calls."),description:J.string().optional().describe("done (single form, omit when using `features`): the markdown summary of the shipped feature."),files:J.array(J.string()).optional().describe("done (single form): repo-relative files the feature touched."),architecture:I9}},async($)=>{try{let{path:Q,body:Z}=v9($.action,$),Y=await s0(Q,Z);return{content:[{type:"text",text:JSON.stringify(Y)}]}}catch(Q){return L9(Q)}});R.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"),hasFrontend:J.boolean().optional().describe("Whether this repo has a frontend surface (UI code) \u2014 you just read the repo, so you know. Gates the per-item `layer` requirement + the layer UI on the boards. Set it explicitly (true or false); omitting leaves Beacon to detect it from the code graph."),classificationRoots:J.array(J.string()).optional().describe("Top-level dirs whose immediate children are the meaningful groups on the Files canvas \u2014 e.g. ['frontend','backend/app']. The canvas groups files ONE level below each (so 'frontend' \u2192 'frontend/components', 'frontend/app', \u2026). Pick the dir sitting directly ABOVE the real package dirs (use 'frontend/src' if there's a src/ wrapper). Not every dir \u2014 just where grouping should start. Omit for a simple single-root repo (the canvas auto-groups)."),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"),layer:J.enum(["frontend","backend","fullstack"]).optional().describe("which side of the stack the component lives on \u2014 set it when hasFrontend is true"),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"),kind:J.enum(["FEATURE","BUG"]).optional().describe("BUG when the survey found a concrete bug to fix \u2014 renders as a typed bug card; defaults to FEATURE"),layer:J.enum(["frontend","backend","fullstack"]).optional().describe("which side of the stack the item lands on \u2014 set it when hasFrontend is true")})).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 s0("/api/init",$);return{content:[{type:"text",text:JSON.stringify(Q)}]}});R.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)}]}});R.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)}]}});R.registerTool("beacon_entities",{description:"Read raw planning data: `features` (roadmap), `architecture` (components), `tables`/`endpoints` (DB map). Descriptions are truncated to ~160 chars by default to stay within the tool-result limit \u2014 pass `full:true` for complete text and `limit` to cap rows. For just titles + categories + status, prefer the lighter `beacon_map`.",inputSchema:{kind:J.enum(["features","architecture","tables","endpoints"]),full:J.boolean().optional().describe("return complete descriptions instead of the truncated default (features/architecture)"),limit:J.number().int().positive().optional().describe("cap the number of rows returned")}},async({kind:$,full:Q,limit:Z})=>{let Y=new URLSearchParams({kind:$});if(Q)Y.set("full","1");if(Z)Y.set("limit",String(Z));let X=await E(`/api/entities?${Y.toString()}`);return{content:[{type:"text",text:JSON.stringify(X)}]}});R.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 and, when the workspace has a frontend, `layer` (frontend | backend | fullstack). The tool REJECTS a plan whose features omit any required field, so set them 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. In any prose (here or a feature's `plain`), write file references as repo-relative paths in `backticks` \u2014 on /plan, paths matching a REAL repo file render clickable to open in the user's editor."),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"),kind:J.enum(["FEATURE","BUG"]).optional().describe("BUG when this roadmap item is a bug to fix \u2014 renders as a typed bug card; defaults to FEATURE"),layer:J.enum(["frontend","backend","fullstack"]).optional().describe("Which side of the stack the work lands on. REQUIRED on every feature when the workspace has a frontend (the tool rejects the plan otherwise); omit in pure-backend repos.")})).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(),contract:J.array(J.string()).optional().describe("Repo-relative files THIS plan will touch \u2014 the scope contract. When the user has the plan scope-guard enabled, these are frozen at approval and you are held to them while implementing: editing an undeclared file pauses for the user's authorization (which adds it to the contract). Safe to always include; ignored when the guard is off.")}},async({description:$,features:Q,tables:Z,relations:Y,endpoints:X,contract:H})=>{let G=(P)=>new Promise((K0)=>setTimeout(K0,P)),j=(P)=>({content:[{type:"text",text:P}]}),U=(Z?.length??0)>0,w=(Q??[]).map((P)=>`${P.title} ${P.role??""} ${P.plain??""}`).join(`
282
286
  `),a=(X?.length??0)>0||C9(`${$}
283
287
  ${w}`);if(!U&&a)return j("\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 P=await E("/api/project-meta").then((S9)=>!!S9?.hasFrontend).catch(()=>!1),K0=F9(Q,{requireLayer:P});if(K0)return j(K0)}let x9=(Z?.length??0)+(X?.length??0)>0;try{await s0("/api/plan",{description:$,draft:x9?{tables:Z??[],relations:Y??[],endpoints:X??[]}:void 0,features:Q?.length?Q:void 0,contract:H?.length?H:void 0})}catch(P){return L9(P)}await fetch(`${r()}/api/workspace/activate?id=${c}`).catch(()=>{}),await L5(r(),c);let z9=Date.now()+n0;while(Date.now()<z9){await G(o0);let P=await E("/api/plan/verdict").catch(()=>null);if(!P)continue;if(P.kind==="feedback")return j("\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:
284
288
 
@@ -286,7 +290,7 @@ ${w}`);if(!U&&a)return j("\u26D4 This plan touches the database \u2014 it declar
286
290
 
287
291
  Implement EXACTLY the schema below (migrations + code) \u2014 the user may have `+`edited columns on the canvas:
288
292
 
289
- `+P.detail:"")+T5(P.features));if(P.kind==="discarded")return j(`\u274C The user discarded the plan in Beacon. ${P.summary} Ask what they want to adjust before proposing again.`)}return j("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.")});R.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)),Y=(H)=>({content:[{type:"text",text:H}]});await s0("/api/plan",{description:$,markdown:Q}),await fetch(`${r()}/api/workspace/activate?id=${c}`).catch(()=>{}),await L5(r(),c);let X=Date.now()+n0;while(Date.now()<X){await Z(o0);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:
293
+ `+P.detail:"")+T5(P.features));if(P.kind==="discarded")return j(`\u274C The user discarded the plan in Beacon. ${P.summary} Ask what they want to adjust before proposing again.`)}return j("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.")});R.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. Write file references as repo-relative paths in `backticks` (e.g. `app/api/plan/route.ts`) \u2014 on /plan, paths matching a REAL repo file render clickable to open in the user's editor.")}},async({description:$,markdown:Q})=>{let Z=(H)=>new Promise((G)=>setTimeout(G,H)),Y=(H)=>({content:[{type:"text",text:H}]});await s0("/api/plan",{description:$,markdown:Q}),await fetch(`${r()}/api/workspace/activate?id=${c}`).catch(()=>{}),await L5(r(),c);let X=Date.now()+n0;while(Date.now()<X){await Z(o0);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:
290
294
 
291
295
  `+H.feedback);if(H.kind==="approved")return Y(`\u2705 Plan approved by the user. ${H.summary??""}`.trim()+(H.detail?`
292
296
 
package/dist/bin/plan.js CHANGED
@@ -215,6 +215,10 @@ Beacon extracts it deterministically and **strips the block from the prose** (it
215
215
 
216
216
  **The board is built ONLY from the block \u2014 prose is NOT parsed.** If your plan describes ANY database models/tables/columns in the prose (e.g. "Model \`legal_precedent.py\` \u2014 natural key (court, \u2026)"), you MUST also put them in the block's \`tables\` array (with \`columns\`), or the /db tab will be empty for that plan. Same for endpoints (\`endpoints\` with \`uses:[{table,access}]\`) and features (\`features\`). A plan that lists five tables in prose but ships a block with only \`features\` renders an empty database board \u2014 exactly the "I described models but the DB tab is empty" failure. Mirror every DB entity you mention into the block.
217
217
 
218
+ ### 2c. Mark the files you mention \u2014 write repo-relative paths in backticks
219
+
220
+ When a plan, feature, or architecture-component description mentions a source file, write its **repo-relative path inside backticks** \u2014 \`app/api/plan/route.ts\`, not "the plan route". On the /plan canvas Beacon turns every backticked token that matches a REAL repo file into a clickable mention that opens it in the user's editor; a bare filename matching several files (e.g. \`route.ts\`) opens a pick-one dropdown of the same-named candidates. The match is deterministic against the live code graph, so a path that isn't a real file just stays plain text \u2014 there's no special syntax to learn and no downside to over-marking: always name files by their real path so the reader can jump straight to the code.
221
+
218
222
  ### 3. At the end, register the work \u2014 in ONE call
219
223
 
220
224
  Call \`beacon_feature({ action: "done" })\` **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.
@@ -215,6 +215,10 @@ Beacon extracts it deterministically and **strips the block from the prose** (it
215
215
 
216
216
  **The board is built ONLY from the block \u2014 prose is NOT parsed.** If your plan describes ANY database models/tables/columns in the prose (e.g. "Model \`legal_precedent.py\` \u2014 natural key (court, \u2026)"), you MUST also put them in the block's \`tables\` array (with \`columns\`), or the /db tab will be empty for that plan. Same for endpoints (\`endpoints\` with \`uses:[{table,access}]\`) and features (\`features\`). A plan that lists five tables in prose but ships a block with only \`features\` renders an empty database board \u2014 exactly the "I described models but the DB tab is empty" failure. Mirror every DB entity you mention into the block.
217
217
 
218
+ ### 2c. Mark the files you mention \u2014 write repo-relative paths in backticks
219
+
220
+ When a plan, feature, or architecture-component description mentions a source file, write its **repo-relative path inside backticks** \u2014 \`app/api/plan/route.ts\`, not "the plan route". On the /plan canvas Beacon turns every backticked token that matches a REAL repo file into a clickable mention that opens it in the user's editor; a bare filename matching several files (e.g. \`route.ts\`) opens a pick-one dropdown of the same-named candidates. The match is deterministic against the live code graph, so a path that isn't a real file just stays plain text \u2014 there's no special syntax to learn and no downside to over-marking: always name files by their real path so the reader can jump straight to the code.
221
+
218
222
  ### 3. At the end, register the work \u2014 in ONE call
219
223
 
220
224
  Call \`beacon_feature({ action: "done" })\` **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.
@@ -214,6 +214,10 @@ Beacon extracts it deterministically and **strips the block from the prose** (it
214
214
 
215
215
  **The board is built ONLY from the block \u2014 prose is NOT parsed.** If your plan describes ANY database models/tables/columns in the prose (e.g. "Model \`legal_precedent.py\` \u2014 natural key (court, \u2026)"), you MUST also put them in the block's \`tables\` array (with \`columns\`), or the /db tab will be empty for that plan. Same for endpoints (\`endpoints\` with \`uses:[{table,access}]\`) and features (\`features\`). A plan that lists five tables in prose but ships a block with only \`features\` renders an empty database board \u2014 exactly the "I described models but the DB tab is empty" failure. Mirror every DB entity you mention into the block.
216
216
 
217
+ ### 2c. Mark the files you mention \u2014 write repo-relative paths in backticks
218
+
219
+ When a plan, feature, or architecture-component description mentions a source file, write its **repo-relative path inside backticks** \u2014 \`app/api/plan/route.ts\`, not "the plan route". On the /plan canvas Beacon turns every backticked token that matches a REAL repo file into a clickable mention that opens it in the user's editor; a bare filename matching several files (e.g. \`route.ts\`) opens a pick-one dropdown of the same-named candidates. The match is deterministic against the live code graph, so a path that isn't a real file just stays plain text \u2014 there's no special syntax to learn and no downside to over-marking: always name files by their real path so the reader can jump straight to the code.
220
+
217
221
  ### 3. At the end, register the work \u2014 in ONE call
218
222
 
219
223
  Call \`beacon_feature({ action: "done" })\` **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.
@@ -214,6 +214,10 @@ Beacon extracts it deterministically and **strips the block from the prose** (it
214
214
 
215
215
  **The board is built ONLY from the block \u2014 prose is NOT parsed.** If your plan describes ANY database models/tables/columns in the prose (e.g. "Model \`legal_precedent.py\` \u2014 natural key (court, \u2026)"), you MUST also put them in the block's \`tables\` array (with \`columns\`), or the /db tab will be empty for that plan. Same for endpoints (\`endpoints\` with \`uses:[{table,access}]\`) and features (\`features\`). A plan that lists five tables in prose but ships a block with only \`features\` renders an empty database board \u2014 exactly the "I described models but the DB tab is empty" failure. Mirror every DB entity you mention into the block.
216
216
 
217
+ ### 2c. Mark the files you mention \u2014 write repo-relative paths in backticks
218
+
219
+ When a plan, feature, or architecture-component description mentions a source file, write its **repo-relative path inside backticks** \u2014 \`app/api/plan/route.ts\`, not "the plan route". On the /plan canvas Beacon turns every backticked token that matches a REAL repo file into a clickable mention that opens it in the user's editor; a bare filename matching several files (e.g. \`route.ts\`) opens a pick-one dropdown of the same-named candidates. The match is deterministic against the live code graph, so a path that isn't a real file just stays plain text \u2014 there's no special syntax to learn and no downside to over-marking: always name files by their real path so the reader can jump straight to the code.
220
+
217
221
  ### 3. At the end, register the work \u2014 in ONE call
218
222
 
219
223
  Call \`beacon_feature({ action: "done" })\` **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.
@@ -214,6 +214,10 @@ Beacon extracts it deterministically and **strips the block from the prose** (it
214
214
 
215
215
  **The board is built ONLY from the block \u2014 prose is NOT parsed.** If your plan describes ANY database models/tables/columns in the prose (e.g. "Model \`legal_precedent.py\` \u2014 natural key (court, \u2026)"), you MUST also put them in the block's \`tables\` array (with \`columns\`), or the /db tab will be empty for that plan. Same for endpoints (\`endpoints\` with \`uses:[{table,access}]\`) and features (\`features\`). A plan that lists five tables in prose but ships a block with only \`features\` renders an empty database board \u2014 exactly the "I described models but the DB tab is empty" failure. Mirror every DB entity you mention into the block.
216
216
 
217
+ ### 2c. Mark the files you mention \u2014 write repo-relative paths in backticks
218
+
219
+ When a plan, feature, or architecture-component description mentions a source file, write its **repo-relative path inside backticks** \u2014 \`app/api/plan/route.ts\`, not "the plan route". On the /plan canvas Beacon turns every backticked token that matches a REAL repo file into a clickable mention that opens it in the user's editor; a bare filename matching several files (e.g. \`route.ts\`) opens a pick-one dropdown of the same-named candidates. The match is deterministic against the live code graph, so a path that isn't a real file just stays plain text \u2014 there's no special syntax to learn and no downside to over-marking: always name files by their real path so the reader can jump straight to the code.
220
+
217
221
  ### 3. At the end, register the work \u2014 in ONE call
218
222
 
219
223
  Call \`beacon_feature({ action: "done" })\` **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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trybeacon",
3
- "version": "0.1.64",
3
+ "version": "0.1.65",
4
4
  "description": "The visual planning surface for the coding agent in your terminal.",
5
5
  "homepage": "https://trybeacon.sh",
6
6
  "license": "Apache-2.0",
@@ -1 +0,0 @@
1
- "use strict";exports.id=2942,exports.ids=[2942],exports.modules={2942:(a,b,c)=>{c.d(b,{F8:()=>s,NG:()=>o,QH:()=>p,Vq:()=>r,aM:()=>v,cV:()=>x,kz:()=>u,n$:()=>m,pO:()=>g,vB:()=>t});var d=c(48249),e=c(67484),f=c(33191);function g({markdown:a,className:b,variant:c="reading"}){let h=(0,e.useMemo)(()=>m(a),[a]),i="reading"===c;return(0,d.jsx)("div",{className:(0,f.cn)("min-w-0 [overflow-wrap:anywhere]",i?"mx-auto w-full max-w-[66ch] space-y-4 text-[15px] leading-[1.6]":"space-y-3.5 text-[13px] leading-relaxed",b),children:h.map((a,b)=>(0,d.jsx)(w,{block:a,variant:c},b))})}function h(a){let b=a.trim();return b.includes("|")&&b.includes("-")&&/^[\s|:-]+$/.test(b)}function i(a){return""!==a.trim()&&a.includes("|")}function j(a){let b=a.trim();return b.startsWith("|")&&(b=b.slice(1)),b.endsWith("|")&&(b=b.slice(0,-1)),b.split("|").map(a=>a.trim())}function k(a){let b=a.trim(),c=b.startsWith(":"),d=b.endsWith(":");return c&&d?"center":d?"right":c?"left":null}let l=/^\s*```[^\s`]*\s*$/;function m(a){let b=a.split("\n"),c=[],d=[],e=()=>{d.length&&(c.push({kind:"p",text:d.join("\n")}),d=[])},f=null,g=()=>{null!==f&&(c.push({kind:"quote",text:f.join("\n")}),f=null)},m=a=>Math.min(6,Math.floor(a.length/2)),n=null,o=null;for(let a=0;a<b.length;a++){let p=b[a];if(null!==n){l.test(p)?(c.push({kind:"code",text:n.join("\n")}),n=null):n.push(p);continue}let q=p.match(/^>\s?(.*)$/);if(q){e(),o=null,(f??=[]).push(q[1]);continue}if(g(),l.test(p)){e(),o=null,n=[];continue}if(/^\s*$/.test(p)){e(),o=null;continue}let r=p.match(/^#### +(.+)$/);if(r){e(),o=null,c.push({kind:"h4",text:r[1]});continue}let s=p.match(/^### +(.+)$/);if(s){e(),o=null,c.push({kind:"h3",text:s[1]});continue}let t=p.match(/^## +(.+)$/);if(t){e(),o=null,c.push({kind:"h2",text:t[1]});continue}let u=p.match(/^# +(.+)$/);if(u){e(),o=null,c.push({kind:"h1",text:u[1]});continue}if(i(p)&&a+1<b.length&&h(b[a+1])){e(),o=null;let d=[j(p)],f=j(b[a+1]).map(k),g=a+2;for(;g<b.length&&i(b[g])&&!h(b[g]);)d.push(j(b[g])),g++;c.push({kind:"table",text:b.slice(a,g).join("\n"),rows:d,align:f}),a=g-1;continue}let v=p.match(/^(\s*)(\d+)\. +(.+)$/);if(v){e(),c.push({kind:"ol",text:v[3],depth:m(v[1]),marker:v[2]}),o=c.length-1;continue}let w=p.match(/^(\s*)- +(.+)$/);if(w){e(),c.push({kind:"ul",text:w[2],depth:m(w[1])}),o=c.length-1;continue}if(null!==o&&0===d.length){c[o].text+=" "+p.trim();continue}d.push(p)}return e(),g(),null!==n&&c.push({kind:"code",text:n.join("\n")}),c}let n=/("(?:\\.|[^"\\])*")(\s*:)?|\b(true|false|null)\b|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)/g;function o({text:a}){let b=function(a){let b=a.trim();if(!b||"{"!==b[0]&&"["!==b[0])return null;try{return JSON.stringify(JSON.parse(b),null,2)}catch{return null}}(a);return(0,d.jsx)("pre",{className:"overflow-x-auto rounded-lg border border-white/10 bg-white/[0.06] p-3 text-[12px] leading-relaxed",children:(0,d.jsx)("code",{className:"whitespace-pre font-mono [overflow-wrap:normal]",children:b?function(a){let b,c=[],e=0,f=0,g=a=>(0,d.jsx)("span",{className:"text-foreground/45",children:a},f++);for(n.lastIndex=0;null!==(b=n.exec(a));){if(b.index>e&&c.push(g(a.slice(e,b.index))),void 0!==b[1]){let a=void 0!==b[2];c.push((0,d.jsx)("span",{className:a?"text-sky-300":"text-emerald-300/90",children:b[1]},f++)),a&&b[2]&&c.push(g(b[2]))}else void 0!==b[3]?c.push((0,d.jsx)("span",{className:"text-purple-300",children:b[3]},f++)):void 0!==b[4]&&c.push((0,d.jsx)("span",{className:"text-amber-300",children:b[4]},f++));e=n.lastIndex}return e<a.length&&c.push(g(a.slice(e))),c}(b):(0,d.jsx)("span",{className:"text-foreground/85",children:a})})})}function p({block:a}){let b=a.rows??[];if(0===b.length)return null;let[c,...e]=b,g=a.align??[],h=a=>"center"===g[a]?"text-center":"right"===g[a]?"text-right":"text-left";return(0,d.jsx)("div",{className:"overflow-x-auto rounded-lg border border-white/10",children:(0,d.jsxs)("table",{className:"w-full border-collapse text-[13px] [overflow-wrap:normal]",children:[(0,d.jsx)("thead",{children:(0,d.jsx)("tr",{className:"border-b border-white/15 bg-white/[0.04]",children:c.map((a,b)=>(0,d.jsx)("th",{className:(0,f.cn)("whitespace-nowrap px-3 py-1.5 font-semibold text-foreground",h(b)),children:(0,d.jsx)(x,{text:a})},b))})}),(0,d.jsx)("tbody",{children:e.map((a,b)=>(0,d.jsx)("tr",{className:"border-b border-white/5 last:border-0",children:a.map((a,b)=>(0,d.jsx)("td",{className:(0,f.cn)("px-3 py-1.5 align-top text-foreground/90",h(b)),children:(0,d.jsx)(x,{text:a})},b))},b))})]})})}let q=["h1","h2","h3","h4"];function r(a){return q.includes(a)}function s(a){let b=q.indexOf(a);return b<0?0:b}function t(a){return`plan-h-${a}`}function u(a){return a.replace(/[`*]/g,"").trim()}function v(a,b,c,e){let g="reading"===c;switch(a.kind){case"h1":return(0,d.jsx)("h1",{id:e,className:g?"scroll-mt-24 text-xl font-semibold tracking-tight text-foreground":"text-base font-semibold text-foreground",children:b});case"h2":return(0,d.jsx)("h2",{id:e,className:g?"mt-6 scroll-mt-24 border-b border-white/10 pb-1 text-lg font-semibold text-foreground":"mt-3 text-sm font-semibold text-muted-foreground",children:b});case"h3":return(0,d.jsx)("h3",{id:e,className:g?"mt-4 scroll-mt-24 text-base font-semibold text-foreground":"mt-2 text-[13px] font-semibold text-foreground",children:b});case"h4":return(0,d.jsx)("h4",{id:e,className:g?"mt-3 scroll-mt-24 text-sm font-semibold text-muted-foreground":"mt-2 text-[13px] font-semibold text-muted-foreground",children:b});case"ul":case"ol":{let c=a.depth??0;return(0,d.jsxs)("div",{className:(0,f.cn)("flex gap-2",g?"text-foreground/95":"text-foreground/90"),style:{marginLeft:`${.75+1.25*c}rem`},children:[(0,d.jsx)("span",{className:"shrink-0 select-none text-muted-foreground tabular-nums",children:"ol"===a.kind?`${a.marker}.`:"•"}),(0,d.jsx)("span",{className:"min-w-0 flex-1",children:b})]})}case"quote":return(0,d.jsx)("blockquote",{className:(0,f.cn)("whitespace-pre-wrap border-l-2 pl-3 italic",g?"border-white/15 text-foreground/80":"border-white/10 text-foreground/75"),children:b});default:return(0,d.jsx)("p",{className:(0,f.cn)("whitespace-pre-wrap",g?"text-foreground/95":"text-foreground/90"),children:b})}}function w({block:a,variant:b}){return"code"===a.kind?(0,d.jsx)(o,{text:a.text}):"table"===a.kind?(0,d.jsx)(p,{block:a}):(0,d.jsx)(d.Fragment,{children:v(a,(0,d.jsx)(x,{text:a.text}),b)})}function x({text:a}){let b=a.split(/(`[^`]+`|\*\*[\s\S]+?\*\*|\*[^*]+\*)/g);return(0,d.jsx)(d.Fragment,{children:b.map((a,b)=>/^`[^`]+`$/.test(a)?(0,d.jsx)("code",{className:"rounded bg-white/5 px-1 font-mono text-[12px]",children:a.slice(1,-1)},b):/^\*\*[\s\S]+\*\*$/.test(a)?(0,d.jsx)("strong",{className:"font-semibold text-foreground",children:(0,d.jsx)(x,{text:a.slice(2,-2)})},b):/^\*[^*]+\*$/.test(a)?(0,d.jsx)("em",{className:"text-muted-foreground",children:(0,d.jsx)(x,{text:a.slice(1,-1)})},b):(0,d.jsx)("span",{children:a},b))})}}};
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[874],{60874:(e,t,n)=>{n.d(t,{F8:()=>b,NG:()=>m,QH:()=>f,Vq:()=>g,aM:()=>N,cV:()=>$,kz:()=>w,n$:()=>x,pO:()=>i,vB:()=>j});var l=n(95155),r=n(12115),s=n(91337);function i({markdown:e,className:t,variant:n="reading"}){let o=(0,r.useMemo)(()=>x(e),[e]),c="reading"===n;return(0,l.jsx)("div",{className:(0,s.cn)("min-w-0 [overflow-wrap:anywhere]",c?"mx-auto w-full max-w-[66ch] space-y-4 text-[15px] leading-[1.6]":"space-y-3.5 text-[13px] leading-relaxed",t),children:o.map((e,t)=>(0,l.jsx)(k,{block:e,variant:n},t))})}function o(e){let t=e.trim();return t.includes("|")&&t.includes("-")&&/^[\s|:-]+$/.test(t)}function c(e){return""!==e.trim()&&e.includes("|")}function u(e){let t=e.trim();return t.startsWith("|")&&(t=t.slice(1)),t.endsWith("|")&&(t=t.slice(0,-1)),t.split("|").map(e=>e.trim())}function d(e){let t=e.trim(),n=t.startsWith(":"),l=t.endsWith(":");return n&&l?"center":l?"right":n?"left":null}let a=/^\s*```[^\s`]*\s*$/;function x(e){let t=e.split("\n"),n=[],l=[],r=()=>{l.length&&(n.push({kind:"p",text:l.join("\n")}),l=[])},s=null,i=()=>{null!==s&&(n.push({kind:"quote",text:s.join("\n")}),s=null)},x=e=>Math.min(6,Math.floor(e.length/2)),h=null,m=null;for(let e=0;e<t.length;e++){let f=t[e];if(null!==h){a.test(f)?(n.push({kind:"code",text:h.join("\n")}),h=null):h.push(f);continue}let p=f.match(/^>\s?(.*)$/);if(p){r(),m=null,(s??=[]).push(p[1]);continue}if(i(),a.test(f)){r(),m=null,h=[];continue}if(/^\s*$/.test(f)){r(),m=null;continue}let g=f.match(/^#### +(.+)$/);if(g){r(),m=null,n.push({kind:"h4",text:g[1]});continue}let b=f.match(/^### +(.+)$/);if(b){r(),m=null,n.push({kind:"h3",text:b[1]});continue}let j=f.match(/^## +(.+)$/);if(j){r(),m=null,n.push({kind:"h2",text:j[1]});continue}let w=f.match(/^# +(.+)$/);if(w){r(),m=null,n.push({kind:"h1",text:w[1]});continue}if(c(f)&&e+1<t.length&&o(t[e+1])){r(),m=null;let l=[u(f)],s=u(t[e+1]).map(d),i=e+2;for(;i<t.length&&c(t[i])&&!o(t[i]);)l.push(u(t[i])),i++;n.push({kind:"table",text:t.slice(e,i).join("\n"),rows:l,align:s}),e=i-1;continue}let N=f.match(/^(\s*)(\d+)\. +(.+)$/);if(N){r(),n.push({kind:"ol",text:N[3],depth:x(N[1]),marker:N[2]}),m=n.length-1;continue}let k=f.match(/^(\s*)- +(.+)$/);if(k){r(),n.push({kind:"ul",text:k[2],depth:x(k[1])}),m=n.length-1;continue}if(null!==m&&0===l.length){n[m].text+=" "+f.trim();continue}l.push(f)}return r(),i(),null!==h&&n.push({kind:"code",text:h.join("\n")}),n}let h=/("(?:\\.|[^"\\])*")(\s*:)?|\b(true|false|null)\b|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)/g;function m({text:e}){let t=function(e){let t=e.trim();if(!t||"{"!==t[0]&&"["!==t[0])return null;try{return JSON.stringify(JSON.parse(t),null,2)}catch{return null}}(e);return(0,l.jsx)("pre",{className:"overflow-x-auto rounded-lg border border-white/10 bg-white/[0.06] p-3 text-[12px] leading-relaxed",children:(0,l.jsx)("code",{className:"whitespace-pre font-mono [overflow-wrap:normal]",children:t?function(e){let t,n=[],r=0,s=0,i=e=>(0,l.jsx)("span",{className:"text-foreground/45",children:e},s++);for(h.lastIndex=0;null!==(t=h.exec(e));){if(t.index>r&&n.push(i(e.slice(r,t.index))),void 0!==t[1]){let e=void 0!==t[2];n.push((0,l.jsx)("span",{className:e?"text-sky-300":"text-emerald-300/90",children:t[1]},s++)),e&&t[2]&&n.push(i(t[2]))}else void 0!==t[3]?n.push((0,l.jsx)("span",{className:"text-purple-300",children:t[3]},s++)):void 0!==t[4]&&n.push((0,l.jsx)("span",{className:"text-amber-300",children:t[4]},s++));r=h.lastIndex}return r<e.length&&n.push(i(e.slice(r))),n}(t):(0,l.jsx)("span",{className:"text-foreground/85",children:e})})})}function f({block:e}){let t=e.rows??[];if(0===t.length)return null;let[n,...r]=t,i=e.align??[],o=e=>"center"===i[e]?"text-center":"right"===i[e]?"text-right":"text-left";return(0,l.jsx)("div",{className:"overflow-x-auto rounded-lg border border-white/10",children:(0,l.jsxs)("table",{className:"w-full border-collapse text-[13px] [overflow-wrap:normal]",children:[(0,l.jsx)("thead",{children:(0,l.jsx)("tr",{className:"border-b border-white/15 bg-white/[0.04]",children:n.map((e,t)=>(0,l.jsx)("th",{className:(0,s.cn)("whitespace-nowrap px-3 py-1.5 font-semibold text-foreground",o(t)),children:(0,l.jsx)($,{text:e})},t))})}),(0,l.jsx)("tbody",{children:r.map((e,t)=>(0,l.jsx)("tr",{className:"border-b border-white/5 last:border-0",children:e.map((e,t)=>(0,l.jsx)("td",{className:(0,s.cn)("px-3 py-1.5 align-top text-foreground/90",o(t)),children:(0,l.jsx)($,{text:e})},t))},t))})]})})}let p=["h1","h2","h3","h4"];function g(e){return p.includes(e)}function b(e){let t=p.indexOf(e);return t<0?0:t}function j(e){return`plan-h-${e}`}function w(e){return e.replace(/[`*]/g,"").trim()}function N(e,t,n,r){let i="reading"===n;switch(e.kind){case"h1":return(0,l.jsx)("h1",{id:r,className:i?"scroll-mt-24 text-xl font-semibold tracking-tight text-foreground":"text-base font-semibold text-foreground",children:t});case"h2":return(0,l.jsx)("h2",{id:r,className:i?"mt-6 scroll-mt-24 border-b border-white/10 pb-1 text-lg font-semibold text-foreground":"mt-3 text-sm font-semibold text-muted-foreground",children:t});case"h3":return(0,l.jsx)("h3",{id:r,className:i?"mt-4 scroll-mt-24 text-base font-semibold text-foreground":"mt-2 text-[13px] font-semibold text-foreground",children:t});case"h4":return(0,l.jsx)("h4",{id:r,className:i?"mt-3 scroll-mt-24 text-sm font-semibold text-muted-foreground":"mt-2 text-[13px] font-semibold text-muted-foreground",children:t});case"ul":case"ol":{let n=e.depth??0;return(0,l.jsxs)("div",{className:(0,s.cn)("flex gap-2",i?"text-foreground/95":"text-foreground/90"),style:{marginLeft:`${.75+1.25*n}rem`},children:[(0,l.jsx)("span",{className:"shrink-0 select-none text-muted-foreground tabular-nums",children:"ol"===e.kind?`${e.marker}.`:"•"}),(0,l.jsx)("span",{className:"min-w-0 flex-1",children:t})]})}case"quote":return(0,l.jsx)("blockquote",{className:(0,s.cn)("whitespace-pre-wrap border-l-2 pl-3 italic",i?"border-white/15 text-foreground/80":"border-white/10 text-foreground/75"),children:t});default:return(0,l.jsx)("p",{className:(0,s.cn)("whitespace-pre-wrap",i?"text-foreground/95":"text-foreground/90"),children:t})}}function k({block:e,variant:t}){return"code"===e.kind?(0,l.jsx)(m,{text:e.text}):"table"===e.kind?(0,l.jsx)(f,{block:e}):(0,l.jsx)(l.Fragment,{children:N(e,(0,l.jsx)($,{text:e.text}),t)})}function $({text:e}){let t=e.split(/(`[^`]+`|\*\*[\s\S]+?\*\*|\*[^*]+\*)/g);return(0,l.jsx)(l.Fragment,{children:t.map((e,t)=>/^`[^`]+`$/.test(e)?(0,l.jsx)("code",{className:"rounded bg-white/5 px-1 font-mono text-[12px]",children:e.slice(1,-1)},t):/^\*\*[\s\S]+\*\*$/.test(e)?(0,l.jsx)("strong",{className:"font-semibold text-foreground",children:(0,l.jsx)($,{text:e.slice(2,-2)})},t):/^\*[^*]+\*$/.test(e)?(0,l.jsx)("em",{className:"text-muted-foreground",children:(0,l.jsx)($,{text:e.slice(1,-1)})},t):(0,l.jsx)("span",{children:e},t))})}}}]);