@agent-spaces/server 0.3.62 → 0.3.64

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 (367) hide show
  1. package/dist/adapters/agent-runtime-types.js +12 -0
  2. package/dist/adapters/claude-code-runtime/index.js +3 -0
  3. package/dist/adapters/claude-code-runtime/message-format.js +1 -1
  4. package/dist/adapters/codex-runtime.js +2 -2
  5. package/dist/adapters/git.js +161 -57
  6. package/dist/adapters/langchain-runtime.js +2 -2
  7. package/dist/adapters/open-agent-sdk-runtime.js +2 -2
  8. package/dist/agents/agent-designer.js +66 -12
  9. package/dist/agents/commit-agent.js +1 -0
  10. package/dist/agents/issue-agent-progress.js +4 -2
  11. package/dist/agents/issue-agent-runner.js +5 -5
  12. package/dist/agents/issue-task-controller.js +96 -15
  13. package/dist/app.js +123 -5
  14. package/dist/package.json +1 -1
  15. package/dist/routes/agent-commands.js +72 -0
  16. package/dist/routes/agent-sse.js +10 -2
  17. package/dist/routes/agent.js +15 -1
  18. package/dist/routes/database.js +345 -0
  19. package/dist/routes/git.js +52 -1
  20. package/dist/routes/hooks.js +88 -0
  21. package/dist/routes/issue.js +59 -1
  22. package/dist/routes/kanban.js +39 -0
  23. package/dist/routes/output-style.js +48 -0
  24. package/dist/routes/prompt-template.js +2 -2
  25. package/dist/routes/skill.js +86 -15
  26. package/dist/routes/task.js +13 -1
  27. package/dist/services/agent-commands.js +168 -0
  28. package/dist/services/builtin-tools/command-tools.js +117 -0
  29. package/dist/services/builtin-tools/database-tools.js +578 -0
  30. package/dist/services/builtin-tools/index.js +5 -0
  31. package/dist/services/builtin-tools/input-helpers.js +26 -0
  32. package/dist/services/builtin-tools/issue-tools.js +209 -0
  33. package/dist/services/builtin-tools/kanban-tools.js +277 -0
  34. package/dist/services/database-vector.js +244 -0
  35. package/dist/services/hook-engine.js +118 -0
  36. package/dist/services/issue.js +6 -0
  37. package/dist/services/kanban.js +50 -0
  38. package/dist/services/notification-hub/bot-agent.js +1 -0
  39. package/dist/services/output-style.js +134 -0
  40. package/dist/services/prompt-template.js +2 -2
  41. package/dist/services/skill.js +148 -35
  42. package/dist/storage/database-store.js +365 -0
  43. package/dist/storage/hook-store.js +55 -0
  44. package/dist/storage/kanban-store.js +142 -0
  45. package/dist/web/404.html +1 -1
  46. package/dist/web/__next.__PAGE__.txt +4 -4
  47. package/dist/web/__next._full.txt +26 -30
  48. package/dist/web/__next._head.txt +4 -4
  49. package/dist/web/__next._index.txt +14 -14
  50. package/dist/web/__next._tree.txt +3 -8
  51. package/dist/web/_next/static/chunks/0-9194nbxy_6d.js +1 -0
  52. package/dist/web/_next/static/chunks/0-f~0xmwl__u5.js +1 -0
  53. package/dist/web/_next/static/chunks/0.n~yfwf4~6w-.js +1 -0
  54. package/dist/web/_next/static/chunks/002_j970b9gdx.js +1 -0
  55. package/dist/web/_next/static/chunks/01iqv28_snwus.js +1 -0
  56. package/dist/web/_next/static/chunks/01~quun6sefgl.js +1 -0
  57. package/dist/web/_next/static/chunks/02mf61htij8g0.js +31 -0
  58. package/dist/web/_next/static/chunks/03scq1-0ykve3.js +1 -0
  59. package/dist/web/_next/static/chunks/04a4vsq2wknm4.js +1 -0
  60. package/dist/web/_next/static/chunks/04dg4l4hv11q2.js +3 -0
  61. package/dist/web/_next/static/chunks/04fxddw-y20~-.js +7 -0
  62. package/dist/web/_next/static/chunks/04w7~5ooz_pwm.js +1 -0
  63. package/dist/web/_next/static/chunks/05oc21sj24wtq.js +1 -0
  64. package/dist/web/_next/static/chunks/{0zd1o3u04~qvo.js → 05psi2gtx~bev.js} +7 -7
  65. package/dist/web/_next/static/chunks/{0-oog4zg4_m~m.css → 062f9zqctzg.b.css} +0 -3
  66. package/dist/web/_next/static/chunks/{12odetnu-lyrr.js → 06whz1~s_7pva.js} +12 -12
  67. package/dist/web/_next/static/chunks/08ckpwmmwlors.js +3 -0
  68. package/dist/web/_next/static/chunks/08k~meqbd8d6v.js +1 -0
  69. package/dist/web/_next/static/chunks/099h96wjsdb25.js +2 -0
  70. package/dist/web/_next/static/chunks/09h23logvq65m.js +1 -0
  71. package/dist/web/_next/static/chunks/{0njy89g5coeyi.js → 0_8dm7bxp18xo.js} +6 -6
  72. package/dist/web/_next/static/chunks/0_mvduwjsm35w.js +1 -0
  73. package/dist/web/_next/static/chunks/0_vi1a~g4wx46.js +3 -0
  74. package/dist/web/_next/static/chunks/0a5y-vhf4i5id.js +3 -0
  75. package/dist/web/_next/static/chunks/0ake2f3x2uan4.js +24 -0
  76. package/dist/web/_next/static/chunks/{0tvd~rxgf0oh_.js → 0bbmx45w_h5np.js} +1 -1
  77. package/dist/web/_next/static/chunks/0ck8dw_9-1cdx.js +1 -0
  78. package/dist/web/_next/static/chunks/{07a0rktf_nr5h.js → 0ctg5qmw7uu.1.js} +2 -2
  79. package/dist/web/_next/static/chunks/0ewceguykiut5.js +1 -0
  80. package/dist/web/_next/static/chunks/0f7cb9li~3jra.js +67 -0
  81. package/dist/web/_next/static/chunks/0fttswpzu69qx.js +1 -0
  82. package/dist/web/_next/static/chunks/0ghs9on7wodrm.js +1 -0
  83. package/dist/web/_next/static/chunks/0ghx3j_.-gdyd.js +1 -0
  84. package/dist/web/_next/static/chunks/{0202ia13sijwb.js → 0h18ej5yf974e.js} +1 -1
  85. package/dist/web/_next/static/chunks/0h9cu-k6z5o08.js +1 -0
  86. package/dist/web/_next/static/chunks/0i39jifmxla7q.js +1 -0
  87. package/dist/web/_next/static/chunks/0iuf30t0rjsjv.js +19 -0
  88. package/dist/web/_next/static/chunks/0jb4~3qqkw2ps.js +1 -0
  89. package/dist/web/_next/static/chunks/0k4zdm72k_bfy.js +1 -0
  90. package/dist/web/_next/static/chunks/{08o-zmr-40r5g.js → 0m11vvph7q94-.js} +1 -1
  91. package/dist/web/_next/static/chunks/0n6_4so_afuwk.js +71 -0
  92. package/dist/web/_next/static/chunks/0nb8.iteznuvx.js +1 -0
  93. package/dist/web/_next/static/chunks/0np.d~hc1-pmh.js +4 -0
  94. package/dist/web/_next/static/chunks/{0qpq0~_58fe9a.js → 0oaq67r7ix.vg.js} +1 -1
  95. package/dist/web/_next/static/chunks/{0d_dp_4ofz0l3.css → 0ojcao3hdm36s.css} +0 -1
  96. package/dist/web/_next/static/chunks/0os58q93stt7j.js +3 -0
  97. package/dist/web/_next/static/chunks/{0gig.k.rq8d0x.js → 0ppr271hz0xoq.js} +1 -1
  98. package/dist/web/_next/static/chunks/0s9lmk8iauou3.js +1 -0
  99. package/dist/web/_next/static/chunks/0sp_zbx~w0am7.js +1 -0
  100. package/dist/web/_next/static/chunks/0tel~zsv4z8l_.js +1 -0
  101. package/dist/web/_next/static/chunks/0twamv4wr_dbv.js +1 -0
  102. package/dist/web/_next/static/chunks/0uhol5wafdbl~.js +1 -0
  103. package/dist/web/_next/static/chunks/0v3a_x4vt42kx.js +5 -0
  104. package/dist/web/_next/static/chunks/{002-dxhags4dj.js → 0v6hte2z-32ca.js} +2 -2
  105. package/dist/web/_next/static/chunks/0v7q4mys.mnm..css +1 -0
  106. package/dist/web/_next/static/chunks/0vbqaynjq8ga..js +3 -0
  107. package/dist/web/_next/static/chunks/0xbaakj0dfc0..js +1 -0
  108. package/dist/web/_next/static/chunks/{0..g0jl-8qup7.js → 0xoo17yef_b8g.js} +1 -1
  109. package/dist/web/_next/static/chunks/0xt-8wk21gs7g.js +1 -0
  110. package/dist/web/_next/static/chunks/0za1r07-6az6w.js +1 -0
  111. package/dist/web/_next/static/chunks/0z~vqzbm_q371.js +1 -0
  112. package/dist/web/_next/static/chunks/0~3xm80~j9ddg.js +1 -0
  113. package/dist/web/_next/static/chunks/0~u.5r3-t7179.js +1 -0
  114. package/dist/web/_next/static/chunks/10l-9myrdo3x9.js +1 -0
  115. package/dist/web/_next/static/chunks/11-czmcci_55y.js +1 -0
  116. package/dist/web/_next/static/chunks/11k-.49r~1mfm.js +1 -0
  117. package/dist/web/_next/static/chunks/{0k.8qdk7oi_os.js → 128ugqd34tr_-.js} +1 -1
  118. package/dist/web/_next/static/chunks/12jm4gwmvq-0q.js +90 -0
  119. package/dist/web/_next/static/chunks/{0rke_patcovgr.js → 1442stwa0gbxe.js} +1 -1
  120. package/dist/web/_next/static/chunks/{0jokpgh485~28.js → 14hqmid8q4apf.js} +11 -11
  121. package/dist/web/_next/static/chunks/14s37n6h0_q3x.js +16 -0
  122. package/dist/web/_next/static/chunks/161ik5kfyuwtd.js +1 -0
  123. package/dist/web/_next/static/chunks/16sg-lflc8csx.js +1 -0
  124. package/dist/web/_next/static/chunks/17k~zbv0_4rep.js +1 -0
  125. package/dist/web/_next/static/chunks/17oc2l.ekcs8b.css +1 -0
  126. package/dist/web/_next/static/chunks/{turbopack-0lrdxynxb9-1t.js → turbopack-0ndm2zc_pdptk.js} +1 -1
  127. package/dist/web/_not-found/__next._full.txt +30 -31
  128. package/dist/web/_not-found/__next._head.txt +4 -4
  129. package/dist/web/_not-found/__next._index.txt +14 -14
  130. package/dist/web/_not-found/__next._not-found.__PAGE__.txt +2 -2
  131. package/dist/web/_not-found/__next._not-found.txt +3 -3
  132. package/dist/web/_not-found/__next._tree.txt +3 -3
  133. package/dist/web/_not-found.html +1 -1
  134. package/dist/web/_not-found.txt +30 -31
  135. package/dist/web/index.html +1 -1
  136. package/dist/web/index.txt +26 -30
  137. package/dist/web/login/__next._full.txt +32 -36
  138. package/dist/web/login/__next._head.txt +4 -4
  139. package/dist/web/login/__next._index.txt +14 -14
  140. package/dist/web/login/__next._tree.txt +3 -8
  141. package/dist/web/login/__next.login.__PAGE__.txt +4 -4
  142. package/dist/web/login/__next.login.txt +3 -3
  143. package/dist/web/login.html +1 -1
  144. package/dist/web/login.txt +32 -36
  145. package/dist/web/settings/__next._full.txt +29 -34
  146. package/dist/web/settings/__next._head.txt +4 -4
  147. package/dist/web/settings/__next._index.txt +14 -14
  148. package/dist/web/settings/__next._tree.txt +3 -8
  149. package/dist/web/settings/__next.settings.__PAGE__.txt +4 -4
  150. package/dist/web/settings/__next.settings.txt +5 -5
  151. package/dist/web/settings/agents/__next._full.txt +27 -32
  152. package/dist/web/settings/agents/__next._head.txt +4 -4
  153. package/dist/web/settings/agents/__next._index.txt +14 -14
  154. package/dist/web/settings/agents/__next._tree.txt +3 -8
  155. package/dist/web/settings/agents/__next.settings.agents.__PAGE__.txt +4 -4
  156. package/dist/web/settings/agents/__next.settings.agents.txt +3 -3
  157. package/dist/web/settings/agents/__next.settings.txt +5 -5
  158. package/dist/web/settings/agents.html +1 -1
  159. package/dist/web/settings/agents.txt +27 -32
  160. package/dist/web/settings/mcps/__next._full.txt +27 -32
  161. package/dist/web/settings/mcps/__next._head.txt +4 -4
  162. package/dist/web/settings/mcps/__next._index.txt +14 -14
  163. package/dist/web/settings/mcps/__next._tree.txt +3 -8
  164. package/dist/web/settings/mcps/__next.settings.mcps.__PAGE__.txt +4 -4
  165. package/dist/web/settings/mcps/__next.settings.mcps.txt +3 -3
  166. package/dist/web/settings/mcps/__next.settings.txt +5 -5
  167. package/dist/web/settings/mcps.html +1 -1
  168. package/dist/web/settings/mcps.txt +27 -32
  169. package/dist/web/settings/models/__next._full.txt +27 -32
  170. package/dist/web/settings/models/__next._head.txt +4 -4
  171. package/dist/web/settings/models/__next._index.txt +14 -14
  172. package/dist/web/settings/models/__next._tree.txt +3 -8
  173. package/dist/web/settings/models/__next.settings.models.__PAGE__.txt +4 -4
  174. package/dist/web/settings/models/__next.settings.models.txt +3 -3
  175. package/dist/web/settings/models/__next.settings.txt +5 -5
  176. package/dist/web/settings/models.html +1 -1
  177. package/dist/web/settings/models.txt +27 -32
  178. package/dist/web/settings/output-styles/__next._full.txt +38 -0
  179. package/dist/web/settings/output-styles/__next._head.txt +6 -0
  180. package/dist/web/settings/output-styles/__next._index.txt +15 -0
  181. package/dist/web/settings/output-styles/__next._tree.txt +3 -0
  182. package/dist/web/settings/output-styles/__next.settings.output-styles.__PAGE__.txt +9 -0
  183. package/dist/web/settings/output-styles/__next.settings.output-styles.txt +5 -0
  184. package/dist/web/settings/output-styles/__next.settings.txt +7 -0
  185. package/dist/web/settings/output-styles.html +1 -0
  186. package/dist/web/settings/output-styles.txt +38 -0
  187. package/dist/web/settings/prompts/__next._full.txt +27 -32
  188. package/dist/web/settings/prompts/__next._head.txt +4 -4
  189. package/dist/web/settings/prompts/__next._index.txt +14 -14
  190. package/dist/web/settings/prompts/__next._tree.txt +3 -8
  191. package/dist/web/settings/prompts/__next.settings.prompts.__PAGE__.txt +4 -4
  192. package/dist/web/settings/prompts/__next.settings.prompts.txt +3 -3
  193. package/dist/web/settings/prompts/__next.settings.txt +5 -5
  194. package/dist/web/settings/prompts.html +1 -1
  195. package/dist/web/settings/prompts.txt +27 -32
  196. package/dist/web/settings/providers/__next._full.txt +27 -32
  197. package/dist/web/settings/providers/__next._head.txt +4 -4
  198. package/dist/web/settings/providers/__next._index.txt +14 -14
  199. package/dist/web/settings/providers/__next._tree.txt +3 -8
  200. package/dist/web/settings/providers/__next.settings.providers.__PAGE__.txt +4 -4
  201. package/dist/web/settings/providers/__next.settings.providers.txt +3 -3
  202. package/dist/web/settings/providers/__next.settings.txt +5 -5
  203. package/dist/web/settings/providers.html +1 -1
  204. package/dist/web/settings/providers.txt +27 -32
  205. package/dist/web/settings/skills/__next._full.txt +27 -32
  206. package/dist/web/settings/skills/__next._head.txt +4 -4
  207. package/dist/web/settings/skills/__next._index.txt +14 -14
  208. package/dist/web/settings/skills/__next._tree.txt +3 -8
  209. package/dist/web/settings/skills/__next.settings.skills.__PAGE__.txt +4 -4
  210. package/dist/web/settings/skills/__next.settings.skills.txt +3 -3
  211. package/dist/web/settings/skills/__next.settings.txt +5 -5
  212. package/dist/web/settings/skills.html +1 -1
  213. package/dist/web/settings/skills.txt +27 -32
  214. package/dist/web/settings/tools/__next._full.txt +38 -0
  215. package/dist/web/settings/tools/__next._head.txt +6 -0
  216. package/dist/web/settings/tools/__next._index.txt +15 -0
  217. package/dist/web/settings/tools/__next._tree.txt +3 -0
  218. package/dist/web/settings/tools/__next.settings.tools.__PAGE__.txt +9 -0
  219. package/dist/web/settings/tools/__next.settings.tools.txt +5 -0
  220. package/dist/web/settings/tools/__next.settings.txt +7 -0
  221. package/dist/web/settings/tools.html +1 -0
  222. package/dist/web/settings/tools.txt +38 -0
  223. package/dist/web/settings.html +1 -1
  224. package/dist/web/settings.txt +29 -34
  225. package/dist/web/workflows/__next._full.txt +34 -37
  226. package/dist/web/workflows/__next._head.txt +4 -4
  227. package/dist/web/workflows/__next._index.txt +14 -14
  228. package/dist/web/workflows/__next._tree.txt +3 -8
  229. package/dist/web/workflows/__next.workflows.__PAGE__.txt +4 -4
  230. package/dist/web/workflows/__next.workflows.txt +3 -3
  231. package/dist/web/workflows.html +1 -1
  232. package/dist/web/workflows.txt +34 -37
  233. package/dist/web/workspace/_/__next._full.txt +32 -77
  234. package/dist/web/workspace/_/__next._head.txt +4 -4
  235. package/dist/web/workspace/_/__next._index.txt +14 -14
  236. package/dist/web/workspace/_/__next._tree.txt +4 -23
  237. package/dist/web/workspace/_/__next.workspace.$d$id.__PAGE__.txt +3 -18
  238. package/dist/web/workspace/_/__next.workspace.$d$id.txt +3 -3
  239. package/dist/web/workspace/_/__next.workspace.txt +3 -3
  240. package/dist/web/workspace/_.html +1 -1
  241. package/dist/web/workspace/_.txt +32 -77
  242. package/dist/web/workspaces/__next._full.txt +32 -38
  243. package/dist/web/workspaces/__next._head.txt +4 -4
  244. package/dist/web/workspaces/__next._index.txt +14 -14
  245. package/dist/web/workspaces/__next._tree.txt +3 -8
  246. package/dist/web/workspaces/__next.workspaces.__PAGE__.txt +4 -4
  247. package/dist/web/workspaces/__next.workspaces.txt +3 -3
  248. package/dist/web/workspaces.html +1 -1
  249. package/dist/web/workspaces.txt +32 -38
  250. package/dist/ws/agent-prompt.js +45 -8
  251. package/dist/ws/agent-runner.js +10 -6
  252. package/package.json +11 -10
  253. package/public/output-styles/carmack-mode.md +381 -0
  254. package/public/output-styles/codex-rigor-mode.md +114 -0
  255. package/public/output-styles/dhh-mode.md +265 -0
  256. package/public/output-styles/evan-you-mode.md +539 -0
  257. package/public/output-styles/index.json +37 -0
  258. package/public/output-styles/jobs-mode.md +369 -0
  259. package/public/output-styles/linus-mode.md +135 -0
  260. package/public/output-styles/uncle-bob-mode.md +221 -0
  261. package/public/prompt/andrej-karpathy-skills.md +65 -0
  262. package/public/prompt/claude-token-efficient-coding.md +35 -0
  263. package/public/prompt/index.json +12 -0
  264. package/public/skills/index.json +92 -0
  265. package/public/skills/planning-with-files/planning-with-files-zh/SKILL.md +243 -0
  266. package/public/skills/planning-with-files/planning-with-files-zh/scripts/check-complete.ps1 +44 -0
  267. package/public/skills/planning-with-files/planning-with-files-zh/scripts/check-complete.sh +46 -0
  268. package/public/skills/planning-with-files/planning-with-files-zh/scripts/init-session.ps1 +124 -0
  269. package/public/skills/planning-with-files/planning-with-files-zh/scripts/init-session.sh +124 -0
  270. package/public/skills/planning-with-files/planning-with-files-zh/scripts/session-catchup.py +438 -0
  271. package/public/skills/planning-with-files/planning-with-files-zh/templates/findings.md +29 -0
  272. package/public/skills/planning-with-files/planning-with-files-zh/templates/progress.md +40 -0
  273. package/public/skills/planning-with-files/planning-with-files-zh/templates/task_plan.md +58 -0
  274. package/public/skills/superpowers/brainstorming/SKILL.md +164 -0
  275. package/public/skills/superpowers/brainstorming/scripts/frame-template.html +214 -0
  276. package/public/skills/superpowers/brainstorming/scripts/helper.js +88 -0
  277. package/public/skills/superpowers/brainstorming/scripts/server.cjs +354 -0
  278. package/public/skills/superpowers/brainstorming/scripts/start-server.sh +148 -0
  279. package/public/skills/superpowers/brainstorming/scripts/stop-server.sh +56 -0
  280. package/public/skills/superpowers/brainstorming/spec-document-reviewer-prompt.md +49 -0
  281. package/public/skills/superpowers/brainstorming/visual-companion.md +287 -0
  282. package/public/skills/superpowers/dispatching-parallel-agents/SKILL.md +182 -0
  283. package/public/skills/superpowers/executing-plans/SKILL.md +70 -0
  284. package/public/skills/superpowers/finishing-a-development-branch/SKILL.md +251 -0
  285. package/public/skills/superpowers/receiving-code-review/SKILL.md +213 -0
  286. package/public/skills/superpowers/requesting-code-review/SKILL.md +103 -0
  287. package/public/skills/superpowers/requesting-code-review/code-reviewer.md +168 -0
  288. package/public/skills/superpowers/subagent-driven-development/SKILL.md +279 -0
  289. package/public/skills/superpowers/subagent-driven-development/code-quality-reviewer-prompt.md +25 -0
  290. package/public/skills/superpowers/subagent-driven-development/implementer-prompt.md +113 -0
  291. package/public/skills/superpowers/subagent-driven-development/spec-reviewer-prompt.md +61 -0
  292. package/public/skills/superpowers/systematic-debugging/CREATION-LOG.md +119 -0
  293. package/public/skills/superpowers/systematic-debugging/SKILL.md +296 -0
  294. package/public/skills/superpowers/systematic-debugging/condition-based-waiting-example.ts +158 -0
  295. package/public/skills/superpowers/systematic-debugging/condition-based-waiting.md +115 -0
  296. package/public/skills/superpowers/systematic-debugging/defense-in-depth.md +122 -0
  297. package/public/skills/superpowers/systematic-debugging/find-polluter.sh +63 -0
  298. package/public/skills/superpowers/systematic-debugging/root-cause-tracing.md +169 -0
  299. package/public/skills/superpowers/systematic-debugging/test-academic.md +14 -0
  300. package/public/skills/superpowers/systematic-debugging/test-pressure-1.md +58 -0
  301. package/public/skills/superpowers/systematic-debugging/test-pressure-2.md +68 -0
  302. package/public/skills/superpowers/systematic-debugging/test-pressure-3.md +69 -0
  303. package/public/skills/superpowers/test-driven-development/SKILL.md +371 -0
  304. package/public/skills/superpowers/test-driven-development/testing-anti-patterns.md +299 -0
  305. package/public/skills/superpowers/using-git-worktrees/SKILL.md +215 -0
  306. package/public/skills/superpowers/using-superpowers/SKILL.md +117 -0
  307. package/public/skills/superpowers/using-superpowers/references/codex-tools.md +59 -0
  308. package/public/skills/superpowers/using-superpowers/references/copilot-tools.md +42 -0
  309. package/public/skills/superpowers/using-superpowers/references/gemini-tools.md +51 -0
  310. package/public/skills/superpowers/verification-before-completion/SKILL.md +139 -0
  311. package/public/skills/superpowers/writing-plans/SKILL.md +152 -0
  312. package/public/skills/superpowers/writing-plans/plan-document-reviewer-prompt.md +49 -0
  313. package/public/skills/superpowers/writing-skills/SKILL.md +655 -0
  314. package/public/skills/superpowers/writing-skills/anthropic-best-practices.md +1150 -0
  315. package/public/skills/superpowers/writing-skills/examples/CLAUDE_MD_TESTING.md +189 -0
  316. package/public/skills/superpowers/writing-skills/graphviz-conventions.dot +172 -0
  317. package/public/skills/superpowers/writing-skills/persuasion-principles.md +187 -0
  318. package/public/skills/superpowers/writing-skills/render-graphs.js +168 -0
  319. package/public/skills/superpowers/writing-skills/testing-skills-with-subagents.md +384 -0
  320. package/dist/web/_next/static/chunks/0-81wi7xr2nd-.js +0 -270
  321. package/dist/web/_next/static/chunks/00lca9lsasdm7.js +0 -1
  322. package/dist/web/_next/static/chunks/01gi~q0c6ez6..js +0 -1
  323. package/dist/web/_next/static/chunks/02shswpmybici.js +0 -1
  324. package/dist/web/_next/static/chunks/05tx6hzdtkgi9.js +0 -2
  325. package/dist/web/_next/static/chunks/07nbyndvzftr1.js +0 -3
  326. package/dist/web/_next/static/chunks/0bn~onkv~9xza.js +0 -1
  327. package/dist/web/_next/static/chunks/0g-0n6glz_z6w.js +0 -1
  328. package/dist/web/_next/static/chunks/0gyede80jpy3n.js +0 -4
  329. package/dist/web/_next/static/chunks/0hrbuvzuxrjfl.js +0 -1
  330. package/dist/web/_next/static/chunks/0i51q.5s_-.vh.css +0 -1
  331. package/dist/web/_next/static/chunks/0qf163pbrwy4z.js +0 -1
  332. package/dist/web/_next/static/chunks/0rnt-f3pjxb-d.js +0 -5
  333. package/dist/web/_next/static/chunks/0tgbcgsca9mrg.js +0 -1
  334. package/dist/web/_next/static/chunks/0tyhv6.y7~yxd.js +0 -1
  335. package/dist/web/_next/static/chunks/0u7_qd9hzqwac.js +0 -1
  336. package/dist/web/_next/static/chunks/0vuvql8rloda5.js +0 -1
  337. package/dist/web/_next/static/chunks/0wv0h27jafag4.js +0 -1
  338. package/dist/web/_next/static/chunks/0wwvc4zc2q6bn.js +0 -1
  339. package/dist/web/_next/static/chunks/0xmmk3vebw8xs.js +0 -1
  340. package/dist/web/_next/static/chunks/0xwqf.llmm_u2.js +0 -31
  341. package/dist/web/_next/static/chunks/0yo22_w53mo~5.js +0 -1
  342. package/dist/web/_next/static/chunks/12c0jp0qvlr1t.js +0 -1
  343. package/dist/web/_next/static/chunks/12pg1nn3v~~5k.js +0 -1
  344. package/dist/web/_next/static/chunks/16cyr8ilpx1nn.js +0 -1
  345. package/dist/web/_next/static/media/0a7740363b4d4863-s.1110aazvokzp..woff2 +0 -0
  346. package/dist/web/_next/static/media/0da9c7f357bd9d4d-s.0ek5sshv8wk3m.woff2 +0 -0
  347. package/dist/web/_next/static/media/1b99372b3eaef0c8-s.p.0gx2haw2tmll8.woff2 +0 -0
  348. package/dist/web/_next/static/media/41e95f694c5c4549-s.0r1jrq7neqdsq.woff2 +0 -0
  349. package/dist/web/_next/static/media/5c285b27cdda1fe8-s.p.0yo6-5yoeeudq.woff2 +0 -0
  350. package/dist/web/_next/static/media/5f9d24ebef5d5292-s.0esuu2f5si~v8.woff2 +0 -0
  351. package/dist/web/_next/static/media/6c55a692938ebbbc-s.0g6rbszwfgn9y.woff2 +0 -0
  352. package/dist/web/_next/static/media/8e6fa89aa22d24ec-s.p.0uvzar8hswo3p.woff2 +0 -0
  353. package/dist/web/_next/static/media/a218039a3287bcfd-s.p.17-1enzs_j91b.woff2 +0 -0
  354. package/dist/web/_next/static/media/b2ea385cb5ae8625-s.0kjod.kaq1k69.woff2 +0 -0
  355. package/dist/web/_next/static/media/bdc7e24a509eb931-s.0apt5mko2.qn3.woff2 +0 -0
  356. package/dist/web/_next/static/media/c3cb240f9c892514-s.163v2i5cux7-c.woff2 +0 -0
  357. package/dist/web/_next/static/media/e2334d715941921e-s.p.12skym0rqknxy.woff2 +0 -0
  358. package/public/avatars/1777813826407-bea0ja-minimax.svg +0 -1
  359. package/public/avatars/1777813967088-3xlvd0-minimax.svg +0 -1
  360. package/public/avatars/1777814041714-yp0qeq-minimax.svg +0 -1
  361. package/public/avatars/1777904986095-rg26je-icon.png +0 -0
  362. package/public/avatars/1778953228323-5je54x-user.jpg +0 -0
  363. package/public/avatars/1778954057880-g01q6y-user.jpg +0 -0
  364. /package/dist/web/_next/static/{GS3b40oeaeLxm7i9-ibaj → e8w3vd9Eov_LDYWj_0zsE}/_buildManifest.js +0 -0
  365. /package/dist/web/_next/static/{GS3b40oeaeLxm7i9-ibaj → e8w3vd9Eov_LDYWj_0zsE}/_clientMiddlewareManifest.js +0 -0
  366. /package/dist/web/_next/static/{GS3b40oeaeLxm7i9-ibaj → e8w3vd9Eov_LDYWj_0zsE}/_ssgManifest.js +0 -0
  367. /package/public/avatars/{1777815865622-08wp9m-user.jpg → user.jpg} +0 -0
@@ -0,0 +1,578 @@
1
+ import { BUILT_IN_AGENT_TOOLS } from '@agent-spaces/shared';
2
+ import * as databaseStore from '../../storage/database-store.js';
3
+ import * as databaseVector from '../database-vector.js';
4
+ import { assertRecord, readRequiredString, readString, readOptionalString, readStringOrDefault, normalizeSearchText } from './input-helpers.js';
5
+ const databasePathFilterInputSchema = {
6
+ type: 'object',
7
+ properties: {
8
+ databaseId: {
9
+ type: 'string',
10
+ description: 'Optional database ID from ListDatabases. If omitted, the first database is used. Do not use workspaceId.',
11
+ },
12
+ path: {
13
+ type: 'string',
14
+ description: 'Optional knowledge base path using titles, for example "/" or "/Projects/Spec". Defaults to root.',
15
+ },
16
+ filter: {
17
+ type: 'string',
18
+ description: 'Optional case-insensitive text filter.',
19
+ },
20
+ includeTrash: {
21
+ type: 'boolean',
22
+ description: 'Include trashed nodes. Defaults to false.',
23
+ },
24
+ },
25
+ additionalProperties: false,
26
+ };
27
+ const listDatabasesInputSchema = {
28
+ type: 'object',
29
+ properties: {},
30
+ additionalProperties: false,
31
+ };
32
+ const readDatabaseNodeInputSchema = {
33
+ type: 'object',
34
+ properties: {
35
+ databaseId: {
36
+ type: 'string',
37
+ description: 'Optional database ID from ListDatabases. If omitted, the first database is used. Do not use workspaceId.',
38
+ },
39
+ id: {
40
+ type: 'string',
41
+ description: 'Knowledge base node ID.',
42
+ },
43
+ },
44
+ required: ['id'],
45
+ additionalProperties: false,
46
+ };
47
+ const listDatabaseNodeVersionsInputSchema = {
48
+ type: 'object',
49
+ properties: {
50
+ databaseId: {
51
+ type: 'string',
52
+ description: 'Optional database ID from ListDatabases. If omitted, the first database is used. Do not use workspaceId.',
53
+ },
54
+ id: {
55
+ type: 'string',
56
+ description: 'Knowledge base node ID.',
57
+ },
58
+ limit: {
59
+ type: 'number',
60
+ description: 'Maximum number of versions. Defaults to 20, capped at 100.',
61
+ },
62
+ },
63
+ required: ['id'],
64
+ additionalProperties: false,
65
+ };
66
+ const queryDatabaseVectorsInputSchema = {
67
+ type: 'object',
68
+ properties: {
69
+ databaseId: {
70
+ type: 'string',
71
+ description: 'Optional database ID from ListDatabases. If omitted, the first database is used. Do not use workspaceId.',
72
+ },
73
+ query: {
74
+ type: 'string',
75
+ description: 'Semantic search query.',
76
+ },
77
+ limit: {
78
+ type: 'number',
79
+ description: 'Maximum number of results. Defaults to 5, capped at 20.',
80
+ },
81
+ },
82
+ required: ['query'],
83
+ additionalProperties: false,
84
+ };
85
+ const createDatabaseNodeInputSchema = {
86
+ type: 'object',
87
+ properties: {
88
+ databaseId: {
89
+ type: 'string',
90
+ description: 'Optional database ID from ListDatabases. If omitted, the first database is used. Do not use workspaceId.',
91
+ },
92
+ title: {
93
+ type: 'string',
94
+ description: 'Knowledge base node title.',
95
+ },
96
+ content: {
97
+ type: 'string',
98
+ description: 'Initial content. Defaults to empty.',
99
+ },
100
+ parentId: {
101
+ type: 'string',
102
+ description: 'Optional parent node ID. Omit for root.',
103
+ },
104
+ path: {
105
+ type: 'string',
106
+ description: 'Optional parent path using titles. Ignored when parentId is provided.',
107
+ },
108
+ icon: {
109
+ type: 'string',
110
+ description: 'Optional icon. Defaults to the document emoji 📝.',
111
+ },
112
+ cover: {
113
+ type: 'string',
114
+ description: 'Optional cover value.',
115
+ },
116
+ },
117
+ required: ['title'],
118
+ additionalProperties: false,
119
+ };
120
+ const writeDatabaseNodeInputSchema = {
121
+ type: 'object',
122
+ properties: {
123
+ databaseId: {
124
+ type: 'string',
125
+ description: 'Optional database ID from ListDatabases. If omitted, the first database is used. Do not use workspaceId.',
126
+ },
127
+ id: {
128
+ type: 'string',
129
+ description: 'Knowledge base node ID.',
130
+ },
131
+ mode: {
132
+ type: 'string',
133
+ enum: ['insert', 'replace', 'overwrite'],
134
+ description: 'insert appends content, replace replaces matched text, overwrite replaces all content. Defaults to insert.',
135
+ },
136
+ replace: {
137
+ type: 'string',
138
+ description: 'Text to replace when mode is replace.',
139
+ },
140
+ content: {
141
+ type: 'string',
142
+ description: 'Content to write.',
143
+ },
144
+ },
145
+ required: ['id', 'content'],
146
+ additionalProperties: false,
147
+ };
148
+ const deleteDatabaseNodeInputSchema = {
149
+ type: 'object',
150
+ properties: {
151
+ databaseId: {
152
+ type: 'string',
153
+ description: 'Optional database ID from ListDatabases. If omitted, the first database is used. Do not use workspaceId.',
154
+ },
155
+ id: {
156
+ type: 'string',
157
+ description: 'Knowledge base node or directory ID.',
158
+ },
159
+ permanent: {
160
+ type: 'boolean',
161
+ description: 'Permanently delete the node and descendants. Defaults to false, which moves them to trash.',
162
+ },
163
+ },
164
+ required: ['id'],
165
+ additionalProperties: false,
166
+ };
167
+ const moveDatabaseNodeInputSchema = {
168
+ type: 'object',
169
+ properties: {
170
+ databaseId: {
171
+ type: 'string',
172
+ description: 'Optional database ID from ListDatabases. If omitted, the first database is used. Do not use workspaceId.',
173
+ },
174
+ id: {
175
+ type: 'string',
176
+ description: 'Knowledge base node or directory ID to move.',
177
+ },
178
+ parentId: {
179
+ type: 'string',
180
+ description: 'Target parent node ID. Use null or omit for root.',
181
+ },
182
+ path: {
183
+ type: 'string',
184
+ description: 'Alternative target parent path. Ignored when parentId is provided.',
185
+ },
186
+ },
187
+ required: ['id'],
188
+ additionalProperties: false,
189
+ };
190
+ const updateDatabaseNodeMetaInputSchema = {
191
+ type: 'object',
192
+ properties: {
193
+ databaseId: { type: 'string', description: 'Optional database ID from ListDatabases. If omitted, the first database is used. Do not use workspaceId.' },
194
+ id: { type: 'string', description: 'Knowledge base node ID.' },
195
+ title: { type: 'string', description: 'New node title.' },
196
+ icon: { type: 'string', description: 'New node icon.' },
197
+ cover: { type: 'string', description: 'New node cover value.' },
198
+ parentId: { type: 'string', description: 'New parent node ID. Use null or omit to leave unchanged.' },
199
+ isTrash: { type: 'boolean', description: 'Trash state.' },
200
+ },
201
+ required: ['id'],
202
+ additionalProperties: false,
203
+ };
204
+ export function createDatabaseFunctionTools(workspaceId, allowedTools) {
205
+ const allowedToolNames = getAllowedDatabaseToolNames(allowedTools);
206
+ const tools = [
207
+ {
208
+ name: 'ListDatabases',
209
+ description: 'List all knowledge base databases in the current workspace. Use this first when you need a databaseId.',
210
+ inputSchema: listDatabasesInputSchema,
211
+ annotations: { readOnly: true, openWorld: false },
212
+ execute: async () => listDatabases(workspaceId),
213
+ },
214
+ {
215
+ name: 'ListDatabaseNodes',
216
+ description: 'List knowledge base files and directories under a title path. Input: optional databaseId, path, filter, includeTrash. If databaseId is omitted, the first database is used.',
217
+ inputSchema: databasePathFilterInputSchema,
218
+ annotations: { readOnly: true, openWorld: false },
219
+ execute: async (input) => listDatabaseNodes(workspaceId, input),
220
+ },
221
+ {
222
+ name: 'SearchDatabaseNodes',
223
+ description: 'Search knowledge base files by title or content under a title path. Input: optional databaseId, path, filter, includeTrash. If databaseId is omitted, the first database is used.',
224
+ inputSchema: databasePathFilterInputSchema,
225
+ annotations: { readOnly: true, openWorld: false },
226
+ execute: async (input) => searchDatabaseNodes(workspaceId, input),
227
+ },
228
+ {
229
+ name: 'QueryDatabaseVectors',
230
+ description: 'Semantic vector search for knowledge base files. The target database must be indexed and bound to an embedding agent. Input: optional databaseId, query, limit. If databaseId is omitted, the first database is used.',
231
+ inputSchema: queryDatabaseVectorsInputSchema,
232
+ annotations: { readOnly: true, openWorld: false },
233
+ execute: async (input) => queryDatabaseVectors(workspaceId, input),
234
+ },
235
+ {
236
+ name: 'ReadDatabaseNode',
237
+ description: 'Read knowledge base file or directory information by id, including metadata, path, children, and content.',
238
+ inputSchema: readDatabaseNodeInputSchema,
239
+ annotations: { readOnly: true, openWorld: false },
240
+ execute: async (input) => readDatabaseNode(workspaceId, input),
241
+ },
242
+ {
243
+ name: 'ListDatabaseNodeVersions',
244
+ description: 'List content version history for a knowledge base file by id, including oldContent and newContent for each diff.',
245
+ inputSchema: listDatabaseNodeVersionsInputSchema,
246
+ annotations: { readOnly: true, openWorld: false },
247
+ execute: async (input) => listDatabaseNodeVersions(workspaceId, input),
248
+ },
249
+ {
250
+ name: 'CreateDatabaseNode',
251
+ description: 'Create a knowledge base file or directory. Use this when the database is empty or the target document does not exist.',
252
+ inputSchema: createDatabaseNodeInputSchema,
253
+ annotations: { destructive: false, openWorld: false },
254
+ execute: async (input) => createDatabaseNode(workspaceId, input),
255
+ },
256
+ {
257
+ name: 'WriteDatabaseNode',
258
+ description: 'Write knowledge base file content by id. mode=insert appends, mode=replace replaces the replace text, mode=overwrite replaces all content.',
259
+ inputSchema: writeDatabaseNodeInputSchema,
260
+ annotations: { destructive: false, openWorld: false },
261
+ execute: async (input) => writeDatabaseNode(workspaceId, input),
262
+ },
263
+ {
264
+ name: 'DeleteDatabaseNode',
265
+ description: 'Delete a knowledge base file or directory by id. Defaults to moving the node and descendants to trash; permanent=true deletes them.',
266
+ inputSchema: deleteDatabaseNodeInputSchema,
267
+ annotations: { destructive: true, openWorld: false },
268
+ execute: async (input) => deleteDatabaseNode(workspaceId, input),
269
+ },
270
+ {
271
+ name: 'MoveDatabaseNode',
272
+ description: 'Move a knowledge base file or directory by id to a target parentId or path. Omit both to move to root.',
273
+ inputSchema: moveDatabaseNodeInputSchema,
274
+ annotations: { destructive: false, openWorld: false },
275
+ execute: async (input) => moveDatabaseNode(workspaceId, input),
276
+ },
277
+ {
278
+ name: 'UpdateDatabaseNodeMeta',
279
+ description: 'Update knowledge base file metadata by id: title, icon, cover, parentId, isTrash.',
280
+ inputSchema: updateDatabaseNodeMetaInputSchema,
281
+ annotations: { destructive: false, openWorld: false },
282
+ execute: async (input) => updateDatabaseNodeMeta(workspaceId, input),
283
+ },
284
+ ];
285
+ return tools.filter((tool) => allowedToolNames.has(tool.name));
286
+ }
287
+ function getAllowedDatabaseToolNames(allowedTools) {
288
+ const names = new Set(allowedTools ?? BUILT_IN_AGENT_TOOLS.map((tool) => tool.name));
289
+ const hasDatabaseTools = Array.from(names).some((name) => isDatabaseToolName(name));
290
+ if (hasDatabaseTools) {
291
+ names.add('ListDatabases');
292
+ names.add('CreateDatabaseNode');
293
+ names.add('QueryDatabaseVectors');
294
+ names.add('ListDatabaseNodeVersions');
295
+ }
296
+ return names;
297
+ }
298
+ function listDatabases(workspaceId) {
299
+ const databases = databaseStore.listDatabases(workspaceId);
300
+ const items = databases.length > 0 ? databases : [databaseStore.getDefaultDatabase(workspaceId)];
301
+ return items.map((database, index) => ({
302
+ ...database,
303
+ isDefault: index === 0,
304
+ nodeCount: databaseStore.listNodes(workspaceId, database.id).filter((node) => !node.isTrash).length,
305
+ }));
306
+ }
307
+ function listDatabaseNodes(workspaceId, input) {
308
+ const data = assertRecord(input);
309
+ const databaseId = resolveToolDatabaseId(workspaceId, data);
310
+ const nodes = databaseStore.listNodes(workspaceId, databaseId);
311
+ const root = resolveDatabasePath(nodes, readOptionalString(data.path) ?? '/');
312
+ const parentId = root?.id ?? null;
313
+ const filter = normalizeSearchText(readOptionalString(data.filter));
314
+ const includeTrash = data.includeTrash === true;
315
+ return nodes
316
+ .filter((node) => node.parentId === parentId)
317
+ .filter((node) => includeTrash || !node.isTrash)
318
+ .filter((node) => !filter || normalizeSearchText(node.title).includes(filter))
319
+ .map((node) => summarizeDatabaseNode(node, nodes));
320
+ }
321
+ function searchDatabaseNodes(workspaceId, input) {
322
+ const data = assertRecord(input);
323
+ const databaseId = resolveToolDatabaseId(workspaceId, data);
324
+ const nodes = databaseStore.listNodes(workspaceId, databaseId);
325
+ const root = resolveDatabasePath(nodes, readOptionalString(data.path) ?? '/');
326
+ const filter = normalizeSearchText(readOptionalString(data.filter));
327
+ const includeTrash = data.includeTrash === true;
328
+ const scopedIds = new Set(root ? collectDatabaseDescendantIds(nodes, root.id, true) : nodes.map((node) => node.id));
329
+ return nodes
330
+ .filter((node) => scopedIds.has(node.id))
331
+ .filter((node) => includeTrash || !node.isTrash)
332
+ .filter((node) => !filter || normalizeSearchText(`${node.title}\n${node.content}`).includes(filter))
333
+ .map((node) => summarizeDatabaseNode(node, nodes));
334
+ }
335
+ async function queryDatabaseVectors(workspaceId, input) {
336
+ const data = assertRecord(input);
337
+ const databaseId = resolveToolDatabaseId(workspaceId, data);
338
+ const query = readRequiredString(data.query, 'query');
339
+ const limit = typeof data.limit === 'number' ? data.limit : 5;
340
+ return databaseVector.searchDatabaseVectors(workspaceId, databaseId, query, limit);
341
+ }
342
+ function readDatabaseNode(workspaceId, input) {
343
+ const data = assertRecord(input);
344
+ const id = readRequiredString(data.id, 'id');
345
+ const databaseId = resolveToolDatabaseId(workspaceId, data);
346
+ const node = requireDatabaseNode(workspaceId, id, databaseId);
347
+ const nodes = databaseStore.listNodes(workspaceId, databaseId);
348
+ return {
349
+ ...node,
350
+ path: buildDatabaseNodePath(node, nodes),
351
+ children: nodes
352
+ .filter((child) => child.parentId === node.id)
353
+ .map((child) => summarizeDatabaseNode(child, nodes)),
354
+ };
355
+ }
356
+ function listDatabaseNodeVersions(workspaceId, input) {
357
+ const data = assertRecord(input);
358
+ const id = readRequiredString(data.id, 'id');
359
+ const databaseId = resolveToolDatabaseId(workspaceId, data);
360
+ requireDatabaseNode(workspaceId, id, databaseId);
361
+ const limit = typeof data.limit === 'number' ? data.limit : 20;
362
+ return databaseStore.listNodeVersions(workspaceId, id, databaseId, limit);
363
+ }
364
+ function createDatabaseNode(workspaceId, input) {
365
+ const data = assertRecord(input);
366
+ const title = readRequiredString(data.title, 'title');
367
+ const databaseId = resolveToolDatabaseId(workspaceId, data);
368
+ const nodes = databaseStore.listNodes(workspaceId, databaseId);
369
+ const parentId = resolveMoveParentId(nodes, data);
370
+ if (parentId) {
371
+ const parent = nodes.find((node) => node.id === parentId);
372
+ if (!parent)
373
+ throw new Error(`Target parent not found: ${parentId}`);
374
+ }
375
+ const node = databaseStore.createNode(workspaceId, {
376
+ databaseId,
377
+ title,
378
+ content: readStringOrDefault(data.content, ''),
379
+ parentId,
380
+ icon: readOptionalString(data.icon) ?? '\u{1F4DD}',
381
+ cover: readStringOrDefault(data.cover, ''),
382
+ });
383
+ const nextNodes = [...nodes, node];
384
+ return {
385
+ ...node,
386
+ path: buildDatabaseNodePath(node, nextNodes),
387
+ };
388
+ }
389
+ function writeDatabaseNode(workspaceId, input) {
390
+ const data = assertRecord(input);
391
+ const id = readRequiredString(data.id, 'id');
392
+ const databaseId = resolveToolDatabaseId(workspaceId, data);
393
+ const content = readString(data.content, 'content');
394
+ const mode = readOptionalString(data.mode) ?? 'insert';
395
+ const existing = requireDatabaseNode(workspaceId, id, databaseId);
396
+ let nextContent;
397
+ if (mode === 'insert') {
398
+ nextContent = existing.content ? `${existing.content}${content}` : content;
399
+ }
400
+ else if (mode === 'overwrite') {
401
+ nextContent = content;
402
+ }
403
+ else if (mode === 'replace') {
404
+ const replace = readRequiredString(data.replace, 'replace');
405
+ if (!existing.content.includes(replace))
406
+ throw new Error('replace text was not found in the existing content.');
407
+ nextContent = existing.content.replace(replace, content);
408
+ }
409
+ else {
410
+ throw new Error('mode must be one of: insert, replace, overwrite.');
411
+ }
412
+ const updated = databaseStore.updateNode(workspaceId, id, { content: nextContent }, databaseId);
413
+ if (!updated)
414
+ throw new Error(`Database node not found: ${id}`);
415
+ return updated;
416
+ }
417
+ function deleteDatabaseNode(workspaceId, input) {
418
+ const data = assertRecord(input);
419
+ const id = readRequiredString(data.id, 'id');
420
+ const databaseId = resolveToolDatabaseId(workspaceId, data);
421
+ requireDatabaseNode(workspaceId, id, databaseId);
422
+ const nodes = databaseStore.listNodes(workspaceId, databaseId);
423
+ const ids = collectDatabaseDescendantIds(nodes, id, true).reverse();
424
+ const permanent = data.permanent === true;
425
+ for (const nodeId of ids) {
426
+ const ok = permanent
427
+ ? databaseStore.deleteNode(workspaceId, nodeId, databaseId)
428
+ : Boolean(databaseStore.trashNode(workspaceId, nodeId, databaseId));
429
+ if (!ok)
430
+ throw new Error(`Failed to delete database node: ${nodeId}`);
431
+ }
432
+ return { ok: true, deletedIds: ids.reverse(), permanent };
433
+ }
434
+ function moveDatabaseNode(workspaceId, input) {
435
+ const data = assertRecord(input);
436
+ const id = readRequiredString(data.id, 'id');
437
+ const databaseId = resolveToolDatabaseId(workspaceId, data);
438
+ requireDatabaseNode(workspaceId, id, databaseId);
439
+ const nodes = databaseStore.listNodes(workspaceId, databaseId);
440
+ const parentId = resolveMoveParentId(nodes, data);
441
+ assertValidDatabaseParent(nodes, id, parentId);
442
+ const updated = databaseStore.moveNode(workspaceId, id, parentId, databaseId);
443
+ if (!updated)
444
+ throw new Error(`Database node not found: ${id}`);
445
+ return updated;
446
+ }
447
+ function updateDatabaseNodeMeta(workspaceId, input) {
448
+ const data = assertRecord(input);
449
+ const id = readRequiredString(data.id, 'id');
450
+ const databaseId = resolveToolDatabaseId(workspaceId, data);
451
+ requireDatabaseNode(workspaceId, id, databaseId);
452
+ const updates = {};
453
+ if (typeof data.title === 'string')
454
+ updates.title = data.title;
455
+ if (typeof data.icon === 'string')
456
+ updates.icon = data.icon;
457
+ if (typeof data.cover === 'string')
458
+ updates.cover = data.cover;
459
+ if (typeof data.isTrash === 'boolean')
460
+ updates.isTrash = data.isTrash;
461
+ if (Object.hasOwn(data, 'parentId')) {
462
+ const parentId = data.parentId === null ? null : readRequiredString(data.parentId, 'parentId');
463
+ const nodes = databaseStore.listNodes(workspaceId, databaseId);
464
+ assertValidDatabaseParent(nodes, id, parentId);
465
+ updates.parentId = parentId;
466
+ }
467
+ if (Object.keys(updates).length === 0)
468
+ throw new Error('At least one metadata field is required.');
469
+ const updated = databaseStore.updateNode(workspaceId, id, updates, databaseId);
470
+ if (!updated)
471
+ throw new Error(`Database node not found: ${id}`);
472
+ return updated;
473
+ }
474
+ function summarizeDatabaseNode(node, nodes) {
475
+ return {
476
+ id: node.id,
477
+ title: node.title,
478
+ icon: node.icon,
479
+ path: buildDatabaseNodePath(node, nodes),
480
+ parentId: node.parentId,
481
+ isTrash: node.isTrash,
482
+ createdAt: node.createdAt,
483
+ updatedAt: node.updatedAt,
484
+ childCount: nodes.filter((child) => child.parentId === node.id).length,
485
+ contentLength: node.content.length,
486
+ };
487
+ }
488
+ function resolveDatabasePath(nodes, path) {
489
+ const parts = path.split('/').map((part) => part.trim()).filter(Boolean);
490
+ if (parts.length === 0)
491
+ return null;
492
+ let parentId = null;
493
+ let current;
494
+ for (const part of parts) {
495
+ current = nodes.find((node) => node.parentId === parentId && node.title === part && !node.isTrash);
496
+ if (!current)
497
+ throw new Error(`Database path not found: ${path}`);
498
+ parentId = current.id;
499
+ }
500
+ return current ?? null;
501
+ }
502
+ function buildDatabaseNodePath(node, nodes) {
503
+ const byId = new Map(nodes.map((item) => [item.id, item]));
504
+ const parts = [node.title || node.id];
505
+ let parentId = node.parentId;
506
+ let guard = 0;
507
+ while (parentId && guard < 100) {
508
+ const parent = byId.get(parentId);
509
+ if (!parent)
510
+ break;
511
+ parts.unshift(parent.title || parent.id);
512
+ parentId = parent.parentId;
513
+ guard++;
514
+ }
515
+ return `/${parts.join('/')}`;
516
+ }
517
+ function collectDatabaseDescendantIds(nodes, id, includeSelf) {
518
+ const ids = includeSelf ? [id] : [];
519
+ for (const child of nodes.filter((node) => node.parentId === id)) {
520
+ ids.push(...collectDatabaseDescendantIds(nodes, child.id, true));
521
+ }
522
+ return ids;
523
+ }
524
+ function resolveMoveParentId(nodes, data) {
525
+ if (Object.hasOwn(data, 'parentId')) {
526
+ if (data.parentId === null || data.parentId === undefined)
527
+ return null;
528
+ return readRequiredString(data.parentId, 'parentId');
529
+ }
530
+ const path = readOptionalString(data.path);
531
+ if (!path)
532
+ return null;
533
+ return resolveDatabasePath(nodes, path)?.id ?? null;
534
+ }
535
+ function assertValidDatabaseParent(nodes, nodeId, parentId) {
536
+ if (!parentId)
537
+ return;
538
+ const parent = nodes.find((node) => node.id === parentId);
539
+ if (!parent)
540
+ throw new Error(`Target parent not found: ${parentId}`);
541
+ if (parentId === nodeId)
542
+ throw new Error('A node cannot be moved under itself.');
543
+ const descendantIds = new Set(collectDatabaseDescendantIds(nodes, nodeId, false));
544
+ if (descendantIds.has(parentId))
545
+ throw new Error('A node cannot be moved under its own descendant.');
546
+ }
547
+ function resolveToolDatabaseId(workspaceId, data) {
548
+ const databaseId = readOptionalString(data.databaseId);
549
+ if (databaseId === workspaceId)
550
+ return databaseStore.getDefaultDatabase(workspaceId).id;
551
+ if (!databaseId)
552
+ return databaseStore.getDefaultDatabase(workspaceId).id;
553
+ if (!databaseStore.getDatabase(workspaceId, databaseId)) {
554
+ const available = listDatabases(workspaceId).map((database) => `${database.name}=${database.id}`).join(', ');
555
+ throw new Error(`Database not found: ${databaseId}. Use ListDatabases to choose a valid databaseId. Available databases: ${available || 'none'}`);
556
+ }
557
+ return databaseId;
558
+ }
559
+ function requireDatabaseNode(workspaceId, id, databaseId) {
560
+ const node = databaseStore.getNode(workspaceId, id, databaseId);
561
+ if (!node)
562
+ throw new Error(`Database node not found: ${id}`);
563
+ return node;
564
+ }
565
+ function isDatabaseToolName(name) {
566
+ return name === 'ListDatabases'
567
+ || name === 'ListDatabaseNodes'
568
+ || name === 'SearchDatabaseNodes'
569
+ || name === 'QueryDatabaseVectors'
570
+ || name === 'ReadDatabaseNode'
571
+ || name === 'ListDatabaseNodeVersions'
572
+ || name === 'CreateDatabaseNode'
573
+ || name === 'WriteDatabaseNode'
574
+ || name === 'DeleteDatabaseNode'
575
+ || name === 'MoveDatabaseNode'
576
+ || name === 'UpdateDatabaseNodeMeta';
577
+ }
578
+ //# sourceMappingURL=database-tools.js.map
@@ -0,0 +1,5 @@
1
+ export { createIssueFunctionTools, isBuiltInIssueToolName } from './issue-tools.js';
2
+ export { createCommandFunctionTools } from './command-tools.js';
3
+ export { createDatabaseFunctionTools } from './database-tools.js';
4
+ export { createKanbanFunctionTools } from './kanban-tools.js';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,26 @@
1
+ export function assertRecord(input) {
2
+ if (!input || typeof input !== 'object' || Array.isArray(input)) {
3
+ throw new Error('Tool input must be an object.');
4
+ }
5
+ return input;
6
+ }
7
+ export function readRequiredString(value, field) {
8
+ if (typeof value !== 'string' || !value.trim())
9
+ throw new Error(`${field} is required.`);
10
+ return value.trim();
11
+ }
12
+ export function readString(value, field) {
13
+ if (typeof value !== 'string')
14
+ throw new Error(`${field} must be a string.`);
15
+ return value;
16
+ }
17
+ export function readOptionalString(value) {
18
+ return typeof value === 'string' && value.trim() ? value.trim() : undefined;
19
+ }
20
+ export function readStringOrDefault(value, fallback) {
21
+ return typeof value === 'string' ? value : fallback;
22
+ }
23
+ export function normalizeSearchText(value) {
24
+ return (value ?? '').trim().toLowerCase();
25
+ }
26
+ //# sourceMappingURL=input-helpers.js.map