@overlordai/server 1.0.152 → 1.0.153

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 (135) hide show
  1. package/database/migrations/016-automation-notify-project-chats.sql +2 -0
  2. package/dist/automation/automation.service.d.ts.map +1 -1
  3. package/dist/automation/automation.service.js +3 -0
  4. package/dist/automation/automation.service.js.map +1 -1
  5. package/dist/automation/builtin-templates.js +3 -3
  6. package/dist/automation/builtin-templates.js.map +1 -1
  7. package/dist/database/repositories/automation.repository.d.ts +2 -0
  8. package/dist/database/repositories/automation.repository.d.ts.map +1 -1
  9. package/dist/database/repositories/automation.repository.js +6 -3
  10. package/dist/database/repositories/automation.repository.js.map +1 -1
  11. package/dist/notifier/notification-consumer.d.ts +4 -1
  12. package/dist/notifier/notification-consumer.d.ts.map +1 -1
  13. package/dist/notifier/notification-consumer.js +32 -8
  14. package/dist/notifier/notification-consumer.js.map +1 -1
  15. package/dist/notifier/notification-event-listener.d.ts.map +1 -1
  16. package/dist/notifier/notification-event-listener.js +3 -2
  17. package/dist/notifier/notification-event-listener.js.map +1 -1
  18. package/dist/notifier/notifier.service.d.ts +4 -2
  19. package/dist/notifier/notifier.service.d.ts.map +1 -1
  20. package/dist/notifier/notifier.service.js +57 -2
  21. package/dist/notifier/notifier.service.js.map +1 -1
  22. package/dist/web/automation.controller.d.ts.map +1 -1
  23. package/dist/web/automation.controller.js +6 -0
  24. package/dist/web/automation.controller.js.map +1 -1
  25. package/package.json +4 -4
  26. package/public/assets/{AccessTokensPage-DOQYcLSs.js → AccessTokensPage-DXQ89ukc.js} +1 -1
  27. package/public/assets/{AdminPage-vaAs4nmP.js → AdminPage-CDZmjRV9.js} +1 -1
  28. package/public/assets/{AgentCliPage-BXGIfvSo.js → AgentCliPage-DCdxPR6S.js} +1 -1
  29. package/public/assets/{ApiReferencePage-ChGlKtFZ.js → ApiReferencePage-C9-X-GKr.js} +1 -1
  30. package/public/assets/{ArchitecturePage-BDo0Sz0V.js → ArchitecturePage-Dxlhg0NE.js} +1 -1
  31. package/public/assets/{AuditLogPage-CDonhWBh.js → AuditLogPage-DuNMP2Ci.js} +1 -1
  32. package/public/assets/AutomationCreatePage-C3WbhMos.js +1 -0
  33. package/public/assets/AutomationDetailPage-CZ4Iuva3.js +16 -0
  34. package/public/assets/AutomationEditPage-CWxADO5Y.js +1 -0
  35. package/public/assets/AutomationListPage-D3Pip2D6.js +26 -0
  36. package/public/assets/{AutomationRunDetailPage-BWRONm49.js → AutomationRunDetailPage-BXDvVmOb.js} +1 -1
  37. package/public/assets/{BindPlatformPage-B-jO83qZ.js → BindPlatformPage-D7RqNYXd.js} +1 -1
  38. package/public/assets/{BotIntegrationPage-CfWOXPnJ.js → BotIntegrationPage-V8qLGn1k.js} +1 -1
  39. package/public/assets/{BotManage-Dt4gvWW6.js → BotManage-BoD4fYJL.js} +1 -1
  40. package/public/assets/{BotSetupPage-BAtr0Wem.js → BotSetupPage-zNoKS7WT.js} +1 -1
  41. package/public/assets/{ChangelogPage-CbYmEPo0.js → ChangelogPage-C8vEoFc1.js} +1 -1
  42. package/public/assets/{CliReferencePage-DzBrPSnn.js → CliReferencePage-DI0v_20Z.js} +1 -1
  43. package/public/assets/{ConfirmStageDialog-CJ8pWink.js → ConfirmStageDialog-BxJrj_E0.js} +1 -1
  44. package/public/assets/{DeploymentPage-DngrSHQT.js → DeploymentPage-C73PyRve.js} +1 -1
  45. package/public/assets/{DevWorkflowPage-BQfJaZyg.js → DevWorkflowPage-BePrf4bW.js} +1 -1
  46. package/public/assets/{DeveloperManage-whlVH116.js → DeveloperManage-C5hMRVC-.js} +1 -1
  47. package/public/assets/{DeveloperSetupPage-LrbpgJ2C.js → DeveloperSetupPage-BgXJyC-s.js} +1 -1
  48. package/public/assets/{DocsIndexPage-vE4yr9Si.js → DocsIndexPage-DwasU6WO.js} +1 -1
  49. package/public/assets/{DocsLayout-ByGEAOqk.js → DocsLayout-Bhyrvjmw.js} +1 -1
  50. package/public/assets/{DocsPrimitives-DCBNKtsW.js → DocsPrimitives-criaO5pB.js} +1 -1
  51. package/public/assets/{EditProjectPage-CjJMof0e.js → EditProjectPage-CukMflPd.js} +1 -1
  52. package/public/assets/{EmptyState-BfgwLg0u.js → EmptyState-Cc73hU7f.js} +1 -1
  53. package/public/assets/{EnvVariablesPage-D5h_sa-J.js → EnvVariablesPage-C2rZQZyt.js} +1 -1
  54. package/public/assets/{HomePage-BfETjlYe.js → HomePage-DW-dLfbp.js} +1 -1
  55. package/public/assets/{InfoRow-CIwHf1Un.js → InfoRow-DINJ_QV-.js} +1 -1
  56. package/public/assets/{InstallationPage-2uTV3WlY.js → InstallationPage-DcmzHz4C.js} +1 -1
  57. package/public/assets/{LandingPage-DMFC0PF_.js → LandingPage-CvJzOpWU.js} +1 -1
  58. package/public/assets/{LocalDevelopmentPage-9g3s63GP.js → LocalDevelopmentPage-GAJID9QZ.js} +1 -1
  59. package/public/assets/{LoginPage-CXwygPZl.js → LoginPage-BytAnsfi.js} +1 -1
  60. package/public/assets/{MetricBar-BWuqiydF.js → MetricBar-CbCODU4f.js} +1 -1
  61. package/public/assets/{NotFoundPage-Cs7ae_Mz.js → NotFoundPage-Bs9yJJwx.js} +1 -1
  62. package/public/assets/{OnboardingGuide-uCrXzgnL.js → OnboardingGuide-BIDXqZnr.js} +1 -1
  63. package/public/assets/{PermissionsPage-CVrdX2r2.js → PermissionsPage-wNPxTxmr.js} +1 -1
  64. package/public/assets/{PipelineConfigPage-BxkXW1la.js → PipelineConfigPage-BnDPzJ0W.js} +1 -1
  65. package/public/assets/{PipelineEditorPage-DiyMvTIg.js → PipelineEditorPage-iwD-Ildz.js} +1 -1
  66. package/public/assets/{PlanPage-B-NSg434.js → PlanPage-Ds--6R8P.js} +1 -1
  67. package/public/assets/{ProfilePage-CRMCbMyc.js → ProfilePage-GD0iZnUX.js} +1 -1
  68. package/public/assets/{ProjectDetailPage-Bx1DUkpw.js → ProjectDetailPage-1xSyDx2g.js} +1 -1
  69. package/public/assets/{ProjectListPage-D1LzmIVf.js → ProjectListPage-DvTwJyL7.js} +1 -1
  70. package/public/assets/{PtyTerminal-CxBKQBbF.js → PtyTerminal-C_XqFPK-.js} +1 -1
  71. package/public/assets/{QuickAuth-BMY6Nw6u.js → QuickAuth-IBPgPMoZ.js} +1 -1
  72. package/public/assets/{RemoveMemberConfirmDialog-Da3XlOxO.js → RemoveMemberConfirmDialog-CnwwKZXG.js} +1 -1
  73. package/public/assets/{ReviewAggregatePage-mnnW-Nli.js → ReviewAggregatePage-_DXYQ1no.js} +1 -1
  74. package/public/assets/{ReviewPage-_pd3mJC1.js → ReviewPage-WglnSxck.js} +1 -1
  75. package/public/assets/{Select-CaAVBHmI.js → Select-BT88kXEc.js} +1 -1
  76. package/public/assets/{SettingsPage-CsDJ7FS9.js → SettingsPage-Cp13YqMS.js} +1 -1
  77. package/public/assets/{Skeleton-CNV0Dyd8.js → Skeleton-BS77WEat.js} +1 -1
  78. package/public/assets/{SkillPage-CQyxaNa5.js → SkillPage-DEiBtg-n.js} +1 -1
  79. package/public/assets/{TaskDetailPage-Dn7Vl2tI.js → TaskDetailPage-CLJm5OHg.js} +1 -1
  80. package/public/assets/{TaskGuidePage-Ch465zVv.js → TaskGuidePage-UnG822ve.js} +1 -1
  81. package/public/assets/{TaskListPage-DbQbJMDj.js → TaskListPage-VMLUqQ3z.js} +1 -1
  82. package/public/assets/{TaskStatusBadge-Dzloj2eJ.js → TaskStatusBadge-CPYwuefQ.js} +1 -1
  83. package/public/assets/{TerminalHomePage-C2bwGFkH.js → TerminalHomePage-BGH7we16.js} +1 -1
  84. package/public/assets/{TokenManage-mToToJ_g.js → TokenManage-DSZ4PiTn.js} +1 -1
  85. package/public/assets/{Tooltip-DzkVglKi.js → Tooltip-iHcbiLoR.js} +1 -1
  86. package/public/assets/{TotpSetupPage-Dk00_OYo.js → TotpSetupPage-DSXh_OAz.js} +1 -1
  87. package/public/assets/{WorkerDetailPage-C8_zfmSR.js → WorkerDetailPage-15-wa8JS.js} +1 -1
  88. package/public/assets/{WorkerListPage-kKUioe-i.js → WorkerListPage-tunTyx1T.js} +1 -1
  89. package/public/assets/{WorkerOperationsPage-CBzwbV8I.js → WorkerOperationsPage-Yg4kcw_x.js} +1 -1
  90. package/public/assets/{WorkerSetupGuidePage-DvaP5u6N.js → WorkerSetupGuidePage-LZUkE-e5.js} +1 -1
  91. package/public/assets/{WorkerSetupPage-BD-EAPKM.js → WorkerSetupPage-CG_DzPUH.js} +1 -1
  92. package/public/assets/{agent-type-options-BiwwFXJv.js → agent-type-options-dOssJvy4.js} +1 -1
  93. package/public/assets/{arrow-left-BnN4eZhK.js → arrow-left-CrZE68gW.js} +1 -1
  94. package/public/assets/{arrow-right-BDaYPEVr.js → arrow-right-DLRQjlkF.js} +1 -1
  95. package/public/assets/{bot-jsWsZ197.js → bot-DmJpjSOx.js} +1 -1
  96. package/public/assets/{chevron-down-DyqUpmgf.js → chevron-down-y6iszDL7.js} +1 -1
  97. package/public/assets/{chevron-left-D5fJVFiB.js → chevron-left-BIWwaWdg.js} +1 -1
  98. package/public/assets/{chevron-right-Bz-j2WmS.js → chevron-right-sVVxgXPZ.js} +1 -1
  99. package/public/assets/{chevron-up-DEXIEMJO.js → chevron-up-DeTe83cH.js} +1 -1
  100. package/public/assets/{circle-alert-DE06tNOV.js → circle-alert-Bfr159qR.js} +1 -1
  101. package/public/assets/{clock-DyV22whY.js → clock-YxHW-VuF.js} +1 -1
  102. package/public/assets/{copy-Dtpgo9EK.js → copy-Bl6iow2q.js} +1 -1
  103. package/public/assets/date-CmcdoD87.js +1 -0
  104. package/public/assets/{download-DVCPTZuD.js → download-n0G7Q5jK.js} +1 -1
  105. package/public/assets/{external-link-Bbo-dc9z.js → external-link-CTyupW5_.js} +1 -1
  106. package/public/assets/{git-fork-A1WGp9ha.js → git-fork-BhvPCxDz.js} +1 -1
  107. package/public/assets/{index-PZwTchr_.js → index-Cfz24FvS.js} +2 -2
  108. package/public/assets/index-DZ09Mz1K.css +1 -0
  109. package/public/assets/{key-BDx4jfUG.js → key-Dxqw3xyk.js} +1 -1
  110. package/public/assets/{loader-circle-nKG9e8iK.js → loader-circle-DNtX1Uwk.js} +1 -1
  111. package/public/assets/{pencil-Dgj4md4-.js → pencil-BKEue5ds.js} +1 -1
  112. package/public/assets/{play-DFj8BMl8.js → play-FY1PInKQ.js} +1 -1
  113. package/public/assets/{plus-CCF-PMRF.js → plus-1F0b5FBe.js} +1 -1
  114. package/public/assets/{rotate-ccw-CyltG4Qx.js → rotate-ccw-a8SG1SHY.js} +1 -1
  115. package/public/assets/{scroll-text-IFQgBRlh.js → scroll-text-B9RM2NGX.js} +1 -1
  116. package/public/assets/{settings-CYtYYzCu.js → settings-tfOPOdvu.js} +1 -1
  117. package/public/assets/{skip-forward-Ck7tY58a.js → skip-forward-CcZfD8OL.js} +1 -1
  118. package/public/assets/{status-colors-DDycfcf7.js → status-colors-qoQt_0Rr.js} +1 -1
  119. package/public/assets/{task-constants-CSVY_jfk.js → task-constants-CfHktCUk.js} +1 -1
  120. package/public/assets/{task.store-BTXbcXgO.js → task.store-DwFV-Y_Y.js} +1 -1
  121. package/public/assets/{timer-CXsWiTNP.js → timer-zcEdGBAt.js} +1 -1
  122. package/public/assets/{trash-2-DXJqRCdo.js → trash-2-BLnVFw_Z.js} +1 -1
  123. package/public/assets/{useFetch-6R6P2rOm.js → useFetch-BhpPrPjt.js} +1 -1
  124. package/public/assets/{users-BZPY-p6E.js → users-DtSlwD1_.js} +1 -1
  125. package/public/assets/{wifi-Bgq95lS8.js → wifi-jQAtmf0f.js} +1 -1
  126. package/public/assets/{workflow-RqNfx4vc.js → workflow-BAkt--kn.js} +1 -1
  127. package/public/assets/{zap-BIwamY7L.js → zap-Bz-sk9DU.js} +1 -1
  128. package/public/index.html +2 -2
  129. package/public/sw.js +1 -1
  130. package/public/assets/AutomationCreatePage-C1_2qnf5.js +0 -1
  131. package/public/assets/AutomationDetailPage-BruGQNkV.js +0 -16
  132. package/public/assets/AutomationEditPage-BVlx-7AI.js +0 -1
  133. package/public/assets/AutomationListPage-BprhRKdu.js +0 -26
  134. package/public/assets/date-RFA7-ZGs.js +0 -1
  135. package/public/assets/index-Du11Fv9c.css +0 -1
@@ -1,4 +1,4 @@
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";/**
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-Cfz24FvS.js";import{P as fe}from"./PtyTerminal-C_XqFPK-.js";import{T as je}from"./Skeleton-BS77WEat.js";import{f as Ne,b as we}from"./date-CmcdoD87.js";import{a as ye}from"./agent-type-options-dOssJvy4.js";import{T as G,g as Q}from"./task-constants-CfHktCUk.js";import{A as ke}from"./arrow-left-CrZE68gW.js";import{L as Se}from"./loader-circle-DNtX1Uwk.js";import{P as z}from"./play-FY1PInKQ.js";import{S as Ce}from"./skip-forward-CcZfD8OL.js";import{R as Te}from"./rotate-ccw-a8SG1SHY.js";import{C as Ae}from"./chevron-up-DeTe83cH.js";import{C as Ee}from"./chevron-down-y6iszDL7.js";import{C as Re}from"./circle-alert-Bfr159qR.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{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
+ 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-Cfz24FvS.js";import{E as D}from"./EmptyState-Cc73hU7f.js";import{T as L}from"./Skeleton-BS77WEat.js";import{S as k}from"./Select-BT88kXEc.js";import{f as P}from"./date-CmcdoD87.js";import{T as A}from"./Tooltip-iHcbiLoR.js";import{a as q}from"./agent-type-options-dOssJvy4.js";import{g as z}from"./task-constants-CfHktCUk.js";import{P as R}from"./play-FY1PInKQ.js";import{C as Q}from"./chevron-left-BIWwaWdg.js";import{C as X}from"./chevron-right-sVVxgXPZ.js";import"./chevron-down-y6iszDL7.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-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
+ import{r as l,j as t}from"./index-Cfz24FvS.js";import{C as f}from"./chevron-down-y6iszDL7.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-PZwTchr_.js";/**
1
+ import{c as h,a as v,r,j as e,h as m,t as u}from"./index-Cfz24FvS.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-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
+ import{j as e}from"./index-Cfz24FvS.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-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};
1
+ import{a as t,j as e}from"./index-Cfz24FvS.js";import{I as c,C as r}from"./DocsPrimitives-criaO5pB.js";import{E as n}from"./external-link-CTyupW5_.js";import"./copy-Bl6iow2q.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,4 +1,4 @@
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";/**
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-Cfz24FvS.js";import{u as ss}from"./task.store-DwFV-Y_Y.js";import{P as ut}from"./PtyTerminal-C_XqFPK-.js";import{g as as,C as ht,H as rs}from"./ConfirmStageDialog-BxJrj_E0.js";import{S as ft}from"./Select-BT88kXEc.js";import{b as ns,f as Q,c as ls}from"./date-CmcdoD87.js";import{a as St}from"./status-colors-qoQt_0Rr.js";import{a as vt}from"./agent-type-options-dOssJvy4.js";import{T as cs,g as Y}from"./task-constants-CfHktCUk.js";import{T as is}from"./Tooltip-iHcbiLoR.js";import{A as os}from"./arrow-left-CrZE68gW.js";import{R as Ct}from"./rotate-ccw-a8SG1SHY.js";import{G as xs}from"./git-fork-BhvPCxDz.js";import{P as gt}from"./play-FY1PInKQ.js";import{E as bt}from"./external-link-CTyupW5_.js";import{L as Et}from"./loader-circle-DNtX1Uwk.js";import{S as ds}from"./skip-forward-CcZfD8OL.js";import"./clock-YxHW-VuF.js";import"./chevron-down-y6iszDL7.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
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
1
+ import{j as e}from"./index-Cfz24FvS.js";import{a as s}from"./DocsPrimitives-criaO5pB.js";import"./copy-Bl6iow2q.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-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
+ 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-Cfz24FvS.js";import{u as X}from"./task.store-DwFV-Y_Y.js";import{T as se}from"./TaskStatusBadge-CPYwuefQ.js";import{f as re}from"./date-CmcdoD87.js";import{T as ke}from"./Tooltip-iHcbiLoR.js";import{G as ae}from"./git-fork-BhvPCxDz.js";import{S as D}from"./Select-BT88kXEc.js";import{a as Ne}from"./task-constants-CfHktCUk.js";import{g as Ce}from"./agent-type-options-dOssJvy4.js";import{C as we}from"./copy-Bl6iow2q.js";import{E as Y}from"./EmptyState-Cc73hU7f.js";import{T as Z}from"./Skeleton-BS77WEat.js";import{P as Se}from"./plus-1F0b5FBe.js";import{C as _e}from"./chevron-left-BIWwaWdg.js";import{C as Te}from"./chevron-right-sVVxgXPZ.js";import"./status-colors-qoQt_0Rr.js";import"./chevron-down-y6iszDL7.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-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};
1
+ import{a as l,j as a}from"./index-Cfz24FvS.js";import{a as u}from"./status-colors-qoQt_0Rr.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,4 +1,4 @@
1
- import{c as ce,n as le,h as O,o as S,a as A,r,k as z,p as de,q as xe,j as e,X as Z,s as me,f as pe,l as ue,m as he}from"./index-PZwTchr_.js";import{g as ee,H as ve,C as fe}from"./ConfirmStageDialog-CJ8pWink.js";import{u as ge}from"./task.store-BTXbcXgO.js";import{P as be}from"./PtyTerminal-CxBKQBbF.js";import{i as G,O as te}from"./OnboardingGuide-uCrXzgnL.js";import{S as E}from"./Select-CaAVBHmI.js";import{a as se}from"./status-colors-DDycfcf7.js";import{a as je}from"./date-RFA7-ZGs.js";import{T as q,a as J,g as ke}from"./task-constants-CSVY_jfk.js";import{g as ye}from"./agent-type-options-BiwwFXJv.js";import{u as ae}from"./useFetch-6R6P2rOm.js";import{P as $}from"./plus-CCF-PMRF.js";import{C as Ne}from"./chevron-down-DyqUpmgf.js";import{C as we}from"./chevron-up-DEXIEMJO.js";import{R as Te}from"./rotate-ccw-CyltG4Qx.js";import{C as Se}from"./clock-DyV22whY.js";import{W as _e}from"./wifi-Bgq95lS8.js";import"./chevron-right-Bz-j2WmS.js";/**
1
+ import{c as ce,n as le,h as O,o as S,a as A,r,k as z,p as de,q as xe,j as e,X as Z,s as me,f as pe,l as ue,m as he}from"./index-Cfz24FvS.js";import{g as ee,H as ve,C as fe}from"./ConfirmStageDialog-BxJrj_E0.js";import{u as ge}from"./task.store-DwFV-Y_Y.js";import{P as be}from"./PtyTerminal-C_XqFPK-.js";import{i as G,O as te}from"./OnboardingGuide-BIDXqZnr.js";import{S as E}from"./Select-BT88kXEc.js";import{a as se}from"./status-colors-qoQt_0Rr.js";import{a as je}from"./date-CmcdoD87.js";import{T as q,a as J,g as ke}from"./task-constants-CfHktCUk.js";import{g as ye}from"./agent-type-options-dOssJvy4.js";import{u as ae}from"./useFetch-BhpPrPjt.js";import{P as $}from"./plus-1F0b5FBe.js";import{C as Ne}from"./chevron-down-y6iszDL7.js";import{C as we}from"./chevron-up-DeTe83cH.js";import{R as Te}from"./rotate-ccw-a8SG1SHY.js";import{C as Se}from"./clock-YxHW-VuF.js";import{W as _e}from"./wifi-jQAtmf0f.js";import"./chevron-right-sVVxgXPZ.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{a as C,v as D,r as n,j as e,h as _,f as P,I as V,a7 as w,a5 as O,ac as S,s as W}from"./index-PZwTchr_.js";import{K as L}from"./key-BDx4jfUG.js";import{C as T}from"./copy-Dtpgo9EK.js";import{E as B}from"./external-link-Bbo-dc9z.js";import{E as J}from"./EmptyState-BfgwLg0u.js";import{T as z}from"./Skeleton-CNV0Dyd8.js";import{u as X}from"./useFetch-6R6P2rOm.js";import{e as E}from"./status-colors-DDycfcf7.js";import{P as q}from"./plus-CCF-PMRF.js";function G({isOpen:r,onClose:f,onCreated:u}){const{t:s}=C();D(r);const[a,o]=n.useState(""),[i,d]=n.useState(!1),[l,h]=n.useState("");function y(){o(""),h(""),f()}async function x(){if(h(""),!a.trim()){h(s("admin.pat_label_required"));return}try{d(!0);const c=await _.post("admin/worker-tokens",{json:{label:a.trim()}}).json();o(""),u({token:c.token,id:c.id})}catch(c){const m=c instanceof Error?c.message:s("admin.pat_failed_to_generate");h(m)}finally{d(!1)}}return r?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},children:e.jsxs("div",{className:"w-full border border-[var(--border)] bg-[var(--bg-card)]",style:{maxWidth:"480px",borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:[e.jsxs("div",{className:"flex items-center gap-2 border-b border-[var(--border)] px-5 py-4",children:[e.jsx(L,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:s("admin.generate_worker_token_title")})]}),e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[l&&e.jsx("div",{className:"border border-[var(--destructive)]/30 bg-[var(--destructive)]/10 px-3 py-2 text-xs text-[var(--destructive)]",style:{borderRadius:"4px"},children:l}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:s("admin.create_one_time_token")}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:s("admin.label")}),e.jsx("input",{type:"text",placeholder:s("admin.pat_label_placeholder"),value:a,onChange:c=>o(c.target.value),className:"w-full border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2 text-sm text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:border-[var(--accent)] focus:outline-none",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},onKeyDown:c=>{c.key==="Enter"&&x()}}),e.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:s("admin.label_identifies_worker")})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-[var(--border)] px-5 py-3",children:[e.jsx("button",{onClick:y,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:s("common.cancel")}),e.jsx("button",{onClick:x,disabled:i,className:"bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-black transition-opacity hover:opacity-80 disabled:opacity-50",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:s(i?"admin.generating":"admin.generate")})]})]})}):null}const U=3e3,H=600*1e3;function Q({isOpen:r,token:f,tokenId:u,onClose:s}){const{t:a}=C();D(r);const[o,i]=n.useState("command"),[d,l]=n.useState(!1),[h,y]=n.useState(!1),[x,c]=n.useState(""),[m,g]=n.useState(null),p=n.useRef(void 0),N=n.useRef(Date.now()),k=n.useRef(null),j=P();n.useEffect(()=>{var v;r&&((v=k.current)==null||v.focus())},[r]);const t=n.useCallback(v=>{v.key==="Escape"&&s()},[s]),A=typeof window<"u"?window.location.origin:"https://overlord.example.com",R=`overlord setup worker --token ${f} --server ${A}`;async function F(){try{await navigator.clipboard.writeText(f),l(!0),setTimeout(()=>l(!1),2e3)}catch{}}async function I(){try{await navigator.clipboard.writeText(R),y(!0),setTimeout(()=>y(!1),2e3)}catch{}}const M=n.useCallback(async()=>{try{const v=await _.get(`admin/worker-tokens/${u}/status`).json();v.status==="used"&&v.worker_name&&(i("success"),c(v.worker_name),g(v.worker_id??null),p.current&&clearInterval(p.current))}catch{}Date.now()-N.current>H&&(i("timeout"),p.current&&clearInterval(p.current))},[u]);function K(){i("waiting"),N.current=Date.now(),p.current=setInterval(M,U)}n.useEffect(()=>()=>{p.current&&clearInterval(p.current)},[]);function $(){s(),m&&j(`/workers/${m}`)}if(!r)return null;const b={fontFamily:"'JetBrains Mono', monospace",borderRadius:"4px"};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},children:e.jsxs("div",{ref:k,className:"w-full border border-[var(--border)] bg-[var(--bg-card)]",style:{...b,maxWidth:"480px"},onKeyDown:t,tabIndex:-1,children:[e.jsx("div",{className:"flex items-center gap-2 border-b border-[var(--border)] px-5 py-4",children:o==="success"?e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:a("admin.worker_registered")})]}):e.jsxs(e.Fragment,{children:[e.jsx(L,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:a("admin.worker_token_generated")})]})}),e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[o!=="success"&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:a("admin.run_command_desc")}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[11px] text-[var(--text-muted)]",children:"Token"}),e.jsxs("div",{className:"relative border border-[var(--border)] bg-[var(--bg-card)] p-3",style:{borderRadius:"4px"},children:[e.jsx("code",{className:"block break-all pr-20 text-xs text-[var(--text-primary)]",children:f}),e.jsx("button",{onClick:F,className:"absolute right-2 top-2 flex items-center gap-1 border border-[var(--border)] bg-transparent px-2 py-1 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:d?e.jsx("span",{className:"text-[var(--accent)]",children:a("common.copied")}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(T,{className:"h-3 w-3"})," ",a("common.copy")]})})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[11px] text-[var(--text-muted)]",children:a("admin.setup_command")}),e.jsxs("div",{className:"relative border border-[var(--border)] bg-[var(--bg-card)] p-3",style:{borderRadius:"4px"},children:[e.jsxs("code",{className:"block break-all pr-20 text-xs text-[var(--accent)]",children:["$ ",R]}),e.jsx("button",{onClick:I,className:"absolute right-2 top-2 flex items-center gap-1 border border-[var(--border)] bg-transparent px-2 py-1 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:h?e.jsx("span",{className:"text-[var(--accent)]",children:a("common.copied")}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(T,{className:"h-3 w-3"})," ",a("common.copy")]})})]})]}),e.jsx("div",{className:"border border-yellow-500/30 bg-yellow-500/10 px-3 py-2 text-xs text-yellow-400",style:{borderRadius:"4px"},children:a("admin.token_shown_once")})]}),o==="waiting"&&e.jsxs("div",{className:"flex items-center gap-3 border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3",style:{borderRadius:"4px"},children:[e.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-[var(--accent)] border-t-transparent"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:a("admin.waiting_for_worker")})]}),o==="timeout"&&e.jsx("div",{className:"border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3 text-xs text-[var(--text-muted)]",style:{borderRadius:"4px"},children:a("admin.token_not_yet_used")}),o==="success"&&e.jsxs("div",{className:"border border-[var(--accent)]/30 bg-[var(--accent)]/10 px-4 py-3",style:{borderRadius:"4px"},children:[e.jsx("p",{className:"text-xs text-[var(--accent)]",children:a("admin.worker_registered_success")}),e.jsxs("p",{className:"mt-1 text-xs text-[var(--text-primary)]",children:[a("admin.worker"),": ",e.jsx("span",{className:"text-[var(--accent)]",children:x})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-[var(--border)] px-5 py-3",children:[o==="command"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:a("common.close")}),e.jsx("button",{onClick:K,className:"bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-black transition-opacity hover:opacity-80",style:b,children:a("admin.copied_wait_for_worker")})]}),o==="waiting"&&e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:a("admin.close_worker_can_register")}),o==="timeout"&&e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:a("common.close")}),o==="success"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:a("common.close")}),e.jsxs("button",{onClick:$,className:"flex items-center gap-1.5 bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-black transition-opacity hover:opacity-80",style:b,children:[e.jsx(B,{className:"h-3 w-3"}),a("admin.view_worker")]})]})]})]})})}function ce(){const{t:r}=C(),[f,u]=n.useState(!1),[s,a]=n.useState(null),[o,i]=n.useState(!1),[d,l]=n.useState(null),[h,y]=n.useState(!1),[x,c]=n.useState(!1),{data:m,loading:g,refetch:p}=X(()=>_.get("admin/worker-tokens").json(),[]);async function N(){if(d){y(!0);try{await _.post(`admin/worker-tokens/${d.id}/revoke`),i(!1),l(null),p()}catch{}finally{y(!1)}}}function k(t){u(!1),a(t),p()}const j=n.useMemo(()=>(m??[]).filter(t=>x||t.status!==w.REVOKED),[m,x]);return e.jsxs("div",{className:"font-mono",children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:r("admin.tokens_title")}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("admin.tokens_subtitle")})]}),e.jsxs("button",{type:"button",className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity",onClick:()=>u(!0),children:[e.jsx(q,{className:"h-3.5 w-3.5"}),r("admin.generate_token")]})]}),!g&&(m==null?void 0:m.some(t=>t.status===w.REVOKED))&&e.jsx("div",{className:"mb-4 flex items-center gap-2",children:e.jsx("button",{type:"button",onClick:()=>c(!x),className:`text-xs transition-colors ${x?"text-[var(--text-primary)]":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:r(x?"admin.hide_revoked":"admin.show_revoked")})}),g?e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsx(z,{rows:3})}):j.length===0?e.jsx(J,{icon:O,title:r("admin.no_worker_tokens"),description:r("admin.generate_token_desc"),actionLabel:r("admin.generate_token"),onAction:()=>u(!0)}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden md:block overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] text-left text-[var(--text-muted)]",children:[e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.label")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.purpose")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.status")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("common.created_at")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.expires_at")}),e.jsx("th",{className:"pb-2 font-normal",children:r("common.actions")})]})}),e.jsx("tbody",{children:j.map(t=>e.jsxs("tr",{className:"border-b border-[var(--border-row)] hover:bg-white/[0.02] transition-colors",children:[e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-primary)]",children:t.label}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:t.purpose}),e.jsx("td",{className:"py-2.5 pr-4",children:e.jsx("span",{className:E(t.status),children:t.status})}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-muted)]",children:new Date(t.createdAt).toLocaleDateString()}),e.jsx("td",{className:"py-2.5 pr-4",children:t.expiresAt?e.jsx("span",{className:"text-[var(--text-secondary)]",children:new Date(t.expiresAt).toLocaleDateString()}):e.jsx("span",{className:"text-[var(--text-muted)]",children:"—"})}),e.jsx("td",{className:"py-2.5",children:t.status===w.ACTIVE&&e.jsxs("button",{type:"button",className:"flex items-center gap-1 rounded-[4px] px-2 py-1 text-red-400 hover:text-red-300 hover:bg-white/[0.05] transition-colors",onClick:()=>{l(t),i(!0)},children:[e.jsx(S,{className:"h-3.5 w-3.5"}),r("admin.revoke")]})})]},t.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3",children:j.map(t=>e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-xs text-[var(--text-primary)] font-medium truncate mr-2",children:t.label}),e.jsx("span",{className:`text-[11px] shrink-0 ${E(t.status)}`,children:t.status})]}),e.jsx("div",{className:"text-[11px] text-[var(--text-secondary)] truncate mb-1",children:t.purpose}),e.jsxs("div",{className:"flex items-center justify-between text-[11px] text-[var(--text-muted)]",children:[e.jsx("span",{children:new Date(t.createdAt).toLocaleDateString()}),t.expiresAt&&e.jsx("span",{children:new Date(t.expiresAt).toLocaleDateString()})]}),t.status===w.ACTIVE&&e.jsx("div",{className:"mt-2 pt-2 border-t border-[var(--border)]",children:e.jsxs("button",{type:"button",className:"flex items-center gap-1 rounded-[4px] px-2 py-1 text-[11px] text-red-400 hover:text-red-300 hover:bg-white/[0.05] transition-colors",onClick:()=>{l(t),i(!0)},children:[e.jsx(S,{className:"h-3.5 w-3.5"}),r("admin.revoke")]})})]},t.id))})]}),e.jsx(G,{isOpen:f,onClose:()=>u(!1),onCreated:k}),s&&e.jsx(Q,{isOpen:!!s,token:s.token,tokenId:s.id,onClose:()=>a(null)}),e.jsx(W,{isOpen:o,onClose:()=>{i(!1),l(null)},onConfirm:N,title:r("admin.revoke_token"),message:r("admin.revoke_token_confirm",{label:(d==null?void 0:d.label)??""}),confirmLabel:r("admin.revoke"),confirmVariant:"danger",isLoading:h})]})}export{ce as default};
1
+ import{a as C,v as D,r as n,j as e,h as _,f as P,I as V,a7 as w,a5 as O,ac as S,s as W}from"./index-Cfz24FvS.js";import{K as L}from"./key-Dxqw3xyk.js";import{C as T}from"./copy-Bl6iow2q.js";import{E as B}from"./external-link-CTyupW5_.js";import{E as J}from"./EmptyState-Cc73hU7f.js";import{T as z}from"./Skeleton-BS77WEat.js";import{u as X}from"./useFetch-BhpPrPjt.js";import{e as E}from"./status-colors-qoQt_0Rr.js";import{P as q}from"./plus-1F0b5FBe.js";function G({isOpen:r,onClose:f,onCreated:u}){const{t:s}=C();D(r);const[a,o]=n.useState(""),[i,d]=n.useState(!1),[l,h]=n.useState("");function y(){o(""),h(""),f()}async function x(){if(h(""),!a.trim()){h(s("admin.pat_label_required"));return}try{d(!0);const c=await _.post("admin/worker-tokens",{json:{label:a.trim()}}).json();o(""),u({token:c.token,id:c.id})}catch(c){const m=c instanceof Error?c.message:s("admin.pat_failed_to_generate");h(m)}finally{d(!1)}}return r?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},children:e.jsxs("div",{className:"w-full border border-[var(--border)] bg-[var(--bg-card)]",style:{maxWidth:"480px",borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:[e.jsxs("div",{className:"flex items-center gap-2 border-b border-[var(--border)] px-5 py-4",children:[e.jsx(L,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:s("admin.generate_worker_token_title")})]}),e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[l&&e.jsx("div",{className:"border border-[var(--destructive)]/30 bg-[var(--destructive)]/10 px-3 py-2 text-xs text-[var(--destructive)]",style:{borderRadius:"4px"},children:l}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:s("admin.create_one_time_token")}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:s("admin.label")}),e.jsx("input",{type:"text",placeholder:s("admin.pat_label_placeholder"),value:a,onChange:c=>o(c.target.value),className:"w-full border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2 text-sm text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:border-[var(--accent)] focus:outline-none",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},onKeyDown:c=>{c.key==="Enter"&&x()}}),e.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:s("admin.label_identifies_worker")})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-[var(--border)] px-5 py-3",children:[e.jsx("button",{onClick:y,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:s("common.cancel")}),e.jsx("button",{onClick:x,disabled:i,className:"bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-black transition-opacity hover:opacity-80 disabled:opacity-50",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:s(i?"admin.generating":"admin.generate")})]})]})}):null}const U=3e3,H=600*1e3;function Q({isOpen:r,token:f,tokenId:u,onClose:s}){const{t:a}=C();D(r);const[o,i]=n.useState("command"),[d,l]=n.useState(!1),[h,y]=n.useState(!1),[x,c]=n.useState(""),[m,g]=n.useState(null),p=n.useRef(void 0),N=n.useRef(Date.now()),k=n.useRef(null),j=P();n.useEffect(()=>{var v;r&&((v=k.current)==null||v.focus())},[r]);const t=n.useCallback(v=>{v.key==="Escape"&&s()},[s]),A=typeof window<"u"?window.location.origin:"https://overlord.example.com",R=`overlord setup worker --token ${f} --server ${A}`;async function F(){try{await navigator.clipboard.writeText(f),l(!0),setTimeout(()=>l(!1),2e3)}catch{}}async function I(){try{await navigator.clipboard.writeText(R),y(!0),setTimeout(()=>y(!1),2e3)}catch{}}const M=n.useCallback(async()=>{try{const v=await _.get(`admin/worker-tokens/${u}/status`).json();v.status==="used"&&v.worker_name&&(i("success"),c(v.worker_name),g(v.worker_id??null),p.current&&clearInterval(p.current))}catch{}Date.now()-N.current>H&&(i("timeout"),p.current&&clearInterval(p.current))},[u]);function K(){i("waiting"),N.current=Date.now(),p.current=setInterval(M,U)}n.useEffect(()=>()=>{p.current&&clearInterval(p.current)},[]);function $(){s(),m&&j(`/workers/${m}`)}if(!r)return null;const b={fontFamily:"'JetBrains Mono', monospace",borderRadius:"4px"};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},children:e.jsxs("div",{ref:k,className:"w-full border border-[var(--border)] bg-[var(--bg-card)]",style:{...b,maxWidth:"480px"},onKeyDown:t,tabIndex:-1,children:[e.jsx("div",{className:"flex items-center gap-2 border-b border-[var(--border)] px-5 py-4",children:o==="success"?e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:a("admin.worker_registered")})]}):e.jsxs(e.Fragment,{children:[e.jsx(L,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:a("admin.worker_token_generated")})]})}),e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[o!=="success"&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:a("admin.run_command_desc")}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[11px] text-[var(--text-muted)]",children:"Token"}),e.jsxs("div",{className:"relative border border-[var(--border)] bg-[var(--bg-card)] p-3",style:{borderRadius:"4px"},children:[e.jsx("code",{className:"block break-all pr-20 text-xs text-[var(--text-primary)]",children:f}),e.jsx("button",{onClick:F,className:"absolute right-2 top-2 flex items-center gap-1 border border-[var(--border)] bg-transparent px-2 py-1 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:d?e.jsx("span",{className:"text-[var(--accent)]",children:a("common.copied")}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(T,{className:"h-3 w-3"})," ",a("common.copy")]})})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[11px] text-[var(--text-muted)]",children:a("admin.setup_command")}),e.jsxs("div",{className:"relative border border-[var(--border)] bg-[var(--bg-card)] p-3",style:{borderRadius:"4px"},children:[e.jsxs("code",{className:"block break-all pr-20 text-xs text-[var(--accent)]",children:["$ ",R]}),e.jsx("button",{onClick:I,className:"absolute right-2 top-2 flex items-center gap-1 border border-[var(--border)] bg-transparent px-2 py-1 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:h?e.jsx("span",{className:"text-[var(--accent)]",children:a("common.copied")}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(T,{className:"h-3 w-3"})," ",a("common.copy")]})})]})]}),e.jsx("div",{className:"border border-yellow-500/30 bg-yellow-500/10 px-3 py-2 text-xs text-yellow-400",style:{borderRadius:"4px"},children:a("admin.token_shown_once")})]}),o==="waiting"&&e.jsxs("div",{className:"flex items-center gap-3 border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3",style:{borderRadius:"4px"},children:[e.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-[var(--accent)] border-t-transparent"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:a("admin.waiting_for_worker")})]}),o==="timeout"&&e.jsx("div",{className:"border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3 text-xs text-[var(--text-muted)]",style:{borderRadius:"4px"},children:a("admin.token_not_yet_used")}),o==="success"&&e.jsxs("div",{className:"border border-[var(--accent)]/30 bg-[var(--accent)]/10 px-4 py-3",style:{borderRadius:"4px"},children:[e.jsx("p",{className:"text-xs text-[var(--accent)]",children:a("admin.worker_registered_success")}),e.jsxs("p",{className:"mt-1 text-xs text-[var(--text-primary)]",children:[a("admin.worker"),": ",e.jsx("span",{className:"text-[var(--accent)]",children:x})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-[var(--border)] px-5 py-3",children:[o==="command"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:a("common.close")}),e.jsx("button",{onClick:K,className:"bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-black transition-opacity hover:opacity-80",style:b,children:a("admin.copied_wait_for_worker")})]}),o==="waiting"&&e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:a("admin.close_worker_can_register")}),o==="timeout"&&e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:a("common.close")}),o==="success"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:a("common.close")}),e.jsxs("button",{onClick:$,className:"flex items-center gap-1.5 bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-black transition-opacity hover:opacity-80",style:b,children:[e.jsx(B,{className:"h-3 w-3"}),a("admin.view_worker")]})]})]})]})})}function ce(){const{t:r}=C(),[f,u]=n.useState(!1),[s,a]=n.useState(null),[o,i]=n.useState(!1),[d,l]=n.useState(null),[h,y]=n.useState(!1),[x,c]=n.useState(!1),{data:m,loading:g,refetch:p}=X(()=>_.get("admin/worker-tokens").json(),[]);async function N(){if(d){y(!0);try{await _.post(`admin/worker-tokens/${d.id}/revoke`),i(!1),l(null),p()}catch{}finally{y(!1)}}}function k(t){u(!1),a(t),p()}const j=n.useMemo(()=>(m??[]).filter(t=>x||t.status!==w.REVOKED),[m,x]);return e.jsxs("div",{className:"font-mono",children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:r("admin.tokens_title")}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("admin.tokens_subtitle")})]}),e.jsxs("button",{type:"button",className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity",onClick:()=>u(!0),children:[e.jsx(q,{className:"h-3.5 w-3.5"}),r("admin.generate_token")]})]}),!g&&(m==null?void 0:m.some(t=>t.status===w.REVOKED))&&e.jsx("div",{className:"mb-4 flex items-center gap-2",children:e.jsx("button",{type:"button",onClick:()=>c(!x),className:`text-xs transition-colors ${x?"text-[var(--text-primary)]":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:r(x?"admin.hide_revoked":"admin.show_revoked")})}),g?e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsx(z,{rows:3})}):j.length===0?e.jsx(J,{icon:O,title:r("admin.no_worker_tokens"),description:r("admin.generate_token_desc"),actionLabel:r("admin.generate_token"),onAction:()=>u(!0)}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden md:block overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] text-left text-[var(--text-muted)]",children:[e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.label")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.purpose")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.status")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("common.created_at")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.expires_at")}),e.jsx("th",{className:"pb-2 font-normal",children:r("common.actions")})]})}),e.jsx("tbody",{children:j.map(t=>e.jsxs("tr",{className:"border-b border-[var(--border-row)] hover:bg-white/[0.02] transition-colors",children:[e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-primary)]",children:t.label}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:t.purpose}),e.jsx("td",{className:"py-2.5 pr-4",children:e.jsx("span",{className:E(t.status),children:t.status})}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-muted)]",children:new Date(t.createdAt).toLocaleDateString()}),e.jsx("td",{className:"py-2.5 pr-4",children:t.expiresAt?e.jsx("span",{className:"text-[var(--text-secondary)]",children:new Date(t.expiresAt).toLocaleDateString()}):e.jsx("span",{className:"text-[var(--text-muted)]",children:"—"})}),e.jsx("td",{className:"py-2.5",children:t.status===w.ACTIVE&&e.jsxs("button",{type:"button",className:"flex items-center gap-1 rounded-[4px] px-2 py-1 text-red-400 hover:text-red-300 hover:bg-white/[0.05] transition-colors",onClick:()=>{l(t),i(!0)},children:[e.jsx(S,{className:"h-3.5 w-3.5"}),r("admin.revoke")]})})]},t.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3",children:j.map(t=>e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-xs text-[var(--text-primary)] font-medium truncate mr-2",children:t.label}),e.jsx("span",{className:`text-[11px] shrink-0 ${E(t.status)}`,children:t.status})]}),e.jsx("div",{className:"text-[11px] text-[var(--text-secondary)] truncate mb-1",children:t.purpose}),e.jsxs("div",{className:"flex items-center justify-between text-[11px] text-[var(--text-muted)]",children:[e.jsx("span",{children:new Date(t.createdAt).toLocaleDateString()}),t.expiresAt&&e.jsx("span",{children:new Date(t.expiresAt).toLocaleDateString()})]}),t.status===w.ACTIVE&&e.jsx("div",{className:"mt-2 pt-2 border-t border-[var(--border)]",children:e.jsxs("button",{type:"button",className:"flex items-center gap-1 rounded-[4px] px-2 py-1 text-[11px] text-red-400 hover:text-red-300 hover:bg-white/[0.05] transition-colors",onClick:()=>{l(t),i(!0)},children:[e.jsx(S,{className:"h-3.5 w-3.5"}),r("admin.revoke")]})})]},t.id))})]}),e.jsx(G,{isOpen:f,onClose:()=>u(!1),onCreated:k}),s&&e.jsx(Q,{isOpen:!!s,token:s.token,tokenId:s.id,onClose:()=>a(null)}),e.jsx(W,{isOpen:o,onClose:()=>{i(!1),l(null)},onConfirm:N,title:r("admin.revoke_token"),message:r("admin.revoke_token_confirm",{label:(d==null?void 0:d.label)??""}),confirmLabel:r("admin.revoke"),confirmVariant:"danger",isLoading:h})]})}export{ce as default};
@@ -1 +1 @@
1
- import{_ as m,r as e,j as t}from"./index-PZwTchr_.js";var b=m();function g({content:n,children:a,delay:l=100,className:i}){const[p,u]=e.useState(!1),[c,f]=e.useState({top:0,left:0}),r=e.useRef(null),o=e.useRef(null),x=e.useCallback(()=>{r.current=setTimeout(()=>{if(o.current){const s=o.current.getBoundingClientRect();f({top:s.top-4,left:s.left+s.width/2})}u(!0)},l)},[l]),d=e.useCallback(()=>{r.current&&(clearTimeout(r.current),r.current=null),u(!1)},[]);return n?t.jsxs(t.Fragment,{children:[t.jsx("span",{ref:o,onMouseEnter:x,onMouseLeave:d,className:i,children:a}),p&&b.createPortal(t.jsx("div",{role:"tooltip",style:{position:"fixed",top:c.top,left:c.left,transform:"translate(-50%, -100%)",zIndex:9999},className:"pointer-events-none max-w-sm rounded-[4px] bg-[var(--bg-card)] px-2.5 py-1.5 text-xs text-[var(--text-primary)] shadow-lg border border-[var(--border-row)]",children:n}),document.body)]}):t.jsx(t.Fragment,{children:a})}export{g as T};
1
+ import{_ as m,r as e,j as t}from"./index-Cfz24FvS.js";var b=m();function g({content:n,children:a,delay:l=100,className:i}){const[p,u]=e.useState(!1),[c,f]=e.useState({top:0,left:0}),r=e.useRef(null),o=e.useRef(null),x=e.useCallback(()=>{r.current=setTimeout(()=>{if(o.current){const s=o.current.getBoundingClientRect();f({top:s.top-4,left:s.left+s.width/2})}u(!0)},l)},[l]),d=e.useCallback(()=>{r.current&&(clearTimeout(r.current),r.current=null),u(!1)},[]);return n?t.jsxs(t.Fragment,{children:[t.jsx("span",{ref:o,onMouseEnter:x,onMouseLeave:d,className:i,children:a}),p&&b.createPortal(t.jsx("div",{role:"tooltip",style:{position:"fixed",top:c.top,left:c.left,transform:"translate(-50%, -100%)",zIndex:9999},className:"pointer-events-none max-w-sm rounded-[4px] bg-[var(--bg-card)] px-2.5 py-1.5 text-xs text-[var(--text-primary)] shadow-lg border border-[var(--border-row)]",children:n}),document.body)]}):t.jsx(t.Fragment,{children:a})}export{g as T};
@@ -1,4 +1,4 @@
1
- import{R as A,g as he,f as fe,u as Y,a as me,r as _,j as M,h as W,t as ge}from"./index-PZwTchr_.js";var pe=Object.defineProperty,j=Object.getOwnPropertySymbols,X=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable,V=(u,a,i)=>a in u?pe(u,a,{enumerable:!0,configurable:!0,writable:!0,value:i}):u[a]=i,k=(u,a)=>{for(var i in a||(a={}))X.call(a,i)&&V(u,i,a[i]);if(j)for(var i of j(a))K.call(a,i)&&V(u,i,a[i]);return u},U=(u,a)=>{var i={};for(var l in u)X.call(u,l)&&a.indexOf(l)<0&&(i[l]=u[l]);if(u!=null&&j)for(var l of j(u))a.indexOf(l)<0&&K.call(u,l)&&(i[l]=u[l]);return i};/**
1
+ import{R as A,g as he,f as fe,u as Y,a as me,r as _,j as M,h as W,t as ge}from"./index-Cfz24FvS.js";var pe=Object.defineProperty,j=Object.getOwnPropertySymbols,X=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable,V=(u,a,i)=>a in u?pe(u,a,{enumerable:!0,configurable:!0,writable:!0,value:i}):u[a]=i,k=(u,a)=>{for(var i in a||(a={}))X.call(a,i)&&V(u,i,a[i]);if(j)for(var i of j(a))K.call(a,i)&&V(u,i,a[i]);return u},U=(u,a)=>{var i={};for(var l in u)X.call(u,l)&&a.indexOf(l)<0&&(i[l]=u[l]);if(u!=null&&j)for(var l of j(u))a.indexOf(l)<0&&K.call(u,l)&&(i[l]=u[l]);return i};/**
2
2
  * @license QR Code generator library (TypeScript)
3
3
  * Copyright (c) Project Nayuki.
4
4
  * SPDX-License-Identifier: MIT
@@ -1 +1 @@
1
- import{a as b,j as e,s as T,A as se,f as te,r as x,u as ae,k as R,w as ne,W as m,D as N,L as oe,Q as F,h as g,l as ie}from"./index-PZwTchr_.js";import{t as le,c as H}from"./date-RFA7-ZGs.js";import{w as ce,b as de,t as xe}from"./status-colors-DDycfcf7.js";import{I as l}from"./InfoRow-CIwHf1Un.js";import{M as S}from"./MetricBar-BWuqiydF.js";import{u as me}from"./useFetch-6R6P2rOm.js";import{T as pe}from"./Tooltip-DzkVglKi.js";import{T as U}from"./trash-2-DXJqRCdo.js";import{A as ue}from"./arrow-left-BnN4eZhK.js";function be({isOpen:t,onClose:n,onConfirm:r,workerName:o,isDraining:i,loading:p}){const{t:c}=b();return e.jsx(T,{isOpen:t,onClose:n,onConfirm:r,title:c(i?"workers.undrain_worker_title":"workers.drain_worker_title"),message:i?c("workers.undrain_confirm",{name:o}):c("workers.drain_confirm",{name:o}),confirmLabel:c(i?"workers.undrain":"workers.drain"),confirmVariant:i?"accent":"warning",isLoading:p})}function V(t){return t==="rate_limit"?"rate limited":t}function ve(t,n){return n(t==="binary_missing"?"workers.manual_restore_required":"workers.awaiting_auto_recovery")}function Se(){var $,A;const{id:t}=se(),n=te(),{t:r}=b(),[o,i]=x.useState(!1),[p,c]=x.useState(!1),[P,w]=x.useState(!1),[z,L]=x.useState(!1),[B,j]=x.useState(!1),[Q,I]=x.useState(!1),[y,f]=x.useState(null),v=ae(a=>{var d;return(d=a.user)==null?void 0:d.role}),J=R(a=>a.workerSeq),K=R(a=>a.taskSeq),{data:u,loading:X,error:M,refetch:_}=me(async()=>{if(!t)throw new Error("Missing worker ID");const[a,d]=await Promise.all([g.get(`web/workers/${t}`).json(),g.get(`web/workers/${t}/tasks`).json().catch(()=>[])]);return{worker:a,tasks:d}},[t,J,K]),s=(u==null?void 0:u.worker)??null,C=(u==null?void 0:u.tasks)??[],O=v===N.LEAD||v===N.ADMIN;ne(x.useMemo(()=>!s||s.status===m.DECOMMISSIONED?null:e.jsxs("div",{className:"flex items-center gap-2",children:[s.status===m.ONLINE&&e.jsxs("button",{onClick:()=>i(!0),className:"rounded-[4px] border border-[var(--warning)]/40 px-3 py-1.5 text-xs text-[var(--warning)] hover:bg-[var(--warning)]/10 transition-colors",children:["> ",r("workers.drain")]}),v===N.ADMIN&&e.jsxs("button",{onClick:()=>w(!0),className:"flex items-center gap-1 rounded-[4px] border border-[var(--destructive)]/40 px-3 py-1.5 text-xs text-[var(--destructive)] hover:bg-[var(--destructive)]/10 transition-colors",children:[e.jsx(U,{className:"h-3 w-3"}),r("workers.decommission")]})]}),[s,v,r]));async function Y(){if(s){c(!0);try{const a=s.status===m.DRAINING?"undrain":"drain";await g.post(`web/workers/${s.id}/${a}`),await _()}catch{}finally{c(!1),i(!1)}}}async function Z(){if(s){L(!0);try{await g.delete(`admin/workers/${s.id}`),n("/workers")}catch{}finally{L(!1),w(!1)}}}async function ee(){if(!(!s||!y)){I(!0);try{await g.post(`web/workers/${s.id}/capabilities/${encodeURIComponent(y)}/restore`),await _()}catch{}finally{I(!1),j(!1),f(null)}}}if(X)return e.jsx("div",{className:"mx-auto max-w-5xl px-4 md:px-6 py-8 font-mono",children:e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:r("workers.loading_worker")})});if(M)return e.jsxs("div",{className:"mx-auto max-w-5xl px-4 md:px-6 py-8 font-mono lowercase text-center",children:[e.jsx("p",{className:"text-sm text-[var(--destructive)]",children:M}),e.jsx("button",{onClick:()=>_(),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:r("common.retry")})]});if(!s)return e.jsxs("div",{className:"mx-auto max-w-5xl px-4 md:px-6 py-8 font-mono lowercase text-center",children:[e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:r("workers.worker_not_found")}),e.jsxs("button",{onClick:()=>n("/workers"),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:["< ",r("workers.back_to_workers")]})]});const k=s.status===m.DRAINING,h=s.status!==m.DECOMMISSIONED;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mx-auto max-w-5xl font-mono lowercase",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] bg-[var(--bg-primary)] px-4 shrink-0 md:hidden",style:{height:56},children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("button",{onClick:()=>n("/workers"),className:"shrink-0 text-[var(--text-muted)]",children:e.jsx(ue,{className:"h-4 w-4"})}),e.jsx("span",{className:"truncate text-sm font-medium text-[var(--text-primary)]",children:s.name})]}),!k&&s.status!==m.OFFLINE&&h&&e.jsxs("button",{onClick:()=>i(!0),className:"shrink-0 rounded-[4px] border border-[var(--warning)]/40 px-3 py-1.5 text-xs text-[var(--warning)] hover:bg-[var(--warning)]/10 transition-colors",children:["> ",r("workers.drain")]})]}),e.jsxs("div",{className:"px-4 md:px-6 py-8",children:[k?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx(oe,{to:"/workers",className:"text-[var(--text-muted)] hover:text-[var(--text-secondary)] transition-colors",children:r("workers.title")}),e.jsx("span",{className:"text-[var(--text-muted)]",children:"/"}),e.jsx("span",{className:"text-[var(--text-secondary)]",children:s.name})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[h&&e.jsxs("button",{onClick:()=>i(!0),className:"rounded-[4px] border border-[var(--accent)] px-4 py-1.5 text-xs text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors",children:["> ",r("workers.undrain")]}),v===N.ADMIN&&h&&e.jsxs("button",{onClick:()=>w(!0),className:"flex items-center gap-1 rounded-[4px] border border-[var(--destructive)]/40 px-3 py-1.5 text-xs text-[var(--destructive)] hover:bg-[var(--destructive)]/10 transition-colors",children:[e.jsx(U,{className:"h-3 w-3"}),r("workers.decommission")]})]})]}),e.jsx("div",{className:"mb-4",children:e.jsx("span",{className:"rounded-[4px] bg-[var(--warning)]/20 px-2.5 py-1 text-xs font-medium text-[var(--warning)]",children:r("workers.draining")})}),e.jsxs("div",{className:"mb-6 rounded-[4px] border border-[var(--warning)]/40 bg-[var(--warning)]/10 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(F,{className:"h-3.5 w-3.5 text-[var(--warning)]"}),e.jsx("span",{className:"text-xs text-[var(--warning)]",children:r("workers.draining_warning")})]}),e.jsx("p",{className:"text-xs text-[var(--warning)]/70 ml-5.5",children:r("workers.draining_active_tasks")})]}),e.jsxs("div",{className:"mb-6 grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsx(D,{label:r("workers.cpu"),value:s.cpuUsage,unit:"%"}),e.jsx(D,{label:r("workers.memory"),value:s.memoryUsage,unit:"%"}),e.jsx(D,{label:r("workers.disk"),value:s.diskUsage,unit:"%"}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("workers.slots")}),e.jsxs("p",{className:"mt-2 text-lg font-semibold text-[var(--text-primary)]",children:[s.activeSlots,"/",s.maxSlots]})]})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>n("/workers"),className:"mb-4 text-xs text-[var(--text-muted)] hover:text-[var(--text-secondary)] transition-colors",children:["< ",r("workers.back_to_workers")]}),e.jsxs("h1",{className:"mb-2 text-lg font-bold text-[var(--text-primary)] flex items-center gap-2",children:[s.name,e.jsxs("span",{className:"flex items-center gap-1.5 text-sm font-normal",style:{color:ce[s.status]},children:[e.jsx("span",{style:{fontSize:"0.5rem"},children:"●"}),s.status.toLowerCase()]})]}),e.jsx("p",{className:"mb-6 text-xs text-[var(--text-muted)]",children:r("workers.last_heartbeat",{time:le(s.lastHeartbeat,"never")})}),s.status===m.DECOMMISSIONED&&e.jsx("div",{className:"mb-6 rounded-[4px] border border-[var(--text-muted)]/40 bg-[var(--text-muted)]/10 p-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{className:"h-3.5 w-3.5 text-[var(--text-muted)]"}),e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["this worker has been decommissioned",s.decommissionedAt?` on ${H(s.decommissionedAt)}`:""," and can no longer accept tasks."]})]})}),e.jsxs("div",{className:"mb-6 grid gap-4 lg:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("h2",{className:"mb-3 text-xs text-[var(--text-muted)]",children:r("workers.resource_usage")}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(S,{label:r("workers.cpu"),value:s.cpuUsage}),e.jsx(S,{label:r("workers.mem"),value:s.memoryUsage}),e.jsx(S,{label:r("workers.disk"),value:s.diskUsage})]})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("h2",{className:"mb-3 text-xs text-[var(--text-muted)]",children:r("workers.connection_info")}),e.jsx(q,{worker:s})]})]})]}),k?e.jsxs(e.Fragment,{children:[e.jsx(G,{title:r("workers.active_tasks"),tasks:C,navigate:n}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"mb-4 text-sm font-medium text-[var(--accent)]",children:r("workers.capabilities")}),s.capabilities.length>0?e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:s.capabilities.map(a=>e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsx("p",{className:"text-xs text-[var(--text-primary)]",children:a})},a))}):e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("workers.no_capabilities_short")}),((($=s.degradedCapabilities)==null?void 0:$.length)??0)>0&&e.jsx("div",{className:"mt-3 space-y-2",children:s.degradedCapabilities.map(a=>e.jsx(W,{agentType:a.agentType,failureType:a.failureType,failureCount:a.failureCount,showRestore:O&&h,onRestore:()=>{f(a.agentType),j(!0)}},a.agentType))})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"mb-4 text-sm font-medium text-[var(--accent)]",children:r("workers.worker_info")}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:e.jsx(q,{worker:s,showExtended:!0})})]})]}):e.jsxs(e.Fragment,{children:[s.capabilities.length>0&&e.jsxs("div",{className:"mb-6 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("h2",{className:"mb-3 text-xs text-[var(--text-muted)]",children:r("workers.capabilities")}),e.jsx("div",{className:"flex flex-wrap gap-2",children:s.capabilities.map(a=>{var E;const d=(E=s.degradedCapabilities)==null?void 0:E.find(re=>re.agentType===a);return e.jsxs("span",{className:`rounded-[4px] border px-2.5 py-1 text-xs ${d?"border-[var(--warning)] text-[var(--warning)] bg-[var(--warning)]/5":"border-[var(--border)] text-[var(--text-secondary)]"}`,children:[a,d&&e.jsx("span",{className:"ml-1.5 text-[10px]",children:V(d.failureType)})]},a)})}),(((A=s.degradedCapabilities)==null?void 0:A.length)??0)>0&&e.jsx("div",{className:"mt-3 space-y-2",children:s.degradedCapabilities.map(a=>e.jsx(W,{agentType:a.agentType,failureType:a.failureType,failureCount:a.failureCount,showRestore:O&&h,onRestore:()=>{f(a.agentType),j(!0)}},a.agentType))})]}),e.jsx(G,{title:`${r("workers.current_tasks")} (${C.length})`,tasks:C,navigate:n})]})]})]}),e.jsx(be,{isOpen:o,onClose:()=>i(!1),onConfirm:Y,workerName:s.name,isDraining:k,loading:p}),e.jsx(T,{isOpen:P,onClose:()=>w(!1),onConfirm:Z,title:r("workers.decommission_title"),message:r("workers.decommission_confirm",{name:s.name}),confirmLabel:r("workers.decommission"),confirmVariant:"danger",isLoading:z}),e.jsx(T,{isOpen:B,onClose:()=>{j(!1),f(null)},onConfirm:ee,title:r("workers.restore_capability_title"),message:r("workers.restore_capability_confirm",{capability:y??r("workers.unknown"),name:s.name}),confirmLabel:r("workers.restore_capability"),confirmVariant:"accent",isLoading:Q})]})}function W({agentType:t,failureType:n,failureCount:r,showRestore:o,onRestore:i}){const{t:p}=b();return e.jsx("div",{className:"rounded-[4px] border border-[var(--warning)] bg-[var(--warning)]/5 p-3 text-sm",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"font-medium",children:t}),e.jsxs("span",{className:"text-[var(--text-muted)] ml-2 text-xs",children:[V(n)," · ",r," consecutive failure",r!==1?"s":""," · ",ve(n,p)]})]}),o&&e.jsx("button",{type:"button",onClick:i,className:"shrink-0 rounded-[4px] border border-[var(--accent)]/40 px-2.5 py-1 text-xs text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors",children:p("workers.restore_capability")})]})})}function q({worker:t,showExtended:n=!1}){const{t:r}=b();return e.jsxs("div",{className:"flex flex-col gap-2 text-xs",children:[e.jsx(l,{label:r("workers.worker_id"),value:t.id}),e.jsx(l,{label:r("workers.host"),value:t.host}),e.jsx(l,{label:r("workers.os"),value:t.os??r("workers.unknown")}),e.jsx(l,{label:r("workers.cpu_model"),value:t.cpuModel??r("workers.n_a")}),e.jsx(l,{label:r("workers.cpu_cores"),value:t.cpuCores!=null?String(t.cpuCores):r("workers.n_a")}),e.jsx(l,{label:r("workers.memory"),value:t.memoryGb!=null?`${t.memoryGb} gb`:r("workers.n_a")}),e.jsx(l,{label:r("workers.last_heartbeat_label"),value:H(t.lastHeartbeat)}),e.jsx(l,{label:r("workers.slots"),value:`${t.activeSlots}/${t.maxSlots}`}),n&&e.jsxs(e.Fragment,{children:[e.jsx(l,{label:r("workers.status_label"),value:t.status.toLowerCase()}),e.jsx(l,{label:r("workers.worker_version"),value:t.workerVersion??r("workers.n_a")})]})]})}function G({title:t,tasks:n,navigate:r}){const{t:o}=b();return e.jsxs("div",{className:"mb-6 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("h2",{className:"mb-3 text-xs text-[var(--text-muted)]",children:t}),n.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-6",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:o("workers.no_active_tasks")})]}):e.jsx(he,{tasks:n,navigate:r})]})}function he({tasks:t,navigate:n}){const{t:r}=b();return e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border-row)]",children:[e.jsx("th",{className:"py-2 pr-4 text-left font-normal text-[var(--text-muted)]",children:r("workers.id")}),e.jsx("th",{className:"py-2 pr-4 text-left font-normal text-[var(--text-muted)]",children:r("workers.description")}),e.jsx("th",{className:"py-2 pr-4 text-left font-normal text-[var(--text-muted)]",children:r("workers.status_label")}),e.jsx("th",{className:"py-2 text-left font-normal text-[var(--text-muted)]",children:r("workers.stage")})]})}),e.jsx("tbody",{children:t.map(o=>e.jsxs("tr",{onClick:()=>n(`/tasks/${o.id}`),className:"cursor-pointer border-b border-[var(--border-row)] hover:bg-[var(--bg-input)] transition-colors",children:[e.jsxs("td",{className:"py-2 pr-4 text-[var(--text-primary)]",children:["#",o.id]}),e.jsx("td",{className:"max-w-[120px] md:max-w-xs truncate py-2 pr-4 text-[var(--text-secondary)]",children:e.jsx(pe,{content:o.description,children:ie(o)})}),e.jsx("td",{className:"py-2 pr-4",children:e.jsxs("span",{style:{color:xe[o.status]},children:["● ",o.status.toLowerCase()]})}),e.jsx("td",{className:"py-2 text-[var(--text-secondary)]",children:o.currentStage??"-"})]},o.id))})]})})}function D({label:t,value:n,unit:r}){const o=Math.round(n*100);return e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:t}),e.jsxs("p",{className:"mt-2 text-lg font-semibold text-[var(--text-primary)]",children:[o,r]}),e.jsx("div",{className:"mt-3 h-1.5 w-full rounded-[2px] bg-[var(--bg-input)]",children:e.jsx("div",{className:"h-full rounded-[2px] transition-all",style:{width:`${o}%`,backgroundColor:de(n)}})})]})}export{Se as default};
1
+ import{a as b,j as e,s as T,A as se,f as te,r as x,u as ae,k as R,w as ne,W as m,D as N,L as oe,Q as F,h as g,l as ie}from"./index-Cfz24FvS.js";import{t as le,c as H}from"./date-CmcdoD87.js";import{w as ce,b as de,t as xe}from"./status-colors-qoQt_0Rr.js";import{I as l}from"./InfoRow-DINJ_QV-.js";import{M as S}from"./MetricBar-CbCODU4f.js";import{u as me}from"./useFetch-BhpPrPjt.js";import{T as pe}from"./Tooltip-iHcbiLoR.js";import{T as U}from"./trash-2-BLnVFw_Z.js";import{A as ue}from"./arrow-left-CrZE68gW.js";function be({isOpen:t,onClose:n,onConfirm:r,workerName:o,isDraining:i,loading:p}){const{t:c}=b();return e.jsx(T,{isOpen:t,onClose:n,onConfirm:r,title:c(i?"workers.undrain_worker_title":"workers.drain_worker_title"),message:i?c("workers.undrain_confirm",{name:o}):c("workers.drain_confirm",{name:o}),confirmLabel:c(i?"workers.undrain":"workers.drain"),confirmVariant:i?"accent":"warning",isLoading:p})}function V(t){return t==="rate_limit"?"rate limited":t}function ve(t,n){return n(t==="binary_missing"?"workers.manual_restore_required":"workers.awaiting_auto_recovery")}function Se(){var $,A;const{id:t}=se(),n=te(),{t:r}=b(),[o,i]=x.useState(!1),[p,c]=x.useState(!1),[P,w]=x.useState(!1),[z,L]=x.useState(!1),[B,j]=x.useState(!1),[Q,I]=x.useState(!1),[y,f]=x.useState(null),v=ae(a=>{var d;return(d=a.user)==null?void 0:d.role}),J=R(a=>a.workerSeq),K=R(a=>a.taskSeq),{data:u,loading:X,error:M,refetch:_}=me(async()=>{if(!t)throw new Error("Missing worker ID");const[a,d]=await Promise.all([g.get(`web/workers/${t}`).json(),g.get(`web/workers/${t}/tasks`).json().catch(()=>[])]);return{worker:a,tasks:d}},[t,J,K]),s=(u==null?void 0:u.worker)??null,C=(u==null?void 0:u.tasks)??[],O=v===N.LEAD||v===N.ADMIN;ne(x.useMemo(()=>!s||s.status===m.DECOMMISSIONED?null:e.jsxs("div",{className:"flex items-center gap-2",children:[s.status===m.ONLINE&&e.jsxs("button",{onClick:()=>i(!0),className:"rounded-[4px] border border-[var(--warning)]/40 px-3 py-1.5 text-xs text-[var(--warning)] hover:bg-[var(--warning)]/10 transition-colors",children:["> ",r("workers.drain")]}),v===N.ADMIN&&e.jsxs("button",{onClick:()=>w(!0),className:"flex items-center gap-1 rounded-[4px] border border-[var(--destructive)]/40 px-3 py-1.5 text-xs text-[var(--destructive)] hover:bg-[var(--destructive)]/10 transition-colors",children:[e.jsx(U,{className:"h-3 w-3"}),r("workers.decommission")]})]}),[s,v,r]));async function Y(){if(s){c(!0);try{const a=s.status===m.DRAINING?"undrain":"drain";await g.post(`web/workers/${s.id}/${a}`),await _()}catch{}finally{c(!1),i(!1)}}}async function Z(){if(s){L(!0);try{await g.delete(`admin/workers/${s.id}`),n("/workers")}catch{}finally{L(!1),w(!1)}}}async function ee(){if(!(!s||!y)){I(!0);try{await g.post(`web/workers/${s.id}/capabilities/${encodeURIComponent(y)}/restore`),await _()}catch{}finally{I(!1),j(!1),f(null)}}}if(X)return e.jsx("div",{className:"mx-auto max-w-5xl px-4 md:px-6 py-8 font-mono",children:e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:r("workers.loading_worker")})});if(M)return e.jsxs("div",{className:"mx-auto max-w-5xl px-4 md:px-6 py-8 font-mono lowercase text-center",children:[e.jsx("p",{className:"text-sm text-[var(--destructive)]",children:M}),e.jsx("button",{onClick:()=>_(),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:r("common.retry")})]});if(!s)return e.jsxs("div",{className:"mx-auto max-w-5xl px-4 md:px-6 py-8 font-mono lowercase text-center",children:[e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:r("workers.worker_not_found")}),e.jsxs("button",{onClick:()=>n("/workers"),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:["< ",r("workers.back_to_workers")]})]});const k=s.status===m.DRAINING,h=s.status!==m.DECOMMISSIONED;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mx-auto max-w-5xl font-mono lowercase",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] bg-[var(--bg-primary)] px-4 shrink-0 md:hidden",style:{height:56},children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("button",{onClick:()=>n("/workers"),className:"shrink-0 text-[var(--text-muted)]",children:e.jsx(ue,{className:"h-4 w-4"})}),e.jsx("span",{className:"truncate text-sm font-medium text-[var(--text-primary)]",children:s.name})]}),!k&&s.status!==m.OFFLINE&&h&&e.jsxs("button",{onClick:()=>i(!0),className:"shrink-0 rounded-[4px] border border-[var(--warning)]/40 px-3 py-1.5 text-xs text-[var(--warning)] hover:bg-[var(--warning)]/10 transition-colors",children:["> ",r("workers.drain")]})]}),e.jsxs("div",{className:"px-4 md:px-6 py-8",children:[k?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx(oe,{to:"/workers",className:"text-[var(--text-muted)] hover:text-[var(--text-secondary)] transition-colors",children:r("workers.title")}),e.jsx("span",{className:"text-[var(--text-muted)]",children:"/"}),e.jsx("span",{className:"text-[var(--text-secondary)]",children:s.name})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[h&&e.jsxs("button",{onClick:()=>i(!0),className:"rounded-[4px] border border-[var(--accent)] px-4 py-1.5 text-xs text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors",children:["> ",r("workers.undrain")]}),v===N.ADMIN&&h&&e.jsxs("button",{onClick:()=>w(!0),className:"flex items-center gap-1 rounded-[4px] border border-[var(--destructive)]/40 px-3 py-1.5 text-xs text-[var(--destructive)] hover:bg-[var(--destructive)]/10 transition-colors",children:[e.jsx(U,{className:"h-3 w-3"}),r("workers.decommission")]})]})]}),e.jsx("div",{className:"mb-4",children:e.jsx("span",{className:"rounded-[4px] bg-[var(--warning)]/20 px-2.5 py-1 text-xs font-medium text-[var(--warning)]",children:r("workers.draining")})}),e.jsxs("div",{className:"mb-6 rounded-[4px] border border-[var(--warning)]/40 bg-[var(--warning)]/10 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(F,{className:"h-3.5 w-3.5 text-[var(--warning)]"}),e.jsx("span",{className:"text-xs text-[var(--warning)]",children:r("workers.draining_warning")})]}),e.jsx("p",{className:"text-xs text-[var(--warning)]/70 ml-5.5",children:r("workers.draining_active_tasks")})]}),e.jsxs("div",{className:"mb-6 grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsx(D,{label:r("workers.cpu"),value:s.cpuUsage,unit:"%"}),e.jsx(D,{label:r("workers.memory"),value:s.memoryUsage,unit:"%"}),e.jsx(D,{label:r("workers.disk"),value:s.diskUsage,unit:"%"}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("workers.slots")}),e.jsxs("p",{className:"mt-2 text-lg font-semibold text-[var(--text-primary)]",children:[s.activeSlots,"/",s.maxSlots]})]})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>n("/workers"),className:"mb-4 text-xs text-[var(--text-muted)] hover:text-[var(--text-secondary)] transition-colors",children:["< ",r("workers.back_to_workers")]}),e.jsxs("h1",{className:"mb-2 text-lg font-bold text-[var(--text-primary)] flex items-center gap-2",children:[s.name,e.jsxs("span",{className:"flex items-center gap-1.5 text-sm font-normal",style:{color:ce[s.status]},children:[e.jsx("span",{style:{fontSize:"0.5rem"},children:"●"}),s.status.toLowerCase()]})]}),e.jsx("p",{className:"mb-6 text-xs text-[var(--text-muted)]",children:r("workers.last_heartbeat",{time:le(s.lastHeartbeat,"never")})}),s.status===m.DECOMMISSIONED&&e.jsx("div",{className:"mb-6 rounded-[4px] border border-[var(--text-muted)]/40 bg-[var(--text-muted)]/10 p-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{className:"h-3.5 w-3.5 text-[var(--text-muted)]"}),e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["this worker has been decommissioned",s.decommissionedAt?` on ${H(s.decommissionedAt)}`:""," and can no longer accept tasks."]})]})}),e.jsxs("div",{className:"mb-6 grid gap-4 lg:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("h2",{className:"mb-3 text-xs text-[var(--text-muted)]",children:r("workers.resource_usage")}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(S,{label:r("workers.cpu"),value:s.cpuUsage}),e.jsx(S,{label:r("workers.mem"),value:s.memoryUsage}),e.jsx(S,{label:r("workers.disk"),value:s.diskUsage})]})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("h2",{className:"mb-3 text-xs text-[var(--text-muted)]",children:r("workers.connection_info")}),e.jsx(q,{worker:s})]})]})]}),k?e.jsxs(e.Fragment,{children:[e.jsx(G,{title:r("workers.active_tasks"),tasks:C,navigate:n}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"mb-4 text-sm font-medium text-[var(--accent)]",children:r("workers.capabilities")}),s.capabilities.length>0?e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:s.capabilities.map(a=>e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsx("p",{className:"text-xs text-[var(--text-primary)]",children:a})},a))}):e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("workers.no_capabilities_short")}),((($=s.degradedCapabilities)==null?void 0:$.length)??0)>0&&e.jsx("div",{className:"mt-3 space-y-2",children:s.degradedCapabilities.map(a=>e.jsx(W,{agentType:a.agentType,failureType:a.failureType,failureCount:a.failureCount,showRestore:O&&h,onRestore:()=>{f(a.agentType),j(!0)}},a.agentType))})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"mb-4 text-sm font-medium text-[var(--accent)]",children:r("workers.worker_info")}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:e.jsx(q,{worker:s,showExtended:!0})})]})]}):e.jsxs(e.Fragment,{children:[s.capabilities.length>0&&e.jsxs("div",{className:"mb-6 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("h2",{className:"mb-3 text-xs text-[var(--text-muted)]",children:r("workers.capabilities")}),e.jsx("div",{className:"flex flex-wrap gap-2",children:s.capabilities.map(a=>{var E;const d=(E=s.degradedCapabilities)==null?void 0:E.find(re=>re.agentType===a);return e.jsxs("span",{className:`rounded-[4px] border px-2.5 py-1 text-xs ${d?"border-[var(--warning)] text-[var(--warning)] bg-[var(--warning)]/5":"border-[var(--border)] text-[var(--text-secondary)]"}`,children:[a,d&&e.jsx("span",{className:"ml-1.5 text-[10px]",children:V(d.failureType)})]},a)})}),(((A=s.degradedCapabilities)==null?void 0:A.length)??0)>0&&e.jsx("div",{className:"mt-3 space-y-2",children:s.degradedCapabilities.map(a=>e.jsx(W,{agentType:a.agentType,failureType:a.failureType,failureCount:a.failureCount,showRestore:O&&h,onRestore:()=>{f(a.agentType),j(!0)}},a.agentType))})]}),e.jsx(G,{title:`${r("workers.current_tasks")} (${C.length})`,tasks:C,navigate:n})]})]})]}),e.jsx(be,{isOpen:o,onClose:()=>i(!1),onConfirm:Y,workerName:s.name,isDraining:k,loading:p}),e.jsx(T,{isOpen:P,onClose:()=>w(!1),onConfirm:Z,title:r("workers.decommission_title"),message:r("workers.decommission_confirm",{name:s.name}),confirmLabel:r("workers.decommission"),confirmVariant:"danger",isLoading:z}),e.jsx(T,{isOpen:B,onClose:()=>{j(!1),f(null)},onConfirm:ee,title:r("workers.restore_capability_title"),message:r("workers.restore_capability_confirm",{capability:y??r("workers.unknown"),name:s.name}),confirmLabel:r("workers.restore_capability"),confirmVariant:"accent",isLoading:Q})]})}function W({agentType:t,failureType:n,failureCount:r,showRestore:o,onRestore:i}){const{t:p}=b();return e.jsx("div",{className:"rounded-[4px] border border-[var(--warning)] bg-[var(--warning)]/5 p-3 text-sm",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"font-medium",children:t}),e.jsxs("span",{className:"text-[var(--text-muted)] ml-2 text-xs",children:[V(n)," · ",r," consecutive failure",r!==1?"s":""," · ",ve(n,p)]})]}),o&&e.jsx("button",{type:"button",onClick:i,className:"shrink-0 rounded-[4px] border border-[var(--accent)]/40 px-2.5 py-1 text-xs text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors",children:p("workers.restore_capability")})]})})}function q({worker:t,showExtended:n=!1}){const{t:r}=b();return e.jsxs("div",{className:"flex flex-col gap-2 text-xs",children:[e.jsx(l,{label:r("workers.worker_id"),value:t.id}),e.jsx(l,{label:r("workers.host"),value:t.host}),e.jsx(l,{label:r("workers.os"),value:t.os??r("workers.unknown")}),e.jsx(l,{label:r("workers.cpu_model"),value:t.cpuModel??r("workers.n_a")}),e.jsx(l,{label:r("workers.cpu_cores"),value:t.cpuCores!=null?String(t.cpuCores):r("workers.n_a")}),e.jsx(l,{label:r("workers.memory"),value:t.memoryGb!=null?`${t.memoryGb} gb`:r("workers.n_a")}),e.jsx(l,{label:r("workers.last_heartbeat_label"),value:H(t.lastHeartbeat)}),e.jsx(l,{label:r("workers.slots"),value:`${t.activeSlots}/${t.maxSlots}`}),n&&e.jsxs(e.Fragment,{children:[e.jsx(l,{label:r("workers.status_label"),value:t.status.toLowerCase()}),e.jsx(l,{label:r("workers.worker_version"),value:t.workerVersion??r("workers.n_a")})]})]})}function G({title:t,tasks:n,navigate:r}){const{t:o}=b();return e.jsxs("div",{className:"mb-6 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("h2",{className:"mb-3 text-xs text-[var(--text-muted)]",children:t}),n.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-6",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:o("workers.no_active_tasks")})]}):e.jsx(he,{tasks:n,navigate:r})]})}function he({tasks:t,navigate:n}){const{t:r}=b();return e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border-row)]",children:[e.jsx("th",{className:"py-2 pr-4 text-left font-normal text-[var(--text-muted)]",children:r("workers.id")}),e.jsx("th",{className:"py-2 pr-4 text-left font-normal text-[var(--text-muted)]",children:r("workers.description")}),e.jsx("th",{className:"py-2 pr-4 text-left font-normal text-[var(--text-muted)]",children:r("workers.status_label")}),e.jsx("th",{className:"py-2 text-left font-normal text-[var(--text-muted)]",children:r("workers.stage")})]})}),e.jsx("tbody",{children:t.map(o=>e.jsxs("tr",{onClick:()=>n(`/tasks/${o.id}`),className:"cursor-pointer border-b border-[var(--border-row)] hover:bg-[var(--bg-input)] transition-colors",children:[e.jsxs("td",{className:"py-2 pr-4 text-[var(--text-primary)]",children:["#",o.id]}),e.jsx("td",{className:"max-w-[120px] md:max-w-xs truncate py-2 pr-4 text-[var(--text-secondary)]",children:e.jsx(pe,{content:o.description,children:ie(o)})}),e.jsx("td",{className:"py-2 pr-4",children:e.jsxs("span",{style:{color:xe[o.status]},children:["● ",o.status.toLowerCase()]})}),e.jsx("td",{className:"py-2 text-[var(--text-secondary)]",children:o.currentStage??"-"})]},o.id))})]})})}function D({label:t,value:n,unit:r}){const o=Math.round(n*100);return e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:t}),e.jsxs("p",{className:"mt-2 text-lg font-semibold text-[var(--text-primary)]",children:[o,r]}),e.jsx("div",{className:"mt-3 h-1.5 w-full rounded-[2px] bg-[var(--bg-input)]",children:e.jsx("div",{className:"h-full rounded-[2px] transition-all",style:{width:`${o}%`,backgroundColor:de(n)}})})]})}export{Se as default};
@@ -1,4 +1,4 @@
1
- import{c as G,R as U,a as C,j as e,v as q,r as o,h as S,X as K,I as H,f as V,u as X,k as J,W as N,w as Q,D as Y,S as M}from"./index-PZwTchr_.js";import{w as W}from"./status-colors-DDycfcf7.js";import{M as _}from"./MetricBar-BWuqiydF.js";import Z from"./WorkerSetupGuidePage-DvaP5u6N.js";import{C as A}from"./copy-Dtpgo9EK.js";import{L as ee}from"./loader-circle-nKG9e8iK.js";import{S as te}from"./Select-CaAVBHmI.js";import{E as re}from"./EmptyState-BfgwLg0u.js";import{C as se}from"./Skeleton-CNV0Dyd8.js";import{u as ae}from"./useFetch-6R6P2rOm.js";import{P as oe}from"./plus-CCF-PMRF.js";import{A as ne}from"./arrow-left-BnN4eZhK.js";import"./key-BDx4jfUG.js";import"./download-DVCPTZuD.js";import"./settings-CYtYYzCu.js";import"./play-DFj8BMl8.js";import"./wifi-Bgq95lS8.js";import"./chevron-down-DyqUpmgf.js";/**
1
+ import{c as G,R as U,a as C,j as e,v as q,r as o,h as S,X as K,I as H,f as V,u as X,k as J,W as N,w as Q,D as Y,S as M}from"./index-Cfz24FvS.js";import{w as W}from"./status-colors-qoQt_0Rr.js";import{M as _}from"./MetricBar-CbCODU4f.js";import Z from"./WorkerSetupGuidePage-LZUkE-e5.js";import{C as A}from"./copy-Bl6iow2q.js";import{L as ee}from"./loader-circle-DNtX1Uwk.js";import{S as te}from"./Select-BT88kXEc.js";import{E as re}from"./EmptyState-Cc73hU7f.js";import{C as se}from"./Skeleton-BS77WEat.js";import{u as ae}from"./useFetch-BhpPrPjt.js";import{P as oe}from"./plus-1F0b5FBe.js";import{A as ne}from"./arrow-left-CrZE68gW.js";import"./key-Dxqw3xyk.js";import"./download-n0G7Q5jK.js";import"./settings-tfOPOdvu.js";import"./play-FY1PInKQ.js";import"./wifi-jQAtmf0f.js";import"./chevron-down-y6iszDL7.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.