agent-tower 0.7.2-beta.6 → 0.7.2-beta.8

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 (555) hide show
  1. package/dist/app.d.ts.map +1 -1
  2. package/dist/app.js +4 -1
  3. package/dist/app.js.map +1 -1
  4. package/dist/app.test.js +80 -1
  5. package/dist/app.test.js.map +1 -1
  6. package/dist/cli.js +4 -10
  7. package/dist/cli.js.map +1 -1
  8. package/dist/core/container.d.ts +8 -0
  9. package/dist/core/container.d.ts.map +1 -1
  10. package/dist/core/container.js +42 -0
  11. package/dist/core/container.js.map +1 -1
  12. package/dist/core/event-bus.d.ts +2 -0
  13. package/dist/core/event-bus.d.ts.map +1 -1
  14. package/dist/core/event-bus.js.map +1 -1
  15. package/dist/executors/__tests__/image-utils.test.d.ts +2 -0
  16. package/dist/executors/__tests__/image-utils.test.d.ts.map +1 -0
  17. package/dist/executors/__tests__/image-utils.test.js +25 -0
  18. package/dist/executors/__tests__/image-utils.test.js.map +1 -0
  19. package/dist/executors/base.executor.d.ts +2 -0
  20. package/dist/executors/base.executor.d.ts.map +1 -1
  21. package/dist/executors/base.executor.js +6 -0
  22. package/dist/executors/base.executor.js.map +1 -1
  23. package/dist/executors/image-utils.d.ts.map +1 -1
  24. package/dist/executors/image-utils.js +10 -8
  25. package/dist/executors/image-utils.js.map +1 -1
  26. package/dist/git/git-cli.d.ts +2 -0
  27. package/dist/git/git-cli.d.ts.map +1 -1
  28. package/dist/git/git-cli.js +2 -0
  29. package/dist/git/git-cli.js.map +1 -1
  30. package/dist/git/worktree.manager.d.ts +2 -1
  31. package/dist/git/worktree.manager.d.ts.map +1 -1
  32. package/dist/git/worktree.manager.js +18 -12
  33. package/dist/git/worktree.manager.js.map +1 -1
  34. package/dist/index.js +16 -31
  35. package/dist/index.js.map +1 -1
  36. package/dist/mcp/http-client.d.ts +1 -0
  37. package/dist/mcp/http-client.d.ts.map +1 -1
  38. package/dist/mcp/http-client.js +3 -0
  39. package/dist/mcp/http-client.js.map +1 -1
  40. package/dist/mcp/server.d.ts.map +1 -1
  41. package/dist/mcp/server.js +15 -0
  42. package/dist/mcp/server.js.map +1 -1
  43. package/dist/mcp/tools/sessions.js +2 -2
  44. package/dist/mcp/tools/sessions.js.map +1 -1
  45. package/dist/mcp/tools/workspaces.d.ts.map +1 -1
  46. package/dist/mcp/tools/workspaces.js +2 -1
  47. package/dist/mcp/tools/workspaces.js.map +1 -1
  48. package/dist/middleware/access-auth.d.ts +1 -0
  49. package/dist/middleware/access-auth.d.ts.map +1 -1
  50. package/dist/middleware/access-auth.js +1 -1
  51. package/dist/middleware/access-auth.js.map +1 -1
  52. package/dist/output/__tests__/text-block-lifecycle.test.d.ts +2 -0
  53. package/dist/output/__tests__/text-block-lifecycle.test.d.ts.map +1 -0
  54. package/dist/output/__tests__/text-block-lifecycle.test.js +241 -0
  55. package/dist/output/__tests__/text-block-lifecycle.test.js.map +1 -0
  56. package/dist/output/claude-code-parser.d.ts +3 -0
  57. package/dist/output/claude-code-parser.d.ts.map +1 -1
  58. package/dist/output/claude-code-parser.js +58 -7
  59. package/dist/output/claude-code-parser.js.map +1 -1
  60. package/dist/output/codex-parser.d.ts.map +1 -1
  61. package/dist/output/codex-parser.js +4 -6
  62. package/dist/output/codex-parser.js.map +1 -1
  63. package/dist/output/cursor-agent-parser.d.ts.map +1 -1
  64. package/dist/output/cursor-agent-parser.js +4 -0
  65. package/dist/output/cursor-agent-parser.js.map +1 -1
  66. package/dist/output/gemini-parser.d.ts +18 -0
  67. package/dist/output/gemini-parser.d.ts.map +1 -0
  68. package/dist/output/gemini-parser.js +91 -0
  69. package/dist/output/gemini-parser.js.map +1 -0
  70. package/dist/output/msg-store.d.ts +6 -0
  71. package/dist/output/msg-store.d.ts.map +1 -1
  72. package/dist/output/msg-store.js +17 -0
  73. package/dist/output/msg-store.js.map +1 -1
  74. package/dist/output/text-block-tracker.d.ts +29 -0
  75. package/dist/output/text-block-tracker.d.ts.map +1 -0
  76. package/dist/output/text-block-tracker.js +149 -0
  77. package/dist/output/text-block-tracker.js.map +1 -0
  78. package/dist/output/types.d.ts +9 -0
  79. package/dist/output/types.d.ts.map +1 -1
  80. package/dist/output/types.js +0 -4
  81. package/dist/output/types.js.map +1 -1
  82. package/dist/routes/__tests__/sessions-runtime.test.js +3 -0
  83. package/dist/routes/__tests__/sessions-runtime.test.js.map +1 -1
  84. package/dist/routes/__tests__/team-run-translations.test.d.ts +2 -0
  85. package/dist/routes/__tests__/team-run-translations.test.d.ts.map +1 -0
  86. package/dist/routes/__tests__/team-run-translations.test.js +418 -0
  87. package/dist/routes/__tests__/team-run-translations.test.js.map +1 -0
  88. package/dist/routes/__tests__/translations.test.d.ts +2 -0
  89. package/dist/routes/__tests__/translations.test.d.ts.map +1 -0
  90. package/dist/routes/__tests__/translations.test.js +286 -0
  91. package/dist/routes/__tests__/translations.test.js.map +1 -0
  92. package/dist/routes/__tests__/workspaces.test.js +140 -0
  93. package/dist/routes/__tests__/workspaces.test.js.map +1 -1
  94. package/dist/routes/conversations.d.ts.map +1 -1
  95. package/dist/routes/conversations.js +19 -2
  96. package/dist/routes/conversations.js.map +1 -1
  97. package/dist/routes/index.d.ts.map +1 -1
  98. package/dist/routes/index.js +2 -0
  99. package/dist/routes/index.js.map +1 -1
  100. package/dist/routes/sessions.d.ts.map +1 -1
  101. package/dist/routes/sessions.js +32 -3
  102. package/dist/routes/sessions.js.map +1 -1
  103. package/dist/routes/team-runs.d.ts.map +1 -1
  104. package/dist/routes/team-runs.js +84 -15
  105. package/dist/routes/team-runs.js.map +1 -1
  106. package/dist/routes/translations.d.ts +4 -0
  107. package/dist/routes/translations.d.ts.map +1 -0
  108. package/dist/routes/translations.js +148 -0
  109. package/dist/routes/translations.js.map +1 -0
  110. package/dist/routes/user-input-origin.d.ts +4 -0
  111. package/dist/routes/user-input-origin.d.ts.map +1 -0
  112. package/dist/routes/user-input-origin.js +7 -0
  113. package/dist/routes/user-input-origin.js.map +1 -0
  114. package/dist/routes/workspaces.d.ts.map +1 -1
  115. package/dist/routes/workspaces.js +32 -2
  116. package/dist/routes/workspaces.js.map +1 -1
  117. package/dist/runtime/__tests__/acp-driver-lifecycle.test.js +2 -2
  118. package/dist/runtime/__tests__/acp-driver-lifecycle.test.js.map +1 -1
  119. package/dist/runtime/__tests__/acp-driver-submission.test.d.ts +2 -0
  120. package/dist/runtime/__tests__/acp-driver-submission.test.d.ts.map +1 -0
  121. package/dist/runtime/__tests__/acp-driver-submission.test.js +88 -0
  122. package/dist/runtime/__tests__/acp-driver-submission.test.js.map +1 -0
  123. package/dist/runtime/__tests__/acp-history-reconciler.test.js +244 -0
  124. package/dist/runtime/__tests__/acp-history-reconciler.test.js.map +1 -1
  125. package/dist/runtime/__tests__/acp-projector.test.js +36 -0
  126. package/dist/runtime/__tests__/acp-projector.test.js.map +1 -1
  127. package/dist/runtime/__tests__/claude-cli-control.test.js +20 -0
  128. package/dist/runtime/__tests__/claude-cli-control.test.js.map +1 -1
  129. package/dist/runtime/__tests__/cli-driver-submission.test.d.ts +2 -0
  130. package/dist/runtime/__tests__/cli-driver-submission.test.d.ts.map +1 -0
  131. package/dist/runtime/__tests__/cli-driver-submission.test.js +61 -0
  132. package/dist/runtime/__tests__/cli-driver-submission.test.js.map +1 -0
  133. package/dist/runtime/__tests__/codex-cli-control.test.js +25 -0
  134. package/dist/runtime/__tests__/codex-cli-control.test.js.map +1 -1
  135. package/dist/runtime/acp/acp-driver.js +38 -1
  136. package/dist/runtime/acp/acp-driver.js.map +1 -1
  137. package/dist/runtime/acp/history-reconciler.d.ts.map +1 -1
  138. package/dist/runtime/acp/history-reconciler.js +95 -36
  139. package/dist/runtime/acp/history-reconciler.js.map +1 -1
  140. package/dist/runtime/acp/projector.d.ts +5 -2
  141. package/dist/runtime/acp/projector.d.ts.map +1 -1
  142. package/dist/runtime/acp/projector.js +50 -23
  143. package/dist/runtime/acp/projector.js.map +1 -1
  144. package/dist/runtime/claude-cli-control.d.ts +4 -1
  145. package/dist/runtime/claude-cli-control.d.ts.map +1 -1
  146. package/dist/runtime/claude-cli-control.js +3 -1
  147. package/dist/runtime/claude-cli-control.js.map +1 -1
  148. package/dist/runtime/cli-driver.js +21 -7
  149. package/dist/runtime/cli-driver.js.map +1 -1
  150. package/dist/runtime/cli-parser.d.ts.map +1 -1
  151. package/dist/runtime/cli-parser.js +3 -0
  152. package/dist/runtime/cli-parser.js.map +1 -1
  153. package/dist/runtime/codex-cli-control.d.ts +4 -1
  154. package/dist/runtime/codex-cli-control.d.ts.map +1 -1
  155. package/dist/runtime/codex-cli-control.js +9 -6
  156. package/dist/runtime/codex-cli-control.js.map +1 -1
  157. package/dist/runtime/codex-cli-projector.d.ts +1 -1
  158. package/dist/runtime/codex-cli-projector.d.ts.map +1 -1
  159. package/dist/runtime/codex-cli-projector.js +4 -2
  160. package/dist/runtime/codex-cli-projector.js.map +1 -1
  161. package/dist/runtime/contracts.d.ts +15 -2
  162. package/dist/runtime/contracts.d.ts.map +1 -1
  163. package/dist/runtime/runtime-coordinator.d.ts.map +1 -1
  164. package/dist/runtime/runtime-coordinator.js +34 -1
  165. package/dist/runtime/runtime-coordinator.js.map +1 -1
  166. package/dist/services/__tests__/conflict-admission.test.d.ts +2 -0
  167. package/dist/services/__tests__/conflict-admission.test.d.ts.map +1 -0
  168. package/dist/services/__tests__/conflict-admission.test.js +37 -0
  169. package/dist/services/__tests__/conflict-admission.test.js.map +1 -0
  170. package/dist/services/__tests__/conflict-recovery-key.test.d.ts +2 -0
  171. package/dist/services/__tests__/conflict-recovery-key.test.d.ts.map +1 -0
  172. package/dist/services/__tests__/conflict-recovery-key.test.js +143 -0
  173. package/dist/services/__tests__/conflict-recovery-key.test.js.map +1 -0
  174. package/dist/services/__tests__/message-delivery.integration.test.d.ts +2 -0
  175. package/dist/services/__tests__/message-delivery.integration.test.d.ts.map +1 -0
  176. package/dist/services/__tests__/message-delivery.integration.test.js +1137 -0
  177. package/dist/services/__tests__/message-delivery.integration.test.js.map +1 -0
  178. package/dist/services/__tests__/review-team-user-counterexamples.test.d.ts +2 -0
  179. package/dist/services/__tests__/review-team-user-counterexamples.test.d.ts.map +1 -0
  180. package/dist/services/__tests__/review-team-user-counterexamples.test.js +200 -0
  181. package/dist/services/__tests__/review-team-user-counterexamples.test.js.map +1 -0
  182. package/dist/services/__tests__/session-manager.lifecycle.test.js +37 -0
  183. package/dist/services/__tests__/session-manager.lifecycle.test.js.map +1 -1
  184. package/dist/services/__tests__/session-manager.team-run.test.js +19 -2
  185. package/dist/services/__tests__/session-manager.team-run.test.js.map +1 -1
  186. package/dist/services/__tests__/team-initial-delivery.integration.test.d.ts +2 -0
  187. package/dist/services/__tests__/team-initial-delivery.integration.test.d.ts.map +1 -0
  188. package/dist/services/__tests__/team-initial-delivery.integration.test.js +469 -0
  189. package/dist/services/__tests__/team-initial-delivery.integration.test.js.map +1 -0
  190. package/dist/services/__tests__/team-reconciler.service.test.js +102 -101
  191. package/dist/services/__tests__/team-reconciler.service.test.js.map +1 -1
  192. package/dist/services/__tests__/team-room-delivery.test.d.ts +2 -0
  193. package/dist/services/__tests__/team-room-delivery.test.d.ts.map +1 -0
  194. package/dist/services/__tests__/team-room-delivery.test.js +670 -0
  195. package/dist/services/__tests__/team-room-delivery.test.js.map +1 -0
  196. package/dist/services/__tests__/team-user-delivery.integration.test.d.ts +2 -0
  197. package/dist/services/__tests__/team-user-delivery.integration.test.d.ts.map +1 -0
  198. package/dist/services/__tests__/team-user-delivery.integration.test.js +622 -0
  199. package/dist/services/__tests__/team-user-delivery.integration.test.js.map +1 -0
  200. package/dist/services/__tests__/translation-client.test.d.ts +2 -0
  201. package/dist/services/__tests__/translation-client.test.d.ts.map +1 -0
  202. package/dist/services/__tests__/translation-client.test.js +240 -0
  203. package/dist/services/__tests__/translation-client.test.js.map +1 -0
  204. package/dist/services/__tests__/translation-protection.test.d.ts +2 -0
  205. package/dist/services/__tests__/translation-protection.test.d.ts.map +1 -0
  206. package/dist/services/__tests__/translation-protection.test.js +156 -0
  207. package/dist/services/__tests__/translation-protection.test.js.map +1 -0
  208. package/dist/services/__tests__/translation-queue.test.d.ts +2 -0
  209. package/dist/services/__tests__/translation-queue.test.d.ts.map +1 -0
  210. package/dist/services/__tests__/translation-queue.test.js +277 -0
  211. package/dist/services/__tests__/translation-queue.test.js.map +1 -0
  212. package/dist/services/__tests__/translation-room-admission.test.d.ts +2 -0
  213. package/dist/services/__tests__/translation-room-admission.test.d.ts.map +1 -0
  214. package/dist/services/__tests__/translation-room-admission.test.js +371 -0
  215. package/dist/services/__tests__/translation-room-admission.test.js.map +1 -0
  216. package/dist/services/__tests__/translation-session-blocks.test.d.ts +2 -0
  217. package/dist/services/__tests__/translation-session-blocks.test.d.ts.map +1 -0
  218. package/dist/services/__tests__/translation-session-blocks.test.js +367 -0
  219. package/dist/services/__tests__/translation-session-blocks.test.js.map +1 -0
  220. package/dist/services/__tests__/translation-settings.service.test.d.ts +2 -0
  221. package/dist/services/__tests__/translation-settings.service.test.d.ts.map +1 -0
  222. package/dist/services/__tests__/translation-settings.service.test.js +154 -0
  223. package/dist/services/__tests__/translation-settings.service.test.js.map +1 -0
  224. package/dist/services/__tests__/translation.service.test.d.ts +2 -0
  225. package/dist/services/__tests__/translation.service.test.d.ts.map +1 -0
  226. package/dist/services/__tests__/translation.service.test.js +480 -0
  227. package/dist/services/__tests__/translation.service.test.js.map +1 -0
  228. package/dist/services/access-auth.service.d.ts +1 -0
  229. package/dist/services/access-auth.service.d.ts.map +1 -1
  230. package/dist/services/access-auth.service.js +8 -0
  231. package/dist/services/access-auth.service.js.map +1 -1
  232. package/dist/services/attachment-context.d.ts +7 -1
  233. package/dist/services/attachment-context.d.ts.map +1 -1
  234. package/dist/services/attachment-context.js +23 -2
  235. package/dist/services/attachment-context.js.map +1 -1
  236. package/dist/services/conflict-admission.d.ts +37 -0
  237. package/dist/services/conflict-admission.d.ts.map +1 -0
  238. package/dist/services/conflict-admission.js +97 -0
  239. package/dist/services/conflict-admission.js.map +1 -0
  240. package/dist/services/conflict-resolution-context.d.ts +33 -0
  241. package/dist/services/conflict-resolution-context.d.ts.map +1 -0
  242. package/dist/services/conflict-resolution-context.js +434 -0
  243. package/dist/services/conflict-resolution-context.js.map +1 -0
  244. package/dist/services/message-delivery.service.d.ts +195 -0
  245. package/dist/services/message-delivery.service.d.ts.map +1 -0
  246. package/dist/services/message-delivery.service.js +956 -0
  247. package/dist/services/message-delivery.service.js.map +1 -0
  248. package/dist/services/project.service.d.ts +1 -1
  249. package/dist/services/session-manager.d.ts +94 -74
  250. package/dist/services/session-manager.d.ts.map +1 -1
  251. package/dist/services/session-manager.js +91 -17
  252. package/dist/services/session-manager.js.map +1 -1
  253. package/dist/services/task.service.d.ts +26 -20
  254. package/dist/services/task.service.d.ts.map +1 -1
  255. package/dist/services/task.service.js +9 -26
  256. package/dist/services/task.service.js.map +1 -1
  257. package/dist/services/team-room-delivery.d.ts +541 -0
  258. package/dist/services/team-room-delivery.d.ts.map +1 -0
  259. package/dist/services/team-room-delivery.js +123 -0
  260. package/dist/services/team-room-delivery.js.map +1 -0
  261. package/dist/services/team-run.service.d.ts +83 -0
  262. package/dist/services/team-run.service.d.ts.map +1 -1
  263. package/dist/services/team-run.service.js +207 -18
  264. package/dist/services/team-run.service.js.map +1 -1
  265. package/dist/services/team-scheduler.service.d.ts +3 -0
  266. package/dist/services/team-scheduler.service.d.ts.map +1 -1
  267. package/dist/services/team-scheduler.service.js +65 -11
  268. package/dist/services/team-scheduler.service.js.map +1 -1
  269. package/dist/services/team-task-input.d.ts +37 -0
  270. package/dist/services/team-task-input.d.ts.map +1 -0
  271. package/dist/services/team-task-input.js +98 -0
  272. package/dist/services/team-task-input.js.map +1 -0
  273. package/dist/services/team-task-input.service.d.ts +72 -0
  274. package/dist/services/team-task-input.service.d.ts.map +1 -0
  275. package/dist/services/team-task-input.service.js +205 -0
  276. package/dist/services/team-task-input.service.js.map +1 -0
  277. package/dist/services/translation-client.d.ts +31 -0
  278. package/dist/services/translation-client.d.ts.map +1 -0
  279. package/dist/services/translation-client.js +169 -0
  280. package/dist/services/translation-client.js.map +1 -0
  281. package/dist/services/translation-errors.d.ts +14 -0
  282. package/dist/services/translation-errors.d.ts.map +1 -0
  283. package/dist/services/translation-errors.js +16 -0
  284. package/dist/services/translation-errors.js.map +1 -0
  285. package/dist/services/translation-protection.d.ts +27 -0
  286. package/dist/services/translation-protection.d.ts.map +1 -0
  287. package/dist/services/translation-protection.js +547 -0
  288. package/dist/services/translation-protection.js.map +1 -0
  289. package/dist/services/translation-queue.d.ts +49 -0
  290. package/dist/services/translation-queue.d.ts.map +1 -0
  291. package/dist/services/translation-queue.js +211 -0
  292. package/dist/services/translation-queue.js.map +1 -0
  293. package/dist/services/translation-settings.service.d.ts +152 -0
  294. package/dist/services/translation-settings.service.d.ts.map +1 -0
  295. package/dist/services/translation-settings.service.js +174 -0
  296. package/dist/services/translation-settings.service.js.map +1 -0
  297. package/dist/services/translation.service.d.ts +168 -0
  298. package/dist/services/translation.service.d.ts.map +1 -0
  299. package/dist/services/translation.service.js +861 -0
  300. package/dist/services/translation.service.js.map +1 -0
  301. package/dist/services/workspace.service.d.ts +84 -93
  302. package/dist/services/workspace.service.d.ts.map +1 -1
  303. package/dist/services/workspace.service.js +69 -5
  304. package/dist/services/workspace.service.js.map +1 -1
  305. package/dist/socket/__tests__/socket-gateway.test.js +131 -1
  306. package/dist/socket/__tests__/socket-gateway.test.js.map +1 -1
  307. package/dist/socket/socket-gateway.d.ts +6 -0
  308. package/dist/socket/socket-gateway.d.ts.map +1 -1
  309. package/dist/socket/socket-gateway.js +312 -6
  310. package/dist/socket/socket-gateway.js.map +1 -1
  311. package/dist/utils/database-schema.d.ts +9 -0
  312. package/dist/utils/database-schema.d.ts.map +1 -0
  313. package/dist/utils/database-schema.js +434 -0
  314. package/dist/utils/database-schema.js.map +1 -0
  315. package/dist/utils/database-schema.test.d.ts +2 -0
  316. package/dist/utils/database-schema.test.d.ts.map +1 -0
  317. package/dist/utils/database-schema.test.js +359 -0
  318. package/dist/utils/database-schema.test.js.map +1 -0
  319. package/dist/utils/database-team-foundation.test.d.ts +2 -0
  320. package/dist/utils/database-team-foundation.test.d.ts.map +1 -0
  321. package/dist/utils/database-team-foundation.test.js +467 -0
  322. package/dist/utils/database-team-foundation.test.js.map +1 -0
  323. package/dist/utils/owned-child-process.test.js +6 -3
  324. package/dist/utils/owned-child-process.test.js.map +1 -1
  325. package/dist/utils/text-preview.d.ts +4 -0
  326. package/dist/utils/text-preview.d.ts.map +1 -0
  327. package/dist/utils/text-preview.js +21 -0
  328. package/dist/utils/text-preview.js.map +1 -0
  329. package/dist/web/assets/AgentDemoPage-CtCYXopw.js +1 -0
  330. package/dist/web/assets/{AgentEnvironmentSettingsPage-BnWVgvNe.js → AgentEnvironmentSettingsPage-DSWN546Y.js} +1 -1
  331. package/dist/web/assets/AttachmentPreview-DRG5_cfN.js +2 -0
  332. package/dist/web/assets/BranchSelect-Dxs7HnMM.js +1 -0
  333. package/dist/web/assets/BrandLogo-Ilm880Xs.js +1 -0
  334. package/dist/web/assets/ConversationPage-B55Bj_ft.js +1 -0
  335. package/dist/web/assets/CreateTaskInput-CxWPeToI.js +1 -0
  336. package/dist/web/assets/{DemoPage-BwX2SvcN.js → DemoPage-Dyn-U9JO.js} +3 -3
  337. package/dist/web/assets/DesignSystemPage-BxypsRUZ.js +12 -0
  338. package/dist/web/assets/EditableTaskTitle-Dh-SmvFW.js +70 -0
  339. package/dist/web/assets/{ExecutionPermissionSelector-DeeNd4Kh.js → ExecutionPermissionSelector-CQ_GNxR0.js} +10 -10
  340. package/dist/web/assets/GeneralSettingsPage-CzoejPZP.js +1 -0
  341. package/dist/web/assets/{LoadingPreviewPage-BxEFnEQh.js → LoadingPreviewPage-BlW2PJhI.js} +1 -1
  342. package/dist/web/assets/McpSettingsPage-DD7EqD4L.js +1 -0
  343. package/dist/web/assets/MemberAvatar-B2pAdWUi.js +1 -0
  344. package/dist/web/assets/MobileTaskDetail-CvmNW0BQ.js +3 -0
  345. package/dist/web/assets/NotificationSettingsPage-BIqldIRf.js +1 -0
  346. package/dist/web/assets/ProfileSettingsPage-DMxpHmF1.js +3 -0
  347. package/dist/web/assets/ProjectKanbanPage-CHW79td4.js +12 -0
  348. package/dist/web/assets/ProjectSettingsPage-DKiEUkoa.js +2 -0
  349. package/dist/web/assets/ProviderSettingsPage-DZT7wyE2.js +67 -0
  350. package/dist/web/assets/SettingsMasterDetail-DnF0lsV1.js +1 -0
  351. package/dist/web/assets/TaskDetail-D_970BDY.js +1 -0
  352. package/dist/web/assets/TeamSettingsPage-BJIEZ7xL.js +1 -0
  353. package/dist/web/assets/TranslationSettingsPage-D3mazqEW.js +1 -0
  354. package/dist/web/assets/arc-hUh7ykl8.js +1 -0
  355. package/dist/web/assets/{architectureDiagram-3BPJPVTR-B5EIiXuX.js → architectureDiagram-3BPJPVTR-CcV9CLkm.js} +1 -1
  356. package/dist/web/assets/{at-sign-BE17rU5b.js → at-sign-B-nhoGyH.js} +1 -1
  357. package/dist/web/assets/{blockDiagram-GPEHLZMM-GFwnvSLM.js → blockDiagram-GPEHLZMM-5q3Y9y0e.js} +1 -1
  358. package/dist/web/assets/{c4Diagram-AAUBKEIU-iJfLTxEa.js → c4Diagram-AAUBKEIU-CorBXi06.js} +1 -1
  359. package/dist/web/assets/channel-By24WpLg.js +1 -0
  360. package/dist/web/assets/check-DqPSoX0r.js +1 -0
  361. package/dist/web/assets/{chevron-down-BaQEBzp3.js → chevron-down-CPnvItQw.js} +1 -1
  362. package/dist/web/assets/{chevron-up-D0y6skqr.js → chevron-up-B8PE5N0G.js} +1 -1
  363. package/dist/web/assets/{chunk-2J33WTMH-CDxRPp-8.js → chunk-2J33WTMH-BUf5B4z4.js} +1 -1
  364. package/dist/web/assets/{chunk-4BX2VUAB-mzPbgyiz.js → chunk-4BX2VUAB-CdnOHkro.js} +1 -1
  365. package/dist/web/assets/{chunk-55IACEB6-KNAJbQyw.js → chunk-55IACEB6-U7edZDpP.js} +1 -1
  366. package/dist/web/assets/{chunk-727SXJPM-BqGfqkDK.js → chunk-727SXJPM-B64Tuhla.js} +1 -1
  367. package/dist/web/assets/{chunk-AQP2D5EJ-D27ue-H0.js → chunk-AQP2D5EJ-dXfe56jB.js} +1 -1
  368. package/dist/web/assets/{chunk-FMBD7UC4-DRza-3q8.js → chunk-FMBD7UC4-DDYbxc1Q.js} +1 -1
  369. package/dist/web/assets/{chunk-ND2GUHAM-CUgkviLu.js → chunk-ND2GUHAM-BQDGMv0R.js} +1 -1
  370. package/dist/web/assets/{chunk-QZHKN3VN-BAlOJwZb.js → chunk-QZHKN3VN-DB8q4xAj.js} +1 -1
  371. package/dist/web/assets/classDiagram-4FO5ZUOK-DxHoimtR.js +1 -0
  372. package/dist/web/assets/classDiagram-v2-Q7XG4LA2-DxHoimtR.js +1 -0
  373. package/dist/web/assets/code-block-OCS4YCEC-BSdICyOa.js +2 -0
  374. package/dist/web/assets/confirm-dialog-DxEBZEbV.js +1 -0
  375. package/dist/web/assets/content-CMUL3HGx.js +2 -0
  376. package/dist/web/assets/{copy-DejkmIHZ.js → copy-DyxlXxiU.js} +1 -1
  377. package/dist/web/assets/{cose-bilkent-S5V4N54A-8TBY7BP_.js → cose-bilkent-S5V4N54A-Dx6eMnll.js} +1 -1
  378. package/dist/web/assets/cssMode-ZnNWfjZ6.js +1 -0
  379. package/dist/web/assets/{dagre-BM42HDAG-CkMzDiim.js → dagre-BM42HDAG-Cxe8pLgD.js} +1 -1
  380. package/dist/web/assets/{diagram-2AECGRRQ-CAOQJ2N1.js → diagram-2AECGRRQ-RMsswEBe.js} +1 -1
  381. package/dist/web/assets/{diagram-5GNKFQAL-DKhE0hiI.js → diagram-5GNKFQAL-Bi4E0hzx.js} +1 -1
  382. package/dist/web/assets/{diagram-KO2AKTUF-DBdkXSpa.js → diagram-KO2AKTUF-Mv6CDCyn.js} +1 -1
  383. package/dist/web/assets/{diagram-LMA3HP47-DRi2t32c.js → diagram-LMA3HP47-CJ3qKNzK.js} +1 -1
  384. package/dist/web/assets/{diagram-OG6HWLK6-DtP92tI1.js → diagram-OG6HWLK6-D8SBY4ft.js} +1 -1
  385. package/dist/web/assets/dialog-BYdeYC2Y.js +5 -0
  386. package/dist/web/assets/{erDiagram-TEJ5UH35-DWFKXtst.js → erDiagram-TEJ5UH35-DwVSCU6X.js} +1 -1
  387. package/dist/web/assets/{flowDiagram-I6XJVG4X-LDE0h4ri.js → flowDiagram-I6XJVG4X-CyipYAWd.js} +1 -1
  388. package/dist/web/assets/{freemarker2-CLksOOZX.js → freemarker2-DbH_yMCO.js} +2 -2
  389. package/dist/web/assets/{ganttDiagram-6RSMTGT7-DD2RfdyV.js → ganttDiagram-6RSMTGT7-CsC6Wjt4.js} +1 -1
  390. package/dist/web/assets/{gitGraphDiagram-PVQCEYII-DkKrR8ex.js → gitGraphDiagram-PVQCEYII-E5jNbqlq.js} +1 -1
  391. package/dist/web/assets/{globe-CD4g63c9.js → globe-B2rgTPH3.js} +1 -1
  392. package/dist/web/assets/handlebars-C5VY_S-z.js +1 -0
  393. package/dist/web/assets/hooks-Ct0srfV-.js +1 -0
  394. package/dist/web/assets/html-e5uLnAgN.js +1 -0
  395. package/dist/web/assets/htmlMode-BeNiGozX.js +1 -0
  396. package/dist/web/assets/icon-button-BEMJj_6T.js +1 -0
  397. package/dist/web/assets/index-0XPZayUU.css +1 -0
  398. package/dist/web/assets/index-BYPOXP6w.js +1 -0
  399. package/dist/web/assets/{index-D_QVcsLn.js → index-C-M0QDqc.js} +5 -5
  400. package/dist/web/assets/index-CAjqC8pT.js +41 -0
  401. package/dist/web/assets/index-CPGzLjEC.js +1 -0
  402. package/dist/web/assets/index-Cm6snkmR.js +122 -0
  403. package/dist/web/assets/index-DNdMmXBr.js +1 -0
  404. package/dist/web/assets/index-DppwrK2G.js +1 -0
  405. package/dist/web/assets/index-IMdA08Ok.js +1 -0
  406. package/dist/web/assets/index-kr6U6_pi.js +1 -0
  407. package/dist/web/assets/{infoDiagram-5YYISTIA-BdPA9Xfi.js → infoDiagram-5YYISTIA-5_0wrRXl.js} +1 -1
  408. package/dist/web/assets/{ishikawaDiagram-YF4QCWOH-220u4uiv.js → ishikawaDiagram-YF4QCWOH-aQujIFZw.js} +5 -5
  409. package/dist/web/assets/javascript-D7QVj9jR.js +1 -0
  410. package/dist/web/assets/{journeyDiagram-JHISSGLW-BvE0Y3tZ.js → journeyDiagram-JHISSGLW-ClMzHdqI.js} +1 -1
  411. package/dist/web/assets/jsonMode-nHmLVf-n.js +7 -0
  412. package/dist/web/assets/{kanban-definition-UN3LZRKU-Q0JH1P6D.js → kanban-definition-UN3LZRKU-BFVlt0tz.js} +1 -1
  413. package/dist/web/assets/kbd-Bfq5K6Ux.js +1 -0
  414. package/dist/web/assets/{key-round-DZm1FLLr.js → key-round-BqsaQdce.js} +1 -1
  415. package/dist/web/assets/{layers-Dda7MM7a.js → layers-DI4vFJ4F.js} +1 -1
  416. package/dist/web/assets/{linear-Dr6SfnSn.js → linear-DZ-6PAPS.js} +1 -1
  417. package/dist/web/assets/{link-BUeSP3T7.js → link-BU4PN723.js} +1 -1
  418. package/dist/web/assets/liquid-BPIyogoj.js +1 -0
  419. package/dist/web/assets/{lspLanguageFeatures-Bbp4PWlJ.js → lspLanguageFeatures-DH4Z8jiM.js} +1 -1
  420. package/dist/web/assets/mdx-CI8yO2pV.js +1 -0
  421. package/dist/web/assets/menu-C3uB3M7p.js +1 -0
  422. package/dist/web/assets/menu-styles-DWynpVVz.js +1 -0
  423. package/dist/web/assets/mermaid-NOHMQCX5-BqeX1osS.js +123 -0
  424. package/dist/web/assets/{message-square-CFriSt4D.js → message-square-E5K8E3A-.js} +1 -1
  425. package/dist/web/assets/{mindmap-definition-RKZ34NQL-bvDaNfKs.js → mindmap-definition-RKZ34NQL-C7dea0db.js} +1 -1
  426. package/dist/web/assets/modal-Cz1iIVeD.js +1 -0
  427. package/dist/web/assets/{monaco-BuDK9Fat.js → monaco-DM3DuGN5.js} +3 -3
  428. package/dist/web/assets/{paperclip-BOSklTt7.js → paperclip-COXNce_v.js} +1 -1
  429. package/dist/web/assets/{pencil-BRQ9W_a-.js → pencil-BFc4n44f.js} +1 -1
  430. package/dist/web/assets/people-BaCetIqh.js +1 -0
  431. package/dist/web/assets/{pieDiagram-4H26LBE5-BQCca9Cq.js → pieDiagram-4H26LBE5-2q5medug.js} +2 -2
  432. package/dist/web/assets/popover-CJCQLoGu.js +1 -0
  433. package/dist/web/assets/python-CSxVPG9p.js +1 -0
  434. package/dist/web/assets/{quadrantDiagram-W4KKPZXB-BEM2U7Cd.js → quadrantDiagram-W4KKPZXB-DHPEM56s.js} +1 -1
  435. package/dist/web/assets/razor-CVoIieeS.js +1 -0
  436. package/dist/web/assets/{requirementDiagram-4Y6WPE33-CcmFIALZ.js → requirementDiagram-4Y6WPE33-B_KyH7PP.js} +1 -1
  437. package/dist/web/assets/{sankeyDiagram-5OEKKPKP-D9Nrfbqk.js → sankeyDiagram-5OEKKPKP-CrqkZAYW.js} +1 -1
  438. package/dist/web/assets/search-CkiBPir_.js +1 -0
  439. package/dist/web/assets/search-field-CbM2P2KE.js +1 -0
  440. package/dist/web/assets/select-Br0TAs7A.js +1 -0
  441. package/dist/web/assets/select-DJsEG0jq.js +1 -0
  442. package/dist/web/assets/{sequenceDiagram-3UESZ5HK-5udQDi0x.js → sequenceDiagram-3UESZ5HK-BRTm1WQA.js} +1 -1
  443. package/dist/web/assets/{server-DJaSJ9m1.js → server-DYeSE1wn.js} +1 -1
  444. package/dist/web/assets/stateDiagram-AJRCARHV-qN49iyR2.js +1 -0
  445. package/dist/web/assets/stateDiagram-v2-BHNVJYJU-B1clBPkJ.js +1 -0
  446. package/dist/web/assets/{textarea-Ft9KMoEI.js → textarea-B7vtoRE3.js} +1 -1
  447. package/dist/web/assets/{timeline-definition-PNZ67QCA-DXS236a-.js → timeline-definition-PNZ67QCA-BzarcDi3.js} +1 -1
  448. package/dist/web/assets/toggles-jo27o0AH.js +1 -0
  449. package/dist/web/assets/tooltip-DbVtCXcO.js +1 -0
  450. package/dist/web/assets/track-C0vxnITw.js +1 -0
  451. package/dist/web/assets/{trash-2-Bc-URu8c.js → trash-2-CUM-XX8B.js} +1 -1
  452. package/dist/web/assets/tsMode-7D3gqep6.js +11 -0
  453. package/dist/web/assets/typescript-CbOVEQNg.js +1 -0
  454. package/dist/web/assets/{upload-C9Z4jLtv.js → upload-CJ6jVmte.js} +1 -1
  455. package/dist/web/assets/use-profiles-B0xXAf7Z.js +1 -0
  456. package/dist/web/assets/{use-projects-DI27nNwl.js → use-projects-BlTwWxkY.js} +1 -1
  457. package/dist/web/assets/{use-providers-DB9ghBPq.js → use-providers-FMSfyTD1.js} +1 -1
  458. package/dist/web/assets/use-translation-settings-BOlszecX.js +1 -0
  459. package/dist/web/assets/use-workspaces-DYrEp0Lw.js +1 -0
  460. package/dist/web/assets/useNormalizedLogs-D0N8MJdH.js +1 -0
  461. package/dist/web/assets/useTokenUsage-WB3ZQ25v.js +1 -0
  462. package/dist/web/assets/{vennDiagram-CIIHVFJN-BzyNrP06.js → vennDiagram-CIIHVFJN-B6oZetvf.js} +1 -1
  463. package/dist/web/assets/{wardley-L42UT6IY-BQ4SyU9_.js → wardley-L42UT6IY-Bzuhm76f.js} +1 -1
  464. package/dist/web/assets/{wardleyDiagram-YWT4CUSO-CcCqmB58.js → wardleyDiagram-YWT4CUSO-DaC-FUf5.js} +1 -1
  465. package/dist/web/assets/xml-Cfa9tkdT.js +1 -0
  466. package/dist/web/assets/{xychartDiagram-2RQKCTM6-RWm1MtQk.js → xychartDiagram-2RQKCTM6-CCvRIJRL.js} +1 -1
  467. package/dist/web/assets/yaml-C86f7VLL.js +1 -0
  468. package/dist/web/index.html +2 -2
  469. package/node_modules/@agent-tower/shared/dist/index.d.ts +1 -0
  470. package/node_modules/@agent-tower/shared/dist/index.d.ts.map +1 -1
  471. package/node_modules/@agent-tower/shared/dist/index.js +1 -0
  472. package/node_modules/@agent-tower/shared/dist/index.js.map +1 -1
  473. package/node_modules/@agent-tower/shared/dist/log-adapter.d.ts +11 -0
  474. package/node_modules/@agent-tower/shared/dist/log-adapter.d.ts.map +1 -1
  475. package/node_modules/@agent-tower/shared/dist/log-adapter.js +2 -0
  476. package/node_modules/@agent-tower/shared/dist/log-adapter.js.map +1 -1
  477. package/node_modules/@agent-tower/shared/dist/socket/events.d.ts +5 -2
  478. package/node_modules/@agent-tower/shared/dist/socket/events.d.ts.map +1 -1
  479. package/node_modules/@agent-tower/shared/dist/socket/events.js +2 -0
  480. package/node_modules/@agent-tower/shared/dist/socket/events.js.map +1 -1
  481. package/node_modules/@agent-tower/shared/dist/translation.d.ts +306 -0
  482. package/node_modules/@agent-tower/shared/dist/translation.d.ts.map +1 -0
  483. package/node_modules/@agent-tower/shared/dist/translation.js +8 -0
  484. package/node_modules/@agent-tower/shared/dist/translation.js.map +1 -0
  485. package/node_modules/@agent-tower/shared/dist/types.d.ts +23 -0
  486. package/node_modules/@agent-tower/shared/dist/types.d.ts.map +1 -1
  487. package/node_modules/@agent-tower/shared/dist/types.js.map +1 -1
  488. package/package.json +1 -1
  489. package/prisma/migrations/20261016000000_add_translation_foundation/migration.sql +104 -0
  490. package/prisma/migrations/20261016010000_add_message_deliveries/migration.sql +158 -0
  491. package/prisma/migrations/20261019000000_add_room_translation_eligibility/migration.sql +3 -0
  492. package/prisma/migrations/20261019100000_add_team_delivery_foundation/migration.sql +217 -0
  493. package/prisma/schema.prisma +224 -0
  494. package/dist/web/assets/AgentDemoPage-D0LQRcXm.js +0 -1
  495. package/dist/web/assets/AgentLogo-BDyW3ihb.js +0 -1
  496. package/dist/web/assets/BranchSelect-Dmp5hq0i.js +0 -1
  497. package/dist/web/assets/BrandLogo-YGT4Vlw5.js +0 -1
  498. package/dist/web/assets/ConversationPage-BhapUYGe.js +0 -3
  499. package/dist/web/assets/CreateTaskInput-GLF3Oyc1.js +0 -1
  500. package/dist/web/assets/DesignSystemPage-j-1-1JtQ.js +0 -16
  501. package/dist/web/assets/EditableTaskTitle-mHT39coo.js +0 -70
  502. package/dist/web/assets/GeneralSettingsPage-BBe3EXcj.js +0 -1
  503. package/dist/web/assets/McpSettingsPage-DDA8yUxu.js +0 -1
  504. package/dist/web/assets/MemberAvatar-CCRbS97s.js +0 -1
  505. package/dist/web/assets/MobileTaskDetail-BOIFPybn.js +0 -5
  506. package/dist/web/assets/NotificationSettingsPage-B2kUnE8w.js +0 -1
  507. package/dist/web/assets/ProfileSettingsPage-DPZpUoFd.js +0 -3
  508. package/dist/web/assets/ProjectKanbanPage-DQnwUBFg.js +0 -12
  509. package/dist/web/assets/ProjectSettingsPage-CcXAOYb7.js +0 -2
  510. package/dist/web/assets/ProviderSettingsPage-BAIRvcAS.js +0 -67
  511. package/dist/web/assets/SettingsMasterDetail-BuxwsR9R.js +0 -1
  512. package/dist/web/assets/TaskDetail-B3pOSx3f.js +0 -3
  513. package/dist/web/assets/TeamSettingsPage-DoWmzvKu.js +0 -1
  514. package/dist/web/assets/agent-meta-MzuGtqxl.js +0 -1
  515. package/dist/web/assets/arc-Bm_QIbJA.js +0 -1
  516. package/dist/web/assets/arrow-down-BVePf1ZM.js +0 -1
  517. package/dist/web/assets/channel-CYYV7_Oi.js +0 -1
  518. package/dist/web/assets/check-qs0S_9rB.js +0 -1
  519. package/dist/web/assets/circle-alert-Cbvy2cMo.js +0 -1
  520. package/dist/web/assets/classDiagram-4FO5ZUOK-Cl-3ikxt.js +0 -1
  521. package/dist/web/assets/classDiagram-v2-Q7XG4LA2-Cl-3ikxt.js +0 -1
  522. package/dist/web/assets/code-block-OCS4YCEC-CO23R1Os.js +0 -2
  523. package/dist/web/assets/confirm-dialog-BrgNTypL.js +0 -1
  524. package/dist/web/assets/cssMode-hzDRnxMx.js +0 -1
  525. package/dist/web/assets/gauge-CPlvCZUV.js +0 -1
  526. package/dist/web/assets/handlebars-C1M9t0Lo.js +0 -1
  527. package/dist/web/assets/html-DKVKQovh.js +0 -1
  528. package/dist/web/assets/htmlMode-BSWjg5ir.js +0 -1
  529. package/dist/web/assets/index-BnqdwOEH.css +0 -1
  530. package/dist/web/assets/index-CMJV-mgF.js +0 -122
  531. package/dist/web/assets/javascript-WwrMY2Bg.js +0 -1
  532. package/dist/web/assets/jsonMode-Dz0hnnvg.js +0 -7
  533. package/dist/web/assets/liquid-CzGEh0ls.js +0 -1
  534. package/dist/web/assets/mdx-y6S3OMMk.js +0 -1
  535. package/dist/web/assets/mermaid-NOHMQCX5-C72362la.js +0 -123
  536. package/dist/web/assets/modal-DeigO7aN.js +0 -1
  537. package/dist/web/assets/play-Mxkwq69n.js +0 -1
  538. package/dist/web/assets/python-CMnGKsU9.js +0 -1
  539. package/dist/web/assets/razor-mLurbGgY.js +0 -1
  540. package/dist/web/assets/select-DKS02St6.js +0 -1
  541. package/dist/web/assets/stateDiagram-AJRCARHV-D-cF1NGV.js +0 -1
  542. package/dist/web/assets/stateDiagram-v2-BHNVJYJU-a4ugQnZs.js +0 -1
  543. package/dist/web/assets/status-styles-sQm4KLdp.js +0 -1
  544. package/dist/web/assets/switch-7LWQ_sEx.js +0 -1
  545. package/dist/web/assets/task-CDYaC_No.js +0 -42
  546. package/dist/web/assets/task-priority-acVgTiil.js +0 -1
  547. package/dist/web/assets/tsMode-Vr3bndW1.js +0 -11
  548. package/dist/web/assets/typescript-BfjoaUSn.js +0 -1
  549. package/dist/web/assets/use-attachments-EypT-7PI.js +0 -2
  550. package/dist/web/assets/use-profiles-nMPGwy3v.js +0 -1
  551. package/dist/web/assets/use-workspaces-d4n9m9cX.js +0 -1
  552. package/dist/web/assets/useNormalizedLogs-DRoPbP0w.js +0 -1
  553. package/dist/web/assets/useTokenUsage-4qTDa8SY.js +0 -1
  554. package/dist/web/assets/xml-BGVoPR0b.js +0 -1
  555. package/dist/web/assets/yaml-eFhNavrs.js +0 -1
@@ -45,6 +45,8 @@ model Task {
45
45
  projectId String
46
46
  project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
47
47
  workspaces Workspace[]
48
+ deliveries MessageDelivery[]
49
+ taskInputSnapshots TeamTaskInputSnapshot[]
48
50
  teamRun TeamRun?
49
51
  deletedAt DateTime?
50
52
  createdAt DateTime @default(now())
@@ -130,6 +132,10 @@ model TeamRun {
130
132
  workRequests WorkRequest[]
131
133
  invocations AgentInvocation[]
132
134
  verdicts WorkspaceVerdict[]
135
+ deliveries MessageDelivery[]
136
+ taskInputSnapshots TeamTaskInputSnapshot[] @relation("TeamSnapshots")
137
+ currentTaskInputSnapshotId String?
138
+ currentTaskInputSnapshot TeamTaskInputSnapshot? @relation("CurrentTaskInput", fields: [currentTaskInputSnapshotId], references: [id], onDelete: SetNull)
133
139
 
134
140
  @@index([mainWorkspaceId])
135
141
  }
@@ -161,6 +167,8 @@ model TeamMember {
161
167
  }
162
168
 
163
169
  model RoomMessage {
170
+ deliveryId String? @unique
171
+ delivery MessageDelivery? @relation(fields: [deliveryId], references: [id], onDelete: Cascade)
164
172
  id String @id @default(uuid())
165
173
  teamRunId String
166
174
  teamRun TeamRun @relation(fields: [teamRunId], references: [id], onDelete: Cascade)
@@ -170,6 +178,7 @@ model RoomMessage {
170
178
  kind String
171
179
  visibility String @default("PUBLIC")
172
180
  content String
181
+ translationEligibilityEpoch Int?
173
182
  mentions String // JSON StructuredMention[]
174
183
  workRequestIds String? // JSON string[]
175
184
  artifactRefs String? // JSON string[]
@@ -180,6 +189,7 @@ model RoomMessage {
180
189
  @@index([teamRunId])
181
190
  @@index([teamRunId, visibility])
182
191
  @@index([senderInvocationId])
192
+ @@index([translationEligibilityEpoch, id])
183
193
  }
184
194
 
185
195
  model RoomMessageParticipant {
@@ -199,6 +209,8 @@ model RoomMessageParticipant {
199
209
  }
200
210
 
201
211
  model WorkRequest {
212
+ taskInputSnapshotId String?
213
+ taskInputSnapshot TeamTaskInputSnapshot? @relation(fields: [taskInputSnapshotId], references: [id], onDelete: SetNull)
202
214
  id String @id @default(uuid())
203
215
  teamRunId String
204
216
  teamRun TeamRun @relation(fields: [teamRunId], references: [id], onDelete: Cascade)
@@ -229,9 +241,12 @@ model WorkRequest {
229
241
  @@index([targetHeadSha])
230
242
  @@index([status])
231
243
  @@index([status, nextStartRetryAt])
244
+ @@index([taskInputSnapshotId, status])
232
245
  }
233
246
 
234
247
  model AgentInvocation {
248
+ taskInputSnapshotId String?
249
+ taskInputSnapshot TeamTaskInputSnapshot? @relation(fields: [taskInputSnapshotId], references: [id], onDelete: SetNull)
235
250
  id String @id @default(uuid())
236
251
  teamRunId String
237
252
  teamRun TeamRun @relation(fields: [teamRunId], references: [id], onDelete: Cascade)
@@ -274,6 +289,8 @@ model AgentInvocation {
274
289
  // WorkspaceStatus: ACTIVE, MERGED, ABANDONED, HIBERNATED
275
290
  // WorkspaceKind: WORKTREE, MAIN_DIRECTORY
276
291
  model Workspace {
292
+ creationSubmissionId String? @unique
293
+ creationFingerprint String?
277
294
  id String @id @default(uuid())
278
295
  taskId String
279
296
  task Task @relation(fields: [taskId], references: [id], onDelete: Cascade)
@@ -404,6 +421,11 @@ model Session {
404
421
  tokenUsage String? // JSON: { totalTokens, modelContextWindow? }
405
422
  processes ExecutionProcess[]
406
423
  artifacts AgentArtifact[]
424
+ creationSubmissionId String? @unique
425
+ creationFingerprint String?
426
+ inputIntent String? // JSON original user input and attachment references
427
+ initialDeliveryId String? @unique
428
+ deliveries MessageDelivery[]
407
429
  conversationTurns ConversationTurn[]
408
430
  createdAt DateTime @default(now())
409
431
  updatedAt DateTime @updatedAt
@@ -418,6 +440,10 @@ model ConversationTurn {
418
440
  id String @id @default(uuid())
419
441
  sessionId String
420
442
  session Session @relation(fields: [sessionId], references: [id], onDelete: Cascade)
443
+ deliveryId String? @unique
444
+ delivery MessageDelivery? @relation(fields: [deliveryId], references: [id], onDelete: Cascade)
445
+ originalText String?
446
+ deliveryRevision Int?
421
447
  message String
422
448
  userEntryId String?
423
449
  providerId String?
@@ -511,6 +537,98 @@ model AppSettings {
511
537
  dataMigrationVersion Int @default(0)
512
538
  }
513
539
 
540
+ // Independent, default-off instance translation configuration. apiKey is server-only.
541
+ // null means unset; the empty string means an explicitly credential-free service.
542
+ model TranslationSettings {
543
+ id String @id @default("singleton")
544
+ enabled Boolean @default(false)
545
+ revision Int @default(0)
546
+ enableEpoch Int @default(0)
547
+ apiBaseUrl String @default("")
548
+ model String @default("")
549
+ apiKey String?
550
+ credentialRevision Int @default(0)
551
+ sendTargetLanguage String @default("English")
552
+ displayTargetLanguage String @default("简体中文")
553
+ promptTemplate String @default("请将以下内容翻译为 {{target_language}},保持原意,只返回译文:\n\n{{text}}")
554
+ maxConcurrency Int @default(4)
555
+ createdAt DateTime @default(now())
556
+ updatedAt DateTime @updatedAt
557
+ }
558
+
559
+ // Polymorphic ownership is checked by TranslationService, never by caller-supplied keys.
560
+ model TranslationSource {
561
+ id String @id @default(uuid())
562
+ scopeType String
563
+ scopeId String
564
+ sourceKind String
565
+ sourceKey String
566
+ laneKey String
567
+ sessionId String?
568
+ turnId String?
569
+ blockId String?
570
+ messageId String?
571
+ deliveryId String?
572
+ delivery MessageDelivery? @relation(fields: [deliveryId], references: [id], onDelete: Cascade)
573
+ direction String
574
+ originalText String
575
+ sourceRevision Int @default(1)
576
+ sourceHash String
577
+ blockState String @default("OPEN")
578
+ jobState String @default("OPEN")
579
+ currentAttemptVersion Int @default(0)
580
+ effectiveAttemptId String?
581
+ generation Int @default(0)
582
+ enableEpoch Int @default(0)
583
+ retryChainId String?
584
+ retryCount Int @default(0)
585
+ budgetStartedAt DateTime?
586
+ nextRetryAt DateTime?
587
+ deletedAt DateTime?
588
+ overlayRevision Int @default(0)
589
+ errorCode String?
590
+ createdAt DateTime @default(now())
591
+ updatedAt DateTime @updatedAt
592
+ attempts TranslationAttempt[]
593
+ taskInputSnapshot TeamTaskInputSnapshot?
594
+
595
+ @@unique([sourceKind, sourceKey, direction])
596
+ @@index([scopeType, scopeId, deletedAt])
597
+ @@index([jobState, nextRetryAt])
598
+ @@index([sessionId])
599
+ @@index([messageId])
600
+ }
601
+
602
+ model TranslationAttempt {
603
+ id String @id @default(uuid())
604
+ sourceId String
605
+ source TranslationSource @relation(fields: [sourceId], references: [id], onDelete: Cascade)
606
+ sourceRevision Int
607
+ sourceHash String
608
+ attemptVersion Int
609
+ configRevision Int
610
+ credentialRevision Int
611
+ targetLanguage String
612
+ sanitizedConfigSnapshot String // JSON; never contains a credential.
613
+ protectionVersion String
614
+ status String @default("RUNNING")
615
+ resultText String?
616
+ errorCode String?
617
+ generation Int
618
+ enableEpoch Int
619
+ retryIndex Int @default(0)
620
+ nextRetryAt DateTime?
621
+ leaseOwner String?
622
+ leaseExpiresAt DateTime?
623
+ startedAt DateTime @default(now())
624
+ completedAt DateTime?
625
+ acceptedTaskInputs TeamTaskInputSnapshot[]
626
+
627
+ @@unique([sourceId, attemptVersion])
628
+ @@index([status, nextRetryAt])
629
+ @@index([sourceId, sourceRevision])
630
+ }
631
+
514
632
  // 访问密码配置 (单例,只有一行)
515
633
  model AccessAuthSettings {
516
634
  id String @id @default("singleton")
@@ -537,3 +655,109 @@ model NotificationSettings {
537
655
  taskInReviewTitleTemplate String @default("Agent Tower")
538
656
  taskInReviewBodyTemplate String @default("✅ \"{taskTitle}\" 已完成,等待审查")
539
657
  }
658
+
659
+ // Durable owner submission. A transport receipt, rather than queue acceptance, releases the channel.
660
+ model MessageDelivery {
661
+ id String @id @default(uuid())
662
+ clientSubmissionId String @unique
663
+ requestFingerprint String
664
+ sessionId String?
665
+ session Session? @relation(fields: [sessionId], references: [id], onDelete: Cascade)
666
+ taskId String?
667
+ task Task? @relation(fields: [taskId], references: [id], onDelete: Cascade)
668
+ teamRunId String?
669
+ teamRun TeamRun? @relation(fields: [teamRunId], references: [id], onDelete: Cascade)
670
+ taskInputSnapshotId String?
671
+ taskInputSnapshot TeamTaskInputSnapshot? @relation(fields: [taskInputSnapshotId], references: [id], onDelete: SetNull)
672
+ channelKey String
673
+ sequence Int
674
+ origin String
675
+ originalText String
676
+ attachmentIds String @default("[]")
677
+ intent String @default("{}")
678
+ sourceRevision Int @default(1)
679
+ sourceHash String
680
+ translationSourceId String? @unique
681
+ enableEpoch Int
682
+ requiresTranslation Boolean
683
+ state String
684
+ sentMode String?
685
+ acceptedText String?
686
+ actualSentText String?
687
+ sentAt DateTime?
688
+ acceptedDestinationId String?
689
+ lastError String?
690
+ revision Int @default(1)
691
+ translationSources TranslationSource[]
692
+ receipt DeliveryReceipt?
693
+ actions DeliveryAction[]
694
+ conversationTurn ConversationTurn?
695
+ roomMessage RoomMessage?
696
+ createdAt DateTime @default(now())
697
+ updatedAt DateTime @updatedAt
698
+ @@unique([channelKey, sequence])
699
+ @@index([sessionId, sequence])
700
+ @@index([taskId, sequence])
701
+ @@index([teamRunId, sequence])
702
+ @@index([taskInputSnapshotId])
703
+ @@index([channelKey, state, sequence])
704
+ @@index([state, updatedAt])
705
+ }
706
+
707
+ model DeliveryReceipt {
708
+ deliveryId String @id
709
+ delivery MessageDelivery @relation(fields: [deliveryId], references: [id], onDelete: Cascade)
710
+ generation Int
711
+ phase String // CLAIMED, WRITING, SUBMITTED, NOT_SUBMITTED, UNKNOWN
712
+ runtimeInstanceId String?
713
+ turnId String?
714
+ evidence String?
715
+ submittedAt DateTime?
716
+ updatedAt DateTime @updatedAt
717
+ }
718
+
719
+ model DeliveryAction {
720
+ actionId String @id
721
+ deliveryId String
722
+ delivery MessageDelivery @relation(fields: [deliveryId], references: [id], onDelete: Cascade)
723
+ fingerprint String
724
+ createdAt DateTime @default(now())
725
+ }
726
+
727
+ // Persistent candidate and immutable accepted task input. Production dispatch is not connected yet.
728
+ model TeamTaskInputSnapshot {
729
+ id String @id @default(uuid())
730
+ teamRunId String
731
+ teamRun TeamRun @relation("TeamSnapshots", fields: [teamRunId], references: [id], onDelete: Cascade)
732
+ taskId String
733
+ task Task @relation(fields: [taskId], references: [id], onDelete: Cascade)
734
+ taskSourceHash String
735
+ originalTitle String
736
+ originalDescription String?
737
+ state String @default("PENDING")
738
+ effectiveUserText String?
739
+ translationSourceId String? @unique
740
+ translationSource TranslationSource? @relation(fields: [translationSourceId], references: [id], onDelete: SetNull)
741
+ acceptedAttemptId String?
742
+ acceptedAttempt TranslationAttempt? @relation(fields: [acceptedAttemptId], references: [id], onDelete: SetNull)
743
+ sentMode String?
744
+ acceptedAt DateTime?
745
+ revision Int @default(1)
746
+ createdAt DateTime @default(now())
747
+ updatedAt DateTime @updatedAt
748
+ currentForTeams TeamRun[] @relation("CurrentTaskInput")
749
+ deliveries MessageDelivery[]
750
+ workRequests WorkRequest[]
751
+ invocations AgentInvocation[]
752
+ actions TeamTaskInputAction[]
753
+ @@unique([teamRunId, taskSourceHash])
754
+ @@index([teamRunId, state])
755
+ }
756
+
757
+ model TeamTaskInputAction {
758
+ actionId String @id
759
+ snapshotId String
760
+ snapshot TeamTaskInputSnapshot @relation(fields: [snapshotId], references: [id], onDelete: Cascade)
761
+ fingerprint String
762
+ createdAt DateTime @default(now())
763
+ }
@@ -1 +0,0 @@
1
- import{c as H,j as e,u as te,af as se,r as n,p as b,B as N,aj as ne,ah as re,ab as ae}from"./index-CMJV-mgF.js";import{u as le,a as oe,L as ie,T as ce}from"./useNormalizedLogs-DRoPbP0w.js";import{a as de}from"./mermaid-NOHMQCX5-C72362la.js";import"./agent-meta-MzuGtqxl.js";import"./use-attachments-EypT-7PI.js";import{d as xe}from"./use-profiles-nMPGwy3v.js";import{C as me}from"./chevron-up-D0y6skqr.js";import{C as ue}from"./chevron-down-BaQEBzp3.js";import{P as he}from"./paperclip-BOSklTt7.js";import{A as pe}from"./at-sign-BE17rU5b.js";import{G as ge}from"./globe-CD4g63c9.js";import"./check-qs0S_9rB.js";const fe=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],be=H("hash",fe);const je=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],ve=H("send",je),B=({className:s})=>e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:s,xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",opacity:"0.4"}),e.jsx("circle",{cx:"8",cy:"8",r:"3",fill:"currentColor"})]}),ye=({className:s})=>e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:s,xmlns:"http://www.w3.org/2000/svg",children:e.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"})}),Ne=({className:s})=>e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:s,xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M13.5 4.5L6.5 11.5L2.5 7.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),we=!0;function Te(){const{t:s}=te(),{preserveDesktopSearch:U}=se(),[w,V]=n.useState([]),[o,S]=n.useState(""),[x,k]=n.useState("DEFAULT"),[i,A]=n.useState(""),[a,C]=n.useState(null),[F,D]=n.useState(null),[l,c]=n.useState("idle"),[g,E]=n.useState(!1),[m,j]=n.useState(""),$=n.useRef(null),I=n.useRef(null),u=n.useRef(null),{data:h}=xe(o),M=h?Object.keys(h):["DEFAULT"],_=t=>{S(t),k("DEFAULT")},G=n.useCallback(t=>{c(t===0?"stopped":"error")},[]),O=n.useCallback(t=>{console.error("Agent error:",t),c("error")},[]),{isConnected:p,isAttached:f,isOutputActive:W,lastExitAt:K,logs:v,entries:q,agentSessionId:L,attach:z,clearLogs:P}=le({sessionId:a||"",sessionStartedAt:F,onExit:G,onError:O}),{todos:R}=oe(q);n.useEffect(()=>{b.get("/demo/agents").then(t=>{V(t.agents);const r=t.agents.find(y=>y.available);r&&S(r.type)})},[]),n.useEffect(()=>{$.current?.scrollToBottom("smooth")},[v]),n.useEffect(()=>{console.log(`[AgentDemoPage:useEffect] t=${Date.now()} sessionId=${a} isConnected=${p} isAttached=${f}`),a&&p&&!f&&(console.log(`[AgentDemoPage:useEffect] t=${Date.now()} calling attach()`),z())},[a,p,f,z]);const J=t=>{if(j(t.target.value),u.current){u.current.style.height="auto";const y=Math.min(u.current.scrollHeight,210);u.current.style.height=`${y}px`}},Q=async()=>{if(!o||!i.trim())return;const t=Date.now();console.log(`[AgentDemoPage:handleStart] t=${t} starting...`),c("starting"),P();try{const r=await b.post("/demo/start",{agentType:o,prompt:i.trim(),variant:x});we&&console.log(`[AgentDemoPage:handleStart] t=${Date.now()} apiTime=${Date.now()-t}ms sessionId=${r.sessionId}`),C(r.sessionId),D(t),c("running")}catch(r){console.error("Start failed:",r),c("error")}},T=async()=>{if(!a||!m.trim())return;const t=m.trim();j("");try{await b.post(`/demo/${a}/message`,{message:t})}catch(r){console.error("Send failed:",r)}},X=async()=>{if(a)try{await b.post(`/demo/${a}/stop`),c("stopped")}catch(t){console.error("Stop failed:",t)}},Y=()=>{C(null),D(null),c("idle"),A(""),j(""),P()},Z=l==="running",d=a!==null,ee=w.find(t=>t.type===o);return e.jsxs("div",{className:"flex flex-col h-full bg-white",children:[e.jsxs("div",{className:"px-8 py-5 border-b border-neutral-100 bg-white transition-all duration-300",children:[e.jsxs("div",{className:"flex items-center flex-wrap gap-3",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("span",{className:"text-base font-medium text-blue-600",children:"Agent Demo"}),e.jsx("span",{className:"text-neutral-300 text-sm",children:"/"}),e.jsx("span",{className:"text-xl font-bold text-neutral-900 tracking-tight",children:d?i.slice(0,50)+(i.length>50?"...":""):s("新会话")})]}),e.jsxs("div",{className:"flex items-center",children:[l==="running"&&e.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-0.5 bg-blue-50 text-blue-700 rounded-full text-xs font-medium border border-blue-100",children:[e.jsx(B,{className:"w-3.5 h-3.5 animate-pulse"}),e.jsx("span",{children:"Running"})]}),l==="stopped"&&e.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-0.5 bg-emerald-50 text-emerald-700 rounded-full text-xs font-medium border border-emerald-100",children:[e.jsx(Ne,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Done"})]}),l==="idle"&&e.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-0.5 bg-neutral-100 text-neutral-600 rounded-full text-xs font-medium border border-neutral-200",children:[e.jsx(ye,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Idle"})]}),l==="starting"&&e.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-0.5 bg-amber-50 text-amber-700 rounded-full text-xs font-medium border border-amber-100",children:[e.jsx(B,{className:"w-3.5 h-3.5 animate-spin"}),e.jsx("span",{children:"Starting..."})]}),l==="error"&&e.jsx("div",{className:"flex items-center gap-1.5 px-2.5 py-0.5 bg-red-50 text-red-700 rounded-full text-xs font-medium border border-red-100",children:e.jsx("span",{children:"Error"})})]})]}),d&&e.jsxs("div",{className:"mt-1.5 flex items-start gap-2 group max-w-4xl",children:[e.jsx("div",{className:`text-sm text-neutral-600 leading-relaxed cursor-pointer transition-all ${g?"":"truncate"}`,onClick:()=>E(!g),children:i}),e.jsx("button",{onClick:()=>E(!g),className:"mt-0.5 text-neutral-400 opacity-0 group-hover:opacity-100 hover:text-neutral-600 transition-opacity",children:g?e.jsx(me,{size:14}):e.jsx(ue,{size:14})})]}),e.jsxs("div",{className:"flex items-center gap-6 mt-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"text-neutral-400 font-medium",children:"Agent"}),e.jsx("div",{className:"flex items-center gap-1.5 text-neutral-900 font-medium bg-neutral-50 px-2 py-1 rounded border border-neutral-100",children:ee?.name||o||s("未选择")})]}),x!=="DEFAULT"&&e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"text-neutral-400 font-medium",children:"Variant"}),e.jsx("div",{className:"flex items-center gap-1.5 text-neutral-700 font-medium bg-blue-50 px-2 py-1 rounded border border-blue-100",children:x})]}),L&&e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"text-neutral-400 font-medium",children:"Session"}),e.jsxs("div",{className:"flex items-center gap-1.5 text-neutral-700 font-mono bg-neutral-50 px-2 py-1 rounded border border-neutral-100",children:[L.slice(0,8),"..."]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"text-neutral-400 font-medium",children:s("连接")}),e.jsx("div",{className:`flex items-center gap-1.5 font-medium px-2 py-1 rounded border ${p?"text-emerald-700 bg-emerald-50 border-emerald-100":"text-neutral-500 bg-neutral-50 border-neutral-100"}`,children:s(p?f?"已连接":"连接中...":"未连接")})]}),d&&e.jsx(N,{variant:"outline",size:"sm",onClick:Y,className:"ml-auto",children:s("新会话")}),e.jsxs(ne,{to:U("/settings/profiles"),className:`flex items-center gap-1.5 text-xs text-neutral-500 hover:text-neutral-900 transition-colors ${d?"":"ml-auto"}`,children:[e.jsx(re,{size:14}),e.jsx("span",{children:s("Profiles 设置")})]})]})]}),e.jsx("div",{ref:I,className:"flex-1 overflow-y-auto px-8 py-6",children:d?e.jsx("div",{className:"min-h-[200px]",children:v.length===0?e.jsx("div",{className:"text-neutral-400 text-center py-8",children:s("等待 Agent 响应...")}):e.jsx(ie,{children:e.jsx(de,{ref:$,logs:v,isOutputActive:W,lastExitAt:K,scrollElementRef:I})})}):e.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold mb-3 text-neutral-900",children:s("选择 Agent")}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:w.map(t=>e.jsxs(N,{variant:o===t.type?"default":"outline",disabled:!t.available,onClick:()=>_(t.type),children:[t.name,t.available&&t.version&&` (${t.version})`,!t.available&&s(" (不可用)")]},t.type))})]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold mb-3 text-neutral-900",children:s("配置变体 (Profile Variant)")}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:M.map(t=>e.jsx("button",{onClick:()=>k(t),className:`px-3 py-1.5 rounded-full text-sm font-medium border transition-colors ${x===t?"bg-neutral-900 text-white border-neutral-900":"bg-white text-neutral-600 border-neutral-200 hover:border-neutral-400"}`,children:t},t))}),h&&h[x]&&e.jsx("p",{className:"mt-2 text-xs text-neutral-500 font-mono",children:Object.entries(h[x]).map(([t,r])=>`${t}: ${JSON.stringify(r)}`).join(", ")})]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold mb-3 text-neutral-900",children:s("输入任务")}),e.jsxs("div",{className:"relative border border-neutral-200 rounded-xl shadow-sm bg-white focus-within:ring-1 focus-within:ring-neutral-300 focus-within:border-neutral-300 transition-all duration-200",children:[e.jsx("textarea",{value:i,onChange:t=>A(t.target.value),rows:4,placeholder:s("描述你想让 Agent 完成的任务..."),className:"w-full px-4 py-3 bg-transparent border-none focus:outline-none focus:ring-0 resize-none text-neutral-900 placeholder-neutral-400 leading-relaxed text-sm"}),e.jsx("div",{className:"flex items-center justify-end px-3 pb-3 pt-1",children:e.jsx(N,{onClick:Q,disabled:l==="starting"||!o||!i.trim(),children:s(l==="starting"?"启动中...":"开始")})})]})]})]})}),d&&R.length>0&&e.jsx("div",{className:"px-8 py-2 bg-white border-t border-neutral-100",children:e.jsx(ce,{todos:R})}),d&&e.jsx("div",{className:"px-8 py-6 border-t border-neutral-100 bg-white",children:e.jsxs("div",{className:"relative border border-neutral-200 rounded-xl shadow-sm bg-white focus-within:ring-1 focus-within:ring-neutral-300 focus-within:border-neutral-300 transition-all duration-200",children:[e.jsx("textarea",{ref:u,value:m,onChange:J,rows:3,placeholder:s("发送消息给 Agent..."),className:"w-full px-4 py-3 bg-transparent border-none focus:outline-none focus:ring-0 resize-none text-neutral-900 placeholder-neutral-400 leading-relaxed text-sm scrollbar-thin scrollbar-thumb-neutral-200 scrollbar-track-transparent",style:{minHeight:"80px",maxHeight:"210px"},onKeyDown:t=>{t.key==="Enter"&&!t.shiftKey&&!t.repeat&&!t.nativeEvent.isComposing&&t.nativeEvent.keyCode!==229&&(t.preventDefault(),T())}}),e.jsxs("div",{className:"flex items-center justify-between px-3 pb-3 pt-1 border-t border-transparent",children:[e.jsxs("div",{className:"flex items-center gap-1 text-neutral-400",children:[e.jsx("button",{className:"p-2 hover:bg-neutral-100 hover:text-neutral-600 rounded-lg transition-colors",title:"Attach File",children:e.jsx(he,{size:18})}),e.jsx("button",{className:"p-2 hover:bg-neutral-100 hover:text-neutral-600 rounded-lg transition-colors",title:"Mention",children:e.jsx(pe,{size:18})}),e.jsx("button",{className:"p-2 hover:bg-neutral-100 hover:text-neutral-600 rounded-lg transition-colors",title:"Reference Issue",children:e.jsx(be,{size:18})}),e.jsx("div",{className:"w-px h-4 bg-neutral-200 mx-1"}),e.jsx("button",{className:"p-2 hover:bg-neutral-100 hover:text-neutral-600 rounded-lg transition-colors",title:"Search Web",children:e.jsx(ge,{size:18})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[Z&&e.jsxs("button",{onClick:X,className:"flex items-center gap-2 px-3 py-2 text-xs font-semibold text-red-600 bg-red-50 hover:bg-red-100 rounded-lg transition-colors",children:[e.jsx(ae,{size:12,fill:"currentColor"}),e.jsx("span",{children:s("停止")})]}),e.jsxs("button",{onClick:T,disabled:!m.trim(),className:`flex items-center gap-2 px-3 py-2 text-xs font-semibold rounded-lg transition-all ${m.trim()?"bg-neutral-900 text-white hover:bg-black shadow-sm":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:[e.jsx("span",{children:s("发送")}),e.jsx(ve,{size:14})]})]})]})]})})]})}export{Te as AgentDemoPage};
@@ -1 +0,0 @@
1
- import{r as a,j as o,C as g,l as s}from"./index-CMJV-mgF.js";import{g as l}from"./agent-meta-MzuGtqxl.js";function d({agentType:n,className:r,fallbackClassName:i}){const e=l(n),[c,t]=a.useState(!1);return a.useEffect(()=>{t(!1)},[e?.logoSrc]),!e?.logoSrc||c?o.jsx(g,{"aria-hidden":"true",className:s("shrink-0 text-muted-foreground",r,i)}):o.jsx("img",{src:e.logoSrc,alt:"","aria-hidden":"true",className:s("shrink-0 object-contain",r),draggable:!1,onError:()=>t(!0)})}export{d as A};
@@ -1 +0,0 @@
1
- import{u as I,r as i,j as a,l as j,E as M}from"./index-CMJV-mgF.js";import{P as S,a as A,B,b as P,S as z,M as K,c as U,d as R}from"./task-CDYaC_No.js";import"./agent-meta-MzuGtqxl.js";import{G as $}from"./task-priority-acVgTiil.js";import{C as L}from"./chevron-down-BaQEBzp3.js";import{C as O}from"./check-qs0S_9rB.js";function F({id:y,label:p,value:o,branches:l,disabled:N,isRefreshing:k,onChange:v,onOpen:C}){const{t}=I(),h=i.useId(),u=i.useRef(null),[c,g]=i.useState(!1),[r,f]=i.useState(""),[m,s]=i.useState(0),n=l.filter(e=>e.toLowerCase().includes(r.trim().toLowerCase())),x=n[m],E=l.includes(o),w=e=>{g(e),e&&(f(""),s(Math.max(0,l.indexOf(o))),C())},b=e=>{v(e),g(!1)};i.useEffect(()=>{c&&u.current?.querySelector("[data-highlighted]")?.scrollIntoView?.({block:"nearest"})},[c,m,r]);const D=e=>{e.nativeEvent.isComposing||(e.key==="ArrowDown"||e.key==="ArrowUp"?(e.preventDefault(),s(d=>Math.max(0,Math.min(n.length-1,d+(e.key==="ArrowDown"?1:-1))))):!r&&(e.key==="Home"||e.key==="End")?(e.preventDefault(),s(e.key==="Home"?0:Math.max(0,n.length-1))):e.key==="Enter"&&x&&(e.preventDefault(),b(x)))};return a.jsxs(S,{open:c,onOpenChange:w,children:[a.jsx(A,{asChild:!0,children:a.jsxs(B,{id:y,"aria-label":p,"aria-haspopup":"listbox",disabled:N,size:"lg",title:o,className:"w-full min-w-0 justify-between border border-input px-3 font-normal shadow-none ring-0 hover:border-ring/50 hover:bg-background focus-visible:border-ring focus-visible:ring-0 data-[state=open]:border-ring",onKeyDown:e=>{!c&&(e.key==="ArrowDown"||e.key==="ArrowUp")&&(e.preventDefault(),w(!0))},children:[a.jsx($,{className:"size-3.5 text-muted-foreground"}),a.jsxs("span",{className:"min-w-0 flex-1 truncate text-left",children:[o,!E&&` (${t("Unavailable")})`]}),a.jsx(L,{className:j("size-3.5 text-muted-foreground transition-transform",c&&"rotate-180")})]})}),a.jsxs(P,{"aria-label":p,className:"z-[70] flex max-h-[min(24rem,var(--radix-popover-content-available-height))] w-(--radix-popover-trigger-width) max-w-[calc(100vw-1rem)] flex-col overflow-hidden p-1",onKeyDown:e=>{e.key==="Escape"&&e.stopPropagation()},onEscapeKeyDown:e=>{e.stopPropagation(),r&&(e.preventDefault(),f(""),s(0))},children:[a.jsx("div",{className:"shrink-0 p-1",children:a.jsx(z,{"aria-label":t("Search branches"),placeholder:t("Search branches"),role:"combobox","aria-expanded":!0,"aria-autocomplete":"list","aria-controls":h,"aria-activedescendant":x?`${h}-${m}`:void 0,value:r,onValueChange:e=>{f(e),s(0)},onKeyDown:D})}),a.jsxs("div",{ref:u,id:h,role:"listbox","aria-label":p,className:"min-h-0 flex-1 overflow-y-auto overscroll-contain",children:[n.map((e,d)=>a.jsxs("button",{id:`${h}-${d}`,type:"button",role:"option","aria-selected":e===o,"data-highlighted":d===m?"":void 0,tabIndex:-1,title:e,onPointerMove:()=>s(d),onClick:()=>b(e),className:j(R,U,e===o&&"font-medium text-foreground"),children:[a.jsx("span",{className:"min-w-0 flex-1 truncate",children:e}),e===o&&a.jsx("span",{className:K,children:a.jsx(O,{className:"size-3.5"})})]},e)),n.length===0&&a.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:t("No matching branches")})]}),a.jsxs("div",{role:"status",className:"flex shrink-0 items-center gap-1.5 border-t border-border/60 px-2 pt-2 pb-1 text-[11px] tabular-nums text-muted-foreground",children:[k&&a.jsx(M,{className:"size-3 animate-spin","aria-label":t("Refreshing branches")}),r.trim()?t("{shown} of {total} local branches",{shown:n.length,total:l.length}):t("{count} local branches",{count:l.length})]})]})]})}export{F as B};
@@ -1 +0,0 @@
1
- import{c as a,j as o}from"./index-CMJV-mgF.js";const n=[["path",{d:"M5 12h14",key:"1ays0h"}]],r=a("minus",n);const s=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],p=a("square-pen",s),t="/assets/agent-tower-lockup-DPAcheCt.png";function u({className:e="h-6 w-auto max-[359px]:h-[22px]"}){return o.jsx("img",{src:t,alt:"Agent Tower",className:`block shrink-0 select-none object-contain ${e}`})}export{u as B,r as M,p as S};
@@ -1,3 +0,0 @@
1
- import{c as ze,u as de,r,j as e,ab as Oe,l as j,m as ke,o as X,n as ce,q as f,p as _,ae as Ke,af as Qe,ag as Fe,_ as Ue,$ as je,ah as Be,ai as _e,s as $e,ac as le}from"./index-CMJV-mgF.js";import{g as Ve,a as Ge}from"./ExecutionPermissionSelector-DeeNd4Kh.js";import{S as A}from"./agent-meta-MzuGtqxl.js";import{a as He}from"./mermaid-NOHMQCX5-C72362la.js";import{u as We,a as Je,L as Ye,T as Xe}from"./useNormalizedLogs-DRoPbP0w.js";import{u as Ze,a as et,R as tt,P as st,T as nt}from"./useTokenUsage-4qTDa8SY.js";import{u as rt,A as at}from"./use-attachments-EypT-7PI.js";import{u as ot,C as it}from"./CreateTaskInput-GLF3Oyc1.js";import{A as lt}from"./arrow-down-BVePf1ZM.js";import{P as dt}from"./paperclip-BOSklTt7.js";import{A as ct,S as Se}from"./task-priority-acVgTiil.js";import{B as ut,S as mt}from"./BrandLogo-YGT4Vlw5.js";import{u as ft}from"./use-providers-DB9ghBPq.js";import{M as he}from"./message-square-CFriSt4D.js";import{T as xt}from"./trash-2-Bc-URu8c.js";import"./chevron-down-BaQEBzp3.js";import"./check-qs0S_9rB.js";import"./gauge-CPlvCZUV.js";import"./AgentLogo-BDyW3ihb.js";import"./use-projects-DI27nNwl.js";import"./MemberAvatar-CCRbS97s.js";const pt=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}],["path",{d:"M14 4h7",key:"3xa0d5"}],["path",{d:"M14 9h7",key:"1icrd9"}],["path",{d:"M14 15h7",key:"1mj8o2"}],["path",{d:"M14 20h7",key:"11slyb"}]],ht=ze("layout-list",pt);function gt({sessionId:t,sessionStatus:n,sessionStartedAt:i,sessionEndedAt:x,agentType:w,runtimeType:h,providerId:u,providers:b,initialTokenUsage:v,onProviderChange:C,onSend:k,onStop:D,onExit:O,isSending:S=!1,isStopping:o=!1,canStop:m,className:ue}){const{t:g}=de(),[I,K]=r.useState(""),[L,Q]=r.useState(u??""),N=Ve(b,L||u),[Z,$]=r.useState(!1),[ee,F]=r.useState(null),V=r.useRef(null),te=r.useRef(null),G=r.useRef(null),P=r.useRef(!1),{scrollRef:H,contentRef:l,isAtBottom:W,scrollToBottom:M,stopScroll:se}=Ze({initial:"instant",resize:"smooth"}),{isConnected:R,isLoadingSnapshot:me,isOutputActive:E,lastExitAt:ne,logs:J,entries:re,attach:U}=We({sessionId:t,sessionStatus:n,sessionStartedAt:i,sessionEndedAt:x,onExit:O}),{todos:Y}=Je(re),fe=et(J,v),{files:ae,addFiles:T,removeFile:xe,clear:oe,buildMarkdownLinks:ie,getDoneAttachments:s,hasFiles:a,isUploading:d}=rt(),{isActive:p,isCancelling:q}=ot(t,n),pe=m??p;r.useEffect(()=>{Q(u??"")},[u]),r.useEffect(()=>{t&&R&&U()},[t,R,U]);const De=r.useCallback(c=>{Q(c),C?.(c)},[C]),ve=r.useCallback(()=>{V.current&&(V.current.style.height="60px")},[]),Ee=r.useCallback(c=>{K(c.target.value);const y=c.target;y.style.height="auto",y.style.height=`${Math.max(60,Math.min(y.scrollHeight,300))}px`},[]),be=r.useCallback(async()=>{if(!I.trim()&&!a||P.current||S||o||q||d||N)return;P.current=!0;const c=ie(),y=s().map(z=>z.id),B=[I.trim(),c].filter(Boolean).join(`
2
-
3
- `);K(""),oe(),ve(),F(null);try{await k({message:B,providerId:L||void 0,attachmentIds:y}),await U(),requestAnimationFrame(()=>M("smooth"))}catch(z){F(z instanceof Error?z.message:g("Send failed. Please try again.")),K(B)}finally{P.current=!1}},[I,a,S,o,q,d,ie,s,oe,ve,k,L,N,U,M,g]),Te=r.useCallback(async()=>{!pe||o||q||await D()},[pe,o,q,D]),Le=r.useCallback(c=>{const y=c.target.files;y&&y.length>0&&T(Array.from(y)),c.target.value=""},[T]),Pe=r.useCallback(c=>{const y=c.clipboardData.items,B=[];for(const z of y)if(z.kind==="file"){const ye=z.getAsFile();ye&&B.push(ye)}B.length>0&&(c.preventDefault(),T(B))},[T]),Me=r.useCallback(c=>{c.preventDefault(),$(!0)},[]),Re=r.useCallback(c=>{c.preventDefault(),$(!1)},[]),qe=r.useCallback(c=>{c.preventDefault(),$(!1);const y=c.dataTransfer.files;y.length>0&&T(Array.from(y))},[T]);return e.jsxs("div",{className:j("relative flex min-h-0 flex-1 flex-col bg-background",ue),children:[e.jsxs("div",{className:"relative min-h-0 flex-1",children:[e.jsx("div",{ref:H,className:"h-full overflow-y-auto scrollbar-app-thin px-6 pb-4 pt-6",children:e.jsx("div",{ref:l,className:"mx-auto w-full min-w-0 max-w-4xl",children:me?e.jsxs("div",{className:"flex items-center justify-center gap-3 py-12 text-muted-foreground/70",children:[e.jsxs("svg",{className:"h-5 w-5 animate-spin",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),e.jsx("span",{className:"text-sm",children:g("Loading logs...")})]}):J.length===0?e.jsx("div",{className:"py-8 text-center text-muted-foreground/70",children:g(p?"Waiting for agent output...":"No logs recorded for this session.")}):e.jsx(Ye,{children:e.jsx(He,{logs:J,downloadSessionId:t,isOutputActive:E,lastExitAt:ne,onUserToggleDetails:se,scrollElementRef:H})})})}),!W&&e.jsxs("button",{type:"button",onClick:()=>M(),className:"absolute bottom-3 left-1/2 z-10 flex -translate-x-1/2 items-center gap-1.5 rounded-full border border-border bg-background/90 px-3 py-1.5 text-xs text-muted-foreground shadow-md backdrop-blur-sm transition-all hover:bg-background hover:text-foreground","aria-label":g("Scroll to bottom"),children:[e.jsx(lt,{size:14}),e.jsx("span",{children:g("Back to bottom")})]})]}),Y.length>0&&e.jsx("div",{className:"shrink-0 border-t border-border/60 bg-background px-6 pb-1 pt-2",children:e.jsx("div",{className:"mx-auto max-w-4xl",children:e.jsx(Xe,{todos:Y})})}),e.jsx("div",{className:"z-10 w-full shrink-0 border-t border-transparent bg-background p-6 pb-6 pt-2",onDragOver:Me,onDragLeave:Re,onDrop:qe,children:e.jsxs("div",{className:"mx-auto max-w-4xl",children:[e.jsx(tt,{sessionId:t}),ee?e.jsx("div",{className:"mb-2 text-sm text-destructive",children:ee}):null,e.jsxs("div",{ref:G,className:j("relative rounded-xl border bg-background transition-colors duration-200 hover:border-ring/40 focus-within:border-ring/60",Z?"border-info bg-info/5":"border-border"),children:[e.jsx(at,{files:ae,onRemove:xe}),e.jsx("textarea",{ref:V,value:I,onChange:Ee,onPaste:Pe,onKeyDown:c=>{c.key==="Enter"&&!c.shiftKey&&!c.repeat&&!c.nativeEvent.isComposing&&c.nativeEvent.keyCode!==229&&(c.preventDefault(),be())},rows:1,placeholder:g(Z?"Drop files here...":t&&!p?"Continue conversation...":"Message Agent..."),className:"w-full resize-none border-none bg-transparent px-4 pb-2 pt-4 text-sm leading-relaxed text-foreground placeholder-muted-foreground/70 focus:outline-none",style:{minHeight:"60px",maxHeight:"300px"}}),e.jsx("input",{ref:te,type:"file",multiple:!0,className:"hidden",onChange:Le}),e.jsxs("div",{className:"flex items-center justify-between px-2 pb-2 pt-1",children:[e.jsx("div",{className:"flex items-center gap-1",children:e.jsx("button",{type:"button",onClick:()=>te.current?.click(),disabled:d,className:"rounded-lg p-2 text-muted-foreground/70 transition-colors hover:bg-muted hover:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",title:g("Upload file"),children:e.jsx(dt,{size:18})})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(st,{providers:b,currentProviderId:L,agentType:w,runtimeType:h,onSelect:De}),e.jsx(nt,{usage:fe}),pe&&p&&!I.trim()&&!a?e.jsx("button",{type:"button",onClick:Te,disabled:o||q,className:"rounded-lg bg-destructive p-2 text-white transition-all duration-200 hover:bg-destructive/90 disabled:opacity-50",title:g("Stop"),children:e.jsx(Oe,{size:14})}):e.jsx("button",{type:"button",onClick:be,disabled:!I.trim()&&!a||d||S||o||q||!!N,className:j("rounded-lg p-2 transition-all duration-200",(I.trim()||a)&&!d&&!S&&!o&&!q&&!N?"bg-primary text-primary-foreground hover:bg-primary/90":"cursor-not-allowed bg-transparent text-muted-foreground/50"),title:g("Send"),children:e.jsx(ct,{size:18})})]})]})]})]})})]})}function vt(t=50){return ke({queryKey:f.conversations.list({limit:t}),queryFn:()=>_.get("/conversations",{params:{limit:String(t)}})})}function bt(t){return ke({queryKey:f.conversations.detail(t??""),queryFn:()=>_.get(`/conversations/${t}`),enabled:!!t})}function yt(){const t=X();return ce({mutationFn:n=>_.post("/conversations",n),onSuccess:n=>{t.setQueryData(f.conversations.detail(n.id),n),t.invalidateQueries({queryKey:f.conversations.all}),t.invalidateQueries({queryKey:f.sessions.detail(n.sessionId)})}})}function jt(){const t=X();return ce({mutationFn:({id:n,...i})=>_.post(`/conversations/${n}/message`,i),onSuccess:n=>{t.setQueryData(f.conversations.detail(n.id),n),t.invalidateQueries({queryKey:f.conversations.all}),t.invalidateQueries({queryKey:f.sessions.detail(n.sessionId)})}})}function Nt(){const t=X();return ce({mutationFn:n=>_.post(`/conversations/${n}/stop`),onSuccess:n=>{t.setQueryData(f.conversations.detail(n.id),n),t.invalidateQueries({queryKey:f.conversations.all}),t.invalidateQueries({queryKey:f.sessions.detail(n.sessionId)})},onSettled:(n,i,x)=>{const w=t.getQueryData(f.conversations.detail(x)),h=n?.sessionId??w?.sessionId;t.invalidateQueries({queryKey:f.conversations.detail(x)}),h&&(t.invalidateQueries({queryKey:f.sessions.detail(h)}),t.invalidateQueries({queryKey:f.sessions.runtime(h)}))}})}function wt(){const t=X();return ce({mutationFn:n=>_.delete(`/conversations/${n}`),onSuccess:(n,i)=>{t.removeQueries({queryKey:f.conversations.detail(i)}),t.invalidateQueries({queryKey:f.conversations.all})}})}const Ct=3e4,Ie="agent-tower:conversation-read-times";function kt(){try{const t=window.localStorage.getItem(Ie);if(!t)return{};const n=JSON.parse(t);return!n||typeof n!="object"||Array.isArray(n)?{}:Object.fromEntries(Object.entries(n).map(([i,x])=>[i,typeof x=="number"?x:Number(x)]).filter(i=>Number.isFinite(i[1])))}catch{return{}}}function Ne(t){try{window.localStorage.setItem(Ie,JSON.stringify(t))}catch{}}function we(t){const n=t.lastActiveAt??t.updatedAt??t.createdAt;if(!n)return 0;const i=new Date(n).getTime();return Number.isFinite(i)?i:0}function St(t=Ct){const[,n]=r.useState(0);r.useEffect(()=>{const i=setInterval(()=>n(x=>x+1),t);return()=>clearInterval(i)},[t])}function ge(t){return t===A.RUNNING||t===A.PENDING}function Ae(t){if(!t)return"";const n=new Date(t);if(Number.isNaN(n.getTime()))return"";const i=Math.max(0,Math.floor((Date.now()-n.getTime())/1e3));return i<60?le("{count}s ago",{count:i}):i<3600?le("{count}m ago",{count:Math.floor(i/60)}):i<86400?le("{count}h ago",{count:Math.floor(i/3600)}):le("{count}d ago",{count:Math.floor(i/86400)})}function It(t,n){switch(t){case A.RUNNING:return n("Running");case A.PENDING:return n("Starting");case A.COMPLETED:return n("Completed");case A.FAILED:return n("Failed");case A.CANCELLED:return n("Stopped");default:return t}}function Ce({className:t,pulseClassName:n}){return e.jsxs("span",{className:"relative inline-flex h-2 w-2",children:[e.jsx("span",{className:j("absolute inline-flex h-full w-full animate-ping rounded-full",n)}),e.jsx("span",{className:j("relative inline-flex h-2 w-2 rounded-full",t)})]})}function At({status:t,unread:n}){return ge(t)?e.jsx(Ce,{className:"bg-success",pulseClassName:"bg-success/70"}):n?e.jsx(Ce,{className:"bg-warning",pulseClassName:"bg-warning/70"}):null}function Dt({conversation:t,selected:n,onSelect:i,onDelete:x,disabled:w,unread:h}){const{t:u}=de(),b=Ae(t.lastActiveAt??t.createdAt),v=ge(t.status)||h;return e.jsxs("div",{className:j("group ml-4 mr-2 flex items-center rounded-md transition-colors",n?"bg-accent":"hover:bg-accent/50"),children:[e.jsxs("button",{type:"button",onClick:i,title:t.title,className:"flex min-w-0 flex-1 animate-task-enter items-center gap-2.5 rounded-md px-2 py-2 text-left text-sm",children:[e.jsx("span",{className:"flex h-3.5 w-3.5 shrink-0 items-center justify-center",children:e.jsx(he,{size:14,className:"text-muted-foreground"})}),e.jsx("span",{className:j("min-w-0 flex-1 truncate",n?"font-medium text-foreground":"text-foreground/90"),children:t.title}),v?e.jsx("span",{className:"flex h-3.5 w-3.5 shrink-0 items-center justify-center",children:e.jsx(At,{status:t.status,unread:h})}):e.jsx("span",{className:"flex w-14 shrink-0 items-center justify-end text-[11px] tabular-nums text-muted-foreground/50",children:e.jsx("span",{className:"truncate group-hover:hidden",children:b})})]}),e.jsx("button",{type:"button",onClick:C=>{C.stopPropagation(),x()},disabled:w,className:"mr-1 hidden shrink-0 rounded-md p-1.5 text-muted-foreground hover:bg-background hover:text-destructive disabled:opacity-50 group-hover:flex",title:u("Delete"),children:e.jsx(xt,{size:14})})]})}function Et({isOpen:t,conversations:n,onClose:i,onSelectConversation:x}){const{t:w}=de(),[h,u]=r.useState(""),[b,v]=r.useState(0),C=r.useRef(null);r.useEffect(()=>{t&&(u(""),v(0))},[t]);const k=r.useMemo(()=>{const o=h.trim().toLowerCase();return o?n.filter(m=>m.title.toLowerCase().includes(o)).slice(0,50):n.slice(0,12)},[n,h]);r.useEffect(()=>{v(0)},[h]),r.useEffect(()=>{C.current?.children[b]?.scrollIntoView({block:"nearest"})},[b]);const D=r.useCallback(o=>{x(o),i()},[i,x]),O=r.useCallback(o=>{if(o.key==="Escape"){o.preventDefault(),i();return}if(o.key==="ArrowDown"){o.preventDefault(),v(m=>Math.min(m+1,k.length-1));return}if(o.key==="ArrowUp"){o.preventDefault(),v(m=>Math.max(m-1,0));return}if(o.key==="Enter"&&!o.nativeEvent.isComposing){o.preventDefault();const m=k[b];m&&D(m)}},[b,D,i,k]);if(!t)return null;const S=h.trim().length>0;return e.jsxs("div",{className:"fixed inset-0 z-90",role:"dialog","aria-modal":"true",children:[e.jsx("div",{className:"absolute inset-0 bg-black/20",onClick:i}),e.jsxs("div",{className:"absolute left-1/2 top-[18vh] w-[min(560px,calc(100vw-2rem))] -translate-x-1/2 overflow-hidden rounded-xl border border-border bg-popover shadow-lg animate-in fade-in zoom-in-95 duration-100",children:[e.jsxs("div",{className:"flex items-center gap-2.5 border-b border-border/60 px-4",children:[e.jsx(Se,{size:15,className:"shrink-0 text-muted-foreground/70"}),e.jsx("input",{value:h,onChange:o=>u(o.target.value),onKeyDown:O,placeholder:w("Search conversations..."),"aria-label":w("Search conversations..."),autoFocus:!0,className:"flex-1 border-none bg-transparent py-3 text-sm text-foreground placeholder-muted-foreground/60 focus:outline-none"})]}),k.length>0?e.jsxs(e.Fragment,{children:[S?null:e.jsx("div",{className:"px-4 pb-1 pt-2.5 text-[11px] font-medium text-muted-foreground/70",children:w("Recent conversations")}),e.jsx("div",{ref:C,className:"max-h-[46vh] overflow-y-auto pb-1.5 pt-0.5 scrollbar-app-thin",children:k.map((o,m)=>e.jsxs("button",{type:"button",onClick:()=>D(o),onMouseEnter:()=>v(m),className:j("flex w-full items-center gap-2.5 px-4 py-2 text-left transition-colors",m===b&&"bg-accent"),children:[e.jsx(he,{size:14,className:"shrink-0 text-muted-foreground"}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground/90",title:o.title,children:o.title}),e.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground/60",children:Ae(o.lastActiveAt??o.createdAt)})]},o.id))})]}):e.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground/70",children:w("No matching conversations")})]})]})}function Xt(){const{t}=de();St();const n=Ke(),{usesIntegratedTitlebar:i,desktopPlatform:x,hasMacTrafficLights:w}=Qe(),h=i&&x==="win32",{conversationId:u}=Fe(),b=X(),[v,C]=r.useState(""),[k,D]=r.useState("idle"),[O,S]=r.useState(null),[o,m]=r.useState(!1),[ue,g]=r.useState(!1),[I,K]=r.useState(kt),[L,Q]=r.useState(()=>new Set),{data:N=[],isLoading:Z}=vt(),{data:$,isLoading:ee}=bt(u),{data:F=[],isLoading:V}=ft(),te=yt(),G=jt(),P=Nt(),H=wt(),l=$??N.find(s=>s.id===u)??null,W=r.useMemo(()=>F.map(s=>{const a=Ge(s);return{id:s.provider.id,name:s.provider.name,agentType:s.provider.agentType,available:!a,permissionMode:s.provider.executionPermission,reason:a}}),[F]),M=!!u,se=M||o,R=r.useCallback(s=>{b.invalidateQueries({queryKey:f.conversations.all}),s&&b.invalidateQueries({queryKey:f.conversations.detail(s)})},[b]),me=r.useCallback(()=>{R(u)},[u,R]),E=r.useCallback(s=>{if(Q(d=>{if(!d.has(s.id))return d;const p=new Set(d);return p.delete(s.id),p}),s.status!==A.COMPLETED)return;const a=Math.max(Date.now(),we(s));K(d=>{if(d[s.id]&&d[s.id]>=a)return d;const p={...d,[s.id]:a};return Ne(p),p})},[]),ne=r.useCallback(s=>{Q(a=>{if(a.has(s))return a;const d=new Set(a);return d.add(s),d})},[]),J=r.useCallback(s=>{Q(a=>{if(!a.has(s))return a;const d=new Set(a);return d.delete(s),d}),K(a=>{if(!(s in a))return a;const d={...a};return delete d[s],Ne(d),d})},[]),re=r.useMemo(()=>{const s=new Map;for(const a of N)s.set(a.sessionId,a);return l&&s.set(l.sessionId,l),s},[l,N]),U=r.useCallback(s=>s.status!==A.COMPLETED?!1:L.has(s.id)?!0:we(s)>(I[s.id]??0),[I,L]);r.useEffect(()=>{l||v||C(W.find(s=>s.available)?.id??"")},[l,v,W]),r.useEffect(()=>{l?.providerId&&C(l.providerId)},[l?.providerId]),r.useEffect(()=>{u&&m(!1)},[u]),r.useEffect(()=>{l&&E(l)},[l,E]),r.useEffect(()=>{const s=Ue.connect(),a=d=>{const p=re.get(d.sessionId);if(p){if(R(p.id),d.status!==A.COMPLETED){E(p);return}if(p.id===u){E(p);return}ne(p.id)}};return s.on(je.SESSION_COMPLETED,a),()=>{s.off(je.SESSION_COMPLETED,a)}},[u,re,R,E,ne]);const Y=()=>{S(null),m(!0),n("/conversations")},fe=()=>{m(!1),n("/conversations")},ae=r.useCallback(s=>{E(s),m(!1),n(`/conversations/${s.id}`)},[E,n]),T=async s=>{if(!(!s.providerId||!s.title.trim()||k!=="idle")){D("starting-session"),S(null);try{const a=await te.mutateAsync({prompt:s.title.trim(),providerId:s.providerId,attachmentIds:s.attachmentIds});C(s.providerId),m(!1),n(`/conversations/${a.id}`)}catch(a){S(a instanceof Error?a.message:t("Failed to start. Please try again."))}finally{D("idle")}}},xe=async s=>{!l||!s.message.trim()||G.isPending||await G.mutateAsync({id:l.id,message:s.message,providerId:s.providerId||v||void 0,attachmentIds:s.attachmentIds})},oe=async()=>{!l||P.isPending||await P.mutateAsync(l.id)},ie=async s=>{window.confirm(t("Delete this conversation?"))&&(await H.mutateAsync(s),J(s),u===s&&(m(!1),n("/conversations")))};return e.jsxs("div",{className:"flex h-dvh flex-col overflow-hidden bg-sidebar text-sm text-foreground",children:[e.jsxs("header",{className:j("flex h-12 shrink-0 items-center justify-between bg-sidebar px-4",i&&"app-region-drag",h&&"pr-[150px]"),children:[e.jsxs("div",{className:j("flex min-w-0 items-center gap-2",w&&"pl-[72px]"),children:[e.jsx(ut,{}),e.jsx("span",{className:"mx-1.5 select-none text-muted-foreground/40",children:"/"}),e.jsx("span",{className:"truncate text-sm font-medium text-foreground/90",children:t("Conversation")})]}),e.jsx("button",{type:"button",onClick:()=>_e.getState().openSettings(),className:j("rounded-md p-1.5 text-muted-foreground/70 transition-colors hover:bg-accent hover:text-foreground",i&&"app-region-no-drag"),title:t("Settings"),children:e.jsx(Be,{size:16})})]}),e.jsxs("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:[e.jsxs("aside",{className:j("h-full w-full shrink-0 flex-col bg-sidebar md:flex md:w-[320px]",se?"hidden md:flex":"flex"),children:[e.jsxs("div",{className:"shrink-0 px-2 pb-1 pt-2",children:[e.jsxs("button",{type:"button",onClick:Y,className:j("flex w-full items-center gap-2.5 rounded-md px-2 py-2 text-sm transition-colors",o?"bg-accent text-foreground":"text-foreground/80 hover:bg-accent/50"),title:t("New Conversation"),children:[e.jsx(mt,{size:16,className:"text-muted-foreground"}),e.jsx("span",{children:t("New Conversation")})]}),e.jsxs("button",{type:"button",onClick:()=>n("/"),className:"flex w-full items-center gap-2.5 rounded-md px-2 py-2 text-sm text-foreground/80 transition-colors hover:bg-accent/50",title:t("Tasks"),children:[e.jsx(ht,{size:16,className:"text-muted-foreground"}),e.jsx("span",{children:t("Tasks")})]}),e.jsxs("button",{type:"button",onClick:()=>g(!0),className:"flex w-full items-center gap-2.5 rounded-md px-2 py-2 text-sm text-foreground/80 transition-colors hover:bg-accent/50",title:t("Search"),children:[e.jsx(Se,{size:16,className:"text-muted-foreground"}),e.jsx("span",{children:t("Search")})]})]}),e.jsx("div",{className:"relative min-h-0 flex-1 overflow-y-auto scrollbar-app-thin pb-4 pt-3",children:Z?e.jsx("div",{className:"px-4 py-4 text-sm text-muted-foreground",children:t("Loading...")}):N.length===0?e.jsxs("div",{className:"flex h-full select-none flex-col items-center justify-center px-6 text-center",children:[e.jsx(he,{size:36,className:"mb-3 text-muted-foreground/40",strokeWidth:1.5}),e.jsx("p",{className:"mb-4 text-sm text-muted-foreground",children:t("No conversations")}),e.jsx("button",{type:"button",onClick:Y,className:"rounded-md bg-brand px-3.5 py-1.5 text-xs font-medium text-brand-foreground transition-colors hover:bg-brand/90",children:t("New Conversation")})]}):e.jsxs("div",{className:"mb-2",children:[e.jsxs("div",{className:"flex w-full items-center gap-1.5 px-4 py-1.5 text-xs font-medium text-muted-foreground",children:[e.jsx("span",{className:"flex-1 text-left",children:t("History")}),e.jsx("span",{className:"text-[11px] font-normal tabular-nums text-muted-foreground/50",children:N.length})]}),e.jsx("div",{className:"mt-0.5 flex min-h-[40px] flex-col rounded-md",children:N.map(s=>e.jsx(Dt,{conversation:s,selected:s.id===u,disabled:H.isPending,unread:s.id!==u&&U(s),onSelect:()=>ae(s),onDelete:()=>ie(s.id)},s.id))})]})}),e.jsx("div",{className:"flex items-center justify-between border-t border-border/60 px-4 py-3 text-xs text-muted-foreground/70",children:e.jsxs("span",{children:[t("Conversations")," · ",N.length]})})]}),e.jsxs("main",{className:j("min-w-0 flex-1 flex-col bg-background md:mb-2 md:mr-2 md:overflow-hidden md:rounded-xl md:border md:border-border/50",se?"flex":"hidden md:flex"),children:[e.jsx("header",{className:"flex h-12 shrink-0 items-center justify-between border-b border-border/60 px-4 md:px-5",children:e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[M||o?e.jsx("button",{type:"button",className:"rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground md:hidden",onClick:fe,title:t("Back"),children:e.jsx($e,{size:17})}):null,e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-semibold",children:l?.title??t("New Conversation")}),l?e.jsxs("div",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:[It(l.status,t),l.directoryName?` · ${l.directoryName}`:""]}):null]})]})}),!l&&M?e.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center px-4 text-sm text-muted-foreground",children:t(ee?"Loading...":"Conversation not found")}):l?e.jsx(gt,{sessionId:l.sessionId,sessionStatus:l.status,sessionStartedAt:l.createdAt,sessionEndedAt:ge(l.status)?null:l.lastActiveAt??l.updatedAt,agentType:l.agentType,runtimeType:l.runtimeType,providerId:v||l.providerId,providers:F,initialTokenUsage:l.tokenUsage,onProviderChange:C,onSend:xe,onStop:oe,onExit:me,isSending:G.isPending,isStopping:P.isPending}):e.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center overflow-y-auto px-4 pb-[10vh] md:px-8",children:e.jsxs("div",{className:"w-full max-w-2xl animate-[fadeInUp_0.5s_cubic-bezier(0.16,1,0.3,1)]",children:[e.jsx("h1",{className:"mb-8 max-w-full break-words text-center text-3xl leading-tight tracking-tight text-foreground",children:t("需要我帮你做点什么?")}),e.jsx(it,{variant:"conversation",projects:[],providers:W,isProvidersLoading:V,defaultProviderId:v,createStep:k,placeholder:"Ask a question...",submitLabel:"Start",pendingLabel:"Starting...",submitTitle:"Start",onSubmit:async({title:s,providerId:a,attachmentIds:d})=>{await T({title:s,providerId:a,attachmentIds:d})}}),O?e.jsx("div",{className:"mt-3 rounded-lg border border-destructive/15 bg-destructive/5 px-3 py-2 text-sm text-destructive",children:O}):null]})})]})]}),e.jsx(Et,{isOpen:ue,conversations:N,onClose:()=>g(!1),onSelectConversation:ae})]})}export{Xt as ConversationPage};
@@ -1 +0,0 @@
1
- import{c as xe,o as fe,n as ye,q as T,p as ie,t as ft,ac as ht,m as Xe,r as o,_ as gt,$ as ae,u as Me,j as e,l as f,af as bt,F as vt,G as yt,E as ve,aj as Ke,X as Nt,D as wt,ad as jt,at as Ct}from"./index-CMJV-mgF.js";import{S as We,A as ge,a as E,T as Ue}from"./agent-meta-MzuGtqxl.js";import{u as kt,A as St,T as He}from"./use-attachments-EypT-7PI.js";import{d as Et}from"./use-projects-DI27nNwl.js";import{M as Qe}from"./MemberAvatar-CCRbS97s.js";import{u as Mt}from"./use-providers-DB9ghBPq.js";import{C as ee}from"./check-qs0S_9rB.js";import{P as It}from"./trash-2-Bc-URu8c.js";import{C as pe}from"./chevron-down-BaQEBzp3.js";import{A as Be}from"./AgentLogo-BDyW3ihb.js";import{l as Tt}from"./ExecutionPermissionSelector-DeeNd4Kh.js";import{g as Ze,T as Rt,A as At,F as Ot,G as Lt}from"./task-priority-acVgTiil.js";import{M as _t}from"./BrandLogo-YGT4Vlw5.js";import{P as Dt}from"./paperclip-BOSklTt7.js";const Pt=[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]],zt=xe("chevrons-down",Pt);const $t=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],Gt=xe("chevrons-up",$t);const Ft=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],qt=xe("shield",Ft);const Kt=[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}],["path",{d:"M12 20v-8",key:"i3yub9"}],["path",{d:"M17 20V8",key:"1tkaf5"}]],Wt=xe("signal-high",Kt);const Ut=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Ht=xe("zap",Ut);function Qt(t){const s=fe(),a=Xe({queryKey:T.sessions.runtime(t),queryFn:()=>ie.get(`/sessions/${t}/runtime`),enabled:!!t});return o.useEffect(()=>{if(!t)return;const i=gt.connect(),l=p=>{p.sessionId===t&&s.invalidateQueries({queryKey:T.sessions.runtime(t)})},d=p=>{p.sessionId===t&&s.setQueryData(T.sessions.runtime(t),p.state)},m=()=>{s.invalidateQueries({queryKey:T.sessions.runtime(t)})};return i.on(ae.SESSION_PERMISSION_REQUESTED,l),i.on(ae.SESSION_PERMISSION_INVALIDATED,l),i.on(ae.SESSION_RUNTIME_STATE_CHANGED,d),i.on("connect",m),()=>{i.off(ae.SESSION_PERMISSION_REQUESTED,l),i.off(ae.SESSION_PERMISSION_INVALIDATED,l),i.off(ae.SESSION_RUNTIME_STATE_CHANGED,d),i.off("connect",m)}},[t,s]),a}function Bt(t){return t==="RUNNING"||t==="AWAITING_PERMISSION"||t==="CANCELLING"}function Yt(t){return t===We.RUNNING||t===We.PENDING}function Os(t,s){const{data:a}=Qt(t);return{runtimeState:a,isActive:Yt(s)||Bt(a?.turnState),isCancelling:a?.turnState==="CANCELLING"}}function Ls(){const t=fe();return ye({mutationFn:({sessionId:s,requestId:a,optionId:i})=>ie.post(`/sessions/${s}/permissions/${a}/resolve`,{optionId:i}),onSettled:(s,a,i)=>{t.invalidateQueries({queryKey:T.sessions.runtime(i.sessionId)})}})}function _s(){const t=fe();return ye({mutationFn:s=>ie.post(`/sessions/${s}/start`),onSuccess:(s,a)=>{t.invalidateQueries({queryKey:T.sessions.detail(a)}),t.invalidateQueries({queryKey:T.tasks.all})}})}const Vt=45e3;function Ds(){const t=fe();return ye({mutationFn:async s=>{try{return await ie.post(`/sessions/${s}/stop`,void 0,{signal:AbortSignal.timeout(Vt)})}catch(a){throw a instanceof DOMException&&a.name==="TimeoutError"?new Error("Stop request timed out before the server answered. The session may still be stopping; refresh the status and retry."):a}},onError:s=>{ft.error(ht("Failed to stop session. Refreshing status; check it and try again."),{description:s instanceof Error?s.message:void 0})},onSettled:(s,a,i)=>{t.setQueryData(T.sessions.runtime(i),l=>l?.turnState==="CANCELLING"?{...l,turnState:"IDLE"}:l),Promise.allSettled([t.invalidateQueries({queryKey:T.sessions.detail(i)}),t.invalidateQueries({queryKey:T.sessions.runtime(i)}),t.invalidateQueries({queryKey:T.workspaces.all}),t.invalidateQueries({queryKey:T.tasks.all})])}})}function Ps(){const t=fe();return ye({mutationFn:({id:s,message:a,providerId:i})=>ie.post(`/sessions/${s}/message`,{message:a,providerId:i}),onSuccess:()=>{t.invalidateQueries({queryKey:T.workspaces.all}),t.invalidateQueries({queryKey:T.tasks.all})}})}function Ye({iconName:t,className:s}){switch(t){case"chevrons-up":return e.jsx(Gt,{className:s,"aria-hidden":"true"});case"signal-high":return e.jsx(Wt,{className:s,"aria-hidden":"true"});case"chevrons-down":return e.jsx(zt,{className:s,"aria-hidden":"true"});default:return e.jsx(_t,{className:s,"aria-hidden":"true"})}}function zs({priority:t,className:s}){const a=Ze(t);return e.jsx("span",{className:f("inline-flex shrink-0 items-center rounded px-1.5 py-0.5 text-[10px] font-semibold leading-none",a.className,s),title:`${a.code} · ${a.label}`,children:a.code})}function Xt({value:t,onChange:s,disabled:a=!1,compact:i=!1}){const{t:l}=Me(),[d,m]=o.useState(!1),p=o.useRef(null),u=Ze(t);return o.useEffect(()=>{if(!d)return;const x=j=>{p.current&&!p.current.contains(j.target)&&m(!1)};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[d]),e.jsxs("div",{className:"relative",ref:p,children:[e.jsxs("button",{type:"button",disabled:a||!s,onClick:()=>m(x=>!x),"aria-haspopup":"listbox","aria-expanded":d,"aria-label":l("Task priority"),className:f("inline-flex items-center gap-1.5 rounded-md text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 disabled:cursor-not-allowed disabled:opacity-50",i?"px-1.5 py-1":"px-2 py-1.5",u.className),children:[e.jsx(Ye,{iconName:u.iconName,className:"size-3.5"}),e.jsx("span",{children:l(u.label)}),s?e.jsx(pe,{className:f("size-3 transition-transform",d&&"rotate-180"),"aria-hidden":"true"}):null]}),d&&e.jsx("div",{className:"absolute right-0 top-full z-50 mt-1.5 w-36 rounded-lg border border-border bg-popover p-1 shadow-lg",role:"listbox","aria-label":l("Task priority"),children:Rt.map(x=>{const j=x.value===u.value;return e.jsxs("button",{type:"button",role:"option","aria-selected":j,onClick:()=>{s?.(x.value),m(!1)},className:"flex w-full items-center gap-2 rounded-md px-2 py-2 text-left text-xs text-foreground/80 transition-colors hover:bg-accent",children:[e.jsx("span",{className:f("inline-flex size-5 items-center justify-center rounded",x.className),children:e.jsx(Ye,{iconName:x.iconName,className:"size-3.5"})}),e.jsxs("span",{className:"flex-1",children:[x.code," · ",l(x.label)]}),j?e.jsx(ee,{className:"size-3.5 text-foreground","aria-hidden":"true"}):null]},x.value)})})]})}function Ve(t,s,a,i){if(a.filter(m=>m===i).length<=1)return t;const d=a.slice(0,s+1).filter(m=>m===i).length;return`${t} #${d}`}function Zt(t){return Object.values(t).filter(Boolean).length}function Jt({mode:t,setMode:s,selectedTemplateId:a,setSelectedTemplateId:i,selectedMemberPresetIds:l,setSelectedMemberPresetIds:d,disabled:m=!1,compact:p=!1}){const{t:u}=Me(),{preserveDesktopSearch:x}=bt(),[j,y]=o.useState(!1),{data:N}=Mt(),{data:c,isError:g,isFetching:D,isLoading:h,refetch:L}=vt(),{data:R,isError:C,isFetching:P,isLoading:X,refetch:_}=yt(),te=o.useMemo(()=>new Map((N??[]).map(({provider:r,availability:b})=>[r.id,r.name+(b.type==="NOT_FOUND"?u(" (不可用)"):"")])),[N,u]),A=o.useMemo(()=>new Map((c??[]).map(r=>[r.id,r])),[c]),K=o.useMemo(()=>new Map((R??[]).map(r=>[r.id,r])),[R]),W=o.useMemo(()=>l.map(r=>A.get(r)).filter(r=>!!r),[A,l]);o.useEffect(()=>{c!==void 0&&d(r=>{const b=r.filter(M=>A.has(M));return b.length===r.length&&b.every((M,$)=>M===r[$])?r:b})},[c,A,d]),o.useEffect(()=>{R!==void 0&&i(r=>!r||K.has(r)?r:null)},[i,K,R]);const se=r=>{m||i(b=>b===r?null:r)},ce=r=>{m||d(b=>[...b,r])},U=r=>{m||d(b=>b.filter((M,$)=>$!==r))},Z=e.jsxs("section",{className:"min-w-0",children:[e.jsx("div",{className:"text-[11px] font-medium text-muted-foreground mb-1.5",children:u("团队模板")}),C?e.jsxs("div",{className:"rounded-lg bg-destructive/10 px-3 py-2.5 text-xs text-destructive",children:[e.jsx("span",{children:u("团队模板加载失败")}),e.jsx("button",{type:"button",onClick:()=>{_()},disabled:m||P,className:"ml-2 underline hover:no-underline",children:u("重试")})]}):X?e.jsxs("div",{className:"flex items-center gap-2 py-3 text-xs text-muted-foreground",children:[e.jsx(ve,{size:12,className:"animate-spin"}),u("加载中...")]}):(R??[]).length===0?e.jsxs("div",{className:"rounded-lg border border-dashed border-border bg-background px-3 py-3 text-xs text-muted-foreground",children:[u("当前没有团队模板"),e.jsx(Ke,{to:x("/settings/team"),className:"ml-1.5 text-info hover:underline",children:u("去创建")})]}):e.jsx("div",{className:f("space-y-1.5",p&&"sm:grid sm:grid-cols-2 sm:gap-1.5 sm:space-y-0"),children:(R??[]).map(r=>{const b=r.id===a,M=r.members?.length??0,$=r.members?.map(Q=>Q.memberPresetId)??[],H=r.members?.slice(0,3).map((Q,oe)=>Ve(Q.memberPreset?.name??Q.memberPresetId,oe,$,Q.memberPresetId)).join(", ");return e.jsx("button",{type:"button",onClick:()=>se(r.id),disabled:m,className:f("w-full rounded-lg px-3 py-2 text-left border transition-all disabled:cursor-not-allowed disabled:opacity-60",b?"bg-background border-foreground/20 shadow-sm":"bg-background border-border/60 hover:border-border hover:bg-accent"),children:e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:f("text-xs truncate",b?"font-medium text-foreground":"text-foreground"),children:r.name}),e.jsxs("span",{className:"text-[10px] text-muted-foreground shrink-0",children:[M,u("人")]})]}),H&&e.jsx("div",{className:"mt-0.5 text-[10px] text-muted-foreground truncate",children:H})]}),b&&e.jsx(ee,{size:13,className:"shrink-0 text-foreground"})]})},r.id)})})]}),G=W.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:W.map((r,b)=>{const M=Ve(r.name,b,l,r.id);return e.jsxs("div",{className:"inline-flex items-center gap-1 pl-1 pr-0.5 py-0.5 rounded-md border border-border/60 bg-background text-[10px] text-foreground",children:[e.jsx(Qe,{name:r.name,avatar:r.avatar,className:"h-3.5 w-3.5 text-[7px]"}),e.jsx("span",{className:"max-w-[80px] truncate",children:M}),e.jsx("button",{type:"button",onClick:()=>U(b),disabled:m,className:"p-0.5 text-muted-foreground hover:text-destructive disabled:opacity-30 rounded transition-colors",children:e.jsx(Nt,{size:9})})]},`${r.id}-${b}`)})}),ne=g?e.jsxs("div",{className:"rounded-lg bg-destructive/10 px-3 py-2.5 text-xs text-destructive",children:[e.jsx("span",{children:u("成员预设加载失败")}),e.jsx("button",{type:"button",onClick:()=>{L()},disabled:m||D,className:"ml-2 underline hover:no-underline",children:u("重试")})]}):h?e.jsxs("div",{className:"flex items-center gap-2 py-3 text-xs text-muted-foreground",children:[e.jsx(ve,{size:12,className:"animate-spin"}),u("加载中...")]}):(c??[]).length===0?e.jsxs("div",{className:"rounded-lg border border-dashed border-border bg-background px-3 py-3 text-xs text-muted-foreground",children:[u("当前没有成员预设"),e.jsx(Ke,{to:x("/settings/team"),className:"ml-1.5 text-info hover:underline",children:u("去创建")})]}):e.jsx("div",{className:"space-y-1 max-h-[180px] overflow-y-auto pr-1",children:(c??[]).map(r=>{const b=l.filter(H=>H===r.id).length,M=te.get(r.providerId)??r.providerId,$=Zt(r.capabilities);return e.jsxs("button",{type:"button",onClick:()=>ce(r.id),disabled:m,className:f("flex items-center gap-2 w-full px-2 py-1.5 rounded-lg text-left border border-transparent transition-all",m&&"cursor-not-allowed opacity-60","bg-background hover:bg-accent hover:border-border/60"),children:[e.jsx(Qe,{name:r.name,avatar:r.avatar,className:"h-6 w-6 text-[9px] shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-xs text-foreground truncate",children:r.name}),e.jsxs("div",{className:"text-[10px] text-muted-foreground truncate",children:[M," · ",$,"/10"]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[b>0&&e.jsxs("span",{className:"text-[10px] text-foreground font-semibold",children:["×",b]}),e.jsx(It,{size:12,className:"text-muted-foreground"})]})]},r.id)})}),F=W.length>0&&e.jsx("span",{className:"inline-flex items-center justify-center min-w-[16px] h-4 rounded-full bg-primary text-[10px] font-semibold text-primary-foreground px-1.5",children:W.length}),le=e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-[11px] font-medium text-muted-foreground shrink-0",children:u("执行模式")}),e.jsxs("div",{className:"inline-flex items-center h-7 rounded-md border border-border/70 bg-background p-0.5",children:[e.jsxs("button",{type:"button",onClick:()=>!m&&s("AUTO"),disabled:m,className:f("flex items-center gap-1.5 rounded h-full px-2.5 text-xs transition-all disabled:cursor-not-allowed disabled:opacity-50",t==="AUTO"?"bg-primary text-primary-foreground font-medium shadow-sm":"text-muted-foreground hover:text-foreground"),children:[e.jsx(Ht,{size:11}),u("自动模式")]}),e.jsxs("button",{type:"button",onClick:()=>!m&&s("CONFIRM"),disabled:m,className:f("flex items-center gap-1.5 rounded h-full px-2.5 text-xs transition-all disabled:cursor-not-allowed disabled:opacity-50",t==="CONFIRM"?"bg-primary text-primary-foreground font-medium shadow-sm":"text-muted-foreground hover:text-foreground"),children:[e.jsx(qt,{size:11}),u("确认模式")]})]})]});return p?e.jsxs("div",{className:"space-y-3",children:[le,Z,e.jsxs("div",{className:"border-t border-border/50 pt-2.5",children:[e.jsxs("button",{type:"button",onClick:()=>!m&&y(r=>!r),disabled:m,"aria-expanded":j,className:"flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground hover:text-foreground transition-colors disabled:cursor-not-allowed disabled:opacity-50",children:[e.jsx(pe,{size:12,className:f("transition-transform",j?"":"-rotate-90")}),u("追加独立成员"),F]}),j&&e.jsxs("div",{className:"mt-2",children:[G,ne]})]})]}):e.jsxs("div",{className:"space-y-3.5",children:[le,e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[Z,e.jsxs("section",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[e.jsx("span",{className:"text-[11px] font-medium text-muted-foreground",children:u("追加成员")}),F]}),G,ne]})]})]})}function es({commands:t,selectedIndex:s,query:a,hasCatalog:i,title:l="Slash Commands",queryPrefix:d="/",emptyCatalogMessage:m="No slash commands catalog for this agent yet.",emptyQueryMessage:p,insertionHint:u="Enter / Tab to insert",compact:x=!1,onSelect:j}){const y=x?"px-1.5 pb-1.5":"px-2 pb-2",N=x?"px-2 py-1.5":"px-2.5 py-2",c=x?"max-h-36":"max-h-48";return e.jsxs("div",{className:x?"pt-1.5":"pt-2",children:[e.jsxs("div",{className:`mb-1 flex items-center justify-between ${x?"px-2 pt-0.5":"px-3 pt-1"}`,children:[e.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.14em] text-neutral-400",children:l}),e.jsx("span",{className:"text-[10px] text-neutral-400",children:u})]}),t.length===0?e.jsx("div",{className:`${x?"px-2 pb-2 pt-1.5 text-[11px]":"px-3 pb-3 pt-2 text-xs"} text-neutral-400`,children:i?p??`No matches for ${d}${a}`:m}):e.jsx("div",{className:`${y} ${c} overflow-y-auto`,children:t.map((g,D)=>e.jsxs("button",{type:"button",onMouseDown:h=>h.preventDefault(),onClick:()=>j(g),className:`w-full rounded-lg border text-left transition-colors ${D===s?"border-neutral-300 bg-neutral-50":"border-transparent hover:border-neutral-200 hover:bg-neutral-50/80"} ${N}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"font-mono text-[13px] text-neutral-900",children:g.command}),g.kind&&g.kind!=="builtin"?e.jsx("span",{className:"rounded-full border border-neutral-200 px-1.5 py-0.5 text-[9px] uppercase tracking-[0.12em] text-neutral-500",children:g.scope?`${g.scope} ${g.kind}`:g.kind}):null]}),e.jsx("div",{className:`${x?"mt-0.5 text-[11px]":"mt-1 text-xs"} text-neutral-500`,children:g.description})]},g.command))})]})}const V=12,be=8;function ts({open:t,anchorRef:s,commands:a,selectedIndex:i,query:l,hasCatalog:d,title:m,queryPrefix:p,emptyCatalogMessage:u,emptyQueryMessage:x,insertionHint:j,compact:y=!1,onSelect:N}){const c=o.useRef(null),[g,D]=o.useState(null);return o.useLayoutEffect(()=>{if(!t){D(null);return}const h=s.current;if(!h)return;let L=0;const R=()=>{const X=s.current;if(!X)return;const _=X.getBoundingClientRect(),te=window.innerWidth,A=window.innerHeight,K=y?260:320,W=y?te-V*2:560,se=Math.min(Math.max(_.width,K),Math.max(K,W)),ce=Math.min(Math.max(V,_.left),Math.max(V,te-V-se)),U=A-_.bottom-be-V,Z=_.top-be-V,G=c.current?.offsetHeight??(y?220:280),ne=y?240:320,F=U<180&&Z>U,r=Math.max(120,Math.min(ne,F?Z:U)),b=F?Math.max(V,_.top-be-Math.min(G,r)):Math.min(A-V-Math.min(G,r),_.bottom+be);D({top:b,left:ce,width:se,maxHeight:r})},C=()=>{cancelAnimationFrame(L),L=requestAnimationFrame(R)};C();const P=new ResizeObserver(C);return P.observe(h),c.current&&P.observe(c.current),window.addEventListener("resize",C),window.addEventListener("scroll",C,!0),window.visualViewport?.addEventListener("resize",C),window.visualViewport?.addEventListener("scroll",C),()=>{cancelAnimationFrame(L),P.disconnect(),window.removeEventListener("resize",C),window.removeEventListener("scroll",C,!0),window.visualViewport?.removeEventListener("resize",C),window.visualViewport?.removeEventListener("scroll",C)}},[s,a.length,y,t,l,i]),!t||!g||typeof document>"u"?null:wt.createPortal(e.jsx("div",{className:"pointer-events-none fixed inset-0 z-[120]",children:e.jsx("div",{ref:c,className:"pointer-events-auto fixed overflow-hidden rounded-xl border border-neutral-200 bg-white shadow-lg shadow-neutral-200/70",style:{top:g.top,left:g.left,width:g.width,maxHeight:g.maxHeight},children:e.jsx(es,{commands:a,selectedIndex:i,query:l,hasCatalog:d,title:m,queryPrefix:p,emptyCatalogMessage:u,emptyQueryMessage:x,insertionHint:j,compact:y,onSelect:N})})}),document.body)}function ss({agentType:t,workingDir:s}){return Xe({queryKey:T.system.slashCommandCatalog(t,s),queryFn:async()=>(await ie.get("/system/slash-command-catalog",{params:{agentType:String(t),...s?{workingDir:s}:{}}})).commands,enabled:!!t,staleTime:3e4})}function ns(t,s){const a=new Set,i=[];for(const l of[...t,...s]){const d=l.command.trim().toLowerCase();!d||a.has(d)||(a.add(d),i.push(l.kind?l:{...l,kind:"builtin"}))}return i}function Ne(t){return t.trim().toLowerCase().replace(/^[/$]/,"")}function os(t){return Ne(t.command)}function rs(t,s){if(!s)return 1e3;const a=os(t),i=t.aliases?.map(Ne)??[],l=[a,...i];let d=0;for(const p of l)p===s?d=Math.max(d,500):p.startsWith(s)?d=Math.max(d,400-(p.length-s.length)):p.includes(s)&&(d=Math.max(d,250-p.indexOf(s)));return d>0?d:`${a} ${i.join(" ")} ${t.description}`.toLowerCase().includes(s)?100:0}function $s(t){const s=/(^|[\s])\$([^\s]*)$/.exec(t);if(!s||s.index===void 0)return null;const a=s.index+s[1].length;return{query:Ne(s[2]),replaceStart:a}}function as(t,s){const a=Ne(s);return a?t.map((i,l)=>({command:i,index:l,score:rs(i,a)})).filter(i=>i.score>0).sort((i,l)=>l.score-i.score||i.index-l.index||i.command.command.localeCompare(l.command.command)).map(i=>i.command):t.slice()}const is=[{command:"/permissions",description:"Manage what Codex can do without approval"},{command:"/sandbox-add-read-dir",description:"Grant read access to another directory"},{command:"/agent",description:"Switch between built-in agent personas"},{command:"/apps",description:"Manage connected apps"},{command:"/clear",description:"Start a fresh conversation"},{command:"/compact",description:"Replace chat context with a summary"},{command:"/copy",description:"Copy the last assistant message to your clipboard"},{command:"/diff",description:"Show the current git diff"},{command:"/experimental",description:"Toggle experimental features"},{command:"/feedback",description:"Share feedback on Codex CLI"},{command:"/init",description:"Create or update AGENTS.md for the repo"},{command:"/logout",description:"Sign out of Codex"},{command:"/mcp",description:"Manage MCP servers"},{command:"/mention",description:"Add files or directories to the conversation context"},{command:"/model",description:"Change the active model"},{command:"/fast",description:"Toggle low reasoning mode"},{command:"/plan",description:"Toggle plan mode for code changes"},{command:"/personality",description:"Select how Codex communicates"},{command:"/ps",description:"List running background tasks"},{command:"/fork",description:"Fork the current conversation state"},{command:"/resume",description:"Resume a previous conversation"},{command:"/new",description:"Open a conversation picker to start or resume"},{command:"/quit",description:"Exit Codex CLI",aliases:["exit"]},{command:"/review",description:"Run a code review"},{command:"/status",description:"Show session and configuration status"},{command:"/debug-config",description:"Inspect the effective configuration"},{command:"/statusline",description:"Configure the custom status line"},{command:"/skills",description:"Browse available skills and insert a $skill mention"}],cs=[{command:"/clear",description:"Clear the conversation history"},{command:"/compact",description:"Compact the conversation context",aliases:["compact focus"]},{command:"/config",description:"Open the configuration panel"},{command:"/cost",description:"Show token usage and cost"},{command:"/doctor",description:"Check Claude Code installation health"},{command:"/help",description:"Show help and available commands"},{command:"/init",description:"Initialize project instructions"},{command:"/login",description:"Sign in to Claude Code"},{command:"/logout",description:"Sign out of Claude Code"},{command:"/mcp",description:"Manage MCP servers"},{command:"/memory",description:"Edit project memory files"},{command:"/model",description:"Change the active model"},{command:"/permissions",description:"Review or update tool permissions"},{command:"/pr_comments",description:"Read pull request review comments"},{command:"/review",description:"Run a code review"},{command:"/status",description:"Show account and system status"},{command:"/terminal-setup",description:"Configure terminal newline shortcuts"},{command:"/vim",description:"Toggle vim mode"}],ls=[{command:"/bug",description:"File an issue about Gemini CLI"},{command:"/chat",description:"Manage chat checkpoints and exports"},{command:"/clear",description:"Clear the terminal display"},{command:"/compress",description:"Replace chat context with a summary"},{command:"/copy",description:"Copy the last Gemini CLI output"},{command:"/directory",description:"Manage additional workspace directories",aliases:["dir"]},{command:"/editor",description:"Choose the preferred editor"},{command:"/extensions",description:"List active Gemini CLI extensions"},{command:"/help",description:"Show help and command usage",aliases:["?"]},{command:"/mcp",description:"Show MCP servers and tools"},{command:"/memory",description:"Manage loaded GEMINI.md memory"},{command:"/restore",description:"Restore files from a tool checkpoint"},{command:"/settings",description:"Open the Gemini CLI settings editor"},{command:"/stats",description:"Show session statistics and token usage"},{command:"/theme",description:"Change the Gemini CLI theme"},{command:"/auth",description:"Change the authentication method"},{command:"/about",description:"Show version information"},{command:"/tools",description:"List currently available tools"},{command:"/privacy",description:"Review privacy and data collection settings"},{command:"/quit",description:"Exit Gemini CLI",aliases:["exit"]},{command:"/vim",description:"Toggle vim mode"},{command:"/init",description:"Generate a tailored GEMINI.md file"}],ds=[{command:"/model",description:"Change the active model"},{command:"/plan",description:"Create or reopen a plan"},{command:"/ask",description:"Toggle ask mode (read-only Q&A)"},{command:"/debug",description:"Toggle debug mode"},{command:"/clear",description:"Start a new chat session",aliases:["new","new-chat","newchat"]},{command:"/compress",description:"Summarize the conversation to reduce context"},{command:"/vim",description:"Toggle vim mode"},{command:"/shell",description:"Enter shell mode"},{command:"/about",description:"Show CLI, system, and account information"},{command:"/setup-terminal",description:"Configure terminal newline shortcuts"},{command:"/feedback",description:"Share feedback with the Cursor team"},{command:"/open",description:"Open the repository git root in Cursor"},{command:"/cursor",description:"Alias for /open",aliases:["open"]},{command:"/resume-chat",description:"Resume a previous chat by folder name",aliases:["resume"]},{command:"/copy-request-id",description:"Copy the last request ID"},{command:"/copy-conversation-id",description:"Copy the current conversation ID"},{command:"/logout",description:"Sign out from Cursor"},{command:"/quit",description:"Exit Cursor Agent",aliases:["exit"]},{command:"/mcp",description:"Manage MCP servers"}],ms={[ge.CODEX]:is,[ge.CLAUDE_CODE]:cs,[ge.GEMINI_CLI]:ls,[ge.CURSOR_AGENT]:ds};function Je(t){return t.trim().toLowerCase().replace(/^\//,"")}function us(t){return t?(ms[t]??[]).map(s=>({...s,kind:s.kind??"builtin"})):[]}function ps(t){const s=t.match(/^\s*\/([^\s]*)$/);return s?Je(s[1]):null}function xs(t,s){return as(t,Je(s))}function fs(t){const s=t.key==="Enter"&&!t.shiftKey&&!t.repeat&&!t.nativeEvent.isComposing&&t.nativeEvent.keyCode!==229,a=t.key==="Tab"&&!t.shiftKey;return s||a}function hs({agentType:t,workingDir:s,input:a,setInput:i,textareaRef:l,minHeight:d,maxHeight:m}){const[p,u]=o.useState(0),{data:x=[]}=ss({agentType:t,workingDir:s}),j=o.useMemo(()=>ns(us(t),x),[t,x]),y=o.useMemo(()=>ps(a),[a]),N=o.useMemo(()=>y===null?[]:xs(j,y),[j,y]),c=o.useCallback(()=>{const h=l.current;h&&(h.style.height="auto",h.style.height=`${Math.max(d,Math.min(h.scrollHeight,m))}px`)},[m,d,l]);o.useEffect(()=>{u(0)},[t,y]),o.useEffect(()=>{p<N.length||u(0)},[N.length,p]);const g=o.useCallback(h=>{const R=`${a.match(/^(\s*)\/[^\s]*$/)?.[1]??""}${h.command} `;i(R),requestAnimationFrame(()=>{const C=l.current;C&&(c(),C.focus(),C.setSelectionRange(R.length,R.length))})},[a,c,i,l]),D=o.useCallback(h=>y===null||N.length===0?!1:h.key==="ArrowDown"?(h.preventDefault(),u(L=>(L+1)%N.length),!0):h.key==="ArrowUp"?(h.preventDefault(),u(L=>(L-1+N.length)%N.length),!0):fs(h)?(h.preventDefault(),g(N[p]??N[0]),!0):!1,[g,N,y,p]);return{allCommands:j,query:y,filteredCommands:N,selectedIndex:p,setSelectedIndex:u,applyCommand:g,handleKeyDown:D}}const gs={idle:"","creating-task":"Creating Task...","creating-teamrun":"Creating TeamRun...","creating-workspace":"Creating Workspace...","creating-session":"Creating Session...","starting-session":"Starting Agent..."};function Gs({variant:t="task",projects:s,providers:a,isProvidersLoading:i,onSubmit:l,defaultProjectId:d="",defaultProviderId:m="",onProjectChange:p,createStep:u,placeholder:x,submitLabel:j,pendingLabel:y,submitTitle:N}){const{t:c}=Me(),[g,D]=o.useState(""),[h,L]=o.useState(d),[R,C]=o.useState(m),P=R||m,[X,_]=o.useState("SOLO"),[te,A]=o.useState(E.WORKTREE),[K,W]=o.useState(Ue.NORMAL),[se,ce]=o.useState({}),[U,Z]=o.useState("AUTO"),[G,ne]=o.useState(null),[F,le]=o.useState([]),[r,b]=o.useState(!1),[M,$]=o.useState(!1),[H,Q]=o.useState(!1),[oe,J]=o.useState(!1),we=o.useRef(null),je=o.useRef(null),Ce=o.useRef(null),Ie=o.useRef(null),Te=o.useRef(null),Re=o.useRef(null),{files:Ae,addFiles:re,removeFile:et,clear:Oe,buildMarkdownLinks:Le,getDoneAttachments:_e,isUploading:he}=kt(),de=Et(),v=t==="conversation",w=t==="task"||t==="conversation",tt=j??c(v?"开始":"创建");o.useEffect(()=>{L(d),p?.(d)},[d,p]),o.useEffect(()=>{if(!M)return;const n=k=>{we.current&&!we.current.contains(k.target)&&$(!1)};return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[M]),o.useEffect(()=>{if(!H)return;const n=k=>{je.current&&!je.current.contains(k.target)&&Q(!1)};return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[H]),o.useEffect(()=>{if(!oe)return;const n=k=>{Ce.current&&!Ce.current.contains(k.target)&&J(!1)};return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[oe]);const z=o.useMemo(()=>s.find(n=>n.id===h),[s,h]),q=o.useMemo(()=>a.find(n=>n.id===P),[a,P]),ke=h?se[h]:void 0,st=(ke?.isGitRepo??z?.isGitRepo)!==!1,nt=(ke?.worktreeReady??z?.worktreeReady)!==!1,O=!v&&!(st&&nt),I=O?"SOLO":X,B=O?E.MAIN_DIRECTORY:te,ot=B===E.MAIN_DIRECTORY?c("本地模式"):c("工作树模式"),De=c("工作树隔离改动,支持 TeamRun、Merge、Rebase 和冲突解决。"),rt=c("本地模式会直接修改项目主目录,不会自动提交,也不能使用 Merge、Rebase 或冲突解决。"),at=ke?.reason??z?.reason,Pe=c(at==="NO_HEAD"?"已检测到 Git,但需要先提交一次才能使用工作树模式。":"初始化 Git 后可使用工作树模式。"),ze=v||I==="SOLO"?q?.agentType:null,Y=hs({agentType:ze,workingDir:v?void 0:z?.repoPath,input:g,setInput:D,textareaRef:Te,minHeight:76,maxHeight:220}),S=u!=="idle",$e=!!G||F.length>0,me=!S&&!he&&g.trim().length>0&&(v?q?.available===!0:!!h&&(I==="SOLO"?q?.available===!0:$e));o.useEffect(()=>{O&&(_("SOLO"),A(E.MAIN_DIRECTORY),b(!1),J(!1))},[O]),o.useEffect(()=>{O||v||A(E.WORKTREE)},[v,O,z?.id]);const it=o.useCallback(async()=>{if(!z||de.isPending)return;const n=await de.mutateAsync({id:z.id});ce(k=>({...k,[z.id]:n})),n.worktreeReady&&(_("SOLO"),A(E.WORKTREE),J(!1))},[de,z]),Se=o.useCallback(async()=>{if(!me)return;const n=w?Le():"",k=w?_e().map(ue=>ue.id):[];try{await l({title:g.trim(),description:"",projectId:v?"":h,providerId:P,mode:v?"SOLO":I,workspaceMode:!v&&I==="SOLO"?B:E.WORKTREE,teamRunMode:v?"AUTO":U,teamTemplateId:v||O?null:G,memberPresetIds:v||O?[]:F,attachmentLinks:n,attachmentIds:k,priority:K}),D(""),W(Ue.NORMAL),w&&Oe()}catch{}},[me,w,Le,_e,l,g,v,h,P,I,B,U,O,G,F,Oe,K]),ct=o.useCallback(n=>{Y.handleKeyDown(n)||n.key==="Enter"&&!n.shiftKey&&!n.nativeEvent.isComposing&&n.nativeEvent.keyCode!==229&&(n.preventDefault(),Se())},[Se,Y]),lt=o.useCallback(n=>{const k=n.target.files;k&&k.length>0&&re(Array.from(k)),n.target.value=""},[re]),dt=o.useCallback(n=>{L(n),p?.(n),$(!1)},[p]),mt=o.useCallback(n=>{if(!w)return;const k=n.clipboardData.items,ue=[];for(const Fe of k)if(Fe.kind==="file"){const qe=Fe.getAsFile();qe&&ue.push(qe)}ue.length>0&&(n.preventDefault(),re(ue))},[re,w]),[Ge,Ee]=o.useState(!1),ut=o.useCallback(n=>{w&&(n.preventDefault(),Ee(!0))},[w]),pt=o.useCallback(n=>{w&&(n.preventDefault(),Ee(!1))},[w]),xt=o.useCallback(n=>{if(!w)return;n.preventDefault(),Ee(!1);const k=n.dataTransfer.files;k.length>0&&re(Array.from(k))},[re,w]);return e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{ref:Ie,className:f("relative bg-background rounded-xl border transition-colors duration-200","shadow-[0_1px_2px_rgba(0,0,0,0.05)]","hover:border-ring/40 focus-within:border-ring/60",Ge?"border-info bg-info/5":"border-border",S&&"opacity-80"),onDragOver:w?ut:void 0,onDragLeave:w?pt:void 0,onDrop:w?xt:void 0,children:[w&&Ae.length>0&&e.jsx("div",{className:"px-4 pt-3",children:e.jsx(St,{files:Ae,onRemove:et})}),e.jsx("textarea",{ref:Te,value:g,onChange:n=>D(n.target.value),onKeyDown:ct,onPaste:w?mt:void 0,placeholder:c(x||"Describe your task..."),disabled:S,autoFocus:!0,rows:1,className:"w-full px-4 pt-4 pb-2 bg-transparent border-none focus:outline-none resize-none text-[15px] text-foreground placeholder:text-muted-foreground/80 leading-relaxed",style:{minHeight:"76px",maxHeight:"220px",fieldSizing:"content"}}),w&&Ge&&e.jsx("div",{className:"px-4 pb-2",children:e.jsx("div",{className:"flex items-center justify-center py-3 border border-dashed border-info/40 rounded-lg text-xs font-medium text-info",children:c("Drop files here")})}),e.jsxs("div",{className:"flex items-center justify-between px-2 pb-2 pt-1",children:[e.jsx("div",{className:"flex items-center gap-1",children:w?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:()=>Re.current?.click(),disabled:S||he,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:c("Attach files"),children:e.jsx(Dt,{size:18})}),e.jsx("input",{ref:Re,type:"file",multiple:!0,onChange:lt,className:"hidden"})]}):null}),e.jsxs("div",{className:"flex items-center gap-2",children:[w&&he&&e.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(ve,{size:14,className:"animate-spin"}),c("Uploading...")]}),S&&e.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(ve,{size:14,className:"animate-spin"}),c(y??gs[u])]}),!v&&!S&&!he&&I==="TEAM"&&!$e&&g.trim().length>0&&e.jsx("span",{className:"text-[11px] text-warning",children:c("请选择团队模板或追加成员")}),me&&e.jsxs("span",{className:"hidden sm:inline-flex items-center gap-1 text-[11px] text-muted-foreground/80 select-none",children:[e.jsx("kbd",{className:"inline-flex items-center justify-center min-w-[18px] h-[18px] px-1 rounded border border-border bg-muted/60 text-[10px] font-medium text-muted-foreground leading-none",children:"⏎"}),tt]}),e.jsx("button",{type:"button",onClick:Se,disabled:!me,className:f("flex items-center justify-center size-8 rounded-lg transition-all duration-200",me?"bg-primary text-primary-foreground hover:bg-primary/90 shadow-sm":"bg-muted text-muted-foreground/40 cursor-not-allowed"),title:c(N||"Create & Start"),children:e.jsx(At,{size:16,strokeWidth:2.5})})]})]})]}),e.jsx(ts,{open:!!ze&&Y.query!==null,anchorRef:Ie,commands:Y.filteredCommands,selectedIndex:Y.selectedIndex,query:Y.query??"",hasCatalog:Y.allCommands.length>0,compact:!0,onSelect:Y.applyCommand}),e.jsxs("div",{className:"flex items-center flex-wrap gap-1.5 mt-2.5 px-0.5",children:[!v&&e.jsxs("div",{className:"relative",ref:we,children:[e.jsxs("button",{type:"button",onClick:()=>{S||$(n=>!n)},disabled:S,className:f("flex items-center gap-1.5 px-2 h-7 rounded-md text-xs font-medium transition-colors","hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed",z?"text-foreground/80":"text-muted-foreground"),children:[e.jsx(Ot,{size:14,className:"shrink-0",style:{color:z?.color??"var(--muted-foreground)"}}),e.jsx("span",{className:"max-w-[120px] truncate",children:z?.name??c("Project")}),e.jsx(pe,{size:12,className:f("text-muted-foreground transition-transform",M&&"rotate-180")})]}),M&&e.jsx("div",{className:"absolute top-full left-0 mt-1.5 w-56 bg-popover border border-border rounded-lg shadow-[0_4px_12px_rgba(0,0,0,0.06)] py-1 max-h-[240px] overflow-y-auto z-50",children:s.map(n=>e.jsxs("button",{type:"button",onClick:()=>dt(n.id),className:"flex items-center w-full px-3 py-2 text-xs text-left hover:bg-accent transition-colors",children:[e.jsx("span",{className:"size-2 rounded-full shrink-0 mr-2",style:{backgroundColor:n.color??"var(--muted-foreground)"}}),e.jsx("span",{className:f("truncate flex-1",n.id===h?"text-foreground font-medium":"text-muted-foreground"),children:n.name}),e.jsx(ee,{size:14,className:f("ml-2 shrink-0 text-foreground",n.id===h?"opacity-100":"opacity-0")})]},n.id))})]}),(v||I==="SOLO")&&e.jsxs("div",{className:"relative",ref:je,children:[e.jsxs("button",{type:"button",onClick:()=>{S||Q(n=>!n)},disabled:S,className:f("flex items-center gap-1.5 px-2 h-7 rounded-md text-xs font-medium transition-colors","hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed",q?"text-foreground/80":"text-muted-foreground"),children:[e.jsx(Be,{agentType:q?.agentType,className:"size-3.5"}),e.jsx("span",{className:"max-w-[120px] truncate",children:q?.name??c(i?"Loading...":"Agent")}),e.jsx(pe,{size:12,className:f("text-muted-foreground transition-transform",H&&"rotate-180")})]}),H&&e.jsx("div",{className:"absolute top-full left-0 z-50 mt-1.5 max-h-[min(60vh,320px)] w-72 max-w-[calc(100vw-2rem)] overflow-y-auto rounded-lg border border-border bg-popover py-1 shadow-[0_4px_12px_rgba(0,0,0,0.06)] sm:w-80",children:a.map(n=>e.jsx("div",{tabIndex:n.available?void 0:0,role:n.available?void 0:"group","aria-label":n.available?void 0:`${n.name}: ${c(n.reason||"Agent executable is unavailable.")}`,className:"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",children:e.jsxs("button",{type:"button",disabled:!n.available,onClick:()=>{C(n.id),Q(!1)},className:f("flex w-full items-start px-3 py-2 text-left text-xs transition-colors hover:bg-accent",!n.available&&"cursor-not-allowed"),children:[e.jsx(ee,{size:14,className:f("mr-2 mt-0.5 shrink-0 text-foreground",n.id===P?"opacity-100":"opacity-0")}),e.jsx(Be,{agentType:n.agentType,className:"mr-2 mt-0.5 size-3.5 shrink-0"}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsxs("span",{className:f("block break-words",n.id===P?"font-medium text-foreground":"text-muted-foreground"),children:[n.name,n.available?"":c(" (unavailable)")]}),n.permissionMode?e.jsx("span",{className:"mt-0.5 block text-[11px] text-muted-foreground",children:c("Required permission: {mode}",{mode:c(Tt[n.permissionMode])})}):null,n.reason?e.jsx("span",{className:"mt-0.5 block break-words text-[11px] leading-snug text-destructive",children:c(n.reason)}):null]})]})},n.id))})]}),!v&&I==="SOLO"&&e.jsxs("div",{className:"relative",ref:Ce,children:[e.jsxs("button",{type:"button",onClick:()=>{S||J(n=>!n)},disabled:S,className:f("flex items-center gap-1.5 px-2 h-7 rounded-md text-xs font-medium transition-colors","hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed text-foreground/80"),children:[e.jsx(Lt,{size:14,className:"text-muted-foreground"}),e.jsx("span",{className:"max-w-[96px] truncate",children:ot}),e.jsx(pe,{size:12,className:f("text-muted-foreground transition-transform",oe&&"rotate-180")})]}),oe&&e.jsxs("div",{className:"absolute top-full left-0 mt-1.5 w-72 max-w-[calc(100vw-2rem)] bg-popover border border-border rounded-lg shadow-[0_4px_12px_rgba(0,0,0,0.06)] py-1 z-50",children:[O?e.jsx(He,{side:"bottom",className:"block w-full",content:Pe,children:e.jsxs("div",{tabIndex:0,"aria-label":Pe,className:"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",children:[e.jsxs("button",{type:"button",disabled:!0,className:"flex w-full cursor-not-allowed items-center px-3 py-2 text-left text-xs opacity-40 transition-colors",children:[e.jsx(ee,{size:14,className:"mr-2 mt-0.5 shrink-0 text-foreground opacity-0"}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block truncate text-muted-foreground",children:c("工作树模式")}),e.jsx("span",{className:"mt-0.5 block whitespace-normal text-[11px] leading-snug text-muted-foreground/80",children:De})]})]}),e.jsx("button",{type:"button",onClick:it,disabled:de.isPending,className:"flex w-full items-center px-3 py-2 text-left text-xs text-muted-foreground transition-colors hover:bg-accent disabled:cursor-not-allowed disabled:opacity-50",children:de.isPending?c("检测中..."):c("重新检测 Git 状态")})]})}):e.jsxs("button",{type:"button",onClick:()=>{A(E.WORKTREE),J(!1)},className:"flex w-full items-center px-3 py-2 text-left text-xs transition-colors hover:bg-accent",children:[e.jsx(ee,{size:14,className:f("mr-2 mt-0.5 shrink-0 text-foreground",B===E.WORKTREE?"opacity-100":"opacity-0")}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:f("block truncate",B===E.WORKTREE?"text-foreground font-medium":"text-muted-foreground"),children:c("工作树模式")}),e.jsx("span",{className:"mt-0.5 block whitespace-normal text-[11px] leading-snug text-muted-foreground/80",children:De})]})]}),e.jsxs("button",{type:"button",onClick:()=>{A(E.MAIN_DIRECTORY),J(!1)},className:"flex items-start w-full px-3 py-2 text-xs text-left hover:bg-accent transition-colors",children:[e.jsx(ee,{size:14,className:f("mr-2 mt-0.5 shrink-0 text-foreground",B===E.MAIN_DIRECTORY?"opacity-100":"opacity-0")}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:f("block truncate",B===E.MAIN_DIRECTORY?"text-foreground font-medium":"text-muted-foreground"),children:c("本地模式")}),e.jsx("span",{className:"mt-0.5 block whitespace-normal text-[11px] leading-snug text-muted-foreground/80",children:rt})]})]})]})]}),!v&&e.jsx(Xt,{value:K,compact:!0,disabled:S,onChange:W}),!v&&e.jsx(He,{side:"bottom",className:"ml-auto",content:O?c("Local projects only support local Solo tasks. Initialize Git to use worktrees and TeamRun."):B===E.MAIN_DIRECTORY?c("TeamRun 需要工作树模式。开启团队模式时会自动切换为工作树模式。"):c("启用 TeamRun 后可选择团队模板或成员。"),children:e.jsxs("button",{type:"button",role:"switch","aria-checked":I==="TEAM",onClick:()=>{S||O||(X==="TEAM"?(_("SOLO"),b(!1)):(_("TEAM"),J(!1),A(E.WORKTREE),b(!0)))},disabled:S||O,className:f("flex items-center gap-2 h-7 pl-2 pr-2 rounded-md text-xs font-medium transition-colors","hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",I==="TEAM"?"text-foreground/80":"text-muted-foreground"),"aria-label":c("启用团队模式"),children:[e.jsx(jt,{size:14,className:I==="TEAM"?"text-foreground/80":"text-muted-foreground"}),e.jsx("span",{children:c("团队模式")}),(O||B===E.MAIN_DIRECTORY)&&I!=="TEAM"?e.jsx(Ct,{size:12,className:"text-muted-foreground/70","aria-hidden":"true"}):null,e.jsx("span",{className:f("relative inline-flex h-4 w-7 shrink-0 items-center rounded-full transition-colors",I==="TEAM"?"bg-primary":"bg-border"),children:e.jsx("span",{className:f("inline-block size-3 rounded-full bg-background shadow-sm transition-transform",I==="TEAM"?"translate-x-3.5":"translate-x-0.5")})})]})})]}),q&&!q.available?e.jsx("p",{role:"alert",className:"mt-2 break-words px-2 text-xs leading-snug text-destructive",children:q.reason?c(q.reason):c("Agent executable is unavailable.")}):null,!v&&I==="TEAM"&&r&&e.jsx("div",{className:"mt-2.5 rounded-xl border border-border/60 bg-muted/40 p-3 animate-[fadeInUp_0.25s_cubic-bezier(0.16,1,0.3,1)]",children:e.jsx(Jt,{mode:U,setMode:Z,selectedTemplateId:G,setSelectedTemplateId:ne,selectedMemberPresetIds:F,setSelectedMemberPresetIds:le,disabled:S,compact:!0})})]})}export{Gs as C,ts as S,Jt as T,Ht as Z,hs as a,Ps as b,_s as c,Ds as d,Xt as e,Qt as f,Ls as g,zs as h,qt as i,$s as j,as as k,Os as u};