@overlordai/server 1.0.136 → 1.0.138

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 (143) hide show
  1. package/database/migrations/001-init-schema.sql +47 -6
  2. package/database/migrations/009-chat-bindings-multi-project.sql +100 -0
  3. package/dist/adapters/chat-binding.utils.d.ts +20 -0
  4. package/dist/adapters/chat-binding.utils.d.ts.map +1 -0
  5. package/dist/adapters/chat-binding.utils.js +44 -0
  6. package/dist/adapters/chat-binding.utils.js.map +1 -0
  7. package/dist/adapters/command-parser.utils.d.ts +4 -2
  8. package/dist/adapters/command-parser.utils.d.ts.map +1 -1
  9. package/dist/adapters/command-parser.utils.js +46 -7
  10. package/dist/adapters/command-parser.utils.js.map +1 -1
  11. package/dist/adapters/help-text.js +1 -1
  12. package/dist/adapters/help-text.js.map +1 -1
  13. package/dist/adapters/lark/lark.adapter.d.ts.map +1 -1
  14. package/dist/adapters/lark/lark.adapter.js +21 -9
  15. package/dist/adapters/lark/lark.adapter.js.map +1 -1
  16. package/dist/adapters/slack/slack.adapter.d.ts.map +1 -1
  17. package/dist/adapters/slack/slack.adapter.js +41 -13
  18. package/dist/adapters/slack/slack.adapter.js.map +1 -1
  19. package/dist/adapters/slack/slack.controller.d.ts.map +1 -1
  20. package/dist/adapters/slack/slack.controller.js +7 -0
  21. package/dist/adapters/slack/slack.controller.js.map +1 -1
  22. package/dist/common/config.js +1 -1
  23. package/dist/database/repositories/bot.repository.d.ts +9 -3
  24. package/dist/database/repositories/bot.repository.d.ts.map +1 -1
  25. package/dist/database/repositories/bot.repository.js +110 -20
  26. package/dist/database/repositories/bot.repository.js.map +1 -1
  27. package/dist/dispatcher/dispatcher.service.d.ts.map +1 -1
  28. package/dist/dispatcher/dispatcher.service.js +15 -3
  29. package/dist/dispatcher/dispatcher.service.js.map +1 -1
  30. package/dist/dispatcher/scheduler.service.d.ts.map +1 -1
  31. package/dist/dispatcher/scheduler.service.js.map +1 -1
  32. package/dist/dispatcher/task-creation.service.d.ts +4 -1
  33. package/dist/dispatcher/task-creation.service.d.ts.map +1 -1
  34. package/dist/dispatcher/task-creation.service.js +19 -4
  35. package/dist/dispatcher/task-creation.service.js.map +1 -1
  36. package/dist/web/admin/admin-bot.controller.d.ts +9 -2
  37. package/dist/web/admin/admin-bot.controller.d.ts.map +1 -1
  38. package/dist/web/admin/admin-bot.controller.js +80 -10
  39. package/dist/web/admin/admin-bot.controller.js.map +1 -1
  40. package/dist/web/task.controller.d.ts +12 -5
  41. package/dist/web/task.controller.d.ts.map +1 -1
  42. package/dist/web/task.controller.js +17 -1
  43. package/dist/web/task.controller.js.map +1 -1
  44. package/package.json +4 -4
  45. package/public/assets/{AccessTokensPage-DR-poRS4.js → AccessTokensPage-BhddWVW1.js} +1 -1
  46. package/public/assets/{AdminPage-BBswldyj.js → AdminPage-pfvAHWMr.js} +1 -1
  47. package/public/assets/AgentCliPage-C345jDjj.js +3 -0
  48. package/public/assets/ApiReferencePage-DHLXt2i6.js +1 -0
  49. package/public/assets/{ArchitecturePage-Ce0QnFXC.js → ArchitecturePage-C6I9_3Gs.js} +2 -2
  50. package/public/assets/{AuditLogPage-w_7Nj4Rv.js → AuditLogPage-CdIyX0zS.js} +1 -1
  51. package/public/assets/{BindPlatformPage-CaN-9QLb.js → BindPlatformPage-KFs9i2uA.js} +1 -1
  52. package/public/assets/{BotIntegrationPage-SVH7cMHP.js → BotIntegrationPage-DCFZPk-7.js} +1 -1
  53. package/public/assets/BotManage-XcDpO3JL.js +6 -0
  54. package/public/assets/{BotSetupPage-DoLW98NA.js → BotSetupPage-VWtZWkVa.js} +1 -1
  55. package/public/assets/{ChangelogPage-DuEv-8dO.js → ChangelogPage-BbOP-JLv.js} +1 -1
  56. package/public/assets/CliReferencePage-DtYHgbSY.js +16 -0
  57. package/public/assets/{DeploymentPage-5MdRHTAa.js → DeploymentPage-BtlkcDYB.js} +1 -1
  58. package/public/assets/{DevWorkflowPage-O7m2Y5RK.js → DevWorkflowPage-CxXMRR-3.js} +3 -2
  59. package/public/assets/{DeveloperManage-DvAPUGuF.js → DeveloperManage-BcBr_3L_.js} +1 -1
  60. package/public/assets/DeveloperSetupPage-DZ4yMaW5.js +4 -0
  61. package/public/assets/{DocsIndexPage-BQ1p1z73.js → DocsIndexPage-BLlkapm4.js} +1 -1
  62. package/public/assets/DocsLayout-MaagZ0kw.js +1 -0
  63. package/public/assets/{DocsPrimitives-C-MCNelj.js → DocsPrimitives-OHFIHBcn.js} +1 -1
  64. package/public/assets/{EditProjectPage-DtBVrVqX.js → EditProjectPage-C3QK8nE_.js} +2 -2
  65. package/public/assets/{EmptyState-BwOJcw-7.js → EmptyState-C3ql5j5L.js} +1 -1
  66. package/public/assets/{EnvVariablesPage-BO3O-emk.js → EnvVariablesPage-DckuYIoH.js} +1 -1
  67. package/public/assets/{HomePage-DGlnGz9w.js → HomePage-zewuW5E4.js} +1 -1
  68. package/public/assets/{InfoRow-CArRH_uK.js → InfoRow-D5t0RpaR.js} +1 -1
  69. package/public/assets/{InstallationPage-DbN30z1N.js → InstallationPage-DUCocNLA.js} +1 -1
  70. package/public/assets/{LandingPage-h4gKySBf.js → LandingPage-y9pKUede.js} +1 -1
  71. package/public/assets/{LocalDevelopmentPage-CzGh_CyA.js → LocalDevelopmentPage-CJBGPeYo.js} +11 -8
  72. package/public/assets/{LoginPage-D0xxVRbd.js → LoginPage-WGOUh3Zl.js} +1 -1
  73. package/public/assets/{MetricBar-CBh2ydOP.js → MetricBar-CWCoyjWv.js} +1 -1
  74. package/public/assets/MobileTerminalShell-6GBZ9nXN.css +32 -0
  75. package/public/assets/MobileTerminalShell-By5L8I0_.js +49 -0
  76. package/public/assets/{NotFoundPage-CTB5zYpq.js → NotFoundPage-NHnxMNCC.js} +1 -1
  77. package/public/assets/{OnboardingGuide-j6HspxdC.js → OnboardingGuide-DalnDVPS.js} +1 -1
  78. package/public/assets/{PermissionsPage-DhIPVozc.js → PermissionsPage-Dt4llTFV.js} +1 -1
  79. package/public/assets/{PipelineConfigPage-BPP3hqfX.js → PipelineConfigPage-CIojkTYx.js} +1 -1
  80. package/public/assets/{PipelineEditorPage-zNzVbcEY.js → PipelineEditorPage-BZ96tFxp.js} +2 -2
  81. package/public/assets/{ProfilePage-By17-B9R.js → ProfilePage-YrqpghqL.js} +1 -1
  82. package/public/assets/{ProjectDetailPage-D3tG00hE.js → ProjectDetailPage-CM5bfJmU.js} +3 -3
  83. package/public/assets/{ProjectListPage-yOkjg0aA.js → ProjectListPage-DC1Kc7Lb.js} +2 -2
  84. package/public/assets/{QuickAuth-Dv8THFX-.js → QuickAuth-rpWKeLO_.js} +1 -1
  85. package/public/assets/{RemoveMemberConfirmDialog-7CNTS9OT.js → RemoveMemberConfirmDialog-DZAmLAes.js} +1 -1
  86. package/public/assets/{Select-C9mH7t3y.js → Select-C-ttiP28.js} +1 -1
  87. package/public/assets/{SettingsPage-CyrpPfpE.js → SettingsPage-C7ErXyNZ.js} +1 -1
  88. package/public/assets/{Skeleton-BSwNthrI.js → Skeleton-joUgi0KR.js} +1 -1
  89. package/public/assets/{SkillPage-x3K6pR1n.js → SkillPage-C3fKU78U.js} +1 -1
  90. package/public/assets/TaskDetailPage-CoYa78-E.js +26 -0
  91. package/public/assets/{TaskListPage-ChDkGoRG.js → TaskListPage-BqyEs5a5.js} +1 -1
  92. package/public/assets/{TaskStatusBadge-bgFlcooX.js → TaskStatusBadge-DHw2HKgB.js} +1 -1
  93. package/public/assets/{TerminalHomePage-DvUjZD9t.js → TerminalHomePage-Dr6u8qQW.js} +2 -2
  94. package/public/assets/TokenManage-Cg_B-8Nh.js +1 -0
  95. package/public/assets/{Tooltip-C8VKfixS.js → Tooltip-C5YjudXm.js} +1 -1
  96. package/public/assets/{TotpSetupPage-BBiIpwY3.js → TotpSetupPage-BnxSNEq7.js} +1 -1
  97. package/public/assets/{WorkerDetailPage-Du6ZEZAb.js → WorkerDetailPage-CZPkIYBS.js} +1 -1
  98. package/public/assets/{WorkerListPage-ByqfyN10.js → WorkerListPage-D50gtKFZ.js} +1 -1
  99. package/public/assets/{WorkerOperationsPage-DeqjI2So.js → WorkerOperationsPage-C4PArGPr.js} +1 -1
  100. package/public/assets/{WorkerSetupGuidePage-BVJvCq1d.js → WorkerSetupGuidePage-r4f3o1z6.js} +1 -1
  101. package/public/assets/WorkerSetupPage-C8IoFobt.js +5 -0
  102. package/public/assets/agent-type-options-B1aNX95r.js +1 -0
  103. package/public/assets/{arrow-left-CIwOL41D.js → arrow-left-kFMv2goM.js} +1 -1
  104. package/public/assets/{arrow-right-vAeX7cF5.js → arrow-right-iDt-dafx.js} +1 -1
  105. package/public/assets/{bot-CvhMANHw.js → bot-ChxoWTEC.js} +1 -1
  106. package/public/assets/{chevron-left-C6IUM-8d.js → chevron-left-CjZsnHH6.js} +1 -1
  107. package/public/assets/{chevron-right-CtCcIQB9.js → chevron-right-bRokRq2n.js} +1 -1
  108. package/public/assets/{copy-BsSvzuvN.js → copy-DTL-jbDm.js} +1 -1
  109. package/public/assets/{download-DziGmRwM.js → download-B7XilVjT.js} +1 -1
  110. package/public/assets/{external-link-D4FpeC5t.js → external-link-CFjZxTQ5.js} +1 -1
  111. package/public/assets/{file-text-DWEXk0wE.js → file-text-oQMnmgkw.js} +1 -1
  112. package/public/assets/{git-fork-DWSuvIF4.js → git-fork-JOmnLsHO.js} +1 -1
  113. package/public/assets/index-C4BXwe2D.css +1 -0
  114. package/public/assets/{index-D_OrDcWf.js → index-DHpBdv1F.js} +26 -26
  115. package/public/assets/{key-BpF_rjM9.js → key-BBeR1F9r.js} +1 -1
  116. package/public/assets/{loader-circle-PQQXGtgi.js → loader-circle-4X_s6z-L.js} +1 -1
  117. package/public/assets/{pencil-DvVrY4a_.js → pencil-er_Z36Ro.js} +1 -1
  118. package/public/assets/{plus-DLpnTi95.js → plus-E_rJxJAi.js} +1 -1
  119. package/public/assets/{rotate-ccw-CiTf48Td.js → rotate-ccw-DKJbe7VX.js} +1 -1
  120. package/public/assets/{scroll-text-cGPnQr3M.js → scroll-text-DTD9Dg9z.js} +1 -1
  121. package/public/assets/{settings--c2rvWEY.js → settings-DaAAUDK3.js} +1 -1
  122. package/public/assets/{status-colors-CYQlZjBF.js → status-colors-DJc_fXaW.js} +1 -1
  123. package/public/assets/{task-constants-C28Dag_x.js → task-constants-CsjB14wR.js} +1 -1
  124. package/public/assets/{trash-2-B5fxIpUx.js → trash-2-DUEEg0-a.js} +1 -1
  125. package/public/assets/{useFetch-_T-wW8J0.js → useFetch-CIp8RQub.js} +1 -1
  126. package/public/assets/{users-cnF1W_5i.js → users-DyJLLqVQ.js} +1 -1
  127. package/public/assets/{wifi-DyUmH42s.js → wifi-BOM9bCKp.js} +1 -1
  128. package/public/assets/{workflow-Br0aC6fc.js → workflow-DCr-oujx.js} +1 -1
  129. package/public/index.html +2 -2
  130. package/public/sw.js +1 -1
  131. package/public/assets/AgentCliPage-BjvJPqFg.js +0 -3
  132. package/public/assets/ApiReferencePage-DGncLrQ3.js +0 -1
  133. package/public/assets/BotManage-D-lenZUf.js +0 -6
  134. package/public/assets/CliReferencePage-BY4jRKIa.js +0 -14
  135. package/public/assets/DeveloperSetupPage-ZxzN_i4I.js +0 -4
  136. package/public/assets/DocsLayout-C21J5c4W.js +0 -1
  137. package/public/assets/PtyTerminal-BCi4nF3w.js +0 -19
  138. package/public/assets/PtyTerminal-Beg8tuEN.css +0 -32
  139. package/public/assets/TaskDetailPage-C4qj7_Be.js +0 -26
  140. package/public/assets/TokenManage-BiFQC6sW.js +0 -1
  141. package/public/assets/WorkerSetupPage-D3Jpi9tJ.js +0 -5
  142. package/public/assets/agent-type-options-snmZcyAv.js +0 -1
  143. package/public/assets/index-3ccyrL7z.css +0 -1
@@ -0,0 +1,26 @@
1
+ import{c as Y,a as Z,r as l,h as j,j as e,M as kt,z as P,H as wt,t as Q,v as _e,A as _t,f as Ct,B as St,q as Tt,s as Et,k as Qe,p as L,l as Ye,m as Lt,L as Ze,X as it,n as Dt,x as It,U as $t,b as At,G as Pt,E as Rt}from"./index-DHpBdv1F.js";import{u as Ft,T as Mt,g as le}from"./task-constants-CsjB14wR.js";import{C as Ot,u as Ut,g as qt,P as et,M as Bt,H as Gt}from"./MobileTerminalShell-By5L8I0_.js";import{a as Kt,b as zt,f as J,c as Wt}from"./date-RFA7-ZGs.js";import{S as tt}from"./Select-C-ttiP28.js";import{a as xt}from"./status-colors-DJc_fXaW.js";import{a as Xt}from"./agent-type-options-B1aNX95r.js";import{T as Ht}from"./Tooltip-C5YjudXm.js";import{A as Vt}from"./arrow-left-kFMv2goM.js";import{R as ot}from"./rotate-ccw-DKJbe7VX.js";import{G as Jt}from"./git-fork-JOmnLsHO.js";import{E as Qt}from"./external-link-CFjZxTQ5.js";import{L as dt}from"./loader-circle-4X_s6z-L.js";import{F as Yt}from"./file-text-oQMnmgkw.js";import"./pencil-er_Z36Ro.js";/**
2
+ * @license lucide-react v0.469.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const Zt=Y("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
7
+ * @license lucide-react v0.469.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const es=Y("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/**
12
+ * @license lucide-react v0.469.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const ts=Y("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
17
+ * @license lucide-react v0.469.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const ss=Y("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
22
+ * @license lucide-react v0.469.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */const as=Y("SkipForward",[["polygon",{points:"5 4 15 12 5 20 5 4",key:"16p6eg"}],["line",{x1:"19",x2:"19",y1:"5",y2:"19",key:"futhcm"}]]);function st({isOpen:n,onClose:c,taskId:s,stageName:r,timeoutSeconds:t,onSubmitted:x}){const{t:m}=Z(),[h,p]=l.useState(t),[_,C]=l.useState(!1);l.useEffect(()=>{if(!n)return;p(t);const o=setInterval(()=>{p(N=>N<=1?(clearInterval(o),0):N-1)},1e3);return()=>clearInterval(o)},[n,t]),l.useEffect(()=>{h===0&&n&&c()},[h,n,c]);const I=l.useCallback(async o=>{C(!0);try{await j.post(`web/tasks/${s}/confirm-stage`,{json:{stageName:r,approved:o}}),x==null||x(),c()}catch{}finally{C(!1)}},[s,r,c,x]);return n?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backdropFilter:"blur(2px)"},children:[e.jsx("div",{className:"fixed inset-0 bg-[var(--modal-backdrop)]"}),e.jsxs("div",{className:"relative z-10 w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] font-mono",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 py-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(kt,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsxs("h3",{className:"text-sm text-[var(--text-primary)]",children:["// stage: ",r]})]}),e.jsxs("span",{className:"flex items-center gap-1 text-xs text-[var(--text-muted)]",children:[e.jsx(Ot,{className:"h-3.5 w-3.5"}),Kt(h)]})]}),e.jsx("div",{className:"space-y-4 px-5 py-5",children:e.jsx("p",{className:"whitespace-pre-wrap text-xs text-[var(--text-primary)]",children:m("tasks.confirm_stage_message",{name:r})})}),e.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-[var(--border)] px-5 py-4",children:[e.jsx("button",{type:"button",className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors disabled:opacity-50",disabled:_,onClick:()=>I(!1),children:m("tasks.reject")}),e.jsx("button",{type:"button",className:"rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",disabled:_,onClick:()=>I(!0),children:m(_?"tasks.stage_submitting":"tasks.confirm_and_proceed")})]})]})]}):null}function rs(n,c){const s=new Date(n).getTime()-Date.now();if(s<=0)return c("tasks.tunnel_expired");const r=Math.floor(s/36e5),t=Math.floor(s%36e5/6e4);return r>0?c("tasks.tunnel_expires_hm",{h:r,m:t}):c("tasks.tunnel_expires_m",{m:t})}function at(n){switch(n){case"CONNECTED":return"var(--accent)";case"STARTING":return"var(--warning)";case"EXPIRED":return"var(--text-muted)";default:return"var(--text-muted)"}}function rt(n,c){switch(n){case"IDLE":case"CLOSED":return c("tasks.tunnel_idle");case"STARTING":return c("tasks.tunnel_starting");case"CONNECTED":return c("tasks.tunnel_connected");case"EXPIRED":return c("tasks.tunnel_expired");case"CLOSING":return c("tasks.tunnel_closing");default:return String(n).toLowerCase()}}function ns({taskId:n,taskFinished:c,compact:s}){const{t:r}=Z(),[t,x]=l.useState(P.IDLE),[m,h]=l.useState(null),[p,_]=l.useState(null),[C,I]=l.useState(""),[o,N]=l.useState(!1),[ce,R]=l.useState(!1),F=l.useRef(null),$=l.useCallback(async()=>{try{const u=await j.get(`web/workspace-tunnel/${n}/status`).json();x(u.status),h(u.tunnelUrl??null),_(u.expiresAt??null),(u.status==="EXPIRED"||u.status==="IDLE"||u.status==="CLOSED")&&S()}catch{}},[n]);function ie(){S(),F.current=setInterval($,5e3)}function S(){F.current&&(clearInterval(F.current),F.current=null)}l.useEffect(()=>{c&&(t===P.STARTING||t===P.CONNECTED)&&(x(P.IDLE),h(null),S())},[c,t]),l.useEffect(()=>{if(t!=="CONNECTED"||!p)return;const u=()=>{const T=rs(p,r);I(T),T===r("tasks.tunnel_expired")&&(x(P.EXPIRED),h(null),S())};u();const D=setInterval(u,3e4);return()=>clearInterval(D)},[t,p]),l.useEffect(()=>()=>S(),[]),l.useEffect(()=>{c||$()},[$,c]);async function K(){N(!0);try{await j.post(`web/workspace-tunnel/${n}/start`),x(P.STARTING),ie()}catch(u){let D=r("tasks.tunnel_start_failed");try{if(u instanceof wt){const T=await u.response.json();T!=null&&T.error&&(D=T.error,/code.*not found|ENOENT.*code|spawn code/i.test(D)&&(D+=". "+r("tasks.tunnel_install_code_hint")))}}catch{}Q.error(D)}finally{N(!1)}}async function z(){N(!0);try{await j.post(`web/workspace-tunnel/${n}/stop`),x(P.IDLE),h(null),S()}catch{}finally{N(!1)}}async function xe(){m&&(await navigator.clipboard.writeText(m),R(!0),setTimeout(()=>R(!1),2e3))}return s?e.jsxs("div",{className:"flex items-center gap-2 font-mono lowercase text-xs",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"ide_tunnel:"}),e.jsx("span",{style:{color:at(t)},children:rt(t,r)}),(t==="IDLE"||t==="CLOSED"||t==="EXPIRED")&&e.jsx("button",{onClick:K,disabled:o,className:"rounded-[4px] px-2 py-1 text-[var(--info)] disabled:opacity-50",style:{backgroundColor:"rgba(59,130,246,0.12)"},children:r(o?"tasks.tunnel_starting":"tasks.tunnel_start")}),t==="CONNECTED"&&m&&e.jsx("a",{href:m.replace(/^https?:/,"cursor:"),target:"_blank",rel:"noopener noreferrer",className:"rounded-[4px] px-2 py-1 text-[var(--info)]",style:{backgroundColor:"rgba(59,130,246,0.12)"},children:r("tasks.tunnel_open_in_cursor")})]}):e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 font-mono lowercase",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.tunnel_header")}),e.jsxs("span",{className:"text-xs",style:{color:at(t)},children:["● ",rt(t,r)]})]}),t==="CONNECTED"&&p&&e.jsxs("p",{className:"mb-2 text-xs text-[var(--text-muted)]",children:["// ",C]}),t==="CONNECTED"&&m&&e.jsxs("div",{className:"mb-3 flex items-center gap-2 rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] px-3 py-2",children:[e.jsx("code",{className:"flex-1 truncate text-xs text-[var(--text-primary)]",children:m}),e.jsxs("button",{onClick:xe,className:"shrink-0 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors","aria-label":r("tasks.tunnel_copy_url"),children:["[",r("common.copy"),"]"]})]}),ce&&e.jsx("p",{className:"mb-2 text-xs text-[var(--accent)]",children:r("tasks.tunnel_copied")}),t==="STARTING"&&e.jsx("p",{className:"mb-3 text-xs text-[var(--text-muted)]",children:r("tasks.tunnel_waiting")}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[(t==="IDLE"||t==="CLOSED")&&e.jsx("button",{onClick:K,disabled:o,className:"rounded-[4px] border border-[var(--accent)]/40 px-3 py-1.5 text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors disabled:opacity-50",children:r(o?"tasks.tunnel_starting_button":"tasks.tunnel_start_button")}),t==="STARTING"&&e.jsx("button",{onClick:z,disabled:o,className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors disabled:opacity-50",children:r(o?"tasks.tunnel_stopping":"tasks.tunnel_cancel")}),t==="CONNECTED"&&m&&e.jsxs(e.Fragment,{children:[e.jsx("a",{href:m.replace(/^https?:/,"cursor:"),target:"_blank",rel:"noopener noreferrer",className:"rounded-[4px] border border-[var(--accent)]/40 px-3 py-1.5 text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors",children:r("tasks.tunnel_open_cursor")}),e.jsx("a",{href:m.replace(/^https?:/,"vscode:"),target:"_blank",rel:"noopener noreferrer",className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:r("tasks.tunnel_open_vscode")}),e.jsx("button",{onClick:z,disabled:o,className:"rounded-[4px] border border-[var(--destructive)]/40 px-3 py-1.5 text-[var(--destructive)] hover:bg-[var(--destructive)]/10 transition-colors disabled:opacity-50",children:r(o?"tasks.tunnel_stopping":"tasks.tunnel_stop")})]}),t==="EXPIRED"&&e.jsx("button",{onClick:K,disabled:o,className:"rounded-[4px] border border-[var(--accent)]/40 px-3 py-1.5 text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors disabled:opacity-50",children:r(o?"tasks.tunnel_starting_button":"tasks.tunnel_restart")})]})]})}function ls({isOpen:n,onClose:c,onConfirm:s,taskId:r,isLoading:t}){const{t:x}=Z();return e.jsx(_e,{isOpen:n,onClose:c,onConfirm:s,title:x("tasks.cancel_task_title"),message:x("tasks.cancel_task_message",{id:String(r)}),confirmLabel:x("tasks.cancel_task_confirm_label"),confirmVariant:"danger",isLoading:t})}function cs({isOpen:n,onClose:c,onConfirm:s,taskId:r,mrUrl:t,isLoading:x,reuseWorkspace:m,onReuseWorkspaceChange:h}){const{t:p}=Z(),_=t?p("tasks.retry_message_with_mr",{id:String(r),url:t}):p("tasks.retry_message_without_mr",{id:String(r)});return e.jsx(_e,{isOpen:n,onClose:c,onConfirm:s,title:p("tasks.retry_title"),message:_,confirmLabel:p("tasks.retry_confirm_label"),confirmVariant:"accent",isLoading:x,children:e.jsxs("label",{className:"flex items-center gap-2 mt-3 text-[var(--text-muted)] text-xs cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:m,onChange:C=>h(C.target.checked),className:"w-3.5 h-3.5 cursor-pointer accent-[var(--accent)]"}),p("tasks.reuse_workspace_label")]})})}const ye=["implement","test","verify","review","simplify","submit"];function we(n){if(typeof n=="string")try{return we(JSON.parse(n))}catch{return null}if(!n||typeof n!="object")return null;const c=n.stages;if(!Array.isArray(c)||c.length===0)return null;const s=c.map(r=>r&&typeof r=="object"?r.name:null).filter(r=>typeof r=="string"&&r.length>0);return s.length===c.length?s:null}function is(n){if(!n.configSnapshot)return ye;try{const c=JSON.parse(n.configSnapshot);return we(c.pipeline)??we(c)??ye}catch{return ye}}function xs(n){switch(n){case"stage_change":return"text-[var(--accent)]";case"info":return"text-[var(--text-secondary)]";case"warning":return"text-[var(--warning)]";case"error":return"text-[var(--destructive)]";case"system":return"text-[var(--info)]";default:return"text-[var(--text-muted)]"}}function ke({status:n,agentType:c}){const s=xt(n),r=le(c);return e.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-[4px] px-2 py-0.5 text-xs",style:{color:s},children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-[3px]",style:{backgroundColor:s}}),n.toLowerCase()," / ",r]})}function nt({stages:n,runningBg:c="bg-[#1a1a1a]",py:s="py-1.5"}){return e.jsx(e.Fragment,{children:n.map(r=>{const t=r.status==="completed",x=r.status==="running",m=r.status==="failed";return e.jsxs("div",{className:`flex items-center gap-2 rounded-[4px] px-2 ${s} ${x?c:""}`,children:[t&&e.jsx(Rt,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),x&&e.jsx(dt,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),m&&e.jsx(it,{className:"h-3.5 w-3.5 shrink-0 text-[var(--destructive)]"}),r.status==="pending"&&e.jsx(Zt,{className:"h-3.5 w-3.5 shrink-0 text-[#525252]"}),e.jsx("span",{className:"text-xs",style:{color:t?"var(--accent)":x?"#e5e5e5":m?"var(--destructive)":"#525252",fontWeight:x?500:400},children:x?`> ${r.name}`:r.name})]},r.name)})})}function lt({task:n,ptyStatus:c,displayAgentType:s,t:r,gap:t="gap-2 md:gap-3"}){return e.jsxs("div",{className:`flex items-center ${t}`,children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:r("tasks.pty_terminal")}),e.jsxs("span",{className:`inline-flex items-center gap-1 text-[11px] ${c==="connected"?"text-[var(--accent)]":c==="connecting"?"text-[var(--warning)]":"text-[var(--text-muted)]"}`,children:[e.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${c==="connected"?"bg-[var(--accent)]":c==="connecting"?"bg-[var(--warning)]":"bg-[#525252]"}`}),r(`tasks.${c}`)]}),e.jsx("span",{className:"text-[11px]",style:{color:xt(n.status)},children:n.status.toLowerCase()}),n.currentStage&&e.jsxs("span",{className:"hidden md:inline text-[11px] text-[var(--accent)]",children:[r("tasks.stage"),": ",n.currentStage]}),e.jsxs("span",{className:"hidden md:inline text-[11px] text-[var(--text-muted)]",children:["agent: ",s]}),n.workerName&&e.jsxs("span",{className:"hidden md:inline text-[11px] text-[var(--text-muted)]",children:["worker: ",n.workerName]})]})}function ct({isFinished:n,takeoverState:c,ptyRef:s,t:r}){return e.jsxs(e.Fragment,{children:[!n&&c==="auto"&&e.jsxs("button",{onClick:()=>{var t;return(t=s.current)==null?void 0:t.requestTakeover()},className:"flex items-center gap-1.5 rounded-[4px] px-2.5 h-10 md:h-8 text-[11px] font-medium text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:[e.jsx(Gt,{className:"h-3 w-3"}),r("tasks.take_over")]}),!n&&c==="manual"&&e.jsxs("button",{onClick:()=>{var t;return(t=s.current)==null?void 0:t.releaseTakeover()},className:"flex items-center gap-1.5 rounded-[4px] px-2.5 h-10 md:h-8 text-[11px] font-medium text-[var(--accent)]",style:{backgroundColor:"rgba(34,197,94,0.12)"},children:[e.jsx(ot,{className:"h-3 w-3"}),r("tasks.restore_auto")]})]})}function os(n){const c=is(n),s=n.currentStage?c.indexOf(n.currentStage):-1;return c.map((r,t)=>{let x="pending";return n.status===L.COMPLETED?x="completed":n.status===L.FAILED&&t<=s?x=t===s?"failed":"completed":s>=0&&(t<s?x="completed":t===s&&(x="running")),{name:r,status:x}})}function G(n,c){if(!n||!c)return null;const s=n.repoUrl.replace(/\.git$/,"").replace(/\/+$/,""),r=c.split("/").map(encodeURIComponent).join("/");return n.gitPlatform===Pt.GITLAB?`${s}/-/tree/${r}`:`${s}/tree/${r}`}function Cs(){var He,Ve,Je;const{id:n}=_t(),c=Ct(),{t:s}=Z(),r=Ft(a=>a.cancelTask),[t,x]=l.useState(null),[m,h]=l.useState(null),[p,_]=l.useState([]),[C,I]=l.useState(!0),[o,N]=l.useState(null),[ce,R]=l.useState(!1),[F,$]=l.useState(!1),[ie,S]=l.useState(!1),[K,z]=l.useState(!1),[xe,u]=l.useState(!1),[D,T]=l.useState(!1),[Ce,Se]=l.useState(""),[Te,Ee]=l.useState(""),[Le,De]=l.useState("append"),[Ie,oe]=l.useState(!1),[$e,mt]=St(),[k,de]=l.useState("terminal"),[Ae,Pe]=l.useState([]),[ee,Re]=l.useState(0),[W,M]=l.useState(0),[X,Fe]=l.useState(""),[te,pt]=l.useState(""),[ut,me]=l.useState(!1),[ht,Me]=l.useState(!1),[O,pe]=l.useState(null),[Oe,ue]=l.useState("disconnected"),[he,fe]=l.useState("auto"),H=l.useRef(null),Ue=l.useRef(null),ft=Ut(),d=Number(n),f=t?Mt.includes(t.status):!1;Tt(t?Et(t,100):null);const E=l.useCallback(async()=>{try{const a=await j.get(`web/tasks/${d}`).json();x(a)}catch{}},[d]),se=l.useCallback(async()=>{try{const a=await j.get(`web/tasks/${d}/logs`).json();_(a.lines)}catch{}},[d]),U=l.useCallback(async()=>{try{const a=await j.get(`web/tasks/${d}/pending-confirm`).json();N(a.confirm)}catch{N(null)}},[d]),qe=l.useCallback(async()=>{me(!0);try{const a=new URLSearchParams;a.set("limit","50"),a.set("offset",String(W*50)),X&&a.set("type",X),te&&a.set("search",te);const i=await j.get(`web/tasks/${d}/events?${a}`).json();Pe(i.events),Re(i.total)}catch{}finally{me(!1)}},[d,W,X,te]);l.useEffect(()=>{k==="logs"&&qe()},[k,qe]),l.useEffect(()=>{k==="pipeline"&&!f&&j.get(`web/workspaces/${d}`).json().then(pe).catch(()=>pe(null))},[k,d,f]);const q=Qe(a=>a.lastEvent),Be=Qe(a=>a.eventSeq);l.useEffect(()=>{I(!0),x(null),h(null),_([]),N(null),pe(null),Pe([]),Re(0),M(0),me(!1),Promise.all([E(),se(),U()]).finally(()=>I(!1))},[E,se,U]),l.useEffect(()=>{t!=null&&t.projectKey&&j.get(`web/projects/${t.projectKey}`).json().then(h).catch(()=>h(null))},[t==null?void 0:t.projectKey]),l.useEffect(()=>{!q||Be===0||(q.event==="task_status_changed"&&q.taskId===d||q.event==="task_created"&&q.taskId===d)&&(E(),U())},[Be,q,d,E,U]),l.useEffect(()=>{if(f)return;const i=setInterval(()=>{document.visibilityState!=="hidden"&&Promise.all([E(),se(),U()])},15e3);return()=>clearInterval(i)},[f,E,se,U]);const Ge=l.useCallback(()=>N(null),[]),ae=l.useCallback(()=>{N(null),E()},[E]),vt=(t==null?void 0:t.status)===L.FAILED||(t==null?void 0:t.status)===L.CANCELLED,ve=(t==null?void 0:t.status)===L.COMPLETED||(t==null?void 0:t.status)===L.FAILED||(t==null?void 0:t.status)===L.CANCELLED;l.useEffect(()=>{$e.get("action")==="fork"&&t&&!C&&(ve&&Ke(),mt(a=>(a.delete("action"),a),{replace:!0}))},[t,C,$e,ve]);async function gt(){z(!0);try{await r(d),R(!1),await E()}finally{z(!1)}}async function bt(){u(!0);try{await j.post(`web/tasks/${d}/retry`,{json:{reuseWorkspace:Ie}}),$(!1),oe(!1),await E()}finally{u(!1)}}function Ke(){Se(""),Ee(""),De("append"),S(!0)}async function jt(){T(!0);try{const a=Ce.trim()||void 0,i=await j.post(`web/tasks/${d}/fork`,{json:{description:a,descriptionMode:a?Le:void 0,agentType:Te||void 0}}).json();S(!1),Q.success(s("tasks.fork_success")),c(`/tasks/${i.task.id}`)}catch{Q.error(s("tasks.fork_error"))}finally{T(!1)}}const y=l.useMemo(()=>t?os(t):[],[t==null?void 0:t.configSnapshot,t==null?void 0:t.currentStage,t==null?void 0:t.status]),ge=y.findIndex(a=>a.status==="running");if(C)return e.jsx("div",{className:"flex h-full items-center justify-center font-mono",children:e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:s("tasks.loading_task")})});if(!t)return e.jsxs("div",{className:"mx-auto max-w-5xl px-6 py-8 font-mono lowercase text-center",children:[e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:s("tasks.task_not_found")}),e.jsxs("button",{onClick:()=>c("/tasks"),className:"mt-4 rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:["< ",s("tasks.back_to_tasks")]})]});const w=t.status===L.QUEUED&&t.queuePosition!=null&&t.queueTotal!=null?{position:t.queuePosition,total:t.queueTotal}:null,v=zt(t.startedAt,t.completedAt),V=qt(t),be=le(t.agentType),Nt=[{value:"",label:s("tasks.fork_agent_type_placeholder",{agent:le(V)})},...Xt(le,V)],re=`${s("tasks.status_suspended")} / ${be}`,ze=w?e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"queue"}),e.jsxs("span",{className:"text-[var(--info)]",children:["#",w.position," / ",w.total]})]}):null,We=e.jsxs("div",{className:"flex items-center gap-3 border-b border-[var(--border)] bg-[var(--bg-primary)] px-4 py-3 shrink-0 md:hidden",children:[e.jsx("button",{onClick:()=>c("/tasks"),className:"shrink-0 text-[var(--text-muted)]",children:e.jsx(Vt,{className:"h-4 w-4"})}),e.jsxs("span",{className:"line-clamp-2 text-sm font-medium text-[var(--text-primary)]",title:Lt(t),children:["#",t.id," ",Ye(t,100)]})]}),je=e.jsxs("div",{className:"hidden md:flex items-center gap-4 border-b border-[var(--border)] bg-[var(--bg-primary)] px-5 shrink-0",style:{height:44},children:[e.jsx(ke,{status:t.status,agentType:t.agentType}),v&&e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["// time cost: ",v]}),w&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),e.jsx("span",{className:"text-xs text-[var(--info)]",children:s("tasks.queue_position",{position:String(w.position),total:String(w.total)})})]}),e.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),e.jsxs(Ze,{to:`/projects/${t.projectKey}`,className:"text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:["project: ",e.jsx("span",{className:"text-[var(--text-primary)]",children:t.projectKey})]}),t.branch&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["branch: ",G(m,t.branch)?e.jsx("a",{href:G(m,t.branch),target:"_blank",rel:"noopener noreferrer",className:"text-[var(--text-primary)] hover:text-[var(--info)] hover:underline transition-colors",children:t.branch}):e.jsx("span",{className:"text-[var(--text-primary)]",children:t.branch})]})]}),t.mrUrl&&/^https?:\/\//.test(t.mrUrl)&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),e.jsxs("a",{href:t.mrUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-[var(--info)] hover:underline",children:["MR: ",((He=t.mrUrl.match(/!?\d+$/))==null?void 0:He[0])??"view"]})]})]}),Xe=e.jsxs("div",{className:"flex items-center gap-3 border-t border-[var(--border)] bg-[var(--bg-primary)] px-4 md:px-5 shrink-0",style:{height:48},children:[!f&&e.jsxs("button",{onClick:()=>R(!0),className:"flex flex-1 md:flex-none items-center justify-center gap-1.5 rounded-[4px] bg-[var(--destructive)]/10 px-3 h-8 text-[11px] font-medium text-[var(--destructive)]",children:[e.jsx(it,{className:"h-3 w-3"}),s("tasks.cancel_task")]}),vt&&e.jsxs("button",{onClick:()=>$(!0),className:"flex flex-1 md:flex-none items-center justify-center gap-1.5 rounded-[4px] bg-[var(--bg-card)] px-3 h-8 text-[11px] text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-input)] transition-colors cursor-pointer",children:[e.jsx(ot,{className:"h-3 w-3"}),s("tasks.retry_task")]}),ve&&e.jsxs("button",{onClick:Ke,className:"flex flex-1 md:flex-none items-center justify-center gap-1.5 rounded-[4px] bg-[var(--bg-card)] px-3 h-8 text-[11px] text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-input)] transition-colors cursor-pointer",children:[e.jsx(Jt,{className:"h-3 w-3"}),s("tasks.fork_task")]}),t.workerId&&!f&&e.jsxs("button",{onClick:()=>{de("pipeline"),setTimeout(()=>{var a,i;(i=(a=Ue.current)==null?void 0:a.scrollIntoView)==null||i.call(a,{behavior:"smooth",block:"center"})},50)},className:"hidden lg:flex items-center justify-center gap-1.5 rounded-[4px] px-3 h-8 text-[11px] font-medium text-[var(--info)]",style:{backgroundColor:"rgba(59,130,246,0.12)"},children:[e.jsx(Qt,{className:"h-3 w-3"}),s("tasks.cursor_tunnel")]})]}),yt=e.jsxs("div",{className:"hidden w-[280px] shrink-0 flex-col gap-6 overflow-y-auto border-l border-[var(--border)] bg-[var(--bg-primary)] p-4 lg:flex",children:[e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:s("tasks.pipeline_stages")}),e.jsx(nt,{stages:y})]}),v&&e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2 text-[11px] text-[var(--text-secondary)]",children:["// time cost: ",v]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:s("tasks.activity_log")}),p.length>0?e.jsx("div",{className:"flex flex-col gap-1.5",children:p.slice(0,8).map((a,i)=>e.jsx("p",{className:"text-[11px] leading-relaxed text-[var(--text-muted)]",children:a},i))}):e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:s("tasks.no_activity")})]})]}),Ne=e.jsxs(e.Fragment,{children:[e.jsx(ls,{isOpen:ce,onClose:()=>R(!1),onConfirm:gt,taskId:d,isLoading:K}),e.jsx(cs,{isOpen:F,onClose:()=>{$(!1),oe(!1)},onConfirm:bt,taskId:d,mrUrl:t.mrUrl??void 0,isLoading:xe,reuseWorkspace:Ie,onReuseWorkspaceChange:oe}),e.jsx(_e,{isOpen:ie,onClose:()=>S(!1),onConfirm:jt,title:s("tasks.fork_task"),message:s("tasks.fork_task_desc"),confirmLabel:s("tasks.fork_task"),confirmVariant:"accent",isLoading:D,children:e.jsxs("div",{className:"mt-3 flex flex-col gap-2",children:[e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["fork of #",d]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:s("tasks.form_agent_type")}),e.jsx(tt,{value:Te,onChange:Ee,options:Nt})]}),e.jsx("textarea",{value:Ce,onChange:a=>Se(a.target.value),placeholder:s("tasks.fork_description_placeholder"),rows:4,className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)] resize-none"}),e.jsxs("label",{className:"flex items-start gap-2 rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] px-3 py-2 text-[11px] text-[var(--text-secondary)]",children:[e.jsx("input",{type:"checkbox",checked:Le==="replace",onChange:a=>De(a.target.checked?"replace":"append"),className:"mt-0.5 h-3.5 w-3.5 rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] accent-[var(--accent)]"}),e.jsxs("span",{children:[s("tasks.fork_replace_description"),e.jsx("span",{className:"mt-1 block text-[10px] text-[var(--text-muted)]",children:s("tasks.fork_append_hint")})]})]})]})})]});return ht&&k==="terminal"?e.jsxs("div",{className:"fixed inset-0 z-50 flex flex-col bg-[var(--bg-primary)] font-mono lowercase h-screen",style:{height:"100dvh",paddingTop:"env(safe-area-inset-top, 0px)",paddingBottom:"env(safe-area-inset-bottom, 0px)"},children:[je,e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 shrink-0",style:{height:36,backgroundColor:"#111111"},children:[e.jsx(lt,{task:t,ptyStatus:Oe,displayAgentType:V,t:s,gap:"gap-3"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ct,{isFinished:f,takeoverState:he,ptyRef:H,t:s}),e.jsx("button",{onClick:()=>Me(!1),className:"flex items-center rounded-[4px] bg-[var(--bg-card)] px-2.5 py-1 text-[var(--text-muted)]",children:e.jsx(ss,{className:"h-3 w-3"})})]})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(et,{ref:H,taskId:d,sessionId:t.currentSessionId??void 0,taskFinished:f,onStatusChange:ue,onTakeoverChange:fe})}),Xe,Ne]}):t.status===L.SUSPENDED?e.jsxs("div",{className:"flex h-full flex-col font-mono lowercase",children:[We,je,e.jsx("div",{className:"flex items-center gap-2 border-b px-4 md:px-6 py-2 text-xs shrink-0",style:{backgroundColor:"rgba(245,158,11,0.08)",borderColor:"rgba(245,158,11,0.2)",color:"var(--warning)"},children:s("tasks.task_suspended_banner")}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col md:flex-row gap-4 md:gap-6 p-4 md:p-6 overflow-y-auto",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-4",children:[e.jsxs("div",{className:"hidden md:flex items-center gap-3",children:[e.jsxs("span",{className:"text-xl font-bold text-[var(--text-primary)]",children:["#",t.id]}),e.jsx("span",{className:"text-base text-[var(--text-secondary)] truncate max-w-[60%]",children:e.jsx(Ht,{content:Dt(t),children:Ye(t,200)})}),e.jsx("span",{className:"rounded-[4px] px-2.5 py-1 text-[11px] font-bold text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:re})]}),e.jsx("div",{className:"flex items-center gap-2 md:hidden",children:e.jsx("span",{className:"rounded-[4px] px-2.5 py-1 text-[11px] font-bold text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:re})}),o&&e.jsxs("div",{className:"rounded-[4px] border p-4",style:{borderColor:"rgba(245,158,11,0.27)",backgroundColor:"#1a1a1a"},children:[e.jsx("p",{className:"mb-2 text-[11px] font-bold text-[var(--accent)]",children:s("tasks.pending_confirmation")}),e.jsx("p",{className:"mb-3 text-xs text-[var(--text-secondary)]",children:o.prompt??s("tasks.pipeline_requires_confirmation")}),e.jsx("div",{className:"mb-3 flex flex-col gap-1.5 text-[11px]",children:e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"stage"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:o.stageName})]})}),e.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:flex-wrap md:gap-3",children:[e.jsx("button",{onClick:async()=>{try{await j.post(`web/tasks/${d}/confirm-stage`,{json:{stageName:o.stageName,approved:!0}}),ae()}catch{Q.error(s("tasks.confirm_failed"))}},className:"flex-1 md:flex-none rounded-[4px] bg-[var(--accent)] px-4 py-2.5 md:py-2 text-[11px] font-bold text-[#0c0c0c]",children:s("tasks.confirm_and_proceed")}),e.jsx("button",{onClick:async()=>{try{await j.post(`web/tasks/${d}/confirm-stage`,{json:{stageName:o.stageName,approved:!1}}),ae()}catch{Q.error(s("tasks.confirm_failed"))}},className:"flex-1 md:flex-none rounded-[4px] bg-[#1a1a1a] px-4 py-2.5 md:py-2 text-[11px] text-[var(--destructive)]",style:{border:"1px solid rgba(239,68,68,0.27)"},children:s("tasks.reject")})]})]}),e.jsxs("div",{className:"flex flex-col gap-3 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 lg:hidden",children:[e.jsx("span",{className:"text-xs font-bold text-[var(--accent)]",children:s("tasks.task_info")}),e.jsxs("div",{className:"flex flex-col gap-1.5 text-[11px]",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"status"}),e.jsx("span",{className:"font-bold text-[var(--warning)]",children:re})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"project"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.projectKey})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"worker"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.workerName??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"created"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:J(t.createdAt)})]})]})]}),e.jsx("div",{className:"hidden md:flex flex-wrap items-center gap-2 py-2",children:y.map((a,i)=>{const g=a.status==="failed",b=a.status==="completed",A=a.status==="running"&&t.status===L.SUSPENDED,B=g?"var(--destructive)":b?"var(--accent)":A?"var(--warning)":"#525252",ne=g?"rgba(239,68,68,0.12)":b?"rgba(34,197,94,0.12)":A?"rgba(245,158,11,0.12)":"transparent";return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"rounded-[4px] px-2.5 py-1 text-[11px]",style:{color:B,backgroundColor:ne,fontWeight:A?700:400,border:A?`1px solid ${B}`:void 0},children:A?"confirm":`${a.name}${b?" ✓":g?" ✗":""}`}),i<y.length-1&&e.jsx("div",{className:"h-px w-6 bg-[var(--border)]"})]},a.name)})}),e.jsxs("div",{className:"hidden md:block min-h-[200px] flex-1 rounded-[4px] border border-[var(--border)] bg-[#0c0c0c] p-4",children:[e.jsx("p",{className:"mb-2 text-[11px] font-bold text-[var(--accent)]",children:s("tasks.pty_output")}),e.jsxs("div",{className:"flex flex-col gap-1",children:[p.slice(-10).map((a,i)=>e.jsx("p",{className:"text-[11px] leading-relaxed text-[var(--text-secondary)]",children:a},i)),p.length===0&&e.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:s("tasks.no_output")})]})]})]}),e.jsxs("div",{className:"hidden w-[280px] shrink-0 flex-col gap-4 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 lg:flex",children:[e.jsx("span",{className:"text-[13px] font-bold text-[var(--accent)]",children:s("tasks.task_info")}),e.jsxs("div",{className:"flex flex-col gap-1.5 text-[11px]",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"status"}),e.jsx("span",{className:"font-bold text-[var(--warning)]",children:re})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"project"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.projectKey})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"worker"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.workerName??"-"})]})]}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsx("span",{className:"text-xs font-bold text-[var(--accent)]",children:s("tasks.stage_timeline")}),e.jsx("div",{className:"flex flex-col gap-2",children:y.map(a=>{const i=a.status==="completed"?"var(--info)":a.status==="failed"?"var(--destructive)":a.status==="running"?"var(--warning)":"#525252",g=a.status==="failed"?"var(--destructive)":a.status==="running"?"var(--warning)":"#a3a3a3",b=a.status==="completed"?"completed":a.status==="running"?"suspended":a.status==="failed"?"failed":"pending";return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"h-2 w-2 shrink-0 rounded-[4px]",style:{backgroundColor:i}}),e.jsxs("span",{className:"text-[11px]",style:{color:g,fontWeight:a.status==="running"?700:400},children:[a.name," ",b]})]},a.name)})}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsx("div",{className:"flex flex-col gap-1.5 text-[11px]",children:e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"created"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:J(t.createdAt)})]})})]})]}),o&&e.jsx(st,{isOpen:!!o,onClose:Ge,taskId:d,stageName:o.stageName,timeoutSeconds:Math.ceil(o.timeout/1e3),onSubmitted:ae}),Ne]}):e.jsxs("div",{className:"flex h-full flex-col overflow-hidden font-mono lowercase",children:[We,e.jsxs("div",{className:"flex flex-wrap items-center gap-3 gap-y-1 border-b border-[var(--border)] bg-[var(--bg-primary)] px-4 py-2 shrink-0 md:hidden",children:[e.jsx(ke,{status:t.status,agentType:t.agentType}),v&&e.jsxs("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:["// time cost: ",v]}),e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:t.projectKey}),t.workerName&&e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:t.workerName}),t.branch&&(G(m,t.branch)?e.jsx("a",{href:G(m,t.branch),target:"_blank",rel:"noopener noreferrer",className:"shrink-0 text-[11px] text-[var(--text-muted)] hover:text-[var(--info)] hover:underline truncate max-w-[80px] md:max-w-[120px] transition-colors",children:t.branch}):e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)] truncate max-w-[80px] md:max-w-[120px]",children:t.branch}))]}),je,t.errorMessage&&e.jsxs("div",{className:"flex items-center gap-2 border-b px-6 py-2 text-xs shrink-0 bg-[var(--destructive)]/10 text-[var(--destructive)]",style:{borderColor:"rgba(239,68,68,0.2)"},children:["// error: ",t.errorMessage]}),w&&e.jsxs("div",{className:"flex items-center gap-2 border-b px-4 md:px-6 py-2 text-xs shrink-0 text-[var(--info)]",style:{backgroundColor:"color-mix(in srgb, var(--info) 8%, transparent)",borderColor:"color-mix(in srgb, var(--info) 20%, transparent)"},children:[e.jsx(es,{className:"h-3.5 w-3.5 shrink-0"}),e.jsxs("span",{children:[s("tasks.queue_position_banner",{position:String(w.position),total:String(w.total)}),w.position>1?` — ${s("tasks.queue_ahead",{count:String(w.position-1)})}`:` — ${s("tasks.queue_next")}`]})]}),o&&e.jsx(st,{isOpen:!!o,onClose:Ge,taskId:d,stageName:o.stageName,timeoutSeconds:Math.ceil(o.timeout/1e3),onSubmitted:ae}),e.jsxs("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[e.jsx("div",{className:"flex items-center border-b border-[var(--border)] shrink-0 overflow-x-auto no-scrollbar",children:["terminal","pipeline","logs","detail"].map(a=>e.jsx("button",{onClick:()=>de(a),className:`shrink-0 whitespace-nowrap px-4 py-2.5 text-xs transition-colors ${k===a?"border-b-2 border-[var(--accent)] text-[var(--accent)] font-medium":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:s(a==="terminal"?"tasks.terminal":a==="pipeline"?"tasks.pipeline_tab":a==="logs"?"tasks.logs":"tasks.detail_tab")},a))}),k==="terminal"&&e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-3 md:px-5 shrink-0",style:{height:36,backgroundColor:"#111111"},children:[e.jsx(lt,{task:t,ptyStatus:Oe,displayAgentType:V,t:s}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ct,{isFinished:f,takeoverState:he,ptyRef:H,t:s}),!f&&he==="requesting"&&e.jsxs("span",{className:"flex items-center gap-1.5 px-2.5 h-10 md:h-8 text-[11px] text-[var(--warning)]",children:[e.jsx(dt,{className:"h-3 w-3 animate-spin"}),s("tasks.requesting_takeover")]}),!f&&t.currentStage&&e.jsxs("button",{className:"hidden md:flex items-center gap-1.5 rounded-[4px] bg-[var(--bg-card)] px-2.5 h-10 md:h-8 text-[11px] text-[var(--text-muted)]",children:[e.jsx(as,{className:"h-3 w-3"}),s("tasks.skip_stage")]}),e.jsx("button",{onClick:()=>Me(!0),className:"hidden md:flex items-center rounded-[4px] bg-[var(--bg-card)] px-2.5 h-10 md:h-8 text-[var(--text-muted)]",children:e.jsx(ts,{className:"h-3 w-3"})})]})]}),e.jsxs("div",{className:"border-b border-[var(--border)] px-4 py-2 shrink-0 md:hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[t.currentStage&&e.jsxs("span",{className:"text-[11px] font-semibold text-[var(--accent)]",children:[s("tasks.stage"),": ",t.currentStage]}),e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["agent: ",V]}),t.workerName&&e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["worker: ",t.workerName]})]}),e.jsx("div",{className:"overflow-x-auto no-scrollbar pr-4",style:{borderRadius:0},children:e.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",children:[e.jsx("span",{className:"shrink-0 text-[11px] font-bold text-[var(--accent)]",children:s("tasks.stage_progress")}),y.map((a,i)=>{const g=a.status==="completed",b=a.status==="running",B=a.status==="failed"?"var(--destructive)":g||b?"var(--accent)":"#525252";return e.jsxs("div",{className:"flex items-center",children:[e.jsxs("span",{className:"shrink-0 text-[11px] leading-normal whitespace-nowrap",style:{color:B,fontWeight:b?600:400},children:[a.name,g?" ✓":b?" ...":""]}),i<y.length-1&&e.jsx("div",{className:"mx-1.5 h-px w-4 shrink-0",style:{backgroundColor:B}})]},a.name)})]})})]}),ft?e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(Bt,{ref:H,taskId:d,sessionId:t.currentSessionId??void 0,taskFinished:f,onStatusChange:ue,onTakeoverChange:fe})}):e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(et,{ref:H,taskId:d,sessionId:t.currentSessionId??void 0,taskFinished:f,onStatusChange:ue,onTakeoverChange:fe})}),Xe]}),k==="pipeline"&&e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto p-4 md:p-6 lg:p-8",children:[e.jsx("div",{className:"mb-4 md:mb-5 overflow-x-auto no-scrollbar",style:{borderRadius:0},children:e.jsx("div",{className:"flex items-center py-5",children:y.map((a,i)=>{const g=a.status==="completed",b=a.status==="running",ne=a.status==="failed"?"var(--destructive)":g||b?"var(--accent)":"#525252";return e.jsxs("div",{className:"flex items-center",style:{flex:i<y.length-1?1:void 0},children:[e.jsxs("div",{className:"flex flex-col items-center gap-1.5",children:[e.jsxs("div",{className:"flex h-6 w-6 md:h-7 md:w-7 items-center justify-center rounded-full shrink-0",style:{backgroundColor:ne},children:[g&&e.jsx("span",{className:"text-[11px] md:text-xs font-semibold text-[#0c0c0c]",children:"✓"}),b&&e.jsx("span",{className:"h-2 w-2 md:h-2.5 md:w-2.5 rounded-full bg-[#0c0c0c]"})]}),e.jsx("span",{className:"text-[11px] leading-normal font-medium whitespace-nowrap",style:{color:ne},children:a.name})]}),i<y.length-1&&e.jsx("div",{className:"mx-1 md:mx-2 h-0.5 flex-1 min-w-3 rounded-full",style:{backgroundColor:i<(ge>=0?ge:0)?"var(--accent)":"#525252"}})]},a.name)})})}),t.currentStage&&e.jsxs("div",{className:"mb-4 md:mb-5 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 text-xs leading-relaxed",children:[e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// stage: ",t.currentStage," (",ge+1,"/",y.length,")"]}),t.startedAt&&e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// elapsed: ",J(t.startedAt).replace(" ago","")]}),v&&e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// time cost: ",v]}),e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// retries: ",t.retryCount,"/2"]})]}),!t.currentStage&&v&&e.jsx("div",{className:"mb-4 md:mb-5 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 text-xs leading-relaxed",children:e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// time cost: ",v]})}),e.jsx("button",{onClick:()=>de("terminal"),className:"flex-1 min-h-[100px] rounded-[4px] border border-dashed border-[var(--border)] flex items-center justify-center gap-2 text-[11px] text-[var(--text-muted)] hover:border-[var(--accent)] hover:text-[var(--accent)] transition-colors",children:e.jsxs("span",{children:["// ",s("tasks.view_terminal")]})}),e.jsxs("div",{className:"mt-4 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 lg:hidden",children:[e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:s("tasks.task_info")}),e.jsxs("div",{className:"mt-2 flex flex-col gap-1.5 text-[11px]",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"project"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.projectKey})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"worker"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.workerName??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"branch"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.branch??"-"})]}),ze]})]}),e.jsxs("div",{className:"flex flex-col gap-6 mt-4 lg:hidden",children:[e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:s("tasks.pipeline_stages")}),e.jsx(nt,{stages:y,runningBg:"bg-[var(--bg-input)]",py:"py-2"})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:s("tasks.activity_log")}),p.length>0?e.jsx("div",{className:"flex flex-col gap-1.5",children:p.slice(-12).map((a,i)=>e.jsx("p",{className:"text-[11px] leading-relaxed text-[var(--text-muted)]",children:a},i))}):e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:s("tasks.no_activity")})]})]})]}),k==="logs"&&e.jsxs("div",{className:"flex flex-1 flex-col gap-3 md:gap-5 overflow-y-auto p-4 md:p-6 lg:p-8",children:[e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)] md:hidden",children:s("tasks.task_logs")}),e.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-center md:gap-3",children:[e.jsx("div",{className:"flex items-center gap-1 overflow-x-auto no-scrollbar md:hidden",children:["","error","system"].map(a=>e.jsx("button",{onClick:()=>{Fe(a),M(0)},className:`shrink-0 rounded-[4px] px-2.5 py-1 text-[11px] ${X===a?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)]"}`,children:a||"all"},a))}),e.jsx("div",{className:"hidden md:block",children:e.jsx(tt,{value:X,onChange:a=>{Fe(a),M(0)},options:[{value:"",label:"all"},{value:"stage_change",label:"stage_change"},{value:"info",label:"info"},{value:"warning",label:"warning"},{value:"error",label:"error"},{value:"system",label:"system"}],className:"w-36"})}),e.jsxs("div",{className:"flex flex-1 items-center gap-2 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2",children:[e.jsx(It,{className:"h-3.5 w-3.5 text-[var(--text-muted)]"}),e.jsx("input",{type:"text",placeholder:s("tasks.search_logs"),value:te,onChange:a=>{pt(a.target.value),M(0)},className:"flex-1 bg-transparent text-xs text-[var(--text-primary)] outline-none placeholder:text-[var(--text-muted)]"})]})]}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[Ae.map((a,i)=>e.jsxs("div",{className:`flex items-start md:items-center gap-2 md:gap-4 rounded-[4px] px-2 md:px-3 py-2 text-[11px] md:text-xs ${i%2===0?"bg-[var(--bg-card)]":""}`,children:[e.jsx("span",{className:"shrink-0 text-[var(--text-muted)]",children:new Date(a.timestamp).toLocaleTimeString("en-US",{hour12:!1})}),e.jsx("span",{className:`shrink-0 font-medium ${xs(a.type)}`,children:a.type}),e.jsx("span",{className:"min-w-0 break-words md:truncate text-[var(--text-primary)]",children:a.message})]},a.id)),Ae.length===0&&!ut&&e.jsx("p",{className:"py-8 text-center text-xs text-[var(--text-muted)]",children:s("tasks.no_log_entries")})]}),ee>50&&e.jsxs("div",{className:"flex items-center justify-center gap-1",children:[Array.from({length:Math.ceil(ee/50)}).slice(0,5).map((a,i)=>e.jsx("button",{onClick:()=>M(i),className:`rounded-[4px] px-2 py-1 text-xs ${W===i?"bg-[var(--accent)] text-black font-medium":"text-[var(--text-muted)] hover:text-[var(--text-primary)]"}`,children:i+1},i)),Math.ceil(ee/50)>5&&e.jsx("button",{onClick:()=>M(W+1),disabled:W>=Math.ceil(ee/50)-1,className:"rounded-[4px] px-2 py-1 text-xs text-[var(--text-muted)] disabled:opacity-30",children:">"})]})]}),k==="detail"&&e.jsxs("div",{className:"flex flex-1 flex-col gap-4 md:gap-5 overflow-y-auto p-4 md:p-6 lg:p-8",children:[e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 md:p-5",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx($t,{className:"h-3.5 w-3.5 text-[var(--accent)]"}),e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:s("tasks.detail_basic_info")})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3",children:[e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:s("tasks.detail_creator")}),e.jsx("span",{className:"text-xs text-[var(--text-primary)]",children:t.creatorName??"-"})]}),e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:s("common.created_at")}),e.jsx("span",{className:"text-xs text-[var(--text-primary)]",children:Wt(t.createdAt)}),e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:J(t.createdAt)})]}),e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:s("common.status")}),e.jsx(ke,{status:t.status,agentType:t.agentType})]}),e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:s("tasks.detail_project")}),e.jsx(Ze,{to:`/projects/${t.projectKey}`,className:"text-xs text-[var(--info)] hover:underline transition-colors",children:t.projectKey})]}),e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:s("tasks.detail_worker")}),e.jsx("span",{className:"text-xs text-[var(--text-primary)]",children:t.workerName??"-"})]}),e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:s("tasks.form_agent_type")}),e.jsx("span",{className:"text-xs text-[var(--text-primary)]",children:be})]}),v&&e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:s("tasks.detail_time_cost")}),e.jsx("span",{className:"text-xs text-[var(--text-primary)]",children:v})]}),t.branch&&e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:s("tasks.detail_branch")}),G(m,t.branch)?e.jsx("a",{href:G(m,t.branch),target:"_blank",rel:"noopener noreferrer",className:"text-xs text-[var(--info)] hover:underline transition-colors truncate",children:t.branch}):e.jsx("span",{className:"text-xs text-[var(--text-primary)] truncate",children:t.branch})]}),t.mrUrl&&/^https?:\/\//.test(t.mrUrl)&&e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:s("tasks.mr_link")}),e.jsx("a",{href:t.mrUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-[var(--info)] hover:underline truncate",children:((Ve=t.mrUrl.match(/!?\d+$/))==null?void 0:Ve[0])??"view"})]})]})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 md:p-5",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx(Yt,{className:"h-3.5 w-3.5 text-[var(--accent)]"}),e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:s("tasks.detail_task_name")})]}),e.jsxs("div",{className:"flex flex-col gap-3",children:[t.name&&e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:s("tasks.detail_ai_name")}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:t.name})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:s("tasks.detail_task_id")}),e.jsxs("span",{className:"text-xs text-[var(--text-secondary)]",children:["#",t.id]})]}),t.sourcePlatform&&e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:s("tasks.detail_source")}),e.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:t.sourcePlatform})]})]})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 md:p-5",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx(At,{className:"h-3.5 w-3.5 text-[var(--accent)]"}),e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:s("tasks.detail_description")})]}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[#0c0c0c] p-4 overflow-x-auto",children:e.jsx("pre",{className:"whitespace-pre-wrap break-words text-xs leading-relaxed text-[var(--text-secondary)] font-mono",children:t.description})})]})]})]}),k==="terminal"&&yt,k==="pipeline"&&e.jsxs("div",{className:"hidden w-[420px] shrink-0 flex-col gap-5 overflow-y-auto border-l border-[var(--border)] bg-[var(--bg-primary)] p-5 lg:flex",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[13px] font-semibold text-[var(--accent)]",children:s("tasks.task_info")}),e.jsxs("div",{className:"flex flex-col gap-1.5 text-xs",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"project"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.projectKey})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"creator"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.creatorName??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"worker"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.workerName??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:s("common.created_at")}),e.jsx("span",{className:"text-[var(--text-primary)]",children:J(t.createdAt)})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:s("tasks.form_agent_type")}),e.jsx("span",{className:"text-[var(--text-primary)]",children:be})]}),v&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"time cost"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:v})]}),ze]})]}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[13px] font-semibold text-[var(--accent)]",children:s("tasks.workspace_section")}),e.jsxs("div",{className:"flex flex-col gap-1.5 text-xs",children:[e.jsxs("div",{className:"flex min-w-0 justify-between",children:[e.jsx("span",{className:"shrink-0 text-[var(--text-muted)]",children:"branch"}),e.jsx("span",{className:"ml-4 min-w-0 truncate text-[var(--text-primary)]",children:t.branch??(O==null?void 0:O.branch)??"-"})]}),e.jsxs("div",{className:"flex min-w-0 justify-between",children:[e.jsx("span",{className:"shrink-0 text-[var(--text-muted)]",children:"worktree"}),e.jsx("span",{className:"ml-4 min-w-0 truncate text-[var(--text-primary)]",children:(O==null?void 0:O.path)??"-"})]}),t.mrUrl&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:s("tasks.mr_link")}),e.jsx("a",{href:t.mrUrl,target:"_blank",rel:"noopener noreferrer",className:"font-medium text-[var(--info)] hover:underline",children:((Je=t.mrUrl.match(/!?\d+$/))==null?void 0:Je[0])??"view"})]})]})]}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsxs("div",{ref:Ue,className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[13px] font-semibold text-[var(--accent)]",children:s("tasks.cursor_tunnel_section")}),t.workerId?e.jsx(ns,{taskId:d,taskFinished:f,compact:!0}):e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:s("tasks.no_worker_assigned")})]}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[13px] font-semibold text-[var(--accent)]",children:s("tasks.stage_timeline")}),e.jsx("div",{className:"flex flex-col gap-2 text-xs",children:y.map(a=>{const i=a.status==="completed"?"✓":a.status==="running"?"→":"·",g=a.status==="running"?"var(--accent)":a.status==="completed"?"var(--info)":a.status==="failed"?"var(--destructive)":"#525252",b=a.status==="completed"?"done":a.status==="running"?"running...":a.status==="failed"?"failed":"pending";return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-semibold",style:{color:g},children:i}),e.jsx("span",{className:a.status==="running"?"font-medium":"",style:{color:g},children:a.name}),e.jsxs("span",{className:"text-[11px]",style:{color:"#525252"},children:["— ",b]})]},a.name)})})]})]})]}),Ne]})}export{Cs as default};
@@ -1 +1 @@
1
- import{R as pe,f as J,a as $,p as u,j as e,l as ee,n as me,u as ue,i as he,r,h as P,X as be,k as ve,w as fe,H as ge,t as W,x as ye,y as V,m as je}from"./index-D_OrDcWf.js";import{a as ke,u as X}from"./task-constants-C28Dag_x.js";import{T as te}from"./TaskStatusBadge-bgFlcooX.js";import{f as se}from"./date-RFA7-ZGs.js";import{T as Ne}from"./Tooltip-C8VKfixS.js";import{G as re}from"./git-fork-DWSuvIF4.js";import{S as A}from"./Select-C9mH7t3y.js";import{g as Ce}from"./agent-type-options-snmZcyAv.js";import{C as we}from"./copy-BsSvzuvN.js";import{E as Y}from"./EmptyState-BwOJcw-7.js";import{T as Z}from"./Skeleton-BSwNthrI.js";import{P as Se}from"./plus-DLpnTi95.js";import{C as _e}from"./chevron-left-C6IUM-8d.js";import{C as Te}from"./chevron-right-CtCcIQB9.js";import"./status-colors-CYQlZjBF.js";const Ee=pe.memo(function({task:s}){const d=J(),{t:c}=$(),x=(a,b)=>c(`common.${a}`,{n:b}),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(Ne,{content:me(s),children:ee(s)})}),e.jsx("td",{className:"py-3 pr-4",children:e.jsx(te,{status:s.status})}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:s.projectKey}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:s.developerName??s.creatorName??"-"}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:s.workerName??"—"}),e.jsx("td",{className:"py-3 font-mono text-xs text-[var(--text-muted)]",children:e.jsxs("span",{className:"flex items-center gap-2",children:[se(s.createdAt,x),i&&e.jsx("button",{onClick:a=>{a.stopPropagation(),d(`/tasks/${s.id}?action=fork`)},className:"shrink-0 rounded-[4px] p-1 text-[var(--text-muted)] hover:text-[var(--accent)] hover:bg-[var(--bg-input)] transition-colors",title:c("tasks.fork_task"),children:e.jsx(re,{className:"h-3 w-3"})})]})})]})});function De({isOpen:n,onClose:s,projects:d,projectsLoading:c,onSubmit:x,isSubmitting:i}){const{t:a}=$();ue(o=>o.user);const b=he(),[p,K]=r.useState(""),[h,B]=r.useState(""),[m,I]=r.useState("feat"),[k,C]=r.useState(""),[w,S]=r.useState(""),[f,_]=r.useState(""),[g,y]=r.useState(""),[T,O]=r.useState(""),[M,R]=r.useState([]),[z,N]=r.useState(""),j=d.find(o=>o.key===p),H=Ce(o=>o,j==null?void 0:j.agentType);r.useEffect(()=>{if(!n||(K(""),B(""),I("feat"),C(""),S(""),_(""),y(""),O(""),N(""),!b))return;const o=new AbortController;return P.get("admin/developers",{signal:o.signal}).json().then(R).catch(()=>{}),()=>o.abort()},[n,b]),r.useEffect(()=>{if(!n)return;function o(D){D.key==="Escape"&&s()}return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[n,s]);async function E(o){if(o.preventDefault(),N(""),!p||!h.trim()){N(a("tasks.project_and_description_required"));return}try{await x({projectKey:p,description:h.trim(),workerId:g||void 0,developerId:T?Number(T):void 0,taskType:m,branchSlug:w.trim()||void 0,agentType:k||void 0,targetBranch:f.trim()||void 0})}catch(D){const L=D instanceof Error?D.message:a("tasks.failed_to_create_task");N(L)}}return n?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 font-mono",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},onClick:o=>{o.target===o.currentTarget&&s()},children:e.jsxs("div",{className:"w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",onClick:o=>o.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-6 py-4",children:[e.jsxs("h2",{className:"text-sm text-[var(--text-primary)]",children:["// ",a("tasks.new_task")]}),e.jsx("button",{onClick:s,className:"text-[var(--text-muted)] transition-colors hover:text-[var(--text-primary)]",children:e.jsx(be,{className:"h-4 w-4"})})]}),e.jsxs("form",{onSubmit:E,className:"px-6 py-5",children:[e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.project")}),e.jsx(A,{value:p,onChange:K,options:d.map(o=>({value:o.key,label:o.name})),placeholder:a(c?"common.loading":"tasks.select_project"),disabled:c})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.task_type")}),e.jsx(A,{value:m,onChange:I,options:ke})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.form_agent_type")}),e.jsx(A,{value:k,onChange:C,options:H})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.task_description")}),e.jsx("textarea",{value:h,onChange:o=>B(o.target.value),placeholder:a("tasks.describe_task_placeholder"),rows:4,className:"w-full resize-none rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.target_worker")}),e.jsx("input",{type:"text",value:g,onChange:o=>y(o.target.value),placeholder:a("tasks.any_able"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.branch_slug")}),e.jsx("input",{type:"text",value:w,onChange:o=>S(o.target.value),placeholder:a("tasks.branch_slug_placeholder"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.target_branch")}),e.jsx("input",{type:"text",value:f,onChange:o=>_(o.target.value),placeholder:a("tasks.target_branch_placeholder"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),b&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.assign_developer")}),e.jsx(A,{value:T,onChange:O,options:M.map(o=>({value:String(o.id),label:o.name})),placeholder:a("tasks.select_developer")})]}),z&&e.jsx("div",{className:"rounded-[4px] bg-[#2a1515] border border-[var(--destructive)]/30 px-3 py-2 text-xs text-[var(--destructive)]",children:z})]}),e.jsxs("div",{className:"mt-6 flex items-center justify-end gap-3",children:[e.jsx("button",{type:"button",onClick:s,className:"rounded-[4px] border border-[var(--border)] bg-transparent px-4 py-2 text-xs text-[var(--text-secondary)] transition-colors hover:text-[var(--text-primary)]",children:a("common.cancel")}),e.jsx("button",{type:"submit",disabled:i||!p||!h.trim(),className:"rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs text-black transition-opacity hover:opacity-90 disabled:opacity-40",children:a(i?"common.creating":"tasks.create_task")})]})]})]})}):null}function Fe({isOpen:n,onClose:s,onForceCreate:d,onViewExisting:c,similarTask:x,isLoading:i}){const{t:a}=$();return!x||!n?null:e.jsx("div",{onClick:s,style:{position:"fixed",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},children:e.jsxs("div",{onClick:b=>b.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"}}),a("tasks.dedup_title")]}),e.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.7rem",marginTop:"0.25rem"},children:a("tasks.dedup_description")})]}),e.jsxs("div",{style:{marginBottom:"1.25rem",padding:"0.75rem",border:"1px solid var(--border)",borderRadius:"4px",backgroundColor:"var(--bg-primary)"},children:[e.jsxs("div",{style:{color:"var(--text-muted)",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace"},children:["#",x.id," · ",x.status]}),e.jsx("div",{style:{color:"var(--text-primary)",fontSize:"0.75rem",marginTop:"0.375rem",lineHeight:"1.5"},children:x.description})]}),e.jsxs("div",{style:{display:"flex",gap:"0.75rem"},children:[e.jsx("button",{type:"button",onClick:s,disabled:i,className:"text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:border-[var(--text-muted)]",style:{flex:1,padding:"0.5rem",backgroundColor:"transparent",border:"1px solid var(--border)",borderRadius:"4px",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:i?"not-allowed":"pointer",opacity:i?.7:1,transition:"color 0.15s, border-color 0.15s"},children:a("common.cancel")}),e.jsx("button",{type:"button",onClick:()=>c(x.id),style:{flex:1,padding:"0.5rem",backgroundColor:"transparent",color:"var(--text-muted)",border:"1px solid var(--border)",borderRadius:"4px",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:"pointer"},children:a("tasks.view_existing")}),e.jsx("button",{type:"button",onClick:d,disabled:i,style:{flex:1,padding:"0.5rem",backgroundColor:"var(--warning)",color:"#0C0C0C",border:"none",borderRadius:"4px",fontSize:"0.75rem",fontWeight:600,fontFamily:"'JetBrains Mono', monospace",cursor:i?"not-allowed":"pointer",opacity:i?.7:1},children:a(i?"common.creating":"tasks.dedup_create_anyway")})]})]})})}function Pe({task:n}){const s=J(),d=n.status===u.COMPLETED||n.status===u.FAILED||n.status===u.CANCELLED;return e.jsxs("div",{onClick:()=>s(`/tasks/${n.id}`),className:"cursor-pointer rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 transition-colors active:bg-[var(--bg-input)]",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("span",{className:"text-[11px] text-[var(--text-primary)] leading-tight line-clamp-2",title:je(n),children:["#",n.id," ",ee(n)]}),e.jsxs("span",{className:"flex items-center gap-1.5 shrink-0",children:[d&&e.jsx("button",{onClick:c=>{c.stopPropagation(),s(`/tasks/${n.id}?action=fork`)},className:"rounded-[4px] p-1 text-[var(--text-muted)] hover:text-[var(--accent)] transition-colors",children:e.jsx(re,{className:"h-3 w-3"})}),e.jsx(te,{status:n.status})]})]}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-2 text-[11px] text-[var(--text-muted)]",children:[e.jsx("span",{children:se(n.createdAt)}),e.jsx("span",{children:"·"}),e.jsx("span",{children:n.projectKey}),n.workerName&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("span",{children:n.workerName})]})]})]})}const 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 Ve(){const n=J(),{t:s}=$(),{tasks:d,loading:c,fetchTasks:x}=X(),i=ve(t=>t.taskSeq),[a,b]=r.useState("all"),[p,K]=r.useState(""),[h,B]=r.useState(""),[m,I]=r.useState(""),[k,C]=r.useState(void 0),[w,S]=r.useState([]),f=X(t=>t.nextCursor),[_,g]=r.useState(!1);fe(r.useMemo(()=>e.jsxs("button",{onClick:()=>g(!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[y,T]=r.useState([]),[O,M]=r.useState(!1),[R,z]=r.useState([]),[N,j]=r.useState(!1),[H,E]=r.useState(!1),[o,D]=r.useState(null),[L,q]=r.useState(null),G=r.useCallback(t=>{const l={limit:String(Ie)};return a!=="all"&&(l.status=a),p&&(l.projectKey=p),h&&(l.developerId=h),t&&(l.cursor=t),l},[a,p,h]);r.useEffect(()=>{x(G(k))},[G,k,x,i]),r.useEffect(()=>{C(void 0),S([])},[a,p,h]),r.useEffect(()=>{let t=!1;return(async()=>{try{const[v,xe]=await Promise.all([P.get("web/projects").json(),P.get("web/projects/-/developers").json()]);if(t)return;T(v),z(xe)}catch{}})(),()=>{t=!0}},[]),r.useEffect(()=>{if(!_||y.length>0)return;M(!0);let t=!1;return(async()=>{try{const v=await P.get("web/projects").json();t||T(v)}catch{}finally{t||M(!1)}})(),()=>{t=!0}},[_,y.length]);const ae=r.useCallback(async t=>{j(!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();g(!1),n(`/tasks/${l.task.id}`)}catch(l){if(l instanceof ge&&l.response.status===409){try{const v=await l.response.json();if(v.confirmRequired){D({id:v.confirmRequired.taskId,description:v.confirmRequired.message,status:"active"}),q(t),g(!1),E(!0);return}}catch{}W.error(s("tasks.similar_task_exists"))}else{const v=l instanceof Error?l.message:String(l);W.error(v)}}finally{j(!1)}},[n]),oe=r.useCallback(async()=>{if(L){j(!0);try{const t=await P.post("web/tasks",{json:{...L,force:!0}}).json();E(!1),q(null),n(`/tasks/${t.task.id}`)}finally{j(!1)}}},[L,n]),F=r.useMemo(()=>{if(!m.trim())return d;const t=m.toLowerCase();return d.filter(l=>(l.name??"").toLowerCase().includes(t)||l.description.toLowerCase().includes(t)||String(l.id).includes(m))},[d,m]),ne=r.useCallback(()=>{f&&(S(t=>[...t,k??""]),C(f))},[f,k]),le=r.useCallback(()=>{S(t=>{if(t.length===0)return t;const l=t.slice(0,-1);return C(t.at(-1)||void 0),l})},[]),ce=w.length+1,ie=r.useMemo(()=>[{value:"",label:s("tasks.filter_project")},...y.map(t=>({value:t.key,label:t.name}))],[y,s]),de=r.useMemo(()=>[{value:"",label:s("tasks.filter_developer")},...R.map(t=>({value:String(t.id),label:t.name}))],[R,s]),Q=s(m?"tasks.try_adjusting_search":"tasks.create_first_task"),U=m?void 0:e.jsx("button",{onClick:()=>g(!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:()=>b(t.key),className:`shrink-0 rounded-[4px] px-3 py-2 h-10 md:h-8 text-xs transition-colors ${a===t.key?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)] bg-[var(--bg-card)] hover:text-[var(--text-secondary)]"}`,children:s(t.labelKey)},t.key))}),e.jsxs("div",{className:"flex flex-col gap-2 md:ml-auto md:flex-row md:items-center",children:[e.jsxs("div",{className:"relative md:w-52",children:[e.jsx(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=>I(t.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] py-1.5 pl-8 pr-3 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"}),m&&e.jsx("button",{onClick:()=>I(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-xs text-[var(--text-muted)] hover:text-[var(--text-secondary)]",children:"x"})]}),e.jsx(A,{value:p,onChange:K,options:ie,className:"md:w-40"}),e.jsx(A,{value:h,onChange:B,options:de,className:"md:w-40"})]})]}),e.jsx("div",{className:"hidden md:block rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:e.jsxs("table",{className:"w-full text-left",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] text-[11px] font-medium text-[#525252]",children:[e.jsx("th",{className:"w-16 px-4 py-2.5 text-right",children:s("tasks.id")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.description_col")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.status_col")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.project_col")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.assignee")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.worker")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.time")})]})}),e.jsxs("tbody",{children:[c&&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(Pe,{task:t},t.id))]}),(w.length>0||f)&&e.jsxs("div",{className:"mt-6 flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["// page ",ce]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:le,disabled:w.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:ne,disabled:!f,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(De,{isOpen:_,onClose:()=>g(!1),projects:y,projectsLoading:O,onSubmit:ae,isSubmitting:N}),e.jsx(Fe,{isOpen:H,onClose:()=>{E(!1),q(null)},onForceCreate:oe,onViewExisting:t=>{E(!1),q(null),n(`/tasks/${t}`)},similarTask:o,isLoading:N})]})}export{Ve as default};
1
+ import{R as pe,f as J,a as $,p as u,j as e,l as ee,n as me,u as ue,i as he,r,h as P,X as be,k as ve,w as fe,H as ge,t as W,x as ye,y as V,m as je}from"./index-DHpBdv1F.js";import{a as ke,u as X}from"./task-constants-CsjB14wR.js";import{T as te}from"./TaskStatusBadge-DHw2HKgB.js";import{f as se}from"./date-RFA7-ZGs.js";import{T as Ne}from"./Tooltip-C5YjudXm.js";import{G as re}from"./git-fork-JOmnLsHO.js";import{S as A}from"./Select-C-ttiP28.js";import{g as Ce}from"./agent-type-options-B1aNX95r.js";import{C as we}from"./copy-DTL-jbDm.js";import{E as Y}from"./EmptyState-C3ql5j5L.js";import{T as Z}from"./Skeleton-joUgi0KR.js";import{P as Se}from"./plus-E_rJxJAi.js";import{C as _e}from"./chevron-left-CjZsnHH6.js";import{C as Te}from"./chevron-right-bRokRq2n.js";import"./status-colors-DJc_fXaW.js";const Ee=pe.memo(function({task:s}){const d=J(),{t:c}=$(),x=(a,b)=>c(`common.${a}`,{n:b}),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(Ne,{content:me(s),children:ee(s)})}),e.jsx("td",{className:"py-3 pr-4",children:e.jsx(te,{status:s.status})}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:s.projectKey}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:s.developerName??s.creatorName??"-"}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:s.workerName??"—"}),e.jsx("td",{className:"py-3 font-mono text-xs text-[var(--text-muted)]",children:e.jsxs("span",{className:"flex items-center gap-2",children:[se(s.createdAt,x),i&&e.jsx("button",{onClick:a=>{a.stopPropagation(),d(`/tasks/${s.id}?action=fork`)},className:"shrink-0 rounded-[4px] p-1 text-[var(--text-muted)] hover:text-[var(--accent)] hover:bg-[var(--bg-input)] transition-colors",title:c("tasks.fork_task"),children:e.jsx(re,{className:"h-3 w-3"})})]})})]})});function De({isOpen:n,onClose:s,projects:d,projectsLoading:c,onSubmit:x,isSubmitting:i}){const{t:a}=$();ue(o=>o.user);const b=he(),[p,K]=r.useState(""),[h,B]=r.useState(""),[m,I]=r.useState("feat"),[k,C]=r.useState(""),[w,S]=r.useState(""),[f,_]=r.useState(""),[g,y]=r.useState(""),[T,O]=r.useState(""),[M,R]=r.useState([]),[z,N]=r.useState(""),j=d.find(o=>o.key===p),H=Ce(o=>o,j==null?void 0:j.agentType);r.useEffect(()=>{if(!n||(K(""),B(""),I("feat"),C(""),S(""),_(""),y(""),O(""),N(""),!b))return;const o=new AbortController;return P.get("admin/developers",{signal:o.signal}).json().then(R).catch(()=>{}),()=>o.abort()},[n,b]),r.useEffect(()=>{if(!n)return;function o(D){D.key==="Escape"&&s()}return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[n,s]);async function E(o){if(o.preventDefault(),N(""),!p||!h.trim()){N(a("tasks.project_and_description_required"));return}try{await x({projectKey:p,description:h.trim(),workerId:g||void 0,developerId:T?Number(T):void 0,taskType:m,branchSlug:w.trim()||void 0,agentType:k||void 0,targetBranch:f.trim()||void 0})}catch(D){const L=D instanceof Error?D.message:a("tasks.failed_to_create_task");N(L)}}return n?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 font-mono",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},onClick:o=>{o.target===o.currentTarget&&s()},children:e.jsxs("div",{className:"w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",onClick:o=>o.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-6 py-4",children:[e.jsxs("h2",{className:"text-sm text-[var(--text-primary)]",children:["// ",a("tasks.new_task")]}),e.jsx("button",{onClick:s,className:"text-[var(--text-muted)] transition-colors hover:text-[var(--text-primary)]",children:e.jsx(be,{className:"h-4 w-4"})})]}),e.jsxs("form",{onSubmit:E,className:"px-6 py-5",children:[e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.project")}),e.jsx(A,{value:p,onChange:K,options:d.map(o=>({value:o.key,label:o.name})),placeholder:a(c?"common.loading":"tasks.select_project"),disabled:c})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.task_type")}),e.jsx(A,{value:m,onChange:I,options:ke})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.form_agent_type")}),e.jsx(A,{value:k,onChange:C,options:H})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.task_description")}),e.jsx("textarea",{value:h,onChange:o=>B(o.target.value),placeholder:a("tasks.describe_task_placeholder"),rows:4,className:"w-full resize-none rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.target_worker")}),e.jsx("input",{type:"text",value:g,onChange:o=>y(o.target.value),placeholder:a("tasks.any_able"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.branch_slug")}),e.jsx("input",{type:"text",value:w,onChange:o=>S(o.target.value),placeholder:a("tasks.branch_slug_placeholder"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.target_branch")}),e.jsx("input",{type:"text",value:f,onChange:o=>_(o.target.value),placeholder:a("tasks.target_branch_placeholder"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),b&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.assign_developer")}),e.jsx(A,{value:T,onChange:O,options:M.map(o=>({value:String(o.id),label:o.name})),placeholder:a("tasks.select_developer")})]}),z&&e.jsx("div",{className:"rounded-[4px] bg-[#2a1515] border border-[var(--destructive)]/30 px-3 py-2 text-xs text-[var(--destructive)]",children:z})]}),e.jsxs("div",{className:"mt-6 flex items-center justify-end gap-3",children:[e.jsx("button",{type:"button",onClick:s,className:"rounded-[4px] border border-[var(--border)] bg-transparent px-4 py-2 text-xs text-[var(--text-secondary)] transition-colors hover:text-[var(--text-primary)]",children:a("common.cancel")}),e.jsx("button",{type:"submit",disabled:i||!p||!h.trim(),className:"rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs text-black transition-opacity hover:opacity-90 disabled:opacity-40",children:a(i?"common.creating":"tasks.create_task")})]})]})]})}):null}function Fe({isOpen:n,onClose:s,onForceCreate:d,onViewExisting:c,similarTask:x,isLoading:i}){const{t:a}=$();return!x||!n?null:e.jsx("div",{onClick:s,style:{position:"fixed",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},children:e.jsxs("div",{onClick:b=>b.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"}}),a("tasks.dedup_title")]}),e.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.7rem",marginTop:"0.25rem"},children:a("tasks.dedup_description")})]}),e.jsxs("div",{style:{marginBottom:"1.25rem",padding:"0.75rem",border:"1px solid var(--border)",borderRadius:"4px",backgroundColor:"var(--bg-primary)"},children:[e.jsxs("div",{style:{color:"var(--text-muted)",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace"},children:["#",x.id," · ",x.status]}),e.jsx("div",{style:{color:"var(--text-primary)",fontSize:"0.75rem",marginTop:"0.375rem",lineHeight:"1.5"},children:x.description})]}),e.jsxs("div",{style:{display:"flex",gap:"0.75rem"},children:[e.jsx("button",{type:"button",onClick:s,disabled:i,className:"text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:border-[var(--text-muted)]",style:{flex:1,padding:"0.5rem",backgroundColor:"transparent",border:"1px solid var(--border)",borderRadius:"4px",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:i?"not-allowed":"pointer",opacity:i?.7:1,transition:"color 0.15s, border-color 0.15s"},children:a("common.cancel")}),e.jsx("button",{type:"button",onClick:()=>c(x.id),style:{flex:1,padding:"0.5rem",backgroundColor:"transparent",color:"var(--text-muted)",border:"1px solid var(--border)",borderRadius:"4px",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:"pointer"},children:a("tasks.view_existing")}),e.jsx("button",{type:"button",onClick:d,disabled:i,style:{flex:1,padding:"0.5rem",backgroundColor:"var(--warning)",color:"#0C0C0C",border:"none",borderRadius:"4px",fontSize:"0.75rem",fontWeight:600,fontFamily:"'JetBrains Mono', monospace",cursor:i?"not-allowed":"pointer",opacity:i?.7:1},children:a(i?"common.creating":"tasks.dedup_create_anyway")})]})]})})}function Pe({task:n}){const s=J(),d=n.status===u.COMPLETED||n.status===u.FAILED||n.status===u.CANCELLED;return e.jsxs("div",{onClick:()=>s(`/tasks/${n.id}`),className:"cursor-pointer rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 transition-colors active:bg-[var(--bg-input)]",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("span",{className:"text-[11px] text-[var(--text-primary)] leading-tight line-clamp-2",title:je(n),children:["#",n.id," ",ee(n)]}),e.jsxs("span",{className:"flex items-center gap-1.5 shrink-0",children:[d&&e.jsx("button",{onClick:c=>{c.stopPropagation(),s(`/tasks/${n.id}?action=fork`)},className:"rounded-[4px] p-1 text-[var(--text-muted)] hover:text-[var(--accent)] transition-colors",children:e.jsx(re,{className:"h-3 w-3"})}),e.jsx(te,{status:n.status})]})]}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-2 text-[11px] text-[var(--text-muted)]",children:[e.jsx("span",{children:se(n.createdAt)}),e.jsx("span",{children:"·"}),e.jsx("span",{children:n.projectKey}),n.workerName&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("span",{children:n.workerName})]})]})]})}const 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 Ve(){const n=J(),{t:s}=$(),{tasks:d,loading:c,fetchTasks:x}=X(),i=ve(t=>t.taskSeq),[a,b]=r.useState("all"),[p,K]=r.useState(""),[h,B]=r.useState(""),[m,I]=r.useState(""),[k,C]=r.useState(void 0),[w,S]=r.useState([]),f=X(t=>t.nextCursor),[_,g]=r.useState(!1);fe(r.useMemo(()=>e.jsxs("button",{onClick:()=>g(!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[y,T]=r.useState([]),[O,M]=r.useState(!1),[R,z]=r.useState([]),[N,j]=r.useState(!1),[H,E]=r.useState(!1),[o,D]=r.useState(null),[L,q]=r.useState(null),G=r.useCallback(t=>{const l={limit:String(Ie)};return a!=="all"&&(l.status=a),p&&(l.projectKey=p),h&&(l.developerId=h),t&&(l.cursor=t),l},[a,p,h]);r.useEffect(()=>{x(G(k))},[G,k,x,i]),r.useEffect(()=>{C(void 0),S([])},[a,p,h]),r.useEffect(()=>{let t=!1;return(async()=>{try{const[v,xe]=await Promise.all([P.get("web/projects").json(),P.get("web/projects/-/developers").json()]);if(t)return;T(v),z(xe)}catch{}})(),()=>{t=!0}},[]),r.useEffect(()=>{if(!_||y.length>0)return;M(!0);let t=!1;return(async()=>{try{const v=await P.get("web/projects").json();t||T(v)}catch{}finally{t||M(!1)}})(),()=>{t=!0}},[_,y.length]);const ae=r.useCallback(async t=>{j(!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();g(!1),n(`/tasks/${l.task.id}`)}catch(l){if(l instanceof ge&&l.response.status===409){try{const v=await l.response.json();if(v.confirmRequired){D({id:v.confirmRequired.taskId,description:v.confirmRequired.message,status:"active"}),q(t),g(!1),E(!0);return}}catch{}W.error(s("tasks.similar_task_exists"))}else{const v=l instanceof Error?l.message:String(l);W.error(v)}}finally{j(!1)}},[n]),oe=r.useCallback(async()=>{if(L){j(!0);try{const t=await P.post("web/tasks",{json:{...L,force:!0}}).json();E(!1),q(null),n(`/tasks/${t.task.id}`)}finally{j(!1)}}},[L,n]),F=r.useMemo(()=>{if(!m.trim())return d;const t=m.toLowerCase();return d.filter(l=>(l.name??"").toLowerCase().includes(t)||l.description.toLowerCase().includes(t)||String(l.id).includes(m))},[d,m]),ne=r.useCallback(()=>{f&&(S(t=>[...t,k??""]),C(f))},[f,k]),le=r.useCallback(()=>{S(t=>{if(t.length===0)return t;const l=t.slice(0,-1);return C(t.at(-1)||void 0),l})},[]),ce=w.length+1,ie=r.useMemo(()=>[{value:"",label:s("tasks.filter_project")},...y.map(t=>({value:t.key,label:t.name}))],[y,s]),de=r.useMemo(()=>[{value:"",label:s("tasks.filter_developer")},...R.map(t=>({value:String(t.id),label:t.name}))],[R,s]),Q=s(m?"tasks.try_adjusting_search":"tasks.create_first_task"),U=m?void 0:e.jsx("button",{onClick:()=>g(!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:()=>b(t.key),className:`shrink-0 rounded-[4px] px-3 py-2 h-10 md:h-8 text-xs transition-colors ${a===t.key?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)] bg-[var(--bg-card)] hover:text-[var(--text-secondary)]"}`,children:s(t.labelKey)},t.key))}),e.jsxs("div",{className:"flex flex-col gap-2 md:ml-auto md:flex-row md:items-center",children:[e.jsxs("div",{className:"relative md:w-52",children:[e.jsx(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=>I(t.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] py-1.5 pl-8 pr-3 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"}),m&&e.jsx("button",{onClick:()=>I(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-xs text-[var(--text-muted)] hover:text-[var(--text-secondary)]",children:"x"})]}),e.jsx(A,{value:p,onChange:K,options:ie,className:"md:w-40"}),e.jsx(A,{value:h,onChange:B,options:de,className:"md:w-40"})]})]}),e.jsx("div",{className:"hidden md:block rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:e.jsxs("table",{className:"w-full text-left",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] text-[11px] font-medium text-[#525252]",children:[e.jsx("th",{className:"w-16 px-4 py-2.5 text-right",children:s("tasks.id")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.description_col")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.status_col")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.project_col")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.assignee")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.worker")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.time")})]})}),e.jsxs("tbody",{children:[c&&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(Pe,{task:t},t.id))]}),(w.length>0||f)&&e.jsxs("div",{className:"mt-6 flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["// page ",ce]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:le,disabled:w.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:ne,disabled:!f,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(De,{isOpen:_,onClose:()=>g(!1),projects:y,projectsLoading:O,onSubmit:ae,isSubmitting:N}),e.jsx(Fe,{isOpen:H,onClose:()=>{E(!1),q(null)},onForceCreate:oe,onViewExisting:t=>{E(!1),q(null),n(`/tasks/${t}`)},similarTask:o,isLoading:N})]})}export{Ve as default};
@@ -1 +1 @@
1
- import{a as l,j as a}from"./index-D_OrDcWf.js";import{a as u}from"./status-colors-CYQlZjBF.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-DHpBdv1F.js";import{a as u}from"./status-colors-DJc_fXaW.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 Z,o as ce,h as A,p as N,a as M,r as c,k as z,q as le,s as oe,j as e,X as ee,v as de,f as xe,l as me,m as ue}from"./index-D_OrDcWf.js";import{g as te,P as pe,H as he,C as fe}from"./PtyTerminal-BCi4nF3w.js";import{T as B,u as ve,a as G,g as ge}from"./task-constants-C28Dag_x.js";import{i as J,O as se}from"./OnboardingGuide-j6HspxdC.js";import{S as C,C as be}from"./Select-C9mH7t3y.js";import{a as ae}from"./status-colors-CYQlZjBF.js";import{a as je}from"./date-RFA7-ZGs.js";import{g as ke}from"./agent-type-options-snmZcyAv.js";import{u as ne}from"./useFetch-_T-wW8J0.js";import{P as $}from"./plus-DLpnTi95.js";import{R as ye}from"./rotate-ccw-CiTf48Td.js";import{W as Ne}from"./wifi-DyUmH42s.js";import"./chevron-right-CtCcIQB9.js";/**
1
+ import{c as Z,o as ce,h as A,p as N,a as M,r as c,k as z,q as le,s as oe,j as e,X as ee,v as de,f as xe,l as me,m as ue}from"./index-DHpBdv1F.js";import{g as te,M as pe,H as he,C as fe}from"./MobileTerminalShell-By5L8I0_.js";import{T as B,u as ve,a as G,g as ge}from"./task-constants-CsjB14wR.js";import{i as J,O as se}from"./OnboardingGuide-DalnDVPS.js";import{S as C,C as be}from"./Select-C-ttiP28.js";import{a as ae}from"./status-colors-DJc_fXaW.js";import{a as je}from"./date-RFA7-ZGs.js";import{g as ke}from"./agent-type-options-B1aNX95r.js";import{u as ne}from"./useFetch-CIp8RQub.js";import{P as $}from"./plus-E_rJxJAi.js";import{R as ye}from"./rotate-ccw-DKJbe7VX.js";import{W as Ne}from"./wifi-BOM9bCKp.js";import"./loader-circle-4X_s6z-L.js";import"./pencil-er_Z36Ro.js";import"./chevron-right-bRokRq2n.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -8,4 +8,4 @@ import{c as Z,o as ce,h as A,p as N,a as M,r as c,k as z,q as le,s as oe,j as e,
8
8
  *
9
9
  * This source code is licensed under the ISC license.
10
10
  * See the LICENSE file in the root directory of this source tree.
11
- */const Te=Z("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),re="overlord_home_terminal";function Se(){try{const t=localStorage.getItem(re);if(t)return JSON.parse(t)}catch{}return{pinnedTaskIds:[],activeTaskId:null}}let Q="";function F(t){const a=JSON.stringify(t);a!==Q&&(Q=a,localStorage.setItem(re,a))}const V=Se(),Ce=new Set([N.QUEUED,N.ASSIGNED,N.RUNNING,N.SUSPENDED]);let H=!1;const _e=ce((t,a)=>({pinnedTaskIds:V.pinnedTaskIds,activeTaskId:V.activeTaskId,taskMetas:{},stageConfirm:null,loading:!1,setActiveTask:s=>{t({activeTaskId:s}),F({pinnedTaskIds:a().pinnedTaskIds,activeTaskId:s})},pinTask:s=>{const{pinnedTaskIds:n}=a();if(n.includes(s))return;const l=[...n,s];t({pinnedTaskIds:l}),F({pinnedTaskIds:l,activeTaskId:a().activeTaskId})},unpinTask:s=>{const{pinnedTaskIds:n,activeTaskId:l,taskMetas:m}=a(),r=n.filter(f=>f!==s),o=l===s?r[0]??null:l,{[s]:p,...i}=m;t({pinnedTaskIds:r,activeTaskId:o,taskMetas:i}),F({pinnedTaskIds:r,activeTaskId:o})},loadActiveTasks:async()=>{if(!H){H=!0,t({loading:!0});try{const n=(await A.get("web/tasks",{searchParams:{limit:"30"}}).json()).data.filter(i=>Ce.has(i.status)),l={};for(const i of n)l[i.id]={id:i.id,name:i.name,description:i.description,status:i.status,projectKey:i.projectKey,workerName:i.workerName??null,agentType:te(i),currentStage:i.currentStage,currentSessionId:i.currentSessionId,updatedAt:i.updatedAt};const r=[...n].sort((i,f)=>f.updatedAt.localeCompare(i.updatedAt)).map(i=>i.id),{activeTaskId:o}=a(),p=o&&r.includes(o)?o:r[0]??null;t({taskMetas:l,pinnedTaskIds:r,activeTaskId:p}),F({pinnedTaskIds:r,activeTaskId:p})}catch{}finally{H=!1,t({loading:!1})}}},fetchStageConfirm:async s=>{try{const n=await A.get(`web/tasks/${s}/pending-confirm`).json();t({stageConfirm:n.confirm})}catch{t({stageConfirm:null})}},clearStageConfirm:()=>t({stageConfirm:null}),updateTaskMeta:(s,n)=>{const{taskMetas:l}=a(),m=l[s];m&&t({taskMetas:{...l,[s]:{...m,...n}}})}}));function Ie(){const[t,a]=c.useState(()=>J());c.useEffect(()=>{const n=()=>a(!0),l=()=>a(J());return window.addEventListener("onboarding-dismissed",n),window.addEventListener("storage",l),()=>{window.removeEventListener("onboarding-dismissed",n),window.removeEventListener("storage",l)}},[]);const{data:s}=ne(()=>t?Promise.resolve(null):A.get("web/dashboard/stats").json(),[t]);return t||!s?null:{activeTasks:(s.active_tasks??0)+(s.queued_tasks??0),totalWorkers:s.online_workers??0,totalProjects:s.project_count??0,totalDevelopers:s.developer_count??0}}function Ee({taskId:t,confirm:a,onSubmitted:s}){const{t:n}=M(),[l,m]=c.useState(a.timeout),[r,o]=c.useState(!1);c.useEffect(()=>{m(a.timeout);const i=setInterval(()=>{m(f=>f<=1?(clearInterval(i),0):f-1)},1e3);return()=>clearInterval(i)},[a.timeout,a.stageName]);const p=c.useCallback(async i=>{o(!0);try{await A.post(`web/tasks/${t}/confirm-stage`,{json:{stageName:a.stageName,approved:i}}),s()}catch{}finally{o(!1)}},[t,a.stageName,s]);return e.jsxs("div",{className:"flex items-center justify-between gap-2 border-b-2 border-[var(--warning)] bg-[var(--warning)]/10 px-3 py-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(fe,{className:"h-3.5 w-3.5 shrink-0 text-[var(--warning)]"}),e.jsxs("span",{className:"truncate text-xs text-[var(--text-primary)]",children:["// stage: ",a.stageName]}),e.jsx("span",{className:"shrink-0 text-xs text-[var(--warning)]",children:je(l)})]}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx("button",{onClick:()=>p(!1),disabled:r,className:"rounded-[4px] border border-[var(--border)] px-2 py-1 text-[11px] text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors disabled:opacity-50",children:n("tasks.reject")}),e.jsx("button",{onClick:()=>p(!0),disabled:r,className:"rounded-[4px] bg-[var(--accent)] px-2 py-1 text-[11px] text-black hover:opacity-90 transition-opacity disabled:opacity-50",children:n(r?"tasks.stage_submitting":"tasks.confirm_and_proceed")})]})]})}function Ae({projectKey:t,onProjectChange:a,onCreated:s}){const{t:n}=M(),l=ve(x=>x.createTask),[m,r]=c.useState(""),[o,p]=c.useState("feat"),[i,f]=c.useState(void 0),[h,_]=c.useState(!1),[I,E]=c.useState(!1),[U,D]=c.useState(!1),{data:w}=ne(()=>A.get("web/projects").json(),[]),g=c.useMemo(()=>{const x=(w??[]).map(R=>({value:R.key,label:R.key}));return[{value:"",label:n("terminal_home.all_projects")},...x]},[w,n]),b=c.useMemo(()=>(w??[]).find(x=>x.key===t)??null,[w,t]),k=c.useMemo(()=>ke(x=>x,b==null?void 0:b.agentType),[b==null?void 0:b.agentType]),T=c.useRef(!1);c.useEffect(()=>{if(!T.current){if(t){T.current=!0;return}g.length>1&&(a(g[1].value),T.current=!0)}},[t,g,a]),c.useEffect(()=>{f(void 0)},[t]);const u=i??"",O=c.useCallback(x=>{f(x||void 0)},[]),y=!!t&&!!m.trim();function v(){y&&E(!0)}async function S(){if(E(!1),!!y){_(!0);try{const x=await l({projectKey:t,description:m.trim(),taskType:o,agentType:i||void 0});r(""),s(x.id)}catch{}finally{_(!1)}}}const L=n("terminal_home.confirm_create_message").replace("{taskType}",o).replace("{projectKey}",t).replace("{description}",m.trim()),P="flex-1 rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-2 py-1.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden md:flex items-center gap-2 border-b border-[var(--border)] bg-[var(--bg-card)] px-3 py-2",children:[e.jsx("div",{className:"w-[140px]",children:e.jsx(C,{value:t,onChange:a,options:g,placeholder:n("terminal_home.select_project")})}),e.jsx("div",{className:"w-[100px]",children:e.jsx(C,{value:o,onChange:p,options:G})}),e.jsx("div",{className:"w-[120px]",children:e.jsx(C,{value:u,onChange:O,options:k,placeholder:n("tasks.form_agent_type"),disabled:h||!t})}),e.jsx("input",{type:"text",value:m,onChange:x=>r(x.target.value),onKeyDown:x=>x.key==="Enter"&&v(),placeholder:n("terminal_home.task_description_placeholder"),className:P,disabled:h}),e.jsxs("button",{onClick:v,disabled:h||!y,className:"flex items-center gap-1 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",children:[e.jsx($,{className:"h-3 w-3"}),n(h?"common.creating":"terminal_home.new_task")]})]}),e.jsx("div",{className:"md:hidden border-b border-[var(--border)] bg-[var(--bg-card)]",children:U?e.jsxs("div",{className:"flex flex-col gap-2 p-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex-1",children:e.jsx(C,{value:t,onChange:a,options:g,placeholder:n("terminal_home.select_project")})}),e.jsx("div",{className:"w-[100px]",children:e.jsx(C,{value:o,onChange:p,options:G})}),e.jsx("div",{className:"w-[120px]",children:e.jsx(C,{value:u,onChange:O,options:k,placeholder:n("tasks.form_agent_type"),disabled:h||!t})}),e.jsx("button",{onClick:()=>D(!1),className:"p-1 text-[var(--text-muted)]",children:e.jsx(ee,{className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",value:m,onChange:x=>r(x.target.value),onKeyDown:x=>x.key==="Enter"&&v(),placeholder:n("terminal_home.task_description_placeholder"),className:P,disabled:h}),e.jsx("button",{onClick:v,disabled:h||!y,className:"rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",children:e.jsx($,{className:"h-3 w-3"})})]})]}):e.jsxs("button",{onClick:()=>D(!0),className:"flex w-full items-center justify-center gap-1 py-2 text-xs text-[var(--accent)] hover:opacity-80",children:[e.jsx($,{className:"h-3.5 w-3.5"}),n("terminal_home.new_task")]})}),e.jsx(de,{isOpen:I,onClose:()=>E(!1),onConfirm:S,title:n("terminal_home.confirm_create_title"),message:L,confirmVariant:"accent",confirmLabel:n("terminal_home.new_task"),isLoading:h})]})}function Y({status:t,size:a}){const s=t===N.SUSPENDED,n=ae(t),l=a==="sm"?"h-1.5 w-1.5":"h-2 w-2";return e.jsx("span",{className:`${l} shrink-0 rounded-full ${s?"animate-pulse":""}`,style:{backgroundColor:s?"var(--warning)":n}})}function Me({tasks:t,activeId:a,onSelect:s,onUnpin:n,children:l}){const m=xe();return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden md:flex flex-col border-r border-[var(--border)] bg-[var(--bg-card)] overflow-y-auto",style:{width:200,minWidth:200},children:[e.jsx("div",{className:"border-b border-[var(--border)] px-3 py-2",children:e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:"// active tasks"})}),t.length===0?e.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:"no active tasks"})}):e.jsx("div",{className:"flex-1",children:t.map(r=>{const o=r.id===a;return e.jsxs("div",{onClick:()=>s(r.id),className:`group flex items-center gap-2 px-3 py-2 cursor-pointer transition-colors ${o?"bg-[var(--accent)]/10 text-[var(--text-primary)]":"text-[var(--text-secondary)] hover:bg-[var(--bg-input)] hover:text-[var(--text-primary)]"}`,children:[e.jsx(Y,{status:r.status,size:"md"}),e.jsxs("div",{className:"flex-1 min-w-0",title:ue(r),children:[e.jsxs("div",{className:"truncate text-xs",children:["#",r.id," ",me(r)]}),e.jsx("div",{className:"text-[10px] text-[var(--text-muted)]",children:r.projectKey})]}),e.jsx("button",{onClick:p=>{p.stopPropagation(),n(r.id)},className:"hidden group-hover:flex items-center justify-center shrink-0 w-5 h-5 text-[var(--text-muted)] hover:text-[var(--text-primary)]",title:"unpin",children:e.jsx(ee,{className:"h-3 w-3"})}),e.jsx("button",{onClick:p=>{p.stopPropagation(),m(`/tasks/${r.id}`)},className:"hidden group-hover:flex items-center justify-center shrink-0 w-5 h-5 text-[var(--text-muted)] hover:text-[var(--accent)]",title:"open detail",children:e.jsx("span",{className:"text-[10px] leading-none",children:"→"})})]},r.id)})})]}),e.jsxs("div",{className:"flex flex-col md:hidden",children:[e.jsx("div",{className:"flex items-center gap-1 overflow-x-auto no-scrollbar border-b border-[var(--border)] bg-[var(--bg-card)] px-2",style:{height:44},children:t.length===0?e.jsx("div",{className:"flex items-center justify-center w-full",children:e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:"no active tasks"})}):t.map(r=>{const o=r.id===a;return e.jsxs("button",{onClick:()=>s(r.id),className:`flex shrink-0 items-center gap-1.5 px-3 border-b-2 transition-colors ${o?"border-[var(--accent)] text-[var(--text-primary)]":"border-transparent text-[var(--text-secondary)]"}`,style:{height:44},children:[e.jsx(Y,{status:r.status,size:"sm"}),e.jsxs("span",{className:"text-[11px] whitespace-nowrap",children:["#",r.id]})]},r.id)})}),l]})]})}function De({task:t,takeoverState:a,onTakeover:s,onRelease:n}){const l=ae(t.status),m=ge(t.agentType),r=a==="manual",o=te(t);return e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] bg-[var(--bg-card)] px-3",style:{height:36,minHeight:36},children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:t.projectKey}),e.jsxs("span",{className:"text-[11px]",style:{color:l},children:[t.status.toLowerCase()," / ",m]}),t.currentStage&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"hidden md:inline text-[11px] text-[var(--text-muted)]",children:["// stage: ",t.currentStage]}),e.jsxs("span",{className:"md:hidden text-[11px] text-[var(--text-muted)]",children:["stage: ",t.currentStage]})]}),e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["agent: ",o]}),t.workerName&&e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["worker: ",t.workerName]})]}),e.jsx("div",{className:"flex items-center gap-1",children:!B.includes(t.status)&&(r?e.jsxs("button",{onClick:n,className:"flex items-center gap-1.5 rounded-[4px] px-2.5 py-0.5 text-[11px] font-medium text-[var(--accent)]",style:{backgroundColor:"rgba(34,197,94,0.12)"},children:[e.jsx(ye,{className:"h-3 w-3"}),e.jsx("span",{className:"hidden md:inline",children:"restore auto"})]}):e.jsxs("button",{onClick:s,disabled:a==="requesting",className:"flex items-center gap-1.5 rounded-[4px] px-2.5 py-0.5 text-[11px] font-medium text-[var(--warning)] disabled:opacity-50",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:[e.jsx(he,{className:"h-3 w-3"}),e.jsx("span",{className:"hidden md:inline",children:"take over"})]}))})]})}function Oe({task:t,ptyStatus:a}){const s=a==="connected";return e.jsxs("div",{className:"flex items-center justify-between border-t border-[var(--border)] bg-[var(--bg-card)] px-3",style:{height:28,minHeight:28},children:[e.jsx("span",{className:"text-[10px] text-[var(--text-muted)]",children:t.currentStage?`stage: ${t.currentStage}`:`task #${t.id}`}),e.jsxs("span",{className:`flex items-center gap-1 text-[10px] ${s?"text-[var(--accent)]":"text-[var(--text-muted)]"}`,children:[s?e.jsx(Ne,{className:"h-2.5 w-2.5"}):e.jsx(Te,{className:"h-2.5 w-2.5"}),s?"connected":a]})]})}function K({onboardingData:t}){const[a,s]=c.useState(!1),{t:n}=M();return t?a?e.jsxs("div",{className:"border-b border-[var(--accent)]/30",children:[e.jsxs("button",{onClick:()=>s(!1),className:"flex w-full items-center justify-between bg-[var(--bg-card)] px-3 py-1.5 transition-colors hover:bg-[var(--bg-input)]",children:[e.jsx("span",{className:"text-[11px] text-[var(--accent)]",children:n("onboarding.getting_started")}),e.jsx(we,{className:"h-3 w-3 text-[var(--text-muted)]"})]}),e.jsx("div",{className:"max-h-[300px] overflow-y-auto",children:e.jsx(se,{data:t})})]}):e.jsxs("button",{onClick:()=>s(!0),className:"flex w-full items-center justify-between border-b border-[var(--accent)]/30 bg-[var(--bg-card)] px-3 py-1.5 transition-colors hover:bg-[var(--bg-input)]",style:{height:36},children:[e.jsx("span",{className:"text-[11px] text-[var(--accent)]",children:n("onboarding.getting_started")}),e.jsx(be,{className:"h-3 w-3 text-[var(--text-muted)]"})]}):null}function X({onboardingData:t}){const{t:a}=M();return e.jsx("div",{className:`flex flex-1 flex-col items-center p-4 md:p-6 ${t?"overflow-auto":"justify-center"}`,children:t?e.jsx("div",{className:"w-full max-w-lg",children:e.jsx(se,{data:t})}):e.jsxs("div",{className:"text-center",children:[e.jsxs("div",{className:"mb-3 text-3xl text-[var(--border)]",children:[">","_"]}),e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:a("terminal_home.no_active_tasks")}),e.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:a("terminal_home.create_task_hint")})]})})}function Qe(){const{t}=M(),{pinnedTaskIds:a,activeTaskId:s,taskMetas:n,stageConfirm:l,loading:m,setActiveTask:r,pinTask:o,unpinTask:p,loadActiveTasks:i,fetchStageConfirm:f,clearStageConfirm:h,updateTaskMeta:_}=_e(),I=c.useRef(null),[E,U]=c.useState("disconnected"),[D,w]=c.useState("auto"),[g,b]=c.useState(""),k=z(d=>d.lastEvent),T=z(d=>d.status),u=s?n[s]??null:null,O=u?B.includes(u.status):!1,y=c.useRef(!1);c.useEffect(()=>{!y.current&&u&&(b(u.projectKey),y.current=!0)},[u]);const v=c.useMemo(()=>{const d=a.map(j=>n[j]).filter(Boolean);return g?d.filter(j=>j.projectKey===g):d},[a,n,g]);c.useEffect(()=>{v.length>0&&s&&!v.some(d=>d.id===s)&&r(v[0].id)},[v,s,r]);const S=Ie();le(u?oe(u):null),c.useEffect(()=>{i()},[i]),c.useEffect(()=>{s&&(u==null?void 0:u.status)===N.SUSPENDED?f(s):h()},[s,u==null?void 0:u.status,f,h]),c.useEffect(()=>{if(k){if(k.event==="task_status_changed"){const{taskId:d,status:j,currentStage:W}=k,q={status:j,updatedAt:new Date().toISOString()};W!==void 0&&(q.currentStage=W),_(d,q),j===N.SUSPENDED&&d===s&&f(d),B.includes(j)&&d===s&&h()}k.event==="task_created"&&i()}},[k,s,f,h,_,i]),c.useEffect(()=>{if(T==="connected")return;const j=setInterval(()=>{document.visibilityState!=="hidden"&&i()},15e3);return()=>clearInterval(j)},[T,i]);const L=c.useCallback(d=>{o(d),r(d),i()},[o,r,i]),P=c.useCallback(()=>{h(),i()},[h,i]),x=c.useCallback(()=>{var d;(d=I.current)==null||d.requestTakeover()},[]),R=c.useCallback(()=>{var d;(d=I.current)==null||d.releaseTakeover()},[]);if(m&&a.length===0)return e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:t("common.loading")})});const ie=v.length>0;return e.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsx(Ae,{projectKey:g,onProjectChange:b,onCreated:L}),e.jsx("div",{className:"flex flex-col md:flex-row flex-1 overflow-hidden",children:ie?e.jsxs(e.Fragment,{children:[e.jsx(Me,{tasks:v,activeId:s,onSelect:r,onUnpin:p,children:e.jsx("div",{className:"md:hidden",children:e.jsx(K,{onboardingData:S})})}),e.jsx("div",{className:"flex flex-1 flex-col overflow-hidden",children:u?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden md:block",children:e.jsx(K,{onboardingData:S})}),e.jsx(De,{task:u,takeoverState:D,onTakeover:x,onRelease:R}),l&&s&&e.jsx(Ee,{taskId:s,confirm:l,onSubmitted:P}),e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:e.jsx(pe,{taskId:s,sessionId:u.currentSessionId??void 0,taskFinished:O,onStatusChange:U,onTakeoverChange:w,ref:I},s)}),e.jsx(Oe,{task:u,ptyStatus:E})]}):e.jsx(X,{onboardingData:S})})]}):e.jsx(X,{onboardingData:S})})]})}export{Qe as default};
11
+ */const Te=Z("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),re="overlord_home_terminal";function Se(){try{const t=localStorage.getItem(re);if(t)return JSON.parse(t)}catch{}return{pinnedTaskIds:[],activeTaskId:null}}let Q="";function F(t){const a=JSON.stringify(t);a!==Q&&(Q=a,localStorage.setItem(re,a))}const V=Se(),Ce=new Set([N.QUEUED,N.ASSIGNED,N.RUNNING,N.SUSPENDED]);let H=!1;const _e=ce((t,a)=>({pinnedTaskIds:V.pinnedTaskIds,activeTaskId:V.activeTaskId,taskMetas:{},stageConfirm:null,loading:!1,setActiveTask:s=>{t({activeTaskId:s}),F({pinnedTaskIds:a().pinnedTaskIds,activeTaskId:s})},pinTask:s=>{const{pinnedTaskIds:n}=a();if(n.includes(s))return;const l=[...n,s];t({pinnedTaskIds:l}),F({pinnedTaskIds:l,activeTaskId:a().activeTaskId})},unpinTask:s=>{const{pinnedTaskIds:n,activeTaskId:l,taskMetas:m}=a(),r=n.filter(f=>f!==s),o=l===s?r[0]??null:l,{[s]:p,...i}=m;t({pinnedTaskIds:r,activeTaskId:o,taskMetas:i}),F({pinnedTaskIds:r,activeTaskId:o})},loadActiveTasks:async()=>{if(!H){H=!0,t({loading:!0});try{const n=(await A.get("web/tasks",{searchParams:{limit:"30"}}).json()).data.filter(i=>Ce.has(i.status)),l={};for(const i of n)l[i.id]={id:i.id,name:i.name,description:i.description,status:i.status,projectKey:i.projectKey,workerName:i.workerName??null,agentType:te(i),currentStage:i.currentStage,currentSessionId:i.currentSessionId,updatedAt:i.updatedAt};const r=[...n].sort((i,f)=>f.updatedAt.localeCompare(i.updatedAt)).map(i=>i.id),{activeTaskId:o}=a(),p=o&&r.includes(o)?o:r[0]??null;t({taskMetas:l,pinnedTaskIds:r,activeTaskId:p}),F({pinnedTaskIds:r,activeTaskId:p})}catch{}finally{H=!1,t({loading:!1})}}},fetchStageConfirm:async s=>{try{const n=await A.get(`web/tasks/${s}/pending-confirm`).json();t({stageConfirm:n.confirm})}catch{t({stageConfirm:null})}},clearStageConfirm:()=>t({stageConfirm:null}),updateTaskMeta:(s,n)=>{const{taskMetas:l}=a(),m=l[s];m&&t({taskMetas:{...l,[s]:{...m,...n}}})}}));function Ie(){const[t,a]=c.useState(()=>J());c.useEffect(()=>{const n=()=>a(!0),l=()=>a(J());return window.addEventListener("onboarding-dismissed",n),window.addEventListener("storage",l),()=>{window.removeEventListener("onboarding-dismissed",n),window.removeEventListener("storage",l)}},[]);const{data:s}=ne(()=>t?Promise.resolve(null):A.get("web/dashboard/stats").json(),[t]);return t||!s?null:{activeTasks:(s.active_tasks??0)+(s.queued_tasks??0),totalWorkers:s.online_workers??0,totalProjects:s.project_count??0,totalDevelopers:s.developer_count??0}}function Ee({taskId:t,confirm:a,onSubmitted:s}){const{t:n}=M(),[l,m]=c.useState(a.timeout),[r,o]=c.useState(!1);c.useEffect(()=>{m(a.timeout);const i=setInterval(()=>{m(f=>f<=1?(clearInterval(i),0):f-1)},1e3);return()=>clearInterval(i)},[a.timeout,a.stageName]);const p=c.useCallback(async i=>{o(!0);try{await A.post(`web/tasks/${t}/confirm-stage`,{json:{stageName:a.stageName,approved:i}}),s()}catch{}finally{o(!1)}},[t,a.stageName,s]);return e.jsxs("div",{className:"flex items-center justify-between gap-2 border-b-2 border-[var(--warning)] bg-[var(--warning)]/10 px-3 py-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(fe,{className:"h-3.5 w-3.5 shrink-0 text-[var(--warning)]"}),e.jsxs("span",{className:"truncate text-xs text-[var(--text-primary)]",children:["// stage: ",a.stageName]}),e.jsx("span",{className:"shrink-0 text-xs text-[var(--warning)]",children:je(l)})]}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx("button",{onClick:()=>p(!1),disabled:r,className:"rounded-[4px] border border-[var(--border)] px-2 py-1 text-[11px] text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors disabled:opacity-50",children:n("tasks.reject")}),e.jsx("button",{onClick:()=>p(!0),disabled:r,className:"rounded-[4px] bg-[var(--accent)] px-2 py-1 text-[11px] text-black hover:opacity-90 transition-opacity disabled:opacity-50",children:n(r?"tasks.stage_submitting":"tasks.confirm_and_proceed")})]})]})}function Ae({projectKey:t,onProjectChange:a,onCreated:s}){const{t:n}=M(),l=ve(x=>x.createTask),[m,r]=c.useState(""),[o,p]=c.useState("feat"),[i,f]=c.useState(void 0),[h,_]=c.useState(!1),[I,E]=c.useState(!1),[U,D]=c.useState(!1),{data:w}=ne(()=>A.get("web/projects").json(),[]),g=c.useMemo(()=>{const x=(w??[]).map(R=>({value:R.key,label:R.key}));return[{value:"",label:n("terminal_home.all_projects")},...x]},[w,n]),b=c.useMemo(()=>(w??[]).find(x=>x.key===t)??null,[w,t]),k=c.useMemo(()=>ke(x=>x,b==null?void 0:b.agentType),[b==null?void 0:b.agentType]),T=c.useRef(!1);c.useEffect(()=>{if(!T.current){if(t){T.current=!0;return}g.length>1&&(a(g[1].value),T.current=!0)}},[t,g,a]),c.useEffect(()=>{f(void 0)},[t]);const u=i??"",O=c.useCallback(x=>{f(x||void 0)},[]),y=!!t&&!!m.trim();function v(){y&&E(!0)}async function S(){if(E(!1),!!y){_(!0);try{const x=await l({projectKey:t,description:m.trim(),taskType:o,agentType:i||void 0});r(""),s(x.id)}catch{}finally{_(!1)}}}const L=n("terminal_home.confirm_create_message").replace("{taskType}",o).replace("{projectKey}",t).replace("{description}",m.trim()),P="flex-1 rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-2 py-1.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden md:flex items-center gap-2 border-b border-[var(--border)] bg-[var(--bg-card)] px-3 py-2",children:[e.jsx("div",{className:"w-[140px]",children:e.jsx(C,{value:t,onChange:a,options:g,placeholder:n("terminal_home.select_project")})}),e.jsx("div",{className:"w-[100px]",children:e.jsx(C,{value:o,onChange:p,options:G})}),e.jsx("div",{className:"w-[120px]",children:e.jsx(C,{value:u,onChange:O,options:k,placeholder:n("tasks.form_agent_type"),disabled:h||!t})}),e.jsx("input",{type:"text",value:m,onChange:x=>r(x.target.value),onKeyDown:x=>x.key==="Enter"&&v(),placeholder:n("terminal_home.task_description_placeholder"),className:P,disabled:h}),e.jsxs("button",{onClick:v,disabled:h||!y,className:"flex items-center gap-1 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",children:[e.jsx($,{className:"h-3 w-3"}),n(h?"common.creating":"terminal_home.new_task")]})]}),e.jsx("div",{className:"md:hidden border-b border-[var(--border)] bg-[var(--bg-card)]",children:U?e.jsxs("div",{className:"flex flex-col gap-2 p-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex-1",children:e.jsx(C,{value:t,onChange:a,options:g,placeholder:n("terminal_home.select_project")})}),e.jsx("div",{className:"w-[100px]",children:e.jsx(C,{value:o,onChange:p,options:G})}),e.jsx("div",{className:"w-[120px]",children:e.jsx(C,{value:u,onChange:O,options:k,placeholder:n("tasks.form_agent_type"),disabled:h||!t})}),e.jsx("button",{onClick:()=>D(!1),className:"p-1 text-[var(--text-muted)]",children:e.jsx(ee,{className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",value:m,onChange:x=>r(x.target.value),onKeyDown:x=>x.key==="Enter"&&v(),placeholder:n("terminal_home.task_description_placeholder"),className:P,disabled:h}),e.jsx("button",{onClick:v,disabled:h||!y,className:"rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",children:e.jsx($,{className:"h-3 w-3"})})]})]}):e.jsxs("button",{onClick:()=>D(!0),className:"flex w-full items-center justify-center gap-1 py-2 text-xs text-[var(--accent)] hover:opacity-80",children:[e.jsx($,{className:"h-3.5 w-3.5"}),n("terminal_home.new_task")]})}),e.jsx(de,{isOpen:I,onClose:()=>E(!1),onConfirm:S,title:n("terminal_home.confirm_create_title"),message:L,confirmVariant:"accent",confirmLabel:n("terminal_home.new_task"),isLoading:h})]})}function Y({status:t,size:a}){const s=t===N.SUSPENDED,n=ae(t),l=a==="sm"?"h-1.5 w-1.5":"h-2 w-2";return e.jsx("span",{className:`${l} shrink-0 rounded-full ${s?"animate-pulse":""}`,style:{backgroundColor:s?"var(--warning)":n}})}function Me({tasks:t,activeId:a,onSelect:s,onUnpin:n,children:l}){const m=xe();return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden md:flex flex-col border-r border-[var(--border)] bg-[var(--bg-card)] overflow-y-auto",style:{width:200,minWidth:200},children:[e.jsx("div",{className:"border-b border-[var(--border)] px-3 py-2",children:e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:"// active tasks"})}),t.length===0?e.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:"no active tasks"})}):e.jsx("div",{className:"flex-1",children:t.map(r=>{const o=r.id===a;return e.jsxs("div",{onClick:()=>s(r.id),className:`group flex items-center gap-2 px-3 py-2 cursor-pointer transition-colors ${o?"bg-[var(--accent)]/10 text-[var(--text-primary)]":"text-[var(--text-secondary)] hover:bg-[var(--bg-input)] hover:text-[var(--text-primary)]"}`,children:[e.jsx(Y,{status:r.status,size:"md"}),e.jsxs("div",{className:"flex-1 min-w-0",title:ue(r),children:[e.jsxs("div",{className:"truncate text-xs",children:["#",r.id," ",me(r)]}),e.jsx("div",{className:"text-[10px] text-[var(--text-muted)]",children:r.projectKey})]}),e.jsx("button",{onClick:p=>{p.stopPropagation(),n(r.id)},className:"hidden group-hover:flex items-center justify-center shrink-0 w-5 h-5 text-[var(--text-muted)] hover:text-[var(--text-primary)]",title:"unpin",children:e.jsx(ee,{className:"h-3 w-3"})}),e.jsx("button",{onClick:p=>{p.stopPropagation(),m(`/tasks/${r.id}`)},className:"hidden group-hover:flex items-center justify-center shrink-0 w-5 h-5 text-[var(--text-muted)] hover:text-[var(--accent)]",title:"open detail",children:e.jsx("span",{className:"text-[10px] leading-none",children:"→"})})]},r.id)})})]}),e.jsxs("div",{className:"flex flex-col md:hidden",children:[e.jsx("div",{className:"flex items-center gap-1 overflow-x-auto no-scrollbar border-b border-[var(--border)] bg-[var(--bg-card)] px-2",style:{height:44},children:t.length===0?e.jsx("div",{className:"flex items-center justify-center w-full",children:e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:"no active tasks"})}):t.map(r=>{const o=r.id===a;return e.jsxs("button",{onClick:()=>s(r.id),className:`flex shrink-0 items-center gap-1.5 px-3 border-b-2 transition-colors ${o?"border-[var(--accent)] text-[var(--text-primary)]":"border-transparent text-[var(--text-secondary)]"}`,style:{height:44},children:[e.jsx(Y,{status:r.status,size:"sm"}),e.jsxs("span",{className:"text-[11px] whitespace-nowrap",children:["#",r.id]})]},r.id)})}),l]})]})}function De({task:t,takeoverState:a,onTakeover:s,onRelease:n}){const l=ae(t.status),m=ge(t.agentType),r=a==="manual",o=te(t);return e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] bg-[var(--bg-card)] px-3",style:{height:36,minHeight:36},children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:t.projectKey}),e.jsxs("span",{className:"text-[11px]",style:{color:l},children:[t.status.toLowerCase()," / ",m]}),t.currentStage&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"hidden md:inline text-[11px] text-[var(--text-muted)]",children:["// stage: ",t.currentStage]}),e.jsxs("span",{className:"md:hidden text-[11px] text-[var(--text-muted)]",children:["stage: ",t.currentStage]})]}),e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["agent: ",o]}),t.workerName&&e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["worker: ",t.workerName]})]}),e.jsx("div",{className:"flex items-center gap-1",children:!B.includes(t.status)&&(r?e.jsxs("button",{onClick:n,className:"flex items-center gap-1.5 rounded-[4px] px-2.5 py-0.5 text-[11px] font-medium text-[var(--accent)]",style:{backgroundColor:"rgba(34,197,94,0.12)"},children:[e.jsx(ye,{className:"h-3 w-3"}),e.jsx("span",{className:"hidden md:inline",children:"restore auto"})]}):e.jsxs("button",{onClick:s,disabled:a==="requesting",className:"flex items-center gap-1.5 rounded-[4px] px-2.5 py-0.5 text-[11px] font-medium text-[var(--warning)] disabled:opacity-50",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:[e.jsx(he,{className:"h-3 w-3"}),e.jsx("span",{className:"hidden md:inline",children:"take over"})]}))})]})}function Oe({task:t,ptyStatus:a}){const s=a==="connected";return e.jsxs("div",{className:"flex items-center justify-between border-t border-[var(--border)] bg-[var(--bg-card)] px-3",style:{height:28,minHeight:28},children:[e.jsx("span",{className:"text-[10px] text-[var(--text-muted)]",children:t.currentStage?`stage: ${t.currentStage}`:`task #${t.id}`}),e.jsxs("span",{className:`flex items-center gap-1 text-[10px] ${s?"text-[var(--accent)]":"text-[var(--text-muted)]"}`,children:[s?e.jsx(Ne,{className:"h-2.5 w-2.5"}):e.jsx(Te,{className:"h-2.5 w-2.5"}),s?"connected":a]})]})}function K({onboardingData:t}){const[a,s]=c.useState(!1),{t:n}=M();return t?a?e.jsxs("div",{className:"border-b border-[var(--accent)]/30",children:[e.jsxs("button",{onClick:()=>s(!1),className:"flex w-full items-center justify-between bg-[var(--bg-card)] px-3 py-1.5 transition-colors hover:bg-[var(--bg-input)]",children:[e.jsx("span",{className:"text-[11px] text-[var(--accent)]",children:n("onboarding.getting_started")}),e.jsx(we,{className:"h-3 w-3 text-[var(--text-muted)]"})]}),e.jsx("div",{className:"max-h-[300px] overflow-y-auto",children:e.jsx(se,{data:t})})]}):e.jsxs("button",{onClick:()=>s(!0),className:"flex w-full items-center justify-between border-b border-[var(--accent)]/30 bg-[var(--bg-card)] px-3 py-1.5 transition-colors hover:bg-[var(--bg-input)]",style:{height:36},children:[e.jsx("span",{className:"text-[11px] text-[var(--accent)]",children:n("onboarding.getting_started")}),e.jsx(be,{className:"h-3 w-3 text-[var(--text-muted)]"})]}):null}function X({onboardingData:t}){const{t:a}=M();return e.jsx("div",{className:`flex flex-1 flex-col items-center p-4 md:p-6 ${t?"overflow-auto":"justify-center"}`,children:t?e.jsx("div",{className:"w-full max-w-lg",children:e.jsx(se,{data:t})}):e.jsxs("div",{className:"text-center",children:[e.jsxs("div",{className:"mb-3 text-3xl text-[var(--border)]",children:[">","_"]}),e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:a("terminal_home.no_active_tasks")}),e.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:a("terminal_home.create_task_hint")})]})})}function Ye(){const{t}=M(),{pinnedTaskIds:a,activeTaskId:s,taskMetas:n,stageConfirm:l,loading:m,setActiveTask:r,pinTask:o,unpinTask:p,loadActiveTasks:i,fetchStageConfirm:f,clearStageConfirm:h,updateTaskMeta:_}=_e(),I=c.useRef(null),[E,U]=c.useState("disconnected"),[D,w]=c.useState("auto"),[g,b]=c.useState(""),k=z(d=>d.lastEvent),T=z(d=>d.status),u=s?n[s]??null:null,O=u?B.includes(u.status):!1,y=c.useRef(!1);c.useEffect(()=>{!y.current&&u&&(b(u.projectKey),y.current=!0)},[u]);const v=c.useMemo(()=>{const d=a.map(j=>n[j]).filter(Boolean);return g?d.filter(j=>j.projectKey===g):d},[a,n,g]);c.useEffect(()=>{v.length>0&&s&&!v.some(d=>d.id===s)&&r(v[0].id)},[v,s,r]);const S=Ie();le(u?oe(u):null),c.useEffect(()=>{i()},[i]),c.useEffect(()=>{s&&(u==null?void 0:u.status)===N.SUSPENDED?f(s):h()},[s,u==null?void 0:u.status,f,h]),c.useEffect(()=>{if(k){if(k.event==="task_status_changed"){const{taskId:d,status:j,currentStage:W}=k,q={status:j,updatedAt:new Date().toISOString()};W!==void 0&&(q.currentStage=W),_(d,q),j===N.SUSPENDED&&d===s&&f(d),B.includes(j)&&d===s&&h()}k.event==="task_created"&&i()}},[k,s,f,h,_,i]),c.useEffect(()=>{if(T==="connected")return;const j=setInterval(()=>{document.visibilityState!=="hidden"&&i()},15e3);return()=>clearInterval(j)},[T,i]);const L=c.useCallback(d=>{o(d),r(d),i()},[o,r,i]),P=c.useCallback(()=>{h(),i()},[h,i]),x=c.useCallback(()=>{var d;(d=I.current)==null||d.requestTakeover()},[]),R=c.useCallback(()=>{var d;(d=I.current)==null||d.releaseTakeover()},[]);if(m&&a.length===0)return e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:t("common.loading")})});const ie=v.length>0;return e.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsx(Ae,{projectKey:g,onProjectChange:b,onCreated:L}),e.jsx("div",{className:"flex flex-col md:flex-row flex-1 overflow-hidden",children:ie?e.jsxs(e.Fragment,{children:[e.jsx(Me,{tasks:v,activeId:s,onSelect:r,onUnpin:p,children:e.jsx("div",{className:"md:hidden",children:e.jsx(K,{onboardingData:S})})}),e.jsx("div",{className:"flex flex-1 flex-col overflow-hidden",children:u?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden md:block",children:e.jsx(K,{onboardingData:S})}),e.jsx(De,{task:u,takeoverState:D,onTakeover:x,onRelease:R}),l&&s&&e.jsx(Ee,{taskId:s,confirm:l,onSubmitted:P}),e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:e.jsx(pe,{taskId:s,sessionId:u.currentSessionId??void 0,taskFinished:O,onStatusChange:U,onTakeoverChange:w,ref:I},s)}),e.jsx(Oe,{task:u,ptyStatus:E})]}):e.jsx(X,{onboardingData:S})})]}):e.jsx(X,{onboardingData:S})})]})}export{Ye as default};
@@ -0,0 +1 @@
1
+ import{a as C,r as n,j as e,h as w,f as M,E as O,$ as k,Z as $,I as T,v as V}from"./index-DHpBdv1F.js";import{K as E}from"./key-BBeR1F9r.js";import{C as S}from"./copy-DTL-jbDm.js";import{E as K}from"./external-link-CFjZxTQ5.js";import{E as P}from"./EmptyState-C3ql5j5L.js";import{T as W}from"./Skeleton-joUgi0KR.js";import{u as B}from"./useFetch-CIp8RQub.js";import{e as R}from"./status-colors-DJc_fXaW.js";import{P as J}from"./plus-E_rJxJAi.js";function z({isOpen:a,onClose:y,onCreated:b}){const{t:s}=C(),[r,c]=n.useState(""),[i,d]=n.useState(!1),[l,v]=n.useState("");function h(){c(""),v(""),y()}async function x(){if(v(""),!r.trim()){v(s("admin.pat_label_required"));return}try{d(!0);const o=await w.post("admin/worker-tokens",{json:{label:r.trim()}}).json();c(""),b({token:o.token,id:o.id})}catch(o){const m=o instanceof Error?o.message:s("admin.pat_failed_to_generate");v(m)}finally{d(!1)}}return a?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},onClick:o=>{o.target===o.currentTarget&&h()},children:e.jsxs("div",{className:"w-full border border-[var(--border)] bg-[var(--bg-card)]",style:{maxWidth:"480px",borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:[e.jsxs("div",{className:"flex items-center gap-2 border-b border-[var(--border)] px-5 py-4",children:[e.jsx(E,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:s("admin.generate_worker_token_title")})]}),e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[l&&e.jsx("div",{className:"border border-[var(--destructive)]/30 bg-[var(--destructive)]/10 px-3 py-2 text-xs text-[var(--destructive)]",style:{borderRadius:"4px"},children:l}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:s("admin.create_one_time_token")}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:s("admin.label")}),e.jsx("input",{type:"text",placeholder:s("admin.pat_label_placeholder"),value:r,onChange:o=>c(o.target.value),className:"w-full border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2 text-sm text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:border-[var(--accent)] focus:outline-none",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},onKeyDown:o=>{o.key==="Enter"&&x()}}),e.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:s("admin.label_identifies_worker")})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-[var(--border)] px-5 py-3",children:[e.jsx("button",{onClick:h,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:s("common.cancel")}),e.jsx("button",{onClick:x,disabled:i,className:"bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-black transition-opacity hover:opacity-80 disabled:opacity-50",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:s(i?"admin.generating":"admin.generate")})]})]})}):null}const X=3e3,q=600*1e3;function G({isOpen:a,token:y,tokenId:b,onClose:s}){const{t:r}=C(),[c,i]=n.useState("command"),[d,l]=n.useState(!1),[v,h]=n.useState(!1),[x,o]=n.useState(""),[m,g]=n.useState(null),p=n.useRef(void 0),N=n.useRef(Date.now()),_=M(),j=typeof window<"u"?window.location.origin:"https://overlord.example.com",t=`overlord setup worker --token ${y} --server ${j}`;async function D(){try{await navigator.clipboard.writeText(y),l(!0),setTimeout(()=>l(!1),2e3)}catch{}}async function L(){try{await navigator.clipboard.writeText(t),h(!0),setTimeout(()=>h(!1),2e3)}catch{}}const A=n.useCallback(async()=>{try{const f=await w.get(`admin/worker-tokens/${b}/status`).json();f.status==="used"&&f.worker_name&&(i("success"),o(f.worker_name),g(f.worker_id??null),p.current&&clearInterval(p.current))}catch{}Date.now()-N.current>q&&(i("timeout"),p.current&&clearInterval(p.current))},[b]);function F(){i("waiting"),N.current=Date.now(),p.current=setInterval(A,X)}n.useEffect(()=>()=>{p.current&&clearInterval(p.current)},[]);function I(){s(),m&&_(`/workers/${m}`)}if(!a)return null;const u={fontFamily:"'JetBrains Mono', monospace",borderRadius:"4px"};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},onClick:f=>{f.target===f.currentTarget&&s()},children:e.jsxs("div",{className:"w-full border border-[var(--border)] bg-[var(--bg-card)]",style:{...u,maxWidth:"480px"},children:[e.jsx("div",{className:"flex items-center gap-2 border-b border-[var(--border)] px-5 py-4",children:c==="success"?e.jsxs(e.Fragment,{children:[e.jsx(O,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:r("admin.worker_registered")})]}):e.jsxs(e.Fragment,{children:[e.jsx(E,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:r("admin.worker_token_generated")})]})}),e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[c!=="success"&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("admin.run_command_desc")}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[11px] text-[var(--text-muted)]",children:"Token"}),e.jsxs("div",{className:"relative border border-[var(--border)] bg-[var(--bg-card)] p-3",style:{borderRadius:"4px"},children:[e.jsx("code",{className:"block break-all pr-20 text-xs text-[var(--text-primary)]",children:y}),e.jsx("button",{onClick:D,className:"absolute right-2 top-2 flex items-center gap-1 border border-[var(--border)] bg-transparent px-2 py-1 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:u,children:d?e.jsx("span",{className:"text-[var(--accent)]",children:r("common.copied")}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(S,{className:"h-3 w-3"})," ",r("common.copy")]})})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[11px] text-[var(--text-muted)]",children:r("admin.setup_command")}),e.jsxs("div",{className:"relative border border-[var(--border)] bg-[var(--bg-card)] p-3",style:{borderRadius:"4px"},children:[e.jsxs("code",{className:"block break-all pr-20 text-xs text-[var(--accent)]",children:["$ ",t]}),e.jsx("button",{onClick:L,className:"absolute right-2 top-2 flex items-center gap-1 border border-[var(--border)] bg-transparent px-2 py-1 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:u,children:v?e.jsx("span",{className:"text-[var(--accent)]",children:r("common.copied")}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(S,{className:"h-3 w-3"})," ",r("common.copy")]})})]})]}),e.jsx("div",{className:"border border-yellow-500/30 bg-yellow-500/10 px-3 py-2 text-xs text-yellow-400",style:{borderRadius:"4px"},children:r("admin.token_shown_once")})]}),c==="waiting"&&e.jsxs("div",{className:"flex items-center gap-3 border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3",style:{borderRadius:"4px"},children:[e.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-[var(--accent)] border-t-transparent"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:r("admin.waiting_for_worker")})]}),c==="timeout"&&e.jsx("div",{className:"border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3 text-xs text-[var(--text-muted)]",style:{borderRadius:"4px"},children:r("admin.token_not_yet_used")}),c==="success"&&e.jsxs("div",{className:"border border-[var(--accent)]/30 bg-[var(--accent)]/10 px-4 py-3",style:{borderRadius:"4px"},children:[e.jsx("p",{className:"text-xs text-[var(--accent)]",children:r("admin.worker_registered_success")}),e.jsxs("p",{className:"mt-1 text-xs text-[var(--text-primary)]",children:[r("admin.worker"),": ",e.jsx("span",{className:"text-[var(--accent)]",children:x})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-[var(--border)] px-5 py-3",children:[c==="command"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:u,children:r("common.close")}),e.jsx("button",{onClick:F,className:"bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-black transition-opacity hover:opacity-80",style:u,children:r("admin.copied_wait_for_worker")})]}),c==="waiting"&&e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:u,children:r("admin.close_worker_can_register")}),c==="timeout"&&e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:u,children:r("common.close")}),c==="success"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:u,children:r("common.close")}),e.jsxs("button",{onClick:I,className:"flex items-center gap-1.5 bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-black transition-opacity hover:opacity-80",style:u,children:[e.jsx(K,{className:"h-3 w-3"}),r("admin.view_worker")]})]})]})]})})}function se(){const{t:a}=C(),[y,b]=n.useState(!1),[s,r]=n.useState(null),[c,i]=n.useState(!1),[d,l]=n.useState(null),[v,h]=n.useState(!1),[x,o]=n.useState(!1),{data:m,loading:g,refetch:p}=B(()=>w.get("admin/worker-tokens").json(),[]);async function N(){if(d){h(!0);try{await w.post(`admin/worker-tokens/${d.id}/revoke`),i(!1),l(null),p()}catch{}finally{h(!1)}}}function _(t){b(!1),r(t),p()}const j=n.useMemo(()=>(m??[]).filter(t=>x||t.status!==k.REVOKED),[m,x]);return e.jsxs("div",{className:"font-mono",children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:a("admin.tokens_title")}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:a("admin.tokens_subtitle")})]}),e.jsxs("button",{type:"button",className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity",onClick:()=>b(!0),children:[e.jsx(J,{className:"h-3.5 w-3.5"}),a("admin.generate_token")]})]}),!g&&(m==null?void 0:m.some(t=>t.status===k.REVOKED))&&e.jsx("div",{className:"mb-4 flex items-center gap-2",children:e.jsx("button",{type:"button",onClick:()=>o(!x),className:`text-xs transition-colors ${x?"text-[var(--text-primary)]":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:a(x?"admin.hide_revoked":"admin.show_revoked")})}),g?e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsx(W,{rows:3})}):j.length===0?e.jsx(P,{icon:$,title:a("admin.no_worker_tokens"),description:a("admin.generate_token_desc"),actionLabel:a("admin.generate_token"),onAction:()=>b(!0)}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden md:block overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] text-left text-[var(--text-muted)]",children:[e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.label")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.purpose")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.status")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("common.created_at")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.expires_at")}),e.jsx("th",{className:"pb-2 font-normal",children:a("common.actions")})]})}),e.jsx("tbody",{children:j.map(t=>e.jsxs("tr",{className:"border-b border-[var(--border-row)] hover:bg-white/[0.02] transition-colors",children:[e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-primary)]",children:t.label}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:t.purpose}),e.jsx("td",{className:"py-2.5 pr-4",children:e.jsx("span",{className:R(t.status),children:t.status})}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-muted)]",children:new Date(t.createdAt).toLocaleDateString()}),e.jsx("td",{className:"py-2.5 pr-4",children:t.expiresAt?e.jsx("span",{className:"text-[var(--text-secondary)]",children:new Date(t.expiresAt).toLocaleDateString()}):e.jsx("span",{className:"text-[var(--text-muted)]",children:"—"})}),e.jsx("td",{className:"py-2.5",children:t.status===k.ACTIVE&&e.jsxs("button",{type:"button",className:"flex items-center gap-1 rounded-[4px] px-2 py-1 text-red-400 hover:text-red-300 hover:bg-white/[0.05] transition-colors",onClick:()=>{l(t),i(!0)},children:[e.jsx(T,{className:"h-3.5 w-3.5"}),a("admin.revoke")]})})]},t.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3",children:j.map(t=>e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-xs text-[var(--text-primary)] font-medium truncate mr-2",children:t.label}),e.jsx("span",{className:`text-[11px] shrink-0 ${R(t.status)}`,children:t.status})]}),e.jsx("div",{className:"text-[11px] text-[var(--text-secondary)] truncate mb-1",children:t.purpose}),e.jsxs("div",{className:"flex items-center justify-between text-[11px] text-[var(--text-muted)]",children:[e.jsx("span",{children:new Date(t.createdAt).toLocaleDateString()}),t.expiresAt&&e.jsx("span",{children:new Date(t.expiresAt).toLocaleDateString()})]}),t.status===k.ACTIVE&&e.jsx("div",{className:"mt-2 pt-2 border-t border-[var(--border)]",children:e.jsxs("button",{type:"button",className:"flex items-center gap-1 rounded-[4px] px-2 py-1 text-[11px] text-red-400 hover:text-red-300 hover:bg-white/[0.05] transition-colors",onClick:()=>{l(t),i(!0)},children:[e.jsx(T,{className:"h-3.5 w-3.5"}),a("admin.revoke")]})})]},t.id))})]}),e.jsx(z,{isOpen:y,onClose:()=>b(!1),onCreated:_}),s&&e.jsx(G,{isOpen:!!s,token:s.token,tokenId:s.id,onClose:()=>r(null)}),e.jsx(V,{isOpen:c,onClose:()=>{i(!1),l(null)},onConfirm:N,title:a("admin.revoke_token"),message:a("admin.revoke_token_confirm",{label:(d==null?void 0:d.label)??""}),confirmLabel:a("admin.revoke"),confirmVariant:"danger",isLoading:v})]})}export{se as default};
@@ -1 +1 @@
1
- import{O as m,r as e,j as t}from"./index-D_OrDcWf.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{V as m,r as e,j as t}from"./index-DHpBdv1F.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-D_OrDcWf.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-DHpBdv1F.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,v 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,I as F,h as g,l as ie,n as le}from"./index-D_OrDcWf.js";import{t as ce,c as H}from"./date-RFA7-ZGs.js";import{w as de,b as xe,t as me}from"./status-colors-CYQlZjBF.js";import{I as l}from"./InfoRow-CArRH_uK.js";import{M as D}from"./MetricBar-CBh2ydOP.js";import{u as pe}from"./useFetch-_T-wW8J0.js";import{T as ue}from"./Tooltip-C8VKfixS.js";import{T as U}from"./trash-2-B5fxIpUx.js";import{A as be}from"./arrow-left-CIwOL41D.js";function ve({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 he(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),[J,I]=x.useState(!1),[y,f]=x.useState(null),v=ae(a=>{var d;return(d=a.user)==null?void 0:d.role}),K=R(a=>a.workerSeq),Q=R(a=>a.taskSeq),{data:u,loading:X,error:M,refetch:_}=pe(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,K,Q]),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(be,{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(S,{label:r("workers.cpu"),value:s.cpuUsage,unit:"%"}),e.jsx(S,{label:r("workers.memory"),value:s.memoryUsage,unit:"%"}),e.jsx(S,{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:de[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:ce(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(D,{label:r("workers.cpu"),value:s.cpuUsage}),e.jsx(D,{label:r("workers.mem"),value:s.memoryUsage}),e.jsx(D,{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(ve,{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:J})]})}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":""," · ",he(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(ge,{tasks:n,navigate:r})]})}function ge({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(ue,{content:le(o),children:ie(o)})}),e.jsx("td",{className:"py-2 pr-4",children:e.jsxs("span",{style:{color:me[o.status]},children:["● ",o.status.toLowerCase()]})}),e.jsx("td",{className:"py-2 text-[var(--text-secondary)]",children:o.currentStage??"-"})]},o.id))})]})})}function S({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:xe(n)}})})]})}export{Se as default};
1
+ import{a as b,j as e,v 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,K as F,h as g,l as ie,n as le}from"./index-DHpBdv1F.js";import{t as ce,c as H}from"./date-RFA7-ZGs.js";import{w as de,b as xe,t as me}from"./status-colors-DJc_fXaW.js";import{I as l}from"./InfoRow-D5t0RpaR.js";import{M as D}from"./MetricBar-CWCoyjWv.js";import{u as pe}from"./useFetch-CIp8RQub.js";import{T as ue}from"./Tooltip-C5YjudXm.js";import{T as U}from"./trash-2-DUEEg0-a.js";import{A as be}from"./arrow-left-kFMv2goM.js";function ve({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 he(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),[K,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),Q=R(a=>a.taskSeq),{data:u,loading:X,error:M,refetch:_}=pe(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,Q]),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(be,{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(S,{label:r("workers.cpu"),value:s.cpuUsage,unit:"%"}),e.jsx(S,{label:r("workers.memory"),value:s.memoryUsage,unit:"%"}),e.jsx(S,{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:de[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:ce(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(D,{label:r("workers.cpu"),value:s.cpuUsage}),e.jsx(D,{label:r("workers.mem"),value:s.memoryUsage}),e.jsx(D,{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(ve,{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:K})]})}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":""," · ",he(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(ge,{tasks:n,navigate:r})]})}function ge({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(ue,{content:le(o),children:ie(o)})}),e.jsx("td",{className:"py-2 pr-4",children:e.jsxs("span",{style:{color:me[o.status]},children:["● ",o.status.toLowerCase()]})}),e.jsx("td",{className:"py-2 text-[var(--text-secondary)]",children:o.currentStage??"-"})]},o.id))})]})})}function S({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:xe(n)}})})]})}export{Se as default};
@@ -1,4 +1,4 @@
1
- import{c as G,R as U,a as C,j as e,r as o,h as S,X as q,E as K,f as H,u as V,k as X,W as N,w as J,D as Q,S as M}from"./index-D_OrDcWf.js";import{w as W}from"./status-colors-CYQlZjBF.js";import{M as _}from"./MetricBar-CBh2ydOP.js";import Y from"./WorkerSetupGuidePage-BVJvCq1d.js";import{C as z}from"./copy-BsSvzuvN.js";import{L as Z}from"./loader-circle-PQQXGtgi.js";import{S as ee}from"./Select-C9mH7t3y.js";import{E as te}from"./EmptyState-BwOJcw-7.js";import{C as re}from"./Skeleton-BSwNthrI.js";import{u as se}from"./useFetch-_T-wW8J0.js";import{P as ae}from"./plus-DLpnTi95.js";import"./key-BpF_rjM9.js";import"./download-DziGmRwM.js";import"./settings--c2rvWEY.js";import"./wifi-DyUmH42s.js";/**
1
+ import{c as G,R as U,a as C,j as e,r as o,h as S,X as q,E as K,f as H,u as V,k as X,W as N,w as J,D as Q,S as M}from"./index-DHpBdv1F.js";import{w as W}from"./status-colors-DJc_fXaW.js";import{M as _}from"./MetricBar-CWCoyjWv.js";import Y from"./WorkerSetupGuidePage-r4f3o1z6.js";import{C as z}from"./copy-DTL-jbDm.js";import{L as Z}from"./loader-circle-4X_s6z-L.js";import{S as ee}from"./Select-C-ttiP28.js";import{E as te}from"./EmptyState-C3ql5j5L.js";import{C as re}from"./Skeleton-joUgi0KR.js";import{u as se}from"./useFetch-CIp8RQub.js";import{P as ae}from"./plus-E_rJxJAi.js";import"./key-BBeR1F9r.js";import"./download-B7XilVjT.js";import"./settings-DaAAUDK3.js";import"./wifi-BOM9bCKp.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.