@overlordai/server 1.0.159 → 1.0.161

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 (133) hide show
  1. package/dist/adapters/adapter.interface.d.ts +1 -0
  2. package/dist/adapters/adapter.interface.d.ts.map +1 -1
  3. package/dist/adapters/adapter.interface.js.map +1 -1
  4. package/dist/adapters/lark/lark-card.builder.d.ts.map +1 -1
  5. package/dist/adapters/lark/lark-card.builder.js +9 -0
  6. package/dist/adapters/lark/lark-card.builder.js.map +1 -1
  7. package/dist/adapters/slack/slack-block.builder.d.ts.map +1 -1
  8. package/dist/adapters/slack/slack-block.builder.js +6 -0
  9. package/dist/adapters/slack/slack-block.builder.js.map +1 -1
  10. package/dist/adapters/slack/slack.adapter.js +3 -3
  11. package/dist/adapters/slack/slack.adapter.js.map +1 -1
  12. package/dist/notifier/notification-consumer.d.ts +6 -0
  13. package/dist/notifier/notification-consumer.d.ts.map +1 -1
  14. package/dist/notifier/notification-consumer.js +41 -33
  15. package/dist/notifier/notification-consumer.js.map +1 -1
  16. package/dist/notifier/template.service.d.ts +19 -0
  17. package/dist/notifier/template.service.d.ts.map +1 -1
  18. package/dist/notifier/template.service.js +100 -1
  19. package/dist/notifier/template.service.js.map +1 -1
  20. package/dist/web/dashboard.service.d.ts.map +1 -1
  21. package/dist/web/dashboard.service.js +19 -12
  22. package/dist/web/dashboard.service.js.map +1 -1
  23. package/package.json +4 -4
  24. package/public/assets/{AccessTokensPage-DJa6imEC.js → AccessTokensPage-lafHzdS7.js} +1 -1
  25. package/public/assets/{AdminPage-Dg8T3e2A.js → AdminPage-E1k_8cwn.js} +1 -1
  26. package/public/assets/{AgentCliPage-CbOOO3x8.js → AgentCliPage-D47m5vOi.js} +1 -1
  27. package/public/assets/{ApiReferencePage-gLJQIfFs.js → ApiReferencePage-BmOy--0F.js} +1 -1
  28. package/public/assets/{ArchitecturePage-CznVuU5n.js → ArchitecturePage-Bl3bI0N5.js} +1 -1
  29. package/public/assets/{AuditLogPage-CUrXuW9T.js → AuditLogPage-CsI3bO3u.js} +1 -1
  30. package/public/assets/{AutomationCreatePage-Cb1l0-wZ.js → AutomationCreatePage-ri2A-CNJ.js} +1 -1
  31. package/public/assets/{AutomationDetailPage-upMMgI6g.js → AutomationDetailPage-DwNJFVCj.js} +4 -4
  32. package/public/assets/{AutomationEditPage-CUKZxnpo.js → AutomationEditPage-C7Erq9DW.js} +1 -1
  33. package/public/assets/AutomationListPage-DwZAlNEL.js +26 -0
  34. package/public/assets/AutomationRunDetailPage-BG6Cqkj-.js +6 -0
  35. package/public/assets/{BindPlatformPage-CbHYiY2Z.js → BindPlatformPage-D7uHmPgN.js} +1 -1
  36. package/public/assets/{BotIntegrationPage-B9jKTeh6.js → BotIntegrationPage-C_PZlgOb.js} +1 -1
  37. package/public/assets/{BotManage-OSxhQ78T.js → BotManage-DtCgf_zl.js} +1 -1
  38. package/public/assets/{BotSetupPage-NEQkb_aJ.js → BotSetupPage-qTjxFSQi.js} +1 -1
  39. package/public/assets/ChangelogPage-C_Wm5MId.js +1 -0
  40. package/public/assets/{CliReferencePage-V-_oDaRg.js → CliReferencePage-CSY8cjmQ.js} +1 -1
  41. package/public/assets/ConfirmStageDialog-Bn-dCp23.js +1 -0
  42. package/public/assets/{DeploymentPage-CwbD1HEF.js → DeploymentPage-QJAgiKU8.js} +1 -1
  43. package/public/assets/{DevWorkflowPage-Bl6nXzEb.js → DevWorkflowPage-DCzumMIC.js} +1 -1
  44. package/public/assets/{DeveloperManage-TPOpF30z.js → DeveloperManage-DpWen1LJ.js} +1 -1
  45. package/public/assets/{DeveloperSetupPage-B4s49n8U.js → DeveloperSetupPage-DvPNRN1x.js} +1 -1
  46. package/public/assets/{DocsIndexPage-tT9tgN-V.js → DocsIndexPage-BS5Ppp-Y.js} +1 -1
  47. package/public/assets/{DocsLayout-CzPavn6q.js → DocsLayout-CdlGN8MT.js} +1 -1
  48. package/public/assets/{DocsPrimitives-909IF-Hp.js → DocsPrimitives-7fXGxzq1.js} +1 -1
  49. package/public/assets/{EditProjectPage-DmlAPrhm.js → EditProjectPage-knNpD-6Q.js} +1 -1
  50. package/public/assets/{EmptyState-Dg8UN1Uo.js → EmptyState-HBgPBpjr.js} +1 -1
  51. package/public/assets/{EnvVariablesPage-EgX4ZE4x.js → EnvVariablesPage-DMJJwKrY.js} +1 -1
  52. package/public/assets/{HomePage-D_YSq-WI.js → HomePage-DxTGvKjU.js} +1 -1
  53. package/public/assets/{InfoRow-D5N9gMw3.js → InfoRow-CTTO0UCT.js} +1 -1
  54. package/public/assets/{InstallationPage-BQIokEvz.js → InstallationPage-BKEAS8Td.js} +1 -1
  55. package/public/assets/{LandingPage-CbjzE9Hp.js → LandingPage-Ct_q1_6H.js} +1 -1
  56. package/public/assets/{LocalDevelopmentPage-Bt3_QwQi.js → LocalDevelopmentPage-CS-vxrGr.js} +1 -1
  57. package/public/assets/{LoginPage-BocCCnhE.js → LoginPage-Cr9G-uZO.js} +1 -1
  58. package/public/assets/{MetricBar-CtqnZJov.js → MetricBar-C2roX-7q.js} +1 -1
  59. package/public/assets/{MultiSelect-D0uOKezV.js → MultiSelect-DPaJC1DP.js} +1 -1
  60. package/public/assets/{NotFoundPage-t8FksA7t.js → NotFoundPage-cEUsX1Rk.js} +1 -1
  61. package/public/assets/{OnboardingGuide-Bi-g-Iw9.js → OnboardingGuide-CpSdz1bh.js} +1 -1
  62. package/public/assets/{PermissionsPage-CCCmXGJ2.js → PermissionsPage-DEB4f4Cb.js} +1 -1
  63. package/public/assets/{PipelineConfigPage-DLxiRezs.js → PipelineConfigPage-CWFxpBM_.js} +1 -1
  64. package/public/assets/{PipelineEditorPage-BqjN6Z6_.js → PipelineEditorPage-M60zBuOQ.js} +1 -1
  65. package/public/assets/PlanPage-BXb36W0B.js +1 -0
  66. package/public/assets/{ProfilePage-DArQZVmd.js → ProfilePage-CLgA4lzL.js} +1 -1
  67. package/public/assets/{ProjectDetailPage-BiLgLtap.js → ProjectDetailPage-CdgLBerx.js} +1 -1
  68. package/public/assets/{ProjectListPage-rKmXQZfN.js → ProjectListPage-Bty8wJAo.js} +1 -1
  69. package/public/assets/{PtyTerminal-Dyd6hZ66.js → PtyTerminal-C5c80Mk8.js} +1 -1
  70. package/public/assets/{QuickAuth-DzPlVKux.js → QuickAuth-CWDvvnTP.js} +1 -1
  71. package/public/assets/{RemoveMemberConfirmDialog-DkPO6agB.js → RemoveMemberConfirmDialog-C2VkUVMv.js} +1 -1
  72. package/public/assets/{ReviewAggregatePage-Cwqw537t.js → ReviewAggregatePage-U4GSbSXS.js} +1 -1
  73. package/public/assets/{ReviewPage-HUY6XIBP.js → ReviewPage-mcj8sHiD.js} +1 -1
  74. package/public/assets/{Select-BdUjuVPU.js → Select-DYoGoG5A.js} +1 -1
  75. package/public/assets/{SettingsPage-BayKRVfO.js → SettingsPage-CMMM4SH_.js} +1 -1
  76. package/public/assets/{Skeleton-DZltBScg.js → Skeleton-YxLLogK4.js} +1 -1
  77. package/public/assets/{SkillPage-tEl_scrn.js → SkillPage-BV-57UR6.js} +1 -1
  78. package/public/assets/TaskDetailPage-D0us72ot.js +21 -0
  79. package/public/assets/{TaskGuidePage-AzKu3Oth.js → TaskGuidePage-BZgl39sy.js} +1 -1
  80. package/public/assets/{TaskListPage-DFu3jl-d.js → TaskListPage-C_iN0T0V.js} +1 -1
  81. package/public/assets/{TaskStatusBadge-DN9LRx7Z.js → TaskStatusBadge-CvRR_2ds.js} +1 -1
  82. package/public/assets/{TerminalHomePage-0dhFntcB.js → TerminalHomePage-BUZOuMPU.js} +2 -2
  83. package/public/assets/{TokenManage-CK-P3WO8.js → TokenManage-BjWADkxL.js} +1 -1
  84. package/public/assets/{Tooltip-BHebqiCF.js → Tooltip-CqGfu3a-.js} +1 -1
  85. package/public/assets/{TotpSetupPage-Bd9tAUkq.js → TotpSetupPage-DuCCt-vy.js} +1 -1
  86. package/public/assets/{WorkerDetailPage-BAWSgsX7.js → WorkerDetailPage-BYSiRies.js} +1 -1
  87. package/public/assets/{WorkerListPage-Bxi_XBHn.js → WorkerListPage-BSTGesxp.js} +1 -1
  88. package/public/assets/{WorkerOperationsPage-7kpkz1U9.js → WorkerOperationsPage-BPPG9lOT.js} +1 -1
  89. package/public/assets/{WorkerSetupGuidePage-BwCr32j3.js → WorkerSetupGuidePage-BrgtuI5g.js} +1 -1
  90. package/public/assets/{WorkerSetupPage-BZ71fFGZ.js → WorkerSetupPage-CetmEJyM.js} +1 -1
  91. package/public/assets/{agent-type-options-D09p3GHf.js → agent-type-options-cDW8GwHd.js} +1 -1
  92. package/public/assets/{arrow-left-Bx4nR3Vh.js → arrow-left-CnVeKL9M.js} +1 -1
  93. package/public/assets/{arrow-right-ByYi4vIr.js → arrow-right-2N8HSM2i.js} +1 -1
  94. package/public/assets/{bot-ChcNlI1h.js → bot-CU1FE6aR.js} +1 -1
  95. package/public/assets/{chevron-down-CMJNvCkO.js → chevron-down-CAmZEYXZ.js} +1 -1
  96. package/public/assets/{chevron-left-D32li7kz.js → chevron-left-CSWcz_5r.js} +1 -1
  97. package/public/assets/{chevron-right-CJoGvgTt.js → chevron-right-BZbzpWXN.js} +1 -1
  98. package/public/assets/{chevron-up-Ouv2r2Jr.js → chevron-up-CcAPSG40.js} +1 -1
  99. package/public/assets/{circle-alert-B88-HLYp.js → circle-alert-CVKJUhGD.js} +1 -1
  100. package/public/assets/{clock-tNaDNX3I.js → clock-B06FHquf.js} +1 -1
  101. package/public/assets/{copy-tvtyH4eP.js → copy-DWmbt3u5.js} +1 -1
  102. package/public/assets/{download-CRX_DJkZ.js → download-BVZ9yayw.js} +1 -1
  103. package/public/assets/{external-link-DP3KNa_2.js → external-link-CzAmYpcP.js} +1 -1
  104. package/public/assets/{git-fork--Nr0I7x8.js → git-fork-BUH8Kkms.js} +1 -1
  105. package/public/assets/{index-Cnjcx5EP.js → index-CHuch-Tb.js} +2 -2
  106. package/public/assets/{key-CkD-0NnX.js → key-C70dVFbt.js} +1 -1
  107. package/public/assets/{loader-circle-CoOnqP8V.js → loader-circle-C5T3J7As.js} +1 -1
  108. package/public/assets/{pencil-CmamgXMb.js → pencil-CRbtV3Ab.js} +1 -1
  109. package/public/assets/{play-CmZnnLuv.js → play-DtboRxSa.js} +1 -1
  110. package/public/assets/{plus-T50zBWvm.js → plus-B-TXPjx1.js} +1 -1
  111. package/public/assets/{rotate-ccw-I6j0q_Iy.js → rotate-ccw-DSGO2DfJ.js} +1 -1
  112. package/public/assets/{scroll-text-ZBeRRo74.js → scroll-text-BAefM1lo.js} +1 -1
  113. package/public/assets/{settings-B1b_6onY.js → settings-c0ay9170.js} +1 -1
  114. package/public/assets/{skip-forward-B7WDk647.js → skip-forward-5uQlHvbV.js} +1 -1
  115. package/public/assets/{status-colors-BMdWkS1a.js → status-colors-DqGwLP3p.js} +1 -1
  116. package/public/assets/task-agent-DdaZOjeh.js +6 -0
  117. package/public/assets/{task-constants-Bjfrzjfy.js → task-constants-DYetbhd8.js} +1 -1
  118. package/public/assets/{task.store-Bq6C3_Ny.js → task.store-pSu-32fL.js} +1 -1
  119. package/public/assets/{timer-GGOn9LAl.js → timer-iriu8OXp.js} +1 -1
  120. package/public/assets/{trash-2-DlnQ4ddN.js → trash-2-DHxbaPwD.js} +1 -1
  121. package/public/assets/{useFetch-BGgm-RKN.js → useFetch-CSkZlgaA.js} +1 -1
  122. package/public/assets/{users-DgMm52jh.js → users-CQ7FFL3m.js} +1 -1
  123. package/public/assets/{wifi-B-LLQjvB.js → wifi-X-F6YIFU.js} +1 -1
  124. package/public/assets/{workflow-CCSkA4u6.js → workflow-YoWYtExV.js} +1 -1
  125. package/public/assets/{zap-CeHncDxq.js → zap-C6pt7pdv.js} +1 -1
  126. package/public/index.html +1 -1
  127. package/public/sw.js +1 -1
  128. package/public/assets/AutomationListPage-D0uIwr0z.js +0 -26
  129. package/public/assets/AutomationRunDetailPage-BYqfc7Ld.js +0 -6
  130. package/public/assets/ChangelogPage-CGQHZHmO.js +0 -1
  131. package/public/assets/ConfirmStageDialog-B7JvCse7.js +0 -6
  132. package/public/assets/PlanPage-BKJWTsJH.js +0 -1
  133. package/public/assets/TaskDetailPage-Mgt_DDft.js +0 -21
@@ -1 +1 @@
1
- import{f as d,a as o,x as p,r as n,j as t}from"./index-Cnjcx5EP.js";import{Q as c}from"./QuickAuth-DzPlVKux.js";import{P as h}from"./plus-T50zBWvm.js";import"./copy-tvtyH4eP.js";const l={GET:"text-green-400",POST:"text-blue-400",PUT:"text-yellow-400",DELETE:"text-red-400"},m=[{title:"authentication",prefix:"/api/auth",endpoints:[{method:"POST",path:"/login",description:"authenticate with username + password (optional totpCode)",auth:"none",body:'{ "username": "string", "password": "string", "totpCode?": "string" }',response:'{ "accessToken": "string", "refreshToken": "string" }'},{method:"POST",path:"/refresh",description:"refresh access token (rotates refresh token)",auth:"none",body:'{ "refreshToken": "string" }',response:'{ "accessToken": "string", "refreshToken": "string" }'},{method:"POST",path:"/logout",description:"invalidate refresh token",auth:"jwt",body:'{ "refreshToken": "string" }'}]},{title:"tasks",prefix:"/api/web/tasks",endpoints:[{method:"GET",path:"",description:"list tasks with optional filters",auth:"jwt",response:'[ { "id": 1, "description": "...", "status": "RUNNING", ... } ]'},{method:"POST",path:"",description:"create a new task (name is AI-generated if LLM is configured, otherwise null)",auth:"jwt",body:'{ "projectKey": "string", "description": "string", "workerId?": "string", "taskType?": "feat|fix|refactor|docs|chore", "branchSlug?": "string", "targetBranch?": "string" }',response:'{ "id": 1, "description": "...", "name": "string | null", "branchSlug": "string | null", "status": "PENDING", ... }'},{method:"GET",path:"/:id",description:"get task details",auth:"jwt"},{method:"POST",path:"/:id/cancel",description:"cancel a running task",auth:"jwt"},{method:"POST",path:"/:id/retry",description:"retry a failed or cancelled task",auth:"jwt"},{method:"POST",path:"/:id/confirm-stage",description:"confirm/choose/input for suspended stage",auth:"jwt",body:'{ "stageIndex": "number", "result": "string" }'},{method:"POST",path:"/:id/pty-token",description:"get pty websocket token",auth:"jwt"}]},{title:"workers",prefix:"/api/web/workers",endpoints:[{method:"GET",path:"",description:"list all workers",auth:"jwt"},{method:"GET",path:"/:id",description:"get worker details",auth:"jwt"},{method:"GET",path:"/:id/tasks",description:"list tasks assigned to a worker",auth:"jwt"},{method:"POST",path:"/:id/drain",description:"start draining a worker",auth:"jwt"},{method:"POST",path:"/:id/undrain",description:"cancel worker drain",auth:"jwt"}]},{title:"projects",prefix:"/api/web/projects",endpoints:[{method:"GET",path:"",description:"list all projects",auth:"jwt"},{method:"GET",path:"/:key",description:"get project details",auth:"jwt"}]},{title:"profile",prefix:"/api/web/profile",endpoints:[{method:"GET",path:"",description:"get current user profile",auth:"jwt"},{method:"PUT",path:"",description:"update profile (gitName, gitEmail)",auth:"jwt",body:'{ "gitName?": "string", "gitEmail?": "string" }'},{method:"PUT",path:"/password",description:"change password",auth:"jwt",body:'{ "currentPassword": "string", "newPassword": "string" }'},{method:"POST",path:"/totp/setup",description:"initialize totp setup",auth:"jwt"},{method:"POST",path:"/totp/verify",description:"verify totp setup code",auth:"jwt",body:'{ "code": "string" }'},{method:"GET",path:"/tokens",description:"list personal access tokens",auth:"jwt"},{method:"POST",path:"/tokens",description:"create a personal access token",auth:"jwt",body:'{ "label": "string", "expiresAt?": "string" }'},{method:"POST",path:"/tokens/:id/revoke",description:"revoke a token",auth:"jwt"},{method:"POST",path:"/bind-platform",description:"link a chat platform account using a one-time bind token",auth:"jwt",body:'{ "token": "string" }',response:'{ "success": true, "platform": "lark" }'}]},{title:"workspaces & tunnels",prefix:"/api/web",endpoints:[{method:"GET",path:"/workspaces/:taskId",description:"get workspace for a task",auth:"jwt"},{method:"POST",path:"/workspace-tunnel/:taskId/start",description:"start a cursor remote tunnel",auth:"jwt"},{method:"POST",path:"/workspace-tunnel/:taskId/stop",description:"stop a running tunnel",auth:"jwt"},{method:"GET",path:"/workspace-tunnel/:taskId/status",description:"get tunnel status",auth:"jwt"}]},{title:"dashboard",prefix:"/api/web/dashboard",endpoints:[{method:"GET",path:"/stats",description:"get dashboard statistics",auth:"jwt"},{method:"GET",path:"/recent-tasks",description:"get recent tasks for dashboard",auth:"jwt"},{method:"GET",path:"/recent-activity",description:"get recent activity feed",auth:"jwt"}]},{title:"notifications",prefix:"/api/web/notifications",endpoints:[{method:"GET",path:"",description:"list notifications with cursor pagination",auth:"jwt"},{method:"POST",path:"/:id/read",description:"mark a notification as read",auth:"jwt"},{method:"POST",path:"/read-all",description:"mark all notifications as read",auth:"jwt"}]},{title:"search",prefix:"/api/web",endpoints:[{method:"GET",path:"/search?q=query",description:"global search across tasks, workers, projects",auth:"jwt"}]},{title:"admin — developers",prefix:"/api/admin/developers",endpoints:[{method:"GET",path:"",description:"list all developers",auth:"jwt"},{method:"POST",path:"",description:"create a developer",auth:"jwt",body:'{ "name": "string", "password": "string", "role": "string", "gitName": "string", "gitEmail": "string" }'},{method:"PUT",path:"/:id",description:"update developer",auth:"jwt"},{method:"PUT",path:"/:id/reset-totp",description:"reset developer totp",auth:"jwt"}]},{title:"admin — projects",prefix:"/api/admin/projects",endpoints:[{method:"GET",path:"",description:"list all projects",auth:"jwt"},{method:"POST",path:"",description:"create a project",auth:"jwt"},{method:"PUT",path:"/:key",description:"update project (including pipeline)",auth:"jwt"},{method:"DELETE",path:"/:key",description:"delete a project",auth:"jwt"},{method:"GET",path:"/:key/members",description:"get project members",auth:"jwt"},{method:"POST",path:"/:key/members",description:"add project member",auth:"jwt"},{method:"DELETE",path:"/:key/members?developerId=N",description:"remove project member",auth:"jwt"}]},{title:"admin — worker tokens",prefix:"/api/admin/worker-tokens",endpoints:[{method:"GET",path:"",description:"list all worker enrollment tokens",auth:"jwt"},{method:"POST",path:"",description:"generate a new worker token",auth:"jwt"},{method:"POST",path:"/:id/revoke",description:"revoke a worker token",auth:"jwt"},{method:"GET",path:"/:id/status",description:"get token status and linked worker",auth:"jwt"}]},{title:"admin — workers",prefix:"/api/admin/workers",endpoints:[{method:"GET",path:"",description:"list all workers (admin)",auth:"jwt"},{method:"PUT",path:"/:id",description:"update worker status",auth:"jwt",body:'{ "status?": "string" }'}]},{title:"admin — bots",prefix:"/api/admin/bots",endpoints:[{method:"GET",path:"",description:"list bot instances",auth:"jwt"},{method:"POST",path:"",description:"create a bot instance",auth:"jwt"},{method:"GET",path:"/:id/bindings",description:"get group bindings for a bot",auth:"jwt"},{method:"POST",path:"/:id/bindings",description:"create a group binding",auth:"jwt"},{method:"DELETE",path:"/:id/bindings",description:"delete a group binding",auth:"jwt"}]},{title:"admin — audit & settings",prefix:"/api/admin",endpoints:[{method:"GET",path:"/audit-logs",description:"query audit log with filters",auth:"jwt"},{method:"GET",path:"/settings",description:"get all system settings",auth:"jwt"},{method:"PUT",path:"/settings",description:"update system settings",auth:"jwt"}]},{title:"websocket",prefix:"",endpoints:[{method:"GET",path:"WS /ws/pty/:taskId",description:'pty terminal websocket — first obtain a channel token via POST /api/web/tasks/:taskId/pty-token, then send an auth frame after connection: { type: "auth", token: "<jwt>", channelToken: "<channel-token>" }',auth:"jwt"},{method:"GET",path:"WS /api/workers/pty/:taskId",description:'worker pty websocket — auth via frame: { type: "auth", workerJwt: "<worker-jwt>", channelToken: "<channel-token>" }',auth:"worker-token"}]}];function u({ep:e,prefix:a}){const[s,r]=n.useState(!1),{t:i}=o();return t.jsxs("div",{className:"border-b border-[var(--border-row)] last:border-b-0",children:[t.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 sm:gap-3 px-3 md:px-4 py-2.5 text-left transition-colors hover:bg-[var(--bg-input)] min-w-0",onClick:()=>r(!s),children:[t.jsx("span",{className:`w-12 shrink-0 text-xs font-bold ${l[e.method]}`,children:e.method}),t.jsxs("code",{className:"flex-1 text-xs text-[var(--text-primary)] truncate min-w-0",children:[a,e.path]}),t.jsxs("span",{className:"text-xs text-[var(--text-muted)] hidden sm:inline truncate max-w-[200px]",children:["// ",e.description]})]}),s&&t.jsxs("div",{className:"border-t border-[var(--border-row)] bg-[var(--bg-primary)] px-3 md:px-4 py-3 space-y-2",children:[t.jsxs("p",{className:"text-xs text-[var(--text-secondary)]",children:["// ",e.description]}),t.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[t.jsx("span",{className:"text-[var(--text-muted)]",children:"auth:"}),t.jsx("span",{className:e.auth==="none"?"text-[var(--text-muted)]":"text-[var(--accent)]",children:e.auth})]}),e.body&&t.jsxs("div",{children:[t.jsx("p",{className:"text-[11px] uppercase tracking-wider text-[var(--text-muted)] mb-1",children:i("docs.request_body")}),t.jsx("pre",{className:"rounded-[4px] bg-[var(--bg-card)] px-3 py-2 text-xs text-[var(--text-secondary)] overflow-x-auto",children:e.body})]}),e.response&&t.jsxs("div",{children:[t.jsx("p",{className:"text-[11px] uppercase tracking-wider text-[var(--text-muted)] mb-1",children:i("docs.response")}),t.jsx("pre",{className:"rounded-[4px] bg-[var(--bg-card)] px-3 py-2 text-xs text-[var(--text-secondary)] overflow-x-auto",children:e.response})]})]})]})}function g(){const e=d(),{t:a}=o();return p(n.useMemo(()=>t.jsxs("button",{onClick:()=>e("/access-tokens"),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:[t.jsx(h,{className:"h-3.5 w-3.5"}),a("access_tokens.create_token")]}),[e,a])),t.jsxs("div",{className:"mx-auto max-w-4xl px-4 md:px-6 py-8 font-mono lowercase",children:[t.jsx("div",{className:"mb-8",children:t.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:a("docs.api_base_url_desc",{url:"http://localhost:9000"})})}),t.jsx(c,{mode:"api"}),t.jsxs("div",{className:"mb-8 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-2",children:[t.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:a("docs.authentication")}),t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("code",{className:"shrink-0 text-xs text-[var(--accent)]",children:"jwt"}),t.jsxs("span",{className:"text-xs text-[var(--text-secondary)]",children:["obtained via /api/auth/login — pass as ",t.jsx("code",{children:"authorization: bearer <token>"})]})]}),t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("code",{className:"shrink-0 text-xs text-[var(--accent)]",children:"pat"}),t.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:"personal access token — same header format, for cli/api usage"})]}),t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("code",{className:"shrink-0 text-xs text-yellow-400",children:"worker-token"}),t.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:"enrollment token for worker registration — used during initial handshake"})]})]}),t.jsx("div",{className:"space-y-6",children:m.map(s=>t.jsxs("div",{children:[t.jsxs("h2",{className:"mb-2 text-sm text-[var(--accent)]",children:["> ",s.title]}),t.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:s.endpoints.map((r,i)=>t.jsx(u,{ep:r,prefix:s.prefix},`${r.method}-${r.path}-${i}`))})]},s.title))})]})}export{g as default};
1
+ import{f as d,a as o,x as p,r as n,j as t}from"./index-CHuch-Tb.js";import{Q as c}from"./QuickAuth-CWDvvnTP.js";import{P as h}from"./plus-B-TXPjx1.js";import"./copy-DWmbt3u5.js";const l={GET:"text-green-400",POST:"text-blue-400",PUT:"text-yellow-400",DELETE:"text-red-400"},m=[{title:"authentication",prefix:"/api/auth",endpoints:[{method:"POST",path:"/login",description:"authenticate with username + password (optional totpCode)",auth:"none",body:'{ "username": "string", "password": "string", "totpCode?": "string" }',response:'{ "accessToken": "string", "refreshToken": "string" }'},{method:"POST",path:"/refresh",description:"refresh access token (rotates refresh token)",auth:"none",body:'{ "refreshToken": "string" }',response:'{ "accessToken": "string", "refreshToken": "string" }'},{method:"POST",path:"/logout",description:"invalidate refresh token",auth:"jwt",body:'{ "refreshToken": "string" }'}]},{title:"tasks",prefix:"/api/web/tasks",endpoints:[{method:"GET",path:"",description:"list tasks with optional filters",auth:"jwt",response:'[ { "id": 1, "description": "...", "status": "RUNNING", ... } ]'},{method:"POST",path:"",description:"create a new task (name is AI-generated if LLM is configured, otherwise null)",auth:"jwt",body:'{ "projectKey": "string", "description": "string", "workerId?": "string", "taskType?": "feat|fix|refactor|docs|chore", "branchSlug?": "string", "targetBranch?": "string" }',response:'{ "id": 1, "description": "...", "name": "string | null", "branchSlug": "string | null", "status": "PENDING", ... }'},{method:"GET",path:"/:id",description:"get task details",auth:"jwt"},{method:"POST",path:"/:id/cancel",description:"cancel a running task",auth:"jwt"},{method:"POST",path:"/:id/retry",description:"retry a failed or cancelled task",auth:"jwt"},{method:"POST",path:"/:id/confirm-stage",description:"confirm/choose/input for suspended stage",auth:"jwt",body:'{ "stageIndex": "number", "result": "string" }'},{method:"POST",path:"/:id/pty-token",description:"get pty websocket token",auth:"jwt"}]},{title:"workers",prefix:"/api/web/workers",endpoints:[{method:"GET",path:"",description:"list all workers",auth:"jwt"},{method:"GET",path:"/:id",description:"get worker details",auth:"jwt"},{method:"GET",path:"/:id/tasks",description:"list tasks assigned to a worker",auth:"jwt"},{method:"POST",path:"/:id/drain",description:"start draining a worker",auth:"jwt"},{method:"POST",path:"/:id/undrain",description:"cancel worker drain",auth:"jwt"}]},{title:"projects",prefix:"/api/web/projects",endpoints:[{method:"GET",path:"",description:"list all projects",auth:"jwt"},{method:"GET",path:"/:key",description:"get project details",auth:"jwt"}]},{title:"profile",prefix:"/api/web/profile",endpoints:[{method:"GET",path:"",description:"get current user profile",auth:"jwt"},{method:"PUT",path:"",description:"update profile (gitName, gitEmail)",auth:"jwt",body:'{ "gitName?": "string", "gitEmail?": "string" }'},{method:"PUT",path:"/password",description:"change password",auth:"jwt",body:'{ "currentPassword": "string", "newPassword": "string" }'},{method:"POST",path:"/totp/setup",description:"initialize totp setup",auth:"jwt"},{method:"POST",path:"/totp/verify",description:"verify totp setup code",auth:"jwt",body:'{ "code": "string" }'},{method:"GET",path:"/tokens",description:"list personal access tokens",auth:"jwt"},{method:"POST",path:"/tokens",description:"create a personal access token",auth:"jwt",body:'{ "label": "string", "expiresAt?": "string" }'},{method:"POST",path:"/tokens/:id/revoke",description:"revoke a token",auth:"jwt"},{method:"POST",path:"/bind-platform",description:"link a chat platform account using a one-time bind token",auth:"jwt",body:'{ "token": "string" }',response:'{ "success": true, "platform": "lark" }'}]},{title:"workspaces & tunnels",prefix:"/api/web",endpoints:[{method:"GET",path:"/workspaces/:taskId",description:"get workspace for a task",auth:"jwt"},{method:"POST",path:"/workspace-tunnel/:taskId/start",description:"start a cursor remote tunnel",auth:"jwt"},{method:"POST",path:"/workspace-tunnel/:taskId/stop",description:"stop a running tunnel",auth:"jwt"},{method:"GET",path:"/workspace-tunnel/:taskId/status",description:"get tunnel status",auth:"jwt"}]},{title:"dashboard",prefix:"/api/web/dashboard",endpoints:[{method:"GET",path:"/stats",description:"get dashboard statistics",auth:"jwt"},{method:"GET",path:"/recent-tasks",description:"get recent tasks for dashboard",auth:"jwt"},{method:"GET",path:"/recent-activity",description:"get recent activity feed",auth:"jwt"}]},{title:"notifications",prefix:"/api/web/notifications",endpoints:[{method:"GET",path:"",description:"list notifications with cursor pagination",auth:"jwt"},{method:"POST",path:"/:id/read",description:"mark a notification as read",auth:"jwt"},{method:"POST",path:"/read-all",description:"mark all notifications as read",auth:"jwt"}]},{title:"search",prefix:"/api/web",endpoints:[{method:"GET",path:"/search?q=query",description:"global search across tasks, workers, projects",auth:"jwt"}]},{title:"admin — developers",prefix:"/api/admin/developers",endpoints:[{method:"GET",path:"",description:"list all developers",auth:"jwt"},{method:"POST",path:"",description:"create a developer",auth:"jwt",body:'{ "name": "string", "password": "string", "role": "string", "gitName": "string", "gitEmail": "string" }'},{method:"PUT",path:"/:id",description:"update developer",auth:"jwt"},{method:"PUT",path:"/:id/reset-totp",description:"reset developer totp",auth:"jwt"}]},{title:"admin — projects",prefix:"/api/admin/projects",endpoints:[{method:"GET",path:"",description:"list all projects",auth:"jwt"},{method:"POST",path:"",description:"create a project",auth:"jwt"},{method:"PUT",path:"/:key",description:"update project (including pipeline)",auth:"jwt"},{method:"DELETE",path:"/:key",description:"delete a project",auth:"jwt"},{method:"GET",path:"/:key/members",description:"get project members",auth:"jwt"},{method:"POST",path:"/:key/members",description:"add project member",auth:"jwt"},{method:"DELETE",path:"/:key/members?developerId=N",description:"remove project member",auth:"jwt"}]},{title:"admin — worker tokens",prefix:"/api/admin/worker-tokens",endpoints:[{method:"GET",path:"",description:"list all worker enrollment tokens",auth:"jwt"},{method:"POST",path:"",description:"generate a new worker token",auth:"jwt"},{method:"POST",path:"/:id/revoke",description:"revoke a worker token",auth:"jwt"},{method:"GET",path:"/:id/status",description:"get token status and linked worker",auth:"jwt"}]},{title:"admin — workers",prefix:"/api/admin/workers",endpoints:[{method:"GET",path:"",description:"list all workers (admin)",auth:"jwt"},{method:"PUT",path:"/:id",description:"update worker status",auth:"jwt",body:'{ "status?": "string" }'}]},{title:"admin — bots",prefix:"/api/admin/bots",endpoints:[{method:"GET",path:"",description:"list bot instances",auth:"jwt"},{method:"POST",path:"",description:"create a bot instance",auth:"jwt"},{method:"GET",path:"/:id/bindings",description:"get group bindings for a bot",auth:"jwt"},{method:"POST",path:"/:id/bindings",description:"create a group binding",auth:"jwt"},{method:"DELETE",path:"/:id/bindings",description:"delete a group binding",auth:"jwt"}]},{title:"admin — audit & settings",prefix:"/api/admin",endpoints:[{method:"GET",path:"/audit-logs",description:"query audit log with filters",auth:"jwt"},{method:"GET",path:"/settings",description:"get all system settings",auth:"jwt"},{method:"PUT",path:"/settings",description:"update system settings",auth:"jwt"}]},{title:"websocket",prefix:"",endpoints:[{method:"GET",path:"WS /ws/pty/:taskId",description:'pty terminal websocket — first obtain a channel token via POST /api/web/tasks/:taskId/pty-token, then send an auth frame after connection: { type: "auth", token: "<jwt>", channelToken: "<channel-token>" }',auth:"jwt"},{method:"GET",path:"WS /api/workers/pty/:taskId",description:'worker pty websocket — auth via frame: { type: "auth", workerJwt: "<worker-jwt>", channelToken: "<channel-token>" }',auth:"worker-token"}]}];function u({ep:e,prefix:a}){const[s,r]=n.useState(!1),{t:i}=o();return t.jsxs("div",{className:"border-b border-[var(--border-row)] last:border-b-0",children:[t.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 sm:gap-3 px-3 md:px-4 py-2.5 text-left transition-colors hover:bg-[var(--bg-input)] min-w-0",onClick:()=>r(!s),children:[t.jsx("span",{className:`w-12 shrink-0 text-xs font-bold ${l[e.method]}`,children:e.method}),t.jsxs("code",{className:"flex-1 text-xs text-[var(--text-primary)] truncate min-w-0",children:[a,e.path]}),t.jsxs("span",{className:"text-xs text-[var(--text-muted)] hidden sm:inline truncate max-w-[200px]",children:["// ",e.description]})]}),s&&t.jsxs("div",{className:"border-t border-[var(--border-row)] bg-[var(--bg-primary)] px-3 md:px-4 py-3 space-y-2",children:[t.jsxs("p",{className:"text-xs text-[var(--text-secondary)]",children:["// ",e.description]}),t.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[t.jsx("span",{className:"text-[var(--text-muted)]",children:"auth:"}),t.jsx("span",{className:e.auth==="none"?"text-[var(--text-muted)]":"text-[var(--accent)]",children:e.auth})]}),e.body&&t.jsxs("div",{children:[t.jsx("p",{className:"text-[11px] uppercase tracking-wider text-[var(--text-muted)] mb-1",children:i("docs.request_body")}),t.jsx("pre",{className:"rounded-[4px] bg-[var(--bg-card)] px-3 py-2 text-xs text-[var(--text-secondary)] overflow-x-auto",children:e.body})]}),e.response&&t.jsxs("div",{children:[t.jsx("p",{className:"text-[11px] uppercase tracking-wider text-[var(--text-muted)] mb-1",children:i("docs.response")}),t.jsx("pre",{className:"rounded-[4px] bg-[var(--bg-card)] px-3 py-2 text-xs text-[var(--text-secondary)] overflow-x-auto",children:e.response})]})]})]})}function g(){const e=d(),{t:a}=o();return p(n.useMemo(()=>t.jsxs("button",{onClick:()=>e("/access-tokens"),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:[t.jsx(h,{className:"h-3.5 w-3.5"}),a("access_tokens.create_token")]}),[e,a])),t.jsxs("div",{className:"mx-auto max-w-4xl px-4 md:px-6 py-8 font-mono lowercase",children:[t.jsx("div",{className:"mb-8",children:t.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:a("docs.api_base_url_desc",{url:"http://localhost:9000"})})}),t.jsx(c,{mode:"api"}),t.jsxs("div",{className:"mb-8 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-2",children:[t.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:a("docs.authentication")}),t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("code",{className:"shrink-0 text-xs text-[var(--accent)]",children:"jwt"}),t.jsxs("span",{className:"text-xs text-[var(--text-secondary)]",children:["obtained via /api/auth/login — pass as ",t.jsx("code",{children:"authorization: bearer <token>"})]})]}),t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("code",{className:"shrink-0 text-xs text-[var(--accent)]",children:"pat"}),t.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:"personal access token — same header format, for cli/api usage"})]}),t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("code",{className:"shrink-0 text-xs text-yellow-400",children:"worker-token"}),t.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:"enrollment token for worker registration — used during initial handshake"})]})]}),t.jsx("div",{className:"space-y-6",children:m.map(s=>t.jsxs("div",{children:[t.jsxs("h2",{className:"mb-2 text-sm text-[var(--accent)]",children:["> ",s.title]}),t.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:s.endpoints.map((r,i)=>t.jsx(u,{ep:r,prefix:s.prefix},`${r.method}-${r.path}-${i}`))})]},s.title))})]})}export{g as default};
@@ -1,4 +1,4 @@
1
- import{j as e}from"./index-Cnjcx5EP.js";import{C as s}from"./DocsPrimitives-909IF-Hp.js";import"./copy-tvtyH4eP.js";const r=` ┌──────────────────┐
1
+ import{j as e}from"./index-CHuch-Tb.js";import{C as s}from"./DocsPrimitives-7fXGxzq1.js";import"./copy-DWmbt3u5.js";const r=` ┌──────────────────┐
2
2
  │ Developer │
3
3
  │ (create / attach) │
4
4
  └──┬─────┬──────┬──┘
@@ -1 +1 @@
1
- import{a as C,r,h as S,j as e,y as k}from"./index-Cnjcx5EP.js";import{S as L}from"./Select-BdUjuVPU.js";import{E}from"./EmptyState-Dg8UN1Uo.js";import{T}from"./Skeleton-DZltBScg.js";import{S as A}from"./scroll-text-ZBeRRo74.js";import{C as F}from"./chevron-left-D32li7kz.js";import{C as P}from"./chevron-right-CJoGvgTt.js";import"./chevron-down-CMJNvCkO.js";function q(){const{t:a}=C(),h=[{value:"",label:a("admin.all_actions")},{value:"login",label:a("admin.action_login")},{value:"logout",label:a("admin.action_logout")},{value:"create",label:a("admin.action_create")},{value:"update",label:a("admin.action_update")},{value:"delete",label:a("admin.action_delete")},{value:"revoke",label:a("admin.action_revoke")},{value:"reset_2fa",label:a("admin.action_reset_2fa")},{value:"generate_token",label:a("admin.action_generate_token")}],[n,b]=r.useState([]),[f,p]=r.useState(!0),[i,j]=r.useState(""),[o,g]=r.useState(""),[N,c]=r.useState(void 0),[x,m]=r.useState([]),[l,w]=r.useState(void 0),d=r.useCallback(async t=>{try{p(!0);const s={limit:"50"};t&&(s.cursor=t),i&&(s.action=i),o&&(s.user=o);const v=await S.get("admin/audit-logs",{searchParams:s}).json();b(v.data),w(v.nextCursor)}catch{}finally{p(!1)}},[i,o]);r.useEffect(()=>{c(void 0),m([]),d()},[d]);function _(){l&&(m(t=>[...t,N??""]),c(l),d(l))}function y(){if(x.length===0)return;const t=[...x],s=t.pop();m(t),c(s||void 0),d(s||void 0)}function u(t){return t.startsWith("delete")||t==="revoke"?"text-[var(--destructive)]":t.startsWith("create")||t==="generate_token"?"text-[var(--accent)]":t.startsWith("update")||t==="reset_2fa"?"text-[var(--warning)]":t==="login"?"text-[var(--info)]":"text-[var(--text-secondary)]"}return e.jsxs("div",{className:"font-mono",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:a("admin.audit_title")}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:a("admin.audit_subtitle")})]}),e.jsxs("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center",children:[e.jsx(L,{value:i,onChange:j,options:h}),e.jsxs("div",{className:"relative w-full max-w-xs",children:[e.jsx(k,{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:a("admin.filter_by_user"),value:o,onChange:t=>g(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)] focus:outline-none focus:border-[var(--accent)]"})]})]}),f?e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsx(T,{rows:5})}):n.length===0?e.jsx(E,{icon:A,title:a("admin.no_audit_entries"),description:a("admin.audit_logs_appear")}):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:a("admin.timestamp")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.user_id")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.action")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.resource")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.detail")}),e.jsx("th",{className:"pb-2 font-normal",children:a("admin.ip")})]})}),e.jsx("tbody",{children:n.map(t=>e.jsxs("tr",{className:"border-b border-[var(--border-row)] hover:bg-white/[0.02] transition-colors",children:[e.jsx("td",{className:"whitespace-nowrap py-2.5 pr-4 text-[var(--text-muted)]",children:new Date(t.createdAt).toLocaleString()}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:t.userId}),e.jsx("td",{className:"py-2.5 pr-4",children:e.jsx("span",{className:u(t.action),children:t.action})}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:t.resource}),e.jsx("td",{className:"max-w-xs truncate py-2.5 pr-4 text-[var(--text-muted)]",children:t.detail}),e.jsx("td",{className:"py-2.5 text-[var(--text-muted)]",children:t.ip})]},t.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3",children:n.map(t=>e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3",children:[e.jsx("div",{className:"text-[11px] text-[var(--text-muted)] mb-1",children:new Date(t.createdAt).toLocaleString()}),e.jsxs("div",{className:"flex min-w-0 items-center gap-2 mb-1",children:[e.jsx("span",{className:`shrink-0 text-[11px] ${u(t.action)}`,children:t.action}),e.jsx("span",{className:"min-w-0 truncate text-[11px] text-[var(--text-secondary)]",children:t.resource})]}),e.jsx("div",{className:"text-[11px] text-[var(--text-muted)] truncate",children:t.detail}),e.jsxs("div",{className:"flex items-center gap-3 mt-1 text-[11px] text-[var(--text-muted)]",children:[e.jsxs("span",{children:["User: ",t.userId]}),e.jsx("span",{children:t.ip})]})]},t.id))}),e.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:a("admin.showing_entries",{count:String(n.length)})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{type:"button",disabled:x.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",onClick:y,children:[e.jsx(F,{className:"h-3.5 w-3.5"}),a("common.previous")]}),e.jsxs("button",{type:"button",disabled:!l,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",onClick:_,children:[a("common.next"),e.jsx(P,{className:"h-3.5 w-3.5"})]})]})]})]})]})}export{q as default};
1
+ import{a as C,r,h as S,j as e,y as k}from"./index-CHuch-Tb.js";import{S as L}from"./Select-DYoGoG5A.js";import{E}from"./EmptyState-HBgPBpjr.js";import{T}from"./Skeleton-YxLLogK4.js";import{S as A}from"./scroll-text-BAefM1lo.js";import{C as F}from"./chevron-left-CSWcz_5r.js";import{C as P}from"./chevron-right-BZbzpWXN.js";import"./chevron-down-CAmZEYXZ.js";function q(){const{t:a}=C(),h=[{value:"",label:a("admin.all_actions")},{value:"login",label:a("admin.action_login")},{value:"logout",label:a("admin.action_logout")},{value:"create",label:a("admin.action_create")},{value:"update",label:a("admin.action_update")},{value:"delete",label:a("admin.action_delete")},{value:"revoke",label:a("admin.action_revoke")},{value:"reset_2fa",label:a("admin.action_reset_2fa")},{value:"generate_token",label:a("admin.action_generate_token")}],[n,b]=r.useState([]),[f,p]=r.useState(!0),[i,j]=r.useState(""),[o,g]=r.useState(""),[N,c]=r.useState(void 0),[x,m]=r.useState([]),[l,w]=r.useState(void 0),d=r.useCallback(async t=>{try{p(!0);const s={limit:"50"};t&&(s.cursor=t),i&&(s.action=i),o&&(s.user=o);const v=await S.get("admin/audit-logs",{searchParams:s}).json();b(v.data),w(v.nextCursor)}catch{}finally{p(!1)}},[i,o]);r.useEffect(()=>{c(void 0),m([]),d()},[d]);function _(){l&&(m(t=>[...t,N??""]),c(l),d(l))}function y(){if(x.length===0)return;const t=[...x],s=t.pop();m(t),c(s||void 0),d(s||void 0)}function u(t){return t.startsWith("delete")||t==="revoke"?"text-[var(--destructive)]":t.startsWith("create")||t==="generate_token"?"text-[var(--accent)]":t.startsWith("update")||t==="reset_2fa"?"text-[var(--warning)]":t==="login"?"text-[var(--info)]":"text-[var(--text-secondary)]"}return e.jsxs("div",{className:"font-mono",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:a("admin.audit_title")}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:a("admin.audit_subtitle")})]}),e.jsxs("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center",children:[e.jsx(L,{value:i,onChange:j,options:h}),e.jsxs("div",{className:"relative w-full max-w-xs",children:[e.jsx(k,{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:a("admin.filter_by_user"),value:o,onChange:t=>g(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)] focus:outline-none focus:border-[var(--accent)]"})]})]}),f?e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsx(T,{rows:5})}):n.length===0?e.jsx(E,{icon:A,title:a("admin.no_audit_entries"),description:a("admin.audit_logs_appear")}):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:a("admin.timestamp")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.user_id")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.action")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.resource")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.detail")}),e.jsx("th",{className:"pb-2 font-normal",children:a("admin.ip")})]})}),e.jsx("tbody",{children:n.map(t=>e.jsxs("tr",{className:"border-b border-[var(--border-row)] hover:bg-white/[0.02] transition-colors",children:[e.jsx("td",{className:"whitespace-nowrap py-2.5 pr-4 text-[var(--text-muted)]",children:new Date(t.createdAt).toLocaleString()}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:t.userId}),e.jsx("td",{className:"py-2.5 pr-4",children:e.jsx("span",{className:u(t.action),children:t.action})}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:t.resource}),e.jsx("td",{className:"max-w-xs truncate py-2.5 pr-4 text-[var(--text-muted)]",children:t.detail}),e.jsx("td",{className:"py-2.5 text-[var(--text-muted)]",children:t.ip})]},t.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3",children:n.map(t=>e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3",children:[e.jsx("div",{className:"text-[11px] text-[var(--text-muted)] mb-1",children:new Date(t.createdAt).toLocaleString()}),e.jsxs("div",{className:"flex min-w-0 items-center gap-2 mb-1",children:[e.jsx("span",{className:`shrink-0 text-[11px] ${u(t.action)}`,children:t.action}),e.jsx("span",{className:"min-w-0 truncate text-[11px] text-[var(--text-secondary)]",children:t.resource})]}),e.jsx("div",{className:"text-[11px] text-[var(--text-muted)] truncate",children:t.detail}),e.jsxs("div",{className:"flex items-center gap-3 mt-1 text-[11px] text-[var(--text-muted)]",children:[e.jsxs("span",{children:["User: ",t.userId]}),e.jsx("span",{children:t.ip})]})]},t.id))}),e.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:a("admin.showing_entries",{count:String(n.length)})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{type:"button",disabled:x.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",onClick:y,children:[e.jsx(F,{className:"h-3.5 w-3.5"}),a("common.previous")]}),e.jsxs("button",{type:"button",disabled:!l,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",onClick:_,children:[a("common.next"),e.jsx(P,{className:"h-3.5 w-3.5"})]})]})]})]})]})}export{q as default};
@@ -1 +1 @@
1
- import{f as J,a as Q,F as W,a1 as A,r,h as X,t as d,j as e}from"./index-Cnjcx5EP.js";import{S as b}from"./Select-BdUjuVPU.js";import{M as ee}from"./MultiSelect-D0uOKezV.js";import{A as te}from"./arrow-left-Bx4nR3Vh.js";import"./chevron-down-CMJNvCkO.js";const ae=[{label:"every_hour",value:"0 * * * *"},{label:"every_6_hours",value:"0 */6 * * *"},{label:"daily_midnight",value:"0 0 * * *"},{label:"daily_9am",value:"0 9 * * *"},{label:"weekly_monday",value:"0 9 * * 1"},{label:"custom",value:""}],re=[{label:"completed",value:"COMPLETED"},{label:"failed",value:"FAILED"},{label:"cancelled",value:"CANCELLED"}],oe=[{label:"claude",value:"claude"},{label:"cursor",value:"cursor"},{label:"codex",value:"codex"}],se=["UTC","America/New_York","America/Chicago","America/Denver","America/Los_Angeles","Europe/London","Europe/Berlin","Asia/Tokyo","Asia/Shanghai","Asia/Singapore","Australia/Sydney"];function ne(m){const a=m.trim().split(/\s+/);return a.length===5||a.length===6}function me(){const m=J(),{t:a}=Q(),[Y]=W(),u=Y.get("templateId"),{createAutomation:w}=A(),[h,P]=r.useState(""),[y,F]=r.useState(""),[s,M]=r.useState([]),[i,$]=r.useState("cron"),[B,j]=r.useState("0 0 * * *"),[v,_]=r.useState("0 0 * * *"),[k,K]=r.useState("UTC"),[N,L]=r.useState("COMPLETED"),[x,C]=r.useState(""),[f,D]=r.useState(""),[g,z]=r.useState("readonly"),[S,T]=r.useState("claude"),[E,I]=r.useState(!0),[U,V]=r.useState({}),[O,G]=r.useState([]),[q,R]=r.useState(!1);r.useEffect(()=>{x&&(s.length===0||!s.includes(x))&&C("")},[x,s]),r.useEffect(()=>{let t=!1;return X.get("web/projects").json().then(n=>{t||G(n),!t&&n.length===1&&(M([n[0].key]),T(n[0].agentType))}).catch(()=>{t||d.error(a("automation.failed_load_projects"))}),()=>{t=!0}},[a]),r.useEffect(()=>{if(!u)return;let t=!1;return A.getState().fetchTemplates().then(()=>{if(t)return;const o=A.getState().templates.find(l=>l.id===Number(u));if(o){P(o.name),F(o.taskDescription),$(o.triggerType),z(o.executionMode);const l=o.triggerConfig;if(o.triggerType==="cron"&&l.cron&&(_(l.cron),j(""),l.timezone&&K(l.timezone)),o.triggerType==="task_event"&&l.event){L(l.event);const c=l.filter;c!=null&&c.projectKey&&C(c.projectKey),c!=null&&c.taskMode&&D(c.taskMode)}const p=o.taskConfig;p&&V(p),p!=null&&p.agentType&&T(p.agentType),I(!0)}}),()=>{t=!0}},[u]);const Z=t=>{j(t),t&&_(t)},H=r.useCallback(async()=>{if(!h.trim()){d.error(a("automation.name_required"));return}if(s.length===0){d.error(a("automation.project_required"));return}let t={};if(i==="cron"){if(!v.trim()){d.error(a("automation.cron_expression_required"));return}if(!ne(v)){d.error(a("automation.cron_expression_invalid"));return}t={cron:v,timezone:k}}else i==="task_event"&&(t={event:N,filter:{...x&&{projectKey:x},...f&&{taskMode:f}}});R(!0);try{const n=await w({projectKey:s[0],projectKeys:s,name:h.trim(),description:y.trim(),triggerType:i,triggerConfig:t,executionMode:g,taskConfig:{...U,agentType:S},notifyProjectChats:E,...u?{templateId:Number(u)}:{}});d.success(a("automation.automation_created")),m(`/automations/${n.id}`)}catch(n){const o=n instanceof Error?n.message:a("automation.failed_create");d.error(o)}finally{R(!1)}},[h,y,s,i,v,k,N,x,f,g,S,E,u,w,m,a]);return e.jsxs("div",{className:"mx-auto max-w-2xl px-2 py-4 md:px-4 md:py-6 font-mono",children:[e.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[e.jsx("button",{onClick:()=>m("/automations"),className:"rounded-[4px] p-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:e.jsx(te,{className:"h-4 w-4"})}),e.jsx("h1",{className:"text-sm font-bold text-[var(--text-primary)]",children:a("automation.create_title")})]}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-project",className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.project")}),e.jsx(ee,{values:s,onChange:M,options:O.map(t=>({value:t.key,label:`${t.name} (${t.key})`})),placeholder:a("automation.select_project")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-name",className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.name")}),e.jsx("input",{id:"create-name",type:"text",value:h,onChange:t=>P(t.target.value),placeholder:a("automation.name_placeholder"),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)]"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-description",className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.description")}),e.jsx("textarea",{id:"create-description",value:y,onChange:t=>F(t.target.value),rows:4,placeholder:a("automation.description_placeholder"),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("p",{className:"mt-1 text-[10px] text-[var(--text-muted)]",children:a("automation.template_vars")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.trigger_type")}),e.jsx("div",{className:"flex gap-2",children:["cron","task_event","manual"].map(t=>e.jsx("button",{onClick:()=>$(t),className:`flex-1 rounded-[4px] border px-3 py-2 text-xs transition-colors ${i===t?"border-[var(--accent)] text-[var(--accent)] bg-[var(--accent)]/5":"border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:t},t))})]}),i==="cron"&&e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("label",{className:"block text-[11px] font-bold text-[var(--text-primary)]",children:a("automation.cron_config")}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-cron-preset",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.preset")}),e.jsx(b,{value:B,onChange:Z,options:ae.map(t=>({value:t.value,label:t.value?`${t.label} (${t.value})`:t.label}))})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-cron-expression",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.cron_expression")}),e.jsx("input",{id:"create-cron-expression",type:"text",value:v,onChange:t=>{_(t.target.value),j("")},placeholder:"* * * * *",className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs font-mono text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-timezone",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.timezone")}),e.jsx(b,{value:k,onChange:K,options:se.map(t=>({value:t,label:t}))})]})]}),i==="task_event"&&e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("label",{className:"block text-[11px] font-bold text-[var(--text-primary)]",children:a("automation.task_event_config")}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-event-type",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.event_type")}),e.jsx(b,{value:N,onChange:L,options:re})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-filter-project",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.filter_project_key")}),e.jsx(b,{value:x,onChange:C,options:[{value:"",label:a("automation.all_projects")},...O.filter(t=>s.includes(t.key)).map(t=>({value:t.key,label:`${t.name} (${t.key})`}))],disabled:s.length===0})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-filter-mode",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.filter_task_mode")}),e.jsx(b,{value:f,onChange:D,options:[{value:"",label:a("automation.all_modes")},{value:"develop",label:"develop"},{value:"review",label:"review"}]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.execution_mode")}),e.jsx("div",{className:"flex gap-2",children:["readonly","writable"].map(t=>e.jsx("button",{onClick:()=>z(t),className:`flex-1 rounded-[4px] border px-3 py-2 text-xs transition-colors ${g===t?"border-[var(--accent)] text-[var(--accent)] bg-[var(--accent)]/5":"border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:t},t))}),e.jsx("p",{className:"mt-1 text-[10px] text-[var(--text-muted)]",children:a(g==="writable"?"automation.writable_hint":"automation.readonly_hint")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.agent_type")}),e.jsx("div",{className:"flex gap-2",children:oe.map(t=>e.jsx("button",{onClick:()=>T(t.value),className:`flex-1 rounded-[4px] border px-3 py-2 text-xs transition-colors ${S===t.value?"border-[var(--accent)] text-[var(--accent)] bg-[var(--accent)]/5":"border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:t.label},t.value))})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center gap-2 text-xs text-[var(--text-primary)] cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:E,onChange:t=>I(t.target.checked),className:"h-3.5 w-3.5 cursor-pointer accent-[var(--accent)]"}),a("automation.notify_project_chats")]}),e.jsx("p",{className:"mt-1 pl-5 text-[10px] text-[var(--text-muted)]",children:a("automation.notify_project_chats_hint")})]}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsx("button",{onClick:H,disabled:q,className:"flex-1 rounded-[4px] bg-[var(--accent)] px-4 py-2.5 text-xs font-bold text-black disabled:opacity-40 disabled:cursor-not-allowed transition-opacity hover:opacity-90",children:a(q?"automation.creating":"automation.create_automation")}),e.jsx("button",{onClick:()=>m("/automations"),className:"rounded-[4px] border border-[var(--border)] px-4 py-2.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:a("automation.cancel")})]})]})]})}export{me as default};
1
+ import{f as J,a as Q,F as W,a1 as A,r,h as X,t as d,j as e}from"./index-CHuch-Tb.js";import{S as b}from"./Select-DYoGoG5A.js";import{M as ee}from"./MultiSelect-DPaJC1DP.js";import{A as te}from"./arrow-left-CnVeKL9M.js";import"./chevron-down-CAmZEYXZ.js";const ae=[{label:"every_hour",value:"0 * * * *"},{label:"every_6_hours",value:"0 */6 * * *"},{label:"daily_midnight",value:"0 0 * * *"},{label:"daily_9am",value:"0 9 * * *"},{label:"weekly_monday",value:"0 9 * * 1"},{label:"custom",value:""}],re=[{label:"completed",value:"COMPLETED"},{label:"failed",value:"FAILED"},{label:"cancelled",value:"CANCELLED"}],oe=[{label:"claude",value:"claude"},{label:"cursor",value:"cursor"},{label:"codex",value:"codex"}],se=["UTC","America/New_York","America/Chicago","America/Denver","America/Los_Angeles","Europe/London","Europe/Berlin","Asia/Tokyo","Asia/Shanghai","Asia/Singapore","Australia/Sydney"];function ne(m){const a=m.trim().split(/\s+/);return a.length===5||a.length===6}function me(){const m=J(),{t:a}=Q(),[Y]=W(),u=Y.get("templateId"),{createAutomation:w}=A(),[h,P]=r.useState(""),[y,F]=r.useState(""),[s,M]=r.useState([]),[i,$]=r.useState("cron"),[B,j]=r.useState("0 0 * * *"),[v,_]=r.useState("0 0 * * *"),[k,K]=r.useState("UTC"),[N,L]=r.useState("COMPLETED"),[x,C]=r.useState(""),[f,D]=r.useState(""),[g,z]=r.useState("readonly"),[S,T]=r.useState("claude"),[E,I]=r.useState(!0),[U,V]=r.useState({}),[O,G]=r.useState([]),[q,R]=r.useState(!1);r.useEffect(()=>{x&&(s.length===0||!s.includes(x))&&C("")},[x,s]),r.useEffect(()=>{let t=!1;return X.get("web/projects").json().then(n=>{t||G(n),!t&&n.length===1&&(M([n[0].key]),T(n[0].agentType))}).catch(()=>{t||d.error(a("automation.failed_load_projects"))}),()=>{t=!0}},[a]),r.useEffect(()=>{if(!u)return;let t=!1;return A.getState().fetchTemplates().then(()=>{if(t)return;const o=A.getState().templates.find(l=>l.id===Number(u));if(o){P(o.name),F(o.taskDescription),$(o.triggerType),z(o.executionMode);const l=o.triggerConfig;if(o.triggerType==="cron"&&l.cron&&(_(l.cron),j(""),l.timezone&&K(l.timezone)),o.triggerType==="task_event"&&l.event){L(l.event);const c=l.filter;c!=null&&c.projectKey&&C(c.projectKey),c!=null&&c.taskMode&&D(c.taskMode)}const p=o.taskConfig;p&&V(p),p!=null&&p.agentType&&T(p.agentType),I(!0)}}),()=>{t=!0}},[u]);const Z=t=>{j(t),t&&_(t)},H=r.useCallback(async()=>{if(!h.trim()){d.error(a("automation.name_required"));return}if(s.length===0){d.error(a("automation.project_required"));return}let t={};if(i==="cron"){if(!v.trim()){d.error(a("automation.cron_expression_required"));return}if(!ne(v)){d.error(a("automation.cron_expression_invalid"));return}t={cron:v,timezone:k}}else i==="task_event"&&(t={event:N,filter:{...x&&{projectKey:x},...f&&{taskMode:f}}});R(!0);try{const n=await w({projectKey:s[0],projectKeys:s,name:h.trim(),description:y.trim(),triggerType:i,triggerConfig:t,executionMode:g,taskConfig:{...U,agentType:S},notifyProjectChats:E,...u?{templateId:Number(u)}:{}});d.success(a("automation.automation_created")),m(`/automations/${n.id}`)}catch(n){const o=n instanceof Error?n.message:a("automation.failed_create");d.error(o)}finally{R(!1)}},[h,y,s,i,v,k,N,x,f,g,S,E,u,w,m,a]);return e.jsxs("div",{className:"mx-auto max-w-2xl px-2 py-4 md:px-4 md:py-6 font-mono",children:[e.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[e.jsx("button",{onClick:()=>m("/automations"),className:"rounded-[4px] p-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:e.jsx(te,{className:"h-4 w-4"})}),e.jsx("h1",{className:"text-sm font-bold text-[var(--text-primary)]",children:a("automation.create_title")})]}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-project",className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.project")}),e.jsx(ee,{values:s,onChange:M,options:O.map(t=>({value:t.key,label:`${t.name} (${t.key})`})),placeholder:a("automation.select_project")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-name",className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.name")}),e.jsx("input",{id:"create-name",type:"text",value:h,onChange:t=>P(t.target.value),placeholder:a("automation.name_placeholder"),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)]"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-description",className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.description")}),e.jsx("textarea",{id:"create-description",value:y,onChange:t=>F(t.target.value),rows:4,placeholder:a("automation.description_placeholder"),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("p",{className:"mt-1 text-[10px] text-[var(--text-muted)]",children:a("automation.template_vars")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.trigger_type")}),e.jsx("div",{className:"flex gap-2",children:["cron","task_event","manual"].map(t=>e.jsx("button",{onClick:()=>$(t),className:`flex-1 rounded-[4px] border px-3 py-2 text-xs transition-colors ${i===t?"border-[var(--accent)] text-[var(--accent)] bg-[var(--accent)]/5":"border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:t},t))})]}),i==="cron"&&e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("label",{className:"block text-[11px] font-bold text-[var(--text-primary)]",children:a("automation.cron_config")}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-cron-preset",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.preset")}),e.jsx(b,{value:B,onChange:Z,options:ae.map(t=>({value:t.value,label:t.value?`${t.label} (${t.value})`:t.label}))})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-cron-expression",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.cron_expression")}),e.jsx("input",{id:"create-cron-expression",type:"text",value:v,onChange:t=>{_(t.target.value),j("")},placeholder:"* * * * *",className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs font-mono text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-timezone",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.timezone")}),e.jsx(b,{value:k,onChange:K,options:se.map(t=>({value:t,label:t}))})]})]}),i==="task_event"&&e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("label",{className:"block text-[11px] font-bold text-[var(--text-primary)]",children:a("automation.task_event_config")}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-event-type",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.event_type")}),e.jsx(b,{value:N,onChange:L,options:re})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-filter-project",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.filter_project_key")}),e.jsx(b,{value:x,onChange:C,options:[{value:"",label:a("automation.all_projects")},...O.filter(t=>s.includes(t.key)).map(t=>({value:t.key,label:`${t.name} (${t.key})`}))],disabled:s.length===0})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-filter-mode",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.filter_task_mode")}),e.jsx(b,{value:f,onChange:D,options:[{value:"",label:a("automation.all_modes")},{value:"develop",label:"develop"},{value:"review",label:"review"}]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.execution_mode")}),e.jsx("div",{className:"flex gap-2",children:["readonly","writable"].map(t=>e.jsx("button",{onClick:()=>z(t),className:`flex-1 rounded-[4px] border px-3 py-2 text-xs transition-colors ${g===t?"border-[var(--accent)] text-[var(--accent)] bg-[var(--accent)]/5":"border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:t},t))}),e.jsx("p",{className:"mt-1 text-[10px] text-[var(--text-muted)]",children:a(g==="writable"?"automation.writable_hint":"automation.readonly_hint")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.agent_type")}),e.jsx("div",{className:"flex gap-2",children:oe.map(t=>e.jsx("button",{onClick:()=>T(t.value),className:`flex-1 rounded-[4px] border px-3 py-2 text-xs transition-colors ${S===t.value?"border-[var(--accent)] text-[var(--accent)] bg-[var(--accent)]/5":"border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:t.label},t.value))})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center gap-2 text-xs text-[var(--text-primary)] cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:E,onChange:t=>I(t.target.checked),className:"h-3.5 w-3.5 cursor-pointer accent-[var(--accent)]"}),a("automation.notify_project_chats")]}),e.jsx("p",{className:"mt-1 pl-5 text-[10px] text-[var(--text-muted)]",children:a("automation.notify_project_chats_hint")})]}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsx("button",{onClick:H,disabled:q,className:"flex-1 rounded-[4px] bg-[var(--accent)] px-4 py-2.5 text-xs font-bold text-black disabled:opacity-40 disabled:cursor-not-allowed transition-opacity hover:opacity-90",children:a(q?"automation.creating":"automation.create_automation")}),e.jsx("button",{onClick:()=>m("/automations"),className:"rounded-[4px] border border-[var(--border)] px-4 py-2.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:a("automation.cancel")})]})]})]})}export{me as default};
@@ -1,16 +1,16 @@
1
- import{c as u,f as M,a as I,B as S,a1 as $,r as o,a2 as D,p as L,t as i,x as O,j as t,s as F}from"./index-Cnjcx5EP.js";import{E as w}from"./EmptyState-Dg8UN1Uo.js";import{T as q}from"./Skeleton-DZltBScg.js";import{f as k,c as K}from"./date-CmcdoD87.js";import{C as _}from"./clock-tNaDNX3I.js";import{A as z}from"./arrow-left-Bx4nR3Vh.js";import{P as A}from"./play-CmZnnLuv.js";import{T as B}from"./trash-2-DlnQ4ddN.js";import{T as G}from"./timer-GGOn9LAl.js";import{Z as H}from"./zap-CeHncDxq.js";import{E as U}from"./external-link-DP3KNa_2.js";/**
1
+ import{c as v,f as I,a as $,B as D,a1 as L,r as o,a2 as O,p as F,t as i,x as q,j as t,s as K}from"./index-CHuch-Tb.js";import{E as _}from"./EmptyState-HBgPBpjr.js";import{T as z}from"./Skeleton-YxLLogK4.js";import{f as A,c as B}from"./date-CmcdoD87.js";import{C}from"./clock-B06FHquf.js";import{A as G}from"./arrow-left-CnVeKL9M.js";import{P as T}from"./play-DtboRxSa.js";import{T as H}from"./trash-2-DHxbaPwD.js";import{T as U}from"./timer-iriu8OXp.js";import{Z as W}from"./zap-C6pt7pdv.js";import{E as Z}from"./external-link-CzAmYpcP.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const Z=u("PowerOff",[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
6
+ */const J=v("PowerOff",[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
7
7
  * @license lucide-react v0.469.0 - ISC
8
8
  *
9
9
  * This source code is licensed under the ISC license.
10
10
  * See the LICENSE file in the root directory of this source tree.
11
- */const Q=u("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/**
11
+ */const Q=v("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/**
12
12
  * @license lucide-react v0.469.0 - ISC
13
13
  *
14
14
  * This source code is licensed under the ISC license.
15
15
  * See the LICENSE file in the root directory of this source tree.
16
- */const V=u("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);function W(n){switch(n){case"COMPLETED":return"bg-[var(--accent)]";case"RUNNING":return"bg-[var(--accent)]";case"PENDING":return"bg-[var(--warning)]";case"FAILED":return"bg-[var(--destructive)]";case"SKIPPED":return"bg-[#525252]";default:return"bg-[#525252]"}}function J(n,e){return(n&&n.length>0?n:[e]).join(", ")}function lt(){const n=M(),{t:e}=I(),{id:h}=S(),r=Number(h),{currentAutomation:a,loading:C,fetchAutomation:l,enableAutomation:v,disableAutomation:b,triggerAutomation:g,deleteAutomation:f,runs:j,fetchRuns:c,clearRunQuery:y}=$(),[T,N]=o.useState(!1),d=o.useRef(!1);o.useEffect(()=>(l(r),c({automationId:r,limit:20}),()=>{y()}),[r,l,c,y]),o.useEffect(()=>{d.current=!0;const s=D.onStatus(p=>{d.current&&p==="connected"&&c({automationId:r,limit:20})});return()=>{d.current=!1,s()}},[r,c]),L((a==null?void 0:a.name)??null);const P=o.useCallback(async()=>{if(a)try{a.enabled?(await b(a.id),await l(r),i.success(e("automation.automation_disabled"))):(await v(a.id),await l(r),i.success(e("automation.automation_enabled")))}catch{i.error(e("automation.failed_toggle"))}},[a,r,v,b,l,e]),E=o.useCallback(async()=>{try{await g(r),i.success(e("automation.automation_triggered")),c({automationId:r,limit:20})}catch{i.error(e("automation.failed_trigger"))}},[r,g,c,e]),R=o.useCallback(async()=>{try{await f(r),i.success(e("automation.automation_deleted")),n("/automations")}catch{i.error(e("automation.failed_delete"))}},[r,f,n,e]);if(O(null),C&&!a)return t.jsx("div",{className:"mx-auto max-w-4xl px-2 py-4 md:px-4 md:py-6 font-mono",children:t.jsx(q,{rows:6})});if(!a)return t.jsx("div",{className:"mx-auto max-w-4xl px-2 py-4 md:px-4 md:py-6 font-mono",children:t.jsx(w,{icon:_,title:e("automation.automation_not_found")})});const x=a.triggerConfig,m=a.taskConfig;return t.jsxs("div",{className:"mx-auto max-w-4xl px-2 py-4 md:px-4 md:py-6 font-mono",children:[t.jsxs("div",{className:"mb-6 flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("button",{onClick:()=>n("/automations"),className:"rounded-[4px] p-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:t.jsx(z,{className:"h-4 w-4"})}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("h1",{className:"text-sm font-bold text-[var(--text-primary)]",children:a.name}),t.jsx("span",{className:`h-2 w-2 rounded-full ${a.enabled?"bg-[var(--accent)]":"bg-[var(--text-muted)]"}`}),t.jsx("span",{className:"text-[10px] text-[var(--text-muted)]",children:a.enabled?e("automation.enabled"):e("automation.disabled")})]}),a.description&&t.jsx("p",{className:"mt-0.5 text-[11px] text-[var(--text-muted)] line-clamp-2",children:a.description})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{onClick:P,className:`flex items-center gap-1 rounded-[4px] border px-3 py-1.5 text-[11px] transition-colors ${a.enabled?"border-[var(--warning)] text-[var(--warning)] hover:bg-[var(--warning)]/10":"border-[var(--accent)] text-[var(--accent)] hover:bg-[var(--accent)]/10"}`,children:a.enabled?t.jsxs(t.Fragment,{children:[t.jsx(Z,{className:"h-3 w-3"})," ",e("automation.disable")]}):t.jsxs(t.Fragment,{children:[t.jsx(Q,{className:"h-3 w-3"})," ",e("automation.enable")]})}),t.jsxs("button",{onClick:()=>n(`/automations/${a.id}/edit`),className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-[11px] text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:[t.jsx(V,{className:"h-3 w-3"})," ",e("automation.edit")]}),t.jsxs("button",{onClick:E,className:"flex items-center gap-1 whitespace-nowrap rounded-[4px] border border-[var(--accent)] px-3 py-1.5 text-[11px] text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors",children:[t.jsx(A,{className:"h-3 w-3 shrink-0"})," ",e("automation.trigger_now")]}),t.jsxs("button",{onClick:()=>N(!0),className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-[11px] text-[var(--text-muted)] hover:text-[var(--destructive)] hover:border-[var(--destructive)] transition-colors",children:[t.jsx(B,{className:"h-3 w-3"})," ",e("automation.delete")]})]})]}),t.jsxs("div",{className:"mb-6 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[t.jsx("h2",{className:"mb-3 text-[11px] font-bold text-[var(--text-muted)]",children:e("automation.configuration")}),t.jsxs("div",{className:"grid grid-cols-2 gap-3 md:grid-cols-4",children:[t.jsxs("div",{children:[t.jsx("span",{className:"block text-[10px] text-[var(--text-muted)]",children:e("automation.trigger_type")}),t.jsxs("div",{className:"mt-0.5 flex items-center gap-1 text-xs text-[var(--text-primary)]",children:[a.triggerType==="cron"&&t.jsx(G,{className:"h-3 w-3"}),a.triggerType==="task_event"&&t.jsx(H,{className:"h-3 w-3"}),a.triggerType==="manual"&&t.jsx(A,{className:"h-3 w-3"}),a.triggerType]})]}),a.triggerType==="cron"&&!!x.cron&&t.jsxs("div",{children:[t.jsx("span",{className:"block text-[10px] text-[var(--text-muted)]",children:e("automation.schedule")}),t.jsx("span",{className:"mt-0.5 block text-xs text-[var(--text-primary)]",children:x.cron}),t.jsx("span",{className:"block text-[10px] text-[var(--text-muted)]",children:x.timezone??"UTC"})]}),a.triggerType==="task_event"&&!!x.event&&t.jsxs("div",{children:[t.jsx("span",{className:"block text-[10px] text-[var(--text-muted)]",children:e("automation.event")}),t.jsx("span",{className:"mt-0.5 block text-xs text-[var(--text-primary)]",children:x.event})]}),t.jsxs("div",{children:[t.jsx("span",{className:"block text-[10px] text-[var(--text-muted)]",children:e("automation.agent_type")}),t.jsx("span",{className:"mt-0.5 block text-xs text-[var(--text-primary)]",children:(m==null?void 0:m.agentType)??"claude"})]}),t.jsxs("div",{children:[t.jsx("span",{className:"block text-[10px] text-[var(--text-muted)]",children:e("automation.execution_mode")}),t.jsx("span",{className:`mt-0.5 block text-xs ${a.executionMode==="writable"?"text-[var(--warning)]":"text-[var(--text-primary)]"}`,children:a.executionMode})]}),t.jsxs("div",{children:[t.jsx("span",{className:"block whitespace-nowrap text-[10px] text-[var(--text-muted)]",children:e("automation.notify_project_chats")}),t.jsx("span",{className:"mt-0.5 block whitespace-nowrap text-xs text-[var(--text-primary)]",children:a.notifyProjectChats?e("automation.notify_project_chats_enabled"):e("automation.notify_project_chats_disabled")})]})]}),t.jsxs("div",{className:"mt-3 flex items-center gap-4 text-[10px] text-[var(--text-muted)]",children:[t.jsxs("span",{children:[e("automation.project"),": ",J(a.projectKeys,a.projectKey)]}),a.lastRunAt&&t.jsx("span",{children:e("automation.last_run",{time:k(a.lastRunAt)})}),a.nextRunAt&&t.jsx("span",{children:e("automation.next_run",{time:K(a.nextRunAt)})})]})]}),t.jsxs("div",{children:[t.jsx("h2",{className:"mb-3 text-[11px] font-bold text-[var(--text-muted)]",children:e("automation.run_history")}),j.length===0?t.jsx(w,{icon:_,title:e("automation.no_runs"),compact:!0}):t.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:t.jsxs("table",{className:"w-full text-left",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-[var(--border)] text-[11px] font-medium text-[#525252]",children:[t.jsx("th",{className:"px-4 py-2.5",children:e("automation.col_time")}),t.jsx("th",{className:"px-4 py-2.5",children:e("automation.project")}),t.jsx("th",{className:"px-4 py-2.5",children:e("automation.col_status")}),t.jsx("th",{className:"px-4 py-2.5",children:e("automation.col_findings")}),t.jsx("th",{className:"px-4 py-2.5",children:e("automation.col_task")})]})}),t.jsx("tbody",{children:j.map(s=>t.jsxs("tr",{className:"cursor-pointer border-b border-[var(--border)] last:border-b-0 hover:bg-[var(--bg-input)] transition-colors",onClick:()=>n(`/automations/runs/${s.id}`),children:[t.jsx("td",{className:"px-4 py-2.5 text-xs text-[var(--text-primary)]",children:k(s.createdAt)}),t.jsx("td",{className:"px-4 py-2.5 text-xs text-[var(--text-primary)]",children:s.projectKey??a.projectKey}),t.jsx("td",{className:"px-4 py-2.5",children:t.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-[var(--text-primary)]",children:[t.jsx("span",{className:`h-2 w-2 rounded-full ${W(s.status)}`}),s.status.toLowerCase()]})}),t.jsx("td",{className:"px-4 py-2.5 text-xs text-[var(--text-muted)]",children:s.hasFindings&&s.findings?`${Array.isArray(s.findings)?s.findings.length:0} finding${Array.isArray(s.findings)&&s.findings.length!==1?"s":""}`:"-"}),t.jsx("td",{className:"px-4 py-2.5",children:s.taskId?t.jsxs("button",{onClick:p=>{p.stopPropagation(),n(`/tasks/${s.taskId}`)},className:"flex items-center gap-1 text-xs text-[var(--accent)] hover:underline",children:["#",s.taskId,t.jsx(U,{className:"h-2.5 w-2.5"})]}):t.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"-"})})]},s.id))})]})})]}),t.jsx(F,{isOpen:T,onClose:()=>N(!1),onConfirm:R,title:e("automation.delete_title"),message:e("automation.delete_confirm",{name:a.name}),confirmLabel:e("automation.delete"),confirmVariant:"danger"})]})}export{lt as default};
16
+ */const V=v("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);function X(n){switch(n){case"COMPLETED":return"bg-[var(--accent)]";case"RUNNING":return"bg-[var(--accent)]";case"PENDING":return"bg-[var(--warning)]";case"FAILED":return"bg-[var(--destructive)]";case"SKIPPED":return"bg-[#525252]";default:return"bg-[#525252]"}}function Y(n,e){return(n&&n.length>0?n:[e]).join(", ")}function dt(){const n=I(),{t:e}=$(),{id:b}=D(),r=Number(b),{currentAutomation:a,loading:P,fetchAutomation:x,enableAutomation:g,disableAutomation:f,triggerAutomation:j,deleteAutomation:y,runs:N,fetchRuns:c,clearRunQuery:w}=L(),[E,k]=o.useState(!1),p=o.useRef(!1);o.useEffect(()=>(x(r),c({automationId:r,limit:20}),()=>{w()}),[r,x,c,w]),o.useEffect(()=>{p.current=!0;const s=O.onStatus(l=>{p.current&&l==="connected"&&c({automationId:r,limit:20})});return()=>{p.current=!1,s()}},[r,c]),F((a==null?void 0:a.name)??null);const M=o.useCallback(async()=>{if(a)try{a.enabled?(await f(a.id),await x(r),i.success(e("automation.automation_disabled"))):(await g(a.id),await x(r),i.success(e("automation.automation_enabled")))}catch{i.error(e("automation.failed_toggle"))}},[a,r,g,f,x,e]),R=o.useCallback(async()=>{try{await j(r),i.success(e("automation.automation_triggered")),c({automationId:r,limit:20})}catch{i.error(e("automation.failed_trigger"))}},[r,j,c,e]),S=o.useCallback(async()=>{try{await y(r),i.success(e("automation.automation_deleted")),n("/automations")}catch{i.error(e("automation.failed_delete"))}},[r,y,n,e]);if(q(null),P&&!a)return t.jsx("div",{className:"mx-auto max-w-4xl px-2 py-4 md:px-4 md:py-6 font-mono",children:t.jsx(z,{rows:6})});if(!a)return t.jsx("div",{className:"mx-auto max-w-4xl px-2 py-4 md:px-4 md:py-6 font-mono",children:t.jsx(_,{icon:C,title:e("automation.automation_not_found")})});const d=a.triggerConfig,u=a.taskConfig;return t.jsxs("div",{className:"mx-auto max-w-4xl px-2 py-4 md:px-4 md:py-6 font-mono",children:[t.jsxs("div",{className:"mb-6 flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("button",{onClick:()=>n("/automations"),className:"rounded-[4px] p-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:t.jsx(G,{className:"h-4 w-4"})}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("h1",{className:"text-sm font-bold text-[var(--text-primary)]",children:a.name}),t.jsx("span",{className:`h-2 w-2 rounded-full ${a.enabled?"bg-[var(--accent)]":"bg-[var(--text-muted)]"}`}),t.jsx("span",{className:"text-[10px] text-[var(--text-muted)]",children:a.enabled?e("automation.enabled"):e("automation.disabled")})]}),a.description&&t.jsx("p",{className:"mt-0.5 text-[11px] text-[var(--text-muted)] line-clamp-2",children:a.description})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{onClick:M,className:`flex items-center gap-1 rounded-[4px] border px-3 py-1.5 text-[11px] transition-colors ${a.enabled?"border-[var(--warning)] text-[var(--warning)] hover:bg-[var(--warning)]/10":"border-[var(--accent)] text-[var(--accent)] hover:bg-[var(--accent)]/10"}`,children:a.enabled?t.jsxs(t.Fragment,{children:[t.jsx(J,{className:"h-3 w-3"})," ",e("automation.disable")]}):t.jsxs(t.Fragment,{children:[t.jsx(Q,{className:"h-3 w-3"})," ",e("automation.enable")]})}),t.jsxs("button",{onClick:()=>n(`/automations/${a.id}/edit`),className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-[11px] text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:[t.jsx(V,{className:"h-3 w-3"})," ",e("automation.edit")]}),t.jsxs("button",{onClick:R,className:"flex items-center gap-1 whitespace-nowrap rounded-[4px] border border-[var(--accent)] px-3 py-1.5 text-[11px] text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors",children:[t.jsx(T,{className:"h-3 w-3 shrink-0"})," ",e("automation.trigger_now")]}),t.jsxs("button",{onClick:()=>k(!0),className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-[11px] text-[var(--text-muted)] hover:text-[var(--destructive)] hover:border-[var(--destructive)] transition-colors",children:[t.jsx(H,{className:"h-3 w-3"})," ",e("automation.delete")]})]})]}),t.jsxs("div",{className:"mb-6 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[t.jsx("h2",{className:"mb-3 text-[11px] font-bold text-[var(--text-muted)]",children:e("automation.configuration")}),t.jsxs("div",{className:"grid grid-cols-2 gap-3 md:grid-cols-4",children:[t.jsxs("div",{children:[t.jsx("span",{className:"block text-[10px] text-[var(--text-muted)]",children:e("automation.trigger_type")}),t.jsxs("div",{className:"mt-0.5 flex items-center gap-1 text-xs text-[var(--text-primary)]",children:[a.triggerType==="cron"&&t.jsx(U,{className:"h-3 w-3"}),a.triggerType==="task_event"&&t.jsx(W,{className:"h-3 w-3"}),a.triggerType==="manual"&&t.jsx(T,{className:"h-3 w-3"}),a.triggerType]})]}),a.triggerType==="cron"&&!!d.cron&&t.jsxs("div",{children:[t.jsx("span",{className:"block text-[10px] text-[var(--text-muted)]",children:e("automation.schedule")}),t.jsx("span",{className:"mt-0.5 block text-xs text-[var(--text-primary)]",children:d.cron}),t.jsx("span",{className:"block text-[10px] text-[var(--text-muted)]",children:d.timezone??"UTC"})]}),a.triggerType==="task_event"&&!!d.event&&t.jsxs("div",{children:[t.jsx("span",{className:"block text-[10px] text-[var(--text-muted)]",children:e("automation.event")}),t.jsx("span",{className:"mt-0.5 block text-xs text-[var(--text-primary)]",children:d.event})]}),t.jsxs("div",{children:[t.jsx("span",{className:"block text-[10px] text-[var(--text-muted)]",children:e("automation.agent_type")}),t.jsx("span",{className:"mt-0.5 block text-xs text-[var(--text-primary)]",children:(u==null?void 0:u.agentType)??"claude"})]}),t.jsxs("div",{children:[t.jsx("span",{className:"block text-[10px] text-[var(--text-muted)]",children:e("automation.execution_mode")}),t.jsx("span",{className:`mt-0.5 block text-xs ${a.executionMode==="writable"?"text-[var(--warning)]":"text-[var(--text-primary)]"}`,children:a.executionMode})]}),t.jsxs("div",{children:[t.jsx("span",{className:"block whitespace-nowrap text-[10px] text-[var(--text-muted)]",children:e("automation.notify_project_chats")}),t.jsx("span",{className:"mt-0.5 block whitespace-nowrap text-xs text-[var(--text-primary)]",children:a.notifyProjectChats?e("automation.notify_project_chats_enabled"):e("automation.notify_project_chats_disabled")})]})]}),t.jsxs("div",{className:"mt-3 flex items-center gap-4 text-[10px] text-[var(--text-muted)]",children:[t.jsxs("span",{children:[e("automation.project"),": ",Y(a.projectKeys,a.projectKey)]}),a.lastRunAt&&t.jsx("span",{children:e("automation.last_run",{time:A(a.lastRunAt)})}),a.nextRunAt&&t.jsx("span",{children:e("automation.next_run",{time:B(a.nextRunAt)})})]})]}),t.jsxs("div",{children:[t.jsx("h2",{className:"mb-3 text-[11px] font-bold text-[var(--text-muted)]",children:e("automation.run_history")}),N.length===0?t.jsx(_,{icon:C,title:e("automation.no_runs"),compact:!0}):t.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:t.jsxs("table",{className:"w-full text-left",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-[var(--border)] text-[11px] font-medium text-[#525252]",children:[t.jsx("th",{className:"px-4 py-2.5",children:e("automation.col_time")}),t.jsx("th",{className:"px-4 py-2.5",children:e("automation.project")}),t.jsx("th",{className:"px-4 py-2.5",children:e("automation.col_status")}),t.jsx("th",{className:"px-4 py-2.5",children:e("automation.col_findings")}),t.jsx("th",{className:"px-4 py-2.5",children:e("automation.col_task")})]})}),t.jsx("tbody",{children:N.map(s=>t.jsxs("tr",{className:"cursor-pointer border-b border-[var(--border)] last:border-b-0 hover:bg-[var(--bg-input)] transition-colors",onClick:()=>n(`/automations/runs/${s.id}`),children:[t.jsx("td",{className:"px-4 py-2.5 text-xs text-[var(--text-primary)]",children:A(s.createdAt)}),t.jsx("td",{className:"px-4 py-2.5 text-xs text-[var(--text-primary)]",children:s.projectKey??a.projectKey}),t.jsx("td",{className:"px-4 py-2.5",children:t.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-[var(--text-primary)]",children:[t.jsx("span",{className:`h-2 w-2 rounded-full ${X(s.status)}`}),s.status.toLowerCase()]})}),t.jsx("td",{className:"px-4 py-2.5 text-xs text-[var(--text-muted)]",children:(()=>{if(!s.hasFindings||!s.findings||!Array.isArray(s.findings))return"-";const l=s.findings.flatMap(m=>{if(m.detail&&typeof m.detail=="string"&&m.detail.trimStart().startsWith("{"))try{const h=JSON.parse(m.detail);if(Array.isArray(h.findings)&&h.findings.length>0)return h.findings}catch{}return[m]});return`${l.length} finding${l.length!==1?"s":""}`})()}),t.jsx("td",{className:"px-4 py-2.5",children:s.taskId?t.jsxs("button",{onClick:l=>{l.stopPropagation(),n(`/tasks/${s.taskId}`)},className:"flex items-center gap-1 text-xs text-[var(--accent)] hover:underline",children:["#",s.taskId,t.jsx(Z,{className:"h-2.5 w-2.5"})]}):t.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"-"})})]},s.id))})]})})]}),t.jsx(K,{isOpen:E,onClose:()=>k(!1),onConfirm:S,title:e("automation.delete_title"),message:e("automation.delete_confirm",{name:a.name}),confirmLabel:e("automation.delete"),confirmVariant:"danger"})]})}export{dt as default};
@@ -1 +1 @@
1
- import{f as X,a as ee,B as te,a1 as ae,r,h as re,t as m,j as e}from"./index-Cnjcx5EP.js";import{S as v}from"./Select-BdUjuVPU.js";import{M as oe}from"./MultiSelect-D0uOKezV.js";import{T as se}from"./Skeleton-DZltBScg.js";import{E as ne}from"./EmptyState-Dg8UN1Uo.js";import{C as le}from"./clock-tNaDNX3I.js";import{A as ie}from"./arrow-left-Bx4nR3Vh.js";import"./chevron-down-CMJNvCkO.js";const R=[{label:"every_hour",value:"0 * * * *"},{label:"every_6_hours",value:"0 */6 * * *"},{label:"daily_midnight",value:"0 0 * * *"},{label:"daily_9am",value:"0 9 * * *"},{label:"weekly_monday",value:"0 9 * * 1"},{label:"custom",value:""}],ce=[{label:"completed",value:"COMPLETED"},{label:"failed",value:"FAILED"},{label:"cancelled",value:"CANCELLED"}],de=[{label:"claude",value:"claude"},{label:"cursor",value:"cursor"},{label:"codex",value:"codex"}],U=["UTC","America/New_York","America/Chicago","America/Denver","America/Los_Angeles","Europe/London","Europe/Berlin","Asia/Tokyo","Asia/Shanghai","Asia/Singapore","Asia/Kolkata","Australia/Sydney"];function xe(u){const a=u.trim().split(/\s+/);return a.length===5||a.length===6}function je(){const u=X(),{t:a}=ee(),{id:Y}=te(),n=Number(Y),{currentAutomation:o,loading:B,fetchAutomation:E,updateAutomation:S}=ae(),[b,T]=r.useState(""),[y,w]=r.useState(""),[l,A]=r.useState([]),[c,P]=r.useState("cron"),[V,j]=r.useState(""),[p,g]=r.useState(""),[d,M]=r.useState("UTC"),[_,$]=r.useState("COMPLETED"),[x,N]=r.useState(""),[h,F]=r.useState(""),[f,K]=r.useState("readonly"),[k,L]=r.useState("claude"),[C,z]=r.useState(!1),[D,G]=r.useState([]),[O,I]=r.useState(!1),[q,Z]=r.useState(!1);r.useEffect(()=>{E(n)},[n,E]),r.useEffect(()=>{let t=!1;return re.get("web/projects").json().then(i=>{t||G(i)}).catch(()=>{t||m.error(a("automation.failed_load_projects"))}),()=>{t=!0}},[a]),r.useEffect(()=>{x&&(l.length===0||!l.includes(x))&&N("")},[x,l]),r.useEffect(()=>{if(!o||o.id!==n||q)return;T(o.name),w(o.description),A(o.projectKeys??[o.projectKey]),P(o.triggerType),K(o.executionMode);const t=o.triggerConfig;if(o.triggerType==="cron"){const s=t.cron??"";g(s);const Q=R.find(W=>W.value===s);j(Q?s:""),M(t.timezone??"UTC")}if(o.triggerType==="task_event"){$(t.event??"COMPLETED");const s=t.filter;N((s==null?void 0:s.projectKey)??""),F((s==null?void 0:s.taskMode)??"")}const i=o.taskConfig;L((i==null?void 0:i.agentType)??"claude"),z(o.notifyProjectChats),Z(!0)},[o,n,q]);const H=t=>{j(t),t&&g(t)},J=r.useCallback(async()=>{if(!b.trim()){m.error(a("automation.name_required"));return}if(l.length===0){m.error(a("automation.project_required"));return}let t={};if(c==="cron"){if(!p.trim()){m.error(a("automation.cron_expression_required"));return}if(!xe(p)){m.error(a("automation.cron_expression_invalid"));return}t={cron:p,timezone:d}}else c==="task_event"&&(t={event:_,filter:{...x&&{projectKey:x},...h&&{taskMode:h}}});I(!0);try{await S(n,{projectKey:l[0],projectKeys:l,name:b.trim(),description:y.trim(),triggerType:c,triggerConfig:t,executionMode:f,taskConfig:{...(o==null?void 0:o.taskConfig)??{},agentType:k},notifyProjectChats:C}),m.success(a("automation.automation_updated")),u(`/automations/${n}`)}catch(i){const s=i instanceof Error?i.message:a("automation.failed_update");m.error(s)}finally{I(!1)}},[b,y,l,c,p,d,_,x,h,f,k,C,n,S,u,a]);return B&&!o?e.jsx("div",{className:"mx-auto max-w-2xl px-2 py-4 md:px-4 md:py-6 font-mono",children:e.jsx(se,{rows:6})}):!o||o.id!==n?e.jsx("div",{className:"mx-auto max-w-2xl px-2 py-4 md:px-4 md:py-6 font-mono",children:e.jsx(ne,{icon:le,title:a("automation.automation_not_found")})}):e.jsxs("div",{className:"mx-auto max-w-2xl px-2 py-4 md:px-4 md:py-6 font-mono",children:[e.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[e.jsx("button",{onClick:()=>u(`/automations/${n}`),className:"rounded-[4px] p-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:e.jsx(ie,{className:"h-4 w-4"})}),e.jsx("h1",{className:"text-sm font-bold text-[var(--text-primary)]",children:a("automation.edit_title")})]}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-projects",className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.project")}),e.jsx(oe,{values:l,onChange:A,options:D.map(t=>({value:t.key,label:`${t.name} (${t.key})`})),placeholder:a("automation.select_project")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-name",className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.name")}),e.jsx("input",{id:"edit-name",type:"text",value:b,onChange:t=>T(t.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-description",className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.description")}),e.jsx("textarea",{id:"edit-description",value:y,onChange:t=>w(t.target.value),rows:4,placeholder:a("automation.description_placeholder"),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("p",{className:"mt-1 text-[10px] text-[var(--text-muted)]",children:a("automation.template_vars")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.trigger_type")}),e.jsx("div",{className:"flex gap-2",children:["cron","task_event","manual"].map(t=>e.jsx("button",{onClick:()=>P(t),className:`flex-1 rounded-[4px] border px-3 py-2 text-xs transition-colors ${c===t?"border-[var(--accent)] text-[var(--accent)] bg-[var(--accent)]/5":"border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:t},t))})]}),c==="cron"&&e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("label",{className:"block text-[11px] font-bold text-[var(--text-primary)]",children:a("automation.cron_config")}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-cron-preset",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.preset")}),e.jsx(v,{value:V,onChange:H,options:R.map(t=>({value:t.value,label:`${t.label}${t.value?` (${t.value})`:""}`}))})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-cron-expression",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.cron_expression")}),e.jsx("input",{id:"edit-cron-expression",type:"text",value:p,onChange:t=>{g(t.target.value),j("")},placeholder:"* * * * *",className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs font-mono text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-timezone",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.timezone")}),e.jsx(v,{value:d,onChange:M,options:[...d&&!U.includes(d)?[{value:d,label:d}]:[],...U.map(t=>({value:t,label:t}))]})]})]}),c==="task_event"&&e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("label",{className:"block text-[11px] font-bold text-[var(--text-primary)]",children:a("automation.task_event_config")}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-event-type",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.event_type")}),e.jsx(v,{value:_,onChange:$,options:ce})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-filter-project",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.filter_project_key")}),e.jsx(v,{value:x,onChange:N,options:[{value:"",label:a("automation.all_projects")},...D.filter(t=>l.includes(t.key)).map(t=>({value:t.key,label:`${t.name} (${t.key})`}))],disabled:l.length===0})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-filter-mode",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.filter_task_mode")}),e.jsx(v,{value:h,onChange:F,options:[{value:"",label:a("automation.all_modes")},{value:"develop",label:"develop"},{value:"review",label:"review"}]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.execution_mode")}),e.jsx("div",{className:"flex gap-2",children:["readonly","writable"].map(t=>e.jsx("button",{onClick:()=>K(t),className:`flex-1 rounded-[4px] border px-3 py-2 text-xs transition-colors ${f===t?"border-[var(--accent)] text-[var(--accent)] bg-[var(--accent)]/5":"border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:t},t))}),e.jsx("p",{className:"mt-1 text-[10px] text-[var(--text-muted)]",children:a(f==="writable"?"automation.writable_hint":"automation.readonly_hint")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.agent_type")}),e.jsx("div",{className:"flex gap-2",children:de.map(t=>e.jsx("button",{onClick:()=>L(t.value),className:`flex-1 rounded-[4px] border px-3 py-2 text-xs transition-colors ${k===t.value?"border-[var(--accent)] text-[var(--accent)] bg-[var(--accent)]/5":"border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:t.label},t.value))})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center gap-2 text-xs text-[var(--text-primary)] cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:C,onChange:t=>z(t.target.checked),className:"h-3.5 w-3.5 cursor-pointer accent-[var(--accent)]"}),a("automation.notify_project_chats")]}),e.jsx("p",{className:"mt-1 pl-5 text-[10px] text-[var(--text-muted)]",children:a("automation.notify_project_chats_hint")})]}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsx("button",{onClick:J,disabled:O,className:"flex-1 rounded-[4px] bg-[var(--accent)] px-4 py-2.5 text-xs font-bold text-black disabled:opacity-40 disabled:cursor-not-allowed transition-opacity hover:opacity-90",children:a(O?"automation.saving":"automation.save_changes")}),e.jsx("button",{onClick:()=>u(`/automations/${n}`),className:"rounded-[4px] border border-[var(--border)] px-4 py-2.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:a("automation.cancel")})]})]})]})}export{je as default};
1
+ import{f as X,a as ee,B as te,a1 as ae,r,h as re,t as m,j as e}from"./index-CHuch-Tb.js";import{S as v}from"./Select-DYoGoG5A.js";import{M as oe}from"./MultiSelect-DPaJC1DP.js";import{T as se}from"./Skeleton-YxLLogK4.js";import{E as ne}from"./EmptyState-HBgPBpjr.js";import{C as le}from"./clock-B06FHquf.js";import{A as ie}from"./arrow-left-CnVeKL9M.js";import"./chevron-down-CAmZEYXZ.js";const R=[{label:"every_hour",value:"0 * * * *"},{label:"every_6_hours",value:"0 */6 * * *"},{label:"daily_midnight",value:"0 0 * * *"},{label:"daily_9am",value:"0 9 * * *"},{label:"weekly_monday",value:"0 9 * * 1"},{label:"custom",value:""}],ce=[{label:"completed",value:"COMPLETED"},{label:"failed",value:"FAILED"},{label:"cancelled",value:"CANCELLED"}],de=[{label:"claude",value:"claude"},{label:"cursor",value:"cursor"},{label:"codex",value:"codex"}],U=["UTC","America/New_York","America/Chicago","America/Denver","America/Los_Angeles","Europe/London","Europe/Berlin","Asia/Tokyo","Asia/Shanghai","Asia/Singapore","Asia/Kolkata","Australia/Sydney"];function xe(u){const a=u.trim().split(/\s+/);return a.length===5||a.length===6}function je(){const u=X(),{t:a}=ee(),{id:Y}=te(),n=Number(Y),{currentAutomation:o,loading:B,fetchAutomation:E,updateAutomation:S}=ae(),[b,T]=r.useState(""),[y,w]=r.useState(""),[l,A]=r.useState([]),[c,P]=r.useState("cron"),[V,j]=r.useState(""),[p,g]=r.useState(""),[d,M]=r.useState("UTC"),[_,$]=r.useState("COMPLETED"),[x,N]=r.useState(""),[h,F]=r.useState(""),[f,K]=r.useState("readonly"),[k,L]=r.useState("claude"),[C,z]=r.useState(!1),[D,G]=r.useState([]),[O,I]=r.useState(!1),[q,Z]=r.useState(!1);r.useEffect(()=>{E(n)},[n,E]),r.useEffect(()=>{let t=!1;return re.get("web/projects").json().then(i=>{t||G(i)}).catch(()=>{t||m.error(a("automation.failed_load_projects"))}),()=>{t=!0}},[a]),r.useEffect(()=>{x&&(l.length===0||!l.includes(x))&&N("")},[x,l]),r.useEffect(()=>{if(!o||o.id!==n||q)return;T(o.name),w(o.description),A(o.projectKeys??[o.projectKey]),P(o.triggerType),K(o.executionMode);const t=o.triggerConfig;if(o.triggerType==="cron"){const s=t.cron??"";g(s);const Q=R.find(W=>W.value===s);j(Q?s:""),M(t.timezone??"UTC")}if(o.triggerType==="task_event"){$(t.event??"COMPLETED");const s=t.filter;N((s==null?void 0:s.projectKey)??""),F((s==null?void 0:s.taskMode)??"")}const i=o.taskConfig;L((i==null?void 0:i.agentType)??"claude"),z(o.notifyProjectChats),Z(!0)},[o,n,q]);const H=t=>{j(t),t&&g(t)},J=r.useCallback(async()=>{if(!b.trim()){m.error(a("automation.name_required"));return}if(l.length===0){m.error(a("automation.project_required"));return}let t={};if(c==="cron"){if(!p.trim()){m.error(a("automation.cron_expression_required"));return}if(!xe(p)){m.error(a("automation.cron_expression_invalid"));return}t={cron:p,timezone:d}}else c==="task_event"&&(t={event:_,filter:{...x&&{projectKey:x},...h&&{taskMode:h}}});I(!0);try{await S(n,{projectKey:l[0],projectKeys:l,name:b.trim(),description:y.trim(),triggerType:c,triggerConfig:t,executionMode:f,taskConfig:{...(o==null?void 0:o.taskConfig)??{},agentType:k},notifyProjectChats:C}),m.success(a("automation.automation_updated")),u(`/automations/${n}`)}catch(i){const s=i instanceof Error?i.message:a("automation.failed_update");m.error(s)}finally{I(!1)}},[b,y,l,c,p,d,_,x,h,f,k,C,n,S,u,a]);return B&&!o?e.jsx("div",{className:"mx-auto max-w-2xl px-2 py-4 md:px-4 md:py-6 font-mono",children:e.jsx(se,{rows:6})}):!o||o.id!==n?e.jsx("div",{className:"mx-auto max-w-2xl px-2 py-4 md:px-4 md:py-6 font-mono",children:e.jsx(ne,{icon:le,title:a("automation.automation_not_found")})}):e.jsxs("div",{className:"mx-auto max-w-2xl px-2 py-4 md:px-4 md:py-6 font-mono",children:[e.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[e.jsx("button",{onClick:()=>u(`/automations/${n}`),className:"rounded-[4px] p-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:e.jsx(ie,{className:"h-4 w-4"})}),e.jsx("h1",{className:"text-sm font-bold text-[var(--text-primary)]",children:a("automation.edit_title")})]}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-projects",className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.project")}),e.jsx(oe,{values:l,onChange:A,options:D.map(t=>({value:t.key,label:`${t.name} (${t.key})`})),placeholder:a("automation.select_project")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-name",className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.name")}),e.jsx("input",{id:"edit-name",type:"text",value:b,onChange:t=>T(t.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-description",className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.description")}),e.jsx("textarea",{id:"edit-description",value:y,onChange:t=>w(t.target.value),rows:4,placeholder:a("automation.description_placeholder"),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("p",{className:"mt-1 text-[10px] text-[var(--text-muted)]",children:a("automation.template_vars")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.trigger_type")}),e.jsx("div",{className:"flex gap-2",children:["cron","task_event","manual"].map(t=>e.jsx("button",{onClick:()=>P(t),className:`flex-1 rounded-[4px] border px-3 py-2 text-xs transition-colors ${c===t?"border-[var(--accent)] text-[var(--accent)] bg-[var(--accent)]/5":"border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:t},t))})]}),c==="cron"&&e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("label",{className:"block text-[11px] font-bold text-[var(--text-primary)]",children:a("automation.cron_config")}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-cron-preset",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.preset")}),e.jsx(v,{value:V,onChange:H,options:R.map(t=>({value:t.value,label:`${t.label}${t.value?` (${t.value})`:""}`}))})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-cron-expression",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.cron_expression")}),e.jsx("input",{id:"edit-cron-expression",type:"text",value:p,onChange:t=>{g(t.target.value),j("")},placeholder:"* * * * *",className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs font-mono text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-timezone",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.timezone")}),e.jsx(v,{value:d,onChange:M,options:[...d&&!U.includes(d)?[{value:d,label:d}]:[],...U.map(t=>({value:t,label:t}))]})]})]}),c==="task_event"&&e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("label",{className:"block text-[11px] font-bold text-[var(--text-primary)]",children:a("automation.task_event_config")}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-event-type",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.event_type")}),e.jsx(v,{value:_,onChange:$,options:ce})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-filter-project",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.filter_project_key")}),e.jsx(v,{value:x,onChange:N,options:[{value:"",label:a("automation.all_projects")},...D.filter(t=>l.includes(t.key)).map(t=>({value:t.key,label:`${t.name} (${t.key})`}))],disabled:l.length===0})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-filter-mode",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.filter_task_mode")}),e.jsx(v,{value:h,onChange:F,options:[{value:"",label:a("automation.all_modes")},{value:"develop",label:"develop"},{value:"review",label:"review"}]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.execution_mode")}),e.jsx("div",{className:"flex gap-2",children:["readonly","writable"].map(t=>e.jsx("button",{onClick:()=>K(t),className:`flex-1 rounded-[4px] border px-3 py-2 text-xs transition-colors ${f===t?"border-[var(--accent)] text-[var(--accent)] bg-[var(--accent)]/5":"border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:t},t))}),e.jsx("p",{className:"mt-1 text-[10px] text-[var(--text-muted)]",children:a(f==="writable"?"automation.writable_hint":"automation.readonly_hint")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.agent_type")}),e.jsx("div",{className:"flex gap-2",children:de.map(t=>e.jsx("button",{onClick:()=>L(t.value),className:`flex-1 rounded-[4px] border px-3 py-2 text-xs transition-colors ${k===t.value?"border-[var(--accent)] text-[var(--accent)] bg-[var(--accent)]/5":"border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:t.label},t.value))})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center gap-2 text-xs text-[var(--text-primary)] cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:C,onChange:t=>z(t.target.checked),className:"h-3.5 w-3.5 cursor-pointer accent-[var(--accent)]"}),a("automation.notify_project_chats")]}),e.jsx("p",{className:"mt-1 pl-5 text-[10px] text-[var(--text-muted)]",children:a("automation.notify_project_chats_hint")})]}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsx("button",{onClick:J,disabled:O,className:"flex-1 rounded-[4px] bg-[var(--accent)] px-4 py-2.5 text-xs font-bold text-black disabled:opacity-40 disabled:cursor-not-allowed transition-opacity hover:opacity-90",children:a(O?"automation.saving":"automation.save_changes")}),e.jsx("button",{onClick:()=>u(`/automations/${n}`),className:"rounded-[4px] border border-[var(--border)] px-4 py-2.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:a("automation.cancel")})]})]})]})}export{je as default};
@@ -0,0 +1,26 @@
1
+ import{c as E,f as R,a as K,r as l,a1 as M,x as Y,j as e,a2 as Z,a3 as P,a4 as J,a5 as F,t as h,V as Q,G as X,v as ee,h as te,X as ae}from"./index-CHuch-Tb.js";import{E as $}from"./EmptyState-HBgPBpjr.js";import{T as I}from"./Skeleton-YxLLogK4.js";import{f as O,d as re}from"./date-CmcdoD87.js";import{S as se}from"./Select-DYoGoG5A.js";import{M as ne}from"./MultiSelect-DPaJC1DP.js";import{P as oe}from"./plus-B-TXPjx1.js";import{P as ie}from"./play-DtboRxSa.js";import{Z as ce}from"./zap-C6pt7pdv.js";import{T as le}from"./timer-iriu8OXp.js";import{C as de}from"./clock-B06FHquf.js";import{C as xe}from"./chevron-right-BZbzpWXN.js";import"./chevron-down-CAmZEYXZ.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 me=E("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/**
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 H=E("BookDashed",[["path",{d:"M12 17h1.5",key:"1gkc67"}],["path",{d:"M12 22h1.5",key:"1my7sn"}],["path",{d:"M12 2h1.5",key:"19tvb7"}],["path",{d:"M17.5 22H19a1 1 0 0 0 1-1",key:"10akbh"}],["path",{d:"M17.5 2H19a1 1 0 0 1 1 1v1.5",key:"1vrfjs"}],["path",{d:"M20 14v3h-2.5",key:"1naeju"}],["path",{d:"M20 8.5V10",key:"1ctpfu"}],["path",{d:"M4 10V8.5",key:"1o3zg5"}],["path",{d:"M4 19.5V14",key:"ob81pf"}],["path",{d:"M4 4.5A2.5 2.5 0 0 1 6.5 2H8",key:"s8vcyb"}],["path",{d:"M8 22H6.5a1 1 0 0 1 0-5H8",key:"1cu73q"}]]);/**
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 ue=E("FlaskConical",[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]]);/**
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 pe=E("Inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);/**
22
+ * @license lucide-react v0.469.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */const he=E("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);function ge({severity:a}){const t={critical:"border-[var(--destructive)] text-[var(--destructive)]",warning:"border-[var(--warning)] text-[var(--warning)]",info:"border-[var(--info)] text-[var(--info)]"};return e.jsx("span",{className:`rounded-[4px] border px-1.5 py-0.5 text-[10px] ${t[a]??"border-[var(--border)] text-[var(--text-muted)]"}`,children:a})}function z({type:a}){const o={cron:le,task_event:ce,manual:ie}[a]??de;return e.jsxs("span",{className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-1.5 py-0.5 text-[10px] text-[var(--text-muted)]",children:[e.jsx(o,{className:"h-2.5 w-2.5"}),a]})}function V({mode:a}){const t=a==="writable";return e.jsx("span",{className:`rounded-[4px] border px-1.5 py-0.5 text-[10px] ${t?"border-[var(--warning)] text-[var(--warning)]":"border-[var(--border)] text-[var(--text-muted)]"}`,children:a})}function be(a,t){const o=a&&a.length>0?a:[t];return o.length<=2?o.join(", "):`${o.slice(0,2).join(", ")} +${o.length-2}`}function ve(){const a=R(),{t}=K(),{runs:o,loading:i,fetchRuns:d,updateRunStatus:v,batchUpdateRuns:x,clearRunQuery:f}=M(),[r,y]=l.useState(new Set),k=l.useRef(!1);l.useEffect(()=>(d({inboxStatus:"unread",limit:50}),()=>{f()}),[d,f]),l.useEffect(()=>{k.current=!0;const s=Z.onStatus(g=>{k.current&&g==="connected"&&d({inboxStatus:"unread",limit:50})});return()=>{k.current=!1,s()}},[d]);const c=s=>{y(g=>{const u=new Set(g);return u.has(s)?u.delete(s):u.add(s),u})},p=()=>{r.size===o.length?y(new Set):y(new Set(o.map(s=>s.id)))},m=async s=>{try{await v(s,"read"),h.success(t("automation.marked_as_read"))}catch{h.error(t("automation.failed_mark_read"))}},N=async s=>{try{await v(s,"archived"),h.success(t("automation.archived"))}catch{h.error(t("automation.failed_archive"))}},w=async()=>{if(r.size!==0)try{await x(Array.from(r),"read"),y(new Set),h.success(t("automation.marked_n_read",{n:r.size}))}catch{h.error(t("automation.failed_batch_update"))}},j=s=>!s.findings||!Array.isArray(s.findings)?[]:s.findings.flatMap(g=>{if(g.detail&&typeof g.detail=="string"&&g.detail.trimStart().startsWith("{"))try{const u=JSON.parse(g.detail);if(Array.isArray(u.findings)&&u.findings.length>0)return u.findings}catch{}return[g]}),C=s=>j(s).length;if(i&&o.length===0)return e.jsx("div",{className:"p-4",children:e.jsx(I,{rows:4})});const T=o.filter(s=>s.inboxStatus==="unread");return T.length===0?e.jsx($,{icon:pe,title:t("automation.no_unread_findings"),description:t("automation.inbox_description")}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx("button",{onClick:p,className:"rounded-[4px] border border-[var(--border)] px-2.5 py-1.5 text-[11px] text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:r.size===T.length?t("automation.deselect_all"):t("automation.select_all")}),r.size>0&&e.jsxs("button",{onClick:w,className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1.5 text-[11px] text-[var(--text-secondary)] hover:text-[var(--accent)] transition-colors",children:[e.jsx(P,{className:"h-3 w-3"}),t("automation.mark_all_read")," (",r.size,")"]})]}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:T.map(s=>e.jsxs("div",{className:"flex items-center gap-3 border-b border-[var(--border)] px-4 py-3 last:border-b-0",children:[e.jsx("input",{type:"checkbox",checked:r.has(s.id),onChange:()=>c(s.id),className:"h-3.5 w-3.5 shrink-0 accent-[var(--accent)]"}),e.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full bg-[var(--accent)]"}),e.jsxs("div",{className:"flex min-w-0 flex-1 cursor-pointer flex-col gap-0.5",onClick:()=>a(`/automations/runs/${s.id}`),children:[e.jsx("span",{className:"truncate text-xs text-[var(--text-primary)] hover:text-[var(--accent)] transition-colors",children:t("automation.run_label",{id:s.id,automationId:s.automationId})}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(z,{type:s.triggerType}),C(s)>0&&e.jsx("span",{className:"text-[10px] text-[var(--text-muted)]",children:C(s)!==1?t("automation.findings_count",{count:C(s)}):t("automation.finding_count",{count:C(s)})}),C(s)>0&&(()=>{const g=new Set(j(s).map(u=>u.severity));return Array.from(g).map(u=>e.jsx(ge,{severity:u},u))})()]})]}),e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:O(s.createdAt)}),e.jsx("button",{onClick:()=>m(s.id),className:"shrink-0 rounded-[4px] p-1.5 text-[var(--text-muted)] hover:text-[var(--accent)] transition-colors",title:t("automation.mark_read"),children:e.jsx(P,{className:"h-3.5 w-3.5"})}),e.jsx("button",{onClick:()=>N(s.id),className:"shrink-0 rounded-[4px] p-1.5 text-[var(--text-muted)] hover:text-[var(--text-secondary)] transition-colors",title:t("automation.archive"),children:e.jsx(me,{className:"h-3.5 w-3.5"})})]},s.id))})]})}function fe(){const a=R(),{t}=K(),{automations:o,loading:i,fetchAutomations:d,enableAutomation:v,disableAutomation:x}=M();l.useEffect(()=>{d()},[d]);const f=async r=>{try{r.enabled?(await x(r.id),h.success(t("automation.automation_disabled"))):(await v(r.id),h.success(t("automation.automation_enabled")))}catch{h.error(t("automation.failed_toggle"))}};return i&&o.length===0?e.jsx("div",{className:"p-4",children:e.jsx(I,{rows:4})}):o.length===0?e.jsx($,{icon:J,title:t("automation.no_automations"),description:t("automation.create_first_description"),actionLabel:t("automation.new_automation"),onAction:()=>a("/automations/new")}):e.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:o.map(r=>e.jsxs("div",{className:"cursor-pointer rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 transition-colors hover:border-[var(--accent)]/30",onClick:()=>a(`/automations/${r.id}`),children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-xs font-bold text-[var(--text-primary)]",children:r.name}),e.jsx("span",{className:`h-2 w-2 shrink-0 rounded-full ${r.enabled?"bg-[var(--accent)]":"bg-[var(--text-muted)]"}`})]}),r.description&&e.jsx("p",{className:"mt-1 truncate text-[11px] text-[var(--text-muted)]",children:r.description}),e.jsxs("p",{className:"mt-1 text-[10px] text-[var(--text-muted)]",children:[t("automation.project"),": ",be(r.projectKeys,r.projectKey)]})]}),e.jsx("button",{type:"button",onClick:y=>{y.stopPropagation(),f(r)},"aria-pressed":r.enabled,className:`relative h-5 w-9 shrink-0 cursor-pointer rounded-full transition-colors focus:outline-none ${r.enabled?"bg-[var(--accent)]":"bg-[var(--border)]"}`,children:e.jsx("span",{className:`absolute top-0.5 left-0.5 h-4 w-4 rounded-full bg-white shadow-sm transition-transform ${r.enabled?"translate-x-4":"translate-x-0"}`})})]}),e.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[e.jsx(z,{type:r.triggerType}),e.jsx(V,{mode:r.executionMode})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-3 text-[10px] text-[var(--text-muted)]",children:[r.lastRunAt&&e.jsx("span",{children:t("automation.last_run",{time:O(r.lastRunAt)})}),r.nextRunAt&&e.jsx("span",{children:t("automation.next_run",{time:re(r.nextRunAt)})}),!r.lastRunAt&&!r.nextRunAt&&e.jsx("span",{children:t("automation.no_runs_yet")})]})]},r.id))})}const B={status_reports:{titleKey:"automation.template_category_status_reports",descriptionKey:"automation.template_category_status_reports_description",icon:X,order:0,iconClass:"border-sky-500/30 bg-sky-500/10 text-sky-300"},release_prep:{titleKey:"automation.template_category_release_prep",descriptionKey:"automation.template_category_release_prep_description",icon:P,order:1,iconClass:"border-emerald-500/30 bg-emerald-500/10 text-emerald-300"},incidents_triage:{titleKey:"automation.template_category_incidents_triage",descriptionKey:"automation.template_category_incidents_triage_description",icon:Q,order:2,iconClass:"border-rose-500/30 bg-rose-500/10 text-rose-300"},code_quality:{titleKey:"automation.template_category_code_quality",descriptionKey:"automation.template_category_code_quality_description",icon:ue,order:3,iconClass:"border-amber-500/30 bg-amber-500/10 text-amber-300"},repo_maintenance:{titleKey:"automation.template_category_repo_maintenance",descriptionKey:"automation.template_category_repo_maintenance_description",icon:he,order:4,iconClass:"border-fuchsia-500/30 bg-fuchsia-500/10 text-fuchsia-300"},growth_exploration:{titleKey:"automation.template_category_growth_exploration",descriptionKey:"automation.template_category_growth_exploration_description",icon:F,order:5,iconClass:"border-violet-500/30 bg-violet-500/10 text-violet-300"},other:{titleKey:"automation.template_category_other",descriptionKey:"automation.template_category_other_description",icon:H,order:99,iconClass:"border-[var(--border)] bg-[var(--bg-input)] text-[var(--text-muted)]"}},ye={standup_summary:0,weekly_engineering_summary:1,weekly_release_notes:2,daily_bug_scan:3},je=[{label:"claude",value:"claude"},{label:"cursor",value:"cursor"},{label:"codex",value:"codex"}];function S(a){return B[a??""]??B.other}function _e(a){const t=S(a.category);return{Icon:t.icon,iconClass:t.iconClass}}function U(a){const t=a.builtinKey!=null?ye[a.builtinKey]??50:50,o=S(a.category).order,i=a.isBuiltin?0:20,d=a.executionMode==="readonly"?0:2;return t+o*5+i+d}function D({template:a,onUse:t,emphasized:o=!1,sourceLabel:i,actionLabel:d}){const{Icon:v,iconClass:x}=_e(a);return e.jsxs("article",{className:`group rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 transition-colors hover:border-[var(--accent)]/30 ${o?"min-h-[220px]":""}`,children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx("div",{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-[4px] border ${x}`,children:e.jsx(v,{className:"h-4 w-4"})}),e.jsx("span",{className:"rounded-[4px] border border-[var(--border)] px-2 py-1 text-[10px] text-[var(--text-muted)]",children:i})]}),e.jsxs("div",{className:"mt-4",children:[e.jsx("h3",{className:"text-sm font-bold text-[var(--text-primary)]",children:a.name}),e.jsx("p",{className:`mt-2 text-xs leading-5 text-[var(--text-secondary)] ${o?"line-clamp-4":"line-clamp-3"}`,children:a.description})]}),e.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[e.jsx(z,{type:a.triggerType}),e.jsx(V,{mode:a.executionMode})]}),e.jsxs("button",{onClick:()=>t(a.id),className:"mt-5 inline-flex items-center gap-1 text-xs font-bold text-[var(--accent)] transition-colors hover:text-[var(--text-primary)]",children:[d,e.jsx(xe,{className:"h-3.5 w-3.5 transition-transform group-hover:translate-x-0.5"})]})]})}function Ne(a){const t=a.trim().split(/\s+/);return t.length===5||t.length===6}function ke({template:a,onClose:t,onCreated:o}){const{t:i}=K(),{createAutomation:d}=M(),[v,x]=l.useState([]),[f,r]=l.useState([]),[y,k]=l.useState(""),[c,p]=l.useState("UTC"),[m,N]=l.useState("claude"),[w,j]=l.useState(!0),[C,T]=l.useState(!1),[s,g]=l.useState(!1),[u,L]=l.useState(!1);if(ee(!!a),l.useEffect(()=>{if(!a)return;const n=a.triggerConfig??{},b=a.taskConfig??{};r([]),k(typeof n.cron=="string"?n.cron:""),p(typeof n.timezone=="string"?n.timezone:"UTC"),N(typeof b.agentType=="string"?b.agentType:"claude"),j(!0),T(!1),g(!0);let _=!1;return te.get("web/projects").json().then(A=>{_||(x(A),A.length===1&&(r([A[0].key]),N(A[0].agentType)))}).catch(()=>{_||h.error(i("automation.failed_load_projects"))}).finally(()=>{_||g(!1)}),()=>{_=!0}},[a,i]),l.useEffect(()=>{if(!a)return;const n=b=>{b.key==="Escape"&&!u&&t()};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[a,t,u]),!a)return null;const q=n=>{if(r(n),C)return;const b=v.find(_=>_.key===n[0]);b&&N(b.agentType)},G=n=>{N(n),T(!0)},W=async()=>{if(f.length===0){h.error(i("automation.project_required"));return}let n=a.triggerConfig??{};if(a.triggerType==="cron"){if(!y.trim()){h.error(i("automation.cron_expression_required"));return}if(!Ne(y)){h.error(i("automation.cron_expression_invalid"));return}n={...n,cron:y.trim(),timezone:c}}else if(a.triggerType==="task_event"){const b=typeof n.filter=="object"&&n.filter!==null&&!Array.isArray(n.filter)?n.filter:{},{projectKey:_,...A}=b;n={...n,filter:{...A,...f.length===1?{projectKey:f[0]}:{}}}}L(!0);try{const b=a.taskConfig??{},_=await d({projectKey:f[0],projectKeys:f,name:a.name,description:a.taskDescription,triggerType:a.triggerType,triggerConfig:n,executionMode:a.executionMode,notifyProjectChats:w,taskConfig:{...b,agentType:m},templateId:a.id});h.success(i("automation.automation_created")),t(),o(_.id)}catch(b){const _=b instanceof Error?b.message:i("automation.failed_create");h.error(_)}finally{L(!1)}};return e.jsx("div",{className:"fixed inset-0 z-50 overflow-y-auto bg-black/70 p-4",onClick:t,children:e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":a.name,onClick:n=>n.stopPropagation(),className:"mx-auto my-4 max-h-[calc(100vh-2rem)] w-full max-w-5xl overflow-y-auto rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] font-mono shadow-2xl",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-[var(--border)] px-6 py-5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--accent)]",children:i("automation.template_preview")}),e.jsx("h2",{className:"mt-2 text-2xl font-semibold text-[var(--text-primary)]",children:a.name}),e.jsx("p",{className:"mt-2 max-w-3xl text-sm leading-6 text-[var(--text-secondary)]",children:a.description})]}),e.jsx("button",{type:"button","aria-label":i("common.close"),onClick:t,className:"rounded-[4px] border border-[var(--border)] p-2 text-[var(--text-muted)] transition-colors hover:text-[var(--text-primary)]",children:e.jsx(ae,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"px-6 py-6",children:e.jsxs("div",{className:"max-h-[40vh] overflow-y-auto rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] p-5",children:[e.jsx("p",{className:"mb-3 text-[11px] text-[var(--text-muted)]",children:i("automation.template_prompt")}),e.jsx("p",{className:"whitespace-pre-wrap text-lg leading-9 text-[var(--text-primary)]",children:a.taskDescription})]})}),e.jsxs("div",{className:"flex flex-col gap-4 border-t border-[var(--border)] px-6 py-5",children:[e.jsxs("div",{className:"grid gap-3 lg:grid-cols-[minmax(0,1.4fr)_minmax(0,1fr)_200px]",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:i("automation.project")}),e.jsx(ne,{values:f,onChange:q,options:v.map(n=>({value:n.key,label:`${n.name} (${n.key})`})),placeholder:i(s?"common.loading":"automation.select_project"),className:"w-full"})]}),a.triggerType==="cron"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:i("automation.schedule")}),e.jsx("input",{type:"text",value:y,onChange:n=>k(n.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:i("automation.timezone")}),e.jsx(se,{value:c,onChange:p,options:[{value:"UTC",label:"UTC"},{value:"Asia/Shanghai",label:"Asia/Shanghai"},{value:"Asia/Singapore",label:"Asia/Singapore"},{value:"America/Los_Angeles",label:"America/Los_Angeles"},{value:"America/New_York",label:"America/New_York"}],placeholder:i("automation.timezone"),className:"w-full"})]})]}):e.jsxs("div",{className:"lg:col-span-2 flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:i("automation.trigger_type")}),e.jsx("div",{className:"flex h-9 items-center rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 text-xs text-[var(--text-primary)]",children:a.triggerType})]})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:i("automation.agent_type")}),e.jsx("div",{className:"flex gap-2",children:je.map(n=>e.jsx("button",{type:"button",onClick:()=>G(n.value),className:`flex-1 rounded-[4px] border px-3 py-2 text-xs transition-colors ${m===n.value?"border-[var(--accent)] bg-[var(--accent)]/5 text-[var(--accent)]":"border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:n.label},n.value))})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center gap-2 text-xs text-[var(--text-primary)] cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:w,onChange:n=>j(n.target.checked),className:"h-3.5 w-3.5 cursor-pointer accent-[var(--accent)]"}),i("automation.notify_project_chats")]}),e.jsx("p",{className:"mt-1 pl-5 text-[10px] text-[var(--text-muted)]",children:i("automation.notify_project_chats_hint")})]}),e.jsxs("div",{className:"flex items-center justify-end gap-3",children:[e.jsx("button",{type:"button",onClick:t,className:"text-sm text-[var(--text-muted)] transition-colors hover:text-[var(--text-primary)]",children:i("automation.cancel")}),e.jsx("button",{type:"button",onClick:W,disabled:u,className:"rounded-[4px] bg-[var(--accent)] px-4 py-2 text-sm font-bold text-black transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-60",children:i(u?"automation.creating":"automation.create_from_template")})]})]})]})})}function we(){const a=R(),{t}=K(),{templates:o,loading:i,fetchTemplates:d}=M(),[v,x]=l.useState(null);if(l.useEffect(()=>{d()},[d]),i&&o.length===0)return e.jsx("div",{className:"p-4",children:e.jsx(I,{rows:4})});if(o.length===0)return e.jsx($,{icon:H,title:t("automation.no_templates"),description:t("automation.templates_description")});const f=o.reduce((c,p)=>{const m=p.category||"other";return c[m]||(c[m]=[]),c[m].push(p),c},{}),r=Object.entries(f).sort(([c],[p])=>S(c).order-S(p).order),y=[...o].sort((c,p)=>U(c)-U(p)).slice(0,Math.min(4,o.length)),k=c=>{const p=o.find(m=>m.id===c)??null;x(p)};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("section",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 md:p-5",children:[e.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-end md:justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-[var(--accent)]",children:[e.jsx(F,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:t("automation.templates_suggested")})]}),e.jsx("h2",{className:"mt-2 text-sm font-bold text-[var(--text-primary)]",children:t("automation.templates_suggested_title")}),e.jsx("p",{className:"mt-1 max-w-2xl text-xs leading-5 text-[var(--text-muted)]",children:t("automation.templates_suggested_description")})]}),e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:t("automation.templates_ready_count",{count:o.length})})]}),e.jsx("div",{className:"mt-4 grid gap-3 xl:grid-cols-2",children:y.map(c=>e.jsx(D,{template:c,emphasized:!0,onUse:k,sourceLabel:c.isBuiltin?t("automation.template_source_builtin"):t("automation.template_source_custom"),actionLabel:t("automation.use_template")},`suggested-${c.id}`))})]}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-[220px_minmax(0,1fr)]",children:[e.jsxs("aside",{className:"h-fit rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 lg:sticky lg:top-4",children:[e.jsx("p",{className:"text-[11px] font-bold text-[var(--text-primary)]",children:t("automation.templates_browse")}),e.jsx("p",{className:"mt-1 text-[11px] leading-5 text-[var(--text-muted)]",children:t("automation.templates_browse_description")}),e.jsx("div",{className:"mt-3 space-y-1.5",children:r.map(([c,p])=>{const m=S(c),N=m.icon,w=`automation-template-category-${c}`;return e.jsxs("button",{type:"button","aria-label":t(m.titleKey),onClick:()=>{var j;(j=document.getElementById(w))==null||j.scrollIntoView({behavior:"smooth",block:"start"})},className:"flex w-full items-center justify-between rounded-[4px] border border-transparent bg-[var(--bg-input)] px-3 py-2 text-left transition-colors hover:border-[var(--border)] hover:text-[var(--text-primary)]",children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2 text-xs text-[var(--text-secondary)]",children:[e.jsx(N,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:"truncate",children:t(m.titleKey)})]}),e.jsx("span",{className:"text-[10px] text-[var(--text-muted)]",children:p.length})]},`nav-${c}`)})})]}),e.jsx("div",{className:"space-y-6",children:r.map(([c,p])=>{const m=S(c),N=m.icon,w=`automation-template-category-${c}`;return e.jsxs("section",{id:w,className:"scroll-mt-4",children:[e.jsxs("div",{className:"mb-3 border-b border-[var(--border)] pb-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-[var(--text-muted)]",children:[e.jsx(N,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:t(m.titleKey)})]}),e.jsx("h3",{className:"mt-2 text-sm font-bold text-[var(--text-primary)]",children:t(m.titleKey)}),e.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--text-muted)]",children:t(m.descriptionKey)})]}),e.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:p.map(j=>e.jsx(D,{template:j,onUse:k,sourceLabel:j.isBuiltin?t("automation.template_source_builtin"):t("automation.template_source_custom"),actionLabel:t("automation.use_template")},j.id))})]},c)})})]}),e.jsx(ke,{template:v,onClose:()=>x(null),onCreated:c=>a(`/automations/${c}`)})]})}function Ue(){const a=R(),{t}=K(),[o,i]=l.useState("inbox"),d=M(x=>x.inboxUnreadCount);l.useEffect(()=>{M.getState().fetchInboxCount()},[]),Y(l.useMemo(()=>e.jsxs("button",{onClick:()=>a("/automations/new"),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(oe,{className:"h-3.5 w-3.5"}),t("automation.new_automation")]}),[a,t]));const v=[{key:"inbox",label:t("automation.tab_inbox"),count:d>0?d:void 0},{key:"automations",label:t("automation.tab_automations")},{key:"templates",label:t("automation.tab_templates")}];return e.jsxs("div",{className:"mx-auto max-w-6xl px-2 py-4 md:px-4 md:py-6 font-mono",children:[e.jsx("h1",{className:"sr-only",children:t("automation.title")}),e.jsx("div",{className:"mb-4 flex items-center gap-1 overflow-x-auto pb-1 no-scrollbar",children:v.map(x=>e.jsxs("button",{onClick:()=>i(x.key),className:`shrink-0 rounded-[4px] px-3 py-2 h-8 text-xs transition-colors flex items-center gap-1.5 ${o===x.key?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)] bg-[var(--bg-card)] hover:text-[var(--text-secondary)]"}`,children:[x.label,x.count!==void 0&&e.jsx("span",{className:"flex h-4 min-w-[16px] items-center justify-center rounded-full bg-[var(--accent)] px-1 text-[10px] font-bold text-black",children:x.count})]},x.key))}),o==="inbox"&&e.jsx(ve,{}),o==="automations"&&e.jsx(fe,{}),o==="templates"&&e.jsx(we,{})]})}export{Ue as default};
@@ -0,0 +1,6 @@
1
+ import{c as k,f as E,a as I,B as A,r as o,k as C,p as R,h,j as t,Y as p,V as S}from"./index-CHuch-Tb.js";import{E as g}from"./EmptyState-HBgPBpjr.js";import{T as _}from"./Skeleton-YxLLogK4.js";import{b as P,c as D,f as T}from"./date-CmcdoD87.js";import{C as L}from"./clock-B06FHquf.js";import{A as $}from"./arrow-left-CnVeKL9M.js";import{E as G}from"./external-link-CzAmYpcP.js";import{C as q}from"./circle-alert-CVKJUhGD.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 U=k("GitPullRequest",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["line",{x1:"6",x2:"6",y1:"9",y2:"21",key:"rroup"}]]);function O(n){switch(n){case"COMPLETED":return"bg-[var(--accent)]";case"RUNNING":return"bg-[var(--accent)]";case"PENDING":return"bg-[var(--warning)]";case"FAILED":return"bg-[var(--destructive)]";case"SKIPPED":return"bg-[#525252]";default:return"bg-[#525252]"}}function B(n){switch(n){case"COMPLETED":return"text-[var(--accent)]";case"RUNNING":return"text-[var(--accent)]";case"PENDING":return"text-[var(--warning)]";case"FAILED":return"text-[var(--destructive)]";default:return"text-[var(--text-muted)]"}}const M={critical:S,warning:q,info:p},b={critical:"border-[var(--destructive)] text-[var(--destructive)]",warning:"border-[var(--warning)] text-[var(--warning)]",info:"border-[var(--info)] text-[var(--info)]"},F={critical:"bg-[var(--destructive)]/5",warning:"bg-[var(--warning)]/5",info:"bg-[var(--info)]/5"};function X(){const n=E(),{t:s}=I(),{runId:i}=A(),[r,x]=o.useState(null),[N,v]=o.useState(!0),d=o.useRef(null),f=C(e=>e.eventSeq);if(R(r?s("automation.run_title",{id:r.id}):null),o.useEffect(()=>{if(!i)return;let e=!1;return v(!0),h.get(`web/automation-runs/${i}`).json().then(a=>{e||(x(a),d.current=a)}).catch(()=>{e||x(null)}).finally(()=>{e||v(!1)}),()=>{e=!0}},[i]),o.useEffect(()=>{if(!i||f===0)return;const e=d.current;e&&!["PENDING","RUNNING"].includes(e.status)||h.get(`web/automation-runs/${i}`).json().then(a=>{x(a),d.current=a}).catch(()=>{})},[f,i]),N)return t.jsx("div",{className:"mx-auto max-w-4xl px-2 py-4 md:px-4 md:py-6 font-mono",children:t.jsx(_,{rows:6})});if(!r)return t.jsx("div",{className:"mx-auto max-w-4xl px-2 py-4 md:px-4 md:py-6 font-mono",children:t.jsx(g,{icon:L,title:s("automation.run_not_found")})});const m=(()=>{if(!Array.isArray(r.findings))return[];const e=[];for(const a of r.findings){if(a.detail&&typeof a.detail=="string"&&a.detail.trimStart().startsWith("{"))try{const c=JSON.parse(a.detail);if(Array.isArray(c.findings)&&c.findings.length>0){e.push(...c.findings);continue}}catch{}e.push(a)}return e})(),j=P(r.startedAt,r.completedAt),l={},y=["critical","warning","info"];for(const e of m){const a=e.severity||"info";l[a]||(l[a]=[]),l[a].push(e)}return t.jsxs("div",{className:"mx-auto max-w-4xl px-2 py-4 md:px-4 md:py-6 font-mono",children:[t.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[t.jsx("button",{onClick:()=>n(-1),className:"rounded-[4px] p-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:t.jsx($,{className:"h-4 w-4"})}),t.jsxs("div",{children:[t.jsx("h1",{className:"text-sm font-bold text-[var(--text-primary)]",children:s("automation.run_title",{id:r.id})}),r.automationName&&t.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:r.automationName})]})]}),t.jsxs("div",{className:"mb-6 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[t.jsx("h2",{className:"mb-3 text-[11px] font-bold text-[var(--text-muted)]",children:s("automation.run_metadata")}),t.jsxs("div",{className:"grid grid-cols-2 gap-3 md:grid-cols-5",children:[t.jsxs("div",{children:[t.jsx("span",{className:"block text-[10px] text-[var(--text-muted)]",children:s("automation.status")}),t.jsxs("span",{className:`mt-0.5 flex items-center gap-1.5 text-xs ${B(r.status)}`,children:[t.jsx("span",{className:`h-2 w-2 rounded-full ${O(r.status)}`}),r.status.toLowerCase()]})]}),t.jsxs("div",{children:[t.jsx("span",{className:"block text-[10px] text-[var(--text-muted)]",children:s("automation.trigger_type")}),t.jsx("span",{className:"mt-0.5 block text-xs text-[var(--text-primary)]",children:r.triggerType})]}),t.jsxs("div",{children:[t.jsx("span",{className:"block text-[10px] text-[var(--text-muted)]",children:s("automation.triggered_at")}),t.jsx("span",{className:"mt-0.5 block text-xs text-[var(--text-primary)]",children:D(r.createdAt)}),t.jsx("span",{className:"block text-[10px] text-[var(--text-muted)]",children:T(r.createdAt)})]}),t.jsxs("div",{children:[t.jsx("span",{className:"block text-[10px] text-[var(--text-muted)]",children:s("automation.duration")}),t.jsx("span",{className:"mt-0.5 block text-xs text-[var(--text-primary)]",children:j??"-"})]}),t.jsxs("div",{children:[t.jsx("span",{className:"block text-[10px] text-[var(--text-muted)]",children:s("automation.project")}),t.jsx("span",{className:"mt-0.5 block text-xs text-[var(--text-primary)]",children:r.projectKey??"-"})]})]}),t.jsxs("div",{className:"mt-3 flex items-center gap-3",children:[r.taskId&&t.jsxs("button",{onClick:()=>n(`/tasks/${r.taskId}`),className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-[11px] text-[var(--accent)] hover:bg-[var(--accent)]/5 transition-colors",children:[t.jsx(G,{className:"h-3 w-3"})," ",s("automation.task_label",{id:r.taskId})]}),r.mrUrl&&t.jsxs("a",{href:r.mrUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-[11px] text-[var(--accent)] hover:bg-[var(--accent)]/5 transition-colors",children:[t.jsx(U,{className:"h-3 w-3"})," ",s("automation.merge_request")]})]})]}),t.jsxs("div",{children:[t.jsx("h2",{className:"mb-3 text-[11px] font-bold text-[var(--text-muted)]",children:s("automation.findings_title",{count:m.length})}),m.length===0?t.jsx(g,{icon:p,title:s("automation.no_findings"),compact:!0}):t.jsx("div",{className:"space-y-4",children:y.map(e=>{const a=l[e];if(!a||a.length===0)return null;const c=M[e]??p;return t.jsxs("div",{children:[t.jsxs("div",{className:"mb-2 flex items-center gap-1.5",children:[t.jsx(c,{className:`h-3.5 w-3.5 ${e==="critical"?"text-[var(--destructive)]":e==="warning"?"text-[var(--warning)]":"text-[var(--info)]"}`}),t.jsxs("span",{className:"text-[11px] font-bold text-[var(--text-primary)]",children:[e," (",a.length,")"]})]}),t.jsx("div",{className:"space-y-2",children:a.map((u,w)=>t.jsx("div",{className:`rounded-[4px] border p-3 ${b[e]??"border-[var(--border)]"} ${F[e]??""}`,children:t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsx("span",{className:`mt-0.5 rounded-[4px] border px-1.5 py-0.5 text-[10px] ${b[e]??"border-[var(--border)] text-[var(--text-muted)]"}`,children:e}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("span",{className:"block text-xs font-bold text-[var(--text-primary)]",children:u.title}),u.detail&&t.jsx("p",{className:"mt-1 whitespace-pre-wrap text-[11px] text-[var(--text-secondary)]",children:u.detail})]})]})},w))})]},e)})})]})]})}export{X as default};
@@ -1 +1 @@
1
- import{a as u,F as h,f as g,r as s,h as v,j as e}from"./index-Cnjcx5EP.js";function j(){const{t:r}=u(),[l]=h(),i=g(),a=l.get("token"),[n,o]=s.useState("loading"),[m,p]=s.useState(""),[b,c]=s.useState("");return s.useEffect(()=>{if(!a){o("error"),c(r("bind.no_token"));return}v.post("web/profile/bind-platform",{json:{token:a}}).json().then(t=>{p(t.platform),o("success")}).catch(async t=>{var x;o("error");try{const d=await((x=t.response)==null?void 0:x.json());c((d==null?void 0:d.message)??r("bind.error"))}catch{c(t instanceof Error?t.message:r("bind.error"))}})},[a]),e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-[var(--bg-primary)] px-4 font-mono",children:e.jsxs("div",{className:"w-full max-w-[400px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 md:p-6",children:[e.jsx("h1",{className:"mb-4 text-sm text-[var(--text-primary)]",children:r("bind.title")}),n==="loading"&&e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("bind.linking")}),n==="success"&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"rounded-[4px] border border-green-500/30 bg-green-500/10 px-3 py-2 text-xs text-green-400",children:r("bind.success")}),e.jsx("p",{className:"text-xs text-[var(--text-secondary)]",children:r("bind.success_detail").replace("{platform}",m)}),e.jsx("button",{onClick:()=>i("/home"),className:"rounded-[4px] bg-[var(--accent)] px-3 py-2 text-xs text-black hover:opacity-90 transition-opacity",children:r("bind.back_to_home")})]}),n==="error"&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"rounded-[4px] border border-red-500/30 bg-red-500/10 px-3 py-2 text-xs text-red-400 break-words",children:b||r("bind.invalid_token")}),e.jsx("button",{onClick:()=>i("/home"),className:"rounded-[4px] border border-[var(--border)] px-3 py-2 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:r("bind.back_to_home")})]})]})})}export{j as default};
1
+ import{a as u,F as h,f as g,r as s,h as v,j as e}from"./index-CHuch-Tb.js";function j(){const{t:r}=u(),[l]=h(),i=g(),a=l.get("token"),[n,o]=s.useState("loading"),[m,p]=s.useState(""),[b,c]=s.useState("");return s.useEffect(()=>{if(!a){o("error"),c(r("bind.no_token"));return}v.post("web/profile/bind-platform",{json:{token:a}}).json().then(t=>{p(t.platform),o("success")}).catch(async t=>{var x;o("error");try{const d=await((x=t.response)==null?void 0:x.json());c((d==null?void 0:d.message)??r("bind.error"))}catch{c(t instanceof Error?t.message:r("bind.error"))}})},[a]),e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-[var(--bg-primary)] px-4 font-mono",children:e.jsxs("div",{className:"w-full max-w-[400px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 md:p-6",children:[e.jsx("h1",{className:"mb-4 text-sm text-[var(--text-primary)]",children:r("bind.title")}),n==="loading"&&e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("bind.linking")}),n==="success"&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"rounded-[4px] border border-green-500/30 bg-green-500/10 px-3 py-2 text-xs text-green-400",children:r("bind.success")}),e.jsx("p",{className:"text-xs text-[var(--text-secondary)]",children:r("bind.success_detail").replace("{platform}",m)}),e.jsx("button",{onClick:()=>i("/home"),className:"rounded-[4px] bg-[var(--accent)] px-3 py-2 text-xs text-black hover:opacity-90 transition-opacity",children:r("bind.back_to_home")})]}),n==="error"&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"rounded-[4px] border border-red-500/30 bg-red-500/10 px-3 py-2 text-xs text-red-400 break-words",children:b||r("bind.invalid_token")}),e.jsx("button",{onClick:()=>i("/home"),className:"rounded-[4px] border border-[var(--border)] px-3 py-2 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:r("bind.back_to_home")})]})]})})}export{j as default};