@readmagic/workmate 0.0.23 → 0.0.25

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 (402) hide show
  1. package/dist/chunks/AddWorkspaceDirectory-Y5S_lMjD.js +1 -0
  2. package/dist/chunks/AgentsMdExternalIncludesDialog-Bnb1jWcg.js +1 -0
  3. package/dist/chunks/AgentsMdExternalIncludesDialog-DVbU-BaD.js +1 -0
  4. package/dist/chunks/App-B8q8PV77.js +1 -0
  5. package/dist/chunks/BackgroundTasksDialog-i0TkZgQp.js +2 -0
  6. package/dist/chunks/BypassPermissionsModeDialog-DjqGAL4C.js +1 -0
  7. package/dist/chunks/CustomSelect-BvTftqEH.js +1 -0
  8. package/dist/chunks/DiffDialog-v5r8cBKW.js +6 -0
  9. package/dist/chunks/Doctor-DKpBnbuI.js +1 -0
  10. package/dist/chunks/Doctor-uvO6NM5m.js +3 -0
  11. package/dist/chunks/ExitFlow-Dh9QdaYK.js +2 -0
  12. package/dist/chunks/InvalidConfigDialog-C9boykQn.js +1 -0
  13. package/dist/chunks/{InvalidSettingsDialog-Dtmpzeps.js → InvalidSettingsDialog-UN5mleCK.js} +1 -1
  14. package/dist/chunks/KeybindingProviderSetup-DsJqfEt-.js +1 -0
  15. package/dist/chunks/MCPConnectionManager-DkZVxLEj.js +1 -0
  16. package/dist/chunks/MCPToolListView-De1W4jpj.js +1 -0
  17. package/dist/chunks/McpParsingWarnings-zkM_lGd0.js +1 -0
  18. package/dist/chunks/MessageSelector-DW_itlX-.js +3 -0
  19. package/dist/chunks/Messages-BFsCpACq.js +10 -0
  20. package/dist/chunks/Onboarding-BT90cFkn.js +1 -0
  21. package/dist/chunks/PromptInputFooterSuggestions-CCTZYbWI.js +1 -0
  22. package/dist/chunks/PromptInputHelpMenu-Bm5KY0Ma.js +1 -0
  23. package/dist/chunks/{ProviderSetup-XcBHjUnd.js → ProviderSetup-yIj8YOKF.js} +1 -1
  24. package/dist/chunks/QueryEngine-egz5mbaW.js +1 -0
  25. package/dist/chunks/REPL-D27CE4WN.js +124 -0
  26. package/dist/chunks/REPL-e8wAT1wN.js +1 -0
  27. package/dist/chunks/ResumeConversation-CWA27Lke.js +1 -0
  28. package/dist/chunks/SearchExtraToolsTool-BRchtZ9Q.js +1 -0
  29. package/dist/chunks/{SelectMulti-Bc6l11_K.js → SelectMulti-BW7Ffk1G.js} +1 -1
  30. package/dist/chunks/Settings-axHLvYIy.js +3 -0
  31. package/dist/chunks/Spinner-VjwI7m_g.js +1 -0
  32. package/dist/chunks/{SpinnerGlyph-CmkRUvHe.js → SpinnerGlyph-CqrOK3Mx.js} +1 -1
  33. package/dist/chunks/TextInput-Cev5Awdd.js +22 -0
  34. package/dist/chunks/ThemePicker-CtQYHmOr.js +1 -0
  35. package/dist/chunks/TrustDialog-8Sjmuu0e.js +1 -0
  36. package/dist/chunks/{ValidationErrorsList-DgNzJQUP.js → ValidationErrorsList-INwwoerV.js} +1 -1
  37. package/dist/chunks/_baseEach-DrPH_FGo.js +1 -0
  38. package/dist/chunks/add-dir-D3RMaYxy.js +1 -0
  39. package/dist/chunks/{agentDisplay-BReJUBWg.js → agentDisplay-B3npXoCS.js} +1 -1
  40. package/dist/chunks/{agents-B3x8yJ_r.js → agents-2mPGmeq6.js} +1 -1
  41. package/dist/chunks/agents-DEnmg8Xo.js +101 -0
  42. package/dist/chunks/allErrors-C9kx6lnk.js +1 -0
  43. package/dist/chunks/analytics-COpjZpvd.js +1 -0
  44. package/dist/chunks/{appleTerminalBackup-BArZWB21.js → appleTerminalBackup-CT7g8yOs.js} +1 -1
  45. package/dist/chunks/backgroundHousekeeping-BkFxfjOf.js +1 -0
  46. package/dist/chunks/backgroundHousekeeping-CvWfd99M.js +1 -0
  47. package/dist/chunks/banner-DHpTmEO7.js +2 -0
  48. package/dist/chunks/branch-Be_yDFU8.js +2 -0
  49. package/dist/chunks/{break-cache-BMXqFTeS.js → break-cache-UUt6Dkf2.js} +2 -2
  50. package/dist/chunks/btw-DUml5L1w.js +1 -0
  51. package/dist/chunks/caches-DWjwe-DN.js +1 -0
  52. package/dist/chunks/caches-VLs1tQkZ.js +1 -0
  53. package/dist/chunks/{claudeDesktop-D8ml2767.js → claudeDesktop-mBGFDbI6.js} +1 -1
  54. package/dist/chunks/{clear-Bdhb6b39.js → clear-CrGjNe6E.js} +1 -1
  55. package/dist/chunks/{client-CpTCeWba.js → client-BDuhbzLD.js} +1 -1
  56. package/dist/chunks/{client-4iqhC8xq.js → client-BYFVVMcf.js} +1 -1
  57. package/dist/chunks/client-CO_6v4yl.js +1 -0
  58. package/dist/chunks/client-DO-O441l.js +1 -0
  59. package/dist/chunks/commands-Cn1P7Tms.js +1 -0
  60. package/dist/chunks/compact-DGUhdXcc.js +2 -0
  61. package/dist/chunks/config-C7GTF4iI.js +1 -0
  62. package/dist/chunks/config-CWPHVTic.js +3 -0
  63. package/dist/chunks/config-Cox0TM2Z.js +1 -0
  64. package/dist/chunks/context-mV5zjqmc.js +1 -0
  65. package/dist/chunks/context-noninteractive--OuiZUzL.js +1 -0
  66. package/dist/chunks/{context-noninteractive-Dd4xIoP1.js → context-noninteractive-DvfVvmSE.js} +2 -2
  67. package/dist/chunks/conversation--y8PD2Lk.js +1 -0
  68. package/dist/chunks/conversation-BIPJEOwO.js +1 -0
  69. package/dist/chunks/conversationRecovery-BBJzrA0g.js +1 -0
  70. package/dist/chunks/crossProjectResume-CwZb3cEU.js +40 -0
  71. package/dist/chunks/cwd-BZMp3CZ8.js +1 -0
  72. package/dist/chunks/cwd-BvNt_018.js +1 -0
  73. package/dist/chunks/debug-CRnGsZOV.js +39 -0
  74. package/dist/chunks/{detectRepository-CfX8Lc0A.js → detectRepository-CsJLbVEe.js} +1 -1
  75. package/dist/chunks/{diff-BOAElpfQ.js → diff-DUEoNCnJ.js} +1 -1
  76. package/dist/chunks/{directoryCompletion-D_Rtg-4j.js → directoryCompletion-Bgi8DBT5.js} +1 -1
  77. package/dist/chunks/doctor-4NiE46ZG.js +1 -0
  78. package/dist/chunks/entry-D1iD76SW.js +13 -0
  79. package/dist/chunks/{esm-CGx9qY3q.js → esm-DUH16IqH.js} +1 -1
  80. package/dist/chunks/execAsync-D6SA-YsV.js +1 -0
  81. package/dist/chunks/{execFileNoThrow-BTachNBI.js → execFileNoThrow-BgRsj_SW.js} +3 -3
  82. package/dist/chunks/exit-CrsQsjbx.js +1 -0
  83. package/dist/chunks/extraUsage-BtHE-SBX.js +1 -0
  84. package/dist/chunks/extractMemories-kogJzpit.js +1 -0
  85. package/dist/chunks/fast-CuNVwVTr.js +1 -0
  86. package/dist/chunks/fast-RlFnwGRV.js +1 -0
  87. package/dist/chunks/fetchModelList-Cjow_QGy.js +1 -0
  88. package/dist/chunks/fetchModelList-uiCPVqbJ.js +1 -0
  89. package/dist/chunks/fileSuggestions-C96V9-Ne.js +3 -0
  90. package/dist/chunks/firstPartyEventLogger-CN9UOmEC.js +1 -0
  91. package/dist/chunks/firstPartyEventLogger-RR5rvDtk.js +1 -0
  92. package/dist/chunks/{gemini-D_ORb_L6.js → gemini-4YGElN3H.js} +2 -2
  93. package/dist/chunks/generateSessionName-BHIKyXpz.js +1 -0
  94. package/dist/chunks/{genericProcessUtils-DwQFuna9.js → genericProcessUtils-BNlr-QxM.js} +1 -1
  95. package/dist/chunks/getMachineId-bsd-DTYGimUN.js +1 -0
  96. package/dist/chunks/getMachineId-darwin-DqIFUVvd.js +2 -0
  97. package/dist/chunks/getMachineId-linux-CnCTmdzd.js +1 -0
  98. package/dist/chunks/getMachineId-unsupported-Cx21ssu1.js +1 -0
  99. package/dist/chunks/getMachineId-win-vZhex7KX.js +1 -0
  100. package/dist/chunks/goal-ePK_jLo3.js +3 -0
  101. package/dist/chunks/grok-DnmklTrm.js +1 -0
  102. package/dist/chunks/help-B7xRle-V.js +1 -0
  103. package/dist/chunks/history-kOw3CcLT.js +1 -0
  104. package/dist/chunks/hooks-BDY1jMbS.js +1 -0
  105. package/dist/chunks/{hooks-DIvN6gdv.js → hooks-BN5f58HY.js} +2 -2
  106. package/dist/chunks/install-DrMiHa2Q.js +1 -0
  107. package/dist/chunks/instrumentation-Oj5xagJG.js +21 -0
  108. package/dist/chunks/{job-R6c4-3c8.js → job-D9ypO0cd.js} +1 -1
  109. package/dist/chunks/keybindings-BRRN_eap.js +1 -0
  110. package/dist/chunks/launchLocalMemory-DliLezJw.js +3 -0
  111. package/dist/chunks/launchOnboarding-A-kk-7ID.js +8 -0
  112. package/dist/chunks/loadAgentsDir-CJAK4kif.js +1 -0
  113. package/dist/chunks/{loadAgentsDir-DlPbtIsS.js → loadAgentsDir-DGozQu_6.js} +550 -550
  114. package/dist/chunks/{loadPluginHooks-C_msxVIc.js → loadPluginHooks-BiHPKDaY.js} +1 -1
  115. package/dist/chunks/{loader-CICGtLp2.js → loader-CtoR-vO-.js} +1 -1
  116. package/dist/chunks/{localSearch-CK-sFzPm.js → localSearch-BU02Qsv9.js} +1 -1
  117. package/dist/chunks/localSearch-DyaB2Rm-.js +1 -0
  118. package/dist/chunks/{log-D2TIwHBV.js → log-DoSpAwRP.js} +1 -1
  119. package/dist/chunks/logoUtils-DLd6JKqW.js +1 -0
  120. package/dist/chunks/{magicDocs-BEF8D3if.js → magicDocs-Bj8LYrN2.js} +2 -2
  121. package/dist/chunks/main-B_09WbaG.js +345 -0
  122. package/dist/chunks/managedEnv-BJGfe3m7.js +1 -0
  123. package/dist/chunks/{managedEnv-OPlzUPbJ.js → managedEnv-CIWJsuty.js} +1 -1
  124. package/dist/chunks/mcp-1nBvcNxw.js +1 -0
  125. package/dist/chunks/mcp-7DXpXMdT.js +2 -0
  126. package/dist/chunks/mcp-kw99WVi2.js +6 -0
  127. package/dist/chunks/memory-CjWvzR_9.js +1 -0
  128. package/dist/chunks/mode-CBKawxnD.js +2 -0
  129. package/dist/chunks/model-DpZaKZMb.js +1 -0
  130. package/dist/chunks/model-DwbqvCY2.js +1 -0
  131. package/dist/chunks/modelOptions-CXBfKFXA.js +1 -0
  132. package/dist/chunks/nativeInstaller-SmPeEisk.js +1 -0
  133. package/dist/chunks/{notifications-4wP1Tx9Y.js → notifications-ql0eSo0Y.js} +1 -1
  134. package/dist/chunks/onChangeAppState-D85b33R5.js +1 -0
  135. package/dist/chunks/open-Cyrr4E5x.js +1 -0
  136. package/dist/chunks/openai-D_j7-KW6.js +2 -0
  137. package/dist/chunks/overlayContext-CLjlCFBl.js +1 -0
  138. package/dist/chunks/{panel-CVS4SK_E.js → panel-DMZkOEiU.js} +1 -1
  139. package/dist/chunks/parser-2usBI4G-.js +1 -0
  140. package/dist/chunks/{parser-Cg6hSCmn.js → parser-UqADrvxF.js} +1 -1
  141. package/dist/chunks/partition-CwxTlmMd.js +1 -0
  142. package/dist/chunks/{pasteStore-P0zP-ch0.js → pasteStore-ovtxMVR5.js} +1 -1
  143. package/dist/chunks/permissions-CgsvWOk_.js +3 -0
  144. package/dist/chunks/pidLock-B-SW3Nhx.js +3 -0
  145. package/dist/chunks/plan-BJrWtXEh.js +1 -0
  146. package/dist/chunks/platform-DsMIk3eq.js +2 -0
  147. package/dist/chunks/plugin-D97VJAxW.js +17 -0
  148. package/dist/chunks/{pluginAutoupdate-8qugAFhb.js → pluginAutoupdate-DQqYDPVg.js} +1 -1
  149. package/dist/chunks/{pluginBlocklist-q01ackCf.js → pluginBlocklist-BAr9WTup.js} +1 -1
  150. package/dist/chunks/pluginCliCommands-CUGPc853.js +1 -0
  151. package/dist/chunks/{pluginFlagging-BG2MHCQJ.js → pluginFlagging-BO_3qjfs.js} +1 -1
  152. package/dist/chunks/pluginOperations-rTrzu6Vg.js +2 -0
  153. package/dist/chunks/pluginStartupCheck-BRHnXlym.js +1 -0
  154. package/dist/chunks/{pluginStartupCheck-DTMa6TgL.js → pluginStartupCheck-BX6cv-vs.js} +1 -1
  155. package/dist/chunks/plugins-9crasx2V.js +4 -0
  156. package/dist/chunks/poorMode-BaS0DBUO.js +1 -0
  157. package/dist/chunks/{poorMode-B0QGV6Ci.js → poorMode-DmvzFAz_.js} +1 -1
  158. package/dist/chunks/print-Bi3xVdB3.js +13 -0
  159. package/dist/chunks/processBashCommand-BBtnCx-7.js +1 -0
  160. package/dist/chunks/processSlashCommand-jzF0GmLO.js +5 -0
  161. package/dist/chunks/{projectOnboardingState-B5YATuc6.js → projectOnboardingState--L3BKjOE.js} +1 -1
  162. package/dist/chunks/prompt-CmijKW7G.js +1 -0
  163. package/dist/chunks/prompt-DYBx_D0H.js +1 -0
  164. package/dist/chunks/{prompt-mM79EGnT.js → prompt-DzO1um1h.js} +4 -4
  165. package/dist/chunks/{promptEditor-DLGN_eLu.js → promptEditor-B6S_Rzcu.js} +2 -2
  166. package/dist/chunks/protocolHandler-BWgH1jaF.js +13 -0
  167. package/dist/chunks/{proxy-CDBfZjO7.js → proxy-BjkGlmBu.js} +1 -1
  168. package/dist/chunks/reconciler-CVMmAaCy.js +1 -0
  169. package/dist/chunks/refresh-CAGv8BJY.js +1 -0
  170. package/dist/chunks/reject-CEUkoI2G.js +1 -0
  171. package/dist/chunks/{reload-plugins-C42xSB5l.js → reload-plugins-DeyJTx4s.js} +1 -1
  172. package/dist/chunks/rename-DPFis9g_.js +1 -0
  173. package/dist/chunks/{renderOptions-DV0dn0IW.js → renderOptions-DRS2EslG.js} +1 -1
  174. package/dist/chunks/resume-N4O5YI-S.js +2 -0
  175. package/dist/chunks/ripgrep-3omwGI-l.js +1 -0
  176. package/dist/chunks/ripgrep-CgQrN3XX.js +5 -0
  177. package/dist/chunks/{runtimeObserver-1wQO8HSZ.js → runtimeObserver-C0CJvA3q.js} +1 -1
  178. package/dist/chunks/{runtimeObserver-XQrOux41.js → runtimeObserver-DMSzdFWt.js} +4 -4
  179. package/dist/chunks/sandbox-adapter-D15jjHJR.js +1 -0
  180. package/dist/chunks/sandbox-toggle-Tbbaw18C.js +1 -0
  181. package/dist/chunks/searchExtraTools-BoFc__Eg.js +1 -0
  182. package/dist/chunks/select-Fq6g2Ejk.js +1 -0
  183. package/dist/chunks/sessionFileAccessHooks-Rgsp4_Ex.js +1 -0
  184. package/dist/chunks/{sessionObserver-DS4G6mb9.js → sessionObserver-CRie77tp.js} +2 -2
  185. package/dist/chunks/sessionObserver-PcaVCVkX.js +1 -0
  186. package/dist/chunks/sessionStorage-Dkf7FRgA.js +1 -0
  187. package/dist/chunks/sessionTracing-D7rekMdW.js +11 -0
  188. package/dist/chunks/settings-8fwIkMDV.js +1 -0
  189. package/dist/chunks/settings-CodSADx8.js +24 -0
  190. package/dist/chunks/setup-DBiIrXrh.js +3 -0
  191. package/dist/chunks/{shadowedRuleDetection-BRxZjobz.js → shadowedRuleDetection-CTnYVrmP.js} +1 -1
  192. package/dist/chunks/{sideQuestion-DLJxyrlp.js → sideQuestion-Cl8m2qYx.js} +3 -3
  193. package/dist/chunks/sinks-CiupmfTg.js +1 -0
  194. package/dist/chunks/sinks-DH83d_kd.js +1 -0
  195. package/dist/chunks/skillChangeDetector-BrrZaFkT.js +1 -0
  196. package/dist/chunks/{skillGapStore-CKN_d3pO.js → skillGapStore-es3K-aYe.js} +2 -2
  197. package/dist/chunks/{skillLifecycle-BMY2JGGG.js → skillLifecycle-BcgoOQBk.js} +2 -2
  198. package/dist/chunks/{skillSearchPanel-D9trHULQ.js → skillSearchPanel-CuDDb1L-.js} +4 -4
  199. package/dist/chunks/skills-BRtgqnLz.js +1 -0
  200. package/dist/chunks/{src-CiJCsqUl.js → src-C8gyNm5a.js} +1 -1
  201. package/dist/chunks/src-Db7K3F_i.js +3 -0
  202. package/dist/chunks/startupProfiler-D1NRu2nj.js +1 -0
  203. package/dist/chunks/startupProfiler-DF0AjiDf.js +3 -0
  204. package/dist/chunks/{state-B4jiUise.js → state-BQ4BEGin.js} +1 -1
  205. package/dist/chunks/state-D3gvDiu8.js +1 -0
  206. package/dist/chunks/status-WXA16wIM.js +1 -0
  207. package/dist/chunks/statusNoticeHelpers-BfmIub5L.js +1 -0
  208. package/dist/chunks/{stringUtils-C718f5ey.js → stringUtils-Bu_lJH5c.js} +1 -1
  209. package/dist/chunks/switcher-5gilU5_R.js +1 -0
  210. package/dist/chunks/{switcher-CAajZeNL.js → switcher-DMfuKuw_.js} +1 -1
  211. package/dist/chunks/{tasks-BWNQr2d3.js → tasks-B6gYXxOx.js} +1 -1
  212. package/dist/chunks/{templateJobs-gUET39Ho.js → templateJobs-BW6TaqEC.js} +1 -1
  213. package/dist/chunks/{terminalSetup-B_10N_gE.js → terminalSetup-BgIXFBpd.js} +4 -4
  214. package/dist/chunks/{terminalSetup-qc2PlvOm.js → terminalSetup-C-g9Xvj3.js} +1 -1
  215. package/dist/chunks/{theme-B7fKI6E5.js → theme-9AZceq_m.js} +1 -1
  216. package/dist/chunks/tipRegistry-DtO1H_Wo.js +2 -0
  217. package/dist/chunks/{toolEventObserver-BL06sDI4.js → toolEventObserver-DTuJcREC.js} +1 -1
  218. package/dist/chunks/toolPool-DHS8jWaL.js +1 -0
  219. package/dist/chunks/{types-Dx7P7JLQ.js → types-97nL3naE.js} +16 -16
  220. package/dist/chunks/{udsClient-cQz6nJ_T.js → udsClient-CmYHFiBD.js} +1 -1
  221. package/dist/chunks/{use-select-navigation-BiUJdWai.js → use-select-navigation-BStVRvcX.js} +1 -1
  222. package/dist/chunks/useExitOnCtrlCDWithKeybindings-DWRFdFoU.js +1 -0
  223. package/dist/chunks/useMainLoopModel-DSN5HjV1.js +1 -0
  224. package/dist/chunks/useManagePlugins-ntnOf5OU.js +1 -0
  225. package/dist/chunks/useMergedTools-C5Yns9Ij.js +1 -0
  226. package/dist/chunks/useSearchInput-B_mY9wBq.js +1 -0
  227. package/dist/chunks/useSettingsErrors-CM7tThcp.js +1 -0
  228. package/dist/chunks/util-Bb2S6g9N.js +1 -0
  229. package/dist/chunks/{validatePlugin-D6tFo87L.js → validatePlugin-D8WQ5z4W.js} +1 -1
  230. package/dist/chunks/vim-Dpnhgoz_.js +1 -0
  231. package/dist/chunks/worktree-a5oOPSYl.js +1 -0
  232. package/dist/cli.js +1 -1
  233. package/package.json +1 -12
  234. package/dist/chunks/AddWorkspaceDirectory-OgcBcK5A.js +0 -1
  235. package/dist/chunks/AgentsMdExternalIncludesDialog-CDNd5-7E.js +0 -1
  236. package/dist/chunks/AgentsMdExternalIncludesDialog-CNEifEyV.js +0 -1
  237. package/dist/chunks/App-B-3tPQ3k.js +0 -1
  238. package/dist/chunks/BackgroundTasksDialog-COuhHcey.js +0 -2
  239. package/dist/chunks/BypassPermissionsModeDialog-bJek4siJ.js +0 -1
  240. package/dist/chunks/CustomSelect-DoeEXOIP.js +0 -1
  241. package/dist/chunks/DiffDialog-B3X9FMpO.js +0 -6
  242. package/dist/chunks/Doctor-6PXyjIi6.js +0 -3
  243. package/dist/chunks/Doctor-DNgkgYhB.js +0 -1
  244. package/dist/chunks/ExitFlow-DgAZp_8U.js +0 -2
  245. package/dist/chunks/Grove-CHatOzcE.js +0 -11
  246. package/dist/chunks/InvalidConfigDialog-DXL92MN9.js +0 -1
  247. package/dist/chunks/KeybindingProviderSetup-DA37QUFs.js +0 -1
  248. package/dist/chunks/MCPConnectionManager-thZd-xA_.js +0 -1
  249. package/dist/chunks/MCPToolListView-CpY-YJg4.js +0 -1
  250. package/dist/chunks/McpParsingWarnings-JvChf3xr.js +0 -1
  251. package/dist/chunks/MessageSelector-C0_iw7SI.js +0 -3
  252. package/dist/chunks/Messages-K4DDsDP9.js +0 -10
  253. package/dist/chunks/Onboarding-C1UdzM-1.js +0 -1
  254. package/dist/chunks/PromptInputFooterSuggestions-AyLog8p7.js +0 -1
  255. package/dist/chunks/PromptInputHelpMenu-oyic20ip.js +0 -1
  256. package/dist/chunks/QueryEngine-DYxBjJ4i.js +0 -1
  257. package/dist/chunks/REPL-CQBJRrT0.js +0 -124
  258. package/dist/chunks/REPL-CrVuMQY2.js +0 -1
  259. package/dist/chunks/ResumeConversation-Dl8H9Gfy.js +0 -1
  260. package/dist/chunks/SearchExtraToolsTool-lv7VE50N.js +0 -1
  261. package/dist/chunks/Settings-TGp3fPrS.js +0 -3
  262. package/dist/chunks/Spinner-zYPFVFHN.js +0 -1
  263. package/dist/chunks/TextInput-CD9iau2k.js +0 -22
  264. package/dist/chunks/ThemePicker-0F0hZYPX.js +0 -1
  265. package/dist/chunks/TrustDialog-C76YiMKz.js +0 -1
  266. package/dist/chunks/_baseEach-4ff-vRlp.js +0 -1
  267. package/dist/chunks/add-dir-JMsRLGfx.js +0 -1
  268. package/dist/chunks/agents-9qQ8I6zW.js +0 -101
  269. package/dist/chunks/allErrors-DfWylHSw.js +0 -1
  270. package/dist/chunks/analytics-DJobLaWP.js +0 -1
  271. package/dist/chunks/backgroundHousekeeping-BGxHB_OX.js +0 -1
  272. package/dist/chunks/backgroundHousekeeping-CVNIhQg8.js +0 -17
  273. package/dist/chunks/banner-Cu2-XUek.js +0 -2
  274. package/dist/chunks/branch-C4TsMEkx.js +0 -2
  275. package/dist/chunks/btw-Dn1eYFAz.js +0 -1
  276. package/dist/chunks/caches-BGzKwpnc.js +0 -1
  277. package/dist/chunks/caches-DArHxBgL.js +0 -1
  278. package/dist/chunks/client-BiqbIkwr.js +0 -1
  279. package/dist/chunks/client-CZ8nyVh5.js +0 -1
  280. package/dist/chunks/commands-QepeBbFn.js +0 -1
  281. package/dist/chunks/compact-Bu9BUpxV.js +0 -2
  282. package/dist/chunks/config-C-Y2qtB2.js +0 -3
  283. package/dist/chunks/config-D58C3_Lu.js +0 -1
  284. package/dist/chunks/config-DD8fCYXn.js +0 -1
  285. package/dist/chunks/context-CY_yfdYa.js +0 -1
  286. package/dist/chunks/context-noninteractive-BDDi3NLF.js +0 -1
  287. package/dist/chunks/conversation-B0wxBwzv.js +0 -1
  288. package/dist/chunks/conversation-DUu9qBnq.js +0 -1
  289. package/dist/chunks/conversationRecovery-2ft8sCPE.js +0 -1
  290. package/dist/chunks/crossProjectResume-6boHMUBx.js +0 -40
  291. package/dist/chunks/cwd-Dc3NV7s8.js +0 -1
  292. package/dist/chunks/cwd-Pa83R95t.js +0 -1
  293. package/dist/chunks/datadog-BPuGcxxC.js +0 -1
  294. package/dist/chunks/debug-Bglx1aTu.js +0 -39
  295. package/dist/chunks/doctor-CkLzqAMd.js +0 -1
  296. package/dist/chunks/entry-TNOoyy7_.js +0 -13
  297. package/dist/chunks/esm-eTAUP-La.js +0 -1
  298. package/dist/chunks/execAsync-Bv2yxuGe.js +0 -1
  299. package/dist/chunks/exit-DXApFJIP.js +0 -1
  300. package/dist/chunks/extraUsage-CmQaLPV1.js +0 -1
  301. package/dist/chunks/extractMemories-xP63mv6R.js +0 -1
  302. package/dist/chunks/fast-C5nQH8rm.js +0 -1
  303. package/dist/chunks/fast-eGx2IxD7.js +0 -1
  304. package/dist/chunks/fetchModelList-CxLsVNsu.js +0 -1
  305. package/dist/chunks/fetchModelList-D24lRIgR.js +0 -1
  306. package/dist/chunks/fileSuggestions-DHxdwq28.js +0 -3
  307. package/dist/chunks/firstPartyEventLogger-BVAogAX8.js +0 -1
  308. package/dist/chunks/firstPartyEventLogger-M6UMli2c.js +0 -3
  309. package/dist/chunks/generateSessionName-BQoDduyA.js +0 -1
  310. package/dist/chunks/getMachineId-bsd-Cut1kHoA.js +0 -1
  311. package/dist/chunks/getMachineId-darwin-CsRhaP3y.js +0 -2
  312. package/dist/chunks/getMachineId-linux-Bd7UBNRQ.js +0 -1
  313. package/dist/chunks/getMachineId-unsupported-vFGP8E_8.js +0 -1
  314. package/dist/chunks/getMachineId-win-DamF2CH_.js +0 -1
  315. package/dist/chunks/goal-D7c2mSds.js +0 -3
  316. package/dist/chunks/grok-B2-ZbUiR.js +0 -1
  317. package/dist/chunks/grove-O6qp7ITR.js +0 -1
  318. package/dist/chunks/help-CZJdRviD.js +0 -1
  319. package/dist/chunks/history-CQiUERTL.js +0 -1
  320. package/dist/chunks/hooks-BNuUlMzL.js +0 -1
  321. package/dist/chunks/install-T_CV1Slu.js +0 -1
  322. package/dist/chunks/instrumentation-BjqUZ383.js +0 -21
  323. package/dist/chunks/keybindings-CLRaiL_Z.js +0 -1
  324. package/dist/chunks/launchLocalMemory-DrbKrwXc.js +0 -3
  325. package/dist/chunks/launchOnboarding-tqsMD8ni.js +0 -8
  326. package/dist/chunks/loadAgentsDir-CcmY8zCj.js +0 -1
  327. package/dist/chunks/localSearch-DrUj0B-d.js +0 -1
  328. package/dist/chunks/logoUtils-x2pHV-Nl.js +0 -1
  329. package/dist/chunks/main-kOVUGxOS.js +0 -345
  330. package/dist/chunks/managedEnv-BEqrGqn1.js +0 -1
  331. package/dist/chunks/mcp-BNd29r6p.js +0 -6
  332. package/dist/chunks/mcp-D0wAJrRT.js +0 -1
  333. package/dist/chunks/mcp-mgOlm1cY.js +0 -2
  334. package/dist/chunks/memory-DDLk9_LJ.js +0 -1
  335. package/dist/chunks/mode-CcNsWgK3.js +0 -2
  336. package/dist/chunks/model-BwBG0V1u.js +0 -1
  337. package/dist/chunks/model-DzCP4K-9.js +0 -1
  338. package/dist/chunks/modelOptions-DRaG3bo0.js +0 -1
  339. package/dist/chunks/nativeInstaller-C3pVPqrZ.js +0 -1
  340. package/dist/chunks/onChangeAppState-BlaoFbYF.js +0 -1
  341. package/dist/chunks/open-BtQHzzL9.js +0 -1
  342. package/dist/chunks/openai-CDN71NdX.js +0 -2
  343. package/dist/chunks/overlayContext-BT2Lq8ei.js +0 -1
  344. package/dist/chunks/parser-CG5RuOCK.js +0 -1
  345. package/dist/chunks/partition-CIl_ORUT.js +0 -1
  346. package/dist/chunks/permissions-zSNOZSwr.js +0 -3
  347. package/dist/chunks/pidLock-BTqO-h7Y.js +0 -3
  348. package/dist/chunks/plan-Bs6em6lk.js +0 -1
  349. package/dist/chunks/platform-BacQ6ACS.js +0 -2
  350. package/dist/chunks/plugin-DDDxjBa0.js +0 -17
  351. package/dist/chunks/pluginCliCommands-DXZfCZsv.js +0 -1
  352. package/dist/chunks/pluginOperations-hXYLrzM2.js +0 -2
  353. package/dist/chunks/pluginStartupCheck-HS1ZceZa.js +0 -1
  354. package/dist/chunks/plugins-COoGBYk6.js +0 -4
  355. package/dist/chunks/poorMode-G-pnu6NM.js +0 -1
  356. package/dist/chunks/print-BASybEtO.js +0 -13
  357. package/dist/chunks/processBashCommand-DDi_Pymt.js +0 -1
  358. package/dist/chunks/processSlashCommand-Cq9kaoSF.js +0 -5
  359. package/dist/chunks/prompt-CHobfCB1.js +0 -1
  360. package/dist/chunks/prompt-CMm6RHHc.js +0 -1
  361. package/dist/chunks/protocolHandler-DjQALaU2.js +0 -13
  362. package/dist/chunks/reconciler-CeXqh95g.js +0 -1
  363. package/dist/chunks/refresh-Ce2yk28a.js +0 -1
  364. package/dist/chunks/registerProtocol-CAsDme_E.js +0 -1
  365. package/dist/chunks/reject-Bld5E-bn.js +0 -1
  366. package/dist/chunks/rename-CtBghpxZ.js +0 -1
  367. package/dist/chunks/resume-BWkaTDqd.js +0 -2
  368. package/dist/chunks/ripgrep-DLs8MraF.js +0 -1
  369. package/dist/chunks/ripgrep-Dl3y5r4m.js +0 -5
  370. package/dist/chunks/sandbox-adapter-8GO6eJxw.js +0 -1
  371. package/dist/chunks/sandbox-toggle-Dir9Polo.js +0 -1
  372. package/dist/chunks/searchExtraTools-BhDq8DTJ.js +0 -1
  373. package/dist/chunks/select-Bxf5-5sI.js +0 -1
  374. package/dist/chunks/sessionFileAccessHooks-CozocHQE.js +0 -1
  375. package/dist/chunks/sessionObserver-DGEQM4cO.js +0 -1
  376. package/dist/chunks/sessionStorage-BcAscOGE.js +0 -1
  377. package/dist/chunks/sessionTracing-BoDDYLxW.js +0 -11
  378. package/dist/chunks/settings-B2jvL8Dp.js +0 -24
  379. package/dist/chunks/settings-CisDe8DB.js +0 -1
  380. package/dist/chunks/setup-BRypY6iT.js +0 -3
  381. package/dist/chunks/sinks-CGdKmq_8.js +0 -1
  382. package/dist/chunks/sinks-Cz2HfgMU.js +0 -1
  383. package/dist/chunks/skillChangeDetector-xviGstqm.js +0 -1
  384. package/dist/chunks/skills-CX_AvwLG.js +0 -1
  385. package/dist/chunks/src-CHw1lvBc.js +0 -3
  386. package/dist/chunks/startupProfiler-BH0FoI66.js +0 -1
  387. package/dist/chunks/startupProfiler-CJdr3SxP.js +0 -3
  388. package/dist/chunks/state-BhOKSFi5.js +0 -1
  389. package/dist/chunks/status-Daaak6Bo.js +0 -1
  390. package/dist/chunks/statusNoticeHelpers-vFVgIYuw.js +0 -1
  391. package/dist/chunks/switcher-BpgmH4AI.js +0 -1
  392. package/dist/chunks/tipRegistry-DamZr34w.js +0 -2
  393. package/dist/chunks/toolPool-CX5wDBi1.js +0 -1
  394. package/dist/chunks/useExitOnCtrlCDWithKeybindings-C9BYG8Bo.js +0 -1
  395. package/dist/chunks/useMainLoopModel-DwjSVzzO.js +0 -1
  396. package/dist/chunks/useManagePlugins-BqfIVa6E.js +0 -1
  397. package/dist/chunks/useMergedTools-Bw8FchX8.js +0 -1
  398. package/dist/chunks/useSearchInput-B25K1RnK.js +0 -1
  399. package/dist/chunks/useSettingsErrors-DYQ44kX4.js +0 -1
  400. package/dist/chunks/util-CtlC2dsN.js +0 -1
  401. package/dist/chunks/vim-CoRp9lY1.js +0 -1
  402. package/dist/chunks/worktree-B8apCnVe.js +0 -1
@@ -0,0 +1,17 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{l as n,o as r}from"./envUtils-DfkgIdYf.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{D as o,Gr as s,Gt as c,H as l,I as u,P as d,T as f,Wt as p,Xn as m,ai as h,hn as g,j as _,k as v,n as y,ot as b,r as x,t as S,x as ee,y as te}from"./src-DL3w8VPk.js";import{t as C}from"./jsx-runtime-Bb4Xn-E0.js";import{$a as w,Ao as T,Ba as ne,Bp as E,Bv as D,Cb as O,Co as k,Cv as A,Do as re,Eo as ie,Fa as ae,Ga as j,Gv as M,Gx as N,Hp as oe,Jv as P,Ka as se,Kv as ce,Mo as le,Mx as ue,No as F,Oo as I,Ox as de,Pa as fe,Qa as pe,Qv as me,Qx as he,So as L,To as R,Va as ge,Vv as _e,Vx as ve,Wv as ye,Xv as be,Ya as z,Yv as xe,Zv as Se,Zx as Ce,bu as we,bv as Te,do as B,eS as Ee,go as De,hd as Oe,io as ke,jx as Ae,kb as je,md as V,mo as Me,qv as Ne,qx as Pe,so as Fe,tS as Ie,to as Le,uo as Re,vo as ze,wo as Be,yo as Ve,yu as He,zp as Ue}from"./loadAgentsDir-DGozQu_6.js";import{I as We,M as Ge,S as Ke,V as qe,c as Je,i as Ye,x as Xe}from"./debug-CRnGsZOV.js";import{Hn as Ze,Vn as Qe,_t as $e,b as et,bt as tt,d as nt,h as rt,s as it}from"./settings-CodSADx8.js";import{d as at,g as ot}from"./config-CWPHVTic.js";import{o as st,s as ct}from"./log-DoSpAwRP.js";import{l as H,o as lt}from"./stringUtils-Bu_lJH5c.js";import{n as ut}from"./analytics-COpjZpvd.js";import{S as dt,v as ft}from"./startupProfiler-DF0AjiDf.js";import{n as pt,t as mt}from"./TextInput-Cev5Awdd.js";import{n as ht,t as gt}from"./pluginStartupCheck-BX6cv-vs.js";import{a as _t,d as vt,f as yt,i as bt,l as xt,o as St,s as Ct,u as wt}from"./pluginOperations-rTrzu6Vg.js";import{a as Tt,c as Et,i as Dt,n as Ot,o as kt,s as At,t as jt}from"./validatePlugin-D8WQ5z4W.js";import{a as Mt,n as Nt,o as Pt,r as Ft}from"./pluginFlagging-BO_3qjfs.js";import{i as It,n as Lt}from"./MCPConnectionManager-DkZVxLEj.js";import{n as Rt,t as zt}from"./useExitOnCtrlCDWithKeybindings-DWRFdFoU.js";import{r as Bt,t as Vt}from"./Spinner-VjwI7m_g.js";import{t as Ht}from"./SearchBox-C9xxQzh1.js";import{n as Ut,t as Wt}from"./useSearchInput-B_mY9wBq.js";import{a as Gt,c as Kt,i as qt,n as Jt,o as Yt,r as Xt,s as Zt,t as Qt}from"./MCPToolListView-De1W4jpj.js";import{i as $t,n as en}from"./pluginAutoupdate-DQqYDPVg.js";import*as tn from"path";import*as nn from"fs/promises";function rn({inputValue:e,setInputValue:t,cursorOffset:n,setCursorOffset:r,error:i,setError:a,result:s,setResult:c,setViewState:l,onAddComplete:p,cliMode:m=!1}){let h=(0,an.useRef)(!1),[g,_]=(0,an.useState)(!1),[v,y]=(0,an.useState)(``),b=async()=>{let t=e.trim();if(!t){a(`Please enter a marketplace source`);return}let n=await Tt(t);if(!n){a(`Invalid marketplace source format. Try: owner/repo, https://..., or ./path`);return}if(`error`in n){a(n.error);return}a(null);try{_(!0),y(``);let{name:e,resolvedSource:t}=await ke(n,e=>{y(e)});ze(e,{source:t}),le(),n.source,n.source===`github`&&n.repo,p&&await p(),y(``),_(!1),m?c(`Successfully added marketplace: ${e}`):l({type:`browse-marketplace`,targetMarketplace:e})}catch(e){let t=qe(e);ct(t),a(t.message),y(``),_(!1),c(m?`Error: ${t.message}`:null)}};return(0,an.useEffect)(()=>{e&&!h.current&&!i&&!s&&(h.current=!0,b())},[]),(0,U.jsxs)(u,{flexDirection:`column`,children:[(0,U.jsxs)(u,{flexDirection:`column`,paddingX:1,borderStyle:`round`,children:[(0,U.jsx)(u,{marginBottom:1,children:(0,U.jsx)(d,{bold:!0,children:`Add Marketplace`})}),(0,U.jsxs)(u,{flexDirection:`column`,children:[(0,U.jsx)(d,{children:`Enter marketplace source:`}),(0,U.jsx)(d,{dimColor:!0,children:`Examples:`}),(0,U.jsx)(d,{dimColor:!0,children:` · owner/repo (GitHub)`}),(0,U.jsx)(d,{dimColor:!0,children:` · git@github.com:owner/repo.git (SSH)`}),(0,U.jsx)(d,{dimColor:!0,children:` · https://example.com/marketplace.json`}),(0,U.jsx)(d,{dimColor:!0,children:` · ./path/to/marketplace`}),(0,U.jsx)(u,{marginTop:1,children:(0,U.jsx)(mt,{value:e,onChange:t,onSubmit:b,columns:80,cursorOffset:n,onChangeCursorOffset:r,focus:!0,showCursor:!0})})]}),g&&(0,U.jsxs)(u,{marginTop:1,children:[(0,U.jsx)(Vt,{}),(0,U.jsx)(d,{children:v||`Adding marketplace to configuration…`})]}),i&&(0,U.jsx)(u,{marginTop:1,children:(0,U.jsx)(d,{color:`error`,children:i})}),s&&(0,U.jsx)(u,{marginTop:1,children:(0,U.jsx)(d,{children:s})})]}),(0,U.jsx)(u,{marginLeft:3,children:(0,U.jsx)(d,{dimColor:!0,italic:!0,children:(0,U.jsxs)(f,{children:[(0,U.jsx)(o,{shortcut:`Enter`,action:`add`}),(0,U.jsx)(V,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]})})})]})}var an,U,on=e((()=>{an=t(h(),1),ut(),Oe(),S(),Bt(),pt(),We(),st(),F(),Re(),Dt(),U=C()}));function sn(e,t,r,i){let a={};for(let o of e){let e=r[o],s=t[o]??``;if(!(e?.sensitive===!0&&s===``&&i?.[o]!==void 0))if(e?.type===`number`){if(s.trim()===``)continue;let e=Number(s);a[o]=Number.isNaN(e)?s:e}else e?.type===`boolean`?a[o]=n(s):a[o]=s}return a}function cn({title:e,subtitle:t,configSchema:n,initialValues:r,onSave:i,onCancel:o}){let l=Object.keys(n),f=(0,ln.useCallback)(e=>{if(n[e]?.sensitive===!0)return``;let t=r?.[e];return t===void 0?``:String(t)},[n,r]),[m,h]=(0,ln.useState)(0),[_,v]=(0,ln.useState)({}),[y,b]=(0,ln.useState)(()=>l[0]?f(l[0]):``),x=l[m],S=x?n[x]:null;if(p(`confirm:no`,o,{context:`Settings`}),c({"confirm:nextField":(0,ln.useCallback)(()=>{if(m<l.length-1&&x){v(e=>({...e,[x]:y})),h(e=>e+1);let e=l[m+1];b(e?f(e):``)}},[m,l,x,y,f]),"confirm:yes":(0,ln.useCallback)(()=>{if(!x)return;let e={..._,[x]:y};if(m===l.length-1)i(sn(l,e,n,r));else{v(e),h(e=>e+1);let t=l[m+1];b(t?f(t):``)}},[x,_,y,m,l,n,i,f,r])},{context:`Confirmation`}),g((e,t)=>{if(t.backspace||t.delete){b(e=>e.slice(0,-1));return}e&&!t.ctrl&&!t.meta&&!t.tab&&!t.return&&b(t=>t+e)}),!S||!x)return null;let ee=S.sensitive===!0,C=S.required===!0,w=ee?`*`.repeat(s(y)):y;return(0,un.jsxs)(te,{title:e,subtitle:t,onCancel:o,isCancelActive:!1,children:[(0,un.jsxs)(u,{flexDirection:`column`,children:[(0,un.jsxs)(d,{bold:!0,children:[S.title||x,C&&(0,un.jsx)(d,{color:`error`,children:` *`})]}),S.description&&(0,un.jsx)(d,{dimColor:!0,children:S.description}),(0,un.jsxs)(u,{marginTop:1,children:[(0,un.jsxs)(d,{children:[a.pointerSmall,` `]}),(0,un.jsx)(d,{children:w}),(0,un.jsx)(d,{children:`█`})]})]}),(0,un.jsxs)(u,{flexDirection:`column`,children:[(0,un.jsxs)(d,{dimColor:!0,children:[`Field `,m+1,` of `,l.length]}),m<l.length-1&&(0,un.jsx)(d,{dimColor:!0,children:`Tab: Next field · Enter: Save and continue`}),m===l.length-1&&(0,un.jsx)(d,{dimColor:!0,children:`Enter: Save configuration`})]})]})}var ln,un,dn=e((()=>{i(),ln=t(h(),1),S(),O(),r(),un=C()}));async function fn(e){let{enabled:t,disabled:n}=await ae();return[...t,...n].find(t=>t.repository===e||t.source===e)}function pn({plugin:e,pluginId:t,onDone:n}){let[r]=mn.useState(()=>{let n=[],r=ye(e);Object.keys(r).length>0&&n.push({key:`top-level`,title:`Configure ${e.name}`,subtitle:`Plugin options`,schema:r,load:()=>ce(t),save:n=>Ne(t,n,e.manifest.userConfig)});let i=D(e);for(let r of i)n.push({key:`channel:${r.server}`,title:`Configure ${r.displayName}`,subtitle:`Plugin: ${e.name}`,schema:r.configSchema,load:()=>be(t,r.server)??void 0,save:e=>me(t,r.server,e,r.configSchema)});return n}),[i,a]=mn.useState(0),o=mn.useRef(n);if(o.current=n,mn.useEffect(()=>{r.length===0&&o.current(`skipped`)},[r.length]),r.length===0)return null;let s=r[i];function c(e){try{s.save(e)}catch(e){n(`error`,Ge(e));return}let t=i+1;t<r.length?a(t):n(`configured`)}return(0,hn.jsx)(cn,{title:s.title,subtitle:s.subtitle,configSchema:s.schema,initialValues:s.load(),onSave:c,onCancel:()=>n(`skipped`)},s.key)}var mn,hn,gn=e((()=>{mn=t(h(),1),We(),P(),_e(),fe(),M(),dn(),hn=C()}));function _n(){let e=re();return(0,vn.jsxs)(u,{marginBottom:1,children:[(0,vn.jsxs)(d,{color:`claude`,children:[a.warning,` `]}),(0,vn.jsxs)(d,{dimColor:!0,italic:!0,children:[`Make sure you trust a plugin before installing, updating, or using it. We do not control what MCP servers, files, or other software are included in plugins and cannot verify that they will work as intended or that they won't change. See each plugin's homepage for more information.`,e?` ${e}`:``]})]})}var vn,yn=e((()=>{i(),S(),I(),vn=C()}));function bn(e){return e.entry.source&&typeof e.entry.source==`object`&&`source`in e.entry.source&&e.entry.source.source===`github`&&typeof e.entry.source==`object`&&`repo`in e.entry.source?e.entry.source.repo:null}function xn(e,t){let n=[{label:`Install for you (user scope)`,action:`install-user`},{label:`Install for all collaborators on this repository (project scope)`,action:`install-project`},{label:`Install for you, in this repo only (local scope)`,action:`install-local`}];return e&&n.push({label:`Open homepage`,action:`homepage`}),t&&n.push({label:`View on GitHub`,action:`github`}),n.push({label:`Back to plugin list`,action:`back`}),n}function Sn({hasSelection:e}){return(0,Cn.jsx)(u,{marginTop:1,children:(0,Cn.jsx)(d,{dimColor:!0,italic:!0,children:(0,Cn.jsxs)(f,{children:[e&&(0,Cn.jsx)(V,{action:`plugin:install`,context:`Plugin`,fallback:`i`,description:`install`,bold:!0}),(0,Cn.jsx)(V,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,Cn.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,Cn.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})}var Cn,wn=e((()=>{Oe(),S(),Cn=C()}));function Tn({totalItems:e,maxVisible:t=Dn,selectedIndex:n=0}){let r=e>t,i=(0,En.useRef)(0),a=(0,En.useMemo)(()=>{if(!r)return 0;let a=i.current;if(n<a)return i.current=n,n;if(n>=a+t){let e=n-t+1;return i.current=e,e}let o=Math.max(0,e-t),s=Math.min(a,o);return i.current=s,s},[n,t,r,e]),o=a,s=Math.min(a+t,e),c=(0,En.useCallback)(e=>r?e.slice(o,s):e,[r,o,s]),l=(0,En.useCallback)(e=>o+e,[o]),u=(0,En.useCallback)(e=>e>=o&&e<s,[o,s]),d=(0,En.useCallback)(e=>{},[]),f=(0,En.useCallback)(()=>{},[]),p=(0,En.useCallback)(()=>{},[]),m=(0,En.useCallback)((t,n)=>{n(Math.max(0,Math.min(t,e-1)))},[e]),h=(0,En.useCallback)((e,t)=>!1,[]),g=Math.max(1,Math.ceil(e/t));return{currentPage:Math.floor(a/t),totalPages:g,startIndex:o,endIndex:s,needsPagination:r,pageSize:t,getVisibleItems:c,toActualIndex:l,isOnCurrentPage:u,goToPage:d,nextPage:f,prevPage:p,handleSelectionChange:m,handlePageNavigation:h,scrollPosition:{current:n+1,total:e,canScrollUp:a>0,canScrollDown:a+t<e}}}var En,Dn,On=e((()=>{En=t(h(),1),Dn=5}));function kn({error:e,setError:t,result:n,setResult:r,setViewState:i,onInstallComplete:o,targetMarketplace:s,targetPlugin:l}){let[m,h]=(0,W.useState)(`marketplace-list`),[g,_]=(0,W.useState)(null),[v,y]=(0,W.useState)(null),[b,x]=(0,W.useState)([]),[S,ee]=(0,W.useState)([]),[te,C]=(0,W.useState)(!0),[ne,E]=(0,W.useState)(null),[D,O]=(0,W.useState)(0),[k,A]=(0,W.useState)(new Set),[re,ae]=(0,W.useState)(new Set),j=Tn({totalItems:S.length,selectedIndex:D}),[M,N]=(0,W.useState)(0),[oe,P]=(0,W.useState)(!1),[ce,ue]=(0,W.useState)(null),[F,I]=(0,W.useState)(null);p(`confirm:no`,An.useCallback(()=>{m===`plugin-list`?s?i({type:`manage-marketplaces`,targetMarketplace:s}):b.length===1?i({type:`menu`}):(h(`marketplace-list`),_(null),A(new Set)):m===`plugin-details`?(h(`plugin-list`),y(null)):i({type:`menu`})},[m,s,i,b.length]),{context:`Confirmation`}),(0,W.useEffect)(()=>{async function e(){try{let e=await B(),{marketplaces:n,failures:r}=await T(e),i=[];for(let{name:e,config:t,data:r}of n)if(r){let n=Qe(r.plugins,t=>w(L(t.name,e)));i.push({name:e,totalPlugins:r.plugins.length,installedCount:n,source:ie(t.source)})}i.sort((e,t)=>e.name===`claude-plugin-directory`?-1:+(t.name===`claude-plugin-directory`)),x(i);let a=R(r,Qe(n,e=>e.data!==null));if(a)if(a.type===`warning`)I(`${a.message}. Showing available marketplaces.`);else throw Error(a.message);if(i.length===1&&!s&&!l){let e=i[0];e&&(_(e.name),h(`plugin-list`))}if(l){let n=null,r=null;for(let[t]of Object.entries(e)){let e=await Fe(t);if(e){let i=e.plugins.find(e=>e.name===l);if(i){let e=L(i.name,t);n={entry:i,marketplaceName:t,pluginId:e,isInstalled:pe(e)},r=t;break}}}if(n&&r){let e=n.pluginId;pe(e)?t(`Plugin '${e}' is already installed globally. Use '/plugin' to manage existing plugins.`):(_(r),y(n),h(`plugin-details`))}else t(`Plugin "${l}" not found in any marketplace`)}else s&&(i.some(e=>e.name===s)?(_(s),h(`plugin-list`)):t(`Marketplace "${s}" not found`))}catch(e){t(e instanceof Error?e.message:`Failed to load marketplaces`)}finally{C(!1)}}e()},[t,s,l]),(0,W.useEffect)(()=>{if(!g)return;let e=!1;async function n(n){C(!0);try{let t=await Fe(n);if(e)return;if(!t)throw Error(`Failed to load marketplace: ${n}`);let r=[];for(let e of t.plugins){let t=L(e.name,n);se(t)||r.push({entry:e,marketplaceName:n,pluginId:t,isInstalled:pe(t)})}try{let t=await At();if(e)return;E(t),t?r.sort((e,n)=>{let r=t.get(e.pluginId)??0,i=t.get(n.pluginId)??0;return r===i?e.entry.name.localeCompare(n.entry.name):i-r}):r.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}catch(t){if(e)return;Je(`Failed to fetch install counts: ${Ge(t)}`),r.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}ee(r),O(0),A(new Set)}catch(n){if(e)return;t(n instanceof Error?n.message:`Failed to load plugins`)}finally{C(!1)}}return n(g),()=>{e=!0}},[g,t]);let de=async()=>{if(k.size===0)return;let e=S.filter(e=>k.has(e.pluginId));ae(new Set(e.map(e=>e.pluginId)));let n=0,a=0,s=[];for(let t of e){let e=await ge({pluginId:t.pluginId,entry:t.entry,marketplaceName:t.marketplaceName,scope:`user`});e.success?n++:(a++,s.push({name:t.entry.name,reason:e.error}))}ae(new Set),A(new Set),le(),a===0?r(`✓ Installed ${n} ${H(n,`plugin`)}. Run /reload-plugins to activate.`):n===0?t(`Failed to install: ${Be(s,!0)}`):r(`✓ Installed ${n} of ${n+a} plugins. Failed: ${Be(s,!1)}. Run /reload-plugins to activate successfully installed plugins.`),n>0&&o&&await o(),i({type:`menu`})},fe=async(e,t=`user`)=>{P(!0),ue(null);let n=await ge({pluginId:e.pluginId,entry:e.entry,marketplaceName:e.marketplaceName,scope:t});if(n.success){let t=await fn(e.pluginId);if(t){P(!1),h({type:`plugin-options`,plugin:t,pluginId:e.pluginId});return}r(n.message),o&&await o(),i({type:`menu`})}else P(!1),ue(n.error)};(0,W.useEffect)(()=>{e&&r(e)},[e,r]),c({"select:previous":()=>{D>0&&O(D-1)},"select:next":()=>{D<b.length-1&&O(D+1)},"select:accept":()=>{let e=b[D];e&&(_(e.name),h(`plugin-list`))}},{context:`Select`,isActive:m===`marketplace-list`}),c({"select:previous":()=>{D>0&&j.handleSelectionChange(D-1,O)},"select:next":()=>{D<S.length-1&&j.handleSelectionChange(D+1,O)},"select:accept":()=>{if(D===S.length&&k.size>0)de();else if(D<S.length){let e=S[D];e&&(e.isInstalled?i({type:`manage-plugins`,targetPlugin:e.entry.name,targetMarketplace:e.marketplaceName}):(y(e),h(`plugin-details`),N(0),ue(null)))}}},{context:`Select`,isActive:m===`plugin-list`}),c({"plugin:toggle":()=>{if(D<S.length){let e=S[D];if(e&&!e.isInstalled){let t=new Set(k);t.has(e.pluginId)?t.delete(e.pluginId):t.add(e.pluginId),A(t)}}},"plugin:install":()=>{k.size>0&&de()}},{context:`Plugin`,isActive:m===`plugin-list`});let me=An.useMemo(()=>{if(!v)return[];let e=v.entry.homepage;return xn(e,bn(v))},[v]);if(c({"select:previous":()=>{M>0&&N(M-1)},"select:next":()=>{M<me.length-1&&N(M+1)},"select:accept":()=>{if(!v)return;let e=me[M]?.action,t=v.entry.homepage,n=bn(v);e===`install-user`?fe(v,`user`):e===`install-project`?fe(v,`project`):e===`install-local`?fe(v,`local`):e===`homepage`&&t?we(t):e===`github`&&n?we(`https://github.com/${n}`):e===`back`&&(h(`plugin-list`),y(null))}},{context:`Select`,isActive:m===`plugin-details`&&!!v}),typeof m==`object`&&m.type===`plugin-options`){let{plugin:e,pluginId:t}=m;function n(e){r(e),o&&o(),i({type:`menu`})}return(0,G.jsx)(pn,{plugin:e,pluginId:t,onDone:(t,r)=>{switch(t){case`configured`:n(`✓ Installed and configured ${e.name}. Run /reload-plugins to apply.`);break;case`skipped`:n(`✓ Installed ${e.name}. Run /reload-plugins to apply.`);break;case`error`:n(`Installed but failed to save config: ${r}`);break}}})}if(te)return(0,G.jsx)(d,{children:`Loading…`});if(e)return(0,G.jsx)(d,{color:`error`,children:e});if(m===`marketplace-list`)return b.length===0?(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(d,{bold:!0,children:`Select marketplace`})}),(0,G.jsx)(d,{children:`No marketplaces configured.`}),(0,G.jsxs)(d,{dimColor:!0,children:[`Add a marketplace first using `,`'Add marketplace'`,`.`]}),(0,G.jsx)(u,{marginTop:1,paddingLeft:1,children:(0,G.jsx)(d,{dimColor:!0,children:(0,G.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})})})]}):(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(d,{bold:!0,children:`Select marketplace`})}),F&&(0,G.jsx)(u,{marginBottom:1,flexDirection:`column`,children:(0,G.jsxs)(d,{color:`warning`,children:[a.warning,` `,F]})}),b.map((e,t)=>(0,G.jsxs)(u,{flexDirection:`column`,marginBottom:+(t<b.length-1),children:[(0,G.jsx)(u,{children:(0,G.jsxs)(d,{color:D===t?`suggestion`:void 0,children:[D===t?a.pointer:` `,` `,e.name]})}),(0,G.jsx)(u,{marginLeft:2,children:(0,G.jsxs)(d,{dimColor:!0,children:[e.totalPlugins,` `,H(e.totalPlugins,`plugin`),` available`,e.installedCount>0&&` · ${e.installedCount} already installed`,e.source&&` · ${e.source}`]})})]},e.name)),(0,G.jsx)(u,{marginTop:1,children:(0,G.jsx)(d,{dimColor:!0,italic:!0,children:(0,G.jsxs)(f,{children:[(0,G.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,G.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]});if(m===`plugin-details`&&v){let e=v.entry.homepage,t=xn(e,bn(v));return(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(d,{bold:!0,children:`Plugin Details`})}),(0,G.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,G.jsx)(d,{bold:!0,children:v.entry.name}),v.entry.version&&(0,G.jsxs)(d,{dimColor:!0,children:[`Version: `,v.entry.version]}),v.entry.description&&(0,G.jsx)(u,{marginTop:1,children:(0,G.jsx)(d,{children:v.entry.description})}),v.entry.author&&(0,G.jsx)(u,{marginTop:1,children:(0,G.jsxs)(d,{dimColor:!0,children:[`By:`,` `,typeof v.entry.author==`string`?v.entry.author:v.entry.author.name]})})]}),(0,G.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,G.jsx)(d,{bold:!0,children:`Will install:`}),v.entry.commands&&(0,G.jsxs)(d,{dimColor:!0,children:[`· Commands:`,` `,Array.isArray(v.entry.commands)?v.entry.commands.join(`, `):Object.keys(v.entry.commands).join(`, `)]}),v.entry.agents&&(0,G.jsxs)(d,{dimColor:!0,children:[`· Agents:`,` `,Array.isArray(v.entry.agents)?v.entry.agents.join(`, `):Object.keys(v.entry.agents).join(`, `)]}),v.entry.hooks&&(0,G.jsxs)(d,{dimColor:!0,children:[`· Hooks: `,Object.keys(v.entry.hooks).join(`, `)]}),v.entry.mcpServers&&(0,G.jsxs)(d,{dimColor:!0,children:[`· MCP Servers:`,` `,Array.isArray(v.entry.mcpServers)?v.entry.mcpServers.join(`, `):typeof v.entry.mcpServers==`object`?Object.keys(v.entry.mcpServers).join(`, `):`configured`]}),!v.entry.commands&&!v.entry.agents&&!v.entry.hooks&&!v.entry.mcpServers&&(typeof v.entry.source==`object`&&`source`in v.entry.source&&(v.entry.source.source===`github`||v.entry.source.source===`url`||v.entry.source.source===`npm`||v.entry.source.source===`pip`)?(0,G.jsx)(d,{dimColor:!0,children:`· Component summary not available for remote plugin`}):(0,G.jsx)(d,{dimColor:!0,children:`· Components will be discovered at installation`}))]}),(0,G.jsx)(_n,{}),ce&&(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsxs)(d,{color:`error`,children:[`Error: `,ce]})}),(0,G.jsx)(u,{flexDirection:`column`,children:t.map((e,t)=>(0,G.jsxs)(u,{children:[M===t&&(0,G.jsx)(d,{children:`> `}),M!==t&&(0,G.jsx)(d,{children:` `}),(0,G.jsx)(d,{bold:M===t,children:oe&&e.action===`install`?`Installing…`:e.label})]},e.action))}),(0,G.jsx)(u,{marginTop:1,paddingLeft:1,children:(0,G.jsx)(d,{dimColor:!0,children:(0,G.jsxs)(f,{children:[(0,G.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,G.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(S.length===0)return(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(d,{bold:!0,children:`Install plugins`})}),(0,G.jsx)(d,{dimColor:!0,children:`No new plugins available to install.`}),(0,G.jsx)(d,{dimColor:!0,children:`All plugins from this marketplace are already installed.`}),(0,G.jsx)(u,{marginLeft:3,children:(0,G.jsx)(d,{dimColor:!0,italic:!0,children:(0,G.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})})})]});let he=j.getVisibleItems(S);return(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(d,{bold:!0,children:`Install Plugins`})}),j.scrollPosition.canScrollUp&&(0,G.jsx)(u,{children:(0,G.jsxs)(d,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),he.map((t,n)=>{let r=j.toActualIndex(n),i=D===r,o=k.has(t.pluginId),s=re.has(t.pluginId);return(0,G.jsxs)(u,{flexDirection:`column`,marginBottom:n===he.length-1&&!e?0:1,children:[(0,G.jsxs)(u,{children:[(0,G.jsxs)(d,{color:i?`suggestion`:void 0,children:[i?a.pointer:` `,` `]}),(0,G.jsxs)(d,{color:t.isInstalled?`success`:void 0,children:[t.isInstalled?a.tick:s?a.ellipsis:o?a.radioOn:a.radioOff,` `,t.entry.name,t.entry.category&&(0,G.jsxs)(d,{dimColor:!0,children:[` [`,t.entry.category,`]`]}),t.entry.tags?.includes(`community-managed`)&&(0,G.jsx)(d,{dimColor:!0,children:` [Community Managed]`}),t.isInstalled&&(0,G.jsx)(d,{dimColor:!0,children:` (installed)`}),ne&&g===`claude-plugins-official`&&(0,G.jsxs)(d,{dimColor:!0,children:[` · `,kt(ne.get(t.pluginId)??0),` installs`]})]})]}),t.entry.description&&(0,G.jsxs)(u,{marginLeft:4,children:[(0,G.jsx)(d,{dimColor:!0,children:dt(t.entry.description,60)}),t.entry.version&&(0,G.jsxs)(d,{dimColor:!0,children:[` · v`,t.entry.version]})]})]},t.pluginId)}),j.scrollPosition.canScrollDown&&(0,G.jsx)(u,{children:(0,G.jsxs)(d,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),e&&(0,G.jsx)(u,{marginTop:1,children:(0,G.jsxs)(d,{color:`error`,children:[a.cross,` `,e]})}),(0,G.jsx)(Sn,{hasSelection:k.size>0})]})}var An,W,G,jn=e((()=>{i(),An=t(h(),1),W=t(h(),1),Oe(),S(),O(),Ze(),He(),Ye(),We(),F(),Et(),z(),I(),Re(),ve(),ne(),j(),lt(),ft(),gn(),yn(),wn(),On(),G=C()}));function Mn({error:e,setError:t,result:n,setResult:r,setViewState:i,onInstallComplete:o,onSearchModeChange:s,targetPlugin:l}){let[h,_]=(0,K.useState)(`plugin-list`),[y,x]=(0,K.useState)(null),[S,ee]=(0,K.useState)([]),[te,C]=(0,K.useState)(!0),[w,ne]=(0,K.useState)(null),[E,D]=(0,K.useState)(!1),O=(0,K.useCallback)(e=>{D(e),s?.(e)},[s]),{query:A,setQuery:re,cursorOffset:ie}=Ut({isActive:h===`plugin-list`&&E&&!te,onExit:()=>{O(!1)}}),ae=m(),{columns:j}=b(),M=(0,K.useMemo)(()=>{if(!A)return S;let e=A.toLowerCase();return S.filter(t=>t.entry.name.toLowerCase().includes(e)||t.entry.description?.toLowerCase().includes(e)||t.marketplaceName.toLowerCase().includes(e))},[S,A]),[N,oe]=(0,K.useState)(0),[P,ce]=(0,K.useState)(new Set),[ue,F]=(0,K.useState)(new Set),I=Tn({totalItems:M.length,selectedIndex:N});(0,K.useEffect)(()=>{oe(0)},[A]);let[de,fe]=(0,K.useState)(0),[me,he]=(0,K.useState)(!1),[_e,ve]=(0,K.useState)(null),[ye,be]=(0,K.useState)(null),[z,xe]=(0,K.useState)(null);(0,K.useEffect)(()=>{async function e(){try{let e=await B(),{marketplaces:n,failures:r}=await T(e),i=[];for(let{name:e,data:t}of n)if(t)for(let n of t.plugins){let t=L(n.name,e);i.push({entry:n,marketplaceName:e,pluginId:t,isInstalled:pe(t)})}let a=i.filter(e=>!e.isInstalled&&!se(e.pluginId));try{let e=await At();ne(e),e?a.sort((t,n)=>{let r=e.get(t.pluginId)??0,i=e.get(n.pluginId)??0;return r===i?t.entry.name.localeCompare(n.entry.name):i-r}):a.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}catch(e){Je(`Failed to fetch install counts: ${Ge(e)}`),a.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}ee(a);let o=Object.keys(e).length;if(a.length===0){let e=await k({configuredMarketplaceCount:o,failedMarketplaceCount:r.length});xe(e)}let s=R(r,Qe(n,e=>e.data!==null));if(s)if(s.type===`warning`)be(`${s.message}. Showing available plugins.`);else throw Error(s.message);if(l){let e=i.find(e=>e.entry.name===l);e?e.isInstalled?t(`Plugin '${e.pluginId}' is already installed. Use '/plugin' to manage existing plugins.`):(x(e),_(`plugin-details`)):t(`Plugin "${l}" not found in any marketplace`)}}catch(e){t(e instanceof Error?e.message:`Failed to load plugins`)}finally{C(!1)}}e()},[t,l]);let Se=async()=>{if(P.size===0)return;let e=S.filter(e=>P.has(e.pluginId));F(new Set(e.map(e=>e.pluginId)));let n=0,a=0,s=[];for(let t of e){let e=await ge({pluginId:t.pluginId,entry:t.entry,marketplaceName:t.marketplaceName,scope:`user`});e.success?n++:(a++,s.push({name:t.entry.name,reason:e.error}))}F(new Set),ce(new Set),le(),a===0?r(`✓ Installed ${n} ${H(n,`plugin`)}. Run /reload-plugins to activate.`):n===0?t(`Failed to install: ${Be(s,!0)}`):r(`✓ Installed ${n} of ${n+a} plugins. Failed: ${Be(s,!1)}. Run /reload-plugins to activate successfully installed plugins.`),n>0&&o&&await o(),i({type:`menu`})},Ce=async(e,t=`user`)=>{he(!0),ve(null);let n=await ge({pluginId:e.pluginId,entry:e.entry,marketplaceName:e.marketplaceName,scope:t});if(n.success){let t=await fn(e.pluginId);if(t){he(!1),_({type:`plugin-options`,plugin:t,pluginId:e.pluginId});return}r(n.message),o&&await o(),i({type:`menu`})}else he(!1),ve(n.error)};(0,K.useEffect)(()=>{e&&r(e)},[e,r]),p(`confirm:no`,()=>{_(`plugin-list`),x(null)},{context:`Confirmation`,isActive:h===`plugin-details`}),p(`confirm:no`,()=>{i({type:`menu`})},{context:`Confirmation`,isActive:h===`plugin-list`&&!E}),g((e,t)=>{let n=!t.ctrl&&!t.meta;E||(e===`/`&&n?(O(!0),re(``)):n&&e.length>0&&!/^\s+$/.test(e)&&e!==`j`&&e!==`k`&&e!==`i`&&(O(!0),re(e)))},{isActive:h===`plugin-list`&&!te}),c({"select:previous":()=>{N===0?O(!0):I.handleSelectionChange(N-1,oe)},"select:next":()=>{N<M.length-1&&I.handleSelectionChange(N+1,oe)},"select:accept":()=>{if(N===M.length&&P.size>0)Se();else if(N<M.length){let e=M[N];e&&(e.isInstalled?i({type:`manage-plugins`,targetPlugin:e.entry.name,targetMarketplace:e.marketplaceName}):(x(e),_(`plugin-details`),fe(0),ve(null)))}}},{context:`Select`,isActive:h===`plugin-list`&&!E}),c({"plugin:toggle":()=>{if(N<M.length){let e=M[N];if(e&&!e.isInstalled){let t=new Set(P);t.has(e.pluginId)?t.delete(e.pluginId):t.add(e.pluginId),ce(t)}}},"plugin:install":()=>{P.size>0&&Se()}},{context:`Plugin`,isActive:h===`plugin-list`&&!E});let Te=Fn.useMemo(()=>{if(!y)return[];let e=y.entry.homepage;return xn(e,bn(y))},[y]);if(c({"select:previous":()=>{de>0&&fe(de-1)},"select:next":()=>{de<Te.length-1&&fe(de+1)},"select:accept":()=>{if(!y)return;let e=Te[de]?.action,t=y.entry.homepage,n=bn(y);e===`install-user`?Ce(y,`user`):e===`install-project`?Ce(y,`project`):e===`install-local`?Ce(y,`local`):e===`homepage`&&t?we(t):e===`github`&&n?we(`https://github.com/${n}`):e===`back`&&(_(`plugin-list`),x(null))}},{context:`Select`,isActive:h===`plugin-details`&&!!y}),typeof h==`object`&&h.type===`plugin-options`){let{plugin:e,pluginId:t}=h;function n(e){r(e),o&&o(),i({type:`menu`})}return(0,q.jsx)(pn,{plugin:e,pluginId:t,onDone:(t,r)=>{switch(t){case`configured`:n(`✓ Installed and configured ${e.name}. Run /reload-plugins to apply.`);break;case`skipped`:n(`✓ Installed ${e.name}. Run /reload-plugins to apply.`);break;case`error`:n(`Installed but failed to save config: ${r}`);break}}})}if(te)return(0,q.jsx)(d,{children:`Loading…`});if(e)return(0,q.jsx)(d,{color:`error`,children:e});if(h===`plugin-details`&&y){let e=y.entry.homepage,t=xn(e,bn(y));return(0,q.jsxs)(u,{flexDirection:`column`,children:[(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsx)(d,{bold:!0,children:`Plugin details`})}),(0,q.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,q.jsx)(d,{bold:!0,children:y.entry.name}),(0,q.jsxs)(d,{dimColor:!0,children:[`from `,y.marketplaceName]}),y.entry.version&&(0,q.jsxs)(d,{dimColor:!0,children:[`Version: `,y.entry.version]}),y.entry.description&&(0,q.jsx)(u,{marginTop:1,children:(0,q.jsx)(d,{children:y.entry.description})}),y.entry.author&&(0,q.jsx)(u,{marginTop:1,children:(0,q.jsxs)(d,{dimColor:!0,children:[`By:`,` `,typeof y.entry.author==`string`?y.entry.author:y.entry.author.name]})})]}),(0,q.jsx)(_n,{}),_e&&(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsxs)(d,{color:`error`,children:[`Error: `,_e]})}),(0,q.jsx)(u,{flexDirection:`column`,children:t.map((e,t)=>(0,q.jsxs)(u,{children:[de===t&&(0,q.jsx)(d,{children:`> `}),de!==t&&(0,q.jsx)(d,{children:` `}),(0,q.jsx)(d,{bold:de===t,children:me&&e.action.startsWith(`install-`)?`Installing…`:e.label})]},e.action))}),(0,q.jsx)(u,{marginTop:1,children:(0,q.jsx)(d,{dimColor:!0,children:(0,q.jsxs)(f,{children:[(0,q.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,q.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(S.length===0)return(0,q.jsxs)(u,{flexDirection:`column`,children:[(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsx)(d,{bold:!0,children:`Discover plugins`})}),(0,q.jsx)(Pn,{reason:z}),(0,q.jsx)(u,{marginTop:1,children:(0,q.jsx)(d,{dimColor:!0,italic:!0,children:`Esc to go back`})})]});let Ee=I.getVisibleItems(M);return(0,q.jsxs)(u,{flexDirection:`column`,children:[(0,q.jsxs)(u,{children:[(0,q.jsx)(d,{bold:!0,children:`Discover plugins`}),I.needsPagination&&(0,q.jsxs)(d,{dimColor:!0,children:[` `,`(`,I.scrollPosition.current,`/`,I.scrollPosition.total,`)`]})]}),(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsx)(v,{query:A,isFocused:E,isTerminalFocused:ae,width:j-4,cursorOffset:ie})}),ye&&(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsxs)(d,{color:`warning`,children:[a.warning,` `,ye]})}),M.length===0&&A&&(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsxs)(d,{dimColor:!0,children:[`No plugins match "`,A,`"`]})}),I.scrollPosition.canScrollUp&&(0,q.jsx)(u,{children:(0,q.jsxs)(d,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),Ee.map((t,n)=>{let r=I.toActualIndex(n),i=N===r,o=P.has(t.pluginId),s=ue.has(t.pluginId);return(0,q.jsxs)(u,{flexDirection:`column`,marginBottom:n===Ee.length-1&&!e?0:1,children:[(0,q.jsxs)(u,{children:[(0,q.jsxs)(d,{color:i&&!E?`suggestion`:void 0,children:[i&&!E?a.pointer:` `,` `]}),(0,q.jsxs)(d,{children:[s?a.ellipsis:o?a.radioOn:a.radioOff,` `,t.entry.name,(0,q.jsxs)(d,{dimColor:!0,children:[` · `,t.marketplaceName]}),t.entry.tags?.includes(`community-managed`)&&(0,q.jsx)(d,{dimColor:!0,children:` [Community Managed]`}),w&&t.marketplaceName===`claude-plugins-official`&&(0,q.jsxs)(d,{dimColor:!0,children:[` · `,kt(w.get(t.pluginId)??0),` installs`]})]})]}),t.entry.description&&(0,q.jsx)(u,{marginLeft:4,children:(0,q.jsx)(d,{dimColor:!0,children:dt(t.entry.description,60)})})]},`${I.startIndex}-${t.pluginId}`)}),I.scrollPosition.canScrollDown&&(0,q.jsx)(u,{children:(0,q.jsxs)(d,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),e&&(0,q.jsx)(u,{marginTop:1,children:(0,q.jsxs)(d,{color:`error`,children:[a.cross,` `,e]})}),(0,q.jsx)(Nn,{hasSelection:P.size>0,canToggle:N<M.length&&!M[N]?.isInstalled})]})}function Nn({hasSelection:e,canToggle:t}){return(0,q.jsx)(u,{marginTop:1,children:(0,q.jsx)(d,{dimColor:!0,italic:!0,children:(0,q.jsxs)(f,{children:[e&&(0,q.jsx)(V,{action:`plugin:install`,context:`Plugin`,fallback:`i`,description:`install`,bold:!0}),(0,q.jsx)(d,{children:`type to search`}),t&&(0,q.jsx)(V,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,q.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,q.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})}function Pn({reason:e}){switch(e){case`git-not-installed`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(d,{dimColor:!0,children:`Git is required to install marketplaces.`}),(0,q.jsx)(d,{dimColor:!0,children:`Please install git and restart Work Mate.`})]});case`all-blocked-by-policy`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(d,{dimColor:!0,children:`Your organization policy does not allow any external marketplaces.`}),(0,q.jsx)(d,{dimColor:!0,children:`Contact your administrator.`})]});case`policy-restricts-sources`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(d,{dimColor:!0,children:`Your organization restricts which marketplaces can be added.`}),(0,q.jsx)(d,{dimColor:!0,children:`Switch to the Marketplaces tab to view allowed sources.`})]});case`all-marketplaces-failed`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(d,{dimColor:!0,children:`Failed to load marketplace data.`}),(0,q.jsx)(d,{dimColor:!0,children:`Check your network connection.`})]});case`all-plugins-installed`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(d,{dimColor:!0,children:`All available plugins are already installed.`}),(0,q.jsx)(d,{dimColor:!0,children:`Check for new plugins later or add more marketplaces.`})]});default:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(d,{dimColor:!0,children:`No plugins available.`}),(0,q.jsx)(d,{dimColor:!0,children:`Add a marketplace first using the Marketplaces tab.`})]})}}var Fn,K,q,In=e((()=>{i(),Fn=t(h(),1),K=t(h(),1),Oe(),Ht(),S(),Wt(),je(),O(),Ze(),He(),Ye(),We(),F(),Et(),z(),I(),Re(),ve(),ne(),j(),lt(),ft(),gn(),yn(),wn(),On(),q=C()}));function Ln({setViewState:e,error:t,setError:n,setResult:r,exitState:i,onManageComplete:o,targetMarketplace:s,action:l}){let[m,h]=(0,zn.useState)([]),[_,v]=(0,zn.useState)(!0),[y,b]=(0,zn.useState)(0),[x,S]=(0,zn.useState)(!1),[ee,te]=(0,zn.useState)(null),[C,w]=(0,zn.useState)(null),[ne,E]=(0,zn.useState)(null),[D,O]=(0,zn.useState)(`list`),[k,A]=(0,zn.useState)(null),[re,j]=(0,zn.useState)(0),M=(0,zn.useRef)(!1);(0,zn.useEffect)(()=>{async function e(){try{let e=await B(),{enabled:r,disabled:i}=await ae(),a=[...r,...i],{marketplaces:o,failures:c}=await T(e),u=[];for(let{name:e,config:t,data:n}of o){let r=a.filter(t=>t.source.endsWith(`@${e}`));u.push({name:e,source:ie(t.source),lastUpdated:t.lastUpdated,pluginCount:n?.plugins.length,installedPlugins:r,pendingUpdate:!1,pendingRemove:!1,autoUpdate:tt(e,t)})}u.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),h(u);let d=R(c,Qe(o,e=>e.data!==null));if(d)if(d.type===`warning`)te(d.message);else throw Error(d.message);if(s&&!M.current&&!t){M.current=!0;let e=u.findIndex(e=>e.name===s);if(e>=0){let t=u[e];if(l){b(e+1);let t=[...u];l===`update`?t[e].pendingUpdate=!0:l===`remove`&&(t[e].pendingRemove=!0),h(t),setTimeout(P,100,t)}else t&&(b(e+1),A(t),O(`details`))}else n&&n(`Marketplace not found: ${s}`)}}catch(e){n&&n(e instanceof Error?e.message:`Failed to load marketplaces`),te(e instanceof Error?e.message:`Failed to load marketplaces`)}finally{v(!1)}}e()},[s,l,t]);let N=()=>m.some(e=>e.pendingUpdate||e.pendingRemove),oe=()=>({updateCount:Qe(m,e=>e.pendingUpdate),removeCount:Qe(m,e=>e.pendingRemove)}),P=async t=>{let i=t||m,s=D===`details`;S(!0),te(null),w(null),E(null);try{let t=it(`userSettings`),n=0,c=0,l=new Set;for(let e of i){if(e.pendingRemove){if(e.installedPlugins&&e.installedPlugins.length>0){let n={...t?.enabledPlugins};for(let t of e.installedPlugins){let r=L(t.name,e.name);n[r]=!1}et(`userSettings`,{enabledPlugins:n})}await De(e.name),c++,e.name,e.installedPlugins?.length;continue}e.pendingUpdate&&(await Me(e.name,e=>{E(e)}),n++,l.add(e.name.toLowerCase()),e.name)}let u=0;l.size>0&&(u=(await $t(l)).length),le(),o&&await o();let d=await B(),{enabled:f,disabled:p}=await ae(),m=[...f,...p],{marketplaces:g}=await T(d),_=[];for(let{name:e,config:t,data:n}of g){let r=m.filter(t=>t.source.endsWith(`@${e}`));_.push({name:e,source:ie(t.source),lastUpdated:t.lastUpdated,pluginCount:n?.plugins.length,installedPlugins:r,pendingUpdate:!1,pendingRemove:!1,autoUpdate:tt(e,t)})}if(_.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),h(_),s&&k){let e=_.find(e=>e.name===k.name);e&&A(e)}let v=[];if(n>0){let e=u>0?` (${u} ${H(u,`plugin`)} bumped)`:``;v.push(`Updated ${n} ${H(n,`marketplace`)}${e}`)}if(c>0&&v.push(`Removed ${c} ${H(c,`marketplace`)}`),v.length>0){let t=`${a.tick} ${v.join(`, `)}`;s?w(t):(r(t),setTimeout(e,2e3,{type:`menu`}))}else s||e({type:`menu`})}catch(e){let t=Ge(e);te(t),n&&n(t)}finally{S(!1),E(null)}},se=async()=>{if(!k)return;let e=m.map(e=>e.name===k.name?{...e,pendingRemove:!0}:e);h(e),await P(e)},ce=e=>{if(!e)return[];let t=[{label:`Browse plugins (${e.pluginCount??0})`,value:`browse`},{label:`Update marketplace`,secondaryLabel:e.lastUpdated?`(last updated ${new Date(e.lastUpdated).toLocaleDateString()})`:void 0,value:`update`}];return ot()||t.push({label:e.autoUpdate?`Disable auto-update`:`Enable auto-update`,value:`toggle-auto-update`}),t.push({label:`Remove marketplace`,value:`remove`}),t},ue=async e=>{let t=!e.autoUpdate;try{await Ve(e.name,t),h(n=>n.map(n=>n.name===e.name?{...n,autoUpdate:t}:n)),A(e=>e&&{...e,autoUpdate:t})}catch(e){te(e instanceof Error?e.message:`Failed to update setting`)}};if(p(`confirm:no`,()=>{O(`list`),j(0)},{context:`Confirmation`,isActive:!x&&(D===`details`||D===`confirm-remove`)}),p(`confirm:no`,()=>{h(e=>e.map(e=>({...e,pendingUpdate:!1,pendingRemove:!1}))),b(0)},{context:`Confirmation`,isActive:!x&&D===`list`&&N()}),p(`confirm:no`,()=>{e({type:`menu`})},{context:`Confirmation`,isActive:!x&&D===`list`&&!N()}),c({"select:previous":()=>b(e=>Math.max(0,e-1)),"select:next":()=>{let e=m.length+1;b(t=>Math.min(e-1,t+1))},"select:accept":()=>{let t=y-1;if(y===0)e({type:`add-marketplace`});else if(N())P();else{let e=m[t];e&&(A(e),O(`details`),j(0))}}},{context:`Select`,isActive:!x&&D===`list`}),g(e=>{let t=y-1;if((e===`u`||e===`U`)&&t>=0)h(e=>e.map((e,n)=>n===t?{...e,pendingUpdate:!e.pendingUpdate,pendingRemove:e.pendingUpdate?e.pendingRemove:!1}:e));else if((e===`r`||e===`R`)&&t>=0){let e=m[t];e&&(A(e),O(`confirm-remove`))}},{isActive:!x&&D===`list`}),c({"select:previous":()=>j(e=>Math.max(0,e-1)),"select:next":()=>{let e=ce(k);j(t=>Math.min(e.length-1,t+1))},"select:accept":()=>{if(!k)return;let t=ce(k)[re];if(t?.value===`browse`)e({type:`browse-marketplace`,targetMarketplace:k.name});else if(t?.value===`update`){let e=m.map(e=>e.name===k.name?{...e,pendingUpdate:!0}:e);h(e),P(e)}else t?.value===`toggle-auto-update`?ue(k):t?.value===`remove`&&O(`confirm-remove`)}},{context:`Select`,isActive:!x&&D===`details`}),g(e=>{e===`y`||e===`Y`?se():(e===`n`||e===`N`)&&(O(`list`),A(null))},{isActive:!x&&D===`confirm-remove`}),_)return(0,J.jsx)(d,{children:`Loading marketplaces…`});if(m.length===0)return(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsx)(u,{marginBottom:1,children:(0,J.jsx)(d,{bold:!0,children:`Manage marketplaces`})}),(0,J.jsxs)(u,{flexDirection:`row`,gap:1,children:[(0,J.jsxs)(d,{color:`suggestion`,children:[a.pointer,` +`]}),(0,J.jsx)(d,{bold:!0,color:`suggestion`,children:`Add Marketplace`})]}),(0,J.jsx)(u,{marginLeft:3,children:(0,J.jsx)(d,{dimColor:!0,italic:!0,children:i.pending?(0,J.jsxs)(J.Fragment,{children:[`Press `,i.keyName,` again to go back`]}):(0,J.jsxs)(f,{children:[(0,J.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,J.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]});if(D===`confirm-remove`&&k){let e=k.installedPlugins?.length||0;return(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsxs)(d,{bold:!0,color:`warning`,children:[`Remove marketplace `,(0,J.jsx)(d,{italic:!0,children:k.name}),`?`]}),(0,J.jsxs)(u,{flexDirection:`column`,children:[e>0&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsxs)(d,{color:`warning`,children:[`This will also uninstall `,e,` `,H(e,`plugin`),` from this marketplace:`]})}),k.installedPlugins&&k.installedPlugins.length>0&&(0,J.jsx)(u,{flexDirection:`column`,marginTop:1,marginLeft:2,children:k.installedPlugins.map(e=>(0,J.jsxs)(d,{dimColor:!0,children:[`• `,e.name]},e.name))}),(0,J.jsx)(u,{marginTop:1,children:(0,J.jsxs)(d,{children:[`Press `,(0,J.jsx)(d,{bold:!0,children:`y`}),` to confirm or `,(0,J.jsx)(d,{bold:!0,children:`n`}),` to cancel`]})})]})]})}if(D===`details`&&k){let e=k.pendingUpdate||x,t=ce(k);return(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsx)(d,{bold:!0,children:k.name}),(0,J.jsx)(d,{dimColor:!0,children:k.source}),(0,J.jsx)(u,{marginTop:1,children:(0,J.jsxs)(d,{children:[k.pluginCount||0,` available `,H(k.pluginCount||0,`plugin`)]})}),k.installedPlugins&&k.installedPlugins.length>0&&(0,J.jsxs)(u,{flexDirection:`column`,marginTop:1,children:[(0,J.jsxs)(d,{bold:!0,children:[`Installed plugins (`,k.installedPlugins.length,`):`]}),(0,J.jsx)(u,{flexDirection:`column`,marginLeft:1,children:k.installedPlugins.map(e=>(0,J.jsxs)(u,{flexDirection:`row`,gap:1,children:[(0,J.jsx)(d,{children:a.bullet}),(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsx)(d,{children:e.name}),(0,J.jsx)(d,{dimColor:!0,children:e.manifest.description})]})]},e.name))})]}),e&&(0,J.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,J.jsx)(d,{color:`claude`,children:`Updating marketplace…`}),ne&&(0,J.jsx)(d,{dimColor:!0,children:ne})]}),!e&&C&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(d,{color:`claude`,children:C})}),!e&&ee&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(d,{color:`error`,children:ee})}),!e&&(0,J.jsx)(u,{flexDirection:`column`,marginTop:1,children:t.map((e,t)=>{if(!e)return null;let n=t===re;return(0,J.jsxs)(u,{children:[(0,J.jsxs)(d,{color:n?`suggestion`:void 0,children:[n?a.pointer:` `,` `,e.label]}),e.secondaryLabel&&(0,J.jsxs)(d,{dimColor:!0,children:[` `,e.secondaryLabel]})]},e.value)})}),!e&&!ot()&&k.autoUpdate&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(d,{dimColor:!0,children:`Auto-update enabled. Work Mate will automatically update this marketplace and its installed plugins.`})}),(0,J.jsx)(u,{marginLeft:3,children:(0,J.jsx)(d,{dimColor:!0,italic:!0,children:e?(0,J.jsx)(J.Fragment,{children:`Please wait…`}):(0,J.jsxs)(f,{children:[(0,J.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,J.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]})}let{updateCount:F,removeCount:I}=oe();return(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsx)(u,{marginBottom:1,children:(0,J.jsx)(d,{bold:!0,children:`Manage marketplaces`})}),(0,J.jsxs)(u,{flexDirection:`row`,gap:1,marginBottom:1,children:[(0,J.jsxs)(d,{color:y===0?`suggestion`:void 0,children:[y===0?a.pointer:` `,` +`]}),(0,J.jsx)(d,{bold:!0,color:y===0?`suggestion`:void 0,children:`Add Marketplace`})]}),(0,J.jsx)(u,{flexDirection:`column`,children:m.map((e,t)=>{let n=t+1===y,r=[];return e.pendingUpdate&&r.push(`UPDATE`),e.pendingRemove&&r.push(`REMOVE`),(0,J.jsxs)(u,{flexDirection:`row`,gap:1,marginBottom:1,children:[(0,J.jsxs)(d,{color:n?`suggestion`:void 0,children:[n?a.pointer:` `,` `,e.pendingRemove?a.cross:a.bullet]}),(0,J.jsxs)(u,{flexDirection:`column`,flexGrow:1,children:[(0,J.jsxs)(u,{flexDirection:`row`,gap:1,children:[(0,J.jsxs)(d,{bold:!0,strikethrough:e.pendingRemove,dimColor:e.pendingRemove,children:[e.name===`claude-plugins-official`&&(0,J.jsx)(d,{color:`claude`,children:`✻ `}),e.name,e.name===`claude-plugins-official`&&(0,J.jsx)(d,{color:`claude`,children:` ✻`})]}),r.length>0&&(0,J.jsxs)(d,{color:`warning`,children:[`[`,r.join(`, `),`]`]})]}),(0,J.jsx)(d,{dimColor:!0,children:e.source}),(0,J.jsxs)(d,{dimColor:!0,children:[e.pluginCount!==void 0&&(0,J.jsxs)(J.Fragment,{children:[e.pluginCount,` available`]}),e.installedPlugins&&e.installedPlugins.length>0&&(0,J.jsxs)(J.Fragment,{children:[` • `,e.installedPlugins.length,` installed`]}),e.lastUpdated&&(0,J.jsxs)(J.Fragment,{children:[` • Updated `,new Date(e.lastUpdated).toLocaleDateString()]})]})]})]},e.name)})}),N()&&(0,J.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,J.jsxs)(d,{children:[(0,J.jsx)(d,{bold:!0,children:`Pending changes:`}),` `,(0,J.jsx)(d,{dimColor:!0,children:`Enter to apply`})]}),F>0&&(0,J.jsxs)(d,{children:[`• Update `,F,` `,H(F,`marketplace`)]}),I>0&&(0,J.jsxs)(d,{color:`warning`,children:[`• Remove `,I,` `,H(I,`marketplace`)]})]}),x&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(d,{color:`claude`,children:`Processing changes…`})}),ee&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(d,{color:`error`,children:ee})}),(0,J.jsx)(Rn,{exitState:i,hasPendingActions:N()})]})}function Rn({exitState:e,hasPendingActions:t}){return e.pending?(0,J.jsx)(u,{marginTop:1,children:(0,J.jsxs)(d,{dimColor:!0,italic:!0,children:[`Press `,e.keyName,` again to go back`]})}):(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(d,{dimColor:!0,italic:!0,children:(0,J.jsxs)(f,{children:[t&&(0,J.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`apply changes`}),!t&&(0,J.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),!t&&(0,J.jsx)(o,{shortcut:`u`,action:`update`}),!t&&(0,J.jsx)(o,{shortcut:`r`,action:`remove`}),(0,J.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:t?`cancel`:`go back`})]})})})}var zn,J,Bn=e((()=>{i(),zn=t(h(),1),ut(),Oe(),S(),O(),Ze(),at(),We(),F(),I(),Re(),en(),fe(),$e(),rt(),lt(),J=C()}));function Vn(e){switch(e.type){case`path-not-found`:return`${e.component} path not found: ${e.path}`;case`git-auth-failed`:return`Git ${e.authType.toUpperCase()} authentication failed for ${e.gitUrl}`;case`git-timeout`:return`Git ${e.operation} timed out for ${e.gitUrl}`;case`network-error`:return`Network error accessing ${e.url}${e.details?`: ${e.details}`:``}`;case`manifest-parse-error`:return`Failed to parse manifest at ${e.manifestPath}: ${e.parseError}`;case`manifest-validation-error`:return`Invalid manifest at ${e.manifestPath}: ${e.validationErrors.join(`, `)}`;case`plugin-not-found`:return`Plugin "${e.pluginId}" not found in marketplace "${e.marketplace}"`;case`marketplace-not-found`:return`Marketplace "${e.marketplace}" not found`;case`marketplace-load-failed`:return`Failed to load marketplace "${e.marketplace}": ${e.reason}`;case`mcp-config-invalid`:return`Invalid MCP server config for "${e.serverName}": ${e.validationError}`;case`mcp-server-suppressed-duplicate`:{let t=e.duplicateOf.startsWith(`plugin:`)?`server provided by plugin "${e.duplicateOf.split(`:`)[1]??`?`}"`:`already-configured "${e.duplicateOf}"`;return`MCP server "${e.serverName}" skipped — same command/URL as ${t}`}case`hook-load-failed`:return`Failed to load hooks from ${e.hookPath}: ${e.reason}`;case`component-load-failed`:return`Failed to load ${e.component} from ${e.path}: ${e.reason}`;case`mcpb-download-failed`:return`Failed to download MCPB from ${e.url}: ${e.reason}`;case`mcpb-extract-failed`:return`Failed to extract MCPB ${e.mcpbPath}: ${e.reason}`;case`mcpb-invalid-manifest`:return`MCPB manifest invalid at ${e.mcpbPath}: ${e.validationError}`;case`marketplace-blocked-by-policy`:return e.blockedByBlocklist?`Marketplace "${e.marketplace}" is blocked by enterprise policy`:`Marketplace "${e.marketplace}" is not in the allowed marketplace list`;case`dependency-unsatisfied`:return e.reason===`not-enabled`?`Dependency "${e.dependency}" is disabled`:`Dependency "${e.dependency}" is not installed`;case`lsp-config-invalid`:return`Invalid LSP server config for "${e.serverName}": ${e.validationError}`;case`lsp-server-start-failed`:return`LSP server "${e.serverName}" failed to start: ${e.reason}`;case`lsp-server-crashed`:return e.signal?`LSP server "${e.serverName}" crashed with signal ${e.signal}`:`LSP server "${e.serverName}" crashed with exit code ${e.exitCode??`unknown`}`;case`lsp-request-timeout`:return`LSP server "${e.serverName}" timed out on ${e.method} after ${e.timeoutMs}ms`;case`lsp-request-failed`:return`LSP server "${e.serverName}" ${e.method} failed: ${e.error}`;case`plugin-cache-miss`:return`Plugin "${e.plugin}" not cached at ${e.installPath}`;case`generic-error`:return e.error}return Ee(e)}function Hn(e){switch(e.type){case`path-not-found`:return`Check that the path in your manifest or marketplace config is correct`;case`git-auth-failed`:return e.authType===`ssh`?`Configure SSH keys or use HTTPS URL instead`:`Configure credentials or use SSH URL instead`;case`git-timeout`:case`network-error`:return`Check your internet connection and try again`;case`manifest-parse-error`:return`Check manifest file syntax in the plugin directory`;case`manifest-validation-error`:return`Check manifest file follows the required schema`;case`plugin-not-found`:return`Plugin may not exist in marketplace "${e.marketplace}"`;case`marketplace-not-found`:return e.availableMarketplaces.length>0?`Available marketplaces: ${e.availableMarketplaces.join(`, `)}`:`Add the marketplace first using /plugin marketplace add`;case`mcp-config-invalid`:return`Check MCP server configuration in .mcp.json or manifest`;case`mcp-server-suppressed-duplicate`:return e.duplicateOf.startsWith(`plugin:`)?`Disable plugin "${e.duplicateOf.split(`:`)[1]??`the other plugin`}" if you want this plugin's version instead`:`Remove "${e.duplicateOf}" from your MCP config if you want the plugin's version instead`;case`hook-load-failed`:return`Check hooks.json file syntax and structure`;case`component-load-failed`:return`Check ${e.component} directory structure and file permissions`;case`mcpb-download-failed`:return`Check your internet connection and URL accessibility`;case`mcpb-extract-failed`:return`Verify the MCPB file is valid and not corrupted`;case`mcpb-invalid-manifest`:return`Contact the plugin author about the invalid manifest`;case`marketplace-blocked-by-policy`:return e.blockedByBlocklist?`This marketplace source is explicitly blocked by your administrator`:e.allowedSources.length>0?`Allowed sources: ${e.allowedSources.join(`, `)}`:`Contact your administrator to configure allowed marketplace sources`;case`dependency-unsatisfied`:return e.reason===`not-enabled`?`Enable "${e.dependency}" or uninstall "${e.plugin}"`:`Install "${e.dependency}" or uninstall "${e.plugin}"`;case`lsp-config-invalid`:return`Check LSP server configuration in the plugin manifest`;case`lsp-server-start-failed`:case`lsp-server-crashed`:case`lsp-request-timeout`:case`lsp-request-failed`:return`Check LSP server logs with --debug for details`;case`plugin-cache-miss`:return`Run /plugins to refresh the plugin cache`;case`marketplace-load-failed`:case`generic-error`:return null}return null}var Un=e((()=>{Ie()}));function Wn({item:e,isSelected:t}){let[n]=l();if(e.type===`plugin`){let r,i;return e.pendingToggle?(r=_(`suggestion`,n)(a.arrowRight),i=e.pendingToggle===`will-enable`?`will enable`:`will disable`):e.errorCount>0?(r=_(`error`,n)(a.cross),i=`${e.errorCount} ${H(e.errorCount,`error`)}`):e.isEnabled?(r=_(`success`,n)(a.tick),i=`enabled`):(r=_(`inactive`,n)(a.radioOff),i=`disabled`),(0,Y.jsxs)(u,{children:[(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(d,{dimColor:!t,children:[` `,(0,Y.jsx)(d,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(d,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(d,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(d,{dimColor:!t,children:i})]})}if(e.type===`flagged-plugin`){let r=_(`warning`,n)(a.warning);return(0,Y.jsxs)(u,{children:[(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(d,{dimColor:!t,children:[` `,(0,Y.jsx)(d,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(d,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(d,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(d,{dimColor:!t,children:`removed`})]})}if(e.type===`failed-plugin`){let r=_(`error`,n)(a.cross),i=`failed to load · ${e.errorCount} ${H(e.errorCount,`error`)}`;return(0,Y.jsxs)(u,{children:[(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(d,{dimColor:!t,children:[` `,(0,Y.jsx)(d,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(d,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(d,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(d,{dimColor:!t,children:i})]})}let r,i;return e.status===`connected`?(r=_(`success`,n)(a.tick),i=`connected`):e.status===`disabled`?(r=_(`inactive`,n)(a.radioOff),i=`disabled`):e.status===`pending`?(r=_(`inactive`,n)(a.radioOff),i=`connecting…`):e.status===`needs-auth`?(r=_(`warning`,n)(a.triangleUpOutline),i=`Enter to auth`):(r=_(`error`,n)(a.cross),i=`failed`),e.indented?(0,Y.jsxs)(u,{children:[(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(d,{dimColor:!t,children:`└ `}),(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(d,{dimColor:!t,children:[` `,(0,Y.jsx)(d,{backgroundColor:`userMessageBackground`,children:`MCP`})]}),(0,Y.jsxs)(d,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(d,{dimColor:!t,children:i})]}):(0,Y.jsxs)(u,{children:[(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(d,{dimColor:!t,children:[` `,(0,Y.jsx)(d,{backgroundColor:`userMessageBackground`,children:`MCP`})]}),(0,Y.jsxs)(d,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(d,{dimColor:!t,children:i})]})}var Y,Gn=e((()=>{i(),S(),lt(),Y=C()}));async function Kn(e){try{return(await nn.readdir(e,{withFileTypes:!0})).filter(e=>e.isFile()&&e.name.endsWith(`.md`)).map(e=>tn.basename(e.name,`.md`))}catch(t){return Je(`Failed to read plugin components from ${e}: ${Ge(t)}`,{level:`error`}),ct(qe(t)),[]}}async function qn(e){try{let t=await nn.readdir(e,{withFileTypes:!0}),n=[];for(let r of t)if(r.isDirectory()||r.isSymbolicLink()){let t=tn.join(e,r.name,`SKILL.md`);try{(await nn.stat(t)).isFile()&&n.push(r.name)}catch{}}return n}catch(t){return Je(`Failed to read skill directories from ${e}: ${Ge(t)}`,{level:`error`}),ct(qe(t)),[]}}function Jn({plugin:e,marketplace:t}){let[n,r]=(0,X.useState)(null),[i,a]=(0,X.useState)(!0),[o,s]=(0,X.useState)(null);return(0,X.useEffect)(()=>{async function n(){try{if(t===`builtin`){let t=Ce(e.name);if(t){let e=t.skills?.map(e=>e.name)??[],n=t.hooks?Object.keys(t.hooks):[],i=t.mcpServers?Object.keys(t.mcpServers):[];r({commands:null,agents:null,skills:e.length>0?e:null,hooks:n.length>0?n:null,mcpServers:i.length>0?i:null})}else s(`Built-in plugin ${e.name} not found`);a(!1);return}let n=(await Fe(t)).plugins.find(t=>t.name===e.name);if(n){let t=[];e.commandsPath&&t.push(e.commandsPath),e.commandsPaths&&t.push(...e.commandsPaths);let i=[];for(let e of t)if(typeof e==`string`){let t=await Kn(e);i.push(...t)}let a=[];e.agentsPath&&a.push(e.agentsPath),e.agentsPaths&&a.push(...e.agentsPaths);let o=[];for(let e of a)if(typeof e==`string`){let t=await Kn(e);o.push(...t)}let s=[];e.skillsPath&&s.push(e.skillsPath),e.skillsPaths&&s.push(...e.skillsPaths);let c=[];for(let e of s)if(typeof e==`string`){let t=await qn(e);c.push(...t)}let l=[];e.hooksConfig&&l.push(Object.keys(e.hooksConfig)),n.hooks&&l.push(n.hooks);let u=[];e.mcpServers&&u.push(Object.keys(e.mcpServers)),n.mcpServers&&u.push(n.mcpServers),r({commands:i.length>0?i:null,agents:o.length>0?o:null,skills:c.length>0?c:null,hooks:l.length>0?l:null,mcpServers:u.length>0?u:null})}else s(`Plugin ${e.name} not found in marketplace`)}catch(e){s(e instanceof Error?e.message:`Failed to load components`)}finally{a(!1)}}n()},[e.name,e.commandsPath,e.commandsPaths,e.agentsPath,e.agentsPaths,e.skillsPath,e.skillsPaths,e.hooksConfig,e.mcpServers,t]),i?null:o?(0,Z.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsx)(d,{bold:!0,children:`Components:`}),(0,Z.jsxs)(d,{dimColor:!0,children:[`Error: `,o]})]}):!n||!(n.commands||n.agents||n.skills||n.hooks||n.mcpServers)?null:(0,Z.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsx)(d,{bold:!0,children:`Installed components:`}),n.commands?(0,Z.jsxs)(d,{dimColor:!0,children:[`• Commands:`,` `,typeof n.commands==`string`?n.commands:Array.isArray(n.commands)?n.commands.join(`, `):Object.keys(n.commands).join(`, `)]}):null,n.agents?(0,Z.jsxs)(d,{dimColor:!0,children:[`• Agents:`,` `,typeof n.agents==`string`?n.agents:Array.isArray(n.agents)?n.agents.join(`, `):Object.keys(n.agents).join(`, `)]}):null,n.skills?(0,Z.jsxs)(d,{dimColor:!0,children:[`• Skills:`,` `,typeof n.skills==`string`?n.skills:Array.isArray(n.skills)?n.skills.join(`, `):Object.keys(n.skills).join(`, `)]}):null,n.hooks?(0,Z.jsxs)(d,{dimColor:!0,children:[`• Hooks:`,` `,typeof n.hooks==`string`?n.hooks:Array.isArray(n.hooks)?n.hooks.map(String).join(`, `):typeof n.hooks==`object`&&n.hooks!==null?Object.keys(n.hooks).join(`, `):String(n.hooks)]}):null,n.mcpServers?(0,Z.jsxs)(d,{dimColor:!0,children:[`• MCP Servers:`,` `,typeof n.mcpServers==`string`?n.mcpServers:Array.isArray(n.mcpServers)?n.mcpServers.map(String).join(`, `):typeof n.mcpServers==`object`&&n.mcpServers!==null?Object.keys(n.mcpServers).join(`, `):String(n.mcpServers)]}):null]})}async function Yn(e,t){let n=(await Fe(t))?.plugins.find(t=>t.name===e);return n&&typeof n.source==`string`?`Local plugins cannot be updated remotely. To update, modify the source at: ${n.source}`:null}function Xn(e){return e.filter(e=>{let t=e.source.split(`@`)[1]||`local`;return!se(`${e.name}@${t}`)})}function Zn({setViewState:e,setResult:t,onManageComplete:n,onSearchModeChange:r,targetPlugin:i,targetMarketplace:o,action:s}){let l=E(e=>e.mcp.clients),h=E(e=>e.mcp.tools),_=E(e=>e.plugins.errors),y=Nt(),[x,S]=(0,X.useState)(!1),ee=(0,X.useCallback)(e=>{S(e),r?.(e)},[r]),te=m(),{columns:C}=b(),[w,T]=(0,X.useState)(`plugin-list`),{query:ne,setQuery:D,cursorOffset:O}=Ut({isActive:w===`plugin-list`&&x,onExit:()=>{ee(!1)}}),[k,A]=(0,X.useState)(null),[re,ie]=(0,X.useState)([]),[j,M]=(0,X.useState)([]),[N,oe]=(0,X.useState)(!0),[P,se]=(0,X.useState)(new Map),F=(0,X.useRef)(!1),I=(0,X.useRef)(void 0),fe=It();p(`confirm:no`,Qn.useCallback(()=>{if(w===`plugin-details`)T(`plugin-list`),A(null),B(null);else if(typeof w==`object`&&w.type===`failed-plugin-details`)T(`plugin-list`),B(null);else if(w===`configuring`)T(`plugin-details`),De(null);else if(typeof w==`object`&&(w.type===`plugin-options`||w.type===`configuring-options`))T(`plugin-list`),A(null),t(`Plugin enabled. Configuration skipped — run /reload-plugins to apply.`),n&&n();else if(typeof w==`object`&&w.type===`flagged-detail`)T(`plugin-list`),B(null);else if(typeof w==`object`&&w.type===`mcp-detail`)T(`plugin-list`),B(null);else if(typeof w==`object`&&w.type===`mcp-tools`)T({type:`mcp-detail`,client:w.client});else if(typeof w==`object`&&w.type===`mcp-tool-detail`)T({type:`mcp-tools`,client:w.client});else{if(P.size>0){t(`Run /reload-plugins to apply plugin changes.`);return}e({type:`menu`})}},[w,e,P,t]),{context:`Confirmation`,isActive:(w!==`plugin-list`||!x)&&w!==`confirm-project-uninstall`&&!(typeof w==`object`&&w.type===`confirm-data-cleanup`)});let pe=e=>e.type===`connected`?`connected`:e.type===`disabled`?`disabled`:e.type===`pending`?`pending`:e.type===`needs-auth`?`needs-auth`:`failed`,me=(0,X.useMemo)(()=>{let e=nt(),t=new Map;for(let e of l)if(e.name.startsWith(`plugin:`)){let n=e.name.split(`:`);if(n.length>=3){let r=n[1],i=n.slice(2).join(`:`),a=t.get(r)||[];a.push({displayName:i,client:e}),t.set(r,a)}}let n=[];for(let r of j){let i=`${r.plugin.name}@${r.marketplace}`,a=e?.enabledPlugins?.[i]!==!1,o=_.filter(e=>`plugin`in e&&e.plugin===r.plugin.name||e.source===i||e.source.startsWith(`${r.plugin.name}@`)),s=r.plugin.isBuiltin?`builtin`:r.scope||`user`;n.push({item:{type:`plugin`,id:i,name:r.plugin.name,description:r.plugin.manifest.description,marketplace:r.marketplace,scope:s,isEnabled:a,errorCount:o.length,errors:o,plugin:r.plugin,pendingEnable:r.pendingEnable,pendingUpdate:r.pendingUpdate,pendingToggle:P.get(i)},originalScope:s,childMcps:t.get(r.plugin.name)||[]})}let r=new Set(n.map(({item:e})=>e.id)),i=new Set(n.map(({item:e})=>e.name)),a=new Map;for(let e of _){if(r.has(e.source)||`plugin`in e&&typeof e.plugin==`string`&&i.has(e.plugin))continue;let t=a.get(e.source)||[];t.push(e),a.set(e.source,t)}let o=gt(),s=[];for(let[e,t]of a){if(e in y)continue;let n=Pe(e),r=n.name||e,i=n.marketplace||`unknown`,a=o.get(e),c=a===`flag`||a===void 0?`user`:a;s.push({type:`failed-plugin`,id:e,name:r,marketplace:i,scope:c,errorCount:t.length,errors:t})}let c=[];for(let e of l)e.name!==`ide`&&(e.name.startsWith(`plugin:`)||c.push({type:`mcp`,id:`mcp:${e.name}`,name:e.name,description:void 0,scope:e.config.scope,status:pe(e),client:e}));let u={flagged:-1,project:0,local:1,user:2,enterprise:3,managed:4,dynamic:5,builtin:6},d=[],f=new Map;for(let{item:e,originalScope:t,childMcps:r}of n){let n=e.scope;f.has(n)||f.set(n,[]),f.get(n).push(e);for(let{displayName:e,client:n}of r){let r=t===`builtin`?`user`:t;f.has(r)||f.set(r,[]),f.get(r).push({type:`mcp`,id:`mcp:${n.name}`,name:e,description:void 0,scope:r,status:pe(n),client:n,indented:!0})}}for(let e of c){let t=e.scope;f.has(t)||f.set(t,[]),f.get(t).push(e)}for(let e of s){let t=e.scope;f.has(t)||f.set(t,[]),f.get(t).push(e)}for(let[e,t]of Object.entries(y)){let n=Pe(e),r=n.name||e,i=n.marketplace||`unknown`;f.has(`flagged`)||f.set(`flagged`,[]),f.get(`flagged`).push({type:`flagged-plugin`,id:e,name:r,marketplace:i,scope:`flagged`,reason:`delisted`,text:`Removed from marketplace`,flaggedAt:t.flaggedAt})}let p=[...f.keys()].sort((e,t)=>(u[e]??99)-(u[t]??99));for(let e of p){let t=f.get(e),n=[],r=[],i=0;for(;i<t.length;){let e=t[i];if(e.type===`plugin`||e.type===`failed-plugin`||e.type===`flagged-plugin`){let r=[e];i++;let a=t[i];for(;a?.type===`mcp`&&a.indented;)r.push(a),i++,a=t[i];n.push(r)}else e.type===`mcp`&&!e.indented&&r.push(e),i++}n.sort((e,t)=>e[0].name.localeCompare(t[0].name)),r.sort((e,t)=>e.name.localeCompare(t.name));for(let e of n)d.push(...e);d.push(...r)}return d},[j,l,_,P,y]),he=(0,X.useMemo)(()=>me.filter(e=>e.type===`flagged-plugin`).map(e=>e.id),[me]);(0,X.useEffect)(()=>{he.length>0&&Mt(he)},[he]);let L=(0,X.useMemo)(()=>{if(!ne)return me;let e=ne.toLowerCase();return me.filter(t=>t.name.toLowerCase().includes(e)||`description`in t&&t.description?.toLowerCase().includes(e))},[me,ne]),[R,ge]=(0,X.useState)(0),_e=Tn({totalItems:L.length,selectedIndex:R,maxVisible:8}),[ve,ye]=(0,X.useState)(0),[be,z]=(0,X.useState)(!1),[Ce,B]=(0,X.useState)(null),[Ee,De]=(0,X.useState)(null),[Oe,ke]=(0,X.useState)(!1),[Ae,je]=(0,X.useState)(!1);(0,X.useEffect)(()=>{if(!k){je(!1);return}async function e(){let e=k.plugin.manifest.mcpServers,t=!1;if(e&&(t=typeof e==`string`&&xe(e)||Array.isArray(e)&&e.some(e=>typeof e==`string`&&xe(e))),!t)try{let e=tn.join(k.plugin.path,`..`),n=tn.join(e,`.claude-plugin`,`marketplace.json`),r=Ke(await nn.readFile(n,`utf-8`)).plugins?.find(e=>e.name===k.plugin.name);if(r?.mcpServers){let e=r.mcpServers;t=typeof e==`string`&&xe(e)||Array.isArray(e)&&e.some(e=>typeof e==`string`&&xe(e))}}catch(e){Je(`Failed to read raw marketplace.json: ${e}`)}je(t)}e()},[k]),(0,X.useEffect)(()=>{async function e(){oe(!0);try{let{enabled:e,disabled:t}=await ae(),n=nt(),r=Xn([...e,...t]),i={};for(let e of r){let t=e.source.split(`@`)[1]||`local`;i[t]||(i[t]=[]),i[t].push(e)}let a=[];for(let[e,t]of Object.entries(i)){let r=Qe(t,t=>{let r=`${t.name}@${e}`;return n?.enabledPlugins?.[r]!==!1}),i=t.length-r;a.push({name:e,installedPlugins:t,enabledCount:r,disabledCount:i})}a.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),ie(a);let o=[];for(let e of a)for(let t of e.installedPlugins){let n=`${t.name}@${e.name}`,r=t.isBuiltin?`builtin`:St(n).scope;o.push({plugin:t,marketplace:e.name,scope:r,pendingEnable:void 0,pendingUpdate:!1})}M(o),ge(0)}finally{oe(!1)}}e()},[]),(0,X.useEffect)(()=>{if(!F.current&&i&&re.length>0&&!N){let{name:e,marketplace:n}=Pe(i),r=o??n,a=r?re.filter(e=>e.name===r):re;for(let t of a){let n=t.installedPlugins.find(t=>t.name===e);if(n){let{scope:e}=St(`${n.name}@${t.name}`),r={plugin:n,marketplace:t.name,scope:e,pendingEnable:void 0,pendingUpdate:!1};A(r),T(`plugin-details`),I.current=s,F.current=!0;return}}let c=me.find(t=>t.type===`failed-plugin`&&t.name===e);c&&c.type===`failed-plugin`&&(T({type:`failed-plugin-details`,plugin:{id:c.id,name:c.name,marketplace:c.marketplace,errors:c.errors,scope:c.scope}}),F.current=!0),!F.current&&s&&(F.current=!0,t(`Plugin "${i}" is not installed in this project`))}},[i,o,re,N,me,s,t]);let Me=async r=>{if(!k)return;let i=k.scope||`user`,a=i===`builtin`;if(a&&(r===`update`||r===`uninstall`)){B(`Built-in plugins cannot be updated or uninstalled.`);return}if(!a&&!xt(i)&&r!==`update`){B(`This plugin is managed by your organization. Contact your admin to disable it.`);return}z(!0),B(null);try{let o=`${k.plugin.name}@${k.marketplace}`,s;switch(r){case`enable`:{let e=await _t(o);if(!e.success)throw Error(e.message);break}case`disable`:{let e=await bt(o);if(!e.success)throw Error(e.message);s=e.reverseDependents;break}case`uninstall`:{if(a||!xt(i))break;if(wt(o)){z(!1),T(`confirm-project-uninstall`);return}let e=Le().plugins[o],t=!e||e.length<=1?await de(o):null;if(t){z(!1),T({type:`confirm-data-cleanup`,size:t});return}let n=await vt(o,i);if(!n.success)throw Error(n.message);s=n.reverseDependents;break}case`update`:{if(a)break;let r=await yt(o,i);if(!r.success)throw Error(r.message);if(r.alreadyUpToDate){t(`${k.plugin.name} is already at the latest version (${r.newVersion}).`),n&&await n(),e({type:`menu`});return}break}}le();let c=`${k.plugin.name}@${k.marketplace}`;if(nt()?.enabledPlugins?.[c]!==!1){z(!1),T({type:`plugin-options`});return}let l=r===`enable`?`Enabled`:r===`disable`?`Disabled`:r===`update`?`Updated`:`Uninstalled`,u=s&&s.length>0?` · required by ${s.join(`, `)}`:``;t(`✓ ${l} ${k.plugin.name}${u}. Run /reload-plugins to apply.`),n&&await n(),e({type:`menu`})}catch(e){z(!1);let t=e instanceof Error?e.message:String(e);B(`Failed to ${r}: ${t}`),ct(qe(e))}},Fe=(0,X.useRef)(Me);Fe.current=Me,(0,X.useEffect)(()=>{if(w===`plugin-details`&&k&&I.current){let e=I.current;I.current=void 0,Fe.current(e)}},[w,k]);let Ie=Qn.useCallback(()=>{if(R>=L.length)return;let e=L[R];if(e?.type!==`flagged-plugin`)if(e?.type===`plugin`){let t=`${e.plugin.name}@${e.marketplace}`,n=nt(),r=P.get(t),i=n?.enabledPlugins?.[t]!==!1,a=e.scope;if(a===`builtin`||xt(a)){let e=new Map(P);r?(e.delete(t),(async()=>{try{r===`will-disable`?await _t(t):await bt(t),le()}catch(e){ct(e)}})()):(e.set(t,i?`will-disable`:`will-enable`),(async()=>{try{i?await bt(t):await _t(t),le()}catch(e){ct(e)}})()),se(e)}}else e?.type===`mcp`&&fe(e.client.name)},[R,L,P,j,fe]);c({"select:previous":()=>{R===0?ee(!0):_e.handleSelectionChange(R-1,ge)},"select:next":()=>{R<L.length-1&&_e.handleSelectionChange(R+1,ge)},"select:accept":Qn.useCallback(()=>{if(R>=L.length)return;let e=L[R];if(e?.type===`plugin`){let t=j.find(t=>t.plugin.name===e.plugin.name&&t.marketplace===e.marketplace);t&&(A(t),T(`plugin-details`),ye(0),B(null))}else e?.type===`flagged-plugin`?(T({type:`flagged-detail`,plugin:{id:e.id,name:e.name,marketplace:e.marketplace,reason:e.reason,text:e.text,flaggedAt:e.flaggedAt}}),B(null)):e?.type===`failed-plugin`?(T({type:`failed-plugin-details`,plugin:{id:e.id,name:e.name,marketplace:e.marketplace,errors:e.errors,scope:e.scope}}),ye(0),B(null)):e?.type===`mcp`&&(T({type:`mcp-detail`,client:e.client}),B(null))},[R,L,j])},{context:`Select`,isActive:w===`plugin-list`&&!x}),c({"plugin:toggle":Ie},{context:`Plugin`,isActive:w===`plugin-list`&&!x}),c({"select:accept":Qn.useCallback(()=>{typeof w!=`object`||w.type!==`flagged-detail`||(Pt(w.plugin.id),T(`plugin-list`))},[w])},{context:`Select`,isActive:typeof w==`object`&&w.type===`flagged-detail`});let Re=Qn.useMemo(()=>{if(w!==`plugin-details`||!k)return[];let e=nt(),t=`${k.plugin.name}@${k.marketplace}`,n=e?.enabledPlugins?.[t]!==!1,r=k.marketplace===`builtin`,i=[];return i.push({label:n?`Disable plugin`:`Enable plugin`,action:()=>void Me(n?`disable`:`enable`)}),r||(i.push({label:k.pendingUpdate?`Unmark for update`:`Mark for update`,action:async()=>{try{let e=await Yn(k.plugin.name,k.marketplace);if(e){B(e);return}let t=[...j],n=t.findIndex(e=>e.plugin.name===k.plugin.name&&e.marketplace===k.marketplace);n!==-1&&(t[n].pendingUpdate=!k.pendingUpdate,M(t),A({...k,pendingUpdate:!k.pendingUpdate}))}catch(e){B(e instanceof Error?e.message:`Failed to check plugin update availability`)}}}),Ae&&i.push({label:`Configure`,action:async()=>{ke(!0);try{let e=k.plugin.manifest.mcpServers,t=null;if(typeof e==`string`&&xe(e))t=e;else if(Array.isArray(e)){for(let n of e)if(typeof n==`string`&&xe(n)){t=n;break}}if(!t){B(`No MCPB file found in plugin`),ke(!1);return}let n=`${k.plugin.name}@${k.marketplace}`,r=await Se(t,k.plugin.path,n,void 0,void 0,!0);`status`in r&&r.status===`needs-config`?(De(r),T(`configuring`)):B(`Failed to load MCPB for configuration`)}catch(e){let t=Ge(e);B(`Failed to load configuration: ${t}`)}finally{ke(!1)}}}),k.plugin.manifest.userConfig&&Object.keys(k.plugin.manifest.userConfig).length>0&&i.push({label:`Configure options`,action:()=>{T({type:`configuring-options`,schema:k.plugin.manifest.userConfig})}}),i.push({label:`Update now`,action:()=>void Me(`update`)}),i.push({label:`Uninstall`,action:()=>void Me(`uninstall`)})),k.plugin.manifest.homepage&&i.push({label:`Open homepage`,action:()=>void we(k.plugin.manifest.homepage)}),k.plugin.manifest.repository&&i.push({label:`View repository`,action:()=>void we(k.plugin.manifest.repository)}),i.push({label:`Back to plugin list`,action:()=>{T(`plugin-list`),A(null),B(null)}}),i},[w,k,Ae,j]);if(c({"select:previous":()=>{ve>0&&ye(ve-1)},"select:next":()=>{ve<Re.length-1&&ye(ve+1)},"select:accept":()=>{Re[ve]&&Re[ve].action()}},{context:`Select`,isActive:w===`plugin-details`&&!!k}),c({"select:accept":()=>{typeof w==`object`&&w.type===`failed-plugin-details`&&(async()=>{z(!0),B(null);let e=w.plugin.id,t=w.plugin.scope,r=xt(t)?await vt(e,t,!1):await vt(e,`user`,!1),i=r.success;if(!i){for(let t of[`userSettings`,`projectSettings`,`localSettings`]){let n=it(t);n?.enabledPlugins?.[e]!==void 0&&(et(t,{enabledPlugins:{...n.enabledPlugins,[e]:void 0}}),i=!0)}le()}i?(n&&await n(),z(!1),T(`plugin-list`)):(z(!1),B(r.message))})()}},{context:`Select`,isActive:typeof w==`object`&&w.type===`failed-plugin-details`&&w.plugin.scope!==`managed`}),c({"confirm:yes":()=>{if(!k)return;z(!0),B(null);let r=`${k.plugin.name}@${k.marketplace}`,{error:i}=et(`localSettings`,{enabledPlugins:{...it(`localSettings`)?.enabledPlugins,[r]:!1}});if(i){z(!1),B(`Failed to write settings: ${i.message}`);return}le(),t(`✓ Disabled ${k.plugin.name} in .workmate/settings.local.json. Run /reload-plugins to apply.`),n&&n(),e({type:`menu`})},"confirm:no":()=>{T(`plugin-details`),B(null)}},{context:`Confirmation`,isActive:w===`confirm-project-uninstall`&&!!k&&!be}),g((r,i)=>{if(!k)return;let o=`${k.plugin.name}@${k.marketplace}`,s=k.scope;if(!s||s===`builtin`||!xt(s))return;let c=async r=>{z(!0),B(null);try{let i=await vt(o,s,r);if(!i.success)throw Error(i.message);le();let c=r?``:` · data preserved`;t(`${a.tick} ${i.message}${c}`),n&&n(),e({type:`menu`})}catch(e){z(!1),B(e instanceof Error?e.message:String(e))}};r===`y`||r===`Y`?c(!0):r===`n`||r===`N`?c(!1):i.escape&&(T(`plugin-details`),B(null))},{isActive:typeof w==`object`&&w.type===`confirm-data-cleanup`&&!!k&&!be}),Qn.useEffect(()=>{ge(0)},[ne]),g((e,t)=>{let n=!t.ctrl&&!t.meta;x||(e===`/`&&n?(ee(!0),D(``),ge(0)):n&&e.length>0&&!/^\s+$/.test(e)&&e!==`j`&&e!==`k`&&e!==` `&&(ee(!0),D(e),ge(0)))},{isActive:w===`plugin-list`}),N)return(0,Z.jsx)(d,{children:`Loading installed plugins…`});if(me.length===0)return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsx)(u,{marginBottom:1,children:(0,Z.jsx)(d,{bold:!0,children:`Manage plugins`})}),(0,Z.jsx)(d,{children:`No plugins or MCP servers installed.`}),(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{dimColor:!0,children:`Esc to go back`})})]});if(typeof w==`object`&&w.type===`plugin-options`&&k){let r=`${k.plugin.name}@${k.marketplace}`;function i(r){t(r),n&&n(),e({type:`menu`})}return(0,Z.jsx)(pn,{plugin:k.plugin,pluginId:r,onDone:(e,t)=>{switch(e){case`configured`:i(`✓ Enabled and configured ${k.plugin.name}. Run /reload-plugins to apply.`);break;case`skipped`:i(`✓ Enabled ${k.plugin.name}. Run /reload-plugins to apply.`);break;case`error`:i(`Failed to save configuration: ${t}`);break}}})}if(typeof w==`object`&&w.type===`configuring-options`&&k){let e=`${k.plugin.name}@${k.marketplace}`;return(0,Z.jsx)(cn,{title:`Configure ${k.plugin.name}`,subtitle:`Plugin options`,configSchema:w.schema,initialValues:ce(e),onSave:n=>{try{Ne(e,n,w.schema),le(),t(`Configuration saved. Run /reload-plugins for changes to take effect.`)}catch(e){B(`Failed to save configuration: ${Ge(e)}`)}T(`plugin-details`)},onCancel:()=>T(`plugin-details`)})}if(w===`configuring`&&Ee&&k){let e=`${k.plugin.name}@${k.marketplace}`;async function n(n){if(!(!Ee||!k))try{let r=k.plugin.manifest.mcpServers,i=null;if(typeof r==`string`&&xe(r))i=r;else if(Array.isArray(r)){for(let e of r)if(typeof e==`string`&&xe(e)){i=e;break}}if(!i){B(`No MCPB file found`),T(`plugin-details`);return}await Se(i,k.plugin.path,e,void 0,n),B(null),De(null),T(`plugin-details`),t(`Configuration saved. Run /reload-plugins for changes to take effect.`)}catch(e){let t=Ge(e);B(`Failed to save configuration: ${t}`),T(`plugin-details`)}}function r(){De(null),T(`plugin-details`)}return(0,Z.jsx)(cn,{title:`Configure ${Ee.manifest.name}`,subtitle:`Plugin: ${k.plugin.name}`,configSchema:Ee.configSchema,initialValues:Ee.existingConfig,onSave:n,onCancel:r})}if(typeof w==`object`&&w.type===`flagged-detail`){let e=w.plugin;return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsx)(u,{children:(0,Z.jsxs)(d,{bold:!0,children:[e.name,` @ `,e.marketplace]})}),(0,Z.jsxs)(u,{marginBottom:1,children:[(0,Z.jsx)(d,{dimColor:!0,children:`Status: `}),(0,Z.jsx)(d,{color:`error`,children:`Removed`})]}),(0,Z.jsxs)(u,{marginBottom:1,flexDirection:`column`,children:[(0,Z.jsxs)(d,{color:`error`,children:[`Removed from marketplace · reason: `,e.reason]}),(0,Z.jsx)(d,{children:e.text}),(0,Z.jsxs)(d,{dimColor:!0,children:[`Flagged on `,new Date(e.flaggedAt).toLocaleDateString()]})]}),(0,Z.jsx)(u,{marginTop:1,flexDirection:`column`,children:(0,Z.jsxs)(u,{children:[(0,Z.jsxs)(d,{children:[a.pointer,` `]}),(0,Z.jsx)(d,{color:`suggestion`,children:`Dismiss`})]})}),(0,Z.jsxs)(f,{children:[(0,Z.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`dismiss`}),(0,Z.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})]})}if(w===`confirm-project-uninstall`&&k)return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsxs)(d,{bold:!0,color:`warning`,children:[k.plugin.name,` is enabled in .workmate/settings.json (shared with your team)`]}),(0,Z.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,Z.jsx)(d,{children:`Disable it just for you in .workmate/settings.local.json?`}),(0,Z.jsx)(d,{dimColor:!0,children:`This has the same effect as uninstalling, without affecting other contributors.`})]}),Ce&&(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{color:`error`,children:Ce})}),(0,Z.jsx)(u,{marginTop:1,children:be?(0,Z.jsx)(d,{dimColor:!0,children:`Disabling…`}):(0,Z.jsxs)(f,{children:[(0,Z.jsx)(V,{action:`confirm:yes`,context:`Confirmation`,fallback:`y`,description:`disable`}),(0,Z.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]});if(typeof w==`object`&&w.type===`confirm-data-cleanup`&&k)return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsxs)(d,{bold:!0,children:[k.plugin.name,` has `,w.size.human,` of persistent data`]}),(0,Z.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,Z.jsx)(d,{children:`Delete it along with the plugin?`}),(0,Z.jsx)(d,{dimColor:!0,children:ue(`${k.plugin.name}@${k.marketplace}`)})]}),Ce&&(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{color:`error`,children:Ce})}),(0,Z.jsx)(u,{marginTop:1,children:be?(0,Z.jsx)(d,{dimColor:!0,children:`Uninstalling…`}):(0,Z.jsxs)(d,{children:[(0,Z.jsx)(d,{bold:!0,children:`y`}),` to delete · `,(0,Z.jsx)(d,{bold:!0,children:`n`}),` to keep · `,(0,Z.jsx)(d,{bold:!0,children:`esc`}),` to cancel`]})})]});if(w===`plugin-details`&&k){let e=nt(),t=`${k.plugin.name}@${k.marketplace}`,n=e?.enabledPlugins?.[t]!==!1,r=_.filter(e=>`plugin`in e&&e.plugin===k.plugin.name||e.source===t||e.source.startsWith(`${k.plugin.name}@`)),i=r.length===0?null:(0,Z.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsxs)(d,{bold:!0,color:`error`,children:[r.length,` `,H(r.length,`error`),`:`]}),r.map((e,t)=>{let n=Hn(e);return(0,Z.jsxs)(u,{flexDirection:`column`,marginLeft:2,children:[(0,Z.jsx)(d,{color:`error`,children:Vn(e)}),n&&(0,Z.jsxs)(d,{dimColor:!0,italic:!0,children:[a.arrowRight,` `,n]})]},t)})]});return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsx)(u,{children:(0,Z.jsxs)(d,{bold:!0,children:[k.plugin.name,` @ `,k.marketplace]})}),(0,Z.jsxs)(u,{children:[(0,Z.jsx)(d,{dimColor:!0,children:`Scope: `}),(0,Z.jsx)(d,{children:k.scope||`user`})]}),k.plugin.manifest.version&&(0,Z.jsxs)(u,{children:[(0,Z.jsx)(d,{dimColor:!0,children:`Version: `}),(0,Z.jsx)(d,{children:k.plugin.manifest.version})]}),k.plugin.manifest.description&&(0,Z.jsx)(u,{marginBottom:1,children:(0,Z.jsx)(d,{children:k.plugin.manifest.description})}),k.plugin.manifest.author&&(0,Z.jsxs)(u,{children:[(0,Z.jsx)(d,{dimColor:!0,children:`Author: `}),(0,Z.jsx)(d,{children:k.plugin.manifest.author.name})]}),(0,Z.jsxs)(u,{marginBottom:1,children:[(0,Z.jsx)(d,{dimColor:!0,children:`Status: `}),(0,Z.jsx)(d,{color:n?`success`:`warning`,children:n?`Enabled`:`Disabled`}),k.pendingUpdate&&(0,Z.jsx)(d,{color:`suggestion`,children:` · Marked for update`})]}),(0,Z.jsx)(Jn,{plugin:k.plugin,marketplace:k.marketplace}),i,(0,Z.jsx)(u,{marginTop:1,flexDirection:`column`,children:Re.map((e,t)=>{let n=t===ve;return(0,Z.jsxs)(u,{children:[n&&(0,Z.jsxs)(d,{children:[a.pointer,` `]}),!n&&(0,Z.jsx)(d,{children:` `}),(0,Z.jsx)(d,{bold:n,color:e.label.includes(`Uninstall`)?`error`:e.label.includes(`Update`)?`suggestion`:void 0,children:e.label})]},t)})}),be&&(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{children:`Processing…`})}),Ce&&(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{color:`error`,children:Ce})}),(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(f,{children:[(0,Z.jsx)(V,{action:`select:previous`,context:`Select`,fallback:`↑`,description:`navigate`}),(0,Z.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,Z.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(typeof w==`object`&&w.type===`failed-plugin-details`){let e=w.plugin,t=e.errors[0],n=t?Vn(t):`Failed to load`;return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsxs)(d,{children:[(0,Z.jsx)(d,{bold:!0,children:e.name}),(0,Z.jsxs)(d,{dimColor:!0,children:[` @ `,e.marketplace]}),(0,Z.jsxs)(d,{dimColor:!0,children:[` (`,e.scope,`)`]})]}),(0,Z.jsx)(d,{color:`error`,children:n}),e.scope===`managed`?(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{dimColor:!0,children:`Managed by your organization — contact your admin`})}):(0,Z.jsxs)(u,{marginTop:1,children:[(0,Z.jsxs)(d,{color:`suggestion`,children:[a.pointer,` `]}),(0,Z.jsx)(d,{bold:!0,children:`Remove`})]}),be&&(0,Z.jsx)(d,{children:`Processing…`}),Ce&&(0,Z.jsx)(d,{color:`error`,children:Ce}),(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(f,{children:[e.scope!==`managed`&&(0,Z.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`remove`}),(0,Z.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(typeof w==`object`&&w.type===`mcp-detail`){let e=w.client,n=Te(h,e.name).length,r=()=>{T({type:`mcp-tools`,client:e})},i=()=>{T(`plugin-list`)},a=e=>{e&&t(e),T(`plugin-list`)},o=e.config.scope,s=e.config.type;return s===`stdio`?(0,Z.jsx)(Gt,{server:{name:e.name,client:e,scope:o,transport:`stdio`,config:e.config},serverToolsCount:n,onViewTools:r,onCancel:i,onComplete:a,borderless:!0}):s===`sse`?(0,Z.jsx)(Zt,{server:{name:e.name,client:e,scope:o,transport:`sse`,isAuthenticated:void 0,config:e.config},serverToolsCount:n,onViewTools:r,onCancel:i,onComplete:a,borderless:!0}):s===`http`?(0,Z.jsx)(Zt,{server:{name:e.name,client:e,scope:o,transport:`http`,isAuthenticated:void 0,config:e.config},serverToolsCount:n,onViewTools:r,onCancel:i,onComplete:a,borderless:!0}):s===`claudeai-proxy`?(0,Z.jsx)(Zt,{server:{name:e.name,client:e,scope:o,transport:`claudeai-proxy`,isAuthenticated:void 0,config:e.config},serverToolsCount:n,onViewTools:r,onCancel:i,onComplete:a,borderless:!0}):(T(`plugin-list`),null)}if(typeof w==`object`&&w.type===`mcp-tools`){let e=w.client,t=e.config.scope,n=e.config.type,r;return r=n===`stdio`?{name:e.name,client:e,scope:t,transport:`stdio`,config:e.config}:n===`sse`?{name:e.name,client:e,scope:t,transport:`sse`,isAuthenticated:void 0,config:e.config}:n===`http`?{name:e.name,client:e,scope:t,transport:`http`,isAuthenticated:void 0,config:e.config}:{name:e.name,client:e,scope:t,transport:`claudeai-proxy`,isAuthenticated:void 0,config:e.config},(0,Z.jsx)(Qt,{server:r,onSelectTool:t=>{T({type:`mcp-tool-detail`,client:e,tool:t})},onBack:()=>T({type:`mcp-detail`,client:e})})}if(typeof w==`object`&&w.type===`mcp-tool-detail`){let{client:e,tool:t}=w,n=e.config.scope,r=e.config.type,i;return i=r===`stdio`?{name:e.name,client:e,scope:n,transport:`stdio`,config:e.config}:r===`sse`?{name:e.name,client:e,scope:n,transport:`sse`,isAuthenticated:void 0,config:e.config}:r===`http`?{name:e.name,client:e,scope:n,transport:`http`,isAuthenticated:void 0,config:e.config}:{name:e.name,client:e,scope:n,transport:`claudeai-proxy`,isAuthenticated:void 0,config:e.config},(0,Z.jsx)(Xt,{tool:t,server:i,onBack:()=>T({type:`mcp-tools`,client:e})})}let ze=_e.getVisibleItems(L);return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsx)(u,{marginBottom:1,children:(0,Z.jsx)(v,{query:ne,isFocused:x,isTerminalFocused:te,width:C-4,cursorOffset:O})}),L.length===0&&ne&&(0,Z.jsx)(u,{marginBottom:1,children:(0,Z.jsxs)(d,{dimColor:!0,children:[`No items match "`,ne,`"`]})}),_e.scrollPosition.canScrollUp&&(0,Z.jsx)(u,{children:(0,Z.jsxs)(d,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),ze.map((e,t)=>{let n=_e.toActualIndex(t)===R&&!x,r=t>0?ze[t-1]:null,i=!r||r.scope!==e.scope;return(0,Z.jsxs)(Qn.Fragment,{children:[i&&(0,Z.jsx)(u,{marginTop:+(t>0),paddingLeft:2,children:(0,Z.jsx)(d,{dimColor:e.scope!==`flagged`,color:e.scope===`flagged`?`warning`:void 0,bold:e.scope===`flagged`,children:(e=>{switch(e){case`flagged`:return`Flagged`;case`project`:return`Project`;case`local`:return`Local`;case`user`:return`User`;case`enterprise`:return`Enterprise`;case`managed`:return`Managed`;case`builtin`:return`Built-in`;case`dynamic`:return`Built-in`;default:return e}})(e.scope)})}),(0,Z.jsx)(Wn,{item:e,isSelected:n})]},e.id)}),_e.scrollPosition.canScrollDown&&(0,Z.jsx)(u,{children:(0,Z.jsxs)(d,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),(0,Z.jsx)(u,{marginTop:1,marginLeft:1,children:(0,Z.jsx)(d,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(f,{children:[(0,Z.jsx)(d,{children:`type to search`}),(0,Z.jsx)(V,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,Z.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,Z.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})}),P.size>0&&(0,Z.jsx)(u,{marginLeft:1,children:(0,Z.jsx)(d,{dimColor:!0,italic:!0,children:`Run /reload-plugins to apply changes`})})]})}var Qn,X,Z,$n=e((()=>{i(),Qn=t(h(),1),X=t(h(),1),Oe(),S(),Kt(),Yt(),qt(),Jt(),Ht(),Wt(),je(),O(),he(),Lt(),A(),Ct(),Ue(),Ze(),He(),Ye(),We(),st(),F(),z(),Re(),P(),Ae(),Ft(),N(),fe(),M(),j(),ht(),rt(),Xe(),lt(),Un(),dn(),gn(),Gn(),On(),Z=C()}));function er(e){if(!e)return{type:`menu`};let t=e.trim().split(/\s+/);switch(t[0]?.toLowerCase()){case`help`:case`--help`:case`-h`:return{type:`help`};case`install`:case`i`:{let e=t[1];if(!e)return{type:`install`};if(e.includes(`@`)){let[t,n]=e.split(`@`);return{type:`install`,plugin:t,marketplace:n}}return e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`file://`)||e.includes(`/`)||e.includes(`\\`)?{type:`install`,marketplace:e}:{type:`install`,plugin:e}}case`manage`:return{type:`manage`};case`uninstall`:return{type:`uninstall`,plugin:t[1]};case`enable`:return{type:`enable`,plugin:t[1]};case`disable`:return{type:`disable`,plugin:t[1]};case`validate`:return{type:`validate`,path:t.slice(1).join(` `).trim()||void 0};case`marketplace`:case`market`:{let e=t[1]?.toLowerCase(),n=t.slice(2).join(` `);switch(e){case`add`:return{type:`marketplace`,action:`add`,target:n};case`remove`:case`rm`:return{type:`marketplace`,action:`remove`,target:n};case`update`:return{type:`marketplace`,action:`update`,target:n};case`list`:return{type:`marketplace`,action:`list`};default:return{type:`marketplace`}}}default:return{type:`menu`}}}var tr=e((()=>{}));function nr({onComplete:e,path:t}){return(0,rr.useEffect)(()=>{async function n(){if(!t){e(`Usage: /plugin validate <path>
2
+
3
+ Validate a plugin or marketplace manifest file or directory.
4
+
5
+ Examples:
6
+ /plugin validate .claude-plugin/plugin.json
7
+ /plugin validate /path/to/plugin-directory
8
+ /plugin validate .
9
+
10
+ When given a directory, automatically validates .claude-plugin/marketplace.json
11
+ or .claude-plugin/plugin.json (prefers marketplace if both exist).
12
+
13
+ Or from the command line:
14
+ claude plugin validate <path>`);return}try{let n=await Ot(t),r=``;r+=`Validating ${n.fileType} manifest: ${n.filePath}\n\n`,n.errors.length>0&&(r+=`${a.cross} Found ${n.errors.length} ${H(n.errors.length,`error`)}:\n\n`,n.errors.forEach(e=>{r+=` ${a.pointer} ${e.path}: ${e.message}\n`}),r+=`
15
+ `),n.warnings.length>0&&(r+=`${a.warning} Found ${n.warnings.length} ${H(n.warnings.length,`warning`)}:\n\n`,n.warnings.forEach(e=>{r+=` ${a.pointer} ${e.path}: ${e.message}\n`}),r+=`
16
+ `),n.success?(n.warnings.length>0?r+=`${a.tick} Validation passed with warnings\n`:r+=`${a.tick} Validation passed\n`,process.exitCode=0):(r+=`${a.cross} Validation failed\n`,process.exitCode=1),e(r)}catch(t){process.exitCode=2,ct(t),e(`${a.cross} Unexpected error during validation: ${Ge(t)}`)}}n()},[e,t]),(0,ir.jsx)(u,{flexDirection:`column`,children:(0,ir.jsx)(d,{children:`Running validation...`})})}var rr,ir,ar=e((()=>{i(),rr=t(h(),1),S(),We(),st(),jt(),lt(),ir=C()}));function or({onComplete:e}){return(0,Q.useEffect)(()=>{async function t(){try{let t=await B(),n=Object.keys(t);n.length===0?e(`No marketplaces configured`):e(`Configured marketplaces:\n${n.map(e=>` • ${e}`).join(`
17
+ `)}`)}catch(t){e(`Error loading marketplaces: ${Ge(t)}`)}}t()},[e]),(0,$.jsx)(d,{children:`Loading marketplaces...`})}function sr(e){let t=[];for(let{source:n,scope:r}of[{source:`userSettings`,scope:`user`},{source:`projectSettings`,scope:`project`},{source:`localSettings`,scope:`local`}])it(n)?.extraKnownMarketplaces?.[e]&&t.push({source:n,scope:r});return{editableSources:t,isInPolicy:!!it(`policySettings`)?.extraKnownMarketplaces?.[e]}}function cr(e){let{editableSources:t,isInPolicy:n}=sr(e);return t.length>0?{kind:`remove-extra-marketplace`,name:e,sources:t}:n?{kind:`managed-only`,name:e}:{kind:`navigate`,tab:`marketplaces`,viewState:{type:`manage-marketplaces`,targetMarketplace:e,action:`remove`}}}function lr(e){return{kind:`navigate`,tab:`installed`,viewState:{type:`manage-plugins`,targetPlugin:e,action:`uninstall`}}}function ur(e){return vr.has(e.type)}function dr(e){if(`pluginId`in e&&e.pluginId)return e.pluginId;if(`plugin`in e&&e.plugin)return e.plugin;if(e.source.includes(`@`))return e.source.split(`@`)[0]}function fr(e,t,n,r,i,a,o){let s=[];for(let e of a){let t=`pluginId`in e?e.pluginId:`plugin`in e?e.plugin:void 0;s.push({label:t??e.source,message:Vn(e),guidance:`Restart to retry loading plugins`,action:{kind:`none`}})}let c=new Set;for(let t of e){c.add(t.name);let e=cr(t.name),n=sr(t.name),r=n.isInPolicy?`managed`:n.editableSources[0]?.scope;s.push({label:t.name,message:t.error??`Installation failed`,guidance:e.kind===`managed-only`?`Managed by your organization — contact your admin`:void 0,action:e,scope:r})}for(let e of t){let t=`marketplace`in e?e.marketplace:e.source;if(c.has(t))continue;c.add(t);let n=cr(t),r=sr(t),i=r.isInPolicy?`managed`:r.editableSources[0]?.scope;s.push({label:t,message:Vn(e),guidance:n.kind===`managed-only`?`Managed by your organization — contact your admin`:Hn(e),action:n,scope:i})}for(let e of i)c.has(e.name)||(c.add(e.name),s.push({label:e.name,message:e.error,action:{kind:`remove-installed-marketplace`,name:e.name}}));let l=new Set;for(let e of n){let t=dr(e);if(t&&l.has(t))continue;t&&l.add(t);let n=`marketplace`in e?e.marketplace:void 0,r=t?o.get(e.source)??o.get(t):void 0;s.push({label:t?n?`${t} @ ${n}`:t:e.source,message:Vn(e),guidance:Hn(e),action:t?lr(t):{kind:`none`},scope:r})}for(let e of r)s.push({label:e.source,message:Vn(e),guidance:Hn(e),action:{kind:`none`}});return s}function pr(e,t){for(let{source:n}of t){let t=it(n);if(!t)continue;let r={};if(t.extraKnownMarketplaces?.[e]&&(r.extraKnownMarketplaces={...t.extraKnownMarketplaces,[e]:void 0}),t.enabledPlugins){let n=`@${e}`,i=!1,a={...t.enabledPlugins};for(let e in a)e.endsWith(n)&&(a[e]=void 0,i=!0);i&&(r.enabledPlugins=a)}Object.keys(r).length>0&&et(n,r)}}function mr({setViewState:e,setActiveTab:t,markPluginsChanged:n}){let r=E(e=>e.plugins.errors),i=E(e=>e.plugins.installationStatus),o=oe(),[s,l]=(0,Q.useState)(0),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)([]);(0,Q.useEffect)(()=>{(async()=>{try{let{failures:e}=await T(await B());_(e)}catch{}})()},[]);let v=i.marketplaces.filter(e=>e.status===`failed`),y=new Set(v.map(e=>e.name)),b=r.filter(ur),x=fr(v,r.filter(e=>(e.type===`marketplace-not-found`||e.type===`marketplace-load-failed`||e.type===`marketplace-blocked-by-policy`)&&!y.has(e.marketplace)),r.filter(e=>ur(e)||e.type===`marketplace-not-found`||e.type===`marketplace-load-failed`||e.type===`marketplace-blocked-by-policy`?!1:dr(e)!==void 0),r.filter(e=>ur(e)||e.type===`marketplace-not-found`||e.type===`marketplace-load-failed`||e.type===`marketplace-blocked-by-policy`?!1:dr(e)===void 0),g,b,gt());p(`confirm:no`,()=>{e({type:`menu`})},{context:`Confirmation`}),c({"select:previous":()=>l(e=>Math.max(0,e-1)),"select:next":()=>l(e=>Math.min(x.length-1,e+1)),"select:accept":()=>{let r=x[s];if(!r)return;let{action:i}=r;switch(i.kind){case`navigate`:t(i.tab),e(i.viewState);break;case`remove-extra-marketplace`:{let e=i.sources.map(e=>e.scope).join(`, `);pr(i.name,i.sources),le(),o(e=>({...e,plugins:{...e.plugins,errors:e.plugins.errors.filter(e=>!(`marketplace`in e&&e.marketplace===i.name)),installationStatus:{...e.plugins.installationStatus,marketplaces:e.plugins.installationStatus.marketplaces.filter(e=>e.name!==i.name)}}})),h(`${a.tick} Removed "${i.name}" from ${e} settings`),n();break}case`remove-installed-marketplace`:(async()=>{try{await De(i.name),le(),_(e=>e.filter(e=>e.name!==i.name)),h(`${a.tick} Removed marketplace "${i.name}"`),n()}catch(e){h(`Failed to remove "${i.name}": ${e instanceof Error?e.message:String(e)}`)}})();break;case`managed-only`:break;case`none`:break}}},{context:`Select`,isActive:x.length>0});let S=Math.min(s,Math.max(0,x.length-1));S!==s&&l(S);let ee=x[S]?.action,te=ee&&ee.kind!==`none`&&ee.kind!==`managed-only`;return x.length===0?(0,$.jsxs)(u,{flexDirection:`column`,children:[(0,$.jsx)(u,{marginLeft:1,children:(0,$.jsx)(d,{dimColor:!0,children:`No plugin errors`})}),(0,$.jsx)(u,{marginTop:1,children:(0,$.jsx)(d,{dimColor:!0,italic:!0,children:(0,$.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})})]}):(0,$.jsxs)(u,{flexDirection:`column`,children:[x.map((e,t)=>{let n=t===S;return(0,$.jsxs)(u,{marginLeft:1,flexDirection:`column`,marginBottom:1,children:[(0,$.jsxs)(d,{children:[(0,$.jsxs)(d,{color:n?`suggestion`:`error`,children:[n?a.pointer:a.cross,` `]}),(0,$.jsx)(d,{bold:n,children:e.label}),e.scope&&(0,$.jsxs)(d,{dimColor:!0,children:[` (`,e.scope,`)`]})]}),(0,$.jsx)(u,{marginLeft:3,children:(0,$.jsx)(d,{color:`error`,children:e.message})}),e.guidance&&(0,$.jsx)(u,{marginLeft:3,children:(0,$.jsx)(d,{dimColor:!0,italic:!0,children:e.guidance})})]},t)}),m&&(0,$.jsx)(u,{marginTop:1,marginLeft:1,children:(0,$.jsx)(d,{color:`claude`,children:m})}),(0,$.jsx)(u,{marginTop:1,children:(0,$.jsx)(d,{dimColor:!0,italic:!0,children:(0,$.jsxs)(f,{children:[(0,$.jsx)(V,{action:`select:previous`,context:`Select`,fallback:`↑`,description:`navigate`}),te&&(0,$.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`resolve`}),(0,$.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}function hr(e){switch(e.type){case`help`:return{type:`help`};case`validate`:return{type:`validate`,path:e.path};case`install`:return e.marketplace?{type:`browse-marketplace`,targetMarketplace:e.marketplace,targetPlugin:e.plugin}:e.plugin?{type:`discover-plugins`,targetPlugin:e.plugin}:{type:`discover-plugins`};case`manage`:return{type:`manage-plugins`};case`uninstall`:return{type:`manage-plugins`,targetPlugin:e.plugin,action:`uninstall`};case`enable`:return{type:`manage-plugins`,targetPlugin:e.plugin,action:`enable`};case`disable`:return{type:`manage-plugins`,targetPlugin:e.plugin,action:`disable`};case`marketplace`:return e.action===`list`?{type:`marketplace-list`}:e.action===`add`?{type:`add-marketplace`,initialValue:e.target}:e.action===`remove`?{type:`manage-marketplaces`,targetMarketplace:e.target,action:`remove`}:e.action===`update`?{type:`manage-marketplaces`,targetMarketplace:e.target,action:`update`}:{type:`marketplace-menu`};default:return{type:`discover-plugins`}}}function gr(e){return e.type===`manage-plugins`?`installed`:e.type===`manage-marketplaces`?`marketplaces`:`discover`}function _r({onComplete:e,args:t}){let n=er(t),r=hr(n),[i,a]=(0,Q.useState)(r),[o,s]=(0,Q.useState)(gr(r)),[c,l]=(0,Q.useState)(i.type===`add-marketplace`&&i.initialValue||``),[f,m]=(0,Q.useState)(0),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(null),[b,S]=(0,Q.useState)(!1),te=oe(),C=E(e=>{let t=e.plugins.errors.length;for(let n of e.plugins.installationStatus.marketplaces)n.status===`failed`&&t++;return t}),w=C>0?`Errors (${C})`:`Errors`,T=Rt(),ne=n.type===`marketplace`&&n.action===`add`&&n.target!==void 0,D=(0,Q.useCallback)(()=>{te(e=>e.plugins.needsRefresh?e:{...e,plugins:{...e.plugins,needsRefresh:!0}})},[te]),O=(0,Q.useCallback)(e=>{let t=e;switch(s(t),g(null),t){case`discover`:a({type:`discover-plugins`});break;case`installed`:a({type:`manage-plugins`});break;case`marketplaces`:a({type:`manage-marketplaces`});break;case`errors`:break}},[]);return(0,Q.useEffect)(()=>{i.type===`menu`&&!_&&e()},[i.type,_,e]),(0,Q.useEffect)(()=>{i.type===`browse-marketplace`&&o!==`discover`&&s(`discover`)},[i.type,o]),p(`confirm:no`,(0,Q.useCallback)(()=>{s(`marketplaces`),a({type:`manage-marketplaces`}),l(``),g(null)},[]),{context:`Settings`,isActive:i.type===`add-marketplace`}),(0,Q.useEffect)(()=>{_&&e(_)},[_,e]),(0,Q.useEffect)(()=>{i.type===`help`&&e()},[i.type,e]),i.type===`help`?(0,$.jsxs)(u,{flexDirection:`column`,children:[(0,$.jsx)(d,{bold:!0,children:`Plugin Command Usage:`}),(0,$.jsx)(d,{children:` `}),(0,$.jsx)(d,{dimColor:!0,children:`Installation:`}),(0,$.jsx)(d,{children:` /plugin install - Browse and install plugins`}),(0,$.jsx)(d,{children:` /plugin install <marketplace> - Install from specific marketplace`}),(0,$.jsx)(d,{children:` /plugin install <plugin> - Install specific plugin`}),(0,$.jsx)(d,{children:` /plugin install <plugin>@<market> - Install plugin from marketplace`}),(0,$.jsx)(d,{children:` `}),(0,$.jsx)(d,{dimColor:!0,children:`Management:`}),(0,$.jsx)(d,{children:` /plugin manage - Manage installed plugins`}),(0,$.jsx)(d,{children:` /plugin enable <plugin> - Enable a plugin`}),(0,$.jsx)(d,{children:` /plugin disable <plugin> - Disable a plugin`}),(0,$.jsx)(d,{children:` /plugin uninstall <plugin> - Uninstall a plugin`}),(0,$.jsx)(d,{children:` `}),(0,$.jsx)(d,{dimColor:!0,children:`Marketplaces:`}),(0,$.jsx)(d,{children:` /plugin marketplace - Marketplace management menu`}),(0,$.jsx)(d,{children:` /plugin marketplace add - Add a marketplace`}),(0,$.jsx)(d,{children:` /plugin marketplace add <path/url> - Add marketplace directly`}),(0,$.jsx)(d,{children:` /plugin marketplace update - Update marketplaces`}),(0,$.jsx)(d,{children:` /plugin marketplace update <name> - Update specific marketplace`}),(0,$.jsx)(d,{children:` /plugin marketplace remove - Remove a marketplace`}),(0,$.jsx)(d,{children:` /plugin marketplace remove <name> - Remove specific marketplace`}),(0,$.jsx)(d,{children:` /plugin marketplace list - List all marketplaces`}),(0,$.jsx)(d,{children:` `}),(0,$.jsx)(d,{dimColor:!0,children:`Validation:`}),(0,$.jsx)(d,{children:` /plugin validate <path> - Validate a manifest file or directory`}),(0,$.jsx)(d,{children:` `}),(0,$.jsx)(d,{dimColor:!0,children:`Other:`}),(0,$.jsx)(d,{children:` /plugin - Main plugin menu`}),(0,$.jsx)(d,{children:` /plugin help - Show this help`}),(0,$.jsx)(d,{children:` /plugins - Alias for /plugin`})]}):i.type===`validate`?(0,$.jsx)(nr,{onComplete:e,path:i.path}):i.type===`marketplace-menu`?(a({type:`menu`}),null):i.type===`marketplace-list`?(0,$.jsx)(or,{onComplete:e}):i.type===`add-marketplace`?(0,$.jsx)(rn,{inputValue:c,setInputValue:l,cursorOffset:f,setCursorOffset:m,error:h,setError:g,result:_,setResult:v,setViewState:a,onAddComplete:D,cliMode:ne}):(0,$.jsx)(ee,{color:`suggestion`,children:(0,$.jsxs)(x,{title:`Plugins`,selectedTab:o,onTabChange:O,color:`suggestion`,disableNavigation:b,children:[(0,$.jsx)(y,{id:`discover`,title:`Discover`,children:i.type===`browse-marketplace`?(0,$.jsx)(kn,{error:h,setError:g,result:_,setResult:v,setViewState:a,onInstallComplete:D,targetMarketplace:i.targetMarketplace,targetPlugin:i.targetPlugin}):(0,$.jsx)(Mn,{error:h,setError:g,result:_,setResult:v,setViewState:a,onInstallComplete:D,onSearchModeChange:S,targetPlugin:i.type===`discover-plugins`?i.targetPlugin:void 0})}),(0,$.jsx)(y,{id:`installed`,title:`Installed`,children:(0,$.jsx)(Zn,{setViewState:a,setResult:v,onManageComplete:D,onSearchModeChange:S,targetPlugin:i.type===`manage-plugins`?i.targetPlugin:void 0,targetMarketplace:i.type===`manage-plugins`?i.targetMarketplace:void 0,action:i.type===`manage-plugins`?i.action:void 0})}),(0,$.jsx)(y,{id:`marketplaces`,title:`Marketplaces`,children:(0,$.jsx)(Ln,{setViewState:a,error:h,setError:g,setResult:v,exitState:T,onManageComplete:D,targetMarketplace:i.type===`manage-marketplaces`?i.targetMarketplace:void 0,action:i.type===`manage-marketplaces`?i.action:void 0})}),(0,$.jsx)(y,{id:`errors`,title:w,children:(0,$.jsx)(mr,{setViewState:a,setActiveTab:s,markPluginsChanged:D})})]})})}var Q,$,vr,yr=e((()=>{i(),Q=t(h(),1),Oe(),S(),zt(),O(),Ue(),We(),F(),I(),Re(),ht(),rt(),on(),jn(),In(),Bn(),$n(),Un(),tr(),ar(),$=C(),vr=new Set([`git-auth-failed`,`git-timeout`,`network-error`])}));async function br(e,t,n){return(0,xr.jsx)(_r,{onComplete:e,args:n})}var xr;e((()=>{yr(),xr=C()}))();export{br as call};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$a as t,Ja as n,Lx as r,Xa as i,ao as a,lo as o,po as s,uo as c,zx as l}from"./loadAgentsDir-DlPbtIsS.js";import{I as u,M as d,c as f,i as p}from"./debug-Bglx1aTu.js";import{_t as m,bt as h}from"./settings-B2jvL8Dp.js";import{p as g,v as _}from"./config-C-Y2qtB2.js";import{o as v,s as y}from"./log-D2TIwHBV.js";import{f as b,s as x}from"./pluginOperations-hXYLrzM2.js";function S(e){return O=e,k!==null&&k.length>0&&(e(k),k=null),()=>{O=null}}async function C(){let e=await c(),t=a(),n=new Set;for(let[r,i]of Object.entries(e)){let e=t[r]?.autoUpdate;(e===void 0?h(r,i):e)&&n.add(r.toLowerCase())}return n}async function w(e,t){let n=!1;for(let{scope:r}of t)try{let t=await b(e,r);t.success&&!t.alreadyUpToDate?(n=!0,f(`Plugin autoupdate: updated ${e} from ${t.oldVersion} to ${t.newVersion}`)):t.alreadyUpToDate||f(`Plugin autoupdate: failed to update ${e}: ${t.message}`,{level:`warn`})}catch(t){f(`Plugin autoupdate: error updating ${e}: ${d(t)}`,{level:`warn`})}return n?e:null}async function T(e){let n=t(),r=Object.keys(n.plugins);return r.length===0?[]:(await Promise.allSettled(r.map(async t=>{let{marketplace:r}=l(t);if(!r||!e.has(r.toLowerCase()))return null;let a=n.plugins[t];if(!a||a.length===0)return null;let o=a.filter(i);return o.length===0?null:w(t,o)}))).filter(e=>e.status===`fulfilled`&&e.value!==null).map(e=>e.value)}async function E(e){return T(e)}function D(){(async()=>{if(_()){f(`Plugin autoupdate: skipped (auto-updater disabled)`);return}try{let e=await C();if(e.size===0)return;let t=(await Promise.allSettled(Array.from(e).map(async e=>{try{await s(e,void 0,{disableCredentialHelper:!0})}catch(t){f(`Plugin autoupdate: failed to refresh marketplace ${e}: ${d(t)}`,{level:`warn`})}}))).filter(e=>e.status===`rejected`);t.length>0&&f(`Plugin autoupdate: ${t.length} marketplace refresh(es) failed`,{level:`warn`}),f(`Plugin autoupdate: checking installed plugins`);let n=await E(e);n.length>0&&(O?O(n):k=n)}catch(e){y(e)}})()}var O,k,A=e((()=>{x(),g(),p(),u(),v(),n(),o(),r(),m(),O=null,k=null}));export{T as i,A as n,S as r,D as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Gx as t,Ya as n,Za as r,do as i,eo as a,mo as o,oo as s,qx as c,uo as l}from"./loadAgentsDir-DGozQu_6.js";import{I as u,M as d,c as f,i as p}from"./debug-CRnGsZOV.js";import{_t as m,bt as h}from"./settings-CodSADx8.js";import{d as g,g as _}from"./config-CWPHVTic.js";import{o as v,s as y}from"./log-DoSpAwRP.js";import{f as b,s as x}from"./pluginOperations-rTrzu6Vg.js";function S(e){return O=e,k!==null&&k.length>0&&(e(k),k=null),()=>{O=null}}async function C(){let e=await i(),t=s(),n=new Set;for(let[r,i]of Object.entries(e)){let e=t[r]?.autoUpdate;(e===void 0?h(r,i):e)&&n.add(r.toLowerCase())}return n}async function w(e,t){let n=!1;for(let{scope:r}of t)try{let t=await b(e,r);t.success&&!t.alreadyUpToDate?(n=!0,f(`Plugin autoupdate: updated ${e} from ${t.oldVersion} to ${t.newVersion}`)):t.alreadyUpToDate||f(`Plugin autoupdate: failed to update ${e}: ${t.message}`,{level:`warn`})}catch(t){f(`Plugin autoupdate: error updating ${e}: ${d(t)}`,{level:`warn`})}return n?e:null}async function T(e){let t=a(),n=Object.keys(t.plugins);return n.length===0?[]:(await Promise.allSettled(n.map(async n=>{let{marketplace:i}=c(n);if(!i||!e.has(i.toLowerCase()))return null;let a=t.plugins[n];if(!a||a.length===0)return null;let o=a.filter(r);return o.length===0?null:w(n,o)}))).filter(e=>e.status===`fulfilled`&&e.value!==null).map(e=>e.value)}async function E(e){return T(e)}function D(){(async()=>{if(_()){f(`Plugin autoupdate: skipped (auto-updater disabled)`);return}try{let e=await C();if(e.size===0)return;let t=(await Promise.allSettled(Array.from(e).map(async e=>{try{await o(e,void 0,{disableCredentialHelper:!0})}catch(t){f(`Plugin autoupdate: failed to refresh marketplace ${e}: ${d(t)}`,{level:`warn`})}}))).filter(e=>e.status===`rejected`);t.length>0&&f(`Plugin autoupdate: ${t.length} marketplace refresh(es) failed`,{level:`warn`}),f(`Plugin autoupdate: checking installed plugins`);let n=await E(e);n.length>0&&(O?O(n):k=n)}catch(e){y(e)}})()}var O,k,A=e((()=>{x(),g(),p(),u(),v(),n(),l(),t(),m(),O=null,k=null}));export{T as i,A as n,S as r,D as t};
@@ -1 +1 @@
1
- import{Ja as e,do as t,eo as n,lo as r,oo as i}from"./loadAgentsDir-DlPbtIsS.js";import{I as a,M as o,c as s,i as c}from"./debug-Bglx1aTu.js";import{d as l,s as u}from"./pluginOperations-hXYLrzM2.js";import{i as d,n as f,r as p,t as m}from"./pluginFlagging-BG2MHCQJ.js";u(),c(),a(),e(),r(),p();function h(e,t,n){let r=new Set(t.plugins.map(e=>e.name)),i=`@${n}`,a=[];for(let t of Object.keys(e.plugins)){if(!t.endsWith(i))continue;let e=t.slice(0,-i.length);r.has(e)||a.push(t)}return a}async function g(){await d();let e=n(),r=f(),a=await t(),c=[];for(let t of Object.keys(a))try{let n=await i(t);if(!n.forceRemoveDeletedPlugins)continue;let a=h(e,n,t);for(let t of a){if(t in r)continue;let n=e.plugins[t]??[];if(n.some(e=>e.scope===`user`||e.scope===`project`||e.scope===`local`)){for(let e of n){let{scope:n}=e;if(!(n!==`user`&&n!==`project`&&n!==`local`))try{await l(t,n)}catch(e){s(`Failed to auto-uninstall delisted plugin ${t} from ${n}: ${o(e)}`,{level:`error`})}}await m(t),c.push(t)}}}catch(e){s(`Failed to check for delisted plugins in "${t}": ${o(e)}`,{level:`warn`})}return c}export{g as t};
1
+ import{Ya as e,fo as t,so as n,to as r,uo as i}from"./loadAgentsDir-DGozQu_6.js";import{I as a,M as o,c as s,i as c}from"./debug-CRnGsZOV.js";import{d as l,s as u}from"./pluginOperations-rTrzu6Vg.js";import{i as d,n as f,r as p,t as m}from"./pluginFlagging-BO_3qjfs.js";u(),c(),a(),e(),i(),p();function h(e,t,n){let r=new Set(t.plugins.map(e=>e.name)),i=`@${n}`,a=[];for(let t of Object.keys(e.plugins)){if(!t.endsWith(i))continue;let e=t.slice(0,-i.length);r.has(e)||a.push(t)}return a}async function g(){await d();let e=r(),i=f(),a=await t(),c=[];for(let t of Object.keys(a))try{let r=await n(t);if(!r.forceRemoveDeletedPlugins)continue;let a=h(e,r,t);for(let t of a){if(t in i)continue;let n=e.plugins[t]??[];if(n.some(e=>e.scope===`user`||e.scope===`project`||e.scope===`local`)){for(let e of n){let{scope:n}=e;if(!(n!==`user`&&n!==`project`&&n!==`local`))try{await l(t,n)}catch(e){s(`Failed to auto-uninstall delisted plugin ${t} from ${n}: ${o(e)}`,{level:`error`})}}await m(t),c.push(t)}}}catch(e){s(`Failed to check for delisted plugins in "${t}": ${o(e)}`,{level:`warn`})}return c}export{g as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./figures-5ThXQEtq.js";import{Gx as n,Ja as r,au as i,gi as a,iu as o,mi as s,qa as c,qx as l,ru as u}from"./loadAgentsDir-DGozQu_6.js";import{I as d,M as f}from"./debug-CRnGsZOV.js";import{n as p,o as m}from"./process-gEbdy6uY.js";import{o as h,s as g}from"./log-DoSpAwRP.js";import{n as _}from"./analytics-COpjZpvd.js";import{a as v,c as y,d as b,f as x,i as S,r as C,s as w}from"./pluginOperations-rTrzu6Vg.js";e(),d(),a(),h(),r(),n(),p(),i(),_(),w();function T(e,n,r){g(e);let i=r?`${n} plugin "${r}"`:n===`disable-all`?`disable all plugins`:`${n} plugins`;console.error(`${t.cross} Failed to ${i}: ${f(e)}`);let a=r?(()=>{let{name:e,marketplace:t}=l(r);return{_PROTO_plugin_name:e,...t&&{_PROTO_marketplace_name:t},...u(e,t,c())}})():{};o(e),{...a},process.exit(1)}async function E(e,n=`user`){try{console.log(`Installing plugin "${e}"...`);let r=await y(e,n);if(!r.success)throw Error(r.message);console.log(`${t.tick} ${r.message}`);let{name:i,marketplace:a}=l(r.pluginId||e);({...a&&{_PROTO_marketplace_name:a}}),r.scope,{...u(i,a,c())},process.exit(0)}catch(t){T(t,`install`,e)}}async function D(e,n=`user`,r=!1){try{let i=await b(e,n,!r);if(!i.success)throw Error(i.message);console.log(`${t.tick} ${i.message}`);let{name:a,marketplace:o}=l(i.pluginId||e);({...o&&{_PROTO_marketplace_name:o}}),i.scope,{...u(a,o,c())},process.exit(0)}catch(t){T(t,`uninstall`,e)}}async function O(e,n){try{let r=await v(e,n);if(!r.success)throw Error(r.message);console.log(`${t.tick} ${r.message}`);let{name:i,marketplace:a}=l(r.pluginId||e);({...a&&{_PROTO_marketplace_name:a}}),r.scope,{...u(i,a,c())},process.exit(0)}catch(t){T(t,`enable`,e)}}async function k(e,n){try{let r=await S(e,n);if(!r.success)throw Error(r.message);console.log(`${t.tick} ${r.message}`);let{name:i,marketplace:a}=l(r.pluginId||e);({...a&&{_PROTO_marketplace_name:a}}),r.scope,{...u(i,a,c())},process.exit(0)}catch(t){T(t,`disable`,e)}}async function A(){try{let e=await C();if(!e.success)throw Error(e.message);console.log(`${t.tick} ${e.message}`),process.exit(0)}catch(e){T(e,`disable-all`)}}async function j(e,n){try{m(`Checking for updates for plugin "${e}" at ${n} scope…\n`);let r=await x(e,n);if(!r.success)throw Error(r.message);if(m(`${t.tick} ${r.message}\n`),!r.alreadyUpToDate){let{name:t,marketplace:n}=l(r.pluginId||e);({...n&&{_PROTO_marketplace_name:n}}),r.oldVersion,r.newVersion,{...u(t,n,c())}}await s(0)}catch(t){T(t,`update`,e)}}export{D as a,E as i,k as n,j as o,O as r,A as t};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Cx as t,Sx as n}from"./loadAgentsDir-DlPbtIsS.js";import{C as r,S as i,c as a,f as o,i as s,u as c,x as l}from"./debug-Bglx1aTu.js";import{o as u,s as d}from"./log-D2TIwHBV.js";import{join as f}from"path";import{randomBytes as p}from"crypto";import{readFile as m,rename as h,unlink as g,writeFile as _}from"fs/promises";function v(){return f(n(),D)}function y(e){let t=i(e);if(typeof t!=`object`||!t||!(`plugins`in t)||typeof t.plugins!=`object`||t.plugins===null)return{};let n=t.plugins,r={};for(let[e,t]of Object.entries(n))if(t&&typeof t==`object`&&`flaggedAt`in t&&typeof t.flaggedAt==`string`){let n={flaggedAt:t.flaggedAt};`seenAt`in t&&typeof t.seenAt==`string`&&(n.seenAt=t.seenAt),r[e]=n}return r}async function b(){try{return y(await m(v(),{encoding:`utf-8`}))}catch{return{}}}async function x(e){let t=v(),i=`${t}.${p(8).toString(`hex`)}.tmp`;try{await c().mkdir(n()),await _(i,r({plugins:e},null,2),{encoding:`utf-8`,mode:384}),await h(i,t),k=e}catch(e){d(e);try{await g(i)}catch{}}}async function S(){let e=await b(),t=Date.now(),n=!1;for(let[r,i]of Object.entries(e))i.seenAt&&t-new Date(i.seenAt).getTime()>=O&&(delete e[r],n=!0);k=e,n&&await x(e)}function C(){return k??{}}async function w(e){k===null&&(k=await b()),await x({...k,[e]:{flaggedAt:new Date().toISOString()}}),a(`Flagged plugin: ${e}`)}async function T(e){k===null&&(k=await b());let t=new Date().toISOString(),n=!1,r={...k};for(let i of e){let e=r[i];e&&!e.seenAt&&(r[i]={...e,seenAt:t},n=!0)}n&&await x(r)}async function E(e){if(k===null&&(k=await b()),!(e in k))return;let{[e]:t,...n}=k;k=n,await x(n)}var D,O,k,A=e((()=>{s(),o(),u(),l(),t(),D=`flagged-plugins.json`,O=2880*60*1e3,k=null}));export{T as a,S as i,C as n,E as o,A as r,w as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Ax as t,jx as n}from"./loadAgentsDir-DGozQu_6.js";import{C as r,S as i,c as a,f as o,i as s,u as c,x as l}from"./debug-CRnGsZOV.js";import{o as u,s as d}from"./log-DoSpAwRP.js";import{join as f}from"path";import{randomBytes as p}from"crypto";import{readFile as m,rename as h,unlink as g,writeFile as _}from"fs/promises";function v(){return f(t(),D)}function y(e){let t=i(e);if(typeof t!=`object`||!t||!(`plugins`in t)||typeof t.plugins!=`object`||t.plugins===null)return{};let n=t.plugins,r={};for(let[e,t]of Object.entries(n))if(t&&typeof t==`object`&&`flaggedAt`in t&&typeof t.flaggedAt==`string`){let n={flaggedAt:t.flaggedAt};`seenAt`in t&&typeof t.seenAt==`string`&&(n.seenAt=t.seenAt),r[e]=n}return r}async function b(){try{return y(await m(v(),{encoding:`utf-8`}))}catch{return{}}}async function x(e){let n=v(),i=`${n}.${p(8).toString(`hex`)}.tmp`;try{await c().mkdir(t()),await _(i,r({plugins:e},null,2),{encoding:`utf-8`,mode:384}),await h(i,n),k=e}catch(e){d(e);try{await g(i)}catch{}}}async function S(){let e=await b(),t=Date.now(),n=!1;for(let[r,i]of Object.entries(e))i.seenAt&&t-new Date(i.seenAt).getTime()>=O&&(delete e[r],n=!0);k=e,n&&await x(e)}function C(){return k??{}}async function w(e){k===null&&(k=await b()),await x({...k,[e]:{flaggedAt:new Date().toISOString()}}),a(`Flagged plugin: ${e}`)}async function T(e){k===null&&(k=await b());let t=new Date().toISOString(),n=!1,r={...k};for(let i of e){let e=r[i];e&&!e.seenAt&&(r[i]={...e,seenAt:t},n=!0)}n&&await x(r)}async function E(e){if(k===null&&(k=await b()),!(e in k))return;let{[e]:t,...n}=k;k=n,await x(n)}var D,O,k,A=e((()=>{s(),o(),u(),l(),n(),D=`flagged-plugins.json`,O=2880*60*1e3,k=null}));export{T as a,S as i,C as n,E as o,A as r,w as t};
@@ -0,0 +1,2 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Pt as t,q as n}from"./state-BQ4BEGin.js";import{$x as r,Ba as i,Dx as a,Fa as o,Ga as s,Gv as c,Gx as l,Ha as u,Hx as d,Jx as f,Ka as p,La as m,Ma as h,Mo as g,Na as _,No as v,Pa as y,Po as b,Qx as x,Ua as S,Uv as ee,Ux as C,Wa as w,Wx as T,Ya as E,do as D,eo as O,ja as te,jx as ne,ka as k,lo as A,no as j,qx as M,ro as re,so as ie,to as N,uo as ae,za as oe}from"./loadAgentsDir-DGozQu_6.js";import{I as se,R as P,V as ce,f as F,u as I}from"./debug-CRnGsZOV.js";import{b as L,h as R,s as z}from"./settings-CodSADx8.js";import{o as B,s as V}from"./log-DoSpAwRP.js";import{l as H,o as U}from"./stringUtils-Bu_lJH5c.js";import{n as W,t as G}from"./pluginStartupCheck-BX6cv-vs.js";import{dirname as le,join as K}from"path";function q(e){if(!Q.includes(e))throw Error(`Invalid scope "${e}". Must be one of: ${Q.join(`, `)}`)}function ue(e){return Q.includes(e)}function J(e){return e===`project`||e===`local`?n():void 0}function de(e){return z(`projectSettings`)?.enabledPlugins?.[e]===!0}function fe(e){let t=e.includes(`@`);for(let n of[`local`,`project`,`user`]){let r=z(f(n))?.enabledPlugins;if(r){for(let i of Object.keys(r))if(t?i===e:i.startsWith(`${e}@`))return{pluginId:i,scope:n}}}return null}function pe(e,t){let{name:n,marketplace:r}=M(e);return t.find(t=>t.name===e||t.name===n?!0:r&&t.source?t.name===n&&t.source.includes(`@${r}`):!1)}function me(e){let{name:t}=M(e),n=N();if(n.plugins[e]?.length)return{pluginId:e,pluginName:t};let r=Object.keys(n.plugins).find(e=>{let{name:r}=M(e);return r===t&&(n.plugins[e]?.length??0)>0});return r?{pluginId:r,pluginName:t}:null}function Y(e){let t=N().plugins[e];if(!t||t.length===0)return{scope:`user`};let r=n(),i=t.find(e=>e.scope===`local`&&e.projectPath===r);if(i)return{scope:i.scope,projectPath:i.projectPath};let a=t.find(e=>e.scope===`project`&&e.projectPath===r);if(a)return{scope:a.scope,projectPath:a.projectPath};let o=t.find(e=>e.scope===`user`);return o?{scope:o.scope}:{scope:t[0].scope,projectPath:t[0].projectPath}}async function he(e,t=`user`){q(t);let{name:n,marketplace:r}=M(e),i,a,o;if(r){let t=await A(e);t&&(i=t.entry,a=r,o=t.marketplaceInstallLocation)}else{let e=await D();for(let[t,r]of Object.entries(e))try{let e=(await ie(t)).plugins.find(e=>e.name===n);if(e){i=e,a=t,o=r.installLocation;break}}catch(e){V(ce(e))}}if(!i||!a)return{success:!1,message:`Plugin "${n}" not found in ${r?`marketplace "${r}"`:`any configured marketplace`}`};let s=i,c=`${s.name}@${a}`,l=await u({pluginId:c,entry:s,scope:t,marketplaceInstallLocation:o});if(!l.ok){let e=l;switch(e.reason){case`local-source-no-location`:return{success:!1,message:`Cannot install local plugin "${e.pluginName}" without marketplace install location`};case`settings-write-failed`:return{success:!1,message:`Failed to update settings: ${e.message}`};case`resolution-failed`:return{success:!1,message:oe(e.resolution)};case`blocked-by-policy`:return{success:!1,message:`Plugin "${e.pluginName}" is blocked by your organization's policy and cannot be installed`};case`dependency-blocked-by-policy`:return{success:!1,message:`Plugin "${e.pluginName}" depends on "${e.blockedDependency}", which is blocked by your organization's policy`}}}return{success:!0,message:`Successfully installed plugin: ${c} (scope: ${t})${l.depNote}`,pluginId:c,pluginName:s.name,scope:t}}async function ge(e,t=`user`,n=!0){q(t);let{enabled:r,disabled:i}=await o(),s=[...r,...i],c=pe(e,s),l=f(t),u=z(l),p,m;if(c)p=Object.keys(u?.enabledPlugins??{}).find(t=>t===e||t===c.name||t.startsWith(`${c.name}@`))??(e.includes(`@`)?e:c.name),m=c.name;else{let t=me(e);if(!t)return{success:!1,message:`Plugin "${e}" not found in installed plugins`};p=t.pluginId,m=t.pluginName}let h=J(t),_=N().plugins[p],v=_?.find(e=>e.scope===t&&e.projectPath===h);if(!v){let{scope:n}=Y(p);return n!==t&&_&&_.length>0?n===`project`?{success:!1,message:`Plugin "${e}" is enabled at project scope (.workmate/settings.json, shared with your team). To disable just for you: claude plugin disable ${e} --scope local`}:{success:!1,message:`Plugin "${e}" is installed in ${n} scope, not ${t}. Use --scope ${n} to uninstall.`}:{success:!1,message:`Plugin "${e}" is not installed in ${t} scope. Use --scope to specify the correct scope.`}}let y=v.installPath,x={...u?.enabledPlugins};x[p]=void 0,L(l,{enabledPlugins:x}),g(),j(p,t,h);let S=N().plugins[p],w=!S||S.length===0;w&&y&&await b(y),w&&(ee(p),n&&await a(p));let T=d(p,s),E=C(T);return{success:!0,message:`Successfully uninstalled plugin: ${m} (scope: ${t})${E}`,pluginId:p,pluginName:m,scope:t,reverseDependents:T.length>0?T:void 0}}async function X(e,t,n){let i=t?`enable`:`disable`;if(r(e)){let{error:n}=L(`userSettings`,{enabledPlugins:{...z(`userSettings`)?.enabledPlugins,[e]:t}});if(n)return{success:!1,message:`Failed to ${i} built-in plugin: ${n.message}`};g();let{name:r}=M(e);return{success:!0,message:`Successfully ${i}d built-in plugin: ${r}`,pluginId:e,pluginName:r,scope:`user`}}n&&q(n);let a,s,c=fe(e);if(n)if(s=n,c)a=c.pluginId;else if(e.includes(`@`))a=e;else return{success:!1,message:`Plugin "${e}" not found in settings. Use plugin@marketplace format.`};else if(c)a=c.pluginId,s=c.scope;else if(e.includes(`@`))a=e,s=`user`;else return{success:!1,message:`Plugin "${e}" not found in any editable settings scope. Use plugin@marketplace format.`};if(t&&p(a))return{success:!1,message:`Plugin "${a}" is blocked by your organization's policy and cannot be enabled`};let l=f(s),u=z(l)?.enabledPlugins?.[a],m={user:0,project:1,local:2},h=n&&c&&m[n]>m[c.scope];if(n&&u===void 0&&c&&c.scope!==n&&!h)return{success:!1,message:`Plugin "${e}" is installed at ${c.scope} scope, not ${n}. Use --scope ${c.scope} or omit --scope to auto-detect.`};if(t===(n&&!h?u===!0:G().has(a)))return{success:!1,message:`Plugin "${e}" is already ${t?`enabled`:`disabled`}${n?` at ${n} scope`:``}`};let _;if(!t){let{enabled:e,disabled:t}=await o(),n=d(a,[...e,...t]);n.length>0&&(_=n)}let{error:v}=L(l,{enabledPlugins:{...z(l)?.enabledPlugins,[a]:t}});if(v)return{success:!1,message:`Failed to ${i} plugin: ${v.message}`};g();let{name:y}=M(a),b=C(_);return{success:!0,message:`Successfully ${i}d plugin: ${y} (scope: ${s})${b}`,pluginId:a,pluginName:y,scope:s,reverseDependents:_}}async function _e(e,t){return X(e,!0,t)}async function ve(e,t){return X(e,!1,t)}async function Z(){let e=G();if(e.size===0)return{success:!0,message:`No enabled plugins to disable`};let t=[],n=[];for(let[r]of e){let e=await X(r,!1);e.success?t.push(r):n.push(`${r}: ${e.message}`)}return n.length>0?{success:!1,message:`Disabled ${t.length} ${H(t.length,`plugin`)}, ${n.length} failed:\n${n.join(`
2
+ `)}`}:{success:!0,message:`Disabled ${t.length} ${H(t.length,`plugin`)}`}}async function ye(e,t){let{name:n,marketplace:r}=M(e),i=r?`${n}@${r}`:e,a=await A(e);if(!a)return{success:!1,message:`Plugin "${n}" not found`,pluginId:i,scope:t};let{entry:o,marketplaceInstallLocation:s}=a,c=O().plugins[i];if(!c||c.length===0)return{success:!1,message:`Plugin "${n}" is not installed`,pluginId:i,scope:t};let l=J(t),u=c.find(e=>e.scope===t&&e.projectPath===l);return u?be({pluginId:i,pluginName:n,entry:o,marketplaceInstallLocation:s,installation:u,scope:t,projectPath:l}):{success:!1,message:`Plugin "${n}" is not installed at scope ${l?`${t} (${l})`:t}`,pluginId:i,scope:t}}async function be({pluginId:e,pluginName:t,entry:n,marketplaceInstallLocation:r,installation:i,scope:a,projectPath:o}){let s=I(),c=i.version,l,u,d=!1,f;if(typeof n.source!=`string`){let t=await k(n.source,{manifest:{name:n.name}});l=t.path,d=!0,f=t.gitCommitSha,u=await S(e,n.source,t.manifest,t.path,n.version,t.gitCommitSha)}else{let t;try{t=await s.stat(r)}catch(t){if(P(t))return{success:!1,message:`Marketplace directory not found at ${r}`,pluginId:e,scope:a};throw t}l=K(t.isDirectory()?r:le(r),n.source);try{await s.stat(l)}catch(t){if(P(t))return{success:!1,message:`Plugin source not found at ${l}`,pluginId:e,scope:a};throw t}let i,o=K(l,`.claude-plugin`,`plugin.json`);try{i=await m(o,n.name,n.source)}catch{}u=await S(e,n.source,i,l,n.version)}try{let r=h(e,u),s=_(e,u);if(i.version===u||i.installPath===r||i.installPath===s)return{success:!0,message:`${t} is already at the latest version (${u}).`,pluginId:e,newVersion:u,oldVersion:c,alreadyUpToDate:!0,scope:a};r=await te(l,e,u,n);let d=i.installPath;if(re(e,a,o,r,u,f),d&&d!==r){let e=O();Object.values(e.plugins).some(e=>e.some(e=>e.installPath===d))||await b(d)}let p=o?`${a} (${o})`:a;return{success:!0,message:`Plugin "${t}" updated from ${c||`unknown`} to ${u} for scope ${p}. Restart to apply changes.`,pluginId:e,newVersion:u,oldVersion:c,scope:a}}finally{d&&l!==h(e,u)&&await s.rm(l,{recursive:!0,force:!0})}}var Q,$,xe=e((()=>{t(),x(),se(),F(),B(),v(),T(),E(),ae(),ne(),l(),i(),y(),c(),s(),W(),w(),R(),U(),Q=[`user`,`project`,`local`],$=[`user`,`project`,`local`,`managed`]}));export{_e as a,he as c,ge as d,ye as f,ve as i,ue as l,$ as n,Y as o,Z as r,xe as s,Q as t,de as u};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./pluginStartupCheck-BX6cv-vs.js";e();export{t as getPluginEditableScopes};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Hx as t,Ja as n,Lx as r,Va as i,Vx as a,lo as o}from"./loadAgentsDir-DlPbtIsS.js";import{n as s}from"./cwd-Pa83R95t.js";import{c,i as l}from"./debug-Bglx1aTu.js";import{_t as u,h as d,s as f}from"./settings-B2jvL8Dp.js";import{o as p}from"./log-D2TIwHBV.js";import"path";function m(){let e=new Map,t=a();for(let[n,r]of Object.entries(t))n.includes(`@`)&&(r===!0?e.set(n,`flag`):r===!1&&e.delete(n));for(let{scope:n,source:r}of[{scope:`managed`,source:`policySettings`},{scope:`user`,source:`userSettings`},{scope:`project`,source:`projectSettings`},{scope:`local`,source:`localSettings`},{scope:`flag`,source:`flagSettings`}]){let i=f(r);if(i?.enabledPlugins)for(let[a,o]of Object.entries(i.enabledPlugins))a.includes(`@`)&&(a in t&&t[a]!==o&&c(`Plugin ${a} from --add-dir (${t[a]}) overridden by ${r} (${o})`),o===!0?e.set(a,n):o===!1&&e.delete(a))}return c(`Found ${e.size} enabled plugins with scopes: ${Array.from(e.entries()).map(([e,t])=>`${e}(${t})`).join(`, `)}`),e}var h=e((()=>{s(),l(),p(),d(),t(),n(),o(),r(),i(),u()}));export{h as n,m as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Ba as t,Gx as n,Xx as r,Ya as i,Yx as a,uo as o}from"./loadAgentsDir-DGozQu_6.js";import{n as s}from"./cwd-BvNt_018.js";import{c,i as l}from"./debug-CRnGsZOV.js";import{_t as u,h as d,s as f}from"./settings-CodSADx8.js";import{o as p}from"./log-DoSpAwRP.js";import"path";function m(){let e=new Map,t=a();for(let[n,r]of Object.entries(t))n.includes(`@`)&&(r===!0?e.set(n,`flag`):r===!1&&e.delete(n));for(let{scope:n,source:r}of[{scope:`managed`,source:`policySettings`},{scope:`user`,source:`userSettings`},{scope:`project`,source:`projectSettings`},{scope:`local`,source:`localSettings`},{scope:`flag`,source:`flagSettings`}]){let i=f(r);if(i?.enabledPlugins)for(let[a,o]of Object.entries(i.enabledPlugins))a.includes(`@`)&&(a in t&&t[a]!==o&&c(`Plugin ${a} from --add-dir (${t[a]}) overridden by ${r} (${o})`),o===!0?e.set(a,n):o===!1&&e.delete(a))}return c(`Found ${e.size} enabled plugins with scopes: ${Array.from(e.entries()).map(([e,t])=>`${e}(${t})`).join(`, `)}`),e}var h=e((()=>{s(),l(),p(),d(),r(),i(),o(),n(),t(),u()}));export{h as n,m as t};
@@ -0,0 +1,4 @@
1
+ import{n as e,t}from"./figures-5ThXQEtq.js";import{Bn as n,Pt as r}from"./state-BQ4BEGin.js";import{$a as i,Ao as a,Fa as o,Gx as s,Hv as c,Jx as l,Mo as u,No as d,Oo as f,Pa as p,So as m,Vv as h,Ya as g,do as _,eS as v,go as y,io as ee,mo as te,po as b,qx as x,tS as S,to as C,uo as w,vo as T}from"./loadAgentsDir-DGozQu_6.js";import{C as E,I as ne,M as D,x as re}from"./debug-CRnGsZOV.js";import{o as O,s as k}from"./log-DoSpAwRP.js";import{l as A,o as j}from"./stringUtils-Bu_lJH5c.js";import{n as M}from"./analytics-COpjZpvd.js";import{n as N,t as P}from"./exit-s9XGerrH.js";import{n as F,s as I,t as L}from"./pluginOperations-rTrzu6Vg.js";import{a as R,i as z,n as B,o as V,r as H,t as U}from"./pluginCliCommands-CUGPc853.js";import{a as ie,c as W,i as G,n as K,r as q,s as J,t as Y}from"./validatePlugin-D8WQ5z4W.js";import{basename as ae,dirname as X}from"path";e(),r(),M(),I(),S(),ne(),O(),d(),W(),g(),f(),w(),h(),G(),s(),p(),Y(),re(),j();function Z(e,n){k(e),P(`${t.cross} Failed to ${n}: ${D(e)}`)}function Q(e){e.errors.length>0&&(console.log(`${t.cross} Found ${e.errors.length} ${A(e.errors.length,`error`)}:\n`),e.errors.forEach(e=>{console.log(` ${t.pointer} ${e.path}: ${e.message}`)}),console.log(``)),e.warnings.length>0&&(console.log(`${t.warning} Found ${e.warnings.length} ${A(e.warnings.length,`warning`)}:\n`),e.warnings.forEach(e=>{console.log(` ${t.pointer} ${e.path}: ${e.message}`)}),console.log(``))}async function oe(e,r){r.cowork&&n(!0);try{let n=await K(e);console.log(`Validating ${n.fileType} manifest: ${n.filePath}\n`),Q(n);let r=[];if(n.fileType===`plugin`){let e=X(n.filePath);if(ae(e)===`.claude-plugin`){r=await q(X(e));for(let e of r)console.log(`Validating ${e.fileType}: ${e.filePath}\n`),Q(e)}}let i=n.success&&r.every(e=>e.success),a=n.warnings.length>0||r.some(e=>e.warnings.length>0);i?N(a?`${t.tick} Validation passed with warnings`:`${t.tick} Validation passed`):(console.log(`${t.cross} Validation failed`),process.exit(1))}catch(e){k(e),console.error(`${t.cross} Unexpected error during validation: ${D(e)}`),process.exit(2)}}async function se(e){e.cowork&&n(!0);let r=C(),{getPluginEditableScopes:s}=await import(`./pluginStartupCheck-BRHnXlym.js`),l=s(),u=Object.keys(r.plugins),{enabled:d,disabled:f,errors:p}=await o(),h=[...d,...f],g=h.filter(e=>e.source.endsWith(`@inline`)),y=p.filter(e=>e.source.endsWith(`@inline`)||e.source.startsWith(`inline[`));if(e.json){let t=new Map(h.map(e=>[e.source,e])),n=[];for(let e of u.sort()){let i=r.plugins[e];if(!i||i.length===0)continue;let a=x(e).name,o=p.filter(t=>t.source===e||`plugin`in t&&t.plugin===a).map(v);for(let r of i){let i=t.get(e),a;if(i){let e=i.mcpServers||await c(i);e&&Object.keys(e).length>0&&(a=e)}n.push({id:e,version:r.version||`unknown`,scope:r.scope,enabled:l.has(e),installPath:r.installPath,installedAt:r.installedAt,lastUpdated:r.lastUpdated,projectPath:r.projectPath,mcpServers:a,errors:o.length>0?o:void 0})}}for(let e of g){let t=e.mcpServers||await c(e),r=y.filter(t=>t.source===e.source||`plugin`in t&&t.plugin===e.name).map(v);n.push({id:e.source,version:e.manifest.version??`unknown`,scope:`session`,enabled:e.enabled!==!1,installPath:e.path,mcpServers:t&&Object.keys(t).length>0?t:void 0,errors:r.length>0?r:void 0})}for(let e of y.filter(e=>e.source.startsWith(`inline[`)))n.push({id:e.source,version:`unknown`,scope:`session`,enabled:!1,installPath:`path`in e?e.path:``,errors:[v(e)]});if(e.available){let e=[];try{let[t,n]=await Promise.all([_(),J()]),{marketplaces:r}=await a(t);for(let{name:t,data:a}of r)if(a)for(let r of a.plugins){let a=m(r.name,t);i(a)||e.push({pluginId:a,name:r.name,description:r.description,marketplaceName:t,version:r.version,source:r.source,installCount:n?.get(a)})}}catch{}N(E({installed:n,available:e},null,2))}else N(E(n,null,2))}u.length===0&&g.length===0&&y.length===0&&N("No plugins installed. Use `claude plugin install` to install a plugin."),u.length>0&&console.log(`Installed plugins:
2
+ `);for(let e of u.sort()){let n=r.plugins[e];if(!n||n.length===0)continue;let i=x(e).name,a=p.filter(t=>t.source===e||`plugin`in t&&t.plugin===i);for(let r of n){let n=l.has(e),i=a.length>0?`${t.cross} failed to load`:n?`${t.tick} enabled`:`${t.cross} disabled`,o=r.version||`unknown`,s=r.scope;console.log(` ${t.pointer} ${e}`),console.log(` Version: ${o}`),console.log(` Scope: ${s}`),console.log(` Status: ${i}`);for(let e of a)console.log(` Error: ${v(e)}`);console.log(``)}}if(g.length>0||y.length>0){console.log(`Session-only plugins (--plugin-dir):
3
+ `);for(let e of g){let n=y.filter(t=>t.source===e.source||`plugin`in t&&t.plugin===e.name),r=n.length>0?`${t.cross} loaded with errors`:`${t.tick} loaded`;console.log(` ${t.pointer} ${e.source}`),console.log(` Version: ${e.manifest.version??`unknown`}`),console.log(` Path: ${e.path}`),console.log(` Status: ${r}`);for(let e of n)console.log(` Error: ${v(e)}`);console.log(``)}for(let e of y.filter(e=>e.source.startsWith(`inline[`)))console.log(` ${t.pointer} ${e.source}: ${t.cross} ${v(e)}\n`)}N()}async function ce(e,r){r.cowork&&n(!0);try{let n=await ie(e);n||P(`${t.cross} Invalid marketplace source format. Try: owner/repo, https://..., or ./path`),`error`in n&&P(`${t.cross} ${n.error}`);let i=r.scope??`user`;i!==`user`&&i!==`project`&&i!==`local`&&P(`${t.cross} Invalid scope '${i}'. Use: user, project, or local`);let a=l(i),o=n;r.sparse&&r.sparse.length>0&&(o.source===`github`||o.source===`git`?o={...o,sparsePaths:r.sparse}:P(`${t.cross} --sparse is only supported for github and git marketplace sources (got: ${o.source})`)),console.log(`Adding marketplace...`);let{name:s,alreadyMaterialized:c,resolvedSource:d}=await ee(o,e=>{console.log(e)});T(s,{source:d},a),u(),o.source,o.source===`github`&&o.repo,N(c?`${t.tick} Marketplace '${s}' already on disk — declared in ${i} settings`:`${t.tick} Successfully added marketplace: ${s} (declared in ${i} settings)`)}catch(e){Z(e,`add marketplace`)}}async function le(e){e.cowork&&n(!0);try{let n=await _(),r=Object.keys(n);e.json&&N(E(r.sort().map(e=>{let t=n[e],r=t?.source;return{name:e,source:r?.source,...r?.source===`github`&&{repo:r.repo},...r?.source===`git`&&{url:r.url},...r?.source===`url`&&{url:r.url},...r?.source===`directory`&&{path:r.path},...r?.source===`file`&&{path:r.path},installLocation:t?.installLocation}}),null,2)),r.length===0&&N(`No marketplaces configured`),console.log(`Configured marketplaces:
4
+ `),r.forEach(e=>{let r=n[e];if(console.log(` ${t.pointer} ${e}`),r?.source){let e=r.source;e.source===`github`?console.log(` Source: GitHub (${e.repo})`):e.source===`git`?console.log(` Source: Git (${e.url})`):e.source===`url`?console.log(` Source: URL (${e.url})`):e.source===`directory`?console.log(` Source: Directory (${e.path})`):e.source===`file`&&console.log(` Source: File (${e.path})`)}console.log(``)}),N()}catch(e){Z(e,`list marketplaces`)}}async function $(e,r){r.cowork&&n(!0);try{await y(e),u(),N(`${t.tick} Successfully removed marketplace: ${e}`)}catch(e){Z(e,`remove marketplace`)}}async function ue(e,r){r.cowork&&n(!0);try{if(e)console.log(`Updating marketplace: ${e}...`),await te(e,e=>{console.log(e)}),u(),N(`${t.tick} Successfully updated marketplace: ${e}`);else{let e=await _(),n=Object.keys(e);n.length===0&&N(`No marketplaces configured`),console.log(`Updating ${n.length} marketplace(s)...`),await b(),u(),n.length,N(`${t.tick} Successfully updated ${n.length} marketplace(s)`)}}catch(e){Z(e,`update marketplace(s)`)}}async function de(e,t){t.cowork&&n(!0);let r=t.scope||`user`;t.cowork&&r!==`user`&&P(`--cowork can only be used with user scope`),L.includes(r)||P(`Invalid scope: ${r}. Must be one of: ${L.join(`, `)}.`);let{name:i,marketplace:a}=x(e);({...a&&{_PROTO_marketplace_name:a}}),await z(e,r)}async function fe(e,t){t.cowork&&n(!0);let r=t.scope||`user`;t.cowork&&r!==`user`&&P(`--cowork can only be used with user scope`),L.includes(r)||P(`Invalid scope: ${r}. Must be one of: ${L.join(`, `)}.`);let{name:i,marketplace:a}=x(e);({...a&&{_PROTO_marketplace_name:a}}),await R(e,r,t.keepData)}async function pe(e,t){t.cowork&&n(!0);let r;t.scope&&(L.includes(t.scope)||P(`Invalid scope "${t.scope}". Valid scopes: ${L.join(`, `)}`),r=t.scope),t.cowork&&r!==void 0&&r!==`user`&&P(`--cowork can only be used with user scope`),t.cowork&&r===void 0&&(r=`user`);let{name:i,marketplace:a}=x(e);({...a&&{_PROTO_marketplace_name:a}}),await H(e,r)}async function me(e,t){if(t.all&&e&&P(`Cannot use --all with a specific plugin`),!t.all&&!e&&P(`Please specify a plugin name or use --all to disable all plugins`),t.cowork&&n(!0),t.all){t.scope&&P(`Cannot use --scope with --all`),await U();return}let r;t.scope&&(L.includes(t.scope)||P(`Invalid scope "${t.scope}". Valid scopes: ${L.join(`, `)}`),r=t.scope),t.cowork&&r!==void 0&&r!==`user`&&P(`--cowork can only be used with user scope`),t.cowork&&r===void 0&&(r=`user`);let{name:i,marketplace:a}=x(e);({...a&&{_PROTO_marketplace_name:a}}),await B(e,r)}async function he(e,t){t.cowork&&n(!0);let{name:r,marketplace:i}=x(e);({...i&&{_PROTO_marketplace_name:i}});let a=`user`;t.scope&&(F.includes(t.scope)||P(`Invalid scope "${t.scope}". Valid scopes: ${F.join(`, `)}`),a=t.scope),t.cowork&&a!==`user`&&P(`--cowork can only be used with user scope`),await V(e,a)}export{ce as marketplaceAddHandler,le as marketplaceListHandler,$ as marketplaceRemoveHandler,ue as marketplaceUpdateHandler,me as pluginDisableHandler,pe as pluginEnableHandler,de as pluginInstallHandler,se as pluginListHandler,fe as pluginUninstallHandler,he as pluginUpdateHandler,oe as pluginValidateHandler};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./poorMode-DmvzFAz_.js";t();export{e as isPoorModeActive};
@@ -1 +1 @@
1
- import{n as e,r as t}from"./rolldown-runtime-DaDcL9Zw.js";import{b as n,h as r,t as i}from"./settings-B2jvL8Dp.js";var a=t({isPoorModeActive:()=>o,setPoorMode:()=>s});function o(){return c===null&&(c=i().poorMode===!0),c}function s(e){c=e,n(`userSettings`,{poorMode:e||void 0})}var c,l=e((()=>{r(),c=null}));export{s as i,o as n,a as r,l as t};
1
+ import{n as e,r as t}from"./rolldown-runtime-DaDcL9Zw.js";import{b as n,h as r,t as i}from"./settings-CodSADx8.js";var a=t({isPoorModeActive:()=>o,setPoorMode:()=>s});function o(){return c===null&&(c=i().poorMode===!0),c}function s(e){c=e,n(`userSettings`,{poorMode:e||void 0})}var c,l=e((()=>{r(),c=null}));export{s as i,o as n,a as r,l as t};