@overlordai/server 1.0.133 → 1.0.134
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.
- package/database/migrations/007-worker-capability-state.sql +5 -0
- package/dist/database/repositories/worker.repository.d.ts +12 -0
- package/dist/database/repositories/worker.repository.d.ts.map +1 -1
- package/dist/database/repositories/worker.repository.js +40 -0
- package/dist/database/repositories/worker.repository.js.map +1 -1
- package/dist/dispatcher/capability.service.d.ts +20 -7
- package/dist/dispatcher/capability.service.d.ts.map +1 -1
- package/dist/dispatcher/capability.service.js +171 -42
- package/dist/dispatcher/capability.service.js.map +1 -1
- package/dist/dispatcher/scheduler.service.d.ts.map +1 -1
- package/dist/dispatcher/scheduler.service.js +58 -15
- package/dist/dispatcher/scheduler.service.js.map +1 -1
- package/dist/dispatcher/task-creation.service.d.ts.map +1 -1
- package/dist/dispatcher/task-creation.service.js +3 -1
- package/dist/dispatcher/task-creation.service.js.map +1 -1
- package/dist/dispatcher/worker-selector.d.ts +4 -0
- package/dist/dispatcher/worker-selector.d.ts.map +1 -1
- package/dist/dispatcher/worker-selector.js +9 -0
- package/dist/dispatcher/worker-selector.js.map +1 -1
- package/dist/web/frame-handlers/progress.handler.d.ts +3 -1
- package/dist/web/frame-handlers/progress.handler.d.ts.map +1 -1
- package/dist/web/frame-handlers/progress.handler.js +41 -5
- package/dist/web/frame-handlers/progress.handler.js.map +1 -1
- package/dist/web/worker-channel.gateway.d.ts +3 -1
- package/dist/web/worker-channel.gateway.d.ts.map +1 -1
- package/dist/web/worker-channel.gateway.js +5 -2
- package/dist/web/worker-channel.gateway.js.map +1 -1
- package/dist/web/worker-web.controller.d.ts +161 -5
- package/dist/web/worker-web.controller.d.ts.map +1 -1
- package/dist/web/worker-web.controller.js +69 -9
- package/dist/web/worker-web.controller.js.map +1 -1
- package/package.json +4 -4
- package/public/assets/{AccessTokensPage-B_di-j0j.js → AccessTokensPage-BoVgUrzP.js} +1 -1
- package/public/assets/AdminPage-P2z0Fl0Y.js +1 -0
- package/public/assets/{AgentCliPage-CiSE6MOL.js → AgentCliPage-C7GiYV6z.js} +2 -2
- package/public/assets/{ApiReferencePage-Cv1THMOi.js → ApiReferencePage-Kzj97VkN.js} +1 -1
- package/public/assets/{ArchitecturePage-H1WtP2sH.js → ArchitecturePage-Dj1I7Lif.js} +1 -1
- package/public/assets/{AuditLogPage-Q-izWOoJ.js → AuditLogPage-D1OTE5S1.js} +1 -1
- package/public/assets/{BindPlatformPage-S-s2YO1G.js → BindPlatformPage-CUbHhfZo.js} +1 -1
- package/public/assets/{BotIntegrationPage-CzgR3bDN.js → BotIntegrationPage-Cz1-B_ag.js} +1 -1
- package/public/assets/{BotManage-Cmb0u2y7.js → BotManage-DGCb_1uD.js} +1 -1
- package/public/assets/{BotSetupPage-DCuRv9lx.js → BotSetupPage-DEj-NMfd.js} +1 -1
- package/public/assets/{ChangelogPage-DGVNwh9w.js → ChangelogPage-DerOZcUF.js} +1 -1
- package/public/assets/{CliReferencePage-DKZZacin.js → CliReferencePage-kHDw2pA7.js} +1 -1
- package/public/assets/{DeploymentPage-Cd_K6k-C.js → DeploymentPage-B5XPM33m.js} +1 -1
- package/public/assets/{DevWorkflowPage-DY1Kcsg7.js → DevWorkflowPage-CdyR3M_a.js} +1 -1
- package/public/assets/{DeveloperManage-BnhZ_Aqp.js → DeveloperManage-CADxGSzH.js} +1 -1
- package/public/assets/{DeveloperSetupPage-C3519X2U.js → DeveloperSetupPage-TGy2mo4p.js} +1 -1
- package/public/assets/{DocsIndexPage-BXNlGsUi.js → DocsIndexPage-CKLFPHA9.js} +6 -11
- package/public/assets/DocsLayout-j09z0-2-.js +1 -0
- package/public/assets/{DocsPrimitives-DNdGlGlH.js → DocsPrimitives-BjKzQarf.js} +1 -1
- package/public/assets/EditProjectPage-YrALdZ6_.js +2 -0
- package/public/assets/{EmptyState-9Eqw0iR8.js → EmptyState-c4IsGUGS.js} +1 -1
- package/public/assets/{EnvVariablesPage-Cddaji3m.js → EnvVariablesPage-DUV5GbgH.js} +1 -1
- package/public/assets/HomePage-Bd0qbwuy.js +1 -0
- package/public/assets/{InfoRow-C3ZXZz4q.js → InfoRow-OjQK-lfD.js} +1 -1
- package/public/assets/{InstallationPage-BTbG8z22.js → InstallationPage-QKu8ZH_9.js} +1 -1
- package/public/assets/{LandingPage-DpdvNKYz.js → LandingPage-9OL5ViAD.js} +1 -1
- package/public/assets/{LocalDevelopmentPage-CqPNGlUK.js → LocalDevelopmentPage-DktRuJdo.js} +1 -1
- package/public/assets/{LoginPage-CzJDQ0H0.js → LoginPage-zjkljmUG.js} +1 -1
- package/public/assets/{MetricBar-CixGVqjI.js → MetricBar-Ct-6XoF8.js} +1 -1
- package/public/assets/{NotFoundPage-DdxosdYc.js → NotFoundPage-DpUSdTHq.js} +1 -1
- package/public/assets/{OnboardingGuide-C1-sQUW7.js → OnboardingGuide-DniYFVLU.js} +1 -1
- package/public/assets/{PermissionsPage-Db7ynPhr.js → PermissionsPage-AtbdWCh6.js} +1 -1
- package/public/assets/{PipelineConfigPage-DM_btq4K.js → PipelineConfigPage-ByKxXAqM.js} +1 -1
- package/public/assets/{PipelineEditorPage-CAO4j2sA.js → PipelineEditorPage-BmkHpPoJ.js} +1 -1
- package/public/assets/ProfilePage-D3DWeoQM.js +1 -0
- package/public/assets/{ProjectDetailPage-B9my9oLw.js → ProjectDetailPage-DcxPgXCF.js} +1 -1
- package/public/assets/ProjectListPage-B2LJx5SB.js +6 -0
- package/public/assets/{PtyTerminal-C9Bp0uS_.js → PtyTerminal-BQ2UYeLe.js} +1 -1
- package/public/assets/{QuickAuth-C1XxLYNZ.js → QuickAuth-DbXnLBbA.js} +1 -1
- package/public/assets/{RemoveMemberConfirmDialog-gohLNDc5.js → RemoveMemberConfirmDialog-DgXwrcbD.js} +1 -1
- package/public/assets/{Select-CkMgU0Lq.js → Select-CKozUJa5.js} +1 -1
- package/public/assets/{SettingsPage-Crc4EZDF.js → SettingsPage-Dc7kQQ-U.js} +1 -1
- package/public/assets/{Skeleton-DI-HCY-N.js → Skeleton-1CByoX9G.js} +1 -1
- package/public/assets/{SkillPage-SmsZWW8c.js → SkillPage-C5bC1S4B.js} +1 -1
- package/public/assets/TaskDetailPage-Bci7hNZD.js +26 -0
- package/public/assets/TaskListPage-CysAqfJ7.js +1 -0
- package/public/assets/{TaskStatusBadge-B49xL6ug.js → TaskStatusBadge-BQr1iwes.js} +1 -1
- package/public/assets/TerminalHomePage-AG4elUye.js +11 -0
- package/public/assets/TokenManage-CaQAVdV3.js +1 -0
- package/public/assets/{Tooltip-DrIj1IXL.js → Tooltip-D_CBrTO_.js} +1 -1
- package/public/assets/{TotpSetupPage-B81U1CZB.js → TotpSetupPage-hm7e8ja5.js} +1 -1
- package/public/assets/WorkerDetailPage-B1Dx_37R.js +1 -0
- package/public/assets/WorkerListPage-BS3r46aW.js +6 -0
- package/public/assets/{WorkerOperationsPage-CcfPJ-Vx.js → WorkerOperationsPage-EplOzeIS.js} +1 -1
- package/public/assets/{WorkerSetupGuidePage-C_GA4jv_.js → WorkerSetupGuidePage-Bj7AFF_z.js} +1 -1
- package/public/assets/{WorkerSetupPage-hV7T8eEi.js → WorkerSetupPage-C3mkq4zM.js} +1 -1
- package/public/assets/agent-type-options-DUkN669t.js +1 -0
- package/public/assets/{arrow-left-BwtdfCwD.js → arrow-left-BPE0QXvK.js} +1 -1
- package/public/assets/{arrow-right-BQPypZRF.js → arrow-right-BdXr5iFo.js} +1 -1
- package/public/assets/{bot-3i2pb58N.js → bot-CNZBTp4c.js} +1 -1
- package/public/assets/{chevron-left-6cPJJmnY.js → chevron-left-BhcTbOUx.js} +1 -1
- package/public/assets/{chevron-right-DxtB9dXk.js → chevron-right-BuhDQxo4.js} +1 -1
- package/public/assets/{copy-BckVr8cJ.js → copy-cloBpe4U.js} +1 -1
- package/public/assets/{download-DnrLGHSN.js → download-BxlPrmML.js} +1 -1
- package/public/assets/{external-link-BWs-24k_.js → external-link-Clr8ygf6.js} +1 -1
- package/public/assets/file-text-KFjDZaJL.js +6 -0
- package/public/assets/{git-fork-DxuKN6TL.js → git-fork-CBlyXbge.js} +1 -1
- package/public/assets/index-D6SjJWkw.css +1 -0
- package/public/assets/{index-D3ZK8e35.js → index-DJl-vKpg.js} +28 -28
- package/public/assets/{key-BjxaakEN.js → key-BwIOi-0U.js} +1 -1
- package/public/assets/{loader-circle-fKTUhuFx.js → loader-circle-CF4O3sgn.js} +1 -1
- package/public/assets/{pencil-BGn762Xd.js → pencil-BKwPd_Fv.js} +1 -1
- package/public/assets/{plus-DfeF35ew.js → plus-Dy384KeJ.js} +1 -1
- package/public/assets/{rotate-ccw-DnJi9esb.js → rotate-ccw-BqKuF1OZ.js} +1 -1
- package/public/assets/{scroll-text-CDAXkr64.js → scroll-text-BQnKZlDZ.js} +1 -1
- package/public/assets/{settings-BQ40mw10.js → settings-iP7F66C4.js} +1 -1
- package/public/assets/{status-colors-BgploKhY.js → status-colors-D3fj6h6e.js} +1 -1
- package/public/assets/task-constants-q2zc7hX5.js +1 -0
- package/public/assets/{trash-2-B6XaTY-0.js → trash-2-CYF0CqNA.js} +1 -1
- package/public/assets/{useFetch-CSoNR_l8.js → useFetch-CyCGABKu.js} +1 -1
- package/public/assets/{users-DI9FgcZa.js → users-BQ-sAhp6.js} +1 -1
- package/public/assets/{wifi-D9JcPn5X.js → wifi-DKdwzLvS.js} +1 -1
- package/public/assets/{workflow-DRETOaoe.js → workflow-DlF_hAtY.js} +1 -1
- package/public/index.html +2 -2
- package/public/sw.js +1 -1
- package/public/assets/AdminPage-DIyGC-b1.js +0 -1
- package/public/assets/DocsLayout-CZh1AEB5.js +0 -1
- package/public/assets/EditProjectPage-BMsLYq9D.js +0 -2
- package/public/assets/HomePage-CRZSG4wX.js +0 -1
- package/public/assets/ProfilePage-5b64UEF7.js +0 -1
- package/public/assets/ProjectListPage-D0ArUg7q.js +0 -6
- package/public/assets/TaskDetailPage-cjzjPYPW.js +0 -26
- package/public/assets/TaskListPage-BCj8HmhB.js +0 -1
- package/public/assets/TerminalHomePage-BmShj9-L.js +0 -11
- package/public/assets/TokenManage-CXGZwaVK.js +0 -1
- package/public/assets/WorkerDetailPage-D3l1CEg-.js +0 -1
- package/public/assets/WorkerListPage-CR3ptj-n.js +0 -6
- package/public/assets/index-DMWyyiI3.css +0 -1
- package/public/assets/task-constants-eOji5WUw.js +0 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import{c as J,a as Q,r as l,h as g,j as e,M as ft,z as A,H as vt,t as V,v as ye,A as bt,f as gt,B as jt,q as Nt,s as yt,k as We,p as L,l as Xe,m as kt,L as He,X as st,n as wt,x as _t,U as Ct,b as St,G as Tt,E as Et}from"./index-DJl-vKpg.js";import{u as Lt,T as Dt,g as at}from"./task-constants-q2zc7hX5.js";import{C as It,g as $t,P as Ve,H as Pt}from"./PtyTerminal-BQ2UYeLe.js";import{a as At,b as Rt,f as H,c as Ft}from"./date-RFA7-ZGs.js";import{S as Mt}from"./Select-CKozUJa5.js";import{a as rt}from"./status-colors-D3fj6h6e.js";import{T as Ot}from"./Tooltip-D_CBrTO_.js";import{A as Ut}from"./arrow-left-BPE0QXvK.js";import{R as nt}from"./rotate-ccw-BqKuF1OZ.js";import{G as qt}from"./git-fork-CBlyXbge.js";import{E as Bt}from"./external-link-Clr8ygf6.js";import{L as lt}from"./loader-circle-CF4O3sgn.js";import{F as Gt}from"./file-text-KFjDZaJL.js";import"./agent-type-options-DUkN669t.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 Kt=J("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 zt=J("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 Wt=J("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 Xt=J("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 Ht=J("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 Je({isOpen:n,onClose:c,taskId:s,stageName:r,timeoutSeconds:t,onSubmitted:x}){const{t:d}=Q(),[h,p]=l.useState(t),[_,C]=l.useState(!1);l.useEffect(()=>{if(!n)return;p(t);const o=setInterval(()=>{p(j=>j<=1?(clearInterval(o),0):j-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 g.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(ft,{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(It,{className:"h-3.5 w-3.5"}),At(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:d("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:d("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:d(_?"tasks.stage_submitting":"tasks.confirm_and_proceed")})]})]})]}):null}function Vt(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 Qe(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 Ye(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 Jt({taskId:n,taskFinished:c,compact:s}){const{t:r}=Q(),[t,x]=l.useState(A.IDLE),[d,h]=l.useState(null),[p,_]=l.useState(null),[C,I]=l.useState(""),[o,j]=l.useState(!1),[le,R]=l.useState(!1),F=l.useRef(null),$=l.useCallback(async()=>{try{const u=await g.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 ce(){S(),F.current=setInterval($,5e3)}function S(){F.current&&(clearInterval(F.current),F.current=null)}l.useEffect(()=>{c&&(t===A.STARTING||t===A.CONNECTED)&&(x(A.IDLE),h(null),S())},[c,t]),l.useEffect(()=>{if(t!=="CONNECTED"||!p)return;const u=()=>{const T=Vt(p,r);I(T),T===r("tasks.tunnel_expired")&&(x(A.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(){j(!0);try{await g.post(`web/workspace-tunnel/${n}/start`),x(A.STARTING),ce()}catch(u){let D=r("tasks.tunnel_start_failed");try{if(u instanceof vt){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{}V.error(D)}finally{j(!1)}}async function z(){j(!0);try{await g.post(`web/workspace-tunnel/${n}/stop`),x(A.IDLE),h(null),S()}catch{}finally{j(!1)}}async function ie(){d&&(await navigator.clipboard.writeText(d),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:Qe(t)},children:Ye(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"&&d&&e.jsx("a",{href:d.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:Qe(t)},children:["● ",Ye(t,r)]})]}),t==="CONNECTED"&&p&&e.jsxs("p",{className:"mb-2 text-xs text-[var(--text-muted)]",children:["// ",C]}),t==="CONNECTED"&&d&&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:d}),e.jsxs("button",{onClick:ie,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"),"]"]})]}),le&&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"&&d&&e.jsxs(e.Fragment,{children:[e.jsx("a",{href:d.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:d.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 Qt({isOpen:n,onClose:c,onConfirm:s,taskId:r,isLoading:t}){const{t:x}=Q();return e.jsx(ye,{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 Yt({isOpen:n,onClose:c,onConfirm:s,taskId:r,mrUrl:t,isLoading:x,reuseWorkspace:d,onReuseWorkspaceChange:h}){const{t:p}=Q(),_=t?p("tasks.retry_message_with_mr",{id:String(r),url:t}):p("tasks.retry_message_without_mr",{id:String(r)});return e.jsx(ye,{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:d,onChange:C=>h(C.target.checked),className:"w-3.5 h-3.5 cursor-pointer accent-[var(--accent)]"}),p("tasks.reuse_workspace_label")]})})}const je=["implement","test","verify","review","simplify","submit"];function Ne(n){if(typeof n=="string")try{return Ne(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 Zt(n){if(!n.configSnapshot)return je;try{const c=JSON.parse(n.configSnapshot);return Ne(c.pipeline)??Ne(c)??je}catch{return je}}function es(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 ne({status:n,agentType:c}){const s=rt(n),r=at(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 Ze({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",d=r.status==="failed";return e.jsxs("div",{className:`flex items-center gap-2 rounded-[4px] px-2 ${s} ${x?c:""}`,children:[t&&e.jsx(Et,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),x&&e.jsx(lt,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),d&&e.jsx(st,{className:"h-3.5 w-3.5 shrink-0 text-[var(--destructive)]"}),r.status==="pending"&&e.jsx(Kt,{className:"h-3.5 w-3.5 shrink-0 text-[#525252]"}),e.jsx("span",{className:"text-xs",style:{color:t?"var(--accent)":x?"#e5e5e5":d?"var(--destructive)":"#525252",fontWeight:x?500:400},children:x?`> ${r.name}`:r.name})]},r.name)})})}function et({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:rt(n.status)},children:n.status.toLowerCase()}),n.currentStage&&e.jsxs("span",{className:"text-[11px] text-[var(--accent)]",children:[r("tasks.stage"),": ",n.currentStage]}),e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["agent: ",s]}),n.workerName&&e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["worker: ",n.workerName]})]})}function tt({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(Pt,{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(nt,{className:"h-3 w-3"}),r("tasks.restore_auto")]})]})}function ts(n){const c=Zt(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===Tt.GITLAB?`${s}/-/tree/${r}`:`${s}/tree/${r}`}function fs(){var Ge,Ke,ze;const{id:n}=bt(),c=gt(),{t:s}=Q(),r=Lt(a=>a.cancelTask),[t,x]=l.useState(null),[d,h]=l.useState(null),[p,_]=l.useState([]),[C,I]=l.useState(!0),[o,j]=l.useState(null),[le,R]=l.useState(!1),[F,$]=l.useState(!1),[ce,S]=l.useState(!1),[K,z]=l.useState(!1),[ie,u]=l.useState(!1),[D,T]=l.useState(!1),[ke,we]=l.useState(""),[_e,xe]=l.useState(!1),[Ce,ct]=jt(),[k,oe]=l.useState("terminal"),[Se,Te]=l.useState([]),[Y,Ee]=l.useState(0),[W,M]=l.useState(0),[X,Le]=l.useState(""),[Z,it]=l.useState(""),[xt,de]=l.useState(!1),[ot,De]=l.useState(!1),[O,me]=l.useState(null),[Ie,$e]=l.useState("disconnected"),[pe,Pe]=l.useState("auto"),ee=l.useRef(null),Ae=l.useRef(null),m=Number(n),N=t?Dt.includes(t.status):!1;Nt(t?yt(t,100):null);const E=l.useCallback(async()=>{try{const a=await g.get(`web/tasks/${m}`).json();x(a)}catch{}},[m]),te=l.useCallback(async()=>{try{const a=await g.get(`web/tasks/${m}/logs`).json();_(a.lines)}catch{}},[m]),U=l.useCallback(async()=>{try{const a=await g.get(`web/tasks/${m}/pending-confirm`).json();j(a.confirm)}catch{j(null)}},[m]),Re=l.useCallback(async()=>{de(!0);try{const a=new URLSearchParams;a.set("limit","50"),a.set("offset",String(W*50)),X&&a.set("type",X),Z&&a.set("search",Z);const i=await g.get(`web/tasks/${m}/events?${a}`).json();Te(i.events),Ee(i.total)}catch{}finally{de(!1)}},[m,W,X,Z]);l.useEffect(()=>{k==="logs"&&Re()},[k,Re]),l.useEffect(()=>{k==="pipeline"&&!N&&g.get(`web/workspaces/${m}`).json().then(me).catch(()=>me(null))},[k,m,N]);const q=We(a=>a.lastEvent),Fe=We(a=>a.eventSeq);l.useEffect(()=>{I(!0),x(null),h(null),_([]),j(null),me(null),Te([]),Ee(0),M(0),de(!1),Promise.all([E(),te(),U()]).finally(()=>I(!1))},[E,te,U]),l.useEffect(()=>{t!=null&&t.projectKey&&g.get(`web/projects/${t.projectKey}`).json().then(h).catch(()=>h(null))},[t==null?void 0:t.projectKey]),l.useEffect(()=>{!q||Fe===0||(q.event==="task_status_changed"&&q.taskId===m||q.event==="task_created"&&q.taskId===m)&&(E(),U())},[Fe,q,m,E,U]),l.useEffect(()=>{if(N)return;const i=setInterval(()=>{document.visibilityState!=="hidden"&&Promise.all([E(),te(),U()])},15e3);return()=>clearInterval(i)},[N,E,te,U]);const Me=l.useCallback(()=>j(null),[]),se=l.useCallback(()=>{j(null),E()},[E]),dt=(t==null?void 0:t.status)===L.FAILED||(t==null?void 0:t.status)===L.CANCELLED,ue=(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(()=>{Ce.get("action")==="fork"&&t&&!C&&(ue&&Oe(),ct(a=>(a.delete("action"),a),{replace:!0}))},[t,C,Ce,ue]);async function mt(){z(!0);try{await r(m),R(!1),await E()}finally{z(!1)}}async function pt(){u(!0);try{await g.post(`web/tasks/${m}/retry`,{json:{reuseWorkspace:_e}}),$(!1),xe(!1),await E()}finally{u(!1)}}function Oe(){we(""),S(!0)}async function ut(){T(!0);try{const a=await g.post(`web/tasks/${m}/fork`,{json:{description:ke||void 0}}).json();S(!1),V.success(s("tasks.fork_success")),c(`/tasks/${a.task.id}`)}catch{V.error(s("tasks.fork_error"))}finally{T(!1)}}const y=l.useMemo(()=>t?ts(t):[],[t==null?void 0:t.configSnapshot,t==null?void 0:t.currentStage,t==null?void 0:t.status]),he=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,f=Rt(t.startedAt,t.completedAt),fe=$t(t),ve=at(t.agentType),ae=`${s("tasks.status_suspended")} / ${ve}`,Ue=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,qe=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(Ut,{className:"h-4 w-4"})}),e.jsxs("span",{className:"line-clamp-2 text-sm font-medium text-[var(--text-primary)]",title:kt(t),children:["#",t.id," ",Xe(t,100)]})]}),be=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(ne,{status:t.status,agentType:t.agentType}),f&&e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["// time cost: ",f]}),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(He,{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(d,t.branch)?e.jsx("a",{href:G(d,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: ",((Ge=t.mrUrl.match(/!?\d+$/))==null?void 0:Ge[0])??"view"]})]})]}),Be=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:[!N&&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(st,{className:"h-3 w-3"}),s("tasks.cancel_task")]}),dt&&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(nt,{className:"h-3 w-3"}),s("tasks.retry_task")]}),ue&&e.jsxs("button",{onClick:Oe,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(qt,{className:"h-3 w-3"}),s("tasks.fork_task")]}),t.workerId&&!N&&e.jsxs("button",{onClick:()=>{oe("pipeline"),setTimeout(()=>{var a,i;(i=(a=Ae.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(Bt,{className:"h-3 w-3"}),s("tasks.cursor_tunnel")]})]}),ht=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(Ze,{stages:y})]}),f&&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: ",f]}),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")})]})]}),ge=e.jsxs(e.Fragment,{children:[e.jsx(Qt,{isOpen:le,onClose:()=>R(!1),onConfirm:mt,taskId:m,isLoading:K}),e.jsx(Yt,{isOpen:F,onClose:()=>{$(!1),xe(!1)},onConfirm:pt,taskId:m,mrUrl:t.mrUrl??void 0,isLoading:ie,reuseWorkspace:_e,onReuseWorkspaceChange:xe}),e.jsx(ye,{isOpen:ce,onClose:()=>S(!1),onConfirm:ut,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 #",m]}),e.jsx("textarea",{value:ke,onChange:a=>we(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"})]})})]});return ot&&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:[be,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(et,{task:t,ptyStatus:Ie,displayAgentType:fe,t:s,gap:"gap-3"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(tt,{isFinished:N,takeoverState:pe,ptyRef:ee,t:s}),e.jsx("button",{onClick:()=>De(!1),className:"flex items-center rounded-[4px] bg-[var(--bg-card)] px-2.5 py-1 text-[var(--text-muted)]",children:e.jsx(Xt,{className:"h-3 w-3"})})]})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(Ve,{ref:ee,taskId:m,sessionId:t.currentSessionId??void 0,taskFinished:N,onStatusChange:$e,onTakeoverChange:Pe})}),Be,ge]}):t.status===L.SUSPENDED?e.jsxs("div",{className:"flex h-full flex-col font-mono lowercase",children:[qe,be,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(Ot,{content:wt(t),children:Xe(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:ae})]}),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:ae})}),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 g.post(`web/tasks/${m}/confirm-stage`,{json:{stageName:o.stageName,approved:!0}}),se()}catch{V.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 g.post(`web/tasks/${m}/confirm-stage`,{json:{stageName:o.stageName,approved:!1}}),se()}catch{V.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:ae})]}),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:H(t.createdAt)})]})]})]}),e.jsx("div",{className:"hidden md:flex flex-wrap items-center gap-2 py-2",children:y.map((a,i)=>{const v=a.status==="failed",b=a.status==="completed",P=a.status==="running"&&t.status===L.SUSPENDED,B=v?"var(--destructive)":b?"var(--accent)":P?"var(--warning)":"#525252",re=v?"rgba(239,68,68,0.12)":b?"rgba(34,197,94,0.12)":P?"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:re,fontWeight:P?700:400,border:P?`1px solid ${B}`:void 0},children:P?"confirm":`${a.name}${b?" ✓":v?" ✗":""}`}),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:ae})]}),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",v=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:v,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:H(t.createdAt)})]})})]})]}),o&&e.jsx(Je,{isOpen:!!o,onClose:Me,taskId:m,stageName:o.stageName,timeoutSeconds:Math.ceil(o.timeout/1e3),onSubmitted:se}),ge]}):e.jsxs("div",{className:"flex h-full flex-col overflow-hidden font-mono lowercase",children:[qe,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(ne,{status:t.status,agentType:t.agentType}),f&&e.jsxs("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:["// time cost: ",f]}),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(d,t.branch)?e.jsx("a",{href:G(d,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}))]}),be,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(zt,{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(Je,{isOpen:!!o,onClose:Me,taskId:m,stageName:o.stageName,timeoutSeconds:Math.ceil(o.timeout/1e3),onSubmitted:se}),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:()=>oe(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(et,{task:t,ptyStatus:Ie,displayAgentType:fe,t:s}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(tt,{isFinished:N,takeoverState:pe,ptyRef:ee,t:s}),!N&&pe==="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(lt,{className:"h-3 w-3 animate-spin"}),s("tasks.requesting_takeover")]}),!N&&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(Ht,{className:"h-3 w-3"}),s("tasks.skip_stage")]}),e.jsx("button",{onClick:()=>De(!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(Wt,{className:"h-3 w-3"})})]})]}),e.jsxs("div",{className:"flex items-center gap-2 border-b border-[var(--border)] px-4 py-2 shrink-0 md:hidden",children:[e.jsx(ne,{status:t.status,agentType:t.agentType}),e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["agent: ",fe]}),t.workerName&&e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["worker: ",t.workerName]})]}),e.jsxs("div",{className:"border-b border-[var(--border)] px-4 py-3 shrink-0 md:hidden",children:[e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:s("tasks.stage_progress")}),e.jsx("div",{className:"mt-2 overflow-x-auto no-scrollbar pr-4",style:{borderRadius:0},children:e.jsx("div",{className:"flex items-center gap-1 py-0.5",children:y.map((a,i)=>{const v=a.status==="completed",b=a.status==="running",B=a.status==="failed"?"var(--destructive)":v||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,v?" ✓":b?" ...":""]}),i<y.length-1&&e.jsx("div",{className:"mx-1.5 h-px w-4 shrink-0",style:{backgroundColor:B}})]},a.name)})})})]}),e.jsx("div",{className:"px-4 pt-3 pb-1 shrink-0 md:hidden",children:e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:s("tasks.pty_output")})}),e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(Ve,{ref:ee,taskId:m,sessionId:t.currentSessionId??void 0,taskFinished:N,onStatusChange:$e,onTakeoverChange:Pe})}),Be]}),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 v=a.status==="completed",b=a.status==="running",re=a.status==="failed"?"var(--destructive)":v||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:re},children:[v&&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:re},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<(he>=0?he: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," (",he+1,"/",y.length,")"]}),t.startedAt&&e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// elapsed: ",H(t.startedAt).replace(" ago","")]}),f&&e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// time cost: ",f]}),e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// retries: ",t.retryCount,"/2"]})]}),!t.currentStage&&f&&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: ",f]})}),e.jsx("button",{onClick:()=>oe("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??"-"})]}),Ue]})]}),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(Ze,{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:()=>{Le(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(Mt,{value:X,onChange:a=>{Le(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(_t,{className:"h-3.5 w-3.5 text-[var(--text-muted)]"}),e.jsx("input",{type:"text",placeholder:s("tasks.search_logs"),value:Z,onChange:a=>{it(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:[Se.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 ${es(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)),Se.length===0&&!xt&&e.jsx("p",{className:"py-8 text-center text-xs text-[var(--text-muted)]",children:s("tasks.no_log_entries")})]}),Y>50&&e.jsxs("div",{className:"flex items-center justify-center gap-1",children:[Array.from({length:Math.ceil(Y/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(Y/50)>5&&e.jsx("button",{onClick:()=>M(W+1),disabled:W>=Math.ceil(Y/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(Ct,{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:Ft(t.createdAt)}),e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:H(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(ne,{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(He,{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:ve})]}),f&&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:f})]}),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(d,t.branch)?e.jsx("a",{href:G(d,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:((Ke=t.mrUrl.match(/!?\d+$/))==null?void 0:Ke[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(Gt,{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(St,{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"&&ht,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:H(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:ve})]}),f&&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:f})]}),Ue]})]}),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:((ze=t.mrUrl.match(/!?\d+$/))==null?void 0:ze[0])??"view"})]})]})]}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsxs("div",{ref:Ae,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(Jt,{taskId:m,taskFinished:N,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"?"→":"·",v=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:v},children:i}),e.jsx("span",{className:a.status==="running"?"font-medium":"",style:{color:v},children:a.name}),e.jsxs("span",{className:"text-[11px]",style:{color:"#525252"},children:["— ",b]})]},a.name)})})]})]})]}),ge]})}export{fs as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{R as pe,f as H,a as z,p as u,j as e,l as Z,n as me,u as ue,i as be,r,h as D,X as ve,k as he,w as fe,H as ge,t as U,x as ye,y as W,m as je}from"./index-DJl-vKpg.js";import{a as ke,u as V}from"./task-constants-q2zc7hX5.js";import{T as ee}from"./TaskStatusBadge-BQr1iwes.js";import{f as te}from"./date-RFA7-ZGs.js";import{T as Ne}from"./Tooltip-D_CBrTO_.js";import{G as se}from"./git-fork-CBlyXbge.js";import{S as F}from"./Select-CKozUJa5.js";import{a as Ce}from"./agent-type-options-DUkN669t.js";import{C as we}from"./copy-cloBpe4U.js";import{E as X}from"./EmptyState-c4IsGUGS.js";import{T as Y}from"./Skeleton-1CByoX9G.js";import{P as Se}from"./plus-Dy384KeJ.js";import{C as _e}from"./chevron-left-BhcTbOUx.js";import{C as Te}from"./chevron-right-BuhDQxo4.js";import"./status-colors-D3fj6h6e.js";const Ee=pe.memo(function({task:s}){const d=H(),{t:i}=z(),x=(a,v)=>i(`common.${a}`,{n:v}),c=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:Z(s)})}),e.jsx("td",{className:"py-3 pr-4",children:e.jsx(ee,{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:[te(s.createdAt,x),c&&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:i("tasks.fork_task"),children:e.jsx(se,{className:"h-3 w-3"})})]})})]})});function De({isOpen:n,onClose:s,projects:d,projectsLoading:i,onSubmit:x,isSubmitting:c}){const{t:a}=z();ue(o=>o.user);const v=be(),[p,L]=r.useState(""),[b,K]=r.useState(""),[m,P]=r.useState("feat"),[k,C]=r.useState(""),[w,S]=r.useState(""),[y,_]=r.useState(""),[h,j]=r.useState(""),[O,B]=r.useState([]),[A,N]=r.useState(""),I=d.find(o=>o.key===p),M=Ce(o=>o,I==null?void 0:I.agentType);r.useEffect(()=>{if(!n||(L(""),K(""),P("feat"),C(""),S(""),_(""),j(""),N(""),!v))return;const o=new AbortController;return D.get("admin/developers",{signal:o.signal}).json().then(B).catch(()=>{}),()=>o.abort()},[n,v]),r.useEffect(()=>{if(!n)return;function o(f){f.key==="Escape"&&s()}return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[n,s]);async function T(o){if(o.preventDefault(),N(""),!p||!b.trim()){N(a("tasks.project_and_description_required"));return}try{await x({projectKey:p,description:b.trim(),workerId:y||void 0,developerId:h?Number(h):void 0,taskType:m,branchSlug:w.trim()||void 0,agentType:k||void 0})}catch(f){const q=f instanceof Error?f.message:a("tasks.failed_to_create_task");N(q)}}return n?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 font-mono",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},onClick:o=>{o.target===o.currentTarget&&s()},children:e.jsxs("div",{className:"w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",onClick:o=>o.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-6 py-4",children:[e.jsxs("h2",{className:"text-sm text-[var(--text-primary)]",children:["// ",a("tasks.new_task")]}),e.jsx("button",{onClick:s,className:"text-[var(--text-muted)] transition-colors hover:text-[var(--text-primary)]",children:e.jsx(ve,{className:"h-4 w-4"})})]}),e.jsxs("form",{onSubmit:T,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(F,{value:p,onChange:L,options:d.map(o=>({value:o.key,label:o.name})),placeholder:a(i?"common.loading":"tasks.select_project"),disabled:i})]}),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(F,{value:m,onChange:P,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(F,{value:k,onChange:C,options:M})]}),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:b,onChange:o=>K(o.target.value),placeholder:a("tasks.describe_task_placeholder"),rows:4,className:"w-full resize-none rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.target_worker")}),e.jsx("input",{type:"text",value:y,onChange:o=>_(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)]"})]}),v&&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(F,{value:h,onChange:j,options:O.map(o=>({value:String(o.id),label:o.name})),placeholder:a("tasks.select_developer")})]}),A&&e.jsx("div",{className:"rounded-[4px] bg-[#2a1515] border border-[var(--destructive)]/30 px-3 py-2 text-xs text-[var(--destructive)]",children:A})]}),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:c||!p||!b.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(c?"common.creating":"tasks.create_task")})]})]})]})}):null}function Fe({isOpen:n,onClose:s,onForceCreate:d,onViewExisting:i,similarTask:x,isLoading:c}){const{t:a}=z();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:v=>v.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:c,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:c?"not-allowed":"pointer",opacity:c?.7:1,transition:"color 0.15s, border-color 0.15s"},children:a("common.cancel")}),e.jsx("button",{type:"button",onClick:()=>i(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:c,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:c?"not-allowed":"pointer",opacity:c?.7:1},children:a(c?"common.creating":"tasks.dedup_create_anyway")})]})]})})}function Pe({task:n}){const s=H(),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," ",Z(n)]}),e.jsxs("span",{className:"flex items-center gap-1.5 shrink-0",children:[d&&e.jsx("button",{onClick:i=>{i.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(se,{className:"h-3 w-3"})}),e.jsx(ee,{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:te(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=H(),{t:s}=z(),{tasks:d,loading:i,fetchTasks:x}=V(),c=he(t=>t.taskSeq),[a,v]=r.useState("all"),[p,L]=r.useState(""),[b,K]=r.useState(""),[m,P]=r.useState(""),[k,C]=r.useState(void 0),[w,S]=r.useState([]),y=V(t=>t.nextCursor),[_,h]=r.useState(!1);fe(r.useMemo(()=>e.jsxs("button",{onClick:()=>h(!0),className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs font-mono text-black transition-opacity hover:opacity-90",children:[e.jsx(Se,{className:"h-3.5 w-3.5"}),s("tasks.new_task")]}),[s]));const[j,O]=r.useState([]),[B,A]=r.useState(!1),[N,I]=r.useState([]),[M,T]=r.useState(!1),[o,f]=r.useState(!1),[q,re]=r.useState(null),[$,R]=r.useState(null),J=r.useCallback(t=>{const l={limit:String(Ie)};return a!=="all"&&(l.status=a),p&&(l.projectKey=p),b&&(l.developerId=b),t&&(l.cursor=t),l},[a,p,b]);r.useEffect(()=>{x(J(k))},[J,k,x,c]),r.useEffect(()=>{C(void 0),S([])},[a,p,b]),r.useEffect(()=>{let t=!1;return(async()=>{try{const[g,xe]=await Promise.all([D.get("web/projects").json(),D.get("web/projects/-/developers").json()]);if(t)return;O(g),I(xe)}catch{}})(),()=>{t=!0}},[]),r.useEffect(()=>{if(!_||j.length>0)return;A(!0);let t=!1;return(async()=>{try{const g=await D.get("web/projects").json();t||O(g)}catch{}finally{t||A(!1)}})(),()=>{t=!0}},[_,j.length]);const ae=r.useCallback(async t=>{T(!0);try{const l=await D.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}}).json();h(!1),n(`/tasks/${l.task.id}`)}catch(l){if(l instanceof ge&&l.response.status===409){try{const g=await l.response.json();if(g.confirmRequired){re({id:g.confirmRequired.taskId,description:g.confirmRequired.message,status:"active"}),R(t),h(!1),f(!0);return}}catch{}U.error(s("tasks.similar_task_exists"))}else{const g=l instanceof Error?l.message:String(l);U.error(g)}}finally{T(!1)}},[n]),oe=r.useCallback(async()=>{if($){T(!0);try{const t=await D.post("web/tasks",{json:{...$,force:!0}}).json();f(!1),R(null),n(`/tasks/${t.task.id}`)}finally{T(!1)}}},[$,n]),E=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(()=>{y&&(S(t=>[...t,k??""]),C(y))},[y,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})},[]),ie=w.length+1,ce=r.useMemo(()=>[{value:"",label:s("tasks.filter_project")},...j.map(t=>({value:t.key,label:t.name}))],[j,s]),de=r.useMemo(()=>[{value:"",label:s("tasks.filter_developer")},...N.map(t=>({value:String(t.id),label:t.name}))],[N,s]),G=s(m?"tasks.try_adjusting_search":"tasks.create_first_task"),Q=m?void 0:e.jsx("button",{onClick:()=>h(!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:()=>v(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=>P(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:()=>P(""),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(F,{value:p,onChange:L,options:ce,className:"md:w-40"}),e.jsx(F,{value:b,onChange:K,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:[i&&E.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"p-4",children:e.jsx(Y,{rows:5})})}),!i&&E.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"p-4",children:e.jsx(X,{icon:W,title:s("tasks.no_tasks_found"),description:G,action:Q})})}),E.map(t=>e.jsx(Ee,{task:t},t.id))]})]})}),e.jsxs("div",{className:"flex flex-col gap-2 md:hidden",children:[i&&E.length===0&&e.jsx("div",{className:"p-4",children:e.jsx(Y,{rows:5})}),!i&&E.length===0&&e.jsx(X,{icon:W,title:s("tasks.no_tasks_found"),description:G,action:Q}),E.map(t=>e.jsx(Pe,{task:t},t.id))]}),(w.length>0||y)&&e.jsxs("div",{className:"mt-6 flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["// page ",ie]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick: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:!y,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:()=>h(!1),projects:j,projectsLoading:B,onSubmit:ae,isSubmitting:M}),e.jsx(Fe,{isOpen:o,onClose:()=>{f(!1),R(null)},onForceCreate:oe,onViewExisting:t=>{f(!1),R(null),n(`/tasks/${t}`)},similarTask:q,isLoading:M})]})}export{Ve as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as l,j as a}from"./index-
|
|
1
|
+
import{a as l,j as a}from"./index-DJl-vKpg.js";import{a as u}from"./status-colors-D3fj6h6e.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};
|
|
@@ -0,0 +1,11 @@
|
|
|
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 oe,s as le,j as e,X as ee,v as de,f as xe,l as me,m as ue}from"./index-DJl-vKpg.js";import{g as te,P as pe,H as he,C as fe}from"./PtyTerminal-BQ2UYeLe.js";import{T as B,u as ve,a as G,g as ge}from"./task-constants-q2zc7hX5.js";import{i as J,O as se}from"./OnboardingGuide-DniYFVLU.js";import{S as C,C as be}from"./Select-CKozUJa5.js";import{a as ae}from"./status-colors-D3fj6h6e.js";import{a as je}from"./date-RFA7-ZGs.js";import{g as ke}from"./agent-type-options-DUkN669t.js";import{u as ne}from"./useFetch-CyCGABKu.js";import{P as $}from"./plus-Dy384KeJ.js";import{R as ye}from"./rotate-ccw-BqKuF1OZ.js";import{W as Ne}from"./wifi-DKdwzLvS.js";import"./chevron-right-BuhDQxo4.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 Te=Z("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
|
|
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 we=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 U(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}),U({pinnedTaskIds:a().pinnedTaskIds,activeTaskId:s})},pinTask:s=>{const{pinnedTaskIds:n}=a();if(n.includes(s))return;const o=[...n,s];t({pinnedTaskIds:o}),U({pinnedTaskIds:o,activeTaskId:a().activeTaskId})},unpinTask:s=>{const{pinnedTaskIds:n,activeTaskId:o,taskMetas:m}=a(),r=n.filter(h=>h!==s),l=o===s?r[0]??null:o,{[s]:p,...i}=m;t({pinnedTaskIds:r,activeTaskId:l,taskMetas:i}),U({pinnedTaskIds:r,activeTaskId:l})},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)),o={};for(const i of n)o[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,h)=>h.updatedAt.localeCompare(i.updatedAt)).map(i=>i.id),{activeTaskId:l}=a(),p=l&&r.includes(l)?l:r[0]??null;t({taskMetas:o,pinnedTaskIds:r,activeTaskId:p}),U({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:o}=a(),m=o[s];m&&t({taskMetas:{...o,[s]:{...m,...n}}})}}));function Ie(){const[t,a]=c.useState(()=>J());c.useEffect(()=>{const n=()=>a(!0),o=()=>a(J());return window.addEventListener("onboarding-dismissed",n),window.addEventListener("storage",o),()=>{window.removeEventListener("onboarding-dismissed",n),window.removeEventListener("storage",o)}},[]);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(),[o,m]=c.useState(a.timeout),[r,l]=c.useState(!1);c.useEffect(()=>{m(a.timeout);const i=setInterval(()=>{m(h=>h<=1?(clearInterval(i),0):h-1)},1e3);return()=>clearInterval(i)},[a.timeout,a.stageName]);const p=c.useCallback(async i=>{l(!0);try{await A.post(`web/tasks/${t}/confirm-stage`,{json:{stageName:a.stageName,approved:i}}),s()}catch{}finally{l(!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(o)})]}),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(),o=ve(x=>x.createTask),[m,r]=c.useState(""),[l,p]=c.useState("feat"),[i,h]=c.useState(void 0),[f,_]=c.useState(!1),[I,E]=c.useState(!1),[F,D]=c.useState(!1),{data:T}=ne(()=>A.get("web/projects").json(),[]),b=c.useMemo(()=>{const x=(T??[]).map(R=>({value:R.key,label:R.key}));return[{value:"",label:n("terminal_home.all_projects")},...x]},[T,n]),v=c.useMemo(()=>(T??[]).find(x=>x.key===t)??null,[T,t]),k=c.useMemo(()=>ke(x=>x,v==null?void 0:v.agentType),[v==null?void 0:v.agentType]),w=c.useRef(!1);c.useEffect(()=>{if(!w.current){if(t){w.current=!0;return}b.length>1&&(a(b[1].value),w.current=!0)}},[t,b,a]),c.useEffect(()=>{h(void 0)},[t]);const u=i??(v==null?void 0:v.agentType)??"",O=c.useCallback(x=>{if(!v||x===v.agentType){h(void 0);return}h(x)},[v]),y=!!t&&!!m.trim();function g(){y&&E(!0)}async function S(){if(E(!1),!!y){_(!0);try{const x=await o({projectKey:t,description:m.trim(),taskType:l,agentType:i||void 0});r(""),s(x.id)}catch{}finally{_(!1)}}}const L=n("terminal_home.confirm_create_message").replace("{taskType}",l).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:b,placeholder:n("terminal_home.select_project")})}),e.jsx("div",{className:"w-[100px]",children:e.jsx(C,{value:l,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:f||!t})}),e.jsx("input",{type:"text",value:m,onChange:x=>r(x.target.value),onKeyDown:x=>x.key==="Enter"&&g(),placeholder:n("terminal_home.task_description_placeholder"),className:P,disabled:f}),e.jsxs("button",{onClick:g,disabled:f||!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(f?"common.creating":"terminal_home.new_task")]})]}),e.jsx("div",{className:"md:hidden border-b border-[var(--border)] bg-[var(--bg-card)]",children:F?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:b,placeholder:n("terminal_home.select_project")})}),e.jsx("div",{className:"w-[100px]",children:e.jsx(C,{value:l,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:f||!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"&&g(),placeholder:n("terminal_home.task_description_placeholder"),className:P,disabled:f}),e.jsx("button",{onClick:g,disabled:f||!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:f})]})}function Y({status:t,size:a}){const s=t===N.SUSPENDED,n=ae(t),o=a==="sm"?"h-1.5 w-1.5":"h-2 w-2";return e.jsx("span",{className:`${o} shrink-0 rounded-full ${s?"animate-pulse":""}`,style:{backgroundColor:s?"var(--warning)":n}})}function Me({tasks:t,activeId:a,onSelect:s,onUnpin:n,children:o}){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 l=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 ${l?"bg-[var(--accent)]/10 text-[var(--text-primary)]":"text-[var(--text-secondary)] hover:bg-[var(--bg-input)] hover:text-[var(--text-primary)]"}`,children:[e.jsx(Y,{status: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 l=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 ${l?"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)})}),o]})]})}function De({task:t,takeoverState:a,onTakeover:s,onRelease:n}){const o=ae(t.status),m=ge(t.agentType),r=a==="manual",l=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:o},children:[t.status.toLowerCase()," / ",m]}),t.currentStage&&e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["// ",t.currentStage]}),e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["agent: ",l]}),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(we,{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(Te,{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:o,loading:m,setActiveTask:r,pinTask:l,unpinTask:p,loadActiveTasks:i,fetchStageConfirm:h,clearStageConfirm:f,updateTaskMeta:_}=_e(),I=c.useRef(null),[E,F]=c.useState("disconnected"),[D,T]=c.useState("auto"),[b,v]=c.useState(""),k=z(d=>d.lastEvent),w=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&&(v(u.projectKey),y.current=!0)},[u]);const g=c.useMemo(()=>{const d=a.map(j=>n[j]).filter(Boolean);return b?d.filter(j=>j.projectKey===b):d},[a,n,b]);c.useEffect(()=>{g.length>0&&s&&!g.some(d=>d.id===s)&&r(g[0].id)},[g,s,r]);const S=Ie();oe(u?le(u):null),c.useEffect(()=>{i()},[i]),c.useEffect(()=>{s&&(u==null?void 0:u.status)===N.SUSPENDED?h(s):f()},[s,u==null?void 0:u.status,h,f]),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&&h(d),B.includes(j)&&d===s&&f()}k.event==="task_created"&&i()}},[k,s,h,f,_,i]),c.useEffect(()=>{if(w==="connected")return;const j=setInterval(()=>{document.visibilityState!=="hidden"&&i()},15e3);return()=>clearInterval(j)},[w,i]);const L=c.useCallback(d=>{l(d),r(d),i()},[l,r,i]),P=c.useCallback(()=>{f(),i()},[f,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=g.length>0;return e.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsx(Ae,{projectKey:b,onProjectChange:v,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:g,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}),o&&s&&e.jsx(Ee,{taskId:s,confirm:o,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:F,onTakeoverChange:T,ref:I},s)}),e.jsx(Oe,{task:u,ptyStatus:E})]}):e.jsx(X,{onboardingData:S})})]}):e.jsx(X,{onboardingData:S})})]})}export{Qe 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,Z as k,V,a4 as T,v as $}from"./index-DJl-vKpg.js";import{K as E}from"./key-BwIOi-0U.js";import{C as S}from"./copy-cloBpe4U.js";import{E as K}from"./external-link-Clr8ygf6.js";import{E as P}from"./EmptyState-c4IsGUGS.js";import{T as W}from"./Skeleton-1CByoX9G.js";import{u as B}from"./useFetch-CyCGABKu.js";import{e as R}from"./status-colors-D3fj6h6e.js";import{P as J}from"./plus-Dy384KeJ.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:V,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($,{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-
|
|
1
|
+
import{O as m,r as e,j as t}from"./index-DJl-vKpg.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-
|
|
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-DJl-vKpg.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
|
|
@@ -0,0 +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-DJl-vKpg.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-D3fj6h6e.js";import{I as l}from"./InfoRow-OjQK-lfD.js";import{M as D}from"./MetricBar-Ct-6XoF8.js";import{u as pe}from"./useFetch-CyCGABKu.js";import{T as ue}from"./Tooltip-D_CBrTO_.js";import{T as U}from"./trash-2-CYF0CqNA.js";import{A as be}from"./arrow-left-BPE0QXvK.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};
|
|
@@ -0,0 +1,6 @@
|
|
|
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-DJl-vKpg.js";import{w as W}from"./status-colors-D3fj6h6e.js";import{M as _}from"./MetricBar-Ct-6XoF8.js";import Y from"./WorkerSetupGuidePage-Bj7AFF_z.js";import{C as z}from"./copy-cloBpe4U.js";import{L as Z}from"./loader-circle-CF4O3sgn.js";import{S as ee}from"./Select-CKozUJa5.js";import{E as te}from"./EmptyState-c4IsGUGS.js";import{C as re}from"./Skeleton-1CByoX9G.js";import{u as se}from"./useFetch-CyCGABKu.js";import{P as ae}from"./plus-Dy384KeJ.js";import"./key-BwIOi-0U.js";import"./download-BxlPrmML.js";import"./settings-iP7F66C4.js";import"./wifi-DKdwzLvS.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 oe=G("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]),ne=U.memo(function({worker:r,onClick:l}){const{t}=C();return e.jsxs("div",{onClick:l,className:`rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 font-mono lowercase transition-colors ${l?"cursor-pointer hover:border-[var(--accent)]/40 hover:bg-[var(--bg-input)]":""}`,children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsxs("h3",{className:"truncate text-sm text-[var(--text-primary)]",children:[e.jsx("span",{style:{color:W[r.status],fontSize:"0.6rem"},children:"●"})," ",r.name]}),e.jsx("span",{className:"text-xs",style:{color:W[r.status]},children:r.status})]}),e.jsxs("div",{className:"mb-3 text-xs text-[var(--text-muted)]",children:[r.host,r.os?`:${r.os}`:""]}),e.jsxs("div",{className:"mb-3 flex flex-col gap-2",children:[e.jsx(_,{label:t("workers.cpu"),value:r.cpuUsage,variant:"inline"}),e.jsx(_,{label:t("workers.mem"),value:r.memoryUsage,variant:"inline"}),e.jsx(_,{label:t("workers.disk"),value:r.diskUsage,variant:"inline"})]}),e.jsx("div",{className:"flex items-center justify-between text-xs",children:e.jsx("span",{className:"text-[var(--text-secondary)]",children:t("workers.tasks_slots",{active:String(r.activeSlots),max:String(r.maxSlots)})})}),r.capabilities.length>0&&e.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:r.capabilities.map(s=>{var d;const c=(d=r.degradedCapabilities)==null?void 0:d.some(i=>i.agentType===s);return e.jsx("span",{className:`rounded-[4px] border px-1.5 py-0.5 text-[11px] ${c?"border-[var(--warning)] text-[var(--warning)]":"border-[var(--border)] text-[var(--text-muted)]"}`,children:s},s)})})]})});function le({isOpen:m,onClose:r,onRegistered:l}){const{t}=C(),[s,c]=o.useState(1),[d,i]=o.useState(!1),[x,u]=o.useState(""),[b,g]=o.useState(null),[v,h]=o.useState(""),[k,a]=o.useState(""),[j,y]=o.useState(!1),[A,w]=o.useState(!1),[D,T]=o.useState(""),[I,$]=o.useState(""),p=o.useRef(null),F={1:t("workers.reg_step_generate_token"),2:t("workers.reg_step_install_worker"),3:t("workers.reg_step_waiting_activation"),4:t("workers.reg_step_activated")};o.useEffect(()=>(m&&(c(1),u(""),g(null),h(""),a(""),y(!1),w(!1),T(""),$(""),i(!1)),()=>{p.current&&clearInterval(p.current)}),[m]);const E=async()=>{const n=v.trim();if(!n){a(t("admin.pat_label_required"));return}a(""),i(!0);try{const f=await S.post("admin/worker-tokens",{json:{label:n}}).json();u(f.token),g(f.tokenId),c(2)}catch{}finally{i(!1)}},O=typeof window<"u"?window.location.origin:"https://overlord.example.com",L=x?`overlord setup worker --token ${x} --server ${O}`:"",P=()=>{navigator.clipboard.writeText(x),y(!0),setTimeout(()=>y(!1),2e3)},R=()=>{navigator.clipboard.writeText(L),w(!0),setTimeout(()=>w(!1),2e3)},B=o.useCallback(()=>{b&&(c(3),p.current=setInterval(async()=>{try{const n=await S.get(`admin/worker-tokens/${b}/status`).json();n.used&&n.workerName&&(T(n.workerName),$(n.workerId??""),c(4),p.current&&clearInterval(p.current),l==null||l())}catch{}},3e3))},[b,l]);return o.useEffect(()=>()=>{p.current&&clearInterval(p.current)},[]),m?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center font-mono lowercase",children:[e.jsx("div",{className:"absolute inset-0 bg-[var(--bg-primary)]/60 backdrop-blur-sm",onClick:r}),e.jsxs("div",{className:"relative z-10 w-full max-w-[1080px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-8",children:[e.jsx("button",{type:"button",onClick:r,className:"absolute right-4 top-4 text-[var(--text-muted)] hover:text-[var(--text-primary)]",children:e.jsx(q,{className:"h-4 w-4"})}),e.jsx("h2",{className:"text-lg font-bold text-[var(--accent)]",children:t("workers.reg_title")}),e.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:t("workers.reg_subtitle")}),e.jsx("div",{className:"mt-6 flex items-center justify-center gap-2",children:[1,2,3,4].map((n,f)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:`rounded-[4px] px-3 py-1.5 text-[11px] font-bold ${n===s?"bg-[var(--accent)] text-black":n<s?"bg-[var(--accent)]/20 text-[var(--accent)]":"border border-[var(--border)] bg-[var(--bg-primary)] text-[var(--text-muted)]"}`,children:[n,". ",F[n]]}),f<3&&e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"→"})]},n))}),e.jsxs("div",{className:"mt-6 grid grid-cols-1 gap-4 lg:grid-cols-2",children:[e.jsxs("div",{className:`rounded-[4px] border p-4 ${s===1?"border-[var(--accent)] bg-[var(--bg-primary)]":"border-[var(--border)] bg-[var(--bg-primary)]"}`,children:[e.jsxs("p",{className:"text-[13px] font-bold text-[var(--accent)]",children:["> ",t("workers.reg_step_generate_token")]}),s===1&&!x?e.jsxs("div",{className:"mt-3 space-y-3",children:[e.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:t("workers.reg_click_to_generate")}),k&&e.jsx("p",{className:"text-[11px] text-red-400",children:k}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-[11px] text-[var(--text-muted)]",children:t("admin.label")}),e.jsx("input",{type:"text",placeholder:t("admin.pat_label_placeholder"),value:v,onChange:n=>h(n.target.value),onKeyDown:n=>{n.key==="Enter"&&E()},className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-1.5 text-[11px] text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:border-[var(--accent)] focus:outline-none"})]}),e.jsx("button",{type:"button",onClick:E,disabled:d,className:"rounded-[4px] bg-[var(--accent)] px-4 py-1.5 text-xs font-bold text-black disabled:opacity-50",children:t(d?"admin.generating":"workers.reg_step_generate_token")})]}):x?e.jsxs("div",{className:"mt-3 space-y-3",children:[e.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:t("workers.reg_token_generated")}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[11px] text-[var(--text-muted)]",children:"Token"}),e.jsxs("div",{className:"relative rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] px-3 py-2 pr-16",children:[e.jsx("code",{className:"block break-all text-[11px] text-[var(--text-primary)]",children:x}),e.jsx("button",{type:"button",onClick:P,className:"absolute right-2 top-1.5 text-[11px] text-[var(--text-muted)] hover:text-[var(--text-primary)]",children:j?e.jsx("span",{className:"text-[var(--accent)]",children:t("common.copied")}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(z,{className:"h-3 w-3"})," ",t("common.copy")]})})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[11px] text-[var(--text-muted)]",children:t("admin.setup_command")}),e.jsxs("div",{className:"relative rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] px-3 py-2 pr-16",children:[e.jsxs("code",{className:"block break-all text-[11px] text-[var(--accent)]",children:["$ ",L]}),e.jsx("button",{type:"button",onClick:R,className:"absolute right-2 top-1.5 text-[11px] text-[var(--text-muted)] hover:text-[var(--text-primary)]",children:A?e.jsx("span",{className:"text-[var(--accent)]",children:t("common.copied")}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(z,{className:"h-3 w-3"})," ",t("common.copy")]})})]})]}),e.jsx("div",{className:"rounded-[4px] border border-yellow-500/30 bg-yellow-500/10 px-3 py-2 text-[11px] text-yellow-400",children:t("admin.token_shown_once")})]}):e.jsx("p",{className:"mt-2 text-[11px] text-[var(--text-muted)]",children:t("workers.reg_completed")})]}),e.jsxs("div",{className:`rounded-[4px] border p-4 ${s===2?"border-[var(--accent)] bg-[var(--bg-primary)]":"border-[var(--border)] bg-[var(--bg-primary)]"}`,children:[e.jsxs("p",{className:"text-[13px] font-bold text-[var(--text-primary)]",children:["> ",t("workers.reg_step_install_worker")]}),e.jsx("p",{className:"mt-2 text-[11px] text-[var(--text-muted)]",children:t("workers.reg_running_installation")}),s>=2&&e.jsxs("div",{className:"mt-3 space-y-1 rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] p-3",children:[e.jsx("p",{className:"text-[11px] text-[var(--text-primary)]",children:"$ overlord setup worker"}),e.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:"server url: https://..."}),e.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:"worker token: ovw_..."}),e.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:"worker name: my-worker"}),e.jsx("p",{className:"text-[11px] text-[var(--accent)]",children:"config written. starting worker..."}),s===2&&e.jsx("p",{className:"text-[11px] text-[var(--accent)] animate-pulse",children:"█"})]}),s===2&&e.jsx("button",{type:"button",onClick:B,className:"mt-3 rounded-[4px] bg-[var(--accent)] px-4 py-1.5 text-xs font-bold text-black",children:t("workers.reg_installed_wait")})]}),e.jsxs("div",{className:`rounded-[4px] border p-4 ${s===3?"border-amber-500 bg-[var(--bg-primary)]":"border-[var(--border)] bg-[var(--bg-primary)]"}`,children:[e.jsxs("p",{className:"text-[13px] font-bold text-[var(--text-primary)]",children:["> ",t("workers.reg_step_waiting_activation")]}),s>=3?e.jsx("div",{className:"mt-3 flex flex-col items-center justify-center gap-3 py-6",children:s===3?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full border-2 border-amber-500",children:e.jsx(Z,{className:"h-5 w-5 animate-spin text-amber-500"})}),e.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:t("workers.reg_listening_for_worker")})]}):e.jsx("p",{className:"text-[11px] text-[var(--accent)]",children:t("workers.reg_worker_connected")})}):e.jsx("p",{className:"mt-2 text-[11px] text-[var(--text-muted)]",children:t("workers.reg_waiting_for_worker")})]}),e.jsxs("div",{className:`rounded-[4px] border p-4 ${s===4?"border-[var(--accent)] bg-[var(--bg-primary)]":"border-[var(--border)] bg-[var(--bg-primary)]"}`,children:[e.jsxs("p",{className:"text-[13px] font-bold text-[var(--text-primary)]",children:["> ",t("workers.reg_step_activated")]}),s===4?e.jsxs("div",{className:"mt-3 flex flex-col items-center justify-center gap-3 py-6",children:[e.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-full bg-[var(--accent)]/20",children:e.jsx(K,{className:"h-6 w-6 text-[var(--accent)]"})}),e.jsx("p",{className:"text-xs font-bold text-[var(--accent)]",children:t("workers.reg_worker_activated",{name:D})}),I&&e.jsxs("p",{className:"text-[11px] text-[var(--text-muted)]",children:["worker_id: ",I]})]}):e.jsx("p",{className:"mt-2 text-[11px] text-[var(--text-muted)]",children:t("workers.reg_worker_registered")})]})]}),s===4&&e.jsx("div",{className:"mt-6 flex justify-end",children:e.jsx("button",{type:"button",onClick:r,className:"rounded-[4px] bg-[var(--accent)] px-5 py-2 text-xs font-bold text-black",children:t("workers.reg_done")})})]})]}):null}function we(){const m=H(),{t:r}=C(),[l,t]=o.useState("all"),[s,c]=o.useState("fleet"),[d,i]=o.useState(!1),[x,u]=o.useState(0),b=V(a=>{var j;return(j=a.user)==null?void 0:j.role}),g=X(a=>a.workerSeq),{data:v,loading:h}=se(()=>{const a={};return l!=="all"&&(a.status=l),S.get("web/workers",{searchParams:a}).json()},[l,x,g]),k=o.useMemo(()=>[{value:"all",label:r("workers.all_statuses")},{value:N.ONLINE,label:r("workers.online")},{value:N.OFFLINE,label:r("workers.offline")},{value:N.DRAINING,label:r("workers.draining")}],[r]);return J(o.useMemo(()=>b===Q.ADMIN?e.jsxs("button",{type:"button",onClick:()=>i(!0),className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity",children:[e.jsx(ae,{size:14}),r("workers.register_worker")]}):null,[b,r])),e.jsxs("div",{className:"mx-auto max-w-6xl px-4 md:px-6 py-8 font-mono lowercase",children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between border-b border-[var(--border)]",children:[e.jsxs("div",{className:"flex overflow-x-auto no-scrollbar",children:[e.jsxs("button",{type:"button",onClick:()=>{c("fleet"),u(a=>a+1)},className:`flex shrink-0 whitespace-nowrap items-center gap-2 px-4 py-2.5 text-xs transition-colors ${s==="fleet"?"border-b-2 border-[var(--accent)] text-[var(--text-primary)]":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:[e.jsx(M,{size:14}),r("workers.fleet")]}),e.jsxs("button",{type:"button",onClick:()=>c("setup_guide"),className:`flex shrink-0 whitespace-nowrap items-center gap-2 px-4 py-2.5 text-xs transition-colors ${s==="setup_guide"?"border-b-2 border-[var(--accent)] text-[var(--text-primary)]":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:[e.jsx(oe,{size:14}),r("workers.setup_guide")]})]}),s==="fleet"&&e.jsx(ee,{value:l,onChange:t,options:k})]}),s==="fleet"?h?e.jsx(re,{cards:6}):!v||v.length===0?e.jsx(te,{icon:M,title:r("workers.no_workers_found"),description:r(l!=="all"?"workers.try_changing_status_filter":"workers.no_workers_registered"),action:e.jsx("button",{type:"button",onClick:()=>c("setup_guide"),className:"rounded-[4px] bg-[var(--accent)] px-5 py-2 text-[11px] font-bold text-black",children:r("workers.view_setup_guide")})}):e.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:(v??[]).map(a=>e.jsx(ne,{worker:a,onClick:()=>m(`/workers/${a.id}`)},a.id))}):e.jsx(Y,{}),e.jsx(le,{isOpen:d,onClose:()=>{i(!1),u(a=>a+1)},onRegistered:()=>{u(a=>a+1)}})]})}export{we as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./index-D3ZK8e35.js";function t(){return e.jsx("div",{className:"mx-auto max-w-4xl px-4 md:px-6 py-8 font-mono lowercase",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// overview"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"workers are the machines that execute tasks. overlord monitors worker health, handles capability degradation, recovers from disconnections, and cleans up orphaned processes — all automatically. this guide covers the operational behavior you should understand when running workers in production."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// health monitoring"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-xs text-[var(--accent)]",children:"> heartbeat"}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["workers send a heartbeat to the server every ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:"30 seconds"}),". if the server receives no heartbeat for ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:"3 minutes"}),", the worker is marked ",e.jsx("code",{className:"text-[var(--accent)]",children:"OFFLINE"}),"."]}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"the heartbeat payload includes system metrics (cpu, memory, disk usage) that are displayed in the web dashboard."})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-xs text-[var(--accent)]",children:"> disk usage auto-drain"}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["when a worker's disk usage exceeds ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:"90%"}),", the server automatically sets the worker status to ",e.jsx("code",{className:"text-[var(--accent)]",children:"DRAINING"}),". draining workers stop accepting new tasks but continue executing any in-progress work."]}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2",children:e.jsx("p",{className:"text-xs text-[var(--text-secondary)]",children:"// auto-drain is not automatically reversed. after freeing disk space, an operator must manually undrain the worker via the dashboard or api."})})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// capability degradation"}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["workers track consecutive failures per agent type. after ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:"3 consecutive failures"}),", that agent type is marked as degraded on the worker and tasks requiring it will be routed elsewhere."]}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"failure types determine the recovery window:"}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] 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)] bg-[var(--bg-card)]",children:[e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"failure type"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"recovery time"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"description"})]})}),e.jsxs("tbody",{className:"text-[var(--text-secondary)]",children:[e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"binary_missing"})}),e.jsx("td",{className:"px-3 py-2",children:"permanent"}),e.jsx("td",{className:"px-3 py-2",children:"agent binary not found — requires manual installation"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"auth_failure"})}),e.jsx("td",{className:"px-3 py-2",children:"5 minutes"}),e.jsx("td",{className:"px-3 py-2",children:"credential or token issue"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"rate_limit"})}),e.jsx("td",{className:"px-3 py-2",children:"1 minute"}),e.jsx("td",{className:"px-3 py-2",children:"upstream rate limit hit"})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"unknown"})}),e.jsx("td",{className:"px-3 py-2",children:"10 minutes"}),e.jsx("td",{className:"px-3 py-2",children:"unclassified error"})]})]})]})}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"a single successful execution resets the failure counter for that agent type, restoring the worker's capability."}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2",children:e.jsx("p",{className:"text-xs text-[var(--text-secondary)]",children:"// permanent degradation (e.g. binary_missing) persists until the worker is restarted with the missing binary installed."})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// orphan reaper"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"on startup, each worker runs an orphan reaper that cleans up processes left behind by a previous crash or unclean shutdown. this prevents zombie processes from consuming resources."}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"the cleanup sequence:"}),e.jsxs("ol",{className:"space-y-1 text-xs text-[var(--text-secondary)] list-none pl-0",children:[e.jsx("li",{children:"1. identify orphaned processes from previous worker sessions"}),e.jsxs("li",{children:["2. send ",e.jsx("code",{className:"text-[var(--accent)]",children:"SIGTERM"})," to each process"]}),e.jsxs("li",{children:["3. wait ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:"5 seconds"})," for graceful shutdown"]}),e.jsxs("li",{children:["4. send ",e.jsx("code",{className:"text-[var(--accent)]",children:"SIGKILL"})," to any remaining processes"]})]}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"the orphan reaper supports both linux and macos process management."})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// cursor remote tunnel"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"workers can start a cursor remote tunnel for a task's workspace, making it accessible via the web dashboard for interactive debugging."}),e.jsxs("ul",{className:"space-y-1 text-xs text-[var(--text-secondary)] list-none pl-0",children:[e.jsxs("li",{children:["— ",e.jsx("span",{className:"text-[var(--accent)]",children:"startup timeout:"})," 30 seconds — if the tunnel fails to establish within this window, it is marked as failed"]}),e.jsxs("li",{children:["— ",e.jsx("span",{className:"text-[var(--accent)]",children:"auto-crash recovery:"})," if the tunnel process crashes, the worker retries up to 3 times with exponential backoff (2s, 4s, 8s delays)"]})]}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"tunnels are tied to the task lifecycle and are torn down when the task completes or is cancelled."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// reconnection recovery"}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["when a worker comes back online after a disconnection, overlord reconciles task state between the worker's local view and the server's records. workers have a ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:"10 minute grace window"})," — if they reconnect within this period, recovery is attempted instead of failing all tasks."]}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"the reconciliation covers six branches:"}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] 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)] bg-[var(--bg-card)]",children:[e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"server state"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"worker state"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"action"})]})}),e.jsxs("tbody",{className:"text-[var(--text-secondary)]",children:[e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:"suspended"}),e.jsx("td",{className:"px-3 py-2",children:"running"}),e.jsxs("td",{className:"px-3 py-2",children:[e.jsx("span",{className:"text-[var(--accent)]",children:"resume"})," — task continued running, update server to running"]})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:"suspended"}),e.jsx("td",{className:"px-3 py-2",children:"completed"}),e.jsxs("td",{className:"px-3 py-2",children:[e.jsx("span",{className:"text-[var(--accent)]",children:"complete"})," — task finished while suspended, accept result"]})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:"failed"}),e.jsx("td",{className:"px-3 py-2",children:"running"}),e.jsxs("td",{className:"px-3 py-2",children:[e.jsx("span",{className:"text-[var(--accent)]",children:"cancel"})," — server marked it failed, tell worker to stop"]})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:"failed"}),e.jsx("td",{className:"px-3 py-2",children:"completed"}),e.jsxs("td",{className:"px-3 py-2",children:[e.jsx("span",{className:"text-[var(--accent)]",children:"restore"})," — task actually succeeded, restore result on server"]})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:"cancelled"}),e.jsx("td",{className:"px-3 py-2",children:"any"}),e.jsxs("td",{className:"px-3 py-2",children:[e.jsx("span",{className:"text-[var(--accent)]",children:"stop"})," — user cancelled, ensure worker stops execution"]})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-3 py-2",children:"not reported"}),e.jsx("td",{className:"px-3 py-2",children:"—"}),e.jsxs("td",{className:"px-3 py-2",children:[e.jsx("span",{className:"text-[var(--accent)]",children:"fail"})," — worker has no record of this task, mark it failed"]})]})]})]})}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2",children:e.jsx("p",{className:"text-xs text-[var(--text-secondary)]",children:"// the 10 minute grace window is intentionally generous to handle brief network blips, server restarts, and worker reboots without losing in-progress work."})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// boot reconciliation"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"when the server starts (or restarts), it reconciles all task state to ensure consistency:"}),e.jsxs("ul",{className:"space-y-1 text-xs text-[var(--text-secondary)] list-none pl-0",children:[e.jsxs("li",{children:["— ",e.jsx("span",{className:"text-[var(--accent)]",children:"queued tasks"})," — re-enqueued into the dispatch queue"]}),e.jsxs("li",{children:["— ",e.jsx("span",{className:"text-[var(--accent)]",children:"assigned tasks"})," (claimed by a worker but not yet running) — reset to queued for reassignment"]}),e.jsxs("li",{children:["— ",e.jsx("span",{className:"text-[var(--accent)]",children:"stale running tasks"})," (assigned to workers that are now offline) — marked as failed"]})]})]})]})})}export{t as default};
|
|
1
|
+
import{j as e}from"./index-DJl-vKpg.js";function t(){return e.jsx("div",{className:"mx-auto max-w-4xl px-4 md:px-6 py-8 font-mono lowercase",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// overview"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"workers are the machines that execute tasks. overlord monitors worker health, handles capability degradation, recovers from disconnections, and cleans up orphaned processes — all automatically. this guide covers the operational behavior you should understand when running workers in production."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// health monitoring"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-xs text-[var(--accent)]",children:"> heartbeat"}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["workers send a heartbeat to the server every ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:"30 seconds"}),". if the server receives no heartbeat for ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:"3 minutes"}),", the worker is marked ",e.jsx("code",{className:"text-[var(--accent)]",children:"OFFLINE"}),"."]}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"the heartbeat payload includes system metrics (cpu, memory, disk usage) that are displayed in the web dashboard."})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-xs text-[var(--accent)]",children:"> disk usage auto-drain"}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["when a worker's disk usage exceeds ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:"90%"}),", the server automatically sets the worker status to ",e.jsx("code",{className:"text-[var(--accent)]",children:"DRAINING"}),". draining workers stop accepting new tasks but continue executing any in-progress work."]}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2",children:e.jsx("p",{className:"text-xs text-[var(--text-secondary)]",children:"// auto-drain is not automatically reversed. after freeing disk space, an operator must manually undrain the worker via the dashboard or api."})})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// capability degradation"}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["workers track consecutive failures per agent type. after ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:"3 consecutive failures"}),", that agent type is marked as degraded on the worker and tasks requiring it will be routed elsewhere."]}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"failure types determine the recovery window:"}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] 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)] bg-[var(--bg-card)]",children:[e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"failure type"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"recovery time"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"description"})]})}),e.jsxs("tbody",{className:"text-[var(--text-secondary)]",children:[e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"binary_missing"})}),e.jsx("td",{className:"px-3 py-2",children:"permanent"}),e.jsx("td",{className:"px-3 py-2",children:"agent binary not found — requires manual installation"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"auth_failure"})}),e.jsx("td",{className:"px-3 py-2",children:"5 minutes"}),e.jsx("td",{className:"px-3 py-2",children:"credential or token issue"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"rate_limit"})}),e.jsx("td",{className:"px-3 py-2",children:"1 minute"}),e.jsx("td",{className:"px-3 py-2",children:"upstream rate limit hit"})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"unknown"})}),e.jsx("td",{className:"px-3 py-2",children:"10 minutes"}),e.jsx("td",{className:"px-3 py-2",children:"unclassified error"})]})]})]})}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"a single successful execution resets the failure counter for that agent type, restoring the worker's capability."}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2",children:e.jsx("p",{className:"text-xs text-[var(--text-secondary)]",children:"// permanent degradation (e.g. binary_missing) persists until the worker is restarted with the missing binary installed."})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// orphan reaper"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"on startup, each worker runs an orphan reaper that cleans up processes left behind by a previous crash or unclean shutdown. this prevents zombie processes from consuming resources."}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"the cleanup sequence:"}),e.jsxs("ol",{className:"space-y-1 text-xs text-[var(--text-secondary)] list-none pl-0",children:[e.jsx("li",{children:"1. identify orphaned processes from previous worker sessions"}),e.jsxs("li",{children:["2. send ",e.jsx("code",{className:"text-[var(--accent)]",children:"SIGTERM"})," to each process"]}),e.jsxs("li",{children:["3. wait ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:"5 seconds"})," for graceful shutdown"]}),e.jsxs("li",{children:["4. send ",e.jsx("code",{className:"text-[var(--accent)]",children:"SIGKILL"})," to any remaining processes"]})]}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"the orphan reaper supports both linux and macos process management."})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// cursor remote tunnel"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"workers can start a cursor remote tunnel for a task's workspace, making it accessible via the web dashboard for interactive debugging."}),e.jsxs("ul",{className:"space-y-1 text-xs text-[var(--text-secondary)] list-none pl-0",children:[e.jsxs("li",{children:["— ",e.jsx("span",{className:"text-[var(--accent)]",children:"startup timeout:"})," 30 seconds — if the tunnel fails to establish within this window, it is marked as failed"]}),e.jsxs("li",{children:["— ",e.jsx("span",{className:"text-[var(--accent)]",children:"auto-crash recovery:"})," if the tunnel process crashes, the worker retries up to 3 times with exponential backoff (2s, 4s, 8s delays)"]})]}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"tunnels are tied to the task lifecycle and are torn down when the task completes or is cancelled."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// reconnection recovery"}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["when a worker comes back online after a disconnection, overlord reconciles task state between the worker's local view and the server's records. workers have a ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:"10 minute grace window"})," — if they reconnect within this period, recovery is attempted instead of failing all tasks."]}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"the reconciliation covers six branches:"}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] 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)] bg-[var(--bg-card)]",children:[e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"server state"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"worker state"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"action"})]})}),e.jsxs("tbody",{className:"text-[var(--text-secondary)]",children:[e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:"suspended"}),e.jsx("td",{className:"px-3 py-2",children:"running"}),e.jsxs("td",{className:"px-3 py-2",children:[e.jsx("span",{className:"text-[var(--accent)]",children:"resume"})," — task continued running, update server to running"]})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:"suspended"}),e.jsx("td",{className:"px-3 py-2",children:"completed"}),e.jsxs("td",{className:"px-3 py-2",children:[e.jsx("span",{className:"text-[var(--accent)]",children:"complete"})," — task finished while suspended, accept result"]})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:"failed"}),e.jsx("td",{className:"px-3 py-2",children:"running"}),e.jsxs("td",{className:"px-3 py-2",children:[e.jsx("span",{className:"text-[var(--accent)]",children:"cancel"})," — server marked it failed, tell worker to stop"]})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:"failed"}),e.jsx("td",{className:"px-3 py-2",children:"completed"}),e.jsxs("td",{className:"px-3 py-2",children:[e.jsx("span",{className:"text-[var(--accent)]",children:"restore"})," — task actually succeeded, restore result on server"]})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:"cancelled"}),e.jsx("td",{className:"px-3 py-2",children:"any"}),e.jsxs("td",{className:"px-3 py-2",children:[e.jsx("span",{className:"text-[var(--accent)]",children:"stop"})," — user cancelled, ensure worker stops execution"]})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-3 py-2",children:"not reported"}),e.jsx("td",{className:"px-3 py-2",children:"—"}),e.jsxs("td",{className:"px-3 py-2",children:[e.jsx("span",{className:"text-[var(--accent)]",children:"fail"})," — worker has no record of this task, mark it failed"]})]})]})]})}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2",children:e.jsx("p",{className:"text-xs text-[var(--text-secondary)]",children:"// the 10 minute grace window is intentionally generous to handle brief network blips, server restarts, and worker reboots without losing in-progress work."})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// boot reconciliation"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"when the server starts (or restarts), it reconciles all task state to ensure consistency:"}),e.jsxs("ul",{className:"space-y-1 text-xs text-[var(--text-secondary)] list-none pl-0",children:[e.jsxs("li",{children:["— ",e.jsx("span",{className:"text-[var(--accent)]",children:"queued tasks"})," — re-enqueued into the dispatch queue"]}),e.jsxs("li",{children:["— ",e.jsx("span",{className:"text-[var(--accent)]",children:"assigned tasks"})," (claimed by a worker but not yet running) — reset to queued for reassignment"]}),e.jsxs("li",{children:["— ",e.jsx("span",{className:"text-[var(--accent)]",children:"stale running tasks"})," (assigned to workers that are now offline) — marked as failed"]})]})]})]})})}export{t as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as o,f as x,a as i,j as e,E as t}from"./index-
|
|
1
|
+
import{c as o,f as x,a as i,j as e,E as t}from"./index-DJl-vKpg.js";import{K as d}from"./key-BwIOi-0U.js";import{D as l}from"./download-BxlPrmML.js";import{S as m}from"./settings-iP7F66C4.js";import{W as p}from"./wifi-DKdwzLvS.js";/**
|
|
2
2
|
* @license lucide-react v0.469.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|