@agent-spaces/server 0.3.64 → 0.3.67

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 (332) hide show
  1. package/dist/adapters/agent-runtime.js +4 -0
  2. package/dist/adapters/claude-code-runtime/index.js +68 -2
  3. package/dist/adapters/claude-code-runtime/message-format.js +26 -0
  4. package/dist/adapters/claude-code-runtime/sdk-config.js +12 -0
  5. package/dist/adapters/codex-function-tool-bridge.js +144 -0
  6. package/dist/adapters/codex-runtime.js +23 -4
  7. package/dist/adapters/git.js +25 -7
  8. package/dist/adapters/hermes-runtime.js +210 -0
  9. package/dist/agents/agent-message-parts.js +1 -1
  10. package/dist/agents/commit-agent.js +4 -2
  11. package/dist/agents/issue-task-controller.js +75 -4
  12. package/dist/agents/pull-request-agent.js +115 -0
  13. package/dist/agents/scheduler-agent.js +1 -1
  14. package/dist/app.js +12 -70
  15. package/dist/middleware/auth.js +1 -1
  16. package/dist/package.json +2 -1
  17. package/dist/routes/agent-sse.js +2 -0
  18. package/dist/routes/agent.js +3 -0
  19. package/dist/routes/database.js +1 -0
  20. package/dist/routes/git.js +197 -317
  21. package/dist/routes/issue.js +1 -1
  22. package/dist/routes/notification.js +10 -0
  23. package/dist/routes/robot-account.js +68 -0
  24. package/dist/routes/version.js +94 -0
  25. package/dist/routes/worktree.js +93 -0
  26. package/dist/services/agent.js +37 -3
  27. package/dist/services/builtin-tools/kanban-tools.js +4 -0
  28. package/dist/services/git-operation-log.js +40 -0
  29. package/dist/services/global-wechat-qr.js +72 -0
  30. package/dist/services/hook-engine.js +175 -17
  31. package/dist/services/notification-center.js +9 -0
  32. package/dist/services/notification-hub/bot-agent.js +3 -1
  33. package/dist/services/notification-hub/service.js +12 -2
  34. package/dist/services/robot-account.js +34 -0
  35. package/dist/services/version.js +59 -0
  36. package/dist/services/workflow-command-runner.js +23 -0
  37. package/dist/services/workflow.js +25 -8
  38. package/dist/services/workspace.js +25 -1
  39. package/dist/services/worktree.js +207 -0
  40. package/dist/storage/robot-account-store.js +39 -0
  41. package/dist/storage/worktree-store.js +33 -0
  42. package/dist/web/404.html +1 -1
  43. package/dist/web/__next.__PAGE__.txt +4 -4
  44. package/dist/web/__next._full.txt +23 -25
  45. package/dist/web/__next._head.txt +4 -4
  46. package/dist/web/__next._index.txt +13 -13
  47. package/dist/web/__next._tree.txt +2 -2
  48. package/dist/web/_next/static/chunks/{0n6_4so_afuwk.js → 0-92u-tiuy40a.js} +4 -4
  49. package/dist/web/_next/static/chunks/{0vbqaynjq8ga..js → 0-yizd8osmas2.js} +1 -1
  50. package/dist/web/_next/static/chunks/0.ln~3mnv8.69.js +1 -0
  51. package/dist/web/_next/static/chunks/{0iuf30t0rjsjv.js → 01y3e9pemva7b.js} +10 -10
  52. package/dist/web/_next/static/chunks/02802taez976w.js +67 -0
  53. package/dist/web/_next/static/chunks/02l~tmzrgny.~.js +1 -0
  54. package/dist/web/_next/static/chunks/033.awk90g6eh.js +1 -0
  55. package/dist/web/_next/static/chunks/03f1bwuynjdmk.js +1 -0
  56. package/dist/web/_next/static/chunks/04cb4kc9r2pd1.js +1 -0
  57. package/dist/web/_next/static/chunks/04de6ha5_e3pp.js +1 -0
  58. package/dist/web/_next/static/chunks/06.kdsa9rr2h1.js +1 -0
  59. package/dist/web/_next/static/chunks/09he0p79ov1rn.js +1 -0
  60. package/dist/web/_next/static/chunks/09vpocs4zuc8h.js +1 -0
  61. package/dist/web/_next/static/chunks/0_o2exgr0e_nh.js +1 -0
  62. package/dist/web/_next/static/chunks/{0xbaakj0dfc0..js → 0_y9nskc-xt2k.js} +1 -1
  63. package/dist/web/_next/static/chunks/0clnj-1fi6u8j.js +3 -0
  64. package/dist/web/_next/static/chunks/0gv40by0zzxs_.js +1 -0
  65. package/dist/web/_next/static/chunks/0iusr8y88.kjg.js +1 -0
  66. package/dist/web/_next/static/chunks/{04a4vsq2wknm4.js → 0j-8418fxvkd1.js} +1 -1
  67. package/dist/web/_next/static/chunks/0j-l7l_k9jt45.js +1 -0
  68. package/dist/web/_next/static/chunks/0j.wxxyoclma5.js +1 -0
  69. package/dist/web/_next/static/chunks/0jq.16sozqik..js +3 -0
  70. package/dist/web/_next/static/chunks/0jw8xdk_fpnp0.css +1 -0
  71. package/dist/web/_next/static/chunks/0l1lkd-wcotma.js +1 -0
  72. package/dist/web/_next/static/chunks/0ncxf_zr4n839.js +1 -0
  73. package/dist/web/_next/static/chunks/0ndo7um~v7vco.js +1 -0
  74. package/dist/web/_next/static/chunks/0ngk.~kan8wq_.js +1 -0
  75. package/dist/web/_next/static/chunks/0p3h-h3zj5ujg.js +30 -0
  76. package/dist/web/_next/static/chunks/0pm-un~-sy3rl.js +1 -0
  77. package/dist/web/_next/static/chunks/0rt9bofnn6qvn.js +1 -0
  78. package/dist/web/_next/static/chunks/0t64.9jd00hio.js +3 -0
  79. package/dist/web/_next/static/chunks/0taui9--5n6-5.js +1 -0
  80. package/dist/web/_next/static/chunks/0ty39169lh~z3.js +1 -0
  81. package/dist/web/_next/static/chunks/0uxzi~9b~k4mn.js +31 -0
  82. package/dist/web/_next/static/chunks/0v8nof~waedlu.js +1 -0
  83. package/dist/web/_next/static/chunks/{0ctg5qmw7uu.1.js → 0vcfoagnpf.aw.js} +3 -3
  84. package/dist/web/_next/static/chunks/{08ckpwmmwlors.js → 0wwwq.gyyz0vg.js} +3 -3
  85. package/dist/web/_next/static/chunks/0x5lak8yz7pm7.js +1 -0
  86. package/dist/web/_next/static/chunks/0xon_.4-o0_zq.js +7 -0
  87. package/dist/web/_next/static/chunks/0zjnrbt7inime.js +1 -0
  88. package/dist/web/_next/static/chunks/0zncg76rgtbm-.js +1 -0
  89. package/dist/web/_next/static/chunks/0zwebpitvpuv1.js +1 -0
  90. package/dist/web/_next/static/chunks/0~02o4g-o6n~m.js +1 -0
  91. package/dist/web/_next/static/chunks/{10l-9myrdo3x9.js → 0~fjezp.k4qk3.js} +1 -1
  92. package/dist/web/_next/static/chunks/0~sh93re1-_rp.js +1 -0
  93. package/dist/web/_next/static/chunks/10_niiq0k6o-p.js +5 -0
  94. package/dist/web/_next/static/chunks/12tjr0_2ccrtq.js +2 -0
  95. package/dist/web/_next/static/chunks/12x5.go_x9mfk.js +1 -0
  96. package/dist/web/_next/static/chunks/{1442stwa0gbxe.js → 12~5dk9i9d16t.js} +2 -2
  97. package/dist/web/_next/static/chunks/13iye4rv5p31b.js +1 -0
  98. package/dist/web/_next/static/chunks/{01~quun6sefgl.js → 13~y-b.b9rrw4.js} +1 -1
  99. package/dist/web/_next/static/chunks/151wzhb5q0lo5.js +1 -0
  100. package/dist/web/_next/static/chunks/18c7g84y01mj0.js +1 -0
  101. package/dist/web/_next/static/chunks/{turbopack-0ndm2zc_pdptk.js → turbopack-11qjwlynmfc-n.js} +1 -1
  102. package/dist/web/_not-found/__next._full.txt +30 -29
  103. package/dist/web/_not-found/__next._head.txt +4 -4
  104. package/dist/web/_not-found/__next._index.txt +13 -13
  105. package/dist/web/_not-found/__next._not-found.__PAGE__.txt +2 -2
  106. package/dist/web/_not-found/__next._not-found.txt +3 -3
  107. package/dist/web/_not-found/__next._tree.txt +2 -2
  108. package/dist/web/_not-found.html +1 -1
  109. package/dist/web/_not-found.txt +30 -29
  110. package/dist/web/index.html +1 -1
  111. package/dist/web/index.txt +23 -25
  112. package/dist/web/login/__next._full.txt +28 -28
  113. package/dist/web/login/__next._head.txt +4 -4
  114. package/dist/web/login/__next._index.txt +13 -13
  115. package/dist/web/login/__next._tree.txt +2 -2
  116. package/dist/web/login/__next.login.__PAGE__.txt +4 -4
  117. package/dist/web/login/__next.login.txt +3 -3
  118. package/dist/web/login.html +1 -1
  119. package/dist/web/login.txt +28 -28
  120. package/dist/web/settings/__next._full.txt +33 -32
  121. package/dist/web/settings/__next._head.txt +4 -4
  122. package/dist/web/settings/__next._index.txt +13 -13
  123. package/dist/web/settings/__next._tree.txt +2 -2
  124. package/dist/web/settings/__next.settings.__PAGE__.txt +4 -4
  125. package/dist/web/settings/__next.settings.txt +5 -5
  126. package/dist/web/settings/agents/__next._full.txt +24 -24
  127. package/dist/web/settings/agents/__next._head.txt +4 -4
  128. package/dist/web/settings/agents/__next._index.txt +13 -13
  129. package/dist/web/settings/agents/__next._tree.txt +2 -2
  130. package/dist/web/settings/agents/__next.settings.agents.__PAGE__.txt +4 -4
  131. package/dist/web/settings/agents/__next.settings.agents.txt +3 -3
  132. package/dist/web/settings/agents/__next.settings.txt +5 -5
  133. package/dist/web/settings/agents.html +1 -1
  134. package/dist/web/settings/agents.txt +24 -24
  135. package/dist/web/settings/mcps/__next._full.txt +24 -24
  136. package/dist/web/settings/mcps/__next._head.txt +4 -4
  137. package/dist/web/settings/mcps/__next._index.txt +13 -13
  138. package/dist/web/settings/mcps/__next._tree.txt +2 -2
  139. package/dist/web/settings/mcps/__next.settings.mcps.__PAGE__.txt +4 -4
  140. package/dist/web/settings/mcps/__next.settings.mcps.txt +3 -3
  141. package/dist/web/settings/mcps/__next.settings.txt +5 -5
  142. package/dist/web/settings/mcps.html +1 -1
  143. package/dist/web/settings/mcps.txt +24 -24
  144. package/dist/web/settings/models/__next._full.txt +24 -24
  145. package/dist/web/settings/models/__next._head.txt +4 -4
  146. package/dist/web/settings/models/__next._index.txt +13 -13
  147. package/dist/web/settings/models/__next._tree.txt +2 -2
  148. package/dist/web/settings/models/__next.settings.models.__PAGE__.txt +4 -4
  149. package/dist/web/settings/models/__next.settings.models.txt +3 -3
  150. package/dist/web/settings/models/__next.settings.txt +5 -5
  151. package/dist/web/settings/models.html +1 -1
  152. package/dist/web/settings/models.txt +24 -24
  153. package/dist/web/settings/output-styles/__next._full.txt +24 -24
  154. package/dist/web/settings/output-styles/__next._head.txt +4 -4
  155. package/dist/web/settings/output-styles/__next._index.txt +13 -13
  156. package/dist/web/settings/output-styles/__next._tree.txt +2 -2
  157. package/dist/web/settings/output-styles/__next.settings.output-styles.__PAGE__.txt +4 -4
  158. package/dist/web/settings/output-styles/__next.settings.output-styles.txt +3 -3
  159. package/dist/web/settings/output-styles/__next.settings.txt +5 -5
  160. package/dist/web/settings/output-styles.html +1 -1
  161. package/dist/web/settings/output-styles.txt +24 -24
  162. package/dist/web/settings/prompts/__next._full.txt +24 -24
  163. package/dist/web/settings/prompts/__next._head.txt +4 -4
  164. package/dist/web/settings/prompts/__next._index.txt +13 -13
  165. package/dist/web/settings/prompts/__next._tree.txt +2 -2
  166. package/dist/web/settings/prompts/__next.settings.prompts.__PAGE__.txt +4 -4
  167. package/dist/web/settings/prompts/__next.settings.prompts.txt +3 -3
  168. package/dist/web/settings/prompts/__next.settings.txt +5 -5
  169. package/dist/web/settings/prompts.html +1 -1
  170. package/dist/web/settings/prompts.txt +24 -24
  171. package/dist/web/settings/providers/__next._full.txt +24 -24
  172. package/dist/web/settings/providers/__next._head.txt +4 -4
  173. package/dist/web/settings/providers/__next._index.txt +13 -13
  174. package/dist/web/settings/providers/__next._tree.txt +2 -2
  175. package/dist/web/settings/providers/__next.settings.providers.__PAGE__.txt +4 -4
  176. package/dist/web/settings/providers/__next.settings.providers.txt +3 -3
  177. package/dist/web/settings/providers/__next.settings.txt +5 -5
  178. package/dist/web/settings/providers.html +1 -1
  179. package/dist/web/settings/providers.txt +24 -24
  180. package/dist/web/settings/skills/__next._full.txt +24 -24
  181. package/dist/web/settings/skills/__next._head.txt +4 -4
  182. package/dist/web/settings/skills/__next._index.txt +13 -13
  183. package/dist/web/settings/skills/__next._tree.txt +2 -2
  184. package/dist/web/settings/skills/__next.settings.skills.__PAGE__.txt +4 -4
  185. package/dist/web/settings/skills/__next.settings.skills.txt +3 -3
  186. package/dist/web/settings/skills/__next.settings.txt +5 -5
  187. package/dist/web/settings/skills.html +1 -1
  188. package/dist/web/settings/skills.txt +24 -24
  189. package/dist/web/settings/tools/__next._full.txt +24 -24
  190. package/dist/web/settings/tools/__next._head.txt +4 -4
  191. package/dist/web/settings/tools/__next._index.txt +13 -13
  192. package/dist/web/settings/tools/__next._tree.txt +2 -2
  193. package/dist/web/settings/tools/__next.settings.tools.__PAGE__.txt +4 -4
  194. package/dist/web/settings/tools/__next.settings.tools.txt +3 -3
  195. package/dist/web/settings/tools/__next.settings.txt +5 -5
  196. package/dist/web/settings/tools.html +1 -1
  197. package/dist/web/settings/tools.txt +24 -24
  198. package/dist/web/settings.html +1 -1
  199. package/dist/web/settings.txt +33 -32
  200. package/dist/web/workflows/__next._full.txt +31 -33
  201. package/dist/web/workflows/__next._head.txt +4 -4
  202. package/dist/web/workflows/__next._index.txt +13 -13
  203. package/dist/web/workflows/__next._tree.txt +2 -2
  204. package/dist/web/workflows/__next.workflows.__PAGE__.txt +4 -4
  205. package/dist/web/workflows/__next.workflows.txt +3 -3
  206. package/dist/web/workflows.html +1 -1
  207. package/dist/web/workflows.txt +31 -33
  208. package/dist/web/workspace/_/__next._full.txt +28 -29
  209. package/dist/web/workspace/_/__next._head.txt +4 -4
  210. package/dist/web/workspace/_/__next._index.txt +13 -13
  211. package/dist/web/workspace/_/__next._tree.txt +2 -2
  212. package/dist/web/workspace/_/__next.workspace.$d$id.__PAGE__.txt +3 -3
  213. package/dist/web/workspace/_/__next.workspace.$d$id.txt +3 -3
  214. package/dist/web/workspace/_/__next.workspace.txt +3 -3
  215. package/dist/web/workspace/_.html +1 -1
  216. package/dist/web/workspace/_.txt +28 -29
  217. package/dist/web/workspaces/__next._full.txt +29 -31
  218. package/dist/web/workspaces/__next._head.txt +4 -4
  219. package/dist/web/workspaces/__next._index.txt +13 -13
  220. package/dist/web/workspaces/__next._tree.txt +2 -2
  221. package/dist/web/workspaces/__next.workspaces.__PAGE__.txt +4 -4
  222. package/dist/web/workspaces/__next.workspaces.txt +3 -3
  223. package/dist/web/workspaces.html +1 -1
  224. package/dist/web/workspaces.txt +29 -31
  225. package/dist/ws/agent-prompt.js +32 -3
  226. package/dist/ws/agent-runner.js +83 -6
  227. package/package.json +11 -11
  228. package/dist/web/_next/static/chunks/0-9194nbxy_6d.js +0 -1
  229. package/dist/web/_next/static/chunks/0.n~yfwf4~6w-.js +0 -1
  230. package/dist/web/_next/static/chunks/02mf61htij8g0.js +0 -31
  231. package/dist/web/_next/static/chunks/04dg4l4hv11q2.js +0 -3
  232. package/dist/web/_next/static/chunks/04fxddw-y20~-.js +0 -7
  233. package/dist/web/_next/static/chunks/04w7~5ooz_pwm.js +0 -1
  234. package/dist/web/_next/static/chunks/05oc21sj24wtq.js +0 -1
  235. package/dist/web/_next/static/chunks/08kfx8on9oty~.js +0 -1
  236. package/dist/web/_next/static/chunks/08k~meqbd8d6v.js +0 -1
  237. package/dist/web/_next/static/chunks/099h96wjsdb25.js +0 -2
  238. package/dist/web/_next/static/chunks/09h23logvq65m.js +0 -1
  239. package/dist/web/_next/static/chunks/0a5y-vhf4i5id.js +0 -3
  240. package/dist/web/_next/static/chunks/0ake2f3x2uan4.js +0 -24
  241. package/dist/web/_next/static/chunks/0ck8dw_9-1cdx.js +0 -1
  242. package/dist/web/_next/static/chunks/0ewceguykiut5.js +0 -1
  243. package/dist/web/_next/static/chunks/0f7cb9li~3jra.js +0 -67
  244. package/dist/web/_next/static/chunks/0ghs9on7wodrm.js +0 -1
  245. package/dist/web/_next/static/chunks/0ghx3j_.-gdyd.js +0 -1
  246. package/dist/web/_next/static/chunks/0h9cu-k6z5o08.js +0 -1
  247. package/dist/web/_next/static/chunks/0jb4~3qqkw2ps.js +0 -1
  248. package/dist/web/_next/static/chunks/0nb8.iteznuvx.js +0 -1
  249. package/dist/web/_next/static/chunks/0os58q93stt7j.js +0 -3
  250. package/dist/web/_next/static/chunks/0s9lmk8iauou3.js +0 -1
  251. package/dist/web/_next/static/chunks/0sp_zbx~w0am7.js +0 -1
  252. package/dist/web/_next/static/chunks/0tel~zsv4z8l_.js +0 -1
  253. package/dist/web/_next/static/chunks/0twamv4wr_dbv.js +0 -1
  254. package/dist/web/_next/static/chunks/0uhol5wafdbl~.js +0 -1
  255. package/dist/web/_next/static/chunks/0v3a_x4vt42kx.js +0 -5
  256. package/dist/web/_next/static/chunks/0v7q4mys.mnm..css +0 -1
  257. package/dist/web/_next/static/chunks/0xt-8wk21gs7g.js +0 -1
  258. package/dist/web/_next/static/chunks/0z~vqzbm_q371.js +0 -1
  259. package/dist/web/_next/static/chunks/0~3xm80~j9ddg.js +0 -1
  260. package/dist/web/_next/static/chunks/14s37n6h0_q3x.js +0 -16
  261. package/dist/web/_next/static/chunks/161ik5kfyuwtd.js +0 -1
  262. package/dist/web/_next/static/chunks/17k~zbv0_4rep.js +0 -1
  263. package/public/output-styles/carmack-mode.md +0 -381
  264. package/public/output-styles/codex-rigor-mode.md +0 -114
  265. package/public/output-styles/dhh-mode.md +0 -265
  266. package/public/output-styles/evan-you-mode.md +0 -539
  267. package/public/output-styles/index.json +0 -37
  268. package/public/output-styles/jobs-mode.md +0 -369
  269. package/public/output-styles/linus-mode.md +0 -135
  270. package/public/output-styles/uncle-bob-mode.md +0 -221
  271. package/public/prompt/andrej-karpathy-skills.md +0 -65
  272. package/public/prompt/claude-token-efficient-coding.md +0 -35
  273. package/public/prompt/index.json +0 -12
  274. package/public/skills/index.json +0 -92
  275. package/public/skills/planning-with-files/planning-with-files-zh/SKILL.md +0 -243
  276. package/public/skills/planning-with-files/planning-with-files-zh/scripts/check-complete.ps1 +0 -44
  277. package/public/skills/planning-with-files/planning-with-files-zh/scripts/check-complete.sh +0 -46
  278. package/public/skills/planning-with-files/planning-with-files-zh/scripts/init-session.ps1 +0 -124
  279. package/public/skills/planning-with-files/planning-with-files-zh/scripts/init-session.sh +0 -124
  280. package/public/skills/planning-with-files/planning-with-files-zh/scripts/session-catchup.py +0 -438
  281. package/public/skills/planning-with-files/planning-with-files-zh/templates/findings.md +0 -29
  282. package/public/skills/planning-with-files/planning-with-files-zh/templates/progress.md +0 -40
  283. package/public/skills/planning-with-files/planning-with-files-zh/templates/task_plan.md +0 -58
  284. package/public/skills/superpowers/brainstorming/SKILL.md +0 -164
  285. package/public/skills/superpowers/brainstorming/scripts/frame-template.html +0 -214
  286. package/public/skills/superpowers/brainstorming/scripts/helper.js +0 -88
  287. package/public/skills/superpowers/brainstorming/scripts/server.cjs +0 -354
  288. package/public/skills/superpowers/brainstorming/scripts/start-server.sh +0 -148
  289. package/public/skills/superpowers/brainstorming/scripts/stop-server.sh +0 -56
  290. package/public/skills/superpowers/brainstorming/spec-document-reviewer-prompt.md +0 -49
  291. package/public/skills/superpowers/brainstorming/visual-companion.md +0 -287
  292. package/public/skills/superpowers/dispatching-parallel-agents/SKILL.md +0 -182
  293. package/public/skills/superpowers/executing-plans/SKILL.md +0 -70
  294. package/public/skills/superpowers/finishing-a-development-branch/SKILL.md +0 -251
  295. package/public/skills/superpowers/receiving-code-review/SKILL.md +0 -213
  296. package/public/skills/superpowers/requesting-code-review/SKILL.md +0 -103
  297. package/public/skills/superpowers/requesting-code-review/code-reviewer.md +0 -168
  298. package/public/skills/superpowers/subagent-driven-development/SKILL.md +0 -279
  299. package/public/skills/superpowers/subagent-driven-development/code-quality-reviewer-prompt.md +0 -25
  300. package/public/skills/superpowers/subagent-driven-development/implementer-prompt.md +0 -113
  301. package/public/skills/superpowers/subagent-driven-development/spec-reviewer-prompt.md +0 -61
  302. package/public/skills/superpowers/systematic-debugging/CREATION-LOG.md +0 -119
  303. package/public/skills/superpowers/systematic-debugging/SKILL.md +0 -296
  304. package/public/skills/superpowers/systematic-debugging/condition-based-waiting-example.ts +0 -158
  305. package/public/skills/superpowers/systematic-debugging/condition-based-waiting.md +0 -115
  306. package/public/skills/superpowers/systematic-debugging/defense-in-depth.md +0 -122
  307. package/public/skills/superpowers/systematic-debugging/find-polluter.sh +0 -63
  308. package/public/skills/superpowers/systematic-debugging/root-cause-tracing.md +0 -169
  309. package/public/skills/superpowers/systematic-debugging/test-academic.md +0 -14
  310. package/public/skills/superpowers/systematic-debugging/test-pressure-1.md +0 -58
  311. package/public/skills/superpowers/systematic-debugging/test-pressure-2.md +0 -68
  312. package/public/skills/superpowers/systematic-debugging/test-pressure-3.md +0 -69
  313. package/public/skills/superpowers/test-driven-development/SKILL.md +0 -371
  314. package/public/skills/superpowers/test-driven-development/testing-anti-patterns.md +0 -299
  315. package/public/skills/superpowers/using-git-worktrees/SKILL.md +0 -215
  316. package/public/skills/superpowers/using-superpowers/SKILL.md +0 -117
  317. package/public/skills/superpowers/using-superpowers/references/codex-tools.md +0 -59
  318. package/public/skills/superpowers/using-superpowers/references/copilot-tools.md +0 -42
  319. package/public/skills/superpowers/using-superpowers/references/gemini-tools.md +0 -51
  320. package/public/skills/superpowers/verification-before-completion/SKILL.md +0 -139
  321. package/public/skills/superpowers/writing-plans/SKILL.md +0 -152
  322. package/public/skills/superpowers/writing-plans/plan-document-reviewer-prompt.md +0 -49
  323. package/public/skills/superpowers/writing-skills/SKILL.md +0 -655
  324. package/public/skills/superpowers/writing-skills/anthropic-best-practices.md +0 -1150
  325. package/public/skills/superpowers/writing-skills/examples/CLAUDE_MD_TESTING.md +0 -189
  326. package/public/skills/superpowers/writing-skills/graphviz-conventions.dot +0 -172
  327. package/public/skills/superpowers/writing-skills/persuasion-principles.md +0 -187
  328. package/public/skills/superpowers/writing-skills/render-graphs.js +0 -168
  329. package/public/skills/superpowers/writing-skills/testing-skills-with-subagents.md +0 -384
  330. /package/dist/web/_next/static/{e8w3vd9Eov_LDYWj_0zsE → rGXyAK8rgod1NjF3bLZAY}/_buildManifest.js +0 -0
  331. /package/dist/web/_next/static/{e8w3vd9Eov_LDYWj_0zsE → rGXyAK8rgod1NjF3bLZAY}/_clientMiddlewareManifest.js +0 -0
  332. /package/dist/web/_next/static/{e8w3vd9Eov_LDYWj_0zsE → rGXyAK8rgod1NjF3bLZAY}/_ssgManifest.js +0 -0
@@ -67,6 +67,7 @@ router.post('/run', async (req, res) => {
67
67
  agentService.updateStatus(workspaceId, session.id, 'active');
68
68
  writeSse(res, 'status', { agentId: session.id, status: 'active' });
69
69
  const result = await runtime.execute(buildAgentPrompt(workspaceId, body.systemPrompt ?? preset.systemPrompt, userPrompt, normalizeMessages(body.messages), {
70
+ runtimeKind: preset.runtimeKind,
70
71
  mcpServers: Object.keys(mcpServers ?? {}),
71
72
  skills,
72
73
  boundDirs: workspace.boundDirs,
@@ -79,6 +80,7 @@ router.post('/run', async (req, res) => {
79
80
  skills,
80
81
  configDir,
81
82
  sandboxDirs: preset.sandboxDirs,
83
+ userPrompt,
82
84
  outputStyle: body.outputStyle ?? preset.outputStyle,
83
85
  onEvent: wrapOnEventWithHooks((event) => {
84
86
  if (event.type === 'output')
@@ -22,6 +22,9 @@ router.post('/presets', (req, res) => {
22
22
  const preset = agentService.createPreset(req.params.id, body);
23
23
  res.status(201).json(preset);
24
24
  });
25
+ router.post('/presets/sync-workspaces', (_req, res) => {
26
+ res.json(agentService.syncTemplatesToAllWorkspaces());
27
+ });
25
28
  router.post('/presets/generate', async (req, res) => {
26
29
  const { prompt } = req.body;
27
30
  if (!prompt?.trim()) {
@@ -84,6 +84,7 @@ router.post('/chat', async (req, res) => {
84
84
  });
85
85
  const result = await runtime.execute(buildDatabaseAgentPrompt(workspaceId, agent, prompt, history ?? []), workingDir, {
86
86
  maxTurns: 60,
87
+ userPrompt: prompt,
87
88
  functionTools,
88
89
  mcpServers: {},
89
90
  skills: [],
@@ -1,325 +1,205 @@
1
1
  import { Router } from 'express';
2
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
+ import { logGitOperation, getGitOperations } from '../services/git-operation-log.js';
3
4
  const router = Router({ mergeParams: true });
4
- router.get('/status', async (req, res) => {
5
- try {
6
- const result = await gitStatus(req.params.id);
7
- res.json(result);
8
- }
9
- catch (err) {
10
- res.status(500).json({ error: err.message });
11
- }
12
- });
13
- router.get('/diff', async (req, res) => {
14
- try {
15
- const filePath = req.query.path;
16
- const result = await gitDiff(req.params.id, filePath);
17
- res.json(result);
18
- }
19
- catch (err) {
20
- res.status(500).json({ error: err.message });
21
- }
22
- });
23
- router.get('/log', async (req, res) => {
24
- try {
25
- const maxCount = parseInt(req.query.maxCount) || 50;
26
- const result = await gitLog(req.params.id, maxCount);
27
- res.json(result);
28
- }
29
- catch (err) {
30
- res.status(500).json({ error: err.message });
31
- }
32
- });
33
- router.post('/commit', async (req, res) => {
34
- try {
35
- const { message } = req.body;
36
- if (!message) {
37
- res.status(400).json({ error: 'message is required' });
38
- return;
39
- }
40
- const result = await gitCommit(req.params.id, message);
41
- res.json(result);
42
- }
43
- catch (err) {
44
- res.status(500).json({ error: err.message });
45
- }
46
- });
47
- router.post('/discard', async (req, res) => {
48
- try {
49
- const { path } = req.body;
50
- if (!path) {
51
- res.status(400).json({ error: 'path is required' });
52
- return;
53
- }
54
- await gitDiscard(req.params.id, path);
55
- res.json({ ok: true });
56
- }
57
- catch (err) {
58
- res.status(500).json({ error: err.message });
59
- }
60
- });
61
- router.post('/discard-all', async (req, res) => {
62
- try {
63
- await gitDiscardAll(req.params.id);
64
- res.json({ ok: true });
65
- }
66
- catch (err) {
67
- res.status(500).json({ error: err.message });
68
- }
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
- });
112
- router.get('/branches', async (req, res) => {
113
- try {
114
- const result = await gitBranches(req.params.id);
115
- res.json(result);
116
- }
117
- catch (err) {
118
- res.status(500).json({ error: err.message });
119
- }
120
- });
121
- router.post('/checkout', async (req, res) => {
122
- try {
123
- const { branch } = req.body;
124
- if (!branch) {
125
- res.status(400).json({ error: 'branch is required' });
126
- return;
127
- }
128
- await gitCheckout(req.params.id, branch);
129
- res.json({ ok: true });
130
- }
131
- catch (err) {
132
- res.status(500).json({ error: err.message });
133
- }
134
- });
135
- router.post('/init', async (req, res) => {
136
- try {
137
- await gitInit(req.params.id);
138
- res.json({ ok: true });
139
- }
140
- catch (err) {
141
- res.status(500).json({ error: err.message });
142
- }
143
- });
144
- router.post('/generate-commit-message', async (req, res) => {
145
- try {
146
- const message = await gitGenerateCommitMsg(req.params.id);
147
- res.json({ message });
148
- }
149
- catch (err) {
150
- res.status(500).json({ error: err.message });
151
- }
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
- });
162
- router.post('/push', async (req, res) => {
163
- try {
164
- await gitPush(req.params.id);
165
- res.json({ ok: true });
166
- }
167
- catch (err) {
168
- res.status(500).json({ error: err.message });
169
- }
170
- });
171
- router.post('/pull', async (req, res) => {
172
- try {
173
- await gitPull(req.params.id);
174
- res.json({ ok: true });
175
- }
176
- catch (err) {
177
- res.status(500).json({ error: err.message });
178
- }
179
- });
180
- router.get('/remotes', async (req, res) => {
181
- try {
182
- const remotes = await gitGetRemotes(req.params.id);
183
- res.json(remotes);
184
- }
185
- catch (err) {
186
- res.status(500).json({ error: err.message });
187
- }
188
- });
189
- router.post('/remotes', async (req, res) => {
190
- try {
191
- const { name, url } = req.body;
192
- if (!name || !url) {
193
- res.status(400).json({ error: 'name and url are required' });
194
- return;
195
- }
196
- await gitAddRemote(req.params.id, name, url);
197
- res.json({ ok: true });
198
- }
199
- catch (err) {
200
- res.status(500).json({ error: err.message });
201
- }
202
- });
203
- router.post('/checkout-detached', async (req, res) => {
204
- try {
205
- const { commitHash } = req.body;
206
- if (!commitHash) {
207
- res.status(400).json({ error: 'commitHash is required' });
208
- return;
209
- }
210
- await gitCheckoutDetached(req.params.id, commitHash);
211
- res.json({ ok: true });
212
- }
213
- catch (err) {
214
- res.status(500).json({ error: err.message });
215
- }
216
- });
217
- router.post('/cherry-pick', async (req, res) => {
218
- try {
219
- const { commitHash } = req.body;
220
- if (!commitHash) {
221
- res.status(400).json({ error: 'commitHash is required' });
222
- return;
5
+ function withLog(operation, inputFn, handler) {
6
+ return async (req, res) => {
7
+ const input = inputFn(req);
8
+ const start = Date.now();
9
+ try {
10
+ await handler(req, res);
11
+ const ok = res.statusCode < 400;
12
+ logGitOperation(req.params.id, operation, input, ok ? { ok: true } : { statusCode: res.statusCode }, ok ? undefined : 'request validation failed', Date.now() - start);
223
13
  }
224
- await gitCherryPick(req.params.id, commitHash);
225
- res.json({ ok: true });
226
- }
227
- catch (err) {
228
- res.status(500).json({ error: err.message });
229
- }
230
- });
231
- router.post('/create-branch', async (req, res) => {
232
- try {
233
- const { name, startPoint } = req.body;
234
- if (!name) {
235
- res.status(400).json({ error: 'name is required' });
236
- return;
14
+ catch (err) {
15
+ logGitOperation(req.params.id, operation, input, undefined, err.message, Date.now() - start);
16
+ if (!res.headersSent)
17
+ res.status(500).json({ error: err.message });
237
18
  }
238
- await gitCreateBranch(req.params.id, name, startPoint);
239
- res.json({ ok: true });
240
- }
241
- catch (err) {
242
- res.status(500).json({ error: err.message });
243
- }
244
- });
245
- router.post('/delete-branch', async (req, res) => {
246
- try {
247
- const { name, force } = req.body;
248
- if (!name) {
249
- res.status(400).json({ error: 'name is required' });
250
- return;
251
- }
252
- await gitDeleteBranch(req.params.id, name, force);
253
- res.json({ ok: true });
254
- }
255
- catch (err) {
256
- res.status(500).json({ error: err.message });
257
- }
258
- });
259
- router.post('/create-tag', async (req, res) => {
260
- try {
261
- const { name, commitHash } = req.body;
262
- if (!name) {
263
- res.status(400).json({ error: 'name is required' });
264
- return;
265
- }
266
- await gitCreateTag(req.params.id, name, commitHash);
267
- res.json({ ok: true });
268
- }
269
- catch (err) {
270
- res.status(500).json({ error: err.message });
271
- }
272
- });
273
- router.get('/commit-diff', async (req, res) => {
274
- try {
275
- const hash = req.query.hash;
276
- if (!hash) {
277
- res.status(400).json({ error: 'hash is required' });
278
- return;
279
- }
280
- const diffs = await gitCommitDiff(req.params.id, hash);
281
- res.json(diffs);
282
- }
283
- catch (err) {
284
- res.status(500).json({ error: err.message });
285
- }
286
- });
287
- router.get('/remote-url', async (req, res) => {
288
- try {
289
- const url = await gitGetRemoteUrl(req.params.id);
290
- res.json({ url });
291
- }
292
- catch (err) {
293
- res.status(500).json({ error: err.message });
294
- }
295
- });
296
- router.get('/merge-base', async (req, res) => {
297
- try {
298
- const hash = await gitMergeBase(req.params.id);
299
- res.json({ hash });
300
- }
301
- catch (err) {
302
- res.status(500).json({ error: err.message });
303
- }
304
- });
305
- router.get('/config', async (req, res) => {
306
- try {
307
- const config = await gitGetConfig('local', req.params.id);
308
- res.json(config);
309
- }
310
- catch (err) {
311
- res.status(500).json({ error: err.message });
312
- }
313
- });
314
- router.post('/config', async (req, res) => {
315
- try {
316
- const { name, email, proxy } = req.body;
317
- await gitSetConfig('local', { name, email, proxy }, req.params.id);
318
- res.json({ ok: true });
319
- }
320
- catch (err) {
321
- res.status(500).json({ error: err.message });
322
- }
19
+ };
20
+ }
21
+ router.get('/status', withLog('status', () => ({}), async (req, res) => {
22
+ const result = await gitStatus(req.params.id);
23
+ res.json(result);
24
+ }));
25
+ router.get('/diff', withLog('diff', (req) => ({ path: req.query.path }), async (req, res) => {
26
+ const filePath = req.query.path;
27
+ const result = await gitDiff(req.params.id, filePath);
28
+ res.json(result);
29
+ }));
30
+ router.get('/log', withLog('log', (req) => ({ maxCount: req.query.maxCount }), async (req, res) => {
31
+ const maxCount = parseInt(req.query.maxCount) || 50;
32
+ const result = await gitLog(req.params.id, maxCount);
33
+ res.json(result);
34
+ }));
35
+ router.post('/commit', withLog('commit', (req) => ({ message: req.body?.message }), async (req, res) => {
36
+ const { message } = req.body;
37
+ if (!message) {
38
+ res.status(400).json({ error: 'message is required' });
39
+ return;
40
+ }
41
+ const result = await gitCommit(req.params.id, message);
42
+ res.json(result);
43
+ }));
44
+ router.post('/discard', withLog('discard', (req) => ({ path: req.body?.path }), async (req, res) => {
45
+ const { path } = req.body;
46
+ if (!path) {
47
+ res.status(400).json({ error: 'path is required' });
48
+ return;
49
+ }
50
+ await gitDiscard(req.params.id, path);
51
+ res.json({ ok: true });
52
+ }));
53
+ router.post('/discard-all', withLog('discard-all', () => ({}), async (req, res) => {
54
+ await gitDiscardAll(req.params.id);
55
+ res.json({ ok: true });
56
+ }));
57
+ router.post('/stage', withLog('stage', (req) => ({ path: req.body?.path }), async (req, res) => {
58
+ const { path } = req.body;
59
+ if (!path) {
60
+ res.status(400).json({ error: 'path is required' });
61
+ return;
62
+ }
63
+ await gitStage(req.params.id, path);
64
+ res.json({ ok: true });
65
+ }));
66
+ router.post('/unstage', withLog('unstage', (req) => ({ path: req.body?.path }), async (req, res) => {
67
+ const { path } = req.body;
68
+ if (!path) {
69
+ res.status(400).json({ error: 'path is required' });
70
+ return;
71
+ }
72
+ await gitUnstage(req.params.id, path);
73
+ res.json({ ok: true });
74
+ }));
75
+ router.post('/resolve-file', withLog('resolve-file', (req) => ({ path: req.body?.path }), async (req, res) => {
76
+ const { path, content, stage } = req.body;
77
+ if (!path || typeof content !== 'string') {
78
+ res.status(400).json({ error: 'path and content are required' });
79
+ return;
80
+ }
81
+ await gitResolveFile(req.params.id, path, content, stage !== false);
82
+ res.json({ ok: true });
83
+ }));
84
+ router.get('/branches', withLog('branches', () => ({}), async (req, res) => {
85
+ const result = await gitBranches(req.params.id);
86
+ res.json(result);
87
+ }));
88
+ router.post('/checkout', withLog('checkout', (req) => ({ branch: req.body?.branch }), async (req, res) => {
89
+ const { branch } = req.body;
90
+ if (!branch) {
91
+ res.status(400).json({ error: 'branch is required' });
92
+ return;
93
+ }
94
+ await gitCheckout(req.params.id, branch);
95
+ res.json({ ok: true });
96
+ }));
97
+ router.post('/init', withLog('init', () => ({}), async (req, res) => {
98
+ await gitInit(req.params.id);
99
+ res.json({ ok: true });
100
+ }));
101
+ router.post('/generate-commit-message', withLog('generate-commit-message', () => ({}), async (req, res) => {
102
+ const message = await gitGenerateCommitMsg(req.params.id);
103
+ res.json({ message });
104
+ }));
105
+ router.post('/fetch', withLog('fetch', () => ({}), async (req, res) => {
106
+ await gitFetch(req.params.id);
107
+ res.json({ ok: true });
108
+ }));
109
+ router.post('/push', withLog('push', () => ({}), async (req, res) => {
110
+ await gitPush(req.params.id);
111
+ res.json({ ok: true });
112
+ }));
113
+ router.post('/pull', withLog('pull', () => ({}), async (req, res) => {
114
+ await gitPull(req.params.id);
115
+ res.json({ ok: true });
116
+ }));
117
+ router.get('/remotes', withLog('remotes', () => ({}), async (req, res) => {
118
+ const remotes = await gitGetRemotes(req.params.id);
119
+ res.json(remotes);
120
+ }));
121
+ router.post('/remotes', withLog('add-remote', (req) => ({ name: req.body?.name, url: req.body?.url }), async (req, res) => {
122
+ const { name, url } = req.body;
123
+ if (!name || !url) {
124
+ res.status(400).json({ error: 'name and url are required' });
125
+ return;
126
+ }
127
+ await gitAddRemote(req.params.id, name, url);
128
+ res.json({ ok: true });
129
+ }));
130
+ router.post('/checkout-detached', withLog('checkout-detached', (req) => ({ commitHash: req.body?.commitHash }), async (req, res) => {
131
+ const { commitHash } = req.body;
132
+ if (!commitHash) {
133
+ res.status(400).json({ error: 'commitHash is required' });
134
+ return;
135
+ }
136
+ await gitCheckoutDetached(req.params.id, commitHash);
137
+ res.json({ ok: true });
138
+ }));
139
+ router.post('/cherry-pick', withLog('cherry-pick', (req) => ({ commitHash: req.body?.commitHash }), async (req, res) => {
140
+ const { commitHash } = req.body;
141
+ if (!commitHash) {
142
+ res.status(400).json({ error: 'commitHash is required' });
143
+ return;
144
+ }
145
+ await gitCherryPick(req.params.id, commitHash);
146
+ res.json({ ok: true });
147
+ }));
148
+ router.post('/create-branch', withLog('create-branch', (req) => ({ name: req.body?.name, startPoint: req.body?.startPoint }), async (req, res) => {
149
+ const { name, startPoint } = req.body;
150
+ if (!name) {
151
+ res.status(400).json({ error: 'name is required' });
152
+ return;
153
+ }
154
+ await gitCreateBranch(req.params.id, name, startPoint);
155
+ res.json({ ok: true });
156
+ }));
157
+ router.post('/delete-branch', withLog('delete-branch', (req) => ({ name: req.body?.name, force: req.body?.force }), async (req, res) => {
158
+ const { name, force } = req.body;
159
+ if (!name) {
160
+ res.status(400).json({ error: 'name is required' });
161
+ return;
162
+ }
163
+ await gitDeleteBranch(req.params.id, name, force);
164
+ res.json({ ok: true });
165
+ }));
166
+ router.post('/create-tag', withLog('create-tag', (req) => ({ name: req.body?.name, commitHash: req.body?.commitHash }), async (req, res) => {
167
+ const { name, commitHash } = req.body;
168
+ if (!name) {
169
+ res.status(400).json({ error: 'name is required' });
170
+ return;
171
+ }
172
+ await gitCreateTag(req.params.id, name, commitHash);
173
+ res.json({ ok: true });
174
+ }));
175
+ router.get('/commit-diff', withLog('commit-diff', (req) => ({ hash: req.query.hash }), async (req, res) => {
176
+ const hash = req.query.hash;
177
+ if (!hash) {
178
+ res.status(400).json({ error: 'hash is required' });
179
+ return;
180
+ }
181
+ const diffs = await gitCommitDiff(req.params.id, hash);
182
+ res.json(diffs);
183
+ }));
184
+ router.get('/remote-url', withLog('remote-url', () => ({}), async (req, res) => {
185
+ const url = await gitGetRemoteUrl(req.params.id);
186
+ res.json({ url });
187
+ }));
188
+ router.get('/merge-base', withLog('merge-base', () => ({}), async (req, res) => {
189
+ const hash = await gitMergeBase(req.params.id);
190
+ res.json({ hash });
191
+ }));
192
+ router.get('/config', withLog('config.get', () => ({}), async (req, res) => {
193
+ const config = await gitGetConfig('local', req.params.id);
194
+ res.json(config);
195
+ }));
196
+ router.post('/config', withLog('config.set', (req) => ({ name: req.body?.name, email: req.body?.email, proxy: req.body?.proxy }), async (req, res) => {
197
+ const { name, email, proxy } = req.body;
198
+ await gitSetConfig('local', { name, email, proxy }, req.params.id);
199
+ res.json({ ok: true });
200
+ }));
201
+ router.get('/operations', (req, res) => {
202
+ res.json(getGitOperations(req.params.id));
323
203
  });
324
204
  export default router;
325
205
  //# sourceMappingURL=git.js.map
@@ -313,7 +313,7 @@ function mergeWorkflowMembers(members, workflowId) {
313
313
  return base;
314
314
  return Array.from(new Set([
315
315
  ...base,
316
- ...workflow.nodes.map((node) => node.data.agentConfigId).filter(Boolean),
316
+ ...workflow.nodes.filter((n) => n.type === 'agent').map((node) => node.data.agentConfigId).filter(Boolean),
317
317
  ]));
318
318
  }
319
319
  //# sourceMappingURL=issue.js.map
@@ -27,5 +27,15 @@ router.delete('/', (req, res) => {
27
27
  nc.clearAll(workspaceId);
28
28
  res.json({ ok: true });
29
29
  });
30
+ router.delete('/:notificationId', (req, res) => {
31
+ const workspaceId = req.params.id;
32
+ const notificationId = req.params.notificationId;
33
+ const removed = nc.removeNotification(workspaceId, notificationId);
34
+ if (!removed) {
35
+ res.status(404).json({ error: 'Not found' });
36
+ return;
37
+ }
38
+ res.json({ ok: true });
39
+ });
30
40
  export default router;
31
41
  //# sourceMappingURL=notification.js.map
@@ -0,0 +1,68 @@
1
+ import { Router } from 'express';
2
+ import { listRobotAccounts, createAccount, updateAccount, deleteRobotAccount } from '../services/robot-account.js';
3
+ import { getGlobalWeChatQRCode, pollGlobalWeChatQRCode } from '../services/global-wechat-qr.js';
4
+ const router = Router();
5
+ router.get('/', (_req, res) => {
6
+ res.json(listRobotAccounts());
7
+ });
8
+ router.post('/', (req, res) => {
9
+ const { name, type, lark, wechat } = req.body;
10
+ if (!name || !type) {
11
+ res.status(400).json({ error: 'name and type are required' });
12
+ return;
13
+ }
14
+ if (!['lark', 'wechat'].includes(type)) {
15
+ res.status(400).json({ error: 'type must be lark or wechat' });
16
+ return;
17
+ }
18
+ if (type === 'lark' && (!lark?.appId || !lark?.appSecret)) {
19
+ res.status(400).json({ error: 'lark.appId and lark.appSecret are required' });
20
+ return;
21
+ }
22
+ if (type === 'wechat' && (!wechat?.token || !wechat?.accountId)) {
23
+ res.status(400).json({ error: 'wechat.token and wechat.accountId are required' });
24
+ return;
25
+ }
26
+ const account = createAccount({ name, type, lark, wechat });
27
+ res.status(201).json(account);
28
+ });
29
+ router.put('/:id', (req, res) => {
30
+ const { id } = req.params;
31
+ const { name, lark, wechat } = req.body;
32
+ const updated = updateAccount(id, { name, lark, wechat });
33
+ if (!updated) {
34
+ res.status(404).json({ error: 'Not found' });
35
+ return;
36
+ }
37
+ res.json(updated);
38
+ });
39
+ router.delete('/:id', (req, res) => {
40
+ const deleted = deleteRobotAccount(req.params.id);
41
+ if (!deleted) {
42
+ res.status(404).json({ error: 'Not found' });
43
+ return;
44
+ }
45
+ res.json({ ok: true });
46
+ });
47
+ // Global WeChat QR login (not bound to a workspace)
48
+ router.post('/wechat/qr', async (_req, res) => {
49
+ try {
50
+ const result = await getGlobalWeChatQRCode();
51
+ res.json(result);
52
+ }
53
+ catch (err) {
54
+ res.status(400).json({ error: err instanceof Error ? err.message : 'Failed to get WeChat QR code' });
55
+ }
56
+ });
57
+ router.post('/wechat/qr/poll', async (req, res) => {
58
+ try {
59
+ const { sessionId } = req.body;
60
+ const result = await pollGlobalWeChatQRCode(sessionId);
61
+ res.json(result);
62
+ }
63
+ catch (err) {
64
+ res.status(400).json({ error: err instanceof Error ? err.message : 'Failed to poll WeChat QR status' });
65
+ }
66
+ });
67
+ export default router;
68
+ //# sourceMappingURL=robot-account.js.map