@overlordai/server 1.0.69 → 1.0.70

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 (80) hide show
  1. package/package.json +4 -4
  2. package/public/assets/{AccessTokensPage-iDZ6rZhl.js → AccessTokensPage-C1KxsuHq.js} +1 -1
  3. package/public/assets/{AdminPage-CIVF_6oN.js → AdminPage-DbFm0hOL.js} +1 -1
  4. package/public/assets/{ApiReferencePage-DdBJhmX5.js → ApiReferencePage-C2sQuzcP.js} +1 -1
  5. package/public/assets/{ArchitecturePage-BWQACk_w.js → ArchitecturePage-C7el9GsX.js} +1 -1
  6. package/public/assets/{AuditLogPage-DTZL5_x5.js → AuditLogPage-CX9OBQtG.js} +1 -1
  7. package/public/assets/{BindPlatformPage-DR0wVGmo.js → BindPlatformPage-BW2M2vKF.js} +1 -1
  8. package/public/assets/{BotIntegrationPage-BsClXkLN.js → BotIntegrationPage-Bsj1xlUm.js} +1 -1
  9. package/public/assets/{BotManage-CNZfkmIJ.js → BotManage-CfH6RaDx.js} +1 -1
  10. package/public/assets/{BotSetupPage-Bcfnysyl.js → BotSetupPage-B9qbCa_P.js} +1 -1
  11. package/public/assets/{ChangelogPage-DpiKKuMW.js → ChangelogPage-CaIv9C_t.js} +1 -1
  12. package/public/assets/{CliReferencePage-3PUTVc7V.js → CliReferencePage-FGtSB-WE.js} +1 -1
  13. package/public/assets/{DeploymentPage-CKZ4SJGu.js → DeploymentPage-BAudG2Tr.js} +1 -1
  14. package/public/assets/{DevWorkflowPage-3C2oScnn.js → DevWorkflowPage-Cg3pznxy.js} +1 -1
  15. package/public/assets/{DeveloperManage-wTnur24N.js → DeveloperManage-7_kw4pfm.js} +1 -1
  16. package/public/assets/{DeveloperSetupPage-BMm9F-Bb.js → DeveloperSetupPage-23Davo01.js} +1 -1
  17. package/public/assets/{DocsLayout-Db02r7be.js → DocsLayout-D3VKB5zJ.js} +1 -1
  18. package/public/assets/{DocsPrimitives-DS0DquzY.js → DocsPrimitives-BiDMVOFl.js} +1 -1
  19. package/public/assets/{EditProjectPage-f_umSRE8.js → EditProjectPage-C6YcYdiz.js} +1 -1
  20. package/public/assets/{EmptyState-CF1knXIb.js → EmptyState-C3yiKdL6.js} +1 -1
  21. package/public/assets/{EnvVariablesPage-BG-6sXnf.js → EnvVariablesPage-lxLwDyYf.js} +1 -1
  22. package/public/assets/{HomePage-Dx-CsXKm.js → HomePage-CMqtLPFH.js} +1 -1
  23. package/public/assets/{InfoRow-DSmNnnLr.js → InfoRow-BzF-Ghcu.js} +1 -1
  24. package/public/assets/{InstallationPage-BNHwwjLf.js → InstallationPage-CelO432V.js} +1 -1
  25. package/public/assets/{LandingPage-D58CYxTa.js → LandingPage-W9ko7DVU.js} +12 -7
  26. package/public/assets/{LocalDevelopmentPage-CyUsNaWH.js → LocalDevelopmentPage-Rs-RJn5-.js} +1 -1
  27. package/public/assets/{LoginPage-BkBq-gI2.js → LoginPage-Bp96JFVD.js} +1 -1
  28. package/public/assets/{MetricBar-CTJw2-TT.js → MetricBar-BQkmuXAL.js} +1 -1
  29. package/public/assets/{NotFoundPage-DQOZcvon.js → NotFoundPage-ZvsZseSi.js} +1 -1
  30. package/public/assets/{OnboardingGuide-CsX3AAYe.js → OnboardingGuide-CDNvxE9_.js} +1 -1
  31. package/public/assets/{PermissionsPage-DV1jB5wk.js → PermissionsPage-CawIrPGc.js} +1 -1
  32. package/public/assets/{PipelineConfigPage-DWTyDQIr.js → PipelineConfigPage-B_wutEEq.js} +1 -1
  33. package/public/assets/{PipelineEditorPage-D3LWtMr2.js → PipelineEditorPage-BSxxF72g.js} +1 -1
  34. package/public/assets/{ProfilePage-BcJ4dzzZ.js → ProfilePage-C-nmN-By.js} +1 -1
  35. package/public/assets/{ProjectDetailPage-CfnwUUSo.js → ProjectDetailPage-LPHSSu7P.js} +1 -1
  36. package/public/assets/{ProjectListPage-CNotLnBe.js → ProjectListPage-C31_Ay4t.js} +1 -1
  37. package/public/assets/{PtyTerminal-BIf7o9cl.js → PtyTerminal-CTqEV7Nd.js} +3 -3
  38. package/public/assets/{QuickAuth-C2UsxqX9.js → QuickAuth-CFK1UL14.js} +1 -1
  39. package/public/assets/{RemoveMemberConfirmDialog-BX3zkPVv.js → RemoveMemberConfirmDialog-C1y2iS_9.js} +1 -1
  40. package/public/assets/{Select-BaCTjbpe.js → Select-BmSEj4-2.js} +1 -1
  41. package/public/assets/{SettingsPage-DwbzfiSN.js → SettingsPage-DggZSPQB.js} +1 -1
  42. package/public/assets/{Skeleton-wnwOeI39.js → Skeleton-B2I8dIUF.js} +1 -1
  43. package/public/assets/{SkillPage-BLEt2rMu.js → SkillPage-CBTxscku.js} +1 -1
  44. package/public/assets/{TaskDetailPage-DtwpHF_O.js → TaskDetailPage-B9zrQxVz.js} +4 -4
  45. package/public/assets/{TaskListPage-sy7iLza2.js → TaskListPage-CLMgzykc.js} +1 -1
  46. package/public/assets/{TaskStatusBadge-Cf0DzE71.js → TaskStatusBadge-D7YtciSI.js} +1 -1
  47. package/public/assets/{TerminalHomePage-BTqi9Axa.js → TerminalHomePage-DS9egsne.js} +2 -2
  48. package/public/assets/{TokenManage-DWMXnCDJ.js → TokenManage-XhEZLm3U.js} +1 -1
  49. package/public/assets/{TotpSetupPage-DHdTMjpN.js → TotpSetupPage-BwXOuC8h.js} +1 -1
  50. package/public/assets/{WorkerDetailPage-YJUVETFW.js → WorkerDetailPage-BidnHWSI.js} +1 -1
  51. package/public/assets/{WorkerListPage-B-D7X_b1.js → WorkerListPage-D9Sx2Qj1.js} +1 -1
  52. package/public/assets/{WorkerOperationsPage-BBxYUgIw.js → WorkerOperationsPage-BVqOPKPL.js} +1 -1
  53. package/public/assets/{WorkerSetupGuidePage-ChzKuXQZ.js → WorkerSetupGuidePage-CisdSN3i.js} +1 -1
  54. package/public/assets/{WorkerSetupPage-B4jlXCjH.js → WorkerSetupPage-D1EfdiQR.js} +1 -1
  55. package/public/assets/{arrow-left-CclYAeLg.js → arrow-left-BhUPkdy5.js} +1 -1
  56. package/public/assets/{arrow-right-BVGnZmSj.js → arrow-right-b1VhePsW.js} +1 -1
  57. package/public/assets/{bot-D9xi44vN.js → bot-3wzbq300.js} +1 -1
  58. package/public/assets/{chevron-right-BagQ0WTS.js → chevron-right-u3Q_FU8D.js} +1 -1
  59. package/public/assets/{copy-CFKtBHG3.js → copy-B1jQ4pbs.js} +1 -1
  60. package/public/assets/{download-CTnOMUpx.js → download-DJCYeset.js} +1 -1
  61. package/public/assets/{external-link-Bdlp6eLv.js → external-link-BlAvfzj2.js} +1 -1
  62. package/public/assets/{index-uDLAla67.js → index-BLXQrTv9.js} +2 -2
  63. package/public/assets/{key-9SBu60Mo.js → key-elqvuBzT.js} +1 -1
  64. package/public/assets/{loader-circle-C3TDU6pb.js → loader-circle-BRMYxZfv.js} +1 -1
  65. package/public/assets/{message-square-CqYt8K2i.js → message-square-CZau8J5h.js} +1 -1
  66. package/public/assets/{pencil-CrcM0dgK.js → pencil-BzyGpI8s.js} +1 -1
  67. package/public/assets/{plus-DnDLd-iP.js → plus-NWcYLEIq.js} +1 -1
  68. package/public/assets/{rotate-ccw-BS27hgv2.js → rotate-ccw-CPStvDV2.js} +1 -1
  69. package/public/assets/{scroll-text-BLE2ARXF.js → scroll-text-FNU4RbjS.js} +1 -1
  70. package/public/assets/{settings-pymAAKeG.js → settings-Vg0cVhzJ.js} +1 -1
  71. package/public/assets/{status-colors-BcGt1oBU.js → status-colors-CNClmRSt.js} +1 -1
  72. package/public/assets/{task-constants-G2j8o2ma.js → task-constants-OK8-vXXs.js} +1 -1
  73. package/public/assets/{trash-2-BmckJ_Dj.js → trash-2-YP06bYAN.js} +1 -1
  74. package/public/assets/{useFetch-DPbqlqsl.js → useFetch-WwlQwbqf.js} +1 -1
  75. package/public/assets/{users-DFQbCvYm.js → users-CFJarfcd.js} +1 -1
  76. package/public/assets/{wifi-DrZKx701.js → wifi-D7sIQnh6.js} +1 -1
  77. package/public/assets/{workflow-DTNRYvFx.js → workflow-Bz54V-O_.js} +1 -1
  78. package/public/index.html +1 -1
  79. package/public/sw.js +1 -1
  80. package/public/assets/zap-D3sq7Jac.js +0 -6
@@ -1 +1 @@
1
- import{a as t,j as e}from"./index-uDLAla67.js";import{I as c,C as r}from"./DocsPrimitives-DS0DquzY.js";import{E as n}from"./external-link-Bdlp6eLv.js";import"./copy-CFKtBHG3.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-BLXQrTv9.js";import{I as c,C as r}from"./DocsPrimitives-BiDMVOFl.js";import{E as n}from"./external-link-BlAvfzj2.js";import"./copy-B1jQ4pbs.js";const o=[{action:"create tasks",desc:"describe what you want done, overlord dispatches to a worker"},{action:"list & monitor tasks",desc:"check status, read execution logs, track progress"},{action:"cancel & retry tasks",desc:"manage task lifecycle"},{action:"confirm pipeline stages",desc:"approve or provide input for suspended stages"},{action:"manage projects",desc:"list projects, view members"},{action:"check cluster health",desc:"see worker status, online workers, queue depth"},{action:"search",desc:"find tasks, projects, and workers by keyword"},{action:"read notifications",desc:"check and clear your notification inbox"}],d=['create a task in project "frontend" to fix the login page styling',"what tasks are running right now?","show me the logs for task 42","how many workers are online?","cancel task 15"],i=[{name:"claude code",url:"https://claude.com/claude-code"},{name:"cursor",url:"https://cursor.com/cli"},{name:"windsurf",url:"https://windsurf.com"},{name:"codex",url:"https://openai.com/codex"}];function u(){t();const a=typeof window<"u"?window.location.origin:"https://your-server";return e.jsxs("div",{className:"mx-auto max-w-4xl px-4 md:px-6 py-8 font-mono lowercase",children:[e.jsx("div",{className:"mb-8",children:e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"// use overlord from your ai coding assistant — claude code, cursor, windsurf, codex, and more. install the skill and your assistant can create tasks, monitor execution, and manage your fleet."})}),e.jsxs("div",{className:"mb-8 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"// install"}),e.jsx(c,{code:"npx skills add overlord-run/skill"})]}),e.jsxs("div",{className:"mb-8 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"// configure — set these environment variables"}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between rounded-[4px] bg-[var(--bg-primary)] px-3 py-2 overflow-x-auto",children:[e.jsxs("code",{className:"text-xs text-[var(--text-primary)] whitespace-nowrap",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"export "}),"OVERLORD_SERVER=",e.jsx("span",{className:"text-[var(--accent)]",children:a})]}),e.jsx(r,{text:`export OVERLORD_SERVER=${a}`})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-[4px] bg-[var(--bg-primary)] px-3 py-2 overflow-x-auto",children:[e.jsxs("code",{className:"text-xs text-[var(--text-primary)] whitespace-nowrap",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"export "}),"OVERLORD_TOKEN=",e.jsx("span",{className:"text-[var(--text-secondary)]",children:"your-token"})]}),e.jsx(r,{text:"export OVERLORD_TOKEN=your-token"})]})]}),e.jsxs("p",{className:"text-[11px] text-[var(--text-muted)]",children:["// create a token at ",e.jsx("a",{href:"/access-tokens",className:"text-[var(--accent)] hover:underline",children:"/access-tokens"})]})]}),e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{className:"mb-4 text-sm text-[var(--accent)]",children:"> capabilities"}),e.jsx("div",{className:"space-y-2",children:o.map(s=>e.jsxs("div",{className:"flex items-start gap-3 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3",children:[e.jsx("span",{className:"shrink-0 text-xs font-medium text-[var(--text-primary)]",children:s.action}),e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["// ",s.desc]})]},s.action))})]}),e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{className:"mb-4 text-sm text-[var(--accent)]",children:"> example usage"}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-2",children:[e.jsx("p",{className:"mb-3 text-xs text-[var(--text-muted)]",children:"// just ask your ai agent naturally"}),d.map(s=>e.jsx("div",{className:"rounded-[4px] bg-[var(--bg-primary)] px-3 py-2",children:e.jsxs("code",{className:"text-xs text-[var(--text-secondary)]",children:[e.jsx("span",{className:"text-[var(--accent)]",children:"> "}),s]})},s))]})]}),e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{className:"mb-4 text-sm text-[var(--accent)]",children:"> compatible tools"}),e.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:i.map(s=>e.jsxs("a",{href:s.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-center gap-1.5 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2.5 text-xs text-[var(--text-primary)] transition-colors hover:border-[var(--accent)]",children:[s.name,e.jsx(n,{className:"h-3 w-3 text-[var(--text-muted)]"})]},s.name))}),e.jsx("p",{className:"mt-2 text-[11px] text-[var(--text-muted)]",children:"// and any ai coding assistant that supports the skills protocol"})]}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["// open source:"," ",e.jsx("a",{href:"https://github.com/overlord-run/skill",target:"_blank",rel:"noopener noreferrer",className:"text-[var(--accent)] hover:underline",children:"github.com/overlord-run/skill"})]})})]})}export{u as default};
@@ -1,4 +1,4 @@
1
- import{c as ee,a as X,r,g as j,j as e,q as D,s as $e,v as Ue,e as qe,m as ze,i as ke,L as Be,X as le,l as K,w as we,t as _e,o as Ge}from"./index-uDLAla67.js";import{u as Ke,T as Xe}from"./task-constants-G2j8o2ma.js";import{C as We,Z as Ce,P as Se}from"./PtyTerminal-BIf7o9cl.js";import{a as Ze,f as Y}from"./date-BdNtiQTP.js";import{M as Ve}from"./message-square-CqYt8K2i.js";import{S as Je}from"./Select-BaCTjbpe.js";import{a as He}from"./status-colors-BcGt1oBU.js";import{A as Qe}from"./arrow-left-CclYAeLg.js";import{R as Ye}from"./rotate-ccw-BS27hgv2.js";import{E as et}from"./external-link-Bdlp6eLv.js";import{L as ce}from"./loader-circle-C3TDU6pb.js";import{Z as Ee}from"./zap-D3sq7Jac.js";/**
1
+ import{c as ee,a as X,r,g as j,j as e,q as D,s as $e,v as Ue,e as qe,m as ze,i as we,L as Be,X as le,l as K,w as _e,t as Ce,o as Ge}from"./index-BLXQrTv9.js";import{u as Ke,T as Xe}from"./task-constants-OK8-vXXs.js";import{C as We,H as Se,P as Ee}from"./PtyTerminal-CTqEV7Nd.js";import{a as Ve,f as Z}from"./date-BdNtiQTP.js";import{M as He}from"./message-square-CZau8J5h.js";import{S as Je}from"./Select-BmSEj4-2.js";import{a as Qe}from"./status-colors-CNClmRSt.js";import{A as Ye}from"./arrow-left-BhUPkdy5.js";import{R as ce}from"./rotate-ccw-CPStvDV2.js";import{E as Ze}from"./external-link-BlAvfzj2.js";import{L as ie}from"./loader-circle-BRMYxZfv.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -8,14 +8,14 @@ import{c as ee,a as X,r,g as j,j as e,q as D,s as $e,v as Ue,e as qe,m as ze,i a
8
8
  *
9
9
  * This source code is licensed under the ISC license.
10
10
  * See the LICENSE file in the root directory of this source tree.
11
- */const tt=ee("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
11
+ */const et=ee("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
12
12
  * @license lucide-react v0.469.0 - ISC
13
13
  *
14
14
  * This source code is licensed under the ISC license.
15
15
  * See the LICENSE file in the root directory of this source tree.
16
- */const st=ee("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
16
+ */const tt=ee("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
17
17
  * @license lucide-react v0.469.0 - ISC
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 at=ee("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 De({isOpen:i,onClose:x,taskId:a,stageName:n,timeoutSeconds:s,onSubmitted:o}){const{t:l}=X(),[g,_]=r.useState(s),[E,u]=r.useState(!1);r.useEffect(()=>{if(!i)return;_(s);const h=setInterval(()=>{_(N=>N<=1?(clearInterval(h),0):N-1)},1e3);return()=>clearInterval(h)},[i,s]),r.useEffect(()=>{g===0&&i&&x()},[g,i,x]);const C=r.useCallback(async h=>{u(!0);try{await j.post(`web/tasks/${a}/confirm-stage`,{json:{stageName:n,approved:h}}),o==null||o(),x()}catch{}finally{u(!1)}},[a,n,x,o]);return i?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(Ve,{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(We,{className:"h-3.5 w-3.5"}),Ze(g)]})]}),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:l("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:()=>C(!1),children:l("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:()=>C(!0),children:l(E?"tasks.stage_submitting":"tasks.confirm_and_proceed")})]})]})]}):null}function rt(i,x){const a=new Date(i).getTime()-Date.now();if(a<=0)return x("tasks.tunnel_expired");const n=Math.floor(a/36e5),s=Math.floor(a%36e5/6e4);return n>0?x("tasks.tunnel_expires_hm",{h:n,m:s}):x("tasks.tunnel_expires_m",{m:s})}function Ie(i){switch(i){case"CONNECTED":return"var(--accent)";case"STARTING":return"var(--warning)";case"EXPIRED":return"var(--text-muted)";default:return"var(--text-muted)"}}function Le(i,x){switch(i){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(i).toLowerCase()}}function nt({taskId:i,taskFinished:x,compact:a}){const{t:n}=X(),[s,o]=r.useState(D.IDLE),[l,g]=r.useState(null),[_,E]=r.useState(null),[u,C]=r.useState(""),[h,N]=r.useState(!1),[te,I]=r.useState(!1),L=r.useRef(null),$=r.useCallback(async()=>{try{const y=await j.get(`web/workspace-tunnel/${i}/status`).json();o(y.status),g(y.tunnelUrl??null),E(y.expiresAt??null),(y.status==="EXPIRED"||y.status==="IDLE"||y.status==="CLOSED")&&S()}catch{}},[i]);function se(){S(),L.current=setInterval($,5e3)}function S(){L.current&&(clearInterval(L.current),L.current=null)}r.useEffect(()=>{x&&(s===D.STARTING||s===D.CONNECTED)&&(o(D.IDLE),g(null),S())},[x,s]),r.useEffect(()=>{if(s!=="CONNECTED"||!_)return;const y=()=>{const Z=rt(_,n);C(Z),Z===n("tasks.tunnel_expired")&&(o(D.EXPIRED),g(null),S())};y();const A=setInterval(y,3e4);return()=>clearInterval(A)},[s,_]),r.useEffect(()=>()=>S(),[]),r.useEffect(()=>{x||$()},[$,x]);async function f(){N(!0);try{await j.post(`web/workspace-tunnel/${i}/start`),o(D.STARTING),se()}catch{}finally{N(!1)}}async function R(){N(!0);try{await j.post(`web/workspace-tunnel/${i}/stop`),o(D.IDLE),g(null),S()}catch{}finally{N(!1)}}async function W(){l&&(await navigator.clipboard.writeText(l),I(!0),setTimeout(()=>I(!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:"cursor_tunnel:"}),e.jsx("span",{style:{color:Ie(s)},children:Le(s,n)}),(s==="IDLE"||s==="CLOSED"||s==="EXPIRED")&&e.jsx("button",{onClick:f,disabled:h,className:"rounded-[4px] px-2 py-1 text-[var(--info)] disabled:opacity-50",style:{backgroundColor:"rgba(59,130,246,0.12)"},children:n(h?"tasks.tunnel_starting":"tasks.tunnel_start")}),s==="CONNECTED"&&l&&e.jsx("a",{href:l.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:Ie(s)},children:["● ",Le(s,n)]})]}),s==="CONNECTED"&&_&&e.jsxs("p",{className:"mb-2 text-xs text-[var(--text-muted)]",children:["// ",u]}),s==="CONNECTED"&&l&&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:l}),e.jsxs("button",{onClick:W,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"),"]"]})]}),te&&e.jsx("p",{className:"mb-2 text-xs text-[var(--accent)]",children:n("tasks.tunnel_copied")}),s==="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:[(s==="IDLE"||s==="CLOSED")&&e.jsx("button",{onClick:f,disabled:h,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(h?"tasks.tunnel_starting_button":"tasks.tunnel_start_button")}),s==="STARTING"&&e.jsx("button",{onClick:R,disabled:h,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(h?"tasks.tunnel_stopping":"tasks.tunnel_cancel")}),s==="CONNECTED"&&l&&e.jsxs(e.Fragment,{children:[e.jsx("a",{href:l.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:l.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:R,disabled:h,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(h?"tasks.tunnel_stopping":"tasks.tunnel_stop")})]}),s==="EXPIRED"&&e.jsx("button",{onClick:f,disabled:h,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(h?"tasks.tunnel_starting_button":"tasks.tunnel_restart")})]})]})}function lt({isOpen:i,onClose:x,onConfirm:a,taskId:n,isLoading:s}){const{t:o}=X();return e.jsx($e,{isOpen:i,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:s})}function ct({isOpen:i,onClose:x,onConfirm:a,taskId:n,mrUrl:s,isLoading:o}){const{t:l}=X(),g=s?l("tasks.retry_message_with_mr",{id:String(n),url:s}):l("tasks.retry_message_without_mr",{id:String(n)});return e.jsx($e,{isOpen:i,onClose:x,onConfirm:a,title:l("tasks.retry_title"),message:g,confirmLabel:l("tasks.retry_confirm_label"),confirmVariant:"accent",isLoading:o})}function it(i){switch(i){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 ie({status:i}){const x=He(i);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}}),i.toLowerCase()]})}function xt(i){let a=["init","agent","completed"];if(i.configSnapshot)try{const s=JSON.parse(i.configSnapshot);if(s&&typeof s=="object"&&typeof s.pipeline=="string"){const o=JSON.parse(s.pipeline);o&&typeof o=="object"&&Array.isArray(o.stages)&&o.stages.length>0&&o.stages.every(l=>l&&typeof l=="object"&&typeof l.name=="string")&&(a=o.stages.map(l=>l.name))}}catch{}const n=i.currentStage?a.indexOf(i.currentStage):-1;return a.map((s,o)=>{let l="pending";return i.status===K.COMPLETED?l="completed":i.status===K.FAILED&&o<=n?l=o===n?"failed":"completed":n>=0&&(o<n?l="completed":o===n&&(l="running")),{name:s,status:l}})}function yt(){var Ne,ye;const{id:i}=Ue(),x=qe(),{t:a}=X(),n=Ke(t=>t.cancelTask),[s,o]=r.useState(null),[l,g]=r.useState([]),[_,E]=r.useState(!0),[u,C]=r.useState(null),[h,N]=r.useState(!1),[te,I]=r.useState(!1),[L,$]=r.useState(!1),[se,S]=r.useState(!1),[f,R]=r.useState("terminal"),[W,y]=r.useState([]),[A,Z]=r.useState(0),[q,z]=r.useState(0),[B,xe]=r.useState(""),[V,Re]=r.useState(""),[Ae,oe]=r.useState(!1),[Pe,de]=r.useState(!1),[P,me]=r.useState(null),[k,pe]=r.useState("disconnected"),[G,ue]=r.useState("auto"),O=r.useRef(null),he=r.useRef(null),m=Number(i),v=s?Xe.includes(s.status):!1;ze(s?`#${s.id} ${s.description}`:null);const w=r.useCallback(async()=>{try{const t=await j.get(`web/tasks/${m}`).json();o(t)}catch{}},[m]),J=r.useCallback(async()=>{try{const t=await j.get(`web/tasks/${m}/logs`).json();g(t.lines)}catch{}},[m]),F=r.useCallback(async()=>{try{const t=await j.get(`web/tasks/${m}/pending-confirm`).json();C(t.confirm)}catch{C(null)}},[m]),fe=r.useCallback(async()=>{oe(!0);try{const t=new URLSearchParams;t.set("limit","50"),t.set("offset",String(q*50)),B&&t.set("type",B),V&&t.set("search",V);const c=await j.get(`web/tasks/${m}/events?${t}`).json();y(c.events),Z(c.total)}catch{}finally{oe(!1)}},[m,q,B,V]);r.useEffect(()=>{f==="logs"&&fe()},[f,fe]),r.useEffect(()=>{f==="pipeline"&&!v&&j.get(`web/workspaces/${m}`).json().then(me).catch(()=>me(null))},[f,m,v]);const M=ke(t=>t.lastEvent),ve=ke(t=>t.eventSeq);r.useEffect(()=>{E(!0),Promise.all([w(),J(),F()]).finally(()=>E(!1))},[w,J,F]),r.useEffect(()=>{!M||ve===0||(M.event==="task_status_changed"&&M.taskId===m||M.event==="task_created"&&M.taskId===m)&&(w(),F())},[ve,M,m,w,F]),r.useEffect(()=>{if(v)return;const c=setInterval(()=>{document.visibilityState!=="hidden"&&Promise.all([w(),J(),F()])},15e3);return()=>clearInterval(c)},[v,w,J,F]);const be=r.useCallback(()=>C(null),[]),H=r.useCallback(()=>{C(null),w()},[w]);async function Oe(){$(!0);try{await n(m),N(!1),await w()}finally{$(!1)}}async function Fe(){S(!0);try{await j.post(`web/tasks/${m}/retry`),I(!1),await w()}finally{S(!1)}}const b=r.useMemo(()=>s?xt(s):[],[s==null?void 0:s.configSnapshot,s==null?void 0:s.currentStage,s==null?void 0:s.status]),ae=b.findIndex(t=>t.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(!s)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 ge=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(Qe,{className:"h-4 w-4"})}),e.jsxs("span",{className:"line-clamp-2 text-sm font-medium text-[var(--text-primary)]",children:["#",s.id," ",s.description]})]}),re=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(ie,{status:s.status}),e.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),e.jsxs(Be,{to:`/projects/${s.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:s.projectKey})]}),s.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: ",e.jsx("span",{className:"text-[var(--text-primary)]",children:s.branch})]})]}),s.mrUrl&&/^https?:\/\//.test(s.mrUrl)&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),e.jsxs("a",{href:s.mrUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-[var(--info)] hover:underline",children:["MR: ",((Ne=s.mrUrl.match(/!?\d+$/))==null?void 0:Ne[0])??"view"]})]})]}),je=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:[!v&&e.jsxs("button",{onClick:()=>N(!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(le,{className:"h-3 w-3"}),a("tasks.cancel_task")]}),s.status===K.FAILED&&e.jsxs("button",{onClick:()=>I(!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(Ye,{className:"h-3 w-3"}),a("tasks.retry_task")]}),s.workerId&&!v&&e.jsxs("button",{onClick:()=>{R("pipeline"),setTimeout(()=>{var t,c;(c=(t=he.current)==null?void 0:t.scrollIntoView)==null||c.call(t,{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(et,{className:"h-3 w-3"}),a("tasks.cursor_tunnel")]})]}),Me=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")}),b.map(t=>{const c=t.status==="completed",d=t.status==="running",p=t.status==="failed";return e.jsxs("div",{className:`flex items-center gap-2 rounded-[4px] px-2 py-1.5 ${d?"bg-[#1a1a1a]":""}`,children:[c&&e.jsx(we,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),d&&e.jsx(ce,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),p&&e.jsx(le,{className:"h-3.5 w-3.5 shrink-0 text-[var(--destructive)]"}),t.status==="pending"&&e.jsx(Te,{className:"h-3.5 w-3.5 shrink-0 text-[#525252]"}),e.jsx("span",{className:"text-xs",style:{color:c?"var(--accent)":d?"#e5e5e5":p?"var(--destructive)":"#525252",fontWeight:d?500:400},children:d?`> ${t.name}`:t.name})]},t.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")}),l.length>0?e.jsx("div",{className:"flex flex-col gap-1.5",children:l.slice(0,8).map((t,c)=>e.jsx("p",{className:"text-[11px] leading-relaxed text-[var(--text-muted)]",children:t},c))}):e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.no_activity")})]})]}),ne=e.jsxs(e.Fragment,{children:[e.jsx(lt,{isOpen:h,onClose:()=>N(!1),onConfirm:Oe,taskId:m,isLoading:L}),e.jsx(ct,{isOpen:te,onClose:()=>I(!1),onConfirm:Fe,taskId:m,mrUrl:s.mrUrl??void 0,isLoading:se})]});return Pe&&f==="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:[re,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:[!v&&G==="auto"&&e.jsxs("button",{onClick:()=>{var t;return(t=O.current)==null?void 0:t.requestTakeover()},className:"flex items-center gap-1.5 rounded-[4px] px-2.5 h-10 md:h-8 text-[11px] font-medium text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:[e.jsx(Ee,{className:"h-3 w-3"}),a("tasks.take_over")]}),!v&&G==="manual"&&e.jsxs("button",{onClick:()=>{var t;return(t=O.current)==null?void 0:t.releaseTakeover()},className:"flex items-center gap-1.5 rounded-[4px] px-2.5 h-10 md:h-8 text-[11px] font-medium text-[var(--accent)]",style:{backgroundColor:"rgba(34,197,94,0.12)"},children:[e.jsx(Ce,{className:"h-3 w-3"}),a("tasks.restore_auto")]}),s.currentStage&&e.jsxs("span",{className:"text-[11px] text-[var(--accent)]",children:[a("tasks.stage"),": ",s.currentStage]}),e.jsx("button",{onClick:()=>de(!1),className:"flex items-center rounded-[4px] bg-[var(--bg-card)] px-2.5 py-1 text-[var(--text-muted)]",children:e.jsx(st,{className:"h-3 w-3"})})]})]}),e.jsx("div",{className:"min-h-0 flex-1",children:e.jsx(Se,{ref:O,taskId:m,sessionId:s.currentSessionId??void 0,taskFinished:v,onStatusChange:pe,onTakeoverChange:ue})}),je,ne]}):s.status===K.SUSPENDED?e.jsxs("div",{className:"flex h-full flex-col font-mono lowercase",children:[ge,re,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:["#",s.id]}),e.jsx("span",{className:"text-base text-[var(--text-secondary)]",children:s.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")})}),u&&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:u.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:u.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 j.post(`web/tasks/${m}/confirm-stage`,{json:{stageName:u.stageName,approved:!0}}),H()}catch{_e.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 j.post(`web/tasks/${m}/confirm-stage`,{json:{stageName:u.stageName,approved:!1}}),H()}catch{_e.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:s.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:s.workerName??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"created"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:Y(s.createdAt)})]})]})]}),e.jsx("div",{className:"hidden md:flex flex-wrap items-center gap-2 py-2",children:b.map((t,c)=>{const d=t.status==="failed",p=t.status==="completed",T=t.status==="running"&&s.status===K.SUSPENDED,U=d?"var(--destructive)":p?"var(--accent)":T?"var(--warning)":"#525252",Q=d?"rgba(239,68,68,0.12)":p?"rgba(34,197,94,0.12)":T?"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:Q,fontWeight:T?700:400,border:T?`1px solid ${U}`:void 0},children:T?"confirm":`${t.name}${p?" ✓":d?" ✗":""}`}),c<b.length-1&&e.jsx("div",{className:"h-px w-6 bg-[var(--border)]"})]},t.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:[l.slice(-10).map((t,c)=>e.jsx("p",{className:"text-[11px] leading-relaxed text-[var(--text-secondary)]",children:t},c)),l.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:s.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:s.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:b.map(t=>{const c=t.status==="completed"?"var(--accent)":t.status==="failed"?"var(--destructive)":t.status==="running"?"var(--warning)":"#525252",d=t.status==="failed"?"var(--destructive)":t.status==="running"?"var(--warning)":"#a3a3a3",p=t.status==="completed"?"completed":t.status==="running"?"suspended":t.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:d,fontWeight:t.status==="running"?700:400},children:[t.name," ",p]})]},t.name)})}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsx("div",{className:"flex flex-col gap-1.5 text-[11px]",children:e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"created"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:Y(s.createdAt)})]})})]})]}),u&&e.jsx(De,{isOpen:!!u,onClose:be,taskId:m,stageName:u.stageName,timeoutSeconds:Math.ceil(u.timeout/1e3),onSubmitted:H}),ne]}):e.jsxs("div",{className:"flex h-full flex-col font-mono lowercase",children:[ge,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(ie,{status:s.status}),e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:s.projectKey}),s.workerName&&e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:s.workerName}),s.branch&&e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)] truncate max-w-[120px]",children:s.branch})]}),re,s.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: ",s.errorMessage]}),u&&e.jsx(De,{isOpen:!!u,onClose:be,taskId:m,stageName:u.stageName,timeoutSeconds:Math.ceil(u.timeout/1e3),onSubmitted:H}),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(t=>e.jsx("button",{onClick:()=>R(t),className:`shrink-0 whitespace-nowrap px-4 py-2.5 text-xs transition-colors ${f===t?"border-b-2 border-[var(--accent)] text-[var(--accent)] font-medium":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:a(t==="terminal"?"tasks.terminal":t==="pipeline"?"tasks.pipeline_tab":"tasks.logs")},t))}),f==="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:[!v&&G==="auto"&&e.jsxs("button",{onClick:()=>{var t;return(t=O.current)==null?void 0:t.requestTakeover()},className:"flex items-center gap-1.5 rounded-[4px] px-2.5 h-10 md:h-8 text-[11px] font-medium text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:[e.jsx(Ee,{className:"h-3 w-3"}),a("tasks.take_over")]}),!v&&G==="manual"&&e.jsxs("button",{onClick:()=>{var t;return(t=O.current)==null?void 0:t.releaseTakeover()},className:"flex items-center gap-1.5 rounded-[4px] px-2.5 h-10 md:h-8 text-[11px] font-medium text-[var(--accent)]",style:{backgroundColor:"rgba(34,197,94,0.12)"},children:[e.jsx(Ce,{className:"h-3 w-3"}),a("tasks.restore_auto")]}),!v&&G==="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(ce,{className:"h-3 w-3 animate-spin"}),a("tasks.requesting_takeover")]}),!v&&s.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(at,{className:"h-3 w-3"}),a("tasks.skip_stage")]}),e.jsx("button",{onClick:()=>de(!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(tt,{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(ie,{status:s.status}),s.workerName&&e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["on ",s.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:b.map((t,c)=>{const d=t.status==="completed",p=t.status==="running",U=t.status==="failed"?"var(--destructive)":d||p?"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:p?600:400},children:[t.name,d?" ✓":p?" ...":""]}),c<b.length-1&&e.jsx("div",{className:"mx-1.5 h-px w-4 shrink-0",style:{backgroundColor:U}})]},t.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(Se,{ref:O,taskId:m,sessionId:s.currentSessionId??void 0,taskFinished:v,onStatusChange:pe,onTakeoverChange:ue})}),je]}),f==="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:b.map((t,c)=>{const d=t.status==="completed",p=t.status==="running",Q=t.status==="failed"?"var(--destructive)":d||p?"var(--accent)":"#525252";return e.jsxs("div",{className:"flex items-center",style:{flex:c<b.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:Q},children:[d&&e.jsx("span",{className:"text-[11px] md:text-xs font-semibold text-[#0c0c0c]",children:"✓"}),p&&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:Q},children:t.name})]}),c<b.length-1&&e.jsx("div",{className:"mx-1 md:mx-2 h-0.5 flex-1 min-w-3 rounded-full",style:{backgroundColor:c<(ae>=0?ae:0)?"var(--accent)":"#525252"}})]},t.name)})}),s.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: ",s.currentStage," (",ae+1,"/",b.length,")"]}),s.startedAt&&e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// elapsed: ",Y(s.startedAt).replace(" ago","")]}),e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// retries: ",s.retryCount,"/2"]})]}),e.jsx("button",{onClick:()=>R("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:s.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:s.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:s.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")}),b.map(t=>{const c=t.status==="completed",d=t.status==="running",p=t.status==="failed";return e.jsxs("div",{className:`flex items-center gap-2 rounded-[4px] px-2 py-1.5 ${d?"bg-[var(--bg-input)]":""}`,children:[c&&e.jsx(we,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),d&&e.jsx(ce,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),p&&e.jsx(le,{className:"h-3.5 w-3.5 shrink-0 text-[var(--destructive)]"}),t.status==="pending"&&e.jsx(Te,{className:"h-3.5 w-3.5 shrink-0 text-[#525252]"}),e.jsx("span",{className:"text-xs",style:{color:c?"var(--accent)":d?"var(--text-primary)":p?"var(--destructive)":"#525252",fontWeight:d?500:400},children:d?`> ${t.name}`:t.name})]},t.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")}),l.length>0?e.jsx("div",{className:"flex flex-col gap-1.5",children:l.slice(-12).map((t,c)=>e.jsx("p",{className:"text-[11px] leading-relaxed text-[var(--text-muted)]",children:t},c))}):e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.no_activity")})]})]})]}),f==="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(t=>e.jsx("button",{onClick:()=>{xe(t),z(0)},className:`shrink-0 rounded-[4px] px-2.5 py-1 text-[11px] ${B===t?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)]"}`,children:t||"all"},t))}),e.jsx("div",{className:"hidden md:block",children:e.jsx(Je,{value:B,onChange:t=>{xe(t),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(Ge,{className:"h-3.5 w-3.5 text-[var(--text-muted)]"}),e.jsx("input",{type:"text",placeholder:a("tasks.search_logs"),value:V,onChange:t=>{Re(t.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:[W.map((t,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(t.timestamp).toLocaleTimeString("en-US",{hour12:!1})}),e.jsx("span",{className:`shrink-0 font-medium ${it(t.type)}`,children:t.type}),e.jsx("span",{className:"min-w-0 break-words md:truncate text-[var(--text-primary)]",children:t.message})]},t.id)),W.length===0&&!Ae&&e.jsx("p",{className:"py-8 text-center text-xs text-[var(--text-muted)]",children:a("tasks.no_log_entries")})]}),A>50&&e.jsxs("div",{className:"flex items-center justify-center gap-1",children:[Array.from({length:Math.ceil(A/50)}).slice(0,5).map((t,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(A/50)>5&&e.jsx("button",{onClick:()=>z(q+1),disabled:q>=Math.ceil(A/50)-1,className:"rounded-[4px] px-2 py-1 text-xs text-[var(--text-muted)] disabled:opacity-30",children:">"})]})]})]}),f==="terminal"&&Me,f==="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:s.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:s.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:s.workerName??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"created_at"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:Y(s.createdAt)})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"agent_type"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:s.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 justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"branch"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:s.branch??(P==null?void 0:P.branch)??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"worktree"}),e.jsx("span",{className:"ml-4 truncate text-[var(--text-primary)]",children:(P==null?void 0:P.path)??"-"})]}),s.mrUrl&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"mr_link"}),e.jsx("a",{href:s.mrUrl,target:"_blank",rel:"noopener noreferrer",className:"font-medium text-[var(--info)] hover:underline",children:((ye=s.mrUrl.match(/!?\d+$/))==null?void 0:ye[0])??"view"})]})]})]}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsxs("div",{ref:he,className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[13px] font-semibold text-[var(--accent)]",children:a("tasks.cursor_tunnel_section")}),s.workerId?e.jsx(nt,{taskId:m,taskFinished:v,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:b.map(t=>{const c=t.status==="completed"?"✓":t.status==="running"?"→":"·",d=t.status==="completed"||t.status==="running"?"var(--accent)":t.status==="failed"?"var(--destructive)":"#525252",p=t.status==="completed"?"done":t.status==="running"?"running...":t.status==="failed"?"failed":"pending";return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-semibold",style:{color:d},children:c}),e.jsx("span",{className:t.status==="running"?"font-medium":"",style:{color:d},children:t.name}),e.jsxs("span",{className:"text-[11px]",style:{color:"#525252"},children:["— ",p]})]},t.name)})})]})]})]}),ne]})}export{yt as default};
21
+ */const st=ee("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 De({isOpen:i,onClose:x,taskId:a,stageName:n,timeoutSeconds:s,onSubmitted:o}){const{t:l}=X(),[g,_]=r.useState(s),[E,u]=r.useState(!1);r.useEffect(()=>{if(!i)return;_(s);const h=setInterval(()=>{_(N=>N<=1?(clearInterval(h),0):N-1)},1e3);return()=>clearInterval(h)},[i,s]),r.useEffect(()=>{g===0&&i&&x()},[g,i,x]);const C=r.useCallback(async h=>{u(!0);try{await j.post(`web/tasks/${a}/confirm-stage`,{json:{stageName:n,approved:h}}),o==null||o(),x()}catch{}finally{u(!1)}},[a,n,x,o]);return i?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(He,{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(We,{className:"h-3.5 w-3.5"}),Ve(g)]})]}),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:l("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:()=>C(!1),children:l("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:()=>C(!0),children:l(E?"tasks.stage_submitting":"tasks.confirm_and_proceed")})]})]})]}):null}function at(i,x){const a=new Date(i).getTime()-Date.now();if(a<=0)return x("tasks.tunnel_expired");const n=Math.floor(a/36e5),s=Math.floor(a%36e5/6e4);return n>0?x("tasks.tunnel_expires_hm",{h:n,m:s}):x("tasks.tunnel_expires_m",{m:s})}function Ie(i){switch(i){case"CONNECTED":return"var(--accent)";case"STARTING":return"var(--warning)";case"EXPIRED":return"var(--text-muted)";default:return"var(--text-muted)"}}function Le(i,x){switch(i){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(i).toLowerCase()}}function rt({taskId:i,taskFinished:x,compact:a}){const{t:n}=X(),[s,o]=r.useState(D.IDLE),[l,g]=r.useState(null),[_,E]=r.useState(null),[u,C]=r.useState(""),[h,N]=r.useState(!1),[te,I]=r.useState(!1),L=r.useRef(null),$=r.useCallback(async()=>{try{const y=await j.get(`web/workspace-tunnel/${i}/status`).json();o(y.status),g(y.tunnelUrl??null),E(y.expiresAt??null),(y.status==="EXPIRED"||y.status==="IDLE"||y.status==="CLOSED")&&S()}catch{}},[i]);function se(){S(),L.current=setInterval($,5e3)}function S(){L.current&&(clearInterval(L.current),L.current=null)}r.useEffect(()=>{x&&(s===D.STARTING||s===D.CONNECTED)&&(o(D.IDLE),g(null),S())},[x,s]),r.useEffect(()=>{if(s!=="CONNECTED"||!_)return;const y=()=>{const V=at(_,n);C(V),V===n("tasks.tunnel_expired")&&(o(D.EXPIRED),g(null),S())};y();const A=setInterval(y,3e4);return()=>clearInterval(A)},[s,_]),r.useEffect(()=>()=>S(),[]),r.useEffect(()=>{x||$()},[$,x]);async function f(){N(!0);try{await j.post(`web/workspace-tunnel/${i}/start`),o(D.STARTING),se()}catch{}finally{N(!1)}}async function R(){N(!0);try{await j.post(`web/workspace-tunnel/${i}/stop`),o(D.IDLE),g(null),S()}catch{}finally{N(!1)}}async function W(){l&&(await navigator.clipboard.writeText(l),I(!0),setTimeout(()=>I(!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:"cursor_tunnel:"}),e.jsx("span",{style:{color:Ie(s)},children:Le(s,n)}),(s==="IDLE"||s==="CLOSED"||s==="EXPIRED")&&e.jsx("button",{onClick:f,disabled:h,className:"rounded-[4px] px-2 py-1 text-[var(--info)] disabled:opacity-50",style:{backgroundColor:"rgba(59,130,246,0.12)"},children:n(h?"tasks.tunnel_starting":"tasks.tunnel_start")}),s==="CONNECTED"&&l&&e.jsx("a",{href:l.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:Ie(s)},children:["● ",Le(s,n)]})]}),s==="CONNECTED"&&_&&e.jsxs("p",{className:"mb-2 text-xs text-[var(--text-muted)]",children:["// ",u]}),s==="CONNECTED"&&l&&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:l}),e.jsxs("button",{onClick:W,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"),"]"]})]}),te&&e.jsx("p",{className:"mb-2 text-xs text-[var(--accent)]",children:n("tasks.tunnel_copied")}),s==="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:[(s==="IDLE"||s==="CLOSED")&&e.jsx("button",{onClick:f,disabled:h,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(h?"tasks.tunnel_starting_button":"tasks.tunnel_start_button")}),s==="STARTING"&&e.jsx("button",{onClick:R,disabled:h,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(h?"tasks.tunnel_stopping":"tasks.tunnel_cancel")}),s==="CONNECTED"&&l&&e.jsxs(e.Fragment,{children:[e.jsx("a",{href:l.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:l.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:R,disabled:h,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(h?"tasks.tunnel_stopping":"tasks.tunnel_stop")})]}),s==="EXPIRED"&&e.jsx("button",{onClick:f,disabled:h,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(h?"tasks.tunnel_starting_button":"tasks.tunnel_restart")})]})]})}function nt({isOpen:i,onClose:x,onConfirm:a,taskId:n,isLoading:s}){const{t:o}=X();return e.jsx($e,{isOpen:i,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:s})}function lt({isOpen:i,onClose:x,onConfirm:a,taskId:n,mrUrl:s,isLoading:o}){const{t:l}=X(),g=s?l("tasks.retry_message_with_mr",{id:String(n),url:s}):l("tasks.retry_message_without_mr",{id:String(n)});return e.jsx($e,{isOpen:i,onClose:x,onConfirm:a,title:l("tasks.retry_title"),message:g,confirmLabel:l("tasks.retry_confirm_label"),confirmVariant:"accent",isLoading:o})}function ct(i){switch(i){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 xe({status:i}){const x=Qe(i);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}}),i.toLowerCase()]})}function it(i){let a=["init","agent","completed"];if(i.configSnapshot)try{const s=JSON.parse(i.configSnapshot);if(s&&typeof s=="object"&&typeof s.pipeline=="string"){const o=JSON.parse(s.pipeline);o&&typeof o=="object"&&Array.isArray(o.stages)&&o.stages.length>0&&o.stages.every(l=>l&&typeof l=="object"&&typeof l.name=="string")&&(a=o.stages.map(l=>l.name))}}catch{}const n=i.currentStage?a.indexOf(i.currentStage):-1;return a.map((s,o)=>{let l="pending";return i.status===K.COMPLETED?l="completed":i.status===K.FAILED&&o<=n?l=o===n?"failed":"completed":n>=0&&(o<n?l="completed":o===n&&(l="running")),{name:s,status:l}})}function jt(){var ye,ke;const{id:i}=Ue(),x=qe(),{t:a}=X(),n=Ke(t=>t.cancelTask),[s,o]=r.useState(null),[l,g]=r.useState([]),[_,E]=r.useState(!0),[u,C]=r.useState(null),[h,N]=r.useState(!1),[te,I]=r.useState(!1),[L,$]=r.useState(!1),[se,S]=r.useState(!1),[f,R]=r.useState("terminal"),[W,y]=r.useState([]),[A,V]=r.useState(0),[q,z]=r.useState(0),[B,oe]=r.useState(""),[H,Re]=r.useState(""),[Ae,de]=r.useState(!1),[Pe,me]=r.useState(!1),[P,pe]=r.useState(null),[k,ue]=r.useState("disconnected"),[G,he]=r.useState("auto"),F=r.useRef(null),fe=r.useRef(null),m=Number(i),v=s?Xe.includes(s.status):!1;ze(s?`#${s.id} ${s.description}`:null);const w=r.useCallback(async()=>{try{const t=await j.get(`web/tasks/${m}`).json();o(t)}catch{}},[m]),J=r.useCallback(async()=>{try{const t=await j.get(`web/tasks/${m}/logs`).json();g(t.lines)}catch{}},[m]),O=r.useCallback(async()=>{try{const t=await j.get(`web/tasks/${m}/pending-confirm`).json();C(t.confirm)}catch{C(null)}},[m]),ve=r.useCallback(async()=>{de(!0);try{const t=new URLSearchParams;t.set("limit","50"),t.set("offset",String(q*50)),B&&t.set("type",B),H&&t.set("search",H);const c=await j.get(`web/tasks/${m}/events?${t}`).json();y(c.events),V(c.total)}catch{}finally{de(!1)}},[m,q,B,H]);r.useEffect(()=>{f==="logs"&&ve()},[f,ve]),r.useEffect(()=>{f==="pipeline"&&!v&&j.get(`web/workspaces/${m}`).json().then(pe).catch(()=>pe(null))},[f,m,v]);const M=we(t=>t.lastEvent),be=we(t=>t.eventSeq);r.useEffect(()=>{E(!0),Promise.all([w(),J(),O()]).finally(()=>E(!1))},[w,J,O]),r.useEffect(()=>{!M||be===0||(M.event==="task_status_changed"&&M.taskId===m||M.event==="task_created"&&M.taskId===m)&&(w(),O())},[be,M,m,w,O]),r.useEffect(()=>{if(v)return;const c=setInterval(()=>{document.visibilityState!=="hidden"&&Promise.all([w(),J(),O()])},15e3);return()=>clearInterval(c)},[v,w,J,O]);const ge=r.useCallback(()=>C(null),[]),Q=r.useCallback(()=>{C(null),w()},[w]);async function Fe(){$(!0);try{await n(m),N(!1),await w()}finally{$(!1)}}async function Oe(){S(!0);try{await j.post(`web/tasks/${m}/retry`),I(!1),await w()}finally{S(!1)}}const b=r.useMemo(()=>s?it(s):[],[s==null?void 0:s.configSnapshot,s==null?void 0:s.currentStage,s==null?void 0:s.status]),ae=b.findIndex(t=>t.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(!s)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 je=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(Ye,{className:"h-4 w-4"})}),e.jsxs("span",{className:"line-clamp-2 text-sm font-medium text-[var(--text-primary)]",children:["#",s.id," ",s.description]})]}),re=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(xe,{status:s.status}),e.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),e.jsxs(Be,{to:`/projects/${s.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:s.projectKey})]}),s.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: ",e.jsx("span",{className:"text-[var(--text-primary)]",children:s.branch})]})]}),s.mrUrl&&/^https?:\/\//.test(s.mrUrl)&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),e.jsxs("a",{href:s.mrUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-[var(--info)] hover:underline",children:["MR: ",((ye=s.mrUrl.match(/!?\d+$/))==null?void 0:ye[0])??"view"]})]})]}),Ne=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:[!v&&e.jsxs("button",{onClick:()=>N(!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(le,{className:"h-3 w-3"}),a("tasks.cancel_task")]}),s.status===K.FAILED&&e.jsxs("button",{onClick:()=>I(!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(ce,{className:"h-3 w-3"}),a("tasks.retry_task")]}),s.workerId&&!v&&e.jsxs("button",{onClick:()=>{R("pipeline"),setTimeout(()=>{var t,c;(c=(t=fe.current)==null?void 0:t.scrollIntoView)==null||c.call(t,{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(Ze,{className:"h-3 w-3"}),a("tasks.cursor_tunnel")]})]}),Me=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")}),b.map(t=>{const c=t.status==="completed",d=t.status==="running",p=t.status==="failed";return e.jsxs("div",{className:`flex items-center gap-2 rounded-[4px] px-2 py-1.5 ${d?"bg-[#1a1a1a]":""}`,children:[c&&e.jsx(_e,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),d&&e.jsx(ie,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),p&&e.jsx(le,{className:"h-3.5 w-3.5 shrink-0 text-[var(--destructive)]"}),t.status==="pending"&&e.jsx(Te,{className:"h-3.5 w-3.5 shrink-0 text-[#525252]"}),e.jsx("span",{className:"text-xs",style:{color:c?"var(--accent)":d?"#e5e5e5":p?"var(--destructive)":"#525252",fontWeight:d?500:400},children:d?`> ${t.name}`:t.name})]},t.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")}),l.length>0?e.jsx("div",{className:"flex flex-col gap-1.5",children:l.slice(0,8).map((t,c)=>e.jsx("p",{className:"text-[11px] leading-relaxed text-[var(--text-muted)]",children:t},c))}):e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.no_activity")})]})]}),ne=e.jsxs(e.Fragment,{children:[e.jsx(nt,{isOpen:h,onClose:()=>N(!1),onConfirm:Fe,taskId:m,isLoading:L}),e.jsx(lt,{isOpen:te,onClose:()=>I(!1),onConfirm:Oe,taskId:m,mrUrl:s.mrUrl??void 0,isLoading:se})]});return Pe&&f==="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:[re,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:[!v&&G==="auto"&&e.jsxs("button",{onClick:()=>{var t;return(t=F.current)==null?void 0:t.requestTakeover()},className:"flex items-center gap-1.5 rounded-[4px] px-2.5 h-10 md:h-8 text-[11px] font-medium text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:[e.jsx(Se,{className:"h-3 w-3"}),a("tasks.take_over")]}),!v&&G==="manual"&&e.jsxs("button",{onClick:()=>{var t;return(t=F.current)==null?void 0:t.releaseTakeover()},className:"flex items-center gap-1.5 rounded-[4px] px-2.5 h-10 md:h-8 text-[11px] font-medium text-[var(--accent)]",style:{backgroundColor:"rgba(34,197,94,0.12)"},children:[e.jsx(ce,{className:"h-3 w-3"}),a("tasks.restore_auto")]}),s.currentStage&&e.jsxs("span",{className:"text-[11px] text-[var(--accent)]",children:[a("tasks.stage"),": ",s.currentStage]}),e.jsx("button",{onClick:()=>me(!1),className:"flex items-center rounded-[4px] bg-[var(--bg-card)] px-2.5 py-1 text-[var(--text-muted)]",children:e.jsx(tt,{className:"h-3 w-3"})})]})]}),e.jsx("div",{className:"min-h-0 flex-1",children:e.jsx(Ee,{ref:F,taskId:m,sessionId:s.currentSessionId??void 0,taskFinished:v,onStatusChange:ue,onTakeoverChange:he})}),Ne,ne]}):s.status===K.SUSPENDED?e.jsxs("div",{className:"flex h-full flex-col font-mono lowercase",children:[je,re,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:["#",s.id]}),e.jsx("span",{className:"text-base text-[var(--text-secondary)]",children:s.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")})}),u&&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:u.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:u.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 j.post(`web/tasks/${m}/confirm-stage`,{json:{stageName:u.stageName,approved:!0}}),Q()}catch{Ce.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 j.post(`web/tasks/${m}/confirm-stage`,{json:{stageName:u.stageName,approved:!1}}),Q()}catch{Ce.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:s.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:s.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:Z(s.createdAt)})]})]})]}),e.jsx("div",{className:"hidden md:flex flex-wrap items-center gap-2 py-2",children:b.map((t,c)=>{const d=t.status==="failed",p=t.status==="completed",T=t.status==="running"&&s.status===K.SUSPENDED,U=d?"var(--destructive)":p?"var(--accent)":T?"var(--warning)":"#525252",Y=d?"rgba(239,68,68,0.12)":p?"rgba(34,197,94,0.12)":T?"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:Y,fontWeight:T?700:400,border:T?`1px solid ${U}`:void 0},children:T?"confirm":`${t.name}${p?" ✓":d?" ✗":""}`}),c<b.length-1&&e.jsx("div",{className:"h-px w-6 bg-[var(--border)]"})]},t.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:[l.slice(-10).map((t,c)=>e.jsx("p",{className:"text-[11px] leading-relaxed text-[var(--text-secondary)]",children:t},c)),l.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:s.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:s.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:b.map(t=>{const c=t.status==="completed"?"var(--accent)":t.status==="failed"?"var(--destructive)":t.status==="running"?"var(--warning)":"#525252",d=t.status==="failed"?"var(--destructive)":t.status==="running"?"var(--warning)":"#a3a3a3",p=t.status==="completed"?"completed":t.status==="running"?"suspended":t.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:d,fontWeight:t.status==="running"?700:400},children:[t.name," ",p]})]},t.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:Z(s.createdAt)})]})})]})]}),u&&e.jsx(De,{isOpen:!!u,onClose:ge,taskId:m,stageName:u.stageName,timeoutSeconds:Math.ceil(u.timeout/1e3),onSubmitted:Q}),ne]}):e.jsxs("div",{className:"flex h-full flex-col font-mono lowercase",children:[je,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(xe,{status:s.status}),e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:s.projectKey}),s.workerName&&e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:s.workerName}),s.branch&&e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)] truncate max-w-[120px]",children:s.branch})]}),re,s.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: ",s.errorMessage]}),u&&e.jsx(De,{isOpen:!!u,onClose:ge,taskId:m,stageName:u.stageName,timeoutSeconds:Math.ceil(u.timeout/1e3),onSubmitted:Q}),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(t=>e.jsx("button",{onClick:()=>R(t),className:`shrink-0 whitespace-nowrap px-4 py-2.5 text-xs transition-colors ${f===t?"border-b-2 border-[var(--accent)] text-[var(--accent)] font-medium":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:a(t==="terminal"?"tasks.terminal":t==="pipeline"?"tasks.pipeline_tab":"tasks.logs")},t))}),f==="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:[!v&&G==="auto"&&e.jsxs("button",{onClick:()=>{var t;return(t=F.current)==null?void 0:t.requestTakeover()},className:"flex items-center gap-1.5 rounded-[4px] px-2.5 h-10 md:h-8 text-[11px] font-medium text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:[e.jsx(Se,{className:"h-3 w-3"}),a("tasks.take_over")]}),!v&&G==="manual"&&e.jsxs("button",{onClick:()=>{var t;return(t=F.current)==null?void 0:t.releaseTakeover()},className:"flex items-center gap-1.5 rounded-[4px] px-2.5 h-10 md:h-8 text-[11px] font-medium text-[var(--accent)]",style:{backgroundColor:"rgba(34,197,94,0.12)"},children:[e.jsx(ce,{className:"h-3 w-3"}),a("tasks.restore_auto")]}),!v&&G==="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(ie,{className:"h-3 w-3 animate-spin"}),a("tasks.requesting_takeover")]}),!v&&s.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(st,{className:"h-3 w-3"}),a("tasks.skip_stage")]}),e.jsx("button",{onClick:()=>me(!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(et,{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(xe,{status:s.status}),s.workerName&&e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["on ",s.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:b.map((t,c)=>{const d=t.status==="completed",p=t.status==="running",U=t.status==="failed"?"var(--destructive)":d||p?"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:p?600:400},children:[t.name,d?" ✓":p?" ...":""]}),c<b.length-1&&e.jsx("div",{className:"mx-1.5 h-px w-4 shrink-0",style:{backgroundColor:U}})]},t.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(Ee,{ref:F,taskId:m,sessionId:s.currentSessionId??void 0,taskFinished:v,onStatusChange:ue,onTakeoverChange:he})}),Ne]}),f==="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:b.map((t,c)=>{const d=t.status==="completed",p=t.status==="running",Y=t.status==="failed"?"var(--destructive)":d||p?"var(--accent)":"#525252";return e.jsxs("div",{className:"flex items-center",style:{flex:c<b.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:Y},children:[d&&e.jsx("span",{className:"text-[11px] md:text-xs font-semibold text-[#0c0c0c]",children:"✓"}),p&&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:Y},children:t.name})]}),c<b.length-1&&e.jsx("div",{className:"mx-1 md:mx-2 h-0.5 flex-1 min-w-3 rounded-full",style:{backgroundColor:c<(ae>=0?ae:0)?"var(--accent)":"#525252"}})]},t.name)})}),s.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: ",s.currentStage," (",ae+1,"/",b.length,")"]}),s.startedAt&&e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// elapsed: ",Z(s.startedAt).replace(" ago","")]}),e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// retries: ",s.retryCount,"/2"]})]}),e.jsx("button",{onClick:()=>R("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:s.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:s.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:s.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")}),b.map(t=>{const c=t.status==="completed",d=t.status==="running",p=t.status==="failed";return e.jsxs("div",{className:`flex items-center gap-2 rounded-[4px] px-2 py-1.5 ${d?"bg-[var(--bg-input)]":""}`,children:[c&&e.jsx(_e,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),d&&e.jsx(ie,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),p&&e.jsx(le,{className:"h-3.5 w-3.5 shrink-0 text-[var(--destructive)]"}),t.status==="pending"&&e.jsx(Te,{className:"h-3.5 w-3.5 shrink-0 text-[#525252]"}),e.jsx("span",{className:"text-xs",style:{color:c?"var(--accent)":d?"var(--text-primary)":p?"var(--destructive)":"#525252",fontWeight:d?500:400},children:d?`> ${t.name}`:t.name})]},t.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")}),l.length>0?e.jsx("div",{className:"flex flex-col gap-1.5",children:l.slice(-12).map((t,c)=>e.jsx("p",{className:"text-[11px] leading-relaxed text-[var(--text-muted)]",children:t},c))}):e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.no_activity")})]})]})]}),f==="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(t=>e.jsx("button",{onClick:()=>{oe(t),z(0)},className:`shrink-0 rounded-[4px] px-2.5 py-1 text-[11px] ${B===t?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)]"}`,children:t||"all"},t))}),e.jsx("div",{className:"hidden md:block",children:e.jsx(Je,{value:B,onChange:t=>{oe(t),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(Ge,{className:"h-3.5 w-3.5 text-[var(--text-muted)]"}),e.jsx("input",{type:"text",placeholder:a("tasks.search_logs"),value:H,onChange:t=>{Re(t.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:[W.map((t,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(t.timestamp).toLocaleTimeString("en-US",{hour12:!1})}),e.jsx("span",{className:`shrink-0 font-medium ${ct(t.type)}`,children:t.type}),e.jsx("span",{className:"min-w-0 break-words md:truncate text-[var(--text-primary)]",children:t.message})]},t.id)),W.length===0&&!Ae&&e.jsx("p",{className:"py-8 text-center text-xs text-[var(--text-muted)]",children:a("tasks.no_log_entries")})]}),A>50&&e.jsxs("div",{className:"flex items-center justify-center gap-1",children:[Array.from({length:Math.ceil(A/50)}).slice(0,5).map((t,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(A/50)>5&&e.jsx("button",{onClick:()=>z(q+1),disabled:q>=Math.ceil(A/50)-1,className:"rounded-[4px] px-2 py-1 text-xs text-[var(--text-muted)] disabled:opacity-30",children:">"})]})]})]}),f==="terminal"&&Me,f==="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:s.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:s.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:s.workerName??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"created_at"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:Z(s.createdAt)})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"agent_type"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:s.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 justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"branch"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:s.branch??(P==null?void 0:P.branch)??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"worktree"}),e.jsx("span",{className:"ml-4 truncate text-[var(--text-primary)]",children:(P==null?void 0:P.path)??"-"})]}),s.mrUrl&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"mr_link"}),e.jsx("a",{href:s.mrUrl,target:"_blank",rel:"noopener noreferrer",className:"font-medium text-[var(--info)] hover:underline",children:((ke=s.mrUrl.match(/!?\d+$/))==null?void 0:ke[0])??"view"})]})]})]}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsxs("div",{ref:fe,className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[13px] font-semibold text-[var(--accent)]",children:a("tasks.cursor_tunnel_section")}),s.workerId?e.jsx(rt,{taskId:m,taskFinished:v,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:b.map(t=>{const c=t.status==="completed"?"✓":t.status==="running"?"→":"·",d=t.status==="completed"||t.status==="running"?"var(--accent)":t.status==="failed"?"var(--destructive)":"#525252",p=t.status==="completed"?"done":t.status==="running"?"running...":t.status==="failed"?"failed":"pending";return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-semibold",style:{color:d},children:c}),e.jsx("span",{className:t.status==="running"?"font-medium":"",style:{color:d},children:t.name}),e.jsxs("span",{className:"text-[11px]",style:{color:"#525252"},children:["— ",p]})]},t.name)})})]})]})]}),ne]})}export{jt as default};
@@ -1 +1 @@
1
- import{R as V,e as $,a as F,j as e,u as X,h as Y,r as a,g as R,X as Z,i as ee,n as te,H as se,t as O,l as _,o as re,p as H}from"./index-uDLAla67.js";import{a as ae,u as oe}from"./task-constants-G2j8o2ma.js";import{T as Q}from"./TaskStatusBadge-Cf0DzE71.js";import{f as G}from"./date-BdNtiQTP.js";import{t as ne}from"./string-B39tzdVK.js";import{S as q}from"./Select-BaCTjbpe.js";import{C as le}from"./copy-CFKtBHG3.js";import{E as U}from"./EmptyState-CF1knXIb.js";import{T as W}from"./Skeleton-wnwOeI39.js";import{P as ie}from"./plus-DnDLd-iP.js";import"./status-colors-BcGt1oBU.js";const ce=V.memo(function({task:t}){const m=$(),{t:p}=F(),d=(l,r)=>p(`common.${l}`,{n:r});return e.jsxs("tr",{onClick:()=>m(`/tasks/${t.id}`),className:"cursor-pointer border-b border-[var(--border-row)] transition-colors hover:bg-[var(--bg-input)]",children:[e.jsxs("td",{className:"w-16 py-3 pr-4 font-mono text-xs font-medium text-[var(--text-secondary)] text-right tabular-nums",children:["#",t.id]}),e.jsx("td",{className:"py-3 pr-4 text-sm text-[var(--text-primary)]",children:ne(t.description,80)}),e.jsx("td",{className:"py-3 pr-4",children:e.jsx(Q,{status:t.status})}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:t.projectKey}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:t.developerName??t.creatorName??"-"}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:t.workerName??"—"}),e.jsx("td",{className:"py-3 font-mono text-xs text-[var(--text-muted)]",children:G(t.createdAt,d)})]})});function de({isOpen:n,onClose:t,projects:m,projectsLoading:p,onSubmit:d,isSubmitting:l}){const{t:r}=F();X(o=>o.user);const b=Y(),[i,w]=a.useState(""),[x,h]=a.useState(""),[g,u]=a.useState("feat"),[T,E]=a.useState(""),[I,S]=a.useState(""),[j,v]=a.useState(""),[B,f]=a.useState([]),[K,k]=a.useState("");a.useEffect(()=>{n&&(w(""),h(""),u("feat"),E(""),S(""),v(""),k(""),b&&R.get("admin/developers").json().then(f).catch(()=>f([])))},[n,b]),a.useEffect(()=>{if(!n)return;function o(N){N.key==="Escape"&&t()}return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[n,t]);async function y(o){if(o.preventDefault(),k(""),!i||!x.trim()){k(r("tasks.project_and_description_required"));return}try{await d({projectKey:i,description:x.trim(),workerId:I||void 0,developerId:j?Number(j):void 0,taskType:g,branchSlug:T.trim()||void 0})}catch(N){const z=N instanceof Error?N.message:r("tasks.failed_to_create_task");k(z)}}return n?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 font-mono",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},onClick:o=>{o.target===o.currentTarget&&t()},children:e.jsxs("div",{className:"w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",onClick:o=>o.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-6 py-4",children:[e.jsxs("h2",{className:"text-sm text-[var(--text-primary)]",children:["// ",r("tasks.new_task")]}),e.jsx("button",{onClick:t,className:"text-[var(--text-muted)] transition-colors hover:text-[var(--text-primary)]",children:e.jsx(Z,{className:"h-4 w-4"})})]}),e.jsxs("form",{onSubmit:y,className:"px-6 py-5",children:[e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.project")}),e.jsx(q,{value:i,onChange:w,options:m.map(o=>({value:o.key,label:o.name})),placeholder:r(p?"common.loading":"tasks.select_project"),disabled:p})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.task_type")}),e.jsx(q,{value:g,onChange:u,options:ae})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.task_description")}),e.jsx("textarea",{value:x,onChange:o=>h(o.target.value),placeholder:r("tasks.describe_task_placeholder"),rows:4,className:"w-full resize-none rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.target_worker")}),e.jsx("input",{type:"text",value:I,onChange:o=>S(o.target.value),placeholder:r("tasks.any_able"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.branch_slug")}),e.jsx("input",{type:"text",value:T,onChange:o=>E(o.target.value),placeholder:r("tasks.branch_slug_placeholder"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),b&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.assign_developer")}),e.jsx(q,{value:j,onChange:v,options:B.map(o=>({value:String(o.id),label:o.name})),placeholder:r("tasks.select_developer")})]}),K&&e.jsx("div",{className:"rounded-[4px] bg-[#2a1515] border border-[var(--destructive)]/30 px-3 py-2 text-xs text-[var(--destructive)]",children:K})]}),e.jsxs("div",{className:"mt-6 flex items-center justify-end gap-3",children:[e.jsx("button",{type:"button",onClick:t,className:"rounded-[4px] border border-[var(--border)] bg-transparent px-4 py-2 text-xs text-[var(--text-secondary)] transition-colors hover:text-[var(--text-primary)]",children:r("common.cancel")}),e.jsx("button",{type:"submit",disabled:l||!i||!x.trim(),className:"rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs text-black transition-opacity hover:opacity-90 disabled:opacity-40",children:r(l?"common.creating":"tasks.create_task")})]})]})]})}):null}function xe({isOpen:n,onClose:t,onForceCreate:m,onViewExisting:p,similarTask:d,isLoading:l}){const{t:r}=F();return!d||!n?null:e.jsx("div",{onClick:t,style:{position:"fixed",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},children:e.jsxs("div",{onClick:b=>b.stopPropagation(),style:{width:"100%",maxWidth:"480px",backgroundColor:"var(--bg-card)",border:"1px solid var(--border)",borderRadius:"4px",padding:"1.5rem",fontFamily:"'JetBrains Mono', monospace"},children:[e.jsxs("div",{style:{marginBottom:"1.25rem"},children:[e.jsxs("div",{style:{color:"var(--accent)",fontSize:"0.875rem",fontWeight:600,display:"flex",alignItems:"center",gap:"0.5rem"},children:[e.jsx(le,{style:{width:"1rem",height:"1rem"}}),r("tasks.dedup_title")]}),e.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.7rem",marginTop:"0.25rem"},children:r("tasks.dedup_description")})]}),e.jsxs("div",{style:{marginBottom:"1.25rem",padding:"0.75rem",border:"1px solid var(--border)",borderRadius:"4px",backgroundColor:"var(--bg-primary)"},children:[e.jsxs("div",{style:{color:"var(--text-muted)",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace"},children:["#",d.id," · ",d.status]}),e.jsx("div",{style:{color:"var(--text-primary)",fontSize:"0.75rem",marginTop:"0.375rem",lineHeight:"1.5"},children:d.description})]}),e.jsxs("div",{style:{display:"flex",gap:"0.75rem"},children:[e.jsx("button",{type:"button",onClick:t,disabled:l,className:"text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:border-[var(--text-muted)]",style:{flex:1,padding:"0.5rem",backgroundColor:"transparent",border:"1px solid var(--border)",borderRadius:"4px",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:l?"not-allowed":"pointer",opacity:l?.7:1,transition:"color 0.15s, border-color 0.15s"},children:r("common.cancel")}),e.jsx("button",{type:"button",onClick:()=>p(d.id),style:{flex:1,padding:"0.5rem",backgroundColor:"transparent",color:"var(--text-muted)",border:"1px solid var(--border)",borderRadius:"4px",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:"pointer"},children:r("tasks.view_existing")}),e.jsx("button",{type:"button",onClick:m,disabled:l,style:{flex:1,padding:"0.5rem",backgroundColor:"var(--warning)",color:"#0C0C0C",border:"none",borderRadius:"4px",fontSize:"0.75rem",fontWeight:600,fontFamily:"'JetBrains Mono', monospace",cursor:l?"not-allowed":"pointer",opacity:l?.7:1},children:r(l?"common.creating":"tasks.dedup_create_anyway")})]})]})})}function pe({task:n}){const t=$();return e.jsxs("div",{onClick:()=>t(`/tasks/${n.id}`),className:"cursor-pointer rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 transition-colors active:bg-[var(--bg-input)]",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("span",{className:"text-[11px] text-[var(--text-primary)] leading-tight",style:{wordBreak:"break-word"},children:["#",n.id," ",n.description]}),e.jsx("span",{className:"shrink-0",children:e.jsx(Q,{status:n.status})})]}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-2 text-[11px] text-[var(--text-muted)]",children:[e.jsx("span",{children:G(n.createdAt)}),e.jsx("span",{children:"·"}),e.jsx("span",{children:n.projectKey}),n.workerName&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("span",{children:n.workerName})]})]})]})}const me=[{key:"all",labelKey:"tasks.tab_all"},{key:_.RUNNING,labelKey:"tasks.tab_running"},{key:_.QUEUED,labelKey:"tasks.tab_queued"},{key:_.COMPLETED,labelKey:"tasks.tab_completed"},{key:_.FAILED,labelKey:"tasks.tab_failed"},{key:_.CANCELLED,labelKey:"tasks.tab_cancelled"}],D=20;function Se(){const n=$(),{t}=F(),{tasks:m,loading:p,fetchTasks:d}=oe(),l=ee(s=>s.taskSeq),[r,b]=a.useState("all"),[i,w]=a.useState(""),[x,h]=a.useState(1),[g,u]=a.useState(!1);te(a.useMemo(()=>e.jsxs("button",{onClick:()=>u(!0),className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs font-mono text-black transition-opacity hover:opacity-90",children:[e.jsx(ie,{className:"h-3.5 w-3.5"}),t("tasks.new_task")]}),[t]));const[T,E]=a.useState([]),[I,S]=a.useState(!1),[j,v]=a.useState(!1),[B,f]=a.useState(!1),[K,k]=a.useState(null),[y,o]=a.useState(null);a.useEffect(()=>{const s={limit:String(D)};r!=="all"&&(s.status=r),d(s)},[r,d,l]),a.useEffect(()=>{h(1)},[i]),a.useEffect(()=>{g&&(S(!0),R.get("web/projects").json().then(s=>E(s)).catch(()=>{}).finally(()=>S(!1)))},[g]);const N=a.useCallback(async s=>{v(!0);try{const c=await R.post("web/tasks",{json:{projectKey:s.projectKey,description:s.description,workerId:s.workerId,developerId:s.developerId}}).json();u(!1),n(`/tasks/${c.task.id}`)}catch(c){if(c instanceof se&&c.response.status===409){try{const C=await c.response.json();if(C.confirmRequired){k({id:C.confirmRequired.taskId,description:C.confirmRequired.message,status:"active"}),o(s),u(!1),f(!0);return}}catch{}O.error(t("tasks.similar_task_exists"))}else{const C=c instanceof Error?c.message:String(c);O.error(C)}}finally{v(!1)}},[n]),z=a.useCallback(async()=>{if(y){v(!0);try{const s=await R.post("web/tasks",{json:{projectKey:y.projectKey,description:y.description,workerId:y.workerId,force:!0}}).json();f(!1),n(`/tasks/${s.task.id}`)}finally{v(!1)}}},[y,n]),P=a.useMemo(()=>{if(!i.trim())return m;const s=i.toLowerCase();return m.filter(c=>c.description.toLowerCase().includes(s)||String(c.id).includes(i))},[m,i]),A=Math.max(1,Math.ceil(P.length/D)),M=P.slice((x-1)*D,x*D),L=t(i?"tasks.try_adjusting_search":"tasks.create_first_task"),J=i?void 0:e.jsx("button",{onClick:()=>u(!0),className:"rounded-[4px] bg-[var(--accent)] px-5 py-2 text-[11px] font-bold text-black",children:t("tasks.create_task")});return e.jsxs("div",{className:"mx-auto max-w-6xl px-2 py-4 md:px-4 md:py-6 font-mono",children:[e.jsxs("div",{className:"mb-4 flex flex-col gap-3 md:gap-4 md:flex-row md:items-center",children:[e.jsx("div",{className:"flex items-center gap-1 overflow-x-auto pb-1 md:pb-0 no-scrollbar pr-4 md:pr-0",children:me.map(s=>e.jsx("button",{onClick:()=>b(s.key),className:`shrink-0 rounded-[4px] px-3 py-2 h-10 md:h-8 text-xs transition-colors ${r===s.key?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)] bg-[var(--bg-card)] hover:text-[var(--text-secondary)]"}`,children:t(s.labelKey)},s.key))}),e.jsxs("div",{className:"relative md:ml-auto md:w-64",children:[e.jsx(re,{className:"absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-[var(--text-muted)]"}),e.jsx("input",{type:"text",placeholder:t("tasks.search_tasks"),value:i,onChange:s=>w(s.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] py-1.5 pl-8 pr-3 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"}),i&&e.jsx("button",{onClick:()=>w(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-xs text-[var(--text-muted)] hover:text-[var(--text-secondary)]",children:"x"})]})]}),e.jsx("div",{className:"hidden md:block rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:e.jsxs("table",{className:"w-full text-left",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] text-[11px] font-medium text-[#525252]",children:[e.jsx("th",{className:"w-16 px-4 py-2.5 text-right",children:t("tasks.id")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.description_col")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.status_col")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.project_col")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.assignee")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.worker")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.time")})]})}),e.jsxs("tbody",{children:[p&&M.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"p-4",children:e.jsx(W,{rows:5})})}),!p&&P.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"p-4",children:e.jsx(U,{icon:H,title:t("tasks.no_tasks_found"),description:L,action:J})})}),M.map(s=>e.jsx(ce,{task:s},s.id))]})]})}),e.jsxs("div",{className:"flex flex-col gap-2 md:hidden",children:[p&&M.length===0&&e.jsx("div",{className:"p-4",children:e.jsx(W,{rows:5})}),!p&&P.length===0&&e.jsx(U,{icon:H,title:t("tasks.no_tasks_found"),description:L,action:J}),M.map(s=>e.jsx(pe,{task:s},s.id))]}),A>1&&e.jsxs("div",{className:"mt-6 flex items-center justify-center gap-1",children:[e.jsx("button",{onClick:()=>h(Math.max(1,x-1)),disabled:x===1,className:"rounded-[4px] px-2 py-1 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] disabled:opacity-30 min-w-[44px] min-h-[44px] flex items-center justify-center",children:t("tasks.prev")}),Array.from({length:A},(s,c)=>c+1).map(s=>e.jsx("button",{onClick:()=>h(s),className:`rounded-[4px] px-2.5 py-1 text-xs transition-colors min-w-[44px] min-h-[44px] flex items-center justify-center ${x===s?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:s},s)),e.jsx("button",{onClick:()=>h(Math.min(A,x+1)),disabled:x===A,className:"rounded-[4px] px-2 py-1 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] disabled:opacity-30 min-w-[44px] min-h-[44px] flex items-center justify-center",children:t("common.next")})]}),e.jsx(de,{isOpen:g,onClose:()=>u(!1),projects:T,projectsLoading:I,onSubmit:N,isSubmitting:j}),e.jsx(xe,{isOpen:B,onClose:()=>f(!1),onForceCreate:z,onViewExisting:s=>{f(!1),n(`/tasks/${s}`)},similarTask:K,isLoading:j})]})}export{Se as default};
1
+ import{R as V,e as $,a as F,j as e,u as X,h as Y,r as a,g as R,X as Z,i as ee,n as te,H as se,t as O,l as _,o as re,p as H}from"./index-BLXQrTv9.js";import{a as ae,u as oe}from"./task-constants-OK8-vXXs.js";import{T as Q}from"./TaskStatusBadge-D7YtciSI.js";import{f as G}from"./date-BdNtiQTP.js";import{t as ne}from"./string-B39tzdVK.js";import{S as q}from"./Select-BmSEj4-2.js";import{C as le}from"./copy-B1jQ4pbs.js";import{E as U}from"./EmptyState-C3yiKdL6.js";import{T as W}from"./Skeleton-B2I8dIUF.js";import{P as ie}from"./plus-NWcYLEIq.js";import"./status-colors-CNClmRSt.js";const ce=V.memo(function({task:t}){const m=$(),{t:p}=F(),d=(l,r)=>p(`common.${l}`,{n:r});return e.jsxs("tr",{onClick:()=>m(`/tasks/${t.id}`),className:"cursor-pointer border-b border-[var(--border-row)] transition-colors hover:bg-[var(--bg-input)]",children:[e.jsxs("td",{className:"w-16 py-3 pr-4 font-mono text-xs font-medium text-[var(--text-secondary)] text-right tabular-nums",children:["#",t.id]}),e.jsx("td",{className:"py-3 pr-4 text-sm text-[var(--text-primary)]",children:ne(t.description,80)}),e.jsx("td",{className:"py-3 pr-4",children:e.jsx(Q,{status:t.status})}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:t.projectKey}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:t.developerName??t.creatorName??"-"}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:t.workerName??"—"}),e.jsx("td",{className:"py-3 font-mono text-xs text-[var(--text-muted)]",children:G(t.createdAt,d)})]})});function de({isOpen:n,onClose:t,projects:m,projectsLoading:p,onSubmit:d,isSubmitting:l}){const{t:r}=F();X(o=>o.user);const b=Y(),[i,w]=a.useState(""),[x,h]=a.useState(""),[g,u]=a.useState("feat"),[T,E]=a.useState(""),[I,S]=a.useState(""),[j,v]=a.useState(""),[B,f]=a.useState([]),[K,k]=a.useState("");a.useEffect(()=>{n&&(w(""),h(""),u("feat"),E(""),S(""),v(""),k(""),b&&R.get("admin/developers").json().then(f).catch(()=>f([])))},[n,b]),a.useEffect(()=>{if(!n)return;function o(N){N.key==="Escape"&&t()}return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[n,t]);async function y(o){if(o.preventDefault(),k(""),!i||!x.trim()){k(r("tasks.project_and_description_required"));return}try{await d({projectKey:i,description:x.trim(),workerId:I||void 0,developerId:j?Number(j):void 0,taskType:g,branchSlug:T.trim()||void 0})}catch(N){const z=N instanceof Error?N.message:r("tasks.failed_to_create_task");k(z)}}return n?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 font-mono",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},onClick:o=>{o.target===o.currentTarget&&t()},children:e.jsxs("div",{className:"w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",onClick:o=>o.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-6 py-4",children:[e.jsxs("h2",{className:"text-sm text-[var(--text-primary)]",children:["// ",r("tasks.new_task")]}),e.jsx("button",{onClick:t,className:"text-[var(--text-muted)] transition-colors hover:text-[var(--text-primary)]",children:e.jsx(Z,{className:"h-4 w-4"})})]}),e.jsxs("form",{onSubmit:y,className:"px-6 py-5",children:[e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.project")}),e.jsx(q,{value:i,onChange:w,options:m.map(o=>({value:o.key,label:o.name})),placeholder:r(p?"common.loading":"tasks.select_project"),disabled:p})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.task_type")}),e.jsx(q,{value:g,onChange:u,options:ae})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.task_description")}),e.jsx("textarea",{value:x,onChange:o=>h(o.target.value),placeholder:r("tasks.describe_task_placeholder"),rows:4,className:"w-full resize-none rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.target_worker")}),e.jsx("input",{type:"text",value:I,onChange:o=>S(o.target.value),placeholder:r("tasks.any_able"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.branch_slug")}),e.jsx("input",{type:"text",value:T,onChange:o=>E(o.target.value),placeholder:r("tasks.branch_slug_placeholder"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),b&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.assign_developer")}),e.jsx(q,{value:j,onChange:v,options:B.map(o=>({value:String(o.id),label:o.name})),placeholder:r("tasks.select_developer")})]}),K&&e.jsx("div",{className:"rounded-[4px] bg-[#2a1515] border border-[var(--destructive)]/30 px-3 py-2 text-xs text-[var(--destructive)]",children:K})]}),e.jsxs("div",{className:"mt-6 flex items-center justify-end gap-3",children:[e.jsx("button",{type:"button",onClick:t,className:"rounded-[4px] border border-[var(--border)] bg-transparent px-4 py-2 text-xs text-[var(--text-secondary)] transition-colors hover:text-[var(--text-primary)]",children:r("common.cancel")}),e.jsx("button",{type:"submit",disabled:l||!i||!x.trim(),className:"rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs text-black transition-opacity hover:opacity-90 disabled:opacity-40",children:r(l?"common.creating":"tasks.create_task")})]})]})]})}):null}function xe({isOpen:n,onClose:t,onForceCreate:m,onViewExisting:p,similarTask:d,isLoading:l}){const{t:r}=F();return!d||!n?null:e.jsx("div",{onClick:t,style:{position:"fixed",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},children:e.jsxs("div",{onClick:b=>b.stopPropagation(),style:{width:"100%",maxWidth:"480px",backgroundColor:"var(--bg-card)",border:"1px solid var(--border)",borderRadius:"4px",padding:"1.5rem",fontFamily:"'JetBrains Mono', monospace"},children:[e.jsxs("div",{style:{marginBottom:"1.25rem"},children:[e.jsxs("div",{style:{color:"var(--accent)",fontSize:"0.875rem",fontWeight:600,display:"flex",alignItems:"center",gap:"0.5rem"},children:[e.jsx(le,{style:{width:"1rem",height:"1rem"}}),r("tasks.dedup_title")]}),e.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.7rem",marginTop:"0.25rem"},children:r("tasks.dedup_description")})]}),e.jsxs("div",{style:{marginBottom:"1.25rem",padding:"0.75rem",border:"1px solid var(--border)",borderRadius:"4px",backgroundColor:"var(--bg-primary)"},children:[e.jsxs("div",{style:{color:"var(--text-muted)",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace"},children:["#",d.id," · ",d.status]}),e.jsx("div",{style:{color:"var(--text-primary)",fontSize:"0.75rem",marginTop:"0.375rem",lineHeight:"1.5"},children:d.description})]}),e.jsxs("div",{style:{display:"flex",gap:"0.75rem"},children:[e.jsx("button",{type:"button",onClick:t,disabled:l,className:"text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:border-[var(--text-muted)]",style:{flex:1,padding:"0.5rem",backgroundColor:"transparent",border:"1px solid var(--border)",borderRadius:"4px",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:l?"not-allowed":"pointer",opacity:l?.7:1,transition:"color 0.15s, border-color 0.15s"},children:r("common.cancel")}),e.jsx("button",{type:"button",onClick:()=>p(d.id),style:{flex:1,padding:"0.5rem",backgroundColor:"transparent",color:"var(--text-muted)",border:"1px solid var(--border)",borderRadius:"4px",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:"pointer"},children:r("tasks.view_existing")}),e.jsx("button",{type:"button",onClick:m,disabled:l,style:{flex:1,padding:"0.5rem",backgroundColor:"var(--warning)",color:"#0C0C0C",border:"none",borderRadius:"4px",fontSize:"0.75rem",fontWeight:600,fontFamily:"'JetBrains Mono', monospace",cursor:l?"not-allowed":"pointer",opacity:l?.7:1},children:r(l?"common.creating":"tasks.dedup_create_anyway")})]})]})})}function pe({task:n}){const t=$();return e.jsxs("div",{onClick:()=>t(`/tasks/${n.id}`),className:"cursor-pointer rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 transition-colors active:bg-[var(--bg-input)]",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("span",{className:"text-[11px] text-[var(--text-primary)] leading-tight",style:{wordBreak:"break-word"},children:["#",n.id," ",n.description]}),e.jsx("span",{className:"shrink-0",children:e.jsx(Q,{status:n.status})})]}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-2 text-[11px] text-[var(--text-muted)]",children:[e.jsx("span",{children:G(n.createdAt)}),e.jsx("span",{children:"·"}),e.jsx("span",{children:n.projectKey}),n.workerName&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("span",{children:n.workerName})]})]})]})}const me=[{key:"all",labelKey:"tasks.tab_all"},{key:_.RUNNING,labelKey:"tasks.tab_running"},{key:_.QUEUED,labelKey:"tasks.tab_queued"},{key:_.COMPLETED,labelKey:"tasks.tab_completed"},{key:_.FAILED,labelKey:"tasks.tab_failed"},{key:_.CANCELLED,labelKey:"tasks.tab_cancelled"}],D=20;function Se(){const n=$(),{t}=F(),{tasks:m,loading:p,fetchTasks:d}=oe(),l=ee(s=>s.taskSeq),[r,b]=a.useState("all"),[i,w]=a.useState(""),[x,h]=a.useState(1),[g,u]=a.useState(!1);te(a.useMemo(()=>e.jsxs("button",{onClick:()=>u(!0),className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs font-mono text-black transition-opacity hover:opacity-90",children:[e.jsx(ie,{className:"h-3.5 w-3.5"}),t("tasks.new_task")]}),[t]));const[T,E]=a.useState([]),[I,S]=a.useState(!1),[j,v]=a.useState(!1),[B,f]=a.useState(!1),[K,k]=a.useState(null),[y,o]=a.useState(null);a.useEffect(()=>{const s={limit:String(D)};r!=="all"&&(s.status=r),d(s)},[r,d,l]),a.useEffect(()=>{h(1)},[i]),a.useEffect(()=>{g&&(S(!0),R.get("web/projects").json().then(s=>E(s)).catch(()=>{}).finally(()=>S(!1)))},[g]);const N=a.useCallback(async s=>{v(!0);try{const c=await R.post("web/tasks",{json:{projectKey:s.projectKey,description:s.description,workerId:s.workerId,developerId:s.developerId}}).json();u(!1),n(`/tasks/${c.task.id}`)}catch(c){if(c instanceof se&&c.response.status===409){try{const C=await c.response.json();if(C.confirmRequired){k({id:C.confirmRequired.taskId,description:C.confirmRequired.message,status:"active"}),o(s),u(!1),f(!0);return}}catch{}O.error(t("tasks.similar_task_exists"))}else{const C=c instanceof Error?c.message:String(c);O.error(C)}}finally{v(!1)}},[n]),z=a.useCallback(async()=>{if(y){v(!0);try{const s=await R.post("web/tasks",{json:{projectKey:y.projectKey,description:y.description,workerId:y.workerId,force:!0}}).json();f(!1),n(`/tasks/${s.task.id}`)}finally{v(!1)}}},[y,n]),P=a.useMemo(()=>{if(!i.trim())return m;const s=i.toLowerCase();return m.filter(c=>c.description.toLowerCase().includes(s)||String(c.id).includes(i))},[m,i]),A=Math.max(1,Math.ceil(P.length/D)),M=P.slice((x-1)*D,x*D),L=t(i?"tasks.try_adjusting_search":"tasks.create_first_task"),J=i?void 0:e.jsx("button",{onClick:()=>u(!0),className:"rounded-[4px] bg-[var(--accent)] px-5 py-2 text-[11px] font-bold text-black",children:t("tasks.create_task")});return e.jsxs("div",{className:"mx-auto max-w-6xl px-2 py-4 md:px-4 md:py-6 font-mono",children:[e.jsxs("div",{className:"mb-4 flex flex-col gap-3 md:gap-4 md:flex-row md:items-center",children:[e.jsx("div",{className:"flex items-center gap-1 overflow-x-auto pb-1 md:pb-0 no-scrollbar pr-4 md:pr-0",children:me.map(s=>e.jsx("button",{onClick:()=>b(s.key),className:`shrink-0 rounded-[4px] px-3 py-2 h-10 md:h-8 text-xs transition-colors ${r===s.key?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)] bg-[var(--bg-card)] hover:text-[var(--text-secondary)]"}`,children:t(s.labelKey)},s.key))}),e.jsxs("div",{className:"relative md:ml-auto md:w-64",children:[e.jsx(re,{className:"absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-[var(--text-muted)]"}),e.jsx("input",{type:"text",placeholder:t("tasks.search_tasks"),value:i,onChange:s=>w(s.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] py-1.5 pl-8 pr-3 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"}),i&&e.jsx("button",{onClick:()=>w(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-xs text-[var(--text-muted)] hover:text-[var(--text-secondary)]",children:"x"})]})]}),e.jsx("div",{className:"hidden md:block rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:e.jsxs("table",{className:"w-full text-left",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] text-[11px] font-medium text-[#525252]",children:[e.jsx("th",{className:"w-16 px-4 py-2.5 text-right",children:t("tasks.id")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.description_col")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.status_col")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.project_col")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.assignee")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.worker")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.time")})]})}),e.jsxs("tbody",{children:[p&&M.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"p-4",children:e.jsx(W,{rows:5})})}),!p&&P.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"p-4",children:e.jsx(U,{icon:H,title:t("tasks.no_tasks_found"),description:L,action:J})})}),M.map(s=>e.jsx(ce,{task:s},s.id))]})]})}),e.jsxs("div",{className:"flex flex-col gap-2 md:hidden",children:[p&&M.length===0&&e.jsx("div",{className:"p-4",children:e.jsx(W,{rows:5})}),!p&&P.length===0&&e.jsx(U,{icon:H,title:t("tasks.no_tasks_found"),description:L,action:J}),M.map(s=>e.jsx(pe,{task:s},s.id))]}),A>1&&e.jsxs("div",{className:"mt-6 flex items-center justify-center gap-1",children:[e.jsx("button",{onClick:()=>h(Math.max(1,x-1)),disabled:x===1,className:"rounded-[4px] px-2 py-1 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] disabled:opacity-30 min-w-[44px] min-h-[44px] flex items-center justify-center",children:t("tasks.prev")}),Array.from({length:A},(s,c)=>c+1).map(s=>e.jsx("button",{onClick:()=>h(s),className:`rounded-[4px] px-2.5 py-1 text-xs transition-colors min-w-[44px] min-h-[44px] flex items-center justify-center ${x===s?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:s},s)),e.jsx("button",{onClick:()=>h(Math.min(A,x+1)),disabled:x===A,className:"rounded-[4px] px-2 py-1 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] disabled:opacity-30 min-w-[44px] min-h-[44px] flex items-center justify-center",children:t("common.next")})]}),e.jsx(de,{isOpen:g,onClose:()=>u(!1),projects:T,projectsLoading:I,onSubmit:N,isSubmitting:j}),e.jsx(xe,{isOpen:B,onClose:()=>f(!1),onForceCreate:z,onViewExisting:s=>{f(!1),n(`/tasks/${s}`)},similarTask:K,isLoading:j})]})}export{Se as default};
@@ -1 +1 @@
1
- import{a as l,j as a}from"./index-uDLAla67.js";import{a as r}from"./status-colors-BcGt1oBU.js";const u={QUEUED:"tasks.status_queued",ASSIGNED:"tasks.status_assigned",RUNNING:"tasks.status_running",SUSPENDED:"tasks.status_suspended",COMPLETED:"tasks.status_completed",FAILED:"tasks.status_failed",CANCELLED:"tasks.status_cancelled"};function E({status:s}){const{t:e}=l(),t=u[s],n=t?e(t):s.toLowerCase(),o=r(s);return a.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-xs",style:{color:o},children:[a.jsx("span",{style:{fontSize:"0.6rem"},children:"●"}),n]})}export{E as T};
1
+ import{a as l,j as a}from"./index-BLXQrTv9.js";import{a as r}from"./status-colors-CNClmRSt.js";const u={QUEUED:"tasks.status_queued",ASSIGNED:"tasks.status_assigned",RUNNING:"tasks.status_running",SUSPENDED:"tasks.status_suspended",COMPLETED:"tasks.status_completed",FAILED:"tasks.status_failed",CANCELLED:"tasks.status_cancelled"};function E({status:s}){const{t:e}=l(),t=u[s],n=t?e(t):s.toLowerCase(),o=r(s);return a.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-xs",style:{color:o},children:[a.jsx("span",{style:{fontSize:"0.6rem"},children:"●"}),n]})}export{E as T};
@@ -1,4 +1,4 @@
1
- import{c as G,k as ne,g as I,l as k,a as _,r as i,i as F,m as re,j as e,X as Z,e as ie}from"./index-uDLAla67.js";import{T as O,u as ce,a as R}from"./task-constants-G2j8o2ma.js";import{P as le,Z as oe,C as de}from"./PtyTerminal-BIf7o9cl.js";import{i as L,O as q}from"./OnboardingGuide-CsX3AAYe.js";import{S as P,C as xe}from"./Select-BaCTjbpe.js";import{a as J}from"./status-colors-BcGt1oBU.js";import{a as me}from"./date-BdNtiQTP.js";import{u as Q}from"./useFetch-DPbqlqsl.js";import{P as A}from"./plus-DnDLd-iP.js";import{Z as ue}from"./zap-D3sq7Jac.js";import{W as pe}from"./wifi-DrZKx701.js";import"./chevron-right-BagQ0WTS.js";/**
1
+ import{c as G,k as ne,g as I,l as k,a as _,r as i,i as $,m as re,j as e,X as q,e as ie}from"./index-BLXQrTv9.js";import{T as O,u as ce,a as F}from"./task-constants-OK8-vXXs.js";import{P as le,H as oe,C as de}from"./PtyTerminal-CTqEV7Nd.js";import{i as H,O as J}from"./OnboardingGuide-CDNvxE9_.js";import{S as P,C as xe}from"./Select-BmSEj4-2.js";import{a as Q}from"./status-colors-CNClmRSt.js";import{a as me}from"./date-BdNtiQTP.js";import{u as Y}from"./useFetch-WwlQwbqf.js";import{P as A}from"./plus-NWcYLEIq.js";import{R as ue}from"./rotate-ccw-CPStvDV2.js";import{W as pe}from"./wifi-D7sIQnh6.js";import"./chevron-right-u3Q_FU8D.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -8,4 +8,4 @@ import{c as G,k as ne,g as I,l as k,a as _,r as i,i as F,m as re,j as e,X as Z,e
8
8
  *
9
9
  * This source code is licensed under the ISC license.
10
10
  * See the LICENSE file in the root directory of this source tree.
11
- */const ve=G("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),Y="overlord_home_terminal";function fe(){try{const s=localStorage.getItem(Y);if(s)return JSON.parse(s)}catch{}return{pinnedTaskIds:[],activeTaskId:null}}let K="";function M(s){const a=JSON.stringify(s);a!==K&&(K=a,localStorage.setItem(Y,a))}const W=fe(),be=new Set([k.QUEUED,k.ASSIGNED,k.RUNNING,k.SUSPENDED]);let D=!1;const ge=ne((s,a)=>({pinnedTaskIds:W.pinnedTaskIds,activeTaskId:W.activeTaskId,taskMetas:{},stageConfirm:null,loading:!1,setActiveTask:t=>{s({activeTaskId:t}),M({pinnedTaskIds:a().pinnedTaskIds,activeTaskId:t})},pinTask:t=>{const{pinnedTaskIds:n}=a();if(n.includes(t))return;const o=[...n,t];s({pinnedTaskIds:o}),M({pinnedTaskIds:o,activeTaskId:a().activeTaskId})},unpinTask:t=>{const{pinnedTaskIds:n,activeTaskId:o,taskMetas:x}=a(),r=n.filter(l=>l!==t),m=o===t?r[0]??null:o,{[t]:p,...c}=x;s({pinnedTaskIds:r,activeTaskId:m,taskMetas:c}),M({pinnedTaskIds:r,activeTaskId:m})},loadActiveTasks:async()=>{if(!D){D=!0,s({loading:!0});try{const n=(await I.get("web/tasks",{searchParams:{limit:"30"}}).json()).data.filter(l=>be.has(l.status)),o={};for(const l of n)o[l.id]={id:l.id,description:l.description,status:l.status,projectKey:l.projectKey,currentStage:l.currentStage,currentSessionId:l.currentSessionId};const x=new Set(n.map(l=>l.id)),{pinnedTaskIds:r,activeTaskId:m}=a(),p=[...new Set([...r.filter(l=>x.has(l)),...x])],c=m&&p.includes(m)?m:p[0]??null;s({taskMetas:o,pinnedTaskIds:p,activeTaskId:c}),M({pinnedTaskIds:p,activeTaskId:c})}catch{}finally{D=!1,s({loading:!1})}}},fetchStageConfirm:async t=>{try{const n=await I.get(`web/tasks/${t}/pending-confirm`).json();s({stageConfirm:n.confirm})}catch{s({stageConfirm:null})}},clearStageConfirm:()=>s({stageConfirm:null}),updateTaskMeta:(t,n)=>{const{taskMetas:o}=a(),x=o[t];x&&s({taskMetas:{...o,[t]:{...x,...n}}})}}));function je(){const[s,a]=i.useState(()=>L());i.useEffect(()=>{const n=()=>a(!0);return window.addEventListener("onboarding-dismissed",n),window.addEventListener("storage",()=>a(L())),()=>{window.removeEventListener("onboarding-dismissed",n),window.removeEventListener("storage",n)}},[]);const{data:t}=Q(()=>s?Promise.resolve(null):I.get("web/dashboard/stats").json(),[s]);return s||!t?null:{activeTasks:(t.active_tasks??0)+(t.queued_tasks??0),totalWorkers:t.online_workers??0,totalProjects:t.project_count??0,totalDevelopers:t.developer_count??0}}function ke({taskId:s,confirm:a,onSubmitted:t}){const{t:n}=_(),[o,x]=i.useState(a.timeout),[r,m]=i.useState(!1);i.useEffect(()=>{x(a.timeout);const c=setInterval(()=>{x(l=>l<=1?(clearInterval(c),0):l-1)},1e3);return()=>clearInterval(c)},[a.timeout,a.stageName]);const p=i.useCallback(async c=>{m(!0);try{await I.post(`web/tasks/${s}/confirm-stage`,{json:{stageName:a.stageName,approved:c}}),t()}catch{}finally{m(!1)}},[s,a.stageName,t]);return e.jsxs("div",{className:"flex items-center justify-between gap-2 border-b-2 border-[var(--warning)] bg-[var(--warning)]/10 px-3 py-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(de,{className:"h-3.5 w-3.5 shrink-0 text-[var(--warning)]"}),e.jsxs("span",{className:"truncate text-xs text-[var(--text-primary)]",children:["// stage: ",a.stageName]}),e.jsx("span",{className:"shrink-0 text-xs text-[var(--warning)]",children:me(o)})]}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx("button",{onClick:()=>p(!1),disabled:r,className:"rounded-[4px] border border-[var(--border)] px-2 py-1 text-[11px] text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors disabled:opacity-50",children:n("tasks.reject")}),e.jsx("button",{onClick:()=>p(!0),disabled:r,className:"rounded-[4px] bg-[var(--accent)] px-2 py-1 text-[11px] text-black hover:opacity-90 transition-opacity disabled:opacity-50",children:n(r?"tasks.stage_submitting":"tasks.confirm_and_proceed")})]})]})}function Ne({projectKey:s,onProjectChange:a,onCreated:t}){const{t:n}=_(),o=ce(h=>h.createTask),[x,r]=i.useState(""),[m,p]=i.useState("feat"),[c,l]=i.useState(!1),[f,T]=i.useState(!1),{data:N}=Q(()=>I.get("web/projects").json(),[]),g=i.useMemo(()=>{const h=(N??[]).map(b=>({value:b.key,label:b.key}));return[{value:"",label:n("terminal_home.all_projects")},...h]},[N,n]),S=i.useRef(!1);i.useEffect(()=>{if(!S.current){if(s){S.current=!0;return}g.length>1&&(a(g[1].value),S.current=!0)}},[s,g,a]);const C=!!s&&!!x.trim();async function y(){if(C){l(!0);try{const h=await o({projectKey:s,description:x.trim(),taskType:m});r(""),t(h.id)}catch{}finally{l(!1)}}}const j="flex-1 rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-2 py-1.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden md:flex items-center gap-2 border-b border-[var(--border)] bg-[var(--bg-card)] px-3 py-2",children:[e.jsx("div",{className:"w-[140px]",children:e.jsx(P,{value:s,onChange:a,options:g,placeholder:n("terminal_home.select_project")})}),e.jsx("div",{className:"w-[100px]",children:e.jsx(P,{value:m,onChange:p,options:R})}),e.jsx("input",{type:"text",value:x,onChange:h=>r(h.target.value),onKeyDown:h=>h.key==="Enter"&&y(),placeholder:n("terminal_home.task_description_placeholder"),className:j,disabled:c}),e.jsxs("button",{onClick:y,disabled:c||!C,className:"flex items-center gap-1 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",children:[e.jsx(A,{className:"h-3 w-3"}),n(c?"common.creating":"terminal_home.new_task")]})]}),e.jsx("div",{className:"md:hidden border-b border-[var(--border)] bg-[var(--bg-card)]",children:f?e.jsxs("div",{className:"flex flex-col gap-2 p-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex-1",children:e.jsx(P,{value:s,onChange:a,options:g,placeholder:n("terminal_home.select_project")})}),e.jsx("div",{className:"w-[100px]",children:e.jsx(P,{value:m,onChange:p,options:R})}),e.jsx("button",{onClick:()=>T(!1),className:"p-1 text-[var(--text-muted)]",children:e.jsx(Z,{className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",value:x,onChange:h=>r(h.target.value),onKeyDown:h=>h.key==="Enter"&&y(),placeholder:n("terminal_home.task_description_placeholder"),className:j,disabled:c}),e.jsx("button",{onClick:y,disabled:c||!C,className:"rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",children:e.jsx(A,{className:"h-3 w-3"})})]})]}):e.jsxs("button",{onClick:()=>T(!0),className:"flex w-full items-center justify-center gap-1 py-2 text-xs text-[var(--accent)] hover:opacity-80",children:[e.jsx(A,{className:"h-3.5 w-3.5"}),n("terminal_home.new_task")]})})]})}function z({status:s,size:a}){const t=s===k.SUSPENDED,n=J(s),o=a==="sm"?"h-1.5 w-1.5":"h-2 w-2";return e.jsx("span",{className:`${o} shrink-0 rounded-full ${t?"animate-pulse":""}`,style:{backgroundColor:t?"var(--warning)":n}})}function ye({tasks:s,activeId:a,onSelect:t,onUnpin:n,children:o}){const x=ie();return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden md:flex flex-col border-r border-[var(--border)] bg-[var(--bg-card)] overflow-y-auto",style:{width:200,minWidth:200},children:[e.jsx("div",{className:"border-b border-[var(--border)] px-3 py-2",children:e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:"// active tasks"})}),s.length===0?e.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:"no active tasks"})}):e.jsx("div",{className:"flex-1",children:s.map(r=>{const m=r.id===a;return e.jsxs("div",{onClick:()=>t(r.id),className:`group flex items-center gap-2 px-3 py-2 cursor-pointer transition-colors ${m?"bg-[var(--accent)]/10 text-[var(--text-primary)]":"text-[var(--text-secondary)] hover:bg-[var(--bg-input)] hover:text-[var(--text-primary)]"}`,children:[e.jsx(z,{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(Z,{className:"h-3 w-3"})}),e.jsx("button",{onClick:p=>{p.stopPropagation(),x(`/tasks/${r.id}`)},className:"hidden group-hover:block shrink-0 p-0.5 text-[var(--text-muted)] hover:text-[var(--accent)]",title:"open detail",children:e.jsx("span",{className:"text-[10px]",children:"→"})})]},r.id)})})]}),e.jsxs("div",{className:"flex flex-col md:hidden",children:[e.jsx("div",{className:"flex items-center gap-1 overflow-x-auto no-scrollbar border-b border-[var(--border)] bg-[var(--bg-card)] px-2",style:{height:44},children:s.length===0?e.jsx("div",{className:"flex items-center justify-center w-full",children:e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:"no active tasks"})}):s.map(r=>{const m=r.id===a;return e.jsxs("button",{onClick:()=>t(r.id),className:`flex shrink-0 items-center gap-1.5 px-3 border-b-2 transition-colors ${m?"border-[var(--accent)] text-[var(--text-primary)]":"border-transparent text-[var(--text-secondary)]"}`,style:{height:44},children:[e.jsx(z,{status:r.status,size:"sm"}),e.jsxs("span",{className:"text-[11px] whitespace-nowrap",children:["#",r.id]})]},r.id)})}),o]})]})}function we({task:s,takeoverState:a,onTakeover:t,onRelease:n}){const o=J(s.status),x=a==="manual";return e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] bg-[var(--bg-card)] px-3",style:{height:36,minHeight:36},children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:s.projectKey}),e.jsx("span",{className:"text-[11px]",style:{color:o},children:s.status.toLowerCase()}),s.currentStage&&e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["// ",s.currentStage]})]}),e.jsx("div",{className:"flex items-center gap-1",children:!O.includes(s.status)&&(x?e.jsxs("button",{onClick:n,className:"flex items-center gap-1 rounded-[4px] border border-[var(--accent)] px-2 py-0.5 text-[11px] text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors",children:[e.jsx(oe,{className:"h-3 w-3"}),e.jsx("span",{className:"hidden md:inline",children:"release"})]}):e.jsxs("button",{onClick:t,disabled:a==="requesting",className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2 py-0.5 text-[11px] text-[var(--text-secondary)] hover:text-[var(--accent)] hover:border-[var(--accent)] transition-colors disabled:opacity-50",children:[e.jsx(ue,{className:"h-3 w-3"}),e.jsx("span",{className:"hidden md:inline",children:"take over"})]}))})]})}function Te({task:s,ptyStatus:a}){const t=a==="connected";return e.jsxs("div",{className:"flex items-center justify-between border-t border-[var(--border)] bg-[var(--bg-card)] px-3",style:{height:28,minHeight:28},children:[e.jsx("span",{className:"text-[10px] text-[var(--text-muted)]",children:s.currentStage?`stage: ${s.currentStage}`:`task #${s.id}`}),e.jsxs("span",{className:`flex items-center gap-1 text-[10px] ${t?"text-[var(--accent)]":"text-[var(--text-muted)]"}`,children:[t?e.jsx(pe,{className:"h-2.5 w-2.5"}):e.jsx(ve,{className:"h-2.5 w-2.5"}),t?"connected":a]})]})}function B({onboardingData:s}){const[a,t]=i.useState(!1),{t:n}=_();return s?a?e.jsxs("div",{className:"border-b border-[var(--accent)]/30",children:[e.jsxs("button",{onClick:()=>t(!1),className:"flex w-full items-center justify-between bg-[var(--bg-card)] px-3 py-1.5 transition-colors hover:bg-[var(--bg-input)]",children:[e.jsx("span",{className:"text-[11px] text-[var(--accent)]",children:n("onboarding.getting_started")}),e.jsx(he,{className:"h-3 w-3 text-[var(--text-muted)]"})]}),e.jsx("div",{className:"max-h-[300px] overflow-y-auto",children:e.jsx(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(xe,{className:"h-3 w-3 text-[var(--text-muted)]"})]}):null}function H({onboardingData:s}){const{t:a}=_();return e.jsx("div",{className:"flex flex-1 flex-col items-center justify-center p-6",children:s?e.jsx("div",{className:"w-full max-w-lg",children:e.jsx(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 Fe(){const{t:s}=_(),{pinnedTaskIds:a,activeTaskId:t,taskMetas:n,stageConfirm:o,loading:x,setActiveTask:r,pinTask:m,unpinTask:p,loadActiveTasks:c,fetchStageConfirm:l,clearStageConfirm:f,updateTaskMeta:T}=ge(),N=i.useRef(null),[g,S]=i.useState("disconnected"),[C,y]=i.useState("auto"),[j,h]=i.useState(""),b=F(d=>d.lastEvent),U=F(d=>d.status),u=t?n[t]??null:null,V=u?O.includes(u.status):!1,$=i.useRef(!1);i.useEffect(()=>{!$.current&&u&&(h(u.projectKey),$.current=!0)},[u]);const w=i.useMemo(()=>{const d=a.map(v=>n[v]).filter(Boolean);return j?d.filter(v=>v.projectKey===j):d},[a,n,j]);i.useEffect(()=>{w.length>0&&t&&!w.some(d=>d.id===t)&&r(w[0].id)},[w,t,r]);const E=je();re(u?`#${u.id} ${u.description}`:null),i.useEffect(()=>{c()},[c]),i.useEffect(()=>{t&&(u==null?void 0:u.status)===k.SUSPENDED?l(t):f()},[t,u==null?void 0:u.status,l,f]),i.useEffect(()=>{if(b){if(b.event==="task_status_changed"){const{taskId:d,status:v}=b;T(d,{status:v}),v===k.SUSPENDED&&d===t&&l(d),O.includes(v)&&d===t&&f()}b.event==="task_created"&&c()}},[b,t,l,f,T,c]),i.useEffect(()=>{if(U==="connected")return;const v=setInterval(()=>{document.visibilityState!=="hidden"&&c()},15e3);return()=>clearInterval(v)},[U,c]);const X=i.useCallback(d=>{m(d),r(d),c()},[m,r,c]),ee=i.useCallback(()=>{f(),c()},[f,c]),te=i.useCallback(()=>{var d;(d=N.current)==null||d.requestTakeover()},[]),se=i.useCallback(()=>{var d;(d=N.current)==null||d.releaseTakeover()},[]);if(x&&a.length===0)return e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:s("common.loading")})});const ae=w.length>0;return e.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsx(Ne,{projectKey:j,onProjectChange:h,onCreated:X}),e.jsx("div",{className:"flex flex-1 overflow-hidden",children:ae?e.jsxs(e.Fragment,{children:[e.jsx(ye,{tasks:w,activeId:t,onSelect:r,onUnpin:p,children:e.jsx("div",{className:"md:hidden",children:e.jsx(B,{onboardingData:E})})}),e.jsx("div",{className:"flex flex-1 flex-col overflow-hidden",children:u?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden md:block",children:e.jsx(B,{onboardingData:E})}),e.jsx(we,{task:u,takeoverState:C,onTakeover:te,onRelease:se}),o&&t&&e.jsx(ke,{taskId:t,confirm:o,onSubmitted:ee}),e.jsx("div",{className:"flex-1 min-h-[300px] overflow-hidden",children:e.jsx(le,{taskId:t,sessionId:u.currentSessionId??void 0,taskFinished:V,onStatusChange:S,onTakeoverChange:y,ref:N},t)}),e.jsx(Te,{task:u,ptyStatus:g})]}):e.jsx(H,{onboardingData:E})})]}):e.jsx(H,{onboardingData:E})})]})}export{Fe as default};
11
+ */const ve=G("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),V="overlord_home_terminal";function fe(){try{const s=localStorage.getItem(V);if(s)return JSON.parse(s)}catch{}return{pinnedTaskIds:[],activeTaskId:null}}let L="";function M(s){const a=JSON.stringify(s);a!==L&&(L=a,localStorage.setItem(V,a))}const K=fe(),be=new Set([k.QUEUED,k.ASSIGNED,k.RUNNING,k.SUSPENDED]);let D=!1;const ge=ne((s,a)=>({pinnedTaskIds:K.pinnedTaskIds,activeTaskId:K.activeTaskId,taskMetas:{},stageConfirm:null,loading:!1,setActiveTask:t=>{s({activeTaskId:t}),M({pinnedTaskIds:a().pinnedTaskIds,activeTaskId:t})},pinTask:t=>{const{pinnedTaskIds:n}=a();if(n.includes(t))return;const o=[...n,t];s({pinnedTaskIds:o}),M({pinnedTaskIds:o,activeTaskId:a().activeTaskId})},unpinTask:t=>{const{pinnedTaskIds:n,activeTaskId:o,taskMetas:x}=a(),r=n.filter(l=>l!==t),m=o===t?r[0]??null:o,{[t]:p,...c}=x;s({pinnedTaskIds:r,activeTaskId:m,taskMetas:c}),M({pinnedTaskIds:r,activeTaskId:m})},loadActiveTasks:async()=>{if(!D){D=!0,s({loading:!0});try{const n=(await I.get("web/tasks",{searchParams:{limit:"30"}}).json()).data.filter(l=>be.has(l.status)),o={};for(const l of n)o[l.id]={id:l.id,description:l.description,status:l.status,projectKey:l.projectKey,currentStage:l.currentStage,currentSessionId:l.currentSessionId};const x=new Set(n.map(l=>l.id)),{pinnedTaskIds:r,activeTaskId:m}=a(),p=[...new Set([...r.filter(l=>x.has(l)),...x])],c=m&&p.includes(m)?m:p[0]??null;s({taskMetas:o,pinnedTaskIds:p,activeTaskId:c}),M({pinnedTaskIds:p,activeTaskId:c})}catch{}finally{D=!1,s({loading:!1})}}},fetchStageConfirm:async t=>{try{const n=await I.get(`web/tasks/${t}/pending-confirm`).json();s({stageConfirm:n.confirm})}catch{s({stageConfirm:null})}},clearStageConfirm:()=>s({stageConfirm:null}),updateTaskMeta:(t,n)=>{const{taskMetas:o}=a(),x=o[t];x&&s({taskMetas:{...o,[t]:{...x,...n}}})}}));function je(){const[s,a]=i.useState(()=>H());i.useEffect(()=>{const n=()=>a(!0);return window.addEventListener("onboarding-dismissed",n),window.addEventListener("storage",()=>a(H())),()=>{window.removeEventListener("onboarding-dismissed",n),window.removeEventListener("storage",n)}},[]);const{data:t}=Y(()=>s?Promise.resolve(null):I.get("web/dashboard/stats").json(),[s]);return s||!t?null:{activeTasks:(t.active_tasks??0)+(t.queued_tasks??0),totalWorkers:t.online_workers??0,totalProjects:t.project_count??0,totalDevelopers:t.developer_count??0}}function ke({taskId:s,confirm:a,onSubmitted:t}){const{t:n}=_(),[o,x]=i.useState(a.timeout),[r,m]=i.useState(!1);i.useEffect(()=>{x(a.timeout);const c=setInterval(()=>{x(l=>l<=1?(clearInterval(c),0):l-1)},1e3);return()=>clearInterval(c)},[a.timeout,a.stageName]);const p=i.useCallback(async c=>{m(!0);try{await I.post(`web/tasks/${s}/confirm-stage`,{json:{stageName:a.stageName,approved:c}}),t()}catch{}finally{m(!1)}},[s,a.stageName,t]);return e.jsxs("div",{className:"flex items-center justify-between gap-2 border-b-2 border-[var(--warning)] bg-[var(--warning)]/10 px-3 py-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(de,{className:"h-3.5 w-3.5 shrink-0 text-[var(--warning)]"}),e.jsxs("span",{className:"truncate text-xs text-[var(--text-primary)]",children:["// stage: ",a.stageName]}),e.jsx("span",{className:"shrink-0 text-xs text-[var(--warning)]",children:me(o)})]}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx("button",{onClick:()=>p(!1),disabled:r,className:"rounded-[4px] border border-[var(--border)] px-2 py-1 text-[11px] text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors disabled:opacity-50",children:n("tasks.reject")}),e.jsx("button",{onClick:()=>p(!0),disabled:r,className:"rounded-[4px] bg-[var(--accent)] px-2 py-1 text-[11px] text-black hover:opacity-90 transition-opacity disabled:opacity-50",children:n(r?"tasks.stage_submitting":"tasks.confirm_and_proceed")})]})]})}function Ne({projectKey:s,onProjectChange:a,onCreated:t}){const{t:n}=_(),o=ce(h=>h.createTask),[x,r]=i.useState(""),[m,p]=i.useState("feat"),[c,l]=i.useState(!1),[f,T]=i.useState(!1),{data:N}=Y(()=>I.get("web/projects").json(),[]),g=i.useMemo(()=>{const h=(N??[]).map(b=>({value:b.key,label:b.key}));return[{value:"",label:n("terminal_home.all_projects")},...h]},[N,n]),S=i.useRef(!1);i.useEffect(()=>{if(!S.current){if(s){S.current=!0;return}g.length>1&&(a(g[1].value),S.current=!0)}},[s,g,a]);const C=!!s&&!!x.trim();async function y(){if(C){l(!0);try{const h=await o({projectKey:s,description:x.trim(),taskType:m});r(""),t(h.id)}catch{}finally{l(!1)}}}const j="flex-1 rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-2 py-1.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden md:flex items-center gap-2 border-b border-[var(--border)] bg-[var(--bg-card)] px-3 py-2",children:[e.jsx("div",{className:"w-[140px]",children:e.jsx(P,{value:s,onChange:a,options:g,placeholder:n("terminal_home.select_project")})}),e.jsx("div",{className:"w-[100px]",children:e.jsx(P,{value:m,onChange:p,options:F})}),e.jsx("input",{type:"text",value:x,onChange:h=>r(h.target.value),onKeyDown:h=>h.key==="Enter"&&y(),placeholder:n("terminal_home.task_description_placeholder"),className:j,disabled:c}),e.jsxs("button",{onClick:y,disabled:c||!C,className:"flex items-center gap-1 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",children:[e.jsx(A,{className:"h-3 w-3"}),n(c?"common.creating":"terminal_home.new_task")]})]}),e.jsx("div",{className:"md:hidden border-b border-[var(--border)] bg-[var(--bg-card)]",children:f?e.jsxs("div",{className:"flex flex-col gap-2 p-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex-1",children:e.jsx(P,{value:s,onChange:a,options:g,placeholder:n("terminal_home.select_project")})}),e.jsx("div",{className:"w-[100px]",children:e.jsx(P,{value:m,onChange:p,options:F})}),e.jsx("button",{onClick:()=>T(!1),className:"p-1 text-[var(--text-muted)]",children:e.jsx(q,{className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",value:x,onChange:h=>r(h.target.value),onKeyDown:h=>h.key==="Enter"&&y(),placeholder:n("terminal_home.task_description_placeholder"),className:j,disabled:c}),e.jsx("button",{onClick:y,disabled:c||!C,className:"rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",children:e.jsx(A,{className:"h-3 w-3"})})]})]}):e.jsxs("button",{onClick:()=>T(!0),className:"flex w-full items-center justify-center gap-1 py-2 text-xs text-[var(--accent)] hover:opacity-80",children:[e.jsx(A,{className:"h-3.5 w-3.5"}),n("terminal_home.new_task")]})})]})}function W({status:s,size:a}){const t=s===k.SUSPENDED,n=Q(s),o=a==="sm"?"h-1.5 w-1.5":"h-2 w-2";return e.jsx("span",{className:`${o} shrink-0 rounded-full ${t?"animate-pulse":""}`,style:{backgroundColor:t?"var(--warning)":n}})}function ye({tasks:s,activeId:a,onSelect:t,onUnpin:n,children:o}){const x=ie();return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden md:flex flex-col border-r border-[var(--border)] bg-[var(--bg-card)] overflow-y-auto",style:{width:200,minWidth:200},children:[e.jsx("div",{className:"border-b border-[var(--border)] px-3 py-2",children:e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:"// active tasks"})}),s.length===0?e.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:"no active tasks"})}):e.jsx("div",{className:"flex-1",children:s.map(r=>{const m=r.id===a;return e.jsxs("div",{onClick:()=>t(r.id),className:`group flex items-center gap-2 px-3 py-2 cursor-pointer transition-colors ${m?"bg-[var(--accent)]/10 text-[var(--text-primary)]":"text-[var(--text-secondary)] hover:bg-[var(--bg-input)] hover:text-[var(--text-primary)]"}`,children:[e.jsx(W,{status:r.status,size:"md"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"truncate text-xs",children:["#",r.id," ",r.description]}),e.jsx("div",{className:"text-[10px] text-[var(--text-muted)]",children:r.projectKey})]}),e.jsx("button",{onClick:p=>{p.stopPropagation(),n(r.id)},className:"hidden group-hover:block shrink-0 p-0.5 text-[var(--text-muted)] hover:text-[var(--text-primary)]",title:"unpin",children:e.jsx(q,{className:"h-3 w-3"})}),e.jsx("button",{onClick:p=>{p.stopPropagation(),x(`/tasks/${r.id}`)},className:"hidden group-hover:block shrink-0 p-0.5 text-[var(--text-muted)] hover:text-[var(--accent)]",title:"open detail",children:e.jsx("span",{className:"text-[10px]",children:"→"})})]},r.id)})})]}),e.jsxs("div",{className:"flex flex-col md:hidden",children:[e.jsx("div",{className:"flex items-center gap-1 overflow-x-auto no-scrollbar border-b border-[var(--border)] bg-[var(--bg-card)] px-2",style:{height:44},children:s.length===0?e.jsx("div",{className:"flex items-center justify-center w-full",children:e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:"no active tasks"})}):s.map(r=>{const m=r.id===a;return e.jsxs("button",{onClick:()=>t(r.id),className:`flex shrink-0 items-center gap-1.5 px-3 border-b-2 transition-colors ${m?"border-[var(--accent)] text-[var(--text-primary)]":"border-transparent text-[var(--text-secondary)]"}`,style:{height:44},children:[e.jsx(W,{status:r.status,size:"sm"}),e.jsxs("span",{className:"text-[11px] whitespace-nowrap",children:["#",r.id]})]},r.id)})}),o]})]})}function we({task:s,takeoverState:a,onTakeover:t,onRelease:n}){const o=Q(s.status),x=a==="manual";return e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] bg-[var(--bg-card)] px-3",style:{height:36,minHeight:36},children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:s.projectKey}),e.jsx("span",{className:"text-[11px]",style:{color:o},children:s.status.toLowerCase()}),s.currentStage&&e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["// ",s.currentStage]})]}),e.jsx("div",{className:"flex items-center gap-1",children:!O.includes(s.status)&&(x?e.jsxs("button",{onClick:n,className:"flex items-center gap-1 rounded-[4px] border border-[var(--accent)] px-2 py-0.5 text-[11px] text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors",children:[e.jsx(ue,{className:"h-3 w-3"}),e.jsx("span",{className:"hidden md:inline",children:"release"})]}):e.jsxs("button",{onClick:t,disabled:a==="requesting",className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2 py-0.5 text-[11px] text-[var(--text-secondary)] hover:text-[var(--accent)] hover:border-[var(--accent)] transition-colors disabled:opacity-50",children:[e.jsx(oe,{className:"h-3 w-3"}),e.jsx("span",{className:"hidden md:inline",children:"take over"})]}))})]})}function Te({task:s,ptyStatus:a}){const t=a==="connected";return e.jsxs("div",{className:"flex items-center justify-between border-t border-[var(--border)] bg-[var(--bg-card)] px-3",style:{height:28,minHeight:28},children:[e.jsx("span",{className:"text-[10px] text-[var(--text-muted)]",children:s.currentStage?`stage: ${s.currentStage}`:`task #${s.id}`}),e.jsxs("span",{className:`flex items-center gap-1 text-[10px] ${t?"text-[var(--accent)]":"text-[var(--text-muted)]"}`,children:[t?e.jsx(pe,{className:"h-2.5 w-2.5"}):e.jsx(ve,{className:"h-2.5 w-2.5"}),t?"connected":a]})]})}function z({onboardingData:s}){const[a,t]=i.useState(!1),{t:n}=_();return s?a?e.jsxs("div",{className:"border-b border-[var(--accent)]/30",children:[e.jsxs("button",{onClick:()=>t(!1),className:"flex w-full items-center justify-between bg-[var(--bg-card)] px-3 py-1.5 transition-colors hover:bg-[var(--bg-input)]",children:[e.jsx("span",{className:"text-[11px] text-[var(--accent)]",children:n("onboarding.getting_started")}),e.jsx(he,{className:"h-3 w-3 text-[var(--text-muted)]"})]}),e.jsx("div",{className:"max-h-[300px] overflow-y-auto",children:e.jsx(J,{data:s})})]}):e.jsxs("button",{onClick:()=>t(!0),className:"flex w-full items-center justify-between border-b border-[var(--accent)]/30 bg-[var(--bg-card)] px-3 py-1.5 transition-colors hover:bg-[var(--bg-input)]",style:{height:36},children:[e.jsx("span",{className:"text-[11px] text-[var(--accent)]",children:n("onboarding.getting_started")}),e.jsx(xe,{className:"h-3 w-3 text-[var(--text-muted)]"})]}):null}function B({onboardingData:s}){const{t:a}=_();return e.jsx("div",{className:"flex flex-1 flex-col items-center justify-center p-6",children:s?e.jsx("div",{className:"w-full max-w-lg",children:e.jsx(J,{data:s})}):e.jsxs("div",{className:"text-center",children:[e.jsxs("div",{className:"mb-3 text-3xl text-[var(--border)]",children:[">","_"]}),e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:a("terminal_home.no_active_tasks")}),e.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:a("terminal_home.create_task_hint")})]})})}function $e(){const{t:s}=_(),{pinnedTaskIds:a,activeTaskId:t,taskMetas:n,stageConfirm:o,loading:x,setActiveTask:r,pinTask:m,unpinTask:p,loadActiveTasks:c,fetchStageConfirm:l,clearStageConfirm:f,updateTaskMeta:T}=ge(),N=i.useRef(null),[g,S]=i.useState("disconnected"),[C,y]=i.useState("auto"),[j,h]=i.useState(""),b=$(d=>d.lastEvent),R=$(d=>d.status),u=t?n[t]??null:null,X=u?O.includes(u.status):!1,U=i.useRef(!1);i.useEffect(()=>{!U.current&&u&&(h(u.projectKey),U.current=!0)},[u]);const w=i.useMemo(()=>{const d=a.map(v=>n[v]).filter(Boolean);return j?d.filter(v=>v.projectKey===j):d},[a,n,j]);i.useEffect(()=>{w.length>0&&t&&!w.some(d=>d.id===t)&&r(w[0].id)},[w,t,r]);const E=je();re(u?`#${u.id} ${u.description}`:null),i.useEffect(()=>{c()},[c]),i.useEffect(()=>{t&&(u==null?void 0:u.status)===k.SUSPENDED?l(t):f()},[t,u==null?void 0:u.status,l,f]),i.useEffect(()=>{if(b){if(b.event==="task_status_changed"){const{taskId:d,status:v}=b;T(d,{status:v}),v===k.SUSPENDED&&d===t&&l(d),O.includes(v)&&d===t&&f()}b.event==="task_created"&&c()}},[b,t,l,f,T,c]),i.useEffect(()=>{if(R==="connected")return;const v=setInterval(()=>{document.visibilityState!=="hidden"&&c()},15e3);return()=>clearInterval(v)},[R,c]);const Z=i.useCallback(d=>{m(d),r(d),c()},[m,r,c]),ee=i.useCallback(()=>{f(),c()},[f,c]),te=i.useCallback(()=>{var d;(d=N.current)==null||d.requestTakeover()},[]),se=i.useCallback(()=>{var d;(d=N.current)==null||d.releaseTakeover()},[]);if(x&&a.length===0)return e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:s("common.loading")})});const ae=w.length>0;return e.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsx(Ne,{projectKey:j,onProjectChange:h,onCreated:Z}),e.jsx("div",{className:"flex flex-1 overflow-hidden",children:ae?e.jsxs(e.Fragment,{children:[e.jsx(ye,{tasks:w,activeId:t,onSelect:r,onUnpin:p,children:e.jsx("div",{className:"md:hidden",children:e.jsx(z,{onboardingData:E})})}),e.jsx("div",{className:"flex flex-1 flex-col overflow-hidden",children:u?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden md:block",children:e.jsx(z,{onboardingData:E})}),e.jsx(we,{task:u,takeoverState:C,onTakeover:te,onRelease:se}),o&&t&&e.jsx(ke,{taskId:t,confirm:o,onSubmitted:ee}),e.jsx("div",{className:"flex-1 min-h-[300px] overflow-hidden",children:e.jsx(le,{taskId:t,sessionId:u.currentSessionId??void 0,taskFinished:X,onStatusChange:S,onTakeoverChange:y,ref:N},t)}),e.jsx(Te,{task:u,ptyStatus:g})]}):e.jsx(B,{onboardingData:E})})]}):e.jsx(B,{onboardingData:E})})]})}export{$e as default};