@overlordai/server 1.0.175 → 1.0.176

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 (289) hide show
  1. package/database/migrations/020-connectors.sql +48 -0
  2. package/database/migrations/021-task-design-context.sql +17 -0
  3. package/dist/adapters/command-parser.utils.d.ts +1 -0
  4. package/dist/adapters/command-parser.utils.d.ts.map +1 -1
  5. package/dist/adapters/command-parser.utils.js +9 -0
  6. package/dist/adapters/command-parser.utils.js.map +1 -1
  7. package/dist/adapters/nlu.service.d.ts.map +1 -1
  8. package/dist/adapters/nlu.service.js +4 -1
  9. package/dist/adapters/nlu.service.js.map +1 -1
  10. package/dist/app.module.d.ts.map +1 -1
  11. package/dist/app.module.js +2 -0
  12. package/dist/app.module.js.map +1 -1
  13. package/dist/connectors/connector-closure.service.d.ts +16 -0
  14. package/dist/connectors/connector-closure.service.d.ts.map +1 -0
  15. package/dist/connectors/connector-closure.service.js +97 -0
  16. package/dist/connectors/connector-closure.service.js.map +1 -0
  17. package/dist/connectors/connector-dispatch.service.d.ts +30 -0
  18. package/dist/connectors/connector-dispatch.service.d.ts.map +1 -0
  19. package/dist/connectors/connector-dispatch.service.js +226 -0
  20. package/dist/connectors/connector-dispatch.service.js.map +1 -0
  21. package/dist/connectors/connector.constants.d.ts +4 -0
  22. package/dist/connectors/connector.constants.d.ts.map +1 -0
  23. package/dist/connectors/connector.constants.js +12 -0
  24. package/dist/connectors/connector.constants.js.map +1 -0
  25. package/dist/connectors/connector.controller.d.ts +20 -0
  26. package/dist/connectors/connector.controller.d.ts.map +1 -0
  27. package/dist/connectors/connector.controller.js +166 -0
  28. package/dist/connectors/connector.controller.js.map +1 -0
  29. package/dist/connectors/connector.interface.d.ts +61 -0
  30. package/dist/connectors/connector.interface.d.ts.map +1 -0
  31. package/dist/connectors/connector.interface.js +3 -0
  32. package/dist/connectors/connector.interface.js.map +1 -0
  33. package/dist/connectors/connector.module.d.ts +3 -0
  34. package/dist/connectors/connector.module.d.ts.map +1 -0
  35. package/dist/connectors/connector.module.js +50 -0
  36. package/dist/connectors/connector.module.js.map +1 -0
  37. package/dist/connectors/connector.registry.d.ts +15 -0
  38. package/dist/connectors/connector.registry.d.ts.map +1 -0
  39. package/dist/connectors/connector.registry.js +48 -0
  40. package/dist/connectors/connector.registry.js.map +1 -0
  41. package/dist/connectors/design-context.service.d.ts +21 -0
  42. package/dist/connectors/design-context.service.d.ts.map +1 -0
  43. package/dist/connectors/design-context.service.js +77 -0
  44. package/dist/connectors/design-context.service.js.map +1 -0
  45. package/dist/connectors/design-review-trigger.service.d.ts +15 -0
  46. package/dist/connectors/design-review-trigger.service.d.ts.map +1 -0
  47. package/dist/connectors/design-review-trigger.service.js +98 -0
  48. package/dist/connectors/design-review-trigger.service.js.map +1 -0
  49. package/dist/connectors/figma/figma-url-parser.d.ts +12 -0
  50. package/dist/connectors/figma/figma-url-parser.d.ts.map +1 -0
  51. package/dist/connectors/figma/figma-url-parser.js +28 -0
  52. package/dist/connectors/figma/figma-url-parser.js.map +1 -0
  53. package/dist/connectors/figma/figma.client.d.ts +67 -0
  54. package/dist/connectors/figma/figma.client.d.ts.map +1 -0
  55. package/dist/connectors/figma/figma.client.js +67 -0
  56. package/dist/connectors/figma/figma.client.js.map +1 -0
  57. package/dist/connectors/figma/figma.connector.d.ts +29 -0
  58. package/dist/connectors/figma/figma.connector.d.ts.map +1 -0
  59. package/dist/connectors/figma/figma.connector.js +223 -0
  60. package/dist/connectors/figma/figma.connector.js.map +1 -0
  61. package/dist/connectors/figma/index.d.ts +4 -0
  62. package/dist/connectors/figma/index.d.ts.map +1 -0
  63. package/dist/connectors/figma/index.js +10 -0
  64. package/dist/connectors/figma/index.js.map +1 -0
  65. package/dist/connectors/issue-ref-helpers.d.ts +10 -0
  66. package/dist/connectors/issue-ref-helpers.d.ts.map +1 -0
  67. package/dist/connectors/issue-ref-helpers.js +24 -0
  68. package/dist/connectors/issue-ref-helpers.js.map +1 -0
  69. package/dist/connectors/issue-ref-parser.d.ts +22 -0
  70. package/dist/connectors/issue-ref-parser.d.ts.map +1 -0
  71. package/dist/connectors/issue-ref-parser.js +35 -0
  72. package/dist/connectors/issue-ref-parser.js.map +1 -0
  73. package/dist/connectors/issue-ref-resolver.service.d.ts +44 -0
  74. package/dist/connectors/issue-ref-resolver.service.d.ts.map +1 -0
  75. package/dist/connectors/issue-ref-resolver.service.js +226 -0
  76. package/dist/connectors/issue-ref-resolver.service.js.map +1 -0
  77. package/dist/connectors/jira/jira.client.d.ts +58 -0
  78. package/dist/connectors/jira/jira.client.d.ts.map +1 -0
  79. package/dist/connectors/jira/jira.client.js +70 -0
  80. package/dist/connectors/jira/jira.client.js.map +1 -0
  81. package/dist/connectors/jira/jira.connector.d.ts +17 -0
  82. package/dist/connectors/jira/jira.connector.d.ts.map +1 -0
  83. package/dist/connectors/jira/jira.connector.js +141 -0
  84. package/dist/connectors/jira/jira.connector.js.map +1 -0
  85. package/dist/connectors/sentry/sentry.client.d.ts +54 -0
  86. package/dist/connectors/sentry/sentry.client.d.ts.map +1 -0
  87. package/dist/connectors/sentry/sentry.client.js +69 -0
  88. package/dist/connectors/sentry/sentry.client.js.map +1 -0
  89. package/dist/connectors/sentry/sentry.connector.d.ts +17 -0
  90. package/dist/connectors/sentry/sentry.connector.d.ts.map +1 -0
  91. package/dist/connectors/sentry/sentry.connector.js +173 -0
  92. package/dist/connectors/sentry/sentry.connector.js.map +1 -0
  93. package/dist/connectors/webhook-comment-parser.d.ts +18 -0
  94. package/dist/connectors/webhook-comment-parser.d.ts.map +1 -0
  95. package/dist/connectors/webhook-comment-parser.js +28 -0
  96. package/dist/connectors/webhook-comment-parser.js.map +1 -0
  97. package/dist/database/repositories/connector.repository.d.ts +84 -0
  98. package/dist/database/repositories/connector.repository.d.ts.map +1 -0
  99. package/dist/database/repositories/connector.repository.js +222 -0
  100. package/dist/database/repositories/connector.repository.js.map +1 -0
  101. package/dist/database/repositories/developer.repository.d.ts +6 -1
  102. package/dist/database/repositories/developer.repository.d.ts.map +1 -1
  103. package/dist/database/repositories/developer.repository.js +19 -1
  104. package/dist/database/repositories/developer.repository.js.map +1 -1
  105. package/dist/database/repositories/external-issue-link.repository.d.ts +27 -0
  106. package/dist/database/repositories/external-issue-link.repository.d.ts.map +1 -0
  107. package/dist/database/repositories/external-issue-link.repository.js +85 -0
  108. package/dist/database/repositories/external-issue-link.repository.js.map +1 -0
  109. package/dist/database/repositories/task-design-context.repository.d.ts +33 -0
  110. package/dist/database/repositories/task-design-context.repository.d.ts.map +1 -0
  111. package/dist/database/repositories/task-design-context.repository.js +76 -0
  112. package/dist/database/repositories/task-design-context.repository.js.map +1 -0
  113. package/dist/database/repository.module.d.ts.map +1 -1
  114. package/dist/database/repository.module.js +6 -0
  115. package/dist/database/repository.module.js.map +1 -1
  116. package/dist/dispatcher/dedup.service.d.ts +1 -1
  117. package/dist/dispatcher/dedup.service.d.ts.map +1 -1
  118. package/dist/dispatcher/dedup.service.js +2 -2
  119. package/dist/dispatcher/dedup.service.js.map +1 -1
  120. package/dist/dispatcher/dispatcher.module.d.ts.map +1 -1
  121. package/dist/dispatcher/dispatcher.module.js +2 -1
  122. package/dist/dispatcher/dispatcher.module.js.map +1 -1
  123. package/dist/dispatcher/dispatcher.service.d.ts +7 -1
  124. package/dist/dispatcher/dispatcher.service.d.ts.map +1 -1
  125. package/dist/dispatcher/dispatcher.service.js +79 -8
  126. package/dist/dispatcher/dispatcher.service.js.map +1 -1
  127. package/dist/dispatcher/dispatcher.types.d.ts +26 -0
  128. package/dist/dispatcher/dispatcher.types.d.ts.map +1 -1
  129. package/dist/dispatcher/scheduler.service.d.ts +3 -1
  130. package/dist/dispatcher/scheduler.service.d.ts.map +1 -1
  131. package/dist/dispatcher/scheduler.service.js +16 -2
  132. package/dist/dispatcher/scheduler.service.js.map +1 -1
  133. package/dist/dispatcher/task-creation.service.d.ts +47 -3
  134. package/dist/dispatcher/task-creation.service.d.ts.map +1 -1
  135. package/dist/dispatcher/task-creation.service.js +26 -9
  136. package/dist/dispatcher/task-creation.service.js.map +1 -1
  137. package/dist/dispatcher/task-lifecycle.service.d.ts +5 -1
  138. package/dist/dispatcher/task-lifecycle.service.d.ts.map +1 -1
  139. package/dist/dispatcher/task-lifecycle.service.js +32 -3
  140. package/dist/dispatcher/task-lifecycle.service.js.map +1 -1
  141. package/dist/notifier/notification-consumer.d.ts +3 -1
  142. package/dist/notifier/notification-consumer.d.ts.map +1 -1
  143. package/dist/notifier/notification-consumer.js +26 -5
  144. package/dist/notifier/notification-consumer.js.map +1 -1
  145. package/dist/notifier/template.service.d.ts +6 -0
  146. package/dist/notifier/template.service.d.ts.map +1 -1
  147. package/dist/notifier/template.service.js +12 -0
  148. package/dist/notifier/template.service.js.map +1 -1
  149. package/dist/web/admin/admin-connector.controller.d.ts +58 -0
  150. package/dist/web/admin/admin-connector.controller.d.ts.map +1 -0
  151. package/dist/web/admin/admin-connector.controller.js +327 -0
  152. package/dist/web/admin/admin-connector.controller.js.map +1 -0
  153. package/dist/web/admin/admin-developer.controller.d.ts +1 -1
  154. package/dist/web/admin/admin-developer.controller.d.ts.map +1 -1
  155. package/dist/web/admin/admin-developer.controller.js +16 -5
  156. package/dist/web/admin/admin-developer.controller.js.map +1 -1
  157. package/dist/web/dashboard.controller.d.ts +1 -1
  158. package/dist/web/dashboard.service.d.ts +2 -7
  159. package/dist/web/dashboard.service.d.ts.map +1 -1
  160. package/dist/web/dashboard.service.js +16 -21
  161. package/dist/web/dashboard.service.js.map +1 -1
  162. package/dist/web/frame-handlers/review-report.handler.d.ts +3 -1
  163. package/dist/web/frame-handlers/review-report.handler.d.ts.map +1 -1
  164. package/dist/web/frame-handlers/review-report.handler.js +8 -3
  165. package/dist/web/frame-handlers/review-report.handler.js.map +1 -1
  166. package/dist/web/task.controller.d.ts +11 -1
  167. package/dist/web/task.controller.d.ts.map +1 -1
  168. package/dist/web/task.controller.js +118 -4
  169. package/dist/web/task.controller.js.map +1 -1
  170. package/dist/web/web.module.d.ts.map +1 -1
  171. package/dist/web/web.module.js +4 -1
  172. package/dist/web/web.module.js.map +1 -1
  173. package/dist/web/worker-channel.gateway.d.ts +3 -1
  174. package/dist/web/worker-channel.gateway.d.ts.map +1 -1
  175. package/dist/web/worker-channel.gateway.js +6 -3
  176. package/dist/web/worker-channel.gateway.js.map +1 -1
  177. package/package.json +4 -4
  178. package/public/assets/{AccessTokensPage-BlZBgj0-.js → AccessTokensPage-CoUlSpBu.js} +1 -1
  179. package/public/assets/{AdminPage-C0OFG0LC.js → AdminPage-BonHpbC8.js} +1 -1
  180. package/public/assets/{AgentCliPage-Ci2XVaN8.js → AgentCliPage-2zflW4gy.js} +1 -1
  181. package/public/assets/{ApiReferencePage-Dm9y-zCM.js → ApiReferencePage-BC8HEfcM.js} +1 -1
  182. package/public/assets/{ArchitecturePage-BetPO5Ws.js → ArchitecturePage-Da9rv0hg.js} +1 -1
  183. package/public/assets/{AuditLogPage-Dbd27v1s.js → AuditLogPage-BrF0T3MT.js} +1 -1
  184. package/public/assets/{AutomationCreatePage-BvSw8KoZ.js → AutomationCreatePage-DI-Z1v9e.js} +1 -1
  185. package/public/assets/{AutomationDetailPage-1Y2tp1KP.js → AutomationDetailPage-7TLMwELt.js} +1 -1
  186. package/public/assets/{AutomationEditPage-C9UO1XrW.js → AutomationEditPage-BuOKTyTf.js} +1 -1
  187. package/public/assets/{AutomationListPage-CJk8o3Vp.js → AutomationListPage-D4XF43yR.js} +1 -1
  188. package/public/assets/{AutomationRunDetailPage-h7T4V9Yq.js → AutomationRunDetailPage-BDhPEndz.js} +1 -1
  189. package/public/assets/{BindPlatformPage-DpzV1bpB.js → BindPlatformPage-DNamr2h_.js} +1 -1
  190. package/public/assets/{BotIntegrationPage-9kAG4BIL.js → BotIntegrationPage-DN665fG6.js} +1 -1
  191. package/public/assets/{BotManage-BanZ5a5-.js → BotManage-DvfKuBFx.js} +1 -1
  192. package/public/assets/{BotSetupPage-BZIfJYqL.js → BotSetupPage-DPsT5Ln6.js} +1 -1
  193. package/public/assets/{ChangelogPage-Da8n7_T3.js → ChangelogPage-D1_YfUwN.js} +1 -1
  194. package/public/assets/{Checkbox-Dsj1BuTd.js → Checkbox-D8xEau6n.js} +1 -1
  195. package/public/assets/{CliReferencePage-BDFsLYmx.js → CliReferencePage-DVtpCVyB.js} +1 -1
  196. package/public/assets/{ConfirmStageDialog-BUTA9YZ1.js → ConfirmStageDialog-Cu49oAnM.js} +1 -1
  197. package/public/assets/ConnectorsPage-DmC6MARl.js +48 -0
  198. package/public/assets/{DeploymentPage-B5TlN0FI.js → DeploymentPage-P3jrGKlU.js} +1 -1
  199. package/public/assets/{DevWorkflowPage-Abvhng0F.js → DevWorkflowPage-DDE9wLKC.js} +1 -1
  200. package/public/assets/DeveloperManage-Bpo7QRy5.js +16 -0
  201. package/public/assets/{DeveloperSetupPage-QipfVSjp.js → DeveloperSetupPage-CHz_5bNW.js} +1 -1
  202. package/public/assets/{DocsIndexPage-Dw-saIXq.js → DocsIndexPage-C8kNCHNc.js} +11 -6
  203. package/public/assets/{DocsLayout-BsGaDVp1.js → DocsLayout-CF22uAIS.js} +1 -1
  204. package/public/assets/{DocsPrimitives-Bv8TQpkc.js → DocsPrimitives-BhxcRaTm.js} +1 -1
  205. package/public/assets/{EditProjectPage-CtNCwK-z.js → EditProjectPage-D_3HRO1s.js} +1 -1
  206. package/public/assets/{EmptyState-BpbqIJyG.js → EmptyState-IvQHEoph.js} +1 -1
  207. package/public/assets/{EnvVariablesPage-D5Cn_E5P.js → EnvVariablesPage-DNuaFEmN.js} +1 -1
  208. package/public/assets/HomePage-B7S2lrwi.js +1 -0
  209. package/public/assets/{InfoRow-BCDb21nt.js → InfoRow-C_tQVkuP.js} +1 -1
  210. package/public/assets/{InstallationPage-DLW6MXhs.js → InstallationPage-CK1BUOe2.js} +1 -1
  211. package/public/assets/{LandingPage-BLcQBvuD.js → LandingPage-DvR0mLWM.js} +1 -1
  212. package/public/assets/{LocalDevelopmentPage-BnbdovKe.js → LocalDevelopmentPage-C-5yQqhM.js} +1 -1
  213. package/public/assets/{LoginPage-Bh-p4hP9.js → LoginPage-BdTmOyQm.js} +1 -1
  214. package/public/assets/{MetricBar-DLR15rum.js → MetricBar-CKXN_2Ue.js} +1 -1
  215. package/public/assets/{MultiSelect-BKtGWYgt.js → MultiSelect-DegVW8UL.js} +1 -1
  216. package/public/assets/{NotFoundPage-BpUwim1l.js → NotFoundPage-V93x8tfy.js} +1 -1
  217. package/public/assets/{OnboardingGuide-BTsSW7Mq.js → OnboardingGuide-Crybb-Zh.js} +1 -1
  218. package/public/assets/{PermissionsPage-A828G2ih.js → PermissionsPage-BmehbFsh.js} +1 -1
  219. package/public/assets/{PipelineConfigPage-Cw1OxgKV.js → PipelineConfigPage-DZVU3Vkj.js} +1 -1
  220. package/public/assets/{PipelineEditorPage-tewviYrj.js → PipelineEditorPage-BH67Oewc.js} +1 -1
  221. package/public/assets/{PlanPage-Bidp5iEn.js → PlanPage-B4OhS9_O.js} +1 -1
  222. package/public/assets/{ProfilePage-DgFxZS6i.js → ProfilePage-DpMfRGms.js} +1 -1
  223. package/public/assets/{ProjectDetailPage-BoIU1U3V.js → ProjectDetailPage-BOvwgwui.js} +1 -1
  224. package/public/assets/{ProjectListPage-DMoN7Ghc.js → ProjectListPage-C2ZPh8P9.js} +1 -1
  225. package/public/assets/{PtyTerminal-QdM0LGge.js → PtyTerminal-DKh7d_-3.js} +1 -1
  226. package/public/assets/{QuickAuth-CGnZQLaj.js → QuickAuth-D2EErll5.js} +1 -1
  227. package/public/assets/{RemoveMemberConfirmDialog-uFuATit4.js → RemoveMemberConfirmDialog-Bnq4vIGU.js} +1 -1
  228. package/public/assets/ReviewAggregatePage-CTSuOo4O.js +6 -0
  229. package/public/assets/ReviewPage-Dx31QqyM.js +1 -0
  230. package/public/assets/{Select-CC0FnszM.js → Select-BXx8KPbW.js} +1 -1
  231. package/public/assets/{SettingsPage-DiecpWAG.js → SettingsPage-D3tDh7gu.js} +1 -1
  232. package/public/assets/{Skeleton-WCDZdltv.js → Skeleton-Crpru9Ol.js} +1 -1
  233. package/public/assets/{SkillPage-ABYkJSop.js → SkillPage-BiwP6aqc.js} +1 -1
  234. package/public/assets/TaskDetailPage-DHW9thUL.js +21 -0
  235. package/public/assets/{TaskGuidePage-CFzoePPd.js → TaskGuidePage-DD_jyUVW.js} +1 -1
  236. package/public/assets/TaskListPage-CBIv7NTp.js +1 -0
  237. package/public/assets/{TaskStatusBadge-CzUIb3QQ.js → TaskStatusBadge-Cfz28K6K.js} +1 -1
  238. package/public/assets/{TerminalHomePage-DP-gqkiq.js → TerminalHomePage-BmhBvY10.js} +1 -1
  239. package/public/assets/{TokenManage-CbLsJbR9.js → TokenManage-CYSBKzT7.js} +1 -1
  240. package/public/assets/{Tooltip-Ds3lc4sS.js → Tooltip-DZdu3ZKx.js} +1 -1
  241. package/public/assets/{TotpSetupPage-Bakhx3kM.js → TotpSetupPage-DP5q6oE-.js} +1 -1
  242. package/public/assets/{WorkerDetailPage-W_1tf-Ng.js → WorkerDetailPage-LMirCNtN.js} +1 -1
  243. package/public/assets/{WorkerListPage-DAgJojBW.js → WorkerListPage-q6siISS8.js} +1 -1
  244. package/public/assets/{WorkerOperationsPage-BE8gDr3P.js → WorkerOperationsPage-CGzqG_QM.js} +1 -1
  245. package/public/assets/{WorkerSetupGuidePage-Cjwu7yCO.js → WorkerSetupGuidePage-aVkDqrMr.js} +1 -1
  246. package/public/assets/{WorkerSetupPage-C4F2PDWx.js → WorkerSetupPage-C_zONAIf.js} +1 -1
  247. package/public/assets/{agent-type-options-BTd_pbKQ.js → agent-type-options-BiSKx1a4.js} +1 -1
  248. package/public/assets/{arrow-left-Czit8jGK.js → arrow-left-sGTyHBvX.js} +1 -1
  249. package/public/assets/{arrow-right-DUvU3ZSE.js → arrow-right-_NIT1UtR.js} +1 -1
  250. package/public/assets/{bot-xYitrdXz.js → bot-CDSBtXc_.js} +1 -1
  251. package/public/assets/{chevron-down-DwSdaR46.js → chevron-down-CE0uuyBZ.js} +1 -1
  252. package/public/assets/{chevron-left-DMFdbT8q.js → chevron-left-C0Zw71uv.js} +1 -1
  253. package/public/assets/{chevron-right-BqoEBUXc.js → chevron-right-BCit7CZP.js} +1 -1
  254. package/public/assets/{chevron-up-4jZShvn6.js → chevron-up-Bl0OZM4v.js} +1 -1
  255. package/public/assets/{circle-alert-gAYg5DQY.js → circle-alert-rHCTliEW.js} +1 -1
  256. package/public/assets/{clock-Bn8CRcdc.js → clock-BwsbKSS6.js} +1 -1
  257. package/public/assets/{copy-_C7txolK.js → copy-h1a805Rd.js} +1 -1
  258. package/public/assets/{download-CGR9pdGa.js → download-URcu3Jx3.js} +1 -1
  259. package/public/assets/{external-link-DGEar13h.js → external-link-FhyMbjzB.js} +1 -1
  260. package/public/assets/{git-fork-bd2vu3ng.js → git-fork-Dc1BvdTN.js} +1 -1
  261. package/public/assets/{index-DAwsREkq.js → index-J1zWTACN.js} +13 -13
  262. package/public/assets/{key-b6kn-A1T.js → key-COdogDFT.js} +1 -1
  263. package/public/assets/{loader-circle-vH-Hp_AS.js → loader-circle-Bq_BpbZ2.js} +1 -1
  264. package/public/assets/{pencil-Cxzh8oiw.js → pencil-0fxibflK.js} +1 -1
  265. package/public/assets/{play-bFi1k4eQ.js → play-Dbk8Wgkn.js} +1 -1
  266. package/public/assets/{plus-DJTaWh3N.js → plus-V36Q_nxP.js} +1 -1
  267. package/public/assets/{rotate-ccw-CXFQ7046.js → rotate-ccw-ByVQRmQu.js} +1 -1
  268. package/public/assets/{scroll-text-UIbwyc0E.js → scroll-text-C2iOLXnA.js} +1 -1
  269. package/public/assets/{settings-DA_C9Znv.js → settings-DrgaMc9j.js} +1 -1
  270. package/public/assets/{skip-forward-C71GgwGt.js → skip-forward-SfkU0vVB.js} +1 -1
  271. package/public/assets/{status-colors-C14ffr9M.js → status-colors-IR97PkWv.js} +1 -1
  272. package/public/assets/{task-agent-BasiQZ0L.js → task-agent-BIYkVnlP.js} +1 -1
  273. package/public/assets/{task-constants-DihuKtBw.js → task-constants-07c7xWcv.js} +1 -1
  274. package/public/assets/{task.store-MpV9TV7z.js → task.store-DWG-SG1e.js} +1 -1
  275. package/public/assets/{timer-COkLkLUF.js → timer-IeRNhyK4.js} +1 -1
  276. package/public/assets/{trash-2-CDhJihtl.js → trash-2-DuFeqRaH.js} +1 -1
  277. package/public/assets/{useFetch-CgkGfhaP.js → useFetch-CZCaxaCi.js} +1 -1
  278. package/public/assets/{users-BwpIig9c.js → users-CG1y1K_u.js} +1 -1
  279. package/public/assets/{wifi-D5o6IWuC.js → wifi-Dvp0MK85.js} +1 -1
  280. package/public/assets/{workflow-DXTOpHef.js → workflow-qWh96h21.js} +1 -1
  281. package/public/assets/{zap-CEUF2oJs.js → zap-Cwv7x_Mg.js} +1 -1
  282. package/public/index.html +1 -1
  283. package/public/sw.js +1 -1
  284. package/public/assets/DeveloperManage-DPSHCC6K.js +0 -16
  285. package/public/assets/HomePage-BFNO_Hk6.js +0 -1
  286. package/public/assets/ReviewAggregatePage-D5S57j51.js +0 -6
  287. package/public/assets/ReviewPage-tkUY7vrY.js +0 -1
  288. package/public/assets/TaskDetailPage-D6qSqsm0.js +0 -21
  289. package/public/assets/TaskListPage-rDPMfjmN.js +0 -1
@@ -0,0 +1,21 @@
1
+ import{c as xe,a as de,r as n,A as P,h as f,j as e,H as Ht,t as $,s as Ee,B as Jt,f as Xt,F as Vt,p as Qt,q as Yt,k as ut,o as k,R as Zt,L as ie,l as ht,m as es,X as Ce,y as ts,U as ss,G as ft,b as as,I as Et,J as rs}from"./index-J1zWTACN.js";import{u as ns}from"./task.store-DWG-SG1e.js";import{P as vt}from"./PtyTerminal-DKh7d_-3.js";import{C as gt}from"./ConfirmStageDialog-Cu49oAnM.js";import{C as oe}from"./Checkbox-D8xEau6n.js";import{S as bt}from"./Select-BXx8KPbW.js";import{b as ls,f as Y,c as cs}from"./date-CmcdoD87.js";import{a as Tt}from"./status-colors-IR97PkWv.js";import{g as is,H as os}from"./task-agent-BIYkVnlP.js";import{a as jt}from"./agent-type-options-BiSKx1a4.js";import{T as xs,g as Z}from"./task-constants-07c7xWcv.js";import{T as ds}from"./Tooltip-DZdu3ZKx.js";import{A as ms}from"./arrow-left-sGTyHBvX.js";import{R as Lt}from"./rotate-ccw-ByVQRmQu.js";import{G as ps}from"./git-fork-Dc1BvdTN.js";import{P as Nt}from"./play-Dbk8Wgkn.js";import{E as yt}from"./external-link-FhyMbjzB.js";import{L as It}from"./loader-circle-Bq_BpbZ2.js";import{S as us}from"./skip-forward-SfkU0vVB.js";import"./clock-BwsbKSS6.js";import"./chevron-down-CE0uuyBZ.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 hs=xe("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 fs=xe("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/**
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 vs=xe("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"}]]);/**
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 gs=xe("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);function bs(l,c){const a=new Date(l).getTime()-Date.now();if(a<=0)return c("tasks.tunnel_expired");const r=Math.floor(a/36e5),t=Math.floor(a%36e5/6e4);return r>0?c("tasks.tunnel_expires_hm",{h:r,m:t}):c("tasks.tunnel_expires_m",{m:t})}function kt(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 wt(l,c){switch(l){case"IDLE":case"CLOSED":return c("tasks.tunnel_idle");case"STARTING":return c("tasks.tunnel_starting");case"CONNECTED":return c("tasks.tunnel_connected");case"EXPIRED":return c("tasks.tunnel_expired");case"CLOSING":return c("tasks.tunnel_closing");default:return String(l).toLowerCase()}}function js({taskId:l,taskFinished:c,compact:a}){const{t:r}=de(),[t,d]=n.useState(P.IDLE),[p,C]=n.useState(null),[h,M]=n.useState(null),[W,ee]=n.useState(""),[o,S]=n.useState(!1),[me,O]=n.useState(!1),F=n.useRef(null),R=n.useCallback(async()=>{try{const v=await f.get(`web/workspace-tunnel/${l}/status`).json();d(v.status),C(v.tunnelUrl??null),M(v.expiresAt??null),(v.status==="EXPIRED"||v.status==="IDLE"||v.status==="CLOSED")&&E()}catch{}},[l]);function pe(){E(),F.current=setInterval(R,5e3)}function E(){F.current&&(clearInterval(F.current),F.current=null)}n.useEffect(()=>{c&&(t===P.STARTING||t===P.CONNECTED)&&(d(P.IDLE),C(null),E())},[c,t]),n.useEffect(()=>{if(t!=="CONNECTED"||!h)return;const v=()=>{const T=bs(h,r);ee(T),T===r("tasks.tunnel_expired")&&(d(P.EXPIRED),C(null),E())};v();const D=setInterval(v,3e4);return()=>clearInterval(D)},[t,h]),n.useEffect(()=>()=>E(),[]),n.useEffect(()=>{c||R()},[R,c]);async function H(){S(!0);try{await f.post(`web/workspace-tunnel/${l}/start`),d(P.STARTING),pe()}catch(v){let D=r("tasks.tunnel_start_failed");try{if(v instanceof Ht){const T=await v.response.json();T!=null&&T.error&&(D=T.error,/code.*not found|ENOENT.*code|spawn code/i.test(D)&&(D+=". "+r("tasks.tunnel_install_code_hint")))}}catch{}$.error(D)}finally{S(!1)}}async function A(){S(!0);try{await f.post(`web/workspace-tunnel/${l}/stop`),d(P.IDLE),C(null),E()}catch{}finally{S(!1)}}async function U(){p&&(await navigator.clipboard.writeText(p),O(!0),setTimeout(()=>O(!1),2e3))}return a?e.jsxs("div",{className:"flex items-center gap-2 font-mono lowercase text-xs",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"ide_tunnel:"}),e.jsx("span",{style:{color:kt(t)},children:wt(t,r)}),(t==="IDLE"||t==="CLOSED"||t==="EXPIRED")&&e.jsx("button",{onClick:H,disabled:o,className:"rounded-[4px] px-2 py-1 text-[var(--info)] disabled:opacity-50",style:{backgroundColor:"rgba(59,130,246,0.12)"},children:r(o?"tasks.tunnel_starting":"tasks.tunnel_start")}),t==="CONNECTED"&&p&&e.jsx("a",{href:p.replace(/^https?:/,"cursor:"),target:"_blank",rel:"noopener noreferrer",className:"rounded-[4px] px-2 py-1 text-[var(--info)]",style:{backgroundColor:"rgba(59,130,246,0.12)"},children:r("tasks.tunnel_open_in_cursor")})]}):e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 font-mono lowercase",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:r("tasks.tunnel_header")}),e.jsxs("span",{className:"text-xs",style:{color:kt(t)},children:["● ",wt(t,r)]})]}),t==="CONNECTED"&&h&&e.jsxs("p",{className:"mb-2 text-xs text-[var(--text-muted)]",children:["// ",W]}),t==="CONNECTED"&&p&&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:p}),e.jsxs("button",{onClick:U,className:"shrink-0 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors","aria-label":r("tasks.tunnel_copy_url"),children:["[",r("common.copy"),"]"]})]}),me&&e.jsx("p",{className:"mb-2 text-xs text-[var(--accent)]",children:r("tasks.tunnel_copied")}),t==="STARTING"&&e.jsx("p",{className:"mb-3 text-xs text-[var(--text-muted)]",children:r("tasks.tunnel_waiting")}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[(t==="IDLE"||t==="CLOSED")&&e.jsx("button",{onClick:H,disabled:o,className:"rounded-[4px] border border-[var(--accent)]/40 px-3 py-1.5 text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors disabled:opacity-50",children:r(o?"tasks.tunnel_starting_button":"tasks.tunnel_start_button")}),t==="STARTING"&&e.jsx("button",{onClick:A,disabled:o,className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors disabled:opacity-50",children:r(o?"tasks.tunnel_stopping":"tasks.tunnel_cancel")}),t==="CONNECTED"&&p&&e.jsxs(e.Fragment,{children:[e.jsx("a",{href:p.replace(/^https?:/,"cursor:"),target:"_blank",rel:"noopener noreferrer",className:"rounded-[4px] border border-[var(--accent)]/40 px-3 py-1.5 text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors",children:r("tasks.tunnel_open_cursor")}),e.jsx("a",{href:p.replace(/^https?:/,"vscode:"),target:"_blank",rel:"noopener noreferrer",className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:r("tasks.tunnel_open_vscode")}),e.jsx("button",{onClick:A,disabled:o,className:"rounded-[4px] border border-[var(--destructive)]/40 px-3 py-1.5 text-[var(--destructive)] hover:bg-[var(--destructive)]/10 transition-colors disabled:opacity-50",children:r(o?"tasks.tunnel_stopping":"tasks.tunnel_stop")})]}),t==="EXPIRED"&&e.jsx("button",{onClick:H,disabled:o,className:"rounded-[4px] border border-[var(--accent)]/40 px-3 py-1.5 text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors disabled:opacity-50",children:r(o?"tasks.tunnel_starting_button":"tasks.tunnel_restart")})]})]})}function Ns({isOpen:l,onClose:c,onConfirm:a,taskId:r,isLoading:t}){const{t:d}=de();return e.jsx(Ee,{isOpen:l,onClose:c,onConfirm:a,title:d("tasks.cancel_task_title"),message:d("tasks.cancel_task_message",{id:String(r)}),confirmLabel:d("tasks.cancel_task_confirm_label"),confirmVariant:"danger",isLoading:t})}function ys({isOpen:l,onClose:c,onConfirm:a,taskId:r,mrUrl:t,isLoading:d,reuseWorkspace:p,onReuseWorkspaceChange:C}){const{t:h}=de(),M=t?h("tasks.retry_message_with_mr",{id:String(r),url:t}):h("tasks.retry_message_without_mr",{id:String(r)});return e.jsx(Ee,{isOpen:l,onClose:c,onConfirm:a,title:h("tasks.retry_title"),message:M,confirmLabel:h("tasks.retry_confirm_label"),confirmVariant:"accent",isLoading:d,children:e.jsx(oe,{checked:p,onCheckedChange:C,label:h("tasks.reuse_workspace_label"),containerClassName:"mt-3",labelClassName:"text-[var(--text-muted)]"})})}const we=["implement","test","verify","review","simplify","rebase","submit"],ks=["analyze","discuss","document","confirm"],ws=["review","report","fix"],_s=["review","report"],Cs=["analyze"];function Se(l){if(typeof l=="string")try{return Se(JSON.parse(l))}catch{return null}if(!l||typeof l!="object")return null;const c=l.stages;if(!Array.isArray(c)||c.length===0)return null;const a=c.map(r=>r&&typeof r=="object"?r.name:null).filter(r=>typeof r=="string"&&r.length>0);return a.length===c.length?a:null}function Ss(l){if(l.taskMode==="plan")return ks;if(l.taskMode==="automation")return Cs;if(l.taskMode==="review"){let c=!1;if(l.configSnapshot)try{c=!!JSON.parse(l.configSnapshot).skipFix}catch{}return c?_s:ws}if(!l.configSnapshot)return we;try{const c=JSON.parse(l.configSnapshot);return Se(c.pipeline)??Se(c)??we}catch{return we}}function Es(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 _e({status:l,agentType:c}){const a=Tt(l),r=Z(c);return e.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-[4px] px-2 py-0.5 text-xs",style:{color:a},children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-[3px]",style:{backgroundColor:a}}),l.toLowerCase()," / ",r]})}function _t({stages:l,runningBg:c="bg-[#1a1a1a]",py:a="py-1.5"}){return e.jsx(e.Fragment,{children:l.map(r=>{const t=r.status==="completed",d=r.status==="running",p=r.status==="failed";return e.jsxs("div",{className:`flex items-center gap-2 rounded-[4px] px-2 ${a} ${d?c:""}`,children:[t&&e.jsx(rs,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),d&&e.jsx(It,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),p&&e.jsx(Ce,{className:"h-3.5 w-3.5 shrink-0 text-[var(--destructive)]"}),r.status==="pending"&&e.jsx(hs,{className:"h-3.5 w-3.5 shrink-0 text-[#525252]"}),e.jsx("span",{className:"text-xs",style:{color:t?"var(--accent)":d?"#e5e5e5":p?"var(--destructive)":"#525252",fontWeight:d?500:400},children:d?`> ${r.name}`:r.name})]},r.name)})})}function Ct({task:l,ptyStatus:c,displayAgentType:a,t:r,gap:t="gap-2 md:gap-3"}){return e.jsxs("div",{className:`flex items-center ${t}`,children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:r("tasks.pty_terminal")}),e.jsxs("span",{className:`inline-flex items-center gap-1 text-[11px] ${c==="connected"?"text-[var(--accent)]":c==="connecting"?"text-[var(--warning)]":"text-[var(--text-muted)]"}`,children:[e.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${c==="connected"?"bg-[var(--accent)]":c==="connecting"?"bg-[var(--warning)]":"bg-[#525252]"}`}),r(`tasks.${c}`)]}),e.jsx("span",{className:"text-[11px]",style:{color:Tt(l.status)},children:l.status.toLowerCase()}),l.currentStage&&e.jsxs("span",{className:"hidden md:inline text-[11px] text-[var(--accent)]",children:[r("tasks.stage"),": ",l.currentStage]}),e.jsxs("span",{className:"hidden md:inline text-[11px] text-[var(--text-muted)]",children:["agent: ",a]}),l.workerName&&e.jsxs("span",{className:"hidden md:inline text-[11px] text-[var(--text-muted)]",children:["worker: ",l.workerName]})]})}function St({isFinished:l,takeoverState:c,ptyRef:a,t:r}){return e.jsxs(e.Fragment,{children:[!l&&c==="auto"&&e.jsxs("button",{onClick:()=>{var t;return(t=a.current)==null?void 0:t.requestTakeover()},className:"flex items-center gap-1.5 rounded-[4px] px-2.5 h-10 md:h-8 text-[11px] font-medium text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:[e.jsx(os,{className:"h-3 w-3"}),r("tasks.take_over")]}),!l&&c==="manual"&&e.jsxs("button",{onClick:()=>{var t;return(t=a.current)==null?void 0:t.releaseTakeover()},className:"flex items-center gap-1.5 rounded-[4px] px-2.5 h-10 md:h-8 text-[11px] font-medium text-[var(--accent)]",style:{backgroundColor:"rgba(34,197,94,0.12)"},children:[e.jsx(Lt,{className:"h-3 w-3"}),r("tasks.restore_auto")]})]})}function Ts(l){const c=Ss(l),a=l.currentStage?c.indexOf(l.currentStage):-1;return c.map((r,t)=>{let d="pending";return l.status===k.COMPLETED?d="completed":l.status===k.FAILED&&t<=a?d=t===a?"failed":"completed":a>=0&&(t<a?d="completed":t===a&&(d="running")),{name:r,status:d}})}function K(l,c){if(!l||!c)return null;const a=l.repoUrl.replace(/\.git$/,"").replace(/\/+$/,""),r=c.split("/").map(encodeURIComponent).join("/");return l.gitPlatform===Et.GITLAB?`${a}/-/tree/${r}`:`${a}/tree/${r}`}function Ls(l,c){if(!l)return null;const a=l.repoUrl.replace(/\.git$/,"").replace(/\/+$/,""),r=c.split("/").map(encodeURIComponent).join("/");return l.gitPlatform===Et.GITLAB?`${a}/-/tree/${r}/docs/specs`:`${a}/tree/${r}/docs/specs`}function Ys(){var dt,mt,pt;const{id:l}=Jt(),c=Xt(),{t:a}=de(),r=ns(s=>s.cancelTask),[t,d]=n.useState(null),[p,C]=n.useState(null),[h,M]=n.useState([]),[W,ee]=n.useState(!0),[o,S]=n.useState(null),[me,O]=n.useState(!1),[F,R]=n.useState(!1),[pe,E]=n.useState(!1),[H,A]=n.useState(!1),[U,v]=n.useState(["claude"]),[D,T]=n.useState(""),[Te,Le]=n.useState(!1),[Ie,De]=n.useState(""),[Re,Ae]=n.useState(!1),[Dt,Pe]=n.useState(!1),[Rt,$e]=n.useState(!1),[At,Me]=n.useState(!1),[Oe,Fe]=n.useState(""),[Ue,qe]=n.useState(""),[Be,Ge]=n.useState("append"),[ze,ue]=n.useState(!1),[Ke,Pt]=Vt(),[N,he]=n.useState("terminal"),[We,He]=n.useState([]),[te,Je]=n.useState(0),[J,q]=n.useState(0),[X,Xe]=n.useState(""),[se,$t]=n.useState(""),[Mt,fe]=n.useState(!1),[Ot,Ve]=n.useState(!1),[B,ve]=n.useState(null),[Qe,Ye]=n.useState("disconnected"),[ge,Ze]=n.useState("auto"),ae=n.useRef(null),et=n.useRef(null),[tt,st]=n.useState([]),x=Number(l),b=t?xs.includes(t.status):!1;Qt(t?Yt(t,100):null);const L=n.useCallback(async()=>{try{const s=await f.get(`web/tasks/${x}`).json();d(s)}catch{}},[x]),re=n.useCallback(async()=>{try{const s=await f.get(`web/tasks/${x}/logs`).json();M(s.lines)}catch{}},[x]),G=n.useCallback(async()=>{try{const s=await f.get(`web/tasks/${x}/pending-confirm`).json();S(s.confirm)}catch{S(null)}},[x]),at=n.useCallback(async()=>{fe(!0);try{const s=new URLSearchParams;s.set("limit","50"),s.set("offset",String(J*50)),X&&s.set("type",X),se&&s.set("search",se);const i=await f.get(`web/tasks/${x}/events?${s}`).json();He(i.events),Je(i.total)}catch{}finally{fe(!1)}},[x,J,X,se]);n.useEffect(()=>{N==="logs"&&at()},[N,at]),n.useEffect(()=>{N==="pipeline"&&!b&&f.get(`web/workspaces/${x}`).json().then(ve).catch(()=>ve(null))},[N,x,b]);const z=ut(s=>s.lastEvent),rt=ut(s=>s.eventSeq);n.useEffect(()=>{ee(!0),d(null),C(null),M([]),S(null),ve(null),He([]),Je(0),q(0),fe(!1),Promise.all([L(),re(),G()]).finally(()=>ee(!1))},[L,re,G]),n.useEffect(()=>{t!=null&&t.projectKey&&f.get(`web/projects/${t.projectKey}`).json().then(C).catch(()=>C(null))},[t==null?void 0:t.projectKey]),n.useEffect(()=>{if(!t)return;let s=!1;return(async()=>{try{const i=[],m=[];let u=t.sourceTaskId??null,y=0;for(;u!=null&&y<2;){const _=await f.get(`web/tasks/${u}`).json();m.unshift({id:_.id,taskMode:_.taskMode??"develop"}),u=_.sourceTaskId??null,y++}i.push(...m),i.push({id:t.id,taskMode:t.taskMode??"develop"});const I=await f.get(`web/tasks?${new URLSearchParams({sourceTaskId:String(t.id),limit:"20"})}`).json();for(const _ of I.data??[])i.push({id:_.id,taskMode:_.taskMode??"develop"});s||st(i)}catch{s||st([])}})(),()=>{s=!0}},[t==null?void 0:t.id,t==null?void 0:t.sourceTaskId,t==null?void 0:t.taskMode]),n.useEffect(()=>{!z||rt===0||(z.event==="task_status_changed"&&z.taskId===x||z.event==="task_created"&&z.taskId===x)&&(L(),G())},[rt,z,x,L,G]),n.useEffect(()=>{if(b)return;const i=setInterval(()=>{document.visibilityState!=="hidden"&&Promise.all([L(),re(),G()])},15e3);return()=>clearInterval(i)},[b,L,re,G]);const nt=n.useCallback(()=>S(null),[]),V=n.useCallback(()=>{S(null),L()},[L]),Ft=(t==null?void 0:t.status)===k.FAILED||(t==null?void 0:t.status)===k.CANCELLED,be=(t==null?void 0:t.status)===k.COMPLETED||(t==null?void 0:t.status)===k.FAILED||(t==null?void 0:t.status)===k.CANCELLED,Ut=(t==null?void 0:t.status)===k.COMPLETED&&(!(t!=null&&t.taskMode)||(t==null?void 0:t.taskMode)==="develop");n.useEffect(()=>{Ke.get("action")==="fork"&&t&&!W&&(be&&lt(),Pt(s=>(s.delete("action"),s),{replace:!0}))},[t,W,Ke,be]);async function qt(){Pe(!0);try{await r(x),O(!1),await L()}finally{Pe(!1)}}async function Bt(){$e(!0);try{await f.post(`web/tasks/${x}/retry`,{json:{reuseWorkspace:ze}}),R(!1),ue(!1),await L()}finally{$e(!1)}}function lt(){Fe(""),qe(""),Ge("append"),E(!0)}async function Gt(){Me(!0);try{const s=Oe.trim()||void 0,i=await f.post(`web/tasks/${x}/fork`,{json:{description:s,descriptionMode:s?Be:void 0,agentType:Ue||void 0}}).json();E(!1),$.success(a("tasks.fork_success")),c(`/tasks/${i.task.id}`)}catch{$.error(a("tasks.fork_error"))}finally{Me(!1)}}async function zt(){if(t){Ae(!0);try{await f.post(`web/tasks/${x}/review`,{json:{agentTypes:U.length>0?U:["claude"],description:D.trim()||void 0,skipFix:Te||void 0,issueRef:Ie.trim()||void 0}}).json(),A(!1),T(""),Le(!1),De(""),c(`/review/${x}`)}catch(s){const i=s instanceof Error?s.message:String(s);$.error(i)}finally{Ae(!1)}}}const j=n.useMemo(()=>t?Ts(t):[],[t==null?void 0:t.configSnapshot,t==null?void 0:t.currentStage,t==null?void 0:t.status]),je=j.findIndex(s=>s.status==="running"),ne=n.useMemo(()=>{if(!(t!=null&&t.configSnapshot))return[];try{const s=JSON.parse(t.configSnapshot);return Array.isArray(s.defaultReviewers)?s.defaultReviewers:[]}catch{return[]}},[t==null?void 0:t.configSnapshot]);if(n.useEffect(()=>{ne.length>0&&v(ne)},[ne.join(",")]),W)return e.jsx("div",{className:"flex h-full items-center justify-center font-mono",children:e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:a("tasks.loading_task")})});if(!t)return e.jsxs("div",{className:"mx-auto max-w-5xl px-6 py-8 font-mono lowercase text-center",children:[e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:a("tasks.task_not_found")}),e.jsxs("button",{onClick:()=>c("/tasks"),className:"mt-4 rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:["< ",a("tasks.back_to_tasks")]})]});const w=t.status===k.QUEUED&&t.queuePosition!=null&&t.queueTotal!=null?{position:t.queuePosition,total:t.queueTotal}:null,g=ls(t.startedAt,t.completedAt),Q=is(t),Ne=Z(t.agentType),Kt=[{value:"",label:a("tasks.fork_agent_type_placeholder",{agent:Z(Q)})},...jt(Z,Q)],le=`${a("tasks.status_suspended")} / ${Ne}`,ct=w?e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"queue"}),e.jsxs("span",{className:"text-[var(--info)]",children:["#",w.position," / ",w.total]})]}):null,it=t.taskMode&&t.taskMode!=="develop"?e.jsx("span",{className:"rounded-[4px] px-2 py-0.5 text-[10px] font-bold uppercase",style:t.taskMode==="plan"?{color:"#3b82f6",backgroundColor:"rgba(59,130,246,0.12)"}:{color:"#a855f7",backgroundColor:"rgba(168,85,247,0.12)"},children:t.taskMode}):null,ce=tt.length>1?e.jsx("div",{className:"flex items-center gap-1 text-xs text-[var(--text-secondary)]",children:tt.map((s,i)=>e.jsxs(Zt.Fragment,{children:[i>0&&e.jsx("span",{className:"text-[var(--text-muted)]",children:"→"}),e.jsxs(ie,{to:`/tasks/${s.id}`,className:s.id===t.id?"text-[var(--accent)]":"text-[var(--info)] hover:underline",children:[s.taskMode," #",s.id]})]},s.id))}):t.sourceTaskId?e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["source:"," ",e.jsxs(ie,{to:`/tasks/${t.sourceTaskId}`,className:"text-[var(--info)] hover:underline",children:["#",t.sourceTaskId]})]}):null,ot=e.jsxs("div",{className:"flex items-center gap-3 border-b border-[var(--border)] bg-[var(--bg-primary)] px-4 py-3 shrink-0 md:hidden",children:[e.jsx("button",{onClick:()=>c("/tasks"),className:"shrink-0 text-[var(--text-muted)]",children:e.jsx(ms,{className:"h-4 w-4"})}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"truncate text-sm font-medium text-[var(--text-primary)] preserve-case",title:es(t),children:["#",t.id," ",ht(t,80)]}),it]}),ce&&e.jsx("div",{className:"text-[11px]",children:ce})]})]}),ye=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(_e,{status:t.status,agentType:t.agentType}),it,g&&e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["// time cost: ",g]}),w&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),e.jsx("span",{className:"text-xs text-[var(--info)]",children:a("tasks.queue_position",{position:String(w.position),total:String(w.total)})})]}),e.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),e.jsxs(ie,{to:`/projects/${t.projectKey}`,className:"text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:["project: ",e.jsx("span",{className:"text-[var(--text-primary)]",children:t.projectKey})]}),t.branch&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["branch: ",K(p,t.branch)?e.jsx("a",{href:K(p,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: ",((dt=t.mrUrl.match(/!?\d+$/))==null?void 0:dt[0])??"view"]})]}),ce&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),ce]})]}),xt=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:[!b&&e.jsxs("button",{onClick:()=>O(!0),className:"flex flex-1 md:flex-none items-center justify-center gap-1.5 rounded-[4px] bg-[var(--destructive)]/10 px-3 h-8 text-[11px] font-medium text-[var(--destructive)]",children:[e.jsx(Ce,{className:"h-3 w-3"}),a("tasks.cancel_task")]}),Ft&&e.jsxs("button",{onClick:()=>R(!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(Lt,{className:"h-3 w-3"}),a("tasks.retry_task")]}),be&&e.jsxs("button",{onClick:lt,className:"flex flex-1 md:flex-none items-center justify-center gap-1.5 rounded-[4px] bg-[var(--bg-card)] px-3 h-8 text-[11px] text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-input)] transition-colors cursor-pointer",children:[e.jsx(ps,{className:"h-3 w-3"}),a("tasks.fork_task")]}),Ut&&e.jsxs("button",{onClick:()=>A(!0),className:"flex flex-1 md:flex-none items-center justify-center gap-1.5 rounded-[4px] px-3 h-8 text-[11px] font-medium text-[var(--accent)]",style:{backgroundColor:"rgba(34,197,94,0.12)"},children:[e.jsx(Nt,{className:"h-3 w-3"}),a("review.launch")]}),t.workerId&&!b&&e.jsxs("button",{onClick:()=>{he("pipeline"),setTimeout(()=>{var s,i;(i=(s=et.current)==null?void 0:s.scrollIntoView)==null||i.call(s,{behavior:"smooth",block:"center"})},50)},className:"hidden lg:flex items-center justify-center gap-1.5 rounded-[4px] px-3 h-8 text-[11px] font-medium text-[var(--info)]",style:{backgroundColor:"rgba(59,130,246,0.12)"},children:[e.jsx(yt,{className:"h-3 w-3"}),a("tasks.cursor_tunnel")]})]}),Wt=e.jsxs("div",{className:"hidden w-[280px] shrink-0 flex-col gap-6 overflow-y-auto border-l border-[var(--border)] bg-[var(--bg-primary)] p-4 lg:flex",children:[e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:a("tasks.pipeline_stages")}),e.jsx(_t,{stages:j})]}),g&&e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2 text-[11px] text-[var(--text-secondary)]",children:["// time cost: ",g]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:a("tasks.activity_log")}),h.length>0?e.jsx("div",{className:"flex flex-col gap-1.5",children:h.slice(0,8).map((s,i)=>e.jsx("p",{className:"text-[11px] leading-relaxed text-[var(--text-muted)]",children:s},i))}):e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.no_activity")})]})]}),ke=e.jsxs(e.Fragment,{children:[e.jsx(Ns,{isOpen:me,onClose:()=>O(!1),onConfirm:qt,taskId:x,isLoading:Dt}),e.jsx(ys,{isOpen:F,onClose:()=>{R(!1),ue(!1)},onConfirm:Bt,taskId:x,mrUrl:t.mrUrl??void 0,isLoading:Rt,reuseWorkspace:ze,onReuseWorkspaceChange:ue}),e.jsx(Ee,{isOpen:pe,onClose:()=>E(!1),onConfirm:Gt,title:a("tasks.fork_task"),message:a("tasks.fork_task_desc"),confirmLabel:a("tasks.fork_task"),confirmVariant:"accent",isLoading:At,children:e.jsxs("div",{className:"mt-3 flex flex-col gap-2",children:[e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["fork of #",x]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.form_agent_type")}),e.jsx(bt,{value:Ue,onChange:qe,options:Kt})]}),e.jsx("textarea",{value:Oe,onChange:s=>Fe(s.target.value),placeholder:a("tasks.fork_description_placeholder"),rows:4,className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)] resize-none"}),e.jsx(oe,{checked:Be==="replace",onCheckedChange:s=>Ge(s?"replace":"append"),label:e.jsxs("span",{children:[a("tasks.fork_replace_description"),e.jsx("span",{className:"mt-1 block text-[10px] text-[var(--text-muted)]",children:a("tasks.fork_append_hint")})]}),containerClassName:"w-full items-start rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] px-3 py-2 text-[11px] text-[var(--text-secondary)]",indicatorClassName:"mt-0.5",labelClassName:"text-[11px] text-[var(--text-secondary)]"})]})}),H&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",children:e.jsxs("div",{className:"w-full max-w-sm rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5 font-mono",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-bold text-[var(--text-primary)]",children:a("review.launch")}),e.jsx("button",{onClick:()=>A(!1),className:"text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:e.jsx(Ce,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsxs("p",{className:"text-[11px] text-[var(--text-muted)]",children:["task #",x," — ",a("review.select_agents")]}),ne.length>0&&e.jsx("span",{className:"rounded-[4px] border border-amber-500/40 bg-amber-500/10 px-1.5 py-0.5 text-[10px] text-amber-500",children:"using project defaults"})]}),e.jsx("div",{className:"mb-4 flex flex-col gap-2",children:jt(Z).map(s=>e.jsx(oe,{checked:U.includes(s.value),onCheckedChange:()=>v(i=>i.includes(s.value)?i.filter(m=>m!==s.value):[...i,s.value]),label:s.label,containerClassName:"w-full gap-2.5 rounded-[4px] border border-[var(--border)] px-3 py-2 hover:bg-[var(--bg-input)] transition-colors"},s.value))}),e.jsx("textarea",{value:D,onChange:s=>T(s.target.value),placeholder:a("review.description_placeholder"),rows:3,className:"mb-3 w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)] resize-none"}),e.jsx(oe,{checked:Te,onCheckedChange:Le,label:a("review.skip_fix_label"),containerClassName:"mb-3 w-full gap-2.5 rounded-[4px] border border-[var(--border)] px-3 py-2 hover:bg-[var(--bg-input)] transition-colors",labelClassName:"text-[var(--text-muted)]"}),e.jsx("input",{value:Ie,onChange:s=>De(s.target.value),placeholder:"--ref: Figma/Jira/Sentry URL",className:"mb-4 w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:zt,disabled:Re||U.length===0,className:"flex flex-1 items-center justify-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs font-bold text-black disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(Nt,{className:"h-3 w-3"}),a(Re?"common.processing":"review.launch")]}),e.jsx("button",{onClick:()=>A(!1),className:"rounded-[4px] border border-[var(--border)] px-4 py-2 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:a("common.cancel")})]})]})})]});return Ot&&N==="terminal"?e.jsxs("div",{className:"fixed inset-0 z-50 flex flex-col bg-[var(--bg-primary)] font-mono lowercase h-screen",style:{height:"100dvh",paddingTop:"env(safe-area-inset-top, 0px)",paddingBottom:"env(safe-area-inset-bottom, 0px)"},children:[ye,e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 shrink-0",style:{height:36,backgroundColor:"#111111"},children:[e.jsx(Ct,{task:t,ptyStatus:Qe,displayAgentType:Q,t:a,gap:"gap-3"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(St,{isFinished:b,takeoverState:ge,ptyRef:ae,t:a}),e.jsx("button",{onClick:()=>Ve(!1),className:"flex items-center rounded-[4px] bg-[var(--bg-card)] px-2.5 py-1 text-[var(--text-muted)]",children:e.jsx(gs,{className:"h-3 w-3"})})]})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(vt,{ref:ae,taskId:x,sessionId:t.currentSessionId??void 0,taskFinished:b,onStatusChange:Ye,onTakeoverChange:Ze})}),xt,ke]}):t.status===k.SUSPENDED?e.jsxs("div",{className:"flex h-full flex-col font-mono lowercase",children:[ot,ye,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%] preserve-case",children:e.jsx(ds,{content:t.description,children:ht(t,200)})}),e.jsx("span",{className:"rounded-[4px] px-2.5 py-1 text-[11px] font-bold text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:le})]}),e.jsx("div",{className:"flex items-center gap-2 md:hidden",children:e.jsx("span",{className:"rounded-[4px] px-2.5 py-1 text-[11px] font-bold text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:le})}),o&&(()=>{const s=o.confirmType,i=s==="plan_decompose",m=s==="plan_review"||s==="code_review",u=s==="plan_review"?a("tasks.plan_review_message",{name:o.stageName}):i?o.prompt==="SPEC_PUSH_FAILED"?a("tasks.plan_decompose_push_failed_message"):a("tasks.plan_decompose_message"):s==="code_review"?a("tasks.code_review_message",{name:o.stageName}):o.prompt??a("tasks.pipeline_requires_confirmation"),y=a(s==="plan_review"?"tasks.approve_plan":i?"tasks.approve_plan_decompose":s==="code_review"?"tasks.approve_review":"tasks.confirm_and_proceed"),I=a(i?"tasks.reject_plan_decompose":m?"tasks.request_changes":"tasks.reject");return e.jsxs("div",{className:"rounded-[4px] border p-4",style:{borderColor:"rgba(245,158,11,0.27)",backgroundColor:"#1a1a1a"},children:[e.jsx("p",{className:"mb-2 text-[11px] font-bold text-[var(--accent)]",children:a("tasks.pending_confirmation")}),e.jsx("p",{className:"mb-3 text-xs text-[var(--text-secondary)]",children:u}),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:o.stageName})]})}),e.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:flex-wrap md:gap-3",children:[e.jsx("button",{onClick:async()=>{try{await f.post(`web/tasks/${x}/confirm-stage`,{json:{stageName:o.stageName,approved:!0,feedback:""}}),V()}catch{$.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:y}),e.jsx("button",{onClick:async()=>{try{await f.post(`web/tasks/${x}/confirm-stage`,{json:{stageName:o.stageName,approved:!1,feedback:""}}),V()}catch{$.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:I})]})]})})(),e.jsxs("div",{className:"flex flex-col gap-3 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 lg:hidden",children:[e.jsx("span",{className:"text-xs font-bold text-[var(--accent)]",children:a("tasks.task_info")}),e.jsxs("div",{className:"flex flex-col gap-1.5 text-[11px]",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"status"}),e.jsx("span",{className:"font-bold text-[var(--warning)]",children:le})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"project"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.projectKey})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"worker"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.workerName??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"created"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:Y(t.createdAt)})]})]})]}),e.jsx("div",{className:"hidden md:flex flex-wrap items-center gap-2 py-2",children:j.map((s,i)=>{const m=s.status==="failed",u=s.status==="completed",y=s.status==="running"&&t.status===k.SUSPENDED,I=m?"var(--destructive)":u?"var(--accent)":y?"var(--warning)":"#525252",_=m?"rgba(239,68,68,0.12)":u?"rgba(34,197,94,0.12)":y?"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:I,backgroundColor:_,fontWeight:y?700:400,border:y?`1px solid ${I}`:void 0},children:y?"confirm":`${s.name}${u?" ✓":m?" ✗":""}`}),i<j.length-1&&e.jsx("div",{className:"h-px w-6 bg-[var(--border)]"})]},s.name)})}),e.jsxs("div",{className:"hidden md:block min-h-[200px] flex-1 rounded-[4px] border border-[var(--border)] bg-[#0c0c0c] p-4",children:[e.jsx("p",{className:"mb-2 text-[11px] font-bold text-[var(--accent)]",children:a("tasks.pty_output")}),e.jsxs("div",{className:"flex flex-col gap-1",children:[h.slice(-10).map((s,i)=>e.jsx("p",{className:"text-[11px] leading-relaxed text-[var(--text-secondary)]",children:s},i)),h.length===0&&e.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.no_output")})]})]})]}),e.jsxs("div",{className:"hidden w-[280px] shrink-0 flex-col gap-4 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 lg:flex",children:[e.jsx("span",{className:"text-[13px] font-bold text-[var(--accent)]",children:a("tasks.task_info")}),e.jsxs("div",{className:"flex flex-col gap-1.5 text-[11px]",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"status"}),e.jsx("span",{className:"font-bold text-[var(--warning)]",children:le})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"project"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.projectKey})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"worker"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.workerName??"-"})]})]}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsx("span",{className:"text-xs font-bold text-[var(--accent)]",children:a("tasks.stage_timeline")}),e.jsx("div",{className:"flex flex-col gap-2",children:j.map(s=>{const i=s.status==="completed"?"var(--info)":s.status==="failed"?"var(--destructive)":s.status==="running"?"var(--warning)":"#525252",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:i}}),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:Y(t.createdAt)})]})})]})]}),o&&e.jsx(gt,{isOpen:!!o,onClose:nt,taskId:x,stageName:o.stageName,timeoutSeconds:o.timeout,confirmType:o.confirmType,prompt:o.prompt,onSubmitted:V}),ke]}):e.jsxs("div",{className:"flex h-full flex-col overflow-hidden font-mono lowercase",children:[ot,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(_e,{status:t.status,agentType:t.agentType}),g&&e.jsxs("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:["// time cost: ",g]}),e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:t.projectKey}),t.workerName&&e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:t.workerName}),t.branch&&(K(p,t.branch)?e.jsx("a",{href:K(p,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}))]}),ye,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]}),w&&e.jsxs("div",{className:"flex items-center gap-2 border-b px-4 md:px-6 py-2 text-xs shrink-0 text-[var(--info)]",style:{backgroundColor:"color-mix(in srgb, var(--info) 8%, transparent)",borderColor:"color-mix(in srgb, var(--info) 20%, transparent)"},children:[e.jsx(fs,{className:"h-3.5 w-3.5 shrink-0"}),e.jsxs("span",{children:[a("tasks.queue_position_banner",{position:String(w.position),total:String(w.total)}),w.position>1?` — ${a("tasks.queue_ahead",{count:String(w.position-1)})}`:` — ${a("tasks.queue_next")}`]})]}),o&&e.jsx(gt,{isOpen:!!o,onClose:nt,taskId:x,stageName:o.stageName,timeoutSeconds:o.timeout,confirmType:o.confirmType,prompt:o.prompt,onSubmitted:V}),e.jsxs("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[e.jsx("div",{className:"flex items-center border-b border-[var(--border)] shrink-0 overflow-x-auto no-scrollbar",children:["terminal","pipeline","logs","detail"].map(s=>e.jsx("button",{onClick:()=>he(s),className:`shrink-0 whitespace-nowrap px-4 py-2.5 text-xs transition-colors ${N===s?"border-b-2 border-[var(--accent)] text-[var(--accent)] font-medium":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:a(s==="terminal"?"tasks.terminal":s==="pipeline"?"tasks.pipeline_tab":s==="logs"?"tasks.logs":"tasks.detail_tab")},s))}),N==="terminal"&&e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-3 md:px-5 shrink-0",style:{height:36,backgroundColor:"#111111"},children:[e.jsx(Ct,{task:t,ptyStatus:Qe,displayAgentType:Q,t:a}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(St,{isFinished:b,takeoverState:ge,ptyRef:ae,t:a}),!b&&ge==="requesting"&&e.jsxs("span",{className:"flex items-center gap-1.5 px-2.5 h-10 md:h-8 text-[11px] text-[var(--warning)]",children:[e.jsx(It,{className:"h-3 w-3 animate-spin"}),a("tasks.requesting_takeover")]}),!b&&t.currentStage&&t.status==="SUSPENDED"&&e.jsxs("button",{onClick:async()=>{try{await f.post(`web/tasks/${x}/confirm-stage`,{json:{stageName:t.currentStage,approved:!1,feedback:""}}),V()}catch{$.error(a("tasks.confirm_failed"))}},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)] hover:text-[var(--text-primary)] transition-colors",children:[e.jsx(us,{className:"h-3 w-3"}),a("tasks.skip_stage")]}),e.jsx("button",{onClick:()=>Ve(!0),className:"hidden md:flex items-center rounded-[4px] bg-[var(--bg-card)] px-2.5 h-10 md:h-8 text-[var(--text-muted)]",children:e.jsx(vs,{className:"h-3 w-3"})})]})]}),e.jsxs("div",{className:"border-b border-[var(--border)] px-4 py-2 shrink-0 md:hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[t.currentStage&&e.jsxs("span",{className:"text-[11px] font-semibold text-[var(--accent)]",children:[a("tasks.stage"),": ",t.currentStage]}),e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["agent: ",Q]}),t.workerName&&e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["worker: ",t.workerName]})]}),e.jsx("div",{className:"overflow-x-auto no-scrollbar pr-4",style:{borderRadius:0},children:e.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",children:[e.jsx("span",{className:"shrink-0 text-[11px] font-bold text-[var(--accent)]",children:a("tasks.stage_progress")}),j.map((s,i)=>{const m=s.status==="completed",u=s.status==="running",I=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] leading-normal whitespace-nowrap",style:{color:I,fontWeight:u?600:400},children:[s.name,m?" ✓":u?" ...":""]}),i<j.length-1&&e.jsx("div",{className:"mx-1.5 h-px w-4 shrink-0",style:{backgroundColor:I}})]},s.name)})]})})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(vt,{ref:ae,taskId:x,sessionId:t.currentSessionId??void 0,taskFinished:b,onStatusChange:Ye,onTakeoverChange:Ze})}),xt]}),N==="pipeline"&&e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto p-4 md:p-6 lg:p-8",children:[e.jsx("div",{className:"mb-4 md:mb-5 overflow-x-auto no-scrollbar",style:{borderRadius:0},children:e.jsx("div",{className:"flex items-center py-5",children:j.map((s,i)=>{const m=s.status==="completed",u=s.status==="running",_=s.status==="failed"?"var(--destructive)":m||u?"var(--accent)":"#525252";return e.jsxs("div",{className:"flex items-center",style:{flex:i<j.length-1?1:void 0},children:[e.jsxs("div",{className:"flex flex-col items-center gap-1.5",children:[e.jsxs("div",{className:"flex h-6 w-6 md:h-7 md:w-7 items-center justify-center rounded-full shrink-0",style:{backgroundColor:_},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] leading-normal font-medium whitespace-nowrap",style:{color:_},children:s.name})]}),i<j.length-1&&e.jsx("div",{className:"mx-1 md:mx-2 h-0.5 flex-1 min-w-3 rounded-full",style:{backgroundColor:i<(je>=0?je: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," (",je+1,"/",j.length,")"]}),t.startedAt&&e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// elapsed: ",Y(t.startedAt).replace(" ago","")]}),g&&e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// time cost: ",g]}),e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// retries: ",t.retryCount,"/2"]})]}),!t.currentStage&&g&&e.jsx("div",{className:"mb-4 md:mb-5 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 text-xs leading-relaxed",children:e.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// time cost: ",g]})}),e.jsx("button",{onClick:()=>he("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??"-"})]}),ct]})]}),e.jsxs("div",{className:"flex flex-col gap-6 mt-4 lg:hidden",children:[e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:a("tasks.pipeline_stages")}),e.jsx(_t,{stages:j,runningBg:"bg-[var(--bg-input)]",py:"py-2"})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:a("tasks.activity_log")}),h.length>0?e.jsx("div",{className:"flex flex-col gap-1.5",children:h.slice(-12).map((s,i)=>e.jsx("p",{className:"text-[11px] leading-relaxed text-[var(--text-muted)]",children:s},i))}):e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.no_activity")})]})]})]}),N==="logs"&&e.jsxs("div",{className:"flex flex-1 flex-col gap-3 md:gap-5 overflow-y-auto p-4 md:p-6 lg:p-8",children:[e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)] md:hidden",children:a("tasks.task_logs")}),e.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-center md:gap-3",children:[e.jsx("div",{className:"flex items-center gap-1 overflow-x-auto no-scrollbar md:hidden",children:["","error","system"].map(s=>e.jsx("button",{onClick:()=>{Xe(s),q(0)},className:`shrink-0 rounded-[4px] px-2.5 py-1 text-[11px] ${X===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(bt,{value:X,onChange:s=>{Xe(s),q(0)},options:[{value:"",label:"all"},{value:"stage_change",label:"stage_change"},{value:"info",label:"info"},{value:"warning",label:"warning"},{value:"error",label:"error"},{value:"system",label:"system"}],className:"w-36"})}),e.jsxs("div",{className:"flex flex-1 items-center gap-2 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2",children:[e.jsx(ts,{className:"h-3.5 w-3.5 text-[var(--text-muted)]"}),e.jsx("input",{type:"text",placeholder:a("tasks.search_logs"),value:se,onChange:s=>{$t(s.target.value),q(0)},className:"flex-1 bg-transparent text-xs text-[var(--text-primary)] outline-none placeholder:text-[var(--text-muted)]"})]})]}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[We.map((s,i)=>e.jsxs("div",{className:`flex items-start md:items-center gap-2 md:gap-4 rounded-[4px] px-2 md:px-3 py-2 text-[11px] md:text-xs ${i%2===0?"bg-[var(--bg-card)]":""}`,children:[e.jsx("span",{className:"shrink-0 text-[var(--text-muted)]",children:new Date(s.timestamp).toLocaleTimeString("en-US",{hour12:!1})}),e.jsx("span",{className:`shrink-0 font-medium ${Es(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)),We.length===0&&!Mt&&e.jsx("p",{className:"py-8 text-center text-xs text-[var(--text-muted)]",children:a("tasks.no_log_entries")})]}),te>50&&e.jsxs("div",{className:"flex items-center justify-center gap-1",children:[Array.from({length:Math.ceil(te/50)}).slice(0,5).map((s,i)=>e.jsx("button",{onClick:()=>q(i),className:`rounded-[4px] px-2 py-1 text-xs ${J===i?"bg-[var(--accent)] text-black font-medium":"text-[var(--text-muted)] hover:text-[var(--text-primary)]"}`,children:i+1},i)),Math.ceil(te/50)>5&&e.jsx("button",{onClick:()=>q(J+1),disabled:J>=Math.ceil(te/50)-1,className:"rounded-[4px] px-2 py-1 text-xs text-[var(--text-muted)] disabled:opacity-30",children:">"})]})]}),N==="detail"&&e.jsxs("div",{className:"flex flex-1 flex-col gap-4 md:gap-5 overflow-y-auto p-4 md:p-6 lg:p-8",children:[e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 md:p-5",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx(ss,{className:"h-3.5 w-3.5 text-[var(--accent)]"}),e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:a("tasks.detail_basic_info")})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3",children:[e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.detail_creator")}),e.jsx("span",{className:"text-xs text-[var(--text-primary)]",children:t.creatorName??"-"})]}),e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("common.created_at")}),e.jsx("span",{className:"text-xs text-[var(--text-primary)]",children:cs(t.createdAt)}),e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:Y(t.createdAt)})]}),e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("common.status")}),e.jsx(_e,{status:t.status,agentType:t.agentType})]}),e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.detail_project")}),e.jsx(ie,{to:`/projects/${t.projectKey}`,className:"text-xs text-[var(--info)] hover:underline transition-colors",children:t.projectKey})]}),e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.detail_worker")}),e.jsx("span",{className:"text-xs text-[var(--text-primary)]",children:t.workerName??"-"})]}),e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.form_agent_type")}),e.jsx("span",{className:"text-xs text-[var(--text-primary)]",children:Ne})]}),g&&e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.detail_time_cost")}),e.jsx("span",{className:"text-xs text-[var(--text-primary)]",children:g})]}),t.branch&&e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.detail_branch")}),K(p,t.branch)?e.jsx("a",{href:K(p,t.branch),target:"_blank",rel:"noopener noreferrer",className:"text-xs text-[var(--info)] hover:underline transition-colors truncate",children:t.branch}):e.jsx("span",{className:"text-xs text-[var(--text-primary)] truncate",children:t.branch})]}),t.mrUrl&&/^https?:\/\//.test(t.mrUrl)&&e.jsxs("div",{className:"flex flex-col gap-1 rounded-[4px] bg-[var(--bg-primary)] p-3",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.mr_link")}),e.jsx("a",{href:t.mrUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-[var(--info)] hover:underline truncate",children:((mt=t.mrUrl.match(/!?\d+$/))==null?void 0:mt[0])??"view"})]})]})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 md:p-5",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx(ft,{className:"h-3.5 w-3.5 text-[var(--accent)]"}),e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:a("tasks.detail_task_name")})]}),e.jsxs("div",{className:"flex flex-col gap-3",children:[t.name&&e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.detail_ai_name")}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:t.name})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.detail_task_id")}),e.jsxs("span",{className:"text-xs text-[var(--text-secondary)]",children:["#",t.id]})]}),t.sourcePlatform&&e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:a("tasks.detail_source")}),e.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:t.sourcePlatform})]})]})]}),t.taskMode==="plan"&&t.status===k.COMPLETED&&(()=>{let s="main";if(t.configSnapshot)try{const m=JSON.parse(t.configSnapshot);m.defaultBranch&&(s=m.defaultBranch)}catch{}const i=Ls(p,s);return i?e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 md:p-5",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx(ft,{className:"h-3.5 w-3.5 text-[var(--accent)]"}),e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:a("plan.view_spec")})]}),e.jsxs("p",{className:"mb-2 text-xs text-[var(--text-muted)]",children:["the spec document was pushed to ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:s})," at ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:"docs/specs/"})]}),e.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--info)] hover:underline transition-colors",children:[e.jsx(yt,{className:"h-3 w-3"}),a("plan.view_spec")]})]}):null})(),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 md:p-5",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx(as,{className:"h-3.5 w-3.5 text-[var(--accent)]"}),e.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:a("tasks.detail_description")})]}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] p-4 overflow-x-auto",children:e.jsx("pre",{className:"whitespace-pre-wrap break-words text-xs leading-relaxed text-[var(--text-secondary)] font-mono",children:t.description})})]})]})]}),N==="terminal"&&Wt,N==="pipeline"&&e.jsxs("div",{className:"hidden w-[420px] shrink-0 flex-col gap-5 overflow-y-auto border-l border-[var(--border)] bg-[var(--bg-primary)] p-5 lg:flex",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[13px] font-semibold text-[var(--accent)]",children:a("tasks.task_info")}),e.jsxs("div",{className:"flex flex-col gap-1.5 text-xs",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"project"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.projectKey})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"creator"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.creatorName??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"worker"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:t.workerName??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:a("common.created_at")}),e.jsx("span",{className:"text-[var(--text-primary)]",children:Y(t.createdAt)})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:a("tasks.form_agent_type")}),e.jsx("span",{className:"text-[var(--text-primary)]",children:Ne})]}),g&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:"time cost"}),e.jsx("span",{className:"text-[var(--text-primary)]",children:g})]}),ct]})]}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[13px] font-semibold text-[var(--accent)]",children:a("tasks.workspace_section")}),e.jsxs("div",{className:"flex flex-col gap-1.5 text-xs",children:[e.jsxs("div",{className:"flex min-w-0 justify-between",children:[e.jsx("span",{className:"shrink-0 text-[var(--text-muted)]",children:"branch"}),e.jsx("span",{className:"ml-4 min-w-0 truncate text-[var(--text-primary)]",children:t.branch??(B==null?void 0:B.branch)??"-"})]}),e.jsxs("div",{className:"flex min-w-0 justify-between",children:[e.jsx("span",{className:"shrink-0 text-[var(--text-muted)]",children:"worktree"}),e.jsx("span",{className:"ml-4 min-w-0 truncate text-[var(--text-primary)]",children:(B==null?void 0:B.path)??"-"})]}),t.mrUrl&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:a("tasks.mr_link")}),e.jsx("a",{href:t.mrUrl,target:"_blank",rel:"noopener noreferrer",className:"font-medium text-[var(--info)] hover:underline",children:((pt=t.mrUrl.match(/!?\d+$/))==null?void 0:pt[0])??"view"})]})]})]}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsxs("div",{ref:et,className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[13px] font-semibold text-[var(--accent)]",children:a("tasks.cursor_tunnel_section")}),t.workerId?e.jsx(js,{taskId:x,taskFinished:b,compact:!0}):e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.no_worker_assigned")})]}),e.jsx("div",{className:"h-px bg-[var(--border)]"}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[13px] font-semibold text-[var(--accent)]",children:a("tasks.stage_timeline")}),e.jsx("div",{className:"flex flex-col gap-2 text-xs",children:j.map(s=>{const i=s.status==="completed"?"✓":s.status==="running"?"→":"·",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:i}),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)})})]})]})]}),ke]})}export{Ys as default};
@@ -1,4 +1,4 @@
1
- import{j as e}from"./index-DAwsREkq.js";import{a as s}from"./DocsPrimitives-Bv8TQpkc.js";import"./copy-_C7txolK.js";const a=`ov task create -d "implement oauth login" -p WEB -t feat
1
+ import{j as e}from"./index-J1zWTACN.js";import{a as s}from"./DocsPrimitives-BhxcRaTm.js";import"./copy-h1a805Rd.js";const a=`ov task create -d "implement oauth login" -p WEB -t feat
2
2
  ov task plan -d "design auth system" -p WEB
3
3
  ov task review 42 --agent codex,cursor
4
4
  ov task fork 42 -d "retry with a simpler approach"`,r=`develop "implement oauth login" --project WEB --type feat
@@ -0,0 +1 @@
1
+ import{R as he,f as G,a as U,o as u,j as e,l as re,u as fe,i as ge,v as ae,r,h as D,X as ye,k as je,w as L,x as ke,H as Ne,t as Y,y as Ce,z as Z,m as we}from"./index-J1zWTACN.js";import{u as ee}from"./task.store-DWG-SG1e.js";import{T as oe}from"./TaskStatusBadge-Cfz28K6K.js";import{f as ne}from"./date-CmcdoD87.js";import{T as Se}from"./Tooltip-DZdu3ZKx.js";import{G as le}from"./git-fork-Dc1BvdTN.js";import{S}from"./Select-BXx8KPbW.js";import{a as _e}from"./task-constants-07c7xWcv.js";import{g as Te}from"./agent-type-options-BiSKx1a4.js";import{C as Ee}from"./copy-h1a805Rd.js";import{E as te}from"./EmptyState-IvQHEoph.js";import{T as se}from"./Skeleton-Crpru9Ol.js";import{P as Pe}from"./plus-V36Q_nxP.js";import{C as Fe}from"./chevron-left-C0Zw71uv.js";import{C as Ae}from"./chevron-right-BCit7CZP.js";import"./status-colors-IR97PkWv.js";import"./chevron-down-CE0uuyBZ.js";const De=he.memo(function({task:s}){const d=G(),{t:c}=U(),x=(a,b)=>c(`common.${a}`,{n:b}),i=s.status===u.COMPLETED||s.status===u.FAILED||s.status===u.CANCELLED;return e.jsxs("tr",{onClick:()=>d(`/tasks/${s.id}`),className:"cursor-pointer border-b border-[var(--border-row)] transition-colors hover:bg-[var(--bg-input)]",children:[e.jsxs("td",{className:"w-16 py-3 pr-4 font-mono text-xs font-medium text-[var(--text-secondary)] text-right tabular-nums",children:["#",s.id]}),e.jsx("td",{className:"py-3 pr-4 text-sm text-[var(--text-primary)] preserve-case",children:e.jsx(Se,{content:s.description,children:re(s)})}),e.jsx("td",{className:"py-3 pr-4",children:e.jsx(oe,{status:s.status})}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:s.projectKey}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:s.developerName??s.creatorName??"-"}),e.jsx("td",{className:"py-3 pr-4 font-mono text-xs text-[var(--text-secondary)]",children:s.workerName??"—"}),e.jsx("td",{className:"py-3 font-mono text-xs text-[var(--text-muted)]",children:e.jsxs("span",{className:"flex items-center gap-2",children:[ne(s.createdAt,x),i&&e.jsx("button",{onClick:a=>{a.stopPropagation(),d(`/tasks/${s.id}?action=fork`)},className:"shrink-0 rounded-[4px] p-1 text-[var(--text-muted)] hover:text-[var(--accent)] hover:bg-[var(--bg-input)] transition-colors",title:c("tasks.fork_task"),children:e.jsx(le,{className:"h-3 w-3"})})]})})]})});function Ie({isOpen:n,onClose:s,projects:d,projectsLoading:c,onSubmit:x,isSubmitting:i}){const{t:a}=U();fe(o=>o.user);const b=ge();ae(n);const[p,M]=r.useState(""),[v,O]=r.useState(""),[g,B]=r.useState("feat"),[m,I]=r.useState(""),[C,_]=r.useState(""),[h,T]=r.useState(""),[y,E]=r.useState(""),[j,k]=r.useState(""),[P,K]=r.useState(""),[z,q]=r.useState([]),[$,w]=r.useState(""),N=d.find(o=>o.key===p),W=Te(o=>o,N==null?void 0:N.agentType);r.useEffect(()=>{if(!n||(M(""),O(""),B("feat"),I(""),_(""),T(""),E(""),k(""),K(""),w(""),!b))return;const o=new AbortController;return D.get("admin/developers",{searchParams:{status:"active"},signal:o.signal}).json().then(q).catch(()=>{}),()=>o.abort()},[n,b]);async function F(o){if(o.preventDefault(),w(""),!p||!v.trim()){w(a("tasks.project_and_description_required"));return}try{await x({projectKey:p,description:v.trim(),workerId:j||void 0,developerId:P?Number(P):void 0,taskType:g,branchSlug:C.trim()||void 0,agentType:m||void 0,targetBranch:h.trim()||void 0,issueRef:y.trim()||void 0})}catch(H){const R=H instanceof Error?H.message:a("tasks.failed_to_create_task");w(R)}}return n?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 font-mono",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},children:e.jsxs("div",{className:"w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",onClick:o=>o.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-6 py-4",children:[e.jsxs("h2",{className:"text-sm text-[var(--text-primary)]",children:["// ",a("tasks.new_task")]}),e.jsx("button",{onClick:s,className:"text-[var(--text-muted)] transition-colors hover:text-[var(--text-primary)]",children:e.jsx(ye,{className:"h-4 w-4"})})]}),e.jsxs("form",{onSubmit:F,className:"px-6 py-5",children:[e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.project")}),e.jsx(S,{value:p,onChange:M,options:d.map(o=>({value:o.key,label:o.name})),placeholder:a(c?"common.loading":"tasks.select_project"),disabled:c})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.task_type")}),e.jsx(S,{value:g,onChange:B,options:_e})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.form_agent_type")}),e.jsx(S,{value:m,onChange:I,options:W})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.task_description")}),e.jsx("textarea",{value:v,onChange:o=>O(o.target.value),placeholder:a("tasks.describe_task_placeholder"),rows:4,className:"w-full resize-none rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.target_worker")}),e.jsx("input",{type:"text",value:j,onChange:o=>k(o.target.value),placeholder:a("tasks.any_able"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.branch_slug")}),e.jsx("input",{type:"text",value:C,onChange:o=>_(o.target.value),placeholder:a("tasks.branch_slug_placeholder"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.target_branch")}),e.jsx("input",{type:"text",value:h,onChange:o=>T(o.target.value),placeholder:a("tasks.target_branch_placeholder"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.issue_ref")}),e.jsx("input",{type:"text",value:y,onChange:o=>E(o.target.value),placeholder:a("tasks.issue_ref_placeholder"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2.5 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),b&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:a("tasks.assign_developer")}),e.jsx(S,{value:P,onChange:K,options:z.map(o=>({value:String(o.id),label:o.name})),placeholder:a("tasks.select_developer")})]}),$&&e.jsx("div",{className:"rounded-[4px] bg-[#2a1515] border border-[var(--destructive)]/30 px-3 py-2 text-xs text-[var(--destructive)]",children:$})]}),e.jsxs("div",{className:"mt-6 flex items-center justify-end gap-3",children:[e.jsx("button",{type:"button",onClick:s,className:"rounded-[4px] border border-[var(--border)] bg-transparent px-4 py-2 text-xs text-[var(--text-secondary)] transition-colors hover:text-[var(--text-primary)]",children:a("common.cancel")}),e.jsx("button",{type:"submit",disabled:i||!p||!v.trim(),className:"rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs text-black transition-opacity hover:opacity-90 disabled:opacity-40",children:a(i?"common.creating":"tasks.create_task")})]})]})]})}):null}function Re({isOpen:n,onClose:s,onForceCreate:d,onViewExisting:c,similarTask:x,isLoading:i}){const{t:a}=U();return ae(n),!x||!n?null:e.jsx("div",{style:{position:"fixed",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},children:e.jsxs("div",{onClick:b=>b.stopPropagation(),style:{width:"100%",maxWidth:"480px",backgroundColor:"var(--bg-card)",border:"1px solid var(--border)",borderRadius:"4px",padding:"1.5rem",fontFamily:"'JetBrains Mono', monospace"},children:[e.jsxs("div",{style:{marginBottom:"1.25rem"},children:[e.jsxs("div",{style:{color:"var(--accent)",fontSize:"0.875rem",fontWeight:600,display:"flex",alignItems:"center",gap:"0.5rem"},children:[e.jsx(Ee,{style:{width:"1rem",height:"1rem"}}),a("tasks.dedup_title")]}),e.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.7rem",marginTop:"0.25rem"},children:a("tasks.dedup_description")})]}),e.jsxs("div",{style:{marginBottom:"1.25rem",padding:"0.75rem",border:"1px solid var(--border)",borderRadius:"4px",backgroundColor:"var(--bg-primary)"},children:[e.jsxs("div",{style:{color:"var(--text-muted)",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace"},children:["#",x.id," · ",x.status]}),e.jsx("div",{style:{color:"var(--text-primary)",fontSize:"0.75rem",marginTop:"0.375rem",lineHeight:"1.5"},children:x.description})]}),e.jsxs("div",{style:{display:"flex",gap:"0.75rem"},children:[e.jsx("button",{type:"button",onClick:s,disabled:i,className:"text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:border-[var(--text-muted)]",style:{flex:1,padding:"0.5rem",backgroundColor:"transparent",border:"1px solid var(--border)",borderRadius:"4px",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:i?"not-allowed":"pointer",opacity:i?.7:1,transition:"color 0.15s, border-color 0.15s"},children:a("common.cancel")}),e.jsx("button",{type:"button",onClick:()=>c(x.id),style:{flex:1,padding:"0.5rem",backgroundColor:"transparent",color:"var(--text-muted)",border:"1px solid var(--border)",borderRadius:"4px",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:"pointer"},children:a("tasks.view_existing")}),e.jsx("button",{type:"button",onClick:d,disabled:i,style:{flex:1,padding:"0.5rem",backgroundColor:"var(--warning)",color:"#0C0C0C",border:"none",borderRadius:"4px",fontSize:"0.75rem",fontWeight:600,fontFamily:"'JetBrains Mono', monospace",cursor:i?"not-allowed":"pointer",opacity:i?.7:1},children:a(i?"common.creating":"tasks.dedup_create_anyway")})]})]})})}function Le({task:n}){const s=G(),d=n.status===u.COMPLETED||n.status===u.FAILED||n.status===u.CANCELLED;return e.jsxs("div",{onClick:()=>s(`/tasks/${n.id}`),className:"cursor-pointer rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 transition-colors active:bg-[var(--bg-input)]",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("span",{className:"text-[11px] text-[var(--text-primary)] leading-tight line-clamp-2 preserve-case",title:we(n),children:["#",n.id," ",re(n)]}),e.jsxs("span",{className:"flex items-center gap-1.5 shrink-0",children:[d&&e.jsx("button",{onClick:c=>{c.stopPropagation(),s(`/tasks/${n.id}?action=fork`)},className:"rounded-[4px] p-1 text-[var(--text-muted)] hover:text-[var(--accent)] transition-colors",children:e.jsx(le,{className:"h-3 w-3"})}),e.jsx(oe,{status:n.status})]})]}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-2 text-[11px] text-[var(--text-muted)]",children:[e.jsx("span",{children:ne(n.createdAt)}),e.jsx("span",{children:"·"}),e.jsx("span",{children:n.projectKey}),n.workerName&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("span",{children:n.workerName})]})]})]})}const Me=[{key:"all",labelKey:"tasks.tab_all"},{key:u.RUNNING,labelKey:"tasks.tab_running"},{key:u.QUEUED,labelKey:"tasks.tab_queued"},{key:u.COMPLETED,labelKey:"tasks.tab_completed"},{key:u.FAILED,labelKey:"tasks.tab_failed"},{key:u.CANCELLED,labelKey:"tasks.tab_cancelled"}],Oe=20;function st(){const n=G(),{t:s}=U(),{tasks:d,loading:c,fetchTasks:x}=ee(),i=je(t=>t.taskSeq),[a,b]=r.useState("all"),[p,M]=r.useState(L.DEVELOP),[v,O]=r.useState(""),[g,B]=r.useState(""),[m,I]=r.useState(""),[C,_]=r.useState(void 0),[h,T]=r.useState([]),y=ee(t=>t.nextCursor),[E,j]=r.useState(!1);ke(r.useMemo(()=>e.jsxs("button",{onClick:()=>j(!0),className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs font-mono text-black transition-opacity hover:opacity-90",children:[e.jsx(Pe,{className:"h-3.5 w-3.5"}),s("tasks.new_task")]}),[s]));const[k,P]=r.useState([]),[K,z]=r.useState(!1),[q,$]=r.useState([]),[w,N]=r.useState(!1),[W,F]=r.useState(!1),[o,H]=r.useState(null),[R,J]=r.useState(null),Q=r.useCallback(t=>{const l={limit:String(Oe)};return p&&(l.taskMode=p),a!=="all"&&(l.status=a),v&&(l.projectKey=v),g&&(l.developerId=g),t&&(l.cursor=t),l},[a,p,v,g]);r.useEffect(()=>{x(Q(C))},[Q,C,x,i]),r.useEffect(()=>{_(void 0),T([])},[a,p,v,g]),r.useEffect(()=>{let t=!1;return(async()=>{try{const[f,be]=await Promise.all([D.get("web/projects").json(),D.get("web/projects/-/developers").json()]);if(t)return;P(f),$(be)}catch{}})(),()=>{t=!0}},[]),r.useEffect(()=>{if(!E||k.length>0)return;z(!0);let t=!1;return(async()=>{try{const f=await D.get("web/projects").json();t||P(f)}catch{}finally{t||z(!1)}})(),()=>{t=!0}},[E,k.length]);const ce=r.useCallback(async t=>{N(!0);try{const l=await D.post("web/tasks",{json:{projectKey:t.projectKey,description:t.description,workerId:t.workerId,developerId:t.developerId,taskType:t.taskType,branchSlug:t.branchSlug,agentType:t.agentType,targetBranch:t.targetBranch,issueRef:t.issueRef}}).json();j(!1),n(`/tasks/${l.task.id}`)}catch(l){if(l instanceof Ne&&l.response.status===409){try{const f=await l.response.json();if(f.confirmRequired){H({id:f.confirmRequired.taskId,description:f.confirmRequired.message,status:"active"}),J(t),j(!1),F(!0);return}}catch{}Y.error(s("tasks.similar_task_exists"))}else{const f=l instanceof Error?l.message:String(l);Y.error(f)}}finally{N(!1)}},[n]),ie=r.useCallback(async()=>{if(R){N(!0);try{const t=await D.post("web/tasks",{json:{...R,force:!0}}).json();F(!1),J(null),n(`/tasks/${t.task.id}`)}finally{N(!1)}}},[R,n]),A=r.useMemo(()=>{if(!m.trim())return d;const t=m.toLowerCase();return d.filter(l=>(l.name??"").toLowerCase().includes(t)||l.description.toLowerCase().includes(t)||String(l.id).includes(m))},[d,m]),de=r.useCallback(()=>{y&&(T(t=>[...t,C??""]),_(y))},[y,C]),xe=r.useCallback(()=>{h.length!==0&&(_(h.at(-1)||void 0),T(t=>t.slice(0,-1)))},[h]),pe=h.length+1,me=r.useMemo(()=>[{value:"",label:s("tasks.filter_project")},...k.map(t=>({value:t.key,label:t.name}))],[k,s]),ue=r.useMemo(()=>[{value:"",label:s("tasks.filter_developer")},...q.map(t=>({value:String(t.id),label:t.name}))],[q,s]),ve=r.useMemo(()=>[{value:"",label:s("tasks.filter_mode")},{value:L.DEVELOP,label:s("tasks.mode_develop")},{value:L.PLAN,label:s("tasks.mode_plan")},{value:L.REVIEW,label:s("tasks.mode_review")},{value:L.AUTOMATION,label:s("tasks.mode_automation")}],[s]),V=s(m?"tasks.try_adjusting_search":"tasks.create_first_task"),X=m?void 0:e.jsx("button",{onClick:()=>j(!0),className:"rounded-[4px] bg-[var(--accent)] px-5 py-2 text-[11px] font-bold text-black",children:s("tasks.create_task")});return e.jsxs("div",{className:"mx-auto max-w-6xl px-2 py-4 md:px-4 md:py-6 font-mono",children:[e.jsxs("div",{className:"mb-4 flex flex-col gap-3 md:gap-4 md:flex-row md:items-center",children:[e.jsx("div",{className:"flex items-center gap-1 overflow-x-auto pb-1 md:pb-0 no-scrollbar pr-4 md:pr-0",children:Me.map(t=>e.jsx("button",{onClick:()=>b(t.key),className:`shrink-0 rounded-[4px] px-3 py-2 h-10 md:h-8 text-xs transition-colors ${a===t.key?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)] bg-[var(--bg-card)] hover:text-[var(--text-secondary)]"}`,children:s(t.labelKey)},t.key))}),e.jsxs("div",{className:"flex flex-col gap-2 md:ml-auto md:flex-row md:items-center",children:[e.jsxs("div",{className:"relative md:w-52",children:[e.jsx(Ce,{className:"absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-[var(--text-muted)]"}),e.jsx("input",{type:"text",placeholder:s("tasks.search_tasks"),value:m,onChange:t=>I(t.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] py-1.5 pl-8 pr-3 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"}),m&&e.jsx("button",{onClick:()=>I(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-xs text-[var(--text-muted)] hover:text-[var(--text-secondary)]",children:"x"})]}),e.jsx(S,{value:p,onChange:M,options:ve,className:"md:w-36"}),e.jsx(S,{value:v,onChange:O,options:me,className:"md:w-40"}),e.jsx(S,{value:g,onChange:B,options:ue,className:"md:w-40"})]})]}),e.jsx("div",{className:"hidden md:block rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:e.jsxs("table",{className:"w-full text-left",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] text-[11px] font-medium text-[#525252]",children:[e.jsx("th",{className:"w-16 px-4 py-2.5 text-right",children:s("tasks.id")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.description_col")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.status_col")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.project_col")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.assignee")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.worker")}),e.jsx("th",{className:"px-4 py-2.5",children:s("tasks.time")})]})}),e.jsxs("tbody",{children:[c&&A.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"p-4",children:e.jsx(se,{rows:5})})}),!c&&A.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"p-4",children:e.jsx(te,{icon:Z,title:s("tasks.no_tasks_found"),description:V,action:X})})}),A.map(t=>e.jsx(De,{task:t},t.id))]})]})}),e.jsxs("div",{className:"flex flex-col gap-2 md:hidden",children:[c&&A.length===0&&e.jsx("div",{className:"p-4",children:e.jsx(se,{rows:5})}),!c&&A.length===0&&e.jsx(te,{icon:Z,title:s("tasks.no_tasks_found"),description:V,action:X}),A.map(t=>e.jsx(Le,{task:t},t.id))]}),(h.length>0||y)&&e.jsxs("div",{className:"mt-6 flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["// page ",pe]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:xe,disabled:h.length===0,className:"flex items-center justify-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1 min-h-[44px] min-w-[44px] md:min-h-0 md:min-w-0 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:border-[var(--accent)] disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:[e.jsx(Fe,{className:"h-3.5 w-3.5"}),s("tasks.prev")]}),e.jsxs("button",{onClick:de,disabled:!y,className:"flex items-center justify-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1 min-h-[44px] min-w-[44px] md:min-h-0 md:min-w-0 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:border-[var(--accent)] disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:[s("common.next"),e.jsx(Ae,{className:"h-3.5 w-3.5"})]})]})]}),e.jsx(Ie,{isOpen:E,onClose:()=>j(!1),projects:k,projectsLoading:K,onSubmit:ce,isSubmitting:w}),e.jsx(Re,{isOpen:W,onClose:()=>{F(!1),J(null)},onForceCreate:ie,onViewExisting:t=>{F(!1),J(null),n(`/tasks/${t}`)},similarTask:o,isLoading:w})]})}export{st as default};
@@ -1 +1 @@
1
- import{a as l,j as a}from"./index-DAwsREkq.js";import{a as u}from"./status-colors-C14ffr9M.js";const r={QUEUED:"tasks.status_queued",ASSIGNED:"tasks.status_assigned",RUNNING:"tasks.status_running",SUSPENDED:"tasks.status_suspended",COMPLETED:"tasks.status_completed",FAILED:"tasks.status_failed",CANCELLED:"tasks.status_cancelled"};function E({status:s}){const{t:e}=l(),t=r[s],n=t?e(t):(s??"unknown").toLowerCase(),o=u(s);return a.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-xs",style:{color:o},children:[a.jsx("span",{style:{fontSize:"0.6rem"},children:"●"}),n]})}export{E as T};
1
+ import{a as l,j as a}from"./index-J1zWTACN.js";import{a as u}from"./status-colors-IR97PkWv.js";const r={QUEUED:"tasks.status_queued",ASSIGNED:"tasks.status_assigned",RUNNING:"tasks.status_running",SUSPENDED:"tasks.status_suspended",COMPLETED:"tasks.status_completed",FAILED:"tasks.status_failed",CANCELLED:"tasks.status_cancelled"};function E({status:s}){const{t:e}=l(),t=r[s],n=t?e(t):(s??"unknown").toLowerCase(),o=u(s);return a.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-xs",style:{color:o},children:[a.jsx("span",{style:{fontSize:"0.6rem"},children:"●"}),n]})}export{E as T};
@@ -1,4 +1,4 @@
1
- import{c as ce,n as le,h as O,o as S,a as A,r,k as z,p as de,q as xe,j as e,X as Z,s as me,f as pe,l as ue,m as he}from"./index-DAwsREkq.js";import{g as ee,H as ve}from"./task-agent-BasiQZ0L.js";import{u as fe}from"./task.store-MpV9TV7z.js";import{P as ge}from"./PtyTerminal-QdM0LGge.js";import{i as G,O as te}from"./OnboardingGuide-BTsSW7Mq.js";import{C as be}from"./ConfirmStageDialog-BUTA9YZ1.js";import{S as E}from"./Select-CC0FnszM.js";import{a as se}from"./status-colors-C14ffr9M.js";import{a as je}from"./date-CmcdoD87.js";import{T as q,a as J,g as ke}from"./task-constants-DihuKtBw.js";import{g as ye}from"./agent-type-options-BTd_pbKQ.js";import{u as ae}from"./useFetch-CgkGfhaP.js";import{P as $}from"./plus-DJTaWh3N.js";import{C as Ne}from"./chevron-down-DwSdaR46.js";import{C as we}from"./chevron-up-4jZShvn6.js";import{R as Te}from"./rotate-ccw-CXFQ7046.js";import{C as Se}from"./clock-Bn8CRcdc.js";import{W as _e}from"./wifi-D5o6IWuC.js";import"./chevron-right-BqoEBUXc.js";/**
1
+ import{c as ce,n as le,h as O,o as S,a as A,r,k as z,p as de,q as xe,j as e,X as Z,s as me,f as pe,l as ue,m as he}from"./index-J1zWTACN.js";import{g as ee,H as ve}from"./task-agent-BIYkVnlP.js";import{u as fe}from"./task.store-DWG-SG1e.js";import{P as ge}from"./PtyTerminal-DKh7d_-3.js";import{i as G,O as te}from"./OnboardingGuide-Crybb-Zh.js";import{C as be}from"./ConfirmStageDialog-Cu49oAnM.js";import{S as E}from"./Select-BXx8KPbW.js";import{a as se}from"./status-colors-IR97PkWv.js";import{a as je}from"./date-CmcdoD87.js";import{T as q,a as J,g as ke}from"./task-constants-07c7xWcv.js";import{g as ye}from"./agent-type-options-BiSKx1a4.js";import{u as ae}from"./useFetch-CZCaxaCi.js";import{P as $}from"./plus-V36Q_nxP.js";import{C as Ne}from"./chevron-down-CE0uuyBZ.js";import{C as we}from"./chevron-up-Bl0OZM4v.js";import{R as Te}from"./rotate-ccw-ByVQRmQu.js";import{C as Se}from"./clock-BwsbKSS6.js";import{W as _e}from"./wifi-Dvp0MK85.js";import"./chevron-right-BCit7CZP.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{a as C,v as D,r as n,j as e,h as _,f as P,J as V,a8 as w,a6 as J,ad as S,s as O}from"./index-DAwsREkq.js";import{K as L}from"./key-b6kn-A1T.js";import{C as T}from"./copy-_C7txolK.js";import{E as W}from"./external-link-DGEar13h.js";import{E as B}from"./EmptyState-BpbqIJyG.js";import{T as z}from"./Skeleton-WCDZdltv.js";import{u as X}from"./useFetch-CgkGfhaP.js";import{e as E}from"./status-colors-C14ffr9M.js";import{P as q}from"./plus-DJTaWh3N.js";function G({isOpen:r,onClose:f,onCreated:u}){const{t:s}=C();D(r);const[a,o]=n.useState(""),[i,d]=n.useState(!1),[l,h]=n.useState("");function y(){o(""),h(""),f()}async function x(){if(h(""),!a.trim()){h(s("admin.pat_label_required"));return}try{d(!0);const c=await _.post("admin/worker-tokens",{json:{label:a.trim()}}).json();o(""),u({token:c.token,id:c.id})}catch(c){const m=c instanceof Error?c.message:s("admin.pat_failed_to_generate");h(m)}finally{d(!1)}}return r?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},children:e.jsxs("div",{className:"w-full border border-[var(--border)] bg-[var(--bg-card)]",style:{maxWidth:"480px",borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:[e.jsxs("div",{className:"flex items-center gap-2 border-b border-[var(--border)] px-5 py-4",children:[e.jsx(L,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:s("admin.generate_worker_token_title")})]}),e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[l&&e.jsx("div",{className:"border border-[var(--destructive)]/30 bg-[var(--destructive)]/10 px-3 py-2 text-xs text-[var(--destructive)]",style:{borderRadius:"4px"},children:l}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:s("admin.create_one_time_token")}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:s("admin.label")}),e.jsx("input",{type:"text",placeholder:s("admin.pat_label_placeholder"),value:a,onChange:c=>o(c.target.value),className:"w-full border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2 text-sm text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:border-[var(--accent)] focus:outline-none",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},onKeyDown:c=>{c.key==="Enter"&&x()}}),e.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:s("admin.label_identifies_worker")})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-[var(--border)] px-5 py-3",children:[e.jsx("button",{onClick:y,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:s("common.cancel")}),e.jsx("button",{onClick:x,disabled:i,className:"bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-black transition-opacity hover:opacity-80 disabled:opacity-50",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:s(i?"admin.generating":"admin.generate")})]})]})}):null}const U=3e3,H=600*1e3;function Q({isOpen:r,token:f,tokenId:u,onClose:s}){const{t:a}=C();D(r);const[o,i]=n.useState("command"),[d,l]=n.useState(!1),[h,y]=n.useState(!1),[x,c]=n.useState(""),[m,g]=n.useState(null),p=n.useRef(void 0),N=n.useRef(Date.now()),k=n.useRef(null),j=P();n.useEffect(()=>{var v;r&&((v=k.current)==null||v.focus())},[r]);const t=n.useCallback(v=>{v.key==="Escape"&&s()},[s]),A=typeof window<"u"?window.location.origin:"https://overlord.example.com",R=`overlord setup worker --token ${f} --server ${A}`;async function F(){try{await navigator.clipboard.writeText(f),l(!0),setTimeout(()=>l(!1),2e3)}catch{}}async function I(){try{await navigator.clipboard.writeText(R),y(!0),setTimeout(()=>y(!1),2e3)}catch{}}const M=n.useCallback(async()=>{try{const v=await _.get(`admin/worker-tokens/${u}/status`).json();v.status==="used"&&v.worker_name&&(i("success"),c(v.worker_name),g(v.worker_id??null),p.current&&clearInterval(p.current))}catch{}Date.now()-N.current>H&&(i("timeout"),p.current&&clearInterval(p.current))},[u]);function K(){i("waiting"),N.current=Date.now(),p.current=setInterval(M,U)}n.useEffect(()=>()=>{p.current&&clearInterval(p.current)},[]);function $(){s(),m&&j(`/workers/${m}`)}if(!r)return null;const b={fontFamily:"'JetBrains Mono', monospace",borderRadius:"4px"};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},children:e.jsxs("div",{ref:k,className:"w-full border border-[var(--border)] bg-[var(--bg-card)]",style:{...b,maxWidth:"480px"},onKeyDown:t,tabIndex:-1,children:[e.jsx("div",{className:"flex items-center gap-2 border-b border-[var(--border)] px-5 py-4",children:o==="success"?e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:a("admin.worker_registered")})]}):e.jsxs(e.Fragment,{children:[e.jsx(L,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:a("admin.worker_token_generated")})]})}),e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[o!=="success"&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:a("admin.run_command_desc")}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[11px] text-[var(--text-muted)]",children:"Token"}),e.jsxs("div",{className:"relative border border-[var(--border)] bg-[var(--bg-card)] p-3",style:{borderRadius:"4px"},children:[e.jsx("code",{className:"block break-all pr-20 text-xs text-[var(--text-primary)]",children:f}),e.jsx("button",{onClick:F,className:"absolute right-2 top-2 flex items-center gap-1 border border-[var(--border)] bg-transparent px-2 py-1 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:d?e.jsx("span",{className:"text-[var(--accent)]",children:a("common.copied")}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(T,{className:"h-3 w-3"})," ",a("common.copy")]})})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[11px] text-[var(--text-muted)]",children:a("admin.setup_command")}),e.jsxs("div",{className:"relative border border-[var(--border)] bg-[var(--bg-card)] p-3",style:{borderRadius:"4px"},children:[e.jsxs("code",{className:"block break-all pr-20 text-xs text-[var(--accent)]",children:["$ ",R]}),e.jsx("button",{onClick:I,className:"absolute right-2 top-2 flex items-center gap-1 border border-[var(--border)] bg-transparent px-2 py-1 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:h?e.jsx("span",{className:"text-[var(--accent)]",children:a("common.copied")}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(T,{className:"h-3 w-3"})," ",a("common.copy")]})})]})]}),e.jsx("div",{className:"border border-yellow-500/30 bg-yellow-500/10 px-3 py-2 text-xs text-yellow-400",style:{borderRadius:"4px"},children:a("admin.token_shown_once")})]}),o==="waiting"&&e.jsxs("div",{className:"flex items-center gap-3 border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3",style:{borderRadius:"4px"},children:[e.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-[var(--accent)] border-t-transparent"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:a("admin.waiting_for_worker")})]}),o==="timeout"&&e.jsx("div",{className:"border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3 text-xs text-[var(--text-muted)]",style:{borderRadius:"4px"},children:a("admin.token_not_yet_used")}),o==="success"&&e.jsxs("div",{className:"border border-[var(--accent)]/30 bg-[var(--accent)]/10 px-4 py-3",style:{borderRadius:"4px"},children:[e.jsx("p",{className:"text-xs text-[var(--accent)]",children:a("admin.worker_registered_success")}),e.jsxs("p",{className:"mt-1 text-xs text-[var(--text-primary)]",children:[a("admin.worker"),": ",e.jsx("span",{className:"text-[var(--accent)]",children:x})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-[var(--border)] px-5 py-3",children:[o==="command"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:a("common.close")}),e.jsx("button",{onClick:K,className:"bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-black transition-opacity hover:opacity-80",style:b,children:a("admin.copied_wait_for_worker")})]}),o==="waiting"&&e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:a("admin.close_worker_can_register")}),o==="timeout"&&e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:a("common.close")}),o==="success"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:a("common.close")}),e.jsxs("button",{onClick:$,className:"flex items-center gap-1.5 bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-black transition-opacity hover:opacity-80",style:b,children:[e.jsx(W,{className:"h-3 w-3"}),a("admin.view_worker")]})]})]})]})})}function ce(){const{t:r}=C(),[f,u]=n.useState(!1),[s,a]=n.useState(null),[o,i]=n.useState(!1),[d,l]=n.useState(null),[h,y]=n.useState(!1),[x,c]=n.useState(!1),{data:m,loading:g,refetch:p}=X(()=>_.get("admin/worker-tokens").json(),[]);async function N(){if(d){y(!0);try{await _.post(`admin/worker-tokens/${d.id}/revoke`),i(!1),l(null),p()}catch{}finally{y(!1)}}}function k(t){u(!1),a(t),p()}const j=n.useMemo(()=>(m??[]).filter(t=>x||t.status!==w.REVOKED),[m,x]);return e.jsxs("div",{className:"font-mono",children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:r("admin.tokens_title")}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("admin.tokens_subtitle")})]}),e.jsxs("button",{type:"button",className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity",onClick:()=>u(!0),children:[e.jsx(q,{className:"h-3.5 w-3.5"}),r("admin.generate_token")]})]}),!g&&(m==null?void 0:m.some(t=>t.status===w.REVOKED))&&e.jsx("div",{className:"mb-4 flex items-center gap-2",children:e.jsx("button",{type:"button",onClick:()=>c(!x),className:`text-xs transition-colors ${x?"text-[var(--text-primary)]":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:r(x?"admin.hide_revoked":"admin.show_revoked")})}),g?e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsx(z,{rows:3})}):j.length===0?e.jsx(B,{icon:J,title:r("admin.no_worker_tokens"),description:r("admin.generate_token_desc"),actionLabel:r("admin.generate_token"),onAction:()=>u(!0)}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden md:block overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] text-left text-[var(--text-muted)]",children:[e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.label")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.purpose")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.status")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("common.created_at")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.expires_at")}),e.jsx("th",{className:"pb-2 font-normal",children:r("common.actions")})]})}),e.jsx("tbody",{children:j.map(t=>e.jsxs("tr",{className:"border-b border-[var(--border-row)] hover:bg-white/[0.02] transition-colors",children:[e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-primary)]",children:t.label}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:t.purpose}),e.jsx("td",{className:"py-2.5 pr-4",children:e.jsx("span",{className:E(t.status),children:t.status})}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-muted)]",children:new Date(t.createdAt).toLocaleDateString()}),e.jsx("td",{className:"py-2.5 pr-4",children:t.expiresAt?e.jsx("span",{className:"text-[var(--text-secondary)]",children:new Date(t.expiresAt).toLocaleDateString()}):e.jsx("span",{className:"text-[var(--text-muted)]",children:"—"})}),e.jsx("td",{className:"py-2.5",children:t.status===w.ACTIVE&&e.jsxs("button",{type:"button",className:"flex items-center gap-1 rounded-[4px] px-2 py-1 text-red-400 hover:text-red-300 hover:bg-white/[0.05] transition-colors",onClick:()=>{l(t),i(!0)},children:[e.jsx(S,{className:"h-3.5 w-3.5"}),r("admin.revoke")]})})]},t.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3",children:j.map(t=>e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-xs text-[var(--text-primary)] font-medium truncate mr-2",children:t.label}),e.jsx("span",{className:`text-[11px] shrink-0 ${E(t.status)}`,children:t.status})]}),e.jsx("div",{className:"text-[11px] text-[var(--text-secondary)] truncate mb-1",children:t.purpose}),e.jsxs("div",{className:"flex items-center justify-between text-[11px] text-[var(--text-muted)]",children:[e.jsx("span",{children:new Date(t.createdAt).toLocaleDateString()}),t.expiresAt&&e.jsx("span",{children:new Date(t.expiresAt).toLocaleDateString()})]}),t.status===w.ACTIVE&&e.jsx("div",{className:"mt-2 pt-2 border-t border-[var(--border)]",children:e.jsxs("button",{type:"button",className:"flex items-center gap-1 rounded-[4px] px-2 py-1 text-[11px] text-red-400 hover:text-red-300 hover:bg-white/[0.05] transition-colors",onClick:()=>{l(t),i(!0)},children:[e.jsx(S,{className:"h-3.5 w-3.5"}),r("admin.revoke")]})})]},t.id))})]}),e.jsx(G,{isOpen:f,onClose:()=>u(!1),onCreated:k}),s&&e.jsx(Q,{isOpen:!!s,token:s.token,tokenId:s.id,onClose:()=>a(null)}),e.jsx(O,{isOpen:o,onClose:()=>{i(!1),l(null)},onConfirm:N,title:r("admin.revoke_token"),message:r("admin.revoke_token_confirm",{label:(d==null?void 0:d.label)??""}),confirmLabel:r("admin.revoke"),confirmVariant:"danger",isLoading:h})]})}export{ce as default};
1
+ import{a as C,v as D,r as n,j as e,h as _,f as P,J as V,a8 as w,a6 as J,ad as S,s as O}from"./index-J1zWTACN.js";import{K as L}from"./key-COdogDFT.js";import{C as T}from"./copy-h1a805Rd.js";import{E as W}from"./external-link-FhyMbjzB.js";import{E as B}from"./EmptyState-IvQHEoph.js";import{T as z}from"./Skeleton-Crpru9Ol.js";import{u as X}from"./useFetch-CZCaxaCi.js";import{e as E}from"./status-colors-IR97PkWv.js";import{P as q}from"./plus-V36Q_nxP.js";function G({isOpen:r,onClose:f,onCreated:u}){const{t:s}=C();D(r);const[a,o]=n.useState(""),[i,d]=n.useState(!1),[l,h]=n.useState("");function y(){o(""),h(""),f()}async function x(){if(h(""),!a.trim()){h(s("admin.pat_label_required"));return}try{d(!0);const c=await _.post("admin/worker-tokens",{json:{label:a.trim()}}).json();o(""),u({token:c.token,id:c.id})}catch(c){const m=c instanceof Error?c.message:s("admin.pat_failed_to_generate");h(m)}finally{d(!1)}}return r?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},children:e.jsxs("div",{className:"w-full border border-[var(--border)] bg-[var(--bg-card)]",style:{maxWidth:"480px",borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:[e.jsxs("div",{className:"flex items-center gap-2 border-b border-[var(--border)] px-5 py-4",children:[e.jsx(L,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:s("admin.generate_worker_token_title")})]}),e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[l&&e.jsx("div",{className:"border border-[var(--destructive)]/30 bg-[var(--destructive)]/10 px-3 py-2 text-xs text-[var(--destructive)]",style:{borderRadius:"4px"},children:l}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:s("admin.create_one_time_token")}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:s("admin.label")}),e.jsx("input",{type:"text",placeholder:s("admin.pat_label_placeholder"),value:a,onChange:c=>o(c.target.value),className:"w-full border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2 text-sm text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:border-[var(--accent)] focus:outline-none",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},onKeyDown:c=>{c.key==="Enter"&&x()}}),e.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:s("admin.label_identifies_worker")})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-[var(--border)] px-5 py-3",children:[e.jsx("button",{onClick:y,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:s("common.cancel")}),e.jsx("button",{onClick:x,disabled:i,className:"bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-black transition-opacity hover:opacity-80 disabled:opacity-50",style:{borderRadius:"4px",fontFamily:"'JetBrains Mono', monospace"},children:s(i?"admin.generating":"admin.generate")})]})]})}):null}const U=3e3,H=600*1e3;function Q({isOpen:r,token:f,tokenId:u,onClose:s}){const{t:a}=C();D(r);const[o,i]=n.useState("command"),[d,l]=n.useState(!1),[h,y]=n.useState(!1),[x,c]=n.useState(""),[m,g]=n.useState(null),p=n.useRef(void 0),N=n.useRef(Date.now()),k=n.useRef(null),j=P();n.useEffect(()=>{var v;r&&((v=k.current)==null||v.focus())},[r]);const t=n.useCallback(v=>{v.key==="Escape"&&s()},[s]),A=typeof window<"u"?window.location.origin:"https://overlord.example.com",R=`overlord setup worker --token ${f} --server ${A}`;async function F(){try{await navigator.clipboard.writeText(f),l(!0),setTimeout(()=>l(!1),2e3)}catch{}}async function I(){try{await navigator.clipboard.writeText(R),y(!0),setTimeout(()=>y(!1),2e3)}catch{}}const M=n.useCallback(async()=>{try{const v=await _.get(`admin/worker-tokens/${u}/status`).json();v.status==="used"&&v.worker_name&&(i("success"),c(v.worker_name),g(v.worker_id??null),p.current&&clearInterval(p.current))}catch{}Date.now()-N.current>H&&(i("timeout"),p.current&&clearInterval(p.current))},[u]);function K(){i("waiting"),N.current=Date.now(),p.current=setInterval(M,U)}n.useEffect(()=>()=>{p.current&&clearInterval(p.current)},[]);function $(){s(),m&&j(`/workers/${m}`)}if(!r)return null;const b={fontFamily:"'JetBrains Mono', monospace",borderRadius:"4px"};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backgroundColor:"var(--modal-backdrop, rgba(12,12,12,0.6))"},children:e.jsxs("div",{ref:k,className:"w-full border border-[var(--border)] bg-[var(--bg-card)]",style:{...b,maxWidth:"480px"},onKeyDown:t,tabIndex:-1,children:[e.jsx("div",{className:"flex items-center gap-2 border-b border-[var(--border)] px-5 py-4",children:o==="success"?e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:a("admin.worker_registered")})]}):e.jsxs(e.Fragment,{children:[e.jsx(L,{className:"h-4 w-4 text-[var(--accent)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:a("admin.worker_token_generated")})]})}),e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[o!=="success"&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:a("admin.run_command_desc")}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[11px] text-[var(--text-muted)]",children:"Token"}),e.jsxs("div",{className:"relative border border-[var(--border)] bg-[var(--bg-card)] p-3",style:{borderRadius:"4px"},children:[e.jsx("code",{className:"block break-all pr-20 text-xs text-[var(--text-primary)]",children:f}),e.jsx("button",{onClick:F,className:"absolute right-2 top-2 flex items-center gap-1 border border-[var(--border)] bg-transparent px-2 py-1 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:d?e.jsx("span",{className:"text-[var(--accent)]",children:a("common.copied")}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(T,{className:"h-3 w-3"})," ",a("common.copy")]})})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[11px] text-[var(--text-muted)]",children:a("admin.setup_command")}),e.jsxs("div",{className:"relative border border-[var(--border)] bg-[var(--bg-card)] p-3",style:{borderRadius:"4px"},children:[e.jsxs("code",{className:"block break-all pr-20 text-xs text-[var(--accent)]",children:["$ ",R]}),e.jsx("button",{onClick:I,className:"absolute right-2 top-2 flex items-center gap-1 border border-[var(--border)] bg-transparent px-2 py-1 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:h?e.jsx("span",{className:"text-[var(--accent)]",children:a("common.copied")}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(T,{className:"h-3 w-3"})," ",a("common.copy")]})})]})]}),e.jsx("div",{className:"border border-yellow-500/30 bg-yellow-500/10 px-3 py-2 text-xs text-yellow-400",style:{borderRadius:"4px"},children:a("admin.token_shown_once")})]}),o==="waiting"&&e.jsxs("div",{className:"flex items-center gap-3 border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3",style:{borderRadius:"4px"},children:[e.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-[var(--accent)] border-t-transparent"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:a("admin.waiting_for_worker")})]}),o==="timeout"&&e.jsx("div",{className:"border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3 text-xs text-[var(--text-muted)]",style:{borderRadius:"4px"},children:a("admin.token_not_yet_used")}),o==="success"&&e.jsxs("div",{className:"border border-[var(--accent)]/30 bg-[var(--accent)]/10 px-4 py-3",style:{borderRadius:"4px"},children:[e.jsx("p",{className:"text-xs text-[var(--accent)]",children:a("admin.worker_registered_success")}),e.jsxs("p",{className:"mt-1 text-xs text-[var(--text-primary)]",children:[a("admin.worker"),": ",e.jsx("span",{className:"text-[var(--accent)]",children:x})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-[var(--border)] px-5 py-3",children:[o==="command"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:a("common.close")}),e.jsx("button",{onClick:K,className:"bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-black transition-opacity hover:opacity-80",style:b,children:a("admin.copied_wait_for_worker")})]}),o==="waiting"&&e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:a("admin.close_worker_can_register")}),o==="timeout"&&e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:a("common.close")}),o==="success"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:s,className:"border border-[var(--border)] bg-transparent px-4 py-1.5 text-xs text-[var(--text-muted)] transition-colors hover:border-[var(--text-muted)] hover:text-[var(--text-primary)]",style:b,children:a("common.close")}),e.jsxs("button",{onClick:$,className:"flex items-center gap-1.5 bg-[var(--accent)] px-4 py-1.5 text-xs font-medium text-black transition-opacity hover:opacity-80",style:b,children:[e.jsx(W,{className:"h-3 w-3"}),a("admin.view_worker")]})]})]})]})})}function ce(){const{t:r}=C(),[f,u]=n.useState(!1),[s,a]=n.useState(null),[o,i]=n.useState(!1),[d,l]=n.useState(null),[h,y]=n.useState(!1),[x,c]=n.useState(!1),{data:m,loading:g,refetch:p}=X(()=>_.get("admin/worker-tokens").json(),[]);async function N(){if(d){y(!0);try{await _.post(`admin/worker-tokens/${d.id}/revoke`),i(!1),l(null),p()}catch{}finally{y(!1)}}}function k(t){u(!1),a(t),p()}const j=n.useMemo(()=>(m??[]).filter(t=>x||t.status!==w.REVOKED),[m,x]);return e.jsxs("div",{className:"font-mono",children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:r("admin.tokens_title")}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("admin.tokens_subtitle")})]}),e.jsxs("button",{type:"button",className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity",onClick:()=>u(!0),children:[e.jsx(q,{className:"h-3.5 w-3.5"}),r("admin.generate_token")]})]}),!g&&(m==null?void 0:m.some(t=>t.status===w.REVOKED))&&e.jsx("div",{className:"mb-4 flex items-center gap-2",children:e.jsx("button",{type:"button",onClick:()=>c(!x),className:`text-xs transition-colors ${x?"text-[var(--text-primary)]":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:r(x?"admin.hide_revoked":"admin.show_revoked")})}),g?e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsx(z,{rows:3})}):j.length===0?e.jsx(B,{icon:J,title:r("admin.no_worker_tokens"),description:r("admin.generate_token_desc"),actionLabel:r("admin.generate_token"),onAction:()=>u(!0)}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden md:block overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] text-left text-[var(--text-muted)]",children:[e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.label")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.purpose")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.status")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("common.created_at")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.expires_at")}),e.jsx("th",{className:"pb-2 font-normal",children:r("common.actions")})]})}),e.jsx("tbody",{children:j.map(t=>e.jsxs("tr",{className:"border-b border-[var(--border-row)] hover:bg-white/[0.02] transition-colors",children:[e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-primary)]",children:t.label}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:t.purpose}),e.jsx("td",{className:"py-2.5 pr-4",children:e.jsx("span",{className:E(t.status),children:t.status})}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-muted)]",children:new Date(t.createdAt).toLocaleDateString()}),e.jsx("td",{className:"py-2.5 pr-4",children:t.expiresAt?e.jsx("span",{className:"text-[var(--text-secondary)]",children:new Date(t.expiresAt).toLocaleDateString()}):e.jsx("span",{className:"text-[var(--text-muted)]",children:"—"})}),e.jsx("td",{className:"py-2.5",children:t.status===w.ACTIVE&&e.jsxs("button",{type:"button",className:"flex items-center gap-1 rounded-[4px] px-2 py-1 text-red-400 hover:text-red-300 hover:bg-white/[0.05] transition-colors",onClick:()=>{l(t),i(!0)},children:[e.jsx(S,{className:"h-3.5 w-3.5"}),r("admin.revoke")]})})]},t.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3",children:j.map(t=>e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-xs text-[var(--text-primary)] font-medium truncate mr-2",children:t.label}),e.jsx("span",{className:`text-[11px] shrink-0 ${E(t.status)}`,children:t.status})]}),e.jsx("div",{className:"text-[11px] text-[var(--text-secondary)] truncate mb-1",children:t.purpose}),e.jsxs("div",{className:"flex items-center justify-between text-[11px] text-[var(--text-muted)]",children:[e.jsx("span",{children:new Date(t.createdAt).toLocaleDateString()}),t.expiresAt&&e.jsx("span",{children:new Date(t.expiresAt).toLocaleDateString()})]}),t.status===w.ACTIVE&&e.jsx("div",{className:"mt-2 pt-2 border-t border-[var(--border)]",children:e.jsxs("button",{type:"button",className:"flex items-center gap-1 rounded-[4px] px-2 py-1 text-[11px] text-red-400 hover:text-red-300 hover:bg-white/[0.05] transition-colors",onClick:()=>{l(t),i(!0)},children:[e.jsx(S,{className:"h-3.5 w-3.5"}),r("admin.revoke")]})})]},t.id))})]}),e.jsx(G,{isOpen:f,onClose:()=>u(!1),onCreated:k}),s&&e.jsx(Q,{isOpen:!!s,token:s.token,tokenId:s.id,onClose:()=>a(null)}),e.jsx(O,{isOpen:o,onClose:()=>{i(!1),l(null)},onConfirm:N,title:r("admin.revoke_token"),message:r("admin.revoke_token_confirm",{label:(d==null?void 0:d.label)??""}),confirmLabel:r("admin.revoke"),confirmVariant:"danger",isLoading:h})]})}export{ce as default};
@@ -1 +1 @@
1
- import{$ as m,r as e,j as t}from"./index-DAwsREkq.js";var b=m();function g({content:n,children:a,delay:l=100,className:i}){const[p,c]=e.useState(!1),[u,f]=e.useState({top:0,left:0}),r=e.useRef(null),o=e.useRef(null),x=e.useCallback(()=>{r.current=setTimeout(()=>{if(o.current){const s=o.current.getBoundingClientRect();f({top:s.top-4,left:s.left+s.width/2})}c(!0)},l)},[l]),d=e.useCallback(()=>{r.current&&(clearTimeout(r.current),r.current=null),c(!1)},[]);return n?t.jsxs(t.Fragment,{children:[t.jsx("span",{ref:o,onMouseEnter:x,onMouseLeave:d,className:i,children:a}),p&&b.createPortal(t.jsx("div",{role:"tooltip",style:{position:"fixed",top:u.top,left:u.left,transform:"translate(-50%, -100%)",zIndex:9999},className:"pointer-events-none max-w-sm rounded-[4px] bg-[var(--bg-card)] px-2.5 py-1.5 text-xs text-[var(--text-primary)] shadow-lg border border-[var(--border-row)] preserve-case",children:n}),document.body)]}):t.jsx(t.Fragment,{children:a})}export{g as T};
1
+ import{$ as m,r as e,j as t}from"./index-J1zWTACN.js";var b=m();function g({content:n,children:a,delay:l=100,className:i}){const[p,c]=e.useState(!1),[u,f]=e.useState({top:0,left:0}),r=e.useRef(null),o=e.useRef(null),x=e.useCallback(()=>{r.current=setTimeout(()=>{if(o.current){const s=o.current.getBoundingClientRect();f({top:s.top-4,left:s.left+s.width/2})}c(!0)},l)},[l]),d=e.useCallback(()=>{r.current&&(clearTimeout(r.current),r.current=null),c(!1)},[]);return n?t.jsxs(t.Fragment,{children:[t.jsx("span",{ref:o,onMouseEnter:x,onMouseLeave:d,className:i,children:a}),p&&b.createPortal(t.jsx("div",{role:"tooltip",style:{position:"fixed",top:u.top,left:u.left,transform:"translate(-50%, -100%)",zIndex:9999},className:"pointer-events-none max-w-sm rounded-[4px] bg-[var(--bg-card)] px-2.5 py-1.5 text-xs text-[var(--text-primary)] shadow-lg border border-[var(--border-row)] preserve-case",children:n}),document.body)]}):t.jsx(t.Fragment,{children:a})}export{g as T};
@@ -1,4 +1,4 @@
1
- import{R as A,g as he,f as fe,u as Y,a as me,r as _,j as M,h as W,t as ge}from"./index-DAwsREkq.js";var pe=Object.defineProperty,j=Object.getOwnPropertySymbols,X=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable,V=(u,a,i)=>a in u?pe(u,a,{enumerable:!0,configurable:!0,writable:!0,value:i}):u[a]=i,k=(u,a)=>{for(var i in a||(a={}))X.call(a,i)&&V(u,i,a[i]);if(j)for(var i of j(a))K.call(a,i)&&V(u,i,a[i]);return u},U=(u,a)=>{var i={};for(var l in u)X.call(u,l)&&a.indexOf(l)<0&&(i[l]=u[l]);if(u!=null&&j)for(var l of j(u))a.indexOf(l)<0&&K.call(u,l)&&(i[l]=u[l]);return i};/**
1
+ import{R as A,g as he,f as fe,u as Y,a as me,r as _,j as M,h as W,t as ge}from"./index-J1zWTACN.js";var pe=Object.defineProperty,j=Object.getOwnPropertySymbols,X=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable,V=(u,a,i)=>a in u?pe(u,a,{enumerable:!0,configurable:!0,writable:!0,value:i}):u[a]=i,k=(u,a)=>{for(var i in a||(a={}))X.call(a,i)&&V(u,i,a[i]);if(j)for(var i of j(a))K.call(a,i)&&V(u,i,a[i]);return u},U=(u,a)=>{var i={};for(var l in u)X.call(u,l)&&a.indexOf(l)<0&&(i[l]=u[l]);if(u!=null&&j)for(var l of j(u))a.indexOf(l)<0&&K.call(u,l)&&(i[l]=u[l]);return i};/**
2
2
  * @license QR Code generator library (TypeScript)
3
3
  * Copyright (c) Project Nayuki.
4
4
  * SPDX-License-Identifier: MIT
@@ -1 +1 @@
1
- import{a as h,j as e,s as A,B as de,f as xe,r as l,u as me,k as z,x as pe,W as b,D as S,L as ue,V as K,h as N,l as be}from"./index-DAwsREkq.js";import{t as ve,c as Y}from"./date-CmcdoD87.js";import{w as he,b as ge,t as we}from"./status-colors-C14ffr9M.js";import{I as x}from"./InfoRow-BCDb21nt.js";import{M}from"./MetricBar-DLR15rum.js";import{u as je}from"./useFetch-CgkGfhaP.js";import{T as fe}from"./Tooltip-Ds3lc4sS.js";import{T as Z}from"./trash-2-CDhJihtl.js";import{A as ke}from"./arrow-left-Czit8jGK.js";import{C as Ne}from"./chevron-left-DMFdbT8q.js";import{C as ye}from"./chevron-right-BqoEBUXc.js";function Ce({isOpen:t,onClose:n,onConfirm:r,workerName:o,isDraining:i,loading:d}){const{t:c}=h();return e.jsx(A,{isOpen:t,onClose:n,onConfirm:r,title:c(i?"workers.undrain_worker_title":"workers.drain_worker_title"),message:i?c("workers.undrain_confirm",{name:o}):c("workers.drain_confirm",{name:o}),confirmLabel:c(i?"workers.undrain":"workers.drain"),confirmVariant:i?"accent":"warning",isLoading:d})}const _e=20;function ee(t){return t==="rate_limit"?"rate limited":t}function Se(t,n){return n(t==="binary_missing"?"workers.manual_restore_required":"workers.awaiting_auto_recovery")}function Ue(){var H,B;const{id:t}=de(),n=xe(),{t:r}=h(),[o,i]=l.useState(!1),[d,c]=l.useState(!1),[D,p]=l.useState(!1),[T,E]=l.useState(!1),[re,y]=l.useState(!1),[se,$]=l.useState(!1),[L,C]=l.useState(null),g=me(a=>{var u;return(u=a.user)==null?void 0:u.role}),te=z(a=>a.workerSeq),ae=z(a=>a.taskSeq),[w,P]=l.useState(void 0),[v,R]=l.useState([]),{data:m,loading:ne,error:F,refetch:I}=je(async()=>{if(!t)throw new Error("Missing worker ID");const a={limit:String(_e)};w&&(a.cursor=w);const[u,k]=await Promise.all([N.get(`web/workers/${t}`).json(),N.get(`web/workers/${t}/tasks`,{searchParams:a}).json().catch(()=>({data:[],nextCursor:null}))]);return{worker:u,tasks:k.data,nextCursor:k.nextCursor}},[t,te,ae,w]),s=(m==null?void 0:m.worker)??null,U=(m==null?void 0:m.tasks)??[],j=(m==null?void 0:m.nextCursor)??null,W=l.useCallback(()=>{j&&(R(a=>[...a,w??""]),P(j))},[j,w]),q=l.useCallback(()=>{v.length!==0&&(P(v.at(-1)||void 0),R(a=>a.slice(0,-1)))},[v]),G=v.length+1,V=g===S.LEAD||g===S.ADMIN;pe(l.useMemo(()=>!s||s.status===b.DECOMMISSIONED?null:e.jsxs("div",{className:"flex items-center gap-2",children:[s.status===b.ONLINE&&e.jsxs("button",{onClick:()=>i(!0),className:"rounded-[4px] border border-[var(--warning)]/40 px-3 py-1.5 text-xs text-[var(--warning)] hover:bg-[var(--warning)]/10 transition-colors",children:["> ",r("workers.drain")]}),g===S.ADMIN&&e.jsxs("button",{onClick:()=>p(!0),className:"flex items-center gap-1 rounded-[4px] border border-[var(--destructive)]/40 px-3 py-1.5 text-xs text-[var(--destructive)] hover:bg-[var(--destructive)]/10 transition-colors",children:[e.jsx(Z,{className:"h-3 w-3"}),r("workers.decommission")]})]}),[s,g,r]));async function oe(){if(s){c(!0);try{const a=s.status===b.DRAINING?"undrain":"drain";await N.post(`web/workers/${s.id}/${a}`),await I()}catch{}finally{c(!1),i(!1)}}}async function ie(){if(s){E(!0);try{await N.delete(`admin/workers/${s.id}`),n("/workers")}catch{}finally{E(!1),p(!1)}}}async function le(){if(!(!s||!L)){$(!0);try{await N.post(`web/workers/${s.id}/capabilities/${encodeURIComponent(L)}/restore`),await I()}catch{}finally{$(!1),y(!1),C(null)}}}if(ne)return e.jsx("div",{className:"mx-auto max-w-5xl px-4 md:px-6 py-8 font-mono",children:e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:r("workers.loading_worker")})});if(F)return e.jsxs("div",{className:"mx-auto max-w-5xl px-4 md:px-6 py-8 font-mono lowercase text-center",children:[e.jsx("p",{className:"text-sm text-[var(--destructive)]",children:F}),e.jsx("button",{onClick:()=>I(),className:"mt-4 rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:r("common.retry")})]});if(!s)return e.jsxs("div",{className:"mx-auto max-w-5xl px-4 md:px-6 py-8 font-mono lowercase text-center",children:[e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:r("workers.worker_not_found")}),e.jsxs("button",{onClick:()=>n("/workers"),className:"mt-4 rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:["< ",r("workers.back_to_workers")]})]});const _=s.status===b.DRAINING,f=s.status!==b.DECOMMISSIONED;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mx-auto max-w-5xl font-mono lowercase",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] bg-[var(--bg-primary)] px-4 shrink-0 md:hidden",style:{height:56},children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("button",{onClick:()=>n("/workers"),className:"shrink-0 text-[var(--text-muted)]",children:e.jsx(ke,{className:"h-4 w-4"})}),e.jsx("span",{className:"truncate text-sm font-medium text-[var(--text-primary)]",children:s.name})]}),!_&&s.status!==b.OFFLINE&&f&&e.jsxs("button",{onClick:()=>i(!0),className:"shrink-0 rounded-[4px] border border-[var(--warning)]/40 px-3 py-1.5 text-xs text-[var(--warning)] hover:bg-[var(--warning)]/10 transition-colors",children:["> ",r("workers.drain")]})]}),e.jsxs("div",{className:"px-4 md:px-6 py-8",children:[_?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx(ue,{to:"/workers",className:"text-[var(--text-muted)] hover:text-[var(--text-secondary)] transition-colors",children:r("workers.title")}),e.jsx("span",{className:"text-[var(--text-muted)]",children:"/"}),e.jsx("span",{className:"text-[var(--text-secondary)]",children:s.name})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[f&&e.jsxs("button",{onClick:()=>i(!0),className:"rounded-[4px] border border-[var(--accent)] px-4 py-1.5 text-xs text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors",children:["> ",r("workers.undrain")]}),g===S.ADMIN&&f&&e.jsxs("button",{onClick:()=>p(!0),className:"flex items-center gap-1 rounded-[4px] border border-[var(--destructive)]/40 px-3 py-1.5 text-xs text-[var(--destructive)] hover:bg-[var(--destructive)]/10 transition-colors",children:[e.jsx(Z,{className:"h-3 w-3"}),r("workers.decommission")]})]})]}),e.jsx("div",{className:"mb-4",children:e.jsx("span",{className:"rounded-[4px] bg-[var(--warning)]/20 px-2.5 py-1 text-xs font-medium text-[var(--warning)]",children:r("workers.draining")})}),e.jsxs("div",{className:"mb-6 rounded-[4px] border border-[var(--warning)]/40 bg-[var(--warning)]/10 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(K,{className:"h-3.5 w-3.5 text-[var(--warning)]"}),e.jsx("span",{className:"text-xs text-[var(--warning)]",children:r("workers.draining_warning")})]}),e.jsx("p",{className:"text-xs text-[var(--warning)]/70 ml-5.5",children:r("workers.draining_active_tasks")})]}),e.jsxs("div",{className:"mb-6 grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsx(O,{label:r("workers.cpu"),value:s.cpuUsage,unit:"%"}),e.jsx(O,{label:r("workers.memory"),value:s.memoryUsage,unit:"%"}),e.jsx(O,{label:r("workers.disk"),value:s.diskUsage,unit:"%"}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("workers.slots")}),e.jsxs("p",{className:"mt-2 text-lg font-semibold text-[var(--text-primary)]",children:[s.activeSlots,"/",s.maxSlots]})]})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>n("/workers"),className:"mb-4 text-xs text-[var(--text-muted)] hover:text-[var(--text-secondary)] transition-colors",children:["< ",r("workers.back_to_workers")]}),e.jsxs("h1",{className:"mb-2 text-lg font-bold text-[var(--text-primary)] flex items-center gap-2",children:[s.name,e.jsxs("span",{className:"flex items-center gap-1.5 text-sm font-normal",style:{color:he[s.status]},children:[e.jsx("span",{style:{fontSize:"0.5rem"},children:"●"}),s.status.toLowerCase()]})]}),e.jsx("p",{className:"mb-6 text-xs text-[var(--text-muted)]",children:r("workers.last_heartbeat",{time:ve(s.lastHeartbeat,"never")})}),s.status===b.DECOMMISSIONED&&e.jsx("div",{className:"mb-6 rounded-[4px] border border-[var(--text-muted)]/40 bg-[var(--text-muted)]/10 p-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(K,{className:"h-3.5 w-3.5 text-[var(--text-muted)]"}),e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["this worker has been decommissioned",s.decommissionedAt?` on ${Y(s.decommissionedAt)}`:""," and can no longer accept tasks."]})]})}),e.jsxs("div",{className:"mb-6 grid gap-4 lg:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("h2",{className:"mb-3 text-xs text-[var(--text-muted)]",children:r("workers.resource_usage")}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(M,{label:r("workers.cpu"),value:s.cpuUsage}),e.jsx(M,{label:r("workers.mem"),value:s.memoryUsage}),e.jsx(M,{label:r("workers.disk"),value:s.diskUsage})]})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("h2",{className:"mb-3 text-xs text-[var(--text-muted)]",children:r("workers.connection_info")}),e.jsx(Q,{worker:s})]})]})]}),_?e.jsxs(e.Fragment,{children:[e.jsx(X,{title:r("workers.active_tasks"),tasks:U,navigate:n,nextCursor:j,pageNumber:G,hasPrev:v.length>0,onNext:W,onPrev:q}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"mb-4 text-sm font-medium text-[var(--accent)]",children:r("workers.capabilities")}),s.capabilities.length>0?e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:s.capabilities.map(a=>e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsx("p",{className:"text-xs text-[var(--text-primary)]",children:a})},a))}):e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("workers.no_capabilities_short")}),(((H=s.degradedCapabilities)==null?void 0:H.length)??0)>0&&e.jsx("div",{className:"mt-3 space-y-2",children:s.degradedCapabilities.map(a=>e.jsx(J,{agentType:a.agentType,failureType:a.failureType,failureCount:a.failureCount,showRestore:V&&f,onRestore:()=>{C(a.agentType),y(!0)}},a.agentType))})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"mb-4 text-sm font-medium text-[var(--accent)]",children:r("workers.worker_info")}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:e.jsx(Q,{worker:s,showExtended:!0})})]})]}):e.jsxs(e.Fragment,{children:[s.capabilities.length>0&&e.jsxs("div",{className:"mb-6 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("h2",{className:"mb-3 text-xs text-[var(--text-muted)]",children:r("workers.capabilities")}),e.jsx("div",{className:"flex flex-wrap gap-2",children:s.capabilities.map(a=>{var k;const u=(k=s.degradedCapabilities)==null?void 0:k.find(ce=>ce.agentType===a);return e.jsxs("span",{className:`rounded-[4px] border px-2.5 py-1 text-xs ${u?"border-[var(--warning)] text-[var(--warning)] bg-[var(--warning)]/5":"border-[var(--border)] text-[var(--text-secondary)]"}`,children:[a,u&&e.jsx("span",{className:"ml-1.5 text-[10px]",children:ee(u.failureType)})]},a)})}),(((B=s.degradedCapabilities)==null?void 0:B.length)??0)>0&&e.jsx("div",{className:"mt-3 space-y-2",children:s.degradedCapabilities.map(a=>e.jsx(J,{agentType:a.agentType,failureType:a.failureType,failureCount:a.failureCount,showRestore:V&&f,onRestore:()=>{C(a.agentType),y(!0)}},a.agentType))})]}),e.jsx(X,{title:r("workers.current_tasks"),tasks:U,navigate:n,nextCursor:j,pageNumber:G,hasPrev:v.length>0,onNext:W,onPrev:q})]})]})]}),e.jsx(Ce,{isOpen:o,onClose:()=>i(!1),onConfirm:oe,workerName:s.name,isDraining:_,loading:d}),e.jsx(A,{isOpen:D,onClose:()=>p(!1),onConfirm:ie,title:r("workers.decommission_title"),message:r("workers.decommission_confirm",{name:s.name}),confirmLabel:r("workers.decommission"),confirmVariant:"danger",isLoading:T}),e.jsx(A,{isOpen:re,onClose:()=>{y(!1),C(null)},onConfirm:le,title:r("workers.restore_capability_title"),message:r("workers.restore_capability_confirm",{capability:L??r("workers.unknown"),name:s.name}),confirmLabel:r("workers.restore_capability"),confirmVariant:"accent",isLoading:se})]})}function J({agentType:t,failureType:n,failureCount:r,showRestore:o,onRestore:i}){const{t:d}=h();return e.jsx("div",{className:"rounded-[4px] border border-[var(--warning)] bg-[var(--warning)]/5 p-3 text-sm",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"font-medium",children:t}),e.jsxs("span",{className:"text-[var(--text-muted)] ml-2 text-xs",children:[ee(n)," · ",r," consecutive failure",r!==1?"s":""," · ",Se(n,d)]})]}),o&&e.jsx("button",{type:"button",onClick:i,className:"shrink-0 rounded-[4px] border border-[var(--accent)]/40 px-2.5 py-1 text-xs text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors",children:d("workers.restore_capability")})]})})}function Q({worker:t,showExtended:n=!1}){const{t:r}=h();return e.jsxs("div",{className:"flex flex-col gap-2 text-xs",children:[e.jsx(x,{label:r("workers.worker_id"),value:t.id}),e.jsx(x,{label:r("workers.host"),value:t.host}),e.jsx(x,{label:r("workers.os"),value:t.os??r("workers.unknown")}),e.jsx(x,{label:r("workers.cpu_model"),value:t.cpuModel??r("workers.n_a")}),e.jsx(x,{label:r("workers.cpu_cores"),value:t.cpuCores!=null?String(t.cpuCores):r("workers.n_a")}),e.jsx(x,{label:r("workers.memory"),value:t.memoryGb!=null?`${t.memoryGb} gb`:r("workers.n_a")}),e.jsx(x,{label:r("workers.last_heartbeat_label"),value:Y(t.lastHeartbeat)}),e.jsx(x,{label:r("workers.slots"),value:`${t.activeSlots}/${t.maxSlots}`}),n&&e.jsxs(e.Fragment,{children:[e.jsx(x,{label:r("workers.status_label"),value:t.status.toLowerCase()}),e.jsx(x,{label:r("workers.worker_version"),value:t.workerVersion??r("workers.n_a")})]})]})}function X({title:t,tasks:n,navigate:r,nextCursor:o,pageNumber:i,hasPrev:d,onNext:c,onPrev:D}){const{t:p}=h(),T=d||!!o;return e.jsxs("div",{className:"mb-6 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("h2",{className:"mb-3 text-xs text-[var(--text-muted)]",children:t}),n.length===0&&!d?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-6",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:p("workers.no_active_tasks")})]}):e.jsxs(e.Fragment,{children:[e.jsx(De,{tasks:n,navigate:r}),T&&e.jsxs("div",{className:"mt-3 flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["// page ",i]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:D,disabled:!d,className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:border-[var(--accent)] disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:[e.jsx(Ne,{className:"h-3.5 w-3.5"}),p("tasks.prev")]}),e.jsxs("button",{onClick:c,disabled:!o,className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:border-[var(--accent)] disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:[p("common.next"),e.jsx(ye,{className:"h-3.5 w-3.5"})]})]})]})]})]})}function De({tasks:t,navigate:n}){const{t:r}=h();return e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border-row)]",children:[e.jsx("th",{className:"py-2 pr-4 text-left font-normal text-[var(--text-muted)]",children:r("workers.id")}),e.jsx("th",{className:"py-2 pr-4 text-left font-normal text-[var(--text-muted)]",children:r("workers.description")}),e.jsx("th",{className:"py-2 pr-4 text-left font-normal text-[var(--text-muted)]",children:r("workers.status_label")}),e.jsx("th",{className:"py-2 text-left font-normal text-[var(--text-muted)]",children:r("workers.stage")})]})}),e.jsx("tbody",{children:t.map(o=>e.jsxs("tr",{onClick:()=>n(`/tasks/${o.id}`),className:"cursor-pointer border-b border-[var(--border-row)] hover:bg-[var(--bg-input)] transition-colors",children:[e.jsxs("td",{className:"py-2 pr-4 text-[var(--text-primary)]",children:["#",o.id]}),e.jsx("td",{className:"max-w-[120px] md:max-w-xs truncate py-2 pr-4 text-[var(--text-secondary)] preserve-case",children:e.jsx(fe,{content:o.description,children:be(o)})}),e.jsx("td",{className:"py-2 pr-4",children:e.jsxs("span",{style:{color:we[o.status]},children:["● ",o.status.toLowerCase()]})}),e.jsx("td",{className:"py-2 text-[var(--text-secondary)]",children:o.currentStage??"-"})]},o.id))})]})})}function O({label:t,value:n,unit:r}){const o=Math.round(n*100);return e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:t}),e.jsxs("p",{className:"mt-2 text-lg font-semibold text-[var(--text-primary)]",children:[o,r]}),e.jsx("div",{className:"mt-3 h-1.5 w-full rounded-[2px] bg-[var(--bg-input)]",children:e.jsx("div",{className:"h-full rounded-[2px] transition-all",style:{width:`${o}%`,backgroundColor:ge(n)}})})]})}export{Ue as default};
1
+ import{a as h,j as e,s as A,B as de,f as xe,r as l,u as me,k as z,x as pe,W as b,D as S,L as ue,V as K,h as N,l as be}from"./index-J1zWTACN.js";import{t as ve,c as Y}from"./date-CmcdoD87.js";import{w as he,b as ge,t as we}from"./status-colors-IR97PkWv.js";import{I as x}from"./InfoRow-C_tQVkuP.js";import{M}from"./MetricBar-CKXN_2Ue.js";import{u as je}from"./useFetch-CZCaxaCi.js";import{T as fe}from"./Tooltip-DZdu3ZKx.js";import{T as Z}from"./trash-2-DuFeqRaH.js";import{A as ke}from"./arrow-left-sGTyHBvX.js";import{C as Ne}from"./chevron-left-C0Zw71uv.js";import{C as ye}from"./chevron-right-BCit7CZP.js";function Ce({isOpen:t,onClose:n,onConfirm:r,workerName:o,isDraining:i,loading:d}){const{t:c}=h();return e.jsx(A,{isOpen:t,onClose:n,onConfirm:r,title:c(i?"workers.undrain_worker_title":"workers.drain_worker_title"),message:i?c("workers.undrain_confirm",{name:o}):c("workers.drain_confirm",{name:o}),confirmLabel:c(i?"workers.undrain":"workers.drain"),confirmVariant:i?"accent":"warning",isLoading:d})}const _e=20;function ee(t){return t==="rate_limit"?"rate limited":t}function Se(t,n){return n(t==="binary_missing"?"workers.manual_restore_required":"workers.awaiting_auto_recovery")}function Ue(){var H,B;const{id:t}=de(),n=xe(),{t:r}=h(),[o,i]=l.useState(!1),[d,c]=l.useState(!1),[D,p]=l.useState(!1),[T,E]=l.useState(!1),[re,y]=l.useState(!1),[se,$]=l.useState(!1),[L,C]=l.useState(null),g=me(a=>{var u;return(u=a.user)==null?void 0:u.role}),te=z(a=>a.workerSeq),ae=z(a=>a.taskSeq),[w,P]=l.useState(void 0),[v,R]=l.useState([]),{data:m,loading:ne,error:F,refetch:I}=je(async()=>{if(!t)throw new Error("Missing worker ID");const a={limit:String(_e)};w&&(a.cursor=w);const[u,k]=await Promise.all([N.get(`web/workers/${t}`).json(),N.get(`web/workers/${t}/tasks`,{searchParams:a}).json().catch(()=>({data:[],nextCursor:null}))]);return{worker:u,tasks:k.data,nextCursor:k.nextCursor}},[t,te,ae,w]),s=(m==null?void 0:m.worker)??null,U=(m==null?void 0:m.tasks)??[],j=(m==null?void 0:m.nextCursor)??null,W=l.useCallback(()=>{j&&(R(a=>[...a,w??""]),P(j))},[j,w]),q=l.useCallback(()=>{v.length!==0&&(P(v.at(-1)||void 0),R(a=>a.slice(0,-1)))},[v]),G=v.length+1,V=g===S.LEAD||g===S.ADMIN;pe(l.useMemo(()=>!s||s.status===b.DECOMMISSIONED?null:e.jsxs("div",{className:"flex items-center gap-2",children:[s.status===b.ONLINE&&e.jsxs("button",{onClick:()=>i(!0),className:"rounded-[4px] border border-[var(--warning)]/40 px-3 py-1.5 text-xs text-[var(--warning)] hover:bg-[var(--warning)]/10 transition-colors",children:["> ",r("workers.drain")]}),g===S.ADMIN&&e.jsxs("button",{onClick:()=>p(!0),className:"flex items-center gap-1 rounded-[4px] border border-[var(--destructive)]/40 px-3 py-1.5 text-xs text-[var(--destructive)] hover:bg-[var(--destructive)]/10 transition-colors",children:[e.jsx(Z,{className:"h-3 w-3"}),r("workers.decommission")]})]}),[s,g,r]));async function oe(){if(s){c(!0);try{const a=s.status===b.DRAINING?"undrain":"drain";await N.post(`web/workers/${s.id}/${a}`),await I()}catch{}finally{c(!1),i(!1)}}}async function ie(){if(s){E(!0);try{await N.delete(`admin/workers/${s.id}`),n("/workers")}catch{}finally{E(!1),p(!1)}}}async function le(){if(!(!s||!L)){$(!0);try{await N.post(`web/workers/${s.id}/capabilities/${encodeURIComponent(L)}/restore`),await I()}catch{}finally{$(!1),y(!1),C(null)}}}if(ne)return e.jsx("div",{className:"mx-auto max-w-5xl px-4 md:px-6 py-8 font-mono",children:e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:r("workers.loading_worker")})});if(F)return e.jsxs("div",{className:"mx-auto max-w-5xl px-4 md:px-6 py-8 font-mono lowercase text-center",children:[e.jsx("p",{className:"text-sm text-[var(--destructive)]",children:F}),e.jsx("button",{onClick:()=>I(),className:"mt-4 rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:r("common.retry")})]});if(!s)return e.jsxs("div",{className:"mx-auto max-w-5xl px-4 md:px-6 py-8 font-mono lowercase text-center",children:[e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:r("workers.worker_not_found")}),e.jsxs("button",{onClick:()=>n("/workers"),className:"mt-4 rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:["< ",r("workers.back_to_workers")]})]});const _=s.status===b.DRAINING,f=s.status!==b.DECOMMISSIONED;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mx-auto max-w-5xl font-mono lowercase",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] bg-[var(--bg-primary)] px-4 shrink-0 md:hidden",style:{height:56},children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("button",{onClick:()=>n("/workers"),className:"shrink-0 text-[var(--text-muted)]",children:e.jsx(ke,{className:"h-4 w-4"})}),e.jsx("span",{className:"truncate text-sm font-medium text-[var(--text-primary)]",children:s.name})]}),!_&&s.status!==b.OFFLINE&&f&&e.jsxs("button",{onClick:()=>i(!0),className:"shrink-0 rounded-[4px] border border-[var(--warning)]/40 px-3 py-1.5 text-xs text-[var(--warning)] hover:bg-[var(--warning)]/10 transition-colors",children:["> ",r("workers.drain")]})]}),e.jsxs("div",{className:"px-4 md:px-6 py-8",children:[_?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx(ue,{to:"/workers",className:"text-[var(--text-muted)] hover:text-[var(--text-secondary)] transition-colors",children:r("workers.title")}),e.jsx("span",{className:"text-[var(--text-muted)]",children:"/"}),e.jsx("span",{className:"text-[var(--text-secondary)]",children:s.name})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[f&&e.jsxs("button",{onClick:()=>i(!0),className:"rounded-[4px] border border-[var(--accent)] px-4 py-1.5 text-xs text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors",children:["> ",r("workers.undrain")]}),g===S.ADMIN&&f&&e.jsxs("button",{onClick:()=>p(!0),className:"flex items-center gap-1 rounded-[4px] border border-[var(--destructive)]/40 px-3 py-1.5 text-xs text-[var(--destructive)] hover:bg-[var(--destructive)]/10 transition-colors",children:[e.jsx(Z,{className:"h-3 w-3"}),r("workers.decommission")]})]})]}),e.jsx("div",{className:"mb-4",children:e.jsx("span",{className:"rounded-[4px] bg-[var(--warning)]/20 px-2.5 py-1 text-xs font-medium text-[var(--warning)]",children:r("workers.draining")})}),e.jsxs("div",{className:"mb-6 rounded-[4px] border border-[var(--warning)]/40 bg-[var(--warning)]/10 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(K,{className:"h-3.5 w-3.5 text-[var(--warning)]"}),e.jsx("span",{className:"text-xs text-[var(--warning)]",children:r("workers.draining_warning")})]}),e.jsx("p",{className:"text-xs text-[var(--warning)]/70 ml-5.5",children:r("workers.draining_active_tasks")})]}),e.jsxs("div",{className:"mb-6 grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsx(O,{label:r("workers.cpu"),value:s.cpuUsage,unit:"%"}),e.jsx(O,{label:r("workers.memory"),value:s.memoryUsage,unit:"%"}),e.jsx(O,{label:r("workers.disk"),value:s.diskUsage,unit:"%"}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("workers.slots")}),e.jsxs("p",{className:"mt-2 text-lg font-semibold text-[var(--text-primary)]",children:[s.activeSlots,"/",s.maxSlots]})]})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>n("/workers"),className:"mb-4 text-xs text-[var(--text-muted)] hover:text-[var(--text-secondary)] transition-colors",children:["< ",r("workers.back_to_workers")]}),e.jsxs("h1",{className:"mb-2 text-lg font-bold text-[var(--text-primary)] flex items-center gap-2",children:[s.name,e.jsxs("span",{className:"flex items-center gap-1.5 text-sm font-normal",style:{color:he[s.status]},children:[e.jsx("span",{style:{fontSize:"0.5rem"},children:"●"}),s.status.toLowerCase()]})]}),e.jsx("p",{className:"mb-6 text-xs text-[var(--text-muted)]",children:r("workers.last_heartbeat",{time:ve(s.lastHeartbeat,"never")})}),s.status===b.DECOMMISSIONED&&e.jsx("div",{className:"mb-6 rounded-[4px] border border-[var(--text-muted)]/40 bg-[var(--text-muted)]/10 p-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(K,{className:"h-3.5 w-3.5 text-[var(--text-muted)]"}),e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["this worker has been decommissioned",s.decommissionedAt?` on ${Y(s.decommissionedAt)}`:""," and can no longer accept tasks."]})]})}),e.jsxs("div",{className:"mb-6 grid gap-4 lg:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("h2",{className:"mb-3 text-xs text-[var(--text-muted)]",children:r("workers.resource_usage")}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(M,{label:r("workers.cpu"),value:s.cpuUsage}),e.jsx(M,{label:r("workers.mem"),value:s.memoryUsage}),e.jsx(M,{label:r("workers.disk"),value:s.diskUsage})]})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("h2",{className:"mb-3 text-xs text-[var(--text-muted)]",children:r("workers.connection_info")}),e.jsx(Q,{worker:s})]})]})]}),_?e.jsxs(e.Fragment,{children:[e.jsx(X,{title:r("workers.active_tasks"),tasks:U,navigate:n,nextCursor:j,pageNumber:G,hasPrev:v.length>0,onNext:W,onPrev:q}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"mb-4 text-sm font-medium text-[var(--accent)]",children:r("workers.capabilities")}),s.capabilities.length>0?e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:s.capabilities.map(a=>e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsx("p",{className:"text-xs text-[var(--text-primary)]",children:a})},a))}):e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("workers.no_capabilities_short")}),(((H=s.degradedCapabilities)==null?void 0:H.length)??0)>0&&e.jsx("div",{className:"mt-3 space-y-2",children:s.degradedCapabilities.map(a=>e.jsx(J,{agentType:a.agentType,failureType:a.failureType,failureCount:a.failureCount,showRestore:V&&f,onRestore:()=>{C(a.agentType),y(!0)}},a.agentType))})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"mb-4 text-sm font-medium text-[var(--accent)]",children:r("workers.worker_info")}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:e.jsx(Q,{worker:s,showExtended:!0})})]})]}):e.jsxs(e.Fragment,{children:[s.capabilities.length>0&&e.jsxs("div",{className:"mb-6 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("h2",{className:"mb-3 text-xs text-[var(--text-muted)]",children:r("workers.capabilities")}),e.jsx("div",{className:"flex flex-wrap gap-2",children:s.capabilities.map(a=>{var k;const u=(k=s.degradedCapabilities)==null?void 0:k.find(ce=>ce.agentType===a);return e.jsxs("span",{className:`rounded-[4px] border px-2.5 py-1 text-xs ${u?"border-[var(--warning)] text-[var(--warning)] bg-[var(--warning)]/5":"border-[var(--border)] text-[var(--text-secondary)]"}`,children:[a,u&&e.jsx("span",{className:"ml-1.5 text-[10px]",children:ee(u.failureType)})]},a)})}),(((B=s.degradedCapabilities)==null?void 0:B.length)??0)>0&&e.jsx("div",{className:"mt-3 space-y-2",children:s.degradedCapabilities.map(a=>e.jsx(J,{agentType:a.agentType,failureType:a.failureType,failureCount:a.failureCount,showRestore:V&&f,onRestore:()=>{C(a.agentType),y(!0)}},a.agentType))})]}),e.jsx(X,{title:r("workers.current_tasks"),tasks:U,navigate:n,nextCursor:j,pageNumber:G,hasPrev:v.length>0,onNext:W,onPrev:q})]})]})]}),e.jsx(Ce,{isOpen:o,onClose:()=>i(!1),onConfirm:oe,workerName:s.name,isDraining:_,loading:d}),e.jsx(A,{isOpen:D,onClose:()=>p(!1),onConfirm:ie,title:r("workers.decommission_title"),message:r("workers.decommission_confirm",{name:s.name}),confirmLabel:r("workers.decommission"),confirmVariant:"danger",isLoading:T}),e.jsx(A,{isOpen:re,onClose:()=>{y(!1),C(null)},onConfirm:le,title:r("workers.restore_capability_title"),message:r("workers.restore_capability_confirm",{capability:L??r("workers.unknown"),name:s.name}),confirmLabel:r("workers.restore_capability"),confirmVariant:"accent",isLoading:se})]})}function J({agentType:t,failureType:n,failureCount:r,showRestore:o,onRestore:i}){const{t:d}=h();return e.jsx("div",{className:"rounded-[4px] border border-[var(--warning)] bg-[var(--warning)]/5 p-3 text-sm",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"font-medium",children:t}),e.jsxs("span",{className:"text-[var(--text-muted)] ml-2 text-xs",children:[ee(n)," · ",r," consecutive failure",r!==1?"s":""," · ",Se(n,d)]})]}),o&&e.jsx("button",{type:"button",onClick:i,className:"shrink-0 rounded-[4px] border border-[var(--accent)]/40 px-2.5 py-1 text-xs text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors",children:d("workers.restore_capability")})]})})}function Q({worker:t,showExtended:n=!1}){const{t:r}=h();return e.jsxs("div",{className:"flex flex-col gap-2 text-xs",children:[e.jsx(x,{label:r("workers.worker_id"),value:t.id}),e.jsx(x,{label:r("workers.host"),value:t.host}),e.jsx(x,{label:r("workers.os"),value:t.os??r("workers.unknown")}),e.jsx(x,{label:r("workers.cpu_model"),value:t.cpuModel??r("workers.n_a")}),e.jsx(x,{label:r("workers.cpu_cores"),value:t.cpuCores!=null?String(t.cpuCores):r("workers.n_a")}),e.jsx(x,{label:r("workers.memory"),value:t.memoryGb!=null?`${t.memoryGb} gb`:r("workers.n_a")}),e.jsx(x,{label:r("workers.last_heartbeat_label"),value:Y(t.lastHeartbeat)}),e.jsx(x,{label:r("workers.slots"),value:`${t.activeSlots}/${t.maxSlots}`}),n&&e.jsxs(e.Fragment,{children:[e.jsx(x,{label:r("workers.status_label"),value:t.status.toLowerCase()}),e.jsx(x,{label:r("workers.worker_version"),value:t.workerVersion??r("workers.n_a")})]})]})}function X({title:t,tasks:n,navigate:r,nextCursor:o,pageNumber:i,hasPrev:d,onNext:c,onPrev:D}){const{t:p}=h(),T=d||!!o;return e.jsxs("div",{className:"mb-6 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("h2",{className:"mb-3 text-xs text-[var(--text-muted)]",children:t}),n.length===0&&!d?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-6",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:p("workers.no_active_tasks")})]}):e.jsxs(e.Fragment,{children:[e.jsx(De,{tasks:n,navigate:r}),T&&e.jsxs("div",{className:"mt-3 flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["// page ",i]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:D,disabled:!d,className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:border-[var(--accent)] disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:[e.jsx(Ne,{className:"h-3.5 w-3.5"}),p("tasks.prev")]}),e.jsxs("button",{onClick:c,disabled:!o,className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:border-[var(--accent)] disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:[p("common.next"),e.jsx(ye,{className:"h-3.5 w-3.5"})]})]})]})]})]})}function De({tasks:t,navigate:n}){const{t:r}=h();return e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border-row)]",children:[e.jsx("th",{className:"py-2 pr-4 text-left font-normal text-[var(--text-muted)]",children:r("workers.id")}),e.jsx("th",{className:"py-2 pr-4 text-left font-normal text-[var(--text-muted)]",children:r("workers.description")}),e.jsx("th",{className:"py-2 pr-4 text-left font-normal text-[var(--text-muted)]",children:r("workers.status_label")}),e.jsx("th",{className:"py-2 text-left font-normal text-[var(--text-muted)]",children:r("workers.stage")})]})}),e.jsx("tbody",{children:t.map(o=>e.jsxs("tr",{onClick:()=>n(`/tasks/${o.id}`),className:"cursor-pointer border-b border-[var(--border-row)] hover:bg-[var(--bg-input)] transition-colors",children:[e.jsxs("td",{className:"py-2 pr-4 text-[var(--text-primary)]",children:["#",o.id]}),e.jsx("td",{className:"max-w-[120px] md:max-w-xs truncate py-2 pr-4 text-[var(--text-secondary)] preserve-case",children:e.jsx(fe,{content:o.description,children:be(o)})}),e.jsx("td",{className:"py-2 pr-4",children:e.jsxs("span",{style:{color:we[o.status]},children:["● ",o.status.toLowerCase()]})}),e.jsx("td",{className:"py-2 text-[var(--text-secondary)]",children:o.currentStage??"-"})]},o.id))})]})})}function O({label:t,value:n,unit:r}){const o=Math.round(n*100);return e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:t}),e.jsxs("p",{className:"mt-2 text-lg font-semibold text-[var(--text-primary)]",children:[o,r]}),e.jsx("div",{className:"mt-3 h-1.5 w-full rounded-[2px] bg-[var(--bg-input)]",children:e.jsx("div",{className:"h-full rounded-[2px] transition-all",style:{width:`${o}%`,backgroundColor:ge(n)}})})]})}export{Ue as default};
@@ -1,4 +1,4 @@
1
- import{c as G,R as U,a as C,j as e,v as q,r as o,h as S,X as K,J as H,f as J,u as V,k as X,W as N,x as Q,D as Y,S as M}from"./index-DAwsREkq.js";import{w as W}from"./status-colors-C14ffr9M.js";import{M as _}from"./MetricBar-DLR15rum.js";import Z from"./WorkerSetupGuidePage-Cjwu7yCO.js";import{C as A}from"./copy-_C7txolK.js";import{L as ee}from"./loader-circle-vH-Hp_AS.js";import{S as te}from"./Select-CC0FnszM.js";import{E as re}from"./EmptyState-BpbqIJyG.js";import{C as se}from"./Skeleton-WCDZdltv.js";import{u as ae}from"./useFetch-CgkGfhaP.js";import{P as oe}from"./plus-DJTaWh3N.js";import{A as ne}from"./arrow-left-Czit8jGK.js";import"./key-b6kn-A1T.js";import"./download-CGR9pdGa.js";import"./settings-DA_C9Znv.js";import"./play-bFi1k4eQ.js";import"./wifi-D5o6IWuC.js";import"./chevron-down-DwSdaR46.js";/**
1
+ import{c as G,R as U,a as C,j as e,v as q,r as o,h as S,X as K,J as H,f as J,u as V,k as X,W as N,x as Q,D as Y,S as M}from"./index-J1zWTACN.js";import{w as W}from"./status-colors-IR97PkWv.js";import{M as _}from"./MetricBar-CKXN_2Ue.js";import Z from"./WorkerSetupGuidePage-aVkDqrMr.js";import{C as A}from"./copy-h1a805Rd.js";import{L as ee}from"./loader-circle-Bq_BpbZ2.js";import{S as te}from"./Select-BXx8KPbW.js";import{E as re}from"./EmptyState-IvQHEoph.js";import{C as se}from"./Skeleton-Crpru9Ol.js";import{u as ae}from"./useFetch-CZCaxaCi.js";import{P as oe}from"./plus-V36Q_nxP.js";import{A as ne}from"./arrow-left-sGTyHBvX.js";import"./key-COdogDFT.js";import"./download-URcu3Jx3.js";import"./settings-DrgaMc9j.js";import"./play-Dbk8Wgkn.js";import"./wifi-Dvp0MK85.js";import"./chevron-down-CE0uuyBZ.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{j as e}from"./index-DAwsREkq.js";function t(){return e.jsx("div",{className:"mx-auto max-w-4xl px-4 md:px-6 py-8 font-mono lowercase",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// overview"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"workers are the machines that execute tasks. overlord monitors worker health, handles capability degradation, recovers from disconnections, and cleans up orphaned processes — all automatically. this guide covers the operational behavior you should understand when running workers in production."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// health monitoring"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-xs text-[var(--accent)]",children:"> heartbeat"}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["workers send a heartbeat to the server every ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:"30 seconds"}),". if the server receives no heartbeat for ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:"3 minutes"}),", the worker is marked ",e.jsx("code",{className:"text-[var(--accent)]",children:"OFFLINE"}),"."]}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"the heartbeat payload includes system metrics (cpu, memory, disk usage) that are displayed in the web dashboard."})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-xs text-[var(--accent)]",children:"> disk usage auto-drain"}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["when a worker's disk usage exceeds ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:"90%"}),", the server automatically sets the worker status to ",e.jsx("code",{className:"text-[var(--accent)]",children:"DRAINING"}),". draining workers stop accepting new tasks but continue executing any in-progress work."]}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2",children:e.jsx("p",{className:"text-xs text-[var(--text-secondary)]",children:"// auto-drain is not automatically reversed. after freeing disk space, an operator must manually undrain the worker via the dashboard or api."})})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// capability degradation"}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["workers track consecutive failures per agent type. after ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:"3 consecutive failures"}),", that agent type is marked as degraded on the worker and tasks requiring it will be routed elsewhere."]}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"failure types determine the recovery window:"}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] 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)] bg-[var(--bg-card)]",children:[e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"failure type"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"recovery time"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"description"})]})}),e.jsxs("tbody",{className:"text-[var(--text-secondary)]",children:[e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"binary_missing"})}),e.jsx("td",{className:"px-3 py-2",children:"permanent"}),e.jsx("td",{className:"px-3 py-2",children:"agent binary not found — requires manual installation"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"auth_failure"})}),e.jsx("td",{className:"px-3 py-2",children:"5 minutes"}),e.jsx("td",{className:"px-3 py-2",children:"credential or token issue"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"rate_limit"})}),e.jsx("td",{className:"px-3 py-2",children:"1 minute"}),e.jsx("td",{className:"px-3 py-2",children:"upstream rate limit hit"})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"unknown"})}),e.jsx("td",{className:"px-3 py-2",children:"10 minutes"}),e.jsx("td",{className:"px-3 py-2",children:"unclassified error"})]})]})]})}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"a single successful execution resets the failure counter for that agent type, restoring the worker's capability."}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2",children:e.jsx("p",{className:"text-xs text-[var(--text-secondary)]",children:"// permanent degradation (e.g. binary_missing) persists until the worker is restarted with the missing binary installed."})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// orphan reaper"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"on startup, each worker runs an orphan reaper that cleans up processes left behind by a previous crash or unclean shutdown. this prevents zombie processes from consuming resources."}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"the cleanup sequence:"}),e.jsxs("ol",{className:"space-y-1 text-xs text-[var(--text-secondary)] list-none pl-0",children:[e.jsx("li",{children:"1. identify orphaned processes from previous worker sessions"}),e.jsxs("li",{children:["2. send ",e.jsx("code",{className:"text-[var(--accent)]",children:"SIGTERM"})," to each process"]}),e.jsxs("li",{children:["3. wait ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:"5 seconds"})," for graceful shutdown"]}),e.jsxs("li",{children:["4. send ",e.jsx("code",{className:"text-[var(--accent)]",children:"SIGKILL"})," to any remaining processes"]})]}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"the orphan reaper supports both linux and macos process management."})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// cursor remote tunnel"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"workers can start a cursor remote tunnel for a task's workspace, making it accessible via the web dashboard for interactive debugging."}),e.jsxs("ul",{className:"space-y-1 text-xs text-[var(--text-secondary)] list-none pl-0",children:[e.jsxs("li",{children:["— ",e.jsx("span",{className:"text-[var(--accent)]",children:"startup timeout:"})," 30 seconds — if the tunnel fails to establish within this window, it is marked as failed"]}),e.jsxs("li",{children:["— ",e.jsx("span",{className:"text-[var(--accent)]",children:"auto-crash recovery:"})," if the tunnel process crashes, the worker retries up to 3 times with exponential backoff (2s, 4s, 8s delays)"]})]}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"tunnels are tied to the task lifecycle and are torn down when the task completes or is cancelled."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// reconnection recovery"}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["when a worker comes back online after a disconnection, overlord reconciles task state between the worker's local view and the server's records. workers have a ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:"10 minute grace window"})," — if they reconnect within this period, recovery is attempted instead of failing all tasks."]}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"the reconciliation covers six branches:"}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] 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)] bg-[var(--bg-card)]",children:[e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"server state"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"worker state"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"action"})]})}),e.jsxs("tbody",{className:"text-[var(--text-secondary)]",children:[e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:"suspended"}),e.jsx("td",{className:"px-3 py-2",children:"running"}),e.jsxs("td",{className:"px-3 py-2",children:[e.jsx("span",{className:"text-[var(--accent)]",children:"resume"})," — task continued running, update server to running"]})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:"suspended"}),e.jsx("td",{className:"px-3 py-2",children:"completed"}),e.jsxs("td",{className:"px-3 py-2",children:[e.jsx("span",{className:"text-[var(--accent)]",children:"complete"})," — task finished while suspended, accept result"]})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:"failed"}),e.jsx("td",{className:"px-3 py-2",children:"running"}),e.jsxs("td",{className:"px-3 py-2",children:[e.jsx("span",{className:"text-[var(--accent)]",children:"cancel"})," — server marked it failed, tell worker to stop"]})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:"failed"}),e.jsx("td",{className:"px-3 py-2",children:"completed"}),e.jsxs("td",{className:"px-3 py-2",children:[e.jsx("span",{className:"text-[var(--accent)]",children:"restore"})," — task actually succeeded, restore result on server"]})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:"cancelled"}),e.jsx("td",{className:"px-3 py-2",children:"any"}),e.jsxs("td",{className:"px-3 py-2",children:[e.jsx("span",{className:"text-[var(--accent)]",children:"stop"})," — user cancelled, ensure worker stops execution"]})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-3 py-2",children:"not reported"}),e.jsx("td",{className:"px-3 py-2",children:"—"}),e.jsxs("td",{className:"px-3 py-2",children:[e.jsx("span",{className:"text-[var(--accent)]",children:"fail"})," — worker has no record of this task, mark it failed"]})]})]})]})}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2",children:e.jsx("p",{className:"text-xs text-[var(--text-secondary)]",children:"// the 10 minute grace window is intentionally generous to handle brief network blips, server restarts, and worker reboots without losing in-progress work."})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// boot reconciliation"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"when the server starts (or restarts), it reconciles all task state to ensure consistency:"}),e.jsxs("ul",{className:"space-y-1 text-xs text-[var(--text-secondary)] list-none pl-0",children:[e.jsxs("li",{children:["— ",e.jsx("span",{className:"text-[var(--accent)]",children:"queued tasks"})," — re-enqueued into the dispatch queue"]}),e.jsxs("li",{children:["— ",e.jsx("span",{className:"text-[var(--accent)]",children:"assigned tasks"})," (claimed by a worker but not yet running) — reset to queued for reassignment"]}),e.jsxs("li",{children:["— ",e.jsx("span",{className:"text-[var(--accent)]",children:"stale running tasks"})," (assigned to workers that are now offline) — marked as failed"]})]})]})]})})}export{t as default};
1
+ import{j as e}from"./index-J1zWTACN.js";function t(){return e.jsx("div",{className:"mx-auto max-w-4xl px-4 md:px-6 py-8 font-mono lowercase",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// overview"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"workers are the machines that execute tasks. overlord monitors worker health, handles capability degradation, recovers from disconnections, and cleans up orphaned processes — all automatically. this guide covers the operational behavior you should understand when running workers in production."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// health monitoring"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-xs text-[var(--accent)]",children:"> heartbeat"}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["workers send a heartbeat to the server every ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:"30 seconds"}),". if the server receives no heartbeat for ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:"3 minutes"}),", the worker is marked ",e.jsx("code",{className:"text-[var(--accent)]",children:"OFFLINE"}),"."]}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"the heartbeat payload includes system metrics (cpu, memory, disk usage) that are displayed in the web dashboard."})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-xs text-[var(--accent)]",children:"> disk usage auto-drain"}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["when a worker's disk usage exceeds ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:"90%"}),", the server automatically sets the worker status to ",e.jsx("code",{className:"text-[var(--accent)]",children:"DRAINING"}),". draining workers stop accepting new tasks but continue executing any in-progress work."]}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2",children:e.jsx("p",{className:"text-xs text-[var(--text-secondary)]",children:"// auto-drain is not automatically reversed. after freeing disk space, an operator must manually undrain the worker via the dashboard or api."})})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// capability degradation"}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["workers track consecutive failures per agent type. after ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:"3 consecutive failures"}),", that agent type is marked as degraded on the worker and tasks requiring it will be routed elsewhere."]}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"failure types determine the recovery window:"}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] 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)] bg-[var(--bg-card)]",children:[e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"failure type"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"recovery time"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"description"})]})}),e.jsxs("tbody",{className:"text-[var(--text-secondary)]",children:[e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"binary_missing"})}),e.jsx("td",{className:"px-3 py-2",children:"permanent"}),e.jsx("td",{className:"px-3 py-2",children:"agent binary not found — requires manual installation"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"auth_failure"})}),e.jsx("td",{className:"px-3 py-2",children:"5 minutes"}),e.jsx("td",{className:"px-3 py-2",children:"credential or token issue"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"rate_limit"})}),e.jsx("td",{className:"px-3 py-2",children:"1 minute"}),e.jsx("td",{className:"px-3 py-2",children:"upstream rate limit hit"})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx("code",{className:"text-[var(--accent)]",children:"unknown"})}),e.jsx("td",{className:"px-3 py-2",children:"10 minutes"}),e.jsx("td",{className:"px-3 py-2",children:"unclassified error"})]})]})]})}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"a single successful execution resets the failure counter for that agent type, restoring the worker's capability."}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2",children:e.jsx("p",{className:"text-xs text-[var(--text-secondary)]",children:"// permanent degradation (e.g. binary_missing) persists until the worker is restarted with the missing binary installed."})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// orphan reaper"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"on startup, each worker runs an orphan reaper that cleans up processes left behind by a previous crash or unclean shutdown. this prevents zombie processes from consuming resources."}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"the cleanup sequence:"}),e.jsxs("ol",{className:"space-y-1 text-xs text-[var(--text-secondary)] list-none pl-0",children:[e.jsx("li",{children:"1. identify orphaned processes from previous worker sessions"}),e.jsxs("li",{children:["2. send ",e.jsx("code",{className:"text-[var(--accent)]",children:"SIGTERM"})," to each process"]}),e.jsxs("li",{children:["3. wait ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:"5 seconds"})," for graceful shutdown"]}),e.jsxs("li",{children:["4. send ",e.jsx("code",{className:"text-[var(--accent)]",children:"SIGKILL"})," to any remaining processes"]})]}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"the orphan reaper supports both linux and macos process management."})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// cursor remote tunnel"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"workers can start a cursor remote tunnel for a task's workspace, making it accessible via the web dashboard for interactive debugging."}),e.jsxs("ul",{className:"space-y-1 text-xs text-[var(--text-secondary)] list-none pl-0",children:[e.jsxs("li",{children:["— ",e.jsx("span",{className:"text-[var(--accent)]",children:"startup timeout:"})," 30 seconds — if the tunnel fails to establish within this window, it is marked as failed"]}),e.jsxs("li",{children:["— ",e.jsx("span",{className:"text-[var(--accent)]",children:"auto-crash recovery:"})," if the tunnel process crashes, the worker retries up to 3 times with exponential backoff (2s, 4s, 8s delays)"]})]}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"tunnels are tied to the task lifecycle and are torn down when the task completes or is cancelled."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// reconnection recovery"}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["when a worker comes back online after a disconnection, overlord reconciles task state between the worker's local view and the server's records. workers have a ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:"10 minute grace window"})," — if they reconnect within this period, recovery is attempted instead of failing all tasks."]}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"the reconciliation covers six branches:"}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] 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)] bg-[var(--bg-card)]",children:[e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"server state"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"worker state"}),e.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)]",children:"action"})]})}),e.jsxs("tbody",{className:"text-[var(--text-secondary)]",children:[e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:"suspended"}),e.jsx("td",{className:"px-3 py-2",children:"running"}),e.jsxs("td",{className:"px-3 py-2",children:[e.jsx("span",{className:"text-[var(--accent)]",children:"resume"})," — task continued running, update server to running"]})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:"suspended"}),e.jsx("td",{className:"px-3 py-2",children:"completed"}),e.jsxs("td",{className:"px-3 py-2",children:[e.jsx("span",{className:"text-[var(--accent)]",children:"complete"})," — task finished while suspended, accept result"]})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:"failed"}),e.jsx("td",{className:"px-3 py-2",children:"running"}),e.jsxs("td",{className:"px-3 py-2",children:[e.jsx("span",{className:"text-[var(--accent)]",children:"cancel"})," — server marked it failed, tell worker to stop"]})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:"failed"}),e.jsx("td",{className:"px-3 py-2",children:"completed"}),e.jsxs("td",{className:"px-3 py-2",children:[e.jsx("span",{className:"text-[var(--accent)]",children:"restore"})," — task actually succeeded, restore result on server"]})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"px-3 py-2",children:"cancelled"}),e.jsx("td",{className:"px-3 py-2",children:"any"}),e.jsxs("td",{className:"px-3 py-2",children:[e.jsx("span",{className:"text-[var(--accent)]",children:"stop"})," — user cancelled, ensure worker stops execution"]})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-3 py-2",children:"not reported"}),e.jsx("td",{className:"px-3 py-2",children:"—"}),e.jsxs("td",{className:"px-3 py-2",children:[e.jsx("span",{className:"text-[var(--accent)]",children:"fail"})," — worker has no record of this task, mark it failed"]})]})]})]})}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2",children:e.jsx("p",{className:"text-xs text-[var(--text-secondary)]",children:"// the 10 minute grace window is intentionally generous to handle brief network blips, server restarts, and worker reboots without losing in-progress work."})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// boot reconciliation"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"when the server starts (or restarts), it reconciles all task state to ensure consistency:"}),e.jsxs("ul",{className:"space-y-1 text-xs text-[var(--text-secondary)] list-none pl-0",children:[e.jsxs("li",{children:["— ",e.jsx("span",{className:"text-[var(--accent)]",children:"queued tasks"})," — re-enqueued into the dispatch queue"]}),e.jsxs("li",{children:["— ",e.jsx("span",{className:"text-[var(--accent)]",children:"assigned tasks"})," (claimed by a worker but not yet running) — reset to queued for reassignment"]}),e.jsxs("li",{children:["— ",e.jsx("span",{className:"text-[var(--accent)]",children:"stale running tasks"})," (assigned to workers that are now offline) — marked as failed"]})]})]})]})})}export{t as default};