@overlordai/server 1.0.150 → 1.0.151

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 (148) hide show
  1. package/database/migrations/015-automation-template-taxonomy.sql +99 -0
  2. package/dist/adapters/lark/lark.controller.js +1 -1
  3. package/dist/adapters/lark/lark.controller.js.map +1 -1
  4. package/dist/adapters/slack/slack.controller.d.ts.map +1 -1
  5. package/dist/adapters/slack/slack.controller.js +4 -1
  6. package/dist/adapters/slack/slack.controller.js.map +1 -1
  7. package/dist/automation/automation-template.service.d.ts +4 -1
  8. package/dist/automation/automation-template.service.d.ts.map +1 -1
  9. package/dist/automation/automation-template.service.js +9 -2
  10. package/dist/automation/automation-template.service.js.map +1 -1
  11. package/dist/automation/builtin-templates.d.ts +14 -0
  12. package/dist/automation/builtin-templates.d.ts.map +1 -0
  13. package/dist/automation/builtin-templates.js +327 -0
  14. package/dist/automation/builtin-templates.js.map +1 -0
  15. package/dist/database/repositories/automation.repository.d.ts +12 -0
  16. package/dist/database/repositories/automation.repository.d.ts.map +1 -1
  17. package/dist/database/repositories/automation.repository.js +63 -2
  18. package/dist/database/repositories/automation.repository.js.map +1 -1
  19. package/dist/dispatcher/dispatcher.service.d.ts.map +1 -1
  20. package/dist/dispatcher/dispatcher.service.js +6 -1
  21. package/dist/dispatcher/dispatcher.service.js.map +1 -1
  22. package/dist/dispatcher/dispatcher.types.d.ts +2 -0
  23. package/dist/dispatcher/dispatcher.types.d.ts.map +1 -1
  24. package/dist/notifier/notification-consumer.d.ts +1 -8
  25. package/dist/notifier/notification-consumer.d.ts.map +1 -1
  26. package/dist/notifier/notification-consumer.js +4 -58
  27. package/dist/notifier/notification-consumer.js.map +1 -1
  28. package/dist/notifier/template.service.d.ts.map +1 -1
  29. package/dist/notifier/template.service.js +14 -7
  30. package/dist/notifier/template.service.js.map +1 -1
  31. package/dist/web/automation.controller.js +1 -1
  32. package/dist/web/automation.controller.js.map +1 -1
  33. package/package.json +4 -4
  34. package/public/assets/{AccessTokensPage-Cxf8lX2l.js → AccessTokensPage-DOQYcLSs.js} +1 -1
  35. package/public/assets/{AdminPage-CYbg2MAm.js → AdminPage-vaAs4nmP.js} +1 -1
  36. package/public/assets/{AgentCliPage-B927spLk.js → AgentCliPage-BXGIfvSo.js} +1 -1
  37. package/public/assets/{ApiReferencePage-Dg2PEPIj.js → ApiReferencePage-ChGlKtFZ.js} +1 -1
  38. package/public/assets/{ArchitecturePage-DpdvWol1.js → ArchitecturePage-BDo0Sz0V.js} +1 -1
  39. package/public/assets/{AuditLogPage-DC0cHKgp.js → AuditLogPage-CDonhWBh.js} +1 -1
  40. package/public/assets/AutomationCreatePage-C1_2qnf5.js +1 -0
  41. package/public/assets/{AutomationDetailPage-Dzkc_ZgE.js → AutomationDetailPage-BruGQNkV.js} +1 -1
  42. package/public/assets/{AutomationEditPage-HuEyfsd4.js → AutomationEditPage-BVlx-7AI.js} +1 -1
  43. package/public/assets/AutomationListPage-BprhRKdu.js +26 -0
  44. package/public/assets/{AutomationRunDetailPage-DpbJ8WGA.js → AutomationRunDetailPage-BWRONm49.js} +2 -2
  45. package/public/assets/{BindPlatformPage-BsEqhv2c.js → BindPlatformPage-B-jO83qZ.js} +1 -1
  46. package/public/assets/BotIntegrationPage-CfWOXPnJ.js +1 -0
  47. package/public/assets/{BotManage-ClYWS35N.js → BotManage-Dt4gvWW6.js} +1 -1
  48. package/public/assets/{BotSetupPage-i-AQ7pd6.js → BotSetupPage-BAtr0Wem.js} +1 -1
  49. package/public/assets/ChangelogPage-CbYmEPo0.js +1 -0
  50. package/public/assets/{CliReferencePage-DE7sjttz.js → CliReferencePage-DzBrPSnn.js} +1 -1
  51. package/public/assets/ConfirmStageDialog-CJ8pWink.js +6 -0
  52. package/public/assets/{DeploymentPage-DSE4lkjS.js → DeploymentPage-DngrSHQT.js} +1 -1
  53. package/public/assets/{DevWorkflowPage-BANLgjo2.js → DevWorkflowPage-BQfJaZyg.js} +1 -1
  54. package/public/assets/{DeveloperManage-D1SXqVFy.js → DeveloperManage-whlVH116.js} +1 -1
  55. package/public/assets/{DeveloperSetupPage-C_2BhtWg.js → DeveloperSetupPage-LrbpgJ2C.js} +1 -1
  56. package/public/assets/DocsIndexPage-vE4yr9Si.js +26 -0
  57. package/public/assets/{DocsLayout-DF24edES.js → DocsLayout-ByGEAOqk.js} +1 -1
  58. package/public/assets/{DocsPrimitives-m1oUERel.js → DocsPrimitives-DCBNKtsW.js} +1 -1
  59. package/public/assets/{EditProjectPage-DBMoGsR8.js → EditProjectPage-CjJMof0e.js} +2 -2
  60. package/public/assets/{EmptyState-tRn0r3m4.js → EmptyState-BfgwLg0u.js} +1 -1
  61. package/public/assets/{EnvVariablesPage-C6aJgjAB.js → EnvVariablesPage-D5h_sa-J.js} +1 -1
  62. package/public/assets/{HomePage-Bk-TkaC8.js → HomePage-BfETjlYe.js} +1 -1
  63. package/public/assets/{InfoRow-DNGAuZW7.js → InfoRow-CIwHf1Un.js} +1 -1
  64. package/public/assets/{InstallationPage-D8L9Higi.js → InstallationPage-2uTV3WlY.js} +1 -1
  65. package/public/assets/{LandingPage-DWUNOSPY.js → LandingPage-DMFC0PF_.js} +1 -1
  66. package/public/assets/{LocalDevelopmentPage-EmrG2Khk.js → LocalDevelopmentPage-9g3s63GP.js} +1 -1
  67. package/public/assets/{LoginPage-DGikIseW.js → LoginPage-CXwygPZl.js} +1 -1
  68. package/public/assets/{MetricBar-DJJX8LMi.js → MetricBar-BWuqiydF.js} +1 -1
  69. package/public/assets/{NotFoundPage-C8KIi602.js → NotFoundPage-Cs7ae_Mz.js} +1 -1
  70. package/public/assets/{OnboardingGuide-hzsHrV8w.js → OnboardingGuide-uCrXzgnL.js} +1 -1
  71. package/public/assets/{PermissionsPage-CViv0974.js → PermissionsPage-CVrdX2r2.js} +1 -1
  72. package/public/assets/{PipelineConfigPage-DAL7k_Mn.js → PipelineConfigPage-BxkXW1la.js} +1 -1
  73. package/public/assets/{PipelineEditorPage-c8vBg5bb.js → PipelineEditorPage-DiyMvTIg.js} +2 -2
  74. package/public/assets/{PlanPage-to7JvocS.js → PlanPage-B-NSg434.js} +1 -1
  75. package/public/assets/{ProfilePage-FkoPFABx.js → ProfilePage-CRMCbMyc.js} +1 -1
  76. package/public/assets/{ProjectDetailPage-CLcnGmQC.js → ProjectDetailPage-Bx1DUkpw.js} +3 -3
  77. package/public/assets/{ProjectListPage-xapZ35at.js → ProjectListPage-D1LzmIVf.js} +2 -2
  78. package/public/assets/PtyTerminal-CxBKQBbF.js +38 -0
  79. package/public/assets/{QuickAuth-tYYBxSU8.js → QuickAuth-BMY6Nw6u.js} +1 -1
  80. package/public/assets/{RemoveMemberConfirmDialog-KoNueMWe.js → RemoveMemberConfirmDialog-Da3XlOxO.js} +1 -1
  81. package/public/assets/{ReviewAggregatePage-BTN2bkEA.js → ReviewAggregatePage-mnnW-Nli.js} +2 -2
  82. package/public/assets/{ReviewPage-DKVAeNjP.js → ReviewPage-_pd3mJC1.js} +1 -1
  83. package/public/assets/{Select-ucU6_0EP.js → Select-CaAVBHmI.js} +1 -1
  84. package/public/assets/{SettingsPage-Dv6y5QEu.js → SettingsPage-CsDJ7FS9.js} +1 -1
  85. package/public/assets/{Skeleton-BAYr4eiz.js → Skeleton-CNV0Dyd8.js} +1 -1
  86. package/public/assets/{SkillPage-B3Iw74cZ.js → SkillPage-CQyxaNa5.js} +1 -1
  87. package/public/assets/TaskDetailPage-Dn7Vl2tI.js +21 -0
  88. package/public/assets/{TaskGuidePage-BBFKjc9w.js → TaskGuidePage-Ch465zVv.js} +1 -1
  89. package/public/assets/{TaskListPage-DUUYPpEt.js → TaskListPage-DbQbJMDj.js} +1 -1
  90. package/public/assets/{TaskStatusBadge-BD3WJQkl.js → TaskStatusBadge-Dzloj2eJ.js} +1 -1
  91. package/public/assets/TerminalHomePage-C2bwGFkH.js +6 -0
  92. package/public/assets/TokenManage-mToToJ_g.js +1 -0
  93. package/public/assets/{Tooltip-DfB8CAIs.js → Tooltip-DzkVglKi.js} +1 -1
  94. package/public/assets/{TotpSetupPage-DwXxvB-k.js → TotpSetupPage-Dk00_OYo.js} +1 -1
  95. package/public/assets/{WorkerDetailPage-aLNOgmfW.js → WorkerDetailPage-C8_zfmSR.js} +1 -1
  96. package/public/assets/{WorkerListPage-CrJESAH0.js → WorkerListPage-kKUioe-i.js} +2 -2
  97. package/public/assets/{WorkerOperationsPage-rHLL8hJa.js → WorkerOperationsPage-CBzwbV8I.js} +1 -1
  98. package/public/assets/{WorkerSetupGuidePage-Ckrfo8-b.js → WorkerSetupGuidePage-DvaP5u6N.js} +1 -1
  99. package/public/assets/{WorkerSetupPage-Cwf4AXe9.js → WorkerSetupPage-BD-EAPKM.js} +1 -1
  100. package/public/assets/{agent-type-options-Vn2Ar3HP.js → agent-type-options-BiwwFXJv.js} +1 -1
  101. package/public/assets/{arrow-left-C08vc7G2.js → arrow-left-BnN4eZhK.js} +1 -1
  102. package/public/assets/{arrow-right-CiCC0owG.js → arrow-right-BDaYPEVr.js} +1 -1
  103. package/public/assets/{bot-BpRqYalx.js → bot-jsWsZ197.js} +1 -1
  104. package/public/assets/{chevron-down-54sz-rQX.js → chevron-down-DyqUpmgf.js} +1 -1
  105. package/public/assets/{chevron-left-D9iQafYD.js → chevron-left-D5fJVFiB.js} +1 -1
  106. package/public/assets/{chevron-right-Ccp2bQ3u.js → chevron-right-Bz-j2WmS.js} +1 -1
  107. package/public/assets/{chevron-up-Cm7Jc-Tg.js → chevron-up-DEXIEMJO.js} +1 -1
  108. package/public/assets/{circle-alert-DKHl7f_Q.js → circle-alert-DE06tNOV.js} +1 -1
  109. package/public/assets/{clock-B6V-4VR5.js → clock-DyV22whY.js} +1 -1
  110. package/public/assets/{copy-B-4Hfvcn.js → copy-Dtpgo9EK.js} +1 -1
  111. package/public/assets/{download-3Syugo5K.js → download-DVCPTZuD.js} +1 -1
  112. package/public/assets/{external-link-B4tgsST2.js → external-link-Bbo-dc9z.js} +1 -1
  113. package/public/assets/{git-fork-BhXdgj_k.js → git-fork-A1WGp9ha.js} +1 -1
  114. package/public/assets/index-Du11Fv9c.css +1 -0
  115. package/public/assets/{index-D3EF0BU0.js → index-PZwTchr_.js} +32 -27
  116. package/public/assets/{key-BTztJw3V.js → key-BDx4jfUG.js} +1 -1
  117. package/public/assets/{loader-circle-CPOjAAu7.js → loader-circle-nKG9e8iK.js} +1 -1
  118. package/public/assets/{pencil-eGjyAgrM.js → pencil-Dgj4md4-.js} +1 -1
  119. package/public/assets/{play-BjFnzBVa.js → play-DFj8BMl8.js} +1 -1
  120. package/public/assets/{plus-BwhhTyaX.js → plus-CCF-PMRF.js} +1 -1
  121. package/public/assets/{rotate-ccw-CesPJxB6.js → rotate-ccw-CyltG4Qx.js} +1 -1
  122. package/public/assets/{scroll-text-BcO-tu0h.js → scroll-text-IFQgBRlh.js} +1 -1
  123. package/public/assets/{settings-Cpf4Aw4Z.js → settings-CYtYYzCu.js} +1 -1
  124. package/public/assets/{skip-forward-tHDn4amf.js → skip-forward-Ck7tY58a.js} +1 -1
  125. package/public/assets/{status-colors-BNBcbZVQ.js → status-colors-DDycfcf7.js} +1 -1
  126. package/public/assets/{task-constants-v3cKX5sS.js → task-constants-CSVY_jfk.js} +1 -1
  127. package/public/assets/{task.store-B1f8yuTU.js → task.store-BTXbcXgO.js} +1 -1
  128. package/public/assets/{timer-D4gHmYOk.js → timer-CXsWiTNP.js} +1 -1
  129. package/public/assets/{trash-2-B0gTlwTA.js → trash-2-DXJqRCdo.js} +1 -1
  130. package/public/assets/{useFetch-DqA_6ili.js → useFetch-6R6P2rOm.js} +1 -1
  131. package/public/assets/{users-BDhUOLR9.js → users-BZPY-p6E.js} +1 -1
  132. package/public/assets/{wifi-CpsnZ0me.js → wifi-Bgq95lS8.js} +1 -1
  133. package/public/assets/{workflow-D6VrmpVC.js → workflow-RqNfx4vc.js} +1 -1
  134. package/public/assets/{zap-ChFVfVhi.js → zap-BIwamY7L.js} +1 -1
  135. package/public/index.html +2 -2
  136. package/public/sw.js +1 -1
  137. package/public/assets/AutomationCreatePage-BvFaaM3C.js +0 -1
  138. package/public/assets/AutomationListPage-Ds8g44m8.js +0 -16
  139. package/public/assets/BotIntegrationPage-ClfrH4Nq.js +0 -1
  140. package/public/assets/ChangelogPage-C-xth3KP.js +0 -1
  141. package/public/assets/ConfirmStageDialog-DvTvViy4.js +0 -7
  142. package/public/assets/DocsIndexPage-Ch2Rj0KS.js +0 -26
  143. package/public/assets/PtyTerminal-CvlgzMDa.js +0 -38
  144. package/public/assets/TaskDetailPage-Dm9O3GpZ.js +0 -21
  145. package/public/assets/TerminalHomePage-By_ngoYD.js +0 -6
  146. package/public/assets/TokenManage-BK36rX8P.js +0 -1
  147. package/public/assets/file-text-BfrzBouS.js +0 -6
  148. package/public/assets/index-CdJk2QGi.css +0 -1
@@ -1 +1 @@
1
- import{a as h,r as s,h as b,a7 as v,j as e,C as j}from"./index-D3EF0BU0.js";import{C as f}from"./copy-B-4Hfvcn.js";function y({mode:l}){const{t:o}=h(),[n,d]=s.useState([]),[x,c]=s.useState(null),[u,i]=s.useState(!1);s.useEffect(()=>{b.get("web/profile/tokens").json().then(t=>{const r=t.filter(m=>m.status===v.ACTIVE);d(r),r.length>0&&c(r[0].id)}).catch(()=>{})},[]);const a=l==="cli"?"ov login --token <your-token>":'curl -H "authorization: bearer <your-token>" http://localhost:9000/api/web/tasks',p=s.useCallback(()=>{navigator.clipboard.writeText(a),i(!0),setTimeout(()=>i(!1),2e3)},[a]);return n.length===0?null:e.jsxs("div",{className:"mb-8 rounded-[4px] border border-[var(--accent)]/20 bg-[var(--bg-card)] p-4",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:o("docs.quick_start_with_token")}),e.jsx("select",{value:x??"",onChange:t=>c(Number(t.target.value)),className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] px-2 py-1 text-xs text-[var(--text-primary)]",children:n.map(t=>e.jsx("option",{value:t.id,children:t.label},t.id))})]}),e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-[4px] bg-[var(--bg-primary)] px-3 py-2",children:[e.jsx("code",{className:"text-xs text-[var(--accent)] break-all",children:a}),e.jsx("button",{onClick:p,className:"shrink-0 text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:u?e.jsx(j,{size:14}):e.jsx(f,{size:14})})]}),e.jsx("p",{className:"mt-2 text-[11px] text-[var(--text-muted)]",children:o("docs.replace_token_hint")})]})}export{y as Q};
1
+ import{a as h,r as s,h as b,a7 as v,j as e,C as j}from"./index-PZwTchr_.js";import{C as f}from"./copy-Dtpgo9EK.js";function y({mode:l}){const{t:o}=h(),[n,d]=s.useState([]),[x,c]=s.useState(null),[u,i]=s.useState(!1);s.useEffect(()=>{b.get("web/profile/tokens").json().then(t=>{const r=t.filter(m=>m.status===v.ACTIVE);d(r),r.length>0&&c(r[0].id)}).catch(()=>{})},[]);const a=l==="cli"?"ov login --token <your-token>":'curl -H "authorization: bearer <your-token>" http://localhost:9000/api/web/tasks',p=s.useCallback(()=>{navigator.clipboard.writeText(a),i(!0),setTimeout(()=>i(!1),2e3)},[a]);return n.length===0?null:e.jsxs("div",{className:"mb-8 rounded-[4px] border border-[var(--accent)]/20 bg-[var(--bg-card)] p-4",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:o("docs.quick_start_with_token")}),e.jsx("select",{value:x??"",onChange:t=>c(Number(t.target.value)),className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] px-2 py-1 text-xs text-[var(--text-primary)]",children:n.map(t=>e.jsx("option",{value:t.id,children:t.label},t.id))})]}),e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-[4px] bg-[var(--bg-primary)] px-3 py-2",children:[e.jsx("code",{className:"text-xs text-[var(--accent)] break-all",children:a}),e.jsx("button",{onClick:p,className:"shrink-0 text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:u?e.jsx(j,{size:14}):e.jsx(f,{size:14})})]}),e.jsx("p",{className:"mt-2 text-[11px] text-[var(--text-muted)]",children:o("docs.replace_token_hint")})]})}export{y as Q};
@@ -1,4 +1,4 @@
1
- import{c as R,a as _,v as w,r as a,Z as c,j as e,X as C,h as g,s as D}from"./index-D3EF0BU0.js";import{S as N}from"./Select-ucU6_0EP.js";/**
1
+ import{c as R,a as _,v as w,r as a,Y as c,j as e,X as C,h as g,s as D}from"./index-PZwTchr_.js";import{S as N}from"./Select-CaAVBHmI.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,6 +1,6 @@
1
- import{c as de,A as xe,f as me,a as B,k as pe,r as n,h as L,j as e,L as ue,V as H,Y as ve,t as f,o as v,b as be,Q as ge,X as he}from"./index-D3EF0BU0.js";import{P as fe}from"./PtyTerminal-CvlgzMDa.js";import{T as je}from"./Skeleton-BAYr4eiz.js";import{f as Ne,b as we}from"./date-RFA7-ZGs.js";import{a as ye}from"./agent-type-options-Vn2Ar3HP.js";import{T as G,g as Q}from"./task-constants-v3cKX5sS.js";import{A as ke}from"./arrow-left-C08vc7G2.js";import{L as Se}from"./loader-circle-CPOjAAu7.js";import{P as z}from"./play-BjFnzBVa.js";import{S as Ce}from"./skip-forward-tHDn4amf.js";import{R as Te}from"./rotate-ccw-CesPJxB6.js";import{C as Ae}from"./chevron-up-Cm7Jc-Tg.js";import{C as Ee}from"./chevron-down-54sz-rQX.js";import{C as Re}from"./circle-alert-DKHl7f_Q.js";/**
1
+ import{c as de,A as xe,f as me,a as B,k as pe,r as n,h as L,j as e,L as ue,Q as H,V as ve,t as f,o as v,b as be,O as ge,X as he}from"./index-PZwTchr_.js";import{P as fe}from"./PtyTerminal-CxBKQBbF.js";import{T as je}from"./Skeleton-CNV0Dyd8.js";import{f as Ne,b as we}from"./date-RFA7-ZGs.js";import{a as ye}from"./agent-type-options-BiwwFXJv.js";import{T as G,g as Q}from"./task-constants-CSVY_jfk.js";import{A as ke}from"./arrow-left-BnN4eZhK.js";import{L as Se}from"./loader-circle-nKG9e8iK.js";import{P as z}from"./play-DFj8BMl8.js";import{S as Ce}from"./skip-forward-Ck7tY58a.js";import{R as Te}from"./rotate-ccw-CyltG4Qx.js";import{C as Ae}from"./chevron-up-DEXIEMJO.js";import{C as Ee}from"./chevron-down-DyqUpmgf.js";import{C as Re}from"./circle-alert-DE06tNOV.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 De=de("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"}]]),X={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(H,{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 W(s){return s===v.RUNNING||s===v.QUEUED||s===v.ASSIGNED}function O(s){return s===v.SUSPENDED}const $e=ye(Q);function Pe({task:s,expanded:l,onToggleExpand:r}){const b=Q(s.agentType),d=_e(s.status),o=we(s.startedAt,s.completedAt??void 0),j=W(s.status),g=G.includes(s.status),w=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 ${d} ${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:y=>y.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:w,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:d}=B(),o=l.length>0?l:[ge.CLAUDE],j=l.length>0,[g,w]=n.useState(o),[y,_]=n.useState(""),[N,$]=n.useState(!1),[C,T]=n.useState(!1);function R(c){w(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:y.trim()||void 0,skipFix:N||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:d("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:d("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:y,onChange:c=>_(c.target.value),placeholder:d("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:N,onChange:c=>$(c.target.checked),className:"h-3.5 w-3.5 accent-[var(--accent)]"}),e.jsx("span",{className:"text-[var(--text-muted)]",children:d("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"}),d(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:d("common.cancel")})]})]})})}function Ze(){var J;const{sourceTaskId:s}=xe(),l=me(),{t:r}=B(),b=Number(s),d=pe(t=>t.eventSeq),[o,j]=n.useState(null),[g,w]=n.useState(!0),[y,_]=n.useState(new Set),[N,$]=n.useState(""),[C,T]=n.useState(!1),[R,D]=n.useState(!1),[c,u]=n.useState(!1),[P,V]=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&&V(a=>a??t.rounds[t.rounds.length-1].round)}catch{j(null)}finally{w(!1)}},[b]);n.useEffect(()=>{w(!0),k()},[k]),n.useEffect(()=>{d>0&&k()},[d,k]);const Z=n.useCallback(t=>{_(a=>{const x=new Set(a);return x.has(t)?x.delete(t):x.add(t),x})},[]),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=>W(t.status));const I=i.some(t=>O(t.status)),M=i.length>0&&i.every(t=>G.includes(t.status)),ee=i.some(t=>t.report!=null),te=i.length>0&&i.every(t=>t.report!=null),q=h===F,se=I||M,A=n.useMemo(()=>{var x;const t=[];for(const p of i)if((x=p.report)!=null&&x.issues)for(const E of p.report.issues)t.push({...E,agentType:p.agentType??"claude"});t.sort((p,E)=>(X[p.severity]??9)-(X[E.severity]??9));const a=new Set;return t.map(p=>{const E=p.description.slice(0,20),K=`${p.file}:${p.line??""}:${E}`;return a.has(K)?{...p,isDuplicate:!0}:(a.add(K),p)})},[i]),re=A.filter(t=>t.severity==="critical").length,ae=A.filter(t=>t.severity==="warning").length,ne=A.filter(t=>t.severity==="suggestion").length,Y=i.filter(t=>O(t.status)),oe=n.useMemo(()=>[{value:"",label:"select agent..."},...Y.map(t=>({value:String(t.id),label:Q(t.agentType)}))],[Y]);async function ce(){if(!N){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(N)}}),f.success("fix started"),k()}catch(t){const a=t instanceof Error?t.message:String(t);f.error(a)}finally{T(!1)}}async function ie(){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 le=n.useMemo(()=>{var a;const t=(a=o==null?void 0:o.sourceTask)==null?void 0:a.configSnapshot;if(!t)return[];try{const x=JSON.parse(t);return Array.isArray(x.defaultReviewers)?x.defaultReviewers:[]}catch{return[]}},[(J=o==null?void 0:o.sourceTask)==null?void 0:J.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:Ne(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:()=>V(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:y.has(t.id),onToggleExpand:()=>Z(t.id)},t.id))})]}),se&&ee&&(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(H,{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(re),warning:String(ae),suggestion:String(ne)})]})}),A.length>0?e.jsx("div",{className:"flex flex-col gap-2",children:A.map((a,x)=>e.jsx(Fe,{issue:a},x))}):e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"// no issues reported"})]})),q&&te&&!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")})]}),q&&(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:N,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:oe.map(t=>e.jsx("option",{value:t.value,children:t.label},t.value))}),e.jsxs("button",{onClick:ce,disabled:C||!N,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:ie,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:le,onClose:()=>u(!1),onLaunched:()=>{u(!1),k()}})]})}export{Ze as default};
6
+ */const De=de("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(H,{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 W(s){return s===v.RUNNING||s===v.QUEUED||s===v.ASSIGNED}function O(s){return s===v.SUSPENDED}const $e=ye(Q);function Pe({task:s,expanded:l,onToggleExpand:r}){const b=Q(s.agentType),d=_e(s.status),o=we(s.startedAt,s.completedAt??void 0),j=W(s.status),g=G.includes(s.status),w=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 ${d} ${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:y=>y.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:w,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:d}=B(),o=l.length>0?l:[ge.CLAUDE],j=l.length>0,[g,w]=n.useState(o),[y,_]=n.useState(""),[N,$]=n.useState(!1),[C,T]=n.useState(!1);function R(c){w(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:y.trim()||void 0,skipFix:N||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:d("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:d("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:y,onChange:c=>_(c.target.value),placeholder:d("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:N,onChange:c=>$(c.target.checked),className:"h-3.5 w-3.5 accent-[var(--accent)]"}),e.jsx("span",{className:"text-[var(--text-muted)]",children:d("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"}),d(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:d("common.cancel")})]})]})})}function Ze(){var K;const{sourceTaskId:s}=xe(),l=me(),{t:r}=B(),b=Number(s),d=pe(t=>t.eventSeq),[o,j]=n.useState(null),[g,w]=n.useState(!0),[y,_]=n.useState(new Set),[N,$]=n.useState(""),[C,T]=n.useState(!1),[R,D]=n.useState(!1),[c,u]=n.useState(!1),[P,V]=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&&V(a=>a??t.rounds[t.rounds.length-1].round)}catch{j(null)}finally{w(!1)}},[b]);n.useEffect(()=>{w(!0),k()},[k]),n.useEffect(()=>{d>0&&k()},[d,k]);const Z=n.useCallback(t=>{_(a=>{const x=new Set(a);return x.has(t)?x.delete(t):x.add(t),x})},[]),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=>W(t.status));const I=i.some(t=>O(t.status)),M=i.length>0&&i.every(t=>G.includes(t.status)),ee=i.some(t=>t.report!=null),te=i.length>0&&i.every(t=>t.report!=null),q=h===F,se=I||M,A=n.useMemo(()=>{var x;const t=[];for(const p of i)if((x=p.report)!=null&&x.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]),re=A.filter(t=>t.severity==="critical").length,ae=A.filter(t=>t.severity==="warning").length,ne=A.filter(t=>t.severity==="suggestion").length,J=i.filter(t=>O(t.status)),oe=n.useMemo(()=>[{value:"",label:"select agent..."},...J.map(t=>({value:String(t.id),label:Q(t.agentType)}))],[J]);async function ce(){if(!N){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(N)}}),f.success("fix started"),k()}catch(t){const a=t instanceof Error?t.message:String(t);f.error(a)}finally{T(!1)}}async function ie(){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 le=n.useMemo(()=>{var a;const t=(a=o==null?void 0:o.sourceTask)==null?void 0:a.configSnapshot;if(!t)return[];try{const x=JSON.parse(t);return Array.isArray(x.defaultReviewers)?x.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:Ne(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:()=>V(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:y.has(t.id),onToggleExpand:()=>Z(t.id)},t.id))})]}),se&&ee&&(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(H,{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(re),warning:String(ae),suggestion:String(ne)})]})}),A.length>0?e.jsx("div",{className:"flex flex-col gap-2",children:A.map((a,x)=>e.jsx(Fe,{issue:a},x))}):e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"// no issues reported"})]})),q&&te&&!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")})]}),q&&(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:N,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:oe.map(t=>e.jsx("option",{value:t.value,children:t.label},t.value))}),e.jsxs("button",{onClick:ce,disabled:C||!N,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:ie,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:le,onClose:()=>u(!1),onLaunched:()=>{u(!1),k()}})]})}export{Ze as default};
@@ -1 +1 @@
1
- import{a as y,k as G,r as a,w as K,j as e,h as N,f as S,o as p,E,l as F,X as T,H as B,t as w,Q as H}from"./index-D3EF0BU0.js";import{E as D}from"./EmptyState-tRn0r3m4.js";import{T as L}from"./Skeleton-BAYr4eiz.js";import{S as k}from"./Select-ucU6_0EP.js";import{f as P}from"./date-RFA7-ZGs.js";import{T as A}from"./Tooltip-DfB8CAIs.js";import{a as Q}from"./agent-type-options-Vn2Ar3HP.js";import{g as q}from"./task-constants-v3cKX5sS.js";import{P as R}from"./play-BjFnzBVa.js";import{C as z}from"./chevron-left-D9iQafYD.js";import{C as X}from"./chevron-right-Ccp2bQ3u.js";import"./chevron-down-54sz-rQX.js";function $(){const[t,n]=a.useState(void 0),[s,i]=a.useState(void 0),[x,o]=a.useState([]),u=a.useRef(void 0),g=a.useRef(void 0);u.current=t,g.current=s;const m=a.useCallback(d=>{n(d)},[]),h=a.useCallback(()=>{const d=u.current;d&&(o(j=>[...j,g.current??""]),i(d))},[]),b=a.useRef([]);b.current=x;const l=a.useCallback(()=>{const d=b.current;d.length!==0&&(i(d.at(-1)||void 0),o(d.slice(0,-1)))},[]),r=x.length+1,c=x.length>0;return{cursor:s,setNextCursor:m,goNext:h,goPrev:l,pageNumber:r,hasPrev:c,hasNext:!!t}}const I=20;function Z(t){switch(t){case p.RUNNING:return"bg-[var(--accent)]";case p.QUEUED:return"bg-[var(--warning)]";case p.ASSIGNED:return"bg-[var(--info)]";case p.SUSPENDED:return"bg-[var(--warning)]";case p.COMPLETED:return"bg-[var(--accent)]";case p.FAILED:return"bg-[var(--destructive)]";case p.CANCELLED:return"bg-[#525252]";default:return"bg-[#525252]"}}const J=Q(q);function V({taskId:t,onClose:n,onLaunched:s}){const{t:i}=y(),[x,o]=a.useState([H.CLAUDE]),[u,g]=a.useState(""),[m,h]=a.useState(!1);function b(r){o(c=>c.includes(r)?c.filter(f=>f!==r):[...c,r])}async function l(){if(x.length===0){w.error("select at least one review agent.");return}h(!0);try{await N.post(`web/tasks/${t}/review`,{json:{agentTypes:x,description:u.trim()||void 0}}),w.success("review launched"),s(),n()}catch(r){const c=r instanceof Error?r.message:String(r);w.error(c)}finally{h(!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:i("review.launch")}),e.jsx("button",{onClick:n,className:"text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:e.jsx(T,{className:"h-4 w-4"})})]}),e.jsxs("p",{className:"mb-3 text-[11px] text-[var(--text-muted)]",children:["task #",t," — ",i("review.select_agents")]}),e.jsx("div",{className:"mb-4 flex flex-col gap-2",children:J.map(r=>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:x.includes(r.value),onChange:()=>b(r.value),className:"h-3.5 w-3.5 accent-[var(--accent)]"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:r.label})]},r.value))}),e.jsx("textarea",{value:u,onChange:r=>g(r.target.value),placeholder:i("review.description_placeholder"),rows:3,className:"mb-4 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("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:l,disabled:m||x.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(R,{className:"h-3 w-3"}),i(m?"common.processing":"review.launch")]}),e.jsx("button",{onClick:n,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:i("common.cancel")})]})]})})}function _({pag:t}){const{t:n}=y();return!t.hasPrev&&!t.hasNext?null:e.jsxs("div",{className:"mt-6 flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["// page ",t.pageNumber]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:t.goPrev,disabled:!t.hasPrev,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:[e.jsx(z,{className:"h-3.5 w-3.5"}),n("tasks.prev")]}),e.jsxs("button",{onClick:t.goNext,disabled:!t.hasNext,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:[n("common.next"),e.jsx(X,{className:"h-3.5 w-3.5"})]})]})]})}function W({onRefresh:t,projectFilter:n,developerFilter:s}){const{t:i}=y(),x=S(),[o,u]=a.useState([]),[g,m]=a.useState(!0),[h,b]=a.useState(null),l=$(),r=a.useCallback(async c=>{m(!0);try{const f=new Date(Date.now()-6048e5).toISOString(),d=new URLSearchParams({status:p.COMPLETED,taskMode:"develop",reviewStatus:"null",completedAfter:f,limit:String(I)});n&&d.set("projectKey",n),s&&d.set("developerId",s),c&&d.set("cursor",c);const j=await N.get(`web/tasks?${d}`).json();u(j.data??[]),l.setNextCursor(j.nextCursor)}catch{u([]),l.setNextCursor(void 0)}finally{m(!1)}},[n,s]);return a.useEffect(()=>{r(l.cursor)},[r,l.cursor]),g&&o.length===0?e.jsx("div",{className:"p-4",children:e.jsx(L,{rows:4})}):!g&&o.length===0&&!l.hasPrev?e.jsx(D,{icon:E,title:i("review.no_reviews"),description:i("review.pending")}):e.jsxs(e.Fragment,{children:[o.length>0&&e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:o.map(c=>e.jsxs("div",{className:"flex items-center gap-3 border-b border-[var(--border)] px-4 py-3 last:border-b-0",children:[e.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full bg-[var(--accent)]"}),e.jsx(A,{content:c.description,className:"flex-1 min-w-0",children:e.jsxs("span",{className:"cursor-pointer truncate text-xs text-[var(--text-primary)] hover:text-[var(--accent)] transition-colors block",onClick:()=>x(`/tasks/${c.id}`),children:["#",c.id," ",F(c)]})}),e.jsx("span",{className:"shrink-0 rounded-[4px] border border-[var(--border)] px-2 py-0.5 text-[11px] text-[var(--text-muted)]",children:c.projectKey}),e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:P(c.completedAt??c.createdAt)}),e.jsxs("button",{onClick:async()=>{try{await N.post(`web/tasks/${c.id}/review-status`,{json:{reviewStatus:"dismissed"}}),r(l.cursor)}catch(f){let d="Failed to dismiss";try{if(f instanceof B){const j=await f.response.json();d=(j==null?void 0:j.message)??d}else f instanceof Error&&(d=f.message)}catch{}w.error(d)}},className:"shrink-0 flex items-center gap-1.5 rounded-[4px] px-3 py-1.5 text-[11px] font-medium text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:[e.jsx(T,{className:"h-3 w-3"}),"Dismiss"]}),e.jsxs("button",{onClick:()=>b(c.id),className:"shrink-0 flex items-center gap-1.5 rounded-[4px] px-3 py-1.5 text-[11px] font-medium text-[var(--accent)]",style:{backgroundColor:"rgba(34,197,94,0.12)"},children:[e.jsx(R,{className:"h-3 w-3"}),e.jsx("span",{className:"hidden md:inline",children:i("review.launch_short")})]})]},c.id))}),e.jsx(_,{pag:l}),h!==null&&e.jsx(V,{taskId:h,onClose:()=>b(null),onLaunched:()=>{t(),r(l.cursor)}})]})}function Y(t){const n=new Map;for(const s of t){const i=s.sourceTaskId??s.id;n.has(i)||n.set(i,[]),n.get(i).push(s)}return Array.from(n.entries()).map(([s,i])=>({sourceTaskId:s,tasks:i}))}function ee({group:t,onClick:n}){const s=t.tasks[0],i=t.tasks.every(o=>o.status===p.COMPLETED||o.status===p.FAILED||o.status===p.CANCELLED),x=s==null?void 0:s.sourceCommitSha;return e.jsxs("div",{onClick:n,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:[e.jsx("span",{className:`h-2 w-2 shrink-0 rounded-full ${i?"bg-[var(--accent)]":"bg-[var(--warning)]"}`}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx(A,{content:(s==null?void 0:s.sourceTaskDescription)??(s==null?void 0:s.description),className:"truncate",children:e.jsxs("span",{className:"truncate text-xs text-[var(--text-primary)]",children:["source #",t.sourceTaskId]})}),x&&e.jsxs("span",{className:"shrink-0 font-mono text-[11px] text-[var(--accent)]",children:["@",x.slice(0,7)]})]}),e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:[t.tasks.length," ",t.tasks.length===1?"agent":"agents"," · ",t.tasks.map(o=>(o.agentType??"claude").toLowerCase()).join(", ")]})]}),s&&e.jsx("span",{className:"shrink-0 rounded-[4px] border border-[var(--border)] px-2 py-0.5 text-[11px] text-[var(--text-muted)]",children:s.projectKey}),s&&e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:P(s.createdAt)}),e.jsx("div",{className:"flex shrink-0 items-center gap-1",children:t.tasks.map(o=>e.jsx("span",{className:`h-2 w-2 rounded-full ${Z(o.status)}`,title:o.status.toLowerCase()},o.id))})]})}function C({mode:t,projectFilter:n,developerFilter:s}){const{t:i}=y(),x=S(),[o,u]=a.useState([]),[g,m]=a.useState(!0),h=$(),b=a.useCallback(async l=>{m(!0);try{const r=new URLSearchParams({taskMode:"review",limit:String(I),groupBySource:"true"});t==="in_progress"?r.set("status",[p.QUEUED,p.ASSIGNED,p.RUNNING,p.SUSPENDED].join(",")):r.set("status",[p.COMPLETED,p.FAILED,p.CANCELLED].join(",")),n&&r.set("projectKey",n),s&&r.set("sourceDeveloperId",s),l&&r.set("cursor",l);const c=await N.get(`web/tasks?${r}`).json();u(Y(c.data??[])),h.setNextCursor(c.nextCursor??void 0)}catch{u([]),h.setNextCursor(void 0)}finally{m(!1)}},[t,n,s]);return a.useEffect(()=>{b(h.cursor)},[b,h.cursor]),g&&o.length===0?e.jsx("div",{className:"p-4",children:e.jsx(L,{rows:4})}):!g&&o.length===0&&!h.hasPrev?e.jsx(D,{icon:E,title:i("review.no_reviews")}):e.jsxs(e.Fragment,{children:[o.length>0&&e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:o.map(l=>e.jsx(ee,{group:l,onClick:()=>x(`/review/${l.sourceTaskId}`)},l.sourceTaskId))}),e.jsx(_,{pag:h})]})}function pe(){const{t}=y(),n=G(v=>v.taskSeq),[s,i]=a.useState("pending"),[x,o]=a.useState(0),[u,g]=a.useState(""),[m,h]=a.useState(""),[b,l]=a.useState([]),[r,c]=a.useState([]);K(null);const f=a.useCallback(()=>o(v=>v+1),[]);a.useEffect(()=>{let v=!1;return(async()=>{try{const[U,M]=await Promise.all([N.get("web/projects").json(),N.get("web/projects/-/developers").json()]);if(v)return;l(U),c(M)}catch{}})(),()=>{v=!0}},[]);const d=a.useMemo(()=>[{value:"",label:t("tasks.filter_project")},...b.map(v=>({value:v.key,label:v.name}))],[b,t]),j=a.useMemo(()=>[{value:"",label:t("tasks.filter_developer")},...r.map(v=>({value:String(v.id),label:v.name}))],[r,t]),O=[{key:"pending",label:t("review.pending")},{key:"in_progress",label:t("review.in_progress")},{key:"history",label:t("review.history")}];return e.jsxs("div",{className:"mx-auto max-w-6xl px-2 py-4 md:px-4 md:py-6 font-mono",children:[e.jsx("h1",{className:"sr-only",children:t("review.title")}),e.jsxs("div",{className:"mb-4 flex flex-col gap-3 md:gap-4 md:flex-row md:items-center",children:[e.jsx("div",{className:"flex items-center gap-1 overflow-x-auto pb-1 md:pb-0 no-scrollbar",children:O.map(v=>e.jsx("button",{onClick:()=>i(v.key),className:`shrink-0 rounded-[4px] px-3 py-2 h-8 text-xs transition-colors ${s===v.key?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)] bg-[var(--bg-card)] hover:text-[var(--text-secondary)]"}`,children:v.label},v.key))}),e.jsxs("div",{className:"flex flex-col gap-2 md:ml-auto md:flex-row md:items-center",children:[e.jsx(k,{value:u,onChange:g,options:d,className:"md:w-40"}),e.jsx(k,{value:m,onChange:h,options:j,className:"md:w-40"})]})]}),s==="pending"&&e.jsx(W,{onRefresh:f,projectFilter:u,developerFilter:m},`pending-${x}-${n}-${u}-${m}`),s==="in_progress"&&e.jsx(C,{mode:"in_progress",projectFilter:u,developerFilter:m},`inprogress-${x}-${n}-${u}-${m}`),s==="history"&&e.jsx(C,{mode:"history",projectFilter:u,developerFilter:m},`history-${x}-${n}-${u}-${m}`)]})}export{pe as default};
1
+ import{a as y,k as G,r as a,w as K,j as e,h as N,f as S,o as p,E,l as F,X as T,H as B,t as w,O as H}from"./index-PZwTchr_.js";import{E as D}from"./EmptyState-BfgwLg0u.js";import{T as L}from"./Skeleton-CNV0Dyd8.js";import{S as k}from"./Select-CaAVBHmI.js";import{f as P}from"./date-RFA7-ZGs.js";import{T as A}from"./Tooltip-DzkVglKi.js";import{a as q}from"./agent-type-options-BiwwFXJv.js";import{g as z}from"./task-constants-CSVY_jfk.js";import{P as R}from"./play-DFj8BMl8.js";import{C as Q}from"./chevron-left-D5fJVFiB.js";import{C as X}from"./chevron-right-Bz-j2WmS.js";import"./chevron-down-DyqUpmgf.js";function $(){const[t,n]=a.useState(void 0),[s,i]=a.useState(void 0),[x,o]=a.useState([]),u=a.useRef(void 0),g=a.useRef(void 0);u.current=t,g.current=s;const m=a.useCallback(d=>{n(d)},[]),h=a.useCallback(()=>{const d=u.current;d&&(o(j=>[...j,g.current??""]),i(d))},[]),b=a.useRef([]);b.current=x;const l=a.useCallback(()=>{const d=b.current;d.length!==0&&(i(d.at(-1)||void 0),o(d.slice(0,-1)))},[]),r=x.length+1,c=x.length>0;return{cursor:s,setNextCursor:m,goNext:h,goPrev:l,pageNumber:r,hasPrev:c,hasNext:!!t}}const I=20;function Z(t){switch(t){case p.RUNNING:return"bg-[var(--accent)]";case p.QUEUED:return"bg-[var(--warning)]";case p.ASSIGNED:return"bg-[var(--info)]";case p.SUSPENDED:return"bg-[var(--warning)]";case p.COMPLETED:return"bg-[var(--accent)]";case p.FAILED:return"bg-[var(--destructive)]";case p.CANCELLED:return"bg-[#525252]";default:return"bg-[#525252]"}}const J=q(z);function V({taskId:t,onClose:n,onLaunched:s}){const{t:i}=y(),[x,o]=a.useState([H.CLAUDE]),[u,g]=a.useState(""),[m,h]=a.useState(!1);function b(r){o(c=>c.includes(r)?c.filter(f=>f!==r):[...c,r])}async function l(){if(x.length===0){w.error("select at least one review agent.");return}h(!0);try{await N.post(`web/tasks/${t}/review`,{json:{agentTypes:x,description:u.trim()||void 0}}),w.success("review launched"),s(),n()}catch(r){const c=r instanceof Error?r.message:String(r);w.error(c)}finally{h(!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:i("review.launch")}),e.jsx("button",{onClick:n,className:"text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:e.jsx(T,{className:"h-4 w-4"})})]}),e.jsxs("p",{className:"mb-3 text-[11px] text-[var(--text-muted)]",children:["task #",t," — ",i("review.select_agents")]}),e.jsx("div",{className:"mb-4 flex flex-col gap-2",children:J.map(r=>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:x.includes(r.value),onChange:()=>b(r.value),className:"h-3.5 w-3.5 accent-[var(--accent)]"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:r.label})]},r.value))}),e.jsx("textarea",{value:u,onChange:r=>g(r.target.value),placeholder:i("review.description_placeholder"),rows:3,className:"mb-4 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("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:l,disabled:m||x.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(R,{className:"h-3 w-3"}),i(m?"common.processing":"review.launch")]}),e.jsx("button",{onClick:n,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:i("common.cancel")})]})]})})}function _({pag:t}){const{t:n}=y();return!t.hasPrev&&!t.hasNext?null:e.jsxs("div",{className:"mt-6 flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["// page ",t.pageNumber]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:t.goPrev,disabled:!t.hasPrev,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:[e.jsx(Q,{className:"h-3.5 w-3.5"}),n("tasks.prev")]}),e.jsxs("button",{onClick:t.goNext,disabled:!t.hasNext,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:[n("common.next"),e.jsx(X,{className:"h-3.5 w-3.5"})]})]})]})}function W({onRefresh:t,projectFilter:n,developerFilter:s}){const{t:i}=y(),x=S(),[o,u]=a.useState([]),[g,m]=a.useState(!0),[h,b]=a.useState(null),l=$(),r=a.useCallback(async c=>{m(!0);try{const f=new Date(Date.now()-6048e5).toISOString(),d=new URLSearchParams({status:p.COMPLETED,taskMode:"develop",reviewStatus:"null",completedAfter:f,limit:String(I)});n&&d.set("projectKey",n),s&&d.set("developerId",s),c&&d.set("cursor",c);const j=await N.get(`web/tasks?${d}`).json();u(j.data??[]),l.setNextCursor(j.nextCursor)}catch{u([]),l.setNextCursor(void 0)}finally{m(!1)}},[n,s]);return a.useEffect(()=>{r(l.cursor)},[r,l.cursor]),g&&o.length===0?e.jsx("div",{className:"p-4",children:e.jsx(L,{rows:4})}):!g&&o.length===0&&!l.hasPrev?e.jsx(D,{icon:E,title:i("review.no_reviews"),description:i("review.pending")}):e.jsxs(e.Fragment,{children:[o.length>0&&e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:o.map(c=>e.jsxs("div",{className:"flex items-center gap-3 border-b border-[var(--border)] px-4 py-3 last:border-b-0",children:[e.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full bg-[var(--accent)]"}),e.jsx(A,{content:c.description,className:"flex-1 min-w-0",children:e.jsxs("span",{className:"cursor-pointer truncate text-xs text-[var(--text-primary)] hover:text-[var(--accent)] transition-colors block",onClick:()=>x(`/tasks/${c.id}`),children:["#",c.id," ",F(c)]})}),e.jsx("span",{className:"shrink-0 rounded-[4px] border border-[var(--border)] px-2 py-0.5 text-[11px] text-[var(--text-muted)]",children:c.projectKey}),e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:P(c.completedAt??c.createdAt)}),e.jsxs("button",{onClick:async()=>{try{await N.post(`web/tasks/${c.id}/review-status`,{json:{reviewStatus:"dismissed"}}),r(l.cursor)}catch(f){let d="Failed to dismiss";try{if(f instanceof B){const j=await f.response.json();d=(j==null?void 0:j.message)??d}else f instanceof Error&&(d=f.message)}catch{}w.error(d)}},className:"shrink-0 flex items-center gap-1.5 rounded-[4px] px-3 py-1.5 text-[11px] font-medium text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:[e.jsx(T,{className:"h-3 w-3"}),"Dismiss"]}),e.jsxs("button",{onClick:()=>b(c.id),className:"shrink-0 flex items-center gap-1.5 rounded-[4px] px-3 py-1.5 text-[11px] font-medium text-[var(--accent)]",style:{backgroundColor:"rgba(34,197,94,0.12)"},children:[e.jsx(R,{className:"h-3 w-3"}),e.jsx("span",{className:"hidden md:inline",children:i("review.launch_short")})]})]},c.id))}),e.jsx(_,{pag:l}),h!==null&&e.jsx(V,{taskId:h,onClose:()=>b(null),onLaunched:()=>{t(),r(l.cursor)}})]})}function Y(t){const n=new Map;for(const s of t){const i=s.sourceTaskId??s.id;n.has(i)||n.set(i,[]),n.get(i).push(s)}return Array.from(n.entries()).map(([s,i])=>({sourceTaskId:s,tasks:i}))}function ee({group:t,onClick:n}){const s=t.tasks[0],i=t.tasks.every(o=>o.status===p.COMPLETED||o.status===p.FAILED||o.status===p.CANCELLED),x=s==null?void 0:s.sourceCommitSha;return e.jsxs("div",{onClick:n,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:[e.jsx("span",{className:`h-2 w-2 shrink-0 rounded-full ${i?"bg-[var(--accent)]":"bg-[var(--warning)]"}`}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx(A,{content:(s==null?void 0:s.sourceTaskDescription)??(s==null?void 0:s.description),className:"truncate",children:e.jsxs("span",{className:"truncate text-xs text-[var(--text-primary)]",children:["source #",t.sourceTaskId]})}),x&&e.jsxs("span",{className:"shrink-0 font-mono text-[11px] text-[var(--accent)]",children:["@",x.slice(0,7)]})]}),e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:[t.tasks.length," ",t.tasks.length===1?"agent":"agents"," · ",t.tasks.map(o=>(o.agentType??"claude").toLowerCase()).join(", ")]})]}),s&&e.jsx("span",{className:"shrink-0 rounded-[4px] border border-[var(--border)] px-2 py-0.5 text-[11px] text-[var(--text-muted)]",children:s.projectKey}),s&&e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:P(s.createdAt)}),e.jsx("div",{className:"flex shrink-0 items-center gap-1",children:t.tasks.map(o=>e.jsx("span",{className:`h-2 w-2 rounded-full ${Z(o.status)}`,title:o.status.toLowerCase()},o.id))})]})}function C({mode:t,projectFilter:n,developerFilter:s}){const{t:i}=y(),x=S(),[o,u]=a.useState([]),[g,m]=a.useState(!0),h=$(),b=a.useCallback(async l=>{m(!0);try{const r=new URLSearchParams({taskMode:"review",limit:String(I),groupBySource:"true"});t==="in_progress"?r.set("status",[p.QUEUED,p.ASSIGNED,p.RUNNING,p.SUSPENDED].join(",")):r.set("status",[p.COMPLETED,p.FAILED,p.CANCELLED].join(",")),n&&r.set("projectKey",n),s&&r.set("sourceDeveloperId",s),l&&r.set("cursor",l);const c=await N.get(`web/tasks?${r}`).json();u(Y(c.data??[])),h.setNextCursor(c.nextCursor??void 0)}catch{u([]),h.setNextCursor(void 0)}finally{m(!1)}},[t,n,s]);return a.useEffect(()=>{b(h.cursor)},[b,h.cursor]),g&&o.length===0?e.jsx("div",{className:"p-4",children:e.jsx(L,{rows:4})}):!g&&o.length===0&&!h.hasPrev?e.jsx(D,{icon:E,title:i("review.no_reviews")}):e.jsxs(e.Fragment,{children:[o.length>0&&e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:o.map(l=>e.jsx(ee,{group:l,onClick:()=>x(`/review/${l.sourceTaskId}`)},l.sourceTaskId))}),e.jsx(_,{pag:h})]})}function pe(){const{t}=y(),n=G(v=>v.taskSeq),[s,i]=a.useState("pending"),[x,o]=a.useState(0),[u,g]=a.useState(""),[m,h]=a.useState(""),[b,l]=a.useState([]),[r,c]=a.useState([]);K(null);const f=a.useCallback(()=>o(v=>v+1),[]);a.useEffect(()=>{let v=!1;return(async()=>{try{const[U,M]=await Promise.all([N.get("web/projects").json(),N.get("web/projects/-/developers").json()]);if(v)return;l(U),c(M)}catch{}})(),()=>{v=!0}},[]);const d=a.useMemo(()=>[{value:"",label:t("tasks.filter_project")},...b.map(v=>({value:v.key,label:v.name}))],[b,t]),j=a.useMemo(()=>[{value:"",label:t("tasks.filter_developer")},...r.map(v=>({value:String(v.id),label:v.name}))],[r,t]),O=[{key:"pending",label:t("review.pending")},{key:"in_progress",label:t("review.in_progress")},{key:"history",label:t("review.history")}];return e.jsxs("div",{className:"mx-auto max-w-6xl px-2 py-4 md:px-4 md:py-6 font-mono",children:[e.jsx("h1",{className:"sr-only",children:t("review.title")}),e.jsxs("div",{className:"mb-4 flex flex-col gap-3 md:gap-4 md:flex-row md:items-center",children:[e.jsx("div",{className:"flex items-center gap-1 overflow-x-auto pb-1 md:pb-0 no-scrollbar",children:O.map(v=>e.jsx("button",{onClick:()=>i(v.key),className:`shrink-0 rounded-[4px] px-3 py-2 h-8 text-xs transition-colors ${s===v.key?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)] bg-[var(--bg-card)] hover:text-[var(--text-secondary)]"}`,children:v.label},v.key))}),e.jsxs("div",{className:"flex flex-col gap-2 md:ml-auto md:flex-row md:items-center",children:[e.jsx(k,{value:u,onChange:g,options:d,className:"md:w-40"}),e.jsx(k,{value:m,onChange:h,options:j,className:"md:w-40"})]})]}),s==="pending"&&e.jsx(W,{onRefresh:f,projectFilter:u,developerFilter:m},`pending-${x}-${n}-${u}-${m}`),s==="in_progress"&&e.jsx(C,{mode:"in_progress",projectFilter:u,developerFilter:m},`inprogress-${x}-${n}-${u}-${m}`),s==="history"&&e.jsx(C,{mode:"history",projectFilter:u,developerFilter:m},`history-${x}-${n}-${u}-${m}`)]})}export{pe as default};
@@ -1 +1 @@
1
- import{r as l,j as t}from"./index-D3EF0BU0.js";import{C as f}from"./chevron-down-54sz-rQX.js";function h({value:r,onChange:x,options:c,placeholder:u,disabled:n=!1,className:m=""}){var i;const[a,o]=l.useState(!1),s=l.useRef(null),d=((i=c.find(e=>e.value===r))==null?void 0:i.label)??u??"";return l.useEffect(()=>{function e(v){s.current&&!s.current.contains(v.target)&&o(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),t.jsxs("div",{ref:s,className:`relative ${m}`,children:[t.jsxs("button",{type:"button",disabled:n,onClick:()=>!n&&o(!a),"aria-expanded":a,"aria-haspopup":"listbox",className:`flex w-full items-center justify-between rounded-[4px] border bg-[var(--bg-input)] px-3 py-2 font-mono text-xs outline-none transition-colors ${a?"border-[var(--accent)] text-[var(--text-primary)]":"border-[var(--border)] text-[var(--text-primary)] hover:border-[var(--text-muted)]"} ${n?"cursor-not-allowed opacity-50":"cursor-pointer"}`,children:[t.jsx("span",{className:r?"":"text-[var(--text-muted)]",children:d}),t.jsx(f,{size:12,className:`ml-2 shrink-0 text-[var(--text-muted)] transition-transform ${a?"rotate-180":""}`})]}),a&&t.jsx("div",{role:"listbox",className:"absolute right-0 z-50 mt-1 max-h-48 min-w-full w-max max-w-[calc(100vw-2rem)] overflow-auto rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] py-1 shadow-lg",children:c.map(e=>t.jsxs("button",{type:"button",role:"option","aria-selected":e.value===r,onClick:()=>{x(e.value),o(!1)},className:`flex w-full items-center px-3 py-1.5 text-left font-mono text-xs transition-colors ${e.value===r?"bg-[var(--accent)]/10 text-[var(--accent)]":"text-[var(--text-secondary)] hover:bg-[var(--bg-input)] hover:text-[var(--text-primary)]"}`,children:[e.value===r&&t.jsx("span",{className:"mr-2 text-[var(--accent)]",children:">"}),e.label]},e.value))})]})}export{h as S};
1
+ import{r as l,j as t}from"./index-PZwTchr_.js";import{C as f}from"./chevron-down-DyqUpmgf.js";function h({value:r,onChange:x,options:c,placeholder:u,disabled:n=!1,className:m=""}){var i;const[a,o]=l.useState(!1),s=l.useRef(null),d=((i=c.find(e=>e.value===r))==null?void 0:i.label)??u??"";return l.useEffect(()=>{function e(v){s.current&&!s.current.contains(v.target)&&o(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),t.jsxs("div",{ref:s,className:`relative ${m}`,children:[t.jsxs("button",{type:"button",disabled:n,onClick:()=>!n&&o(!a),"aria-expanded":a,"aria-haspopup":"listbox",className:`flex w-full items-center justify-between rounded-[4px] border bg-[var(--bg-input)] px-3 py-2 font-mono text-xs outline-none transition-colors ${a?"border-[var(--accent)] text-[var(--text-primary)]":"border-[var(--border)] text-[var(--text-primary)] hover:border-[var(--text-muted)]"} ${n?"cursor-not-allowed opacity-50":"cursor-pointer"}`,children:[t.jsx("span",{className:r?"":"text-[var(--text-muted)]",children:d}),t.jsx(f,{size:12,className:`ml-2 shrink-0 text-[var(--text-muted)] transition-transform ${a?"rotate-180":""}`})]}),a&&t.jsx("div",{role:"listbox",className:"absolute right-0 z-50 mt-1 max-h-48 min-w-full w-max max-w-[calc(100vw-2rem)] overflow-auto rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] py-1 shadow-lg",children:c.map(e=>t.jsxs("button",{type:"button",role:"option","aria-selected":e.value===r,onClick:()=>{x(e.value),o(!1)},className:`flex w-full items-center px-3 py-1.5 text-left font-mono text-xs transition-colors ${e.value===r?"bg-[var(--accent)]/10 text-[var(--accent)]":"text-[var(--text-secondary)] hover:bg-[var(--bg-input)] hover:text-[var(--text-primary)]"}`,children:[e.value===r&&t.jsx("span",{className:"mr-2 text-[var(--accent)]",children:">"}),e.label]},e.value))})]})}export{h as S};
@@ -1,4 +1,4 @@
1
- import{c as h,a as v,r,j as e,h as m,t as u}from"./index-D3EF0BU0.js";/**
1
+ import{c as h,a as v,r,j as e,h as m,t as u}from"./index-PZwTchr_.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{j as e}from"./index-D3EF0BU0.js";const n="rounded-[4px] bg-[var(--border)] animate-pulse";function c({rows:r=5}){const a=[[60,200,80,120],[60,160,100,80],[60,220,70,140],[60,180,90,100],[60,190,110,90]];return e.jsx("div",{className:"flex flex-col gap-3",children:Array.from({length:r}).map((s,l)=>{const t=a[l%a.length];return e.jsx("div",{className:"flex gap-4",children:t.map((i,o)=>e.jsx("div",{className:n,style:{width:i,height:12}},o))},l)})})}function m({cards:r=4}){return e.jsx("div",{className:"grid grid-cols-2 gap-3",children:Array.from({length:r}).map((a,s)=>e.jsx("div",{className:`${n} h-20`},s))})}export{m as C,c as T};
1
+ import{j as e}from"./index-PZwTchr_.js";const n="rounded-[4px] bg-[var(--border)] animate-pulse";function c({rows:r=5}){const a=[[60,200,80,120],[60,160,100,80],[60,220,70,140],[60,180,90,100],[60,190,110,90]];return e.jsx("div",{className:"flex flex-col gap-3",children:Array.from({length:r}).map((s,l)=>{const t=a[l%a.length];return e.jsx("div",{className:"flex gap-4",children:t.map((i,o)=>e.jsx("div",{className:n,style:{width:i,height:12}},o))},l)})})}function m({cards:r=4}){return e.jsx("div",{className:"grid grid-cols-2 gap-3",children:Array.from({length:r}).map((a,s)=>e.jsx("div",{className:`${n} h-20`},s))})}export{m as C,c as T};
@@ -1 +1 @@
1
- import{a as t,j as e}from"./index-D3EF0BU0.js";import{I as c,C as r}from"./DocsPrimitives-m1oUERel.js";import{E as n}from"./external-link-B4tgsST2.js";import"./copy-B-4Hfvcn.js";const o=[{action:"create tasks",desc:"describe what you want done, overlord dispatches to a worker"},{action:"list & monitor tasks",desc:"check status, read execution logs, track progress"},{action:"cancel & retry tasks",desc:"manage task lifecycle"},{action:"confirm pipeline stages",desc:"approve or provide input for suspended stages"},{action:"manage projects",desc:"list projects, view members"},{action:"check cluster health",desc:"see worker status, online workers, queue depth"},{action:"search",desc:"find tasks, projects, and workers by keyword"},{action:"read notifications",desc:"check and clear your notification inbox"}],d=['create a task in project "frontend" to fix the login page styling',"what tasks are running right now?","show me the logs for task 42","how many workers are online?","cancel task 15"],i=[{name:"claude code",url:"https://claude.com/claude-code"},{name:"cursor",url:"https://cursor.com/cli"},{name:"windsurf",url:"https://windsurf.com"},{name:"codex",url:"https://openai.com/codex"}];function u(){t();const a=typeof window<"u"?window.location.origin:"https://your-server";return e.jsxs("div",{className:"mx-auto max-w-4xl px-4 md:px-6 py-8 font-mono lowercase",children:[e.jsx("div",{className:"mb-8",children:e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"// use overlord from your ai coding assistant — claude code, cursor, windsurf, codex, and more. install the skill and your assistant can create tasks, monitor execution, and manage your fleet."})}),e.jsxs("div",{className:"mb-8 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"// install"}),e.jsx(c,{code:"npx skills add overlord-run/skill"})]}),e.jsxs("div",{className:"mb-8 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"// configure — set these environment variables"}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between rounded-[4px] bg-[var(--bg-primary)] px-3 py-2 overflow-x-auto",children:[e.jsxs("code",{className:"text-xs text-[var(--text-primary)] whitespace-nowrap",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"export "}),"OVERLORD_SERVER=",e.jsx("span",{className:"text-[var(--accent)]",children:a})]}),e.jsx(r,{text:`export OVERLORD_SERVER=${a}`})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-[4px] bg-[var(--bg-primary)] px-3 py-2 overflow-x-auto",children:[e.jsxs("code",{className:"text-xs text-[var(--text-primary)] whitespace-nowrap",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"export "}),"OVERLORD_TOKEN=",e.jsx("span",{className:"text-[var(--text-secondary)]",children:"your-token"})]}),e.jsx(r,{text:"export OVERLORD_TOKEN=your-token"})]})]}),e.jsxs("p",{className:"text-[11px] text-[var(--text-muted)]",children:["// create a token at ",e.jsx("a",{href:"/access-tokens",className:"text-[var(--accent)] hover:underline",children:"/access-tokens"})]})]}),e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{className:"mb-4 text-sm text-[var(--accent)]",children:"> capabilities"}),e.jsx("div",{className:"space-y-2",children:o.map(s=>e.jsxs("div",{className:"flex items-start gap-3 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3",children:[e.jsx("span",{className:"shrink-0 text-xs font-medium text-[var(--text-primary)]",children:s.action}),e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["// ",s.desc]})]},s.action))})]}),e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{className:"mb-4 text-sm text-[var(--accent)]",children:"> example usage"}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-2",children:[e.jsx("p",{className:"mb-3 text-xs text-[var(--text-muted)]",children:"// just ask your ai agent naturally"}),d.map(s=>e.jsx("div",{className:"rounded-[4px] bg-[var(--bg-primary)] px-3 py-2",children:e.jsxs("code",{className:"text-xs text-[var(--text-secondary)]",children:[e.jsx("span",{className:"text-[var(--accent)]",children:"> "}),s]})},s))]})]}),e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{className:"mb-4 text-sm text-[var(--accent)]",children:"> compatible tools"}),e.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:i.map(s=>e.jsxs("a",{href:s.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-center gap-1.5 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2.5 text-xs text-[var(--text-primary)] transition-colors hover:border-[var(--accent)]",children:[s.name,e.jsx(n,{className:"h-3 w-3 text-[var(--text-muted)]"})]},s.name))}),e.jsx("p",{className:"mt-2 text-[11px] text-[var(--text-muted)]",children:"// and any ai coding assistant that supports the skills protocol"})]}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["// open source:"," ",e.jsx("a",{href:"https://github.com/overlord-run/skill",target:"_blank",rel:"noopener noreferrer",className:"text-[var(--accent)] hover:underline",children:"github.com/overlord-run/skill"})]})})]})}export{u as default};
1
+ import{a as t,j as e}from"./index-PZwTchr_.js";import{I as c,C as r}from"./DocsPrimitives-DCBNKtsW.js";import{E as n}from"./external-link-Bbo-dc9z.js";import"./copy-Dtpgo9EK.js";const o=[{action:"create tasks",desc:"describe what you want done, overlord dispatches to a worker"},{action:"list & monitor tasks",desc:"check status, read execution logs, track progress"},{action:"cancel & retry tasks",desc:"manage task lifecycle"},{action:"confirm pipeline stages",desc:"approve or provide input for suspended stages"},{action:"manage projects",desc:"list projects, view members"},{action:"check cluster health",desc:"see worker status, online workers, queue depth"},{action:"search",desc:"find tasks, projects, and workers by keyword"},{action:"read notifications",desc:"check and clear your notification inbox"}],d=['create a task in project "frontend" to fix the login page styling',"what tasks are running right now?","show me the logs for task 42","how many workers are online?","cancel task 15"],i=[{name:"claude code",url:"https://claude.com/claude-code"},{name:"cursor",url:"https://cursor.com/cli"},{name:"windsurf",url:"https://windsurf.com"},{name:"codex",url:"https://openai.com/codex"}];function u(){t();const a=typeof window<"u"?window.location.origin:"https://your-server";return e.jsxs("div",{className:"mx-auto max-w-4xl px-4 md:px-6 py-8 font-mono lowercase",children:[e.jsx("div",{className:"mb-8",children:e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"// use overlord from your ai coding assistant — claude code, cursor, windsurf, codex, and more. install the skill and your assistant can create tasks, monitor execution, and manage your fleet."})}),e.jsxs("div",{className:"mb-8 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"// install"}),e.jsx(c,{code:"npx skills add overlord-run/skill"})]}),e.jsxs("div",{className:"mb-8 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"// configure — set these environment variables"}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between rounded-[4px] bg-[var(--bg-primary)] px-3 py-2 overflow-x-auto",children:[e.jsxs("code",{className:"text-xs text-[var(--text-primary)] whitespace-nowrap",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"export "}),"OVERLORD_SERVER=",e.jsx("span",{className:"text-[var(--accent)]",children:a})]}),e.jsx(r,{text:`export OVERLORD_SERVER=${a}`})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-[4px] bg-[var(--bg-primary)] px-3 py-2 overflow-x-auto",children:[e.jsxs("code",{className:"text-xs text-[var(--text-primary)] whitespace-nowrap",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"export "}),"OVERLORD_TOKEN=",e.jsx("span",{className:"text-[var(--text-secondary)]",children:"your-token"})]}),e.jsx(r,{text:"export OVERLORD_TOKEN=your-token"})]})]}),e.jsxs("p",{className:"text-[11px] text-[var(--text-muted)]",children:["// create a token at ",e.jsx("a",{href:"/access-tokens",className:"text-[var(--accent)] hover:underline",children:"/access-tokens"})]})]}),e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{className:"mb-4 text-sm text-[var(--accent)]",children:"> capabilities"}),e.jsx("div",{className:"space-y-2",children:o.map(s=>e.jsxs("div",{className:"flex items-start gap-3 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3",children:[e.jsx("span",{className:"shrink-0 text-xs font-medium text-[var(--text-primary)]",children:s.action}),e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["// ",s.desc]})]},s.action))})]}),e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{className:"mb-4 text-sm text-[var(--accent)]",children:"> example usage"}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-2",children:[e.jsx("p",{className:"mb-3 text-xs text-[var(--text-muted)]",children:"// just ask your ai agent naturally"}),d.map(s=>e.jsx("div",{className:"rounded-[4px] bg-[var(--bg-primary)] px-3 py-2",children:e.jsxs("code",{className:"text-xs text-[var(--text-secondary)]",children:[e.jsx("span",{className:"text-[var(--accent)]",children:"> "}),s]})},s))]})]}),e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{className:"mb-4 text-sm text-[var(--accent)]",children:"> compatible tools"}),e.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:i.map(s=>e.jsxs("a",{href:s.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-center gap-1.5 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2.5 text-xs text-[var(--text-primary)] transition-colors hover:border-[var(--accent)]",children:[s.name,e.jsx(n,{className:"h-3 w-3 text-[var(--text-muted)]"})]},s.name))}),e.jsx("p",{className:"mt-2 text-[11px] text-[var(--text-muted)]",children:"// and any ai coding assistant that supports the skills protocol"})]}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["// open source:"," ",e.jsx("a",{href:"https://github.com/overlord-run/skill",target:"_blank",rel:"noopener noreferrer",className:"text-[var(--accent)] hover:underline",children:"github.com/overlord-run/skill"})]})})]})}export{u as default};
@@ -0,0 +1,21 @@
1
+ import{c as oe,a as xe,r as n,z as P,h as f,j as e,H as zt,t as W,s as Ce,A as Kt,f as Wt,B as Xt,p as Ht,q as Vt,k as dt,o as y,R as Jt,L as ie,l as mt,m as Qt,X as _e,x as Yt,U as Zt,F as pt,b as es,G as _t,I as ts}from"./index-PZwTchr_.js";import{u as ss}from"./task.store-BTXbcXgO.js";import{P as ut}from"./PtyTerminal-CxBKQBbF.js";import{g as as,C as ht,H as rs}from"./ConfirmStageDialog-CJ8pWink.js";import{S as ft}from"./Select-CaAVBHmI.js";import{b as ns,f as Q,c as ls}from"./date-RFA7-ZGs.js";import{a as St}from"./status-colors-DDycfcf7.js";import{a as vt}from"./agent-type-options-BiwwFXJv.js";import{T as cs,g as Y}from"./task-constants-CSVY_jfk.js";import{T as is}from"./Tooltip-DzkVglKi.js";import{A as os}from"./arrow-left-BnN4eZhK.js";import{R as Ct}from"./rotate-ccw-CyltG4Qx.js";import{G as xs}from"./git-fork-A1WGp9ha.js";import{P as gt}from"./play-DFj8BMl8.js";import{E as bt}from"./external-link-Bbo-dc9z.js";import{L as Et}from"./loader-circle-nKG9e8iK.js";import{S as ds}from"./skip-forward-Ck7tY58a.js";import"./clock-DyV22whY.js";import"./chevron-down-DyqUpmgf.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 ms=oe("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
7
+ * @license lucide-react v0.469.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const ps=oe("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/**
12
+ * @license lucide-react v0.469.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const us=oe("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
17
+ * @license lucide-react v0.469.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const hs=oe("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);function fs(l,c){const a=new Date(l).getTime()-Date.now();if(a<=0)return c("tasks.tunnel_expired");const r=Math.floor(a/36e5),t=Math.floor(a%36e5/6e4);return r>0?c("tasks.tunnel_expires_hm",{h:r,m:t}):c("tasks.tunnel_expires_m",{m:t})}function jt(l){switch(l){case"CONNECTED":return"var(--accent)";case"STARTING":return"var(--warning)";case"EXPIRED":return"var(--text-muted)";default:return"var(--text-muted)"}}function Nt(l,c){switch(l){case"IDLE":case"CLOSED":return c("tasks.tunnel_idle");case"STARTING":return c("tasks.tunnel_starting");case"CONNECTED":return c("tasks.tunnel_connected");case"EXPIRED":return c("tasks.tunnel_expired");case"CLOSING":return c("tasks.tunnel_closing");default:return String(l).toLowerCase()}}function vs({taskId:l,taskFinished:c,compact:a}){const{t:r}=xe(),[t,d]=n.useState(P.IDLE),[m,_]=n.useState(null),[h,M]=n.useState(null),[R,Z]=n.useState(""),[x,S]=n.useState(!1),[de,O]=n.useState(!1),F=n.useRef(null),A=n.useCallback(async()=>{try{const v=await f.get(`web/workspace-tunnel/${l}/status`).json();d(v.status),_(v.tunnelUrl??null),M(v.expiresAt??null),(v.status==="EXPIRED"||v.status==="IDLE"||v.status==="CLOSED")&&C()}catch{}},[l]);function me(){C(),F.current=setInterval(A,5e3)}function C(){F.current&&(clearInterval(F.current),F.current=null)}n.useEffect(()=>{c&&(t===P.STARTING||t===P.CONNECTED)&&(d(P.IDLE),_(null),C())},[c,t]),n.useEffect(()=>{if(t!=="CONNECTED"||!h)return;const v=()=>{const E=fs(h,r);Z(E),E===r("tasks.tunnel_expired")&&(d(P.EXPIRED),_(null),C())};v();const I=setInterval(v,3e4);return()=>clearInterval(I)},[t,h]),n.useEffect(()=>()=>C(),[]),n.useEffect(()=>{c||A()},[A,c]);async function X(){S(!0);try{await f.post(`web/workspace-tunnel/${l}/start`),d(P.STARTING),me()}catch(v){let I=r("tasks.tunnel_start_failed");try{if(v instanceof zt){const E=await v.response.json();E!=null&&E.error&&(I=E.error,/code.*not found|ENOENT.*code|spawn code/i.test(I)&&(I+=". "+r("tasks.tunnel_install_code_hint")))}}catch{}W.error(I)}finally{S(!1)}}async function $(){S(!0);try{await f.post(`web/workspace-tunnel/${l}/stop`),d(P.IDLE),_(null),C()}catch{}finally{S(!1)}}async function U(){m&&(await navigator.clipboard.writeText(m),O(!0),setTimeout(()=>O(!1),2e3))}return a?e.jsxs("div",{className:"flex items-center gap-2 font-mono lowercase text-xs",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"ide_tunnel:"}),e.jsx("span",{style:{color:jt(t)},children:Nt(t,r)}),(t==="IDLE"||t==="CLOSED"||t==="EXPIRED")&&e.jsx("button",{onClick:X,disabled:x,className:"rounded-[4px] px-2 py-1 text-[var(--info)] disabled:opacity-50",style:{backgroundColor:"rgba(59,130,246,0.12)"},children:r(x?"tasks.tunnel_starting":"tasks.tunnel_start")}),t==="CONNECTED"&&m&&e.jsx("a",{href:m.replace(/^https?:/,"cursor:"),target:"_blank",rel:"noopener noreferrer",className:"rounded-[4px] px-2 py-1 text-[var(--info)]",style:{backgroundColor:"rgba(59,130,246,0.12)"},children:r("tasks.tunnel_open_in_cursor")})]}):e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 font-mono lowercase",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.tunnel_header")}),e.jsxs("span",{className:"text-xs",style:{color:jt(t)},children:["● ",Nt(t,r)]})]}),t==="CONNECTED"&&h&&e.jsxs("p",{className:"mb-2 text-xs text-[var(--text-muted)]",children:["// ",R]}),t==="CONNECTED"&&m&&e.jsxs("div",{className:"mb-3 flex items-center gap-2 rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] px-3 py-2",children:[e.jsx("code",{className:"flex-1 truncate text-xs text-[var(--text-primary)]",children:m}),e.jsxs("button",{onClick:U,className:"shrink-0 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors","aria-label":r("tasks.tunnel_copy_url"),children:["[",r("common.copy"),"]"]})]}),de&&e.jsx("p",{className:"mb-2 text-xs text-[var(--accent)]",children:r("tasks.tunnel_copied")}),t==="STARTING"&&e.jsx("p",{className:"mb-3 text-xs text-[var(--text-muted)]",children:r("tasks.tunnel_waiting")}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[(t==="IDLE"||t==="CLOSED")&&e.jsx("button",{onClick:X,disabled:x,className:"rounded-[4px] border border-[var(--accent)]/40 px-3 py-1.5 text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors disabled:opacity-50",children:r(x?"tasks.tunnel_starting_button":"tasks.tunnel_start_button")}),t==="STARTING"&&e.jsx("button",{onClick:$,disabled:x,className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors disabled:opacity-50",children:r(x?"tasks.tunnel_stopping":"tasks.tunnel_cancel")}),t==="CONNECTED"&&m&&e.jsxs(e.Fragment,{children:[e.jsx("a",{href:m.replace(/^https?:/,"cursor:"),target:"_blank",rel:"noopener noreferrer",className:"rounded-[4px] border border-[var(--accent)]/40 px-3 py-1.5 text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors",children:r("tasks.tunnel_open_cursor")}),e.jsx("a",{href:m.replace(/^https?:/,"vscode:"),target:"_blank",rel:"noopener noreferrer",className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:r("tasks.tunnel_open_vscode")}),e.jsx("button",{onClick:$,disabled:x,className:"rounded-[4px] border border-[var(--destructive)]/40 px-3 py-1.5 text-[var(--destructive)] hover:bg-[var(--destructive)]/10 transition-colors disabled:opacity-50",children:r(x?"tasks.tunnel_stopping":"tasks.tunnel_stop")})]}),t==="EXPIRED"&&e.jsx("button",{onClick:X,disabled:x,className:"rounded-[4px] border border-[var(--accent)]/40 px-3 py-1.5 text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors disabled:opacity-50",children:r(x?"tasks.tunnel_starting_button":"tasks.tunnel_restart")})]})]})}function gs({isOpen:l,onClose:c,onConfirm:a,taskId:r,isLoading:t}){const{t:d}=xe();return e.jsx(Ce,{isOpen:l,onClose:c,onConfirm:a,title:d("tasks.cancel_task_title"),message:d("tasks.cancel_task_message",{id:String(r)}),confirmLabel:d("tasks.cancel_task_confirm_label"),confirmVariant:"danger",isLoading:t})}function bs({isOpen:l,onClose:c,onConfirm:a,taskId:r,mrUrl:t,isLoading:d,reuseWorkspace:m,onReuseWorkspaceChange:_}){const{t:h}=xe(),M=t?h("tasks.retry_message_with_mr",{id:String(r),url:t}):h("tasks.retry_message_without_mr",{id:String(r)});return e.jsx(Ce,{isOpen:l,onClose:c,onConfirm:a,title:h("tasks.retry_title"),message:M,confirmLabel:h("tasks.retry_confirm_label"),confirmVariant:"accent",isLoading:d,children:e.jsxs("label",{className:"flex items-center gap-2 mt-3 text-[var(--text-muted)] text-xs cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:m,onChange:R=>_(R.target.checked),className:"w-3.5 h-3.5 cursor-pointer accent-[var(--accent)]"}),h("tasks.reuse_workspace_label")]})})}const ke=["implement","test","verify","review","simplify","rebase","submit"],js=["analyze","discuss","document","confirm"],Ns=["review","report","fix"],ys=["review","report"];function Se(l){if(typeof l=="string")try{return Se(JSON.parse(l))}catch{return null}if(!l||typeof l!="object")return null;const c=l.stages;if(!Array.isArray(c)||c.length===0)return null;const a=c.map(r=>r&&typeof r=="object"?r.name:null).filter(r=>typeof r=="string"&&r.length>0);return a.length===c.length?a:null}function ks(l){if(l.taskMode==="plan")return js;if(l.taskMode==="review"){let c=!1;if(l.configSnapshot)try{c=!!JSON.parse(l.configSnapshot).skipFix}catch{}return c?ys:Ns}if(!l.configSnapshot)return ke;try{const c=JSON.parse(l.configSnapshot);return Se(c.pipeline)??Se(c)??ke}catch{return ke}}function ws(l){switch(l){case"stage_change":return"text-[var(--accent)]";case"info":return"text-[var(--text-secondary)]";case"warning":return"text-[var(--warning)]";case"error":return"text-[var(--destructive)]";case"system":return"text-[var(--info)]";default:return"text-[var(--text-muted)]"}}function we({status:l,agentType:c}){const a=St(l),r=Y(c);return e.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-[4px] px-2 py-0.5 text-xs",style:{color:a},children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-[3px]",style:{backgroundColor:a}}),l.toLowerCase()," / ",r]})}function yt({stages:l,runningBg:c="bg-[#1a1a1a]",py:a="py-1.5"}){return e.jsx(e.Fragment,{children:l.map(r=>{const t=r.status==="completed",d=r.status==="running",m=r.status==="failed";return e.jsxs("div",{className:`flex items-center gap-2 rounded-[4px] px-2 ${a} ${d?c:""}`,children:[t&&e.jsx(ts,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),d&&e.jsx(Et,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),m&&e.jsx(_e,{className:"h-3.5 w-3.5 shrink-0 text-[var(--destructive)]"}),r.status==="pending"&&e.jsx(ms,{className:"h-3.5 w-3.5 shrink-0 text-[#525252]"}),e.jsx("span",{className:"text-xs",style:{color:t?"var(--accent)":d?"#e5e5e5":m?"var(--destructive)":"#525252",fontWeight:d?500:400},children:d?`> ${r.name}`:r.name})]},r.name)})})}function kt({task:l,ptyStatus:c,displayAgentType:a,t:r,gap:t="gap-2 md:gap-3"}){return e.jsxs("div",{className:`flex items-center ${t}`,children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:r("tasks.pty_terminal")}),e.jsxs("span",{className:`inline-flex items-center gap-1 text-[11px] ${c==="connected"?"text-[var(--accent)]":c==="connecting"?"text-[var(--warning)]":"text-[var(--text-muted)]"}`,children:[e.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${c==="connected"?"bg-[var(--accent)]":c==="connecting"?"bg-[var(--warning)]":"bg-[#525252]"}`}),r(`tasks.${c}`)]}),e.jsx("span",{className:"text-[11px]",style:{color:St(l.status)},children:l.status.toLowerCase()}),l.currentStage&&e.jsxs("span",{className:"hidden md:inline text-[11px] text-[var(--accent)]",children:[r("tasks.stage"),": ",l.currentStage]}),e.jsxs("span",{className:"hidden md:inline text-[11px] text-[var(--text-muted)]",children:["agent: ",a]}),l.workerName&&e.jsxs("span",{className:"hidden md:inline text-[11px] text-[var(--text-muted)]",children:["worker: ",l.workerName]})]})}function wt({isFinished:l,takeoverState:c,ptyRef:a,t:r}){return e.jsxs(e.Fragment,{children:[!l&&c==="auto"&&e.jsxs("button",{onClick:()=>{var t;return(t=a.current)==null?void 0:t.requestTakeover()},className:"flex items-center gap-1.5 rounded-[4px] px-2.5 h-10 md:h-8 text-[11px] font-medium text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:[e.jsx(rs,{className:"h-3 w-3"}),r("tasks.take_over")]}),!l&&c==="manual"&&e.jsxs("button",{onClick:()=>{var t;return(t=a.current)==null?void 0:t.releaseTakeover()},className:"flex items-center gap-1.5 rounded-[4px] px-2.5 h-10 md:h-8 text-[11px] font-medium text-[var(--accent)]",style:{backgroundColor:"rgba(34,197,94,0.12)"},children:[e.jsx(Ct,{className:"h-3 w-3"}),r("tasks.restore_auto")]})]})}function _s(l){const c=ks(l),a=l.currentStage?c.indexOf(l.currentStage):-1;return c.map((r,t)=>{let d="pending";return l.status===y.COMPLETED?d="completed":l.status===y.FAILED&&t<=a?d=t===a?"failed":"completed":a>=0&&(t<a?d="completed":t===a&&(d="running")),{name:r,status:d}})}function K(l,c){if(!l||!c)return null;const a=l.repoUrl.replace(/\.git$/,"").replace(/\/+$/,""),r=c.split("/").map(encodeURIComponent).join("/");return l.gitPlatform===_t.GITLAB?`${a}/-/tree/${r}`:`${a}/tree/${r}`}function Ss(l,c){if(!l)return null;const a=l.repoUrl.replace(/\.git$/,"").replace(/\/+$/,""),r=c.split("/").map(encodeURIComponent).join("/");return l.gitPlatform===_t.GITLAB?`${a}/-/tree/${r}/docs/specs`:`${a}/tree/${r}/docs/specs`}function Ws(){var it,ot,xt;const{id:l}=Kt(),c=Wt(),{t:a}=xe(),r=ss(s=>s.cancelTask),[t,d]=n.useState(null),[m,_]=n.useState(null),[h,M]=n.useState([]),[R,Z]=n.useState(!0),[x,S]=n.useState(null),[de,O]=n.useState(!1),[F,A]=n.useState(!1),[me,C]=n.useState(!1),[X,$]=n.useState(!1),[U,v]=n.useState(["claude"]),[I,E]=n.useState(""),[Ee,Te]=n.useState(!1),[Le,Ie]=n.useState(!1),[Tt,De]=n.useState(!1),[Lt,Re]=n.useState(!1),[It,Ae]=n.useState(!1),[$e,Pe]=n.useState(""),[Me,Oe]=n.useState(""),[Fe,Ue]=n.useState("append"),[qe,pe]=n.useState(!1),[Be,Dt]=Xt(),[N,ue]=n.useState("terminal"),[Ge,ze]=n.useState([]),[ee,Ke]=n.useState(0),[H,q]=n.useState(0),[V,We]=n.useState(""),[te,Rt]=n.useState(""),[At,he]=n.useState(!1),[$t,Xe]=n.useState(!1),[B,fe]=n.useState(null),[He,Ve]=n.useState("disconnected"),[ve,Je]=n.useState("auto"),se=n.useRef(null),Qe=n.useRef(null),[Ye,Ze]=n.useState([]),o=Number(l),b=t?cs.includes(t.status):!1;Ht(t?Vt(t,100):null);const T=n.useCallback(async()=>{try{const s=await f.get(`web/tasks/${o}`).json();d(s)}catch{}},[o]),ae=n.useCallback(async()=>{try{const s=await f.get(`web/tasks/${o}/logs`).json();M(s.lines)}catch{}},[o]),G=n.useCallback(async()=>{try{const s=await f.get(`web/tasks/${o}/pending-confirm`).json();S(s.confirm)}catch{S(null)}},[o]),et=n.useCallback(async()=>{he(!0);try{const s=new URLSearchParams;s.set("limit","50"),s.set("offset",String(H*50)),V&&s.set("type",V),te&&s.set("search",te);const i=await f.get(`web/tasks/${o}/events?${s}`).json();ze(i.events),Ke(i.total)}catch{}finally{he(!1)}},[o,H,V,te]);n.useEffect(()=>{N==="logs"&&et()},[N,et]),n.useEffect(()=>{N==="pipeline"&&!b&&f.get(`web/workspaces/${o}`).json().then(fe).catch(()=>fe(null))},[N,o,b]);const z=dt(s=>s.lastEvent),tt=dt(s=>s.eventSeq);n.useEffect(()=>{Z(!0),d(null),_(null),M([]),S(null),fe(null),ze([]),Ke(0),q(0),he(!1),Promise.all([T(),ae(),G()]).finally(()=>Z(!1))},[T,ae,G]),n.useEffect(()=>{t!=null&&t.projectKey&&f.get(`web/projects/${t.projectKey}`).json().then(_).catch(()=>_(null))},[t==null?void 0:t.projectKey]),n.useEffect(()=>{if(!t)return;let s=!1;return(async()=>{try{const i=[],p=[];let u=t.sourceTaskId??null,L=0;for(;u!=null&&L<2;){const w=await f.get(`web/tasks/${u}`).json();p.unshift({id:w.id,taskMode:w.taskMode??"develop"}),u=w.sourceTaskId??null,L++}i.push(...p),i.push({id:t.id,taskMode:t.taskMode??"develop"});const D=await f.get(`web/tasks?${new URLSearchParams({sourceTaskId:String(t.id),limit:"20"})}`).json();for(const w of D.data??[])i.push({id:w.id,taskMode:w.taskMode??"develop"});s||Ze(i)}catch{s||Ze([])}})(),()=>{s=!0}},[t==null?void 0:t.id,t==null?void 0:t.sourceTaskId,t==null?void 0:t.taskMode]),n.useEffect(()=>{!z||tt===0||(z.event==="task_status_changed"&&z.taskId===o||z.event==="task_created"&&z.taskId===o)&&(T(),G())},[tt,z,o,T,G]),n.useEffect(()=>{if(b)return;const i=setInterval(()=>{document.visibilityState!=="hidden"&&Promise.all([T(),ae(),G()])},15e3);return()=>clearInterval(i)},[b,T,ae,G]);const st=n.useCallback(()=>S(null),[]),re=n.useCallback(()=>{S(null),T()},[T]),Pt=(t==null?void 0:t.status)===y.FAILED||(t==null?void 0:t.status)===y.CANCELLED,ge=(t==null?void 0:t.status)===y.COMPLETED||(t==null?void 0:t.status)===y.FAILED||(t==null?void 0:t.status)===y.CANCELLED,Mt=(t==null?void 0:t.status)===y.COMPLETED&&(!(t!=null&&t.taskMode)||(t==null?void 0:t.taskMode)==="develop");n.useEffect(()=>{Be.get("action")==="fork"&&t&&!R&&(ge&&at(),Dt(s=>(s.delete("action"),s),{replace:!0}))},[t,R,Be,ge]);async function Ot(){De(!0);try{await r(o),O(!1),await T()}finally{De(!1)}}async function Ft(){Re(!0);try{await f.post(`web/tasks/${o}/retry`,{json:{reuseWorkspace:qe}}),A(!1),pe(!1),await T()}finally{Re(!1)}}function at(){Pe(""),Oe(""),Ue("append"),C(!0)}async function Ut(){Ae(!0);try{const s=$e.trim()||void 0,i=await f.post(`web/tasks/${o}/fork`,{json:{description:s,descriptionMode:s?Fe:void 0,agentType:Me||void 0}}).json();C(!1),W.success(a("tasks.fork_success")),c(`/tasks/${i.task.id}`)}catch{W.error(a("tasks.fork_error"))}finally{Ae(!1)}}async function qt(){if(t){Ie(!0);try{await f.post(`web/tasks/${o}/review`,{json:{agentTypes:U.length>0?U:["claude"],description:I.trim()||void 0,skipFix:Ee||void 0}}).json(),$(!1),E(""),Te(!1),c(`/review/${o}`)}catch(s){const i=s instanceof Error?s.message:String(s);W.error(i)}finally{Ie(!1)}}}const j=n.useMemo(()=>t?_s(t):[],[t==null?void 0:t.configSnapshot,t==null?void 0:t.currentStage,t==null?void 0:t.status]),be=j.findIndex(s=>s.status==="running"),ne=n.useMemo(()=>{if(!(t!=null&&t.configSnapshot))return[];try{const s=JSON.parse(t.configSnapshot);return Array.isArray(s.defaultReviewers)?s.defaultReviewers:[]}catch{return[]}},[t==null?void 0:t.configSnapshot]);if(n.useEffect(()=>{ne.length>0&&v(ne)},[ne.join(",")]),R)return e.jsx("div",{className:"flex h-full items-center justify-center font-mono",children:e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:a("tasks.loading_task")})});if(!t)return e.jsxs("div",{className:"mx-auto max-w-5xl px-6 py-8 font-mono lowercase text-center",children:[e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:a("tasks.task_not_found")}),e.jsxs("button",{onClick:()=>c("/tasks"),className:"mt-4 rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:["< ",a("tasks.back_to_tasks")]})]});const k=t.status===y.QUEUED&&t.queuePosition!=null&&t.queueTotal!=null?{position:t.queuePosition,total:t.queueTotal}:null,g=ns(t.startedAt,t.completedAt),J=as(t),je=Y(t.agentType),Bt=[{value:"",label:a("tasks.fork_agent_type_placeholder",{agent:Y(J)})},...vt(Y,J)],le=`${a("tasks.status_suspended")} / ${je}`,rt=k?e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"queue"}),e.jsxs("span",{className:"text-[var(--info)]",children:["#",k.position," / ",k.total]})]}):null,nt=t.taskMode&&t.taskMode!=="develop"?e.jsx("span",{className:"rounded-[4px] px-2 py-0.5 text-[10px] font-bold uppercase",style:t.taskMode==="plan"?{color:"#3b82f6",backgroundColor:"rgba(59,130,246,0.12)"}:{color:"#a855f7",backgroundColor:"rgba(168,85,247,0.12)"},children:t.taskMode}):null,ce=Ye.length>1?e.jsx("div",{className:"flex items-center gap-1 text-xs text-[var(--text-secondary)]",children:Ye.map((s,i)=>e.jsxs(Jt.Fragment,{children:[i>0&&e.jsx("span",{className:"text-[var(--text-muted)]",children:"→"}),e.jsxs(ie,{to:`/tasks/${s.id}`,className:s.id===t.id?"text-[var(--accent)]":"text-[var(--info)] hover:underline",children:[s.taskMode," #",s.id]})]},s.id))}):t.sourceTaskId?e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["source:"," ",e.jsxs(ie,{to:`/tasks/${t.sourceTaskId}`,className:"text-[var(--info)] hover:underline",children:["#",t.sourceTaskId]})]}):null,lt=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:()=>c("/tasks"),className:"shrink-0 text-[var(--text-muted)]",children:e.jsx(os,{className:"h-4 w-4"})}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"truncate text-sm font-medium text-[var(--text-primary)]",title:Qt(t),children:["#",t.id," ",mt(t,80)]}),nt]}),ce&&e.jsx("div",{className:"text-[11px]",children:ce})]})]}),Ne=e.jsxs("div",{className:"hidden md:flex items-center gap-4 border-b border-[var(--border)] bg-[var(--bg-primary)] px-5 shrink-0",style:{height:44},children:[e.jsx(we,{status:t.status,agentType:t.agentType}),nt,g&&e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["// time cost: ",g]}),k&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),e.jsx("span",{className:"text-xs text-[var(--info)]",children:a("tasks.queue_position",{position:String(k.position),total:String(k.total)})})]}),e.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),e.jsxs(ie,{to:`/projects/${t.projectKey}`,className:"text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:["project: ",e.jsx("span",{className:"text-[var(--text-primary)]",children:t.projectKey})]}),t.branch&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["branch: ",K(m,t.branch)?e.jsx("a",{href:K(m,t.branch),target:"_blank",rel:"noopener noreferrer",className:"text-[var(--text-primary)] hover:text-[var(--info)] hover:underline transition-colors",children:t.branch}):e.jsx("span",{className:"text-[var(--text-primary)]",children:t.branch})]})]}),t.mrUrl&&/^https?:\/\//.test(t.mrUrl)&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),e.jsxs("a",{href:t.mrUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-[var(--info)] hover:underline",children:["MR: ",((it=t.mrUrl.match(/!?\d+$/))==null?void 0:it[0])??"view"]})]}),ce&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),ce]})]}),ct=e.jsxs("div",{className:"flex items-center gap-3 border-t border-[var(--border)] bg-[var(--bg-primary)] px-4 md:px-5 shrink-0",style:{height:48},children:[!b&&e.jsxs("button",{onClick:()=>O(!0),className:"flex flex-1 md:flex-none items-center justify-center gap-1.5 rounded-[4px] bg-[var(--destructive)]/10 px-3 h-8 text-[11px] font-medium text-[var(--destructive)]",children:[e.jsx(_e,{className:"h-3 w-3"}),a("tasks.cancel_task")]}),Pt&&e.jsxs("button",{onClick:()=>A(!0),className:"flex flex-1 md:flex-none items-center justify-center gap-1.5 rounded-[4px] bg-[var(--bg-card)] px-3 h-8 text-[11px] text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-input)] transition-colors cursor-pointer",children:[e.jsx(Ct,{className:"h-3 w-3"}),a("tasks.retry_task")]}),ge&&e.jsxs("button",{onClick:at,className:"flex flex-1 md:flex-none items-center justify-center gap-1.5 rounded-[4px] bg-[var(--bg-card)] px-3 h-8 text-[11px] text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-input)] transition-colors cursor-pointer",children:[e.jsx(xs,{className:"h-3 w-3"}),a("tasks.fork_task")]}),Mt&&e.jsxs("button",{onClick:()=>$(!0),className:"flex flex-1 md:flex-none items-center justify-center gap-1.5 rounded-[4px] px-3 h-8 text-[11px] font-medium text-[var(--accent)]",style:{backgroundColor:"rgba(34,197,94,0.12)"},children:[e.jsx(gt,{className:"h-3 w-3"}),a("review.launch")]}),t.workerId&&!b&&e.jsxs("button",{onClick:()=>{ue("pipeline"),setTimeout(()=>{var s,i;(i=(s=Qe.current)==null?void 0:s.scrollIntoView)==null||i.call(s,{behavior:"smooth",block:"center"})},50)},className:"hidden lg:flex items-center justify-center gap-1.5 rounded-[4px] px-3 h-8 text-[11px] font-medium text-[var(--info)]",style:{backgroundColor:"rgba(59,130,246,0.12)"},children:[e.jsx(bt,{className:"h-3 w-3"}),a("tasks.cursor_tunnel")]})]}),Gt=e.jsxs("div",{className:"hidden w-[280px] shrink-0 flex-col gap-6 overflow-y-auto border-l border-[var(--border)] bg-[var(--bg-primary)] p-4 lg:flex",children:[e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:a("tasks.pipeline_stages")}),e.jsx(yt,{stages:j})]}),g&&e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2 text-[11px] text-[var(--text-secondary)]",children:["// time cost: ",g]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:a("tasks.activity_log")}),h.length>0?e.jsx("div",{className:"flex flex-col gap-1.5",children:h.slice(0,8).map((s,i)=>e.jsx("p",{className:"text-[11px] leading-relaxed text-[var(--text-muted)]",children:s},i))}):e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.no_activity")})]})]}),ye=e.jsxs(e.Fragment,{children:[e.jsx(gs,{isOpen:de,onClose:()=>O(!1),onConfirm:Ot,taskId:o,isLoading:Tt}),e.jsx(bs,{isOpen:F,onClose:()=>{A(!1),pe(!1)},onConfirm:Ft,taskId:o,mrUrl:t.mrUrl??void 0,isLoading:Lt,reuseWorkspace:qe,onReuseWorkspaceChange:pe}),e.jsx(Ce,{isOpen:me,onClose:()=>C(!1),onConfirm:Ut,title:a("tasks.fork_task"),message:a("tasks.fork_task_desc"),confirmLabel:a("tasks.fork_task"),confirmVariant:"accent",isLoading:It,children:e.jsxs("div",{className:"mt-3 flex flex-col gap-2",children:[e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["fork of #",o]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.form_agent_type")}),e.jsx(ft,{value:Me,onChange:Oe,options:Bt})]}),e.jsx("textarea",{value:$e,onChange:s=>Pe(s.target.value),placeholder:a("tasks.fork_description_placeholder"),rows:4,className:"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:"flex items-start gap-2 rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] px-3 py-2 text-[11px] text-[var(--text-secondary)]",children:[e.jsx("input",{type:"checkbox",checked:Fe==="replace",onChange:s=>Ue(s.target.checked?"replace":"append"),className:"mt-0.5 h-3.5 w-3.5 rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] accent-[var(--accent)]"}),e.jsxs("span",{children:[a("tasks.fork_replace_description"),e.jsx("span",{className:"mt-1 block text-[10px] text-[var(--text-muted)]",children:a("tasks.fork_append_hint")})]})]})]})}),X&&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:a("review.launch")}),e.jsx("button",{onClick:()=>$(!1),className:"text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:e.jsx(_e,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsxs("p",{className:"text-[11px] text-[var(--text-muted)]",children:["task #",o," — ",a("review.select_agents")]}),ne.length>0&&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:vt(Y).map(s=>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:U.includes(s.value),onChange:()=>v(i=>i.includes(s.value)?i.filter(p=>p!==s.value):[...i,s.value]),className:"h-3.5 w-3.5 accent-[var(--accent)]"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:s.label})]},s.value))}),e.jsx("textarea",{value:I,onChange:s=>E(s.target.value),placeholder:a("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:Ee,onChange:s=>Te(s.target.checked),className:"h-3.5 w-3.5 accent-[var(--accent)]"}),e.jsx("span",{className:"text-[var(--text-muted)]",children:a("review.skip_fix_label")})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:qt,disabled:Le||U.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(gt,{className:"h-3 w-3"}),a(Le?"common.processing":"review.launch")]}),e.jsx("button",{onClick:()=>$(!1),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:a("common.cancel")})]})]})})]});return $t&&N==="terminal"?e.jsxs("div",{className:"fixed inset-0 z-50 flex flex-col bg-[var(--bg-primary)] font-mono lowercase h-screen",style:{height:"100dvh",paddingTop:"env(safe-area-inset-top, 0px)",paddingBottom:"env(safe-area-inset-bottom, 0px)"},children:[Ne,e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 shrink-0",style:{height:36,backgroundColor:"#111111"},children:[e.jsx(kt,{task:t,ptyStatus:He,displayAgentType:J,t:a,gap:"gap-3"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(wt,{isFinished:b,takeoverState:ve,ptyRef:se,t:a}),e.jsx("button",{onClick:()=>Xe(!1),className:"flex items-center rounded-[4px] bg-[var(--bg-card)] px-2.5 py-1 text-[var(--text-muted)]",children:e.jsx(hs,{className:"h-3 w-3"})})]})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(ut,{ref:se,taskId:o,sessionId:t.currentSessionId??void 0,taskFinished:b,onStatusChange:Ve,onTakeoverChange:Je})}),ct,ye]}):t.status===y.SUSPENDED?e.jsxs("div",{className:"flex h-full flex-col font-mono lowercase",children:[lt,Ne,e.jsx("div",{className:"flex items-center gap-2 border-b px-4 md:px-6 py-2 text-xs shrink-0",style:{backgroundColor:"rgba(245,158,11,0.08)",borderColor:"rgba(245,158,11,0.2)",color:"var(--warning)"},children:a("tasks.task_suspended_banner")}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col md:flex-row gap-4 md:gap-6 p-4 md:p-6 overflow-y-auto",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-4",children:[e.jsxs("div",{className:"hidden md:flex items-center gap-3",children:[e.jsxs("span",{className:"text-xl font-bold text-[var(--text-primary)]",children:["#",t.id]}),e.jsx("span",{className:"text-base text-[var(--text-secondary)] truncate max-w-[60%]",children:e.jsx(is,{content:t.description,children:mt(t,200)})}),e.jsx("span",{className:"rounded-[4px] px-2.5 py-1 text-[11px] font-bold text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:le})]}),e.jsx("div",{className:"flex items-center gap-2 md:hidden",children:e.jsx("span",{className:"rounded-[4px] px-2.5 py-1 text-[11px] font-bold text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:le})}),x&&e.jsxs("div",{className:"rounded-[4px] border p-4",style:{borderColor:"rgba(245,158,11,0.27)",backgroundColor:"#1a1a1a"},children:[e.jsx("p",{className:"mb-2 text-[11px] font-bold text-[var(--accent)]",children:a("tasks.pending_confirmation")}),e.jsx("p",{className:"mb-3 text-xs text-[var(--text-secondary)]",children:x.prompt??a("tasks.pipeline_requires_confirmation")}),e.jsx("div",{className:"mb-3 flex flex-col gap-1.5 text-[11px]",children:e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"stage"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:x.stageName})]})}),e.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:flex-wrap md:gap-3",children:[e.jsx("button",{onClick:async()=>{try{await f.post(`web/tasks/${o}/confirm-stage`,{json:{stageName:x.stageName,approved:!0,feedback:""}}),re()}catch{W.error(a("tasks.confirm_failed"))}},className:"flex-1 md:flex-none rounded-[4px] bg-[var(--accent)] px-4 py-2.5 md:py-2 text-[11px] font-bold text-[#0c0c0c]",children:a("tasks.confirm_and_proceed")}),e.jsx("button",{onClick:async()=>{try{await f.post(`web/tasks/${o}/confirm-stage`,{json:{stageName:x.stageName,approved:!1,feedback:""}}),re()}catch{W.error(a("tasks.confirm_failed"))}},className:"flex-1 md:flex-none rounded-[4px] bg-[#1a1a1a] px-4 py-2.5 md:py-2 text-[11px] text-[var(--destructive)]",style:{border:"1px solid rgba(239,68,68,0.27)"},children:a("tasks.reject")})]})]}),e.jsxs("div",{className:"flex flex-col gap-3 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 lg:hidden",children:[e.jsx("span",{className:"text-xs font-bold text-[var(--accent)]",children:a("tasks.task_info")}),e.jsxs("div",{className:"flex flex-col gap-1.5 text-[11px]",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"status"}),e.jsx("span",{className:"font-bold text-[var(--warning)]",children:le})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"project"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.projectKey})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"worker"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.workerName??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"created"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:Q(t.createdAt)})]})]})]}),e.jsx("div",{className:"hidden md:flex flex-wrap items-center gap-2 py-2",children:j.map((s,i)=>{const p=s.status==="failed",u=s.status==="completed",L=s.status==="running"&&t.status===y.SUSPENDED,D=p?"var(--destructive)":u?"var(--accent)":L?"var(--warning)":"#525252",w=p?"rgba(239,68,68,0.12)":u?"rgba(34,197,94,0.12)":L?"rgba(245,158,11,0.12)":"transparent";return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"rounded-[4px] px-2.5 py-1 text-[11px]",style:{color:D,backgroundColor:w,fontWeight:L?700:400,border:L?`1px solid ${D}`:void 0},children:L?"confirm":`${s.name}${u?" ✓":p?" ✗":""}`}),i<j.length-1&&e.jsx("div",{className:"h-px w-6 bg-[var(--border)]"})]},s.name)})}),e.jsxs("div",{className:"hidden md:block min-h-[200px] flex-1 rounded-[4px] border border-[var(--border)] bg-[#0c0c0c] p-4",children:[e.jsx("p",{className:"mb-2 text-[11px] font-bold text-[var(--accent)]",children:a("tasks.pty_output")}),e.jsxs("div",{className:"flex flex-col gap-1",children:[h.slice(-10).map((s,i)=>e.jsx("p",{className:"text-[11px] leading-relaxed text-[var(--text-secondary)]",children:s},i)),h.length===0&&e.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.no_output")})]})]})]}),e.jsxs("div",{className:"hidden w-[280px] shrink-0 flex-col gap-4 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 lg:flex",children:[e.jsx("span",{className:"text-[13px] font-bold text-[var(--accent)]",children:a("tasks.task_info")}),e.jsxs("div",{className:"flex flex-col gap-1.5 text-[11px]",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"status"}),e.jsx("span",{className:"font-bold text-[var(--warning)]",children:le})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"project"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.projectKey})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"worker"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.workerName??"-"})]})]}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsx("span",{className:"text-xs font-bold text-[var(--accent)]",children:a("tasks.stage_timeline")}),e.jsx("div",{className:"flex flex-col gap-2",children:j.map(s=>{const i=s.status==="completed"?"var(--info)":s.status==="failed"?"var(--destructive)":s.status==="running"?"var(--warning)":"#525252",p=s.status==="failed"?"var(--destructive)":s.status==="running"?"var(--warning)":"#a3a3a3",u=s.status==="completed"?"completed":s.status==="running"?"suspended":s.status==="failed"?"failed":"pending";return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"h-2 w-2 shrink-0 rounded-[4px]",style:{backgroundColor:i}}),e.jsxs("span",{className:"text-[11px]",style:{color:p,fontWeight:s.status==="running"?700:400},children:[s.name," ",u]})]},s.name)})}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsx("div",{className:"flex flex-col gap-1.5 text-[11px]",children:e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"created"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:Q(t.createdAt)})]})})]})]}),x&&e.jsx(ht,{isOpen:!!x,onClose:st,taskId:o,stageName:x.stageName,timeoutSeconds:Math.ceil(x.timeout/1e3),confirmType:x.confirmType,prompt:x.prompt,onSubmitted:re}),ye]}):e.jsxs("div",{className:"flex h-full flex-col overflow-hidden font-mono lowercase",children:[lt,e.jsxs("div",{className:"flex flex-wrap items-center gap-3 gap-y-1 border-b border-[var(--border)] bg-[var(--bg-primary)] px-4 py-2 shrink-0 md:hidden",children:[e.jsx(we,{status:t.status,agentType:t.agentType}),g&&e.jsxs("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:["// time cost: ",g]}),e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:t.projectKey}),t.workerName&&e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:t.workerName}),t.branch&&(K(m,t.branch)?e.jsx("a",{href:K(m,t.branch),target:"_blank",rel:"noopener noreferrer",className:"shrink-0 text-[11px] text-[var(--text-muted)] hover:text-[var(--info)] hover:underline truncate max-w-[80px] md:max-w-[120px] transition-colors",children:t.branch}):e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)] truncate max-w-[80px] md:max-w-[120px]",children:t.branch}))]}),Ne,t.errorMessage&&e.jsxs("div",{className:"flex items-center gap-2 border-b px-6 py-2 text-xs shrink-0 bg-[var(--destructive)]/10 text-[var(--destructive)]",style:{borderColor:"rgba(239,68,68,0.2)"},children:["// error: ",t.errorMessage]}),k&&e.jsxs("div",{className:"flex items-center gap-2 border-b px-4 md:px-6 py-2 text-xs shrink-0 text-[var(--info)]",style:{backgroundColor:"color-mix(in srgb, var(--info) 8%, transparent)",borderColor:"color-mix(in srgb, var(--info) 20%, transparent)"},children:[e.jsx(ps,{className:"h-3.5 w-3.5 shrink-0"}),e.jsxs("span",{children:[a("tasks.queue_position_banner",{position:String(k.position),total:String(k.total)}),k.position>1?` — ${a("tasks.queue_ahead",{count:String(k.position-1)})}`:` — ${a("tasks.queue_next")}`]})]}),x&&e.jsx(ht,{isOpen:!!x,onClose:st,taskId:o,stageName:x.stageName,timeoutSeconds:Math.ceil(x.timeout/1e3),confirmType:x.confirmType,prompt:x.prompt,onSubmitted:re}),e.jsxs("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[e.jsx("div",{className:"flex items-center border-b border-[var(--border)] shrink-0 overflow-x-auto no-scrollbar",children:["terminal","pipeline","logs","detail"].map(s=>e.jsx("button",{onClick:()=>ue(s),className:`shrink-0 whitespace-nowrap px-4 py-2.5 text-xs transition-colors ${N===s?"border-b-2 border-[var(--accent)] text-[var(--accent)] font-medium":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:a(s==="terminal"?"tasks.terminal":s==="pipeline"?"tasks.pipeline_tab":s==="logs"?"tasks.logs":"tasks.detail_tab")},s))}),N==="terminal"&&e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-3 md:px-5 shrink-0",style:{height:36,backgroundColor:"#111111"},children:[e.jsx(kt,{task:t,ptyStatus:He,displayAgentType:J,t:a}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(wt,{isFinished:b,takeoverState:ve,ptyRef:se,t:a}),!b&&ve==="requesting"&&e.jsxs("span",{className:"flex items-center gap-1.5 px-2.5 h-10 md:h-8 text-[11px] text-[var(--warning)]",children:[e.jsx(Et,{className:"h-3 w-3 animate-spin"}),a("tasks.requesting_takeover")]}),!b&&t.currentStage&&e.jsxs("button",{className:"hidden md:flex items-center gap-1.5 rounded-[4px] bg-[var(--bg-card)] px-2.5 h-10 md:h-8 text-[11px] text-[var(--text-muted)]",children:[e.jsx(ds,{className:"h-3 w-3"}),a("tasks.skip_stage")]}),e.jsx("button",{onClick:()=>Xe(!0),className:"hidden md:flex items-center rounded-[4px] bg-[var(--bg-card)] px-2.5 h-10 md:h-8 text-[var(--text-muted)]",children:e.jsx(us,{className:"h-3 w-3"})})]})]}),e.jsxs("div",{className:"border-b border-[var(--border)] px-4 py-2 shrink-0 md:hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[t.currentStage&&e.jsxs("span",{className:"text-[11px] font-semibold text-[var(--accent)]",children:[a("tasks.stage"),": ",t.currentStage]}),e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["agent: ",J]}),t.workerName&&e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["worker: ",t.workerName]})]}),e.jsx("div",{className:"overflow-x-auto no-scrollbar pr-4",style:{borderRadius:0},children:e.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",children:[e.jsx("span",{className:"shrink-0 text-[11px] font-bold text-[var(--accent)]",children:a("tasks.stage_progress")}),j.map((s,i)=>{const p=s.status==="completed",u=s.status==="running",D=s.status==="failed"?"var(--destructive)":p||u?"var(--accent)":"#525252";return e.jsxs("div",{className:"flex items-center",children:[e.jsxs("span",{className:"shrink-0 text-[11px] leading-normal whitespace-nowrap",style:{color:D,fontWeight:u?600:400},children:[s.name,p?" ✓":u?" ...":""]}),i<j.length-1&&e.jsx("div",{className:"mx-1.5 h-px w-4 shrink-0",style:{backgroundColor:D}})]},s.name)})]})})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(ut,{ref:se,taskId:o,sessionId:t.currentSessionId??void 0,taskFinished:b,onStatusChange:Ve,onTakeoverChange:Je})}),ct]}),N==="pipeline"&&e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto p-4 md:p-6 lg:p-8",children:[e.jsx("div",{className:"mb-4 md:mb-5 overflow-x-auto no-scrollbar",style:{borderRadius:0},children:e.jsx("div",{className:"flex items-center py-5",children:j.map((s,i)=>{const p=s.status==="completed",u=s.status==="running",w=s.status==="failed"?"var(--destructive)":p||u?"var(--accent)":"#525252";return e.jsxs("div",{className:"flex items-center",style:{flex:i<j.length-1?1:void 0},children:[e.jsxs("div",{className:"flex flex-col items-center gap-1.5",children:[e.jsxs("div",{className:"flex h-6 w-6 md:h-7 md:w-7 items-center justify-center rounded-full shrink-0",style:{backgroundColor:w},children:[p&&e.jsx("span",{className:"text-[11px] md:text-xs font-semibold text-[#0c0c0c]",children:"✓"}),u&&e.jsx("span",{className:"h-2 w-2 md:h-2.5 md:w-2.5 rounded-full bg-[#0c0c0c]"})]}),e.jsx("span",{className:"text-[11px] leading-normal font-medium whitespace-nowrap",style:{color:w},children:s.name})]}),i<j.length-1&&e.jsx("div",{className:"mx-1 md:mx-2 h-0.5 flex-1 min-w-3 rounded-full",style:{backgroundColor:i<(be>=0?be:0)?"var(--accent)":"#525252"}})]},s.name)})})}),t.currentStage&&e.jsxs("div",{className:"mb-4 md:mb-5 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 text-xs leading-relaxed",children:[e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// stage: ",t.currentStage," (",be+1,"/",j.length,")"]}),t.startedAt&&e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// elapsed: ",Q(t.startedAt).replace(" ago","")]}),g&&e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// time cost: ",g]}),e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// retries: ",t.retryCount,"/2"]})]}),!t.currentStage&&g&&e.jsx("div",{className:"mb-4 md:mb-5 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 text-xs leading-relaxed",children:e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// time cost: ",g]})}),e.jsx("button",{onClick:()=>ue("terminal"),className:"flex-1 min-h-[100px] rounded-[4px] border border-dashed border-[var(--border)] flex items-center justify-center gap-2 text-[11px] text-[var(--text-muted)] hover:border-[var(--accent)] hover:text-[var(--accent)] transition-colors",children:e.jsxs("span",{children:["// ",a("tasks.view_terminal")]})}),e.jsxs("div",{className:"mt-4 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 lg:hidden",children:[e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:a("tasks.task_info")}),e.jsxs("div",{className:"mt-2 flex flex-col gap-1.5 text-[11px]",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"project"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.projectKey})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"worker"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.workerName??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"branch"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.branch??"-"})]}),rt]})]}),e.jsxs("div",{className:"flex flex-col gap-6 mt-4 lg:hidden",children:[e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:a("tasks.pipeline_stages")}),e.jsx(yt,{stages:j,runningBg:"bg-[var(--bg-input)]",py:"py-2"})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:a("tasks.activity_log")}),h.length>0?e.jsx("div",{className:"flex flex-col gap-1.5",children:h.slice(-12).map((s,i)=>e.jsx("p",{className:"text-[11px] leading-relaxed text-[var(--text-muted)]",children:s},i))}):e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.no_activity")})]})]})]}),N==="logs"&&e.jsxs("div",{className:"flex flex-1 flex-col gap-3 md:gap-5 overflow-y-auto p-4 md:p-6 lg:p-8",children:[e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)] md:hidden",children:a("tasks.task_logs")}),e.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-center md:gap-3",children:[e.jsx("div",{className:"flex items-center gap-1 overflow-x-auto no-scrollbar md:hidden",children:["","error","system"].map(s=>e.jsx("button",{onClick:()=>{We(s),q(0)},className:`shrink-0 rounded-[4px] px-2.5 py-1 text-[11px] ${V===s?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)]"}`,children:s||"all"},s))}),e.jsx("div",{className:"hidden md:block",children:e.jsx(ft,{value:V,onChange:s=>{We(s),q(0)},options:[{value:"",label:"all"},{value:"stage_change",label:"stage_change"},{value:"info",label:"info"},{value:"warning",label:"warning"},{value:"error",label:"error"},{value:"system",label:"system"}],className:"w-36"})}),e.jsxs("div",{className:"flex flex-1 items-center gap-2 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2",children:[e.jsx(Yt,{className:"h-3.5 w-3.5 text-[var(--text-muted)]"}),e.jsx("input",{type:"text",placeholder:a("tasks.search_logs"),value:te,onChange:s=>{Rt(s.target.value),q(0)},className:"flex-1 bg-transparent text-xs text-[var(--text-primary)] outline-none placeholder:text-[var(--text-muted)]"})]})]}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[Ge.map((s,i)=>e.jsxs("div",{className:`flex items-start md:items-center gap-2 md:gap-4 rounded-[4px] px-2 md:px-3 py-2 text-[11px] md:text-xs ${i%2===0?"bg-[var(--bg-card)]":""}`,children:[e.jsx("span",{className:"shrink-0 text-[var(--text-muted)]",children:new Date(s.timestamp).toLocaleTimeString("en-US",{hour12:!1})}),e.jsx("span",{className:`shrink-0 font-medium ${ws(s.type)}`,children:s.type}),e.jsx("span",{className:"min-w-0 break-words md:truncate text-[var(--text-primary)]",children:s.message})]},s.id)),Ge.length===0&&!At&&e.jsx("p",{className:"py-8 text-center text-xs text-[var(--text-muted)]",children:a("tasks.no_log_entries")})]}),ee>50&&e.jsxs("div",{className:"flex items-center justify-center gap-1",children:[Array.from({length:Math.ceil(ee/50)}).slice(0,5).map((s,i)=>e.jsx("button",{onClick:()=>q(i),className:`rounded-[4px] px-2 py-1 text-xs ${H===i?"bg-[var(--accent)] text-black font-medium":"text-[var(--text-muted)] hover:text-[var(--text-primary)]"}`,children:i+1},i)),Math.ceil(ee/50)>5&&e.jsx("button",{onClick:()=>q(H+1),disabled:H>=Math.ceil(ee/50)-1,className:"rounded-[4px] px-2 py-1 text-xs text-[var(--text-muted)] disabled:opacity-30",children:">"})]})]}),N==="detail"&&e.jsxs("div",{className:"flex flex-1 flex-col gap-4 md:gap-5 overflow-y-auto p-4 md:p-6 lg:p-8",children:[e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 md:p-5",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx(Zt,{className:"h-3.5 w-3.5 text-[var(--accent)]"}),e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:a("tasks.detail_basic_info")})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3",children:[e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.detail_creator")}),e.jsx("span",{className:"text-xs text-[var(--text-primary)]",children:t.creatorName??"-"})]}),e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("common.created_at")}),e.jsx("span",{className:"text-xs text-[var(--text-primary)]",children:ls(t.createdAt)}),e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:Q(t.createdAt)})]}),e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("common.status")}),e.jsx(we,{status:t.status,agentType:t.agentType})]}),e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.detail_project")}),e.jsx(ie,{to:`/projects/${t.projectKey}`,className:"text-xs text-[var(--info)] hover:underline transition-colors",children:t.projectKey})]}),e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.detail_worker")}),e.jsx("span",{className:"text-xs text-[var(--text-primary)]",children:t.workerName??"-"})]}),e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.form_agent_type")}),e.jsx("span",{className:"text-xs text-[var(--text-primary)]",children:je})]}),g&&e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.detail_time_cost")}),e.jsx("span",{className:"text-xs text-[var(--text-primary)]",children:g})]}),t.branch&&e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.detail_branch")}),K(m,t.branch)?e.jsx("a",{href:K(m,t.branch),target:"_blank",rel:"noopener noreferrer",className:"text-xs text-[var(--info)] hover:underline transition-colors truncate",children:t.branch}):e.jsx("span",{className:"text-xs text-[var(--text-primary)] truncate",children:t.branch})]}),t.mrUrl&&/^https?:\/\//.test(t.mrUrl)&&e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.mr_link")}),e.jsx("a",{href:t.mrUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-[var(--info)] hover:underline truncate",children:((ot=t.mrUrl.match(/!?\d+$/))==null?void 0:ot[0])??"view"})]})]})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 md:p-5",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx(pt,{className:"h-3.5 w-3.5 text-[var(--accent)]"}),e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:a("tasks.detail_task_name")})]}),e.jsxs("div",{className:"flex flex-col gap-3",children:[t.name&&e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.detail_ai_name")}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:t.name})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.detail_task_id")}),e.jsxs("span",{className:"text-xs text-[var(--text-secondary)]",children:["#",t.id]})]}),t.sourcePlatform&&e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.detail_source")}),e.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:t.sourcePlatform})]})]})]}),t.taskMode==="plan"&&t.status===y.COMPLETED&&(()=>{let s="main";if(t.configSnapshot)try{const p=JSON.parse(t.configSnapshot);p.defaultBranch&&(s=p.defaultBranch)}catch{}const i=Ss(m,s);return i?e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 md:p-5",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx(pt,{className:"h-3.5 w-3.5 text-[var(--accent)]"}),e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:a("plan.view_spec")})]}),e.jsxs("p",{className:"mb-2 text-xs text-[var(--text-muted)]",children:["the spec document was pushed to ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:s})," at ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:"docs/specs/"})]}),e.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--info)] hover:underline transition-colors",children:[e.jsx(bt,{className:"h-3 w-3"}),a("plan.view_spec")]})]}):null})(),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 md:p-5",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx(es,{className:"h-3.5 w-3.5 text-[var(--accent)]"}),e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:a("tasks.detail_description")})]}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[#0c0c0c] p-4 overflow-x-auto",children:e.jsx("pre",{className:"whitespace-pre-wrap break-words text-xs leading-relaxed text-[var(--text-secondary)] font-mono",children:t.description})})]})]})]}),N==="terminal"&&Gt,N==="pipeline"&&e.jsxs("div",{className:"hidden w-[420px] shrink-0 flex-col gap-5 overflow-y-auto border-l border-[var(--border)] bg-[var(--bg-primary)] p-5 lg:flex",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[13px] font-semibold text-[var(--accent)]",children:a("tasks.task_info")}),e.jsxs("div",{className:"flex flex-col gap-1.5 text-xs",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"project"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.projectKey})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"creator"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.creatorName??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"worker"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.workerName??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:a("common.created_at")}),e.jsx("span",{className:"text-[var(--text-primary)]",children:Q(t.createdAt)})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:a("tasks.form_agent_type")}),e.jsx("span",{className:"text-[var(--text-primary)]",children:je})]}),g&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"time cost"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:g})]}),rt]})]}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[13px] font-semibold text-[var(--accent)]",children:a("tasks.workspace_section")}),e.jsxs("div",{className:"flex flex-col gap-1.5 text-xs",children:[e.jsxs("div",{className:"flex min-w-0 justify-between",children:[e.jsx("span",{className:"shrink-0 text-[var(--text-muted)]",children:"branch"}),e.jsx("span",{className:"ml-4 min-w-0 truncate text-[var(--text-primary)]",children:t.branch??(B==null?void 0:B.branch)??"-"})]}),e.jsxs("div",{className:"flex min-w-0 justify-between",children:[e.jsx("span",{className:"shrink-0 text-[var(--text-muted)]",children:"worktree"}),e.jsx("span",{className:"ml-4 min-w-0 truncate text-[var(--text-primary)]",children:(B==null?void 0:B.path)??"-"})]}),t.mrUrl&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:a("tasks.mr_link")}),e.jsx("a",{href:t.mrUrl,target:"_blank",rel:"noopener noreferrer",className:"font-medium text-[var(--info)] hover:underline",children:((xt=t.mrUrl.match(/!?\d+$/))==null?void 0:xt[0])??"view"})]})]})]}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsxs("div",{ref:Qe,className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[13px] font-semibold text-[var(--accent)]",children:a("tasks.cursor_tunnel_section")}),t.workerId?e.jsx(vs,{taskId:o,taskFinished:b,compact:!0}):e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.no_worker_assigned")})]}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[13px] font-semibold text-[var(--accent)]",children:a("tasks.stage_timeline")}),e.jsx("div",{className:"flex flex-col gap-2 text-xs",children:j.map(s=>{const i=s.status==="completed"?"✓":s.status==="running"?"→":"·",p=s.status==="running"?"var(--accent)":s.status==="completed"?"var(--info)":s.status==="failed"?"var(--destructive)":"#525252",u=s.status==="completed"?"done":s.status==="running"?"running...":s.status==="failed"?"failed":"pending";return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-semibold",style:{color:p},children:i}),e.jsx("span",{className:s.status==="running"?"font-medium":"",style:{color:p},children:s.name}),e.jsxs("span",{className:"text-[11px]",style:{color:"#525252"},children:["— ",u]})]},s.name)})})]})]})]}),ye]})}export{Ws as default};
@@ -1,4 +1,4 @@
1
- import{j as e}from"./index-D3EF0BU0.js";import{a as s}from"./DocsPrimitives-m1oUERel.js";import"./copy-B-4Hfvcn.js";const a=`ov task create -d "implement oauth login" -p WEB -t feat
1
+ import{j as e}from"./index-PZwTchr_.js";import{a as s}from"./DocsPrimitives-DCBNKtsW.js";import"./copy-Dtpgo9EK.js";const a=`ov task create -d "implement oauth login" -p WEB -t feat
2
2
  ov task plan -d "design auth system" -p WEB
3
3
  ov task review 42 --agent codex,cursor
4
4
  ov task fork 42 -d "retry with a simpler approach"`,r=`develop "implement oauth login" --project WEB --type feat
@@ -1 +1 @@
1
- import{R as me,f as J,a as $,o as u,j as e,l as ee,u as ue,i as ve,v as te,r as a,h as P,X as he,k as be,w as fe,H as ge,t as W,x as ye,y as V,m as je}from"./index-D3EF0BU0.js";import{u as X}from"./task.store-B1f8yuTU.js";import{T as se}from"./TaskStatusBadge-BD3WJQkl.js";import{f as re}from"./date-RFA7-ZGs.js";import{T as ke}from"./Tooltip-DfB8CAIs.js";import{G as ae}from"./git-fork-BhXdgj_k.js";import{S as D}from"./Select-ucU6_0EP.js";import{a as Ne}from"./task-constants-v3cKX5sS.js";import{g as Ce}from"./agent-type-options-Vn2Ar3HP.js";import{C as we}from"./copy-B-4Hfvcn.js";import{E as Y}from"./EmptyState-tRn0r3m4.js";import{T as Z}from"./Skeleton-BAYr4eiz.js";import{P as Se}from"./plus-BwhhTyaX.js";import{C as _e}from"./chevron-left-D9iQafYD.js";import{C as Te}from"./chevron-right-Ccp2bQ3u.js";import"./status-colors-BNBcbZVQ.js";import"./chevron-down-54sz-rQX.js";const Ee=me.memo(function({task:s}){const d=J(),{t:c}=$(),x=(r,h)=>c(`common.${r}`,{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(ke,{content:s.description,children:ee(s)})}),e.jsx("td",{className:"py-3 pr-4",children:e.jsx(se,{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:[re(s.createdAt,x),i&&e.jsx("button",{onClick:r=>{r.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(ae,{className:"h-3 w-3"})})]})})]})});function Fe({isOpen:o,onClose:s,projects:d,projectsLoading:c,onSubmit:x,isSubmitting:i}){const{t:r}=$();ue(n=>n.user);const h=ve();te(o);const[p,L]=a.useState(""),[v,B]=a.useState(""),[m,A]=a.useState("feat"),[N,w]=a.useState(""),[b,S]=a.useState(""),[g,_]=a.useState(""),[y,j]=a.useState(""),[T,K]=a.useState(""),[M,R]=a.useState([]),[O,C]=a.useState(""),k=d.find(n=>n.key===p),H=Ce(n=>n,k==null?void 0:k.agentType);a.useEffect(()=>{if(!o||(L(""),B(""),A("feat"),w(""),S(""),_(""),j(""),K(""),C(""),!h))return;const n=new AbortController;return P.get("admin/developers",{signal:n.signal}).json().then(R).catch(()=>{}),()=>n.abort()},[o,h]);async function E(n){if(n.preventDefault(),C(""),!p||!v.trim()){C(r("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(z){const I=z instanceof Error?z.message:r("tasks.failed_to_create_task");C(I)}}return o?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))"},children:e.jsxs("div",{className:"w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",onClick:n=>n.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-6 py-4",children:[e.jsxs("h2",{className:"text-sm text-[var(--text-primary)]",children:["// ",r("tasks.new_task")]}),e.jsx("button",{onClick:s,className:"text-[var(--text-muted)] transition-colors hover:text-[var(--text-primary)]",children:e.jsx(he,{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:r("tasks.project")}),e.jsx(D,{value:p,onChange:L,options:d.map(n=>({value:n.key,label:n.name})),placeholder:r(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:r("tasks.task_type")}),e.jsx(D,{value:m,onChange:A,options:Ne})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.form_agent_type")}),e.jsx(D,{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:r("tasks.task_description")}),e.jsx("textarea",{value:v,onChange:n=>B(n.target.value),placeholder:r("tasks.describe_task_placeholder"),rows:4,className:"w-full resize-none rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.target_worker")}),e.jsx("input",{type:"text",value:y,onChange:n=>j(n.target.value),placeholder:r("tasks.any_able"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.branch_slug")}),e.jsx("input",{type:"text",value:b,onChange:n=>S(n.target.value),placeholder:r("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:r("tasks.target_branch")}),e.jsx("input",{type:"text",value:g,onChange:n=>_(n.target.value),placeholder:r("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:r("tasks.assign_developer")}),e.jsx(D,{value:T,onChange:K,options:M.map(n=>({value:String(n.id),label:n.name})),placeholder:r("tasks.select_developer")})]}),O&&e.jsx("div",{className:"rounded-[4px] bg-[#2a1515] border border-[var(--destructive)]/30 px-3 py-2 text-xs text-[var(--destructive)]",children:O})]}),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:r("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:r(i?"common.creating":"tasks.create_task")})]})]})]})}):null}function Pe({isOpen:o,onClose:s,onForceCreate:d,onViewExisting:c,similarTask:x,isLoading:i}){const{t:r}=$();return te(o),!x||!o?null: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))"},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(we,{style:{width:"1rem",height:"1rem"}}),r("tasks.dedup_title")]}),e.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.7rem",marginTop:"0.25rem"},children:r("tasks.dedup_description")})]}),e.jsxs("div",{style:{marginBottom:"1.25rem",padding:"0.75rem",border:"1px solid var(--border)",borderRadius:"4px",backgroundColor:"var(--bg-primary)"},children:[e.jsxs("div",{style:{color:"var(--text-muted)",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace"},children:["#",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:r("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:r("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:r(i?"common.creating":"tasks.dedup_create_anyway")})]})]})})}function De({task:o}){const s=J(),d=o.status===u.COMPLETED||o.status===u.FAILED||o.status===u.CANCELLED;return e.jsxs("div",{onClick:()=>s(`/tasks/${o.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:je(o),children:["#",o.id," ",ee(o)]}),e.jsxs("span",{className:"flex items-center gap-1.5 shrink-0",children:[d&&e.jsx("button",{onClick:c=>{c.stopPropagation(),s(`/tasks/${o.id}?action=fork`)},className:"rounded-[4px] p-1 text-[var(--text-muted)] hover:text-[var(--accent)] transition-colors",children:e.jsx(ae,{className:"h-3 w-3"})}),e.jsx(se,{status:o.status})]})]}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-2 text-[11px] text-[var(--text-muted)]",children:[e.jsx("span",{children:re(o.createdAt)}),e.jsx("span",{children:"·"}),e.jsx("span",{children:o.projectKey}),o.workerName&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("span",{children:o.workerName})]})]})]})}const Ae=[{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"}],Ie=20;function Ye(){const o=J(),{t:s}=$(),{tasks:d,loading:c,fetchTasks:x}=X(),i=be(t=>t.taskSeq),[r,h]=a.useState("all"),[p,L]=a.useState(""),[v,B]=a.useState(""),[m,A]=a.useState(""),[N,w]=a.useState(void 0),[b,S]=a.useState([]),g=X(t=>t.nextCursor),[_,y]=a.useState(!1);fe(a.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(Se,{className:"h-3.5 w-3.5"}),s("tasks.new_task")]}),[s]));const[j,T]=a.useState([]),[K,M]=a.useState(!1),[R,O]=a.useState([]),[C,k]=a.useState(!1),[H,E]=a.useState(!1),[n,z]=a.useState(null),[I,q]=a.useState(null),G=a.useCallback(t=>{const l={limit:String(Ie),taskMode:"develop"};return r!=="all"&&(l.status=r),p&&(l.projectKey=p),v&&(l.developerId=v),t&&(l.cursor=t),l},[r,p,v]);a.useEffect(()=>{x(G(N))},[G,N,x,i]),a.useEffect(()=>{w(void 0),S([])},[r,p,v]),a.useEffect(()=>{let t=!1;return(async()=>{try{const[f,pe]=await Promise.all([P.get("web/projects").json(),P.get("web/projects/-/developers").json()]);if(t)return;T(f),O(pe)}catch{}})(),()=>{t=!0}},[]),a.useEffect(()=>{if(!_||j.length>0)return;M(!0);let t=!1;return(async()=>{try{const f=await P.get("web/projects").json();t||T(f)}catch{}finally{t||M(!1)}})(),()=>{t=!0}},[_,j.length]);const oe=a.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),o(`/tasks/${l.task.id}`)}catch(l){if(l instanceof ge&&l.response.status===409){try{const f=await l.response.json();if(f.confirmRequired){z({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)}},[o]),ne=a.useCallback(async()=>{if(I){k(!0);try{const t=await P.post("web/tasks",{json:{...I,force:!0}}).json();E(!1),q(null),o(`/tasks/${t.task.id}`)}finally{k(!1)}}},[I,o]),F=a.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]),le=a.useCallback(()=>{g&&(S(t=>[...t,N??""]),w(g))},[g,N]),ce=a.useCallback(()=>{b.length!==0&&(w(b.at(-1)||void 0),S(t=>t.slice(0,-1)))},[b]),ie=b.length+1,de=a.useMemo(()=>[{value:"",label:s("tasks.filter_project")},...j.map(t=>({value:t.key,label:t.name}))],[j,s]),xe=a.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:Ae.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 ${r===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(ye,{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=>A(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:()=>A(""),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(D,{value:p,onChange:L,options:de,className:"md:w-40"}),e.jsx(D,{value:v,onChange:B,options:xe,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&&F.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"p-4",children:e.jsx(Z,{rows:5})})}),!c&&F.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})})}),F.map(t=>e.jsx(Ee,{task:t},t.id))]})]})}),e.jsxs("div",{className:"flex flex-col gap-2 md:hidden",children:[c&&F.length===0&&e.jsx("div",{className:"p-4",children:e.jsx(Z,{rows:5})}),!c&&F.length===0&&e.jsx(Y,{icon:V,title:s("tasks.no_tasks_found"),description:Q,action:U}),F.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 ",ie]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:ce,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(_e,{className:"h-3.5 w-3.5"}),s("tasks.prev")]}),e.jsxs("button",{onClick:le,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(Te,{className:"h-3.5 w-3.5"})]})]})]}),e.jsx(Fe,{isOpen:_,onClose:()=>y(!1),projects:j,projectsLoading:K,onSubmit:oe,isSubmitting:C}),e.jsx(Pe,{isOpen:H,onClose:()=>{E(!1),q(null)},onForceCreate:ne,onViewExisting:t=>{E(!1),q(null),o(`/tasks/${t}`)},similarTask:n,isLoading:C})]})}export{Ye as default};
1
+ import{R as me,f as J,a as $,o as u,j as e,l as ee,u as ue,i as ve,v as te,r as a,h as P,X as he,k as be,w as fe,H as ge,t as W,x as ye,y as V,m as je}from"./index-PZwTchr_.js";import{u as X}from"./task.store-BTXbcXgO.js";import{T as se}from"./TaskStatusBadge-Dzloj2eJ.js";import{f as re}from"./date-RFA7-ZGs.js";import{T as ke}from"./Tooltip-DzkVglKi.js";import{G as ae}from"./git-fork-A1WGp9ha.js";import{S as D}from"./Select-CaAVBHmI.js";import{a as Ne}from"./task-constants-CSVY_jfk.js";import{g as Ce}from"./agent-type-options-BiwwFXJv.js";import{C as we}from"./copy-Dtpgo9EK.js";import{E as Y}from"./EmptyState-BfgwLg0u.js";import{T as Z}from"./Skeleton-CNV0Dyd8.js";import{P as Se}from"./plus-CCF-PMRF.js";import{C as _e}from"./chevron-left-D5fJVFiB.js";import{C as Te}from"./chevron-right-Bz-j2WmS.js";import"./status-colors-DDycfcf7.js";import"./chevron-down-DyqUpmgf.js";const Ee=me.memo(function({task:s}){const d=J(),{t:c}=$(),x=(r,h)=>c(`common.${r}`,{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(ke,{content:s.description,children:ee(s)})}),e.jsx("td",{className:"py-3 pr-4",children:e.jsx(se,{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:[re(s.createdAt,x),i&&e.jsx("button",{onClick:r=>{r.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(ae,{className:"h-3 w-3"})})]})})]})});function Fe({isOpen:o,onClose:s,projects:d,projectsLoading:c,onSubmit:x,isSubmitting:i}){const{t:r}=$();ue(n=>n.user);const h=ve();te(o);const[p,L]=a.useState(""),[v,B]=a.useState(""),[m,A]=a.useState("feat"),[N,w]=a.useState(""),[b,S]=a.useState(""),[g,_]=a.useState(""),[y,j]=a.useState(""),[T,K]=a.useState(""),[M,R]=a.useState([]),[O,C]=a.useState(""),k=d.find(n=>n.key===p),H=Ce(n=>n,k==null?void 0:k.agentType);a.useEffect(()=>{if(!o||(L(""),B(""),A("feat"),w(""),S(""),_(""),j(""),K(""),C(""),!h))return;const n=new AbortController;return P.get("admin/developers",{signal:n.signal}).json().then(R).catch(()=>{}),()=>n.abort()},[o,h]);async function E(n){if(n.preventDefault(),C(""),!p||!v.trim()){C(r("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(z){const I=z instanceof Error?z.message:r("tasks.failed_to_create_task");C(I)}}return o?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))"},children:e.jsxs("div",{className:"w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",onClick:n=>n.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-6 py-4",children:[e.jsxs("h2",{className:"text-sm text-[var(--text-primary)]",children:["// ",r("tasks.new_task")]}),e.jsx("button",{onClick:s,className:"text-[var(--text-muted)] transition-colors hover:text-[var(--text-primary)]",children:e.jsx(he,{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:r("tasks.project")}),e.jsx(D,{value:p,onChange:L,options:d.map(n=>({value:n.key,label:n.name})),placeholder:r(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:r("tasks.task_type")}),e.jsx(D,{value:m,onChange:A,options:Ne})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.form_agent_type")}),e.jsx(D,{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:r("tasks.task_description")}),e.jsx("textarea",{value:v,onChange:n=>B(n.target.value),placeholder:r("tasks.describe_task_placeholder"),rows:4,className:"w-full resize-none rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.target_worker")}),e.jsx("input",{type:"text",value:y,onChange:n=>j(n.target.value),placeholder:r("tasks.any_able"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.branch_slug")}),e.jsx("input",{type:"text",value:b,onChange:n=>S(n.target.value),placeholder:r("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:r("tasks.target_branch")}),e.jsx("input",{type:"text",value:g,onChange:n=>_(n.target.value),placeholder:r("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:r("tasks.assign_developer")}),e.jsx(D,{value:T,onChange:K,options:M.map(n=>({value:String(n.id),label:n.name})),placeholder:r("tasks.select_developer")})]}),O&&e.jsx("div",{className:"rounded-[4px] bg-[#2a1515] border border-[var(--destructive)]/30 px-3 py-2 text-xs text-[var(--destructive)]",children:O})]}),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:r("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:r(i?"common.creating":"tasks.create_task")})]})]})]})}):null}function Pe({isOpen:o,onClose:s,onForceCreate:d,onViewExisting:c,similarTask:x,isLoading:i}){const{t:r}=$();return te(o),!x||!o?null: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))"},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(we,{style:{width:"1rem",height:"1rem"}}),r("tasks.dedup_title")]}),e.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.7rem",marginTop:"0.25rem"},children:r("tasks.dedup_description")})]}),e.jsxs("div",{style:{marginBottom:"1.25rem",padding:"0.75rem",border:"1px solid var(--border)",borderRadius:"4px",backgroundColor:"var(--bg-primary)"},children:[e.jsxs("div",{style:{color:"var(--text-muted)",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace"},children:["#",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:r("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:r("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:r(i?"common.creating":"tasks.dedup_create_anyway")})]})]})})}function De({task:o}){const s=J(),d=o.status===u.COMPLETED||o.status===u.FAILED||o.status===u.CANCELLED;return e.jsxs("div",{onClick:()=>s(`/tasks/${o.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:je(o),children:["#",o.id," ",ee(o)]}),e.jsxs("span",{className:"flex items-center gap-1.5 shrink-0",children:[d&&e.jsx("button",{onClick:c=>{c.stopPropagation(),s(`/tasks/${o.id}?action=fork`)},className:"rounded-[4px] p-1 text-[var(--text-muted)] hover:text-[var(--accent)] transition-colors",children:e.jsx(ae,{className:"h-3 w-3"})}),e.jsx(se,{status:o.status})]})]}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-2 text-[11px] text-[var(--text-muted)]",children:[e.jsx("span",{children:re(o.createdAt)}),e.jsx("span",{children:"·"}),e.jsx("span",{children:o.projectKey}),o.workerName&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("span",{children:o.workerName})]})]})]})}const Ae=[{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"}],Ie=20;function Ye(){const o=J(),{t:s}=$(),{tasks:d,loading:c,fetchTasks:x}=X(),i=be(t=>t.taskSeq),[r,h]=a.useState("all"),[p,L]=a.useState(""),[v,B]=a.useState(""),[m,A]=a.useState(""),[N,w]=a.useState(void 0),[b,S]=a.useState([]),g=X(t=>t.nextCursor),[_,y]=a.useState(!1);fe(a.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(Se,{className:"h-3.5 w-3.5"}),s("tasks.new_task")]}),[s]));const[j,T]=a.useState([]),[K,M]=a.useState(!1),[R,O]=a.useState([]),[C,k]=a.useState(!1),[H,E]=a.useState(!1),[n,z]=a.useState(null),[I,q]=a.useState(null),G=a.useCallback(t=>{const l={limit:String(Ie),taskMode:"develop"};return r!=="all"&&(l.status=r),p&&(l.projectKey=p),v&&(l.developerId=v),t&&(l.cursor=t),l},[r,p,v]);a.useEffect(()=>{x(G(N))},[G,N,x,i]),a.useEffect(()=>{w(void 0),S([])},[r,p,v]),a.useEffect(()=>{let t=!1;return(async()=>{try{const[f,pe]=await Promise.all([P.get("web/projects").json(),P.get("web/projects/-/developers").json()]);if(t)return;T(f),O(pe)}catch{}})(),()=>{t=!0}},[]),a.useEffect(()=>{if(!_||j.length>0)return;M(!0);let t=!1;return(async()=>{try{const f=await P.get("web/projects").json();t||T(f)}catch{}finally{t||M(!1)}})(),()=>{t=!0}},[_,j.length]);const oe=a.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),o(`/tasks/${l.task.id}`)}catch(l){if(l instanceof ge&&l.response.status===409){try{const f=await l.response.json();if(f.confirmRequired){z({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)}},[o]),ne=a.useCallback(async()=>{if(I){k(!0);try{const t=await P.post("web/tasks",{json:{...I,force:!0}}).json();E(!1),q(null),o(`/tasks/${t.task.id}`)}finally{k(!1)}}},[I,o]),F=a.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]),le=a.useCallback(()=>{g&&(S(t=>[...t,N??""]),w(g))},[g,N]),ce=a.useCallback(()=>{b.length!==0&&(w(b.at(-1)||void 0),S(t=>t.slice(0,-1)))},[b]),ie=b.length+1,de=a.useMemo(()=>[{value:"",label:s("tasks.filter_project")},...j.map(t=>({value:t.key,label:t.name}))],[j,s]),xe=a.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:Ae.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 ${r===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(ye,{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=>A(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:()=>A(""),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(D,{value:p,onChange:L,options:de,className:"md:w-40"}),e.jsx(D,{value:v,onChange:B,options:xe,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&&F.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"p-4",children:e.jsx(Z,{rows:5})})}),!c&&F.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})})}),F.map(t=>e.jsx(Ee,{task:t},t.id))]})]})}),e.jsxs("div",{className:"flex flex-col gap-2 md:hidden",children:[c&&F.length===0&&e.jsx("div",{className:"p-4",children:e.jsx(Z,{rows:5})}),!c&&F.length===0&&e.jsx(Y,{icon:V,title:s("tasks.no_tasks_found"),description:Q,action:U}),F.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 ",ie]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:ce,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(_e,{className:"h-3.5 w-3.5"}),s("tasks.prev")]}),e.jsxs("button",{onClick:le,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(Te,{className:"h-3.5 w-3.5"})]})]})]}),e.jsx(Fe,{isOpen:_,onClose:()=>y(!1),projects:j,projectsLoading:K,onSubmit:oe,isSubmitting:C}),e.jsx(Pe,{isOpen:H,onClose:()=>{E(!1),q(null)},onForceCreate:ne,onViewExisting:t=>{E(!1),q(null),o(`/tasks/${t}`)},similarTask:n,isLoading:C})]})}export{Ye as default};
@@ -1 +1 @@
1
- import{a as l,j as a}from"./index-D3EF0BU0.js";import{a as u}from"./status-colors-BNBcbZVQ.js";const r={QUEUED:"tasks.status_queued",ASSIGNED:"tasks.status_assigned",RUNNING:"tasks.status_running",SUSPENDED:"tasks.status_suspended",COMPLETED:"tasks.status_completed",FAILED:"tasks.status_failed",CANCELLED:"tasks.status_cancelled"};function E({status:s}){const{t:e}=l(),t=r[s],n=t?e(t):(s??"unknown").toLowerCase(),o=u(s);return a.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-xs",style:{color:o},children:[a.jsx("span",{style:{fontSize:"0.6rem"},children:"●"}),n]})}export{E as T};
1
+ import{a as l,j as a}from"./index-PZwTchr_.js";import{a as u}from"./status-colors-DDycfcf7.js";const r={QUEUED:"tasks.status_queued",ASSIGNED:"tasks.status_assigned",RUNNING:"tasks.status_running",SUSPENDED:"tasks.status_suspended",COMPLETED:"tasks.status_completed",FAILED:"tasks.status_failed",CANCELLED:"tasks.status_cancelled"};function E({status:s}){const{t:e}=l(),t=r[s],n=t?e(t):(s??"unknown").toLowerCase(),o=u(s);return a.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-xs",style:{color:o},children:[a.jsx("span",{style:{fontSize:"0.6rem"},children:"●"}),n]})}export{E as T};