@overlordai/server 1.0.144 → 1.0.146
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/database/migrations/014-automations.sql +67 -0
- package/dist/adapters/command-parser.utils.d.ts +1 -0
- package/dist/adapters/command-parser.utils.d.ts.map +1 -1
- package/dist/adapters/command-parser.utils.js +14 -1
- package/dist/adapters/command-parser.utils.js.map +1 -1
- package/dist/adapters/help-text.d.ts.map +1 -1
- package/dist/adapters/help-text.js +2 -1
- package/dist/adapters/help-text.js.map +1 -1
- package/dist/adapters/nlu.service.d.ts.map +1 -1
- package/dist/adapters/nlu.service.js +4 -1
- package/dist/adapters/nlu.service.js.map +1 -1
- package/dist/app.module.d.ts.map +1 -1
- package/dist/app.module.js +2 -0
- package/dist/app.module.js.map +1 -1
- package/dist/automation/automation-executor.d.ts +23 -0
- package/dist/automation/automation-executor.d.ts.map +1 -0
- package/dist/automation/automation-executor.js +365 -0
- package/dist/automation/automation-executor.js.map +1 -0
- package/dist/automation/automation-scheduler.d.ts +21 -0
- package/dist/automation/automation-scheduler.d.ts.map +1 -0
- package/dist/automation/automation-scheduler.js +124 -0
- package/dist/automation/automation-scheduler.js.map +1 -0
- package/dist/automation/automation-template.service.d.ts +30 -0
- package/dist/automation/automation-template.service.d.ts.map +1 -0
- package/dist/automation/automation-template.service.js +66 -0
- package/dist/automation/automation-template.service.js.map +1 -0
- package/dist/automation/automation-trigger.d.ts +13 -0
- package/dist/automation/automation-trigger.d.ts.map +1 -0
- package/dist/automation/automation-trigger.js +96 -0
- package/dist/automation/automation-trigger.js.map +1 -0
- package/dist/automation/automation-validation.d.ts +14 -0
- package/dist/automation/automation-validation.d.ts.map +1 -0
- package/dist/automation/automation-validation.js +66 -0
- package/dist/automation/automation-validation.js.map +1 -0
- package/dist/automation/automation.module.d.ts +3 -0
- package/dist/automation/automation.module.d.ts.map +1 -0
- package/dist/automation/automation.module.js +33 -0
- package/dist/automation/automation.module.js.map +1 -0
- package/dist/automation/automation.service.d.ts +22 -0
- package/dist/automation/automation.service.d.ts.map +1 -0
- package/dist/automation/automation.service.js +232 -0
- package/dist/automation/automation.service.js.map +1 -0
- package/dist/database/database.service.d.ts +8 -0
- package/dist/database/database.service.d.ts.map +1 -1
- package/dist/database/database.service.js +16 -5
- package/dist/database/database.service.js.map +1 -1
- package/dist/database/repositories/automation.repository.d.ts +87 -0
- package/dist/database/repositories/automation.repository.d.ts.map +1 -0
- package/dist/database/repositories/automation.repository.js +531 -0
- package/dist/database/repositories/automation.repository.js.map +1 -0
- package/dist/database/repositories/task.repository.d.ts +1 -0
- package/dist/database/repositories/task.repository.d.ts.map +1 -1
- package/dist/database/repositories/task.repository.js +4 -2
- package/dist/database/repositories/task.repository.js.map +1 -1
- package/dist/database/repository.module.d.ts.map +1 -1
- package/dist/database/repository.module.js +2 -0
- package/dist/database/repository.module.js.map +1 -1
- package/dist/dispatcher/dispatcher.service.d.ts.map +1 -1
- package/dist/dispatcher/dispatcher.service.js +1 -0
- package/dist/dispatcher/dispatcher.service.js.map +1 -1
- package/dist/dispatcher/task-creation.service.d.ts +3 -3
- package/dist/dispatcher/task-creation.service.d.ts.map +1 -1
- package/dist/dispatcher/task-creation.service.js +14 -5
- package/dist/dispatcher/task-creation.service.js.map +1 -1
- package/dist/events/event-types.d.ts +31 -0
- package/dist/events/event-types.d.ts.map +1 -1
- package/dist/events/event-types.js +4 -0
- package/dist/events/event-types.js.map +1 -1
- package/dist/notifier/notification-consumer.d.ts.map +1 -1
- package/dist/notifier/notification-consumer.js +65 -1
- package/dist/notifier/notification-consumer.js.map +1 -1
- package/dist/notifier/notification-event-listener.d.ts +7 -2
- package/dist/notifier/notification-event-listener.d.ts.map +1 -1
- package/dist/notifier/notification-event-listener.js +56 -2
- package/dist/notifier/notification-event-listener.js.map +1 -1
- package/dist/notifier/notifier.service.d.ts +4 -1
- package/dist/notifier/notifier.service.d.ts.map +1 -1
- package/dist/notifier/notifier.service.js +23 -2
- package/dist/notifier/notifier.service.js.map +1 -1
- package/dist/notifier/template.service.d.ts +1 -1
- package/dist/notifier/template.service.d.ts.map +1 -1
- package/dist/notifier/template.service.js +14 -4
- package/dist/notifier/template.service.js.map +1 -1
- package/dist/web/automation.controller.d.ts +74 -0
- package/dist/web/automation.controller.d.ts.map +1 -0
- package/dist/web/automation.controller.js +539 -0
- package/dist/web/automation.controller.js.map +1 -0
- package/dist/web/frame-handlers/automation-report.handler.d.ts +10 -0
- package/dist/web/frame-handlers/automation-report.handler.d.ts.map +1 -0
- package/dist/web/frame-handlers/automation-report.handler.js +15 -0
- package/dist/web/frame-handlers/automation-report.handler.js.map +1 -0
- package/dist/web/frame-handlers/index.d.ts +1 -0
- package/dist/web/frame-handlers/index.d.ts.map +1 -1
- package/dist/web/frame-handlers/index.js +3 -1
- package/dist/web/frame-handlers/index.js.map +1 -1
- package/dist/web/frame-handlers/stage-confirm.handler.d.ts.map +1 -1
- package/dist/web/frame-handlers/stage-confirm.handler.js +1 -1
- package/dist/web/frame-handlers/stage-confirm.handler.js.map +1 -1
- package/dist/web/task.controller.d.ts +3 -0
- package/dist/web/task.controller.d.ts.map +1 -1
- package/dist/web/web-event.service.d.ts +20 -1
- package/dist/web/web-event.service.d.ts.map +1 -1
- package/dist/web/web-event.service.js +66 -2
- package/dist/web/web-event.service.js.map +1 -1
- package/dist/web/web.module.d.ts.map +1 -1
- package/dist/web/web.module.js +4 -1
- package/dist/web/web.module.js.map +1 -1
- package/dist/web/worker-channel.gateway.d.ts +2 -1
- package/dist/web/worker-channel.gateway.d.ts.map +1 -1
- package/dist/web/worker-channel.gateway.js +5 -2
- package/dist/web/worker-channel.gateway.js.map +1 -1
- package/package.json +5 -4
- package/public/assets/AccessTokensPage-jZ0fW6lX.js +1 -0
- package/public/assets/{AdminPage-OHTVG-ck.js → AdminPage-BhEFd__u.js} +1 -1
- package/public/assets/{AgentCliPage-BsZmnI3p.js → AgentCliPage-BlwF0Ske.js} +1 -1
- package/public/assets/{ApiReferencePage-8yiImnYs.js → ApiReferencePage-DYw-AFRb.js} +1 -1
- package/public/assets/{ArchitecturePage-Deswgqy2.js → ArchitecturePage-Bj4s2Tjl.js} +1 -1
- package/public/assets/{AuditLogPage-Hn4ivp8Y.js → AuditLogPage-Dw56aHuy.js} +1 -1
- package/public/assets/AutomationCreatePage-Dt2pGfgf.js +1 -0
- package/public/assets/AutomationDetailPage-DNYkC31X.js +16 -0
- package/public/assets/AutomationEditPage-C8IUsSvR.js +1 -0
- package/public/assets/AutomationListPage-Bqog--Ae.js +16 -0
- package/public/assets/AutomationRunDetailPage-C3PuPibC.js +6 -0
- package/public/assets/{BindPlatformPage-DjGHKswB.js → BindPlatformPage-M_2I5Qrq.js} +1 -1
- package/public/assets/BotIntegrationPage-CAwevaIk.js +1 -0
- package/public/assets/{BotManage-Dss1Y_jv.js → BotManage-DGBezqSD.js} +2 -2
- package/public/assets/{BotSetupPage-C_KKFdu3.js → BotSetupPage-C0Fs8ZnS.js} +2 -2
- package/public/assets/{ChangelogPage-5btaAfls.js → ChangelogPage-DlB2ibrO.js} +1 -1
- package/public/assets/{CliReferencePage--yAuXfNl.js → CliReferencePage-CZfrDLHw.js} +1 -1
- package/public/assets/ConfirmStageDialog-Z0pbQqim.js +7 -0
- package/public/assets/{DeploymentPage-Qi860C4T.js → DeploymentPage-7vnTwGfh.js} +1 -1
- package/public/assets/{DevWorkflowPage-CZks72g2.js → DevWorkflowPage-DuwsvFYh.js} +1 -1
- package/public/assets/DeveloperManage-D4RJh1ZW.js +16 -0
- package/public/assets/{DeveloperSetupPage-CSs2Mh7c.js → DeveloperSetupPage-BrCi0Lwe.js} +1 -1
- package/public/assets/{DocsIndexPage-BmSMwLvO.js → DocsIndexPage-rnTjEz8b.js} +1 -1
- package/public/assets/{DocsLayout-CunlDzH9.js → DocsLayout-C6xN_yk0.js} +1 -1
- package/public/assets/{DocsPrimitives-Bqnk0mEW.js → DocsPrimitives-IJB6nZ_z.js} +1 -1
- package/public/assets/{EditProjectPage-CJAdaxRE.js → EditProjectPage-BPUvr801.js} +2 -2
- package/public/assets/{EmptyState-DpRw-xch.js → EmptyState-CW1xfNCv.js} +1 -1
- package/public/assets/{EnvVariablesPage-DWD4RzmX.js → EnvVariablesPage-CR4pvBH3.js} +2 -2
- package/public/assets/{HomePage-oShWGYcN.js → HomePage-A0kDqIF6.js} +1 -1
- package/public/assets/{InfoRow-CTXIPrG6.js → InfoRow-D-vceQHX.js} +1 -1
- package/public/assets/{InstallationPage-BgbU06Ei.js → InstallationPage-DQOr1ZdF.js} +1 -1
- package/public/assets/{LandingPage-C-s-hSgz.js → LandingPage-B1mQ0b1M.js} +7 -12
- package/public/assets/{LocalDevelopmentPage-Cg4FYaCn.js → LocalDevelopmentPage-B3tPpv14.js} +1 -1
- package/public/assets/{LoginPage-BhyQxY5d.js → LoginPage-2TJGugqP.js} +1 -1
- package/public/assets/{MetricBar-DZOZStDZ.js → MetricBar-BWriVYES.js} +1 -1
- package/public/assets/{NotFoundPage-DaeTOzAm.js → NotFoundPage-CL8L-hAH.js} +1 -1
- package/public/assets/{OnboardingGuide-DGH0Yfsj.js → OnboardingGuide-Cdz3B-Hy.js} +1 -1
- package/public/assets/{PermissionsPage-D4Lqb40x.js → PermissionsPage-BdKxCcLI.js} +1 -1
- package/public/assets/{PipelineConfigPage-CAWpyPiY.js → PipelineConfigPage-CYPnPxIe.js} +1 -1
- package/public/assets/{PipelineEditorPage-BLDxO49P.js → PipelineEditorPage-Cx5jQ7sn.js} +2 -2
- package/public/assets/{PlanPage-UX5QUlvv.js → PlanPage-B8izWg2B.js} +1 -1
- package/public/assets/{ProfilePage-B73YqnCd.js → ProfilePage-S_chkZka.js} +1 -1
- package/public/assets/{ProjectDetailPage-eNAn85vT.js → ProjectDetailPage-DPjR4K6z.js} +3 -3
- package/public/assets/ProjectListPage-B7KDEb5r.js +6 -0
- package/public/assets/PtyTerminal-SPgs4fDa.js +38 -0
- package/public/assets/{QuickAuth-DSSMYJEC.js → QuickAuth-kStSentC.js} +1 -1
- package/public/assets/RemoveMemberConfirmDialog-nrYU_g4X.js +6 -0
- package/public/assets/ReviewAggregatePage-BycSqu1a.js +6 -0
- package/public/assets/{ReviewPage-BNa6T3xv.js → ReviewPage-CDyr8wXz.js} +1 -1
- package/public/assets/{Select-FmuTJbfh.js → Select-B0NXCdTE.js} +1 -1
- package/public/assets/{SettingsPage-aSrpn6Ta.js → SettingsPage-BOXtwa2r.js} +1 -1
- package/public/assets/{Skeleton-Bo0DEIHn.js → Skeleton-BiHQNXJ9.js} +1 -1
- package/public/assets/{SkillPage-BjiQKd7n.js → SkillPage-DBiTVuCH.js} +1 -1
- package/public/assets/{TaskDetailPage-BLNjDqnY.js → TaskDetailPage-CTVJwy-t.js} +2 -2
- package/public/assets/{TaskGuidePage-C5o7i2D0.js → TaskGuidePage-BsH7MBPf.js} +1 -1
- package/public/assets/TaskListPage-pui2im5r.js +1 -0
- package/public/assets/{TaskStatusBadge-CD8sO9C_.js → TaskStatusBadge-CeC-9VO9.js} +1 -1
- package/public/assets/TerminalHomePage-Bu10hJuQ.js +6 -0
- package/public/assets/TokenManage-Bo15S_D_.js +1 -0
- package/public/assets/{Tooltip-BKRBwA7o.js → Tooltip-BtLbD3s1.js} +1 -1
- package/public/assets/{TotpSetupPage-IVkRIgKh.js → TotpSetupPage-QOB1KoQV.js} +1 -1
- package/public/assets/{WorkerDetailPage-nw_gzQ45.js → WorkerDetailPage-BbUUJ-4x.js} +1 -1
- package/public/assets/WorkerListPage-Cz97ZJ44.js +6 -0
- package/public/assets/{WorkerOperationsPage-Clh8jDGG.js → WorkerOperationsPage-BVb41hZJ.js} +1 -1
- package/public/assets/{WorkerSetupGuidePage-C1wXY1wd.js → WorkerSetupGuidePage-Cidrk_C8.js} +1 -1
- package/public/assets/{WorkerSetupPage-CTCwHKaC.js → WorkerSetupPage-BEBJC4eO.js} +1 -1
- package/public/assets/{agent-type-options-5v4PgZnP.js → agent-type-options-js05RaN7.js} +1 -1
- package/public/assets/{arrow-left-CR_n40mK.js → arrow-left-B7mlJm2S.js} +1 -1
- package/public/assets/{arrow-right-D-j7nSgI.js → arrow-right-pahP-ey1.js} +1 -1
- package/public/assets/{bot--DUOKBmv.js → bot-Utar32Rx.js} +1 -1
- package/public/assets/{chevron-down-CDFiGGBG.js → chevron-down-rRjDei6n.js} +1 -1
- package/public/assets/{chevron-left-C_lJcnCg.js → chevron-left-Bh3DdiT8.js} +1 -1
- package/public/assets/{chevron-right-IZlTWMcO.js → chevron-right-BUIsW0nB.js} +1 -1
- package/public/assets/{chevron-up-DSOCVgRW.js → chevron-up-CC4d-5nr.js} +1 -1
- package/public/assets/circle-alert-DfjZjHfx.js +6 -0
- package/public/assets/clock-CcoV8c6t.js +6 -0
- package/public/assets/{copy-2UMMaHKT.js → copy-CVElRaVS.js} +1 -1
- package/public/assets/{download-D2NyL1OR.js → download-Cuv6Ei5j.js} +1 -1
- package/public/assets/{external-link-B9CWNSMc.js → external-link-Beb0-hR9.js} +1 -1
- package/public/assets/{file-text-COzaNu8e.js → file-text-DQb29yBJ.js} +1 -1
- package/public/assets/{git-fork-9KuFRmam.js → git-fork-IyYS1SDo.js} +1 -1
- package/public/assets/index-CFc6KjWS.js +257 -0
- package/public/assets/index-CdJk2QGi.css +1 -0
- package/public/assets/{key-DoJm5thS.js → key-C5pNR-B1.js} +1 -1
- package/public/assets/{loader-circle-B5SLmhRr.js → loader-circle-BlnkIjik.js} +1 -1
- package/public/assets/{pencil-C_niWuAb.js → pencil-C2RlSzkd.js} +1 -1
- package/public/assets/{play-Do-8kkck.js → play-CShsFo4_.js} +1 -1
- package/public/assets/{plus-C8aSzgHN.js → plus-Awea36q5.js} +1 -1
- package/public/assets/{rotate-ccw-BSPzJeCn.js → rotate-ccw-Lsbc1OqV.js} +1 -1
- package/public/assets/{scroll-text-DdqU_dT6.js → scroll-text-Dljs30sR.js} +1 -1
- package/public/assets/{settings-C8PB6BpE.js → settings-Dagn2Hyc.js} +1 -1
- package/public/assets/{skip-forward-CEuvYtQc.js → skip-forward-DGvJRd3l.js} +1 -1
- package/public/assets/{status-colors-0U8b2F2t.js → status-colors-BDICDBur.js} +1 -1
- package/public/assets/{task-constants-DTDx5Lfp.js → task-constants-Cla1S92u.js} +1 -1
- package/public/assets/{task.store-CGgehOLp.js → task.store-C7wSxS0U.js} +1 -1
- package/public/assets/timer-DJB-k-YQ.js +6 -0
- package/public/assets/{trash-2-tEkzRo6q.js → trash-2-Dbr1-vpY.js} +1 -1
- package/public/assets/{useFetch-CJDmNhIT.js → useFetch-BXXQ6s_s.js} +1 -1
- package/public/assets/{users-Cs2w_uVo.js → users-CAOqfuvd.js} +1 -1
- package/public/assets/{wifi-BCoKY35p.js → wifi-CxjX29U2.js} +1 -1
- package/public/assets/{workflow-BLCy8gMf.js → workflow-BAPA9kNh.js} +1 -1
- package/public/assets/zap-yBKAVFp4.js +6 -0
- package/public/index.html +2 -2
- package/public/sw.js +1 -1
- package/public/assets/AccessTokensPage-zuZElOFy.js +0 -1
- package/public/assets/BotIntegrationPage-58cLGS0T.js +0 -1
- package/public/assets/ConfirmStageDialog-BatYNr9r.js +0 -12
- package/public/assets/DeveloperManage-7tpVdYUx.js +0 -16
- package/public/assets/ProjectListPage-61CMBaxl.js +0 -6
- package/public/assets/PtyTerminal-DOgYXCFD.js +0 -38
- package/public/assets/RemoveMemberConfirmDialog-MiS_sqor.js +0 -6
- package/public/assets/ReviewAggregatePage-LBAVcz2T.js +0 -11
- package/public/assets/TaskListPage-26QNdjqP.js +0 -1
- package/public/assets/TerminalHomePage-DBhs1WQJ.js +0 -6
- package/public/assets/TokenManage-BQ0e_d4e.js +0 -1
- package/public/assets/WorkerListPage-CF1x84G-.js +0 -6
- package/public/assets/index-DvdpkDlU.js +0 -252
- package/public/assets/index-kJfGgL_V.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as h,r as s,h as b,
|
|
1
|
+
import{a as h,r as s,h as b,a7 as v,j as e,C as j}from"./index-CFc6KjWS.js";import{C as f}from"./copy-CVElRaVS.js";function y({mode:l}){const{t:o}=h(),[n,d]=s.useState([]),[x,c]=s.useState(null),[u,i]=s.useState(!1);s.useEffect(()=>{b.get("web/profile/tokens").json().then(t=>{const r=t.filter(m=>m.status===v.ACTIVE);d(r),r.length>0&&c(r[0].id)}).catch(()=>{})},[]);const a=l==="cli"?"ov login --token <your-token>":'curl -H "authorization: bearer <your-token>" http://localhost:9000/api/web/tasks',p=s.useCallback(()=>{navigator.clipboard.writeText(a),i(!0),setTimeout(()=>i(!1),2e3)},[a]);return n.length===0?null:e.jsxs("div",{className:"mb-8 rounded-[4px] border border-[var(--accent)]/20 bg-[var(--bg-card)] p-4",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:o("docs.quick_start_with_token")}),e.jsx("select",{value:x??"",onChange:t=>c(Number(t.target.value)),className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] px-2 py-1 text-xs text-[var(--text-primary)]",children:n.map(t=>e.jsx("option",{value:t.id,children:t.label},t.id))})]}),e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-[4px] bg-[var(--bg-primary)] px-3 py-2",children:[e.jsx("code",{className:"text-xs text-[var(--accent)] break-all",children:a}),e.jsx("button",{onClick:p,className:"shrink-0 text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:u?e.jsx(j,{size:14}):e.jsx(f,{size:14})})]}),e.jsx("p",{className:"mt-2 text-[11px] text-[var(--text-muted)]",children:o("docs.replace_token_hint")})]})}export{y as Q};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{c as R,a as _,v as w,r as a,Z as c,j as e,X as C,h as g,s as D}from"./index-CFc6KjWS.js";import{S as N}from"./Select-B0NXCdTE.js";/**
|
|
2
|
+
* @license lucide-react v0.469.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const L=R("UserMinus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);function $({isOpen:s,onClose:l,projectKey:i,existingMemberIds:d=[],onAdded:m}){const{t}=_();w(s);const[E,M]=a.useState([]),[o,u]=a.useState(""),[v,j]=a.useState(c.MEMBER),[x,f]=a.useState(!1),[y,p]=a.useState("");a.useEffect(()=>{if(!s)return;async function r(){try{const n=await g.get("web/projects/-/developers").json();M(n)}catch{}}r()},[s]);function b(){u(""),j(c.MEMBER),p(""),l()}async function k(r){if(r.preventDefault(),!!o){p(""),f(!0);try{await g.post(`web/projects/${i}/members`,{json:{developerId:parseInt(o,10),role:v}}),m(),b()}catch(n){const h=n instanceof Error?n.message:"",S=h.includes("409")?t("projects.member_already_exists"):h||t("projects.failed_to_add_member");p(S)}finally{f(!1)}}}return s?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backdropFilter:"blur(2px)"},children:[e.jsx("div",{className:"fixed inset-0 bg-[var(--modal-backdrop)]"}),e.jsx("div",{className:"relative z-10 w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] font-mono",children:e.jsxs("form",{onSubmit:k,children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 py-4",children:[e.jsx("h3",{className:"text-sm text-[var(--text-primary)]",children:t("projects.add_member_title")}),e.jsx("button",{type:"button",className:"rounded-[4px] p-1 text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",onClick:b,children:e.jsx(C,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"space-y-4 px-5 py-5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:t("projects.developer")}),e.jsx(N,{value:o,onChange:u,options:E.filter(r=>!d.includes(r.id)).map(r=>({value:String(r.id),label:`${r.name} (${r.gitEmail})`})),placeholder:t("projects.select_developer")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:t("projects.role")}),e.jsx(N,{value:v,onChange:r=>j(r),options:[{value:c.MEMBER,label:t("projects.member_role")},{value:c.MAINTAINER,label:t("projects.maintainer_role")}]})]}),y&&e.jsx("div",{className:"rounded-[4px] border border-red-500/30 bg-red-500/10 px-3 py-2 text-xs text-red-400",children:y})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-[var(--border)] px-5 py-4",children:[e.jsx("button",{type:"button",className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors disabled:opacity-50",disabled:x,onClick:b,children:t("common.cancel")}),e.jsx("button",{type:"submit",className:"rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",disabled:x||!o,children:t(x?"projects.adding":"projects.add_member")})]})]})})]}):null}function B({isOpen:s,onClose:l,onConfirm:i,memberName:d,loading:m}){const{t}=_();return e.jsx(D,{isOpen:s,onClose:l,onConfirm:i,title:`> ${t("projects.remove_member")}`,message:t("projects.remove_member_confirm",{name:d}),confirmLabel:t("common.remove"),confirmVariant:"danger",isLoading:m})}export{$ as A,B as R,L as U};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{c as de,A as xe,f as me,a as B,k as pe,r as n,h as L,j as e,L as ue,V as H,Y as ve,t as f,o as v,b as be,Q as ge,X as he}from"./index-CFc6KjWS.js";import{P as fe}from"./PtyTerminal-SPgs4fDa.js";import{T as je}from"./Skeleton-BiHQNXJ9.js";import{f as Ne,b as we}from"./date-RFA7-ZGs.js";import{a as ye}from"./agent-type-options-js05RaN7.js";import{T as G,g as Q}from"./task-constants-Cla1S92u.js";import{A as ke}from"./arrow-left-B7mlJm2S.js";import{L as Se}from"./loader-circle-BlnkIjik.js";import{P as z}from"./play-CShsFo4_.js";import{S as Ce}from"./skip-forward-DGvJRd3l.js";import{R as Te}from"./rotate-ccw-Lsbc1OqV.js";import{C as Ae}from"./chevron-up-CC4d-5nr.js";import{C as Ee}from"./chevron-down-rRjDei6n.js";import{C as Re}from"./circle-alert-DfjZjHfx.js";/**
|
|
2
|
+
* @license lucide-react v0.469.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const De=de("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]),X={critical:0,warning:1,suggestion:2};function Ie(s){switch(s){case"critical":return{text:"text-[var(--destructive)]",bg:"rgba(239,68,68,0.12)",border:"rgba(239,68,68,0.27)"};case"warning":return{text:"text-[var(--warning)]",bg:"rgba(245,158,11,0.12)",border:"rgba(245,158,11,0.27)"};default:return{text:"text-[var(--info)]",bg:"rgba(59,130,246,0.10)",border:"rgba(59,130,246,0.27)"}}}function Le({severity:s}){return s==="critical"?e.jsx(Re,{className:"h-3.5 w-3.5 text-[var(--destructive)]"}):s==="warning"?e.jsx(H,{className:"h-3.5 w-3.5 text-[var(--warning)]"}):e.jsx(De,{className:"h-3.5 w-3.5 text-[var(--info)]"})}function _e(s){switch(s){case v.RUNNING:return"bg-[var(--accent)]";case v.QUEUED:case v.ASSIGNED:case v.SUSPENDED:return"bg-[var(--warning)]";case v.COMPLETED:return"bg-[var(--accent)]";case v.FAILED:return"bg-[var(--destructive)]";default:return"bg-[#525252]"}}function W(s){return s===v.RUNNING||s===v.QUEUED||s===v.ASSIGNED}function O(s){return s===v.SUSPENDED}const $e=ye(Q);function Pe({task:s,expanded:l,onToggleExpand:r}){const b=Q(s.agentType),d=_e(s.status),o=we(s.startedAt,s.completedAt??void 0),j=W(s.status),g=G.includes(s.status),w=n.useRef(null);return e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsxs("div",{className:"flex cursor-pointer items-center gap-3 px-4 py-3 hover:bg-[var(--bg-input)] transition-colors",onClick:r,children:[e.jsx("span",{className:`h-2 w-2 shrink-0 rounded-full ${d} ${j?"animate-pulse":""}`}),e.jsx("span",{className:"flex-1 text-xs font-medium text-[var(--text-primary)]",children:b}),e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:[j?`${s.status.toLowerCase()}...`:s.status.toLowerCase(),o&&` · ${o}`]}),e.jsxs("a",{href:`/tasks/${s.id}`,target:"_blank",rel:"noopener noreferrer",onClick:y=>y.stopPropagation(),className:"rounded-[4px] border border-[var(--border)] px-2 py-1 text-[11px] text-[var(--text-muted)] hover:text-[var(--accent)] hover:border-[var(--accent)] transition-colors flex items-center gap-1",children:[e.jsx(be,{className:"h-3 w-3"}),"↗"]}),l?e.jsx(Ae,{className:"h-3.5 w-3.5 text-[var(--text-muted)]"}):e.jsx(Ee,{className:"h-3.5 w-3.5 text-[var(--text-muted)]"})]}),l&&e.jsx("div",{className:"border-t border-[var(--border)]",style:{height:"300px"},children:e.jsx(fe,{ref:w,taskId:s.id,sessionId:s.currentSessionId??void 0,taskFinished:g})})]})}function Fe({issue:s}){const l=Ie(s.severity);return e.jsxs("div",{className:`rounded-[4px] p-3 text-xs ${s.isDuplicate?"opacity-60":""}`,style:{backgroundColor:l.bg,border:`1px solid ${l.border}`},children:[e.jsxs("div",{className:"mb-1 flex items-center gap-2",children:[e.jsx(Le,{severity:s.severity}),e.jsx("span",{className:`font-bold ${l.text}`,children:s.severity}),s.agentType&&e.jsx("span",{className:"rounded-[4px] border border-[var(--border)] px-1.5 py-0.5 text-[10px] text-[var(--text-muted)]",children:s.agentType}),e.jsxs("span",{className:"text-[var(--text-muted)]",children:[s.file,s.line!=null?`:${s.line}`:""]}),s.isDuplicate&&e.jsx("span",{className:"rounded-[4px] border border-[var(--border)] px-1.5 py-0.5 text-[10px] text-[var(--text-muted)]",children:"duplicate"})]}),e.jsx("p",{className:"mb-1 text-[var(--text-secondary)]",children:s.description}),s.suggestion&&e.jsxs("p",{className:"text-[var(--text-muted)]",children:[e.jsx("span",{className:"font-medium",children:"suggestion:"})," ",s.suggestion]})]})}function Ue({sourceTaskId:s,defaultReviewers:l,onClose:r,onLaunched:b}){const{t:d}=B(),o=l.length>0?l:[ge.CLAUDE],j=l.length>0,[g,w]=n.useState(o),[y,_]=n.useState(""),[N,$]=n.useState(!1),[C,T]=n.useState(!1);function R(c){w(u=>u.includes(c)?u.filter(P=>P!==c):[...u,c])}async function D(){if(g.length===0){f.error("select at least one review agent.");return}T(!0);try{await L.post(`web/tasks/${s}/review`,{json:{agentTypes:g,description:y.trim()||void 0,skipFix:N||void 0}}),f.success("review launched"),b(),r()}catch(c){const u=c instanceof Error?c.message:String(c);f.error(u)}finally{T(!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:d("review.review_again")}),e.jsx("button",{onClick:r,className:"text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:e.jsx(he,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:d("review.select_agents")}),j&&e.jsx("span",{className:"rounded-[4px] border border-amber-500/40 bg-amber-500/10 px-1.5 py-0.5 text-[10px] text-amber-500",children:"using project defaults"})]}),e.jsx("div",{className:"mb-4 flex flex-col gap-2",children:$e.map(c=>e.jsxs("label",{className:"flex cursor-pointer items-center gap-2.5 rounded-[4px] border border-[var(--border)] px-3 py-2 text-xs hover:bg-[var(--bg-input)] transition-colors",children:[e.jsx("input",{type:"checkbox",checked:g.includes(c.value),onChange:()=>R(c.value),className:"h-3.5 w-3.5 accent-[var(--accent)]"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:c.label})]},c.value))}),e.jsx("textarea",{value:y,onChange:c=>_(c.target.value),placeholder:d("review.description_placeholder"),rows:3,className:"mb-3 w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)] resize-none"}),e.jsxs("label",{className:"mb-4 flex cursor-pointer items-center gap-2.5 rounded-[4px] border border-[var(--border)] px-3 py-2 text-xs hover:bg-[var(--bg-input)] transition-colors",children:[e.jsx("input",{type:"checkbox",checked:N,onChange:c=>$(c.target.checked),className:"h-3.5 w-3.5 accent-[var(--accent)]"}),e.jsx("span",{className:"text-[var(--text-muted)]",children:d("review.skip_fix_label")})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:D,disabled:C||g.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(z,{className:"h-3 w-3"}),d(C?"common.processing":"review.launch")]}),e.jsx("button",{onClick:r,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:d("common.cancel")})]})]})})}function Ze(){var J;const{sourceTaskId:s}=xe(),l=me(),{t:r}=B(),b=Number(s),d=pe(t=>t.eventSeq),[o,j]=n.useState(null),[g,w]=n.useState(!0),[y,_]=n.useState(new Set),[N,$]=n.useState(""),[C,T]=n.useState(!1),[R,D]=n.useState(!1),[c,u]=n.useState(!1),[P,V]=n.useState(null),k=n.useCallback(async()=>{try{const t=await L.get(`web/tasks/${b}/reviews`).json();j(t),t.rounds&&t.rounds.length>0&&V(a=>a??t.rounds[t.rounds.length-1].round)}catch{j(null)}finally{w(!1)}},[b]);n.useEffect(()=>{w(!0),k()},[k]),n.useEffect(()=>{d>0&&k()},[d,k]);const Z=n.useCallback(t=>{_(a=>{const x=new Set(a);return x.has(t)?x.delete(t):x.add(t),x})},[]),S=(o==null?void 0:o.rounds)??[],F=S.length>0?S[S.length-1].round:null,h=P??F,U=S.find(t=>t.round===h),i=(U==null?void 0:U.reviewTasks)??(o==null?void 0:o.reviewTasks)??[];i.some(t=>W(t.status));const I=i.some(t=>O(t.status)),M=i.length>0&&i.every(t=>G.includes(t.status)),ee=i.some(t=>t.report!=null),te=i.length>0&&i.every(t=>t.report!=null),q=h===F,se=I||M,A=n.useMemo(()=>{var x;const t=[];for(const p of i)if((x=p.report)!=null&&x.issues)for(const E of p.report.issues)t.push({...E,agentType:p.agentType??"claude"});t.sort((p,E)=>(X[p.severity]??9)-(X[E.severity]??9));const a=new Set;return t.map(p=>{const E=p.description.slice(0,20),K=`${p.file}:${p.line??""}:${E}`;return a.has(K)?{...p,isDuplicate:!0}:(a.add(K),p)})},[i]),re=A.filter(t=>t.severity==="critical").length,ae=A.filter(t=>t.severity==="warning").length,ne=A.filter(t=>t.severity==="suggestion").length,Y=i.filter(t=>O(t.status)),oe=n.useMemo(()=>[{value:"",label:"select agent..."},...Y.map(t=>({value:String(t.id),label:Q(t.agentType)}))],[Y]);async function ce(){if(!N){f.error("select a review agent to perform the fix.");return}T(!0);try{await L.post(`web/tasks/${b}/approve-fix`,{json:{reviewTaskId:Number(N)}}),f.success("fix started"),k()}catch(t){const a=t instanceof Error?t.message:String(t);f.error(a)}finally{T(!1)}}async function ie(){D(!0);try{await L.post(`web/tasks/${b}/skip-fix`,{json:h!=null?{round:h}:{}}),f.success("review completed — no fix needed"),l("/review")}catch(t){const a=t instanceof Error?t.message:String(t);f.error(a)}finally{D(!1)}}const le=n.useMemo(()=>{var a;const t=(a=o==null?void 0:o.sourceTask)==null?void 0:a.configSnapshot;if(!t)return[];try{const x=JSON.parse(t);return Array.isArray(x.defaultReviewers)?x.defaultReviewers:[]}catch{return[]}},[(J=o==null?void 0:o.sourceTask)==null?void 0:J.configSnapshot]);if(g)return e.jsx("div",{className:"mx-auto max-w-4xl px-2 py-4 md:px-4 md:py-6 font-mono",children:e.jsx(je,{rows:5})});if(!o)return e.jsxs("div",{className:"mx-auto max-w-4xl px-2 py-4 md:px-4 md:py-6 font-mono text-center",children:[e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:"// reviews not found"}),e.jsx("button",{onClick:()=>l("/review"),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:"< back to review"})]});const{sourceTask:m}=o;return e.jsxs("div",{className:"mx-auto max-w-4xl px-2 py-4 md:px-4 md:py-6 font-mono",children:[e.jsx("div",{className:"mb-4 flex items-center gap-2",children:e.jsxs("button",{onClick:()=>l("/review"),className:"flex items-center gap-1.5 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:[e.jsx(ke,{className:"h-3.5 w-3.5"}),r("common.back")]})}),e.jsx("div",{className:"mb-5 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("div",{className:"flex flex-1 flex-col gap-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-bold text-[var(--text-muted)]",children:"source task"}),e.jsxs(ue,{to:`/tasks/${m.id}`,className:"text-xs text-[var(--info)] hover:underline",children:["#",m.id]}),e.jsx("span",{className:"shrink-0 rounded-[4px] border border-[var(--border)] px-2 py-0.5 text-[11px] text-[var(--text-muted)]",children:m.projectKey})]}),e.jsx("span",{className:"truncate text-sm text-[var(--text-primary)]",children:m.description}),(m.branch||m.sourceCommitSha)&&e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["reviewing branch"," ",m.branch&&e.jsx("span",{className:"text-[var(--text-secondary)]",children:m.branch}),m.sourceCommitSha&&e.jsxs(e.Fragment,{children:[" ","at commit"," ",e.jsx("span",{className:"font-mono text-[var(--accent)]",children:m.sourceCommitSha.slice(0,7)})]})]})]}),e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:Ne(m.createdAt)})]})}),S.length>1&&e.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"round:"}),e.jsx("div",{className:"flex gap-1",children:S.map(t=>e.jsxs("button",{onClick:()=>V(t.round),className:`rounded-[4px] border px-3 py-1 text-xs transition-colors ${h===t.round?"border-[var(--accent)] bg-[var(--accent)] text-black font-bold":"border-[var(--border)] text-[var(--text-muted)] hover:text-[var(--text-primary)]"}`,children:["#",t.round]},t.round))}),h!==F&&e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:"// historical"})]}),i.length>0&&e.jsxs("div",{className:"mb-5",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs font-bold text-[var(--text-muted)]",children:[r("review.round"),h?` #${h}`:""]}),e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:[i.filter(t=>G.includes(t.status)||O(t.status)).length," / ",i.length," done"]})]}),e.jsx("div",{className:"flex flex-col gap-2",children:i.map(t=>e.jsx(Pe,{task:t,expanded:y.has(t.id),onToggleExpand:()=>Z(t.id)},t.id))})]}),se&&ee&&(i.filter(a=>a.report!=null).every(a=>!a.report.summary&&a.report.issues.length===0)?e.jsx("div",{className:"mb-5 rounded-[4px] border border-amber-500/40 bg-amber-500/10 p-4",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(H,{className:"h-4 w-4 shrink-0 text-amber-500 mt-0.5"}),e.jsx("p",{className:"text-xs text-amber-500",children:r("review.empty_report_warning")})]})}):e.jsxs("div",{className:"mb-5 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("div",{className:"mb-3 flex items-center gap-3",children:e.jsxs("span",{className:"text-xs font-bold text-[var(--accent)]",children:[r("review.round")," — ",r("review.issues_summary",{critical:String(re),warning:String(ae),suggestion:String(ne)})]})}),A.length>0?e.jsx("div",{className:"flex flex-col gap-2",children:A.map((a,x)=>e.jsx(Fe,{issue:a},x))}):e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"// no issues reported"})]})),q&&te&&!I&&!M&&e.jsxs("div",{className:"mb-4 flex items-center gap-2 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3",children:[e.jsx(Se,{className:"h-3.5 w-3.5 animate-spin text-[var(--text-muted)]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:r("review.waiting_agents")})]}),q&&(I||M)&&e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("span",{className:"mb-3 block text-xs font-bold text-[var(--text-muted)]",children:"actions"}),e.jsxs("div",{className:"flex flex-col gap-3",children:[I&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-center",children:[e.jsx("select",{value:N,onChange:t=>$(t.target.value),className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)] md:w-48",children:oe.map(t=>e.jsx("option",{value:t.value,children:t.label},t.value))}),e.jsxs("button",{onClick:ce,disabled:C||!N,className:"flex 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(z,{className:"h-3 w-3"}),r(C?"common.processing":"review.approve_fix")]}),e.jsxs("button",{onClick:ie,disabled:R,className:"flex items-center justify-center gap-1.5 rounded-[4px] border border-[var(--border)] px-4 py-2 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-input)] transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(Ce,{className:"h-3 w-3"}),r(R?"common.processing":"review.skip_fix")]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] text-[var(--text-muted)]",children:[e.jsx(ve,{className:"h-3 w-3 shrink-0"}),r("review.fix_push_info")]})]}),e.jsxs("button",{onClick:()=>u(!0),className:"flex items-center gap-1.5 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:[e.jsx(Te,{className:"h-3.5 w-3.5"}),r("review.review_again")]})]})]}),i.length===0&&e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-8 text-center",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("review.no_reviews")}),e.jsxs("button",{onClick:()=>u(!0),className:"mt-3 flex items-center gap-1.5 mx-auto rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs font-bold text-black",children:[e.jsx(z,{className:"h-3 w-3"}),r("review.launch")]})]}),c&&e.jsx(Ue,{sourceTaskId:b,defaultReviewers:le,onClose:()=>u(!1),onLaunched:()=>{u(!1),k()}})]})}export{Ze as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as y,k as G,r as a,v as K,j as e,h as N,f as S,o as p,E,l as F,X as T,H as B,t as w,O as H}from"./index-DvdpkDlU.js";import{E as D}from"./EmptyState-DpRw-xch.js";import{T as L}from"./Skeleton-Bo0DEIHn.js";import{S as k}from"./Select-FmuTJbfh.js";import{f as P}from"./date-RFA7-ZGs.js";import{T as A}from"./Tooltip-BKRBwA7o.js";import{a as q}from"./agent-type-options-5v4PgZnP.js";import{g as z}from"./task-constants-DTDx5Lfp.js";import{P as R}from"./play-Do-8kkck.js";import{C as Q}from"./chevron-left-C_lJcnCg.js";import{C as X}from"./chevron-right-IZlTWMcO.js";import"./chevron-down-CDFiGGBG.js";function $(){const[t,n]=a.useState(void 0),[s,i]=a.useState(void 0),[x,o]=a.useState([]),u=a.useRef(void 0),g=a.useRef(void 0);u.current=t,g.current=s;const m=a.useCallback(d=>{n(d)},[]),h=a.useCallback(()=>{const d=u.current;d&&(o(j=>[...j,g.current??""]),i(d))},[]),b=a.useRef([]);b.current=x;const l=a.useCallback(()=>{const d=b.current;d.length!==0&&(i(d.at(-1)||void 0),o(d.slice(0,-1)))},[]),r=x.length+1,c=x.length>0;return{cursor:s,setNextCursor:m,goNext:h,goPrev:l,pageNumber:r,hasPrev:c,hasNext:!!t}}const I=20;function Z(t){switch(t){case p.RUNNING:return"bg-[var(--accent)]";case p.QUEUED:return"bg-[var(--warning)]";case p.ASSIGNED:return"bg-[var(--info)]";case p.SUSPENDED:return"bg-[var(--warning)]";case p.COMPLETED:return"bg-[var(--accent)]";case p.FAILED:return"bg-[var(--destructive)]";case p.CANCELLED:return"bg-[#525252]";default:return"bg-[#525252]"}}const J=q(z);function V({taskId:t,onClose:n,onLaunched:s}){const{t:i}=y(),[x,o]=a.useState([H.CLAUDE]),[u,g]=a.useState(""),[m,h]=a.useState(!1);function b(r){o(c=>c.includes(r)?c.filter(f=>f!==r):[...c,r])}async function l(){if(x.length===0){w.error("select at least one review agent.");return}h(!0);try{await N.post(`web/tasks/${t}/review`,{json:{agentTypes:x,description:u.trim()||void 0}}),w.success("review launched"),s(),n()}catch(r){const c=r instanceof Error?r.message:String(r);w.error(c)}finally{h(!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:i("review.launch")}),e.jsx("button",{onClick:n,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 #",t," — ",i("review.select_agents")]}),e.jsx("div",{className:"mb-4 flex flex-col gap-2",children:J.map(r=>e.jsxs("label",{className:"flex cursor-pointer items-center gap-2.5 rounded-[4px] border border-[var(--border)] px-3 py-2 text-xs hover:bg-[var(--bg-input)] transition-colors",children:[e.jsx("input",{type:"checkbox",checked:x.includes(r.value),onChange:()=>b(r.value),className:"h-3.5 w-3.5 accent-[var(--accent)]"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:r.label})]},r.value))}),e.jsx("textarea",{value:u,onChange:r=>g(r.target.value),placeholder:i("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:l,disabled:m||x.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"}),i(m?"common.processing":"review.launch")]}),e.jsx("button",{onClick:n,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:i("common.cancel")})]})]})})}function _({pag:t}){const{t:n}=y();return!t.hasPrev&&!t.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 ",t.pageNumber]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:t.goPrev,disabled:!t.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(Q,{className:"h-3.5 w-3.5"}),n("tasks.prev")]}),e.jsxs("button",{onClick:t.goNext,disabled:!t.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:[n("common.next"),e.jsx(X,{className:"h-3.5 w-3.5"})]})]})]})}function W({onRefresh:t,projectFilter:n,developerFilter:s}){const{t:i}=y(),x=S(),[o,u]=a.useState([]),[g,m]=a.useState(!0),[h,b]=a.useState(null),l=$(),r=a.useCallback(async c=>{m(!0);try{const f=new Date(Date.now()-6048e5).toISOString(),d=new URLSearchParams({status:p.COMPLETED,taskMode:"develop",reviewStatus:"null",completedAfter:f,limit:String(I)});n&&d.set("projectKey",n),s&&d.set("developerId",s),c&&d.set("cursor",c);const j=await N.get(`web/tasks?${d}`).json();u(j.data??[]),l.setNextCursor(j.nextCursor)}catch{u([]),l.setNextCursor(void 0)}finally{m(!1)}},[n,s]);return a.useEffect(()=>{r(l.cursor)},[r,l.cursor]),g&&o.length===0?e.jsx("div",{className:"p-4",children:e.jsx(L,{rows:4})}):!g&&o.length===0&&!l.hasPrev?e.jsx(D,{icon:E,title:i("review.no_reviews"),description:i("review.pending")}):e.jsxs(e.Fragment,{children:[o.length>0&&e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:o.map(c=>e.jsxs("div",{className:"flex items-center gap-3 border-b border-[var(--border)] px-4 py-3 last:border-b-0",children:[e.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full bg-[var(--accent)]"}),e.jsx(A,{content:c.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",onClick:()=>x(`/tasks/${c.id}`),children:["#",c.id," ",F(c)]})}),e.jsx("span",{className:"shrink-0 rounded-[4px] border border-[var(--border)] px-2 py-0.5 text-[11px] text-[var(--text-muted)]",children:c.projectKey}),e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:P(c.completedAt??c.createdAt)}),e.jsxs("button",{onClick:async()=>{try{await N.post(`web/tasks/${c.id}/review-status`,{json:{reviewStatus:"dismissed"}}),r(l.cursor)}catch(f){let d="Failed to dismiss";try{if(f instanceof B){const j=await f.response.json();d=(j==null?void 0:j.message)??d}else f instanceof Error&&(d=f.message)}catch{}w.error(d)}},className:"shrink-0 flex items-center gap-1.5 rounded-[4px] px-3 py-1.5 text-[11px] font-medium text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:[e.jsx(T,{className:"h-3 w-3"}),"Dismiss"]}),e.jsxs("button",{onClick:()=>b(c.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:i("review.launch_short")})]})]},c.id))}),e.jsx(_,{pag:l}),h!==null&&e.jsx(V,{taskId:h,onClose:()=>b(null),onLaunched:()=>{t(),r(l.cursor)}})]})}function Y(t){const n=new Map;for(const s of t){const i=s.sourceTaskId??s.id;n.has(i)||n.set(i,[]),n.get(i).push(s)}return Array.from(n.entries()).map(([s,i])=>({sourceTaskId:s,tasks:i}))}function ee({group:t,onClick:n}){const s=t.tasks[0],i=t.tasks.every(o=>o.status===p.COMPLETED||o.status===p.FAILED||o.status===p.CANCELLED),x=s==null?void 0:s.sourceCommitSha;return e.jsxs("div",{onClick:n,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 ${i?"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:(s==null?void 0:s.sourceTaskDescription)??(s==null?void 0:s.description),className:"truncate",children:e.jsxs("span",{className:"truncate text-xs text-[var(--text-primary)]",children:["source #",t.sourceTaskId]})}),x&&e.jsxs("span",{className:"shrink-0 font-mono text-[11px] text-[var(--accent)]",children:["@",x.slice(0,7)]})]}),e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:[t.tasks.length," ",t.tasks.length===1?"agent":"agents"," · ",t.tasks.map(o=>(o.agentType??"claude").toLowerCase()).join(", ")]})]}),s&&e.jsx("span",{className:"shrink-0 rounded-[4px] border border-[var(--border)] px-2 py-0.5 text-[11px] text-[var(--text-muted)]",children:s.projectKey}),s&&e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:P(s.createdAt)}),e.jsx("div",{className:"flex shrink-0 items-center gap-1",children:t.tasks.map(o=>e.jsx("span",{className:`h-2 w-2 rounded-full ${Z(o.status)}`,title:o.status.toLowerCase()},o.id))})]})}function C({mode:t,projectFilter:n,developerFilter:s}){const{t:i}=y(),x=S(),[o,u]=a.useState([]),[g,m]=a.useState(!0),h=$(),b=a.useCallback(async l=>{m(!0);try{const r=new URLSearchParams({taskMode:"review",limit:String(I),groupBySource:"true"});t==="in_progress"?r.set("status",[p.QUEUED,p.ASSIGNED,p.RUNNING,p.SUSPENDED].join(",")):r.set("status",[p.COMPLETED,p.FAILED,p.CANCELLED].join(",")),n&&r.set("projectKey",n),s&&r.set("sourceDeveloperId",s),l&&r.set("cursor",l);const c=await N.get(`web/tasks?${r}`).json();u(Y(c.data??[])),h.setNextCursor(c.nextCursor??void 0)}catch{u([]),h.setNextCursor(void 0)}finally{m(!1)}},[t,n,s]);return a.useEffect(()=>{b(h.cursor)},[b,h.cursor]),g&&o.length===0?e.jsx("div",{className:"p-4",children:e.jsx(L,{rows:4})}):!g&&o.length===0&&!h.hasPrev?e.jsx(D,{icon:E,title:i("review.no_reviews")}):e.jsxs(e.Fragment,{children:[o.length>0&&e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:o.map(l=>e.jsx(ee,{group:l,onClick:()=>x(`/review/${l.sourceTaskId}`)},l.sourceTaskId))}),e.jsx(_,{pag:h})]})}function pe(){const{t}=y(),n=G(v=>v.taskSeq),[s,i]=a.useState("pending"),[x,o]=a.useState(0),[u,g]=a.useState(""),[m,h]=a.useState(""),[b,l]=a.useState([]),[r,c]=a.useState([]);K(null);const f=a.useCallback(()=>o(v=>v+1),[]);a.useEffect(()=>{let v=!1;return(async()=>{try{const[U,M]=await Promise.all([N.get("web/projects").json(),N.get("web/projects/-/developers").json()]);if(v)return;l(U),c(M)}catch{}})(),()=>{v=!0}},[]);const d=a.useMemo(()=>[{value:"",label:t("tasks.filter_project")},...b.map(v=>({value:v.key,label:v.name}))],[b,t]),j=a.useMemo(()=>[{value:"",label:t("tasks.filter_developer")},...r.map(v=>({value:String(v.id),label:v.name}))],[r,t]),O=[{key:"pending",label:t("review.pending")},{key:"in_progress",label:t("review.in_progress")},{key:"history",label:t("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:t("review.title")}),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",children:O.map(v=>e.jsx("button",{onClick:()=>i(v.key),className:`shrink-0 rounded-[4px] px-3 py-2 h-8 text-xs transition-colors ${s===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("div",{className:"flex flex-col gap-2 md:ml-auto md:flex-row md:items-center",children:[e.jsx(k,{value:u,onChange:g,options:d,className:"md:w-40"}),e.jsx(k,{value:m,onChange:h,options:j,className:"md:w-40"})]})]}),s==="pending"&&e.jsx(W,{onRefresh:f,projectFilter:u,developerFilter:m},`pending-${x}-${n}-${u}-${m}`),s==="in_progress"&&e.jsx(C,{mode:"in_progress",projectFilter:u,developerFilter:m},`inprogress-${x}-${n}-${u}-${m}`),s==="history"&&e.jsx(C,{mode:"history",projectFilter:u,developerFilter:m},`history-${x}-${n}-${u}-${m}`)]})}export{pe as default};
|
|
1
|
+
import{a as y,k as G,r as a,w as K,j as e,h as N,f as S,o as p,E,l as F,X as T,H as B,t as w,Q as H}from"./index-CFc6KjWS.js";import{E as D}from"./EmptyState-CW1xfNCv.js";import{T as L}from"./Skeleton-BiHQNXJ9.js";import{S as k}from"./Select-B0NXCdTE.js";import{f as P}from"./date-RFA7-ZGs.js";import{T as A}from"./Tooltip-BtLbD3s1.js";import{a as Q}from"./agent-type-options-js05RaN7.js";import{g as q}from"./task-constants-Cla1S92u.js";import{P as R}from"./play-CShsFo4_.js";import{C as z}from"./chevron-left-Bh3DdiT8.js";import{C as X}from"./chevron-right-BUIsW0nB.js";import"./chevron-down-rRjDei6n.js";function $(){const[t,n]=a.useState(void 0),[s,i]=a.useState(void 0),[x,o]=a.useState([]),u=a.useRef(void 0),g=a.useRef(void 0);u.current=t,g.current=s;const m=a.useCallback(d=>{n(d)},[]),h=a.useCallback(()=>{const d=u.current;d&&(o(j=>[...j,g.current??""]),i(d))},[]),b=a.useRef([]);b.current=x;const l=a.useCallback(()=>{const d=b.current;d.length!==0&&(i(d.at(-1)||void 0),o(d.slice(0,-1)))},[]),r=x.length+1,c=x.length>0;return{cursor:s,setNextCursor:m,goNext:h,goPrev:l,pageNumber:r,hasPrev:c,hasNext:!!t}}const I=20;function Z(t){switch(t){case p.RUNNING:return"bg-[var(--accent)]";case p.QUEUED:return"bg-[var(--warning)]";case p.ASSIGNED:return"bg-[var(--info)]";case p.SUSPENDED:return"bg-[var(--warning)]";case p.COMPLETED:return"bg-[var(--accent)]";case p.FAILED:return"bg-[var(--destructive)]";case p.CANCELLED:return"bg-[#525252]";default:return"bg-[#525252]"}}const J=Q(q);function V({taskId:t,onClose:n,onLaunched:s}){const{t:i}=y(),[x,o]=a.useState([H.CLAUDE]),[u,g]=a.useState(""),[m,h]=a.useState(!1);function b(r){o(c=>c.includes(r)?c.filter(f=>f!==r):[...c,r])}async function l(){if(x.length===0){w.error("select at least one review agent.");return}h(!0);try{await N.post(`web/tasks/${t}/review`,{json:{agentTypes:x,description:u.trim()||void 0}}),w.success("review launched"),s(),n()}catch(r){const c=r instanceof Error?r.message:String(r);w.error(c)}finally{h(!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:i("review.launch")}),e.jsx("button",{onClick:n,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 #",t," — ",i("review.select_agents")]}),e.jsx("div",{className:"mb-4 flex flex-col gap-2",children:J.map(r=>e.jsxs("label",{className:"flex cursor-pointer items-center gap-2.5 rounded-[4px] border border-[var(--border)] px-3 py-2 text-xs hover:bg-[var(--bg-input)] transition-colors",children:[e.jsx("input",{type:"checkbox",checked:x.includes(r.value),onChange:()=>b(r.value),className:"h-3.5 w-3.5 accent-[var(--accent)]"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:r.label})]},r.value))}),e.jsx("textarea",{value:u,onChange:r=>g(r.target.value),placeholder:i("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:l,disabled:m||x.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"}),i(m?"common.processing":"review.launch")]}),e.jsx("button",{onClick:n,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:i("common.cancel")})]})]})})}function _({pag:t}){const{t:n}=y();return!t.hasPrev&&!t.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 ",t.pageNumber]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:t.goPrev,disabled:!t.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(z,{className:"h-3.5 w-3.5"}),n("tasks.prev")]}),e.jsxs("button",{onClick:t.goNext,disabled:!t.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:[n("common.next"),e.jsx(X,{className:"h-3.5 w-3.5"})]})]})]})}function W({onRefresh:t,projectFilter:n,developerFilter:s}){const{t:i}=y(),x=S(),[o,u]=a.useState([]),[g,m]=a.useState(!0),[h,b]=a.useState(null),l=$(),r=a.useCallback(async c=>{m(!0);try{const f=new Date(Date.now()-6048e5).toISOString(),d=new URLSearchParams({status:p.COMPLETED,taskMode:"develop",reviewStatus:"null",completedAfter:f,limit:String(I)});n&&d.set("projectKey",n),s&&d.set("developerId",s),c&&d.set("cursor",c);const j=await N.get(`web/tasks?${d}`).json();u(j.data??[]),l.setNextCursor(j.nextCursor)}catch{u([]),l.setNextCursor(void 0)}finally{m(!1)}},[n,s]);return a.useEffect(()=>{r(l.cursor)},[r,l.cursor]),g&&o.length===0?e.jsx("div",{className:"p-4",children:e.jsx(L,{rows:4})}):!g&&o.length===0&&!l.hasPrev?e.jsx(D,{icon:E,title:i("review.no_reviews"),description:i("review.pending")}):e.jsxs(e.Fragment,{children:[o.length>0&&e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:o.map(c=>e.jsxs("div",{className:"flex items-center gap-3 border-b border-[var(--border)] px-4 py-3 last:border-b-0",children:[e.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full bg-[var(--accent)]"}),e.jsx(A,{content:c.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",onClick:()=>x(`/tasks/${c.id}`),children:["#",c.id," ",F(c)]})}),e.jsx("span",{className:"shrink-0 rounded-[4px] border border-[var(--border)] px-2 py-0.5 text-[11px] text-[var(--text-muted)]",children:c.projectKey}),e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:P(c.completedAt??c.createdAt)}),e.jsxs("button",{onClick:async()=>{try{await N.post(`web/tasks/${c.id}/review-status`,{json:{reviewStatus:"dismissed"}}),r(l.cursor)}catch(f){let d="Failed to dismiss";try{if(f instanceof B){const j=await f.response.json();d=(j==null?void 0:j.message)??d}else f instanceof Error&&(d=f.message)}catch{}w.error(d)}},className:"shrink-0 flex items-center gap-1.5 rounded-[4px] px-3 py-1.5 text-[11px] font-medium text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:[e.jsx(T,{className:"h-3 w-3"}),"Dismiss"]}),e.jsxs("button",{onClick:()=>b(c.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:i("review.launch_short")})]})]},c.id))}),e.jsx(_,{pag:l}),h!==null&&e.jsx(V,{taskId:h,onClose:()=>b(null),onLaunched:()=>{t(),r(l.cursor)}})]})}function Y(t){const n=new Map;for(const s of t){const i=s.sourceTaskId??s.id;n.has(i)||n.set(i,[]),n.get(i).push(s)}return Array.from(n.entries()).map(([s,i])=>({sourceTaskId:s,tasks:i}))}function ee({group:t,onClick:n}){const s=t.tasks[0],i=t.tasks.every(o=>o.status===p.COMPLETED||o.status===p.FAILED||o.status===p.CANCELLED),x=s==null?void 0:s.sourceCommitSha;return e.jsxs("div",{onClick:n,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 ${i?"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:(s==null?void 0:s.sourceTaskDescription)??(s==null?void 0:s.description),className:"truncate",children:e.jsxs("span",{className:"truncate text-xs text-[var(--text-primary)]",children:["source #",t.sourceTaskId]})}),x&&e.jsxs("span",{className:"shrink-0 font-mono text-[11px] text-[var(--accent)]",children:["@",x.slice(0,7)]})]}),e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:[t.tasks.length," ",t.tasks.length===1?"agent":"agents"," · ",t.tasks.map(o=>(o.agentType??"claude").toLowerCase()).join(", ")]})]}),s&&e.jsx("span",{className:"shrink-0 rounded-[4px] border border-[var(--border)] px-2 py-0.5 text-[11px] text-[var(--text-muted)]",children:s.projectKey}),s&&e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:P(s.createdAt)}),e.jsx("div",{className:"flex shrink-0 items-center gap-1",children:t.tasks.map(o=>e.jsx("span",{className:`h-2 w-2 rounded-full ${Z(o.status)}`,title:o.status.toLowerCase()},o.id))})]})}function C({mode:t,projectFilter:n,developerFilter:s}){const{t:i}=y(),x=S(),[o,u]=a.useState([]),[g,m]=a.useState(!0),h=$(),b=a.useCallback(async l=>{m(!0);try{const r=new URLSearchParams({taskMode:"review",limit:String(I),groupBySource:"true"});t==="in_progress"?r.set("status",[p.QUEUED,p.ASSIGNED,p.RUNNING,p.SUSPENDED].join(",")):r.set("status",[p.COMPLETED,p.FAILED,p.CANCELLED].join(",")),n&&r.set("projectKey",n),s&&r.set("sourceDeveloperId",s),l&&r.set("cursor",l);const c=await N.get(`web/tasks?${r}`).json();u(Y(c.data??[])),h.setNextCursor(c.nextCursor??void 0)}catch{u([]),h.setNextCursor(void 0)}finally{m(!1)}},[t,n,s]);return a.useEffect(()=>{b(h.cursor)},[b,h.cursor]),g&&o.length===0?e.jsx("div",{className:"p-4",children:e.jsx(L,{rows:4})}):!g&&o.length===0&&!h.hasPrev?e.jsx(D,{icon:E,title:i("review.no_reviews")}):e.jsxs(e.Fragment,{children:[o.length>0&&e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:o.map(l=>e.jsx(ee,{group:l,onClick:()=>x(`/review/${l.sourceTaskId}`)},l.sourceTaskId))}),e.jsx(_,{pag:h})]})}function pe(){const{t}=y(),n=G(v=>v.taskSeq),[s,i]=a.useState("pending"),[x,o]=a.useState(0),[u,g]=a.useState(""),[m,h]=a.useState(""),[b,l]=a.useState([]),[r,c]=a.useState([]);K(null);const f=a.useCallback(()=>o(v=>v+1),[]);a.useEffect(()=>{let v=!1;return(async()=>{try{const[U,M]=await Promise.all([N.get("web/projects").json(),N.get("web/projects/-/developers").json()]);if(v)return;l(U),c(M)}catch{}})(),()=>{v=!0}},[]);const d=a.useMemo(()=>[{value:"",label:t("tasks.filter_project")},...b.map(v=>({value:v.key,label:v.name}))],[b,t]),j=a.useMemo(()=>[{value:"",label:t("tasks.filter_developer")},...r.map(v=>({value:String(v.id),label:v.name}))],[r,t]),O=[{key:"pending",label:t("review.pending")},{key:"in_progress",label:t("review.in_progress")},{key:"history",label:t("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:t("review.title")}),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",children:O.map(v=>e.jsx("button",{onClick:()=>i(v.key),className:`shrink-0 rounded-[4px] px-3 py-2 h-8 text-xs transition-colors ${s===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("div",{className:"flex flex-col gap-2 md:ml-auto md:flex-row md:items-center",children:[e.jsx(k,{value:u,onChange:g,options:d,className:"md:w-40"}),e.jsx(k,{value:m,onChange:h,options:j,className:"md:w-40"})]})]}),s==="pending"&&e.jsx(W,{onRefresh:f,projectFilter:u,developerFilter:m},`pending-${x}-${n}-${u}-${m}`),s==="in_progress"&&e.jsx(C,{mode:"in_progress",projectFilter:u,developerFilter:m},`inprogress-${x}-${n}-${u}-${m}`),s==="history"&&e.jsx(C,{mode:"history",projectFilter:u,developerFilter:m},`history-${x}-${n}-${u}-${m}`)]})}export{pe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as l,j as t}from"./index-
|
|
1
|
+
import{r as l,j as t}from"./index-CFc6KjWS.js";import{C as f}from"./chevron-down-rRjDei6n.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-CFc6KjWS.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-CFc6KjWS.js";import{I as c,C as r}from"./DocsPrimitives-IJB6nZ_z.js";import{E as n}from"./external-link-Beb0-hR9.js";import"./copy-CVElRaVS.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 oe,a as xe,r as n,
|
|
1
|
+
import{c as oe,a as xe,r as n,z as $,h as f,j as e,H as Kt,t as W,s as Ee,A as Wt,f as Vt,B as Xt,p as Ht,q as Jt,k as dt,o as y,R as Qt,L as ie,l as mt,m as Yt,X as Ce,x as Zt,U as es,b as ts,G as _t,F as ss}from"./index-CFc6KjWS.js";import{u as as}from"./task.store-C7wSxS0U.js";import{u as rs,g as ns,C as pt,M as ls,H as cs}from"./ConfirmStageDialog-Z0pbQqim.js";import{P as ut}from"./PtyTerminal-SPgs4fDa.js";import{S as ht}from"./Select-B0NXCdTE.js";import{b as is,f as Y,c as os}from"./date-RFA7-ZGs.js";import{a as St}from"./status-colors-BDICDBur.js";import{a as ft}from"./agent-type-options-js05RaN7.js";import{T as xs,g as Z}from"./task-constants-Cla1S92u.js";import{T as ds}from"./Tooltip-BtLbD3s1.js";import{A as ms}from"./arrow-left-B7mlJm2S.js";import{R as Ct}from"./rotate-ccw-Lsbc1OqV.js";import{G as ps}from"./git-fork-IyYS1SDo.js";import{P as vt}from"./play-CShsFo4_.js";import{E as gt}from"./external-link-Beb0-hR9.js";import{L as Tt}from"./loader-circle-BlnkIjik.js";import{S as us}from"./skip-forward-DGvJRd3l.js";import{F as bt}from"./file-text-DQb29yBJ.js";import"./clock-CcoV8c6t.js";import"./chevron-down-rRjDei6n.js";/**
|
|
2
2
|
* @license lucide-react v0.469.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -18,4 +18,4 @@ import{c as oe,a as xe,r as n,y as $,h as f,j as e,H as Kt,t as W,s as Ee,z as W
|
|
|
18
18
|
*
|
|
19
19
|
* This source code is licensed under the ISC license.
|
|
20
20
|
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const gs=oe("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);function bs(l,c){const a=new Date(l).getTime()-Date.now();if(a<=0)return c("tasks.tunnel_expired");const r=Math.floor(a/36e5),t=Math.floor(a%36e5/6e4);return r>0?c("tasks.tunnel_expires_hm",{h:r,m:t}):c("tasks.tunnel_expires_m",{m:t})}function jt(l){switch(l){case"CONNECTED":return"var(--accent)";case"STARTING":return"var(--warning)";case"EXPIRED":return"var(--text-muted)";default:return"var(--text-muted)"}}function Nt(l,c){switch(l){case"IDLE":case"CLOSED":return c("tasks.tunnel_idle");case"STARTING":return c("tasks.tunnel_starting");case"CONNECTED":return c("tasks.tunnel_connected");case"EXPIRED":return c("tasks.tunnel_expired");case"CLOSING":return c("tasks.tunnel_closing");default:return String(l).toLowerCase()}}function js({taskId:l,taskFinished:c,compact:a}){const{t:r}=xe(),[t,x]=n.useState($.IDLE),[m,_]=n.useState(null),[h,P]=n.useState(null),[R,ee]=n.useState(""),[d,S]=n.useState(!1),[de,O]=n.useState(!1),F=n.useRef(null),M=n.useCallback(async()=>{try{const v=await f.get(`web/workspace-tunnel/${l}/status`).json();x(v.status),_(v.tunnelUrl??null),P(v.expiresAt??null),(v.status==="EXPIRED"||v.status==="IDLE"||v.status==="CLOSED")&&C()}catch{}},[l]);function me(){C(),F.current=setInterval(M,5e3)}function C(){F.current&&(clearInterval(F.current),F.current=null)}n.useEffect(()=>{c&&(t===$.STARTING||t===$.CONNECTED)&&(x($.IDLE),_(null),C())},[c,t]),n.useEffect(()=>{if(t!=="CONNECTED"||!h)return;const v=()=>{const T=bs(h,r);ee(T),T===r("tasks.tunnel_expired")&&(x($.EXPIRED),_(null),C())};v();const I=setInterval(v,3e4);return()=>clearInterval(I)},[t,h]),n.useEffect(()=>()=>C(),[]),n.useEffect(()=>{c||M()},[M,c]);async function V(){S(!0);try{await f.post(`web/workspace-tunnel/${l}/start`),x($.STARTING),me()}catch(v){let I=r("tasks.tunnel_start_failed");try{if(v instanceof Kt){const T=await v.response.json();T!=null&&T.error&&(I=T.error,/code.*not found|ENOENT.*code|spawn code/i.test(I)&&(I+=". "+r("tasks.tunnel_install_code_hint")))}}catch{}W.error(I)}finally{S(!1)}}async function A(){S(!0);try{await f.post(`web/workspace-tunnel/${l}/stop`),x($.IDLE),_(null),C()}catch{}finally{S(!1)}}async function U(){m&&(await navigator.clipboard.writeText(m),O(!0),setTimeout(()=>O(!1),2e3))}return a?e.jsxs("div",{className:"flex items-center gap-2 font-mono lowercase text-xs",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"ide_tunnel:"}),e.jsx("span",{style:{color:jt(t)},children:Nt(t,r)}),(t==="IDLE"||t==="CLOSED"||t==="EXPIRED")&&e.jsx("button",{onClick:V,disabled:d,className:"rounded-[4px] px-2 py-1 text-[var(--info)] disabled:opacity-50",style:{backgroundColor:"rgba(59,130,246,0.12)"},children:r(d?"tasks.tunnel_starting":"tasks.tunnel_start")}),t==="CONNECTED"&&m&&e.jsx("a",{href:m.replace(/^https?:/,"cursor:"),target:"_blank",rel:"noopener noreferrer",className:"rounded-[4px] px-2 py-1 text-[var(--info)]",style:{backgroundColor:"rgba(59,130,246,0.12)"},children:r("tasks.tunnel_open_in_cursor")})]}):e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 font-mono lowercase",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.tunnel_header")}),e.jsxs("span",{className:"text-xs",style:{color:jt(t)},children:["● ",Nt(t,r)]})]}),t==="CONNECTED"&&h&&e.jsxs("p",{className:"mb-2 text-xs text-[var(--text-muted)]",children:["// ",R]}),t==="CONNECTED"&&m&&e.jsxs("div",{className:"mb-3 flex items-center gap-2 rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] px-3 py-2",children:[e.jsx("code",{className:"flex-1 truncate text-xs text-[var(--text-primary)]",children:m}),e.jsxs("button",{onClick:U,className:"shrink-0 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors","aria-label":r("tasks.tunnel_copy_url"),children:["[",r("common.copy"),"]"]})]}),de&&e.jsx("p",{className:"mb-2 text-xs text-[var(--accent)]",children:r("tasks.tunnel_copied")}),t==="STARTING"&&e.jsx("p",{className:"mb-3 text-xs text-[var(--text-muted)]",children:r("tasks.tunnel_waiting")}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[(t==="IDLE"||t==="CLOSED")&&e.jsx("button",{onClick:V,disabled:d,className:"rounded-[4px] border border-[var(--accent)]/40 px-3 py-1.5 text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors disabled:opacity-50",children:r(d?"tasks.tunnel_starting_button":"tasks.tunnel_start_button")}),t==="STARTING"&&e.jsx("button",{onClick:A,disabled:d,className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors disabled:opacity-50",children:r(d?"tasks.tunnel_stopping":"tasks.tunnel_cancel")}),t==="CONNECTED"&&m&&e.jsxs(e.Fragment,{children:[e.jsx("a",{href:m.replace(/^https?:/,"cursor:"),target:"_blank",rel:"noopener noreferrer",className:"rounded-[4px] border border-[var(--accent)]/40 px-3 py-1.5 text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors",children:r("tasks.tunnel_open_cursor")}),e.jsx("a",{href:m.replace(/^https?:/,"vscode:"),target:"_blank",rel:"noopener noreferrer",className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:r("tasks.tunnel_open_vscode")}),e.jsx("button",{onClick:A,disabled:d,className:"rounded-[4px] border border-[var(--destructive)]/40 px-3 py-1.5 text-[var(--destructive)] hover:bg-[var(--destructive)]/10 transition-colors disabled:opacity-50",children:r(d?"tasks.tunnel_stopping":"tasks.tunnel_stop")})]}),t==="EXPIRED"&&e.jsx("button",{onClick:V,disabled:d,className:"rounded-[4px] border border-[var(--accent)]/40 px-3 py-1.5 text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors disabled:opacity-50",children:r(d?"tasks.tunnel_starting_button":"tasks.tunnel_restart")})]})]})}function Ns({isOpen:l,onClose:c,onConfirm:a,taskId:r,isLoading:t}){const{t:x}=xe();return e.jsx(Ee,{isOpen:l,onClose:c,onConfirm:a,title:x("tasks.cancel_task_title"),message:x("tasks.cancel_task_message",{id:String(r)}),confirmLabel:x("tasks.cancel_task_confirm_label"),confirmVariant:"danger",isLoading:t})}function ys({isOpen:l,onClose:c,onConfirm:a,taskId:r,mrUrl:t,isLoading:x,reuseWorkspace:m,onReuseWorkspaceChange:_}){const{t:h}=xe(),P=t?h("tasks.retry_message_with_mr",{id:String(r),url:t}):h("tasks.retry_message_without_mr",{id:String(r)});return e.jsx(Ee,{isOpen:l,onClose:c,onConfirm:a,title:h("tasks.retry_title"),message:P,confirmLabel:h("tasks.retry_confirm_label"),confirmVariant:"accent",isLoading:x,children:e.jsxs("label",{className:"flex items-center gap-2 mt-3 text-[var(--text-muted)] text-xs cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:m,onChange:R=>_(R.target.checked),className:"w-3.5 h-3.5 cursor-pointer accent-[var(--accent)]"}),h("tasks.reuse_workspace_label")]})})}const _e=["implement","test","verify","review","simplify","rebase","submit"],ks=["analyze","discuss","document","confirm"],ws=["review","report","fix"],_s=["review","report"];function Te(l){if(typeof l=="string")try{return Te(JSON.parse(l))}catch{return null}if(!l||typeof l!="object")return null;const c=l.stages;if(!Array.isArray(c)||c.length===0)return null;const a=c.map(r=>r&&typeof r=="object"?r.name:null).filter(r=>typeof r=="string"&&r.length>0);return a.length===c.length?a:null}function Ss(l){if(l.taskMode==="plan")return ks;if(l.taskMode==="review"){let c=!1;if(l.configSnapshot)try{c=!!JSON.parse(l.configSnapshot).skipFix}catch{}return c?_s:ws}if(!l.configSnapshot)return _e;try{const c=JSON.parse(l.configSnapshot);return Te(c.pipeline)??Te(c)??_e}catch{return _e}}function Cs(l){switch(l){case"stage_change":return"text-[var(--accent)]";case"info":return"text-[var(--text-secondary)]";case"warning":return"text-[var(--warning)]";case"error":return"text-[var(--destructive)]";case"system":return"text-[var(--info)]";default:return"text-[var(--text-muted)]"}}function Se({status:l,agentType:c}){const a=St(l),r=Z(c);return e.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-[4px] px-2 py-0.5 text-xs",style:{color:a},children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-[3px]",style:{backgroundColor:a}}),l.toLowerCase()," / ",r]})}function yt({stages:l,runningBg:c="bg-[#1a1a1a]",py:a="py-1.5"}){return e.jsx(e.Fragment,{children:l.map(r=>{const t=r.status==="completed",x=r.status==="running",m=r.status==="failed";return e.jsxs("div",{className:`flex items-center gap-2 rounded-[4px] px-2 ${a} ${x?c:""}`,children:[t&&e.jsx(ss,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),x&&e.jsx(Tt,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),m&&e.jsx(Ce,{className:"h-3.5 w-3.5 shrink-0 text-[var(--destructive)]"}),r.status==="pending"&&e.jsx(hs,{className:"h-3.5 w-3.5 shrink-0 text-[#525252]"}),e.jsx("span",{className:"text-xs",style:{color:t?"var(--accent)":x?"#e5e5e5":m?"var(--destructive)":"#525252",fontWeight:x?500:400},children:x?`> ${r.name}`:r.name})]},r.name)})})}function kt({task:l,ptyStatus:c,displayAgentType:a,t:r,gap:t="gap-2 md:gap-3"}){return e.jsxs("div",{className:`flex items-center ${t}`,children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:r("tasks.pty_terminal")}),e.jsxs("span",{className:`inline-flex items-center gap-1 text-[11px] ${c==="connected"?"text-[var(--accent)]":c==="connecting"?"text-[var(--warning)]":"text-[var(--text-muted)]"}`,children:[e.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${c==="connected"?"bg-[var(--accent)]":c==="connecting"?"bg-[var(--warning)]":"bg-[#525252]"}`}),r(`tasks.${c}`)]}),e.jsx("span",{className:"text-[11px]",style:{color:St(l.status)},children:l.status.toLowerCase()}),l.currentStage&&e.jsxs("span",{className:"hidden md:inline text-[11px] text-[var(--accent)]",children:[r("tasks.stage"),": ",l.currentStage]}),e.jsxs("span",{className:"hidden md:inline text-[11px] text-[var(--text-muted)]",children:["agent: ",a]}),l.workerName&&e.jsxs("span",{className:"hidden md:inline text-[11px] text-[var(--text-muted)]",children:["worker: ",l.workerName]})]})}function wt({isFinished:l,takeoverState:c,ptyRef:a,t:r}){return e.jsxs(e.Fragment,{children:[!l&&c==="auto"&&e.jsxs("button",{onClick:()=>{var t;return(t=a.current)==null?void 0:t.requestTakeover()},className:"flex items-center gap-1.5 rounded-[4px] px-2.5 h-10 md:h-8 text-[11px] font-medium text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:[e.jsx(cs,{className:"h-3 w-3"}),r("tasks.take_over")]}),!l&&c==="manual"&&e.jsxs("button",{onClick:()=>{var t;return(t=a.current)==null?void 0:t.releaseTakeover()},className:"flex items-center gap-1.5 rounded-[4px] px-2.5 h-10 md:h-8 text-[11px] font-medium text-[var(--accent)]",style:{backgroundColor:"rgba(34,197,94,0.12)"},children:[e.jsx(Ct,{className:"h-3 w-3"}),r("tasks.restore_auto")]})]})}function Ts(l){const c=Ss(l),a=l.currentStage?c.indexOf(l.currentStage):-1;return c.map((r,t)=>{let x="pending";return l.status===y.COMPLETED?x="completed":l.status===y.FAILED&&t<=a?x=t===a?"failed":"completed":a>=0&&(t<a?x="completed":t===a&&(x="running")),{name:r,status:x}})}function K(l,c){if(!l||!c)return null;const a=l.repoUrl.replace(/\.git$/,"").replace(/\/+$/,""),r=c.split("/").map(encodeURIComponent).join("/");return l.gitPlatform===_t.GITLAB?`${a}/-/tree/${r}`:`${a}/tree/${r}`}function Es(l,c){if(!l)return null;const a=l.repoUrl.replace(/\.git$/,"").replace(/\/+$/,""),r=c.split("/").map(encodeURIComponent).join("/");return l.gitPlatform===_t.GITLAB?`${a}/-/tree/${r}/docs/specs`:`${a}/tree/${r}/docs/specs`}function Hs(){var it,ot,xt;const{id:l}=Wt(),c=Vt(),{t:a}=xe(),r=as(s=>s.cancelTask),[t,x]=n.useState(null),[m,_]=n.useState(null),[h,P]=n.useState([]),[R,ee]=n.useState(!0),[d,S]=n.useState(null),[de,O]=n.useState(!1),[F,M]=n.useState(!1),[me,C]=n.useState(!1),[V,A]=n.useState(!1),[U,v]=n.useState(["claude"]),[I,T]=n.useState(""),[Le,Ie]=n.useState(!1),[De,Re]=n.useState(!1),[Et,Me]=n.useState(!1),[Lt,Ae]=n.useState(!1),[It,$e]=n.useState(!1),[Pe,Oe]=n.useState(""),[Fe,Ue]=n.useState(""),[qe,Be]=n.useState("append"),[Ge,pe]=n.useState(!1),[ze,Dt]=Xt(),[N,ue]=n.useState("terminal"),[Ke,We]=n.useState([]),[te,Ve]=n.useState(0),[X,q]=n.useState(0),[H,Xe]=n.useState(""),[se,Rt]=n.useState(""),[Mt,he]=n.useState(!1),[At,He]=n.useState(!1),[B,fe]=n.useState(null),[Je,ve]=n.useState("disconnected"),[ge,be]=n.useState("auto"),J=n.useRef(null),Qe=n.useRef(null),$t=rs(),[Ye,Ze]=n.useState([]),o=Number(l),g=t?xs.includes(t.status):!1;Ht(t?Jt(t,100):null);const E=n.useCallback(async()=>{try{const s=await f.get(`web/tasks/${o}`).json();x(s)}catch{}},[o]),ae=n.useCallback(async()=>{try{const s=await f.get(`web/tasks/${o}/logs`).json();P(s.lines)}catch{}},[o]),G=n.useCallback(async()=>{try{const s=await f.get(`web/tasks/${o}/pending-confirm`).json();S(s.confirm)}catch{S(null)}},[o]),et=n.useCallback(async()=>{he(!0);try{const s=new URLSearchParams;s.set("limit","50"),s.set("offset",String(X*50)),H&&s.set("type",H),se&&s.set("search",se);const i=await f.get(`web/tasks/${o}/events?${s}`).json();We(i.events),Ve(i.total)}catch{}finally{he(!1)}},[o,X,H,se]);n.useEffect(()=>{N==="logs"&&et()},[N,et]),n.useEffect(()=>{N==="pipeline"&&!g&&f.get(`web/workspaces/${o}`).json().then(fe).catch(()=>fe(null))},[N,o,g]);const z=dt(s=>s.lastEvent),tt=dt(s=>s.eventSeq);n.useEffect(()=>{ee(!0),x(null),_(null),P([]),S(null),fe(null),We([]),Ve(0),q(0),he(!1),Promise.all([E(),ae(),G()]).finally(()=>ee(!1))},[E,ae,G]),n.useEffect(()=>{t!=null&&t.projectKey&&f.get(`web/projects/${t.projectKey}`).json().then(_).catch(()=>_(null))},[t==null?void 0:t.projectKey]),n.useEffect(()=>{if(!t)return;let s=!1;return(async()=>{try{const i=[],p=[];let u=t.sourceTaskId??null,L=0;for(;u!=null&&L<2;){const w=await f.get(`web/tasks/${u}`).json();p.unshift({id:w.id,taskMode:w.taskMode??"develop"}),u=w.sourceTaskId??null,L++}i.push(...p),i.push({id:t.id,taskMode:t.taskMode??"develop"});const D=await f.get(`web/tasks?${new URLSearchParams({sourceTaskId:String(t.id),limit:"20"})}`).json();for(const w of D.data??[])i.push({id:w.id,taskMode:w.taskMode??"develop"});s||Ze(i)}catch{s||Ze([])}})(),()=>{s=!0}},[t==null?void 0:t.id,t==null?void 0:t.sourceTaskId,t==null?void 0:t.taskMode]),n.useEffect(()=>{!z||tt===0||(z.event==="task_status_changed"&&z.taskId===o||z.event==="task_created"&&z.taskId===o)&&(E(),G())},[tt,z,o,E,G]),n.useEffect(()=>{if(g)return;const i=setInterval(()=>{document.visibilityState!=="hidden"&&Promise.all([E(),ae(),G()])},15e3);return()=>clearInterval(i)},[g,E,ae,G]);const st=n.useCallback(()=>S(null),[]),re=n.useCallback(()=>{S(null),E()},[E]),Pt=(t==null?void 0:t.status)===y.FAILED||(t==null?void 0:t.status)===y.CANCELLED,je=(t==null?void 0:t.status)===y.COMPLETED||(t==null?void 0:t.status)===y.FAILED||(t==null?void 0:t.status)===y.CANCELLED,Ot=(t==null?void 0:t.status)===y.COMPLETED&&(!(t!=null&&t.taskMode)||(t==null?void 0:t.taskMode)==="develop");n.useEffect(()=>{ze.get("action")==="fork"&&t&&!R&&(je&&at(),Dt(s=>(s.delete("action"),s),{replace:!0}))},[t,R,ze,je]);async function Ft(){Me(!0);try{await r(o),O(!1),await E()}finally{Me(!1)}}async function Ut(){Ae(!0);try{await f.post(`web/tasks/${o}/retry`,{json:{reuseWorkspace:Ge}}),M(!1),pe(!1),await E()}finally{Ae(!1)}}function at(){Oe(""),Ue(""),Be("append"),C(!0)}async function qt(){$e(!0);try{const s=Pe.trim()||void 0,i=await f.post(`web/tasks/${o}/fork`,{json:{description:s,descriptionMode:s?qe:void 0,agentType:Fe||void 0}}).json();C(!1),W.success(a("tasks.fork_success")),c(`/tasks/${i.task.id}`)}catch{W.error(a("tasks.fork_error"))}finally{$e(!1)}}async function Bt(){if(t){Re(!0);try{await f.post(`web/tasks/${o}/review`,{json:{agentTypes:U.length>0?U:["claude"],description:I.trim()||void 0,skipFix:Le||void 0}}).json(),A(!1),T(""),Ie(!1),c(`/review/${o}`)}catch(s){const i=s instanceof Error?s.message:String(s);W.error(i)}finally{Re(!1)}}}const j=n.useMemo(()=>t?Ts(t):[],[t==null?void 0:t.configSnapshot,t==null?void 0:t.currentStage,t==null?void 0:t.status]),Ne=j.findIndex(s=>s.status==="running"),ne=n.useMemo(()=>{if(!(t!=null&&t.configSnapshot))return[];try{const s=JSON.parse(t.configSnapshot);return Array.isArray(s.defaultReviewers)?s.defaultReviewers:[]}catch{return[]}},[t==null?void 0:t.configSnapshot]);if(n.useEffect(()=>{ne.length>0&&v(ne)},[ne.join(",")]),R)return e.jsx("div",{className:"flex h-full items-center justify-center font-mono",children:e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:a("tasks.loading_task")})});if(!t)return e.jsxs("div",{className:"mx-auto max-w-5xl px-6 py-8 font-mono lowercase text-center",children:[e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:a("tasks.task_not_found")}),e.jsxs("button",{onClick:()=>c("/tasks"),className:"mt-4 rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:["< ",a("tasks.back_to_tasks")]})]});const k=t.status===y.QUEUED&&t.queuePosition!=null&&t.queueTotal!=null?{position:t.queuePosition,total:t.queueTotal}:null,b=is(t.startedAt,t.completedAt),Q=ns(t),ye=Z(t.agentType),Gt=[{value:"",label:a("tasks.fork_agent_type_placeholder",{agent:Z(Q)})},...ft(Z,Q)],le=`${a("tasks.status_suspended")} / ${ye}`,rt=k?e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"queue"}),e.jsxs("span",{className:"text-[var(--info)]",children:["#",k.position," / ",k.total]})]}):null,nt=t.taskMode&&t.taskMode!=="develop"?e.jsx("span",{className:"rounded-[4px] px-2 py-0.5 text-[10px] font-bold uppercase",style:t.taskMode==="plan"?{color:"#3b82f6",backgroundColor:"rgba(59,130,246,0.12)"}:{color:"#a855f7",backgroundColor:"rgba(168,85,247,0.12)"},children:t.taskMode}):null,ce=Ye.length>1?e.jsx("div",{className:"flex items-center gap-1 text-xs text-[var(--text-secondary)]",children:Ye.map((s,i)=>e.jsxs(Qt.Fragment,{children:[i>0&&e.jsx("span",{className:"text-[var(--text-muted)]",children:"→"}),e.jsxs(ie,{to:`/tasks/${s.id}`,className:s.id===t.id?"text-[var(--accent)]":"text-[var(--info)] hover:underline",children:[s.taskMode," #",s.id]})]},s.id))}):t.sourceTaskId?e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["source:"," ",e.jsxs(ie,{to:`/tasks/${t.sourceTaskId}`,className:"text-[var(--info)] hover:underline",children:["#",t.sourceTaskId]})]}):null,lt=e.jsxs("div",{className:"flex items-center gap-3 border-b border-[var(--border)] bg-[var(--bg-primary)] px-4 py-3 shrink-0 md:hidden",children:[e.jsx("button",{onClick:()=>c("/tasks"),className:"shrink-0 text-[var(--text-muted)]",children:e.jsx(ms,{className:"h-4 w-4"})}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"truncate text-sm font-medium text-[var(--text-primary)]",title:Yt(t),children:["#",t.id," ",mt(t,80)]}),nt]}),ce&&e.jsx("div",{className:"text-[11px]",children:ce})]})]}),ke=e.jsxs("div",{className:"hidden md:flex items-center gap-4 border-b border-[var(--border)] bg-[var(--bg-primary)] px-5 shrink-0",style:{height:44},children:[e.jsx(Se,{status:t.status,agentType:t.agentType}),nt,b&&e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["// time cost: ",b]}),k&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),e.jsx("span",{className:"text-xs text-[var(--info)]",children:a("tasks.queue_position",{position:String(k.position),total:String(k.total)})})]}),e.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),e.jsxs(ie,{to:`/projects/${t.projectKey}`,className:"text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:["project: ",e.jsx("span",{className:"text-[var(--text-primary)]",children:t.projectKey})]}),t.branch&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["branch: ",K(m,t.branch)?e.jsx("a",{href:K(m,t.branch),target:"_blank",rel:"noopener noreferrer",className:"text-[var(--text-primary)] hover:text-[var(--info)] hover:underline transition-colors",children:t.branch}):e.jsx("span",{className:"text-[var(--text-primary)]",children:t.branch})]})]}),t.mrUrl&&/^https?:\/\//.test(t.mrUrl)&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),e.jsxs("a",{href:t.mrUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-[var(--info)] hover:underline",children:["MR: ",((it=t.mrUrl.match(/!?\d+$/))==null?void 0:it[0])??"view"]})]}),ce&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),ce]})]}),ct=e.jsxs("div",{className:"flex items-center gap-3 border-t border-[var(--border)] bg-[var(--bg-primary)] px-4 md:px-5 shrink-0",style:{height:48},children:[!g&&e.jsxs("button",{onClick:()=>O(!0),className:"flex flex-1 md:flex-none items-center justify-center gap-1.5 rounded-[4px] bg-[var(--destructive)]/10 px-3 h-8 text-[11px] font-medium text-[var(--destructive)]",children:[e.jsx(Ce,{className:"h-3 w-3"}),a("tasks.cancel_task")]}),Pt&&e.jsxs("button",{onClick:()=>M(!0),className:"flex flex-1 md:flex-none items-center justify-center gap-1.5 rounded-[4px] bg-[var(--bg-card)] px-3 h-8 text-[11px] text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-input)] transition-colors cursor-pointer",children:[e.jsx(Ct,{className:"h-3 w-3"}),a("tasks.retry_task")]}),je&&e.jsxs("button",{onClick:at,className:"flex flex-1 md:flex-none items-center justify-center gap-1.5 rounded-[4px] bg-[var(--bg-card)] px-3 h-8 text-[11px] text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-input)] transition-colors cursor-pointer",children:[e.jsx(ps,{className:"h-3 w-3"}),a("tasks.fork_task")]}),Ot&&e.jsxs("button",{onClick:()=>A(!0),className:"flex flex-1 md:flex-none items-center justify-center gap-1.5 rounded-[4px] px-3 h-8 text-[11px] font-medium text-[var(--accent)]",style:{backgroundColor:"rgba(34,197,94,0.12)"},children:[e.jsx(vt,{className:"h-3 w-3"}),a("review.launch")]}),t.workerId&&!g&&e.jsxs("button",{onClick:()=>{ue("pipeline"),setTimeout(()=>{var s,i;(i=(s=Qe.current)==null?void 0:s.scrollIntoView)==null||i.call(s,{behavior:"smooth",block:"center"})},50)},className:"hidden lg:flex items-center justify-center gap-1.5 rounded-[4px] px-3 h-8 text-[11px] font-medium text-[var(--info)]",style:{backgroundColor:"rgba(59,130,246,0.12)"},children:[e.jsx(gt,{className:"h-3 w-3"}),a("tasks.cursor_tunnel")]})]}),zt=e.jsxs("div",{className:"hidden w-[280px] shrink-0 flex-col gap-6 overflow-y-auto border-l border-[var(--border)] bg-[var(--bg-primary)] p-4 lg:flex",children:[e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:a("tasks.pipeline_stages")}),e.jsx(yt,{stages:j})]}),b&&e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2 text-[11px] text-[var(--text-secondary)]",children:["// time cost: ",b]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:a("tasks.activity_log")}),h.length>0?e.jsx("div",{className:"flex flex-col gap-1.5",children:h.slice(0,8).map((s,i)=>e.jsx("p",{className:"text-[11px] leading-relaxed text-[var(--text-muted)]",children:s},i))}):e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.no_activity")})]})]}),we=e.jsxs(e.Fragment,{children:[e.jsx(Ns,{isOpen:de,onClose:()=>O(!1),onConfirm:Ft,taskId:o,isLoading:Et}),e.jsx(ys,{isOpen:F,onClose:()=>{M(!1),pe(!1)},onConfirm:Ut,taskId:o,mrUrl:t.mrUrl??void 0,isLoading:Lt,reuseWorkspace:Ge,onReuseWorkspaceChange:pe}),e.jsx(Ee,{isOpen:me,onClose:()=>C(!1),onConfirm:qt,title:a("tasks.fork_task"),message:a("tasks.fork_task_desc"),confirmLabel:a("tasks.fork_task"),confirmVariant:"accent",isLoading:It,children:e.jsxs("div",{className:"mt-3 flex flex-col gap-2",children:[e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["fork of #",o]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.form_agent_type")}),e.jsx(ht,{value:Fe,onChange:Ue,options:Gt})]}),e.jsx("textarea",{value:Pe,onChange:s=>Oe(s.target.value),placeholder:a("tasks.fork_description_placeholder"),rows:4,className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)] resize-none"}),e.jsxs("label",{className:"flex items-start gap-2 rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] px-3 py-2 text-[11px] text-[var(--text-secondary)]",children:[e.jsx("input",{type:"checkbox",checked:qe==="replace",onChange:s=>Be(s.target.checked?"replace":"append"),className:"mt-0.5 h-3.5 w-3.5 rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] accent-[var(--accent)]"}),e.jsxs("span",{children:[a("tasks.fork_replace_description"),e.jsx("span",{className:"mt-1 block text-[10px] text-[var(--text-muted)]",children:a("tasks.fork_append_hint")})]})]})]})}),V&&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:a("review.launch")}),e.jsx("button",{onClick:()=>A(!1),className:"text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:e.jsx(Ce,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsxs("p",{className:"text-[11px] text-[var(--text-muted)]",children:["task #",o," — ",a("review.select_agents")]}),ne.length>0&&e.jsx("span",{className:"rounded-[4px] border border-amber-500/40 bg-amber-500/10 px-1.5 py-0.5 text-[10px] text-amber-500",children:"using project defaults"})]}),e.jsx("div",{className:"mb-4 flex flex-col gap-2",children:ft(Z).map(s=>e.jsxs("label",{className:"flex cursor-pointer items-center gap-2.5 rounded-[4px] border border-[var(--border)] px-3 py-2 text-xs hover:bg-[var(--bg-input)] transition-colors",children:[e.jsx("input",{type:"checkbox",checked:U.includes(s.value),onChange:()=>v(i=>i.includes(s.value)?i.filter(p=>p!==s.value):[...i,s.value]),className:"h-3.5 w-3.5 accent-[var(--accent)]"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:s.label})]},s.value))}),e.jsx("textarea",{value:I,onChange:s=>T(s.target.value),placeholder:a("review.description_placeholder"),rows:3,className:"mb-3 w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)] resize-none"}),e.jsxs("label",{className:"mb-4 flex cursor-pointer items-center gap-2.5 rounded-[4px] border border-[var(--border)] px-3 py-2 text-xs hover:bg-[var(--bg-input)] transition-colors",children:[e.jsx("input",{type:"checkbox",checked:Le,onChange:s=>Ie(s.target.checked),className:"h-3.5 w-3.5 accent-[var(--accent)]"}),e.jsx("span",{className:"text-[var(--text-muted)]",children:a("review.skip_fix_label")})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:Bt,disabled:De||U.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(vt,{className:"h-3 w-3"}),a(De?"common.processing":"review.launch")]}),e.jsx("button",{onClick:()=>A(!1),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:a("common.cancel")})]})]})})]});return At&&N==="terminal"?e.jsxs("div",{className:"fixed inset-0 z-50 flex flex-col bg-[var(--bg-primary)] font-mono lowercase h-screen",style:{height:"100dvh",paddingTop:"env(safe-area-inset-top, 0px)",paddingBottom:"env(safe-area-inset-bottom, 0px)"},children:[ke,e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 shrink-0",style:{height:36,backgroundColor:"#111111"},children:[e.jsx(kt,{task:t,ptyStatus:Je,displayAgentType:Q,t:a,gap:"gap-3"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(wt,{isFinished:g,takeoverState:ge,ptyRef:J,t:a}),e.jsx("button",{onClick:()=>He(!1),className:"flex items-center rounded-[4px] bg-[var(--bg-card)] px-2.5 py-1 text-[var(--text-muted)]",children:e.jsx(gs,{className:"h-3 w-3"})})]})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(ut,{ref:J,taskId:o,sessionId:t.currentSessionId??void 0,taskFinished:g,onStatusChange:ve,onTakeoverChange:be})}),ct,we]}):t.status===y.SUSPENDED?e.jsxs("div",{className:"flex h-full flex-col font-mono lowercase",children:[lt,ke,e.jsx("div",{className:"flex items-center gap-2 border-b px-4 md:px-6 py-2 text-xs shrink-0",style:{backgroundColor:"rgba(245,158,11,0.08)",borderColor:"rgba(245,158,11,0.2)",color:"var(--warning)"},children:a("tasks.task_suspended_banner")}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col md:flex-row gap-4 md:gap-6 p-4 md:p-6 overflow-y-auto",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-4",children:[e.jsxs("div",{className:"hidden md:flex items-center gap-3",children:[e.jsxs("span",{className:"text-xl font-bold text-[var(--text-primary)]",children:["#",t.id]}),e.jsx("span",{className:"text-base text-[var(--text-secondary)] truncate max-w-[60%]",children:e.jsx(ds,{content:t.description,children:mt(t,200)})}),e.jsx("span",{className:"rounded-[4px] px-2.5 py-1 text-[11px] font-bold text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:le})]}),e.jsx("div",{className:"flex items-center gap-2 md:hidden",children:e.jsx("span",{className:"rounded-[4px] px-2.5 py-1 text-[11px] font-bold text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:le})}),d&&e.jsxs("div",{className:"rounded-[4px] border p-4",style:{borderColor:"rgba(245,158,11,0.27)",backgroundColor:"#1a1a1a"},children:[e.jsx("p",{className:"mb-2 text-[11px] font-bold text-[var(--accent)]",children:a("tasks.pending_confirmation")}),e.jsx("p",{className:"mb-3 text-xs text-[var(--text-secondary)]",children:d.prompt??a("tasks.pipeline_requires_confirmation")}),e.jsx("div",{className:"mb-3 flex flex-col gap-1.5 text-[11px]",children:e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"stage"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:d.stageName})]})}),e.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:flex-wrap md:gap-3",children:[e.jsx("button",{onClick:async()=>{try{await f.post(`web/tasks/${o}/confirm-stage`,{json:{stageName:d.stageName,approved:!0,feedback:""}}),re()}catch{W.error(a("tasks.confirm_failed"))}},className:"flex-1 md:flex-none rounded-[4px] bg-[var(--accent)] px-4 py-2.5 md:py-2 text-[11px] font-bold text-[#0c0c0c]",children:a("tasks.confirm_and_proceed")}),e.jsx("button",{onClick:async()=>{try{await f.post(`web/tasks/${o}/confirm-stage`,{json:{stageName:d.stageName,approved:!1,feedback:""}}),re()}catch{W.error(a("tasks.confirm_failed"))}},className:"flex-1 md:flex-none rounded-[4px] bg-[#1a1a1a] px-4 py-2.5 md:py-2 text-[11px] text-[var(--destructive)]",style:{border:"1px solid rgba(239,68,68,0.27)"},children:a("tasks.reject")})]})]}),e.jsxs("div",{className:"flex flex-col gap-3 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 lg:hidden",children:[e.jsx("span",{className:"text-xs font-bold text-[var(--accent)]",children:a("tasks.task_info")}),e.jsxs("div",{className:"flex flex-col gap-1.5 text-[11px]",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"status"}),e.jsx("span",{className:"font-bold text-[var(--warning)]",children:le})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"project"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.projectKey})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"worker"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.workerName??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"created"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:Y(t.createdAt)})]})]})]}),e.jsx("div",{className:"hidden md:flex flex-wrap items-center gap-2 py-2",children:j.map((s,i)=>{const p=s.status==="failed",u=s.status==="completed",L=s.status==="running"&&t.status===y.SUSPENDED,D=p?"var(--destructive)":u?"var(--accent)":L?"var(--warning)":"#525252",w=p?"rgba(239,68,68,0.12)":u?"rgba(34,197,94,0.12)":L?"rgba(245,158,11,0.12)":"transparent";return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"rounded-[4px] px-2.5 py-1 text-[11px]",style:{color:D,backgroundColor:w,fontWeight:L?700:400,border:L?`1px solid ${D}`:void 0},children:L?"confirm":`${s.name}${u?" ✓":p?" ✗":""}`}),i<j.length-1&&e.jsx("div",{className:"h-px w-6 bg-[var(--border)]"})]},s.name)})}),e.jsxs("div",{className:"hidden md:block min-h-[200px] flex-1 rounded-[4px] border border-[var(--border)] bg-[#0c0c0c] p-4",children:[e.jsx("p",{className:"mb-2 text-[11px] font-bold text-[var(--accent)]",children:a("tasks.pty_output")}),e.jsxs("div",{className:"flex flex-col gap-1",children:[h.slice(-10).map((s,i)=>e.jsx("p",{className:"text-[11px] leading-relaxed text-[var(--text-secondary)]",children:s},i)),h.length===0&&e.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.no_output")})]})]})]}),e.jsxs("div",{className:"hidden w-[280px] shrink-0 flex-col gap-4 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 lg:flex",children:[e.jsx("span",{className:"text-[13px] font-bold text-[var(--accent)]",children:a("tasks.task_info")}),e.jsxs("div",{className:"flex flex-col gap-1.5 text-[11px]",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"status"}),e.jsx("span",{className:"font-bold text-[var(--warning)]",children:le})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"project"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.projectKey})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"worker"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.workerName??"-"})]})]}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsx("span",{className:"text-xs font-bold text-[var(--accent)]",children:a("tasks.stage_timeline")}),e.jsx("div",{className:"flex flex-col gap-2",children:j.map(s=>{const i=s.status==="completed"?"var(--info)":s.status==="failed"?"var(--destructive)":s.status==="running"?"var(--warning)":"#525252",p=s.status==="failed"?"var(--destructive)":s.status==="running"?"var(--warning)":"#a3a3a3",u=s.status==="completed"?"completed":s.status==="running"?"suspended":s.status==="failed"?"failed":"pending";return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"h-2 w-2 shrink-0 rounded-[4px]",style:{backgroundColor:i}}),e.jsxs("span",{className:"text-[11px]",style:{color:p,fontWeight:s.status==="running"?700:400},children:[s.name," ",u]})]},s.name)})}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsx("div",{className:"flex flex-col gap-1.5 text-[11px]",children:e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"created"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:Y(t.createdAt)})]})})]})]}),d&&e.jsx(pt,{isOpen:!!d,onClose:st,taskId:o,stageName:d.stageName,timeoutSeconds:Math.ceil(d.timeout/1e3),confirmType:d.confirmType,onSubmitted:re}),we]}):e.jsxs("div",{className:"flex h-full flex-col overflow-hidden font-mono lowercase",children:[lt,e.jsxs("div",{className:"flex flex-wrap items-center gap-3 gap-y-1 border-b border-[var(--border)] bg-[var(--bg-primary)] px-4 py-2 shrink-0 md:hidden",children:[e.jsx(Se,{status:t.status,agentType:t.agentType}),b&&e.jsxs("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:["// time cost: ",b]}),e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:t.projectKey}),t.workerName&&e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:t.workerName}),t.branch&&(K(m,t.branch)?e.jsx("a",{href:K(m,t.branch),target:"_blank",rel:"noopener noreferrer",className:"shrink-0 text-[11px] text-[var(--text-muted)] hover:text-[var(--info)] hover:underline truncate max-w-[80px] md:max-w-[120px] transition-colors",children:t.branch}):e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)] truncate max-w-[80px] md:max-w-[120px]",children:t.branch}))]}),ke,t.errorMessage&&e.jsxs("div",{className:"flex items-center gap-2 border-b px-6 py-2 text-xs shrink-0 bg-[var(--destructive)]/10 text-[var(--destructive)]",style:{borderColor:"rgba(239,68,68,0.2)"},children:["// error: ",t.errorMessage]}),k&&e.jsxs("div",{className:"flex items-center gap-2 border-b px-4 md:px-6 py-2 text-xs shrink-0 text-[var(--info)]",style:{backgroundColor:"color-mix(in srgb, var(--info) 8%, transparent)",borderColor:"color-mix(in srgb, var(--info) 20%, transparent)"},children:[e.jsx(fs,{className:"h-3.5 w-3.5 shrink-0"}),e.jsxs("span",{children:[a("tasks.queue_position_banner",{position:String(k.position),total:String(k.total)}),k.position>1?` — ${a("tasks.queue_ahead",{count:String(k.position-1)})}`:` — ${a("tasks.queue_next")}`]})]}),d&&e.jsx(pt,{isOpen:!!d,onClose:st,taskId:o,stageName:d.stageName,timeoutSeconds:Math.ceil(d.timeout/1e3),confirmType:d.confirmType,onSubmitted:re}),e.jsxs("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[e.jsx("div",{className:"flex items-center border-b border-[var(--border)] shrink-0 overflow-x-auto no-scrollbar",children:["terminal","pipeline","logs","detail"].map(s=>e.jsx("button",{onClick:()=>ue(s),className:`shrink-0 whitespace-nowrap px-4 py-2.5 text-xs transition-colors ${N===s?"border-b-2 border-[var(--accent)] text-[var(--accent)] font-medium":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:a(s==="terminal"?"tasks.terminal":s==="pipeline"?"tasks.pipeline_tab":s==="logs"?"tasks.logs":"tasks.detail_tab")},s))}),N==="terminal"&&e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-3 md:px-5 shrink-0",style:{height:36,backgroundColor:"#111111"},children:[e.jsx(kt,{task:t,ptyStatus:Je,displayAgentType:Q,t:a}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(wt,{isFinished:g,takeoverState:ge,ptyRef:J,t:a}),!g&&ge==="requesting"&&e.jsxs("span",{className:"flex items-center gap-1.5 px-2.5 h-10 md:h-8 text-[11px] text-[var(--warning)]",children:[e.jsx(Tt,{className:"h-3 w-3 animate-spin"}),a("tasks.requesting_takeover")]}),!g&&t.currentStage&&e.jsxs("button",{className:"hidden md:flex items-center gap-1.5 rounded-[4px] bg-[var(--bg-card)] px-2.5 h-10 md:h-8 text-[11px] text-[var(--text-muted)]",children:[e.jsx(us,{className:"h-3 w-3"}),a("tasks.skip_stage")]}),e.jsx("button",{onClick:()=>He(!0),className:"hidden md:flex items-center rounded-[4px] bg-[var(--bg-card)] px-2.5 h-10 md:h-8 text-[var(--text-muted)]",children:e.jsx(vs,{className:"h-3 w-3"})})]})]}),e.jsxs("div",{className:"border-b border-[var(--border)] px-4 py-2 shrink-0 md:hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[t.currentStage&&e.jsxs("span",{className:"text-[11px] font-semibold text-[var(--accent)]",children:[a("tasks.stage"),": ",t.currentStage]}),e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["agent: ",Q]}),t.workerName&&e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["worker: ",t.workerName]})]}),e.jsx("div",{className:"overflow-x-auto no-scrollbar pr-4",style:{borderRadius:0},children:e.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",children:[e.jsx("span",{className:"shrink-0 text-[11px] font-bold text-[var(--accent)]",children:a("tasks.stage_progress")}),j.map((s,i)=>{const p=s.status==="completed",u=s.status==="running",D=s.status==="failed"?"var(--destructive)":p||u?"var(--accent)":"#525252";return e.jsxs("div",{className:"flex items-center",children:[e.jsxs("span",{className:"shrink-0 text-[11px] leading-normal whitespace-nowrap",style:{color:D,fontWeight:u?600:400},children:[s.name,p?" ✓":u?" ...":""]}),i<j.length-1&&e.jsx("div",{className:"mx-1.5 h-px w-4 shrink-0",style:{backgroundColor:D}})]},s.name)})]})})]}),$t?e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(ls,{ref:J,taskId:o,sessionId:t.currentSessionId??void 0,taskFinished:g,onStatusChange:ve,onTakeoverChange:be})}):e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(ut,{ref:J,taskId:o,sessionId:t.currentSessionId??void 0,taskFinished:g,onStatusChange:ve,onTakeoverChange:be})}),ct]}),N==="pipeline"&&e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto p-4 md:p-6 lg:p-8",children:[e.jsx("div",{className:"mb-4 md:mb-5 overflow-x-auto no-scrollbar",style:{borderRadius:0},children:e.jsx("div",{className:"flex items-center py-5",children:j.map((s,i)=>{const p=s.status==="completed",u=s.status==="running",w=s.status==="failed"?"var(--destructive)":p||u?"var(--accent)":"#525252";return e.jsxs("div",{className:"flex items-center",style:{flex:i<j.length-1?1:void 0},children:[e.jsxs("div",{className:"flex flex-col items-center gap-1.5",children:[e.jsxs("div",{className:"flex h-6 w-6 md:h-7 md:w-7 items-center justify-center rounded-full shrink-0",style:{backgroundColor:w},children:[p&&e.jsx("span",{className:"text-[11px] md:text-xs font-semibold text-[#0c0c0c]",children:"✓"}),u&&e.jsx("span",{className:"h-2 w-2 md:h-2.5 md:w-2.5 rounded-full bg-[#0c0c0c]"})]}),e.jsx("span",{className:"text-[11px] leading-normal font-medium whitespace-nowrap",style:{color:w},children:s.name})]}),i<j.length-1&&e.jsx("div",{className:"mx-1 md:mx-2 h-0.5 flex-1 min-w-3 rounded-full",style:{backgroundColor:i<(Ne>=0?Ne:0)?"var(--accent)":"#525252"}})]},s.name)})})}),t.currentStage&&e.jsxs("div",{className:"mb-4 md:mb-5 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 text-xs leading-relaxed",children:[e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// stage: ",t.currentStage," (",Ne+1,"/",j.length,")"]}),t.startedAt&&e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// elapsed: ",Y(t.startedAt).replace(" ago","")]}),b&&e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// time cost: ",b]}),e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// retries: ",t.retryCount,"/2"]})]}),!t.currentStage&&b&&e.jsx("div",{className:"mb-4 md:mb-5 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 text-xs leading-relaxed",children:e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// time cost: ",b]})}),e.jsx("button",{onClick:()=>ue("terminal"),className:"flex-1 min-h-[100px] rounded-[4px] border border-dashed border-[var(--border)] flex items-center justify-center gap-2 text-[11px] text-[var(--text-muted)] hover:border-[var(--accent)] hover:text-[var(--accent)] transition-colors",children:e.jsxs("span",{children:["// ",a("tasks.view_terminal")]})}),e.jsxs("div",{className:"mt-4 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 lg:hidden",children:[e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:a("tasks.task_info")}),e.jsxs("div",{className:"mt-2 flex flex-col gap-1.5 text-[11px]",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"project"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.projectKey})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"worker"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.workerName??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"branch"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.branch??"-"})]}),rt]})]}),e.jsxs("div",{className:"flex flex-col gap-6 mt-4 lg:hidden",children:[e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:a("tasks.pipeline_stages")}),e.jsx(yt,{stages:j,runningBg:"bg-[var(--bg-input)]",py:"py-2"})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:a("tasks.activity_log")}),h.length>0?e.jsx("div",{className:"flex flex-col gap-1.5",children:h.slice(-12).map((s,i)=>e.jsx("p",{className:"text-[11px] leading-relaxed text-[var(--text-muted)]",children:s},i))}):e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.no_activity")})]})]})]}),N==="logs"&&e.jsxs("div",{className:"flex flex-1 flex-col gap-3 md:gap-5 overflow-y-auto p-4 md:p-6 lg:p-8",children:[e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)] md:hidden",children:a("tasks.task_logs")}),e.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-center md:gap-3",children:[e.jsx("div",{className:"flex items-center gap-1 overflow-x-auto no-scrollbar md:hidden",children:["","error","system"].map(s=>e.jsx("button",{onClick:()=>{Xe(s),q(0)},className:`shrink-0 rounded-[4px] px-2.5 py-1 text-[11px] ${H===s?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)]"}`,children:s||"all"},s))}),e.jsx("div",{className:"hidden md:block",children:e.jsx(ht,{value:H,onChange:s=>{Xe(s),q(0)},options:[{value:"",label:"all"},{value:"stage_change",label:"stage_change"},{value:"info",label:"info"},{value:"warning",label:"warning"},{value:"error",label:"error"},{value:"system",label:"system"}],className:"w-36"})}),e.jsxs("div",{className:"flex flex-1 items-center gap-2 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2",children:[e.jsx(Zt,{className:"h-3.5 w-3.5 text-[var(--text-muted)]"}),e.jsx("input",{type:"text",placeholder:a("tasks.search_logs"),value:se,onChange:s=>{Rt(s.target.value),q(0)},className:"flex-1 bg-transparent text-xs text-[var(--text-primary)] outline-none placeholder:text-[var(--text-muted)]"})]})]}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[Ke.map((s,i)=>e.jsxs("div",{className:`flex items-start md:items-center gap-2 md:gap-4 rounded-[4px] px-2 md:px-3 py-2 text-[11px] md:text-xs ${i%2===0?"bg-[var(--bg-card)]":""}`,children:[e.jsx("span",{className:"shrink-0 text-[var(--text-muted)]",children:new Date(s.timestamp).toLocaleTimeString("en-US",{hour12:!1})}),e.jsx("span",{className:`shrink-0 font-medium ${Cs(s.type)}`,children:s.type}),e.jsx("span",{className:"min-w-0 break-words md:truncate text-[var(--text-primary)]",children:s.message})]},s.id)),Ke.length===0&&!Mt&&e.jsx("p",{className:"py-8 text-center text-xs text-[var(--text-muted)]",children:a("tasks.no_log_entries")})]}),te>50&&e.jsxs("div",{className:"flex items-center justify-center gap-1",children:[Array.from({length:Math.ceil(te/50)}).slice(0,5).map((s,i)=>e.jsx("button",{onClick:()=>q(i),className:`rounded-[4px] px-2 py-1 text-xs ${X===i?"bg-[var(--accent)] text-black font-medium":"text-[var(--text-muted)] hover:text-[var(--text-primary)]"}`,children:i+1},i)),Math.ceil(te/50)>5&&e.jsx("button",{onClick:()=>q(X+1),disabled:X>=Math.ceil(te/50)-1,className:"rounded-[4px] px-2 py-1 text-xs text-[var(--text-muted)] disabled:opacity-30",children:">"})]})]}),N==="detail"&&e.jsxs("div",{className:"flex flex-1 flex-col gap-4 md:gap-5 overflow-y-auto p-4 md:p-6 lg:p-8",children:[e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 md:p-5",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx(es,{className:"h-3.5 w-3.5 text-[var(--accent)]"}),e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:a("tasks.detail_basic_info")})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3",children:[e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.detail_creator")}),e.jsx("span",{className:"text-xs text-[var(--text-primary)]",children:t.creatorName??"-"})]}),e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("common.created_at")}),e.jsx("span",{className:"text-xs text-[var(--text-primary)]",children:os(t.createdAt)}),e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:Y(t.createdAt)})]}),e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("common.status")}),e.jsx(Se,{status:t.status,agentType:t.agentType})]}),e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.detail_project")}),e.jsx(ie,{to:`/projects/${t.projectKey}`,className:"text-xs text-[var(--info)] hover:underline transition-colors",children:t.projectKey})]}),e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.detail_worker")}),e.jsx("span",{className:"text-xs text-[var(--text-primary)]",children:t.workerName??"-"})]}),e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.form_agent_type")}),e.jsx("span",{className:"text-xs text-[var(--text-primary)]",children:ye})]}),b&&e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.detail_time_cost")}),e.jsx("span",{className:"text-xs text-[var(--text-primary)]",children:b})]}),t.branch&&e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.detail_branch")}),K(m,t.branch)?e.jsx("a",{href:K(m,t.branch),target:"_blank",rel:"noopener noreferrer",className:"text-xs text-[var(--info)] hover:underline transition-colors truncate",children:t.branch}):e.jsx("span",{className:"text-xs text-[var(--text-primary)] truncate",children:t.branch})]}),t.mrUrl&&/^https?:\/\//.test(t.mrUrl)&&e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.mr_link")}),e.jsx("a",{href:t.mrUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-[var(--info)] hover:underline truncate",children:((ot=t.mrUrl.match(/!?\d+$/))==null?void 0:ot[0])??"view"})]})]})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 md:p-5",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx(bt,{className:"h-3.5 w-3.5 text-[var(--accent)]"}),e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:a("tasks.detail_task_name")})]}),e.jsxs("div",{className:"flex flex-col gap-3",children:[t.name&&e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.detail_ai_name")}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:t.name})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.detail_task_id")}),e.jsxs("span",{className:"text-xs text-[var(--text-secondary)]",children:["#",t.id]})]}),t.sourcePlatform&&e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.detail_source")}),e.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:t.sourcePlatform})]})]})]}),t.taskMode==="plan"&&t.status===y.COMPLETED&&(()=>{let s="main";if(t.configSnapshot)try{const p=JSON.parse(t.configSnapshot);p.defaultBranch&&(s=p.defaultBranch)}catch{}const i=Es(m,s);return i?e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 md:p-5",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx(bt,{className:"h-3.5 w-3.5 text-[var(--accent)]"}),e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:a("plan.view_spec")})]}),e.jsxs("p",{className:"mb-2 text-xs text-[var(--text-muted)]",children:["the spec document was pushed to ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:s})," at ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:"docs/specs/"})]}),e.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--info)] hover:underline transition-colors",children:[e.jsx(gt,{className:"h-3 w-3"}),a("plan.view_spec")]})]}):null})(),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 md:p-5",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx(ts,{className:"h-3.5 w-3.5 text-[var(--accent)]"}),e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:a("tasks.detail_description")})]}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[#0c0c0c] p-4 overflow-x-auto",children:e.jsx("pre",{className:"whitespace-pre-wrap break-words text-xs leading-relaxed text-[var(--text-secondary)] font-mono",children:t.description})})]})]})]}),N==="terminal"&&zt,N==="pipeline"&&e.jsxs("div",{className:"hidden w-[420px] shrink-0 flex-col gap-5 overflow-y-auto border-l border-[var(--border)] bg-[var(--bg-primary)] p-5 lg:flex",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[13px] font-semibold text-[var(--accent)]",children:a("tasks.task_info")}),e.jsxs("div",{className:"flex flex-col gap-1.5 text-xs",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"project"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.projectKey})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"creator"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.creatorName??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"worker"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.workerName??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:a("common.created_at")}),e.jsx("span",{className:"text-[var(--text-primary)]",children:Y(t.createdAt)})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:a("tasks.form_agent_type")}),e.jsx("span",{className:"text-[var(--text-primary)]",children:ye})]}),b&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"time cost"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:b})]}),rt]})]}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[13px] font-semibold text-[var(--accent)]",children:a("tasks.workspace_section")}),e.jsxs("div",{className:"flex flex-col gap-1.5 text-xs",children:[e.jsxs("div",{className:"flex min-w-0 justify-between",children:[e.jsx("span",{className:"shrink-0 text-[var(--text-muted)]",children:"branch"}),e.jsx("span",{className:"ml-4 min-w-0 truncate text-[var(--text-primary)]",children:t.branch??(B==null?void 0:B.branch)??"-"})]}),e.jsxs("div",{className:"flex min-w-0 justify-between",children:[e.jsx("span",{className:"shrink-0 text-[var(--text-muted)]",children:"worktree"}),e.jsx("span",{className:"ml-4 min-w-0 truncate text-[var(--text-primary)]",children:(B==null?void 0:B.path)??"-"})]}),t.mrUrl&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:a("tasks.mr_link")}),e.jsx("a",{href:t.mrUrl,target:"_blank",rel:"noopener noreferrer",className:"font-medium text-[var(--info)] hover:underline",children:((xt=t.mrUrl.match(/!?\d+$/))==null?void 0:xt[0])??"view"})]})]})]}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsxs("div",{ref:Qe,className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[13px] font-semibold text-[var(--accent)]",children:a("tasks.cursor_tunnel_section")}),t.workerId?e.jsx(js,{taskId:o,taskFinished:g,compact:!0}):e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.no_worker_assigned")})]}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[13px] font-semibold text-[var(--accent)]",children:a("tasks.stage_timeline")}),e.jsx("div",{className:"flex flex-col gap-2 text-xs",children:j.map(s=>{const i=s.status==="completed"?"✓":s.status==="running"?"→":"·",p=s.status==="running"?"var(--accent)":s.status==="completed"?"var(--info)":s.status==="failed"?"var(--destructive)":"#525252",u=s.status==="completed"?"done":s.status==="running"?"running...":s.status==="failed"?"failed":"pending";return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-semibold",style:{color:p},children:i}),e.jsx("span",{className:s.status==="running"?"font-medium":"",style:{color:p},children:s.name}),e.jsxs("span",{className:"text-[11px]",style:{color:"#525252"},children:["— ",u]})]},s.name)})})]})]})]}),we]})}export{Hs as default};
|
|
21
|
+
*/const gs=oe("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);function bs(l,c){const a=new Date(l).getTime()-Date.now();if(a<=0)return c("tasks.tunnel_expired");const r=Math.floor(a/36e5),t=Math.floor(a%36e5/6e4);return r>0?c("tasks.tunnel_expires_hm",{h:r,m:t}):c("tasks.tunnel_expires_m",{m:t})}function jt(l){switch(l){case"CONNECTED":return"var(--accent)";case"STARTING":return"var(--warning)";case"EXPIRED":return"var(--text-muted)";default:return"var(--text-muted)"}}function Nt(l,c){switch(l){case"IDLE":case"CLOSED":return c("tasks.tunnel_idle");case"STARTING":return c("tasks.tunnel_starting");case"CONNECTED":return c("tasks.tunnel_connected");case"EXPIRED":return c("tasks.tunnel_expired");case"CLOSING":return c("tasks.tunnel_closing");default:return String(l).toLowerCase()}}function js({taskId:l,taskFinished:c,compact:a}){const{t:r}=xe(),[t,d]=n.useState($.IDLE),[m,_]=n.useState(null),[h,P]=n.useState(null),[R,ee]=n.useState(""),[x,S]=n.useState(!1),[de,F]=n.useState(!1),O=n.useRef(null),M=n.useCallback(async()=>{try{const v=await f.get(`web/workspace-tunnel/${l}/status`).json();d(v.status),_(v.tunnelUrl??null),P(v.expiresAt??null),(v.status==="EXPIRED"||v.status==="IDLE"||v.status==="CLOSED")&&C()}catch{}},[l]);function me(){C(),O.current=setInterval(M,5e3)}function C(){O.current&&(clearInterval(O.current),O.current=null)}n.useEffect(()=>{c&&(t===$.STARTING||t===$.CONNECTED)&&(d($.IDLE),_(null),C())},[c,t]),n.useEffect(()=>{if(t!=="CONNECTED"||!h)return;const v=()=>{const T=bs(h,r);ee(T),T===r("tasks.tunnel_expired")&&(d($.EXPIRED),_(null),C())};v();const I=setInterval(v,3e4);return()=>clearInterval(I)},[t,h]),n.useEffect(()=>()=>C(),[]),n.useEffect(()=>{c||M()},[M,c]);async function V(){S(!0);try{await f.post(`web/workspace-tunnel/${l}/start`),d($.STARTING),me()}catch(v){let I=r("tasks.tunnel_start_failed");try{if(v instanceof Kt){const T=await v.response.json();T!=null&&T.error&&(I=T.error,/code.*not found|ENOENT.*code|spawn code/i.test(I)&&(I+=". "+r("tasks.tunnel_install_code_hint")))}}catch{}W.error(I)}finally{S(!1)}}async function A(){S(!0);try{await f.post(`web/workspace-tunnel/${l}/stop`),d($.IDLE),_(null),C()}catch{}finally{S(!1)}}async function U(){m&&(await navigator.clipboard.writeText(m),F(!0),setTimeout(()=>F(!1),2e3))}return a?e.jsxs("div",{className:"flex items-center gap-2 font-mono lowercase text-xs",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"ide_tunnel:"}),e.jsx("span",{style:{color:jt(t)},children:Nt(t,r)}),(t==="IDLE"||t==="CLOSED"||t==="EXPIRED")&&e.jsx("button",{onClick:V,disabled:x,className:"rounded-[4px] px-2 py-1 text-[var(--info)] disabled:opacity-50",style:{backgroundColor:"rgba(59,130,246,0.12)"},children:r(x?"tasks.tunnel_starting":"tasks.tunnel_start")}),t==="CONNECTED"&&m&&e.jsx("a",{href:m.replace(/^https?:/,"cursor:"),target:"_blank",rel:"noopener noreferrer",className:"rounded-[4px] px-2 py-1 text-[var(--info)]",style:{backgroundColor:"rgba(59,130,246,0.12)"},children:r("tasks.tunnel_open_in_cursor")})]}):e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 font-mono lowercase",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.tunnel_header")}),e.jsxs("span",{className:"text-xs",style:{color:jt(t)},children:["● ",Nt(t,r)]})]}),t==="CONNECTED"&&h&&e.jsxs("p",{className:"mb-2 text-xs text-[var(--text-muted)]",children:["// ",R]}),t==="CONNECTED"&&m&&e.jsxs("div",{className:"mb-3 flex items-center gap-2 rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] px-3 py-2",children:[e.jsx("code",{className:"flex-1 truncate text-xs text-[var(--text-primary)]",children:m}),e.jsxs("button",{onClick:U,className:"shrink-0 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors","aria-label":r("tasks.tunnel_copy_url"),children:["[",r("common.copy"),"]"]})]}),de&&e.jsx("p",{className:"mb-2 text-xs text-[var(--accent)]",children:r("tasks.tunnel_copied")}),t==="STARTING"&&e.jsx("p",{className:"mb-3 text-xs text-[var(--text-muted)]",children:r("tasks.tunnel_waiting")}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[(t==="IDLE"||t==="CLOSED")&&e.jsx("button",{onClick:V,disabled:x,className:"rounded-[4px] border border-[var(--accent)]/40 px-3 py-1.5 text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors disabled:opacity-50",children:r(x?"tasks.tunnel_starting_button":"tasks.tunnel_start_button")}),t==="STARTING"&&e.jsx("button",{onClick:A,disabled:x,className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors disabled:opacity-50",children:r(x?"tasks.tunnel_stopping":"tasks.tunnel_cancel")}),t==="CONNECTED"&&m&&e.jsxs(e.Fragment,{children:[e.jsx("a",{href:m.replace(/^https?:/,"cursor:"),target:"_blank",rel:"noopener noreferrer",className:"rounded-[4px] border border-[var(--accent)]/40 px-3 py-1.5 text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors",children:r("tasks.tunnel_open_cursor")}),e.jsx("a",{href:m.replace(/^https?:/,"vscode:"),target:"_blank",rel:"noopener noreferrer",className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:r("tasks.tunnel_open_vscode")}),e.jsx("button",{onClick:A,disabled:x,className:"rounded-[4px] border border-[var(--destructive)]/40 px-3 py-1.5 text-[var(--destructive)] hover:bg-[var(--destructive)]/10 transition-colors disabled:opacity-50",children:r(x?"tasks.tunnel_stopping":"tasks.tunnel_stop")})]}),t==="EXPIRED"&&e.jsx("button",{onClick:V,disabled:x,className:"rounded-[4px] border border-[var(--accent)]/40 px-3 py-1.5 text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors disabled:opacity-50",children:r(x?"tasks.tunnel_starting_button":"tasks.tunnel_restart")})]})]})}function Ns({isOpen:l,onClose:c,onConfirm:a,taskId:r,isLoading:t}){const{t:d}=xe();return e.jsx(Ee,{isOpen:l,onClose:c,onConfirm:a,title:d("tasks.cancel_task_title"),message:d("tasks.cancel_task_message",{id:String(r)}),confirmLabel:d("tasks.cancel_task_confirm_label"),confirmVariant:"danger",isLoading:t})}function ys({isOpen:l,onClose:c,onConfirm:a,taskId:r,mrUrl:t,isLoading:d,reuseWorkspace:m,onReuseWorkspaceChange:_}){const{t:h}=xe(),P=t?h("tasks.retry_message_with_mr",{id:String(r),url:t}):h("tasks.retry_message_without_mr",{id:String(r)});return e.jsx(Ee,{isOpen:l,onClose:c,onConfirm:a,title:h("tasks.retry_title"),message:P,confirmLabel:h("tasks.retry_confirm_label"),confirmVariant:"accent",isLoading:d,children:e.jsxs("label",{className:"flex items-center gap-2 mt-3 text-[var(--text-muted)] text-xs cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:m,onChange:R=>_(R.target.checked),className:"w-3.5 h-3.5 cursor-pointer accent-[var(--accent)]"}),h("tasks.reuse_workspace_label")]})})}const _e=["implement","test","verify","review","simplify","rebase","submit"],ks=["analyze","discuss","document","confirm"],ws=["review","report","fix"],_s=["review","report"];function Te(l){if(typeof l=="string")try{return Te(JSON.parse(l))}catch{return null}if(!l||typeof l!="object")return null;const c=l.stages;if(!Array.isArray(c)||c.length===0)return null;const a=c.map(r=>r&&typeof r=="object"?r.name:null).filter(r=>typeof r=="string"&&r.length>0);return a.length===c.length?a:null}function Ss(l){if(l.taskMode==="plan")return ks;if(l.taskMode==="review"){let c=!1;if(l.configSnapshot)try{c=!!JSON.parse(l.configSnapshot).skipFix}catch{}return c?_s:ws}if(!l.configSnapshot)return _e;try{const c=JSON.parse(l.configSnapshot);return Te(c.pipeline)??Te(c)??_e}catch{return _e}}function Cs(l){switch(l){case"stage_change":return"text-[var(--accent)]";case"info":return"text-[var(--text-secondary)]";case"warning":return"text-[var(--warning)]";case"error":return"text-[var(--destructive)]";case"system":return"text-[var(--info)]";default:return"text-[var(--text-muted)]"}}function Se({status:l,agentType:c}){const a=St(l),r=Z(c);return e.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-[4px] px-2 py-0.5 text-xs",style:{color:a},children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-[3px]",style:{backgroundColor:a}}),l.toLowerCase()," / ",r]})}function yt({stages:l,runningBg:c="bg-[#1a1a1a]",py:a="py-1.5"}){return e.jsx(e.Fragment,{children:l.map(r=>{const t=r.status==="completed",d=r.status==="running",m=r.status==="failed";return e.jsxs("div",{className:`flex items-center gap-2 rounded-[4px] px-2 ${a} ${d?c:""}`,children:[t&&e.jsx(ss,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),d&&e.jsx(Tt,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),m&&e.jsx(Ce,{className:"h-3.5 w-3.5 shrink-0 text-[var(--destructive)]"}),r.status==="pending"&&e.jsx(hs,{className:"h-3.5 w-3.5 shrink-0 text-[#525252]"}),e.jsx("span",{className:"text-xs",style:{color:t?"var(--accent)":d?"#e5e5e5":m?"var(--destructive)":"#525252",fontWeight:d?500:400},children:d?`> ${r.name}`:r.name})]},r.name)})})}function kt({task:l,ptyStatus:c,displayAgentType:a,t:r,gap:t="gap-2 md:gap-3"}){return e.jsxs("div",{className:`flex items-center ${t}`,children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:r("tasks.pty_terminal")}),e.jsxs("span",{className:`inline-flex items-center gap-1 text-[11px] ${c==="connected"?"text-[var(--accent)]":c==="connecting"?"text-[var(--warning)]":"text-[var(--text-muted)]"}`,children:[e.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${c==="connected"?"bg-[var(--accent)]":c==="connecting"?"bg-[var(--warning)]":"bg-[#525252]"}`}),r(`tasks.${c}`)]}),e.jsx("span",{className:"text-[11px]",style:{color:St(l.status)},children:l.status.toLowerCase()}),l.currentStage&&e.jsxs("span",{className:"hidden md:inline text-[11px] text-[var(--accent)]",children:[r("tasks.stage"),": ",l.currentStage]}),e.jsxs("span",{className:"hidden md:inline text-[11px] text-[var(--text-muted)]",children:["agent: ",a]}),l.workerName&&e.jsxs("span",{className:"hidden md:inline text-[11px] text-[var(--text-muted)]",children:["worker: ",l.workerName]})]})}function wt({isFinished:l,takeoverState:c,ptyRef:a,t:r}){return e.jsxs(e.Fragment,{children:[!l&&c==="auto"&&e.jsxs("button",{onClick:()=>{var t;return(t=a.current)==null?void 0:t.requestTakeover()},className:"flex items-center gap-1.5 rounded-[4px] px-2.5 h-10 md:h-8 text-[11px] font-medium text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:[e.jsx(cs,{className:"h-3 w-3"}),r("tasks.take_over")]}),!l&&c==="manual"&&e.jsxs("button",{onClick:()=>{var t;return(t=a.current)==null?void 0:t.releaseTakeover()},className:"flex items-center gap-1.5 rounded-[4px] px-2.5 h-10 md:h-8 text-[11px] font-medium text-[var(--accent)]",style:{backgroundColor:"rgba(34,197,94,0.12)"},children:[e.jsx(Ct,{className:"h-3 w-3"}),r("tasks.restore_auto")]})]})}function Ts(l){const c=Ss(l),a=l.currentStage?c.indexOf(l.currentStage):-1;return c.map((r,t)=>{let d="pending";return l.status===y.COMPLETED?d="completed":l.status===y.FAILED&&t<=a?d=t===a?"failed":"completed":a>=0&&(t<a?d="completed":t===a&&(d="running")),{name:r,status:d}})}function K(l,c){if(!l||!c)return null;const a=l.repoUrl.replace(/\.git$/,"").replace(/\/+$/,""),r=c.split("/").map(encodeURIComponent).join("/");return l.gitPlatform===_t.GITLAB?`${a}/-/tree/${r}`:`${a}/tree/${r}`}function Es(l,c){if(!l)return null;const a=l.repoUrl.replace(/\.git$/,"").replace(/\/+$/,""),r=c.split("/").map(encodeURIComponent).join("/");return l.gitPlatform===_t.GITLAB?`${a}/-/tree/${r}/docs/specs`:`${a}/tree/${r}/docs/specs`}function Js(){var it,ot,xt;const{id:l}=Wt(),c=Vt(),{t:a}=xe(),r=as(s=>s.cancelTask),[t,d]=n.useState(null),[m,_]=n.useState(null),[h,P]=n.useState([]),[R,ee]=n.useState(!0),[x,S]=n.useState(null),[de,F]=n.useState(!1),[O,M]=n.useState(!1),[me,C]=n.useState(!1),[V,A]=n.useState(!1),[U,v]=n.useState(["claude"]),[I,T]=n.useState(""),[Le,Ie]=n.useState(!1),[De,Re]=n.useState(!1),[Et,Me]=n.useState(!1),[Lt,Ae]=n.useState(!1),[It,$e]=n.useState(!1),[Pe,Fe]=n.useState(""),[Oe,Ue]=n.useState(""),[qe,Be]=n.useState("append"),[Ge,pe]=n.useState(!1),[ze,Dt]=Xt(),[N,ue]=n.useState("terminal"),[Ke,We]=n.useState([]),[te,Ve]=n.useState(0),[X,q]=n.useState(0),[H,Xe]=n.useState(""),[se,Rt]=n.useState(""),[Mt,he]=n.useState(!1),[At,He]=n.useState(!1),[B,fe]=n.useState(null),[Je,ve]=n.useState("disconnected"),[ge,be]=n.useState("auto"),J=n.useRef(null),Qe=n.useRef(null),$t=rs(),[Ye,Ze]=n.useState([]),o=Number(l),g=t?xs.includes(t.status):!1;Ht(t?Jt(t,100):null);const E=n.useCallback(async()=>{try{const s=await f.get(`web/tasks/${o}`).json();d(s)}catch{}},[o]),ae=n.useCallback(async()=>{try{const s=await f.get(`web/tasks/${o}/logs`).json();P(s.lines)}catch{}},[o]),G=n.useCallback(async()=>{try{const s=await f.get(`web/tasks/${o}/pending-confirm`).json();S(s.confirm)}catch{S(null)}},[o]),et=n.useCallback(async()=>{he(!0);try{const s=new URLSearchParams;s.set("limit","50"),s.set("offset",String(X*50)),H&&s.set("type",H),se&&s.set("search",se);const i=await f.get(`web/tasks/${o}/events?${s}`).json();We(i.events),Ve(i.total)}catch{}finally{he(!1)}},[o,X,H,se]);n.useEffect(()=>{N==="logs"&&et()},[N,et]),n.useEffect(()=>{N==="pipeline"&&!g&&f.get(`web/workspaces/${o}`).json().then(fe).catch(()=>fe(null))},[N,o,g]);const z=dt(s=>s.lastEvent),tt=dt(s=>s.eventSeq);n.useEffect(()=>{ee(!0),d(null),_(null),P([]),S(null),fe(null),We([]),Ve(0),q(0),he(!1),Promise.all([E(),ae(),G()]).finally(()=>ee(!1))},[E,ae,G]),n.useEffect(()=>{t!=null&&t.projectKey&&f.get(`web/projects/${t.projectKey}`).json().then(_).catch(()=>_(null))},[t==null?void 0:t.projectKey]),n.useEffect(()=>{if(!t)return;let s=!1;return(async()=>{try{const i=[],p=[];let u=t.sourceTaskId??null,L=0;for(;u!=null&&L<2;){const w=await f.get(`web/tasks/${u}`).json();p.unshift({id:w.id,taskMode:w.taskMode??"develop"}),u=w.sourceTaskId??null,L++}i.push(...p),i.push({id:t.id,taskMode:t.taskMode??"develop"});const D=await f.get(`web/tasks?${new URLSearchParams({sourceTaskId:String(t.id),limit:"20"})}`).json();for(const w of D.data??[])i.push({id:w.id,taskMode:w.taskMode??"develop"});s||Ze(i)}catch{s||Ze([])}})(),()=>{s=!0}},[t==null?void 0:t.id,t==null?void 0:t.sourceTaskId,t==null?void 0:t.taskMode]),n.useEffect(()=>{!z||tt===0||(z.event==="task_status_changed"&&z.taskId===o||z.event==="task_created"&&z.taskId===o)&&(E(),G())},[tt,z,o,E,G]),n.useEffect(()=>{if(g)return;const i=setInterval(()=>{document.visibilityState!=="hidden"&&Promise.all([E(),ae(),G()])},15e3);return()=>clearInterval(i)},[g,E,ae,G]);const st=n.useCallback(()=>S(null),[]),re=n.useCallback(()=>{S(null),E()},[E]),Pt=(t==null?void 0:t.status)===y.FAILED||(t==null?void 0:t.status)===y.CANCELLED,je=(t==null?void 0:t.status)===y.COMPLETED||(t==null?void 0:t.status)===y.FAILED||(t==null?void 0:t.status)===y.CANCELLED,Ft=(t==null?void 0:t.status)===y.COMPLETED&&(!(t!=null&&t.taskMode)||(t==null?void 0:t.taskMode)==="develop");n.useEffect(()=>{ze.get("action")==="fork"&&t&&!R&&(je&&at(),Dt(s=>(s.delete("action"),s),{replace:!0}))},[t,R,ze,je]);async function Ot(){Me(!0);try{await r(o),F(!1),await E()}finally{Me(!1)}}async function Ut(){Ae(!0);try{await f.post(`web/tasks/${o}/retry`,{json:{reuseWorkspace:Ge}}),M(!1),pe(!1),await E()}finally{Ae(!1)}}function at(){Fe(""),Ue(""),Be("append"),C(!0)}async function qt(){$e(!0);try{const s=Pe.trim()||void 0,i=await f.post(`web/tasks/${o}/fork`,{json:{description:s,descriptionMode:s?qe:void 0,agentType:Oe||void 0}}).json();C(!1),W.success(a("tasks.fork_success")),c(`/tasks/${i.task.id}`)}catch{W.error(a("tasks.fork_error"))}finally{$e(!1)}}async function Bt(){if(t){Re(!0);try{await f.post(`web/tasks/${o}/review`,{json:{agentTypes:U.length>0?U:["claude"],description:I.trim()||void 0,skipFix:Le||void 0}}).json(),A(!1),T(""),Ie(!1),c(`/review/${o}`)}catch(s){const i=s instanceof Error?s.message:String(s);W.error(i)}finally{Re(!1)}}}const j=n.useMemo(()=>t?Ts(t):[],[t==null?void 0:t.configSnapshot,t==null?void 0:t.currentStage,t==null?void 0:t.status]),Ne=j.findIndex(s=>s.status==="running"),ne=n.useMemo(()=>{if(!(t!=null&&t.configSnapshot))return[];try{const s=JSON.parse(t.configSnapshot);return Array.isArray(s.defaultReviewers)?s.defaultReviewers:[]}catch{return[]}},[t==null?void 0:t.configSnapshot]);if(n.useEffect(()=>{ne.length>0&&v(ne)},[ne.join(",")]),R)return e.jsx("div",{className:"flex h-full items-center justify-center font-mono",children:e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:a("tasks.loading_task")})});if(!t)return e.jsxs("div",{className:"mx-auto max-w-5xl px-6 py-8 font-mono lowercase text-center",children:[e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:a("tasks.task_not_found")}),e.jsxs("button",{onClick:()=>c("/tasks"),className:"mt-4 rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:["< ",a("tasks.back_to_tasks")]})]});const k=t.status===y.QUEUED&&t.queuePosition!=null&&t.queueTotal!=null?{position:t.queuePosition,total:t.queueTotal}:null,b=is(t.startedAt,t.completedAt),Q=ns(t),ye=Z(t.agentType),Gt=[{value:"",label:a("tasks.fork_agent_type_placeholder",{agent:Z(Q)})},...ft(Z,Q)],le=`${a("tasks.status_suspended")} / ${ye}`,rt=k?e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"queue"}),e.jsxs("span",{className:"text-[var(--info)]",children:["#",k.position," / ",k.total]})]}):null,nt=t.taskMode&&t.taskMode!=="develop"?e.jsx("span",{className:"rounded-[4px] px-2 py-0.5 text-[10px] font-bold uppercase",style:t.taskMode==="plan"?{color:"#3b82f6",backgroundColor:"rgba(59,130,246,0.12)"}:{color:"#a855f7",backgroundColor:"rgba(168,85,247,0.12)"},children:t.taskMode}):null,ce=Ye.length>1?e.jsx("div",{className:"flex items-center gap-1 text-xs text-[var(--text-secondary)]",children:Ye.map((s,i)=>e.jsxs(Qt.Fragment,{children:[i>0&&e.jsx("span",{className:"text-[var(--text-muted)]",children:"→"}),e.jsxs(ie,{to:`/tasks/${s.id}`,className:s.id===t.id?"text-[var(--accent)]":"text-[var(--info)] hover:underline",children:[s.taskMode," #",s.id]})]},s.id))}):t.sourceTaskId?e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["source:"," ",e.jsxs(ie,{to:`/tasks/${t.sourceTaskId}`,className:"text-[var(--info)] hover:underline",children:["#",t.sourceTaskId]})]}):null,lt=e.jsxs("div",{className:"flex items-center gap-3 border-b border-[var(--border)] bg-[var(--bg-primary)] px-4 py-3 shrink-0 md:hidden",children:[e.jsx("button",{onClick:()=>c("/tasks"),className:"shrink-0 text-[var(--text-muted)]",children:e.jsx(ms,{className:"h-4 w-4"})}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"truncate text-sm font-medium text-[var(--text-primary)]",title:Yt(t),children:["#",t.id," ",mt(t,80)]}),nt]}),ce&&e.jsx("div",{className:"text-[11px]",children:ce})]})]}),ke=e.jsxs("div",{className:"hidden md:flex items-center gap-4 border-b border-[var(--border)] bg-[var(--bg-primary)] px-5 shrink-0",style:{height:44},children:[e.jsx(Se,{status:t.status,agentType:t.agentType}),nt,b&&e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["// time cost: ",b]}),k&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),e.jsx("span",{className:"text-xs text-[var(--info)]",children:a("tasks.queue_position",{position:String(k.position),total:String(k.total)})})]}),e.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),e.jsxs(ie,{to:`/projects/${t.projectKey}`,className:"text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:["project: ",e.jsx("span",{className:"text-[var(--text-primary)]",children:t.projectKey})]}),t.branch&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["branch: ",K(m,t.branch)?e.jsx("a",{href:K(m,t.branch),target:"_blank",rel:"noopener noreferrer",className:"text-[var(--text-primary)] hover:text-[var(--info)] hover:underline transition-colors",children:t.branch}):e.jsx("span",{className:"text-[var(--text-primary)]",children:t.branch})]})]}),t.mrUrl&&/^https?:\/\//.test(t.mrUrl)&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),e.jsxs("a",{href:t.mrUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-[var(--info)] hover:underline",children:["MR: ",((it=t.mrUrl.match(/!?\d+$/))==null?void 0:it[0])??"view"]})]}),ce&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),ce]})]}),ct=e.jsxs("div",{className:"flex items-center gap-3 border-t border-[var(--border)] bg-[var(--bg-primary)] px-4 md:px-5 shrink-0",style:{height:48},children:[!g&&e.jsxs("button",{onClick:()=>F(!0),className:"flex flex-1 md:flex-none items-center justify-center gap-1.5 rounded-[4px] bg-[var(--destructive)]/10 px-3 h-8 text-[11px] font-medium text-[var(--destructive)]",children:[e.jsx(Ce,{className:"h-3 w-3"}),a("tasks.cancel_task")]}),Pt&&e.jsxs("button",{onClick:()=>M(!0),className:"flex flex-1 md:flex-none items-center justify-center gap-1.5 rounded-[4px] bg-[var(--bg-card)] px-3 h-8 text-[11px] text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-input)] transition-colors cursor-pointer",children:[e.jsx(Ct,{className:"h-3 w-3"}),a("tasks.retry_task")]}),je&&e.jsxs("button",{onClick:at,className:"flex flex-1 md:flex-none items-center justify-center gap-1.5 rounded-[4px] bg-[var(--bg-card)] px-3 h-8 text-[11px] text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-input)] transition-colors cursor-pointer",children:[e.jsx(ps,{className:"h-3 w-3"}),a("tasks.fork_task")]}),Ft&&e.jsxs("button",{onClick:()=>A(!0),className:"flex flex-1 md:flex-none items-center justify-center gap-1.5 rounded-[4px] px-3 h-8 text-[11px] font-medium text-[var(--accent)]",style:{backgroundColor:"rgba(34,197,94,0.12)"},children:[e.jsx(vt,{className:"h-3 w-3"}),a("review.launch")]}),t.workerId&&!g&&e.jsxs("button",{onClick:()=>{ue("pipeline"),setTimeout(()=>{var s,i;(i=(s=Qe.current)==null?void 0:s.scrollIntoView)==null||i.call(s,{behavior:"smooth",block:"center"})},50)},className:"hidden lg:flex items-center justify-center gap-1.5 rounded-[4px] px-3 h-8 text-[11px] font-medium text-[var(--info)]",style:{backgroundColor:"rgba(59,130,246,0.12)"},children:[e.jsx(gt,{className:"h-3 w-3"}),a("tasks.cursor_tunnel")]})]}),zt=e.jsxs("div",{className:"hidden w-[280px] shrink-0 flex-col gap-6 overflow-y-auto border-l border-[var(--border)] bg-[var(--bg-primary)] p-4 lg:flex",children:[e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:a("tasks.pipeline_stages")}),e.jsx(yt,{stages:j})]}),b&&e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2 text-[11px] text-[var(--text-secondary)]",children:["// time cost: ",b]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:a("tasks.activity_log")}),h.length>0?e.jsx("div",{className:"flex flex-col gap-1.5",children:h.slice(0,8).map((s,i)=>e.jsx("p",{className:"text-[11px] leading-relaxed text-[var(--text-muted)]",children:s},i))}):e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.no_activity")})]})]}),we=e.jsxs(e.Fragment,{children:[e.jsx(Ns,{isOpen:de,onClose:()=>F(!1),onConfirm:Ot,taskId:o,isLoading:Et}),e.jsx(ys,{isOpen:O,onClose:()=>{M(!1),pe(!1)},onConfirm:Ut,taskId:o,mrUrl:t.mrUrl??void 0,isLoading:Lt,reuseWorkspace:Ge,onReuseWorkspaceChange:pe}),e.jsx(Ee,{isOpen:me,onClose:()=>C(!1),onConfirm:qt,title:a("tasks.fork_task"),message:a("tasks.fork_task_desc"),confirmLabel:a("tasks.fork_task"),confirmVariant:"accent",isLoading:It,children:e.jsxs("div",{className:"mt-3 flex flex-col gap-2",children:[e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["fork of #",o]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.form_agent_type")}),e.jsx(ht,{value:Oe,onChange:Ue,options:Gt})]}),e.jsx("textarea",{value:Pe,onChange:s=>Fe(s.target.value),placeholder:a("tasks.fork_description_placeholder"),rows:4,className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)] resize-none"}),e.jsxs("label",{className:"flex items-start gap-2 rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] px-3 py-2 text-[11px] text-[var(--text-secondary)]",children:[e.jsx("input",{type:"checkbox",checked:qe==="replace",onChange:s=>Be(s.target.checked?"replace":"append"),className:"mt-0.5 h-3.5 w-3.5 rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] accent-[var(--accent)]"}),e.jsxs("span",{children:[a("tasks.fork_replace_description"),e.jsx("span",{className:"mt-1 block text-[10px] text-[var(--text-muted)]",children:a("tasks.fork_append_hint")})]})]})]})}),V&&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:a("review.launch")}),e.jsx("button",{onClick:()=>A(!1),className:"text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:e.jsx(Ce,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsxs("p",{className:"text-[11px] text-[var(--text-muted)]",children:["task #",o," — ",a("review.select_agents")]}),ne.length>0&&e.jsx("span",{className:"rounded-[4px] border border-amber-500/40 bg-amber-500/10 px-1.5 py-0.5 text-[10px] text-amber-500",children:"using project defaults"})]}),e.jsx("div",{className:"mb-4 flex flex-col gap-2",children:ft(Z).map(s=>e.jsxs("label",{className:"flex cursor-pointer items-center gap-2.5 rounded-[4px] border border-[var(--border)] px-3 py-2 text-xs hover:bg-[var(--bg-input)] transition-colors",children:[e.jsx("input",{type:"checkbox",checked:U.includes(s.value),onChange:()=>v(i=>i.includes(s.value)?i.filter(p=>p!==s.value):[...i,s.value]),className:"h-3.5 w-3.5 accent-[var(--accent)]"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:s.label})]},s.value))}),e.jsx("textarea",{value:I,onChange:s=>T(s.target.value),placeholder:a("review.description_placeholder"),rows:3,className:"mb-3 w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)] resize-none"}),e.jsxs("label",{className:"mb-4 flex cursor-pointer items-center gap-2.5 rounded-[4px] border border-[var(--border)] px-3 py-2 text-xs hover:bg-[var(--bg-input)] transition-colors",children:[e.jsx("input",{type:"checkbox",checked:Le,onChange:s=>Ie(s.target.checked),className:"h-3.5 w-3.5 accent-[var(--accent)]"}),e.jsx("span",{className:"text-[var(--text-muted)]",children:a("review.skip_fix_label")})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:Bt,disabled:De||U.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(vt,{className:"h-3 w-3"}),a(De?"common.processing":"review.launch")]}),e.jsx("button",{onClick:()=>A(!1),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:a("common.cancel")})]})]})})]});return At&&N==="terminal"?e.jsxs("div",{className:"fixed inset-0 z-50 flex flex-col bg-[var(--bg-primary)] font-mono lowercase h-screen",style:{height:"100dvh",paddingTop:"env(safe-area-inset-top, 0px)",paddingBottom:"env(safe-area-inset-bottom, 0px)"},children:[ke,e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 shrink-0",style:{height:36,backgroundColor:"#111111"},children:[e.jsx(kt,{task:t,ptyStatus:Je,displayAgentType:Q,t:a,gap:"gap-3"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(wt,{isFinished:g,takeoverState:ge,ptyRef:J,t:a}),e.jsx("button",{onClick:()=>He(!1),className:"flex items-center rounded-[4px] bg-[var(--bg-card)] px-2.5 py-1 text-[var(--text-muted)]",children:e.jsx(gs,{className:"h-3 w-3"})})]})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(ut,{ref:J,taskId:o,sessionId:t.currentSessionId??void 0,taskFinished:g,onStatusChange:ve,onTakeoverChange:be})}),ct,we]}):t.status===y.SUSPENDED?e.jsxs("div",{className:"flex h-full flex-col font-mono lowercase",children:[lt,ke,e.jsx("div",{className:"flex items-center gap-2 border-b px-4 md:px-6 py-2 text-xs shrink-0",style:{backgroundColor:"rgba(245,158,11,0.08)",borderColor:"rgba(245,158,11,0.2)",color:"var(--warning)"},children:a("tasks.task_suspended_banner")}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col md:flex-row gap-4 md:gap-6 p-4 md:p-6 overflow-y-auto",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-4",children:[e.jsxs("div",{className:"hidden md:flex items-center gap-3",children:[e.jsxs("span",{className:"text-xl font-bold text-[var(--text-primary)]",children:["#",t.id]}),e.jsx("span",{className:"text-base text-[var(--text-secondary)] truncate max-w-[60%]",children:e.jsx(ds,{content:t.description,children:mt(t,200)})}),e.jsx("span",{className:"rounded-[4px] px-2.5 py-1 text-[11px] font-bold text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:le})]}),e.jsx("div",{className:"flex items-center gap-2 md:hidden",children:e.jsx("span",{className:"rounded-[4px] px-2.5 py-1 text-[11px] font-bold text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:le})}),x&&e.jsxs("div",{className:"rounded-[4px] border p-4",style:{borderColor:"rgba(245,158,11,0.27)",backgroundColor:"#1a1a1a"},children:[e.jsx("p",{className:"mb-2 text-[11px] font-bold text-[var(--accent)]",children:a("tasks.pending_confirmation")}),e.jsx("p",{className:"mb-3 text-xs text-[var(--text-secondary)]",children:x.prompt??a("tasks.pipeline_requires_confirmation")}),e.jsx("div",{className:"mb-3 flex flex-col gap-1.5 text-[11px]",children:e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"stage"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:x.stageName})]})}),e.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:flex-wrap md:gap-3",children:[e.jsx("button",{onClick:async()=>{try{await f.post(`web/tasks/${o}/confirm-stage`,{json:{stageName:x.stageName,approved:!0,feedback:""}}),re()}catch{W.error(a("tasks.confirm_failed"))}},className:"flex-1 md:flex-none rounded-[4px] bg-[var(--accent)] px-4 py-2.5 md:py-2 text-[11px] font-bold text-[#0c0c0c]",children:a("tasks.confirm_and_proceed")}),e.jsx("button",{onClick:async()=>{try{await f.post(`web/tasks/${o}/confirm-stage`,{json:{stageName:x.stageName,approved:!1,feedback:""}}),re()}catch{W.error(a("tasks.confirm_failed"))}},className:"flex-1 md:flex-none rounded-[4px] bg-[#1a1a1a] px-4 py-2.5 md:py-2 text-[11px] text-[var(--destructive)]",style:{border:"1px solid rgba(239,68,68,0.27)"},children:a("tasks.reject")})]})]}),e.jsxs("div",{className:"flex flex-col gap-3 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 lg:hidden",children:[e.jsx("span",{className:"text-xs font-bold text-[var(--accent)]",children:a("tasks.task_info")}),e.jsxs("div",{className:"flex flex-col gap-1.5 text-[11px]",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"status"}),e.jsx("span",{className:"font-bold text-[var(--warning)]",children:le})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"project"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.projectKey})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"worker"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.workerName??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"created"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:Y(t.createdAt)})]})]})]}),e.jsx("div",{className:"hidden md:flex flex-wrap items-center gap-2 py-2",children:j.map((s,i)=>{const p=s.status==="failed",u=s.status==="completed",L=s.status==="running"&&t.status===y.SUSPENDED,D=p?"var(--destructive)":u?"var(--accent)":L?"var(--warning)":"#525252",w=p?"rgba(239,68,68,0.12)":u?"rgba(34,197,94,0.12)":L?"rgba(245,158,11,0.12)":"transparent";return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"rounded-[4px] px-2.5 py-1 text-[11px]",style:{color:D,backgroundColor:w,fontWeight:L?700:400,border:L?`1px solid ${D}`:void 0},children:L?"confirm":`${s.name}${u?" ✓":p?" ✗":""}`}),i<j.length-1&&e.jsx("div",{className:"h-px w-6 bg-[var(--border)]"})]},s.name)})}),e.jsxs("div",{className:"hidden md:block min-h-[200px] flex-1 rounded-[4px] border border-[var(--border)] bg-[#0c0c0c] p-4",children:[e.jsx("p",{className:"mb-2 text-[11px] font-bold text-[var(--accent)]",children:a("tasks.pty_output")}),e.jsxs("div",{className:"flex flex-col gap-1",children:[h.slice(-10).map((s,i)=>e.jsx("p",{className:"text-[11px] leading-relaxed text-[var(--text-secondary)]",children:s},i)),h.length===0&&e.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.no_output")})]})]})]}),e.jsxs("div",{className:"hidden w-[280px] shrink-0 flex-col gap-4 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 lg:flex",children:[e.jsx("span",{className:"text-[13px] font-bold text-[var(--accent)]",children:a("tasks.task_info")}),e.jsxs("div",{className:"flex flex-col gap-1.5 text-[11px]",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"status"}),e.jsx("span",{className:"font-bold text-[var(--warning)]",children:le})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"project"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.projectKey})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"worker"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.workerName??"-"})]})]}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsx("span",{className:"text-xs font-bold text-[var(--accent)]",children:a("tasks.stage_timeline")}),e.jsx("div",{className:"flex flex-col gap-2",children:j.map(s=>{const i=s.status==="completed"?"var(--info)":s.status==="failed"?"var(--destructive)":s.status==="running"?"var(--warning)":"#525252",p=s.status==="failed"?"var(--destructive)":s.status==="running"?"var(--warning)":"#a3a3a3",u=s.status==="completed"?"completed":s.status==="running"?"suspended":s.status==="failed"?"failed":"pending";return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"h-2 w-2 shrink-0 rounded-[4px]",style:{backgroundColor:i}}),e.jsxs("span",{className:"text-[11px]",style:{color:p,fontWeight:s.status==="running"?700:400},children:[s.name," ",u]})]},s.name)})}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsx("div",{className:"flex flex-col gap-1.5 text-[11px]",children:e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"created"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:Y(t.createdAt)})]})})]})]}),x&&e.jsx(pt,{isOpen:!!x,onClose:st,taskId:o,stageName:x.stageName,timeoutSeconds:Math.ceil(x.timeout/1e3),confirmType:x.confirmType,prompt:x.prompt,onSubmitted:re}),we]}):e.jsxs("div",{className:"flex h-full flex-col overflow-hidden font-mono lowercase",children:[lt,e.jsxs("div",{className:"flex flex-wrap items-center gap-3 gap-y-1 border-b border-[var(--border)] bg-[var(--bg-primary)] px-4 py-2 shrink-0 md:hidden",children:[e.jsx(Se,{status:t.status,agentType:t.agentType}),b&&e.jsxs("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:["// time cost: ",b]}),e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:t.projectKey}),t.workerName&&e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:t.workerName}),t.branch&&(K(m,t.branch)?e.jsx("a",{href:K(m,t.branch),target:"_blank",rel:"noopener noreferrer",className:"shrink-0 text-[11px] text-[var(--text-muted)] hover:text-[var(--info)] hover:underline truncate max-w-[80px] md:max-w-[120px] transition-colors",children:t.branch}):e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)] truncate max-w-[80px] md:max-w-[120px]",children:t.branch}))]}),ke,t.errorMessage&&e.jsxs("div",{className:"flex items-center gap-2 border-b px-6 py-2 text-xs shrink-0 bg-[var(--destructive)]/10 text-[var(--destructive)]",style:{borderColor:"rgba(239,68,68,0.2)"},children:["// error: ",t.errorMessage]}),k&&e.jsxs("div",{className:"flex items-center gap-2 border-b px-4 md:px-6 py-2 text-xs shrink-0 text-[var(--info)]",style:{backgroundColor:"color-mix(in srgb, var(--info) 8%, transparent)",borderColor:"color-mix(in srgb, var(--info) 20%, transparent)"},children:[e.jsx(fs,{className:"h-3.5 w-3.5 shrink-0"}),e.jsxs("span",{children:[a("tasks.queue_position_banner",{position:String(k.position),total:String(k.total)}),k.position>1?` — ${a("tasks.queue_ahead",{count:String(k.position-1)})}`:` — ${a("tasks.queue_next")}`]})]}),x&&e.jsx(pt,{isOpen:!!x,onClose:st,taskId:o,stageName:x.stageName,timeoutSeconds:Math.ceil(x.timeout/1e3),confirmType:x.confirmType,prompt:x.prompt,onSubmitted:re}),e.jsxs("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[e.jsx("div",{className:"flex items-center border-b border-[var(--border)] shrink-0 overflow-x-auto no-scrollbar",children:["terminal","pipeline","logs","detail"].map(s=>e.jsx("button",{onClick:()=>ue(s),className:`shrink-0 whitespace-nowrap px-4 py-2.5 text-xs transition-colors ${N===s?"border-b-2 border-[var(--accent)] text-[var(--accent)] font-medium":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:a(s==="terminal"?"tasks.terminal":s==="pipeline"?"tasks.pipeline_tab":s==="logs"?"tasks.logs":"tasks.detail_tab")},s))}),N==="terminal"&&e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-3 md:px-5 shrink-0",style:{height:36,backgroundColor:"#111111"},children:[e.jsx(kt,{task:t,ptyStatus:Je,displayAgentType:Q,t:a}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(wt,{isFinished:g,takeoverState:ge,ptyRef:J,t:a}),!g&&ge==="requesting"&&e.jsxs("span",{className:"flex items-center gap-1.5 px-2.5 h-10 md:h-8 text-[11px] text-[var(--warning)]",children:[e.jsx(Tt,{className:"h-3 w-3 animate-spin"}),a("tasks.requesting_takeover")]}),!g&&t.currentStage&&e.jsxs("button",{className:"hidden md:flex items-center gap-1.5 rounded-[4px] bg-[var(--bg-card)] px-2.5 h-10 md:h-8 text-[11px] text-[var(--text-muted)]",children:[e.jsx(us,{className:"h-3 w-3"}),a("tasks.skip_stage")]}),e.jsx("button",{onClick:()=>He(!0),className:"hidden md:flex items-center rounded-[4px] bg-[var(--bg-card)] px-2.5 h-10 md:h-8 text-[var(--text-muted)]",children:e.jsx(vs,{className:"h-3 w-3"})})]})]}),e.jsxs("div",{className:"border-b border-[var(--border)] px-4 py-2 shrink-0 md:hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[t.currentStage&&e.jsxs("span",{className:"text-[11px] font-semibold text-[var(--accent)]",children:[a("tasks.stage"),": ",t.currentStage]}),e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["agent: ",Q]}),t.workerName&&e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["worker: ",t.workerName]})]}),e.jsx("div",{className:"overflow-x-auto no-scrollbar pr-4",style:{borderRadius:0},children:e.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",children:[e.jsx("span",{className:"shrink-0 text-[11px] font-bold text-[var(--accent)]",children:a("tasks.stage_progress")}),j.map((s,i)=>{const p=s.status==="completed",u=s.status==="running",D=s.status==="failed"?"var(--destructive)":p||u?"var(--accent)":"#525252";return e.jsxs("div",{className:"flex items-center",children:[e.jsxs("span",{className:"shrink-0 text-[11px] leading-normal whitespace-nowrap",style:{color:D,fontWeight:u?600:400},children:[s.name,p?" ✓":u?" ...":""]}),i<j.length-1&&e.jsx("div",{className:"mx-1.5 h-px w-4 shrink-0",style:{backgroundColor:D}})]},s.name)})]})})]}),$t?e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(ls,{ref:J,taskId:o,sessionId:t.currentSessionId??void 0,taskFinished:g,onStatusChange:ve,onTakeoverChange:be})}):e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(ut,{ref:J,taskId:o,sessionId:t.currentSessionId??void 0,taskFinished:g,onStatusChange:ve,onTakeoverChange:be})}),ct]}),N==="pipeline"&&e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto p-4 md:p-6 lg:p-8",children:[e.jsx("div",{className:"mb-4 md:mb-5 overflow-x-auto no-scrollbar",style:{borderRadius:0},children:e.jsx("div",{className:"flex items-center py-5",children:j.map((s,i)=>{const p=s.status==="completed",u=s.status==="running",w=s.status==="failed"?"var(--destructive)":p||u?"var(--accent)":"#525252";return e.jsxs("div",{className:"flex items-center",style:{flex:i<j.length-1?1:void 0},children:[e.jsxs("div",{className:"flex flex-col items-center gap-1.5",children:[e.jsxs("div",{className:"flex h-6 w-6 md:h-7 md:w-7 items-center justify-center rounded-full shrink-0",style:{backgroundColor:w},children:[p&&e.jsx("span",{className:"text-[11px] md:text-xs font-semibold text-[#0c0c0c]",children:"✓"}),u&&e.jsx("span",{className:"h-2 w-2 md:h-2.5 md:w-2.5 rounded-full bg-[#0c0c0c]"})]}),e.jsx("span",{className:"text-[11px] leading-normal font-medium whitespace-nowrap",style:{color:w},children:s.name})]}),i<j.length-1&&e.jsx("div",{className:"mx-1 md:mx-2 h-0.5 flex-1 min-w-3 rounded-full",style:{backgroundColor:i<(Ne>=0?Ne:0)?"var(--accent)":"#525252"}})]},s.name)})})}),t.currentStage&&e.jsxs("div",{className:"mb-4 md:mb-5 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 text-xs leading-relaxed",children:[e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// stage: ",t.currentStage," (",Ne+1,"/",j.length,")"]}),t.startedAt&&e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// elapsed: ",Y(t.startedAt).replace(" ago","")]}),b&&e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// time cost: ",b]}),e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// retries: ",t.retryCount,"/2"]})]}),!t.currentStage&&b&&e.jsx("div",{className:"mb-4 md:mb-5 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 text-xs leading-relaxed",children:e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// time cost: ",b]})}),e.jsx("button",{onClick:()=>ue("terminal"),className:"flex-1 min-h-[100px] rounded-[4px] border border-dashed border-[var(--border)] flex items-center justify-center gap-2 text-[11px] text-[var(--text-muted)] hover:border-[var(--accent)] hover:text-[var(--accent)] transition-colors",children:e.jsxs("span",{children:["// ",a("tasks.view_terminal")]})}),e.jsxs("div",{className:"mt-4 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 lg:hidden",children:[e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:a("tasks.task_info")}),e.jsxs("div",{className:"mt-2 flex flex-col gap-1.5 text-[11px]",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"project"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.projectKey})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"worker"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.workerName??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"branch"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.branch??"-"})]}),rt]})]}),e.jsxs("div",{className:"flex flex-col gap-6 mt-4 lg:hidden",children:[e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:a("tasks.pipeline_stages")}),e.jsx(yt,{stages:j,runningBg:"bg-[var(--bg-input)]",py:"py-2"})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:a("tasks.activity_log")}),h.length>0?e.jsx("div",{className:"flex flex-col gap-1.5",children:h.slice(-12).map((s,i)=>e.jsx("p",{className:"text-[11px] leading-relaxed text-[var(--text-muted)]",children:s},i))}):e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.no_activity")})]})]})]}),N==="logs"&&e.jsxs("div",{className:"flex flex-1 flex-col gap-3 md:gap-5 overflow-y-auto p-4 md:p-6 lg:p-8",children:[e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)] md:hidden",children:a("tasks.task_logs")}),e.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-center md:gap-3",children:[e.jsx("div",{className:"flex items-center gap-1 overflow-x-auto no-scrollbar md:hidden",children:["","error","system"].map(s=>e.jsx("button",{onClick:()=>{Xe(s),q(0)},className:`shrink-0 rounded-[4px] px-2.5 py-1 text-[11px] ${H===s?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)]"}`,children:s||"all"},s))}),e.jsx("div",{className:"hidden md:block",children:e.jsx(ht,{value:H,onChange:s=>{Xe(s),q(0)},options:[{value:"",label:"all"},{value:"stage_change",label:"stage_change"},{value:"info",label:"info"},{value:"warning",label:"warning"},{value:"error",label:"error"},{value:"system",label:"system"}],className:"w-36"})}),e.jsxs("div",{className:"flex flex-1 items-center gap-2 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2",children:[e.jsx(Zt,{className:"h-3.5 w-3.5 text-[var(--text-muted)]"}),e.jsx("input",{type:"text",placeholder:a("tasks.search_logs"),value:se,onChange:s=>{Rt(s.target.value),q(0)},className:"flex-1 bg-transparent text-xs text-[var(--text-primary)] outline-none placeholder:text-[var(--text-muted)]"})]})]}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[Ke.map((s,i)=>e.jsxs("div",{className:`flex items-start md:items-center gap-2 md:gap-4 rounded-[4px] px-2 md:px-3 py-2 text-[11px] md:text-xs ${i%2===0?"bg-[var(--bg-card)]":""}`,children:[e.jsx("span",{className:"shrink-0 text-[var(--text-muted)]",children:new Date(s.timestamp).toLocaleTimeString("en-US",{hour12:!1})}),e.jsx("span",{className:`shrink-0 font-medium ${Cs(s.type)}`,children:s.type}),e.jsx("span",{className:"min-w-0 break-words md:truncate text-[var(--text-primary)]",children:s.message})]},s.id)),Ke.length===0&&!Mt&&e.jsx("p",{className:"py-8 text-center text-xs text-[var(--text-muted)]",children:a("tasks.no_log_entries")})]}),te>50&&e.jsxs("div",{className:"flex items-center justify-center gap-1",children:[Array.from({length:Math.ceil(te/50)}).slice(0,5).map((s,i)=>e.jsx("button",{onClick:()=>q(i),className:`rounded-[4px] px-2 py-1 text-xs ${X===i?"bg-[var(--accent)] text-black font-medium":"text-[var(--text-muted)] hover:text-[var(--text-primary)]"}`,children:i+1},i)),Math.ceil(te/50)>5&&e.jsx("button",{onClick:()=>q(X+1),disabled:X>=Math.ceil(te/50)-1,className:"rounded-[4px] px-2 py-1 text-xs text-[var(--text-muted)] disabled:opacity-30",children:">"})]})]}),N==="detail"&&e.jsxs("div",{className:"flex flex-1 flex-col gap-4 md:gap-5 overflow-y-auto p-4 md:p-6 lg:p-8",children:[e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 md:p-5",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx(es,{className:"h-3.5 w-3.5 text-[var(--accent)]"}),e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:a("tasks.detail_basic_info")})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3",children:[e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.detail_creator")}),e.jsx("span",{className:"text-xs text-[var(--text-primary)]",children:t.creatorName??"-"})]}),e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("common.created_at")}),e.jsx("span",{className:"text-xs text-[var(--text-primary)]",children:os(t.createdAt)}),e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:Y(t.createdAt)})]}),e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("common.status")}),e.jsx(Se,{status:t.status,agentType:t.agentType})]}),e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.detail_project")}),e.jsx(ie,{to:`/projects/${t.projectKey}`,className:"text-xs text-[var(--info)] hover:underline transition-colors",children:t.projectKey})]}),e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.detail_worker")}),e.jsx("span",{className:"text-xs text-[var(--text-primary)]",children:t.workerName??"-"})]}),e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.form_agent_type")}),e.jsx("span",{className:"text-xs text-[var(--text-primary)]",children:ye})]}),b&&e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.detail_time_cost")}),e.jsx("span",{className:"text-xs text-[var(--text-primary)]",children:b})]}),t.branch&&e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.detail_branch")}),K(m,t.branch)?e.jsx("a",{href:K(m,t.branch),target:"_blank",rel:"noopener noreferrer",className:"text-xs text-[var(--info)] hover:underline transition-colors truncate",children:t.branch}):e.jsx("span",{className:"text-xs text-[var(--text-primary)] truncate",children:t.branch})]}),t.mrUrl&&/^https?:\/\//.test(t.mrUrl)&&e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.mr_link")}),e.jsx("a",{href:t.mrUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-[var(--info)] hover:underline truncate",children:((ot=t.mrUrl.match(/!?\d+$/))==null?void 0:ot[0])??"view"})]})]})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 md:p-5",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx(bt,{className:"h-3.5 w-3.5 text-[var(--accent)]"}),e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:a("tasks.detail_task_name")})]}),e.jsxs("div",{className:"flex flex-col gap-3",children:[t.name&&e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.detail_ai_name")}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:t.name})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.detail_task_id")}),e.jsxs("span",{className:"text-xs text-[var(--text-secondary)]",children:["#",t.id]})]}),t.sourcePlatform&&e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.detail_source")}),e.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:t.sourcePlatform})]})]})]}),t.taskMode==="plan"&&t.status===y.COMPLETED&&(()=>{let s="main";if(t.configSnapshot)try{const p=JSON.parse(t.configSnapshot);p.defaultBranch&&(s=p.defaultBranch)}catch{}const i=Es(m,s);return i?e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 md:p-5",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx(bt,{className:"h-3.5 w-3.5 text-[var(--accent)]"}),e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:a("plan.view_spec")})]}),e.jsxs("p",{className:"mb-2 text-xs text-[var(--text-muted)]",children:["the spec document was pushed to ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:s})," at ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:"docs/specs/"})]}),e.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--info)] hover:underline transition-colors",children:[e.jsx(gt,{className:"h-3 w-3"}),a("plan.view_spec")]})]}):null})(),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 md:p-5",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx(ts,{className:"h-3.5 w-3.5 text-[var(--accent)]"}),e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:a("tasks.detail_description")})]}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[#0c0c0c] p-4 overflow-x-auto",children:e.jsx("pre",{className:"whitespace-pre-wrap break-words text-xs leading-relaxed text-[var(--text-secondary)] font-mono",children:t.description})})]})]})]}),N==="terminal"&&zt,N==="pipeline"&&e.jsxs("div",{className:"hidden w-[420px] shrink-0 flex-col gap-5 overflow-y-auto border-l border-[var(--border)] bg-[var(--bg-primary)] p-5 lg:flex",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[13px] font-semibold text-[var(--accent)]",children:a("tasks.task_info")}),e.jsxs("div",{className:"flex flex-col gap-1.5 text-xs",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"project"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.projectKey})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"creator"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.creatorName??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"worker"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.workerName??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:a("common.created_at")}),e.jsx("span",{className:"text-[var(--text-primary)]",children:Y(t.createdAt)})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:a("tasks.form_agent_type")}),e.jsx("span",{className:"text-[var(--text-primary)]",children:ye})]}),b&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"time cost"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:b})]}),rt]})]}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[13px] font-semibold text-[var(--accent)]",children:a("tasks.workspace_section")}),e.jsxs("div",{className:"flex flex-col gap-1.5 text-xs",children:[e.jsxs("div",{className:"flex min-w-0 justify-between",children:[e.jsx("span",{className:"shrink-0 text-[var(--text-muted)]",children:"branch"}),e.jsx("span",{className:"ml-4 min-w-0 truncate text-[var(--text-primary)]",children:t.branch??(B==null?void 0:B.branch)??"-"})]}),e.jsxs("div",{className:"flex min-w-0 justify-between",children:[e.jsx("span",{className:"shrink-0 text-[var(--text-muted)]",children:"worktree"}),e.jsx("span",{className:"ml-4 min-w-0 truncate text-[var(--text-primary)]",children:(B==null?void 0:B.path)??"-"})]}),t.mrUrl&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:a("tasks.mr_link")}),e.jsx("a",{href:t.mrUrl,target:"_blank",rel:"noopener noreferrer",className:"font-medium text-[var(--info)] hover:underline",children:((xt=t.mrUrl.match(/!?\d+$/))==null?void 0:xt[0])??"view"})]})]})]}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsxs("div",{ref:Qe,className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[13px] font-semibold text-[var(--accent)]",children:a("tasks.cursor_tunnel_section")}),t.workerId?e.jsx(js,{taskId:o,taskFinished:g,compact:!0}):e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.no_worker_assigned")})]}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[13px] font-semibold text-[var(--accent)]",children:a("tasks.stage_timeline")}),e.jsx("div",{className:"flex flex-col gap-2 text-xs",children:j.map(s=>{const i=s.status==="completed"?"✓":s.status==="running"?"→":"·",p=s.status==="running"?"var(--accent)":s.status==="completed"?"var(--info)":s.status==="failed"?"var(--destructive)":"#525252",u=s.status==="completed"?"done":s.status==="running"?"running...":s.status==="failed"?"failed":"pending";return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-semibold",style:{color:p},children:i}),e.jsx("span",{className:s.status==="running"?"font-medium":"",style:{color:p},children:s.name}),e.jsxs("span",{className:"text-[11px]",style:{color:"#525252"},children:["— ",u]})]},s.name)})})]})]})]}),we]})}export{Js as default};
|