agent-tower 0.1.0

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 (341) hide show
  1. package/dist/app.d.ts +2 -0
  2. package/dist/app.d.ts.map +1 -0
  3. package/dist/app.js +62 -0
  4. package/dist/app.js.map +1 -0
  5. package/dist/cli.d.ts +3 -0
  6. package/dist/cli.d.ts.map +1 -0
  7. package/dist/cli.js +131 -0
  8. package/dist/cli.js.map +1 -0
  9. package/dist/core/container.d.ts +11 -0
  10. package/dist/core/container.d.ts.map +1 -0
  11. package/dist/core/container.js +66 -0
  12. package/dist/core/container.js.map +1 -0
  13. package/dist/core/event-bus.d.ts +58 -0
  14. package/dist/core/event-bus.d.ts.map +1 -0
  15. package/dist/core/event-bus.js +29 -0
  16. package/dist/core/event-bus.js.map +1 -0
  17. package/dist/errors.d.ts +22 -0
  18. package/dist/errors.d.ts.map +1 -0
  19. package/dist/errors.js +36 -0
  20. package/dist/errors.js.map +1 -0
  21. package/dist/executors/base.executor.d.ts +160 -0
  22. package/dist/executors/base.executor.d.ts.map +1 -0
  23. package/dist/executors/base.executor.js +122 -0
  24. package/dist/executors/base.executor.js.map +1 -0
  25. package/dist/executors/claude-code.executor.d.ts +78 -0
  26. package/dist/executors/claude-code.executor.d.ts.map +1 -0
  27. package/dist/executors/claude-code.executor.js +160 -0
  28. package/dist/executors/claude-code.executor.js.map +1 -0
  29. package/dist/executors/command-builder.d.ts +64 -0
  30. package/dist/executors/command-builder.d.ts.map +1 -0
  31. package/dist/executors/command-builder.js +144 -0
  32. package/dist/executors/command-builder.js.map +1 -0
  33. package/dist/executors/cursor-agent.executor.d.ts +57 -0
  34. package/dist/executors/cursor-agent.executor.d.ts.map +1 -0
  35. package/dist/executors/cursor-agent.executor.js +109 -0
  36. package/dist/executors/cursor-agent.executor.js.map +1 -0
  37. package/dist/executors/default-profiles.json +29 -0
  38. package/dist/executors/execution-env.d.ts +64 -0
  39. package/dist/executors/execution-env.d.ts.map +1 -0
  40. package/dist/executors/execution-env.js +97 -0
  41. package/dist/executors/execution-env.js.map +1 -0
  42. package/dist/executors/gemini-cli.executor.d.ts +55 -0
  43. package/dist/executors/gemini-cli.executor.d.ts.map +1 -0
  44. package/dist/executors/gemini-cli.executor.js +117 -0
  45. package/dist/executors/gemini-cli.executor.js.map +1 -0
  46. package/dist/executors/index.d.ts +49 -0
  47. package/dist/executors/index.d.ts.map +1 -0
  48. package/dist/executors/index.js +95 -0
  49. package/dist/executors/index.js.map +1 -0
  50. package/dist/executors/profiles.d.ts +61 -0
  51. package/dist/executors/profiles.d.ts.map +1 -0
  52. package/dist/executors/profiles.js +192 -0
  53. package/dist/executors/profiles.js.map +1 -0
  54. package/dist/git/git-cli.d.ts +59 -0
  55. package/dist/git/git-cli.d.ts.map +1 -0
  56. package/dist/git/git-cli.js +156 -0
  57. package/dist/git/git-cli.js.map +1 -0
  58. package/dist/git/worktree.manager.d.ts +166 -0
  59. package/dist/git/worktree.manager.d.ts.map +1 -0
  60. package/dist/git/worktree.manager.js +481 -0
  61. package/dist/git/worktree.manager.js.map +1 -0
  62. package/dist/index.d.ts +2 -0
  63. package/dist/index.d.ts.map +1 -0
  64. package/dist/index.js +37 -0
  65. package/dist/index.js.map +1 -0
  66. package/dist/mcp/context.d.ts +15 -0
  67. package/dist/mcp/context.d.ts.map +1 -0
  68. package/dist/mcp/context.js +19 -0
  69. package/dist/mcp/context.js.map +1 -0
  70. package/dist/mcp/http-client.d.ts +46 -0
  71. package/dist/mcp/http-client.d.ts.map +1 -0
  72. package/dist/mcp/http-client.js +100 -0
  73. package/dist/mcp/http-client.js.map +1 -0
  74. package/dist/mcp/index.d.ts +3 -0
  75. package/dist/mcp/index.d.ts.map +1 -0
  76. package/dist/mcp/index.js +36 -0
  77. package/dist/mcp/index.js.map +1 -0
  78. package/dist/mcp/server.d.ts +6 -0
  79. package/dist/mcp/server.d.ts.map +1 -0
  80. package/dist/mcp/server.js +32 -0
  81. package/dist/mcp/server.js.map +1 -0
  82. package/dist/mcp/tools/projects.d.ts +7 -0
  83. package/dist/mcp/tools/projects.d.ts.map +1 -0
  84. package/dist/mcp/tools/projects.js +12 -0
  85. package/dist/mcp/tools/projects.js.map +1 -0
  86. package/dist/mcp/tools/sessions.d.ts +7 -0
  87. package/dist/mcp/tools/sessions.d.ts.map +1 -0
  88. package/dist/mcp/tools/sessions.js +22 -0
  89. package/dist/mcp/tools/sessions.js.map +1 -0
  90. package/dist/mcp/tools/tasks.d.ts +7 -0
  91. package/dist/mcp/tools/tasks.d.ts.map +1 -0
  92. package/dist/mcp/tools/tasks.js +68 -0
  93. package/dist/mcp/tools/tasks.js.map +1 -0
  94. package/dist/mcp/tools/workspaces.d.ts +7 -0
  95. package/dist/mcp/tools/workspaces.d.ts.map +1 -0
  96. package/dist/mcp/tools/workspaces.js +45 -0
  97. package/dist/mcp/tools/workspaces.js.map +1 -0
  98. package/dist/mcp/types.d.ts +109 -0
  99. package/dist/mcp/types.d.ts.map +1 -0
  100. package/dist/mcp/types.js +55 -0
  101. package/dist/mcp/types.js.map +1 -0
  102. package/dist/middleware/tunnel-auth.d.ts +13 -0
  103. package/dist/middleware/tunnel-auth.d.ts.map +1 -0
  104. package/dist/middleware/tunnel-auth.js +39 -0
  105. package/dist/middleware/tunnel-auth.js.map +1 -0
  106. package/dist/output/__tests__/claude-code-parser-token.test.d.ts +2 -0
  107. package/dist/output/__tests__/claude-code-parser-token.test.d.ts.map +1 -0
  108. package/dist/output/__tests__/claude-code-parser-token.test.js +233 -0
  109. package/dist/output/__tests__/claude-code-parser-token.test.js.map +1 -0
  110. package/dist/output/__tests__/cursor-agent-parser-token.test.d.ts +2 -0
  111. package/dist/output/__tests__/cursor-agent-parser-token.test.d.ts.map +1 -0
  112. package/dist/output/__tests__/cursor-agent-parser-token.test.js +95 -0
  113. package/dist/output/__tests__/cursor-agent-parser-token.test.js.map +1 -0
  114. package/dist/output/__tests__/msg-store-token.test.d.ts +2 -0
  115. package/dist/output/__tests__/msg-store-token.test.d.ts.map +1 -0
  116. package/dist/output/__tests__/msg-store-token.test.js +38 -0
  117. package/dist/output/__tests__/msg-store-token.test.js.map +1 -0
  118. package/dist/output/claude-code-parser.d.ts +96 -0
  119. package/dist/output/claude-code-parser.d.ts.map +1 -0
  120. package/dist/output/claude-code-parser.js +498 -0
  121. package/dist/output/claude-code-parser.js.map +1 -0
  122. package/dist/output/cursor-agent-parser.d.ts +87 -0
  123. package/dist/output/cursor-agent-parser.d.ts.map +1 -0
  124. package/dist/output/cursor-agent-parser.js +476 -0
  125. package/dist/output/cursor-agent-parser.js.map +1 -0
  126. package/dist/output/index.d.ts +9 -0
  127. package/dist/output/index.d.ts.map +1 -0
  128. package/dist/output/index.js +13 -0
  129. package/dist/output/index.js.map +1 -0
  130. package/dist/output/msg-store.d.ts +110 -0
  131. package/dist/output/msg-store.d.ts.map +1 -0
  132. package/dist/output/msg-store.js +274 -0
  133. package/dist/output/msg-store.js.map +1 -0
  134. package/dist/output/types.d.ts +90 -0
  135. package/dist/output/types.d.ts.map +1 -0
  136. package/dist/output/types.js +93 -0
  137. package/dist/output/types.js.map +1 -0
  138. package/dist/output/utils/ansi.d.ts +8 -0
  139. package/dist/output/utils/ansi.d.ts.map +1 -0
  140. package/dist/output/utils/ansi.js +17 -0
  141. package/dist/output/utils/ansi.js.map +1 -0
  142. package/dist/output/utils/patch.d.ts +57 -0
  143. package/dist/output/utils/patch.d.ts.map +1 -0
  144. package/dist/output/utils/patch.js +113 -0
  145. package/dist/output/utils/patch.js.map +1 -0
  146. package/dist/pipeline/agent-pipeline.d.ts +28 -0
  147. package/dist/pipeline/agent-pipeline.d.ts.map +1 -0
  148. package/dist/pipeline/agent-pipeline.js +76 -0
  149. package/dist/pipeline/agent-pipeline.js.map +1 -0
  150. package/dist/routes/attachments.d.ts +3 -0
  151. package/dist/routes/attachments.d.ts.map +1 -0
  152. package/dist/routes/attachments.js +141 -0
  153. package/dist/routes/attachments.js.map +1 -0
  154. package/dist/routes/demo.d.ts +3 -0
  155. package/dist/routes/demo.d.ts.map +1 -0
  156. package/dist/routes/demo.js +152 -0
  157. package/dist/routes/demo.js.map +1 -0
  158. package/dist/routes/files.d.ts +3 -0
  159. package/dist/routes/files.d.ts.map +1 -0
  160. package/dist/routes/files.js +313 -0
  161. package/dist/routes/files.js.map +1 -0
  162. package/dist/routes/filesystem.d.ts +3 -0
  163. package/dist/routes/filesystem.d.ts.map +1 -0
  164. package/dist/routes/filesystem.js +126 -0
  165. package/dist/routes/filesystem.js.map +1 -0
  166. package/dist/routes/git.d.ts +3 -0
  167. package/dist/routes/git.d.ts.map +1 -0
  168. package/dist/routes/git.js +170 -0
  169. package/dist/routes/git.js.map +1 -0
  170. package/dist/routes/index.d.ts +3 -0
  171. package/dist/routes/index.d.ts.map +1 -0
  172. package/dist/routes/index.js +45 -0
  173. package/dist/routes/index.js.map +1 -0
  174. package/dist/routes/notifications.d.ts +10 -0
  175. package/dist/routes/notifications.d.ts.map +1 -0
  176. package/dist/routes/notifications.js +54 -0
  177. package/dist/routes/notifications.js.map +1 -0
  178. package/dist/routes/profiles.d.ts +12 -0
  179. package/dist/routes/profiles.d.ts.map +1 -0
  180. package/dist/routes/profiles.js +76 -0
  181. package/dist/routes/profiles.js.map +1 -0
  182. package/dist/routes/projects.d.ts +3 -0
  183. package/dist/routes/projects.d.ts.map +1 -0
  184. package/dist/routes/projects.js +94 -0
  185. package/dist/routes/projects.js.map +1 -0
  186. package/dist/routes/sessions.d.ts +12 -0
  187. package/dist/routes/sessions.d.ts.map +1 -0
  188. package/dist/routes/sessions.js +109 -0
  189. package/dist/routes/sessions.js.map +1 -0
  190. package/dist/routes/system.d.ts +3 -0
  191. package/dist/routes/system.d.ts.map +1 -0
  192. package/dist/routes/system.js +42 -0
  193. package/dist/routes/system.js.map +1 -0
  194. package/dist/routes/tasks.d.ts +3 -0
  195. package/dist/routes/tasks.d.ts.map +1 -0
  196. package/dist/routes/tasks.js +136 -0
  197. package/dist/routes/tasks.js.map +1 -0
  198. package/dist/routes/terminals.d.ts +3 -0
  199. package/dist/routes/terminals.d.ts.map +1 -0
  200. package/dist/routes/terminals.js +54 -0
  201. package/dist/routes/terminals.js.map +1 -0
  202. package/dist/routes/tunnel.d.ts +3 -0
  203. package/dist/routes/tunnel.d.ts.map +1 -0
  204. package/dist/routes/tunnel.js +36 -0
  205. package/dist/routes/tunnel.js.map +1 -0
  206. package/dist/routes/workspaces.d.ts +3 -0
  207. package/dist/routes/workspaces.d.ts.map +1 -0
  208. package/dist/routes/workspaces.js +171 -0
  209. package/dist/routes/workspaces.js.map +1 -0
  210. package/dist/services/commit-message.service.d.ts +32 -0
  211. package/dist/services/commit-message.service.d.ts.map +1 -0
  212. package/dist/services/commit-message.service.js +202 -0
  213. package/dist/services/commit-message.service.js.map +1 -0
  214. package/dist/services/notifications/feishu-channel.d.ts +9 -0
  215. package/dist/services/notifications/feishu-channel.d.ts.map +1 -0
  216. package/dist/services/notifications/feishu-channel.js +51 -0
  217. package/dist/services/notifications/feishu-channel.js.map +1 -0
  218. package/dist/services/notifications/index.d.ts +3 -0
  219. package/dist/services/notifications/index.d.ts.map +1 -0
  220. package/dist/services/notifications/index.js +2 -0
  221. package/dist/services/notifications/index.js.map +1 -0
  222. package/dist/services/notifications/notification.service.d.ts +10 -0
  223. package/dist/services/notifications/notification.service.d.ts.map +1 -0
  224. package/dist/services/notifications/notification.service.js +85 -0
  225. package/dist/services/notifications/notification.service.js.map +1 -0
  226. package/dist/services/notifications/os-channel.d.ts +8 -0
  227. package/dist/services/notifications/os-channel.d.ts.map +1 -0
  228. package/dist/services/notifications/os-channel.js +38 -0
  229. package/dist/services/notifications/os-channel.js.map +1 -0
  230. package/dist/services/notifications/types.d.ts +11 -0
  231. package/dist/services/notifications/types.d.ts.map +1 -0
  232. package/dist/services/notifications/types.js +2 -0
  233. package/dist/services/notifications/types.js.map +1 -0
  234. package/dist/services/project.service.d.ts +91 -0
  235. package/dist/services/project.service.d.ts.map +1 -0
  236. package/dist/services/project.service.js +138 -0
  237. package/dist/services/project.service.js.map +1 -0
  238. package/dist/services/session-manager.d.ts +164 -0
  239. package/dist/services/session-manager.d.ts.map +1 -0
  240. package/dist/services/session-manager.js +569 -0
  241. package/dist/services/session-manager.js.map +1 -0
  242. package/dist/services/task.service.d.ts +179 -0
  243. package/dist/services/task.service.d.ts.map +1 -0
  244. package/dist/services/task.service.js +281 -0
  245. package/dist/services/task.service.js.map +1 -0
  246. package/dist/services/terminal-manager.d.ts +64 -0
  247. package/dist/services/terminal-manager.d.ts.map +1 -0
  248. package/dist/services/terminal-manager.js +217 -0
  249. package/dist/services/terminal-manager.js.map +1 -0
  250. package/dist/services/tunnel.service.d.ts +16 -0
  251. package/dist/services/tunnel.service.d.ts.map +1 -0
  252. package/dist/services/tunnel.service.js +77 -0
  253. package/dist/services/tunnel.service.js.map +1 -0
  254. package/dist/services/workspace.service.d.ts +219 -0
  255. package/dist/services/workspace.service.d.ts.map +1 -0
  256. package/dist/services/workspace.service.js +351 -0
  257. package/dist/services/workspace.service.js.map +1 -0
  258. package/dist/socket/events.d.ts +2 -0
  259. package/dist/socket/events.d.ts.map +1 -0
  260. package/dist/socket/events.js +3 -0
  261. package/dist/socket/events.js.map +1 -0
  262. package/dist/socket/index.d.ts +20 -0
  263. package/dist/socket/index.d.ts.map +1 -0
  264. package/dist/socket/index.js +77 -0
  265. package/dist/socket/index.js.map +1 -0
  266. package/dist/socket/middleware/auth.d.ts +13 -0
  267. package/dist/socket/middleware/auth.d.ts.map +1 -0
  268. package/dist/socket/middleware/auth.js +29 -0
  269. package/dist/socket/middleware/auth.js.map +1 -0
  270. package/dist/socket/middleware/error-handler.d.ts +11 -0
  271. package/dist/socket/middleware/error-handler.d.ts.map +1 -0
  272. package/dist/socket/middleware/error-handler.js +39 -0
  273. package/dist/socket/middleware/error-handler.js.map +1 -0
  274. package/dist/socket/middleware/index.d.ts +3 -0
  275. package/dist/socket/middleware/index.d.ts.map +1 -0
  276. package/dist/socket/middleware/index.js +3 -0
  277. package/dist/socket/middleware/index.js.map +1 -0
  278. package/dist/socket/rooms.d.ts +30 -0
  279. package/dist/socket/rooms.d.ts.map +1 -0
  280. package/dist/socket/rooms.js +39 -0
  281. package/dist/socket/rooms.js.map +1 -0
  282. package/dist/socket/socket-gateway.d.ts +21 -0
  283. package/dist/socket/socket-gateway.d.ts.map +1 -0
  284. package/dist/socket/socket-gateway.js +173 -0
  285. package/dist/socket/socket-gateway.js.map +1 -0
  286. package/dist/types/index.d.ts +41 -0
  287. package/dist/types/index.d.ts.map +1 -0
  288. package/dist/types/index.js +41 -0
  289. package/dist/types/index.js.map +1 -0
  290. package/dist/utils/index.d.ts +12 -0
  291. package/dist/utils/index.d.ts.map +1 -0
  292. package/dist/utils/index.js +25 -0
  293. package/dist/utils/index.js.map +1 -0
  294. package/dist/web/assets/AgentDemoPage-WdWEQtyU.js +1 -0
  295. package/dist/web/assets/DemoPage-C4Z_ftHI.js +4 -0
  296. package/dist/web/assets/NotificationSettingsPage-FrLfgt9y.js +1 -0
  297. package/dist/web/assets/ProfileSettingsPage-Cs93rTRr.js +3 -0
  298. package/dist/web/assets/ProjectKanbanPage-BmlRVfzo.js +75 -0
  299. package/dist/web/assets/ProjectKanbanPage-G5OQeJvU.css +1 -0
  300. package/dist/web/assets/api-client-CEBkg5lt.js +1 -0
  301. package/dist/web/assets/circle-alert-BEozlsMd.js +1 -0
  302. package/dist/web/assets/code-block-OCS4YCEC-CGgYYS4A.js +2 -0
  303. package/dist/web/assets/folder-picker-BP3x3phB.js +1 -0
  304. package/dist/web/assets/index-BuAijQvi.js +13 -0
  305. package/dist/web/assets/index-CxV866Yg.css +1 -0
  306. package/dist/web/assets/loader-circle-yEIqsdJ1.js +1 -0
  307. package/dist/web/assets/mermaid-NOHMQCX5-CIqtI2jF.js +123 -0
  308. package/dist/web/assets/mermaid-NOHMQCX5-lI9o3AWT.css +1 -0
  309. package/dist/web/assets/modal-BoX2RXaV.js +1 -0
  310. package/dist/web/assets/query-keys-BD_s_Etj.js +1 -0
  311. package/dist/web/assets/use-profiles-Rh8rBsAt.js +1 -0
  312. package/dist/web/index.html +14 -0
  313. package/dist/web/vite.svg +1 -0
  314. package/node_modules/@agent-tower/shared/dist/dev-port.d.ts +12 -0
  315. package/node_modules/@agent-tower/shared/dist/dev-port.d.ts.map +1 -0
  316. package/node_modules/@agent-tower/shared/dist/dev-port.js +31 -0
  317. package/node_modules/@agent-tower/shared/dist/dev-port.js.map +1 -0
  318. package/node_modules/@agent-tower/shared/dist/index.d.ts +5 -0
  319. package/node_modules/@agent-tower/shared/dist/index.d.ts.map +1 -0
  320. package/node_modules/@agent-tower/shared/dist/index.js +5 -0
  321. package/node_modules/@agent-tower/shared/dist/index.js.map +1 -0
  322. package/node_modules/@agent-tower/shared/dist/log-adapter.d.ts +72 -0
  323. package/node_modules/@agent-tower/shared/dist/log-adapter.d.ts.map +1 -0
  324. package/node_modules/@agent-tower/shared/dist/log-adapter.js +144 -0
  325. package/node_modules/@agent-tower/shared/dist/log-adapter.js.map +1 -0
  326. package/node_modules/@agent-tower/shared/dist/socket/events.d.ts +133 -0
  327. package/node_modules/@agent-tower/shared/dist/socket/events.d.ts.map +1 -0
  328. package/node_modules/@agent-tower/shared/dist/socket/events.js +32 -0
  329. package/node_modules/@agent-tower/shared/dist/socket/events.js.map +1 -0
  330. package/node_modules/@agent-tower/shared/dist/socket/index.d.ts +2 -0
  331. package/node_modules/@agent-tower/shared/dist/socket/index.d.ts.map +1 -0
  332. package/node_modules/@agent-tower/shared/dist/socket/index.js +2 -0
  333. package/node_modules/@agent-tower/shared/dist/socket/index.js.map +1 -0
  334. package/node_modules/@agent-tower/shared/dist/types.d.ts +168 -0
  335. package/node_modules/@agent-tower/shared/dist/types.d.ts.map +1 -0
  336. package/node_modules/@agent-tower/shared/dist/types.js +53 -0
  337. package/node_modules/@agent-tower/shared/dist/types.js.map +1 -0
  338. package/node_modules/@agent-tower/shared/package.json +38 -0
  339. package/package.json +46 -0
  340. package/prisma/schema.prisma +130 -0
  341. package/scripts/postinstall.js +120 -0
@@ -0,0 +1,100 @@
1
+ /**
2
+ * agent-tower 后端 API HTTP 客户端
3
+ * MCP 服务器通过此客户端代理调用后端 REST API
4
+ */
5
+ export class AgentTowerClient {
6
+ baseUrl;
7
+ constructor(baseUrl) {
8
+ this.baseUrl = baseUrl;
9
+ }
10
+ url(path) {
11
+ return `${this.baseUrl.replace(/\/+$/, '')}/${path.replace(/^\/+/, '')}`;
12
+ }
13
+ async request(method, path, body, query) {
14
+ let url = this.url(path);
15
+ if (query) {
16
+ const params = new URLSearchParams(query);
17
+ url += `?${params.toString()}`;
18
+ }
19
+ const resp = await fetch(url, {
20
+ method,
21
+ headers: body ? { 'Content-Type': 'application/json' } : undefined,
22
+ body: body ? JSON.stringify(body) : undefined,
23
+ });
24
+ if (!resp.ok) {
25
+ const text = await resp.text().catch(() => '');
26
+ throw new Error(`API ${method} ${path} failed (${resp.status}): ${text}`);
27
+ }
28
+ // 204 No Content
29
+ if (resp.status === 204)
30
+ return undefined;
31
+ return resp.json();
32
+ }
33
+ // ── Projects ──
34
+ async listProjects(params) {
35
+ const query = {};
36
+ if (params?.page)
37
+ query.page = String(params.page);
38
+ if (params?.limit)
39
+ query.limit = String(params.limit);
40
+ return this.request('GET', '/api/projects', undefined, query);
41
+ }
42
+ // ── Tasks ──
43
+ async listTasks(projectId, params) {
44
+ const query = {};
45
+ if (params?.status)
46
+ query.status = params.status;
47
+ if (params?.limit)
48
+ query.limit = String(params.limit);
49
+ if (params?.page)
50
+ query.page = String(params.page);
51
+ return this.request('GET', `/api/projects/${projectId}/tasks`, undefined, query);
52
+ }
53
+ async createTask(projectId, input) {
54
+ return this.request('POST', `/api/projects/${projectId}/tasks`, input);
55
+ }
56
+ async getTask(taskId) {
57
+ return this.request('GET', `/api/tasks/${taskId}`);
58
+ }
59
+ async updateTask(taskId, input) {
60
+ return this.request('PUT', `/api/tasks/${taskId}`, input);
61
+ }
62
+ async updateTaskStatus(taskId, status) {
63
+ return this.request('PATCH', `/api/tasks/${taskId}/status`, { status });
64
+ }
65
+ async deleteTask(taskId) {
66
+ return this.request('DELETE', `/api/tasks/${taskId}`);
67
+ }
68
+ // ── Workspaces ──
69
+ async createWorkspace(taskId, branchName) {
70
+ return this.request('POST', `/api/tasks/${taskId}/workspaces`, branchName ? { branchName } : {});
71
+ }
72
+ async getWorkspaceDiff(workspaceId) {
73
+ return this.request('GET', `/api/workspaces/${workspaceId}/diff`);
74
+ }
75
+ async mergeWorkspace(workspaceId) {
76
+ return this.request('POST', `/api/workspaces/${workspaceId}/merge`);
77
+ }
78
+ // ── Sessions ──
79
+ async createSession(workspaceId, agentType, prompt, variant) {
80
+ return this.request('POST', `/api/workspaces/${workspaceId}/sessions`, {
81
+ agentType,
82
+ prompt,
83
+ ...(variant ? { variant } : {}),
84
+ });
85
+ }
86
+ async startSession(sessionId) {
87
+ return this.request('POST', `/api/sessions/${sessionId}/start`);
88
+ }
89
+ async stopSession(sessionId) {
90
+ return this.request('POST', `/api/sessions/${sessionId}/stop`);
91
+ }
92
+ async sendMessage(sessionId, message) {
93
+ return this.request('POST', `/api/sessions/${sessionId}/message`, { message });
94
+ }
95
+ // ── System ──
96
+ async getWorkspaceContext(cwdPath) {
97
+ return this.request('GET', '/api/system/workspace-context', undefined, { path: cwdPath });
98
+ }
99
+ }
100
+ //# sourceMappingURL=http-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-client.js","sourceRoot":"","sources":["../../src/mcp/http-client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,OAAO,gBAAgB;IACP;IAApB,YAAoB,OAAe;QAAf,YAAO,GAAP,OAAO,CAAQ;IAAG,CAAC;IAE/B,GAAG,CAAC,IAAY;QACtB,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAA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tE,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,SAAiB,EAAE,OAAe;QAClD,OAAO,IAAI,CAAC,OAAO,CAAM,MAAM,EAAE,iBAAiB,SAAS,UAAU,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IACtF,CAAC;IAED,eAAe;IAEf,KAAK,CAAC,mBAAmB,CAAC,OAAe;QACvC,OAAO,IAAI,CAAC,OAAO,CAAM,KAAK,EAAE,+BAA+B,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IACjG,CAAC;CACF"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * agent-tower MCP 服务器入口
4
+ * 通过 stdio 传输与 MCP 客户端通信,代理调用 agent-tower 后端 API
5
+ */
6
+ import path from 'node:path';
7
+ import { fileURLToPath } from 'node:url';
8
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
9
+ import { createMcpServer } from './server.js';
10
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
11
+ async function main() {
12
+ // 按优先级确定后端 URL
13
+ let port = process.env.AGENT_TOWER_PORT ?? 12580;
14
+ // 开发模式: 尝试从 monorepo 路径计算确定性端口
15
+ if (!process.env.AGENT_TOWER_PORT && !process.env.AGENT_TOWER_URL) {
16
+ try {
17
+ const monorepoRoot = path.resolve(__dirname, '../../..');
18
+ const { getDevPort } = await import('@agent-tower/shared/dev-port');
19
+ port = getDevPort(monorepoRoot);
20
+ }
21
+ catch {
22
+ // 非 monorepo 环境(npm 全局安装),使用默认端口
23
+ }
24
+ }
25
+ const baseUrl = process.env.AGENT_TOWER_URL ?? `http://127.0.0.1:${port}`;
26
+ console.error(`[agent-tower-mcp] Connecting to backend at ${baseUrl}`);
27
+ const server = await createMcpServer(baseUrl);
28
+ const transport = new StdioServerTransport();
29
+ await server.connect(transport);
30
+ console.error('[agent-tower-mcp] MCP server started (stdio)');
31
+ }
32
+ main().catch((err) => {
33
+ console.error('[agent-tower-mcp] Fatal error:', err);
34
+ process.exit(1);
35
+ });
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":";AACA;;;GAGG;AACH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE/D,KAAK,UAAU,IAAI;IACjB,eAAe;IACf,IAAI,IAAI,GAAoB,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,KAAK,CAAC;IAClE,+BAA+B;IAC/B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC;QAClE,IAAI,CAAC;YACH,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;YACzD,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,MAAM,CAAC,8BAA8B,CAAC,CAAC;YACpE,IAAI,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;QAClC,CAAC;QAAC,MAAM,CAAC;YACP,iCAAiC;QACnC,CAAC;IACH,CAAC;IACD,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,oBAAoB,IAAI,EAAE,CAAC;IAE1E,OAAO,CAAC,KAAK,CAAC,8CAA8C,OAAO,EAAE,CAAC,CAAC;IAEvE,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,OAAO,CAAC,CAAC;IAC9C,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,OAAO,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAAC;AAChE,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAE,GAAG,CAAC,CAAC;IACrD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * MCP 服务器创建与 tool 注册
3
+ */
4
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
5
+ export declare function createMcpServer(baseUrl: string): Promise<McpServer>;
6
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAQpE,wBAAsB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CA6BzE"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * MCP 服务器创建与 tool 注册
3
+ */
4
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
5
+ import { AgentTowerClient } from './http-client.js';
6
+ import { fetchContext } from './context.js';
7
+ import { registerProjectTools } from './tools/projects.js';
8
+ import { registerTaskTools } from './tools/tasks.js';
9
+ import { registerWorkspaceTools } from './tools/workspaces.js';
10
+ import { registerSessionTools } from './tools/sessions.js';
11
+ export async function createMcpServer(baseUrl) {
12
+ const client = new AgentTowerClient(baseUrl);
13
+ const context = await fetchContext(client);
14
+ const server = new McpServer({
15
+ name: 'agent-tower',
16
+ version: '0.1.0',
17
+ });
18
+ // 注册所有 tools
19
+ registerProjectTools(server, client);
20
+ registerTaskTools(server, client);
21
+ registerWorkspaceTools(server, client);
22
+ registerSessionTools(server, client);
23
+ // 条件注册 get_context(仅当检测到工作空间上下文时)
24
+ if (context) {
25
+ server.tool('get_context', 'Get workspace context for the current directory (project, task, workspace info).', {}, async () => {
26
+ return { content: [{ type: 'text', text: JSON.stringify(context, null, 2) }] };
27
+ });
28
+ console.error(`[agent-tower-mcp] Context loaded: project=${context.projectName}, task=${context.taskTitle}`);
29
+ }
30
+ return server;
31
+ }
32
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAmB,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,OAAe;IACnD,MAAM,MAAM,GAAG,IAAI,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAC7C,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,MAAM,CAAC,CAAC;IAE3C,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;QAC3B,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,OAAO;KACjB,CAAC,CAAC;IAEH,aAAa;IACb,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,sBAAsB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAErC,kCAAkC;IAClC,IAAI,OAAO,EAAE,CAAC;QACZ,MAAM,CAAC,IAAI,CACT,aAAa,EACb,kFAAkF,EAClF,EAAE,EACF,KAAK,IAAI,EAAE;YACT,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;QACjF,CAAC,CACF,CAAC;QACF,OAAO,CAAC,KAAK,CAAC,6CAA6C,OAAO,CAAC,WAAW,UAAU,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;IAC/G,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * 项目相关 MCP tools
3
+ */
4
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
5
+ import type { AgentTowerClient } from '../http-client.js';
6
+ export declare function registerProjectTools(server: McpServer, client: AgentTowerClient): void;
7
+ //# sourceMappingURL=projects.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projects.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/projects.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,gBAAgB,QAc/E"}
@@ -0,0 +1,12 @@
1
+ export function registerProjectTools(server, client) {
2
+ server.tool('list_projects', 'List all projects', {}, async () => {
3
+ try {
4
+ const result = await client.listProjects();
5
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
6
+ }
7
+ catch (e) {
8
+ return { content: [{ type: 'text', text: `Error: ${e.message}` }], isError: true };
9
+ }
10
+ });
11
+ }
12
+ //# sourceMappingURL=projects.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projects.js","sourceRoot":"","sources":["../../../src/mcp/tools/projects.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,oBAAoB,CAAC,MAAiB,EAAE,MAAwB;IAC9E,MAAM,CAAC,IAAI,CACT,eAAe,EACf,mBAAmB,EACnB,EAAE,EACF,KAAK,IAAI,EAAE;QACT,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,YAAY,EAAE,CAAC;YAC3C,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;QAChF,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QACrF,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * 会话相关 MCP tools
3
+ */
4
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
5
+ import type { AgentTowerClient } from '../http-client.js';
6
+ export declare function registerSessionTools(server: McpServer, client: AgentTowerClient): void;
7
+ //# sourceMappingURL=sessions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sessions.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/sessions.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG1D,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,gBAAgB,QA4B/E"}
@@ -0,0 +1,22 @@
1
+ import { StopSessionInput, SendMessageInput } from '../types.js';
2
+ export function registerSessionTools(server, client) {
3
+ server.tool('stop_session', 'Stop a running AI agent session.', StopSessionInput.shape, async (params) => {
4
+ try {
5
+ await client.stopSession(params.session_id);
6
+ return { content: [{ type: 'text', text: JSON.stringify({ success: true }, null, 2) }] };
7
+ }
8
+ catch (e) {
9
+ return { content: [{ type: 'text', text: `Error: ${e.message}` }], isError: true };
10
+ }
11
+ });
12
+ server.tool('send_message', 'Send a message to a running or completed AI agent session.', SendMessageInput.shape, async (params) => {
13
+ try {
14
+ await client.sendMessage(params.session_id, params.message);
15
+ return { content: [{ type: 'text', text: JSON.stringify({ success: true }, null, 2) }] };
16
+ }
17
+ catch (e) {
18
+ return { content: [{ type: 'text', text: `Error: ${e.message}` }], isError: true };
19
+ }
20
+ });
21
+ }
22
+ //# sourceMappingURL=sessions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sessions.js","sourceRoot":"","sources":["../../../src/mcp/tools/sessions.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEjE,MAAM,UAAU,oBAAoB,CAAC,MAAiB,EAAE,MAAwB;IAC9E,MAAM,CAAC,IAAI,CACT,cAAc,EACd,kCAAkC,EAClC,gBAAgB,CAAC,KAAK,EACtB,KAAK,EAAE,MAAM,EAAE,EAAE;QACf,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;YAC5C,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;QAC3F,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QACrF,CAAC;IACH,CAAC,CACF,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,cAAc,EACd,4DAA4D,EAC5D,gBAAgB,CAAC,KAAK,EACtB,KAAK,EAAE,MAAM,EAAE,EAAE;QACf,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;YAC5D,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;QAC3F,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QACrF,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * 任务相关 MCP tools
3
+ */
4
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
5
+ import type { AgentTowerClient } from '../http-client.js';
6
+ export declare function registerTaskTools(server: McpServer, client: AgentTowerClient): void;
7
+ //# sourceMappingURL=tasks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/tasks.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAS1D,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,gBAAgB,QAyF5E"}
@@ -0,0 +1,68 @@
1
+ import { ListTasksInput, CreateTaskInput, GetTaskInput, UpdateTaskInput, DeleteTaskInput, } from '../types.js';
2
+ export function registerTaskTools(server, client) {
3
+ server.tool('list_tasks', 'List tasks in a project with optional status filter. `project_id` is required!', ListTasksInput.shape, async (params) => {
4
+ try {
5
+ const result = await client.listTasks(params.project_id, {
6
+ status: params.status,
7
+ limit: params.limit,
8
+ });
9
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
10
+ }
11
+ catch (e) {
12
+ return { content: [{ type: 'text', text: `Error: ${e.message}` }], isError: true };
13
+ }
14
+ });
15
+ server.tool('create_task', 'Create a new task in a project. `project_id` is required!', CreateTaskInput.shape, async (params) => {
16
+ try {
17
+ const task = await client.createTask(params.project_id, {
18
+ title: params.title,
19
+ description: params.description,
20
+ });
21
+ return { content: [{ type: 'text', text: JSON.stringify(task, null, 2) }] };
22
+ }
23
+ catch (e) {
24
+ return { content: [{ type: 'text', text: `Error: ${e.message}` }], isError: true };
25
+ }
26
+ });
27
+ server.tool('get_task', 'Get detailed information about a specific task. `task_id` is required.', GetTaskInput.shape, async (params) => {
28
+ try {
29
+ const task = await client.getTask(params.task_id);
30
+ return { content: [{ type: 'text', text: JSON.stringify(task, null, 2) }] };
31
+ }
32
+ catch (e) {
33
+ return { content: [{ type: 'text', text: `Error: ${e.message}` }], isError: true };
34
+ }
35
+ });
36
+ server.tool('update_task', "Update a task's title, description, or status. `task_id` is required.", UpdateTaskInput.shape, async (params) => {
37
+ try {
38
+ const { task_id, status, ...fields } = params;
39
+ // 更新字段(title/description)
40
+ const hasFields = fields.title !== undefined || fields.description !== undefined;
41
+ let result;
42
+ if (hasFields) {
43
+ result = await client.updateTask(task_id, fields);
44
+ }
45
+ // 更新状态
46
+ if (status) {
47
+ result = await client.updateTaskStatus(task_id, status);
48
+ }
49
+ if (!result) {
50
+ result = await client.getTask(task_id);
51
+ }
52
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
53
+ }
54
+ catch (e) {
55
+ return { content: [{ type: 'text', text: `Error: ${e.message}` }], isError: true };
56
+ }
57
+ });
58
+ server.tool('delete_task', 'Delete a task. `task_id` is required.', DeleteTaskInput.shape, async (params) => {
59
+ try {
60
+ await client.deleteTask(params.task_id);
61
+ return { content: [{ type: 'text', text: JSON.stringify({ deleted_task_id: params.task_id }, null, 2) }] };
62
+ }
63
+ catch (e) {
64
+ return { content: [{ type: 'text', text: `Error: ${e.message}` }], isError: true };
65
+ }
66
+ });
67
+ }
68
+ //# sourceMappingURL=tasks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tasks.js","sourceRoot":"","sources":["../../../src/mcp/tools/tasks.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,cAAc,EACd,eAAe,EACf,YAAY,EACZ,eAAe,EACf,eAAe,GAChB,MAAM,aAAa,CAAC;AAErB,MAAM,UAAU,iBAAiB,CAAC,MAAiB,EAAE,MAAwB;IAC3E,MAAM,CAAC,IAAI,CACT,YAAY,EACZ,gFAAgF,EAChF,cAAc,CAAC,KAAK,EACpB,KAAK,EAAE,MAAM,EAAE,EAAE;QACf,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,EAAE;gBACvD,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,KAAK,EAAE,MAAM,CAAC,KAAK;aACpB,CAAC,CAAC;YACH,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE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AAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;QAChF,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QACrF,CAAC;IACH,CAAC,CACF,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,aAAa,EACb,uCAAuC,EACvC,eAAe,CAAC,KAAK,EACrB,KAAK,EAAE,MAAM,EAAE,EAAE;QACf,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YACxC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,eAAe,EAAE,MAAM,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;QAC7G,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QACrF,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * 工作空间相关 MCP tools
3
+ */
4
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
5
+ import type { AgentTowerClient } from '../http-client.js';
6
+ export declare function registerWorkspaceTools(server: McpServer, client: AgentTowerClient): void;
7
+ //# sourceMappingURL=workspaces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspaces.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/workspaces.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAO1D,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,gBAAgB,QA6DjF"}
@@ -0,0 +1,45 @@
1
+ import { StartWorkspaceSessionInput, GetWorkspaceDiffInput, MergeWorkspaceInput, } from '../types.js';
2
+ export function registerWorkspaceTools(server, client) {
3
+ server.tool('start_workspace_session', 'Create a workspace and start an AI agent session for a task.', StartWorkspaceSessionInput.shape, async (params) => {
4
+ try {
5
+ // 1. 创建工作空间
6
+ const workspace = await client.createWorkspace(params.task_id);
7
+ // 2. 创建会话
8
+ const session = await client.createSession(workspace.id, params.agent_type, params.prompt, params.variant);
9
+ // 3. 启动会话
10
+ await client.startSession(session.id);
11
+ return {
12
+ content: [{
13
+ type: 'text',
14
+ text: JSON.stringify({
15
+ task_id: params.task_id,
16
+ workspace_id: workspace.id,
17
+ session_id: session.id,
18
+ }, null, 2),
19
+ }],
20
+ };
21
+ }
22
+ catch (e) {
23
+ return { content: [{ type: 'text', text: `Error: ${e.message}` }], isError: true };
24
+ }
25
+ });
26
+ server.tool('get_workspace_diff', 'Get the code diff for a workspace.', GetWorkspaceDiffInput.shape, async (params) => {
27
+ try {
28
+ const result = await client.getWorkspaceDiff(params.workspace_id);
29
+ return { content: [{ type: 'text', text: result.diff || '(no changes)' }] };
30
+ }
31
+ catch (e) {
32
+ return { content: [{ type: 'text', text: `Error: ${e.message}` }], isError: true };
33
+ }
34
+ });
35
+ server.tool('merge_workspace', 'Merge a workspace branch into the main branch.', MergeWorkspaceInput.shape, async (params) => {
36
+ try {
37
+ const result = await client.mergeWorkspace(params.workspace_id);
38
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
39
+ }
40
+ catch (e) {
41
+ return { content: [{ type: 'text', text: `Error: ${e.message}` }], isError: true };
42
+ }
43
+ });
44
+ }
45
+ //# sourceMappingURL=workspaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspaces.js","sourceRoot":"","sources":["../../../src/mcp/tools/workspaces.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,0BAA0B,EAC1B,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,aAAa,CAAC;AAErB,MAAM,UAAU,sBAAsB,CAAC,MAAiB,EAAE,MAAwB;IAChF,MAAM,CAAC,IAAI,CACT,yBAAyB,EACzB,8DAA8D,EAC9D,0BAA0B,CAAC,KAAK,EAChC,KAAK,EAAE,MAAM,EAAE,EAAE;QACf,IAAI,CAAC;YACH,YAAY;YACZ,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAC/D,UAAU;YACV,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,aAAa,CACxC,SAAS,CAAC,EAAE,EACZ,MAAM,CAAC,UAAU,EACjB,MAAM,CAAC,MAAM,EACb,MAAM,CAAC,OAAO,CACf,CAAC;YACF,UAAU;YACV,MAAM,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YACtC,OAAO;gBACL,OAAO,EAAE,CAAC;wBACR,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;4BACnB,OAAO,EAAE,MAAM,CAAC,OAAO;4BACvB,YAAY,EAAE,SAAS,CAAC,EAAE;4BAC1B,UAAU,EAAE,OAAO,CAAC,EAAE;yBACvB,EAAE,IAAI,EAAE,CAAC,CAAC;qBACZ,CAAC;aACH,CAAC;QACJ,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QACrF,CAAC;IAC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,0 +1,109 @@
1
+ /**
2
+ * MCP tool 输入参数的 Zod schema 定义
3
+ */
4
+ import { z } from 'zod';
5
+ export declare const ListProjectsInput: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
6
+ export declare const ListTasksInput: z.ZodObject<{
7
+ project_id: z.ZodString;
8
+ status: z.ZodOptional<z.ZodEnum<["TODO", "IN_PROGRESS", "IN_REVIEW", "DONE", "CANCELLED"]>>;
9
+ limit: z.ZodOptional<z.ZodNumber>;
10
+ }, "strip", z.ZodTypeAny, {
11
+ project_id: string;
12
+ limit?: number | undefined;
13
+ status?: "TODO" | "IN_PROGRESS" | "IN_REVIEW" | "DONE" | "CANCELLED" | undefined;
14
+ }, {
15
+ project_id: string;
16
+ limit?: number | undefined;
17
+ status?: "TODO" | "IN_PROGRESS" | "IN_REVIEW" | "DONE" | "CANCELLED" | undefined;
18
+ }>;
19
+ export declare const CreateTaskInput: z.ZodObject<{
20
+ project_id: z.ZodString;
21
+ title: z.ZodString;
22
+ description: z.ZodOptional<z.ZodString>;
23
+ }, "strip", z.ZodTypeAny, {
24
+ title: string;
25
+ project_id: string;
26
+ description?: string | undefined;
27
+ }, {
28
+ title: string;
29
+ project_id: string;
30
+ description?: string | undefined;
31
+ }>;
32
+ export declare const GetTaskInput: z.ZodObject<{
33
+ task_id: z.ZodString;
34
+ }, "strip", z.ZodTypeAny, {
35
+ task_id: string;
36
+ }, {
37
+ task_id: string;
38
+ }>;
39
+ export declare const UpdateTaskInput: z.ZodObject<{
40
+ task_id: z.ZodString;
41
+ title: z.ZodOptional<z.ZodString>;
42
+ description: z.ZodOptional<z.ZodString>;
43
+ status: z.ZodOptional<z.ZodEnum<["TODO", "IN_PROGRESS", "IN_REVIEW", "DONE", "CANCELLED"]>>;
44
+ }, "strip", z.ZodTypeAny, {
45
+ task_id: string;
46
+ description?: string | undefined;
47
+ title?: string | undefined;
48
+ status?: "TODO" | "IN_PROGRESS" | "IN_REVIEW" | "DONE" | "CANCELLED" | undefined;
49
+ }, {
50
+ task_id: string;
51
+ description?: string | undefined;
52
+ title?: string | undefined;
53
+ status?: "TODO" | "IN_PROGRESS" | "IN_REVIEW" | "DONE" | "CANCELLED" | undefined;
54
+ }>;
55
+ export declare const DeleteTaskInput: z.ZodObject<{
56
+ task_id: z.ZodString;
57
+ }, "strip", z.ZodTypeAny, {
58
+ task_id: string;
59
+ }, {
60
+ task_id: string;
61
+ }>;
62
+ export declare const StartWorkspaceSessionInput: z.ZodObject<{
63
+ task_id: z.ZodString;
64
+ agent_type: z.ZodEnum<["CLAUDE_CODE", "GEMINI_CLI", "CURSOR_AGENT"]>;
65
+ prompt: z.ZodString;
66
+ variant: z.ZodOptional<z.ZodString>;
67
+ }, "strip", z.ZodTypeAny, {
68
+ prompt: string;
69
+ task_id: string;
70
+ agent_type: "CLAUDE_CODE" | "GEMINI_CLI" | "CURSOR_AGENT";
71
+ variant?: string | undefined;
72
+ }, {
73
+ prompt: string;
74
+ task_id: string;
75
+ agent_type: "CLAUDE_CODE" | "GEMINI_CLI" | "CURSOR_AGENT";
76
+ variant?: string | undefined;
77
+ }>;
78
+ export declare const GetWorkspaceDiffInput: z.ZodObject<{
79
+ workspace_id: z.ZodString;
80
+ }, "strip", z.ZodTypeAny, {
81
+ workspace_id: string;
82
+ }, {
83
+ workspace_id: string;
84
+ }>;
85
+ export declare const MergeWorkspaceInput: z.ZodObject<{
86
+ workspace_id: z.ZodString;
87
+ }, "strip", z.ZodTypeAny, {
88
+ workspace_id: string;
89
+ }, {
90
+ workspace_id: string;
91
+ }>;
92
+ export declare const StopSessionInput: z.ZodObject<{
93
+ session_id: z.ZodString;
94
+ }, "strip", z.ZodTypeAny, {
95
+ session_id: string;
96
+ }, {
97
+ session_id: string;
98
+ }>;
99
+ export declare const SendMessageInput: z.ZodObject<{
100
+ session_id: z.ZodString;
101
+ message: z.ZodString;
102
+ }, "strip", z.ZodTypeAny, {
103
+ message: string;
104
+ session_id: string;
105
+ }, {
106
+ message: string;
107
+ session_id: string;
108
+ }>;
109
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/mcp/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,iBAAiB,gDAAe,CAAC;AAI9C,eAAO,MAAM,cAAc;;;;;;;;;;;;EAMzB,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;EAI1B,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;EAEvB,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;EAM1B,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;EAE1B,CAAC;AAIH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;EAMrC,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;EAEhC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;EAE9B,CAAC;AAIH,eAAO,MAAM,gBAAgB;;;;;;EAE3B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;EAG3B,CAAC"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * MCP tool 输入参数的 Zod schema 定义
3
+ */
4
+ import { z } from 'zod';
5
+ // ── Projects ──
6
+ export const ListProjectsInput = z.object({});
7
+ // ── Tasks ──
8
+ export const ListTasksInput = z.object({
9
+ project_id: z.string().describe('The ID of the project to list tasks from'),
10
+ status: z.enum(['TODO', 'IN_PROGRESS', 'IN_REVIEW', 'DONE', 'CANCELLED']).optional()
11
+ .describe("Optional status filter: 'TODO', 'IN_PROGRESS', 'IN_REVIEW', 'DONE', 'CANCELLED'"),
12
+ limit: z.number().int().min(1).max(100).optional()
13
+ .describe('Maximum number of tasks to return (default: 50)'),
14
+ });
15
+ export const CreateTaskInput = z.object({
16
+ project_id: z.string().describe('The ID of the project to create the task in'),
17
+ title: z.string().min(1).describe('The title of the task'),
18
+ description: z.string().optional().describe('Optional description of the task'),
19
+ });
20
+ export const GetTaskInput = z.object({
21
+ task_id: z.string().describe('The ID of the task to retrieve'),
22
+ });
23
+ export const UpdateTaskInput = z.object({
24
+ task_id: z.string().describe('The ID of the task to update'),
25
+ title: z.string().min(1).optional().describe('New title for the task'),
26
+ description: z.string().optional().describe('New description for the task'),
27
+ status: z.enum(['TODO', 'IN_PROGRESS', 'IN_REVIEW', 'DONE', 'CANCELLED']).optional()
28
+ .describe("New status: 'TODO', 'IN_PROGRESS', 'IN_REVIEW', 'DONE', 'CANCELLED'"),
29
+ });
30
+ export const DeleteTaskInput = z.object({
31
+ task_id: z.string().describe('The ID of the task to delete'),
32
+ });
33
+ // ── Workspaces ──
34
+ export const StartWorkspaceSessionInput = z.object({
35
+ task_id: z.string().describe('The ID of the task to start a workspace session for'),
36
+ agent_type: z.enum(['CLAUDE_CODE', 'GEMINI_CLI', 'CURSOR_AGENT'])
37
+ .describe("The AI agent type: 'CLAUDE_CODE', 'GEMINI_CLI', 'CURSOR_AGENT'"),
38
+ prompt: z.string().min(1).describe('The prompt/instruction for the AI agent'),
39
+ variant: z.string().optional().describe('Optional executor variant'),
40
+ });
41
+ export const GetWorkspaceDiffInput = z.object({
42
+ workspace_id: z.string().describe('The ID of the workspace'),
43
+ });
44
+ export const MergeWorkspaceInput = z.object({
45
+ workspace_id: z.string().describe('The ID of the workspace to merge'),
46
+ });
47
+ // ── Sessions ──
48
+ export const StopSessionInput = z.object({
49
+ session_id: z.string().describe('The ID of the session to stop'),
50
+ });
51
+ export const SendMessageInput = z.object({
52
+ session_id: z.string().describe('The ID of the session'),
53
+ message: z.string().min(1).describe('The message to send'),
54
+ });
55
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/mcp/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,iBAAiB;AAEjB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,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;CACtE,CAAC,CAAC;AAEH,iBAAiB;AAEjB,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+BAA+B,CAAC;CACjE,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC;IACxD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,qBAAqB,CAAC;CAC3D,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { FastifyRequest, FastifyReply } from 'fastify';
2
+ /**
3
+ * 判断请求是否来自 Cloudflare 隧道
4
+ * cloudflared 代理请求时,Cloudflare 边缘会注入 CF-Connecting-IP / CF-Ray 等头
5
+ */
6
+ declare function isTunnelRequest(request: FastifyRequest): boolean;
7
+ /**
8
+ * Fastify onRequest 钩子:隧道请求必须携带有效 token
9
+ * 本地直连请求(无 CF 头)自动放行
10
+ */
11
+ export declare function tunnelAuthHook(request: FastifyRequest, reply: FastifyReply): Promise<void>;
12
+ export { isTunnelRequest };
13
+ //# sourceMappingURL=tunnel-auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tunnel-auth.d.ts","sourceRoot":"","sources":["../../src/middleware/tunnel-auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG5D;;;GAGG;AACH,iBAAS,eAAe,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAEzD;AAgBD;;;GAGG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,YAAY,GAClB,OAAO,CAAC,IAAI,CAAC,CAWf;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}