@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 +1 @@
1
- import{f as Q,a as H,k as J,r,h as j,o as s,t as M,v as V,j as t,K as Z,l as z,G as W}from"./index-DvdpkDlU.js";import{E as X}from"./EmptyState-DpRw-xch.js";import{T as Y}from"./Skeleton-Bo0DEIHn.js";import{f as ee}from"./date-RFA7-ZGs.js";import{S as te}from"./Select-FmuTJbfh.js";import{P as re}from"./plus-C8aSzgHN.js";import{E as se}from"./external-link-B9CWNSMc.js";import{C as ae}from"./chevron-left-C_lJcnCg.js";import{C as oe}from"./chevron-right-IZlTWMcO.js";import"./chevron-down-CDFiGGBG.js";const ne=[s.QUEUED,s.ASSIGNED,s.RUNNING,s.SUSPENDED],ce=20;function ie(n,a){if(!n)return null;const v=n.repoUrl.replace(/\.git$/,"").replace(/\/+$/,""),c=a.split("/").map(encodeURIComponent).join("/");return n.gitPlatform===W.GITLAB?`${v}/-/tree/${c}/docs/specs`:`${v}/tree/${c}/docs/specs`}function le(n){switch(n){case s.RUNNING:return"bg-[var(--accent)]";case s.QUEUED:return"bg-[var(--warning)]";case s.ASSIGNED:return"bg-[var(--info)]";case s.SUSPENDED:return"bg-[var(--warning)]";case s.COMPLETED:return"bg-[var(--accent)]";case s.FAILED:return"bg-[var(--destructive)]";case s.CANCELLED:return"bg-[#525252]";default:return"bg-[#525252]"}}function je(){const n=Q(),{t:a}=H(),v=J(e=>e.taskSeq),[c,G]=r.useState("in_progress"),[y,w]=r.useState([]),[k,D]=r.useState(!0),[u,P]=r.useState(void 0),[g,N]=r.useState(void 0),[p,E]=r.useState([]),[h,T]=r.useState({}),[i,R]=r.useState([]),[x,L]=r.useState(""),[m,U]=r.useState(""),[S,_]=r.useState(!1),O=r.useMemo(()=>{const e={};for(const o of i)e[o.key]=o;return e},[i]);r.useEffect(()=>{let e=!1;return j.get("web/projects").json().then(o=>{e||R(o)}).catch(()=>{}),()=>{e=!0}},[]),r.useEffect(()=>{i.length>0&&!x&&L(i[0].key)},[i]);const A=r.useCallback(async e=>{D(!0);try{const o=new URLSearchParams({taskMode:"plan",limit:String(ce)});c==="in_progress"?o.set("status",ne.join(",")):o.set("status",s.COMPLETED+","+s.FAILED+","+s.CANCELLED),e&&o.set("cursor",e);const b=await j.get(`web/tasks?${o}`).json(),f=b.data??[];w(f),P(b.nextCursor);const l=f.filter(d=>d.status===s.COMPLETED).map(d=>d.id);if(l.length>0){const d={};await Promise.all(l.map(async C=>{try{const F=await j.get(`web/tasks?${new URLSearchParams({sourceTaskId:String(C),limit:"100"})}`).json();d[C]=(F.data??[]).length}catch{d[C]=0}})),T(d)}else T({})}catch{w([]),P(void 0)}finally{D(!1)}},[c]);r.useEffect(()=>{A(g)},[A,g,v]),r.useEffect(()=>{N(void 0),E([])},[c]);const K=r.useCallback(()=>{u&&(E(e=>[...e,g??""]),N(u))},[u,g]),B=r.useCallback(()=>{p.length!==0&&(N(p.at(-1)||void 0),E(e=>e.slice(0,-1)))},[p]),q=p.length+1,$=r.useCallback(async()=>{if(!x||!m.trim()){M.error("project and description are required.");return}_(!0);try{const e=await j.post("web/tasks",{json:{projectKey:x,description:m.trim(),taskMode:"plan"}}).json();U(""),n(`/tasks/${e.task.id}`)}catch(e){const o=e instanceof Error?e.message:String(e);M.error(o)}finally{_(!1)}},[x,m,n]),I=r.useMemo(()=>i.map(e=>({value:e.key,label:e.name})),[i]);return V(null),t.jsxs("div",{className:"mx-auto max-w-6xl px-2 py-4 md:px-4 md:py-6 font-mono",children:[t.jsx("h1",{className:"sr-only",children:a("plan.title")}),t.jsxs("div",{className:"mb-6 flex flex-col gap-2 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 md:flex-row md:items-center md:gap-3",children:[t.jsx(te,{value:x,onChange:L,options:I.length>0?I:[{value:"",label:"loading..."}],className:"md:w-44 shrink-0"}),t.jsx("input",{type:"text",placeholder:a("plan.description_placeholder"),value:m,onChange:e=>U(e.target.value),onKeyDown:e=>{e.key==="Enter"&&!S&&$()},className:"flex-1 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)]"}),t.jsxs("button",{onClick:$,disabled:S||!x||!m.trim(),className:"flex shrink-0 items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs font-mono text-black transition-opacity hover:opacity-90 disabled:opacity-40 disabled:cursor-not-allowed",children:[t.jsx(re,{className:"h-3.5 w-3.5"}),a(S?"common.creating":"plan.create")]})]}),t.jsx("div",{className:"mb-4 flex items-center gap-1 overflow-x-auto pb-1 no-scrollbar",children:["in_progress","completed"].map(e=>t.jsx("button",{onClick:()=>G(e),className:`shrink-0 rounded-[4px] px-3 py-2 h-8 text-xs transition-colors ${c===e?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)] bg-[var(--bg-card)] hover:text-[var(--text-secondary)]"}`,children:a(e==="in_progress"?"review.in_progress":"tasks.tab_completed")},e))}),t.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:[k&&y.length===0&&t.jsx("div",{className:"p-4",children:t.jsx(Y,{rows:4})}),!k&&y.length===0&&t.jsx(X,{icon:Z,title:a("plan.no_plans"),description:a("plan.description_placeholder")}),y.map(e=>t.jsxs("div",{onClick:()=>n(`/tasks/${e.id}`),className:"flex cursor-pointer items-center gap-3 border-b border-[var(--border)] px-4 py-3 last:border-b-0 hover:bg-[var(--bg-input)] transition-colors",children:[t.jsx("span",{className:`h-2 w-2 shrink-0 rounded-full ${le(e.status)}`}),t.jsxs("span",{className:"flex-1 truncate text-xs text-[var(--text-primary)]",children:["#",e.id," ",z(e)]}),e.status===s.COMPLETED&&h[e.id]!=null&&h[e.id]>0&&t.jsxs("span",{className:"shrink-0 rounded-[4px] px-2 py-0.5 text-[10px] font-bold",style:{color:"#3b82f6",backgroundColor:"rgba(59,130,246,0.12)"},title:`${h[e.id]} downstream task(s)`,children:[h[e.id]," tasks"]}),e.status===s.COMPLETED&&(()=>{const o=O[e.projectKey];if(!o)return null;let b="main";if(e.configSnapshot)try{const l=JSON.parse(e.configSnapshot);l.defaultBranch&&(b=l.defaultBranch)}catch{}const f=ie(o,b);return f?t.jsxs("a",{href:f,target:"_blank",rel:"noopener noreferrer",onClick:l=>l.stopPropagation(),className:"shrink-0 flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2 py-0.5 text-[10px] text-[var(--text-muted)] hover:text-[var(--info)] hover:border-[var(--info)] transition-colors",title:a("plan.view_spec"),children:[t.jsx(se,{className:"h-2.5 w-2.5"}),a("plan.view_spec")]}):null})(),t.jsx("span",{className:"shrink-0 rounded-[4px] border border-[var(--border)] px-2 py-0.5 text-[11px] text-[var(--text-muted)]",children:e.projectKey}),t.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:e.status.toLowerCase()}),t.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:ee(e.createdAt)})]},e.id))]}),(p.length>0||u)&&t.jsxs("div",{className:"mt-6 flex items-center justify-between",children:[t.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["// page ",q]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsxs("button",{onClick:B,disabled:p.length===0,className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1 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:[t.jsx(ae,{className:"h-3.5 w-3.5"}),a("tasks.prev")]}),t.jsxs("button",{onClick:K,disabled:!u,className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1 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:[a("common.next"),t.jsx(oe,{className:"h-3.5 w-3.5"})]})]})]})]})}export{je as default};
1
+ import{f as Q,a as H,k as J,r,h as j,o as s,t as M,w as V,j as t,O as Z,l as z,G as W}from"./index-DEBRwDiX.js";import{E as X}from"./EmptyState-CM34MS8q.js";import{T as Y}from"./Skeleton-DMVGjH__.js";import{f as ee}from"./date-RFA7-ZGs.js";import{S as te}from"./Select-Bxil-UGQ.js";import{P as re}from"./plus-Bh23dSc7.js";import{E as se}from"./external-link-kSTql_zg.js";import{C as ae}from"./chevron-left-CWC7W_zG.js";import{C as oe}from"./chevron-right-BDlNEjPF.js";import"./chevron-down-D9VkxIPs.js";const ne=[s.QUEUED,s.ASSIGNED,s.RUNNING,s.SUSPENDED],ce=20;function ie(n,a){if(!n)return null;const v=n.repoUrl.replace(/\.git$/,"").replace(/\/+$/,""),c=a.split("/").map(encodeURIComponent).join("/");return n.gitPlatform===W.GITLAB?`${v}/-/tree/${c}/docs/specs`:`${v}/tree/${c}/docs/specs`}function le(n){switch(n){case s.RUNNING:return"bg-[var(--accent)]";case s.QUEUED:return"bg-[var(--warning)]";case s.ASSIGNED:return"bg-[var(--info)]";case s.SUSPENDED:return"bg-[var(--warning)]";case s.COMPLETED:return"bg-[var(--accent)]";case s.FAILED:return"bg-[var(--destructive)]";case s.CANCELLED:return"bg-[#525252]";default:return"bg-[#525252]"}}function je(){const n=Q(),{t:a}=H(),v=J(e=>e.taskSeq),[c,G]=r.useState("in_progress"),[y,w]=r.useState([]),[k,D]=r.useState(!0),[u,P]=r.useState(void 0),[g,N]=r.useState(void 0),[p,E]=r.useState([]),[h,T]=r.useState({}),[i,O]=r.useState([]),[x,L]=r.useState(""),[m,U]=r.useState(""),[S,_]=r.useState(!1),R=r.useMemo(()=>{const e={};for(const o of i)e[o.key]=o;return e},[i]);r.useEffect(()=>{let e=!1;return j.get("web/projects").json().then(o=>{e||O(o)}).catch(()=>{}),()=>{e=!0}},[]),r.useEffect(()=>{i.length>0&&!x&&L(i[0].key)},[i]);const A=r.useCallback(async e=>{D(!0);try{const o=new URLSearchParams({taskMode:"plan",limit:String(ce)});c==="in_progress"?o.set("status",ne.join(",")):o.set("status",s.COMPLETED+","+s.FAILED+","+s.CANCELLED),e&&o.set("cursor",e);const b=await j.get(`web/tasks?${o}`).json(),f=b.data??[];w(f),P(b.nextCursor);const l=f.filter(d=>d.status===s.COMPLETED).map(d=>d.id);if(l.length>0){const d={};await Promise.all(l.map(async C=>{try{const F=await j.get(`web/tasks?${new URLSearchParams({sourceTaskId:String(C),limit:"100"})}`).json();d[C]=(F.data??[]).length}catch{d[C]=0}})),T(d)}else T({})}catch{w([]),P(void 0)}finally{D(!1)}},[c]);r.useEffect(()=>{A(g)},[A,g,v]),r.useEffect(()=>{N(void 0),E([])},[c]);const B=r.useCallback(()=>{u&&(E(e=>[...e,g??""]),N(u))},[u,g]),K=r.useCallback(()=>{p.length!==0&&(N(p.at(-1)||void 0),E(e=>e.slice(0,-1)))},[p]),q=p.length+1,$=r.useCallback(async()=>{if(!x||!m.trim()){M.error("project and description are required.");return}_(!0);try{const e=await j.post("web/tasks",{json:{projectKey:x,description:m.trim(),taskMode:"plan"}}).json();U(""),n(`/tasks/${e.task.id}`)}catch(e){const o=e instanceof Error?e.message:String(e);M.error(o)}finally{_(!1)}},[x,m,n]),I=r.useMemo(()=>i.map(e=>({value:e.key,label:e.name})),[i]);return V(null),t.jsxs("div",{className:"mx-auto max-w-6xl px-2 py-4 md:px-4 md:py-6 font-mono",children:[t.jsx("h1",{className:"sr-only",children:a("plan.title")}),t.jsxs("div",{className:"mb-6 flex flex-col gap-2 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 md:flex-row md:items-center md:gap-3",children:[t.jsx(te,{value:x,onChange:L,options:I.length>0?I:[{value:"",label:"loading..."}],className:"md:w-44 shrink-0"}),t.jsx("input",{type:"text",placeholder:a("plan.description_placeholder"),value:m,onChange:e=>U(e.target.value),onKeyDown:e=>{e.key==="Enter"&&!S&&$()},className:"flex-1 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)]"}),t.jsxs("button",{onClick:$,disabled:S||!x||!m.trim(),className:"flex shrink-0 items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs font-mono text-black transition-opacity hover:opacity-90 disabled:opacity-40 disabled:cursor-not-allowed",children:[t.jsx(re,{className:"h-3.5 w-3.5"}),a(S?"common.creating":"plan.create")]})]}),t.jsx("div",{className:"mb-4 flex items-center gap-1 overflow-x-auto pb-1 no-scrollbar",children:["in_progress","completed"].map(e=>t.jsx("button",{onClick:()=>G(e),className:`shrink-0 rounded-[4px] px-3 py-2 h-8 text-xs transition-colors ${c===e?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)] bg-[var(--bg-card)] hover:text-[var(--text-secondary)]"}`,children:a(e==="in_progress"?"review.in_progress":"tasks.tab_completed")},e))}),t.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:[k&&y.length===0&&t.jsx("div",{className:"p-4",children:t.jsx(Y,{rows:4})}),!k&&y.length===0&&t.jsx(X,{icon:Z,title:a("plan.no_plans"),description:a("plan.description_placeholder")}),y.map(e=>t.jsxs("div",{onClick:()=>n(`/tasks/${e.id}`),className:"flex cursor-pointer items-center gap-3 border-b border-[var(--border)] px-4 py-3 last:border-b-0 hover:bg-[var(--bg-input)] transition-colors",children:[t.jsx("span",{className:`h-2 w-2 shrink-0 rounded-full ${le(e.status)}`}),t.jsxs("span",{className:"flex-1 truncate text-xs text-[var(--text-primary)]",children:["#",e.id," ",z(e)]}),e.status===s.COMPLETED&&h[e.id]!=null&&h[e.id]>0&&t.jsxs("span",{className:"shrink-0 rounded-[4px] px-2 py-0.5 text-[10px] font-bold",style:{color:"#3b82f6",backgroundColor:"rgba(59,130,246,0.12)"},title:`${h[e.id]} downstream task(s)`,children:[h[e.id]," tasks"]}),e.status===s.COMPLETED&&(()=>{const o=R[e.projectKey];if(!o)return null;let b="main";if(e.configSnapshot)try{const l=JSON.parse(e.configSnapshot);l.defaultBranch&&(b=l.defaultBranch)}catch{}const f=ie(o,b);return f?t.jsxs("a",{href:f,target:"_blank",rel:"noopener noreferrer",onClick:l=>l.stopPropagation(),className:"shrink-0 flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2 py-0.5 text-[10px] text-[var(--text-muted)] hover:text-[var(--info)] hover:border-[var(--info)] transition-colors",title:a("plan.view_spec"),children:[t.jsx(se,{className:"h-2.5 w-2.5"}),a("plan.view_spec")]}):null})(),t.jsx("span",{className:"shrink-0 rounded-[4px] border border-[var(--border)] px-2 py-0.5 text-[11px] text-[var(--text-muted)]",children:e.projectKey}),t.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:e.status.toLowerCase()}),t.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:ee(e.createdAt)})]},e.id))]}),(p.length>0||u)&&t.jsxs("div",{className:"mt-6 flex items-center justify-between",children:[t.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["// page ",q]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsxs("button",{onClick:K,disabled:p.length===0,className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1 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:[t.jsx(ae,{className:"h-3.5 w-3.5"}),a("tasks.prev")]}),t.jsxs("button",{onClick:B,disabled:!u,className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1 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:[a("common.next"),t.jsx(oe,{className:"h-3.5 w-3.5"})]})]})]})]})}export{je as default};
@@ -1 +1 @@
1
- import{a as A,u as F,f as T,r as s,j as e,L as z,a0 as I,a1 as $,s as K,h as p,t as c}from"./index-DvdpkDlU.js";import{v as M}from"./password-CHk45-jw.js";import{I as o}from"./InfoRow-CTXIPrG6.js";import{u as V}from"./useFetch-CJDmNhIT.js";function Q(){var y,k,C,P;const{t:r}=A(),{logout:L}=F(),E=T(),[S,m]=s.useState(!1),{data:t,loading:U,refetch:D}=V(()=>p.get("web/profile").json(),[]),[x,u]=s.useState(""),[d,b]=s.useState(""),[f,v]=s.useState(""),[g,h]=s.useState(!1),[j,n]=s.useState(""),[i,_]=s.useState(""),[w,N]=s.useState(!1);async function O(){if(n(""),!x){n(r("profile.current_password_required"));return}if(!d){n(r("profile.new_password_required"));return}const a=M(d);if(a){n(r(a));return}if(d!==f){n(r("profile.passwords_do_not_match"));return}try{h(!0),await p.put("web/profile/password",{json:{currentPassword:x,newPassword:d}}),c.success(r("profile.password_changed")),u(""),b(""),v("")}catch(l){const q=l instanceof Error?l.message:r("profile.failed_to_change_password");n(q)}finally{h(!1)}}async function R(){if(!i||i.length!==6){c.error(r("profile.totp_code_required"));return}try{N(!0),await p.post("web/profile/totp/regenerate",{json:{code:i}}),c.success(r("profile.two_fa_regenerated")),_(""),D()}catch(a){const l=a instanceof Error?a.message:r("profile.totp_code_invalid");c.error(l)}finally{N(!1)}}return U?e.jsx("div",{className:"flex justify-center py-20",children:e.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-[var(--border)] border-t-[var(--accent)]"})}):e.jsxs("div",{className:"mx-auto max-w-xl space-y-8 px-4 md:px-6 py-8 font-mono lowercase",children:[e.jsxs("h1",{className:"text-lg text-[var(--text-primary)]",children:[r("profile.title")," ",e.jsx("span",{className:"text-[var(--text-muted)]",children:r("profile.personal_settings")})]}),e.jsxs("section",{className:"rounded-[4px] bg-[var(--bg-card)] border border-[var(--border)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("profile.profile_info")}),t?e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{variant:"fixed-label",label:r("profile.username"),value:t.name}),e.jsx(o,{variant:"fixed-label",label:r("common.role"),value:t.role}),e.jsx(o,{variant:"fixed-label",label:r("profile.git_name"),value:t.gitName||r("common.not_set")}),e.jsx(o,{variant:"fixed-label",label:r("profile.git_email"),value:t.gitEmail||r("common.not_set")}),e.jsx(o,{variant:"fixed-label",label:r("profile.status"),value:t.status}),e.jsx(o,{variant:"fixed-label",label:r("profile.created_at"),value:new Date(t.createdAt).toLocaleDateString()})]}):e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:r("profile.unable_to_load_profile")})]}),e.jsxs("section",{className:"rounded-[4px] bg-[var(--bg-card)] border border-[var(--border)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("profile.platform_accounts")}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{variant:"fixed-label",label:"lark",value:(y=t==null?void 0:t.platformUids)!=null&&y.lark?`${t.platformUids.lark.slice(0,12)}... ✓`:r("profile.not_linked")}),e.jsx(o,{variant:"fixed-label",label:"slack",value:(k=t==null?void 0:t.platformUids)!=null&&k.slack?`${t.platformUids.slack.slice(0,12)}... ✓`:r("profile.not_linked")})]}),(!((C=t==null?void 0:t.platformUids)!=null&&C.lark)||!((P=t==null?void 0:t.platformUids)!=null&&P.slack))&&e.jsx("p",{className:"mt-3 text-xs text-[var(--text-muted)]",children:r("profile.bind_hint")})]}),e.jsxs("section",{className:"rounded-[4px] bg-[var(--bg-card)] border border-[var(--border)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("profile.change_password")}),e.jsxs("div",{className:"space-y-4",children:[j&&e.jsx("div",{className:"rounded-[4px] border border-[var(--destructive)] bg-[var(--bg-input)] px-3 py-2 text-sm text-[var(--destructive)]",children:j}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-[var(--text-secondary)]",children:r("profile.current_password")}),e.jsx("input",{type:"password",value:x,onChange:a=>u(a.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-sm text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-[var(--text-secondary)]",children:r("profile.new_password")}),e.jsx("input",{type:"password",value:d,onChange:a=>b(a.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-sm text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"}),e.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:r("profile.password_hint_10_20")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-[var(--text-secondary)]",children:r("profile.confirm_password")}),e.jsx("input",{type:"password",value:f,onChange:a=>v(a.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-sm text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:O,disabled:g,className:"rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs font-medium text-black disabled:opacity-50",children:r(g?"common.updating":"profile.update_password")})})]})]}),e.jsxs("section",{className:"rounded-[4px] bg-[var(--bg-card)] border border-[var(--border)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("profile.two_factor_auth")}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex items-center gap-2 text-sm",children:t!=null&&t.totpEnabled?e.jsxs("span",{className:"text-[var(--accent)]",children:["● ",r("profile.two_fa_enabled")]}):e.jsxs("span",{className:"text-[var(--text-muted)]",children:["● ",r("profile.two_fa_not_setup")]})}),(t==null?void 0:t.totpEnabled)&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("profile.regenerate_2fa_warning")}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-[var(--text-secondary)]",children:r("profile.current_totp_code")}),e.jsx("input",{type:"text",inputMode:"numeric",maxLength:6,placeholder:r("profile.totp_code_placeholder"),value:i,onChange:a=>{const l=a.target.value.replace(/\D/g,"").slice(0,6);_(l)},className:"w-full max-w-xs rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-sm text-[var(--text-primary)] outline-none focus:border-[var(--accent)] font-mono tracking-widest"})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:R,disabled:w||i.length!==6,className:"rounded-[4px] border border-[var(--warning)] bg-transparent px-4 py-2 text-xs font-medium text-[var(--warning)] hover:bg-[var(--warning)] hover:text-black disabled:opacity-50 transition-colors",children:r(w?"profile.regenerating":"profile.regenerate_2fa")})})]})]})]}),e.jsxs(z,{to:"/access-tokens",className:"flex items-center gap-3 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 transition-colors hover:border-[var(--accent)]",children:[e.jsx(I,{size:16,className:"text-[var(--accent)]"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-[var(--text-primary)]",children:r("profile.access_tokens")}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("profile.access_tokens_desc")})]})]}),e.jsxs("button",{onClick:()=>m(!0),className:"flex w-full items-center gap-3 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 transition-colors hover:border-[var(--destructive)] text-left",children:[e.jsx($,{size:16,className:"text-[var(--destructive)]"}),e.jsx("span",{className:"text-sm text-[var(--destructive)]",children:r("common.log_out")})]}),e.jsxs("div",{className:"pt-2 pb-4 text-center text-xs text-[var(--text-muted)]",children:["overlord v","1.0.144"]}),e.jsx(K,{isOpen:S,onClose:()=>m(!1),onConfirm:()=>{L(),E("/login")},title:r("common.logout_title"),message:r("common.logout_message"),confirmLabel:r("common.logout"),confirmVariant:"warning"})]})}export{Q as default};
1
+ import{a as A,u as F,f as T,r as s,j as e,L as z,a5 as I,a6 as $,s as K,h as p,t as c}from"./index-DEBRwDiX.js";import{v as M}from"./password-CHk45-jw.js";import{I as o}from"./InfoRow-BkLVrW3X.js";import{u as V}from"./useFetch-_325GIxD.js";function Q(){var y,k,C,P;const{t:r}=A(),{logout:L}=F(),E=T(),[S,m]=s.useState(!1),{data:t,loading:U,refetch:D}=V(()=>p.get("web/profile").json(),[]),[x,u]=s.useState(""),[d,b]=s.useState(""),[f,v]=s.useState(""),[g,h]=s.useState(!1),[j,n]=s.useState(""),[i,_]=s.useState(""),[w,N]=s.useState(!1);async function O(){if(n(""),!x){n(r("profile.current_password_required"));return}if(!d){n(r("profile.new_password_required"));return}const a=M(d);if(a){n(r(a));return}if(d!==f){n(r("profile.passwords_do_not_match"));return}try{h(!0),await p.put("web/profile/password",{json:{currentPassword:x,newPassword:d}}),c.success(r("profile.password_changed")),u(""),b(""),v("")}catch(l){const q=l instanceof Error?l.message:r("profile.failed_to_change_password");n(q)}finally{h(!1)}}async function R(){if(!i||i.length!==6){c.error(r("profile.totp_code_required"));return}try{N(!0),await p.post("web/profile/totp/regenerate",{json:{code:i}}),c.success(r("profile.two_fa_regenerated")),_(""),D()}catch(a){const l=a instanceof Error?a.message:r("profile.totp_code_invalid");c.error(l)}finally{N(!1)}}return U?e.jsx("div",{className:"flex justify-center py-20",children:e.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-[var(--border)] border-t-[var(--accent)]"})}):e.jsxs("div",{className:"mx-auto max-w-xl space-y-8 px-4 md:px-6 py-8 font-mono lowercase",children:[e.jsxs("h1",{className:"text-lg text-[var(--text-primary)]",children:[r("profile.title")," ",e.jsx("span",{className:"text-[var(--text-muted)]",children:r("profile.personal_settings")})]}),e.jsxs("section",{className:"rounded-[4px] bg-[var(--bg-card)] border border-[var(--border)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("profile.profile_info")}),t?e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{variant:"fixed-label",label:r("profile.username"),value:t.name}),e.jsx(o,{variant:"fixed-label",label:r("common.role"),value:t.role}),e.jsx(o,{variant:"fixed-label",label:r("profile.git_name"),value:t.gitName||r("common.not_set")}),e.jsx(o,{variant:"fixed-label",label:r("profile.git_email"),value:t.gitEmail||r("common.not_set")}),e.jsx(o,{variant:"fixed-label",label:r("profile.status"),value:t.status}),e.jsx(o,{variant:"fixed-label",label:r("profile.created_at"),value:new Date(t.createdAt).toLocaleDateString()})]}):e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:r("profile.unable_to_load_profile")})]}),e.jsxs("section",{className:"rounded-[4px] bg-[var(--bg-card)] border border-[var(--border)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("profile.platform_accounts")}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{variant:"fixed-label",label:"lark",value:(y=t==null?void 0:t.platformUids)!=null&&y.lark?`${t.platformUids.lark.slice(0,12)}... ✓`:r("profile.not_linked")}),e.jsx(o,{variant:"fixed-label",label:"slack",value:(k=t==null?void 0:t.platformUids)!=null&&k.slack?`${t.platformUids.slack.slice(0,12)}... ✓`:r("profile.not_linked")})]}),(!((C=t==null?void 0:t.platformUids)!=null&&C.lark)||!((P=t==null?void 0:t.platformUids)!=null&&P.slack))&&e.jsx("p",{className:"mt-3 text-xs text-[var(--text-muted)]",children:r("profile.bind_hint")})]}),e.jsxs("section",{className:"rounded-[4px] bg-[var(--bg-card)] border border-[var(--border)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("profile.change_password")}),e.jsxs("div",{className:"space-y-4",children:[j&&e.jsx("div",{className:"rounded-[4px] border border-[var(--destructive)] bg-[var(--bg-input)] px-3 py-2 text-sm text-[var(--destructive)]",children:j}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-[var(--text-secondary)]",children:r("profile.current_password")}),e.jsx("input",{type:"password",value:x,onChange:a=>u(a.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-sm text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-[var(--text-secondary)]",children:r("profile.new_password")}),e.jsx("input",{type:"password",value:d,onChange:a=>b(a.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-sm text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"}),e.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:r("profile.password_hint_10_20")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-[var(--text-secondary)]",children:r("profile.confirm_password")}),e.jsx("input",{type:"password",value:f,onChange:a=>v(a.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-sm text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:O,disabled:g,className:"rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs font-medium text-black disabled:opacity-50",children:r(g?"common.updating":"profile.update_password")})})]})]}),e.jsxs("section",{className:"rounded-[4px] bg-[var(--bg-card)] border border-[var(--border)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("profile.two_factor_auth")}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex items-center gap-2 text-sm",children:t!=null&&t.totpEnabled?e.jsxs("span",{className:"text-[var(--accent)]",children:["● ",r("profile.two_fa_enabled")]}):e.jsxs("span",{className:"text-[var(--text-muted)]",children:["● ",r("profile.two_fa_not_setup")]})}),(t==null?void 0:t.totpEnabled)&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("profile.regenerate_2fa_warning")}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-[var(--text-secondary)]",children:r("profile.current_totp_code")}),e.jsx("input",{type:"text",inputMode:"numeric",maxLength:6,placeholder:r("profile.totp_code_placeholder"),value:i,onChange:a=>{const l=a.target.value.replace(/\D/g,"").slice(0,6);_(l)},className:"w-full max-w-xs rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-sm text-[var(--text-primary)] outline-none focus:border-[var(--accent)] font-mono tracking-widest"})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:R,disabled:w||i.length!==6,className:"rounded-[4px] border border-[var(--warning)] bg-transparent px-4 py-2 text-xs font-medium text-[var(--warning)] hover:bg-[var(--warning)] hover:text-black disabled:opacity-50 transition-colors",children:r(w?"profile.regenerating":"profile.regenerate_2fa")})})]})]})]}),e.jsxs(z,{to:"/access-tokens",className:"flex items-center gap-3 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 transition-colors hover:border-[var(--accent)]",children:[e.jsx(I,{size:16,className:"text-[var(--accent)]"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-[var(--text-primary)]",children:r("profile.access_tokens")}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("profile.access_tokens_desc")})]})]}),e.jsxs("button",{onClick:()=>m(!0),className:"flex w-full items-center gap-3 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 transition-colors hover:border-[var(--destructive)] text-left",children:[e.jsx($,{size:16,className:"text-[var(--destructive)]"}),e.jsx("span",{className:"text-sm text-[var(--destructive)]",children:r("common.log_out")})]}),e.jsxs("div",{className:"pt-2 pb-4 text-center text-xs text-[var(--text-muted)]",children:["overlord v","1.0.145"]}),e.jsx(K,{isOpen:S,onClose:()=>m(!1),onConfirm:()=>{L(),E("/login")},title:r("common.logout_title"),message:r("common.logout_message"),confirmLabel:r("common.logout"),confirmVariant:"warning"})]})}export{Q as default};
@@ -1,7 +1,7 @@
1
- import{c as R,a as $,j as e,s as q,z as K,f as z,u as B,i as H,r as x,Y as k,v as J,l as D,Z as V,h}from"./index-DvdpkDlU.js";import{U as P,A as Y,R as Z}from"./RemoveMemberConfirmDialog-MiS_sqor.js";import{T as G}from"./Tooltip-BKRBwA7o.js";import{c as _}from"./date-RFA7-ZGs.js";import{t as T}from"./status-colors-0U8b2F2t.js";import{I as o}from"./InfoRow-CTXIPrG6.js";import{u as Q}from"./useFetch-CJDmNhIT.js";import{P as X}from"./pencil-C_niWuAb.js";import{T as ee}from"./trash-2-tEkzRo6q.js";import{A as te}from"./arrow-left-CR_n40mK.js";import{P as re}from"./plus-C8aSzgHN.js";import"./Select-FmuTJbfh.js";import"./chevron-down-CDFiGGBG.js";/**
1
+ import{c as R,a as $,j as e,s as q,A as K,f as B,u as H,i as J,r as x,Z as k,w as V,l as D,_ as Z,h as v}from"./index-DEBRwDiX.js";import{U as P,A as z,R as G}from"./RemoveMemberConfirmDialog-gr2WUWrR.js";import{T as Q}from"./Tooltip-3_9w-Oet.js";import{c as _}from"./date-RFA7-ZGs.js";import{t as T}from"./status-colors-CpxhEwhO.js";import{I as o}from"./InfoRow-BkLVrW3X.js";import{u as X}from"./useFetch-_325GIxD.js";import{P as Y}from"./pencil-COk9Cf4n.js";import{T as ee}from"./trash-2-CGFhXY_R.js";import{A as te}from"./arrow-left-BDjYIP3Y.js";import{P as re}from"./plus-Bh23dSc7.js";import"./Select-Bxil-UGQ.js";import"./chevron-down-D9VkxIPs.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const se=R("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);function ae({isOpen:n,onClose:a,onConfirm:r,projectName:m,loading:p}){const{t:j}=$();return e.jsx(q,{isOpen:n,onClose:a,onConfirm:r,title:`> ${j("projects.delete_project")}`,message:j("projects.delete_project_confirm",{name:m}),confirmLabel:j("projects.delete_project"),confirmVariant:"danger",isLoading:p})}function ue(){const{key:n}=K(),a=z(),{t:r}=$(),m=B(t=>t.user),p=H(),[j,N]=x.useState(!1),[L,C]=x.useState(!1),[S,A]=x.useState(!1),[d,u]=x.useState(null),[W,I]=x.useState(!1),{data:l,loading:F,error:M,refetch:y}=Q(async()=>{if(!n)throw new Error("Missing project key");const[t,w,f]=await Promise.all([h.get(`web/projects/${n}`).json(),h.get(`web/projects/${n}/members`).json().catch(()=>[]),h.get("web/tasks",{searchParams:{projectKey:n,limit:"20"}}).json().then(U=>U.data).catch(()=>[])]);let v=null;if(t.pipeline)try{v=JSON.parse(t.pipeline)}catch{}return{project:t,members:w,tasks:f,pipelineConfig:v}},[n]),s=(l==null?void 0:l.project)??null,b=(l==null?void 0:l.members)??[],g=(l==null?void 0:l.tasks)??[],i=(l==null?void 0:l.pipelineConfig)??null,c=p||b.some(t=>t.developerId===(m==null?void 0:m.id)&&t.role===k.MAINTAINER);J(x.useMemo(()=>s?e.jsxs(e.Fragment,{children:[c&&e.jsxs("button",{onClick:()=>a(`/projects/${s.key}/edit`),className:"flex items-center gap-1.5 rounded-[4px] border border-[var(--border)] bg-transparent px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)]",children:[e.jsx(X,{className:"h-3 w-3"}),r("common.edit")]}),p&&e.jsxs("button",{onClick:()=>N(!0),className:"flex items-center gap-1.5 rounded-[4px] border border-[var(--destructive)] bg-transparent px-3 py-1.5 text-xs text-[var(--destructive)] hover:bg-[var(--destructive)] hover:text-white",children:[e.jsx(ee,{className:"h-3 w-3"}),r("common.delete")]})]}):null,[s,c,p,a,r]));async function O(){if(s){C(!0);try{await h.delete(`admin/projects/${s.key}`),a("/projects")}catch{}finally{C(!1),N(!1)}}}async function E(){if(!(!s||!d)){I(!0);try{await h.delete(`web/projects/${s.key}/members`,{searchParams:{developerId:String(d.developerId)}}),await y()}catch{}finally{I(!1),u(null)}}}return F?e.jsx("div",{className:"flex justify-center py-20",children:e.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-[var(--border)] border-t-[var(--accent)]"})}):M?e.jsxs("div",{className:"mx-auto max-w-4xl px-4 md:px-6 py-8 text-center",children:[e.jsx("p",{className:"text-sm text-[var(--destructive)]",children:M}),e.jsx("button",{onClick:()=>y(),className:"mt-4 rounded-[4px] border border-[var(--border)] bg-transparent px-4 py-2 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)]",children:r("common.retry")})]}):s?e.jsxs("div",{className:"mx-auto max-w-6xl",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:()=>a("/projects"),className:"shrink-0 text-[var(--text-muted)]",children:e.jsx(te,{className:"h-4 w-4"})}),e.jsxs("span",{className:"truncate text-sm font-medium text-[var(--text-primary)]",children:[s.key," — ",s.name]})]}),e.jsxs("div",{className:"px-4 md:px-6 py-8",children:[e.jsxs("div",{className:"mb-2 hidden md:block text-xs text-[var(--text-muted)]",children:[e.jsx("span",{className:"cursor-pointer hover:text-[var(--text-secondary)]",onClick:()=>a("/projects"),children:r("projects.title")})," / ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:s.key})]}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-[1fr_340px]",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("section",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 md:p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("projects.project_info")}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{variant:"fixed-label",labelWidth:"w-32",label:r("projects.key"),value:s.key}),e.jsx(o,{variant:"fixed-label",labelWidth:"w-32",label:r("projects.name"),value:s.name}),e.jsx(o,{variant:"fixed-label",labelWidth:"w-32",label:r("projects.repo_url"),value:s.repoUrl,href:s.repoUrl}),s.sshUrl&&e.jsx(o,{variant:"fixed-label",labelWidth:"w-32",label:r("projects.ssh_url"),value:s.sshUrl}),e.jsx(o,{variant:"fixed-label",labelWidth:"w-32",label:r("projects.git_platform"),value:s.gitPlatform}),e.jsx(o,{variant:"fixed-label",labelWidth:"w-32",label:r("projects.default_branch"),value:s.defaultBranch}),e.jsx(o,{variant:"fixed-label",labelWidth:"w-32",label:r("projects.agent_type"),value:s.agentType}),e.jsx(o,{variant:"fixed-label",labelWidth:"w-32",label:r("projects.max_turns"),value:String(s.maxTurns)}),e.jsx(o,{variant:"fixed-label",labelWidth:"w-32",label:r("projects.allowed_tools"),value:s.allowedTools??"all"}),e.jsx(o,{variant:"fixed-label",labelWidth:"w-32",label:r("projects.default_project"),value:s.isDefault?"yes":"no"})]})]}),e.jsxs("section",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 md:p-5",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsx("h2",{className:"text-sm font-semibold text-[var(--accent)]",children:r("projects.members")}),c&&e.jsxs("button",{onClick:()=>A(!0),className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs font-medium text-black",children:[e.jsx(re,{className:"h-3.5 w-3.5"}),r("projects.add_member")]})]}),b.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-6",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:r("projects.no_members_yet")})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-col gap-2 md:hidden",children:b.map(t=>e.jsxs("div",{className:"flex items-center justify-between rounded-[4px] border border-[var(--border)] p-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block text-xs text-[var(--text-primary)]",children:t.developerName??`#${t.developerId}`}),e.jsx("span",{className:"block text-[11px] mt-0.5",style:{color:t.role===k.MAINTAINER?"var(--warning)":"var(--text-muted)"},children:t.role})]}),c&&e.jsx("button",{onClick:()=>u(t),className:"shrink-0 text-[var(--destructive)] hover:underline ml-2","aria-label":r("projects.remove_member"),children:e.jsx(P,{className:"h-3.5 w-3.5"})})]},t.developerId))}),e.jsx("div",{className:"hidden md:block overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border-row)]",children:[e.jsx("th",{className:"pb-2 text-left text-xs font-medium text-[var(--text-muted)]",children:r("projects.name")}),e.jsx("th",{className:"pb-2 text-left text-xs font-medium text-[var(--text-muted)]",children:r("projects.role")}),e.jsx("th",{className:"pb-2 text-left text-xs font-medium text-[var(--text-muted)]",children:r("projects.added_at")}),c&&e.jsx("th",{className:"pb-2 text-right text-xs font-medium text-[var(--text-muted)]",children:r("common.actions")})]})}),e.jsx("tbody",{children:b.map(t=>e.jsxs("tr",{className:"border-b border-[var(--border-row)] last:border-b-0",children:[e.jsx("td",{className:"py-2.5 text-sm text-[var(--text-primary)]",children:t.developerName??`#${t.developerId}`}),e.jsx("td",{className:"py-2.5 text-sm",style:{color:t.role===k.MAINTAINER?"var(--warning)":"var(--text-secondary)"},children:t.role}),e.jsx("td",{className:"py-2.5 text-sm text-[var(--text-secondary)]",children:_(t.createdAt)}),c&&e.jsx("td",{className:"py-2.5 text-right",children:e.jsx("button",{onClick:()=>u(t),className:"text-[var(--destructive)] hover:underline","aria-label":r("projects.remove_member"),children:e.jsx(P,{className:"h-3.5 w-3.5"})})})]},t.developerId))})]})})]})]}),e.jsxs("section",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 md:p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("projects.recent_tasks")}),g.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-6",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:r("projects.no_tasks_for_project")})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-col gap-2 md:hidden",children:g.map(t=>e.jsxs("div",{className:"cursor-pointer rounded-[4px] border border-[var(--border)] p-3 transition-colors active:bg-[var(--bg-input)]",onClick:()=>a(`/tasks/${t.id}`),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:t.description,children:["#",t.id," ",D(t)]}),e.jsx("span",{className:"shrink-0 text-[11px]",style:{color:T[t.status]},children:t.status})]}),e.jsx("span",{className:"text-[11px] text-[var(--text-muted)] mt-1 block",children:_(t.createdAt)})]},t.id))}),e.jsx("div",{className:"hidden md:block overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border-row)]",children:[e.jsx("th",{className:"pb-2 text-left text-xs font-medium text-[var(--text-muted)]",children:r("projects.id")}),e.jsx("th",{className:"pb-2 text-left text-xs font-medium text-[var(--text-muted)]",children:r("projects.description")}),e.jsx("th",{className:"pb-2 text-left text-xs font-medium text-[var(--text-muted)]",children:r("projects.status")}),e.jsx("th",{className:"pb-2 text-left text-xs font-medium text-[var(--text-muted)]",children:r("projects.created")})]})}),e.jsx("tbody",{children:g.map(t=>e.jsxs("tr",{className:"cursor-pointer border-b border-[var(--border-row)] last:border-b-0 hover:bg-[var(--bg-input)]",onClick:()=>a(`/tasks/${t.id}`),children:[e.jsxs("td",{className:"py-2.5 text-sm text-[var(--text-secondary)]",children:["#",t.id]}),e.jsx("td",{className:"max-w-xs truncate py-2.5 text-sm text-[var(--text-primary)]",children:e.jsx(G,{content:t.description,children:D(t)})}),e.jsx("td",{className:"py-2.5 text-sm",style:{color:T[t.status]},children:t.status}),e.jsx("td",{className:"py-2.5 text-sm text-[var(--text-secondary)]",children:_(t.createdAt)})]},t.id))})]})})]})]})]}),e.jsx("div",{children:e.jsxs("section",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 md:p-5",children:[e.jsx("h2",{className:"mb-4 text-[13px] font-medium text-[var(--accent)]",children:r("projects.pipeline")}),e.jsx("div",{className:"mb-3 h-px bg-[var(--border)]"}),i!=null&&i.stages&&i.stages.length>0?e.jsx("div",{className:"flex flex-col items-center",children:i.stages.map((t,w)=>{var f,v;return e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:"flex items-center justify-between rounded-[4px] bg-[var(--bg-input)] px-3 py-2.5 cursor-pointer hover:bg-[var(--bg-secondary)]",style:{borderLeft:"3px solid var(--accent)"},onClick:()=>a(`/projects/${s.key}/pipeline`),children:[e.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[e.jsx("span",{className:"text-xs font-medium text-[var(--text-primary)]",children:t.label??t.name}),t.prompt&&e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)] truncate",children:["// ",t.prompt.split(`
7
- `)[0].slice(0,40)]})]}),e.jsx("div",{className:"flex items-center gap-2 shrink-0",children:t.requireConfirm&&e.jsx("span",{className:"rounded-[4px] px-2 py-0.5 text-[11px] font-medium text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:r("projects.confirm_label")})})]}),((f=t.onFailure)==null?void 0:f.goto)&&e.jsxs("div",{className:"flex items-center justify-center gap-1.5 py-1",children:[e.jsx(V,{className:"h-3 w-3 text-[var(--warning)]"}),e.jsxs("span",{className:"text-[11px] text-[var(--warning)]",children:["onFailure.goto: ",t.onFailure.goto,", maxLoops: ",t.onFailure.maxLoops]})]}),w<i.stages.length-1&&!((v=t.onFailure)!=null&&v.goto)&&e.jsx("div",{className:"flex justify-center py-1",children:e.jsx(se,{className:"h-3.5 w-3.5 text-[var(--text-muted)]"})})]},t.name)})}):e.jsx("div",{className:"py-6 text-center text-xs text-[var(--text-muted)]",children:r("projects.no_pipeline_configured")}),c&&e.jsx("button",{onClick:()=>a(`/projects/${s.key}/pipeline`),className:"mt-3 flex w-full items-center justify-center gap-1.5 py-2 text-xs text-[var(--accent)] hover:text-[var(--accent)]",children:r("projects.add_stage")})]})})]}),e.jsx(ae,{isOpen:j,onClose:()=>N(!1),onConfirm:O,projectName:s.name,loading:L}),e.jsx(Y,{isOpen:S,onClose:()=>A(!1),projectKey:s.key,existingMemberIds:b.map(t=>t.developerId),onAdded:y}),e.jsx(Z,{isOpen:!!d,onClose:()=>u(null),onConfirm:E,memberName:d?d.developerName??`#${d.developerId}`:"",loading:W})]})]}):e.jsxs("div",{className:"mx-auto max-w-4xl px-4 md:px-6 py-8 text-center",children:[e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:r("projects.project_not_found")}),e.jsx("button",{onClick:()=>a("/projects"),className:"mt-4 rounded-[4px] border border-[var(--border)] bg-transparent px-4 py-2 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)]",children:r("projects.back_to_projects")})]})}export{ue as default};
6
+ */const se=R("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);function ae({isOpen:n,onClose:a,onConfirm:r,projectName:m,loading:p}){const{t:j}=$();return e.jsx(q,{isOpen:n,onClose:a,onConfirm:r,title:`> ${j("projects.delete_project")}`,message:j("projects.delete_project_confirm",{name:m}),confirmLabel:j("projects.delete_project"),confirmVariant:"danger",isLoading:p})}function ue(){const{key:n}=K(),a=B(),{t:r}=$(),m=H(t=>t.user),p=J(),[j,N]=x.useState(!1),[L,C]=x.useState(!1),[S,A]=x.useState(!1),[d,u]=x.useState(null),[W,I]=x.useState(!1),{data:l,loading:F,error:M,refetch:y}=X(async()=>{if(!n)throw new Error("Missing project key");const[t,w,f]=await Promise.all([v.get(`web/projects/${n}`).json(),v.get(`web/projects/${n}/members`).json().catch(()=>[]),v.get("web/tasks",{searchParams:{projectKey:n,limit:"20"}}).json().then(U=>U.data).catch(()=>[])]);let h=null;if(t.pipeline)try{h=JSON.parse(t.pipeline)}catch{}return{project:t,members:w,tasks:f,pipelineConfig:h}},[n]),s=(l==null?void 0:l.project)??null,b=(l==null?void 0:l.members)??[],g=(l==null?void 0:l.tasks)??[],i=(l==null?void 0:l.pipelineConfig)??null,c=p||b.some(t=>t.developerId===(m==null?void 0:m.id)&&t.role===k.MAINTAINER);V(x.useMemo(()=>s?e.jsxs(e.Fragment,{children:[c&&e.jsxs("button",{onClick:()=>a(`/projects/${s.key}/edit`),className:"flex items-center gap-1.5 rounded-[4px] border border-[var(--border)] bg-transparent px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)]",children:[e.jsx(Y,{className:"h-3 w-3"}),r("common.edit")]}),p&&e.jsxs("button",{onClick:()=>N(!0),className:"flex items-center gap-1.5 rounded-[4px] border border-[var(--destructive)] bg-transparent px-3 py-1.5 text-xs text-[var(--destructive)] hover:bg-[var(--destructive)] hover:text-white",children:[e.jsx(ee,{className:"h-3 w-3"}),r("common.delete")]})]}):null,[s,c,p,a,r]));async function O(){if(s){C(!0);try{await v.delete(`admin/projects/${s.key}`),a("/projects")}catch{}finally{C(!1),N(!1)}}}async function E(){if(!(!s||!d)){I(!0);try{await v.delete(`web/projects/${s.key}/members`,{searchParams:{developerId:String(d.developerId)}}),await y()}catch{}finally{I(!1),u(null)}}}return F?e.jsx("div",{className:"flex justify-center py-20",children:e.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-[var(--border)] border-t-[var(--accent)]"})}):M?e.jsxs("div",{className:"mx-auto max-w-4xl px-4 md:px-6 py-8 text-center",children:[e.jsx("p",{className:"text-sm text-[var(--destructive)]",children:M}),e.jsx("button",{onClick:()=>y(),className:"mt-4 rounded-[4px] border border-[var(--border)] bg-transparent px-4 py-2 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)]",children:r("common.retry")})]}):s?e.jsxs("div",{className:"mx-auto max-w-6xl",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:()=>a("/projects"),className:"shrink-0 text-[var(--text-muted)]",children:e.jsx(te,{className:"h-4 w-4"})}),e.jsxs("span",{className:"truncate text-sm font-medium text-[var(--text-primary)]",children:[s.key," — ",s.name]})]}),e.jsxs("div",{className:"px-4 md:px-6 py-8",children:[e.jsxs("div",{className:"mb-2 hidden md:block text-xs text-[var(--text-muted)]",children:[e.jsx("span",{className:"cursor-pointer hover:text-[var(--text-secondary)]",onClick:()=>a("/projects"),children:r("projects.title")})," / ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:s.key})]}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-[1fr_340px]",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("section",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 md:p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("projects.project_info")}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{variant:"fixed-label",labelWidth:"w-32",label:r("projects.key"),value:s.key}),e.jsx(o,{variant:"fixed-label",labelWidth:"w-32",label:r("projects.name"),value:s.name}),e.jsx(o,{variant:"fixed-label",labelWidth:"w-32",label:r("projects.repo_url"),value:s.repoUrl,href:s.repoUrl}),s.sshUrl&&e.jsx(o,{variant:"fixed-label",labelWidth:"w-32",label:r("projects.ssh_url"),value:s.sshUrl}),e.jsx(o,{variant:"fixed-label",labelWidth:"w-32",label:r("projects.git_platform"),value:s.gitPlatform}),e.jsx(o,{variant:"fixed-label",labelWidth:"w-32",label:r("projects.default_branch"),value:s.defaultBranch}),e.jsx(o,{variant:"fixed-label",labelWidth:"w-32",label:r("projects.agent_type"),value:s.agentType}),e.jsx(o,{variant:"fixed-label",labelWidth:"w-32",label:r("projects.max_turns"),value:String(s.maxTurns)}),e.jsx(o,{variant:"fixed-label",labelWidth:"w-32",label:r("projects.allowed_tools"),value:s.allowedTools??"all"}),e.jsx(o,{variant:"fixed-label",labelWidth:"w-32",label:r("projects.default_project"),value:s.isDefault?"yes":"no"})]})]}),e.jsxs("section",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 md:p-5",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsx("h2",{className:"text-sm font-semibold text-[var(--accent)]",children:r("projects.members")}),c&&e.jsxs("button",{onClick:()=>A(!0),className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs font-medium text-black",children:[e.jsx(re,{className:"h-3.5 w-3.5"}),r("projects.add_member")]})]}),b.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-6",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:r("projects.no_members_yet")})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-col gap-2 md:hidden",children:b.map(t=>e.jsxs("div",{className:"flex items-center justify-between rounded-[4px] border border-[var(--border)] p-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block text-xs text-[var(--text-primary)]",children:t.developerName??`#${t.developerId}`}),e.jsx("span",{className:"block text-[11px] mt-0.5",style:{color:t.role===k.MAINTAINER?"var(--warning)":"var(--text-muted)"},children:t.role})]}),c&&e.jsx("button",{onClick:()=>u(t),className:"shrink-0 text-[var(--destructive)] hover:underline ml-2","aria-label":r("projects.remove_member"),children:e.jsx(P,{className:"h-3.5 w-3.5"})})]},t.developerId))}),e.jsx("div",{className:"hidden md:block overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border-row)]",children:[e.jsx("th",{className:"pb-2 text-left text-xs font-medium text-[var(--text-muted)]",children:r("projects.name")}),e.jsx("th",{className:"pb-2 text-left text-xs font-medium text-[var(--text-muted)]",children:r("projects.role")}),e.jsx("th",{className:"pb-2 text-left text-xs font-medium text-[var(--text-muted)]",children:r("projects.added_at")}),c&&e.jsx("th",{className:"pb-2 text-right text-xs font-medium text-[var(--text-muted)]",children:r("common.actions")})]})}),e.jsx("tbody",{children:b.map(t=>e.jsxs("tr",{className:"border-b border-[var(--border-row)] last:border-b-0",children:[e.jsx("td",{className:"py-2.5 text-sm text-[var(--text-primary)]",children:t.developerName??`#${t.developerId}`}),e.jsx("td",{className:"py-2.5 text-sm",style:{color:t.role===k.MAINTAINER?"var(--warning)":"var(--text-secondary)"},children:t.role}),e.jsx("td",{className:"py-2.5 text-sm text-[var(--text-secondary)]",children:_(t.createdAt)}),c&&e.jsx("td",{className:"py-2.5 text-right",children:e.jsx("button",{onClick:()=>u(t),className:"text-[var(--destructive)] hover:underline","aria-label":r("projects.remove_member"),children:e.jsx(P,{className:"h-3.5 w-3.5"})})})]},t.developerId))})]})})]})]}),e.jsxs("section",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 md:p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("projects.recent_tasks")}),g.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-6",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:r("projects.no_tasks_for_project")})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-col gap-2 md:hidden",children:g.map(t=>e.jsxs("div",{className:"cursor-pointer rounded-[4px] border border-[var(--border)] p-3 transition-colors active:bg-[var(--bg-input)]",onClick:()=>a(`/tasks/${t.id}`),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:t.description,children:["#",t.id," ",D(t)]}),e.jsx("span",{className:"shrink-0 text-[11px]",style:{color:T[t.status]},children:t.status})]}),e.jsx("span",{className:"text-[11px] text-[var(--text-muted)] mt-1 block",children:_(t.createdAt)})]},t.id))}),e.jsx("div",{className:"hidden md:block overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border-row)]",children:[e.jsx("th",{className:"pb-2 text-left text-xs font-medium text-[var(--text-muted)]",children:r("projects.id")}),e.jsx("th",{className:"pb-2 text-left text-xs font-medium text-[var(--text-muted)]",children:r("projects.description")}),e.jsx("th",{className:"pb-2 text-left text-xs font-medium text-[var(--text-muted)]",children:r("projects.status")}),e.jsx("th",{className:"pb-2 text-left text-xs font-medium text-[var(--text-muted)]",children:r("projects.created")})]})}),e.jsx("tbody",{children:g.map(t=>e.jsxs("tr",{className:"cursor-pointer border-b border-[var(--border-row)] last:border-b-0 hover:bg-[var(--bg-input)]",onClick:()=>a(`/tasks/${t.id}`),children:[e.jsxs("td",{className:"py-2.5 text-sm text-[var(--text-secondary)]",children:["#",t.id]}),e.jsx("td",{className:"max-w-xs truncate py-2.5 text-sm text-[var(--text-primary)]",children:e.jsx(Q,{content:t.description,children:D(t)})}),e.jsx("td",{className:"py-2.5 text-sm",style:{color:T[t.status]},children:t.status}),e.jsx("td",{className:"py-2.5 text-sm text-[var(--text-secondary)]",children:_(t.createdAt)})]},t.id))})]})})]})]})]}),e.jsx("div",{children:e.jsxs("section",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 md:p-5",children:[e.jsx("h2",{className:"mb-4 text-[13px] font-medium text-[var(--accent)]",children:r("projects.pipeline")}),e.jsx("div",{className:"mb-3 h-px bg-[var(--border)]"}),i!=null&&i.stages&&i.stages.length>0?e.jsx("div",{className:"flex flex-col items-center",children:i.stages.map((t,w)=>{var f,h;return e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:"flex items-center justify-between rounded-[4px] bg-[var(--bg-input)] px-3 py-2.5 cursor-pointer hover:bg-[var(--bg-secondary)]",style:{borderLeft:"3px solid var(--accent)"},onClick:()=>a(`/projects/${s.key}/pipeline`),children:[e.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[e.jsx("span",{className:"text-xs font-medium text-[var(--text-primary)]",children:t.label??t.name}),t.prompt&&e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)] truncate",children:["// ",t.prompt.split(`
7
+ `)[0].slice(0,40)]})]}),e.jsx("div",{className:"flex items-center gap-2 shrink-0",children:t.requireConfirm&&e.jsx("span",{className:"rounded-[4px] px-2 py-0.5 text-[11px] font-medium text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:r("projects.confirm_label")})})]}),((f=t.onFailure)==null?void 0:f.goto)&&e.jsxs("div",{className:"flex items-center justify-center gap-1.5 py-1",children:[e.jsx(Z,{className:"h-3 w-3 text-[var(--warning)]"}),e.jsxs("span",{className:"text-[11px] text-[var(--warning)]",children:["onFailure.goto: ",t.onFailure.goto,", maxLoops: ",t.onFailure.maxLoops]})]}),w<i.stages.length-1&&!((h=t.onFailure)!=null&&h.goto)&&e.jsx("div",{className:"flex justify-center py-1",children:e.jsx(se,{className:"h-3.5 w-3.5 text-[var(--text-muted)]"})})]},t.name)})}):e.jsx("div",{className:"py-6 text-center text-xs text-[var(--text-muted)]",children:r("projects.no_pipeline_configured")}),c&&e.jsx("button",{onClick:()=>a(`/projects/${s.key}/pipeline`),className:"mt-3 flex w-full items-center justify-center gap-1.5 py-2 text-xs text-[var(--accent)] hover:text-[var(--accent)]",children:r("projects.add_stage")})]})})]}),e.jsx(ae,{isOpen:j,onClose:()=>N(!1),onConfirm:O,projectName:s.name,loading:L}),e.jsx(z,{isOpen:S,onClose:()=>A(!1),projectKey:s.key,existingMemberIds:b.map(t=>t.developerId),onAdded:y}),e.jsx(G,{isOpen:!!d,onClose:()=>u(null),onConfirm:E,memberName:d?d.developerName??`#${d.developerId}`:"",loading:W})]})]}):e.jsxs("div",{className:"mx-auto max-w-4xl px-4 md:px-6 py-8 text-center",children:[e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:r("projects.project_not_found")}),e.jsx("button",{onClick:()=>a("/projects"),className:"mt-4 rounded-[4px] border border-[var(--border)] bg-transparent px-4 py-2 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)]",children:r("projects.back_to_projects")})]})}export{ue as default};
@@ -0,0 +1,6 @@
1
+ import{c as I,a as P,v as R,r as o,G as x,Q as z,j as e,h as E,f as H,w as M}from"./index-DEBRwDiX.js";import{S as U}from"./Select-Bxil-UGQ.js";import{a as D}from"./agent-type-options-BBcV6_LY.js";import{E as J}from"./EmptyState-CM34MS8q.js";import{T as O}from"./Skeleton-DMVGjH__.js";import{t as q}from"./date-RFA7-ZGs.js";import{u as W}from"./useFetch-_325GIxD.js";import{P as $}from"./plus-Bh23dSc7.js";import{A as K}from"./arrow-left-BDjYIP3Y.js";import"./chevron-down-D9VkxIPs.js";/**
2
+ * @license lucide-react v0.469.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const Q=I("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]),m={width:"100%",padding:"0.5rem 0.75rem",backgroundColor:"var(--bg-input)",border:"1px solid var(--border)",borderRadius:"4px",color:"var(--text-primary)",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",outline:"none",boxSizing:"border-box"},i={display:"block",color:"var(--text-secondary)",fontSize:"0.7rem",marginBottom:"0.25rem",fontFamily:"'JetBrains Mono', monospace"};function V({isOpen:l,onClose:a,onCreated:j}){const{t}=P();R(l);const d=D(r=>r),[c,u]=o.useState(""),[s,b]=o.useState(""),[n,g]=o.useState(""),[y,f]=o.useState(""),[C,_]=o.useState("main"),[k,N]=o.useState(x.GITHUB),[S,B]=o.useState(z.CLAUDE),[p,T]=o.useState(!1),[w,v]=o.useState("");o.useEffect(()=>{l&&F()},[l]);function F(){u(""),b(""),g(""),f(""),_("main"),N(x.GITHUB),B(z.CLAUDE),v("")}function A(){F(),a()}async function L(r){r.preventDefault(),v(""),T(!0);try{const h=await E.post("admin/projects",{json:{name:c,key:s,repoUrl:n,sshUrl:y||void 0,defaultBranch:C,gitPlatform:k,agentType:S}}).json();j(h),A()}catch(h){const G=h instanceof Error?h.message:t("projects.failed_to_create_project");v(G)}finally{T(!1)}}return l?e.jsx("div",{style:{position:"fixed",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))",padding:"1rem"},children:e.jsxs("div",{onClick:r=>r.stopPropagation(),style:{width:"100%",maxWidth:"480px",backgroundColor:"var(--bg-card)",border:"1px solid var(--border)",borderRadius:"4px",padding:"1.5rem",fontFamily:"'JetBrains Mono', monospace"},children:[e.jsxs("div",{style:{marginBottom:"1.25rem"},children:[e.jsxs("div",{style:{color:"var(--accent)",fontSize:"0.875rem",fontWeight:600},children:["> ",t("projects.create_project")]}),e.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.7rem",marginTop:"0.25rem"},children:t("projects.add_project_desc")})]}),w&&e.jsx("div",{style:{marginBottom:"1rem",padding:"0.5rem 0.75rem",borderRadius:"4px",backgroundColor:"rgba(239, 68, 68, 0.1)",border:"1px solid rgba(239, 68, 68, 0.3)",color:"var(--destructive)",fontSize:"0.7rem"},children:w}),e.jsxs("form",{onSubmit:L,style:{display:"flex",flexDirection:"column",gap:"0.875rem"},children:[e.jsxs("div",{children:[e.jsx("label",{style:i,children:t("projects.project_name")}),e.jsx("input",{type:"text",value:c,onChange:r=>u(r.target.value),placeholder:t("projects.project_name_placeholder"),required:!0,autoFocus:!0,style:m,onFocus:r=>r.target.style.borderColor="var(--accent)",onBlur:r=>r.target.style.borderColor="var(--border)"})]}),e.jsxs("div",{children:[e.jsx("label",{style:i,children:t("projects.project_key")}),e.jsx("input",{type:"text",value:s,onChange:r=>b(r.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"")),placeholder:t("projects.project_key_placeholder"),required:!0,style:m,onFocus:r=>r.target.style.borderColor="var(--accent)",onBlur:r=>r.target.style.borderColor="var(--border)"}),e.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.65rem",marginTop:"0.25rem"},children:t("projects.project_key_hint")})]}),e.jsxs("div",{children:[e.jsx("label",{style:i,children:t("projects.repo_url")}),e.jsx("input",{type:"text",value:n,onChange:r=>g(r.target.value),placeholder:t("projects.repo_url_placeholder"),required:!0,style:m,onFocus:r=>r.target.style.borderColor="var(--accent)",onBlur:r=>r.target.style.borderColor="var(--border)"})]}),e.jsxs("div",{children:[e.jsx("label",{style:i,children:t("projects.ssh_url")}),e.jsx("input",{type:"text",value:y,onChange:r=>f(r.target.value),placeholder:t("projects.ssh_url_placeholder"),style:m,onFocus:r=>r.target.style.borderColor="var(--accent)",onBlur:r=>r.target.style.borderColor="var(--border)"}),e.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.65rem",marginTop:"0.25rem"},children:t("projects.ssh_url_hint")})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{style:i,children:t("projects.default_branch")}),e.jsx("input",{type:"text",value:C,onChange:r=>_(r.target.value),placeholder:t("projects.main"),style:m,onFocus:r=>r.target.style.borderColor="var(--accent)",onBlur:r=>r.target.style.borderColor="var(--border)"})]}),e.jsxs("div",{children:[e.jsx("label",{style:i,children:t("projects.git_platform")}),e.jsx(U,{value:k,onChange:r=>N(r),options:[{value:x.GITHUB,label:t("projects.github")},{value:x.GITLAB,label:t("projects.gitlab")},{value:x.GITEA,label:t("projects.gitea")}]})]}),e.jsxs("div",{children:[e.jsx("label",{style:i,children:t("projects.agent_type")}),e.jsx(U,{value:S,onChange:r=>B(r),options:d})]})]}),e.jsxs("div",{style:{display:"flex",gap:"0.75rem",marginTop:"0.5rem"},children:[e.jsx("button",{type:"button",onClick:A,disabled:p,style:{flex:1,padding:"0.5rem",backgroundColor:"transparent",border:"1px solid var(--border)",borderRadius:"4px",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:"pointer",transition:"color 0.15s, border-color 0.15s"},className:"text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:border-[var(--text-muted)]",children:t("common.cancel")}),e.jsx("button",{type:"submit",disabled:p||!c||!s||!n,style:{flex:1,padding:"0.5rem",backgroundColor:"var(--accent)",color:"#0C0C0C",border:"none",borderRadius:"4px",fontSize:"0.75rem",fontWeight:600,fontFamily:"'JetBrains Mono', monospace",cursor:p||!c||!s||!n?"not-allowed":"pointer",opacity:p||!c||!s||!n?.7:1},children:t(p?"common.creating":"common.create")})]})]})]})}):null}function le(){const l=H(),{t:a}=P(),[j,t]=o.useState(!1),{data:d,loading:c,refetch:u}=W(()=>E.get("web/projects").json(),[]);return M(o.useMemo(()=>e.jsxs("button",{onClick:()=>t(!0),className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs font-medium text-black",children:[e.jsx($,{className:"h-3.5 w-3.5"}),a("projects.create_project")]}),[a])),e.jsxs("div",{className:"mx-auto max-w-5xl",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:()=>l("/dashboard"),className:"shrink-0 text-[var(--text-muted)]",children:e.jsx(K,{className:"h-4 w-4"})}),e.jsx("span",{className:"truncate text-sm font-medium text-[var(--text-primary)]",children:a("projects.title")})]}),e.jsxs("div",{className:"px-4 md:px-6 py-8",children:[c?e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsx(O,{rows:4})}):!d||d.length===0?e.jsx(J,{icon:Q,title:a("projects.no_projects_yet"),description:a("projects.create_first_project"),actionLabel:a("projects.create_project"),onAction:()=>t(!0)}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-col gap-2 md:hidden",children:d.map(s=>e.jsxs("div",{onClick:()=>l(`/projects/${s.key}`),className:"cursor-pointer rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 transition-colors active:bg-[var(--bg-input)]",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-xs font-medium text-[var(--accent)]",children:s.key}),e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:[s.taskCount??0," tasks"]})]}),e.jsx("span",{className:"mt-1 block text-[11px] text-[var(--text-primary)]",children:s.name}),e.jsx("span",{className:"mt-0.5 block text-[11px] text-[var(--text-muted)]",children:s.agentType})]},s.key))}),e.jsxs("div",{className:"hidden md:block rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsxs("div",{className:"grid grid-cols-[36px_90px_1fr_120px_60px_80px] gap-3 border-b border-[var(--border-row)] px-4 py-2.5 text-xs font-medium text-[var(--text-muted)]",children:[e.jsx("span",{children:"#"}),e.jsx("span",{children:a("projects.key")}),e.jsx("span",{children:a("projects.name")}),e.jsx("span",{children:a("projects.members")}),e.jsx("span",{children:a("projects.tasks_count")}),e.jsx("span",{children:a("projects.last_activity")})]}),d.map((s,b)=>e.jsxs("div",{onClick:()=>l(`/projects/${s.key}`),className:"grid cursor-pointer grid-cols-[36px_90px_1fr_120px_60px_80px] gap-3 border-b border-[var(--border-row)] px-4 py-3 last:border-b-0 hover:bg-[var(--bg-input)] transition-colors items-center",children:[e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:b+1}),e.jsx("span",{className:"truncate text-xs text-[var(--accent)]",children:s.key}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"block truncate text-xs text-[var(--text-primary)]",children:s.name}),e.jsxs("span",{className:"block truncate text-[11px] text-[var(--text-muted)]",children:[s.agentType," · ",s.repoUrl.replace(/^https?:\/\//,"").split("/").slice(-2).join("/")]})]}),e.jsx("div",{className:"flex items-center",children:e.jsxs("div",{className:"flex -space-x-1.5",children:[(s.members??[]).map(n=>e.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-full border-2 border-[var(--bg-card)] bg-[var(--accent)]/20 text-[11px] font-bold text-[var(--accent)]",title:n.name,children:n.name.charAt(0).toUpperCase()},n.id)),(s.memberCount??0)>5&&e.jsxs("div",{className:"flex h-6 w-6 items-center justify-center rounded-full border-2 border-[var(--bg-card)] bg-[var(--bg-input)] text-[11px] text-[var(--text-muted)]",children:["+",s.memberCount-5]})]})}),e.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:s.taskCount??0}),e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:q(s.lastActivity??null)})]},s.key))]})]}),e.jsx(V,{isOpen:j,onClose:()=>t(!1),onCreated:u})]})]})}export{le as default};