@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,345 @@
1
+ import { Router } from 'express';
2
+ import { existsSync, readFileSync, writeFileSync } from 'node:fs';
3
+ import { join } from 'node:path';
4
+ import * as store from '../storage/database-store.js';
5
+ import * as databaseVector from '../services/database-vector.js';
6
+ import * as agentService from '../services/agent.js';
7
+ import * as workspaceService from '../services/workspace.js';
8
+ import { createDatabaseFunctionTools } from '../services/builtin-tools/index.js';
9
+ import { createAgentRuntime } from '../adapters/agent-runtime.js';
10
+ import { getThinkingRuntimeConfig } from '../services/llm-model-config.js';
11
+ import { getDataDir, ensureDir } from '../storage/json-store.js';
12
+ import { generateAgentDesign } from '../agents/agent-designer.js';
13
+ const router = Router({ mergeParams: true });
14
+ const pendingContentSaves = new Map();
15
+ const CONTENT_SAVE_IDLE_MS = 30_000;
16
+ const DATABASE_AGENT_ID = 'database-agent';
17
+ const DATABASE_AGENT_TOOLS = [
18
+ 'ListDatabases',
19
+ 'ListDatabaseNodes',
20
+ 'SearchDatabaseNodes',
21
+ 'QueryDatabaseVectors',
22
+ 'ReadDatabaseNode',
23
+ 'ListDatabaseNodeVersions',
24
+ 'CreateDatabaseNode',
25
+ 'WriteDatabaseNode',
26
+ 'DeleteDatabaseNode',
27
+ 'MoveDatabaseNode',
28
+ 'UpdateDatabaseNodeMeta',
29
+ ];
30
+ const wid = (req) => req.params.id;
31
+ const databaseId = (req) => req.query.databaseId || store.getDefaultDatabase(wid(req)).id;
32
+ router.get('/agent-presets', (req, res) => {
33
+ res.json([readDatabaseAgent(wid(req))]);
34
+ });
35
+ router.get('/agent-presets/:presetId', (req, res) => {
36
+ if (req.params.presetId !== DATABASE_AGENT_ID)
37
+ return res.status(404).json({ error: 'database agent not found' });
38
+ res.json(readDatabaseAgent(wid(req)));
39
+ });
40
+ router.put('/agent-presets/:presetId', (req, res) => {
41
+ if (req.params.presetId !== DATABASE_AGENT_ID)
42
+ return res.status(404).json({ error: 'database agent not found' });
43
+ res.json(writeDatabaseAgent(wid(req), req.body));
44
+ });
45
+ router.post('/agent-presets/test-connection', async (req, res) => {
46
+ const result = await agentService.testConnection(wid(req), req.body);
47
+ if (!result)
48
+ return res.status(404).json({ error: 'workspace not found' });
49
+ res.status(result.success ? 200 : 400).json(result);
50
+ });
51
+ router.post('/agent-presets/generate', async (req, res) => {
52
+ const { prompt } = req.body;
53
+ if (!prompt?.trim())
54
+ return res.status(400).json({ error: 'prompt is required' });
55
+ try {
56
+ res.json(await generateAgentDesign(prompt));
57
+ }
58
+ catch (err) {
59
+ res.status(400).json({ error: err instanceof Error ? err.message : 'agent generation failed' });
60
+ }
61
+ });
62
+ router.post('/chat', async (req, res) => {
63
+ const workspaceId = wid(req);
64
+ const { message, history } = req.body;
65
+ const prompt = message?.trim();
66
+ if (!prompt)
67
+ return res.status(400).json({ error: 'message is required' });
68
+ const workspace = workspaceService.getById(workspaceId);
69
+ if (!workspace)
70
+ return res.status(404).json({ error: 'workspace not found' });
71
+ const agent = readDatabaseAgent(workspaceId);
72
+ if (agent.enabled === false)
73
+ return res.status(400).json({ error: 'database agent is disabled' });
74
+ const workingDir = workspace.boundDirs[0] || process.cwd();
75
+ const functionTools = createDatabaseFunctionTools(workspaceId, agent.tools);
76
+ const runtime = createAgentRuntime({
77
+ kind: agent.runtimeKind,
78
+ provider: agent.modelProvider,
79
+ model: agent.modelId,
80
+ apiKey: agent.apiKey,
81
+ baseURL: getRuntimeBaseURL(agent.modelProvider, agent.apiBase),
82
+ adapterBaseURL: agent.apiBase,
83
+ ...getThinkingRuntimeConfig(agent),
84
+ });
85
+ const result = await runtime.execute(buildDatabaseAgentPrompt(workspaceId, agent, prompt, history ?? []), workingDir, {
86
+ maxTurns: 60,
87
+ functionTools,
88
+ mcpServers: {},
89
+ skills: [],
90
+ sandboxDirs: [],
91
+ outputStyle: agent.outputStyle,
92
+ });
93
+ const finalMessage = result.success
94
+ ? extractFinalMessage(result.output, result.summary)
95
+ : result.error || extractFinalMessage(result.output, result.summary);
96
+ res.status(result.success ? 200 : 400).json({ finalMessage });
97
+ });
98
+ router.get('/databases', (req, res) => {
99
+ const databases = store.listDatabases(wid(req));
100
+ res.json(databases.length > 0 ? databases : [store.getDefaultDatabase(wid(req))]);
101
+ });
102
+ router.post('/databases', (req, res) => {
103
+ const database = store.createDatabase(wid(req), req.body);
104
+ res.status(201).json(database);
105
+ });
106
+ router.put('/databases/:databaseId', (req, res) => {
107
+ const database = store.updateDatabase(wid(req), req.params.databaseId, req.body);
108
+ if (!database)
109
+ return res.status(404).json({ error: 'Database not found' });
110
+ res.json(database);
111
+ });
112
+ router.get('/databases/:databaseId/vector', (req, res) => {
113
+ if (!store.getDatabase(wid(req), req.params.databaseId)) {
114
+ return res.status(404).json({ error: 'Database not found' });
115
+ }
116
+ res.json(store.getVectorStats(wid(req), req.params.databaseId));
117
+ });
118
+ router.put('/databases/:databaseId/vector', (req, res) => {
119
+ const { embeddingModelId } = req.body;
120
+ const database = store.setDatabaseEmbeddingModel(wid(req), req.params.databaseId, embeddingModelId || null);
121
+ if (!database)
122
+ return res.status(404).json({ error: 'Database not found' });
123
+ res.json(store.getVectorStats(wid(req), req.params.databaseId));
124
+ });
125
+ router.post('/databases/:databaseId/vector/index', async (req, res) => {
126
+ try {
127
+ res.json(await databaseVector.indexDatabaseVectors(wid(req), req.params.databaseId));
128
+ }
129
+ catch (error) {
130
+ console.error('[database:vector:index] failed', {
131
+ workspaceId: wid(req),
132
+ databaseId: req.params.databaseId,
133
+ error: error instanceof Error ? error.message : String(error),
134
+ debug: error instanceof databaseVector.DatabaseVectorError ? error.debug : undefined,
135
+ });
136
+ res.status(400).json({
137
+ error: error instanceof Error ? error.message : String(error),
138
+ debug: error instanceof databaseVector.DatabaseVectorError ? error.debug : undefined,
139
+ });
140
+ }
141
+ });
142
+ router.delete('/databases/:databaseId', (req, res) => {
143
+ if (!store.deleteDatabase(wid(req), req.params.databaseId)) {
144
+ return res.status(404).json({ error: 'Database not found' });
145
+ }
146
+ res.json({ ok: true });
147
+ });
148
+ // List all nodes
149
+ router.get('/', (req, res) => {
150
+ res.json(store.listNodes(wid(req), databaseId(req)));
151
+ });
152
+ // Get single node
153
+ router.get('/:nodeId', (req, res) => {
154
+ const node = store.getNode(wid(req), req.params.nodeId, databaseId(req));
155
+ if (!node)
156
+ return res.status(404).json({ error: 'Node not found' });
157
+ res.json(node);
158
+ });
159
+ router.get('/:nodeId/versions', (req, res) => {
160
+ flushPendingContentSave(wid(req), databaseId(req), req.params.nodeId);
161
+ const limit = typeof req.query.limit === 'string' ? Number(req.query.limit) : 50;
162
+ const versions = store.listNodeVersions(wid(req), req.params.nodeId, databaseId(req), limit);
163
+ res.json(versions);
164
+ });
165
+ // Create node
166
+ router.post('/', (req, res) => {
167
+ const node = store.createNode(wid(req), { ...req.body, databaseId: databaseId(req) });
168
+ res.status(201).json(node);
169
+ });
170
+ // Update node
171
+ router.put('/:nodeId', (req, res) => {
172
+ const workspaceId = wid(req);
173
+ const activeDatabaseId = databaseId(req);
174
+ const nodeId = req.params.nodeId;
175
+ const body = req.body;
176
+ const { content, ...metadataUpdates } = body;
177
+ let node = Object.keys(metadataUpdates).length > 0
178
+ ? store.updateNode(workspaceId, nodeId, metadataUpdates, activeDatabaseId)
179
+ : store.getNode(workspaceId, nodeId, activeDatabaseId);
180
+ if (!node)
181
+ return res.status(404).json({ error: 'Node not found' });
182
+ if (typeof content === 'string') {
183
+ scheduleContentSave(workspaceId, activeDatabaseId, nodeId, content);
184
+ node = { ...node, content, updatedAt: Date.now() };
185
+ }
186
+ res.json(node);
187
+ });
188
+ // Move node (change parent)
189
+ router.put('/:nodeId/move', (req, res) => {
190
+ const { parentId } = req.body;
191
+ const node = store.moveNode(wid(req), req.params.nodeId, parentId ?? null, databaseId(req));
192
+ if (!node)
193
+ return res.status(404).json({ error: 'Node not found' });
194
+ res.json(node);
195
+ });
196
+ // Trash node (soft delete)
197
+ router.put('/:nodeId/trash', (req, res) => {
198
+ const node = store.trashNode(wid(req), req.params.nodeId, databaseId(req));
199
+ if (!node)
200
+ return res.status(404).json({ error: 'Node not found' });
201
+ res.json(node);
202
+ });
203
+ // Restore node from trash
204
+ router.put('/:nodeId/restore', (req, res) => {
205
+ const node = store.restoreNode(wid(req), req.params.nodeId, databaseId(req));
206
+ if (!node)
207
+ return res.status(404).json({ error: 'Node not found' });
208
+ res.json(node);
209
+ });
210
+ // Delete node permanently
211
+ router.delete('/:nodeId', (req, res) => {
212
+ if (!store.deleteNode(wid(req), req.params.nodeId, databaseId(req))) {
213
+ return res.status(404).json({ error: 'Node not found' });
214
+ }
215
+ res.json({ ok: true });
216
+ });
217
+ function scheduleContentSave(workspaceId, activeDatabaseId, nodeId, content) {
218
+ const key = `${workspaceId}:${activeDatabaseId}:${nodeId}`;
219
+ const existing = pendingContentSaves.get(key);
220
+ if (existing)
221
+ clearTimeout(existing.timer);
222
+ const timer = setTimeout(() => {
223
+ flushPendingContentSave(workspaceId, activeDatabaseId, nodeId);
224
+ }, CONTENT_SAVE_IDLE_MS);
225
+ pendingContentSaves.set(key, { timer, content });
226
+ }
227
+ function flushPendingContentSave(workspaceId, activeDatabaseId, nodeId) {
228
+ const key = `${workspaceId}:${activeDatabaseId}:${nodeId}`;
229
+ const pending = pendingContentSaves.get(key);
230
+ if (!pending)
231
+ return;
232
+ clearTimeout(pending.timer);
233
+ pendingContentSaves.delete(key);
234
+ store.updateNode(workspaceId, nodeId, { content: pending.content }, activeDatabaseId);
235
+ }
236
+ function databaseAgentPath(workspaceId) {
237
+ return join(getDataDir(), 'workspaces', workspaceId, 'database', 'agent.json');
238
+ }
239
+ function readDatabaseAgent(workspaceId) {
240
+ const filePath = databaseAgentPath(workspaceId);
241
+ if (!existsSync(filePath))
242
+ return defaultDatabaseAgent();
243
+ try {
244
+ return normalizeDatabaseAgent(JSON.parse(readFileSync(filePath, 'utf-8')));
245
+ }
246
+ catch {
247
+ return defaultDatabaseAgent();
248
+ }
249
+ }
250
+ function writeDatabaseAgent(workspaceId, input) {
251
+ const agent = normalizeDatabaseAgent(input);
252
+ ensureDir(join(getDataDir(), 'workspaces', workspaceId, 'database'));
253
+ writeFileSync(databaseAgentPath(workspaceId), JSON.stringify(agent, null, 2), 'utf-8');
254
+ return agent;
255
+ }
256
+ function defaultDatabaseAgent() {
257
+ return normalizeDatabaseAgent({
258
+ name: 'Database AI',
259
+ role: 'agent',
260
+ description: 'Knowledge base assistant for Agent Spaces database documents.',
261
+ runtimeKind: 'claude-code',
262
+ modelProvider: undefined,
263
+ modelId: '',
264
+ apiBase: '',
265
+ apiKey: '',
266
+ systemPrompt: [
267
+ 'You are the database knowledge base assistant.',
268
+ 'Answer from Agent Spaces database content when possible.',
269
+ 'Use only the provided database tools for knowledge base operations.',
270
+ 'Return only the final answer in concise Markdown.',
271
+ ].join('\n'),
272
+ temperature: 0.2,
273
+ maxTokens: 4096,
274
+ enabled: true,
275
+ });
276
+ }
277
+ function normalizeDatabaseAgent(input) {
278
+ return {
279
+ id: DATABASE_AGENT_ID,
280
+ name: input.name?.trim() || 'Database AI',
281
+ role: 'agent',
282
+ description: input.description || '',
283
+ runtimeKind: input.runtimeKind || 'claude-code',
284
+ modelProvider: input.modelProvider,
285
+ modelId: input.modelId || '',
286
+ apiBase: input.apiBase || '',
287
+ apiKey: input.apiKey || '',
288
+ workingDir: '',
289
+ mcps: {},
290
+ skills: [],
291
+ tools: DATABASE_AGENT_TOOLS,
292
+ systemPrompt: input.systemPrompt || defaultDatabaseAgent().systemPrompt,
293
+ outputStyle: input.outputStyle,
294
+ temperature: input.temperature ?? 0.2,
295
+ maxTokens: input.maxTokens ?? 4096,
296
+ sandboxDirs: [],
297
+ maxRetries: input.maxRetries,
298
+ enabled: input.enabled ?? true,
299
+ };
300
+ }
301
+ function buildDatabaseAgentPrompt(workspaceId, agent, userMessage, history) {
302
+ const recentHistory = history
303
+ .slice(-12)
304
+ .map((item) => `${item.role === 'user' ? 'User' : 'Agent'}: ${item.content}`)
305
+ .join('\n\n');
306
+ return [
307
+ agent.systemPrompt?.trim(),
308
+ 'Runtime constraints:',
309
+ `- Current workspace id: ${workspaceId}`,
310
+ '- MCP servers configured for this agent: none.',
311
+ `- Available database tools: ${DATABASE_AGENT_TOOLS.map((tool) => `mcp__agent-spaces__${tool}`).join(', ')}.`,
312
+ '- Use mcp__agent-spaces__ListDatabases when you need to know valid database IDs.',
313
+ '- If the user does not specify a database, omit databaseId and the first database will be used automatically.',
314
+ '- Never use the workspace id as databaseId.',
315
+ '- Do not use filesystem, command, issue, channel, web, or other non-database tools for knowledge base work.',
316
+ '- If you need database content, call the database tools before answering.',
317
+ '- Return only the final answer in Markdown. Do not include tool logs or implementation traces.',
318
+ recentHistory ? `Conversation history:\n${recentHistory}` : '',
319
+ `User message:\n${userMessage}`,
320
+ ].filter(Boolean).join('\n\n');
321
+ }
322
+ function extractFinalMessage(output, fallback) {
323
+ const candidates = output
324
+ .map((line) => line.trim())
325
+ .filter((line) => {
326
+ if (!line)
327
+ return false;
328
+ if (/^\[Usage\]/i.test(line))
329
+ return false;
330
+ if (/^(Tool:|Todo:|Codex initialized\b|Claude Code initialized\b)/i.test(line))
331
+ return false;
332
+ if (/^\[Reasoning\]/i.test(line))
333
+ return false;
334
+ return true;
335
+ });
336
+ return candidates.at(-1) || fallback || '';
337
+ }
338
+ function getRuntimeBaseURL(provider, apiBase) {
339
+ if (provider === 'openai-responses-to-anthropic-messages'
340
+ || provider === 'openai-chat-completions-to-anthropic-messages')
341
+ return undefined;
342
+ return apiBase;
343
+ }
344
+ export default router;
345
+ //# sourceMappingURL=database.js.map
@@ -1,5 +1,5 @@
1
1
  import { Router } from 'express';
2
- import { gitStatus, gitDiff, gitLog, gitCommit, gitDiscard, gitDiscardAll, gitBranches, gitCheckout, gitInit, gitGenerateCommitMsg, gitPush, gitPull, gitGetRemotes, gitAddRemote, gitCheckoutDetached, gitCherryPick, gitCreateBranch, gitDeleteBranch, gitCreateTag, gitCommitDiff, gitGetRemoteUrl, gitMergeBase, gitGetConfig, gitSetConfig } from '../adapters/git.js';
2
+ import { gitStatus, gitDiff, gitLog, gitCommit, gitDiscard, gitDiscardAll, gitBranches, gitCheckout, gitInit, gitGenerateCommitMsg, gitPush, gitPull, gitFetch, gitGetRemotes, gitAddRemote, gitCheckoutDetached, gitCherryPick, gitCreateBranch, gitDeleteBranch, gitCreateTag, gitCommitDiff, gitGetRemoteUrl, gitMergeBase, gitGetConfig, gitSetConfig, gitStage, gitUnstage, gitResolveFile } from '../adapters/git.js';
3
3
  const router = Router({ mergeParams: true });
4
4
  router.get('/status', async (req, res) => {
5
5
  try {
@@ -67,6 +67,48 @@ router.post('/discard-all', async (req, res) => {
67
67
  res.status(500).json({ error: err.message });
68
68
  }
69
69
  });
70
+ router.post('/stage', async (req, res) => {
71
+ try {
72
+ const { path } = req.body;
73
+ if (!path) {
74
+ res.status(400).json({ error: 'path is required' });
75
+ return;
76
+ }
77
+ await gitStage(req.params.id, path);
78
+ res.json({ ok: true });
79
+ }
80
+ catch (err) {
81
+ res.status(500).json({ error: err.message });
82
+ }
83
+ });
84
+ router.post('/unstage', async (req, res) => {
85
+ try {
86
+ const { path } = req.body;
87
+ if (!path) {
88
+ res.status(400).json({ error: 'path is required' });
89
+ return;
90
+ }
91
+ await gitUnstage(req.params.id, path);
92
+ res.json({ ok: true });
93
+ }
94
+ catch (err) {
95
+ res.status(500).json({ error: err.message });
96
+ }
97
+ });
98
+ router.post('/resolve-file', async (req, res) => {
99
+ try {
100
+ const { path, content, stage } = req.body;
101
+ if (!path || typeof content !== 'string') {
102
+ res.status(400).json({ error: 'path and content are required' });
103
+ return;
104
+ }
105
+ await gitResolveFile(req.params.id, path, content, stage !== false);
106
+ res.json({ ok: true });
107
+ }
108
+ catch (err) {
109
+ res.status(500).json({ error: err.message });
110
+ }
111
+ });
70
112
  router.get('/branches', async (req, res) => {
71
113
  try {
72
114
  const result = await gitBranches(req.params.id);
@@ -108,6 +150,15 @@ router.post('/generate-commit-message', async (req, res) => {
108
150
  res.status(500).json({ error: err.message });
109
151
  }
110
152
  });
153
+ router.post('/fetch', async (req, res) => {
154
+ try {
155
+ await gitFetch(req.params.id);
156
+ res.json({ ok: true });
157
+ }
158
+ catch (err) {
159
+ res.status(500).json({ error: err.message });
160
+ }
161
+ });
111
162
  router.post('/push', async (req, res) => {
112
163
  try {
113
164
  await gitPush(req.params.id);
@@ -0,0 +1,88 @@
1
+ import { Router } from 'express';
2
+ import * as store from '../storage/hook-store.js';
3
+ const router = Router({ mergeParams: true });
4
+ router.get('/', (req, res) => {
5
+ try {
6
+ res.json(store.listHooks(req.params.id));
7
+ }
8
+ catch (error) {
9
+ res.status(500).json({ error: error.message });
10
+ }
11
+ });
12
+ router.get('/:name', (req, res) => {
13
+ try {
14
+ const hook = store.getHook(req.params.id, req.params.name);
15
+ if (!hook) {
16
+ res.status(404).json({ error: 'Hook not found' });
17
+ return;
18
+ }
19
+ res.json(hook);
20
+ }
21
+ catch (error) {
22
+ res.status(500).json({ error: error.message });
23
+ }
24
+ });
25
+ router.post('/', (req, res) => {
26
+ try {
27
+ const config = req.body;
28
+ if (!config.name) {
29
+ res.status(400).json({ error: 'name required' });
30
+ return;
31
+ }
32
+ store.saveHook(req.params.id, config);
33
+ res.status(201).json(config);
34
+ }
35
+ catch (error) {
36
+ res.status(400).json({ error: error.message });
37
+ }
38
+ });
39
+ router.put('/:name', (req, res) => {
40
+ try {
41
+ const config = req.body;
42
+ config.name = req.params.name;
43
+ store.saveHook(req.params.id, config);
44
+ res.json(config);
45
+ }
46
+ catch (error) {
47
+ res.status(400).json({ error: error.message });
48
+ }
49
+ });
50
+ router.delete('/:name', (req, res) => {
51
+ try {
52
+ store.deleteHook(req.params.id, req.params.name);
53
+ res.status(204).send();
54
+ }
55
+ catch (error) {
56
+ res.status(400).json({ error: error.message });
57
+ }
58
+ });
59
+ router.post('/upload', (req, res) => {
60
+ try {
61
+ const { content } = req.body;
62
+ if (!content || typeof content !== 'string') {
63
+ res.status(400).json({ error: 'content (string) required' });
64
+ return;
65
+ }
66
+ const config = store.uploadHook(req.params.id, content);
67
+ res.status(201).json(config);
68
+ }
69
+ catch (error) {
70
+ res.status(400).json({ error: error.message });
71
+ }
72
+ });
73
+ router.post('/:name/apply', (req, res) => {
74
+ try {
75
+ const { targetWorkspaceId } = req.body;
76
+ if (!targetWorkspaceId) {
77
+ res.status(400).json({ error: 'targetWorkspaceId required' });
78
+ return;
79
+ }
80
+ store.applyToWorkspace(req.params.id, req.params.name, targetWorkspaceId);
81
+ res.json({ ok: true });
82
+ }
83
+ catch (error) {
84
+ res.status(400).json({ error: error.message });
85
+ }
86
+ });
87
+ export default router;
88
+ //# sourceMappingURL=hooks.js.map
@@ -8,6 +8,7 @@ import * as agentService from '../services/agent.js';
8
8
  import * as taskService from '../services/task.js';
9
9
  import { retryIssue } from '../services/issue-retry.js';
10
10
  import { hasActiveIssueAutomation, runIssueAutomation } from '../agents/issue-agent-runner.js';
11
+ import { continueIssueTaskScheduling, stopIssueAutomation } from '../agents/issue-task-controller.js';
11
12
  import * as workflowService from '../services/workflow.js';
12
13
  const router = Router({ mergeParams: true });
13
14
  router.get('/', (req, res) => {
@@ -48,13 +49,15 @@ router.put('/:issueId', (req, res) => {
48
49
  return;
49
50
  }
50
51
  const previousStatus = issue.status;
51
- const { title, description, status, members, workflowId } = req.body;
52
+ const { title, description, status, members, workflowId, continuousRun } = req.body;
52
53
  if (title)
53
54
  issue.title = title;
54
55
  if (description !== undefined)
55
56
  issue.description = description;
56
57
  if (workflowId !== undefined)
57
58
  issue.workflowId = workflowId || undefined;
59
+ if (continuousRun !== undefined)
60
+ issue.continuousRun = continuousRun !== false;
58
61
  if (members !== undefined) {
59
62
  issue.members = normalizeIssueMembers(req.params.id, mergeWorkflowMembers(members, issue.workflowId));
60
63
  }
@@ -142,6 +145,61 @@ router.post('/:issueId/resume', async (req, res) => {
142
145
  }
143
146
  res.json(result.issue);
144
147
  });
148
+ router.post('/:issueId/continue', (req, res) => {
149
+ const workspaceId = req.params.id;
150
+ const { issueId } = req.params;
151
+ const before = issueService.getById(workspaceId, issueId);
152
+ if (!before) {
153
+ res.status(404).json({ error: 'issue not found' });
154
+ return;
155
+ }
156
+ const issue = before.status === 'draft' || before.status === 'planned'
157
+ ? issueService.updateStatus(workspaceId, issueId, 'in_progress')
158
+ : before;
159
+ if (!issue) {
160
+ res.status(404).json({ error: 'issue not found' });
161
+ return;
162
+ }
163
+ if (issue.status !== before.status) {
164
+ broadcastToWorkspace(workspaceId, 'issue.status_changed', { issueId, from: before.status, to: issue.status });
165
+ }
166
+ broadcastToWorkspace(workspaceId, 'issue.updated', issue);
167
+ res.json(issue);
168
+ const ctx = {
169
+ workspaceId,
170
+ broadcast: (event, data) => broadcastToWorkspace(workspaceId, event, data),
171
+ getSession: (sessionId) => agentService.getById(workspaceId, sessionId),
172
+ updateSessionStatus: (sessionId, status, extra) => agentService.updateStatus(workspaceId, sessionId, status, extra),
173
+ };
174
+ continueIssueTaskScheduling(workspaceId, issueId, ctx).catch((err) => {
175
+ console.error(`[issue-continue] scheduling error for issue ${issueId}:`, err);
176
+ });
177
+ });
178
+ router.post('/:issueId/interrupt', (req, res) => {
179
+ const workspaceId = req.params.id;
180
+ const { issueId } = req.params;
181
+ const before = issueService.getById(workspaceId, issueId);
182
+ if (!before) {
183
+ res.status(404).json({ error: 'issue not found' });
184
+ return;
185
+ }
186
+ const reason = 'Interrupted by user';
187
+ const failedTasks = stopIssueAutomation(workspaceId, issueId, reason);
188
+ for (const { task, from } of failedTasks) {
189
+ broadcastToWorkspace(workspaceId, 'task.status_changed', { taskId: task.id, from, to: task.status });
190
+ broadcastToWorkspace(workspaceId, 'task.updated', task);
191
+ }
192
+ if (before.channelId)
193
+ stopChannelRuns(workspaceId, before.channelId);
194
+ const issue = issueService.markError(workspaceId, issueId, reason);
195
+ if (!issue) {
196
+ res.status(404).json({ error: 'issue not found' });
197
+ return;
198
+ }
199
+ broadcastToWorkspace(workspaceId, 'issue.status_changed', { issueId, from: before.status, to: 'error' });
200
+ broadcastToWorkspace(workspaceId, 'issue.updated', issue);
201
+ res.json(issue);
202
+ });
145
203
  router.delete('/:issueId', (req, res) => {
146
204
  const { id, issueId } = req.params;
147
205
  const issue = issueService.getById(id, issueId);
@@ -0,0 +1,39 @@
1
+ import { Router } from 'express';
2
+ import * as svc from '../services/kanban.js';
3
+ const router = Router({ mergeParams: true });
4
+ // GET /api/workspaces/:id/kanban — 获取或初始化 board
5
+ router.get('/', (req, res) => {
6
+ const workspaceId = req.params.id;
7
+ if (!workspaceId) {
8
+ res.status(400).json({ error: 'workspaceId required' });
9
+ return;
10
+ }
11
+ try {
12
+ const board = svc.ensureBoard(workspaceId);
13
+ res.json(board);
14
+ }
15
+ catch (error) {
16
+ res.status(500).json({ error: error.message });
17
+ }
18
+ });
19
+ // PUT /api/workspaces/:id/kanban — 保存完整 board 状态
20
+ router.put('/', (req, res) => {
21
+ const workspaceId = req.params.id;
22
+ if (!workspaceId) {
23
+ res.status(400).json({ error: 'workspaceId required' });
24
+ return;
25
+ }
26
+ try {
27
+ const board = svc.saveBoard(workspaceId, req.body);
28
+ if (!board) {
29
+ res.status(404).json({ error: 'Board not found' });
30
+ return;
31
+ }
32
+ res.json(board);
33
+ }
34
+ catch (error) {
35
+ res.status(400).json({ error: error.message });
36
+ }
37
+ });
38
+ export default router;
39
+ //# sourceMappingURL=kanban.js.map
@@ -0,0 +1,48 @@
1
+ import { Router } from 'express';
2
+ import { listOutputStyles, createOutputStyle, updateOutputStyle, deleteOutputStyle, applyOutputStyleToAgents, listOutputStyleAgentCandidates, } from '../services/output-style.js';
3
+ const router = Router();
4
+ router.get('/', (_req, res) => {
5
+ res.json(listOutputStyles());
6
+ });
7
+ router.get('/agents', (_req, res) => {
8
+ res.json(listOutputStyleAgentCandidates());
9
+ });
10
+ router.post('/', (req, res) => {
11
+ const { name, content, storeId, description } = req.body;
12
+ if (!name || !content) {
13
+ res.status(400).json({ error: 'name and content required' });
14
+ return;
15
+ }
16
+ res.json(createOutputStyle(name, content, storeId, description));
17
+ });
18
+ router.put('/:id', (req, res) => {
19
+ const id = typeof req.params.id === 'string' ? req.params.id : req.params.id[0];
20
+ const data = req.body;
21
+ const tmpl = updateOutputStyle(id, data);
22
+ if (!tmpl) {
23
+ res.status(404).json({ error: 'Not found' });
24
+ return;
25
+ }
26
+ res.json(tmpl);
27
+ });
28
+ router.delete('/:id', (req, res) => {
29
+ const id = typeof req.params.id === 'string' ? req.params.id : req.params.id[0];
30
+ const ok = deleteOutputStyle(id);
31
+ if (!ok) {
32
+ res.status(404).json({ error: 'Not found' });
33
+ return;
34
+ }
35
+ res.json({ success: true });
36
+ });
37
+ router.post('/:id/apply', (req, res) => {
38
+ const id = typeof req.params.id === 'string' ? req.params.id : req.params.id[0];
39
+ const { agentIds } = req.body;
40
+ if (!agentIds?.length) {
41
+ res.status(400).json({ error: 'agentIds required' });
42
+ return;
43
+ }
44
+ const applied = applyOutputStyleToAgents(id, agentIds);
45
+ res.json({ applied });
46
+ });
47
+ export default router;
48
+ //# sourceMappingURL=output-style.js.map