@overlordai/server 1.0.71 → 1.0.72

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/package.json +4 -4
  2. package/public/assets/{AccessTokensPage-C1KxsuHq.js → AccessTokensPage-CTrIeDGn.js} +1 -1
  3. package/public/assets/{AdminPage-DbFm0hOL.js → AdminPage-C5TGIDur.js} +1 -1
  4. package/public/assets/{ApiReferencePage-C2sQuzcP.js → ApiReferencePage-2LgDOSsG.js} +1 -1
  5. package/public/assets/{ArchitecturePage-C7el9GsX.js → ArchitecturePage-ct1Aoqcx.js} +1 -1
  6. package/public/assets/{AuditLogPage-CX9OBQtG.js → AuditLogPage-C9v9wKL7.js} +1 -1
  7. package/public/assets/{BindPlatformPage-BW2M2vKF.js → BindPlatformPage-C2LAr7OX.js} +1 -1
  8. package/public/assets/{BotIntegrationPage-Bsj1xlUm.js → BotIntegrationPage-TAuYx6Ph.js} +1 -1
  9. package/public/assets/{BotManage-CfH6RaDx.js → BotManage-Dtr1CDCE.js} +1 -1
  10. package/public/assets/{BotSetupPage-B9qbCa_P.js → BotSetupPage-iM2F_ajk.js} +1 -1
  11. package/public/assets/{ChangelogPage-CaIv9C_t.js → ChangelogPage-ZdJ5m2-I.js} +1 -1
  12. package/public/assets/{CliReferencePage-FGtSB-WE.js → CliReferencePage-BMSwCcyx.js} +1 -1
  13. package/public/assets/{DeploymentPage-BAudG2Tr.js → DeploymentPage-DmbpMhaq.js} +1 -1
  14. package/public/assets/{DevWorkflowPage-Cg3pznxy.js → DevWorkflowPage-C0bT_W4r.js} +1 -1
  15. package/public/assets/{DeveloperManage-7_kw4pfm.js → DeveloperManage-BLEwbkdo.js} +1 -1
  16. package/public/assets/{DeveloperSetupPage-23Davo01.js → DeveloperSetupPage-DpyP0UDz.js} +1 -1
  17. package/public/assets/{DocsLayout-D3VKB5zJ.js → DocsLayout-CKAwGAMY.js} +1 -1
  18. package/public/assets/{DocsPrimitives-BiDMVOFl.js → DocsPrimitives-da9Oz8oj.js} +1 -1
  19. package/public/assets/{EditProjectPage-C6YcYdiz.js → EditProjectPage-WNcBdoOV.js} +1 -1
  20. package/public/assets/{EmptyState-C3yiKdL6.js → EmptyState-UzC8uton.js} +1 -1
  21. package/public/assets/{EnvVariablesPage-lxLwDyYf.js → EnvVariablesPage-fALKRBpP.js} +1 -1
  22. package/public/assets/{HomePage-CMqtLPFH.js → HomePage-Chajmcrd.js} +1 -1
  23. package/public/assets/{InfoRow-BzF-Ghcu.js → InfoRow-BxuuO5Qy.js} +1 -1
  24. package/public/assets/{InstallationPage-CelO432V.js → InstallationPage-BZArixzU.js} +1 -1
  25. package/public/assets/{LandingPage-W9ko7DVU.js → LandingPage-CD4lk1an.js} +1 -1
  26. package/public/assets/{LocalDevelopmentPage-Rs-RJn5-.js → LocalDevelopmentPage-DwKRd_Yh.js} +1 -1
  27. package/public/assets/{LoginPage-Bp96JFVD.js → LoginPage-L15LV6L-.js} +1 -1
  28. package/public/assets/{MetricBar-BQkmuXAL.js → MetricBar-CY4JXTL4.js} +1 -1
  29. package/public/assets/{NotFoundPage-ZvsZseSi.js → NotFoundPage-C89tnB9j.js} +1 -1
  30. package/public/assets/{OnboardingGuide-CDNvxE9_.js → OnboardingGuide-CXvqLclC.js} +1 -1
  31. package/public/assets/{PermissionsPage-CawIrPGc.js → PermissionsPage-CEzl0EZF.js} +1 -1
  32. package/public/assets/{PipelineConfigPage-B_wutEEq.js → PipelineConfigPage-BbD8NHD3.js} +1 -1
  33. package/public/assets/{PipelineEditorPage-BSxxF72g.js → PipelineEditorPage-Dq7n_D5r.js} +1 -1
  34. package/public/assets/{ProfilePage-C-nmN-By.js → ProfilePage-8cooPUJN.js} +1 -1
  35. package/public/assets/{ProjectDetailPage-LPHSSu7P.js → ProjectDetailPage-C7eY7Cre.js} +1 -1
  36. package/public/assets/{ProjectListPage-C31_Ay4t.js → ProjectListPage-CaUESq9u.js} +1 -1
  37. package/public/assets/{PtyTerminal-CTqEV7Nd.js → PtyTerminal-DQzv-lNY.js} +1 -1
  38. package/public/assets/{QuickAuth-CFK1UL14.js → QuickAuth-bh93hBaI.js} +1 -1
  39. package/public/assets/{RemoveMemberConfirmDialog-C1y2iS_9.js → RemoveMemberConfirmDialog-PMBM-tCf.js} +1 -1
  40. package/public/assets/{Select-BmSEj4-2.js → Select-BOHcpb-Z.js} +1 -1
  41. package/public/assets/{SettingsPage-DggZSPQB.js → SettingsPage-CdYoRmnU.js} +1 -1
  42. package/public/assets/{Skeleton-B2I8dIUF.js → Skeleton-BU6NxyrT.js} +1 -1
  43. package/public/assets/{SkillPage-CBTxscku.js → SkillPage-B6raz5hZ.js} +1 -1
  44. package/public/assets/{TaskDetailPage-B9zrQxVz.js → TaskDetailPage-CFE4y9km.js} +1 -1
  45. package/public/assets/{TaskListPage-CLMgzykc.js → TaskListPage-cI4W08hL.js} +1 -1
  46. package/public/assets/{TaskStatusBadge-D7YtciSI.js → TaskStatusBadge-TE_9qPSu.js} +1 -1
  47. package/public/assets/{TerminalHomePage-DS9egsne.js → TerminalHomePage-B5E8B_Le.js} +2 -2
  48. package/public/assets/{TokenManage-XhEZLm3U.js → TokenManage-DsJOx3Ji.js} +1 -1
  49. package/public/assets/{TotpSetupPage-BwXOuC8h.js → TotpSetupPage-DFogIoM0.js} +1 -1
  50. package/public/assets/{WorkerDetailPage-BidnHWSI.js → WorkerDetailPage-Bxibd0Jv.js} +1 -1
  51. package/public/assets/{WorkerListPage-D9Sx2Qj1.js → WorkerListPage-rv3EzS_-.js} +1 -1
  52. package/public/assets/{WorkerOperationsPage-BVqOPKPL.js → WorkerOperationsPage-CDCfh7pJ.js} +1 -1
  53. package/public/assets/{WorkerSetupGuidePage-CisdSN3i.js → WorkerSetupGuidePage-BdhmSBuu.js} +1 -1
  54. package/public/assets/{WorkerSetupPage-D1EfdiQR.js → WorkerSetupPage-CTTXuDNx.js} +1 -1
  55. package/public/assets/{arrow-left-BhUPkdy5.js → arrow-left-C68Wmh7I.js} +1 -1
  56. package/public/assets/{arrow-right-b1VhePsW.js → arrow-right-D3IWbQ9s.js} +1 -1
  57. package/public/assets/{bot-3wzbq300.js → bot-CQLe-HII.js} +1 -1
  58. package/public/assets/{chevron-right-u3Q_FU8D.js → chevron-right-CCpkekO3.js} +1 -1
  59. package/public/assets/{copy-B1jQ4pbs.js → copy-WhOEX5ot.js} +1 -1
  60. package/public/assets/{download-DJCYeset.js → download-Da942af8.js} +1 -1
  61. package/public/assets/{external-link-BlAvfzj2.js → external-link-Dmw_XJHJ.js} +1 -1
  62. package/public/assets/{index-BLXQrTv9.js → index-6DyWlxlQ.js} +2 -2
  63. package/public/assets/{key-elqvuBzT.js → key-CeyMjwsm.js} +1 -1
  64. package/public/assets/{loader-circle-BRMYxZfv.js → loader-circle-BAcRWGK5.js} +1 -1
  65. package/public/assets/{message-square-CZau8J5h.js → message-square-W6a9HB30.js} +1 -1
  66. package/public/assets/{pencil-BzyGpI8s.js → pencil-B7kYVQql.js} +1 -1
  67. package/public/assets/{plus-NWcYLEIq.js → plus-LcuKUlNK.js} +1 -1
  68. package/public/assets/{rotate-ccw-CPStvDV2.js → rotate-ccw-BxvEw64c.js} +1 -1
  69. package/public/assets/{scroll-text-FNU4RbjS.js → scroll-text-BuElWJem.js} +1 -1
  70. package/public/assets/{settings-Vg0cVhzJ.js → settings-Xi8Njbwg.js} +1 -1
  71. package/public/assets/{status-colors-CNClmRSt.js → status-colors-BUgDdbGs.js} +1 -1
  72. package/public/assets/{task-constants-OK8-vXXs.js → task-constants-CTL1qWJ8.js} +1 -1
  73. package/public/assets/{trash-2-YP06bYAN.js → trash-2-CyrHY1x3.js} +1 -1
  74. package/public/assets/{useFetch-WwlQwbqf.js → useFetch-BqhQtTnS.js} +1 -1
  75. package/public/assets/{users-CFJarfcd.js → users-BTSprZf4.js} +1 -1
  76. package/public/assets/{wifi-D7sIQnh6.js → wifi-lkENCfkT.js} +1 -1
  77. package/public/assets/{workflow-Bz54V-O_.js → workflow-BHZMdl7E.js} +1 -1
  78. package/public/index.html +1 -1
  79. package/public/sw.js +1 -1
@@ -1 +1 @@
1
- import{a as b,r as s,g as h,F as v,j as e,C as j}from"./index-BLXQrTv9.js";import{C as f}from"./copy-B1jQ4pbs.js";function y({mode:l}){const{t:o}=b(),[n,d]=s.useState([]),[x,c]=s.useState(null),[u,i]=s.useState(!1);s.useEffect(()=>{h.get("web/profile/tokens").json().then(t=>{const r=t.filter(m=>m.status===v.ACTIVE);d(r),r.length>0&&c(r[0].id)}).catch(()=>{})},[]);const a=l==="cli"?"ov login --token <your-token>":'curl -H "authorization: bearer <your-token>" http://localhost:9000/api/web/tasks',p=s.useCallback(()=>{navigator.clipboard.writeText(a),i(!0),setTimeout(()=>i(!1),2e3)},[a]);return n.length===0?null:e.jsxs("div",{className:"mb-8 rounded-[4px] border border-[var(--accent)]/20 bg-[var(--bg-card)] p-4",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:o("docs.quick_start_with_token")}),e.jsx("select",{value:x??"",onChange:t=>c(Number(t.target.value)),className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] px-2 py-1 text-xs text-[var(--text-primary)]",children:n.map(t=>e.jsx("option",{value:t.id,children:t.label},t.id))})]}),e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-[4px] bg-[var(--bg-primary)] px-3 py-2",children:[e.jsx("code",{className:"text-xs text-[var(--accent)] break-all",children:a}),e.jsx("button",{onClick:p,className:"shrink-0 text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:u?e.jsx(j,{size:14}):e.jsx(f,{size:14})})]}),e.jsx("p",{className:"mt-2 text-[11px] text-[var(--text-muted)]",children:o("docs.replace_token_hint")})]})}export{y as Q};
1
+ import{a as b,r as s,g as h,F as v,j as e,C as j}from"./index-6DyWlxlQ.js";import{C as f}from"./copy-WhOEX5ot.js";function y({mode:l}){const{t:o}=b(),[n,d]=s.useState([]),[x,c]=s.useState(null),[u,i]=s.useState(!1);s.useEffect(()=>{h.get("web/profile/tokens").json().then(t=>{const r=t.filter(m=>m.status===v.ACTIVE);d(r),r.length>0&&c(r[0].id)}).catch(()=>{})},[]);const a=l==="cli"?"ov login --token <your-token>":'curl -H "authorization: bearer <your-token>" http://localhost:9000/api/web/tasks',p=s.useCallback(()=>{navigator.clipboard.writeText(a),i(!0),setTimeout(()=>i(!1),2e3)},[a]);return n.length===0?null:e.jsxs("div",{className:"mb-8 rounded-[4px] border border-[var(--accent)]/20 bg-[var(--bg-card)] p-4",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:o("docs.quick_start_with_token")}),e.jsx("select",{value:x??"",onChange:t=>c(Number(t.target.value)),className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] px-2 py-1 text-xs text-[var(--text-primary)]",children:n.map(t=>e.jsx("option",{value:t.id,children:t.label},t.id))})]}),e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-[4px] bg-[var(--bg-primary)] px-3 py-2",children:[e.jsx("code",{className:"text-xs text-[var(--accent)] break-all",children:a}),e.jsx("button",{onClick:p,className:"shrink-0 text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:u?e.jsx(j,{size:14}):e.jsx(f,{size:14})})]}),e.jsx("p",{className:"mt-2 text-[11px] text-[var(--text-muted)]",children:o("docs.replace_token_hint")})]})}export{y as Q};
@@ -1,4 +1,4 @@
1
- import{c as w,a as _,r as s,y as l,j as e,X as R,g,s as C}from"./index-BLXQrTv9.js";import{S as N}from"./Select-BmSEj4-2.js";/**
1
+ import{c as w,a as _,r as s,y as l,j as e,X as R,g,s as C}from"./index-6DyWlxlQ.js";import{S as N}from"./Select-BOHcpb-Z.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as p,r as l,j as t}from"./index-BLXQrTv9.js";/**
1
+ import{c as p,r as l,j as t}from"./index-6DyWlxlQ.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as h,a as v,r,j as e,g as m,t as u}from"./index-BLXQrTv9.js";/**
1
+ import{c as h,a as v,r,j as e,g as m,t as u}from"./index-6DyWlxlQ.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-BLXQrTv9.js";const n="rounded-[4px] bg-[var(--border)] animate-pulse";function c({rows:r=5}){const a=[[60,200,80,120],[60,160,100,80],[60,220,70,140],[60,180,90,100],[60,190,110,90]];return e.jsx("div",{className:"flex flex-col gap-3",children:Array.from({length:r}).map((s,l)=>{const t=a[l%a.length];return e.jsx("div",{className:"flex gap-4",children:t.map((i,o)=>e.jsx("div",{className:n,style:{width:i,height:12}},o))},l)})})}function m({cards:r=4}){return e.jsx("div",{className:"grid grid-cols-2 gap-3",children:Array.from({length:r}).map((a,s)=>e.jsx("div",{className:`${n} h-20`},s))})}export{m as C,c as T};
1
+ import{j as e}from"./index-6DyWlxlQ.js";const n="rounded-[4px] bg-[var(--border)] animate-pulse";function c({rows:r=5}){const a=[[60,200,80,120],[60,160,100,80],[60,220,70,140],[60,180,90,100],[60,190,110,90]];return e.jsx("div",{className:"flex flex-col gap-3",children:Array.from({length:r}).map((s,l)=>{const t=a[l%a.length];return e.jsx("div",{className:"flex gap-4",children:t.map((i,o)=>e.jsx("div",{className:n,style:{width:i,height:12}},o))},l)})})}function m({cards:r=4}){return e.jsx("div",{className:"grid grid-cols-2 gap-3",children:Array.from({length:r}).map((a,s)=>e.jsx("div",{className:`${n} h-20`},s))})}export{m as C,c as T};
@@ -1 +1 @@
1
- import{a as t,j as e}from"./index-BLXQrTv9.js";import{I as c,C as r}from"./DocsPrimitives-BiDMVOFl.js";import{E as n}from"./external-link-BlAvfzj2.js";import"./copy-B1jQ4pbs.js";const o=[{action:"create tasks",desc:"describe what you want done, overlord dispatches to a worker"},{action:"list & monitor tasks",desc:"check status, read execution logs, track progress"},{action:"cancel & retry tasks",desc:"manage task lifecycle"},{action:"confirm pipeline stages",desc:"approve or provide input for suspended stages"},{action:"manage projects",desc:"list projects, view members"},{action:"check cluster health",desc:"see worker status, online workers, queue depth"},{action:"search",desc:"find tasks, projects, and workers by keyword"},{action:"read notifications",desc:"check and clear your notification inbox"}],d=['create a task in project "frontend" to fix the login page styling',"what tasks are running right now?","show me the logs for task 42","how many workers are online?","cancel task 15"],i=[{name:"claude code",url:"https://claude.com/claude-code"},{name:"cursor",url:"https://cursor.com/cli"},{name:"windsurf",url:"https://windsurf.com"},{name:"codex",url:"https://openai.com/codex"}];function u(){t();const a=typeof window<"u"?window.location.origin:"https://your-server";return e.jsxs("div",{className:"mx-auto max-w-4xl px-4 md:px-6 py-8 font-mono lowercase",children:[e.jsx("div",{className:"mb-8",children:e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"// use overlord from your ai coding assistant — claude code, cursor, windsurf, codex, and more. install the skill and your assistant can create tasks, monitor execution, and manage your fleet."})}),e.jsxs("div",{className:"mb-8 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"// install"}),e.jsx(c,{code:"npx skills add overlord-run/skill"})]}),e.jsxs("div",{className:"mb-8 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"// configure — set these environment variables"}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between rounded-[4px] bg-[var(--bg-primary)] px-3 py-2 overflow-x-auto",children:[e.jsxs("code",{className:"text-xs text-[var(--text-primary)] whitespace-nowrap",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"export "}),"OVERLORD_SERVER=",e.jsx("span",{className:"text-[var(--accent)]",children:a})]}),e.jsx(r,{text:`export OVERLORD_SERVER=${a}`})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-[4px] bg-[var(--bg-primary)] px-3 py-2 overflow-x-auto",children:[e.jsxs("code",{className:"text-xs text-[var(--text-primary)] whitespace-nowrap",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"export "}),"OVERLORD_TOKEN=",e.jsx("span",{className:"text-[var(--text-secondary)]",children:"your-token"})]}),e.jsx(r,{text:"export OVERLORD_TOKEN=your-token"})]})]}),e.jsxs("p",{className:"text-[11px] text-[var(--text-muted)]",children:["// create a token at ",e.jsx("a",{href:"/access-tokens",className:"text-[var(--accent)] hover:underline",children:"/access-tokens"})]})]}),e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{className:"mb-4 text-sm text-[var(--accent)]",children:"> capabilities"}),e.jsx("div",{className:"space-y-2",children:o.map(s=>e.jsxs("div",{className:"flex items-start gap-3 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3",children:[e.jsx("span",{className:"shrink-0 text-xs font-medium text-[var(--text-primary)]",children:s.action}),e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["// ",s.desc]})]},s.action))})]}),e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{className:"mb-4 text-sm text-[var(--accent)]",children:"> example usage"}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-2",children:[e.jsx("p",{className:"mb-3 text-xs text-[var(--text-muted)]",children:"// just ask your ai agent naturally"}),d.map(s=>e.jsx("div",{className:"rounded-[4px] bg-[var(--bg-primary)] px-3 py-2",children:e.jsxs("code",{className:"text-xs text-[var(--text-secondary)]",children:[e.jsx("span",{className:"text-[var(--accent)]",children:"> "}),s]})},s))]})]}),e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{className:"mb-4 text-sm text-[var(--accent)]",children:"> compatible tools"}),e.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:i.map(s=>e.jsxs("a",{href:s.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-center gap-1.5 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2.5 text-xs text-[var(--text-primary)] transition-colors hover:border-[var(--accent)]",children:[s.name,e.jsx(n,{className:"h-3 w-3 text-[var(--text-muted)]"})]},s.name))}),e.jsx("p",{className:"mt-2 text-[11px] text-[var(--text-muted)]",children:"// and any ai coding assistant that supports the skills protocol"})]}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["// open source:"," ",e.jsx("a",{href:"https://github.com/overlord-run/skill",target:"_blank",rel:"noopener noreferrer",className:"text-[var(--accent)] hover:underline",children:"github.com/overlord-run/skill"})]})})]})}export{u as default};
1
+ import{a as t,j as e}from"./index-6DyWlxlQ.js";import{I as c,C as r}from"./DocsPrimitives-da9Oz8oj.js";import{E as n}from"./external-link-Dmw_XJHJ.js";import"./copy-WhOEX5ot.js";const o=[{action:"create tasks",desc:"describe what you want done, overlord dispatches to a worker"},{action:"list & monitor tasks",desc:"check status, read execution logs, track progress"},{action:"cancel & retry tasks",desc:"manage task lifecycle"},{action:"confirm pipeline stages",desc:"approve or provide input for suspended stages"},{action:"manage projects",desc:"list projects, view members"},{action:"check cluster health",desc:"see worker status, online workers, queue depth"},{action:"search",desc:"find tasks, projects, and workers by keyword"},{action:"read notifications",desc:"check and clear your notification inbox"}],d=['create a task in project "frontend" to fix the login page styling',"what tasks are running right now?","show me the logs for task 42","how many workers are online?","cancel task 15"],i=[{name:"claude code",url:"https://claude.com/claude-code"},{name:"cursor",url:"https://cursor.com/cli"},{name:"windsurf",url:"https://windsurf.com"},{name:"codex",url:"https://openai.com/codex"}];function u(){t();const a=typeof window<"u"?window.location.origin:"https://your-server";return e.jsxs("div",{className:"mx-auto max-w-4xl px-4 md:px-6 py-8 font-mono lowercase",children:[e.jsx("div",{className:"mb-8",children:e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"// use overlord from your ai coding assistant — claude code, cursor, windsurf, codex, and more. install the skill and your assistant can create tasks, monitor execution, and manage your fleet."})}),e.jsxs("div",{className:"mb-8 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"// install"}),e.jsx(c,{code:"npx skills add overlord-run/skill"})]}),e.jsxs("div",{className:"mb-8 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"// configure — set these environment variables"}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between rounded-[4px] bg-[var(--bg-primary)] px-3 py-2 overflow-x-auto",children:[e.jsxs("code",{className:"text-xs text-[var(--text-primary)] whitespace-nowrap",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"export "}),"OVERLORD_SERVER=",e.jsx("span",{className:"text-[var(--accent)]",children:a})]}),e.jsx(r,{text:`export OVERLORD_SERVER=${a}`})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-[4px] bg-[var(--bg-primary)] px-3 py-2 overflow-x-auto",children:[e.jsxs("code",{className:"text-xs text-[var(--text-primary)] whitespace-nowrap",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"export "}),"OVERLORD_TOKEN=",e.jsx("span",{className:"text-[var(--text-secondary)]",children:"your-token"})]}),e.jsx(r,{text:"export OVERLORD_TOKEN=your-token"})]})]}),e.jsxs("p",{className:"text-[11px] text-[var(--text-muted)]",children:["// create a token at ",e.jsx("a",{href:"/access-tokens",className:"text-[var(--accent)] hover:underline",children:"/access-tokens"})]})]}),e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{className:"mb-4 text-sm text-[var(--accent)]",children:"> capabilities"}),e.jsx("div",{className:"space-y-2",children:o.map(s=>e.jsxs("div",{className:"flex items-start gap-3 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3",children:[e.jsx("span",{className:"shrink-0 text-xs font-medium text-[var(--text-primary)]",children:s.action}),e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["// ",s.desc]})]},s.action))})]}),e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{className:"mb-4 text-sm text-[var(--accent)]",children:"> example usage"}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-2",children:[e.jsx("p",{className:"mb-3 text-xs text-[var(--text-muted)]",children:"// just ask your ai agent naturally"}),d.map(s=>e.jsx("div",{className:"rounded-[4px] bg-[var(--bg-primary)] px-3 py-2",children:e.jsxs("code",{className:"text-xs text-[var(--text-secondary)]",children:[e.jsx("span",{className:"text-[var(--accent)]",children:"> "}),s]})},s))]})]}),e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{className:"mb-4 text-sm text-[var(--accent)]",children:"> compatible tools"}),e.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:i.map(s=>e.jsxs("a",{href:s.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-center gap-1.5 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2.5 text-xs text-[var(--text-primary)] transition-colors hover:border-[var(--accent)]",children:[s.name,e.jsx(n,{className:"h-3 w-3 text-[var(--text-muted)]"})]},s.name))}),e.jsx("p",{className:"mt-2 text-[11px] text-[var(--text-muted)]",children:"// and any ai coding assistant that supports the skills protocol"})]}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["// open source:"," ",e.jsx("a",{href:"https://github.com/overlord-run/skill",target:"_blank",rel:"noopener noreferrer",className:"text-[var(--accent)] hover:underline",children:"github.com/overlord-run/skill"})]})})]})}export{u as default};
@@ -1,4 +1,4 @@
1
- import{c as ee,a as X,r,g as j,j as e,q as D,s as $e,v as Ue,e as qe,m as ze,i as we,L as Be,X as le,l as K,w as _e,t as Ce,o as Ge}from"./index-BLXQrTv9.js";import{u as Ke,T as Xe}from"./task-constants-OK8-vXXs.js";import{C as We,H as Se,P as Ee}from"./PtyTerminal-CTqEV7Nd.js";import{a as Ve,f as Z}from"./date-BdNtiQTP.js";import{M as He}from"./message-square-CZau8J5h.js";import{S as Je}from"./Select-BmSEj4-2.js";import{a as Qe}from"./status-colors-CNClmRSt.js";import{A as Ye}from"./arrow-left-BhUPkdy5.js";import{R as ce}from"./rotate-ccw-CPStvDV2.js";import{E as Ze}from"./external-link-BlAvfzj2.js";import{L as ie}from"./loader-circle-BRMYxZfv.js";/**
1
+ import{c as ee,a as X,r,g as j,j as e,q as D,s as $e,v as Ue,e as qe,m as ze,i as we,L as Be,X as le,l as K,w as _e,t as Ce,o as Ge}from"./index-6DyWlxlQ.js";import{u as Ke,T as Xe}from"./task-constants-CTL1qWJ8.js";import{C as We,H as Se,P as Ee}from"./PtyTerminal-DQzv-lNY.js";import{a as Ve,f as Z}from"./date-BdNtiQTP.js";import{M as He}from"./message-square-W6a9HB30.js";import{S as Je}from"./Select-BOHcpb-Z.js";import{a as Qe}from"./status-colors-BUgDdbGs.js";import{A as Ye}from"./arrow-left-C68Wmh7I.js";import{R as ce}from"./rotate-ccw-BxvEw64c.js";import{E as Ze}from"./external-link-Dmw_XJHJ.js";import{L as ie}from"./loader-circle-BAcRWGK5.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{R as V,e as $,a as F,j as e,u as X,h as Y,r as a,g as R,X as Z,i as ee,n as te,H as se,t as O,l as _,o as re,p as H}from"./index-BLXQrTv9.js";import{a as ae,u as oe}from"./task-constants-OK8-vXXs.js";import{T as Q}from"./TaskStatusBadge-D7YtciSI.js";import{f as G}from"./date-BdNtiQTP.js";import{t as ne}from"./string-B39tzdVK.js";import{S as q}from"./Select-BmSEj4-2.js";import{C as le}from"./copy-B1jQ4pbs.js";import{E as U}from"./EmptyState-C3yiKdL6.js";import{T as W}from"./Skeleton-B2I8dIUF.js";import{P as ie}from"./plus-NWcYLEIq.js";import"./status-colors-CNClmRSt.js";const ce=V.memo(function({task:t}){const m=$(),{t:p}=F(),d=(l,r)=>p(`common.${l}`,{n:r});return e.jsxs("tr",{onClick:()=>m(`/tasks/${t.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:["#",t.id]}),e.jsx("td",{className:"py-3 pr-4 text-sm text-[var(--text-primary)]",children:ne(t.description,80)}),e.jsx("td",{className:"py-3 pr-4",children:e.jsx(Q,{status:t.status})}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:t.projectKey}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:t.developerName??t.creatorName??"-"}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:t.workerName??"—"}),e.jsx("td",{className:"py-3 font-mono text-xs text-[var(--text-muted)]",children:G(t.createdAt,d)})]})});function de({isOpen:n,onClose:t,projects:m,projectsLoading:p,onSubmit:d,isSubmitting:l}){const{t:r}=F();X(o=>o.user);const b=Y(),[i,w]=a.useState(""),[x,h]=a.useState(""),[g,u]=a.useState("feat"),[T,E]=a.useState(""),[I,S]=a.useState(""),[j,v]=a.useState(""),[B,f]=a.useState([]),[K,k]=a.useState("");a.useEffect(()=>{n&&(w(""),h(""),u("feat"),E(""),S(""),v(""),k(""),b&&R.get("admin/developers").json().then(f).catch(()=>f([])))},[n,b]),a.useEffect(()=>{if(!n)return;function o(N){N.key==="Escape"&&t()}return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[n,t]);async function y(o){if(o.preventDefault(),k(""),!i||!x.trim()){k(r("tasks.project_and_description_required"));return}try{await d({projectKey:i,description:x.trim(),workerId:I||void 0,developerId:j?Number(j):void 0,taskType:g,branchSlug:T.trim()||void 0})}catch(N){const z=N instanceof Error?N.message:r("tasks.failed_to_create_task");k(z)}}return n?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 font-mono",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},onClick:o=>{o.target===o.currentTarget&&t()},children:e.jsxs("div",{className:"w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",onClick:o=>o.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-6 py-4",children:[e.jsxs("h2",{className:"text-sm text-[var(--text-primary)]",children:["// ",r("tasks.new_task")]}),e.jsx("button",{onClick:t,className:"text-[var(--text-muted)] transition-colors hover:text-[var(--text-primary)]",children:e.jsx(Z,{className:"h-4 w-4"})})]}),e.jsxs("form",{onSubmit:y,className:"px-6 py-5",children:[e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.project")}),e.jsx(q,{value:i,onChange:w,options:m.map(o=>({value:o.key,label:o.name})),placeholder:r(p?"common.loading":"tasks.select_project"),disabled:p})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.task_type")}),e.jsx(q,{value:g,onChange:u,options:ae})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.task_description")}),e.jsx("textarea",{value:x,onChange:o=>h(o.target.value),placeholder:r("tasks.describe_task_placeholder"),rows:4,className:"w-full resize-none rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.target_worker")}),e.jsx("input",{type:"text",value:I,onChange:o=>S(o.target.value),placeholder:r("tasks.any_able"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.branch_slug")}),e.jsx("input",{type:"text",value:T,onChange:o=>E(o.target.value),placeholder:r("tasks.branch_slug_placeholder"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),b&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.assign_developer")}),e.jsx(q,{value:j,onChange:v,options:B.map(o=>({value:String(o.id),label:o.name})),placeholder:r("tasks.select_developer")})]}),K&&e.jsx("div",{className:"rounded-[4px] bg-[#2a1515] border border-[var(--destructive)]/30 px-3 py-2 text-xs text-[var(--destructive)]",children:K})]}),e.jsxs("div",{className:"mt-6 flex items-center justify-end gap-3",children:[e.jsx("button",{type:"button",onClick:t,className:"rounded-[4px] border border-[var(--border)] bg-transparent px-4 py-2 text-xs text-[var(--text-secondary)] transition-colors hover:text-[var(--text-primary)]",children:r("common.cancel")}),e.jsx("button",{type:"submit",disabled:l||!i||!x.trim(),className:"rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs text-black transition-opacity hover:opacity-90 disabled:opacity-40",children:r(l?"common.creating":"tasks.create_task")})]})]})]})}):null}function xe({isOpen:n,onClose:t,onForceCreate:m,onViewExisting:p,similarTask:d,isLoading:l}){const{t:r}=F();return!d||!n?null:e.jsx("div",{onClick:t,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(le,{style:{width:"1rem",height:"1rem"}}),r("tasks.dedup_title")]}),e.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.7rem",marginTop:"0.25rem"},children:r("tasks.dedup_description")})]}),e.jsxs("div",{style:{marginBottom:"1.25rem",padding:"0.75rem",border:"1px solid var(--border)",borderRadius:"4px",backgroundColor:"var(--bg-primary)"},children:[e.jsxs("div",{style:{color:"var(--text-muted)",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace"},children:["#",d.id," · ",d.status]}),e.jsx("div",{style:{color:"var(--text-primary)",fontSize:"0.75rem",marginTop:"0.375rem",lineHeight:"1.5"},children:d.description})]}),e.jsxs("div",{style:{display:"flex",gap:"0.75rem"},children:[e.jsx("button",{type:"button",onClick:t,disabled:l,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:l?"not-allowed":"pointer",opacity:l?.7:1,transition:"color 0.15s, border-color 0.15s"},children:r("common.cancel")}),e.jsx("button",{type:"button",onClick:()=>p(d.id),style:{flex:1,padding:"0.5rem",backgroundColor:"transparent",color:"var(--text-muted)",border:"1px solid var(--border)",borderRadius:"4px",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:"pointer"},children:r("tasks.view_existing")}),e.jsx("button",{type:"button",onClick:m,disabled:l,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:l?"not-allowed":"pointer",opacity:l?.7:1},children:r(l?"common.creating":"tasks.dedup_create_anyway")})]})]})})}function pe({task:n}){const t=$();return e.jsxs("div",{onClick:()=>t(`/tasks/${n.id}`),className:"cursor-pointer rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 transition-colors active:bg-[var(--bg-input)]",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("span",{className:"text-[11px] text-[var(--text-primary)] leading-tight",style:{wordBreak:"break-word"},children:["#",n.id," ",n.description]}),e.jsx("span",{className:"shrink-0",children:e.jsx(Q,{status:n.status})})]}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-2 text-[11px] text-[var(--text-muted)]",children:[e.jsx("span",{children:G(n.createdAt)}),e.jsx("span",{children:"·"}),e.jsx("span",{children:n.projectKey}),n.workerName&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("span",{children:n.workerName})]})]})]})}const me=[{key:"all",labelKey:"tasks.tab_all"},{key:_.RUNNING,labelKey:"tasks.tab_running"},{key:_.QUEUED,labelKey:"tasks.tab_queued"},{key:_.COMPLETED,labelKey:"tasks.tab_completed"},{key:_.FAILED,labelKey:"tasks.tab_failed"},{key:_.CANCELLED,labelKey:"tasks.tab_cancelled"}],D=20;function Se(){const n=$(),{t}=F(),{tasks:m,loading:p,fetchTasks:d}=oe(),l=ee(s=>s.taskSeq),[r,b]=a.useState("all"),[i,w]=a.useState(""),[x,h]=a.useState(1),[g,u]=a.useState(!1);te(a.useMemo(()=>e.jsxs("button",{onClick:()=>u(!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(ie,{className:"h-3.5 w-3.5"}),t("tasks.new_task")]}),[t]));const[T,E]=a.useState([]),[I,S]=a.useState(!1),[j,v]=a.useState(!1),[B,f]=a.useState(!1),[K,k]=a.useState(null),[y,o]=a.useState(null);a.useEffect(()=>{const s={limit:String(D)};r!=="all"&&(s.status=r),d(s)},[r,d,l]),a.useEffect(()=>{h(1)},[i]),a.useEffect(()=>{g&&(S(!0),R.get("web/projects").json().then(s=>E(s)).catch(()=>{}).finally(()=>S(!1)))},[g]);const N=a.useCallback(async s=>{v(!0);try{const c=await R.post("web/tasks",{json:{projectKey:s.projectKey,description:s.description,workerId:s.workerId,developerId:s.developerId}}).json();u(!1),n(`/tasks/${c.task.id}`)}catch(c){if(c instanceof se&&c.response.status===409){try{const C=await c.response.json();if(C.confirmRequired){k({id:C.confirmRequired.taskId,description:C.confirmRequired.message,status:"active"}),o(s),u(!1),f(!0);return}}catch{}O.error(t("tasks.similar_task_exists"))}else{const C=c instanceof Error?c.message:String(c);O.error(C)}}finally{v(!1)}},[n]),z=a.useCallback(async()=>{if(y){v(!0);try{const s=await R.post("web/tasks",{json:{projectKey:y.projectKey,description:y.description,workerId:y.workerId,force:!0}}).json();f(!1),n(`/tasks/${s.task.id}`)}finally{v(!1)}}},[y,n]),P=a.useMemo(()=>{if(!i.trim())return m;const s=i.toLowerCase();return m.filter(c=>c.description.toLowerCase().includes(s)||String(c.id).includes(i))},[m,i]),A=Math.max(1,Math.ceil(P.length/D)),M=P.slice((x-1)*D,x*D),L=t(i?"tasks.try_adjusting_search":"tasks.create_first_task"),J=i?void 0:e.jsx("button",{onClick:()=>u(!0),className:"rounded-[4px] bg-[var(--accent)] px-5 py-2 text-[11px] font-bold text-black",children:t("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:me.map(s=>e.jsx("button",{onClick:()=>b(s.key),className:`shrink-0 rounded-[4px] px-3 py-2 h-10 md:h-8 text-xs transition-colors ${r===s.key?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)] bg-[var(--bg-card)] hover:text-[var(--text-secondary)]"}`,children:t(s.labelKey)},s.key))}),e.jsxs("div",{className:"relative md:ml-auto md:w-64",children:[e.jsx(re,{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:t("tasks.search_tasks"),value:i,onChange:s=>w(s.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)]"}),i&&e.jsx("button",{onClick:()=>w(""),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("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:t("tasks.id")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.description_col")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.status_col")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.project_col")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.assignee")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.worker")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.time")})]})}),e.jsxs("tbody",{children:[p&&M.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"p-4",children:e.jsx(W,{rows:5})})}),!p&&P.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"p-4",children:e.jsx(U,{icon:H,title:t("tasks.no_tasks_found"),description:L,action:J})})}),M.map(s=>e.jsx(ce,{task:s},s.id))]})]})}),e.jsxs("div",{className:"flex flex-col gap-2 md:hidden",children:[p&&M.length===0&&e.jsx("div",{className:"p-4",children:e.jsx(W,{rows:5})}),!p&&P.length===0&&e.jsx(U,{icon:H,title:t("tasks.no_tasks_found"),description:L,action:J}),M.map(s=>e.jsx(pe,{task:s},s.id))]}),A>1&&e.jsxs("div",{className:"mt-6 flex items-center justify-center gap-1",children:[e.jsx("button",{onClick:()=>h(Math.max(1,x-1)),disabled:x===1,className:"rounded-[4px] px-2 py-1 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] disabled:opacity-30 min-w-[44px] min-h-[44px] flex items-center justify-center",children:t("tasks.prev")}),Array.from({length:A},(s,c)=>c+1).map(s=>e.jsx("button",{onClick:()=>h(s),className:`rounded-[4px] px-2.5 py-1 text-xs transition-colors min-w-[44px] min-h-[44px] flex items-center justify-center ${x===s?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:s},s)),e.jsx("button",{onClick:()=>h(Math.min(A,x+1)),disabled:x===A,className:"rounded-[4px] px-2 py-1 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] disabled:opacity-30 min-w-[44px] min-h-[44px] flex items-center justify-center",children:t("common.next")})]}),e.jsx(de,{isOpen:g,onClose:()=>u(!1),projects:T,projectsLoading:I,onSubmit:N,isSubmitting:j}),e.jsx(xe,{isOpen:B,onClose:()=>f(!1),onForceCreate:z,onViewExisting:s=>{f(!1),n(`/tasks/${s}`)},similarTask:K,isLoading:j})]})}export{Se as default};
1
+ import{R as V,e as $,a as F,j as e,u as X,h as Y,r as a,g as R,X as Z,i as ee,n as te,H as se,t as O,l as _,o as re,p as H}from"./index-6DyWlxlQ.js";import{a as ae,u as oe}from"./task-constants-CTL1qWJ8.js";import{T as Q}from"./TaskStatusBadge-TE_9qPSu.js";import{f as G}from"./date-BdNtiQTP.js";import{t as ne}from"./string-B39tzdVK.js";import{S as q}from"./Select-BOHcpb-Z.js";import{C as le}from"./copy-WhOEX5ot.js";import{E as U}from"./EmptyState-UzC8uton.js";import{T as W}from"./Skeleton-BU6NxyrT.js";import{P as ie}from"./plus-LcuKUlNK.js";import"./status-colors-BUgDdbGs.js";const ce=V.memo(function({task:t}){const m=$(),{t:p}=F(),d=(l,r)=>p(`common.${l}`,{n:r});return e.jsxs("tr",{onClick:()=>m(`/tasks/${t.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:["#",t.id]}),e.jsx("td",{className:"py-3 pr-4 text-sm text-[var(--text-primary)]",children:ne(t.description,80)}),e.jsx("td",{className:"py-3 pr-4",children:e.jsx(Q,{status:t.status})}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:t.projectKey}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:t.developerName??t.creatorName??"-"}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:t.workerName??"—"}),e.jsx("td",{className:"py-3 font-mono text-xs text-[var(--text-muted)]",children:G(t.createdAt,d)})]})});function de({isOpen:n,onClose:t,projects:m,projectsLoading:p,onSubmit:d,isSubmitting:l}){const{t:r}=F();X(o=>o.user);const b=Y(),[i,w]=a.useState(""),[x,h]=a.useState(""),[g,u]=a.useState("feat"),[T,E]=a.useState(""),[I,S]=a.useState(""),[j,v]=a.useState(""),[B,f]=a.useState([]),[K,k]=a.useState("");a.useEffect(()=>{n&&(w(""),h(""),u("feat"),E(""),S(""),v(""),k(""),b&&R.get("admin/developers").json().then(f).catch(()=>f([])))},[n,b]),a.useEffect(()=>{if(!n)return;function o(N){N.key==="Escape"&&t()}return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[n,t]);async function y(o){if(o.preventDefault(),k(""),!i||!x.trim()){k(r("tasks.project_and_description_required"));return}try{await d({projectKey:i,description:x.trim(),workerId:I||void 0,developerId:j?Number(j):void 0,taskType:g,branchSlug:T.trim()||void 0})}catch(N){const z=N instanceof Error?N.message:r("tasks.failed_to_create_task");k(z)}}return n?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 font-mono",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},onClick:o=>{o.target===o.currentTarget&&t()},children:e.jsxs("div",{className:"w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",onClick:o=>o.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-6 py-4",children:[e.jsxs("h2",{className:"text-sm text-[var(--text-primary)]",children:["// ",r("tasks.new_task")]}),e.jsx("button",{onClick:t,className:"text-[var(--text-muted)] transition-colors hover:text-[var(--text-primary)]",children:e.jsx(Z,{className:"h-4 w-4"})})]}),e.jsxs("form",{onSubmit:y,className:"px-6 py-5",children:[e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.project")}),e.jsx(q,{value:i,onChange:w,options:m.map(o=>({value:o.key,label:o.name})),placeholder:r(p?"common.loading":"tasks.select_project"),disabled:p})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.task_type")}),e.jsx(q,{value:g,onChange:u,options:ae})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.task_description")}),e.jsx("textarea",{value:x,onChange:o=>h(o.target.value),placeholder:r("tasks.describe_task_placeholder"),rows:4,className:"w-full resize-none rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.target_worker")}),e.jsx("input",{type:"text",value:I,onChange:o=>S(o.target.value),placeholder:r("tasks.any_able"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.branch_slug")}),e.jsx("input",{type:"text",value:T,onChange:o=>E(o.target.value),placeholder:r("tasks.branch_slug_placeholder"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),b&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.assign_developer")}),e.jsx(q,{value:j,onChange:v,options:B.map(o=>({value:String(o.id),label:o.name})),placeholder:r("tasks.select_developer")})]}),K&&e.jsx("div",{className:"rounded-[4px] bg-[#2a1515] border border-[var(--destructive)]/30 px-3 py-2 text-xs text-[var(--destructive)]",children:K})]}),e.jsxs("div",{className:"mt-6 flex items-center justify-end gap-3",children:[e.jsx("button",{type:"button",onClick:t,className:"rounded-[4px] border border-[var(--border)] bg-transparent px-4 py-2 text-xs text-[var(--text-secondary)] transition-colors hover:text-[var(--text-primary)]",children:r("common.cancel")}),e.jsx("button",{type:"submit",disabled:l||!i||!x.trim(),className:"rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs text-black transition-opacity hover:opacity-90 disabled:opacity-40",children:r(l?"common.creating":"tasks.create_task")})]})]})]})}):null}function xe({isOpen:n,onClose:t,onForceCreate:m,onViewExisting:p,similarTask:d,isLoading:l}){const{t:r}=F();return!d||!n?null:e.jsx("div",{onClick:t,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(le,{style:{width:"1rem",height:"1rem"}}),r("tasks.dedup_title")]}),e.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.7rem",marginTop:"0.25rem"},children:r("tasks.dedup_description")})]}),e.jsxs("div",{style:{marginBottom:"1.25rem",padding:"0.75rem",border:"1px solid var(--border)",borderRadius:"4px",backgroundColor:"var(--bg-primary)"},children:[e.jsxs("div",{style:{color:"var(--text-muted)",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace"},children:["#",d.id," · ",d.status]}),e.jsx("div",{style:{color:"var(--text-primary)",fontSize:"0.75rem",marginTop:"0.375rem",lineHeight:"1.5"},children:d.description})]}),e.jsxs("div",{style:{display:"flex",gap:"0.75rem"},children:[e.jsx("button",{type:"button",onClick:t,disabled:l,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:l?"not-allowed":"pointer",opacity:l?.7:1,transition:"color 0.15s, border-color 0.15s"},children:r("common.cancel")}),e.jsx("button",{type:"button",onClick:()=>p(d.id),style:{flex:1,padding:"0.5rem",backgroundColor:"transparent",color:"var(--text-muted)",border:"1px solid var(--border)",borderRadius:"4px",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:"pointer"},children:r("tasks.view_existing")}),e.jsx("button",{type:"button",onClick:m,disabled:l,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:l?"not-allowed":"pointer",opacity:l?.7:1},children:r(l?"common.creating":"tasks.dedup_create_anyway")})]})]})})}function pe({task:n}){const t=$();return e.jsxs("div",{onClick:()=>t(`/tasks/${n.id}`),className:"cursor-pointer rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 transition-colors active:bg-[var(--bg-input)]",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("span",{className:"text-[11px] text-[var(--text-primary)] leading-tight",style:{wordBreak:"break-word"},children:["#",n.id," ",n.description]}),e.jsx("span",{className:"shrink-0",children:e.jsx(Q,{status:n.status})})]}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-2 text-[11px] text-[var(--text-muted)]",children:[e.jsx("span",{children:G(n.createdAt)}),e.jsx("span",{children:"·"}),e.jsx("span",{children:n.projectKey}),n.workerName&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("span",{children:n.workerName})]})]})]})}const me=[{key:"all",labelKey:"tasks.tab_all"},{key:_.RUNNING,labelKey:"tasks.tab_running"},{key:_.QUEUED,labelKey:"tasks.tab_queued"},{key:_.COMPLETED,labelKey:"tasks.tab_completed"},{key:_.FAILED,labelKey:"tasks.tab_failed"},{key:_.CANCELLED,labelKey:"tasks.tab_cancelled"}],D=20;function Se(){const n=$(),{t}=F(),{tasks:m,loading:p,fetchTasks:d}=oe(),l=ee(s=>s.taskSeq),[r,b]=a.useState("all"),[i,w]=a.useState(""),[x,h]=a.useState(1),[g,u]=a.useState(!1);te(a.useMemo(()=>e.jsxs("button",{onClick:()=>u(!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(ie,{className:"h-3.5 w-3.5"}),t("tasks.new_task")]}),[t]));const[T,E]=a.useState([]),[I,S]=a.useState(!1),[j,v]=a.useState(!1),[B,f]=a.useState(!1),[K,k]=a.useState(null),[y,o]=a.useState(null);a.useEffect(()=>{const s={limit:String(D)};r!=="all"&&(s.status=r),d(s)},[r,d,l]),a.useEffect(()=>{h(1)},[i]),a.useEffect(()=>{g&&(S(!0),R.get("web/projects").json().then(s=>E(s)).catch(()=>{}).finally(()=>S(!1)))},[g]);const N=a.useCallback(async s=>{v(!0);try{const c=await R.post("web/tasks",{json:{projectKey:s.projectKey,description:s.description,workerId:s.workerId,developerId:s.developerId}}).json();u(!1),n(`/tasks/${c.task.id}`)}catch(c){if(c instanceof se&&c.response.status===409){try{const C=await c.response.json();if(C.confirmRequired){k({id:C.confirmRequired.taskId,description:C.confirmRequired.message,status:"active"}),o(s),u(!1),f(!0);return}}catch{}O.error(t("tasks.similar_task_exists"))}else{const C=c instanceof Error?c.message:String(c);O.error(C)}}finally{v(!1)}},[n]),z=a.useCallback(async()=>{if(y){v(!0);try{const s=await R.post("web/tasks",{json:{projectKey:y.projectKey,description:y.description,workerId:y.workerId,force:!0}}).json();f(!1),n(`/tasks/${s.task.id}`)}finally{v(!1)}}},[y,n]),P=a.useMemo(()=>{if(!i.trim())return m;const s=i.toLowerCase();return m.filter(c=>c.description.toLowerCase().includes(s)||String(c.id).includes(i))},[m,i]),A=Math.max(1,Math.ceil(P.length/D)),M=P.slice((x-1)*D,x*D),L=t(i?"tasks.try_adjusting_search":"tasks.create_first_task"),J=i?void 0:e.jsx("button",{onClick:()=>u(!0),className:"rounded-[4px] bg-[var(--accent)] px-5 py-2 text-[11px] font-bold text-black",children:t("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:me.map(s=>e.jsx("button",{onClick:()=>b(s.key),className:`shrink-0 rounded-[4px] px-3 py-2 h-10 md:h-8 text-xs transition-colors ${r===s.key?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)] bg-[var(--bg-card)] hover:text-[var(--text-secondary)]"}`,children:t(s.labelKey)},s.key))}),e.jsxs("div",{className:"relative md:ml-auto md:w-64",children:[e.jsx(re,{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:t("tasks.search_tasks"),value:i,onChange:s=>w(s.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)]"}),i&&e.jsx("button",{onClick:()=>w(""),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("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:t("tasks.id")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.description_col")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.status_col")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.project_col")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.assignee")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.worker")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.time")})]})}),e.jsxs("tbody",{children:[p&&M.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"p-4",children:e.jsx(W,{rows:5})})}),!p&&P.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"p-4",children:e.jsx(U,{icon:H,title:t("tasks.no_tasks_found"),description:L,action:J})})}),M.map(s=>e.jsx(ce,{task:s},s.id))]})]})}),e.jsxs("div",{className:"flex flex-col gap-2 md:hidden",children:[p&&M.length===0&&e.jsx("div",{className:"p-4",children:e.jsx(W,{rows:5})}),!p&&P.length===0&&e.jsx(U,{icon:H,title:t("tasks.no_tasks_found"),description:L,action:J}),M.map(s=>e.jsx(pe,{task:s},s.id))]}),A>1&&e.jsxs("div",{className:"mt-6 flex items-center justify-center gap-1",children:[e.jsx("button",{onClick:()=>h(Math.max(1,x-1)),disabled:x===1,className:"rounded-[4px] px-2 py-1 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] disabled:opacity-30 min-w-[44px] min-h-[44px] flex items-center justify-center",children:t("tasks.prev")}),Array.from({length:A},(s,c)=>c+1).map(s=>e.jsx("button",{onClick:()=>h(s),className:`rounded-[4px] px-2.5 py-1 text-xs transition-colors min-w-[44px] min-h-[44px] flex items-center justify-center ${x===s?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:s},s)),e.jsx("button",{onClick:()=>h(Math.min(A,x+1)),disabled:x===A,className:"rounded-[4px] px-2 py-1 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] disabled:opacity-30 min-w-[44px] min-h-[44px] flex items-center justify-center",children:t("common.next")})]}),e.jsx(de,{isOpen:g,onClose:()=>u(!1),projects:T,projectsLoading:I,onSubmit:N,isSubmitting:j}),e.jsx(xe,{isOpen:B,onClose:()=>f(!1),onForceCreate:z,onViewExisting:s=>{f(!1),n(`/tasks/${s}`)},similarTask:K,isLoading:j})]})}export{Se as default};
@@ -1 +1 @@
1
- import{a as l,j as a}from"./index-BLXQrTv9.js";import{a as r}from"./status-colors-CNClmRSt.js";const u={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=u[s],n=t?e(t):s.toLowerCase(),o=r(s);return a.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-xs",style:{color:o},children:[a.jsx("span",{style:{fontSize:"0.6rem"},children:"●"}),n]})}export{E as T};
1
+ import{a as l,j as a}from"./index-6DyWlxlQ.js";import{a as r}from"./status-colors-BUgDdbGs.js";const u={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=u[s],n=t?e(t):s.toLowerCase(),o=r(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 G,k as ne,g as I,l as k,a as _,r as i,i as $,m as re,j as e,X as q,e as ie}from"./index-BLXQrTv9.js";import{T as O,u as ce,a as F}from"./task-constants-OK8-vXXs.js";import{P as le,H as oe,C as de}from"./PtyTerminal-CTqEV7Nd.js";import{i as H,O as J}from"./OnboardingGuide-CDNvxE9_.js";import{S as P,C as xe}from"./Select-BmSEj4-2.js";import{a as Q}from"./status-colors-CNClmRSt.js";import{a as me}from"./date-BdNtiQTP.js";import{u as Y}from"./useFetch-WwlQwbqf.js";import{P as A}from"./plus-NWcYLEIq.js";import{R as ue}from"./rotate-ccw-CPStvDV2.js";import{W as pe}from"./wifi-D7sIQnh6.js";import"./chevron-right-u3Q_FU8D.js";/**
1
+ import{c as G,k as ne,g as I,l as k,a as _,r as i,i as $,m as re,j as e,X as q,e as ie}from"./index-6DyWlxlQ.js";import{T as O,u as ce,a as F}from"./task-constants-CTL1qWJ8.js";import{P as le,H as oe,C as de}from"./PtyTerminal-DQzv-lNY.js";import{i as H,O as J}from"./OnboardingGuide-CXvqLclC.js";import{S as P,C as xe}from"./Select-BOHcpb-Z.js";import{a as Q}from"./status-colors-BUgDdbGs.js";import{a as ue}from"./date-BdNtiQTP.js";import{u as Y}from"./useFetch-BqhQtTnS.js";import{P as A}from"./plus-LcuKUlNK.js";import{R as me}from"./rotate-ccw-BxvEw64c.js";import{W as pe}from"./wifi-lkENCfkT.js";import"./chevron-right-CCpkekO3.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -8,4 +8,4 @@ import{c as G,k as ne,g as I,l as k,a as _,r as i,i as $,m as re,j as e,X as q,e
8
8
  *
9
9
  * This source code is licensed under the ISC license.
10
10
  * See the LICENSE file in the root directory of this source tree.
11
- */const ve=G("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),V="overlord_home_terminal";function fe(){try{const s=localStorage.getItem(V);if(s)return JSON.parse(s)}catch{}return{pinnedTaskIds:[],activeTaskId:null}}let L="";function M(s){const a=JSON.stringify(s);a!==L&&(L=a,localStorage.setItem(V,a))}const K=fe(),be=new Set([k.QUEUED,k.ASSIGNED,k.RUNNING,k.SUSPENDED]);let D=!1;const ge=ne((s,a)=>({pinnedTaskIds:K.pinnedTaskIds,activeTaskId:K.activeTaskId,taskMetas:{},stageConfirm:null,loading:!1,setActiveTask:t=>{s({activeTaskId:t}),M({pinnedTaskIds:a().pinnedTaskIds,activeTaskId:t})},pinTask:t=>{const{pinnedTaskIds:n}=a();if(n.includes(t))return;const o=[...n,t];s({pinnedTaskIds:o}),M({pinnedTaskIds:o,activeTaskId:a().activeTaskId})},unpinTask:t=>{const{pinnedTaskIds:n,activeTaskId:o,taskMetas:x}=a(),r=n.filter(l=>l!==t),m=o===t?r[0]??null:o,{[t]:p,...c}=x;s({pinnedTaskIds:r,activeTaskId:m,taskMetas:c}),M({pinnedTaskIds:r,activeTaskId:m})},loadActiveTasks:async()=>{if(!D){D=!0,s({loading:!0});try{const n=(await I.get("web/tasks",{searchParams:{limit:"30"}}).json()).data.filter(l=>be.has(l.status)),o={};for(const l of n)o[l.id]={id:l.id,description:l.description,status:l.status,projectKey:l.projectKey,currentStage:l.currentStage,currentSessionId:l.currentSessionId};const x=new Set(n.map(l=>l.id)),{pinnedTaskIds:r,activeTaskId:m}=a(),p=[...new Set([...r.filter(l=>x.has(l)),...x])],c=m&&p.includes(m)?m:p[0]??null;s({taskMetas:o,pinnedTaskIds:p,activeTaskId:c}),M({pinnedTaskIds:p,activeTaskId:c})}catch{}finally{D=!1,s({loading:!1})}}},fetchStageConfirm:async t=>{try{const n=await I.get(`web/tasks/${t}/pending-confirm`).json();s({stageConfirm:n.confirm})}catch{s({stageConfirm:null})}},clearStageConfirm:()=>s({stageConfirm:null}),updateTaskMeta:(t,n)=>{const{taskMetas:o}=a(),x=o[t];x&&s({taskMetas:{...o,[t]:{...x,...n}}})}}));function je(){const[s,a]=i.useState(()=>H());i.useEffect(()=>{const n=()=>a(!0);return window.addEventListener("onboarding-dismissed",n),window.addEventListener("storage",()=>a(H())),()=>{window.removeEventListener("onboarding-dismissed",n),window.removeEventListener("storage",n)}},[]);const{data:t}=Y(()=>s?Promise.resolve(null):I.get("web/dashboard/stats").json(),[s]);return s||!t?null:{activeTasks:(t.active_tasks??0)+(t.queued_tasks??0),totalWorkers:t.online_workers??0,totalProjects:t.project_count??0,totalDevelopers:t.developer_count??0}}function ke({taskId:s,confirm:a,onSubmitted:t}){const{t:n}=_(),[o,x]=i.useState(a.timeout),[r,m]=i.useState(!1);i.useEffect(()=>{x(a.timeout);const c=setInterval(()=>{x(l=>l<=1?(clearInterval(c),0):l-1)},1e3);return()=>clearInterval(c)},[a.timeout,a.stageName]);const p=i.useCallback(async c=>{m(!0);try{await I.post(`web/tasks/${s}/confirm-stage`,{json:{stageName:a.stageName,approved:c}}),t()}catch{}finally{m(!1)}},[s,a.stageName,t]);return e.jsxs("div",{className:"flex items-center justify-between gap-2 border-b-2 border-[var(--warning)] bg-[var(--warning)]/10 px-3 py-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(de,{className:"h-3.5 w-3.5 shrink-0 text-[var(--warning)]"}),e.jsxs("span",{className:"truncate text-xs text-[var(--text-primary)]",children:["// stage: ",a.stageName]}),e.jsx("span",{className:"shrink-0 text-xs text-[var(--warning)]",children:me(o)})]}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx("button",{onClick:()=>p(!1),disabled:r,className:"rounded-[4px] border border-[var(--border)] px-2 py-1 text-[11px] text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors disabled:opacity-50",children:n("tasks.reject")}),e.jsx("button",{onClick:()=>p(!0),disabled:r,className:"rounded-[4px] bg-[var(--accent)] px-2 py-1 text-[11px] text-black hover:opacity-90 transition-opacity disabled:opacity-50",children:n(r?"tasks.stage_submitting":"tasks.confirm_and_proceed")})]})]})}function Ne({projectKey:s,onProjectChange:a,onCreated:t}){const{t:n}=_(),o=ce(h=>h.createTask),[x,r]=i.useState(""),[m,p]=i.useState("feat"),[c,l]=i.useState(!1),[f,T]=i.useState(!1),{data:N}=Y(()=>I.get("web/projects").json(),[]),g=i.useMemo(()=>{const h=(N??[]).map(b=>({value:b.key,label:b.key}));return[{value:"",label:n("terminal_home.all_projects")},...h]},[N,n]),S=i.useRef(!1);i.useEffect(()=>{if(!S.current){if(s){S.current=!0;return}g.length>1&&(a(g[1].value),S.current=!0)}},[s,g,a]);const C=!!s&&!!x.trim();async function y(){if(C){l(!0);try{const h=await o({projectKey:s,description:x.trim(),taskType:m});r(""),t(h.id)}catch{}finally{l(!1)}}}const j="flex-1 rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-2 py-1.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden md:flex items-center gap-2 border-b border-[var(--border)] bg-[var(--bg-card)] px-3 py-2",children:[e.jsx("div",{className:"w-[140px]",children:e.jsx(P,{value:s,onChange:a,options:g,placeholder:n("terminal_home.select_project")})}),e.jsx("div",{className:"w-[100px]",children:e.jsx(P,{value:m,onChange:p,options:F})}),e.jsx("input",{type:"text",value:x,onChange:h=>r(h.target.value),onKeyDown:h=>h.key==="Enter"&&y(),placeholder:n("terminal_home.task_description_placeholder"),className:j,disabled:c}),e.jsxs("button",{onClick:y,disabled:c||!C,className:"flex items-center gap-1 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",children:[e.jsx(A,{className:"h-3 w-3"}),n(c?"common.creating":"terminal_home.new_task")]})]}),e.jsx("div",{className:"md:hidden border-b border-[var(--border)] bg-[var(--bg-card)]",children:f?e.jsxs("div",{className:"flex flex-col gap-2 p-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex-1",children:e.jsx(P,{value:s,onChange:a,options:g,placeholder:n("terminal_home.select_project")})}),e.jsx("div",{className:"w-[100px]",children:e.jsx(P,{value:m,onChange:p,options:F})}),e.jsx("button",{onClick:()=>T(!1),className:"p-1 text-[var(--text-muted)]",children:e.jsx(q,{className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",value:x,onChange:h=>r(h.target.value),onKeyDown:h=>h.key==="Enter"&&y(),placeholder:n("terminal_home.task_description_placeholder"),className:j,disabled:c}),e.jsx("button",{onClick:y,disabled:c||!C,className:"rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",children:e.jsx(A,{className:"h-3 w-3"})})]})]}):e.jsxs("button",{onClick:()=>T(!0),className:"flex w-full items-center justify-center gap-1 py-2 text-xs text-[var(--accent)] hover:opacity-80",children:[e.jsx(A,{className:"h-3.5 w-3.5"}),n("terminal_home.new_task")]})})]})}function W({status:s,size:a}){const t=s===k.SUSPENDED,n=Q(s),o=a==="sm"?"h-1.5 w-1.5":"h-2 w-2";return e.jsx("span",{className:`${o} shrink-0 rounded-full ${t?"animate-pulse":""}`,style:{backgroundColor:t?"var(--warning)":n}})}function ye({tasks:s,activeId:a,onSelect:t,onUnpin:n,children:o}){const x=ie();return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden md:flex flex-col border-r border-[var(--border)] bg-[var(--bg-card)] overflow-y-auto",style:{width:200,minWidth:200},children:[e.jsx("div",{className:"border-b border-[var(--border)] px-3 py-2",children:e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:"// active tasks"})}),s.length===0?e.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:"no active tasks"})}):e.jsx("div",{className:"flex-1",children:s.map(r=>{const m=r.id===a;return e.jsxs("div",{onClick:()=>t(r.id),className:`group flex items-center gap-2 px-3 py-2 cursor-pointer transition-colors ${m?"bg-[var(--accent)]/10 text-[var(--text-primary)]":"text-[var(--text-secondary)] hover:bg-[var(--bg-input)] hover:text-[var(--text-primary)]"}`,children:[e.jsx(W,{status:r.status,size:"md"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"truncate text-xs",children:["#",r.id," ",r.description]}),e.jsx("div",{className:"text-[10px] text-[var(--text-muted)]",children:r.projectKey})]}),e.jsx("button",{onClick:p=>{p.stopPropagation(),n(r.id)},className:"hidden group-hover:block shrink-0 p-0.5 text-[var(--text-muted)] hover:text-[var(--text-primary)]",title:"unpin",children:e.jsx(q,{className:"h-3 w-3"})}),e.jsx("button",{onClick:p=>{p.stopPropagation(),x(`/tasks/${r.id}`)},className:"hidden group-hover:block shrink-0 p-0.5 text-[var(--text-muted)] hover:text-[var(--accent)]",title:"open detail",children:e.jsx("span",{className:"text-[10px]",children:"→"})})]},r.id)})})]}),e.jsxs("div",{className:"flex flex-col md:hidden",children:[e.jsx("div",{className:"flex items-center gap-1 overflow-x-auto no-scrollbar border-b border-[var(--border)] bg-[var(--bg-card)] px-2",style:{height:44},children:s.length===0?e.jsx("div",{className:"flex items-center justify-center w-full",children:e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:"no active tasks"})}):s.map(r=>{const m=r.id===a;return e.jsxs("button",{onClick:()=>t(r.id),className:`flex shrink-0 items-center gap-1.5 px-3 border-b-2 transition-colors ${m?"border-[var(--accent)] text-[var(--text-primary)]":"border-transparent text-[var(--text-secondary)]"}`,style:{height:44},children:[e.jsx(W,{status:r.status,size:"sm"}),e.jsxs("span",{className:"text-[11px] whitespace-nowrap",children:["#",r.id]})]},r.id)})}),o]})]})}function we({task:s,takeoverState:a,onTakeover:t,onRelease:n}){const o=Q(s.status),x=a==="manual";return e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] bg-[var(--bg-card)] px-3",style:{height:36,minHeight:36},children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:s.projectKey}),e.jsx("span",{className:"text-[11px]",style:{color:o},children:s.status.toLowerCase()}),s.currentStage&&e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["// ",s.currentStage]})]}),e.jsx("div",{className:"flex items-center gap-1",children:!O.includes(s.status)&&(x?e.jsxs("button",{onClick:n,className:"flex items-center gap-1 rounded-[4px] border border-[var(--accent)] px-2 py-0.5 text-[11px] text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors",children:[e.jsx(ue,{className:"h-3 w-3"}),e.jsx("span",{className:"hidden md:inline",children:"release"})]}):e.jsxs("button",{onClick:t,disabled:a==="requesting",className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2 py-0.5 text-[11px] text-[var(--text-secondary)] hover:text-[var(--accent)] hover:border-[var(--accent)] transition-colors disabled:opacity-50",children:[e.jsx(oe,{className:"h-3 w-3"}),e.jsx("span",{className:"hidden md:inline",children:"take over"})]}))})]})}function Te({task:s,ptyStatus:a}){const t=a==="connected";return e.jsxs("div",{className:"flex items-center justify-between border-t border-[var(--border)] bg-[var(--bg-card)] px-3",style:{height:28,minHeight:28},children:[e.jsx("span",{className:"text-[10px] text-[var(--text-muted)]",children:s.currentStage?`stage: ${s.currentStage}`:`task #${s.id}`}),e.jsxs("span",{className:`flex items-center gap-1 text-[10px] ${t?"text-[var(--accent)]":"text-[var(--text-muted)]"}`,children:[t?e.jsx(pe,{className:"h-2.5 w-2.5"}):e.jsx(ve,{className:"h-2.5 w-2.5"}),t?"connected":a]})]})}function z({onboardingData:s}){const[a,t]=i.useState(!1),{t:n}=_();return s?a?e.jsxs("div",{className:"border-b border-[var(--accent)]/30",children:[e.jsxs("button",{onClick:()=>t(!1),className:"flex w-full items-center justify-between bg-[var(--bg-card)] px-3 py-1.5 transition-colors hover:bg-[var(--bg-input)]",children:[e.jsx("span",{className:"text-[11px] text-[var(--accent)]",children:n("onboarding.getting_started")}),e.jsx(he,{className:"h-3 w-3 text-[var(--text-muted)]"})]}),e.jsx("div",{className:"max-h-[300px] overflow-y-auto",children:e.jsx(J,{data:s})})]}):e.jsxs("button",{onClick:()=>t(!0),className:"flex w-full items-center justify-between border-b border-[var(--accent)]/30 bg-[var(--bg-card)] px-3 py-1.5 transition-colors hover:bg-[var(--bg-input)]",style:{height:36},children:[e.jsx("span",{className:"text-[11px] text-[var(--accent)]",children:n("onboarding.getting_started")}),e.jsx(xe,{className:"h-3 w-3 text-[var(--text-muted)]"})]}):null}function B({onboardingData:s}){const{t:a}=_();return e.jsx("div",{className:"flex flex-1 flex-col items-center justify-center p-6",children:s?e.jsx("div",{className:"w-full max-w-lg",children:e.jsx(J,{data:s})}):e.jsxs("div",{className:"text-center",children:[e.jsxs("div",{className:"mb-3 text-3xl text-[var(--border)]",children:[">","_"]}),e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:a("terminal_home.no_active_tasks")}),e.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:a("terminal_home.create_task_hint")})]})})}function $e(){const{t:s}=_(),{pinnedTaskIds:a,activeTaskId:t,taskMetas:n,stageConfirm:o,loading:x,setActiveTask:r,pinTask:m,unpinTask:p,loadActiveTasks:c,fetchStageConfirm:l,clearStageConfirm:f,updateTaskMeta:T}=ge(),N=i.useRef(null),[g,S]=i.useState("disconnected"),[C,y]=i.useState("auto"),[j,h]=i.useState(""),b=$(d=>d.lastEvent),R=$(d=>d.status),u=t?n[t]??null:null,X=u?O.includes(u.status):!1,U=i.useRef(!1);i.useEffect(()=>{!U.current&&u&&(h(u.projectKey),U.current=!0)},[u]);const w=i.useMemo(()=>{const d=a.map(v=>n[v]).filter(Boolean);return j?d.filter(v=>v.projectKey===j):d},[a,n,j]);i.useEffect(()=>{w.length>0&&t&&!w.some(d=>d.id===t)&&r(w[0].id)},[w,t,r]);const E=je();re(u?`#${u.id} ${u.description}`:null),i.useEffect(()=>{c()},[c]),i.useEffect(()=>{t&&(u==null?void 0:u.status)===k.SUSPENDED?l(t):f()},[t,u==null?void 0:u.status,l,f]),i.useEffect(()=>{if(b){if(b.event==="task_status_changed"){const{taskId:d,status:v}=b;T(d,{status:v}),v===k.SUSPENDED&&d===t&&l(d),O.includes(v)&&d===t&&f()}b.event==="task_created"&&c()}},[b,t,l,f,T,c]),i.useEffect(()=>{if(R==="connected")return;const v=setInterval(()=>{document.visibilityState!=="hidden"&&c()},15e3);return()=>clearInterval(v)},[R,c]);const Z=i.useCallback(d=>{m(d),r(d),c()},[m,r,c]),ee=i.useCallback(()=>{f(),c()},[f,c]),te=i.useCallback(()=>{var d;(d=N.current)==null||d.requestTakeover()},[]),se=i.useCallback(()=>{var d;(d=N.current)==null||d.releaseTakeover()},[]);if(x&&a.length===0)return e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:s("common.loading")})});const ae=w.length>0;return e.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsx(Ne,{projectKey:j,onProjectChange:h,onCreated:Z}),e.jsx("div",{className:"flex flex-1 overflow-hidden",children:ae?e.jsxs(e.Fragment,{children:[e.jsx(ye,{tasks:w,activeId:t,onSelect:r,onUnpin:p,children:e.jsx("div",{className:"md:hidden",children:e.jsx(z,{onboardingData:E})})}),e.jsx("div",{className:"flex flex-1 flex-col overflow-hidden",children:u?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden md:block",children:e.jsx(z,{onboardingData:E})}),e.jsx(we,{task:u,takeoverState:C,onTakeover:te,onRelease:se}),o&&t&&e.jsx(ke,{taskId:t,confirm:o,onSubmitted:ee}),e.jsx("div",{className:"flex-1 min-h-[300px] overflow-hidden",children:e.jsx(le,{taskId:t,sessionId:u.currentSessionId??void 0,taskFinished:X,onStatusChange:S,onTakeoverChange:y,ref:N},t)}),e.jsx(Te,{task:u,ptyStatus:g})]}):e.jsx(B,{onboardingData:E})})]}):e.jsx(B,{onboardingData:E})})]})}export{$e as default};
11
+ */const ve=G("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),V="overlord_home_terminal";function fe(){try{const s=localStorage.getItem(V);if(s)return JSON.parse(s)}catch{}return{pinnedTaskIds:[],activeTaskId:null}}let L="";function M(s){const a=JSON.stringify(s);a!==L&&(L=a,localStorage.setItem(V,a))}const K=fe(),ge=new Set([k.QUEUED,k.ASSIGNED,k.RUNNING,k.SUSPENDED]);let D=!1;const be=ne((s,a)=>({pinnedTaskIds:K.pinnedTaskIds,activeTaskId:K.activeTaskId,taskMetas:{},stageConfirm:null,loading:!1,setActiveTask:t=>{s({activeTaskId:t}),M({pinnedTaskIds:a().pinnedTaskIds,activeTaskId:t})},pinTask:t=>{const{pinnedTaskIds:n}=a();if(n.includes(t))return;const o=[...n,t];s({pinnedTaskIds:o}),M({pinnedTaskIds:o,activeTaskId:a().activeTaskId})},unpinTask:t=>{const{pinnedTaskIds:n,activeTaskId:o,taskMetas:x}=a(),r=n.filter(l=>l!==t),u=o===t?r[0]??null:o,{[t]:p,...c}=x;s({pinnedTaskIds:r,activeTaskId:u,taskMetas:c}),M({pinnedTaskIds:r,activeTaskId:u})},loadActiveTasks:async()=>{if(!D){D=!0,s({loading:!0});try{const n=(await I.get("web/tasks",{searchParams:{limit:"30"}}).json()).data.filter(l=>ge.has(l.status)),o={};for(const l of n)o[l.id]={id:l.id,description:l.description,status:l.status,projectKey:l.projectKey,currentStage:l.currentStage,currentSessionId:l.currentSessionId};const x=new Set(n.map(l=>l.id)),{pinnedTaskIds:r,activeTaskId:u}=a(),p=[...new Set([...r.filter(l=>x.has(l)),...x])],c=u&&p.includes(u)?u:p[0]??null;s({taskMetas:o,pinnedTaskIds:p,activeTaskId:c}),M({pinnedTaskIds:p,activeTaskId:c})}catch{}finally{D=!1,s({loading:!1})}}},fetchStageConfirm:async t=>{try{const n=await I.get(`web/tasks/${t}/pending-confirm`).json();s({stageConfirm:n.confirm})}catch{s({stageConfirm:null})}},clearStageConfirm:()=>s({stageConfirm:null}),updateTaskMeta:(t,n)=>{const{taskMetas:o}=a(),x=o[t];x&&s({taskMetas:{...o,[t]:{...x,...n}}})}}));function je(){const[s,a]=i.useState(()=>H());i.useEffect(()=>{const n=()=>a(!0);return window.addEventListener("onboarding-dismissed",n),window.addEventListener("storage",()=>a(H())),()=>{window.removeEventListener("onboarding-dismissed",n),window.removeEventListener("storage",n)}},[]);const{data:t}=Y(()=>s?Promise.resolve(null):I.get("web/dashboard/stats").json(),[s]);return s||!t?null:{activeTasks:(t.active_tasks??0)+(t.queued_tasks??0),totalWorkers:t.online_workers??0,totalProjects:t.project_count??0,totalDevelopers:t.developer_count??0}}function ke({taskId:s,confirm:a,onSubmitted:t}){const{t:n}=_(),[o,x]=i.useState(a.timeout),[r,u]=i.useState(!1);i.useEffect(()=>{x(a.timeout);const c=setInterval(()=>{x(l=>l<=1?(clearInterval(c),0):l-1)},1e3);return()=>clearInterval(c)},[a.timeout,a.stageName]);const p=i.useCallback(async c=>{u(!0);try{await I.post(`web/tasks/${s}/confirm-stage`,{json:{stageName:a.stageName,approved:c}}),t()}catch{}finally{u(!1)}},[s,a.stageName,t]);return e.jsxs("div",{className:"flex items-center justify-between gap-2 border-b-2 border-[var(--warning)] bg-[var(--warning)]/10 px-3 py-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(de,{className:"h-3.5 w-3.5 shrink-0 text-[var(--warning)]"}),e.jsxs("span",{className:"truncate text-xs text-[var(--text-primary)]",children:["// stage: ",a.stageName]}),e.jsx("span",{className:"shrink-0 text-xs text-[var(--warning)]",children:ue(o)})]}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx("button",{onClick:()=>p(!1),disabled:r,className:"rounded-[4px] border border-[var(--border)] px-2 py-1 text-[11px] text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors disabled:opacity-50",children:n("tasks.reject")}),e.jsx("button",{onClick:()=>p(!0),disabled:r,className:"rounded-[4px] bg-[var(--accent)] px-2 py-1 text-[11px] text-black hover:opacity-90 transition-opacity disabled:opacity-50",children:n(r?"tasks.stage_submitting":"tasks.confirm_and_proceed")})]})]})}function Ne({projectKey:s,onProjectChange:a,onCreated:t}){const{t:n}=_(),o=ce(h=>h.createTask),[x,r]=i.useState(""),[u,p]=i.useState("feat"),[c,l]=i.useState(!1),[f,T]=i.useState(!1),{data:N}=Y(()=>I.get("web/projects").json(),[]),b=i.useMemo(()=>{const h=(N??[]).map(g=>({value:g.key,label:g.key}));return[{value:"",label:n("terminal_home.all_projects")},...h]},[N,n]),S=i.useRef(!1);i.useEffect(()=>{if(!S.current){if(s){S.current=!0;return}b.length>1&&(a(b[1].value),S.current=!0)}},[s,b,a]);const C=!!s&&!!x.trim();async function y(){if(C){l(!0);try{const h=await o({projectKey:s,description:x.trim(),taskType:u});r(""),t(h.id)}catch{}finally{l(!1)}}}const j="flex-1 rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-2 py-1.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden md:flex items-center gap-2 border-b border-[var(--border)] bg-[var(--bg-card)] px-3 py-2",children:[e.jsx("div",{className:"w-[140px]",children:e.jsx(P,{value:s,onChange:a,options:b,placeholder:n("terminal_home.select_project")})}),e.jsx("div",{className:"w-[100px]",children:e.jsx(P,{value:u,onChange:p,options:F})}),e.jsx("input",{type:"text",value:x,onChange:h=>r(h.target.value),onKeyDown:h=>h.key==="Enter"&&y(),placeholder:n("terminal_home.task_description_placeholder"),className:j,disabled:c}),e.jsxs("button",{onClick:y,disabled:c||!C,className:"flex items-center gap-1 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",children:[e.jsx(A,{className:"h-3 w-3"}),n(c?"common.creating":"terminal_home.new_task")]})]}),e.jsx("div",{className:"md:hidden border-b border-[var(--border)] bg-[var(--bg-card)]",children:f?e.jsxs("div",{className:"flex flex-col gap-2 p-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex-1",children:e.jsx(P,{value:s,onChange:a,options:b,placeholder:n("terminal_home.select_project")})}),e.jsx("div",{className:"w-[100px]",children:e.jsx(P,{value:u,onChange:p,options:F})}),e.jsx("button",{onClick:()=>T(!1),className:"p-1 text-[var(--text-muted)]",children:e.jsx(q,{className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",value:x,onChange:h=>r(h.target.value),onKeyDown:h=>h.key==="Enter"&&y(),placeholder:n("terminal_home.task_description_placeholder"),className:j,disabled:c}),e.jsx("button",{onClick:y,disabled:c||!C,className:"rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",children:e.jsx(A,{className:"h-3 w-3"})})]})]}):e.jsxs("button",{onClick:()=>T(!0),className:"flex w-full items-center justify-center gap-1 py-2 text-xs text-[var(--accent)] hover:opacity-80",children:[e.jsx(A,{className:"h-3.5 w-3.5"}),n("terminal_home.new_task")]})})]})}function W({status:s,size:a}){const t=s===k.SUSPENDED,n=Q(s),o=a==="sm"?"h-1.5 w-1.5":"h-2 w-2";return e.jsx("span",{className:`${o} shrink-0 rounded-full ${t?"animate-pulse":""}`,style:{backgroundColor:t?"var(--warning)":n}})}function ye({tasks:s,activeId:a,onSelect:t,onUnpin:n,children:o}){const x=ie();return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden md:flex flex-col border-r border-[var(--border)] bg-[var(--bg-card)] overflow-y-auto",style:{width:200,minWidth:200},children:[e.jsx("div",{className:"border-b border-[var(--border)] px-3 py-2",children:e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:"// active tasks"})}),s.length===0?e.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:"no active tasks"})}):e.jsx("div",{className:"flex-1",children:s.map(r=>{const u=r.id===a;return e.jsxs("div",{onClick:()=>t(r.id),className:`group flex items-center gap-2 px-3 py-2 cursor-pointer transition-colors ${u?"bg-[var(--accent)]/10 text-[var(--text-primary)]":"text-[var(--text-secondary)] hover:bg-[var(--bg-input)] hover:text-[var(--text-primary)]"}`,children:[e.jsx(W,{status:r.status,size:"md"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"truncate text-xs",children:["#",r.id," ",r.description]}),e.jsx("div",{className:"text-[10px] text-[var(--text-muted)]",children:r.projectKey})]}),e.jsx("button",{onClick:p=>{p.stopPropagation(),n(r.id)},className:"hidden group-hover:block shrink-0 p-0.5 text-[var(--text-muted)] hover:text-[var(--text-primary)]",title:"unpin",children:e.jsx(q,{className:"h-3 w-3"})}),e.jsx("button",{onClick:p=>{p.stopPropagation(),x(`/tasks/${r.id}`)},className:"hidden group-hover:block shrink-0 p-0.5 text-[var(--text-muted)] hover:text-[var(--accent)]",title:"open detail",children:e.jsx("span",{className:"text-[10px]",children:"→"})})]},r.id)})})]}),e.jsxs("div",{className:"flex flex-col md:hidden",children:[e.jsx("div",{className:"flex items-center gap-1 overflow-x-auto no-scrollbar border-b border-[var(--border)] bg-[var(--bg-card)] px-2",style:{height:44},children:s.length===0?e.jsx("div",{className:"flex items-center justify-center w-full",children:e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:"no active tasks"})}):s.map(r=>{const u=r.id===a;return e.jsxs("button",{onClick:()=>t(r.id),className:`flex shrink-0 items-center gap-1.5 px-3 border-b-2 transition-colors ${u?"border-[var(--accent)] text-[var(--text-primary)]":"border-transparent text-[var(--text-secondary)]"}`,style:{height:44},children:[e.jsx(W,{status:r.status,size:"sm"}),e.jsxs("span",{className:"text-[11px] whitespace-nowrap",children:["#",r.id]})]},r.id)})}),o]})]})}function we({task:s,takeoverState:a,onTakeover:t,onRelease:n}){const o=Q(s.status),x=a==="manual";return e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] bg-[var(--bg-card)] px-3",style:{height:36,minHeight:36},children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:s.projectKey}),e.jsx("span",{className:"text-[11px]",style:{color:o},children:s.status.toLowerCase()}),s.currentStage&&e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["// ",s.currentStage]})]}),e.jsx("div",{className:"flex items-center gap-1",children:!O.includes(s.status)&&(x?e.jsxs("button",{onClick:n,className:"flex items-center gap-1.5 rounded-[4px] px-2.5 py-0.5 text-[11px] font-medium text-[var(--accent)]",style:{backgroundColor:"rgba(34,197,94,0.12)"},children:[e.jsx(me,{className:"h-3 w-3"}),e.jsx("span",{className:"hidden md:inline",children:"restore auto"})]}):e.jsxs("button",{onClick:t,disabled:a==="requesting",className:"flex items-center gap-1.5 rounded-[4px] px-2.5 py-0.5 text-[11px] font-medium text-[var(--warning)] disabled:opacity-50",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:[e.jsx(oe,{className:"h-3 w-3"}),e.jsx("span",{className:"hidden md:inline",children:"take over"})]}))})]})}function Te({task:s,ptyStatus:a}){const t=a==="connected";return e.jsxs("div",{className:"flex items-center justify-between border-t border-[var(--border)] bg-[var(--bg-card)] px-3",style:{height:28,minHeight:28},children:[e.jsx("span",{className:"text-[10px] text-[var(--text-muted)]",children:s.currentStage?`stage: ${s.currentStage}`:`task #${s.id}`}),e.jsxs("span",{className:`flex items-center gap-1 text-[10px] ${t?"text-[var(--accent)]":"text-[var(--text-muted)]"}`,children:[t?e.jsx(pe,{className:"h-2.5 w-2.5"}):e.jsx(ve,{className:"h-2.5 w-2.5"}),t?"connected":a]})]})}function z({onboardingData:s}){const[a,t]=i.useState(!1),{t:n}=_();return s?a?e.jsxs("div",{className:"border-b border-[var(--accent)]/30",children:[e.jsxs("button",{onClick:()=>t(!1),className:"flex w-full items-center justify-between bg-[var(--bg-card)] px-3 py-1.5 transition-colors hover:bg-[var(--bg-input)]",children:[e.jsx("span",{className:"text-[11px] text-[var(--accent)]",children:n("onboarding.getting_started")}),e.jsx(he,{className:"h-3 w-3 text-[var(--text-muted)]"})]}),e.jsx("div",{className:"max-h-[300px] overflow-y-auto",children:e.jsx(J,{data:s})})]}):e.jsxs("button",{onClick:()=>t(!0),className:"flex w-full items-center justify-between border-b border-[var(--accent)]/30 bg-[var(--bg-card)] px-3 py-1.5 transition-colors hover:bg-[var(--bg-input)]",style:{height:36},children:[e.jsx("span",{className:"text-[11px] text-[var(--accent)]",children:n("onboarding.getting_started")}),e.jsx(xe,{className:"h-3 w-3 text-[var(--text-muted)]"})]}):null}function B({onboardingData:s}){const{t:a}=_();return e.jsx("div",{className:"flex flex-1 flex-col items-center justify-center p-6",children:s?e.jsx("div",{className:"w-full max-w-lg",children:e.jsx(J,{data:s})}):e.jsxs("div",{className:"text-center",children:[e.jsxs("div",{className:"mb-3 text-3xl text-[var(--border)]",children:[">","_"]}),e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:a("terminal_home.no_active_tasks")}),e.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:a("terminal_home.create_task_hint")})]})})}function $e(){const{t:s}=_(),{pinnedTaskIds:a,activeTaskId:t,taskMetas:n,stageConfirm:o,loading:x,setActiveTask:r,pinTask:u,unpinTask:p,loadActiveTasks:c,fetchStageConfirm:l,clearStageConfirm:f,updateTaskMeta:T}=be(),N=i.useRef(null),[b,S]=i.useState("disconnected"),[C,y]=i.useState("auto"),[j,h]=i.useState(""),g=$(d=>d.lastEvent),R=$(d=>d.status),m=t?n[t]??null:null,X=m?O.includes(m.status):!1,U=i.useRef(!1);i.useEffect(()=>{!U.current&&m&&(h(m.projectKey),U.current=!0)},[m]);const w=i.useMemo(()=>{const d=a.map(v=>n[v]).filter(Boolean);return j?d.filter(v=>v.projectKey===j):d},[a,n,j]);i.useEffect(()=>{w.length>0&&t&&!w.some(d=>d.id===t)&&r(w[0].id)},[w,t,r]);const E=je();re(m?`#${m.id} ${m.description}`:null),i.useEffect(()=>{c()},[c]),i.useEffect(()=>{t&&(m==null?void 0:m.status)===k.SUSPENDED?l(t):f()},[t,m==null?void 0:m.status,l,f]),i.useEffect(()=>{if(g){if(g.event==="task_status_changed"){const{taskId:d,status:v}=g;T(d,{status:v}),v===k.SUSPENDED&&d===t&&l(d),O.includes(v)&&d===t&&f()}g.event==="task_created"&&c()}},[g,t,l,f,T,c]),i.useEffect(()=>{if(R==="connected")return;const v=setInterval(()=>{document.visibilityState!=="hidden"&&c()},15e3);return()=>clearInterval(v)},[R,c]);const Z=i.useCallback(d=>{u(d),r(d),c()},[u,r,c]),ee=i.useCallback(()=>{f(),c()},[f,c]),te=i.useCallback(()=>{var d;(d=N.current)==null||d.requestTakeover()},[]),se=i.useCallback(()=>{var d;(d=N.current)==null||d.releaseTakeover()},[]);if(x&&a.length===0)return e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:s("common.loading")})});const ae=w.length>0;return e.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsx(Ne,{projectKey:j,onProjectChange:h,onCreated:Z}),e.jsx("div",{className:"flex flex-1 overflow-hidden",children:ae?e.jsxs(e.Fragment,{children:[e.jsx(ye,{tasks:w,activeId:t,onSelect:r,onUnpin:p,children:e.jsx("div",{className:"md:hidden",children:e.jsx(z,{onboardingData:E})})}),e.jsx("div",{className:"flex flex-1 flex-col overflow-hidden",children:m?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden md:block",children:e.jsx(z,{onboardingData:E})}),e.jsx(we,{task:m,takeoverState:C,onTakeover:te,onRelease:se}),o&&t&&e.jsx(ke,{taskId:t,confirm:o,onSubmitted:ee}),e.jsx("div",{className:"flex-1 min-h-[300px] overflow-hidden",children:e.jsx(le,{taskId:t,sessionId:m.currentSessionId??void 0,taskFinished:X,onStatusChange:S,onTakeoverChange:y,ref:N},t)}),e.jsx(Te,{task:m,ptyStatus:b})]}):e.jsx(B,{onboardingData:E})})]}):e.jsx(B,{onboardingData:E})})]})}export{$e as default};
@@ -1 +1 @@
1
- import{a as C,r as n,j as e,g as w,e as M,w as O,F as k,K as $,Q as T,s as K}from"./index-BLXQrTv9.js";import{K as E}from"./key-elqvuBzT.js";import{C as S}from"./copy-B1jQ4pbs.js";import{E as V}from"./external-link-BlAvfzj2.js";import{E as P}from"./EmptyState-C3yiKdL6.js";import{T as W}from"./Skeleton-B2I8dIUF.js";import{u as B}from"./useFetch-WwlQwbqf.js";import{e as R}from"./status-colors-CNClmRSt.js";import{P as J}from"./plus-NWcYLEIq.js";function z({isOpen:a,onClose:y,onCreated:b}){const{t:s}=C(),[r,c]=n.useState(""),[i,d]=n.useState(!1),[l,v]=n.useState("");function h(){c(""),v(""),y()}async function x(){if(v(""),!r.trim()){v(s("admin.pat_label_required"));return}try{d(!0);const o=await w.post("admin/worker-tokens",{json:{label:r.trim()}}).json();c(""),b({token:o.token,id:o.id})}catch(o){const m=o instanceof Error?o.message:s("admin.pat_failed_to_generate");v(m)}finally{d(!1)}}return a?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},onClick:o=>{o.target===o.currentTarget&&h()},children:e.jsxs("div",{className:"w-full border border-[var(--border)] bg-[var(--bg-card)]",style:{maxWidth:"480px",borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:[e.jsxs("div",{className:"flex items-center gap-2 border-b border-[var(--border)] px-5 py-4",children:[e.jsx(E,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:s("admin.generate_worker_token_title")})]}),e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[l&&e.jsx("div",{className:"border border-[var(--destructive)]/30 bg-[var(--destructive)]/10 px-3 py-2 text-xs text-[var(--destructive)]",style:{borderRadius:"4px"},children:l}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:s("admin.create_one_time_token")}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:s("admin.label")}),e.jsx("input",{type:"text",placeholder:s("admin.pat_label_placeholder"),value:r,onChange:o=>c(o.target.value),className:"w-full border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2 text-sm text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:border-[var(--accent)] focus:outline-none",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},onKeyDown:o=>{o.key==="Enter"&&x()}}),e.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:s("admin.label_identifies_worker")})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-[var(--border)] px-5 py-3",children:[e.jsx("button",{onClick:h,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:s("common.cancel")}),e.jsx("button",{onClick:x,disabled:i,className:"bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-black transition-opacity hover:opacity-80 disabled:opacity-50",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:s(i?"admin.generating":"admin.generate")})]})]})}):null}const X=3e3,q=600*1e3;function G({isOpen:a,token:y,tokenId:b,onClose:s}){const{t:r}=C(),[c,i]=n.useState("command"),[d,l]=n.useState(!1),[v,h]=n.useState(!1),[x,o]=n.useState(""),[m,g]=n.useState(null),p=n.useRef(void 0),N=n.useRef(Date.now()),_=M(),j=typeof window<"u"?window.location.origin:"https://overlord.example.com",t=`overlord setup worker --token ${y} --server ${j}`;async function D(){try{await navigator.clipboard.writeText(y),l(!0),setTimeout(()=>l(!1),2e3)}catch{}}async function L(){try{await navigator.clipboard.writeText(t),h(!0),setTimeout(()=>h(!1),2e3)}catch{}}const A=n.useCallback(async()=>{try{const f=await w.get(`admin/worker-tokens/${b}/status`).json();f.status==="used"&&f.worker_name&&(i("success"),o(f.worker_name),g(f.worker_id??null),p.current&&clearInterval(p.current))}catch{}Date.now()-N.current>q&&(i("timeout"),p.current&&clearInterval(p.current))},[b]);function F(){i("waiting"),N.current=Date.now(),p.current=setInterval(A,X)}n.useEffect(()=>()=>{p.current&&clearInterval(p.current)},[]);function I(){s(),m&&_(`/workers/${m}`)}if(!a)return null;const u={fontFamily:"'JetBrains Mono', monospace",borderRadius:"4px"};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},onClick:f=>{f.target===f.currentTarget&&s()},children:e.jsxs("div",{className:"w-full border border-[var(--border)] bg-[var(--bg-card)]",style:{...u,maxWidth:"480px"},children:[e.jsx("div",{className:"flex items-center gap-2 border-b border-[var(--border)] px-5 py-4",children:c==="success"?e.jsxs(e.Fragment,{children:[e.jsx(O,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:r("admin.worker_registered")})]}):e.jsxs(e.Fragment,{children:[e.jsx(E,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:r("admin.worker_token_generated")})]})}),e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[c!=="success"&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("admin.run_command_desc")}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[11px] text-[var(--text-muted)]",children:"Token"}),e.jsxs("div",{className:"relative border border-[var(--border)] bg-[var(--bg-card)] p-3",style:{borderRadius:"4px"},children:[e.jsx("code",{className:"block break-all pr-20 text-xs text-[var(--text-primary)]",children:y}),e.jsx("button",{onClick:D,className:"absolute right-2 top-2 flex items-center gap-1 border border-[var(--border)] bg-transparent px-2 py-1 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:u,children:d?e.jsx("span",{className:"text-[var(--accent)]",children:r("common.copied")}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(S,{className:"h-3 w-3"})," ",r("common.copy")]})})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[11px] text-[var(--text-muted)]",children:r("admin.setup_command")}),e.jsxs("div",{className:"relative border border-[var(--border)] bg-[var(--bg-card)] p-3",style:{borderRadius:"4px"},children:[e.jsxs("code",{className:"block break-all pr-20 text-xs text-[var(--accent)]",children:["$ ",t]}),e.jsx("button",{onClick:L,className:"absolute right-2 top-2 flex items-center gap-1 border border-[var(--border)] bg-transparent px-2 py-1 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:u,children:v?e.jsx("span",{className:"text-[var(--accent)]",children:r("common.copied")}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(S,{className:"h-3 w-3"})," ",r("common.copy")]})})]})]}),e.jsx("div",{className:"border border-yellow-500/30 bg-yellow-500/10 px-3 py-2 text-xs text-yellow-400",style:{borderRadius:"4px"},children:r("admin.token_shown_once")})]}),c==="waiting"&&e.jsxs("div",{className:"flex items-center gap-3 border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3",style:{borderRadius:"4px"},children:[e.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-[var(--accent)] border-t-transparent"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:r("admin.waiting_for_worker")})]}),c==="timeout"&&e.jsx("div",{className:"border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3 text-xs text-[var(--text-muted)]",style:{borderRadius:"4px"},children:r("admin.token_not_yet_used")}),c==="success"&&e.jsxs("div",{className:"border border-[var(--accent)]/30 bg-[var(--accent)]/10 px-4 py-3",style:{borderRadius:"4px"},children:[e.jsx("p",{className:"text-xs text-[var(--accent)]",children:r("admin.worker_registered_success")}),e.jsxs("p",{className:"mt-1 text-xs text-[var(--text-primary)]",children:[r("admin.worker"),": ",e.jsx("span",{className:"text-[var(--accent)]",children:x})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-[var(--border)] px-5 py-3",children:[c==="command"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:u,children:r("common.close")}),e.jsx("button",{onClick:F,className:"bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-black transition-opacity hover:opacity-80",style:u,children:r("admin.copied_wait_for_worker")})]}),c==="waiting"&&e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:u,children:r("admin.close_worker_can_register")}),c==="timeout"&&e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:u,children:r("common.close")}),c==="success"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:u,children:r("common.close")}),e.jsxs("button",{onClick:I,className:"flex items-center gap-1.5 bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-black transition-opacity hover:opacity-80",style:u,children:[e.jsx(V,{className:"h-3 w-3"}),r("admin.view_worker")]})]})]})]})})}function se(){const{t:a}=C(),[y,b]=n.useState(!1),[s,r]=n.useState(null),[c,i]=n.useState(!1),[d,l]=n.useState(null),[v,h]=n.useState(!1),[x,o]=n.useState(!1),{data:m,loading:g,refetch:p}=B(()=>w.get("admin/worker-tokens").json(),[]);async function N(){if(d){h(!0);try{await w.post(`admin/worker-tokens/${d.id}/revoke`),i(!1),l(null),p()}catch{}finally{h(!1)}}}function _(t){b(!1),r(t),p()}const j=n.useMemo(()=>(m??[]).filter(t=>x||t.status!==k.REVOKED),[m,x]);return e.jsxs("div",{className:"font-mono",children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:a("admin.tokens_title")}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:a("admin.tokens_subtitle")})]}),e.jsxs("button",{type:"button",className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity",onClick:()=>b(!0),children:[e.jsx(J,{className:"h-3.5 w-3.5"}),a("admin.generate_token")]})]}),!g&&(m==null?void 0:m.some(t=>t.status===k.REVOKED))&&e.jsx("div",{className:"mb-4 flex items-center gap-2",children:e.jsx("button",{type:"button",onClick:()=>o(!x),className:`text-xs transition-colors ${x?"text-[var(--text-primary)]":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:a(x?"admin.hide_revoked":"admin.show_revoked")})}),g?e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsx(W,{rows:3})}):j.length===0?e.jsx(P,{icon:$,title:a("admin.no_worker_tokens"),description:a("admin.generate_token_desc"),actionLabel:a("admin.generate_token"),onAction:()=>b(!0)}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden md:block overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] text-left text-[var(--text-muted)]",children:[e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.label")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.purpose")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.status")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("common.created_at")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.expires_at")}),e.jsx("th",{className:"pb-2 font-normal",children:a("common.actions")})]})}),e.jsx("tbody",{children:j.map(t=>e.jsxs("tr",{className:"border-b border-[var(--border-row)] hover:bg-white/[0.02] transition-colors",children:[e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-primary)]",children:t.label}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:t.purpose}),e.jsx("td",{className:"py-2.5 pr-4",children:e.jsx("span",{className:R(t.status),children:t.status})}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-muted)]",children:new Date(t.createdAt).toLocaleDateString()}),e.jsx("td",{className:"py-2.5 pr-4",children:t.expiresAt?e.jsx("span",{className:"text-[var(--text-secondary)]",children:new Date(t.expiresAt).toLocaleDateString()}):e.jsx("span",{className:"text-[var(--text-muted)]",children:"—"})}),e.jsx("td",{className:"py-2.5",children:t.status===k.ACTIVE&&e.jsxs("button",{type:"button",className:"flex items-center gap-1 rounded-[4px] px-2 py-1 text-red-400 hover:text-red-300 hover:bg-white/[0.05] transition-colors",onClick:()=>{l(t),i(!0)},children:[e.jsx(T,{className:"h-3.5 w-3.5"}),a("admin.revoke")]})})]},t.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3",children:j.map(t=>e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-xs text-[var(--text-primary)] font-medium truncate mr-2",children:t.label}),e.jsx("span",{className:`text-[11px] shrink-0 ${R(t.status)}`,children:t.status})]}),e.jsx("div",{className:"text-[11px] text-[var(--text-secondary)] truncate mb-1",children:t.purpose}),e.jsxs("div",{className:"flex items-center justify-between text-[11px] text-[var(--text-muted)]",children:[e.jsx("span",{children:new Date(t.createdAt).toLocaleDateString()}),t.expiresAt&&e.jsx("span",{children:new Date(t.expiresAt).toLocaleDateString()})]}),t.status===k.ACTIVE&&e.jsx("div",{className:"mt-2 pt-2 border-t border-[var(--border)]",children:e.jsxs("button",{type:"button",className:"flex items-center gap-1 rounded-[4px] px-2 py-1 text-[11px] text-red-400 hover:text-red-300 hover:bg-white/[0.05] transition-colors",onClick:()=>{l(t),i(!0)},children:[e.jsx(T,{className:"h-3.5 w-3.5"}),a("admin.revoke")]})})]},t.id))})]}),e.jsx(z,{isOpen:y,onClose:()=>b(!1),onCreated:_}),s&&e.jsx(G,{isOpen:!!s,token:s.token,tokenId:s.id,onClose:()=>r(null)}),e.jsx(K,{isOpen:c,onClose:()=>{i(!1),l(null)},onConfirm:N,title:a("admin.revoke_token"),message:a("admin.revoke_token_confirm",{label:(d==null?void 0:d.label)??""}),confirmLabel:a("admin.revoke"),confirmVariant:"danger",isLoading:v})]})}export{se as default};
1
+ import{a as C,r as n,j as e,g as w,e as M,w as O,F as k,K as $,Q as T,s as K}from"./index-6DyWlxlQ.js";import{K as E}from"./key-CeyMjwsm.js";import{C as S}from"./copy-WhOEX5ot.js";import{E as V}from"./external-link-Dmw_XJHJ.js";import{E as P}from"./EmptyState-UzC8uton.js";import{T as W}from"./Skeleton-BU6NxyrT.js";import{u as B}from"./useFetch-BqhQtTnS.js";import{e as R}from"./status-colors-BUgDdbGs.js";import{P as J}from"./plus-LcuKUlNK.js";function z({isOpen:a,onClose:y,onCreated:b}){const{t:s}=C(),[r,c]=n.useState(""),[i,d]=n.useState(!1),[l,v]=n.useState("");function h(){c(""),v(""),y()}async function x(){if(v(""),!r.trim()){v(s("admin.pat_label_required"));return}try{d(!0);const o=await w.post("admin/worker-tokens",{json:{label:r.trim()}}).json();c(""),b({token:o.token,id:o.id})}catch(o){const m=o instanceof Error?o.message:s("admin.pat_failed_to_generate");v(m)}finally{d(!1)}}return a?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},onClick:o=>{o.target===o.currentTarget&&h()},children:e.jsxs("div",{className:"w-full border border-[var(--border)] bg-[var(--bg-card)]",style:{maxWidth:"480px",borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:[e.jsxs("div",{className:"flex items-center gap-2 border-b border-[var(--border)] px-5 py-4",children:[e.jsx(E,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:s("admin.generate_worker_token_title")})]}),e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[l&&e.jsx("div",{className:"border border-[var(--destructive)]/30 bg-[var(--destructive)]/10 px-3 py-2 text-xs text-[var(--destructive)]",style:{borderRadius:"4px"},children:l}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:s("admin.create_one_time_token")}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:s("admin.label")}),e.jsx("input",{type:"text",placeholder:s("admin.pat_label_placeholder"),value:r,onChange:o=>c(o.target.value),className:"w-full border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2 text-sm text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:border-[var(--accent)] focus:outline-none",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},onKeyDown:o=>{o.key==="Enter"&&x()}}),e.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:s("admin.label_identifies_worker")})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-[var(--border)] px-5 py-3",children:[e.jsx("button",{onClick:h,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:s("common.cancel")}),e.jsx("button",{onClick:x,disabled:i,className:"bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-black transition-opacity hover:opacity-80 disabled:opacity-50",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:s(i?"admin.generating":"admin.generate")})]})]})}):null}const X=3e3,q=600*1e3;function G({isOpen:a,token:y,tokenId:b,onClose:s}){const{t:r}=C(),[c,i]=n.useState("command"),[d,l]=n.useState(!1),[v,h]=n.useState(!1),[x,o]=n.useState(""),[m,g]=n.useState(null),p=n.useRef(void 0),N=n.useRef(Date.now()),_=M(),j=typeof window<"u"?window.location.origin:"https://overlord.example.com",t=`overlord setup worker --token ${y} --server ${j}`;async function D(){try{await navigator.clipboard.writeText(y),l(!0),setTimeout(()=>l(!1),2e3)}catch{}}async function L(){try{await navigator.clipboard.writeText(t),h(!0),setTimeout(()=>h(!1),2e3)}catch{}}const A=n.useCallback(async()=>{try{const f=await w.get(`admin/worker-tokens/${b}/status`).json();f.status==="used"&&f.worker_name&&(i("success"),o(f.worker_name),g(f.worker_id??null),p.current&&clearInterval(p.current))}catch{}Date.now()-N.current>q&&(i("timeout"),p.current&&clearInterval(p.current))},[b]);function F(){i("waiting"),N.current=Date.now(),p.current=setInterval(A,X)}n.useEffect(()=>()=>{p.current&&clearInterval(p.current)},[]);function I(){s(),m&&_(`/workers/${m}`)}if(!a)return null;const u={fontFamily:"'JetBrains Mono', monospace",borderRadius:"4px"};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},onClick:f=>{f.target===f.currentTarget&&s()},children:e.jsxs("div",{className:"w-full border border-[var(--border)] bg-[var(--bg-card)]",style:{...u,maxWidth:"480px"},children:[e.jsx("div",{className:"flex items-center gap-2 border-b border-[var(--border)] px-5 py-4",children:c==="success"?e.jsxs(e.Fragment,{children:[e.jsx(O,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:r("admin.worker_registered")})]}):e.jsxs(e.Fragment,{children:[e.jsx(E,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:r("admin.worker_token_generated")})]})}),e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[c!=="success"&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("admin.run_command_desc")}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[11px] text-[var(--text-muted)]",children:"Token"}),e.jsxs("div",{className:"relative border border-[var(--border)] bg-[var(--bg-card)] p-3",style:{borderRadius:"4px"},children:[e.jsx("code",{className:"block break-all pr-20 text-xs text-[var(--text-primary)]",children:y}),e.jsx("button",{onClick:D,className:"absolute right-2 top-2 flex items-center gap-1 border border-[var(--border)] bg-transparent px-2 py-1 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:u,children:d?e.jsx("span",{className:"text-[var(--accent)]",children:r("common.copied")}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(S,{className:"h-3 w-3"})," ",r("common.copy")]})})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[11px] text-[var(--text-muted)]",children:r("admin.setup_command")}),e.jsxs("div",{className:"relative border border-[var(--border)] bg-[var(--bg-card)] p-3",style:{borderRadius:"4px"},children:[e.jsxs("code",{className:"block break-all pr-20 text-xs text-[var(--accent)]",children:["$ ",t]}),e.jsx("button",{onClick:L,className:"absolute right-2 top-2 flex items-center gap-1 border border-[var(--border)] bg-transparent px-2 py-1 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:u,children:v?e.jsx("span",{className:"text-[var(--accent)]",children:r("common.copied")}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(S,{className:"h-3 w-3"})," ",r("common.copy")]})})]})]}),e.jsx("div",{className:"border border-yellow-500/30 bg-yellow-500/10 px-3 py-2 text-xs text-yellow-400",style:{borderRadius:"4px"},children:r("admin.token_shown_once")})]}),c==="waiting"&&e.jsxs("div",{className:"flex items-center gap-3 border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3",style:{borderRadius:"4px"},children:[e.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-[var(--accent)] border-t-transparent"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:r("admin.waiting_for_worker")})]}),c==="timeout"&&e.jsx("div",{className:"border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3 text-xs text-[var(--text-muted)]",style:{borderRadius:"4px"},children:r("admin.token_not_yet_used")}),c==="success"&&e.jsxs("div",{className:"border border-[var(--accent)]/30 bg-[var(--accent)]/10 px-4 py-3",style:{borderRadius:"4px"},children:[e.jsx("p",{className:"text-xs text-[var(--accent)]",children:r("admin.worker_registered_success")}),e.jsxs("p",{className:"mt-1 text-xs text-[var(--text-primary)]",children:[r("admin.worker"),": ",e.jsx("span",{className:"text-[var(--accent)]",children:x})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-[var(--border)] px-5 py-3",children:[c==="command"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:u,children:r("common.close")}),e.jsx("button",{onClick:F,className:"bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-black transition-opacity hover:opacity-80",style:u,children:r("admin.copied_wait_for_worker")})]}),c==="waiting"&&e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:u,children:r("admin.close_worker_can_register")}),c==="timeout"&&e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:u,children:r("common.close")}),c==="success"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:u,children:r("common.close")}),e.jsxs("button",{onClick:I,className:"flex items-center gap-1.5 bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-black transition-opacity hover:opacity-80",style:u,children:[e.jsx(V,{className:"h-3 w-3"}),r("admin.view_worker")]})]})]})]})})}function se(){const{t:a}=C(),[y,b]=n.useState(!1),[s,r]=n.useState(null),[c,i]=n.useState(!1),[d,l]=n.useState(null),[v,h]=n.useState(!1),[x,o]=n.useState(!1),{data:m,loading:g,refetch:p}=B(()=>w.get("admin/worker-tokens").json(),[]);async function N(){if(d){h(!0);try{await w.post(`admin/worker-tokens/${d.id}/revoke`),i(!1),l(null),p()}catch{}finally{h(!1)}}}function _(t){b(!1),r(t),p()}const j=n.useMemo(()=>(m??[]).filter(t=>x||t.status!==k.REVOKED),[m,x]);return e.jsxs("div",{className:"font-mono",children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:a("admin.tokens_title")}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:a("admin.tokens_subtitle")})]}),e.jsxs("button",{type:"button",className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity",onClick:()=>b(!0),children:[e.jsx(J,{className:"h-3.5 w-3.5"}),a("admin.generate_token")]})]}),!g&&(m==null?void 0:m.some(t=>t.status===k.REVOKED))&&e.jsx("div",{className:"mb-4 flex items-center gap-2",children:e.jsx("button",{type:"button",onClick:()=>o(!x),className:`text-xs transition-colors ${x?"text-[var(--text-primary)]":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:a(x?"admin.hide_revoked":"admin.show_revoked")})}),g?e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsx(W,{rows:3})}):j.length===0?e.jsx(P,{icon:$,title:a("admin.no_worker_tokens"),description:a("admin.generate_token_desc"),actionLabel:a("admin.generate_token"),onAction:()=>b(!0)}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden md:block overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] text-left text-[var(--text-muted)]",children:[e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.label")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.purpose")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.status")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("common.created_at")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.expires_at")}),e.jsx("th",{className:"pb-2 font-normal",children:a("common.actions")})]})}),e.jsx("tbody",{children:j.map(t=>e.jsxs("tr",{className:"border-b border-[var(--border-row)] hover:bg-white/[0.02] transition-colors",children:[e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-primary)]",children:t.label}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:t.purpose}),e.jsx("td",{className:"py-2.5 pr-4",children:e.jsx("span",{className:R(t.status),children:t.status})}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-muted)]",children:new Date(t.createdAt).toLocaleDateString()}),e.jsx("td",{className:"py-2.5 pr-4",children:t.expiresAt?e.jsx("span",{className:"text-[var(--text-secondary)]",children:new Date(t.expiresAt).toLocaleDateString()}):e.jsx("span",{className:"text-[var(--text-muted)]",children:"—"})}),e.jsx("td",{className:"py-2.5",children:t.status===k.ACTIVE&&e.jsxs("button",{type:"button",className:"flex items-center gap-1 rounded-[4px] px-2 py-1 text-red-400 hover:text-red-300 hover:bg-white/[0.05] transition-colors",onClick:()=>{l(t),i(!0)},children:[e.jsx(T,{className:"h-3.5 w-3.5"}),a("admin.revoke")]})})]},t.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3",children:j.map(t=>e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-xs text-[var(--text-primary)] font-medium truncate mr-2",children:t.label}),e.jsx("span",{className:`text-[11px] shrink-0 ${R(t.status)}`,children:t.status})]}),e.jsx("div",{className:"text-[11px] text-[var(--text-secondary)] truncate mb-1",children:t.purpose}),e.jsxs("div",{className:"flex items-center justify-between text-[11px] text-[var(--text-muted)]",children:[e.jsx("span",{children:new Date(t.createdAt).toLocaleDateString()}),t.expiresAt&&e.jsx("span",{children:new Date(t.expiresAt).toLocaleDateString()})]}),t.status===k.ACTIVE&&e.jsx("div",{className:"mt-2 pt-2 border-t border-[var(--border)]",children:e.jsxs("button",{type:"button",className:"flex items-center gap-1 rounded-[4px] px-2 py-1 text-[11px] text-red-400 hover:text-red-300 hover:bg-white/[0.05] transition-colors",onClick:()=>{l(t),i(!0)},children:[e.jsx(T,{className:"h-3.5 w-3.5"}),a("admin.revoke")]})})]},t.id))})]}),e.jsx(z,{isOpen:y,onClose:()=>b(!1),onCreated:_}),s&&e.jsx(G,{isOpen:!!s,token:s.token,tokenId:s.id,onClose:()=>r(null)}),e.jsx(K,{isOpen:c,onClose:()=>{i(!1),l(null)},onConfirm:N,title:a("admin.revoke_token"),message:a("admin.revoke_token_confirm",{label:(d==null?void 0:d.label)??""}),confirmLabel:a("admin.revoke"),confirmVariant:"danger",isLoading:v})]})}export{se as default};
@@ -1,4 +1,4 @@
1
- import{R as A,f as he,e as fe,u as Y,a as me,r as _,j as M,g as W,t as ge}from"./index-BLXQrTv9.js";var pe=Object.defineProperty,j=Object.getOwnPropertySymbols,X=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable,V=(u,a,i)=>a in u?pe(u,a,{enumerable:!0,configurable:!0,writable:!0,value:i}):u[a]=i,k=(u,a)=>{for(var i in a||(a={}))X.call(a,i)&&V(u,i,a[i]);if(j)for(var i of j(a))K.call(a,i)&&V(u,i,a[i]);return u},U=(u,a)=>{var i={};for(var l in u)X.call(u,l)&&a.indexOf(l)<0&&(i[l]=u[l]);if(u!=null&&j)for(var l of j(u))a.indexOf(l)<0&&K.call(u,l)&&(i[l]=u[l]);return i};/**
1
+ import{R as A,f as he,e as fe,u as Y,a as me,r as _,j as M,g as W,t as ge}from"./index-6DyWlxlQ.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 u,j as e,s as O,v as W,e as G,r as m,u as H,n as P,W as c,D,L as R,x as S,g as h}from"./index-BLXQrTv9.js";import{t as V,b as $}from"./date-BdNtiQTP.js";import{w as z,b as B,t as q}from"./status-colors-CNClmRSt.js";import{I as i}from"./InfoRow-BzF-Ghcu.js";import{M as N}from"./MetricBar-BQkmuXAL.js";import{u as J}from"./useFetch-WwlQwbqf.js";import{T as I}from"./trash-2-YP06bYAN.js";import{A as K}from"./arrow-left-BhUPkdy5.js";function Q({isOpen:t,onClose:a,onConfirm:r,workerName:o,isDraining:l,loading:j}){const{t:d}=u();return e.jsx(O,{isOpen:t,onClose:a,onConfirm:r,title:d(l?"workers.undrain_worker_title":"workers.drain_worker_title"),message:l?d("workers.undrain_confirm",{name:o}):d("workers.drain_confirm",{name:o}),confirmLabel:d(l?"workers.undrain":"workers.drain"),confirmVariant:l?"accent":"warning",isLoading:j})}function ne(){const{id:t}=W(),a=G(),{t:r}=u(),[o,l]=m.useState(!1),[j,d]=m.useState(!1),[A,p]=m.useState(!1),[E,y]=m.useState(!1),w=H(n=>{var v;return(v=n.user)==null?void 0:v.role}),{data:x,loading:F,error:_,refetch:C}=J(async()=>{if(!t)throw new Error("Missing worker ID");const[n,v]=await Promise.all([h.get(`web/workers/${t}`).json(),h.get(`web/workers/${t}/tasks`).json().catch(()=>[])]);return{worker:n,tasks:v}},[t]),s=(x==null?void 0:x.worker)??null,g=(x==null?void 0:x.tasks)??[];P(m.useMemo(()=>!s||s.status===c.DECOMMISSIONED?null:e.jsxs("div",{className:"flex items-center gap-2",children:[s.status===c.ONLINE&&e.jsxs("button",{onClick:()=>l(!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")]}),w===D.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(I,{className:"h-3 w-3"}),r("workers.decommission")]})]}),[s,w,r]));async function T(){if(s){d(!0);try{const n=s.status===c.DRAINING?"undrain":"drain";await h.post(`web/workers/${s.id}/${n}`),await C()}catch{}finally{d(!1),l(!1)}}}async function U(){if(s){y(!0);try{await h.delete(`admin/workers/${s.id}`),a("/workers")}catch{}finally{y(!1),p(!1)}}}if(F)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(_)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:_}),e.jsx("button",{onClick:()=>C(),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:()=>a("/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 b=s.status===c.DRAINING,k=s.status!==c.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:()=>a("/workers"),className:"shrink-0 text-[var(--text-muted)]",children:e.jsx(K,{className:"h-4 w-4"})}),e.jsx("span",{className:"truncate text-sm font-medium text-[var(--text-primary)]",children:s.name})]}),!b&&s.status!==c.OFFLINE&&k&&e.jsxs("button",{onClick:()=>l(!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:[b?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(R,{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:[k&&e.jsxs("button",{onClick:()=>l(!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")]}),w===D.ADMIN&&k&&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(I,{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(S,{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-2 gap-4",children:[e.jsx(f,{label:r("workers.cpu"),value:s.cpuUsage,unit:"%"}),e.jsx(f,{label:r("workers.memory"),value:s.memoryUsage,unit:"%"}),e.jsx(f,{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:()=>a("/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:z[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:V(s.lastHeartbeat,"never")})}),s.status===c.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(S,{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 ${$(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(N,{label:r("workers.cpu"),value:s.cpuUsage}),e.jsx(N,{label:r("workers.mem"),value:s.memoryUsage}),e.jsx(N,{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(M,{worker:s})]})]})]}),b?e.jsxs(e.Fragment,{children:[e.jsx(L,{title:r("workers.active_tasks"),tasks:g,navigate:a}),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-2 gap-3 sm:grid-cols-3",children:s.capabilities.map(n=>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:n})},n))}):e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("workers.no_capabilities_short")})]}),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(M,{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(n=>e.jsx("span",{className:"rounded-[4px] border border-[var(--border)] px-2.5 py-1 text-xs text-[var(--text-secondary)]",children:n},n))})]}),e.jsx(L,{title:`${r("workers.current_tasks")} (${g.length})`,tasks:g,navigate:a})]})]})]}),e.jsx(Q,{isOpen:o,onClose:()=>l(!1),onConfirm:T,workerName:s.name,isDraining:b,loading:j}),e.jsx(O,{isOpen:A,onClose:()=>p(!1),onConfirm:U,title:r("workers.decommission_title"),message:r("workers.decommission_confirm",{name:s.name}),confirmLabel:r("workers.decommission"),confirmVariant:"danger",isLoading:E})]})}function M({worker:t,showExtended:a=!1}){const{t:r}=u();return e.jsxs("div",{className:"flex flex-col gap-2 text-xs",children:[e.jsx(i,{label:r("workers.worker_id"),value:t.id}),e.jsx(i,{label:r("workers.host"),value:t.host}),e.jsx(i,{label:r("workers.port"),value:String(t.port)}),e.jsx(i,{label:r("workers.os"),value:t.os??r("workers.unknown")}),e.jsx(i,{label:r("workers.cpu_model"),value:t.cpuModel??r("workers.n_a")}),e.jsx(i,{label:r("workers.cpu_cores"),value:t.cpuCores!=null?String(t.cpuCores):r("workers.n_a")}),e.jsx(i,{label:r("workers.memory"),value:t.memoryGb!=null?`${t.memoryGb} gb`:r("workers.n_a")}),e.jsx(i,{label:r("workers.last_heartbeat_label"),value:$(t.lastHeartbeat)}),e.jsx(i,{label:r("workers.slots"),value:`${t.activeSlots}/${t.maxSlots}`}),a&&e.jsxs(e.Fragment,{children:[e.jsx(i,{label:r("workers.status_label"),value:t.status.toLowerCase()}),e.jsx(i,{label:r("workers.worker_version"),value:t.workerVersion??r("workers.n_a")})]})]})}function L({title:t,tasks:a,navigate:r}){const{t:o}=u();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}),a.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-6",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:o("workers.no_active_tasks")})]}):e.jsx(X,{tasks:a,navigate:r})]})}function X({tasks:t,navigate:a}){const{t:r}=u();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:()=>a(`/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-xs truncate py-2 pr-4 text-[var(--text-secondary)]",children:o.description}),e.jsx("td",{className:"py-2 pr-4",children:e.jsxs("span",{style:{color:q[o.status]},children:["● ",o.status.toLowerCase()]})}),e.jsx("td",{className:"py-2 text-[var(--text-secondary)]",children:o.currentStage??"-"})]},o.id))})]})})}function f({label:t,value:a,unit:r}){const o=Math.round(a*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:B(a)}})})]})}export{ne as default};
1
+ import{a as u,j as e,s as O,v as W,e as G,r as m,u as H,n as P,W as c,D,L as R,x as S,g as h}from"./index-6DyWlxlQ.js";import{t as V,b as $}from"./date-BdNtiQTP.js";import{w as z,b as B,t as q}from"./status-colors-BUgDdbGs.js";import{I as i}from"./InfoRow-BxuuO5Qy.js";import{M as N}from"./MetricBar-CY4JXTL4.js";import{u as J}from"./useFetch-BqhQtTnS.js";import{T as I}from"./trash-2-CyrHY1x3.js";import{A as K}from"./arrow-left-C68Wmh7I.js";function Q({isOpen:t,onClose:a,onConfirm:r,workerName:o,isDraining:l,loading:j}){const{t:d}=u();return e.jsx(O,{isOpen:t,onClose:a,onConfirm:r,title:d(l?"workers.undrain_worker_title":"workers.drain_worker_title"),message:l?d("workers.undrain_confirm",{name:o}):d("workers.drain_confirm",{name:o}),confirmLabel:d(l?"workers.undrain":"workers.drain"),confirmVariant:l?"accent":"warning",isLoading:j})}function ne(){const{id:t}=W(),a=G(),{t:r}=u(),[o,l]=m.useState(!1),[j,d]=m.useState(!1),[A,p]=m.useState(!1),[E,y]=m.useState(!1),w=H(n=>{var v;return(v=n.user)==null?void 0:v.role}),{data:x,loading:F,error:_,refetch:C}=J(async()=>{if(!t)throw new Error("Missing worker ID");const[n,v]=await Promise.all([h.get(`web/workers/${t}`).json(),h.get(`web/workers/${t}/tasks`).json().catch(()=>[])]);return{worker:n,tasks:v}},[t]),s=(x==null?void 0:x.worker)??null,g=(x==null?void 0:x.tasks)??[];P(m.useMemo(()=>!s||s.status===c.DECOMMISSIONED?null:e.jsxs("div",{className:"flex items-center gap-2",children:[s.status===c.ONLINE&&e.jsxs("button",{onClick:()=>l(!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")]}),w===D.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(I,{className:"h-3 w-3"}),r("workers.decommission")]})]}),[s,w,r]));async function T(){if(s){d(!0);try{const n=s.status===c.DRAINING?"undrain":"drain";await h.post(`web/workers/${s.id}/${n}`),await C()}catch{}finally{d(!1),l(!1)}}}async function U(){if(s){y(!0);try{await h.delete(`admin/workers/${s.id}`),a("/workers")}catch{}finally{y(!1),p(!1)}}}if(F)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(_)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:_}),e.jsx("button",{onClick:()=>C(),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:()=>a("/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 b=s.status===c.DRAINING,k=s.status!==c.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:()=>a("/workers"),className:"shrink-0 text-[var(--text-muted)]",children:e.jsx(K,{className:"h-4 w-4"})}),e.jsx("span",{className:"truncate text-sm font-medium text-[var(--text-primary)]",children:s.name})]}),!b&&s.status!==c.OFFLINE&&k&&e.jsxs("button",{onClick:()=>l(!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:[b?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(R,{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:[k&&e.jsxs("button",{onClick:()=>l(!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")]}),w===D.ADMIN&&k&&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(I,{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(S,{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-2 gap-4",children:[e.jsx(f,{label:r("workers.cpu"),value:s.cpuUsage,unit:"%"}),e.jsx(f,{label:r("workers.memory"),value:s.memoryUsage,unit:"%"}),e.jsx(f,{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:()=>a("/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:z[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:V(s.lastHeartbeat,"never")})}),s.status===c.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(S,{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 ${$(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(N,{label:r("workers.cpu"),value:s.cpuUsage}),e.jsx(N,{label:r("workers.mem"),value:s.memoryUsage}),e.jsx(N,{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(M,{worker:s})]})]})]}),b?e.jsxs(e.Fragment,{children:[e.jsx(L,{title:r("workers.active_tasks"),tasks:g,navigate:a}),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-2 gap-3 sm:grid-cols-3",children:s.capabilities.map(n=>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:n})},n))}):e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("workers.no_capabilities_short")})]}),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(M,{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(n=>e.jsx("span",{className:"rounded-[4px] border border-[var(--border)] px-2.5 py-1 text-xs text-[var(--text-secondary)]",children:n},n))})]}),e.jsx(L,{title:`${r("workers.current_tasks")} (${g.length})`,tasks:g,navigate:a})]})]})]}),e.jsx(Q,{isOpen:o,onClose:()=>l(!1),onConfirm:T,workerName:s.name,isDraining:b,loading:j}),e.jsx(O,{isOpen:A,onClose:()=>p(!1),onConfirm:U,title:r("workers.decommission_title"),message:r("workers.decommission_confirm",{name:s.name}),confirmLabel:r("workers.decommission"),confirmVariant:"danger",isLoading:E})]})}function M({worker:t,showExtended:a=!1}){const{t:r}=u();return e.jsxs("div",{className:"flex flex-col gap-2 text-xs",children:[e.jsx(i,{label:r("workers.worker_id"),value:t.id}),e.jsx(i,{label:r("workers.host"),value:t.host}),e.jsx(i,{label:r("workers.port"),value:String(t.port)}),e.jsx(i,{label:r("workers.os"),value:t.os??r("workers.unknown")}),e.jsx(i,{label:r("workers.cpu_model"),value:t.cpuModel??r("workers.n_a")}),e.jsx(i,{label:r("workers.cpu_cores"),value:t.cpuCores!=null?String(t.cpuCores):r("workers.n_a")}),e.jsx(i,{label:r("workers.memory"),value:t.memoryGb!=null?`${t.memoryGb} gb`:r("workers.n_a")}),e.jsx(i,{label:r("workers.last_heartbeat_label"),value:$(t.lastHeartbeat)}),e.jsx(i,{label:r("workers.slots"),value:`${t.activeSlots}/${t.maxSlots}`}),a&&e.jsxs(e.Fragment,{children:[e.jsx(i,{label:r("workers.status_label"),value:t.status.toLowerCase()}),e.jsx(i,{label:r("workers.worker_version"),value:t.workerVersion??r("workers.n_a")})]})]})}function L({title:t,tasks:a,navigate:r}){const{t:o}=u();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}),a.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-6",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:o("workers.no_active_tasks")})]}):e.jsx(X,{tasks:a,navigate:r})]})}function X({tasks:t,navigate:a}){const{t:r}=u();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:()=>a(`/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-xs truncate py-2 pr-4 text-[var(--text-secondary)]",children:o.description}),e.jsx("td",{className:"py-2 pr-4",children:e.jsxs("span",{style:{color:q[o.status]},children:["● ",o.status.toLowerCase()]})}),e.jsx("td",{className:"py-2 text-[var(--text-secondary)]",children:o.currentStage??"-"})]},o.id))})]})})}function f({label:t,value:a,unit:r}){const o=Math.round(a*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:B(a)}})})]})}export{ne as default};
@@ -1 +1 @@
1
- import{R as G,a as S,j as e,r as a,g as _,X as U,w as K,e as q,u as H,W as N,n as X,D as J,S as L,B as Q}from"./index-BLXQrTv9.js";import{w as W}from"./status-colors-CNClmRSt.js";import{M as y}from"./MetricBar-BQkmuXAL.js";import V from"./WorkerSetupGuidePage-CisdSN3i.js";import{C as M}from"./copy-B1jQ4pbs.js";import{L as Y}from"./loader-circle-BRMYxZfv.js";import{S as Z}from"./Select-BmSEj4-2.js";import{E as ee}from"./EmptyState-C3yiKdL6.js";import{C as te}from"./Skeleton-B2I8dIUF.js";import{u as re}from"./useFetch-WwlQwbqf.js";import{P as se}from"./plus-NWcYLEIq.js";import"./key-elqvuBzT.js";import"./download-DJCYeset.js";import"./settings-Vg0cVhzJ.js";import"./wifi-D7sIQnh6.js";const ae=G.memo(function({worker:r,onClick:l}){const{t}=S();return e.jsxs("div",{onClick:l,className:`rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 font-mono lowercase transition-colors ${l?"cursor-pointer hover:border-[var(--accent)]/40 hover:bg-[var(--bg-input)]":""}`,children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsxs("h3",{className:"truncate text-sm text-[var(--text-primary)]",children:[e.jsx("span",{style:{color:W[r.status],fontSize:"0.6rem"},children:"●"})," ",r.name]}),e.jsx("span",{className:"text-xs",style:{color:W[r.status]},children:r.status})]}),e.jsxs("div",{className:"mb-3 text-xs text-[var(--text-muted)]",children:[r.host,r.os?`:${r.os}`:""]}),e.jsxs("div",{className:"mb-3 flex flex-col gap-2",children:[e.jsx(y,{label:t("workers.cpu"),value:r.cpuUsage,variant:"inline"}),e.jsx(y,{label:t("workers.mem"),value:r.memoryUsage,variant:"inline"}),e.jsx(y,{label:t("workers.disk"),value:r.diskUsage,variant:"inline"})]}),e.jsx("div",{className:"flex items-center justify-between text-xs",children:e.jsx("span",{className:"text-[var(--text-secondary)]",children:t("workers.tasks_slots",{active:String(r.activeSlots),max:String(r.maxSlots)})})}),r.capabilities.length>0&&e.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:r.capabilities.map(s=>e.jsx("span",{className:"rounded-[4px] border border-[var(--border)] px-1.5 py-0.5 text-[11px] text-[var(--text-muted)]",children:s},s))})]})});function oe({isOpen:d,onClose:r,onRegistered:l}){const{t}=S(),[s,c]=a.useState(1),[g,p]=a.useState(!1),[i,m]=a.useState(""),[u,b]=a.useState(null),[h,j]=a.useState(""),[o,v]=a.useState(""),[z,f]=a.useState(!1),[A,w]=a.useState(!1),[F,C]=a.useState(""),[T,I]=a.useState(""),x=a.useRef(null),P={1:t("workers.reg_step_generate_token"),2:t("workers.reg_step_install_worker"),3:t("workers.reg_step_waiting_activation"),4:t("workers.reg_step_activated")};a.useEffect(()=>(d&&(c(1),m(""),b(null),j(""),v(""),f(!1),w(!1),C(""),I(""),p(!1)),()=>{x.current&&clearInterval(x.current)}),[d]);const $=async()=>{const n=h.trim();if(!n){v(t("admin.pat_label_required"));return}v(""),p(!0);try{const k=await _.post("admin/worker-tokens",{json:{label:n}}).json();m(k.token),b(k.tokenId),c(2)}catch{}finally{p(!1)}},R=typeof window<"u"?window.location.origin:"https://overlord.example.com",E=i?`overlord setup worker --token ${i} --server ${R}`:"",D=()=>{navigator.clipboard.writeText(i),f(!0),setTimeout(()=>f(!1),2e3)},O=()=>{navigator.clipboard.writeText(E),w(!0),setTimeout(()=>w(!1),2e3)},B=a.useCallback(()=>{u&&(c(3),x.current=setInterval(async()=>{try{const n=await _.get(`admin/worker-tokens/${u}/status`).json();n.used&&n.workerName&&(C(n.workerName),I(n.workerId??""),c(4),x.current&&clearInterval(x.current),l==null||l())}catch{}},3e3))},[u,l]);return a.useEffect(()=>()=>{x.current&&clearInterval(x.current)},[]),d?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center font-mono lowercase",children:[e.jsx("div",{className:"absolute inset-0 bg-[var(--bg-primary)]/60 backdrop-blur-sm",onClick:r}),e.jsxs("div",{className:"relative z-10 w-full max-w-[1080px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-8",children:[e.jsx("button",{type:"button",onClick:r,className:"absolute right-4 top-4 text-[var(--text-muted)] hover:text-[var(--text-primary)]",children:e.jsx(U,{className:"h-4 w-4"})}),e.jsx("h2",{className:"text-lg font-bold text-[var(--accent)]",children:t("workers.reg_title")}),e.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:t("workers.reg_subtitle")}),e.jsx("div",{className:"mt-6 flex items-center justify-center gap-2",children:[1,2,3,4].map((n,k)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:`rounded-[4px] px-3 py-1.5 text-[11px] font-bold ${n===s?"bg-[var(--accent)] text-black":n<s?"bg-[var(--accent)]/20 text-[var(--accent)]":"border border-[var(--border)] bg-[var(--bg-primary)] text-[var(--text-muted)]"}`,children:[n,". ",P[n]]}),k<3&&e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"→"})]},n))}),e.jsxs("div",{className:"mt-6 grid grid-cols-1 gap-4 lg:grid-cols-2",children:[e.jsxs("div",{className:`rounded-[4px] border p-4 ${s===1?"border-[var(--accent)] bg-[var(--bg-primary)]":"border-[var(--border)] bg-[var(--bg-primary)]"}`,children:[e.jsxs("p",{className:"text-[13px] font-bold text-[var(--accent)]",children:["> ",t("workers.reg_step_generate_token")]}),s===1&&!i?e.jsxs("div",{className:"mt-3 space-y-3",children:[e.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:t("workers.reg_click_to_generate")}),o&&e.jsx("p",{className:"text-[11px] text-red-400",children:o}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-[11px] text-[var(--text-muted)]",children:t("admin.label")}),e.jsx("input",{type:"text",placeholder:t("admin.pat_label_placeholder"),value:h,onChange:n=>j(n.target.value),onKeyDown:n=>{n.key==="Enter"&&$()},className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-1.5 text-[11px] text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:border-[var(--accent)] focus:outline-none"})]}),e.jsx("button",{type:"button",onClick:$,disabled:g,className:"rounded-[4px] bg-[var(--accent)] px-4 py-1.5 text-xs font-bold text-black disabled:opacity-50",children:t(g?"admin.generating":"workers.reg_step_generate_token")})]}):i?e.jsxs("div",{className:"mt-3 space-y-3",children:[e.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:t("workers.reg_token_generated")}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[11px] text-[var(--text-muted)]",children:"Token"}),e.jsxs("div",{className:"relative rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] px-3 py-2 pr-16",children:[e.jsx("code",{className:"block break-all text-[11px] text-[var(--text-primary)]",children:i}),e.jsx("button",{type:"button",onClick:D,className:"absolute right-2 top-1.5 text-[11px] text-[var(--text-muted)] hover:text-[var(--text-primary)]",children:z?e.jsx("span",{className:"text-[var(--accent)]",children:t("common.copied")}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(M,{className:"h-3 w-3"})," ",t("common.copy")]})})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[11px] text-[var(--text-muted)]",children:t("admin.setup_command")}),e.jsxs("div",{className:"relative rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] px-3 py-2 pr-16",children:[e.jsxs("code",{className:"block break-all text-[11px] text-[var(--accent)]",children:["$ ",E]}),e.jsx("button",{type:"button",onClick:O,className:"absolute right-2 top-1.5 text-[11px] text-[var(--text-muted)] hover:text-[var(--text-primary)]",children:A?e.jsx("span",{className:"text-[var(--accent)]",children:t("common.copied")}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(M,{className:"h-3 w-3"})," ",t("common.copy")]})})]})]}),e.jsx("div",{className:"rounded-[4px] border border-yellow-500/30 bg-yellow-500/10 px-3 py-2 text-[11px] text-yellow-400",children:t("admin.token_shown_once")})]}):e.jsx("p",{className:"mt-2 text-[11px] text-[var(--text-muted)]",children:t("workers.reg_completed")})]}),e.jsxs("div",{className:`rounded-[4px] border p-4 ${s===2?"border-[var(--accent)] bg-[var(--bg-primary)]":"border-[var(--border)] bg-[var(--bg-primary)]"}`,children:[e.jsxs("p",{className:"text-[13px] font-bold text-[var(--text-primary)]",children:["> ",t("workers.reg_step_install_worker")]}),e.jsx("p",{className:"mt-2 text-[11px] text-[var(--text-muted)]",children:t("workers.reg_running_installation")}),s>=2&&e.jsxs("div",{className:"mt-3 space-y-1 rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] p-3",children:[e.jsx("p",{className:"text-[11px] text-[var(--text-primary)]",children:"$ overlord setup worker"}),e.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:"server url: https://..."}),e.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:"worker token: ovw_..."}),e.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:"worker name: my-worker"}),e.jsx("p",{className:"text-[11px] text-[var(--accent)]",children:"config written. starting worker..."}),s===2&&e.jsx("p",{className:"text-[11px] text-[var(--accent)] animate-pulse",children:"&block;"})]}),s===2&&e.jsx("button",{type:"button",onClick:B,className:"mt-3 rounded-[4px] bg-[var(--accent)] px-4 py-1.5 text-xs font-bold text-black",children:t("workers.reg_installed_wait")})]}),e.jsxs("div",{className:`rounded-[4px] border p-4 ${s===3?"border-amber-500 bg-[var(--bg-primary)]":"border-[var(--border)] bg-[var(--bg-primary)]"}`,children:[e.jsxs("p",{className:"text-[13px] font-bold text-[var(--text-primary)]",children:["> ",t("workers.reg_step_waiting_activation")]}),s>=3?e.jsx("div",{className:"mt-3 flex flex-col items-center justify-center gap-3 py-6",children:s===3?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full border-2 border-amber-500",children:e.jsx(Y,{className:"h-5 w-5 animate-spin text-amber-500"})}),e.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:t("workers.reg_listening_for_worker")})]}):e.jsx("p",{className:"text-[11px] text-[var(--accent)]",children:t("workers.reg_worker_connected")})}):e.jsx("p",{className:"mt-2 text-[11px] text-[var(--text-muted)]",children:t("workers.reg_waiting_for_worker")})]}),e.jsxs("div",{className:`rounded-[4px] border p-4 ${s===4?"border-[var(--accent)] bg-[var(--bg-primary)]":"border-[var(--border)] bg-[var(--bg-primary)]"}`,children:[e.jsxs("p",{className:"text-[13px] font-bold text-[var(--text-primary)]",children:["> ",t("workers.reg_step_activated")]}),s===4?e.jsxs("div",{className:"mt-3 flex flex-col items-center justify-center gap-3 py-6",children:[e.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-full bg-[var(--accent)]/20",children:e.jsx(K,{className:"h-6 w-6 text-[var(--accent)]"})}),e.jsx("p",{className:"text-xs font-bold text-[var(--accent)]",children:t("workers.reg_worker_activated",{name:F})}),T&&e.jsxs("p",{className:"text-[11px] text-[var(--text-muted)]",children:["worker_id: ",T]})]}):e.jsx("p",{className:"mt-2 text-[11px] text-[var(--text-muted)]",children:t("workers.reg_worker_registered")})]})]}),s===4&&e.jsx("div",{className:"mt-6 flex justify-end",children:e.jsx("button",{type:"button",onClick:r,className:"rounded-[4px] bg-[var(--accent)] px-5 py-2 text-xs font-bold text-black",children:t("workers.reg_done")})})]})]}):null}function fe(){const d=q(),{t:r}=S(),[l,t]=a.useState("all"),[s,c]=a.useState("fleet"),[g,p]=a.useState(!1),[i,m]=a.useState(0),u=H(o=>{var v;return(v=o.user)==null?void 0:v.role}),{data:b,loading:h}=re(()=>{const o={};return l!=="all"&&(o.status=l),_.get("web/workers",{searchParams:o}).json()},[l,i]),j=a.useMemo(()=>[{value:"all",label:r("workers.all_statuses")},{value:N.ONLINE,label:r("workers.online")},{value:N.OFFLINE,label:r("workers.offline")},{value:N.DRAINING,label:r("workers.draining")}],[r]);return X(a.useMemo(()=>u===J.ADMIN?e.jsxs("button",{type:"button",onClick:()=>p(!0),className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity",children:[e.jsx(se,{size:14}),r("workers.register_worker")]}):null,[u,r])),e.jsxs("div",{className:"mx-auto max-w-6xl px-4 md:px-6 py-8 font-mono lowercase",children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between border-b border-[var(--border)]",children:[e.jsxs("div",{className:"flex overflow-x-auto no-scrollbar",children:[e.jsxs("button",{type:"button",onClick:()=>{c("fleet"),m(o=>o+1)},className:`flex shrink-0 whitespace-nowrap items-center gap-2 px-4 py-2.5 text-xs transition-colors ${s==="fleet"?"border-b-2 border-[var(--accent)] text-[var(--text-primary)]":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:[e.jsx(L,{size:14}),r("workers.fleet")]}),e.jsxs("button",{type:"button",onClick:()=>c("setup_guide"),className:`flex shrink-0 whitespace-nowrap items-center gap-2 px-4 py-2.5 text-xs transition-colors ${s==="setup_guide"?"border-b-2 border-[var(--accent)] text-[var(--text-primary)]":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:[e.jsx(Q,{size:14}),r("workers.setup_guide")]})]}),s==="fleet"&&e.jsx(Z,{value:l,onChange:t,options:j})]}),s==="fleet"?h?e.jsx(te,{cards:6}):!b||b.length===0?e.jsx(ee,{icon:L,title:r("workers.no_workers_found"),description:r(l!=="all"?"workers.try_changing_status_filter":"workers.no_workers_registered"),action:e.jsx("button",{type:"button",onClick:()=>c("setup_guide"),className:"rounded-[4px] bg-[var(--accent)] px-5 py-2 text-[11px] font-bold text-black",children:r("workers.view_setup_guide")})}):e.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:(b??[]).map(o=>e.jsx(ae,{worker:o,onClick:()=>d(`/workers/${o.id}`)},o.id))}):e.jsx(V,{}),e.jsx(oe,{isOpen:g,onClose:()=>{p(!1),m(o=>o+1)},onRegistered:()=>{m(o=>o+1)}})]})}export{fe as default};
1
+ import{R as G,a as S,j as e,r as a,g as _,X as U,w as K,e as q,u as H,W as N,n as X,D as J,S as L,B as Q}from"./index-6DyWlxlQ.js";import{w as W}from"./status-colors-BUgDdbGs.js";import{M as y}from"./MetricBar-CY4JXTL4.js";import V from"./WorkerSetupGuidePage-BdhmSBuu.js";import{C as M}from"./copy-WhOEX5ot.js";import{L as Y}from"./loader-circle-BAcRWGK5.js";import{S as Z}from"./Select-BOHcpb-Z.js";import{E as ee}from"./EmptyState-UzC8uton.js";import{C as te}from"./Skeleton-BU6NxyrT.js";import{u as re}from"./useFetch-BqhQtTnS.js";import{P as se}from"./plus-LcuKUlNK.js";import"./key-CeyMjwsm.js";import"./download-Da942af8.js";import"./settings-Xi8Njbwg.js";import"./wifi-lkENCfkT.js";const ae=G.memo(function({worker:r,onClick:l}){const{t}=S();return e.jsxs("div",{onClick:l,className:`rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 font-mono lowercase transition-colors ${l?"cursor-pointer hover:border-[var(--accent)]/40 hover:bg-[var(--bg-input)]":""}`,children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsxs("h3",{className:"truncate text-sm text-[var(--text-primary)]",children:[e.jsx("span",{style:{color:W[r.status],fontSize:"0.6rem"},children:"●"})," ",r.name]}),e.jsx("span",{className:"text-xs",style:{color:W[r.status]},children:r.status})]}),e.jsxs("div",{className:"mb-3 text-xs text-[var(--text-muted)]",children:[r.host,r.os?`:${r.os}`:""]}),e.jsxs("div",{className:"mb-3 flex flex-col gap-2",children:[e.jsx(y,{label:t("workers.cpu"),value:r.cpuUsage,variant:"inline"}),e.jsx(y,{label:t("workers.mem"),value:r.memoryUsage,variant:"inline"}),e.jsx(y,{label:t("workers.disk"),value:r.diskUsage,variant:"inline"})]}),e.jsx("div",{className:"flex items-center justify-between text-xs",children:e.jsx("span",{className:"text-[var(--text-secondary)]",children:t("workers.tasks_slots",{active:String(r.activeSlots),max:String(r.maxSlots)})})}),r.capabilities.length>0&&e.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:r.capabilities.map(s=>e.jsx("span",{className:"rounded-[4px] border border-[var(--border)] px-1.5 py-0.5 text-[11px] text-[var(--text-muted)]",children:s},s))})]})});function oe({isOpen:d,onClose:r,onRegistered:l}){const{t}=S(),[s,c]=a.useState(1),[g,p]=a.useState(!1),[i,m]=a.useState(""),[u,b]=a.useState(null),[h,j]=a.useState(""),[o,v]=a.useState(""),[z,f]=a.useState(!1),[A,w]=a.useState(!1),[F,C]=a.useState(""),[T,I]=a.useState(""),x=a.useRef(null),P={1:t("workers.reg_step_generate_token"),2:t("workers.reg_step_install_worker"),3:t("workers.reg_step_waiting_activation"),4:t("workers.reg_step_activated")};a.useEffect(()=>(d&&(c(1),m(""),b(null),j(""),v(""),f(!1),w(!1),C(""),I(""),p(!1)),()=>{x.current&&clearInterval(x.current)}),[d]);const $=async()=>{const n=h.trim();if(!n){v(t("admin.pat_label_required"));return}v(""),p(!0);try{const k=await _.post("admin/worker-tokens",{json:{label:n}}).json();m(k.token),b(k.tokenId),c(2)}catch{}finally{p(!1)}},R=typeof window<"u"?window.location.origin:"https://overlord.example.com",E=i?`overlord setup worker --token ${i} --server ${R}`:"",D=()=>{navigator.clipboard.writeText(i),f(!0),setTimeout(()=>f(!1),2e3)},O=()=>{navigator.clipboard.writeText(E),w(!0),setTimeout(()=>w(!1),2e3)},B=a.useCallback(()=>{u&&(c(3),x.current=setInterval(async()=>{try{const n=await _.get(`admin/worker-tokens/${u}/status`).json();n.used&&n.workerName&&(C(n.workerName),I(n.workerId??""),c(4),x.current&&clearInterval(x.current),l==null||l())}catch{}},3e3))},[u,l]);return a.useEffect(()=>()=>{x.current&&clearInterval(x.current)},[]),d?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center font-mono lowercase",children:[e.jsx("div",{className:"absolute inset-0 bg-[var(--bg-primary)]/60 backdrop-blur-sm",onClick:r}),e.jsxs("div",{className:"relative z-10 w-full max-w-[1080px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-8",children:[e.jsx("button",{type:"button",onClick:r,className:"absolute right-4 top-4 text-[var(--text-muted)] hover:text-[var(--text-primary)]",children:e.jsx(U,{className:"h-4 w-4"})}),e.jsx("h2",{className:"text-lg font-bold text-[var(--accent)]",children:t("workers.reg_title")}),e.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:t("workers.reg_subtitle")}),e.jsx("div",{className:"mt-6 flex items-center justify-center gap-2",children:[1,2,3,4].map((n,k)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:`rounded-[4px] px-3 py-1.5 text-[11px] font-bold ${n===s?"bg-[var(--accent)] text-black":n<s?"bg-[var(--accent)]/20 text-[var(--accent)]":"border border-[var(--border)] bg-[var(--bg-primary)] text-[var(--text-muted)]"}`,children:[n,". ",P[n]]}),k<3&&e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"→"})]},n))}),e.jsxs("div",{className:"mt-6 grid grid-cols-1 gap-4 lg:grid-cols-2",children:[e.jsxs("div",{className:`rounded-[4px] border p-4 ${s===1?"border-[var(--accent)] bg-[var(--bg-primary)]":"border-[var(--border)] bg-[var(--bg-primary)]"}`,children:[e.jsxs("p",{className:"text-[13px] font-bold text-[var(--accent)]",children:["> ",t("workers.reg_step_generate_token")]}),s===1&&!i?e.jsxs("div",{className:"mt-3 space-y-3",children:[e.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:t("workers.reg_click_to_generate")}),o&&e.jsx("p",{className:"text-[11px] text-red-400",children:o}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-[11px] text-[var(--text-muted)]",children:t("admin.label")}),e.jsx("input",{type:"text",placeholder:t("admin.pat_label_placeholder"),value:h,onChange:n=>j(n.target.value),onKeyDown:n=>{n.key==="Enter"&&$()},className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-1.5 text-[11px] text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:border-[var(--accent)] focus:outline-none"})]}),e.jsx("button",{type:"button",onClick:$,disabled:g,className:"rounded-[4px] bg-[var(--accent)] px-4 py-1.5 text-xs font-bold text-black disabled:opacity-50",children:t(g?"admin.generating":"workers.reg_step_generate_token")})]}):i?e.jsxs("div",{className:"mt-3 space-y-3",children:[e.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:t("workers.reg_token_generated")}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[11px] text-[var(--text-muted)]",children:"Token"}),e.jsxs("div",{className:"relative rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] px-3 py-2 pr-16",children:[e.jsx("code",{className:"block break-all text-[11px] text-[var(--text-primary)]",children:i}),e.jsx("button",{type:"button",onClick:D,className:"absolute right-2 top-1.5 text-[11px] text-[var(--text-muted)] hover:text-[var(--text-primary)]",children:z?e.jsx("span",{className:"text-[var(--accent)]",children:t("common.copied")}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(M,{className:"h-3 w-3"})," ",t("common.copy")]})})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[11px] text-[var(--text-muted)]",children:t("admin.setup_command")}),e.jsxs("div",{className:"relative rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] px-3 py-2 pr-16",children:[e.jsxs("code",{className:"block break-all text-[11px] text-[var(--accent)]",children:["$ ",E]}),e.jsx("button",{type:"button",onClick:O,className:"absolute right-2 top-1.5 text-[11px] text-[var(--text-muted)] hover:text-[var(--text-primary)]",children:A?e.jsx("span",{className:"text-[var(--accent)]",children:t("common.copied")}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(M,{className:"h-3 w-3"})," ",t("common.copy")]})})]})]}),e.jsx("div",{className:"rounded-[4px] border border-yellow-500/30 bg-yellow-500/10 px-3 py-2 text-[11px] text-yellow-400",children:t("admin.token_shown_once")})]}):e.jsx("p",{className:"mt-2 text-[11px] text-[var(--text-muted)]",children:t("workers.reg_completed")})]}),e.jsxs("div",{className:`rounded-[4px] border p-4 ${s===2?"border-[var(--accent)] bg-[var(--bg-primary)]":"border-[var(--border)] bg-[var(--bg-primary)]"}`,children:[e.jsxs("p",{className:"text-[13px] font-bold text-[var(--text-primary)]",children:["> ",t("workers.reg_step_install_worker")]}),e.jsx("p",{className:"mt-2 text-[11px] text-[var(--text-muted)]",children:t("workers.reg_running_installation")}),s>=2&&e.jsxs("div",{className:"mt-3 space-y-1 rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] p-3",children:[e.jsx("p",{className:"text-[11px] text-[var(--text-primary)]",children:"$ overlord setup worker"}),e.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:"server url: https://..."}),e.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:"worker token: ovw_..."}),e.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:"worker name: my-worker"}),e.jsx("p",{className:"text-[11px] text-[var(--accent)]",children:"config written. starting worker..."}),s===2&&e.jsx("p",{className:"text-[11px] text-[var(--accent)] animate-pulse",children:"&block;"})]}),s===2&&e.jsx("button",{type:"button",onClick:B,className:"mt-3 rounded-[4px] bg-[var(--accent)] px-4 py-1.5 text-xs font-bold text-black",children:t("workers.reg_installed_wait")})]}),e.jsxs("div",{className:`rounded-[4px] border p-4 ${s===3?"border-amber-500 bg-[var(--bg-primary)]":"border-[var(--border)] bg-[var(--bg-primary)]"}`,children:[e.jsxs("p",{className:"text-[13px] font-bold text-[var(--text-primary)]",children:["> ",t("workers.reg_step_waiting_activation")]}),s>=3?e.jsx("div",{className:"mt-3 flex flex-col items-center justify-center gap-3 py-6",children:s===3?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full border-2 border-amber-500",children:e.jsx(Y,{className:"h-5 w-5 animate-spin text-amber-500"})}),e.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:t("workers.reg_listening_for_worker")})]}):e.jsx("p",{className:"text-[11px] text-[var(--accent)]",children:t("workers.reg_worker_connected")})}):e.jsx("p",{className:"mt-2 text-[11px] text-[var(--text-muted)]",children:t("workers.reg_waiting_for_worker")})]}),e.jsxs("div",{className:`rounded-[4px] border p-4 ${s===4?"border-[var(--accent)] bg-[var(--bg-primary)]":"border-[var(--border)] bg-[var(--bg-primary)]"}`,children:[e.jsxs("p",{className:"text-[13px] font-bold text-[var(--text-primary)]",children:["> ",t("workers.reg_step_activated")]}),s===4?e.jsxs("div",{className:"mt-3 flex flex-col items-center justify-center gap-3 py-6",children:[e.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-full bg-[var(--accent)]/20",children:e.jsx(K,{className:"h-6 w-6 text-[var(--accent)]"})}),e.jsx("p",{className:"text-xs font-bold text-[var(--accent)]",children:t("workers.reg_worker_activated",{name:F})}),T&&e.jsxs("p",{className:"text-[11px] text-[var(--text-muted)]",children:["worker_id: ",T]})]}):e.jsx("p",{className:"mt-2 text-[11px] text-[var(--text-muted)]",children:t("workers.reg_worker_registered")})]})]}),s===4&&e.jsx("div",{className:"mt-6 flex justify-end",children:e.jsx("button",{type:"button",onClick:r,className:"rounded-[4px] bg-[var(--accent)] px-5 py-2 text-xs font-bold text-black",children:t("workers.reg_done")})})]})]}):null}function fe(){const d=q(),{t:r}=S(),[l,t]=a.useState("all"),[s,c]=a.useState("fleet"),[g,p]=a.useState(!1),[i,m]=a.useState(0),u=H(o=>{var v;return(v=o.user)==null?void 0:v.role}),{data:b,loading:h}=re(()=>{const o={};return l!=="all"&&(o.status=l),_.get("web/workers",{searchParams:o}).json()},[l,i]),j=a.useMemo(()=>[{value:"all",label:r("workers.all_statuses")},{value:N.ONLINE,label:r("workers.online")},{value:N.OFFLINE,label:r("workers.offline")},{value:N.DRAINING,label:r("workers.draining")}],[r]);return X(a.useMemo(()=>u===J.ADMIN?e.jsxs("button",{type:"button",onClick:()=>p(!0),className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity",children:[e.jsx(se,{size:14}),r("workers.register_worker")]}):null,[u,r])),e.jsxs("div",{className:"mx-auto max-w-6xl px-4 md:px-6 py-8 font-mono lowercase",children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between border-b border-[var(--border)]",children:[e.jsxs("div",{className:"flex overflow-x-auto no-scrollbar",children:[e.jsxs("button",{type:"button",onClick:()=>{c("fleet"),m(o=>o+1)},className:`flex shrink-0 whitespace-nowrap items-center gap-2 px-4 py-2.5 text-xs transition-colors ${s==="fleet"?"border-b-2 border-[var(--accent)] text-[var(--text-primary)]":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:[e.jsx(L,{size:14}),r("workers.fleet")]}),e.jsxs("button",{type:"button",onClick:()=>c("setup_guide"),className:`flex shrink-0 whitespace-nowrap items-center gap-2 px-4 py-2.5 text-xs transition-colors ${s==="setup_guide"?"border-b-2 border-[var(--accent)] text-[var(--text-primary)]":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:[e.jsx(Q,{size:14}),r("workers.setup_guide")]})]}),s==="fleet"&&e.jsx(Z,{value:l,onChange:t,options:j})]}),s==="fleet"?h?e.jsx(te,{cards:6}):!b||b.length===0?e.jsx(ee,{icon:L,title:r("workers.no_workers_found"),description:r(l!=="all"?"workers.try_changing_status_filter":"workers.no_workers_registered"),action:e.jsx("button",{type:"button",onClick:()=>c("setup_guide"),className:"rounded-[4px] bg-[var(--accent)] px-5 py-2 text-[11px] font-bold text-black",children:r("workers.view_setup_guide")})}):e.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:(b??[]).map(o=>e.jsx(ae,{worker:o,onClick:()=>d(`/workers/${o.id}`)},o.id))}):e.jsx(V,{}),e.jsx(oe,{isOpen:g,onClose:()=>{p(!1),m(o=>o+1)},onRegistered:()=>{m(o=>o+1)}})]})}export{fe as default};