@overlordai/server 1.0.144 → 1.0.145

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 (226) hide show
  1. package/database/migrations/014-automations.sql +67 -0
  2. package/dist/adapters/command-parser.utils.d.ts +1 -0
  3. package/dist/adapters/command-parser.utils.d.ts.map +1 -1
  4. package/dist/adapters/command-parser.utils.js +14 -1
  5. package/dist/adapters/command-parser.utils.js.map +1 -1
  6. package/dist/adapters/help-text.d.ts.map +1 -1
  7. package/dist/adapters/help-text.js +2 -1
  8. package/dist/adapters/help-text.js.map +1 -1
  9. package/dist/adapters/nlu.service.d.ts.map +1 -1
  10. package/dist/adapters/nlu.service.js +4 -1
  11. package/dist/adapters/nlu.service.js.map +1 -1
  12. package/dist/app.module.d.ts.map +1 -1
  13. package/dist/app.module.js +2 -0
  14. package/dist/app.module.js.map +1 -1
  15. package/dist/automation/automation-executor.d.ts +23 -0
  16. package/dist/automation/automation-executor.d.ts.map +1 -0
  17. package/dist/automation/automation-executor.js +365 -0
  18. package/dist/automation/automation-executor.js.map +1 -0
  19. package/dist/automation/automation-scheduler.d.ts +21 -0
  20. package/dist/automation/automation-scheduler.d.ts.map +1 -0
  21. package/dist/automation/automation-scheduler.js +124 -0
  22. package/dist/automation/automation-scheduler.js.map +1 -0
  23. package/dist/automation/automation-template.service.d.ts +30 -0
  24. package/dist/automation/automation-template.service.d.ts.map +1 -0
  25. package/dist/automation/automation-template.service.js +66 -0
  26. package/dist/automation/automation-template.service.js.map +1 -0
  27. package/dist/automation/automation-trigger.d.ts +13 -0
  28. package/dist/automation/automation-trigger.d.ts.map +1 -0
  29. package/dist/automation/automation-trigger.js +96 -0
  30. package/dist/automation/automation-trigger.js.map +1 -0
  31. package/dist/automation/automation-validation.d.ts +14 -0
  32. package/dist/automation/automation-validation.d.ts.map +1 -0
  33. package/dist/automation/automation-validation.js +66 -0
  34. package/dist/automation/automation-validation.js.map +1 -0
  35. package/dist/automation/automation.module.d.ts +3 -0
  36. package/dist/automation/automation.module.d.ts.map +1 -0
  37. package/dist/automation/automation.module.js +33 -0
  38. package/dist/automation/automation.module.js.map +1 -0
  39. package/dist/automation/automation.service.d.ts +22 -0
  40. package/dist/automation/automation.service.d.ts.map +1 -0
  41. package/dist/automation/automation.service.js +232 -0
  42. package/dist/automation/automation.service.js.map +1 -0
  43. package/dist/database/repositories/automation.repository.d.ts +87 -0
  44. package/dist/database/repositories/automation.repository.d.ts.map +1 -0
  45. package/dist/database/repositories/automation.repository.js +531 -0
  46. package/dist/database/repositories/automation.repository.js.map +1 -0
  47. package/dist/database/repositories/task.repository.d.ts +1 -0
  48. package/dist/database/repositories/task.repository.d.ts.map +1 -1
  49. package/dist/database/repositories/task.repository.js +4 -2
  50. package/dist/database/repositories/task.repository.js.map +1 -1
  51. package/dist/database/repository.module.d.ts.map +1 -1
  52. package/dist/database/repository.module.js +2 -0
  53. package/dist/database/repository.module.js.map +1 -1
  54. package/dist/dispatcher/dispatcher.service.d.ts.map +1 -1
  55. package/dist/dispatcher/dispatcher.service.js +1 -0
  56. package/dist/dispatcher/dispatcher.service.js.map +1 -1
  57. package/dist/dispatcher/task-creation.service.d.ts +3 -3
  58. package/dist/dispatcher/task-creation.service.d.ts.map +1 -1
  59. package/dist/dispatcher/task-creation.service.js +14 -5
  60. package/dist/dispatcher/task-creation.service.js.map +1 -1
  61. package/dist/events/event-types.d.ts +31 -0
  62. package/dist/events/event-types.d.ts.map +1 -1
  63. package/dist/events/event-types.js +4 -0
  64. package/dist/events/event-types.js.map +1 -1
  65. package/dist/notifier/notification-consumer.d.ts.map +1 -1
  66. package/dist/notifier/notification-consumer.js +65 -1
  67. package/dist/notifier/notification-consumer.js.map +1 -1
  68. package/dist/notifier/notification-event-listener.d.ts +7 -2
  69. package/dist/notifier/notification-event-listener.d.ts.map +1 -1
  70. package/dist/notifier/notification-event-listener.js +56 -2
  71. package/dist/notifier/notification-event-listener.js.map +1 -1
  72. package/dist/notifier/notifier.service.d.ts +4 -1
  73. package/dist/notifier/notifier.service.d.ts.map +1 -1
  74. package/dist/notifier/notifier.service.js +23 -2
  75. package/dist/notifier/notifier.service.js.map +1 -1
  76. package/dist/notifier/template.service.d.ts +1 -1
  77. package/dist/notifier/template.service.d.ts.map +1 -1
  78. package/dist/notifier/template.service.js +14 -4
  79. package/dist/notifier/template.service.js.map +1 -1
  80. package/dist/web/automation.controller.d.ts +74 -0
  81. package/dist/web/automation.controller.d.ts.map +1 -0
  82. package/dist/web/automation.controller.js +539 -0
  83. package/dist/web/automation.controller.js.map +1 -0
  84. package/dist/web/frame-handlers/automation-report.handler.d.ts +10 -0
  85. package/dist/web/frame-handlers/automation-report.handler.d.ts.map +1 -0
  86. package/dist/web/frame-handlers/automation-report.handler.js +15 -0
  87. package/dist/web/frame-handlers/automation-report.handler.js.map +1 -0
  88. package/dist/web/frame-handlers/index.d.ts +1 -0
  89. package/dist/web/frame-handlers/index.d.ts.map +1 -1
  90. package/dist/web/frame-handlers/index.js +3 -1
  91. package/dist/web/frame-handlers/index.js.map +1 -1
  92. package/dist/web/frame-handlers/stage-confirm.handler.d.ts.map +1 -1
  93. package/dist/web/frame-handlers/stage-confirm.handler.js +1 -1
  94. package/dist/web/frame-handlers/stage-confirm.handler.js.map +1 -1
  95. package/dist/web/task.controller.d.ts +3 -0
  96. package/dist/web/task.controller.d.ts.map +1 -1
  97. package/dist/web/web-event.service.d.ts +20 -1
  98. package/dist/web/web-event.service.d.ts.map +1 -1
  99. package/dist/web/web-event.service.js +66 -2
  100. package/dist/web/web-event.service.js.map +1 -1
  101. package/dist/web/web.module.d.ts.map +1 -1
  102. package/dist/web/web.module.js +4 -1
  103. package/dist/web/web.module.js.map +1 -1
  104. package/dist/web/worker-channel.gateway.d.ts +2 -1
  105. package/dist/web/worker-channel.gateway.d.ts.map +1 -1
  106. package/dist/web/worker-channel.gateway.js +5 -2
  107. package/dist/web/worker-channel.gateway.js.map +1 -1
  108. package/package.json +5 -4
  109. package/public/assets/AccessTokensPage-BYuGmkhG.js +1 -0
  110. package/public/assets/{AdminPage-OHTVG-ck.js → AdminPage-BResRWph.js} +1 -1
  111. package/public/assets/{AgentCliPage-BsZmnI3p.js → AgentCliPage-BcDXV12E.js} +1 -1
  112. package/public/assets/{ApiReferencePage-8yiImnYs.js → ApiReferencePage-NaJYMeTA.js} +1 -1
  113. package/public/assets/{ArchitecturePage-Deswgqy2.js → ArchitecturePage-D-0d-kgA.js} +1 -1
  114. package/public/assets/{AuditLogPage-Hn4ivp8Y.js → AuditLogPage-BuiWgzsv.js} +1 -1
  115. package/public/assets/AutomationCreatePage-CbGNlXYx.js +1 -0
  116. package/public/assets/AutomationDetailPage-C8GfVtsX.js +16 -0
  117. package/public/assets/AutomationEditPage-C7hl6YxI.js +1 -0
  118. package/public/assets/AutomationListPage-sjxnTqLB.js +16 -0
  119. package/public/assets/AutomationRunDetailPage-DYpv-WBg.js +6 -0
  120. package/public/assets/{BindPlatformPage-DjGHKswB.js → BindPlatformPage-DS1eO2Me.js} +1 -1
  121. package/public/assets/BotIntegrationPage-DW13UERh.js +1 -0
  122. package/public/assets/{BotManage-Dss1Y_jv.js → BotManage-CW08edmX.js} +2 -2
  123. package/public/assets/{BotSetupPage-C_KKFdu3.js → BotSetupPage-B2TIppqV.js} +2 -2
  124. package/public/assets/{ChangelogPage-5btaAfls.js → ChangelogPage-BpJdCfIe.js} +1 -1
  125. package/public/assets/{CliReferencePage--yAuXfNl.js → CliReferencePage-wbYT0YSP.js} +1 -1
  126. package/public/assets/ConfirmStageDialog-Bke18NAb.js +7 -0
  127. package/public/assets/{DeploymentPage-Qi860C4T.js → DeploymentPage-DqYVYlM2.js} +1 -1
  128. package/public/assets/{DevWorkflowPage-CZks72g2.js → DevWorkflowPage-B1T1aB-L.js} +1 -1
  129. package/public/assets/DeveloperManage-CwH2nj3C.js +16 -0
  130. package/public/assets/{DeveloperSetupPage-CSs2Mh7c.js → DeveloperSetupPage-B099stPW.js} +1 -1
  131. package/public/assets/{DocsIndexPage-BmSMwLvO.js → DocsIndexPage-BQJNEB0T.js} +1 -1
  132. package/public/assets/{DocsLayout-CunlDzH9.js → DocsLayout-VgiIORoW.js} +1 -1
  133. package/public/assets/{DocsPrimitives-Bqnk0mEW.js → DocsPrimitives-DStFX1T8.js} +1 -1
  134. package/public/assets/{EditProjectPage-CJAdaxRE.js → EditProjectPage-CSv1LQ0c.js} +2 -2
  135. package/public/assets/{EmptyState-DpRw-xch.js → EmptyState-CM34MS8q.js} +1 -1
  136. package/public/assets/{EnvVariablesPage-DWD4RzmX.js → EnvVariablesPage-By_n8jC_.js} +2 -2
  137. package/public/assets/{HomePage-oShWGYcN.js → HomePage-BA8S5QIk.js} +1 -1
  138. package/public/assets/{InfoRow-CTXIPrG6.js → InfoRow-BkLVrW3X.js} +1 -1
  139. package/public/assets/{InstallationPage-BgbU06Ei.js → InstallationPage-5aHtmv3w.js} +1 -1
  140. package/public/assets/{LandingPage-C-s-hSgz.js → LandingPage-XfW3mTgR.js} +7 -12
  141. package/public/assets/{LocalDevelopmentPage-Cg4FYaCn.js → LocalDevelopmentPage-CEhJ10RY.js} +1 -1
  142. package/public/assets/{LoginPage-BhyQxY5d.js → LoginPage-hEkjuwQp.js} +1 -1
  143. package/public/assets/{MetricBar-DZOZStDZ.js → MetricBar-CuVoQPXf.js} +1 -1
  144. package/public/assets/{NotFoundPage-DaeTOzAm.js → NotFoundPage-CDaJI7W_.js} +1 -1
  145. package/public/assets/{OnboardingGuide-DGH0Yfsj.js → OnboardingGuide-xLqRqP0t.js} +1 -1
  146. package/public/assets/{PermissionsPage-D4Lqb40x.js → PermissionsPage-BGlc6yU2.js} +1 -1
  147. package/public/assets/{PipelineConfigPage-CAWpyPiY.js → PipelineConfigPage-Bzm1MeK0.js} +1 -1
  148. package/public/assets/{PipelineEditorPage-BLDxO49P.js → PipelineEditorPage-DhS-VBVt.js} +2 -2
  149. package/public/assets/{PlanPage-UX5QUlvv.js → PlanPage-Mu6msPek.js} +1 -1
  150. package/public/assets/{ProfilePage-B73YqnCd.js → ProfilePage-Dk-XPfIf.js} +1 -1
  151. package/public/assets/{ProjectDetailPage-eNAn85vT.js → ProjectDetailPage-C8v5ztXD.js} +3 -3
  152. package/public/assets/ProjectListPage-Ccrl3DtV.js +6 -0
  153. package/public/assets/PtyTerminal-DCbNmuIT.js +38 -0
  154. package/public/assets/{QuickAuth-DSSMYJEC.js → QuickAuth-DAPeXfQS.js} +1 -1
  155. package/public/assets/RemoveMemberConfirmDialog-gr2WUWrR.js +6 -0
  156. package/public/assets/ReviewAggregatePage-B1SB4rXq.js +6 -0
  157. package/public/assets/{ReviewPage-BNa6T3xv.js → ReviewPage-Bde6YvIA.js} +1 -1
  158. package/public/assets/{Select-FmuTJbfh.js → Select-Bxil-UGQ.js} +1 -1
  159. package/public/assets/{SettingsPage-aSrpn6Ta.js → SettingsPage-nA4hlLlN.js} +1 -1
  160. package/public/assets/{Skeleton-Bo0DEIHn.js → Skeleton-DMVGjH__.js} +1 -1
  161. package/public/assets/{SkillPage-BjiQKd7n.js → SkillPage-BqTTImpe.js} +1 -1
  162. package/public/assets/{TaskDetailPage-BLNjDqnY.js → TaskDetailPage-DPdD57PF.js} +2 -2
  163. package/public/assets/{TaskGuidePage-C5o7i2D0.js → TaskGuidePage-CQAlhXHL.js} +1 -1
  164. package/public/assets/TaskListPage-C5tAOuSG.js +1 -0
  165. package/public/assets/{TaskStatusBadge-CD8sO9C_.js → TaskStatusBadge-D5lVjwey.js} +1 -1
  166. package/public/assets/TerminalHomePage-BX-sHKXF.js +6 -0
  167. package/public/assets/TokenManage-95LL4o8y.js +1 -0
  168. package/public/assets/{Tooltip-BKRBwA7o.js → Tooltip-3_9w-Oet.js} +1 -1
  169. package/public/assets/{TotpSetupPage-IVkRIgKh.js → TotpSetupPage-BzyS9OrP.js} +1 -1
  170. package/public/assets/{WorkerDetailPage-nw_gzQ45.js → WorkerDetailPage-BaVeVMvg.js} +1 -1
  171. package/public/assets/WorkerListPage-zOEHoOtr.js +6 -0
  172. package/public/assets/{WorkerOperationsPage-Clh8jDGG.js → WorkerOperationsPage-B9A7kFhI.js} +1 -1
  173. package/public/assets/{WorkerSetupGuidePage-C1wXY1wd.js → WorkerSetupGuidePage-DzTffG6n.js} +1 -1
  174. package/public/assets/{WorkerSetupPage-CTCwHKaC.js → WorkerSetupPage-B28GH43r.js} +1 -1
  175. package/public/assets/{agent-type-options-5v4PgZnP.js → agent-type-options-BBcV6_LY.js} +1 -1
  176. package/public/assets/{arrow-left-CR_n40mK.js → arrow-left-BDjYIP3Y.js} +1 -1
  177. package/public/assets/{arrow-right-D-j7nSgI.js → arrow-right-DITZLrUG.js} +1 -1
  178. package/public/assets/{bot--DUOKBmv.js → bot-CJ6g-CgU.js} +1 -1
  179. package/public/assets/{chevron-down-CDFiGGBG.js → chevron-down-D9VkxIPs.js} +1 -1
  180. package/public/assets/{chevron-left-C_lJcnCg.js → chevron-left-CWC7W_zG.js} +1 -1
  181. package/public/assets/{chevron-right-IZlTWMcO.js → chevron-right-BDlNEjPF.js} +1 -1
  182. package/public/assets/{chevron-up-DSOCVgRW.js → chevron-up-B2_M0Aou.js} +1 -1
  183. package/public/assets/circle-alert-Cb6RgYCQ.js +6 -0
  184. package/public/assets/clock-CPiGRQpX.js +6 -0
  185. package/public/assets/{copy-2UMMaHKT.js → copy-Dz9BK4cr.js} +1 -1
  186. package/public/assets/{download-D2NyL1OR.js → download-qgK3DePm.js} +1 -1
  187. package/public/assets/{external-link-B9CWNSMc.js → external-link-kSTql_zg.js} +1 -1
  188. package/public/assets/{file-text-COzaNu8e.js → file-text-moi4pXOm.js} +1 -1
  189. package/public/assets/{git-fork-9KuFRmam.js → git-fork-FS4LqWZJ.js} +1 -1
  190. package/public/assets/index-CdJk2QGi.css +1 -0
  191. package/public/assets/index-DEBRwDiX.js +257 -0
  192. package/public/assets/{key-DoJm5thS.js → key-CHc_t6rY.js} +1 -1
  193. package/public/assets/{loader-circle-B5SLmhRr.js → loader-circle-BEHOzbAc.js} +1 -1
  194. package/public/assets/{pencil-C_niWuAb.js → pencil-COk9Cf4n.js} +1 -1
  195. package/public/assets/{play-Do-8kkck.js → play-B8L-TpIA.js} +1 -1
  196. package/public/assets/{plus-C8aSzgHN.js → plus-Bh23dSc7.js} +1 -1
  197. package/public/assets/{rotate-ccw-BSPzJeCn.js → rotate-ccw-CumxDFOW.js} +1 -1
  198. package/public/assets/{scroll-text-DdqU_dT6.js → scroll-text-yKGiDEH2.js} +1 -1
  199. package/public/assets/{settings-C8PB6BpE.js → settings-BZ99cVpB.js} +1 -1
  200. package/public/assets/{skip-forward-CEuvYtQc.js → skip-forward-YMw2gv4i.js} +1 -1
  201. package/public/assets/{status-colors-0U8b2F2t.js → status-colors-CpxhEwhO.js} +1 -1
  202. package/public/assets/{task-constants-DTDx5Lfp.js → task-constants-BOIiRs7J.js} +1 -1
  203. package/public/assets/{task.store-CGgehOLp.js → task.store-B7v0IyXP.js} +1 -1
  204. package/public/assets/timer--KEJmHJk.js +6 -0
  205. package/public/assets/{trash-2-tEkzRo6q.js → trash-2-CGFhXY_R.js} +1 -1
  206. package/public/assets/{useFetch-CJDmNhIT.js → useFetch-_325GIxD.js} +1 -1
  207. package/public/assets/{users-Cs2w_uVo.js → users-0IqI-VRX.js} +1 -1
  208. package/public/assets/{wifi-BCoKY35p.js → wifi-DveQJnOv.js} +1 -1
  209. package/public/assets/{workflow-BLCy8gMf.js → workflow-BUUDFa4R.js} +1 -1
  210. package/public/assets/zap-D2T18qt7.js +6 -0
  211. package/public/index.html +2 -2
  212. package/public/sw.js +1 -1
  213. package/public/assets/AccessTokensPage-zuZElOFy.js +0 -1
  214. package/public/assets/BotIntegrationPage-58cLGS0T.js +0 -1
  215. package/public/assets/ConfirmStageDialog-BatYNr9r.js +0 -12
  216. package/public/assets/DeveloperManage-7tpVdYUx.js +0 -16
  217. package/public/assets/ProjectListPage-61CMBaxl.js +0 -6
  218. package/public/assets/PtyTerminal-DOgYXCFD.js +0 -38
  219. package/public/assets/RemoveMemberConfirmDialog-MiS_sqor.js +0 -6
  220. package/public/assets/ReviewAggregatePage-LBAVcz2T.js +0 -11
  221. package/public/assets/TaskListPage-26QNdjqP.js +0 -1
  222. package/public/assets/TerminalHomePage-DBhs1WQJ.js +0 -6
  223. package/public/assets/TokenManage-BQ0e_d4e.js +0 -1
  224. package/public/assets/WorkerListPage-CF1x84G-.js +0 -6
  225. package/public/assets/index-DvdpkDlU.js +0 -252
  226. package/public/assets/index-kJfGgL_V.css +0 -1
@@ -1,6 +0,0 @@
1
- import{c as w,a as _,r as s,Y as l,j as e,X as R,h as g,s as C}from"./index-DvdpkDlU.js";import{S as N}from"./Select-FmuTJbfh.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 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};
@@ -1,11 +0,0 @@
1
- import{c as B,z as de,f as me,a as H,k as pe,r as n,h as L,j as e,L as ue,Q as W,V as ve,t as f,o as v,b as be,O as ge,X as he}from"./index-DvdpkDlU.js";import{P as fe}from"./PtyTerminal-DOgYXCFD.js";import{T as je}from"./Skeleton-Bo0DEIHn.js";import{f as ye,b as Ne}from"./date-RFA7-ZGs.js";import{a as we}from"./agent-type-options-5v4PgZnP.js";import{T as G,g as q}from"./task-constants-DTDx5Lfp.js";import{A as ke}from"./arrow-left-CR_n40mK.js";import{L as Se}from"./loader-circle-B5SLmhRr.js";import{P as z}from"./play-Do-8kkck.js";import{S as Ce}from"./skip-forward-CEuvYtQc.js";import{R as Te}from"./rotate-ccw-BSPzJeCn.js";import{C as Ae}from"./chevron-up-DSOCVgRW.js";import{C as Ee}from"./chevron-down-CDFiGGBG.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 Re=B("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
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 De=B("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]),Y={critical:0,warning:1,suggestion:2};function Ie(s){switch(s){case"critical":return{text:"text-[var(--destructive)]",bg:"rgba(239,68,68,0.12)",border:"rgba(239,68,68,0.27)"};case"warning":return{text:"text-[var(--warning)]",bg:"rgba(245,158,11,0.12)",border:"rgba(245,158,11,0.27)"};default:return{text:"text-[var(--info)]",bg:"rgba(59,130,246,0.10)",border:"rgba(59,130,246,0.27)"}}}function Le({severity:s}){return s==="critical"?e.jsx(Re,{className:"h-3.5 w-3.5 text-[var(--destructive)]"}):s==="warning"?e.jsx(W,{className:"h-3.5 w-3.5 text-[var(--warning)]"}):e.jsx(De,{className:"h-3.5 w-3.5 text-[var(--info)]"})}function _e(s){switch(s){case v.RUNNING:return"bg-[var(--accent)]";case v.QUEUED:case v.ASSIGNED:case v.SUSPENDED:return"bg-[var(--warning)]";case v.COMPLETED:return"bg-[var(--accent)]";case v.FAILED:return"bg-[var(--destructive)]";default:return"bg-[#525252]"}}function Z(s){return s===v.RUNNING||s===v.QUEUED||s===v.ASSIGNED}function O(s){return s===v.SUSPENDED}const $e=we(q);function Pe({task:s,expanded:l,onToggleExpand:r}){const b=q(s.agentType),x=_e(s.status),o=Ne(s.startedAt,s.completedAt??void 0),j=Z(s.status),g=G.includes(s.status),N=n.useRef(null);return e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsxs("div",{className:"flex cursor-pointer items-center gap-3 px-4 py-3 hover:bg-[var(--bg-input)] transition-colors",onClick:r,children:[e.jsx("span",{className:`h-2 w-2 shrink-0 rounded-full ${x} ${j?"animate-pulse":""}`}),e.jsx("span",{className:"flex-1 text-xs font-medium text-[var(--text-primary)]",children:b}),e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:[j?`${s.status.toLowerCase()}...`:s.status.toLowerCase(),o&&` · ${o}`]}),e.jsxs("a",{href:`/tasks/${s.id}`,target:"_blank",rel:"noopener noreferrer",onClick:w=>w.stopPropagation(),className:"rounded-[4px] border border-[var(--border)] px-2 py-1 text-[11px] text-[var(--text-muted)] hover:text-[var(--accent)] hover:border-[var(--accent)] transition-colors flex items-center gap-1",children:[e.jsx(be,{className:"h-3 w-3"}),"↗"]}),l?e.jsx(Ae,{className:"h-3.5 w-3.5 text-[var(--text-muted)]"}):e.jsx(Ee,{className:"h-3.5 w-3.5 text-[var(--text-muted)]"})]}),l&&e.jsx("div",{className:"border-t border-[var(--border)]",style:{height:"300px"},children:e.jsx(fe,{ref:N,taskId:s.id,sessionId:s.currentSessionId??void 0,taskFinished:g})})]})}function Fe({issue:s}){const l=Ie(s.severity);return e.jsxs("div",{className:`rounded-[4px] p-3 text-xs ${s.isDuplicate?"opacity-60":""}`,style:{backgroundColor:l.bg,border:`1px solid ${l.border}`},children:[e.jsxs("div",{className:"mb-1 flex items-center gap-2",children:[e.jsx(Le,{severity:s.severity}),e.jsx("span",{className:`font-bold ${l.text}`,children:s.severity}),s.agentType&&e.jsx("span",{className:"rounded-[4px] border border-[var(--border)] px-1.5 py-0.5 text-[10px] text-[var(--text-muted)]",children:s.agentType}),e.jsxs("span",{className:"text-[var(--text-muted)]",children:[s.file,s.line!=null?`:${s.line}`:""]}),s.isDuplicate&&e.jsx("span",{className:"rounded-[4px] border border-[var(--border)] px-1.5 py-0.5 text-[10px] text-[var(--text-muted)]",children:"duplicate"})]}),e.jsx("p",{className:"mb-1 text-[var(--text-secondary)]",children:s.description}),s.suggestion&&e.jsxs("p",{className:"text-[var(--text-muted)]",children:[e.jsx("span",{className:"font-medium",children:"suggestion:"})," ",s.suggestion]})]})}function Ue({sourceTaskId:s,defaultReviewers:l,onClose:r,onLaunched:b}){const{t:x}=H(),o=l.length>0?l:[ge.CLAUDE],j=l.length>0,[g,N]=n.useState(o),[w,_]=n.useState(""),[y,$]=n.useState(!1),[C,T]=n.useState(!1);function R(c){N(u=>u.includes(c)?u.filter(P=>P!==c):[...u,c])}async function D(){if(g.length===0){f.error("select at least one review agent.");return}T(!0);try{await L.post(`web/tasks/${s}/review`,{json:{agentTypes:g,description:w.trim()||void 0,skipFix:y||void 0}}),f.success("review launched"),b(),r()}catch(c){const u=c instanceof Error?c.message:String(c);f.error(u)}finally{T(!1)}}return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",children:e.jsxs("div",{className:"w-full max-w-sm rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5 font-mono",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-bold text-[var(--text-primary)]",children:x("review.review_again")}),e.jsx("button",{onClick:r,className:"text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:e.jsx(he,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:x("review.select_agents")}),j&&e.jsx("span",{className:"rounded-[4px] border border-amber-500/40 bg-amber-500/10 px-1.5 py-0.5 text-[10px] text-amber-500",children:"using project defaults"})]}),e.jsx("div",{className:"mb-4 flex flex-col gap-2",children:$e.map(c=>e.jsxs("label",{className:"flex cursor-pointer items-center gap-2.5 rounded-[4px] border border-[var(--border)] px-3 py-2 text-xs hover:bg-[var(--bg-input)] transition-colors",children:[e.jsx("input",{type:"checkbox",checked:g.includes(c.value),onChange:()=>R(c.value),className:"h-3.5 w-3.5 accent-[var(--accent)]"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:c.label})]},c.value))}),e.jsx("textarea",{value:w,onChange:c=>_(c.target.value),placeholder:x("review.description_placeholder"),rows:3,className:"mb-3 w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)] resize-none"}),e.jsxs("label",{className:"mb-4 flex cursor-pointer items-center gap-2.5 rounded-[4px] border border-[var(--border)] px-3 py-2 text-xs hover:bg-[var(--bg-input)] transition-colors",children:[e.jsx("input",{type:"checkbox",checked:y,onChange:c=>$(c.target.checked),className:"h-3.5 w-3.5 accent-[var(--accent)]"}),e.jsx("span",{className:"text-[var(--text-muted)]",children:x("review.skip_fix_label")})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:D,disabled:C||g.length===0,className:"flex flex-1 items-center justify-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs font-bold text-black disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(z,{className:"h-3 w-3"}),x(C?"common.processing":"review.launch")]}),e.jsx("button",{onClick:r,className:"rounded-[4px] border border-[var(--border)] px-4 py-2 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:x("common.cancel")})]})]})})}function We(){var K;const{sourceTaskId:s}=de(),l=me(),{t:r}=H(),b=Number(s),x=pe(t=>t.eventSeq),[o,j]=n.useState(null),[g,N]=n.useState(!0),[w,_]=n.useState(new Set),[y,$]=n.useState(""),[C,T]=n.useState(!1),[R,D]=n.useState(!1),[c,u]=n.useState(!1),[P,Q]=n.useState(null),k=n.useCallback(async()=>{try{const t=await L.get(`web/tasks/${b}/reviews`).json();j(t),t.rounds&&t.rounds.length>0&&Q(a=>a??t.rounds[t.rounds.length-1].round)}catch{j(null)}finally{N(!1)}},[b]);n.useEffect(()=>{N(!0),k()},[k]),n.useEffect(()=>{x>0&&k()},[x,k]);const ee=n.useCallback(t=>{_(a=>{const d=new Set(a);return d.has(t)?d.delete(t):d.add(t),d})},[]),S=(o==null?void 0:o.rounds)??[],F=S.length>0?S[S.length-1].round:null,h=P??F,U=S.find(t=>t.round===h),i=(U==null?void 0:U.reviewTasks)??(o==null?void 0:o.reviewTasks)??[];i.some(t=>Z(t.status));const I=i.some(t=>O(t.status)),M=i.length>0&&i.every(t=>G.includes(t.status)),te=i.some(t=>t.report!=null),se=i.length>0&&i.every(t=>t.report!=null),V=h===F,re=I||M,A=n.useMemo(()=>{var d;const t=[];for(const p of i)if((d=p.report)!=null&&d.issues)for(const E of p.report.issues)t.push({...E,agentType:p.agentType??"claude"});t.sort((p,E)=>(Y[p.severity]??9)-(Y[E.severity]??9));const a=new Set;return t.map(p=>{const E=p.description.slice(0,20),X=`${p.file}:${p.line??""}:${E}`;return a.has(X)?{...p,isDuplicate:!0}:(a.add(X),p)})},[i]),ae=A.filter(t=>t.severity==="critical").length,ne=A.filter(t=>t.severity==="warning").length,oe=A.filter(t=>t.severity==="suggestion").length,J=i.filter(t=>O(t.status)),ce=n.useMemo(()=>[{value:"",label:"select agent..."},...J.map(t=>({value:String(t.id),label:q(t.agentType)}))],[J]);async function ie(){if(!y){f.error("select a review agent to perform the fix.");return}T(!0);try{await L.post(`web/tasks/${b}/approve-fix`,{json:{reviewTaskId:Number(y)}}),f.success("fix started"),k()}catch(t){const a=t instanceof Error?t.message:String(t);f.error(a)}finally{T(!1)}}async function le(){D(!0);try{await L.post(`web/tasks/${b}/skip-fix`,{json:h!=null?{round:h}:{}}),f.success("review completed — no fix needed"),l("/review")}catch(t){const a=t instanceof Error?t.message:String(t);f.error(a)}finally{D(!1)}}const xe=n.useMemo(()=>{var a;const t=(a=o==null?void 0:o.sourceTask)==null?void 0:a.configSnapshot;if(!t)return[];try{const d=JSON.parse(t);return Array.isArray(d.defaultReviewers)?d.defaultReviewers:[]}catch{return[]}},[(K=o==null?void 0:o.sourceTask)==null?void 0:K.configSnapshot]);if(g)return e.jsx("div",{className:"mx-auto max-w-4xl px-2 py-4 md:px-4 md:py-6 font-mono",children:e.jsx(je,{rows:5})});if(!o)return e.jsxs("div",{className:"mx-auto max-w-4xl px-2 py-4 md:px-4 md:py-6 font-mono text-center",children:[e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:"// reviews not found"}),e.jsx("button",{onClick:()=>l("/review"),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:"< back to review"})]});const{sourceTask:m}=o;return e.jsxs("div",{className:"mx-auto max-w-4xl px-2 py-4 md:px-4 md:py-6 font-mono",children:[e.jsx("div",{className:"mb-4 flex items-center gap-2",children:e.jsxs("button",{onClick:()=>l("/review"),className:"flex items-center gap-1.5 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:[e.jsx(ke,{className:"h-3.5 w-3.5"}),r("common.back")]})}),e.jsx("div",{className:"mb-5 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("div",{className:"flex flex-1 flex-col gap-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-bold text-[var(--text-muted)]",children:"source task"}),e.jsxs(ue,{to:`/tasks/${m.id}`,className:"text-xs text-[var(--info)] hover:underline",children:["#",m.id]}),e.jsx("span",{className:"shrink-0 rounded-[4px] border border-[var(--border)] px-2 py-0.5 text-[11px] text-[var(--text-muted)]",children:m.projectKey})]}),e.jsx("span",{className:"truncate text-sm text-[var(--text-primary)]",children:m.description}),(m.branch||m.sourceCommitSha)&&e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["reviewing branch"," ",m.branch&&e.jsx("span",{className:"text-[var(--text-secondary)]",children:m.branch}),m.sourceCommitSha&&e.jsxs(e.Fragment,{children:[" ","at commit"," ",e.jsx("span",{className:"font-mono text-[var(--accent)]",children:m.sourceCommitSha.slice(0,7)})]})]})]}),e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:ye(m.createdAt)})]})}),S.length>1&&e.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"round:"}),e.jsx("div",{className:"flex gap-1",children:S.map(t=>e.jsxs("button",{onClick:()=>Q(t.round),className:`rounded-[4px] border px-3 py-1 text-xs transition-colors ${h===t.round?"border-[var(--accent)] bg-[var(--accent)] text-black font-bold":"border-[var(--border)] text-[var(--text-muted)] hover:text-[var(--text-primary)]"}`,children:["#",t.round]},t.round))}),h!==F&&e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:"// historical"})]}),i.length>0&&e.jsxs("div",{className:"mb-5",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs font-bold text-[var(--text-muted)]",children:[r("review.round"),h?` #${h}`:""]}),e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:[i.filter(t=>G.includes(t.status)||O(t.status)).length," / ",i.length," done"]})]}),e.jsx("div",{className:"flex flex-col gap-2",children:i.map(t=>e.jsx(Pe,{task:t,expanded:w.has(t.id),onToggleExpand:()=>ee(t.id)},t.id))})]}),re&&te&&(i.filter(a=>a.report!=null).every(a=>!a.report.summary&&a.report.issues.length===0)?e.jsx("div",{className:"mb-5 rounded-[4px] border border-amber-500/40 bg-amber-500/10 p-4",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(W,{className:"h-4 w-4 shrink-0 text-amber-500 mt-0.5"}),e.jsx("p",{className:"text-xs text-amber-500",children:r("review.empty_report_warning")})]})}):e.jsxs("div",{className:"mb-5 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("div",{className:"mb-3 flex items-center gap-3",children:e.jsxs("span",{className:"text-xs font-bold text-[var(--accent)]",children:[r("review.round")," — ",r("review.issues_summary",{critical:String(ae),warning:String(ne),suggestion:String(oe)})]})}),A.length>0?e.jsx("div",{className:"flex flex-col gap-2",children:A.map((a,d)=>e.jsx(Fe,{issue:a},d))}):e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"// no issues reported"})]})),V&&se&&!I&&!M&&e.jsxs("div",{className:"mb-4 flex items-center gap-2 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3",children:[e.jsx(Se,{className:"h-3.5 w-3.5 animate-spin text-[var(--text-muted)]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:r("review.waiting_agents")})]}),V&&(I||M)&&e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("span",{className:"mb-3 block text-xs font-bold text-[var(--text-muted)]",children:"actions"}),e.jsxs("div",{className:"flex flex-col gap-3",children:[I&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-center",children:[e.jsx("select",{value:y,onChange:t=>$(t.target.value),className:"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)] md:w-48",children:ce.map(t=>e.jsx("option",{value:t.value,children:t.label},t.value))}),e.jsxs("button",{onClick:ie,disabled:C||!y,className:"flex items-center justify-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs font-bold text-black disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(z,{className:"h-3 w-3"}),r(C?"common.processing":"review.approve_fix")]}),e.jsxs("button",{onClick:le,disabled:R,className:"flex items-center justify-center gap-1.5 rounded-[4px] border border-[var(--border)] px-4 py-2 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-input)] transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(Ce,{className:"h-3 w-3"}),r(R?"common.processing":"review.skip_fix")]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] text-[var(--text-muted)]",children:[e.jsx(ve,{className:"h-3 w-3 shrink-0"}),r("review.fix_push_info")]})]}),e.jsxs("button",{onClick:()=>u(!0),className:"flex items-center gap-1.5 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:[e.jsx(Te,{className:"h-3.5 w-3.5"}),r("review.review_again")]})]})]}),i.length===0&&e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-8 text-center",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("review.no_reviews")}),e.jsxs("button",{onClick:()=>u(!0),className:"mt-3 flex items-center gap-1.5 mx-auto rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs font-bold text-black",children:[e.jsx(z,{className:"h-3 w-3"}),r("review.launch")]})]}),c&&e.jsx(Ue,{sourceTaskId:b,defaultReviewers:xe,onClose:()=>u(!1),onLaunched:()=>{u(!1),k()}})]})}export{We as default};
@@ -1 +0,0 @@
1
- import{R as pe,f as J,a as $,o as u,j as e,l as ee,u as me,i as ue,r,h as P,X as ve,k as he,v as be,H as fe,t as W,w as ge,x as V,m as ye}from"./index-DvdpkDlU.js";import{u as X}from"./task.store-CGgehOLp.js";import{T as te}from"./TaskStatusBadge-CD8sO9C_.js";import{f as se}from"./date-RFA7-ZGs.js";import{T as je}from"./Tooltip-BKRBwA7o.js";import{G as re}from"./git-fork-9KuFRmam.js";import{S as A}from"./Select-FmuTJbfh.js";import{a as ke}from"./task-constants-DTDx5Lfp.js";import{g as Ne}from"./agent-type-options-5v4PgZnP.js";import{C as Ce}from"./copy-2UMMaHKT.js";import{E as Y}from"./EmptyState-DpRw-xch.js";import{T as Z}from"./Skeleton-Bo0DEIHn.js";import{P as we}from"./plus-C8aSzgHN.js";import{C as Se}from"./chevron-left-C_lJcnCg.js";import{C as _e}from"./chevron-right-IZlTWMcO.js";import"./status-colors-0U8b2F2t.js";import"./chevron-down-CDFiGGBG.js";const Te=pe.memo(function({task:s}){const d=J(),{t:c}=$(),x=(a,h)=>c(`common.${a}`,{n:h}),i=s.status===u.COMPLETED||s.status===u.FAILED||s.status===u.CANCELLED;return e.jsxs("tr",{onClick:()=>d(`/tasks/${s.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:["#",s.id]}),e.jsx("td",{className:"py-3 pr-4 text-sm text-[var(--text-primary)]",children:e.jsx(je,{content:s.description,children:ee(s)})}),e.jsx("td",{className:"py-3 pr-4",children:e.jsx(te,{status:s.status})}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:s.projectKey}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:s.developerName??s.creatorName??"-"}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:s.workerName??"—"}),e.jsx("td",{className:"py-3 font-mono text-xs text-[var(--text-muted)]",children:e.jsxs("span",{className:"flex items-center gap-2",children:[se(s.createdAt,x),i&&e.jsx("button",{onClick:a=>{a.stopPropagation(),d(`/tasks/${s.id}?action=fork`)},className:"shrink-0 rounded-[4px] p-1 text-[var(--text-muted)] hover:text-[var(--accent)] hover:bg-[var(--bg-input)] transition-colors",title:c("tasks.fork_task"),children:e.jsx(re,{className:"h-3 w-3"})})]})})]})});function Ee({isOpen:n,onClose:s,projects:d,projectsLoading:c,onSubmit:x,isSubmitting:i}){const{t:a}=$();me(o=>o.user);const h=ue(),[p,K]=r.useState(""),[v,B]=r.useState(""),[m,I]=r.useState("feat"),[N,w]=r.useState(""),[b,S]=r.useState(""),[g,_]=r.useState(""),[y,j]=r.useState(""),[T,M]=r.useState(""),[O,R]=r.useState([]),[z,C]=r.useState(""),k=d.find(o=>o.key===p),H=Ne(o=>o,k==null?void 0:k.agentType);r.useEffect(()=>{if(!n||(K(""),B(""),I("feat"),w(""),S(""),_(""),j(""),M(""),C(""),!h))return;const o=new AbortController;return P.get("admin/developers",{signal:o.signal}).json().then(R).catch(()=>{}),()=>o.abort()},[n,h]),r.useEffect(()=>{if(!n)return;function o(F){F.key==="Escape"&&s()}return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[n,s]);async function E(o){if(o.preventDefault(),C(""),!p||!v.trim()){C(a("tasks.project_and_description_required"));return}try{await x({projectKey:p,description:v.trim(),workerId:y||void 0,developerId:T?Number(T):void 0,taskType:m,branchSlug:b.trim()||void 0,agentType:N||void 0,targetBranch:g.trim()||void 0})}catch(F){const L=F instanceof Error?F.message:a("tasks.failed_to_create_task");C(L)}}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:o=>{o.target===o.currentTarget&&s()},children:e.jsxs("div",{className:"w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",onClick:o=>o.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:["// ",a("tasks.new_task")]}),e.jsx("button",{onClick:s,className:"text-[var(--text-muted)] transition-colors hover:text-[var(--text-primary)]",children:e.jsx(ve,{className:"h-4 w-4"})})]}),e.jsxs("form",{onSubmit:E,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:a("tasks.project")}),e.jsx(A,{value:p,onChange:K,options:d.map(o=>({value:o.key,label:o.name})),placeholder:a(c?"common.loading":"tasks.select_project"),disabled:c})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.task_type")}),e.jsx(A,{value:m,onChange:I,options:ke})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.form_agent_type")}),e.jsx(A,{value:N,onChange:w,options:H})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.task_description")}),e.jsx("textarea",{value:v,onChange:o=>B(o.target.value),placeholder:a("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:a("tasks.target_worker")}),e.jsx("input",{type:"text",value:y,onChange:o=>j(o.target.value),placeholder:a("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)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.branch_slug")}),e.jsx("input",{type:"text",value:b,onChange:o=>S(o.target.value),placeholder:a("tasks.branch_slug_placeholder"),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)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.target_branch")}),e.jsx("input",{type:"text",value:g,onChange:o=>_(o.target.value),placeholder:a("tasks.target_branch_placeholder"),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:a("tasks.assign_developer")}),e.jsx(A,{value:T,onChange:M,options:O.map(o=>({value:String(o.id),label:o.name})),placeholder:a("tasks.select_developer")})]}),z&&e.jsx("div",{className:"rounded-[4px] bg-[#2a1515] border border-[var(--destructive)]/30 px-3 py-2 text-xs text-[var(--destructive)]",children:z})]}),e.jsxs("div",{className:"mt-6 flex items-center justify-end gap-3",children:[e.jsx("button",{type:"button",onClick:s,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:a("common.cancel")}),e.jsx("button",{type:"submit",disabled:i||!p||!v.trim(),className:"rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs text-black transition-opacity hover:opacity-90 disabled:opacity-40",children:a(i?"common.creating":"tasks.create_task")})]})]})]})}):null}function Fe({isOpen:n,onClose:s,onForceCreate:d,onViewExisting:c,similarTask:x,isLoading:i}){const{t:a}=$();return!x||!n?null:e.jsx("div",{onClick:s,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(Ce,{style:{width:"1rem",height:"1rem"}}),a("tasks.dedup_title")]}),e.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.7rem",marginTop:"0.25rem"},children:a("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:["#",x.id," · ",x.status]}),e.jsx("div",{style:{color:"var(--text-primary)",fontSize:"0.75rem",marginTop:"0.375rem",lineHeight:"1.5"},children:x.description})]}),e.jsxs("div",{style:{display:"flex",gap:"0.75rem"},children:[e.jsx("button",{type:"button",onClick:s,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:a("common.cancel")}),e.jsx("button",{type:"button",onClick:()=>c(x.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:a("tasks.view_existing")}),e.jsx("button",{type:"button",onClick:d,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:a(i?"common.creating":"tasks.dedup_create_anyway")})]})]})})}function De({task:n}){const s=J(),d=n.status===u.COMPLETED||n.status===u.FAILED||n.status===u.CANCELLED;return e.jsxs("div",{onClick:()=>s(`/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 line-clamp-2",title:ye(n),children:["#",n.id," ",ee(n)]}),e.jsxs("span",{className:"flex items-center gap-1.5 shrink-0",children:[d&&e.jsx("button",{onClick:c=>{c.stopPropagation(),s(`/tasks/${n.id}?action=fork`)},className:"rounded-[4px] p-1 text-[var(--text-muted)] hover:text-[var(--accent)] transition-colors",children:e.jsx(re,{className:"h-3 w-3"})}),e.jsx(te,{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:se(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:u.RUNNING,labelKey:"tasks.tab_running"},{key:u.QUEUED,labelKey:"tasks.tab_queued"},{key:u.COMPLETED,labelKey:"tasks.tab_completed"},{key:u.FAILED,labelKey:"tasks.tab_failed"},{key:u.CANCELLED,labelKey:"tasks.tab_cancelled"}],Ae=20;function Xe(){const n=J(),{t:s}=$(),{tasks:d,loading:c,fetchTasks:x}=X(),i=he(t=>t.taskSeq),[a,h]=r.useState("all"),[p,K]=r.useState(""),[v,B]=r.useState(""),[m,I]=r.useState(""),[N,w]=r.useState(void 0),[b,S]=r.useState([]),g=X(t=>t.nextCursor),[_,y]=r.useState(!1);be(r.useMemo(()=>e.jsxs("button",{onClick:()=>y(!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(we,{className:"h-3.5 w-3.5"}),s("tasks.new_task")]}),[s]));const[j,T]=r.useState([]),[M,O]=r.useState(!1),[R,z]=r.useState([]),[C,k]=r.useState(!1),[H,E]=r.useState(!1),[o,F]=r.useState(null),[L,q]=r.useState(null),G=r.useCallback(t=>{const l={limit:String(Ae),taskMode:"develop"};return a!=="all"&&(l.status=a),p&&(l.projectKey=p),v&&(l.developerId=v),t&&(l.cursor=t),l},[a,p,v]);r.useEffect(()=>{x(G(N))},[G,N,x,i]),r.useEffect(()=>{w(void 0),S([])},[a,p,v]),r.useEffect(()=>{let t=!1;return(async()=>{try{const[f,xe]=await Promise.all([P.get("web/projects").json(),P.get("web/projects/-/developers").json()]);if(t)return;T(f),z(xe)}catch{}})(),()=>{t=!0}},[]),r.useEffect(()=>{if(!_||j.length>0)return;O(!0);let t=!1;return(async()=>{try{const f=await P.get("web/projects").json();t||T(f)}catch{}finally{t||O(!1)}})(),()=>{t=!0}},[_,j.length]);const ae=r.useCallback(async t=>{k(!0);try{const l=await P.post("web/tasks",{json:{projectKey:t.projectKey,description:t.description,workerId:t.workerId,developerId:t.developerId,taskType:t.taskType,branchSlug:t.branchSlug,agentType:t.agentType,targetBranch:t.targetBranch}}).json();y(!1),n(`/tasks/${l.task.id}`)}catch(l){if(l instanceof fe&&l.response.status===409){try{const f=await l.response.json();if(f.confirmRequired){F({id:f.confirmRequired.taskId,description:f.confirmRequired.message,status:"active"}),q(t),y(!1),E(!0);return}}catch{}W.error(s("tasks.similar_task_exists"))}else{const f=l instanceof Error?l.message:String(l);W.error(f)}}finally{k(!1)}},[n]),oe=r.useCallback(async()=>{if(L){k(!0);try{const t=await P.post("web/tasks",{json:{...L,force:!0}}).json();E(!1),q(null),n(`/tasks/${t.task.id}`)}finally{k(!1)}}},[L,n]),D=r.useMemo(()=>{if(!m.trim())return d;const t=m.toLowerCase();return d.filter(l=>(l.name??"").toLowerCase().includes(t)||l.description.toLowerCase().includes(t)||String(l.id).includes(m))},[d,m]),ne=r.useCallback(()=>{g&&(S(t=>[...t,N??""]),w(g))},[g,N]),le=r.useCallback(()=>{b.length!==0&&(w(b.at(-1)||void 0),S(t=>t.slice(0,-1)))},[b]),ce=b.length+1,ie=r.useMemo(()=>[{value:"",label:s("tasks.filter_project")},...j.map(t=>({value:t.key,label:t.name}))],[j,s]),de=r.useMemo(()=>[{value:"",label:s("tasks.filter_developer")},...R.map(t=>({value:String(t.id),label:t.name}))],[R,s]),Q=s(m?"tasks.try_adjusting_search":"tasks.create_first_task"),U=m?void 0:e.jsx("button",{onClick:()=>y(!0),className:"rounded-[4px] bg-[var(--accent)] px-5 py-2 text-[11px] font-bold text-black",children:s("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 pr-4 md:pr-0",children:Pe.map(t=>e.jsx("button",{onClick:()=>h(t.key),className:`shrink-0 rounded-[4px] px-3 py-2 h-10 md:h-8 text-xs transition-colors ${a===t.key?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)] bg-[var(--bg-card)] hover:text-[var(--text-secondary)]"}`,children:s(t.labelKey)},t.key))}),e.jsxs("div",{className:"flex flex-col gap-2 md:ml-auto md:flex-row md:items-center",children:[e.jsxs("div",{className:"relative md:w-52",children:[e.jsx(ge,{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:s("tasks.search_tasks"),value:m,onChange:t=>I(t.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)]"}),m&&e.jsx("button",{onClick:()=>I(""),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(A,{value:p,onChange:K,options:ie,className:"md:w-40"}),e.jsx(A,{value:v,onChange:B,options:de,className:"md:w-40"})]})]}),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:s("tasks.id")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.description_col")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.status_col")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.project_col")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.assignee")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.worker")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.time")})]})}),e.jsxs("tbody",{children:[c&&D.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"p-4",children:e.jsx(Z,{rows:5})})}),!c&&D.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"p-4",children:e.jsx(Y,{icon:V,title:s("tasks.no_tasks_found"),description:Q,action:U})})}),D.map(t=>e.jsx(Te,{task:t},t.id))]})]})}),e.jsxs("div",{className:"flex flex-col gap-2 md:hidden",children:[c&&D.length===0&&e.jsx("div",{className:"p-4",children:e.jsx(Z,{rows:5})}),!c&&D.length===0&&e.jsx(Y,{icon:V,title:s("tasks.no_tasks_found"),description:Q,action:U}),D.map(t=>e.jsx(De,{task:t},t.id))]}),(b.length>0||g)&&e.jsxs("div",{className:"mt-6 flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["// page ",ce]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:le,disabled:b.length===0,className:"flex items-center justify-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1 min-h-[44px] min-w-[44px] md:min-h-0 md:min-w-0 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:border-[var(--accent)] disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:[e.jsx(Se,{className:"h-3.5 w-3.5"}),s("tasks.prev")]}),e.jsxs("button",{onClick:ne,disabled:!g,className:"flex items-center justify-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1 min-h-[44px] min-w-[44px] md:min-h-0 md:min-w-0 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:border-[var(--accent)] disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:[s("common.next"),e.jsx(_e,{className:"h-3.5 w-3.5"})]})]})]}),e.jsx(Ee,{isOpen:_,onClose:()=>y(!1),projects:j,projectsLoading:M,onSubmit:ae,isSubmitting:C}),e.jsx(Fe,{isOpen:H,onClose:()=>{E(!1),q(null)},onForceCreate:oe,onViewExisting:t=>{E(!1),q(null),n(`/tasks/${t}`)},similarTask:o,isLoading:C})]})}export{Xe as default};
@@ -1,6 +0,0 @@
1
- import{c as ce,n as le,h as D,o as S,a as O,r,k as q,p as de,q as xe,j as e,X as Z,s as me,f as pe,l as ue,m as ve}from"./index-DvdpkDlU.js";import{g as ee,M as he,C as fe,a as ge}from"./ConfirmStageDialog-BatYNr9r.js";import{u as be}from"./task.store-CGgehOLp.js";import{i as z,O as te}from"./OnboardingGuide-DGH0Yfsj.js";import{S as E}from"./Select-FmuTJbfh.js";import{a as se}from"./status-colors-0U8b2F2t.js";import{a as je}from"./date-RFA7-ZGs.js";import{T as G,a as J,g as ke}from"./task-constants-DTDx5Lfp.js";import{g as ye}from"./agent-type-options-5v4PgZnP.js";import{u as ae}from"./useFetch-CJDmNhIT.js";import{P as $}from"./plus-C8aSzgHN.js";import{C as Ne}from"./chevron-down-CDFiGGBG.js";import{C as Te}from"./chevron-up-DSOCVgRW.js";import{W as we}from"./wifi-BCoKY35p.js";import"./loader-circle-B5SLmhRr.js";import"./rotate-ccw-BSPzJeCn.js";import"./PtyTerminal-DOgYXCFD.js";import"./file-text-COzaNu8e.js";import"./chevron-right-IZlTWMcO.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=ce("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"}]]),ne="overlord_home_terminal";function Ce(){try{const t=localStorage.getItem(ne);if(t)return JSON.parse(t)}catch{}return{pinnedTaskIds:[],activeTaskId:null}}let Q="";function R(t){const a=JSON.stringify(t);a!==Q&&(Q=a,localStorage.setItem(ne,a))}const V=Ce(),_e=new Set([S.QUEUED,S.ASSIGNED,S.RUNNING,S.SUSPENDED]);let B=!1;const Ie=le((t,a)=>({pinnedTaskIds:V.pinnedTaskIds,activeTaskId:V.activeTaskId,taskMetas:{},stageConfirm:null,loading:!1,initialLoaded:!1,setActiveTask:s=>{t({activeTaskId:s}),R({pinnedTaskIds:a().pinnedTaskIds,activeTaskId:s})},pinTask:s=>{const{pinnedTaskIds:n}=a();if(n.includes(s))return;const c=[...n,s];t({pinnedTaskIds:c}),R({pinnedTaskIds:c,activeTaskId:a().activeTaskId})},unpinTask:s=>{const{pinnedTaskIds:n,activeTaskId:c,taskMetas:x}=a(),i=n.filter(o=>o!==s),l=c===s?i[0]??null:c,{[s]:v,...f}=x;t({pinnedTaskIds:i,activeTaskId:l,taskMetas:f}),R({pinnedTaskIds:i,activeTaskId:l})},loadActiveTasks:async()=>{if(B)return;B=!0;const s=!a().initialLoaded;s&&t({loading:!0});try{const c=(await D.get("web/tasks",{searchParams:{limit:"30"}}).json()).data.filter(o=>_e.has(o.status)),x={};for(const o of c)x[o.id]={id:o.id,name:o.name,description:o.description,status:o.status,projectKey:o.projectKey,workerName:o.workerName??null,agentType:ee(o),currentStage:o.currentStage,currentSessionId:o.currentSessionId,updatedAt:o.updatedAt};const l=[...c].sort((o,u)=>u.updatedAt.localeCompare(o.updatedAt)).map(o=>o.id),{activeTaskId:v}=a(),f=v&&l.includes(v)?v:l[0]??null;t({taskMetas:x,pinnedTaskIds:l,activeTaskId:f,initialLoaded:!0}),R({pinnedTaskIds:l,activeTaskId:f})}catch{}finally{B=!1,s&&t({loading:!1})}},fetchStageConfirm:async s=>{try{const n=await D.get(`web/tasks/${s}/pending-confirm`).json();t({stageConfirm:n.confirm})}catch{t({stageConfirm:null})}},clearStageConfirm:()=>t({stageConfirm:null}),updateTaskMeta:(s,n)=>{const{taskMetas:c}=a(),x=c[s];x&&t({taskMetas:{...c,[s]:{...x,...n}}})}}));function Ee(){const[t,a]=r.useState(()=>z());r.useEffect(()=>{const n=()=>a(!0),c=()=>a(z());return window.addEventListener("onboarding-dismissed",n),window.addEventListener("storage",c),()=>{window.removeEventListener("onboarding-dismissed",n),window.removeEventListener("storage",c)}},[]);const{data:s}=ae(()=>t?Promise.resolve(null):D.get("web/dashboard/stats").json(),[t]);return t||!s?null:{activeTasks:(s.active_tasks??0)+(s.queued_tasks??0),totalWorkers:s.online_workers??0,totalProjects:s.project_count??0,totalDevelopers:s.developer_count??0}}function Ae({taskId:t,confirm:a,onSubmitted:s}){const{t:n}=O(),[c,x]=r.useState(a.timeout),[i,l]=r.useState(!1),[v,f]=r.useState(!1),o=a.confirmType==="plan_review"||a.confirmType==="code_review",u=a.confirmType==="plan_decompose";r.useEffect(()=>{x(a.timeout);const j=setInterval(()=>{x(b=>b<=1?(clearInterval(j),0):b-1)},1e3);return()=>clearInterval(j)},[a.timeout,a.stageName]);const h=r.useCallback(async j=>{l(!0);try{await D.post(`web/tasks/${t}/confirm-stage`,{json:{stageName:a.stageName,approved:j}}),s()}catch{}finally{l(!1)}},[t,a.stageName,s]);return e.jsxs(e.Fragment,{children:[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(fe,{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:je(c)})]}),e.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:u?e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>h(!1),disabled:i,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_plan_decompose")}),e.jsx("button",{onClick:()=>h(!0),disabled:i,className:"rounded-[4px] bg-[var(--accent)] px-2 py-1 text-[11px] text-black hover:opacity-90 transition-opacity disabled:opacity-50",children:n(i?"tasks.stage_submitting":"tasks.approve_plan_decompose")})]}):o?e.jsx("button",{onClick:()=>f(!0),className:"rounded-[4px] bg-[var(--accent)] px-2 py-1 text-[11px] text-black hover:opacity-90 transition-opacity",children:a.confirmType==="plan_review"?n("tasks.approve_plan"):n("tasks.approve_review")}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>h(!1),disabled:i,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:i,className:"rounded-[4px] bg-[var(--accent)] px-2 py-1 text-[11px] text-black hover:opacity-90 transition-opacity disabled:opacity-50",children:n(i?"tasks.stage_submitting":"tasks.confirm_and_proceed")})]})})]}),o&&e.jsx(ge,{isOpen:v,onClose:()=>f(!1),taskId:t,stageName:a.stageName,timeoutSeconds:Math.ceil(a.timeout/1e3),confirmType:a.confirmType,onSubmitted:s})]})}function Me({projectKey:t,onProjectChange:a,onCreated:s}){const{t:n}=O(),c=be(m=>m.createTask),[x,i]=r.useState(""),[l,v]=r.useState("feat"),[f,o]=r.useState(void 0),[u,h]=r.useState(!1),[j,b]=r.useState(!1),[U,L]=r.useState(!1),{data:C}=ae(()=>D.get("web/projects").json(),[]),T=r.useMemo(()=>{const m=(C??[]).map(F=>({value:F.key,label:F.key}));return[{value:"",label:n("terminal_home.all_projects")},...m]},[C,n]),g=r.useMemo(()=>(C??[]).find(m=>m.key===t)??null,[C,t]),A=r.useMemo(()=>ye(m=>m,g==null?void 0:g.agentType),[g==null?void 0:g.agentType]),k=r.useRef(!1);r.useEffect(()=>{if(!k.current){if(t){k.current=!0;return}T.length>1&&(a(T[1].value),k.current=!0)}},[t,T,a]),r.useEffect(()=>{o(void 0)},[t]);const M=f??"",p=r.useCallback(m=>{o(m||void 0)},[]),_=!!t&&!!x.trim();function w(){_&&b(!0)}async function N(){if(b(!1),!!_){h(!0);try{const m=await c({projectKey:t,description:x.trim(),taskType:l,agentType:f||void 0});i(""),s(m.id)}catch{}finally{h(!1)}}}const I=n("terminal_home.confirm_create_message").replace("{taskType}",l).replace("{projectKey}",t).replace("{description}",x.trim()),P="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(E,{value:t,onChange:a,options:T,placeholder:n("terminal_home.select_project")})}),e.jsx("div",{className:"w-[100px]",children:e.jsx(E,{value:l,onChange:v,options:J})}),e.jsx("div",{className:"w-[120px]",children:e.jsx(E,{value:M,onChange:p,options:A,placeholder:n("tasks.form_agent_type"),disabled:u||!t})}),e.jsx("input",{type:"text",value:x,onChange:m=>i(m.target.value),onKeyDown:m=>m.key==="Enter"&&w(),placeholder:n("terminal_home.task_description_placeholder"),className:P,disabled:u}),e.jsxs("button",{onClick:w,disabled:u||!_,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($,{className:"h-3 w-3"}),n(u?"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(E,{value:t,onChange:a,options:T,placeholder:n("terminal_home.select_project")})}),e.jsx("div",{className:"w-[100px]",children:e.jsx(E,{value:l,onChange:v,options:J})}),e.jsx("div",{className:"w-[120px]",children:e.jsx(E,{value:M,onChange:p,options:A,placeholder:n("tasks.form_agent_type"),disabled:u||!t})}),e.jsx("button",{onClick:()=>L(!1),className:"p-1 text-[var(--text-muted)]",children:e.jsx(Z,{className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",value:x,onChange:m=>i(m.target.value),onKeyDown:m=>m.key==="Enter"&&w(),placeholder:n("terminal_home.task_description_placeholder"),className:P,disabled:u}),e.jsx("button",{onClick:w,disabled:u||!_,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($,{className:"h-3 w-3"})})]})]}):e.jsxs("button",{onClick:()=>L(!0),className:"flex w-full items-center justify-center gap-1 py-2 text-xs text-[var(--accent)] hover:opacity-80",children:[e.jsx($,{className:"h-3.5 w-3.5"}),n("terminal_home.new_task")]})}),e.jsx(me,{isOpen:j,onClose:()=>b(!1),onConfirm:N,title:n("terminal_home.confirm_create_title"),message:I,confirmVariant:"accent",confirmLabel:n("terminal_home.new_task"),isLoading:u})]})}function Y({status:t,size:a}){const s=t===S.SUSPENDED,n=se(t),c=a==="sm"?"h-1.5 w-1.5":"h-2 w-2";return e.jsx("span",{className:`${c} shrink-0 rounded-full ${s?"animate-pulse":""}`,style:{backgroundColor:s?"var(--warning)":n}})}function De({tasks:t,activeId:a,onSelect:s,onUnpin:n,children:c}){const x=pe();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"})}),t.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:t.map(i=>{const l=i.id===a;return e.jsxs("div",{onClick:()=>s(i.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(Y,{status:i.status,size:"md"}),e.jsxs("div",{className:"flex-1 min-w-0",title:ve(i),children:[e.jsxs("div",{className:"truncate text-xs",children:["#",i.id," ",ue(i)]}),e.jsx("div",{className:"text-[10px] text-[var(--text-muted)]",children:i.projectKey})]}),e.jsx("button",{onClick:v=>{v.stopPropagation(),n(i.id)},className:"hidden group-hover:flex items-center justify-center shrink-0 w-5 h-5 text-[var(--text-muted)] hover:text-[var(--text-primary)]",title:"unpin",children:e.jsx(Z,{className:"h-3 w-3"})}),e.jsx("button",{onClick:v=>{v.stopPropagation(),x(`/tasks/${i.id}`)},className:"hidden group-hover:flex items-center justify-center shrink-0 w-5 h-5 text-[var(--text-muted)] hover:text-[var(--accent)]",title:"open detail",children:e.jsx("span",{className:"text-[10px] leading-none",children:"→"})})]},i.id)})})]}),e.jsxs("div",{className:"flex flex-col md:hidden",children:[e.jsx("div",{className:"flex items-center gap-1 overflow-x-auto no-scrollbar border-b border-[var(--border)] bg-[var(--bg-card)] px-2",style:{height:44},children:t.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"})}):t.map(i=>{const l=i.id===a;return e.jsxs("button",{onClick:()=>s(i.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)]"}`,style:{height:44},children:[e.jsx(Y,{status:i.status,size:"sm"}),e.jsxs("span",{className:"text-[11px] whitespace-nowrap",children:["#",i.id]})]},i.id)})}),c]})]})}function Oe({task:t,takeoverState:a,onTakeover:s,onRelease:n}){const c=se(t.status),x=ke(t.agentType),i=ee(t);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:t.projectKey}),e.jsxs("span",{className:"text-[11px]",style:{color:c},children:[t.status.toLowerCase()," / ",x]}),t.currentStage&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"hidden md:inline text-[11px] text-[var(--text-muted)]",children:["// stage: ",t.currentStage]}),e.jsxs("span",{className:"md:hidden text-[11px] text-[var(--text-muted)]",children:["stage: ",t.currentStage]})]}),e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["agent: ",i]}),t.workerName&&e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["worker: ",t.workerName]})]}),e.jsx("div",{className:"flex items-center gap-1"})]})}function Le({task:t,ptyStatus:a}){const s=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:t.currentStage?`stage: ${t.currentStage}`:`task #${t.id}`}),e.jsxs("span",{className:`flex items-center gap-1 text-[10px] ${s?"text-[var(--accent)]":"text-[var(--text-muted)]"}`,children:[s?e.jsx(we,{className:"h-2.5 w-2.5"}):e.jsx(Se,{className:"h-2.5 w-2.5"}),s?"connected":a]})]})}function K({onboardingData:t}){const[a,s]=r.useState(!1),{t:n}=O();return t?a?e.jsxs("div",{className:"border-b border-[var(--accent)]/30",children:[e.jsxs("button",{onClick:()=>s(!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(Te,{className:"h-3 w-3 text-[var(--text-muted)]"})]}),e.jsx("div",{className:"max-h-[300px] overflow-y-auto",children:e.jsx(te,{data:t})})]}):e.jsxs("button",{onClick:()=>s(!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(Ne,{className:"h-3 w-3 text-[var(--text-muted)]"})]}):null}function X({onboardingData:t}){const{t:a}=O();return e.jsx("div",{className:`flex flex-1 flex-col items-center p-4 md:p-6 ${t?"overflow-auto":"justify-center"}`,children:t?e.jsx("div",{className:"w-full max-w-lg",children:e.jsx(te,{data:t})}):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 tt(){const{t}=O(),{pinnedTaskIds:a,activeTaskId:s,taskMetas:n,stageConfirm:c,loading:x,initialLoaded:i,setActiveTask:l,pinTask:v,unpinTask:f,loadActiveTasks:o,fetchStageConfirm:u,clearStageConfirm:h,updateTaskMeta:j}=Ie(),b=r.useRef(null),[U,L]=r.useState("disconnected"),[C,T]=r.useState("auto"),[g,A]=r.useState(""),k=q(d=>d.lastEvent),M=q(d=>d.status),p=s?n[s]??null:null,_=p?G.includes(p.status):!1,w=r.useRef(!1);r.useEffect(()=>{!w.current&&p&&(A(p.projectKey),w.current=!0)},[p]);const N=r.useMemo(()=>{const d=a.map(y=>n[y]).filter(Boolean);return g?d.filter(y=>y.projectKey===g):d},[a,n,g]);r.useEffect(()=>{N.length>0&&s&&!N.some(d=>d.id===s)&&l(N[0].id)},[N,s,l]);const I=Ee();de(p?xe(p):null),r.useEffect(()=>{o()},[o]),r.useEffect(()=>{s&&(p==null?void 0:p.status)===S.SUSPENDED?u(s):h()},[s,p==null?void 0:p.status,u,h]),r.useEffect(()=>{if(k){if(k.event==="task_status_changed"){const{taskId:d,status:y,currentStage:H}=k,W={status:y,updatedAt:new Date().toISOString()};H!==void 0&&(W.currentStage=H),j(d,W),y===S.SUSPENDED&&d===s&&u(d),G.includes(y)&&d===s&&h()}k.event==="task_created"&&o()}},[k,s,u,h,j,o]),r.useEffect(()=>{if(M==="connected")return;const y=setInterval(()=>{document.visibilityState!=="hidden"&&o()},15e3);return()=>clearInterval(y)},[M,o]);const P=r.useCallback(d=>{v(d),l(d),o()},[v,l,o]),m=r.useCallback(()=>{h(),o()},[h,o]),F=r.useCallback(()=>{var d;(d=b.current)==null||d.requestTakeover()},[]),re=r.useCallback(()=>{var d;(d=b.current)==null||d.releaseTakeover()},[]),ie=N.length>0,oe=x&&!i;return e.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsx(Me,{projectKey:g,onProjectChange:A,onCreated:P}),oe?e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:t("common.loading")})}):e.jsx("div",{className:"flex flex-col md:flex-row flex-1 overflow-hidden",children:ie?e.jsxs(e.Fragment,{children:[e.jsx(De,{tasks:N,activeId:s,onSelect:l,onUnpin:f,children:e.jsx("div",{className:"md:hidden",children:e.jsx(K,{onboardingData:I})})}),e.jsx("div",{className:"flex flex-1 flex-col overflow-hidden",children:p?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden md:block",children:e.jsx(K,{onboardingData:I})}),e.jsx(Oe,{task:p,takeoverState:C,onTakeover:F,onRelease:re}),c&&s&&e.jsx(Ae,{taskId:s,confirm:c,onSubmitted:m}),e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:e.jsx(he,{taskId:s,sessionId:p.currentSessionId??void 0,taskFinished:_,onStatusChange:L,onTakeoverChange:T,ref:b},s)}),e.jsx(Le,{task:p,ptyStatus:U})]}):e.jsx(X,{onboardingData:I})})]}):e.jsx(X,{onboardingData:I})})]})}export{tt as default};
@@ -1 +0,0 @@
1
- import{a as C,r as n,j as e,h as w,f as M,B as O,a2 as k,a0 as $,I as T,s as V}from"./index-DvdpkDlU.js";import{K as E}from"./key-DoJm5thS.js";import{C as S}from"./copy-2UMMaHKT.js";import{E as B}from"./external-link-B9CWNSMc.js";import{E as K}from"./EmptyState-DpRw-xch.js";import{T as P}from"./Skeleton-Bo0DEIHn.js";import{u as W}from"./useFetch-CJDmNhIT.js";import{e as R}from"./status-colors-0U8b2F2t.js";import{P as J}from"./plus-C8aSzgHN.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(B,{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(K,{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(V,{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};
@@ -1,6 +0,0 @@
1
- import{c as G,R as U,a as C,j as e,r as o,h as S,X as q,B as K,f as H,u as V,k as X,W as N,v as J,D as Q,S as M}from"./index-DvdpkDlU.js";import{w as W}from"./status-colors-0U8b2F2t.js";import{M as _}from"./MetricBar-DZOZStDZ.js";import Y from"./WorkerSetupGuidePage-C1wXY1wd.js";import{C as A}from"./copy-2UMMaHKT.js";import{L as Z}from"./loader-circle-B5SLmhRr.js";import{S as ee}from"./Select-FmuTJbfh.js";import{E as te}from"./EmptyState-DpRw-xch.js";import{C as re}from"./Skeleton-Bo0DEIHn.js";import{u as se}from"./useFetch-CJDmNhIT.js";import{P as ae}from"./plus-C8aSzgHN.js";import{A as oe}from"./arrow-left-CR_n40mK.js";import"./key-DoJm5thS.js";import"./download-D2NyL1OR.js";import"./settings-C8PB6BpE.js";import"./play-Do-8kkck.js";import"./wifi-BCoKY35p.js";import"./chevron-down-CDFiGGBG.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 ne=G("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]),le=U.memo(function({worker:r,onClick:l}){const{t}=C();return e.jsxs("div",{onClick:l,className:`rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 font-mono lowercase transition-colors ${l?"cursor-pointer hover:border-[var(--accent)]/40 hover:bg-[var(--bg-input)]":""}`,children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsxs("h3",{className:"truncate text-sm text-[var(--text-primary)]",children:[e.jsx("span",{style:{color:W[r.status],fontSize:"0.6rem"},children:"●"})," ",r.name]}),e.jsx("span",{className:"text-xs",style:{color:W[r.status]},children:r.status})]}),e.jsxs("div",{className:"mb-3 text-xs text-[var(--text-muted)]",children:[r.host,r.os?`:${r.os}`:""]}),e.jsxs("div",{className:"mb-3 flex flex-col gap-2",children:[e.jsx(_,{label:t("workers.cpu"),value:r.cpuUsage,variant:"inline"}),e.jsx(_,{label:t("workers.mem"),value:r.memoryUsage,variant:"inline"}),e.jsx(_,{label:t("workers.disk"),value:r.diskUsage,variant:"inline"})]}),e.jsx("div",{className:"flex items-center justify-between text-xs",children:e.jsx("span",{className:"text-[var(--text-secondary)]",children:t("workers.tasks_slots",{active:String(r.activeSlots),max:String(r.maxSlots)})})}),r.capabilities.length>0&&e.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:r.capabilities.map(s=>{var m;const c=(m=r.degradedCapabilities)==null?void 0:m.some(i=>i.agentType===s);return e.jsx("span",{className:`rounded-[4px] border px-1.5 py-0.5 text-[11px] ${c?"border-[var(--warning)] text-[var(--warning)]":"border-[var(--border)] text-[var(--text-muted)]"}`,children:s},s)})})]})});function ce({isOpen:d,onClose:r,onRegistered:l}){const{t}=C(),[s,c]=o.useState(1),[m,i]=o.useState(!1),[x,u]=o.useState(""),[b,g]=o.useState(null),[v,h]=o.useState(""),[k,a]=o.useState(""),[j,y]=o.useState(!1),[z,w]=o.useState(!1),[D,T]=o.useState(""),[I,$]=o.useState(""),p=o.useRef(null),F={1:t("workers.reg_step_generate_token"),2:t("workers.reg_step_install_worker"),3:t("workers.reg_step_waiting_activation"),4:t("workers.reg_step_activated")};o.useEffect(()=>(d&&(c(1),u(""),g(null),h(""),a(""),y(!1),w(!1),T(""),$(""),i(!1)),()=>{p.current&&clearInterval(p.current)}),[d]);const E=async()=>{const n=v.trim();if(!n){a(t("admin.pat_label_required"));return}a(""),i(!0);try{const f=await S.post("admin/worker-tokens",{json:{label:n}}).json();u(f.token),g(f.tokenId),c(2)}catch{}finally{i(!1)}},O=typeof window<"u"?window.location.origin:"https://overlord.example.com",L=x?`overlord setup worker --token ${x} --server ${O}`:"",P=()=>{navigator.clipboard.writeText(x),y(!0),setTimeout(()=>y(!1),2e3)},R=()=>{navigator.clipboard.writeText(L),w(!0),setTimeout(()=>w(!1),2e3)},B=o.useCallback(()=>{b&&(c(3),p.current=setInterval(async()=>{try{const n=await S.get(`admin/worker-tokens/${b}/status`).json();n.used&&n.workerName&&(T(n.workerName),$(n.workerId??""),c(4),p.current&&clearInterval(p.current),l==null||l())}catch{}},3e3))},[b,l]);return o.useEffect(()=>()=>{p.current&&clearInterval(p.current)},[]),d?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center font-mono lowercase",children:[e.jsx("div",{className:"absolute inset-0 bg-[var(--bg-primary)]/60 backdrop-blur-sm",onClick:r}),e.jsxs("div",{className:"relative z-10 w-full max-w-[1080px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-8",children:[e.jsx("button",{type:"button",onClick:r,className:"absolute right-4 top-4 text-[var(--text-muted)] hover:text-[var(--text-primary)]",children:e.jsx(q,{className:"h-4 w-4"})}),e.jsx("h2",{className:"text-lg font-bold text-[var(--accent)]",children:t("workers.reg_title")}),e.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:t("workers.reg_subtitle")}),e.jsx("div",{className:"mt-6 flex items-center justify-center gap-2",children:[1,2,3,4].map((n,f)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:`rounded-[4px] px-3 py-1.5 text-[11px] font-bold ${n===s?"bg-[var(--accent)] text-black":n<s?"bg-[var(--accent)]/20 text-[var(--accent)]":"border border-[var(--border)] bg-[var(--bg-primary)] text-[var(--text-muted)]"}`,children:[n,". ",F[n]]}),f<3&&e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"→"})]},n))}),e.jsxs("div",{className:"mt-6 grid grid-cols-1 gap-4 lg:grid-cols-2",children:[e.jsxs("div",{className:`rounded-[4px] border p-4 ${s===1?"border-[var(--accent)] bg-[var(--bg-primary)]":"border-[var(--border)] bg-[var(--bg-primary)]"}`,children:[e.jsxs("p",{className:"text-[13px] font-bold text-[var(--accent)]",children:["> ",t("workers.reg_step_generate_token")]}),s===1&&!x?e.jsxs("div",{className:"mt-3 space-y-3",children:[e.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:t("workers.reg_click_to_generate")}),k&&e.jsx("p",{className:"text-[11px] text-red-400",children:k}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-[11px] text-[var(--text-muted)]",children:t("admin.label")}),e.jsx("input",{type:"text",placeholder:t("admin.pat_label_placeholder"),value:v,onChange:n=>h(n.target.value),onKeyDown:n=>{n.key==="Enter"&&E()},className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-1.5 text-[11px] text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:border-[var(--accent)] focus:outline-none"})]}),e.jsx("button",{type:"button",onClick:E,disabled:m,className:"rounded-[4px] bg-[var(--accent)] px-4 py-1.5 text-xs font-bold text-black disabled:opacity-50",children:t(m?"admin.generating":"workers.reg_step_generate_token")})]}):x?e.jsxs("div",{className:"mt-3 space-y-3",children:[e.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:t("workers.reg_token_generated")}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[11px] text-[var(--text-muted)]",children:"Token"}),e.jsxs("div",{className:"relative rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] px-3 py-2 pr-16",children:[e.jsx("code",{className:"block break-all text-[11px] text-[var(--text-primary)]",children:x}),e.jsx("button",{type:"button",onClick:P,className:"absolute right-2 top-1.5 text-[11px] text-[var(--text-muted)] hover:text-[var(--text-primary)]",children:j?e.jsx("span",{className:"text-[var(--accent)]",children:t("common.copied")}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(A,{className:"h-3 w-3"})," ",t("common.copy")]})})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[11px] text-[var(--text-muted)]",children:t("admin.setup_command")}),e.jsxs("div",{className:"relative rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] px-3 py-2 pr-16",children:[e.jsxs("code",{className:"block break-all text-[11px] text-[var(--accent)]",children:["$ ",L]}),e.jsx("button",{type:"button",onClick:R,className:"absolute right-2 top-1.5 text-[11px] text-[var(--text-muted)] hover:text-[var(--text-primary)]",children:z?e.jsx("span",{className:"text-[var(--accent)]",children:t("common.copied")}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(A,{className:"h-3 w-3"})," ",t("common.copy")]})})]})]}),e.jsx("div",{className:"rounded-[4px] border border-yellow-500/30 bg-yellow-500/10 px-3 py-2 text-[11px] text-yellow-400",children:t("admin.token_shown_once")})]}):e.jsx("p",{className:"mt-2 text-[11px] text-[var(--text-muted)]",children:t("workers.reg_completed")})]}),e.jsxs("div",{className:`rounded-[4px] border p-4 ${s===2?"border-[var(--accent)] bg-[var(--bg-primary)]":"border-[var(--border)] bg-[var(--bg-primary)]"}`,children:[e.jsxs("p",{className:"text-[13px] font-bold text-[var(--text-primary)]",children:["> ",t("workers.reg_step_install_worker")]}),e.jsx("p",{className:"mt-2 text-[11px] text-[var(--text-muted)]",children:t("workers.reg_running_installation")}),s>=2&&e.jsxs("div",{className:"mt-3 space-y-1 rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] p-3",children:[e.jsx("p",{className:"text-[11px] text-[var(--text-primary)]",children:"$ overlord setup worker"}),e.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:"server url: https://..."}),e.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:"worker token: ovw_..."}),e.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:"worker name: my-worker"}),e.jsx("p",{className:"text-[11px] text-[var(--accent)]",children:"config written. starting worker..."}),s===2&&e.jsx("p",{className:"text-[11px] text-[var(--accent)] animate-pulse",children:"&block;"})]}),s===2&&e.jsx("button",{type:"button",onClick:B,className:"mt-3 rounded-[4px] bg-[var(--accent)] px-4 py-1.5 text-xs font-bold text-black",children:t("workers.reg_installed_wait")})]}),e.jsxs("div",{className:`rounded-[4px] border p-4 ${s===3?"border-amber-500 bg-[var(--bg-primary)]":"border-[var(--border)] bg-[var(--bg-primary)]"}`,children:[e.jsxs("p",{className:"text-[13px] font-bold text-[var(--text-primary)]",children:["> ",t("workers.reg_step_waiting_activation")]}),s>=3?e.jsx("div",{className:"mt-3 flex flex-col items-center justify-center gap-3 py-6",children:s===3?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full border-2 border-amber-500",children:e.jsx(Z,{className:"h-5 w-5 animate-spin text-amber-500"})}),e.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:t("workers.reg_listening_for_worker")})]}):e.jsx("p",{className:"text-[11px] text-[var(--accent)]",children:t("workers.reg_worker_connected")})}):e.jsx("p",{className:"mt-2 text-[11px] text-[var(--text-muted)]",children:t("workers.reg_waiting_for_worker")})]}),e.jsxs("div",{className:`rounded-[4px] border p-4 ${s===4?"border-[var(--accent)] bg-[var(--bg-primary)]":"border-[var(--border)] bg-[var(--bg-primary)]"}`,children:[e.jsxs("p",{className:"text-[13px] font-bold text-[var(--text-primary)]",children:["> ",t("workers.reg_step_activated")]}),s===4?e.jsxs("div",{className:"mt-3 flex flex-col items-center justify-center gap-3 py-6",children:[e.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-full bg-[var(--accent)]/20",children:e.jsx(K,{className:"h-6 w-6 text-[var(--accent)]"})}),e.jsx("p",{className:"text-xs font-bold text-[var(--accent)]",children:t("workers.reg_worker_activated",{name:D})}),I&&e.jsxs("p",{className:"text-[11px] text-[var(--text-muted)]",children:["worker_id: ",I]})]}):e.jsx("p",{className:"mt-2 text-[11px] text-[var(--text-muted)]",children:t("workers.reg_worker_registered")})]})]}),s===4&&e.jsx("div",{className:"mt-6 flex justify-end",children:e.jsx("button",{type:"button",onClick:r,className:"rounded-[4px] bg-[var(--accent)] px-5 py-2 text-xs font-bold text-black",children:t("workers.reg_done")})})]})]}):null}function Ce(){const d=H(),{t:r}=C(),[l,t]=o.useState("all"),[s,c]=o.useState("fleet"),[m,i]=o.useState(!1),[x,u]=o.useState(0),b=V(a=>{var j;return(j=a.user)==null?void 0:j.role}),g=X(a=>a.workerSeq),{data:v,loading:h}=se(()=>{const a={};return l!=="all"&&(a.status=l),S.get("web/workers",{searchParams:a}).json()},[l,x,g]),k=o.useMemo(()=>[{value:"all",label:r("workers.all_statuses")},{value:N.ONLINE,label:r("workers.online")},{value:N.OFFLINE,label:r("workers.offline")},{value:N.DRAINING,label:r("workers.draining")}],[r]);return J(o.useMemo(()=>b===Q.ADMIN?e.jsxs("button",{type:"button",onClick:()=>i(!0),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",children:[e.jsx(ae,{size:14}),r("workers.register_worker")]}):null,[b,r])),e.jsxs("div",{className:"mx-auto max-w-6xl font-mono lowercase",children:[e.jsxs("div",{className:"flex items-center gap-3 border-b border-[var(--border)] bg-[var(--bg-primary)] px-4 py-3 shrink-0 md:hidden",children:[e.jsx("button",{onClick:()=>d("/dashboard"),className:"shrink-0 text-[var(--text-muted)]",children:e.jsx(oe,{className:"h-4 w-4"})}),e.jsx("span",{className:"truncate text-sm font-medium text-[var(--text-primary)]",children:r("workers.title")})]}),e.jsxs("div",{className:"px-4 md:px-6 py-8",children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between border-b border-[var(--border)]",children:[e.jsxs("div",{className:"flex overflow-x-auto no-scrollbar",children:[e.jsxs("button",{type:"button",onClick:()=>{c("fleet"),u(a=>a+1)},className:`flex shrink-0 whitespace-nowrap items-center gap-2 px-4 py-2.5 text-xs transition-colors ${s==="fleet"?"border-b-2 border-[var(--accent)] text-[var(--text-primary)]":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:[e.jsx(M,{size:14}),r("workers.fleet")]}),e.jsxs("button",{type:"button",onClick:()=>c("setup_guide"),className:`flex shrink-0 whitespace-nowrap items-center gap-2 px-4 py-2.5 text-xs transition-colors ${s==="setup_guide"?"border-b-2 border-[var(--accent)] text-[var(--text-primary)]":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:[e.jsx(ne,{size:14}),r("workers.setup_guide")]})]}),s==="fleet"&&e.jsx(ee,{value:l,onChange:t,options:k})]}),s==="fleet"?h?e.jsx(re,{cards:6}):!v||v.length===0?e.jsx(te,{icon:M,title:r("workers.no_workers_found"),description:r(l!=="all"?"workers.try_changing_status_filter":"workers.no_workers_registered"),action:e.jsx("button",{type:"button",onClick:()=>c("setup_guide"),className:"rounded-[4px] bg-[var(--accent)] px-5 py-2 text-[11px] font-bold text-black",children:r("workers.view_setup_guide")})}):e.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:(v??[]).map(a=>e.jsx(le,{worker:a,onClick:()=>d(`/workers/${a.id}`)},a.id))}):e.jsx(Y,{}),e.jsx(ce,{isOpen:m,onClose:()=>{i(!1),u(a=>a+1)},onRegistered:()=>{u(a=>a+1)}})]})]})}export{Ce as default};