adam-agent-server 1.13.0 → 1.15.0

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 (210) hide show
  1. package/README.md +4 -5
  2. package/dist/App-6TRGTNZ7.js +13 -0
  3. package/dist/approval-handler-YLO3V75T.js +1 -0
  4. package/dist/audit-diagnostics-MASYIEGZ.js +1 -0
  5. package/dist/audit-manager-LYBXP7U4.js +1 -0
  6. package/dist/bree-engine-AA7EVKTG.js +1 -0
  7. package/dist/{channels-WFC26TED.js → channels-2IL6USWL.js} +1 -1
  8. package/dist/channels-6BEGHNOK.js +1 -0
  9. package/dist/chat-tool-calls-KARPW7PE.js +1 -0
  10. package/dist/chunk-245WE5AF.js +1 -0
  11. package/dist/chunk-2N4EOZZ4.js +9 -0
  12. package/dist/chunk-3BRHWRZ5.js +2 -0
  13. package/dist/chunk-3KNR2F6H.js +3 -0
  14. package/dist/chunk-42V6ZPCS.js +5 -0
  15. package/dist/chunk-6NWIZ3BH.js +220 -0
  16. package/dist/chunk-APAOIZN4.js +114 -0
  17. package/dist/chunk-ASPPM7TQ.js +1 -0
  18. package/dist/chunk-BKNXRSJU.js +4 -0
  19. package/dist/{chunk-MRTJFYPR.js → chunk-BLCNUT53.js} +1 -1
  20. package/dist/chunk-BPXS4QEO.js +1006 -0
  21. package/dist/chunk-CLNYHWZ6.js +5 -0
  22. package/dist/chunk-D3SPXZZY.js +6 -0
  23. package/dist/{chunk-SWP2JC54.js → chunk-DRO3DG7X.js} +1 -1
  24. package/dist/chunk-EVUZ5LH2.js +1 -0
  25. package/dist/chunk-F6U5TMM3.js +5 -0
  26. package/dist/chunk-FD4IKMXV.js +1 -0
  27. package/dist/chunk-GXWB47NF.js +9 -0
  28. package/dist/{chunk-PXGK5H5C.js → chunk-I7LJ4432.js} +1 -1
  29. package/dist/chunk-ICAM2GUU.js +1 -0
  30. package/dist/{chunk-B44X7JAJ.js → chunk-IRUR4DVD.js} +1 -1
  31. package/dist/chunk-ISKCTUI7.js +9 -0
  32. package/dist/{chunk-7T4B2MZ7.js → chunk-J3VYLSJI.js} +1 -1
  33. package/dist/chunk-KJNAORKM.js +15 -0
  34. package/dist/chunk-L47LZYVG.js +21 -0
  35. package/dist/chunk-LU3D53ZV.js +34 -0
  36. package/dist/{chunk-YKYRNTPV.js → chunk-N2OLEUAQ.js} +1 -1
  37. package/dist/{chunk-PHT24MOV.js → chunk-NLTYJUQG.js} +1 -1
  38. package/dist/chunk-NNMQGISW.js +1 -0
  39. package/dist/chunk-NPGZRSGL.js +5 -0
  40. package/dist/chunk-NTVLV7NI.js +1 -0
  41. package/dist/chunk-NUJSTEV4.js +1 -0
  42. package/dist/{chunk-FUWPDXXG.js → chunk-NWGRLNUM.js} +1 -1
  43. package/dist/chunk-OQ3JOTPK.js +1 -0
  44. package/dist/chunk-RBJPQYV3.js +6 -0
  45. package/dist/chunk-SVUP3F4V.js +14 -0
  46. package/dist/chunk-TLMG5W3L.js +4 -0
  47. package/dist/chunk-TLP4ZMJB.js +19 -0
  48. package/dist/{chunk-WQFNB2MQ.js → chunk-TZCMK3UG.js} +6 -6
  49. package/dist/chunk-UFWMUBFH.js +25 -0
  50. package/dist/chunk-VKKDSXMR.js +1 -0
  51. package/dist/chunk-VNXTBIPI.js +31 -0
  52. package/dist/chunk-XF7YHFVR.js +15 -0
  53. package/dist/{chunk-X5V4VMET.js → chunk-XIVFVKMB.js} +2 -2
  54. package/dist/chunk-XYZVMTNN.js +1 -0
  55. package/dist/{chunk-Q2JQFDAK.js → chunk-XZEBYOFR.js} +3 -3
  56. package/dist/chunk-Z6LHGA27.js +1 -0
  57. package/dist/cli.js +10 -10
  58. package/dist/config-VHWLMFIN.js +1 -0
  59. package/dist/{config-GKVOAMY2.js → config-XO7TGH27.js} +1 -1
  60. package/dist/db-WCTOLFAZ.js +1 -0
  61. package/dist/delivery-log-ML4RJOBM.js +1 -0
  62. package/dist/dist-HCSYRPJU.js +1 -0
  63. package/dist/engine-XLH4VL6Y.js +1 -0
  64. package/dist/evolution-audit-HLU7LQL6.js +1 -0
  65. package/dist/execution-tools-SYP3GR6T.js +1 -0
  66. package/dist/{external-api-DOVGA3ML.js → external-api-YMEFVZGG.js} +1 -1
  67. package/dist/index.js +240 -36
  68. package/dist/learner-NJXX2RUL.js +1 -0
  69. package/dist/{logger-WEXZORHP.js → logger-PAMNFWI3.js} +1 -1
  70. package/dist/memories-JDTQM3UN.js +1 -0
  71. package/dist/memory-extractor-5PTMCSOX.js +1 -0
  72. package/dist/memory-gc-BCHTOSXK.js +1 -0
  73. package/dist/memory-service-66EMRJXO.js +1 -0
  74. package/dist/onnxruntime_binding-2BPLI7ZQ.node +0 -0
  75. package/dist/onnxruntime_binding-5J67DTMJ.node +0 -0
  76. package/dist/onnxruntime_binding-7ZZLEQ2F.node +0 -0
  77. package/dist/onnxruntime_binding-KDCXAPN5.node +0 -0
  78. package/dist/onnxruntime_binding-R73P2IQW.node +0 -0
  79. package/dist/outbound-gateway-3INYZDOR.js +1 -0
  80. package/dist/presets-DT3J2ON4.js +1 -0
  81. package/dist/reflection-job-ST4ANCGB.js +23 -0
  82. package/dist/role-presets-3IQKCSVQ.js +1 -0
  83. package/dist/role-workspace-SIHNI6HO.js +1 -0
  84. package/dist/roles-F6AEM6B5.js +1 -0
  85. package/dist/{runtime-QA2DCZYQ.js → runtime-TWLGJSL6.js} +1 -1
  86. package/dist/session-manager-JTQRJI7R.js +1 -0
  87. package/dist/skill-registry-4JT62GEF.js +1 -0
  88. package/dist/target-resolution-PSSBM4LX.js +1 -0
  89. package/dist/task-templates-6G46OVYT.js +1 -0
  90. package/dist/template-dispatch-2K7KV7YS.js +1 -0
  91. package/dist/template-execution-artifacts-NEPSVD2B.js +1 -0
  92. package/dist/trace-context-UR7DI5ME.js +1 -0
  93. package/package.json +34 -14
  94. package/web/dist/assets/{Button-VPwTNGpF.js → Button-fLMsJd5o.js} +1 -1
  95. package/web/dist/assets/{Card-C2N6k4gh.js → Card-cy-gHU0O.js} +1 -1
  96. package/web/dist/assets/{ChannelDetail-DktmpO0A.js → ChannelDetail-CsKBPHkT.js} +1 -1
  97. package/web/dist/assets/Channels-DMutLV9r.js +14 -0
  98. package/web/dist/assets/Chat-DWTs-iOw.js +2 -0
  99. package/web/dist/assets/Dashboard-CoatfhW8.js +1 -0
  100. package/web/dist/assets/{EmptyState-CWS9PJND.js → EmptyState-C5kVDHc7.js} +1 -1
  101. package/web/dist/assets/{EnvVarEditor-D0kGIBcl.js → EnvVarEditor-BvRsHayG.js} +1 -1
  102. package/web/dist/assets/{EventDefDetail-BiXTA6LF.js → EventDefDetail-zuJydp12.js} +1 -1
  103. package/web/dist/assets/Events-nCImjXyr.js +1 -0
  104. package/web/dist/assets/{Evolution-C884p_CE.js → Evolution-Br41g99g.js} +1 -1
  105. package/web/dist/assets/ExtensionDetail-BXlphIkn.js +1 -0
  106. package/web/dist/assets/Extensions-3lhbw0A2.js +1 -0
  107. package/web/dist/assets/{FeatureRequests-Ck0WQnXX.js → FeatureRequests-oaXQNu43.js} +1 -1
  108. package/web/dist/assets/{GoalDetail-DJOyf7By.js → GoalDetail-DRDg1JDv.js} +1 -1
  109. package/web/dist/assets/Goals-DGmKvtGA.js +1 -0
  110. package/web/dist/assets/{Logs-6r7fnBn7.js → Logs-BZKxhdnb.js} +1 -1
  111. package/web/dist/assets/{Memories-CvPaqv5r.js → Memories-DhJJk-KB.js} +1 -1
  112. package/web/dist/assets/{Mistakes-aUhkqHDC.js → Mistakes-DxThj9as.js} +1 -1
  113. package/web/dist/assets/{NotFound-R6tIzhL0.js → NotFound-buXr2gl7.js} +1 -1
  114. package/web/dist/assets/{PageHeader-D9lLjo0N.js → PageHeader-BgNbz3JV.js} +1 -1
  115. package/web/dist/assets/Plugins-BXrsGsXs.js +1 -0
  116. package/web/dist/assets/RoleDetail-rClUsHwS.js +35 -0
  117. package/web/dist/assets/Roles-DH9cRv8h.js +1 -0
  118. package/web/dist/assets/{SectionHeader-BB3H3F_P.js → SectionHeader-CwX6m1f6.js} +1 -1
  119. package/web/dist/assets/Settings-My2lOEWv.js +1 -0
  120. package/web/dist/assets/{Strategies-DUps-2I9.js → Strategies-YLMryJlG.js} +1 -1
  121. package/web/dist/assets/{Switch-B_R_EX9s.js → Switch-PNpjNoGn.js} +1 -1
  122. package/web/dist/assets/{Table-D4lT5uHx.js → Table-BrERwl-F.js} +1 -1
  123. package/web/dist/assets/{Tabs-CwzWpI-7.js → Tabs-CGHmpUAD.js} +1 -1
  124. package/web/dist/assets/TaskDetail-Bkaq0NwW.js +2 -0
  125. package/web/dist/assets/Work-4OcGMu_a.js +1 -0
  126. package/web/dist/assets/api-BkdixMz9.js +1 -0
  127. package/web/dist/assets/{es2015-DCW7LI8d.js → es2015-JqLIWAgH.js} +1 -1
  128. package/web/dist/assets/index-C-e-qpXc.js +12 -0
  129. package/web/dist/assets/index-DGTVc0qD.css +2 -0
  130. package/web/dist/assets/{useIsMobileLayout-D6Tz5o5h.js → useIsMobileLayout-Blj4Mk4K.js} +1 -1
  131. package/web/dist/assets/{usePluginsWithUsage-CSQr03vZ.js → usePluginsWithUsage-Ch9WCFTb.js} +1 -1
  132. package/web/dist/assets/vendor-icons-U4igmrUq.js +1 -0
  133. package/web/dist/assets/{vendor-react-CIkiuNDu.js → vendor-react-Bp_V-Hsf.js} +1 -1
  134. package/web/dist/assets/{vendor-state-CEOsUh-T.js → vendor-state-Zjl_6-V3.js} +1 -1
  135. package/web/dist/index.html +8 -8
  136. package/dist/App-5QZKMPRM.js +0 -13
  137. package/dist/adam-tools-SQD2V4RJ.js +0 -1
  138. package/dist/approval-handler-J6RUTICJ.js +0 -1
  139. package/dist/audit-manager-CWVHQAUI.js +0 -1
  140. package/dist/bree-engine-VGEYMVNP.js +0 -1
  141. package/dist/channels-OOIM62BX.js +0 -1
  142. package/dist/chunk-2BXTT4P2.js +0 -6
  143. package/dist/chunk-47COBMRF.js +0 -1
  144. package/dist/chunk-6JBSBSCL.js +0 -1
  145. package/dist/chunk-6WRZJVQ2.js +0 -1
  146. package/dist/chunk-7IFLU3CY.js +0 -4
  147. package/dist/chunk-AQO6IIHV.js +0 -684
  148. package/dist/chunk-AVM3O74V.js +0 -5
  149. package/dist/chunk-B544JOZM.js +0 -3
  150. package/dist/chunk-DZIEY4CH.js +0 -47
  151. package/dist/chunk-E4WIUUL4.js +0 -27
  152. package/dist/chunk-HDHMNT6D.js +0 -1
  153. package/dist/chunk-JYHOGBCP.js +0 -12
  154. package/dist/chunk-M3RZWIW3.js +0 -50
  155. package/dist/chunk-N4ES7TCL.js +0 -1
  156. package/dist/chunk-NPIXYK5G.js +0 -5
  157. package/dist/chunk-O7XQSONJ.js +0 -5
  158. package/dist/chunk-OZL6VNOR.js +0 -146
  159. package/dist/chunk-Q2ISNOBQ.js +0 -1
  160. package/dist/chunk-QYRI4HYA.js +0 -1
  161. package/dist/chunk-R2WB5BKF.js +0 -7
  162. package/dist/chunk-RMGBR3XZ.js +0 -21
  163. package/dist/chunk-S6OV7Z6K.js +0 -1
  164. package/dist/chunk-SC2DDRYB.js +0 -5
  165. package/dist/chunk-SGIKNIC5.js +0 -49
  166. package/dist/chunk-TI3AKKWZ.js +0 -80
  167. package/dist/chunk-U2LBBBWO.js +0 -8
  168. package/dist/chunk-UXDTFTG5.js +0 -10
  169. package/dist/chunk-Y5FFL6UO.js +0 -5
  170. package/dist/chunk-ZFDULJGB.js +0 -3
  171. package/dist/chunk-ZQ4PNKMQ.js +0 -10
  172. package/dist/config-DRFRLIVN.js +0 -1
  173. package/dist/db-FACSMWEY.js +0 -1
  174. package/dist/delivery-log-JIQMHBJ5.js +0 -1
  175. package/dist/dist-CDWBOTZS.js +0 -1
  176. package/dist/engine-OHYWUUMJ.js +0 -1
  177. package/dist/evolution-audit-M7FSYRQR.js +0 -1
  178. package/dist/learner-OUNQSWN7.js +0 -1
  179. package/dist/memories-ABE7PMQL.js +0 -1
  180. package/dist/memory-extractor-ZX2NJIBV.js +0 -6
  181. package/dist/memory-service-UWER3T2S.js +0 -1
  182. package/dist/onnxruntime_binding-6Q6HXASN.node +0 -0
  183. package/dist/onnxruntime_binding-EKZT2NRK.node +0 -0
  184. package/dist/onnxruntime_binding-P6S7V3CI.node +0 -0
  185. package/dist/onnxruntime_binding-PJNNIIUO.node +0 -0
  186. package/dist/onnxruntime_binding-UN6SPTQK.node +0 -0
  187. package/dist/outbound-gateway-XDCGAXXW.js +0 -1
  188. package/dist/presets-RMW3WO5P.js +0 -1
  189. package/dist/role-presets-FAXQRBII.js +0 -1
  190. package/dist/role-workspace-ISGPO25D.js +0 -1
  191. package/dist/roles-WNKRM6FD.js +0 -1
  192. package/dist/session-manager-SOJXQHHY.js +0 -1
  193. package/dist/task-templates-IS3DJCZB.js +0 -1
  194. package/dist/token-estimator-HMPVGDCN.js +0 -1
  195. package/dist/workflow-executor-LOMKVFPV.js +0 -1
  196. package/web/dist/assets/Channels-ozCXdZMq.js +0 -12
  197. package/web/dist/assets/Chat-CggvtidD.js +0 -2
  198. package/web/dist/assets/Dashboard-z37ZVhzH.js +0 -1
  199. package/web/dist/assets/Events-C4P3jjZd.js +0 -1
  200. package/web/dist/assets/Goals-CDZWDuXR.js +0 -1
  201. package/web/dist/assets/Plugins-CtwoMUoj.js +0 -1
  202. package/web/dist/assets/RoleDetail-B32225ae.js +0 -33
  203. package/web/dist/assets/Roles-CGYsxuq8.js +0 -1
  204. package/web/dist/assets/Settings-D2jrO8-G.js +0 -1
  205. package/web/dist/assets/TaskDetail-DKminIM_.js +0 -2
  206. package/web/dist/assets/Work-uD_6IieV.js +0 -1
  207. package/web/dist/assets/api-D-UzHSDq.js +0 -1
  208. package/web/dist/assets/index-6f2jcj0h.css +0 -2
  209. package/web/dist/assets/index-Bl-2p6d8.js +0 -12
  210. package/web/dist/assets/vendor-icons-jzPiR6xl.js +0 -1
@@ -1,12 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{C as t,E as n,O as r,S as i,b as a,lt as o,n as s,s as c,w as l}from"./vendor-icons-jzPiR6xl.js";import{t as u}from"./vendor-react-CIkiuNDu.js";import{t as d}from"./Button-VPwTNGpF.js";import{t as f}from"./api-D-UzHSDq.js";import{t as p}from"./index-Bl-2p6d8.js";import{i as m,r as h,t as g}from"./Card-C2N6k4gh.js";import{t as _}from"./PageHeader-D9lLjo0N.js";import{t as v}from"./SectionHeader-BB3H3F_P.js";import{t as y}from"./EmptyState-CWS9PJND.js";import{t as b}from"./ui-CerQw0jA.js";var x=e(o(),1),S=u(),C=[`telegram`,`slack`,`discord`,`openclaw`,`wechat`,`whatsapp`],w={telegram:`{
2
- "botToken": ""
3
- }`,slack:`{
4
- "botToken": "",
5
- "signingSecret": ""
6
- }`,discord:`{
7
- "botToken": ""
8
- }`,openclaw:`{
9
- "gatewayUrl": "ws://127.0.0.1:18789"
10
- }`,wechat:`{
11
- "baseUrl": "https://ilinkai.weixin.qq.com"
12
- }`,whatsapp:`{}`},T=e=>{switch(e){case`connected`:return`success`;case`connecting`:return`warning`;case`degraded`:return`warning`;case`error`:return`destructive`;default:return`secondary`}};function E({initial:e,onSubmit:t,onCancel:n}){let[r,i]=(0,x.useState)(e?.name??``),[a,o]=(0,x.useState)(e?.platform??`telegram`),[c,l]=(0,x.useState)(e?.config?JSON.stringify(e.config,null,2):w[e?.platform??`telegram`]??`{}`),[u,f]=(0,x.useState)(e?.enabled??!0),[p,h]=(0,x.useState)(``);function _(e){if(e.preventDefault(),!r.trim()){h(`Name is required`);return}let n;try{n=JSON.parse(c)}catch{h(`Invalid JSON in config`);return}h(``),t({name:r.trim(),platform:a,config:n,enabled:u})}return(0,S.jsx)(g,{children:(0,S.jsxs)(`form`,{onSubmit:_,className:`space-y-3`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,S.jsx)(m,{className:`text-[var(--app-text)]`,children:e?`Edit Channel`:`New Channel`}),(0,S.jsx)(d,{variant:`ghost`,size:`icon`,type:`button`,onClick:n,children:(0,S.jsx)(s,{size:14})})]}),p&&(0,S.jsx)(`div`,{className:`text-xs text-[var(--app-danger)]`,children:p}),(0,S.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,S.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,S.jsx)(`label`,{className:`text-xs text-[var(--app-text-muted)]`,children:`Name`}),(0,S.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),placeholder:`My Telegram Bot`,className:`rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-sm text-[var(--app-text)] placeholder:text-[var(--app-text-subtle)] focus:border-[var(--app-accent)] focus:outline-none`})]}),(0,S.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,S.jsx)(`label`,{className:`text-xs text-[var(--app-text-muted)]`,children:`Platform`}),(0,S.jsx)(`select`,{value:a,onChange:t=>{o(t.target.value),e||l(w[t.target.value]??`{}`)},className:`rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-sm text-[var(--app-text)] focus:border-[var(--app-accent)] focus:outline-none`,children:C.map(e=>(0,S.jsx)(`option`,{value:e,children:e},e))})]})]}),(0,S.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,S.jsx)(`label`,{className:`text-xs text-[var(--app-text-muted)]`,children:`Config (JSON)`}),(0,S.jsx)(`textarea`,{value:c,onChange:e=>l(e.target.value),rows:4,className:`resize-none rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 font-mono text-xs text-[var(--app-text)] placeholder:text-[var(--app-text-subtle)] focus:border-[var(--app-accent)] focus:outline-none`})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`input`,{type:`checkbox`,id:`ch-enabled`,checked:u,onChange:e=>f(e.target.checked),className:`rounded border-[var(--app-border)] bg-[var(--app-panel-elevated)]`}),(0,S.jsx)(`label`,{htmlFor:`ch-enabled`,className:`text-xs text-[var(--app-text-muted)]`,children:`Enabled`})]}),!e&&a===`wechat`&&(0,S.jsx)(`div`,{className:`rounded bg-[var(--app-accent-soft-bg)] border border-[var(--app-accent-soft-border)] px-3 py-2 text-xs text-[var(--app-accent)]`,children:`Creating a WeChat channel will start a QR code scan. Have your WeChat app ready.`}),(0,S.jsxs)(`div`,{className:`flex gap-2`,children:[(0,S.jsx)(d,{type:`submit`,size:`sm`,children:e?`Save`:a===`wechat`&&!e?`Create & Connect`:`Create`}),(0,S.jsx)(d,{type:`button`,variant:`ghost`,size:`sm`,onClick:n,children:`Cancel`})]})]})})}function D({channelId:e,onClose:t}){let[n,r]=(0,x.useState)([]),[i,a]=(0,x.useState)(!0);return(0,x.useEffect)(()=>{(async()=>{try{r((await f(`/channels/${e}/messages`)).messages)}catch{}a(!1)})()},[e]),(0,S.jsxs)(g,{children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,S.jsx)(m,{children:`Channel Messages`}),(0,S.jsx)(d,{variant:`ghost`,size:`icon`,onClick:t,children:(0,S.jsx)(s,{size:14})})]}),i?(0,S.jsx)(`div`,{className:`text-xs text-[var(--app-text-subtle)]`,children:`Loading...`}):n.length===0?(0,S.jsx)(`div`,{className:`text-xs text-[var(--app-text-subtle)]`,children:`No messages yet`}):(0,S.jsx)(`div`,{className:`max-h-64 overflow-y-auto space-y-2`,children:n.map(e=>(0,S.jsxs)(`div`,{className:`rounded bg-[var(--app-panel-elevated)]/50 px-3 py-2 text-xs`,children:[(0,S.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,S.jsx)(`span`,{className:e.role===`user`?`text-[var(--app-accent)]`:`text-[var(--app-success)]`,children:e.role}),(0,S.jsx)(`span`,{className:`text-[var(--app-text-subtle)]`,children:new Date(e.createdAt).toLocaleTimeString()})]}),(0,S.jsx)(`div`,{className:`mt-1 text-[var(--app-text)]`,children:e.content})]},e.id))})]})}function O(){let[e,o]=(0,x.useState)([]),[s,u]=(0,x.useState)(!0),[C,w]=(0,x.useState)(!1),[O,k]=(0,x.useState)(null),[A,j]=(0,x.useState)(null),[M,N]=(0,x.useState)(null),[P,F]=(0,x.useState)(!1);(0,x.useEffect)(()=>{I()},[]);async function I(){try{o((await f(`/channels`)).channels)}catch{}u(!1)}async function L(e){try{let t=await f(`/channels`,{method:`POST`,body:JSON.stringify(e)});w(!1),I(),e.platform===`wechat`&&t.channel?.id&&z(t.channel.id)}catch{}}async function R(e){if(O)try{await f(`/channels/${O.id}`,{method:`PATCH`,body:JSON.stringify(e)}),k(null),I()}catch{}}async function z(t){if(e.find(e=>e.id===t)?.platform===`wechat`)try{let e=await f(`/channels/${t}/wechat/qr-start`,{method:`POST`});if(e.qrcodeUrl&&e.sessionKey){N({channelId:t,qrcodeUrl:e.qrcodeUrl,sessionKey:e.sessionKey}),F(!0);try{(await f(`/channels/${t}/wechat/qr-wait`,{method:`POST`,body:JSON.stringify({sessionKey:e.sessionKey,timeoutMs:12e4})})).connected&&I()}catch{}N(null),F(!1)}}catch{}else try{await f(`/channels/${t}/connect`,{method:`POST`}),I()}catch{}}async function B(e){try{await f(`/channels/${e}/disconnect`,{method:`POST`}),I()}catch{}}async function V(e){try{await f(`/channels/${e}`,{method:`DELETE`}),o(t=>t.filter(t=>t.id!==e))}catch{}}return s?(0,S.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,S.jsx)(`div`,{className:`h-8 w-8 animate-spin rounded-full border-2 border-[var(--app-border)] border-t-[var(--app-accent)]`})}):(0,S.jsxs)(`div`,{className:`space-y-6`,children:[(0,S.jsx)(_,{eyebrow:`Delivery`,title:`Channels`,description:`Connection status, volume, and edit access for every delivery endpoint.`,metrics:[{label:`Connected`,value:e.filter(e=>e.status===`connected`).length},{label:`Enabled`,value:e.filter(e=>e.enabled).length},{label:`Messages`,value:e.reduce((e,t)=>e+t.messageCount,0)}],compact:!0,actions:(0,S.jsxs)(d,{size:`sm`,onClick:()=>{w(!0),k(null)},children:[(0,S.jsx)(i,{size:14}),`Add Channel`]})}),(0,S.jsx)(v,{title:`Endpoints`,description:`Connect, disconnect, edit, inspect messages, or add a new endpoint.`,compact:!0,action:(0,S.jsxs)(`div`,{className:`text-xs text-[var(--app-text-subtle)]`,children:[e.length,` channel`,e.length===1?``:`s`]})}),C&&!O&&(0,S.jsx)(E,{onSubmit:L,onCancel:()=>w(!1)}),O&&(0,S.jsx)(E,{initial:O,onSubmit:R,onCancel:()=>k(null)}),A&&(0,S.jsx)(D,{channelId:A,onClose:()=>j(null)}),M&&(0,S.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60`,children:(0,S.jsxs)(g,{className:`max-w-sm text-center`,children:[(0,S.jsx)(m,{className:`mb-3 text-[var(--app-text)]`,children:`Scan QR Code with WeChat`}),(0,S.jsx)(`img`,{src:`https://api.qrserver.com/v1/create-qr-code/?size=256x256&data=${encodeURIComponent(M.qrcodeUrl)}`,alt:`WeChat QR Code`,className:`mx-auto h-64 w-64 rounded bg-white p-2`}),(0,S.jsx)(`p`,{className:`mt-3 text-xs text-[var(--app-text-muted)]`,children:P?`Waiting for scan...`:`Open WeChat and scan the QR code`}),(0,S.jsx)(`a`,{href:M.qrcodeUrl,target:`_blank`,rel:`noopener noreferrer`,className:`mt-1 block text-[10px] text-[var(--app-accent)] hover:text-[var(--app-accent)] truncate max-w-[280px] mx-auto`,children:M.qrcodeUrl}),(0,S.jsx)(d,{variant:`ghost`,size:`sm`,className:`mt-3`,onClick:()=>{N(null),F(!1)},children:`Cancel`})]})}),e.length===0&&!C?(0,S.jsx)(g,{children:(0,S.jsx)(y,{icon:(0,S.jsx)(a,{size:b.hero}),title:`No channels`,description:`Add a channel to connect Adam to messaging platforms like Telegram, Slack, or Discord.`})}):(0,S.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-3`,children:e.map(e=>(0,S.jsxs)(g,{children:[(0,S.jsxs)(h,{children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(a,{size:16,className:`text-[var(--app-text-muted)]`}),(0,S.jsx)(m,{className:`text-[var(--app-text)]`,children:e.name})]}),(0,S.jsx)(p,{variant:T(e.status),children:e.status})]}),(0,S.jsxs)(`div`,{className:`space-y-2 text-xs text-[var(--app-text-muted)]`,children:[(0,S.jsxs)(`div`,{className:`flex justify-between`,children:[(0,S.jsx)(`span`,{children:`Platform`}),(0,S.jsx)(`span`,{className:`text-[var(--app-text)]`,children:e.platform})]}),(0,S.jsxs)(`div`,{className:`flex justify-between`,children:[(0,S.jsx)(`span`,{children:`Messages`}),(0,S.jsx)(`span`,{className:`text-[var(--app-text)]`,children:e.messageCount})]}),(0,S.jsxs)(`div`,{className:`flex justify-between`,children:[(0,S.jsx)(`span`,{children:`Enabled`}),(0,S.jsx)(`span`,{className:e.enabled?`text-[var(--app-success)]`:`text-[var(--app-text-subtle)]`,children:e.enabled?`Yes`:`No`})]})]}),(0,S.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 border-t border-[var(--app-border)] pt-3`,children:[e.status===`connected`?(0,S.jsxs)(d,{variant:`secondary`,size:`sm`,onClick:()=>void B(e.id),children:[(0,S.jsx)(l,{size:12}),` Disconnect`]}):(0,S.jsxs)(d,{variant:`secondary`,size:`sm`,onClick:()=>void z(e.id),children:[(0,S.jsx)(t,{size:12}),` Connect`]}),(0,S.jsx)(d,{variant:`ghost`,size:`sm`,onClick:()=>{k(e),w(!1)},children:(0,S.jsx)(n,{size:12})}),(0,S.jsx)(d,{variant:`ghost`,size:`sm`,onClick:()=>j(e.id),children:(0,S.jsx)(r,{size:12})}),(0,S.jsx)(d,{variant:`ghost`,size:`sm`,onClick:()=>void V(e.id),children:(0,S.jsx)(c,{size:12})})]})]},e.id))})]})}export{O as Channels};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/api-D-UzHSDq.js","assets/rolldown-runtime-Dw2cE7zH.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{A as t,S as n,Y as r,d as i,f as a,h as o,k as s,lt as c,n as l,s as u,st as d,v as f}from"./vendor-icons-jzPiR6xl.js";import{p,t as m}from"./vendor-react-CIkiuNDu.js";import{r as h}from"./dist-CgGno8kE.js";import{t as g}from"./Button-VPwTNGpF.js";import{n as _}from"./vendor-state-CEOsUh-T.js";import{t as v}from"./api-D-UzHSDq.js";import{t as y}from"./PageHeader-D9lLjo0N.js";import{a as b}from"./format-BUYXZqDw.js";import{t as x}from"./EmptyState-CWS9PJND.js";import{t as S}from"./ui-CerQw0jA.js";import{t as C}from"./useIsMobileLayout-D6Tz5o5h.js";var w=e(c(),1),T=_((e,t)=>({sessions:[],activeSessionId:null,messages:[],loading:!1,sending:!1,_chatWs:null,_chatWsReconnectDelay:1e3,fetchSessions:async()=>{try{e({sessions:(await v(`/chat/sessions`)).sessions})}catch{}},fetchMessages:async t=>{e({loading:!0});try{e({messages:(await v(`/chat/sessions/${t}`)).messages,loading:!1})}catch{e({messages:[],loading:!1})}},sendMessage:async n=>{if(t().sending)return null;e({sending:!0});try{let r=await v(`/chat/messages`,{method:`POST`,body:JSON.stringify({content:n,source:{type:`web`},sessionId:t().activeSessionId??void 0})});return e({activeSessionId:r.sessionId,sending:!1}),t().fetchSessions(),r}catch{return e({sending:!1}),null}},createSession:async()=>{try{let t=await v(`/chat/sessions`,{method:`POST`,body:JSON.stringify({source:{type:`web`}})});return e(e=>({sessions:[t.session,...e.sessions],activeSessionId:t.session.id,messages:[]})),t.session}catch{return null}},archiveSession:async t=>{try{await v(`/chat/sessions/${t}/archive`,{method:`POST`}),e(e=>({sessions:e.sessions.map(e=>e.id===t?{...e,status:`archived`}:e),activeSessionId:e.activeSessionId===t?null:e.activeSessionId,messages:e.activeSessionId===t?[]:e.messages}))}catch{}},restoreSession:async t=>{try{await v(`/chat/sessions/${t}/restore`,{method:`POST`}),e(e=>({sessions:e.sessions.map(e=>e.id===t?{...e,status:`active`}:e)}))}catch{}},deleteSession:async t=>{try{await v(`/chat/sessions/${t}`,{method:`DELETE`}),e(e=>({sessions:e.sessions.filter(e=>e.id!==t),activeSessionId:e.activeSessionId===t?null:e.activeSessionId,messages:e.activeSessionId===t?[]:e.messages}))}catch{}},setActiveSession:n=>{e({activeSessionId:n,messages:[]}),n&&t().fetchMessages(n)},connectChatStream:()=>{let n=t()._chatWs;if(n&&n.readyState<=1)return;let r=window.location.protocol===`https:`?`wss:`:`ws:`,i=localStorage.getItem(`adam_api_key`),a=new URL(`${r}//${window.location.host}/chat/stream`);i&&a.searchParams.set(`api_key`,i);let o=new WebSocket(a.toString()),s=!1;o.onopen=()=>{s=!0,e({_chatWs:o,_chatWsReconnectDelay:1e3})},o.onclose=async()=>{if(!s&&i){let{verifyApiKey:e,clearStoredApiKey:t,redirectToLogin:n}=await p(async()=>{let{verifyApiKey:e,clearStoredApiKey:t,redirectToLogin:n}=await import(`./api-D-UzHSDq.js`).then(e=>e.n);return{verifyApiKey:e,clearStoredApiKey:t,redirectToLogin:n}},__vite__mapDeps([0,1]));if(!await e(i).catch(()=>!0)){t(),n();return}}let n=t()._chatWsReconnectDelay;e({_chatWs:null,_chatWsReconnectDelay:Math.min(n*2,1e4)}),setTimeout(()=>{t().connectChatStream()},n)},o.onerror=()=>{o.close()},o.onmessage=n=>{try{let r=JSON.parse(n.data);if(r.type===`chat_message`&&r.message){let n=r.message,{activeSessionId:i,messages:a}=t();if(n.sessionId!==i||a.some(e=>e.id===n.id))return;e(e=>({messages:[...e.messages,n]}))}else r.type===`session_created`&&t().fetchSessions()}catch{}},e({_chatWs:o})},disconnectChatStream:()=>{let n=t()._chatWs;n&&(n.onclose=null,n.onerror=null,n.onmessage=null,n.close(),e({_chatWs:null}))}})),E=m();function D({message:e}){let t=e.role===`user`,n=t?`You`:e.taskId?`Adam · execution`:`Adam`;return(0,E.jsx)(`div`,{className:h(`flex`,t?`justify-end`:`justify-start`),children:(0,E.jsxs)(`div`,{className:h(`max-w-[85%] rounded-lg px-4 py-3 text-sm leading-7 shadow-[var(--app-shadow-md)]`,t?`surface-accent text-white`:`surface-panel text-[var(--app-text)]`),children:[(0,E.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-[11px] uppercase tracking-[0.16em]`,children:[(0,E.jsx)(`span`,{className:t?`text-white/70`:`text-[var(--app-kicker)]`,children:n}),(0,E.jsx)(`span`,{className:t?`text-white/45`:`text-[var(--app-text-subtle)]`,children:b(typeof e.createdAt==`number`?e.createdAt:new Date(e.createdAt).getTime())})]}),(0,E.jsx)(`div`,{className:`whitespace-pre-wrap break-words`,children:e.content})]})})}function O({onSend:e,disabled:t,placeholder:n=`Type a message...`,starterActions:r=[],showStarterActions:i=!0,compact:a=!1}){let[s,c]=(0,w.useState)(``),l=(0,w.useRef)(null),u=()=>{let n=s.trim();!n||t||(e(n),c(``),l.current&&(l.current.style.height=`auto`))},d=e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),u())},f=()=>{let e=l.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,120)}px`)};return(0,E.jsxs)(`div`,{className:a?`rounded-xl border border-[var(--app-border)] bg-white/[0.03] p-3`:`surface-panel-elevated rounded-xl p-3`,children:[i&&r.length>0?(0,E.jsx)(`div`,{className:`mb-3 flex flex-wrap gap-2`,children:r.map(e=>(0,E.jsx)(`button`,{type:`button`,onClick:()=>{c(e.value),requestAnimationFrame(()=>l.current?.focus())},className:`rounded-full border border-[var(--app-border)] bg-white/[0.04] px-3 py-1.5 text-xs font-medium text-[var(--app-text-muted)] transition-colors hover:border-[var(--app-border-strong)] hover:text-[var(--app-text)]`,children:e.label},e.label))}):null,(0,E.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,E.jsx)(`textarea`,{ref:l,value:s,onChange:e=>{c(e.target.value),f()},onKeyDown:d,placeholder:n,disabled:t,rows:1,className:`min-h-12 flex-1 resize-none rounded-lg border border-[var(--app-border)] bg-white/[0.04] px-4 py-3 text-sm text-[var(--app-text)] placeholder:text-[var(--app-text-subtle)] focus:border-[var(--app-border-strong)] focus:outline-none focus:ring-1 focus:ring-[var(--app-accent)] disabled:opacity-50`}),(0,E.jsxs)(g,{onClick:u,disabled:t||!s.trim(),size:`default`,"aria-label":`Send message`,children:[(0,E.jsx)(o,{size:16}),`Send`]})]}),(0,E.jsx)(`div`,{className:`mt-2 text-xs text-[var(--app-text-subtle)]`,children:`Enter to send; Shift+Enter for a new line.`})]})}function k({session:e,isActive:t,onSelect:n,onArchive:r,onRestore:i,onDelete:a}){let o=e.status===`archived`,s=(e,t)=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),t())};return(0,E.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:n,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n())},className:h(`group flex w-full flex-col gap-1 rounded-lg border px-3 py-3 text-left transition-colors`,t?`border-[var(--app-border-strong)] bg-white/[0.08] text-[var(--app-text)]`:`border-transparent text-[var(--app-text-muted)] hover:border-[var(--app-border)] hover:bg-white/[0.04] hover:text-[var(--app-text)]`,o&&`opacity-60`),"aria-label":e.title??e.id.slice(0,8),children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,E.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.title??e.id.slice(0,8)}),(0,E.jsxs)(`div`,{className:h(`flex gap-0.5 transition-opacity`,t?`opacity-100`:`opacity-100 lg:opacity-0 lg:group-hover:opacity-100 lg:group-focus-within:opacity-100`),children:[o?(0,E.jsx)(g,{variant:`ghost`,size:`icon`,className:`h-6 w-6 text-[var(--app-text-subtle)] hover:text-[var(--app-success)]`,onClick:e=>{e.stopPropagation(),i()},onKeyDown:e=>s(e,i),title:`Restore session`,"aria-label":`Restore session`,children:(0,E.jsx)(f,{size:S.xs})}):(0,E.jsx)(g,{variant:`ghost`,size:`icon`,className:`h-6 w-6 text-[var(--app-text-subtle)] hover:text-[var(--app-warning)]`,onClick:e=>{e.stopPropagation(),r()},onKeyDown:e=>s(e,r),title:`Archive session`,"aria-label":`Archive session`,children:(0,E.jsx)(d,{size:S.xs})}),(0,E.jsx)(g,{variant:`ghost`,size:`icon`,className:`h-6 w-6 text-[var(--app-text-subtle)] hover:text-[var(--app-danger)]`,onClick:e=>{e.stopPropagation(),a()},onKeyDown:e=>s(e,a),title:`Delete session`,"aria-label":`Delete session`,children:(0,E.jsx)(u,{size:S.xs})})]})]}),(0,E.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-[var(--app-text-subtle)]`,children:[(0,E.jsxs)(`span`,{children:[e.messageCount,` turns`]}),(0,E.jsx)(`span`,{children:b(e.lastActiveAt)}),o&&(0,E.jsx)(`span`,{className:`rounded-full border border-[var(--app-border)] bg-white/[0.04] px-1.5 py-0.5 text-[9px] uppercase tracking-[0.16em]`,children:`archived`})]})]})}function A({sessions:e,activeSessionId:t,onSelectSession:r,onNewSession:i,onArchiveSession:a,onRestoreSession:o,onDeleteSession:s,onClose:c}){let{recentSessions:l,earlierSessions:u,archivedSessions:d,activeSessions:f}=(0,w.useMemo)(()=>{let t=Date.now(),n=1440*60*1e3,r=e.filter(e=>e.status===`active`);return{recentSessions:r.filter(e=>t-e.lastActiveAt<n),earlierSessions:r.filter(e=>t-e.lastActiveAt>=n),archivedSessions:e.filter(e=>e.status===`archived`),activeSessions:r}},[e]);return(0,E.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between border-b border-[var(--app-border)] px-4 py-3`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`span`,{className:`text-section-label`,children:`Sessions`}),(0,E.jsx)(`p`,{className:`mt-1 text-xs text-[var(--app-text-subtle)]`,children:`Switch context or reopen archived work.`})]}),(0,E.jsxs)(g,{variant:`ghost`,size:`sm`,onClick:i,"aria-label":`New session`,children:[(0,E.jsx)(n,{size:14}),(0,E.jsx)(`span`,{className:`hidden sm:inline`,children:`New`})]})]}),(0,E.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:[f.length===0&&d.length===0&&(0,E.jsx)(`div`,{className:`px-2 py-6 text-center text-xs text-[var(--app-text-subtle)]`,children:`No sessions yet`}),l.length>0&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`div`,{className:`mb-2 px-2 text-[10px] font-semibold uppercase tracking-[0.18em] text-[var(--app-text-subtle)]`,children:`Today`}),(0,E.jsx)(`div`,{className:`space-y-1`,children:l.map(e=>(0,E.jsx)(k,{session:e,isActive:e.id===t,onSelect:()=>{r(e.id),c?.()},onArchive:()=>a(e.id),onRestore:()=>o(e.id),onDelete:()=>s(e.id)},e.id))})]}),u.length>0&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`div`,{className:`mb-2 mt-4 px-2 text-[10px] font-semibold uppercase tracking-[0.18em] text-[var(--app-text-subtle)]`,children:`Earlier`}),(0,E.jsx)(`div`,{className:`space-y-1`,children:u.map(e=>(0,E.jsx)(k,{session:e,isActive:e.id===t,onSelect:()=>{r(e.id),c?.()},onArchive:()=>a(e.id),onRestore:()=>o(e.id),onDelete:()=>s(e.id)},e.id))})]}),d.length>0&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`div`,{className:`mb-2 mt-4 px-2 text-[10px] font-semibold uppercase tracking-[0.18em] text-[var(--app-text-subtle)]`,children:`Archived`}),(0,E.jsx)(`div`,{className:`space-y-1`,children:d.map(e=>(0,E.jsx)(k,{session:e,isActive:e.id===t,onSelect:()=>{r(e.id),c?.()},onArchive:()=>a(e.id),onRestore:()=>o(e.id),onDelete:()=>s(e.id)},e.id))})]})]})]})}var j=[{label:`Debug a failure`,value:`Review the most recent failed task and explain the next fix.`},{label:`Summarize status`,value:`Summarize the current system status, blockers, and active work.`},{label:`Plan a task`,value:`Break down the next implementation task into a concrete execution plan.`}];function M(){let e=T(e=>e.sessions),o=T(e=>e.activeSessionId),c=T(e=>e.messages),u=T(e=>e.sending),d=T(e=>e.fetchSessions),f=T(e=>e.sendMessage),p=T(e=>e.createSession),m=T(e=>e.archiveSession),h=T(e=>e.restoreSession),_=T(e=>e.deleteSession),v=T(e=>e.setActiveSession),b=T(e=>e.connectChatStream),k=T(e=>e.disconnectChatStream),M=(0,w.useRef)(null),[P,F]=(0,w.useState)(!1),I=C(1024),L=e.filter(e=>e.status===`active`),R=e.filter(e=>e.status===`archived`),z=e.length>0,B=c.length>0,V=e.find(e=>e.id===o)??null;(0,w.useEffect)(()=>{d()},[d]),(0,w.useEffect)(()=>(b(),()=>k()),[b,k]),(0,w.useEffect)(()=>{M.current?.scrollIntoView?.({behavior:`smooth`})},[c]),(0,w.useEffect)(()=>{I||F(!1)},[I]),(0,w.useEffect)(()=>{if(o||e.length===0)return;let t=[...e].filter(e=>e.status===`active`).sort((e,t)=>t.lastActiveAt-e.lastActiveAt)[0]??[...e].sort((e,t)=>t.lastActiveAt-e.lastActiveAt)[0];t&&v(t.id)},[o,e,v]);let H=async e=>{await f(e)};return(0,E.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-5`,children:[(0,E.jsx)(y,{title:`Chat`,description:z?`Resume the latest session, inspect context, and keep the composer in view.`:`Start the first session and use Adam as the working surface for review, debugging, and planning.`,compact:!0,className:`px-4 py-3 lg:px-4 lg:py-3`,actions:(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,E.jsxs)(g,{variant:`secondary`,size:`sm`,onClick:()=>void p(),children:[(0,E.jsx)(n,{size:14}),`New Session`]}),(0,E.jsxs)(g,{variant:`secondary`,size:`sm`,className:`lg:hidden`,onClick:()=>F(!0),"aria-label":`Manage sessions`,children:[(0,E.jsx)(t,{size:16}),`Sessions`]})]})}),P?(0,E.jsxs)(`div`,{className:`fixed inset-0 z-40 lg:hidden`,role:`dialog`,"aria-modal":`true`,"aria-label":`Session manager`,children:[(0,E.jsx)(`div`,{className:`absolute inset-0 bg-black/60`,onClick:()=>F(!1)}),(0,E.jsxs)(`div`,{className:`relative z-50 h-full w-full max-w-sm border-r border-[var(--app-border)] bg-[var(--app-canvas)] shadow-[var(--app-shadow-lg)]`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between border-b border-[var(--app-border)] px-4 py-3`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`p`,{className:`text-section-label`,children:`Sessions`}),(0,E.jsx)(`p`,{className:`mt-1 text-xs text-[var(--app-text-subtle)]`,children:`Switch, archive, restore, or start a new conversation.`})]}),(0,E.jsx)(g,{variant:`ghost`,size:`icon`,onClick:()=>F(!1),"aria-label":`Close session manager`,children:(0,E.jsx)(l,{size:16})})]}),(0,E.jsx)(A,{sessions:e,activeSessionId:o,onSelectSession:v,onNewSession:()=>{p(),F(!1)},onArchiveSession:e=>void m(e),onRestoreSession:e=>void h(e),onDeleteSession:e=>void _(e),onClose:()=>F(!1)})]})]}):null,(0,E.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden rounded-xl border border-[var(--app-border)] bg-[color-mix(in_oklch,var(--app-canvas)_88%,transparent)] shadow-[var(--app-shadow-lg)]`,children:[(0,E.jsx)(`div`,{className:`hidden w-72 flex-shrink-0 border-r border-[var(--app-border)] bg-[color-mix(in_oklch,var(--app-canvas)_90%,transparent)] lg:block`,children:(0,E.jsx)(A,{sessions:e,activeSessionId:o,onSelectSession:v,onNewSession:()=>void p(),onArchiveSession:e=>void m(e),onRestoreSession:e=>void h(e),onDeleteSession:e=>void _(e)})}),(0,E.jsxs)(`div`,{className:`flex flex-1 flex-col`,children:[(0,E.jsx)(`div`,{className:`flex-1 overflow-y-auto px-4 py-4 lg:px-6`,children:B?(0,E.jsxs)(`div`,{className:`mx-auto max-w-4xl space-y-3`,children:[c.map(e=>(0,E.jsx)(D,{message:e},e.id)),(0,E.jsx)(`div`,{ref:M})]}):z?(0,E.jsx)(`div`,{className:`mx-auto flex h-full w-full max-w-4xl items-start`,children:(0,E.jsxs)(`div`,{className:`surface-panel-muted flex w-full flex-col gap-4 rounded-xl p-5`,children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,E.jsxs)(`div`,{className:`space-y-1`,children:[(0,E.jsx)(`p`,{className:`text-kicker`,children:`Working Surface`}),(0,E.jsx)(`h2`,{className:`text-xl font-semibold text-[var(--app-text)]`,children:V?`Session ${V.title??V.id.slice(0,8)}`:`Pick a session to continue`}),(0,E.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-[var(--app-text-muted)]`,children:V?`This session has no loaded transcript yet. Continue here or start a new thread without leaving the page.`:`Archived history exists, but no session is active. Select one from the rail or start a new conversation.`})]}),(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-[var(--app-text-subtle)]`,children:[(0,E.jsxs)(`span`,{children:[L.length,` active`]}),(0,E.jsxs)(`span`,{children:[R.length,` archived`]})]})]}),(0,E.jsx)(`div`,{className:`grid gap-3 md:grid-cols-3`,children:j.map(e=>(0,E.jsxs)(`button`,{type:`button`,onClick:()=>void H(e.value),className:`rounded-xl border border-[var(--app-border)] bg-white/[0.03] p-4 text-left transition-colors hover:border-[var(--app-border-strong)] hover:bg-white/[0.05]`,children:[(0,E.jsx)(`div`,{className:`text-sm font-semibold text-[var(--app-text)]`,children:e.label}),(0,E.jsx)(`div`,{className:`mt-1 text-sm leading-6 text-[var(--app-text-muted)]`,children:e.value})]},e.label))})]})}):(0,E.jsx)(x,{icon:(0,E.jsx)(s,{size:S.hero}),title:`Start a conversation with Adam`,description:`Use the starter prompts below to inspect recent work, diagnose failures, or create an execution plan.`,className:`h-full min-h-[24rem]`,action:(0,E.jsxs)(`div`,{className:`grid gap-3 text-left sm:grid-cols-3`,children:[(0,E.jsx)(N,{icon:a,title:`Inspect live status`,description:`Summarize active work, risk, and recent changes.`}),(0,E.jsx)(N,{icon:i,title:`Dig into a task`,description:`Review recent execution output and the next concrete step.`}),(0,E.jsx)(N,{icon:r,title:`Recover context`,description:`Continue from the latest session without losing history.`})]})})}),(0,E.jsx)(`div`,{className:`mx-auto w-full max-w-4xl px-4 pb-4 lg:px-6`,children:(0,E.jsx)(O,{onSend:H,disabled:u,starterActions:j,showStarterActions:!z&&!B,compact:z})})]})]})]})}function N({icon:e,title:t,description:n}){return(0,E.jsxs)(`div`,{className:`surface-panel-muted rounded-lg p-4`,children:[(0,E.jsx)(`div`,{className:`mb-3 flex h-10 w-10 items-center justify-center rounded-lg bg-white/[0.05] text-[var(--app-kicker)]`,children:(0,E.jsx)(e,{size:S.lg})}),(0,E.jsx)(`div`,{className:`text-sm font-semibold text-[var(--app-text)]`,children:t}),(0,E.jsx)(`div`,{className:`mt-1 text-sm leading-6 text-[var(--app-text-muted)]`,children:n})]})}export{M as Chat};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{$ as t,N as n,Q as r,X as i,ct as a,lt as o}from"./vendor-icons-jzPiR6xl.js";import{r as s,t as c}from"./vendor-react-CIkiuNDu.js";import{t as l}from"./vendor-state-CEOsUh-T.js";import{f as u,n as d,t as f}from"./index-Bl-2p6d8.js";import{i as p,n as m,r as h,t as g}from"./Card-C2N6k4gh.js";import{t as _}from"./PageHeader-D9lLjo0N.js";import{t as v}from"./SectionHeader-BB3H3F_P.js";import{a as y,o as b,t as x}from"./format-BUYXZqDw.js";var S=e(o(),1),C=c();function w(){let{tasks:e,goals:o,roles:c,stats:w,readiness:D,executionPool:O}=u(l(e=>({tasks:e.tasks,goals:e.goals,roles:e.roles,stats:e.stats,readiness:e.readiness,executionPool:e.executionPool}))),k=u(e=>e.fetchTasks),A=u(e=>e.fetchGoals),j=u(e=>e.fetchRoles),M=u(e=>e.fetchExecutionPool);(0,S.useEffect)(()=>{k(),A(),j(),M();let e=setInterval(()=>{k(),M()},5e3);return()=>clearInterval(e)},[k,A,j,M]);let N=e.filter(e=>e.status===`running`).length,P=e.filter(e=>e.status===`queued`||e.status===`pending`).length,F=e.filter(e=>e.status===`failed`).length,I=(0,S.useMemo)(()=>[...e].sort((e,t)=>t.createdAt-e.createdAt),[e]),L=(0,S.useMemo)(()=>I.slice(0,4),[I]),R=(0,S.useMemo)(()=>I.find(e=>e.status===`failed`)||I.find(e=>e.status===`running`)||I[0],[I]),z=(0,S.useMemo)(()=>D?Object.entries(D.checks):[],[D]),B=(0,S.useMemo)(()=>z.filter(([,e])=>e).length,[z]),V=R?.roleId?c.find(e=>e.id===R.roleId)?.name??R.roleId.slice(0,8):`Unassigned`,H=R?`/tasks/${R.id}`:`/work`,U=R?`Open task`:`Open work`,W=R?R.status===`failed`?`Review the failed task before queueing more work.`:R.status===`running`?`Track this active run and its next result.`:`Use the latest completed run as the starting point for follow-up work.`:`Queue work, review recent runs, or launch an automation.`,G=R?R.status===`failed`?`surface-critical`:R.status===`running`?`surface-accent`:`surface-panel-elevated`:`surface-panel-muted`,K=G===`surface-critical`?`critical`:G===`surface-accent`?`accent`:`neutral`,q=K===`accent`||K===`critical`,J=q?`text-white`:`text-[var(--app-text)]`,Y=q?`text-white/70`:`text-[var(--app-text-subtle)]`,X=q?`text-white/76`:`text-[var(--app-text-muted)]`;return(0,C.jsxs)(`div`,{className:`space-y-6`,children:[(0,C.jsx)(_,{title:`Dashboard`,description:`Queue health, execution readiness, and the next task that needs attention.`,metrics:[{label:`Server`,value:D?.status===`ready`?`Ready`:`Attention`},{label:`Running`,value:w.activeTasks||N},{label:`Queued`,value:w.queuedTasks||P},{label:`Goals`,value:o.length},{label:`Execution Pool`,value:`${O.active}/${O.max} | ${O.queued} queued`}],compact:!0,className:`px-4 py-3 lg:px-4 lg:py-3`,actions:D?(0,C.jsx)(`span`,{role:`status`,"aria-live":`polite`,children:(0,C.jsx)(f,{variant:D.status===`ready`?`success`:`destructive`,children:D.status===`ready`?`Server Ready`:`Not Ready`})}):null}),(0,C.jsxs)(`div`,{className:`grid items-start gap-4 xl:grid-cols-2`,children:[(0,C.jsxs)(g,{className:`${G} self-start ${q?`text-white`:``}`,children:[(0,C.jsxs)(h,{className:`mb-2`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`p`,{className:`text-kicker ${Y}`,children:`Current Focus`}),(0,C.jsx)(p,{className:`mt-2 ${J}`,children:R?b(R.prompt,92):`No active blockers`})]}),R?(0,C.jsx)(f,{variant:d(R.status),children:R.status}):null]}),(0,C.jsx)(m,{className:X,children:W}),(0,C.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-[repeat(3,minmax(0,1fr))_auto]`,children:[(0,C.jsx)(E,{tone:K,label:`Created`,value:R?y(R.createdAt):`Idle`}),(0,C.jsx)(E,{tone:K,label:`Cost`,value:R?.costUsd==null?`No cost`:x(R.costUsd)}),(0,C.jsx)(E,{tone:K,label:`Role`,value:V}),(0,C.jsx)(s,{to:H,className:`inline-flex items-center justify-center rounded-lg border px-3 py-2 text-sm font-medium transition-colors ${q?`border-white/20 bg-white/10 text-white hover:bg-white/14`:`border-[var(--app-border)] bg-white/[0.05] text-[var(--app-text)] hover:border-[var(--app-border-strong)]`}`,children:U})]})]}),(0,C.jsxs)(g,{className:`surface-panel-elevated self-start`,children:[(0,C.jsx)(v,{title:`System Checks`,description:`${B}/${z.length||0} checks passing`,compact:!0}),D?(0,C.jsx)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:Object.entries(D.checks).map(([e,t])=>(0,C.jsxs)(`div`,{className:`surface-panel-muted flex items-center justify-between rounded-lg px-3 py-3`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsx)(i,{size:10,className:t?`fill-[var(--app-success)] text-[var(--app-success)]`:`fill-[var(--app-danger)] text-[var(--app-danger)]`}),(0,C.jsx)(`span`,{className:`text-sm capitalize text-[var(--app-text)]`,children:e})]}),(0,C.jsx)(`span`,{className:`text-xs text-[var(--app-text-subtle)]`,children:t?`healthy`:`attention`})]},e))}):(0,C.jsx)(`span`,{className:`text-xs text-[var(--app-text-subtle)]`,children:`Loading...`})]})]}),(0,C.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,role:`region`,"aria-label":`Server statistics`,children:[(0,C.jsx)(T,{icon:n,label:`Active Tasks`,value:w.activeTasks||N,color:`text-[var(--app-accent)]`}),(()=>{let e=c.filter(e=>e.status===`active`).length,t=c.length,n=c.filter(e=>e.status===`probation`).length,r=c.filter(e=>e.status===`retired`).length,i=[n>0?`${n} probation`:``,r>0?`${r} retired`:``].filter(Boolean).join(` · `);return(0,C.jsx)(T,{icon:a,label:`Role Health`,value:i?`${e}/${t} | ${i}`:`${e}/${t}`,color:r>0?`text-[var(--app-danger)]`:n>0?`text-[var(--app-warning)]`:`text-[var(--app-success)]`})})(),(0,C.jsx)(T,{icon:t,label:`Failed`,value:F,color:`text-[var(--app-danger)]`}),(0,C.jsx)(T,{icon:r,label:`Cost Today`,value:x(w.totalCostToday),color:`text-[var(--app-accent-strong)]`})]}),(0,C.jsxs)(g,{padding:!1,children:[(0,C.jsx)(`div`,{className:`px-4 pt-4`,children:(0,C.jsx)(v,{title:`Recent Tasks`,description:`Latest executions across the control plane.`,action:(0,C.jsx)(s,{to:`/work`,className:`text-sm font-medium text-[var(--app-accent-strong)] hover:underline`,children:`View all`})})}),(0,C.jsx)(`div`,{className:`mt-4 space-y-3 px-4 pb-4`,children:L.length===0?(0,C.jsx)(`div`,{className:`surface-panel-muted rounded-lg px-4 py-6 text-sm text-[var(--app-text-subtle)]`,children:`No tasks yet`}):L.map(e=>(0,C.jsxs)(s,{to:`/tasks/${e.id}`,className:`surface-panel-muted flex flex-col gap-3 rounded-lg px-4 py-4 transition-colors hover:border-[var(--app-border-strong)] hover:bg-white/[0.05] lg:flex-row lg:items-start lg:justify-between`,children:[(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,C.jsx)(f,{variant:d(e.status),children:e.status}),(0,C.jsx)(`span`,{className:`font-mono text-xs text-[var(--app-text-subtle)]`,children:e.id.slice(0,8)}),e.roleId?(0,C.jsxs)(`span`,{className:`text-xs text-[var(--app-text-subtle)]`,children:[`role `,e.roleId.slice(0,12)]}):null]}),(0,C.jsx)(`div`,{className:`text-sm font-medium text-[var(--app-text)]`,children:b(e.prompt,128)})]}),(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 text-xs text-[var(--app-text-subtle)]`,children:[(0,C.jsx)(`span`,{children:y(e.createdAt)}),(0,C.jsx)(`span`,{children:e.costUsd==null?`no cost`:x(e.costUsd)})]})]},e.id))})]})]})}function T({icon:e,label:t,value:n,color:r}){return(0,C.jsxs)(g,{className:`surface-panel-muted flex items-center gap-3`,children:[(0,C.jsx)(`div`,{className:`rounded-lg bg-white/[0.05] p-3 ${r}`,children:(0,C.jsx)(e,{size:16})}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-xl font-semibold text-[var(--app-text)]`,children:n}),(0,C.jsx)(`div`,{className:`text-xs uppercase tracking-[0.14em] text-[var(--app-text-subtle)]`,children:t})]})]})}function E({label:e,value:t,tone:n=`accent`}){let r=n===`accent`||n===`critical`;return(0,C.jsxs)(`div`,{className:r?`rounded-lg border border-white/12 bg-black/10 px-3 py-3`:`surface-focus-metric rounded-lg px-3 py-3`,children:[(0,C.jsx)(`div`,{className:r?`text-[10px] uppercase tracking-[0.16em] text-white/62`:`text-[10px] uppercase tracking-[0.16em] text-[var(--app-text-subtle)]`,children:e}),(0,C.jsx)(`div`,{className:r?`mt-1 text-lg font-semibold text-white`:`mt-1 text-lg font-semibold text-[var(--app-text)]`,children:t})]})}export{w as Dashboard};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{E as t,S as n,T as ee,lt as r,s as te,t as ne,y as re}from"./vendor-icons-jzPiR6xl.js";import{d as ie,t as i}from"./vendor-react-CIkiuNDu.js";import"./es2015-DCW7LI8d.js";import{t as a}from"./Button-VPwTNGpF.js";import{t as o}from"./api-D-UzHSDq.js";import{a as ae,c as s,i as c,l,o as u,p as d,r as f,s as oe,t as se,u as ce}from"./index-Bl-2p6d8.js";import{t as p}from"./Card-C2N6k4gh.js";import{t as le}from"./SectionHeader-BB3H3F_P.js";import{a as ue}from"./format-BUYXZqDw.js";import{t as de}from"./EmptyState-CWS9PJND.js";import{a as fe,i as m,n as pe,o as h,r as g,t as me}from"./Table-D4lT5uHx.js";import{t as he}from"./Switch-B_R_EX9s.js";var _=e(r(),1),v=i(),ge={webhook:`info`,directory_watch:`warning`,cron:`success`,manual:`muted`};function y(e){let t=e.trim().split(/\s+/);return t.length===5?t.every(e=>/^(\*|(\*\/)?\d+(-\d+)?(,\d+(-\d+)?)*)$/.test(e)):!1}function b(){let e=ie(),[r,i]=(0,_.useState)([]),[b,x]=(0,_.useState)(!0),[_e,S]=(0,_.useState)(!1),[C,w]=(0,_.useState)(``),[T,ve]=(0,_.useState)(`webhook`),[E,D]=(0,_.useState)(``),[O,k]=(0,_.useState)(``),[A,j]=(0,_.useState)(``),[M,N]=(0,_.useState)(``),[P,F]=(0,_.useState)(!1),[I,L]=(0,_.useState)(null),[R,z]=(0,_.useState)(``),[B,ye]=(0,_.useState)(``),[V,be]=(0,_.useState)(`webhook`),[H,U]=(0,_.useState)(``),[W,G]=(0,_.useState)(``),[K,q]=(0,_.useState)(``),[xe,Se]=(0,_.useState)(!1),[J,Y]=(0,_.useState)(null),[X,Z]=(0,_.useState)(null),[Q,Ce]=(0,_.useState)(``),[we,Te]=(0,_.useState)(!1),$=(0,_.useCallback)(async()=>{x(!0);try{i(await o(`/event-defs`))}catch{d.error(`Failed to load events`)}finally{x(!1)}},[]);(0,_.useEffect)(()=>{$()},[$]);let Ee=async()=>{if(C.trim()){if(T===`cron`&&!y(A)){N(`Invalid cron expression (expected 5 fields: minute hour day month weekday)`);return}F(!0);try{let e={name:C.trim(),sourceType:T,description:E.trim()||void 0,enabled:!0};T===`directory_watch`&&O.trim()?e.sourceConfig={path:O.trim(),stability_delay_ms:5e3}:T===`cron`&&A.trim()&&(e.sourceConfig={cron:A.trim()}),await o(`/event-defs`,{method:`POST`,body:JSON.stringify(e)}),w(``),D(``),k(``),j(``),N(``),S(!1),$(),d.success(`Event created`)}catch(e){let t=e instanceof Error?e.message:`Failed to create event`;d.error(t)}finally{F(!1)}}},De=e=>{L(e.id),z(e.name),ye(e.description??``),be(e.sourceType),U(e.sourceConfig?.path??``),G(e.sourceConfig?.cron??``),q(``)},Oe=async()=>{if(!(!I||!R.trim())){if(V===`cron`&&!y(W)){q(`Invalid cron expression`);return}Se(!0);try{let e={name:R.trim(),description:B.trim()||void 0};V===`directory_watch`?e.sourceConfig={path:H.trim(),stability_delay_ms:5e3}:V===`cron`&&(e.sourceConfig={cron:W.trim()}),await o(`/event-defs/${I}`,{method:`PATCH`,body:JSON.stringify(e)}),L(null),$(),d.success(`Event updated`)}catch(e){let t=e instanceof Error?e.message:`Failed to update event`;d.error(t)}finally{Se(!1)}}},ke=async e=>{try{await o(`/event-defs/${e.id}`,{method:`PATCH`,body:JSON.stringify({enabled:!e.enabled})}),$()}catch(e){let t=e instanceof Error?e.message:`Failed to toggle`;d.error(t)}},Ae=async e=>{try{await o(`/event-defs/${e}`,{method:`DELETE`}),Y(null),$(),d.success(`Event deleted`)}catch(e){let t=e instanceof Error?e.message:`Failed to delete`;d.error(t)}},je=async e=>{Te(!0);try{let t={};if(Q.trim())try{t.payload=JSON.parse(Q)}catch{t.payload={raw:Q}}await o(`/event-defs/${e}/fire`,{method:`POST`,body:JSON.stringify(t)}),Z(null),Ce(``),d.success(`Event fired`)}catch(e){let t=e instanceof Error?e.message:`Failed to fire event`;d.error(t)}finally{Te(!1)}},Me=r.find(e=>e.id===J);return(0,v.jsxs)(`div`,{className:`space-y-4`,children:[(0,v.jsx)(le,{title:`Events`,description:`Event definitions that trigger automations. Configure webhooks, schedules, or file watchers.`,compact:!0,action:(0,v.jsxs)(`div`,{className:`flex gap-2`,children:[(0,v.jsx)(a,{variant:`ghost`,size:`sm`,onClick:()=>void $(),children:(0,v.jsx)(re,{size:14})}),(0,v.jsxs)(a,{size:`sm`,onClick:()=>S(!_e),children:[(0,v.jsx)(n,{size:14}),`New Event`]})]})}),_e&&(0,v.jsxs)(p,{className:`space-y-3`,children:[(0,v.jsx)(`span`,{className:`text-sm font-medium text-[var(--app-text)]`,children:`New Event`}),(0,v.jsx)(`input`,{className:`w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-sm text-[var(--app-text)] placeholder:text-[var(--app-text-subtle)] focus:border-[var(--app-accent)] focus:outline-none`,placeholder:`Event name`,value:C,onChange:e=>w(e.target.value)}),(0,v.jsx)(`input`,{className:`w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-sm text-[var(--app-text)] placeholder:text-[var(--app-text-subtle)] focus:border-[var(--app-accent)] focus:outline-none`,placeholder:`Description (optional)`,value:E,onChange:e=>D(e.target.value)}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(`span`,{className:`text-xs text-[var(--app-text-muted)]`,children:`Source:`}),(0,v.jsxs)(`select`,{className:`rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-sm text-[var(--app-text)] focus:border-[var(--app-accent)] focus:outline-none`,value:T,onChange:e=>ve(e.target.value),children:[(0,v.jsx)(`option`,{value:`webhook`,children:`Webhook (HTTP)`}),(0,v.jsx)(`option`,{value:`cron`,children:`Schedule (Cron)`}),(0,v.jsx)(`option`,{value:`directory_watch`,children:`File Watcher`}),(0,v.jsx)(`option`,{value:`manual`,children:`Manual`})]})]}),T===`directory_watch`&&(0,v.jsx)(`input`,{className:`w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-sm text-[var(--app-text)] placeholder:text-[var(--app-text-subtle)] focus:border-[var(--app-accent)] focus:outline-none`,placeholder:`Watch directory path (absolute)`,value:O,onChange:e=>k(e.target.value)}),T===`cron`&&(0,v.jsxs)(`div`,{className:`space-y-1`,children:[(0,v.jsx)(`input`,{className:`w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-sm text-[var(--app-text)] placeholder:text-[var(--app-text-subtle)] focus:border-[var(--app-accent)] focus:outline-none`,placeholder:`Cron expression (minute hour day month weekday)`,value:A,onChange:e=>{j(e.target.value),N(``)}}),M&&(0,v.jsx)(`p`,{className:`text-xs text-[var(--app-danger)]`,children:M})]}),(0,v.jsxs)(`div`,{className:`flex gap-2`,children:[(0,v.jsx)(a,{onClick:()=>void Ee(),disabled:P||!C.trim()||T===`directory_watch`&&!O.trim(),children:P?`Creating...`:`Create`}),(0,v.jsx)(a,{variant:`ghost`,onClick:()=>S(!1),children:`Cancel`})]})]}),I!==null&&(r.find(e=>e.id===I)?(0,v.jsxs)(p,{className:`space-y-3`,children:[(0,v.jsx)(`span`,{className:`text-sm font-medium text-[var(--app-text)]`,children:`Edit Event`}),(0,v.jsx)(`input`,{className:`w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-sm text-[var(--app-text)] placeholder:text-[var(--app-text-subtle)] focus:border-[var(--app-accent)] focus:outline-none`,placeholder:`Event name`,value:R,onChange:e=>z(e.target.value)}),(0,v.jsx)(`input`,{className:`w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-sm text-[var(--app-text)]`,placeholder:`Description (optional)`,value:B,onChange:e=>ye(e.target.value)}),V===`directory_watch`&&(0,v.jsx)(`input`,{className:`w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-sm text-[var(--app-text)]`,placeholder:`Watch directory path`,value:H,onChange:e=>U(e.target.value)}),V===`cron`&&(0,v.jsxs)(`div`,{className:`space-y-1`,children:[(0,v.jsx)(`input`,{className:`w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-sm text-[var(--app-text)]`,placeholder:`Cron expression`,value:W,onChange:e=>{G(e.target.value),q(``)}}),K&&(0,v.jsx)(`p`,{className:`text-xs text-[var(--app-danger)]`,children:K})]}),(0,v.jsxs)(`div`,{className:`flex gap-2`,children:[(0,v.jsx)(a,{onClick:()=>void Oe(),disabled:xe||!R.trim(),children:xe?`Saving...`:`Save`}),(0,v.jsx)(a,{variant:`ghost`,onClick:()=>L(null),children:`Cancel`})]})]}):null),(0,v.jsx)(p,{padding:!1,children:b?(0,v.jsx)(`div`,{className:`flex items-center justify-center p-8`,children:(0,v.jsx)(`div`,{className:`h-6 w-6 animate-spin rounded-full border-2 border-[var(--app-border)] border-t-[var(--app-accent)]`})}):r.length===0?(0,v.jsx)(de,{icon:(0,v.jsx)(ne,{size:32}),title:`No events`,description:`Events are triggered by webhooks, schedules, or file changes and can start automations.`}):(0,v.jsxs)(me,{children:[(0,v.jsx)(fe,{children:(0,v.jsxs)(h,{children:[(0,v.jsx)(m,{children:`Name`}),(0,v.jsx)(m,{children:`Source`}),(0,v.jsx)(m,{children:`Enabled`}),(0,v.jsx)(m,{children:`Last Fired`}),(0,v.jsx)(m,{children:`Actions`})]})}),(0,v.jsx)(pe,{children:r.map(n=>(0,v.jsxs)(h,{children:[(0,v.jsxs)(g,{children:[(0,v.jsx)(`button`,{type:`button`,onClick:()=>e(`/events/${n.id}`),className:`font-medium text-[var(--app-text)] hover:text-[var(--app-accent)] transition-colors text-left`,children:n.name}),n.description&&(0,v.jsx)(`div`,{className:`text-xs text-[var(--app-text-muted)] truncate max-w-[200px]`,children:n.description})]}),(0,v.jsx)(g,{children:(0,v.jsx)(se,{variant:ge[n.sourceType],children:n.sourceType===`directory_watch`?`file watcher`:n.sourceType})}),(0,v.jsx)(g,{children:(0,v.jsx)(he,{checked:n.enabled,onCheckedChange:()=>void ke(n),"aria-label":`Toggle ${n.name}`})}),(0,v.jsx)(g,{className:`text-xs text-[var(--app-text-muted)]`,children:n.lastFiredAt?ue(n.lastFiredAt):`—`}),(0,v.jsx)(g,{children:(0,v.jsxs)(`div`,{className:`flex gap-1`,children:[(0,v.jsx)(a,{variant:`ghost`,size:`sm`,onClick:()=>De(n),title:`Edit`,children:(0,v.jsx)(t,{size:12})}),n.sourceType===`manual`&&n.enabled&&(0,v.jsx)(a,{variant:`ghost`,size:`sm`,onClick:()=>Z(n.id),title:`Fire now`,children:(0,v.jsx)(ee,{size:12})}),(0,v.jsx)(a,{variant:`ghost`,size:`sm`,className:`text-[var(--app-danger)] hover:text-[var(--app-danger-soft-text)]`,onClick:()=>Y(n.id),title:`Delete`,children:(0,v.jsx)(te,{size:12})})]})})]},n.id))})]})}),(0,v.jsx)(f,{open:X!==null,onOpenChange:e=>{e||Z(null)},children:(0,v.jsxs)(u,{children:[(0,v.jsxs)(l,{children:[(0,v.jsx)(ce,{children:`Fire Event`}),(0,v.jsx)(oe,{children:`Fire the manual event immediately. Optionally provide a JSON payload.`})]}),(0,v.jsx)(`textarea`,{className:`w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-2 text-sm text-[var(--app-text)] placeholder='{}' focus:border-[var(--app-accent)] focus:outline-none font-mono`,rows:4,placeholder:`{"key": "value"}`,value:Q,onChange:e=>Ce(e.target.value)}),(0,v.jsxs)(s,{children:[(0,v.jsx)(ae,{children:`Cancel`}),(0,v.jsx)(c,{onClick:()=>{X&&je(X),Z(null)},disabled:we,children:we?`Firing...`:`Fire Event`})]})]})}),(0,v.jsx)(f,{open:J!==null,onOpenChange:e=>{e||Y(null)},children:(0,v.jsxs)(u,{children:[(0,v.jsxs)(l,{children:[(0,v.jsx)(ce,{children:`Delete Event`}),(0,v.jsxs)(oe,{children:[`Delete “`,Me?.name,`”? This action cannot be undone.`]})]}),(0,v.jsxs)(s,{children:[(0,v.jsx)(ae,{children:`Cancel`}),(0,v.jsx)(c,{className:`bg-[var(--app-danger)] hover:bg-[var(--app-danger)]`,onClick:()=>{J&&Ae(J)},children:`Delete`})]})]})})]})}export{b as Events};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{D as t,E as n,S as r,T as i,l as a,lt as o,n as s,s as c,y as l}from"./vendor-icons-jzPiR6xl.js";import{t as u}from"./vendor-react-CIkiuNDu.js";import"./es2015-DCW7LI8d.js";import{t as d}from"./Button-VPwTNGpF.js";import{t as f}from"./api-D-UzHSDq.js";import{a as p,c as m,d as ee,f as h,i as te,l as g,n as _,o as v,p as y,r as ne,s as b,t as x,u as re}from"./index-Bl-2p6d8.js";import{i as S,r as C,t as w}from"./Card-C2N6k4gh.js";import{t as T}from"./PageHeader-D9lLjo0N.js";import{n as E,t as D}from"./format-BUYXZqDw.js";import{t as O}from"./EmptyState-CWS9PJND.js";var k=e(o(),1),A=u();function j({value:e,onChange:t,label:n=`Delivery Targets`}){let[r,i]=(0,k.useState)([]),[a,o]=(0,k.useState)(!1);(0,k.useEffect)(()=>{let e=!1;return Promise.all([f(`/channels`).catch(()=>({channels:[]})),f(`/chat/sessions`).catch(()=>({sessions:[]}))]).then(([t,n])=>{if(e)return;let r=new Map(t.channels.map(e=>[e.id,e])),a=[];for(let e of n.sessions)if(e.source.type===`channel`&&e.source.channelId&&e.source.chatId){let t=r.get(e.source.channelId);a.push({id:e.id,channelId:e.source.channelId,channelName:t?.name??e.source.channelId.slice(0,8),platform:t?.platform??`unknown`,chatId:e.source.chatId})}let o=new Set;i(a.filter(e=>{let t=`${e.channelId}:${e.chatId}`;return o.has(t)?!1:(o.add(t),!0)}))}),()=>{e=!0}},[]);let s=(t,n)=>e.some(e=>e.type===`channel`&&e.channelId===t&&e.chatId===n),c=(n,r)=>{s(n,r)?t(e.filter(e=>!(e.type===`channel`&&e.channelId===n&&e.chatId===r))):t([...e,{type:`channel`,channelId:n,chatId:r}])},l=e.filter(e=>e.type===`channel`).length;return(0,A.jsxs)(`div`,{className:`relative`,children:[(0,A.jsx)(`label`,{className:`text-xs text-[var(--app-text-muted)]`,children:n}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>o(!a),className:`mt-1 w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-1.5 text-left text-sm text-[var(--app-text)] hover:border-[var(--app-border-strong)] focus:border-[var(--app-accent)] focus:outline-none`,children:l===0?`Default (current session)`:`${l} channel${l>1?`s`:``} selected`}),a&&(0,A.jsxs)(`div`,{className:`absolute z-10 mt-1 w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] py-1 shadow-lg`,children:[r.length===0?(0,A.jsx)(`div`,{className:`px-3 py-2 text-xs text-[var(--app-text-subtle)]`,children:`No active channel conversations. Start a chat on WeChat/Telegram first.`}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:`px-3 py-1 text-xs text-[var(--app-text-subtle)]`,children:`Channel conversations`}),r.map(e=>(0,A.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 px-3 py-1.5 text-xs text-[var(--app-text)] hover:bg-[var(--app-panel-muted)]`,children:[(0,A.jsx)(`input`,{type:`checkbox`,checked:s(e.channelId,e.chatId),onChange:()=>c(e.channelId,e.chatId),className:`rounded border-[var(--app-border-strong)] bg-[var(--app-panel-muted)]`}),(0,A.jsx)(`span`,{className:`truncate font-medium`,children:e.channelName}),(0,A.jsxs)(`span`,{className:`text-[var(--app-text-subtle)]`,children:[`(`,e.platform,`)`]})]},`${e.channelId}:${e.chatId}`))]}),l>0&&(0,A.jsx)(`button`,{type:`button`,onClick:()=>{t([]),o(!1)},className:`mt-1 w-full border-t border-[var(--app-border)] px-3 py-1 text-left text-xs text-[var(--app-danger)] hover:bg-[var(--app-panel-muted)]`,children:`Clear all`}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>o(!1),className:`w-full border-t border-[var(--app-border)] px-3 py-1 text-left text-xs text-[var(--app-text-subtle)] hover:bg-[var(--app-panel-muted)]`,children:`Done`})]})]})}var M={active:`paused`,paused:`active`,completed:`active`,failed:`active`},N={active:(0,A.jsx)(t,{size:12}),paused:(0,A.jsx)(i,{size:12}),completed:(0,A.jsx)(l,{size:12}),failed:(0,A.jsx)(l,{size:12})};function P(){let e=h(e=>e.goals),t=h(e=>e.fetchGoals),o=h(e=>e.updateGoal),u=h(e=>e.deleteGoal),[P,F]=(0,k.useState)(!1),[I,L]=(0,k.useState)(``),[R,z]=(0,k.useState)(!1),[B,V]=(0,k.useState)(null),[H,U]=(0,k.useState)(null),[W,G]=(0,k.useState)(``),[K,q]=(0,k.useState)(``),[J,Y]=(0,k.useState)([]),[X,Z]=(0,k.useState)([]),[Q,ie]=(0,k.useState)([]),[$,ae]=(0,k.useState)([]),oe=e.filter(e=>e.status===`active`).length,se=e.filter(e=>e.status===`paused`).length,ce=e.filter(e=>e.status===`completed`).length;(0,k.useEffect)(()=>{t();let e=setInterval(()=>void t(),1e4);return()=>clearInterval(e)},[t]);let le=async()=>{if(I.trim()){z(!0),V(null);try{await f(`/goals`,{method:`POST`,body:JSON.stringify({input:I.trim(),deliverTo:Q.length>0?Q:void 0,reportTo:$.length>0?$:void 0})}),L(``),F(!1),t()}catch(e){V(e instanceof Error?e.message:`Failed to create goal`)}finally{z(!1)}}};return(0,A.jsxs)(`div`,{className:`space-y-4`,children:[(0,A.jsx)(T,{eyebrow:`Operations`,title:`Goals`,compact:!0,description:`Long-running outcomes, budgets, and delivery targets.`,metrics:[{label:`Active`,value:oe},{label:`Paused`,value:se},{label:`Completed`,value:ce}],actions:(0,A.jsxs)(`div`,{className:`flex gap-2`,children:[(0,A.jsx)(d,{variant:`ghost`,size:`sm`,onClick:()=>void t(),children:(0,A.jsx)(l,{size:14})}),(0,A.jsxs)(d,{size:`sm`,onClick:()=>F(!P),children:[(0,A.jsx)(r,{size:14}),`New Goal`]})]})}),P&&(0,A.jsxs)(w,{className:`space-y-3`,children:[(0,A.jsx)(`textarea`,{className:`w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-3 py-2 text-sm text-[var(--app-text)] placeholder:text-[var(--app-text-subtle)] focus:border-[var(--app-accent)] focus:outline-none`,placeholder:`Describe your goal in natural language...`,rows:3,value:I,onChange:e=>L(e.target.value)}),(0,A.jsx)(j,{value:Q,onChange:ie,label:`Deliver To (results)`}),(0,A.jsx)(j,{value:$,onChange:ae,label:`Report To (status)`}),B&&(0,A.jsx)(`p`,{className:`text-xs text-[var(--app-danger)]`,children:B}),(0,A.jsxs)(`div`,{className:`flex gap-2`,children:[(0,A.jsx)(d,{onClick:()=>void le(),disabled:R||!I.trim(),children:R?`Creating...`:`Create`}),(0,A.jsx)(d,{variant:`ghost`,onClick:()=>F(!1),children:`Cancel`})]})]}),e.length===0?(0,A.jsx)(O,{icon:(0,A.jsx)(a,{size:32}),title:`No goals`,description:`Create a goal to start goal-driven task orchestration`}):(0,A.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:e.map(e=>{let t=e.targetValue>0?Math.min(100,Math.round(e.currentValue/e.targetValue*100)):0,r=new Date(e.deadline).getTime()<Date.now()&&e.status!==`completed`,a=H===e.id;return(0,A.jsxs)(w,{children:[(0,A.jsxs)(C,{children:[a?(0,A.jsx)(`input`,{className:`flex-1 rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-2 py-1 text-sm text-[var(--app-text)] focus:border-[var(--app-accent)] focus:outline-none`,value:W,onChange:e=>G(e.target.value),autoFocus:!0}):(0,A.jsx)(S,{className:`max-w-full text-[var(--app-text)] text-sm font-medium truncate sm:max-w-[180px]`,children:e.name}),(0,A.jsx)(x,{variant:_(e.status),children:e.status})]}),a?(0,A.jsx)(`textarea`,{className:`w-full rounded-md border border-[var(--app-border)] bg-[var(--app-panel-elevated)] px-2 py-1 text-xs text-[var(--app-text)] placeholder:text-[var(--app-text-subtle)] focus:border-[var(--app-accent)] focus:outline-none mb-3`,placeholder:`Description...`,rows:2,value:K,onChange:e=>q(e.target.value)}):e.description?(0,A.jsx)(`p`,{className:`text-xs text-[var(--app-text-muted)] mb-3 line-clamp-2`,children:e.description}):null,a&&(0,A.jsxs)(`div`,{className:`mb-3 space-y-2`,children:[(0,A.jsx)(j,{value:J,onChange:Y,label:`Deliver To (results)`}),(0,A.jsx)(j,{value:X,onChange:Z,label:`Report To (status)`})]}),(0,A.jsxs)(`div`,{className:`mb-3`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,A.jsx)(`span`,{className:`text-xs text-[var(--app-text-subtle)]`,children:`Progress`}),(0,A.jsxs)(`span`,{className:`font-mono text-xs text-[var(--app-text)]`,children:[t,`%`]})]}),(0,A.jsx)(`div`,{className:`h-1.5 rounded-full bg-[var(--app-panel-elevated)]`,children:(0,A.jsx)(`div`,{className:`h-full rounded-full transition-[width] ${t>=100?`bg-[var(--app-success)]`:`bg-[var(--app-accent)]`}`,style:{width:`${t}%`}})}),(0,A.jsxs)(`div`,{className:`flex items-center justify-between mt-1`,children:[(0,A.jsxs)(`span`,{className:`font-mono text-[10px] text-[var(--app-text-subtle)]`,children:[e.currentValue,` / `,e.targetValue]}),(0,A.jsx)(`span`,{className:`font-mono text-[10px] text-[var(--app-text-subtle)]`,children:e.metricType})]})]}),(0,A.jsxs)(`div`,{className:`space-y-1.5 text-xs`,children:[(0,A.jsxs)(`div`,{className:`flex justify-between`,children:[(0,A.jsx)(`span`,{className:`text-[var(--app-text-subtle)]`,children:`Role`}),(0,A.jsx)(x,{variant:`muted`,className:`text-[10px]`,children:e.roleId})]}),(0,A.jsxs)(`div`,{className:`flex justify-between`,children:[(0,A.jsx)(`span`,{className:`text-[var(--app-text-subtle)]`,children:`Budget`}),(0,A.jsx)(`span`,{className:`font-mono text-[var(--app-text)]`,children:D(e.budgetUsd)})]}),(0,A.jsxs)(`div`,{className:`flex justify-between`,children:[(0,A.jsx)(`span`,{className:`text-[var(--app-text-subtle)] ${r?`text-[var(--app-danger)]`:``}`,children:`Deadline`}),(0,A.jsx)(`span`,{className:`text-[var(--app-text)] ${r?`text-[var(--app-danger)]`:``}`,children:E(e.deadline)})]}),(0,A.jsxs)(`div`,{className:`flex justify-between`,children:[(0,A.jsx)(`span`,{className:`text-[var(--app-text-subtle)]`,children:`Created`}),(0,A.jsx)(`span`,{className:`text-[var(--app-text-muted)]`,children:E(e.createdAt)})]})]}),(0,A.jsx)(`div`,{className:`flex items-center gap-1 mt-3 pt-3 border-t border-[var(--app-border)]`,children:a?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(d,{size:`sm`,variant:`ghost`,onClick:async()=>{try{await o(e.id,{name:W,description:K,deliverTo:J,reportTo:X}),U(null),y.success(`Goal updated`)}catch(e){y.error(e instanceof Error?e.message:`Failed to update`)}},children:`Save`}),(0,A.jsx)(d,{size:`sm`,variant:`ghost`,onClick:()=>U(null),children:(0,A.jsx)(s,{size:14})})]}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(d,{size:`sm`,variant:`ghost`,title:`Edit`,onClick:()=>{U(e.id),G(e.name),q(e.description??``),Y(e.deliverTo??[]),Z(e.reportTo??[])},children:(0,A.jsx)(n,{size:14})}),(0,A.jsxs)(d,{size:`sm`,variant:`ghost`,title:`Change to ${M[e.status]}`,onClick:async()=>{try{await o(e.id,{status:M[e.status]}),y.success(`Status changed to ${M[e.status]}`)}catch(e){y.error(e instanceof Error?e.message:`Failed to update status`)}},children:[N[e.status]??(0,A.jsx)(i,{size:12}),(0,A.jsx)(`span`,{className:`text-xs`,children:M[e.status]})]}),(0,A.jsx)(`div`,{className:`ml-auto`,children:(0,A.jsxs)(ne,{children:[(0,A.jsx)(ee,{asChild:!0,children:(0,A.jsx)(d,{size:`sm`,variant:`ghost`,title:`Delete`,className:`text-[var(--app-danger)] hover:text-[var(--app-danger-soft-text)]`,children:(0,A.jsx)(c,{size:14})})}),(0,A.jsxs)(v,{children:[(0,A.jsxs)(g,{children:[(0,A.jsx)(re,{children:`Delete goal`}),(0,A.jsxs)(b,{children:[`This will permanently delete "`,e.name,`". This action cannot be undone.`]})]}),(0,A.jsxs)(m,{children:[(0,A.jsx)(p,{children:`Cancel`}),(0,A.jsx)(te,{className:`bg-[var(--app-danger)] hover:bg-[var(--app-danger-strong)]`,onClick:async()=>{try{await u(e.id),y.success(`Goal deleted`)}catch(e){y.error(e instanceof Error?e.message:`Failed to delete`)}},children:`Delete`})]})]})]})})]})})]},e.id)})})]})}export{P as Goals,j as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{G as t,K as n,M as r,R as i,S as a,X as o,et as s,g as c,lt as l,n as u,nt as d,rt as f,tt as p,x as ee,y as m}from"./vendor-icons-jzPiR6xl.js";import{t as te}from"./vendor-react-CIkiuNDu.js";import{n as h}from"./dist-CgGno8kE.js";import{_ as g,a as ne,c as _,d as v,f as y,i as re,m as b,n as ie,o as x,p as S,r as C,s as w,t as ae,u as oe,v as T}from"./es2015-DCW7LI8d.js";import{i as E,r as D,t as O}from"./Button-VPwTNGpF.js";import{t as k}from"./api-D-UzHSDq.js";import{S as A,_ as se,b as ce,g as j,h as M,m as le,p as N,t as P,v as ue,x as F,y as de}from"./index-Bl-2p6d8.js";import{t as I}from"./Card-C2N6k4gh.js";import{t as fe}from"./PageHeader-D9lLjo0N.js";import{t as pe}from"./SectionHeader-BB3H3F_P.js";import{a as me}from"./format-BUYXZqDw.js";import{t as he}from"./EmptyState-CWS9PJND.js";import{t as L}from"./ui-CerQw0jA.js";import{a as ge,i as R,n as _e,o as z,r as B,t as ve}from"./Table-D4lT5uHx.js";import{n as ye,r as be,t as xe}from"./usePluginsWithUsage-CSQr03vZ.js";import{a as Se,c as Ce,i as we,l as Te,n as Ee,o as De,r as Oe,s as ke,t as Ae}from"./Tabs-CwzWpI-7.js";var V=e(l(),1),H=te();function je(){let[e,t]=(0,V.useState)(!1),[n,r]=(0,V.useState)([]),i=(0,V.useCallback)(async()=>{try{r((await k(`/plugins/stats?limit=20`)).stats)}catch{r([])}},[]);return(0,H.jsxs)(I,{children:[(0,H.jsxs)(`button`,{className:`flex w-full items-center gap-2 text-sm font-semibold text-[var(--app-text)]`,onClick:()=>{!e&&n.length===0&&i(),t(e=>!e)},children:[(0,H.jsx)(f,{size:L.sm,className:`text-[var(--app-text-muted)]`}),`Usage Stats`,e?(0,H.jsx)(p,{size:L.xs,className:`ml-auto`}):(0,H.jsx)(s,{size:L.xs,className:`ml-auto`})]}),e?(0,H.jsx)(`div`,{className:`mt-3`,children:n.length===0?(0,H.jsx)(`p`,{className:`py-2 text-center text-xs text-[var(--app-text-subtle)]`,children:`No usage data yet`}):(0,H.jsxs)(ve,{children:[(0,H.jsx)(ge,{children:(0,H.jsxs)(z,{children:[(0,H.jsx)(R,{children:`Plugin`}),(0,H.jsx)(R,{children:`Usage Count`}),(0,H.jsx)(R,{children:`Last Used`})]})}),(0,H.jsx)(_e,{children:n.map(e=>(0,H.jsxs)(z,{children:[(0,H.jsx)(B,{className:`text-xs font-medium text-[var(--app-text)]`,children:e.pluginName}),(0,H.jsx)(B,{className:`font-mono text-xs text-[var(--app-text-muted)]`,children:e.usageCount}),(0,H.jsx)(B,{className:`text-xs text-[var(--app-text-muted)]`,children:e.lastUsed?me(e.lastUsed):`—`})]},e.pluginPath))})]})}):null]})}var Me=[`Enter`,` `],Ne=[`ArrowDown`,`PageUp`,`Home`],Pe=[`ArrowUp`,`PageDown`,`End`],Fe=[...Ne,...Pe],Ie={ltr:[...Me,`ArrowRight`],rtl:[...Me,`ArrowLeft`]},Le={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},U=`Menu`,[W,Re,ze]=Te(U),[G,Be]=g(U,[ze,A,ke]),K=A(),Ve=ke(),[He,q]=G(U),[Ue,J]=G(U),We=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=K(t),[c,l]=V.useState(null),u=V.useRef(!1),d=v(a),f=Ce(i);return V.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,H.jsx)(F,{...s,children:(0,H.jsx)(He,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,H.jsx)(Ue,{scope:t,onClose:V.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};We.displayName=U;var Ge=`MenuAnchor`,Ke=V.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=K(n);return(0,H.jsx)(ue,{...i,...r,ref:t})});Ke.displayName=Ge;var qe=`MenuPortal`,[Je,Ye]=G(qe,{forceMount:void 0}),Xe=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=q(qe,t);return(0,H.jsx)(Je,{scope:t,forceMount:n,children:(0,H.jsx)(x,{present:n||a.open,children:(0,H.jsx)(w,{asChild:!0,container:i,children:r})})})};Xe.displayName=qe;var Y=`MenuContent`,[Ze,Qe]=G(Y),$e=V.forwardRef((e,t)=>{let n=Ye(Y,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=q(Y,e.__scopeMenu),o=J(Y,e.__scopeMenu);return(0,H.jsx)(W.Provider,{scope:e.__scopeMenu,children:(0,H.jsx)(x,{present:r||a.open,children:(0,H.jsx)(W.Slot,{scope:e.__scopeMenu,children:o.modal?(0,H.jsx)(et,{...i,ref:t}):(0,H.jsx)(tt,{...i,ref:t})})})})}),et=V.forwardRef((e,t)=>{let n=q(Y,e.__scopeMenu),r=V.useRef(null),i=E(t,r);return V.useEffect(()=>{let e=r.current;if(e)return ae(e)},[]),(0,H.jsx)(rt,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:T(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),tt=V.forwardRef((e,t)=>{let n=q(Y,e.__scopeMenu);return(0,H.jsx)(rt,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),nt=b(`MenuContent.ScrollLock`),rt=V.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:ee,...m}=e,te=q(Y,n),h=J(Y,n),g=K(n),ne=Ve(n),_=Re(n),[v,y]=V.useState(null),b=V.useRef(null),x=E(t,b,te.onContentChange),S=V.useRef(0),w=V.useRef(``),ae=V.useRef(0),D=V.useRef(null),O=V.useRef(`right`),k=V.useRef(0),A=ee?ie:V.Fragment,se=ee?{as:nt,allowPinchZoom:!0}:void 0,j=e=>{let t=w.current+e,n=_().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=Bt(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){w.current=t,window.clearTimeout(S.current),t!==``&&(S.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};V.useEffect(()=>()=>window.clearTimeout(S.current),[]),C();let M=V.useCallback(e=>O.current===D.current?.side&&Ht(e,D.current?.area),[]);return(0,H.jsx)(Ze,{scope:n,searchRef:w,onItemEnter:V.useCallback(e=>{M(e)&&e.preventDefault()},[M]),onItemLeave:V.useCallback(e=>{M(e)||(b.current?.focus(),y(null))},[M]),onTriggerLeave:V.useCallback(e=>{M(e)&&e.preventDefault()},[M]),pointerGraceTimerRef:ae,onPointerGraceIntentChange:V.useCallback(e=>{D.current=e},[]),children:(0,H.jsx)(A,{...se,children:(0,H.jsx)(re,{asChild:!0,trapped:i,onMountAutoFocus:T(a,e=>{e.preventDefault(),b.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,H.jsx)(oe,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,H.jsx)(De,{asChild:!0,...ne,dir:h.dir,orientation:`vertical`,loop:r,currentTabStopId:v,onCurrentTabStopIdChange:y,onEntryFocus:T(c,e=>{h.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,H.jsx)(ce,{role:`menu`,"aria-orientation":`vertical`,"data-state":Ft(te.open),"data-radix-menu-content":``,dir:h.dir,...g,...m,ref:x,style:{outline:`none`,...m.style},onKeyDown:T(m.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&j(e.key));let i=b.current;if(e.target!==i||!Fe.includes(e.key))return;e.preventDefault();let a=_().filter(e=>!e.disabled).map(e=>e.ref.current);Pe.includes(e.key)&&a.reverse(),Rt(a)}),onBlur:T(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(S.current),w.current=``)}),onPointerMove:T(e.onPointerMove,Z(e=>{let t=e.target,n=k.current!==e.clientX;e.currentTarget.contains(t)&&n&&(O.current=e.clientX>k.current?`right`:`left`,k.current=e.clientX)}))})})})})})})});$e.displayName=Y;var it=`MenuGroup`,at=V.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,H.jsx)(y.div,{role:`group`,...r,ref:t})});at.displayName=it;var ot=`MenuLabel`,st=V.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,H.jsx)(y.div,{...r,ref:t})});st.displayName=ot;var ct=`MenuItem`,lt=`menu.itemSelect`,ut=V.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=V.useRef(null),o=J(ct,e.__scopeMenu),s=Qe(ct,e.__scopeMenu),c=E(t,a),l=V.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(lt,{bubbles:!0,cancelable:!0});e.addEventListener(lt,e=>r?.(e),{once:!0}),S(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,H.jsx)(dt,{...i,ref:c,disabled:n,onClick:T(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:T(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:T(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||Me.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});ut.displayName=ct;var dt=V.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=Qe(ct,n),s=Ve(n),c=V.useRef(null),l=E(t,c),[u,d]=V.useState(!1),[f,p]=V.useState(``);return V.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,H.jsx)(W.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,H.jsx)(Se,{asChild:!0,...s,focusable:!r,children:(0,H.jsx)(y.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:T(e.onPointerMove,Z(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:T(e.onPointerLeave,Z(e=>o.onItemLeave(e))),onFocus:T(e.onFocus,()=>d(!0)),onBlur:T(e.onBlur,()=>d(!1))})})})}),ft=`MenuCheckboxItem`,pt=V.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,H.jsx)(xt,{scope:e.__scopeMenu,checked:n,children:(0,H.jsx)(ut,{role:`menuitemcheckbox`,"aria-checked":It(n)?`mixed`:n,...i,ref:t,"data-state":Lt(n),onSelect:T(i.onSelect,()=>r?.(It(n)?!0:!n),{checkForDefaultPrevented:!1})})})});pt.displayName=ft;var mt=`MenuRadioGroup`,[ht,gt]=G(mt,{value:void 0,onValueChange:()=>{}}),_t=V.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=v(r);return(0,H.jsx)(ht,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,H.jsx)(at,{...i,ref:t})})});_t.displayName=mt;var vt=`MenuRadioItem`,yt=V.forwardRef((e,t)=>{let{value:n,...r}=e,i=gt(vt,e.__scopeMenu),a=n===i.value;return(0,H.jsx)(xt,{scope:e.__scopeMenu,checked:a,children:(0,H.jsx)(ut,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":Lt(a),onSelect:T(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});yt.displayName=vt;var bt=`MenuItemIndicator`,[xt,St]=G(bt,{checked:!1}),Ct=V.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=St(bt,n);return(0,H.jsx)(x,{present:r||It(a.checked)||a.checked===!0,children:(0,H.jsx)(y.span,{...i,ref:t,"data-state":Lt(a.checked)})})});Ct.displayName=bt;var wt=`MenuSeparator`,Tt=V.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,H.jsx)(y.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});Tt.displayName=wt;var Et=`MenuArrow`,Dt=V.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=K(n);return(0,H.jsx)(de,{...i,...r,ref:t})});Dt.displayName=Et;var Ot=`MenuSub`,[kt,At]=G(Ot),jt=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=q(Ot,t),o=K(t),[s,c]=V.useState(null),[l,u]=V.useState(null),d=v(i);return V.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,H.jsx)(F,{...o,children:(0,H.jsx)(He,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,H.jsx)(kt,{scope:t,contentId:_(),triggerId:_(),trigger:s,onTriggerChange:c,children:n})})})};jt.displayName=Ot;var X=`MenuSubTrigger`,Mt=V.forwardRef((e,t)=>{let n=q(X,e.__scopeMenu),r=J(X,e.__scopeMenu),i=At(X,e.__scopeMenu),a=Qe(X,e.__scopeMenu),o=V.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=V.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return V.useEffect(()=>u,[u]),V.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,H.jsx)(Ke,{asChild:!0,...l,children:(0,H.jsx)(dt,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":Ft(n.open),...e,ref:D(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:T(e.onPointerMove,Z(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:T(e.onPointerLeave,Z(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:T(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||Ie[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});Mt.displayName=X;var Nt=`MenuSubContent`,Pt=V.forwardRef((e,t)=>{let n=Ye(Y,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=q(Y,e.__scopeMenu),o=J(Y,e.__scopeMenu),s=At(Nt,e.__scopeMenu),c=V.useRef(null),l=E(t,c);return(0,H.jsx)(W.Provider,{scope:e.__scopeMenu,children:(0,H.jsx)(x,{present:r||a.open,children:(0,H.jsx)(W.Slot,{scope:e.__scopeMenu,children:(0,H.jsx)(rt,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:T(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:T(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:T(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Le[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});Pt.displayName=Nt;function Ft(e){return e?`open`:`closed`}function It(e){return e===`indeterminate`}function Lt(e){return It(e)?`indeterminate`:e?`checked`:`unchecked`}function Rt(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function zt(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Bt(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=zt(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function Vt(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Ht(e,t){return t?Vt({x:e.clientX,y:e.clientY},t):!1}function Z(e){return t=>t.pointerType===`mouse`?e(t):void 0}var Ut=We,Wt=Ke,Gt=Xe,Kt=$e,qt=at,Jt=st,Yt=ut,Xt=pt,Zt=_t,Qt=yt,$t=Ct,en=Tt,tn=Dt,nn=Mt,rn=Pt,an=`DropdownMenu`,[on,sn]=g(an,[Be]),Q=Be(),[cn,ln]=on(an),un=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Q(t),l=V.useRef(null),[u,d]=ne({prop:i,defaultProp:a??!1,onChange:o,caller:an});return(0,H.jsx)(cn,{scope:t,triggerId:_(),triggerRef:l,contentId:_(),open:u,onOpenChange:d,onOpenToggle:V.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,H.jsx)(Ut,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};un.displayName=an;var dn=`DropdownMenuTrigger`,fn=V.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=ln(dn,n),o=Q(n);return(0,H.jsx)(Wt,{asChild:!0,...o,children:(0,H.jsx)(y.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:D(t,a.triggerRef),onPointerDown:T(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:T(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});fn.displayName=dn;var pn=`DropdownMenuPortal`,mn=e=>{let{__scopeDropdownMenu:t,...n}=e,r=Q(t);return(0,H.jsx)(Gt,{...r,...n})};mn.displayName=pn;var hn=`DropdownMenuContent`,gn=V.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=ln(hn,n),a=Q(n),o=V.useRef(!1);return(0,H.jsx)(Kt,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:T(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:T(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});gn.displayName=hn;var _n=`DropdownMenuGroup`,vn=V.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,H.jsx)(qt,{...i,...r,ref:t})});vn.displayName=_n;var yn=`DropdownMenuLabel`,bn=V.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,H.jsx)(Jt,{...i,...r,ref:t})});bn.displayName=yn;var xn=`DropdownMenuItem`,Sn=V.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,H.jsx)(Yt,{...i,...r,ref:t})});Sn.displayName=xn;var Cn=`DropdownMenuCheckboxItem`,wn=V.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,H.jsx)(Xt,{...i,...r,ref:t})});wn.displayName=Cn;var Tn=`DropdownMenuRadioGroup`,En=V.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,H.jsx)(Zt,{...i,...r,ref:t})});En.displayName=Tn;var Dn=`DropdownMenuRadioItem`,On=V.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,H.jsx)(Qt,{...i,...r,ref:t})});On.displayName=Dn;var kn=`DropdownMenuItemIndicator`,An=V.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,H.jsx)($t,{...i,...r,ref:t})});An.displayName=kn;var jn=`DropdownMenuSeparator`,Mn=V.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,H.jsx)(en,{...i,...r,ref:t})});Mn.displayName=jn;var Nn=`DropdownMenuArrow`,Pn=V.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,H.jsx)(tn,{...i,...r,ref:t})});Pn.displayName=Nn;var Fn=`DropdownMenuSubTrigger`,In=V.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,H.jsx)(nn,{...i,...r,ref:t})});In.displayName=Fn;var Ln=`DropdownMenuSubContent`,Rn=V.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,H.jsx)(rn,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Rn.displayName=Ln;var zn=un,Bn=fn,Vn=mn,Hn=gn,Un=bn,Wn=Sn,Gn=wn,Kn=On,qn=An,Jn=Mn,Yn=In,Xn=Rn,Zn=zn,Qn=Bn,$n=V.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,H.jsxs)(Yn,{ref:i,className:h(`flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-[var(--app-panel-elevated)] data-[state=open]:bg-[var(--app-panel-elevated)] [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,t&&`pl-8`,e),...r,children:[n,(0,H.jsx)(s,{className:`ml-auto`})]}));$n.displayName=Yn.displayName;var er=V.forwardRef(({className:e,...t},n)=>(0,H.jsx)(Xn,{ref:n,className:h(`z-50 min-w-[8rem] overflow-hidden rounded-md border border-[var(--app-border)] bg-[var(--app-panel)] p-1 text-[var(--app-text)] shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...t}));er.displayName=Xn.displayName;var tr=V.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,H.jsx)(Vn,{children:(0,H.jsx)(Hn,{ref:r,sideOffset:t,className:h(`z-50 min-w-[8rem] overflow-hidden rounded-md border border-[var(--app-border)] bg-[var(--app-panel)] p-1 text-[var(--app-text)] shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n})}));tr.displayName=Hn.displayName;var $=V.forwardRef(({className:e,inset:t,...n},r)=>(0,H.jsx)(Wn,{ref:r,className:h(`relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-[var(--app-panel-elevated)] focus:text-[var(--app-text)] data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,t&&`pl-8`,e),...n}));$.displayName=Wn.displayName;var nr=V.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,H.jsxs)(Gn,{ref:i,className:h(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-[var(--app-panel-elevated)] focus:text-[var(--app-text)] data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),checked:n,...r,children:[(0,H.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,H.jsx)(qn,{children:(0,H.jsx)(d,{className:`h-4 w-4`})})}),t]}));nr.displayName=Gn.displayName;var rr=V.forwardRef(({className:e,children:t,...n},r)=>(0,H.jsxs)(Kn,{ref:r,className:h(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-[var(--app-panel-elevated)] focus:text-[var(--app-text)] data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,H.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,H.jsx)(qn,{children:(0,H.jsx)(o,{className:`h-2 w-2 fill-current`})})}),t]}));rr.displayName=Kn.displayName;var ir=V.forwardRef(({className:e,inset:t,...n},r)=>(0,H.jsx)(Un,{ref:r,className:h(`px-2 py-1.5 text-sm font-semibold text-[var(--app-text)]`,t&&`pl-8`,e),...n}));ir.displayName=Un.displayName;var ar=V.forwardRef(({className:e,...t},n)=>(0,H.jsx)(Jn,{ref:n,className:h(`-mx-1 my-1 h-px bg-[var(--app-panel-elevated)]`,e),...t}));ar.displayName=Jn.displayName;var or=({className:e,...t})=>(0,H.jsx)(`span`,{className:h(`ml-auto text-xs tracking-widest text-[var(--app-text-subtle)]`,e),...t});or.displayName=`DropdownMenuShortcut`;function sr({plugin:e}){let t=e.manifest;if(!t)return null;let n=[];return t.skills.length>0&&n.push({label:`Skill(${t.skills.length})`,variant:`info`}),t.agents.length>0&&n.push({label:`Agent(${t.agents.length})`,variant:`success`}),t.mcpServers.length>0&&n.push({label:`MCP(${t.mcpServers.length})`,variant:`warning`}),t.hooks.length>0&&n.push({label:`Hook(${t.hooks.length})`,variant:`default`}),t.lspServers.length>0&&n.push({label:`LSP(${t.lspServers.length})`,variant:`default`}),n.length===0?null:(0,H.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:n.map(e=>(0,H.jsx)(P,{variant:e.variant,children:e.label},e.label))})}function cr({plugin:e,roles:n,onInstallToRole:i,onToggleGlobal:a,onUninstallUser:o,projectOperatingKey:s,userOperatingId:c}){let l=c===e.id;return(0,H.jsxs)(Zn,{modal:!1,children:[(0,H.jsx)(Qn,{asChild:!0,children:(0,H.jsx)(O,{variant:`ghost`,size:`sm`,className:`h-7 w-7 px-0`,"aria-label":`Manage ${e.name}`,children:l?(0,H.jsx)(r,{size:L.xs,className:`animate-spin`}):(0,H.jsx)(t,{size:L.sm})})}),(0,H.jsxs)(tr,{align:`end`,className:`min-w-[200px]`,children:[n.length>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ir,{className:`text-[10px] uppercase tracking-[0.14em] text-[var(--app-text-subtle)]`,children:`Add to Role`}),n.map(t=>{let n=e.usedByRoles.some(e=>e.roleId===t.id),a=s===`${e.id}:${t.workspacePath}`;return(0,H.jsxs)($,{disabled:a||n,onSelect:()=>{i(e.id,t.workspacePath)},children:[(0,H.jsx)(`span`,{className:`flex-1`,children:t.name}),a?(0,H.jsx)(r,{size:L.xs,className:`animate-spin`}):n?(0,H.jsx)(`span`,{className:`text-[10px] text-[var(--app-text-subtle)]`,children:`installed`}):null]},t.id)}),(0,H.jsx)(ar,{})]}):null,(0,H.jsx)($,{disabled:l,onSelect:()=>{a(e.id,!e.globalEnabled)},children:e.globalEnabled?`Disable`:`Enable`}),(0,H.jsx)($,{disabled:l,className:`text-[var(--app-danger)] focus:text-[var(--app-danger)]`,onSelect:()=>{o(e.id)},children:`Uninstall`})]})]})}function lr({plugin:e,roles:t,expandedContent:n,onInstallToRole:r,onToggleGlobal:i,onUninstallUser:a,projectOperatingKey:o,userOperatingId:c}){let[l,u]=(0,V.useState)(!1),d=e.usedByRoles.map(e=>`${e.roleName} (v${e.version})`).join(`, `)||`No Roles`;return(0,H.jsxs)(`div`,{className:`rounded border border-[var(--app-border)] px-3 py-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,H.jsx)(`button`,{className:`mt-0.5 text-[var(--app-text-subtle)] hover:text-[var(--app-text)]`,onClick:()=>u(e=>!e),"aria-label":l?`Collapse ${e.name}`:`Expand ${e.name}`,children:l?(0,H.jsx)(p,{size:L.xs}):(0,H.jsx)(s,{size:L.xs})}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`text-sm font-medium text-[var(--app-text)]`,children:e.name}),(0,H.jsxs)(`span`,{className:`text-xs text-[var(--app-text-muted)]`,children:[`v`,e.version]}),e.marketplace?(0,H.jsx)(P,{variant:`muted`,className:`text-[10px]`,children:e.marketplace}):null,(0,H.jsx)(j,{delayDuration:150,children:(0,H.jsxs)(le,{children:[(0,H.jsx)(se,{asChild:!0,children:(0,H.jsxs)(`button`,{className:`text-xs text-[var(--app-text-muted)] hover:text-[var(--app-text)]`,title:d,children:[e.usedByRoles.length,` `,e.usedByRoles.length===1?`Role`:`Roles`]})}),(0,H.jsx)(M,{children:d})]})})]}),(0,H.jsx)(sr,{plugin:e})]}),(0,H.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,H.jsx)(P,{variant:e.globalEnabled?`success`:`destructive`,children:e.globalEnabled?`User On`:`User Off`}),(0,H.jsx)(cr,{plugin:e,roles:t,onInstallToRole:r,onToggleGlobal:i,onUninstallUser:a,projectOperatingKey:o,userOperatingId:c})]})]}),l?(0,H.jsx)(`div`,{className:`mt-4 rounded-xl border border-[var(--app-border)] bg-black/10 p-3`,children:n}):null]})}function ur({label:e,value:t}){return(0,H.jsxs)(`div`,{className:`rounded-xl border border-[var(--app-border)] bg-black/10 px-3 py-2`,children:[(0,H.jsx)(`p`,{className:`text-[10px] uppercase tracking-[0.14em] text-[var(--app-text-subtle)]`,children:e}),(0,H.jsx)(`p`,{className:`mt-1 text-sm font-medium text-[var(--app-text)]`,children:t})]})}function dr({plugin:e}){return e.manifest?(0,H.jsxs)(`div`,{className:`space-y-4 text-xs`,children:[e.manifest.description?(0,H.jsx)(`p`,{className:`text-[var(--app-text-muted)]`,children:e.manifest.description}):null,(0,H.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-4`,children:[(0,H.jsx)(ur,{label:`Version`,value:e.version?`v${e.version}`:`—`}),(0,H.jsx)(ur,{label:`Scope`,value:e.scope}),(0,H.jsx)(ur,{label:`Capability Count`,value:e.manifest.skills.length+e.manifest.agents.length+e.manifest.mcpServers.length+e.manifest.hooks.length+e.manifest.lspServers.length}),(0,H.jsx)(ur,{label:`Activation`,value:e.globalEnabled?`User On`:`User Off`})]}),(0,H.jsxs)(`div`,{className:`rounded-xl border border-[var(--app-border)] bg-black/10 px-3 py-2`,children:[(0,H.jsx)(`p`,{className:`text-[10px] uppercase tracking-[0.14em] text-[var(--app-text-subtle)]`,children:`Install Path`}),(0,H.jsx)(`p`,{className:`mt-1 truncate font-mono text-[11px] text-[var(--app-text-muted)]`,title:e.installPath,children:e.installPath})]}),(0,H.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[e.manifest.skills.length>0?(0,H.jsxs)(`div`,{className:`rounded-xl border border-[var(--app-border)] bg-black/10 p-3`,children:[(0,H.jsx)(`div`,{className:`mb-2 font-semibold text-[var(--app-text)]`,children:`Skills`}),e.manifest.skills.map(e=>(0,H.jsxs)(`div`,{className:`inline-flex items-baseline gap-1 text-[var(--app-text-muted)]`,children:[(0,H.jsx)(`span`,{className:`text-[var(--app-text)]`,children:e.name}),e.description?(0,H.jsxs)(`span`,{className:`text-[var(--app-text-subtle)]`,children:[`; `,e.description]}):null]},e.name))]}):null,e.manifest.agents.length>0?(0,H.jsxs)(`div`,{className:`rounded-xl border border-[var(--app-border)] bg-black/10 p-3`,children:[(0,H.jsx)(`div`,{className:`mb-2 font-semibold text-[var(--app-text)]`,children:`Agents`}),e.manifest.agents.map(e=>(0,H.jsxs)(`div`,{className:`inline-flex items-baseline gap-1 text-[var(--app-text-muted)]`,children:[(0,H.jsx)(`span`,{className:`text-[var(--app-text)]`,children:e.name}),e.description?(0,H.jsxs)(`span`,{className:`text-[var(--app-text-subtle)]`,children:[`; `,e.description]}):null]},e.name))]}):null,e.manifest.mcpServers.length>0?(0,H.jsxs)(`div`,{className:`rounded-xl border border-[var(--app-border)] bg-black/10 p-3`,children:[(0,H.jsx)(`div`,{className:`mb-2 font-semibold text-[var(--app-text)]`,children:`MCP Servers`}),e.manifest.mcpServers.map(e=>(0,H.jsx)(`div`,{className:`text-[var(--app-text-muted)]`,children:e},e))]}):null,e.manifest.hooks.length>0?(0,H.jsxs)(`div`,{className:`rounded-xl border border-[var(--app-border)] bg-black/10 p-3`,children:[(0,H.jsx)(`div`,{className:`mb-2 font-semibold text-[var(--app-text)]`,children:`Hooks`}),e.manifest.hooks.map(e=>(0,H.jsx)(`div`,{className:`text-[var(--app-text-muted)]`,children:e},e))]}):null,e.manifest.lspServers.length>0?(0,H.jsxs)(`div`,{className:`rounded-xl border border-[var(--app-border)] bg-black/10 p-3`,children:[(0,H.jsx)(`div`,{className:`mb-2 font-semibold text-[var(--app-text)]`,children:`LSP Servers`}),e.manifest.lspServers.map(e=>(0,H.jsx)(`div`,{className:`text-[var(--app-text-muted)]`,children:e},e))]}):null]})]}):(0,H.jsx)(`p`,{className:`text-xs text-[var(--app-text-subtle)]`,children:`Loading manifest...`})}function fr(){let{userScope:e,projectScope:t,loading:o,error:s,refresh:l,rawPlugins:d,roles:f}=xe(),[te,h]=(0,V.useState)(`installed`),[g,ne]=(0,V.useState)([]),[_,v]=(0,V.useState)([]),[y,re]=(0,V.useState)(new Set),[b,ie]=(0,V.useState)(!1),[x,S]=(0,V.useState)(null),[C,w]=(0,V.useState)(``),[ae,oe]=(0,V.useState)(!1),[T,E]=(0,V.useState)(``),[D,A]=(0,V.useState)(null),[se,ce]=(0,V.useState)(null),{operatingKey:j,installToRole:M,uninstallFromRole:le,updateRoleVersion:ue}=ye(l),F=(0,V.useCallback)(async()=>{ie(!0),S(null);try{let[e,t]=await Promise.all([k(`/plugins/marketplace`).catch(()=>({available:[],installed:[]})),k(`/plugins/marketplaces`)]);v(e.available),re(new Set(e.installed.map(e=>e.id))),ne(t.sources)}catch(e){S(e instanceof Error?e.message:`Failed to load marketplace`)}finally{ie(!1)}},[]);(0,V.useEffect)(()=>{F()},[F]);let de=(0,V.useCallback)(async(e,t)=>{A(e);try{await k(`/plugins/${encodeURIComponent(e)}/${t?`enable`:`disable`}`,{method:`POST`}),N.success(`${e} ${t?`enabled`:`disabled`} globally`)}catch(e){N.error(e instanceof Error?e.message:`Failed to ${t?`enable`:`disable`} plugin`)}finally{await l(),A(null)}},[l]),me=(0,V.useCallback)(async e=>{A(e);try{await k(`/plugins/uninstall/${encodeURIComponent(e)}`,{method:`POST`}),N.success(`Plugin uninstalled`)}catch(e){N.error(e instanceof Error?e.message:`Uninstall failed`)}finally{await Promise.all([l(),F()]),A(null)}},[F,l]),Se=(0,V.useCallback)(async()=>{let e=T.trim();if(e)try{await k(`/plugins/marketplaces`,{method:`POST`,body:JSON.stringify({url:e})}),N.success(`Marketplace added`),E(``),oe(!1),await F()}catch(e){N.error(e instanceof Error?e.message:`Failed to add marketplace`)}},[F,T]),Ce=(0,V.useCallback)(async(e,t=`user`,n)=>{ce(e);try{await k(`/plugins/install/${encodeURIComponent(e)}`,{method:`POST`,body:JSON.stringify({scope:t,cwd:n})});let r=t===`project`&&n?`${e.split(`@`)[0]} for ${n.split(`/`).pop()}`:e.split(`@`)[0];N.success(`Installed ${r}`)}catch(e){N.error(e instanceof Error?e.message:`Install failed`)}finally{await Promise.all([l(),F()]),ce(null)}},[F,l]),Te=C?_.filter(e=>e.name.toLowerCase().includes(C.toLowerCase())||e.description.toLowerCase().includes(C.toLowerCase())):_,De=d.filter(e=>e.scope===`project`).length;return(0,H.jsxs)(`div`,{className:`space-y-5`,children:[(0,H.jsx)(fe,{eyebrow:`Capabilities`,title:`Plugins`,compact:!0,description:`Installed capabilities, scope, and activation.`,metrics:[{label:`Total`,value:d.length},{label:`Project Scope`,value:De},{label:`Catalog`,value:_.length}],actions:(0,H.jsx)(O,{variant:`ghost`,size:`sm`,onClick:()=>void Promise.all([l(),F()]),children:(0,H.jsx)(m,{size:L.sm})})}),(0,H.jsx)(pe,{title:`Plugin Library`,compact:!0,description:`Installed plugins and marketplace discovery live in separate tabs.`}),(0,H.jsxs)(Ae,{value:te,onValueChange:e=>h(e),children:[(0,H.jsxs)(Oe,{children:[(0,H.jsxs)(we,{value:`installed`,children:[`Installed (`,e.length,`)`]}),(0,H.jsxs)(we,{value:`marketplace`,children:[`Marketplace (`,_.length,`)`]})]}),(0,H.jsx)(Ee,{value:`installed`,className:`space-y-5`,children:o?(0,H.jsx)(I,{children:(0,H.jsx)(`div`,{className:`py-8 text-center text-sm text-[var(--app-text-subtle)]`,children:`Loading...`})}):s?(0,H.jsx)(I,{children:(0,H.jsx)(`div`,{className:`py-8 text-center text-sm text-[var(--app-danger)]`,children:s})}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`section`,{className:`space-y-3`,children:[(0,H.jsx)(pe,{title:`User scope`,compact:!0,description:`Global defaults. Available to all Roles unless overridden.`}),e.length===0?(0,H.jsx)(I,{children:(0,H.jsx)(he,{icon:(0,H.jsx)(ee,{size:L.hero}),title:`No user-scope plugins`,description:`Install a plugin once here to make it available as the default for every Role.`,className:`py-8`})}):(0,H.jsx)(`div`,{className:`space-y-3`,children:e.map(e=>(0,H.jsx)(lr,{plugin:e,roles:f,expandedContent:(0,H.jsx)(dr,{plugin:e}),onInstallToRole:M,onToggleGlobal:de,onUninstallUser:me,projectOperatingKey:j,userOperatingId:D},e.id))})]}),(0,H.jsxs)(`section`,{className:`space-y-3`,children:[(0,H.jsx)(pe,{title:`Project scope`,compact:!0,description:`Role-specific overrides. Only plugins that differ from user scope are shown here.`}),(0,H.jsx)(be,{groups:t,layout:`full`,onUninstall:le,onUpdate:ue,operatingKey:j})]}),(0,H.jsx)(je,{})]})}),(0,H.jsxs)(Ee,{value:`marketplace`,className:`space-y-4`,children:[(0,H.jsxs)(I,{children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(i,{size:L.sm,className:`flex-shrink-0 text-[var(--app-text-muted)]`}),g.map(e=>(0,H.jsx)(P,{variant:`muted`,className:`text-xs`,children:e.name},e.name)),(0,H.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[b?(0,H.jsx)(r,{size:L.xs,className:`animate-spin text-[var(--app-text-subtle)]`}):null,(0,H.jsxs)(O,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>oe(e=>!e),children:[ae?(0,H.jsx)(u,{size:L.xs}):(0,H.jsx)(a,{size:L.xs}),`Source`]})]})]}),ae?(0,H.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[(0,H.jsx)(`input`,{className:`flex-1 rounded border border-[var(--app-border)] bg-[var(--app-panel)] px-2 py-1.5 text-sm text-[var(--app-text)] focus:border-[var(--app-accent)] focus:outline-none`,value:T,onChange:e=>E(e.target.value),placeholder:`https://github.com/org/marketplace-repo`,onKeyDown:e=>{e.key===`Enter`&&Se()}}),(0,H.jsx)(O,{size:`sm`,onClick:()=>void Se(),disabled:!T.trim(),children:`Add`})]}):null]}),(0,H.jsx)(I,{children:(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(c,{size:L.sm,className:`absolute left-2.5 top-2 text-[var(--app-text-subtle)]`}),(0,H.jsx)(`input`,{className:`w-full rounded border border-[var(--app-border)] bg-[var(--app-panel)] py-1.5 pl-8 pr-3 text-sm text-[var(--app-text)] placeholder:text-[var(--app-text-subtle)] focus:border-[var(--app-accent)] focus:outline-none`,value:C,onChange:e=>w(e.target.value),placeholder:`Search available plugins...`})]})}),b?(0,H.jsx)(I,{children:(0,H.jsx)(`p`,{className:`py-8 text-center text-xs text-[var(--app-text-subtle)]`,children:`Loading marketplace...`})}):x?(0,H.jsx)(I,{children:(0,H.jsx)(`p`,{className:`py-8 text-center text-xs text-[var(--app-danger)]`,children:x})}):Te.length===0?(0,H.jsx)(I,{children:(0,H.jsx)(`p`,{className:`py-8 text-center text-xs text-[var(--app-text-subtle)]`,children:C?`No plugins match your search`:`No marketplace plugins available`})}):(0,H.jsx)(I,{padding:!1,children:(0,H.jsxs)(ve,{children:[(0,H.jsx)(ge,{children:(0,H.jsxs)(z,{children:[(0,H.jsx)(R,{children:`Name`}),(0,H.jsx)(R,{children:`Description`}),(0,H.jsx)(R,{children:`Source`}),(0,H.jsx)(R,{children:`Action`})]})}),(0,H.jsx)(_e,{children:Te.map(e=>{let t=y.has(e.pluginId),i=se===e.pluginId;return(0,H.jsxs)(z,{children:[(0,H.jsx)(B,{className:`text-xs font-medium text-[var(--app-text)]`,children:e.name}),(0,H.jsx)(B,{className:`max-w-[300px] truncate text-xs text-[var(--app-text-muted)]`,title:e.description,children:e.description}),(0,H.jsx)(B,{children:(0,H.jsx)(P,{variant:`muted`,className:`text-[10px]`,children:e.marketplaceName})}),(0,H.jsx)(B,{children:t?(0,H.jsx)(P,{variant:`success`,className:`text-[10px]`,children:`Installed`}):(0,H.jsxs)(Zn,{modal:!1,children:[(0,H.jsx)(Qn,{asChild:!0,children:(0,H.jsx)(O,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,disabled:i,children:i?(0,H.jsx)(r,{size:L.xs,className:`animate-spin`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(n,{size:L.xs}),`Install`,(0,H.jsx)(p,{size:L.xs})]})})}),(0,H.jsxs)(tr,{align:`end`,className:`min-w-[200px]`,children:[(0,H.jsx)($,{disabled:i,onSelect:()=>{Ce(e.pluginId)},children:`Install globally (User scope)`}),f.length>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ar,{}),f.map(t=>(0,H.jsxs)($,{disabled:i,onSelect:()=>{Ce(e.pluginId,`project`,t.workspacePath)},children:[`Install to `,t.name]},t.id))]}):null]})]})})]},e.pluginId)})})]})})]})]})]})}export{fr as Plugins};