@readmagic/workmate 0.0.27 → 0.0.29

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 (255) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-DqlPtsVK.js → AddWorkspaceDirectory-C0lrhffT.js} +1 -1
  2. package/dist/chunks/AgentsMdExternalIncludesDialog-DIahWLha.js +1 -0
  3. package/dist/chunks/{AgentsMdExternalIncludesDialog-rJS5l6yk.js → AgentsMdExternalIncludesDialog-Dmjjx4ql.js} +1 -1
  4. package/dist/chunks/App-COz7knHS.js +1 -0
  5. package/dist/chunks/{BackgroundTasksDialog-CBhSmdz_.js → BackgroundTasksDialog-5IkCQ8lN.js} +2 -2
  6. package/dist/chunks/{BypassPermissionsModeDialog-zz-lnmJt.js → BypassPermissionsModeDialog-g1FMGfQF.js} +1 -1
  7. package/dist/chunks/{CustomSelect-CYmc4vRh.js → CustomSelect-BsEd2To5.js} +1 -1
  8. package/dist/chunks/{DiffDialog-CTUIAcEE.js → DiffDialog-Cwf8CdxZ.js} +5 -5
  9. package/dist/chunks/Doctor-CcLoI7tF.js +1 -0
  10. package/dist/chunks/Doctor-GmT5aeAc.js +3 -0
  11. package/dist/chunks/ExitFlow-DPgUFqeC.js +2 -0
  12. package/dist/chunks/{InvalidConfigDialog-B-9Z58oD.js → InvalidConfigDialog-Di6HZYDV.js} +1 -1
  13. package/dist/chunks/{InvalidSettingsDialog-B4EWjbp7.js → InvalidSettingsDialog-BHL-MERJ.js} +1 -1
  14. package/dist/chunks/{KeybindingProviderSetup-Dzg77_Xn.js → KeybindingProviderSetup-eE3o0bfp.js} +1 -1
  15. package/dist/chunks/MCPConnectionManager-D-qpUJLV.js +1 -0
  16. package/dist/chunks/MCPToolListView-DtHRw4jQ.js +1 -0
  17. package/dist/chunks/{McpParsingWarnings-Dj_Fu5o-.js → McpParsingWarnings-ByyErvR3.js} +1 -1
  18. package/dist/chunks/MessageSelector-CFz30wBL.js +3 -0
  19. package/dist/chunks/Messages-CfY-Oj3M.js +10 -0
  20. package/dist/chunks/{Onboarding-BRSXxc2E.js → Onboarding-BfWLRx3n.js} +1 -1
  21. package/dist/chunks/{PromptInputFooterSuggestions-ChpyD9B7.js → PromptInputFooterSuggestions-BRyJj7XR.js} +1 -1
  22. package/dist/chunks/{PromptInputHelpMenu-CrTT8MKE.js → PromptInputHelpMenu-DLuRCXVS.js} +1 -1
  23. package/dist/chunks/{ProviderSetup-BEV95bnz.js → ProviderSetup-CKZGG2B9.js} +1 -1
  24. package/dist/chunks/QueryEngine-B27MOtBA.js +1 -0
  25. package/dist/chunks/{REPL-BDnZnm__.js → REPL-DMRD5wSN.js} +23 -23
  26. package/dist/chunks/REPL-gzolQvzu.js +1 -0
  27. package/dist/chunks/ResumeConversation-7eURPHmQ.js +1 -0
  28. package/dist/chunks/SearchExtraToolsTool-BINZTstr.js +1 -0
  29. package/dist/chunks/Settings-4TNYpfUs.js +2 -0
  30. package/dist/chunks/Spinner-BgjmQLjw.js +1 -0
  31. package/dist/chunks/{TextInput-ZKU-x_FD.js → TextInput-BVEWdRz9.js} +5 -5
  32. package/dist/chunks/{ThemePicker-B69oDgXN.js → ThemePicker-th2jdUjh.js} +1 -1
  33. package/dist/chunks/{TrustDialog-BSG8Ibh8.js → TrustDialog-YsYqHyRR.js} +1 -1
  34. package/dist/chunks/{ValidationErrorsList-BUYHEft4.js → ValidationErrorsList-CKeHoN2Z.js} +1 -1
  35. package/dist/chunks/{_baseEach-P0u1zIx6.js → _baseEach-Bz5fQbIq.js} +1 -1
  36. package/dist/chunks/{add-dir-C8RmmyQK.js → add-dir-BsO6l8Ue.js} +1 -1
  37. package/dist/chunks/{agentDisplay-np7CH47m.js → agentDisplay-ChkgiTIH.js} +1 -1
  38. package/dist/chunks/{agents-DedoH0Q4.js → agents-BV1nan6b.js} +6 -6
  39. package/dist/chunks/{agents-DRQlR5M1.js → agents-DqEB6iwV.js} +1 -1
  40. package/dist/chunks/allErrors-CkdguCDv.js +1 -0
  41. package/dist/chunks/{appleTerminalBackup-Bemd4RXh.js → appleTerminalBackup-CN8kS74J.js} +1 -1
  42. package/dist/chunks/{backgroundHousekeeping-BtEJ6TeC.js → backgroundHousekeeping-1VsWy8xd.js} +1 -1
  43. package/dist/chunks/backgroundHousekeeping-pMtrl4K2.js +1 -0
  44. package/dist/chunks/{banner-CuoceXzz.js → banner-BKOzHotb.js} +1 -1
  45. package/dist/chunks/{branch-ClhlS7f8.js → branch-CTIHtpwz.js} +2 -2
  46. package/dist/chunks/bridgeControl-C8xaGuwO.js +2 -0
  47. package/dist/chunks/{btw-B-FLxlx-.js → btw-BA39Zrhm.js} +1 -1
  48. package/dist/chunks/caches-DHZHqVhf.js +1 -0
  49. package/dist/chunks/caches-fqs-Y-kW.js +1 -0
  50. package/dist/chunks/channel-B5FkNSZ3.js +1 -0
  51. package/dist/chunks/channel-C5yKM1wf.js +1 -0
  52. package/dist/chunks/{clear-BnWv0i65.js → clear-BmlaYYrD.js} +1 -1
  53. package/dist/chunks/commands-EUcHifS4.js +1 -0
  54. package/dist/chunks/compact-D3uePeI7.js +2 -0
  55. package/dist/chunks/{config-BDn2YIjC.js → config-Bio2EjUK.js} +1 -1
  56. package/dist/chunks/config-C_AEhZrn.js +1 -0
  57. package/dist/chunks/config-GgGdlJ9h.js +1 -0
  58. package/dist/chunks/{context-BvDBAyJ9.js → context-CBEWyVpE.js} +1 -1
  59. package/dist/chunks/{context-noninteractive-CuHHniJn.js → context-noninteractive-B03nuxfN.js} +2 -2
  60. package/dist/chunks/context-noninteractive-BLCyyyGL.js +1 -0
  61. package/dist/chunks/conversation-BFL0rEIx.js +1 -0
  62. package/dist/chunks/conversation-D-ker4RO.js +1 -0
  63. package/dist/chunks/{conversationRecovery-NL05oJb1.js → conversationRecovery-Bt84CYO6.js} +1 -1
  64. package/dist/chunks/crossProjectResume-DwlYY6lV.js +40 -0
  65. package/dist/chunks/{diff--6gQCx_x.js → diff-CewYzu3Y.js} +1 -1
  66. package/dist/chunks/doctor-CrQ0UfG2.js +1 -0
  67. package/dist/chunks/{entry-DWYOrkFS.js → entry-DdVUdGWV.js} +3 -3
  68. package/dist/chunks/exit-QwCo2aJo.js +1 -0
  69. package/dist/chunks/{extraUsage-Dr0YXm1w.js → extraUsage-Cu0aV35i.js} +1 -1
  70. package/dist/chunks/extractMemories-DHlbRc5g.js +1 -0
  71. package/dist/chunks/{fast-C5-lNCQi.js → fast-BlhpCQ2f.js} +1 -1
  72. package/dist/chunks/fast-C3JeBy3A.js +1 -0
  73. package/dist/chunks/{fetchModelList-9w1E4Ue8.js → fetchModelList-DjFCMjVN.js} +1 -1
  74. package/dist/chunks/fetchModelList-L2XarfAj.js +1 -0
  75. package/dist/chunks/{fileSuggestions-BYD78vcF.js → fileSuggestions-BRwKV_KA.js} +2 -2
  76. package/dist/chunks/{gemini-BNBptTET.js → gemini-I-M5_sUA.js} +2 -2
  77. package/dist/chunks/{generateSessionName-CO2484aJ.js → generateSessionName-CJ0sh6HD.js} +1 -1
  78. package/dist/chunks/{goal-j0wdadwM.js → goal-DIrBBT5J.js} +3 -3
  79. package/dist/chunks/{grok-BpO1ZwK_.js → grok-ZLjJN6b9.js} +1 -1
  80. package/dist/chunks/{help-DwhA0qQ6.js → help-CDMjVOl6.js} +1 -1
  81. package/dist/chunks/{hooks-DG4_WdZ2.js → hooks-BNKCE023.js} +2 -2
  82. package/dist/chunks/hooks-ERYtmuNW.js +1 -0
  83. package/dist/chunks/{install-BbmCNCuM.js → install-xlfTw1j6.js} +1 -1
  84. package/dist/chunks/{instrumentation-DpPmDyNF.js → instrumentation-DSt0UvGn.js} +3 -3
  85. package/dist/chunks/{job-GcmX1ALd.js → job-BVElGsu0.js} +1 -1
  86. package/dist/chunks/{launchLocalMemory-CDgT5lst.js → launchLocalMemory-DUkJCKmd.js} +2 -2
  87. package/dist/chunks/{launchOnboarding-uQ_ux9sS.js → launchOnboarding-BvD-E_jC.js} +1 -1
  88. package/dist/chunks/loadAgentsDir-BImZsKrh.js +1 -0
  89. package/dist/chunks/{loadAgentsDir-uuZYOgKn.js → loadAgentsDir-BfLCckVj.js} +343 -343
  90. package/dist/chunks/loadPluginHooks-BPwWtBzO.js +1 -0
  91. package/dist/chunks/{localSearch-yVCDrVrf.js → localSearch-BHG8sp8p.js} +1 -1
  92. package/dist/chunks/localSearch-D3rvcRRC.js +1 -0
  93. package/dist/chunks/{logoUtils-B4wCDKs9.js → logoUtils-BsNLv-qi.js} +1 -1
  94. package/dist/chunks/{magicDocs-D53lV8b5.js → magicDocs-Bue9vxzY.js} +2 -2
  95. package/dist/chunks/{main-fy_XSXGj.js → main-U71X4Thd.js} +22 -22
  96. package/dist/chunks/managedEnv-DCGLDTP_.js +1 -0
  97. package/dist/chunks/{managedEnv-B8YWmM4A.js → managedEnv-EZ2IirNa.js} +1 -1
  98. package/dist/chunks/{mcp-CZUVaPb3.js → mcp-C4CxCMwJ.js} +3 -3
  99. package/dist/chunks/mcp-D9HFARDy.js +1 -0
  100. package/dist/chunks/mcp-De3QGKvT.js +2 -0
  101. package/dist/chunks/memory-DVRdJFfI.js +1 -0
  102. package/dist/chunks/{mode-Bteqe2QG.js → mode-Bd5w-RBX.js} +2 -2
  103. package/dist/chunks/{model-CHDU5yqH.js → model-BCIcUhrc.js} +1 -1
  104. package/dist/chunks/{model-CcHyMyBv.js → model-BIf2i1is.js} +1 -1
  105. package/dist/chunks/{modelOptions-CJV1R3Jt.js → modelOptions-COIU5U3w.js} +1 -1
  106. package/dist/chunks/{nativeInstaller-CIUYh1aD.js → nativeInstaller-CGSNzGNn.js} +1 -1
  107. package/dist/chunks/{notifications-GLnjirCl.js → notifications-B5gzCmPC.js} +1 -1
  108. package/dist/chunks/{onChangeAppState-CxGW2d-l.js → onChangeAppState-NWwSE-I4.js} +1 -1
  109. package/dist/chunks/{openai-BpGQT2Iv.js → openai-CyJ3m4dI.js} +2 -2
  110. package/dist/chunks/{overlayContext-7wgLio1O.js → overlayContext-DYrGDe63.js} +1 -1
  111. package/dist/chunks/{partition-djFY9gGI.js → partition-BavNaw1S.js} +1 -1
  112. package/dist/chunks/permissions-CLYcBXIu.js +3 -0
  113. package/dist/chunks/{pidLock-CFUBtZck.js → pidLock-Bao7SU6Z.js} +2 -2
  114. package/dist/chunks/{plan-DI0n7LIV.js → plan-Dwj_ZX8G.js} +1 -1
  115. package/dist/chunks/plugin-Cscvf8st.js +17 -0
  116. package/dist/chunks/{pluginAutoupdate-CNrHb4RJ.js → pluginAutoupdate-D5XyiZrP.js} +1 -1
  117. package/dist/chunks/pluginBlocklist-CpkjXXKQ.js +1 -0
  118. package/dist/chunks/pluginCliCommands-DmLsxs1M.js +1 -0
  119. package/dist/chunks/{pluginFlagging-CUvkKGOB.js → pluginFlagging-CRuX6sHR.js} +1 -1
  120. package/dist/chunks/pluginOperations-orq3bOCp.js +2 -0
  121. package/dist/chunks/{pluginStartupCheck-DftTiXct.js → pluginStartupCheck-DGDl1WOZ.js} +1 -1
  122. package/dist/chunks/pluginStartupCheck-GHO77nmg.js +1 -0
  123. package/dist/chunks/plugins-Cq5c-Qs1.js +4 -0
  124. package/dist/chunks/{print-DSHypGJa.js → print-zo7Z--Ll.js} +9 -9
  125. package/dist/chunks/processBashCommand-C7oVqf0B.js +1 -0
  126. package/dist/chunks/processSlashCommand-CPQB5_0w.js +5 -0
  127. package/dist/chunks/{projectOnboardingState-nTCycGCD.js → projectOnboardingState-D-_ijZnG.js} +1 -1
  128. package/dist/chunks/prompt-CAzFDybL.js +1 -0
  129. package/dist/chunks/prompt-Cm8SKZXY.js +1 -0
  130. package/dist/chunks/{prompt-BfXryFt-.js → prompt-DaYH88Oe.js} +1 -1
  131. package/dist/chunks/{protocolHandler-VigBkAQQ.js → protocolHandler-CJO3CRYW.js} +1 -1
  132. package/dist/chunks/{reconciler-B9XFdL4f.js → reconciler-B5Kr4do0.js} +1 -1
  133. package/dist/chunks/refresh-DurNMJeS.js +1 -0
  134. package/dist/chunks/{reject-CBxnwckZ.js → reject-CzjtO3fU.js} +1 -1
  135. package/dist/chunks/{reload-plugins-5eFWrQlL.js → reload-plugins-C38i_Eb3.js} +1 -1
  136. package/dist/chunks/rename-BV-3ZpFx.js +1 -0
  137. package/dist/chunks/{resume-U2D0ybfU.js → resume-CUzQIor4.js} +2 -2
  138. package/dist/chunks/{runtimeObserver-CWaYMJG8.js → runtimeObserver-BKoQ5IEO.js} +4 -4
  139. package/dist/chunks/{runtimeObserver-DOYlxx9H.js → runtimeObserver-Ess1Cn8Y.js} +1 -1
  140. package/dist/chunks/sandbox-adapter-ClRO21Ci.js +1 -0
  141. package/dist/chunks/{sandbox-toggle-BtiPyjT3.js → sandbox-toggle-Bp6Xpjh3.js} +1 -1
  142. package/dist/chunks/searchExtraTools-CV_fkuD6.js +1 -0
  143. package/dist/chunks/{select-BuTJbu_Q.js → select-Bm29ymsI.js} +1 -1
  144. package/dist/chunks/sessionFileAccessHooks-B5kAD4ol.js +1 -0
  145. package/dist/chunks/{sessionObserver-cfwD8pV8.js → sessionObserver-CBlzrJt1.js} +1 -1
  146. package/dist/chunks/sessionObserver-CayxkuxO.js +1 -0
  147. package/dist/chunks/sessionStorage-vLxCo1Mh.js +1 -0
  148. package/dist/chunks/{sessionTracing-DsdcOqvc.js → sessionTracing-TDsq54Uc.js} +1 -1
  149. package/dist/chunks/setup-BbyfyeQk.js +3 -0
  150. package/dist/chunks/{shadowedRuleDetection-DiZUDzxU.js → shadowedRuleDetection-BG3jtA9Y.js} +1 -1
  151. package/dist/chunks/{sideQuestion-CdgUarC2.js → sideQuestion-C8GNVo4R.js} +3 -3
  152. package/dist/chunks/{sinks-Cy3NqVbk.js → sinks-BafJR6Fw.js} +1 -1
  153. package/dist/chunks/sinks-CHtjg7sn.js +1 -0
  154. package/dist/chunks/skillChangeDetector-CY17weG4.js +1 -0
  155. package/dist/chunks/{skillGapStore-BJV8ZIB1.js → skillGapStore-Cl4J1WoZ.js} +2 -2
  156. package/dist/chunks/{skillLifecycle-iO_3s9Ff.js → skillLifecycle-DdfeUHBf.js} +2 -2
  157. package/dist/chunks/{skillSearchPanel-BL5gXTHU.js → skillSearchPanel-DtQYF9gN.js} +4 -4
  158. package/dist/chunks/{skills-BEp3_RyT.js → skills-Fd12LJal.js} +1 -1
  159. package/dist/chunks/status-CGEMRiPI.js +1 -0
  160. package/dist/chunks/statusNoticeHelpers-D0tonVy0.js +1 -0
  161. package/dist/chunks/{switcher-DSt2cVjA.js → switcher-BCq9Az_q.js} +1 -1
  162. package/dist/chunks/switcher-DQMr6Anx.js +1 -0
  163. package/dist/chunks/{tasks-DyBUXnQb.js → tasks-DQmkY_xD.js} +1 -1
  164. package/dist/chunks/{templateJobs-BBnReWWj.js → templateJobs-CEDUbFAY.js} +1 -1
  165. package/dist/chunks/{terminalSetup-CDpFfqqV.js → terminalSetup-CaGbEVjB.js} +1 -1
  166. package/dist/chunks/{terminalSetup-DedaY1P7.js → terminalSetup-xe_P98fY.js} +1 -1
  167. package/dist/chunks/{theme-BZOy9Iqh.js → theme-DQjJ4R0o.js} +1 -1
  168. package/dist/chunks/tipRegistry-BwxZ_G0j.js +2 -0
  169. package/dist/chunks/{toolEventObserver-ClwWmVbH.js → toolEventObserver-DdZ30on9.js} +1 -1
  170. package/dist/chunks/toolPool-CWIXwdX7.js +1 -0
  171. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-ClN4NJnB.js → useExitOnCtrlCDWithKeybindings-ClrtNKJ6.js} +1 -1
  172. package/dist/chunks/useMainLoopModel-CULw8pB_.js +1 -0
  173. package/dist/chunks/{useManagePlugins-CxHz-gUP.js → useManagePlugins-CmsPSHor.js} +1 -1
  174. package/dist/chunks/useMergedTools-C8PxReh0.js +1 -0
  175. package/dist/chunks/{useSearchInput-BIQN_-Hm.js → useSearchInput-BZhTzjgN.js} +1 -1
  176. package/dist/chunks/useSettingsErrors-GWIxCYyd.js +1 -0
  177. package/dist/chunks/{util-BHr5l6Bx.js → util-Bih2g-pV.js} +1 -1
  178. package/dist/chunks/validatePlugin-BwcC_Wbr.js +1 -0
  179. package/dist/chunks/{vim-CYjMtnwH.js → vim-BlO9V5_5.js} +1 -1
  180. package/dist/chunks/worktree-BB9lFWBB.js +1 -0
  181. package/dist/chunks/wrapper-B-Q3Illb.js +1 -0
  182. package/dist/chunks/{wrapper-K8ZapJVu.js → wrapper-DVKxC5fR.js} +1 -1
  183. package/dist/cli.js +1 -1
  184. package/package.json +2 -1
  185. package/dist/chunks/AgentsMdExternalIncludesDialog-CgSethgo.js +0 -1
  186. package/dist/chunks/App-DzRQpRKr.js +0 -1
  187. package/dist/chunks/Doctor-CLOYkPRR.js +0 -3
  188. package/dist/chunks/Doctor-CiZNe_qx.js +0 -1
  189. package/dist/chunks/ExitFlow-CATwJC4c.js +0 -2
  190. package/dist/chunks/MCPConnectionManager-CBY8nqdU.js +0 -1
  191. package/dist/chunks/MCPToolListView-C7HT6rrl.js +0 -1
  192. package/dist/chunks/MessageSelector-Dw_ERK_Z.js +0 -3
  193. package/dist/chunks/Messages-RBfRELKn.js +0 -10
  194. package/dist/chunks/QueryEngine-BBBkZWu2.js +0 -1
  195. package/dist/chunks/REPL-BHk0vZDf.js +0 -1
  196. package/dist/chunks/ResumeConversation-BuSqBrm1.js +0 -1
  197. package/dist/chunks/SearchExtraToolsTool-CdWB9sO8.js +0 -1
  198. package/dist/chunks/Settings-DYKmPdbd.js +0 -2
  199. package/dist/chunks/Spinner-DOI8qqZi.js +0 -1
  200. package/dist/chunks/allErrors-DvcU0w0F.js +0 -1
  201. package/dist/chunks/backgroundHousekeeping-B56nFTzq.js +0 -1
  202. package/dist/chunks/caches-D7arwhaa.js +0 -1
  203. package/dist/chunks/caches-Dn8yrJmL.js +0 -1
  204. package/dist/chunks/commands-AcfFLgl5.js +0 -1
  205. package/dist/chunks/compact-Banc-SNk.js +0 -2
  206. package/dist/chunks/config-BhBcadjZ.js +0 -1
  207. package/dist/chunks/config-Bm5pVdCq.js +0 -1
  208. package/dist/chunks/context-noninteractive-BK2IDLSS.js +0 -1
  209. package/dist/chunks/conversation-B2dX3X4Z.js +0 -1
  210. package/dist/chunks/conversation-Cjaftrrw.js +0 -1
  211. package/dist/chunks/crossProjectResume-BzltC4NJ.js +0 -40
  212. package/dist/chunks/doctor-CQf8xPZH.js +0 -1
  213. package/dist/chunks/exit-uKtXb5U3.js +0 -1
  214. package/dist/chunks/extractMemories-8yvMGZ1J.js +0 -1
  215. package/dist/chunks/fast-aNkj6WvB.js +0 -1
  216. package/dist/chunks/fetchModelList-D2quBF6M.js +0 -1
  217. package/dist/chunks/hooks-B5Wq-KxE.js +0 -1
  218. package/dist/chunks/loadAgentsDir-BBbIAiay.js +0 -1
  219. package/dist/chunks/loadPluginHooks-QoVXsBjy.js +0 -1
  220. package/dist/chunks/localSearch-D6MhwvnR.js +0 -1
  221. package/dist/chunks/managedEnv-ulQBH73B.js +0 -1
  222. package/dist/chunks/mcp--LmEVBRg.js +0 -1
  223. package/dist/chunks/mcp-DCl-Tz-C.js +0 -2
  224. package/dist/chunks/memory-Bu5ku7y9.js +0 -1
  225. package/dist/chunks/permissions-DNedQyLg.js +0 -3
  226. package/dist/chunks/plugin-BQ8gRVYF.js +0 -17
  227. package/dist/chunks/pluginBlocklist-CKCsgWdY.js +0 -1
  228. package/dist/chunks/pluginCliCommands-CACeyIwz.js +0 -1
  229. package/dist/chunks/pluginOperations-Ca_T-HYn.js +0 -2
  230. package/dist/chunks/pluginStartupCheck-Du9yx2P8.js +0 -1
  231. package/dist/chunks/plugins-Divl-P-X.js +0 -4
  232. package/dist/chunks/processBashCommand-BLcFmbyG.js +0 -1
  233. package/dist/chunks/processSlashCommand-Caif46Gi.js +0 -5
  234. package/dist/chunks/prompt-BZmu5CeK.js +0 -1
  235. package/dist/chunks/prompt-Cogr_WZr.js +0 -1
  236. package/dist/chunks/refresh-CBHbWTGg.js +0 -1
  237. package/dist/chunks/rename-Cw7cMerG.js +0 -1
  238. package/dist/chunks/sandbox-adapter-Df7Wpt77.js +0 -1
  239. package/dist/chunks/searchExtraTools-CbJVb_Zk.js +0 -1
  240. package/dist/chunks/sessionFileAccessHooks-_mxyfQmn.js +0 -1
  241. package/dist/chunks/sessionObserver-BZVgzp3W.js +0 -1
  242. package/dist/chunks/sessionStorage-SC5RfnUP.js +0 -1
  243. package/dist/chunks/setup-DR-KEmxL.js +0 -3
  244. package/dist/chunks/sinks-D41OiGE4.js +0 -1
  245. package/dist/chunks/skillChangeDetector-CVFCJcG7.js +0 -1
  246. package/dist/chunks/status-6JMz8jmM.js +0 -1
  247. package/dist/chunks/statusNoticeHelpers-BoloSeXY.js +0 -1
  248. package/dist/chunks/switcher-95d4TrQH.js +0 -1
  249. package/dist/chunks/tipRegistry-Cl5sdLRX.js +0 -2
  250. package/dist/chunks/toolPool-DSTbgGmX.js +0 -1
  251. package/dist/chunks/useMainLoopModel-Bgxpmn2Q.js +0 -1
  252. package/dist/chunks/useMergedTools-BUuWew0-.js +0 -1
  253. package/dist/chunks/useSettingsErrors-BDJCLei_.js +0 -1
  254. package/dist/chunks/validatePlugin-fx1Y8vam.js +0 -1
  255. package/dist/chunks/worktree-CGu_58ue.js +0 -1
@@ -1,3 +1,3 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{c as r,i,l as a,o}from"./envUtils-QyzA_cFM.js";import{A as s,M as c,Xt as l,m as ee,qt as te,rn as ne,t as re,tn as ie}from"./settings-D4M13toi.js";import{aC as ae,sC as oe}from"./loadAgentsDir-uuZYOgKn.js";import{n as se}from"./cwd-DrEEb4f5.js";import{C as ce,D as le,I as u,R as d,S as ue,T as de,V as fe,c as f,f as p,i as m,u as h,x as g,z as pe}from"./debug-2pVES-2G.js";import{d as me,i as _,o as v,r as he}from"./config-BDn2YIjC.js";import{r as ge,t as _e}from"./execa-CBhG1doD.js";import{o as y,s as b}from"./log-L1kqxa_P.js";import{i as x,n as ve,t as S}from"./execFileNoThrow-DXSEj8ZO.js";import{c as ye,i as C,n as w,o as be,s as xe,t as Se}from"./bundledMode-D9omqD3L.js";import{b as Ce,y as we}from"./sleep-xKMbXTJe.js";import{a as Te,i as Ee}from"./ripgrep-67m14ImZ.js";import{n as De,r as Oe}from"./genericProcessUtils-GqURdVAv.js";import{homedir as T}from"os";import{basename as ke,delimiter as Ae,join as E,posix as D,win32 as O}from"path";import{constants as je}from"fs";import{access as k,open as Me,readFile as A,realpath as j,stat as Ne}from"fs/promises";function Pe(){return E(i(),`local`)}function Fe(){return E(Pe(),`workmate`)}function Ie(){return(process.argv[1]||``).includes(`/.workmate/local/node_modules/`)}async function Le(){try{return await k(E(Pe(),`node_modules`,`.bin`,`wm`)),!0}catch{return!1}}function Re(){let e=process.env.SHELL||``;return e.includes(`zsh`)?`zsh`:e.includes(`bash`)?`bash`:e.includes(`fish`)?`fish`:`unknown`}var M=e((()=>{me(),o(),u(),x(),p(),y(),g()}));function N(e){let t=e?.homedir??T();return{zsh:E((e?.env??process.env).ZDOTDIR||t,`.zshrc`),bash:E(t,`.bashrc`),fish:E(t,`.config/fish/config.fish`)}}function ze(e){let t=!1;return{filtered:e.filter(e=>{if(F.test(e)){let n=e.match(/alias\s+claude\s*=\s*["']([^"']+)["']/);if(n||(n=e.match(/alias\s+claude\s*=\s*([^#\n]+)/)),n?.[1]&&n[1].trim()===Fe())return t=!0,!1}return!0}),hadAlias:t}}async function Be(e){try{return(await A(e,{encoding:`utf8`})).split(`
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{c as r,i,l as a,o}from"./envUtils-QyzA_cFM.js";import{A as s,M as c,Xt as l,m as ee,qt as te,rn as ne,t as re,tn as ie}from"./settings-D4M13toi.js";import{lC as ae,sC as oe}from"./loadAgentsDir-BfLCckVj.js";import{n as se}from"./cwd-DrEEb4f5.js";import{C as ce,D as le,I as u,R as d,S as ue,T as de,V as fe,c as f,f as p,i as m,u as h,x as g,z as pe}from"./debug-2pVES-2G.js";import{d as me,i as _,o as v,r as he}from"./config-Bio2EjUK.js";import{r as ge,t as _e}from"./execa-CBhG1doD.js";import{o as y,s as b}from"./log-L1kqxa_P.js";import{i as x,n as ve,t as S}from"./execFileNoThrow-DXSEj8ZO.js";import{c as ye,i as C,n as w,o as be,s as xe,t as Se}from"./bundledMode-D9omqD3L.js";import{b as Ce,y as we}from"./sleep-xKMbXTJe.js";import{a as Te,i as Ee}from"./ripgrep-67m14ImZ.js";import{n as De,r as Oe}from"./genericProcessUtils-GqURdVAv.js";import{homedir as T}from"os";import{basename as ke,delimiter as Ae,join as E,posix as D,win32 as O}from"path";import{constants as je}from"fs";import{access as k,open as Me,readFile as A,realpath as j,stat as Ne}from"fs/promises";function Pe(){return E(i(),`local`)}function Fe(){return E(Pe(),`workmate`)}function Ie(){return(process.argv[1]||``).includes(`/.workmate/local/node_modules/`)}async function Le(){try{return await k(E(Pe(),`node_modules`,`.bin`,`wm`)),!0}catch{return!1}}function Re(){let e=process.env.SHELL||``;return e.includes(`zsh`)?`zsh`:e.includes(`bash`)?`bash`:e.includes(`fish`)?`fish`:`unknown`}var M=e((()=>{me(),o(),u(),x(),p(),y(),g()}));function N(e){let t=e?.homedir??T();return{zsh:E((e?.env??process.env).ZDOTDIR||t,`.zshrc`),bash:E(t,`.bashrc`),fish:E(t,`.config/fish/config.fish`)}}function ze(e){let t=!1;return{filtered:e.filter(e=>{if(F.test(e)){let n=e.match(/alias\s+claude\s*=\s*["']([^"']+)["']/);if(n||(n=e.match(/alias\s+claude\s*=\s*([^#\n]+)/)),n?.[1]&&n[1].trim()===Fe())return t=!0,!1}return!0}),hadAlias:t}}async function Be(e){try{return(await A(e,{encoding:`utf8`})).split(`
2
2
  `)}catch(e){if(pe(e))return null;throw e}}async function Ve(e,t){let n=await Me(e,`w`);try{await n.writeFile(t.join(`
3
- `),{encoding:`utf8`}),await n.datasync()}finally{await n.close()}}async function P(e){let t=N(e);for(let e of Object.values(t)){let t=await Be(e);if(t){for(let e of t)if(F.test(e)){let t=e.match(/alias\s+claude=["']?([^"'\s]+)/);if(t?.[1])return t[1]}}}return null}async function He(e){let t=await P(e);if(!t)return null;let n=e?.homedir??T(),r=t.startsWith(`~`)?t.replace(`~`,n):t;try{let e=await Ne(r);if(e.isFile()||e.isSymbolicLink())return t}catch{}return null}var F,I=e((()=>{u(),M(),F=/^\s*alias\s+claude\s*=/}));async function Ue(){}function We(e){let t=re()?.minimumVersion;if(!t)return!1;let n=!we(e,t);return n&&f(`Skipping update to ${e} - below minimumVersion ${t}`),n}async function Ge(){let e=te.isRunningWithBun(),t=null;return t=e?await ve(`bun`,[`pm`,`bin`,`-g`],{cwd:T()}):await ve(`npm`,[`-g`,`config`,`get`,`prefix`],{cwd:T()}),t.code===0?t.stdout.trim():(b(Error(`Failed to check ${e?`bun`:`npm`} permissions`)),null)}async function Ke(){try{let e=await Ge();if(!e)return{hasPermissions:!1,npmPrefix:null};try{return await k(e,je.W_OK),{hasPermissions:!0,npmPrefix:e}}catch{return b(new L(`Insufficient permissions for global npm install.`)),{hasPermissions:!1,npmPrefix:e}}}catch(e){return b(e),{hasPermissions:!1,npmPrefix:null}}}var L,R=e((()=>{m(),l(),o(),u(),x(),p(),y(),Ce(),ee(),I(),L=class extends le{}}));function z(e,t){return t.includes(e.id)||e.idLike.some(e=>t.includes(e))}function B(){let e=process.execPath||process.argv[0]||``;return/[/\\]mise[/\\]installs[/\\]/i.test(e)?(f(`Detected mise installation: ${e}`),!0):!1}function V(){let e=process.execPath||process.argv[0]||``;return/[/\\]\.?asdf[/\\]installs[/\\]/i.test(e)?(f(`Detected asdf installation: ${e}`),!0):!1}function H(){let e=C();if(e!==`macos`&&e!==`linux`&&e!==`wsl`)return!1;let t=process.execPath||process.argv[0]||``;return t.includes(`/Caskroom/`)?(f(`Detected Homebrew cask installation: ${t}`),!0):!1}function U(){if(C()!==`windows`)return!1;let e=process.execPath||process.argv[0]||``;for(let t of[/Microsoft[/\\]WinGet[/\\]Packages/i,/Microsoft[/\\]WinGet[/\\]Links/i])if(t.test(e))return f(`Detected winget installation: ${e}`),!0;return!1}var W,G,K,q,J,qe,Je=e((()=>{n(),m(),x(),be(),W=t(async()=>{try{let e=await A(`/etc/os-release`,`utf8`),t=e.match(/^ID=["']?(\S+?)["']?\s*$/m),n=e.match(/^ID_LIKE=["']?(.+?)["']?\s*$/m);return{id:t?.[1]??``,idLike:n?.[1]?.split(` `)??[]}}catch{return null}}),G=t(async()=>{if(C()!==`linux`)return!1;let e=await W();if(e&&!z(e,[`arch`]))return!1;let t=await S(`pacman`,[`-Qo`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(f(`Detected pacman installation: ${t.stdout.trim()}`),!0):!1}),K=t(async()=>{if(C()!==`linux`)return!1;let e=await W();if(e&&!z(e,[`debian`]))return!1;let t=await S(`dpkg`,[`-S`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(f(`Detected deb installation: ${t.stdout.trim()}`),!0):!1}),q=t(async()=>{if(C()!==`linux`)return!1;let e=await W();if(e&&!z(e,[`fedora`,`rhel`,`suse`]))return!1;let t=await S(`rpm`,[`-qf`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(f(`Detected rpm installation: ${t.stdout.trim()}`),!0):!1}),J=t(async()=>{if(C()!==`linux`)return!1;let e=await W();if(e&&!z(e,[`alpine`]))return!1;let t=await S(`apk`,[`info`,`--who-owns`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(f(`Detected apk installation: ${t.stdout.trim()}`),!0):!1}),qe=t(async()=>H()?`homebrew`:U()?`winget`:B()?`mise`:V()?`asdf`:await G()?`pacman`:await J()?`apk`:await K()?`deb`:await q()?`rpm`:`unknown`)}));function Ye(){let e=process.argv[1]||``,t=process.execPath||process.argv[0]||``;return C()===`windows`&&(e=e.split(O.sep).join(D.sep),t=t.split(O.sep).join(D.sep)),[e,t]}async function Xe(){let[e]=Ye();if(w())return H()||U()||B()||V()||await G()||await K()||await q()||await J()?`package-manager`:`native`;if(Ie())return`npm-local`;if([`/usr/local/lib/node_modules`,`/usr/lib/node_modules`,`/opt/homebrew/lib/node_modules`,`/opt/homebrew/bin`,`/usr/local/bin`,`/.nvm/versions/node/`].some(t=>e.includes(t))||e.includes(`/npm/`)||e.includes(`/nvm/`))return`npm-global`;let t=await _e(`npm config get prefix`,{shell:!0,reject:!1}),n=t.exitCode===0?t.stdout.trim():null;return n&&e.startsWith(n)?`npm-global`:`unknown`}async function Ze(){if(w()){try{return await j(process.execPath)}catch{}try{let e=await ye(`claude`);if(e)return e}catch{}try{return await h().stat(E(T(),`.local/bin/claude`)),E(T(),`.local/bin/claude`)}catch{}return`native`}try{return process.argv[0]||`unknown`}catch{return`unknown`}}function Qe(){try{return w()?process.execPath||`unknown`:process.argv[1]||`unknown`}catch{return`unknown`}}async function $e(){let e=h(),t=[],n=E(T(),`.workmate`,`local`);await Le()&&t.push({type:`npm-local`,path:n});let r=[`@readmagic/workmate`],i=await S(`npm`,[`-g`,`config`,`get`,`prefix`]);if(i.code===0&&i.stdout){let n=i.stdout.trim(),a=C()===`windows`,o=a?E(n,`claude`):E(n,`bin`,`claude`),s=!1;try{await e.stat(o),s=!0}catch{}if(s){let e=!1;try{(await j(o)).includes(`/Caskroom/`)&&(e=H())}catch{}e||t.push({type:`npm-global`,path:o})}else for(let i of r){let r=a?E(n,`node_modules`,i):E(n,`lib`,`node_modules`,i);try{await e.stat(r),t.push({type:`npm-global-orphan`,path:r})}catch{}}}let a=E(T(),`.local`,`bin`,`claude`);try{await e.stat(a),t.push({type:`native`,path:a})}catch{}if(v().installMethod===`native`){let n=E(T(),`.local`,`share`,`claude`);try{await e.stat(n),t.some(e=>e.type===`native`)||t.push({type:`native`,path:n})}catch{}}return t}async function et(e){let t=[];try{let e=ue(await A(E(ie(),`managed-settings.json`),`utf-8`)),n=e&&typeof e==`object`?e.strictPluginOnlyCustomization:void 0;if(n!==void 0&&typeof n!=`boolean`)if(!Array.isArray(n))t.push({issue:`managed-settings.json: strictPluginOnlyCustomization has an invalid value (expected true or an array, got ${typeof n})`,fix:`The field is silently ignored (schema .catch rescues it). Set it to true, or an array of: ${s.join(`, `)}.`});else{let e=n.filter(e=>typeof e==`string`&&!s.includes(e));e.length>0&&t.push({issue:`managed-settings.json: strictPluginOnlyCustomization has ${e.length} value(s) this client doesn't recognize: ${e.map(String).join(`, `)}`,fix:`These are silently ignored (forwards-compat). Known surfaces for this version: ${s.join(`, `)}. Either remove them, or this client is older than the managed-settings intended.`})}}catch{}let n=v();if(e===`development`)return t;if(e===`native`){let e=(process.env.PATH||``).split(Ae),n=E(T(),`.local`,`bin`),r=n;if(C()===`windows`&&(r=n.split(O.sep).join(D.sep)),!e.some(e=>{let t=e;C()===`windows`&&(t=e.split(O.sep).join(D.sep));let n=t.replace(/\/+$/,``),i=e.replace(/[/\\]+$/,``);return n===r||i===`~/.local/bin`||i===`$HOME/.local/bin`}))if(C()===`windows`){let e=n.split(D.sep).join(O.sep);t.push({issue:`Native installation exists but ${e} is not in your PATH`,fix:`Add it by opening: System Properties → Environment Variables → Edit User PATH → New → Add the path above. Then restart your terminal.`})}else{let e=Re(),n=N()[e],r=n?n.replace(T(),`~`):`your shell config file`;t.push({issue:`Native installation exists but ~/.local/bin is not in your PATH`,fix:`Run: echo 'export PATH="$HOME/.local/bin:$PATH"' >> ${r} then open a new terminal or run: source ${r}`})}}a(process.env.DISABLE_INSTALLATION_CHECKS)||(e===`npm-local`&&n.installMethod!==`local`&&t.push({issue:`Running from local installation but config install method is '${n.installMethod}'`,fix:`Consider using native installation: claude install`}),e===`native`&&n.installMethod!==`native`&&t.push({issue:`Running native installation but config install method is '${n.installMethod}'`,fix:`Run claude install to update configuration`})),e===`npm-global`&&await Le()&&t.push({issue:`Local installation exists but not being used`,fix:`Consider using native installation: claude install`});let r=await P(),i=await He();return e===`npm-local`&&!await ye(`claude`)&&!i&&(r?t.push({issue:`Local installation not accessible`,fix:`Alias exists but points to invalid target: ${r}. Update alias: alias claude="~/.workmate/local/claude"`}):t.push({issue:`Local installation not accessible`,fix:`Create alias: alias claude="~/.workmate/local/claude"`})),t}function tt(){if(C()!==`linux`)return[];let e=[],t=ae.getLinuxGlobPatternWarnings();if(t.length>0){let n=t.slice(0,3).join(`, `),r=t.length-3,i=r>0?`${n} (${r} more)`:n;e.push({issue:`Glob patterns in sandbox permission rules are not fully supported on Linux`,fix:`Found ${t.length} pattern(s): ${i}. On Linux, glob patterns in Edit/Read rules will be ignored.`})}return e}async function nt(){let e=await Xe(),t=typeof MACRO<`u`?`0.0.27`:`unknown`,n=await Ze(),r=Qe(),i=await $e(),a=await et(e);if(a.push(...tt()),e===`native`){let e=i.filter(e=>e.type===`npm-global`||e.type===`npm-global-orphan`||e.type===`npm-local`),t=C()===`windows`;for(let n of e)n.type===`npm-global`?a.push({issue:`Leftover npm global installation at ${n.path}`,fix:`Run: npm -g uninstall @readmagic/workmate`}):n.type===`npm-global-orphan`?a.push({issue:`Orphaned npm global package at ${n.path}`,fix:t?`Run: rmdir /s /q "${n.path}"`:`Run: rm -rf ${n.path}`}):n.type===`npm-local`&&a.push({issue:`Leftover npm local installation at ${n.path}`,fix:t?`Run: rmdir /s /q "${n.path}"`:`Run: rm -rf ${n.path}`})}let o=v().installMethod||`not set`,s=null;e===`npm-global`&&(s=(await Ke()).hasPermissions,!s&&!_()&&a.push({issue:`Insufficient permissions for auto-updates`,fix:"Do one of: (1) Re-install node without sudo, or (2) Use `claude install` for native installation"}));let c=Ee(),l={working:c.working??!0,mode:c.mode,systemPath:c.mode===`system`?c.path:null,note:c.note??null},ee=e===`package-manager`?await qe():void 0;return{installationType:e,version:t,installationPath:n,invokedBinary:r,configInstallMethod:o,autoUpdates:(()=>{let e=_();return e?`disabled (${he(e)})`:`enabled`})(),hasUpdatePermissions:s,multipleInstallations:i,warnings:a,packageManager:ee,ripgrepStatus:l}}var rt=e((()=>{ge(),R(),Se(),me(),se(),o(),x(),p(),M(),Je(),be(),Te(),oe(),ne(),c(),I(),g(),xe()}));function Y(e){return{env:e?.env??process.env,home:e?.homedir??process.env.HOME??T()}}function X(e,...t){return e.includes(`/`)&&!e.includes(`\\`)&&!/^[A-Za-z]:/.test(e)?D.join(e,...t):E(e,...t)}function it(e){let{env:t,home:n}=Y(e);return t.XDG_STATE_HOME??X(n,`.local`,`state`)}function at(e){let{env:t,home:n}=Y(e);return t.XDG_CACHE_HOME??X(n,`.cache`)}function ot(e){let{env:t,home:n}=Y(e);return t.XDG_DATA_HOME??X(n,`.local`,`share`)}function st(e){let{home:t}=Y(e);return X(t,`.local`,`bin`)}var ct=e((()=>{}));function lt(){let e=process.env.ENABLE_PID_BASED_VERSION_LOCKING;return a(e)?!0:(r(e),!1)}function Z(e){if(e<=1)return!1;try{return process.kill(e,0),!0}catch{return!1}}function ut(e,t){if(!Z(e))return!1;if(e===process.pid)return!0;try{let n=De(e);if(!n)return!0;let r=n.toLowerCase(),i=t.toLowerCase();return r.includes(`claude`)||r.includes(i)}catch{return!0}}function Q(e){let t=h();try{let n=t.readFileSync(e,{encoding:`utf8`});if(!n||n.trim()===``)return null;let r=ue(n);return typeof r.pid!=`number`||!r.version||!r.execPath?null:r}catch{return null}}function $(e){let t=Q(e);if(!t)return!1;let{pid:n,execPath:r}=t;if(!Z(n))return!1;if(!ut(n,r))return f(`Lock PID ${n} is running but does not appear to be Work Mate - treating as stale`),!1;let i=h();try{let t=i.statSync(e);if(Date.now()-t.mtimeMs>_t&&!Z(n))return!1}catch{}return!0}function dt(e,t){let n=h(),r=`${e}.tmp.${process.pid}.${Date.now()}`;try{de(r,ce(t,null,2),{encoding:`utf8`,flush:!0}),n.renameSync(r,e)}catch(e){try{n.unlinkSync(r)}catch{}throw e}}async function ft(e,t){let n=h(),r=ke(e);if($(t))return f(`Cannot acquire lock for ${r} - held by PID ${Q(t)?.pid}`),null;let i={pid:process.pid,version:r,execPath:process.execPath,acquiredAt:Date.now()};try{return dt(t,i),Q(t)?.pid===process.pid?(f(`Acquired PID lock for ${r} (PID ${process.pid})`),()=>{try{Q(t)?.pid===process.pid&&(n.unlinkSync(t),f(`Released PID lock for ${r}`))}catch(e){f(`Failed to release lock for ${r}: ${e}`)}}):null}catch(e){return f(`Failed to acquire lock for ${r}: ${e}`),null}}async function pt(e,t){let n=await ft(e,t);if(!n)return!1;let r=()=>{try{n()}catch{}};return process.on(`exit`,r),process.on(`SIGINT`,r),process.on(`SIGTERM`,r),!0}async function mt(e,t,n){let r=await ft(e,t);if(!r)return!1;try{return await n(),!0}finally{r()}}function ht(e){let t=h(),n=[];try{let r=t.readdirStringSync(e).filter(e=>e.endsWith(`.lock`));for(let t of r){let r=E(e,t),i=Q(r);i&&n.push({version:i.version,pid:i.pid,isProcessRunning:Z(i.pid),execPath:i.execPath,acquiredAt:new Date(i.acquiredAt),lockFilePath:r})}}catch(e){if(d(e))return n;b(fe(e))}return n}function gt(e){let t=h(),n=0;try{let r=t.readdirStringSync(e).filter(e=>e.endsWith(`.lock`));for(let i of r){let r=E(e,i);try{t.lstatSync(r).isDirectory()?(t.rmSync(r,{recursive:!0,force:!0}),n++,f(`Cleaned up legacy directory lock: ${i}`)):$(r)||(t.unlinkSync(r),n++,f(`Cleaned up stale lock: ${i}`))}catch{}}}catch(e){if(d(e))return 0;b(fe(e))}return n}var _t,vt=e((()=>{m(),o(),u(),p(),Oe(),y(),g(),_t=7200*1e3}));export{Be as C,M as E,I as S,Re as T,Ue as _,$ as a,ze as b,mt as c,ot as d,it as f,rt as g,nt as h,vt as i,st as l,Xe as m,gt as n,lt as o,ct as p,ht as r,Q as s,pt as t,at as u,R as v,Ve as w,N as x,We as y};
3
+ `),{encoding:`utf8`}),await n.datasync()}finally{await n.close()}}async function P(e){let t=N(e);for(let e of Object.values(t)){let t=await Be(e);if(t){for(let e of t)if(F.test(e)){let t=e.match(/alias\s+claude=["']?([^"'\s]+)/);if(t?.[1])return t[1]}}}return null}async function He(e){let t=await P(e);if(!t)return null;let n=e?.homedir??T(),r=t.startsWith(`~`)?t.replace(`~`,n):t;try{let e=await Ne(r);if(e.isFile()||e.isSymbolicLink())return t}catch{}return null}var F,I=e((()=>{u(),M(),F=/^\s*alias\s+claude\s*=/}));async function Ue(){}function We(e){let t=re()?.minimumVersion;if(!t)return!1;let n=!we(e,t);return n&&f(`Skipping update to ${e} - below minimumVersion ${t}`),n}async function Ge(){let e=te.isRunningWithBun(),t=null;return t=e?await ve(`bun`,[`pm`,`bin`,`-g`],{cwd:T()}):await ve(`npm`,[`-g`,`config`,`get`,`prefix`],{cwd:T()}),t.code===0?t.stdout.trim():(b(Error(`Failed to check ${e?`bun`:`npm`} permissions`)),null)}async function Ke(){try{let e=await Ge();if(!e)return{hasPermissions:!1,npmPrefix:null};try{return await k(e,je.W_OK),{hasPermissions:!0,npmPrefix:e}}catch{return b(new L(`Insufficient permissions for global npm install.`)),{hasPermissions:!1,npmPrefix:e}}}catch(e){return b(e),{hasPermissions:!1,npmPrefix:null}}}var L,R=e((()=>{m(),l(),o(),u(),x(),p(),y(),Ce(),ee(),I(),L=class extends le{}}));function z(e,t){return t.includes(e.id)||e.idLike.some(e=>t.includes(e))}function B(){let e=process.execPath||process.argv[0]||``;return/[/\\]mise[/\\]installs[/\\]/i.test(e)?(f(`Detected mise installation: ${e}`),!0):!1}function V(){let e=process.execPath||process.argv[0]||``;return/[/\\]\.?asdf[/\\]installs[/\\]/i.test(e)?(f(`Detected asdf installation: ${e}`),!0):!1}function H(){let e=C();if(e!==`macos`&&e!==`linux`&&e!==`wsl`)return!1;let t=process.execPath||process.argv[0]||``;return t.includes(`/Caskroom/`)?(f(`Detected Homebrew cask installation: ${t}`),!0):!1}function U(){if(C()!==`windows`)return!1;let e=process.execPath||process.argv[0]||``;for(let t of[/Microsoft[/\\]WinGet[/\\]Packages/i,/Microsoft[/\\]WinGet[/\\]Links/i])if(t.test(e))return f(`Detected winget installation: ${e}`),!0;return!1}var W,G,K,q,J,qe,Je=e((()=>{n(),m(),x(),be(),W=t(async()=>{try{let e=await A(`/etc/os-release`,`utf8`),t=e.match(/^ID=["']?(\S+?)["']?\s*$/m),n=e.match(/^ID_LIKE=["']?(.+?)["']?\s*$/m);return{id:t?.[1]??``,idLike:n?.[1]?.split(` `)??[]}}catch{return null}}),G=t(async()=>{if(C()!==`linux`)return!1;let e=await W();if(e&&!z(e,[`arch`]))return!1;let t=await S(`pacman`,[`-Qo`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(f(`Detected pacman installation: ${t.stdout.trim()}`),!0):!1}),K=t(async()=>{if(C()!==`linux`)return!1;let e=await W();if(e&&!z(e,[`debian`]))return!1;let t=await S(`dpkg`,[`-S`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(f(`Detected deb installation: ${t.stdout.trim()}`),!0):!1}),q=t(async()=>{if(C()!==`linux`)return!1;let e=await W();if(e&&!z(e,[`fedora`,`rhel`,`suse`]))return!1;let t=await S(`rpm`,[`-qf`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(f(`Detected rpm installation: ${t.stdout.trim()}`),!0):!1}),J=t(async()=>{if(C()!==`linux`)return!1;let e=await W();if(e&&!z(e,[`alpine`]))return!1;let t=await S(`apk`,[`info`,`--who-owns`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(f(`Detected apk installation: ${t.stdout.trim()}`),!0):!1}),qe=t(async()=>H()?`homebrew`:U()?`winget`:B()?`mise`:V()?`asdf`:await G()?`pacman`:await J()?`apk`:await K()?`deb`:await q()?`rpm`:`unknown`)}));function Ye(){let e=process.argv[1]||``,t=process.execPath||process.argv[0]||``;return C()===`windows`&&(e=e.split(O.sep).join(D.sep),t=t.split(O.sep).join(D.sep)),[e,t]}async function Xe(){let[e]=Ye();if(w())return H()||U()||B()||V()||await G()||await K()||await q()||await J()?`package-manager`:`native`;if(Ie())return`npm-local`;if([`/usr/local/lib/node_modules`,`/usr/lib/node_modules`,`/opt/homebrew/lib/node_modules`,`/opt/homebrew/bin`,`/usr/local/bin`,`/.nvm/versions/node/`].some(t=>e.includes(t))||e.includes(`/npm/`)||e.includes(`/nvm/`))return`npm-global`;let t=await _e(`npm config get prefix`,{shell:!0,reject:!1}),n=t.exitCode===0?t.stdout.trim():null;return n&&e.startsWith(n)?`npm-global`:`unknown`}async function Ze(){if(w()){try{return await j(process.execPath)}catch{}try{let e=await ye(`claude`);if(e)return e}catch{}try{return await h().stat(E(T(),`.local/bin/claude`)),E(T(),`.local/bin/claude`)}catch{}return`native`}try{return process.argv[0]||`unknown`}catch{return`unknown`}}function Qe(){try{return w()?process.execPath||`unknown`:process.argv[1]||`unknown`}catch{return`unknown`}}async function $e(){let e=h(),t=[],n=E(T(),`.workmate`,`local`);await Le()&&t.push({type:`npm-local`,path:n});let r=[`@readmagic/workmate`],i=await S(`npm`,[`-g`,`config`,`get`,`prefix`]);if(i.code===0&&i.stdout){let n=i.stdout.trim(),a=C()===`windows`,o=a?E(n,`claude`):E(n,`bin`,`claude`),s=!1;try{await e.stat(o),s=!0}catch{}if(s){let e=!1;try{(await j(o)).includes(`/Caskroom/`)&&(e=H())}catch{}e||t.push({type:`npm-global`,path:o})}else for(let i of r){let r=a?E(n,`node_modules`,i):E(n,`lib`,`node_modules`,i);try{await e.stat(r),t.push({type:`npm-global-orphan`,path:r})}catch{}}}let a=E(T(),`.local`,`bin`,`claude`);try{await e.stat(a),t.push({type:`native`,path:a})}catch{}if(v().installMethod===`native`){let n=E(T(),`.local`,`share`,`claude`);try{await e.stat(n),t.some(e=>e.type===`native`)||t.push({type:`native`,path:n})}catch{}}return t}async function et(e){let t=[];try{let e=ue(await A(E(ie(),`managed-settings.json`),`utf-8`)),n=e&&typeof e==`object`?e.strictPluginOnlyCustomization:void 0;if(n!==void 0&&typeof n!=`boolean`)if(!Array.isArray(n))t.push({issue:`managed-settings.json: strictPluginOnlyCustomization has an invalid value (expected true or an array, got ${typeof n})`,fix:`The field is silently ignored (schema .catch rescues it). Set it to true, or an array of: ${s.join(`, `)}.`});else{let e=n.filter(e=>typeof e==`string`&&!s.includes(e));e.length>0&&t.push({issue:`managed-settings.json: strictPluginOnlyCustomization has ${e.length} value(s) this client doesn't recognize: ${e.map(String).join(`, `)}`,fix:`These are silently ignored (forwards-compat). Known surfaces for this version: ${s.join(`, `)}. Either remove them, or this client is older than the managed-settings intended.`})}}catch{}let n=v();if(e===`development`)return t;if(e===`native`){let e=(process.env.PATH||``).split(Ae),n=E(T(),`.local`,`bin`),r=n;if(C()===`windows`&&(r=n.split(O.sep).join(D.sep)),!e.some(e=>{let t=e;C()===`windows`&&(t=e.split(O.sep).join(D.sep));let n=t.replace(/\/+$/,``),i=e.replace(/[/\\]+$/,``);return n===r||i===`~/.local/bin`||i===`$HOME/.local/bin`}))if(C()===`windows`){let e=n.split(D.sep).join(O.sep);t.push({issue:`Native installation exists but ${e} is not in your PATH`,fix:`Add it by opening: System Properties → Environment Variables → Edit User PATH → New → Add the path above. Then restart your terminal.`})}else{let e=Re(),n=N()[e],r=n?n.replace(T(),`~`):`your shell config file`;t.push({issue:`Native installation exists but ~/.local/bin is not in your PATH`,fix:`Run: echo 'export PATH="$HOME/.local/bin:$PATH"' >> ${r} then open a new terminal or run: source ${r}`})}}a(process.env.DISABLE_INSTALLATION_CHECKS)||(e===`npm-local`&&n.installMethod!==`local`&&t.push({issue:`Running from local installation but config install method is '${n.installMethod}'`,fix:`Consider using native installation: claude install`}),e===`native`&&n.installMethod!==`native`&&t.push({issue:`Running native installation but config install method is '${n.installMethod}'`,fix:`Run claude install to update configuration`})),e===`npm-global`&&await Le()&&t.push({issue:`Local installation exists but not being used`,fix:`Consider using native installation: claude install`});let r=await P(),i=await He();return e===`npm-local`&&!await ye(`claude`)&&!i&&(r?t.push({issue:`Local installation not accessible`,fix:`Alias exists but points to invalid target: ${r}. Update alias: alias claude="~/.workmate/local/claude"`}):t.push({issue:`Local installation not accessible`,fix:`Create alias: alias claude="~/.workmate/local/claude"`})),t}function tt(){if(C()!==`linux`)return[];let e=[],t=oe.getLinuxGlobPatternWarnings();if(t.length>0){let n=t.slice(0,3).join(`, `),r=t.length-3,i=r>0?`${n} (${r} more)`:n;e.push({issue:`Glob patterns in sandbox permission rules are not fully supported on Linux`,fix:`Found ${t.length} pattern(s): ${i}. On Linux, glob patterns in Edit/Read rules will be ignored.`})}return e}async function nt(){let e=await Xe(),t=typeof MACRO<`u`?`0.0.29`:`unknown`,n=await Ze(),r=Qe(),i=await $e(),a=await et(e);if(a.push(...tt()),e===`native`){let e=i.filter(e=>e.type===`npm-global`||e.type===`npm-global-orphan`||e.type===`npm-local`),t=C()===`windows`;for(let n of e)n.type===`npm-global`?a.push({issue:`Leftover npm global installation at ${n.path}`,fix:`Run: npm -g uninstall @readmagic/workmate`}):n.type===`npm-global-orphan`?a.push({issue:`Orphaned npm global package at ${n.path}`,fix:t?`Run: rmdir /s /q "${n.path}"`:`Run: rm -rf ${n.path}`}):n.type===`npm-local`&&a.push({issue:`Leftover npm local installation at ${n.path}`,fix:t?`Run: rmdir /s /q "${n.path}"`:`Run: rm -rf ${n.path}`})}let o=v().installMethod||`not set`,s=null;e===`npm-global`&&(s=(await Ke()).hasPermissions,!s&&!_()&&a.push({issue:`Insufficient permissions for auto-updates`,fix:"Do one of: (1) Re-install node without sudo, or (2) Use `claude install` for native installation"}));let c=Ee(),l={working:c.working??!0,mode:c.mode,systemPath:c.mode===`system`?c.path:null,note:c.note??null},ee=e===`package-manager`?await qe():void 0;return{installationType:e,version:t,installationPath:n,invokedBinary:r,configInstallMethod:o,autoUpdates:(()=>{let e=_();return e?`disabled (${he(e)})`:`enabled`})(),hasUpdatePermissions:s,multipleInstallations:i,warnings:a,packageManager:ee,ripgrepStatus:l}}var rt=e((()=>{ge(),R(),Se(),me(),se(),o(),x(),p(),M(),Je(),be(),Te(),ae(),ne(),c(),I(),g(),xe()}));function Y(e){return{env:e?.env??process.env,home:e?.homedir??process.env.HOME??T()}}function X(e,...t){return e.includes(`/`)&&!e.includes(`\\`)&&!/^[A-Za-z]:/.test(e)?D.join(e,...t):E(e,...t)}function it(e){let{env:t,home:n}=Y(e);return t.XDG_STATE_HOME??X(n,`.local`,`state`)}function at(e){let{env:t,home:n}=Y(e);return t.XDG_CACHE_HOME??X(n,`.cache`)}function ot(e){let{env:t,home:n}=Y(e);return t.XDG_DATA_HOME??X(n,`.local`,`share`)}function st(e){let{home:t}=Y(e);return X(t,`.local`,`bin`)}var ct=e((()=>{}));function lt(){let e=process.env.ENABLE_PID_BASED_VERSION_LOCKING;return a(e)?!0:(r(e),!1)}function Z(e){if(e<=1)return!1;try{return process.kill(e,0),!0}catch{return!1}}function ut(e,t){if(!Z(e))return!1;if(e===process.pid)return!0;try{let n=De(e);if(!n)return!0;let r=n.toLowerCase(),i=t.toLowerCase();return r.includes(`claude`)||r.includes(i)}catch{return!0}}function Q(e){let t=h();try{let n=t.readFileSync(e,{encoding:`utf8`});if(!n||n.trim()===``)return null;let r=ue(n);return typeof r.pid!=`number`||!r.version||!r.execPath?null:r}catch{return null}}function $(e){let t=Q(e);if(!t)return!1;let{pid:n,execPath:r}=t;if(!Z(n))return!1;if(!ut(n,r))return f(`Lock PID ${n} is running but does not appear to be Work Mate - treating as stale`),!1;let i=h();try{let t=i.statSync(e);if(Date.now()-t.mtimeMs>_t&&!Z(n))return!1}catch{}return!0}function dt(e,t){let n=h(),r=`${e}.tmp.${process.pid}.${Date.now()}`;try{de(r,ce(t,null,2),{encoding:`utf8`,flush:!0}),n.renameSync(r,e)}catch(e){try{n.unlinkSync(r)}catch{}throw e}}async function ft(e,t){let n=h(),r=ke(e);if($(t))return f(`Cannot acquire lock for ${r} - held by PID ${Q(t)?.pid}`),null;let i={pid:process.pid,version:r,execPath:process.execPath,acquiredAt:Date.now()};try{return dt(t,i),Q(t)?.pid===process.pid?(f(`Acquired PID lock for ${r} (PID ${process.pid})`),()=>{try{Q(t)?.pid===process.pid&&(n.unlinkSync(t),f(`Released PID lock for ${r}`))}catch(e){f(`Failed to release lock for ${r}: ${e}`)}}):null}catch(e){return f(`Failed to acquire lock for ${r}: ${e}`),null}}async function pt(e,t){let n=await ft(e,t);if(!n)return!1;let r=()=>{try{n()}catch{}};return process.on(`exit`,r),process.on(`SIGINT`,r),process.on(`SIGTERM`,r),!0}async function mt(e,t,n){let r=await ft(e,t);if(!r)return!1;try{return await n(),!0}finally{r()}}function ht(e){let t=h(),n=[];try{let r=t.readdirStringSync(e).filter(e=>e.endsWith(`.lock`));for(let t of r){let r=E(e,t),i=Q(r);i&&n.push({version:i.version,pid:i.pid,isProcessRunning:Z(i.pid),execPath:i.execPath,acquiredAt:new Date(i.acquiredAt),lockFilePath:r})}}catch(e){if(d(e))return n;b(fe(e))}return n}function gt(e){let t=h(),n=0;try{let r=t.readdirStringSync(e).filter(e=>e.endsWith(`.lock`));for(let i of r){let r=E(e,i);try{t.lstatSync(r).isDirectory()?(t.rmSync(r,{recursive:!0,force:!0}),n++,f(`Cleaned up legacy directory lock: ${i}`)):$(r)||(t.unlinkSync(r),n++,f(`Cleaned up stale lock: ${i}`))}catch{}}}catch(e){if(d(e))return 0;b(fe(e))}return n}var _t,vt=e((()=>{m(),o(),u(),p(),Oe(),y(),g(),_t=7200*1e3}));export{Be as C,M as E,I as S,Re as T,Ue as _,$ as a,ze as b,mt as c,ot as d,it as f,rt as g,nt as h,vt as i,st as l,Xe as m,gt as n,lt as o,ct as p,ht as r,Q as s,pt as t,at as u,R as v,Ve as w,N as x,We as y};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{I as t,P as n,t as r}from"./src-BX54x08P.js";import{t as i}from"./jsx-runtime-Bb4Xn-E0.js";import{Pt as a,kt as o}from"./state-CXY-q5gr.js";import{D as s,Mg as c,aw as l,b as u,cw as d,iw as f,kg as p}from"./loadAgentsDir-uuZYOgKn.js";import{a as m,i as h,r as g,t as _}from"./promptEditor-14TB3MYt.js";import{r as v,t as y}from"./staticRender-Bt82RvGc.js";function b({planContent:e,planPath:r,editorName:i}){return(0,S.jsxs)(t,{flexDirection:`column`,children:[(0,S.jsx)(n,{bold:!0,children:`Current Plan`}),(0,S.jsx)(n,{dimColor:!0,children:r}),(0,S.jsx)(t,{marginTop:1,children:(0,S.jsx)(n,{children:e})}),i&&(0,S.jsxs)(t,{marginTop:1,children:[(0,S.jsx)(n,{dimColor:!0,children:`"/plan open"`}),(0,S.jsx)(n,{dimColor:!0,children:` to edit this plan in `}),(0,S.jsx)(n,{bold:!0,dimColor:!0,children:i})]})]})}async function x(e,t,n){let{getAppState:r,setAppState:i}=t,a=r().toolPermissionContext.mode;if(a!==`plan`){o(a,`plan`),i(e=>({...e,toolPermissionContext:p(s(e.toolPermissionContext),{type:`setMode`,mode:`plan`,destination:`session`})}));let t=n.trim();return t&&t!==`open`?e(`Enabled plan mode`,{shouldQuery:!0}):e(`Enabled plan mode`),null}let c=f(),u=l();if(!c)return e(`Already in plan mode. No plan written yet.`),null;if(n.trim().split(/\s+/)[0]===`open`){let t=await _(u);return t.error?e(`Failed to open plan in editor: ${t.error}`):e(`Opened plan in editor: ${u}`),null}return e(await v((0,S.jsx)(b,{planContent:c,planPath:u,editorName:h()??void 0}))),null}var S;e((()=>{a(),r(),m(),c(),u(),d(),g(),y(),S=i()}))();export{x as call};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{I as t,P as n,t as r}from"./src-BX54x08P.js";import{t as i}from"./jsx-runtime-Bb4Xn-E0.js";import{Pt as a,kt as o}from"./state-CXY-q5gr.js";import{D as s,Pg as c,b as l,jg as u,ow as d,sw as f,uw as p}from"./loadAgentsDir-BfLCckVj.js";import{a as m,i as h,r as g,t as _}from"./promptEditor-14TB3MYt.js";import{r as v,t as y}from"./staticRender-Bt82RvGc.js";function b({planContent:e,planPath:r,editorName:i}){return(0,S.jsxs)(t,{flexDirection:`column`,children:[(0,S.jsx)(n,{bold:!0,children:`Current Plan`}),(0,S.jsx)(n,{dimColor:!0,children:r}),(0,S.jsx)(t,{marginTop:1,children:(0,S.jsx)(n,{children:e})}),i&&(0,S.jsxs)(t,{marginTop:1,children:[(0,S.jsx)(n,{dimColor:!0,children:`"/plan open"`}),(0,S.jsx)(n,{dimColor:!0,children:` to edit this plan in `}),(0,S.jsx)(n,{bold:!0,dimColor:!0,children:i})]})]})}async function x(e,t,n){let{getAppState:r,setAppState:i}=t,a=r().toolPermissionContext.mode;if(a!==`plan`){o(a,`plan`),i(e=>({...e,toolPermissionContext:u(s(e.toolPermissionContext),{type:`setMode`,mode:`plan`,destination:`session`})}));let t=n.trim();return t&&t!==`open`?e(`Enabled plan mode`,{shouldQuery:!0}):e(`Enabled plan mode`),null}let c=d(),l=f();if(!c)return e(`Already in plan mode. No plan written yet.`),null;if(n.trim().split(/\s+/)[0]===`open`){let t=await _(l);return t.error?e(`Failed to open plan in editor: ${t.error}`):e(`Opened plan in editor: ${l}`),null}return e(await v((0,S.jsx)(b,{planContent:c,planPath:l,editorName:h()??void 0}))),null}var S;e((()=>{a(),r(),m(),c(),l(),p(),g(),y(),S=i()}))();export{x as call};
@@ -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-QyzA_cFM.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-BX54x08P.js";import{t as C}from"./jsx-runtime-Bb4Xn-E0.js";import{$n as w,Qn as ne,d as re,gt as T,m as E,s as D,y as O,yt as ie}from"./settings-D4M13toi.js";import{$m as ae,Ao as k,Do as A,Dx as j,Eo as oe,Fo as M,Fx as N,Ha as P,Hh as F,Ia as se,Ja as ce,La as le,Mo as ue,Mx as de,Oo as fe,Po as pe,Px as I,Qd as me,Qm as he,Su as ge,To as _e,Tx as ve,Ua as ye,Vh as be,Wh as L,Za as R,Zm as xe,_d as Se,ah as Ce,bo as we,cx as Te,dx as Ee,eh as De,eo as z,fo as Oe,fx as ke,gd as B,go as V,ih as Ae,jx as je,ko as Me,lb as Ne,lo as Pe,nh as Fe,oo as Ie,po as Le,qa as Re,rb as ze,rh as Be,ro as Ve,tf as He,th as Ue,to as We,vf as Ge,vo as Ke,wo as qe,xo as Je,xu as Ye,xx as Xe,yf as Ze}from"./loadAgentsDir-BfLCckVj.js";import{I as Qe,M as $e,S as et,V as tt,c as nt,i as rt,x as it}from"./debug-2pVES-2G.js";import{d as at,g as ot}from"./config-Bio2EjUK.js";import{o as st,s as ct}from"./log-L1kqxa_P.js";import{n as lt}from"./analytics-COpjZpvd.js";import{S as ut,v as dt}from"./startupProfiler-B9Qv2QGH.js";import{l as H,o as ft}from"./stringUtils-Cs6E5f-B.js";import{n as pt,t as mt}from"./pluginStartupCheck-DGDl1WOZ.js";import{a as ht,d as gt,f as _t,i as vt,l as yt,o as bt,s as xt,u as St}from"./pluginOperations-orq3bOCp.js";import{a as Ct,c as wt,i as Tt,n as Et,o as Dt,s as Ot,t as kt}from"./validatePlugin-BwcC_Wbr.js";import{a as At,n as jt,o as Mt,r as Nt}from"./pluginFlagging-CRuX6sHR.js";import{i as Pt,n as Ft}from"./MCPConnectionManager-D-qpUJLV.js";import{n as It,t as Lt}from"./useExitOnCtrlCDWithKeybindings-ClrtNKJ6.js";import{n as Rt,t as zt}from"./TextInput-BVEWdRz9.js";import{r as Bt,t as Vt}from"./Spinner-BgjmQLjw.js";import{t as Ht}from"./SearchBox-zA5QwIpO.js";import{n as Ut,t as Wt}from"./useSearchInput-BZhTzjgN.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-DtHRw4jQ.js";import{i as $t,n as en}from"./pluginAutoupdate-D5XyiZrP.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 Ct(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 Ie(n,e=>{y(e)});we(e,{source:t}),pe(),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=tt(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)(zt,{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)(B,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]})})})]})}var an,U,on=e((()=>{an=t(h(),1),lt(),Se(),S(),Bt(),Rt(),Qe(),st(),M(),Oe(),Tt(),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(),ze(),r(),un=C()}));async function fn(e){let{enabled:t,disabled:n}=await le();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=xe(e);Object.keys(r).length>0&&n.push({key:`top-level`,title:`Configure ${e.name}`,subtitle:`Plugin options`,schema:r,load:()=>ae(t),save:n=>De(t,n,e.manifest.userConfig)});let i=Ge(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=>Ce(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`,$e(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),Qe(),Ue(),Ze(),se(),he(),dn(),hn=C()}));function _n(){let e=Me();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(),k(),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)(B,{action:`plugin:install`,context:`Plugin`,fallback:`i`,description:`install`,bold:!0}),(0,Cn.jsx)(B,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,Cn.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,Cn.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})}var Cn,wn=e((()=>{Se(),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),[w,re]=(0,W.useState)(null),[T,E]=(0,W.useState)(0),[D,O]=(0,W.useState)(new Set),[ie,ae]=(0,W.useState)(new Set),k=Tn({totalItems:S.length,selectedIndex:T}),[j,M]=(0,W.useState)(0),[N,P]=(0,W.useState)(!1),[F,se]=(0,W.useState)(null),[le,de]=(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),O(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 Le(),{marketplaces:n,failures:r}=await ue(e),i=[];for(let{name:e,config:t,data:r}of n)if(r){let n=ne(r.plugins,t=>We(qe(t.name,e)));i.push({name:e,totalPlugins:r.plugins.length,installedCount:n,source:fe(t.source)})}i.sort((e,t)=>e.name===`claude-plugin-directory`?-1:+(t.name===`claude-plugin-directory`)),x(i);let a=A(r,ne(n,e=>e.data!==null));if(a)if(a.type===`warning`)de(`${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 Pe(t);if(e){let i=e.plugins.find(e=>e.name===l);if(i){let e=qe(i.name,t);n={entry:i,marketplaceName:t,pluginId:e,isInstalled:z(e)},r=t;break}}}if(n&&r){let e=n.pluginId;z(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 Pe(n);if(e)return;if(!t)throw Error(`Failed to load marketplace: ${n}`);let r=[];for(let e of t.plugins){let t=qe(e.name,n);ce(t)||r.push({entry:e,marketplaceName:n,pluginId:t,isInstalled:z(t)})}try{let t=await Ot();if(e)return;re(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;nt(`Failed to fetch install counts: ${$e(t)}`),r.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}ee(r),E(0),O(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 I=async()=>{if(D.size===0)return;let e=S.filter(e=>D.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 ye({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),O(new Set),pe(),a===0?r(`✓ Installed ${n} ${H(n,`plugin`)}. Run /reload-plugins to activate.`):n===0?t(`Failed to install: ${oe(s,!0)}`):r(`✓ Installed ${n} of ${n+a} plugins. Failed: ${oe(s,!1)}. Run /reload-plugins to activate successfully installed plugins.`),n>0&&o&&await o(),i({type:`menu`})},me=async(e,t=`user`)=>{P(!0),se(null);let n=await ye({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),se(n.error)};(0,W.useEffect)(()=>{e&&r(e)},[e,r]),c({"select:previous":()=>{T>0&&E(T-1)},"select:next":()=>{T<b.length-1&&E(T+1)},"select:accept":()=>{let e=b[T];e&&(_(e.name),h(`plugin-list`))}},{context:`Select`,isActive:m===`marketplace-list`}),c({"select:previous":()=>{T>0&&k.handleSelectionChange(T-1,E)},"select:next":()=>{T<S.length-1&&k.handleSelectionChange(T+1,E)},"select:accept":()=>{if(T===S.length&&D.size>0)I();else if(T<S.length){let e=S[T];e&&(e.isInstalled?i({type:`manage-plugins`,targetPlugin:e.entry.name,targetMarketplace:e.marketplaceName}):(y(e),h(`plugin-details`),M(0),se(null)))}}},{context:`Select`,isActive:m===`plugin-list`}),c({"plugin:toggle":()=>{if(T<S.length){let e=S[T];if(e&&!e.isInstalled){let t=new Set(D);t.has(e.pluginId)?t.delete(e.pluginId):t.add(e.pluginId),O(t)}}},"plugin:install":()=>{D.size>0&&I()}},{context:`Plugin`,isActive:m===`plugin-list`});let he=An.useMemo(()=>{if(!v)return[];let e=v.entry.homepage;return xn(e,bn(v))},[v]);if(c({"select:previous":()=>{j>0&&M(j-1)},"select:next":()=>{j<he.length-1&&M(j+1)},"select:accept":()=>{if(!v)return;let e=he[j]?.action,t=v.entry.homepage,n=bn(v);e===`install-user`?me(v,`user`):e===`install-project`?me(v,`project`):e===`install-local`?me(v,`local`):e===`homepage`&&t?ge(t):e===`github`&&n?ge(`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)(B,{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`})}),le&&(0,G.jsx)(u,{marginBottom:1,flexDirection:`column`,children:(0,G.jsxs)(d,{color:`warning`,children:[a.warning,` `,le]})}),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:T===t?`suggestion`:void 0,children:[T===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)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,G.jsx)(B,{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,{}),F&&(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsxs)(d,{color:`error`,children:[`Error: `,F]})}),(0,G.jsx)(u,{flexDirection:`column`,children:t.map((e,t)=>(0,G.jsxs)(u,{children:[j===t&&(0,G.jsx)(d,{children:`> `}),j!==t&&(0,G.jsx)(d,{children:` `}),(0,G.jsx)(d,{bold:j===t,children:N&&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)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,G.jsx)(B,{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)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})})})]});let _e=k.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`})}),k.scrollPosition.canScrollUp&&(0,G.jsx)(u,{children:(0,G.jsxs)(d,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),_e.map((t,n)=>{let r=k.toActualIndex(n),i=T===r,o=D.has(t.pluginId),s=ie.has(t.pluginId);return(0,G.jsxs)(u,{flexDirection:`column`,marginBottom:n===_e.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)`}),w&&g===`claude-plugins-official`&&(0,G.jsxs)(d,{dimColor:!0,children:[` · `,Dt(w.get(t.pluginId)??0),` installs`]})]})]}),t.entry.description&&(0,G.jsxs)(u,{marginLeft:4,children:[(0,G.jsx)(d,{dimColor:!0,children:ut(t.entry.description,60)}),t.entry.version&&(0,G.jsxs)(d,{dimColor:!0,children:[` · v`,t.entry.version]})]})]},t.pluginId)}),k.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:D.size>0})]})}var An,W,G,jn=e((()=>{i(),An=t(h(),1),W=t(h(),1),Se(),S(),ze(),w(),Ye(),rt(),Qe(),M(),wt(),R(),k(),Oe(),Xe(),P(),Re(),ft(),dt(),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,re]=(0,K.useState)(null),[T,E]=(0,K.useState)(!1),D=(0,K.useCallback)(e=>{E(e),s?.(e)},[s]),{query:O,setQuery:ie,cursorOffset:ae}=Ut({isActive:h===`plugin-list`&&T&&!te,onExit:()=>{D(!1)}}),k=m(),{columns:j}=b(),M=(0,K.useMemo)(()=>{if(!O)return S;let e=O.toLowerCase();return S.filter(t=>t.entry.name.toLowerCase().includes(e)||t.entry.description?.toLowerCase().includes(e)||t.marketplaceName.toLowerCase().includes(e))},[S,O]),[N,P]=(0,K.useState)(0),[F,se]=(0,K.useState)(new Set),[le,de]=(0,K.useState)(new Set),fe=Tn({totalItems:M.length,selectedIndex:N});(0,K.useEffect)(()=>{P(0)},[O]);let[I,me]=(0,K.useState)(0),[he,ve]=(0,K.useState)(!1),[be,L]=(0,K.useState)(null),[R,xe]=(0,K.useState)(null),[Se,Ce]=(0,K.useState)(null);(0,K.useEffect)(()=>{async function e(){try{let e=await Le(),{marketplaces:n,failures:r}=await ue(e),i=[];for(let{name:e,data:t}of n)if(t)for(let n of t.plugins){let t=qe(n.name,e);i.push({entry:n,marketplaceName:e,pluginId:t,isInstalled:z(t)})}let a=i.filter(e=>!e.isInstalled&&!ce(e.pluginId));try{let e=await Ot();re(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){nt(`Failed to fetch install counts: ${$e(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 _e({configuredMarketplaceCount:o,failedMarketplaceCount:r.length});Ce(e)}let s=A(r,ne(n,e=>e.data!==null));if(s)if(s.type===`warning`)xe(`${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 we=async()=>{if(F.size===0)return;let e=S.filter(e=>F.has(e.pluginId));de(new Set(e.map(e=>e.pluginId)));let n=0,a=0,s=[];for(let t of e){let e=await ye({pluginId:t.pluginId,entry:t.entry,marketplaceName:t.marketplaceName,scope:`user`});e.success?n++:(a++,s.push({name:t.entry.name,reason:e.error}))}de(new Set),se(new Set),pe(),a===0?r(`✓ Installed ${n} ${H(n,`plugin`)}. Run /reload-plugins to activate.`):n===0?t(`Failed to install: ${oe(s,!0)}`):r(`✓ Installed ${n} of ${n+a} plugins. Failed: ${oe(s,!1)}. Run /reload-plugins to activate successfully installed plugins.`),n>0&&o&&await o(),i({type:`menu`})},Te=async(e,t=`user`)=>{ve(!0),L(null);let n=await ye({pluginId:e.pluginId,entry:e.entry,marketplaceName:e.marketplaceName,scope:t});if(n.success){let t=await fn(e.pluginId);if(t){ve(!1),_({type:`plugin-options`,plugin:t,pluginId:e.pluginId});return}r(n.message),o&&await o(),i({type:`menu`})}else ve(!1),L(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`&&!T}),g((e,t)=>{let n=!t.ctrl&&!t.meta;T||(e===`/`&&n?(D(!0),ie(``)):n&&e.length>0&&!/^\s+$/.test(e)&&e!==`j`&&e!==`k`&&e!==`i`&&(D(!0),ie(e)))},{isActive:h===`plugin-list`&&!te}),c({"select:previous":()=>{N===0?D(!0):fe.handleSelectionChange(N-1,P)},"select:next":()=>{N<M.length-1&&fe.handleSelectionChange(N+1,P)},"select:accept":()=>{if(N===M.length&&F.size>0)we();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`),me(0),L(null)))}}},{context:`Select`,isActive:h===`plugin-list`&&!T}),c({"plugin:toggle":()=>{if(N<M.length){let e=M[N];if(e&&!e.isInstalled){let t=new Set(F);t.has(e.pluginId)?t.delete(e.pluginId):t.add(e.pluginId),se(t)}}},"plugin:install":()=>{F.size>0&&we()}},{context:`Plugin`,isActive:h===`plugin-list`&&!T});let Ee=Fn.useMemo(()=>{if(!y)return[];let e=y.entry.homepage;return xn(e,bn(y))},[y]);if(c({"select:previous":()=>{I>0&&me(I-1)},"select:next":()=>{I<Ee.length-1&&me(I+1)},"select:accept":()=>{if(!y)return;let e=Ee[I]?.action,t=y.entry.homepage,n=bn(y);e===`install-user`?Te(y,`user`):e===`install-project`?Te(y,`project`):e===`install-local`?Te(y,`local`):e===`homepage`&&t?ge(t):e===`github`&&n?ge(`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,{}),be&&(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsxs)(d,{color:`error`,children:[`Error: `,be]})}),(0,q.jsx)(u,{flexDirection:`column`,children:t.map((e,t)=>(0,q.jsxs)(u,{children:[I===t&&(0,q.jsx)(d,{children:`> `}),I!==t&&(0,q.jsx)(d,{children:` `}),(0,q.jsx)(d,{bold:I===t,children:he&&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)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,q.jsx)(B,{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:Se}),(0,q.jsx)(u,{marginTop:1,children:(0,q.jsx)(d,{dimColor:!0,italic:!0,children:`Esc to go back`})})]});let De=fe.getVisibleItems(M);return(0,q.jsxs)(u,{flexDirection:`column`,children:[(0,q.jsxs)(u,{children:[(0,q.jsx)(d,{bold:!0,children:`Discover plugins`}),fe.needsPagination&&(0,q.jsxs)(d,{dimColor:!0,children:[` `,`(`,fe.scrollPosition.current,`/`,fe.scrollPosition.total,`)`]})]}),(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsx)(v,{query:O,isFocused:T,isTerminalFocused:k,width:j-4,cursorOffset:ae})}),R&&(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsxs)(d,{color:`warning`,children:[a.warning,` `,R]})}),M.length===0&&O&&(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsxs)(d,{dimColor:!0,children:[`No plugins match "`,O,`"`]})}),fe.scrollPosition.canScrollUp&&(0,q.jsx)(u,{children:(0,q.jsxs)(d,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),De.map((t,n)=>{let r=fe.toActualIndex(n),i=N===r,o=F.has(t.pluginId),s=le.has(t.pluginId);return(0,q.jsxs)(u,{flexDirection:`column`,marginBottom:n===De.length-1&&!e?0:1,children:[(0,q.jsxs)(u,{children:[(0,q.jsxs)(d,{color:i&&!T?`suggestion`:void 0,children:[i&&!T?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:[` · `,Dt(w.get(t.pluginId)??0),` installs`]})]})]}),t.entry.description&&(0,q.jsx)(u,{marginLeft:4,children:(0,q.jsx)(d,{dimColor:!0,children:ut(t.entry.description,60)})})]},`${fe.startIndex}-${t.pluginId}`)}),fe.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:F.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)(B,{action:`plugin:install`,context:`Plugin`,fallback:`i`,description:`install`,bold:!0}),(0,q.jsx)(d,{children:`type to search`}),t&&(0,q.jsx)(B,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,q.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,q.jsx)(B,{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),Se(),Ht(),S(),Wt(),Ne(),ze(),w(),Ye(),rt(),Qe(),M(),wt(),R(),k(),Oe(),Xe(),P(),Re(),ft(),dt(),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),[re,T]=(0,zn.useState)(null),[E,ae]=(0,zn.useState)(`list`),[k,j]=(0,zn.useState)(null),[oe,M]=(0,zn.useState)(0),N=(0,zn.useRef)(!1);(0,zn.useEffect)(()=>{async function e(){try{let e=await Le(),{enabled:r,disabled:i}=await le(),a=[...r,...i],{marketplaces:o,failures:c}=await ue(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:fe(t.source),lastUpdated:t.lastUpdated,pluginCount:n?.plugins.length,installedPlugins:r,pendingUpdate:!1,pendingRemove:!1,autoUpdate:ie(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=A(c,ne(o,e=>e.data!==null));if(d)if(d.type===`warning`)te(d.message);else throw Error(d.message);if(s&&!N.current&&!t){N.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(se,100,t)}else t&&(b(e+1),j(t),ae(`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 P=()=>m.some(e=>e.pendingUpdate||e.pendingRemove),F=()=>({updateCount:ne(m,e=>e.pendingUpdate),removeCount:ne(m,e=>e.pendingRemove)}),se=async t=>{let i=t||m,s=E===`details`;S(!0),te(null),w(null),T(null);try{let t=D(`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=qe(t.name,e.name);n[r]=!1}O(`userSettings`,{enabledPlugins:n})}await Ke(e.name),c++,e.name,e.installedPlugins?.length;continue}e.pendingUpdate&&(await V(e.name,e=>{T(e)}),n++,l.add(e.name.toLowerCase()),e.name)}let u=0;l.size>0&&(u=(await $t(l)).length),pe(),o&&await o();let d=await Le(),{enabled:f,disabled:p}=await le(),m=[...f,...p],{marketplaces:g}=await ue(d),_=[];for(let{name:e,config:t,data:n}of g){let r=m.filter(t=>t.source.endsWith(`@${e}`));_.push({name:e,source:fe(t.source),lastUpdated:t.lastUpdated,pluginCount:n?.plugins.length,installedPlugins:r,pendingUpdate:!1,pendingRemove:!1,autoUpdate:ie(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&&j(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=$e(e);te(t),n&&n(t)}finally{S(!1),T(null)}},ce=async()=>{if(!k)return;let e=m.map(e=>e.name===k.name?{...e,pendingRemove:!0}:e);h(e),await se(e)},de=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},I=async e=>{let t=!e.autoUpdate;try{await Je(e.name,t),h(n=>n.map(n=>n.name===e.name?{...n,autoUpdate:t}:n)),j(e=>e&&{...e,autoUpdate:t})}catch(e){te(e instanceof Error?e.message:`Failed to update setting`)}};if(p(`confirm:no`,()=>{ae(`list`),M(0)},{context:`Confirmation`,isActive:!x&&(E===`details`||E===`confirm-remove`)}),p(`confirm:no`,()=>{h(e=>e.map(e=>({...e,pendingUpdate:!1,pendingRemove:!1}))),b(0)},{context:`Confirmation`,isActive:!x&&E===`list`&&P()}),p(`confirm:no`,()=>{e({type:`menu`})},{context:`Confirmation`,isActive:!x&&E===`list`&&!P()}),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(P())se();else{let e=m[t];e&&(j(e),ae(`details`),M(0))}}},{context:`Select`,isActive:!x&&E===`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&&(j(e),ae(`confirm-remove`))}},{isActive:!x&&E===`list`}),c({"select:previous":()=>M(e=>Math.max(0,e-1)),"select:next":()=>{let e=de(k);M(t=>Math.min(e.length-1,t+1))},"select:accept":()=>{if(!k)return;let t=de(k)[oe];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),se(e)}else t?.value===`toggle-auto-update`?I(k):t?.value===`remove`&&ae(`confirm-remove`)}},{context:`Select`,isActive:!x&&E===`details`}),g(e=>{e===`y`||e===`Y`?ce():(e===`n`||e===`N`)&&(ae(`list`),j(null))},{isActive:!x&&E===`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)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,J.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]});if(E===`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(E===`details`&&k){let e=k.pendingUpdate||x,t=de(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…`}),re&&(0,J.jsx)(d,{dimColor:!0,children:re})]}),!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===oe;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)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,J.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]})}let{updateCount:me,removeCount:he}=F();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)})}),P()&&(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`})]}),me>0&&(0,J.jsxs)(d,{children:[`• Update `,me,` `,H(me,`marketplace`)]}),he>0&&(0,J.jsxs)(d,{color:`warning`,children:[`• Remove `,he,` `,H(he,`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:P()})]})}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)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`apply changes`}),!t&&(0,J.jsx)(B,{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)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:t?`cancel`:`go back`})]})})})}var zn,J,Bn=e((()=>{i(),zn=t(h(),1),lt(),Se(),S(),ze(),w(),at(),Qe(),M(),k(),Oe(),en(),se(),T(),E(),ft(),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 I(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((()=>{N()}));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(),ft(),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 nt(`Failed to read plugin components from ${e}: ${$e(t)}`,{level:`error`}),ct(tt(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 nt(`Failed to read skill directories from ${e}: ${$e(t)}`,{level:`error`}),ct(tt(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=je(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 Pe(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 Pe(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!ce(`${e.name}@${t}`)})}function Zn({setViewState:e,setResult:t,onManageComplete:n,onSearchModeChange:r,targetPlugin:i,targetMarketplace:o,action:s}){let l=F(e=>e.mcp.clients),h=F(e=>e.mcp.tools),_=F(e=>e.plugins.errors),y=jt(),[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:E,setQuery:ie,cursorOffset:k}=Ut({isActive:w===`plugin-list`&&x,onExit:()=>{ee(!1)}}),[A,oe]=(0,X.useState)(null),[M,N]=(0,X.useState)([]),[P,se]=(0,X.useState)([]),[ce,ue]=(0,X.useState)(!0),[de,fe]=(0,X.useState)(new Map),I=(0,X.useRef)(!1),he=(0,X.useRef)(void 0),_e=Pt();p(`confirm:no`,Qn.useCallback(()=>{if(w===`plugin-details`)T(`plugin-list`),oe(null),V(null);else if(typeof w==`object`&&w.type===`failed-plugin-details`)T(`plugin-list`),V(null);else if(w===`configuring`)T(`plugin-details`),Me(null);else if(typeof w==`object`&&(w.type===`plugin-options`||w.type===`configuring-options`))T(`plugin-list`),oe(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`),V(null);else if(typeof w==`object`&&w.type===`mcp-detail`)T(`plugin-list`),V(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(de.size>0){t(`Run /reload-plugins to apply plugin changes.`);return}e({type:`menu`})}},[w,e,de,t]),{context:`Confirmation`,isActive:(w!==`plugin-list`||!x)&&w!==`confirm-project-uninstall`&&!(typeof w==`object`&&w.type===`confirm-data-cleanup`)});let ve=e=>e.type===`connected`?`connected`:e.type===`disabled`?`disabled`:e.type===`pending`?`pending`:e.type===`needs-auth`?`needs-auth`:`failed`,ye=(0,X.useMemo)(()=>{let e=re(),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 P){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:de.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=mt(),s=[];for(let[e,t]of a){if(e in y)continue;let n=j(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:ve(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:ve(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=j(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},[P,l,_,de,y]),be=(0,X.useMemo)(()=>ye.filter(e=>e.type===`flagged-plugin`).map(e=>e.id),[ye]);(0,X.useEffect)(()=>{be.length>0&&At(be)},[be]);let L=(0,X.useMemo)(()=>{if(!E)return ye;let e=E.toLowerCase();return ye.filter(t=>t.name.toLowerCase().includes(e)||`description`in t&&t.description?.toLowerCase().includes(e))},[ye,E]),[R,xe]=(0,X.useState)(0),Se=Tn({totalItems:L.length,selectedIndex:R,maxVisible:8}),[Ce,we]=(0,X.useState)(0),[Ee,z]=(0,X.useState)(!1),[Oe,V]=(0,X.useState)(null),[je,Me]=(0,X.useState)(null),[Ne,Pe]=(0,X.useState)(!1),[Ie,Le]=(0,X.useState)(!1);(0,X.useEffect)(()=>{if(!A){Le(!1);return}async function e(){let e=A.plugin.manifest.mcpServers,t=!1;if(e&&(t=typeof e==`string`&&Fe(e)||Array.isArray(e)&&e.some(e=>typeof e==`string`&&Fe(e))),!t)try{let e=tn.join(A.plugin.path,`..`),n=tn.join(e,`.claude-plugin`,`marketplace.json`),r=et(await nn.readFile(n,`utf-8`)).plugins?.find(e=>e.name===A.plugin.name);if(r?.mcpServers){let e=r.mcpServers;t=typeof e==`string`&&Fe(e)||Array.isArray(e)&&e.some(e=>typeof e==`string`&&Fe(e))}}catch(e){nt(`Failed to read raw marketplace.json: ${e}`)}Le(t)}e()},[A]),(0,X.useEffect)(()=>{async function e(){ue(!0);try{let{enabled:e,disabled:t}=await le(),n=re(),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=ne(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)),N(a);let o=[];for(let e of a)for(let t of e.installedPlugins){let n=`${t.name}@${e.name}`,r=t.isBuiltin?`builtin`:bt(n).scope;o.push({plugin:t,marketplace:e.name,scope:r,pendingEnable:void 0,pendingUpdate:!1})}se(o),xe(0)}finally{ue(!1)}}e()},[]),(0,X.useEffect)(()=>{if(!I.current&&i&&M.length>0&&!ce){let{name:e,marketplace:n}=j(i),r=o??n,a=r?M.filter(e=>e.name===r):M;for(let t of a){let n=t.installedPlugins.find(t=>t.name===e);if(n){let{scope:e}=bt(`${n.name}@${t.name}`),r={plugin:n,marketplace:t.name,scope:e,pendingEnable:void 0,pendingUpdate:!1};oe(r),T(`plugin-details`),he.current=s,I.current=!0;return}}let c=ye.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}}),I.current=!0),!I.current&&s&&(I.current=!0,t(`Plugin "${i}" is not installed in this project`))}},[i,o,M,ce,ye,s,t]);let Re=async r=>{if(!A)return;let i=A.scope||`user`,a=i===`builtin`;if(a&&(r===`update`||r===`uninstall`)){V(`Built-in plugins cannot be updated or uninstalled.`);return}if(!a&&!yt(i)&&r!==`update`){V(`This plugin is managed by your organization. Contact your admin to disable it.`);return}z(!0),V(null);try{let o=`${A.plugin.name}@${A.marketplace}`,s;switch(r){case`enable`:{let e=await ht(o);if(!e.success)throw Error(e.message);break}case`disable`:{let e=await vt(o);if(!e.success)throw Error(e.message);s=e.reverseDependents;break}case`uninstall`:{if(a||!yt(i))break;if(St(o)){z(!1),T(`confirm-project-uninstall`);return}let e=Ve().plugins[o],t=!e||e.length<=1?await Te(o):null;if(t){z(!1),T({type:`confirm-data-cleanup`,size:t});return}let n=await gt(o,i);if(!n.success)throw Error(n.message);s=n.reverseDependents;break}case`update`:{if(a)break;let r=await _t(o,i);if(!r.success)throw Error(r.message);if(r.alreadyUpToDate){t(`${A.plugin.name} is already at the latest version (${r.newVersion}).`),n&&await n(),e({type:`menu`});return}break}}pe();let c=`${A.plugin.name}@${A.marketplace}`;if(re()?.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} ${A.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);V(`Failed to ${r}: ${t}`),ct(tt(e))}},ze=(0,X.useRef)(Re);ze.current=Re,(0,X.useEffect)(()=>{if(w===`plugin-details`&&A&&he.current){let e=he.current;he.current=void 0,ze.current(e)}},[w,A]);let Be=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=re(),r=de.get(t),i=n?.enabledPlugins?.[t]!==!1,a=e.scope;if(a===`builtin`||yt(a)){let e=new Map(de);r?(e.delete(t),(async()=>{try{r===`will-disable`?await ht(t):await vt(t),pe()}catch(e){ct(e)}})()):(e.set(t,i?`will-disable`:`will-enable`),(async()=>{try{i?await vt(t):await ht(t),pe()}catch(e){ct(e)}})()),fe(e)}}else e?.type===`mcp`&&_e(e.client.name)},[R,L,de,P,_e]);c({"select:previous":()=>{R===0?ee(!0):Se.handleSelectionChange(R-1,xe)},"select:next":()=>{R<L.length-1&&Se.handleSelectionChange(R+1,xe)},"select:accept":Qn.useCallback(()=>{if(R>=L.length)return;let e=L[R];if(e?.type===`plugin`){let t=P.find(t=>t.plugin.name===e.plugin.name&&t.marketplace===e.marketplace);t&&(oe(t),T(`plugin-details`),we(0),V(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}}),V(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}}),we(0),V(null)):e?.type===`mcp`&&(T({type:`mcp-detail`,client:e.client}),V(null))},[R,L,P])},{context:`Select`,isActive:w===`plugin-list`&&!x}),c({"plugin:toggle":Be},{context:`Plugin`,isActive:w===`plugin-list`&&!x}),c({"select:accept":Qn.useCallback(()=>{typeof w!=`object`||w.type!==`flagged-detail`||(Mt(w.plugin.id),T(`plugin-list`))},[w])},{context:`Select`,isActive:typeof w==`object`&&w.type===`flagged-detail`});let He=Qn.useMemo(()=>{if(w!==`plugin-details`||!A)return[];let e=re(),t=`${A.plugin.name}@${A.marketplace}`,n=e?.enabledPlugins?.[t]!==!1,r=A.marketplace===`builtin`,i=[];return i.push({label:n?`Disable plugin`:`Enable plugin`,action:()=>void Re(n?`disable`:`enable`)}),r||(i.push({label:A.pendingUpdate?`Unmark for update`:`Mark for update`,action:async()=>{try{let e=await Yn(A.plugin.name,A.marketplace);if(e){V(e);return}let t=[...P],n=t.findIndex(e=>e.plugin.name===A.plugin.name&&e.marketplace===A.marketplace);n!==-1&&(t[n].pendingUpdate=!A.pendingUpdate,se(t),oe({...A,pendingUpdate:!A.pendingUpdate}))}catch(e){V(e instanceof Error?e.message:`Failed to check plugin update availability`)}}}),Ie&&i.push({label:`Configure`,action:async()=>{Pe(!0);try{let e=A.plugin.manifest.mcpServers,t=null;if(typeof e==`string`&&Fe(e))t=e;else if(Array.isArray(e)){for(let n of e)if(typeof n==`string`&&Fe(n)){t=n;break}}if(!t){V(`No MCPB file found in plugin`),Pe(!1);return}let n=`${A.plugin.name}@${A.marketplace}`,r=await Ae(t,A.plugin.path,n,void 0,void 0,!0);`status`in r&&r.status===`needs-config`?(Me(r),T(`configuring`)):V(`Failed to load MCPB for configuration`)}catch(e){let t=$e(e);V(`Failed to load configuration: ${t}`)}finally{Pe(!1)}}}),A.plugin.manifest.userConfig&&Object.keys(A.plugin.manifest.userConfig).length>0&&i.push({label:`Configure options`,action:()=>{T({type:`configuring-options`,schema:A.plugin.manifest.userConfig})}}),i.push({label:`Update now`,action:()=>void Re(`update`)}),i.push({label:`Uninstall`,action:()=>void Re(`uninstall`)})),A.plugin.manifest.homepage&&i.push({label:`Open homepage`,action:()=>void ge(A.plugin.manifest.homepage)}),A.plugin.manifest.repository&&i.push({label:`View repository`,action:()=>void ge(A.plugin.manifest.repository)}),i.push({label:`Back to plugin list`,action:()=>{T(`plugin-list`),oe(null),V(null)}}),i},[w,A,Ie,P]);if(c({"select:previous":()=>{Ce>0&&we(Ce-1)},"select:next":()=>{Ce<He.length-1&&we(Ce+1)},"select:accept":()=>{He[Ce]&&He[Ce].action()}},{context:`Select`,isActive:w===`plugin-details`&&!!A}),c({"select:accept":()=>{typeof w==`object`&&w.type===`failed-plugin-details`&&(async()=>{z(!0),V(null);let e=w.plugin.id,t=w.plugin.scope,r=yt(t)?await gt(e,t,!1):await gt(e,`user`,!1),i=r.success;if(!i){for(let t of[`userSettings`,`projectSettings`,`localSettings`]){let n=D(t);n?.enabledPlugins?.[e]!==void 0&&(O(t,{enabledPlugins:{...n.enabledPlugins,[e]:void 0}}),i=!0)}pe()}i?(n&&await n(),z(!1),T(`plugin-list`)):(z(!1),V(r.message))})()}},{context:`Select`,isActive:typeof w==`object`&&w.type===`failed-plugin-details`&&w.plugin.scope!==`managed`}),c({"confirm:yes":()=>{if(!A)return;z(!0),V(null);let r=`${A.plugin.name}@${A.marketplace}`,{error:i}=O(`localSettings`,{enabledPlugins:{...D(`localSettings`)?.enabledPlugins,[r]:!1}});if(i){z(!1),V(`Failed to write settings: ${i.message}`);return}pe(),t(`✓ Disabled ${A.plugin.name} in .workmate/settings.local.json. Run /reload-plugins to apply.`),n&&n(),e({type:`menu`})},"confirm:no":()=>{T(`plugin-details`),V(null)}},{context:`Confirmation`,isActive:w===`confirm-project-uninstall`&&!!A&&!Ee}),g((r,i)=>{if(!A)return;let o=`${A.plugin.name}@${A.marketplace}`,s=A.scope;if(!s||s===`builtin`||!yt(s))return;let c=async r=>{z(!0),V(null);try{let i=await gt(o,s,r);if(!i.success)throw Error(i.message);pe();let c=r?``:` · data preserved`;t(`${a.tick} ${i.message}${c}`),n&&n(),e({type:`menu`})}catch(e){z(!1),V(e instanceof Error?e.message:String(e))}};r===`y`||r===`Y`?c(!0):r===`n`||r===`N`?c(!1):i.escape&&(T(`plugin-details`),V(null))},{isActive:typeof w==`object`&&w.type===`confirm-data-cleanup`&&!!A&&!Ee}),Qn.useEffect(()=>{xe(0)},[E]),g((e,t)=>{let n=!t.ctrl&&!t.meta;x||(e===`/`&&n?(ee(!0),ie(``),xe(0)):n&&e.length>0&&!/^\s+$/.test(e)&&e!==`j`&&e!==`k`&&e!==` `&&(ee(!0),ie(e),xe(0)))},{isActive:w===`plugin-list`}),ce)return(0,Z.jsx)(d,{children:`Loading installed plugins…`});if(ye.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`&&A){let r=`${A.plugin.name}@${A.marketplace}`;function i(r){t(r),n&&n(),e({type:`menu`})}return(0,Z.jsx)(pn,{plugin:A.plugin,pluginId:r,onDone:(e,t)=>{switch(e){case`configured`:i(`✓ Enabled and configured ${A.plugin.name}. Run /reload-plugins to apply.`);break;case`skipped`:i(`✓ Enabled ${A.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`&&A){let e=`${A.plugin.name}@${A.marketplace}`;return(0,Z.jsx)(cn,{title:`Configure ${A.plugin.name}`,subtitle:`Plugin options`,configSchema:w.schema,initialValues:ae(e),onSave:n=>{try{De(e,n,w.schema),pe(),t(`Configuration saved. Run /reload-plugins for changes to take effect.`)}catch(e){V(`Failed to save configuration: ${$e(e)}`)}T(`plugin-details`)},onCancel:()=>T(`plugin-details`)})}if(w===`configuring`&&je&&A){let e=`${A.plugin.name}@${A.marketplace}`;async function n(n){if(!(!je||!A))try{let r=A.plugin.manifest.mcpServers,i=null;if(typeof r==`string`&&Fe(r))i=r;else if(Array.isArray(r)){for(let e of r)if(typeof e==`string`&&Fe(e)){i=e;break}}if(!i){V(`No MCPB file found`),T(`plugin-details`);return}await Ae(i,A.plugin.path,e,void 0,n),V(null),Me(null),T(`plugin-details`),t(`Configuration saved. Run /reload-plugins for changes to take effect.`)}catch(e){let t=$e(e);V(`Failed to save configuration: ${t}`),T(`plugin-details`)}}function r(){Me(null),T(`plugin-details`)}return(0,Z.jsx)(cn,{title:`Configure ${je.manifest.name}`,subtitle:`Plugin: ${A.plugin.name}`,configSchema:je.configSchema,initialValues:je.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)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`dismiss`}),(0,Z.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})]})}if(w===`confirm-project-uninstall`&&A)return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsxs)(d,{bold:!0,color:`warning`,children:[A.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.`})]}),Oe&&(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{color:`error`,children:Oe})}),(0,Z.jsx)(u,{marginTop:1,children:Ee?(0,Z.jsx)(d,{dimColor:!0,children:`Disabling…`}):(0,Z.jsxs)(f,{children:[(0,Z.jsx)(B,{action:`confirm:yes`,context:`Confirmation`,fallback:`y`,description:`disable`}),(0,Z.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]});if(typeof w==`object`&&w.type===`confirm-data-cleanup`&&A)return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsxs)(d,{bold:!0,children:[A.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:ke(`${A.plugin.name}@${A.marketplace}`)})]}),Oe&&(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{color:`error`,children:Oe})}),(0,Z.jsx)(u,{marginTop:1,children:Ee?(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`&&A){let e=re(),t=`${A.plugin.name}@${A.marketplace}`,n=e?.enabledPlugins?.[t]!==!1,r=_.filter(e=>`plugin`in e&&e.plugin===A.plugin.name||e.source===t||e.source.startsWith(`${A.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:[A.plugin.name,` @ `,A.marketplace]})}),(0,Z.jsxs)(u,{children:[(0,Z.jsx)(d,{dimColor:!0,children:`Scope: `}),(0,Z.jsx)(d,{children:A.scope||`user`})]}),A.plugin.manifest.version&&(0,Z.jsxs)(u,{children:[(0,Z.jsx)(d,{dimColor:!0,children:`Version: `}),(0,Z.jsx)(d,{children:A.plugin.manifest.version})]}),A.plugin.manifest.description&&(0,Z.jsx)(u,{marginBottom:1,children:(0,Z.jsx)(d,{children:A.plugin.manifest.description})}),A.plugin.manifest.author&&(0,Z.jsxs)(u,{children:[(0,Z.jsx)(d,{dimColor:!0,children:`Author: `}),(0,Z.jsx)(d,{children:A.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`}),A.pendingUpdate&&(0,Z.jsx)(d,{color:`suggestion`,children:` · Marked for update`})]}),(0,Z.jsx)(Jn,{plugin:A.plugin,marketplace:A.marketplace}),i,(0,Z.jsx)(u,{marginTop:1,flexDirection:`column`,children:He.map((e,t)=>{let n=t===Ce;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)})}),Ee&&(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{children:`Processing…`})}),Oe&&(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{color:`error`,children:Oe})}),(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(f,{children:[(0,Z.jsx)(B,{action:`select:previous`,context:`Select`,fallback:`↑`,description:`navigate`}),(0,Z.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,Z.jsx)(B,{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`})]}),Ee&&(0,Z.jsx)(d,{children:`Processing…`}),Oe&&(0,Z.jsx)(d,{color:`error`,children:Oe}),(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)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`remove`}),(0,Z.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(typeof w==`object`&&w.type===`mcp-detail`){let e=w.client,n=me(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 Ue=Se.getVisibleItems(L);return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsx)(u,{marginBottom:1,children:(0,Z.jsx)(v,{query:E,isFocused:x,isTerminalFocused:te,width:C-4,cursorOffset:k})}),L.length===0&&E&&(0,Z.jsx)(u,{marginBottom:1,children:(0,Z.jsxs)(d,{dimColor:!0,children:[`No items match "`,E,`"`]})}),Se.scrollPosition.canScrollUp&&(0,Z.jsx)(u,{children:(0,Z.jsxs)(d,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),Ue.map((e,t)=>{let n=Se.toActualIndex(t)===R&&!x,r=t>0?Ue[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)}),Se.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)(B,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,Z.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,Z.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})}),de.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),Se(),S(),Kt(),Yt(),qt(),Jt(),Ht(),Wt(),Ne(),ze(),de(),Ft(),He(),xt(),be(),w(),Ye(),rt(),Qe(),st(),M(),R(),Oe(),Ue(),Ee(),Nt(),ve(),se(),he(),Re(),pt(),E(),it(),ft(),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 Et(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: ${$e(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(),Qe(),st(),kt(),ft(),ir=C()}));function or({onComplete:e}){return(0,Q.useEffect)(()=>{async function t(){try{let t=await Le(),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: ${$e(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`}])D(n)?.extraKnownMarketplaces?.[e]&&t.push({source:n,scope:r});return{editableSources:t,isInPolicy:!!D(`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=D(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&&O(n,r)}}function mr({setViewState:e,setActiveTab:t,markPluginsChanged:n}){let r=F(e=>e.plugins.errors),i=F(e=>e.plugins.installationStatus),o=L(),[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 ue(await Le());_(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,mt());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),pe(),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 Ke(i.name),pe(),_(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)(B,{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)(B,{action:`select:previous`,context:`Select`,fallback:`↑`,description:`navigate`}),te&&(0,$.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`resolve`}),(0,$.jsx)(B,{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=L(),C=F(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`,ne=It(),re=n.type===`marketplace`&&n.action===`add`&&n.target!==void 0,T=(0,Q.useCallback)(()=>{te(e=>e.plugins.needsRefresh?e:{...e,plugins:{...e.plugins,needsRefresh:!0}})},[te]),E=(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:T,cliMode:re}):(0,$.jsx)(ee,{color:`suggestion`,children:(0,$.jsxs)(x,{title:`Plugins`,selectedTab:o,onTabChange:E,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:T,targetMarketplace:i.targetMarketplace,targetPlugin:i.targetPlugin}):(0,$.jsx)(Mn,{error:h,setError:g,result:_,setResult:v,setViewState:a,onInstallComplete:T,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:T,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:ne,onManageComplete:T,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:T})})]})})}var Q,$,vr,yr=e((()=>{i(),Q=t(h(),1),Se(),S(),Lt(),ze(),be(),Qe(),M(),k(),Oe(),pt(),E(),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{gt as t,yt as n}from"./settings-D4M13toi.js";import{Cx as r,Tx as i,Ya as a,Za as o,do as s,eo as c,mo as l,oo as u,uo as d}from"./loadAgentsDir-uuZYOgKn.js";import{I as f,M as p,c as m,i as h}from"./debug-2pVES-2G.js";import{d as g,g as _}from"./config-BDn2YIjC.js";import{o as v,s as y}from"./log-L1kqxa_P.js";import{f as b,s as x}from"./pluginOperations-Ca_T-HYn.js";function S(e){return O=e,k!==null&&k.length>0&&(e(k),k=null),()=>{O=null}}async function C(){let e=await s(),t=u(),r=new Set;for(let[i,a]of Object.entries(e)){let e=t[i]?.autoUpdate;(e===void 0?n(i,a):e)&&r.add(i.toLowerCase())}return r}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,m(`Plugin autoupdate: updated ${e} from ${t.oldVersion} to ${t.newVersion}`)):t.alreadyUpToDate||m(`Plugin autoupdate: failed to update ${e}: ${t.message}`,{level:`warn`})}catch(t){m(`Plugin autoupdate: error updating ${e}: ${p(t)}`,{level:`warn`})}return n?e:null}async function T(e){let t=c(),n=Object.keys(t.plugins);return n.length===0?[]:(await Promise.allSettled(n.map(async n=>{let{marketplace:r}=i(n);if(!r||!e.has(r.toLowerCase()))return null;let a=t.plugins[n];if(!a||a.length===0)return null;let s=a.filter(o);return s.length===0?null:w(n,s)}))).filter(e=>e.status===`fulfilled`&&e.value!==null).map(e=>e.value)}async function E(e){return T(e)}function D(){(async()=>{if(_()){m(`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 l(e,void 0,{disableCredentialHelper:!0})}catch(t){m(`Plugin autoupdate: failed to refresh marketplace ${e}: ${p(t)}`,{level:`warn`})}}))).filter(e=>e.status===`rejected`);t.length>0&&m(`Plugin autoupdate: ${t.length} marketplace refresh(es) failed`,{level:`warn`}),m(`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(),h(),f(),v(),a(),d(),r(),t(),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{gt as t,yt as n}from"./settings-D4M13toi.js";import{$a as r,Dx as i,Tx as a,Za as o,co as s,fo as c,go as l,no as u,po as d}from"./loadAgentsDir-BfLCckVj.js";import{I as f,M as p,c as m,i as h}from"./debug-2pVES-2G.js";import{d as g,g as _}from"./config-Bio2EjUK.js";import{o as v,s as y}from"./log-L1kqxa_P.js";import{f as b,s as x}from"./pluginOperations-orq3bOCp.js";function S(e){return O=e,k!==null&&k.length>0&&(e(k),k=null),()=>{O=null}}async function C(){let e=await d(),t=s(),r=new Set;for(let[i,a]of Object.entries(e)){let e=t[i]?.autoUpdate;(e===void 0?n(i,a):e)&&r.add(i.toLowerCase())}return r}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,m(`Plugin autoupdate: updated ${e} from ${t.oldVersion} to ${t.newVersion}`)):t.alreadyUpToDate||m(`Plugin autoupdate: failed to update ${e}: ${t.message}`,{level:`warn`})}catch(t){m(`Plugin autoupdate: error updating ${e}: ${p(t)}`,{level:`warn`})}return n?e:null}async function T(e){let t=u(),n=Object.keys(t.plugins);return n.length===0?[]:(await Promise.allSettled(n.map(async n=>{let{marketplace:a}=i(n);if(!a||!e.has(a.toLowerCase()))return null;let o=t.plugins[n];if(!o||o.length===0)return null;let s=o.filter(r);return s.length===0?null:w(n,s)}))).filter(e=>e.status===`fulfilled`&&e.value!==null).map(e=>e.value)}async function E(e){return T(e)}function D(){(async()=>{if(_()){m(`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 l(e,void 0,{disableCredentialHelper:!0})}catch(t){m(`Plugin autoupdate: failed to refresh marketplace ${e}: ${p(t)}`,{level:`warn`})}}))).filter(e=>e.status===`rejected`);t.length>0&&m(`Plugin autoupdate: ${t.length} marketplace refresh(es) failed`,{level:`warn`}),m(`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(),h(),f(),v(),o(),c(),a(),t(),O=null,k=null}));export{T as i,A as n,S as r,D as t};
@@ -0,0 +1 @@
1
+ import{Za as e,fo as t,lo as n,mo as r,ro as i}from"./loadAgentsDir-BfLCckVj.js";import{I as a,M as o,c as s,i as c}from"./debug-2pVES-2G.js";import{d as l,s as u}from"./pluginOperations-orq3bOCp.js";import{i as d,n as f,r as p,t as m}from"./pluginFlagging-CRuX6sHR.js";u(),c(),a(),e(),t(),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=i(),t=f(),a=await r(),c=[];for(let r of Object.keys(a))try{let i=await n(r);if(!i.forceRemoveDeletedPlugins)continue;let a=h(e,i,r);for(let n of a){if(n in t)continue;let r=e.plugins[n]??[];if(r.some(e=>e.scope===`user`||e.scope===`project`||e.scope===`local`)){for(let e of r){let{scope:t}=e;if(!(t!==`user`&&t!==`project`&&t!==`local`))try{await l(n,t)}catch(e){s(`Failed to auto-uninstall delisted plugin ${n} from ${t}: ${o(e)}`,{level:`error`})}}await m(n),c.push(n)}}}catch(e){s(`Failed to check for delisted plugins in "${r}": ${o(e)}`,{level:`warn`})}return c}export{g as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./figures-5ThXQEtq.js";import{Dx as n,Tx as r,Xa as i,Ya as a,au as o,gi as s,ou as c,su as l,vi as u}from"./loadAgentsDir-BfLCckVj.js";import{I as d,M as f}from"./debug-2pVES-2G.js";import{n as p,o as m}from"./process-gEbdy6uY.js";import{o as h,s as g}from"./log-L1kqxa_P.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-orq3bOCp.js";e(),d(),u(),h(),i(),r(),p(),l(),_(),w();function T(e,r,i){g(e);let s=i?`${r} plugin "${i}"`:r===`disable-all`?`disable all plugins`:`${r} plugins`;console.error(`${t.cross} Failed to ${s}: ${f(e)}`);let l=i?(()=>{let{name:e,marketplace:t}=n(i);return{_PROTO_plugin_name:e,...t&&{_PROTO_marketplace_name:t},...o(e,t,a())}})():{};c(e),{...l},process.exit(1)}async function E(e,r=`user`){try{console.log(`Installing plugin "${e}"...`);let i=await y(e,r);if(!i.success)throw Error(i.message);console.log(`${t.tick} ${i.message}`);let{name:s,marketplace:c}=n(i.pluginId||e);({...c&&{_PROTO_marketplace_name:c}}),i.scope,{...o(s,c,a())},process.exit(0)}catch(t){T(t,`install`,e)}}async function D(e,r=`user`,i=!1){try{let s=await b(e,r,!i);if(!s.success)throw Error(s.message);console.log(`${t.tick} ${s.message}`);let{name:c,marketplace:l}=n(s.pluginId||e);({...l&&{_PROTO_marketplace_name:l}}),s.scope,{...o(c,l,a())},process.exit(0)}catch(t){T(t,`uninstall`,e)}}async function O(e,r){try{let i=await v(e,r);if(!i.success)throw Error(i.message);console.log(`${t.tick} ${i.message}`);let{name:s,marketplace:c}=n(i.pluginId||e);({...c&&{_PROTO_marketplace_name:c}}),i.scope,{...o(s,c,a())},process.exit(0)}catch(t){T(t,`enable`,e)}}async function k(e,r){try{let i=await S(e,r);if(!i.success)throw Error(i.message);console.log(`${t.tick} ${i.message}`);let{name:s,marketplace:c}=n(i.pluginId||e);({...c&&{_PROTO_marketplace_name:c}}),i.scope,{...o(s,c,a())},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,r){try{m(`Checking for updates for plugin "${e}" at ${r} scope…\n`);let i=await x(e,r);if(!i.success)throw Error(i.message);if(m(`${t.tick} ${i.message}\n`),!i.alreadyUpToDate){let{name:t,marketplace:r}=n(i.pluginId||e);({...r&&{_PROTO_marketplace_name:r}}),i.oldVersion,i.newVersion,{...o(t,r,a())}}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,lx as n}from"./loadAgentsDir-uuZYOgKn.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-2pVES-2G.js";import{o as u,s as d}from"./log-L1kqxa_P.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};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{dx as t,ux as n}from"./loadAgentsDir-BfLCckVj.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-2pVES-2G.js";import{o as u,s as d}from"./log-L1kqxa_P.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};
@@ -0,0 +1,2 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{m as t,s as n,y as r}from"./settings-D4M13toi.js";import{Pt as i,q as a}from"./state-CXY-q5gr.js";import{Cx as o,Dx as s,Fa as c,Fo as l,Ga as u,Ha as d,Ia as f,Io as p,Ja as m,Ka as h,La as g,Mx as _,Na as v,Nx as y,Ox as b,Pa as x,Po as S,Qm as C,Sx as w,Tx as T,Va as E,Wa as D,Xm as O,Za as ee,ao as te,do as k,dx as A,fo as j,io as ne,ja as re,lo as ie,no as M,po as ae,qa as oe,ro as N,sx as se,wx as ce,za as P}from"./loadAgentsDir-BfLCckVj.js";import{I as F,R as I,V as L,f as R,u as z}from"./debug-2pVES-2G.js";import{o as B,s as V}from"./log-L1kqxa_P.js";import{l as H,o as U}from"./stringUtils-Cs6E5f-B.js";import{n as W,t as G}from"./pluginStartupCheck-DGDl1WOZ.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`?a():void 0}function de(e){return n(`projectSettings`)?.enabledPlugins?.[e]===!0}function fe(e){let t=e.includes(`@`);for(let r of[`local`,`project`,`user`]){let i=n(b(r))?.enabledPlugins;if(i){for(let n of Object.keys(i))if(t?n===e:n.startsWith(`${e}@`))return{pluginId:n,scope:r}}}return null}function pe(e,t){let{name:n,marketplace:r}=s(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}=s(e),n=N();if(n.plugins[e]?.length)return{pluginId:e,pluginName:t};let r=Object.keys(n.plugins).find(e=>{let{name:r}=s(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 n=a(),r=t.find(e=>e.scope===`local`&&e.projectPath===n);if(r)return{scope:r.scope,projectPath:r.projectPath};let i=t.find(e=>e.scope===`project`&&e.projectPath===n);if(i)return{scope:i.scope,projectPath:i.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}=s(e),i,a,o;if(r){let t=await k(e);t&&(i=t.entry,a=r,o=t.marketplaceInstallLocation)}else{let e=await ae();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(L(e))}}if(!i||!a)return{success:!1,message:`Plugin "${n}" not found in ${r?`marketplace "${r}"`:`any configured marketplace`}`};let c=i,l=`${c.name}@${a}`,u=await D({pluginId:l,entry:c,scope:t,marketplaceInstallLocation:o});if(!u.ok){let e=u;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:E(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: ${l} (scope: ${t})${u.depNote}`,pluginId:l,pluginName:c.name,scope:t}}async function ge(e,t=`user`,i=!0){q(t);let{enabled:a,disabled:s}=await g(),c=[...a,...s],l=pe(e,c),u=b(t),d=n(u),f,m;if(l)f=Object.keys(d?.enabledPlugins??{}).find(t=>t===e||t===l.name||t.startsWith(`${l.name}@`))??(e.includes(`@`)?e:l.name),m=l.name;else{let t=me(e);if(!t)return{success:!1,message:`Plugin "${e}" not found in installed plugins`};f=t.pluginId,m=t.pluginName}let h=J(t),_=N().plugins[f],v=_?.find(e=>e.scope===t&&e.projectPath===h);if(!v){let{scope:n}=Y(f);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={...d?.enabledPlugins};x[f]=void 0,r(u,{enabledPlugins:x}),S(),ne(f,t,h);let C=N().plugins[f],T=!C||C.length===0;T&&y&&await p(y),T&&(O(f),i&&await se(f));let E=w(f,c),D=o(E);return{success:!0,message:`Successfully uninstalled plugin: ${m} (scope: ${t})${D}`,pluginId:f,pluginName:m,scope:t,reverseDependents:E.length>0?E:void 0}}async function X(e,t,i){let a=t?`enable`:`disable`;if(y(e)){let{error:i}=r(`userSettings`,{enabledPlugins:{...n(`userSettings`)?.enabledPlugins,[e]:t}});if(i)return{success:!1,message:`Failed to ${a} built-in plugin: ${i.message}`};S();let{name:o}=s(e);return{success:!0,message:`Successfully ${a}d built-in plugin: ${o}`,pluginId:e,pluginName:o,scope:`user`}}i&&q(i);let c,l,u=fe(e);if(i)if(l=i,u)c=u.pluginId;else if(e.includes(`@`))c=e;else return{success:!1,message:`Plugin "${e}" not found in settings. Use plugin@marketplace format.`};else if(u)c=u.pluginId,l=u.scope;else if(e.includes(`@`))c=e,l=`user`;else return{success:!1,message:`Plugin "${e}" not found in any editable settings scope. Use plugin@marketplace format.`};if(t&&m(c))return{success:!1,message:`Plugin "${c}" is blocked by your organization's policy and cannot be enabled`};let d=b(l),f=n(d)?.enabledPlugins?.[c],p={user:0,project:1,local:2},h=i&&u&&p[i]>p[u.scope];if(i&&f===void 0&&u&&u.scope!==i&&!h)return{success:!1,message:`Plugin "${e}" is installed at ${u.scope} scope, not ${i}. Use --scope ${u.scope} or omit --scope to auto-detect.`};if(t===(i&&!h?f===!0:G().has(c)))return{success:!1,message:`Plugin "${e}" is already ${t?`enabled`:`disabled`}${i?` at ${i} scope`:``}`};let _;if(!t){let{enabled:e,disabled:t}=await g(),n=w(c,[...e,...t]);n.length>0&&(_=n)}let{error:v}=r(d,{enabledPlugins:{...n(d)?.enabledPlugins,[c]:t}});if(v)return{success:!1,message:`Failed to ${a} plugin: ${v.message}`};S();let{name:x}=s(c),C=o(_);return{success:!0,message:`Successfully ${a}d plugin: ${x} (scope: ${l})${C}`,pluginId:c,pluginName:x,scope:l,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}=s(e),i=r?`${n}@${r}`:e,a=await k(e);if(!a)return{success:!1,message:`Plugin "${n}" not found`,pluginId:i,scope:t};let{entry:o,marketplaceInstallLocation:c}=a,l=M().plugins[i];if(!l||l.length===0)return{success:!1,message:`Plugin "${n}" is not installed`,pluginId:i,scope:t};let u=J(t),d=l.find(e=>e.scope===t&&e.projectPath===u);return d?be({pluginId:i,pluginName:n,entry:o,marketplaceInstallLocation:c,installation:d,scope:t,projectPath:u}):{success:!1,message:`Plugin "${n}" is not installed at scope ${u?`${t} (${u})`:t}`,pluginId:i,scope:t}}async function be({pluginId:e,pluginName:t,entry:n,marketplaceInstallLocation:r,installation:i,scope:a,projectPath:o}){let s=z(),l=i.version,d,f,m=!1,h;if(typeof n.source!=`string`){let t=await re(n.source,{manifest:{name:n.name}});d=t.path,m=!0,h=t.gitCommitSha,f=await u(e,n.source,t.manifest,t.path,n.version,t.gitCommitSha)}else{let t;try{t=await s.stat(r)}catch(t){if(I(t))return{success:!1,message:`Marketplace directory not found at ${r}`,pluginId:e,scope:a};throw t}d=K(t.isDirectory()?r:le(r),n.source);try{await s.stat(d)}catch(t){if(I(t))return{success:!1,message:`Plugin source not found at ${d}`,pluginId:e,scope:a};throw t}let i,o=K(d,`.claude-plugin`,`plugin.json`);try{i=await P(o,n.name,n.source)}catch{}f=await u(e,n.source,i,d,n.version)}try{let r=x(e,f),s=c(e,f);if(i.version===f||i.installPath===r||i.installPath===s)return{success:!0,message:`${t} is already at the latest version (${f}).`,pluginId:e,newVersion:f,oldVersion:l,alreadyUpToDate:!0,scope:a};r=await v(d,e,f,n);let u=i.installPath;if(te(e,a,o,r,f,h),u&&u!==r){let e=M();Object.values(e.plugins).some(e=>e.some(e=>e.installPath===u))||await p(u)}let m=o?`${a} (${o})`:a;return{success:!0,message:`Plugin "${t}" updated from ${l||`unknown`} to ${f} for scope ${m}. Restart to apply changes.`,pluginId:e,newVersion:f,oldVersion:l,scope:a}}finally{m&&d!==x(e,f)&&await s.rm(d,{recursive:!0,force:!0})}}var Q,$,xe=e((()=>{i(),_(),F(),R(),B(),l(),ce(),ee(),j(),A(),T(),d(),f(),C(),oe(),W(),h(),t(),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};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{gt as t,m as n,s as r}from"./settings-D4M13toi.js";import{Ba as i,Cx as a,Dx as o,Ox as s,Ya as c,uo as l}from"./loadAgentsDir-uuZYOgKn.js";import{n as u}from"./cwd-DrEEb4f5.js";import{c as d,i as f}from"./debug-2pVES-2G.js";import{o as p}from"./log-L1kqxa_P.js";import"path";function m(){let e=new Map,t=o();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:i}of[{scope:`managed`,source:`policySettings`},{scope:`user`,source:`userSettings`},{scope:`project`,source:`projectSettings`},{scope:`local`,source:`localSettings`},{scope:`flag`,source:`flagSettings`}]){let a=r(i);if(a?.enabledPlugins)for(let[r,o]of Object.entries(a.enabledPlugins))r.includes(`@`)&&(r in t&&t[r]!==o&&d(`Plugin ${r} from --add-dir (${t[r]}) overridden by ${i} (${o})`),o===!0?e.set(r,n):o===!1&&e.delete(r))}return d(`Found ${e.size} enabled plugins with scopes: ${Array.from(e.entries()).map(([e,t])=>`${e}(${t})`).join(`, `)}`),e}var h=e((()=>{u(),f(),p(),n(),s(),c(),l(),a(),i(),t()}));export{h as n,m as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{gt as t,m as n,s as r}from"./settings-D4M13toi.js";import{Ax as i,Ha as a,Tx as o,Za as s,fo as c,kx as l}from"./loadAgentsDir-BfLCckVj.js";import{n as u}from"./cwd-DrEEb4f5.js";import{c as d,i as f}from"./debug-2pVES-2G.js";import{o as p}from"./log-L1kqxa_P.js";import"path";function m(){let e=new Map,t=l();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:i}of[{scope:`managed`,source:`policySettings`},{scope:`user`,source:`userSettings`},{scope:`project`,source:`projectSettings`},{scope:`local`,source:`localSettings`},{scope:`flag`,source:`flagSettings`}]){let a=r(i);if(a?.enabledPlugins)for(let[r,o]of Object.entries(a.enabledPlugins))r.includes(`@`)&&(r in t&&t[r]!==o&&d(`Plugin ${r} from --add-dir (${t[r]}) overridden by ${i} (${o})`),o===!0?e.set(r,n):o===!1&&e.delete(r))}return d(`Found ${e.size} enabled plugins with scopes: ${Array.from(e.entries()).map(([e,t])=>`${e}(${t})`).join(`, `)}`),e}var h=e((()=>{u(),f(),p(),n(),i(),s(),c(),o(),a(),t()}));export{h as n,m as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./pluginStartupCheck-DGDl1WOZ.js";e();export{t as getPluginEditableScopes};
@@ -0,0 +1,4 @@
1
+ import{n as e,t}from"./figures-5ThXQEtq.js";import{Bn as n,Pt as r}from"./state-CXY-q5gr.js";import{Ao as i,Dx as a,Fo as o,Fx as s,Ia as c,La as l,Mo as u,Ox as d,Po as f,Px as p,Tx as m,Za as h,bf as g,bo as _,fo as ee,go as v,ho as y,oo as b,po as x,ro as S,to as C,vo as w,wo as te,yf as ne}from"./loadAgentsDir-BfLCckVj.js";import{C as T,I as re,M as E,x as D}from"./debug-2pVES-2G.js";import{o as O,s as k}from"./log-L1kqxa_P.js";import{n as A}from"./analytics-COpjZpvd.js";import{l as j,o as M}from"./stringUtils-Cs6E5f-B.js";import{n as N,t as P}from"./exit-s9XGerrH.js";import{n as F,s as I,t as L}from"./pluginOperations-orq3bOCp.js";import{a as R,i as z,n as B,o as V,r as H,t as U}from"./pluginCliCommands-DmLsxs1M.js";import{a as W,c as G,i as ie,n as K,r as q,s as J,t as Y}from"./validatePlugin-BwcC_Wbr.js";import{basename as ae,dirname as X}from"path";e(),r(),A(),I(),s(),re(),O(),o(),G(),h(),i(),ee(),ne(),ie(),m(),c(),Y(),D(),M();function Z(e,n){k(e),P(`${t.cross} Failed to ${n}: ${E(e)}`)}function Q(e){e.errors.length>0&&(console.log(`${t.cross} Found ${e.errors.length} ${j(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} ${j(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: ${E(e)}`),process.exit(2)}}async function se(e){e.cowork&&n(!0);let r=S(),{getPluginEditableScopes:i}=await import(`./pluginStartupCheck-GHO77nmg.js`),o=i(),s=Object.keys(r.plugins),{enabled:c,disabled:d,errors:f}=await l(),m=[...c,...d],h=m.filter(e=>e.source.endsWith(`@inline`)),_=f.filter(e=>e.source.endsWith(`@inline`)||e.source.startsWith(`inline[`));if(e.json){let t=new Map(m.map(e=>[e.source,e])),n=[];for(let e of s.sort()){let i=r.plugins[e];if(!i||i.length===0)continue;let s=a(e).name,c=f.filter(t=>t.source===e||`plugin`in t&&t.plugin===s).map(p);for(let r of i){let i=t.get(e),a;if(i){let e=i.mcpServers||await g(i);e&&Object.keys(e).length>0&&(a=e)}n.push({id:e,version:r.version||`unknown`,scope:r.scope,enabled:o.has(e),installPath:r.installPath,installedAt:r.installedAt,lastUpdated:r.lastUpdated,projectPath:r.projectPath,mcpServers:a,errors:c.length>0?c:void 0})}}for(let e of h){let t=e.mcpServers||await g(e),r=_.filter(t=>t.source===e.source||`plugin`in t&&t.plugin===e.name).map(p);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 _.filter(e=>e.source.startsWith(`inline[`)))n.push({id:e.source,version:`unknown`,scope:`session`,enabled:!1,installPath:`path`in e?e.path:``,errors:[p(e)]});if(e.available){let e=[];try{let[t,n]=await Promise.all([x(),J()]),{marketplaces:r}=await u(t);for(let{name:t,data:i}of r)if(i)for(let r of i.plugins){let i=te(r.name,t);C(i)||e.push({pluginId:i,name:r.name,description:r.description,marketplaceName:t,version:r.version,source:r.source,installCount:n?.get(i)})}}catch{}N(T({installed:n,available:e},null,2))}else N(T(n,null,2))}s.length===0&&h.length===0&&_.length===0&&N("No plugins installed. Use `wm plugin install` to install a plugin."),s.length>0&&console.log(`Installed plugins:
2
+ `);for(let e of s.sort()){let n=r.plugins[e];if(!n||n.length===0)continue;let i=a(e).name,s=f.filter(t=>t.source===e||`plugin`in t&&t.plugin===i);for(let r of n){let n=o.has(e),i=s.length>0?`${t.cross} failed to load`:n?`${t.tick} enabled`:`${t.cross} disabled`,a=r.version||`unknown`,c=r.scope;console.log(` ${t.pointer} ${e}`),console.log(` Version: ${a}`),console.log(` Scope: ${c}`),console.log(` Status: ${i}`);for(let e of s)console.log(` Error: ${p(e)}`);console.log(``)}}if(h.length>0||_.length>0){console.log(`Session-only plugins (--plugin-dir):
3
+ `);for(let e of h){let n=_.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: ${p(e)}`);console.log(``)}for(let e of _.filter(e=>e.source.startsWith(`inline[`)))console.log(` ${t.pointer} ${e.source}: ${t.cross} ${p(e)}\n`)}N()}async function ce(e,r){r.cowork&&n(!0);try{let n=await W(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=d(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:l}=await b(o,e=>{console.log(e)});_(s,{source:l},a),f(),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 x(),r=Object.keys(n);e.json&&N(T(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 w(e),f(),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 v(e,e=>{console.log(e)}),f(),N(`${t.tick} Successfully updated marketplace: ${e}`);else{let e=await x(),n=Object.keys(e);n.length===0&&N(`No marketplaces configured`),console.log(`Updating ${n.length} marketplace(s)...`),await y(),f(),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:o}=a(e);({...o&&{_PROTO_marketplace_name:o}}),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:o}=a(e);({...o&&{_PROTO_marketplace_name:o}}),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:o}=a(e);({...o&&{_PROTO_marketplace_name:o}}),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:o}=a(e);({...o&&{_PROTO_marketplace_name:o}}),await B(e,r)}async function he(e,t){t.cowork&&n(!0);let{name:r,marketplace:i}=a(e);({...i&&{_PROTO_marketplace_name:i}});let o=`user`;t.scope&&(F.includes(t.scope)||P(`Invalid scope "${t.scope}". Valid scopes: ${F.join(`, `)}`),o=t.scope),t.cowork&&o!==`user`&&P(`--cowork can only be used with user scope`),await V(e,o)}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};