@overlordai/server 1.0.176 → 1.0.178

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 (143) hide show
  1. package/dist/connectors/connector.controller.d.ts.map +1 -1
  2. package/dist/connectors/connector.controller.js +2 -0
  3. package/dist/connectors/connector.controller.js.map +1 -1
  4. package/dist/database/repositories/connector.repository.d.ts +2 -0
  5. package/dist/database/repositories/connector.repository.d.ts.map +1 -1
  6. package/dist/database/repositories/connector.repository.js +8 -0
  7. package/dist/database/repositories/connector.repository.js.map +1 -1
  8. package/dist/dispatcher/scheduler.service.d.ts.map +1 -1
  9. package/dist/dispatcher/scheduler.service.js +6 -1
  10. package/dist/dispatcher/scheduler.service.js.map +1 -1
  11. package/dist/web/admin/admin-connector.controller.d.ts +6 -0
  12. package/dist/web/admin/admin-connector.controller.d.ts.map +1 -1
  13. package/dist/web/admin/admin-connector.controller.js +88 -12
  14. package/dist/web/admin/admin-connector.controller.js.map +1 -1
  15. package/dist/web/project.controller.d.ts +1 -3
  16. package/dist/web/project.controller.d.ts.map +1 -1
  17. package/dist/web/project.controller.js +3 -2
  18. package/dist/web/project.controller.js.map +1 -1
  19. package/package.json +4 -4
  20. package/public/assets/{AccessTokensPage-CoUlSpBu.js → AccessTokensPage-1EKC1hiZ.js} +1 -1
  21. package/public/assets/AdminPage-51tboyFu.js +1 -0
  22. package/public/assets/{AgentCliPage-2zflW4gy.js → AgentCliPage-HVXHK2Or.js} +1 -1
  23. package/public/assets/{ApiReferencePage-BC8HEfcM.js → ApiReferencePage-TgiwRipe.js} +1 -1
  24. package/public/assets/{ArchitecturePage-Da9rv0hg.js → ArchitecturePage-BzeZql6h.js} +1 -1
  25. package/public/assets/{AuditLogPage-BrF0T3MT.js → AuditLogPage-y6n7Px8g.js} +1 -1
  26. package/public/assets/{AutomationCreatePage-DI-Z1v9e.js → AutomationCreatePage-CajNO4bS.js} +1 -1
  27. package/public/assets/{AutomationDetailPage-7TLMwELt.js → AutomationDetailPage-Dgf3Tb9C.js} +3 -8
  28. package/public/assets/{AutomationEditPage-BuOKTyTf.js → AutomationEditPage-DYaZj31T.js} +1 -1
  29. package/public/assets/{AutomationListPage-D4XF43yR.js → AutomationListPage-DxPUmPbs.js} +3 -3
  30. package/public/assets/{AutomationRunDetailPage-BDhPEndz.js → AutomationRunDetailPage-DmNxMDk5.js} +1 -1
  31. package/public/assets/{BindPlatformPage-DNamr2h_.js → BindPlatformPage-MYeCpBFT.js} +1 -1
  32. package/public/assets/{BotIntegrationPage-DN665fG6.js → BotIntegrationPage-Dnk8iYbr.js} +1 -1
  33. package/public/assets/BotManage-96DyyPVc.js +1 -0
  34. package/public/assets/{BotSetupPage-DPsT5Ln6.js → BotSetupPage-esAmTt5X.js} +1 -1
  35. package/public/assets/ChangelogPage-BZmrhbzu.js +1 -0
  36. package/public/assets/{Checkbox-D8xEau6n.js → Checkbox-CQt3GUhI.js} +1 -1
  37. package/public/assets/{CliReferencePage-DVtpCVyB.js → CliReferencePage-D-PUOTbI.js} +1 -1
  38. package/public/assets/{ConfirmStageDialog-Cu49oAnM.js → ConfirmStageDialog-DIsZM7QS.js} +1 -1
  39. package/public/assets/ConnectorsManage-v8CzbHwB.js +6 -0
  40. package/public/assets/{ConnectorsPage-DmC6MARl.js → ConnectorsPage-Czxmo0rf.js} +1 -1
  41. package/public/assets/{DeploymentPage-P3jrGKlU.js → DeploymentPage-BmfGIQ--.js} +1 -1
  42. package/public/assets/{DevWorkflowPage-DDE9wLKC.js → DevWorkflowPage-BwP87xBb.js} +1 -1
  43. package/public/assets/{DeveloperManage-Bpo7QRy5.js → DeveloperManage-Bu-dU6qo.js} +2 -2
  44. package/public/assets/{DeveloperSetupPage-CHz_5bNW.js → DeveloperSetupPage-PXns-tkJ.js} +1 -1
  45. package/public/assets/{DocsIndexPage-C8kNCHNc.js → DocsIndexPage-DHYB2eq5.js} +6 -11
  46. package/public/assets/{DocsLayout-CF22uAIS.js → DocsLayout-DLxSnG0D.js} +1 -1
  47. package/public/assets/{DocsPrimitives-BhxcRaTm.js → DocsPrimitives-D7h19aXG.js} +1 -1
  48. package/public/assets/{EditProjectPage-D_3HRO1s.js → EditProjectPage-BC0UDNOv.js} +2 -2
  49. package/public/assets/{EmptyState-IvQHEoph.js → EmptyState-CMDagsi4.js} +1 -1
  50. package/public/assets/{EnvVariablesPage-DNuaFEmN.js → EnvVariablesPage-BB7ahnB1.js} +1 -1
  51. package/public/assets/HomePage-CssNquOH.js +1 -0
  52. package/public/assets/{InfoRow-C_tQVkuP.js → InfoRow-BxIE0xaA.js} +1 -1
  53. package/public/assets/{InstallationPage-CK1BUOe2.js → InstallationPage-CcJ0J1Zn.js} +1 -1
  54. package/public/assets/{LandingPage-DvR0mLWM.js → LandingPage-BiMt64NW.js} +1 -1
  55. package/public/assets/{LocalDevelopmentPage-C-5yQqhM.js → LocalDevelopmentPage-D4FSxH3d.js} +1 -1
  56. package/public/assets/{LoginPage-BdTmOyQm.js → LoginPage-dLNo1JNx.js} +1 -1
  57. package/public/assets/{MetricBar-CKXN_2Ue.js → MetricBar-kakUenDO.js} +1 -1
  58. package/public/assets/{MultiSelect-DegVW8UL.js → MultiSelect-CmPlPDVq.js} +1 -1
  59. package/public/assets/{NotFoundPage-V93x8tfy.js → NotFoundPage-ohSBiBT-.js} +1 -1
  60. package/public/assets/{OnboardingGuide-Crybb-Zh.js → OnboardingGuide-cHKCR0M5.js} +1 -1
  61. package/public/assets/{PermissionsPage-BmehbFsh.js → PermissionsPage-7-IPdVXg.js} +1 -1
  62. package/public/assets/{PipelineConfigPage-DZVU3Vkj.js → PipelineConfigPage-BX6JMHM4.js} +1 -1
  63. package/public/assets/{PipelineEditorPage-BH67Oewc.js → PipelineEditorPage-BeNxSKH5.js} +1 -1
  64. package/public/assets/{PlanPage-B4OhS9_O.js → PlanPage-B7z3l_2F.js} +1 -1
  65. package/public/assets/{ProfilePage-DpMfRGms.js → ProfilePage-DwsnCrys.js} +1 -1
  66. package/public/assets/{ProjectDetailPage-BOvwgwui.js → ProjectDetailPage-CzLqL69C.js} +3 -3
  67. package/public/assets/{ProjectListPage-C2ZPh8P9.js → ProjectListPage-Do-9PkUN.js} +1 -1
  68. package/public/assets/{PtyTerminal-DKh7d_-3.js → PtyTerminal-Z14rUlQy.js} +1 -1
  69. package/public/assets/{QuickAuth-D2EErll5.js → QuickAuth-CX1phe7h.js} +1 -1
  70. package/public/assets/RemoveMemberConfirmDialog-DI3-C2N9.js +6 -0
  71. package/public/assets/{ReviewAggregatePage-CTSuOo4O.js → ReviewAggregatePage-tiy7PRsr.js} +2 -2
  72. package/public/assets/ReviewPage-CmbUljfI.js +1 -0
  73. package/public/assets/Select-LGk_EawR.js +1 -0
  74. package/public/assets/{SettingsPage-D3tDh7gu.js → SettingsPage-BpS56Ttu.js} +1 -1
  75. package/public/assets/{Skeleton-Crpru9Ol.js → Skeleton-DaeQHyTP.js} +1 -1
  76. package/public/assets/{SkillPage-BiwP6aqc.js → SkillPage-BexkozUK.js} +1 -1
  77. package/public/assets/TaskDetailPage-CElleGRa.js +21 -0
  78. package/public/assets/{TaskGuidePage-DD_jyUVW.js → TaskGuidePage-C5Ed0gO0.js} +1 -1
  79. package/public/assets/TaskListPage-CdajIIwz.js +1 -0
  80. package/public/assets/{TaskStatusBadge-Cfz28K6K.js → TaskStatusBadge-CuTVIvqD.js} +1 -1
  81. package/public/assets/{TerminalHomePage-BmhBvY10.js → TerminalHomePage-Cs3JoG8j.js} +1 -1
  82. package/public/assets/{TokenManage-CYSBKzT7.js → TokenManage-BeDY8n-U.js} +1 -1
  83. package/public/assets/Tooltip-DjIk-pqB.js +1 -0
  84. package/public/assets/{TotpSetupPage-DP5q6oE-.js → TotpSetupPage-C_NjLBdt.js} +1 -1
  85. package/public/assets/{WorkerDetailPage-LMirCNtN.js → WorkerDetailPage-CuuvI6Fx.js} +1 -1
  86. package/public/assets/{WorkerListPage-q6siISS8.js → WorkerListPage-70g7vy3m.js} +1 -1
  87. package/public/assets/{WorkerOperationsPage-CGzqG_QM.js → WorkerOperationsPage-BL4BZ45w.js} +1 -1
  88. package/public/assets/{WorkerSetupGuidePage-aVkDqrMr.js → WorkerSetupGuidePage-jnyL_uM0.js} +1 -1
  89. package/public/assets/{WorkerSetupPage-C_zONAIf.js → WorkerSetupPage-ChyjqvnS.js} +1 -1
  90. package/public/assets/{agent-type-options-BiSKx1a4.js → agent-type-options-BpMI3Naw.js} +1 -1
  91. package/public/assets/{arrow-left-sGTyHBvX.js → arrow-left-BL1QzlAp.js} +1 -1
  92. package/public/assets/{arrow-right-_NIT1UtR.js → arrow-right-BrrN-7YA.js} +1 -1
  93. package/public/assets/{bot-CDSBtXc_.js → bot-D-zp4qz4.js} +1 -1
  94. package/public/assets/{chevron-down-CE0uuyBZ.js → chevron-down-BOgq_PNA.js} +1 -1
  95. package/public/assets/{chevron-left-C0Zw71uv.js → chevron-left-BPO7Bb6l.js} +1 -1
  96. package/public/assets/{chevron-right-BCit7CZP.js → chevron-right-DHCIokyJ.js} +1 -1
  97. package/public/assets/{chevron-up-Bl0OZM4v.js → chevron-up-wO9VgMYB.js} +1 -1
  98. package/public/assets/{circle-alert-rHCTliEW.js → circle-alert-DkW4_zyQ.js} +1 -1
  99. package/public/assets/{clock-BwsbKSS6.js → clock-BbJkwoCd.js} +1 -1
  100. package/public/assets/{copy-h1a805Rd.js → copy-BBOWX6ou.js} +1 -1
  101. package/public/assets/developer-options-PMfL5Zv7.js +1 -0
  102. package/public/assets/{download-URcu3Jx3.js → download-CbWraeN_.js} +1 -1
  103. package/public/assets/{external-link-FhyMbjzB.js → external-link-CEkNn2LX.js} +1 -1
  104. package/public/assets/{git-fork-Dc1BvdTN.js → git-fork-B775P9bq.js} +1 -1
  105. package/public/assets/{index-J1zWTACN.js → index-Dh1GMLID.js} +15 -15
  106. package/public/assets/index-DwFw8jxe.css +1 -0
  107. package/public/assets/{key-COdogDFT.js → key-Dl9aLBg3.js} +1 -1
  108. package/public/assets/link-2-BBq5JW-o.js +6 -0
  109. package/public/assets/{loader-circle-Bq_BpbZ2.js → loader-circle-wSNLBiy-.js} +1 -1
  110. package/public/assets/{pencil-0fxibflK.js → pencil-ZFPPMxtk.js} +1 -1
  111. package/public/assets/{play-Dbk8Wgkn.js → play-DX-9yzZV.js} +1 -1
  112. package/public/assets/plug-BxGp3gAo.js +6 -0
  113. package/public/assets/{plus-V36Q_nxP.js → plus-Cn46sPb9.js} +1 -1
  114. package/public/assets/power-PnMndXJz.js +6 -0
  115. package/public/assets/{rotate-ccw-ByVQRmQu.js → rotate-ccw-zdevuzi_.js} +1 -1
  116. package/public/assets/{scroll-text-C2iOLXnA.js → scroll-text-BGkAQAvr.js} +1 -1
  117. package/public/assets/{settings-DrgaMc9j.js → settings-CfrsrJUV.js} +1 -1
  118. package/public/assets/{skip-forward-SfkU0vVB.js → skip-forward-ckOfJ8QF.js} +1 -1
  119. package/public/assets/status-colors-DC-m2CdG.js +1 -0
  120. package/public/assets/{task-agent-BIYkVnlP.js → task-agent-ZWBurVoa.js} +1 -1
  121. package/public/assets/{task-constants-07c7xWcv.js → task-constants-DfpO4NY9.js} +1 -1
  122. package/public/assets/{task.store-DWG-SG1e.js → task.store-B461yHYH.js} +1 -1
  123. package/public/assets/{timer-IeRNhyK4.js → timer-BFPhC5N0.js} +1 -1
  124. package/public/assets/{trash-2-DuFeqRaH.js → trash-2-CaIOqYj_.js} +1 -1
  125. package/public/assets/{useFetch-CZCaxaCi.js → useFetch-CJMNf1mK.js} +1 -1
  126. package/public/assets/{users-CG1y1K_u.js → users-BCrPK5sS.js} +1 -1
  127. package/public/assets/{wifi-Dvp0MK85.js → wifi-Cm-x6iNY.js} +1 -1
  128. package/public/assets/{workflow-qWh96h21.js → workflow-Burj_14o.js} +1 -1
  129. package/public/assets/{zap-Cwv7x_Mg.js → zap-BAYG3kyF.js} +1 -1
  130. package/public/index.html +2 -2
  131. package/public/sw.js +1 -1
  132. package/public/assets/AdminPage-BonHpbC8.js +0 -1
  133. package/public/assets/BotManage-DvfKuBFx.js +0 -6
  134. package/public/assets/ChangelogPage-D1_YfUwN.js +0 -1
  135. package/public/assets/HomePage-B7S2lrwi.js +0 -1
  136. package/public/assets/RemoveMemberConfirmDialog-Bnq4vIGU.js +0 -6
  137. package/public/assets/ReviewPage-Dx31QqyM.js +0 -1
  138. package/public/assets/Select-BXx8KPbW.js +0 -1
  139. package/public/assets/TaskDetailPage-DHW9thUL.js +0 -21
  140. package/public/assets/TaskListPage-CBIv7NTp.js +0 -1
  141. package/public/assets/Tooltip-DZdu3ZKx.js +0 -1
  142. package/public/assets/index-B40ZH6vh.css +0 -1
  143. package/public/assets/status-colors-IR97PkWv.js +0 -1
@@ -1,4 +1,4 @@
1
- import{c as E,f as $,a as K,r as l,a1 as M,x as Z,j as e,a2 as Q,a3 as R,a4 as X,a5 as F,t as p,V as J,G as ee,v as te,h as ae,X as re}from"./index-J1zWTACN.js";import{E as P}from"./EmptyState-IvQHEoph.js";import{T as I}from"./Skeleton-Crpru9Ol.js";import{T as se}from"./TaskStatusBadge-Cfz28K6K.js";import{f as H,d as oe}from"./date-CmcdoD87.js";import{S as ne}from"./Select-BXx8KPbW.js";import{M as ie}from"./MultiSelect-DegVW8UL.js";import{C as O}from"./Checkbox-D8xEau6n.js";import{e as ce}from"./automationFindings-DfyQvLZV.js";import{P as le}from"./plus-V36Q_nxP.js";import{P as de}from"./play-Dbk8Wgkn.js";import{Z as xe}from"./zap-Cwv7x_Mg.js";import{T as me}from"./timer-IeRNhyK4.js";import{C as ue}from"./clock-BwsbKSS6.js";import{C as pe}from"./chevron-right-BCit7CZP.js";import"./status-colors-IR97PkWv.js";import"./chevron-down-CE0uuyBZ.js";/**
1
+ import{c as E,f as $,a as K,r as l,a2 as M,x as Z,j as e,a3 as Q,a4 as R,a5 as X,a6 as F,t as p,Y as J,G as ee,v as te,h as ae,X as re}from"./index-Dh1GMLID.js";import{E as P}from"./EmptyState-CMDagsi4.js";import{T as I}from"./Skeleton-DaeQHyTP.js";import{T as se}from"./TaskStatusBadge-CuTVIvqD.js";import{f as H,d as oe}from"./date-CmcdoD87.js";import{S as ne}from"./Select-LGk_EawR.js";import{M as ie}from"./MultiSelect-CmPlPDVq.js";import{C as O}from"./Checkbox-CQt3GUhI.js";import{e as ce}from"./automationFindings-DfyQvLZV.js";import{P as le}from"./plus-Cn46sPb9.js";import{P as de}from"./play-DX-9yzZV.js";import{Z as xe}from"./zap-BAYG3kyF.js";import{T as me}from"./timer-BFPhC5N0.js";import{C as ue}from"./clock-BbJkwoCd.js";import{C as pe}from"./chevron-right-DHCIokyJ.js";import"./status-colors-DC-m2CdG.js";import"./chevron-down-BOgq_PNA.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -8,7 +8,7 @@ import{c as E,f as $,a as K,r as l,a1 as M,x as Z,j as e,a2 as Q,a3 as R,a4 as X
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 V=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"}]]);/**
11
+ */const q=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
12
  * @license lucide-react v0.469.0 - ISC
13
13
  *
14
14
  * This source code is licensed under the ISC license.
@@ -23,4 +23,4 @@ import{c as E,f as $,a as K,r as l,a1 as M,x as Z,j as e,a2 as Q,a3 as R,a4 as X
23
23
  *
24
24
  * This source code is licensed under the ISC license.
25
25
  * See the LICENSE file in the root directory of this source tree.
26
- */const ve=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 fe({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:me,task_event:xe,manual:de}[a]??ue;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 q({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 ye(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 je(){const a=$(),{t}=K(),{runs:o,loading:n,fetchRuns:d,updateRunStatus:b,batchUpdateRuns:x,clearRunQuery:v}=M(),[s,f]=l.useState(new Set),N=l.useRef(!1);l.useEffect(()=>(d({inboxStatus:"unread",limit:50}),()=>{v()}),[d,v]),l.useEffect(()=>{N.current=!0;const r=Q.onStatus(w=>{N.current&&w==="connected"&&d({inboxStatus:"unread",limit:50})});return()=>{N.current=!1,r()}},[d]);const c=r=>{f(w=>{const h=new Set(w);return h.has(r)?h.delete(r):h.add(r),h})},u=()=>{s.size===o.length?f(new Set):f(new Set(o.map(r=>r.id)))},m=async r=>{try{await b(r,"read"),p.success(t("automation.marked_as_read"))}catch{p.error(t("automation.failed_mark_read"))}},_=async r=>{try{await b(r,"archived"),p.success(t("automation.archived"))}catch{p.error(t("automation.failed_archive"))}},k=async()=>{if(s.size!==0)try{await x(Array.from(s),"read"),f(new Set),p.success(t("automation.marked_n_read",{n:s.size}))}catch{p.error(t("automation.failed_batch_update"))}},y=r=>!r.findings||!Array.isArray(r.findings)?[]:ce(r.findings),C=r=>y(r).length;if(n&&o.length===0)return e.jsx("div",{className:"p-4",children:e.jsx(I,{rows:4})});const T=o.filter(r=>r.inboxStatus==="unread");return T.length===0?e.jsx(P,{icon:be,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:u,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:s.size===T.length?t("automation.deselect_all"):t("automation.select_all")}),s.size>0&&e.jsxs("button",{onClick:k,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(R,{className:"h-3 w-3"}),t("automation.mark_all_read")," (",s.size,")"]})]}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:T.map(r=>e.jsxs("div",{className:`flex items-center gap-3 border-b border-[var(--border)] px-4 py-3 transition-colors last:border-b-0 ${s.has(r.id)?"bg-[var(--accent)]/5":"hover:bg-[var(--bg-input)]/60"}`,children:[e.jsx(O,{checked:s.has(r.id),onCheckedChange:()=>c(r.id),"aria-label":r.automationName?`${r.automationName} #${r.id}`:t("automation.run_label",{id:r.id,automationId:r.automationId}),containerClassName:"shrink-0"}),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/${r.id}`),children:[e.jsx("span",{className:"truncate text-xs text-[var(--text-primary)] hover:text-[var(--accent)] transition-colors",children:r.automationName?`${r.automationName} #${r.id}`:t("automation.run_label",{id:r.id,automationId:r.automationId})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[r.projectKey&&e.jsx("span",{className:"rounded-[4px] border border-[var(--border)] px-1.5 py-0.5 text-[10px] text-[var(--text-muted)]",children:r.projectKey}),e.jsx(z,{type:r.triggerType}),r.taskStatus&&e.jsx(se,{status:r.taskStatus}),r.workerName&&e.jsx("span",{className:"text-[10px] text-[var(--text-muted)]",children:r.workerName}),C(r)>0&&e.jsx("span",{className:"text-[10px] text-[var(--text-muted)]",children:C(r)!==1?t("automation.findings_count",{count:C(r)}):t("automation.finding_count",{count:C(r)})}),C(r)>0&&(()=>{const w=new Set(y(r).map(h=>h.severity));return Array.from(w).map(h=>e.jsx(fe,{severity:h},h))})()]})]}),e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:H(r.createdAt)}),e.jsx("button",{onClick:()=>m(r.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(R,{className:"h-3.5 w-3.5"})}),e.jsx("button",{onClick:()=>_(r.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(he,{className:"h-3.5 w-3.5"})})]},r.id))})]})}function _e(){const a=$(),{t}=K(),{automations:o,loading:n,fetchAutomations:d,enableAutomation:b,disableAutomation:x}=M();l.useEffect(()=>{d()},[d]);const v=async s=>{try{s.enabled?(await x(s.id),p.success(t("automation.automation_disabled"))):(await b(s.id),p.success(t("automation.automation_enabled")))}catch{p.error(t("automation.failed_toggle"))}};return n&&o.length===0?e.jsx("div",{className:"p-4",children:e.jsx(I,{rows:4})}):o.length===0?e.jsx(P,{icon:X,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(s=>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/${s.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:s.name}),e.jsx("span",{className:`h-2 w-2 shrink-0 rounded-full ${s.enabled?"bg-[var(--accent)]":"bg-[var(--text-muted)]"}`})]}),s.description&&e.jsx("p",{className:"mt-1 truncate text-[11px] text-[var(--text-muted)]",children:s.description}),e.jsxs("p",{className:"mt-1 text-[10px] text-[var(--text-muted)]",children:[t("automation.project"),": ",ye(s.projectKeys,s.projectKey)]})]}),e.jsx("button",{type:"button",onClick:f=>{f.stopPropagation(),v(s)},"aria-pressed":s.enabled,className:`relative h-5 w-9 shrink-0 cursor-pointer rounded-full transition-colors focus:outline-none ${s.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 ${s.enabled?"translate-x-4":"translate-x-0"}`})})]}),e.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[e.jsx(z,{type:s.triggerType}),e.jsx(q,{mode:s.executionMode})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-3 text-[10px] text-[var(--text-muted)]",children:[s.lastRunAt&&e.jsx("span",{children:t("automation.last_run",{time:H(s.lastRunAt)})}),s.nextRunAt&&e.jsx("span",{children:t("automation.next_run",{time:oe(s.nextRunAt)})}),!s.lastRunAt&&!s.nextRunAt&&e.jsx("span",{children:t("automation.no_runs_yet")})]})]},s.id))})}const B={status_reports:{titleKey:"automation.template_category_status_reports",descriptionKey:"automation.template_category_status_reports_description",icon:ee,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:R,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:J,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:ge,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:ve,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:V,order:99,iconClass:"border-[var(--border)] bg-[var(--bg-input)] text-[var(--text-muted)]"}},Ne={standup_summary:0,weekly_engineering_summary:1,weekly_release_notes:2,daily_bug_scan:3},ke=[{label:"claude",value:"claude"},{label:"cursor",value:"cursor"},{label:"codex",value:"codex"},{label:"pi",value:"pi"}];function S(a){return B[a??""]??B.other}function we(a){const t=S(a.category);return{Icon:t.icon,iconClass:t.iconClass}}function U(a){const t=a.builtinKey!=null?Ne[a.builtinKey]??50:50,o=S(a.category).order,n=a.isBuiltin?0:20,d=a.executionMode==="readonly"?0:2;return t+o*5+n+d}function D({template:a,onUse:t,emphasized:o=!1,sourceLabel:n,actionLabel:d}){const{Icon:b,iconClass:x}=we(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(b,{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:n})]}),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(q,{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(pe,{className:"h-3.5 w-3.5 transition-transform group-hover:translate-x-0.5"})]})]})}function Ce(a){const t=a.trim().split(/\s+/);return t.length===5||t.length===6}function Te({template:a,onClose:t,onCreated:o}){const{t:n}=K(),{createAutomation:d}=M(),[b,x]=l.useState([]),[v,s]=l.useState([]),[f,N]=l.useState(""),[c,u]=l.useState("UTC"),[m,_]=l.useState("claude"),[k,y]=l.useState(!0),[C,T]=l.useState(!1),[r,w]=l.useState(!1),[h,L]=l.useState(!1);if(te(!!a),l.useEffect(()=>{if(!a)return;const i=a.triggerConfig??{},g=a.taskConfig??{};s([]),N(typeof i.cron=="string"?i.cron:""),u(typeof i.timezone=="string"?i.timezone:"UTC"),_(typeof g.agentType=="string"?g.agentType:"claude"),y(!0),T(!1),w(!0);let j=!1;return ae.get("web/projects").json().then(A=>{j||(x(A),A.length===1&&(s([A[0].key]),_(A[0].agentType)))}).catch(()=>{j||p.error(n("automation.failed_load_projects"))}).finally(()=>{j||w(!1)}),()=>{j=!0}},[a,n]),l.useEffect(()=>{if(!a)return;const i=g=>{g.key==="Escape"&&!h&&t()};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[a,t,h]),!a)return null;const G=i=>{if(s(i),C)return;const g=b.find(j=>j.key===i[0]);g&&_(g.agentType)},Y=i=>{_(i),T(!0)},W=async()=>{if(v.length===0){p.error(n("automation.project_required"));return}let i=a.triggerConfig??{};if(a.triggerType==="cron"){if(!f.trim()){p.error(n("automation.cron_expression_required"));return}if(!Ce(f)){p.error(n("automation.cron_expression_invalid"));return}i={...i,cron:f.trim(),timezone:c}}else if(a.triggerType==="task_event"){const g=typeof i.filter=="object"&&i.filter!==null&&!Array.isArray(i.filter)?i.filter:{},{projectKey:j,...A}=g;i={...i,filter:{...A,...v.length===1?{projectKey:v[0]}:{}}}}L(!0);try{const g=a.taskConfig??{},j=await d({projectKey:v[0],projectKeys:v,name:a.name,description:a.taskDescription,triggerType:a.triggerType,triggerConfig:i,executionMode:a.executionMode,notifyProjectChats:k,taskConfig:{...g,agentType:m},templateId:a.id});p.success(n("automation.automation_created")),t(),o(j.id)}catch(g){const j=g instanceof Error?g.message:n("automation.failed_create");p.error(j)}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:i=>i.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:n("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":n("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(re,{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:n("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:n("automation.project")}),e.jsx(ie,{values:v,onChange:G,options:b.map(i=>({value:i.key,label:`${i.name} (${i.key})`})),placeholder:n(r?"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:n("automation.schedule")}),e.jsx("input",{type:"text",value:f,onChange:i=>N(i.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:n("automation.timezone")}),e.jsx(ne,{value:c,onChange:u,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:n("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:n("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:n("automation.agent_type")}),e.jsx("div",{className:"flex gap-2",children:ke.map(i=>e.jsx("button",{type:"button",onClick:()=>Y(i.value),className:`flex-1 rounded-[4px] border px-3 py-2 text-xs transition-colors ${m===i.value?"border-[var(--accent)] bg-[var(--accent)]/5 text-[var(--accent)]":"border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:i.label},i.value))})]}),e.jsxs("div",{children:[e.jsx(O,{checked:k,onCheckedChange:y,label:n("automation.notify_project_chats")}),e.jsx("p",{className:"mt-1 pl-6 text-[10px] text-[var(--text-muted)]",children:n("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:n("automation.cancel")}),e.jsx("button",{type:"button",onClick:W,disabled:h,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:n(h?"automation.creating":"automation.create_from_template")})]})]})]})})}function Ae(){const a=$(),{t}=K(),{templates:o,loading:n,fetchTemplates:d}=M(),[b,x]=l.useState(null);if(l.useEffect(()=>{d()},[d]),n&&o.length===0)return e.jsx("div",{className:"p-4",children:e.jsx(I,{rows:4})});if(o.length===0)return e.jsx(P,{icon:V,title:t("automation.no_templates"),description:t("automation.templates_description")});const v=o.reduce((c,u)=>{const m=u.category||"other";return c[m]||(c[m]=[]),c[m].push(u),c},{}),s=Object.entries(v).sort(([c],[u])=>S(c).order-S(u).order),f=[...o].sort((c,u)=>U(c)-U(u)).slice(0,Math.min(4,o.length)),N=c=>{const u=o.find(m=>m.id===c)??null;x(u)};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:f.map(c=>e.jsx(D,{template:c,emphasized:!0,onUse:N,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:s.map(([c,u])=>{const m=S(c),_=m.icon,k=`automation-template-category-${c}`;return e.jsxs("button",{type:"button","aria-label":t(m.titleKey),onClick:()=>{var y;(y=document.getElementById(k))==null||y.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(_,{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:u.length})]},`nav-${c}`)})})]}),e.jsx("div",{className:"space-y-6",children:s.map(([c,u])=>{const m=S(c),_=m.icon,k=`automation-template-category-${c}`;return e.jsxs("section",{id:k,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(_,{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:u.map(y=>e.jsx(D,{template:y,onUse:N,sourceLabel:y.isBuiltin?t("automation.template_source_builtin"):t("automation.template_source_custom"),actionLabel:t("automation.use_template")},y.id))})]},c)})})]}),e.jsx(Te,{template:b,onClose:()=>x(null),onCreated:c=>a(`/automations/${c}`)})]})}function Ge(){const a=$(),{t}=K(),[o,n]=l.useState("inbox"),d=M(x=>x.inboxUnreadCount);l.useEffect(()=>{M.getState().fetchInboxCount()},[]),Z(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(le,{className:"h-3.5 w-3.5"}),t("automation.new_automation")]}),[a,t]));const b=[{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:b.map(x=>e.jsxs("button",{onClick:()=>n(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(je,{}),o==="automations"&&e.jsx(_e,{}),o==="templates"&&e.jsx(Ae,{})]})}export{Ge as default};
26
+ */const ve=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 fe({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:me,task_event:xe,manual:de}[a]??ue;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 ye(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 je(){const a=$(),{t}=K(),{runs:o,loading:n,fetchRuns:d,updateRunStatus:b,batchUpdateRuns:x,clearRunQuery:v}=M(),[s,f]=l.useState(new Set),N=l.useRef(!1);l.useEffect(()=>(d({inboxStatus:"unread",limit:50}),()=>{v()}),[d,v]),l.useEffect(()=>{N.current=!0;const r=Q.onStatus(w=>{N.current&&w==="connected"&&d({inboxStatus:"unread",limit:50})});return()=>{N.current=!1,r()}},[d]);const c=r=>{f(w=>{const h=new Set(w);return h.has(r)?h.delete(r):h.add(r),h})},u=()=>{s.size===o.length?f(new Set):f(new Set(o.map(r=>r.id)))},m=async r=>{try{await b(r,"read"),p.success(t("automation.marked_as_read"))}catch{p.error(t("automation.failed_mark_read"))}},_=async r=>{try{await b(r,"archived"),p.success(t("automation.archived"))}catch{p.error(t("automation.failed_archive"))}},k=async()=>{if(s.size!==0)try{await x(Array.from(s),"read"),f(new Set),p.success(t("automation.marked_n_read",{n:s.size}))}catch{p.error(t("automation.failed_batch_update"))}},y=r=>!r.findings||!Array.isArray(r.findings)?[]:ce(r.findings),C=r=>y(r).length;if(n&&o.length===0)return e.jsx("div",{className:"p-4",children:e.jsx(I,{rows:4})});const T=o.filter(r=>r.inboxStatus==="unread");return T.length===0?e.jsx(P,{icon:be,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:u,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:s.size===T.length?t("automation.deselect_all"):t("automation.select_all")}),s.size>0&&e.jsxs("button",{onClick:k,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(R,{className:"h-3 w-3"}),t("automation.mark_all_read")," (",s.size,")"]})]}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:T.map(r=>e.jsxs("div",{className:`flex items-center gap-3 border-b border-[var(--border)] px-4 py-3 transition-colors last:border-b-0 ${s.has(r.id)?"bg-[var(--accent)]/5":"hover:bg-[var(--bg-input)]/60"}`,children:[e.jsx(O,{checked:s.has(r.id),onCheckedChange:()=>c(r.id),"aria-label":r.automationName?`${r.automationName} #${r.id}`:t("automation.run_label",{id:r.id,automationId:r.automationId}),containerClassName:"shrink-0"}),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/${r.id}`),children:[e.jsx("span",{className:"truncate text-xs text-[var(--text-primary)] hover:text-[var(--accent)] transition-colors",children:r.automationName?`${r.automationName} #${r.id}`:t("automation.run_label",{id:r.id,automationId:r.automationId})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[r.projectKey&&e.jsx("span",{className:"rounded-[4px] border border-[var(--border)] px-1.5 py-0.5 text-[10px] text-[var(--text-muted)]",children:r.projectKey}),e.jsx(z,{type:r.triggerType}),r.taskStatus&&e.jsx(se,{status:r.taskStatus}),r.workerName&&e.jsx("span",{className:"text-[10px] text-[var(--text-muted)]",children:r.workerName}),C(r)>0&&e.jsx("span",{className:"text-[10px] text-[var(--text-muted)]",children:C(r)!==1?t("automation.findings_count",{count:C(r)}):t("automation.finding_count",{count:C(r)})}),C(r)>0&&(()=>{const w=new Set(y(r).map(h=>h.severity));return Array.from(w).map(h=>e.jsx(fe,{severity:h},h))})()]})]}),e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:H(r.createdAt)}),e.jsx("button",{onClick:()=>m(r.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(R,{className:"h-3.5 w-3.5"})}),e.jsx("button",{onClick:()=>_(r.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(he,{className:"h-3.5 w-3.5"})})]},r.id))})]})}function _e(){const a=$(),{t}=K(),{automations:o,loading:n,fetchAutomations:d,enableAutomation:b,disableAutomation:x}=M();l.useEffect(()=>{d()},[d]);const v=async s=>{try{s.enabled?(await x(s.id),p.success(t("automation.automation_disabled"))):(await b(s.id),p.success(t("automation.automation_enabled")))}catch{p.error(t("automation.failed_toggle"))}};return n&&o.length===0?e.jsx("div",{className:"p-4",children:e.jsx(I,{rows:4})}):o.length===0?e.jsx(P,{icon:X,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(s=>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/${s.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:s.name}),e.jsx("span",{className:`h-2 w-2 shrink-0 rounded-full ${s.enabled?"bg-[var(--accent)]":"bg-[var(--text-muted)]"}`})]}),s.description&&e.jsx("p",{className:"mt-1 truncate text-[11px] text-[var(--text-muted)]",children:s.description}),e.jsxs("p",{className:"mt-1 text-[10px] text-[var(--text-muted)]",children:[t("automation.project"),": ",ye(s.projectKeys,s.projectKey)]})]}),e.jsx("button",{type:"button",onClick:f=>{f.stopPropagation(),v(s)},"aria-pressed":s.enabled,className:`relative h-5 w-9 shrink-0 cursor-pointer rounded-full transition-colors focus:outline-none ${s.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 ${s.enabled?"translate-x-4":"translate-x-0"}`})})]}),e.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[e.jsx(z,{type:s.triggerType}),e.jsx(V,{mode:s.executionMode})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-3 text-[10px] text-[var(--text-muted)]",children:[s.lastRunAt&&e.jsx("span",{children:t("automation.last_run",{time:H(s.lastRunAt)})}),s.nextRunAt&&e.jsx("span",{children:t("automation.next_run",{time:oe(s.nextRunAt)})}),!s.lastRunAt&&!s.nextRunAt&&e.jsx("span",{children:t("automation.no_runs_yet")})]})]},s.id))})}const B={status_reports:{titleKey:"automation.template_category_status_reports",descriptionKey:"automation.template_category_status_reports_description",icon:ee,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:R,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:J,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:ge,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:ve,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:q,order:99,iconClass:"border-[var(--border)] bg-[var(--bg-input)] text-[var(--text-muted)]"}},Ne={standup_summary:0,weekly_engineering_summary:1,weekly_release_notes:2,daily_bug_scan:3},ke=[{label:"claude",value:"claude"},{label:"cursor",value:"cursor"},{label:"codex",value:"codex"},{label:"pi",value:"pi"}];function S(a){return B[a??""]??B.other}function we(a){const t=S(a.category);return{Icon:t.icon,iconClass:t.iconClass}}function U(a){const t=a.builtinKey!=null?Ne[a.builtinKey]??50:50,o=S(a.category).order,n=a.isBuiltin?0:20,d=a.executionMode==="readonly"?0:2;return t+o*5+n+d}function D({template:a,onUse:t,emphasized:o=!1,sourceLabel:n,actionLabel:d}){const{Icon:b,iconClass:x}=we(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(b,{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:n})]}),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(pe,{className:"h-3.5 w-3.5 transition-transform group-hover:translate-x-0.5"})]})]})}function Ce(a){const t=a.trim().split(/\s+/);return t.length===5||t.length===6}function Te({template:a,onClose:t,onCreated:o}){const{t:n}=K(),{createAutomation:d}=M(),[b,x]=l.useState([]),[v,s]=l.useState([]),[f,N]=l.useState(""),[c,u]=l.useState("UTC"),[m,_]=l.useState("claude"),[k,y]=l.useState(!0),[C,T]=l.useState(!1),[r,w]=l.useState(!1),[h,L]=l.useState(!1);if(te(!!a),l.useEffect(()=>{if(!a)return;const i=a.triggerConfig??{},g=a.taskConfig??{};s([]),N(typeof i.cron=="string"?i.cron:""),u(typeof i.timezone=="string"?i.timezone:"UTC"),_(typeof g.agentType=="string"?g.agentType:"claude"),y(!0),T(!1),w(!0);let j=!1;return ae.get("web/projects").json().then(A=>{j||(x(A),A.length===1&&(s([A[0].key]),_(A[0].agentType)))}).catch(()=>{j||p.error(n("automation.failed_load_projects"))}).finally(()=>{j||w(!1)}),()=>{j=!0}},[a,n]),l.useEffect(()=>{if(!a)return;const i=g=>{g.key==="Escape"&&!h&&t()};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[a,t,h]),!a)return null;const Y=i=>{if(s(i),C)return;const g=b.find(j=>j.key===i[0]);g&&_(g.agentType)},G=i=>{_(i),T(!0)},W=async()=>{if(v.length===0){p.error(n("automation.project_required"));return}let i=a.triggerConfig??{};if(a.triggerType==="cron"){if(!f.trim()){p.error(n("automation.cron_expression_required"));return}if(!Ce(f)){p.error(n("automation.cron_expression_invalid"));return}i={...i,cron:f.trim(),timezone:c}}else if(a.triggerType==="task_event"){const g=typeof i.filter=="object"&&i.filter!==null&&!Array.isArray(i.filter)?i.filter:{},{projectKey:j,...A}=g;i={...i,filter:{...A,...v.length===1?{projectKey:v[0]}:{}}}}L(!0);try{const g=a.taskConfig??{},j=await d({projectKey:v[0],projectKeys:v,name:a.name,description:a.taskDescription,triggerType:a.triggerType,triggerConfig:i,executionMode:a.executionMode,notifyProjectChats:k,taskConfig:{...g,agentType:m},templateId:a.id});p.success(n("automation.automation_created")),t(),o(j.id)}catch(g){const j=g instanceof Error?g.message:n("automation.failed_create");p.error(j)}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:i=>i.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:n("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":n("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(re,{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:n("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:n("automation.project")}),e.jsx(ie,{values:v,onChange:Y,options:b.map(i=>({value:i.key,label:`${i.name} (${i.key})`})),placeholder:n(r?"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:n("automation.schedule")}),e.jsx("input",{type:"text",value:f,onChange:i=>N(i.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:n("automation.timezone")}),e.jsx(ne,{value:c,onChange:u,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:n("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:n("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:n("automation.agent_type")}),e.jsx("div",{className:"flex gap-2",children:ke.map(i=>e.jsx("button",{type:"button",onClick:()=>G(i.value),className:`flex-1 rounded-[4px] border px-3 py-2 text-xs transition-colors ${m===i.value?"border-[var(--accent)] bg-[var(--accent)]/5 text-[var(--accent)]":"border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:i.label},i.value))})]}),e.jsxs("div",{children:[e.jsx(O,{checked:k,onCheckedChange:y,label:n("automation.notify_project_chats")}),e.jsx("p",{className:"mt-1 pl-6 text-[10px] text-[var(--text-muted)]",children:n("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:n("automation.cancel")}),e.jsx("button",{type:"button",onClick:W,disabled:h,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:n(h?"automation.creating":"automation.create_from_template")})]})]})]})})}function Ae(){const a=$(),{t}=K(),{templates:o,loading:n,fetchTemplates:d}=M(),[b,x]=l.useState(null);if(l.useEffect(()=>{d()},[d]),n&&o.length===0)return e.jsx("div",{className:"p-4",children:e.jsx(I,{rows:4})});if(o.length===0)return e.jsx(P,{icon:q,title:t("automation.no_templates"),description:t("automation.templates_description")});const v=o.reduce((c,u)=>{const m=u.category||"other";return c[m]||(c[m]=[]),c[m].push(u),c},{}),s=Object.entries(v).sort(([c],[u])=>S(c).order-S(u).order),f=[...o].sort((c,u)=>U(c)-U(u)).slice(0,Math.min(4,o.length)),N=c=>{const u=o.find(m=>m.id===c)??null;x(u)};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:f.map(c=>e.jsx(D,{template:c,emphasized:!0,onUse:N,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:s.map(([c,u])=>{const m=S(c),_=m.icon,k=`automation-template-category-${c}`;return e.jsxs("button",{type:"button","aria-label":t(m.titleKey),onClick:()=>{var y;(y=document.getElementById(k))==null||y.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(_,{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:u.length})]},`nav-${c}`)})})]}),e.jsx("div",{className:"space-y-6",children:s.map(([c,u])=>{const m=S(c),_=m.icon,k=`automation-template-category-${c}`;return e.jsxs("section",{id:k,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(_,{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:u.map(y=>e.jsx(D,{template:y,onUse:N,sourceLabel:y.isBuiltin?t("automation.template_source_builtin"):t("automation.template_source_custom"),actionLabel:t("automation.use_template")},y.id))})]},c)})})]}),e.jsx(Te,{template:b,onClose:()=>x(null),onCreated:c=>a(`/automations/${c}`)})]})}function Ye(){const a=$(),{t}=K(),[o,n]=l.useState("inbox"),d=M(x=>x.inboxUnreadCount);l.useEffect(()=>{M.getState().fetchInboxCount()},[]),Z(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(le,{className:"h-3.5 w-3.5"}),t("automation.new_automation")]}),[a,t]));const b=[{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:b.map(x=>e.jsxs("button",{onClick:()=>n(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(je,{}),o==="automations"&&e.jsx(_e,{}),o==="templates"&&e.jsx(Ae,{})]})}export{Ye as default};
@@ -1,4 +1,4 @@
1
- import{c as k,f as E,a as I,B as A,r as c,k as C,p as R,h as f,j as t,Y as u,V as _}from"./index-J1zWTACN.js";import{E as h}from"./EmptyState-IvQHEoph.js";import{T as P}from"./Skeleton-Crpru9Ol.js";import{b as D,c as S,f as T}from"./date-CmcdoD87.js";import{e as L}from"./automationFindings-DfyQvLZV.js";import{C as $}from"./clock-BwsbKSS6.js";import{A as G}from"./arrow-left-sGTyHBvX.js";import{E as q}from"./external-link-FhyMbjzB.js";import{C as U}from"./circle-alert-rHCTliEW.js";/**
1
+ import{c as k,f as E,a as I,B as A,r as c,k as C,p as R,h as f,j as t,Z as u,Y as _}from"./index-Dh1GMLID.js";import{E as h}from"./EmptyState-CMDagsi4.js";import{T as P}from"./Skeleton-DaeQHyTP.js";import{b as D,c as S,f as T}from"./date-CmcdoD87.js";import{e as L}from"./automationFindings-DfyQvLZV.js";import{C as $}from"./clock-BbJkwoCd.js";import{A as G}from"./arrow-left-BL1QzlAp.js";import{E as q}from"./external-link-CEkNn2LX.js";import{C as U}from"./circle-alert-DkW4_zyQ.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{a as u,F as h,f as g,r as s,h as v,j as e}from"./index-J1zWTACN.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-Dh1GMLID.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 +1 @@
1
- import{j as e}from"./index-J1zWTACN.js";function t(){return e.jsxs("div",{className:"mx-auto max-w-4xl px-4 md:px-6 py-8 font-mono lowercase",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// bot integration"}),e.jsx("p",{className:"mt-2 text-xs text-[var(--text-muted)]",children:"advanced bot integration topics — interactive cards, troubleshooting, and the adapter pattern. for initial bot setup (lark, slack), see the bot setup guide."})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-4",children:[e.jsx("h2",{className:"text-sm text-[var(--accent)]",children:"> interactive cards"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"when a pipeline reaches a stage that requires user input, the bot sends an interactive card. there are three card modes:"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs text-[var(--text-primary)]",children:"confirm mode"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"sent when a stage needs explicit approval before proceeding. the card shows a summary of what will happen and two buttons:"}),e.jsxs("ul",{className:"space-y-1 text-xs text-[var(--text-secondary)] pl-4",children:[e.jsxs("li",{children:["- ",e.jsx("span",{className:"text-[var(--accent)]",children:"confirm"})," — advance the pipeline to the next stage"]}),e.jsxs("li",{children:["- ",e.jsx("span",{className:"text-[var(--accent)]",children:"reject"})," — skip or abort the current stage (you can also cancel the entire task with ",e.jsx("code",{className:"text-[var(--accent)]",children:"cancel #id"}),")"]})]}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"example: a deploy stage waiting for human sign-off before pushing to production. the bot updates the card in-place after the user responds, replacing the buttons with the outcome."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs text-[var(--text-primary)]",children:"choice mode"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"sent when the pipeline branches and the user must pick one of several options. each option is rendered as a button. the selected option determines which branch the pipeline follows."}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"example: choosing a deploy target (staging / production / canary) mid-pipeline."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs text-[var(--text-primary)]",children:"input mode"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"sent when the pipeline needs free-form text input from the user. the bot sends a card with a link to the web dashboard where the user submits their input. the submitted value is injected into the pipeline context as a variable."}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"example: providing a hotfix version number or a rollback reason."})]})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--accent)]",children:"> card lifecycle"}),e.jsxs("div",{className:"space-y-2 text-xs text-[var(--text-secondary)]",children:[e.jsx("p",{children:"1. bot sends the card when the stage starts"}),e.jsx("p",{children:"2. card remains active until a user responds or the stage times out (default: 10 minutes)"}),e.jsx("p",{children:"3. on response, the bot updates the card to show the result and the pipeline continues"}),e.jsx("p",{children:"4. if the stage times out, the card is updated with a timeout message and the pipeline follows the timeout path (fail or fallback)"})]}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"only users with the appropriate project role can interact with cards. unauthorized clicks return an ephemeral error."})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--accent)]",children:"> notification routing"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"when a task progresses through its lifecycle, the bot sends notifications to relevant parties. routing depends on who created the task and who is assigned to execute it."}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"completion and failure notifications stay with the executor dm plus the original source chat or creator fallback. overlord does not fan these lifecycle notifications out to every chat bound to the project."}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("th",{className:"py-2 pr-4 text-left text-[var(--text-muted)]",children:"event"}),e.jsx("th",{className:"py-2 pr-4 text-left text-[var(--text-muted)]",children:"method"}),e.jsx("th",{className:"py-2 pr-4 text-left text-[var(--text-muted)]",children:"executor"}),e.jsx("th",{className:"py-2 pr-4 text-left text-[var(--text-muted)]",children:"creator (if ≠)"})]})}),e.jsxs("tbody",{className:"text-[var(--text-secondary)]",children:[e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"assigned"}),e.jsx("td",{className:"py-2 pr-4",children:"card update"}),e.jsx("td",{className:"py-2 pr-4",children:"yes (dm)"}),e.jsx("td",{className:"py-2 pr-4",children:"—"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"running"}),e.jsx("td",{className:"py-2 pr-4",children:"card update"}),e.jsx("td",{className:"py-2 pr-4",children:"yes (dm)"}),e.jsx("td",{className:"py-2 pr-4",children:"—"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"stage_changed"}),e.jsx("td",{className:"py-2 pr-4",children:"card update"}),e.jsx("td",{className:"py-2 pr-4",children:"yes (dm)"}),e.jsx("td",{className:"py-2 pr-4",children:"—"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"completed"}),e.jsx("td",{className:"py-2 pr-4",children:"new message"}),e.jsx("td",{className:"py-2 pr-4",children:"yes (dm)"}),e.jsx("td",{className:"py-2 pr-4",children:"yes (source chat)"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"failed"}),e.jsx("td",{className:"py-2 pr-4",children:"new message"}),e.jsx("td",{className:"py-2 pr-4",children:"yes (dm)"}),e.jsx("td",{className:"py-2 pr-4",children:"yes (source chat)"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"cancelled"}),e.jsx("td",{className:"py-2 pr-4",children:"new message"}),e.jsx("td",{className:"py-2 pr-4",children:"yes (dm)"}),e.jsx("td",{className:"py-2 pr-4",children:"—"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"suspended"}),e.jsx("td",{className:"py-2 pr-4",children:"dm"}),e.jsx("td",{className:"py-2 pr-4",children:"yes (dm)"}),e.jsx("td",{className:"py-2 pr-4",children:"—"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"resumed"}),e.jsx("td",{className:"py-2 pr-4",children:"card update"}),e.jsx("td",{className:"py-2 pr-4",children:"yes (dm)"}),e.jsx("td",{className:"py-2 pr-4",children:"—"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"stage_confirm_required"}),e.jsx("td",{className:"py-2 pr-4",children:"new dm"}),e.jsx("td",{className:"py-2 pr-4",children:"yes (dm only)"}),e.jsx("td",{className:"py-2 pr-4",children:"—"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"review_round_complete"}),e.jsx("td",{className:"py-2 pr-4",children:"new message"}),e.jsx("td",{className:"py-2 pr-4",children:"yes (source chat or dm)"}),e.jsx("td",{className:"py-2 pr-4",children:"yes (source chat)"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"automation_run_completed"}),e.jsx("td",{className:"py-2 pr-4",children:"new message (card, text fallback)"}),e.jsx("td",{className:"py-2 pr-4",children:"yes (dm, if linked)"}),e.jsx("td",{className:"py-2 pr-4",children:"notify-default project chats"})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"py-2 pr-4",children:"automation_run_failed"}),e.jsx("td",{className:"py-2 pr-4",children:"new message (card, text fallback)"}),e.jsx("td",{className:"py-2 pr-4",children:"yes (dm, if linked)"}),e.jsx("td",{className:"py-2 pr-4",children:"notify-default project chats"})]})]})]})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs text-[var(--text-primary)]",children:"automation tasks"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"automation-spawned tasks do not emit regular task lifecycle notifications (created, assigned, running, completed, failed). instead, when an automation run finishes, the executor receives a text-only dm with findings (if their platform account is linked), and each bot's notify-default chat for that project also receives the summary when notifyprojectchats is enabled."}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["command routing and automation routing are separate. ",e.jsx("code",{className:"text-[var(--accent)]",children:"default"})," decides which project a chat uses for bot commands; ",e.jsx("code",{className:"text-[var(--accent)]",children:"notify default"})," decides which chat receives automation summaries for a project."]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs text-[var(--text-primary)]",children:"creator = executor"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"intermediate updates (assigned, running, stage changes) update the original task card in-place. important events (completed, failed, cancelled, suspended) send a new message in the same source chat. stage confirmation requests are always sent as a dm."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs text-[var(--text-primary)]",children:"creator ≠ executor"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"when a task is assigned to another developer via @mention, the executor receives all notifications via dm. the creator receives completed, failed, and review_round_complete notifications in the source chat, or in-app if no source chat exists. stage confirmations go exclusively to the executor."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs text-[var(--text-primary)]",children:"stage confirmation via commands"}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["in addition to card buttons, users can type ",e.jsx("code",{className:"text-[var(--accent)]",children:"confirm #id"})," or ",e.jsx("code",{className:"text-[var(--accent)]",children:"reject #id"}),". when replying directly to the bot's confirmation dm, the task id can be omitted — the bot infers it from the parent message."]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs text-[var(--text-primary)]",children:"stage confirmation timeout"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"if the executor does not respond to a stage confirmation within 10 minutes, the task is automatically marked as failed with a timeout error."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs text-[var(--text-primary)]",children:"web-created tasks"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"tasks created via the web dashboard also receive DM notifications if the developer has linked their Lark or Slack account. both in-app (bell icon) and platform DM notifications are delivered."})]}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"if the target developer has not linked their platform account, notifications fall back to the web dashboard's in-app notification system."})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--accent)]",children:"> plan and review commands"}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["in addition to ",e.jsx("span",{className:"text-[var(--accent)]",children:"develop"})," and ",e.jsx("span",{className:"text-[var(--accent)]",children:"fork"}),", the bot supports two higher-level commands:"]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h3",{className:"text-xs text-[var(--text-primary)]",children:"plan"}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["starts an interactive planning session where an ai agent reads the project codebase, discusses requirements with you, and produces a spec document saved to the project repository. use ",e.jsx("span",{className:"text-[var(--accent)]",children:"--project KEY"})," to specify the target project."]}),e.jsx("code",{className:"block text-xs text-[var(--text-secondary)] bg-[var(--bg-primary)] rounded-[4px] px-3 py-2",children:'@bot plan "implement user authentication system" --project WEB'})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("h3",{className:"text-xs text-[var(--text-primary)]",children:"review"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"triggers cross-model code review on a completed develop task. each specified agent runs a parallel review task and produces a structured report. only completed develop tasks can be reviewed."}),e.jsx("code",{className:"block text-xs text-[var(--text-secondary)] bg-[var(--bg-primary)] rounded-[4px] px-3 py-2",children:"@bot review #42 --agent codex,cursor"})]})]})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--accent)]",children:"> troubleshooting"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"common issues when running bots in production:"}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("th",{className:"py-2 pr-4 text-left text-[var(--text-muted)]",children:"symptom"}),e.jsx("th",{className:"py-2 pr-4 text-left text-[var(--text-muted)]",children:"cause"}),e.jsx("th",{className:"py-2 text-left text-[var(--text-muted)]",children:"fix"})]})}),e.jsxs("tbody",{className:"text-[var(--text-secondary)]",children:[e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"bot doesn't respond to mentions"}),e.jsx("td",{className:"py-2 pr-4",children:"webhook url not reachable"}),e.jsx("td",{className:"py-2",children:"verify the url is publicly accessible and returns 200 to the platform's verification challenge"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"401 on webhook"}),e.jsx("td",{className:"py-2 pr-4",children:"wrong verification token / signing secret"}),e.jsx("td",{className:"py-2",children:"check webhooktoken matches the platform's verification token (lark) or signing secret (slack)"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"commands work but no cards"}),e.jsx("td",{className:"py-2 pr-4",children:"missing card event subscription"}),e.jsx("td",{className:"py-2",children:"lark: set callback configuration request url to your webhook url. slack: enable interactivity and set the interact url"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"user not found error"}),e.jsx("td",{className:"py-2 pr-4",children:"developer account not linked"}),e.jsx("td",{className:"py-2",children:"set platform_uid on the developer record to their platform user id"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"bot responds in wrong project"}),e.jsx("td",{className:"py-2 pr-4",children:"chat group bound to wrong project"}),e.jsx("td",{className:"py-2",children:"update the binding via admin - bot management or the bindings api"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"automation summary sent to the wrong room"}),e.jsx("td",{className:"py-2 pr-4",children:"notify-default chat set on another binding"}),e.jsx("td",{className:"py-2",children:"switch the project's notify default in admin - bot management"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"duplicate messages"}),e.jsx("td",{className:"py-2 pr-4",children:"multiple bot instances handling same event"}),e.jsx("td",{className:"py-2",children:"ensure only one overlord instance processes webhooks, or use the built-in dedup"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"card buttons do nothing"}),e.jsx("td",{className:"py-2 pr-4",children:"interact url misconfigured"}),e.jsx("td",{className:"py-2",children:"slack: check interactivity request url. lark: check card action callback url"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"/overlord slash command 404"}),e.jsx("td",{className:"py-2 pr-4",children:"command url wrong"}),e.jsx("td",{className:"py-2",children:"verify the slash command request url matches your-server/webhook/slack/commands"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"bot stops responding after deploy"}),e.jsx("td",{className:"py-2 pr-4",children:"webhook url changed"}),e.jsx("td",{className:"py-2",children:"update the request url in the platform's app settings to match the new server address"})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"py-2 pr-4",children:"lark quote/reply content missing"}),e.jsx("td",{className:"py-2 pr-4",children:"missing im:message:readonly permission"}),e.jsx("td",{className:"py-2",children:"add im:message:readonly scope in the lark app's permissions settings and publish a new version"})]})]})]})})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--accent)]",children:"> adapter pattern"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"the bot system uses an adapter pattern internally. each platform (lark, slack, discord) implements an adapter interface:"}),e.jsxs("div",{className:"space-y-1 text-xs text-[var(--text-secondary)]",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("code",{className:"shrink-0 text-[var(--accent)]",children:"handleWebhook(req)"}),e.jsx("span",{children:"— receive platform events, verify signatures, parse into commands"})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("code",{className:"shrink-0 text-[var(--accent)]",children:"sendMessage(chatId, content)"}),e.jsx("span",{children:"— send messages (text or cards)"})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("code",{className:"shrink-0 text-[var(--accent)]",children:"updateMessage(msgId, content)"}),e.jsx("span",{children:"— update existing messages (progress updates)"})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("code",{className:"shrink-0 text-[var(--accent)]",children:"resolveUser(platformUid)"}),e.jsx("span",{children:"— map platform user id to overlord developer"})]})]}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"to add a custom platform adapter, implement the interface and register it in the bot service config. see the lark and slack adapters in the codebase for reference."})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--accent)]",children:"> multi-bot architecture"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"overlord supports multiple bot instances across different platforms simultaneously. each project or group can have its own bot. all bots share the same overlord backend."}),e.jsxs("div",{className:"space-y-2 text-xs text-[var(--text-secondary)]",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-[var(--accent)]",children:"lark"})," — single webhook url (/webhook/lark), bot identified by app_id in the request payload"]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[var(--accent)]",children:"slack"})," — separate endpoints for events, interactivity, and commands (/webhook/slack/events, /webhook/slack/interact, /webhook/slack/commands), bot identified by app_id in the request headers"]})]}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"you can run multiple bots on the same platform (e.g., one slack bot per team) by registering each with a unique app id. a discord adapter is planned for a future release."})]})]})]})}export{t as default};
1
+ import{j as e}from"./index-Dh1GMLID.js";function t(){return e.jsxs("div",{className:"mx-auto max-w-4xl px-4 md:px-6 py-8 font-mono lowercase",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// bot integration"}),e.jsx("p",{className:"mt-2 text-xs text-[var(--text-muted)]",children:"advanced bot integration topics — interactive cards, troubleshooting, and the adapter pattern. for initial bot setup (lark, slack), see the bot setup guide."})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-4",children:[e.jsx("h2",{className:"text-sm text-[var(--accent)]",children:"> interactive cards"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"when a pipeline reaches a stage that requires user input, the bot sends an interactive card. there are three card modes:"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs text-[var(--text-primary)]",children:"confirm mode"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"sent when a stage needs explicit approval before proceeding. the card shows a summary of what will happen and two buttons:"}),e.jsxs("ul",{className:"space-y-1 text-xs text-[var(--text-secondary)] pl-4",children:[e.jsxs("li",{children:["- ",e.jsx("span",{className:"text-[var(--accent)]",children:"confirm"})," — advance the pipeline to the next stage"]}),e.jsxs("li",{children:["- ",e.jsx("span",{className:"text-[var(--accent)]",children:"reject"})," — skip or abort the current stage (you can also cancel the entire task with ",e.jsx("code",{className:"text-[var(--accent)]",children:"cancel #id"}),")"]})]}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"example: a deploy stage waiting for human sign-off before pushing to production. the bot updates the card in-place after the user responds, replacing the buttons with the outcome."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs text-[var(--text-primary)]",children:"choice mode"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"sent when the pipeline branches and the user must pick one of several options. each option is rendered as a button. the selected option determines which branch the pipeline follows."}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"example: choosing a deploy target (staging / production / canary) mid-pipeline."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs text-[var(--text-primary)]",children:"input mode"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"sent when the pipeline needs free-form text input from the user. the bot sends a card with a link to the web dashboard where the user submits their input. the submitted value is injected into the pipeline context as a variable."}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"example: providing a hotfix version number or a rollback reason."})]})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--accent)]",children:"> card lifecycle"}),e.jsxs("div",{className:"space-y-2 text-xs text-[var(--text-secondary)]",children:[e.jsx("p",{children:"1. bot sends the card when the stage starts"}),e.jsx("p",{children:"2. card remains active until a user responds or the stage times out (default: 10 minutes)"}),e.jsx("p",{children:"3. on response, the bot updates the card to show the result and the pipeline continues"}),e.jsx("p",{children:"4. if the stage times out, the card is updated with a timeout message and the pipeline follows the timeout path (fail or fallback)"})]}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"only users with the appropriate project role can interact with cards. unauthorized clicks return an ephemeral error."})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--accent)]",children:"> notification routing"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"when a task progresses through its lifecycle, the bot sends notifications to relevant parties. routing depends on who created the task and who is assigned to execute it."}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"completion and failure notifications stay with the executor dm plus the original source chat or creator fallback. overlord does not fan these lifecycle notifications out to every chat bound to the project."}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("th",{className:"py-2 pr-4 text-left text-[var(--text-muted)]",children:"event"}),e.jsx("th",{className:"py-2 pr-4 text-left text-[var(--text-muted)]",children:"method"}),e.jsx("th",{className:"py-2 pr-4 text-left text-[var(--text-muted)]",children:"executor"}),e.jsx("th",{className:"py-2 pr-4 text-left text-[var(--text-muted)]",children:"creator (if ≠)"})]})}),e.jsxs("tbody",{className:"text-[var(--text-secondary)]",children:[e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"assigned"}),e.jsx("td",{className:"py-2 pr-4",children:"card update"}),e.jsx("td",{className:"py-2 pr-4",children:"yes (dm)"}),e.jsx("td",{className:"py-2 pr-4",children:"—"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"running"}),e.jsx("td",{className:"py-2 pr-4",children:"card update"}),e.jsx("td",{className:"py-2 pr-4",children:"yes (dm)"}),e.jsx("td",{className:"py-2 pr-4",children:"—"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"stage_changed"}),e.jsx("td",{className:"py-2 pr-4",children:"card update"}),e.jsx("td",{className:"py-2 pr-4",children:"yes (dm)"}),e.jsx("td",{className:"py-2 pr-4",children:"—"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"completed"}),e.jsx("td",{className:"py-2 pr-4",children:"new message"}),e.jsx("td",{className:"py-2 pr-4",children:"yes (dm)"}),e.jsx("td",{className:"py-2 pr-4",children:"yes (source chat)"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"failed"}),e.jsx("td",{className:"py-2 pr-4",children:"new message"}),e.jsx("td",{className:"py-2 pr-4",children:"yes (dm)"}),e.jsx("td",{className:"py-2 pr-4",children:"yes (source chat)"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"cancelled"}),e.jsx("td",{className:"py-2 pr-4",children:"new message"}),e.jsx("td",{className:"py-2 pr-4",children:"yes (dm)"}),e.jsx("td",{className:"py-2 pr-4",children:"—"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"suspended"}),e.jsx("td",{className:"py-2 pr-4",children:"dm"}),e.jsx("td",{className:"py-2 pr-4",children:"yes (dm)"}),e.jsx("td",{className:"py-2 pr-4",children:"—"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"resumed"}),e.jsx("td",{className:"py-2 pr-4",children:"card update"}),e.jsx("td",{className:"py-2 pr-4",children:"yes (dm)"}),e.jsx("td",{className:"py-2 pr-4",children:"—"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"stage_confirm_required"}),e.jsx("td",{className:"py-2 pr-4",children:"new dm"}),e.jsx("td",{className:"py-2 pr-4",children:"yes (dm only)"}),e.jsx("td",{className:"py-2 pr-4",children:"—"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"review_round_complete"}),e.jsx("td",{className:"py-2 pr-4",children:"new message"}),e.jsx("td",{className:"py-2 pr-4",children:"yes (source chat or dm)"}),e.jsx("td",{className:"py-2 pr-4",children:"yes (source chat)"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"automation_run_completed"}),e.jsx("td",{className:"py-2 pr-4",children:"new message (card, text fallback)"}),e.jsx("td",{className:"py-2 pr-4",children:"yes (dm, if linked)"}),e.jsx("td",{className:"py-2 pr-4",children:"notify-default project chats"})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"py-2 pr-4",children:"automation_run_failed"}),e.jsx("td",{className:"py-2 pr-4",children:"new message (card, text fallback)"}),e.jsx("td",{className:"py-2 pr-4",children:"yes (dm, if linked)"}),e.jsx("td",{className:"py-2 pr-4",children:"notify-default project chats"})]})]})]})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs text-[var(--text-primary)]",children:"automation tasks"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"automation-spawned tasks do not emit regular task lifecycle notifications (created, assigned, running, completed, failed). instead, when an automation run finishes, the executor receives a text-only dm with findings (if their platform account is linked), and each bot's notify-default chat for that project also receives the summary when notifyprojectchats is enabled."}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["command routing and automation routing are separate. ",e.jsx("code",{className:"text-[var(--accent)]",children:"default"})," decides which project a chat uses for bot commands; ",e.jsx("code",{className:"text-[var(--accent)]",children:"notify default"})," decides which chat receives automation summaries for a project."]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs text-[var(--text-primary)]",children:"creator = executor"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"intermediate updates (assigned, running, stage changes) update the original task card in-place. important events (completed, failed, cancelled, suspended) send a new message in the same source chat. stage confirmation requests are always sent as a dm."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs text-[var(--text-primary)]",children:"creator ≠ executor"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"when a task is assigned to another developer via @mention, the executor receives all notifications via dm. the creator receives completed, failed, and review_round_complete notifications in the source chat, or in-app if no source chat exists. stage confirmations go exclusively to the executor."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs text-[var(--text-primary)]",children:"stage confirmation via commands"}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["in addition to card buttons, users can type ",e.jsx("code",{className:"text-[var(--accent)]",children:"confirm #id"})," or ",e.jsx("code",{className:"text-[var(--accent)]",children:"reject #id"}),". when replying directly to the bot's confirmation dm, the task id can be omitted — the bot infers it from the parent message."]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs text-[var(--text-primary)]",children:"stage confirmation timeout"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"if the executor does not respond to a stage confirmation within 10 minutes, the task is automatically marked as failed with a timeout error."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs text-[var(--text-primary)]",children:"web-created tasks"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"tasks created via the web dashboard also receive DM notifications if the developer has linked their Lark or Slack account. both in-app (bell icon) and platform DM notifications are delivered."})]}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"if the target developer has not linked their platform account, notifications fall back to the web dashboard's in-app notification system."})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--accent)]",children:"> plan and review commands"}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["in addition to ",e.jsx("span",{className:"text-[var(--accent)]",children:"develop"})," and ",e.jsx("span",{className:"text-[var(--accent)]",children:"fork"}),", the bot supports two higher-level commands:"]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h3",{className:"text-xs text-[var(--text-primary)]",children:"plan"}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["starts an interactive planning session where an ai agent reads the project codebase, discusses requirements with you, and produces a spec document saved to the project repository. use ",e.jsx("span",{className:"text-[var(--accent)]",children:"--project KEY"})," to specify the target project."]}),e.jsx("code",{className:"block text-xs text-[var(--text-secondary)] bg-[var(--bg-primary)] rounded-[4px] px-3 py-2",children:'@bot plan "implement user authentication system" --project WEB'})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("h3",{className:"text-xs text-[var(--text-primary)]",children:"review"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"triggers cross-model code review on a completed develop task. each specified agent runs a parallel review task and produces a structured report. only completed develop tasks can be reviewed."}),e.jsx("code",{className:"block text-xs text-[var(--text-secondary)] bg-[var(--bg-primary)] rounded-[4px] px-3 py-2",children:"@bot review #42 --agent codex,cursor"})]})]})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--accent)]",children:"> troubleshooting"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"common issues when running bots in production:"}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("th",{className:"py-2 pr-4 text-left text-[var(--text-muted)]",children:"symptom"}),e.jsx("th",{className:"py-2 pr-4 text-left text-[var(--text-muted)]",children:"cause"}),e.jsx("th",{className:"py-2 text-left text-[var(--text-muted)]",children:"fix"})]})}),e.jsxs("tbody",{className:"text-[var(--text-secondary)]",children:[e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"bot doesn't respond to mentions"}),e.jsx("td",{className:"py-2 pr-4",children:"webhook url not reachable"}),e.jsx("td",{className:"py-2",children:"verify the url is publicly accessible and returns 200 to the platform's verification challenge"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"401 on webhook"}),e.jsx("td",{className:"py-2 pr-4",children:"wrong verification token / signing secret"}),e.jsx("td",{className:"py-2",children:"check webhooktoken matches the platform's verification token (lark) or signing secret (slack)"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"commands work but no cards"}),e.jsx("td",{className:"py-2 pr-4",children:"missing card event subscription"}),e.jsx("td",{className:"py-2",children:"lark: set callback configuration request url to your webhook url. slack: enable interactivity and set the interact url"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"user not found error"}),e.jsx("td",{className:"py-2 pr-4",children:"developer account not linked"}),e.jsx("td",{className:"py-2",children:"set platform_uid on the developer record to their platform user id"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"bot responds in wrong project"}),e.jsx("td",{className:"py-2 pr-4",children:"chat group bound to wrong project"}),e.jsx("td",{className:"py-2",children:"update the binding via admin - bot management or the bindings api"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"automation summary sent to the wrong room"}),e.jsx("td",{className:"py-2 pr-4",children:"notify-default chat set on another binding"}),e.jsx("td",{className:"py-2",children:"switch the project's notify default in admin - bot management"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"duplicate messages"}),e.jsx("td",{className:"py-2 pr-4",children:"multiple bot instances handling same event"}),e.jsx("td",{className:"py-2",children:"ensure only one overlord instance processes webhooks, or use the built-in dedup"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"card buttons do nothing"}),e.jsx("td",{className:"py-2 pr-4",children:"interact url misconfigured"}),e.jsx("td",{className:"py-2",children:"slack: check interactivity request url. lark: check card action callback url"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"/overlord slash command 404"}),e.jsx("td",{className:"py-2 pr-4",children:"command url wrong"}),e.jsx("td",{className:"py-2",children:"verify the slash command request url matches your-server/webhook/slack/commands"})]}),e.jsxs("tr",{className:"border-b border-[var(--border)]",children:[e.jsx("td",{className:"py-2 pr-4",children:"bot stops responding after deploy"}),e.jsx("td",{className:"py-2 pr-4",children:"webhook url changed"}),e.jsx("td",{className:"py-2",children:"update the request url in the platform's app settings to match the new server address"})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"py-2 pr-4",children:"lark quote/reply content missing"}),e.jsx("td",{className:"py-2 pr-4",children:"missing im:message:readonly permission"}),e.jsx("td",{className:"py-2",children:"add im:message:readonly scope in the lark app's permissions settings and publish a new version"})]})]})]})})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--accent)]",children:"> adapter pattern"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"the bot system uses an adapter pattern internally. each platform (lark, slack, discord) implements an adapter interface:"}),e.jsxs("div",{className:"space-y-1 text-xs text-[var(--text-secondary)]",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("code",{className:"shrink-0 text-[var(--accent)]",children:"handleWebhook(req)"}),e.jsx("span",{children:"— receive platform events, verify signatures, parse into commands"})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("code",{className:"shrink-0 text-[var(--accent)]",children:"sendMessage(chatId, content)"}),e.jsx("span",{children:"— send messages (text or cards)"})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("code",{className:"shrink-0 text-[var(--accent)]",children:"updateMessage(msgId, content)"}),e.jsx("span",{children:"— update existing messages (progress updates)"})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("code",{className:"shrink-0 text-[var(--accent)]",children:"resolveUser(platformUid)"}),e.jsx("span",{children:"— map platform user id to overlord developer"})]})]}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"to add a custom platform adapter, implement the interface and register it in the bot service config. see the lark and slack adapters in the codebase for reference."})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("h2",{className:"text-sm text-[var(--accent)]",children:"> multi-bot architecture"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"overlord supports multiple bot instances across different platforms simultaneously. each project or group can have its own bot. all bots share the same overlord backend."}),e.jsxs("div",{className:"space-y-2 text-xs text-[var(--text-secondary)]",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-[var(--accent)]",children:"lark"})," — single webhook url (/webhook/lark), bot identified by app_id in the request payload"]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[var(--accent)]",children:"slack"})," — separate endpoints for events, interactivity, and commands (/webhook/slack/events, /webhook/slack/interact, /webhook/slack/commands), bot identified by app_id in the request headers"]})]}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"you can run multiple bots on the same platform (e.g., one slack bot per team) by registering each with a unique app id. a discord adapter is planned for a future release."})]})]})]})}export{t as default};
@@ -0,0 +1 @@
1
+ import{a as K,v as F,r as o,j as e,X as M,h as j,s as R,t as U}from"./index-Dh1GMLID.js";import{S as q}from"./Select-LGk_EawR.js";import{C as V}from"./DocsPrimitives-D7h19aXG.js";import{T as z}from"./trash-2-CaIOqYj_.js";import{P as W}from"./plus-Cn46sPb9.js";import{E as X}from"./EmptyState-CMDagsi4.js";import{T as L}from"./Skeleton-DaeQHyTP.js";import{u as P}from"./useFetch-CJMNf1mK.js";import{d as T}from"./status-colors-DC-m2CdG.js";import{B as H}from"./bot-D-zp4qz4.js";import{P as J}from"./pencil-ZFPPMxtk.js";import{L as O}from"./link-2-BBq5JW-o.js";import"./chevron-down-BOgq_PNA.js";import"./copy-BBOWX6ou.js";const Q=[{value:"lark",label:"lark_(feishu)"},{value:"slack",label:"slack"}];function Y({isOpen:r,onClose:v,onCreated:I,editBot:h,onEditClose:s}){const{t:a}=K(),m=!!h;F(r);const[A,g]=o.useState(""),[i,b]=o.useState("lark"),[k,y]=o.useState(""),[p,w]=o.useState(""),[u,C]=o.useState(""),[$,D]=o.useState(!1),[S,x]=o.useState("");o.useEffect(()=>{r&&(h?(g(h.name),b(h.platform),y(h.appId),w(""),C("")):(g(""),b("lark"),y(""),w(""),C("")),D(!1),x(""))},[h,r]);function N(){m&&s?s():v()}async function f(){if(x(""),!A.trim()||!k.trim()){x(a("admin.name_and_app_id_required"));return}if(m){if(i==="slack"&&p.trim()&&!p.trim().startsWith("xoxb-")){x(a("admin.invalid_bot_token"));return}}else{if(!p.trim()){x(a("admin.app_secret_required"));return}if(i==="slack"){if(!p.trim().startsWith("xoxb-")){x(a("admin.invalid_bot_token"));return}if(!u.trim()){x(a("admin.signing_secret_required"));return}}}const c={name:A.trim(),platform:i,appId:k.trim()};p.trim()&&(c.appSecret=p.trim()),u.trim()&&(c.webhookToken=u.trim());try{D(!0),m?await j.put(`admin/bots/${h.id}`,{json:c}).json():await j.post("admin/bots",{json:c}).json(),N(),I()}catch(n){const l=n instanceof Error?n.message:a(m?"admin.failed_to_update_bot":"admin.failed_to_create_bot");x(l)}finally{D(!1)}}if(!r)return null;const t=window.location.origin,d=[{label:a("admin.webhook_events_url"),url:`${t}/webhook/slack/events`,hint:a("admin.slack_events_hint")},{label:a("admin.webhook_interact_url"),url:`${t}/webhook/slack/interact`,hint:a("admin.slack_interact_hint")},{label:a("admin.webhook_commands_url"),url:`${t}/webhook/slack/commands`,hint:a("admin.slack_commands_hint")}],B=[{label:a("admin.webhook_request_url"),url:`${t}/webhook/lark`,hint:a("admin.webhook_config_hint_lark")}],_=i==="slack"?d:B;return e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backdropFilter:"blur(2px)"},children:[e.jsx("div",{className:"fixed inset-0 bg-[var(--modal-backdrop)]"}),e.jsxs("div",{className:"relative z-10 w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] font-mono",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 py-4",children:[e.jsx("h3",{className:"text-sm text-[var(--text-primary)]",children:m?`// ${a("admin.edit_bot")}`:`// ${a("admin.create_bot")}`}),e.jsx("button",{type:"button",className:"rounded-[4px] p-1 text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",onClick:N,children:e.jsx(M,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"space-y-4 px-5 py-5",children:[S&&e.jsx("div",{className:"rounded-[4px] border border-red-500/30 bg-red-500/10 px-3 py-2 text-xs text-red-400",children:S}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:a("admin.bot_name")}),e.jsx("input",{type:"text",placeholder:"e.g. overlord lark bot",value:A,onChange:c=>g(c.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:a("admin.platform")}),e.jsx(q,{value:i,onChange:b,options:Q,disabled:m})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-3",children:[e.jsx("div",{className:"mb-2 text-xs text-[var(--text-muted)]",children:a("admin.webhook_config")}),e.jsx("div",{className:"text-xs text-[var(--text-muted)] mb-3",children:a(i==="slack"?"admin.webhook_config_hint_slack":"admin.webhook_config_hint_lark")}),e.jsx("div",{className:"space-y-2",children:_.map(c=>e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-[var(--text-muted)] mb-1",children:c.label}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("code",{className:"flex-1 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-2 py-1 text-xs text-[var(--text-primary)] select-all overflow-x-auto",children:c.url}),e.jsx(V,{text:c.url})]}),e.jsx("div",{className:"mt-0.5 text-xs text-[var(--text-muted)]",children:c.hint})]},c.label))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:a("admin.app_id")}),e.jsx("div",{className:"mb-1 text-xs text-[var(--text-muted)]",children:a(i==="slack"?"admin.app_id_hint_slack":"admin.app_id_hint_lark")}),e.jsx("input",{type:"text",placeholder:"platform application id",value:k,onChange:c=>y(c.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)]"})]}),i==="slack"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:a(m?"admin.bot_token_keep_current":"admin.bot_token")}),e.jsx("div",{className:"mb-1 text-xs text-[var(--text-muted)]",children:a("admin.bot_token_hint")}),e.jsx("input",{type:"password",placeholder:a("admin.bot_token_placeholder"),value:p,onChange:c=>w(c.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:a(m?"admin.signing_secret_keep_current":"admin.signing_secret")}),e.jsx("div",{className:"mb-1 text-xs text-[var(--text-muted)]",children:a("admin.signing_secret_hint")}),e.jsx("input",{type:"password",placeholder:a("admin.signing_secret_placeholder"),value:u,onChange:c=>C(c.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)]"})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:a(m?"admin.app_secret_keep_current":"admin.app_secret")}),e.jsx("div",{className:"mb-1 text-xs text-[var(--text-muted)]",children:a("admin.app_secret_hint_lark")}),e.jsx("input",{type:"password",placeholder:"platform application secret",value:p,onChange:c=>w(c.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:a(m?"admin.encrypt_key_keep_current":"admin.encrypt_key")}),e.jsx("div",{className:"mb-1 text-xs text-[var(--text-muted)]",children:a("admin.encrypt_key_hint")}),e.jsx("input",{type:"password",placeholder:a("admin.encrypt_key_placeholder"),value:u,onChange:c=>C(c.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)]"})]})]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-[var(--border)] px-5 py-4",children:[e.jsx("button",{type:"button",className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",onClick:N,children:a("common.cancel")}),e.jsx("button",{type:"button",className:"rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",disabled:$,onClick:f,children:a($?m?"common.saving":"common.creating":m?"common.save_changes":"common.create")})]})]})]})}function Z({isOpen:r,bot:v,onClose:I,onUpdated:h}){const{t:s}=K();F(r);const[a,m]=o.useState([]),[A,g]=o.useState([]),[i,b]=o.useState(!1),[k,y]=o.useState(!1),[p,w]=o.useState(""),[u,C]=o.useState(""),[$,D]=o.useState(""),[S,x]=o.useState(""),N=a.reduce((n,l)=>{const E=n.find(G=>G.platformChatId===l.platformChatId);return E?(E.bindings.push(l),!E.chatName&&l.chatName&&(E.chatName=l.chatName),n):(n.push({platformChatId:l.platformChatId,chatName:l.chatName,bindings:[l]}),n)},[]),f=o.useCallback(async()=>{try{const n=await j.get(`admin/bots/${v.id}/bindings`).json();m(n)}catch{}},[v.id]);o.useEffect(()=>{r&&f()},[r,f]);const t=o.useCallback(async()=>{try{const n=await j.get("web/projects").json();g(n)}catch{}},[]);o.useEffect(()=>{r&&t()},[r,t]);const d=async()=>{if(x(""),!p.trim()||!u.trim()||!$){x(s("admin.chat_binding_all_fields_required"));return}try{b(!0),await j.post(`admin/bots/${v.id}/bindings`,{json:{platformChatId:p.trim(),chatName:u.trim(),projectKey:$}}).json(),w(""),C(""),D(""),y(!1),await f(),h()}catch(n){const l=n instanceof Error?n.message:s("admin.failed_to_add_binding");x(l)}finally{b(!1)}},B=async n=>{try{await j.delete(`admin/bots/${v.id}/bindings`,{json:{platformChatId:n.platformChatId,projectKey:n.projectKey}}),await f(),h()}catch{x(s("admin.failed_to_delete_binding"))}},_=async n=>{try{b(!0),x(""),await j.put(`admin/bots/${v.id}/bindings/default`,{json:{platformChatId:n.platformChatId,projectKey:n.projectKey}}).json(),await f(),h()}catch(l){const E=l instanceof Error?l.message:s("admin.chat_binding_set_default_failed");x(E)}finally{b(!1)}},c=async n=>{try{b(!0),x(""),await j.put(`admin/bots/${v.id}/bindings/notification-default`,{json:{platformChatId:n.platformChatId,projectKey:n.projectKey}}).json(),await f(),h()}catch(l){const E=l instanceof Error?l.message:s("admin.chat_binding_set_notify_default_failed");x(E)}finally{b(!1)}};return r?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backdropFilter:"blur(2px)"},children:[e.jsx("div",{className:"fixed inset-0 bg-[var(--modal-backdrop)]"}),e.jsxs("div",{className:"relative z-10 w-full max-w-[600px] max-h-[85vh] flex flex-col rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] font-mono",children:[e.jsxs("div",{className:"shrink-0 flex items-center justify-between border-b border-[var(--border)] px-5 py-4",children:[e.jsx("h3",{className:"text-sm text-[var(--text-primary)]",children:s("admin.chat_binding_title",{name:v.name})}),e.jsx("button",{type:"button",className:"rounded-[4px] p-1 text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",onClick:I,children:e.jsx(M,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"overflow-y-auto min-h-0 px-5 py-5",children:[S&&e.jsx("div",{className:"mb-4 rounded-[4px] border border-red-500/30 bg-red-500/10 px-3 py-2 text-xs text-red-400",children:S}),a.length===0&&!k?e.jsx("p",{className:"py-4 text-center text-xs text-[var(--text-muted)]",children:s("admin.chat_binding_no_bindings")}):e.jsx("div",{className:"space-y-3",children:N.map(n=>e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] p-4",children:[e.jsxs("div",{className:"mb-3 flex flex-wrap items-center justify-between gap-2 border-b border-[var(--border)] pb-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-[var(--text-primary)]",children:n.chatName||"-"}),e.jsx("div",{className:"text-[11px] text-[var(--text-muted)]",children:n.platformChatId})]}),e.jsxs("div",{className:"text-[11px] text-[var(--text-muted)]",children:[s("admin.chat_binding_projects"),": ",n.bindings.length]})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] text-left text-[var(--text-muted)]",children:[e.jsx("th",{className:"pb-2 pr-4 font-normal",children:s("admin.project")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:s("admin.chat_binding_default_project")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:s("admin.chat_binding_notify_group")}),e.jsx("th",{className:"pb-2 font-normal",children:s("common.actions")})]})}),e.jsx("tbody",{children:n.bindings.map(l=>e.jsxs("tr",{className:"border-b border-[var(--border-row)] last:border-b-0 hover:bg-white/[0.02] transition-colors",children:[e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:l.projectKey??"-"}),e.jsx("td",{className:"py-2.5 pr-4",children:l.isDefault?e.jsx("span",{className:"rounded-[4px] border border-[var(--accent)] px-2 py-0.5 text-[11px] text-[var(--accent)]",children:s("admin.chat_binding_default_badge")}):e.jsx("button",{type:"button",className:"rounded-[4px] border border-[var(--border)] px-2 py-1 text-[11px] text-[var(--text-secondary)] hover:border-[var(--accent)] hover:text-[var(--text-primary)] transition-colors",disabled:i||!l.projectKey,onClick:()=>_(l),children:s("admin.chat_binding_set_default")})}),e.jsx("td",{className:"py-2.5 pr-4",children:l.notifyDefault?e.jsx("span",{className:"rounded-[4px] border border-[var(--accent)] px-2 py-0.5 text-[11px] text-[var(--accent)]",children:s("admin.chat_binding_notify_default_badge")}):e.jsx("button",{type:"button",className:"rounded-[4px] border border-[var(--border)] px-2 py-1 text-[11px] text-[var(--text-secondary)] hover:border-[var(--accent)] hover:text-[var(--text-primary)] transition-colors",disabled:i||!l.projectKey,onClick:()=>c(l),children:s("admin.chat_binding_set_notify_default")})}),e.jsx("td",{className:"py-2.5",children:e.jsx("button",{type:"button",className:"rounded-[4px] p-1.5 text-red-400 hover:text-red-300 hover:bg-white/[0.05] transition-colors",onClick:()=>B(l),children:e.jsx(z,{className:"h-3.5 w-3.5"})})})]},l.id))})]})})]},n.platformChatId))}),k&&e.jsxs("div",{className:"mt-4 space-y-3 rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] p-4",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:s("admin.chat_binding_add")}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:s("admin.chat_id")}),e.jsx("input",{type:"text",placeholder:s("admin.chat_binding_id_placeholder"),value:p,onChange:n=>w(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)] placeholder:text-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:s("admin.chat_name")}),e.jsx("input",{type:"text",placeholder:s("admin.chat_binding_name_placeholder"),value:u,onChange:n=>C(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)] placeholder:text-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:s("admin.project")}),e.jsx(q,{value:$,onChange:D,options:A.map(n=>({value:n.key,label:`${n.name} (${n.key})`})),placeholder:s("admin.chat_binding_select_project")})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{type:"button",className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",onClick:()=>y(!1),children:s("common.cancel")}),e.jsx("button",{type:"button","data-testid":"submit-binding",className:"rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",disabled:i,onClick:d,children:s(i?"admin.chat_binding_adding":"admin.add_binding")})]})]})]}),e.jsxs("div",{className:"shrink-0 flex items-center justify-between border-t border-[var(--border)] px-5 py-4",children:[e.jsx("div",{children:!k&&e.jsxs("button",{type:"button",className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:border-[var(--accent)] transition-colors",onClick:()=>y(!0),children:[e.jsx(W,{className:"h-3.5 w-3.5"}),s("admin.add_binding")]})}),e.jsx("button",{type:"button",className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",onClick:I,children:s("common.close")})]})]})]}):null}function he(){const{t:r}=K(),[v,I]=o.useState(!1),[h,s]=o.useState(null),[a,m]=o.useState(null),[A,g]=o.useState(!1),[i,b]=o.useState(null),[k,y]=o.useState(!1),{data:p,loading:w,refetch:u}=P(()=>j.get("admin/bots").json(),[]),{data:C,loading:$,refetch:D}=P(()=>j.get("admin/bots/all-bindings").json(),[]),S=(C??[]).reduce((t,d)=>{const B=`${d.botInstanceId}:${d.platformChatId}`,_=t.find(c=>c.key===B);return _?(_.bindings.push(d),!_.chatName&&d.chatName&&(_.chatName=d.chatName),d.createdAt<_.createdAt&&(_.createdAt=d.createdAt),t):(t.push({key:B,botName:d.botName,platform:d.platform,platformChatId:d.platformChatId,chatName:d.chatName,createdAt:d.createdAt,bindings:[d]}),t)},[]);async function x(){if(i){y(!0);try{await j.delete(`admin/bots/${i.id}`),g(!1),b(null),u()}catch{U.error(r("admin.failed_to_delete_bot"))}finally{y(!1)}}}function N(t){switch(t){case"lark":return"text-blue-400";case"slack":return"text-yellow-400";default:return"text-[var(--text-secondary)]"}}function f(t){return e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{type:"button",className:"rounded-[4px] p-2.5 md:p-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-white/[0.05] transition-colors",title:r("common.edit"),onClick:()=>s(t),children:e.jsx(J,{className:"h-3.5 w-3.5"})}),e.jsx("button",{type:"button",className:"rounded-[4px] p-2.5 md:p-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-white/[0.05] transition-colors",title:r("admin.chat_bindings"),onClick:()=>m(t),children:e.jsx(O,{className:"h-3.5 w-3.5"})}),e.jsx("button",{type:"button",className:"rounded-[4px] p-2.5 md:p-1.5 text-red-400 hover:text-red-300 hover:bg-white/[0.05] transition-colors",title:r("common.delete"),onClick:()=>{b(t),g(!0)},children:e.jsx(z,{className:"h-3.5 w-3.5"})})]})}return e.jsxs("div",{className:"font-mono",children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:r("admin.bots_title")}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("admin.bots_subtitle")})]}),e.jsxs("button",{type:"button",className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity",onClick:()=>{s(null),I(!0)},children:[e.jsx(W,{className:"h-3.5 w-3.5"}),r("admin.create_bot")]})]}),w?e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsx(L,{rows:3})}):!p||p.length===0?e.jsx(X,{icon:H,title:r("admin.no_bots_configured"),description:r("admin.add_bot_desc"),actionLabel:r("admin.create_bot"),onAction:()=>{s(null),I(!0)}}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden md:block overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] text-left text-[var(--text-muted)]",children:[e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.bot_name")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.platform")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.app_id")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.status")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("common.created_at")}),e.jsx("th",{className:"pb-2 font-normal",children:r("common.actions")})]})}),e.jsx("tbody",{children:p.map(t=>e.jsxs("tr",{className:"border-b border-[var(--border-row)] hover:bg-white/[0.02] transition-colors",children:[e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-primary)]",children:t.name}),e.jsx("td",{className:"py-2.5 pr-4",children:e.jsx("span",{className:N(t.platform),children:t.platform})}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:t.appId}),e.jsx("td",{className:"py-2.5 pr-4",children:e.jsx("span",{className:T(t.status),children:t.status})}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-muted)]",children:new Date(t.createdAt).toLocaleDateString()}),e.jsx("td",{className:"py-2.5",children:f(t)})]},t.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3",children:p.map(t=>e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-[var(--text-primary)] font-medium",children:t.name}),f(t)]}),e.jsxs("div",{className:"flex items-center gap-3 text-[11px]",children:[e.jsx("span",{className:N(t.platform),children:t.platform}),e.jsx("span",{className:T(t.status),children:t.status})]}),e.jsx("div",{className:"mt-1 text-[11px] text-[var(--text-secondary)] truncate",children:t.appId})]},t.id))})]}),e.jsx(Y,{isOpen:v||!!h,onClose:()=>{I(!1),s(null)},onCreated:u,editBot:h,onEditClose:()=>s(null)}),a&&e.jsx(Z,{isOpen:!!a,bot:a,onClose:()=>m(null),onUpdated:()=>{u(),D()}}),e.jsx(R,{isOpen:A,onClose:()=>{g(!1),b(null)},onConfirm:x,title:r("admin.delete_bot"),message:r("admin.delete_bot_confirm",{name:(i==null?void 0:i.name)??""}),confirmLabel:r("common.delete"),confirmVariant:"danger",isLoading:k}),e.jsxs("div",{className:"mt-8",children:[e.jsxs("h2",{className:"mb-4 text-sm text-[var(--text-primary)]",children:[r("admin.chat_bindings"),e.jsx("span",{className:"ml-2 text-[var(--text-muted)]",children:r("admin.chat_bindings_subtitle")})]}),$?e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsx(L,{rows:3})}):S.length===0?e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-8 text-center",children:e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("admin.no_chat_bindings")})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden md:block overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] text-left text-[var(--text-muted)]",children:[e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.bot")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.platform")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.chat_id")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.chat_name")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:r("admin.project")}),e.jsx("th",{className:"pb-2 font-normal",children:r("common.created_at")})]})}),e.jsx("tbody",{children:S.map(t=>e.jsxs("tr",{className:"border-b border-[var(--border-row)] hover:bg-white/[0.02] transition-colors",children:[e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-primary)]",children:t.botName}),e.jsx("td",{className:"py-2.5 pr-4",children:e.jsx("span",{className:N(t.platform),children:t.platform})}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:t.platformChatId}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:t.chatName??"-"}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:e.jsx("div",{className:"space-y-1",children:t.bindings.map(d=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:d.projectKey??"-"}),d.isDefault&&e.jsx("span",{className:"rounded-[4px] border border-[var(--accent)] px-1.5 py-0.5 text-[10px] text-[var(--accent)]",children:r("admin.chat_binding_default_badge")}),d.notifyDefault&&e.jsx("span",{className:"rounded-[4px] border border-[var(--border)] px-1.5 py-0.5 text-[10px] text-[var(--text-secondary)]",children:r("admin.chat_binding_notify_default_badge")})]},d.id))})}),e.jsx("td",{className:"py-2.5 text-[var(--text-muted)]",children:new Date(t.createdAt).toLocaleDateString()})]},t.key))})]})}),e.jsx("div",{className:"md:hidden space-y-3",children:S.map(t=>e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-xs text-[var(--text-primary)] font-medium",children:t.botName}),e.jsx("span",{className:`text-[11px] ${N(t.platform)}`,children:t.platform})]}),e.jsx("div",{className:"text-[11px] text-[var(--text-secondary)] truncate",children:t.platformChatId}),e.jsx("div",{className:"mt-1 text-[11px] text-[var(--text-muted)]",children:t.chatName??"-"}),e.jsx("div",{className:"mt-2 space-y-1 text-[11px] text-[var(--text-muted)]",children:t.bindings.map(d=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:d.projectKey??"-"}),d.isDefault&&e.jsx("span",{className:"rounded-[4px] border border-[var(--accent)] px-1.5 py-0.5 text-[10px] text-[var(--accent)]",children:r("admin.chat_binding_default_badge")}),d.notifyDefault&&e.jsx("span",{className:"rounded-[4px] border border-[var(--border)] px-1.5 py-0.5 text-[10px] text-[var(--text-secondary)]",children:r("admin.chat_binding_notify_default_badge")})]},d.id))})]},t.key))})]})]})]})}export{he as default};
@@ -1,4 +1,4 @@
1
- import{j as e}from"./index-J1zWTACN.js";import{a as t}from"./DocsPrimitives-BhxcRaTm.js";import"./copy-h1a805Rd.js";const c=[{command:"develop",alias:"dev",example:'@bot develop "fix login bug" --project WEB',description:"create a new task"},{command:"develop",alias:"dev",example:'@bot develop "fix login bug" --agent cursor',description:"create a task with specific agent"},{command:"develop",alias:"dev",example:'@bot develop "fix login bug" --type fix --branch fix-login',description:"specify task type and branch slug"},{command:"develop",alias:"dev",example:'@bot develop "deploy" --on worker-1',description:"create a task on a specific worker"},{command:"show",alias:"progress / logs / workspace / ws",example:"@bot show #42",description:"view task details"},{command:"cancel",alias:"",example:"@bot cancel #42",description:"cancel a running task"},{command:"retry",alias:"",example:"@bot retry #42",description:"retry a failed/cancelled task"},{command:"fork",alias:"",example:"@bot fork #42",description:"fork a completed/failed/cancelled task"},{command:"fork",alias:"",example:"@bot fork #42 --agent codex",description:"fork with a different agent"},{command:"fork",alias:"",example:'@bot fork #42 "extra detail"',description:"fork and append extra detail to the original description"},{command:"fork",alias:"",example:'@bot fork #42 "new desc" --replace',description:"fork and replace the original description"},{command:"list",alias:"ls",example:"@bot list --project WEB",description:"list recent tasks"},{command:"confirm",alias:"",example:"@bot confirm #42",description:"confirm a pending stage"},{command:"projects",alias:"proj",example:"@bot projects",description:"list your projects"},{command:"status",alias:"",example:"@bot status",description:"show cluster status"},{command:"workers",alias:"",example:"@bot workers",description:"list all workers (admin only)"},{command:"search",alias:"",example:"@bot search login",description:"search tasks, workers, projects"},{command:"bind",alias:"",example:"@bot bind",description:"link your chat account to your overlord account"},{command:"info",alias:"",example:"@bot info",description:"show chat id, user id, and link status"},{command:"help",alias:"",example:"@bot help",description:"show available commands"}];function o(){return e.jsx("div",{className:"mx-auto max-w-4xl px-4 md:px-6 py-8 font-mono lowercase",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// overview"}),e.jsxs("p",{className:"mt-2 text-xs text-[var(--text-muted)]",children:["overlord supports creating tasks via chat bots. users can ",e.jsx("code",{className:"text-[var(--accent)]",children:'@bot develop "fix the login bug"'})," in a group chat, and overlord dispatches the task automatically. notifications are sent back through the same channel."]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// lark setup"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-xs text-[var(--accent)]",children:"> 1. create a lark app"}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["on ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:"lark open platform"})," (open.larksuite.com) → custom app:"]}),e.jsxs("ul",{className:"space-y-1 text-xs text-[var(--text-secondary)] list-none pl-0",children:[e.jsxs("li",{children:["— note the ",e.jsx("span",{className:"text-[var(--accent)]",children:"app id"})," and ",e.jsx("span",{className:"text-[var(--accent)]",children:"app secret"})]}),e.jsxs("li",{children:["— event subscriptions: ",e.jsx("code",{className:"text-[var(--accent)]",children:"im.message.receive_v1"})]}),e.jsxs("li",{children:["— event request url: ",e.jsx("code",{className:"text-[var(--text-secondary)]",children:"https://your-overlord-server.com/webhook/lark"})]}),e.jsxs("li",{children:["— callback configuration → request url: ",e.jsx("code",{className:"text-[var(--text-secondary)]",children:"https://your-overlord-server.com/webhook/lark"})]}),e.jsx("li",{children:"— enable bot capability"}),e.jsxs("li",{children:["— permissions: ",e.jsx("code",{className:"text-[var(--accent)]",children:"im:message.group_at_msg:readonly"}),", ",e.jsx("code",{className:"text-[var(--accent)]",children:"im:message.p2p_msg:readonly"}),", ",e.jsx("code",{className:"text-[var(--accent)]",children:"im:message:send_as_bot"})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-xs text-[var(--accent)]",children:"> 2. register in overlord"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"via admin → bot management → add bot, or via the api:"}),e.jsx(t,{code:`curl -X POST https://your-server:9000/api/admin/bots \\
1
+ import{j as e}from"./index-Dh1GMLID.js";import{a as t}from"./DocsPrimitives-D7h19aXG.js";import"./copy-BBOWX6ou.js";const c=[{command:"develop",alias:"dev",example:'@bot develop "fix login bug" --project WEB',description:"create a new task"},{command:"develop",alias:"dev",example:'@bot develop "fix login bug" --agent cursor',description:"create a task with specific agent"},{command:"develop",alias:"dev",example:'@bot develop "fix login bug" --type fix --branch fix-login',description:"specify task type and branch slug"},{command:"develop",alias:"dev",example:'@bot develop "deploy" --on worker-1',description:"create a task on a specific worker"},{command:"show",alias:"progress / logs / workspace / ws",example:"@bot show #42",description:"view task details"},{command:"cancel",alias:"",example:"@bot cancel #42",description:"cancel a running task"},{command:"retry",alias:"",example:"@bot retry #42",description:"retry a failed/cancelled task"},{command:"fork",alias:"",example:"@bot fork #42",description:"fork a completed/failed/cancelled task"},{command:"fork",alias:"",example:"@bot fork #42 --agent codex",description:"fork with a different agent"},{command:"fork",alias:"",example:'@bot fork #42 "extra detail"',description:"fork and append extra detail to the original description"},{command:"fork",alias:"",example:'@bot fork #42 "new desc" --replace',description:"fork and replace the original description"},{command:"list",alias:"ls",example:"@bot list --project WEB",description:"list recent tasks"},{command:"confirm",alias:"",example:"@bot confirm #42",description:"confirm a pending stage"},{command:"projects",alias:"proj",example:"@bot projects",description:"list your projects"},{command:"status",alias:"",example:"@bot status",description:"show cluster status"},{command:"workers",alias:"",example:"@bot workers",description:"list all workers (admin only)"},{command:"search",alias:"",example:"@bot search login",description:"search tasks, workers, projects"},{command:"bind",alias:"",example:"@bot bind",description:"link your chat account to your overlord account"},{command:"info",alias:"",example:"@bot info",description:"show chat id, user id, and link status"},{command:"help",alias:"",example:"@bot help",description:"show available commands"}];function o(){return e.jsx("div",{className:"mx-auto max-w-4xl px-4 md:px-6 py-8 font-mono lowercase",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// overview"}),e.jsxs("p",{className:"mt-2 text-xs text-[var(--text-muted)]",children:["overlord supports creating tasks via chat bots. users can ",e.jsx("code",{className:"text-[var(--accent)]",children:'@bot develop "fix the login bug"'})," in a group chat, and overlord dispatches the task automatically. notifications are sent back through the same channel."]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:"// lark setup"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-xs text-[var(--accent)]",children:"> 1. create a lark app"}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["on ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:"lark open platform"})," (open.larksuite.com) → custom app:"]}),e.jsxs("ul",{className:"space-y-1 text-xs text-[var(--text-secondary)] list-none pl-0",children:[e.jsxs("li",{children:["— note the ",e.jsx("span",{className:"text-[var(--accent)]",children:"app id"})," and ",e.jsx("span",{className:"text-[var(--accent)]",children:"app secret"})]}),e.jsxs("li",{children:["— event subscriptions: ",e.jsx("code",{className:"text-[var(--accent)]",children:"im.message.receive_v1"})]}),e.jsxs("li",{children:["— event request url: ",e.jsx("code",{className:"text-[var(--text-secondary)]",children:"https://your-overlord-server.com/webhook/lark"})]}),e.jsxs("li",{children:["— callback configuration → request url: ",e.jsx("code",{className:"text-[var(--text-secondary)]",children:"https://your-overlord-server.com/webhook/lark"})]}),e.jsx("li",{children:"— enable bot capability"}),e.jsxs("li",{children:["— permissions: ",e.jsx("code",{className:"text-[var(--accent)]",children:"im:message.group_at_msg:readonly"}),", ",e.jsx("code",{className:"text-[var(--accent)]",children:"im:message.p2p_msg:readonly"}),", ",e.jsx("code",{className:"text-[var(--accent)]",children:"im:message:send_as_bot"})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-xs text-[var(--accent)]",children:"> 2. register in overlord"}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"via admin → bot management → add bot, or via the api:"}),e.jsx(t,{code:`curl -X POST https://your-server:9000/api/admin/bots \\
2
2
  -H "Authorization: Bearer $TOKEN" \\
3
3
  -H "Content-Type: application/json" \\
4
4
  -d '{