@overlordai/server 1.0.113 → 1.0.114

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 (187) hide show
  1. package/database/migrations/003-chat-bindings-project-key-index.sql +1 -0
  2. package/database/migrations/004-drop-agent-command.sql +2 -0
  3. package/dist/adapters/command-parser.utils.d.ts +45 -0
  4. package/dist/adapters/command-parser.utils.d.ts.map +1 -0
  5. package/dist/adapters/command-parser.utils.js +144 -0
  6. package/dist/adapters/command-parser.utils.js.map +1 -0
  7. package/dist/adapters/help-text.d.ts +2 -0
  8. package/dist/adapters/help-text.d.ts.map +1 -0
  9. package/dist/adapters/help-text.js +24 -0
  10. package/dist/adapters/help-text.js.map +1 -0
  11. package/dist/adapters/lark/lark-message.parser.d.ts +2 -35
  12. package/dist/adapters/lark/lark-message.parser.d.ts.map +1 -1
  13. package/dist/adapters/lark/lark-message.parser.js +12 -162
  14. package/dist/adapters/lark/lark-message.parser.js.map +1 -1
  15. package/dist/adapters/lark/lark.adapter.d.ts +12 -0
  16. package/dist/adapters/lark/lark.adapter.d.ts.map +1 -1
  17. package/dist/adapters/lark/lark.adapter.js +83 -22
  18. package/dist/adapters/lark/lark.adapter.js.map +1 -1
  19. package/dist/adapters/slack/slack-message.parser.d.ts +2 -11
  20. package/dist/adapters/slack/slack-message.parser.d.ts.map +1 -1
  21. package/dist/adapters/slack/slack-message.parser.js +12 -135
  22. package/dist/adapters/slack/slack-message.parser.js.map +1 -1
  23. package/dist/adapters/slack/slack.adapter.d.ts +4 -0
  24. package/dist/adapters/slack/slack.adapter.d.ts.map +1 -1
  25. package/dist/adapters/slack/slack.adapter.js +78 -25
  26. package/dist/adapters/slack/slack.adapter.js.map +1 -1
  27. package/dist/adapters/slack/slack.controller.d.ts.map +1 -1
  28. package/dist/adapters/slack/slack.controller.js +0 -2
  29. package/dist/adapters/slack/slack.controller.js.map +1 -1
  30. package/dist/common/project-validation.d.ts +1 -1
  31. package/dist/common/project-validation.d.ts.map +1 -1
  32. package/dist/common/project-validation.js +1 -9
  33. package/dist/common/project-validation.js.map +1 -1
  34. package/dist/database/repositories/bot.repository.d.ts +4 -0
  35. package/dist/database/repositories/bot.repository.d.ts.map +1 -1
  36. package/dist/database/repositories/bot.repository.js +15 -0
  37. package/dist/database/repositories/bot.repository.js.map +1 -1
  38. package/dist/database/repositories/project.repository.d.ts.map +1 -1
  39. package/dist/database/repositories/project.repository.js +0 -2
  40. package/dist/database/repositories/project.repository.js.map +1 -1
  41. package/dist/database/repositories/task.repository.d.ts +1 -1
  42. package/dist/database/repositories/task.repository.d.ts.map +1 -1
  43. package/dist/database/repositories/task.repository.js +4 -1
  44. package/dist/database/repositories/task.repository.js.map +1 -1
  45. package/dist/dispatcher/cleanup.service.d.ts +5 -0
  46. package/dist/dispatcher/cleanup.service.d.ts.map +1 -1
  47. package/dist/dispatcher/cleanup.service.js +19 -0
  48. package/dist/dispatcher/cleanup.service.js.map +1 -1
  49. package/dist/dispatcher/dispatcher.service.d.ts.map +1 -1
  50. package/dist/dispatcher/dispatcher.service.js +34 -13
  51. package/dist/dispatcher/dispatcher.service.js.map +1 -1
  52. package/dist/dispatcher/dispatcher.types.d.ts +1 -0
  53. package/dist/dispatcher/dispatcher.types.d.ts.map +1 -1
  54. package/dist/dispatcher/scheduler.service.d.ts.map +1 -1
  55. package/dist/dispatcher/scheduler.service.js +13 -2
  56. package/dist/dispatcher/scheduler.service.js.map +1 -1
  57. package/dist/dispatcher/task-creation.service.d.ts.map +1 -1
  58. package/dist/dispatcher/task-creation.service.js +16 -1
  59. package/dist/dispatcher/task-creation.service.js.map +1 -1
  60. package/dist/dispatcher/task-lifecycle.service.d.ts +2 -2
  61. package/dist/dispatcher/task-lifecycle.service.d.ts.map +1 -1
  62. package/dist/dispatcher/task-lifecycle.service.js +16 -8
  63. package/dist/dispatcher/task-lifecycle.service.js.map +1 -1
  64. package/dist/events/event-types.d.ts +1 -0
  65. package/dist/events/event-types.d.ts.map +1 -1
  66. package/dist/notifier/notification-consumer.d.ts +18 -1
  67. package/dist/notifier/notification-consumer.d.ts.map +1 -1
  68. package/dist/notifier/notification-consumer.js +91 -4
  69. package/dist/notifier/notification-consumer.js.map +1 -1
  70. package/dist/notifier/template.service.d.ts +2 -0
  71. package/dist/notifier/template.service.d.ts.map +1 -1
  72. package/dist/notifier/template.service.js +20 -0
  73. package/dist/notifier/template.service.js.map +1 -1
  74. package/dist/web/dashboard.controller.d.ts +1 -1
  75. package/dist/web/dashboard.controller.d.ts.map +1 -1
  76. package/dist/web/dashboard.controller.js +12 -4
  77. package/dist/web/dashboard.controller.js.map +1 -1
  78. package/dist/web/dashboard.service.d.ts +18 -0
  79. package/dist/web/dashboard.service.d.ts.map +1 -1
  80. package/dist/web/dashboard.service.js +78 -8
  81. package/dist/web/dashboard.service.js.map +1 -1
  82. package/dist/web/frame-handlers/progress.handler.d.ts +3 -1
  83. package/dist/web/frame-handlers/progress.handler.d.ts.map +1 -1
  84. package/dist/web/frame-handlers/progress.handler.js +22 -3
  85. package/dist/web/frame-handlers/progress.handler.js.map +1 -1
  86. package/dist/web/project.controller.d.ts +0 -2
  87. package/dist/web/project.controller.d.ts.map +1 -1
  88. package/dist/web/task.controller.d.ts +3 -1
  89. package/dist/web/task.controller.d.ts.map +1 -1
  90. package/dist/web/task.controller.js +7 -5
  91. package/dist/web/task.controller.js.map +1 -1
  92. package/dist/web/web-event.service.d.ts.map +1 -1
  93. package/dist/web/web-event.service.js +1 -0
  94. package/dist/web/web-event.service.js.map +1 -1
  95. package/dist/web/worker-channel.gateway.d.ts.map +1 -1
  96. package/dist/web/worker-channel.gateway.js +1 -1
  97. package/dist/web/worker-channel.gateway.js.map +1 -1
  98. package/package.json +4 -4
  99. package/public/assets/{AccessTokensPage-D_A93EkP.js → AccessTokensPage-B2zkZtaB.js} +1 -1
  100. package/public/assets/{AdminPage-DnmoRibU.js → AdminPage-B-n-9yUY.js} +1 -1
  101. package/public/assets/{ApiReferencePage-8Fvke3MS.js → ApiReferencePage-Dcik4fBN.js} +1 -1
  102. package/public/assets/{ArchitecturePage-Co5G-15M.js → ArchitecturePage-CDgB6NL0.js} +1 -1
  103. package/public/assets/{AuditLogPage-DoaVh4un.js → AuditLogPage-CmxGpu8q.js} +1 -1
  104. package/public/assets/{BindPlatformPage-C2bIjAbT.js → BindPlatformPage-D-7wxMjF.js} +1 -1
  105. package/public/assets/{BotIntegrationPage-BgK7NXyQ.js → BotIntegrationPage-DoD5KbmU.js} +1 -1
  106. package/public/assets/BotManage-DSe8d-gZ.js +6 -0
  107. package/public/assets/{BotSetupPage-BhNhgobr.js → BotSetupPage-BkNF3ug4.js} +1 -1
  108. package/public/assets/{ChangelogPage-CazGvq6Y.js → ChangelogPage-BUAm5LN6.js} +1 -1
  109. package/public/assets/{CliReferencePage-tonM0XBs.js → CliReferencePage-B6-2m7YU.js} +1 -1
  110. package/public/assets/{DeploymentPage-DwifcnIe.js → DeploymentPage-cW2JDGd0.js} +1 -1
  111. package/public/assets/{DevWorkflowPage-DJddffhm.js → DevWorkflowPage-BbNK1Bmy.js} +1 -1
  112. package/public/assets/{DeveloperManage-DwaEFuLo.js → DeveloperManage-BVkSw-WE.js} +2 -2
  113. package/public/assets/{DeveloperSetupPage-DA4BHPuG.js → DeveloperSetupPage-Cf8ehfWm.js} +1 -1
  114. package/public/assets/{DocsIndexPage-C-FZbN8Z.js → DocsIndexPage-BEMGBIkx.js} +1 -1
  115. package/public/assets/{DocsLayout-HdiVoWKl.js → DocsLayout-BLcuuadd.js} +1 -1
  116. package/public/assets/{DocsPrimitives-DU41lKXb.js → DocsPrimitives-BEIQH4P7.js} +1 -1
  117. package/public/assets/EditProjectPage-RsYg77Bf.js +2 -0
  118. package/public/assets/{EmptyState-i9jXL5NQ.js → EmptyState-D8UwaoPs.js} +1 -1
  119. package/public/assets/{EnvVariablesPage-DofRDtyz.js → EnvVariablesPage-krKQsNzw.js} +1 -1
  120. package/public/assets/HomePage-vhKQtyLw.js +1 -0
  121. package/public/assets/{InfoRow-kU23cpPE.js → InfoRow-BbQYGWPd.js} +1 -1
  122. package/public/assets/{InstallationPage-JxXYftV0.js → InstallationPage-blIErVXZ.js} +1 -1
  123. package/public/assets/{LandingPage-7--4I0lt.js → LandingPage-CL2eVc3w.js} +1 -1
  124. package/public/assets/{LocalDevelopmentPage-B0C1C5Rs.js → LocalDevelopmentPage-CNfZtynN.js} +1 -1
  125. package/public/assets/{LoginPage-2Io9O_Q7.js → LoginPage-C_jpU4-N.js} +1 -1
  126. package/public/assets/{MetricBar-BSwVCFMX.js → MetricBar-CCL5kOaE.js} +1 -1
  127. package/public/assets/{NotFoundPage-DbO52kqL.js → NotFoundPage-DiQ3T_pE.js} +1 -1
  128. package/public/assets/{OnboardingGuide-BeP-StZq.js → OnboardingGuide-xVUtEvVm.js} +1 -1
  129. package/public/assets/{PermissionsPage-BMM-SA8k.js → PermissionsPage-CE5Yc52w.js} +1 -1
  130. package/public/assets/{PipelineConfigPage-6KxS3scE.js → PipelineConfigPage-BG_LWoNZ.js} +1 -1
  131. package/public/assets/{PipelineEditorPage-CpW1dBVH.js → PipelineEditorPage-BR9ozDOr.js} +1 -1
  132. package/public/assets/{ProfilePage-BaDJoNI7.js → ProfilePage-kUKBviJg.js} +1 -1
  133. package/public/assets/{ProjectDetailPage-QjUSwxfS.js → ProjectDetailPage-VE0081wk.js} +3 -3
  134. package/public/assets/ProjectListPage-DZoCY4RY.js +6 -0
  135. package/public/assets/{PtyTerminal-CEkY7dvk.js → PtyTerminal-DY7uY9Y-.js} +1 -1
  136. package/public/assets/{QuickAuth-9InsfbSA.js → QuickAuth-DbURb8Mn.js} +1 -1
  137. package/public/assets/{RemoveMemberConfirmDialog-Do5LW-9Q.js → RemoveMemberConfirmDialog-WvwPPSjT.js} +1 -1
  138. package/public/assets/{Select-8IQBiBBw.js → Select-B_UE_NDL.js} +1 -1
  139. package/public/assets/{SettingsPage-DRWkl-_N.js → SettingsPage-DpJ00PdY.js} +1 -1
  140. package/public/assets/{Skeleton-B3ZvE5gP.js → Skeleton-CqLLWdXS.js} +1 -1
  141. package/public/assets/{SkillPage-BhiRgb-S.js → SkillPage-D5a41yA5.js} +1 -1
  142. package/public/assets/TaskDetailPage-Dt3Hj-nd.js +21 -0
  143. package/public/assets/TaskListPage-CbmW-VAl.js +1 -0
  144. package/public/assets/{TaskStatusBadge-B6mxAWy2.js → TaskStatusBadge-DzeMf5Ey.js} +1 -1
  145. package/public/assets/TerminalHomePage-D7aNN02N.js +11 -0
  146. package/public/assets/{TokenManage-CenYPcRv.js → TokenManage-BCVRHkhz.js} +1 -1
  147. package/public/assets/Tooltip-BWRiD768.js +1 -0
  148. package/public/assets/{TotpSetupPage-DQyx573Y.js → TotpSetupPage-D4T0gS9_.js} +1 -1
  149. package/public/assets/WorkerDetailPage-D9ZTWwot.js +1 -0
  150. package/public/assets/{WorkerListPage-_bt8SJDK.js → WorkerListPage-4qQGHwbV.js} +2 -2
  151. package/public/assets/{WorkerOperationsPage-CDat2rGV.js → WorkerOperationsPage-DKPUYRDJ.js} +1 -1
  152. package/public/assets/{WorkerSetupGuidePage-CN7fSwA-.js → WorkerSetupGuidePage-B4B-DkyO.js} +1 -1
  153. package/public/assets/{WorkerSetupPage--spDks6s.js → WorkerSetupPage-frqVW4Ll.js} +1 -1
  154. package/public/assets/{arrow-left-CQ-bmyEx.js → arrow-left-DEORM5c1.js} +1 -1
  155. package/public/assets/{arrow-right-BOWA0FvU.js → arrow-right-B0qrrCV_.js} +1 -1
  156. package/public/assets/{bot-BpTfNKBP.js → bot-B_Wtzq9W.js} +1 -1
  157. package/public/assets/{chevron-right-D-xhzuZQ.js → chevron-right-CURI3LO_.js} +1 -1
  158. package/public/assets/{copy-DXSXnWX4.js → copy-4UTzTyXv.js} +1 -1
  159. package/public/assets/{download-FbsyL-QU.js → download-Dq5jLFci.js} +1 -1
  160. package/public/assets/{external-link-CPRFmfE1.js → external-link-Cj283ZgT.js} +1 -1
  161. package/public/assets/index-BiItJ2NI.css +1 -0
  162. package/public/assets/{index-D205WYza.js → index-C5MJg1oC.js} +48 -48
  163. package/public/assets/{key-Diuh2Udi.js → key-BKBK0Uc2.js} +1 -1
  164. package/public/assets/{loader-circle-CsopNBbX.js → loader-circle-B71q4Dz7.js} +1 -1
  165. package/public/assets/{pencil-n52F1Vop.js → pencil-DG3Q-41a.js} +1 -1
  166. package/public/assets/{plus-BHkYD1iG.js → plus-CQjC8fgx.js} +1 -1
  167. package/public/assets/{rotate-ccw-Bl22woOU.js → rotate-ccw-CQh0kfDP.js} +1 -1
  168. package/public/assets/{scroll-text-DbVWAYzk.js → scroll-text-DF3DMVZk.js} +1 -1
  169. package/public/assets/{settings-0li6vYCf.js → settings-C_K0CJNU.js} +1 -1
  170. package/public/assets/{status-colors-C6o-wKJJ.js → status-colors-BnNRsWp0.js} +1 -1
  171. package/public/assets/{task-constants-a8NftfbJ.js → task-constants-D_2_U6qL.js} +1 -1
  172. package/public/assets/{trash-2-LoxvLZVm.js → trash-2-DsQUbmfY.js} +1 -1
  173. package/public/assets/{useFetch-DIPC8gCD.js → useFetch-C8LjfJUm.js} +1 -1
  174. package/public/assets/{users-BgBBs7IT.js → users-BWaNs7Vz.js} +1 -1
  175. package/public/assets/{wifi-CF0XZj9i.js → wifi-0ZLwtMKj.js} +1 -1
  176. package/public/assets/{workflow-DBOppGKP.js → workflow-B0yaOIwg.js} +1 -1
  177. package/public/index.html +2 -2
  178. package/public/sw.js +1 -1
  179. package/public/assets/BotManage-BlWUAERC.js +0 -6
  180. package/public/assets/EditProjectPage-0HfKfeFS.js +0 -2
  181. package/public/assets/HomePage-Ct5rkEIu.js +0 -1
  182. package/public/assets/ProjectListPage-Bs0GPEJb.js +0 -6
  183. package/public/assets/TaskDetailPage-vwqcnwqe.js +0 -21
  184. package/public/assets/TaskListPage-DRiTh03Z.js +0 -1
  185. package/public/assets/TerminalHomePage-sK-nSIOn.js +0 -11
  186. package/public/assets/WorkerDetailPage-BV7YTrMb.js +0 -1
  187. package/public/assets/index-DrlMKbMb.css +0 -1
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-D205WYza.js";/**
1
+ import{c as e}from"./index-C5MJg1oC.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-D205WYza.js";/**
1
+ import{c as e}from"./index-C5MJg1oC.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as a}from"./index-D205WYza.js";/**
1
+ import{c as a}from"./index-C5MJg1oC.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-D205WYza.js";/**
1
+ import{c as e}from"./index-C5MJg1oC.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as t}from"./index-D205WYza.js";/**
1
+ import{c as t}from"./index-C5MJg1oC.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as a}from"./index-D205WYza.js";/**
1
+ import{c as a}from"./index-C5MJg1oC.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as a}from"./index-D205WYza.js";/**
1
+ import{c as a}from"./index-C5MJg1oC.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{W as r,n as e,Y as s,Z as u,J as a}from"./index-D205WYza.js";const n={[e.QUEUED]:"var(--text-muted)",[e.ASSIGNED]:"#60a5fa",[e.RUNNING]:"var(--accent)",[e.SUSPENDED]:"var(--warning)",[e.COMPLETED]:"var(--info)",[e.FAILED]:"var(--destructive)",[e.CANCELLED]:"var(--text-muted)"};function v(t){return n[t]??"var(--text-muted)"}const o={[r.ONLINE]:"var(--accent)",[r.OFFLINE]:"var(--destructive)",[r.DRAINING]:"var(--warning)",[r.DECOMMISSIONED]:"var(--text-muted)"};function E(t){return o[t]??"var(--text-muted)"}function x(t){switch(t){case s.ACTIVE:return"text-green-400";case s.DISABLED:return"text-red-400";default:return"text-[var(--text-muted)]"}}function S(t){switch(t){case a.ACTIVE:return"text-green-400";case a.USED:return"text-blue-400";case a.REVOKED:return"text-red-400";case a.EXPIRED:return"text-[var(--text-muted)]";default:return"text-[var(--text-muted)]"}}function d(t){switch(t){case u.ACTIVE:return"text-green-400";case"error":return"text-red-400";default:return"text-[var(--text-muted)]"}}function i(t){return t>.8?"var(--destructive)":t>.6?"var(--warning)":"var(--accent)"}export{v as a,i as b,x as c,d,S as e,E as g,n as t,o as w};
1
+ import{W as r,n as e,Z as s,_ as u,O as a}from"./index-C5MJg1oC.js";const n={[e.QUEUED]:"var(--text-muted)",[e.ASSIGNED]:"#60a5fa",[e.RUNNING]:"var(--accent)",[e.SUSPENDED]:"var(--warning)",[e.COMPLETED]:"var(--info)",[e.FAILED]:"var(--destructive)",[e.CANCELLED]:"var(--text-muted)"};function v(t){return n[t]??"var(--text-muted)"}const o={[r.ONLINE]:"var(--accent)",[r.OFFLINE]:"var(--destructive)",[r.DRAINING]:"var(--warning)",[r.DECOMMISSIONED]:"var(--text-muted)"};function E(t){return o[t]??"var(--text-muted)"}function x(t){switch(t){case s.ACTIVE:return"text-green-400";case s.DISABLED:return"text-red-400";default:return"text-[var(--text-muted)]"}}function S(t){switch(t){case a.ACTIVE:return"text-green-400";case a.USED:return"text-blue-400";case a.REVOKED:return"text-red-400";case a.EXPIRED:return"text-[var(--text-muted)]";default:return"text-[var(--text-muted)]"}}function d(t){switch(t){case u.ACTIVE:return"text-green-400";case"error":return"text-red-400";default:return"text-[var(--text-muted)]"}}function i(t){return t>.8?"var(--destructive)":t>.6?"var(--warning)":"var(--accent)"}export{v as a,i as b,x as c,d,S as e,E as g,n as t,o as w};
@@ -1 +1 @@
1
- import{m as f,h as n,n as c,A as k}from"./index-D205WYza.js";const b=f((t,e)=>({tasks:[],currentTask:null,loading:!1,error:null,nextCursor:null,_fetchTasksAbort:null,fetchTasks:async a=>{const s=e()._fetchTasksAbort;s&&s.abort();const o=new AbortController;t({loading:!0,error:null,_fetchTasksAbort:o});try{const r={};a!=null&&a.status&&(r.status=a.status),a!=null&&a.projectKey&&(r.projectKey=a.projectKey),a!=null&&a.cursor&&(r.cursor=a.cursor),a!=null&&a.limit&&(r.limit=String(a.limit));const l=await n.get("web/tasks",{searchParams:r,signal:o.signal}).json();a!=null&&a.cursor?t(i=>({tasks:[...i.tasks,...l.data],nextCursor:l.nextCursor??null,_fetchTasksAbort:null})):t({tasks:l.data,nextCursor:l.nextCursor??null,_fetchTasksAbort:null})}catch(r){if(r instanceof DOMException&&r.name==="AbortError")return;t({error:r instanceof Error?r.message:"Failed to fetch tasks"})}finally{t({loading:!1})}},fetchTask:async a=>{t({loading:!0,error:null});try{const s=await n.get(`web/tasks/${a}`).json();t({currentTask:s})}catch(s){t({error:s instanceof Error?s.message:"Failed to fetch task"})}finally{t({loading:!1})}},createTask:async a=>{t({error:null});try{const s=await n.post("web/tasks",{json:a}).json();return t(o=>({tasks:[s,...o.tasks]})),s}catch(s){throw t({error:s instanceof Error?s.message:"Failed to create task"}),s}},cancelTask:async a=>{t({error:null});try{await n.post(`web/tasks/${a}/cancel`);const{currentTask:s}=e();(s==null?void 0:s.id)===a&&await e().fetchTask(a)}catch(s){throw t({error:s instanceof Error?s.message:"Failed to cancel task"}),s}},reset:()=>{t({tasks:[],currentTask:null,loading:!1,error:null,nextCursor:null})}})),h=[c.COMPLETED,c.FAILED,c.CANCELLED],u=[{value:"feat",label:"feat"},{value:"fix",label:"fix"},{value:"refactor",label:"refactor"},{value:"docs",label:"docs"},{value:"chore",label:"chore"}],A=[{value:"",label:"default"},...Object.values(k).map(t=>({value:t,label:t}))];export{A,h as T,u as a,b as u};
1
+ import{m as f,h as n,n as c,A as k}from"./index-C5MJg1oC.js";const b=f((t,e)=>({tasks:[],currentTask:null,loading:!1,error:null,nextCursor:null,_fetchTasksAbort:null,fetchTasks:async a=>{const s=e()._fetchTasksAbort;s&&s.abort();const o=new AbortController;t({loading:!0,error:null,_fetchTasksAbort:o});try{const r={};a!=null&&a.status&&(r.status=a.status),a!=null&&a.projectKey&&(r.projectKey=a.projectKey),a!=null&&a.cursor&&(r.cursor=a.cursor),a!=null&&a.limit&&(r.limit=String(a.limit));const l=await n.get("web/tasks",{searchParams:r,signal:o.signal}).json();a!=null&&a.cursor?t(i=>({tasks:[...i.tasks,...l.data],nextCursor:l.nextCursor??null,_fetchTasksAbort:null})):t({tasks:l.data,nextCursor:l.nextCursor??null,_fetchTasksAbort:null})}catch(r){if(r instanceof DOMException&&r.name==="AbortError")return;t({error:r instanceof Error?r.message:"Failed to fetch tasks"})}finally{t({loading:!1})}},fetchTask:async a=>{t({loading:!0,error:null});try{const s=await n.get(`web/tasks/${a}`).json();t({currentTask:s})}catch(s){t({error:s instanceof Error?s.message:"Failed to fetch task"})}finally{t({loading:!1})}},createTask:async a=>{t({error:null});try{const s=await n.post("web/tasks",{json:a}).json();return t(o=>({tasks:[s,...o.tasks]})),s}catch(s){throw t({error:s instanceof Error?s.message:"Failed to create task"}),s}},cancelTask:async a=>{t({error:null});try{await n.post(`web/tasks/${a}/cancel`);const{currentTask:s}=e();(s==null?void 0:s.id)===a&&await e().fetchTask(a)}catch(s){throw t({error:s instanceof Error?s.message:"Failed to cancel task"}),s}},reset:()=>{t({tasks:[],currentTask:null,loading:!1,error:null,nextCursor:null})}})),h=[c.COMPLETED,c.FAILED,c.CANCELLED],u=[{value:"feat",label:"feat"},{value:"fix",label:"fix"},{value:"refactor",label:"refactor"},{value:"docs",label:"docs"},{value:"chore",label:"chore"}],A=[{value:"",label:"default"},...Object.values(k).map(t=>({value:t,label:t}))];export{A,h as T,u as a,b as u};
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-D205WYza.js";/**
1
+ import{c as e}from"./index-C5MJg1oC.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{r as e}from"./index-D205WYza.js";function p(c,f){const[l,i]=e.useState(null),[d,u]=e.useState(!0),[R,a]=e.useState(null),o=e.useRef(c);o.current=c;const r=e.useRef(0),n=e.useCallback(async()=>{const s=++r.current;u(!0),a(null);try{const t=await o.current();s===r.current&&i(t)}catch(t){if(s===r.current){const g=t instanceof Error?t.message:"An unexpected error occurred";a(g)}}finally{s===r.current&&u(!1)}},f);return e.useEffect(()=>{n()},[n]),{data:l,loading:d,error:R,refetch:n}}export{p as u};
1
+ import{r as e}from"./index-C5MJg1oC.js";function p(c,f){const[l,i]=e.useState(null),[d,u]=e.useState(!0),[R,a]=e.useState(null),o=e.useRef(c);o.current=c;const r=e.useRef(0),n=e.useCallback(async()=>{const s=++r.current;u(!0),a(null);try{const t=await o.current();s===r.current&&i(t)}catch(t){if(s===r.current){const g=t instanceof Error?t.message:"An unexpected error occurred";a(g)}}finally{s===r.current&&u(!1)}},f);return e.useEffect(()=>{n()},[n]),{data:l,loading:d,error:R,refetch:n}}export{p as u};
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-D205WYza.js";/**
1
+ import{c as e}from"./index-C5MJg1oC.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-D205WYza.js";/**
1
+ import{c as e}from"./index-C5MJg1oC.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c}from"./index-D205WYza.js";/**
1
+ import{c}from"./index-C5MJg1oC.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
package/public/index.html CHANGED
@@ -28,8 +28,8 @@
28
28
  href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&display=swap"
29
29
  rel="stylesheet"
30
30
  />
31
- <script type="module" crossorigin src="/assets/index-D205WYza.js"></script>
32
- <link rel="stylesheet" crossorigin href="/assets/index-DrlMKbMb.css">
31
+ <script type="module" crossorigin src="/assets/index-C5MJg1oC.js"></script>
32
+ <link rel="stylesheet" crossorigin href="/assets/index-BiItJ2NI.css">
33
33
  <link rel="manifest" href="/manifest.webmanifest"><script id="vite-plugin-pwa:register-sw" src="/registerSW.js"></script></head>
34
34
  <body>
35
35
  <div id="root"></div>
package/public/sw.js CHANGED
@@ -1 +1 @@
1
- if(!self.define){let s,e={};const l=(l,i)=>(l=new URL(l+".js",i).href,e[l]||new Promise(e=>{if("document"in self){const s=document.createElement("script");s.src=l,s.onload=e,document.head.appendChild(s)}else s=l,importScripts(l),e()}).then(()=>{let s=e[l];if(!s)throw new Error(`Module ${l} didn’t register its module`);return s}));self.define=(i,n)=>{const r=s||("document"in self?document.currentScript.src:"")||location.href;if(e[r])return;let o={};const a=s=>l(s,r),u={module:{uri:r},exports:o,require:a};e[r]=Promise.all(i.map(s=>u[s]||a(s))).then(s=>(n(...s),o))}}define(["./workbox-6e9b121d"],function(s){"use strict";self.skipWaiting(),s.clientsClaim(),s.precacheAndRoute([{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"og-image.png",revision:"f1563b4bdc7d1a4ab0aef864b0c2294e"},{url:"index.html",revision:"16b4781d82dcb190a3dd4181b770dcf8"},{url:"icon-maskable-512x512.png",revision:"69ada030d99c4a087bc309c00d716654"},{url:"icon-maskable-192x192.png",revision:"bf88226fe789dcb35bf89a307d3ba1af"},{url:"icon-512x512.png",revision:"74e561c3eb152bbb9cdcb333b5f1f3be"},{url:"icon-192x192.png",revision:"0bc2b74efb274c01d9eb50f717f4b7cf"},{url:"favicon.svg",revision:"e91ea32c7308cc2267ae15a5974a27f8"},{url:"apple-touch-icon-180x180.png",revision:"34c1b155ebc55bee221777f86f4612d8"},{url:"apple-touch-icon-152x152.png",revision:"8cc7ef3bc3aa19c3d8a29a58646d0636"},{url:"apple-touch-icon-120x120.png",revision:"7057fb6fb60df3fcf3cd49883db13be9"},{url:"assets/workflow-DBOppGKP.js",revision:null},{url:"assets/wifi-CF0XZj9i.js",revision:null},{url:"assets/users-BgBBs7IT.js",revision:null},{url:"assets/useFetch-DIPC8gCD.js",revision:null},{url:"assets/trash-2-LoxvLZVm.js",revision:null},{url:"assets/task-constants-a8NftfbJ.js",revision:null},{url:"assets/status-colors-C6o-wKJJ.js",revision:null},{url:"assets/settings-0li6vYCf.js",revision:null},{url:"assets/scroll-text-DbVWAYzk.js",revision:null},{url:"assets/rotate-ccw-Bl22woOU.js",revision:null},{url:"assets/plus-BHkYD1iG.js",revision:null},{url:"assets/pencil-n52F1Vop.js",revision:null},{url:"assets/password-CHk45-jw.js",revision:null},{url:"assets/loader-circle-CsopNBbX.js",revision:null},{url:"assets/key-Diuh2Udi.js",revision:null},{url:"assets/index-DrlMKbMb.css",revision:null},{url:"assets/index-D205WYza.js",revision:null},{url:"assets/external-link-CPRFmfE1.js",revision:null},{url:"assets/download-FbsyL-QU.js",revision:null},{url:"assets/date-BdNtiQTP.js",revision:null},{url:"assets/copy-DXSXnWX4.js",revision:null},{url:"assets/chevron-right-D-xhzuZQ.js",revision:null},{url:"assets/bot-BpTfNKBP.js",revision:null},{url:"assets/arrow-right-BOWA0FvU.js",revision:null},{url:"assets/arrow-left-CQ-bmyEx.js",revision:null},{url:"assets/WorkerSetupPage--spDks6s.js",revision:null},{url:"assets/WorkerSetupGuidePage-CN7fSwA-.js",revision:null},{url:"assets/WorkerOperationsPage-CDat2rGV.js",revision:null},{url:"assets/WorkerListPage-_bt8SJDK.js",revision:null},{url:"assets/WorkerDetailPage-BV7YTrMb.js",revision:null},{url:"assets/TotpSetupPage-DQyx573Y.js",revision:null},{url:"assets/TokenManage-CenYPcRv.js",revision:null},{url:"assets/TerminalHomePage-sK-nSIOn.js",revision:null},{url:"assets/TaskStatusBadge-B6mxAWy2.js",revision:null},{url:"assets/TaskListPage-DRiTh03Z.js",revision:null},{url:"assets/TaskDetailPage-vwqcnwqe.js",revision:null},{url:"assets/SkillPage-BhiRgb-S.js",revision:null},{url:"assets/Skeleton-B3ZvE5gP.js",revision:null},{url:"assets/SettingsPage-DRWkl-_N.js",revision:null},{url:"assets/Select-8IQBiBBw.js",revision:null},{url:"assets/RemoveMemberConfirmDialog-Do5LW-9Q.js",revision:null},{url:"assets/QuickAuth-9InsfbSA.js",revision:null},{url:"assets/PtyTerminal-CEkY7dvk.js",revision:null},{url:"assets/PtyTerminal-Beg8tuEN.css",revision:null},{url:"assets/ProjectListPage-Bs0GPEJb.js",revision:null},{url:"assets/ProjectDetailPage-QjUSwxfS.js",revision:null},{url:"assets/ProfilePage-BaDJoNI7.js",revision:null},{url:"assets/PipelineEditorPage-CpW1dBVH.js",revision:null},{url:"assets/PipelineConfigPage-6KxS3scE.js",revision:null},{url:"assets/PermissionsPage-BMM-SA8k.js",revision:null},{url:"assets/OnboardingGuide-BeP-StZq.js",revision:null},{url:"assets/NotFoundPage-DbO52kqL.js",revision:null},{url:"assets/MetricBar-BSwVCFMX.js",revision:null},{url:"assets/LoginPage-2Io9O_Q7.js",revision:null},{url:"assets/LocalDevelopmentPage-B0C1C5Rs.js",revision:null},{url:"assets/LandingPage-7--4I0lt.js",revision:null},{url:"assets/InstallationPage-JxXYftV0.js",revision:null},{url:"assets/InfoRow-kU23cpPE.js",revision:null},{url:"assets/HomePage-Ct5rkEIu.js",revision:null},{url:"assets/EnvVariablesPage-DofRDtyz.js",revision:null},{url:"assets/EmptyState-i9jXL5NQ.js",revision:null},{url:"assets/EditProjectPage-0HfKfeFS.js",revision:null},{url:"assets/DocsPrimitives-DU41lKXb.js",revision:null},{url:"assets/DocsLayout-HdiVoWKl.js",revision:null},{url:"assets/DocsIndexPage-C-FZbN8Z.js",revision:null},{url:"assets/DeveloperSetupPage-DA4BHPuG.js",revision:null},{url:"assets/DeveloperManage-DwaEFuLo.js",revision:null},{url:"assets/DevWorkflowPage-DJddffhm.js",revision:null},{url:"assets/DeploymentPage-DwifcnIe.js",revision:null},{url:"assets/CliReferencePage-tonM0XBs.js",revision:null},{url:"assets/ChangelogPage-CazGvq6Y.js",revision:null},{url:"assets/BotSetupPage-BhNhgobr.js",revision:null},{url:"assets/BotManage-BlWUAERC.js",revision:null},{url:"assets/BotIntegrationPage-BgK7NXyQ.js",revision:null},{url:"assets/BindPlatformPage-C2bIjAbT.js",revision:null},{url:"assets/AuditLogPage-DoaVh4un.js",revision:null},{url:"assets/ArchitecturePage-Co5G-15M.js",revision:null},{url:"assets/ApiReferencePage-8Fvke3MS.js",revision:null},{url:"assets/AdminPage-DnmoRibU.js",revision:null},{url:"assets/AccessTokensPage-D_A93EkP.js",revision:null},{url:"apple-touch-icon-180x180.png",revision:"34c1b155ebc55bee221777f86f4612d8"},{url:"favicon.svg",revision:"e91ea32c7308cc2267ae15a5974a27f8"},{url:"icon-192x192.png",revision:"0bc2b74efb274c01d9eb50f717f4b7cf"},{url:"icon-512x512.png",revision:"74e561c3eb152bbb9cdcb333b5f1f3be"},{url:"icon-maskable-192x192.png",revision:"bf88226fe789dcb35bf89a307d3ba1af"},{url:"icon-maskable-512x512.png",revision:"69ada030d99c4a087bc309c00d716654"},{url:"manifest.webmanifest",revision:"fefa2ba09d815fe1773d1fdaaf97d9e5"}],{}),s.cleanupOutdatedCaches(),s.registerRoute(new s.NavigationRoute(s.createHandlerBoundToURL("/index.html"))),s.registerRoute(/^https:\/\/fonts\.googleapis\.com/,new s.CacheFirst({cacheName:"google-fonts-stylesheets",plugins:[]}),"GET"),s.registerRoute(/^https:\/\/fonts\.gstatic\.com/,new s.CacheFirst({cacheName:"google-fonts-webfonts",plugins:[new s.ExpirationPlugin({maxEntries:10,maxAgeSeconds:31536e3})]}),"GET")});
1
+ if(!self.define){let s,e={};const l=(l,i)=>(l=new URL(l+".js",i).href,e[l]||new Promise(e=>{if("document"in self){const s=document.createElement("script");s.src=l,s.onload=e,document.head.appendChild(s)}else s=l,importScripts(l),e()}).then(()=>{let s=e[l];if(!s)throw new Error(`Module ${l} didn’t register its module`);return s}));self.define=(i,n)=>{const r=s||("document"in self?document.currentScript.src:"")||location.href;if(e[r])return;let a={};const o=s=>l(s,r),u={module:{uri:r},exports:a,require:o};e[r]=Promise.all(i.map(s=>u[s]||o(s))).then(s=>(n(...s),a))}}define(["./workbox-6e9b121d"],function(s){"use strict";self.skipWaiting(),s.clientsClaim(),s.precacheAndRoute([{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"og-image.png",revision:"f1563b4bdc7d1a4ab0aef864b0c2294e"},{url:"index.html",revision:"52c96bb3a0c11c3d0c4b222619de4f1b"},{url:"icon-maskable-512x512.png",revision:"69ada030d99c4a087bc309c00d716654"},{url:"icon-maskable-192x192.png",revision:"bf88226fe789dcb35bf89a307d3ba1af"},{url:"icon-512x512.png",revision:"74e561c3eb152bbb9cdcb333b5f1f3be"},{url:"icon-192x192.png",revision:"0bc2b74efb274c01d9eb50f717f4b7cf"},{url:"favicon.svg",revision:"e91ea32c7308cc2267ae15a5974a27f8"},{url:"apple-touch-icon-180x180.png",revision:"34c1b155ebc55bee221777f86f4612d8"},{url:"apple-touch-icon-152x152.png",revision:"8cc7ef3bc3aa19c3d8a29a58646d0636"},{url:"apple-touch-icon-120x120.png",revision:"7057fb6fb60df3fcf3cd49883db13be9"},{url:"assets/workflow-B0yaOIwg.js",revision:null},{url:"assets/wifi-0ZLwtMKj.js",revision:null},{url:"assets/users-BWaNs7Vz.js",revision:null},{url:"assets/useFetch-C8LjfJUm.js",revision:null},{url:"assets/trash-2-DsQUbmfY.js",revision:null},{url:"assets/task-constants-D_2_U6qL.js",revision:null},{url:"assets/status-colors-BnNRsWp0.js",revision:null},{url:"assets/settings-C_K0CJNU.js",revision:null},{url:"assets/scroll-text-DF3DMVZk.js",revision:null},{url:"assets/rotate-ccw-CQh0kfDP.js",revision:null},{url:"assets/plus-CQjC8fgx.js",revision:null},{url:"assets/pencil-DG3Q-41a.js",revision:null},{url:"assets/password-CHk45-jw.js",revision:null},{url:"assets/loader-circle-B71q4Dz7.js",revision:null},{url:"assets/key-BKBK0Uc2.js",revision:null},{url:"assets/index-C5MJg1oC.js",revision:null},{url:"assets/index-BiItJ2NI.css",revision:null},{url:"assets/external-link-Cj283ZgT.js",revision:null},{url:"assets/download-Dq5jLFci.js",revision:null},{url:"assets/date-BdNtiQTP.js",revision:null},{url:"assets/copy-4UTzTyXv.js",revision:null},{url:"assets/chevron-right-CURI3LO_.js",revision:null},{url:"assets/bot-B_Wtzq9W.js",revision:null},{url:"assets/arrow-right-B0qrrCV_.js",revision:null},{url:"assets/arrow-left-DEORM5c1.js",revision:null},{url:"assets/WorkerSetupPage-frqVW4Ll.js",revision:null},{url:"assets/WorkerSetupGuidePage-B4B-DkyO.js",revision:null},{url:"assets/WorkerOperationsPage-DKPUYRDJ.js",revision:null},{url:"assets/WorkerListPage-4qQGHwbV.js",revision:null},{url:"assets/WorkerDetailPage-D9ZTWwot.js",revision:null},{url:"assets/TotpSetupPage-D4T0gS9_.js",revision:null},{url:"assets/Tooltip-BWRiD768.js",revision:null},{url:"assets/TokenManage-BCVRHkhz.js",revision:null},{url:"assets/TerminalHomePage-D7aNN02N.js",revision:null},{url:"assets/TaskStatusBadge-DzeMf5Ey.js",revision:null},{url:"assets/TaskListPage-CbmW-VAl.js",revision:null},{url:"assets/TaskDetailPage-Dt3Hj-nd.js",revision:null},{url:"assets/SkillPage-D5a41yA5.js",revision:null},{url:"assets/Skeleton-CqLLWdXS.js",revision:null},{url:"assets/SettingsPage-DpJ00PdY.js",revision:null},{url:"assets/Select-B_UE_NDL.js",revision:null},{url:"assets/RemoveMemberConfirmDialog-WvwPPSjT.js",revision:null},{url:"assets/QuickAuth-DbURb8Mn.js",revision:null},{url:"assets/PtyTerminal-DY7uY9Y-.js",revision:null},{url:"assets/PtyTerminal-Beg8tuEN.css",revision:null},{url:"assets/ProjectListPage-DZoCY4RY.js",revision:null},{url:"assets/ProjectDetailPage-VE0081wk.js",revision:null},{url:"assets/ProfilePage-kUKBviJg.js",revision:null},{url:"assets/PipelineEditorPage-BR9ozDOr.js",revision:null},{url:"assets/PipelineConfigPage-BG_LWoNZ.js",revision:null},{url:"assets/PermissionsPage-CE5Yc52w.js",revision:null},{url:"assets/OnboardingGuide-xVUtEvVm.js",revision:null},{url:"assets/NotFoundPage-DiQ3T_pE.js",revision:null},{url:"assets/MetricBar-CCL5kOaE.js",revision:null},{url:"assets/LoginPage-C_jpU4-N.js",revision:null},{url:"assets/LocalDevelopmentPage-CNfZtynN.js",revision:null},{url:"assets/LandingPage-CL2eVc3w.js",revision:null},{url:"assets/InstallationPage-blIErVXZ.js",revision:null},{url:"assets/InfoRow-BbQYGWPd.js",revision:null},{url:"assets/HomePage-vhKQtyLw.js",revision:null},{url:"assets/EnvVariablesPage-krKQsNzw.js",revision:null},{url:"assets/EmptyState-D8UwaoPs.js",revision:null},{url:"assets/EditProjectPage-RsYg77Bf.js",revision:null},{url:"assets/DocsPrimitives-BEIQH4P7.js",revision:null},{url:"assets/DocsLayout-BLcuuadd.js",revision:null},{url:"assets/DocsIndexPage-BEMGBIkx.js",revision:null},{url:"assets/DeveloperSetupPage-Cf8ehfWm.js",revision:null},{url:"assets/DeveloperManage-BVkSw-WE.js",revision:null},{url:"assets/DevWorkflowPage-BbNK1Bmy.js",revision:null},{url:"assets/DeploymentPage-cW2JDGd0.js",revision:null},{url:"assets/CliReferencePage-B6-2m7YU.js",revision:null},{url:"assets/ChangelogPage-BUAm5LN6.js",revision:null},{url:"assets/BotSetupPage-BkNF3ug4.js",revision:null},{url:"assets/BotManage-DSe8d-gZ.js",revision:null},{url:"assets/BotIntegrationPage-DoD5KbmU.js",revision:null},{url:"assets/BindPlatformPage-D-7wxMjF.js",revision:null},{url:"assets/AuditLogPage-CmxGpu8q.js",revision:null},{url:"assets/ArchitecturePage-CDgB6NL0.js",revision:null},{url:"assets/ApiReferencePage-Dcik4fBN.js",revision:null},{url:"assets/AdminPage-B-n-9yUY.js",revision:null},{url:"assets/AccessTokensPage-B2zkZtaB.js",revision:null},{url:"apple-touch-icon-180x180.png",revision:"34c1b155ebc55bee221777f86f4612d8"},{url:"favicon.svg",revision:"e91ea32c7308cc2267ae15a5974a27f8"},{url:"icon-192x192.png",revision:"0bc2b74efb274c01d9eb50f717f4b7cf"},{url:"icon-512x512.png",revision:"74e561c3eb152bbb9cdcb333b5f1f3be"},{url:"icon-maskable-192x192.png",revision:"bf88226fe789dcb35bf89a307d3ba1af"},{url:"icon-maskable-512x512.png",revision:"69ada030d99c4a087bc309c00d716654"},{url:"manifest.webmanifest",revision:"fefa2ba09d815fe1773d1fdaaf97d9e5"}],{}),s.cleanupOutdatedCaches(),s.registerRoute(new s.NavigationRoute(s.createHandlerBoundToURL("/index.html"))),s.registerRoute(/^https:\/\/fonts\.googleapis\.com/,new s.CacheFirst({cacheName:"google-fonts-stylesheets",plugins:[]}),"GET"),s.registerRoute(/^https:\/\/fonts\.gstatic\.com/,new s.CacheFirst({cacheName:"google-fonts-webfonts",plugins:[new s.ExpirationPlugin({maxEntries:10,maxAgeSeconds:31536e3})]}),"GET")});
@@ -1,6 +0,0 @@
1
- import{c as z,a as E,r as n,j as e,X as D,h as _,p as W,t as U}from"./index-D205WYza.js";import{S as F}from"./Select-8IQBiBBw.js";import{C as O}from"./DocsPrimitives-DU41lKXb.js";import{T as M}from"./trash-2-LoxvLZVm.js";import{P as q}from"./plus-BHkYD1iG.js";import{E as R}from"./EmptyState-i9jXL5NQ.js";import{T}from"./Skeleton-B3ZvE5gP.js";import{u as P}from"./useFetch-DIPC8gCD.js";import{d as A}from"./status-colors-C6o-wKJJ.js";import{B as H}from"./bot-BpTfNKBP.js";import{P as V}from"./pencil-n52F1Vop.js";import"./copy-DXSXnWX4.js";/**
2
- * @license lucide-react v0.469.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const X=z("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]),G=[{value:"lark",label:"lark_(feishu)"},{value:"slack",label:"slack"}];function J({isOpen:r,onClose:j,onCreated:f,editBot:m,onEditClose:s}){const{t}=E(),o=!!m,[C,y]=n.useState(""),[i,u]=n.useState("lark"),[g,v]=n.useState(""),[c,N]=n.useState(""),[p,h]=n.useState(""),[k,w]=n.useState(!1),[S,x]=n.useState("");n.useEffect(()=>{r&&(m?(y(m.name),u(m.platform),v(m.appId),N(""),h("")):(y(""),u("lark"),v(""),N(""),h("")),w(!1),x(""))},[m,r]);function b(){o&&s?s():j()}async function a(){if(x(""),!C.trim()||!g.trim()){x(t("admin.name_and_app_id_required"));return}if(o){if(i==="slack"&&c.trim()&&!c.trim().startsWith("xoxb-")){x(t("admin.invalid_bot_token"));return}}else{if(!c.trim()){x(t("admin.app_secret_required"));return}if(i==="slack"){if(!c.trim().startsWith("xoxb-")){x(t("admin.invalid_bot_token"));return}if(!p.trim()){x(t("admin.signing_secret_required"));return}}}const l={name:C.trim(),platform:i,appId:g.trim()};c.trim()&&(l.appSecret=c.trim()),p.trim()&&(l.webhookToken=p.trim());try{w(!0),o?await _.put(`admin/bots/${m.id}`,{json:l}).json():await _.post("admin/bots",{json:l}).json(),b(),f()}catch(B){const K=B instanceof Error?B.message:t(o?"admin.failed_to_update_bot":"admin.failed_to_create_bot");x(K)}finally{w(!1)}}if(!r)return null;const I=window.location.origin,$=[{label:t("admin.webhook_events_url"),url:`${I}/webhook/slack/events`,hint:t("admin.slack_events_hint")},{label:t("admin.webhook_interact_url"),url:`${I}/webhook/slack/interact`,hint:t("admin.slack_interact_hint")},{label:t("admin.webhook_commands_url"),url:`${I}/webhook/slack/commands`,hint:t("admin.slack_commands_hint")}],d=[{label:t("admin.webhook_request_url"),url:`${I}/webhook/lark`,hint:t("admin.webhook_config_hint_lark")}],L=i==="slack"?$:d;return 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)]",onClick:b}),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.jsx("h3",{className:"text-sm text-[var(--text-primary)]",children:o?`// ${t("admin.edit_bot")}`:`// ${t("admin.create_bot")}`}),e.jsx("button",{type:"button",className:"rounded-[4px] p-1 text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",onClick:b,children:e.jsx(D,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"space-y-4 px-5 py-5",children:[S&&e.jsx("div",{className:"rounded-[4px] border border-red-500/30 bg-red-500/10 px-3 py-2 text-xs text-red-400",children:S}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:t("admin.bot_name")}),e.jsx("input",{type:"text",placeholder:"e.g. overlord lark bot",value:C,onChange:l=>y(l.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:t("admin.platform")}),e.jsx(F,{value:i,onChange:u,options:G,disabled:o})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-3",children:[e.jsx("div",{className:"mb-2 text-xs text-[var(--text-muted)]",children:t("admin.webhook_config")}),e.jsx("div",{className:"text-xs text-[var(--text-muted)] mb-3",children:t(i==="slack"?"admin.webhook_config_hint_slack":"admin.webhook_config_hint_lark")}),e.jsx("div",{className:"space-y-2",children:L.map(l=>e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-[var(--text-muted)] mb-1",children:l.label}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("code",{className:"flex-1 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-2 py-1 text-xs text-[var(--text-primary)] select-all overflow-x-auto",children:l.url}),e.jsx(O,{text:l.url})]}),e.jsx("div",{className:"mt-0.5 text-xs text-[var(--text-muted)]",children:l.hint})]},l.label))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:t("admin.app_id")}),e.jsx("div",{className:"mb-1 text-xs text-[var(--text-muted)]",children:t(i==="slack"?"admin.app_id_hint_slack":"admin.app_id_hint_lark")}),e.jsx("input",{type:"text",placeholder:"platform application id",value:g,onChange:l=>v(l.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)]"})]}),i==="slack"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:t(o?"admin.bot_token_keep_current":"admin.bot_token")}),e.jsx("div",{className:"mb-1 text-xs text-[var(--text-muted)]",children:t("admin.bot_token_hint")}),e.jsx("input",{type:"password",placeholder:t("admin.bot_token_placeholder"),value:c,onChange:l=>N(l.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:t(o?"admin.signing_secret_keep_current":"admin.signing_secret")}),e.jsx("div",{className:"mb-1 text-xs text-[var(--text-muted)]",children:t("admin.signing_secret_hint")}),e.jsx("input",{type:"password",placeholder:t("admin.signing_secret_placeholder"),value:p,onChange:l=>h(l.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)]"})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:t(o?"admin.app_secret_keep_current":"admin.app_secret")}),e.jsx("div",{className:"mb-1 text-xs text-[var(--text-muted)]",children:t("admin.app_secret_hint_lark")}),e.jsx("input",{type:"password",placeholder:"platform application secret",value:c,onChange:l=>N(l.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:o?"encrypt key (leave empty to keep current)":"encrypt key"}),e.jsx("div",{className:"mb-1 text-xs text-[var(--text-muted)]",children:"events & callbacks → encryption strategy → encrypt key"}),e.jsx("input",{type:"password",placeholder:"encrypt key from encryption strategy",value:p,onChange:l=>h(l.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)]"})]})]})]}),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",onClick:b,children:t("common.cancel")}),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:k,onClick:a,children:t(k?o?"common.saving":"common.creating":o?"common.save_changes":"common.create")})]})]})]})}function Q({isOpen:r,bot:j,onClose:f,onUpdated:m}){const{t:s}=E(),[t,o]=n.useState([]),[C,y]=n.useState([]),[i,u]=n.useState(!1),[g,v]=n.useState(!1),[c,N]=n.useState(""),[p,h]=n.useState(""),[k,w]=n.useState(""),[S,x]=n.useState(""),b=n.useCallback(async()=>{try{const d=await _.get(`admin/bots/${j.id}/bindings`).json();o(d)}catch{}},[j.id]);n.useEffect(()=>{r&&b()},[r,b]);const a=n.useCallback(async()=>{try{const d=await _.get("web/projects").json();y(d)}catch{}},[]);n.useEffect(()=>{r&&a()},[r,a]);const I=async()=>{if(x(""),!c.trim()||!p.trim()||!k){x(s("admin.chat_binding_all_fields_required"));return}try{u(!0),await _.post(`admin/bots/${j.id}/bindings`,{json:{platformChatId:c.trim(),chatName:p.trim(),projectKey:k}}).json(),N(""),h(""),w(""),v(!1),await b(),m()}catch(d){const L=d instanceof Error?d.message:s("admin.failed_to_add_binding");x(L)}finally{u(!1)}},$=async d=>{try{await _.delete(`admin/bots/${j.id}/bindings`,{json:{platformChatId:d.platformChatId}}),o(L=>L.filter(l=>l.id!==d.id)),m()}catch{}};return r?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)]",onClick:f}),e.jsxs("div",{className:"relative z-10 w-full max-w-[600px] 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.jsx("h3",{className:"text-sm text-[var(--text-primary)]",children:s("admin.chat_binding_title",{name:j.name})}),e.jsx("button",{type:"button",className:"rounded-[4px] p-1 text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",onClick:f,children:e.jsx(D,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"px-5 py-5",children:[S&&e.jsx("div",{className:"mb-4 rounded-[4px] border border-red-500/30 bg-red-500/10 px-3 py-2 text-xs text-red-400",children:S}),t.length===0&&!g?e.jsx("p",{className:"py-4 text-center text-xs text-[var(--text-muted)]",children:s("admin.chat_binding_no_bindings")}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] text-left text-[var(--text-muted)]",children:[e.jsx("th",{className:"pb-2 pr-4 font-normal",children:s("admin.chat_name")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:s("admin.chat_id")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:s("admin.project")}),e.jsx("th",{className:"pb-2 font-normal",children:s("common.remove")})]})}),e.jsx("tbody",{children:t.map(d=>e.jsxs("tr",{className:"border-b border-[var(--border-row)] hover:bg-white/[0.02] transition-colors",children:[e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-primary)]",children:d.chatName}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:d.platformChatId}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:d.projectKey}),e.jsx("td",{className:"py-2.5",children:e.jsx("button",{type:"button",className:"rounded-[4px] p-1.5 text-red-400 hover:text-red-300 hover:bg-white/[0.05] transition-colors",onClick:()=>$(d),children:e.jsx(M,{className:"h-3.5 w-3.5"})})})]},d.id))})]})}),g&&e.jsxs("div",{className:"mt-4 space-y-3 rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] p-4",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:s("admin.chat_binding_add")}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:s("admin.chat_id")}),e.jsx("input",{type:"text",placeholder:s("admin.chat_binding_id_placeholder"),value:c,onChange:d=>N(d.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:s("admin.chat_name")}),e.jsx("input",{type:"text",placeholder:s("admin.chat_binding_name_placeholder"),value:p,onChange:d=>h(d.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:s("admin.project")}),e.jsx(F,{value:k,onChange:w,options:C.map(d=>({value:d.key,label:`${d.name} (${d.key})`})),placeholder:s("admin.chat_binding_select_project")})]}),e.jsxs("div",{className:"flex justify-end gap-2",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",onClick:()=>v(!1),children:s("common.cancel")}),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:i,onClick:I,children:s(i?"admin.chat_binding_adding":"admin.add_binding")})]})]})]}),e.jsxs("div",{className:"flex items-center justify-between border-t border-[var(--border)] px-5 py-4",children:[e.jsx("div",{children:!g&&e.jsxs("button",{type:"button",className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:border-[var(--accent)] transition-colors",onClick:()=>v(!0),children:[e.jsx(q,{className:"h-3.5 w-3.5"}),s("admin.add_binding")]})}),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",onClick:f,children:s("common.close")})]})]})]}):null}function ce(){const{t:r}=E(),[j,f]=n.useState(!1),[m,s]=n.useState(null),[t,o]=n.useState(null),[C,y]=n.useState(!1),[i,u]=n.useState(null),[g,v]=n.useState(!1),{data:c,loading:N,refetch:p}=P(()=>_.get("admin/bots").json(),[]),{data:h,loading:k,refetch:w}=P(()=>_.get("admin/bots/all-bindings").json(),[]);async function S(){if(i){v(!0);try{await _.delete(`admin/bots/${i.id}`),y(!1),u(null),p()}catch{U.error(r("admin.failed_to_delete_bot"))}finally{v(!1)}}}function x(a){switch(a){case"lark":return"text-blue-400";case"slack":return"text-yellow-400";default:return"text-[var(--text-secondary)]"}}function b(a){return e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{type:"button",className:"rounded-[4px] p-2.5 md:p-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-white/[0.05] transition-colors",title:r("common.edit"),onClick:()=>s(a),children:e.jsx(V,{className:"h-3.5 w-3.5"})}),e.jsx("button",{type:"button",className:"rounded-[4px] p-2.5 md:p-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-white/[0.05] transition-colors",title:r("admin.chat_bindings"),onClick:()=>o(a),children:e.jsx(X,{className:"h-3.5 w-3.5"})}),e.jsx("button",{type:"button",className:"rounded-[4px] p-2.5 md:p-1.5 text-red-400 hover:text-red-300 hover:bg-white/[0.05] transition-colors",title:r("common.delete"),onClick:()=>{u(a),y(!0)},children:e.jsx(M,{className:"h-3.5 w-3.5"})})]})}return e.jsxs("div",{className:"font-mono",children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:r("admin.bots_title")}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("admin.bots_subtitle")})]}),e.jsxs("button",{type:"button",className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity",onClick:()=>{s(null),f(!0)},children:[e.jsx(q,{className:"h-3.5 w-3.5"}),r("admin.create_bot")]})]}),N?e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsx(T,{rows:3})}):!c||c.length===0?e.jsx(R,{icon:H,title:r("admin.no_bots_configured"),description:r("admin.add_bot_desc"),actionLabel:r("admin.create_bot"),onAction:()=>{s(null),f(!0)}}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden md:block overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] text-left text-[var(--text-muted)]",children:[e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.bot_name")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.platform")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.app_id")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.status")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("common.created_at")}),e.jsx("th",{className:"pb-2 font-normal",children:r("common.actions")})]})}),e.jsx("tbody",{children:c.map(a=>e.jsxs("tr",{className:"border-b border-[var(--border-row)] hover:bg-white/[0.02] transition-colors",children:[e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-primary)]",children:a.name}),e.jsx("td",{className:"py-2.5 pr-4",children:e.jsx("span",{className:x(a.platform),children:a.platform})}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:a.appId}),e.jsx("td",{className:"py-2.5 pr-4",children:e.jsx("span",{className:A(a.status),children:a.status})}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-muted)]",children:new Date(a.createdAt).toLocaleDateString()}),e.jsx("td",{className:"py-2.5",children:b(a)})]},a.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3",children:c.map(a=>e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-[var(--text-primary)] font-medium",children:a.name}),b(a)]}),e.jsxs("div",{className:"flex items-center gap-3 text-[11px]",children:[e.jsx("span",{className:x(a.platform),children:a.platform}),e.jsx("span",{className:A(a.status),children:a.status})]}),e.jsx("div",{className:"mt-1 text-[11px] text-[var(--text-secondary)] truncate",children:a.appId})]},a.id))})]}),e.jsx(J,{isOpen:j||!!m,onClose:()=>{f(!1),s(null)},onCreated:p,editBot:m,onEditClose:()=>s(null)}),t&&e.jsx(Q,{isOpen:!!t,bot:t,onClose:()=>o(null),onUpdated:()=>{p(),w()}}),e.jsx(W,{isOpen:C,onClose:()=>{y(!1),u(null)},onConfirm:S,title:r("admin.delete_bot"),message:r("admin.delete_bot_confirm",{name:(i==null?void 0:i.name)??""}),confirmLabel:r("common.delete"),confirmVariant:"danger",isLoading:g}),e.jsxs("div",{className:"mt-8",children:[e.jsxs("h2",{className:"mb-4 text-sm text-[var(--text-primary)]",children:[r("admin.chat_bindings"),e.jsx("span",{className:"ml-2 text-[var(--text-muted)]",children:r("admin.chat_bindings_subtitle")})]}),k?e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsx(T,{rows:3})}):!h||h.length===0?e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-8 text-center",children:e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("admin.no_chat_bindings")})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden md:block overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] text-left text-[var(--text-muted)]",children:[e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.bot")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.platform")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.chat_id")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.chat_name")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.project")}),e.jsx("th",{className:"pb-2 font-normal",children:r("common.created_at")})]})}),e.jsx("tbody",{children:h.map(a=>e.jsxs("tr",{className:"border-b border-[var(--border-row)] hover:bg-white/[0.02] transition-colors",children:[e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-primary)]",children:a.botName}),e.jsx("td",{className:"py-2.5 pr-4",children:e.jsx("span",{className:x(a.platform),children:a.platform})}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:a.platformChatId}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:a.chatName??"-"}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:a.projectKey??"-"}),e.jsx("td",{className:"py-2.5 text-[var(--text-muted)]",children:new Date(a.createdAt).toLocaleDateString()})]},a.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3",children:h.map(a=>e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-xs text-[var(--text-primary)] font-medium",children:a.botName}),e.jsx("span",{className:`text-[11px] ${x(a.platform)}`,children:a.platform})]}),e.jsx("div",{className:"text-[11px] text-[var(--text-secondary)] truncate",children:a.platformChatId}),e.jsxs("div",{className:"flex items-center gap-3 mt-1 text-[11px] text-[var(--text-muted)]",children:[e.jsx("span",{children:a.chatName??"-"}),e.jsx("span",{children:a.projectKey??"-"})]})]},a.id))})]})]})]})}export{ce as default};
@@ -1,2 +0,0 @@
1
- import{x as me,f as be,a as ve,r as s,G as j,A as i,h as p,j as e,L as je,B as ee,t as c}from"./index-D205WYza.js";import{S as te}from"./Select-8IQBiBBw.js";import{U as he,A as ge,R as ye}from"./RemoveMemberConfirmDialog-Do5LW-9Q.js";import{P as fe}from"./plus-BHkYD1iG.js";function Ce(){const{key:n}=me(),l=be(),{t:r}=ve(),[o,re]=s.useState(null),[h,se]=s.useState([]),[ae,oe]=s.useState(!0),[S,g]=s.useState(!1),[y,T]=s.useState(""),[f,M]=s.useState(""),[I,A]=s.useState(""),[R,U]=s.useState(j.GITHUB),[O,P]=s.useState(""),[N,G]=s.useState(i.CLAUDE),[E,$]=s.useState(""),[D,B]=s.useState("50"),[L,F]=s.useState(""),[J,q]=s.useState(""),[z,H]=s.useState(""),[K,W]=s.useState("0"),[x,k]=s.useState(""),[X,_]=s.useState(null),[u,w]=s.useState(""),[Q,m]=s.useState(!1),[ne,V]=s.useState(!1),[d,C]=s.useState(null),[le,Y]=s.useState(!1),b=s.useCallback(async()=>{if(n)try{const[t,v]=await Promise.all([p.get(`web/projects/${n}`).json(),p.get(`web/projects/${n}/members`).json().catch(()=>[])]);if(re(t),se(v),_(t.gitTokenMasked??null),T(t.name),M(t.repoUrl),A(t.sshUrl??""),U(t.gitPlatform),P(t.defaultBranch),G(t.agentType),$(t.agentCommand??""),B(String(t.maxTurns)),F(t.workspaceRoot??""),q(t.setupCommands??""),H(t.testCommand??""),W(String(t.ptyOutputFilter??0)),t.pipeline)try{k(JSON.stringify(JSON.parse(t.pipeline),null,2))}catch{k(t.pipeline)}}catch{}finally{oe(!1)}},[n]);s.useEffect(()=>{b()},[b]);async function ce(t){if(t.preventDefault(),!o)return;g(!0);let v=null;if(x.trim())try{JSON.parse(x),v=x.trim()}catch{c.error(r("projects.invalid_pipeline_json")),g(!1);return}try{await p.put(`web/projects/${o.key}`,{json:{name:y,repoUrl:f,sshUrl:I||null,defaultBranch:O,gitPlatform:R,agentType:N,agentCommand:E||null,maxTurns:parseInt(D,10)||50,workspaceRoot:L||null,setupCommands:J||null,testCommand:z||null,ptyOutputFilter:parseInt(K,10)||0,pipeline:v}}),c.success(r("projects.project_saved")),l(`/projects/${o.key}`)}catch(Z){const ue=Z instanceof Error?Z.message:r("projects.failed_to_save_project");c.error(ue)}finally{g(!1)}}function de(){l(`/projects/${n}`)}async function ie(){if(!(!o||!u.trim())){m(!0);try{const t=await p.put(`web/projects/${o.key}/git-token`,{json:{token:u.trim()}}).json();_(t.gitTokenMasked),w(""),c.success(r("projects.git_token_saved"))}catch{c.error(r("projects.git_token_failed"))}finally{m(!1)}}}async function pe(){if(o){m(!0);try{await p.delete(`web/projects/${o.key}/git-token`),_(null),w(""),c.success(r("projects.git_token_cleared"))}catch{c.error(r("projects.git_token_failed"))}finally{m(!1)}}}async function xe(){if(!(!o||!d)){Y(!0);try{await p.delete(`web/projects/${o.key}/members`,{searchParams:{developerId:String(d.developerId)}}),await b()}catch{}finally{Y(!1),C(null)}}}return ae?e.jsx("div",{className:"flex justify-center py-20",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-[var(--border)] border-t-[var(--accent)]"})}):o?e.jsxs("form",{onSubmit:ce,className:"mx-auto max-w-6xl px-4 md:px-6 py-8",children:[e.jsxs("div",{className:"mb-2 text-xs text-[var(--text-muted)]",children:[e.jsx("span",{className:"cursor-pointer hover:text-[var(--text-secondary)]",onClick:()=>l("/projects"),children:r("projects.title")})," / ",e.jsx("span",{className:"cursor-pointer hover:text-[var(--text-secondary)]",onClick:()=>l(`/projects/${o.key}`),children:o.key})," / ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:r("common.edit")})]}),e.jsx("h1",{className:"text-lg font-bold text-[var(--text-primary)] mb-4",children:r("projects.edit_project_title")}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-[1fr_400px]",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("section",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("projects.basic_info")}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(a,{label:r("projects.key"),children:e.jsx("input",{type:"text",value:o.key,readOnly:!0,className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-muted)] outline-none opacity-60 cursor-not-allowed"})}),e.jsx(a,{label:r("projects.name"),children:e.jsx("input",{type:"text",value:y,onChange:t=>T(t.target.value),required:!0,className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})}),e.jsx(a,{label:r("projects.repo_url"),children:e.jsx("input",{type:"text",value:f,onChange:t=>M(t.target.value),required:!0,className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})}),e.jsxs(a,{label:r("projects.ssh_url"),children:[e.jsx("input",{type:"text",value:I,onChange:t=>A(t.target.value),placeholder:r("projects.ssh_url_placeholder"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"}),e.jsx("p",{className:"mt-1 text-[11px] text-[var(--text-muted)]",children:r("projects.ssh_url_hint")})]}),e.jsx(a,{label:r("projects.git_platform"),children:e.jsx(te,{value:R,onChange:t=>U(t),options:[{value:j.GITHUB,label:r("projects.github")},{value:j.GITLAB,label:r("projects.gitlab")},{value:j.GITEA,label:r("projects.gitea")}]})}),e.jsx(a,{label:r("projects.default_branch"),children:e.jsx("input",{type:"text",value:O,onChange:t=>P(t.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})})]})]}),e.jsxs("section",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("projects.agent_config")}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(a,{label:r("projects.agent_type"),children:e.jsx(te,{value:N,onChange:t=>G(t),options:[{value:i.CLAUDE,label:r("projects.claude")},{value:i.CURSOR,label:r("projects.cursor")},{value:i.CODEX,label:r("projects.codex")},{value:i.CUSTOM,label:r("projects.custom")}]})}),e.jsx(a,{label:r("projects.agent_command"),children:e.jsx("input",{type:"text",value:E,onChange:t=>$(t.target.value),disabled:N!==i.CUSTOM,placeholder:"custom agent command",className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)] disabled:opacity-50 disabled:cursor-not-allowed"})}),e.jsx(a,{label:r("projects.max_turns"),children:e.jsx("input",{type:"number",value:D,onChange:t=>B(t.target.value),min:1,className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})}),e.jsx(a,{label:r("projects.workspace_root"),children:e.jsx("input",{type:"text",value:L,onChange:t=>F(t.target.value),placeholder:"/path/to/workspace",className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})})]})]}),e.jsxs("section",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("projects.environment")}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(a,{label:r("projects.setup_commands"),children:e.jsx("textarea",{value:J,onChange:t=>q(t.target.value),rows:3,placeholder:`npm install
2
- npm run build`,className:"w-full resize-y rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})}),e.jsx(a,{label:r("projects.post_command"),children:e.jsx("input",{type:"text",value:z,onChange:t=>H(t.target.value),placeholder:"npm test",className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})})]})]}),e.jsxs("section",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("projects.security")}),e.jsx("div",{className:"space-y-3",children:e.jsx(a,{label:r("projects.pty_output_filter"),children:e.jsx("input",{type:"text",value:K,onChange:t=>W(t.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})})})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("section",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("projects.git_token")}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(a,{label:r("projects.git_token_label"),children:e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:X??r("common.not_set")})})}),e.jsxs(a,{label:r("projects.git_token_set"),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"password",value:u,onChange:t=>w(t.target.value),placeholder:"ghp_xxxx...",className:"min-w-0 flex-1 rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"}),e.jsx("button",{type:"button",disabled:Q||!u.trim(),onClick:ie,className:"shrink-0 rounded-[4px] bg-[var(--accent)] px-3 py-2 text-xs font-medium text-black hover:opacity-90 transition-opacity disabled:opacity-50",children:r("common.save")})]}),e.jsx("p",{className:"mt-1 text-[11px] text-[var(--text-muted)]",children:r("projects.git_token_hint")})]}),X&&e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{type:"button",disabled:Q,onClick:pe,className:"rounded-[4px] border border-[var(--destructive)] px-3 py-1.5 text-xs text-[var(--destructive)] hover:opacity-70 transition-opacity disabled:opacity-50",children:r("projects.git_token_clear")})})]})]}),e.jsxs("section",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsx("h2",{className:"text-sm font-semibold text-[var(--accent)]",children:r("projects.pipeline_section")}),e.jsx(je,{to:"/projects/"+n+"/pipeline",className:"text-xs text-[var(--accent)] hover:underline",children:r("projects.edit_pipeline")})]}),e.jsx("textarea",{value:x,onChange:t=>k(t.target.value),rows:20,spellCheck:!1,placeholder:'{"stages": []}',className:"w-full resize-y rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]",style:{fontFamily:'"JetBrains Mono", monospace',textTransform:"none"}})]}),e.jsxs("section",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsx("h2",{className:"text-sm font-semibold text-[var(--accent)]",children:r("projects.members")}),e.jsxs("button",{type:"button",onClick:()=>V(!0),className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs font-medium text-black",children:[e.jsx(fe,{className:"h-3.5 w-3.5"}),r("projects.add_member")]})]}),h.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-6",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:r("projects.no_members_yet")})]}):e.jsx("div",{className:"space-y-2",children:h.map(t=>e.jsxs("div",{className:"flex items-center justify-between rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-full bg-[var(--accent)]/20 text-xs font-bold text-[var(--accent)]",children:(t.developerName??String(t.developerId)).charAt(0).toUpperCase()}),e.jsxs("div",{children:[e.jsx("span",{className:"text-xs text-[var(--text-primary)]",children:t.developerName??`#${t.developerId}`}),e.jsx("span",{className:"ml-2 rounded-[4px] px-1.5 py-0.5 text-[11px] font-medium",style:{color:t.role===ee.MAINTAINER?"var(--warning)":"var(--text-secondary)",background:t.role===ee.MAINTAINER?"rgba(245,158,11,0.1)":"rgba(163,163,163,0.1)"},children:t.role})]})]}),e.jsx("button",{type:"button",onClick:()=>C(t),className:"text-[var(--destructive)] hover:opacity-70 transition-opacity","aria-label":r("projects.remove_member"),children:e.jsx(he,{className:"h-3.5 w-3.5"})})]},t.developerId))})]})]})]}),e.jsxs("div",{className:"mt-8 flex items-center justify-end gap-3 border-t border-[var(--border)] pt-6",children:[e.jsx("button",{type:"button",onClick:de,className:"rounded-[4px] border border-[var(--border)] bg-transparent px-4 py-2 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:r("common.discard")}),e.jsx("button",{type:"submit",disabled:S||!y||!f,className:"rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs font-medium text-black hover:opacity-90 transition-opacity disabled:opacity-50",children:r(S?"common.saving":"projects.save_changes")})]}),e.jsx(ge,{isOpen:ne,onClose:()=>V(!1),projectKey:o.key,existingMemberIds:h.map(t=>t.developerId),onAdded:b}),e.jsx(ye,{isOpen:!!d,onClose:()=>C(null),onConfirm:xe,memberName:d?d.developerName??`#${d.developerId}`:"",loading:le})]}):e.jsxs("div",{className:"mx-auto max-w-4xl px-4 md:px-6 py-8 text-center",children:[e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:r("projects.project_not_found")}),e.jsx("button",{onClick:()=>l("/projects"),className:"mt-4 rounded-[4px] border border-[var(--border)] bg-transparent px-4 py-2 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)]",children:r("projects.back_to_projects")})]})}function a({label:n,children:l}){return e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start gap-1 sm:gap-3",children:[e.jsx("label",{className:"sm:w-36 shrink-0 sm:pt-2 text-xs text-[var(--text-muted)]",children:n}),e.jsx("div",{className:"min-w-0 flex-1",children:l})]})}export{Ce as default};
@@ -1 +0,0 @@
1
- import{f as $,a as A,i as W,k as w,r as S,j as e,L as b,l as D,W as v,h as x}from"./index-D205WYza.js";import{T as L}from"./TaskStatusBadge-B6mxAWy2.js";import{T as u}from"./Skeleton-B3ZvE5gP.js";import{O as F}from"./OnboardingGuide-BeP-StZq.js";import{f as j}from"./date-BdNtiQTP.js";import{g as M}from"./status-colors-C6o-wKJJ.js";import{u as o}from"./useFetch-DIPC8gCD.js";import{A as g}from"./arrow-right-BOWA0FvU.js";import"./chevron-right-D-xhzuZQ.js";const O=3e5,B=[{key:"active_tasks",labelKey:"dashboard.active_tasks"},{key:"queued_tasks",labelKey:"dashboard.queued_tasks"},{key:"online_workers",labelKey:"dashboard.online_workers"},{key:"completed_today",labelKey:"dashboard.completed_today"}],P=["mon","tue","wed","thu","fri","sat","sun"];function G({dailyRates:l,overallRate:t}){const{t:m}=A(),i=P.map((r,c)=>({label:r,value:l[c]??0})),n=Math.max(...i.map(r=>r.value),1);return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-3 flex items-baseline gap-2",children:[e.jsxs("span",{className:"text-2xl font-bold text-[var(--text-primary)]",children:[t,"%"]}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:m("dashboard.last_7_days")})]}),e.jsx("div",{className:"flex gap-2",style:{height:80},children:i.map(r=>{const c=n>0?Math.max(r.value/n*100,4):4;return e.jsxs("div",{className:"flex flex-1 flex-col items-center gap-1",children:[e.jsx("div",{className:"relative w-full h-full rounded-[4px]",style:{backgroundColor:"rgba(34,197,94,0.1)"},children:e.jsx("div",{className:"absolute bottom-0 left-0 right-0 rounded-[4px]",style:{height:`${c}%`,backgroundColor:r.value>=80?"var(--accent)":r.value>=50?"var(--warning)":"var(--destructive)"}})}),e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:r.label})]},r.label)})})]})}function ee(){const l=$(),{t}=A(),m=W(),i=w(s=>s.taskSeq),n=w(s=>s.workerSeq),[r,c]=S.useState(0),{data:a,loading:f}=o(()=>x.get("web/dashboard/stats").json(),[r,i,n]),{data:T,loading:R}=o(()=>x.get("web/dashboard/recent-tasks",{searchParams:{limit:"5"}}).json(),[r,i]),{data:C,loading:I}=o(()=>x.get("web/workers").json(),[r,n]),{data:E,loading:q}=o(()=>x.get("web/dashboard/recent-activity").json(),[]);S.useEffect(()=>{const s=setInterval(()=>{c(d=>d+1)},O);return()=>clearInterval(s)},[]);const N=(a==null?void 0:a.success_rate_daily)??null,y=(a==null?void 0:a.task_success_rate_7d)??0,_=T??[],h=C??[],k=E??[];function K(s){switch(s){case v.ONLINE:return t("dashboard.online");case v.DRAINING:return t("dashboard.idle");case v.OFFLINE:default:return t("dashboard.offline")}}return e.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-4 md:px-6 md:py-8 font-mono",children:[e.jsx("div",{className:"mb-4 md:hidden",children:e.jsxs("span",{className:"text-base font-bold text-[var(--accent)]",children:["// ",t("dashboard.title")]})}),e.jsx("div",{className:"mb-6 md:mb-8 grid grid-cols-2 gap-3 md:gap-4 lg:grid-cols-4",children:B.map(({key:s,labelKey:d})=>e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 md:p-4",children:[e.jsxs("span",{className:"text-[11px] md:text-xs text-[var(--text-muted)]",children:[t(d),":"]}),f?e.jsx("div",{className:"mt-1 h-6 md:h-8 w-12 md:w-16 animate-pulse rounded-[4px] bg-[var(--bg-input)]"}):e.jsx("div",{className:"mt-1 flex items-baseline gap-2",children:e.jsx("span",{className:"text-2xl md:text-3xl font-bold text-[var(--text-primary)]",children:(a==null?void 0:a[s])??0})})]},s))}),e.jsx(F,{data:{activeTasks:((a==null?void 0:a.active_tasks)??0)+((a==null?void 0:a.queued_tasks)??0),totalWorkers:h.length,totalProjects:(a==null?void 0:a.project_count)??0,totalDevelopers:(a==null?void 0:a.developer_count)??0}}),e.jsxs("div",{className:"mb-6 grid gap-6 lg:grid-cols-3 items-stretch",children:[e.jsx("div",{className:"flex flex-col gap-6 lg:col-span-2",children:e.jsxs("div",{className:"flex flex-1 flex-col rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsx("div",{className:"border-b border-[var(--border)] px-5 py-3",children:e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:t("dashboard.task_success_rate")})}),e.jsx("div",{className:"flex flex-1 flex-col justify-center p-5",children:f?e.jsx("div",{className:"h-24 animate-pulse rounded-[4px] bg-[var(--bg-input)]"}):N?e.jsx(G,{dailyRates:N,overallRate:y}):e.jsxs("div",{className:"flex flex-col items-center gap-2 py-6",children:[e.jsxs("span",{className:"text-2xl font-bold text-[var(--text-primary)]",children:[y,"%"]}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:t("dashboard.daily_breakdown_not_available")})]})})]})}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] md:border",children:[e.jsxs("div",{className:"hidden md:flex items-center justify-between border-b border-[var(--border)] px-5 py-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:t("dashboard.recent_tasks")}),e.jsxs(b,{to:"/tasks",className:"flex items-center gap-1 text-xs text-[var(--accent)] hover:underline",children:[t("common.view_all")," ",e.jsx(g,{className:"h-3 w-3"})]})]}),e.jsx("div",{className:"flex md:hidden items-center justify-between px-3 py-3",children:e.jsx("h2",{className:"text-xs font-bold text-[var(--accent)]",children:t("dashboard.recent_tasks")})}),e.jsx("div",{className:"px-3 pb-3 md:px-5 md:pb-4 md:pt-0",children:R?e.jsx(u,{rows:4}):_.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-8",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:t("dashboard.no_tasks_yet")})]}):e.jsx("div",{className:"flex flex-col gap-2 md:gap-0",children:_.map(s=>e.jsxs("div",{onClick:()=>l(`/tasks/${s.id}`),className:"flex cursor-pointer items-center gap-3 rounded-[4px] border border-[var(--border)] p-3 transition-colors hover:bg-[var(--bg-input)] md:rounded-none md:border-0 md:border-b md:border-[var(--border-row)] md:p-0 md:py-2.5 last:md:border-b-0",children:[e.jsxs("div",{className:"flex-1 min-w-0 md:hidden",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("span",{className:"text-[11px] text-[var(--text-primary)] leading-tight line-clamp-2",title:`#${s.id} ${s.description}`,children:["#",s.id," ",s.description]}),e.jsx("span",{className:"shrink-0",children:e.jsx(L,{status:s.status})})]}),e.jsx("span",{className:"text-[11px] text-[var(--text-muted)] mt-1 block",children:j(s.createdAt)})]}),e.jsxs("span",{className:"hidden md:inline shrink-0 text-xs text-[var(--text-muted)]",children:["#",s.id]}),e.jsx("span",{className:"hidden md:inline flex-1 text-xs text-[var(--text-primary)] truncate",title:s.description,children:D(s.description,40)}),e.jsx("span",{className:"hidden md:inline",children:e.jsx(L,{status:s.status})}),e.jsx("span",{className:"hidden md:inline shrink-0 text-xs text-[var(--text-muted)]",children:j(s.createdAt)})]},s.id))})})]})]}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 py-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:t("dashboard.worker_status")}),e.jsxs(b,{to:"/workers",className:"flex items-center gap-1 text-xs text-[var(--accent)] hover:underline",children:[t("common.view_all")," ",e.jsx(g,{className:"h-3 w-3"})]})]}),e.jsx("div",{className:"p-4",children:I?e.jsx(u,{rows:3}):h.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-8",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:t("dashboard.no_workers_registered")})]}):e.jsx("div",{className:"flex flex-col",children:h.map(s=>e.jsxs("div",{onClick:()=>l(`/workers/${s.id}`),className:"flex cursor-pointer items-center justify-between border-b border-[var(--border-row)] py-2.5 transition-colors hover:bg-[var(--bg-input)] last:border-b-0",children:[e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("span",{className:"text-xs text-[var(--text-primary)]",children:s.name}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:s.host??"--"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"text-xs text-[var(--text-secondary)]",children:[s.activeSlots,"/",s.maxSlots," ",t("dashboard.slots")]}),e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs",style:{color:M(s.status)},children:[e.jsx("span",{style:{fontSize:"0.5rem"},children:"●"}),K(s.status)]})]})]},s.id))})})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 py-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:t("dashboard.recent_activity")}),m&&e.jsxs(b,{to:"/admin/audit-logs",className:"flex items-center gap-1 text-xs text-[var(--accent)] hover:underline",children:[t("common.view_all")," ",e.jsx(g,{className:"h-3 w-3"})]})]}),e.jsx("div",{className:"p-4",children:q?e.jsx(u,{rows:4}):k.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-8",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:t("dashboard.no_recent_activity")})]}):e.jsx("div",{className:"flex flex-col",children:k.map(s=>{const d=s.message.match(/task\s*#?(\d+)/i),p=d?d[1]:null;return e.jsxs("div",{className:`flex items-start gap-3 border-b border-[var(--border-row)] py-2 last:border-b-0 ${p?"cursor-pointer hover:bg-[var(--bg-input)] transition-colors":""}`,onClick:()=>p&&l(`/tasks/${p}`),children:[e.jsx("span",{className:"shrink-0 text-xs text-[var(--text-muted)]",children:j(s.timestamp)}),e.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:s.message})]},s.id)})})})]})]})]})}export{ee as default};
@@ -1,6 +0,0 @@
1
- import{c as R,a as z,r as o,G as u,A as x,j as e,h as E,f as G,q as I}from"./index-D205WYza.js";import{S as A}from"./Select-8IQBiBBw.js";import{E as M}from"./EmptyState-i9jXL5NQ.js";import{T as D}from"./Skeleton-B3ZvE5gP.js";import{t as H}from"./date-BdNtiQTP.js";import{u as O}from"./useFetch-DIPC8gCD.js";import{P as J}from"./plus-BHkYD1iG.js";/**
2
- * @license lucide-react v0.469.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const q=R("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]),b={width:"100%",padding:"0.5rem 0.75rem",backgroundColor:"var(--bg-input)",border:"1px solid var(--border)",borderRadius:"4px",color:"var(--text-primary)",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",outline:"none",boxSizing:"border-box"},i={display:"block",color:"var(--text-secondary)",fontSize:"0.7rem",marginBottom:"0.25rem",fontFamily:"'JetBrains Mono', monospace"};function W({isOpen:d,onClose:a,onCreated:h}){const{t}=z(),[l,j]=o.useState(""),[n,s]=o.useState(""),[c,p]=o.useState(""),[f,C]=o.useState(""),[_,k]=o.useState("main"),[S,N]=o.useState(u.GITHUB),[B,T]=o.useState(x.CLAUDE),[m,F]=o.useState(!1),[w,g]=o.useState("");o.useEffect(()=>{d&&U()},[d]);function U(){j(""),s(""),p(""),C(""),k("main"),N(u.GITHUB),T(x.CLAUDE),g("")}function y(){U(),a()}async function P(r){r.preventDefault(),g(""),F(!0);try{const v=await E.post("admin/projects",{json:{name:l,key:n,repoUrl:c,sshUrl:f||void 0,defaultBranch:_,gitPlatform:S,agentType:B}}).json();h(v),y()}catch(v){const L=v instanceof Error?v.message:t("projects.failed_to_create_project");g(L)}finally{F(!1)}}return d?e.jsx("div",{onClick:y,style:{position:"fixed",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))",padding:"1rem"},children:e.jsxs("div",{onClick:r=>r.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},children:["> ",t("projects.create_project")]}),e.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.7rem",marginTop:"0.25rem"},children:t("projects.add_project_desc")})]}),w&&e.jsx("div",{style:{marginBottom:"1rem",padding:"0.5rem 0.75rem",borderRadius:"4px",backgroundColor:"rgba(239, 68, 68, 0.1)",border:"1px solid rgba(239, 68, 68, 0.3)",color:"var(--destructive)",fontSize:"0.7rem"},children:w}),e.jsxs("form",{onSubmit:P,style:{display:"flex",flexDirection:"column",gap:"0.875rem"},children:[e.jsxs("div",{children:[e.jsx("label",{style:i,children:t("projects.project_name")}),e.jsx("input",{type:"text",value:l,onChange:r=>j(r.target.value),placeholder:t("projects.project_name_placeholder"),required:!0,autoFocus:!0,style:b,onFocus:r=>r.target.style.borderColor="var(--accent)",onBlur:r=>r.target.style.borderColor="var(--border)"})]}),e.jsxs("div",{children:[e.jsx("label",{style:i,children:t("projects.project_key")}),e.jsx("input",{type:"text",value:n,onChange:r=>s(r.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"")),placeholder:t("projects.project_key_placeholder"),required:!0,style:b,onFocus:r=>r.target.style.borderColor="var(--accent)",onBlur:r=>r.target.style.borderColor="var(--border)"}),e.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.65rem",marginTop:"0.25rem"},children:t("projects.project_key_hint")})]}),e.jsxs("div",{children:[e.jsx("label",{style:i,children:t("projects.repo_url")}),e.jsx("input",{type:"text",value:c,onChange:r=>p(r.target.value),placeholder:t("projects.repo_url_placeholder"),required:!0,style:b,onFocus:r=>r.target.style.borderColor="var(--accent)",onBlur:r=>r.target.style.borderColor="var(--border)"})]}),e.jsxs("div",{children:[e.jsx("label",{style:i,children:t("projects.ssh_url")}),e.jsx("input",{type:"text",value:f,onChange:r=>C(r.target.value),placeholder:t("projects.ssh_url_placeholder"),style:b,onFocus:r=>r.target.style.borderColor="var(--accent)",onBlur:r=>r.target.style.borderColor="var(--border)"}),e.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.65rem",marginTop:"0.25rem"},children:t("projects.ssh_url_hint")})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{style:i,children:t("projects.default_branch")}),e.jsx("input",{type:"text",value:_,onChange:r=>k(r.target.value),placeholder:t("projects.main"),style:b,onFocus:r=>r.target.style.borderColor="var(--accent)",onBlur:r=>r.target.style.borderColor="var(--border)"})]}),e.jsxs("div",{children:[e.jsx("label",{style:i,children:t("projects.git_platform")}),e.jsx(A,{value:S,onChange:r=>N(r),options:[{value:u.GITHUB,label:t("projects.github")},{value:u.GITLAB,label:t("projects.gitlab")},{value:u.GITEA,label:t("projects.gitea")}]})]}),e.jsxs("div",{children:[e.jsx("label",{style:i,children:t("projects.agent_type")}),e.jsx(A,{value:B,onChange:r=>T(r),options:[{value:x.CLAUDE,label:t("projects.claude")},{value:x.CURSOR,label:t("projects.cursor")},{value:x.CODEX,label:t("projects.codex")},{value:x.CUSTOM,label:t("projects.custom")}]})]})]}),e.jsxs("div",{style:{display:"flex",gap:"0.75rem",marginTop:"0.5rem"},children:[e.jsx("button",{type:"button",onClick:y,disabled:m,style:{flex:1,padding:"0.5rem",backgroundColor:"transparent",border:"1px solid var(--border)",borderRadius:"4px",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:"pointer",transition:"color 0.15s, border-color 0.15s"},className:"text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:border-[var(--text-muted)]",children:t("common.cancel")}),e.jsx("button",{type:"submit",disabled:m||!l||!n||!c,style:{flex:1,padding:"0.5rem",backgroundColor:"var(--accent)",color:"#0C0C0C",border:"none",borderRadius:"4px",fontSize:"0.75rem",fontWeight:600,fontFamily:"'JetBrains Mono', monospace",cursor:m||!l||!n||!c?"not-allowed":"pointer",opacity:m||!l||!n||!c?.7:1},children:t(m?"common.creating":"common.create")})]})]})]})}):null}function ee(){const d=G(),{t:a}=z(),[h,t]=o.useState(!1),{data:l,loading:j,refetch:n}=O(()=>E.get("web/projects").json(),[]);return I(o.useMemo(()=>e.jsxs("button",{onClick:()=>t(!0),className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs font-medium text-black",children:[e.jsx(J,{className:"h-3.5 w-3.5"}),a("projects.create_project")]}),[a])),e.jsxs("div",{className:"mx-auto max-w-5xl px-4 md:px-6 py-8",children:[j?e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsx(D,{rows:4})}):!l||l.length===0?e.jsx(M,{icon:q,title:a("projects.no_projects_yet"),description:a("projects.create_first_project"),actionLabel:a("projects.create_project"),onAction:()=>t(!0)}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-col gap-2 md:hidden",children:l.map(s=>e.jsxs("div",{onClick:()=>d(`/projects/${s.key}`),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-center justify-between gap-2",children:[e.jsx("span",{className:"text-xs font-medium text-[var(--accent)]",children:s.key}),e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:[s.taskCount??0," tasks"]})]}),e.jsx("span",{className:"mt-1 block text-[11px] text-[var(--text-primary)]",children:s.name}),e.jsx("span",{className:"mt-0.5 block text-[11px] text-[var(--text-muted)]",children:s.agentType})]},s.key))}),e.jsxs("div",{className:"hidden md:block rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsxs("div",{className:"grid grid-cols-[36px_90px_1fr_120px_60px_80px] gap-3 border-b border-[var(--border-row)] px-4 py-2.5 text-xs font-medium text-[var(--text-muted)]",children:[e.jsx("span",{children:"#"}),e.jsx("span",{children:a("projects.key")}),e.jsx("span",{children:a("projects.name")}),e.jsx("span",{children:a("projects.members")}),e.jsx("span",{children:a("projects.tasks_count")}),e.jsx("span",{children:a("projects.last_activity")})]}),l.map((s,c)=>e.jsxs("div",{onClick:()=>d(`/projects/${s.key}`),className:"grid cursor-pointer grid-cols-[36px_90px_1fr_120px_60px_80px] gap-3 border-b border-[var(--border-row)] px-4 py-3 last:border-b-0 hover:bg-[var(--bg-input)] transition-colors items-center",children:[e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:c+1}),e.jsx("span",{className:"truncate text-xs text-[var(--accent)]",children:s.key}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"block truncate text-xs text-[var(--text-primary)]",children:s.name}),e.jsxs("span",{className:"block truncate text-[11px] text-[var(--text-muted)]",children:[s.agentType," · ",s.repoUrl.replace(/^https?:\/\//,"").split("/").slice(-2).join("/")]})]}),e.jsx("div",{className:"flex items-center",children:e.jsxs("div",{className:"flex -space-x-1.5",children:[(s.members??[]).map(p=>e.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-full border-2 border-[var(--bg-card)] bg-[var(--accent)]/20 text-[11px] font-bold text-[var(--accent)]",title:p.name,children:p.name.charAt(0).toUpperCase()},p.id)),(s.memberCount??0)>5&&e.jsxs("div",{className:"flex h-6 w-6 items-center justify-center rounded-full border-2 border-[var(--bg-card)] bg-[var(--bg-input)] text-[11px] text-[var(--text-muted)]",children:["+",s.memberCount-5]})]})}),e.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:s.taskCount??0}),e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:H(s.lastActivity??null)})]},s.key))]})]}),e.jsx(W,{isOpen:h,onClose:()=>t(!1),onCreated:n})]})}export{ee as default};
@@ -1,21 +0,0 @@
1
- import{c as se,a as H,r,h as N,j as e,M as ze,w as I,H as Be,t as me,p as Pe,x as qe,f as Xe,o as We,k as Se,L as He,X as ie,n as W,y as Ee,s as Ve,G as Je}from"./index-D205WYza.js";import{u as Qe,T as Ye}from"./task-constants-a8NftfbJ.js";import{C as Ze,H as Te,P as De}from"./PtyTerminal-CEkY7dvk.js";import{a as et,f as ee}from"./date-BdNtiQTP.js";import{S as tt}from"./Select-8IQBiBBw.js";import{a as st}from"./status-colors-C6o-wKJJ.js";import{A as at}from"./arrow-left-CQ-bmyEx.js";import{R as xe}from"./rotate-ccw-Bl22woOU.js";import{E as rt}from"./external-link-CPRFmfE1.js";import{L as oe}from"./loader-circle-CsopNBbX.js";/**
2
- * @license lucide-react v0.469.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const $e=se("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
7
- * @license lucide-react v0.469.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const nt=se("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
- * @license lucide-react v0.469.0 - ISC
13
- *
14
- * This source code is licensed under the ISC license.
15
- * See the LICENSE file in the root directory of this source tree.
16
- */const lt=se("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
- * @license lucide-react v0.469.0 - ISC
18
- *
19
- * This source code is licensed under the ISC license.
20
- * See the LICENSE file in the root directory of this source tree.
21
- */const ct=se("SkipForward",[["polygon",{points:"5 4 15 12 5 20 5 4",key:"16p6eg"}],["line",{x1:"19",x2:"19",y1:"5",y2:"19",key:"futhcm"}]]);function Ie({isOpen:l,onClose:x,taskId:a,stageName:n,timeoutSeconds:t,onSubmitted:o}){const{t:i}=H(),[b,v]=r.useState(t),[E,L]=r.useState(!1);r.useEffect(()=>{if(!l)return;v(t);const d=setInterval(()=>{v(y=>y<=1?(clearInterval(d),0):y-1)},1e3);return()=>clearInterval(d)},[l,t]),r.useEffect(()=>{b===0&&l&&x()},[b,l,x]);const T=r.useCallback(async d=>{L(!0);try{await N.post(`web/tasks/${a}/confirm-stage`,{json:{stageName:n,approved:d}}),o==null||o(),x()}catch{}finally{L(!1)}},[a,n,x,o]);return l?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backdropFilter:"blur(2px)"},children:[e.jsx("div",{className:"fixed inset-0 bg-[var(--modal-backdrop)]"}),e.jsxs("div",{className:"relative z-10 w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] font-mono",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 py-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ze,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsxs("h3",{className:"text-sm text-[var(--text-primary)]",children:["// stage: ",n]})]}),e.jsxs("span",{className:"flex items-center gap-1 text-xs text-[var(--text-muted)]",children:[e.jsx(Ze,{className:"h-3.5 w-3.5"}),et(b)]})]}),e.jsx("div",{className:"space-y-4 px-5 py-5",children:e.jsx("p",{className:"whitespace-pre-wrap text-xs text-[var(--text-primary)]",children:i("tasks.confirm_stage_message",{name:n})})}),e.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-[var(--border)] px-5 py-4",children:[e.jsx("button",{type:"button",className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors disabled:opacity-50",disabled:E,onClick:()=>T(!1),children:i("tasks.reject")}),e.jsx("button",{type:"button",className:"rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",disabled:E,onClick:()=>T(!0),children:i(E?"tasks.stage_submitting":"tasks.confirm_and_proceed")})]})]})]}):null}function it(l,x){const a=new Date(l).getTime()-Date.now();if(a<=0)return x("tasks.tunnel_expired");const n=Math.floor(a/36e5),t=Math.floor(a%36e5/6e4);return n>0?x("tasks.tunnel_expires_hm",{h:n,m:t}):x("tasks.tunnel_expires_m",{m:t})}function Le(l){switch(l){case"CONNECTED":return"var(--accent)";case"STARTING":return"var(--warning)";case"EXPIRED":return"var(--text-muted)";default:return"var(--text-muted)"}}function Re(l,x){switch(l){case"IDLE":case"CLOSED":return x("tasks.tunnel_idle");case"STARTING":return x("tasks.tunnel_starting");case"CONNECTED":return x("tasks.tunnel_connected");case"EXPIRED":return x("tasks.tunnel_expired");case"CLOSING":return x("tasks.tunnel_closing");default:return String(l).toLowerCase()}}function xt({taskId:l,taskFinished:x,compact:a}){const{t:n}=H(),[t,o]=r.useState(I.IDLE),[i,b]=r.useState(null),[v,E]=r.useState(null),[L,T]=r.useState(""),[d,y]=r.useState(!1),[ae,R]=r.useState(!1),P=r.useRef(null),D=r.useCallback(async()=>{try{const h=await N.get(`web/workspace-tunnel/${l}/status`).json();o(h.status),b(h.tunnelUrl??null),E(h.expiresAt??null),(h.status==="EXPIRED"||h.status==="IDLE"||h.status==="CLOSED")&&_()}catch{}},[l]);function re(){_(),P.current=setInterval(D,5e3)}function _(){P.current&&(clearInterval(P.current),P.current=null)}r.useEffect(()=>{x&&(t===I.STARTING||t===I.CONNECTED)&&(o(I.IDLE),b(null),_())},[x,t]),r.useEffect(()=>{if(t!=="CONNECTED"||!v)return;const h=()=>{const S=it(v,n);T(S),S===n("tasks.tunnel_expired")&&(o(I.EXPIRED),b(null),_())};h();const C=setInterval(h,3e4);return()=>clearInterval(C)},[t,v]),r.useEffect(()=>()=>_(),[]),r.useEffect(()=>{x||D()},[D,x]);async function G(){y(!0);try{await N.post(`web/workspace-tunnel/${l}/start`),o(I.STARTING),re()}catch(h){let C=n("tasks.tunnel_start_failed");try{if(h instanceof Be){const S=await h.response.json();S!=null&&S.error&&(C=S.error,/code.*not found|ENOENT.*code|spawn code/i.test(C)&&(C+=". "+n("tasks.tunnel_install_code_hint")))}}catch{}me.error(C)}finally{y(!1)}}async function K(){y(!0);try{await N.post(`web/workspace-tunnel/${l}/stop`),o(I.IDLE),b(null),_()}catch{}finally{y(!1)}}async function g(){i&&(await navigator.clipboard.writeText(i),R(!0),setTimeout(()=>R(!1),2e3))}return a?e.jsxs("div",{className:"flex items-center gap-2 font-mono lowercase text-xs",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"ide_tunnel:"}),e.jsx("span",{style:{color:Le(t)},children:Re(t,n)}),(t==="IDLE"||t==="CLOSED"||t==="EXPIRED")&&e.jsx("button",{onClick:G,disabled:d,className:"rounded-[4px] px-2 py-1 text-[var(--info)] disabled:opacity-50",style:{backgroundColor:"rgba(59,130,246,0.12)"},children:n(d?"tasks.tunnel_starting":"tasks.tunnel_start")}),t==="CONNECTED"&&i&&e.jsx("a",{href:i.replace(/^https?:/,"cursor:"),target:"_blank",rel:"noopener noreferrer",className:"rounded-[4px] px-2 py-1 text-[var(--info)]",style:{backgroundColor:"rgba(59,130,246,0.12)"},children:n("tasks.tunnel_open_in_cursor")})]}):e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 font-mono lowercase",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:n("tasks.tunnel_header")}),e.jsxs("span",{className:"text-xs",style:{color:Le(t)},children:["● ",Re(t,n)]})]}),t==="CONNECTED"&&v&&e.jsxs("p",{className:"mb-2 text-xs text-[var(--text-muted)]",children:["// ",L]}),t==="CONNECTED"&&i&&e.jsxs("div",{className:"mb-3 flex items-center gap-2 rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] px-3 py-2",children:[e.jsx("code",{className:"flex-1 truncate text-xs text-[var(--text-primary)]",children:i}),e.jsxs("button",{onClick:g,className:"shrink-0 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors","aria-label":n("tasks.tunnel_copy_url"),children:["[",n("common.copy"),"]"]})]}),ae&&e.jsx("p",{className:"mb-2 text-xs text-[var(--accent)]",children:n("tasks.tunnel_copied")}),t==="STARTING"&&e.jsx("p",{className:"mb-3 text-xs text-[var(--text-muted)]",children:n("tasks.tunnel_waiting")}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[(t==="IDLE"||t==="CLOSED")&&e.jsx("button",{onClick:G,disabled:d,className:"rounded-[4px] border border-[var(--accent)]/40 px-3 py-1.5 text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors disabled:opacity-50",children:n(d?"tasks.tunnel_starting_button":"tasks.tunnel_start_button")}),t==="STARTING"&&e.jsx("button",{onClick:K,disabled:d,className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors disabled:opacity-50",children:n(d?"tasks.tunnel_stopping":"tasks.tunnel_cancel")}),t==="CONNECTED"&&i&&e.jsxs(e.Fragment,{children:[e.jsx("a",{href:i.replace(/^https?:/,"cursor:"),target:"_blank",rel:"noopener noreferrer",className:"rounded-[4px] border border-[var(--accent)]/40 px-3 py-1.5 text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors",children:n("tasks.tunnel_open_cursor")}),e.jsx("a",{href:i.replace(/^https?:/,"vscode:"),target:"_blank",rel:"noopener noreferrer",className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:n("tasks.tunnel_open_vscode")}),e.jsx("button",{onClick:K,disabled:d,className:"rounded-[4px] border border-[var(--destructive)]/40 px-3 py-1.5 text-[var(--destructive)] hover:bg-[var(--destructive)]/10 transition-colors disabled:opacity-50",children:n(d?"tasks.tunnel_stopping":"tasks.tunnel_stop")})]}),t==="EXPIRED"&&e.jsx("button",{onClick:G,disabled:d,className:"rounded-[4px] border border-[var(--accent)]/40 px-3 py-1.5 text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors disabled:opacity-50",children:n(d?"tasks.tunnel_starting_button":"tasks.tunnel_restart")})]})]})}function ot({isOpen:l,onClose:x,onConfirm:a,taskId:n,isLoading:t}){const{t:o}=H();return e.jsx(Pe,{isOpen:l,onClose:x,onConfirm:a,title:o("tasks.cancel_task_title"),message:o("tasks.cancel_task_message",{id:String(n)}),confirmLabel:o("tasks.cancel_task_confirm_label"),confirmVariant:"danger",isLoading:t})}function dt({isOpen:l,onClose:x,onConfirm:a,taskId:n,mrUrl:t,isLoading:o}){const{t:i}=H(),b=t?i("tasks.retry_message_with_mr",{id:String(n),url:t}):i("tasks.retry_message_without_mr",{id:String(n)});return e.jsx(Pe,{isOpen:l,onClose:x,onConfirm:a,title:i("tasks.retry_title"),message:b,confirmLabel:i("tasks.retry_confirm_label"),confirmVariant:"accent",isLoading:o})}function mt(l){switch(l){case"stage_change":return"text-[var(--accent)]";case"info":return"text-[var(--text-secondary)]";case"warning":return"text-[var(--warning)]";case"error":return"text-[var(--destructive)]";case"system":return"text-[var(--info)]";default:return"text-[var(--text-muted)]"}}function de({status:l}){const x=st(l);return e.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-[4px] px-2 py-0.5 text-xs",style:{color:x},children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-[3px]",style:{backgroundColor:x}}),l.toLowerCase()]})}function pt(l){let a=["implement","test","verify","review","submit"];if(l.configSnapshot)try{const t=JSON.parse(l.configSnapshot);if(t&&typeof t=="object"){const o=typeof t.pipeline=="string"?JSON.parse(t.pipeline):t.pipeline;o&&typeof o=="object"&&Array.isArray(o.stages)&&o.stages.length>0&&o.stages.every(i=>i&&typeof i=="object"&&typeof i.name=="string")&&(a=o.stages.map(i=>i.name))}}catch{}const n=l.currentStage?a.indexOf(l.currentStage):-1;return a.map((t,o)=>{let i="pending";return l.status===W.COMPLETED?i="completed":l.status===W.FAILED&&o<=n?i=o===n?"failed":"completed":n>=0&&(o<n?i="completed":o===n&&(i="running")),{name:t,status:i}})}function te(l,x){if(!l||!x)return null;const a=l.repoUrl.replace(/\.git$/,"");return l.gitPlatform===Je.GITLAB?`${a}/-/tree/${x}`:`${a}/tree/${x}`}function wt(){var _e,Ce;const{id:l}=qe(),x=Xe(),{t:a}=H(),n=Qe(s=>s.cancelTask),[t,o]=r.useState(null),[i,b]=r.useState(null),[v,E]=r.useState([]),[L,T]=r.useState(!0),[d,y]=r.useState(null),[ae,R]=r.useState(!1),[P,D]=r.useState(!1),[re,_]=r.useState(!1),[G,K]=r.useState(!1),[g,h]=r.useState("terminal"),[C,S]=r.useState([]),[V,Ae]=r.useState(0),[z,B]=r.useState(0),[q,pe]=r.useState(""),[J,Oe]=r.useState(""),[Fe,ue]=r.useState(!1),[Me,he]=r.useState(!1),[A,fe]=r.useState(null),[k,ve]=r.useState("disconnected"),[X,be]=r.useState("auto"),O=r.useRef(null),ge=r.useRef(null),p=Number(l),f=t?Ye.includes(t.status):!1;We(t?`#${t.id} ${t.description}`:null);const w=r.useCallback(async()=>{try{const s=await N.get(`web/tasks/${p}`).json();o(s)}catch{}},[p]),Q=r.useCallback(async()=>{try{const s=await N.get(`web/tasks/${p}/logs`).json();E(s.lines)}catch{}},[p]),F=r.useCallback(async()=>{try{const s=await N.get(`web/tasks/${p}/pending-confirm`).json();y(s.confirm)}catch{y(null)}},[p]),je=r.useCallback(async()=>{ue(!0);try{const s=new URLSearchParams;s.set("limit","50"),s.set("offset",String(z*50)),q&&s.set("type",q),J&&s.set("search",J);const c=await N.get(`web/tasks/${p}/events?${s}`).json();S(c.events),Ae(c.total)}catch{}finally{ue(!1)}},[p,z,q,J]);r.useEffect(()=>{g==="logs"&&je()},[g,je]),r.useEffect(()=>{g==="pipeline"&&!f&&N.get(`web/workspaces/${p}`).json().then(fe).catch(()=>fe(null))},[g,p,f]);const M=Se(s=>s.lastEvent),Ne=Se(s=>s.eventSeq);r.useEffect(()=>{T(!0),Promise.all([w(),Q(),F()]).finally(()=>T(!1))},[w,Q,F]),r.useEffect(()=>{t!=null&&t.projectKey&&N.get(`web/projects/${t.projectKey}`).json().then(b).catch(()=>b(null))},[t==null?void 0:t.projectKey]),r.useEffect(()=>{!M||Ne===0||(M.event==="task_status_changed"&&M.taskId===p||M.event==="task_created"&&M.taskId===p)&&(w(),F())},[Ne,M,p,w,F]),r.useEffect(()=>{if(f)return;const c=setInterval(()=>{document.visibilityState!=="hidden"&&Promise.all([w(),Q(),F()])},15e3);return()=>clearInterval(c)},[f,w,Q,F]);const ye=r.useCallback(()=>y(null),[]),Y=r.useCallback(()=>{y(null),w()},[w]);async function Ue(){_(!0);try{await n(p),R(!1),await w()}finally{_(!1)}}async function Ge(){K(!0);try{await N.post(`web/tasks/${p}/retry`),D(!1),await w()}finally{K(!1)}}const j=r.useMemo(()=>t?pt(t):[],[t==null?void 0:t.configSnapshot,t==null?void 0:t.currentStage,t==null?void 0:t.status]),ne=j.findIndex(s=>s.status==="running");if(L)return e.jsx("div",{className:"flex h-full items-center justify-center font-mono",children:e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:a("tasks.loading_task")})});if(!t)return e.jsxs("div",{className:"mx-auto max-w-5xl px-6 py-8 font-mono lowercase text-center",children:[e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:a("tasks.task_not_found")}),e.jsxs("button",{onClick:()=>x("/tasks"),className:"mt-4 rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:["< ",a("tasks.back_to_tasks")]})]});const ke=e.jsxs("div",{className:"flex items-center gap-3 border-b border-[var(--border)] bg-[var(--bg-primary)] px-4 py-3 shrink-0 md:hidden",children:[e.jsx("button",{onClick:()=>x("/tasks"),className:"shrink-0 text-[var(--text-muted)]",children:e.jsx(at,{className:"h-4 w-4"})}),e.jsxs("span",{className:"line-clamp-2 text-sm font-medium text-[var(--text-primary)]",title:`#${t.id} ${t.description}`,children:["#",t.id," ",t.description]})]}),le=e.jsxs("div",{className:"hidden md:flex items-center gap-4 border-b border-[var(--border)] bg-[var(--bg-primary)] px-5 shrink-0",style:{height:44},children:[e.jsx(de,{status:t.status}),e.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),e.jsxs(He,{to:`/projects/${t.projectKey}`,className:"text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:["project: ",e.jsx("span",{className:"text-[var(--text-primary)]",children:t.projectKey})]}),t.branch&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["branch: ",te(i,t.branch)?e.jsx("a",{href:te(i,t.branch),target:"_blank",rel:"noopener noreferrer",className:"text-[var(--text-primary)] hover:text-[var(--info)] hover:underline transition-colors",children:t.branch}):e.jsx("span",{className:"text-[var(--text-primary)]",children:t.branch})]})]}),t.mrUrl&&/^https?:\/\//.test(t.mrUrl)&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),e.jsxs("a",{href:t.mrUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-[var(--info)] hover:underline",children:["MR: ",((_e=t.mrUrl.match(/!?\d+$/))==null?void 0:_e[0])??"view"]})]})]}),we=e.jsxs("div",{className:"flex items-center gap-3 border-t border-[var(--border)] bg-[var(--bg-primary)] px-4 md:px-5 shrink-0",style:{height:48},children:[!f&&e.jsxs("button",{onClick:()=>R(!0),className:"flex flex-1 md:flex-none items-center justify-center gap-1.5 rounded-[4px] bg-[var(--destructive)]/10 px-3 h-8 text-[11px] font-medium text-[var(--destructive)]",children:[e.jsx(ie,{className:"h-3 w-3"}),a("tasks.cancel_task")]}),t.status===W.FAILED&&e.jsxs("button",{onClick:()=>D(!0),className:"flex flex-1 md:flex-none items-center justify-center gap-1.5 rounded-[4px] bg-[var(--bg-card)] px-3 h-8 text-[11px] text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-input)] transition-colors cursor-pointer",children:[e.jsx(xe,{className:"h-3 w-3"}),a("tasks.retry_task")]}),t.workerId&&!f&&e.jsxs("button",{onClick:()=>{h("pipeline"),setTimeout(()=>{var s,c;(c=(s=ge.current)==null?void 0:s.scrollIntoView)==null||c.call(s,{behavior:"smooth",block:"center"})},50)},className:"hidden lg:flex items-center justify-center gap-1.5 rounded-[4px] px-3 h-8 text-[11px] font-medium text-[var(--info)]",style:{backgroundColor:"rgba(59,130,246,0.12)"},children:[e.jsx(rt,{className:"h-3 w-3"}),a("tasks.cursor_tunnel")]})]}),Ke=e.jsxs("div",{className:"hidden w-[280px] shrink-0 flex-col gap-6 overflow-y-auto border-l border-[var(--border)] bg-[var(--bg-primary)] p-4 lg:flex",children:[e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:a("tasks.pipeline_stages")}),j.map(s=>{const c=s.status==="completed",m=s.status==="running",u=s.status==="failed";return e.jsxs("div",{className:`flex items-center gap-2 rounded-[4px] px-2 py-1.5 ${m?"bg-[#1a1a1a]":""}`,children:[c&&e.jsx(Ee,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),m&&e.jsx(oe,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),u&&e.jsx(ie,{className:"h-3.5 w-3.5 shrink-0 text-[var(--destructive)]"}),s.status==="pending"&&e.jsx($e,{className:"h-3.5 w-3.5 shrink-0 text-[#525252]"}),e.jsx("span",{className:"text-xs",style:{color:c?"var(--accent)":m?"#e5e5e5":u?"var(--destructive)":"#525252",fontWeight:m?500:400},children:m?`> ${s.name}`:s.name})]},s.name)})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:a("tasks.activity_log")}),v.length>0?e.jsx("div",{className:"flex flex-col gap-1.5",children:v.slice(0,8).map((s,c)=>e.jsx("p",{className:"text-[11px] leading-relaxed text-[var(--text-muted)]",children:s},c))}):e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.no_activity")})]})]}),ce=e.jsxs(e.Fragment,{children:[e.jsx(ot,{isOpen:ae,onClose:()=>R(!1),onConfirm:Ue,taskId:p,isLoading:re}),e.jsx(dt,{isOpen:P,onClose:()=>D(!1),onConfirm:Ge,taskId:p,mrUrl:t.mrUrl??void 0,isLoading:G})]});return Me&&g==="terminal"?e.jsxs("div",{className:"fixed inset-0 z-50 flex flex-col bg-[var(--bg-primary)] font-mono lowercase h-screen",style:{height:"100dvh",paddingTop:"env(safe-area-inset-top, 0px)",paddingBottom:"env(safe-area-inset-bottom, 0px)"},children:[le,e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 shrink-0",style:{height:36,backgroundColor:"#111111"},children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:a("tasks.pty_terminal")}),e.jsxs("span",{className:`inline-flex items-center gap-1 text-[11px] ${k==="connected"?"text-[var(--accent)]":k==="connecting"?"text-[var(--warning)]":"text-[var(--text-muted)]"}`,children:[e.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${k==="connected"?"bg-[var(--accent)]":k==="connecting"?"bg-[var(--warning)]":"bg-[#525252]"}`}),a(`tasks.${k}`)]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[!f&&X==="auto"&&e.jsxs("button",{onClick:()=>{var s;return(s=O.current)==null?void 0:s.requestTakeover()},className:"flex items-center gap-1.5 rounded-[4px] px-2.5 h-10 md:h-8 text-[11px] font-medium text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:[e.jsx(Te,{className:"h-3 w-3"}),a("tasks.take_over")]}),!f&&X==="manual"&&e.jsxs("button",{onClick:()=>{var s;return(s=O.current)==null?void 0:s.releaseTakeover()},className:"flex items-center gap-1.5 rounded-[4px] px-2.5 h-10 md:h-8 text-[11px] font-medium text-[var(--accent)]",style:{backgroundColor:"rgba(34,197,94,0.12)"},children:[e.jsx(xe,{className:"h-3 w-3"}),a("tasks.restore_auto")]}),t.currentStage&&e.jsxs("span",{className:"text-[11px] text-[var(--accent)]",children:[a("tasks.stage"),": ",t.currentStage]}),e.jsx("button",{onClick:()=>he(!1),className:"flex items-center rounded-[4px] bg-[var(--bg-card)] px-2.5 py-1 text-[var(--text-muted)]",children:e.jsx(lt,{className:"h-3 w-3"})})]})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(De,{ref:O,taskId:p,sessionId:t.currentSessionId??void 0,taskFinished:f,onStatusChange:ve,onTakeoverChange:be})}),we,ce]}):t.status===W.SUSPENDED?e.jsxs("div",{className:"flex h-full flex-col font-mono lowercase",children:[ke,le,e.jsx("div",{className:"flex items-center gap-2 border-b px-4 md:px-6 py-2 text-xs shrink-0",style:{backgroundColor:"rgba(245,158,11,0.08)",borderColor:"rgba(245,158,11,0.2)",color:"var(--warning)"},children:a("tasks.task_suspended_banner")}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col md:flex-row gap-4 md:gap-6 p-4 md:p-6 overflow-y-auto",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-4",children:[e.jsxs("div",{className:"hidden md:flex items-center gap-3",children:[e.jsxs("span",{className:"text-xl font-bold text-[var(--text-primary)]",children:["#",t.id]}),e.jsx("span",{className:"text-base text-[var(--text-secondary)] truncate max-w-[60%]",title:t.description,children:t.description}),e.jsx("span",{className:"rounded-[4px] px-2.5 py-1 text-[11px] font-bold text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:a("tasks.status_suspended")})]}),e.jsx("div",{className:"flex items-center gap-2 md:hidden",children:e.jsx("span",{className:"rounded-[4px] px-2.5 py-1 text-[11px] font-bold text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:a("tasks.status_suspended")})}),d&&e.jsxs("div",{className:"rounded-[4px] border p-4",style:{borderColor:"rgba(245,158,11,0.27)",backgroundColor:"#1a1a1a"},children:[e.jsx("p",{className:"mb-2 text-[11px] font-bold text-[var(--accent)]",children:a("tasks.pending_confirmation")}),e.jsx("p",{className:"mb-3 text-xs text-[var(--text-secondary)]",children:d.prompt??a("tasks.pipeline_requires_confirmation")}),e.jsx("div",{className:"mb-3 flex flex-col gap-1.5 text-[11px]",children:e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"stage"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:d.stageName})]})}),e.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:flex-wrap md:gap-3",children:[e.jsx("button",{onClick:async()=>{try{await N.post(`web/tasks/${p}/confirm-stage`,{json:{stageName:d.stageName,approved:!0}}),Y()}catch{me.error(a("tasks.confirm_failed"))}},className:"flex-1 md:flex-none rounded-[4px] bg-[var(--accent)] px-4 py-2.5 md:py-2 text-[11px] font-bold text-[#0c0c0c]",children:a("tasks.confirm_and_proceed")}),e.jsx("button",{onClick:async()=>{try{await N.post(`web/tasks/${p}/confirm-stage`,{json:{stageName:d.stageName,approved:!1}}),Y()}catch{me.error(a("tasks.confirm_failed"))}},className:"flex-1 md:flex-none rounded-[4px] bg-[#1a1a1a] px-4 py-2.5 md:py-2 text-[11px] text-[var(--destructive)]",style:{border:"1px solid rgba(239,68,68,0.27)"},children:a("tasks.reject")})]})]}),e.jsxs("div",{className:"flex flex-col gap-3 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 lg:hidden",children:[e.jsx("span",{className:"text-xs font-bold text-[var(--accent)]",children:a("tasks.task_info")}),e.jsxs("div",{className:"flex flex-col gap-1.5 text-[11px]",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"status"}),e.jsx("span",{className:"font-bold text-[var(--warning)]",children:"suspended"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"project"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.projectKey})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"worker"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.workerName??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"created"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:ee(t.createdAt)})]})]})]}),e.jsx("div",{className:"hidden md:flex flex-wrap items-center gap-2 py-2",children:j.map((s,c)=>{const m=s.status==="failed",u=s.status==="completed",$=s.status==="running"&&t.status===W.SUSPENDED,U=m?"var(--destructive)":u?"var(--accent)":$?"var(--warning)":"#525252",Z=m?"rgba(239,68,68,0.12)":u?"rgba(34,197,94,0.12)":$?"rgba(245,158,11,0.12)":"transparent";return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"rounded-[4px] px-2.5 py-1 text-[11px]",style:{color:U,backgroundColor:Z,fontWeight:$?700:400,border:$?`1px solid ${U}`:void 0},children:$?"confirm":`${s.name}${u?" ✓":m?" ✗":""}`}),c<j.length-1&&e.jsx("div",{className:"h-px w-6 bg-[var(--border)]"})]},s.name)})}),e.jsxs("div",{className:"hidden md:block min-h-[200px] flex-1 rounded-[4px] border border-[var(--border)] bg-[#0c0c0c] p-4",children:[e.jsx("p",{className:"mb-2 text-[11px] font-bold text-[var(--accent)]",children:a("tasks.pty_output")}),e.jsxs("div",{className:"flex flex-col gap-1",children:[v.slice(-10).map((s,c)=>e.jsx("p",{className:"text-[11px] leading-relaxed text-[var(--text-secondary)]",children:s},c)),v.length===0&&e.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.no_output")})]})]})]}),e.jsxs("div",{className:"hidden w-[280px] shrink-0 flex-col gap-4 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 lg:flex",children:[e.jsx("span",{className:"text-[13px] font-bold text-[var(--accent)]",children:a("tasks.task_info")}),e.jsxs("div",{className:"flex flex-col gap-1.5 text-[11px]",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"status"}),e.jsx("span",{className:"font-bold text-[var(--warning)]",children:"suspended"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"project"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.projectKey})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"worker"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.workerName??"-"})]})]}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsx("span",{className:"text-xs font-bold text-[var(--accent)]",children:a("tasks.stage_timeline")}),e.jsx("div",{className:"flex flex-col gap-2",children:j.map(s=>{const c=s.status==="completed"?"var(--info)":s.status==="failed"?"var(--destructive)":s.status==="running"?"var(--warning)":"#525252",m=s.status==="failed"?"var(--destructive)":s.status==="running"?"var(--warning)":"#a3a3a3",u=s.status==="completed"?"completed":s.status==="running"?"suspended":s.status==="failed"?"failed":"pending";return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"h-2 w-2 shrink-0 rounded-[4px]",style:{backgroundColor:c}}),e.jsxs("span",{className:"text-[11px]",style:{color:m,fontWeight:s.status==="running"?700:400},children:[s.name," ",u]})]},s.name)})}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsx("div",{className:"flex flex-col gap-1.5 text-[11px]",children:e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"created"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:ee(t.createdAt)})]})})]})]}),d&&e.jsx(Ie,{isOpen:!!d,onClose:ye,taskId:p,stageName:d.stageName,timeoutSeconds:Math.ceil(d.timeout/1e3),onSubmitted:Y}),ce]}):e.jsxs("div",{className:"flex h-full flex-col overflow-hidden font-mono lowercase",children:[ke,e.jsxs("div",{className:"flex flex-wrap items-center gap-3 gap-y-1 border-b border-[var(--border)] bg-[var(--bg-primary)] px-4 py-2 shrink-0 md:hidden",children:[e.jsx(de,{status:t.status}),e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:t.projectKey}),t.workerName&&e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:t.workerName}),t.branch&&(te(i,t.branch)?e.jsx("a",{href:te(i,t.branch),target:"_blank",rel:"noopener noreferrer",className:"shrink-0 text-[11px] text-[var(--text-muted)] hover:text-[var(--info)] hover:underline truncate max-w-[80px] md:max-w-[120px] transition-colors",children:t.branch}):e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)] truncate max-w-[80px] md:max-w-[120px]",children:t.branch}))]}),le,t.errorMessage&&e.jsxs("div",{className:"flex items-center gap-2 border-b px-6 py-2 text-xs shrink-0 bg-[var(--destructive)]/10 text-[var(--destructive)]",style:{borderColor:"rgba(239,68,68,0.2)"},children:["// error: ",t.errorMessage]}),d&&e.jsx(Ie,{isOpen:!!d,onClose:ye,taskId:p,stageName:d.stageName,timeoutSeconds:Math.ceil(d.timeout/1e3),onSubmitted:Y}),e.jsxs("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[e.jsx("div",{className:"flex items-center border-b border-[var(--border)] shrink-0 overflow-x-auto no-scrollbar",children:["terminal","pipeline","logs"].map(s=>e.jsx("button",{onClick:()=>h(s),className:`shrink-0 whitespace-nowrap px-4 py-2.5 text-xs transition-colors ${g===s?"border-b-2 border-[var(--accent)] text-[var(--accent)] font-medium":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:a(s==="terminal"?"tasks.terminal":s==="pipeline"?"tasks.pipeline_tab":"tasks.logs")},s))}),g==="terminal"&&e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-3 md:px-5 shrink-0",style:{height:36,backgroundColor:"#111111"},children:[e.jsxs("div",{className:"flex items-center gap-2 md:gap-3",children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:a("tasks.pty_terminal")}),e.jsxs("span",{className:`inline-flex items-center gap-1 text-[11px] ${k==="connected"?"text-[var(--accent)]":k==="connecting"?"text-[var(--warning)]":"text-[var(--text-muted)]"}`,children:[e.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${k==="connected"?"bg-[var(--accent)]":k==="connecting"?"bg-[var(--warning)]":"bg-[#525252]"}`}),a(`tasks.${k}`)]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[!f&&X==="auto"&&e.jsxs("button",{onClick:()=>{var s;return(s=O.current)==null?void 0:s.requestTakeover()},className:"flex items-center gap-1.5 rounded-[4px] px-2.5 h-10 md:h-8 text-[11px] font-medium text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:[e.jsx(Te,{className:"h-3 w-3"}),a("tasks.take_over")]}),!f&&X==="manual"&&e.jsxs("button",{onClick:()=>{var s;return(s=O.current)==null?void 0:s.releaseTakeover()},className:"flex items-center gap-1.5 rounded-[4px] px-2.5 h-10 md:h-8 text-[11px] font-medium text-[var(--accent)]",style:{backgroundColor:"rgba(34,197,94,0.12)"},children:[e.jsx(xe,{className:"h-3 w-3"}),a("tasks.restore_auto")]}),!f&&X==="requesting"&&e.jsxs("span",{className:"flex items-center gap-1.5 px-2.5 h-10 md:h-8 text-[11px] text-[var(--warning)]",children:[e.jsx(oe,{className:"h-3 w-3 animate-spin"}),a("tasks.requesting_takeover")]}),!f&&t.currentStage&&e.jsxs("button",{className:"hidden md:flex items-center gap-1.5 rounded-[4px] bg-[var(--bg-card)] px-2.5 h-10 md:h-8 text-[11px] text-[var(--text-muted)]",children:[e.jsx(ct,{className:"h-3 w-3"}),a("tasks.skip_stage")]}),e.jsx("button",{onClick:()=>he(!0),className:"hidden md:flex items-center rounded-[4px] bg-[var(--bg-card)] px-2.5 h-10 md:h-8 text-[var(--text-muted)]",children:e.jsx(nt,{className:"h-3 w-3"})})]})]}),e.jsxs("div",{className:"flex items-center gap-2 border-b border-[var(--border)] px-4 py-2 shrink-0 md:hidden",children:[e.jsx(de,{status:t.status}),t.workerName&&e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["on ",t.workerName]})]}),e.jsxs("div",{className:"border-b border-[var(--border)] px-4 py-3 shrink-0 md:hidden",children:[e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:a("tasks.stage_progress")}),e.jsx("div",{className:"mt-2 flex items-center gap-1 overflow-x-auto no-scrollbar pr-4",children:j.map((s,c)=>{const m=s.status==="completed",u=s.status==="running",U=s.status==="failed"?"var(--destructive)":m||u?"var(--accent)":"#525252";return e.jsxs("div",{className:"flex items-center",children:[e.jsxs("span",{className:"shrink-0 text-[11px] whitespace-nowrap",style:{color:U,fontWeight:u?600:400},children:[s.name,m?" ✓":u?" ...":""]}),c<j.length-1&&e.jsx("div",{className:"mx-1.5 h-px w-4 shrink-0",style:{backgroundColor:U}})]},s.name)})})]}),e.jsx("div",{className:"px-4 pt-3 pb-1 shrink-0 md:hidden",children:e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:a("tasks.pty_output")})}),e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(De,{ref:O,taskId:p,sessionId:t.currentSessionId??void 0,taskFinished:f,onStatusChange:ve,onTakeoverChange:be})}),we]}),g==="pipeline"&&e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto p-4 md:p-6 lg:p-8",children:[e.jsx("div",{className:"flex items-center py-4 mb-4 md:mb-5 overflow-x-auto no-scrollbar",children:j.map((s,c)=>{const m=s.status==="completed",u=s.status==="running",Z=s.status==="failed"?"var(--destructive)":m||u?"var(--accent)":"#525252";return e.jsxs("div",{className:"flex items-center",style:{flex:c<j.length-1?1:void 0},children:[e.jsxs("div",{className:"flex flex-col items-center gap-1.5",children:[e.jsxs("div",{className:"flex h-6 w-6 md:h-7 md:w-7 items-center justify-center rounded-full shrink-0",style:{backgroundColor:Z},children:[m&&e.jsx("span",{className:"text-[11px] md:text-xs font-semibold text-[#0c0c0c]",children:"✓"}),u&&e.jsx("span",{className:"h-2 w-2 md:h-2.5 md:w-2.5 rounded-full bg-[#0c0c0c]"})]}),e.jsx("span",{className:"text-[11px] font-medium whitespace-nowrap",style:{color:Z},children:s.name})]}),c<j.length-1&&e.jsx("div",{className:"mx-1 md:mx-2 h-0.5 flex-1 min-w-3 rounded-full",style:{backgroundColor:c<(ne>=0?ne:0)?"var(--accent)":"#525252"}})]},s.name)})}),t.currentStage&&e.jsxs("div",{className:"mb-4 md:mb-5 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 text-xs leading-relaxed",children:[e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// stage: ",t.currentStage," (",ne+1,"/",j.length,")"]}),t.startedAt&&e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// elapsed: ",ee(t.startedAt).replace(" ago","")]}),e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// retries: ",t.retryCount,"/2"]})]}),e.jsx("button",{onClick:()=>h("terminal"),className:"flex-1 min-h-[100px] rounded-[4px] border border-dashed border-[var(--border)] flex items-center justify-center gap-2 text-[11px] text-[var(--text-muted)] hover:border-[var(--accent)] hover:text-[var(--accent)] transition-colors",children:e.jsxs("span",{children:["// ",a("tasks.view_terminal")]})}),e.jsxs("div",{className:"mt-4 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 lg:hidden",children:[e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:a("tasks.task_info")}),e.jsxs("div",{className:"mt-2 flex flex-col gap-1.5 text-[11px]",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"project"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.projectKey})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"worker"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.workerName??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"branch"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.branch??"-"})]})]})]}),e.jsxs("div",{className:"flex flex-col gap-6 mt-4 lg:hidden",children:[e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:a("tasks.pipeline_stages")}),j.map(s=>{const c=s.status==="completed",m=s.status==="running",u=s.status==="failed";return e.jsxs("div",{className:`flex items-center gap-2 rounded-[4px] px-2 py-1.5 ${m?"bg-[var(--bg-input)]":""}`,children:[c&&e.jsx(Ee,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),m&&e.jsx(oe,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),u&&e.jsx(ie,{className:"h-3.5 w-3.5 shrink-0 text-[var(--destructive)]"}),s.status==="pending"&&e.jsx($e,{className:"h-3.5 w-3.5 shrink-0 text-[#525252]"}),e.jsx("span",{className:"text-xs",style:{color:c?"var(--accent)":m?"var(--text-primary)":u?"var(--destructive)":"#525252",fontWeight:m?500:400},children:m?`> ${s.name}`:s.name})]},s.name)})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:a("tasks.activity_log")}),v.length>0?e.jsx("div",{className:"flex flex-col gap-1.5",children:v.slice(-12).map((s,c)=>e.jsx("p",{className:"text-[11px] leading-relaxed text-[var(--text-muted)]",children:s},c))}):e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.no_activity")})]})]})]}),g==="logs"&&e.jsxs("div",{className:"flex flex-1 flex-col gap-3 md:gap-5 overflow-y-auto p-4 md:p-6 lg:p-8",children:[e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)] md:hidden",children:a("tasks.task_logs")}),e.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-center md:gap-3",children:[e.jsx("div",{className:"flex items-center gap-1 overflow-x-auto no-scrollbar md:hidden",children:["","error","system"].map(s=>e.jsx("button",{onClick:()=>{pe(s),B(0)},className:`shrink-0 rounded-[4px] px-2.5 py-1 text-[11px] ${q===s?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)]"}`,children:s||"all"},s))}),e.jsx("div",{className:"hidden md:block",children:e.jsx(tt,{value:q,onChange:s=>{pe(s),B(0)},options:[{value:"",label:"all"},{value:"stage_change",label:"stage_change"},{value:"info",label:"info"},{value:"warning",label:"warning"},{value:"error",label:"error"},{value:"system",label:"system"}],className:"w-36"})}),e.jsxs("div",{className:"flex flex-1 items-center gap-2 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2",children:[e.jsx(Ve,{className:"h-3.5 w-3.5 text-[var(--text-muted)]"}),e.jsx("input",{type:"text",placeholder:a("tasks.search_logs"),value:J,onChange:s=>{Oe(s.target.value),B(0)},className:"flex-1 bg-transparent text-xs text-[var(--text-primary)] outline-none placeholder:text-[var(--text-muted)]"})]})]}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[C.map((s,c)=>e.jsxs("div",{className:`flex items-start md:items-center gap-2 md:gap-4 rounded-[4px] px-2 md:px-3 py-2 text-[11px] md:text-xs ${c%2===0?"bg-[var(--bg-card)]":""}`,children:[e.jsx("span",{className:"shrink-0 text-[var(--text-muted)]",children:new Date(s.timestamp).toLocaleTimeString("en-US",{hour12:!1})}),e.jsx("span",{className:`shrink-0 font-medium ${mt(s.type)}`,children:s.type}),e.jsx("span",{className:"min-w-0 break-words md:truncate text-[var(--text-primary)]",children:s.message})]},s.id)),C.length===0&&!Fe&&e.jsx("p",{className:"py-8 text-center text-xs text-[var(--text-muted)]",children:a("tasks.no_log_entries")})]}),V>50&&e.jsxs("div",{className:"flex items-center justify-center gap-1",children:[Array.from({length:Math.ceil(V/50)}).slice(0,5).map((s,c)=>e.jsx("button",{onClick:()=>B(c),className:`rounded-[4px] px-2 py-1 text-xs ${z===c?"bg-[var(--accent)] text-black font-medium":"text-[var(--text-muted)] hover:text-[var(--text-primary)]"}`,children:c+1},c)),Math.ceil(V/50)>5&&e.jsx("button",{onClick:()=>B(z+1),disabled:z>=Math.ceil(V/50)-1,className:"rounded-[4px] px-2 py-1 text-xs text-[var(--text-muted)] disabled:opacity-30",children:">"})]})]})]}),g==="terminal"&&Ke,g==="pipeline"&&e.jsxs("div",{className:"hidden w-[420px] shrink-0 flex-col gap-5 overflow-y-auto border-l border-[var(--border)] bg-[var(--bg-primary)] p-5 lg:flex",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[13px] font-semibold text-[var(--accent)]",children:a("tasks.task_info")}),e.jsxs("div",{className:"flex flex-col gap-1.5 text-xs",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"project"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.projectKey})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"creator"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.creatorName??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"worker"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.workerName??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:a("common.created_at")}),e.jsx("span",{className:"text-[var(--text-primary)]",children:ee(t.createdAt)})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:a("tasks.form_agent_type")}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.agentType??"claude"})]})]})]}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[13px] font-semibold text-[var(--accent)]",children:a("tasks.workspace_section")}),e.jsxs("div",{className:"flex flex-col gap-1.5 text-xs",children:[e.jsxs("div",{className:"flex min-w-0 justify-between",children:[e.jsx("span",{className:"shrink-0 text-[var(--text-muted)]",children:"branch"}),e.jsx("span",{className:"ml-4 min-w-0 truncate text-[var(--text-primary)]",children:t.branch??(A==null?void 0:A.branch)??"-"})]}),e.jsxs("div",{className:"flex min-w-0 justify-between",children:[e.jsx("span",{className:"shrink-0 text-[var(--text-muted)]",children:"worktree"}),e.jsx("span",{className:"ml-4 min-w-0 truncate text-[var(--text-primary)]",children:(A==null?void 0:A.path)??"-"})]}),t.mrUrl&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:a("tasks.mr_link")}),e.jsx("a",{href:t.mrUrl,target:"_blank",rel:"noopener noreferrer",className:"font-medium text-[var(--info)] hover:underline",children:((Ce=t.mrUrl.match(/!?\d+$/))==null?void 0:Ce[0])??"view"})]})]})]}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsxs("div",{ref:ge,className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[13px] font-semibold text-[var(--accent)]",children:a("tasks.cursor_tunnel_section")}),t.workerId?e.jsx(xt,{taskId:p,taskFinished:f,compact:!0}):e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.no_worker_assigned")})]}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[13px] font-semibold text-[var(--accent)]",children:a("tasks.stage_timeline")}),e.jsx("div",{className:"flex flex-col gap-2 text-xs",children:j.map(s=>{const c=s.status==="completed"?"✓":s.status==="running"?"→":"·",m=s.status==="running"?"var(--accent)":s.status==="completed"?"var(--info)":s.status==="failed"?"var(--destructive)":"#525252",u=s.status==="completed"?"done":s.status==="running"?"running...":s.status==="failed"?"failed":"pending";return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-semibold",style:{color:m},children:c}),e.jsx("span",{className:s.status==="running"?"font-medium":"",style:{color:m},children:s.name}),e.jsxs("span",{className:"text-[11px]",style:{color:"#525252"},children:["— ",u]})]},s.name)})})]})]})]}),ce]})}export{wt as default};
@@ -1 +0,0 @@
1
- import{R as Y,f as $,a as q,j as e,l as V,u as X,i as Z,r as a,h as F,X as ee,k as te,q as se,H as re,t as J,n as E,s as ae,v as H}from"./index-D205WYza.js";import{a as oe,A as ne,u as le}from"./task-constants-a8NftfbJ.js";import{T as G}from"./TaskStatusBadge-B6mxAWy2.js";import{f as Q}from"./date-BdNtiQTP.js";import{S as D}from"./Select-8IQBiBBw.js";import{C as ie}from"./copy-DXSXnWX4.js";import{E as U}from"./EmptyState-i9jXL5NQ.js";import{T as W}from"./Skeleton-B3ZvE5gP.js";import{P as ce}from"./plus-BHkYD1iG.js";import"./status-colors-C6o-wKJJ.js";const de=Y.memo(function({task:t}){const m=$(),{t:p}=q(),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)]",title:t.description,children:V(t.description,50)}),e.jsx("td",{className:"py-3 pr-4",children:e.jsx(G,{status:t.status})}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:t.projectKey}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:t.developerName??t.creatorName??"-"}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:t.workerName??"—"}),e.jsx("td",{className:"py-3 font-mono text-xs text-[var(--text-muted)]",children:Q(t.createdAt,d)})]})});function xe({isOpen:o,onClose:t,projects:m,projectsLoading:p,onSubmit:d,isSubmitting:l}){const{t:r}=q();X(n=>n.user);const v=Z(),[i,S]=a.useState(""),[x,f]=a.useState(""),[j,h]=a.useState("feat"),[I,P]=a.useState(""),[A,w]=a.useState(""),[_,y]=a.useState(""),[C,g]=a.useState(""),[z,K]=a.useState([]),[b,k]=a.useState("");a.useEffect(()=>{o&&(S(""),f(""),h("feat"),P(""),w(""),y(""),g(""),k(""),v&&F.get("admin/developers").json().then(K).catch(()=>K([])))},[o,v]),a.useEffect(()=>{if(!o)return;function n(u){u.key==="Escape"&&t()}return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[o,t]);async function B(n){if(n.preventDefault(),k(""),!i||!x.trim()){k(r("tasks.project_and_description_required"));return}try{await d({projectKey:i,description:x.trim(),workerId:_||void 0,developerId:C?Number(C):void 0,taskType:j,branchSlug:A.trim()||void 0,agentType:I||void 0})}catch(u){const N=u instanceof Error?u.message:r("tasks.failed_to_create_task");k(N)}}return o?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 font-mono",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},onClick:n=>{n.target===n.currentTarget&&t()},children:e.jsxs("div",{className:"w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",onClick:n=>n.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-6 py-4",children:[e.jsxs("h2",{className:"text-sm text-[var(--text-primary)]",children:["// ",r("tasks.new_task")]}),e.jsx("button",{onClick:t,className:"text-[var(--text-muted)] transition-colors hover:text-[var(--text-primary)]",children:e.jsx(ee,{className:"h-4 w-4"})})]}),e.jsxs("form",{onSubmit:B,className:"px-6 py-5",children:[e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.project")}),e.jsx(D,{value:i,onChange:S,options:m.map(n=>({value:n.key,label:n.name})),placeholder:r(p?"common.loading":"tasks.select_project"),disabled:p})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.task_type")}),e.jsx(D,{value:j,onChange:h,options:oe})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.form_agent_type")}),e.jsx(D,{value:I,onChange:P,options:ne})]}),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:n=>f(n.target.value),placeholder:r("tasks.describe_task_placeholder"),rows:4,className:"w-full resize-none rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.target_worker")}),e.jsx("input",{type:"text",value:_,onChange:n=>y(n.target.value),placeholder:r("tasks.any_able"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.branch_slug")}),e.jsx("input",{type:"text",value:A,onChange:n=>w(n.target.value),placeholder:r("tasks.branch_slug_placeholder"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),v&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.assign_developer")}),e.jsx(D,{value:C,onChange:g,options:z.map(n=>({value:String(n.id),label:n.name})),placeholder:r("tasks.select_developer")})]}),b&&e.jsx("div",{className:"rounded-[4px] bg-[#2a1515] border border-[var(--destructive)]/30 px-3 py-2 text-xs text-[var(--destructive)]",children:b})]}),e.jsxs("div",{className:"mt-6 flex items-center justify-end gap-3",children:[e.jsx("button",{type:"button",onClick:t,className:"rounded-[4px] border border-[var(--border)] bg-transparent px-4 py-2 text-xs text-[var(--text-secondary)] transition-colors hover:text-[var(--text-primary)]",children:r("common.cancel")}),e.jsx("button",{type:"submit",disabled:l||!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 pe({isOpen:o,onClose:t,onForceCreate:m,onViewExisting:p,similarTask:d,isLoading:l}){const{t:r}=q();return!d||!o?null:e.jsx("div",{onClick:t,style:{position:"fixed",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},children:e.jsxs("div",{onClick:v=>v.stopPropagation(),style:{width:"100%",maxWidth:"480px",backgroundColor:"var(--bg-card)",border:"1px solid var(--border)",borderRadius:"4px",padding:"1.5rem",fontFamily:"'JetBrains Mono', monospace"},children:[e.jsxs("div",{style:{marginBottom:"1.25rem"},children:[e.jsxs("div",{style:{color:"var(--accent)",fontSize:"0.875rem",fontWeight:600,display:"flex",alignItems:"center",gap:"0.5rem"},children:[e.jsx(ie,{style:{width:"1rem",height:"1rem"}}),r("tasks.dedup_title")]}),e.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.7rem",marginTop:"0.25rem"},children:r("tasks.dedup_description")})]}),e.jsxs("div",{style:{marginBottom:"1.25rem",padding:"0.75rem",border:"1px solid var(--border)",borderRadius:"4px",backgroundColor:"var(--bg-primary)"},children:[e.jsxs("div",{style:{color:"var(--text-muted)",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace"},children:["#",d.id," · ",d.status]}),e.jsx("div",{style:{color:"var(--text-primary)",fontSize:"0.75rem",marginTop:"0.375rem",lineHeight:"1.5"},children:d.description})]}),e.jsxs("div",{style:{display:"flex",gap:"0.75rem"},children:[e.jsx("button",{type:"button",onClick:t,disabled:l,className:"text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:border-[var(--text-muted)]",style:{flex:1,padding:"0.5rem",backgroundColor:"transparent",border:"1px solid var(--border)",borderRadius:"4px",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:l?"not-allowed":"pointer",opacity:l?.7:1,transition:"color 0.15s, border-color 0.15s"},children:r("common.cancel")}),e.jsx("button",{type:"button",onClick:()=>p(d.id),style:{flex:1,padding:"0.5rem",backgroundColor:"transparent",color:"var(--text-muted)",border:"1px solid var(--border)",borderRadius:"4px",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:"pointer"},children:r("tasks.view_existing")}),e.jsx("button",{type:"button",onClick:m,disabled:l,style:{flex:1,padding:"0.5rem",backgroundColor:"var(--warning)",color:"#0C0C0C",border:"none",borderRadius:"4px",fontSize:"0.75rem",fontWeight:600,fontFamily:"'JetBrains Mono', monospace",cursor:l?"not-allowed":"pointer",opacity:l?.7:1},children:r(l?"common.creating":"tasks.dedup_create_anyway")})]})]})})}function me({task:o}){const t=$();return e.jsxs("div",{onClick:()=>t(`/tasks/${o.id}`),className:"cursor-pointer rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 transition-colors active:bg-[var(--bg-input)]",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("span",{className:"text-[11px] text-[var(--text-primary)] leading-tight line-clamp-2",title:`#${o.id} ${o.description}`,children:["#",o.id," ",o.description]}),e.jsx("span",{className:"shrink-0",children:e.jsx(G,{status:o.status})})]}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-2 text-[11px] text-[var(--text-muted)]",children:[e.jsx("span",{children:Q(o.createdAt)}),e.jsx("span",{children:"·"}),e.jsx("span",{children:o.projectKey}),o.workerName&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("span",{children:o.workerName})]})]})]})}const ue=[{key:"all",labelKey:"tasks.tab_all"},{key:E.RUNNING,labelKey:"tasks.tab_running"},{key:E.QUEUED,labelKey:"tasks.tab_queued"},{key:E.COMPLETED,labelKey:"tasks.tab_completed"},{key:E.FAILED,labelKey:"tasks.tab_failed"},{key:E.CANCELLED,labelKey:"tasks.tab_cancelled"}],R=20;function we(){const o=$(),{t}=q(),{tasks:m,loading:p,fetchTasks:d}=le(),l=te(s=>s.taskSeq),[r,v]=a.useState("all"),[i,S]=a.useState(""),[x,f]=a.useState(1),[j,h]=a.useState(!1);se(a.useMemo(()=>e.jsxs("button",{onClick:()=>h(!0),className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs font-mono text-black transition-opacity hover:opacity-90",children:[e.jsx(ce,{className:"h-3.5 w-3.5"}),t("tasks.new_task")]}),[t]));const[I,P]=a.useState([]),[A,w]=a.useState(!1),[_,y]=a.useState(!1),[C,g]=a.useState(!1),[z,K]=a.useState(null),[b,k]=a.useState(null);a.useEffect(()=>{const s={limit:String(R)};r!=="all"&&(s.status=r),d(s)},[r,d,l]),a.useEffect(()=>{f(1)},[i]),a.useEffect(()=>{j&&(w(!0),F.get("web/projects").json().then(s=>P(s)).catch(()=>{}).finally(()=>w(!1)))},[j]);const B=a.useCallback(async s=>{y(!0);try{const c=await F.post("web/tasks",{json:{projectKey:s.projectKey,description:s.description,workerId:s.workerId,developerId:s.developerId,taskType:s.taskType,branchSlug:s.branchSlug,agentType:s.agentType}}).json();h(!1),o(`/tasks/${c.task.id}`)}catch(c){if(c instanceof re&&c.response.status===409){try{const T=await c.response.json();if(T.confirmRequired){K({id:T.confirmRequired.taskId,description:T.confirmRequired.message,status:"active"}),k(s),h(!1),g(!0);return}}catch{}J.error(t("tasks.similar_task_exists"))}else{const T=c instanceof Error?c.message:String(c);J.error(T)}}finally{y(!1)}},[o]),n=a.useCallback(async()=>{if(b){y(!0);try{const s=await F.post("web/tasks",{json:{projectKey:b.projectKey,description:b.description,workerId:b.workerId,force:!0}}).json();g(!1),o(`/tasks/${s.task.id}`)}finally{y(!1)}}},[b,o]),u=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]),N=Math.max(1,Math.ceil(u.length/R)),M=u.slice((x-1)*R,x*R),O=t(i?"tasks.try_adjusting_search":"tasks.create_first_task"),L=i?void 0:e.jsx("button",{onClick:()=>h(!0),className:"rounded-[4px] bg-[var(--accent)] px-5 py-2 text-[11px] font-bold text-black",children:t("tasks.create_task")});return e.jsxs("div",{className:"mx-auto max-w-6xl px-2 py-4 md:px-4 md:py-6 font-mono",children:[e.jsxs("div",{className:"mb-4 flex flex-col gap-3 md:gap-4 md:flex-row md:items-center",children:[e.jsx("div",{className:"flex items-center gap-1 overflow-x-auto pb-1 md:pb-0 no-scrollbar pr-4 md:pr-0",children:ue.map(s=>e.jsx("button",{onClick:()=>v(s.key),className:`shrink-0 rounded-[4px] px-3 py-2 h-10 md:h-8 text-xs transition-colors ${r===s.key?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)] bg-[var(--bg-card)] hover:text-[var(--text-secondary)]"}`,children:t(s.labelKey)},s.key))}),e.jsxs("div",{className:"relative md:ml-auto md:w-64",children:[e.jsx(ae,{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=>S(s.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] py-1.5 pl-8 pr-3 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"}),i&&e.jsx("button",{onClick:()=>S(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-xs text-[var(--text-muted)] hover:text-[var(--text-secondary)]",children:"x"})]})]}),e.jsx("div",{className:"hidden md:block rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:e.jsxs("table",{className:"w-full text-left",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] text-[11px] font-medium text-[#525252]",children:[e.jsx("th",{className:"w-16 px-4 py-2.5 text-right",children:t("tasks.id")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.description_col")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.status_col")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.project_col")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.assignee")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.worker")}),e.jsx("th",{className:"px-4 py-2.5",children:t("tasks.time")})]})}),e.jsxs("tbody",{children:[p&&M.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"p-4",children:e.jsx(W,{rows:5})})}),!p&&u.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"p-4",children:e.jsx(U,{icon:H,title:t("tasks.no_tasks_found"),description:O,action:L})})}),M.map(s=>e.jsx(de,{task:s},s.id))]})]})}),e.jsxs("div",{className:"flex flex-col gap-2 md:hidden",children:[p&&M.length===0&&e.jsx("div",{className:"p-4",children:e.jsx(W,{rows:5})}),!p&&u.length===0&&e.jsx(U,{icon:H,title:t("tasks.no_tasks_found"),description:O,action:L}),M.map(s=>e.jsx(me,{task:s},s.id))]}),N>1&&e.jsxs("div",{className:"mt-6 flex items-center justify-center gap-1",children:[e.jsx("button",{onClick:()=>f(Math.max(1,x-1)),disabled:x===1,className:"rounded-[4px] px-2 py-1 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] disabled:opacity-30 min-w-[44px] min-h-[44px] flex items-center justify-center",children:t("tasks.prev")}),Array.from({length:N},(s,c)=>c+1).map(s=>e.jsx("button",{onClick:()=>f(s),className:`rounded-[4px] px-2.5 py-1 text-xs transition-colors min-w-[44px] min-h-[44px] flex items-center justify-center ${x===s?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:s},s)),e.jsx("button",{onClick:()=>f(Math.min(N,x+1)),disabled:x===N,className:"rounded-[4px] px-2 py-1 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] disabled:opacity-30 min-w-[44px] min-h-[44px] flex items-center justify-center",children:t("common.next")})]}),e.jsx(xe,{isOpen:j,onClose:()=>h(!1),projects:I,projectsLoading:A,onSubmit:B,isSubmitting:_}),e.jsx(pe,{isOpen:C,onClose:()=>g(!1),onForceCreate:n,onViewExisting:s=>{g(!1),o(`/tasks/${s}`)},similarTask:z,isLoading:_})]})}export{we as default};