@overlordai/server 1.0.53 → 1.0.54

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 (533) hide show
  1. package/database/migrations/001-init-schema.sql +73 -9
  2. package/dist/adapters/adapter.interface.d.ts +1 -4
  3. package/dist/adapters/adapter.interface.d.ts.map +1 -1
  4. package/dist/adapters/adapter.interface.js.map +1 -1
  5. package/dist/adapters/adapter.module.d.ts.map +1 -1
  6. package/dist/adapters/adapter.module.js +8 -7
  7. package/dist/adapters/adapter.module.js.map +1 -1
  8. package/dist/adapters/lark/lark-card.builder.d.ts +1 -25
  9. package/dist/adapters/lark/lark-card.builder.d.ts.map +1 -1
  10. package/dist/adapters/lark/lark-card.builder.js +6 -110
  11. package/dist/adapters/lark/lark-card.builder.js.map +1 -1
  12. package/dist/adapters/lark/lark-message.parser.d.ts +4 -4
  13. package/dist/adapters/lark/lark-message.parser.d.ts.map +1 -1
  14. package/dist/adapters/lark/lark-message.parser.js +20 -13
  15. package/dist/adapters/lark/lark-message.parser.js.map +1 -1
  16. package/dist/adapters/lark/lark-signature.d.ts.map +1 -1
  17. package/dist/adapters/lark/lark-signature.js +6 -0
  18. package/dist/adapters/lark/lark-signature.js.map +1 -1
  19. package/dist/adapters/lark/lark.adapter.d.ts +14 -9
  20. package/dist/adapters/lark/lark.adapter.d.ts.map +1 -1
  21. package/dist/adapters/lark/lark.adapter.js +99 -177
  22. package/dist/adapters/lark/lark.adapter.js.map +1 -1
  23. package/dist/adapters/lark/lark.controller.d.ts +10 -1
  24. package/dist/adapters/lark/lark.controller.d.ts.map +1 -1
  25. package/dist/adapters/lark/lark.controller.js +48 -14
  26. package/dist/adapters/lark/lark.controller.js.map +1 -1
  27. package/dist/adapters/slack/slack-block.builder.d.ts +8 -0
  28. package/dist/adapters/slack/slack-block.builder.d.ts.map +1 -0
  29. package/dist/adapters/slack/slack-block.builder.js +117 -0
  30. package/dist/adapters/slack/slack-block.builder.js.map +1 -0
  31. package/dist/adapters/slack/slack-message.parser.d.ts +15 -0
  32. package/dist/adapters/slack/slack-message.parser.d.ts.map +1 -0
  33. package/dist/adapters/slack/slack-message.parser.js +158 -0
  34. package/dist/adapters/slack/slack-message.parser.js.map +1 -0
  35. package/dist/adapters/slack/slack-signature.d.ts +7 -0
  36. package/dist/adapters/slack/slack-signature.d.ts.map +1 -0
  37. package/dist/adapters/slack/slack-signature.js +59 -0
  38. package/dist/adapters/slack/slack-signature.js.map +1 -0
  39. package/dist/adapters/slack/slack.adapter.d.ts +67 -13
  40. package/dist/adapters/slack/slack.adapter.d.ts.map +1 -1
  41. package/dist/adapters/slack/slack.adapter.js +468 -19
  42. package/dist/adapters/slack/slack.adapter.js.map +1 -1
  43. package/dist/adapters/slack/slack.controller.d.ts +20 -0
  44. package/dist/adapters/slack/slack.controller.d.ts.map +1 -0
  45. package/dist/adapters/slack/slack.controller.js +257 -0
  46. package/dist/adapters/slack/slack.controller.js.map +1 -0
  47. package/dist/app.module.d.ts.map +1 -1
  48. package/dist/app.module.js +4 -0
  49. package/dist/app.module.js.map +1 -1
  50. package/dist/auth/auth.controller.d.ts.map +1 -1
  51. package/dist/auth/auth.controller.js +1 -0
  52. package/dist/auth/auth.controller.js.map +1 -1
  53. package/dist/auth/auth.module.d.ts.map +1 -1
  54. package/dist/auth/auth.module.js +4 -5
  55. package/dist/auth/auth.module.js.map +1 -1
  56. package/dist/auth/auth.service.d.ts +9 -2
  57. package/dist/auth/auth.service.d.ts.map +1 -1
  58. package/dist/auth/auth.service.js +50 -79
  59. package/dist/auth/auth.service.js.map +1 -1
  60. package/dist/auth/authenticated-request.d.ts +10 -0
  61. package/dist/auth/authenticated-request.d.ts.map +1 -0
  62. package/dist/auth/authenticated-request.js +3 -0
  63. package/dist/auth/authenticated-request.js.map +1 -0
  64. package/dist/auth/extract-user.middleware.d.ts.map +1 -1
  65. package/dist/auth/extract-user.middleware.js +2 -1
  66. package/dist/auth/extract-user.middleware.js.map +1 -1
  67. package/dist/auth/guards/jwt-auth.guard.d.ts.map +1 -1
  68. package/dist/auth/guards/jwt-auth.guard.js +5 -2
  69. package/dist/auth/guards/jwt-auth.guard.js.map +1 -1
  70. package/dist/auth/guards/project-role.guard.d.ts.map +1 -1
  71. package/dist/auth/guards/project-role.guard.js +6 -8
  72. package/dist/auth/guards/project-role.guard.js.map +1 -1
  73. package/dist/auth/jwt.strategy.d.ts +6 -3
  74. package/dist/auth/jwt.strategy.d.ts.map +1 -1
  75. package/dist/auth/jwt.strategy.js +15 -5
  76. package/dist/auth/jwt.strategy.js.map +1 -1
  77. package/dist/common/command-parser.d.ts +29 -0
  78. package/dist/common/command-parser.d.ts.map +1 -0
  79. package/dist/common/command-parser.js +133 -0
  80. package/dist/common/command-parser.js.map +1 -0
  81. package/dist/common/config.d.ts +17 -0
  82. package/dist/common/config.d.ts.map +1 -0
  83. package/dist/common/config.js +47 -0
  84. package/dist/common/config.js.map +1 -0
  85. package/dist/common/crypto.service.d.ts +4 -1
  86. package/dist/common/crypto.service.d.ts.map +1 -1
  87. package/dist/common/crypto.service.js +14 -7
  88. package/dist/common/crypto.service.js.map +1 -1
  89. package/dist/common/error-filter.d.ts +1 -0
  90. package/dist/common/error-filter.d.ts.map +1 -1
  91. package/dist/common/error-filter.js +6 -2
  92. package/dist/common/error-filter.js.map +1 -1
  93. package/dist/common/git-utils.d.ts +9 -0
  94. package/dist/common/git-utils.d.ts.map +1 -0
  95. package/dist/common/git-utils.js +41 -0
  96. package/dist/common/git-utils.js.map +1 -0
  97. package/dist/common/health.controller.d.ts.map +1 -1
  98. package/dist/common/health.controller.js +3 -5
  99. package/dist/common/health.controller.js.map +1 -1
  100. package/dist/common/machine-utils.d.ts +32 -0
  101. package/dist/common/machine-utils.d.ts.map +1 -0
  102. package/dist/common/machine-utils.js +12 -0
  103. package/dist/common/machine-utils.js.map +1 -0
  104. package/dist/common/pagination.d.ts +12 -5
  105. package/dist/common/pagination.d.ts.map +1 -1
  106. package/dist/common/pagination.js +27 -17
  107. package/dist/common/pagination.js.map +1 -1
  108. package/dist/common/project-validation.d.ts +7 -0
  109. package/dist/common/project-validation.d.ts.map +1 -0
  110. package/dist/common/project-validation.js +86 -0
  111. package/dist/common/project-validation.js.map +1 -0
  112. package/dist/common/rate-limit.guard.d.ts +4 -3
  113. package/dist/common/rate-limit.guard.d.ts.map +1 -1
  114. package/dist/common/rate-limit.guard.js +14 -5
  115. package/dist/common/rate-limit.guard.js.map +1 -1
  116. package/dist/common/sql-utils.d.ts +6 -0
  117. package/dist/common/sql-utils.d.ts.map +1 -0
  118. package/dist/common/sql-utils.js +11 -0
  119. package/dist/common/sql-utils.js.map +1 -0
  120. package/dist/common/string-utils.d.ts +6 -0
  121. package/dist/common/string-utils.d.ts.map +1 -0
  122. package/dist/common/string-utils.js +15 -0
  123. package/dist/common/string-utils.js.map +1 -0
  124. package/dist/common/worker-utils.d.ts +31 -0
  125. package/dist/common/worker-utils.d.ts.map +1 -0
  126. package/dist/common/worker-utils.js +12 -0
  127. package/dist/common/worker-utils.js.map +1 -0
  128. package/dist/database/base.repository.d.ts +56 -0
  129. package/dist/database/base.repository.d.ts.map +1 -0
  130. package/dist/database/base.repository.js +82 -0
  131. package/dist/database/base.repository.js.map +1 -0
  132. package/dist/database/database.service.d.ts.map +1 -1
  133. package/dist/database/database.service.js +9 -1
  134. package/dist/database/database.service.js.map +1 -1
  135. package/dist/database/migration-runner.d.ts.map +1 -1
  136. package/dist/database/migration-runner.js +2 -1
  137. package/dist/database/migration-runner.js.map +1 -1
  138. package/dist/database/repositories/audit-log.repository.d.ts.map +1 -1
  139. package/dist/database/repositories/audit-log.repository.js +16 -18
  140. package/dist/database/repositories/audit-log.repository.js.map +1 -1
  141. package/dist/database/repositories/bot.repository.d.ts +18 -32
  142. package/dist/database/repositories/bot.repository.d.ts.map +1 -1
  143. package/dist/database/repositories/bot.repository.js +42 -21
  144. package/dist/database/repositories/bot.repository.js.map +1 -1
  145. package/dist/database/repositories/developer-token.repository.d.ts +7 -17
  146. package/dist/database/repositories/developer-token.repository.d.ts.map +1 -1
  147. package/dist/database/repositories/developer-token.repository.js +24 -15
  148. package/dist/database/repositories/developer-token.repository.js.map +1 -1
  149. package/dist/database/repositories/developer.repository.d.ts +5 -1
  150. package/dist/database/repositories/developer.repository.d.ts.map +1 -1
  151. package/dist/database/repositories/developer.repository.js +60 -49
  152. package/dist/database/repositories/developer.repository.js.map +1 -1
  153. package/dist/database/repositories/machine.repository.d.ts.map +1 -1
  154. package/dist/database/repositories/machine.repository.js +2 -7
  155. package/dist/database/repositories/machine.repository.js.map +1 -1
  156. package/dist/database/repositories/notification.repository.d.ts +1 -0
  157. package/dist/database/repositories/notification.repository.d.ts.map +1 -1
  158. package/dist/database/repositories/notification.repository.js +25 -20
  159. package/dist/database/repositories/notification.repository.js.map +1 -1
  160. package/dist/database/repositories/project-member.repository.d.ts +7 -16
  161. package/dist/database/repositories/project-member.repository.d.ts.map +1 -1
  162. package/dist/database/repositories/project-member.repository.js +34 -24
  163. package/dist/database/repositories/project-member.repository.js.map +1 -1
  164. package/dist/database/repositories/project.repository.d.ts +2 -1
  165. package/dist/database/repositories/project.repository.d.ts.map +1 -1
  166. package/dist/database/repositories/project.repository.js +70 -71
  167. package/dist/database/repositories/project.repository.js.map +1 -1
  168. package/dist/database/repositories/session.repository.d.ts.map +1 -1
  169. package/dist/database/repositories/session.repository.js +22 -25
  170. package/dist/database/repositories/session.repository.js.map +1 -1
  171. package/dist/database/repositories/task.repository.d.ts +31 -7
  172. package/dist/database/repositories/task.repository.d.ts.map +1 -1
  173. package/dist/database/repositories/task.repository.js +134 -86
  174. package/dist/database/repositories/task.repository.js.map +1 -1
  175. package/dist/database/repositories/worker-token.repository.d.ts.map +1 -1
  176. package/dist/database/repositories/worker-token.repository.js +18 -16
  177. package/dist/database/repositories/worker-token.repository.js.map +1 -1
  178. package/dist/database/repositories/worker.repository.d.ts +50 -0
  179. package/dist/database/repositories/worker.repository.d.ts.map +1 -0
  180. package/dist/database/repositories/worker.repository.js +215 -0
  181. package/dist/database/repositories/worker.repository.js.map +1 -0
  182. package/dist/database/repositories/workspace.repository.d.ts +3 -2
  183. package/dist/database/repositories/workspace.repository.d.ts.map +1 -1
  184. package/dist/database/repositories/workspace.repository.js +29 -21
  185. package/dist/database/repositories/workspace.repository.js.map +1 -1
  186. package/dist/database/repository.module.d.ts +3 -0
  187. package/dist/database/repository.module.d.ts.map +1 -0
  188. package/dist/database/repository.module.js +45 -0
  189. package/dist/database/repository.module.js.map +1 -0
  190. package/dist/dispatcher/capability.service.d.ts +19 -14
  191. package/dist/dispatcher/capability.service.d.ts.map +1 -1
  192. package/dist/dispatcher/capability.service.js +77 -69
  193. package/dist/dispatcher/capability.service.js.map +1 -1
  194. package/dist/dispatcher/cleanup.service.d.ts +1 -1
  195. package/dist/dispatcher/cleanup.service.d.ts.map +1 -1
  196. package/dist/dispatcher/cleanup.service.js +13 -13
  197. package/dist/dispatcher/cleanup.service.js.map +1 -1
  198. package/dist/dispatcher/dedup.service.d.ts +17 -3
  199. package/dist/dispatcher/dedup.service.d.ts.map +1 -1
  200. package/dist/dispatcher/dedup.service.js +76 -82
  201. package/dist/dispatcher/dedup.service.js.map +1 -1
  202. package/dist/dispatcher/dispatcher.module.d.ts.map +1 -1
  203. package/dist/dispatcher/dispatcher.module.js +11 -18
  204. package/dist/dispatcher/dispatcher.module.js.map +1 -1
  205. package/dist/dispatcher/dispatcher.service.d.ts +14 -116
  206. package/dist/dispatcher/dispatcher.service.d.ts.map +1 -1
  207. package/dist/dispatcher/dispatcher.service.js +62 -940
  208. package/dist/dispatcher/dispatcher.service.js.map +1 -1
  209. package/dist/dispatcher/dispatcher.types.d.ts +33 -0
  210. package/dist/dispatcher/dispatcher.types.d.ts.map +1 -0
  211. package/dist/dispatcher/dispatcher.types.js +3 -0
  212. package/dist/dispatcher/dispatcher.types.js.map +1 -0
  213. package/dist/dispatcher/heartbeat.service.d.ts +17 -10
  214. package/dist/dispatcher/heartbeat.service.d.ts.map +1 -1
  215. package/dist/dispatcher/heartbeat.service.js +47 -51
  216. package/dist/dispatcher/heartbeat.service.js.map +1 -1
  217. package/dist/dispatcher/pty-relay.service.d.ts.map +1 -1
  218. package/dist/dispatcher/pty-relay.service.js +7 -15
  219. package/dist/dispatcher/pty-relay.service.js.map +1 -1
  220. package/dist/dispatcher/reconciler.d.ts +18 -8
  221. package/dist/dispatcher/reconciler.d.ts.map +1 -1
  222. package/dist/dispatcher/reconciler.js +219 -130
  223. package/dist/dispatcher/reconciler.js.map +1 -1
  224. package/dist/dispatcher/scheduler.service.d.ts +15 -9
  225. package/dist/dispatcher/scheduler.service.d.ts.map +1 -1
  226. package/dist/dispatcher/scheduler.service.js +95 -53
  227. package/dist/dispatcher/scheduler.service.js.map +1 -1
  228. package/dist/dispatcher/state-machine.d.ts.map +1 -1
  229. package/dist/dispatcher/state-machine.js +1 -5
  230. package/dist/dispatcher/state-machine.js.map +1 -1
  231. package/dist/dispatcher/task-creation.service.d.ts +30 -0
  232. package/dist/dispatcher/task-creation.service.d.ts.map +1 -0
  233. package/dist/dispatcher/task-creation.service.js +242 -0
  234. package/dist/dispatcher/task-creation.service.js.map +1 -0
  235. package/dist/dispatcher/task-lifecycle.service.d.ts +63 -0
  236. package/dist/dispatcher/task-lifecycle.service.d.ts.map +1 -0
  237. package/dist/dispatcher/task-lifecycle.service.js +584 -0
  238. package/dist/dispatcher/task-lifecycle.service.js.map +1 -0
  239. package/dist/dispatcher/task-log-batcher.d.ts.map +1 -1
  240. package/dist/dispatcher/task-log-batcher.js +4 -11
  241. package/dist/dispatcher/task-log-batcher.js.map +1 -1
  242. package/dist/dispatcher/worker-auth.service.d.ts +29 -0
  243. package/dist/dispatcher/worker-auth.service.d.ts.map +1 -0
  244. package/dist/dispatcher/worker-auth.service.js +296 -0
  245. package/dist/dispatcher/worker-auth.service.js.map +1 -0
  246. package/dist/dispatcher/worker-connection.manager.d.ts +15 -15
  247. package/dist/dispatcher/worker-connection.manager.d.ts.map +1 -1
  248. package/dist/dispatcher/worker-connection.manager.js +35 -43
  249. package/dist/dispatcher/worker-connection.manager.js.map +1 -1
  250. package/dist/dispatcher/worker-selector.d.ts +18 -0
  251. package/dist/dispatcher/worker-selector.d.ts.map +1 -0
  252. package/dist/dispatcher/worker-selector.js +150 -0
  253. package/dist/dispatcher/worker-selector.js.map +1 -0
  254. package/dist/events/event-types.d.ts +31 -0
  255. package/dist/events/event-types.d.ts.map +1 -0
  256. package/dist/events/event-types.js +16 -0
  257. package/dist/events/event-types.js.map +1 -0
  258. package/dist/events/events.module.d.ts +7 -0
  259. package/dist/events/events.module.d.ts.map +1 -0
  260. package/dist/events/events.module.js +26 -0
  261. package/dist/events/events.module.js.map +1 -0
  262. package/dist/main.js +22 -0
  263. package/dist/main.js.map +1 -1
  264. package/dist/notifier/debouncer.d.ts +1 -1
  265. package/dist/notifier/debouncer.d.ts.map +1 -1
  266. package/dist/notifier/debouncer.js +2 -1
  267. package/dist/notifier/debouncer.js.map +1 -1
  268. package/dist/notifier/notification-consumer.d.ts +1 -1
  269. package/dist/notifier/notification-consumer.d.ts.map +1 -1
  270. package/dist/notifier/notification-consumer.js +5 -5
  271. package/dist/notifier/notification-consumer.js.map +1 -1
  272. package/dist/notifier/notifier.module.d.ts.map +1 -1
  273. package/dist/notifier/notifier.module.js +0 -6
  274. package/dist/notifier/notifier.module.js.map +1 -1
  275. package/dist/notifier/notifier.service.d.ts +1 -1
  276. package/dist/notifier/notifier.service.d.ts.map +1 -1
  277. package/dist/notifier/notifier.service.js +7 -9
  278. package/dist/notifier/notifier.service.js.map +1 -1
  279. package/dist/notifier/template.service.d.ts +1 -1
  280. package/dist/notifier/template.service.d.ts.map +1 -1
  281. package/dist/notifier/template.service.js +6 -10
  282. package/dist/notifier/template.service.js.map +1 -1
  283. package/dist/redis/redis.service.d.ts.map +1 -1
  284. package/dist/redis/redis.service.js +2 -2
  285. package/dist/redis/redis.service.js.map +1 -1
  286. package/dist/web/admin/admin-audit.controller.d.ts.map +1 -1
  287. package/dist/web/admin/admin-audit.controller.js +2 -1
  288. package/dist/web/admin/admin-audit.controller.js.map +1 -1
  289. package/dist/web/admin/admin-bot.controller.d.ts +11 -48
  290. package/dist/web/admin/admin-bot.controller.d.ts.map +1 -1
  291. package/dist/web/admin/admin-bot.controller.js +50 -18
  292. package/dist/web/admin/admin-bot.controller.js.map +1 -1
  293. package/dist/web/admin/admin-developer.controller.d.ts +14 -27
  294. package/dist/web/admin/admin-developer.controller.d.ts.map +1 -1
  295. package/dist/web/admin/admin-developer.controller.js +62 -28
  296. package/dist/web/admin/admin-developer.controller.js.map +1 -1
  297. package/dist/web/admin/admin-machine.controller.d.ts +1 -8
  298. package/dist/web/admin/admin-machine.controller.d.ts.map +1 -1
  299. package/dist/web/admin/admin-machine.controller.js +3 -6
  300. package/dist/web/admin/admin-machine.controller.js.map +1 -1
  301. package/dist/web/admin/admin-project.controller.d.ts +9 -30
  302. package/dist/web/admin/admin-project.controller.d.ts.map +1 -1
  303. package/dist/web/admin/admin-project.controller.js +15 -60
  304. package/dist/web/admin/admin-project.controller.js.map +1 -1
  305. package/dist/web/admin/admin-settings.controller.d.ts +7 -10
  306. package/dist/web/admin/admin-settings.controller.d.ts.map +1 -1
  307. package/dist/web/admin/admin-settings.controller.js +14 -6
  308. package/dist/web/admin/admin-settings.controller.js.map +1 -1
  309. package/dist/web/admin/admin-token.controller.d.ts +6 -13
  310. package/dist/web/admin/admin-token.controller.d.ts.map +1 -1
  311. package/dist/web/admin/admin-token.controller.js +15 -27
  312. package/dist/web/admin/admin-token.controller.js.map +1 -1
  313. package/dist/web/admin/admin-worker.controller.d.ts +26 -0
  314. package/dist/web/admin/admin-worker.controller.d.ts.map +1 -0
  315. package/dist/web/admin/admin-worker.controller.js +184 -0
  316. package/dist/web/admin/admin-worker.controller.js.map +1 -0
  317. package/dist/web/dashboard.controller.d.ts +6 -12
  318. package/dist/web/dashboard.controller.d.ts.map +1 -1
  319. package/dist/web/dashboard.controller.js +30 -18
  320. package/dist/web/dashboard.controller.js.map +1 -1
  321. package/dist/web/dashboard.service.d.ts +21 -12
  322. package/dist/web/dashboard.service.d.ts.map +1 -1
  323. package/dist/web/dashboard.service.js +169 -119
  324. package/dist/web/dashboard.service.js.map +1 -1
  325. package/dist/web/event.gateway.d.ts +32 -0
  326. package/dist/web/event.gateway.d.ts.map +1 -0
  327. package/dist/web/event.gateway.js +168 -0
  328. package/dist/web/event.gateway.js.map +1 -0
  329. package/dist/web/frame-handlers/frame-handler.interface.d.ts +24 -0
  330. package/dist/web/frame-handlers/frame-handler.interface.d.ts.map +1 -0
  331. package/dist/web/frame-handlers/frame-handler.interface.js +3 -0
  332. package/dist/web/frame-handlers/frame-handler.interface.js.map +1 -0
  333. package/dist/web/frame-handlers/frame-handler.registry.d.ts +16 -0
  334. package/dist/web/frame-handlers/frame-handler.registry.d.ts.map +1 -0
  335. package/dist/web/frame-handlers/frame-handler.registry.js +39 -0
  336. package/dist/web/frame-handlers/frame-handler.registry.js.map +1 -0
  337. package/dist/web/frame-handlers/heartbeat.handler.d.ts +13 -0
  338. package/dist/web/frame-handlers/heartbeat.handler.d.ts.map +1 -0
  339. package/dist/web/frame-handlers/heartbeat.handler.js +35 -0
  340. package/dist/web/frame-handlers/heartbeat.handler.js.map +1 -0
  341. package/dist/web/frame-handlers/index.d.ts +7 -0
  342. package/dist/web/frame-handlers/index.d.ts.map +1 -0
  343. package/dist/web/frame-handlers/index.js +14 -0
  344. package/dist/web/frame-handlers/index.js.map +1 -0
  345. package/dist/web/frame-handlers/progress.handler.d.ts +25 -0
  346. package/dist/web/frame-handlers/progress.handler.d.ts.map +1 -0
  347. package/dist/web/frame-handlers/progress.handler.js +69 -0
  348. package/dist/web/frame-handlers/progress.handler.js.map +1 -0
  349. package/dist/web/frame-handlers/stage-confirm.handler.d.ts +15 -0
  350. package/dist/web/frame-handlers/stage-confirm.handler.d.ts.map +1 -0
  351. package/dist/web/frame-handlers/stage-confirm.handler.js +39 -0
  352. package/dist/web/frame-handlers/stage-confirm.handler.js.map +1 -0
  353. package/dist/web/frame-handlers/tunnel.handler.d.ts +10 -0
  354. package/dist/web/frame-handlers/tunnel.handler.d.ts.map +1 -0
  355. package/dist/web/frame-handlers/tunnel.handler.js +31 -0
  356. package/dist/web/frame-handlers/tunnel.handler.js.map +1 -0
  357. package/dist/web/interaction.service.d.ts +0 -4
  358. package/dist/web/interaction.service.d.ts.map +1 -1
  359. package/dist/web/interaction.service.js +0 -10
  360. package/dist/web/interaction.service.js.map +1 -1
  361. package/dist/web/machine.controller.d.ts +1 -8
  362. package/dist/web/machine.controller.d.ts.map +1 -1
  363. package/dist/web/machine.controller.js +6 -9
  364. package/dist/web/machine.controller.js.map +1 -1
  365. package/dist/web/notification.controller.d.ts +1 -8
  366. package/dist/web/notification.controller.d.ts.map +1 -1
  367. package/dist/web/notification.controller.js +3 -2
  368. package/dist/web/notification.controller.js.map +1 -1
  369. package/dist/web/profile.controller.d.ts +19 -10
  370. package/dist/web/profile.controller.d.ts.map +1 -1
  371. package/dist/web/profile.controller.js +100 -13
  372. package/dist/web/profile.controller.js.map +1 -1
  373. package/dist/web/project-member.service.d.ts +16 -0
  374. package/dist/web/project-member.service.d.ts.map +1 -0
  375. package/dist/web/project-member.service.js +90 -0
  376. package/dist/web/project-member.service.js.map +1 -0
  377. package/dist/web/project.controller.d.ts +43 -26
  378. package/dist/web/project.controller.d.ts.map +1 -1
  379. package/dist/web/project.controller.js +73 -46
  380. package/dist/web/project.controller.js.map +1 -1
  381. package/dist/web/pty.gateway.d.ts +9 -3
  382. package/dist/web/pty.gateway.d.ts.map +1 -1
  383. package/dist/web/pty.gateway.js +46 -18
  384. package/dist/web/pty.gateway.js.map +1 -1
  385. package/dist/web/search.service.d.ts +9 -2
  386. package/dist/web/search.service.d.ts.map +1 -1
  387. package/dist/web/search.service.js +53 -26
  388. package/dist/web/search.service.js.map +1 -1
  389. package/dist/web/task.controller.d.ts +15 -24
  390. package/dist/web/task.controller.d.ts.map +1 -1
  391. package/dist/web/task.controller.js +70 -53
  392. package/dist/web/task.controller.js.map +1 -1
  393. package/dist/web/tunnel.service.d.ts +74 -0
  394. package/dist/web/tunnel.service.d.ts.map +1 -0
  395. package/dist/web/tunnel.service.js +250 -0
  396. package/dist/web/tunnel.service.js.map +1 -0
  397. package/dist/web/web-event.service.d.ts +25 -0
  398. package/dist/web/web-event.service.d.ts.map +1 -0
  399. package/dist/web/web-event.service.js +116 -0
  400. package/dist/web/web-event.service.js.map +1 -0
  401. package/dist/web/web.module.d.ts.map +1 -1
  402. package/dist/web/web.module.js +13 -28
  403. package/dist/web/web.module.js.map +1 -1
  404. package/dist/web/worker-channel.gateway.d.ts +10 -18
  405. package/dist/web/worker-channel.gateway.d.ts.map +1 -1
  406. package/dist/web/worker-channel.gateway.js +70 -144
  407. package/dist/web/worker-channel.gateway.js.map +1 -1
  408. package/dist/web/worker-web.controller.d.ts +15 -0
  409. package/dist/web/worker-web.controller.d.ts.map +1 -0
  410. package/dist/web/worker-web.controller.js +143 -0
  411. package/dist/web/worker-web.controller.js.map +1 -0
  412. package/dist/web/worker.controller.d.ts +3 -3
  413. package/dist/web/worker.controller.d.ts.map +1 -1
  414. package/dist/web/worker.controller.js +8 -8
  415. package/dist/web/worker.controller.js.map +1 -1
  416. package/dist/web/workspace.controller.d.ts +8 -33
  417. package/dist/web/workspace.controller.d.ts.map +1 -1
  418. package/dist/web/workspace.controller.js +93 -205
  419. package/dist/web/workspace.controller.js.map +1 -1
  420. package/package.json +10 -2
  421. package/public/apple-touch-icon-120x120.png +0 -0
  422. package/public/apple-touch-icon-152x152.png +0 -0
  423. package/public/apple-touch-icon-180x180.png +0 -0
  424. package/public/assets/AccessTokensPage-DPQB2fbi.js +1 -0
  425. package/public/assets/AdminPage-BqVelYNu.js +1 -0
  426. package/public/assets/ApiReferencePage-CiGvbLxL.js +1 -0
  427. package/public/assets/AuditLogPage-DSo4jVYm.js +6 -0
  428. package/public/assets/BindPlatformPage-CTqzpOmt.js +1 -0
  429. package/public/assets/BotManage-CIR0rrK7.js +6 -0
  430. package/public/assets/CliReferencePage-C8GmlwUz.js +14 -0
  431. package/public/assets/DeveloperManage-r6y2AoB4.js +16 -0
  432. package/public/assets/EditProjectPage-7WCsNltj.js +2 -0
  433. package/public/assets/{EmptyState-CvmhFgWJ.js → EmptyState-D3foEiul.js} +1 -1
  434. package/public/assets/HomePage-D4yv4orb.js +1 -0
  435. package/public/assets/InfoRow-DhdTYoY9.js +1 -0
  436. package/public/assets/LandingPage-CqS0E2eC.js +43 -0
  437. package/public/assets/LoginPage-DDXkdcz_.js +1 -0
  438. package/public/assets/MetricBar-DMMHfS0A.js +1 -0
  439. package/public/assets/{NotFoundPage-BuiAS4g4.js → NotFoundPage-D5x5BrlX.js} +1 -1
  440. package/public/assets/OnboardingGuide-D8RyPcEd.js +1 -0
  441. package/public/assets/PipelineEditorPage-y2-Q8ofQ.js +3 -0
  442. package/public/assets/ProfilePage-DN7usHOi.js +1 -0
  443. package/public/assets/ProjectDetailPage-DJexg49z.js +7 -0
  444. package/public/assets/ProjectListPage-Bz7I2D0H.js +6 -0
  445. package/public/assets/QuickAuth-Dr0Q50ld.js +1 -0
  446. package/public/assets/{RemoveMemberConfirmDialog-DS9z6jQT.js → RemoveMemberConfirmDialog-BCrue0AP.js} +2 -2
  447. package/public/assets/Select-BnV8yZlD.js +6 -0
  448. package/public/assets/SettingsPage-HaUCcsgl.js +6 -0
  449. package/public/assets/{Skeleton-CcVqz28_.js → Skeleton-DUgWc2LJ.js} +1 -1
  450. package/public/assets/SkillPage-BInwZTQh.js +1 -0
  451. package/public/assets/TaskDetailPage-CfwEj1hy.js +31 -0
  452. package/public/assets/TaskListPage-Dh59ldSZ.js +1 -0
  453. package/public/assets/TaskStatusBadge-DuOoGIwE.js +1 -0
  454. package/public/assets/TerminalHomePage-BwXJjr-a.js +16 -0
  455. package/public/assets/TokenManage-B0Cpv6SO.js +1 -0
  456. package/public/assets/TotpSetupPage-MSCCURj9.js +9 -0
  457. package/public/assets/WorkerDetailPage-R2veIzKo.js +1 -0
  458. package/public/assets/WorkerListPage-CserMjGO.js +6 -0
  459. package/public/assets/WorkerSetupGuidePage-SqO2lzVa.js +11 -0
  460. package/public/assets/{arrow-left-CVKez32c.js → arrow-left-DklRsENx.js} +1 -1
  461. package/public/assets/{arrow-right-g7hTftEi.js → arrow-right-MDrzFe3K.js} +1 -1
  462. package/public/assets/{bot-DYvBcsZn.js → bot-DPaziJPf.js} +1 -1
  463. package/public/assets/{chevron-right-COxU2yxz.js → chevron-right-CqyufMDW.js} +1 -1
  464. package/public/assets/{copy-BGttVgA1.js → copy-BUH7P2Hf.js} +1 -1
  465. package/public/assets/date-BdNtiQTP.js +1 -0
  466. package/public/assets/{external-link-DXlCfUjE.js → external-link-ChPgQ7N_.js} +1 -1
  467. package/public/assets/index-BS0Fbx5V.css +1 -0
  468. package/public/assets/index-vL7aQJNr.js +225 -0
  469. package/public/assets/{key-3eDVdGih.js → key-CxvwwHnW.js} +1 -1
  470. package/public/assets/{loader-circle-DPm92ETj.js → loader-circle-DS5g1-Od.js} +1 -1
  471. package/public/assets/password-CHk45-jw.js +1 -0
  472. package/public/assets/{pencil-Bs3PwH2W.js → pencil-B6spIBcw.js} +1 -1
  473. package/public/assets/{plus-d-PLzbVX.js → plus-Bnd1Vz2Y.js} +1 -1
  474. package/public/assets/{rotate-ccw-Cus8CABi.js → rotate-ccw-CgcLAXNR.js} +1 -1
  475. package/public/assets/{scroll-text-CV3wlIy2.js → scroll-text-CecZ0Fk5.js} +1 -1
  476. package/public/assets/{settings-Ccijf48b.js → settings-C1uOD3PZ.js} +1 -1
  477. package/public/assets/status-colors-BPEUp90-.js +1 -0
  478. package/public/assets/string-B39tzdVK.js +1 -0
  479. package/public/assets/task-constants-BbFyCyKk.js +14 -0
  480. package/public/assets/task.store-BE6fEPu4.js +1 -0
  481. package/public/assets/{trash-2-bRJ-xwtq.js → trash-2-A2FsT1yG.js} +1 -1
  482. package/public/assets/useFetch-vGZMAvGi.js +1 -0
  483. package/public/assets/{users-LNQqKSEN.js → users-CEdRS_A3.js} +1 -1
  484. package/public/assets/wifi-D60NkK6F.js +6 -0
  485. package/public/assets/zap-DXw1NrWz.js +6 -0
  486. package/public/icon-192x192.png +0 -0
  487. package/public/icon-512x512.png +0 -0
  488. package/public/icon-maskable-192x192.png +0 -0
  489. package/public/icon-maskable-512x512.png +0 -0
  490. package/public/index.html +21 -4
  491. package/public/manifest.webmanifest +1 -0
  492. package/public/og-image.png +0 -0
  493. package/public/registerSW.js +1 -0
  494. package/public/sw.js +1 -0
  495. package/public/workbox-6e9b121d.js +1 -0
  496. package/database/migrations/002-add-indexes.sql +0 -17
  497. package/database/migrations/003-add-settings-table.sql +0 -4
  498. package/database/migrations/004-add-developer-id-index.sql +0 -5
  499. package/database/migrations/005-add-worker-version.sql +0 -2
  500. package/database/migrations/006-add-decommission-fields.sql +0 -2
  501. package/database/migrations/007-add-ssh-url.sql +0 -1
  502. package/public/assets/AccessTokensPage-Cb5hGBfN.js +0 -1
  503. package/public/assets/AdminPage-C7Xytkfo.js +0 -1
  504. package/public/assets/ApiReferencePage-DLGVc4xN.js +0 -1
  505. package/public/assets/AuditLogPage-BgqsUJ7x.js +0 -6
  506. package/public/assets/BotManage-Ds9DYQZA.js +0 -6
  507. package/public/assets/CliReferencePage-WXinn_69.js +0 -8
  508. package/public/assets/DeveloperManage-saSq3Hfx.js +0 -16
  509. package/public/assets/EditProjectPage-C4xWYLTo.js +0 -2
  510. package/public/assets/HomePage-y20pQ52r.js +0 -1
  511. package/public/assets/LandingPage-CB5BBbdI.js +0 -36
  512. package/public/assets/LoginPage-DLljhJkQ.js +0 -1
  513. package/public/assets/MachineDetailPage-CPm9tfdp.js +0 -1
  514. package/public/assets/MachineListPage-D-nhVz-m.js +0 -6
  515. package/public/assets/PipelineEditorPage-B9GgqAju.js +0 -3
  516. package/public/assets/ProfilePage-DASpeJq6.js +0 -1
  517. package/public/assets/ProjectDetailPage-DWZyNwTV.js +0 -7
  518. package/public/assets/ProjectListPage-BUMX3Dxa.js +0 -6
  519. package/public/assets/QuickAuth-B9mvq7ht.js +0 -1
  520. package/public/assets/Select-A7PXobk_.js +0 -6
  521. package/public/assets/SettingsPage-WGzxUbGp.js +0 -6
  522. package/public/assets/SkillPage-BIt2kF3W.js +0 -1
  523. package/public/assets/TaskDetailPage-CePyNfp6.js +0 -44
  524. package/public/assets/TaskListPage-MO4_PSve.js +0 -1
  525. package/public/assets/TaskStatusBadge-QtQUDscM.js +0 -1
  526. package/public/assets/TokenManage-Sf0RGymw.js +0 -1
  527. package/public/assets/TotpSetupPage-D-rbEYLf.js +0 -9
  528. package/public/assets/WorkerSetupGuidePage-D6Fv1MQo.js +0 -16
  529. package/public/assets/index-CDBuOPx4.js +0 -212
  530. package/public/assets/index-CQojj7Zu.css +0 -1
  531. package/public/assets/protocol-C5uQmiiB.js +0 -1
  532. package/public/assets/task.store-CvjSr507.js +0 -1
  533. /package/public/assets/{TaskDetailPage-Beg8tuEN.css → task-constants-Beg8tuEN.css} +0 -0
@@ -0,0 +1,3 @@
1
+ import{a as g,r as d,j as e,v as $,e as I,g as S,t as y}from"./index-vL7aQJNr.js";import{S as C}from"./Select-BnV8yZlD.js";import{t as M}from"./string-B39tzdVK.js";const O={stages:[]};function q(){return{name:"",prompt:""}}function b({children:t}){return e.jsx("label",{className:"mb-1 block font-mono text-[11px] text-[var(--text-secondary)]",children:t})}function j({value:t,onChange:o,placeholder:a,type:r="text",className:c=""}){return e.jsx("input",{type:r,value:t,onChange:s=>o(s.target.value),placeholder:a,className:`w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] px-2.5 py-1.5 font-mono text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:border-[var(--accent)] focus:outline-none ${c}`})}function J({checked:t,onChange:o}){return e.jsx("button",{type:"button",role:"switch","aria-checked":t,onClick:()=>o(!t),className:`relative inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border border-[var(--border)] transition-colors ${t?"bg-[var(--accent)]":"bg-[var(--bg-primary)]"}`,children:e.jsx("span",{className:`inline-block h-3.5 w-3.5 rounded-full bg-white shadow transition-transform ${t?"translate-x-[18px]":"translate-x-[2px]"}`})})}function N({value:t,onChange:o,placeholder:a,rows:r=4}){return e.jsx("textarea",{value:t,onChange:c=>o(c.target.value),placeholder:a,rows:r,className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] px-2.5 py-1.5 font-mono text-xs leading-relaxed text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:border-[var(--accent)] focus:outline-none"})}function T({stage:t,index:o,selected:a,onSelect:r,onDelete:c}){const{t:s}=g(),i=t.prompt?M(t.prompt,60):"";return e.jsxs("button",{type:"button",onClick:r,className:`group relative flex w-full items-start gap-3 rounded-[4px] border px-4 py-3 text-left transition-colors ${a?"border-[var(--accent)] bg-[var(--bg-card)]":"border-[var(--border)] bg-[var(--bg-card)] hover:border-[var(--text-muted)]"}`,style:{borderLeftWidth:3,borderLeftColor:"var(--accent)"},children:[e.jsx("span",{className:"mt-0.5 shrink-0 font-mono text-[11px] text-[var(--text-muted)]",children:String(o+1).padStart(2,"0")}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs font-bold text-[var(--text-primary)]",children:t.name||"unnamed"}),t.label&&e.jsx("span",{className:"truncate font-mono text-[11px] text-[var(--text-muted)]",children:t.label})]}),i&&e.jsxs("div",{className:"mt-0.5 truncate font-mono text-[11px] text-[var(--text-muted)]",children:["// ",i]}),e.jsxs("div",{className:"mt-1 flex items-center gap-2 font-mono text-[11px] text-[var(--text-muted)]",children:[t.gate&&e.jsx("span",{children:"gate"}),t.requireConfirm&&e.jsx("span",{children:"confirm"}),t.timeout!=null&&e.jsxs("span",{children:["timeout:",t.timeout,"s"]})]})]}),e.jsx("button",{type:"button",onClick:p=>{p.stopPropagation(),c()},className:"mt-0.5 shrink-0 rounded-[4px] p-0.5 text-[var(--text-muted)] opacity-0 transition-opacity hover:text-[var(--destructive)] group-hover:opacity-100","aria-label":s("pipeline.delete_stage"),children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"3 6 5 6 21 6"}),e.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})]})}function _({stage:t,onChange:o,allStageNames:a}){const{t:r}=g(),c=d.useMemo(()=>{const s=[{value:"",label:"-- select --"}];for(const i of a)i&&i!==t.name&&s.push({value:i,label:i});return s},[a,t.name]);return e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"font-mono text-sm font-semibold text-[var(--accent)]",children:r("pipeline.stage_properties")}),e.jsx("p",{className:"font-mono text-[11px] text-[var(--text-muted)]",children:r("pipeline.editing",{name:t.name||r("pipeline.unnamed")})}),e.jsxs("div",{children:[e.jsxs(b,{children:[r("pipeline.name")," *"]}),e.jsx(j,{value:t.name,onChange:s=>o({name:s}),placeholder:r("pipeline.stage_name")})]}),e.jsxs("div",{children:[e.jsx(b,{children:"label"}),e.jsx(j,{value:t.label??"",onChange:s=>o({label:s||void 0}),placeholder:"optional display label"})]}),e.jsxs("div",{children:[e.jsx(b,{children:"prompt *"}),e.jsx(N,{value:t.prompt,onChange:s=>o({prompt:s}),placeholder:"instructions for the agent...",rows:8})]}),e.jsxs("div",{children:[e.jsx(b,{children:"gate"}),e.jsx(j,{value:t.gate??"",onChange:s=>o({gate:s||void 0}),placeholder:"Pass condition, e.g.: no P1-P3 issues"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(b,{children:r("pipeline.confirm_required")}),e.jsx(J,{checked:t.requireConfirm??!1,onChange:s=>o({requireConfirm:s})})]}),e.jsxs("div",{children:[e.jsx(b,{children:r("pipeline.timeout")}),e.jsx(j,{type:"number",value:String(t.timeout??""),onChange:s=>o({timeout:s?parseInt(s,10):void 0}),placeholder:"600"})]}),e.jsxs("div",{className:"border-t border-[var(--border)] pt-3",children:[e.jsx("p",{className:"mb-3 font-mono text-[11px] text-[var(--text-muted)]",children:r("pipeline.on_failure_section")}),e.jsxs("div",{className:"mb-3",children:[e.jsx(b,{children:r("pipeline.on_failure")}),e.jsx(C,{value:t.onFailure?"goto":"stop",onChange:s=>{o(s==="stop"?{onFailure:void 0}:{onFailure:{goto:"",maxLoops:3}})},options:[{value:"stop",label:r("pipeline.stop")},{value:"goto",label:r("pipeline.goto_stage")}]})]}),t.onFailure&&e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(b,{children:r("pipeline.goto")}),e.jsx(C,{value:t.onFailure.goto,onChange:s=>{var i;return o({onFailure:{goto:s,maxLoops:((i=t.onFailure)==null?void 0:i.maxLoops)??3}})},options:c})]}),e.jsxs("div",{children:[e.jsx(b,{children:r("pipeline.max_loops")}),e.jsx(j,{type:"number",value:String(t.onFailure.maxLoops),onChange:s=>{var i;return o({onFailure:{goto:((i=t.onFailure)==null?void 0:i.goto)??"",maxLoops:s?parseInt(s,10):3}})},placeholder:"3"})]})]})]}),e.jsxs("div",{className:"border-t border-[var(--border)] pt-3",children:[e.jsx("h4",{className:"mb-2 font-mono text-xs font-semibold text-[var(--accent)]",children:"params"}),e.jsx(N,{value:t.params?Object.entries(t.params).map(([s,i])=>`${s}=${i}`).join(`
2
+ `):"",onChange:s=>{if(!s.trim()){o({params:void 0});return}const i={};s.split(`
3
+ `).forEach(p=>{const l=p.indexOf("=");l>0&&(i[p.slice(0,l).trim()]=p.slice(l+1).trim())}),o({params:i})},placeholder:"KEY=value (one per line)",rows:3})]})]})}function B({value:t,onChange:o}){const[a,r]=d.useState(t.trim().length>0);return d.useEffect(()=>{!a&&t.trim().length>0&&r(!0)},[t,a]),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsxs("button",{type:"button",onClick:()=>r(c=>!c),className:"flex w-full items-center justify-between px-4 py-3 text-left font-mono text-xs font-semibold text-[var(--accent)]",children:[e.jsx("span",{children:"preamble"}),e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a?"[-]":"[+]"})]}),a&&e.jsx("div",{className:"border-t border-[var(--border)] px-4 py-3",children:e.jsx(N,{value:t,onChange:o,placeholder:"Global pre-prompt injected before all stages",rows:4})})]})}function G({value:t,onChange:o}){const{t:a}=g(),[r,c]=d.useState(null),[s,i]=d.useState(!1),p=d.useMemo(()=>t??O,[t]),l=p.stages,h=r!=null?l[r]??null:null,f=d.useMemo(()=>l.map(n=>n.name),[l]),v=d.useCallback(n=>{o({...p,stages:n})},[o,p]),F=d.useCallback(()=>{const n=[...l,q()];v(n),c(n.length-1)},[l,v]),E=d.useCallback(n=>{const x=l.filter((m,u)=>u!==n);v(x),r===n?c(x.length>0?Math.min(n,x.length-1):null):r!=null&&r>n&&c(r-1)},[l,r,v]),w=d.useCallback((n,x)=>{const m=l.map((u,P)=>P===n?{...u,...x}:u);v(m)},[l,v]),k=d.useCallback((n,x)=>{const m=x==="up"?n-1:n+1;if(m<0||m>=l.length)return;const u=[...l];[u[n],u[m]]=[u[m],u[n]],v(u),r===n?c(m):r===m&&c(n)},[l,r,v]),L=d.useMemo(()=>JSON.stringify(p,null,2),[p]);return e.jsxs("div",{className:"flex flex-col gap-0",children:[e.jsx("div",{className:"mb-4 flex items-center gap-2",children:e.jsxs("button",{type:"button",onClick:()=>i(n=>!n),className:`rounded-[4px] border px-2 py-1 font-mono text-[11px] transition-colors ${s?"border-[var(--accent)] text-[var(--accent)]":"border-[var(--border)] text-[var(--text-muted)] hover:text-[var(--text-primary)]"}`,children:[a("pipeline.json_toggle")," ⇅"]})}),s&&e.jsx("pre",{className:"mb-4 max-h-[400px] overflow-auto rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] p-3 font-mono text-[11px] leading-relaxed text-[var(--text-primary)]",children:L}),e.jsx("div",{className:"mb-4",children:e.jsx(B,{value:p.preamble??"",onChange:n=>o({...p,preamble:n||void 0})})}),e.jsxs("div",{className:"flex gap-6",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[l.map((n,x)=>{var m;return e.jsxs("div",{children:[e.jsx(T,{stage:n,index:x,selected:r===x,onSelect:()=>c(x),onDelete:()=>E(x)}),x<l.length-1&&e.jsxs("div",{className:"flex items-center justify-center gap-2 py-2",children:[e.jsx("div",{className:"h-6 w-px bg-[var(--border)]"}),e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:"▼"}),e.jsx("div",{className:"h-6 w-px bg-[var(--border)]"})]}),((m=n.onFailure)==null?void 0:m.goto)&&e.jsx("div",{className:"flex items-center justify-center gap-1.5 py-1",children:e.jsxs("span",{className:"text-[11px] text-[var(--warning)]",children:["↺ loop → ",n.onFailure.goto," (max ",n.onFailure.maxLoops,")"]})})]},`${x}-${n.name}`)}),r!=null&&l.length>1&&e.jsxs("div",{className:"flex items-center gap-1 pl-7 pt-2",children:[e.jsxs("button",{type:"button",disabled:r===0,onClick:()=>k(r,"up"),className:"rounded-[4px] border border-[var(--border)] px-2 py-0.5 font-mono text-[11px] text-[var(--text-muted)] transition-colors hover:text-[var(--text-primary)] disabled:opacity-30",children:["▲ ",a("pipeline.up")]}),e.jsxs("button",{type:"button",disabled:r===l.length-1,onClick:()=>k(r,"down"),className:"rounded-[4px] border border-[var(--border)] px-2 py-0.5 font-mono text-[11px] text-[var(--text-muted)] transition-colors hover:text-[var(--text-primary)] disabled:opacity-30",children:["▼ ",a("pipeline.down")]})]}),e.jsx("div",{className:"flex items-center justify-center py-3",children:e.jsxs("button",{type:"button",onClick:F,className:"flex items-center gap-1.5 rounded-[4px] border border-dashed border-[var(--border)] px-4 py-2 font-mono text-xs text-[var(--accent)] transition-colors hover:border-[var(--accent)] hover:bg-[var(--bg-secondary)]",children:[e.jsx("span",{className:"text-sm leading-none",children:"+"})," ",a("pipeline.add_stage")]})}),h&&e.jsxs("div",{className:"mt-4 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 lg:hidden",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsx("span",{className:"font-mono text-xs font-semibold text-[var(--accent)]",children:a("pipeline.stage_properties")}),e.jsx("button",{type:"button",onClick:()=>c(null),className:"rounded-[4px] border border-[var(--border)] px-2 py-1 font-mono text-[11px] text-[var(--text-muted)]",children:"x"})]}),e.jsx(_,{stage:h,onChange:n=>w(r,n),allStageNames:f})]})]}),e.jsx("div",{className:"hidden w-[360px] shrink-0 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5 lg:block",style:{alignSelf:"flex-start",position:"sticky",top:0},children:h?e.jsx(_,{stage:h,onChange:n=>w(r,n),allStageNames:f}):e.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:e.jsx("p",{className:"font-mono text-xs text-[var(--text-muted)]",children:a("pipeline.select_stage")})})})]})]})}function A(){const{key:t}=$(),o=I(),{t:a}=g(),[r,c]=d.useState(null),[s,i]=d.useState(!0),[p,l]=d.useState(!1);d.useEffect(()=>{t&&S.get(`web/projects/${t}`).json().then(f=>{if(f.pipeline)try{c(JSON.parse(f.pipeline))}catch{c(null)}}).catch(()=>y.error(a("pipeline.failed_to_load_project"))).finally(()=>i(!1))},[t,a]);const h=d.useCallback(async()=>{if(t){l(!0);try{await S.put(`web/projects/${t}`,{json:{pipeline:r?JSON.stringify(r):null}}),y.success(a("pipeline.saved"))}catch{y.error(a("pipeline.failed_to_save"))}finally{l(!1)}}},[t,r,a]);return s?e.jsx("div",{className:"flex h-full items-center justify-center font-mono",children:e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:a("pipeline.loading_pipeline")})}):e.jsxs("div",{className:"flex h-full flex-col font-mono lowercase",children:[e.jsxs("div",{className:"flex flex-col gap-3 border-b border-[var(--border)] px-4 md:px-8 py-5 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"text-base font-medium text-[var(--text-primary)] shrink-0",children:a("pipeline.title")}),e.jsx("span",{className:"text-sm text-[var(--text-muted)] truncate",children:a("pipeline.subtitle",{key:t??""})})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx("button",{type:"button",onClick:h,disabled:p,className:"rounded-[4px] bg-[var(--accent)] px-4 py-1.5 text-xs font-bold text-black disabled:opacity-50",children:a(p?"common.saving":"pipeline.save")}),e.jsx("button",{type:"button",onClick:()=>o(`/projects/${t}`),className:"rounded-[4px] border border-[var(--border)] px-4 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:a("pipeline.cancel")})]})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-4 md:p-8",children:e.jsx(G,{value:r,onChange:c})})]})}export{A as default};
@@ -0,0 +1 @@
1
+ import{a as R,r as o,j as e,L as q,K as D,g as p,t as c}from"./index-vL7aQJNr.js";import{v as F}from"./password-CHk45-jw.js";import{I as s}from"./InfoRow-DhdTYoY9.js";import{u as T}from"./useFetch-vGZMAvGi.js";function z(){var N,y,k,P;const{t:r}=R(),{data:a,loading:C,refetch:E}=T(()=>p.get("web/profile").json(),[]),[x,m]=o.useState(""),[d,b]=o.useState(""),[u,f]=o.useState(""),[v,g]=o.useState(!1),[h,l]=o.useState(""),[i,j]=o.useState(""),[w,_]=o.useState(!1);async function L(){if(l(""),!x){l(r("profile.current_password_required"));return}if(!d){l(r("profile.new_password_required"));return}const t=F(d);if(t){l(r(t));return}if(d!==u){l(r("profile.passwords_do_not_match"));return}try{g(!0),await p.put("web/profile/password",{json:{currentPassword:x,newPassword:d}}),c.success(r("profile.password_changed")),m(""),b(""),f("")}catch(n){const U=n instanceof Error?n.message:r("profile.failed_to_change_password");l(U)}finally{g(!1)}}async function S(){if(!i||i.length!==6){c.error(r("profile.totp_code_required"));return}try{_(!0),await p.post("web/profile/totp/regenerate",{json:{code:i}}),c.success(r("profile.two_fa_regenerated")),j(""),E()}catch(t){const n=t instanceof Error?t.message:r("profile.totp_code_invalid");c.error(n)}finally{_(!1)}}return C?e.jsx("div",{className:"flex justify-center py-20",children:e.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-[var(--border)] border-t-[var(--accent)]"})}):e.jsxs("div",{className:"mx-auto max-w-xl space-y-8 px-4 md:px-6 py-8 font-mono lowercase",children:[e.jsxs("h1",{className:"text-lg text-[var(--text-primary)]",children:[r("profile.title")," ",e.jsx("span",{className:"text-[var(--text-muted)]",children:r("profile.personal_settings")})]}),e.jsxs("section",{className:"rounded-[4px] bg-[var(--bg-card)] border border-[var(--border)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("profile.profile_info")}),a?e.jsxs("div",{className:"space-y-2",children:[e.jsx(s,{variant:"fixed-label",label:r("profile.username"),value:a.name}),e.jsx(s,{variant:"fixed-label",label:r("common.role"),value:a.role}),e.jsx(s,{variant:"fixed-label",label:r("profile.git_name"),value:a.gitName||r("common.not_set")}),e.jsx(s,{variant:"fixed-label",label:r("profile.git_email"),value:a.gitEmail||r("common.not_set")}),e.jsx(s,{variant:"fixed-label",label:r("profile.status"),value:a.status}),e.jsx(s,{variant:"fixed-label",label:r("profile.created_at"),value:new Date(a.createdAt).toLocaleDateString()})]}):e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:r("profile.unable_to_load_profile")})]}),e.jsxs("section",{className:"rounded-[4px] bg-[var(--bg-card)] border border-[var(--border)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("profile.platform_accounts")}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(s,{variant:"fixed-label",label:"lark",value:(N=a==null?void 0:a.platformUids)!=null&&N.lark?`${a.platformUids.lark.slice(0,12)}... ✓`:r("profile.not_linked")}),e.jsx(s,{variant:"fixed-label",label:"slack",value:(y=a==null?void 0:a.platformUids)!=null&&y.slack?`${a.platformUids.slack.slice(0,12)}... ✓`:r("profile.not_linked")})]}),(!((k=a==null?void 0:a.platformUids)!=null&&k.lark)||!((P=a==null?void 0:a.platformUids)!=null&&P.slack))&&e.jsx("p",{className:"mt-3 text-xs text-[var(--text-muted)]",children:r("profile.bind_hint")})]}),e.jsxs("section",{className:"rounded-[4px] bg-[var(--bg-card)] border border-[var(--border)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("profile.change_password")}),e.jsxs("div",{className:"space-y-4",children:[h&&e.jsx("div",{className:"rounded-[4px] border border-[var(--destructive)] bg-[var(--bg-input)] px-3 py-2 text-sm text-[var(--destructive)]",children:h}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-[var(--text-secondary)]",children:r("profile.current_password")}),e.jsx("input",{type:"password",value:x,onChange:t=>m(t.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-sm text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-[var(--text-secondary)]",children:r("profile.new_password")}),e.jsx("input",{type:"password",value:d,onChange:t=>b(t.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-sm text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"}),e.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:r("profile.password_hint_10_20")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-[var(--text-secondary)]",children:r("profile.confirm_password")}),e.jsx("input",{type:"password",value:u,onChange:t=>f(t.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-sm text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:L,disabled:v,className:"rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs font-medium text-black disabled:opacity-50",children:r(v?"common.updating":"profile.update_password")})})]})]}),e.jsxs("section",{className:"rounded-[4px] bg-[var(--bg-card)] border border-[var(--border)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("profile.two_factor_auth")}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex items-center gap-2 text-sm",children:a!=null&&a.totpEnabled?e.jsxs("span",{className:"text-[var(--accent)]",children:["● ",r("profile.two_fa_enabled")]}):e.jsxs("span",{className:"text-[var(--text-muted)]",children:["● ",r("profile.two_fa_not_setup")]})}),(a==null?void 0:a.totpEnabled)&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("profile.regenerate_2fa_warning")}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-[var(--text-secondary)]",children:r("profile.current_totp_code")}),e.jsx("input",{type:"text",inputMode:"numeric",maxLength:6,placeholder:r("profile.totp_code_placeholder"),value:i,onChange:t=>{const n=t.target.value.replace(/\D/g,"").slice(0,6);j(n)},className:"w-full max-w-xs rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-sm text-[var(--text-primary)] outline-none focus:border-[var(--accent)] font-mono tracking-widest"})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:S,disabled:w||i.length!==6,className:"rounded-[4px] border border-[var(--warning)] bg-transparent px-4 py-2 text-xs font-medium text-[var(--warning)] hover:bg-[var(--warning)] hover:text-black disabled:opacity-50 transition-colors",children:r(w?"profile.regenerating":"profile.regenerate_2fa")})})]})]})]}),e.jsxs(q,{to:"/access-tokens",className:"flex items-center gap-3 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 transition-colors hover:border-[var(--accent)]",children:[e.jsx(D,{size:16,className:"text-[var(--accent)]"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-[var(--text-primary)]",children:r("profile.access_tokens")}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("profile.access_tokens_desc")})]})]})]})}export{z as default};
@@ -0,0 +1,7 @@
1
+ import{c as F,a as D,j as e,s as U,v as E,e as R,u as q,h as K,r as x,P as A,n as B,y as H,g as v}from"./index-vL7aQJNr.js";import{U as J,A as V,R as z}from"./RemoveMemberConfirmDialog-BCrue0AP.js";import{b as I}from"./date-BdNtiQTP.js";import{t as G}from"./status-colors-BPEUp90-.js";import{I as o}from"./InfoRow-DhdTYoY9.js";import{u as Q}from"./useFetch-vGZMAvGi.js";import{P as X}from"./pencil-B6spIBcw.js";import{T as Y}from"./trash-2-A2FsT1yG.js";import{P as Z}from"./plus-Bnd1Vz2Y.js";import"./Select-BnV8yZlD.js";/**
2
+ * @license lucide-react v0.469.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const ee=F("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);function te({isOpen:n,onClose:l,onConfirm:t,projectName:m,loading:p}){const{t:j}=D();return e.jsx(U,{isOpen:n,onClose:l,onConfirm:t,title:`> ${j("projects.delete_project")}`,message:j("projects.delete_project_confirm",{name:m}),confirmLabel:j("projects.delete_project"),confirmVariant:"danger",isLoading:p})}function me(){const{key:n}=E(),l=R(),{t}=D(),m=q(r=>r.user),p=K(),[j,f]=x.useState(!1),[P,w]=x.useState(!1),[$,_]=x.useState(!1),[c,N]=x.useState(null),[L,k]=x.useState(!1),{data:a,loading:S,error:C,refetch:y}=Q(async()=>{if(!n)throw new Error("Missing project key");const[r,g,u]=await Promise.all([v.get(`web/projects/${n}`).json(),v.get(`web/projects/${n}/members`).json().catch(()=>[]),v.get("web/tasks",{searchParams:{projectKey:n,limit:"20"}}).json().then(O=>O.data).catch(()=>[])]);let b=null;if(r.pipeline)try{b=JSON.parse(r.pipeline)}catch{}return{project:r,members:g,tasks:u,pipelineConfig:b}},[n]),s=(a==null?void 0:a.project)??null,h=(a==null?void 0:a.members)??[],M=(a==null?void 0:a.tasks)??[],d=(a==null?void 0:a.pipelineConfig)??null,i=p||h.some(r=>r.developerId===(m==null?void 0:m.id)&&r.role===A.MAINTAINER);B(x.useMemo(()=>s?e.jsxs(e.Fragment,{children:[i&&e.jsxs("button",{onClick:()=>l(`/projects/${s.key}/edit`),className:"flex items-center gap-1.5 rounded-[4px] border border-[var(--border)] bg-transparent px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)]",children:[e.jsx(X,{className:"h-3 w-3"}),t("common.edit")]}),p&&e.jsxs("button",{onClick:()=>f(!0),className:"flex items-center gap-1.5 rounded-[4px] border border-[var(--destructive)] bg-transparent px-3 py-1.5 text-xs text-[var(--destructive)] hover:bg-[var(--destructive)] hover:text-white",children:[e.jsx(Y,{className:"h-3 w-3"}),t("common.delete")]})]}):null,[s,i,p,l,t]));async function W(){if(s){w(!0);try{await v.delete(`admin/projects/${s.key}`),l("/projects")}catch{}finally{w(!1),f(!1)}}}async function T(){if(!(!s||!c)){k(!0);try{await v.delete(`web/projects/${s.key}/members`,{searchParams:{developerId:String(c.developerId)}}),await y()}catch{}finally{k(!1),N(null)}}}return S?e.jsx("div",{className:"flex justify-center py-20",children:e.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-[var(--border)] border-t-[var(--accent)]"})}):C?e.jsxs("div",{className:"mx-auto max-w-4xl px-4 md:px-6 py-8 text-center",children:[e.jsx("p",{className:"text-sm text-[var(--destructive)]",children:C}),e.jsx("button",{onClick:()=>y(),className:"mt-4 rounded-[4px] border border-[var(--border)] bg-transparent px-4 py-2 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)]",children:t("common.retry")})]}):s?e.jsxs("div",{className:"mx-auto max-w-6xl px-4 md:px-6 py-8",children:[e.jsxs("div",{className:"mb-2 text-xs text-[var(--text-muted)]",children:[e.jsx("span",{className:"cursor-pointer hover:text-[var(--text-secondary)]",onClick:()=>l("/projects"),children:t("projects.title")})," / ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:s.key})]}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-[1fr_340px]",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("section",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:t("projects.project_info")}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{variant:"fixed-label",labelWidth:"w-32",label:t("projects.key"),value:s.key}),e.jsx(o,{variant:"fixed-label",labelWidth:"w-32",label:t("projects.name"),value:s.name}),e.jsx(o,{variant:"fixed-label",labelWidth:"w-32",label:t("projects.repo_url"),value:s.repoUrl,href:s.repoUrl}),s.sshUrl&&e.jsx(o,{variant:"fixed-label",labelWidth:"w-32",label:t("projects.ssh_url"),value:s.sshUrl}),e.jsx(o,{variant:"fixed-label",labelWidth:"w-32",label:t("projects.git_platform"),value:s.gitPlatform}),e.jsx(o,{variant:"fixed-label",labelWidth:"w-32",label:t("projects.default_branch"),value:s.defaultBranch}),e.jsx(o,{variant:"fixed-label",labelWidth:"w-32",label:t("projects.agent_type"),value:s.agentType}),e.jsx(o,{variant:"fixed-label",labelWidth:"w-32",label:t("projects.max_turns"),value:String(s.maxTurns)}),e.jsx(o,{variant:"fixed-label",labelWidth:"w-32",label:t("projects.allowed_tools"),value:s.allowedTools??"all"}),e.jsx(o,{variant:"fixed-label",labelWidth:"w-32",label:t("projects.default_project"),value:s.isDefault?"yes":"no"})]})]}),e.jsxs("section",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsx("h2",{className:"text-sm font-semibold text-[var(--accent)]",children:t("projects.members")}),i&&e.jsxs("button",{onClick:()=>_(!0),className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs font-medium text-black",children:[e.jsx(Z,{className:"h-3.5 w-3.5"}),t("projects.add_member")]})]}),h.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-6",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:t("projects.no_members_yet")})]}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border-row)]",children:[e.jsx("th",{className:"pb-2 text-left text-xs font-medium text-[var(--text-muted)]",children:t("projects.name")}),e.jsx("th",{className:"pb-2 text-left text-xs font-medium text-[var(--text-muted)]",children:t("projects.role")}),e.jsx("th",{className:"pb-2 text-left text-xs font-medium text-[var(--text-muted)]",children:t("projects.added_at")}),i&&e.jsx("th",{className:"pb-2 text-right text-xs font-medium text-[var(--text-muted)]",children:t("common.actions")})]})}),e.jsx("tbody",{children:h.map(r=>e.jsxs("tr",{className:"border-b border-[var(--border-row)] last:border-b-0",children:[e.jsx("td",{className:"py-2.5 text-sm text-[var(--text-primary)]",children:r.developerName??`#${r.developerId}`}),e.jsx("td",{className:"py-2.5 text-sm",style:{color:r.role===A.MAINTAINER?"var(--warning)":"var(--text-secondary)"},children:r.role}),e.jsx("td",{className:"py-2.5 text-sm text-[var(--text-secondary)]",children:I(r.createdAt)}),i&&e.jsx("td",{className:"py-2.5 text-right",children:e.jsx("button",{onClick:()=>N(r),className:"text-[var(--destructive)] hover:underline","aria-label":t("projects.remove_member"),children:e.jsx(J,{className:"h-3.5 w-3.5"})})})]},r.developerId))})]})})]}),e.jsxs("section",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:t("projects.recent_tasks")}),M.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-6",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:t("projects.no_tasks_for_project")})]}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border-row)]",children:[e.jsx("th",{className:"pb-2 text-left text-xs font-medium text-[var(--text-muted)]",children:t("projects.id")}),e.jsx("th",{className:"pb-2 text-left text-xs font-medium text-[var(--text-muted)]",children:t("projects.description")}),e.jsx("th",{className:"pb-2 text-left text-xs font-medium text-[var(--text-muted)]",children:t("projects.status")}),e.jsx("th",{className:"pb-2 text-left text-xs font-medium text-[var(--text-muted)]",children:t("projects.created")})]})}),e.jsx("tbody",{children:M.map(r=>e.jsxs("tr",{className:"cursor-pointer border-b border-[var(--border-row)] last:border-b-0 hover:bg-[var(--bg-input)]",onClick:()=>l(`/tasks/${r.id}`),children:[e.jsxs("td",{className:"py-2.5 text-sm text-[var(--text-secondary)]",children:["#",r.id]}),e.jsx("td",{className:"max-w-xs truncate py-2.5 text-sm text-[var(--text-primary)]",children:r.description}),e.jsx("td",{className:"py-2.5 text-sm",style:{color:G[r.status]},children:r.status}),e.jsx("td",{className:"py-2.5 text-sm text-[var(--text-secondary)]",children:I(r.createdAt)})]},r.id))})]})})]})]}),e.jsx("div",{children:e.jsxs("section",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsx("h2",{className:"mb-4 text-[13px] font-medium text-[var(--accent)]",children:t("projects.pipeline")}),e.jsx("div",{className:"mb-3 h-px bg-[var(--border)]"}),d!=null&&d.stages&&d.stages.length>0?e.jsx("div",{className:"flex flex-col items-center",children:d.stages.map((r,g)=>{var u,b;return e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:"flex items-center justify-between rounded-[4px] bg-[var(--bg-input)] px-3 py-2.5 cursor-pointer hover:bg-[var(--bg-secondary)]",style:{borderLeft:"3px solid var(--accent)"},onClick:()=>l(`/projects/${s.key}/pipeline`),children:[e.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[e.jsx("span",{className:"text-xs font-medium text-[var(--text-primary)]",children:r.label??r.name}),r.prompt&&e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)] truncate",children:["// ",r.prompt.split(`
7
+ `)[0].slice(0,40)]})]}),e.jsx("div",{className:"flex items-center gap-2 shrink-0",children:r.requireConfirm&&e.jsx("span",{className:"rounded-[4px] px-2 py-0.5 text-[11px] font-medium text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:t("projects.confirm_label")})})]}),((u=r.onFailure)==null?void 0:u.goto)&&e.jsxs("div",{className:"flex items-center justify-center gap-1.5 py-1",children:[e.jsx(H,{className:"h-3 w-3 text-[var(--warning)]"}),e.jsxs("span",{className:"text-[11px] text-[var(--warning)]",children:["onFailure.goto: ",r.onFailure.goto,", maxLoops: ",r.onFailure.maxLoops]})]}),g<d.stages.length-1&&!((b=r.onFailure)!=null&&b.goto)&&e.jsx("div",{className:"flex justify-center py-1",children:e.jsx(ee,{className:"h-3.5 w-3.5 text-[var(--text-muted)]"})})]},r.name)})}):e.jsx("div",{className:"py-6 text-center text-xs text-[var(--text-muted)]",children:t("projects.no_pipeline_configured")}),i&&e.jsx("button",{onClick:()=>l(`/projects/${s.key}/pipeline`),className:"mt-3 flex w-full items-center justify-center gap-1.5 py-2 text-xs text-[var(--accent)] hover:text-[var(--accent)]",children:t("projects.add_stage")})]})})]}),e.jsx(te,{isOpen:j,onClose:()=>f(!1),onConfirm:W,projectName:s.name,loading:P}),e.jsx(V,{isOpen:$,onClose:()=>_(!1),projectKey:s.key,existingMemberIds:h.map(r=>r.developerId),onAdded:y}),e.jsx(z,{isOpen:!!c,onClose:()=>N(null),onConfirm:T,memberName:c?c.developerName??`#${c.developerId}`:"",loading:L})]}):e.jsxs("div",{className:"mx-auto max-w-4xl px-4 md:px-6 py-8 text-center",children:[e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:t("projects.project_not_found")}),e.jsx("button",{onClick:()=>l("/projects"),className:"mt-4 rounded-[4px] border border-[var(--border)] bg-transparent px-4 py-2 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)]",children:t("projects.back_to_projects")})]})}export{me as default};
@@ -0,0 +1,6 @@
1
+ import{c as R,a as z,r as o,G as u,A as x,j as e,g as E,e as G,n as I}from"./index-vL7aQJNr.js";import{S as A}from"./Select-BnV8yZlD.js";import{E as M}from"./EmptyState-D3foEiul.js";import{T as D}from"./Skeleton-DUgWc2LJ.js";import{t as H}from"./date-BdNtiQTP.js";import{u as O}from"./useFetch-vGZMAvGi.js";import{P as J}from"./plus-Bnd1Vz2Y.js";/**
2
+ * @license lucide-react v0.469.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const q=R("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]),b={width:"100%",padding:"0.5rem 0.75rem",backgroundColor:"var(--bg-input)",border:"1px solid var(--border)",borderRadius:"4px",color:"var(--text-primary)",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",outline:"none",boxSizing:"border-box"},i={display:"block",color:"var(--text-secondary)",fontSize:"0.7rem",marginBottom:"0.25rem",fontFamily:"'JetBrains Mono', monospace"};function W({isOpen:d,onClose:a,onCreated:h}){const{t}=z(),[l,j]=o.useState(""),[n,s]=o.useState(""),[c,p]=o.useState(""),[f,C]=o.useState(""),[_,k]=o.useState("main"),[S,N]=o.useState(u.GITHUB),[B,T]=o.useState(x.CLAUDE),[m,F]=o.useState(!1),[w,g]=o.useState("");o.useEffect(()=>{d&&U()},[d]);function U(){j(""),s(""),p(""),C(""),k("main"),N(u.GITHUB),T(x.CLAUDE),g("")}function y(){U(),a()}async function P(r){r.preventDefault(),g(""),F(!0);try{const v=await E.post("admin/projects",{json:{name:l,key:n,repoUrl:c,sshUrl:f||void 0,defaultBranch:_,gitPlatform:S,agentType:B}}).json();h(v),y()}catch(v){const L=v instanceof Error?v.message:t("projects.failed_to_create_project");g(L)}finally{F(!1)}}return d?e.jsx("div",{onClick:y,style:{position:"fixed",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))",padding:"1rem"},children:e.jsxs("div",{onClick:r=>r.stopPropagation(),style:{width:"100%",maxWidth:"480px",backgroundColor:"var(--bg-card)",border:"1px solid var(--border)",borderRadius:"4px",padding:"1.5rem",fontFamily:"'JetBrains Mono', monospace"},children:[e.jsxs("div",{style:{marginBottom:"1.25rem"},children:[e.jsxs("div",{style:{color:"var(--accent)",fontSize:"0.875rem",fontWeight:600},children:["> ",t("projects.create_project")]}),e.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.7rem",marginTop:"0.25rem"},children:t("projects.add_project_desc")})]}),w&&e.jsx("div",{style:{marginBottom:"1rem",padding:"0.5rem 0.75rem",borderRadius:"4px",backgroundColor:"rgba(239, 68, 68, 0.1)",border:"1px solid rgba(239, 68, 68, 0.3)",color:"var(--destructive)",fontSize:"0.7rem"},children:w}),e.jsxs("form",{onSubmit:P,style:{display:"flex",flexDirection:"column",gap:"0.875rem"},children:[e.jsxs("div",{children:[e.jsx("label",{style:i,children:t("projects.project_name")}),e.jsx("input",{type:"text",value:l,onChange:r=>j(r.target.value),placeholder:t("projects.project_name_placeholder"),required:!0,autoFocus:!0,style:b,onFocus:r=>r.target.style.borderColor="var(--accent)",onBlur:r=>r.target.style.borderColor="var(--border)"})]}),e.jsxs("div",{children:[e.jsx("label",{style:i,children:t("projects.project_key")}),e.jsx("input",{type:"text",value:n,onChange:r=>s(r.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"")),placeholder:t("projects.project_key_placeholder"),required:!0,style:b,onFocus:r=>r.target.style.borderColor="var(--accent)",onBlur:r=>r.target.style.borderColor="var(--border)"}),e.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.65rem",marginTop:"0.25rem"},children:t("projects.project_key_hint")})]}),e.jsxs("div",{children:[e.jsx("label",{style:i,children:t("projects.repo_url")}),e.jsx("input",{type:"text",value:c,onChange:r=>p(r.target.value),placeholder:t("projects.repo_url_placeholder"),required:!0,style:b,onFocus:r=>r.target.style.borderColor="var(--accent)",onBlur:r=>r.target.style.borderColor="var(--border)"})]}),e.jsxs("div",{children:[e.jsx("label",{style:i,children:t("projects.ssh_url")}),e.jsx("input",{type:"text",value:f,onChange:r=>C(r.target.value),placeholder:t("projects.ssh_url_placeholder"),style:b,onFocus:r=>r.target.style.borderColor="var(--accent)",onBlur:r=>r.target.style.borderColor="var(--border)"}),e.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.65rem",marginTop:"0.25rem"},children:t("projects.ssh_url_hint")})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{style:i,children:t("projects.default_branch")}),e.jsx("input",{type:"text",value:_,onChange:r=>k(r.target.value),placeholder:t("projects.main"),style:b,onFocus:r=>r.target.style.borderColor="var(--accent)",onBlur:r=>r.target.style.borderColor="var(--border)"})]}),e.jsxs("div",{children:[e.jsx("label",{style:i,children:t("projects.git_platform")}),e.jsx(A,{value:S,onChange:r=>N(r),options:[{value:u.GITHUB,label:t("projects.github")},{value:u.GITLAB,label:t("projects.gitlab")},{value:u.GITEA,label:t("projects.gitea")}]})]}),e.jsxs("div",{children:[e.jsx("label",{style:i,children:t("projects.agent_type")}),e.jsx(A,{value:B,onChange:r=>T(r),options:[{value:x.CLAUDE,label:t("projects.claude")},{value:x.CURSOR,label:t("projects.cursor")},{value:x.CODEX,label:t("projects.codex")},{value:x.CUSTOM,label:t("projects.custom")}]})]})]}),e.jsxs("div",{style:{display:"flex",gap:"0.75rem",marginTop:"0.5rem"},children:[e.jsx("button",{type:"button",onClick:y,disabled:m,style:{flex:1,padding:"0.5rem",backgroundColor:"transparent",border:"1px solid var(--border)",borderRadius:"4px",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:"pointer",transition:"color 0.15s, border-color 0.15s"},className:"text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:border-[var(--text-muted)]",children:t("common.cancel")}),e.jsx("button",{type:"submit",disabled:m||!l||!n||!c,style:{flex:1,padding:"0.5rem",backgroundColor:"var(--accent)",color:"#0C0C0C",border:"none",borderRadius:"4px",fontSize:"0.75rem",fontWeight:600,fontFamily:"'JetBrains Mono', monospace",cursor:m||!l||!n||!c?"not-allowed":"pointer",opacity:m||!l||!n||!c?.7:1},children:t(m?"common.creating":"common.create")})]})]})]})}):null}function ee(){const d=G(),{t:a}=z(),[h,t]=o.useState(!1),{data:l,loading:j,refetch:n}=O(()=>E.get("web/projects").json(),[]);return I(o.useMemo(()=>e.jsxs("button",{onClick:()=>t(!0),className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs font-medium text-black",children:[e.jsx(J,{className:"h-3.5 w-3.5"}),a("projects.create_project")]}),[a])),e.jsxs("div",{className:"mx-auto max-w-5xl px-4 md:px-6 py-8",children:[j?e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsx(D,{rows:4})}):!l||l.length===0?e.jsx(M,{icon:q,title:a("projects.no_projects_yet"),description:a("projects.create_first_project"),actionLabel:a("projects.create_project"),onAction:()=>t(!0)}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-col gap-2 md:hidden",children:l.map(s=>e.jsxs("div",{onClick:()=>d(`/projects/${s.key}`),className:"cursor-pointer rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 transition-colors active:bg-[var(--bg-input)]",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-xs font-medium text-[var(--accent)]",children:s.key}),e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:[s.taskCount??0," tasks"]})]}),e.jsx("span",{className:"mt-1 block text-[11px] text-[var(--text-primary)]",children:s.name}),e.jsx("span",{className:"mt-0.5 block text-[11px] text-[var(--text-muted)]",children:s.agentType})]},s.key))}),e.jsxs("div",{className:"hidden md:block rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsxs("div",{className:"grid grid-cols-[36px_90px_1fr_120px_60px_80px] gap-3 border-b border-[var(--border-row)] px-4 py-2.5 text-xs font-medium text-[var(--text-muted)]",children:[e.jsx("span",{children:"#"}),e.jsx("span",{children:a("projects.key")}),e.jsx("span",{children:a("projects.name")}),e.jsx("span",{children:a("projects.members")}),e.jsx("span",{children:a("projects.tasks_count")}),e.jsx("span",{children:a("projects.last_activity")})]}),l.map((s,c)=>e.jsxs("div",{onClick:()=>d(`/projects/${s.key}`),className:"grid cursor-pointer grid-cols-[36px_90px_1fr_120px_60px_80px] gap-3 border-b border-[var(--border-row)] px-4 py-3 last:border-b-0 hover:bg-[var(--bg-input)] transition-colors items-center",children:[e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:c+1}),e.jsx("span",{className:"truncate text-xs text-[var(--accent)]",children:s.key}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"block truncate text-xs text-[var(--text-primary)]",children:s.name}),e.jsxs("span",{className:"block truncate text-[11px] text-[var(--text-muted)]",children:[s.agentType," · ",s.repoUrl.replace(/^https?:\/\//,"").split("/").slice(-2).join("/")]})]}),e.jsx("div",{className:"flex items-center",children:e.jsxs("div",{className:"flex -space-x-1.5",children:[(s.members??[]).map(p=>e.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-full border-2 border-[var(--bg-card)] bg-[var(--accent)]/20 text-[11px] font-bold text-[var(--accent)]",title:p.name,children:p.name.charAt(0).toUpperCase()},p.id)),(s.memberCount??0)>5&&e.jsxs("div",{className:"flex h-6 w-6 items-center justify-center rounded-full border-2 border-[var(--bg-card)] bg-[var(--bg-input)] text-[11px] text-[var(--text-muted)]",children:["+",s.memberCount-5]})]})}),e.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:s.taskCount??0}),e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:H(s.lastActivity??null)})]},s.key))]})]}),e.jsx(W,{isOpen:h,onClose:()=>t(!1),onCreated:n})]})}export{ee as default};
@@ -0,0 +1 @@
1
+ import{a as b,r as s,g as h,B as v,j as e,C as j}from"./index-vL7aQJNr.js";import{C as f}from"./copy-BUH7P2Hf.js";function y({mode:l}){const{t:o}=b(),[n,d]=s.useState([]),[x,c]=s.useState(null),[u,i]=s.useState(!1);s.useEffect(()=>{h.get("web/profile/tokens").json().then(t=>{const r=t.filter(m=>m.status===v.ACTIVE);d(r),r.length>0&&c(r[0].id)}).catch(()=>{})},[]);const a=l==="cli"?"ov login --token <your-token>":'curl -H "authorization: bearer <your-token>" http://localhost:9000/api/web/tasks',p=s.useCallback(()=>{navigator.clipboard.writeText(a),i(!0),setTimeout(()=>i(!1),2e3)},[a]);return n.length===0?null:e.jsxs("div",{className:"mb-8 rounded-[4px] border border-[var(--accent)]/20 bg-[var(--bg-card)] p-4",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:o("docs.quick_start_with_token")}),e.jsx("select",{value:x??"",onChange:t=>c(Number(t.target.value)),className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] px-2 py-1 text-xs text-[var(--text-primary)]",children:n.map(t=>e.jsx("option",{value:t.id,children:t.label},t.id))})]}),e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-[4px] bg-[var(--bg-primary)] px-3 py-2",children:[e.jsx("code",{className:"text-xs text-[var(--accent)] break-all",children:a}),e.jsx("button",{onClick:p,className:"shrink-0 text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:u?e.jsx(j,{size:14}):e.jsx(f,{size:14})})]}),e.jsx("p",{className:"mt-2 text-[11px] text-[var(--text-muted)]",children:o("docs.replace_token_hint")})]})}export{y as Q};
@@ -1,6 +1,6 @@
1
- import{c as w,a as _,r as s,j as e,X as R,f as g,l as C}from"./index-CDBuOPx4.js";import{P as l}from"./protocol-C5uQmiiB.js";import{S as N}from"./Select-A7PXobk_.js";/**
1
+ import{c as w,a as _,r as s,P as l,j as e,X as R,g,s as C}from"./index-vL7aQJNr.js";import{S as N}from"./Select-BnV8yZlD.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const L=w("UserMinus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);function $({isOpen:a,onClose:i,projectKey:d,existingMemberIds:m=[],onAdded:x}){const{t}=_(),[E,M]=s.useState([]),[o,u]=s.useState(""),[v,j]=s.useState(l.MEMBER),[p,f]=s.useState(!1),[y,b]=s.useState("");s.useEffect(()=>{if(!a)return;async function r(){try{const c=await g.get("web/projects/-/developers").json();M(c)}catch{}}r()},[a]);function n(){u(""),j(l.MEMBER),b(""),i()}async function k(r){if(r.preventDefault(),!!o){b(""),f(!0);try{await g.post(`web/projects/${d}/members`,{json:{developerId:parseInt(o,10),role:v}}),x(),n()}catch(c){const h=c instanceof Error?c.message:"",S=h.includes("409")?t("projects.member_already_exists"):h||t("projects.failed_to_add_member");b(S)}finally{f(!1)}}}return a?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backdropFilter:"blur(2px)"},children:[e.jsx("div",{className:"fixed inset-0 bg-[var(--modal-backdrop)]",onClick:n}),e.jsx("div",{className:"relative z-10 w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] font-mono",children:e.jsxs("form",{onSubmit:k,children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 py-4",children:[e.jsx("h3",{className:"text-sm text-[var(--text-primary)]",children:t("projects.add_member_title")}),e.jsx("button",{type:"button",className:"rounded-[4px] p-1 text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",onClick:n,children:e.jsx(R,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"space-y-4 px-5 py-5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:t("projects.developer")}),e.jsx(N,{value:o,onChange:u,options:E.filter(r=>!m.includes(r.id)).map(r=>({value:String(r.id),label:`${r.name} (${r.gitEmail})`})),placeholder:t("projects.select_developer")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:t("projects.role")}),e.jsx(N,{value:v,onChange:r=>j(r),options:[{value:l.MEMBER,label:t("projects.member_role")},{value:l.MAINTAINER,label:t("projects.maintainer_role")}]})]}),y&&e.jsx("div",{className:"rounded-[4px] border border-red-500/30 bg-red-500/10 px-3 py-2 text-xs text-red-400",children:y})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-[var(--border)] px-5 py-4",children:[e.jsx("button",{type:"button",className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors disabled:opacity-50",disabled:p,onClick:n,children:t("common.cancel")}),e.jsx("button",{type:"submit",className:"rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",disabled:p||!o,children:t(p?"projects.adding":"projects.add_member")})]})]})})]}):null}function B({isOpen:a,onClose:i,onConfirm:d,memberName:m,loading:x}){const{t}=_();return e.jsx(C,{isOpen:a,onClose:i,onConfirm:d,title:`> ${t("projects.remove_member")}`,message:t("projects.remove_member_confirm",{name:m}),confirmLabel:t("common.remove"),confirmVariant:"danger",isLoading:x})}export{$ as A,B as R,L as U};
6
+ */const A=w("UserMinus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);function L({isOpen:a,onClose:i,projectKey:d,existingMemberIds:m=[],onAdded:x}){const{t}=_(),[E,M]=s.useState([]),[o,u]=s.useState(""),[v,j]=s.useState(l.MEMBER),[p,f]=s.useState(!1),[y,b]=s.useState("");s.useEffect(()=>{if(!a)return;async function r(){try{const c=await g.get("web/projects/-/developers").json();M(c)}catch{}}r()},[a]);function n(){u(""),j(l.MEMBER),b(""),i()}async function k(r){if(r.preventDefault(),!!o){b(""),f(!0);try{await g.post(`web/projects/${d}/members`,{json:{developerId:parseInt(o,10),role:v}}),x(),n()}catch(c){const h=c instanceof Error?c.message:"",S=h.includes("409")?t("projects.member_already_exists"):h||t("projects.failed_to_add_member");b(S)}finally{f(!1)}}}return a?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backdropFilter:"blur(2px)"},children:[e.jsx("div",{className:"fixed inset-0 bg-[var(--modal-backdrop)]",onClick:n}),e.jsx("div",{className:"relative z-10 w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] font-mono",children:e.jsxs("form",{onSubmit:k,children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 py-4",children:[e.jsx("h3",{className:"text-sm text-[var(--text-primary)]",children:t("projects.add_member_title")}),e.jsx("button",{type:"button",className:"rounded-[4px] p-1 text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",onClick:n,children:e.jsx(R,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"space-y-4 px-5 py-5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:t("projects.developer")}),e.jsx(N,{value:o,onChange:u,options:E.filter(r=>!m.includes(r.id)).map(r=>({value:String(r.id),label:`${r.name} (${r.gitEmail})`})),placeholder:t("projects.select_developer")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:t("projects.role")}),e.jsx(N,{value:v,onChange:r=>j(r),options:[{value:l.MEMBER,label:t("projects.member_role")},{value:l.MAINTAINER,label:t("projects.maintainer_role")}]})]}),y&&e.jsx("div",{className:"rounded-[4px] border border-red-500/30 bg-red-500/10 px-3 py-2 text-xs text-red-400",children:y})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-[var(--border)] px-5 py-4",children:[e.jsx("button",{type:"button",className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors disabled:opacity-50",disabled:p,onClick:n,children:t("common.cancel")}),e.jsx("button",{type:"submit",className:"rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",disabled:p||!o,children:t(p?"projects.adding":"projects.add_member")})]})]})})]}):null}function $({isOpen:a,onClose:i,onConfirm:d,memberName:m,loading:x}){const{t}=_();return e.jsx(C,{isOpen:a,onClose:i,onConfirm:d,title:`> ${t("projects.remove_member")}`,message:t("projects.remove_member_confirm",{name:m}),confirmLabel:t("common.remove"),confirmVariant:"danger",isLoading:x})}export{L as A,$ as R,A as U};
@@ -0,0 +1,6 @@
1
+ import{c as p,r as l,j as t}from"./index-vL7aQJNr.js";/**
2
+ * @license lucide-react v0.469.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const b=p("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);function h({value:r,onChange:x,options:c,placeholder:u,disabled:n=!1,className:d=""}){var i;const[a,o]=l.useState(!1),s=l.useRef(null),m=((i=c.find(e=>e.value===r))==null?void 0:i.label)??u??"";return l.useEffect(()=>{function e(v){s.current&&!s.current.contains(v.target)&&o(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),t.jsxs("div",{ref:s,className:`relative ${d}`,children:[t.jsxs("button",{type:"button",disabled:n,onClick:()=>!n&&o(!a),"aria-expanded":a,"aria-haspopup":"listbox",className:`flex w-full items-center justify-between rounded-[4px] border bg-[var(--bg-input)] px-3 py-2 font-mono text-xs outline-none transition-colors ${a?"border-[var(--accent)] text-[var(--text-primary)]":"border-[var(--border)] text-[var(--text-primary)] hover:border-[var(--text-muted)]"} ${n?"cursor-not-allowed opacity-50":"cursor-pointer"}`,children:[t.jsx("span",{className:r?"":"text-[var(--text-muted)]",children:m}),t.jsx(b,{size:12,className:`ml-2 shrink-0 text-[var(--text-muted)] transition-transform ${a?"rotate-180":""}`})]}),a&&t.jsx("div",{role:"listbox",className:"absolute right-0 z-50 mt-1 max-h-48 min-w-full w-max max-w-[calc(100vw-2rem)] overflow-auto rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] py-1 shadow-lg",children:c.map(e=>t.jsxs("button",{type:"button",role:"option","aria-selected":e.value===r,onClick:()=>{x(e.value),o(!1)},className:`flex w-full items-center px-3 py-1.5 text-left font-mono text-xs transition-colors ${e.value===r?"bg-[var(--accent)]/10 text-[var(--accent)]":"text-[var(--text-secondary)] hover:bg-[var(--bg-input)] hover:text-[var(--text-primary)]"}`,children:[e.value===r&&t.jsx("span",{className:"mr-2 text-[var(--accent)]",children:">"}),e.label]},e.value))})]})}export{b as C,h as S};
@@ -0,0 +1,6 @@
1
+ import{c as h,a as v,r,j as e,g as m,t as u}from"./index-vL7aQJNr.js";/**
2
+ * @license lucide-react v0.469.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const _=h("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]),b=[{nameKey:"admin.scheduling",fields:[{key:"max_concurrent_tasks_per_worker",labelKey:"admin.max_concurrent_tasks",descKey:"admin.max_concurrent_tasks_desc",type:"number",placeholder:"3"},{key:"task_timeout_minutes",labelKey:"admin.task_timeout",descKey:"admin.task_timeout_desc",type:"number",placeholder:"120"}]},{nameKey:"admin.heartbeat",fields:[{key:"heartbeat_interval_seconds",labelKey:"admin.heartbeat_interval",descKey:"admin.heartbeat_interval_desc",type:"number",placeholder:"30"}]},{nameKey:"admin.output",fields:[{key:"worker_offline_threshold_seconds",labelKey:"admin.worker_offline_threshold",descKey:"admin.worker_offline_threshold_desc",type:"number",placeholder:"90"}]},{nameKey:"admin.defaults",fields:[{key:"default_agent_type",labelKey:"admin.default_agent_type",descKey:"admin.default_agent_type_desc",type:"text",placeholder:"claude-code"},{key:"server_url",labelKey:"admin.server_url",descKey:"admin.server_url_desc",type:"text",placeholder:"https://overlord.example.com"}]}];function f(){const{t:a}=v(),[i,d]=r.useState({}),[l,x]=r.useState(!0),[c,o]=r.useState(!1);r.useEffect(()=>{async function s(){try{const t=await m.get("admin/settings").json();d(t)}catch{}finally{x(!1)}}s()},[]);function y(s,t){d(n=>({...n,[s]:t}))}async function p(){o(!0);try{const s=await m.put("admin/settings",{json:i}).json();d(s),u.success(a("admin.settings_saved"))}catch{u.error(a("admin.failed_to_save_settings"))}finally{o(!1)}}return e.jsxs("div",{className:"font-mono",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:a("admin.settings_title")}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:a("admin.settings_subtitle")})]}),l?e.jsx("div",{className:"py-16 text-center text-xs text-[var(--text-muted)]",children:a("admin.loading_settings")}):e.jsxs("div",{className:"space-y-6",children:[b.map(s=>e.jsxs("div",{children:[e.jsx("h3",{className:"mb-3 text-xs font-medium text-[var(--text-primary)]",children:a(s.nameKey)}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-4",children:s.fields.map(t=>e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-[var(--text-primary)]",children:a(t.labelKey)}),e.jsx("p",{className:"mb-2 text-[11px] text-[var(--text-muted)]",children:a(t.descKey)}),e.jsx("input",{type:"text",inputMode:t.type==="number"?"numeric":void 0,pattern:t.type==="number"?"[0-9]*":void 0,value:i[t.key]??"",onChange:n=>{t.type==="number"&&n.target.value&&!/^\d*$/.test(n.target.value)||y(t.key,n.target.value)},placeholder:t.placeholder,className:"w-full max-w-full md:max-w-[200px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})]},t.key))})]},s.nameKey)),e.jsx("div",{children:e.jsxs("button",{type:"button",onClick:p,disabled:c||l,className:"flex items-center gap-2 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs font-medium text-black transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",children:[e.jsx(_,{size:12}),a(c?"common.saving":"admin.save_settings")]})})]})]})}export{f as default};
@@ -1 +1 @@
1
- import{j as e}from"./index-CDBuOPx4.js";const n="rounded-[4px] bg-[var(--border)] animate-pulse";function c({rows:r=5}){const a=[[60,200,80,120],[60,160,100,80],[60,220,70,140],[60,180,90,100],[60,190,110,90]];return e.jsx("div",{className:"flex flex-col gap-3",children:Array.from({length:r}).map((s,l)=>{const t=a[l%a.length];return e.jsx("div",{className:"flex gap-4",children:t.map((i,o)=>e.jsx("div",{className:n,style:{width:i,height:12}},o))},l)})})}function m({cards:r=4}){return e.jsx("div",{className:"grid grid-cols-2 gap-3",children:Array.from({length:r}).map((a,s)=>e.jsx("div",{className:`${n} h-20`},s))})}export{m as C,c as T};
1
+ import{j as e}from"./index-vL7aQJNr.js";const n="rounded-[4px] bg-[var(--border)] animate-pulse";function c({rows:r=5}){const a=[[60,200,80,120],[60,160,100,80],[60,220,70,140],[60,180,90,100],[60,190,110,90]];return e.jsx("div",{className:"flex flex-col gap-3",children:Array.from({length:r}).map((s,l)=>{const t=a[l%a.length];return e.jsx("div",{className:"flex gap-4",children:t.map((i,o)=>e.jsx("div",{className:n,style:{width:i,height:12}},o))},l)})})}function m({cards:r=4}){return e.jsx("div",{className:"grid grid-cols-2 gap-3",children:Array.from({length:r}).map((a,s)=>e.jsx("div",{className:`${n} h-20`},s))})}export{m as C,c as T};
@@ -0,0 +1 @@
1
+ import{a as c,j as e,r as n,C as o}from"./index-vL7aQJNr.js";import{E as i}from"./external-link-ChPgQ7N_.js";import{C as d}from"./copy-BUH7P2Hf.js";function a({text:t}){const[s,r]=n.useState(!1);return e.jsx("button",{onClick:async()=>{await navigator.clipboard.writeText(t),r(!0),setTimeout(()=>r(!1),2e3)},className:"rounded-[4px] p-1 text-[var(--text-muted)] transition-colors hover:text-[var(--text-primary)]",children:s?e.jsx(o,{className:"h-3 w-3 text-[var(--accent)]"}):e.jsx(d,{className:"h-3 w-3"})})}function x({text:t}){return e.jsxs("div",{className:"flex items-center justify-between rounded-[4px] bg-[var(--bg-primary)] px-3 py-2 overflow-x-auto",children:[e.jsx("code",{className:"text-xs text-[var(--accent)] whitespace-nowrap",children:t}),e.jsx(a,{text:t})]})}const l=[{action:"create tasks",desc:"describe what you want done, overlord dispatches to a worker"},{action:"list & monitor tasks",desc:"check status, read execution logs, track progress"},{action:"cancel & retry tasks",desc:"manage task lifecycle"},{action:"confirm pipeline stages",desc:"approve or provide input for suspended stages"},{action:"manage projects",desc:"list projects, view members"},{action:"check cluster health",desc:"see worker status, online workers, queue depth"},{action:"search",desc:"find tasks, projects, and workers by keyword"},{action:"read notifications",desc:"check and clear your notification inbox"}],m=['create a task in project "frontend" to fix the login page styling',"what tasks are running right now?","show me the logs for task 42","how many workers are online?","cancel task 15"],p=[{name:"claude code",url:"https://claude.com/claude-code"},{name:"cursor",url:"https://cursor.com/cli"},{name:"windsurf",url:"https://windsurf.com"},{name:"codex",url:"https://openai.com/codex"}];function b(){c();const t=typeof window<"u"?window.location.origin:"https://your-server";return e.jsxs("div",{className:"mx-auto max-w-4xl px-4 md:px-6 py-8 font-mono lowercase",children:[e.jsx("div",{className:"mb-8",children:e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"// use overlord from your ai coding assistant — claude code, cursor, windsurf, codex, and more. install the skill and your assistant can create tasks, monitor execution, and manage your fleet."})}),e.jsxs("div",{className:"mb-8 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"// install"}),e.jsx(x,{text:"npx skills add overlord-run/skill"})]}),e.jsxs("div",{className:"mb-8 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"// configure — set these environment variables"}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between rounded-[4px] bg-[var(--bg-primary)] px-3 py-2 overflow-x-auto",children:[e.jsxs("code",{className:"text-xs text-[var(--text-primary)] whitespace-nowrap",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"export "}),"OVERLORD_SERVER=",e.jsx("span",{className:"text-[var(--accent)]",children:t})]}),e.jsx(a,{text:`export OVERLORD_SERVER=${t}`})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-[4px] bg-[var(--bg-primary)] px-3 py-2 overflow-x-auto",children:[e.jsxs("code",{className:"text-xs text-[var(--text-primary)] whitespace-nowrap",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"export "}),"OVERLORD_TOKEN=",e.jsx("span",{className:"text-[var(--text-secondary)]",children:"your-token"})]}),e.jsx(a,{text:"export OVERLORD_TOKEN=your-token"})]})]}),e.jsxs("p",{className:"text-[11px] text-[var(--text-muted)]",children:["// create a token at ",e.jsx("a",{href:"/access-tokens",className:"text-[var(--accent)] hover:underline",children:"/access-tokens"})]})]}),e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{className:"mb-4 text-sm text-[var(--accent)]",children:"> capabilities"}),e.jsx("div",{className:"space-y-2",children:l.map(s=>e.jsxs("div",{className:"flex items-start gap-3 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3",children:[e.jsx("span",{className:"shrink-0 text-xs font-medium text-[var(--text-primary)]",children:s.action}),e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["// ",s.desc]})]},s.action))})]}),e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{className:"mb-4 text-sm text-[var(--accent)]",children:"> example usage"}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-2",children:[e.jsx("p",{className:"mb-3 text-xs text-[var(--text-muted)]",children:"// just ask your ai agent naturally"}),m.map(s=>e.jsx("div",{className:"rounded-[4px] bg-[var(--bg-primary)] px-3 py-2",children:e.jsxs("code",{className:"text-xs text-[var(--text-secondary)]",children:[e.jsx("span",{className:"text-[var(--accent)]",children:"> "}),s]})},s))]})]}),e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{className:"mb-4 text-sm text-[var(--accent)]",children:"> compatible tools"}),e.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:p.map(s=>e.jsxs("a",{href:s.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-center gap-1.5 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2.5 text-xs text-[var(--text-primary)] transition-colors hover:border-[var(--accent)]",children:[s.name,e.jsx(i,{className:"h-3 w-3 text-[var(--text-muted)]"})]},s.name))}),e.jsx("p",{className:"mt-2 text-[11px] text-[var(--text-muted)]",children:"// and any ai coding assistant that supports the skills protocol"})]}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["// open source:"," ",e.jsx("a",{href:"https://github.com/overlord-run/skill",target:"_blank",rel:"noopener noreferrer",className:"text-[var(--accent)] hover:underline",children:"github.com/overlord-run/skill"})]})})]})}export{b as default};
@@ -0,0 +1,31 @@
1
+ import{c as z,a as X,r,g as j,j as e,q as D,s as Ie,v as Oe,e as Ue,m as ze,i as ke,L as qe,X as le,l as V,w as we,t as _e,o as Be}from"./index-vL7aQJNr.js";import{u as Ge}from"./task.store-BE6fEPu4.js";import{C as Ke,T as Ve,P as Ce}from"./task-constants-BbFyCyKk.js";import{a as Xe,f as ee}from"./date-BdNtiQTP.js";import{S as We}from"./Select-BnV8yZlD.js";import{a as He}from"./status-colors-BPEUp90-.js";import{A as Je}from"./arrow-left-DklRsENx.js";import{R as Qe}from"./rotate-ccw-CgcLAXNR.js";import{E as Ye}from"./external-link-ChPgQ7N_.js";import{L as ce}from"./loader-circle-DS5g1-Od.js";/**
2
+ * @license lucide-react v0.469.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const Se=z("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
7
+ * @license lucide-react v0.469.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const Ee=z("Hand",[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]]);/**
12
+ * @license lucide-react v0.469.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const Ze=z("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
17
+ * @license lucide-react v0.469.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const et=z("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
22
+ * @license lucide-react v0.469.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */const tt=z("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
27
+ * @license lucide-react v0.469.0 - ISC
28
+ *
29
+ * This source code is licensed under the ISC license.
30
+ * See the LICENSE file in the root directory of this source tree.
31
+ */const st=z("SkipForward",[["polygon",{points:"5 4 15 12 5 20 5 4",key:"16p6eg"}],["line",{x1:"19",x2:"19",y1:"5",y2:"19",key:"futhcm"}]]);function Te({isOpen:i,onClose:x,taskId:a,stageName:n,timeoutSeconds:s,onSubmitted:o}){const{t:l}=X(),[g,_]=r.useState(s),[E,u]=r.useState(!1);r.useEffect(()=>{if(!i)return;_(s);const h=setInterval(()=>{_(N=>N<=1?(clearInterval(h),0):N-1)},1e3);return()=>clearInterval(h)},[i,s]),r.useEffect(()=>{g===0&&i&&x()},[g,i,x]);const C=r.useCallback(async h=>{u(!0);try{await j.post(`web/tasks/${a}/confirm-stage`,{json:{stageName:n,approved:h}}),o==null||o(),x()}catch{}finally{u(!1)}},[a,n,x,o]);return i?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backdropFilter:"blur(2px)"},children:[e.jsx("div",{className:"fixed inset-0 bg-[var(--modal-backdrop)]"}),e.jsxs("div",{className:"relative z-10 w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] font-mono",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 py-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(et,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsxs("h3",{className:"text-sm text-[var(--text-primary)]",children:["// stage: ",n]})]}),e.jsxs("span",{className:"flex items-center gap-1 text-xs text-[var(--text-muted)]",children:[e.jsx(Ke,{className:"h-3.5 w-3.5"}),Xe(g)]})]}),e.jsx("div",{className:"space-y-4 px-5 py-5",children:e.jsx("p",{className:"whitespace-pre-wrap text-xs text-[var(--text-primary)]",children:l("tasks.confirm_stage_message",{name:n})})}),e.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-[var(--border)] px-5 py-4",children:[e.jsx("button",{type:"button",className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors disabled:opacity-50",disabled:E,onClick:()=>C(!1),children:l("tasks.reject")}),e.jsx("button",{type:"button",className:"rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",disabled:E,onClick:()=>C(!0),children:l(E?"tasks.stage_submitting":"tasks.confirm_and_proceed")})]})]})]}):null}function at(i,x){const a=new Date(i).getTime()-Date.now();if(a<=0)return x("tasks.tunnel_expired");const n=Math.floor(a/36e5),s=Math.floor(a%36e5/6e4);return n>0?x("tasks.tunnel_expires_hm",{h:n,m:s}):x("tasks.tunnel_expires_m",{m:s})}function De(i){switch(i){case"CONNECTED":return"var(--accent)";case"STARTING":return"var(--warning)";case"EXPIRED":return"var(--text-muted)";default:return"var(--text-muted)"}}function Le(i,x){switch(i){case"IDLE":case"CLOSED":return x("tasks.tunnel_idle");case"STARTING":return x("tasks.tunnel_starting");case"CONNECTED":return x("tasks.tunnel_connected");case"EXPIRED":return x("tasks.tunnel_expired");case"CLOSING":return x("tasks.tunnel_closing");default:return String(i).toLowerCase()}}function rt({taskId:i,taskFinished:x,compact:a}){const{t:n}=X(),[s,o]=r.useState(D.IDLE),[l,g]=r.useState(null),[_,E]=r.useState(null),[u,C]=r.useState(""),[h,N]=r.useState(!1),[te,L]=r.useState(!1),I=r.useRef(null),$=r.useCallback(async()=>{try{const y=await j.get(`web/workspace-tunnel/${i}/status`).json();o(y.status),g(y.tunnelUrl??null),E(y.expiresAt??null),(y.status==="EXPIRED"||y.status==="IDLE"||y.status==="CLOSED")&&S()}catch{}},[i]);function se(){S(),I.current=setInterval($,5e3)}function S(){I.current&&(clearInterval(I.current),I.current=null)}r.useEffect(()=>{x&&(s===D.STARTING||s===D.CONNECTED)&&(o(D.IDLE),g(null),S())},[x,s]),r.useEffect(()=>{if(s!=="CONNECTED"||!_)return;const y=()=>{const H=at(_,n);C(H),H===n("tasks.tunnel_expired")&&(o(D.EXPIRED),g(null),S())};y();const A=setInterval(y,3e4);return()=>clearInterval(A)},[s,_]),r.useEffect(()=>()=>S(),[]),r.useEffect(()=>{x||$()},[$,x]);async function f(){N(!0);try{await j.post(`web/workspace-tunnel/${i}/start`),o(D.STARTING),se()}catch{}finally{N(!1)}}async function R(){N(!0);try{await j.post(`web/workspace-tunnel/${i}/stop`),o(D.IDLE),g(null),S()}catch{}finally{N(!1)}}async function W(){l&&(await navigator.clipboard.writeText(l),L(!0),setTimeout(()=>L(!1),2e3))}return a?e.jsxs("div",{className:"flex items-center gap-2 font-mono lowercase text-xs",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"cursor_tunnel:"}),e.jsx("span",{style:{color:De(s)},children:Le(s,n)}),(s==="IDLE"||s==="CLOSED"||s==="EXPIRED")&&e.jsx("button",{onClick:f,disabled:h,className:"rounded-[4px] px-2 py-1 text-[var(--info)] disabled:opacity-50",style:{backgroundColor:"rgba(59,130,246,0.12)"},children:n(h?"tasks.tunnel_starting":"tasks.tunnel_start")}),s==="CONNECTED"&&l&&e.jsx("a",{href:l.replace(/^https?:/,"cursor:"),target:"_blank",rel:"noopener noreferrer",className:"rounded-[4px] px-2 py-1 text-[var(--info)]",style:{backgroundColor:"rgba(59,130,246,0.12)"},children:n("tasks.tunnel_open_in_cursor")})]}):e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 font-mono lowercase",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:n("tasks.tunnel_header")}),e.jsxs("span",{className:"text-xs",style:{color:De(s)},children:["● ",Le(s,n)]})]}),s==="CONNECTED"&&_&&e.jsxs("p",{className:"mb-2 text-xs text-[var(--text-muted)]",children:["// ",u]}),s==="CONNECTED"&&l&&e.jsxs("div",{className:"mb-3 flex items-center gap-2 rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] px-3 py-2",children:[e.jsx("code",{className:"flex-1 truncate text-xs text-[var(--text-primary)]",children:l}),e.jsxs("button",{onClick:W,className:"shrink-0 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors","aria-label":n("tasks.tunnel_copy_url"),children:["[",n("common.copy"),"]"]})]}),te&&e.jsx("p",{className:"mb-2 text-xs text-[var(--accent)]",children:n("tasks.tunnel_copied")}),s==="STARTING"&&e.jsx("p",{className:"mb-3 text-xs text-[var(--text-muted)]",children:n("tasks.tunnel_waiting")}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[(s==="IDLE"||s==="CLOSED")&&e.jsx("button",{onClick:f,disabled:h,className:"rounded-[4px] border border-[var(--accent)]/40 px-3 py-1.5 text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors disabled:opacity-50",children:n(h?"tasks.tunnel_starting_button":"tasks.tunnel_start_button")}),s==="STARTING"&&e.jsx("button",{onClick:R,disabled:h,className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors disabled:opacity-50",children:n(h?"tasks.tunnel_stopping":"tasks.tunnel_cancel")}),s==="CONNECTED"&&l&&e.jsxs(e.Fragment,{children:[e.jsx("a",{href:l.replace(/^https?:/,"cursor:"),target:"_blank",rel:"noopener noreferrer",className:"rounded-[4px] border border-[var(--accent)]/40 px-3 py-1.5 text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors",children:n("tasks.tunnel_open_cursor")}),e.jsx("a",{href:l.replace(/^https?:/,"vscode:"),target:"_blank",rel:"noopener noreferrer",className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:n("tasks.tunnel_open_vscode")}),e.jsx("button",{onClick:R,disabled:h,className:"rounded-[4px] border border-[var(--destructive)]/40 px-3 py-1.5 text-[var(--destructive)] hover:bg-[var(--destructive)]/10 transition-colors disabled:opacity-50",children:n(h?"tasks.tunnel_stopping":"tasks.tunnel_stop")})]}),s==="EXPIRED"&&e.jsx("button",{onClick:f,disabled:h,className:"rounded-[4px] border border-[var(--accent)]/40 px-3 py-1.5 text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors disabled:opacity-50",children:n(h?"tasks.tunnel_starting_button":"tasks.tunnel_restart")})]})]})}function nt({isOpen:i,onClose:x,onConfirm:a,taskId:n,isLoading:s}){const{t:o}=X();return e.jsx(Ie,{isOpen:i,onClose:x,onConfirm:a,title:o("tasks.cancel_task_title"),message:o("tasks.cancel_task_message",{id:String(n)}),confirmLabel:o("tasks.cancel_task_confirm_label"),confirmVariant:"danger",isLoading:s})}function lt({isOpen:i,onClose:x,onConfirm:a,taskId:n,mrUrl:s,isLoading:o}){const{t:l}=X(),g=s?l("tasks.retry_message_with_mr",{id:String(n),url:s}):l("tasks.retry_message_without_mr",{id:String(n)});return e.jsx(Ie,{isOpen:i,onClose:x,onConfirm:a,title:l("tasks.retry_title"),message:g,confirmLabel:l("tasks.retry_confirm_label"),confirmVariant:"accent",isLoading:o})}function ct(i){switch(i){case"stage_change":return"text-[var(--accent)]";case"info":return"text-[var(--text-secondary)]";case"warning":return"text-[var(--warning)]";case"error":return"text-[var(--destructive)]";case"system":return"text-[var(--info)]";default:return"text-[var(--text-muted)]"}}function ie({status:i}){const x=He(i);return e.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-[4px] px-2 py-0.5 text-xs",style:{color:x},children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-[3px]",style:{backgroundColor:x}}),i.toLowerCase()]})}function it(i){let a=["init","agent","completed"];if(i.configSnapshot)try{const s=JSON.parse(i.configSnapshot);if(s&&typeof s=="object"&&typeof s.pipeline=="string"){const o=JSON.parse(s.pipeline);o&&typeof o=="object"&&Array.isArray(o.stages)&&o.stages.length>0&&o.stages.every(l=>l&&typeof l=="object"&&typeof l.name=="string")&&(a=o.stages.map(l=>l.name))}}catch{}const n=i.currentStage?a.indexOf(i.currentStage):-1;return a.map((s,o)=>{let l="pending";return i.status===V.COMPLETED?l="completed":i.status===V.FAILED&&o<=n?l=o===n?"failed":"completed":n>=0&&(o<n?l="completed":o===n&&(l="running")),{name:s,status:l}})}function gt(){var Ne,ye;const{id:i}=Oe(),x=Ue(),{t:a}=X(),n=Ge(t=>t.cancelTask),[s,o]=r.useState(null),[l,g]=r.useState([]),[_,E]=r.useState(!0),[u,C]=r.useState(null),[h,N]=r.useState(!1),[te,L]=r.useState(!1),[I,$]=r.useState(!1),[se,S]=r.useState(!1),[f,R]=r.useState("terminal"),[W,y]=r.useState([]),[A,H]=r.useState(0),[q,B]=r.useState(0),[G,xe]=r.useState(""),[J,$e]=r.useState(""),[Re,oe]=r.useState(!1),[Ae,de]=r.useState(!1),[M,me]=r.useState(null),[k,pe]=r.useState("disconnected"),[K,ue]=r.useState("auto"),P=r.useRef(null),he=r.useRef(null),m=Number(i),v=s?Ve.includes(s.status):!1;ze(s?`#${s.id} ${s.description}`:null);const w=r.useCallback(async()=>{try{const t=await j.get(`web/tasks/${m}`).json();o(t)}catch{}},[m]),Q=r.useCallback(async()=>{try{const t=await j.get(`web/tasks/${m}/logs`).json();g(t.lines)}catch{}},[m]),F=r.useCallback(async()=>{try{const t=await j.get(`web/tasks/${m}/pending-confirm`).json();C(t.confirm)}catch{C(null)}},[m]),fe=r.useCallback(async()=>{oe(!0);try{const t=new URLSearchParams;t.set("limit","50"),t.set("offset",String(q*50)),G&&t.set("type",G),J&&t.set("search",J);const c=await j.get(`web/tasks/${m}/events?${t}`).json();y(c.events),H(c.total)}catch{}finally{oe(!1)}},[m,q,G,J]);r.useEffect(()=>{f==="logs"&&fe()},[f,fe]),r.useEffect(()=>{f==="pipeline"&&!v&&j.get(`web/workspaces/${m}`).json().then(me).catch(()=>me(null))},[f,m,v]);const O=ke(t=>t.lastEvent),ve=ke(t=>t.eventSeq);r.useEffect(()=>{E(!0),Promise.all([w(),Q(),F()]).finally(()=>E(!1))},[w,Q,F]),r.useEffect(()=>{!O||ve===0||(O.event==="task_status_changed"&&O.taskId===m||O.event==="task_created"&&O.taskId===m)&&(w(),F())},[ve,O,m,w,F]),r.useEffect(()=>{if(v)return;const c=setInterval(()=>{document.visibilityState!=="hidden"&&Promise.all([w(),Q(),F()])},15e3);return()=>clearInterval(c)},[v,w,Q,F]);const be=r.useCallback(()=>C(null),[]),Y=r.useCallback(()=>{C(null),w()},[w]);async function Me(){$(!0);try{await n(m),N(!1),await w()}finally{$(!1)}}async function Pe(){S(!0);try{await j.post(`web/tasks/${m}/retry`),L(!1),await w()}finally{S(!1)}}const b=r.useMemo(()=>s?it(s):[],[s==null?void 0:s.configSnapshot,s==null?void 0:s.currentStage,s==null?void 0:s.status]),ae=b.findIndex(t=>t.status==="running");if(_)return e.jsx("div",{className:"flex h-full items-center justify-center font-mono",children:e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:a("tasks.loading_task")})});if(!s)return e.jsxs("div",{className:"mx-auto max-w-5xl px-6 py-8 font-mono lowercase text-center",children:[e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:a("tasks.task_not_found")}),e.jsxs("button",{onClick:()=>x("/tasks"),className:"mt-4 rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:["< ",a("tasks.back_to_tasks")]})]});const ge=e.jsxs("div",{className:"flex items-center gap-3 border-b border-[var(--border)] bg-[var(--bg-primary)] px-4 shrink-0 md:hidden",style:{height:56},children:[e.jsx("button",{onClick:()=>x("/tasks"),className:"shrink-0 text-[var(--text-muted)]",children:e.jsx(Je,{className:"h-4 w-4"})}),e.jsxs("span",{className:"truncate text-sm font-medium text-[var(--text-primary)]",children:["#",s.id," ",s.description]})]}),re=e.jsxs("div",{className:"hidden md:flex items-center gap-4 border-b border-[var(--border)] bg-[var(--bg-primary)] px-5 shrink-0",style:{height:44},children:[e.jsx(ie,{status:s.status}),e.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),e.jsxs(qe,{to:`/projects/${s.projectKey}`,className:"text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:["project: ",e.jsx("span",{className:"text-[var(--text-primary)]",children:s.projectKey})]}),s.branch&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["branch: ",e.jsx("span",{className:"text-[var(--text-primary)]",children:s.branch})]})]}),s.mrUrl&&/^https?:\/\//.test(s.mrUrl)&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),e.jsxs("a",{href:s.mrUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-[var(--info)] hover:underline",children:["MR: ",((Ne=s.mrUrl.match(/!?\d+$/))==null?void 0:Ne[0])??"view"]})]})]}),je=e.jsxs("div",{className:"flex items-center gap-3 border-t border-[var(--border)] bg-[var(--bg-primary)] px-4 md:px-5 shrink-0",style:{height:48},children:[!v&&e.jsxs("button",{onClick:()=>N(!0),className:"flex flex-1 md:flex-none items-center justify-center gap-1.5 rounded-[4px] bg-[var(--destructive)]/10 px-3 h-8 text-[11px] font-medium text-[var(--destructive)]",children:[e.jsx(le,{className:"h-3 w-3"}),a("tasks.cancel_task")]}),s.status===V.FAILED&&e.jsxs("button",{onClick:()=>L(!0),className:"flex flex-1 md:flex-none items-center justify-center gap-1.5 rounded-[4px] bg-[var(--bg-card)] px-3 h-8 text-[11px] text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-input)] transition-colors cursor-pointer",children:[e.jsx(Qe,{className:"h-3 w-3"}),a("tasks.retry_task")]}),s.workerId&&!v&&e.jsxs("button",{onClick:()=>{R("pipeline"),setTimeout(()=>{var t,c;(c=(t=he.current)==null?void 0:t.scrollIntoView)==null||c.call(t,{behavior:"smooth",block:"center"})},50)},className:"hidden lg:flex items-center justify-center gap-1.5 rounded-[4px] px-3 h-8 text-[11px] font-medium text-[var(--info)]",style:{backgroundColor:"rgba(59,130,246,0.12)"},children:[e.jsx(Ye,{className:"h-3 w-3"}),a("tasks.cursor_tunnel")]})]}),Fe=e.jsxs("div",{className:"hidden w-[280px] shrink-0 flex-col gap-6 overflow-y-auto border-l border-[var(--border)] bg-[var(--bg-primary)] p-4 lg:flex",children:[e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:a("tasks.pipeline_stages")}),b.map(t=>{const c=t.status==="completed",d=t.status==="running",p=t.status==="failed";return e.jsxs("div",{className:`flex items-center gap-2 rounded-[4px] px-2 py-1.5 ${d?"bg-[#1a1a1a]":""}`,children:[c&&e.jsx(we,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),d&&e.jsx(ce,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),p&&e.jsx(le,{className:"h-3.5 w-3.5 shrink-0 text-[var(--destructive)]"}),t.status==="pending"&&e.jsx(Se,{className:"h-3.5 w-3.5 shrink-0 text-[#525252]"}),e.jsx("span",{className:"text-xs",style:{color:c?"var(--accent)":d?"#e5e5e5":p?"var(--destructive)":"#525252",fontWeight:d?500:400},children:d?`> ${t.name}`:t.name})]},t.name)})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:a("tasks.activity_log")}),l.length>0?e.jsx("div",{className:"flex flex-col gap-1.5",children:l.slice(0,8).map((t,c)=>e.jsx("p",{className:"text-[11px] leading-relaxed text-[var(--text-muted)]",children:t},c))}):e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.no_activity")})]})]}),ne=e.jsxs(e.Fragment,{children:[e.jsx(nt,{isOpen:h,onClose:()=>N(!1),onConfirm:Me,taskId:m,isLoading:I}),e.jsx(lt,{isOpen:te,onClose:()=>L(!1),onConfirm:Pe,taskId:m,mrUrl:s.mrUrl??void 0,isLoading:se})]});return Ae&&f==="terminal"?e.jsxs("div",{className:"fixed inset-0 z-50 flex flex-col bg-[var(--bg-primary)] font-mono lowercase h-screen",style:{height:"100dvh",paddingTop:"env(safe-area-inset-top, 0px)",paddingBottom:"env(safe-area-inset-bottom, 0px)"},children:[re,e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 shrink-0",style:{height:36,backgroundColor:"#111111"},children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:a("tasks.pty_terminal")}),e.jsxs("span",{className:`inline-flex items-center gap-1 text-[11px] ${k==="connected"?"text-[var(--accent)]":k==="connecting"?"text-[var(--warning)]":"text-[var(--text-muted)]"}`,children:[e.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${k==="connected"?"bg-[var(--accent)]":k==="connecting"?"bg-[var(--warning)]":"bg-[#525252]"}`}),a(`tasks.${k}`)]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[!v&&K==="auto"&&e.jsxs("button",{onClick:()=>{var t;return(t=P.current)==null?void 0:t.requestTakeover()},className:"flex items-center gap-1.5 rounded-[4px] px-2.5 h-10 md:h-8 text-[11px] font-medium text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:[e.jsx(Ee,{className:"h-3 w-3"}),a("tasks.take_over")]}),!v&&K==="manual"&&e.jsx("button",{onClick:()=>{var t;return(t=P.current)==null?void 0:t.releaseTakeover()},className:"flex items-center gap-1.5 rounded-[4px] px-2.5 h-10 md:h-8 text-[11px] font-medium text-[var(--accent)]",style:{backgroundColor:"rgba(34,197,94,0.12)"},children:a("tasks.restore_auto")}),s.currentStage&&e.jsxs("span",{className:"text-[11px] text-[var(--accent)]",children:[a("tasks.stage"),": ",s.currentStage]}),e.jsx("button",{onClick:()=>de(!1),className:"flex items-center rounded-[4px] bg-[var(--bg-card)] px-2.5 py-1 text-[var(--text-muted)]",children:e.jsx(tt,{className:"h-3 w-3"})})]})]}),e.jsx("div",{className:"min-h-0 flex-1",children:e.jsx(Ce,{ref:P,taskId:m,sessionId:s.currentSessionId??void 0,taskFinished:v,onStatusChange:pe,onTakeoverChange:ue})}),je,ne]}):s.status===V.SUSPENDED?e.jsxs("div",{className:"flex h-full flex-col font-mono lowercase",children:[ge,re,e.jsx("div",{className:"flex items-center gap-2 border-b px-4 md:px-6 py-2 text-xs shrink-0",style:{backgroundColor:"rgba(245,158,11,0.08)",borderColor:"rgba(245,158,11,0.2)",color:"var(--warning)"},children:a("tasks.task_suspended_banner")}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col md:flex-row gap-4 md:gap-6 p-4 md:p-6 overflow-y-auto",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-4",children:[e.jsxs("div",{className:"hidden md:flex items-center gap-3",children:[e.jsxs("span",{className:"text-xl font-bold text-[var(--text-primary)]",children:["#",s.id]}),e.jsx("span",{className:"text-base text-[var(--text-secondary)]",children:s.description}),e.jsx("span",{className:"rounded-[4px] px-2.5 py-1 text-[11px] font-bold text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:a("tasks.status_suspended")})]}),e.jsx("div",{className:"flex items-center gap-2 md:hidden",children:e.jsx("span",{className:"rounded-[4px] px-2.5 py-1 text-[11px] font-bold text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:a("tasks.status_suspended")})}),u&&e.jsxs("div",{className:"rounded-[4px] border p-4",style:{borderColor:"rgba(245,158,11,0.27)",backgroundColor:"#1a1a1a"},children:[e.jsx("p",{className:"mb-2 text-[11px] font-bold text-[var(--accent)]",children:a("tasks.pending_confirmation")}),e.jsx("p",{className:"mb-3 text-xs text-[var(--text-secondary)]",children:u.prompt??a("tasks.pipeline_requires_confirmation")}),e.jsx("div",{className:"mb-3 flex flex-col gap-1.5 text-[11px]",children:e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"stage"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:u.stageName})]})}),e.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:flex-wrap md:gap-3",children:[e.jsx("button",{onClick:async()=>{try{await j.post(`web/tasks/${m}/confirm-stage`,{json:{stageName:u.stageName,approved:!0}}),Y()}catch{_e.error(a("tasks.confirm_failed"))}},className:"flex-1 md:flex-none rounded-[4px] bg-[var(--accent)] px-4 py-2.5 md:py-2 text-[11px] font-bold text-[#0c0c0c]",children:a("tasks.confirm_and_proceed")}),e.jsx("button",{onClick:async()=>{try{await j.post(`web/tasks/${m}/confirm-stage`,{json:{stageName:u.stageName,approved:!1}}),Y()}catch{_e.error(a("tasks.confirm_failed"))}},className:"flex-1 md:flex-none rounded-[4px] bg-[#1a1a1a] px-4 py-2.5 md:py-2 text-[11px] text-[var(--destructive)]",style:{border:"1px solid rgba(239,68,68,0.27)"},children:a("tasks.reject")})]})]}),e.jsxs("div",{className:"flex flex-col gap-3 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 lg:hidden",children:[e.jsx("span",{className:"text-xs font-bold text-[var(--accent)]",children:a("tasks.task_info")}),e.jsxs("div",{className:"flex flex-col gap-1.5 text-[11px]",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"status"}),e.jsx("span",{className:"font-bold text-[var(--warning)]",children:"suspended"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"project"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:s.projectKey})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"worker"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:s.workerName??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"created"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:ee(s.createdAt)})]})]})]}),e.jsx("div",{className:"hidden md:flex flex-wrap items-center gap-2 py-2",children:b.map((t,c)=>{const d=t.status==="failed",p=t.status==="completed",T=t.status==="running"&&s.status===V.SUSPENDED,U=d?"var(--destructive)":p?"var(--accent)":T?"var(--warning)":"#525252",Z=d?"rgba(239,68,68,0.12)":p?"rgba(34,197,94,0.12)":T?"rgba(245,158,11,0.12)":"transparent";return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"rounded-[4px] px-2.5 py-1 text-[11px]",style:{color:U,backgroundColor:Z,fontWeight:T?700:400,border:T?`1px solid ${U}`:void 0},children:T?"confirm":`${t.name}${p?" ✓":d?" ✗":""}`}),c<b.length-1&&e.jsx("div",{className:"h-px w-6 bg-[var(--border)]"})]},t.name)})}),e.jsxs("div",{className:"hidden md:block min-h-[200px] flex-1 rounded-[4px] border border-[var(--border)] bg-[#0c0c0c] p-4",children:[e.jsx("p",{className:"mb-2 text-[11px] font-bold text-[var(--accent)]",children:a("tasks.pty_output")}),e.jsxs("div",{className:"flex flex-col gap-1",children:[l.slice(-10).map((t,c)=>e.jsx("p",{className:"text-[11px] leading-relaxed text-[var(--text-secondary)]",children:t},c)),l.length===0&&e.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.no_output")})]})]})]}),e.jsxs("div",{className:"hidden w-[280px] shrink-0 flex-col gap-4 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 lg:flex",children:[e.jsx("span",{className:"text-[13px] font-bold text-[var(--accent)]",children:a("tasks.task_info")}),e.jsxs("div",{className:"flex flex-col gap-1.5 text-[11px]",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"status"}),e.jsx("span",{className:"font-bold text-[var(--warning)]",children:"suspended"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"project"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:s.projectKey})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"worker"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:s.workerName??"-"})]})]}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsx("span",{className:"text-xs font-bold text-[var(--accent)]",children:a("tasks.stage_timeline")}),e.jsx("div",{className:"flex flex-col gap-2",children:b.map(t=>{const c=t.status==="completed"?"var(--accent)":t.status==="failed"?"var(--destructive)":t.status==="running"?"var(--warning)":"#525252",d=t.status==="failed"?"var(--destructive)":t.status==="running"?"var(--warning)":"#a3a3a3",p=t.status==="completed"?"completed":t.status==="running"?"suspended":t.status==="failed"?"failed":"pending";return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"h-2 w-2 shrink-0 rounded-[4px]",style:{backgroundColor:c}}),e.jsxs("span",{className:"text-[11px]",style:{color:d,fontWeight:t.status==="running"?700:400},children:[t.name," ",p]})]},t.name)})}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsx("div",{className:"flex flex-col gap-1.5 text-[11px]",children:e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"created"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:ee(s.createdAt)})]})})]})]}),u&&e.jsx(Te,{isOpen:!!u,onClose:be,taskId:m,stageName:u.stageName,timeoutSeconds:Math.ceil(u.timeout/1e3),onSubmitted:Y}),ne]}):e.jsxs("div",{className:"flex h-full flex-col font-mono lowercase",children:[ge,e.jsxs("div",{className:"flex items-center gap-3 overflow-x-auto no-scrollbar border-b border-[var(--border)] bg-[var(--bg-primary)] px-4 py-2 shrink-0 md:hidden",children:[e.jsx(ie,{status:s.status}),e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:s.projectKey}),s.workerName&&e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:s.workerName}),s.branch&&e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)] truncate max-w-[120px]",children:s.branch})]}),re,s.errorMessage&&e.jsxs("div",{className:"flex items-center gap-2 border-b px-6 py-2 text-xs shrink-0 bg-[var(--destructive)]/10 text-[var(--destructive)]",style:{borderColor:"rgba(239,68,68,0.2)"},children:["// error: ",s.errorMessage]}),u&&e.jsx(Te,{isOpen:!!u,onClose:be,taskId:m,stageName:u.stageName,timeoutSeconds:Math.ceil(u.timeout/1e3),onSubmitted:Y}),e.jsxs("div",{className:"flex min-h-0 flex-1",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsx("div",{className:"flex items-center border-b border-[var(--border)] shrink-0",children:["terminal","pipeline","logs"].map(t=>e.jsx("button",{onClick:()=>R(t),className:`px-4 py-2.5 text-xs transition-colors ${f===t?"border-b-2 border-[var(--accent)] text-[var(--accent)] font-medium":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:a(t==="terminal"?"tasks.terminal":t==="pipeline"?"tasks.pipeline_tab":"tasks.logs")},t))}),f==="terminal"&&e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-3 md:px-5 shrink-0",style:{height:36,backgroundColor:"#111111"},children:[e.jsxs("div",{className:"flex items-center gap-2 md:gap-3",children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:a("tasks.pty_terminal")}),e.jsxs("span",{className:`inline-flex items-center gap-1 text-[11px] ${k==="connected"?"text-[var(--accent)]":k==="connecting"?"text-[var(--warning)]":"text-[var(--text-muted)]"}`,children:[e.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${k==="connected"?"bg-[var(--accent)]":k==="connecting"?"bg-[var(--warning)]":"bg-[#525252]"}`}),a(`tasks.${k}`)]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[!v&&K==="auto"&&e.jsxs("button",{onClick:()=>{var t;return(t=P.current)==null?void 0:t.requestTakeover()},className:"flex items-center gap-1.5 rounded-[4px] px-2.5 h-10 md:h-8 text-[11px] font-medium text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:[e.jsx(Ee,{className:"h-3 w-3"}),a("tasks.take_over")]}),!v&&K==="manual"&&e.jsx("button",{onClick:()=>{var t;return(t=P.current)==null?void 0:t.releaseTakeover()},className:"flex items-center gap-1.5 rounded-[4px] px-2.5 h-10 md:h-8 text-[11px] font-medium text-[var(--accent)]",style:{backgroundColor:"rgba(34,197,94,0.12)"},children:a("tasks.restore_auto")}),!v&&K==="requesting"&&e.jsxs("span",{className:"flex items-center gap-1.5 px-2.5 h-10 md:h-8 text-[11px] text-[var(--warning)]",children:[e.jsx(ce,{className:"h-3 w-3 animate-spin"}),a("tasks.requesting_takeover")]}),!v&&s.currentStage&&e.jsxs("button",{className:"hidden md:flex items-center gap-1.5 rounded-[4px] bg-[var(--bg-card)] px-2.5 h-10 md:h-8 text-[11px] text-[var(--text-muted)]",children:[e.jsx(st,{className:"h-3 w-3"}),a("tasks.skip_stage")]}),e.jsx("button",{onClick:()=>de(!0),className:"hidden md:flex items-center rounded-[4px] bg-[var(--bg-card)] px-2.5 h-10 md:h-8 text-[var(--text-muted)]",children:e.jsx(Ze,{className:"h-3 w-3"})})]})]}),e.jsxs("div",{className:"flex items-center gap-2 border-b border-[var(--border)] px-4 py-2 shrink-0 md:hidden",children:[e.jsx(ie,{status:s.status}),s.workerName&&e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["on ",s.workerName]})]}),e.jsxs("div",{className:"border-b border-[var(--border)] px-4 py-3 shrink-0 md:hidden",children:[e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:a("tasks.stage_progress")}),e.jsx("div",{className:"mt-2 flex items-center gap-1 overflow-x-auto no-scrollbar",children:b.map((t,c)=>{const d=t.status==="completed",p=t.status==="running",U=t.status==="failed"?"var(--destructive)":d||p?"var(--accent)":"#525252";return e.jsxs("div",{className:"flex items-center",children:[e.jsxs("span",{className:"shrink-0 text-[11px] whitespace-nowrap",style:{color:U,fontWeight:p?600:400},children:[t.name,d?" ✓":p?" ...":""]}),c<b.length-1&&e.jsx("div",{className:"mx-1.5 h-px w-4 shrink-0",style:{backgroundColor:U}})]},t.name)})})]}),e.jsx("div",{className:"px-4 pt-3 pb-1 shrink-0 md:hidden",children:e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:a("tasks.pty_output")})}),e.jsx("div",{className:"min-h-0 flex-1 md:min-h-0",children:e.jsx(Ce,{ref:P,taskId:m,sessionId:s.currentSessionId??void 0,taskFinished:v,onStatusChange:pe,onTakeoverChange:ue})}),je]}),f==="pipeline"&&e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto p-4 md:p-6 lg:p-8",children:[e.jsx("div",{className:"flex items-center py-4 mb-4 md:mb-5 overflow-x-auto no-scrollbar",children:b.map((t,c)=>{const d=t.status==="completed",p=t.status==="running",Z=t.status==="failed"?"var(--destructive)":d||p?"var(--accent)":"#525252";return e.jsxs("div",{className:"flex items-center",style:{flex:c<b.length-1?1:void 0},children:[e.jsxs("div",{className:"flex flex-col items-center gap-1.5",children:[e.jsxs("div",{className:"flex h-6 w-6 md:h-7 md:w-7 items-center justify-center rounded-full shrink-0",style:{backgroundColor:Z},children:[d&&e.jsx("span",{className:"text-[11px] md:text-xs font-semibold text-[#0c0c0c]",children:"✓"}),p&&e.jsx("span",{className:"h-2 w-2 md:h-2.5 md:w-2.5 rounded-full bg-[#0c0c0c]"})]}),e.jsx("span",{className:"text-[11px] font-medium whitespace-nowrap",style:{color:Z},children:t.name})]}),c<b.length-1&&e.jsx("div",{className:"mx-1 md:mx-2 h-0.5 flex-1 min-w-3 rounded-full",style:{backgroundColor:c<(ae>=0?ae:0)?"var(--accent)":"#525252"}})]},t.name)})}),s.currentStage&&e.jsxs("div",{className:"mb-4 md:mb-5 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 text-xs leading-relaxed",children:[e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// stage: ",s.currentStage," (",ae+1,"/",b.length,")"]}),s.startedAt&&e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// elapsed: ",ee(s.startedAt).replace(" ago","")]}),e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// retries: ",s.retryCount,"/2"]})]}),e.jsx("button",{onClick:()=>R("terminal"),className:"flex-1 min-h-[100px] rounded-[4px] border border-dashed border-[var(--border)] flex items-center justify-center gap-2 text-[11px] text-[var(--text-muted)] hover:border-[var(--accent)] hover:text-[var(--accent)] transition-colors",children:e.jsxs("span",{children:["// ",a("tasks.view_terminal")]})}),e.jsxs("div",{className:"mt-4 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 lg:hidden",children:[e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:a("tasks.task_info")}),e.jsxs("div",{className:"mt-2 flex flex-col gap-1.5 text-[11px]",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"project"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:s.projectKey})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"worker"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:s.workerName??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"branch"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:s.branch??"-"})]})]})]}),e.jsxs("div",{className:"flex flex-col gap-6 mt-4 lg:hidden",children:[e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:a("tasks.pipeline_stages")}),b.map(t=>{const c=t.status==="completed",d=t.status==="running",p=t.status==="failed";return e.jsxs("div",{className:`flex items-center gap-2 rounded-[4px] px-2 py-1.5 ${d?"bg-[var(--bg-input)]":""}`,children:[c&&e.jsx(we,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),d&&e.jsx(ce,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),p&&e.jsx(le,{className:"h-3.5 w-3.5 shrink-0 text-[var(--destructive)]"}),t.status==="pending"&&e.jsx(Se,{className:"h-3.5 w-3.5 shrink-0 text-[#525252]"}),e.jsx("span",{className:"text-xs",style:{color:c?"var(--accent)":d?"var(--text-primary)":p?"var(--destructive)":"#525252",fontWeight:d?500:400},children:d?`> ${t.name}`:t.name})]},t.name)})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:a("tasks.activity_log")}),l.length>0?e.jsx("div",{className:"flex flex-col gap-1.5",children:l.slice(-12).map((t,c)=>e.jsx("p",{className:"text-[11px] leading-relaxed text-[var(--text-muted)]",children:t},c))}):e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.no_activity")})]})]})]}),f==="logs"&&e.jsxs("div",{className:"flex flex-1 flex-col gap-3 md:gap-5 overflow-y-auto p-4 md:p-6 lg:p-8",children:[e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)] md:hidden",children:a("tasks.task_logs")}),e.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-center md:gap-3",children:[e.jsx("div",{className:"flex items-center gap-1 overflow-x-auto no-scrollbar md:hidden",children:["","error","system"].map(t=>e.jsx("button",{onClick:()=>{xe(t),B(0)},className:`shrink-0 rounded-[4px] px-2.5 py-1 text-[11px] ${G===t?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)]"}`,children:t||"all"},t))}),e.jsx("div",{className:"hidden md:block",children:e.jsx(We,{value:G,onChange:t=>{xe(t),B(0)},options:[{value:"",label:"all"},{value:"stage_change",label:"stage_change"},{value:"info",label:"info"},{value:"warning",label:"warning"},{value:"error",label:"error"},{value:"system",label:"system"}],className:"w-36"})}),e.jsxs("div",{className:"flex flex-1 items-center gap-2 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2",children:[e.jsx(Be,{className:"h-3.5 w-3.5 text-[var(--text-muted)]"}),e.jsx("input",{type:"text",placeholder:a("tasks.search_logs"),value:J,onChange:t=>{$e(t.target.value),B(0)},className:"flex-1 bg-transparent text-xs text-[var(--text-primary)] outline-none placeholder:text-[var(--text-muted)]"})]})]}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[W.map((t,c)=>e.jsxs("div",{className:`flex items-start md:items-center gap-2 md:gap-4 rounded-[4px] px-2 md:px-3 py-2 text-[11px] md:text-xs ${c%2===0?"bg-[var(--bg-card)]":""}`,children:[e.jsx("span",{className:"shrink-0 text-[var(--text-muted)]",children:new Date(t.timestamp).toLocaleTimeString("en-US",{hour12:!1})}),e.jsx("span",{className:`shrink-0 font-medium ${ct(t.type)}`,children:t.type}),e.jsx("span",{className:"min-w-0 break-words md:truncate text-[var(--text-primary)]",children:t.message})]},t.id)),W.length===0&&!Re&&e.jsx("p",{className:"py-8 text-center text-xs text-[var(--text-muted)]",children:a("tasks.no_log_entries")})]}),A>50&&e.jsxs("div",{className:"flex items-center justify-center gap-1",children:[Array.from({length:Math.ceil(A/50)}).slice(0,5).map((t,c)=>e.jsx("button",{onClick:()=>B(c),className:`rounded-[4px] px-2 py-1 text-xs ${q===c?"bg-[var(--accent)] text-black font-medium":"text-[var(--text-muted)] hover:text-[var(--text-primary)]"}`,children:c+1},c)),Math.ceil(A/50)>5&&e.jsx("button",{onClick:()=>B(q+1),disabled:q>=Math.ceil(A/50)-1,className:"rounded-[4px] px-2 py-1 text-xs text-[var(--text-muted)] disabled:opacity-30",children:">"})]})]})]}),f==="terminal"&&Fe,f==="pipeline"&&e.jsxs("div",{className:"hidden w-[420px] shrink-0 flex-col gap-5 overflow-y-auto border-l border-[var(--border)] bg-[var(--bg-primary)] p-5 lg:flex",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[13px] font-semibold text-[var(--accent)]",children:a("tasks.task_info")}),e.jsxs("div",{className:"flex flex-col gap-1.5 text-xs",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"project"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:s.projectKey})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"creator"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:s.creatorName??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"worker"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:s.workerName??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"created_at"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:ee(s.createdAt)})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"agent_type"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:s.agentType??"claude"})]})]})]}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[13px] font-semibold text-[var(--accent)]",children:a("tasks.workspace_section")}),e.jsxs("div",{className:"flex flex-col gap-1.5 text-xs",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"branch"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:s.branch??(M==null?void 0:M.branch)??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"worktree"}),e.jsx("span",{className:"ml-4 truncate text-[var(--text-primary)]",children:(M==null?void 0:M.path)??"-"})]}),s.mrUrl&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"mr_link"}),e.jsx("a",{href:s.mrUrl,target:"_blank",rel:"noopener noreferrer",className:"font-medium text-[var(--info)] hover:underline",children:((ye=s.mrUrl.match(/!?\d+$/))==null?void 0:ye[0])??"view"})]})]})]}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsxs("div",{ref:he,className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[13px] font-semibold text-[var(--accent)]",children:a("tasks.cursor_tunnel_section")}),s.workerId?e.jsx(rt,{taskId:m,taskFinished:v,compact:!0}):e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.no_worker_assigned")})]}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[13px] font-semibold text-[var(--accent)]",children:a("tasks.stage_timeline")}),e.jsx("div",{className:"flex flex-col gap-2 text-xs",children:b.map(t=>{const c=t.status==="completed"?"✓":t.status==="running"?"→":"·",d=t.status==="completed"||t.status==="running"?"var(--accent)":t.status==="failed"?"var(--destructive)":"#525252",p=t.status==="completed"?"done":t.status==="running"?"running...":t.status==="failed"?"failed":"pending";return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-semibold",style:{color:d},children:c}),e.jsx("span",{className:t.status==="running"?"font-medium":"",style:{color:d},children:t.name}),e.jsxs("span",{className:"text-[11px]",style:{color:"#525252"},children:["— ",p]})]},t.name)})})]})]})]}),ne]})}export{gt as default};
@@ -0,0 +1 @@
1
+ import{R as V,e as F,a as P,j as e,u as X,h as Z,r as o,g as M,X as Y,i as ee,n as te,H as se,t as q,l as C,o as re,p as $}from"./index-vL7aQJNr.js";import{u as ae}from"./task.store-BE6fEPu4.js";import{T as U}from"./TaskStatusBadge-DuOoGIwE.js";import{f as W}from"./date-BdNtiQTP.js";import{t as oe}from"./string-B39tzdVK.js";import{S as L}from"./Select-BnV8yZlD.js";import{C as ne}from"./copy-BUH7P2Hf.js";import{E as J}from"./EmptyState-D3foEiul.js";import{T as H}from"./Skeleton-DUgWc2LJ.js";import{P as ie}from"./plus-Bnd1Vz2Y.js";import"./status-colors-BPEUp90-.js";const ce=V.memo(function({task:t}){const m=F(),{t:p}=P(),d=(i,r)=>p(`common.${i}`,{n:r});return e.jsxs("tr",{onClick:()=>m(`/tasks/${t.id}`),className:"cursor-pointer border-b border-[var(--border-row)] transition-colors hover:bg-[var(--bg-input)]",children:[e.jsxs("td",{className:"w-16 py-3 pr-4 font-mono text-xs font-medium text-[var(--text-secondary)] text-right tabular-nums",children:["#",t.id]}),e.jsx("td",{className:"py-3 pr-4 text-sm text-[var(--text-primary)]",children:oe(t.description,80)}),e.jsx("td",{className:"py-3 pr-4",children:e.jsx(U,{status:t.status})}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:t.projectKey}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:t.developerName??t.creatorName??"-"}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:t.workerName??"—"}),e.jsx("td",{className:"py-3 font-mono text-xs text-[var(--text-muted)]",children:W(t.createdAt,d)})]})});function le({isOpen:n,onClose:t,projects:m,projectsLoading:p,onSubmit:d,isSubmitting:i}){const{t:r}=P();X(a=>a.user);const h=Z(),[c,j]=o.useState(""),[x,v]=o.useState(""),[f,b]=o.useState(""),[g,_]=o.useState(""),[A,k]=o.useState([]),[N,u]=o.useState("");o.useEffect(()=>{n&&(j(""),v(""),b(""),_(""),u(""),h&&M.get("admin/developers").json().then(k).catch(()=>k([])))},[n,h]),o.useEffect(()=>{if(!n)return;function a(y){y.key==="Escape"&&t()}return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[n,t]);async function D(a){if(a.preventDefault(),u(""),!c||!x.trim()){u(r("tasks.project_and_description_required"));return}try{await d({projectKey:c,description:x.trim(),workerId:f||void 0,developerId:g?Number(g):void 0})}catch(y){const R=y instanceof Error?y.message:r("tasks.failed_to_create_task");u(R)}}return n?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 font-mono",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},onClick:a=>{a.target===a.currentTarget&&t()},children:e.jsxs("div",{className:"w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",onClick:a=>a.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-6 py-4",children:[e.jsxs("h2",{className:"text-sm text-[var(--text-primary)]",children:["// ",r("tasks.new_task")]}),e.jsx("button",{onClick:t,className:"text-[var(--text-muted)] transition-colors hover:text-[var(--text-primary)]",children:e.jsx(Y,{className:"h-4 w-4"})})]}),e.jsxs("form",{onSubmit:D,className:"px-6 py-5",children:[e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.task_description")}),e.jsx("textarea",{value:x,onChange:a=>v(a.target.value),placeholder:r("tasks.describe_task_placeholder"),rows:4,className:"w-full resize-none rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.project")}),e.jsx(L,{value:c,onChange:j,options:m.map(a=>({value:a.key,label:a.name})),placeholder:r(p?"common.loading":"tasks.select_project"),disabled:p})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.target_worker")}),e.jsx("input",{type:"text",value:f,onChange:a=>b(a.target.value),placeholder:r("tasks.any_able"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),h&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.assign_developer")}),e.jsx(L,{value:g,onChange:_,options:A.map(a=>({value:String(a.id),label:a.username})),placeholder:r("tasks.select_developer")})]}),N&&e.jsx("div",{className:"rounded-[4px] bg-[#2a1515] border border-[var(--destructive)]/30 px-3 py-2 text-xs text-[var(--destructive)]",children:N})]}),e.jsxs("div",{className:"mt-6 flex items-center justify-end gap-3",children:[e.jsx("button",{type:"button",onClick:t,className:"rounded-[4px] border border-[var(--border)] bg-transparent px-4 py-2 text-xs text-[var(--text-secondary)] transition-colors hover:text-[var(--text-primary)]",children:r("common.cancel")}),e.jsx("button",{type:"submit",disabled:i||!c||!x.trim(),className:"rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs text-black transition-opacity hover:opacity-90 disabled:opacity-40",children:r(i?"common.creating":"tasks.create_task")})]})]})]})}):null}function de({isOpen:n,onClose:t,onForceCreate:m,onViewExisting:p,similarTask:d,isLoading:i}){const{t:r}=P();return!d||!n?null:e.jsx("div",{onClick:t,style:{position:"fixed",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},children:e.jsxs("div",{onClick:h=>h.stopPropagation(),style:{width:"100%",maxWidth:"480px",backgroundColor:"var(--bg-card)",border:"1px solid var(--border)",borderRadius:"4px",padding:"1.5rem",fontFamily:"'JetBrains Mono', monospace"},children:[e.jsxs("div",{style:{marginBottom:"1.25rem"},children:[e.jsxs("div",{style:{color:"var(--accent)",fontSize:"0.875rem",fontWeight:600,display:"flex",alignItems:"center",gap:"0.5rem"},children:[e.jsx(ne,{style:{width:"1rem",height:"1rem"}}),r("tasks.dedup_title")]}),e.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.7rem",marginTop:"0.25rem"},children:r("tasks.dedup_description")})]}),e.jsxs("div",{style:{marginBottom:"1.25rem",padding:"0.75rem",border:"1px solid var(--border)",borderRadius:"4px",backgroundColor:"var(--bg-primary)"},children:[e.jsxs("div",{style:{color:"var(--text-muted)",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace"},children:["#",d.id," · ",d.status]}),e.jsx("div",{style:{color:"var(--text-primary)",fontSize:"0.75rem",marginTop:"0.375rem",lineHeight:"1.5"},children:d.description})]}),e.jsxs("div",{style:{display:"flex",gap:"0.75rem"},children:[e.jsx("button",{type:"button",onClick:t,disabled:i,className:"text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:border-[var(--text-muted)]",style:{flex:1,padding:"0.5rem",backgroundColor:"transparent",border:"1px solid var(--border)",borderRadius:"4px",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:i?"not-allowed":"pointer",opacity:i?.7:1,transition:"color 0.15s, border-color 0.15s"},children:r("common.cancel")}),e.jsx("button",{type:"button",onClick:()=>p(d.id),style:{flex:1,padding:"0.5rem",backgroundColor:"transparent",color:"var(--text-muted)",border:"1px solid var(--border)",borderRadius:"4px",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:"pointer"},children:r("tasks.view_existing")}),e.jsx("button",{type:"button",onClick:m,disabled:i,style:{flex:1,padding:"0.5rem",backgroundColor:"var(--warning)",color:"#0C0C0C",border:"none",borderRadius:"4px",fontSize:"0.75rem",fontWeight:600,fontFamily:"'JetBrains Mono', monospace",cursor:i?"not-allowed":"pointer",opacity:i?.7:1},children:r(i?"common.creating":"tasks.dedup_create_anyway")})]})]})})}function xe({task:n}){const t=F();return e.jsxs("div",{onClick:()=>t(`/tasks/${n.id}`),className:"cursor-pointer rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 transition-colors active:bg-[var(--bg-input)]",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("span",{className:"text-[11px] text-[var(--text-primary)] leading-tight",style:{wordBreak:"break-word"},children:["#",n.id," ",n.description]}),e.jsx("span",{className:"shrink-0",children:e.jsx(U,{status:n.status})})]}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-2 text-[11px] text-[var(--text-muted)]",children:[e.jsx("span",{children:W(n.createdAt)}),e.jsx("span",{children:"·"}),e.jsx("span",{children:n.projectKey}),n.workerName&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("span",{children:n.workerName})]})]})]})}const pe=[{key:"all",labelKey:"tasks.tab_all"},{key:C.RUNNING,labelKey:"tasks.tab_running"},{key:C.QUEUED,labelKey:"tasks.tab_queued"},{key:C.COMPLETED,labelKey:"tasks.tab_completed"},{key:C.FAILED,labelKey:"tasks.tab_failed"},{key:C.CANCELLED,labelKey:"tasks.tab_cancelled"}],K=20;function we(){const n=F(),{t}=P(),{tasks:m,loading:p,fetchTasks:d}=ae(),i=ee(s=>s.taskSeq),[r,h]=o.useState("all"),[c,j]=o.useState(""),[x,v]=o.useState(1),[f,b]=o.useState(!1);te(o.useMemo(()=>e.jsxs("button",{onClick:()=>b(!0),className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs font-mono text-black transition-opacity hover:opacity-90",children:[e.jsx(ie,{className:"h-3.5 w-3.5"}),t("tasks.new_task")]}),[t]));const[g,_]=o.useState([]),[A,k]=o.useState(!1),[N,u]=o.useState(!1),[D,a]=o.useState(!1),[y,R]=o.useState(null),[w,O]=o.useState(null);o.useEffect(()=>{const s={limit:String(K)};r!=="all"&&(s.status=r),d(s)},[r,d,i]),o.useEffect(()=>{v(1)},[c]),o.useEffect(()=>{f&&(k(!0),M.get("web/projects").json().then(s=>_(s)).catch(()=>{}).finally(()=>k(!1)))},[f]);const Q=o.useCallback(async s=>{u(!0);try{const l=await M.post("web/tasks",{json:{projectKey:s.projectKey,description:s.description,workerId:s.workerId,developerId:s.developerId}}).json();b(!1),n(`/tasks/${l.task.id}`)}catch(l){if(l instanceof se&&l.response.status===409){try{const S=await l.response.json();if(S.confirmRequired){R({id:S.confirmRequired.taskId,description:S.confirmRequired.message,status:"active"}),O(s),b(!1),a(!0);return}}catch{}q.error(t("tasks.similar_task_exists"))}else{const S=l instanceof Error?l.message:String(l);q.error(S)}}finally{u(!1)}},[n]),G=o.useCallback(async()=>{if(w){u(!0);try{const s=await M.post("web/tasks",{json:{projectKey:w.projectKey,description:w.description,workerId:w.workerId,force:!0}}).json();a(!1),n(`/tasks/${s.task.id}`)}finally{u(!1)}}},[w,n]),E=o.useMemo(()=>{if(!c.trim())return m;const s=c.toLowerCase();return m.filter(l=>l.description.toLowerCase().includes(s)||String(l.id).includes(c))},[m,c]),T=Math.max(1,Math.ceil(E.length/K)),I=E.slice((x-1)*K,x*K),z=t(c?"tasks.try_adjusting_search":"tasks.create_first_task"),B=c?void 0:e.jsx("button",{onClick:()=>b(!0),className:"rounded-[4px] bg-[var(--accent)] px-5 py-2 text-[11px] font-bold text-black",children:t("tasks.create_task")});return e.jsxs("div",{className:"mx-auto max-w-6xl px-2 py-4 md:px-4 md:py-6 font-mono",children:[e.jsxs("div",{className:"mb-4 flex flex-col gap-3 md:gap-4 md:flex-row md:items-center",children:[e.jsx("div",{className:"flex items-center gap-1 overflow-x-auto pb-1 md:pb-0 no-scrollbar",children:pe.map(s=>e.jsx("button",{onClick:()=>h(s.key),className:`shrink-0 rounded-[4px] px-3 py-2 h-10 md:h-8 text-xs transition-colors ${r===s.key?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)] bg-[var(--bg-card)] hover:text-[var(--text-secondary)]"}`,children:t(s.labelKey)},s.key))}),e.jsxs("div",{className:"relative md:ml-auto md:w-64",children:[e.jsx(re,{className:"absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-[var(--text-muted)]"}),e.jsx("input",{type:"text",placeholder:t("tasks.search_tasks"),value:c,onChange:s=>j(s.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] py-1.5 pl-8 pr-3 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"}),c&&e.jsx("button",{onClick:()=>j(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-xs text-[var(--text-muted)] hover:text-[var(--text-secondary)]",children:"x"})]})]}),e.jsx("div",{className:"hidden md:block rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:e.jsxs("table",{className:"w-full text-left",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] text-[11px] font-medium text-[#525252]",children:[e.jsx("th",{className:"w-16 px-4 py-2.5 text-right",children:t("tasks.id")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.description_col")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.status_col")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.project_col")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.assignee")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.worker")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.time")})]})}),e.jsxs("tbody",{children:[p&&I.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"p-4",children:e.jsx(H,{rows:5})})}),!p&&E.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"p-4",children:e.jsx(J,{icon:$,title:t("tasks.no_tasks_found"),description:z,action:B})})}),I.map(s=>e.jsx(ce,{task:s},s.id))]})]})}),e.jsxs("div",{className:"flex flex-col gap-2 md:hidden",children:[p&&I.length===0&&e.jsx("div",{className:"p-4",children:e.jsx(H,{rows:5})}),!p&&E.length===0&&e.jsx(J,{icon:$,title:t("tasks.no_tasks_found"),description:z,action:B}),I.map(s=>e.jsx(xe,{task:s},s.id))]}),T>1&&e.jsxs("div",{className:"mt-6 flex items-center justify-center gap-1",children:[e.jsx("button",{onClick:()=>v(Math.max(1,x-1)),disabled:x===1,className:"rounded-[4px] px-2 py-1 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] disabled:opacity-30 min-w-[44px] min-h-[44px] flex items-center justify-center",children:t("tasks.prev")}),Array.from({length:T},(s,l)=>l+1).map(s=>e.jsx("button",{onClick:()=>v(s),className:`rounded-[4px] px-2.5 py-1 text-xs transition-colors min-w-[44px] min-h-[44px] flex items-center justify-center ${x===s?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:s},s)),e.jsx("button",{onClick:()=>v(Math.min(T,x+1)),disabled:x===T,className:"rounded-[4px] px-2 py-1 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] disabled:opacity-30 min-w-[44px] min-h-[44px] flex items-center justify-center",children:t("common.next")})]}),e.jsx(le,{isOpen:f,onClose:()=>b(!1),projects:g,projectsLoading:A,onSubmit:Q,isSubmitting:N}),e.jsx(de,{isOpen:D,onClose:()=>a(!1),onForceCreate:G,onViewExisting:s=>{a(!1),n(`/tasks/${s}`)},similarTask:y,isLoading:N})]})}export{we as default};
@@ -0,0 +1 @@
1
+ import{a as l,j as a}from"./index-vL7aQJNr.js";import{a as r}from"./status-colors-BPEUp90-.js";const u={QUEUED:"tasks.status_queued",ASSIGNED:"tasks.status_assigned",RUNNING:"tasks.status_running",SUSPENDED:"tasks.status_suspended",COMPLETED:"tasks.status_completed",FAILED:"tasks.status_failed",CANCELLED:"tasks.status_cancelled"};function E({status:s}){const{t:e}=l(),t=u[s],n=t?e(t):s.toLowerCase(),o=r(s);return a.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-xs",style:{color:o},children:[a.jsx("span",{style:{fontSize:"0.6rem"},children:"●"}),n]})}export{E as T};
@@ -0,0 +1,16 @@
1
+ import{c as D,k as se,g as T,l as k,a as C,r as i,i as F,m as ae,j as e,X as K,e as ne}from"./index-vL7aQJNr.js";import{u as re}from"./task.store-BE6fEPu4.js";import{T as A,P as ie,C as ce}from"./task-constants-BbFyCyKk.js";import{i as R,O as q}from"./OnboardingGuide-D8RyPcEd.js";import{S as H,C as oe}from"./Select-BnV8yZlD.js";import{a as G}from"./status-colors-BPEUp90-.js";import{a as le}from"./date-BdNtiQTP.js";import{u as Z}from"./useFetch-vGZMAvGi.js";import{P as M}from"./plus-Bnd1Vz2Y.js";import{Z as de}from"./zap-DXw1NrWz.js";import{W as xe}from"./wifi-D60NkK6F.js";import"./chevron-right-CqyufMDW.js";/**
2
+ * @license lucide-react v0.469.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const ue=D("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
7
+ * @license lucide-react v0.469.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const me=D("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
12
+ * @license lucide-react v0.469.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const pe=D("ZapOff",[["path",{d:"M10.513 4.856 13.12 2.17a.5.5 0 0 1 .86.46l-1.377 4.317",key:"193nxd"}],["path",{d:"M15.656 10H20a1 1 0 0 1 .78 1.63l-1.72 1.773",key:"27a7lr"}],["path",{d:"M16.273 16.273 10.88 21.83a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14H4a1 1 0 0 1-.78-1.63l4.507-4.643",key:"1e0qe9"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),J="overlord_home_terminal";function he(){try{const s=localStorage.getItem(J);if(s)return JSON.parse(s)}catch{}return{pinnedTaskIds:[],activeTaskId:null}}let L="";function _(s){const a=JSON.stringify(s);a!==L&&(L=a,localStorage.setItem(J,a))}const W=he(),ve=new Set([k.QUEUED,k.ASSIGNED,k.RUNNING,k.SUSPENDED]);let P=!1;const fe=se((s,a)=>({pinnedTaskIds:W.pinnedTaskIds,activeTaskId:W.activeTaskId,taskMetas:{},stageConfirm:null,loading:!1,setActiveTask:t=>{s({activeTaskId:t}),_({pinnedTaskIds:a().pinnedTaskIds,activeTaskId:t})},pinTask:t=>{const{pinnedTaskIds:n}=a();if(n.includes(t))return;const o=[...n,t];s({pinnedTaskIds:o}),_({pinnedTaskIds:o,activeTaskId:a().activeTaskId})},unpinTask:t=>{const{pinnedTaskIds:n,activeTaskId:o,taskMetas:r}=a(),l=n.filter(c=>c!==t),x=o===t?l[0]??null:o,{[t]:h,...u}=r;s({pinnedTaskIds:l,activeTaskId:x,taskMetas:u}),_({pinnedTaskIds:l,activeTaskId:x})},loadActiveTasks:async()=>{if(!P){P=!0,s({loading:!0});try{const n=(await T.get("web/tasks",{searchParams:{limit:"30"}}).json()).data.filter(c=>ve.has(c.status)),o={};for(const c of n)o[c.id]={id:c.id,description:c.description,status:c.status,projectKey:c.projectKey,currentStage:c.currentStage,currentSessionId:c.currentSessionId};const r=new Set(n.map(c=>c.id)),{pinnedTaskIds:l,activeTaskId:x}=a(),h=[...new Set([...l.filter(c=>r.has(c)),...r])],u=x&&h.includes(x)?x:h[0]??null;s({taskMetas:o,pinnedTaskIds:h,activeTaskId:u}),_({pinnedTaskIds:h,activeTaskId:u})}catch{}finally{P=!1,s({loading:!1})}}},fetchStageConfirm:async t=>{try{const n=await T.get(`web/tasks/${t}/pending-confirm`).json();s({stageConfirm:n.confirm})}catch{s({stageConfirm:null})}},clearStageConfirm:()=>s({stageConfirm:null}),updateTaskMeta:(t,n)=>{const{taskMetas:o}=a(),r=o[t];r&&s({taskMetas:{...o,[t]:{...r,...n}}})}}));function be(){const[s,a]=i.useState(()=>R());i.useEffect(()=>{const n=()=>a(!0);return window.addEventListener("onboarding-dismissed",n),window.addEventListener("storage",()=>a(R())),()=>{window.removeEventListener("onboarding-dismissed",n),window.removeEventListener("storage",n)}},[]);const{data:t}=Z(()=>s?Promise.resolve(null):T.get("web/dashboard/stats").json(),[s]);return s||!t?null:{activeTasks:(t.active_tasks??0)+(t.queued_tasks??0),totalWorkers:t.online_workers??0,totalProjects:t.project_count??0,totalDevelopers:t.developer_count??0}}function ge({taskId:s,confirm:a,onSubmitted:t}){const{t:n}=C(),[o,r]=i.useState(a.timeout),[l,x]=i.useState(!1);i.useEffect(()=>{r(a.timeout);const u=setInterval(()=>{r(c=>c<=1?(clearInterval(u),0):c-1)},1e3);return()=>clearInterval(u)},[a.timeout,a.stageName]);const h=i.useCallback(async u=>{x(!0);try{await T.post(`web/tasks/${s}/confirm-stage`,{json:{stageName:a.stageName,approved:u}}),t()}catch{}finally{x(!1)}},[s,a.stageName,t]);return e.jsxs("div",{className:"flex items-center justify-between gap-2 border-b-2 border-[var(--warning)] bg-[var(--warning)]/10 px-3 py-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(ce,{className:"h-3.5 w-3.5 shrink-0 text-[var(--warning)]"}),e.jsxs("span",{className:"truncate text-xs text-[var(--text-primary)]",children:["// stage: ",a.stageName]}),e.jsx("span",{className:"shrink-0 text-xs text-[var(--warning)]",children:le(o)})]}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx("button",{onClick:()=>h(!1),disabled:l,className:"rounded-[4px] border border-[var(--border)] px-2 py-1 text-[11px] text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors disabled:opacity-50",children:n("tasks.reject")}),e.jsx("button",{onClick:()=>h(!0),disabled:l,className:"rounded-[4px] bg-[var(--accent)] px-2 py-1 text-[11px] text-black hover:opacity-90 transition-opacity disabled:opacity-50",children:n(l?"tasks.stage_submitting":"tasks.confirm_and_proceed")})]})]})}function je({projectKey:s,onProjectChange:a,onCreated:t}){const{t:n}=C(),o=re(p=>p.createTask),[r,l]=i.useState(""),[x,h]=i.useState(!1),[u,c]=i.useState(!1),{data:v}=Z(()=>T.get("web/projects").json(),[]),b=i.useMemo(()=>{const p=(v??[]).map(j=>({value:j.key,label:j.key}));return[{value:"",label:n("terminal_home.all_projects")},...p]},[v,n]),g=i.useRef(!1);i.useEffect(()=>{if(!g.current){if(s){g.current=!0;return}b.length>1&&(a(b[1].value),g.current=!0)}},[s,b,a]);const w=!!s&&!!r.trim();async function y(){if(w){h(!0);try{const p=await o({projectKey:s,description:r.trim()});l(""),t(p.id)}catch{}finally{h(!1)}}}const I="flex-1 rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-2 py-1.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden md:flex items-center gap-2 border-b border-[var(--border)] bg-[var(--bg-card)] px-3 py-2",children:[e.jsx("div",{className:"w-[140px]",children:e.jsx(H,{value:s,onChange:a,options:b,placeholder:n("terminal_home.select_project")})}),e.jsx("input",{type:"text",value:r,onChange:p=>l(p.target.value),onKeyDown:p=>p.key==="Enter"&&y(),placeholder:n("terminal_home.task_description_placeholder"),className:I,disabled:x}),e.jsxs("button",{onClick:y,disabled:x||!w,className:"flex items-center gap-1 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",children:[e.jsx(M,{className:"h-3 w-3"}),n(x?"common.creating":"terminal_home.new_task")]})]}),e.jsx("div",{className:"md:hidden border-b border-[var(--border)] bg-[var(--bg-card)]",children:u?e.jsxs("div",{className:"flex flex-col gap-2 p-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex-1",children:e.jsx(H,{value:s,onChange:a,options:b,placeholder:n("terminal_home.select_project")})}),e.jsx("button",{onClick:()=>c(!1),className:"p-1 text-[var(--text-muted)]",children:e.jsx(K,{className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",value:r,onChange:p=>l(p.target.value),onKeyDown:p=>p.key==="Enter"&&y(),placeholder:n("terminal_home.task_description_placeholder"),className:I,disabled:x}),e.jsx("button",{onClick:y,disabled:x||!w,className:"rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",children:e.jsx(M,{className:"h-3 w-3"})})]})]}):e.jsxs("button",{onClick:()=>c(!0),className:"flex w-full items-center justify-center gap-1 py-2 text-xs text-[var(--accent)] hover:opacity-80",children:[e.jsx(M,{className:"h-3.5 w-3.5"}),n("terminal_home.new_task")]})})]})}function z({status:s,size:a}){const t=s===k.SUSPENDED,n=G(s),o=a==="sm"?"h-1.5 w-1.5":"h-2 w-2";return e.jsx("span",{className:`${o} shrink-0 rounded-full ${t?"animate-pulse":""}`,style:{backgroundColor:t?"var(--warning)":n}})}function ke({tasks:s,activeId:a,onSelect:t,onUnpin:n}){const o=ne();return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden md:flex flex-col border-r border-[var(--border)] bg-[var(--bg-card)] overflow-y-auto",style:{width:200,minWidth:200},children:[e.jsx("div",{className:"border-b border-[var(--border)] px-3 py-2",children:e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:"// active tasks"})}),s.length===0?e.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:"no active tasks"})}):e.jsx("div",{className:"flex-1",children:s.map(r=>{const l=r.id===a;return e.jsxs("div",{onClick:()=>t(r.id),className:`group flex items-center gap-2 px-3 py-2 cursor-pointer transition-colors ${l?"bg-[var(--accent)]/10 text-[var(--text-primary)]":"text-[var(--text-secondary)] hover:bg-[var(--bg-input)] hover:text-[var(--text-primary)]"}`,children:[e.jsx(z,{status:r.status,size:"md"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"truncate text-xs",children:["#",r.id," ",r.description]}),e.jsx("div",{className:"text-[10px] text-[var(--text-muted)]",children:r.projectKey})]}),e.jsx("button",{onClick:x=>{x.stopPropagation(),n(r.id)},className:"hidden group-hover:block shrink-0 p-0.5 text-[var(--text-muted)] hover:text-[var(--text-primary)]",title:"unpin",children:e.jsx(K,{className:"h-3 w-3"})}),e.jsx("button",{onClick:x=>{x.stopPropagation(),o(`/tasks/${r.id}`)},className:"hidden group-hover:block shrink-0 p-0.5 text-[var(--text-muted)] hover:text-[var(--accent)]",title:"open detail",children:e.jsx("span",{className:"text-[10px]",children:"→"})})]},r.id)})})]}),e.jsx("div",{className:"flex md:hidden overflow-x-auto border-b border-[var(--border)] bg-[var(--bg-card)]",style:{height:44},children:s.length===0?e.jsx("div",{className:"flex items-center justify-center w-full",children:e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:"no active tasks"})}):s.map(r=>{const l=r.id===a;return e.jsxs("button",{onClick:()=>t(r.id),className:`flex shrink-0 items-center gap-1.5 px-3 border-b-2 transition-colors ${l?"border-[var(--accent)] text-[var(--text-primary)]":"border-transparent text-[var(--text-secondary)]"}`,children:[e.jsx(z,{status:r.status,size:"sm"}),e.jsxs("span",{className:"text-[11px] whitespace-nowrap",children:["#",r.id]})]},r.id)})})]})}function ye({task:s,takeoverState:a,onTakeover:t,onRelease:n}){const o=G(s.status),r=a==="manual";return e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] bg-[var(--bg-card)] px-3",style:{height:36,minHeight:36},children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:s.projectKey}),e.jsx("span",{className:"text-[11px]",style:{color:o},children:s.status.toLowerCase()}),s.currentStage&&e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["// ",s.currentStage]})]}),e.jsx("div",{className:"flex items-center gap-1",children:!A.includes(s.status)&&(r?e.jsxs("button",{onClick:n,className:"flex items-center gap-1 rounded-[4px] border border-[var(--accent)] px-2 py-0.5 text-[11px] text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors",children:[e.jsx(pe,{className:"h-3 w-3"}),e.jsx("span",{className:"hidden md:inline",children:"release"})]}):e.jsxs("button",{onClick:t,disabled:a==="requesting",className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2 py-0.5 text-[11px] text-[var(--text-secondary)] hover:text-[var(--accent)] hover:border-[var(--accent)] transition-colors disabled:opacity-50",children:[e.jsx(de,{className:"h-3 w-3"}),e.jsx("span",{className:"hidden md:inline",children:"take over"})]}))})]})}function Ne({task:s,ptyStatus:a}){const t=a==="connected";return e.jsxs("div",{className:"flex items-center justify-between border-t border-[var(--border)] bg-[var(--bg-card)] px-3",style:{height:28,minHeight:28},children:[e.jsx("span",{className:"text-[10px] text-[var(--text-muted)]",children:s.currentStage?`stage: ${s.currentStage}`:`task #${s.id}`}),e.jsxs("span",{className:`flex items-center gap-1 text-[10px] ${t?"text-[var(--accent)]":"text-[var(--text-muted)]"}`,children:[t?e.jsx(xe,{className:"h-2.5 w-2.5"}):e.jsx(me,{className:"h-2.5 w-2.5"}),t?"connected":a]})]})}function we({onboardingData:s}){const[a,t]=i.useState(!1),{t:n}=C();return s?a?e.jsxs("div",{className:"border-b border-[var(--accent)]/30",children:[e.jsxs("button",{onClick:()=>t(!1),className:"flex w-full items-center justify-between bg-[var(--bg-card)] px-3 py-1.5 transition-colors hover:bg-[var(--bg-input)]",children:[e.jsx("span",{className:"text-[11px] text-[var(--accent)]",children:n("onboarding.getting_started")}),e.jsx(ue,{className:"h-3 w-3 text-[var(--text-muted)]"})]}),e.jsx("div",{className:"max-h-[300px] overflow-y-auto",children:e.jsx(q,{data:s})})]}):e.jsxs("button",{onClick:()=>t(!0),className:"flex w-full items-center justify-between border-b border-[var(--accent)]/30 bg-[var(--bg-card)] px-3 py-1.5 transition-colors hover:bg-[var(--bg-input)]",style:{height:36},children:[e.jsx("span",{className:"text-[11px] text-[var(--accent)]",children:n("onboarding.getting_started")}),e.jsx(oe,{className:"h-3 w-3 text-[var(--text-muted)]"})]}):null}function B({onboardingData:s}){const{t:a}=C();return e.jsx("div",{className:"flex flex-1 flex-col items-center justify-center p-6",children:s?e.jsx("div",{className:"w-full max-w-lg",children:e.jsx(q,{data:s})}):e.jsxs("div",{className:"text-center",children:[e.jsxs("div",{className:"mb-3 text-3xl text-[var(--border)]",children:[">","_"]}),e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:a("terminal_home.no_active_tasks")}),e.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:a("terminal_home.create_task_hint")})]})})}function $e(){const{t:s}=C(),{pinnedTaskIds:a,activeTaskId:t,taskMetas:n,stageConfirm:o,loading:r,setActiveTask:l,pinTask:x,unpinTask:h,loadActiveTasks:u,fetchStageConfirm:c,clearStageConfirm:v,updateTaskMeta:b}=fe(),g=i.useRef(null),[w,y]=i.useState("disconnected"),[I,p]=i.useState("auto"),[j,O]=i.useState(""),S=F(d=>d.lastEvent),U=F(d=>d.status),m=t?n[t]??null:null,Q=m?A.includes(m.status):!1,$=i.useRef(!1);i.useEffect(()=>{!$.current&&m&&(O(m.projectKey),$.current=!0)},[m]);const N=i.useMemo(()=>{const d=a.map(f=>n[f]).filter(Boolean);return j?d.filter(f=>f.projectKey===j):d},[a,n,j]);i.useEffect(()=>{N.length>0&&t&&!N.some(d=>d.id===t)&&l(N[0].id)},[N,t,l]);const E=be();ae(m?`#${m.id} ${m.description}`:null),i.useEffect(()=>{u()},[u]),i.useEffect(()=>{t&&(m==null?void 0:m.status)===k.SUSPENDED?c(t):v()},[t,m==null?void 0:m.status,c,v]),i.useEffect(()=>{if(S){if(S.event==="task_status_changed"){const{taskId:d,status:f}=S;b(d,{status:f}),f===k.SUSPENDED&&d===t&&c(d),A.includes(f)&&d===t&&v()}S.event==="task_created"&&u()}},[S,t,c,v,b,u]),i.useEffect(()=>{if(U==="connected")return;const f=setInterval(()=>{document.visibilityState!=="hidden"&&u()},15e3);return()=>clearInterval(f)},[U,u]);const V=i.useCallback(d=>{x(d),l(d),u()},[x,l,u]),X=i.useCallback(()=>{v(),u()},[v,u]),Y=i.useCallback(()=>{var d;(d=g.current)==null||d.requestTakeover()},[]),ee=i.useCallback(()=>{var d;(d=g.current)==null||d.releaseTakeover()},[]);if(r&&a.length===0)return e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:s("common.loading")})});const te=N.length>0;return e.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsx(je,{projectKey:j,onProjectChange:O,onCreated:V}),e.jsx("div",{className:"flex flex-1 overflow-hidden",children:te?e.jsxs(e.Fragment,{children:[e.jsx(ke,{tasks:N,activeId:t,onSelect:l,onUnpin:h}),e.jsx("div",{className:"flex flex-1 flex-col overflow-hidden",children:m?e.jsxs(e.Fragment,{children:[e.jsx(we,{onboardingData:E}),e.jsx(ye,{task:m,takeoverState:I,onTakeover:Y,onRelease:ee}),o&&t&&e.jsx(ge,{taskId:t,confirm:o,onSubmitted:X}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(ie,{taskId:t,sessionId:m.currentSessionId??void 0,taskFinished:Q,onStatusChange:y,onTakeoverChange:p,ref:g},t)}),e.jsx(Ne,{task:m,ptyStatus:w})]}):e.jsx(B,{onboardingData:E})})]}):e.jsx(B,{onboardingData:E})})]})}export{$e as default};
@@ -0,0 +1 @@
1
+ import{a as C,r as n,j as e,g as w,e as M,w as O,B as k,K as $,I as T,s as K}from"./index-vL7aQJNr.js";import{K as E}from"./key-CxvwwHnW.js";import{C as S}from"./copy-BUH7P2Hf.js";import{E as V}from"./external-link-ChPgQ7N_.js";import{E as B}from"./EmptyState-D3foEiul.js";import{T as P}from"./Skeleton-DUgWc2LJ.js";import{u as W}from"./useFetch-vGZMAvGi.js";import{e as R}from"./status-colors-BPEUp90-.js";import{P as J}from"./plus-Bnd1Vz2Y.js";function z({isOpen:a,onClose:y,onCreated:b}){const{t:s}=C(),[r,c]=n.useState(""),[i,d]=n.useState(!1),[l,v]=n.useState("");function h(){c(""),v(""),y()}async function x(){if(v(""),!r.trim()){v(s("admin.pat_label_required"));return}try{d(!0);const o=await w.post("admin/worker-tokens",{json:{label:r.trim()}}).json();c(""),b({token:o.token,id:o.id})}catch(o){const m=o instanceof Error?o.message:s("admin.pat_failed_to_generate");v(m)}finally{d(!1)}}return a?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},onClick:o=>{o.target===o.currentTarget&&h()},children:e.jsxs("div",{className:"w-full border border-[var(--border)] bg-[var(--bg-card)]",style:{maxWidth:"480px",borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:[e.jsxs("div",{className:"flex items-center gap-2 border-b border-[var(--border)] px-5 py-4",children:[e.jsx(E,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:s("admin.generate_worker_token_title")})]}),e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[l&&e.jsx("div",{className:"border border-[var(--destructive)]/30 bg-[var(--destructive)]/10 px-3 py-2 text-xs text-[var(--destructive)]",style:{borderRadius:"4px"},children:l}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:s("admin.create_one_time_token")}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:s("admin.label")}),e.jsx("input",{type:"text",placeholder:s("admin.pat_label_placeholder"),value:r,onChange:o=>c(o.target.value),className:"w-full border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2 text-sm text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:border-[var(--accent)] focus:outline-none",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},onKeyDown:o=>{o.key==="Enter"&&x()}}),e.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:s("admin.label_identifies_worker")})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-[var(--border)] px-5 py-3",children:[e.jsx("button",{onClick:h,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:s("common.cancel")}),e.jsx("button",{onClick:x,disabled:i,className:"bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-black transition-opacity hover:opacity-80 disabled:opacity-50",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:s(i?"admin.generating":"admin.generate")})]})]})}):null}const X=3e3,q=600*1e3;function G({isOpen:a,token:y,tokenId:b,onClose:s}){const{t:r}=C(),[c,i]=n.useState("command"),[d,l]=n.useState(!1),[v,h]=n.useState(!1),[x,o]=n.useState(""),[m,g]=n.useState(null),p=n.useRef(void 0),N=n.useRef(Date.now()),_=M(),j=typeof window<"u"?window.location.origin:"https://overlord.example.com",t=`overlord setup worker --token ${y} --server ${j}`;async function D(){try{await navigator.clipboard.writeText(y),l(!0),setTimeout(()=>l(!1),2e3)}catch{}}async function L(){try{await navigator.clipboard.writeText(t),h(!0),setTimeout(()=>h(!1),2e3)}catch{}}const A=n.useCallback(async()=>{try{const f=await w.get(`admin/worker-tokens/${b}/status`).json();f.status==="used"&&f.worker_name&&(i("success"),o(f.worker_name),g(f.worker_id??null),p.current&&clearInterval(p.current))}catch{}Date.now()-N.current>q&&(i("timeout"),p.current&&clearInterval(p.current))},[b]);function F(){i("waiting"),N.current=Date.now(),p.current=setInterval(A,X)}n.useEffect(()=>()=>{p.current&&clearInterval(p.current)},[]);function I(){s(),m&&_(`/workers/${m}`)}if(!a)return null;const u={fontFamily:"'JetBrains Mono', monospace",borderRadius:"4px"};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},onClick:f=>{f.target===f.currentTarget&&s()},children:e.jsxs("div",{className:"w-full border border-[var(--border)] bg-[var(--bg-card)]",style:{...u,maxWidth:"480px"},children:[e.jsx("div",{className:"flex items-center gap-2 border-b border-[var(--border)] px-5 py-4",children:c==="success"?e.jsxs(e.Fragment,{children:[e.jsx(O,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:r("admin.worker_registered")})]}):e.jsxs(e.Fragment,{children:[e.jsx(E,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:r("admin.worker_token_generated")})]})}),e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[c!=="success"&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("admin.run_command_desc")}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[11px] text-[var(--text-muted)]",children:"Token"}),e.jsxs("div",{className:"relative border border-[var(--border)] bg-[var(--bg-card)] p-3",style:{borderRadius:"4px"},children:[e.jsx("code",{className:"block break-all pr-20 text-xs text-[var(--text-primary)]",children:y}),e.jsx("button",{onClick:D,className:"absolute right-2 top-2 flex items-center gap-1 border border-[var(--border)] bg-transparent px-2 py-1 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:u,children:d?e.jsx("span",{className:"text-[var(--accent)]",children:r("common.copied")}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(S,{className:"h-3 w-3"})," ",r("common.copy")]})})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[11px] text-[var(--text-muted)]",children:r("admin.setup_command")}),e.jsxs("div",{className:"relative border border-[var(--border)] bg-[var(--bg-card)] p-3",style:{borderRadius:"4px"},children:[e.jsxs("code",{className:"block break-all pr-20 text-xs text-[var(--accent)]",children:["$ ",t]}),e.jsx("button",{onClick:L,className:"absolute right-2 top-2 flex items-center gap-1 border border-[var(--border)] bg-transparent px-2 py-1 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:u,children:v?e.jsx("span",{className:"text-[var(--accent)]",children:r("common.copied")}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(S,{className:"h-3 w-3"})," ",r("common.copy")]})})]})]}),e.jsx("div",{className:"border border-yellow-500/30 bg-yellow-500/10 px-3 py-2 text-xs text-yellow-400",style:{borderRadius:"4px"},children:r("admin.token_shown_once")})]}),c==="waiting"&&e.jsxs("div",{className:"flex items-center gap-3 border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3",style:{borderRadius:"4px"},children:[e.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-[var(--accent)] border-t-transparent"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:r("admin.waiting_for_worker")})]}),c==="timeout"&&e.jsx("div",{className:"border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3 text-xs text-[var(--text-muted)]",style:{borderRadius:"4px"},children:r("admin.token_not_yet_used")}),c==="success"&&e.jsxs("div",{className:"border border-[var(--accent)]/30 bg-[var(--accent)]/10 px-4 py-3",style:{borderRadius:"4px"},children:[e.jsx("p",{className:"text-xs text-[var(--accent)]",children:r("admin.worker_registered_success")}),e.jsxs("p",{className:"mt-1 text-xs text-[var(--text-primary)]",children:[r("admin.worker"),": ",e.jsx("span",{className:"text-[var(--accent)]",children:x})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-[var(--border)] px-5 py-3",children:[c==="command"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:u,children:r("common.close")}),e.jsx("button",{onClick:F,className:"bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-black transition-opacity hover:opacity-80",style:u,children:r("admin.copied_wait_for_worker")})]}),c==="waiting"&&e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:u,children:r("admin.close_worker_can_register")}),c==="timeout"&&e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:u,children:r("common.close")}),c==="success"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:u,children:r("common.close")}),e.jsxs("button",{onClick:I,className:"flex items-center gap-1.5 bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-black transition-opacity hover:opacity-80",style:u,children:[e.jsx(V,{className:"h-3 w-3"}),r("admin.view_worker")]})]})]})]})})}function se(){const{t:a}=C(),[y,b]=n.useState(!1),[s,r]=n.useState(null),[c,i]=n.useState(!1),[d,l]=n.useState(null),[v,h]=n.useState(!1),[x,o]=n.useState(!1),{data:m,loading:g,refetch:p}=W(()=>w.get("admin/worker-tokens").json(),[]);async function N(){if(d){h(!0);try{await w.post(`admin/worker-tokens/${d.id}/revoke`),i(!1),l(null),p()}catch{}finally{h(!1)}}}function _(t){b(!1),r(t),p()}const j=n.useMemo(()=>(m??[]).filter(t=>x||t.status!==k.REVOKED),[m,x]);return e.jsxs("div",{className:"font-mono",children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:a("admin.tokens_title")}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:a("admin.tokens_subtitle")})]}),e.jsxs("button",{type:"button",className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity",onClick:()=>b(!0),children:[e.jsx(J,{className:"h-3.5 w-3.5"}),a("admin.generate_token")]})]}),!g&&(m==null?void 0:m.some(t=>t.status===k.REVOKED))&&e.jsx("div",{className:"mb-4 flex items-center gap-2",children:e.jsx("button",{type:"button",onClick:()=>o(!x),className:`text-xs transition-colors ${x?"text-[var(--text-primary)]":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:a(x?"admin.hide_revoked":"admin.show_revoked")})}),g?e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsx(P,{rows:3})}):j.length===0?e.jsx(B,{icon:$,title:a("admin.no_worker_tokens"),description:a("admin.generate_token_desc"),actionLabel:a("admin.generate_token"),onAction:()=>b(!0)}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden md:block overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] text-left text-[var(--text-muted)]",children:[e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.label")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.purpose")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.status")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("common.created_at")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.expires_at")}),e.jsx("th",{className:"pb-2 font-normal",children:a("common.actions")})]})}),e.jsx("tbody",{children:j.map(t=>e.jsxs("tr",{className:"border-b border-[var(--border-row)] hover:bg-white/[0.02] transition-colors",children:[e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-primary)]",children:t.label}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:t.purpose}),e.jsx("td",{className:"py-2.5 pr-4",children:e.jsx("span",{className:R(t.status),children:t.status})}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-muted)]",children:new Date(t.createdAt).toLocaleDateString()}),e.jsx("td",{className:"py-2.5 pr-4",children:t.expiresAt?e.jsx("span",{className:"text-[var(--text-secondary)]",children:new Date(t.expiresAt).toLocaleDateString()}):e.jsx("span",{className:"text-[var(--text-muted)]",children:"—"})}),e.jsx("td",{className:"py-2.5",children:t.status===k.ACTIVE&&e.jsxs("button",{type:"button",className:"flex items-center gap-1 rounded-[4px] px-2 py-1 text-red-400 hover:text-red-300 hover:bg-white/[0.05] transition-colors",onClick:()=>{l(t),i(!0)},children:[e.jsx(T,{className:"h-3.5 w-3.5"}),a("admin.revoke")]})})]},t.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3",children:j.map(t=>e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-xs text-[var(--text-primary)] font-medium truncate mr-2",children:t.label}),e.jsx("span",{className:`text-[11px] shrink-0 ${R(t.status)}`,children:t.status})]}),e.jsx("div",{className:"text-[11px] text-[var(--text-secondary)] truncate mb-1",children:t.purpose}),e.jsxs("div",{className:"flex items-center justify-between text-[11px] text-[var(--text-muted)]",children:[e.jsx("span",{children:new Date(t.createdAt).toLocaleDateString()}),t.expiresAt&&e.jsx("span",{children:new Date(t.expiresAt).toLocaleDateString()})]}),t.status===k.ACTIVE&&e.jsx("div",{className:"mt-2 pt-2 border-t border-[var(--border)]",children:e.jsxs("button",{type:"button",className:"flex items-center gap-1 rounded-[4px] px-2 py-1 text-[11px] text-red-400 hover:text-red-300 hover:bg-white/[0.05] transition-colors",onClick:()=>{l(t),i(!0)},children:[e.jsx(T,{className:"h-3.5 w-3.5"}),a("admin.revoke")]})})]},t.id))})]}),e.jsx(z,{isOpen:y,onClose:()=>b(!1),onCreated:_}),s&&e.jsx(G,{isOpen:!!s,token:s.token,tokenId:s.id,onClose:()=>r(null)}),e.jsx(K,{isOpen:c,onClose:()=>{i(!1),l(null)},onConfirm:N,title:a("admin.revoke_token"),message:a("admin.revoke_token_confirm",{label:(d==null?void 0:d.label)??""}),confirmLabel:a("admin.revoke"),confirmVariant:"danger",isLoading:v})]})}export{se as default};