@overlordai/server 1.0.167 → 1.0.169
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/lark/lark.adapter.d.ts +2 -0
- package/dist/adapters/lark/lark.adapter.d.ts.map +1 -1
- package/dist/adapters/lark/lark.adapter.js +15 -7
- package/dist/adapters/lark/lark.adapter.js.map +1 -1
- package/dist/notifier/notification-consumer.d.ts.map +1 -1
- package/dist/notifier/notification-consumer.js +1 -2
- package/dist/notifier/notification-consumer.js.map +1 -1
- package/package.json +4 -4
- package/public/assets/{AccessTokensPage-DMNxwrg6.js → AccessTokensPage-De2uT9ah.js} +1 -1
- package/public/assets/{AdminPage-D78l3-js.js → AdminPage-d9p3EvHB.js} +1 -1
- package/public/assets/{AgentCliPage-CezoSx0e.js → AgentCliPage-Dti2jk_1.js} +1 -1
- package/public/assets/{ApiReferencePage-BfsTWFkC.js → ApiReferencePage-C_hlqZFG.js} +1 -1
- package/public/assets/{ArchitecturePage-DOZKFmLE.js → ArchitecturePage-BQHfhqc-.js} +1 -1
- package/public/assets/{AuditLogPage-A5UhPmS9.js → AuditLogPage-Bt6v_qaJ.js} +1 -1
- package/public/assets/{AutomationCreatePage-Cfx7p5ZH.js → AutomationCreatePage-CA3dyud9.js} +1 -1
- package/public/assets/{AutomationDetailPage-8_1UJCY4.js → AutomationDetailPage-DFTHkrf2.js} +1 -1
- package/public/assets/{AutomationEditPage-B12TprUz.js → AutomationEditPage-tJEqQhCA.js} +1 -1
- package/public/assets/{AutomationListPage-BKny7DqY.js → AutomationListPage-8hdao_IF.js} +1 -1
- package/public/assets/{AutomationRunDetailPage-C9R_iUPs.js → AutomationRunDetailPage-DkFCcDww.js} +1 -1
- package/public/assets/{BindPlatformPage-CkltaXIg.js → BindPlatformPage-ByHqfZwN.js} +1 -1
- package/public/assets/{BotIntegrationPage-CTA5m6EP.js → BotIntegrationPage-DM0k9qbh.js} +1 -1
- package/public/assets/{BotManage-CL-RMln2.js → BotManage-B3KCoFbR.js} +1 -1
- package/public/assets/{BotSetupPage-_LhptGZi.js → BotSetupPage-WqP34xa8.js} +1 -1
- package/public/assets/ChangelogPage-DarudsB7.js +1 -0
- package/public/assets/{Checkbox-BRhYFIpt.js → Checkbox-DAG7dCWP.js} +1 -1
- package/public/assets/{CliReferencePage-CgoqsHJ0.js → CliReferencePage-C0fMlW4Z.js} +1 -1
- package/public/assets/{ConfirmStageDialog-B2LeSdLq.js → ConfirmStageDialog-CeYHdsRO.js} +1 -1
- package/public/assets/{DeploymentPage-B3qn4jFe.js → DeploymentPage-B-o3zgwK.js} +1 -1
- package/public/assets/{DevWorkflowPage-j85BzszO.js → DevWorkflowPage-CPLjd_jV.js} +1 -1
- package/public/assets/{DeveloperManage-Dfr7kpLJ.js → DeveloperManage-7lKU6fez.js} +1 -1
- package/public/assets/{DeveloperSetupPage-wfMRR2Bh.js → DeveloperSetupPage-CSxz1zah.js} +1 -1
- package/public/assets/{DocsIndexPage-tVuRVdx8.js → DocsIndexPage-BHhbEOB4.js} +1 -1
- package/public/assets/{DocsLayout-YaVPoPRK.js → DocsLayout-0g-moqPG.js} +1 -1
- package/public/assets/{DocsPrimitives-jI8vuIJo.js → DocsPrimitives-SdmUr48p.js} +1 -1
- package/public/assets/{EditProjectPage-DgIEytli.js → EditProjectPage-BKrASpWT.js} +1 -1
- package/public/assets/{EmptyState-BeoDXDBu.js → EmptyState-DmUmVu70.js} +1 -1
- package/public/assets/{EnvVariablesPage-M5IQlnny.js → EnvVariablesPage-DKQO0DII.js} +1 -1
- package/public/assets/{HomePage-Dx9hOjD2.js → HomePage-BTVBzWV5.js} +1 -1
- package/public/assets/{InfoRow-CoZ0eUXB.js → InfoRow-DqaKPbde.js} +1 -1
- package/public/assets/{InstallationPage-CcM--D1m.js → InstallationPage-BIjigSZ9.js} +1 -1
- package/public/assets/{LandingPage-CeeUnHpJ.js → LandingPage-Dr6N4B7Y.js} +1 -1
- package/public/assets/{LocalDevelopmentPage-C6BkO_ZW.js → LocalDevelopmentPage-DJZ4e9ar.js} +1 -1
- package/public/assets/{LoginPage-Cn--ZHt7.js → LoginPage--soj1Lrf.js} +1 -1
- package/public/assets/{MetricBar-CUJBXzX_.js → MetricBar-D7sK0jEq.js} +1 -1
- package/public/assets/{MultiSelect-BTB7J2Fh.js → MultiSelect-BBx_-YvM.js} +1 -1
- package/public/assets/{NotFoundPage-D4Jjx8cv.js → NotFoundPage-LLf_UeAP.js} +1 -1
- package/public/assets/{OnboardingGuide-B7P5fbum.js → OnboardingGuide-B4YiVD6E.js} +1 -1
- package/public/assets/{PermissionsPage-DoWGhM4D.js → PermissionsPage-DUs4QRtf.js} +1 -1
- package/public/assets/{PipelineConfigPage-UJ3d8bcb.js → PipelineConfigPage-DwG3NqE4.js} +1 -1
- package/public/assets/{PipelineEditorPage-4gGeAv96.js → PipelineEditorPage-146q5sK_.js} +1 -1
- package/public/assets/{PlanPage-DHgYvGU4.js → PlanPage-dfuQHT3U.js} +1 -1
- package/public/assets/{ProfilePage-JE8g-TWb.js → ProfilePage-R6h5sb8u.js} +1 -1
- package/public/assets/{ProjectDetailPage-BrzNDku9.js → ProjectDetailPage-DOLId0Oy.js} +1 -1
- package/public/assets/{ProjectListPage-BiDWGA7h.js → ProjectListPage-C2C7mT_T.js} +1 -1
- package/public/assets/{PtyTerminal-DPQEhidb.js → PtyTerminal-hL02615j.js} +1 -1
- package/public/assets/{QuickAuth-CN9wyrop.js → QuickAuth-V9myhetN.js} +1 -1
- package/public/assets/{RemoveMemberConfirmDialog-CAXEaBZJ.js → RemoveMemberConfirmDialog-Cn40aMPG.js} +1 -1
- package/public/assets/{ReviewAggregatePage-Bm9h8tvr.js → ReviewAggregatePage-gYJ_Mv4n.js} +1 -1
- package/public/assets/{ReviewPage-o_8lWzwT.js → ReviewPage-ufYOfkKs.js} +1 -1
- package/public/assets/{Select-Be3Zm1p-.js → Select-D6BeX24N.js} +1 -1
- package/public/assets/{SettingsPage-ZCZCcjXt.js → SettingsPage-BGm7NJu2.js} +1 -1
- package/public/assets/{Skeleton-CjQusY7D.js → Skeleton-BbVk04Qq.js} +1 -1
- package/public/assets/{SkillPage-Ww2j12ta.js → SkillPage-DORSZ3jK.js} +1 -1
- package/public/assets/{TaskDetailPage-RMqXP-be.js → TaskDetailPage-CYcAcHW8.js} +1 -1
- package/public/assets/{TaskGuidePage-CAjjU0eV.js → TaskGuidePage-i8_yYM0J.js} +1 -1
- package/public/assets/{TaskListPage-BzaNnoxh.js → TaskListPage-DWVW2f3X.js} +1 -1
- package/public/assets/{TaskStatusBadge-BRKuMr4f.js → TaskStatusBadge-DPvH-r-e.js} +1 -1
- package/public/assets/{TerminalHomePage-BHuscc1u.js → TerminalHomePage-BAyBMhXX.js} +1 -1
- package/public/assets/{TokenManage-BGP3ybbu.js → TokenManage-CB6dNmg6.js} +1 -1
- package/public/assets/{Tooltip-DsPnaAbV.js → Tooltip-BqCa4MNE.js} +1 -1
- package/public/assets/{TotpSetupPage-DJyVfiCq.js → TotpSetupPage-BK5Obdmu.js} +1 -1
- package/public/assets/{WorkerDetailPage-wybcLkt5.js → WorkerDetailPage-uuue8wce.js} +1 -1
- package/public/assets/{WorkerListPage-CEAFlVpa.js → WorkerListPage-BmmiICx7.js} +1 -1
- package/public/assets/{WorkerOperationsPage-Hc6Lwise.js → WorkerOperationsPage-DJd9axlu.js} +1 -1
- package/public/assets/{WorkerSetupGuidePage-BNu6_nFD.js → WorkerSetupGuidePage-BzSnYeI8.js} +1 -1
- package/public/assets/{WorkerSetupPage-B6xufVUT.js → WorkerSetupPage-Cfxglyku.js} +1 -1
- package/public/assets/{agent-type-options-DL0KIlom.js → agent-type-options-BM8j4KsG.js} +1 -1
- package/public/assets/{arrow-left-BSsK0_W1.js → arrow-left-DqInn209.js} +1 -1
- package/public/assets/{arrow-right-CFrrGMm3.js → arrow-right-BZM9ZnGm.js} +1 -1
- package/public/assets/automationFindings-CL3x3xO6.js +2 -0
- package/public/assets/{bot-DvrRH6Q9.js → bot-CHY-wkGC.js} +1 -1
- package/public/assets/{chevron-down-DlZ2cTIM.js → chevron-down-D0oPuFDK.js} +1 -1
- package/public/assets/{chevron-left-CuehXDpM.js → chevron-left-BxCm1rXX.js} +1 -1
- package/public/assets/{chevron-right-DUzlRcbw.js → chevron-right-JjA_YKtJ.js} +1 -1
- package/public/assets/{chevron-up-DzAlvjTW.js → chevron-up-CGdyW-JD.js} +1 -1
- package/public/assets/{circle-alert-k-Pjv7DV.js → circle-alert-BhRzQtyf.js} +1 -1
- package/public/assets/{clock-Bo5XAR1L.js → clock-Dc4Net7w.js} +1 -1
- package/public/assets/{copy-DXs4V3c2.js → copy-CkRs-F8C.js} +1 -1
- package/public/assets/{download-Cdyv1KUo.js → download-C_PoVs7u.js} +1 -1
- package/public/assets/{external-link-DMd2RjTt.js → external-link-BpzOrxrN.js} +1 -1
- package/public/assets/{git-fork-CIQLHrI4.js → git-fork-HJn7Wwfe.js} +1 -1
- package/public/assets/{index-Bgvmej4n.js → index-CzELujVH.js} +2 -2
- package/public/assets/{key-d4PGJDNU.js → key-Bp8O_2z-.js} +1 -1
- package/public/assets/{loader-circle-3UzozktT.js → loader-circle-Br3SI9uE.js} +1 -1
- package/public/assets/{pencil-46yJkhDp.js → pencil-dU9vAe_n.js} +1 -1
- package/public/assets/{play-qKW2SRs-.js → play-CZuNsRe4.js} +1 -1
- package/public/assets/{plus-xtTdDSWw.js → plus-BgYYBOLc.js} +1 -1
- package/public/assets/{rotate-ccw-BeweZwVM.js → rotate-ccw-nf3pbt98.js} +1 -1
- package/public/assets/{scroll-text-DKsahVHO.js → scroll-text-CREnPb7c.js} +1 -1
- package/public/assets/{settings-Cy-lOHTo.js → settings-C7JWuRQX.js} +1 -1
- package/public/assets/{skip-forward-XDL9bikk.js → skip-forward-CKtB9GYx.js} +1 -1
- package/public/assets/{status-colors-DFKrrbb3.js → status-colors-cjNKu-0M.js} +1 -1
- package/public/assets/{task-agent-CGHmImi1.js → task-agent-BAyqw2LQ.js} +1 -1
- package/public/assets/{task-constants-BRbcHP6G.js → task-constants-DF5WSAah.js} +1 -1
- package/public/assets/{task.store-CXBqDJ4r.js → task.store-BQKU9waM.js} +1 -1
- package/public/assets/{timer-BoGgzlud.js → timer-gaBA8eys.js} +1 -1
- package/public/assets/{trash-2-xUbm8lqm.js → trash-2-Cah2gSau.js} +1 -1
- package/public/assets/{useFetch-BNnhvwY-.js → useFetch-DOTFwxss.js} +1 -1
- package/public/assets/{users-FV98q18Y.js → users-D46z6XlY.js} +1 -1
- package/public/assets/{wifi-COuU7uV0.js → wifi-13RzCkO8.js} +1 -1
- package/public/assets/{workflow-CcwLflWQ.js → workflow-DPz-cT0Q.js} +1 -1
- package/public/assets/{zap-j68I8HKG.js → zap-Dh-gEYCZ.js} +1 -1
- package/public/index.html +1 -1
- package/public/sw.js +1 -1
- package/public/assets/ChangelogPage-NmGWtY1U.js +0 -1
- package/public/assets/automationFindings-CnN7yNaM.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as w,f as k,k as K,r,x as F,j as e,h as N,o as m,E,l as B,X as T,H,t as y,Q}from"./index-Bgvmej4n.js";import{E as D}from"./EmptyState-BeoDXDBu.js";import{T as L}from"./Skeleton-CjQusY7D.js";import{C as q}from"./Checkbox-BRhYFIpt.js";import{S as C}from"./Select-Be3Zm1p-.js";import{f as P}from"./date-CmcdoD87.js";import{T as A}from"./Tooltip-DsPnaAbV.js";import{a as z}from"./agent-type-options-DL0KIlom.js";import{g as X}from"./task-constants-BRbcHP6G.js";import{P as Z}from"./plus-xtTdDSWw.js";import{P as R}from"./play-qKW2SRs-.js";import{C as J}from"./chevron-left-CuehXDpM.js";import{C as V}from"./chevron-right-DUzlRcbw.js";import"./chevron-down-DlZ2cTIM.js";function $(){const[s,i]=r.useState(void 0),[t,o]=r.useState(void 0),[p,c]=r.useState([]),h=r.useRef(void 0),u=r.useRef(void 0);h.current=s,u.current=t;const g=r.useCallback(x=>{i(x)},[]),l=r.useCallback(()=>{const x=h.current;x&&(c(j=>[...j,u.current??""]),o(x))},[]),b=r.useRef([]);b.current=p;const d=r.useCallback(()=>{const x=b.current;x.length!==0&&(o(x.at(-1)||void 0),c(x.slice(0,-1)))},[]),a=p.length+1,n=p.length>0;return{cursor:t,setNextCursor:g,goNext:l,goPrev:d,pageNumber:a,hasPrev:n,hasNext:!!s}}const I=20;function W(s){switch(s){case m.RUNNING:return"bg-[var(--accent)]";case m.QUEUED:return"bg-[var(--warning)]";case m.ASSIGNED:return"bg-[var(--info)]";case m.SUSPENDED:return"bg-[var(--warning)]";case m.COMPLETED:return"bg-[var(--accent)]";case m.FAILED:return"bg-[var(--destructive)]";case m.CANCELLED:return"bg-[#525252]";default:return"bg-[#525252]"}}const Y=z(X);function ee({taskId:s,onClose:i,onLaunched:t}){const{t:o}=w(),[p,c]=r.useState([Q.CLAUDE]),[h,u]=r.useState(""),[g,l]=r.useState(!1);function b(a){c(n=>n.includes(a)?n.filter(f=>f!==a):[...n,a])}async function d(){if(p.length===0){y.error("select at least one review agent.");return}l(!0);try{await N.post(`web/tasks/${s}/review`,{json:{agentTypes:p,description:h.trim()||void 0}}),y.success("review launched"),t(),i()}catch(a){const n=a instanceof Error?a.message:String(a);y.error(n)}finally{l(!1)}}return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",children:e.jsxs("div",{className:"w-full max-w-sm rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5 font-mono",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-bold text-[var(--text-primary)]",children:o("review.launch")}),e.jsx("button",{onClick:i,className:"text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:e.jsx(T,{className:"h-4 w-4"})})]}),e.jsxs("p",{className:"mb-3 text-[11px] text-[var(--text-muted)]",children:["task #",s," — ",o("review.select_agents")]}),e.jsx("div",{className:"mb-4 flex flex-col gap-2",children:Y.map(a=>e.jsx(q,{checked:p.includes(a.value),onCheckedChange:()=>b(a.value),label:a.label,containerClassName:"w-full gap-2.5 rounded-[4px] border border-[var(--border)] px-3 py-2 hover:bg-[var(--bg-input)] transition-colors"},a.value))}),e.jsx("textarea",{value:h,onChange:a=>u(a.target.value),placeholder:o("review.description_placeholder"),rows:3,className:"mb-4 w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)] resize-none"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:d,disabled:g||p.length===0,className:"flex flex-1 items-center justify-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs font-bold text-black disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(R,{className:"h-3 w-3"}),o(g?"common.processing":"review.launch")]}),e.jsx("button",{onClick:i,className:"rounded-[4px] border border-[var(--border)] px-4 py-2 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:o("common.cancel")})]})]})})}function _({pag:s}){const{t:i}=w();return!s.hasPrev&&!s.hasNext?null:e.jsxs("div",{className:"mt-6 flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["// page ",s.pageNumber]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:s.goPrev,disabled:!s.hasPrev,className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:border-[var(--accent)] disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:[e.jsx(J,{className:"h-3.5 w-3.5"}),i("tasks.prev")]}),e.jsxs("button",{onClick:s.goNext,disabled:!s.hasNext,className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:border-[var(--accent)] disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:[i("common.next"),e.jsx(V,{className:"h-3.5 w-3.5"})]})]})]})}function se({onRefresh:s,projectFilter:i,developerFilter:t}){const{t:o}=w(),p=k(),[c,h]=r.useState([]),[u,g]=r.useState(!0),[l,b]=r.useState(null),d=$(),a=r.useCallback(async n=>{g(!0);try{const f=new Date(Date.now()-6048e5).toISOString(),x=new URLSearchParams({status:m.COMPLETED,taskMode:"develop",reviewStatus:"null",completedAfter:f,limit:String(I)});i&&x.set("projectKey",i),t&&x.set("developerId",t),n&&x.set("cursor",n);const j=await N.get(`web/tasks?${x}`).json();h(j.data??[]),d.setNextCursor(j.nextCursor)}catch{h([]),d.setNextCursor(void 0)}finally{g(!1)}},[i,t]);return r.useEffect(()=>{a(d.cursor)},[a,d.cursor]),u&&c.length===0?e.jsx("div",{className:"p-4",children:e.jsx(L,{rows:4})}):!u&&c.length===0&&!d.hasPrev?e.jsx(D,{icon:E,title:o("review.no_reviews"),description:o("review.pending")}):e.jsxs(e.Fragment,{children:[c.length>0&&e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:c.map(n=>e.jsxs("div",{className:"flex flex-col gap-1 border-b border-[var(--border)] px-4 py-3 last:border-b-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full bg-[var(--accent)]"}),e.jsx(A,{content:n.description,className:"flex-1 min-w-0",children:e.jsxs("span",{className:"cursor-pointer truncate text-xs text-[var(--text-primary)] hover:text-[var(--accent)] transition-colors block preserve-case",onClick:()=>p(`/tasks/${n.id}`),children:["#",n.id," ",B(n)]})}),e.jsx("button",{onClick:async()=>{try{await N.post(`web/tasks/${n.id}/review-status`,{json:{reviewStatus:"dismissed"}}),a(d.cursor)}catch(f){let x="Failed to dismiss";try{if(f instanceof H){const j=await f.response.json();x=(j==null?void 0:j.message)??x}else f instanceof Error&&(x=f.message)}catch{}y.error(x)}},className:"shrink-0 flex items-center rounded-[4px] p-1.5 text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors","aria-label":"dismiss",children:e.jsx(T,{className:"h-3.5 w-3.5"})}),e.jsxs("button",{onClick:()=>b(n.id),className:"shrink-0 flex items-center gap-1.5 rounded-[4px] px-3 py-1.5 text-[11px] font-medium text-[var(--accent)]",style:{backgroundColor:"rgba(34,197,94,0.12)"},children:[e.jsx(R,{className:"h-3 w-3"}),e.jsx("span",{className:"hidden md:inline",children:o("review.launch_short")})]})]}),e.jsxs("div",{className:"flex items-center gap-2 pl-5 text-[11px] text-[var(--text-muted)] min-w-0",children:[e.jsx("span",{className:"shrink-0",children:P(n.completedAt??n.createdAt)}),e.jsx("span",{className:"shrink-0",children:"·"}),e.jsx("span",{className:"shrink-0",children:n.projectKey}),n.workerName&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"shrink-0",children:"·"}),e.jsx("span",{className:"truncate",children:n.workerName})]})]})]},n.id))}),e.jsx(_,{pag:d}),l!==null&&e.jsx(ee,{taskId:l,onClose:()=>b(null),onLaunched:()=>{s(),a(d.cursor)}})]})}function te(s){const i=new Map;for(const t of s){const o=t.sourceTaskId??t.id;i.has(o)||i.set(o,[]),i.get(o).push(t)}return Array.from(i.entries()).map(([t,o])=>({sourceTaskId:t,tasks:o}))}function re({group:s,onClick:i}){const t=s.tasks[0],o=s.tasks.every(c=>c.status===m.COMPLETED||c.status===m.FAILED||c.status===m.CANCELLED),p=t==null?void 0:t.sourceCommitSha;return e.jsxs("div",{onClick:i,className:"flex cursor-pointer items-center gap-3 border-b border-[var(--border)] px-4 py-3 last:border-b-0 hover:bg-[var(--bg-input)] transition-colors",children:[e.jsx("span",{className:`h-2 w-2 shrink-0 rounded-full ${o?"bg-[var(--accent)]":"bg-[var(--warning)]"}`}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx(A,{content:(t==null?void 0:t.sourceTaskDescription)??(t==null?void 0:t.description),className:"truncate",children:e.jsxs("span",{className:"truncate text-xs text-[var(--text-primary)]",children:["source #",s.sourceTaskId]})}),p&&e.jsxs("span",{className:"shrink-0 font-mono text-[11px] text-[var(--accent)]",children:["@",p.slice(0,7)]})]}),e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:[s.tasks.length," ",s.tasks.length===1?"agent":"agents"," · ",s.tasks.map(c=>(c.agentType??"claude").toLowerCase()).join(", ")]})]}),t&&e.jsx("span",{className:"shrink-0 rounded-[4px] border border-[var(--border)] px-2 py-0.5 text-[11px] text-[var(--text-muted)]",children:t.projectKey}),t&&e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:P(t.createdAt)}),e.jsx("div",{className:"flex shrink-0 items-center gap-1",children:s.tasks.map(c=>e.jsx("span",{className:`h-2 w-2 rounded-full ${W(c.status)}`,title:c.status.toLowerCase()},c.id))})]})}function S({mode:s,projectFilter:i,developerFilter:t}){const{t:o}=w(),p=k(),[c,h]=r.useState([]),[u,g]=r.useState(!0),l=$(),b=r.useCallback(async d=>{g(!0);try{const a=new URLSearchParams({taskMode:"review",limit:String(I),groupBySource:"true"});s==="in_progress"?a.set("status",[m.QUEUED,m.ASSIGNED,m.RUNNING,m.SUSPENDED].join(",")):a.set("status",[m.COMPLETED,m.FAILED,m.CANCELLED].join(",")),i&&a.set("projectKey",i),t&&a.set("sourceDeveloperId",t),d&&a.set("cursor",d);const n=await N.get(`web/tasks?${a}`).json();h(te(n.data??[])),l.setNextCursor(n.nextCursor??void 0)}catch{h([]),l.setNextCursor(void 0)}finally{g(!1)}},[s,i,t]);return r.useEffect(()=>{b(l.cursor)},[b,l.cursor]),u&&c.length===0?e.jsx("div",{className:"p-4",children:e.jsx(L,{rows:4})}):!u&&c.length===0&&!l.hasPrev?e.jsx(D,{icon:E,title:o("review.no_reviews")}):e.jsxs(e.Fragment,{children:[c.length>0&&e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:c.map(d=>e.jsx(re,{group:d,onClick:()=>p(`/review/${d.sourceTaskId}`)},d.sourceTaskId))}),e.jsx(_,{pag:l})]})}function fe(){const{t:s}=w(),i=k(),t=K(v=>v.taskSeq),[o,p]=r.useState("pending"),[c,h]=r.useState(0),[u,g]=r.useState(""),[l,b]=r.useState(""),[d,a]=r.useState([]),[n,f]=r.useState([]);F(null);const x=r.useCallback(()=>h(v=>v+1),[]);r.useEffect(()=>{let v=!1;return(async()=>{try{const[M,G]=await Promise.all([N.get("web/projects").json(),N.get("web/projects/-/developers").json()]);if(v)return;a(M),f(G)}catch{}})(),()=>{v=!0}},[]);const j=r.useMemo(()=>[{value:"",label:s("tasks.filter_project")},...d.map(v=>({value:v.key,label:v.name}))],[d,s]),O=r.useMemo(()=>[{value:"",label:s("tasks.filter_developer")},...n.map(v=>({value:String(v.id),label:v.name}))],[n,s]),U=[{key:"pending",label:s("review.pending")},{key:"in_progress",label:s("review.in_progress")},{key:"history",label:s("review.history")}];return e.jsxs("div",{className:"mx-auto max-w-6xl px-2 py-4 md:px-4 md:py-6 font-mono",children:[e.jsx("h1",{className:"sr-only",children:s("review.title")}),e.jsxs("div",{className:"mb-4 flex flex-col gap-3 md:gap-4 md:flex-row md:items-center",children:[e.jsxs("div",{className:"flex items-center gap-1 overflow-x-auto pb-1 md:pb-0 no-scrollbar",children:[U.map(v=>e.jsx("button",{onClick:()=>p(v.key),className:`shrink-0 rounded-[4px] px-3 py-2 h-8 text-xs transition-colors ${o===v.key?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)] bg-[var(--bg-card)] hover:text-[var(--text-secondary)]"}`,children:v.label},v.key)),e.jsxs("button",{onClick:()=>i("/plan"),className:"shrink-0 flex items-center gap-1 rounded-[4px] px-3 py-2 h-8 text-xs text-[var(--text-muted)] hover:text-[var(--accent)] transition-colors",children:[e.jsx(Z,{className:"h-3 w-3"}),s("plan.title")]})]}),e.jsxs("div",{className:"flex flex-col gap-2 md:ml-auto md:flex-row md:items-center",children:[e.jsx(C,{value:u,onChange:g,options:j,className:"md:w-40"}),e.jsx(C,{value:l,onChange:b,options:O,className:"md:w-40"})]})]}),o==="pending"&&e.jsx(se,{onRefresh:x,projectFilter:u,developerFilter:l},`pending-${c}-${t}-${u}-${l}`),o==="in_progress"&&e.jsx(S,{mode:"in_progress",projectFilter:u,developerFilter:l},`inprogress-${c}-${t}-${u}-${l}`),o==="history"&&e.jsx(S,{mode:"history",projectFilter:u,developerFilter:l},`history-${c}-${t}-${u}-${l}`)]})}export{fe as default};
|
|
1
|
+
import{a as w,f as k,k as K,r,x as F,j as e,h as N,o as m,E,l as B,X as T,H,t as y,Q}from"./index-CzELujVH.js";import{E as D}from"./EmptyState-DmUmVu70.js";import{T as L}from"./Skeleton-BbVk04Qq.js";import{C as q}from"./Checkbox-DAG7dCWP.js";import{S as C}from"./Select-D6BeX24N.js";import{f as P}from"./date-CmcdoD87.js";import{T as A}from"./Tooltip-BqCa4MNE.js";import{a as z}from"./agent-type-options-BM8j4KsG.js";import{g as X}from"./task-constants-DF5WSAah.js";import{P as Z}from"./plus-BgYYBOLc.js";import{P as R}from"./play-CZuNsRe4.js";import{C as J}from"./chevron-left-BxCm1rXX.js";import{C as V}from"./chevron-right-JjA_YKtJ.js";import"./chevron-down-D0oPuFDK.js";function $(){const[s,i]=r.useState(void 0),[t,o]=r.useState(void 0),[p,c]=r.useState([]),h=r.useRef(void 0),u=r.useRef(void 0);h.current=s,u.current=t;const g=r.useCallback(x=>{i(x)},[]),l=r.useCallback(()=>{const x=h.current;x&&(c(j=>[...j,u.current??""]),o(x))},[]),b=r.useRef([]);b.current=p;const d=r.useCallback(()=>{const x=b.current;x.length!==0&&(o(x.at(-1)||void 0),c(x.slice(0,-1)))},[]),a=p.length+1,n=p.length>0;return{cursor:t,setNextCursor:g,goNext:l,goPrev:d,pageNumber:a,hasPrev:n,hasNext:!!s}}const I=20;function W(s){switch(s){case m.RUNNING:return"bg-[var(--accent)]";case m.QUEUED:return"bg-[var(--warning)]";case m.ASSIGNED:return"bg-[var(--info)]";case m.SUSPENDED:return"bg-[var(--warning)]";case m.COMPLETED:return"bg-[var(--accent)]";case m.FAILED:return"bg-[var(--destructive)]";case m.CANCELLED:return"bg-[#525252]";default:return"bg-[#525252]"}}const Y=z(X);function ee({taskId:s,onClose:i,onLaunched:t}){const{t:o}=w(),[p,c]=r.useState([Q.CLAUDE]),[h,u]=r.useState(""),[g,l]=r.useState(!1);function b(a){c(n=>n.includes(a)?n.filter(f=>f!==a):[...n,a])}async function d(){if(p.length===0){y.error("select at least one review agent.");return}l(!0);try{await N.post(`web/tasks/${s}/review`,{json:{agentTypes:p,description:h.trim()||void 0}}),y.success("review launched"),t(),i()}catch(a){const n=a instanceof Error?a.message:String(a);y.error(n)}finally{l(!1)}}return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",children:e.jsxs("div",{className:"w-full max-w-sm rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5 font-mono",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-bold text-[var(--text-primary)]",children:o("review.launch")}),e.jsx("button",{onClick:i,className:"text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:e.jsx(T,{className:"h-4 w-4"})})]}),e.jsxs("p",{className:"mb-3 text-[11px] text-[var(--text-muted)]",children:["task #",s," — ",o("review.select_agents")]}),e.jsx("div",{className:"mb-4 flex flex-col gap-2",children:Y.map(a=>e.jsx(q,{checked:p.includes(a.value),onCheckedChange:()=>b(a.value),label:a.label,containerClassName:"w-full gap-2.5 rounded-[4px] border border-[var(--border)] px-3 py-2 hover:bg-[var(--bg-input)] transition-colors"},a.value))}),e.jsx("textarea",{value:h,onChange:a=>u(a.target.value),placeholder:o("review.description_placeholder"),rows:3,className:"mb-4 w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)] resize-none"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:d,disabled:g||p.length===0,className:"flex flex-1 items-center justify-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs font-bold text-black disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(R,{className:"h-3 w-3"}),o(g?"common.processing":"review.launch")]}),e.jsx("button",{onClick:i,className:"rounded-[4px] border border-[var(--border)] px-4 py-2 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:o("common.cancel")})]})]})})}function _({pag:s}){const{t:i}=w();return!s.hasPrev&&!s.hasNext?null:e.jsxs("div",{className:"mt-6 flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["// page ",s.pageNumber]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:s.goPrev,disabled:!s.hasPrev,className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:border-[var(--accent)] disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:[e.jsx(J,{className:"h-3.5 w-3.5"}),i("tasks.prev")]}),e.jsxs("button",{onClick:s.goNext,disabled:!s.hasNext,className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:border-[var(--accent)] disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:[i("common.next"),e.jsx(V,{className:"h-3.5 w-3.5"})]})]})]})}function se({onRefresh:s,projectFilter:i,developerFilter:t}){const{t:o}=w(),p=k(),[c,h]=r.useState([]),[u,g]=r.useState(!0),[l,b]=r.useState(null),d=$(),a=r.useCallback(async n=>{g(!0);try{const f=new Date(Date.now()-6048e5).toISOString(),x=new URLSearchParams({status:m.COMPLETED,taskMode:"develop",reviewStatus:"null",completedAfter:f,limit:String(I)});i&&x.set("projectKey",i),t&&x.set("developerId",t),n&&x.set("cursor",n);const j=await N.get(`web/tasks?${x}`).json();h(j.data??[]),d.setNextCursor(j.nextCursor)}catch{h([]),d.setNextCursor(void 0)}finally{g(!1)}},[i,t]);return r.useEffect(()=>{a(d.cursor)},[a,d.cursor]),u&&c.length===0?e.jsx("div",{className:"p-4",children:e.jsx(L,{rows:4})}):!u&&c.length===0&&!d.hasPrev?e.jsx(D,{icon:E,title:o("review.no_reviews"),description:o("review.pending")}):e.jsxs(e.Fragment,{children:[c.length>0&&e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:c.map(n=>e.jsxs("div",{className:"flex flex-col gap-1 border-b border-[var(--border)] px-4 py-3 last:border-b-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full bg-[var(--accent)]"}),e.jsx(A,{content:n.description,className:"flex-1 min-w-0",children:e.jsxs("span",{className:"cursor-pointer truncate text-xs text-[var(--text-primary)] hover:text-[var(--accent)] transition-colors block preserve-case",onClick:()=>p(`/tasks/${n.id}`),children:["#",n.id," ",B(n)]})}),e.jsx("button",{onClick:async()=>{try{await N.post(`web/tasks/${n.id}/review-status`,{json:{reviewStatus:"dismissed"}}),a(d.cursor)}catch(f){let x="Failed to dismiss";try{if(f instanceof H){const j=await f.response.json();x=(j==null?void 0:j.message)??x}else f instanceof Error&&(x=f.message)}catch{}y.error(x)}},className:"shrink-0 flex items-center rounded-[4px] p-1.5 text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors","aria-label":"dismiss",children:e.jsx(T,{className:"h-3.5 w-3.5"})}),e.jsxs("button",{onClick:()=>b(n.id),className:"shrink-0 flex items-center gap-1.5 rounded-[4px] px-3 py-1.5 text-[11px] font-medium text-[var(--accent)]",style:{backgroundColor:"rgba(34,197,94,0.12)"},children:[e.jsx(R,{className:"h-3 w-3"}),e.jsx("span",{className:"hidden md:inline",children:o("review.launch_short")})]})]}),e.jsxs("div",{className:"flex items-center gap-2 pl-5 text-[11px] text-[var(--text-muted)] min-w-0",children:[e.jsx("span",{className:"shrink-0",children:P(n.completedAt??n.createdAt)}),e.jsx("span",{className:"shrink-0",children:"·"}),e.jsx("span",{className:"shrink-0",children:n.projectKey}),n.workerName&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"shrink-0",children:"·"}),e.jsx("span",{className:"truncate",children:n.workerName})]})]})]},n.id))}),e.jsx(_,{pag:d}),l!==null&&e.jsx(ee,{taskId:l,onClose:()=>b(null),onLaunched:()=>{s(),a(d.cursor)}})]})}function te(s){const i=new Map;for(const t of s){const o=t.sourceTaskId??t.id;i.has(o)||i.set(o,[]),i.get(o).push(t)}return Array.from(i.entries()).map(([t,o])=>({sourceTaskId:t,tasks:o}))}function re({group:s,onClick:i}){const t=s.tasks[0],o=s.tasks.every(c=>c.status===m.COMPLETED||c.status===m.FAILED||c.status===m.CANCELLED),p=t==null?void 0:t.sourceCommitSha;return e.jsxs("div",{onClick:i,className:"flex cursor-pointer items-center gap-3 border-b border-[var(--border)] px-4 py-3 last:border-b-0 hover:bg-[var(--bg-input)] transition-colors",children:[e.jsx("span",{className:`h-2 w-2 shrink-0 rounded-full ${o?"bg-[var(--accent)]":"bg-[var(--warning)]"}`}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx(A,{content:(t==null?void 0:t.sourceTaskDescription)??(t==null?void 0:t.description),className:"truncate",children:e.jsxs("span",{className:"truncate text-xs text-[var(--text-primary)]",children:["source #",s.sourceTaskId]})}),p&&e.jsxs("span",{className:"shrink-0 font-mono text-[11px] text-[var(--accent)]",children:["@",p.slice(0,7)]})]}),e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:[s.tasks.length," ",s.tasks.length===1?"agent":"agents"," · ",s.tasks.map(c=>(c.agentType??"claude").toLowerCase()).join(", ")]})]}),t&&e.jsx("span",{className:"shrink-0 rounded-[4px] border border-[var(--border)] px-2 py-0.5 text-[11px] text-[var(--text-muted)]",children:t.projectKey}),t&&e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:P(t.createdAt)}),e.jsx("div",{className:"flex shrink-0 items-center gap-1",children:s.tasks.map(c=>e.jsx("span",{className:`h-2 w-2 rounded-full ${W(c.status)}`,title:c.status.toLowerCase()},c.id))})]})}function S({mode:s,projectFilter:i,developerFilter:t}){const{t:o}=w(),p=k(),[c,h]=r.useState([]),[u,g]=r.useState(!0),l=$(),b=r.useCallback(async d=>{g(!0);try{const a=new URLSearchParams({taskMode:"review",limit:String(I),groupBySource:"true"});s==="in_progress"?a.set("status",[m.QUEUED,m.ASSIGNED,m.RUNNING,m.SUSPENDED].join(",")):a.set("status",[m.COMPLETED,m.FAILED,m.CANCELLED].join(",")),i&&a.set("projectKey",i),t&&a.set("sourceDeveloperId",t),d&&a.set("cursor",d);const n=await N.get(`web/tasks?${a}`).json();h(te(n.data??[])),l.setNextCursor(n.nextCursor??void 0)}catch{h([]),l.setNextCursor(void 0)}finally{g(!1)}},[s,i,t]);return r.useEffect(()=>{b(l.cursor)},[b,l.cursor]),u&&c.length===0?e.jsx("div",{className:"p-4",children:e.jsx(L,{rows:4})}):!u&&c.length===0&&!l.hasPrev?e.jsx(D,{icon:E,title:o("review.no_reviews")}):e.jsxs(e.Fragment,{children:[c.length>0&&e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:c.map(d=>e.jsx(re,{group:d,onClick:()=>p(`/review/${d.sourceTaskId}`)},d.sourceTaskId))}),e.jsx(_,{pag:l})]})}function fe(){const{t:s}=w(),i=k(),t=K(v=>v.taskSeq),[o,p]=r.useState("pending"),[c,h]=r.useState(0),[u,g]=r.useState(""),[l,b]=r.useState(""),[d,a]=r.useState([]),[n,f]=r.useState([]);F(null);const x=r.useCallback(()=>h(v=>v+1),[]);r.useEffect(()=>{let v=!1;return(async()=>{try{const[M,G]=await Promise.all([N.get("web/projects").json(),N.get("web/projects/-/developers").json()]);if(v)return;a(M),f(G)}catch{}})(),()=>{v=!0}},[]);const j=r.useMemo(()=>[{value:"",label:s("tasks.filter_project")},...d.map(v=>({value:v.key,label:v.name}))],[d,s]),O=r.useMemo(()=>[{value:"",label:s("tasks.filter_developer")},...n.map(v=>({value:String(v.id),label:v.name}))],[n,s]),U=[{key:"pending",label:s("review.pending")},{key:"in_progress",label:s("review.in_progress")},{key:"history",label:s("review.history")}];return e.jsxs("div",{className:"mx-auto max-w-6xl px-2 py-4 md:px-4 md:py-6 font-mono",children:[e.jsx("h1",{className:"sr-only",children:s("review.title")}),e.jsxs("div",{className:"mb-4 flex flex-col gap-3 md:gap-4 md:flex-row md:items-center",children:[e.jsxs("div",{className:"flex items-center gap-1 overflow-x-auto pb-1 md:pb-0 no-scrollbar",children:[U.map(v=>e.jsx("button",{onClick:()=>p(v.key),className:`shrink-0 rounded-[4px] px-3 py-2 h-8 text-xs transition-colors ${o===v.key?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)] bg-[var(--bg-card)] hover:text-[var(--text-secondary)]"}`,children:v.label},v.key)),e.jsxs("button",{onClick:()=>i("/plan"),className:"shrink-0 flex items-center gap-1 rounded-[4px] px-3 py-2 h-8 text-xs text-[var(--text-muted)] hover:text-[var(--accent)] transition-colors",children:[e.jsx(Z,{className:"h-3 w-3"}),s("plan.title")]})]}),e.jsxs("div",{className:"flex flex-col gap-2 md:ml-auto md:flex-row md:items-center",children:[e.jsx(C,{value:u,onChange:g,options:j,className:"md:w-40"}),e.jsx(C,{value:l,onChange:b,options:O,className:"md:w-40"})]})]}),o==="pending"&&e.jsx(se,{onRefresh:x,projectFilter:u,developerFilter:l},`pending-${c}-${t}-${u}-${l}`),o==="in_progress"&&e.jsx(S,{mode:"in_progress",projectFilter:u,developerFilter:l},`inprogress-${c}-${t}-${u}-${l}`),o==="history"&&e.jsx(S,{mode:"history",projectFilter:u,developerFilter:l},`history-${c}-${t}-${u}-${l}`)]})}export{fe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as l,j as t}from"./index-
|
|
1
|
+
import{r as l,j as t}from"./index-CzELujVH.js";import{C as f}from"./chevron-down-D0oPuFDK.js";function h({value:r,onChange:x,options:c,placeholder:u,disabled:n=!1,className:m=""}){var i;const[a,o]=l.useState(!1),s=l.useRef(null),d=((i=c.find(e=>e.value===r))==null?void 0:i.label)??u??"";return l.useEffect(()=>{function e(v){s.current&&!s.current.contains(v.target)&&o(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),t.jsxs("div",{ref:s,className:`relative ${m}`,children:[t.jsxs("button",{type:"button",disabled:n,onClick:()=>!n&&o(!a),"aria-expanded":a,"aria-haspopup":"listbox",className:`flex w-full items-center justify-between rounded-[4px] border bg-[var(--bg-input)] px-3 py-2 font-mono text-xs outline-none transition-colors ${a?"border-[var(--accent)] text-[var(--text-primary)]":"border-[var(--border)] text-[var(--text-primary)] hover:border-[var(--text-muted)]"} ${n?"cursor-not-allowed opacity-50":"cursor-pointer"}`,children:[t.jsx("span",{className:r?"":"text-[var(--text-muted)]",children:d}),t.jsx(f,{size:12,className:`ml-2 shrink-0 text-[var(--text-muted)] transition-transform ${a?"rotate-180":""}`})]}),a&&t.jsx("div",{role:"listbox",className:"absolute right-0 z-50 mt-1 max-h-48 min-w-full w-max max-w-[calc(100vw-2rem)] overflow-auto rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] py-1 shadow-lg",children:c.map(e=>t.jsxs("button",{type:"button",role:"option","aria-selected":e.value===r,onClick:()=>{x(e.value),o(!1)},className:`flex w-full items-center px-3 py-1.5 text-left font-mono text-xs transition-colors ${e.value===r?"bg-[var(--accent)]/10 text-[var(--accent)]":"text-[var(--text-secondary)] hover:bg-[var(--bg-input)] hover:text-[var(--text-primary)]"}`,children:[e.value===r&&t.jsx("span",{className:"mr-2 text-[var(--accent)]",children:">"}),e.label]},e.value))})]})}export{h as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./index-
|
|
1
|
+
import{j as e}from"./index-CzELujVH.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-
|
|
1
|
+
import{a as t,j as e}from"./index-CzELujVH.js";import{I as c,C as r}from"./DocsPrimitives-SdmUr48p.js";import{E as n}from"./external-link-BpzOrxrN.js";import"./copy-CkRs-F8C.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 xe,a as de,r as n,A as R,h as f,j as e,H as Kt,t as $,s as Ee,B as Wt,f as Ht,F as Xt,p as Jt,q as Vt,k as mt,o as k,R as Qt,L as ie,l as pt,m as Yt,X as Ce,y as Zt,U as es,G as ut,b as ts,I as Ct,J as ss}from"./index-
|
|
1
|
+
import{c as xe,a as de,r as n,A as R,h as f,j as e,H as Kt,t as $,s as Ee,B as Wt,f as Ht,F as Xt,p as Jt,q as Vt,k as mt,o as k,R as Qt,L as ie,l as pt,m as Yt,X as Ce,y as Zt,U as es,G as ut,b as ts,I as Ct,J as ss}from"./index-CzELujVH.js";import{u as as}from"./task.store-BQKU9waM.js";import{P as ht}from"./PtyTerminal-hL02615j.js";import{C as ft}from"./ConfirmStageDialog-CeYHdsRO.js";import{C as oe}from"./Checkbox-DAG7dCWP.js";import{S as vt}from"./Select-D6BeX24N.js";import{b as rs,f as Y,c as ns}from"./date-CmcdoD87.js";import{a as St}from"./status-colors-cjNKu-0M.js";import{g as ls,H as cs}from"./task-agent-BAyqw2LQ.js";import{a as gt}from"./agent-type-options-BM8j4KsG.js";import{T as is,g as Z}from"./task-constants-DF5WSAah.js";import{T as os}from"./Tooltip-BqCa4MNE.js";import{A as xs}from"./arrow-left-DqInn209.js";import{R as Et}from"./rotate-ccw-nf3pbt98.js";import{G as ds}from"./git-fork-HJn7Wwfe.js";import{P as bt}from"./play-CZuNsRe4.js";import{E as jt}from"./external-link-BpzOrxrN.js";import{L as Tt}from"./loader-circle-Br3SI9uE.js";import{S as ms}from"./skip-forward-CKtB9GYx.js";import"./clock-Dc4Net7w.js";import"./chevron-down-D0oPuFDK.js";/**
|
|
2
2
|
* @license lucide-react v0.469.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e}from"./index-
|
|
1
|
+
import{j as e}from"./index-CzELujVH.js";import{a as s}from"./DocsPrimitives-SdmUr48p.js";import"./copy-CkRs-F8C.js";const a=`ov task create -d "implement oauth login" -p WEB -t feat
|
|
2
2
|
ov task plan -d "design auth system" -p WEB
|
|
3
3
|
ov task review 42 --agent codex,cursor
|
|
4
4
|
ov task fork 42 -d "retry with a simpler approach"`,r=`develop "implement oauth login" --project WEB --type feat
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{R as he,f as W,a as $,o as u,j as e,l as se,u as fe,i as ge,v as re,r,h as A,X as ye,k as je,w as M,x as ke,H as Ne,t as X,y as Ce,z as Y,m as we}from"./index-Bgvmej4n.js";import{u as Z}from"./task.store-CXBqDJ4r.js";import{T as ae}from"./TaskStatusBadge-BRKuMr4f.js";import{f as oe}from"./date-CmcdoD87.js";import{T as Se}from"./Tooltip-DsPnaAbV.js";import{G as ne}from"./git-fork-CIQLHrI4.js";import{S}from"./Select-Be3Zm1p-.js";import{a as _e}from"./task-constants-BRbcHP6G.js";import{g as Te}from"./agent-type-options-DL0KIlom.js";import{C as Ee}from"./copy-DXs4V3c2.js";import{E as ee}from"./EmptyState-BeoDXDBu.js";import{T as te}from"./Skeleton-CjQusY7D.js";import{P as Pe}from"./plus-xtTdDSWw.js";import{C as Fe}from"./chevron-left-CuehXDpM.js";import{C as Ae}from"./chevron-right-DUzlRcbw.js";import"./status-colors-DFKrrbb3.js";import"./chevron-down-DlZ2cTIM.js";const De=he.memo(function({task:s}){const d=W(),{t:c}=$(),x=(a,b)=>c(`common.${a}`,{n:b}),i=s.status===u.COMPLETED||s.status===u.FAILED||s.status===u.CANCELLED;return e.jsxs("tr",{onClick:()=>d(`/tasks/${s.id}`),className:"cursor-pointer border-b border-[var(--border-row)] transition-colors hover:bg-[var(--bg-input)]",children:[e.jsxs("td",{className:"w-16 py-3 pr-4 font-mono text-xs font-medium text-[var(--text-secondary)] text-right tabular-nums",children:["#",s.id]}),e.jsx("td",{className:"py-3 pr-4 text-sm text-[var(--text-primary)] preserve-case",children:e.jsx(Se,{content:s.description,children:se(s)})}),e.jsx("td",{className:"py-3 pr-4",children:e.jsx(ae,{status:s.status})}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:s.projectKey}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:s.developerName??s.creatorName??"-"}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:s.workerName??"—"}),e.jsx("td",{className:"py-3 font-mono text-xs text-[var(--text-muted)]",children:e.jsxs("span",{className:"flex items-center gap-2",children:[oe(s.createdAt,x),i&&e.jsx("button",{onClick:a=>{a.stopPropagation(),d(`/tasks/${s.id}?action=fork`)},className:"shrink-0 rounded-[4px] p-1 text-[var(--text-muted)] hover:text-[var(--accent)] hover:bg-[var(--bg-input)] transition-colors",title:c("tasks.fork_task"),children:e.jsx(ne,{className:"h-3 w-3"})})]})})]})});function Ie({isOpen:o,onClose:s,projects:d,projectsLoading:c,onSubmit:x,isSubmitting:i}){const{t:a}=$();fe(n=>n.user);const b=ge();re(o);const[p,O]=r.useState(""),[v,R]=r.useState(""),[y,B]=r.useState("feat"),[m,D]=r.useState(""),[N,_]=r.useState(""),[h,T]=r.useState(""),[j,E]=r.useState(""),[f,k]=r.useState(""),[K,H]=r.useState([]),[I,C]=r.useState(""),L=d.find(n=>n.key===p),z=Te(n=>n,L==null?void 0:L.agentType);r.useEffect(()=>{if(!o||(O(""),R(""),B("feat"),D(""),_(""),T(""),E(""),k(""),C(""),!b))return;const n=new AbortController;return A.get("admin/developers",{signal:n.signal}).json().then(H).catch(()=>{}),()=>n.abort()},[o,b]);async function P(n){if(n.preventDefault(),C(""),!p||!v.trim()){C(a("tasks.project_and_description_required"));return}try{await x({projectKey:p,description:v.trim(),workerId:j||void 0,developerId:f?Number(f):void 0,taskType:y,branchSlug:N.trim()||void 0,agentType:m||void 0,targetBranch:h.trim()||void 0})}catch(w){const J=w instanceof Error?w.message:a("tasks.failed_to_create_task");C(J)}}return o?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 font-mono",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},children:e.jsxs("div",{className:"w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",onClick:n=>n.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-6 py-4",children:[e.jsxs("h2",{className:"text-sm text-[var(--text-primary)]",children:["// ",a("tasks.new_task")]}),e.jsx("button",{onClick:s,className:"text-[var(--text-muted)] transition-colors hover:text-[var(--text-primary)]",children:e.jsx(ye,{className:"h-4 w-4"})})]}),e.jsxs("form",{onSubmit:P,className:"px-6 py-5",children:[e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.project")}),e.jsx(S,{value:p,onChange:O,options:d.map(n=>({value:n.key,label:n.name})),placeholder:a(c?"common.loading":"tasks.select_project"),disabled:c})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.task_type")}),e.jsx(S,{value:y,onChange:B,options:_e})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.form_agent_type")}),e.jsx(S,{value:m,onChange:D,options:z})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.task_description")}),e.jsx("textarea",{value:v,onChange:n=>R(n.target.value),placeholder:a("tasks.describe_task_placeholder"),rows:4,className:"w-full resize-none rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.target_worker")}),e.jsx("input",{type:"text",value:j,onChange:n=>E(n.target.value),placeholder:a("tasks.any_able"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.branch_slug")}),e.jsx("input",{type:"text",value:N,onChange:n=>_(n.target.value),placeholder:a("tasks.branch_slug_placeholder"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.target_branch")}),e.jsx("input",{type:"text",value:h,onChange:n=>T(n.target.value),placeholder:a("tasks.target_branch_placeholder"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),b&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.assign_developer")}),e.jsx(S,{value:f,onChange:k,options:K.map(n=>({value:String(n.id),label:n.name})),placeholder:a("tasks.select_developer")})]}),I&&e.jsx("div",{className:"rounded-[4px] bg-[#2a1515] border border-[var(--destructive)]/30 px-3 py-2 text-xs text-[var(--destructive)]",children:I})]}),e.jsxs("div",{className:"mt-6 flex items-center justify-end gap-3",children:[e.jsx("button",{type:"button",onClick:s,className:"rounded-[4px] border border-[var(--border)] bg-transparent px-4 py-2 text-xs text-[var(--text-secondary)] transition-colors hover:text-[var(--text-primary)]",children:a("common.cancel")}),e.jsx("button",{type:"submit",disabled:i||!p||!v.trim(),className:"rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs text-black transition-opacity hover:opacity-90 disabled:opacity-40",children:a(i?"common.creating":"tasks.create_task")})]})]})]})}):null}function Le({isOpen:o,onClose:s,onForceCreate:d,onViewExisting:c,similarTask:x,isLoading:i}){const{t:a}=$();return re(o),!x||!o?null:e.jsx("div",{style:{position:"fixed",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},children:e.jsxs("div",{onClick:b=>b.stopPropagation(),style:{width:"100%",maxWidth:"480px",backgroundColor:"var(--bg-card)",border:"1px solid var(--border)",borderRadius:"4px",padding:"1.5rem",fontFamily:"'JetBrains Mono', monospace"},children:[e.jsxs("div",{style:{marginBottom:"1.25rem"},children:[e.jsxs("div",{style:{color:"var(--accent)",fontSize:"0.875rem",fontWeight:600,display:"flex",alignItems:"center",gap:"0.5rem"},children:[e.jsx(Ee,{style:{width:"1rem",height:"1rem"}}),a("tasks.dedup_title")]}),e.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.7rem",marginTop:"0.25rem"},children:a("tasks.dedup_description")})]}),e.jsxs("div",{style:{marginBottom:"1.25rem",padding:"0.75rem",border:"1px solid var(--border)",borderRadius:"4px",backgroundColor:"var(--bg-primary)"},children:[e.jsxs("div",{style:{color:"var(--text-muted)",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace"},children:["#",x.id," · ",x.status]}),e.jsx("div",{style:{color:"var(--text-primary)",fontSize:"0.75rem",marginTop:"0.375rem",lineHeight:"1.5"},children:x.description})]}),e.jsxs("div",{style:{display:"flex",gap:"0.75rem"},children:[e.jsx("button",{type:"button",onClick:s,disabled:i,className:"text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:border-[var(--text-muted)]",style:{flex:1,padding:"0.5rem",backgroundColor:"transparent",border:"1px solid var(--border)",borderRadius:"4px",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:i?"not-allowed":"pointer",opacity:i?.7:1,transition:"color 0.15s, border-color 0.15s"},children:a("common.cancel")}),e.jsx("button",{type:"button",onClick:()=>c(x.id),style:{flex:1,padding:"0.5rem",backgroundColor:"transparent",color:"var(--text-muted)",border:"1px solid var(--border)",borderRadius:"4px",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:"pointer"},children:a("tasks.view_existing")}),e.jsx("button",{type:"button",onClick:d,disabled:i,style:{flex:1,padding:"0.5rem",backgroundColor:"var(--warning)",color:"#0C0C0C",border:"none",borderRadius:"4px",fontSize:"0.75rem",fontWeight:600,fontFamily:"'JetBrains Mono', monospace",cursor:i?"not-allowed":"pointer",opacity:i?.7:1},children:a(i?"common.creating":"tasks.dedup_create_anyway")})]})]})})}function Me({task:o}){const s=W(),d=o.status===u.COMPLETED||o.status===u.FAILED||o.status===u.CANCELLED;return e.jsxs("div",{onClick:()=>s(`/tasks/${o.id}`),className:"cursor-pointer rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 transition-colors active:bg-[var(--bg-input)]",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("span",{className:"text-[11px] text-[var(--text-primary)] leading-tight line-clamp-2 preserve-case",title:we(o),children:["#",o.id," ",se(o)]}),e.jsxs("span",{className:"flex items-center gap-1.5 shrink-0",children:[d&&e.jsx("button",{onClick:c=>{c.stopPropagation(),s(`/tasks/${o.id}?action=fork`)},className:"rounded-[4px] p-1 text-[var(--text-muted)] hover:text-[var(--accent)] transition-colors",children:e.jsx(ne,{className:"h-3 w-3"})}),e.jsx(ae,{status:o.status})]})]}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-2 text-[11px] text-[var(--text-muted)]",children:[e.jsx("span",{children:oe(o.createdAt)}),e.jsx("span",{children:"·"}),e.jsx("span",{children:o.projectKey}),o.workerName&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("span",{children:o.workerName})]})]})]})}const Oe=[{key:"all",labelKey:"tasks.tab_all"},{key:u.RUNNING,labelKey:"tasks.tab_running"},{key:u.QUEUED,labelKey:"tasks.tab_queued"},{key:u.COMPLETED,labelKey:"tasks.tab_completed"},{key:u.FAILED,labelKey:"tasks.tab_failed"},{key:u.CANCELLED,labelKey:"tasks.tab_cancelled"}],Re=20;function st(){const o=W(),{t:s}=$(),{tasks:d,loading:c,fetchTasks:x}=Z(),i=je(t=>t.taskSeq),[a,b]=r.useState("all"),[p,O]=r.useState(M.DEVELOP),[v,R]=r.useState(""),[y,B]=r.useState(""),[m,D]=r.useState(""),[N,_]=r.useState(void 0),[h,T]=r.useState([]),j=Z(t=>t.nextCursor),[E,f]=r.useState(!1);ke(r.useMemo(()=>e.jsxs("button",{onClick:()=>f(!0),className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs font-mono text-black transition-opacity hover:opacity-90",children:[e.jsx(Pe,{className:"h-3.5 w-3.5"}),s("tasks.new_task")]}),[s]));const[k,K]=r.useState([]),[H,I]=r.useState(!1),[C,L]=r.useState([]),[z,P]=r.useState(!1),[n,w]=r.useState(!1),[J,le]=r.useState(null),[U,q]=r.useState(null),G=r.useCallback(t=>{const l={limit:String(Re)};return p&&(l.taskMode=p),a!=="all"&&(l.status=a),v&&(l.projectKey=v),y&&(l.developerId=y),t&&(l.cursor=t),l},[a,p,v,y]);r.useEffect(()=>{x(G(N))},[G,N,x,i]),r.useEffect(()=>{_(void 0),T([])},[a,p,v,y]),r.useEffect(()=>{let t=!1;return(async()=>{try{const[g,be]=await Promise.all([A.get("web/projects").json(),A.get("web/projects/-/developers").json()]);if(t)return;K(g),L(be)}catch{}})(),()=>{t=!0}},[]),r.useEffect(()=>{if(!E||k.length>0)return;I(!0);let t=!1;return(async()=>{try{const g=await A.get("web/projects").json();t||K(g)}catch{}finally{t||I(!1)}})(),()=>{t=!0}},[E,k.length]);const ce=r.useCallback(async t=>{P(!0);try{const l=await A.post("web/tasks",{json:{projectKey:t.projectKey,description:t.description,workerId:t.workerId,developerId:t.developerId,taskType:t.taskType,branchSlug:t.branchSlug,agentType:t.agentType,targetBranch:t.targetBranch}}).json();f(!1),o(`/tasks/${l.task.id}`)}catch(l){if(l instanceof Ne&&l.response.status===409){try{const g=await l.response.json();if(g.confirmRequired){le({id:g.confirmRequired.taskId,description:g.confirmRequired.message,status:"active"}),q(t),f(!1),w(!0);return}}catch{}X.error(s("tasks.similar_task_exists"))}else{const g=l instanceof Error?l.message:String(l);X.error(g)}}finally{P(!1)}},[o]),ie=r.useCallback(async()=>{if(U){P(!0);try{const t=await A.post("web/tasks",{json:{...U,force:!0}}).json();w(!1),q(null),o(`/tasks/${t.task.id}`)}finally{P(!1)}}},[U,o]),F=r.useMemo(()=>{if(!m.trim())return d;const t=m.toLowerCase();return d.filter(l=>(l.name??"").toLowerCase().includes(t)||l.description.toLowerCase().includes(t)||String(l.id).includes(m))},[d,m]),de=r.useCallback(()=>{j&&(T(t=>[...t,N??""]),_(j))},[j,N]),xe=r.useCallback(()=>{h.length!==0&&(_(h.at(-1)||void 0),T(t=>t.slice(0,-1)))},[h]),pe=h.length+1,me=r.useMemo(()=>[{value:"",label:s("tasks.filter_project")},...k.map(t=>({value:t.key,label:t.name}))],[k,s]),ue=r.useMemo(()=>[{value:"",label:s("tasks.filter_developer")},...C.map(t=>({value:String(t.id),label:t.name}))],[C,s]),ve=r.useMemo(()=>[{value:"",label:s("tasks.filter_mode")},{value:M.DEVELOP,label:s("tasks.mode_develop")},{value:M.PLAN,label:s("tasks.mode_plan")},{value:M.REVIEW,label:s("tasks.mode_review")},{value:M.AUTOMATION,label:s("tasks.mode_automation")}],[s]),Q=s(m?"tasks.try_adjusting_search":"tasks.create_first_task"),V=m?void 0:e.jsx("button",{onClick:()=>f(!0),className:"rounded-[4px] bg-[var(--accent)] px-5 py-2 text-[11px] font-bold text-black",children:s("tasks.create_task")});return e.jsxs("div",{className:"mx-auto max-w-6xl px-2 py-4 md:px-4 md:py-6 font-mono",children:[e.jsxs("div",{className:"mb-4 flex flex-col gap-3 md:gap-4 md:flex-row md:items-center",children:[e.jsx("div",{className:"flex items-center gap-1 overflow-x-auto pb-1 md:pb-0 no-scrollbar pr-4 md:pr-0",children:Oe.map(t=>e.jsx("button",{onClick:()=>b(t.key),className:`shrink-0 rounded-[4px] px-3 py-2 h-10 md:h-8 text-xs transition-colors ${a===t.key?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)] bg-[var(--bg-card)] hover:text-[var(--text-secondary)]"}`,children:s(t.labelKey)},t.key))}),e.jsxs("div",{className:"flex flex-col gap-2 md:ml-auto md:flex-row md:items-center",children:[e.jsxs("div",{className:"relative md:w-52",children:[e.jsx(Ce,{className:"absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-[var(--text-muted)]"}),e.jsx("input",{type:"text",placeholder:s("tasks.search_tasks"),value:m,onChange:t=>D(t.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] py-1.5 pl-8 pr-3 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"}),m&&e.jsx("button",{onClick:()=>D(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-xs text-[var(--text-muted)] hover:text-[var(--text-secondary)]",children:"x"})]}),e.jsx(S,{value:p,onChange:O,options:ve,className:"md:w-36"}),e.jsx(S,{value:v,onChange:R,options:me,className:"md:w-40"}),e.jsx(S,{value:y,onChange:B,options:ue,className:"md:w-40"})]})]}),e.jsx("div",{className:"hidden md:block rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:e.jsxs("table",{className:"w-full text-left",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] text-[11px] font-medium text-[#525252]",children:[e.jsx("th",{className:"w-16 px-4 py-2.5 text-right",children:s("tasks.id")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.description_col")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.status_col")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.project_col")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.assignee")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.worker")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.time")})]})}),e.jsxs("tbody",{children:[c&&F.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"p-4",children:e.jsx(te,{rows:5})})}),!c&&F.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"p-4",children:e.jsx(ee,{icon:Y,title:s("tasks.no_tasks_found"),description:Q,action:V})})}),F.map(t=>e.jsx(De,{task:t},t.id))]})]})}),e.jsxs("div",{className:"flex flex-col gap-2 md:hidden",children:[c&&F.length===0&&e.jsx("div",{className:"p-4",children:e.jsx(te,{rows:5})}),!c&&F.length===0&&e.jsx(ee,{icon:Y,title:s("tasks.no_tasks_found"),description:Q,action:V}),F.map(t=>e.jsx(Me,{task:t},t.id))]}),(h.length>0||j)&&e.jsxs("div",{className:"mt-6 flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["// page ",pe]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:xe,disabled:h.length===0,className:"flex items-center justify-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1 min-h-[44px] min-w-[44px] md:min-h-0 md:min-w-0 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:border-[var(--accent)] disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:[e.jsx(Fe,{className:"h-3.5 w-3.5"}),s("tasks.prev")]}),e.jsxs("button",{onClick:de,disabled:!j,className:"flex items-center justify-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1 min-h-[44px] min-w-[44px] md:min-h-0 md:min-w-0 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:border-[var(--accent)] disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:[s("common.next"),e.jsx(Ae,{className:"h-3.5 w-3.5"})]})]})]}),e.jsx(Ie,{isOpen:E,onClose:()=>f(!1),projects:k,projectsLoading:H,onSubmit:ce,isSubmitting:z}),e.jsx(Le,{isOpen:n,onClose:()=>{w(!1),q(null)},onForceCreate:ie,onViewExisting:t=>{w(!1),q(null),o(`/tasks/${t}`)},similarTask:J,isLoading:z})]})}export{st as default};
|
|
1
|
+
import{R as he,f as W,a as $,o as u,j as e,l as se,u as fe,i as ge,v as re,r,h as A,X as ye,k as je,w as M,x as ke,H as Ne,t as X,y as Ce,z as Y,m as we}from"./index-CzELujVH.js";import{u as Z}from"./task.store-BQKU9waM.js";import{T as ae}from"./TaskStatusBadge-DPvH-r-e.js";import{f as oe}from"./date-CmcdoD87.js";import{T as Se}from"./Tooltip-BqCa4MNE.js";import{G as ne}from"./git-fork-HJn7Wwfe.js";import{S}from"./Select-D6BeX24N.js";import{a as _e}from"./task-constants-DF5WSAah.js";import{g as Te}from"./agent-type-options-BM8j4KsG.js";import{C as Ee}from"./copy-CkRs-F8C.js";import{E as ee}from"./EmptyState-DmUmVu70.js";import{T as te}from"./Skeleton-BbVk04Qq.js";import{P as Pe}from"./plus-BgYYBOLc.js";import{C as Fe}from"./chevron-left-BxCm1rXX.js";import{C as Ae}from"./chevron-right-JjA_YKtJ.js";import"./status-colors-cjNKu-0M.js";import"./chevron-down-D0oPuFDK.js";const De=he.memo(function({task:s}){const d=W(),{t:c}=$(),x=(a,b)=>c(`common.${a}`,{n:b}),i=s.status===u.COMPLETED||s.status===u.FAILED||s.status===u.CANCELLED;return e.jsxs("tr",{onClick:()=>d(`/tasks/${s.id}`),className:"cursor-pointer border-b border-[var(--border-row)] transition-colors hover:bg-[var(--bg-input)]",children:[e.jsxs("td",{className:"w-16 py-3 pr-4 font-mono text-xs font-medium text-[var(--text-secondary)] text-right tabular-nums",children:["#",s.id]}),e.jsx("td",{className:"py-3 pr-4 text-sm text-[var(--text-primary)] preserve-case",children:e.jsx(Se,{content:s.description,children:se(s)})}),e.jsx("td",{className:"py-3 pr-4",children:e.jsx(ae,{status:s.status})}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:s.projectKey}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:s.developerName??s.creatorName??"-"}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:s.workerName??"—"}),e.jsx("td",{className:"py-3 font-mono text-xs text-[var(--text-muted)]",children:e.jsxs("span",{className:"flex items-center gap-2",children:[oe(s.createdAt,x),i&&e.jsx("button",{onClick:a=>{a.stopPropagation(),d(`/tasks/${s.id}?action=fork`)},className:"shrink-0 rounded-[4px] p-1 text-[var(--text-muted)] hover:text-[var(--accent)] hover:bg-[var(--bg-input)] transition-colors",title:c("tasks.fork_task"),children:e.jsx(ne,{className:"h-3 w-3"})})]})})]})});function Ie({isOpen:o,onClose:s,projects:d,projectsLoading:c,onSubmit:x,isSubmitting:i}){const{t:a}=$();fe(n=>n.user);const b=ge();re(o);const[p,O]=r.useState(""),[v,R]=r.useState(""),[y,B]=r.useState("feat"),[m,D]=r.useState(""),[N,_]=r.useState(""),[h,T]=r.useState(""),[j,E]=r.useState(""),[f,k]=r.useState(""),[K,H]=r.useState([]),[I,C]=r.useState(""),L=d.find(n=>n.key===p),z=Te(n=>n,L==null?void 0:L.agentType);r.useEffect(()=>{if(!o||(O(""),R(""),B("feat"),D(""),_(""),T(""),E(""),k(""),C(""),!b))return;const n=new AbortController;return A.get("admin/developers",{signal:n.signal}).json().then(H).catch(()=>{}),()=>n.abort()},[o,b]);async function P(n){if(n.preventDefault(),C(""),!p||!v.trim()){C(a("tasks.project_and_description_required"));return}try{await x({projectKey:p,description:v.trim(),workerId:j||void 0,developerId:f?Number(f):void 0,taskType:y,branchSlug:N.trim()||void 0,agentType:m||void 0,targetBranch:h.trim()||void 0})}catch(w){const J=w instanceof Error?w.message:a("tasks.failed_to_create_task");C(J)}}return o?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 font-mono",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},children:e.jsxs("div",{className:"w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",onClick:n=>n.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-6 py-4",children:[e.jsxs("h2",{className:"text-sm text-[var(--text-primary)]",children:["// ",a("tasks.new_task")]}),e.jsx("button",{onClick:s,className:"text-[var(--text-muted)] transition-colors hover:text-[var(--text-primary)]",children:e.jsx(ye,{className:"h-4 w-4"})})]}),e.jsxs("form",{onSubmit:P,className:"px-6 py-5",children:[e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.project")}),e.jsx(S,{value:p,onChange:O,options:d.map(n=>({value:n.key,label:n.name})),placeholder:a(c?"common.loading":"tasks.select_project"),disabled:c})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.task_type")}),e.jsx(S,{value:y,onChange:B,options:_e})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.form_agent_type")}),e.jsx(S,{value:m,onChange:D,options:z})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.task_description")}),e.jsx("textarea",{value:v,onChange:n=>R(n.target.value),placeholder:a("tasks.describe_task_placeholder"),rows:4,className:"w-full resize-none rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.target_worker")}),e.jsx("input",{type:"text",value:j,onChange:n=>E(n.target.value),placeholder:a("tasks.any_able"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.branch_slug")}),e.jsx("input",{type:"text",value:N,onChange:n=>_(n.target.value),placeholder:a("tasks.branch_slug_placeholder"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.target_branch")}),e.jsx("input",{type:"text",value:h,onChange:n=>T(n.target.value),placeholder:a("tasks.target_branch_placeholder"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),b&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.assign_developer")}),e.jsx(S,{value:f,onChange:k,options:K.map(n=>({value:String(n.id),label:n.name})),placeholder:a("tasks.select_developer")})]}),I&&e.jsx("div",{className:"rounded-[4px] bg-[#2a1515] border border-[var(--destructive)]/30 px-3 py-2 text-xs text-[var(--destructive)]",children:I})]}),e.jsxs("div",{className:"mt-6 flex items-center justify-end gap-3",children:[e.jsx("button",{type:"button",onClick:s,className:"rounded-[4px] border border-[var(--border)] bg-transparent px-4 py-2 text-xs text-[var(--text-secondary)] transition-colors hover:text-[var(--text-primary)]",children:a("common.cancel")}),e.jsx("button",{type:"submit",disabled:i||!p||!v.trim(),className:"rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs text-black transition-opacity hover:opacity-90 disabled:opacity-40",children:a(i?"common.creating":"tasks.create_task")})]})]})]})}):null}function Le({isOpen:o,onClose:s,onForceCreate:d,onViewExisting:c,similarTask:x,isLoading:i}){const{t:a}=$();return re(o),!x||!o?null:e.jsx("div",{style:{position:"fixed",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},children:e.jsxs("div",{onClick:b=>b.stopPropagation(),style:{width:"100%",maxWidth:"480px",backgroundColor:"var(--bg-card)",border:"1px solid var(--border)",borderRadius:"4px",padding:"1.5rem",fontFamily:"'JetBrains Mono', monospace"},children:[e.jsxs("div",{style:{marginBottom:"1.25rem"},children:[e.jsxs("div",{style:{color:"var(--accent)",fontSize:"0.875rem",fontWeight:600,display:"flex",alignItems:"center",gap:"0.5rem"},children:[e.jsx(Ee,{style:{width:"1rem",height:"1rem"}}),a("tasks.dedup_title")]}),e.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.7rem",marginTop:"0.25rem"},children:a("tasks.dedup_description")})]}),e.jsxs("div",{style:{marginBottom:"1.25rem",padding:"0.75rem",border:"1px solid var(--border)",borderRadius:"4px",backgroundColor:"var(--bg-primary)"},children:[e.jsxs("div",{style:{color:"var(--text-muted)",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace"},children:["#",x.id," · ",x.status]}),e.jsx("div",{style:{color:"var(--text-primary)",fontSize:"0.75rem",marginTop:"0.375rem",lineHeight:"1.5"},children:x.description})]}),e.jsxs("div",{style:{display:"flex",gap:"0.75rem"},children:[e.jsx("button",{type:"button",onClick:s,disabled:i,className:"text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:border-[var(--text-muted)]",style:{flex:1,padding:"0.5rem",backgroundColor:"transparent",border:"1px solid var(--border)",borderRadius:"4px",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:i?"not-allowed":"pointer",opacity:i?.7:1,transition:"color 0.15s, border-color 0.15s"},children:a("common.cancel")}),e.jsx("button",{type:"button",onClick:()=>c(x.id),style:{flex:1,padding:"0.5rem",backgroundColor:"transparent",color:"var(--text-muted)",border:"1px solid var(--border)",borderRadius:"4px",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:"pointer"},children:a("tasks.view_existing")}),e.jsx("button",{type:"button",onClick:d,disabled:i,style:{flex:1,padding:"0.5rem",backgroundColor:"var(--warning)",color:"#0C0C0C",border:"none",borderRadius:"4px",fontSize:"0.75rem",fontWeight:600,fontFamily:"'JetBrains Mono', monospace",cursor:i?"not-allowed":"pointer",opacity:i?.7:1},children:a(i?"common.creating":"tasks.dedup_create_anyway")})]})]})})}function Me({task:o}){const s=W(),d=o.status===u.COMPLETED||o.status===u.FAILED||o.status===u.CANCELLED;return e.jsxs("div",{onClick:()=>s(`/tasks/${o.id}`),className:"cursor-pointer rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 transition-colors active:bg-[var(--bg-input)]",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("span",{className:"text-[11px] text-[var(--text-primary)] leading-tight line-clamp-2 preserve-case",title:we(o),children:["#",o.id," ",se(o)]}),e.jsxs("span",{className:"flex items-center gap-1.5 shrink-0",children:[d&&e.jsx("button",{onClick:c=>{c.stopPropagation(),s(`/tasks/${o.id}?action=fork`)},className:"rounded-[4px] p-1 text-[var(--text-muted)] hover:text-[var(--accent)] transition-colors",children:e.jsx(ne,{className:"h-3 w-3"})}),e.jsx(ae,{status:o.status})]})]}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-2 text-[11px] text-[var(--text-muted)]",children:[e.jsx("span",{children:oe(o.createdAt)}),e.jsx("span",{children:"·"}),e.jsx("span",{children:o.projectKey}),o.workerName&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("span",{children:o.workerName})]})]})]})}const Oe=[{key:"all",labelKey:"tasks.tab_all"},{key:u.RUNNING,labelKey:"tasks.tab_running"},{key:u.QUEUED,labelKey:"tasks.tab_queued"},{key:u.COMPLETED,labelKey:"tasks.tab_completed"},{key:u.FAILED,labelKey:"tasks.tab_failed"},{key:u.CANCELLED,labelKey:"tasks.tab_cancelled"}],Re=20;function st(){const o=W(),{t:s}=$(),{tasks:d,loading:c,fetchTasks:x}=Z(),i=je(t=>t.taskSeq),[a,b]=r.useState("all"),[p,O]=r.useState(M.DEVELOP),[v,R]=r.useState(""),[y,B]=r.useState(""),[m,D]=r.useState(""),[N,_]=r.useState(void 0),[h,T]=r.useState([]),j=Z(t=>t.nextCursor),[E,f]=r.useState(!1);ke(r.useMemo(()=>e.jsxs("button",{onClick:()=>f(!0),className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs font-mono text-black transition-opacity hover:opacity-90",children:[e.jsx(Pe,{className:"h-3.5 w-3.5"}),s("tasks.new_task")]}),[s]));const[k,K]=r.useState([]),[H,I]=r.useState(!1),[C,L]=r.useState([]),[z,P]=r.useState(!1),[n,w]=r.useState(!1),[J,le]=r.useState(null),[U,q]=r.useState(null),G=r.useCallback(t=>{const l={limit:String(Re)};return p&&(l.taskMode=p),a!=="all"&&(l.status=a),v&&(l.projectKey=v),y&&(l.developerId=y),t&&(l.cursor=t),l},[a,p,v,y]);r.useEffect(()=>{x(G(N))},[G,N,x,i]),r.useEffect(()=>{_(void 0),T([])},[a,p,v,y]),r.useEffect(()=>{let t=!1;return(async()=>{try{const[g,be]=await Promise.all([A.get("web/projects").json(),A.get("web/projects/-/developers").json()]);if(t)return;K(g),L(be)}catch{}})(),()=>{t=!0}},[]),r.useEffect(()=>{if(!E||k.length>0)return;I(!0);let t=!1;return(async()=>{try{const g=await A.get("web/projects").json();t||K(g)}catch{}finally{t||I(!1)}})(),()=>{t=!0}},[E,k.length]);const ce=r.useCallback(async t=>{P(!0);try{const l=await A.post("web/tasks",{json:{projectKey:t.projectKey,description:t.description,workerId:t.workerId,developerId:t.developerId,taskType:t.taskType,branchSlug:t.branchSlug,agentType:t.agentType,targetBranch:t.targetBranch}}).json();f(!1),o(`/tasks/${l.task.id}`)}catch(l){if(l instanceof Ne&&l.response.status===409){try{const g=await l.response.json();if(g.confirmRequired){le({id:g.confirmRequired.taskId,description:g.confirmRequired.message,status:"active"}),q(t),f(!1),w(!0);return}}catch{}X.error(s("tasks.similar_task_exists"))}else{const g=l instanceof Error?l.message:String(l);X.error(g)}}finally{P(!1)}},[o]),ie=r.useCallback(async()=>{if(U){P(!0);try{const t=await A.post("web/tasks",{json:{...U,force:!0}}).json();w(!1),q(null),o(`/tasks/${t.task.id}`)}finally{P(!1)}}},[U,o]),F=r.useMemo(()=>{if(!m.trim())return d;const t=m.toLowerCase();return d.filter(l=>(l.name??"").toLowerCase().includes(t)||l.description.toLowerCase().includes(t)||String(l.id).includes(m))},[d,m]),de=r.useCallback(()=>{j&&(T(t=>[...t,N??""]),_(j))},[j,N]),xe=r.useCallback(()=>{h.length!==0&&(_(h.at(-1)||void 0),T(t=>t.slice(0,-1)))},[h]),pe=h.length+1,me=r.useMemo(()=>[{value:"",label:s("tasks.filter_project")},...k.map(t=>({value:t.key,label:t.name}))],[k,s]),ue=r.useMemo(()=>[{value:"",label:s("tasks.filter_developer")},...C.map(t=>({value:String(t.id),label:t.name}))],[C,s]),ve=r.useMemo(()=>[{value:"",label:s("tasks.filter_mode")},{value:M.DEVELOP,label:s("tasks.mode_develop")},{value:M.PLAN,label:s("tasks.mode_plan")},{value:M.REVIEW,label:s("tasks.mode_review")},{value:M.AUTOMATION,label:s("tasks.mode_automation")}],[s]),Q=s(m?"tasks.try_adjusting_search":"tasks.create_first_task"),V=m?void 0:e.jsx("button",{onClick:()=>f(!0),className:"rounded-[4px] bg-[var(--accent)] px-5 py-2 text-[11px] font-bold text-black",children:s("tasks.create_task")});return e.jsxs("div",{className:"mx-auto max-w-6xl px-2 py-4 md:px-4 md:py-6 font-mono",children:[e.jsxs("div",{className:"mb-4 flex flex-col gap-3 md:gap-4 md:flex-row md:items-center",children:[e.jsx("div",{className:"flex items-center gap-1 overflow-x-auto pb-1 md:pb-0 no-scrollbar pr-4 md:pr-0",children:Oe.map(t=>e.jsx("button",{onClick:()=>b(t.key),className:`shrink-0 rounded-[4px] px-3 py-2 h-10 md:h-8 text-xs transition-colors ${a===t.key?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)] bg-[var(--bg-card)] hover:text-[var(--text-secondary)]"}`,children:s(t.labelKey)},t.key))}),e.jsxs("div",{className:"flex flex-col gap-2 md:ml-auto md:flex-row md:items-center",children:[e.jsxs("div",{className:"relative md:w-52",children:[e.jsx(Ce,{className:"absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-[var(--text-muted)]"}),e.jsx("input",{type:"text",placeholder:s("tasks.search_tasks"),value:m,onChange:t=>D(t.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] py-1.5 pl-8 pr-3 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"}),m&&e.jsx("button",{onClick:()=>D(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-xs text-[var(--text-muted)] hover:text-[var(--text-secondary)]",children:"x"})]}),e.jsx(S,{value:p,onChange:O,options:ve,className:"md:w-36"}),e.jsx(S,{value:v,onChange:R,options:me,className:"md:w-40"}),e.jsx(S,{value:y,onChange:B,options:ue,className:"md:w-40"})]})]}),e.jsx("div",{className:"hidden md:block rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:e.jsxs("table",{className:"w-full text-left",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] text-[11px] font-medium text-[#525252]",children:[e.jsx("th",{className:"w-16 px-4 py-2.5 text-right",children:s("tasks.id")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.description_col")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.status_col")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.project_col")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.assignee")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.worker")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.time")})]})}),e.jsxs("tbody",{children:[c&&F.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"p-4",children:e.jsx(te,{rows:5})})}),!c&&F.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"p-4",children:e.jsx(ee,{icon:Y,title:s("tasks.no_tasks_found"),description:Q,action:V})})}),F.map(t=>e.jsx(De,{task:t},t.id))]})]})}),e.jsxs("div",{className:"flex flex-col gap-2 md:hidden",children:[c&&F.length===0&&e.jsx("div",{className:"p-4",children:e.jsx(te,{rows:5})}),!c&&F.length===0&&e.jsx(ee,{icon:Y,title:s("tasks.no_tasks_found"),description:Q,action:V}),F.map(t=>e.jsx(Me,{task:t},t.id))]}),(h.length>0||j)&&e.jsxs("div",{className:"mt-6 flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["// page ",pe]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:xe,disabled:h.length===0,className:"flex items-center justify-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1 min-h-[44px] min-w-[44px] md:min-h-0 md:min-w-0 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:border-[var(--accent)] disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:[e.jsx(Fe,{className:"h-3.5 w-3.5"}),s("tasks.prev")]}),e.jsxs("button",{onClick:de,disabled:!j,className:"flex items-center justify-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1 min-h-[44px] min-w-[44px] md:min-h-0 md:min-w-0 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:border-[var(--accent)] disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:[s("common.next"),e.jsx(Ae,{className:"h-3.5 w-3.5"})]})]})]}),e.jsx(Ie,{isOpen:E,onClose:()=>f(!1),projects:k,projectsLoading:H,onSubmit:ce,isSubmitting:z}),e.jsx(Le,{isOpen:n,onClose:()=>{w(!1),q(null)},onForceCreate:ie,onViewExisting:t=>{w(!1),q(null),o(`/tasks/${t}`)},similarTask:J,isLoading:z})]})}export{st as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as l,j as a}from"./index-
|
|
1
|
+
import{a as l,j as a}from"./index-CzELujVH.js";import{a as u}from"./status-colors-cjNKu-0M.js";const r={QUEUED:"tasks.status_queued",ASSIGNED:"tasks.status_assigned",RUNNING:"tasks.status_running",SUSPENDED:"tasks.status_suspended",COMPLETED:"tasks.status_completed",FAILED:"tasks.status_failed",CANCELLED:"tasks.status_cancelled"};function E({status:s}){const{t:e}=l(),t=r[s],n=t?e(t):(s??"unknown").toLowerCase(),o=u(s);return a.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-xs",style:{color:o},children:[a.jsx("span",{style:{fontSize:"0.6rem"},children:"●"}),n]})}export{E as T};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as ce,n as le,h as O,o as S,a as A,r,k as z,p as de,q as xe,j as e,X as Z,s as me,f as pe,l as ue,m as he}from"./index-
|
|
1
|
+
import{c as ce,n as le,h as O,o as S,a as A,r,k as z,p as de,q as xe,j as e,X as Z,s as me,f as pe,l as ue,m as he}from"./index-CzELujVH.js";import{g as ee,H as ve}from"./task-agent-BAyqw2LQ.js";import{u as fe}from"./task.store-BQKU9waM.js";import{P as ge}from"./PtyTerminal-hL02615j.js";import{i as G,O as te}from"./OnboardingGuide-B4YiVD6E.js";import{C as be}from"./ConfirmStageDialog-CeYHdsRO.js";import{S as E}from"./Select-D6BeX24N.js";import{a as se}from"./status-colors-cjNKu-0M.js";import{a as je}from"./date-CmcdoD87.js";import{T as q,a as J,g as ke}from"./task-constants-DF5WSAah.js";import{g as ye}from"./agent-type-options-BM8j4KsG.js";import{u as ae}from"./useFetch-DOTFwxss.js";import{P as $}from"./plus-BgYYBOLc.js";import{C as Ne}from"./chevron-down-D0oPuFDK.js";import{C as we}from"./chevron-up-CGdyW-JD.js";import{R as Te}from"./rotate-ccw-nf3pbt98.js";import{C as Se}from"./clock-Dc4Net7w.js";import{W as _e}from"./wifi-13RzCkO8.js";import"./chevron-right-JjA_YKtJ.js";/**
|
|
2
2
|
* @license lucide-react v0.469.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as C,v as D,r as n,j as e,h as _,f as P,J as V,a8 as w,a6 as J,ad as S,s as O}from"./index-Bgvmej4n.js";import{K as L}from"./key-d4PGJDNU.js";import{C as T}from"./copy-DXs4V3c2.js";import{E as W}from"./external-link-DMd2RjTt.js";import{E as B}from"./EmptyState-BeoDXDBu.js";import{T as z}from"./Skeleton-CjQusY7D.js";import{u as X}from"./useFetch-BNnhvwY-.js";import{e as E}from"./status-colors-DFKrrbb3.js";import{P as q}from"./plus-xtTdDSWw.js";function G({isOpen:r,onClose:f,onCreated:u}){const{t:s}=C();D(r);const[a,o]=n.useState(""),[i,d]=n.useState(!1),[l,h]=n.useState("");function y(){o(""),h(""),f()}async function x(){if(h(""),!a.trim()){h(s("admin.pat_label_required"));return}try{d(!0);const c=await _.post("admin/worker-tokens",{json:{label:a.trim()}}).json();o(""),u({token:c.token,id:c.id})}catch(c){const m=c instanceof Error?c.message:s("admin.pat_failed_to_generate");h(m)}finally{d(!1)}}return r?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},children:e.jsxs("div",{className:"w-full border border-[var(--border)] bg-[var(--bg-card)]",style:{maxWidth:"480px",borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:[e.jsxs("div",{className:"flex items-center gap-2 border-b border-[var(--border)] px-5 py-4",children:[e.jsx(L,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:s("admin.generate_worker_token_title")})]}),e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[l&&e.jsx("div",{className:"border border-[var(--destructive)]/30 bg-[var(--destructive)]/10 px-3 py-2 text-xs text-[var(--destructive)]",style:{borderRadius:"4px"},children:l}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:s("admin.create_one_time_token")}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:s("admin.label")}),e.jsx("input",{type:"text",placeholder:s("admin.pat_label_placeholder"),value:a,onChange:c=>o(c.target.value),className:"w-full border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2 text-sm text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:border-[var(--accent)] focus:outline-none",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},onKeyDown:c=>{c.key==="Enter"&&x()}}),e.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:s("admin.label_identifies_worker")})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-[var(--border)] px-5 py-3",children:[e.jsx("button",{onClick:y,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:s("common.cancel")}),e.jsx("button",{onClick:x,disabled:i,className:"bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-black transition-opacity hover:opacity-80 disabled:opacity-50",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:s(i?"admin.generating":"admin.generate")})]})]})}):null}const U=3e3,H=600*1e3;function Q({isOpen:r,token:f,tokenId:u,onClose:s}){const{t:a}=C();D(r);const[o,i]=n.useState("command"),[d,l]=n.useState(!1),[h,y]=n.useState(!1),[x,c]=n.useState(""),[m,g]=n.useState(null),p=n.useRef(void 0),N=n.useRef(Date.now()),k=n.useRef(null),j=P();n.useEffect(()=>{var v;r&&((v=k.current)==null||v.focus())},[r]);const t=n.useCallback(v=>{v.key==="Escape"&&s()},[s]),A=typeof window<"u"?window.location.origin:"https://overlord.example.com",R=`overlord setup worker --token ${f} --server ${A}`;async function F(){try{await navigator.clipboard.writeText(f),l(!0),setTimeout(()=>l(!1),2e3)}catch{}}async function I(){try{await navigator.clipboard.writeText(R),y(!0),setTimeout(()=>y(!1),2e3)}catch{}}const M=n.useCallback(async()=>{try{const v=await _.get(`admin/worker-tokens/${u}/status`).json();v.status==="used"&&v.worker_name&&(i("success"),c(v.worker_name),g(v.worker_id??null),p.current&&clearInterval(p.current))}catch{}Date.now()-N.current>H&&(i("timeout"),p.current&&clearInterval(p.current))},[u]);function K(){i("waiting"),N.current=Date.now(),p.current=setInterval(M,U)}n.useEffect(()=>()=>{p.current&&clearInterval(p.current)},[]);function $(){s(),m&&j(`/workers/${m}`)}if(!r)return null;const b={fontFamily:"'JetBrains Mono', monospace",borderRadius:"4px"};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},children:e.jsxs("div",{ref:k,className:"w-full border border-[var(--border)] bg-[var(--bg-card)]",style:{...b,maxWidth:"480px"},onKeyDown:t,tabIndex:-1,children:[e.jsx("div",{className:"flex items-center gap-2 border-b border-[var(--border)] px-5 py-4",children:o==="success"?e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:a("admin.worker_registered")})]}):e.jsxs(e.Fragment,{children:[e.jsx(L,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:a("admin.worker_token_generated")})]})}),e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[o!=="success"&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:a("admin.run_command_desc")}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[11px] text-[var(--text-muted)]",children:"Token"}),e.jsxs("div",{className:"relative border border-[var(--border)] bg-[var(--bg-card)] p-3",style:{borderRadius:"4px"},children:[e.jsx("code",{className:"block break-all pr-20 text-xs text-[var(--text-primary)]",children:f}),e.jsx("button",{onClick:F,className:"absolute right-2 top-2 flex items-center gap-1 border border-[var(--border)] bg-transparent px-2 py-1 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:d?e.jsx("span",{className:"text-[var(--accent)]",children:a("common.copied")}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(T,{className:"h-3 w-3"})," ",a("common.copy")]})})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[11px] text-[var(--text-muted)]",children:a("admin.setup_command")}),e.jsxs("div",{className:"relative border border-[var(--border)] bg-[var(--bg-card)] p-3",style:{borderRadius:"4px"},children:[e.jsxs("code",{className:"block break-all pr-20 text-xs text-[var(--accent)]",children:["$ ",R]}),e.jsx("button",{onClick:I,className:"absolute right-2 top-2 flex items-center gap-1 border border-[var(--border)] bg-transparent px-2 py-1 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:h?e.jsx("span",{className:"text-[var(--accent)]",children:a("common.copied")}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(T,{className:"h-3 w-3"})," ",a("common.copy")]})})]})]}),e.jsx("div",{className:"border border-yellow-500/30 bg-yellow-500/10 px-3 py-2 text-xs text-yellow-400",style:{borderRadius:"4px"},children:a("admin.token_shown_once")})]}),o==="waiting"&&e.jsxs("div",{className:"flex items-center gap-3 border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3",style:{borderRadius:"4px"},children:[e.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-[var(--accent)] border-t-transparent"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:a("admin.waiting_for_worker")})]}),o==="timeout"&&e.jsx("div",{className:"border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3 text-xs text-[var(--text-muted)]",style:{borderRadius:"4px"},children:a("admin.token_not_yet_used")}),o==="success"&&e.jsxs("div",{className:"border border-[var(--accent)]/30 bg-[var(--accent)]/10 px-4 py-3",style:{borderRadius:"4px"},children:[e.jsx("p",{className:"text-xs text-[var(--accent)]",children:a("admin.worker_registered_success")}),e.jsxs("p",{className:"mt-1 text-xs text-[var(--text-primary)]",children:[a("admin.worker"),": ",e.jsx("span",{className:"text-[var(--accent)]",children:x})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-[var(--border)] px-5 py-3",children:[o==="command"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:a("common.close")}),e.jsx("button",{onClick:K,className:"bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-black transition-opacity hover:opacity-80",style:b,children:a("admin.copied_wait_for_worker")})]}),o==="waiting"&&e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:a("admin.close_worker_can_register")}),o==="timeout"&&e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:a("common.close")}),o==="success"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:a("common.close")}),e.jsxs("button",{onClick:$,className:"flex items-center gap-1.5 bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-black transition-opacity hover:opacity-80",style:b,children:[e.jsx(W,{className:"h-3 w-3"}),a("admin.view_worker")]})]})]})]})})}function ce(){const{t:r}=C(),[f,u]=n.useState(!1),[s,a]=n.useState(null),[o,i]=n.useState(!1),[d,l]=n.useState(null),[h,y]=n.useState(!1),[x,c]=n.useState(!1),{data:m,loading:g,refetch:p}=X(()=>_.get("admin/worker-tokens").json(),[]);async function N(){if(d){y(!0);try{await _.post(`admin/worker-tokens/${d.id}/revoke`),i(!1),l(null),p()}catch{}finally{y(!1)}}}function k(t){u(!1),a(t),p()}const j=n.useMemo(()=>(m??[]).filter(t=>x||t.status!==w.REVOKED),[m,x]);return e.jsxs("div",{className:"font-mono",children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:r("admin.tokens_title")}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("admin.tokens_subtitle")})]}),e.jsxs("button",{type:"button",className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity",onClick:()=>u(!0),children:[e.jsx(q,{className:"h-3.5 w-3.5"}),r("admin.generate_token")]})]}),!g&&(m==null?void 0:m.some(t=>t.status===w.REVOKED))&&e.jsx("div",{className:"mb-4 flex items-center gap-2",children:e.jsx("button",{type:"button",onClick:()=>c(!x),className:`text-xs transition-colors ${x?"text-[var(--text-primary)]":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:r(x?"admin.hide_revoked":"admin.show_revoked")})}),g?e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsx(z,{rows:3})}):j.length===0?e.jsx(B,{icon:J,title:r("admin.no_worker_tokens"),description:r("admin.generate_token_desc"),actionLabel:r("admin.generate_token"),onAction:()=>u(!0)}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden md:block overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] text-left text-[var(--text-muted)]",children:[e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.label")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.purpose")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.status")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("common.created_at")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.expires_at")}),e.jsx("th",{className:"pb-2 font-normal",children:r("common.actions")})]})}),e.jsx("tbody",{children:j.map(t=>e.jsxs("tr",{className:"border-b border-[var(--border-row)] hover:bg-white/[0.02] transition-colors",children:[e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-primary)]",children:t.label}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:t.purpose}),e.jsx("td",{className:"py-2.5 pr-4",children:e.jsx("span",{className:E(t.status),children:t.status})}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-muted)]",children:new Date(t.createdAt).toLocaleDateString()}),e.jsx("td",{className:"py-2.5 pr-4",children:t.expiresAt?e.jsx("span",{className:"text-[var(--text-secondary)]",children:new Date(t.expiresAt).toLocaleDateString()}):e.jsx("span",{className:"text-[var(--text-muted)]",children:"—"})}),e.jsx("td",{className:"py-2.5",children:t.status===w.ACTIVE&&e.jsxs("button",{type:"button",className:"flex items-center gap-1 rounded-[4px] px-2 py-1 text-red-400 hover:text-red-300 hover:bg-white/[0.05] transition-colors",onClick:()=>{l(t),i(!0)},children:[e.jsx(S,{className:"h-3.5 w-3.5"}),r("admin.revoke")]})})]},t.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3",children:j.map(t=>e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-xs text-[var(--text-primary)] font-medium truncate mr-2",children:t.label}),e.jsx("span",{className:`text-[11px] shrink-0 ${E(t.status)}`,children:t.status})]}),e.jsx("div",{className:"text-[11px] text-[var(--text-secondary)] truncate mb-1",children:t.purpose}),e.jsxs("div",{className:"flex items-center justify-between text-[11px] text-[var(--text-muted)]",children:[e.jsx("span",{children:new Date(t.createdAt).toLocaleDateString()}),t.expiresAt&&e.jsx("span",{children:new Date(t.expiresAt).toLocaleDateString()})]}),t.status===w.ACTIVE&&e.jsx("div",{className:"mt-2 pt-2 border-t border-[var(--border)]",children:e.jsxs("button",{type:"button",className:"flex items-center gap-1 rounded-[4px] px-2 py-1 text-[11px] text-red-400 hover:text-red-300 hover:bg-white/[0.05] transition-colors",onClick:()=>{l(t),i(!0)},children:[e.jsx(S,{className:"h-3.5 w-3.5"}),r("admin.revoke")]})})]},t.id))})]}),e.jsx(G,{isOpen:f,onClose:()=>u(!1),onCreated:k}),s&&e.jsx(Q,{isOpen:!!s,token:s.token,tokenId:s.id,onClose:()=>a(null)}),e.jsx(O,{isOpen:o,onClose:()=>{i(!1),l(null)},onConfirm:N,title:r("admin.revoke_token"),message:r("admin.revoke_token_confirm",{label:(d==null?void 0:d.label)??""}),confirmLabel:r("admin.revoke"),confirmVariant:"danger",isLoading:h})]})}export{ce as default};
|
|
1
|
+
import{a as C,v as D,r as n,j as e,h as _,f as P,J as V,a8 as w,a6 as J,ad as S,s as O}from"./index-CzELujVH.js";import{K as L}from"./key-Bp8O_2z-.js";import{C as T}from"./copy-CkRs-F8C.js";import{E as W}from"./external-link-BpzOrxrN.js";import{E as B}from"./EmptyState-DmUmVu70.js";import{T as z}from"./Skeleton-BbVk04Qq.js";import{u as X}from"./useFetch-DOTFwxss.js";import{e as E}from"./status-colors-cjNKu-0M.js";import{P as q}from"./plus-BgYYBOLc.js";function G({isOpen:r,onClose:f,onCreated:u}){const{t:s}=C();D(r);const[a,o]=n.useState(""),[i,d]=n.useState(!1),[l,h]=n.useState("");function y(){o(""),h(""),f()}async function x(){if(h(""),!a.trim()){h(s("admin.pat_label_required"));return}try{d(!0);const c=await _.post("admin/worker-tokens",{json:{label:a.trim()}}).json();o(""),u({token:c.token,id:c.id})}catch(c){const m=c instanceof Error?c.message:s("admin.pat_failed_to_generate");h(m)}finally{d(!1)}}return r?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},children:e.jsxs("div",{className:"w-full border border-[var(--border)] bg-[var(--bg-card)]",style:{maxWidth:"480px",borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:[e.jsxs("div",{className:"flex items-center gap-2 border-b border-[var(--border)] px-5 py-4",children:[e.jsx(L,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:s("admin.generate_worker_token_title")})]}),e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[l&&e.jsx("div",{className:"border border-[var(--destructive)]/30 bg-[var(--destructive)]/10 px-3 py-2 text-xs text-[var(--destructive)]",style:{borderRadius:"4px"},children:l}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:s("admin.create_one_time_token")}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:s("admin.label")}),e.jsx("input",{type:"text",placeholder:s("admin.pat_label_placeholder"),value:a,onChange:c=>o(c.target.value),className:"w-full border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2 text-sm text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:border-[var(--accent)] focus:outline-none",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},onKeyDown:c=>{c.key==="Enter"&&x()}}),e.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:s("admin.label_identifies_worker")})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-[var(--border)] px-5 py-3",children:[e.jsx("button",{onClick:y,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:s("common.cancel")}),e.jsx("button",{onClick:x,disabled:i,className:"bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-black transition-opacity hover:opacity-80 disabled:opacity-50",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:s(i?"admin.generating":"admin.generate")})]})]})}):null}const U=3e3,H=600*1e3;function Q({isOpen:r,token:f,tokenId:u,onClose:s}){const{t:a}=C();D(r);const[o,i]=n.useState("command"),[d,l]=n.useState(!1),[h,y]=n.useState(!1),[x,c]=n.useState(""),[m,g]=n.useState(null),p=n.useRef(void 0),N=n.useRef(Date.now()),k=n.useRef(null),j=P();n.useEffect(()=>{var v;r&&((v=k.current)==null||v.focus())},[r]);const t=n.useCallback(v=>{v.key==="Escape"&&s()},[s]),A=typeof window<"u"?window.location.origin:"https://overlord.example.com",R=`overlord setup worker --token ${f} --server ${A}`;async function F(){try{await navigator.clipboard.writeText(f),l(!0),setTimeout(()=>l(!1),2e3)}catch{}}async function I(){try{await navigator.clipboard.writeText(R),y(!0),setTimeout(()=>y(!1),2e3)}catch{}}const M=n.useCallback(async()=>{try{const v=await _.get(`admin/worker-tokens/${u}/status`).json();v.status==="used"&&v.worker_name&&(i("success"),c(v.worker_name),g(v.worker_id??null),p.current&&clearInterval(p.current))}catch{}Date.now()-N.current>H&&(i("timeout"),p.current&&clearInterval(p.current))},[u]);function K(){i("waiting"),N.current=Date.now(),p.current=setInterval(M,U)}n.useEffect(()=>()=>{p.current&&clearInterval(p.current)},[]);function $(){s(),m&&j(`/workers/${m}`)}if(!r)return null;const b={fontFamily:"'JetBrains Mono', monospace",borderRadius:"4px"};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},children:e.jsxs("div",{ref:k,className:"w-full border border-[var(--border)] bg-[var(--bg-card)]",style:{...b,maxWidth:"480px"},onKeyDown:t,tabIndex:-1,children:[e.jsx("div",{className:"flex items-center gap-2 border-b border-[var(--border)] px-5 py-4",children:o==="success"?e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:a("admin.worker_registered")})]}):e.jsxs(e.Fragment,{children:[e.jsx(L,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:a("admin.worker_token_generated")})]})}),e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[o!=="success"&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:a("admin.run_command_desc")}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[11px] text-[var(--text-muted)]",children:"Token"}),e.jsxs("div",{className:"relative border border-[var(--border)] bg-[var(--bg-card)] p-3",style:{borderRadius:"4px"},children:[e.jsx("code",{className:"block break-all pr-20 text-xs text-[var(--text-primary)]",children:f}),e.jsx("button",{onClick:F,className:"absolute right-2 top-2 flex items-center gap-1 border border-[var(--border)] bg-transparent px-2 py-1 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:d?e.jsx("span",{className:"text-[var(--accent)]",children:a("common.copied")}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(T,{className:"h-3 w-3"})," ",a("common.copy")]})})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[11px] text-[var(--text-muted)]",children:a("admin.setup_command")}),e.jsxs("div",{className:"relative border border-[var(--border)] bg-[var(--bg-card)] p-3",style:{borderRadius:"4px"},children:[e.jsxs("code",{className:"block break-all pr-20 text-xs text-[var(--accent)]",children:["$ ",R]}),e.jsx("button",{onClick:I,className:"absolute right-2 top-2 flex items-center gap-1 border border-[var(--border)] bg-transparent px-2 py-1 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:h?e.jsx("span",{className:"text-[var(--accent)]",children:a("common.copied")}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(T,{className:"h-3 w-3"})," ",a("common.copy")]})})]})]}),e.jsx("div",{className:"border border-yellow-500/30 bg-yellow-500/10 px-3 py-2 text-xs text-yellow-400",style:{borderRadius:"4px"},children:a("admin.token_shown_once")})]}),o==="waiting"&&e.jsxs("div",{className:"flex items-center gap-3 border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3",style:{borderRadius:"4px"},children:[e.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-[var(--accent)] border-t-transparent"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:a("admin.waiting_for_worker")})]}),o==="timeout"&&e.jsx("div",{className:"border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3 text-xs text-[var(--text-muted)]",style:{borderRadius:"4px"},children:a("admin.token_not_yet_used")}),o==="success"&&e.jsxs("div",{className:"border border-[var(--accent)]/30 bg-[var(--accent)]/10 px-4 py-3",style:{borderRadius:"4px"},children:[e.jsx("p",{className:"text-xs text-[var(--accent)]",children:a("admin.worker_registered_success")}),e.jsxs("p",{className:"mt-1 text-xs text-[var(--text-primary)]",children:[a("admin.worker"),": ",e.jsx("span",{className:"text-[var(--accent)]",children:x})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-[var(--border)] px-5 py-3",children:[o==="command"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:a("common.close")}),e.jsx("button",{onClick:K,className:"bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-black transition-opacity hover:opacity-80",style:b,children:a("admin.copied_wait_for_worker")})]}),o==="waiting"&&e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:a("admin.close_worker_can_register")}),o==="timeout"&&e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:a("common.close")}),o==="success"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:a("common.close")}),e.jsxs("button",{onClick:$,className:"flex items-center gap-1.5 bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-black transition-opacity hover:opacity-80",style:b,children:[e.jsx(W,{className:"h-3 w-3"}),a("admin.view_worker")]})]})]})]})})}function ce(){const{t:r}=C(),[f,u]=n.useState(!1),[s,a]=n.useState(null),[o,i]=n.useState(!1),[d,l]=n.useState(null),[h,y]=n.useState(!1),[x,c]=n.useState(!1),{data:m,loading:g,refetch:p}=X(()=>_.get("admin/worker-tokens").json(),[]);async function N(){if(d){y(!0);try{await _.post(`admin/worker-tokens/${d.id}/revoke`),i(!1),l(null),p()}catch{}finally{y(!1)}}}function k(t){u(!1),a(t),p()}const j=n.useMemo(()=>(m??[]).filter(t=>x||t.status!==w.REVOKED),[m,x]);return e.jsxs("div",{className:"font-mono",children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:r("admin.tokens_title")}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("admin.tokens_subtitle")})]}),e.jsxs("button",{type:"button",className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity",onClick:()=>u(!0),children:[e.jsx(q,{className:"h-3.5 w-3.5"}),r("admin.generate_token")]})]}),!g&&(m==null?void 0:m.some(t=>t.status===w.REVOKED))&&e.jsx("div",{className:"mb-4 flex items-center gap-2",children:e.jsx("button",{type:"button",onClick:()=>c(!x),className:`text-xs transition-colors ${x?"text-[var(--text-primary)]":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:r(x?"admin.hide_revoked":"admin.show_revoked")})}),g?e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsx(z,{rows:3})}):j.length===0?e.jsx(B,{icon:J,title:r("admin.no_worker_tokens"),description:r("admin.generate_token_desc"),actionLabel:r("admin.generate_token"),onAction:()=>u(!0)}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden md:block overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] text-left text-[var(--text-muted)]",children:[e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.label")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.purpose")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.status")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("common.created_at")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.expires_at")}),e.jsx("th",{className:"pb-2 font-normal",children:r("common.actions")})]})}),e.jsx("tbody",{children:j.map(t=>e.jsxs("tr",{className:"border-b border-[var(--border-row)] hover:bg-white/[0.02] transition-colors",children:[e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-primary)]",children:t.label}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:t.purpose}),e.jsx("td",{className:"py-2.5 pr-4",children:e.jsx("span",{className:E(t.status),children:t.status})}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-muted)]",children:new Date(t.createdAt).toLocaleDateString()}),e.jsx("td",{className:"py-2.5 pr-4",children:t.expiresAt?e.jsx("span",{className:"text-[var(--text-secondary)]",children:new Date(t.expiresAt).toLocaleDateString()}):e.jsx("span",{className:"text-[var(--text-muted)]",children:"—"})}),e.jsx("td",{className:"py-2.5",children:t.status===w.ACTIVE&&e.jsxs("button",{type:"button",className:"flex items-center gap-1 rounded-[4px] px-2 py-1 text-red-400 hover:text-red-300 hover:bg-white/[0.05] transition-colors",onClick:()=>{l(t),i(!0)},children:[e.jsx(S,{className:"h-3.5 w-3.5"}),r("admin.revoke")]})})]},t.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3",children:j.map(t=>e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-xs text-[var(--text-primary)] font-medium truncate mr-2",children:t.label}),e.jsx("span",{className:`text-[11px] shrink-0 ${E(t.status)}`,children:t.status})]}),e.jsx("div",{className:"text-[11px] text-[var(--text-secondary)] truncate mb-1",children:t.purpose}),e.jsxs("div",{className:"flex items-center justify-between text-[11px] text-[var(--text-muted)]",children:[e.jsx("span",{children:new Date(t.createdAt).toLocaleDateString()}),t.expiresAt&&e.jsx("span",{children:new Date(t.expiresAt).toLocaleDateString()})]}),t.status===w.ACTIVE&&e.jsx("div",{className:"mt-2 pt-2 border-t border-[var(--border)]",children:e.jsxs("button",{type:"button",className:"flex items-center gap-1 rounded-[4px] px-2 py-1 text-[11px] text-red-400 hover:text-red-300 hover:bg-white/[0.05] transition-colors",onClick:()=>{l(t),i(!0)},children:[e.jsx(S,{className:"h-3.5 w-3.5"}),r("admin.revoke")]})})]},t.id))})]}),e.jsx(G,{isOpen:f,onClose:()=>u(!1),onCreated:k}),s&&e.jsx(Q,{isOpen:!!s,token:s.token,tokenId:s.id,onClose:()=>a(null)}),e.jsx(O,{isOpen:o,onClose:()=>{i(!1),l(null)},onConfirm:N,title:r("admin.revoke_token"),message:r("admin.revoke_token_confirm",{label:(d==null?void 0:d.label)??""}),confirmLabel:r("admin.revoke"),confirmVariant:"danger",isLoading:h})]})}export{ce as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as m,r as e,j as t}from"./index-
|
|
1
|
+
import{$ as m,r as e,j as t}from"./index-CzELujVH.js";var b=m();function g({content:n,children:a,delay:l=100,className:i}){const[p,c]=e.useState(!1),[u,f]=e.useState({top:0,left:0}),r=e.useRef(null),o=e.useRef(null),x=e.useCallback(()=>{r.current=setTimeout(()=>{if(o.current){const s=o.current.getBoundingClientRect();f({top:s.top-4,left:s.left+s.width/2})}c(!0)},l)},[l]),d=e.useCallback(()=>{r.current&&(clearTimeout(r.current),r.current=null),c(!1)},[]);return n?t.jsxs(t.Fragment,{children:[t.jsx("span",{ref:o,onMouseEnter:x,onMouseLeave:d,className:i,children:a}),p&&b.createPortal(t.jsx("div",{role:"tooltip",style:{position:"fixed",top:u.top,left:u.left,transform:"translate(-50%, -100%)",zIndex:9999},className:"pointer-events-none max-w-sm rounded-[4px] bg-[var(--bg-card)] px-2.5 py-1.5 text-xs text-[var(--text-primary)] shadow-lg border border-[var(--border-row)] preserve-case",children:n}),document.body)]}):t.jsx(t.Fragment,{children:a})}export{g as T};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{R as A,g as he,f as fe,u as Y,a as me,r as _,j as M,h as W,t as ge}from"./index-
|
|
1
|
+
import{R as A,g as he,f as fe,u as Y,a as me,r as _,j as M,h as W,t as ge}from"./index-CzELujVH.js";var pe=Object.defineProperty,j=Object.getOwnPropertySymbols,X=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable,V=(u,a,i)=>a in u?pe(u,a,{enumerable:!0,configurable:!0,writable:!0,value:i}):u[a]=i,k=(u,a)=>{for(var i in a||(a={}))X.call(a,i)&&V(u,i,a[i]);if(j)for(var i of j(a))K.call(a,i)&&V(u,i,a[i]);return u},U=(u,a)=>{var i={};for(var l in u)X.call(u,l)&&a.indexOf(l)<0&&(i[l]=u[l]);if(u!=null&&j)for(var l of j(u))a.indexOf(l)<0&&K.call(u,l)&&(i[l]=u[l]);return i};/**
|
|
2
2
|
* @license QR Code generator library (TypeScript)
|
|
3
3
|
* Copyright (c) Project Nayuki.
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as h,j as e,s as A,B as de,f as xe,r as l,u as me,k as z,x as pe,W as b,D as S,L as ue,V as K,h as N,l as be}from"./index-Bgvmej4n.js";import{t as ve,c as Y}from"./date-CmcdoD87.js";import{w as he,b as ge,t as we}from"./status-colors-DFKrrbb3.js";import{I as x}from"./InfoRow-CoZ0eUXB.js";import{M}from"./MetricBar-CUJBXzX_.js";import{u as je}from"./useFetch-BNnhvwY-.js";import{T as fe}from"./Tooltip-DsPnaAbV.js";import{T as Z}from"./trash-2-xUbm8lqm.js";import{A as ke}from"./arrow-left-BSsK0_W1.js";import{C as Ne}from"./chevron-left-CuehXDpM.js";import{C as ye}from"./chevron-right-DUzlRcbw.js";function Ce({isOpen:t,onClose:n,onConfirm:r,workerName:o,isDraining:i,loading:d}){const{t:c}=h();return e.jsx(A,{isOpen:t,onClose:n,onConfirm:r,title:c(i?"workers.undrain_worker_title":"workers.drain_worker_title"),message:i?c("workers.undrain_confirm",{name:o}):c("workers.drain_confirm",{name:o}),confirmLabel:c(i?"workers.undrain":"workers.drain"),confirmVariant:i?"accent":"warning",isLoading:d})}const _e=20;function ee(t){return t==="rate_limit"?"rate limited":t}function Se(t,n){return n(t==="binary_missing"?"workers.manual_restore_required":"workers.awaiting_auto_recovery")}function Ue(){var H,B;const{id:t}=de(),n=xe(),{t:r}=h(),[o,i]=l.useState(!1),[d,c]=l.useState(!1),[D,p]=l.useState(!1),[T,E]=l.useState(!1),[re,y]=l.useState(!1),[se,$]=l.useState(!1),[L,C]=l.useState(null),g=me(a=>{var u;return(u=a.user)==null?void 0:u.role}),te=z(a=>a.workerSeq),ae=z(a=>a.taskSeq),[w,P]=l.useState(void 0),[v,R]=l.useState([]),{data:m,loading:ne,error:F,refetch:I}=je(async()=>{if(!t)throw new Error("Missing worker ID");const a={limit:String(_e)};w&&(a.cursor=w);const[u,k]=await Promise.all([N.get(`web/workers/${t}`).json(),N.get(`web/workers/${t}/tasks`,{searchParams:a}).json().catch(()=>({data:[],nextCursor:null}))]);return{worker:u,tasks:k.data,nextCursor:k.nextCursor}},[t,te,ae,w]),s=(m==null?void 0:m.worker)??null,U=(m==null?void 0:m.tasks)??[],j=(m==null?void 0:m.nextCursor)??null,W=l.useCallback(()=>{j&&(R(a=>[...a,w??""]),P(j))},[j,w]),q=l.useCallback(()=>{v.length!==0&&(P(v.at(-1)||void 0),R(a=>a.slice(0,-1)))},[v]),G=v.length+1,V=g===S.LEAD||g===S.ADMIN;pe(l.useMemo(()=>!s||s.status===b.DECOMMISSIONED?null:e.jsxs("div",{className:"flex items-center gap-2",children:[s.status===b.ONLINE&&e.jsxs("button",{onClick:()=>i(!0),className:"rounded-[4px] border border-[var(--warning)]/40 px-3 py-1.5 text-xs text-[var(--warning)] hover:bg-[var(--warning)]/10 transition-colors",children:["> ",r("workers.drain")]}),g===S.ADMIN&&e.jsxs("button",{onClick:()=>p(!0),className:"flex items-center gap-1 rounded-[4px] border border-[var(--destructive)]/40 px-3 py-1.5 text-xs text-[var(--destructive)] hover:bg-[var(--destructive)]/10 transition-colors",children:[e.jsx(Z,{className:"h-3 w-3"}),r("workers.decommission")]})]}),[s,g,r]));async function oe(){if(s){c(!0);try{const a=s.status===b.DRAINING?"undrain":"drain";await N.post(`web/workers/${s.id}/${a}`),await I()}catch{}finally{c(!1),i(!1)}}}async function ie(){if(s){E(!0);try{await N.delete(`admin/workers/${s.id}`),n("/workers")}catch{}finally{E(!1),p(!1)}}}async function le(){if(!(!s||!L)){$(!0);try{await N.post(`web/workers/${s.id}/capabilities/${encodeURIComponent(L)}/restore`),await I()}catch{}finally{$(!1),y(!1),C(null)}}}if(ne)return e.jsx("div",{className:"mx-auto max-w-5xl px-4 md:px-6 py-8 font-mono",children:e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:r("workers.loading_worker")})});if(F)return e.jsxs("div",{className:"mx-auto max-w-5xl px-4 md:px-6 py-8 font-mono lowercase text-center",children:[e.jsx("p",{className:"text-sm text-[var(--destructive)]",children:F}),e.jsx("button",{onClick:()=>I(),className:"mt-4 rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:r("common.retry")})]});if(!s)return e.jsxs("div",{className:"mx-auto max-w-5xl px-4 md:px-6 py-8 font-mono lowercase text-center",children:[e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:r("workers.worker_not_found")}),e.jsxs("button",{onClick:()=>n("/workers"),className:"mt-4 rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:["< ",r("workers.back_to_workers")]})]});const _=s.status===b.DRAINING,f=s.status!==b.DECOMMISSIONED;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mx-auto max-w-5xl font-mono lowercase",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] bg-[var(--bg-primary)] px-4 shrink-0 md:hidden",style:{height:56},children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("button",{onClick:()=>n("/workers"),className:"shrink-0 text-[var(--text-muted)]",children:e.jsx(ke,{className:"h-4 w-4"})}),e.jsx("span",{className:"truncate text-sm font-medium text-[var(--text-primary)]",children:s.name})]}),!_&&s.status!==b.OFFLINE&&f&&e.jsxs("button",{onClick:()=>i(!0),className:"shrink-0 rounded-[4px] border border-[var(--warning)]/40 px-3 py-1.5 text-xs text-[var(--warning)] hover:bg-[var(--warning)]/10 transition-colors",children:["> ",r("workers.drain")]})]}),e.jsxs("div",{className:"px-4 md:px-6 py-8",children:[_?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx(ue,{to:"/workers",className:"text-[var(--text-muted)] hover:text-[var(--text-secondary)] transition-colors",children:r("workers.title")}),e.jsx("span",{className:"text-[var(--text-muted)]",children:"/"}),e.jsx("span",{className:"text-[var(--text-secondary)]",children:s.name})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[f&&e.jsxs("button",{onClick:()=>i(!0),className:"rounded-[4px] border border-[var(--accent)] px-4 py-1.5 text-xs text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors",children:["> ",r("workers.undrain")]}),g===S.ADMIN&&f&&e.jsxs("button",{onClick:()=>p(!0),className:"flex items-center gap-1 rounded-[4px] border border-[var(--destructive)]/40 px-3 py-1.5 text-xs text-[var(--destructive)] hover:bg-[var(--destructive)]/10 transition-colors",children:[e.jsx(Z,{className:"h-3 w-3"}),r("workers.decommission")]})]})]}),e.jsx("div",{className:"mb-4",children:e.jsx("span",{className:"rounded-[4px] bg-[var(--warning)]/20 px-2.5 py-1 text-xs font-medium text-[var(--warning)]",children:r("workers.draining")})}),e.jsxs("div",{className:"mb-6 rounded-[4px] border border-[var(--warning)]/40 bg-[var(--warning)]/10 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(K,{className:"h-3.5 w-3.5 text-[var(--warning)]"}),e.jsx("span",{className:"text-xs text-[var(--warning)]",children:r("workers.draining_warning")})]}),e.jsx("p",{className:"text-xs text-[var(--warning)]/70 ml-5.5",children:r("workers.draining_active_tasks")})]}),e.jsxs("div",{className:"mb-6 grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsx(O,{label:r("workers.cpu"),value:s.cpuUsage,unit:"%"}),e.jsx(O,{label:r("workers.memory"),value:s.memoryUsage,unit:"%"}),e.jsx(O,{label:r("workers.disk"),value:s.diskUsage,unit:"%"}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("workers.slots")}),e.jsxs("p",{className:"mt-2 text-lg font-semibold text-[var(--text-primary)]",children:[s.activeSlots,"/",s.maxSlots]})]})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>n("/workers"),className:"mb-4 text-xs text-[var(--text-muted)] hover:text-[var(--text-secondary)] transition-colors",children:["< ",r("workers.back_to_workers")]}),e.jsxs("h1",{className:"mb-2 text-lg font-bold text-[var(--text-primary)] flex items-center gap-2",children:[s.name,e.jsxs("span",{className:"flex items-center gap-1.5 text-sm font-normal",style:{color:he[s.status]},children:[e.jsx("span",{style:{fontSize:"0.5rem"},children:"●"}),s.status.toLowerCase()]})]}),e.jsx("p",{className:"mb-6 text-xs text-[var(--text-muted)]",children:r("workers.last_heartbeat",{time:ve(s.lastHeartbeat,"never")})}),s.status===b.DECOMMISSIONED&&e.jsx("div",{className:"mb-6 rounded-[4px] border border-[var(--text-muted)]/40 bg-[var(--text-muted)]/10 p-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(K,{className:"h-3.5 w-3.5 text-[var(--text-muted)]"}),e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["this worker has been decommissioned",s.decommissionedAt?` on ${Y(s.decommissionedAt)}`:""," and can no longer accept tasks."]})]})}),e.jsxs("div",{className:"mb-6 grid gap-4 lg:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("h2",{className:"mb-3 text-xs text-[var(--text-muted)]",children:r("workers.resource_usage")}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(M,{label:r("workers.cpu"),value:s.cpuUsage}),e.jsx(M,{label:r("workers.mem"),value:s.memoryUsage}),e.jsx(M,{label:r("workers.disk"),value:s.diskUsage})]})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("h2",{className:"mb-3 text-xs text-[var(--text-muted)]",children:r("workers.connection_info")}),e.jsx(Q,{worker:s})]})]})]}),_?e.jsxs(e.Fragment,{children:[e.jsx(X,{title:r("workers.active_tasks"),tasks:U,navigate:n,nextCursor:j,pageNumber:G,hasPrev:v.length>0,onNext:W,onPrev:q}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"mb-4 text-sm font-medium text-[var(--accent)]",children:r("workers.capabilities")}),s.capabilities.length>0?e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:s.capabilities.map(a=>e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsx("p",{className:"text-xs text-[var(--text-primary)]",children:a})},a))}):e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("workers.no_capabilities_short")}),(((H=s.degradedCapabilities)==null?void 0:H.length)??0)>0&&e.jsx("div",{className:"mt-3 space-y-2",children:s.degradedCapabilities.map(a=>e.jsx(J,{agentType:a.agentType,failureType:a.failureType,failureCount:a.failureCount,showRestore:V&&f,onRestore:()=>{C(a.agentType),y(!0)}},a.agentType))})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"mb-4 text-sm font-medium text-[var(--accent)]",children:r("workers.worker_info")}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:e.jsx(Q,{worker:s,showExtended:!0})})]})]}):e.jsxs(e.Fragment,{children:[s.capabilities.length>0&&e.jsxs("div",{className:"mb-6 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("h2",{className:"mb-3 text-xs text-[var(--text-muted)]",children:r("workers.capabilities")}),e.jsx("div",{className:"flex flex-wrap gap-2",children:s.capabilities.map(a=>{var k;const u=(k=s.degradedCapabilities)==null?void 0:k.find(ce=>ce.agentType===a);return e.jsxs("span",{className:`rounded-[4px] border px-2.5 py-1 text-xs ${u?"border-[var(--warning)] text-[var(--warning)] bg-[var(--warning)]/5":"border-[var(--border)] text-[var(--text-secondary)]"}`,children:[a,u&&e.jsx("span",{className:"ml-1.5 text-[10px]",children:ee(u.failureType)})]},a)})}),(((B=s.degradedCapabilities)==null?void 0:B.length)??0)>0&&e.jsx("div",{className:"mt-3 space-y-2",children:s.degradedCapabilities.map(a=>e.jsx(J,{agentType:a.agentType,failureType:a.failureType,failureCount:a.failureCount,showRestore:V&&f,onRestore:()=>{C(a.agentType),y(!0)}},a.agentType))})]}),e.jsx(X,{title:r("workers.current_tasks"),tasks:U,navigate:n,nextCursor:j,pageNumber:G,hasPrev:v.length>0,onNext:W,onPrev:q})]})]})]}),e.jsx(Ce,{isOpen:o,onClose:()=>i(!1),onConfirm:oe,workerName:s.name,isDraining:_,loading:d}),e.jsx(A,{isOpen:D,onClose:()=>p(!1),onConfirm:ie,title:r("workers.decommission_title"),message:r("workers.decommission_confirm",{name:s.name}),confirmLabel:r("workers.decommission"),confirmVariant:"danger",isLoading:T}),e.jsx(A,{isOpen:re,onClose:()=>{y(!1),C(null)},onConfirm:le,title:r("workers.restore_capability_title"),message:r("workers.restore_capability_confirm",{capability:L??r("workers.unknown"),name:s.name}),confirmLabel:r("workers.restore_capability"),confirmVariant:"accent",isLoading:se})]})}function J({agentType:t,failureType:n,failureCount:r,showRestore:o,onRestore:i}){const{t:d}=h();return e.jsx("div",{className:"rounded-[4px] border border-[var(--warning)] bg-[var(--warning)]/5 p-3 text-sm",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"font-medium",children:t}),e.jsxs("span",{className:"text-[var(--text-muted)] ml-2 text-xs",children:[ee(n)," · ",r," consecutive failure",r!==1?"s":""," · ",Se(n,d)]})]}),o&&e.jsx("button",{type:"button",onClick:i,className:"shrink-0 rounded-[4px] border border-[var(--accent)]/40 px-2.5 py-1 text-xs text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors",children:d("workers.restore_capability")})]})})}function Q({worker:t,showExtended:n=!1}){const{t:r}=h();return e.jsxs("div",{className:"flex flex-col gap-2 text-xs",children:[e.jsx(x,{label:r("workers.worker_id"),value:t.id}),e.jsx(x,{label:r("workers.host"),value:t.host}),e.jsx(x,{label:r("workers.os"),value:t.os??r("workers.unknown")}),e.jsx(x,{label:r("workers.cpu_model"),value:t.cpuModel??r("workers.n_a")}),e.jsx(x,{label:r("workers.cpu_cores"),value:t.cpuCores!=null?String(t.cpuCores):r("workers.n_a")}),e.jsx(x,{label:r("workers.memory"),value:t.memoryGb!=null?`${t.memoryGb} gb`:r("workers.n_a")}),e.jsx(x,{label:r("workers.last_heartbeat_label"),value:Y(t.lastHeartbeat)}),e.jsx(x,{label:r("workers.slots"),value:`${t.activeSlots}/${t.maxSlots}`}),n&&e.jsxs(e.Fragment,{children:[e.jsx(x,{label:r("workers.status_label"),value:t.status.toLowerCase()}),e.jsx(x,{label:r("workers.worker_version"),value:t.workerVersion??r("workers.n_a")})]})]})}function X({title:t,tasks:n,navigate:r,nextCursor:o,pageNumber:i,hasPrev:d,onNext:c,onPrev:D}){const{t:p}=h(),T=d||!!o;return e.jsxs("div",{className:"mb-6 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("h2",{className:"mb-3 text-xs text-[var(--text-muted)]",children:t}),n.length===0&&!d?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-6",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:p("workers.no_active_tasks")})]}):e.jsxs(e.Fragment,{children:[e.jsx(De,{tasks:n,navigate:r}),T&&e.jsxs("div",{className:"mt-3 flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["// page ",i]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:D,disabled:!d,className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:border-[var(--accent)] disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:[e.jsx(Ne,{className:"h-3.5 w-3.5"}),p("tasks.prev")]}),e.jsxs("button",{onClick:c,disabled:!o,className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:border-[var(--accent)] disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:[p("common.next"),e.jsx(ye,{className:"h-3.5 w-3.5"})]})]})]})]})]})}function De({tasks:t,navigate:n}){const{t:r}=h();return e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border-row)]",children:[e.jsx("th",{className:"py-2 pr-4 text-left font-normal text-[var(--text-muted)]",children:r("workers.id")}),e.jsx("th",{className:"py-2 pr-4 text-left font-normal text-[var(--text-muted)]",children:r("workers.description")}),e.jsx("th",{className:"py-2 pr-4 text-left font-normal text-[var(--text-muted)]",children:r("workers.status_label")}),e.jsx("th",{className:"py-2 text-left font-normal text-[var(--text-muted)]",children:r("workers.stage")})]})}),e.jsx("tbody",{children:t.map(o=>e.jsxs("tr",{onClick:()=>n(`/tasks/${o.id}`),className:"cursor-pointer border-b border-[var(--border-row)] hover:bg-[var(--bg-input)] transition-colors",children:[e.jsxs("td",{className:"py-2 pr-4 text-[var(--text-primary)]",children:["#",o.id]}),e.jsx("td",{className:"max-w-[120px] md:max-w-xs truncate py-2 pr-4 text-[var(--text-secondary)] preserve-case",children:e.jsx(fe,{content:o.description,children:be(o)})}),e.jsx("td",{className:"py-2 pr-4",children:e.jsxs("span",{style:{color:we[o.status]},children:["● ",o.status.toLowerCase()]})}),e.jsx("td",{className:"py-2 text-[var(--text-secondary)]",children:o.currentStage??"-"})]},o.id))})]})})}function O({label:t,value:n,unit:r}){const o=Math.round(n*100);return e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:t}),e.jsxs("p",{className:"mt-2 text-lg font-semibold text-[var(--text-primary)]",children:[o,r]}),e.jsx("div",{className:"mt-3 h-1.5 w-full rounded-[2px] bg-[var(--bg-input)]",children:e.jsx("div",{className:"h-full rounded-[2px] transition-all",style:{width:`${o}%`,backgroundColor:ge(n)}})})]})}export{Ue as default};
|
|
1
|
+
import{a as h,j as e,s as A,B as de,f as xe,r as l,u as me,k as z,x as pe,W as b,D as S,L as ue,V as K,h as N,l as be}from"./index-CzELujVH.js";import{t as ve,c as Y}from"./date-CmcdoD87.js";import{w as he,b as ge,t as we}from"./status-colors-cjNKu-0M.js";import{I as x}from"./InfoRow-DqaKPbde.js";import{M}from"./MetricBar-D7sK0jEq.js";import{u as je}from"./useFetch-DOTFwxss.js";import{T as fe}from"./Tooltip-BqCa4MNE.js";import{T as Z}from"./trash-2-Cah2gSau.js";import{A as ke}from"./arrow-left-DqInn209.js";import{C as Ne}from"./chevron-left-BxCm1rXX.js";import{C as ye}from"./chevron-right-JjA_YKtJ.js";function Ce({isOpen:t,onClose:n,onConfirm:r,workerName:o,isDraining:i,loading:d}){const{t:c}=h();return e.jsx(A,{isOpen:t,onClose:n,onConfirm:r,title:c(i?"workers.undrain_worker_title":"workers.drain_worker_title"),message:i?c("workers.undrain_confirm",{name:o}):c("workers.drain_confirm",{name:o}),confirmLabel:c(i?"workers.undrain":"workers.drain"),confirmVariant:i?"accent":"warning",isLoading:d})}const _e=20;function ee(t){return t==="rate_limit"?"rate limited":t}function Se(t,n){return n(t==="binary_missing"?"workers.manual_restore_required":"workers.awaiting_auto_recovery")}function Ue(){var H,B;const{id:t}=de(),n=xe(),{t:r}=h(),[o,i]=l.useState(!1),[d,c]=l.useState(!1),[D,p]=l.useState(!1),[T,E]=l.useState(!1),[re,y]=l.useState(!1),[se,$]=l.useState(!1),[L,C]=l.useState(null),g=me(a=>{var u;return(u=a.user)==null?void 0:u.role}),te=z(a=>a.workerSeq),ae=z(a=>a.taskSeq),[w,P]=l.useState(void 0),[v,R]=l.useState([]),{data:m,loading:ne,error:F,refetch:I}=je(async()=>{if(!t)throw new Error("Missing worker ID");const a={limit:String(_e)};w&&(a.cursor=w);const[u,k]=await Promise.all([N.get(`web/workers/${t}`).json(),N.get(`web/workers/${t}/tasks`,{searchParams:a}).json().catch(()=>({data:[],nextCursor:null}))]);return{worker:u,tasks:k.data,nextCursor:k.nextCursor}},[t,te,ae,w]),s=(m==null?void 0:m.worker)??null,U=(m==null?void 0:m.tasks)??[],j=(m==null?void 0:m.nextCursor)??null,W=l.useCallback(()=>{j&&(R(a=>[...a,w??""]),P(j))},[j,w]),q=l.useCallback(()=>{v.length!==0&&(P(v.at(-1)||void 0),R(a=>a.slice(0,-1)))},[v]),G=v.length+1,V=g===S.LEAD||g===S.ADMIN;pe(l.useMemo(()=>!s||s.status===b.DECOMMISSIONED?null:e.jsxs("div",{className:"flex items-center gap-2",children:[s.status===b.ONLINE&&e.jsxs("button",{onClick:()=>i(!0),className:"rounded-[4px] border border-[var(--warning)]/40 px-3 py-1.5 text-xs text-[var(--warning)] hover:bg-[var(--warning)]/10 transition-colors",children:["> ",r("workers.drain")]}),g===S.ADMIN&&e.jsxs("button",{onClick:()=>p(!0),className:"flex items-center gap-1 rounded-[4px] border border-[var(--destructive)]/40 px-3 py-1.5 text-xs text-[var(--destructive)] hover:bg-[var(--destructive)]/10 transition-colors",children:[e.jsx(Z,{className:"h-3 w-3"}),r("workers.decommission")]})]}),[s,g,r]));async function oe(){if(s){c(!0);try{const a=s.status===b.DRAINING?"undrain":"drain";await N.post(`web/workers/${s.id}/${a}`),await I()}catch{}finally{c(!1),i(!1)}}}async function ie(){if(s){E(!0);try{await N.delete(`admin/workers/${s.id}`),n("/workers")}catch{}finally{E(!1),p(!1)}}}async function le(){if(!(!s||!L)){$(!0);try{await N.post(`web/workers/${s.id}/capabilities/${encodeURIComponent(L)}/restore`),await I()}catch{}finally{$(!1),y(!1),C(null)}}}if(ne)return e.jsx("div",{className:"mx-auto max-w-5xl px-4 md:px-6 py-8 font-mono",children:e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:r("workers.loading_worker")})});if(F)return e.jsxs("div",{className:"mx-auto max-w-5xl px-4 md:px-6 py-8 font-mono lowercase text-center",children:[e.jsx("p",{className:"text-sm text-[var(--destructive)]",children:F}),e.jsx("button",{onClick:()=>I(),className:"mt-4 rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:r("common.retry")})]});if(!s)return e.jsxs("div",{className:"mx-auto max-w-5xl px-4 md:px-6 py-8 font-mono lowercase text-center",children:[e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:r("workers.worker_not_found")}),e.jsxs("button",{onClick:()=>n("/workers"),className:"mt-4 rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:["< ",r("workers.back_to_workers")]})]});const _=s.status===b.DRAINING,f=s.status!==b.DECOMMISSIONED;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mx-auto max-w-5xl font-mono lowercase",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] bg-[var(--bg-primary)] px-4 shrink-0 md:hidden",style:{height:56},children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("button",{onClick:()=>n("/workers"),className:"shrink-0 text-[var(--text-muted)]",children:e.jsx(ke,{className:"h-4 w-4"})}),e.jsx("span",{className:"truncate text-sm font-medium text-[var(--text-primary)]",children:s.name})]}),!_&&s.status!==b.OFFLINE&&f&&e.jsxs("button",{onClick:()=>i(!0),className:"shrink-0 rounded-[4px] border border-[var(--warning)]/40 px-3 py-1.5 text-xs text-[var(--warning)] hover:bg-[var(--warning)]/10 transition-colors",children:["> ",r("workers.drain")]})]}),e.jsxs("div",{className:"px-4 md:px-6 py-8",children:[_?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx(ue,{to:"/workers",className:"text-[var(--text-muted)] hover:text-[var(--text-secondary)] transition-colors",children:r("workers.title")}),e.jsx("span",{className:"text-[var(--text-muted)]",children:"/"}),e.jsx("span",{className:"text-[var(--text-secondary)]",children:s.name})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[f&&e.jsxs("button",{onClick:()=>i(!0),className:"rounded-[4px] border border-[var(--accent)] px-4 py-1.5 text-xs text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors",children:["> ",r("workers.undrain")]}),g===S.ADMIN&&f&&e.jsxs("button",{onClick:()=>p(!0),className:"flex items-center gap-1 rounded-[4px] border border-[var(--destructive)]/40 px-3 py-1.5 text-xs text-[var(--destructive)] hover:bg-[var(--destructive)]/10 transition-colors",children:[e.jsx(Z,{className:"h-3 w-3"}),r("workers.decommission")]})]})]}),e.jsx("div",{className:"mb-4",children:e.jsx("span",{className:"rounded-[4px] bg-[var(--warning)]/20 px-2.5 py-1 text-xs font-medium text-[var(--warning)]",children:r("workers.draining")})}),e.jsxs("div",{className:"mb-6 rounded-[4px] border border-[var(--warning)]/40 bg-[var(--warning)]/10 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(K,{className:"h-3.5 w-3.5 text-[var(--warning)]"}),e.jsx("span",{className:"text-xs text-[var(--warning)]",children:r("workers.draining_warning")})]}),e.jsx("p",{className:"text-xs text-[var(--warning)]/70 ml-5.5",children:r("workers.draining_active_tasks")})]}),e.jsxs("div",{className:"mb-6 grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsx(O,{label:r("workers.cpu"),value:s.cpuUsage,unit:"%"}),e.jsx(O,{label:r("workers.memory"),value:s.memoryUsage,unit:"%"}),e.jsx(O,{label:r("workers.disk"),value:s.diskUsage,unit:"%"}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("workers.slots")}),e.jsxs("p",{className:"mt-2 text-lg font-semibold text-[var(--text-primary)]",children:[s.activeSlots,"/",s.maxSlots]})]})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>n("/workers"),className:"mb-4 text-xs text-[var(--text-muted)] hover:text-[var(--text-secondary)] transition-colors",children:["< ",r("workers.back_to_workers")]}),e.jsxs("h1",{className:"mb-2 text-lg font-bold text-[var(--text-primary)] flex items-center gap-2",children:[s.name,e.jsxs("span",{className:"flex items-center gap-1.5 text-sm font-normal",style:{color:he[s.status]},children:[e.jsx("span",{style:{fontSize:"0.5rem"},children:"●"}),s.status.toLowerCase()]})]}),e.jsx("p",{className:"mb-6 text-xs text-[var(--text-muted)]",children:r("workers.last_heartbeat",{time:ve(s.lastHeartbeat,"never")})}),s.status===b.DECOMMISSIONED&&e.jsx("div",{className:"mb-6 rounded-[4px] border border-[var(--text-muted)]/40 bg-[var(--text-muted)]/10 p-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(K,{className:"h-3.5 w-3.5 text-[var(--text-muted)]"}),e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["this worker has been decommissioned",s.decommissionedAt?` on ${Y(s.decommissionedAt)}`:""," and can no longer accept tasks."]})]})}),e.jsxs("div",{className:"mb-6 grid gap-4 lg:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("h2",{className:"mb-3 text-xs text-[var(--text-muted)]",children:r("workers.resource_usage")}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(M,{label:r("workers.cpu"),value:s.cpuUsage}),e.jsx(M,{label:r("workers.mem"),value:s.memoryUsage}),e.jsx(M,{label:r("workers.disk"),value:s.diskUsage})]})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("h2",{className:"mb-3 text-xs text-[var(--text-muted)]",children:r("workers.connection_info")}),e.jsx(Q,{worker:s})]})]})]}),_?e.jsxs(e.Fragment,{children:[e.jsx(X,{title:r("workers.active_tasks"),tasks:U,navigate:n,nextCursor:j,pageNumber:G,hasPrev:v.length>0,onNext:W,onPrev:q}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"mb-4 text-sm font-medium text-[var(--accent)]",children:r("workers.capabilities")}),s.capabilities.length>0?e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:s.capabilities.map(a=>e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsx("p",{className:"text-xs text-[var(--text-primary)]",children:a})},a))}):e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("workers.no_capabilities_short")}),(((H=s.degradedCapabilities)==null?void 0:H.length)??0)>0&&e.jsx("div",{className:"mt-3 space-y-2",children:s.degradedCapabilities.map(a=>e.jsx(J,{agentType:a.agentType,failureType:a.failureType,failureCount:a.failureCount,showRestore:V&&f,onRestore:()=>{C(a.agentType),y(!0)}},a.agentType))})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"mb-4 text-sm font-medium text-[var(--accent)]",children:r("workers.worker_info")}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:e.jsx(Q,{worker:s,showExtended:!0})})]})]}):e.jsxs(e.Fragment,{children:[s.capabilities.length>0&&e.jsxs("div",{className:"mb-6 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("h2",{className:"mb-3 text-xs text-[var(--text-muted)]",children:r("workers.capabilities")}),e.jsx("div",{className:"flex flex-wrap gap-2",children:s.capabilities.map(a=>{var k;const u=(k=s.degradedCapabilities)==null?void 0:k.find(ce=>ce.agentType===a);return e.jsxs("span",{className:`rounded-[4px] border px-2.5 py-1 text-xs ${u?"border-[var(--warning)] text-[var(--warning)] bg-[var(--warning)]/5":"border-[var(--border)] text-[var(--text-secondary)]"}`,children:[a,u&&e.jsx("span",{className:"ml-1.5 text-[10px]",children:ee(u.failureType)})]},a)})}),(((B=s.degradedCapabilities)==null?void 0:B.length)??0)>0&&e.jsx("div",{className:"mt-3 space-y-2",children:s.degradedCapabilities.map(a=>e.jsx(J,{agentType:a.agentType,failureType:a.failureType,failureCount:a.failureCount,showRestore:V&&f,onRestore:()=>{C(a.agentType),y(!0)}},a.agentType))})]}),e.jsx(X,{title:r("workers.current_tasks"),tasks:U,navigate:n,nextCursor:j,pageNumber:G,hasPrev:v.length>0,onNext:W,onPrev:q})]})]})]}),e.jsx(Ce,{isOpen:o,onClose:()=>i(!1),onConfirm:oe,workerName:s.name,isDraining:_,loading:d}),e.jsx(A,{isOpen:D,onClose:()=>p(!1),onConfirm:ie,title:r("workers.decommission_title"),message:r("workers.decommission_confirm",{name:s.name}),confirmLabel:r("workers.decommission"),confirmVariant:"danger",isLoading:T}),e.jsx(A,{isOpen:re,onClose:()=>{y(!1),C(null)},onConfirm:le,title:r("workers.restore_capability_title"),message:r("workers.restore_capability_confirm",{capability:L??r("workers.unknown"),name:s.name}),confirmLabel:r("workers.restore_capability"),confirmVariant:"accent",isLoading:se})]})}function J({agentType:t,failureType:n,failureCount:r,showRestore:o,onRestore:i}){const{t:d}=h();return e.jsx("div",{className:"rounded-[4px] border border-[var(--warning)] bg-[var(--warning)]/5 p-3 text-sm",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"font-medium",children:t}),e.jsxs("span",{className:"text-[var(--text-muted)] ml-2 text-xs",children:[ee(n)," · ",r," consecutive failure",r!==1?"s":""," · ",Se(n,d)]})]}),o&&e.jsx("button",{type:"button",onClick:i,className:"shrink-0 rounded-[4px] border border-[var(--accent)]/40 px-2.5 py-1 text-xs text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors",children:d("workers.restore_capability")})]})})}function Q({worker:t,showExtended:n=!1}){const{t:r}=h();return e.jsxs("div",{className:"flex flex-col gap-2 text-xs",children:[e.jsx(x,{label:r("workers.worker_id"),value:t.id}),e.jsx(x,{label:r("workers.host"),value:t.host}),e.jsx(x,{label:r("workers.os"),value:t.os??r("workers.unknown")}),e.jsx(x,{label:r("workers.cpu_model"),value:t.cpuModel??r("workers.n_a")}),e.jsx(x,{label:r("workers.cpu_cores"),value:t.cpuCores!=null?String(t.cpuCores):r("workers.n_a")}),e.jsx(x,{label:r("workers.memory"),value:t.memoryGb!=null?`${t.memoryGb} gb`:r("workers.n_a")}),e.jsx(x,{label:r("workers.last_heartbeat_label"),value:Y(t.lastHeartbeat)}),e.jsx(x,{label:r("workers.slots"),value:`${t.activeSlots}/${t.maxSlots}`}),n&&e.jsxs(e.Fragment,{children:[e.jsx(x,{label:r("workers.status_label"),value:t.status.toLowerCase()}),e.jsx(x,{label:r("workers.worker_version"),value:t.workerVersion??r("workers.n_a")})]})]})}function X({title:t,tasks:n,navigate:r,nextCursor:o,pageNumber:i,hasPrev:d,onNext:c,onPrev:D}){const{t:p}=h(),T=d||!!o;return e.jsxs("div",{className:"mb-6 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("h2",{className:"mb-3 text-xs text-[var(--text-muted)]",children:t}),n.length===0&&!d?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-6",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:p("workers.no_active_tasks")})]}):e.jsxs(e.Fragment,{children:[e.jsx(De,{tasks:n,navigate:r}),T&&e.jsxs("div",{className:"mt-3 flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["// page ",i]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:D,disabled:!d,className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:border-[var(--accent)] disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:[e.jsx(Ne,{className:"h-3.5 w-3.5"}),p("tasks.prev")]}),e.jsxs("button",{onClick:c,disabled:!o,className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:border-[var(--accent)] disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:[p("common.next"),e.jsx(ye,{className:"h-3.5 w-3.5"})]})]})]})]})]})}function De({tasks:t,navigate:n}){const{t:r}=h();return e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border-row)]",children:[e.jsx("th",{className:"py-2 pr-4 text-left font-normal text-[var(--text-muted)]",children:r("workers.id")}),e.jsx("th",{className:"py-2 pr-4 text-left font-normal text-[var(--text-muted)]",children:r("workers.description")}),e.jsx("th",{className:"py-2 pr-4 text-left font-normal text-[var(--text-muted)]",children:r("workers.status_label")}),e.jsx("th",{className:"py-2 text-left font-normal text-[var(--text-muted)]",children:r("workers.stage")})]})}),e.jsx("tbody",{children:t.map(o=>e.jsxs("tr",{onClick:()=>n(`/tasks/${o.id}`),className:"cursor-pointer border-b border-[var(--border-row)] hover:bg-[var(--bg-input)] transition-colors",children:[e.jsxs("td",{className:"py-2 pr-4 text-[var(--text-primary)]",children:["#",o.id]}),e.jsx("td",{className:"max-w-[120px] md:max-w-xs truncate py-2 pr-4 text-[var(--text-secondary)] preserve-case",children:e.jsx(fe,{content:o.description,children:be(o)})}),e.jsx("td",{className:"py-2 pr-4",children:e.jsxs("span",{style:{color:we[o.status]},children:["● ",o.status.toLowerCase()]})}),e.jsx("td",{className:"py-2 text-[var(--text-secondary)]",children:o.currentStage??"-"})]},o.id))})]})})}function O({label:t,value:n,unit:r}){const o=Math.round(n*100);return e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:t}),e.jsxs("p",{className:"mt-2 text-lg font-semibold text-[var(--text-primary)]",children:[o,r]}),e.jsx("div",{className:"mt-3 h-1.5 w-full rounded-[2px] bg-[var(--bg-input)]",children:e.jsx("div",{className:"h-full rounded-[2px] transition-all",style:{width:`${o}%`,backgroundColor:ge(n)}})})]})}export{Ue as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as G,R as U,a as C,j as e,v as q,r as o,h as S,X as K,J as H,f as J,u as V,k as X,W as N,x as Q,D as Y,S as M}from"./index-
|
|
1
|
+
import{c as G,R as U,a as C,j as e,v as q,r as o,h as S,X as K,J as H,f as J,u as V,k as X,W as N,x as Q,D as Y,S as M}from"./index-CzELujVH.js";import{w as W}from"./status-colors-cjNKu-0M.js";import{M as _}from"./MetricBar-D7sK0jEq.js";import Z from"./WorkerSetupGuidePage-BzSnYeI8.js";import{C as A}from"./copy-CkRs-F8C.js";import{L as ee}from"./loader-circle-Br3SI9uE.js";import{S as te}from"./Select-D6BeX24N.js";import{E as re}from"./EmptyState-DmUmVu70.js";import{C as se}from"./Skeleton-BbVk04Qq.js";import{u as ae}from"./useFetch-DOTFwxss.js";import{P as oe}from"./plus-BgYYBOLc.js";import{A as ne}from"./arrow-left-DqInn209.js";import"./key-Bp8O_2z-.js";import"./download-C_PoVs7u.js";import"./settings-C7JWuRQX.js";import"./play-CZuNsRe4.js";import"./wifi-13RzCkO8.js";import"./chevron-down-D0oPuFDK.js";/**
|
|
2
2
|
* @license lucide-react v0.469.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|