@overlordai/server 1.0.171 → 1.0.172
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/package.json +4 -4
- package/public/assets/{AccessTokensPage-Bj3ysKAB.js → AccessTokensPage-BSKEvmhc.js} +1 -1
- package/public/assets/{AdminPage-C539TbxG.js → AdminPage-d-75YuxT.js} +1 -1
- package/public/assets/{AgentCliPage-BtkvkTMV.js → AgentCliPage-Cxm16Iqx.js} +1 -1
- package/public/assets/{ApiReferencePage-6nqLrJAK.js → ApiReferencePage-Dhk18OkY.js} +1 -1
- package/public/assets/{ArchitecturePage-bwnZkzu3.js → ArchitecturePage-DmoMtimd.js} +1 -1
- package/public/assets/{AuditLogPage-CdVeWDly.js → AuditLogPage-DdZM1K0d.js} +1 -1
- package/public/assets/{AutomationCreatePage-Dbt7Xq9Q.js → AutomationCreatePage-0Dj7tMDO.js} +1 -1
- package/public/assets/{AutomationDetailPage-DpA4rBIW.js → AutomationDetailPage-BWh_rx3G.js} +1 -1
- package/public/assets/{AutomationEditPage-CXp0Mh0V.js → AutomationEditPage-CueVAD_p.js} +1 -1
- package/public/assets/{AutomationListPage-hEqWh1ig.js → AutomationListPage-DPbq7yXK.js} +1 -1
- package/public/assets/{AutomationRunDetailPage-DxAzCC9q.js → AutomationRunDetailPage-RR3em6-h.js} +1 -1
- package/public/assets/{BindPlatformPage-np67mZPL.js → BindPlatformPage-CTFRxIk3.js} +1 -1
- package/public/assets/{BotIntegrationPage-CMCVcqvP.js → BotIntegrationPage-B1iiLtAx.js} +1 -1
- package/public/assets/{BotManage-DCY4ci_8.js → BotManage-CxPzKBp_.js} +1 -1
- package/public/assets/{BotSetupPage-CV6E3sLe.js → BotSetupPage-ZzJlB2pv.js} +1 -1
- package/public/assets/{ChangelogPage-C0DV_86Z.js → ChangelogPage-m-DBhDE9.js} +1 -1
- package/public/assets/{Checkbox-DXBiglE2.js → Checkbox-DCm8s9lF.js} +1 -1
- package/public/assets/{CliReferencePage-CVrwNGMy.js → CliReferencePage-f5G7LIWg.js} +1 -1
- package/public/assets/{ConfirmStageDialog-fdJXh3vD.js → ConfirmStageDialog-Hr5m6-gd.js} +1 -1
- package/public/assets/{DeploymentPage-0SnOwvZx.js → DeploymentPage-D1_5WkBS.js} +1 -1
- package/public/assets/{DevWorkflowPage-ByX-y10Q.js → DevWorkflowPage-Dd-13vHW.js} +1 -1
- package/public/assets/{DeveloperManage-CApEiaHh.js → DeveloperManage-B7_DIaZ4.js} +1 -1
- package/public/assets/{DeveloperSetupPage-fbURtH8M.js → DeveloperSetupPage-CTJrqpEF.js} +1 -1
- package/public/assets/{DocsIndexPage-DbqbocXN.js → DocsIndexPage-Ynf1hXCG.js} +1 -1
- package/public/assets/{DocsLayout-gvYdBELt.js → DocsLayout-Bdq5wsxR.js} +1 -1
- package/public/assets/{DocsPrimitives-0rbwNPdJ.js → DocsPrimitives-BGGP86NT.js} +1 -1
- package/public/assets/{EditProjectPage-Dq8SvJ0e.js → EditProjectPage-BxEA4Fti.js} +1 -1
- package/public/assets/{EmptyState-BqdymWlY.js → EmptyState-DrJ71y5v.js} +1 -1
- package/public/assets/{EnvVariablesPage-D6txC9fC.js → EnvVariablesPage-B3lExh73.js} +1 -1
- package/public/assets/{HomePage-DEHVqmeo.js → HomePage-rT8PsE03.js} +1 -1
- package/public/assets/{InfoRow-LmWp744V.js → InfoRow-CyH41bJ_.js} +1 -1
- package/public/assets/{InstallationPage-CxgPPzCx.js → InstallationPage-CbVkag9M.js} +1 -1
- package/public/assets/{LandingPage-x9p9JIuL.js → LandingPage-DBL0evS0.js} +1 -1
- package/public/assets/{LocalDevelopmentPage-Di4tHT8X.js → LocalDevelopmentPage-5POLR9mL.js} +1 -1
- package/public/assets/{LoginPage-Stgm5fsG.js → LoginPage-CNQv0W_U.js} +1 -1
- package/public/assets/{MetricBar-CkZIfUq6.js → MetricBar-C93aACjn.js} +1 -1
- package/public/assets/{MultiSelect-vUaG8I2g.js → MultiSelect-C7StIvCC.js} +1 -1
- package/public/assets/{NotFoundPage-DotfKf-z.js → NotFoundPage-oojV5W8M.js} +1 -1
- package/public/assets/{OnboardingGuide-GBu1WXvY.js → OnboardingGuide-DfO_nz8H.js} +1 -1
- package/public/assets/{PermissionsPage-CiYmP2Wj.js → PermissionsPage-qsB8aosk.js} +1 -1
- package/public/assets/{PipelineConfigPage-BYjx1ouM.js → PipelineConfigPage-DSxENZ4i.js} +1 -1
- package/public/assets/{PipelineEditorPage-Bgks5WU6.js → PipelineEditorPage-CySUnVoU.js} +1 -1
- package/public/assets/{PlanPage-nl2u-0Pi.js → PlanPage-D1mVJ2Mw.js} +1 -1
- package/public/assets/{ProfilePage-Et9jbBjZ.js → ProfilePage-B667uLVG.js} +1 -1
- package/public/assets/{ProjectDetailPage-DI-y6wh8.js → ProjectDetailPage-C4zgDR0v.js} +1 -1
- package/public/assets/{ProjectListPage-CF5RsxEk.js → ProjectListPage-D5vomx51.js} +1 -1
- package/public/assets/{PtyTerminal-CGp0AVWL.js → PtyTerminal-Sg6Vp7_M.js} +1 -1
- package/public/assets/{QuickAuth-Dxrby18G.js → QuickAuth-CaTsNDEr.js} +1 -1
- package/public/assets/{RemoveMemberConfirmDialog-B_Wts2d_.js → RemoveMemberConfirmDialog-BD5yG1qR.js} +1 -1
- package/public/assets/{ReviewAggregatePage-BvfzhCsK.js → ReviewAggregatePage-MUHPll_y.js} +1 -1
- package/public/assets/{ReviewPage-pk0Wv8KH.js → ReviewPage-DiwlEzto.js} +1 -1
- package/public/assets/{Select-D6NqBbsj.js → Select-Oo9Mtr7U.js} +1 -1
- package/public/assets/{SettingsPage-DLVlWCKf.js → SettingsPage-lx0q0VBO.js} +1 -1
- package/public/assets/{Skeleton-CGmOAlS2.js → Skeleton-ZmBjZxS-.js} +1 -1
- package/public/assets/{SkillPage-C6CX9Bg_.js → SkillPage-Kc50_XXe.js} +1 -1
- package/public/assets/{TaskDetailPage-CENLCJst.js → TaskDetailPage-iDlyGLmh.js} +1 -1
- package/public/assets/{TaskGuidePage-3X9ztEXr.js → TaskGuidePage-BmnEXSr0.js} +1 -1
- package/public/assets/{TaskListPage-DxILG6Dr.js → TaskListPage-CfDTodGc.js} +1 -1
- package/public/assets/{TaskStatusBadge-BzUl_Vhj.js → TaskStatusBadge-CwRoPvBr.js} +1 -1
- package/public/assets/{TerminalHomePage-B6ONgq8m.js → TerminalHomePage-D-c23MN0.js} +1 -1
- package/public/assets/{TokenManage-C9HNs2Y0.js → TokenManage-CxO2jh-g.js} +1 -1
- package/public/assets/{Tooltip-CcKi7kt4.js → Tooltip-D4Qk5Haa.js} +1 -1
- package/public/assets/{TotpSetupPage-BokFT_bT.js → TotpSetupPage-Bc9dGVAZ.js} +1 -1
- package/public/assets/{WorkerDetailPage-DKe--j8i.js → WorkerDetailPage-aNr_lYRW.js} +1 -1
- package/public/assets/{WorkerListPage-CdHKiupA.js → WorkerListPage-HXlSdW5a.js} +1 -1
- package/public/assets/{WorkerOperationsPage-z39aqpPg.js → WorkerOperationsPage-DWCPIXtq.js} +1 -1
- package/public/assets/{WorkerSetupGuidePage-DdrUpofd.js → WorkerSetupGuidePage-Dc8EwtLE.js} +1 -1
- package/public/assets/{WorkerSetupPage-BmMDO6G3.js → WorkerSetupPage-xqSte9fR.js} +1 -1
- package/public/assets/{agent-type-options-DIKwG8ov.js → agent-type-options-bd4EFySP.js} +1 -1
- package/public/assets/{arrow-left-Dt8Fc2tT.js → arrow-left-CrWDmaxW.js} +1 -1
- package/public/assets/{arrow-right-CtNX35j0.js → arrow-right-6YV1GhPj.js} +1 -1
- package/public/assets/{bot-F2LxwOEN.js → bot-D0D8Ie9M.js} +1 -1
- package/public/assets/{chevron-down-D7Ostzf1.js → chevron-down-Ckd1H7Qb.js} +1 -1
- package/public/assets/{chevron-left-CgtOoE0B.js → chevron-left-BBUPVpzI.js} +1 -1
- package/public/assets/{chevron-right-D8nW44q3.js → chevron-right-Cuq0FVt8.js} +1 -1
- package/public/assets/{chevron-up-DdMU1Eht.js → chevron-up-C2DlCBBk.js} +1 -1
- package/public/assets/{circle-alert-CLeTDF2i.js → circle-alert-Ch-Edxwu.js} +1 -1
- package/public/assets/{clock-DCDEPUaH.js → clock-CrvlXUq5.js} +1 -1
- package/public/assets/{copy-C051Wr-d.js → copy-BYaFbye3.js} +1 -1
- package/public/assets/{download-BXnPaTq3.js → download-Dc0JEVAx.js} +1 -1
- package/public/assets/{external-link-B8hPJyFL.js → external-link-AIAS-X11.js} +1 -1
- package/public/assets/{git-fork-BD90ntZS.js → git-fork-CVba32im.js} +1 -1
- package/public/assets/{index-B19uS9bj.js → index-SIpO8066.js} +2 -2
- package/public/assets/{key-BZuQs2Pl.js → key-DBbJpxpA.js} +1 -1
- package/public/assets/{loader-circle-Bv_P4kd-.js → loader-circle-CgEDuRCD.js} +1 -1
- package/public/assets/{pencil-DTse6lO8.js → pencil-ByI4kFFH.js} +1 -1
- package/public/assets/{play-BtmqxS1O.js → play-D7LSd1xC.js} +1 -1
- package/public/assets/{plus-gbieRhvw.js → plus-C7qIBqP3.js} +1 -1
- package/public/assets/{rotate-ccw-C04sr08w.js → rotate-ccw-Dnr0SLIh.js} +1 -1
- package/public/assets/{scroll-text-BF_TwGla.js → scroll-text-aVgif8mt.js} +1 -1
- package/public/assets/{settings-C2xdeKAV.js → settings-DzZ0EIFb.js} +1 -1
- package/public/assets/{skip-forward-NKQNYaFc.js → skip-forward-B8b-c1X9.js} +1 -1
- package/public/assets/{status-colors-CbSft6mt.js → status-colors-DgUib6yo.js} +1 -1
- package/public/assets/{task-agent-ByA3yTq4.js → task-agent-CiiRe-U2.js} +1 -1
- package/public/assets/{task-constants-Nz6YB543.js → task-constants-Dl6aS_wt.js} +1 -1
- package/public/assets/{task.store-B7qvXDps.js → task.store-BO0eSFD5.js} +1 -1
- package/public/assets/{timer-DTjJ9vty.js → timer-B2Nne0hy.js} +1 -1
- package/public/assets/{trash-2-RJiyWQaa.js → trash-2-D6nUAwu0.js} +1 -1
- package/public/assets/{useFetch-Bvarcx0Z.js → useFetch-DPYKm7wX.js} +1 -1
- package/public/assets/{users-B0vZQYO0.js → users-DHIY-Lew.js} +1 -1
- package/public/assets/{wifi-_nfqPpUk.js → wifi-Bmp-6qp_.js} +1 -1
- package/public/assets/{workflow-DUZlRmfH.js → workflow-DrdevBLv.js} +1 -1
- package/public/assets/{zap-D628PASJ.js → zap-DbjBHXgM.js} +1 -1
- package/public/index.html +1 -1
- package/public/sw.js +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{R as he,f as W,a as $,o as u,j as e,l as se,u as fe,i as ge,v as re,r,h as A,X as ye,k as je,w as M,x as ke,H as Ne,t as X,y as Ce,z as Y,m as we}from"./index-B19uS9bj.js";import{u as Z}from"./task.store-B7qvXDps.js";import{T as ae}from"./TaskStatusBadge-BzUl_Vhj.js";import{f as oe}from"./date-CmcdoD87.js";import{T as Se}from"./Tooltip-CcKi7kt4.js";import{G as ne}from"./git-fork-BD90ntZS.js";import{S}from"./Select-D6NqBbsj.js";import{a as _e}from"./task-constants-Nz6YB543.js";import{g as Te}from"./agent-type-options-DIKwG8ov.js";import{C as Ee}from"./copy-C051Wr-d.js";import{E as ee}from"./EmptyState-BqdymWlY.js";import{T as te}from"./Skeleton-CGmOAlS2.js";import{P as Pe}from"./plus-gbieRhvw.js";import{C as Fe}from"./chevron-left-CgtOoE0B.js";import{C as Ae}from"./chevron-right-D8nW44q3.js";import"./status-colors-CbSft6mt.js";import"./chevron-down-D7Ostzf1.js";const De=he.memo(function({task:s}){const d=W(),{t:c}=$(),x=(a,b)=>c(`common.${a}`,{n:b}),i=s.status===u.COMPLETED||s.status===u.FAILED||s.status===u.CANCELLED;return e.jsxs("tr",{onClick:()=>d(`/tasks/${s.id}`),className:"cursor-pointer border-b border-[var(--border-row)] transition-colors hover:bg-[var(--bg-input)]",children:[e.jsxs("td",{className:"w-16 py-3 pr-4 font-mono text-xs font-medium text-[var(--text-secondary)] text-right tabular-nums",children:["#",s.id]}),e.jsx("td",{className:"py-3 pr-4 text-sm text-[var(--text-primary)] preserve-case",children:e.jsx(Se,{content:s.description,children:se(s)})}),e.jsx("td",{className:"py-3 pr-4",children:e.jsx(ae,{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:[oe(s.createdAt,x),i&&e.jsx("button",{onClick:a=>{a.stopPropagation(),d(`/tasks/${s.id}?action=fork`)},className:"shrink-0 rounded-[4px] p-1 text-[var(--text-muted)] hover:text-[var(--accent)] hover:bg-[var(--bg-input)] transition-colors",title:c("tasks.fork_task"),children:e.jsx(ne,{className:"h-3 w-3"})})]})})]})});function Ie({isOpen:o,onClose:s,projects:d,projectsLoading:c,onSubmit:x,isSubmitting:i}){const{t:a}=$();fe(n=>n.user);const b=ge();re(o);const[p,O]=r.useState(""),[v,R]=r.useState(""),[y,B]=r.useState("feat"),[m,D]=r.useState(""),[N,_]=r.useState(""),[h,T]=r.useState(""),[j,E]=r.useState(""),[f,k]=r.useState(""),[K,H]=r.useState([]),[I,C]=r.useState(""),L=d.find(n=>n.key===p),z=Te(n=>n,L==null?void 0:L.agentType);r.useEffect(()=>{if(!o||(O(""),R(""),B("feat"),D(""),_(""),T(""),E(""),k(""),C(""),!b))return;const n=new AbortController;return A.get("admin/developers",{signal:n.signal}).json().then(H).catch(()=>{}),()=>n.abort()},[o,b]);async function P(n){if(n.preventDefault(),C(""),!p||!v.trim()){C(a("tasks.project_and_description_required"));return}try{await x({projectKey:p,description:v.trim(),workerId:j||void 0,developerId:f?Number(f):void 0,taskType:y,branchSlug:N.trim()||void 0,agentType:m||void 0,targetBranch:h.trim()||void 0})}catch(w){const J=w instanceof Error?w.message:a("tasks.failed_to_create_task");C(J)}}return o?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 font-mono",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},children:e.jsxs("div",{className:"w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",onClick:n=>n.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-6 py-4",children:[e.jsxs("h2",{className:"text-sm text-[var(--text-primary)]",children:["// ",a("tasks.new_task")]}),e.jsx("button",{onClick:s,className:"text-[var(--text-muted)] transition-colors hover:text-[var(--text-primary)]",children:e.jsx(ye,{className:"h-4 w-4"})})]}),e.jsxs("form",{onSubmit:P,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(S,{value:p,onChange:O,options:d.map(n=>({value:n.key,label:n.name})),placeholder:a(c?"common.loading":"tasks.select_project"),disabled:c})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.task_type")}),e.jsx(S,{value:y,onChange:B,options:_e})]}),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(S,{value:m,onChange:D,options:z})]}),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:v,onChange:n=>R(n.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:j,onChange:n=>E(n.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:N,onChange:n=>_(n.target.value),placeholder:a("tasks.branch_slug_placeholder"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.target_branch")}),e.jsx("input",{type:"text",value:h,onChange:n=>T(n.target.value),placeholder:a("tasks.target_branch_placeholder"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),b&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.assign_developer")}),e.jsx(S,{value:f,onChange:k,options:K.map(n=>({value:String(n.id),label:n.name})),placeholder:a("tasks.select_developer")})]}),I&&e.jsx("div",{className:"rounded-[4px] bg-[#2a1515] border border-[var(--destructive)]/30 px-3 py-2 text-xs text-[var(--destructive)]",children:I})]}),e.jsxs("div",{className:"mt-6 flex items-center justify-end gap-3",children:[e.jsx("button",{type:"button",onClick:s,className:"rounded-[4px] border border-[var(--border)] bg-transparent px-4 py-2 text-xs text-[var(--text-secondary)] transition-colors hover:text-[var(--text-primary)]",children:a("common.cancel")}),e.jsx("button",{type:"submit",disabled:i||!p||!v.trim(),className:"rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs text-black transition-opacity hover:opacity-90 disabled:opacity-40",children:a(i?"common.creating":"tasks.create_task")})]})]})]})}):null}function Le({isOpen:o,onClose:s,onForceCreate:d,onViewExisting:c,similarTask:x,isLoading:i}){const{t:a}=$();return re(o),!x||!o?null:e.jsx("div",{style:{position:"fixed",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},children:e.jsxs("div",{onClick:b=>b.stopPropagation(),style:{width:"100%",maxWidth:"480px",backgroundColor:"var(--bg-card)",border:"1px solid var(--border)",borderRadius:"4px",padding:"1.5rem",fontFamily:"'JetBrains Mono', monospace"},children:[e.jsxs("div",{style:{marginBottom:"1.25rem"},children:[e.jsxs("div",{style:{color:"var(--accent)",fontSize:"0.875rem",fontWeight:600,display:"flex",alignItems:"center",gap:"0.5rem"},children:[e.jsx(Ee,{style:{width:"1rem",height:"1rem"}}),a("tasks.dedup_title")]}),e.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.7rem",marginTop:"0.25rem"},children:a("tasks.dedup_description")})]}),e.jsxs("div",{style:{marginBottom:"1.25rem",padding:"0.75rem",border:"1px solid var(--border)",borderRadius:"4px",backgroundColor:"var(--bg-primary)"},children:[e.jsxs("div",{style:{color:"var(--text-muted)",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace"},children:["#",x.id," · ",x.status]}),e.jsx("div",{style:{color:"var(--text-primary)",fontSize:"0.75rem",marginTop:"0.375rem",lineHeight:"1.5"},children:x.description})]}),e.jsxs("div",{style:{display:"flex",gap:"0.75rem"},children:[e.jsx("button",{type:"button",onClick:s,disabled:i,className:"text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:border-[var(--text-muted)]",style:{flex:1,padding:"0.5rem",backgroundColor:"transparent",border:"1px solid var(--border)",borderRadius:"4px",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:i?"not-allowed":"pointer",opacity:i?.7:1,transition:"color 0.15s, border-color 0.15s"},children:a("common.cancel")}),e.jsx("button",{type:"button",onClick:()=>c(x.id),style:{flex:1,padding:"0.5rem",backgroundColor:"transparent",color:"var(--text-muted)",border:"1px solid var(--border)",borderRadius:"4px",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:"pointer"},children:a("tasks.view_existing")}),e.jsx("button",{type:"button",onClick:d,disabled:i,style:{flex:1,padding:"0.5rem",backgroundColor:"var(--warning)",color:"#0C0C0C",border:"none",borderRadius:"4px",fontSize:"0.75rem",fontWeight:600,fontFamily:"'JetBrains Mono', monospace",cursor:i?"not-allowed":"pointer",opacity:i?.7:1},children:a(i?"common.creating":"tasks.dedup_create_anyway")})]})]})})}function Me({task:o}){const s=W(),d=o.status===u.COMPLETED||o.status===u.FAILED||o.status===u.CANCELLED;return e.jsxs("div",{onClick:()=>s(`/tasks/${o.id}`),className:"cursor-pointer rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 transition-colors active:bg-[var(--bg-input)]",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("span",{className:"text-[11px] text-[var(--text-primary)] leading-tight line-clamp-2 preserve-case",title:we(o),children:["#",o.id," ",se(o)]}),e.jsxs("span",{className:"flex items-center gap-1.5 shrink-0",children:[d&&e.jsx("button",{onClick:c=>{c.stopPropagation(),s(`/tasks/${o.id}?action=fork`)},className:"rounded-[4px] p-1 text-[var(--text-muted)] hover:text-[var(--accent)] transition-colors",children:e.jsx(ne,{className:"h-3 w-3"})}),e.jsx(ae,{status:o.status})]})]}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-2 text-[11px] text-[var(--text-muted)]",children:[e.jsx("span",{children:oe(o.createdAt)}),e.jsx("span",{children:"·"}),e.jsx("span",{children:o.projectKey}),o.workerName&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("span",{children:o.workerName})]})]})]})}const Oe=[{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"}],Re=20;function st(){const o=W(),{t:s}=$(),{tasks:d,loading:c,fetchTasks:x}=Z(),i=je(t=>t.taskSeq),[a,b]=r.useState("all"),[p,O]=r.useState(M.DEVELOP),[v,R]=r.useState(""),[y,B]=r.useState(""),[m,D]=r.useState(""),[N,_]=r.useState(void 0),[h,T]=r.useState([]),j=Z(t=>t.nextCursor),[E,f]=r.useState(!1);ke(r.useMemo(()=>e.jsxs("button",{onClick:()=>f(!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(Pe,{className:"h-3.5 w-3.5"}),s("tasks.new_task")]}),[s]));const[k,K]=r.useState([]),[H,I]=r.useState(!1),[C,L]=r.useState([]),[z,P]=r.useState(!1),[n,w]=r.useState(!1),[J,le]=r.useState(null),[U,q]=r.useState(null),G=r.useCallback(t=>{const l={limit:String(Re)};return p&&(l.taskMode=p),a!=="all"&&(l.status=a),v&&(l.projectKey=v),y&&(l.developerId=y),t&&(l.cursor=t),l},[a,p,v,y]);r.useEffect(()=>{x(G(N))},[G,N,x,i]),r.useEffect(()=>{_(void 0),T([])},[a,p,v,y]),r.useEffect(()=>{let t=!1;return(async()=>{try{const[g,be]=await Promise.all([A.get("web/projects").json(),A.get("web/projects/-/developers").json()]);if(t)return;K(g),L(be)}catch{}})(),()=>{t=!0}},[]),r.useEffect(()=>{if(!E||k.length>0)return;I(!0);let t=!1;return(async()=>{try{const g=await A.get("web/projects").json();t||K(g)}catch{}finally{t||I(!1)}})(),()=>{t=!0}},[E,k.length]);const ce=r.useCallback(async t=>{P(!0);try{const l=await A.post("web/tasks",{json:{projectKey:t.projectKey,description:t.description,workerId:t.workerId,developerId:t.developerId,taskType:t.taskType,branchSlug:t.branchSlug,agentType:t.agentType,targetBranch:t.targetBranch}}).json();f(!1),o(`/tasks/${l.task.id}`)}catch(l){if(l instanceof Ne&&l.response.status===409){try{const g=await l.response.json();if(g.confirmRequired){le({id:g.confirmRequired.taskId,description:g.confirmRequired.message,status:"active"}),q(t),f(!1),w(!0);return}}catch{}X.error(s("tasks.similar_task_exists"))}else{const g=l instanceof Error?l.message:String(l);X.error(g)}}finally{P(!1)}},[o]),ie=r.useCallback(async()=>{if(U){P(!0);try{const t=await A.post("web/tasks",{json:{...U,force:!0}}).json();w(!1),q(null),o(`/tasks/${t.task.id}`)}finally{P(!1)}}},[U,o]),F=r.useMemo(()=>{if(!m.trim())return d;const t=m.toLowerCase();return d.filter(l=>(l.name??"").toLowerCase().includes(t)||l.description.toLowerCase().includes(t)||String(l.id).includes(m))},[d,m]),de=r.useCallback(()=>{j&&(T(t=>[...t,N??""]),_(j))},[j,N]),xe=r.useCallback(()=>{h.length!==0&&(_(h.at(-1)||void 0),T(t=>t.slice(0,-1)))},[h]),pe=h.length+1,me=r.useMemo(()=>[{value:"",label:s("tasks.filter_project")},...k.map(t=>({value:t.key,label:t.name}))],[k,s]),ue=r.useMemo(()=>[{value:"",label:s("tasks.filter_developer")},...C.map(t=>({value:String(t.id),label:t.name}))],[C,s]),ve=r.useMemo(()=>[{value:"",label:s("tasks.filter_mode")},{value:M.DEVELOP,label:s("tasks.mode_develop")},{value:M.PLAN,label:s("tasks.mode_plan")},{value:M.REVIEW,label:s("tasks.mode_review")},{value:M.AUTOMATION,label:s("tasks.mode_automation")}],[s]),Q=s(m?"tasks.try_adjusting_search":"tasks.create_first_task"),V=m?void 0:e.jsx("button",{onClick:()=>f(!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:Oe.map(t=>e.jsx("button",{onClick:()=>b(t.key),className:`shrink-0 rounded-[4px] px-3 py-2 h-10 md:h-8 text-xs transition-colors ${a===t.key?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)] bg-[var(--bg-card)] hover:text-[var(--text-secondary)]"}`,children:s(t.labelKey)},t.key))}),e.jsxs("div",{className:"flex flex-col gap-2 md:ml-auto md:flex-row md:items-center",children:[e.jsxs("div",{className:"relative md:w-52",children:[e.jsx(Ce,{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=>D(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:()=>D(""),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(S,{value:p,onChange:O,options:ve,className:"md:w-36"}),e.jsx(S,{value:v,onChange:R,options:me,className:"md:w-40"}),e.jsx(S,{value:y,onChange:B,options:ue,className:"md:w-40"})]})]}),e.jsx("div",{className:"hidden md:block rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:e.jsxs("table",{className:"w-full text-left",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] text-[11px] font-medium text-[#525252]",children:[e.jsx("th",{className:"w-16 px-4 py-2.5 text-right",children:s("tasks.id")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.description_col")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.status_col")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.project_col")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.assignee")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.worker")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.time")})]})}),e.jsxs("tbody",{children:[c&&F.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"p-4",children:e.jsx(te,{rows:5})})}),!c&&F.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"p-4",children:e.jsx(ee,{icon:Y,title:s("tasks.no_tasks_found"),description:Q,action:V})})}),F.map(t=>e.jsx(De,{task:t},t.id))]})]})}),e.jsxs("div",{className:"flex flex-col gap-2 md:hidden",children:[c&&F.length===0&&e.jsx("div",{className:"p-4",children:e.jsx(te,{rows:5})}),!c&&F.length===0&&e.jsx(ee,{icon:Y,title:s("tasks.no_tasks_found"),description:Q,action:V}),F.map(t=>e.jsx(Me,{task:t},t.id))]}),(h.length>0||j)&&e.jsxs("div",{className:"mt-6 flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["// page ",pe]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:xe,disabled:h.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(Fe,{className:"h-3.5 w-3.5"}),s("tasks.prev")]}),e.jsxs("button",{onClick:de,disabled:!j,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(Ae,{className:"h-3.5 w-3.5"})]})]})]}),e.jsx(Ie,{isOpen:E,onClose:()=>f(!1),projects:k,projectsLoading:H,onSubmit:ce,isSubmitting:z}),e.jsx(Le,{isOpen:n,onClose:()=>{w(!1),q(null)},onForceCreate:ie,onViewExisting:t=>{w(!1),q(null),o(`/tasks/${t}`)},similarTask:J,isLoading:z})]})}export{st as default};
|
|
1
|
+
import{R as he,f as W,a as $,o as u,j as e,l as se,u as fe,i as ge,v as re,r,h as A,X as ye,k as je,w as M,x as ke,H as Ne,t as X,y as Ce,z as Y,m as we}from"./index-SIpO8066.js";import{u as Z}from"./task.store-BO0eSFD5.js";import{T as ae}from"./TaskStatusBadge-CwRoPvBr.js";import{f as oe}from"./date-CmcdoD87.js";import{T as Se}from"./Tooltip-D4Qk5Haa.js";import{G as ne}from"./git-fork-CVba32im.js";import{S}from"./Select-Oo9Mtr7U.js";import{a as _e}from"./task-constants-Dl6aS_wt.js";import{g as Te}from"./agent-type-options-bd4EFySP.js";import{C as Ee}from"./copy-BYaFbye3.js";import{E as ee}from"./EmptyState-DrJ71y5v.js";import{T as te}from"./Skeleton-ZmBjZxS-.js";import{P as Pe}from"./plus-C7qIBqP3.js";import{C as Fe}from"./chevron-left-BBUPVpzI.js";import{C as Ae}from"./chevron-right-Cuq0FVt8.js";import"./status-colors-DgUib6yo.js";import"./chevron-down-Ckd1H7Qb.js";const De=he.memo(function({task:s}){const d=W(),{t:c}=$(),x=(a,b)=>c(`common.${a}`,{n:b}),i=s.status===u.COMPLETED||s.status===u.FAILED||s.status===u.CANCELLED;return e.jsxs("tr",{onClick:()=>d(`/tasks/${s.id}`),className:"cursor-pointer border-b border-[var(--border-row)] transition-colors hover:bg-[var(--bg-input)]",children:[e.jsxs("td",{className:"w-16 py-3 pr-4 font-mono text-xs font-medium text-[var(--text-secondary)] text-right tabular-nums",children:["#",s.id]}),e.jsx("td",{className:"py-3 pr-4 text-sm text-[var(--text-primary)] preserve-case",children:e.jsx(Se,{content:s.description,children:se(s)})}),e.jsx("td",{className:"py-3 pr-4",children:e.jsx(ae,{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:[oe(s.createdAt,x),i&&e.jsx("button",{onClick:a=>{a.stopPropagation(),d(`/tasks/${s.id}?action=fork`)},className:"shrink-0 rounded-[4px] p-1 text-[var(--text-muted)] hover:text-[var(--accent)] hover:bg-[var(--bg-input)] transition-colors",title:c("tasks.fork_task"),children:e.jsx(ne,{className:"h-3 w-3"})})]})})]})});function Ie({isOpen:o,onClose:s,projects:d,projectsLoading:c,onSubmit:x,isSubmitting:i}){const{t:a}=$();fe(n=>n.user);const b=ge();re(o);const[p,O]=r.useState(""),[v,R]=r.useState(""),[y,B]=r.useState("feat"),[m,D]=r.useState(""),[N,_]=r.useState(""),[h,T]=r.useState(""),[j,E]=r.useState(""),[f,k]=r.useState(""),[K,H]=r.useState([]),[I,C]=r.useState(""),L=d.find(n=>n.key===p),z=Te(n=>n,L==null?void 0:L.agentType);r.useEffect(()=>{if(!o||(O(""),R(""),B("feat"),D(""),_(""),T(""),E(""),k(""),C(""),!b))return;const n=new AbortController;return A.get("admin/developers",{signal:n.signal}).json().then(H).catch(()=>{}),()=>n.abort()},[o,b]);async function P(n){if(n.preventDefault(),C(""),!p||!v.trim()){C(a("tasks.project_and_description_required"));return}try{await x({projectKey:p,description:v.trim(),workerId:j||void 0,developerId:f?Number(f):void 0,taskType:y,branchSlug:N.trim()||void 0,agentType:m||void 0,targetBranch:h.trim()||void 0})}catch(w){const J=w instanceof Error?w.message:a("tasks.failed_to_create_task");C(J)}}return o?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 font-mono",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},children:e.jsxs("div",{className:"w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",onClick:n=>n.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-6 py-4",children:[e.jsxs("h2",{className:"text-sm text-[var(--text-primary)]",children:["// ",a("tasks.new_task")]}),e.jsx("button",{onClick:s,className:"text-[var(--text-muted)] transition-colors hover:text-[var(--text-primary)]",children:e.jsx(ye,{className:"h-4 w-4"})})]}),e.jsxs("form",{onSubmit:P,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(S,{value:p,onChange:O,options:d.map(n=>({value:n.key,label:n.name})),placeholder:a(c?"common.loading":"tasks.select_project"),disabled:c})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.task_type")}),e.jsx(S,{value:y,onChange:B,options:_e})]}),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(S,{value:m,onChange:D,options:z})]}),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:v,onChange:n=>R(n.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:j,onChange:n=>E(n.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:N,onChange:n=>_(n.target.value),placeholder:a("tasks.branch_slug_placeholder"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.target_branch")}),e.jsx("input",{type:"text",value:h,onChange:n=>T(n.target.value),placeholder:a("tasks.target_branch_placeholder"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),b&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.assign_developer")}),e.jsx(S,{value:f,onChange:k,options:K.map(n=>({value:String(n.id),label:n.name})),placeholder:a("tasks.select_developer")})]}),I&&e.jsx("div",{className:"rounded-[4px] bg-[#2a1515] border border-[var(--destructive)]/30 px-3 py-2 text-xs text-[var(--destructive)]",children:I})]}),e.jsxs("div",{className:"mt-6 flex items-center justify-end gap-3",children:[e.jsx("button",{type:"button",onClick:s,className:"rounded-[4px] border border-[var(--border)] bg-transparent px-4 py-2 text-xs text-[var(--text-secondary)] transition-colors hover:text-[var(--text-primary)]",children:a("common.cancel")}),e.jsx("button",{type:"submit",disabled:i||!p||!v.trim(),className:"rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs text-black transition-opacity hover:opacity-90 disabled:opacity-40",children:a(i?"common.creating":"tasks.create_task")})]})]})]})}):null}function Le({isOpen:o,onClose:s,onForceCreate:d,onViewExisting:c,similarTask:x,isLoading:i}){const{t:a}=$();return re(o),!x||!o?null:e.jsx("div",{style:{position:"fixed",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},children:e.jsxs("div",{onClick:b=>b.stopPropagation(),style:{width:"100%",maxWidth:"480px",backgroundColor:"var(--bg-card)",border:"1px solid var(--border)",borderRadius:"4px",padding:"1.5rem",fontFamily:"'JetBrains Mono', monospace"},children:[e.jsxs("div",{style:{marginBottom:"1.25rem"},children:[e.jsxs("div",{style:{color:"var(--accent)",fontSize:"0.875rem",fontWeight:600,display:"flex",alignItems:"center",gap:"0.5rem"},children:[e.jsx(Ee,{style:{width:"1rem",height:"1rem"}}),a("tasks.dedup_title")]}),e.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.7rem",marginTop:"0.25rem"},children:a("tasks.dedup_description")})]}),e.jsxs("div",{style:{marginBottom:"1.25rem",padding:"0.75rem",border:"1px solid var(--border)",borderRadius:"4px",backgroundColor:"var(--bg-primary)"},children:[e.jsxs("div",{style:{color:"var(--text-muted)",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace"},children:["#",x.id," · ",x.status]}),e.jsx("div",{style:{color:"var(--text-primary)",fontSize:"0.75rem",marginTop:"0.375rem",lineHeight:"1.5"},children:x.description})]}),e.jsxs("div",{style:{display:"flex",gap:"0.75rem"},children:[e.jsx("button",{type:"button",onClick:s,disabled:i,className:"text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:border-[var(--text-muted)]",style:{flex:1,padding:"0.5rem",backgroundColor:"transparent",border:"1px solid var(--border)",borderRadius:"4px",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:i?"not-allowed":"pointer",opacity:i?.7:1,transition:"color 0.15s, border-color 0.15s"},children:a("common.cancel")}),e.jsx("button",{type:"button",onClick:()=>c(x.id),style:{flex:1,padding:"0.5rem",backgroundColor:"transparent",color:"var(--text-muted)",border:"1px solid var(--border)",borderRadius:"4px",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:"pointer"},children:a("tasks.view_existing")}),e.jsx("button",{type:"button",onClick:d,disabled:i,style:{flex:1,padding:"0.5rem",backgroundColor:"var(--warning)",color:"#0C0C0C",border:"none",borderRadius:"4px",fontSize:"0.75rem",fontWeight:600,fontFamily:"'JetBrains Mono', monospace",cursor:i?"not-allowed":"pointer",opacity:i?.7:1},children:a(i?"common.creating":"tasks.dedup_create_anyway")})]})]})})}function Me({task:o}){const s=W(),d=o.status===u.COMPLETED||o.status===u.FAILED||o.status===u.CANCELLED;return e.jsxs("div",{onClick:()=>s(`/tasks/${o.id}`),className:"cursor-pointer rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 transition-colors active:bg-[var(--bg-input)]",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("span",{className:"text-[11px] text-[var(--text-primary)] leading-tight line-clamp-2 preserve-case",title:we(o),children:["#",o.id," ",se(o)]}),e.jsxs("span",{className:"flex items-center gap-1.5 shrink-0",children:[d&&e.jsx("button",{onClick:c=>{c.stopPropagation(),s(`/tasks/${o.id}?action=fork`)},className:"rounded-[4px] p-1 text-[var(--text-muted)] hover:text-[var(--accent)] transition-colors",children:e.jsx(ne,{className:"h-3 w-3"})}),e.jsx(ae,{status:o.status})]})]}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-2 text-[11px] text-[var(--text-muted)]",children:[e.jsx("span",{children:oe(o.createdAt)}),e.jsx("span",{children:"·"}),e.jsx("span",{children:o.projectKey}),o.workerName&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("span",{children:o.workerName})]})]})]})}const Oe=[{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"}],Re=20;function st(){const o=W(),{t:s}=$(),{tasks:d,loading:c,fetchTasks:x}=Z(),i=je(t=>t.taskSeq),[a,b]=r.useState("all"),[p,O]=r.useState(M.DEVELOP),[v,R]=r.useState(""),[y,B]=r.useState(""),[m,D]=r.useState(""),[N,_]=r.useState(void 0),[h,T]=r.useState([]),j=Z(t=>t.nextCursor),[E,f]=r.useState(!1);ke(r.useMemo(()=>e.jsxs("button",{onClick:()=>f(!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(Pe,{className:"h-3.5 w-3.5"}),s("tasks.new_task")]}),[s]));const[k,K]=r.useState([]),[H,I]=r.useState(!1),[C,L]=r.useState([]),[z,P]=r.useState(!1),[n,w]=r.useState(!1),[J,le]=r.useState(null),[U,q]=r.useState(null),G=r.useCallback(t=>{const l={limit:String(Re)};return p&&(l.taskMode=p),a!=="all"&&(l.status=a),v&&(l.projectKey=v),y&&(l.developerId=y),t&&(l.cursor=t),l},[a,p,v,y]);r.useEffect(()=>{x(G(N))},[G,N,x,i]),r.useEffect(()=>{_(void 0),T([])},[a,p,v,y]),r.useEffect(()=>{let t=!1;return(async()=>{try{const[g,be]=await Promise.all([A.get("web/projects").json(),A.get("web/projects/-/developers").json()]);if(t)return;K(g),L(be)}catch{}})(),()=>{t=!0}},[]),r.useEffect(()=>{if(!E||k.length>0)return;I(!0);let t=!1;return(async()=>{try{const g=await A.get("web/projects").json();t||K(g)}catch{}finally{t||I(!1)}})(),()=>{t=!0}},[E,k.length]);const ce=r.useCallback(async t=>{P(!0);try{const l=await A.post("web/tasks",{json:{projectKey:t.projectKey,description:t.description,workerId:t.workerId,developerId:t.developerId,taskType:t.taskType,branchSlug:t.branchSlug,agentType:t.agentType,targetBranch:t.targetBranch}}).json();f(!1),o(`/tasks/${l.task.id}`)}catch(l){if(l instanceof Ne&&l.response.status===409){try{const g=await l.response.json();if(g.confirmRequired){le({id:g.confirmRequired.taskId,description:g.confirmRequired.message,status:"active"}),q(t),f(!1),w(!0);return}}catch{}X.error(s("tasks.similar_task_exists"))}else{const g=l instanceof Error?l.message:String(l);X.error(g)}}finally{P(!1)}},[o]),ie=r.useCallback(async()=>{if(U){P(!0);try{const t=await A.post("web/tasks",{json:{...U,force:!0}}).json();w(!1),q(null),o(`/tasks/${t.task.id}`)}finally{P(!1)}}},[U,o]),F=r.useMemo(()=>{if(!m.trim())return d;const t=m.toLowerCase();return d.filter(l=>(l.name??"").toLowerCase().includes(t)||l.description.toLowerCase().includes(t)||String(l.id).includes(m))},[d,m]),de=r.useCallback(()=>{j&&(T(t=>[...t,N??""]),_(j))},[j,N]),xe=r.useCallback(()=>{h.length!==0&&(_(h.at(-1)||void 0),T(t=>t.slice(0,-1)))},[h]),pe=h.length+1,me=r.useMemo(()=>[{value:"",label:s("tasks.filter_project")},...k.map(t=>({value:t.key,label:t.name}))],[k,s]),ue=r.useMemo(()=>[{value:"",label:s("tasks.filter_developer")},...C.map(t=>({value:String(t.id),label:t.name}))],[C,s]),ve=r.useMemo(()=>[{value:"",label:s("tasks.filter_mode")},{value:M.DEVELOP,label:s("tasks.mode_develop")},{value:M.PLAN,label:s("tasks.mode_plan")},{value:M.REVIEW,label:s("tasks.mode_review")},{value:M.AUTOMATION,label:s("tasks.mode_automation")}],[s]),Q=s(m?"tasks.try_adjusting_search":"tasks.create_first_task"),V=m?void 0:e.jsx("button",{onClick:()=>f(!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:Oe.map(t=>e.jsx("button",{onClick:()=>b(t.key),className:`shrink-0 rounded-[4px] px-3 py-2 h-10 md:h-8 text-xs transition-colors ${a===t.key?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)] bg-[var(--bg-card)] hover:text-[var(--text-secondary)]"}`,children:s(t.labelKey)},t.key))}),e.jsxs("div",{className:"flex flex-col gap-2 md:ml-auto md:flex-row md:items-center",children:[e.jsxs("div",{className:"relative md:w-52",children:[e.jsx(Ce,{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=>D(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:()=>D(""),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(S,{value:p,onChange:O,options:ve,className:"md:w-36"}),e.jsx(S,{value:v,onChange:R,options:me,className:"md:w-40"}),e.jsx(S,{value:y,onChange:B,options:ue,className:"md:w-40"})]})]}),e.jsx("div",{className:"hidden md:block rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:e.jsxs("table",{className:"w-full text-left",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] text-[11px] font-medium text-[#525252]",children:[e.jsx("th",{className:"w-16 px-4 py-2.5 text-right",children:s("tasks.id")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.description_col")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.status_col")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.project_col")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.assignee")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.worker")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.time")})]})}),e.jsxs("tbody",{children:[c&&F.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"p-4",children:e.jsx(te,{rows:5})})}),!c&&F.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"p-4",children:e.jsx(ee,{icon:Y,title:s("tasks.no_tasks_found"),description:Q,action:V})})}),F.map(t=>e.jsx(De,{task:t},t.id))]})]})}),e.jsxs("div",{className:"flex flex-col gap-2 md:hidden",children:[c&&F.length===0&&e.jsx("div",{className:"p-4",children:e.jsx(te,{rows:5})}),!c&&F.length===0&&e.jsx(ee,{icon:Y,title:s("tasks.no_tasks_found"),description:Q,action:V}),F.map(t=>e.jsx(Me,{task:t},t.id))]}),(h.length>0||j)&&e.jsxs("div",{className:"mt-6 flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["// page ",pe]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:xe,disabled:h.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(Fe,{className:"h-3.5 w-3.5"}),s("tasks.prev")]}),e.jsxs("button",{onClick:de,disabled:!j,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(Ae,{className:"h-3.5 w-3.5"})]})]})]}),e.jsx(Ie,{isOpen:E,onClose:()=>f(!1),projects:k,projectsLoading:H,onSubmit:ce,isSubmitting:z}),e.jsx(Le,{isOpen:n,onClose:()=>{w(!1),q(null)},onForceCreate:ie,onViewExisting:t=>{w(!1),q(null),o(`/tasks/${t}`)},similarTask:J,isLoading:z})]})}export{st as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as l,j as a}from"./index-
|
|
1
|
+
import{a as l,j as a}from"./index-SIpO8066.js";import{a as u}from"./status-colors-DgUib6yo.js";const r={QUEUED:"tasks.status_queued",ASSIGNED:"tasks.status_assigned",RUNNING:"tasks.status_running",SUSPENDED:"tasks.status_suspended",COMPLETED:"tasks.status_completed",FAILED:"tasks.status_failed",CANCELLED:"tasks.status_cancelled"};function E({status:s}){const{t:e}=l(),t=r[s],n=t?e(t):(s??"unknown").toLowerCase(),o=u(s);return a.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-xs",style:{color:o},children:[a.jsx("span",{style:{fontSize:"0.6rem"},children:"●"}),n]})}export{E as T};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as ce,n as le,h as O,o as S,a as A,r,k as z,p as de,q as xe,j as e,X as Z,s as me,f as pe,l as ue,m as he}from"./index-
|
|
1
|
+
import{c as ce,n as le,h as O,o as S,a as A,r,k as z,p as de,q as xe,j as e,X as Z,s as me,f as pe,l as ue,m as he}from"./index-SIpO8066.js";import{g as ee,H as ve}from"./task-agent-CiiRe-U2.js";import{u as fe}from"./task.store-BO0eSFD5.js";import{P as ge}from"./PtyTerminal-Sg6Vp7_M.js";import{i as G,O as te}from"./OnboardingGuide-DfO_nz8H.js";import{C as be}from"./ConfirmStageDialog-Hr5m6-gd.js";import{S as E}from"./Select-Oo9Mtr7U.js";import{a as se}from"./status-colors-DgUib6yo.js";import{a as je}from"./date-CmcdoD87.js";import{T as q,a as J,g as ke}from"./task-constants-Dl6aS_wt.js";import{g as ye}from"./agent-type-options-bd4EFySP.js";import{u as ae}from"./useFetch-DPYKm7wX.js";import{P as $}from"./plus-C7qIBqP3.js";import{C as Ne}from"./chevron-down-Ckd1H7Qb.js";import{C as we}from"./chevron-up-C2DlCBBk.js";import{R as Te}from"./rotate-ccw-Dnr0SLIh.js";import{C as Se}from"./clock-CrvlXUq5.js";import{W as _e}from"./wifi-Bmp-6qp_.js";import"./chevron-right-Cuq0FVt8.js";/**
|
|
2
2
|
* @license lucide-react v0.469.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as C,v as D,r as n,j as e,h as _,f as P,J as V,a8 as w,a6 as J,ad as S,s as O}from"./index-B19uS9bj.js";import{K as L}from"./key-BZuQs2Pl.js";import{C as T}from"./copy-C051Wr-d.js";import{E as W}from"./external-link-B8hPJyFL.js";import{E as B}from"./EmptyState-BqdymWlY.js";import{T as z}from"./Skeleton-CGmOAlS2.js";import{u as X}from"./useFetch-Bvarcx0Z.js";import{e as E}from"./status-colors-CbSft6mt.js";import{P as q}from"./plus-gbieRhvw.js";function G({isOpen:r,onClose:f,onCreated:u}){const{t:s}=C();D(r);const[a,o]=n.useState(""),[i,d]=n.useState(!1),[l,h]=n.useState("");function y(){o(""),h(""),f()}async function x(){if(h(""),!a.trim()){h(s("admin.pat_label_required"));return}try{d(!0);const c=await _.post("admin/worker-tokens",{json:{label:a.trim()}}).json();o(""),u({token:c.token,id:c.id})}catch(c){const m=c instanceof Error?c.message:s("admin.pat_failed_to_generate");h(m)}finally{d(!1)}}return r?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},children:e.jsxs("div",{className:"w-full border border-[var(--border)] bg-[var(--bg-card)]",style:{maxWidth:"480px",borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:[e.jsxs("div",{className:"flex items-center gap-2 border-b border-[var(--border)] px-5 py-4",children:[e.jsx(L,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:s("admin.generate_worker_token_title")})]}),e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[l&&e.jsx("div",{className:"border border-[var(--destructive)]/30 bg-[var(--destructive)]/10 px-3 py-2 text-xs text-[var(--destructive)]",style:{borderRadius:"4px"},children:l}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:s("admin.create_one_time_token")}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:s("admin.label")}),e.jsx("input",{type:"text",placeholder:s("admin.pat_label_placeholder"),value:a,onChange:c=>o(c.target.value),className:"w-full border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2 text-sm text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:border-[var(--accent)] focus:outline-none",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},onKeyDown:c=>{c.key==="Enter"&&x()}}),e.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:s("admin.label_identifies_worker")})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-[var(--border)] px-5 py-3",children:[e.jsx("button",{onClick:y,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:s("common.cancel")}),e.jsx("button",{onClick:x,disabled:i,className:"bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-black transition-opacity hover:opacity-80 disabled:opacity-50",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:s(i?"admin.generating":"admin.generate")})]})]})}):null}const U=3e3,H=600*1e3;function Q({isOpen:r,token:f,tokenId:u,onClose:s}){const{t:a}=C();D(r);const[o,i]=n.useState("command"),[d,l]=n.useState(!1),[h,y]=n.useState(!1),[x,c]=n.useState(""),[m,g]=n.useState(null),p=n.useRef(void 0),N=n.useRef(Date.now()),k=n.useRef(null),j=P();n.useEffect(()=>{var v;r&&((v=k.current)==null||v.focus())},[r]);const t=n.useCallback(v=>{v.key==="Escape"&&s()},[s]),A=typeof window<"u"?window.location.origin:"https://overlord.example.com",R=`overlord setup worker --token ${f} --server ${A}`;async function F(){try{await navigator.clipboard.writeText(f),l(!0),setTimeout(()=>l(!1),2e3)}catch{}}async function I(){try{await navigator.clipboard.writeText(R),y(!0),setTimeout(()=>y(!1),2e3)}catch{}}const M=n.useCallback(async()=>{try{const v=await _.get(`admin/worker-tokens/${u}/status`).json();v.status==="used"&&v.worker_name&&(i("success"),c(v.worker_name),g(v.worker_id??null),p.current&&clearInterval(p.current))}catch{}Date.now()-N.current>H&&(i("timeout"),p.current&&clearInterval(p.current))},[u]);function K(){i("waiting"),N.current=Date.now(),p.current=setInterval(M,U)}n.useEffect(()=>()=>{p.current&&clearInterval(p.current)},[]);function $(){s(),m&&j(`/workers/${m}`)}if(!r)return null;const b={fontFamily:"'JetBrains Mono', monospace",borderRadius:"4px"};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},children:e.jsxs("div",{ref:k,className:"w-full border border-[var(--border)] bg-[var(--bg-card)]",style:{...b,maxWidth:"480px"},onKeyDown:t,tabIndex:-1,children:[e.jsx("div",{className:"flex items-center gap-2 border-b border-[var(--border)] px-5 py-4",children:o==="success"?e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:a("admin.worker_registered")})]}):e.jsxs(e.Fragment,{children:[e.jsx(L,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:a("admin.worker_token_generated")})]})}),e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[o!=="success"&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:a("admin.run_command_desc")}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[11px] text-[var(--text-muted)]",children:"Token"}),e.jsxs("div",{className:"relative border border-[var(--border)] bg-[var(--bg-card)] p-3",style:{borderRadius:"4px"},children:[e.jsx("code",{className:"block break-all pr-20 text-xs text-[var(--text-primary)]",children:f}),e.jsx("button",{onClick:F,className:"absolute right-2 top-2 flex items-center gap-1 border border-[var(--border)] bg-transparent px-2 py-1 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:d?e.jsx("span",{className:"text-[var(--accent)]",children:a("common.copied")}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(T,{className:"h-3 w-3"})," ",a("common.copy")]})})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[11px] text-[var(--text-muted)]",children:a("admin.setup_command")}),e.jsxs("div",{className:"relative border border-[var(--border)] bg-[var(--bg-card)] p-3",style:{borderRadius:"4px"},children:[e.jsxs("code",{className:"block break-all pr-20 text-xs text-[var(--accent)]",children:["$ ",R]}),e.jsx("button",{onClick:I,className:"absolute right-2 top-2 flex items-center gap-1 border border-[var(--border)] bg-transparent px-2 py-1 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:h?e.jsx("span",{className:"text-[var(--accent)]",children:a("common.copied")}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(T,{className:"h-3 w-3"})," ",a("common.copy")]})})]})]}),e.jsx("div",{className:"border border-yellow-500/30 bg-yellow-500/10 px-3 py-2 text-xs text-yellow-400",style:{borderRadius:"4px"},children:a("admin.token_shown_once")})]}),o==="waiting"&&e.jsxs("div",{className:"flex items-center gap-3 border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3",style:{borderRadius:"4px"},children:[e.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-[var(--accent)] border-t-transparent"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:a("admin.waiting_for_worker")})]}),o==="timeout"&&e.jsx("div",{className:"border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3 text-xs text-[var(--text-muted)]",style:{borderRadius:"4px"},children:a("admin.token_not_yet_used")}),o==="success"&&e.jsxs("div",{className:"border border-[var(--accent)]/30 bg-[var(--accent)]/10 px-4 py-3",style:{borderRadius:"4px"},children:[e.jsx("p",{className:"text-xs text-[var(--accent)]",children:a("admin.worker_registered_success")}),e.jsxs("p",{className:"mt-1 text-xs text-[var(--text-primary)]",children:[a("admin.worker"),": ",e.jsx("span",{className:"text-[var(--accent)]",children:x})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-[var(--border)] px-5 py-3",children:[o==="command"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:a("common.close")}),e.jsx("button",{onClick:K,className:"bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-black transition-opacity hover:opacity-80",style:b,children:a("admin.copied_wait_for_worker")})]}),o==="waiting"&&e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:a("admin.close_worker_can_register")}),o==="timeout"&&e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:a("common.close")}),o==="success"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:a("common.close")}),e.jsxs("button",{onClick:$,className:"flex items-center gap-1.5 bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-black transition-opacity hover:opacity-80",style:b,children:[e.jsx(W,{className:"h-3 w-3"}),a("admin.view_worker")]})]})]})]})})}function ce(){const{t:r}=C(),[f,u]=n.useState(!1),[s,a]=n.useState(null),[o,i]=n.useState(!1),[d,l]=n.useState(null),[h,y]=n.useState(!1),[x,c]=n.useState(!1),{data:m,loading:g,refetch:p}=X(()=>_.get("admin/worker-tokens").json(),[]);async function N(){if(d){y(!0);try{await _.post(`admin/worker-tokens/${d.id}/revoke`),i(!1),l(null),p()}catch{}finally{y(!1)}}}function k(t){u(!1),a(t),p()}const j=n.useMemo(()=>(m??[]).filter(t=>x||t.status!==w.REVOKED),[m,x]);return e.jsxs("div",{className:"font-mono",children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:r("admin.tokens_title")}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("admin.tokens_subtitle")})]}),e.jsxs("button",{type:"button",className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity",onClick:()=>u(!0),children:[e.jsx(q,{className:"h-3.5 w-3.5"}),r("admin.generate_token")]})]}),!g&&(m==null?void 0:m.some(t=>t.status===w.REVOKED))&&e.jsx("div",{className:"mb-4 flex items-center gap-2",children:e.jsx("button",{type:"button",onClick:()=>c(!x),className:`text-xs transition-colors ${x?"text-[var(--text-primary)]":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:r(x?"admin.hide_revoked":"admin.show_revoked")})}),g?e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsx(z,{rows:3})}):j.length===0?e.jsx(B,{icon:J,title:r("admin.no_worker_tokens"),description:r("admin.generate_token_desc"),actionLabel:r("admin.generate_token"),onAction:()=>u(!0)}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden md:block overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] text-left text-[var(--text-muted)]",children:[e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.label")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.purpose")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.status")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("common.created_at")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.expires_at")}),e.jsx("th",{className:"pb-2 font-normal",children:r("common.actions")})]})}),e.jsx("tbody",{children:j.map(t=>e.jsxs("tr",{className:"border-b border-[var(--border-row)] hover:bg-white/[0.02] transition-colors",children:[e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-primary)]",children:t.label}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:t.purpose}),e.jsx("td",{className:"py-2.5 pr-4",children:e.jsx("span",{className:E(t.status),children:t.status})}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-muted)]",children:new Date(t.createdAt).toLocaleDateString()}),e.jsx("td",{className:"py-2.5 pr-4",children:t.expiresAt?e.jsx("span",{className:"text-[var(--text-secondary)]",children:new Date(t.expiresAt).toLocaleDateString()}):e.jsx("span",{className:"text-[var(--text-muted)]",children:"—"})}),e.jsx("td",{className:"py-2.5",children:t.status===w.ACTIVE&&e.jsxs("button",{type:"button",className:"flex items-center gap-1 rounded-[4px] px-2 py-1 text-red-400 hover:text-red-300 hover:bg-white/[0.05] transition-colors",onClick:()=>{l(t),i(!0)},children:[e.jsx(S,{className:"h-3.5 w-3.5"}),r("admin.revoke")]})})]},t.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3",children:j.map(t=>e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-xs text-[var(--text-primary)] font-medium truncate mr-2",children:t.label}),e.jsx("span",{className:`text-[11px] shrink-0 ${E(t.status)}`,children:t.status})]}),e.jsx("div",{className:"text-[11px] text-[var(--text-secondary)] truncate mb-1",children:t.purpose}),e.jsxs("div",{className:"flex items-center justify-between text-[11px] text-[var(--text-muted)]",children:[e.jsx("span",{children:new Date(t.createdAt).toLocaleDateString()}),t.expiresAt&&e.jsx("span",{children:new Date(t.expiresAt).toLocaleDateString()})]}),t.status===w.ACTIVE&&e.jsx("div",{className:"mt-2 pt-2 border-t border-[var(--border)]",children:e.jsxs("button",{type:"button",className:"flex items-center gap-1 rounded-[4px] px-2 py-1 text-[11px] text-red-400 hover:text-red-300 hover:bg-white/[0.05] transition-colors",onClick:()=>{l(t),i(!0)},children:[e.jsx(S,{className:"h-3.5 w-3.5"}),r("admin.revoke")]})})]},t.id))})]}),e.jsx(G,{isOpen:f,onClose:()=>u(!1),onCreated:k}),s&&e.jsx(Q,{isOpen:!!s,token:s.token,tokenId:s.id,onClose:()=>a(null)}),e.jsx(O,{isOpen:o,onClose:()=>{i(!1),l(null)},onConfirm:N,title:r("admin.revoke_token"),message:r("admin.revoke_token_confirm",{label:(d==null?void 0:d.label)??""}),confirmLabel:r("admin.revoke"),confirmVariant:"danger",isLoading:h})]})}export{ce as default};
|
|
1
|
+
import{a as C,v as D,r as n,j as e,h as _,f as P,J as V,a8 as w,a6 as J,ad as S,s as O}from"./index-SIpO8066.js";import{K as L}from"./key-DBbJpxpA.js";import{C as T}from"./copy-BYaFbye3.js";import{E as W}from"./external-link-AIAS-X11.js";import{E as B}from"./EmptyState-DrJ71y5v.js";import{T as z}from"./Skeleton-ZmBjZxS-.js";import{u as X}from"./useFetch-DPYKm7wX.js";import{e as E}from"./status-colors-DgUib6yo.js";import{P as q}from"./plus-C7qIBqP3.js";function G({isOpen:r,onClose:f,onCreated:u}){const{t:s}=C();D(r);const[a,o]=n.useState(""),[i,d]=n.useState(!1),[l,h]=n.useState("");function y(){o(""),h(""),f()}async function x(){if(h(""),!a.trim()){h(s("admin.pat_label_required"));return}try{d(!0);const c=await _.post("admin/worker-tokens",{json:{label:a.trim()}}).json();o(""),u({token:c.token,id:c.id})}catch(c){const m=c instanceof Error?c.message:s("admin.pat_failed_to_generate");h(m)}finally{d(!1)}}return r?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},children:e.jsxs("div",{className:"w-full border border-[var(--border)] bg-[var(--bg-card)]",style:{maxWidth:"480px",borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:[e.jsxs("div",{className:"flex items-center gap-2 border-b border-[var(--border)] px-5 py-4",children:[e.jsx(L,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:s("admin.generate_worker_token_title")})]}),e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[l&&e.jsx("div",{className:"border border-[var(--destructive)]/30 bg-[var(--destructive)]/10 px-3 py-2 text-xs text-[var(--destructive)]",style:{borderRadius:"4px"},children:l}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:s("admin.create_one_time_token")}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:s("admin.label")}),e.jsx("input",{type:"text",placeholder:s("admin.pat_label_placeholder"),value:a,onChange:c=>o(c.target.value),className:"w-full border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2 text-sm text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:border-[var(--accent)] focus:outline-none",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},onKeyDown:c=>{c.key==="Enter"&&x()}}),e.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:s("admin.label_identifies_worker")})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-[var(--border)] px-5 py-3",children:[e.jsx("button",{onClick:y,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:s("common.cancel")}),e.jsx("button",{onClick:x,disabled:i,className:"bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-black transition-opacity hover:opacity-80 disabled:opacity-50",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:s(i?"admin.generating":"admin.generate")})]})]})}):null}const U=3e3,H=600*1e3;function Q({isOpen:r,token:f,tokenId:u,onClose:s}){const{t:a}=C();D(r);const[o,i]=n.useState("command"),[d,l]=n.useState(!1),[h,y]=n.useState(!1),[x,c]=n.useState(""),[m,g]=n.useState(null),p=n.useRef(void 0),N=n.useRef(Date.now()),k=n.useRef(null),j=P();n.useEffect(()=>{var v;r&&((v=k.current)==null||v.focus())},[r]);const t=n.useCallback(v=>{v.key==="Escape"&&s()},[s]),A=typeof window<"u"?window.location.origin:"https://overlord.example.com",R=`overlord setup worker --token ${f} --server ${A}`;async function F(){try{await navigator.clipboard.writeText(f),l(!0),setTimeout(()=>l(!1),2e3)}catch{}}async function I(){try{await navigator.clipboard.writeText(R),y(!0),setTimeout(()=>y(!1),2e3)}catch{}}const M=n.useCallback(async()=>{try{const v=await _.get(`admin/worker-tokens/${u}/status`).json();v.status==="used"&&v.worker_name&&(i("success"),c(v.worker_name),g(v.worker_id??null),p.current&&clearInterval(p.current))}catch{}Date.now()-N.current>H&&(i("timeout"),p.current&&clearInterval(p.current))},[u]);function K(){i("waiting"),N.current=Date.now(),p.current=setInterval(M,U)}n.useEffect(()=>()=>{p.current&&clearInterval(p.current)},[]);function $(){s(),m&&j(`/workers/${m}`)}if(!r)return null;const b={fontFamily:"'JetBrains Mono', monospace",borderRadius:"4px"};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},children:e.jsxs("div",{ref:k,className:"w-full border border-[var(--border)] bg-[var(--bg-card)]",style:{...b,maxWidth:"480px"},onKeyDown:t,tabIndex:-1,children:[e.jsx("div",{className:"flex items-center gap-2 border-b border-[var(--border)] px-5 py-4",children:o==="success"?e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:a("admin.worker_registered")})]}):e.jsxs(e.Fragment,{children:[e.jsx(L,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:a("admin.worker_token_generated")})]})}),e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[o!=="success"&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:a("admin.run_command_desc")}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[11px] text-[var(--text-muted)]",children:"Token"}),e.jsxs("div",{className:"relative border border-[var(--border)] bg-[var(--bg-card)] p-3",style:{borderRadius:"4px"},children:[e.jsx("code",{className:"block break-all pr-20 text-xs text-[var(--text-primary)]",children:f}),e.jsx("button",{onClick:F,className:"absolute right-2 top-2 flex items-center gap-1 border border-[var(--border)] bg-transparent px-2 py-1 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:d?e.jsx("span",{className:"text-[var(--accent)]",children:a("common.copied")}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(T,{className:"h-3 w-3"})," ",a("common.copy")]})})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[11px] text-[var(--text-muted)]",children:a("admin.setup_command")}),e.jsxs("div",{className:"relative border border-[var(--border)] bg-[var(--bg-card)] p-3",style:{borderRadius:"4px"},children:[e.jsxs("code",{className:"block break-all pr-20 text-xs text-[var(--accent)]",children:["$ ",R]}),e.jsx("button",{onClick:I,className:"absolute right-2 top-2 flex items-center gap-1 border border-[var(--border)] bg-transparent px-2 py-1 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:h?e.jsx("span",{className:"text-[var(--accent)]",children:a("common.copied")}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(T,{className:"h-3 w-3"})," ",a("common.copy")]})})]})]}),e.jsx("div",{className:"border border-yellow-500/30 bg-yellow-500/10 px-3 py-2 text-xs text-yellow-400",style:{borderRadius:"4px"},children:a("admin.token_shown_once")})]}),o==="waiting"&&e.jsxs("div",{className:"flex items-center gap-3 border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3",style:{borderRadius:"4px"},children:[e.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-[var(--accent)] border-t-transparent"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:a("admin.waiting_for_worker")})]}),o==="timeout"&&e.jsx("div",{className:"border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3 text-xs text-[var(--text-muted)]",style:{borderRadius:"4px"},children:a("admin.token_not_yet_used")}),o==="success"&&e.jsxs("div",{className:"border border-[var(--accent)]/30 bg-[var(--accent)]/10 px-4 py-3",style:{borderRadius:"4px"},children:[e.jsx("p",{className:"text-xs text-[var(--accent)]",children:a("admin.worker_registered_success")}),e.jsxs("p",{className:"mt-1 text-xs text-[var(--text-primary)]",children:[a("admin.worker"),": ",e.jsx("span",{className:"text-[var(--accent)]",children:x})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-[var(--border)] px-5 py-3",children:[o==="command"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:a("common.close")}),e.jsx("button",{onClick:K,className:"bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-black transition-opacity hover:opacity-80",style:b,children:a("admin.copied_wait_for_worker")})]}),o==="waiting"&&e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:a("admin.close_worker_can_register")}),o==="timeout"&&e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:a("common.close")}),o==="success"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:a("common.close")}),e.jsxs("button",{onClick:$,className:"flex items-center gap-1.5 bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-black transition-opacity hover:opacity-80",style:b,children:[e.jsx(W,{className:"h-3 w-3"}),a("admin.view_worker")]})]})]})]})})}function ce(){const{t:r}=C(),[f,u]=n.useState(!1),[s,a]=n.useState(null),[o,i]=n.useState(!1),[d,l]=n.useState(null),[h,y]=n.useState(!1),[x,c]=n.useState(!1),{data:m,loading:g,refetch:p}=X(()=>_.get("admin/worker-tokens").json(),[]);async function N(){if(d){y(!0);try{await _.post(`admin/worker-tokens/${d.id}/revoke`),i(!1),l(null),p()}catch{}finally{y(!1)}}}function k(t){u(!1),a(t),p()}const j=n.useMemo(()=>(m??[]).filter(t=>x||t.status!==w.REVOKED),[m,x]);return e.jsxs("div",{className:"font-mono",children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:r("admin.tokens_title")}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("admin.tokens_subtitle")})]}),e.jsxs("button",{type:"button",className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity",onClick:()=>u(!0),children:[e.jsx(q,{className:"h-3.5 w-3.5"}),r("admin.generate_token")]})]}),!g&&(m==null?void 0:m.some(t=>t.status===w.REVOKED))&&e.jsx("div",{className:"mb-4 flex items-center gap-2",children:e.jsx("button",{type:"button",onClick:()=>c(!x),className:`text-xs transition-colors ${x?"text-[var(--text-primary)]":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:r(x?"admin.hide_revoked":"admin.show_revoked")})}),g?e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsx(z,{rows:3})}):j.length===0?e.jsx(B,{icon:J,title:r("admin.no_worker_tokens"),description:r("admin.generate_token_desc"),actionLabel:r("admin.generate_token"),onAction:()=>u(!0)}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden md:block overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] text-left text-[var(--text-muted)]",children:[e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.label")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.purpose")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.status")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("common.created_at")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.expires_at")}),e.jsx("th",{className:"pb-2 font-normal",children:r("common.actions")})]})}),e.jsx("tbody",{children:j.map(t=>e.jsxs("tr",{className:"border-b border-[var(--border-row)] hover:bg-white/[0.02] transition-colors",children:[e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-primary)]",children:t.label}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:t.purpose}),e.jsx("td",{className:"py-2.5 pr-4",children:e.jsx("span",{className:E(t.status),children:t.status})}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-muted)]",children:new Date(t.createdAt).toLocaleDateString()}),e.jsx("td",{className:"py-2.5 pr-4",children:t.expiresAt?e.jsx("span",{className:"text-[var(--text-secondary)]",children:new Date(t.expiresAt).toLocaleDateString()}):e.jsx("span",{className:"text-[var(--text-muted)]",children:"—"})}),e.jsx("td",{className:"py-2.5",children:t.status===w.ACTIVE&&e.jsxs("button",{type:"button",className:"flex items-center gap-1 rounded-[4px] px-2 py-1 text-red-400 hover:text-red-300 hover:bg-white/[0.05] transition-colors",onClick:()=>{l(t),i(!0)},children:[e.jsx(S,{className:"h-3.5 w-3.5"}),r("admin.revoke")]})})]},t.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3",children:j.map(t=>e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-xs text-[var(--text-primary)] font-medium truncate mr-2",children:t.label}),e.jsx("span",{className:`text-[11px] shrink-0 ${E(t.status)}`,children:t.status})]}),e.jsx("div",{className:"text-[11px] text-[var(--text-secondary)] truncate mb-1",children:t.purpose}),e.jsxs("div",{className:"flex items-center justify-between text-[11px] text-[var(--text-muted)]",children:[e.jsx("span",{children:new Date(t.createdAt).toLocaleDateString()}),t.expiresAt&&e.jsx("span",{children:new Date(t.expiresAt).toLocaleDateString()})]}),t.status===w.ACTIVE&&e.jsx("div",{className:"mt-2 pt-2 border-t border-[var(--border)]",children:e.jsxs("button",{type:"button",className:"flex items-center gap-1 rounded-[4px] px-2 py-1 text-[11px] text-red-400 hover:text-red-300 hover:bg-white/[0.05] transition-colors",onClick:()=>{l(t),i(!0)},children:[e.jsx(S,{className:"h-3.5 w-3.5"}),r("admin.revoke")]})})]},t.id))})]}),e.jsx(G,{isOpen:f,onClose:()=>u(!1),onCreated:k}),s&&e.jsx(Q,{isOpen:!!s,token:s.token,tokenId:s.id,onClose:()=>a(null)}),e.jsx(O,{isOpen:o,onClose:()=>{i(!1),l(null)},onConfirm:N,title:r("admin.revoke_token"),message:r("admin.revoke_token_confirm",{label:(d==null?void 0:d.label)??""}),confirmLabel:r("admin.revoke"),confirmVariant:"danger",isLoading:h})]})}export{ce as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as m,r as e,j as t}from"./index-
|
|
1
|
+
import{$ as m,r as e,j as t}from"./index-SIpO8066.js";var b=m();function g({content:n,children:a,delay:l=100,className:i}){const[p,c]=e.useState(!1),[u,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})}c(!0)},l)},[l]),d=e.useCallback(()=>{r.current&&(clearTimeout(r.current),r.current=null),c(!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:u.top,left:u.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)] preserve-case",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-SIpO8066.js";var pe=Object.defineProperty,j=Object.getOwnPropertySymbols,X=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable,V=(u,a,i)=>a in u?pe(u,a,{enumerable:!0,configurable:!0,writable:!0,value:i}):u[a]=i,k=(u,a)=>{for(var i in a||(a={}))X.call(a,i)&&V(u,i,a[i]);if(j)for(var i of j(a))K.call(a,i)&&V(u,i,a[i]);return u},U=(u,a)=>{var i={};for(var l in u)X.call(u,l)&&a.indexOf(l)<0&&(i[l]=u[l]);if(u!=null&&j)for(var l of j(u))a.indexOf(l)<0&&K.call(u,l)&&(i[l]=u[l]);return i};/**
|
|
2
2
|
* @license QR Code generator library (TypeScript)
|
|
3
3
|
* Copyright (c) Project Nayuki.
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as h,j as e,s as A,B as de,f as xe,r as l,u as me,k as z,x as pe,W as b,D as S,L as ue,V as K,h as N,l as be}from"./index-B19uS9bj.js";import{t as ve,c as Y}from"./date-CmcdoD87.js";import{w as he,b as ge,t as we}from"./status-colors-CbSft6mt.js";import{I as x}from"./InfoRow-LmWp744V.js";import{M}from"./MetricBar-CkZIfUq6.js";import{u as je}from"./useFetch-Bvarcx0Z.js";import{T as fe}from"./Tooltip-CcKi7kt4.js";import{T as Z}from"./trash-2-RJiyWQaa.js";import{A as ke}from"./arrow-left-Dt8Fc2tT.js";import{C as Ne}from"./chevron-left-CgtOoE0B.js";import{C as ye}from"./chevron-right-D8nW44q3.js";function Ce({isOpen:t,onClose:n,onConfirm:r,workerName:o,isDraining:i,loading:d}){const{t:c}=h();return e.jsx(A,{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:d})}const _e=20;function ee(t){return t==="rate_limit"?"rate limited":t}function Se(t,n){return n(t==="binary_missing"?"workers.manual_restore_required":"workers.awaiting_auto_recovery")}function Ue(){var H,B;const{id:t}=de(),n=xe(),{t:r}=h(),[o,i]=l.useState(!1),[d,c]=l.useState(!1),[D,p]=l.useState(!1),[T,E]=l.useState(!1),[re,y]=l.useState(!1),[se,$]=l.useState(!1),[L,C]=l.useState(null),g=me(a=>{var u;return(u=a.user)==null?void 0:u.role}),te=z(a=>a.workerSeq),ae=z(a=>a.taskSeq),[w,P]=l.useState(void 0),[v,R]=l.useState([]),{data:m,loading:ne,error:F,refetch:I}=je(async()=>{if(!t)throw new Error("Missing worker ID");const a={limit:String(_e)};w&&(a.cursor=w);const[u,k]=await Promise.all([N.get(`web/workers/${t}`).json(),N.get(`web/workers/${t}/tasks`,{searchParams:a}).json().catch(()=>({data:[],nextCursor:null}))]);return{worker:u,tasks:k.data,nextCursor:k.nextCursor}},[t,te,ae,w]),s=(m==null?void 0:m.worker)??null,U=(m==null?void 0:m.tasks)??[],j=(m==null?void 0:m.nextCursor)??null,W=l.useCallback(()=>{j&&(R(a=>[...a,w??""]),P(j))},[j,w]),q=l.useCallback(()=>{v.length!==0&&(P(v.at(-1)||void 0),R(a=>a.slice(0,-1)))},[v]),G=v.length+1,V=g===S.LEAD||g===S.ADMIN;pe(l.useMemo(()=>!s||s.status===b.DECOMMISSIONED?null:e.jsxs("div",{className:"flex items-center gap-2",children:[s.status===b.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")]}),g===S.ADMIN&&e.jsxs("button",{onClick:()=>p(!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(Z,{className:"h-3 w-3"}),r("workers.decommission")]})]}),[s,g,r]));async function oe(){if(s){c(!0);try{const a=s.status===b.DRAINING?"undrain":"drain";await N.post(`web/workers/${s.id}/${a}`),await I()}catch{}finally{c(!1),i(!1)}}}async function ie(){if(s){E(!0);try{await N.delete(`admin/workers/${s.id}`),n("/workers")}catch{}finally{E(!1),p(!1)}}}async function le(){if(!(!s||!L)){$(!0);try{await N.post(`web/workers/${s.id}/capabilities/${encodeURIComponent(L)}/restore`),await I()}catch{}finally{$(!1),y(!1),C(null)}}}if(ne)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(F)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:F}),e.jsx("button",{onClick:()=>I(),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 _=s.status===b.DRAINING,f=s.status!==b.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(ke,{className:"h-4 w-4"})}),e.jsx("span",{className:"truncate text-sm font-medium text-[var(--text-primary)]",children:s.name})]}),!_&&s.status!==b.OFFLINE&&f&&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:[_?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(ue,{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:[f&&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")]}),g===S.ADMIN&&f&&e.jsxs("button",{onClick:()=>p(!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(Z,{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(K,{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(O,{label:r("workers.cpu"),value:s.cpuUsage,unit:"%"}),e.jsx(O,{label:r("workers.memory"),value:s.memoryUsage,unit:"%"}),e.jsx(O,{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:he[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:ve(s.lastHeartbeat,"never")})}),s.status===b.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(K,{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 ${Y(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(M,{label:r("workers.cpu"),value:s.cpuUsage}),e.jsx(M,{label:r("workers.mem"),value:s.memoryUsage}),e.jsx(M,{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})]})]})]}),_?e.jsxs(e.Fragment,{children:[e.jsx(X,{title:r("workers.active_tasks"),tasks:U,navigate:n,nextCursor:j,pageNumber:G,hasPrev:v.length>0,onNext:W,onPrev:q}),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")}),(((H=s.degradedCapabilities)==null?void 0:H.length)??0)>0&&e.jsx("div",{className:"mt-3 space-y-2",children:s.degradedCapabilities.map(a=>e.jsx(J,{agentType:a.agentType,failureType:a.failureType,failureCount:a.failureCount,showRestore:V&&f,onRestore:()=>{C(a.agentType),y(!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 k;const u=(k=s.degradedCapabilities)==null?void 0:k.find(ce=>ce.agentType===a);return e.jsxs("span",{className:`rounded-[4px] border px-2.5 py-1 text-xs ${u?"border-[var(--warning)] text-[var(--warning)] bg-[var(--warning)]/5":"border-[var(--border)] text-[var(--text-secondary)]"}`,children:[a,u&&e.jsx("span",{className:"ml-1.5 text-[10px]",children:ee(u.failureType)})]},a)})}),(((B=s.degradedCapabilities)==null?void 0:B.length)??0)>0&&e.jsx("div",{className:"mt-3 space-y-2",children:s.degradedCapabilities.map(a=>e.jsx(J,{agentType:a.agentType,failureType:a.failureType,failureCount:a.failureCount,showRestore:V&&f,onRestore:()=>{C(a.agentType),y(!0)}},a.agentType))})]}),e.jsx(X,{title:r("workers.current_tasks"),tasks:U,navigate:n,nextCursor:j,pageNumber:G,hasPrev:v.length>0,onNext:W,onPrev:q})]})]})]}),e.jsx(Ce,{isOpen:o,onClose:()=>i(!1),onConfirm:oe,workerName:s.name,isDraining:_,loading:d}),e.jsx(A,{isOpen:D,onClose:()=>p(!1),onConfirm:ie,title:r("workers.decommission_title"),message:r("workers.decommission_confirm",{name:s.name}),confirmLabel:r("workers.decommission"),confirmVariant:"danger",isLoading:T}),e.jsx(A,{isOpen:re,onClose:()=>{y(!1),C(null)},onConfirm:le,title:r("workers.restore_capability_title"),message:r("workers.restore_capability_confirm",{capability:L??r("workers.unknown"),name:s.name}),confirmLabel:r("workers.restore_capability"),confirmVariant:"accent",isLoading:se})]})}function J({agentType:t,failureType:n,failureCount:r,showRestore:o,onRestore:i}){const{t:d}=h();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:[ee(n)," · ",r," consecutive failure",r!==1?"s":""," · ",Se(n,d)]})]}),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:d("workers.restore_capability")})]})})}function Q({worker:t,showExtended:n=!1}){const{t:r}=h();return e.jsxs("div",{className:"flex flex-col gap-2 text-xs",children:[e.jsx(x,{label:r("workers.worker_id"),value:t.id}),e.jsx(x,{label:r("workers.host"),value:t.host}),e.jsx(x,{label:r("workers.os"),value:t.os??r("workers.unknown")}),e.jsx(x,{label:r("workers.cpu_model"),value:t.cpuModel??r("workers.n_a")}),e.jsx(x,{label:r("workers.cpu_cores"),value:t.cpuCores!=null?String(t.cpuCores):r("workers.n_a")}),e.jsx(x,{label:r("workers.memory"),value:t.memoryGb!=null?`${t.memoryGb} gb`:r("workers.n_a")}),e.jsx(x,{label:r("workers.last_heartbeat_label"),value:Y(t.lastHeartbeat)}),e.jsx(x,{label:r("workers.slots"),value:`${t.activeSlots}/${t.maxSlots}`}),n&&e.jsxs(e.Fragment,{children:[e.jsx(x,{label:r("workers.status_label"),value:t.status.toLowerCase()}),e.jsx(x,{label:r("workers.worker_version"),value:t.workerVersion??r("workers.n_a")})]})]})}function X({title:t,tasks:n,navigate:r,nextCursor:o,pageNumber:i,hasPrev:d,onNext:c,onPrev:D}){const{t:p}=h(),T=d||!!o;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&&!d?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:p("workers.no_active_tasks")})]}):e.jsxs(e.Fragment,{children:[e.jsx(De,{tasks:n,navigate:r}),T&&e.jsxs("div",{className:"mt-3 flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["// page ",i]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:D,disabled:!d,className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:border-[var(--accent)] disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:[e.jsx(Ne,{className:"h-3.5 w-3.5"}),p("tasks.prev")]}),e.jsxs("button",{onClick:c,disabled:!o,className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:border-[var(--accent)] disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:[p("common.next"),e.jsx(ye,{className:"h-3.5 w-3.5"})]})]})]})]})]})}function De({tasks:t,navigate:n}){const{t:r}=h();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)] preserve-case",children:e.jsx(fe,{content:o.description,children:be(o)})}),e.jsx("td",{className:"py-2 pr-4",children:e.jsxs("span",{style:{color:we[o.status]},children:["● ",o.status.toLowerCase()]})}),e.jsx("td",{className:"py-2 text-[var(--text-secondary)]",children:o.currentStage??"-"})]},o.id))})]})})}function O({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:ge(n)}})})]})}export{Ue as default};
|
|
1
|
+
import{a as h,j as e,s as A,B as de,f as xe,r as l,u as me,k as z,x as pe,W as b,D as S,L as ue,V as K,h as N,l as be}from"./index-SIpO8066.js";import{t as ve,c as Y}from"./date-CmcdoD87.js";import{w as he,b as ge,t as we}from"./status-colors-DgUib6yo.js";import{I as x}from"./InfoRow-CyH41bJ_.js";import{M}from"./MetricBar-C93aACjn.js";import{u as je}from"./useFetch-DPYKm7wX.js";import{T as fe}from"./Tooltip-D4Qk5Haa.js";import{T as Z}from"./trash-2-D6nUAwu0.js";import{A as ke}from"./arrow-left-CrWDmaxW.js";import{C as Ne}from"./chevron-left-BBUPVpzI.js";import{C as ye}from"./chevron-right-Cuq0FVt8.js";function Ce({isOpen:t,onClose:n,onConfirm:r,workerName:o,isDraining:i,loading:d}){const{t:c}=h();return e.jsx(A,{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:d})}const _e=20;function ee(t){return t==="rate_limit"?"rate limited":t}function Se(t,n){return n(t==="binary_missing"?"workers.manual_restore_required":"workers.awaiting_auto_recovery")}function Ue(){var H,B;const{id:t}=de(),n=xe(),{t:r}=h(),[o,i]=l.useState(!1),[d,c]=l.useState(!1),[D,p]=l.useState(!1),[T,E]=l.useState(!1),[re,y]=l.useState(!1),[se,$]=l.useState(!1),[L,C]=l.useState(null),g=me(a=>{var u;return(u=a.user)==null?void 0:u.role}),te=z(a=>a.workerSeq),ae=z(a=>a.taskSeq),[w,P]=l.useState(void 0),[v,R]=l.useState([]),{data:m,loading:ne,error:F,refetch:I}=je(async()=>{if(!t)throw new Error("Missing worker ID");const a={limit:String(_e)};w&&(a.cursor=w);const[u,k]=await Promise.all([N.get(`web/workers/${t}`).json(),N.get(`web/workers/${t}/tasks`,{searchParams:a}).json().catch(()=>({data:[],nextCursor:null}))]);return{worker:u,tasks:k.data,nextCursor:k.nextCursor}},[t,te,ae,w]),s=(m==null?void 0:m.worker)??null,U=(m==null?void 0:m.tasks)??[],j=(m==null?void 0:m.nextCursor)??null,W=l.useCallback(()=>{j&&(R(a=>[...a,w??""]),P(j))},[j,w]),q=l.useCallback(()=>{v.length!==0&&(P(v.at(-1)||void 0),R(a=>a.slice(0,-1)))},[v]),G=v.length+1,V=g===S.LEAD||g===S.ADMIN;pe(l.useMemo(()=>!s||s.status===b.DECOMMISSIONED?null:e.jsxs("div",{className:"flex items-center gap-2",children:[s.status===b.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")]}),g===S.ADMIN&&e.jsxs("button",{onClick:()=>p(!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(Z,{className:"h-3 w-3"}),r("workers.decommission")]})]}),[s,g,r]));async function oe(){if(s){c(!0);try{const a=s.status===b.DRAINING?"undrain":"drain";await N.post(`web/workers/${s.id}/${a}`),await I()}catch{}finally{c(!1),i(!1)}}}async function ie(){if(s){E(!0);try{await N.delete(`admin/workers/${s.id}`),n("/workers")}catch{}finally{E(!1),p(!1)}}}async function le(){if(!(!s||!L)){$(!0);try{await N.post(`web/workers/${s.id}/capabilities/${encodeURIComponent(L)}/restore`),await I()}catch{}finally{$(!1),y(!1),C(null)}}}if(ne)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(F)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:F}),e.jsx("button",{onClick:()=>I(),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 _=s.status===b.DRAINING,f=s.status!==b.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(ke,{className:"h-4 w-4"})}),e.jsx("span",{className:"truncate text-sm font-medium text-[var(--text-primary)]",children:s.name})]}),!_&&s.status!==b.OFFLINE&&f&&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:[_?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(ue,{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:[f&&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")]}),g===S.ADMIN&&f&&e.jsxs("button",{onClick:()=>p(!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(Z,{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(K,{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(O,{label:r("workers.cpu"),value:s.cpuUsage,unit:"%"}),e.jsx(O,{label:r("workers.memory"),value:s.memoryUsage,unit:"%"}),e.jsx(O,{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:he[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:ve(s.lastHeartbeat,"never")})}),s.status===b.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(K,{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 ${Y(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(M,{label:r("workers.cpu"),value:s.cpuUsage}),e.jsx(M,{label:r("workers.mem"),value:s.memoryUsage}),e.jsx(M,{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})]})]})]}),_?e.jsxs(e.Fragment,{children:[e.jsx(X,{title:r("workers.active_tasks"),tasks:U,navigate:n,nextCursor:j,pageNumber:G,hasPrev:v.length>0,onNext:W,onPrev:q}),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")}),(((H=s.degradedCapabilities)==null?void 0:H.length)??0)>0&&e.jsx("div",{className:"mt-3 space-y-2",children:s.degradedCapabilities.map(a=>e.jsx(J,{agentType:a.agentType,failureType:a.failureType,failureCount:a.failureCount,showRestore:V&&f,onRestore:()=>{C(a.agentType),y(!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 k;const u=(k=s.degradedCapabilities)==null?void 0:k.find(ce=>ce.agentType===a);return e.jsxs("span",{className:`rounded-[4px] border px-2.5 py-1 text-xs ${u?"border-[var(--warning)] text-[var(--warning)] bg-[var(--warning)]/5":"border-[var(--border)] text-[var(--text-secondary)]"}`,children:[a,u&&e.jsx("span",{className:"ml-1.5 text-[10px]",children:ee(u.failureType)})]},a)})}),(((B=s.degradedCapabilities)==null?void 0:B.length)??0)>0&&e.jsx("div",{className:"mt-3 space-y-2",children:s.degradedCapabilities.map(a=>e.jsx(J,{agentType:a.agentType,failureType:a.failureType,failureCount:a.failureCount,showRestore:V&&f,onRestore:()=>{C(a.agentType),y(!0)}},a.agentType))})]}),e.jsx(X,{title:r("workers.current_tasks"),tasks:U,navigate:n,nextCursor:j,pageNumber:G,hasPrev:v.length>0,onNext:W,onPrev:q})]})]})]}),e.jsx(Ce,{isOpen:o,onClose:()=>i(!1),onConfirm:oe,workerName:s.name,isDraining:_,loading:d}),e.jsx(A,{isOpen:D,onClose:()=>p(!1),onConfirm:ie,title:r("workers.decommission_title"),message:r("workers.decommission_confirm",{name:s.name}),confirmLabel:r("workers.decommission"),confirmVariant:"danger",isLoading:T}),e.jsx(A,{isOpen:re,onClose:()=>{y(!1),C(null)},onConfirm:le,title:r("workers.restore_capability_title"),message:r("workers.restore_capability_confirm",{capability:L??r("workers.unknown"),name:s.name}),confirmLabel:r("workers.restore_capability"),confirmVariant:"accent",isLoading:se})]})}function J({agentType:t,failureType:n,failureCount:r,showRestore:o,onRestore:i}){const{t:d}=h();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:[ee(n)," · ",r," consecutive failure",r!==1?"s":""," · ",Se(n,d)]})]}),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:d("workers.restore_capability")})]})})}function Q({worker:t,showExtended:n=!1}){const{t:r}=h();return e.jsxs("div",{className:"flex flex-col gap-2 text-xs",children:[e.jsx(x,{label:r("workers.worker_id"),value:t.id}),e.jsx(x,{label:r("workers.host"),value:t.host}),e.jsx(x,{label:r("workers.os"),value:t.os??r("workers.unknown")}),e.jsx(x,{label:r("workers.cpu_model"),value:t.cpuModel??r("workers.n_a")}),e.jsx(x,{label:r("workers.cpu_cores"),value:t.cpuCores!=null?String(t.cpuCores):r("workers.n_a")}),e.jsx(x,{label:r("workers.memory"),value:t.memoryGb!=null?`${t.memoryGb} gb`:r("workers.n_a")}),e.jsx(x,{label:r("workers.last_heartbeat_label"),value:Y(t.lastHeartbeat)}),e.jsx(x,{label:r("workers.slots"),value:`${t.activeSlots}/${t.maxSlots}`}),n&&e.jsxs(e.Fragment,{children:[e.jsx(x,{label:r("workers.status_label"),value:t.status.toLowerCase()}),e.jsx(x,{label:r("workers.worker_version"),value:t.workerVersion??r("workers.n_a")})]})]})}function X({title:t,tasks:n,navigate:r,nextCursor:o,pageNumber:i,hasPrev:d,onNext:c,onPrev:D}){const{t:p}=h(),T=d||!!o;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&&!d?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:p("workers.no_active_tasks")})]}):e.jsxs(e.Fragment,{children:[e.jsx(De,{tasks:n,navigate:r}),T&&e.jsxs("div",{className:"mt-3 flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["// page ",i]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:D,disabled:!d,className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:border-[var(--accent)] disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:[e.jsx(Ne,{className:"h-3.5 w-3.5"}),p("tasks.prev")]}),e.jsxs("button",{onClick:c,disabled:!o,className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:border-[var(--accent)] disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:[p("common.next"),e.jsx(ye,{className:"h-3.5 w-3.5"})]})]})]})]})]})}function De({tasks:t,navigate:n}){const{t:r}=h();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)] preserve-case",children:e.jsx(fe,{content:o.description,children:be(o)})}),e.jsx("td",{className:"py-2 pr-4",children:e.jsxs("span",{style:{color:we[o.status]},children:["● ",o.status.toLowerCase()]})}),e.jsx("td",{className:"py-2 text-[var(--text-secondary)]",children:o.currentStage??"-"})]},o.id))})]})})}function O({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:ge(n)}})})]})}export{Ue as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as G,R as U,a as C,j as e,v as q,r as o,h as S,X as K,J as H,f as J,u as V,k as X,W as N,x as Q,D as Y,S as M}from"./index-
|
|
1
|
+
import{c as G,R as U,a as C,j as e,v as q,r as o,h as S,X as K,J as H,f as J,u as V,k as X,W as N,x as Q,D as Y,S as M}from"./index-SIpO8066.js";import{w as W}from"./status-colors-DgUib6yo.js";import{M as _}from"./MetricBar-C93aACjn.js";import Z from"./WorkerSetupGuidePage-Dc8EwtLE.js";import{C as A}from"./copy-BYaFbye3.js";import{L as ee}from"./loader-circle-CgEDuRCD.js";import{S as te}from"./Select-Oo9Mtr7U.js";import{E as re}from"./EmptyState-DrJ71y5v.js";import{C as se}from"./Skeleton-ZmBjZxS-.js";import{u as ae}from"./useFetch-DPYKm7wX.js";import{P as oe}from"./plus-C7qIBqP3.js";import{A as ne}from"./arrow-left-CrWDmaxW.js";import"./key-DBbJpxpA.js";import"./download-Dc0JEVAx.js";import"./settings-DzZ0EIFb.js";import"./play-D7LSd1xC.js";import"./wifi-Bmp-6qp_.js";import"./chevron-down-Ckd1H7Qb.js";/**
|
|
2
2
|
* @license lucide-react v0.469.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./index-B19uS9bj.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-SIpO8066.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 +1 @@
|
|
|
1
|
-
import{f as x,a as o,j as e,J as t}from"./index-
|
|
1
|
+
import{f as x,a as o,j as e,J as t}from"./index-SIpO8066.js";import{K as i}from"./key-DBbJpxpA.js";import{D as d}from"./download-Dc0JEVAx.js";import{S as l}from"./settings-DzZ0EIFb.js";import{P as m}from"./play-D7LSd1xC.js";import{W as p}from"./wifi-Bmp-6qp_.js";function k(){const c=x(),{t:r}=o(),n=[{number:1,icon:i,title:r("workers.step_generate_token"),description:r("workers.step_generate_token_desc"),content:e.jsx("button",{type:"button",className:"rounded-[4px] border border-[var(--accent)] px-3 py-1.5 text-xs text-[var(--accent)] hover:bg-[var(--accent)] hover:text-black transition-colors",onClick:()=>c("/admin/tokens"),children:r("workers.go_to_token_management")})},{number:2,icon:d,title:r("workers.step_install_worker"),description:r("workers.step_install_worker_desc"),content:e.jsx("div",{className:"space-y-2",children:e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] overflow-x-auto",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"$ "}),"npm install -g @overlordai/cli @overlordai/worker"]})})},{number:3,icon:l,title:r("workers.step_configure_env"),description:r("workers.step_configure_env_desc"),content:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"mb-1.5 text-[11px] text-[var(--text-muted)]",children:r("workers.setup_wizard_option")}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] overflow-x-auto",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"$ "}),"overlord setup worker"]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1.5 text-[11px] text-[var(--text-muted)]",children:r("workers.manual_config_option")}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] overflow-x-auto space-y-1",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"$ "}),"mkdir -p ~/.overlord-worker"]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"$ "}),"cat > ~/.overlord-worker/.env <<EOF"]}),e.jsx("div",{children:"OVERLORD_HOST=https://overlord.example.com"}),e.jsx("div",{children:"OVERLORD_WORKER_TOKEN=ovw_TOKEN_HERE"}),e.jsx("div",{children:"OVERLORD_WORKER_NAME=my-worker"}),e.jsx("div",{children:"EOF"})]})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] p-3 text-xs space-y-1",children:[e.jsxs("p",{className:"text-[var(--text-secondary)]",children:[e.jsx("span",{className:"text-[var(--accent)]",children:"OVERLORD_HOST"})," — ",r("workers.env_host")]}),e.jsxs("p",{className:"text-[var(--text-secondary)]",children:[e.jsx("span",{className:"text-[var(--accent)]",children:"OVERLORD_WORKER_TOKEN"})," — ",r("workers.env_worker_token")]}),e.jsxs("p",{className:"text-[var(--text-secondary)]",children:[e.jsx("span",{className:"text-[var(--accent)]",children:"OVERLORD_WORKER_NAME"})," — ",r("workers.env_worker_name")]}),e.jsxs("p",{className:"text-[var(--text-secondary)]",children:[e.jsx("span",{className:"text-[var(--accent)]",children:"OVERLORD_WORKSPACE_ROOT"})," — ",r("workers.env_workspace_root")]}),e.jsxs("p",{className:"text-[var(--text-secondary)]",children:[e.jsx("span",{className:"text-[var(--accent)]",children:"OVERLORD_MAX_SLOTS"})," — ",r("workers.env_max_slots")]})]})]})},{number:4,icon:m,title:r("workers.step_start_worker"),description:r("workers.step_start_worker_desc"),content:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:r("workers.start_note_setup_wizard")}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] overflow-x-auto",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"$ "}),"overlord start worker"]})]})},{number:5,icon:p,title:r("workers.step_verify_connection"),description:r("workers.step_verify_connection_desc"),content:e.jsxs("div",{className:"flex items-start gap-3 rounded-[4px] border border-green-500/20 bg-green-500/5 p-3",children:[e.jsx(t,{className:"mt-0.5 h-4 w-4 shrink-0 text-green-400"}),e.jsxs("div",{className:"text-xs",children:[e.jsx("p",{className:"text-[var(--text-primary)]",children:r("workers.verify_how_to")}),e.jsxs("ul",{className:"mt-1 list-inside list-disc text-[var(--text-muted)]",children:[e.jsx("li",{children:r("workers.verify_check_workers").split("workers page").map((s,a)=>a===0?e.jsxs("span",{children:[s,e.jsx("button",{type:"button",className:"text-[var(--accent)] underline",onClick:()=>c("/workers"),children:r("workers.title")})]},a):e.jsx("span",{children:s},a))}),e.jsx("li",{children:r("workers.verify_status")}),e.jsx("li",{children:r("workers.verify_capabilities")})]})]})]})}];return e.jsxs("div",{className:"max-w-3xl font-mono px-4 md:px-0",children:[e.jsx("div",{className:"mb-8",children:e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("workers.setup_header_desc")})}),e.jsxs("div",{className:"mb-8 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsx("h2",{className:"mb-3 text-xs text-[var(--text-primary)]",children:r("workers.prerequisites")}),e.jsxs("ul",{className:"space-y-2 text-xs text-[var(--text-muted)]",children:[e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(t,{className:"h-3.5 w-3.5 text-[var(--accent)]"}),r("workers.prereq_machine")]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(t,{className:"h-3.5 w-3.5 text-[var(--accent)]"}),r("workers.prereq_node")]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(t,{className:"h-3.5 w-3.5 text-[var(--accent)]"}),r("workers.prereq_git")]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(t,{className:"h-3.5 w-3.5 text-[var(--accent)]"}),r("workers.prereq_network")]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(t,{className:"h-3.5 w-3.5 text-[var(--accent)]"}),r("workers.prereq_token")]})]})]}),e.jsx("div",{className:"space-y-4",children:n.map(s=>e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-3",children:[e.jsx("span",{className:"flex h-6 w-6 items-center justify-center rounded-[4px] bg-[var(--accent)] text-[11px] font-bold text-black",children:s.number}),e.jsx(s.icon,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("h3",{className:"text-xs text-[var(--text-primary)]",children:s.title})]}),e.jsx("p",{className:"mb-3 text-[11px] text-[var(--text-muted)]",children:s.description}),s.content]},s.number))})]})}export{k as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e,L as t}from"./index-
|
|
1
|
+
import{j as e,L as t}from"./index-SIpO8066.js";import{I as s,a as r}from"./DocsPrimitives-BGGP86NT.js";import"./copy-BYaFbye3.js";function l(){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:"each machine that will execute tasks needs the overlord worker package installed. workers connect to the server via websocket, receive task assignments, manage git workspaces, and run ai agents in pty terminals."})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// installation"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"on each worker machine:"}),e.jsx(s,{code:"npm install -g @overlordai/cli @overlordai/worker"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// interactive setup"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"run the setup wizard:"}),e.jsx(s,{code:"overlord setup worker"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"the wizard prompts for:"}),e.jsxs("ol",{className:"space-y-1 text-xs text-[var(--text-secondary)] list-none pl-0",children:[e.jsxs("li",{children:["1. ",e.jsx("span",{className:"text-[var(--accent)]",children:"server url"})," — the overlord server address (e.g., ",e.jsx("code",{className:"text-[var(--text-muted)]",children:"https://overlord.yourdomain.com"})," or ",e.jsx("code",{className:"text-[var(--text-muted)]",children:"http://localhost:9000"}),")"]}),e.jsxs("li",{children:["2. ",e.jsx("span",{className:"text-[var(--accent)]",children:"registration token"})," — a one-time token generated in admin → settings → tokens"]}),e.jsxs("li",{children:["3. ",e.jsx("span",{className:"text-[var(--accent)]",children:"machine name"})," — a display name for this worker"]}),e.jsxs("li",{children:["4. ",e.jsx("span",{className:"text-[var(--accent)]",children:"max slots"})," — maximum number of concurrent tasks (default: 2)"]})]}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["the wizard writes configuration to ",e.jsx("code",{className:"text-[var(--accent)]",children:"~/.overlord-worker/.env"})," and starts the worker service."]})]}),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:"// each worker needs its own unique registration token. generate one per machine in admin → settings → tokens (web dashboard)."})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// web ui guided setup"}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["alternatively, open ",e.jsx("code",{className:"text-[var(--accent)]",children:"https://your-server/workers/setup"})," in a browser. the page provides step-by-step instructions with the exact commands to run on the worker machine."]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// what the worker does"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"once running, the worker:"}),e.jsxs("ul",{className:"space-y-1 text-xs text-[var(--text-secondary)] list-none pl-0",children:[e.jsx("li",{children:"— connects to the server via websocket (auto-reconnects on failure)"}),e.jsx("li",{children:"— registers with the one-time token on first run, then uses jwt for subsequent connections"}),e.jsx("li",{children:"— sends heartbeats every 30 seconds with cpu, memory, and disk usage"}),e.jsxs("li",{children:["— reports installed agent capabilities (",e.jsx("code",{className:"text-[var(--accent)]",children:"claude"}),", ",e.jsx("code",{className:"text-[var(--accent)]",children:"cursor"}),", ",e.jsx("code",{className:"text-[var(--accent)]",children:"codex"}),")"]}),e.jsx("li",{children:"— receives task assignments and creates isolated git worktrees"}),e.jsx("li",{children:"— spawns pty terminals running the configured ai agent"}),e.jsx("li",{children:"— streams terminal output back to the server in real time"}),e.jsx("li",{children:"— manages cursor remote tunnels for workspace access"})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// configuration"}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["worker configuration is stored in ",e.jsx("code",{className:"text-[var(--accent)]",children:"~/.overlord-worker/.env"}),":"]}),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:"variable"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"default"}),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:"OVERLORD_HOST"})}),e.jsx("td",{className:"px-3 py-2 text-[var(--text-muted)]",children:"—"}),e.jsx("td",{className:"px-3 py-2",children:"server url (required)"})]}),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:"OVERLORD_WORKER_TOKEN"})}),e.jsx("td",{className:"px-3 py-2 text-[var(--text-muted)]",children:"—"}),e.jsx("td",{className:"px-3 py-2",children:"one-time registration token"})]}),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:"OVERLORD_WORKER_NAME"})}),e.jsx("td",{className:"px-3 py-2 text-[var(--text-muted)]",children:"hostname"}),e.jsx("td",{className:"px-3 py-2",children:"display name"})]}),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:"OVERLORD_WORKSPACE_ROOT"})}),e.jsx("td",{className:"px-3 py-2 text-[var(--text-muted)]",children:"~/.overlord-worker/workspaces"}),e.jsx("td",{className:"px-3 py-2",children:"task workspace directory"})]}),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:"OVERLORD_MAX_SLOTS"})}),e.jsx("td",{className:"px-3 py-2 text-[var(--text-muted)]",children:"2"}),e.jsx("td",{className:"px-3 py-2",children:"max concurrent tasks"})]}),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:"OVERLORD_DATA_DIR"})}),e.jsx("td",{className:"px-3 py-2 text-[var(--text-muted)]",children:"~/.overlord-worker"}),e.jsx("td",{className:"px-3 py-2",children:"config and jwt storage"})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"OVERLORD_SSH_KEY_PATH"})}),e.jsx("td",{className:"px-3 py-2 text-[var(--text-muted)]",children:"—"}),e.jsx("td",{className:"px-3 py-2",children:"ssh key for git operations"})]})]})]})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// non-interactive mode"}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["for automation or ci, pass ",e.jsx("code",{className:"text-[var(--accent)]",children:"--server"})," and ",e.jsx("code",{className:"text-[var(--accent)]",children:"--token"})," as cli flags. non-interactive mode activates automatically when both are provided:"]}),e.jsx(r,{code:`overlord setup worker \\
|
|
2
2
|
--server https://overlord.yourdomain.com \\
|
|
3
3
|
--token ovw_1_abc123 \\
|
|
4
4
|
--name worker-01 \\
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Q as t}from"./index-
|
|
1
|
+
import{Q as t}from"./index-SIpO8066.js";const r=[t.CLAUDE,t.CODEX,t.CURSOR];function i(e){return r.includes(e)}function u(e){return i(e)?[e,...r.filter(n=>n!==e)]:[...r]}function s(e,n){return u(n).map(o=>({value:o,label:e(o)}))}function a(e,n){return[{value:"",label:"auto"},...s(e,n)]}export{s as a,a as g};
|