@overlordai/server 1.0.103 → 1.0.105

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/dist/notifier/notification-event-listener.d.ts +19 -0
  2. package/dist/notifier/notification-event-listener.d.ts.map +1 -0
  3. package/dist/notifier/notification-event-listener.js +98 -0
  4. package/dist/notifier/notification-event-listener.js.map +1 -0
  5. package/dist/notifier/notifier.module.d.ts.map +1 -1
  6. package/dist/notifier/notifier.module.js +2 -0
  7. package/dist/notifier/notifier.module.js.map +1 -1
  8. package/package.json +4 -4
  9. package/public/assets/{AccessTokensPage-DYW95oYn.js → AccessTokensPage-Bklr5Gm7.js} +1 -1
  10. package/public/assets/{AdminPage-CmzgxmfL.js → AdminPage-CcUKpWkV.js} +1 -1
  11. package/public/assets/ApiReferencePage-CEmVrDLO.js +1 -0
  12. package/public/assets/{ArchitecturePage-CZdIr5OG.js → ArchitecturePage-JHmZVOZf.js} +1 -1
  13. package/public/assets/{AuditLogPage-B46ZPniK.js → AuditLogPage-CJWr3nik.js} +2 -2
  14. package/public/assets/{BindPlatformPage-CiTvVM38.js → BindPlatformPage-CY-8adbR.js} +1 -1
  15. package/public/assets/{BotIntegrationPage-DWUypE3E.js → BotIntegrationPage-DucjG3iO.js} +1 -1
  16. package/public/assets/{BotManage-BgzStyGf.js → BotManage-Dp3bmBkj.js} +1 -1
  17. package/public/assets/{BotSetupPage-GNWFUbvf.js → BotSetupPage-D5TWwRNZ.js} +1 -1
  18. package/public/assets/{ChangelogPage-BjXBiyw2.js → ChangelogPage-8jc-Fo30.js} +1 -1
  19. package/public/assets/{CliReferencePage-l1Msp1MO.js → CliReferencePage-lRLqMKnH.js} +1 -1
  20. package/public/assets/{DeploymentPage-dKYl9mAA.js → DeploymentPage-D8PfRXYv.js} +1 -1
  21. package/public/assets/{DevWorkflowPage-BoQ2X_5v.js → DevWorkflowPage-2g82xJ7j.js} +1 -1
  22. package/public/assets/{DeveloperManage-DCXu9nL7.js → DeveloperManage-DB1SPAfa.js} +1 -1
  23. package/public/assets/{DeveloperSetupPage-gVXD6Xl2.js → DeveloperSetupPage-B0hPwD0C.js} +1 -1
  24. package/public/assets/{DocsIndexPage-B34B9w-e.js → DocsIndexPage-BtNg23tA.js} +1 -1
  25. package/public/assets/{DocsLayout-BjOXe_bC.js → DocsLayout-Cez6qVfX.js} +1 -1
  26. package/public/assets/{DocsPrimitives-8sNjBDJg.js → DocsPrimitives-DrJkBFNZ.js} +1 -1
  27. package/public/assets/{EditProjectPage-CBxwr2NU.js → EditProjectPage-DI10LAXj.js} +1 -1
  28. package/public/assets/{EmptyState-Cc8AT_UZ.js → EmptyState-DbhiJS8D.js} +1 -1
  29. package/public/assets/{EnvVariablesPage-C6MCWAeN.js → EnvVariablesPage-CSNt-3F_.js} +1 -1
  30. package/public/assets/{HomePage-dOxzI3Gt.js → HomePage-BFpVA-V9.js} +1 -1
  31. package/public/assets/{InfoRow-BhSkV-4a.js → InfoRow-apXTRFQ-.js} +1 -1
  32. package/public/assets/{InstallationPage-Dorh05Cd.js → InstallationPage-BkR_ZJ-G.js} +1 -1
  33. package/public/assets/{LandingPage-C7_v2JNK.js → LandingPage-BvMu2Ev2.js} +1 -1
  34. package/public/assets/{LocalDevelopmentPage-IzSDZ8WW.js → LocalDevelopmentPage-BiF4WApj.js} +1 -1
  35. package/public/assets/{LoginPage-CZz5g9sU.js → LoginPage-BZ7J9v8B.js} +1 -1
  36. package/public/assets/{MetricBar-q2ffYwIO.js → MetricBar-CKXUjyvB.js} +1 -1
  37. package/public/assets/{NotFoundPage-CZEX5gr6.js → NotFoundPage-JavijR2s.js} +1 -1
  38. package/public/assets/{OnboardingGuide-C1FUVjMo.js → OnboardingGuide-B2ouxTnA.js} +1 -1
  39. package/public/assets/{PermissionsPage-CfFekX2i.js → PermissionsPage-CxItU3LT.js} +1 -1
  40. package/public/assets/{PipelineConfigPage-6tfkv6hj.js → PipelineConfigPage-DHCrOOyU.js} +1 -1
  41. package/public/assets/{PipelineEditorPage-XxZdswLa.js → PipelineEditorPage-wKpLfy8q.js} +1 -1
  42. package/public/assets/{ProfilePage-KG0GogCa.js → ProfilePage-BnCAxjoF.js} +1 -1
  43. package/public/assets/{ProjectDetailPage-iQzJH48J.js → ProjectDetailPage-DsWoLD3e.js} +1 -1
  44. package/public/assets/{ProjectListPage-D0LAZZsK.js → ProjectListPage-CiNBuWTI.js} +1 -1
  45. package/public/assets/{PtyTerminal-BArxYF4R.js → PtyTerminal-DrSwszQB.js} +1 -1
  46. package/public/assets/{QuickAuth-fWoVJHZd.js → QuickAuth-WDPxucnM.js} +1 -1
  47. package/public/assets/{RemoveMemberConfirmDialog-D0MNaqua.js → RemoveMemberConfirmDialog-CmnRgOLv.js} +1 -1
  48. package/public/assets/{Select-Bb1Om6Pn.js → Select-B_ck2i6c.js} +1 -1
  49. package/public/assets/{SettingsPage-Y6Uo5-cT.js → SettingsPage-D9nbOES4.js} +1 -1
  50. package/public/assets/{Skeleton-BnZTI3PM.js → Skeleton-pzJkEnE6.js} +1 -1
  51. package/public/assets/{SkillPage-DPXfneXB.js → SkillPage-D3HQK3u2.js} +1 -1
  52. package/public/assets/{TaskDetailPage-DxS8IX_H.js → TaskDetailPage-CTJGFMb7.js} +2 -2
  53. package/public/assets/{TaskListPage-kOQDNqdP.js → TaskListPage-BwPWRZYK.js} +1 -1
  54. package/public/assets/TaskStatusBadge-BfVCs18S.js +1 -0
  55. package/public/assets/TerminalHomePage-Dc7v5gHB.js +11 -0
  56. package/public/assets/{TokenManage-DLqC8Oiq.js → TokenManage-D-gX376p.js} +1 -1
  57. package/public/assets/{TotpSetupPage-XFWUwLmD.js → TotpSetupPage-BXAOs6eQ.js} +1 -1
  58. package/public/assets/{WorkerDetailPage-ze7Anqi8.js → WorkerDetailPage-2OLAEDOJ.js} +1 -1
  59. package/public/assets/{WorkerListPage-DHcw_qVO.js → WorkerListPage-Bphy5klq.js} +1 -1
  60. package/public/assets/{WorkerOperationsPage-BKYGuZT9.js → WorkerOperationsPage-_sFFFhoM.js} +1 -1
  61. package/public/assets/{WorkerSetupGuidePage-BBjUnfoc.js → WorkerSetupGuidePage-BD2U3Zd3.js} +1 -1
  62. package/public/assets/{WorkerSetupPage-CllS2_5z.js → WorkerSetupPage-DZMdsc9A.js} +1 -1
  63. package/public/assets/{arrow-left-eknrcEhw.js → arrow-left-Dkx3kZ3M.js} +1 -1
  64. package/public/assets/{arrow-right-BoqEsRZm.js → arrow-right-Cx1J58wk.js} +1 -1
  65. package/public/assets/{bot-C76OsRmU.js → bot-BtpPp4mZ.js} +1 -1
  66. package/public/assets/{chevron-right-qJP2MWRS.js → chevron-right-YlCuiZOO.js} +1 -1
  67. package/public/assets/{copy-Bmiw8s-G.js → copy-CPHUK1ku.js} +1 -1
  68. package/public/assets/{download-DNT6K4MW.js → download-W_S67t3k.js} +1 -1
  69. package/public/assets/{external-link-DBXYeKLc.js → external-link-CdCE8J2x.js} +1 -1
  70. package/public/assets/{index-IU_JgZB6.js → index-CDX3RozQ.js} +4 -2
  71. package/public/assets/index-DPmKxmNF.css +1 -0
  72. package/public/assets/{key-BUcjEzf-.js → key-DgI6laXw.js} +1 -1
  73. package/public/assets/{loader-circle-Bw10cLrR.js → loader-circle-BOFaamKn.js} +1 -1
  74. package/public/assets/{pencil-DzScLBmG.js → pencil-D0-P5VAL.js} +1 -1
  75. package/public/assets/{plus-o_FzgRCv.js → plus-BKGIPAng.js} +1 -1
  76. package/public/assets/{rotate-ccw-BlXPBXyn.js → rotate-ccw-Bqxz-Wkr.js} +1 -1
  77. package/public/assets/{scroll-text-CFVr0o0Z.js → scroll-text-Bd130O0t.js} +1 -1
  78. package/public/assets/{settings-Dy8YWweC.js → settings-BtXdvb95.js} +1 -1
  79. package/public/assets/{status-colors-D6drermf.js → status-colors-etVqHg4l.js} +1 -1
  80. package/public/assets/string-YaUnvj19.js +1 -0
  81. package/public/assets/{task-constants-CO2WGgG-.js → task-constants-DJm-CFzH.js} +1 -1
  82. package/public/assets/{trash-2-HeC4Exog.js → trash-2--ItIzkYF.js} +1 -1
  83. package/public/assets/{useFetch-BTCOsmJx.js → useFetch-BQ5yntc6.js} +1 -1
  84. package/public/assets/{users-C4psfHHj.js → users-CWB1ts4z.js} +1 -1
  85. package/public/assets/{wifi-D342KBoS.js → wifi-3MFN8I6Y.js} +1 -1
  86. package/public/assets/{workflow-DsuYDF_6.js → workflow-3dPZ1h-d.js} +1 -1
  87. package/public/index.html +2 -2
  88. package/public/sw.js +1 -1
  89. package/public/assets/ApiReferencePage-k0qwCqrg.js +0 -1
  90. package/public/assets/TaskStatusBadge-CAzEbP55.js +0 -1
  91. package/public/assets/TerminalHomePage-CajSNUCs.js +0 -11
  92. package/public/assets/index-DqE8DNNZ.css +0 -1
  93. package/public/assets/string-B39tzdVK.js +0 -1
@@ -1 +1 @@
1
- import{a as A,u as F,f as T,r as s,j as e,L as z,K as I,E as K,v as $,h as p,t as c}from"./index-IU_JgZB6.js";import{v as M}from"./password-CHk45-jw.js";import{I as o}from"./InfoRow-BhSkV-4a.js";import{u as V}from"./useFetch-BTCOsmJx.js";function Q(){var y,k,C,P;const{t:r}=A(),{logout:L}=F(),E=T(),[S,m]=s.useState(!1),{data:t,loading:U,refetch:D}=V(()=>p.get("web/profile").json(),[]),[x,u]=s.useState(""),[d,b]=s.useState(""),[f,v]=s.useState(""),[g,h]=s.useState(!1),[j,n]=s.useState(""),[i,_]=s.useState(""),[w,N]=s.useState(!1);async function O(){if(n(""),!x){n(r("profile.current_password_required"));return}if(!d){n(r("profile.new_password_required"));return}const a=M(d);if(a){n(r(a));return}if(d!==f){n(r("profile.passwords_do_not_match"));return}try{h(!0),await p.put("web/profile/password",{json:{currentPassword:x,newPassword:d}}),c.success(r("profile.password_changed")),u(""),b(""),v("")}catch(l){const q=l instanceof Error?l.message:r("profile.failed_to_change_password");n(q)}finally{h(!1)}}async function R(){if(!i||i.length!==6){c.error(r("profile.totp_code_required"));return}try{N(!0),await p.post("web/profile/totp/regenerate",{json:{code:i}}),c.success(r("profile.two_fa_regenerated")),_(""),D()}catch(a){const l=a instanceof Error?a.message:r("profile.totp_code_invalid");c.error(l)}finally{N(!1)}}return U?e.jsx("div",{className:"flex justify-center py-20",children:e.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-[var(--border)] border-t-[var(--accent)]"})}):e.jsxs("div",{className:"mx-auto max-w-xl space-y-8 px-4 md:px-6 py-8 font-mono lowercase",children:[e.jsxs("h1",{className:"text-lg text-[var(--text-primary)]",children:[r("profile.title")," ",e.jsx("span",{className:"text-[var(--text-muted)]",children:r("profile.personal_settings")})]}),e.jsxs("section",{className:"rounded-[4px] bg-[var(--bg-card)] border border-[var(--border)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("profile.profile_info")}),t?e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{variant:"fixed-label",label:r("profile.username"),value:t.name}),e.jsx(o,{variant:"fixed-label",label:r("common.role"),value:t.role}),e.jsx(o,{variant:"fixed-label",label:r("profile.git_name"),value:t.gitName||r("common.not_set")}),e.jsx(o,{variant:"fixed-label",label:r("profile.git_email"),value:t.gitEmail||r("common.not_set")}),e.jsx(o,{variant:"fixed-label",label:r("profile.status"),value:t.status}),e.jsx(o,{variant:"fixed-label",label:r("profile.created_at"),value:new Date(t.createdAt).toLocaleDateString()})]}):e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:r("profile.unable_to_load_profile")})]}),e.jsxs("section",{className:"rounded-[4px] bg-[var(--bg-card)] border border-[var(--border)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("profile.platform_accounts")}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{variant:"fixed-label",label:"lark",value:(y=t==null?void 0:t.platformUids)!=null&&y.lark?`${t.platformUids.lark.slice(0,12)}... ✓`:r("profile.not_linked")}),e.jsx(o,{variant:"fixed-label",label:"slack",value:(k=t==null?void 0:t.platformUids)!=null&&k.slack?`${t.platformUids.slack.slice(0,12)}... ✓`:r("profile.not_linked")})]}),(!((C=t==null?void 0:t.platformUids)!=null&&C.lark)||!((P=t==null?void 0:t.platformUids)!=null&&P.slack))&&e.jsx("p",{className:"mt-3 text-xs text-[var(--text-muted)]",children:r("profile.bind_hint")})]}),e.jsxs("section",{className:"rounded-[4px] bg-[var(--bg-card)] border border-[var(--border)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("profile.change_password")}),e.jsxs("div",{className:"space-y-4",children:[j&&e.jsx("div",{className:"rounded-[4px] border border-[var(--destructive)] bg-[var(--bg-input)] px-3 py-2 text-sm text-[var(--destructive)]",children:j}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-[var(--text-secondary)]",children:r("profile.current_password")}),e.jsx("input",{type:"password",value:x,onChange:a=>u(a.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-sm text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-[var(--text-secondary)]",children:r("profile.new_password")}),e.jsx("input",{type:"password",value:d,onChange:a=>b(a.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-sm text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"}),e.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:r("profile.password_hint_10_20")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-[var(--text-secondary)]",children:r("profile.confirm_password")}),e.jsx("input",{type:"password",value:f,onChange:a=>v(a.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-sm text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:O,disabled:g,className:"rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs font-medium text-black disabled:opacity-50",children:r(g?"common.updating":"profile.update_password")})})]})]}),e.jsxs("section",{className:"rounded-[4px] bg-[var(--bg-card)] border border-[var(--border)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("profile.two_factor_auth")}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex items-center gap-2 text-sm",children:t!=null&&t.totpEnabled?e.jsxs("span",{className:"text-[var(--accent)]",children:["● ",r("profile.two_fa_enabled")]}):e.jsxs("span",{className:"text-[var(--text-muted)]",children:["● ",r("profile.two_fa_not_setup")]})}),(t==null?void 0:t.totpEnabled)&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("profile.regenerate_2fa_warning")}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-[var(--text-secondary)]",children:r("profile.current_totp_code")}),e.jsx("input",{type:"text",inputMode:"numeric",maxLength:6,placeholder:r("profile.totp_code_placeholder"),value:i,onChange:a=>{const l=a.target.value.replace(/\D/g,"").slice(0,6);_(l)},className:"w-full max-w-xs rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-sm text-[var(--text-primary)] outline-none focus:border-[var(--accent)] font-mono tracking-widest"})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:R,disabled:w||i.length!==6,className:"rounded-[4px] border border-[var(--warning)] bg-transparent px-4 py-2 text-xs font-medium text-[var(--warning)] hover:bg-[var(--warning)] hover:text-black disabled:opacity-50 transition-colors",children:r(w?"profile.regenerating":"profile.regenerate_2fa")})})]})]})]}),e.jsxs(z,{to:"/access-tokens",className:"flex items-center gap-3 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 transition-colors hover:border-[var(--accent)]",children:[e.jsx(I,{size:16,className:"text-[var(--accent)]"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-[var(--text-primary)]",children:r("profile.access_tokens")}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("profile.access_tokens_desc")})]})]}),e.jsxs("button",{onClick:()=>m(!0),className:"flex w-full items-center gap-3 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 transition-colors hover:border-[var(--destructive)] text-left",children:[e.jsx(K,{size:16,className:"text-[var(--destructive)]"}),e.jsx("span",{className:"text-sm text-[var(--destructive)]",children:r("common.log_out")})]}),e.jsxs("div",{className:"pt-2 pb-4 text-center text-xs text-[var(--text-muted)]",children:["overlord v","1.0.103"]}),e.jsx($,{isOpen:S,onClose:()=>m(!1),onConfirm:()=>{L(),E("/login")},title:r("common.logout_title"),message:r("common.logout_message"),confirmLabel:r("common.logout"),confirmVariant:"warning"})]})}export{Q as default};
1
+ import{a as A,u as F,f as T,r as s,j as e,L as z,K as I,E as K,o as $,h as p,t as c}from"./index-CDX3RozQ.js";import{v as M}from"./password-CHk45-jw.js";import{I as o}from"./InfoRow-apXTRFQ-.js";import{u as V}from"./useFetch-BQ5yntc6.js";function Q(){var y,k,C,P;const{t:r}=A(),{logout:L}=F(),E=T(),[S,m]=s.useState(!1),{data:t,loading:U,refetch:D}=V(()=>p.get("web/profile").json(),[]),[x,u]=s.useState(""),[d,b]=s.useState(""),[f,v]=s.useState(""),[g,h]=s.useState(!1),[j,n]=s.useState(""),[i,_]=s.useState(""),[w,N]=s.useState(!1);async function O(){if(n(""),!x){n(r("profile.current_password_required"));return}if(!d){n(r("profile.new_password_required"));return}const a=M(d);if(a){n(r(a));return}if(d!==f){n(r("profile.passwords_do_not_match"));return}try{h(!0),await p.put("web/profile/password",{json:{currentPassword:x,newPassword:d}}),c.success(r("profile.password_changed")),u(""),b(""),v("")}catch(l){const q=l instanceof Error?l.message:r("profile.failed_to_change_password");n(q)}finally{h(!1)}}async function R(){if(!i||i.length!==6){c.error(r("profile.totp_code_required"));return}try{N(!0),await p.post("web/profile/totp/regenerate",{json:{code:i}}),c.success(r("profile.two_fa_regenerated")),_(""),D()}catch(a){const l=a instanceof Error?a.message:r("profile.totp_code_invalid");c.error(l)}finally{N(!1)}}return U?e.jsx("div",{className:"flex justify-center py-20",children:e.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-[var(--border)] border-t-[var(--accent)]"})}):e.jsxs("div",{className:"mx-auto max-w-xl space-y-8 px-4 md:px-6 py-8 font-mono lowercase",children:[e.jsxs("h1",{className:"text-lg text-[var(--text-primary)]",children:[r("profile.title")," ",e.jsx("span",{className:"text-[var(--text-muted)]",children:r("profile.personal_settings")})]}),e.jsxs("section",{className:"rounded-[4px] bg-[var(--bg-card)] border border-[var(--border)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("profile.profile_info")}),t?e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{variant:"fixed-label",label:r("profile.username"),value:t.name}),e.jsx(o,{variant:"fixed-label",label:r("common.role"),value:t.role}),e.jsx(o,{variant:"fixed-label",label:r("profile.git_name"),value:t.gitName||r("common.not_set")}),e.jsx(o,{variant:"fixed-label",label:r("profile.git_email"),value:t.gitEmail||r("common.not_set")}),e.jsx(o,{variant:"fixed-label",label:r("profile.status"),value:t.status}),e.jsx(o,{variant:"fixed-label",label:r("profile.created_at"),value:new Date(t.createdAt).toLocaleDateString()})]}):e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:r("profile.unable_to_load_profile")})]}),e.jsxs("section",{className:"rounded-[4px] bg-[var(--bg-card)] border border-[var(--border)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("profile.platform_accounts")}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{variant:"fixed-label",label:"lark",value:(y=t==null?void 0:t.platformUids)!=null&&y.lark?`${t.platformUids.lark.slice(0,12)}... ✓`:r("profile.not_linked")}),e.jsx(o,{variant:"fixed-label",label:"slack",value:(k=t==null?void 0:t.platformUids)!=null&&k.slack?`${t.platformUids.slack.slice(0,12)}... ✓`:r("profile.not_linked")})]}),(!((C=t==null?void 0:t.platformUids)!=null&&C.lark)||!((P=t==null?void 0:t.platformUids)!=null&&P.slack))&&e.jsx("p",{className:"mt-3 text-xs text-[var(--text-muted)]",children:r("profile.bind_hint")})]}),e.jsxs("section",{className:"rounded-[4px] bg-[var(--bg-card)] border border-[var(--border)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("profile.change_password")}),e.jsxs("div",{className:"space-y-4",children:[j&&e.jsx("div",{className:"rounded-[4px] border border-[var(--destructive)] bg-[var(--bg-input)] px-3 py-2 text-sm text-[var(--destructive)]",children:j}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-[var(--text-secondary)]",children:r("profile.current_password")}),e.jsx("input",{type:"password",value:x,onChange:a=>u(a.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-sm text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-[var(--text-secondary)]",children:r("profile.new_password")}),e.jsx("input",{type:"password",value:d,onChange:a=>b(a.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-sm text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"}),e.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:r("profile.password_hint_10_20")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-[var(--text-secondary)]",children:r("profile.confirm_password")}),e.jsx("input",{type:"password",value:f,onChange:a=>v(a.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-sm text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:O,disabled:g,className:"rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs font-medium text-black disabled:opacity-50",children:r(g?"common.updating":"profile.update_password")})})]})]}),e.jsxs("section",{className:"rounded-[4px] bg-[var(--bg-card)] border border-[var(--border)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("profile.two_factor_auth")}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex items-center gap-2 text-sm",children:t!=null&&t.totpEnabled?e.jsxs("span",{className:"text-[var(--accent)]",children:["● ",r("profile.two_fa_enabled")]}):e.jsxs("span",{className:"text-[var(--text-muted)]",children:["● ",r("profile.two_fa_not_setup")]})}),(t==null?void 0:t.totpEnabled)&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("profile.regenerate_2fa_warning")}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-[var(--text-secondary)]",children:r("profile.current_totp_code")}),e.jsx("input",{type:"text",inputMode:"numeric",maxLength:6,placeholder:r("profile.totp_code_placeholder"),value:i,onChange:a=>{const l=a.target.value.replace(/\D/g,"").slice(0,6);_(l)},className:"w-full max-w-xs rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-sm text-[var(--text-primary)] outline-none focus:border-[var(--accent)] font-mono tracking-widest"})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:R,disabled:w||i.length!==6,className:"rounded-[4px] border border-[var(--warning)] bg-transparent px-4 py-2 text-xs font-medium text-[var(--warning)] hover:bg-[var(--warning)] hover:text-black disabled:opacity-50 transition-colors",children:r(w?"profile.regenerating":"profile.regenerate_2fa")})})]})]})]}),e.jsxs(z,{to:"/access-tokens",className:"flex items-center gap-3 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 transition-colors hover:border-[var(--accent)]",children:[e.jsx(I,{size:16,className:"text-[var(--accent)]"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-[var(--text-primary)]",children:r("profile.access_tokens")}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("profile.access_tokens_desc")})]})]}),e.jsxs("button",{onClick:()=>m(!0),className:"flex w-full items-center gap-3 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 transition-colors hover:border-[var(--destructive)] text-left",children:[e.jsx(K,{size:16,className:"text-[var(--destructive)]"}),e.jsx("span",{className:"text-sm text-[var(--destructive)]",children:r("common.log_out")})]}),e.jsxs("div",{className:"pt-2 pb-4 text-center text-xs text-[var(--text-muted)]",children:["overlord v","1.0.105"]}),e.jsx($,{isOpen:S,onClose:()=>m(!1),onConfirm:()=>{L(),E("/login")},title:r("common.logout_title"),message:r("common.logout_message"),confirmLabel:r("common.logout"),confirmVariant:"warning"})]})}export{Q as default};
@@ -1,4 +1,4 @@
1
- import{c as F,a as D,j as e,v as U,w as E,f as R,u as q,i as B,r as x,z as A,o as K,B as z,h as v}from"./index-IU_JgZB6.js";import{U as H,A as J,R as V}from"./RemoveMemberConfirmDialog-D0MNaqua.js";import{b as I}from"./date-BdNtiQTP.js";import{t as G}from"./status-colors-D6drermf.js";import{I as o}from"./InfoRow-BhSkV-4a.js";import{u as Q}from"./useFetch-BTCOsmJx.js";import{P as X}from"./pencil-DzScLBmG.js";import{T as Y}from"./trash-2-HeC4Exog.js";import{P as Z}from"./plus-o_FzgRCv.js";import"./Select-Bb1Om6Pn.js";/**
1
+ import{c as F,a as D,j as e,o as U,w as E,f as R,u as q,i as B,r as x,z as A,p as K,B as z,h as v}from"./index-CDX3RozQ.js";import{U as H,A as J,R as V}from"./RemoveMemberConfirmDialog-CmnRgOLv.js";import{b as I}from"./date-BdNtiQTP.js";import{t as G}from"./status-colors-etVqHg4l.js";import{I as o}from"./InfoRow-apXTRFQ-.js";import{u as Q}from"./useFetch-BQ5yntc6.js";import{P as X}from"./pencil-D0-P5VAL.js";import{T as Y}from"./trash-2--ItIzkYF.js";import{P as Z}from"./plus-BKGIPAng.js";import"./Select-B_ck2i6c.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as R,a as z,r as o,G as u,A as x,j as e,h as E,f as G,o as I}from"./index-IU_JgZB6.js";import{S as A}from"./Select-Bb1Om6Pn.js";import{E as M}from"./EmptyState-Cc8AT_UZ.js";import{T as D}from"./Skeleton-BnZTI3PM.js";import{t as H}from"./date-BdNtiQTP.js";import{u as O}from"./useFetch-BTCOsmJx.js";import{P as J}from"./plus-o_FzgRCv.js";/**
1
+ import{c as R,a as z,r as o,G as u,A as x,j as e,h as E,f as G,p as I}from"./index-CDX3RozQ.js";import{S as A}from"./Select-B_ck2i6c.js";import{E as M}from"./EmptyState-DbhiJS8D.js";import{T as D}from"./Skeleton-pzJkEnE6.js";import{t as H}from"./date-BdNtiQTP.js";import{u as O}from"./useFetch-BQ5yntc6.js";import{P as J}from"./plus-BKGIPAng.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- var ke=Object.defineProperty;var Le=(te,j,K)=>j in te?ke(te,j,{enumerable:!0,configurable:!0,writable:!0,value:K}):te[j]=K;var se=(te,j,K)=>Le(te,typeof j!="symbol"?j+"":j,K);import{c as ye,r as X,u as De,h as Re,j as ue}from"./index-IU_JgZB6.js";/**
1
+ var ke=Object.defineProperty;var Le=(te,j,K)=>j in te?ke(te,j,{enumerable:!0,configurable:!0,writable:!0,value:K}):te[j]=K;var se=(te,j,K)=>Le(te,typeof j!="symbol"?j+"":j,K);import{c as ye,r as X,u as De,h as Re,j as ue}from"./index-CDX3RozQ.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{a as h,r as s,h as b,I as v,j as e,C as j}from"./index-IU_JgZB6.js";import{C as f}from"./copy-Bmiw8s-G.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};
1
+ import{a as h,r as s,h as b,I as v,j as e,C as j}from"./index-CDX3RozQ.js";import{C as f}from"./copy-CPHUK1ku.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};
@@ -1,4 +1,4 @@
1
- import{c as w,a as _,r as s,z as l,j as e,X as R,h as g,v as C}from"./index-IU_JgZB6.js";import{S as N}from"./Select-Bb1Om6Pn.js";/**
1
+ import{c as w,a as _,r as s,z as l,j as e,X as R,h as g,o as C}from"./index-CDX3RozQ.js";import{S as N}from"./Select-B_ck2i6c.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as p,r as l,j as t}from"./index-IU_JgZB6.js";/**
1
+ import{c as p,r as l,j as t}from"./index-CDX3RozQ.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as h,a as v,r,j as e,h as m,t as u}from"./index-IU_JgZB6.js";/**
1
+ import{c as h,a as v,r,j as e,h as m,t as u}from"./index-CDX3RozQ.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{j as e}from"./index-IU_JgZB6.js";const n="rounded-[4px] bg-[var(--border)] animate-pulse";function c({rows:r=5}){const a=[[60,200,80,120],[60,160,100,80],[60,220,70,140],[60,180,90,100],[60,190,110,90]];return e.jsx("div",{className:"flex flex-col gap-3",children:Array.from({length:r}).map((s,l)=>{const t=a[l%a.length];return e.jsx("div",{className:"flex gap-4",children:t.map((i,o)=>e.jsx("div",{className:n,style:{width:i,height:12}},o))},l)})})}function m({cards:r=4}){return e.jsx("div",{className:"grid grid-cols-2 gap-3",children:Array.from({length:r}).map((a,s)=>e.jsx("div",{className:`${n} h-20`},s))})}export{m as C,c as T};
1
+ import{j as e}from"./index-CDX3RozQ.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-IU_JgZB6.js";import{I as c,C as r}from"./DocsPrimitives-8sNjBDJg.js";import{E as n}from"./external-link-DBXYeKLc.js";import"./copy-Bmiw8s-G.js";const o=[{action:"create tasks",desc:"describe what you want done, overlord dispatches to a worker"},{action:"list & monitor tasks",desc:"check status, read execution logs, track progress"},{action:"cancel & retry tasks",desc:"manage task lifecycle"},{action:"confirm pipeline stages",desc:"approve or provide input for suspended stages"},{action:"manage projects",desc:"list projects, view members"},{action:"check cluster health",desc:"see worker status, online workers, queue depth"},{action:"search",desc:"find tasks, projects, and workers by keyword"},{action:"read notifications",desc:"check and clear your notification inbox"}],d=['create a task in project "frontend" to fix the login page styling',"what tasks are running right now?","show me the logs for task 42","how many workers are online?","cancel task 15"],i=[{name:"claude code",url:"https://claude.com/claude-code"},{name:"cursor",url:"https://cursor.com/cli"},{name:"windsurf",url:"https://windsurf.com"},{name:"codex",url:"https://openai.com/codex"}];function u(){t();const a=typeof window<"u"?window.location.origin:"https://your-server";return e.jsxs("div",{className:"mx-auto max-w-4xl px-4 md:px-6 py-8 font-mono lowercase",children:[e.jsx("div",{className:"mb-8",children:e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"// use overlord from your ai coding assistant — claude code, cursor, windsurf, codex, and more. install the skill and your assistant can create tasks, monitor execution, and manage your fleet."})}),e.jsxs("div",{className:"mb-8 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"// install"}),e.jsx(c,{code:"npx skills add overlord-run/skill"})]}),e.jsxs("div",{className:"mb-8 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"// configure — set these environment variables"}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between rounded-[4px] bg-[var(--bg-primary)] px-3 py-2 overflow-x-auto",children:[e.jsxs("code",{className:"text-xs text-[var(--text-primary)] whitespace-nowrap",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"export "}),"OVERLORD_SERVER=",e.jsx("span",{className:"text-[var(--accent)]",children:a})]}),e.jsx(r,{text:`export OVERLORD_SERVER=${a}`})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-[4px] bg-[var(--bg-primary)] px-3 py-2 overflow-x-auto",children:[e.jsxs("code",{className:"text-xs text-[var(--text-primary)] whitespace-nowrap",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"export "}),"OVERLORD_TOKEN=",e.jsx("span",{className:"text-[var(--text-secondary)]",children:"your-token"})]}),e.jsx(r,{text:"export OVERLORD_TOKEN=your-token"})]})]}),e.jsxs("p",{className:"text-[11px] text-[var(--text-muted)]",children:["// create a token at ",e.jsx("a",{href:"/access-tokens",className:"text-[var(--accent)] hover:underline",children:"/access-tokens"})]})]}),e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{className:"mb-4 text-sm text-[var(--accent)]",children:"> capabilities"}),e.jsx("div",{className:"space-y-2",children:o.map(s=>e.jsxs("div",{className:"flex items-start gap-3 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3",children:[e.jsx("span",{className:"shrink-0 text-xs font-medium text-[var(--text-primary)]",children:s.action}),e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["// ",s.desc]})]},s.action))})]}),e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{className:"mb-4 text-sm text-[var(--accent)]",children:"> example usage"}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-2",children:[e.jsx("p",{className:"mb-3 text-xs text-[var(--text-muted)]",children:"// just ask your ai agent naturally"}),d.map(s=>e.jsx("div",{className:"rounded-[4px] bg-[var(--bg-primary)] px-3 py-2",children:e.jsxs("code",{className:"text-xs text-[var(--text-secondary)]",children:[e.jsx("span",{className:"text-[var(--accent)]",children:"> "}),s]})},s))]})]}),e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{className:"mb-4 text-sm text-[var(--accent)]",children:"> compatible tools"}),e.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:i.map(s=>e.jsxs("a",{href:s.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-center gap-1.5 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2.5 text-xs text-[var(--text-primary)] transition-colors hover:border-[var(--accent)]",children:[s.name,e.jsx(n,{className:"h-3 w-3 text-[var(--text-muted)]"})]},s.name))}),e.jsx("p",{className:"mt-2 text-[11px] text-[var(--text-muted)]",children:"// and any ai coding assistant that supports the skills protocol"})]}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["// open source:"," ",e.jsx("a",{href:"https://github.com/overlord-run/skill",target:"_blank",rel:"noopener noreferrer",className:"text-[var(--accent)] hover:underline",children:"github.com/overlord-run/skill"})]})})]})}export{u as default};
1
+ import{a as t,j as e}from"./index-CDX3RozQ.js";import{I as c,C as r}from"./DocsPrimitives-DrJkBFNZ.js";import{E as n}from"./external-link-CdCE8J2x.js";import"./copy-CPHUK1ku.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 se,a as H,r,h as N,j as e,M as ze,s as L,H as Be,t as me,v as Pe,w as qe,f as Xe,n as We,k as Se,L as He,X as ie,m as W,x as Ee,p as Ve,G as Je}from"./index-IU_JgZB6.js";import{u as Qe,T as Ye}from"./task-constants-CO2WGgG-.js";import{C as Ze,H as Te,P as De}from"./PtyTerminal-BArxYF4R.js";import{a as et,f as ee}from"./date-BdNtiQTP.js";import{S as tt}from"./Select-Bb1Om6Pn.js";import{a as st}from"./status-colors-D6drermf.js";import{A as at}from"./arrow-left-eknrcEhw.js";import{R as xe}from"./rotate-ccw-BlXPBXyn.js";import{E as rt}from"./external-link-DBXYeKLc.js";import{L as oe}from"./loader-circle-Bw10cLrR.js";/**
1
+ import{c as se,a as H,r,h as N,j as e,M as qe,v as L,H as ze,t as me,o as Pe,w as Be,f as Xe,n as We,k as Se,L as He,X as ie,m as W,x as Ee,q as Ve,G as Je}from"./index-CDX3RozQ.js";import{u as Qe,T as Ye}from"./task-constants-DJm-CFzH.js";import{C as Ze,H as Te,P as De}from"./PtyTerminal-DrSwszQB.js";import{a as et,f as ee}from"./date-BdNtiQTP.js";import{S as tt}from"./Select-B_ck2i6c.js";import{a as st}from"./status-colors-etVqHg4l.js";import{A as at}from"./arrow-left-Dkx3kZ3M.js";import{R as xe}from"./rotate-ccw-Bqxz-Wkr.js";import{E as rt}from"./external-link-CdCE8J2x.js";import{L as oe}from"./loader-circle-BOFaamKn.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 se,a as H,r,h as N,j as e,M as ze,s as L,H as Be,t as me,v as Pe,w a
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 ct=se("SkipForward",[["polygon",{points:"5 4 15 12 5 20 5 4",key:"16p6eg"}],["line",{x1:"19",x2:"19",y1:"5",y2:"19",key:"futhcm"}]]);function Le({isOpen:l,onClose:x,taskId:a,stageName:n,timeoutSeconds:t,onSubmitted:o}){const{t:i}=H(),[b,v]=r.useState(t),[E,$]=r.useState(!1);r.useEffect(()=>{if(!l)return;v(t);const d=setInterval(()=>{v(y=>y<=1?(clearInterval(d),0):y-1)},1e3);return()=>clearInterval(d)},[l,t]),r.useEffect(()=>{b===0&&l&&x()},[b,l,x]);const T=r.useCallback(async d=>{$(!0);try{await N.post(`web/tasks/${a}/confirm-stage`,{json:{stageName:n,approved:d}}),o==null||o(),x()}catch{}finally{$(!1)}},[a,n,x,o]);return l?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backdropFilter:"blur(2px)"},children:[e.jsx("div",{className:"fixed inset-0 bg-[var(--modal-backdrop)]"}),e.jsxs("div",{className:"relative z-10 w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] font-mono",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 py-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ze,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsxs("h3",{className:"text-sm text-[var(--text-primary)]",children:["// stage: ",n]})]}),e.jsxs("span",{className:"flex items-center gap-1 text-xs text-[var(--text-muted)]",children:[e.jsx(Ze,{className:"h-3.5 w-3.5"}),et(b)]})]}),e.jsx("div",{className:"space-y-4 px-5 py-5",children:e.jsx("p",{className:"whitespace-pre-wrap text-xs text-[var(--text-primary)]",children:i("tasks.confirm_stage_message",{name:n})})}),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:E,onClick:()=>T(!1),children:i("tasks.reject")}),e.jsx("button",{type:"button",className:"rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",disabled:E,onClick:()=>T(!0),children:i(E?"tasks.stage_submitting":"tasks.confirm_and_proceed")})]})]})]}):null}function it(l,x){const a=new Date(l).getTime()-Date.now();if(a<=0)return x("tasks.tunnel_expired");const n=Math.floor(a/36e5),t=Math.floor(a%36e5/6e4);return n>0?x("tasks.tunnel_expires_hm",{h:n,m:t}):x("tasks.tunnel_expires_m",{m:t})}function $e(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 Re(l,x){switch(l){case"IDLE":case"CLOSED":return x("tasks.tunnel_idle");case"STARTING":return x("tasks.tunnel_starting");case"CONNECTED":return x("tasks.tunnel_connected");case"EXPIRED":return x("tasks.tunnel_expired");case"CLOSING":return x("tasks.tunnel_closing");default:return String(l).toLowerCase()}}function xt({taskId:l,taskFinished:x,compact:a}){const{t:n}=H(),[t,o]=r.useState(L.IDLE),[i,b]=r.useState(null),[v,E]=r.useState(null),[$,T]=r.useState(""),[d,y]=r.useState(!1),[ae,R]=r.useState(!1),P=r.useRef(null),D=r.useCallback(async()=>{try{const h=await N.get(`web/workspace-tunnel/${l}/status`).json();o(h.status),b(h.tunnelUrl??null),E(h.expiresAt??null),(h.status==="EXPIRED"||h.status==="IDLE"||h.status==="CLOSED")&&_()}catch{}},[l]);function re(){_(),P.current=setInterval(D,5e3)}function _(){P.current&&(clearInterval(P.current),P.current=null)}r.useEffect(()=>{x&&(t===L.STARTING||t===L.CONNECTED)&&(o(L.IDLE),b(null),_())},[x,t]),r.useEffect(()=>{if(t!=="CONNECTED"||!v)return;const h=()=>{const S=it(v,n);T(S),S===n("tasks.tunnel_expired")&&(o(L.EXPIRED),b(null),_())};h();const C=setInterval(h,3e4);return()=>clearInterval(C)},[t,v]),r.useEffect(()=>()=>_(),[]),r.useEffect(()=>{x||D()},[D,x]);async function G(){y(!0);try{await N.post(`web/workspace-tunnel/${l}/start`),o(L.STARTING),re()}catch(h){let C=n("tasks.tunnel_start_failed");try{if(h instanceof Be){const S=await h.response.json();S!=null&&S.error&&(C=S.error,/code.*not found|ENOENT.*code|spawn code/i.test(C)&&(C+=". "+n("tasks.tunnel_install_code_hint")))}}catch{}me.error(C)}finally{y(!1)}}async function K(){y(!0);try{await N.post(`web/workspace-tunnel/${l}/stop`),o(L.IDLE),b(null),_()}catch{}finally{y(!1)}}async function g(){i&&(await navigator.clipboard.writeText(i),R(!0),setTimeout(()=>R(!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:$e(t)},children:Re(t,n)}),(t==="IDLE"||t==="CLOSED"||t==="EXPIRED")&&e.jsx("button",{onClick:G,disabled:d,className:"rounded-[4px] px-2 py-1 text-[var(--info)] disabled:opacity-50",style:{backgroundColor:"rgba(59,130,246,0.12)"},children:n(d?"tasks.tunnel_starting":"tasks.tunnel_start")}),t==="CONNECTED"&&i&&e.jsx("a",{href:i.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:n("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:n("tasks.tunnel_header")}),e.jsxs("span",{className:"text-xs",style:{color:$e(t)},children:["● ",Re(t,n)]})]}),t==="CONNECTED"&&v&&e.jsxs("p",{className:"mb-2 text-xs text-[var(--text-muted)]",children:["// ",$]}),t==="CONNECTED"&&i&&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:i}),e.jsxs("button",{onClick:g,className:"shrink-0 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors","aria-label":n("tasks.tunnel_copy_url"),children:["[",n("common.copy"),"]"]})]}),ae&&e.jsx("p",{className:"mb-2 text-xs text-[var(--accent)]",children:n("tasks.tunnel_copied")}),t==="STARTING"&&e.jsx("p",{className:"mb-3 text-xs text-[var(--text-muted)]",children:n("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:G,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:n(d?"tasks.tunnel_starting_button":"tasks.tunnel_start_button")}),t==="STARTING"&&e.jsx("button",{onClick:K,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:n(d?"tasks.tunnel_stopping":"tasks.tunnel_cancel")}),t==="CONNECTED"&&i&&e.jsxs(e.Fragment,{children:[e.jsx("a",{href:i.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:n("tasks.tunnel_open_cursor")}),e.jsx("a",{href:i.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:n("tasks.tunnel_open_vscode")}),e.jsx("button",{onClick:K,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:n(d?"tasks.tunnel_stopping":"tasks.tunnel_stop")})]}),t==="EXPIRED"&&e.jsx("button",{onClick:G,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:n(d?"tasks.tunnel_starting_button":"tasks.tunnel_restart")})]})]})}function ot({isOpen:l,onClose:x,onConfirm:a,taskId:n,isLoading:t}){const{t:o}=H();return e.jsx(Pe,{isOpen:l,onClose:x,onConfirm:a,title:o("tasks.cancel_task_title"),message:o("tasks.cancel_task_message",{id:String(n)}),confirmLabel:o("tasks.cancel_task_confirm_label"),confirmVariant:"danger",isLoading:t})}function dt({isOpen:l,onClose:x,onConfirm:a,taskId:n,mrUrl:t,isLoading:o}){const{t:i}=H(),b=t?i("tasks.retry_message_with_mr",{id:String(n),url:t}):i("tasks.retry_message_without_mr",{id:String(n)});return e.jsx(Pe,{isOpen:l,onClose:x,onConfirm:a,title:i("tasks.retry_title"),message:b,confirmLabel:i("tasks.retry_confirm_label"),confirmVariant:"accent",isLoading:o})}function mt(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 de({status:l}){const x=st(l);return e.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-[4px] px-2 py-0.5 text-xs",style:{color:x},children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-[3px]",style:{backgroundColor:x}}),l.toLowerCase()]})}function pt(l){let a=["implement","test","verify","review","submit"];if(l.configSnapshot)try{const t=JSON.parse(l.configSnapshot);if(t&&typeof t=="object"){const o=typeof t.pipeline=="string"?JSON.parse(t.pipeline):t.pipeline;o&&typeof o=="object"&&Array.isArray(o.stages)&&o.stages.length>0&&o.stages.every(i=>i&&typeof i=="object"&&typeof i.name=="string")&&(a=o.stages.map(i=>i.name))}}catch{}const n=l.currentStage?a.indexOf(l.currentStage):-1;return a.map((t,o)=>{let i="pending";return l.status===W.COMPLETED?i="completed":l.status===W.FAILED&&o<=n?i=o===n?"failed":"completed":n>=0&&(o<n?i="completed":o===n&&(i="running")),{name:t,status:i}})}function te(l,x){if(!l||!x)return null;const a=l.repoUrl.replace(/\.git$/,"");return l.gitPlatform===Je.GITLAB?`${a}/-/tree/${x}`:`${a}/tree/${x}`}function wt(){var _e,Ce;const{id:l}=qe(),x=Xe(),{t:a}=H(),n=Qe(s=>s.cancelTask),[t,o]=r.useState(null),[i,b]=r.useState(null),[v,E]=r.useState([]),[$,T]=r.useState(!0),[d,y]=r.useState(null),[ae,R]=r.useState(!1),[P,D]=r.useState(!1),[re,_]=r.useState(!1),[G,K]=r.useState(!1),[g,h]=r.useState("terminal"),[C,S]=r.useState([]),[V,Ae]=r.useState(0),[z,B]=r.useState(0),[q,pe]=r.useState(""),[J,Oe]=r.useState(""),[Fe,ue]=r.useState(!1),[Me,he]=r.useState(!1),[A,fe]=r.useState(null),[k,ve]=r.useState("disconnected"),[X,be]=r.useState("auto"),O=r.useRef(null),ge=r.useRef(null),p=Number(l),f=t?Ye.includes(t.status):!1;We(t?`#${t.id} ${t.description}`:null);const w=r.useCallback(async()=>{try{const s=await N.get(`web/tasks/${p}`).json();o(s)}catch{}},[p]),Q=r.useCallback(async()=>{try{const s=await N.get(`web/tasks/${p}/logs`).json();E(s.lines)}catch{}},[p]),F=r.useCallback(async()=>{try{const s=await N.get(`web/tasks/${p}/pending-confirm`).json();y(s.confirm)}catch{y(null)}},[p]),je=r.useCallback(async()=>{ue(!0);try{const s=new URLSearchParams;s.set("limit","50"),s.set("offset",String(z*50)),q&&s.set("type",q),J&&s.set("search",J);const c=await N.get(`web/tasks/${p}/events?${s}`).json();S(c.events),Ae(c.total)}catch{}finally{ue(!1)}},[p,z,q,J]);r.useEffect(()=>{g==="logs"&&je()},[g,je]),r.useEffect(()=>{g==="pipeline"&&!f&&N.get(`web/workspaces/${p}`).json().then(fe).catch(()=>fe(null))},[g,p,f]);const M=Se(s=>s.lastEvent),Ne=Se(s=>s.eventSeq);r.useEffect(()=>{T(!0),Promise.all([w(),Q(),F()]).finally(()=>T(!1))},[w,Q,F]),r.useEffect(()=>{t!=null&&t.projectKey&&N.get(`web/projects/${t.projectKey}`).json().then(b).catch(()=>b(null))},[t==null?void 0:t.projectKey]),r.useEffect(()=>{!M||Ne===0||(M.event==="task_status_changed"&&M.taskId===p||M.event==="task_created"&&M.taskId===p)&&(w(),F())},[Ne,M,p,w,F]),r.useEffect(()=>{if(f)return;const c=setInterval(()=>{document.visibilityState!=="hidden"&&Promise.all([w(),Q(),F()])},15e3);return()=>clearInterval(c)},[f,w,Q,F]);const ye=r.useCallback(()=>y(null),[]),Y=r.useCallback(()=>{y(null),w()},[w]);async function Ue(){_(!0);try{await n(p),R(!1),await w()}finally{_(!1)}}async function Ge(){K(!0);try{await N.post(`web/tasks/${p}/retry`),D(!1),await w()}finally{K(!1)}}const j=r.useMemo(()=>t?pt(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");if($)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:()=>x("/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 ke=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:()=>x("/tasks"),className:"shrink-0 text-[var(--text-muted)]",children:e.jsx(at,{className:"h-4 w-4"})}),e.jsxs("span",{className:"line-clamp-2 text-sm font-medium text-[var(--text-primary)]",children:["#",t.id," ",t.description]})]}),le=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(de,{status:t.status}),e.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),e.jsxs(He,{to:`/projects/${t.projectKey}`,className:"text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:["project: ",e.jsx("span",{className:"text-[var(--text-primary)]",children:t.projectKey})]}),t.branch&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["branch: ",te(i,t.branch)?e.jsx("a",{href:te(i,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: ",((_e=t.mrUrl.match(/!?\d+$/))==null?void 0:_e[0])??"view"]})]})]}),we=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:[!f&&e.jsxs("button",{onClick:()=>R(!0),className:"flex flex-1 md:flex-none items-center justify-center gap-1.5 rounded-[4px] bg-[var(--destructive)]/10 px-3 h-8 text-[11px] font-medium text-[var(--destructive)]",children:[e.jsx(ie,{className:"h-3 w-3"}),a("tasks.cancel_task")]}),t.status===W.FAILED&&e.jsxs("button",{onClick:()=>D(!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(xe,{className:"h-3 w-3"}),a("tasks.retry_task")]}),t.workerId&&!f&&e.jsxs("button",{onClick:()=>{h("pipeline"),setTimeout(()=>{var s,c;(c=(s=ge.current)==null?void 0:s.scrollIntoView)==null||c.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(rt,{className:"h-3 w-3"}),a("tasks.cursor_tunnel")]})]}),Ke=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")}),j.map(s=>{const c=s.status==="completed",m=s.status==="running",u=s.status==="failed";return e.jsxs("div",{className:`flex items-center gap-2 rounded-[4px] px-2 py-1.5 ${m?"bg-[#1a1a1a]":""}`,children:[c&&e.jsx(Ee,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),m&&e.jsx(oe,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),u&&e.jsx(ie,{className:"h-3.5 w-3.5 shrink-0 text-[var(--destructive)]"}),s.status==="pending"&&e.jsx(Ie,{className:"h-3.5 w-3.5 shrink-0 text-[#525252]"}),e.jsx("span",{className:"text-xs",style:{color:c?"var(--accent)":m?"#e5e5e5":u?"var(--destructive)":"#525252",fontWeight:m?500:400},children:m?`> ${s.name}`:s.name})]},s.name)})]}),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")}),v.length>0?e.jsx("div",{className:"flex flex-col gap-1.5",children:v.slice(0,8).map((s,c)=>e.jsx("p",{className:"text-[11px] leading-relaxed text-[var(--text-muted)]",children:s},c))}):e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.no_activity")})]})]}),ce=e.jsxs(e.Fragment,{children:[e.jsx(ot,{isOpen:ae,onClose:()=>R(!1),onConfirm:Ue,taskId:p,isLoading:re}),e.jsx(dt,{isOpen:P,onClose:()=>D(!1),onConfirm:Ge,taskId:p,mrUrl:t.mrUrl??void 0,isLoading:G})]});return Me&&g==="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:[le,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.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:a("tasks.pty_terminal")}),e.jsxs("span",{className:`inline-flex items-center gap-1 text-[11px] ${k==="connected"?"text-[var(--accent)]":k==="connecting"?"text-[var(--warning)]":"text-[var(--text-muted)]"}`,children:[e.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${k==="connected"?"bg-[var(--accent)]":k==="connecting"?"bg-[var(--warning)]":"bg-[#525252]"}`}),a(`tasks.${k}`)]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[!f&&X==="auto"&&e.jsxs("button",{onClick:()=>{var s;return(s=O.current)==null?void 0:s.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(Te,{className:"h-3 w-3"}),a("tasks.take_over")]}),!f&&X==="manual"&&e.jsxs("button",{onClick:()=>{var s;return(s=O.current)==null?void 0:s.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(xe,{className:"h-3 w-3"}),a("tasks.restore_auto")]}),t.currentStage&&e.jsxs("span",{className:"text-[11px] text-[var(--accent)]",children:[a("tasks.stage"),": ",t.currentStage]}),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(lt,{className:"h-3 w-3"})})]})]}),e.jsx("div",{className:"min-h-0 flex-1",children:e.jsx(De,{ref:O,taskId:p,sessionId:t.currentSessionId??void 0,taskFinished:f,onStatusChange:ve,onTakeoverChange:be})}),we,ce]}):t.status===W.SUSPENDED?e.jsxs("div",{className:"flex h-full flex-col font-mono lowercase",children:[ke,le,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)]",children:t.description}),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:a("tasks.status_suspended")})]}),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:a("tasks.status_suspended")})}),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 N.post(`web/tasks/${p}/confirm-stage`,{json:{stageName:d.stageName,approved:!0}}),Y()}catch{me.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 N.post(`web/tasks/${p}/confirm-stage`,{json:{stageName:d.stageName,approved:!1}}),Y()}catch{me.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:"suspended"})]}),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:ee(t.createdAt)})]})]})]}),e.jsx("div",{className:"hidden md:flex flex-wrap items-center gap-2 py-2",children:j.map((s,c)=>{const m=s.status==="failed",u=s.status==="completed",I=s.status==="running"&&t.status===W.SUSPENDED,U=m?"var(--destructive)":u?"var(--accent)":I?"var(--warning)":"#525252",Z=m?"rgba(239,68,68,0.12)":u?"rgba(34,197,94,0.12)":I?"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:U,backgroundColor:Z,fontWeight:I?700:400,border:I?`1px solid ${U}`:void 0},children:I?"confirm":`${s.name}${u?" ✓":m?" ✗":""}`}),c<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:[v.slice(-10).map((s,c)=>e.jsx("p",{className:"text-[11px] leading-relaxed text-[var(--text-secondary)]",children:s},c)),v.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:"suspended"})]}),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 c=s.status==="completed"?"var(--accent)":s.status==="failed"?"var(--destructive)":s.status==="running"?"var(--warning)":"#525252",m=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:c}}),e.jsxs("span",{className:"text-[11px]",style:{color:m,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:ee(t.createdAt)})]})})]})]}),d&&e.jsx(Le,{isOpen:!!d,onClose:ye,taskId:p,stageName:d.stageName,timeoutSeconds:Math.ceil(d.timeout/1e3),onSubmitted:Y}),ce]}):e.jsxs("div",{className:"flex h-full flex-col font-mono lowercase",children:[ke,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(de,{status:t.status}),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&&(te(i,t.branch)?e.jsx("a",{href:te(i,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}))]}),le,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]}),d&&e.jsx(Le,{isOpen:!!d,onClose:ye,taskId:p,stageName:d.stageName,timeoutSeconds:Math.ceil(d.timeout/1e3),onSubmitted:Y}),e.jsxs("div",{className:"flex min-h-0 flex-1",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsx("div",{className:"flex items-center border-b border-[var(--border)] shrink-0 overflow-x-auto no-scrollbar",children:["terminal","pipeline","logs"].map(s=>e.jsx("button",{onClick:()=>h(s),className:`shrink-0 whitespace-nowrap px-4 py-2.5 text-xs transition-colors ${g===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":"tasks.logs")},s))}),g==="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.jsxs("div",{className:"flex items-center gap-2 md:gap-3",children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:a("tasks.pty_terminal")}),e.jsxs("span",{className:`inline-flex items-center gap-1 text-[11px] ${k==="connected"?"text-[var(--accent)]":k==="connecting"?"text-[var(--warning)]":"text-[var(--text-muted)]"}`,children:[e.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${k==="connected"?"bg-[var(--accent)]":k==="connecting"?"bg-[var(--warning)]":"bg-[#525252]"}`}),a(`tasks.${k}`)]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[!f&&X==="auto"&&e.jsxs("button",{onClick:()=>{var s;return(s=O.current)==null?void 0:s.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(Te,{className:"h-3 w-3"}),a("tasks.take_over")]}),!f&&X==="manual"&&e.jsxs("button",{onClick:()=>{var s;return(s=O.current)==null?void 0:s.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(xe,{className:"h-3 w-3"}),a("tasks.restore_auto")]}),!f&&X==="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(oe,{className:"h-3 w-3 animate-spin"}),a("tasks.requesting_takeover")]}),!f&&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(ct,{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(nt,{className:"h-3 w-3"})})]})]}),e.jsxs("div",{className:"flex items-center gap-2 border-b border-[var(--border)] px-4 py-2 shrink-0 md:hidden",children:[e.jsx(de,{status:t.status}),t.workerName&&e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["on ",t.workerName]})]}),e.jsxs("div",{className:"border-b border-[var(--border)] px-4 py-3 shrink-0 md:hidden",children:[e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:a("tasks.stage_progress")}),e.jsx("div",{className:"mt-2 flex items-center gap-1 overflow-x-auto no-scrollbar pr-4",children:j.map((s,c)=>{const m=s.status==="completed",u=s.status==="running",U=s.status==="failed"?"var(--destructive)":m||u?"var(--accent)":"#525252";return e.jsxs("div",{className:"flex items-center",children:[e.jsxs("span",{className:"shrink-0 text-[11px] whitespace-nowrap",style:{color:U,fontWeight:u?600:400},children:[s.name,m?" ✓":u?" ...":""]}),c<j.length-1&&e.jsx("div",{className:"mx-1.5 h-px w-4 shrink-0",style:{backgroundColor:U}})]},s.name)})})]}),e.jsx("div",{className:"px-4 pt-3 pb-1 shrink-0 md:hidden",children:e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:a("tasks.pty_output")})}),e.jsx("div",{className:"min-h-0 flex-1 md:min-h-0",children:e.jsx(De,{ref:O,taskId:p,sessionId:t.currentSessionId??void 0,taskFinished:f,onStatusChange:ve,onTakeoverChange:be})}),we]}),g==="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:"flex items-center py-4 mb-4 md:mb-5 overflow-x-auto no-scrollbar",children:j.map((s,c)=>{const m=s.status==="completed",u=s.status==="running",Z=s.status==="failed"?"var(--destructive)":m||u?"var(--accent)":"#525252";return e.jsxs("div",{className:"flex items-center",style:{flex:c<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:Z},children:[m&&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] font-medium whitespace-nowrap",style:{color:Z},children:s.name})]}),c<j.length-1&&e.jsx("div",{className:"mx-1 md:mx-2 h-0.5 flex-1 min-w-3 rounded-full",style:{backgroundColor:c<(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: ",ee(t.startedAt).replace(" ago","")]}),e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// retries: ",t.retryCount,"/2"]})]}),e.jsx("button",{onClick:()=>h("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??"-"})]})]})]}),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")}),j.map(s=>{const c=s.status==="completed",m=s.status==="running",u=s.status==="failed";return e.jsxs("div",{className:`flex items-center gap-2 rounded-[4px] px-2 py-1.5 ${m?"bg-[var(--bg-input)]":""}`,children:[c&&e.jsx(Ee,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),m&&e.jsx(oe,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),u&&e.jsx(ie,{className:"h-3.5 w-3.5 shrink-0 text-[var(--destructive)]"}),s.status==="pending"&&e.jsx(Ie,{className:"h-3.5 w-3.5 shrink-0 text-[#525252]"}),e.jsx("span",{className:"text-xs",style:{color:c?"var(--accent)":m?"var(--text-primary)":u?"var(--destructive)":"#525252",fontWeight:m?500:400},children:m?`> ${s.name}`:s.name})]},s.name)})]}),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")}),v.length>0?e.jsx("div",{className:"flex flex-col gap-1.5",children:v.slice(-12).map((s,c)=>e.jsx("p",{className:"text-[11px] leading-relaxed text-[var(--text-muted)]",children:s},c))}):e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.no_activity")})]})]})]}),g==="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:()=>{pe(s),B(0)},className:`shrink-0 rounded-[4px] px-2.5 py-1 text-[11px] ${q===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(tt,{value:q,onChange:s=>{pe(s),B(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(Ve,{className:"h-3.5 w-3.5 text-[var(--text-muted)]"}),e.jsx("input",{type:"text",placeholder:a("tasks.search_logs"),value:J,onChange:s=>{Oe(s.target.value),B(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:[C.map((s,c)=>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 ${c%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 ${mt(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)),C.length===0&&!Fe&&e.jsx("p",{className:"py-8 text-center text-xs text-[var(--text-muted)]",children:a("tasks.no_log_entries")})]}),V>50&&e.jsxs("div",{className:"flex items-center justify-center gap-1",children:[Array.from({length:Math.ceil(V/50)}).slice(0,5).map((s,c)=>e.jsx("button",{onClick:()=>B(c),className:`rounded-[4px] px-2 py-1 text-xs ${z===c?"bg-[var(--accent)] text-black font-medium":"text-[var(--text-muted)] hover:text-[var(--text-primary)]"}`,children:c+1},c)),Math.ceil(V/50)>5&&e.jsx("button",{onClick:()=>B(z+1),disabled:z>=Math.ceil(V/50)-1,className:"rounded-[4px] px-2 py-1 text-xs text-[var(--text-muted)] disabled:opacity-30",children:">"})]})]})]}),g==="terminal"&&Ke,g==="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:ee(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:t.agentType??"claude"})]})]})]}),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??(A==null?void 0:A.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:(A==null?void 0:A.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:((Ce=t.mrUrl.match(/!?\d+$/))==null?void 0:Ce[0])??"view"})]})]})]}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsxs("div",{ref:ge,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(xt,{taskId:p,taskFinished:f,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 c=s.status==="completed"?"✓":s.status==="running"?"→":"·",m=s.status==="completed"||s.status==="running"?"var(--accent)":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:m},children:c}),e.jsx("span",{className:s.status==="running"?"font-medium":"",style:{color:m},children:s.name}),e.jsxs("span",{className:"text-[11px]",style:{color:"#525252"},children:["— ",u]})]},s.name)})})]})]})]}),ce]})}export{wt as default};
21
+ */const ct=se("SkipForward",[["polygon",{points:"5 4 15 12 5 20 5 4",key:"16p6eg"}],["line",{x1:"19",x2:"19",y1:"5",y2:"19",key:"futhcm"}]]);function Le({isOpen:l,onClose:x,taskId:a,stageName:n,timeoutSeconds:t,onSubmitted:o}){const{t:i}=H(),[b,v]=r.useState(t),[E,$]=r.useState(!1);r.useEffect(()=>{if(!l)return;v(t);const d=setInterval(()=>{v(y=>y<=1?(clearInterval(d),0):y-1)},1e3);return()=>clearInterval(d)},[l,t]),r.useEffect(()=>{b===0&&l&&x()},[b,l,x]);const T=r.useCallback(async d=>{$(!0);try{await N.post(`web/tasks/${a}/confirm-stage`,{json:{stageName:n,approved:d}}),o==null||o(),x()}catch{}finally{$(!1)}},[a,n,x,o]);return l?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backdropFilter:"blur(2px)"},children:[e.jsx("div",{className:"fixed inset-0 bg-[var(--modal-backdrop)]"}),e.jsxs("div",{className:"relative z-10 w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] font-mono",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 py-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(qe,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsxs("h3",{className:"text-sm text-[var(--text-primary)]",children:["// stage: ",n]})]}),e.jsxs("span",{className:"flex items-center gap-1 text-xs text-[var(--text-muted)]",children:[e.jsx(Ze,{className:"h-3.5 w-3.5"}),et(b)]})]}),e.jsx("div",{className:"space-y-4 px-5 py-5",children:e.jsx("p",{className:"whitespace-pre-wrap text-xs text-[var(--text-primary)]",children:i("tasks.confirm_stage_message",{name:n})})}),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:E,onClick:()=>T(!1),children:i("tasks.reject")}),e.jsx("button",{type:"button",className:"rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",disabled:E,onClick:()=>T(!0),children:i(E?"tasks.stage_submitting":"tasks.confirm_and_proceed")})]})]})]}):null}function it(l,x){const a=new Date(l).getTime()-Date.now();if(a<=0)return x("tasks.tunnel_expired");const n=Math.floor(a/36e5),t=Math.floor(a%36e5/6e4);return n>0?x("tasks.tunnel_expires_hm",{h:n,m:t}):x("tasks.tunnel_expires_m",{m:t})}function $e(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 Re(l,x){switch(l){case"IDLE":case"CLOSED":return x("tasks.tunnel_idle");case"STARTING":return x("tasks.tunnel_starting");case"CONNECTED":return x("tasks.tunnel_connected");case"EXPIRED":return x("tasks.tunnel_expired");case"CLOSING":return x("tasks.tunnel_closing");default:return String(l).toLowerCase()}}function xt({taskId:l,taskFinished:x,compact:a}){const{t:n}=H(),[t,o]=r.useState(L.IDLE),[i,b]=r.useState(null),[v,E]=r.useState(null),[$,T]=r.useState(""),[d,y]=r.useState(!1),[ae,R]=r.useState(!1),P=r.useRef(null),D=r.useCallback(async()=>{try{const h=await N.get(`web/workspace-tunnel/${l}/status`).json();o(h.status),b(h.tunnelUrl??null),E(h.expiresAt??null),(h.status==="EXPIRED"||h.status==="IDLE"||h.status==="CLOSED")&&_()}catch{}},[l]);function re(){_(),P.current=setInterval(D,5e3)}function _(){P.current&&(clearInterval(P.current),P.current=null)}r.useEffect(()=>{x&&(t===L.STARTING||t===L.CONNECTED)&&(o(L.IDLE),b(null),_())},[x,t]),r.useEffect(()=>{if(t!=="CONNECTED"||!v)return;const h=()=>{const S=it(v,n);T(S),S===n("tasks.tunnel_expired")&&(o(L.EXPIRED),b(null),_())};h();const C=setInterval(h,3e4);return()=>clearInterval(C)},[t,v]),r.useEffect(()=>()=>_(),[]),r.useEffect(()=>{x||D()},[D,x]);async function G(){y(!0);try{await N.post(`web/workspace-tunnel/${l}/start`),o(L.STARTING),re()}catch(h){let C=n("tasks.tunnel_start_failed");try{if(h instanceof ze){const S=await h.response.json();S!=null&&S.error&&(C=S.error,/code.*not found|ENOENT.*code|spawn code/i.test(C)&&(C+=". "+n("tasks.tunnel_install_code_hint")))}}catch{}me.error(C)}finally{y(!1)}}async function K(){y(!0);try{await N.post(`web/workspace-tunnel/${l}/stop`),o(L.IDLE),b(null),_()}catch{}finally{y(!1)}}async function g(){i&&(await navigator.clipboard.writeText(i),R(!0),setTimeout(()=>R(!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:$e(t)},children:Re(t,n)}),(t==="IDLE"||t==="CLOSED"||t==="EXPIRED")&&e.jsx("button",{onClick:G,disabled:d,className:"rounded-[4px] px-2 py-1 text-[var(--info)] disabled:opacity-50",style:{backgroundColor:"rgba(59,130,246,0.12)"},children:n(d?"tasks.tunnel_starting":"tasks.tunnel_start")}),t==="CONNECTED"&&i&&e.jsx("a",{href:i.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:n("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:n("tasks.tunnel_header")}),e.jsxs("span",{className:"text-xs",style:{color:$e(t)},children:["● ",Re(t,n)]})]}),t==="CONNECTED"&&v&&e.jsxs("p",{className:"mb-2 text-xs text-[var(--text-muted)]",children:["// ",$]}),t==="CONNECTED"&&i&&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:i}),e.jsxs("button",{onClick:g,className:"shrink-0 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors","aria-label":n("tasks.tunnel_copy_url"),children:["[",n("common.copy"),"]"]})]}),ae&&e.jsx("p",{className:"mb-2 text-xs text-[var(--accent)]",children:n("tasks.tunnel_copied")}),t==="STARTING"&&e.jsx("p",{className:"mb-3 text-xs text-[var(--text-muted)]",children:n("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:G,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:n(d?"tasks.tunnel_starting_button":"tasks.tunnel_start_button")}),t==="STARTING"&&e.jsx("button",{onClick:K,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:n(d?"tasks.tunnel_stopping":"tasks.tunnel_cancel")}),t==="CONNECTED"&&i&&e.jsxs(e.Fragment,{children:[e.jsx("a",{href:i.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:n("tasks.tunnel_open_cursor")}),e.jsx("a",{href:i.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:n("tasks.tunnel_open_vscode")}),e.jsx("button",{onClick:K,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:n(d?"tasks.tunnel_stopping":"tasks.tunnel_stop")})]}),t==="EXPIRED"&&e.jsx("button",{onClick:G,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:n(d?"tasks.tunnel_starting_button":"tasks.tunnel_restart")})]})]})}function ot({isOpen:l,onClose:x,onConfirm:a,taskId:n,isLoading:t}){const{t:o}=H();return e.jsx(Pe,{isOpen:l,onClose:x,onConfirm:a,title:o("tasks.cancel_task_title"),message:o("tasks.cancel_task_message",{id:String(n)}),confirmLabel:o("tasks.cancel_task_confirm_label"),confirmVariant:"danger",isLoading:t})}function dt({isOpen:l,onClose:x,onConfirm:a,taskId:n,mrUrl:t,isLoading:o}){const{t:i}=H(),b=t?i("tasks.retry_message_with_mr",{id:String(n),url:t}):i("tasks.retry_message_without_mr",{id:String(n)});return e.jsx(Pe,{isOpen:l,onClose:x,onConfirm:a,title:i("tasks.retry_title"),message:b,confirmLabel:i("tasks.retry_confirm_label"),confirmVariant:"accent",isLoading:o})}function mt(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 de({status:l}){const x=st(l);return e.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-[4px] px-2 py-0.5 text-xs",style:{color:x},children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-[3px]",style:{backgroundColor:x}}),l.toLowerCase()]})}function pt(l){let a=["implement","test","verify","review","submit"];if(l.configSnapshot)try{const t=JSON.parse(l.configSnapshot);if(t&&typeof t=="object"){const o=typeof t.pipeline=="string"?JSON.parse(t.pipeline):t.pipeline;o&&typeof o=="object"&&Array.isArray(o.stages)&&o.stages.length>0&&o.stages.every(i=>i&&typeof i=="object"&&typeof i.name=="string")&&(a=o.stages.map(i=>i.name))}}catch{}const n=l.currentStage?a.indexOf(l.currentStage):-1;return a.map((t,o)=>{let i="pending";return l.status===W.COMPLETED?i="completed":l.status===W.FAILED&&o<=n?i=o===n?"failed":"completed":n>=0&&(o<n?i="completed":o===n&&(i="running")),{name:t,status:i}})}function te(l,x){if(!l||!x)return null;const a=l.repoUrl.replace(/\.git$/,"");return l.gitPlatform===Je.GITLAB?`${a}/-/tree/${x}`:`${a}/tree/${x}`}function wt(){var _e,Ce;const{id:l}=Be(),x=Xe(),{t:a}=H(),n=Qe(s=>s.cancelTask),[t,o]=r.useState(null),[i,b]=r.useState(null),[v,E]=r.useState([]),[$,T]=r.useState(!0),[d,y]=r.useState(null),[ae,R]=r.useState(!1),[P,D]=r.useState(!1),[re,_]=r.useState(!1),[G,K]=r.useState(!1),[g,h]=r.useState("terminal"),[C,S]=r.useState([]),[V,Ae]=r.useState(0),[q,z]=r.useState(0),[B,pe]=r.useState(""),[J,Oe]=r.useState(""),[Fe,ue]=r.useState(!1),[Me,he]=r.useState(!1),[A,fe]=r.useState(null),[k,ve]=r.useState("disconnected"),[X,be]=r.useState("auto"),O=r.useRef(null),ge=r.useRef(null),p=Number(l),f=t?Ye.includes(t.status):!1;We(t?`#${t.id} ${t.description}`:null);const w=r.useCallback(async()=>{try{const s=await N.get(`web/tasks/${p}`).json();o(s)}catch{}},[p]),Q=r.useCallback(async()=>{try{const s=await N.get(`web/tasks/${p}/logs`).json();E(s.lines)}catch{}},[p]),F=r.useCallback(async()=>{try{const s=await N.get(`web/tasks/${p}/pending-confirm`).json();y(s.confirm)}catch{y(null)}},[p]),je=r.useCallback(async()=>{ue(!0);try{const s=new URLSearchParams;s.set("limit","50"),s.set("offset",String(q*50)),B&&s.set("type",B),J&&s.set("search",J);const c=await N.get(`web/tasks/${p}/events?${s}`).json();S(c.events),Ae(c.total)}catch{}finally{ue(!1)}},[p,q,B,J]);r.useEffect(()=>{g==="logs"&&je()},[g,je]),r.useEffect(()=>{g==="pipeline"&&!f&&N.get(`web/workspaces/${p}`).json().then(fe).catch(()=>fe(null))},[g,p,f]);const M=Se(s=>s.lastEvent),Ne=Se(s=>s.eventSeq);r.useEffect(()=>{T(!0),Promise.all([w(),Q(),F()]).finally(()=>T(!1))},[w,Q,F]),r.useEffect(()=>{t!=null&&t.projectKey&&N.get(`web/projects/${t.projectKey}`).json().then(b).catch(()=>b(null))},[t==null?void 0:t.projectKey]),r.useEffect(()=>{!M||Ne===0||(M.event==="task_status_changed"&&M.taskId===p||M.event==="task_created"&&M.taskId===p)&&(w(),F())},[Ne,M,p,w,F]),r.useEffect(()=>{if(f)return;const c=setInterval(()=>{document.visibilityState!=="hidden"&&Promise.all([w(),Q(),F()])},15e3);return()=>clearInterval(c)},[f,w,Q,F]);const ye=r.useCallback(()=>y(null),[]),Y=r.useCallback(()=>{y(null),w()},[w]);async function Ue(){_(!0);try{await n(p),R(!1),await w()}finally{_(!1)}}async function Ge(){K(!0);try{await N.post(`web/tasks/${p}/retry`),D(!1),await w()}finally{K(!1)}}const j=r.useMemo(()=>t?pt(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");if($)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:()=>x("/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 ke=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:()=>x("/tasks"),className:"shrink-0 text-[var(--text-muted)]",children:e.jsx(at,{className:"h-4 w-4"})}),e.jsxs("span",{className:"line-clamp-2 text-sm font-medium text-[var(--text-primary)]",children:["#",t.id," ",t.description]})]}),le=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(de,{status:t.status}),e.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),e.jsxs(He,{to:`/projects/${t.projectKey}`,className:"text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:["project: ",e.jsx("span",{className:"text-[var(--text-primary)]",children:t.projectKey})]}),t.branch&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["branch: ",te(i,t.branch)?e.jsx("a",{href:te(i,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: ",((_e=t.mrUrl.match(/!?\d+$/))==null?void 0:_e[0])??"view"]})]})]}),we=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:[!f&&e.jsxs("button",{onClick:()=>R(!0),className:"flex flex-1 md:flex-none items-center justify-center gap-1.5 rounded-[4px] bg-[var(--destructive)]/10 px-3 h-8 text-[11px] font-medium text-[var(--destructive)]",children:[e.jsx(ie,{className:"h-3 w-3"}),a("tasks.cancel_task")]}),t.status===W.FAILED&&e.jsxs("button",{onClick:()=>D(!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(xe,{className:"h-3 w-3"}),a("tasks.retry_task")]}),t.workerId&&!f&&e.jsxs("button",{onClick:()=>{h("pipeline"),setTimeout(()=>{var s,c;(c=(s=ge.current)==null?void 0:s.scrollIntoView)==null||c.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(rt,{className:"h-3 w-3"}),a("tasks.cursor_tunnel")]})]}),Ke=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")}),j.map(s=>{const c=s.status==="completed",m=s.status==="running",u=s.status==="failed";return e.jsxs("div",{className:`flex items-center gap-2 rounded-[4px] px-2 py-1.5 ${m?"bg-[#1a1a1a]":""}`,children:[c&&e.jsx(Ee,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),m&&e.jsx(oe,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),u&&e.jsx(ie,{className:"h-3.5 w-3.5 shrink-0 text-[var(--destructive)]"}),s.status==="pending"&&e.jsx(Ie,{className:"h-3.5 w-3.5 shrink-0 text-[#525252]"}),e.jsx("span",{className:"text-xs",style:{color:c?"var(--accent)":m?"#e5e5e5":u?"var(--destructive)":"#525252",fontWeight:m?500:400},children:m?`> ${s.name}`:s.name})]},s.name)})]}),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")}),v.length>0?e.jsx("div",{className:"flex flex-col gap-1.5",children:v.slice(0,8).map((s,c)=>e.jsx("p",{className:"text-[11px] leading-relaxed text-[var(--text-muted)]",children:s},c))}):e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.no_activity")})]})]}),ce=e.jsxs(e.Fragment,{children:[e.jsx(ot,{isOpen:ae,onClose:()=>R(!1),onConfirm:Ue,taskId:p,isLoading:re}),e.jsx(dt,{isOpen:P,onClose:()=>D(!1),onConfirm:Ge,taskId:p,mrUrl:t.mrUrl??void 0,isLoading:G})]});return Me&&g==="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:[le,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.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:a("tasks.pty_terminal")}),e.jsxs("span",{className:`inline-flex items-center gap-1 text-[11px] ${k==="connected"?"text-[var(--accent)]":k==="connecting"?"text-[var(--warning)]":"text-[var(--text-muted)]"}`,children:[e.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${k==="connected"?"bg-[var(--accent)]":k==="connecting"?"bg-[var(--warning)]":"bg-[#525252]"}`}),a(`tasks.${k}`)]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[!f&&X==="auto"&&e.jsxs("button",{onClick:()=>{var s;return(s=O.current)==null?void 0:s.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(Te,{className:"h-3 w-3"}),a("tasks.take_over")]}),!f&&X==="manual"&&e.jsxs("button",{onClick:()=>{var s;return(s=O.current)==null?void 0:s.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(xe,{className:"h-3 w-3"}),a("tasks.restore_auto")]}),t.currentStage&&e.jsxs("span",{className:"text-[11px] text-[var(--accent)]",children:[a("tasks.stage"),": ",t.currentStage]}),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(lt,{className:"h-3 w-3"})})]})]}),e.jsx("div",{className:"min-h-0 flex-1",children:e.jsx(De,{ref:O,taskId:p,sessionId:t.currentSessionId??void 0,taskFinished:f,onStatusChange:ve,onTakeoverChange:be})}),we,ce]}):t.status===W.SUSPENDED?e.jsxs("div",{className:"flex h-full flex-col font-mono lowercase",children:[ke,le,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)]",children:t.description}),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:a("tasks.status_suspended")})]}),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:a("tasks.status_suspended")})}),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 N.post(`web/tasks/${p}/confirm-stage`,{json:{stageName:d.stageName,approved:!0}}),Y()}catch{me.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 N.post(`web/tasks/${p}/confirm-stage`,{json:{stageName:d.stageName,approved:!1}}),Y()}catch{me.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:"suspended"})]}),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:ee(t.createdAt)})]})]})]}),e.jsx("div",{className:"hidden md:flex flex-wrap items-center gap-2 py-2",children:j.map((s,c)=>{const m=s.status==="failed",u=s.status==="completed",I=s.status==="running"&&t.status===W.SUSPENDED,U=m?"var(--destructive)":u?"var(--accent)":I?"var(--warning)":"#525252",Z=m?"rgba(239,68,68,0.12)":u?"rgba(34,197,94,0.12)":I?"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:U,backgroundColor:Z,fontWeight:I?700:400,border:I?`1px solid ${U}`:void 0},children:I?"confirm":`${s.name}${u?" ✓":m?" ✗":""}`}),c<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:[v.slice(-10).map((s,c)=>e.jsx("p",{className:"text-[11px] leading-relaxed text-[var(--text-secondary)]",children:s},c)),v.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:"suspended"})]}),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 c=s.status==="completed"?"var(--accent)":s.status==="failed"?"var(--destructive)":s.status==="running"?"var(--warning)":"#525252",m=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:c}}),e.jsxs("span",{className:"text-[11px]",style:{color:m,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:ee(t.createdAt)})]})})]})]}),d&&e.jsx(Le,{isOpen:!!d,onClose:ye,taskId:p,stageName:d.stageName,timeoutSeconds:Math.ceil(d.timeout/1e3),onSubmitted:Y}),ce]}):e.jsxs("div",{className:"flex h-full flex-col font-mono lowercase",children:[ke,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(de,{status:t.status}),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&&(te(i,t.branch)?e.jsx("a",{href:te(i,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}))]}),le,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]}),d&&e.jsx(Le,{isOpen:!!d,onClose:ye,taskId:p,stageName:d.stageName,timeoutSeconds:Math.ceil(d.timeout/1e3),onSubmitted:Y}),e.jsxs("div",{className:"flex min-h-0 flex-1",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsx("div",{className:"flex items-center border-b border-[var(--border)] shrink-0 overflow-x-auto no-scrollbar",children:["terminal","pipeline","logs"].map(s=>e.jsx("button",{onClick:()=>h(s),className:`shrink-0 whitespace-nowrap px-4 py-2.5 text-xs transition-colors ${g===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":"tasks.logs")},s))}),g==="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.jsxs("div",{className:"flex items-center gap-2 md:gap-3",children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:a("tasks.pty_terminal")}),e.jsxs("span",{className:`inline-flex items-center gap-1 text-[11px] ${k==="connected"?"text-[var(--accent)]":k==="connecting"?"text-[var(--warning)]":"text-[var(--text-muted)]"}`,children:[e.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${k==="connected"?"bg-[var(--accent)]":k==="connecting"?"bg-[var(--warning)]":"bg-[#525252]"}`}),a(`tasks.${k}`)]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[!f&&X==="auto"&&e.jsxs("button",{onClick:()=>{var s;return(s=O.current)==null?void 0:s.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(Te,{className:"h-3 w-3"}),a("tasks.take_over")]}),!f&&X==="manual"&&e.jsxs("button",{onClick:()=>{var s;return(s=O.current)==null?void 0:s.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(xe,{className:"h-3 w-3"}),a("tasks.restore_auto")]}),!f&&X==="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(oe,{className:"h-3 w-3 animate-spin"}),a("tasks.requesting_takeover")]}),!f&&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(ct,{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(nt,{className:"h-3 w-3"})})]})]}),e.jsxs("div",{className:"flex items-center gap-2 border-b border-[var(--border)] px-4 py-2 shrink-0 md:hidden",children:[e.jsx(de,{status:t.status}),t.workerName&&e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["on ",t.workerName]})]}),e.jsxs("div",{className:"border-b border-[var(--border)] px-4 py-3 shrink-0 md:hidden",children:[e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:a("tasks.stage_progress")}),e.jsx("div",{className:"mt-2 flex items-center gap-1 overflow-x-auto no-scrollbar pr-4",children:j.map((s,c)=>{const m=s.status==="completed",u=s.status==="running",U=s.status==="failed"?"var(--destructive)":m||u?"var(--accent)":"#525252";return e.jsxs("div",{className:"flex items-center",children:[e.jsxs("span",{className:"shrink-0 text-[11px] whitespace-nowrap",style:{color:U,fontWeight:u?600:400},children:[s.name,m?" ✓":u?" ...":""]}),c<j.length-1&&e.jsx("div",{className:"mx-1.5 h-px w-4 shrink-0",style:{backgroundColor:U}})]},s.name)})})]}),e.jsx("div",{className:"px-4 pt-3 pb-1 shrink-0 md:hidden",children:e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:a("tasks.pty_output")})}),e.jsx("div",{className:"min-h-0 flex-1 md:min-h-0",children:e.jsx(De,{ref:O,taskId:p,sessionId:t.currentSessionId??void 0,taskFinished:f,onStatusChange:ve,onTakeoverChange:be})}),we]}),g==="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:"flex items-center py-4 mb-4 md:mb-5 overflow-x-auto no-scrollbar",children:j.map((s,c)=>{const m=s.status==="completed",u=s.status==="running",Z=s.status==="failed"?"var(--destructive)":m||u?"var(--accent)":"#525252";return e.jsxs("div",{className:"flex items-center",style:{flex:c<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:Z},children:[m&&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] font-medium whitespace-nowrap",style:{color:Z},children:s.name})]}),c<j.length-1&&e.jsx("div",{className:"mx-1 md:mx-2 h-0.5 flex-1 min-w-3 rounded-full",style:{backgroundColor:c<(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: ",ee(t.startedAt).replace(" ago","")]}),e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// retries: ",t.retryCount,"/2"]})]}),e.jsx("button",{onClick:()=>h("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??"-"})]})]})]}),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")}),j.map(s=>{const c=s.status==="completed",m=s.status==="running",u=s.status==="failed";return e.jsxs("div",{className:`flex items-center gap-2 rounded-[4px] px-2 py-1.5 ${m?"bg-[var(--bg-input)]":""}`,children:[c&&e.jsx(Ee,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),m&&e.jsx(oe,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),u&&e.jsx(ie,{className:"h-3.5 w-3.5 shrink-0 text-[var(--destructive)]"}),s.status==="pending"&&e.jsx(Ie,{className:"h-3.5 w-3.5 shrink-0 text-[#525252]"}),e.jsx("span",{className:"text-xs",style:{color:c?"var(--accent)":m?"var(--text-primary)":u?"var(--destructive)":"#525252",fontWeight:m?500:400},children:m?`> ${s.name}`:s.name})]},s.name)})]}),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")}),v.length>0?e.jsx("div",{className:"flex flex-col gap-1.5",children:v.slice(-12).map((s,c)=>e.jsx("p",{className:"text-[11px] leading-relaxed text-[var(--text-muted)]",children:s},c))}):e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.no_activity")})]})]})]}),g==="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:()=>{pe(s),z(0)},className:`shrink-0 rounded-[4px] px-2.5 py-1 text-[11px] ${B===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(tt,{value:B,onChange:s=>{pe(s),z(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(Ve,{className:"h-3.5 w-3.5 text-[var(--text-muted)]"}),e.jsx("input",{type:"text",placeholder:a("tasks.search_logs"),value:J,onChange:s=>{Oe(s.target.value),z(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:[C.map((s,c)=>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 ${c%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 ${mt(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)),C.length===0&&!Fe&&e.jsx("p",{className:"py-8 text-center text-xs text-[var(--text-muted)]",children:a("tasks.no_log_entries")})]}),V>50&&e.jsxs("div",{className:"flex items-center justify-center gap-1",children:[Array.from({length:Math.ceil(V/50)}).slice(0,5).map((s,c)=>e.jsx("button",{onClick:()=>z(c),className:`rounded-[4px] px-2 py-1 text-xs ${q===c?"bg-[var(--accent)] text-black font-medium":"text-[var(--text-muted)] hover:text-[var(--text-primary)]"}`,children:c+1},c)),Math.ceil(V/50)>5&&e.jsx("button",{onClick:()=>z(q+1),disabled:q>=Math.ceil(V/50)-1,className:"rounded-[4px] px-2 py-1 text-xs text-[var(--text-muted)] disabled:opacity-30",children:">"})]})]})]}),g==="terminal"&&Ke,g==="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:ee(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:t.agentType??"claude"})]})]})]}),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??(A==null?void 0:A.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:(A==null?void 0:A.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:((Ce=t.mrUrl.match(/!?\d+$/))==null?void 0:Ce[0])??"view"})]})]})]}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsxs("div",{ref:ge,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(xt,{taskId:p,taskFinished:f,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 c=s.status==="completed"?"✓":s.status==="running"?"→":"·",m=s.status==="completed"||s.status==="running"?"var(--accent)":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:m},children:c}),e.jsx("span",{className:s.status==="running"?"font-medium":"",style:{color:m},children:s.name}),e.jsxs("span",{className:"text-[11px]",style:{color:"#525252"},children:["— ",u]})]},s.name)})})]})]})]}),ce]})}export{wt as default};
@@ -1 +1 @@
1
- import{R as Y,f as $,a as B,j as e,u as V,i as X,r as a,h as F,X as Z,k as ee,o as te,H as se,t as J,m as E,p as re,q as H}from"./index-IU_JgZB6.js";import{a as ae,A as oe,u as ne}from"./task-constants-CO2WGgG-.js";import{T as G}from"./TaskStatusBadge-CAzEbP55.js";import{f as Q}from"./date-BdNtiQTP.js";import{t as le}from"./string-B39tzdVK.js";import{S as D}from"./Select-Bb1Om6Pn.js";import{C as ce}from"./copy-Bmiw8s-G.js";import{E as U}from"./EmptyState-Cc8AT_UZ.js";import{T as W}from"./Skeleton-BnZTI3PM.js";import{P as ie}from"./plus-o_FzgRCv.js";import"./status-colors-D6drermf.js";const de=Y.memo(function({task:t}){const m=$(),{t:p}=B(),d=(l,r)=>p(`common.${l}`,{n:r});return e.jsxs("tr",{onClick:()=>m(`/tasks/${t.id}`),className:"cursor-pointer border-b border-[var(--border-row)] transition-colors hover:bg-[var(--bg-input)]",children:[e.jsxs("td",{className:"w-16 py-3 pr-4 font-mono text-xs font-medium text-[var(--text-secondary)] text-right tabular-nums",children:["#",t.id]}),e.jsx("td",{className:"py-3 pr-4 text-sm text-[var(--text-primary)]",children:le(t.description,80)}),e.jsx("td",{className:"py-3 pr-4",children:e.jsx(G,{status:t.status})}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:t.projectKey}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:t.developerName??t.creatorName??"-"}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:t.workerName??"—"}),e.jsx("td",{className:"py-3 font-mono text-xs text-[var(--text-muted)]",children:Q(t.createdAt,d)})]})});function xe({isOpen:n,onClose:t,projects:m,projectsLoading:p,onSubmit:d,isSubmitting:l}){const{t:r}=B();V(o=>o.user);const v=X(),[c,S]=a.useState(""),[x,f]=a.useState(""),[j,h]=a.useState("feat"),[I,P]=a.useState(""),[A,w]=a.useState(""),[_,y]=a.useState(""),[C,g]=a.useState(""),[q,K]=a.useState([]),[b,k]=a.useState("");a.useEffect(()=>{n&&(S(""),f(""),h("feat"),P(""),w(""),y(""),g(""),k(""),v&&F.get("admin/developers").json().then(K).catch(()=>K([])))},[n,v]),a.useEffect(()=>{if(!n)return;function o(u){u.key==="Escape"&&t()}return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[n,t]);async function z(o){if(o.preventDefault(),k(""),!c||!x.trim()){k(r("tasks.project_and_description_required"));return}try{await d({projectKey:c,description:x.trim(),workerId:_||void 0,developerId:C?Number(C):void 0,taskType:j,branchSlug:A.trim()||void 0,agentType:I||void 0})}catch(u){const N=u instanceof Error?u.message:r("tasks.failed_to_create_task");k(N)}}return n?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 font-mono",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},onClick:o=>{o.target===o.currentTarget&&t()},children:e.jsxs("div",{className:"w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",onClick:o=>o.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-6 py-4",children:[e.jsxs("h2",{className:"text-sm text-[var(--text-primary)]",children:["// ",r("tasks.new_task")]}),e.jsx("button",{onClick:t,className:"text-[var(--text-muted)] transition-colors hover:text-[var(--text-primary)]",children:e.jsx(Z,{className:"h-4 w-4"})})]}),e.jsxs("form",{onSubmit:z,className:"px-6 py-5",children:[e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.project")}),e.jsx(D,{value:c,onChange:S,options:m.map(o=>({value:o.key,label:o.name})),placeholder:r(p?"common.loading":"tasks.select_project"),disabled:p})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.task_type")}),e.jsx(D,{value:j,onChange:h,options:ae})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.form_agent_type")}),e.jsx(D,{value:I,onChange:P,options:oe})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.task_description")}),e.jsx("textarea",{value:x,onChange:o=>f(o.target.value),placeholder:r("tasks.describe_task_placeholder"),rows:4,className:"w-full resize-none rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.target_worker")}),e.jsx("input",{type:"text",value:_,onChange:o=>y(o.target.value),placeholder:r("tasks.any_able"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.branch_slug")}),e.jsx("input",{type:"text",value:A,onChange:o=>w(o.target.value),placeholder:r("tasks.branch_slug_placeholder"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),v&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.assign_developer")}),e.jsx(D,{value:C,onChange:g,options:q.map(o=>({value:String(o.id),label:o.name})),placeholder:r("tasks.select_developer")})]}),b&&e.jsx("div",{className:"rounded-[4px] bg-[#2a1515] border border-[var(--destructive)]/30 px-3 py-2 text-xs text-[var(--destructive)]",children:b})]}),e.jsxs("div",{className:"mt-6 flex items-center justify-end gap-3",children:[e.jsx("button",{type:"button",onClick:t,className:"rounded-[4px] border border-[var(--border)] bg-transparent px-4 py-2 text-xs text-[var(--text-secondary)] transition-colors hover:text-[var(--text-primary)]",children:r("common.cancel")}),e.jsx("button",{type:"submit",disabled:l||!c||!x.trim(),className:"rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs text-black transition-opacity hover:opacity-90 disabled:opacity-40",children:r(l?"common.creating":"tasks.create_task")})]})]})]})}):null}function pe({isOpen:n,onClose:t,onForceCreate:m,onViewExisting:p,similarTask:d,isLoading:l}){const{t:r}=B();return!d||!n?null:e.jsx("div",{onClick:t,style:{position:"fixed",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},children:e.jsxs("div",{onClick:v=>v.stopPropagation(),style:{width:"100%",maxWidth:"480px",backgroundColor:"var(--bg-card)",border:"1px solid var(--border)",borderRadius:"4px",padding:"1.5rem",fontFamily:"'JetBrains Mono', monospace"},children:[e.jsxs("div",{style:{marginBottom:"1.25rem"},children:[e.jsxs("div",{style:{color:"var(--accent)",fontSize:"0.875rem",fontWeight:600,display:"flex",alignItems:"center",gap:"0.5rem"},children:[e.jsx(ce,{style:{width:"1rem",height:"1rem"}}),r("tasks.dedup_title")]}),e.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.7rem",marginTop:"0.25rem"},children:r("tasks.dedup_description")})]}),e.jsxs("div",{style:{marginBottom:"1.25rem",padding:"0.75rem",border:"1px solid var(--border)",borderRadius:"4px",backgroundColor:"var(--bg-primary)"},children:[e.jsxs("div",{style:{color:"var(--text-muted)",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace"},children:["#",d.id," · ",d.status]}),e.jsx("div",{style:{color:"var(--text-primary)",fontSize:"0.75rem",marginTop:"0.375rem",lineHeight:"1.5"},children:d.description})]}),e.jsxs("div",{style:{display:"flex",gap:"0.75rem"},children:[e.jsx("button",{type:"button",onClick:t,disabled:l,className:"text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:border-[var(--text-muted)]",style:{flex:1,padding:"0.5rem",backgroundColor:"transparent",border:"1px solid var(--border)",borderRadius:"4px",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:l?"not-allowed":"pointer",opacity:l?.7:1,transition:"color 0.15s, border-color 0.15s"},children:r("common.cancel")}),e.jsx("button",{type:"button",onClick:()=>p(d.id),style:{flex:1,padding:"0.5rem",backgroundColor:"transparent",color:"var(--text-muted)",border:"1px solid var(--border)",borderRadius:"4px",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:"pointer"},children:r("tasks.view_existing")}),e.jsx("button",{type:"button",onClick:m,disabled:l,style:{flex:1,padding:"0.5rem",backgroundColor:"var(--warning)",color:"#0C0C0C",border:"none",borderRadius:"4px",fontSize:"0.75rem",fontWeight:600,fontFamily:"'JetBrains Mono', monospace",cursor:l?"not-allowed":"pointer",opacity:l?.7:1},children:r(l?"common.creating":"tasks.dedup_create_anyway")})]})]})})}function me({task:n}){const t=$();return e.jsxs("div",{onClick:()=>t(`/tasks/${n.id}`),className:"cursor-pointer rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 transition-colors active:bg-[var(--bg-input)]",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("span",{className:"text-[11px] text-[var(--text-primary)] leading-tight",style:{wordBreak:"break-word"},children:["#",n.id," ",n.description]}),e.jsx("span",{className:"shrink-0",children:e.jsx(G,{status:n.status})})]}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-2 text-[11px] text-[var(--text-muted)]",children:[e.jsx("span",{children:Q(n.createdAt)}),e.jsx("span",{children:"·"}),e.jsx("span",{children:n.projectKey}),n.workerName&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("span",{children:n.workerName})]})]})]})}const ue=[{key:"all",labelKey:"tasks.tab_all"},{key:E.RUNNING,labelKey:"tasks.tab_running"},{key:E.QUEUED,labelKey:"tasks.tab_queued"},{key:E.COMPLETED,labelKey:"tasks.tab_completed"},{key:E.FAILED,labelKey:"tasks.tab_failed"},{key:E.CANCELLED,labelKey:"tasks.tab_cancelled"}],R=20;function _e(){const n=$(),{t}=B(),{tasks:m,loading:p,fetchTasks:d}=ne(),l=ee(s=>s.taskSeq),[r,v]=a.useState("all"),[c,S]=a.useState(""),[x,f]=a.useState(1),[j,h]=a.useState(!1);te(a.useMemo(()=>e.jsxs("button",{onClick:()=>h(!0),className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs font-mono text-black transition-opacity hover:opacity-90",children:[e.jsx(ie,{className:"h-3.5 w-3.5"}),t("tasks.new_task")]}),[t]));const[I,P]=a.useState([]),[A,w]=a.useState(!1),[_,y]=a.useState(!1),[C,g]=a.useState(!1),[q,K]=a.useState(null),[b,k]=a.useState(null);a.useEffect(()=>{const s={limit:String(R)};r!=="all"&&(s.status=r),d(s)},[r,d,l]),a.useEffect(()=>{f(1)},[c]),a.useEffect(()=>{j&&(w(!0),F.get("web/projects").json().then(s=>P(s)).catch(()=>{}).finally(()=>w(!1)))},[j]);const z=a.useCallback(async s=>{y(!0);try{const i=await F.post("web/tasks",{json:{projectKey:s.projectKey,description:s.description,workerId:s.workerId,developerId:s.developerId,taskType:s.taskType,branchSlug:s.branchSlug,agentType:s.agentType}}).json();h(!1),n(`/tasks/${i.task.id}`)}catch(i){if(i instanceof se&&i.response.status===409){try{const T=await i.response.json();if(T.confirmRequired){K({id:T.confirmRequired.taskId,description:T.confirmRequired.message,status:"active"}),k(s),h(!1),g(!0);return}}catch{}J.error(t("tasks.similar_task_exists"))}else{const T=i instanceof Error?i.message:String(i);J.error(T)}}finally{y(!1)}},[n]),o=a.useCallback(async()=>{if(b){y(!0);try{const s=await F.post("web/tasks",{json:{projectKey:b.projectKey,description:b.description,workerId:b.workerId,force:!0}}).json();g(!1),n(`/tasks/${s.task.id}`)}finally{y(!1)}}},[b,n]),u=a.useMemo(()=>{if(!c.trim())return m;const s=c.toLowerCase();return m.filter(i=>i.description.toLowerCase().includes(s)||String(i.id).includes(c))},[m,c]),N=Math.max(1,Math.ceil(u.length/R)),M=u.slice((x-1)*R,x*R),O=t(c?"tasks.try_adjusting_search":"tasks.create_first_task"),L=c?void 0:e.jsx("button",{onClick:()=>h(!0),className:"rounded-[4px] bg-[var(--accent)] px-5 py-2 text-[11px] font-bold text-black",children:t("tasks.create_task")});return e.jsxs("div",{className:"mx-auto max-w-6xl px-2 py-4 md:px-4 md:py-6 font-mono",children:[e.jsxs("div",{className:"mb-4 flex flex-col gap-3 md:gap-4 md:flex-row md:items-center",children:[e.jsx("div",{className:"flex items-center gap-1 overflow-x-auto pb-1 md:pb-0 no-scrollbar pr-4 md:pr-0",children:ue.map(s=>e.jsx("button",{onClick:()=>v(s.key),className:`shrink-0 rounded-[4px] px-3 py-2 h-10 md:h-8 text-xs transition-colors ${r===s.key?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)] bg-[var(--bg-card)] hover:text-[var(--text-secondary)]"}`,children:t(s.labelKey)},s.key))}),e.jsxs("div",{className:"relative md:ml-auto md:w-64",children:[e.jsx(re,{className:"absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-[var(--text-muted)]"}),e.jsx("input",{type:"text",placeholder:t("tasks.search_tasks"),value:c,onChange:s=>S(s.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] py-1.5 pl-8 pr-3 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"}),c&&e.jsx("button",{onClick:()=>S(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-xs text-[var(--text-muted)] hover:text-[var(--text-secondary)]",children:"x"})]})]}),e.jsx("div",{className:"hidden md:block rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:e.jsxs("table",{className:"w-full text-left",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] text-[11px] font-medium text-[#525252]",children:[e.jsx("th",{className:"w-16 px-4 py-2.5 text-right",children:t("tasks.id")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.description_col")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.status_col")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.project_col")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.assignee")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.worker")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.time")})]})}),e.jsxs("tbody",{children:[p&&M.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"p-4",children:e.jsx(W,{rows:5})})}),!p&&u.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"p-4",children:e.jsx(U,{icon:H,title:t("tasks.no_tasks_found"),description:O,action:L})})}),M.map(s=>e.jsx(de,{task:s},s.id))]})]})}),e.jsxs("div",{className:"flex flex-col gap-2 md:hidden",children:[p&&M.length===0&&e.jsx("div",{className:"p-4",children:e.jsx(W,{rows:5})}),!p&&u.length===0&&e.jsx(U,{icon:H,title:t("tasks.no_tasks_found"),description:O,action:L}),M.map(s=>e.jsx(me,{task:s},s.id))]}),N>1&&e.jsxs("div",{className:"mt-6 flex items-center justify-center gap-1",children:[e.jsx("button",{onClick:()=>f(Math.max(1,x-1)),disabled:x===1,className:"rounded-[4px] px-2 py-1 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] disabled:opacity-30 min-w-[44px] min-h-[44px] flex items-center justify-center",children:t("tasks.prev")}),Array.from({length:N},(s,i)=>i+1).map(s=>e.jsx("button",{onClick:()=>f(s),className:`rounded-[4px] px-2.5 py-1 text-xs transition-colors min-w-[44px] min-h-[44px] flex items-center justify-center ${x===s?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:s},s)),e.jsx("button",{onClick:()=>f(Math.min(N,x+1)),disabled:x===N,className:"rounded-[4px] px-2 py-1 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] disabled:opacity-30 min-w-[44px] min-h-[44px] flex items-center justify-center",children:t("common.next")})]}),e.jsx(xe,{isOpen:j,onClose:()=>h(!1),projects:I,projectsLoading:A,onSubmit:z,isSubmitting:_}),e.jsx(pe,{isOpen:C,onClose:()=>g(!1),onForceCreate:o,onViewExisting:s=>{g(!1),n(`/tasks/${s}`)},similarTask:q,isLoading:_})]})}export{_e as default};
1
+ import{R as Y,f as $,a as B,j as e,u as V,i as X,r as a,h as F,X as Z,k as ee,p as te,H as se,t as J,m as E,q as re,s as H}from"./index-CDX3RozQ.js";import{a as ae,A as oe,u as ne}from"./task-constants-DJm-CFzH.js";import{T as G}from"./TaskStatusBadge-BfVCs18S.js";import{f as Q}from"./date-BdNtiQTP.js";import{t as le}from"./string-YaUnvj19.js";import{S as D}from"./Select-B_ck2i6c.js";import{C as ce}from"./copy-CPHUK1ku.js";import{E as U}from"./EmptyState-DbhiJS8D.js";import{T as W}from"./Skeleton-pzJkEnE6.js";import{P as ie}from"./plus-BKGIPAng.js";import"./status-colors-etVqHg4l.js";const de=Y.memo(function({task:t}){const m=$(),{t:p}=B(),d=(l,r)=>p(`common.${l}`,{n:r});return e.jsxs("tr",{onClick:()=>m(`/tasks/${t.id}`),className:"cursor-pointer border-b border-[var(--border-row)] transition-colors hover:bg-[var(--bg-input)]",children:[e.jsxs("td",{className:"w-16 py-3 pr-4 font-mono text-xs font-medium text-[var(--text-secondary)] text-right tabular-nums",children:["#",t.id]}),e.jsx("td",{className:"py-3 pr-4 text-sm text-[var(--text-primary)]",children:le(t.description,80)}),e.jsx("td",{className:"py-3 pr-4",children:e.jsx(G,{status:t.status})}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:t.projectKey}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:t.developerName??t.creatorName??"-"}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:t.workerName??"—"}),e.jsx("td",{className:"py-3 font-mono text-xs text-[var(--text-muted)]",children:Q(t.createdAt,d)})]})});function xe({isOpen:n,onClose:t,projects:m,projectsLoading:p,onSubmit:d,isSubmitting:l}){const{t:r}=B();V(o=>o.user);const v=X(),[c,S]=a.useState(""),[x,f]=a.useState(""),[j,h]=a.useState("feat"),[I,P]=a.useState(""),[A,w]=a.useState(""),[_,y]=a.useState(""),[C,g]=a.useState(""),[q,K]=a.useState([]),[b,k]=a.useState("");a.useEffect(()=>{n&&(S(""),f(""),h("feat"),P(""),w(""),y(""),g(""),k(""),v&&F.get("admin/developers").json().then(K).catch(()=>K([])))},[n,v]),a.useEffect(()=>{if(!n)return;function o(u){u.key==="Escape"&&t()}return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[n,t]);async function z(o){if(o.preventDefault(),k(""),!c||!x.trim()){k(r("tasks.project_and_description_required"));return}try{await d({projectKey:c,description:x.trim(),workerId:_||void 0,developerId:C?Number(C):void 0,taskType:j,branchSlug:A.trim()||void 0,agentType:I||void 0})}catch(u){const N=u instanceof Error?u.message:r("tasks.failed_to_create_task");k(N)}}return n?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 font-mono",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},onClick:o=>{o.target===o.currentTarget&&t()},children:e.jsxs("div",{className:"w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",onClick:o=>o.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-6 py-4",children:[e.jsxs("h2",{className:"text-sm text-[var(--text-primary)]",children:["// ",r("tasks.new_task")]}),e.jsx("button",{onClick:t,className:"text-[var(--text-muted)] transition-colors hover:text-[var(--text-primary)]",children:e.jsx(Z,{className:"h-4 w-4"})})]}),e.jsxs("form",{onSubmit:z,className:"px-6 py-5",children:[e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.project")}),e.jsx(D,{value:c,onChange:S,options:m.map(o=>({value:o.key,label:o.name})),placeholder:r(p?"common.loading":"tasks.select_project"),disabled:p})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.task_type")}),e.jsx(D,{value:j,onChange:h,options:ae})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.form_agent_type")}),e.jsx(D,{value:I,onChange:P,options:oe})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.task_description")}),e.jsx("textarea",{value:x,onChange:o=>f(o.target.value),placeholder:r("tasks.describe_task_placeholder"),rows:4,className:"w-full resize-none rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.target_worker")}),e.jsx("input",{type:"text",value:_,onChange:o=>y(o.target.value),placeholder:r("tasks.any_able"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.branch_slug")}),e.jsx("input",{type:"text",value:A,onChange:o=>w(o.target.value),placeholder:r("tasks.branch_slug_placeholder"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),v&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.assign_developer")}),e.jsx(D,{value:C,onChange:g,options:q.map(o=>({value:String(o.id),label:o.name})),placeholder:r("tasks.select_developer")})]}),b&&e.jsx("div",{className:"rounded-[4px] bg-[#2a1515] border border-[var(--destructive)]/30 px-3 py-2 text-xs text-[var(--destructive)]",children:b})]}),e.jsxs("div",{className:"mt-6 flex items-center justify-end gap-3",children:[e.jsx("button",{type:"button",onClick:t,className:"rounded-[4px] border border-[var(--border)] bg-transparent px-4 py-2 text-xs text-[var(--text-secondary)] transition-colors hover:text-[var(--text-primary)]",children:r("common.cancel")}),e.jsx("button",{type:"submit",disabled:l||!c||!x.trim(),className:"rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs text-black transition-opacity hover:opacity-90 disabled:opacity-40",children:r(l?"common.creating":"tasks.create_task")})]})]})]})}):null}function pe({isOpen:n,onClose:t,onForceCreate:m,onViewExisting:p,similarTask:d,isLoading:l}){const{t:r}=B();return!d||!n?null:e.jsx("div",{onClick:t,style:{position:"fixed",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},children:e.jsxs("div",{onClick:v=>v.stopPropagation(),style:{width:"100%",maxWidth:"480px",backgroundColor:"var(--bg-card)",border:"1px solid var(--border)",borderRadius:"4px",padding:"1.5rem",fontFamily:"'JetBrains Mono', monospace"},children:[e.jsxs("div",{style:{marginBottom:"1.25rem"},children:[e.jsxs("div",{style:{color:"var(--accent)",fontSize:"0.875rem",fontWeight:600,display:"flex",alignItems:"center",gap:"0.5rem"},children:[e.jsx(ce,{style:{width:"1rem",height:"1rem"}}),r("tasks.dedup_title")]}),e.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.7rem",marginTop:"0.25rem"},children:r("tasks.dedup_description")})]}),e.jsxs("div",{style:{marginBottom:"1.25rem",padding:"0.75rem",border:"1px solid var(--border)",borderRadius:"4px",backgroundColor:"var(--bg-primary)"},children:[e.jsxs("div",{style:{color:"var(--text-muted)",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace"},children:["#",d.id," · ",d.status]}),e.jsx("div",{style:{color:"var(--text-primary)",fontSize:"0.75rem",marginTop:"0.375rem",lineHeight:"1.5"},children:d.description})]}),e.jsxs("div",{style:{display:"flex",gap:"0.75rem"},children:[e.jsx("button",{type:"button",onClick:t,disabled:l,className:"text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:border-[var(--text-muted)]",style:{flex:1,padding:"0.5rem",backgroundColor:"transparent",border:"1px solid var(--border)",borderRadius:"4px",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:l?"not-allowed":"pointer",opacity:l?.7:1,transition:"color 0.15s, border-color 0.15s"},children:r("common.cancel")}),e.jsx("button",{type:"button",onClick:()=>p(d.id),style:{flex:1,padding:"0.5rem",backgroundColor:"transparent",color:"var(--text-muted)",border:"1px solid var(--border)",borderRadius:"4px",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:"pointer"},children:r("tasks.view_existing")}),e.jsx("button",{type:"button",onClick:m,disabled:l,style:{flex:1,padding:"0.5rem",backgroundColor:"var(--warning)",color:"#0C0C0C",border:"none",borderRadius:"4px",fontSize:"0.75rem",fontWeight:600,fontFamily:"'JetBrains Mono', monospace",cursor:l?"not-allowed":"pointer",opacity:l?.7:1},children:r(l?"common.creating":"tasks.dedup_create_anyway")})]})]})})}function me({task:n}){const t=$();return e.jsxs("div",{onClick:()=>t(`/tasks/${n.id}`),className:"cursor-pointer rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 transition-colors active:bg-[var(--bg-input)]",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("span",{className:"text-[11px] text-[var(--text-primary)] leading-tight",style:{wordBreak:"break-word"},children:["#",n.id," ",n.description]}),e.jsx("span",{className:"shrink-0",children:e.jsx(G,{status:n.status})})]}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-2 text-[11px] text-[var(--text-muted)]",children:[e.jsx("span",{children:Q(n.createdAt)}),e.jsx("span",{children:"·"}),e.jsx("span",{children:n.projectKey}),n.workerName&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("span",{children:n.workerName})]})]})]})}const ue=[{key:"all",labelKey:"tasks.tab_all"},{key:E.RUNNING,labelKey:"tasks.tab_running"},{key:E.QUEUED,labelKey:"tasks.tab_queued"},{key:E.COMPLETED,labelKey:"tasks.tab_completed"},{key:E.FAILED,labelKey:"tasks.tab_failed"},{key:E.CANCELLED,labelKey:"tasks.tab_cancelled"}],R=20;function _e(){const n=$(),{t}=B(),{tasks:m,loading:p,fetchTasks:d}=ne(),l=ee(s=>s.taskSeq),[r,v]=a.useState("all"),[c,S]=a.useState(""),[x,f]=a.useState(1),[j,h]=a.useState(!1);te(a.useMemo(()=>e.jsxs("button",{onClick:()=>h(!0),className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs font-mono text-black transition-opacity hover:opacity-90",children:[e.jsx(ie,{className:"h-3.5 w-3.5"}),t("tasks.new_task")]}),[t]));const[I,P]=a.useState([]),[A,w]=a.useState(!1),[_,y]=a.useState(!1),[C,g]=a.useState(!1),[q,K]=a.useState(null),[b,k]=a.useState(null);a.useEffect(()=>{const s={limit:String(R)};r!=="all"&&(s.status=r),d(s)},[r,d,l]),a.useEffect(()=>{f(1)},[c]),a.useEffect(()=>{j&&(w(!0),F.get("web/projects").json().then(s=>P(s)).catch(()=>{}).finally(()=>w(!1)))},[j]);const z=a.useCallback(async s=>{y(!0);try{const i=await F.post("web/tasks",{json:{projectKey:s.projectKey,description:s.description,workerId:s.workerId,developerId:s.developerId,taskType:s.taskType,branchSlug:s.branchSlug,agentType:s.agentType}}).json();h(!1),n(`/tasks/${i.task.id}`)}catch(i){if(i instanceof se&&i.response.status===409){try{const T=await i.response.json();if(T.confirmRequired){K({id:T.confirmRequired.taskId,description:T.confirmRequired.message,status:"active"}),k(s),h(!1),g(!0);return}}catch{}J.error(t("tasks.similar_task_exists"))}else{const T=i instanceof Error?i.message:String(i);J.error(T)}}finally{y(!1)}},[n]),o=a.useCallback(async()=>{if(b){y(!0);try{const s=await F.post("web/tasks",{json:{projectKey:b.projectKey,description:b.description,workerId:b.workerId,force:!0}}).json();g(!1),n(`/tasks/${s.task.id}`)}finally{y(!1)}}},[b,n]),u=a.useMemo(()=>{if(!c.trim())return m;const s=c.toLowerCase();return m.filter(i=>i.description.toLowerCase().includes(s)||String(i.id).includes(c))},[m,c]),N=Math.max(1,Math.ceil(u.length/R)),M=u.slice((x-1)*R,x*R),O=t(c?"tasks.try_adjusting_search":"tasks.create_first_task"),L=c?void 0:e.jsx("button",{onClick:()=>h(!0),className:"rounded-[4px] bg-[var(--accent)] px-5 py-2 text-[11px] font-bold text-black",children:t("tasks.create_task")});return e.jsxs("div",{className:"mx-auto max-w-6xl px-2 py-4 md:px-4 md:py-6 font-mono",children:[e.jsxs("div",{className:"mb-4 flex flex-col gap-3 md:gap-4 md:flex-row md:items-center",children:[e.jsx("div",{className:"flex items-center gap-1 overflow-x-auto pb-1 md:pb-0 no-scrollbar pr-4 md:pr-0",children:ue.map(s=>e.jsx("button",{onClick:()=>v(s.key),className:`shrink-0 rounded-[4px] px-3 py-2 h-10 md:h-8 text-xs transition-colors ${r===s.key?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)] bg-[var(--bg-card)] hover:text-[var(--text-secondary)]"}`,children:t(s.labelKey)},s.key))}),e.jsxs("div",{className:"relative md:ml-auto md:w-64",children:[e.jsx(re,{className:"absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-[var(--text-muted)]"}),e.jsx("input",{type:"text",placeholder:t("tasks.search_tasks"),value:c,onChange:s=>S(s.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] py-1.5 pl-8 pr-3 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"}),c&&e.jsx("button",{onClick:()=>S(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-xs text-[var(--text-muted)] hover:text-[var(--text-secondary)]",children:"x"})]})]}),e.jsx("div",{className:"hidden md:block rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:e.jsxs("table",{className:"w-full text-left",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] text-[11px] font-medium text-[#525252]",children:[e.jsx("th",{className:"w-16 px-4 py-2.5 text-right",children:t("tasks.id")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.description_col")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.status_col")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.project_col")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.assignee")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.worker")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.time")})]})}),e.jsxs("tbody",{children:[p&&M.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"p-4",children:e.jsx(W,{rows:5})})}),!p&&u.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"p-4",children:e.jsx(U,{icon:H,title:t("tasks.no_tasks_found"),description:O,action:L})})}),M.map(s=>e.jsx(de,{task:s},s.id))]})]})}),e.jsxs("div",{className:"flex flex-col gap-2 md:hidden",children:[p&&M.length===0&&e.jsx("div",{className:"p-4",children:e.jsx(W,{rows:5})}),!p&&u.length===0&&e.jsx(U,{icon:H,title:t("tasks.no_tasks_found"),description:O,action:L}),M.map(s=>e.jsx(me,{task:s},s.id))]}),N>1&&e.jsxs("div",{className:"mt-6 flex items-center justify-center gap-1",children:[e.jsx("button",{onClick:()=>f(Math.max(1,x-1)),disabled:x===1,className:"rounded-[4px] px-2 py-1 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] disabled:opacity-30 min-w-[44px] min-h-[44px] flex items-center justify-center",children:t("tasks.prev")}),Array.from({length:N},(s,i)=>i+1).map(s=>e.jsx("button",{onClick:()=>f(s),className:`rounded-[4px] px-2.5 py-1 text-xs transition-colors min-w-[44px] min-h-[44px] flex items-center justify-center ${x===s?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:s},s)),e.jsx("button",{onClick:()=>f(Math.min(N,x+1)),disabled:x===N,className:"rounded-[4px] px-2 py-1 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] disabled:opacity-30 min-w-[44px] min-h-[44px] flex items-center justify-center",children:t("common.next")})]}),e.jsx(xe,{isOpen:j,onClose:()=>h(!1),projects:I,projectsLoading:A,onSubmit:z,isSubmitting:_}),e.jsx(pe,{isOpen:C,onClose:()=>g(!1),onForceCreate:o,onViewExisting:s=>{g(!1),n(`/tasks/${s}`)},similarTask:q,isLoading:_})]})}export{_e as default};
@@ -0,0 +1 @@
1
+ import{a as l,j as a}from"./index-CDX3RozQ.js";import{a as u}from"./status-colors-etVqHg4l.js";const r={QUEUED:"tasks.status_queued",ASSIGNED:"tasks.status_assigned",RUNNING:"tasks.status_running",SUSPENDED:"tasks.status_suspended",COMPLETED:"tasks.status_completed",FAILED:"tasks.status_failed",CANCELLED:"tasks.status_cancelled"};function E({status:s}){const{t:e}=l(),t=r[s],n=t?e(t):(s??"unknown").toLowerCase(),o=u(s);return a.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-xs",style:{color:o},children:[a.jsx("span",{style:{fontSize:"0.6rem"},children:"●"}),n]})}export{E as T};
@@ -0,0 +1,11 @@
1
+ import{c as J,l as re,h as I,m as N,a as E,r as c,k as F,n as ie,j as e,X as Y,o as ce,f as oe}from"./index-CDX3RozQ.js";import{T as U,u as le,a as L,A as H}from"./task-constants-DJm-CFzH.js";import{P as de,H as xe,C as me}from"./PtyTerminal-DrSwszQB.js";import{i as K,O as Q}from"./OnboardingGuide-B2ouxTnA.js";import{S as w,C as ue}from"./Select-B_ck2i6c.js";import{a as V}from"./status-colors-etVqHg4l.js";import{a as pe}from"./date-BdNtiQTP.js";import{u as X}from"./useFetch-BQ5yntc6.js";import{P as R}from"./plus-BKGIPAng.js";import{R as he}from"./rotate-ccw-Bqxz-Wkr.js";import{W as fe}from"./wifi-3MFN8I6Y.js";import"./chevron-right-YlCuiZOO.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 ve=J("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
7
+ * @license lucide-react v0.469.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const ge=J("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),Z="overlord_home_terminal";function be(){try{const s=localStorage.getItem(Z);if(s)return JSON.parse(s)}catch{}return{pinnedTaskIds:[],activeTaskId:null}}let W="";function M(s){const a=JSON.stringify(s);a!==W&&(W=a,localStorage.setItem(Z,a))}const z=be(),je=new Set([N.QUEUED,N.ASSIGNED,N.RUNNING,N.SUSPENDED]);let $=!1;const ke=re((s,a)=>({pinnedTaskIds:z.pinnedTaskIds,activeTaskId:z.activeTaskId,taskMetas:{},stageConfirm:null,loading:!1,setActiveTask:t=>{s({activeTaskId:t}),M({pinnedTaskIds:a().pinnedTaskIds,activeTaskId:t})},pinTask:t=>{const{pinnedTaskIds:n}=a();if(n.includes(t))return;const o=[...n,t];s({pinnedTaskIds:o}),M({pinnedTaskIds:o,activeTaskId:a().activeTaskId})},unpinTask:t=>{const{pinnedTaskIds:n,activeTaskId:o,taskMetas:x}=a(),r=n.filter(h=>h!==t),d=o===t?r[0]??null:o,{[t]:p,...i}=x;s({pinnedTaskIds:r,activeTaskId:d,taskMetas:i}),M({pinnedTaskIds:r,activeTaskId:d})},loadActiveTasks:async()=>{if(!$){$=!0,s({loading:!0});try{const n=(await I.get("web/tasks",{searchParams:{limit:"30"}}).json()).data.filter(i=>je.has(i.status)),o={};for(const i of n)o[i.id]={id:i.id,description:i.description,status:i.status,projectKey:i.projectKey,currentStage:i.currentStage,currentSessionId:i.currentSessionId,updatedAt:i.updatedAt};const r=[...n].sort((i,h)=>h.updatedAt.localeCompare(i.updatedAt)).map(i=>i.id),{activeTaskId:d}=a(),p=d&&r.includes(d)?d:r[0]??null;s({taskMetas:o,pinnedTaskIds:r,activeTaskId:p}),M({pinnedTaskIds:r,activeTaskId:p})}catch{}finally{$=!1,s({loading:!1})}}},fetchStageConfirm:async t=>{try{const n=await I.get(`web/tasks/${t}/pending-confirm`).json();s({stageConfirm:n.confirm})}catch{s({stageConfirm:null})}},clearStageConfirm:()=>s({stageConfirm:null}),updateTaskMeta:(t,n)=>{const{taskMetas:o}=a(),x=o[t];x&&s({taskMetas:{...o,[t]:{...x,...n}}})}}));function Ne(){const[s,a]=c.useState(()=>K());c.useEffect(()=>{const n=()=>a(!0),o=()=>a(K());return window.addEventListener("onboarding-dismissed",n),window.addEventListener("storage",o),()=>{window.removeEventListener("onboarding-dismissed",n),window.removeEventListener("storage",o)}},[]);const{data:t}=X(()=>s?Promise.resolve(null):I.get("web/dashboard/stats").json(),[s]);return s||!t?null:{activeTasks:(t.active_tasks??0)+(t.queued_tasks??0),totalWorkers:t.online_workers??0,totalProjects:t.project_count??0,totalDevelopers:t.developer_count??0}}function ye({taskId:s,confirm:a,onSubmitted:t}){const{t:n}=E(),[o,x]=c.useState(a.timeout),[r,d]=c.useState(!1);c.useEffect(()=>{x(a.timeout);const i=setInterval(()=>{x(h=>h<=1?(clearInterval(i),0):h-1)},1e3);return()=>clearInterval(i)},[a.timeout,a.stageName]);const p=c.useCallback(async i=>{d(!0);try{await I.post(`web/tasks/${s}/confirm-stage`,{json:{stageName:a.stageName,approved:i}}),t()}catch{}finally{d(!1)}},[s,a.stageName,t]);return e.jsxs("div",{className:"flex items-center justify-between gap-2 border-b-2 border-[var(--warning)] bg-[var(--warning)]/10 px-3 py-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(me,{className:"h-3.5 w-3.5 shrink-0 text-[var(--warning)]"}),e.jsxs("span",{className:"truncate text-xs text-[var(--text-primary)]",children:["// stage: ",a.stageName]}),e.jsx("span",{className:"shrink-0 text-xs text-[var(--warning)]",children:pe(o)})]}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx("button",{onClick:()=>p(!1),disabled:r,className:"rounded-[4px] border border-[var(--border)] px-2 py-1 text-[11px] text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors disabled:opacity-50",children:n("tasks.reject")}),e.jsx("button",{onClick:()=>p(!0),disabled:r,className:"rounded-[4px] bg-[var(--accent)] px-2 py-1 text-[11px] text-black hover:opacity-90 transition-opacity disabled:opacity-50",children:n(r?"tasks.stage_submitting":"tasks.confirm_and_proceed")})]})]})}function we({projectKey:s,onProjectChange:a,onCreated:t}){const{t:n}=E(),o=le(u=>u.createTask),[x,r]=c.useState(""),[d,p]=c.useState("feat"),[i,h]=c.useState(""),[f,T]=c.useState(!1),[S,C]=c.useState(!1),[D,A]=c.useState(!1),{data:P}=X(()=>I.get("web/projects").json(),[]),v=c.useMemo(()=>{const u=(P??[]).map(k=>({value:k.key,label:k.key}));return[{value:"",label:n("terminal_home.all_projects")},...u]},[P,n]),y=c.useRef(!1);c.useEffect(()=>{if(!y.current){if(s){y.current=!0;return}v.length>1&&(a(v[1].value),y.current=!0)}},[s,v,a]);const g=!!s&&!!x.trim();function j(){g&&C(!0)}async function m(){if(C(!1),!!g){T(!0);try{const u=await o({projectKey:s,description:x.trim(),taskType:d,agentType:i||void 0});r(""),t(u.id)}catch{}finally{T(!1)}}}const O=n("terminal_home.confirm_create_message").replace("{taskType}",d).replace("{projectKey}",s).replace("{description}",x.trim()),_="flex-1 rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-2 py-1.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden md:flex items-center gap-2 border-b border-[var(--border)] bg-[var(--bg-card)] px-3 py-2",children:[e.jsx("div",{className:"w-[140px]",children:e.jsx(w,{value:s,onChange:a,options:v,placeholder:n("terminal_home.select_project")})}),e.jsx("div",{className:"w-[100px]",children:e.jsx(w,{value:d,onChange:p,options:L})}),e.jsx("div",{className:"w-[120px]",children:e.jsx(w,{value:i,onChange:h,options:H})}),e.jsx("input",{type:"text",value:x,onChange:u=>r(u.target.value),onKeyDown:u=>u.key==="Enter"&&j(),placeholder:n("terminal_home.task_description_placeholder"),className:_,disabled:f}),e.jsxs("button",{onClick:j,disabled:f||!g,className:"flex items-center gap-1 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",children:[e.jsx(R,{className:"h-3 w-3"}),n(f?"common.creating":"terminal_home.new_task")]})]}),e.jsx("div",{className:"md:hidden border-b border-[var(--border)] bg-[var(--bg-card)]",children:D?e.jsxs("div",{className:"flex flex-col gap-2 p-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex-1",children:e.jsx(w,{value:s,onChange:a,options:v,placeholder:n("terminal_home.select_project")})}),e.jsx("div",{className:"w-[100px]",children:e.jsx(w,{value:d,onChange:p,options:L})}),e.jsx("div",{className:"w-[120px]",children:e.jsx(w,{value:i,onChange:h,options:H})}),e.jsx("button",{onClick:()=>A(!1),className:"p-1 text-[var(--text-muted)]",children:e.jsx(Y,{className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",value:x,onChange:u=>r(u.target.value),onKeyDown:u=>u.key==="Enter"&&j(),placeholder:n("terminal_home.task_description_placeholder"),className:_,disabled:f}),e.jsx("button",{onClick:j,disabled:f||!g,className:"rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",children:e.jsx(R,{className:"h-3 w-3"})})]})]}):e.jsxs("button",{onClick:()=>A(!0),className:"flex w-full items-center justify-center gap-1 py-2 text-xs text-[var(--accent)] hover:opacity-80",children:[e.jsx(R,{className:"h-3.5 w-3.5"}),n("terminal_home.new_task")]})}),e.jsx(ce,{isOpen:S,onClose:()=>C(!1),onConfirm:m,title:n("terminal_home.confirm_create_title"),message:O,confirmVariant:"accent",confirmLabel:n("terminal_home.new_task"),isLoading:f})]})}function B({status:s,size:a}){const t=s===N.SUSPENDED,n=V(s),o=a==="sm"?"h-1.5 w-1.5":"h-2 w-2";return e.jsx("span",{className:`${o} shrink-0 rounded-full ${t?"animate-pulse":""}`,style:{backgroundColor:t?"var(--warning)":n}})}function Te({tasks:s,activeId:a,onSelect:t,onUnpin:n,children:o}){const x=oe();return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden md:flex flex-col border-r border-[var(--border)] bg-[var(--bg-card)] overflow-y-auto",style:{width:200,minWidth:200},children:[e.jsx("div",{className:"border-b border-[var(--border)] px-3 py-2",children:e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:"// active tasks"})}),s.length===0?e.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:"no active tasks"})}):e.jsx("div",{className:"flex-1",children:s.map(r=>{const d=r.id===a;return e.jsxs("div",{onClick:()=>t(r.id),className:`group flex items-center gap-2 px-3 py-2 cursor-pointer transition-colors ${d?"bg-[var(--accent)]/10 text-[var(--text-primary)]":"text-[var(--text-secondary)] hover:bg-[var(--bg-input)] hover:text-[var(--text-primary)]"}`,children:[e.jsx(B,{status:r.status,size:"md"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"truncate text-xs",children:["#",r.id," ",r.description]}),e.jsx("div",{className:"text-[10px] text-[var(--text-muted)]",children:r.projectKey})]}),e.jsx("button",{onClick:p=>{p.stopPropagation(),n(r.id)},className:"hidden group-hover:block shrink-0 p-0.5 text-[var(--text-muted)] hover:text-[var(--text-primary)]",title:"unpin",children:e.jsx(Y,{className:"h-3 w-3"})}),e.jsx("button",{onClick:p=>{p.stopPropagation(),x(`/tasks/${r.id}`)},className:"hidden group-hover:block shrink-0 p-0.5 text-[var(--text-muted)] hover:text-[var(--accent)]",title:"open detail",children:e.jsx("span",{className:"text-[10px]",children:"→"})})]},r.id)})})]}),e.jsxs("div",{className:"flex flex-col md:hidden",children:[e.jsx("div",{className:"flex items-center gap-1 overflow-x-auto no-scrollbar border-b border-[var(--border)] bg-[var(--bg-card)] px-2",style:{height:44},children:s.length===0?e.jsx("div",{className:"flex items-center justify-center w-full",children:e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:"no active tasks"})}):s.map(r=>{const d=r.id===a;return e.jsxs("button",{onClick:()=>t(r.id),className:`flex shrink-0 items-center gap-1.5 px-3 border-b-2 transition-colors ${d?"border-[var(--accent)] text-[var(--text-primary)]":"border-transparent text-[var(--text-secondary)]"}`,style:{height:44},children:[e.jsx(B,{status:r.status,size:"sm"}),e.jsxs("span",{className:"text-[11px] whitespace-nowrap",children:["#",r.id]})]},r.id)})}),o]})]})}function Se({task:s,takeoverState:a,onTakeover:t,onRelease:n}){const o=V(s.status),x=a==="manual";return e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] bg-[var(--bg-card)] px-3",style:{height:36,minHeight:36},children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:s.projectKey}),e.jsx("span",{className:"text-[11px]",style:{color:o},children:s.status.toLowerCase()}),s.currentStage&&e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["// ",s.currentStage]})]}),e.jsx("div",{className:"flex items-center gap-1",children:!U.includes(s.status)&&(x?e.jsxs("button",{onClick:n,className:"flex items-center gap-1.5 rounded-[4px] px-2.5 py-0.5 text-[11px] font-medium text-[var(--accent)]",style:{backgroundColor:"rgba(34,197,94,0.12)"},children:[e.jsx(he,{className:"h-3 w-3"}),e.jsx("span",{className:"hidden md:inline",children:"restore auto"})]}):e.jsxs("button",{onClick:t,disabled:a==="requesting",className:"flex items-center gap-1.5 rounded-[4px] px-2.5 py-0.5 text-[11px] font-medium text-[var(--warning)] disabled:opacity-50",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:[e.jsx(xe,{className:"h-3 w-3"}),e.jsx("span",{className:"hidden md:inline",children:"take over"})]}))})]})}function Ce({task:s,ptyStatus:a}){const t=a==="connected";return e.jsxs("div",{className:"flex items-center justify-between border-t border-[var(--border)] bg-[var(--bg-card)] px-3",style:{height:28,minHeight:28},children:[e.jsx("span",{className:"text-[10px] text-[var(--text-muted)]",children:s.currentStage?`stage: ${s.currentStage}`:`task #${s.id}`}),e.jsxs("span",{className:`flex items-center gap-1 text-[10px] ${t?"text-[var(--accent)]":"text-[var(--text-muted)]"}`,children:[t?e.jsx(fe,{className:"h-2.5 w-2.5"}):e.jsx(ge,{className:"h-2.5 w-2.5"}),t?"connected":a]})]})}function G({onboardingData:s}){const[a,t]=c.useState(!1),{t:n}=E();return s?a?e.jsxs("div",{className:"border-b border-[var(--accent)]/30",children:[e.jsxs("button",{onClick:()=>t(!1),className:"flex w-full items-center justify-between bg-[var(--bg-card)] px-3 py-1.5 transition-colors hover:bg-[var(--bg-input)]",children:[e.jsx("span",{className:"text-[11px] text-[var(--accent)]",children:n("onboarding.getting_started")}),e.jsx(ve,{className:"h-3 w-3 text-[var(--text-muted)]"})]}),e.jsx("div",{className:"max-h-[300px] overflow-y-auto",children:e.jsx(Q,{data:s})})]}):e.jsxs("button",{onClick:()=>t(!0),className:"flex w-full items-center justify-between border-b border-[var(--accent)]/30 bg-[var(--bg-card)] px-3 py-1.5 transition-colors hover:bg-[var(--bg-input)]",style:{height:36},children:[e.jsx("span",{className:"text-[11px] text-[var(--accent)]",children:n("onboarding.getting_started")}),e.jsx(ue,{className:"h-3 w-3 text-[var(--text-muted)]"})]}):null}function q({onboardingData:s}){const{t:a}=E();return e.jsx("div",{className:`flex flex-1 flex-col items-center p-4 md:p-6 ${s?"overflow-auto":"justify-center"}`,children:s?e.jsx("div",{className:"w-full max-w-lg",children:e.jsx(Q,{data:s})}):e.jsxs("div",{className:"text-center",children:[e.jsxs("div",{className:"mb-3 text-3xl text-[var(--border)]",children:[">","_"]}),e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:a("terminal_home.no_active_tasks")}),e.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:a("terminal_home.create_task_hint")})]})})}function Le(){const{t:s}=E(),{pinnedTaskIds:a,activeTaskId:t,taskMetas:n,stageConfirm:o,loading:x,setActiveTask:r,pinTask:d,unpinTask:p,loadActiveTasks:i,fetchStageConfirm:h,clearStageConfirm:f,updateTaskMeta:T}=ke(),S=c.useRef(null),[C,D]=c.useState("disconnected"),[A,P]=c.useState("auto"),[v,y]=c.useState(""),g=F(l=>l.lastEvent),j=F(l=>l.status),m=t?n[t]??null:null,O=m?U.includes(m.status):!1,_=c.useRef(!1);c.useEffect(()=>{!_.current&&m&&(y(m.projectKey),_.current=!0)},[m]);const u=c.useMemo(()=>{const l=a.map(b=>n[b]).filter(Boolean);return v?l.filter(b=>b.projectKey===v):l},[a,n,v]);c.useEffect(()=>{u.length>0&&t&&!u.some(l=>l.id===t)&&r(u[0].id)},[u,t,r]);const k=Ne();ie(m?`#${m.id} ${m.description}`:null),c.useEffect(()=>{i()},[i]),c.useEffect(()=>{t&&(m==null?void 0:m.status)===N.SUSPENDED?h(t):f()},[t,m==null?void 0:m.status,h,f]),c.useEffect(()=>{if(g){if(g.event==="task_status_changed"){const{taskId:l,status:b}=g;T(l,{status:b,updatedAt:new Date().toISOString()}),b===N.SUSPENDED&&l===t&&h(l),U.includes(b)&&l===t&&f()}g.event==="task_created"&&i()}},[g,t,h,f,T,i]),c.useEffect(()=>{if(j==="connected")return;const b=setInterval(()=>{document.visibilityState!=="hidden"&&i()},15e3);return()=>clearInterval(b)},[j,i]);const ee=c.useCallback(l=>{d(l),r(l),i()},[d,r,i]),te=c.useCallback(()=>{f(),i()},[f,i]),se=c.useCallback(()=>{var l;(l=S.current)==null||l.requestTakeover()},[]),ae=c.useCallback(()=>{var l;(l=S.current)==null||l.releaseTakeover()},[]);if(x&&a.length===0)return e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:s("common.loading")})});const ne=u.length>0;return e.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsx(we,{projectKey:v,onProjectChange:y,onCreated:ee}),e.jsx("div",{className:"flex flex-1 overflow-hidden",children:ne?e.jsxs(e.Fragment,{children:[e.jsx(Te,{tasks:u,activeId:t,onSelect:r,onUnpin:p,children:e.jsx("div",{className:"md:hidden",children:e.jsx(G,{onboardingData:k})})}),e.jsx("div",{className:"flex flex-1 flex-col overflow-hidden",children:m?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden md:block",children:e.jsx(G,{onboardingData:k})}),e.jsx(Se,{task:m,takeoverState:A,onTakeover:se,onRelease:ae}),o&&t&&e.jsx(ye,{taskId:t,confirm:o,onSubmitted:te}),e.jsx("div",{className:"flex-1 min-h-[300px] overflow-hidden",children:e.jsx(de,{taskId:t,sessionId:m.currentSessionId??void 0,taskFinished:O,onStatusChange:D,onTakeoverChange:P,ref:S},t)}),e.jsx(Ce,{task:m,ptyStatus:C})]}):e.jsx(q,{onboardingData:k})})]}):e.jsx(q,{onboardingData:k})})]})}export{Le as default};